From 092304d9e0ccc37cc0ddaa9b136457e56a1cac20 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 12 Oct 2025 11:47:26 -0500 Subject: changing repositories --- assets/info/python.info | 532361 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 532361 insertions(+) create mode 100644 assets/info/python.info (limited to 'assets/info/python.info') diff --git a/assets/info/python.info b/assets/info/python.info new file mode 100644 index 00000000..648074b8 --- /dev/null +++ b/assets/info/python.info @@ -0,0 +1,532361 @@ +This is python.info, produced by makeinfo version 7.1 from python.texi. + + Python 3.13.7, August 14, 2025 + + Author name not set + + Copyright © 2001-2025, 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.13.7, August 14, 2025 + + Author name not set + + Copyright © 2001-2025, Python Software Foundation + +* Menu: + +* What’s New in Python:: +* The Python Tutorial:: +* Python Setup and Usage:: +* The Python Language Reference:: +* The Python Standard Library:: +* Extending and Embedding the Python Interpreter:: +* Python/C API Reference Manual:: +* Installing Python Modules:: +* Python HOWTOs:: +* Python Frequently Asked Questions:: +* Deprecations:: +* Glossary:: +* About this documentation:: +* Dealing with Bugs:: +* Copyright:: +* History and License:: +* Python Module Index:: +* Index:: + + -- The Detailed Node Listing -- + +What’s New in Python + +* 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. +* Changelog:: + +What’s New In Python 3.13 + +* Summary – Release Highlights:: +* New Features:: +* Other Language Changes:: +* New Modules:: +* Improved Modules:: +* Optimizations:: +* Removed Modules And APIs:: +* New Deprecations:: +* CPython Bytecode Changes:: +* C API Changes:: +* Build Changes:: +* Porting to Python 3.13: Porting to Python 3 13. +* Regression Test Changes:: +* Notable changes in 3.13.1: Notable changes in 3 13 1. +* Notable changes in 3.13.4: Notable changes in 3 13 4. + +New Features + +* A better interactive interpreter:: +* Improved error messages:: +* Free-threaded CPython:: +* An experimental just-in-time (JIT) compiler: An experimental just-in-time JIT compiler. +* Defined mutation semantics for locals(): Defined mutation semantics for locals. +* Support for mobile platforms:: + +Improved Modules + +* argparse:: +* array:: +* ast:: +* asyncio:: +* base64:: +* compileall:: +* concurrent.futures: concurrent futures. +* configparser:: +* copy:: +* ctypes:: +* dbm:: +* dis:: +* doctest:: +* email:: +* enum:: +* fractions:: +* glob:: +* importlib:: +* io:: +* ipaddress:: +* itertools:: +* marshal:: +* math:: +* mimetypes:: +* mmap:: +* multiprocessing:: +* os:: +* os.path: os path. +* pathlib:: +* pdb:: +* queue:: +* random:: +* re:: +* shutil:: +* site:: +* sqlite3:: +* ssl:: +* statistics:: +* subprocess:: +* sys:: +* tempfile:: +* time:: +* tkinter:: +* traceback:: +* types:: +* typing:: +* unicodedata:: +* venv:: +* warnings:: +* xml:: +* zipimport:: + +Removed Modules And APIs + +* PEP 594; Remove “dead batteries” from the standard library: PEP 594 Remove “dead batteries” from the standard library. +* 2to3:: +* builtins:: +* configparser: configparser<2>. +* importlib.metadata: importlib metadata. +* locale:: +* opcode:: +* optparse:: +* pathlib: pathlib<2>. +* re: re<2>. +* tkinter.tix: tkinter tix. +* turtle:: +* typing: typing<2>. +* unittest:: +* urllib:: +* webbrowser:: + +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. +* Pending removal in Python 3.16: Pending removal in Python 3 16. +* Pending Removal in Future Versions:: + +C API Changes + +* New Features: New Features<2>. +* Changed C APIs:: +* Limited C API Changes:: +* Removed C APIs:: +* Deprecated C APIs:: + +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<2>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<2>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<2>. + +Porting to Python 3.13 + +* Changes in the Python API:: +* Changes in the C API:: + +Notable changes in 3.13.1 + +* sys: sys<2>. + +Notable changes in 3.13.4 + +* os.path: os path<2>. +* tarfile:: + +What’s New In Python 3.12 + +* Summary – Release highlights:: +* New Features: New Features<3>. +* New Features Related to Type Hints:: +* Other Language Changes: Other Language Changes<2>. +* New Modules: New Modules<2>. +* Improved Modules: Improved Modules<2>. +* Optimizations: Optimizations<2>. +* CPython bytecode changes:: +* Demos and Tools:: +* Deprecated:: +* Removed:: +* Porting to Python 3.12: Porting to Python 3 12. +* Build Changes: Build Changes<2>. +* C API Changes: C API Changes<2>. + +New Features + +* PEP 695; Type Parameter Syntax: PEP 695 Type Parameter Syntax. +* PEP 701; Syntactic formalization of f-strings: PEP 701 Syntactic formalization of f-strings. +* PEP 684; A Per-Interpreter GIL: PEP 684 A Per-Interpreter GIL. +* PEP 669; Low impact monitoring for CPython: PEP 669 Low impact monitoring for CPython. +* PEP 688; Making the buffer protocol accessible in Python: PEP 688 Making the buffer protocol accessible in Python. +* PEP 709; Comprehension inlining: PEP 709 Comprehension inlining. +* Improved Error Messages:: + +New Features Related to Type Hints + +* 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. + +Improved Modules + +* array: array<2>. +* asyncio: asyncio<2>. +* calendar:: +* csv:: +* dis: dis<2>. +* fractions: fractions<2>. +* importlib.resources: importlib resources. +* inspect:: +* itertools: itertools<2>. +* math: math<2>. +* os: os<2>. +* os.path: os path<3>. +* pathlib: pathlib<3>. +* platform:: +* pdb: pdb<2>. +* random: random<2>. +* shutil: shutil<2>. +* sqlite3: sqlite3<2>. +* statistics: statistics<2>. +* sys: sys<3>. +* tempfile: tempfile<2>. +* threading:: +* tkinter: tkinter<2>. +* tokenize:: +* types: types<2>. +* typing: typing<3>. +* unicodedata: unicodedata<2>. +* unittest: unittest<2>. +* uuid:: + +Deprecated + +* 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<3>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<3>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<3>. + +Removed + +* asynchat and asyncore:: +* configparser: configparser<3>. +* distutils:: +* ensurepip:: +* enum: enum<2>. +* ftplib:: +* gzip:: +* hashlib:: +* importlib: importlib<2>. +* imp:: +* io: io<2>. +* locale: locale<2>. +* smtpd:: +* sqlite3: sqlite3<3>. +* ssl: ssl<2>. +* unittest: unittest<3>. +* webbrowser: webbrowser<2>. +* xml.etree.ElementTree: xml etree ElementTree. +* zipimport: zipimport<2>. +* Others:: + +Porting to Python 3.12 + +* Changes in the Python API: Changes in the Python API<2>. + +C API Changes + +* New Features: New Features<4>. +* Porting to Python 3.12: Porting to Python 3 12<2>. +* Deprecated: Deprecated<2>. +* Removed: Removed<2>. + +Deprecated + +* 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<4>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<4>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<4>. + +What’s New In Python 3.11 + +* Summary – Release highlights: Summary – Release highlights<2>. +* New Features: New Features<5>. +* New Features Related to Type Hints: New Features Related to Type Hints<2>. +* Other Language Changes: Other Language Changes<3>. +* Other CPython Implementation Changes:: +* New Modules: New Modules<3>. +* Improved Modules: Improved Modules<3>. +* Optimizations: Optimizations<3>. +* Faster CPython:: +* CPython bytecode changes: CPython bytecode changes<2>. +* Deprecated: Deprecated<3>. +* Pending Removal in Python 3.12: Pending Removal in Python 3 12. +* Removed: Removed<3>. +* Porting to Python 3.11: Porting to Python 3 11. +* Build Changes: Build Changes<3>. +* C API Changes: C API Changes<3>. +* Notable changes in 3.11.4: Notable changes in 3 11 4. +* Notable changes in 3.11.5: Notable changes in 3 11 5. + +New Features + +* PEP 657; Fine-grained error locations in tracebacks: PEP 657 Fine-grained error locations in tracebacks. +* PEP 654; Exception Groups and except*: PEP 654 Exception Groups and except*. +* PEP 678; Exceptions can be enriched with notes: PEP 678 Exceptions can be enriched with notes. +* Windows py.exe launcher improvements: Windows py exe launcher improvements. + +New Features Related to Type Hints + +* 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 type: PEP 673 Self type. +* 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:: + +Improved Modules + +* asyncio: asyncio<3>. +* contextlib:: +* dataclasses:: +* datetime:: +* enum: enum<3>. +* fcntl:: +* fractions: fractions<3>. +* functools:: +* gzip: gzip<2>. +* hashlib: hashlib<2>. +* IDLE and idlelib:: +* inspect: inspect<2>. +* locale: locale<3>. +* logging:: +* math: math<3>. +* operator:: +* os: os<3>. +* pathlib: pathlib<4>. +* re: re<3>. +* shutil: shutil<3>. +* socket:: +* sqlite3: sqlite3<4>. +* string:: +* sys: sys<4>. +* sysconfig:: +* tempfile: tempfile<3>. +* threading: threading<2>. +* time: time<2>. +* tkinter: tkinter<3>. +* traceback: traceback<2>. +* typing: typing<4>. +* unicodedata: unicodedata<3>. +* unittest: unittest<4>. +* venv: venv<2>. +* warnings: warnings<2>. +* zipfile:: + +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 bytecode changes + +* New opcodes:: +* Replaced opcodes:: +* Changed/removed opcodes:: + +Deprecated + +* Language/Builtins:: +* Modules:: +* Standard Library:: + +C API Changes + +* New Features: New Features<6>. +* Porting to Python 3.11: Porting to Python 3 11<2>. +* Deprecated: Deprecated<4>. +* Pending Removal in Python 3.12: Pending Removal in Python 3 12<2>. +* Removed: Removed<4>. + +Notable changes in 3.11.4 + +* tarfile: tarfile<2>. + +Notable changes in 3.11.5 + +* OpenSSL:: + +What’s New In Python 3.10 + +* Summary – Release highlights: Summary – Release highlights<3>. +* New Features: New Features<7>. +* New Features Related to Type Hints: New Features Related to Type Hints<3>. +* Other Language Changes: Other Language Changes<4>. +* New Modules: New Modules<4>. +* Improved Modules: Improved Modules<4>. +* Optimizations: Optimizations<4>. +* Deprecated: Deprecated<5>. +* Removed: Removed<5>. +* Porting to Python 3.10: Porting to Python 3 10. +* CPython bytecode changes: CPython bytecode changes<3>. +* Build Changes: Build Changes<4>. +* C API Changes: C API Changes<4>. +* 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. + +New Features + +* Parenthesized context managers:: +* Better error messages:: +* PEP 626; Precise line numbers for debugging and other tools: PEP 626 Precise line numbers for debugging and other tools. +* PEP 634; Structural Pattern Matching: PEP 634 Structural Pattern Matching. +* Optional EncodingWarning and encoding="locale" option:: + +Better error messages + +* SyntaxErrors:: +* IndentationErrors:: +* AttributeErrors:: +* NameErrors:: + +PEP 634: Structural Pattern Matching + +* Syntax and operations:: +* Declarative approach:: +* Simple pattern; match to a literal: Simple pattern match to a literal. +* Patterns with a literal and variable:: +* Patterns and classes:: +* Nested patterns:: +* Complex patterns and the wildcard:: +* Guard:: +* Other Key Features:: + +Simple pattern: match to a literal + +* Behavior without the wildcard:: + +Patterns and classes + +* Patterns with positional parameters:: + +New Features Related to Type Hints + +* 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. + +Improved Modules + +* asyncio: asyncio<4>. +* argparse: argparse<2>. +* array: array<3>. +* asynchat, asyncore, smtpd: asynchat asyncore smtpd. +* base64: base64<2>. +* bdb:: +* bisect:: +* codecs:: +* collections.abc: collections abc. +* contextlib: contextlib<2>. +* curses:: +* dataclasses: dataclasses<2>. +* distutils: distutils<2>. +* doctest: doctest<2>. +* encodings:: +* enum: enum<4>. +* fileinput:: +* faulthandler:: +* gc:: +* glob: glob<2>. +* hashlib: hashlib<3>. +* hmac:: +* IDLE and idlelib: IDLE and idlelib<2>. +* importlib.metadata: importlib metadata<2>. +* inspect: inspect<3>. +* itertools: itertools<3>. +* linecache:: +* os: os<4>. +* os.path: os path<4>. +* pathlib: pathlib<5>. +* platform: platform<2>. +* pprint:: +* py_compile:: +* pyclbr:: +* shelve:: +* statistics: statistics<3>. +* site: site<2>. +* socket: socket<2>. +* ssl: ssl<3>. +* sqlite3: sqlite3<5>. +* sys: sys<5>. +* _thread:: +* threading: threading<3>. +* traceback: traceback<3>. +* types: types<3>. +* typing: typing<5>. +* unittest: unittest<5>. +* urllib.parse: urllib parse. +* xml: xml<2>. +* zipimport: zipimport<3>. + +dataclasses + +* __slots__:: +* Keyword-only fields:: + +Porting to Python 3.10 + +* Changes in the Python syntax:: +* Changes in the Python API: Changes in the Python API<3>. +* Changes in the C API: Changes in the C API<2>. + +C API Changes + +* PEP 652; Maintaining the Stable ABI: PEP 652 Maintaining the Stable ABI. +* New Features: New Features<8>. +* Porting to Python 3.10: Porting to Python 3 10<2>. +* Deprecated: Deprecated<6>. +* Removed: Removed<6>. + +Notable changes in 3.10.12 + +* tarfile: tarfile<3>. + +What’s New In Python 3.9 + +* Summary – Release highlights: Summary – Release highlights<4>. +* You should check for DeprecationWarning in your code:: +* New Features: New Features<9>. +* Other Language Changes: Other Language Changes<5>. +* New Modules: New Modules<5>. +* Improved Modules: Improved Modules<5>. +* Optimizations: Optimizations<5>. +* Deprecated: Deprecated<7>. +* Removed: Removed<7>. +* Porting to Python 3.9: Porting to Python 3 9. +* Build Changes: Build Changes<5>. +* C API Changes: C API Changes<5>. +* Notable changes in Python 3.9.1: Notable changes in Python 3 9 1. +* Notable changes in Python 3.9.2: Notable changes in Python 3 9 2. +* Notable changes in Python 3.9.3: Notable changes in Python 3 9 3. +* Notable changes in Python 3.9.5: Notable changes in 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. + +New Features + +* Dictionary Merge & Update Operators:: +* New String Methods to Remove Prefixes and Suffixes:: +* Type Hinting Generics in Standard Collections:: +* New Parser:: + +New Modules + +* zoneinfo:: +* graphlib:: + +Improved Modules + +* ast: ast<2>. +* asyncio: asyncio<5>. +* compileall: compileall<2>. +* concurrent.futures: concurrent futures<2>. +* curses: curses<2>. +* datetime: datetime<2>. +* distutils: distutils<3>. +* fcntl: fcntl<2>. +* ftplib: ftplib<2>. +* gc: gc<2>. +* hashlib: hashlib<4>. +* http:: +* IDLE and idlelib: IDLE and idlelib<3>. +* imaplib:: +* importlib: importlib<3>. +* inspect: inspect<4>. +* ipaddress: ipaddress<2>. +* math: math<4>. +* multiprocessing: multiprocessing<2>. +* nntplib:: +* os: os<5>. +* pathlib: pathlib<6>. +* pdb: pdb<3>. +* poplib:: +* pprint: pprint<2>. +* pydoc:: +* random: random<3>. +* signal:: +* smtplib:: +* socket: socket<3>. +* time: time<3>. +* sys: sys<6>. +* tracemalloc:: +* typing: typing<6>. +* unicodedata: unicodedata<4>. +* venv: venv<3>. +* xml: xml<3>. + +Porting to Python 3.9 + +* Changes in the Python API: Changes in the Python API<4>. +* Changes in the C API: Changes in the C API<3>. +* CPython bytecode changes: CPython bytecode changes<4>. + +C API Changes + +* New Features: New Features<10>. +* Porting to Python 3.9: Porting to Python 3 9<2>. +* Removed: Removed<8>. + +Notable changes in Python 3.9.1 + +* typing: typing<7>. +* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support. + +Notable changes in Python 3.9.2 + +* collections.abc: collections abc<2>. +* urllib.parse: urllib parse<2>. + +Notable changes in Python 3.9.5 + +* urllib.parse: urllib parse<3>. + +Notable changes in 3.9.17 + +* tarfile: tarfile<4>. + +What’s New In Python 3.8 + +* Summary – Release highlights: Summary – Release highlights<5>. +* New Features: New Features<11>. +* Other Language Changes: Other Language Changes<6>. +* New Modules: New Modules<6>. +* Improved Modules: Improved Modules<6>. +* Optimizations: Optimizations<6>. +* Build and C API Changes:: +* Deprecated: Deprecated<8>. +* API and Feature Removals:: +* Porting to Python 3.8: Porting to Python 3 8. +* Notable changes in Python 3.8.1: Notable changes in Python 3 8 1. +* Notable changes in Python 3.8.2: Notable changes in Python 3 8 2. +* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3. +* Notable changes in Python 3.8.8: Notable changes in Python 3 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. + +New Features + +* Assignment expressions:: +* Positional-only parameters:: +* Parallel filesystem cache for compiled bytecode files:: +* Debug build uses the same ABI as release build:: +* f-strings support = for self-documenting expressions and debugging:: +* PEP 578; Python Runtime Audit Hooks: PEP 578 Python Runtime Audit Hooks. +* PEP 587; Python Initialization Configuration: PEP 587 Python Initialization Configuration. +* PEP 590; Vectorcall; a fast calling protocol for CPython: PEP 590 Vectorcall a fast calling protocol for CPython. +* Pickle protocol 5 with out-of-band data buffers:: + +Improved Modules + +* ast: ast<3>. +* asyncio: asyncio<6>. +* builtins: builtins<2>. +* collections:: +* cProfile:: +* csv: csv<2>. +* curses: curses<3>. +* ctypes: ctypes<2>. +* datetime: datetime<3>. +* functools: functools<2>. +* gc: gc<3>. +* gettext:: +* gzip: gzip<3>. +* IDLE and idlelib: IDLE and idlelib<4>. +* inspect: inspect<5>. +* io: io<3>. +* itertools: itertools<4>. +* json.tool: json tool. +* logging: logging<2>. +* math: math<5>. +* mmap: mmap<2>. +* multiprocessing: multiprocessing<3>. +* os: os<6>. +* os.path: os path<5>. +* pathlib: pathlib<7>. +* pickle:: +* plistlib:: +* pprint: pprint<3>. +* py_compile: py_compile<2>. +* shlex:: +* shutil: shutil<4>. +* socket: socket<4>. +* ssl: ssl<4>. +* statistics: statistics<4>. +* sys: sys<7>. +* tarfile: tarfile<5>. +* threading: threading<4>. +* tokenize: tokenize<2>. +* tkinter: tkinter<4>. +* time: time<4>. +* typing: typing<8>. +* unicodedata: unicodedata<5>. +* unittest: unittest<6>. +* venv: venv<4>. +* weakref:: +* xml: xml<4>. +* xmlrpc:: + +Porting to Python 3.8 + +* Changes in Python behavior:: +* Changes in the Python API: Changes in the Python API<5>. +* Changes in the C API: Changes in the C API<4>. +* CPython bytecode changes: CPython bytecode changes<5>. +* Demos and Tools: Demos and Tools<2>. + +Notable changes in Python 3.8.10 + +* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support<2>. + +Notable changes in Python 3.8.10 + +* urllib.parse: urllib parse<4>. + +Notable changes in Python 3.8.12 + +* Changes in the Python API: Changes in the Python API<6>. + +Notable changes in 3.8.17 + +* tarfile: tarfile<6>. + +What’s New In Python 3.7 + +* Summary – Release Highlights: Summary – Release Highlights<2>. +* New Features: New Features<12>. +* Other Language Changes: Other Language Changes<7>. +* New Modules: New Modules<7>. +* Improved Modules: Improved Modules<7>. +* C API Changes: C API Changes<6>. +* Build Changes: Build Changes<6>. +* Optimizations: Optimizations<7>. +* Other CPython Implementation Changes: Other CPython Implementation Changes<2>. +* Deprecated Python Behavior:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods. +* Deprecated functions and types of the C API:: +* Platform Support Removals:: +* API and Feature Removals: API and Feature Removals<2>. +* Module Removals:: +* Windows-only Changes:: +* Porting to Python 3.7: Porting to Python 3 7. +* Notable changes in Python 3.7.1: Notable changes in Python 3 7 1. +* Notable changes in Python 3.7.2: Notable changes in Python 3 7 2. +* Notable changes in Python 3.7.6: Notable changes in Python 3 7 6. +* Notable changes in Python 3.7.10: Notable changes in 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. + +New Features + +* PEP 563; Postponed Evaluation of Annotations: PEP 563 Postponed Evaluation of Annotations. +* PEP 538; Legacy C Locale Coercion: PEP 538 Legacy C Locale Coercion. +* PEP 540; Forced UTF-8 Runtime Mode: PEP 540 Forced UTF-8 Runtime Mode. +* PEP 553; Built-in breakpoint(): PEP 553 Built-in breakpoint. +* PEP 539; New C API for Thread-Local Storage: PEP 539 New C API for Thread-Local Storage. +* PEP 562; Customization of Access to Module Attributes: PEP 562 Customization of Access to Module Attributes. +* PEP 564; New Time Functions With Nanosecond Resolution: PEP 564 New Time Functions With Nanosecond Resolution. +* PEP 565; Show DeprecationWarning in __main__: PEP 565 Show DeprecationWarning in __main__. +* PEP 560; Core Support for typing module and Generic Types: PEP 560 Core Support for typing module and Generic Types. +* 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. + +New Modules + +* contextvars:: +* dataclasses: dataclasses<3>. +* importlib.resources: importlib resources<2>. + +Improved Modules + +* argparse: argparse<3>. +* asyncio: asyncio<7>. +* binascii:: +* calendar: calendar<2>. +* collections: collections<2>. +* compileall: compileall<3>. +* concurrent.futures: concurrent futures<3>. +* contextlib: contextlib<3>. +* cProfile: cProfile<2>. +* crypt:: +* datetime: datetime<4>. +* dbm: dbm<2>. +* decimal:: +* dis: dis<3>. +* distutils: distutils<4>. +* enum: enum<5>. +* functools: functools<3>. +* gc: gc<4>. +* hmac: hmac<2>. +* http.client: http client. +* http.server: http server. +* idlelib and IDLE:: +* importlib: importlib<4>. +* io: io<4>. +* ipaddress: ipaddress<3>. +* itertools: itertools<5>. +* locale: locale<4>. +* logging: logging<3>. +* math: math<6>. +* mimetypes: mimetypes<2>. +* msilib:: +* multiprocessing: multiprocessing<4>. +* os: os<7>. +* pathlib: pathlib<8>. +* pdb: pdb<4>. +* py_compile: py_compile<3>. +* pydoc: pydoc<2>. +* queue: queue<2>. +* re: re<4>. +* signal: signal<2>. +* socket: socket<5>. +* socketserver:: +* sqlite3: sqlite3<6>. +* ssl: ssl<5>. +* string: string<2>. +* subprocess: subprocess<2>. +* sys: sys<8>. +* time: time<5>. +* tkinter: tkinter<5>. +* tracemalloc: tracemalloc<2>. +* types: types<4>. +* unicodedata: unicodedata<6>. +* unittest: unittest<7>. +* unittest.mock: unittest mock. +* urllib.parse: urllib parse<5>. +* uu:: +* uuid: uuid<2>. +* warnings: warnings<3>. +* xml: xml<5>. +* xml.etree: xml etree. +* xmlrpc.server: xmlrpc server. +* zipapp:: +* zipfile: zipfile<2>. + +Deprecated Python modules, functions and methods + +* aifc:: +* asyncio: asyncio<8>. +* collections: collections<3>. +* dbm: dbm<3>. +* enum: enum<6>. +* gettext: gettext<2>. +* importlib: importlib<5>. +* locale: locale<5>. +* macpath:: +* threading: threading<5>. +* socket: socket<6>. +* ssl: ssl<6>. +* sunau:: +* sys: sys<9>. +* wave:: + +Porting to Python 3.7 + +* Changes in Python Behavior:: +* Changes in the Python API: Changes in the Python API<7>. +* Changes in the C API: Changes in the C API<5>. +* CPython bytecode changes: CPython bytecode changes<6>. +* Windows-only Changes: Windows-only Changes<2>. +* Other CPython implementation changes:: + +What’s New In Python 3.6 + +* Summary – Release highlights: Summary – Release highlights<6>. +* New Features: New Features<13>. +* Other Language Changes: Other Language Changes<8>. +* New Modules: New Modules<8>. +* Improved Modules: Improved Modules<8>. +* Optimizations: Optimizations<8>. +* Build and C API Changes: Build and C API Changes<2>. +* Other Improvements:: +* Deprecated: Deprecated<9>. +* Removed: Removed<9>. +* Porting to Python 3.6: Porting to 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. + +New Features + +* PEP 498; Formatted string literals: PEP 498 Formatted string literals. +* PEP 526; Syntax for variable annotations: PEP 526 Syntax for variable annotations. +* PEP 515; Underscores in Numeric Literals: PEP 515 Underscores in Numeric Literals. +* PEP 525; Asynchronous Generators: PEP 525 Asynchronous Generators. +* PEP 530; Asynchronous Comprehensions: PEP 530 Asynchronous Comprehensions. +* PEP 487; Simpler customization of class creation: PEP 487 Simpler customization of class creation. +* PEP 487; Descriptor Protocol Enhancements: PEP 487 Descriptor Protocol Enhancements. +* PEP 519; Adding a file system path protocol: PEP 519 Adding a file system path protocol. +* PEP 495; Local Time Disambiguation: PEP 495 Local Time Disambiguation. +* PEP 529; Change Windows filesystem encoding to UTF-8: PEP 529 Change Windows filesystem encoding to UTF-8. +* PEP 528; Change Windows console encoding to UTF-8: PEP 528 Change Windows console encoding to UTF-8. +* PEP 520; Preserving Class Attribute Definition Order: PEP 520 Preserving Class Attribute Definition Order. +* PEP 468; Preserving Keyword Argument Order: PEP 468 Preserving Keyword Argument Order. +* New dict implementation:: +* PEP 523; Adding a frame evaluation API to CPython: PEP 523 Adding a frame evaluation API to CPython. +* PYTHONMALLOC environment variable:: +* DTrace and SystemTap probing support:: + +New Modules + +* secrets:: + +Improved Modules + +* array: array<4>. +* ast: ast<4>. +* asyncio: asyncio<9>. +* binascii: binascii<2>. +* cmath:: +* collections: collections<4>. +* concurrent.futures: concurrent futures<4>. +* contextlib: contextlib<4>. +* datetime: datetime<5>. +* decimal: decimal<2>. +* distutils: distutils<5>. +* email: email<2>. +* encodings: encodings<2>. +* enum: enum<7>. +* faulthandler: faulthandler<2>. +* fileinput: fileinput<2>. +* hashlib: hashlib<5>. +* http.client: http client<2>. +* idlelib and IDLE: idlelib and IDLE<2>. +* importlib: importlib<6>. +* inspect: inspect<6>. +* json:: +* logging: logging<4>. +* math: math<7>. +* multiprocessing: multiprocessing<5>. +* os: os<8>. +* pathlib: pathlib<9>. +* pdb: pdb<5>. +* pickle: pickle<2>. +* pickletools:: +* pydoc: pydoc<3>. +* random: random<4>. +* re: re<5>. +* readline:: +* rlcompleter:: +* shlex: shlex<2>. +* site: site<3>. +* sqlite3: sqlite3<7>. +* socket: socket<7>. +* socketserver: socketserver<2>. +* ssl: ssl<7>. +* statistics: statistics<5>. +* struct:: +* subprocess: subprocess<3>. +* sys: sys<10>. +* telnetlib:: +* time: time<6>. +* timeit:: +* tkinter: tkinter<6>. +* traceback: traceback<4>. +* tracemalloc: tracemalloc<3>. +* typing: typing<9>. +* unicodedata: unicodedata<7>. +* unittest.mock: unittest mock<2>. +* urllib.request: urllib request. +* urllib.robotparser: urllib robotparser. +* venv: venv<5>. +* warnings: warnings<4>. +* winreg:: +* winsound:: +* xmlrpc.client: xmlrpc client. +* zipfile: zipfile<3>. +* zlib:: + +Deprecated + +* New Keywords:: +* Deprecated Python behavior:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<2>. +* xml: xml<6>. +* Deprecated functions and types of the C API: Deprecated functions and types of the C API<2>. +* Deprecated Build Options:: + +Deprecated Python modules, functions and methods + +* asynchat:: +* asyncore:: +* dbm: dbm<4>. +* distutils: distutils<6>. +* grp:: +* importlib: importlib<7>. +* os: os<9>. +* re: re<6>. +* ssl: ssl<8>. +* tkinter: tkinter<7>. +* venv: venv<6>. + +Removed + +* API and Feature Removals: API and Feature Removals<3>. + +Porting to Python 3.6 + +* Changes in ‘python’ Command Behavior:: +* Changes in the Python API: Changes in the Python API<8>. +* Changes in the C API: Changes in the C API<6>. +* CPython bytecode changes: CPython bytecode changes<7>. + +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 + +* Summary – Release highlights: Summary – Release highlights<7>. +* New Features: New Features<14>. +* Other Language Changes: Other Language Changes<9>. +* New Modules: New Modules<9>. +* Improved Modules: Improved Modules<9>. +* Other module-level changes:: +* Optimizations: Optimizations<9>. +* Build and C API Changes: Build and C API Changes<3>. +* Deprecated: Deprecated<10>. +* Removed: Removed<10>. +* Porting to Python 3.5: Porting to Python 3 5. +* Notable changes in Python 3.5.4: Notable changes in Python 3 5 4. + +New Features + +* PEP 492 - Coroutines with async and await syntax:: +* PEP 465 - A dedicated infix operator for matrix multiplication:: +* PEP 448 - Additional Unpacking Generalizations:: +* PEP 461 - percent formatting support for bytes and bytearray:: +* PEP 484 - Type Hints:: +* PEP 471 - os.scandir() function – a better and faster directory iterator: PEP 471 - os scandir function – a better and faster directory iterator. +* PEP 475; Retry system calls failing with EINTR: PEP 475 Retry system calls failing with EINTR. +* PEP 479; Change StopIteration handling inside generators: PEP 479 Change StopIteration handling inside generators. +* PEP 485; A function for testing approximate equality: PEP 485 A function for testing approximate equality. +* PEP 486; Make the Python Launcher aware of virtual environments: PEP 486 Make the Python Launcher aware of virtual environments. +* PEP 488; Elimination of PYO files: PEP 488 Elimination of PYO files. +* PEP 489; Multi-phase extension module initialization: PEP 489 Multi-phase extension module initialization. + +New Modules + +* typing: typing<10>. +* zipapp: zipapp<2>. + +Improved Modules + +* argparse: argparse<4>. +* asyncio: asyncio<10>. +* bz2:: +* cgi:: +* cmath: cmath<2>. +* code:: +* collections: collections<5>. +* collections.abc: collections abc<3>. +* compileall: compileall<4>. +* concurrent.futures: concurrent futures<5>. +* configparser: configparser<4>. +* contextlib: contextlib<5>. +* csv: csv<3>. +* curses: curses<4>. +* dbm: dbm<5>. +* difflib:: +* distutils: distutils<7>. +* doctest: doctest<3>. +* email: email<3>. +* enum: enum<8>. +* faulthandler: faulthandler<3>. +* functools: functools<4>. +* glob: glob<3>. +* gzip: gzip<4>. +* heapq:: +* http: http<2>. +* http.client: http client<3>. +* idlelib and IDLE: idlelib and IDLE<3>. +* imaplib: imaplib<2>. +* imghdr:: +* importlib: importlib<8>. +* inspect: inspect<7>. +* io: io<5>. +* ipaddress: ipaddress<4>. +* json: json<2>. +* linecache: linecache<2>. +* locale: locale<6>. +* logging: logging<5>. +* lzma:: +* math: math<8>. +* multiprocessing: multiprocessing<6>. +* operator: operator<2>. +* os: os<10>. +* pathlib: pathlib<10>. +* pickle: pickle<3>. +* poplib: poplib<2>. +* re: re<7>. +* readline: readline<2>. +* selectors:: +* shutil: shutil<5>. +* signal: signal<3>. +* smtpd: smtpd<2>. +* smtplib: smtplib<2>. +* sndhdr:: +* socket: socket<8>. +* ssl: ssl<9>. +* sqlite3: sqlite3<8>. +* subprocess: subprocess<4>. +* sys: sys<11>. +* sysconfig: sysconfig<2>. +* tarfile: tarfile<7>. +* threading: threading<6>. +* time: time<7>. +* timeit: timeit<2>. +* tkinter: tkinter<8>. +* traceback: traceback<5>. +* types: types<5>. +* unicodedata: unicodedata<8>. +* unittest: unittest<8>. +* unittest.mock: unittest mock<3>. +* urllib: urllib<2>. +* wsgiref:: +* xmlrpc: xmlrpc<2>. +* xml.sax: xml sax. +* zipfile: zipfile<4>. + +ssl + +* Memory BIO Support:: +* Application-Layer Protocol Negotiation Support:: +* Other Changes:: + +Deprecated + +* New Keywords: New Keywords<2>. +* Deprecated Python Behavior: Deprecated Python Behavior<2>. +* Unsupported Operating Systems:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<3>. + +Removed + +* API and Feature Removals: API and Feature Removals<4>. + +Porting to Python 3.5 + +* Changes in Python behavior: Changes in Python behavior<2>. +* Changes in the Python API: Changes in the Python API<9>. +* Changes in the C API: Changes in the C API<7>. + +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 + +* Summary – Release Highlights: Summary – Release Highlights<3>. +* New Features: New Features<15>. +* New Modules: New Modules<10>. +* Improved Modules: Improved Modules<10>. +* CPython Implementation Changes:: +* Deprecated: Deprecated<11>. +* Removed: Removed<11>. +* Porting to Python 3.4: Porting to Python 3 4. +* Changed in 3.4.3: Changed in 3 4 3. + +New Features + +* PEP 453; Explicit Bootstrapping of PIP in Python Installations: PEP 453 Explicit Bootstrapping of PIP in Python Installations. +* PEP 446; Newly Created File Descriptors Are Non-Inheritable: PEP 446 Newly Created File Descriptors Are Non-Inheritable. +* Improvements to Codec Handling:: +* PEP 451; A ModuleSpec Type for the Import System: PEP 451 A ModuleSpec Type for the Import System. +* Other Language Changes: Other Language Changes<10>. + +PEP 453: Explicit Bootstrapping of PIP in Python Installations + +* Bootstrapping pip By Default:: +* Documentation Changes:: + +New Modules + +* asyncio: asyncio<11>. +* ensurepip: ensurepip<2>. +* enum: enum<9>. +* pathlib: pathlib<11>. +* selectors: selectors<2>. +* statistics: statistics<6>. +* tracemalloc: tracemalloc<4>. + +Improved Modules + +* abc:: +* aifc: aifc<2>. +* argparse: argparse<5>. +* audioop:: +* base64: base64<3>. +* collections: collections<6>. +* colorsys:: +* contextlib: contextlib<6>. +* dbm: dbm<6>. +* dis: dis<4>. +* doctest: doctest<4>. +* email: email<4>. +* filecmp:: +* functools: functools<5>. +* gc: gc<5>. +* glob: glob<4>. +* hashlib: hashlib<6>. +* hmac: hmac<3>. +* html:: +* http: http<3>. +* idlelib and IDLE: idlelib and IDLE<4>. +* importlib: importlib<9>. +* inspect: inspect<8>. +* ipaddress: ipaddress<5>. +* logging: logging<6>. +* marshal: marshal<2>. +* mmap: mmap<3>. +* multiprocessing: multiprocessing<7>. +* operator: operator<3>. +* os: os<11>. +* pdb: pdb<6>. +* pickle: pickle<4>. +* plistlib: plistlib<2>. +* poplib: poplib<3>. +* pprint: pprint<4>. +* pty:: +* pydoc: pydoc<4>. +* re: re<8>. +* resource:: +* select:: +* shelve: shelve<2>. +* shutil: shutil<6>. +* smtpd: smtpd<3>. +* smtplib: smtplib<3>. +* socket: socket<9>. +* sqlite3: sqlite3<9>. +* ssl: ssl<10>. +* stat:: +* struct: struct<2>. +* subprocess: subprocess<5>. +* sunau: sunau<2>. +* sys: sys<12>. +* tarfile: tarfile<8>. +* textwrap:: +* threading: threading<7>. +* traceback: traceback<6>. +* types: types<6>. +* urllib: urllib<3>. +* unittest: unittest<9>. +* venv: venv<7>. +* wave: wave<2>. +* weakref: weakref<2>. +* xml.etree: xml etree<2>. +* zipfile: zipfile<5>. + +CPython Implementation Changes + +* PEP 445; Customization of CPython Memory Allocators: PEP 445 Customization of CPython Memory Allocators. +* PEP 442; Safe Object Finalization: PEP 442 Safe Object Finalization. +* PEP 456; Secure and Interchangeable Hash Algorithm: PEP 456 Secure and Interchangeable Hash Algorithm. +* PEP 436; Argument Clinic: PEP 436 Argument Clinic. +* Other Build and C API Changes:: +* Other Improvements: Other Improvements<2>. +* Significant Optimizations:: + +Deprecated + +* Deprecations in the Python API:: +* Deprecated Features:: + +Removed + +* Operating Systems No Longer Supported:: +* API and Feature Removals: API and Feature Removals<5>. +* Code Cleanups:: + +Porting to Python 3.4 + +* Changes in ‘python’ Command Behavior: Changes in ‘python’ Command Behavior<2>. +* Changes in the Python API: Changes in the Python API<10>. +* Changes in the C API: Changes in the C API<8>. + +Changed in 3.4.3 + +* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients. + +What’s New In Python 3.3 + +* Summary – Release highlights: Summary – Release highlights<8>. +* PEP 405; Virtual Environments: PEP 405 Virtual Environments. +* PEP 420; Implicit Namespace Packages: PEP 420 Implicit Namespace Packages. +* PEP 3118; New memoryview implementation and buffer protocol documentation: PEP 3118 New memoryview implementation and buffer protocol documentation. +* PEP 393; Flexible String Representation: PEP 393 Flexible String Representation. +* PEP 397; Python Launcher for Windows: PEP 397 Python Launcher for Windows. +* PEP 3151; Reworking the OS and IO exception hierarchy: PEP 3151 Reworking the OS and IO exception hierarchy. +* PEP 380; Syntax for Delegating to a Subgenerator: PEP 380 Syntax for Delegating to a Subgenerator. +* PEP 409; Suppressing exception context: PEP 409 Suppressing exception context. +* PEP 414; Explicit Unicode literals: PEP 414 Explicit Unicode literals. +* PEP 3155; Qualified name for classes and functions: PEP 3155 Qualified name for classes and functions. +* PEP 412; Key-Sharing Dictionary: PEP 412 Key-Sharing Dictionary. +* PEP 362; Function Signature Object: PEP 362 Function Signature Object. +* PEP 421; Adding sys.implementation: PEP 421 Adding sys implementation. +* Using importlib as the Implementation of Import:: +* Other Language Changes: Other Language Changes<11>. +* A Finer-Grained Import Lock:: +* Builtin functions and types:: +* New Modules: New Modules<11>. +* Improved Modules: Improved Modules<11>. +* Optimizations: Optimizations<10>. +* Build and C API Changes: Build and C API Changes<4>. +* Deprecated: Deprecated<12>. +* Porting to Python 3.3: Porting to Python 3 3. + +PEP 3118: New memoryview implementation and buffer protocol documentation + +* Features:: +* API changes:: + +PEP 393: Flexible String Representation + +* Functionality:: +* Performance and resource usage:: + +PEP 421: Adding sys.implementation + +* SimpleNamespace:: + +Using importlib as the Implementation of Import + +* New APIs:: +* Visible Changes:: + +New Modules + +* faulthandler: faulthandler<4>. +* ipaddress: ipaddress<6>. +* lzma: lzma<2>. + +Improved Modules + +* abc: abc<2>. +* array: array<5>. +* base64: base64<4>. +* binascii: binascii<3>. +* bz2: bz2<2>. +* codecs: codecs<2>. +* collections: collections<7>. +* contextlib: contextlib<7>. +* crypt: crypt<2>. +* curses: curses<5>. +* datetime: datetime<6>. +* decimal: decimal<3>. +* email: email<5>. +* ftplib: ftplib<3>. +* functools: functools<6>. +* gc: gc<6>. +* hmac: hmac<4>. +* http: http<4>. +* html: html<2>. +* imaplib: imaplib<3>. +* inspect: inspect<9>. +* io: io<6>. +* itertools: itertools<6>. +* logging: logging<7>. +* math: math<9>. +* mmap: mmap<4>. +* multiprocessing: multiprocessing<8>. +* nntplib: nntplib<2>. +* os: os<12>. +* pdb: pdb<7>. +* pickle: pickle<5>. +* pydoc: pydoc<5>. +* re: re<9>. +* sched:: +* select: select<2>. +* shlex: shlex<3>. +* shutil: shutil<7>. +* signal: signal<4>. +* smtpd: smtpd<4>. +* smtplib: smtplib<4>. +* socket: socket<10>. +* socketserver: socketserver<3>. +* sqlite3: sqlite3<10>. +* ssl: ssl<11>. +* stat: stat<2>. +* struct: struct<3>. +* subprocess: subprocess<6>. +* sys: sys<13>. +* tarfile: tarfile<9>. +* tempfile: tempfile<4>. +* textwrap: textwrap<2>. +* threading: threading<8>. +* time: time<8>. +* types: types<7>. +* unittest: unittest<10>. +* urllib: urllib<4>. +* webbrowser: webbrowser<3>. +* xml.etree.ElementTree: xml etree ElementTree<2>. +* zlib: zlib<2>. + +decimal + +* Features: Features<2>. +* API changes: API changes<2>. + +email + +* Policy Framework:: +* Provisional Policy with New Header API:: +* Other API Changes:: + +Deprecated + +* Unsupported Operating Systems: Unsupported Operating Systems<2>. +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<4>. +* Deprecated functions and types of the C API: Deprecated functions and types of the C API<3>. +* Deprecated features:: + +Porting to Python 3.3 + +* Porting Python code:: +* Porting C code:: +* Building C extensions:: +* Command Line Switch Changes:: + +What’s New In Python 3.2 + +* PEP 384; Defining a Stable ABI: PEP 384 Defining a Stable ABI. +* PEP 389; Argparse Command Line Parsing Module: PEP 389 Argparse Command Line Parsing Module. +* PEP 391; Dictionary Based Configuration for Logging: PEP 391 Dictionary Based Configuration for Logging. +* PEP 3148; The concurrent.futures module: PEP 3148 The concurrent futures module. +* PEP 3147; PYC Repository Directories: PEP 3147 PYC Repository Directories. +* PEP 3149; ABI Version Tagged .so Files: PEP 3149 ABI Version Tagged so Files. +* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1. +* Other Language Changes: Other Language Changes<12>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules. +* Multi-threading:: +* Optimizations: Optimizations<11>. +* Unicode:: +* Codecs:: +* Documentation:: +* IDLE:: +* Code Repository:: +* Build and C API Changes: Build and C API Changes<5>. +* Porting to Python 3.2: Porting to Python 3 2. + +New, Improved, and Deprecated Modules + +* email: email<6>. +* elementtree:: +* functools: functools<7>. +* itertools: itertools<7>. +* collections: collections<8>. +* threading: threading<9>. +* datetime and time:: +* math: math<10>. +* abc: abc<3>. +* io: io<7>. +* reprlib:: +* logging: logging<8>. +* csv: csv<4>. +* contextlib: contextlib<8>. +* decimal and fractions:: +* ftp:: +* popen:: +* select: select<3>. +* gzip and zipfile:: +* tarfile: tarfile<10>. +* hashlib: hashlib<7>. +* ast: ast<5>. +* os: os<13>. +* shutil: shutil<8>. +* sqlite3: sqlite3<11>. +* html: html<3>. +* socket: socket<11>. +* ssl: ssl<12>. +* nntp:: +* certificates:: +* imaplib: imaplib<4>. +* http.client: http client<4>. +* unittest: unittest<11>. +* random: random<5>. +* poplib: poplib<4>. +* asyncore: asyncore<2>. +* tempfile: tempfile<5>. +* inspect: inspect<10>. +* pydoc: pydoc<6>. +* dis: dis<5>. +* dbm: dbm<7>. +* ctypes: ctypes<3>. +* site: site<4>. +* sysconfig: sysconfig<3>. +* pdb: pdb<8>. +* configparser: configparser<5>. +* urllib.parse: urllib parse<6>. +* mailbox:: +* turtledemo:: + +What’s New In Python 3.1 + +* PEP 372; Ordered Dictionaries: PEP 372 Ordered Dictionaries. +* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator. +* Other Language Changes: Other Language Changes<13>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<2>. +* Optimizations: Optimizations<12>. +* IDLE: IDLE<2>. +* Build and C API Changes: Build and C API Changes<6>. +* Porting to Python 3.1: Porting to Python 3 1. + +What’s New In Python 3.0 + +* Common Stumbling Blocks:: +* Overview Of Syntax Changes:: +* Changes Already Present In Python 2.6: Changes Already Present In Python 2 6. +* Library Changes:: +* PEP 3101; A New Approach To String Formatting: PEP 3101 A New Approach To String Formatting. +* Changes To Exceptions:: +* Miscellaneous Other Changes:: +* Build and C API Changes: Build and C API Changes<7>. +* Performance:: +* Porting To Python 3.0: Porting To Python 3 0. + +Common Stumbling Blocks + +* Print Is A Function:: +* Views And Iterators Instead Of Lists:: +* Ordering Comparisons:: +* Integers:: +* Text Vs. Data Instead Of Unicode Vs. 8-bit: Text Vs Data Instead Of Unicode Vs 8-bit. + +Overview Of Syntax Changes + +* New Syntax:: +* Changed Syntax:: +* Removed Syntax:: + +Miscellaneous Other Changes + +* Operators And Special Methods:: +* Builtins:: + +What’s New in Python 2.7 + +* The Future for Python 2.x: The Future for Python 2 x. +* Changes to the Handling of Deprecation Warnings:: +* Python 3.1 Features: Python 3 1 Features. +* PEP 372; Adding an Ordered Dictionary to collections: PEP 372 Adding an Ordered Dictionary to collections. +* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator<2>. +* PEP 389; The argparse Module for Parsing Command Lines: PEP 389 The argparse Module for Parsing Command Lines. +* PEP 391; Dictionary-Based Configuration For Logging: PEP 391 Dictionary-Based Configuration For Logging. +* PEP 3106; Dictionary Views: PEP 3106 Dictionary Views. +* PEP 3137; The memoryview Object: PEP 3137 The memoryview Object. +* Other Language Changes: Other Language Changes<14>. +* New and Improved Modules:: +* Build and C API Changes: Build and C API Changes<8>. +* Other Changes and Fixes:: +* Porting to Python 2.7: Porting to Python 2 7. +* New Features Added to Python 2.7 Maintenance Releases: New Features Added to Python 2 7 Maintenance Releases. +* Acknowledgements:: + +Other Language Changes + +* Interpreter Changes:: +* Optimizations: Optimizations<13>. + +New and Improved Modules + +* New module; importlib: New module importlib. +* New module; sysconfig: New module sysconfig. +* ttk; Themed Widgets for Tk: ttk Themed Widgets for Tk. +* Updated module; unittest: Updated module unittest. +* Updated module; ElementTree 1.3: Updated module ElementTree 1 3. + +Build and C API Changes + +* Capsules:: +* Port-Specific Changes; Windows: Port-Specific Changes Windows. +* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X. +* Port-Specific Changes; FreeBSD: Port-Specific Changes FreeBSD. + +New Features Added to Python 2.7 Maintenance Releases + +* Two new environment variables for debug mode:: +* PEP 434; IDLE Enhancement Exception for All Branches: PEP 434 IDLE Enhancement Exception for All Branches. +* PEP 466; Network Security Enhancements for Python 2.7: PEP 466 Network Security Enhancements for Python 2 7. +* PEP 477; Backport ensurepip (PEP 453) to Python 2.7: PEP 477 Backport ensurepip PEP 453 to Python 2 7. +* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients<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: Backport ensurepip (PEP 453) to Python 2.7 + +* Bootstrapping pip By Default: Bootstrapping pip By Default<2>. +* Documentation Changes: Documentation Changes<2>. + +What’s New in Python 2.6 + +* Python 3.0: Python 3 0. +* Changes to the Development Process:: +* PEP 343; The ‘with’ statement: PEP 343 The ‘with’ statement. +* PEP 366; Explicit Relative Imports From a Main Module: PEP 366 Explicit Relative Imports From a Main Module. +* PEP 370; Per-user site-packages Directory: PEP 370 Per-user site-packages Directory. +* PEP 371; The multiprocessing Package: PEP 371 The multiprocessing Package. +* PEP 3101; Advanced String Formatting: PEP 3101 Advanced String Formatting. +* PEP 3105; print As a Function: PEP 3105 print As a Function. +* PEP 3110; Exception-Handling Changes: PEP 3110 Exception-Handling Changes. +* PEP 3112; Byte Literals: PEP 3112 Byte Literals. +* PEP 3116; New I/O Library: PEP 3116 New I/O Library. +* PEP 3118; Revised Buffer Protocol: PEP 3118 Revised Buffer Protocol. +* PEP 3119; Abstract Base Classes: PEP 3119 Abstract Base Classes. +* PEP 3127; Integer Literal Support and Syntax: PEP 3127 Integer Literal Support and Syntax. +* PEP 3129; Class Decorators: PEP 3129 Class Decorators. +* PEP 3141; A Type Hierarchy for Numbers: PEP 3141 A Type Hierarchy for Numbers. +* Other Language Changes: Other Language Changes<15>. +* New and Improved Modules: New and Improved Modules<2>. +* Deprecations and Removals:: +* Build and C API Changes: Build and C API Changes<9>. +* Porting to Python 2.6: Porting to Python 2 6. +* Acknowledgements: Acknowledgements<2>. + +Changes to the Development Process + +* New Issue Tracker; Roundup: New Issue Tracker Roundup. +* New Documentation Format; reStructuredText Using Sphinx: New Documentation Format reStructuredText Using Sphinx. + +PEP 343: The ‘with’ statement + +* Writing Context Managers:: +* The contextlib module:: + +PEP 3141: A Type Hierarchy for Numbers + +* The fractions Module:: + +Other Language Changes + +* Optimizations: Optimizations<14>. +* Interpreter Changes: Interpreter Changes<2>. + +New and Improved Modules + +* The ast module:: +* The future_builtins module:: +* The json module; JavaScript Object Notation: The json module JavaScript Object Notation. +* The plistlib module; A Property-List Parser: The plistlib module A Property-List Parser. +* ctypes Enhancements:: +* Improved SSL Support:: + +Build and C API Changes + +* Port-Specific Changes; Windows: Port-Specific Changes Windows<2>. +* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X<2>. +* Port-Specific Changes; IRIX: Port-Specific Changes IRIX. + +What’s New in Python 2.5 + +* PEP 308; Conditional Expressions: PEP 308 Conditional Expressions. +* PEP 309; Partial Function Application: PEP 309 Partial Function Application. +* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1. +* PEP 328; Absolute and Relative Imports: PEP 328 Absolute and Relative Imports. +* PEP 338; Executing Modules as Scripts: PEP 338 Executing Modules as Scripts. +* PEP 341; Unified try/except/finally: PEP 341 Unified try/except/finally. +* PEP 342; New Generator Features: PEP 342 New Generator Features. +* PEP 343; The ‘with’ statement: PEP 343 The ‘with’ statement<2>. +* PEP 352; Exceptions as New-Style Classes: PEP 352 Exceptions as New-Style Classes. +* PEP 353; Using ssize_t as the index type: PEP 353 Using ssize_t as the index type. +* PEP 357; The ‘__index__’ method: PEP 357 The ‘__index__’ method. +* Other Language Changes: Other Language Changes<16>. +* New, Improved, and Removed Modules: New Improved and Removed Modules. +* Build and C API Changes: Build and C API Changes<10>. +* Porting to Python 2.5: Porting to Python 2 5. +* Acknowledgements: Acknowledgements<3>. + +PEP 343: The ‘with’ statement + +* Writing Context Managers: Writing Context Managers<2>. +* The contextlib module: The contextlib module<2>. + +Other Language Changes + +* Interactive Interpreter Changes:: +* Optimizations: Optimizations<15>. + +New, Improved, and Removed Modules + +* The ctypes package:: +* The ElementTree package:: +* The hashlib package:: +* The sqlite3 package:: +* The wsgiref package:: + +Build and C API Changes + +* Port-Specific Changes:: + +What’s New in Python 2.4 + +* PEP 218; Built-In Set Objects: PEP 218 Built-In Set Objects. +* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers. +* PEP 289; Generator Expressions: PEP 289 Generator Expressions. +* PEP 292; Simpler String Substitutions: PEP 292 Simpler String Substitutions. +* PEP 318; Decorators for Functions and Methods: PEP 318 Decorators for Functions and Methods. +* PEP 322; Reverse Iteration: PEP 322 Reverse Iteration. +* PEP 324; New subprocess Module: PEP 324 New subprocess Module. +* PEP 327; Decimal Data Type: PEP 327 Decimal Data Type. +* PEP 328; Multi-line Imports: PEP 328 Multi-line Imports. +* PEP 331; Locale-Independent Float/String Conversions: PEP 331 Locale-Independent Float/String Conversions. +* Other Language Changes: Other Language Changes<17>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<3>. +* Build and C API Changes: Build and C API Changes<11>. +* Porting to Python 2.4: Porting to Python 2 4. +* Acknowledgements: Acknowledgements<4>. + +PEP 327: Decimal Data Type + +* Why is Decimal needed?:: +* The Decimal type:: +* The Context type:: + +Other Language Changes + +* Optimizations: Optimizations<16>. + +New, Improved, and Deprecated Modules + +* cookielib:: +* doctest: doctest<5>. + +Build and C API Changes + +* Port-Specific Changes: Port-Specific Changes<2>. + +What’s New in Python 2.3 + +* PEP 218; A Standard Set Datatype: PEP 218 A Standard Set Datatype. +* PEP 255; Simple Generators: PEP 255 Simple Generators. +* PEP 263; Source Code Encodings: PEP 263 Source Code Encodings. +* PEP 273; Importing Modules from ZIP Archives: PEP 273 Importing Modules from ZIP Archives. +* PEP 277; Unicode file name support for Windows NT: PEP 277 Unicode file name support for Windows NT. +* PEP 278; Universal Newline Support: PEP 278 Universal Newline Support. +* PEP 279; enumerate(): PEP 279 enumerate. +* PEP 282; The logging Package: PEP 282 The logging Package. +* PEP 285; A Boolean Type: PEP 285 A Boolean Type. +* PEP 293; Codec Error Handling Callbacks: PEP 293 Codec Error Handling Callbacks. +* PEP 301; Package Index and Metadata for Distutils: PEP 301 Package Index and Metadata for Distutils. +* PEP 302; New Import Hooks: PEP 302 New Import Hooks. +* PEP 305; Comma-separated Files: PEP 305 Comma-separated Files. +* PEP 307; Pickle Enhancements: PEP 307 Pickle Enhancements. +* Extended Slices:: +* Other Language Changes: Other Language Changes<18>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<4>. +* Pymalloc; A Specialized Object Allocator: Pymalloc A Specialized Object Allocator. +* Build and C API Changes: Build and C API Changes<12>. +* Other Changes and Fixes: Other Changes and Fixes<2>. +* Porting to Python 2.3: Porting to Python 2 3. +* Acknowledgements: Acknowledgements<5>. + +Other Language Changes + +* String Changes:: +* Optimizations: Optimizations<17>. + +New, Improved, and Deprecated Modules + +* Date/Time Type:: +* The optparse Module:: + +Build and C API Changes + +* Port-Specific Changes: Port-Specific Changes<3>. + +What’s New in Python 2.2 + +* Introduction:: +* PEPs 252 and 253; Type and Class Changes: PEPs 252 and 253 Type and Class Changes. +* PEP 234; Iterators: PEP 234 Iterators. +* PEP 255; Simple Generators: PEP 255 Simple Generators<2>. +* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers<2>. +* PEP 238; Changing the Division Operator: PEP 238 Changing the Division Operator. +* Unicode Changes:: +* PEP 227; Nested Scopes: PEP 227 Nested Scopes. +* New and Improved Modules: New and Improved Modules<3>. +* Interpreter Changes and Fixes:: +* Other Changes and Fixes: Other Changes and Fixes<3>. +* Acknowledgements: Acknowledgements<6>. + +PEPs 252 and 253: Type and Class Changes + +* Old and New Classes:: +* Descriptors:: +* Multiple Inheritance; The Diamond Rule: Multiple Inheritance The Diamond Rule. +* Attribute Access:: +* Related Links:: + +What’s New in Python 2.1 + +* Introduction: Introduction<2>. +* PEP 227; Nested Scopes: PEP 227 Nested Scopes<2>. +* PEP 236; __future__ Directives: PEP 236 __future__ Directives. +* PEP 207; Rich Comparisons: PEP 207 Rich Comparisons. +* PEP 230; Warning Framework: PEP 230 Warning Framework. +* PEP 229; New Build System: PEP 229 New Build System. +* PEP 205; Weak References: PEP 205 Weak References. +* PEP 232; Function Attributes: PEP 232 Function Attributes. +* PEP 235; Importing Modules on Case-Insensitive Platforms: PEP 235 Importing Modules on Case-Insensitive Platforms. +* PEP 217; Interactive Display Hook: PEP 217 Interactive Display Hook. +* PEP 208; New Coercion Model: PEP 208 New Coercion Model. +* PEP 241; Metadata in Python Packages: PEP 241 Metadata in Python Packages. +* New and Improved Modules: New and Improved Modules<4>. +* Other Changes and Fixes: Other Changes and Fixes<4>. +* Acknowledgements: Acknowledgements<7>. + +What’s New in Python 2.0 + +* Introduction: Introduction<3>. +* What About Python 1.6?: What About Python 1 6?. +* New Development Process:: +* Unicode: Unicode<2>. +* List Comprehensions:: +* Augmented Assignment:: +* String Methods:: +* Garbage Collection of Cycles:: +* Other Core Changes:: +* Porting to 2.0: Porting to 2 0. +* Extending/Embedding Changes:: +* Distutils; Making Modules Easy to Install: Distutils Making Modules Easy to Install. +* XML Modules:: +* Module changes:: +* New modules:: +* IDLE Improvements:: +* Deleted and Deprecated Modules:: +* Acknowledgements: Acknowledgements<8>. + +Other Core Changes + +* Minor Language Changes:: +* Changes to Built-in Functions:: + +XML Modules + +* SAX2 Support:: +* DOM Support:: +* Relationship to PyXML:: + +Changelog + +* Python 3.13.7 final: Python 3 13 7 final. +* Python 3.13.6 final: Python 3 13 6 final. +* Python 3.13.5 final: Python 3 13 5 final. +* Python 3.13.4 final: Python 3 13 4 final. +* Python 3.13.3 final: Python 3 13 3 final. +* Python 3.13.2 final: Python 3 13 2 final. +* Python 3.13.1 final: Python 3 13 1 final. +* Python 3.13.0 final: Python 3 13 0 final. +* Python 3.13.0 release candidate 3: Python 3 13 0 release candidate 3. +* Python 3.13.0 release candidate 2: Python 3 13 0 release candidate 2. +* Python 3.13.0 release candidate 1: Python 3 13 0 release candidate 1. +* Python 3.13.0 beta 4: Python 3 13 0 beta 4. +* Python 3.13.0 beta 3: Python 3 13 0 beta 3. +* Python 3.13.0 beta 2: Python 3 13 0 beta 2. +* 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 3.13.7 final + +* Library:: +* Documentation: Documentation<2>. +* Core and Builtins:: + +Python 3.13.6 final + +* macOS:: +* Windows:: +* Tools/Demos:: +* Tests:: +* Security:: +* Library: Library<2>. +* Documentation: Documentation<3>. +* Core and Builtins: Core and Builtins<2>. +* Build:: + +Python 3.13.5 final + +* Windows: Windows<2>. +* Tests: Tests<2>. +* Library: Library<3>. +* Core and Builtins: Core and Builtins<3>. +* C API:: + +Python 3.13.4 final + +* Windows: Windows<3>. +* Tests: Tests<3>. +* Security: Security<2>. +* Library: Library<4>. +* IDLE: IDLE<3>. +* Documentation: Documentation<4>. +* Core and Builtins: Core and Builtins<4>. +* C API: C API<2>. +* Build: Build<2>. + +Python 3.13.3 final + +* macOS: macOS<2>. +* Windows: Windows<4>. +* Tools/Demos: Tools/Demos<2>. +* Tests: Tests<4>. +* Security: Security<3>. +* Library: Library<5>. +* IDLE: IDLE<4>. +* Documentation: Documentation<5>. +* Core and Builtins: Core and Builtins<5>. +* C API: C API<3>. +* Build: Build<3>. + +Python 3.13.2 final + +* macOS: macOS<3>. +* Windows: Windows<5>. +* Tools/Demos: Tools/Demos<3>. +* Tests: Tests<5>. +* Security: Security<4>. +* Library: Library<6>. +* Documentation: Documentation<6>. +* Core and Builtins: Core and Builtins<6>. +* C API: C API<4>. +* Build: Build<4>. + +Python 3.13.1 final + +* macOS: macOS<4>. +* Windows: Windows<6>. +* Tools/Demos: Tools/Demos<4>. +* Tests: Tests<6>. +* Security: Security<5>. +* Library: Library<7>. +* IDLE: IDLE<5>. +* Documentation: Documentation<7>. +* Core and Builtins: Core and Builtins<7>. +* C API: C API<5>. +* Build: Build<5>. + +Python 3.13.0 final + +* Core and Builtins: Core and Builtins<8>. + +Python 3.13.0 release candidate 3 + +* macOS: macOS<5>. +* Windows: Windows<7>. +* Tests: Tests<7>. +* Library: Library<8>. +* IDLE: IDLE<6>. +* Documentation: Documentation<8>. +* Core and Builtins: Core and Builtins<9>. +* C API: C API<6>. +* Build: Build<6>. + +Python 3.13.0 release candidate 2 + +* macOS: macOS<6>. +* Windows: Windows<8>. +* Tools/Demos: Tools/Demos<5>. +* Tests: Tests<8>. +* Security: Security<6>. +* Library: Library<9>. +* IDLE: IDLE<7>. +* Core and Builtins: Core and Builtins<10>. +* C API: C API<7>. +* Build: Build<7>. + +Python 3.13.0 release candidate 1 + +* Tests: Tests<9>. +* Security: Security<7>. +* Library: Library<10>. +* IDLE: IDLE<8>. +* Core and Builtins: Core and Builtins<11>. +* C API: C API<8>. +* Build: Build<8>. + +Python 3.13.0 beta 4 + +* Tests: Tests<10>. +* Library: Library<11>. +* IDLE: IDLE<9>. +* Documentation: Documentation<9>. +* Core and Builtins: Core and Builtins<12>. +* C API: C API<9>. +* Build: Build<9>. + +Python 3.13.0 beta 3 + +* Core and Builtins: Core and Builtins<13>. +* Library: Library<12>. +* Build: Build<10>. +* C API: C API<10>. + +Python 3.13.0 beta 2 + +* Security: Security<8>. +* Core and Builtins: Core and Builtins<14>. +* Library: Library<13>. +* Tests: Tests<11>. +* Build: Build<11>. +* Windows: Windows<9>. +* C API: C API<11>. + +Python 3.13.0 beta 1 + +* Security: Security<9>. +* Core and Builtins: Core and Builtins<15>. +* Library: Library<14>. +* Documentation: Documentation<10>. +* Build: Build<12>. +* Windows: Windows<10>. +* macOS: macOS<7>. +* IDLE: IDLE<10>. +* C API: C API<12>. + +Python 3.13.0 alpha 6 + +* Core and Builtins: Core and Builtins<16>. +* Library: Library<15>. +* Documentation: Documentation<11>. +* Tests: Tests<12>. +* Build: Build<13>. +* Windows: Windows<11>. +* C API: C API<13>. + +Python 3.13.0 alpha 5 + +* Security: Security<10>. +* Core and Builtins: Core and Builtins<17>. +* Library: Library<16>. +* Documentation: Documentation<12>. +* Tests: Tests<13>. +* Build: Build<14>. +* Windows: Windows<12>. +* macOS: macOS<8>. +* IDLE: IDLE<11>. +* Tools/Demos: Tools/Demos<6>. +* C API: C API<14>. + +Python 3.13.0 alpha 4 + +* Security: Security<11>. +* Core and Builtins: Core and Builtins<18>. +* Library: Library<17>. +* Documentation: Documentation<13>. +* Tests: Tests<14>. +* Build: Build<15>. +* Windows: Windows<13>. +* macOS: macOS<9>. +* IDLE: IDLE<12>. +* Tools/Demos: Tools/Demos<7>. +* C API: C API<15>. + +Python 3.13.0 alpha 3 + +* Security: Security<12>. +* Core and Builtins: Core and Builtins<19>. +* Library: Library<18>. +* Documentation: Documentation<14>. +* Tests: Tests<15>. +* Build: Build<16>. +* Windows: Windows<14>. +* macOS: macOS<10>. +* IDLE: IDLE<13>. +* C API: C API<16>. + +Python 3.13.0 alpha 2 + +* Core and Builtins: Core and Builtins<20>. +* Library: Library<19>. +* Tests: Tests<16>. +* Build: Build<17>. +* Windows: Windows<15>. +* macOS: macOS<11>. +* IDLE: IDLE<14>. +* Tools/Demos: Tools/Demos<8>. +* C API: C API<17>. + +Python 3.13.0 alpha 1 + +* Security: Security<13>. +* Core and Builtins: Core and Builtins<21>. +* Library: Library<20>. +* Documentation: Documentation<15>. +* Tests: Tests<17>. +* Build: Build<18>. +* Windows: Windows<16>. +* macOS: macOS<12>. +* IDLE: IDLE<15>. +* Tools/Demos: Tools/Demos<9>. +* C API: C API<18>. + +Python 3.12.0 beta 1 + +* Security: Security<14>. +* Core and Builtins: Core and Builtins<22>. +* Library: Library<21>. +* Documentation: Documentation<16>. +* Tests: Tests<18>. +* Build: Build<19>. +* Windows: Windows<17>. +* macOS: macOS<13>. +* IDLE: IDLE<16>. +* Tools/Demos: Tools/Demos<10>. +* C API: C API<19>. + +Python 3.12.0 alpha 7 + +* Core and Builtins: Core and Builtins<23>. +* Library: Library<22>. +* Documentation: Documentation<17>. +* Tests: Tests<19>. +* Build: Build<20>. +* Windows: Windows<18>. +* Tools/Demos: Tools/Demos<11>. +* C API: C API<20>. + +Python 3.12.0 alpha 6 + +* Security: Security<15>. +* Core and Builtins: Core and Builtins<24>. +* Library: Library<23>. +* Documentation: Documentation<18>. +* Tests: Tests<20>. +* Build: Build<21>. +* Windows: Windows<19>. +* macOS: macOS<14>. +* C API: C API<21>. + +Python 3.12.0 alpha 5 + +* Security: Security<16>. +* Core and Builtins: Core and Builtins<25>. +* Library: Library<24>. +* Documentation: Documentation<19>. +* Tests: Tests<21>. +* Build: Build<22>. +* Windows: Windows<20>. + +Python 3.12.0 alpha 4 + +* Core and Builtins: Core and Builtins<26>. +* Library: Library<25>. +* Documentation: Documentation<20>. +* Tests: Tests<22>. +* Build: Build<23>. +* Windows: Windows<21>. +* macOS: macOS<15>. +* Tools/Demos: Tools/Demos<12>. +* C API: C API<22>. + +Python 3.12.0 alpha 3 + +* Security: Security<17>. +* Core and Builtins: Core and Builtins<27>. +* Library: Library<26>. +* Documentation: Documentation<21>. +* Tests: Tests<23>. +* Build: Build<24>. +* Windows: Windows<22>. +* macOS: macOS<16>. +* Tools/Demos: Tools/Demos<13>. +* C API: C API<23>. + +Python 3.12.0 alpha 2 + +* Security: Security<18>. +* Core and Builtins: Core and Builtins<28>. +* Library: Library<27>. +* Documentation: Documentation<22>. +* Tests: Tests<24>. +* Build: Build<25>. +* Windows: Windows<23>. +* macOS: macOS<17>. +* C API: C API<24>. + +Python 3.12.0 alpha 1 + +* Security: Security<19>. +* Core and Builtins: Core and Builtins<29>. +* Library: Library<28>. +* Documentation: Documentation<23>. +* Tests: Tests<25>. +* Build: Build<26>. +* Windows: Windows<24>. +* macOS: macOS<18>. +* IDLE: IDLE<17>. +* Tools/Demos: Tools/Demos<14>. +* C API: C API<25>. + +Python 3.11.0 beta 1 + +* Security: Security<20>. +* Core and Builtins: Core and Builtins<30>. +* Library: Library<29>. +* Documentation: Documentation<24>. +* Tests: Tests<26>. +* Build: Build<27>. +* Windows: Windows<25>. +* macOS: macOS<19>. +* Tools/Demos: Tools/Demos<15>. +* C API: C API<26>. + +Python 3.11.0 alpha 7 + +* Core and Builtins: Core and Builtins<31>. +* Library: Library<30>. +* Documentation: Documentation<25>. +* Tests: Tests<27>. +* Build: Build<28>. +* Windows: Windows<26>. +* macOS: macOS<20>. +* Tools/Demos: Tools/Demos<16>. +* C API: C API<27>. + +Python 3.11.0 alpha 6 + +* Core and Builtins: Core and Builtins<32>. +* Library: Library<31>. +* Documentation: Documentation<26>. +* Tests: Tests<28>. +* Build: Build<29>. +* Windows: Windows<27>. +* IDLE: IDLE<18>. +* C API: C API<28>. + +Python 3.11.0 alpha 5 + +* Core and Builtins: Core and Builtins<33>. +* Library: Library<32>. +* Documentation: Documentation<27>. +* Tests: Tests<29>. +* Build: Build<30>. +* Windows: Windows<28>. +* macOS: macOS<21>. +* IDLE: IDLE<19>. +* C API: C API<29>. + +Python 3.11.0 alpha 4 + +* Core and Builtins: Core and Builtins<34>. +* Library: Library<33>. +* Documentation: Documentation<28>. +* Tests: Tests<30>. +* Build: Build<31>. +* Windows: Windows<29>. +* macOS: macOS<22>. +* C API: C API<30>. + +Python 3.11.0 alpha 3 + +* Core and Builtins: Core and Builtins<35>. +* Library: Library<34>. +* Documentation: Documentation<29>. +* Tests: Tests<31>. +* Build: Build<32>. +* Windows: Windows<30>. +* macOS: macOS<23>. +* C API: C API<31>. + +Python 3.11.0 alpha 2 + +* Core and Builtins: Core and Builtins<36>. +* Library: Library<35>. +* Documentation: Documentation<30>. +* Tests: Tests<32>. +* Build: Build<33>. +* Windows: Windows<31>. +* macOS: macOS<24>. +* IDLE: IDLE<20>. +* C API: C API<32>. + +Python 3.11.0 alpha 1 + +* Security: Security<21>. +* Core and Builtins: Core and Builtins<37>. +* Library: Library<36>. +* Documentation: Documentation<31>. +* Tests: Tests<33>. +* Build: Build<34>. +* Windows: Windows<32>. +* macOS: macOS<25>. +* IDLE: IDLE<21>. +* Tools/Demos: Tools/Demos<17>. +* C API: C API<33>. + +Python 3.10.0 beta 1 + +* Security: Security<22>. +* Core and Builtins: Core and Builtins<38>. +* Library: Library<37>. +* Documentation: Documentation<32>. +* Tests: Tests<34>. +* Build: Build<35>. +* Windows: Windows<33>. +* macOS: macOS<26>. +* IDLE: IDLE<22>. +* C API: C API<34>. + +Python 3.10.0 alpha 7 + +* Security: Security<23>. +* Core and Builtins: Core and Builtins<39>. +* Library: Library<38>. +* Documentation: Documentation<33>. +* Tests: Tests<35>. +* Build: Build<36>. +* Windows: Windows<34>. +* IDLE: IDLE<23>. +* C API: C API<35>. + +Python 3.10.0 alpha 6 + +* Security: Security<24>. +* Core and Builtins: Core and Builtins<40>. +* Library: Library<39>. +* Documentation: Documentation<34>. +* Tests: Tests<36>. +* Build: Build<37>. +* Windows: Windows<35>. +* macOS: macOS<27>. +* IDLE: IDLE<24>. +* C API: C API<36>. + +Python 3.10.0 alpha 5 + +* Security: Security<25>. +* Core and Builtins: Core and Builtins<41>. +* Library: Library<40>. +* Documentation: Documentation<35>. +* Tests: Tests<37>. +* Build: Build<38>. +* Windows: Windows<36>. +* macOS: macOS<28>. +* IDLE: IDLE<25>. +* C API: C API<37>. + +Python 3.10.0 alpha 4 + +* Core and Builtins: Core and Builtins<42>. +* Library: Library<41>. +* Documentation: Documentation<36>. +* Tests: Tests<38>. +* Build: Build<39>. +* macOS: macOS<29>. +* Tools/Demos: Tools/Demos<18>. +* C API: C API<38>. + +Python 3.10.0 alpha 3 + +* Security: Security<26>. +* Core and Builtins: Core and Builtins<43>. +* Library: Library<42>. +* Documentation: Documentation<37>. +* Tests: Tests<39>. +* Build: Build<40>. +* Windows: Windows<37>. +* macOS: macOS<30>. +* IDLE: IDLE<26>. +* Tools/Demos: Tools/Demos<19>. +* C API: C API<39>. + +Python 3.10.0 alpha 2 + +* Security: Security<27>. +* Core and Builtins: Core and Builtins<44>. +* Library: Library<43>. +* Documentation: Documentation<38>. +* Tests: Tests<40>. +* Build: Build<41>. +* Windows: Windows<38>. +* macOS: macOS<31>. +* IDLE: IDLE<27>. +* C API: C API<40>. + +Python 3.10.0 alpha 1 + +* Security: Security<28>. +* Core and Builtins: Core and Builtins<45>. +* Library: Library<44>. +* Documentation: Documentation<39>. +* Tests: Tests<41>. +* Build: Build<42>. +* Windows: Windows<39>. +* macOS: macOS<32>. +* IDLE: IDLE<28>. +* C API: C API<41>. + +Python 3.9.0 beta 1 + +* Security: Security<29>. +* Core and Builtins: Core and Builtins<46>. +* Library: Library<45>. +* Documentation: Documentation<40>. +* Tests: Tests<42>. +* Build: Build<43>. +* Windows: Windows<40>. +* macOS: macOS<33>. +* Tools/Demos: Tools/Demos<20>. +* C API: C API<42>. + +Python 3.9.0 alpha 6 + +* Security: Security<30>. +* Core and Builtins: Core and Builtins<47>. +* Library: Library<46>. +* Documentation: Documentation<41>. +* Tests: Tests<43>. +* Build: Build<44>. +* Windows: Windows<41>. +* macOS: macOS<34>. +* IDLE: IDLE<29>. +* Tools/Demos: Tools/Demos<21>. +* C API: C API<43>. + +Python 3.9.0 alpha 5 + +* Security: Security<31>. +* Core and Builtins: Core and Builtins<48>. +* Library: Library<47>. +* Documentation: Documentation<42>. +* Tests: Tests<44>. +* Build: Build<45>. +* Windows: Windows<42>. +* macOS: macOS<35>. +* IDLE: IDLE<30>. +* Tools/Demos: Tools/Demos<22>. +* C API: C API<44>. + +Python 3.9.0 alpha 4 + +* Security: Security<32>. +* Core and Builtins: Core and Builtins<49>. +* Library: Library<48>. +* Documentation: Documentation<43>. +* Tests: Tests<45>. +* Build: Build<46>. +* Windows: Windows<43>. +* IDLE: IDLE<31>. +* C API: C API<45>. + +Python 3.9.0 alpha 3 + +* Core and Builtins: Core and Builtins<50>. +* Library: Library<49>. +* Documentation: Documentation<44>. +* Build: Build<47>. +* IDLE: IDLE<32>. +* C API: C API<46>. + +Python 3.9.0 alpha 2 + +* Security: Security<33>. +* Core and Builtins: Core and Builtins<51>. +* Library: Library<50>. +* Documentation: Documentation<45>. +* Tests: Tests<46>. +* Build: Build<48>. +* Windows: Windows<44>. +* macOS: macOS<36>. +* IDLE: IDLE<33>. +* C API: C API<47>. + +Python 3.9.0 alpha 1 + +* Security: Security<34>. +* Core and Builtins: Core and Builtins<52>. +* Library: Library<51>. +* Documentation: Documentation<46>. +* Tests: Tests<47>. +* Build: Build<49>. +* Windows: Windows<45>. +* macOS: macOS<37>. +* IDLE: IDLE<34>. +* Tools/Demos: Tools/Demos<23>. +* C API: C API<48>. + +Python 3.8.0 beta 1 + +* Security: Security<35>. +* Core and Builtins: Core and Builtins<53>. +* Library: Library<52>. +* Documentation: Documentation<47>. +* Tests: Tests<48>. +* Build: Build<50>. +* Windows: Windows<46>. +* macOS: macOS<38>. +* IDLE: IDLE<35>. +* Tools/Demos: Tools/Demos<24>. +* C API: C API<49>. + +Python 3.8.0 alpha 4 + +* Security: Security<36>. +* Core and Builtins: Core and Builtins<54>. +* Library: Library<53>. +* Documentation: Documentation<48>. +* Tests: Tests<49>. +* Build: Build<51>. +* Windows: Windows<47>. +* macOS: macOS<39>. +* IDLE: IDLE<36>. +* Tools/Demos: Tools/Demos<25>. +* C API: C API<50>. + +Python 3.8.0 alpha 3 + +* Security: Security<37>. +* Core and Builtins: Core and Builtins<55>. +* Library: Library<54>. +* Documentation: Documentation<49>. +* Tests: Tests<50>. +* Build: Build<52>. +* Windows: Windows<48>. +* IDLE: IDLE<37>. +* Tools/Demos: Tools/Demos<26>. +* C API: C API<51>. + +Python 3.8.0 alpha 2 + +* Core and Builtins: Core and Builtins<56>. +* Library: Library<55>. +* Documentation: Documentation<50>. +* Tests: Tests<51>. +* Windows: Windows<49>. +* IDLE: IDLE<38>. + +Python 3.8.0 alpha 1 + +* Security: Security<38>. +* Core and Builtins: Core and Builtins<57>. +* Library: Library<56>. +* Documentation: Documentation<51>. +* Tests: Tests<52>. +* Build: Build<53>. +* Windows: Windows<50>. +* macOS: macOS<40>. +* IDLE: IDLE<39>. +* Tools/Demos: Tools/Demos<27>. +* C API: C API<52>. + +Python 3.7.0 final + +* Library: Library<57>. +* C API: C API<53>. + +Python 3.7.0 release candidate 1 + +* Core and Builtins: Core and Builtins<58>. +* Library: Library<58>. +* Documentation: Documentation<52>. +* Build: Build<54>. +* Windows: Windows<51>. +* IDLE: IDLE<40>. + +Python 3.7.0 beta 5 + +* Core and Builtins: Core and Builtins<59>. +* Library: Library<59>. +* Documentation: Documentation<53>. +* Tests: Tests<53>. +* Build: Build<55>. +* macOS: macOS<41>. +* IDLE: IDLE<41>. + +Python 3.7.0 beta 4 + +* Core and Builtins: Core and Builtins<60>. +* Library: Library<60>. +* Documentation: Documentation<54>. +* Tests: Tests<54>. +* Build: Build<56>. +* Windows: Windows<52>. +* macOS: macOS<42>. +* IDLE: IDLE<42>. +* Tools/Demos: Tools/Demos<28>. + +Python 3.7.0 beta 3 + +* Security: Security<39>. +* Core and Builtins: Core and Builtins<61>. +* Library: Library<61>. +* Documentation: Documentation<55>. +* Tests: Tests<55>. +* Build: Build<57>. +* Windows: Windows<53>. +* macOS: macOS<43>. +* IDLE: IDLE<43>. +* Tools/Demos: Tools/Demos<29>. +* C API: C API<54>. + +Python 3.7.0 beta 2 + +* Security: Security<40>. +* Core and Builtins: Core and Builtins<62>. +* Library: Library<62>. +* Documentation: Documentation<56>. +* Tests: Tests<56>. +* Build: Build<58>. +* Windows: Windows<54>. +* macOS: macOS<44>. +* IDLE: IDLE<44>. +* Tools/Demos: Tools/Demos<30>. + +Python 3.7.0 beta 1 + +* Core and Builtins: Core and Builtins<63>. +* Library: Library<63>. +* Documentation: Documentation<57>. +* Tests: Tests<57>. +* Build: Build<59>. +* Windows: Windows<55>. +* macOS: macOS<45>. +* C API: C API<55>. + +Python 3.7.0 alpha 4 + +* Core and Builtins: Core and Builtins<64>. +* Library: Library<64>. +* Documentation: Documentation<58>. +* Tests: Tests<58>. +* Windows: Windows<56>. +* Tools/Demos: Tools/Demos<31>. +* C API: C API<56>. + +Python 3.7.0 alpha 3 + +* Core and Builtins: Core and Builtins<65>. +* Library: Library<65>. +* Documentation: Documentation<59>. +* Tests: Tests<59>. +* Build: Build<60>. +* Windows: Windows<57>. +* macOS: macOS<46>. +* IDLE: IDLE<45>. +* Tools/Demos: Tools/Demos<32>. +* C API: C API<57>. + +Python 3.7.0 alpha 2 + +* Core and Builtins: Core and Builtins<66>. +* Library: Library<66>. +* Documentation: Documentation<60>. +* Build: Build<61>. +* IDLE: IDLE<46>. +* C API: C API<58>. + +Python 3.7.0 alpha 1 + +* Security: Security<41>. +* Core and Builtins: Core and Builtins<67>. +* Library: Library<67>. +* Documentation: Documentation<61>. +* Tests: Tests<60>. +* Build: Build<62>. +* Windows: Windows<58>. +* IDLE: IDLE<47>. +* Tools/Demos: Tools/Demos<33>. +* C API: C API<59>. + +Python 3.6.6 release candidate 1 + +* Core and Builtins: Core and Builtins<68>. +* Library: Library<68>. +* Documentation: Documentation<62>. +* Tests: Tests<61>. +* Build: Build<63>. +* Windows: Windows<59>. +* macOS: macOS<47>. +* IDLE: IDLE<48>. +* Tools/Demos: Tools/Demos<34>. +* C API: C API<60>. + +Python 3.6.5 final + +* Tests: Tests<62>. +* Build: Build<64>. + +Python 3.6.5 release candidate 1 + +* Security: Security<42>. +* Core and Builtins: Core and Builtins<69>. +* Library: Library<69>. +* Documentation: Documentation<63>. +* Tests: Tests<63>. +* Build: Build<65>. +* Windows: Windows<60>. +* macOS: macOS<48>. +* IDLE: IDLE<49>. +* Tools/Demos: Tools/Demos<35>. +* C API: C API<61>. + +Python 3.6.4 release candidate 1 + +* Core and Builtins: Core and Builtins<70>. +* Library: Library<70>. +* Documentation: Documentation<64>. +* Tests: Tests<64>. +* Build: Build<66>. +* Windows: Windows<61>. +* macOS: macOS<49>. +* IDLE: IDLE<50>. +* Tools/Demos: Tools/Demos<36>. +* C API: C API<62>. + +Python 3.6.3 final + +* Library: Library<71>. +* Build: Build<67>. + +Python 3.6.3 release candidate 1 + +* Security: Security<43>. +* Core and Builtins: Core and Builtins<71>. +* Library: Library<72>. +* Documentation: Documentation<65>. +* Tests: Tests<65>. +* Build: Build<68>. +* Windows: Windows<62>. +* IDLE: IDLE<51>. +* Tools/Demos: Tools/Demos<37>. + +Python 3.6.2 release candidate 2 + +* Security: Security<44>. + +Python 3.6.2 release candidate 1 + +* Security: Security<45>. +* Core and Builtins: Core and Builtins<72>. +* Library: Library<73>. +* IDLE: IDLE<52>. +* C API: C API<63>. +* Build: Build<69>. +* Documentation: Documentation<66>. +* Tools/Demos: Tools/Demos<38>. +* Tests: Tests<66>. +* Windows: Windows<63>. + +Python 3.6.1 final + +* Core and Builtins: Core and Builtins<73>. +* Build: Build<70>. + +Python 3.6.1 release candidate 1 + +* Core and Builtins: Core and Builtins<74>. +* Library: Library<74>. +* IDLE: IDLE<53>. +* Windows: Windows<64>. +* C API: C API<64>. +* Documentation: Documentation<67>. +* Tests: Tests<67>. +* Build: Build<71>. + +Python 3.6.0 release candidate 2 + +* Core and Builtins: Core and Builtins<75>. +* Tools/Demos: Tools/Demos<39>. +* Windows: Windows<65>. +* Build: Build<72>. + +Python 3.6.0 release candidate 1 + +* Core and Builtins: Core and Builtins<76>. +* Library: Library<75>. +* C API: C API<65>. +* Documentation: Documentation<68>. +* Tools/Demos: Tools/Demos<40>. + +Python 3.6.0 beta 4 + +* Core and Builtins: Core and Builtins<77>. +* Library: Library<76>. +* Documentation: Documentation<69>. +* Tests: Tests<68>. +* Build: Build<73>. + +Python 3.6.0 beta 3 + +* Core and Builtins: Core and Builtins<78>. +* Library: Library<77>. +* Windows: Windows<66>. +* Build: Build<74>. +* Tests: Tests<69>. + +Python 3.6.0 beta 2 + +* Core and Builtins: Core and Builtins<79>. +* Library: Library<78>. +* Windows: Windows<67>. +* C API: C API<66>. +* Build: Build<75>. +* Tests: Tests<70>. + +Python 3.6.0 beta 1 + +* Core and Builtins: Core and Builtins<80>. +* Library: Library<79>. +* IDLE: IDLE<54>. +* C API: C API<67>. +* Tests: Tests<71>. +* Build: Build<76>. +* Tools/Demos: Tools/Demos<41>. +* Windows: Windows<68>. + +Python 3.6.0 alpha 4 + +* Core and Builtins: Core and Builtins<81>. +* Library: Library<80>. +* IDLE: IDLE<55>. +* Tests: Tests<72>. +* Windows: Windows<69>. +* Build: Build<77>. + +Python 3.6.0 alpha 3 + +* Security: Security<46>. +* Core and Builtins: Core and Builtins<82>. +* Library: Library<81>. +* IDLE: IDLE<56>. +* C API: C API<68>. +* Build: Build<78>. +* Tools/Demos: Tools/Demos<42>. +* Documentation: Documentation<70>. +* Tests: Tests<73>. + +Python 3.6.0 alpha 2 + +* Security: Security<47>. +* Core and Builtins: Core and Builtins<83>. +* Library: Library<82>. +* IDLE: IDLE<57>. +* Documentation: Documentation<71>. +* Tests: Tests<74>. +* Windows: Windows<70>. +* Build: Build<79>. +* C API: C API<69>. +* Tools/Demos: Tools/Demos<43>. + +Python 3.6.0 alpha 1 + +* Security: Security<48>. +* Core and Builtins: Core and Builtins<84>. +* Library: Library<83>. +* IDLE: IDLE<58>. +* Documentation: Documentation<72>. +* Tests: Tests<75>. +* Build: Build<80>. +* Windows: Windows<71>. +* Tools/Demos: Tools/Demos<44>. +* C API: C API<70>. + +Python 3.5.5 release candidate 1 + +* Security: Security<49>. +* Core and Builtins: Core and Builtins<85>. +* Library: Library<84>. + +Python 3.5.4 final + +* Library: Library<85>. + +Python 3.5.4 release candidate 1 + +* Security: Security<50>. +* Core and Builtins: Core and Builtins<86>. +* Library: Library<86>. +* Documentation: Documentation<73>. +* Tests: Tests<76>. +* Build: Build<81>. +* Windows: Windows<72>. +* C API: C API<71>. + +Python 3.5.3 release candidate 1 + +* Security: Security<51>. +* Core and Builtins: Core and Builtins<87>. +* Library: Library<87>. +* IDLE: IDLE<59>. +* C API: C API<72>. +* Documentation: Documentation<74>. +* Tests: Tests<77>. +* Tools/Demos: Tools/Demos<45>. +* Windows: Windows<73>. +* Build: Build<82>. + +Python 3.5.2 final + +* Core and Builtins: Core and Builtins<88>. +* Tests: Tests<78>. +* IDLE: IDLE<60>. + +Python 3.5.2 release candidate 1 + +* Security: Security<52>. +* Core and Builtins: Core and Builtins<89>. +* Library: Library<88>. +* IDLE: IDLE<61>. +* Documentation: Documentation<75>. +* Tests: Tests<79>. +* Build: Build<83>. +* Windows: Windows<74>. +* Tools/Demos: Tools/Demos<46>. + +Python 3.5.1 final + +* Core and Builtins: Core and Builtins<90>. +* Windows: Windows<75>. + +Python 3.5.1 release candidate 1 + +* Core and Builtins: Core and Builtins<91>. +* Library: Library<89>. +* IDLE: IDLE<62>. +* Documentation: Documentation<76>. +* Tests: Tests<80>. +* Build: Build<84>. +* Windows: Windows<76>. +* Tools/Demos: Tools/Demos<47>. + +Python 3.5.0 final + +* Build: Build<85>. + +Python 3.5.0 release candidate 4 + +* Library: Library<90>. +* Build: Build<86>. + +Python 3.5.0 release candidate 3 + +* Core and Builtins: Core and Builtins<92>. +* Library: Library<91>. + +Python 3.5.0 release candidate 2 + +* Core and Builtins: Core and Builtins<93>. +* Library: Library<92>. + +Python 3.5.0 release candidate 1 + +* Core and Builtins: Core and Builtins<94>. +* Library: Library<93>. +* IDLE: IDLE<63>. +* Documentation: Documentation<77>. +* Tests: Tests<81>. + +Python 3.5.0 beta 4 + +* Core and Builtins: Core and Builtins<95>. +* Library: Library<94>. +* Build: Build<87>. + +Python 3.5.0 beta 3 + +* Core and Builtins: Core and Builtins<96>. +* Library: Library<95>. +* Tests: Tests<82>. +* Documentation: Documentation<78>. +* Build: Build<88>. + +Python 3.5.0 beta 2 + +* Core and Builtins: Core and Builtins<97>. +* Library: Library<96>. + +Python 3.5.0 beta 1 + +* Core and Builtins: Core and Builtins<98>. +* Library: Library<97>. +* IDLE: IDLE<64>. +* Tests: Tests<83>. +* Documentation: Documentation<79>. +* Tools/Demos: Tools/Demos<48>. + +Python 3.5.0 alpha 4 + +* Core and Builtins: Core and Builtins<99>. +* Library: Library<98>. +* Build: Build<89>. +* Tests: Tests<84>. +* Tools/Demos: Tools/Demos<49>. +* C API: C API<73>. + +Python 3.5.0 alpha 3 + +* Core and Builtins: Core and Builtins<100>. +* Library: Library<99>. +* Build: Build<90>. +* Tests: Tests<85>. +* Tools/Demos: Tools/Demos<50>. + +Python 3.5.0 alpha 2 + +* Core and Builtins: Core and Builtins<101>. +* Library: Library<100>. +* Build: Build<91>. +* C API: C API<74>. +* Windows: Windows<77>. + +Python 3.5.0 alpha 1 + +* Core and Builtins: Core and Builtins<102>. +* Library: Library<101>. +* IDLE: IDLE<65>. +* Build: Build<92>. +* C API: C API<75>. +* Documentation: Documentation<80>. +* Tests: Tests<86>. +* Tools/Demos: Tools/Demos<51>. +* Windows: Windows<78>. + +The Python Tutorial + +* Whetting Your Appetite:: +* Using the Python Interpreter:: +* An Informal Introduction to Python:: +* More Control Flow Tools:: +* Data Structures:: +* Modules: Modules<2>. +* Input and Output:: +* Errors and Exceptions:: +* Classes:: +* Brief Tour of the Standard Library:: +* Brief Tour of the Standard Library — Part II:: +* Virtual Environments and Packages:: +* What Now?:: +* Interactive Input Editing and History Substitution:: +* Floating-Point Arithmetic; Issues and Limitations: Floating-Point Arithmetic Issues and Limitations. +* Appendix:: + +Using the Python Interpreter + +* Invoking the Interpreter:: +* The Interpreter and Its Environment:: + +Invoking the Interpreter + +* Argument Passing:: +* Interactive Mode:: + +The Interpreter and Its Environment + +* Source Code Encoding:: + +An Informal Introduction to Python + +* Using Python as a Calculator:: +* First Steps Towards Programming:: + +Using Python as a Calculator + +* Numbers:: +* Text:: +* Lists:: + +More Control Flow Tools + +* if Statements:: +* for Statements:: +* The range() Function: The range Function. +* break and continue Statements:: +* else Clauses on Loops:: +* pass Statements:: +* match Statements:: +* Defining Functions:: +* More on Defining Functions:: +* Intermezzo; Coding Style: Intermezzo Coding Style. + +More on Defining Functions + +* Default Argument Values:: +* Keyword Arguments:: +* Special parameters:: +* Arbitrary Argument Lists:: +* Unpacking Argument Lists:: +* Lambda Expressions:: +* Documentation Strings:: +* Function Annotations:: + +Special parameters + +* Positional-or-Keyword Arguments:: +* Positional-Only Parameters:: +* Keyword-Only Arguments:: +* Function Examples:: +* Recap:: + +Data Structures + +* More on Lists:: +* The del statement:: +* Tuples and Sequences:: +* Sets:: +* Dictionaries:: +* Looping Techniques:: +* More on Conditions:: +* Comparing Sequences and Other Types:: + +More on Lists + +* Using Lists as Stacks:: +* Using Lists as Queues:: +* List Comprehensions: List Comprehensions<2>. +* Nested List Comprehensions:: + +Modules + +* More on Modules:: +* Standard Modules:: +* The dir() Function: The dir Function. +* Packages:: + +More on Modules + +* Executing modules as scripts:: +* The Module Search Path:: +* “Compiled” Python files:: + +Packages + +* Importing * From a Package:: +* Intra-package References:: +* Packages in Multiple Directories:: + +Input and Output + +* Fancier Output Formatting:: +* Reading and Writing Files:: + +Fancier Output Formatting + +* Formatted String Literals:: +* The String format() Method: The String format Method. +* Manual String Formatting:: +* Old string formatting:: + +Reading and Writing Files + +* Methods of File Objects:: +* Saving structured data with json:: + +Errors and Exceptions + +* Syntax Errors:: +* Exceptions:: +* Handling Exceptions:: +* Raising Exceptions:: +* Exception Chaining:: +* User-defined Exceptions:: +* Defining Clean-up Actions:: +* Predefined Clean-up Actions:: +* Raising and Handling Multiple Unrelated Exceptions:: +* Enriching Exceptions with Notes:: + +Classes + +* A Word About Names and Objects:: +* Python Scopes and Namespaces:: +* A First Look at Classes:: +* Random Remarks:: +* Inheritance:: +* Private Variables:: +* Odds and Ends:: +* Iterators:: +* Generators:: +* Generator Expressions:: + +Python Scopes and Namespaces + +* Scopes and Namespaces Example:: + +A First Look at Classes + +* Class Definition Syntax:: +* Class Objects:: +* Instance Objects:: +* Method Objects:: +* Class and Instance Variables:: + +Inheritance + +* Multiple Inheritance:: + +Brief Tour of the Standard Library + +* Operating System Interface:: +* File Wildcards:: +* Command Line Arguments:: +* Error Output Redirection and Program Termination:: +* String Pattern Matching:: +* Mathematics:: +* Internet Access:: +* Dates and Times:: +* Data Compression:: +* Performance Measurement:: +* Quality Control:: +* Batteries Included:: + +Brief Tour of the Standard Library — Part II + +* Output Formatting:: +* Templating:: +* Working with Binary Data Record Layouts:: +* Multi-threading: Multi-threading<2>. +* Logging:: +* Weak References:: +* Tools for Working with Lists:: +* Decimal Floating-Point Arithmetic:: + +Virtual Environments and Packages + +* Introduction: Introduction<4>. +* Creating Virtual Environments:: +* Managing Packages with pip:: + +Interactive Input Editing and History Substitution + +* Tab Completion and History Editing:: +* Alternatives to the Interactive Interpreter:: + +Floating-Point Arithmetic: Issues and Limitations + +* Representation Error:: + +Appendix + +* Interactive Mode: Interactive Mode<2>. + +Interactive Mode + +* Error Handling:: +* Executable Python Scripts:: +* The Interactive Startup File:: +* The Customization Modules:: + +Python Setup and Usage + +* Command line and environment:: +* Using Python on Unix platforms:: +* Configure Python:: +* Using Python on Windows:: +* Using Python on macOS:: +* Using Python on Android:: +* Using Python on iOS:: +* Editors and IDEs:: + +Command line and environment + +* Command line:: +* Environment variables:: + +Command line + +* Interface options:: +* Generic options:: +* Miscellaneous options:: +* Controlling color:: +* Options you shouldn’t use:: + +Environment variables + +* Debug-mode variables:: + +Using Python on Unix platforms + +* Getting and installing the latest version of Python:: +* Building Python:: +* Python-related paths and files:: +* Miscellaneous:: +* Custom OpenSSL:: + +Getting and installing the latest version of Python + +* On Linux:: +* On FreeBSD and OpenBSD:: + +On Linux + +* Installing IDLE:: + +Configure Python + +* Build Requirements:: +* Generated files:: +* Configure Options:: +* Python Build System:: +* Compiler and linker flags:: + +Generated files + +* configure script:: + +Configure Options + +* General Options:: +* C compiler options:: +* Linker options:: +* Options for third-party dependencies:: +* WebAssembly Options:: +* Install Options:: +* Performance options:: +* Python Debug Build:: +* Debug options:: +* Linker options: Linker options<2>. +* Libraries options:: +* Security Options:: +* macOS Options:: +* iOS Options:: +* Cross Compiling Options:: + +Python Build System + +* Main files of the build system:: +* Main build steps:: +* Main Makefile targets:: +* C extensions:: + +Main Makefile targets + +* make:: +* make platform:: +* make profile-opt:: +* make clean:: +* make distclean:: +* make install:: +* make test:: +* make buildbottest:: +* make regen-all:: + +Compiler and linker flags + +* Preprocessor flags:: +* Compiler flags:: +* Linker flags:: + +Using Python on Windows + +* The full installer:: +* The Microsoft Store package:: +* The nuget.org packages: The nuget org packages. +* The embeddable package:: +* Alternative bundles:: +* Configuring Python:: +* UTF-8 mode:: +* Python Launcher for Windows:: +* Finding modules:: +* Additional modules:: +* Compiling Python on Windows:: +* Other Platforms:: + +The full installer + +* Installation steps:: +* Removing the MAX_PATH Limitation:: +* Installing Without UI:: +* Installing Without Downloading:: +* Modifying an install:: +* Installing Free-threaded Binaries:: + +The Microsoft Store package + +* Known issues:: + +Known issues + +* Redirection of local data, registry, and temporary paths: Redirection of local data registry and temporary paths. + +The nuget.org packages + +* Free-threaded packages:: + +The embeddable package + +* Python Application:: +* Embedding Python:: + +Configuring Python + +* Excursus; Setting environment variables: Excursus Setting environment variables. +* Finding the Python executable:: + +Python Launcher for Windows + +* Getting started:: +* Shebang Lines:: +* Arguments in shebang lines:: +* Customization:: +* Diagnostics:: +* Dry Run:: +* Install on demand:: +* Return codes:: + +Getting started + +* From the command-line:: +* Virtual environments:: +* From a script:: +* From file associations:: + +Customization + +* Customization via INI files:: +* Customizing default Python versions:: + +Additional modules + +* PyWin32:: +* cx_Freeze:: + +Using Python on macOS + +* Using Python for macOS from python.org: Using Python for macOS from python org. +* Alternative Distributions:: +* Installing Additional Python Packages:: +* GUI Programming:: +* Advanced Topics:: +* Other Resources:: + +Using Python for macOS from python.org + +* Installation steps: Installation steps<2>. +* How to run a Python script:: + +Advanced Topics + +* Installing Free-threaded Binaries: Installing Free-threaded Binaries<2>. +* Installing using the command line:: +* Distributing Python Applications:: +* App Store Compliance:: + +Using Python on Android + +* Adding Python to an Android app:: +* Building a Python package for Android:: + +Using Python on iOS + +* Python at runtime on iOS:: +* Installing Python on iOS:: +* App Store Compliance: App Store Compliance<2>. + +Python at runtime on iOS + +* iOS version compatibility:: +* Platform identification:: +* Standard library availability:: +* Binary extension modules:: +* Compiler stub binaries:: + +Installing Python on iOS + +* Tools for building iOS apps:: +* Adding Python to an iOS project:: +* Testing a Python package:: + +Editors and IDEs + +* IDLE — Python editor and shell:: +* Other Editors and IDEs:: + +The Python Language Reference + +* Introduction: Introduction<5>. +* Lexical analysis:: +* Data model:: +* Execution model:: +* The import system:: +* Expressions:: +* Simple statements:: +* Compound statements:: +* Top-level components:: +* Full Grammar specification:: + +Introduction + +* Alternate Implementations:: +* Notation:: + +Lexical analysis + +* Line structure:: +* Other tokens:: +* Identifiers and keywords:: +* Literals:: +* Operators:: +* Delimiters:: + +Line structure + +* Logical lines:: +* Physical lines:: +* Comments:: +* Encoding declarations:: +* Explicit line joining:: +* Implicit line joining:: +* Blank lines:: +* Indentation:: +* Whitespace between tokens:: + +Identifiers and keywords + +* Keywords:: +* Soft Keywords:: +* Reserved classes of identifiers:: + +Literals + +* String and Bytes literals:: +* String literal concatenation:: +* f-strings:: +* Numeric literals:: +* Integer literals:: +* Floating-point literals:: +* Imaginary literals:: + +String and Bytes literals + +* Escape sequences:: + +Data model + +* Objects, values and types: Objects values and types. +* The standard type hierarchy:: +* Special method names:: +* Coroutines:: + +The standard type hierarchy + +* None:: +* NotImplemented:: +* Ellipsis:: +* numbers.Number: numbers Number. +* Sequences:: +* Set types:: +* Mappings:: +* Callable types:: +* Modules: Modules<3>. +* Custom classes:: +* Class instances:: +* I/O objects (also known as file objects): I/O objects also known as file objects. +* Internal types:: + +numbers.Number + +* numbers.Integral: numbers Integral. +* numbers.Real (float): numbers Real float. +* numbers.Complex (complex): numbers Complex complex. + +Sequences + +* Immutable sequences:: +* Mutable sequences:: + +Mappings + +* Dictionaries: Dictionaries<2>. + +Callable types + +* User-defined functions:: +* Instance methods:: +* Generator functions:: +* Coroutine functions:: +* Asynchronous generator functions:: +* Built-in functions:: +* Built-in methods:: +* Classes: Classes<2>. +* Class Instances:: + +User-defined functions + +* Special read-only attributes:: +* Special writable attributes:: + +Modules + +* Import-related attributes on module objects:: +* Other writable attributes on module objects:: +* Module dictionaries:: + +Custom classes + +* Special attributes:: +* Special methods:: + +Class instances + +* Special attributes: Special attributes<2>. + +Internal types + +* Code objects:: +* Frame objects:: +* Traceback objects:: +* Slice objects:: +* Static method objects:: +* Class method objects:: + +Code objects + +* Special read-only attributes: Special read-only attributes<2>. +* Methods on code objects:: + +Frame objects + +* Special read-only attributes: Special read-only attributes<3>. +* Special writable attributes: Special writable attributes<2>. +* Frame object methods:: + +Special method names + +* Basic customization:: +* Customizing attribute access:: +* Customizing class creation:: +* Customizing instance and subclass checks:: +* Emulating generic types:: +* Emulating callable objects:: +* Emulating container types:: +* Emulating numeric types:: +* With Statement Context Managers:: +* Customizing positional arguments in class pattern matching:: +* Emulating buffer types:: +* Special method lookup:: + +Customizing attribute access + +* Customizing module attribute access:: +* Implementing Descriptors:: +* Invoking Descriptors:: +* __slots__: __slots__<2>. + +Customizing class creation + +* Metaclasses:: +* Resolving MRO entries:: +* Determining the appropriate metaclass:: +* Preparing the class namespace:: +* Executing the class body:: +* Creating the class object:: +* Uses for metaclasses:: + +Emulating generic types + +* The purpose of __class_getitem__:: +* __class_getitem__ versus __getitem__:: + +Coroutines + +* Awaitable Objects:: +* Coroutine Objects:: +* Asynchronous Iterators:: +* Asynchronous Context Managers:: + +Execution model + +* Structure of a program:: +* Naming and binding:: +* Exceptions: Exceptions<2>. + +Naming and binding + +* Binding of names:: +* Resolution of names:: +* Annotation scopes:: +* Lazy evaluation:: +* Builtins and restricted execution:: +* Interaction with dynamic features:: + +The import system + +* importlib: importlib<10>. +* Packages: Packages<2>. +* Searching:: +* Loading:: +* The Path Based Finder:: +* Replacing the standard import system:: +* Package Relative Imports:: +* Special considerations for __main__:: +* References:: + +Packages + +* Regular packages:: +* Namespace packages:: + +Searching + +* The module cache:: +* Finders and loaders:: +* Import hooks:: +* The meta path:: + +Loading + +* Loaders:: +* Submodules:: +* Module specs:: +* __path__ attributes on modules:: +* Module reprs:: +* Cached bytecode invalidation:: + +The Path Based Finder + +* Path entry finders:: +* Path entry finder protocol:: + +Special considerations for __main__ + +* __main__.__spec__: __main__ __spec__. + +Expressions + +* Arithmetic conversions:: +* Atoms:: +* Primaries:: +* Await expression:: +* The power operator:: +* Unary arithmetic and bitwise operations:: +* Binary arithmetic operations:: +* Shifting operations:: +* Binary bitwise operations:: +* Comparisons:: +* Boolean operations:: +* Assignment expressions: Assignment expressions<2>. +* Conditional expressions:: +* Lambdas:: +* Expression lists:: +* Evaluation order:: +* Operator precedence:: + +Atoms + +* Identifiers (Names): Identifiers Names. +* Literals: Literals<2>. +* Parenthesized forms:: +* Displays for lists, sets and dictionaries: Displays for lists sets and dictionaries. +* List displays:: +* Set displays:: +* Dictionary displays:: +* Generator expressions:: +* Yield expressions:: + +Identifiers (Names) + +* Private name mangling:: + +Yield expressions + +* Generator-iterator methods:: +* Examples:: +* Asynchronous generator functions: Asynchronous generator functions<2>. +* Asynchronous generator-iterator methods:: + +Primaries + +* Attribute references:: +* Subscriptions:: +* Slicings:: +* Calls:: + +Comparisons + +* Value comparisons:: +* Membership test operations:: +* Identity comparisons:: + +Simple statements + +* Expression statements:: +* Assignment statements:: +* The assert statement:: +* The pass statement:: +* The del statement: The del statement<2>. +* The return statement:: +* The yield statement:: +* The raise statement:: +* The break statement:: +* The continue statement:: +* The import statement:: +* The global statement:: +* The nonlocal statement:: +* The type statement:: + +Assignment statements + +* Augmented assignment statements:: +* Annotated assignment statements:: + +The import statement + +* Future statements:: + +Compound statements + +* The if statement:: +* The while statement:: +* The for statement:: +* The try statement:: +* The with statement:: +* The match statement:: +* Function definitions:: +* Class definitions:: +* Coroutines: Coroutines<2>. +* Type parameter lists:: + +The try statement + +* except clause:: +* except* clause:: +* else clause:: +* finally clause:: + +The match statement + +* Overview:: +* Guards:: +* Irrefutable Case Blocks:: +* Patterns:: + +Patterns + +* OR Patterns:: +* AS Patterns:: +* Literal Patterns:: +* Capture Patterns:: +* Wildcard Patterns:: +* Value Patterns:: +* Group Patterns:: +* Sequence Patterns:: +* Mapping Patterns:: +* Class Patterns:: + +Coroutines + +* Coroutine function definition:: +* The async for statement:: +* The async with statement:: + +Type parameter lists + +* Generic functions:: +* Generic classes:: +* Generic type aliases:: + +Top-level components + +* Complete Python programs:: +* File input:: +* Interactive input:: +* Expression input:: + +The Python Standard Library + +* Introduction: Introduction<6>. +* Built-in Functions:: +* Built-in Constants:: +* Built-in Types:: +* Built-in Exceptions:: +* Text Processing Services:: +* Binary Data Services:: +* Data Types:: +* Numeric and Mathematical Modules:: +* Functional Programming Modules:: +* File and Directory Access:: +* Data Persistence:: +* Data Compression and Archiving:: +* File Formats:: +* Cryptographic Services:: +* Generic Operating System Services:: +* Command Line Interface Libraries:: +* Concurrent Execution:: +* Networking and Interprocess Communication:: +* Internet Data Handling:: +* Structured Markup Processing Tools:: +* Internet Protocols and Support:: +* Multimedia Services:: +* Internationalization:: +* Program Frameworks:: +* Graphical User Interfaces with Tk:: +* Development Tools:: +* Debugging and Profiling:: +* Software Packaging and Distribution:: +* Python Runtime Services:: +* Custom Python Interpreters:: +* Importing Modules:: +* Python Language Services:: +* MS Windows Specific Services:: +* Unix Specific Services:: +* Modules command-line interface (CLI): Modules command-line interface CLI. +* Superseded Modules:: +* Removed Modules:: +* Security Considerations: Security Considerations<3>. + +Introduction + +* Notes on availability:: + +Notes on availability + +* WebAssembly platforms:: +* Mobile platforms:: + +Built-in Constants + +* Constants added by the site module:: + +Built-in Types + +* Truth Value Testing:: +* Boolean Operations — and, or, not: Boolean Operations — and or not. +* Comparisons: Comparisons<2>. +* Numeric Types — int, float, complex: Numeric Types — int float complex. +* Boolean Type - bool:: +* Iterator Types:: +* Sequence Types — list, tuple, range: Sequence Types — list tuple range. +* Text Sequence Type — str:: +* Binary Sequence Types — bytes, bytearray, memoryview: Binary Sequence Types — bytes bytearray memoryview. +* Set Types — set, frozenset: Set Types — set frozenset. +* Mapping Types — dict:: +* Context Manager Types:: +* Type Annotation Types — Generic Alias, Union: Type Annotation Types — Generic Alias Union. +* Other Built-in Types:: +* Special Attributes:: +* Integer string conversion length limitation:: + +Numeric Types — int, float, complex + +* Bitwise Operations on Integer Types:: +* Additional Methods on Integer Types:: +* Additional Methods on Float:: +* Hashing of numeric types:: + +Iterator Types + +* Generator Types:: + +Sequence Types — list, tuple, range + +* Common Sequence Operations:: +* Immutable Sequence Types:: +* Mutable Sequence Types:: +* Lists: Lists<2>. +* Tuples:: +* Ranges:: + +Text Sequence Type — str + +* String Methods: String Methods<2>. +* Formatted String Literals (f-strings): Formatted String Literals f-strings. +* printf-style String Formatting:: + +Binary Sequence Types — bytes, bytearray, memoryview + +* Bytes Objects:: +* Bytearray Objects:: +* Bytes and Bytearray Operations:: +* printf-style Bytes Formatting:: +* Memory Views:: + +Mapping Types — dict + +* Dictionary view objects:: + +Type Annotation Types — Generic Alias, Union + +* Generic Alias Type:: +* Union Type:: + +Generic Alias Type + +* Standard Generic Classes:: +* Special Attributes of GenericAlias objects:: + +Other Built-in Types + +* Modules: Modules<4>. +* Classes and Class Instances:: +* Functions:: +* Methods:: +* Code Objects:: +* Type Objects:: +* The Null Object:: +* The Ellipsis Object:: +* The NotImplemented Object:: +* Internal Objects:: + +Integer string conversion length limitation + +* Affected APIs:: +* Configuring the limit:: +* Recommended configuration:: + +Built-in Exceptions + +* Exception context:: +* Inheriting from built-in exceptions:: +* Base classes:: +* Concrete exceptions:: +* Warnings:: +* Exception groups:: +* Exception hierarchy:: + +Concrete exceptions + +* OS exceptions:: + +Text Processing Services + +* string — Common string operations:: +* re — Regular expression operations:: +* difflib — Helpers for computing deltas:: +* textwrap — Text wrapping and filling:: +* unicodedata — Unicode Database:: +* stringprep — Internet String Preparation:: +* readline — GNU readline interface:: +* rlcompleter — Completion function for GNU readline:: + +string — Common string operations + +* String constants:: +* Custom String Formatting:: +* Format String Syntax:: +* Template strings:: +* Helper functions:: + +Format String Syntax + +* Format Specification Mini-Language:: +* Format examples:: + +re — Regular expression operations + +* Regular Expression Syntax:: +* Module Contents:: +* Regular Expression Objects:: +* Match Objects:: +* Regular Expression Examples:: + +Module Contents + +* Flags:: +* Functions: Functions<2>. +* Exceptions: Exceptions<3>. + +Regular Expression Examples + +* Checking for a Pair:: +* Simulating scanf(): Simulating scanf. +* search() vs. match(): search vs match. +* Making a Phonebook:: +* Text Munging:: +* Finding all Adverbs:: +* Finding all Adverbs and their Positions:: +* Raw String Notation:: +* Writing a Tokenizer:: + +difflib — Helpers for computing deltas + +* SequenceMatcher Objects:: +* SequenceMatcher Examples:: +* Differ Objects:: +* Differ Example:: +* A command-line interface to difflib:: +* ndiff example:: + +readline — GNU readline interface + +* Init file:: +* Line buffer:: +* History file:: +* History list:: +* Startup hooks:: +* Completion:: +* Example:: + +Binary Data Services + +* struct — Interpret bytes as packed binary data:: +* codecs — Codec registry and base classes:: + +struct — Interpret bytes as packed binary data + +* Functions and Exceptions:: +* Format Strings:: +* Applications:: +* Classes: Classes<3>. + +Format Strings + +* Byte Order, Size, and Alignment: Byte Order Size and Alignment. +* Format Characters:: +* Examples: Examples<2>. + +Applications + +* Native Formats:: +* Standard Formats:: + +codecs — Codec registry and base classes + +* Codec Base Classes:: +* Encodings and Unicode:: +* Standard Encodings:: +* Python Specific Encodings:: +* encodings — Encodings package:: +* encodings.idna — Internationalized Domain Names in Applications: encodings idna — Internationalized Domain Names in Applications. +* encodings.mbcs — Windows ANSI codepage: encodings mbcs — Windows ANSI codepage. +* encodings.utf_8_sig — UTF-8 codec with BOM signature: encodings utf_8_sig — UTF-8 codec with BOM signature. + +Codec Base Classes + +* Error Handlers:: +* Stateless Encoding and Decoding:: +* Incremental Encoding and Decoding:: +* Stream Encoding and Decoding:: + +Incremental Encoding and Decoding + +* IncrementalEncoder Objects:: +* IncrementalDecoder Objects:: + +Stream Encoding and Decoding + +* StreamWriter Objects:: +* StreamReader Objects:: +* StreamReaderWriter Objects:: +* StreamRecoder Objects:: + +Python Specific Encodings + +* Text Encodings:: +* Binary Transforms:: +* Standalone Codec Functions:: +* Text Transforms:: + +Data Types + +* datetime — Basic date and time types:: +* zoneinfo — IANA time zone support:: +* calendar — General calendar-related functions:: +* collections — Container datatypes:: +* collections.abc — Abstract Base Classes for Containers: collections abc — Abstract Base Classes for Containers. +* heapq — Heap queue algorithm:: +* bisect — Array bisection algorithm:: +* array — Efficient arrays of numeric values:: +* weakref — Weak references:: +* types — Dynamic type creation and names for built-in types:: +* copy — Shallow and deep copy operations:: +* pprint — Data pretty printer:: +* reprlib — Alternate repr() implementation: reprlib — Alternate repr implementation. +* enum — Support for enumerations:: +* graphlib — Functionality to operate with graph-like structures:: + +datetime — Basic date and time types + +* Aware and Naive Objects:: +* Constants:: +* 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 time zone support + +* Using ZoneInfo:: +* Data sources:: +* The ZoneInfo class:: +* Functions: Functions<3>. +* Globals:: +* Exceptions and warnings:: + +Data sources + +* Configuring the data sources:: + +Configuring the data sources + +* Compile-time configuration:: +* Environment configuration:: +* Runtime configuration:: + +The ZoneInfo class + +* String representations:: +* Pickle serialization:: + +calendar — General calendar-related functions + +* Command-Line Usage:: + +collections — Container datatypes + +* ChainMap objects:: +* Counter objects:: +* deque objects:: +* defaultdict objects:: +* namedtuple() Factory Function for Tuples with Named Fields: namedtuple Factory Function for Tuples with Named Fields. +* OrderedDict objects:: +* UserDict objects:: +* UserList objects:: +* UserString objects:: + +ChainMap objects + +* ChainMap Examples and Recipes:: + +deque objects + +* deque Recipes:: + +defaultdict objects + +* defaultdict Examples:: + +OrderedDict objects + +* OrderedDict Examples and Recipes:: + +collections.abc — Abstract Base Classes for Containers + +* Collections Abstract Base Classes:: +* Collections Abstract Base Classes – Detailed Descriptions:: +* Examples and Recipes:: + +heapq — Heap queue algorithm + +* Basic Examples:: +* Priority Queue Implementation Notes:: +* Theory:: + +bisect — Array bisection algorithm + +* Performance Notes:: +* Searching Sorted Lists:: +* Examples: Examples<3>. + +weakref — Weak references + +* Weak Reference Objects:: +* Example: Example<2>. +* Finalizer Objects:: +* Comparing finalizers with __del__() methods: Comparing finalizers with __del__ methods. + +types — Dynamic type creation and names for built-in types + +* Dynamic Type Creation:: +* Standard Interpreter Types:: +* Additional Utility Classes and Functions:: +* Coroutine Utility Functions:: + +pprint — Data pretty printer + +* Functions: Functions<4>. +* PrettyPrinter Objects:: +* Example: Example<3>. + +reprlib — Alternate repr() implementation + +* Repr Objects:: +* Subclassing Repr Objects:: + +enum — Support for enumerations + +* Module Contents: Module Contents<2>. +* Data Types: Data Types<2>. +* Utilities and Decorators:: +* Notes:: + +Data Types + +* Supported __dunder__ names:: +* Supported _sunder_ names:: + +graphlib — Functionality to operate with graph-like structures + +* Exceptions: Exceptions<4>. + +Numeric and Mathematical Modules + +* numbers — Numeric abstract base classes:: +* math — Mathematical functions:: +* cmath — Mathematical functions for complex numbers:: +* decimal — Decimal fixed-point and floating-point arithmetic:: +* fractions — Rational numbers:: +* random — Generate pseudo-random numbers:: +* statistics — Mathematical statistics functions:: + +numbers — Numeric abstract base classes + +* The numeric tower:: +* Notes for type implementers:: + +Notes for type implementers + +* Adding More Numeric ABCs:: +* Implementing the arithmetic operations:: + +math — Mathematical functions + +* Number-theoretic functions:: +* Floating point arithmetic:: +* Floating point manipulation functions:: +* Power, exponential and logarithmic functions: Power exponential and logarithmic functions. +* Summation and product functions:: +* Angular conversion:: +* Trigonometric functions:: +* Hyperbolic functions:: +* Special functions:: +* Constants: Constants<2>. + +cmath — Mathematical functions for complex numbers + +* Conversions to and from polar coordinates:: +* Power and logarithmic functions:: +* Trigonometric functions: Trigonometric functions<2>. +* Hyperbolic functions: Hyperbolic functions<2>. +* Classification functions:: +* Constants: Constants<3>. + +decimal — Decimal fixed-point and floating-point arithmetic + +* Quick-start tutorial:: +* Decimal objects:: +* Context objects:: +* Constants: Constants<4>. +* Rounding modes:: +* Signals:: +* Floating-point notes:: +* Working with threads:: +* Recipes:: +* Decimal FAQ:: + +Decimal objects + +* Logical operands:: + +Floating-point notes + +* Mitigating round-off error with increased precision:: +* Special values:: + +random — Generate pseudo-random numbers + +* Bookkeeping functions:: +* Functions for bytes:: +* Functions for integers:: +* Functions for sequences:: +* Discrete distributions:: +* Real-valued distributions:: +* Alternative Generator:: +* Notes on Reproducibility:: +* Examples: Examples<4>. +* Recipes: Recipes<2>. +* Command-line usage:: +* Command-line example:: + +statistics — Mathematical statistics functions + +* Averages and measures of central location:: +* Measures of spread:: +* Statistics for relations between two inputs:: +* Function details:: +* Exceptions: Exceptions<5>. +* NormalDist objects:: +* Examples and Recipes: Examples and Recipes<2>. + +Examples and Recipes + +* Classic probability problems:: +* Monte Carlo inputs for simulations:: +* Approximating binomial distributions:: +* Naive bayesian classifier:: + +Functional Programming Modules + +* itertools — Functions creating iterators for efficient looping:: +* functools — Higher-order functions and operations on callable objects:: +* operator — Standard operators as functions:: + +itertools — Functions creating iterators for efficient looping + +* Itertool Functions:: +* Itertools Recipes:: + +functools — Higher-order functions and operations on callable objects + +* partial Objects:: + +operator — Standard operators as functions + +* Mapping Operators to Functions:: +* In-place Operators:: + +File and Directory Access + +* pathlib — Object-oriented filesystem paths:: +* os.path — Common pathname manipulations: os path — Common pathname manipulations. +* stat — Interpreting stat() results: stat — Interpreting stat results. +* filecmp — File and Directory Comparisons:: +* tempfile — Generate temporary files and directories:: +* glob — Unix style pathname pattern expansion:: +* fnmatch — Unix filename pattern matching:: +* linecache — Random access to text lines:: +* shutil — High-level file operations:: + +pathlib — Object-oriented filesystem paths + +* Basic use:: +* Exceptions: Exceptions<6>. +* Pure paths:: +* Concrete paths:: +* Pattern language:: +* Comparison to the glob module:: +* Comparison to the os and os.path modules: Comparison to the os and os path modules. + +Pure paths + +* General properties:: +* Operators: Operators<2>. +* Accessing individual parts:: +* Methods and properties:: + +Concrete paths + +* Parsing and generating URIs:: +* Expanding and resolving paths:: +* Querying file type and status:: +* Reading and writing files:: +* Reading directories:: +* Creating files and directories:: +* Renaming and deleting:: +* Permissions and ownership:: + +Comparison to the os and os.path modules + +* Corresponding tools:: + +filecmp — File and Directory Comparisons + +* The dircmp class:: + +tempfile — Generate temporary files and directories + +* Examples: Examples<5>. +* Deprecated functions and variables:: + +glob — Unix style pathname pattern expansion + +* Examples: Examples<6>. + +shutil — High-level file operations + +* Directory and files operations:: +* Archiving operations:: +* Querying the size of the output terminal:: + +Directory and files operations + +* Platform-dependent efficient copy operations:: +* copytree example:: +* rmtree example:: + +Archiving operations + +* Archiving example:: +* Archiving example with base_dir:: + +Data Persistence + +* pickle — Python object serialization:: +* copyreg — Register pickle support functions:: +* shelve — Python object persistence:: +* marshal — Internal Python object serialization:: +* dbm — Interfaces to Unix “databases”:: +* sqlite3 — DB-API 2.0 interface for SQLite databases: sqlite3 — DB-API 2 0 interface for SQLite databases. + +pickle — Python object serialization + +* Relationship to other Python modules:: +* Data stream format:: +* Module Interface:: +* What can be pickled and unpickled?:: +* Pickling Class Instances:: +* Custom Reduction for Types, Functions, and Other Objects: Custom Reduction for Types Functions and Other Objects. +* Out-of-band Buffers:: +* Restricting Globals:: +* Performance: Performance<2>. +* Examples: Examples<7>. + +Relationship to other Python modules + +* Comparison with marshal:: +* Comparison with json:: + +Pickling Class Instances + +* Persistence of External Objects:: +* Dispatch Tables:: +* Handling Stateful Objects:: + +Out-of-band Buffers + +* Provider API:: +* Consumer API:: +* Example: Example<4>. + +copyreg — Register pickle support functions + +* Example: Example<5>. + +shelve — Python object persistence + +* Restrictions:: +* Example: Example<6>. + +dbm — Interfaces to Unix “databases” + +* dbm.sqlite3 — SQLite backend for dbm: dbm sqlite3 — SQLite backend for dbm. +* dbm.gnu — GNU database manager: dbm gnu — GNU database manager. +* dbm.ndbm — New Database Manager: dbm ndbm — New Database Manager. +* dbm.dumb — Portable DBM implementation: dbm dumb — Portable DBM implementation. + +sqlite3 — DB-API 2.0 interface for SQLite databases + +* Tutorial:: +* Reference:: +* How-to guides:: +* Explanation:: + +Reference + +* Module functions:: +* Module constants:: +* Connection objects:: +* Cursor objects:: +* Row objects:: +* Blob objects:: +* PrepareProtocol objects:: +* Exceptions: Exceptions<7>. +* SQLite and Python types:: +* Default adapters and converters (deprecated): Default adapters and converters deprecated. +* Command-line interface:: + +How-to guides + +* How to use placeholders to bind values in SQL queries:: +* How to adapt custom Python types to SQLite values:: +* How to convert SQLite values to custom Python types:: +* Adapter and converter recipes:: +* How to use connection shortcut methods:: +* How to use the connection context manager:: +* How to work with SQLite URIs:: +* How to create and use row factories:: +* How to handle non-UTF-8 text encodings:: + +How to adapt custom Python types to SQLite values + +* How to write adaptable objects:: +* How to register adapter callables:: + +Explanation + +* Transaction control:: + +Transaction control + +* Transaction control via the autocommit attribute:: +* Transaction control via the isolation_level attribute:: + +Data Compression and Archiving + +* zlib — Compression compatible with gzip:: +* gzip — Support for gzip files:: +* bz2 — Support for bzip2 compression:: +* lzma — Compression using the LZMA algorithm:: +* zipfile — Work with ZIP archives:: +* tarfile — Read and write tar archive files:: + +gzip — Support for gzip files + +* Examples of usage:: +* Command Line Interface:: + +Command Line Interface + +* Command line options:: + +bz2 — Support for bzip2 compression + +* (De)compression of files: De compression of files. +* Incremental (de)compression: Incremental de compression. +* One-shot (de)compression: One-shot de compression. +* Examples of usage: Examples of usage<2>. + +lzma — Compression using the LZMA algorithm + +* Reading and writing compressed files:: +* Compressing and decompressing data in memory:: +* Miscellaneous: Miscellaneous<2>. +* Specifying custom filter chains:: +* Examples: Examples<8>. + +zipfile — Work with ZIP archives + +* ZipFile Objects:: +* Path Objects:: +* PyZipFile Objects:: +* ZipInfo Objects:: +* Command-Line Interface:: +* Decompression pitfalls:: + +Command-Line Interface + +* Command-line options:: + +Decompression pitfalls + +* From file itself:: +* File System limitations:: +* Resources limitations:: +* Interruption:: +* Default behaviors of extraction:: + +tarfile — Read and write tar archive files + +* TarFile Objects:: +* TarInfo Objects:: +* Extraction filters:: +* Command-Line Interface: Command-Line Interface<2>. +* Examples: Examples<9>. +* Supported tar formats:: +* Unicode issues:: + +Extraction filters + +* Default named filters:: +* Filter errors:: +* Hints for further verification:: +* Supporting older Python versions:: +* Stateful extraction filter example:: + +Command-Line Interface + +* Command-line options: Command-line options<2>. + +Examples + +* Reading examples:: +* Writing examples:: + +File Formats + +* csv — CSV File Reading and Writing:: +* configparser — Configuration file parser:: +* tomllib — Parse TOML files:: +* netrc — netrc file processing:: +* plistlib — Generate and parse Apple .plist files: plistlib — Generate and parse Apple plist files. + +csv — CSV File Reading and Writing + +* Module Contents: Module Contents<3>. +* Dialects and Formatting Parameters:: +* Reader Objects:: +* Writer Objects:: +* Examples: Examples<10>. + +configparser — Configuration file parser + +* Quick Start:: +* Supported Datatypes:: +* Fallback Values:: +* Supported INI File Structure:: +* Unnamed Sections:: +* Interpolation of values:: +* Mapping Protocol Access:: +* Customizing Parser Behaviour:: +* Legacy API Examples:: +* ConfigParser Objects:: +* RawConfigParser Objects:: +* Exceptions: Exceptions<8>. + +tomllib — Parse TOML files + +* Examples: Examples<11>. +* Conversion Table:: + +netrc — netrc file processing + +* netrc Objects:: + +plistlib — Generate and parse Apple .plist files + +* Examples: Examples<12>. + +Cryptographic Services + +* hashlib — Secure hashes and message digests:: +* hmac — Keyed-Hashing for Message Authentication:: +* secrets — Generate secure random numbers for managing secrets:: + +hashlib — Secure hashes and message digests + +* Hash algorithms:: +* Usage:: +* Constructors:: +* Attributes:: +* Hash Objects:: +* SHAKE variable length digests:: +* File hashing:: +* Key derivation:: +* BLAKE2:: + +BLAKE2 + +* Creating hash objects:: +* Constants: Constants<5>. +* Examples: Examples<13>. +* Credits:: + +Examples + +* Simple hashing:: +* Using different digest sizes:: +* Keyed hashing:: +* Randomized hashing:: +* Personalization:: +* Tree mode:: + +secrets — Generate secure random numbers for managing secrets + +* Random numbers:: +* Generating tokens:: +* Other functions:: +* Recipes and best practices:: + +Generating tokens + +* How many bytes should tokens use?:: + +Generic Operating System Services + +* os — Miscellaneous operating system interfaces:: +* io — Core tools for working with streams:: +* time — Time access and conversions:: +* logging — Logging facility for Python:: +* logging.config — Logging configuration: logging config — Logging configuration. +* logging.handlers — Logging handlers: logging handlers — Logging handlers. +* platform — Access to underlying platform’s identifying data:: +* errno — Standard errno system symbols:: +* ctypes — A foreign function library for Python:: + +os — Miscellaneous operating system interfaces + +* File Names, Command Line Arguments, and Environment Variables: File Names Command Line Arguments and Environment Variables. +* Python UTF-8 Mode:: +* Process Parameters:: +* File Object Creation:: +* File Descriptor Operations:: +* Files and Directories:: +* Process Management:: +* Interface to the scheduler:: +* Miscellaneous System Information:: +* Random numbers: Random numbers<2>. + +File Descriptor Operations + +* Querying the size of a terminal:: +* Inheritance of File Descriptors:: + +Files and Directories + +* Timer File Descriptors:: +* Linux extended attributes:: + +io — Core tools for working with streams + +* Overview: Overview<2>. +* Text Encoding:: +* High-level Module Interface:: +* Class hierarchy:: +* Performance: Performance<3>. + +Overview + +* Text I/O:: +* Binary I/O:: +* Raw I/O:: + +Text Encoding + +* Opt-in EncodingWarning:: + +Class hierarchy + +* I/O Base Classes:: +* Raw File I/O:: +* Buffered Streams:: +* Text I/O: Text I/O<2>. + +Performance + +* Binary I/O: Binary I/O<2>. +* Text I/O: Text I/O<3>. +* Multi-threading: Multi-threading<3>. +* Reentrancy:: + +time — Time access and conversions + +* Functions: Functions<5>. +* Clock ID Constants:: +* Timezone Constants:: + +logging — Logging facility for Python + +* Logger Objects:: +* Logging Levels:: +* Handler Objects:: +* Formatter Objects:: +* Filter Objects:: +* LogRecord Objects:: +* LogRecord attributes:: +* LoggerAdapter Objects:: +* Thread Safety:: +* Module-Level Functions:: +* Module-Level Attributes:: +* Integration with the warnings module:: + +logging.config — Logging configuration + +* Configuration functions:: +* Security considerations:: +* Configuration dictionary schema:: +* Configuration file format:: + +Configuration dictionary schema + +* Dictionary Schema Details:: +* Incremental Configuration:: +* Object connections:: +* User-defined objects:: +* Handler configuration order:: +* Access to external objects:: +* Access to internal objects:: +* Import resolution and custom importers:: +* Configuring QueueHandler and QueueListener:: + +logging.handlers — Logging handlers + +* StreamHandler:: +* FileHandler:: +* NullHandler:: +* WatchedFileHandler:: +* BaseRotatingHandler:: +* RotatingFileHandler:: +* TimedRotatingFileHandler:: +* SocketHandler:: +* DatagramHandler:: +* SysLogHandler:: +* NTEventLogHandler:: +* SMTPHandler:: +* MemoryHandler:: +* HTTPHandler:: +* QueueHandler:: +* QueueListener:: + +platform — Access to underlying platform’s identifying data + +* Cross platform:: +* Java platform:: +* Windows platform:: +* macOS platform:: +* iOS platform:: +* Unix platforms:: +* Linux platforms:: +* Android platform:: +* Command-line usage: Command-line usage<2>. + +ctypes — A foreign function library for Python + +* ctypes tutorial:: +* ctypes reference:: + +ctypes tutorial + +* Loading dynamic link libraries:: +* Accessing functions from loaded dlls:: +* Calling functions:: +* Fundamental data types:: +* Calling functions, continued: Calling functions continued. +* Calling variadic functions:: +* Calling functions with your own custom data types:: +* Specifying the required argument types (function prototypes): Specifying the required argument types function prototypes. +* Return types:: +* Passing pointers (or; passing parameters by reference): Passing pointers or passing parameters by reference. +* Structures and unions:: +* Structure/union alignment and byte order:: +* Bit fields in structures and unions:: +* Arrays:: +* Pointers:: +* Type conversions:: +* Incomplete Types:: +* Callback functions:: +* Accessing values exported from dlls:: +* Surprises:: +* Variable-sized data types:: + +ctypes reference + +* Finding shared libraries:: +* Loading shared libraries:: +* Foreign functions:: +* Function prototypes:: +* Utility functions:: +* Data types:: +* Fundamental data types: Fundamental data types<2>. +* Structured data types:: +* Arrays and pointers:: + +Command Line Interface Libraries + +* argparse — Parser for command-line options, arguments and subcommands: argparse — Parser for command-line options arguments and subcommands. +* optparse — Parser for command line options:: +* getpass — Portable password input:: +* fileinput — Iterate over lines from multiple input streams:: +* curses — Terminal handling for character-cell displays:: +* curses.textpad — Text input widget for curses programs: curses textpad — Text input widget for curses programs. +* curses.ascii — Utilities for ASCII characters: curses ascii — Utilities for ASCII characters. +* curses.panel — A panel stack extension for curses: curses panel — A panel stack extension for curses. + +argparse — Parser for command-line options, arguments and subcommands + +* ArgumentParser objects:: +* The add_argument() method: The add_argument method. +* The parse_args() method: The parse_args method. +* Other utilities:: +* Exceptions: Exceptions<9>. + +ArgumentParser objects + +* prog:: +* usage:: +* description:: +* epilog:: +* parents:: +* formatter_class:: +* prefix_chars:: +* fromfile_prefix_chars:: +* argument_default:: +* allow_abbrev:: +* conflict_handler:: +* add_help:: +* exit_on_error:: + +The add_argument() method + +* name or flags:: +* action:: +* nargs:: +* const:: +* default:: +* type:: +* choices:: +* required:: +* help:: +* metavar:: +* dest:: +* deprecated:: +* Action classes:: + +The parse_args() method + +* Option value syntax:: +* Invalid arguments:: +* Arguments containing -:: +* Argument abbreviations (prefix matching): Argument abbreviations prefix matching. +* Beyond sys.argv: Beyond sys argv. +* The Namespace object:: + +Other utilities + +* Sub-commands:: +* FileType objects:: +* Argument groups:: +* Mutual exclusion:: +* Parser defaults:: +* Printing help:: +* Partial parsing:: +* Customizing file parsing:: +* Exiting methods:: +* Intermixed parsing:: +* Registering custom types or actions:: + +Exceptions + +* Argparse Tutorial:: +* Migrating optparse code to argparse:: + +Argparse Tutorial + +* Concepts:: +* The basics:: +* Introducing Positional arguments:: +* Introducing Optional arguments:: +* Combining Positional and Optional arguments:: +* Getting a little more advanced:: +* How to translate the argparse output:: +* Custom type converters:: +* Conclusion:: + +Introducing Optional arguments + +* Short options:: + +Getting a little more advanced + +* Specifying ambiguous arguments:: +* Conflicting options:: + +optparse — Parser for command line options + +* Choosing an argument parsing library:: +* Introduction: Introduction<7>. +* Background:: +* Tutorial: Tutorial<2>. +* Reference Guide:: +* Option Callbacks:: +* Extending optparse:: +* Exceptions: Exceptions<10>. + +Background + +* Terminology:: +* What are options for?:: +* What are positional arguments for?:: + +Tutorial + +* Understanding option actions:: +* The store action:: +* Handling boolean (flag) options: Handling boolean flag options. +* Other actions:: +* Default values:: +* Generating help:: +* Printing a version string:: +* How optparse handles errors:: +* Putting it all together:: + +Generating help + +* Grouping Options:: + +Reference Guide + +* Creating the parser:: +* Populating the parser:: +* Defining options:: +* Option attributes:: +* Standard option actions:: +* Standard option types:: +* Parsing arguments:: +* Querying and manipulating your option parser:: +* Conflicts between options:: +* Cleanup:: +* Other methods:: + +Option Callbacks + +* Defining a callback option:: +* How callbacks are called:: +* Raising errors in a callback:: +* Callback example 1; trivial callback: Callback example 1 trivial callback. +* Callback example 2; check option order: Callback example 2 check option order. +* Callback example 3; check option order (generalized): Callback example 3 check option order generalized. +* Callback example 4; check arbitrary condition: Callback example 4 check arbitrary condition. +* Callback example 5; fixed arguments: Callback example 5 fixed arguments. +* Callback example 6; variable arguments: Callback example 6 variable arguments. + +Extending optparse + +* Adding new types:: +* Adding new actions:: + +curses — Terminal handling for character-cell displays + +* Functions: Functions<6>. +* Window Objects:: +* Constants: Constants<6>. + +curses.textpad — Text input widget for curses programs + +* Textbox objects:: + +curses.panel — A panel stack extension for curses + +* Functions: Functions<7>. +* Panel Objects:: + +Concurrent Execution + +* threading — Thread-based parallelism:: +* multiprocessing — Process-based parallelism:: +* multiprocessing.shared_memory — Shared memory for direct access across processes: multiprocessing shared_memory — Shared memory for direct access across processes. +* The concurrent package:: +* concurrent.futures — Launching parallel tasks: concurrent futures — Launching parallel tasks. +* subprocess — Subprocess management:: +* sched — Event scheduler:: +* queue — A synchronized queue class:: +* contextvars — Context Variables:: +* _thread — Low-level threading API:: + +threading — Thread-based parallelism + +* Introduction: Introduction<8>. +* GIL and performance considerations:: +* Reference: Reference<2>. +* Using locks, conditions, and semaphores in the with statement: Using locks conditions and semaphores in the with statement. + +Reference + +* Thread-local data:: +* Thread objects:: +* Lock objects:: +* RLock objects:: +* Condition objects:: +* Semaphore objects:: +* Semaphore example:: +* Event objects:: +* Timer objects:: +* Barrier objects:: + +multiprocessing — Process-based parallelism + +* Introduction: Introduction<9>. +* Reference: Reference<3>. +* Programming guidelines:: +* Examples: Examples<14>. + +Introduction + +* The Process class:: +* Contexts and start methods:: +* Exchanging objects between processes:: +* Synchronization between processes:: +* Sharing state between processes:: +* Using a pool of workers:: + +Reference + +* Process and exceptions:: +* Pipes and Queues:: +* Miscellaneous: Miscellaneous<3>. +* Connection Objects:: +* Synchronization primitives:: +* Shared ctypes Objects:: +* Managers:: +* Proxy Objects:: +* Process Pools:: +* Listeners and Clients:: +* Authentication keys:: +* Logging: Logging<2>. +* The multiprocessing.dummy module: The multiprocessing dummy module. + +Shared ctypes Objects + +* The multiprocessing.sharedctypes module: The multiprocessing sharedctypes module. + +Managers + +* Customized managers:: +* Using a remote manager:: + +Proxy Objects + +* Cleanup: Cleanup<2>. + +Listeners and Clients + +* Address Formats:: + +Programming guidelines + +* All start methods:: +* The spawn and forkserver start methods:: + +concurrent.futures — Launching parallel tasks + +* Executor Objects:: +* ThreadPoolExecutor:: +* ProcessPoolExecutor:: +* Future Objects:: +* Module Functions:: +* Exception classes:: + +ThreadPoolExecutor + +* ThreadPoolExecutor Example:: + +ProcessPoolExecutor + +* ProcessPoolExecutor Example:: + +subprocess — Subprocess management + +* Using the subprocess Module:: +* Security Considerations:: +* Popen Objects:: +* Windows Popen Helpers:: +* Older high-level API:: +* Replacing Older Functions with the subprocess Module:: +* Legacy Shell Invocation Functions:: +* Notes: Notes<2>. + +Using the subprocess Module + +* Frequently Used Arguments:: +* Popen Constructor:: +* Exceptions: Exceptions<11>. + +Windows Popen Helpers + +* Windows Constants:: + +Replacing Older Functions with the subprocess Module + +* Replacing /bin/sh shell command substitution:: +* Replacing shell pipeline:: +* Replacing os.system(): Replacing os system. +* Replacing the os.spawn family: Replacing the os spawn family. +* Replacing os.popen(), os.popen2(), os.popen3(): Replacing os popen os popen2 os popen3. +* Replacing functions from the popen2 module:: + +Notes + +* Timeout Behavior:: +* Converting an argument sequence to a string on Windows:: +* Disabling use of vfork() or posix_spawn(): Disabling use of vfork or posix_spawn. + +sched — Event scheduler + +* Scheduler Objects:: + +queue — A synchronized queue class + +* Queue Objects:: +* SimpleQueue Objects:: + +Queue Objects + +* Waiting for task completion:: +* Terminating queues:: + +contextvars — Context Variables + +* Context Variables:: +* Manual Context Management:: +* asyncio support:: + +Networking and Interprocess Communication + +* asyncio — Asynchronous I/O:: +* socket — Low-level networking interface:: +* ssl — TLS/SSL wrapper for socket objects:: +* select — Waiting for I/O completion:: +* selectors — High-level I/O multiplexing:: +* signal — Set handlers for asynchronous events:: +* mmap — Memory-mapped file support:: + +asyncio — Asynchronous I/O + +* Runners:: +* Coroutines and Tasks:: +* Streams:: +* Synchronization Primitives:: +* Subprocesses:: +* Queues:: +* Exceptions: Exceptions<13>. +* Event Loop:: +* Futures:: +* Transports and Protocols:: +* Policies:: +* Platform Support:: +* Extending:: +* High-level API Index:: +* Low-level API Index:: +* Developing with asyncio:: + +Runners + +* Running an asyncio Program:: +* Runner context manager:: +* Handling Keyboard Interruption:: + +Coroutines and Tasks + +* Coroutines: Coroutines<3>. +* Awaitables:: +* Creating Tasks:: +* Task Cancellation:: +* Task Groups:: +* Sleeping:: +* Running Tasks Concurrently:: +* Eager Task Factory:: +* Shielding From Cancellation:: +* Timeouts:: +* Waiting Primitives:: +* Running in Threads:: +* Scheduling From Other Threads:: +* Introspection:: +* Task Object:: + +Task Groups + +* Terminating a Task Group:: + +Streams + +* StreamReader:: +* StreamWriter:: +* Examples: Examples<15>. + +Examples + +* TCP echo client using streams:: +* TCP echo server using streams:: +* Get HTTP headers:: +* Register an open socket to wait for data using streams:: + +Synchronization Primitives + +* Lock:: +* Event:: +* Condition:: +* Semaphore:: +* BoundedSemaphore:: +* Barrier:: + +Subprocesses + +* Creating Subprocesses:: +* Constants: Constants<7>. +* Interacting with Subprocesses:: + +Interacting with Subprocesses + +* Subprocess and Threads:: +* Examples: Examples<16>. + +Queues + +* Queue:: +* Priority Queue:: +* LIFO Queue:: +* Exceptions: Exceptions<12>. +* Examples: Examples<17>. + +Event Loop + +* Event Loop Methods:: +* Callback Handles:: +* Server Objects:: +* Event Loop Implementations:: +* Examples: Examples<18>. + +Event Loop Methods + +* Running and stopping the loop:: +* Scheduling callbacks:: +* Scheduling delayed callbacks:: +* Creating Futures and Tasks:: +* Opening network connections:: +* Creating network servers:: +* Transferring files:: +* TLS Upgrade:: +* Watching file descriptors:: +* Working with socket objects directly:: +* DNS:: +* Working with pipes:: +* Unix signals:: +* Executing code in thread or process pools:: +* Error Handling API:: +* Enabling debug mode:: +* Running Subprocesses:: + +Examples + +* Hello World with call_soon(): Hello World with call_soon. +* Display the current date with call_later(): Display the current date with call_later. +* Watch a file descriptor for read events:: +* Set signal handlers for SIGINT and SIGTERM:: + +Futures + +* Future Functions:: +* Future Object:: + +Transports and Protocols + +* Transports:: +* Protocols:: +* Examples: Examples<19>. + +Transports + +* Transports Hierarchy:: +* Base Transport:: +* Read-only Transports:: +* Write-only Transports:: +* Datagram Transports:: +* Subprocess Transports:: + +Protocols + +* Base Protocols:: +* Base Protocol:: +* Streaming Protocols:: +* Buffered Streaming Protocols:: +* Datagram Protocols:: +* Subprocess Protocols:: + +Examples + +* TCP Echo Server:: +* TCP Echo Client:: +* UDP Echo Server:: +* UDP Echo Client:: +* Connecting Existing Sockets:: +* loop.subprocess_exec() and SubprocessProtocol: loop subprocess_exec and SubprocessProtocol. + +Policies + +* Getting and Setting the Policy:: +* Policy Objects:: +* Process Watchers:: +* Custom Policies:: + +Platform Support + +* All Platforms:: +* Windows: Windows<79>. +* macOS: macOS<50>. + +Windows + +* Subprocess Support on Windows:: + +Extending + +* Writing a Custom Event Loop:: +* Future and Task private constructors:: +* Task lifetime support:: + +High-level API Index + +* Tasks:: +* Queues: Queues<2>. +* Subprocesses: Subprocesses<2>. +* Streams: Streams<2>. +* Synchronization:: +* Exceptions: Exceptions<14>. + +Low-level API Index + +* Obtaining the Event Loop:: +* Event Loop Methods: Event Loop Methods<2>. +* Transports: Transports<2>. +* Protocols: Protocols<2>. +* Event Loop Policies:: + +Developing with asyncio + +* Debug Mode:: +* Concurrency and Multithreading:: +* Running Blocking Code:: +* Logging: Logging<3>. +* Detect never-awaited coroutines:: +* Detect never-retrieved exceptions:: + +socket — Low-level networking interface + +* Socket families:: +* Module contents:: +* Socket Objects:: +* Notes on socket timeouts:: +* Example: Example<7>. + +Module contents + +* Exceptions: Exceptions<15>. +* Constants: Constants<8>. +* Functions: Functions<8>. + +Functions + +* Creating sockets:: +* Other functions: Other functions<2>. + +Notes on socket timeouts + +* Timeouts and the connect method:: +* Timeouts and the accept method:: + +ssl — TLS/SSL wrapper for socket objects + +* Functions, Constants, and Exceptions: Functions Constants and Exceptions. +* SSL Sockets:: +* SSL Contexts:: +* Certificates:: +* Examples: Examples<20>. +* Notes on non-blocking sockets:: +* Memory BIO Support: Memory BIO Support<2>. +* SSL session:: +* Security considerations: Security considerations<2>. +* TLS 1.3: TLS 1 3. + +Functions, Constants, and Exceptions + +* Socket creation:: +* Context creation:: +* Exceptions: Exceptions<16>. +* Random generation:: +* Certificate handling:: +* Constants: Constants<9>. + +Certificates + +* Certificate chains:: +* CA certificates:: +* Combined key and certificate:: +* Self-signed certificates:: + +Examples + +* Testing for SSL support:: +* Client-side operation:: +* Server-side operation:: + +Security considerations + +* Best defaults:: +* Manual settings:: +* Multi-processing:: + +Manual settings + +* Verifying certificates:: +* Protocol versions:: +* Cipher selection:: + +select — Waiting for I/O completion + +* /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 — High-level I/O multiplexing + +* Introduction: Introduction<10>. +* Classes: Classes<4>. +* Examples: Examples<21>. + +signal — Set handlers for asynchronous events + +* General rules:: +* Module contents: Module contents<2>. +* Examples: Examples<22>. +* Note on SIGPIPE:: +* Note on Signal Handlers and Exceptions:: + +General rules + +* Execution of Python signal handlers:: +* Signals and threads:: + +mmap — Memory-mapped file support + +* MADV_* Constants:: +* MAP_* Constants:: + +Internet Data Handling + +* email — An email and MIME handling package:: +* json — JSON encoder and decoder:: +* mailbox — Manipulate mailboxes in various formats:: +* mimetypes — Map filenames to MIME types:: +* base64 — Base16, Base32, Base64, Base85 Data Encodings: base64 — Base16 Base32 Base64 Base85 Data Encodings. +* binascii — Convert between binary and ASCII:: +* quopri — Encode and decode MIME quoted-printable data:: + +email — An email and MIME handling package + +* 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; Examples: email Examples. +* email.message.Message; Representing an email message using the compat32 API: email message Message Representing an email message using the compat32 API. +* email.mime; Creating email and MIME objects from scratch: email mime Creating email and MIME objects from scratch. +* email.header; Internationalized headers: email header Internationalized headers. +* email.charset; Representing character sets: email charset Representing character sets. +* email.encoders; Encoders: email encoders Encoders. +* email.utils; Miscellaneous utilities: email utils Miscellaneous utilities. +* email.iterators; Iterators: email iterators Iterators. + +email.parser: Parsing email messages + +* FeedParser API:: +* Parser API:: +* Additional notes:: + +email.contentmanager: Managing MIME Content + +* Content Manager Instances:: + +json — JSON encoder and decoder + +* Basic Usage:: +* Encoders and Decoders:: +* Exceptions: Exceptions<17>. +* Standard Compliance and Interoperability:: +* Command Line Interface: Command Line Interface<2>. + +Standard Compliance and Interoperability + +* Character Encodings:: +* Infinite and NaN Number Values:: +* Repeated Names Within an Object:: +* Top-level Non-Object, Non-Array Values: Top-level Non-Object Non-Array Values. +* Implementation Limitations:: + +Command Line Interface + +* Command line options: Command line options<2>. + +mailbox — Manipulate mailboxes in various formats + +* Mailbox objects:: +* Message objects:: +* Exceptions: Exceptions<18>. +* Examples: Examples<23>. + +Mailbox objects + +* Maildir objects:: +* mbox objects:: +* MH objects:: +* Babyl objects:: +* MMDF objects:: + +Message objects + +* MaildirMessage objects:: +* mboxMessage objects:: +* MHMessage objects:: +* BabylMessage objects:: +* MMDFMessage objects:: + +mimetypes — Map filenames to MIME types + +* MimeTypes Objects:: + +base64 — Base16, Base32, Base64, Base85 Data Encodings + +* RFC 4648 Encodings:: +* Base85 Encodings:: +* Legacy Interface:: +* Security Considerations: Security Considerations<2>. + +Structured Markup Processing Tools + +* html — HyperText Markup Language support:: +* html.parser — Simple HTML and XHTML parser: html parser — Simple HTML and XHTML parser. +* html.entities — Definitions of HTML general entities: html entities — Definitions of HTML general entities. +* XML Processing Modules:: +* xml.etree.ElementTree — The ElementTree XML API: xml etree ElementTree — The ElementTree XML API. +* xml.dom — The Document Object Model API: xml dom — The Document Object Model API. +* xml.dom.minidom — Minimal DOM implementation: xml dom minidom — Minimal DOM implementation. +* xml.dom.pulldom — Support for building partial DOM trees: xml dom pulldom — Support for building partial DOM trees. +* xml.sax — Support for SAX2 parsers: xml sax — Support for SAX2 parsers. +* xml.sax.handler — Base classes for SAX handlers: xml sax handler — Base classes for SAX handlers. +* xml.sax.saxutils — SAX Utilities: xml sax saxutils — SAX Utilities. +* xml.sax.xmlreader — Interface for XML parsers: xml sax xmlreader — Interface for XML parsers. +* xml.parsers.expat — Fast XML parsing using Expat: xml parsers expat — Fast XML parsing using Expat. + +html.parser — Simple HTML and XHTML parser + +* Example HTML Parser Application:: +* HTMLParser Methods:: +* Examples: Examples<24>. + +XML Processing Modules + +* XML security:: + +xml.etree.ElementTree — The ElementTree XML API + +* Tutorial: Tutorial<3>. +* XPath support:: +* Reference: Reference<4>. +* XInclude support:: +* Reference: Reference<5>. + +Tutorial + +* XML tree and elements:: +* Parsing XML:: +* Pull API for non-blocking parsing:: +* Finding interesting elements:: +* Modifying an XML File:: +* Building XML documents:: +* Parsing XML with Namespaces:: + +XPath support + +* Example: Example<8>. +* Supported XPath syntax:: + +Reference + +* Functions: Functions<9>. + +XInclude support + +* Example: Example<9>. + +Reference + +* Functions: Functions<10>. +* Element Objects:: +* ElementTree Objects:: +* QName Objects:: +* TreeBuilder Objects:: +* XMLParser Objects:: +* XMLPullParser Objects:: +* Exceptions: Exceptions<19>. + +xml.dom — The Document Object Model API + +* Module Contents: Module Contents<4>. +* Objects in the DOM:: +* Conformance:: + +Objects in the DOM + +* DOMImplementation Objects:: +* Node Objects:: +* NodeList Objects:: +* DocumentType Objects:: +* Document Objects:: +* Element Objects: Element Objects<2>. +* Attr Objects:: +* NamedNodeMap Objects:: +* Comment Objects:: +* Text and CDATASection Objects:: +* ProcessingInstruction Objects:: +* Exceptions: Exceptions<20>. + +Conformance + +* Type Mapping:: +* Accessor Methods:: + +xml.dom.minidom — Minimal DOM implementation + +* DOM Objects:: +* DOM Example:: +* minidom and the DOM standard:: + +xml.dom.pulldom — Support for building partial DOM trees + +* DOMEventStream Objects:: + +xml.sax — Support for SAX2 parsers + +* SAXException Objects:: + +xml.sax.handler — Base classes for SAX handlers + +* ContentHandler Objects:: +* DTDHandler Objects:: +* EntityResolver Objects:: +* ErrorHandler Objects:: +* LexicalHandler Objects:: + +xml.sax.xmlreader — Interface for XML parsers + +* XMLReader Objects:: +* IncrementalParser Objects:: +* Locator Objects:: +* InputSource Objects:: +* The Attributes Interface:: +* The AttributesNS Interface:: + +xml.parsers.expat — Fast XML parsing using Expat + +* XMLParser Objects: XMLParser Objects<2>. +* ExpatError Exceptions:: +* Example: Example<10>. +* Content Model Descriptions:: +* Expat error constants:: + +Internet Protocols and Support + +* webbrowser — Convenient web-browser controller:: +* wsgiref — WSGI Utilities and Reference Implementation:: +* urllib — URL handling modules:: +* urllib.request — Extensible library for opening URLs: urllib request — Extensible library for opening URLs. +* urllib.response — Response classes used by urllib: urllib response — Response classes used by urllib. +* urllib.parse — Parse URLs into components: urllib parse — Parse URLs into components. +* urllib.error — Exception classes raised by urllib.request: urllib error — Exception classes raised by urllib request. +* urllib.robotparser — Parser for robots.txt: urllib robotparser — Parser for robots txt. +* http — HTTP modules:: +* http.client — HTTP protocol client: http client — HTTP protocol client. +* ftplib — FTP protocol client:: +* poplib — POP3 protocol client:: +* imaplib — IMAP4 protocol client:: +* smtplib — SMTP protocol client:: +* uuid — UUID objects according to RFC 4122:: +* socketserver — A framework for network servers:: +* http.server — HTTP servers: http server — HTTP servers. +* http.cookies — HTTP state management: http cookies — HTTP state management. +* http.cookiejar — Cookie handling for HTTP clients: http cookiejar — Cookie handling for HTTP clients. +* xmlrpc — XMLRPC server and client modules:: +* xmlrpc.client — XML-RPC client access: xmlrpc client — XML-RPC client access. +* xmlrpc.server — Basic XML-RPC servers: xmlrpc server — Basic XML-RPC servers. +* ipaddress — IPv4/IPv6 manipulation library:: + +webbrowser — Convenient web-browser controller + +* Browser Controller Objects:: + +wsgiref — WSGI Utilities and Reference Implementation + +* wsgiref.util – WSGI environment utilities: wsgiref util – WSGI environment utilities. +* wsgiref.headers – WSGI response header tools: wsgiref headers – WSGI response header tools. +* wsgiref.simple_server – a simple WSGI HTTP server: wsgiref simple_server – a simple WSGI HTTP server. +* wsgiref.validate — WSGI conformance checker: wsgiref validate — WSGI conformance checker. +* wsgiref.handlers – server/gateway base classes: wsgiref handlers – server/gateway base classes. +* wsgiref.types – WSGI types for static type checking: wsgiref types – WSGI types for static type checking. +* Examples: Examples<25>. + +urllib.request — Extensible library for opening URLs + +* Request Objects:: +* OpenerDirector Objects:: +* BaseHandler Objects:: +* HTTPRedirectHandler Objects:: +* HTTPCookieProcessor Objects:: +* ProxyHandler Objects:: +* HTTPPasswordMgr Objects:: +* HTTPPasswordMgrWithPriorAuth Objects:: +* AbstractBasicAuthHandler Objects:: +* HTTPBasicAuthHandler Objects:: +* ProxyBasicAuthHandler Objects:: +* AbstractDigestAuthHandler Objects:: +* HTTPDigestAuthHandler Objects:: +* ProxyDigestAuthHandler Objects:: +* HTTPHandler Objects:: +* HTTPSHandler Objects:: +* FileHandler Objects:: +* DataHandler Objects:: +* FTPHandler Objects:: +* CacheFTPHandler Objects:: +* UnknownHandler Objects:: +* HTTPErrorProcessor Objects:: +* Examples: Examples<26>. +* Legacy interface:: +* urllib.request Restrictions: urllib request Restrictions. + +urllib.parse — Parse URLs into components + +* URL Parsing:: +* URL parsing security:: +* Parsing ASCII Encoded Bytes:: +* Structured Parse Results:: +* URL Quoting:: + +http — HTTP modules + +* HTTP status codes:: +* HTTP status category:: +* HTTP methods:: + +http.client — HTTP protocol client + +* HTTPConnection Objects:: +* HTTPResponse Objects:: +* Examples: Examples<27>. +* HTTPMessage Objects:: + +ftplib — FTP protocol client + +* Reference: Reference<6>. + +Reference + +* FTP objects:: +* FTP_TLS objects:: +* Module variables:: + +poplib — POP3 protocol client + +* POP3 Objects:: +* POP3 Example:: + +imaplib — IMAP4 protocol client + +* IMAP4 Objects:: +* IMAP4 Example:: + +smtplib — SMTP protocol client + +* SMTP Objects:: +* SMTP Example:: + +uuid — UUID objects according to RFC 4122 + +* Command-Line Usage: Command-Line Usage<2>. +* Example: Example<11>. +* Command-Line Example:: + +socketserver — A framework for network servers + +* Server Creation Notes:: +* Server Objects: Server Objects<2>. +* Request Handler Objects:: +* Examples: Examples<28>. + +Examples + +* socketserver.TCPServer Example: socketserver TCPServer Example. +* socketserver.UDPServer Example: socketserver UDPServer Example. +* Asynchronous Mixins:: + +http.server — HTTP servers + +* Command-line interface: Command-line interface<2>. +* Security considerations: Security considerations<3>. + +http.cookies — HTTP state management + +* Cookie Objects:: +* Morsel Objects:: +* Example: Example<12>. + +http.cookiejar — Cookie handling for HTTP clients + +* CookieJar and FileCookieJar Objects:: +* FileCookieJar subclasses and co-operation with web browsers:: +* CookiePolicy Objects:: +* DefaultCookiePolicy Objects:: +* Cookie Objects: Cookie Objects<2>. +* Examples: Examples<29>. + +xmlrpc.client — XML-RPC client access + +* ServerProxy Objects:: +* DateTime Objects:: +* Binary Objects:: +* Fault Objects:: +* ProtocolError Objects:: +* MultiCall Objects:: +* Convenience Functions:: +* Example of Client Usage:: +* Example of Client and Server Usage:: + +xmlrpc.server — Basic XML-RPC servers + +* SimpleXMLRPCServer Objects:: +* CGIXMLRPCRequestHandler:: +* Documenting XMLRPC server:: +* DocXMLRPCServer Objects:: +* DocCGIXMLRPCRequestHandler:: + +SimpleXMLRPCServer Objects + +* SimpleXMLRPCServer Example:: + +ipaddress — IPv4/IPv6 manipulation library + +* Convenience factory functions:: +* IP Addresses:: +* IP Network definitions:: +* Interface objects:: +* Other Module Level Functions:: +* Custom Exceptions:: + +IP Addresses + +* Address objects:: +* Conversion to Strings and Integers:: +* Operators: Operators<3>. + +Operators + +* Comparison operators:: +* Arithmetic operators:: + +IP Network definitions + +* Prefix, net mask and host mask: Prefix net mask and host mask. +* Network objects:: +* Operators: Operators<4>. + +Operators + +* Logical operators:: +* Iteration:: +* Networks as containers of addresses:: + +Interface objects + +* Operators: Operators<5>. + +Operators + +* Logical operators: Logical operators<2>. + +Multimedia Services + +* wave — Read and write WAV files:: +* colorsys — Conversions between color systems:: + +wave — Read and write WAV files + +* Wave_read Objects:: +* Wave_write Objects:: + +Internationalization + +* gettext — Multilingual internationalization services:: +* locale — Internationalization services:: + +gettext — Multilingual internationalization services + +* GNU gettext API:: +* Class-based API:: +* Internationalizing your programs and modules:: +* Acknowledgements: Acknowledgements<9>. + +Class-based API + +* The NullTranslations class:: +* The GNUTranslations class:: +* Solaris message catalog support:: +* The Catalog constructor:: + +Internationalizing your programs and modules + +* Localizing your module:: +* Localizing your application:: +* Changing languages on the fly:: +* Deferred translations:: + +locale — Internationalization services + +* Background, details, hints, tips and caveats: Background details hints tips and caveats. +* Locale names:: +* For extension writers and programs that embed Python:: +* Access to message catalogs:: + +Program Frameworks + +* turtle — Turtle graphics:: +* cmd — Support for line-oriented command interpreters:: +* shlex — Simple lexical analysis:: + +turtle — Turtle graphics + +* Introduction: Introduction<11>. +* Get started:: +* Tutorial: Tutorial<4>. +* How to…:: +* Turtle graphics reference:: +* Methods of RawTurtle/Turtle and corresponding functions:: +* Methods of TurtleScreen/Screen and corresponding functions:: +* Public classes:: +* Explanation: Explanation<2>. +* Help and configuration:: +* turtledemo — Demo scripts:: +* Changes since Python 2.6: Changes since Python 2 6. +* Changes since Python 3.0: Changes since Python 3 0. + +Tutorial + +* Starting a turtle environment:: +* Basic drawing:: +* Making algorithmic patterns:: + +Basic drawing + +* Pen control:: +* The turtle’s position:: + +How to… + +* Get started as quickly as possible:: +* Use the turtle module namespace:: +* Use turtle graphics in a script:: +* Use object-oriented turtle graphics:: + +Turtle graphics reference + +* Turtle methods:: +* Methods of TurtleScreen/Screen:: + +Methods of RawTurtle/Turtle and corresponding functions + +* Turtle motion:: +* Tell Turtle’s state:: +* Settings for measurement:: +* Pen control: Pen control<2>. +* Turtle state:: +* Using events:: +* Special Turtle methods:: +* Compound shapes:: + +Pen control + +* Drawing state:: +* Color control:: +* Filling:: +* More drawing control:: + +Turtle state + +* Visibility:: +* Appearance:: + +Methods of TurtleScreen/Screen and corresponding functions + +* Window control:: +* Animation control:: +* Using screen events:: +* Input methods:: +* Settings and special methods:: +* Methods specific to Screen, not inherited from TurtleScreen: Methods specific to Screen not inherited from TurtleScreen. + +Help and configuration + +* How to use help:: +* Translation of docstrings into different languages:: +* How to configure Screen and Turtles:: + +cmd — Support for line-oriented command interpreters + +* Cmd Objects:: +* Cmd Example:: + +shlex — Simple lexical analysis + +* shlex Objects:: +* Parsing Rules:: +* Improved Compatibility with Shells:: + +Graphical User Interfaces with Tk + +* tkinter — Python interface to Tcl/Tk:: +* tkinter.colorchooser — Color choosing dialog: tkinter colorchooser — Color choosing dialog. +* tkinter.font — Tkinter font wrapper: tkinter font — Tkinter font wrapper. +* Tkinter Dialogs:: +* tkinter.messagebox — Tkinter message prompts: tkinter messagebox — Tkinter message prompts. +* tkinter.scrolledtext — Scrolled Text Widget: tkinter scrolledtext — Scrolled Text Widget. +* tkinter.dnd — Drag and drop support: tkinter dnd — Drag and drop support. +* tkinter.ttk — Tk themed widgets: tkinter ttk — Tk themed widgets. +* IDLE — Python editor and shell: IDLE — Python editor and shell<2>. + +tkinter — Python interface to Tcl/Tk + +* Architecture:: +* Tkinter Modules:: +* Tkinter Life Preserver:: +* Threading model:: +* Handy Reference:: +* File Handlers:: + +Tkinter Life Preserver + +* A Hello World Program:: +* Important Tk Concepts:: +* Understanding How Tkinter Wraps Tcl/Tk:: +* How do I…? What option does…?:: +* Navigating the Tcl/Tk Reference Manual:: + +Handy Reference + +* Setting Options:: +* The Packer:: +* Packer Options:: +* Coupling Widget Variables:: +* The Window Manager:: +* Tk Option Data Types:: +* Bindings and Events:: +* The index Parameter:: +* Images:: + +Tkinter Dialogs + +* tkinter.simpledialog — Standard Tkinter input dialogs: tkinter simpledialog — Standard Tkinter input dialogs. +* tkinter.filedialog — File selection dialogs: tkinter filedialog — File selection dialogs. +* tkinter.commondialog — Dialog window templates: tkinter commondialog — Dialog window templates. + +tkinter.filedialog — File selection dialogs + +* Native Load/Save Dialogs:: + +tkinter.ttk — Tk themed widgets + +* Using Ttk:: +* Ttk Widgets:: +* Widget:: +* Combobox:: +* Spinbox:: +* Notebook:: +* Progressbar:: +* Separator:: +* Sizegrip:: +* Treeview:: +* Ttk Styling:: + +Widget + +* Standard Options:: +* Scrollable Widget Options:: +* Label Options:: +* Compatibility Options:: +* Widget States:: +* ttk.Widget: ttk Widget. + +Combobox + +* Options:: +* Virtual events:: +* ttk.Combobox: ttk Combobox. + +Spinbox + +* Options: Options<2>. +* Virtual events: Virtual events<2>. +* ttk.Spinbox: ttk Spinbox. + +Notebook + +* Options: Options<3>. +* Tab Options:: +* Tab Identifiers:: +* Virtual Events:: +* ttk.Notebook: ttk Notebook. + +Progressbar + +* Options: Options<4>. +* ttk.Progressbar: ttk Progressbar. + +Separator + +* Options: Options<5>. + +Sizegrip + +* Platform-specific notes:: +* Bugs:: + +Treeview + +* Options: Options<6>. +* Item Options:: +* Tag Options:: +* Column Identifiers:: +* Virtual Events: Virtual Events<2>. +* ttk.Treeview: ttk Treeview. + +Ttk Styling + +* Layouts:: + +IDLE — Python editor and shell + +* Menus:: +* Editing and Navigation:: +* Startup and Code Execution:: +* Help and Preferences:: +* idlelib — implementation of IDLE application:: + +Menus + +* File menu (Shell and Editor): File menu Shell and Editor. +* Edit menu (Shell and Editor): Edit menu Shell and Editor. +* Format menu (Editor window only): Format menu Editor window only. +* Run menu (Editor window only): Run menu Editor window only. +* Shell menu (Shell window only): Shell menu Shell window only. +* Debug menu (Shell window only): Debug menu Shell window only. +* Options menu (Shell and Editor): Options menu Shell and Editor. +* Window menu (Shell and Editor): Window menu Shell and Editor. +* Help menu (Shell and Editor): Help menu Shell and Editor. +* Context menus:: + +Editing and Navigation + +* Editor windows:: +* Key bindings:: +* Automatic indentation:: +* Search and Replace:: +* Completions:: +* Calltips:: +* Code Context:: +* Shell window:: +* Text colors:: + +Startup and Code Execution + +* Command line usage:: +* Startup failure:: +* Running user code:: +* User output in Shell:: +* Developing tkinter applications:: +* Running without a subprocess:: + +Help and Preferences + +* Help sources:: +* Setting preferences:: +* IDLE on macOS:: +* Extensions:: + +Development Tools + +* typing — Support for type hints:: +* pydoc — Documentation generator and online help system:: +* Python Development Mode:: +* doctest — Test interactive Python examples:: +* unittest — Unit testing framework:: +* unittest.mock — mock object library: unittest mock — mock object library. +* unittest.mock — getting started: unittest mock — getting started. +* test — Regression tests package for Python:: +* test.support — Utilities for the Python test suite: test support — Utilities for the Python test suite. +* test.support.socket_helper — Utilities for socket tests: test support socket_helper — Utilities for socket tests. +* test.support.script_helper — Utilities for the Python execution tests: test support script_helper — Utilities for the Python execution tests. +* test.support.bytecode_helper — Support tools for testing correct bytecode generation: test support bytecode_helper — Support tools for testing correct bytecode generation. +* test.support.threading_helper — Utilities for threading tests: test support threading_helper — Utilities for threading tests. +* test.support.os_helper — Utilities for os tests: test support os_helper — Utilities for os tests. +* test.support.import_helper — Utilities for import tests: test support import_helper — Utilities for import tests. +* test.support.warnings_helper — Utilities for warnings tests: test support warnings_helper — Utilities for warnings tests. + +typing — Support for type hints + +* Specification for the Python Type System:: +* Type aliases:: +* NewType:: +* Annotating callable objects:: +* Generics:: +* Annotating tuples:: +* The type of class objects:: +* Annotating generators and coroutines:: +* User-defined generic types:: +* The Any type:: +* Nominal vs structural subtyping:: +* Module contents: Module contents<3>. +* Deprecation Timeline of Major Features:: + +Module contents + +* Special typing primitives:: +* Protocols: Protocols<3>. +* ABCs for working with IO:: +* Functions and decorators:: +* Introspection helpers:: +* Constant:: +* Deprecated aliases:: + +Special typing primitives + +* Special types:: +* Special forms:: +* Building generic types and type aliases:: +* Other special directives:: + +Deprecated aliases + +* 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 Development Mode + +* Effects of the Python Development Mode:: +* ResourceWarning Example:: +* Bad file descriptor error example:: + +doctest — Test interactive Python examples + +* Simple Usage; Checking Examples in Docstrings: Simple Usage Checking Examples in Docstrings. +* Simple Usage; Checking Examples in a Text File: Simple Usage Checking Examples in a Text File. +* Command-line Usage:: +* How It Works:: +* Basic API:: +* Unittest API:: +* Advanced API:: +* Debugging:: +* Soapbox:: + +How It Works + +* Which Docstrings Are Examined?:: +* How are Docstring Examples Recognized?:: +* What’s the Execution Context?:: +* What About Exceptions?:: +* Option Flags:: +* Directives:: +* Warnings: Warnings<2>. + +Advanced API + +* DocTest Objects:: +* Example Objects:: +* DocTestFinder objects:: +* DocTestParser objects:: +* TestResults objects:: +* DocTestRunner objects:: +* OutputChecker objects:: + +unittest — Unit testing framework + +* Basic example:: +* Command-Line Interface: Command-Line Interface<3>. +* Test Discovery:: +* Organizing test code:: +* Re-using old test code:: +* Skipping tests and expected failures:: +* Distinguishing test iterations using subtests:: +* Classes and functions:: +* Class and Module Fixtures:: +* Signal Handling:: + +Command-Line Interface + +* Command-line options: Command-line options<3>. + +Classes and functions + +* Test cases:: +* Grouping tests:: +* Loading and running tests:: + +Loading and running tests + +* load_tests Protocol:: + +Class and Module Fixtures + +* setUpClass and tearDownClass:: +* setUpModule and tearDownModule:: + +unittest.mock — mock object library + +* Quick Guide:: +* The Mock Class:: +* The patchers:: +* MagicMock and magic method support:: +* Helpers:: +* Order of precedence of side_effect, return_value and wraps: Order of precedence of side_effect return_value and wraps. + +The Mock Class + +* Calling:: +* Deleting Attributes:: +* Mock names and the name attribute:: +* Attaching Mocks as Attributes:: + +The patchers + +* patch:: +* patch.object: patch object. +* patch.dict: patch dict. +* patch.multiple: patch multiple. +* patch methods; start and stop: patch methods start and stop. +* patch builtins:: +* TEST_PREFIX:: +* Nesting Patch Decorators:: +* Where to patch:: +* Patching Descriptors and Proxy Objects:: + +MagicMock and magic method support + +* Mocking Magic Methods:: +* Magic Mock:: + +Helpers + +* sentinel:: +* DEFAULT:: +* call:: +* create_autospec:: +* ANY:: +* FILTER_DIR:: +* mock_open:: +* Autospeccing:: +* Sealing mocks:: + +unittest.mock — getting started + +* Using Mock:: +* Patch Decorators:: +* Further Examples:: + +Using Mock + +* Mock Patching Methods:: +* Mock for Method Calls on an Object:: +* Mocking Classes:: +* Naming your mocks:: +* Tracking all Calls:: +* Setting Return Values and Attributes:: +* Raising exceptions with mocks:: +* Side effect functions and iterables:: +* Mocking asynchronous iterators:: +* Mocking asynchronous context manager:: +* Creating a Mock from an Existing Object:: +* Using side_effect to return per file content:: + +Further Examples + +* Mocking chained calls:: +* Partial mocking:: +* Mocking a Generator Method:: +* Applying the same patch to every test method:: +* Mocking Unbound Methods:: +* Checking multiple calls with mock:: +* Coping with mutable arguments:: +* Nesting Patches:: +* Mocking a dictionary with MagicMock:: +* Mock subclasses and their attributes:: +* Mocking imports with patch.dict: Mocking imports with patch dict. +* 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:: +* Running tests using the command-line interface:: + +Debugging and Profiling + +* Audit events table:: +* bdb — Debugger framework:: +* faulthandler — Dump the Python traceback:: +* pdb — The Python Debugger:: +* The Python Profilers:: +* timeit — Measure execution time of small code snippets:: +* trace — Trace or track Python statement execution:: +* tracemalloc — Trace memory allocations:: + +faulthandler — Dump the Python traceback + +* Dumping the traceback:: +* Fault handler state:: +* Dumping the tracebacks after a timeout:: +* Dumping the traceback on a user signal:: +* Issue with file descriptors:: +* Example: Example<13>. + +pdb — The Python Debugger + +* Debugger Commands:: + +The Python Profilers + +* Introduction to the profilers:: +* Instant User’s Manual:: +* profile and cProfile Module Reference:: +* The Stats Class:: +* What Is Deterministic Profiling?:: +* Limitations:: +* Calibration:: +* Using a custom timer:: + +timeit — Measure execution time of small code snippets + +* Basic Examples: Basic Examples<2>. +* Python Interface:: +* Command-Line Interface: Command-Line Interface<4>. +* Examples: Examples<30>. + +trace — Trace or track Python statement execution + +* Command-Line Usage: Command-Line Usage<3>. +* Programmatic Interface:: + +Command-Line Usage + +* Main options:: +* Modifiers:: +* Filters:: + +tracemalloc — Trace memory allocations + +* Examples: Examples<31>. +* API:: + +Examples + +* Display the top 10:: +* Compute differences:: +* Get the traceback of a memory block:: +* Pretty top:: + +Pretty top + +* Record the current and peak size of all traced memory blocks:: + +API + +* Functions: Functions<11>. +* DomainFilter:: +* Filter:: +* Frame:: +* Snapshot:: +* Statistic:: +* StatisticDiff:: +* Trace:: +* Traceback:: + +Software Packaging and Distribution + +* ensurepip — Bootstrapping the pip installer:: +* venv — Creation of virtual environments:: +* zipapp — Manage executable Python zip archives:: + +ensurepip — Bootstrapping the pip installer + +* Command line interface:: +* Module API:: + +venv — Creation of virtual environments + +* Creating virtual environments:: +* How venvs work:: +* API: API<2>. +* An example of extending EnvBuilder:: + +zipapp — Manage executable Python zip archives + +* Basic Example:: +* Command-Line Interface: Command-Line Interface<5>. +* Python API:: +* Examples: Examples<32>. +* Specifying the Interpreter:: +* Creating Standalone Applications with zipapp:: +* The Python Zip Application Archive Format:: + +Creating Standalone Applications with zipapp + +* Caveats:: + +Python Runtime Services + +* sys — System-specific parameters and functions:: +* sys.monitoring — Execution event monitoring: sys monitoring — Execution event monitoring. +* sysconfig — Provide access to Python’s configuration information:: +* builtins — Built-in objects:: +* __main__ — Top-level code environment:: +* warnings — Warning control:: +* dataclasses — Data Classes:: +* contextlib — Utilities for with-statement contexts:: +* abc — Abstract Base Classes:: +* atexit — Exit handlers:: +* traceback — Print or retrieve a stack traceback:: +* __future__ — Future statement definitions:: +* gc — Garbage Collector interface:: +* inspect — Inspect live objects:: +* site — Site-specific configuration hook:: + +sys.monitoring — Execution event monitoring + +* Tool identifiers:: +* Events:: +* Turning events on and off:: +* Registering callback functions:: + +Tool identifiers + +* Registering and using tools:: + +Events + +* Local events:: +* 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 — Provide access to Python’s configuration information + +* Configuration variables:: +* Installation paths:: +* User scheme:: +* Home scheme:: +* Prefix scheme:: +* Installation path functions:: +* Other functions: Other functions<3>. +* Command-line usage: Command-line usage<3>. + +User scheme + +* posix_user:: +* nt_user:: +* osx_framework_user:: + +Home scheme + +* posix_home:: + +Prefix scheme + +* posix_prefix:: +* nt:: + +__main__ — Top-level code environment + +* __name__ == '__main__':: +* __main__.py in Python Packages: __main__ py in Python Packages. +* import __main__:: + +__name__ == '__main__' + +* What is the “top-level code environment”?:: +* Idiomatic Usage:: +* Packaging Considerations:: + +__main__.py in Python Packages + +* Idiomatic Usage: Idiomatic Usage<2>. + +warnings — Warning control + +* Warning Categories:: +* The Warnings Filter:: +* Temporarily Suppressing Warnings:: +* Testing Warnings:: +* Updating Code For New Versions of Dependencies:: +* Available Functions:: +* Available Context Managers:: + +The Warnings Filter + +* Repeated Warning Suppression Criteria:: +* Describing Warning Filters:: +* Default Warning Filter:: +* Overriding the default filter:: + +dataclasses — Data Classes + +* Module contents: Module contents<4>. +* Post-init processing:: +* Class variables:: +* Init-only variables:: +* Frozen instances:: +* Inheritance: Inheritance<2>. +* Re-ordering of keyword-only parameters in __init__(): Re-ordering of keyword-only parameters in __init__. +* Default factory functions:: +* Mutable default values:: +* Descriptor-typed fields:: + +contextlib — Utilities for with-statement contexts + +* Utilities:: +* Examples and Recipes: Examples and Recipes<3>. +* Single use, reusable and reentrant context managers: Single use reusable and reentrant context managers. + +Examples and Recipes + +* Supporting a variable number of context managers:: +* Catching exceptions from __enter__ methods:: +* Cleaning up in an __enter__ implementation:: +* Replacing any use of try-finally and flag variables:: +* Using a context manager as a function decorator:: + +Single use, reusable and reentrant context managers + +* Reentrant context managers:: +* Reusable context managers:: + +atexit — Exit handlers + +* atexit Example:: + +traceback — Print or retrieve a stack traceback + +* Module-Level Functions: Module-Level Functions<2>. +* TracebackException Objects:: +* StackSummary Objects:: +* FrameSummary Objects:: +* Examples of Using the Module-Level Functions:: +* Examples of Using TracebackException:: + +__future__ — Future statement definitions + +* Module Contents: Module Contents<5>. + +inspect — Inspect live objects + +* Types and members:: +* Retrieving source code:: +* Introspecting callables with the Signature object:: +* Classes and functions: Classes and functions<2>. +* The interpreter stack:: +* Fetching attributes statically:: +* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators. +* Code Objects Bit Flags:: +* Buffer flags:: +* Command Line Interface: Command Line Interface<3>. + +site — Site-specific configuration hook + +* sitecustomize:: +* usercustomize:: +* Readline configuration:: +* Module contents: Module contents<5>. +* Command Line Interface: Command Line Interface<4>. + +Custom Python Interpreters + +* code — Interpreter base classes:: +* codeop — Compile Python code:: + +code — Interpreter base classes + +* Interactive Interpreter Objects:: +* Interactive Console Objects:: + +Importing Modules + +* zipimport — Import modules from Zip archives:: +* pkgutil — Package extension utility:: +* modulefinder — Find modules used by a script:: +* runpy — Locating and executing Python modules:: +* importlib — The implementation of import:: +* importlib.resources – Package resource reading, opening and access: importlib resources – Package resource reading opening and access. +* importlib.resources.abc – Abstract base classes for resources: importlib resources abc – Abstract base classes for resources. +* importlib.metadata – Accessing package metadata: importlib metadata – Accessing package metadata. +* The initialization of the sys.path module search path: The initialization of the sys path module search path. + +zipimport — Import modules from Zip archives + +* zipimporter Objects:: +* Examples: Examples<33>. + +modulefinder — Find modules used by a script + +* Example usage of ModuleFinder:: + +importlib — The implementation of import + +* Introduction: Introduction<12>. +* Functions: Functions<12>. +* importlib.abc – Abstract base classes related to import: importlib abc – Abstract base classes related to import. +* importlib.machinery – Importers and path hooks: importlib machinery – Importers and path hooks. +* importlib.util – Utility code for importers: importlib util – Utility code for importers. +* Examples: Examples<34>. + +Examples + +* Importing programmatically:: +* Checking if a module can be imported:: +* Importing a source file directly:: +* Implementing lazy imports:: +* Setting up an importer:: +* Approximating importlib.import_module(): Approximating importlib import_module. + +importlib.resources – Package resource reading, opening and access + +* Functional API:: + +importlib.metadata – Accessing package metadata + +* Overview: Overview<3>. +* Functional API: Functional API<2>. +* Distributions:: +* Distribution Discovery:: +* Extending the search algorithm:: + +Functional API + +* Entry points:: +* Distribution metadata:: +* Distribution versions:: +* Distribution files:: +* Distribution requirements:: +* Mapping import to distribution packages:: + +Extending the search algorithm + +* Example: Example<14>. + +The initialization of the sys.path module search path + +* Virtual environments: Virtual environments<2>. +* _pth files:: +* Embedded Python:: + +Python Language Services + +* ast — Abstract Syntax Trees:: +* symtable — Access to the compiler’s symbol tables:: +* token — Constants used with Python parse trees:: +* keyword — Testing for Python keywords:: +* tokenize — Tokenizer for Python source:: +* tabnanny — Detection of ambiguous indentation:: +* pyclbr — Python module browser support:: +* py_compile — Compile Python source files:: +* compileall — Byte-compile Python libraries:: +* dis — Disassembler for Python bytecode:: +* pickletools — Tools for pickle developers:: + +ast — Abstract Syntax Trees + +* Abstract Grammar:: +* Node classes:: +* ast Helpers:: +* Compiler Flags:: +* Command-Line Usage: Command-Line Usage<4>. + +Node classes + +* Root nodes:: +* Literals: Literals<3>. +* Variables:: +* Expressions: Expressions<2>. +* Statements:: +* Control flow:: +* Pattern matching:: +* Type annotations:: +* Type parameters:: +* Function and class definitions:: +* Async and await:: + +Expressions + +* Subscripting:: +* Comprehensions:: + +Statements + +* Imports:: + +symtable — Access to the compiler’s symbol tables + +* Generating Symbol Tables:: +* Examining Symbol Tables:: +* Command-Line Usage: Command-Line Usage<5>. + +tokenize — Tokenizer for Python source + +* Tokenizing Input:: +* Command-Line Usage: Command-Line Usage<6>. +* Examples: Examples<35>. + +pyclbr — Python module browser support + +* Function Objects:: +* Class Objects: Class Objects<2>. + +py_compile — Compile Python source files + +* Command-Line Interface: Command-Line Interface<6>. + +compileall — Byte-compile Python libraries + +* Command-line use:: +* Public functions:: + +dis — Disassembler for Python bytecode + +* Command-line interface: Command-line interface<3>. +* Bytecode analysis:: +* Analysis functions:: +* Python Bytecode Instructions:: +* Opcode collections:: + +pickletools — Tools for pickle developers + +* Command line usage: Command line usage<2>. +* Programmatic Interface: Programmatic Interface<2>. + +Command line usage + +* Command line options: Command line options<3>. + +MS Windows Specific Services + +* msvcrt — Useful routines from the MS VC++ runtime:: +* winreg — Windows registry access:: +* winsound — Sound-playing interface for Windows:: + +msvcrt — Useful routines from the MS VC++ runtime + +* File Operations:: +* Console I/O:: +* Other Functions:: + +winreg — Windows registry access + +* Functions: Functions<13>. +* Constants: Constants<10>. +* Registry Handle Objects:: + +Constants + +* HKEY_* Constants:: +* Access Rights:: +* Value Types:: + +Access Rights + +* 64-bit Specific:: + +Unix Specific Services + +* posix — The most common POSIX system calls:: +* pwd — The password database:: +* grp — The group database:: +* termios — POSIX style tty control:: +* tty — Terminal control functions:: +* pty — Pseudo-terminal utilities:: +* fcntl — The fcntl and ioctl system calls:: +* resource — Resource usage information:: +* syslog — Unix syslog library routines:: + +posix — The most common POSIX system calls + +* Large File Support:: +* Notable Module Contents:: + +termios — POSIX style tty control + +* Example: Example<15>. + +pty — Pseudo-terminal utilities + +* Example: Example<16>. + +resource — Resource usage information + +* Resource Limits:: +* Resource Usage:: + +syslog — Unix syslog library routines + +* Examples: Examples<36>. + +Examples + +* Simple example:: + +Superseded Modules + +* getopt — C-style parser for command line options:: + +Removed Modules + +* aifc — Read and write AIFF and AIFC files:: +* asynchat — Asynchronous socket command/response handler:: +* asyncore — Asynchronous socket handler:: +* audioop — Manipulate raw audio data:: +* cgi — Common Gateway Interface support:: +* cgitb — Traceback manager for CGI scripts:: +* chunk — Read IFF chunked data:: +* crypt — Function to check Unix passwords:: +* distutils — Building and installing Python modules:: +* imghdr — Determine the type of an image:: +* imp — Access the import internals:: +* mailcap — Mailcap file handling:: +* msilib — Read and write Microsoft Installer files:: +* nis — Interface to Sun’s NIS (Yellow Pages): nis — Interface to Sun’s NIS Yellow Pages. +* nntplib — NNTP protocol client:: +* ossaudiodev — Access to OSS-compatible audio devices:: +* pipes — Interface to shell pipelines:: +* smtpd — SMTP Server:: +* sndhdr — Determine type of sound file:: +* spwd — The shadow password database:: +* sunau — Read and write Sun AU files:: +* telnetlib — Telnet client:: +* uu — Encode and decode uuencode files:: +* xdrlib — Encode and decode XDR data:: + +Extending and Embedding the Python Interpreter + +* Recommended third party tools:: +* Creating extensions without third party tools:: +* Embedding the CPython runtime in a larger application:: + +Creating extensions without third party tools + +* Extending Python with C or C++:: +* Defining Extension Types; Tutorial: Defining Extension Types Tutorial. +* Defining Extension Types; Assorted Topics: Defining Extension Types Assorted Topics. +* Building C and C++ Extensions:: +* Building C and C++ Extensions on Windows:: + +Extending Python with C or C++ + +* A Simple Example:: +* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions. +* Back to the Example:: +* The Module’s Method Table and Initialization Function:: +* Compilation and Linkage:: +* Calling Python Functions from C:: +* Extracting Parameters in Extension Functions:: +* Keyword Parameters for Extension Functions:: +* Building Arbitrary Values:: +* Reference Counts:: +* Writing Extensions in C++:: +* Providing a C API for an Extension Module:: + +Reference Counts + +* Reference Counting in Python:: +* Ownership Rules:: +* Thin Ice:: +* NULL Pointers:: + +Defining Extension Types: Tutorial + +* The Basics:: +* Adding data and methods to the Basic example:: +* Providing finer control over data attributes:: +* Supporting cyclic garbage collection:: +* Subclassing other types:: + +Defining Extension Types: Assorted Topics + +* Finalization and De-allocation:: +* Object Presentation:: +* Attribute Management:: +* Object Comparison:: +* Abstract Protocol Support:: +* Weak Reference Support:: +* More Suggestions:: + +Attribute Management + +* Generic Attribute Management:: +* Type-specific Attribute Management:: + +Building C and C++ Extensions + +* Building C and C++ Extensions with setuptools:: + +Building C and C++ Extensions on Windows + +* A Cookbook Approach:: +* Differences Between Unix and Windows:: +* Using DLLs in Practice:: + +Embedding the CPython runtime in a larger application + +* Embedding Python in Another Application:: + +Embedding Python in Another Application + +* Very High Level Embedding:: +* Beyond Very High Level Embedding; An overview: Beyond Very High Level Embedding An overview. +* Pure Embedding:: +* Extending Embedded Python:: +* Embedding Python in C++:: +* Compiling and Linking under Unix-like systems:: + +Python/C API Reference Manual + +* Introduction: Introduction<13>. +* C API Stability:: +* The Very High Level Layer:: +* Reference Counting:: +* Exception Handling:: +* Utilities: Utilities<2>. +* Abstract Objects Layer:: +* Concrete Objects Layer:: +* Initialization, Finalization, and Threads: Initialization Finalization and Threads. +* Python Initialization Configuration:: +* Memory Management:: +* Object Implementation Support:: +* API and ABI Versioning:: +* Monitoring C API:: +* Generating Execution Events:: + +Introduction + +* Coding standards:: +* Include Files:: +* Useful macros:: +* Objects, Types and Reference Counts: Objects Types and Reference Counts. +* Exceptions: Exceptions<21>. +* Embedding Python: Embedding Python<2>. +* Debugging Builds:: +* Recommended third party tools: Recommended third party tools<2>. + +Objects, Types and Reference Counts + +* Reference Counts: Reference Counts<2>. +* Types:: + +Reference Counts + +* Reference Count Details:: + +C API Stability + +* Unstable C API:: +* Stable Application Binary Interface:: +* Platform Considerations:: +* Contents of Limited API:: + +Stable Application Binary Interface + +* Limited C API:: +* Stable ABI:: +* Limited API Scope and Performance:: +* Limited API Caveats:: + +Exception Handling + +* Printing and clearing:: +* Raising exceptions:: +* Issuing warnings:: +* Querying the error indicator:: +* Signal Handling: Signal Handling<2>. +* Exception Classes:: +* Exception Objects:: +* Unicode Exception Objects:: +* Recursion Control:: +* Exception and warning types:: + +Exception and warning types + +* Exception types:: +* OSError aliases:: +* Warning types:: + +Utilities + +* Operating System Utilities:: +* System Functions:: +* Process Control:: +* Importing Modules: Importing Modules<2>. +* Data marshalling support:: +* Parsing arguments and building values:: +* String conversion and formatting:: +* PyHash API:: +* Reflection:: +* Codec registry and support functions:: +* PyTime C API:: +* Support for Perf Maps:: + +Parsing arguments and building values + +* Parsing arguments: Parsing arguments<2>. +* Building values:: + +Parsing arguments + +* Strings and buffers:: +* Numbers: Numbers<2>. +* Other objects:: +* API Functions:: + +Codec registry and support functions + +* Codec lookup API:: +* Registry API for Unicode encoding error handlers:: + +PyTime C API + +* Types: Types<2>. +* Clock Functions:: +* Raw Clock Functions:: +* Conversion functions:: + +Abstract Objects Layer + +* Object Protocol:: +* Call Protocol:: +* Number Protocol:: +* Sequence Protocol:: +* Mapping Protocol:: +* Iterator Protocol:: +* Buffer Protocol:: + +Call Protocol + +* The tp_call Protocol:: +* The Vectorcall Protocol:: +* Object Calling API:: +* Call Support API:: + +The Vectorcall Protocol + +* Recursion Control: Recursion Control<2>. +* Vectorcall Support API:: + +Buffer Protocol + +* Buffer structure:: +* Buffer request types:: +* Complex arrays:: +* Buffer-related functions:: + +Buffer request types + +* request-independent fields:: +* readonly, format: readonly format. +* shape, strides, suboffsets: shape strides suboffsets. +* contiguity requests:: +* compound requests:: + +Complex arrays + +* NumPy-style; shape and strides: NumPy-style shape and strides. +* PIL-style; shape, strides and suboffsets: PIL-style shape strides and suboffsets. + +Concrete Objects Layer + +* Fundamental Objects:: +* Numeric Objects:: +* Sequence Objects:: +* Container Objects:: +* Function Objects: Function Objects<2>. +* Other Objects:: + +Fundamental Objects + +* Type Objects: Type Objects<2>. +* The None Object:: + +Type Objects + +* Creating Heap-Allocated Types:: + +Numeric Objects + +* Integer Objects:: +* Boolean Objects:: +* Floating-Point Objects:: +* Complex Number Objects:: + +Floating-Point Objects + +* Pack and Unpack functions:: + +Pack and Unpack functions + +* Pack functions:: +* Unpack functions:: + +Complex Number Objects + +* Complex Numbers as C Structures:: +* Complex Numbers as Python Objects:: + +Sequence Objects + +* Bytes Objects: Bytes Objects<2>. +* Byte Array Objects:: +* Unicode Objects and Codecs:: +* Tuple Objects:: +* Struct Sequence Objects:: +* List Objects:: + +Byte Array Objects + +* Type check macros:: +* Direct API functions:: +* Macros:: + +Unicode Objects and Codecs + +* Unicode Objects:: +* Built-in Codecs:: +* Methods and Slot Functions:: + +Unicode Objects + +* Unicode Type:: +* Unicode Character Properties:: +* Creating and accessing Unicode strings:: +* Locale Encoding:: +* File System Encoding:: +* wchar_t Support:: + +Built-in Codecs + +* Generic Codecs:: +* 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:: +* MBCS codecs for Windows:: + +Container Objects + +* Dictionary Objects:: +* Set Objects:: + +Function Objects + +* Function Objects: Function Objects<3>. +* Instance Method Objects:: +* Method Objects: Method Objects<2>. +* Cell Objects:: +* Code Objects: Code Objects<2>. +* Code Object Flags:: +* Extra information:: + +Other Objects + +* File Objects:: +* Module Objects:: +* Iterator Objects:: +* Descriptor Objects:: +* Slice Objects:: +* MemoryView objects:: +* Weak Reference Objects: Weak Reference Objects<2>. +* Capsules: Capsules<2>. +* Frame Objects:: +* Generator Objects:: +* Coroutine Objects: Coroutine Objects<2>. +* Context Variables Objects:: +* DateTime Objects: DateTime Objects<2>. +* Objects for Type Hinting:: + +Module Objects + +* Initializing C modules:: +* Module lookup:: + +Initializing C modules + +* Single-phase initialization:: +* Multi-phase initialization:: +* Low-level module creation functions:: +* Support functions:: + +Slice Objects + +* Ellipsis Object:: + +Frame Objects + +* Frame Locals Proxies:: +* Internal Frames:: + +Initialization, Finalization, and Threads + +* Before Python Initialization:: +* Global configuration variables:: +* Initializing and finalizing the interpreter:: +* Process-wide parameters:: +* Thread State and the Global Interpreter Lock:: +* Sub-interpreter support:: +* Asynchronous Notifications:: +* Profiling and Tracing:: +* Reference tracing:: +* Advanced Debugger Support:: +* Thread Local Storage Support:: +* Synchronization Primitives: Synchronization Primitives<2>. + +Thread State and the Global Interpreter Lock + +* Releasing the GIL from extension code:: +* Non-Python created threads:: +* Cautions about fork(): Cautions about fork. +* High-level API:: +* Low-level API:: + +Sub-interpreter support + +* A Per-Interpreter GIL:: +* Bugs and caveats:: + +Thread Local Storage Support + +* Thread Specific Storage (TSS) API: Thread Specific Storage TSS API. +* Thread Local Storage (TLS) API: Thread Local Storage TLS API. + +Thread Specific Storage (TSS) API + +* Dynamic Allocation:: +* Methods: Methods<2>. + +Synchronization Primitives + +* Python Critical Section API:: + +Python Initialization Configuration + +* Example: Example<17>. +* PyWideStringList:: +* PyStatus:: +* PyPreConfig:: +* Preinitialize Python with PyPreConfig:: +* PyConfig:: +* Initialization with PyConfig:: +* Isolated Configuration:: +* Python Configuration:: +* Python Path Configuration:: +* Py_GetArgcArgv(): Py_GetArgcArgv. +* Multi-Phase Initialization Private Provisional API:: + +Memory Management + +* Overview: Overview<4>. +* Allocator Domains:: +* Raw Memory Interface:: +* Memory Interface:: +* Object allocators:: +* Default Memory Allocators:: +* Customize Memory Allocators:: +* Debug hooks on the Python memory allocators:: +* The pymalloc allocator:: +* The mimalloc allocator:: +* tracemalloc C API:: +* Examples: Examples<37>. + +The pymalloc allocator + +* Customize pymalloc Arena Allocator:: + +Object Implementation Support + +* Allocating Objects on the Heap:: +* Common Object Structures:: +* Type Object Structures:: +* Supporting Cyclic Garbage Collection:: + +Common Object Structures + +* 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 + +* Quick Reference:: +* PyTypeObject Definition:: +* PyObject Slots:: +* PyVarObject Slots:: +* PyTypeObject Slots:: +* Static Types:: +* Heap Types:: +* Number Object Structures:: +* Mapping Object Structures:: +* Sequence Object Structures:: +* Buffer Object Structures:: +* Async Object Structures:: +* Slot Type typedefs:: +* Examples: Examples<38>. + +Quick Reference + +* “tp slots”:: +* sub-slots:: +* slot typedefs:: + +Supporting Cyclic Garbage Collection + +* Controlling the Garbage Collector State:: +* Querying Garbage Collector State:: + +Generating Execution Events + +* Managing the Monitoring State:: + +Installing Python Modules + +* Key terms:: +* Basic usage:: +* How do I …?:: +* Common installation issues:: + +How do I …? + +* … install pip in versions of Python prior to Python 3.4?: … install pip in versions of Python prior to Python 3 4?. +* … install packages just for the current user?:: +* … install scientific Python packages?:: +* … work with multiple versions of Python installed in parallel?:: + +Common installation issues + +* Installing into the system Python on Linux:: +* Pip not installed:: +* Installing binary extensions:: + +Python HOWTOs + +* A Conceptual Overview of asyncio:: +* Porting Extension Modules to Python 3:: +* Curses Programming with Python:: +* Descriptor Guide:: +* Debugging C API extensions and CPython Internals with GDB:: +* Enum HOWTO:: +* Functional Programming HOWTO:: +* Logging HOWTO:: +* Logging Cookbook:: +* Regular Expression HOWTO:: +* Socket Programming HOWTO:: +* Sorting Techniques:: +* Unicode HOWTO:: +* HOWTO Fetch Internet Resources Using The urllib Package:: +* An introduction to the ipaddress module:: +* Instrumenting CPython with DTrace and SystemTap:: +* Python support for the Linux perf profiler:: +* Annotations Best Practices:: +* Isolating Extension Modules:: +* timer file descriptor HOWTO:: +* The Python 2.3 Method Resolution Order: The Python 2 3 Method Resolution Order. +* Python experimental support for free threading:: +* C API Extension Support for Free Threading:: + +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:: +* Tasks: Tasks<2>. +* await:: + +A conceptual overview part 2: the nuts and bolts + +* The inner workings of coroutines:: +* Futures: Futures<2>. +* A homemade asyncio.sleep: A homemade asyncio sleep. + +Curses Programming with Python + +* What is curses?:: +* Starting and ending a curses application:: +* Windows and Pads:: +* Displaying Text:: +* User Input:: +* For More Information:: + +What is curses? + +* The Python curses module:: + +Displaying Text + +* Attributes and Color:: + +Descriptor Guide + +* Primer:: +* Complete Practical Example:: +* Technical Tutorial:: +* Pure Python Equivalents:: + +Primer + +* Simple example; A descriptor that returns a constant: Simple example A descriptor that returns a constant. +* Dynamic lookups:: +* Managed attributes:: +* Customized names:: +* Closing thoughts:: + +Complete Practical Example + +* Validator class:: +* Custom validators:: +* Practical application:: + +Technical Tutorial + +* Abstract:: +* Definition and introduction:: +* Descriptor protocol:: +* Overview of descriptor invocation:: +* Invocation from an instance:: +* Invocation from a class:: +* Invocation from super:: +* Summary of invocation logic:: +* Automatic name notification:: +* ORM example:: + +Pure Python Equivalents + +* Properties:: +* Functions and methods:: +* Kinds of methods:: +* Static methods:: +* Class methods:: +* Member objects and __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:: + +Enum HOWTO + +* Programmatic access to enumeration members and their attributes:: +* Duplicating enum members and values:: +* Ensuring unique enumeration values:: +* Using automatic values:: +* Iteration: Iteration<2>. +* Comparisons: Comparisons<3>. +* Allowed members and attributes of enumerations:: +* Restricted Enum subclassing:: +* Dataclass support:: +* Pickling:: +* Functional API: Functional API<3>. +* Derived Enumerations:: +* When to use __new__() vs. __init__(): When to use __new__ vs __init__. +* How are Enums and Flags different?:: +* Enum Cookbook:: +* Subclassing EnumType:: + +Derived Enumerations + +* IntEnum:: +* StrEnum:: +* IntFlag:: +* Flag:: +* Others: Others<2>. + +When to use __new__() vs. __init__() + +* Finer Points:: + +Finer Points + +* Supported __dunder__ names: Supported __dunder__ names<2>. +* Supported _sunder_ names: Supported _sunder_ names<2>. +* _Private__names:: +* Enum member type:: +* Creating members that are mixed with other data types:: +* Boolean value of Enum classes and members:: +* Enum classes with methods:: +* Combining members of Flag:: +* Flag and IntFlag minutia:: + +How are Enums and Flags different? + +* Enum Classes:: +* Flag Classes:: +* Enum Members (aka instances): Enum Members aka instances. +* Flag Members:: + +Enum Cookbook + +* Omitting values:: +* OrderedEnum:: +* DuplicateFreeEnum:: +* MultiValueEnum:: +* Planet:: +* TimePeriod:: + +Omitting values + +* Using auto:: +* Using object:: +* Using a descriptive string:: +* Using a custom __new__(): Using a custom __new__. + +Functional Programming HOWTO + +* Introduction: Introduction<14>. +* Iterators: Iterators<2>. +* Generator expressions and list comprehensions:: +* Generators: Generators<2>. +* Built-in functions: Built-in functions<2>. +* The itertools module:: +* The functools module:: +* Small functions and the lambda expression:: +* Revision History and Acknowledgements:: +* References: References<2>. + +Introduction + +* Formal provability:: +* Modularity:: +* Ease of debugging and testing:: +* Composability:: + +Iterators + +* Data Types That Support Iterators:: + +Generators + +* Passing values into a generator:: + +The itertools module + +* Creating new iterators:: +* Calling functions on elements:: +* Selecting elements:: +* Combinatoric functions:: +* Grouping elements:: + +The functools module + +* The operator module:: + +References + +* General:: +* Python-specific:: +* Python documentation:: + +Logging HOWTO + +* Basic Logging Tutorial:: +* Advanced Logging Tutorial:: +* Logging Levels: Logging Levels<2>. +* Useful Handlers:: +* Exceptions raised during logging:: +* Using arbitrary objects as messages:: +* Optimization:: +* Other resources:: + +Basic Logging Tutorial + +* When to use logging:: +* A simple example:: +* Logging to a file:: +* Logging variable data:: +* Changing the format of displayed messages:: +* Displaying the date/time in messages:: +* Next Steps:: + +Advanced Logging Tutorial + +* Logging Flow:: +* Loggers:: +* Handlers:: +* Formatters:: +* Configuring Logging:: +* What happens if no configuration is provided:: +* Configuring Logging for a Library:: + +Logging Levels + +* Custom Levels:: + +Logging Cookbook + +* Using logging in multiple modules:: +* Logging from multiple threads:: +* Multiple handlers and formatters:: +* Logging to multiple destinations:: +* Custom handling of levels:: +* Configuration server example:: +* Dealing with handlers that block:: +* Sending and receiving logging events across a network:: +* Adding contextual information to your logging output:: +* Use of contextvars:: +* Imparting contextual information in handlers:: +* Logging to a single file from multiple processes:: +* Using file rotation:: +* Use of alternative formatting styles:: +* Customizing LogRecord:: +* Subclassing QueueHandler and QueueListener- a ZeroMQ example:: +* Subclassing QueueHandler and QueueListener- a pynng example:: +* An example dictionary-based configuration:: +* Using a rotator and namer to customize log rotation processing:: +* A more elaborate multiprocessing example:: +* Inserting a BOM into messages sent to a SysLogHandler:: +* Implementing structured logging:: +* Customizing handlers with dictConfig(): Customizing handlers with dictConfig. +* Using particular formatting styles throughout your application:: +* Configuring filters with dictConfig(): Configuring filters with dictConfig. +* Customized exception formatting:: +* Speaking logging messages:: +* Buffering logging messages and outputting them conditionally:: +* Sending logging messages to email, with buffering: Sending logging messages to email with buffering. +* Formatting times using UTC (GMT) via configuration: Formatting times using UTC GMT via configuration. +* Using a context manager for selective logging:: +* A CLI application starter template:: +* A Qt GUI for logging:: +* Logging to syslog with RFC5424 support:: +* How to treat a logger like an output stream:: +* How to uniformly handle newlines in logging output:: +* Patterns to avoid:: +* Other resources: Other resources<2>. + +Sending and receiving logging events across a network + +* Running a logging socket listener in production:: + +Adding contextual information to your logging output + +* Using LoggerAdapters to impart contextual information:: +* Using Filters to impart contextual information:: + +Using LoggerAdapters to impart contextual information + +* Using objects other than dicts to pass contextual information:: + +Logging to a single file from multiple processes + +* Using concurrent.futures.ProcessPoolExecutor: Using 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>. + +Using particular formatting styles throughout your application + +* Using LogRecord factories:: +* Using custom message objects:: + +Patterns to avoid + +* Opening the same log file multiple times:: +* Using loggers as attributes in a class or passing them as parameters:: +* Adding handlers other than NullHandler to a logger in a library:: +* Creating a lot of loggers:: + +Regular Expression HOWTO + +* Introduction: Introduction<15>. +* Simple Patterns:: +* Using Regular Expressions:: +* More Pattern Power:: +* Modifying Strings:: +* Common Problems:: +* Feedback:: + +Simple Patterns + +* Matching Characters:: +* Repeating Things:: + +Using Regular Expressions + +* Compiling Regular Expressions:: +* The Backslash Plague:: +* Performing Matches:: +* Module-Level Functions: Module-Level Functions<3>. +* Compilation Flags:: + +More Pattern Power + +* More Metacharacters:: +* Grouping:: +* Non-capturing and Named Groups:: +* Lookahead Assertions:: + +Modifying Strings + +* Splitting Strings:: +* Search and Replace: Search and Replace<2>. + +Common Problems + +* Use String Methods:: +* match() versus search(): match versus search. +* Greedy versus Non-Greedy:: +* Using re.VERBOSE: Using re VERBOSE. + +Socket Programming HOWTO + +* Sockets:: +* Creating a Socket:: +* Using a Socket:: +* Disconnecting:: +* Non-blocking Sockets:: + +Sockets + +* History:: + +Creating a Socket + +* IPC:: + +Using a Socket + +* Binary Data:: + +Disconnecting + +* When Sockets Die:: + +Sorting Techniques + +* Sorting Basics:: +* Key Functions:: +* Operator Module Functions and Partial Function Evaluation:: +* Ascending and Descending:: +* Sort Stability and Complex Sorts:: +* Decorate-Sort-Undecorate:: +* Comparison Functions:: +* Odds and Ends: Odds and Ends<2>. +* Partial Sorts:: + +Unicode HOWTO + +* Introduction to Unicode:: +* Python’s Unicode Support:: +* Reading and Writing Unicode Data:: +* Acknowledgements: Acknowledgements<10>. + +Introduction to Unicode + +* Definitions:: +* Encodings:: +* References: References<3>. + +Python’s Unicode Support + +* The String Type:: +* Converting to Bytes:: +* Unicode Literals in Python Source Code:: +* Unicode Properties:: +* Comparing Strings:: +* Unicode Regular Expressions:: +* References: References<4>. + +Reading and Writing Unicode Data + +* Unicode filenames:: +* Tips for Writing Unicode-aware Programs:: +* References: References<5>. + +Tips for Writing Unicode-aware Programs + +* Converting Between File Encodings:: +* Files in an Unknown Encoding:: + +HOWTO Fetch Internet Resources Using The urllib Package + +* Introduction: Introduction<16>. +* Fetching URLs:: +* Handling Exceptions: Handling Exceptions<2>. +* info and geturl:: +* Openers and Handlers:: +* Basic Authentication:: +* Proxies:: +* Sockets and Layers:: +* Footnotes:: + +Fetching URLs + +* Data:: +* Headers:: + +Handling Exceptions + +* URLError:: +* HTTPError:: +* Wrapping it Up:: + +HTTPError + +* Error Codes:: + +Wrapping it Up + +* Number 1:: +* Number 2:: + +An introduction to the ipaddress module + +* Creating Address/Network/Interface objects:: +* Inspecting Address/Network/Interface Objects:: +* Networks as lists of Addresses:: +* Comparisons: Comparisons<4>. +* Using IP Addresses with other modules:: +* Getting more detail when instance creation fails:: + +Creating Address/Network/Interface objects + +* A Note on IP Versions:: +* IP Host Addresses:: +* Defining Networks:: +* Host Interfaces:: + +Instrumenting CPython with DTrace and SystemTap + +* Enabling the static markers:: +* Static DTrace probes:: +* Static SystemTap markers:: +* Available static markers:: +* SystemTap Tapsets:: +* Examples: Examples<39>. + +Python support for the Linux perf profiler + +* How to enable perf profiling support:: +* How to obtain the best results:: +* How to work without frame pointers:: + +Annotations Best Practices + +* Accessing The Annotations Dict Of An Object In Python 3.10 And Newer: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer. +* Accessing The Annotations Dict Of An Object In Python 3.9 And Older: Accessing The Annotations Dict Of An Object In Python 3 9 And Older. +* Manually Un-Stringizing Stringized Annotations:: +* Best Practices For __annotations__ In Any Python Version:: +* __annotations__ Quirks:: + +Isolating Extension Modules + +* Who should read this:: +* Background: Background<2>. +* Making Modules Safe with Multiple Interpreters:: +* Heap Types: Heap Types<2>. +* Open Issues:: + +Background + +* Enter Per-Module State:: +* Isolated Module Objects:: +* Surprising Edge Cases:: + +Making Modules Safe with Multiple Interpreters + +* Managing Global State:: +* Managing Per-Module State:: +* Opt-Out; Limiting to One Module Object per Process: Opt-Out Limiting to One Module Object per Process. +* Module State Access from Functions:: + +Heap Types + +* Changing Static Types to Heap Types:: +* Defining Heap Types:: +* Garbage-Collection Protocol:: +* Module State Access from Classes:: +* Module State Access from Regular Methods:: +* Module State Access from Slot Methods, Getters and Setters: Module State Access from Slot Methods Getters and Setters. +* Lifetime of the Module State:: + +Garbage-Collection Protocol + +* tp_traverse in Python 3.8 and lower: tp_traverse in Python 3 8 and lower. +* Delegating tp_traverse:: +* Defining tp_dealloc:: +* Not overriding tp_free:: +* Avoiding PyObject_New:: + +Open Issues + +* Per-Class Scope:: +* Lossless Conversion to Heap Types:: + +timer file descriptor HOWTO + +* Examples: Examples<40>. + +The Python 2.3 Method Resolution Order + +* The beginning:: +* The C3 Method Resolution Order:: +* Examples: Examples<41>. +* Bad Method Resolution Orders:: +* The end:: +* Resources:: + +Python experimental support for free threading + +* Installation:: +* Identifying free-threaded Python:: +* The global interpreter lock in free-threaded Python:: +* Thread safety:: +* Known limitations:: + +Known limitations + +* Immortalization:: +* Frame objects: Frame objects<2>. +* Iterators: Iterators<3>. +* Single-threaded performance:: + +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:: +* 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:: + +Building Extensions for the Free-Threaded Build + +* Limited C API and Stable ABI:: +* Windows: Windows<80>. + +Python Frequently Asked Questions + +* General Python FAQ:: +* Programming FAQ:: +* Design and History FAQ:: +* Library and Extension FAQ:: +* Extending/Embedding FAQ:: +* Python on Windows FAQ:: +* Graphic User Interface FAQ:: +* “Why is Python Installed on my Computer?” FAQ:: + +General Python FAQ + +* General Information:: +* Python in the real world:: + +General Information + +* What is Python?:: +* What is the Python Software Foundation?:: +* Are there copyright restrictions on the use of Python?:: +* Why was Python created in the first place?:: +* What is Python good for?:: +* How does the Python version numbering scheme work?:: +* How do I obtain a copy of the Python source?:: +* How do I get documentation on Python?:: +* I’ve never programmed before. Is there a Python tutorial?: I’ve never programmed before Is there a Python tutorial?. +* Is there a newsgroup or mailing list devoted to Python?:: +* How do I get a beta test version of Python?:: +* How do I submit bug reports and patches for Python?:: +* Are there any published articles about Python that I can reference?:: +* Are there any books on Python?:: +* Where in the world is www.python.org located?: Where in the world is www python org located?. +* Why is it called Python?:: +* Do I have to like “Monty Python’s Flying Circus”?:: + +Python in the real world + +* How stable is Python?:: +* How many people are using Python?:: +* Have any significant projects been done in Python?:: +* What new developments are expected for Python in the future?:: +* Is it reasonable to propose incompatible changes to Python?:: +* Is Python a good language for beginning programmers?:: + +Programming FAQ + +* General Questions:: +* Core Language:: +* Numbers and strings:: +* Performance: Performance<4>. +* Sequences (Tuples/Lists): Sequences Tuples/Lists. +* Objects:: +* Modules: Modules<5>. + +General Questions + +* Is there a source code level debugger with breakpoints, single-stepping, etc.?: Is there a source code level debugger with breakpoints single-stepping etc ?. +* Are there tools to help find bugs or perform static analysis?:: +* How can I create a stand-alone binary from a Python script?:: +* Are there coding standards or a style guide for Python programs?:: + +Core Language + +* Why am I getting an UnboundLocalError when the variable has a value?:: +* What are the rules for local and global variables in Python?:: +* Why do lambdas defined in a loop with different values all return the same result?:: +* How do I share global variables across modules?:: +* What are the “best practices” for using import in a module?:: +* Why are default values shared between objects?:: +* How can I pass optional or keyword parameters from one function to another?:: +* What is the difference between arguments and parameters?:: +* Why did changing list ‘y’ also change list ‘x’?:: +* How do I write a function with output parameters (call by reference)?: How do I write a function with output parameters call by reference ?. +* How do you make a higher order function in Python?:: +* How do I copy an object in Python?:: +* How can I find the methods or attributes of an object?:: +* How can my code discover the name of an object?:: +* What’s up with the comma operator’s precedence?:: +* Is there an equivalent of C’s “?;” ternary operator?: Is there an equivalent of C’s “? ” ternary operator?. +* Is it possible to write obfuscated one-liners in Python?:: +* What does the slash(/) in the parameter list of a function mean?: What does the slash / in the parameter list of a function mean?. + +Numbers and strings + +* How do I specify hexadecimal and octal integers?:: +* Why does -22 // 10 return -3?:: +* How do I get int literal attribute instead of SyntaxError?:: +* How do I convert a string to a number?:: +* How do I convert a number to a string?:: +* How do I modify a string in place?:: +* How do I use strings to call functions/methods?:: +* 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?:: +* Can I end a raw string with an odd number of backslashes?:: + +Performance + +* My program is too slow. How do I speed it up?: My program is too slow How do I speed it up?. +* What is the most efficient way to concatenate many strings together?:: + +Sequences (Tuples/Lists) + +* How do I convert between tuples and lists?:: +* What’s a negative index?:: +* How do I iterate over a sequence in reverse order?:: +* How do you remove duplicates from a list?:: +* How do you remove multiple items from a list:: +* How do you make an array in Python?:: +* How do I create a multidimensional list?:: +* How do I apply a method or function to a sequence of objects?:: +* Why does a_tuple[i] += [‘item’] raise an exception when the addition works?:: +* I want to do a complicated sort; can you do a Schwartzian Transform in Python?: I want to do a complicated sort can you do a Schwartzian Transform in Python?. +* How can I sort one list by values from another list?:: + +Objects + +* What is a class?:: +* What is a method?:: +* What is self?:: +* How do I check if an object is an instance of a given class or of a subclass of it?:: +* What is delegation?:: +* How do I call a method defined in a base class from a derived class that extends it?:: +* How can I organize my code to make it easier to change the base class?:: +* How do I create static class data and static class methods?:: +* How can I overload constructors (or methods) in Python?: How can I overload constructors or methods in Python?. +* I try to use __spam and I get an error about _SomeClassName__spam.: I try to use __spam and I get an error about _SomeClassName__spam. +* My class defines __del__ but it is not called when I delete the object.: My class defines __del__ but it is not called when I delete the object. +* How do I get a list of all instances of a given class?:: +* Why does the result of id() appear to be not unique?: Why does the result of id appear to be not unique?. +* When can I rely on identity tests with the is operator?:: +* How can a subclass control what data is stored in an immutable instance?:: +* How do I cache method calls?:: + +Modules + +* How do I create a .pyc file?: How do I create a pyc file?. +* How do I find the current module name?:: +* How can I have modules that mutually import each other?:: +* __import__(‘x.y.z’) returns ; how do I get z?: __import__ ‘x y z’ returns ; how do I get z?. +* When I edit an imported module and reimport it, the changes don’t show up. Why does this happen?: When I edit an imported module and reimport it the changes don’t show up Why does this happen?. + +Design and History FAQ + +* Why does Python use indentation for grouping of statements?:: +* Why am I getting strange results with simple arithmetic operations?:: +* Why are floating-point calculations so inaccurate?:: +* Why are Python strings immutable?:: +* Why must ‘self’ be used explicitly in method definitions and calls?:: +* Why can’t I use an assignment in an expression?:: +* Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?: Why does Python use methods for some functionality e g list index but functions for other e g len list ?. +* Why is join() a string method instead of a list or tuple method?: Why is join a string method instead of a list or tuple method?. +* How fast are exceptions?:: +* Why isn’t there a switch or case statement in Python?:: +* Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?:: +* Why can’t lambda expressions contain statements?:: +* Can Python be compiled to machine code, C or some other language?: Can Python be compiled to machine code C or some other language?. +* How does Python manage memory?:: +* Why doesn’t CPython use a more traditional garbage collection scheme?:: +* Why isn’t all memory freed when CPython exits?:: +* Why are there separate tuple and list data types?:: +* How are lists implemented in CPython?:: +* How are dictionaries implemented in CPython?:: +* Why must dictionary keys be immutable?:: +* Why doesn’t list.sort() return the sorted list?: Why doesn’t list sort return the sorted list?. +* How do you specify and enforce an interface spec in Python?:: +* Why is there no goto?:: +* Why can’t raw strings (r-strings) end with a backslash?: Why can’t raw strings r-strings end with a backslash?. +* Why doesn’t Python have a “with” statement for attribute assignments?:: +* Why don’t generators support the with statement?:: +* Why are colons required for the if/while/def/class statements?:: +* Why does Python allow commas at the end of lists and tuples?:: + +Library and Extension FAQ + +* General Library Questions:: +* Common tasks:: +* Threads:: +* Input and Output: Input and Output<2>. +* Network/Internet Programming:: +* Databases:: +* Mathematics and Numerics:: + +General Library Questions + +* How do I find a module or application to perform task X?:: +* Where is the math.py (socket.py, regex.py, etc.) source file?: Where is the math py socket py regex py etc source file?. +* How do I make a Python script executable on Unix?:: +* Is there a curses/termcap package for Python?:: +* Is there an equivalent to C’s onexit() in Python?: Is there an equivalent to C’s onexit in Python?. +* Why don’t my signal handlers work?:: + +Common tasks + +* How do I test a Python program or component?:: +* How do I create documentation from doc strings?:: +* How do I get a single keypress at a time?:: + +Threads + +* How do I program using threads?:: +* None of my threads seem to run; why?: None of my threads seem to run why?. +* How do I parcel out work among a bunch of worker threads?:: +* What kinds of global value mutation are thread-safe?:: +* Can’t we get rid of the Global Interpreter Lock?:: + +Input and Output + +* How do I delete a file? (And other file questions…): How do I delete a file? And other file questions…. +* How do I copy a file?:: +* How do I read (or write) binary data?: How do I read or write binary data?. +* I can’t seem to use os.read() on a pipe created with os.popen(); why?: I can’t seem to use os read on a pipe created with os popen ; why?. +* How do I access the serial (RS232) port?: How do I access the serial RS232 port?. +* Why doesn’t closing sys.stdout (stdin, stderr) really close it?: Why doesn’t closing sys stdout stdin stderr really close it?. + +Network/Internet Programming + +* What WWW tools are there for Python?:: +* What module should I use to help with generating HTML?:: +* How do I send mail from a Python script?:: +* How do I avoid blocking in the connect() method of a socket?: How do I avoid blocking in the connect method of a socket?. + +Databases + +* Are there any interfaces to database packages in Python?:: +* How do you implement persistent objects in Python?:: + +Mathematics and Numerics + +* How do I generate random numbers in Python?:: + +Extending/Embedding FAQ + +* Can I create my own functions in C?:: +* Can I create my own functions in C++?:: +* Writing C is hard; are there any alternatives?:: +* How can I execute arbitrary Python statements from C?:: +* How can I evaluate an arbitrary Python expression from C?:: +* How do I extract C values from a Python object?:: +* How do I use Py_BuildValue() to create a tuple of arbitrary length?: How do I use Py_BuildValue to create a tuple of arbitrary length?. +* How do I call an object’s method from C?:: +* How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?. +* How do I access a module written in Python from C?:: +* How do I interface to C++ objects from Python?:: +* I added a module using the Setup file and the make fails; why?:: +* How do I debug an extension?:: +* I want to compile a Python module on my Linux system, but some files are missing. Why?: I want to compile a Python module on my Linux system but some files are missing Why?. +* How do I tell “incomplete input” from “invalid input”?:: +* How do I find undefined g++ symbols __builtin_new or __pure_virtual?:: +* Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?: Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?. + +Python on Windows FAQ + +* How do I run a Python program under Windows?:: +* How do I make Python scripts executable?:: +* Why does Python sometimes take so long to start?:: +* How do I make an executable from a Python script?:: +* Is a *.pyd file the same as a DLL?: Is a * pyd file the same as a DLL?. +* How can I embed Python into a Windows application?:: +* How do I keep editors from inserting tabs into my Python source?:: +* How do I check for a keypress without blocking?:: +* How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?. + +Graphic User Interface FAQ + +* General GUI Questions:: +* What GUI toolkits exist for Python?:: +* Tkinter questions:: + +Tkinter questions + +* How do I freeze Tkinter applications?:: +* Can I have Tk events handled while waiting for I/O?:: +* I can’t get key bindings to work in Tkinter; why?: I can’t get key bindings to work in Tkinter why?. + +“Why is Python Installed on my Computer?” FAQ + +* What is Python?: What is Python?<2>. +* Why is Python installed on my machine?:: +* Can I delete Python?:: + +Deprecations + +* Pending Removal in Python 3.14: Pending Removal in Python 3 14<5>. +* Pending Removal in Python 3.15: Pending Removal in Python 3 15<5>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<5>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<5>. +* C API Deprecations:: + +C API Deprecations + +* Pending Removal in Python 3.14: Pending Removal in Python 3 14<6>. +* Pending Removal in Python 3.15: Pending Removal in Python 3 15<6>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<6>. + +About this documentation + +* Contributors to the Python documentation:: + +Dealing with Bugs + +* Documentation bugs:: +* Using the Python issue tracker:: +* Getting started contributing to Python yourself:: + +History and License + +* History of the software:: +* 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:: +* Sockets: Sockets<2>. +* Asynchronous socket services:: +* Cookie management:: +* Execution tracing:: +* UUencode and UUdecode functions:: +* XML Remote Procedure Calls:: +* test_epoll:: +* Select kqueue:: +* SipHash24:: +* strtod and dtoa:: +* OpenSSL: OpenSSL<2>. +* expat:: +* libffi:: +* zlib: zlib<3>. +* cfuhash:: +* libmpdec:: +* W3C C14N test suite:: +* mimalloc:: +* asyncio: asyncio<12>. +* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS. + + + +File: python.info, Node: What’s New in Python, Next: The Python Tutorial, Prev: Top, Up: Top + +1 What’s New in Python +********************** + +The “What’s New in Python” series of essays takes tours through the most +important changes between major Python versions. They are a “must read” +for anyone wishing to stay up-to-date after a new release. + +* Menu: + +* 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. +* Changelog:: + + +File: python.info, Node: What’s New In Python 3 13, Next: What’s New In Python 3 12, Up: What’s New in Python + +1.1 What’s New In Python 3.13 +============================= + + +Editors: Adam Turner and Thomas Wouters + +This article explains the new features in Python 3.13, compared to 3.12. +Python 3.13 was released on October 7, 2024. For full details, see the +*note changelog: 13c. + +See also +........ + +PEP 719(1) – Python 3.13 Release Schedule + +* Menu: + +* Summary – Release Highlights:: +* New Features:: +* Other Language Changes:: +* New Modules:: +* Improved Modules:: +* Optimizations:: +* Removed Modules And APIs:: +* New Deprecations:: +* CPython Bytecode Changes:: +* C API Changes:: +* Build Changes:: +* Porting to Python 3.13: Porting to Python 3 13. +* Regression Test Changes:: +* Notable changes in 3.13.1: Notable changes in 3 13 1. +* Notable changes in 3.13.4: Notable changes in 3 13 4. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0719/ + + +File: python.info, Node: Summary – Release Highlights, Next: New Features, Up: What’s New In Python 3 13 + +1.1.1 Summary – Release Highlights +---------------------------------- + +Python 3.13 is the latest stable release of the Python programming +language, with a mix of changes to the language, the implementation and +the standard library. The biggest changes include a new *note +interactive interpreter: 13e., experimental support for running in a +*note free-threaded mode: 13f.( PEP 703(1)), and a *note Just-In-Time +compiler: 140.( PEP 744(2)). + +Error messages continue to improve, with tracebacks now highlighted in +color by default. The *note locals(): 141. builtin now has *note +defined semantics: 142. for changing the returned mapping, and type +parameters now support default values. + +The library changes contain removal of deprecated APIs and modules, as +well as the usual improvements in user-friendliness and correctness. +Several legacy standard library modules have now *note been removed: +143.following their deprecation in Python 3.11 ( PEP 594(3)). + +This article doesn’t attempt to provide a complete specification of all +new features, but instead gives a convenient overview. For full details +refer to the documentation, such as the *note Library Reference: 144. +and *note Language Reference: 145. To understand the complete +implementation and design rationale for a change, refer to the PEP for a +particular new feature; but note that PEPs usually are not kept +up-to-date once a feature has been fully implemented. See *note Porting +to Python 3.13: 146. for guidance on upgrading from earlier versions of +Python. + +__________________________________________________________________ + +Interpreter improvements: + + * A greatly improved *note interactive interpreter: 13e. and *note + improved error messages: 147. + + * PEP 667(4): The *note locals(): 141. builtin now has *note defined + semantics: 142. when mutating the returned mapping. Python + debuggers and similar tools may now more reliably update local + variables in optimized scopes even during concurrent code + execution. + + * PEP 703(5): CPython 3.13 has experimental support for running with + the *note global interpreter lock: 148. disabled. See *note + Free-threaded CPython: 13f. for more details. + + * PEP 744(6): A basic *note JIT compiler: 140. was added. It is + currently disabled by default (though we may turn it on later). + Performance improvements are modest – we expect to improve this + over the next few releases. + + * Color support in the new *note interactive interpreter: 13e, as + well as in *note tracebacks: 147. and *note doctest: 149. output. + This can be disabled through the *note PYTHON_COLORS: 14a. and + NO_COLOR(7) environment variables. + +Python data model improvements: + + * *note __static_attributes__: 14b. stores the names of attributes + accessed through ‘self.X’ in any function in a class body. + + * *note __firstlineno__: 14c. records the first line number of a + class definition. + +Significant improvements in the standard library: + + * Add a new *note PythonFinalizationError: 14d. exception, raised + when an operation is blocked during *note finalization: 14e. + + * The *note argparse: 6. module now supports deprecating command-line + options, positional arguments, and subcommands. + + * The new functions *note base64.z85encode(): 14f. and *note + base64.z85decode(): 150. support encoding and decoding Z85 data(8). + + * The *note copy: 25. module now has a *note copy.replace(): 151. + function, with support for many builtin types and any class + defining the *note __replace__(): 152. method. + + * The new *note dbm.sqlite3: 35. module is now the default *note dbm: + 31. backend. + + * The *note os: a1. module has a *note suite of new functions: 153. + for working with Linux’s timer notification file descriptors. + + * The *note random: b8. module now has a *note command-line + interface: 154. + +Security improvements: + + * *note ssl.create_default_context(): 155. sets *note + ssl.VERIFY_X509_PARTIAL_CHAIN: 156. and *note + ssl.VERIFY_X509_STRICT: 157. as default flags. + +C API improvements: + + * The *note Py_mod_gil: 158. slot is now used to indicate that an + extension module supports running with the *note GIL: 159. + disabled. + + * The *note PyTime C API: 15a. has been added, providing access to + system clocks. + + * *note PyMutex: 15b. is a new lightweight mutex that occupies a + single byte. + + * There is a new *note suite of functions: 15c. for generating PEP + 669(9) monitoring events in the C API. + +New typing features: + + * PEP 696(10): Type parameters (*note typing.TypeVar: 15d, *note + typing.ParamSpec: 15e, and *note typing.TypeVarTuple: 15f.) now + support defaults. + + * PEP 702(11): The new *note warnings.deprecated(): 160. decorator + adds support for marking deprecations in the type system and at + runtime. + + * PEP 705(12): *note typing.ReadOnly: 161. can be used to mark an + item of a *note typing.TypedDict: 162. as read-only for type + checkers. + + * PEP 742(13): *note typing.TypeIs: 163. provides more intuitive type + narrowing behavior, as an alternative to *note typing.TypeGuard: + 164. + +Platform support: + + * PEP 730(14): Apple’s iOS is now an *note officially supported + platform: 165, at tier 3(15). + + * PEP 738(16): Android is now an *note officially supported platform: + 165, at tier 3(17). + + * ‘wasm32-wasi’ is now supported as a tier 2(18) platform. + + * ‘wasm32-emscripten’ is no longer an officially supported platform. + +Important removals: + + * *note PEP 594: 143.: The remaining 19 “dead batteries” (legacy + stdlib modules) have been removed from the standard library: + ‘aifc’, ‘audioop’, ‘cgi’, ‘cgitb’, ‘chunk’, ‘crypt’, ‘imghdr’, + ‘mailcap’, ‘msilib’, ‘nis’, ‘nntplib’, ‘ossaudiodev’, ‘pipes’, + ‘sndhdr’, ‘spwd’, ‘sunau’, ‘telnetlib’, ‘uu’ and ‘xdrlib’. + + * Remove the ‘2to3’ tool and ‘lib2to3’ module (deprecated in Python + 3.11). + + * Remove the ‘tkinter.tix’ module (deprecated in Python 3.6). + + * Remove the ‘locale.resetlocale()’ function. + + * Remove the ‘typing.io’ and ‘typing.re’ namespaces. + + * Remove chained *note classmethod: 166. descriptors. + +Release schedule changes: + +PEP 602(19) (“Annual Release Cycle for Python”) has been updated to +extend the full support (‘bugfix’) period for new releases to two years. +This updated policy means that: + + * Python 3.9–3.12 have one and a half years of full support, followed + by three and a half years of security fixes. + + * Python 3.13 and later have two years of full support, followed by + three years of security fixes. + + ---------- 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: New Features, Next: Other Language Changes, Prev: Summary – Release Highlights, Up: What’s New In Python 3 13 + +1.1.2 New Features +------------------ + +* Menu: + +* A better interactive interpreter:: +* Improved error messages:: +* Free-threaded CPython:: +* An experimental just-in-time (JIT) compiler: An experimental just-in-time JIT compiler. +* Defined mutation semantics for locals(): Defined mutation semantics for locals. +* Support for mobile platforms:: + + +File: python.info, Node: A better interactive interpreter, Next: Improved error messages, Up: New Features + +1.1.2.1 A better interactive interpreter +........................................ + +Python now uses a new *note interactive: 169. shell by default, based on +code from the PyPy project(1). When the user starts the *note REPL: +16a. from an interactive terminal, the following new features are now +supported: + + * Multiline editing with history preservation. + + * Direct support for REPL-specific commands like ‘help’, ‘exit’, and + ‘quit’, without the need to call them as functions. + + * Prompts and tracebacks with *note color enabled by default: 16b. + + * Interactive help browsing using ‘F1’ with a separate command + history. + + * History browsing using ‘F2’ that skips output as well as the *note + >>>: 16c. and *note …: 16d. prompts. + + * “Paste mode” with ‘F3’ that makes pasting larger blocks of code + easier (press ‘F3’ again to return to the regular prompt). + +To disable the new interactive shell, set the *note PYTHON_BASIC_REPL: +16e. environment variable. For more on interactive mode, see *note +Interactive Mode: 16f. + +(Contributed by Pablo Galindo Salgado, Łukasz Langa, and Lysandros +Nikolaou in gh-111201(2) based on code from the PyPy project. Windows +support contributed by Dino Viehland and Anthony Shaw.) + + ---------- Footnotes ---------- + + (1) https://pypy.org/ + + (2) https://github.com/python/cpython/issues/111201 + + +File: python.info, Node: Improved error messages, Next: Free-threaded CPython, Prev: A better interactive interpreter, Up: New Features + +1.1.2.2 Improved error messages +............................... + + * The interpreter now uses color by default when displaying + tracebacks in the terminal. This feature *note can be controlled: + 16b. via the new *note PYTHON_COLORS: 14a. environment variable as + well as the canonical NO_COLOR(1) and FORCE_COLOR(2) environment + variables. (Contributed by Pablo Galindo Salgado in gh-112730(3).) + + * A common mistake is to write a script with the same name as a + standard library module. When this results in errors, we now + display a more helpful error message: + + $ python random.py + Traceback (most recent call last): + File "/home/me/random.py", line 1, in + import random + File "/home/me/random.py", line 3, in + 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) + + Similarly, if a script has the same name as a third-party module + that it attempts to import and this results in errors, we also + display a more helpful error message: + + $ python numpy.py + Traceback (most recent call last): + File "/home/me/numpy.py", line 1, in + import numpy as np + File "/home/me/numpy.py", line 3, in + 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) + + (Contributed by Shantanu Jain in gh-95754(4).) + + * The error message now tries to suggest the correct keyword argument + when an incorrect keyword argument is passed to a function. + + >>> "Better error messages!".split(max_split=1) + Traceback (most recent call last): + File "", line 1, in + "Better error messages!".split(max_split=1) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^ + TypeError: split() got an unexpected keyword argument 'max_split'. Did you mean 'maxsplit'? + + (Contributed by Pablo Galindo Salgado and Shantanu Jain in + 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: Free-threaded CPython, Next: An experimental just-in-time JIT compiler, Prev: Improved error messages, Up: New Features + +1.1.2.3 Free-threaded CPython +............................. + +CPython now has experimental support for running in a free-threaded +mode, with the *note global interpreter lock: 148. (GIL) disabled. This +is an experimental feature and therefore is not enabled by default. The +free-threaded mode requires a different executable, usually called +‘python3.13t’ or ‘python3.13t.exe’. Pre-built binaries marked as +'free-threaded' can be installed as part of the official *note Windows: +172. and *note macOS: 173. installers, or CPython can be built from +source with the *note -disable-gil: 174. option. + +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. +'The free-threaded mode is experimental' and work is ongoing to improve +it: expect some bugs and a substantial single-threaded performance hit. +Free-threaded builds of CPython support optionally running with the GIL +enabled at runtime using the environment variable *note PYTHON_GIL: 175. +or the command-line option *note -X gil=1: 176. + +To check if the current interpreter supports free-threading, *note +python -VV: 177. and *note sys.version: 178. contain “experimental +free-threading build”. The new ‘sys._is_gil_enabled()’ function can be +used to check whether the GIL is actually disabled in the running +process. + +C-API extension modules need to be built specifically for the +free-threaded build. Extensions that support running with the *note +GIL: 159. disabled should use the *note Py_mod_gil: 158. slot. +Extensions using single-phase init should use *note +PyUnstable_Module_SetGIL(): 179. to indicate whether they support +running with the GIL disabled. Importing C extensions that don’t use +these mechanisms will cause the GIL to be enabled, unless the GIL was +explicitly disabled with the *note PYTHON_GIL: 175. environment variable +or the *note -X gil=0: 176. option. pip 24.1 or newer is required to +install packages with C extensions in the free-threaded build. + +This work was made possible thanks to many individuals and +organizations, including the large community of contributors to Python +and third-party projects to test and enable free-threading support. +Notable contributors include: Sam Gross, Ken Jin, Donghee Na, Itamar +Oren, Matt Page, Brett Simmers, Dino Viehland, Carl Meyer, Nathan +Goldbaum, Ralf Gommers, Lysandros Nikolaou, and many others. Many of +these contributors are employed by Meta, which has provided significant +engineering resources to support this project. + +See also +........ + +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: An experimental just-in-time JIT compiler, Next: Defined mutation semantics for locals, Prev: Free-threaded CPython, Up: New Features + +1.1.2.4 An experimental just-in-time (JIT) compiler +................................................... + +When CPython is configured and built using the +‘--enable-experimental-jit’ option, a just-in-time (JIT) compiler is +added which may speed up some Python programs. On Windows, use +‘PCbuild/build.bat --experimental-jit’ to enable the JIT or +‘--experimental-jit-interpreter’ to enable the Tier 2 interpreter. +Build requirements and further supporting information are contained +at(1) ‘Tools/jit/README.md’. + +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 *note PYTHON_JIT=0: 17b. + + * ‘yes-off’: Build the JIT but disable it by default. To enable the + JIT at runtime, pass the environment variable *note PYTHON_JIT=1: + 17b. + + * ‘interpreter’: Enable the Tier 2 interpreter but disable the JIT. + The interpreter can be disabled by running with *note PYTHON_JIT=0: + 17b. + +The internal architecture is roughly as follows: + + * We start with specialized 'Tier 1 bytecode'. See *note What’s new + in 3.11: 17c. 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. + +See also +........ + +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: An experimental just-in-time JIT compiler, Up: New Features + +1.1.2.5 Defined mutation semantics for ‘locals()’ +................................................. + +Historically, the expected result of mutating the return value of *note +locals(): 141. 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: 17e. (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(): 141. 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(): 17f. and *note eval(): 180.). 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(): 181. 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: +182. 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: 183. and *note C APIs: 184. + +(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: New Features + +1.1.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).) + +See also +........ + +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: Other Language Changes, Next: New Modules, Prev: New Features, Up: What’s New In Python 3 13 + +1.1.3 Other Language Changes +---------------------------- + + * The compiler now strips common leading whitespace from every line + in a docstring. This reduces the size of the *note bytecode cache: + 187. (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: 3a. + + >>> 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: 188. 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: 189. 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: 18a. declarations are now permitted in *note except: + 18b. blocks when that global is used in the *note else: 18c. block. + Previously this raised an erroneous *note SyntaxError: 18d. + (Contributed by Irit Katriel in gh-111123(5).) + + * Add *note PYTHON_FROZEN_MODULES: 18e, a new environment variable + that determines whether frozen modules are ignored by the import + machinery, equivalent to the *note -X frozen_modules: 176. + command-line option. (Contributed by Yilei Yang in gh-111374(6).) + + * Add *note support for the perf profiler: 18f. working without frame + pointers(7) through the new environment variable *note + PYTHON_PERF_JIT_SUPPORT: 190. and command-line option *note -X + perf_jit: 176. (Contributed by Pablo Galindo in gh-118518(8).) + + * The location of a ‘.python_history’ file can be changed via the new + *note PYTHON_HISTORY: 191. environment variable. (Contributed by + Levi Sabah, Zackery Spytz and Hugo van Kemenade in gh-73965(9).) + + * Classes have a new *note __static_attributes__: 14b. attribute. + This is populated by the compiler with a tuple of the class’s + attribute names which are assigned through ‘self.’ 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(): 17f. and *note eval(): 180. builtins now accept + the 'globals' and 'locals' arguments as keywords. (Contributed by + Raphael Gaschignard in gh-105879(12)) + + * The *note compile(): 192. 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__: 193. attribute on *note property: 194. + objects. (Contributed by Eugene Toder in gh-101860(14).) + + * Add *note PythonFinalizationError: 14d, a new exception derived + from *note RuntimeError: 195. and used to signal when operations + are blocked during *note finalization: 14e. The following + callables now raise ‘PythonFinalizationError’, instead of *note + RuntimeError: 195.: + + * *note _thread.start_new_thread(): 196. + + * *note os.fork(): 197. + + * *note os.forkpty(): 198. + + * *note subprocess.Popen: 199. + + (Contributed by Victor Stinner in gh-114570(15).) + + * Allow the 'count' argument of *note str.replace(): 19a. 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: 13, *note lzma: 8a, *note + tarfile: de, and *note zipfile: 131. 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: New Modules, Next: Improved Modules, Prev: Other Language Changes, Up: What’s New In Python 3 13 + +1.1.4 New Modules +----------------- + + * *note dbm.sqlite3: 35.: An SQLite backend for *note dbm: 31. + (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: Improved Modules, Next: Optimizations, Prev: New Modules, Up: What’s New In Python 3 13 + +1.1.5 Improved Modules +---------------------- + +* Menu: + +* argparse:: +* array:: +* ast:: +* asyncio:: +* base64:: +* compileall:: +* concurrent.futures: concurrent futures. +* configparser:: +* copy:: +* ctypes:: +* dbm:: +* dis:: +* doctest:: +* email:: +* enum:: +* fractions:: +* glob:: +* importlib:: +* io:: +* ipaddress:: +* itertools:: +* marshal:: +* math:: +* mimetypes:: +* mmap:: +* multiprocessing:: +* os:: +* os.path: os path. +* pathlib:: +* pdb:: +* queue:: +* random:: +* re:: +* shutil:: +* site:: +* sqlite3:: +* ssl:: +* statistics:: +* subprocess:: +* sys:: +* tempfile:: +* time:: +* tkinter:: +* traceback:: +* types:: +* typing:: +* unicodedata:: +* venv:: +* warnings:: +* xml:: +* zipimport:: + + +File: python.info, Node: argparse, Next: array, Up: Improved Modules + +1.1.5.1 argparse +................ + + * Add the 'deprecated' parameter to the *note add_argument(): 19e. + 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: array, Next: ast, Prev: argparse, Up: Improved Modules + +1.1.5.2 array +............. + + * 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: 1a0. as a *note MutableSequence: 1a1. + by implementing the *note clear(): 1a2. 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, Next: asyncio, Prev: array, Up: Improved Modules + +1.1.5.3 ast +........... + + * The constructors of node types in the *note ast: 8. 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(): 1a4. (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: 1a5. 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: 1a6. unless the class opts in to the new behavior by + defining the *note AST._field_types: 1a7. mapping. + + (Contributed by Jelle Zijlstra in gh-105858(1), gh-117486(2), and + gh-118851(3).) + + * *note ast.parse(): 1a8. now accepts an optional argument 'optimize' + which is passed on to *note compile(): 192. 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, Next: base64, Prev: ast, Up: Improved Modules + +1.1.5.4 asyncio +............... + + * *note asyncio.as_completed(): 1aa. now returns an object that is + both an *note asynchronous iterator: 1ab. and a plain *note + iterator: 1ac. of *note awaitables: 1ad. 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(): 1ae. will now + automatically remove the Unix socket when the server is closed. + (Contributed by Pierre Ossman in gh-111246(2).) + + * *note DatagramTransport.sendto(): 1af. 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: 1b0. and *note QueueShutDown: 1b1. to + manage queue termination. (Contributed by Laurie Opperman and Yves + Duprat in gh-104228(4).) + + * Add the *note Server.close_clients(): 1b2. and *note + Server.abort_clients(): 1b3. 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(): + 1b4, stopping when any one of them is encountered. (Contributed by + Bruce Merry in gh-81322(6).) + + * Improve the behavior of *note TaskGroup: 1b5. 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: 1b6, it will now call the + parent task’s *note cancel(): 1b7. method. This ensures that a + *note CancelledError: 1b8. will be raised at the next *note await: + 1b9, so the cancellation is not lost. + + An added benefit of these changes is that task groups now preserve + the cancellation count (*note cancelling(): 1ba.). + + In order to handle some corner cases, *note uncancel(): 1bb. 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(): 1bc. is called on an inactive + *note TaskGroup: 1b5, the given coroutine will be closed (which + prevents a *note RuntimeWarning: 1bd. 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: 1be. and to custom task factories. + + This affects the following function and methods: *note + asyncio.create_task(): 1bf, *note asyncio.loop.create_task(): 1c0, + *note asyncio.TaskGroup.create_task(): 1bc. (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, Next: compileall, Prev: asyncio, Up: Improved Modules + +1.1.5.5 base64 +.............. + + * Add *note z85encode(): 14f. and *note z85decode(): 150. functions + for encoding *note bytes: 1c2. 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, Prev: base64, Up: Improved Modules + +1.1.5.6 compileall +.................. + + * The default number of worker threads and processes is now selected + using *note os.process_cpu_count(): 1c4. instead of *note + os.cpu_count(): 1c5. (Contributed by Victor Stinner in + gh-109649(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/109649 + + +File: python.info, Node: concurrent futures, Next: configparser, Prev: compileall, Up: Improved Modules + +1.1.5.7 concurrent.futures +.......................... + + * The default number of worker threads and processes is now selected + using *note os.process_cpu_count(): 1c4. instead of *note + os.cpu_count(): 1c5. (Contributed by Victor Stinner in + gh-109649(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/109649 + + +File: python.info, Node: configparser, Next: copy, Prev: concurrent futures, Up: Improved Modules + +1.1.5.8 configparser +.................... + + * *note ConfigParser: 1c8. 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, Prev: configparser, Up: Improved Modules + +1.1.5.9 copy +............ + + * The new *note replace(): 151. function and the *note replace + protocol: 152. make creating modified copies of objects much + simpler. This is especially useful when working with immutable + objects. The following types support the *note replace(): 151. + function and implement the replace protocol: + + * *note collections.namedtuple(): 1ca. + + * *note dataclasses.dataclass: 1cb. + + * *note datetime.datetime: 1cc, *note datetime.date: 1cd, *note + datetime.time: 1ce. + + * *note inspect.Signature: 1cf, *note inspect.Parameter: 1d0. + + * *note types.SimpleNamespace: 1d1. + + * *note code objects: 1d2. + + Any user-defined class can also support *note copy.replace(): 151. + by defining the *note __replace__(): 152. method. (Contributed by + Serhiy Storchaka in gh-108751(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/108751 + + +File: python.info, Node: ctypes, Next: dbm, Prev: copy, Up: Improved Modules + +1.1.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: 1d4. objects have a new *note _align_: 1d5. + attribute which allows the alignment of the structure being packed + to/from memory to be specified explicitly. (Contributed by Matt + Sanderson in gh-112433(2)) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/124520 + + (2) https://github.com/python/cpython/issues/112433 + + +File: python.info, Node: dbm, Next: dis, Prev: ctypes, Up: Improved Modules + +1.1.5.11 dbm +............ + + * Add *note dbm.sqlite3: 35, 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 *note + gdbm.clear(): 1d7. and *note ndbm.clear(): 1d8. methods. + (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, Next: doctest, Prev: dbm, Up: Improved Modules + +1.1.5.12 dis +............ + + * Change the output of *note dis: 38. 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: 1da. + command-line option or the 'show_offsets' argument. (Contributed + by Irit Katriel in gh-112137(1).) + + * *note get_instructions(): 1db. no longer represents cache entries + as separate instructions. Instead, it returns them as part of the + *note Instruction: 1dc, in the new 'cache_info' field. The + 'show_caches' argument to *note get_instructions(): 1db. 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, Prev: dis, Up: Improved Modules + +1.1.5.13 doctest +................ + + * *note doctest: 3a. output is now colored by default. This can be + controlled via the new *note PYTHON_COLORS: 14a. environment + variable as well as the canonical NO_COLOR(1) and FORCE_COLOR(2) + environment variables. See also *note Controlling color: 16b. + (Contributed by Hugo van Kemenade in gh-117225(3).) + + * The *note DocTestRunner.run(): 1de. method now counts the number of + skipped tests. Add the *note DocTestRunner.skips: 1df. and *note + TestResults.skipped: 1e0. 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, Next: enum, Prev: doctest, Up: Improved Modules + +1.1.5.14 email +.............. + + * Headers with embedded newlines are now quoted on output. The *note + generator: 40. 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: + 1e2. (Contributed by Bas Bloemsaat and Petr Viktorin in + gh-121650(1).) + + * *note getaddresses(): 1e3. and *note parseaddr(): 1e4. 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, Prev: email, Up: Improved Modules + +1.1.5.15 enum +............. + + * *note EnumDict: 1e6. has been made public to better support + subclassing *note EnumType: 1e7. + + +File: python.info, Node: fractions, Next: glob, Prev: enum, Up: Improved Modules + +1.1.5.16 fractions +.................. + + * *note Fraction: 1e9. objects now support the standard *note format + specification mini-language: 1ea. rules for fill, alignment, sign + handling, minimum width, and grouping. (Contributed by Mark + Dickinson in gh-111320(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/111320 + + +File: python.info, Node: glob, Next: importlib, Prev: fractions, Up: Improved Modules + +1.1.5.17 glob +............. + + * Add *note translate(): 1ec, 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, Prev: glob, Up: Improved Modules + +1.1.5.18 importlib +.................. + + * The following functions in *note importlib.resources: 7b. 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(): 1ee. + + * *note open_binary(): 1ef. + + * *note open_text(): 1f0. + + * *note path(): 1f1. + + * *note read_binary(): 1f2. + + * *note read_text(): 1f3. + + These functions are no longer deprecated and are not scheduled for + removal. (Contributed by Petr Viktorin in gh-116608(1).) + + * *note contents(): 1f4. remains deprecated in favor of the + fully-featured *note Traversable: 1f5. 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, Next: ipaddress, Prev: importlib, Up: Improved Modules + +1.1.5.19 io +........... + + * The *note IOBase: 1f7. finalizer now logs any errors raised by the + *note close(): 1f8. method with *note sys.unraisablehook: 1f9. + Previously, errors were ignored silently by default, and only + logged in *note Python Development Mode: 1fa. or when using a *note + Python debug build: 1fb. (Contributed by Victor Stinner in + gh-62948(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/62948 + + +File: python.info, Node: ipaddress, Next: itertools, Prev: io, Up: Improved Modules + +1.1.5.20 ipaddress +.................. + + * Add the *note IPv4Address.ipv6_mapped: 1fd. 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: + 1fe, *note IPv6Address: 1ff, *note IPv4Network: 200, and *note + IPv6Network: 201. (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, Next: marshal, Prev: ipaddress, Up: Improved Modules + +1.1.5.21 itertools +.................. + + * *note batched(): 203. has a new 'strict' parameter, which raises a + *note ValueError: 204. 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, Prev: itertools, Up: Improved Modules + +1.1.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, Next: mimetypes, Prev: marshal, Up: Improved Modules + +1.1.5.23 math +............. + + * The new function *note fma(): 207. 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, Next: mmap, Prev: math, Up: Improved Modules + +1.1.5.24 mimetypes +.................. + + * Add the *note guess_file_type(): 209. function to guess a MIME type + from a filesystem path. Using paths with *note guess_type(): 20a. + is now *note soft deprecated: 20b. (Contributed by Serhiy + Storchaka in gh-66543(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/66543 + + +File: python.info, Node: mmap, Next: multiprocessing, Prev: mimetypes, Up: Improved Modules + +1.1.5.25 mmap +............. + + * *note mmap: 20d. 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: 20d. has a new *note seekable(): 20e. method that can + be used when a seekable file-like object is required. The *note + seek(): 20f. 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: 20d. 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, Next: os, Prev: mmap, Up: Improved Modules + +1.1.5.26 multiprocessing +........................ + + * The default number of worker threads and processes is now selected + using *note os.process_cpu_count(): 1c4. instead of *note + os.cpu_count(): 1c5. (Contributed by Victor Stinner in + gh-109649(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/109649 + + +File: python.info, Node: os, Next: os path, Prev: multiprocessing, Up: Improved Modules + +1.1.5.27 os +........... + + * Add *note process_cpu_count(): 1c4. 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(): 1c5. and *note process_cpu_count(): 1c4. can be + overridden through the new environment variable *note + PYTHON_CPU_COUNT: 212. or the new command-line option *note -X + cpu_count: 176. 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: 153. to Linux’s ‘timer file + descriptors(3)’ via *note timerfd_create(): 213, *note + timerfd_settime(): 214, *note timerfd_settime_ns(): 215, *note + timerfd_gettime(): 216, *note timerfd_gettime_ns(): 217, *note + TFD_NONBLOCK: 218, *note TFD_CLOEXEC: 219, *note TFD_TIMER_ABSTIME: + 21a, and *note TFD_TIMER_CANCEL_ON_SET: 21b. (Contributed by Masaru + Tsuchiyama in gh-108277(4).) + + * *note lchmod(): 21c. and the 'follow_symlinks' argument of *note + chmod(): 21d. 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(): 21e. and support for file descriptors in *note + chmod(): 21d. are both now available on Windows. (Contributed by + Serhiy Storchaka in gh-113191(6).) + + * On Windows, *note mkdir(): 21f. and *note makedirs(): 220. now + support passing a 'mode' value of ‘0o700’ to apply access control + to the new directory. This implicitly affects *note + tempfile.mkdtemp(): 221. 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(): 222. 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(): 222. can now use the *note + POSIX_SPAWN_CLOSEFROM: 223. 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, Next: pathlib, Prev: os, Up: Improved Modules + +1.1.5.28 os.path +................ + + * Add *note isreserved(): 225. 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(): 226. 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(): 227. 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, Next: pdb, Prev: os path, Up: Improved Modules + +1.1.5.29 pathlib +................ + + * Add *note UnsupportedOperation: 229, which is raised instead of + *note NotImplementedError: 22a. when a path operation isn’t + supported. (Contributed by Barney Gale in gh-89812(1).) + + * Add a new constructor for creating *note Path: 22b. objects from + ‘file’ URIs (‘file:///’), *note Path.from_uri(): 22c. (Contributed + by Barney Gale in gh-107465(2).) + + * Add *note PurePath.full_match(): 22d. for matching paths with + shell-style wildcards, including the recursive wildcard “‘**’”. + (Contributed by Barney Gale in gh-73435(3).) + + * Add the *note PurePath.parser: 22e. class attribute to store the + implementation of *note os.path: a2. 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(): + 22f. and *note rglob(): 230. (Contributed by Barney Gale in + gh-77609(4).) + + * *note Path.glob(): 22f. and *note rglob(): 230. 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: 231, *note Path.is_dir: 232, *note Path.owner(): 233, + and *note Path.group(): 234. (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, Next: queue, Prev: pathlib, Up: Improved Modules + +1.1.5.30 pdb +............ + + * *note breakpoint(): 236. and *note set_trace(): 237. 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: 238. is set. + (Contributed by Tian Gao and Christian Walther in gh-111762(2).) + + * *note zipapp: 130. 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(): 239. using the new *note exceptions + [exc_number]: 23a. 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, Up: Improved Modules + +1.1.5.31 queue +.............. + + * Add *note Queue.shutdown: 23c. and *note ShutDown: 23d. 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, Prev: queue, Up: Improved Modules + +1.1.5.32 random +............... + + * Add a *note command-line interface: 154. (Contributed by Hugo van + Kemenade in gh-118131(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/118131 + + +File: python.info, Node: re, Next: shutil, Prev: random, Up: Improved Modules + +1.1.5.33 re +........... + + * Rename ‘re.error’ to *note PatternError: 240. for improved clarity. + ‘re.error’ is kept for backward compatibility. + + +File: python.info, Node: shutil, Next: site, Prev: re, Up: Improved Modules + +1.1.5.34 shutil +............... + + * Support the 'dir_fd' and 'follow_symlinks' keyword arguments in + *note chown(): 242. (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, Prev: shutil, Up: Improved Modules + +1.1.5.35 site +............. + + * ‘.pth’ files are now decoded using UTF-8 first, and then with the + *note locale encoding: 244. 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, Next: ssl, Prev: site, Up: Improved Modules + +1.1.5.36 sqlite3 +................ + + * A *note ResourceWarning: 246. is now emitted if a *note Connection: + 247. object is not *note closed: 248. explicitly. (Contributed by + Erlend E. Aasland in gh-105539(1).) + + * Add the 'filter' keyword-only parameter to *note + Connection.iterdump(): 249. 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, Next: statistics, Prev: sqlite3, Up: Improved Modules + +1.1.5.37 ssl +............ + + * The *note create_default_context(): 155. API now includes *note + VERIFY_X509_PARTIAL_CHAIN: 156. and *note VERIFY_X509_STRICT: 157. + in its default flags. + + Note: *note VERIFY_X509_STRICT: 157. may reject pre- RFC + 5280(1) or malformed certificates that the underlying OpenSSL + implementation might otherwise accept. Whilst disabling this + is not recommended, you can do so using: + + import ssl + + ctx = ssl.create_default_context() + ctx.verify_flags &= ~ssl.VERIFY_X509_STRICT + + (Contributed by William Woodruff in gh-112389(2).) + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc5280.html + + (2) https://github.com/python/cpython/issues/112389 + + +File: python.info, Node: statistics, Next: subprocess, Prev: ssl, Up: Improved Modules + +1.1.5.38 statistics +................... + + * Add *note kde(): 24c. 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(): 24d. for sampling from an estimated + probability density function created by *note kde(): 24c. + (Contributed by Raymond Hettinger in gh-115863(2).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/115863 + + (2) https://github.com/python/cpython/issues/115863 + + +File: python.info, Node: subprocess, Next: sys, Prev: statistics, Up: Improved Modules + +1.1.5.39 subprocess +................... + + * The *note subprocess: d6. module now uses the *note posix_spawn(): + 222. function in more situations. + + Notably, when 'close_fds' is ‘True’ (the default), *note + posix_spawn(): 222. 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: d6. to never use + *note posix_spawn(): 222. Please report your reason and platform + details in the *note issue tracker: 250. 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, Next: tempfile, Prev: subprocess, Up: Improved Modules + +1.1.5.40 sys +............ + + * Add the *note _is_interned(): 252. 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, Up: Improved Modules + +1.1.5.41 tempfile +................. + + * On Windows, the default mode ‘0o700’ used by *note + tempfile.mkdtemp(): 221. now limits access to the new directory due + to changes to *note os.mkdir(): 21f. 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, Prev: tempfile, Up: Improved Modules + +1.1.5.42 time +............. + + * On Windows, *note monotonic(): 255. 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(): 256. 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, Next: traceback, Prev: time, Up: Improved Modules + +1.1.5.43 tkinter +................ + + * Add *note tkinter: f0. 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: f0. 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: 258, + 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: 259. 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(): + 25a. method of *note tkinter.ttk.Style: 25b. (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, Prev: tkinter, Up: Improved Modules + +1.1.5.44 traceback +.................. + + * Add the *note exc_type_str: 25d. attribute to *note + TracebackException: 25e, which holds a string display of the + 'exc_type'. Deprecate the *note exc_type: 25f. 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(): 260. to (recursively) + format the nested exceptions of a *note BaseExceptionGroup: 261. + 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, Next: typing, Prev: traceback, Up: Improved Modules + +1.1.5.45 types +.............. + + * *note SimpleNamespace: 1d1. 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, Next: unicodedata, Prev: types, Up: Improved Modules + +1.1.5.46 typing +............... + + * PEP 705(1): Add *note ReadOnly: 161, a special typing construct to + mark a *note TypedDict: 162. item as read-only for type checkers. + + * PEP 742(2): Add *note TypeIs: 163, a typing construct that can be + used to instruct a type checker how to narrow a type. + + * Add *note NoDefault: 264, a sentinel object used to represent the + defaults of some parameters in the *note typing: 104. module. + (Contributed by Jelle Zijlstra in gh-116126(3).) + + * Add *note get_protocol_members(): 265. to return the set of members + defining a *note typing.Protocol: 266. (Contributed by Jelle + Zijlstra in gh-104873(4).) + + * Add *note is_protocol(): 267. to check whether a class is a *note + Protocol: 266. (Contributed by Jelle Zijlstra in gh-104873(5).) + + * *note ClassVar: 268. can now be nested in *note Final: 269, 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, Next: venv, Prev: typing, Up: Improved Modules + +1.1.5.47 unicodedata +.................... + + * Update the Unicode database to version 15.1.0(1). (Contributed by + James Gerity in gh-109559(2).) + + ---------- Footnotes ---------- + + (1) https://www.unicode.org/versions/Unicode15.1.0/ + + (2) https://github.com/python/cpython/issues/109559 + + +File: python.info, Node: venv, Next: warnings, Prev: unicodedata, Up: Improved Modules + +1.1.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: 26c. and *note + create(): 26d.), and opt-out via the CLI, using + ‘--without-scm-ignore-files’. (Contributed by Brett Cannon in + gh-108125(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/108125 + + +File: python.info, Node: warnings, Next: xml, Prev: venv, Up: Improved Modules + +1.1.5.49 warnings +................. + + * PEP 702(1): The new *note warnings.deprecated(): 160. decorator + provides a way to communicate deprecations to a *note static type + checker: 26f. and to warn on usage of deprecated classes and + functions. A *note DeprecationWarning: 1a5. may also be emitted + when a decorated function or class is used at runtime. + (Contributed by Jelle Zijlstra in gh-104003(2).) + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0702/ + + (2) https://github.com/python/cpython/issues/104003 + + +File: python.info, Node: xml, Next: zipimport, Prev: warnings, Up: Improved Modules + +1.1.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(): 271. + + * *note xml.etree.ElementTree.XMLPullParser.flush(): 272. + + * *note xml.parsers.expat.xmlparser.GetReparseDeferralEnabled(): + 273. + + * *note xml.parsers.expat.xmlparser.SetReparseDeferralEnabled(): + 274. + + * ‘xml.sax.expatreader.ExpatParser.flush()’ + + (Contributed by Sebastian Pipping in gh-115623(2).) + + * Add the ‘close()’ method for the iterator returned by *note + iterparse(): 275. for explicit cleanup. (Contributed by Serhiy + Storchaka in gh-69893(3).) + + ---------- Footnotes ---------- + + (1) https://www.cve.org/CVERecord?id=CVE-2023-52425 + + (2) https://github.com/python/cpython/issues/115623 + + (3) https://github.com/python/cpython/issues/69893 + + +File: python.info, Node: zipimport, Prev: xml, Up: Improved Modules + +1.1.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: Optimizations, Next: Removed Modules And APIs, Prev: Improved Modules, Up: What’s New In Python 3 13 + +1.1.6 Optimizations +------------------- + + * Several standard library modules have had their import times + significantly improved. For example, the import time of the *note + typing: 104. module has been reduced by around a third by removing + dependencies on *note re: b9. and *note contextlib: 23. Other + modules to enjoy import-time speedups include *note email.utils: + 50, *note enum: 56, *note functools: 5f, *note importlib.metadata: + 7a, and *note threading: ed. (Contributed by Alex Waygood, + Shantanu Jain, Adam Turner, Daniel Hollas, and others in + gh-109653(1).) + + * *note textwrap.indent(): 278. is now around 30% faster than before + for large input. (Contributed by Inada Naoki in gh-107369(2).) + + * The *note subprocess: d6. module now uses the *note posix_spawn(): + 222. 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: 24f. 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: Optimizations, Up: What’s New In Python 3 13 + +1.1.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<2>. +* importlib.metadata: importlib metadata. +* locale:: +* opcode:: +* optparse:: +* pathlib: pathlib<2>. +* re: re<2>. +* tkinter.tix: tkinter tix. +* turtle:: +* typing: typing<2>. +* unittest:: +* urllib:: +* webbrowser:: + + +File: python.info, Node: PEP 594 Remove “dead batteries” from the standard library, Next: 2to3, Up: Removed Modules And APIs + +1.1.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(): 27b. for ‘GET’ and ‘HEAD’ requests, + and the *note email.message: 44. module or the multipart(5) + library for ‘POST’ and ‘PUT’ requests. + + * ‘cgi.parse()’ can be replaced by calling *note + urllib.parse.parse_qs(): 27c. 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: 3b. package, which implements the same MIME + RFCs. For example, with *note email.message.EmailMessage: + 27d.: + + 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: 3b. package, which implements the same + MIME RFCs, or with the multipart(6) library. For example, the + *note email.message.EmailMessage: 27d. and *note + email.message.Message: 27e. 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: 68. + 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. + + * passlib(10): Comprehensive password hashing framework + supporting over 30 schemes. + + * argon2-cffi(11): The secure Argon2 password hashing algorithm. + + * legacycrypt(12): *note ctypes: 2a. wrapper to the POSIX crypt + library call and associated functionality. + + * crypt_r(13): Fork of the ‘crypt’ module, wrapper to the + ‘crypt_r(3)(14)’ library call and associated functionality. + + * standard-crypt(15) and deprecated-crypt-alternative(16): Use + the redistribution of ‘crypt’ and reimplementation of ‘_crypt’ + libraries from PyPI. + + * ‘imghdr’: The filetype(17), puremagic(18), or python-magic(19) + 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(20): Use the redistribution of ‘imghdr’ + library from PyPI. + + * ‘mailcap’: Use the *note mimetypes: 8f. module instead. + + * standard-mailcap(21): Use the redistribution of ‘mailcap’ + library from PyPI. + + * ‘msilib’ + + * ‘nis’ + + * ‘nntplib’: Use the pynntp(22) library from PyPI instead. + + * standard-nntplib(23): Use the redistribution of ‘nntplib’ + library from PyPI. + + * ‘ossaudiodev’: For audio playback, use the pygame(24) library from + PyPI instead. + + * ‘pipes’: Use the *note subprocess: d6. module instead. Use *note + shlex.quote(): 27f. to replace the undocumented ‘pipes.quote’ + function. + + * standard-pipes(25): Use the redistribution of ‘pipes’ library + from PyPI. + + * ‘sndhdr’: The filetype(26), puremagic(27), or python-magic(28) + libraries should be used as replacements. + + * standard-sndhdr(29): Use the redistribution of ‘sndhdr’ + library from PyPI. + + * ‘spwd’: Use the python-pam(30) library from PyPI instead. + + * ‘sunau’ + + * standard-sunau(31): Use the redistribution of ‘sunau’ library + from PyPI. + + * ‘telnetlib’, Use the telnetlib3(32) or Exscript(33) libraries from + PyPI instead. + + * standard-telnetlib(34): Use the redistribution of ‘telnetlib’ + library from PyPI. + + * ‘uu’: Use the *note base64: e. module instead, as a modern + alternative. + + * standard-uu(35): Use the redistribution of ‘uu’ library from + PyPI. + + * ‘xdrlib’ + + * standard-xdrlib(36): Use the redistribution of ‘xdrlib’ + library from PyPI. + +(Contributed by Victor Stinner and Zachary Ware in gh-104773(37) and +gh-104780(38).) + + ---------- 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/passlib/ + + (11) https://pypi.org/project/argon2-cffi/ + + (12) https://pypi.org/project/legacycrypt/ + + (13) https://pypi.org/project/crypt_r/ + + (14) https://manpages.debian.org/crypt_r(3) + + (15) https://pypi.org/project/standard-crypt/ + + (16) https://pypi.org/project/deprecated-crypt-alternative/ + + (17) https://pypi.org/project/filetype/ + + (18) https://pypi.org/project/puremagic/ + + (19) https://pypi.org/project/python-magic/ + + (20) https://pypi.org/project/standard-imghdr/ + + (21) https://pypi.org/project/standard-mailcap/ + + (22) https://pypi.org/project/pynntp/ + + (23) https://pypi.org/project/standard-nntplib/ + + (24) https://pypi.org/project/pygame/ + + (25) https://pypi.org/project/standard-pipes/ + + (26) https://pypi.org/project/filetype/ + + (27) https://pypi.org/project/puremagic/ + + (28) https://pypi.org/project/python-magic/ + + (29) https://pypi.org/project/standard-sndhdr/ + + (30) https://pypi.org/project/python-pam/ + + (31) https://pypi.org/project/standard-sunau/ + + (32) https://pypi.org/project/telnetlib3/ + + (33) https://pypi.org/project/Exscript/ + + (34) https://pypi.org/project/standard-telnetlib/ + + (35) https://pypi.org/project/standard-uu/ + + (36) https://pypi.org/project/standard-xdrlib/ + + (37) https://github.com/python/cpython/issues/104773 + + (38) 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.1.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<2>, Prev: 2to3, Up: Removed Modules And APIs + +1.1.7.3 builtins +................ + + * Remove support for chained *note classmethod: 166. descriptors + (introduced in gh-63272(1)). These can no longer be used to wrap + other descriptors, such as *note property: 194. The core design of + this feature was flawed and led to several problems. To + “pass-through” a *note classmethod: 166, consider using the + ‘__wrapped__’ attribute that was added in Python 3.10. + (Contributed by Raymond Hettinger in gh-89519(2).) + + * Raise a *note RuntimeError: 195. when calling *note frame.clear(): + 282. 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<2>, Next: importlib metadata, Prev: builtins, Up: Removed Modules And APIs + +1.1.7.4 configparser +.................... + + * Remove the undocumented ‘LegacyInterpolation’ class, deprecated in + the docstring since Python 3.2, and at runtime since Python 3.11. + (Contributed by Hugo van Kemenade in gh-104886(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/104886 + + +File: python.info, Node: importlib metadata, Next: locale, Prev: configparser<2>, Up: Removed Modules And APIs + +1.1.7.5 importlib.metadata +.......................... + + * Remove deprecated subscript (*note __getitem__(): 285.) access for + *note EntryPoint: 286. objects. (Contributed by Jason R. Coombs in + gh-113175(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/113175 + + +File: python.info, Node: locale, Next: opcode, Prev: importlib metadata, Up: Removed Modules And APIs + +1.1.7.6 locale +.............. + + * Remove the ‘locale.resetlocale()’ function, deprecated in Python + 3.11. Use ‘locale.setlocale(locale.LC_ALL, "")’ instead. + (Contributed by Victor Stinner in gh-104783(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/104783 + + +File: python.info, Node: opcode, Next: optparse, Prev: locale, Up: Removed Modules And APIs + +1.1.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: 38, 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<2>, Prev: opcode, Up: Removed Modules And APIs + +1.1.7.8 optparse +................ + + * This module is no longer considered *note soft deprecated: 20b. + While *note argparse: 6. 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<2>, Next: re<2>, Prev: optparse, Up: Removed Modules And APIs + +1.1.7.9 pathlib +............... + + * Remove the ability to use *note Path: 22b. 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<2>, Next: tkinter tix, Prev: pathlib<2>, Up: Removed Modules And APIs + +1.1.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, Prev: re<2>, Up: Removed Modules And APIs + +1.1.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, Next: typing<2>, Prev: tkinter tix, Up: Removed Modules And APIs + +1.1.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<2>, Next: unittest, Prev: turtle, Up: Removed Modules And APIs + +1.1.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: 104. module. (Contributed by Sebastian + Rittau in gh-92871(1).) + + * Remove the keyword-argument method of creating *note TypedDict: + 162. 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, Next: urllib, Prev: typing<2>, Up: Removed Modules And APIs + +1.1.7.14 unittest +................. + + * Remove the following *note unittest: 106. functions, deprecated in + Python 3.11: + + * ‘unittest.findTestCases()’ + + * ‘unittest.makeSuite()’ + + * ‘unittest.getTestCaseNames()’ + + Use *note TestLoader: 290. methods instead: + + * *note loadTestsFromModule(): 291. + + * *note loadTestsFromTestCase(): 292. + + * *note getTestCaseNames(): 293. + + (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, Next: webbrowser, Prev: unittest, Up: Removed Modules And APIs + +1.1.7.15 urllib +............... + + * Remove the 'cafile', 'capath', and 'cadefault' parameters of the + *note urllib.request.urlopen(): 295. function, deprecated in Python + 3.6. Use the 'context' parameter instead with an *note SSLContext: + 296. instance. The *note ssl.SSLContext.load_cert_chain(): 297. + function can be used to load specific certificates, or let *note + ssl.create_default_context(): 155. 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, Prev: urllib, Up: Removed Modules And APIs + +1.1.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: 299. 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.1.8 New Deprecations +---------------------- + + * *note User-defined functions: 29b.: + + * Deprecate assignment to a function’s *note __code__: 29c. + 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: 7.: + + * 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: 29d.) for Unicode characters instead. + (Contributed by Hugo van Kemenade in gh-80480(2).) + + * *note ctypes: 2a.: + + * Deprecate the undocumented ‘SetPointerType()’ function, to be + removed in Python 3.15. (Contributed by Victor Stinner in + gh-105733(3).) + + * *note Soft-deprecate: 20b. the *note ARRAY(): 29e. function in + favour of ‘type * length’ multiplication. (Contributed by + Victor Stinner in gh-105733(4).) + + * *note decimal: 36.: + + * Deprecate the non-standard and undocumented *note Decimal: + 29f. format specifier ‘'N'’, which is only supported in the + ‘decimal’ module’s C implementation. (Contributed by Serhiy + Storchaka in gh-89902(5).) + + * *note dis: 38.: + + * Deprecate the ‘HAVE_ARGUMENT’ separator. Check membership in + *note hasarg: 2a0. instead. (Contributed by Irit Katriel in + gh-109319(6).) + + * *note gettext: 63.: + + * 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: 64.: + + * Deprecate the undocumented ‘glob0()’ and ‘glob1()’ functions. + Use *note glob(): 2a1. and pass a *note path-like object: 2a2. + specifying the root directory to the 'root_dir' parameter + instead. (Contributed by Barney Gale in gh-117337(8).) + + * *note http.server: 72.: + + * Deprecate *note CGIHTTPRequestHandler: 2a3, 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: 8f.: + + * *note Soft-deprecate: 20b. file path arguments to *note + guess_type(): 20a, use *note guess_file_type(): 209. instead. + (Contributed by Serhiy Storchaka in gh-66543(11).) + + * *note re: b9.: + + * Deprecate passing the optional 'maxsplit', 'count', or 'flags' + arguments as positional arguments to the module-level *note + split(): 2a4, *note sub(): 2a5, and *note subn(): 2a6. + functions. These parameters will become *note keyword-only: + 2a7. in a future version of Python. (Contributed by Serhiy + Storchaka in gh-56166(12).) + + * *note pathlib: a4.: + + * Deprecate *note PurePath.is_reserved(): 2a8, to be removed in + Python 3.15. Use *note os.path.isreserved(): 225. to detect + reserved paths on Windows. (Contributed by Barney Gale in + gh-88569(13).) + + * *note platform: aa.: + + * Deprecate *note java_ver(): 2a9, 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: b5.: + + * Deprecate the undocumented ‘ispackage()’ function. + (Contributed by Zackery Spytz in gh-64020(15).) + + * *note sqlite3: cf.: + + * Deprecate passing more than one positional argument to the + *note connect(): 2aa. function and the *note Connection: 247. + 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(): + 2ab. and *note Connection.create_aggregate(): 2ac. 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(): 2ad, *note set_progress_handler(): + 2ae, and *note set_trace_callback(): 2af. *note Connection: + 247. methods. The callback callables will become + positional-only in Python 3.15. (Contributed by Erlend E. + Aasland in gh-108278(18).) + + * *note sys: d9.: + + * Deprecate the *note _enablelegacywindowsfsencoding(): 2b0. + function, to be removed in Python 3.16. Use the *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. environment variable + instead. (Contributed by Inada Naoki in gh-73427(19).) + + * *note tarfile: de.: + + * Deprecate the undocumented and unused ‘TarFile.tarfile’ + attribute, to be removed in Python 3.16. (Contributed in + gh-115256(20).) + + * *note traceback: fe.: + + * Deprecate the *note TracebackException.exc_type: 25f. + attribute. Use *note TracebackException.exc_type_str: 25d. + instead. (Contributed by Irit Katriel in gh-112332(21).) + + * *note typing: 104.: + + * Deprecate the undocumented keyword argument syntax for + creating *note NamedTuple: 2b2. 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: 2b2. or *note typing.TypedDict: 162. class, + and deprecate passing ‘None’ to the 'fields' parameter of both + types. Python 3.15 will require a valid sequence for the + 'fields' parameter. To create a NamedTuple class with zero + fields, use ‘class NT(NamedTuple): pass’ or ‘NT = + NamedTuple("NT", ())’. To create a TypedDict class with zero + fields, use ‘class TD(TypedDict): pass’ or ‘TD = + TypedDict("TD", {})’. (Contributed by Alex Waygood in + gh-105566(23) and gh-105570(24).) + + * Deprecate the *note typing.no_type_check_decorator(): 2b3. + decorator function, to be removed in Python 3.15. After eight + years in the *note typing: 104. module, it has yet to be + supported by any major type checker. (Contributed by Alex + Waygood in gh-106309(25).) + + * Deprecate *note typing.AnyStr: 2b4. In Python 3.16, it will + be removed from ‘typing.__all__’, and a *note + DeprecationWarning: 1a5. 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: 2b5. instead. + (Contributed by Michael The in gh-107116(26).) + + * *note wave: 113.: + + * Deprecate the *note getmark(): 2b6, ‘setmark()’, and *note + getmarkers(): 2b7. methods of the *note Wave_read: 2b8. and + *note Wave_write: 2b9. 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. +* Pending removal in Python 3.16: Pending removal in Python 3 16. +* Pending Removal in Future Versions:: + + ---------- 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, Up: New Deprecations + +1.1.8.1 Pending Removal in Python 3.14 +...................................... + + * *note argparse: 6.: 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: 8.: The following features have been deprecated in + documentation since Python 3.8, now cause a *note + DeprecationWarning: 1a5. 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: 2bb. instead. (Contributed by Serhiy + Storchaka in gh-90953(2).) + + * *note asyncio: a.: + + * The child watcher classes *note MultiLoopChildWatcher: 2bc, + *note FastChildWatcher: 2bd, *note AbstractChildWatcher: 2be. + and *note SafeChildWatcher: 2bf. are deprecated and will be + removed in Python 3.14. (Contributed by Kumar Aditya in + gh-94597(3).) + + * *note asyncio.set_child_watcher(): 2c0, *note + asyncio.get_child_watcher(): 2c1, *note + asyncio.AbstractEventLoopPolicy.set_child_watcher(): 2c2. and + *note asyncio.AbstractEventLoopPolicy.get_child_watcher(): + 2c3. are deprecated and will be removed in Python 3.14. + (Contributed by Kumar Aditya in gh-94597(4).) + + * The *note get_event_loop(): 2c4. method of the default event + loop policy now emits a *note DeprecationWarning: 1a5. 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 collections.abc: 1e.: Deprecated *note ByteString: 2c5. + Prefer ‘Sequence’ or *note Buffer: 2c6. For use in typing, prefer + a union, like ‘bytes | bytearray’, or *note collections.abc.Buffer: + 2c6. (Contributed by Shantanu Jain in gh-91896(6).) + + * *note email: 3b.: Deprecated the 'isdst' parameter in *note + email.utils.localtime(): 2c7. (Contributed by Alan Williams in + gh-72346(7).) + + * *note importlib.abc: 78. deprecated classes: + + * ‘importlib.abc.ResourceReader’ + + * ‘importlib.abc.Traversable’ + + * ‘importlib.abc.TraversableResources’ + + Use *note importlib.resources.abc: 7c. classes instead: + + * *note importlib.resources.abc.Traversable: 1f5. + + * *note importlib.resources.abc.TraversableResources: 2c8. + + (Contributed by Jason R. Coombs and Hugo van Kemenade in + gh-93963(8).) + + * *note itertools: 81. 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(9).) + + * *note multiprocessing: 94.: 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(10)). 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(): 2c9. or *note set_start_method(): 2ca. APIs to + explicitly specify when your code 'requires' ‘'fork'’. See *note + Contexts and start methods: 2cb. + + * *note pathlib: a4.: *note is_relative_to(): 2cc. and *note + relative_to(): 2cd.: passing additional arguments is deprecated. + + * *note pkgutil: a9.: *note find_loader(): 2ce. and *note + get_loader(): 2cf. now raise *note DeprecationWarning: 1a5.; use + *note importlib.util.find_spec(): 2d0. instead. (Contributed by + Nikita Sobolev in gh-97850(11).) + + * *note pty: b1.: + + * ‘master_open()’: use *note pty.openpty(): 2d1. + + * ‘slave_open()’: use *note pty.openpty(): 2d1. + + * *note sqlite3: cf.: + + * *note version: 2d2. and *note version_info: 2d3. + + * *note execute(): 2d4. and *note executemany(): 2d5. if *note + named placeholders: 2d6. are used and 'parameters' is a + sequence instead of a *note dict: 258. + + * *note typing: 104.: *note ByteString: 2d7, deprecated since Python + 3.9, now causes a *note DeprecationWarning: 1a5. to be emitted when + it is used. + + * *note urllib: 108.: ‘urllib.parse.Quoter’ is deprecated: it was not + intended to be a public API. (Contributed by Gregory P. Smith in + gh-88168(12).) + + ---------- 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/91896 + + (7) https://github.com/python/cpython/issues/72346 + + (8) https://github.com/python/cpython/issues/93963 + + (9) https://github.com/python/cpython/issues/101588 + + (10) https://github.com/python/cpython/issues/84559 + + (11) https://github.com/python/cpython/issues/97850 + + (12) https://github.com/python/cpython/issues/88168 + + +File: python.info, Node: Pending Removal in Python 3 15, Next: Pending removal in Python 3 16, Prev: Pending Removal in Python 3 14, Up: New Deprecations + +1.1.8.2 Pending Removal in Python 3.15 +...................................... + + * The import system: + + * Setting *note __cached__: 2d9. on a module while failing to + set *note __spec__.cached: 2da. 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__: 2db. on a module while failing to + set *note __spec__.parent: 2dc. 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: 2a.: + + * The undocumented ‘ctypes.SetPointerType()’ function has been + deprecated since Python 3.13. + + * *note http.server: 72.: + + * The obsolete and rarely used *note CGIHTTPRequestHandler: 2a3. + 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: 77.: + + * ‘load_module()’ method: use ‘exec_module()’ instead. + + * *note locale: 86.: + + * The *note getdefaultlocale(): 2dd. function has been + deprecated since Python 3.11. Its removal was originally + planned for Python 3.13 (gh-90817(3)), but has been postponed + to Python 3.15. Use *note getlocale(): 2de, *note + setlocale(): 2df, and *note getencoding(): 2e0. instead. + (Contributed by Hugo van Kemenade in gh-111187(4).) + + * *note pathlib: a4.: + + * *note PurePath.is_reserved(): 2a8. has been deprecated since + Python 3.13. Use *note os.path.isreserved(): 225. to detect + reserved paths on Windows. + + * *note platform: aa.: + + * *note java_ver(): 2a9. 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: db.: + + * The 'check_home' argument of *note + sysconfig.is_python_build(): 2e1. has been deprecated since + Python 3.12. + + * *note threading: ed.: + + * *note RLock(): 2e2. 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: 103.: + + * *note types.CodeType: 2e3.: Accessing *note co_lnotab: 2e4. + was deprecated in PEP 626(5) since 3.10 and was planned to be + removed in 3.12, but it only got a proper *note + DeprecationWarning: 1a5. in 3.12. May be removed in 3.15. + (Contributed by Nikita Sobolev in gh-101866(6).) + + * *note typing: 104.: + + * The undocumented keyword argument syntax for creating *note + NamedTuple: 2b2. classes (e.g. ‘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: 162.s, + failing to pass a value to the 'fields' parameter (‘TD = + TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD", + None)’) has been deprecated since Python 3.13. Use ‘class + TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a + TypedDict with zero field. + + * The *note typing.no_type_check_decorator(): 2b3. decorator + function has been deprecated since Python 3.13. After eight + years in the *note typing: 104. module, it has yet to be + supported by any major type checker. + + * *note wave: 113.: + + * The *note getmark(): 2b6, ‘setmark()’, and *note getmarkers(): + 2b7. methods of the *note Wave_read: 2b8. and *note + Wave_write: 2b9. classes have been deprecated since Python + 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/97879 + + (2) https://github.com/python/cpython/issues/97879 + + (3) https://github.com/python/cpython/issues/90817 + + (4) https://github.com/python/cpython/issues/111187 + + (5) https://peps.python.org/pep-0626/ + + (6) https://github.com/python/cpython/issues/101866 + + +File: python.info, Node: Pending removal in Python 3 16, Next: Pending Removal in Future Versions, Prev: Pending Removal in Python 3 15, Up: New Deprecations + +1.1.8.3 Pending removal in Python 3.16 +...................................... + + * The import system: + + * Setting *note __loader__: 2e6. on a module while failing to + set *note __spec__.loader: 2e7. 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: 7.: + + * 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: 29d.) for + Unicode characters instead. + + * *note asyncio: a.: + + * ‘asyncio.iscoroutinefunction()’ is deprecated and will be + removed in Python 3.16, use *note + inspect.iscoroutinefunction(): 2e8. instead. (Contributed by + Jiahao Li and Kumar Aditya in gh-122875(1).) + + * *note builtins: 12.: + + * 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 shutil: c5.: + + * 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: 195. + + * *note symtable: d8.: + + * The *note Class.get_methods: 2e9. method has been deprecated + since Python 3.14. + + * *note sys: d9.: + + * The *note _enablelegacywindowsfsencoding(): 2b0. function has + been deprecated since Python 3.13. Use the *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. environment variable + instead. + + * *note tarfile: de.: + + * The undocumented and unused ‘TarFile.tarfile’ attribute has + been deprecated since Python 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/122875 + + +File: python.info, Node: Pending Removal in Future Versions, Prev: Pending removal in Python 3 16, Up: New Deprecations + +1.1.8.4 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: 6.: Nesting argument groups and nesting mutually + exclusive groups are deprecated. + + * *note builtins: 12.: + + * ‘bool(NotImplemented)’. + + * 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: + 2eb, *note else: 18c, *note for: 2ec, *note if: 2ed, *note in: + 2ee, *note is: 2ef. and *note or: 2f0. 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: 259. + + * Support for ‘__float__()’ method returning a strict subclass + of *note float: 2f1.: these methods will be required to return + an instance of *note float: 2f1. + + * Support for ‘__complex__()’ method returning a strict subclass + of *note complex: 2f2.: these methods will be required to + return an instance of *note complex: 2f2. + + * Delegation of ‘int()’ to ‘__trunc__()’ method. + + * Passing a complex number as the 'real' or 'imag' argument in + the *note complex(): 2f2. constructor is now deprecated; it + should only be passed as a single positional argument. + (Contributed by Serhiy Storchaka in gh-109218(2).) + + * *note calendar: 14.: ‘calendar.January’ and ‘calendar.February’ + constants are deprecated and replaced by *note calendar.JANUARY: + 2f3. and *note calendar.FEBRUARY: 2f4. (Contributed by Prince + Roshan in gh-103636(3).) + + * *note codeobject.co_lnotab: 2e4.: use the *note + codeobject.co_lines(): 2f5. method instead. + + * *note datetime: 30.: + + * *note utcnow(): 2f6.: use + ‘datetime.datetime.now(tz=datetime.UTC)’. + + * *note utcfromtimestamp(): 2f7.: use + ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’. + + * *note gettext: 63.: Plural value must be an integer. + + * *note importlib: 77.: + + * *note cache_from_source(): 2f8. 'debug_override' parameter is + deprecated: use the 'optimization' parameter instead. + + * *note importlib.metadata: 7a.: + + * ‘EntryPoints’ tuple interface. + + * Implicit ‘None’ on return values. + + * *note logging: 87.: the ‘warn()’ method has been deprecated since + Python 3.3, use *note warning(): 2f9. instead. + + * *note mailbox: 8b.: Use of StringIO input and text mode is + deprecated, use BytesIO and binary mode instead. + + * *note os: a1.: Calling *note os.register_at_fork(): 2fa. in + multi-threaded process. + + * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter + is deprecated, use an exception instance. + + * *note re: b9.: 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(4).) + + * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules. + + * *note shutil: c5.: *note rmtree(): 2fb.’s 'onerror' parameter is + deprecated in Python 3.12; use the 'onexc' parameter instead. + + * *note ssl: d0. options and protocols: + + * *note ssl.SSLContext: 296. without protocol argument is + deprecated. + + * *note ssl.SSLContext: 296.: *note set_npn_protocols(): 2fc. + 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: ed. methods: + + * ‘threading.Condition.notifyAll()’: use *note notify_all(): + 2fd. + + * ‘threading.Event.isSet()’: use *note is_set(): 2fe. + + * ‘threading.Thread.isDaemon()’, *note + threading.Thread.setDaemon(): 2ff.: use *note + threading.Thread.daemon: 300. attribute. + + * ‘threading.Thread.getName()’, *note + threading.Thread.setName(): 301.: use *note + threading.Thread.name: 302. attribute. + + * ‘threading.currentThread()’: use *note + threading.current_thread(): 303. + + * ‘threading.activeCount()’: use *note threading.active_count(): + 304. + + * *note typing.Text: 305. (gh-92332(5)). + + * *note unittest.IsolatedAsyncioTestCase: 306.: it is deprecated to + return a value that is not ‘None’ from a test case. + + * *note urllib.parse: 10a. deprecated functions: *note urlparse(): + 307. instead + + * ‘splitattr()’ + + * ‘splithost()’ + + * ‘splitnport()’ + + * ‘splitpasswd()’ + + * ‘splitport()’ + + * ‘splitquery()’ + + * ‘splittag()’ + + * ‘splittype()’ + + * ‘splituser()’ + + * ‘splitvalue()’ + + * ‘to_bytes()’ + + * *note urllib.request: 10b.: *note URLopener: 308. and *note + FancyURLopener: 309. style of invoking requests is deprecated. Use + newer *note urlopen(): 295. functions and methods. + + * *note wsgiref: 118.: ‘SimpleHandler.stdout.write()’ should not do + partial writes. + + * *note xml.etree.ElementTree: 125.: Testing the truth value of an + *note Element: 30a. is deprecated. In a future release it will + always return ‘True’. Prefer explicit ‘len(elem)’ or ‘elem is not + None’ tests instead. + + * *note zipimport.zipimporter.load_module(): 30b. is deprecated: use + *note exec_module(): 30c. 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/91760 + + (5) https://github.com/python/cpython/issues/92332 + + +File: python.info, Node: CPython Bytecode Changes, Next: C API Changes, Prev: New Deprecations, Up: What’s New In Python 3 13 + +1.1.9 CPython Bytecode Changes +------------------------------ + + * The oparg of *note YIELD_VALUE: 30e. is now ‘1’ if the yield is + part of a yield-from or await, and ‘0’ otherwise. The oparg of + *note RESUME: 30f. 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 Changes, Next: Build Changes, Prev: CPython Bytecode Changes, Up: What’s New In Python 3 13 + +1.1.10 C API Changes +-------------------- + +* Menu: + +* New Features: New Features<2>. +* Changed C APIs:: +* Limited C API Changes:: +* Removed C APIs:: +* Deprecated C APIs:: + + +File: python.info, Node: New Features<2>, Next: Changed C APIs, Up: C API Changes + +1.1.10.1 New Features +..................... + + * Add the *note PyMonitoring C API: 15c. for generating PEP 669(1) + monitoring events: + + * *note PyMonitoringState: 312. + + * *note PyMonitoring_FirePyStartEvent(): 313. + + * *note PyMonitoring_FirePyResumeEvent(): 314. + + * *note PyMonitoring_FirePyReturnEvent(): 315. + + * *note PyMonitoring_FirePyYieldEvent(): 316. + + * *note PyMonitoring_FireCallEvent(): 317. + + * *note PyMonitoring_FireLineEvent(): 318. + + * *note PyMonitoring_FireJumpEvent(): 319. + + * *note PyMonitoring_FireBranchEvent(): 31a. + + * *note PyMonitoring_FireCReturnEvent(): 31b. + + * *note PyMonitoring_FirePyThrowEvent(): 31c. + + * *note PyMonitoring_FireRaiseEvent(): 31d. + + * *note PyMonitoring_FireCRaiseEvent(): 31e. + + * *note PyMonitoring_FireReraiseEvent(): 31f. + + * *note PyMonitoring_FireExceptionHandledEvent(): 320. + + * *note PyMonitoring_FirePyUnwindEvent(): 321. + + * *note PyMonitoring_FireStopIterationEvent(): 322. + + * *note PyMonitoring_EnterScope(): 323. + + * *note PyMonitoring_ExitScope(): 324. + + (Contributed by Irit Katriel in gh-111997(2)). + + * Add *note PyMutex: 15b, a lightweight mutex that occupies a single + byte, and the new *note PyMutex_Lock(): 325. and *note + PyMutex_Unlock(): 326. functions. ‘PyMutex_Lock()’ will release + the *note GIL: 159. (if currently held) if the operation needs to + block. (Contributed by Sam Gross in gh-108724(3).) + + * Add the *note PyTime C API: 327. to provide access to system + clocks: + + * *note PyTime_t: 328. + + * *note PyTime_MIN: 329. and *note PyTime_MAX: 32a. + + * *note PyTime_AsSecondsDouble(): 32b. + + * *note PyTime_Monotonic(): 32c. + + * *note PyTime_MonotonicRaw(): 32d. + + * *note PyTime_PerfCounter(): 32e. + + * *note PyTime_PerfCounterRaw(): 32f. + + * *note PyTime_Time(): 330. + + * *note PyTime_TimeRaw(): 331. + + (Contributed by Victor Stinner and Petr Viktorin in gh-110850(4).) + + * Add the *note PyDict_ContainsString(): 332. function with the same + behavior as *note PyDict_Contains(): 333, but 'key' is specified as + a const char* UTF-8 encoded bytes string, rather than a *note + PyObject: 334.*. (Contributed by Victor Stinner in gh-108314(5).) + + * Add the *note PyDict_GetItemRef(): 335. and *note + PyDict_GetItemStringRef(): 336. functions, which behave similarly + to *note PyDict_GetItemWithError(): 337, but return a *note strong + reference: 338. instead of a *note borrowed reference: 339. + 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(): 33a. function, which behaves + similarly to *note PyDict_SetDefault(): 33b, but returns a *note + strong reference: 338. instead of a *note borrowed reference: 339. + 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(): 33c. and *note PyDict_PopString(): 33d. + functions to remove a key from a dictionary and optionally return + the removed value. This is similar to *note dict.pop(): 33e, + though there is no default value, and *note KeyError: 33f. is not + raised for missing keys. (Contributed by Stefan Behnel and Victor + Stinner in gh-111262(8).) + + * Add the *note PyMapping_GetOptionalItem(): 340. and *note + PyMapping_GetOptionalItemString(): 341. functions as alternatives + to *note PyObject_GetItem(): 342. and *note + PyMapping_GetItemString(): 343. respectively. The new functions do + not raise *note KeyError: 33f. 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(): 344. and *note + PyObject_GetOptionalAttrString(): 345. functions as alternatives to + *note PyObject_GetAttr(): 346. and *note PyObject_GetAttrString(): + 347. respectively. The new functions do not raise *note + AttributeError: 348. 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(): 349. function as an + extension to *note PyErr_WriteUnraisable(): 34a. that allows + customizing the warning message. (Contributed by Serhiy Storchaka + in gh-108082(11).) + + * Add new functions that return a *note strong reference: 338. + instead of a *note borrowed reference: 339. for frame locals, + globals, and builtins, as part of *note PEP 667: 142.: + + * *note PyEval_GetFrameBuiltins(): 34b. replaces *note + PyEval_GetBuiltins(): 34c. + + * *note PyEval_GetFrameGlobals(): 34d. replaces *note + PyEval_GetGlobals(): 34e. + + * *note PyEval_GetFrameLocals(): 34f. replaces *note + PyEval_GetLocals(): 350. + + (Contributed by Mark Shannon and Tian Gao in gh-74929(12).) + + * Add the *note Py_GetConstant(): 351. and *note + Py_GetConstantBorrowed(): 352. functions to get *note strong: 338. + or *note borrowed: 339. 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(): 353. function as a + replacement for *note PyImport_AddModule(): 354. that returns a + *note strong reference: 338. instead of a *note borrowed reference: + 339. (Contributed by Victor Stinner in gh-105922(14).) + + * Add the *note Py_IsFinalizing(): 355. function to check whether the + main Python interpreter is *note shutting down: 14e. (Contributed + by Victor Stinner in gh-108014(15).) + + * Add the *note PyList_GetItemRef(): 356. function as a replacement + for *note PyList_GetItem(): 357. that returns a *note strong + reference: 338. instead of a *note borrowed reference: 339. + (Contributed by Sam Gross in gh-114329(16).) + + * Add the *note PyList_Extend(): 358. and *note PyList_Clear(): 359. + functions, mirroring the Python ‘list.extend()’ and ‘list.clear()’ + methods. (Contributed by Victor Stinner in gh-111138(17).) + + * Add the *note PyLong_AsInt(): 35a. function. It behaves similarly + to *note PyLong_AsLong(): 35b, 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(): 35c, *note + PyLong_FromNativeBytes(): 35d, and *note + PyLong_FromUnsignedNativeBytes(): 35e. functions to simplify + converting between native integer types and Python *note int: 259. + objects. (Contributed by Steve Dower in gh-111140(19).) + + * Add *note PyModule_Add(): 35f. function, which is similar to *note + PyModule_AddObjectRef(): 360. and *note PyModule_AddObject(): 361, + but always steals a reference to the value. (Contributed by Serhiy + Storchaka in gh-86493(20).) + + * Add the *note PyObject_GenericHash(): 362. function that implements + the default hashing function of a Python object. (Contributed by + Serhiy Storchaka in gh-113024(21).) + + * Add the *note Py_HashPointer(): 363. function to hash a raw + pointer. (Contributed by Victor Stinner in gh-111545(22).) + + * Add the *note PyObject_VisitManagedDict(): 364. and *note + PyObject_ClearManagedDict(): 365. functions. which must be called + by the traverse and clear functions of a type using the *note + Py_TPFLAGS_MANAGED_DICT: 366. 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(): 367. and *note + PyRefTracer_GetTracer(): 368. functions, which enable tracking + object creation and destruction in the same way that the *note + tracemalloc: ff. module does. (Contributed by Pablo Galindo in + gh-93502(25).) + + * Add the *note PySys_AuditTuple(): 369. function as an alternative + to *note PySys_Audit(): 36a. that takes event arguments as a Python + *note tuple: 36b. object. (Contributed by Victor Stinner in + gh-85283(26).) + + * Add the *note PyThreadState_GetUnchecked(): 36c. function as an + alternative to *note PyThreadState_Get(): 36d. 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(): 36e. function to get + the type’s fully qualified name. The module name is prepended if + *note type.__module__: 36f. 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(): 370. function to get the + type’s module name. This is equivalent to getting the *note + type.__module__: 36f. attribute. (Contributed by Eric Snow and + Victor Stinner in gh-111696(29).) + + * Add the *note PyUnicode_EqualToUTF8AndSize(): 371. and *note + PyUnicode_EqualToUTF8(): 372. 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(): 373. function as an alternative + to *note PyWeakref_GetObject(): 374. that returns a *note strong + reference: 338. 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(): 375. replaces *note + PyObject_HasAttr(): 376. + + * *note PyObject_HasAttrStringWithError(): 377. replaces *note + PyObject_HasAttrString(): 378. + + * *note PyMapping_HasKeyWithError(): 379. replaces *note + PyMapping_HasKey(): 37a. + + * *note PyMapping_HasKeyStringWithError(): 37b. replaces *note + PyMapping_HasKeyString(): 37c. + + The new functions return ‘-1’ for errors and the standard ‘1’ for + true and ‘0’ for false. + + (Contributed by Serhiy Storchaka in gh-108511(32).) + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0669/ + + (2) https://github.com/python/cpython/issues/111997 + + (3) https://github.com/python/cpython/issues/108724 + + (4) https://github.com/python/cpython/issues/110850 + + (5) https://github.com/python/cpython/issues/108314 + + (6) https://github.com/python/cpython/issues/106004 + + (7) https://github.com/python/cpython/issues/112066 + + (8) https://github.com/python/cpython/issues/111262 + + (9) https://github.com/python/cpython/issues/106307 + + (10) https://github.com/python/cpython/issues/106521 + + (11) https://github.com/python/cpython/issues/108082 + + (12) https://github.com/python/cpython/issues/74929 + + (13) https://github.com/python/cpython/issues/115754 + + (14) https://github.com/python/cpython/issues/105922 + + (15) https://github.com/python/cpython/issues/108014 + + (16) https://github.com/python/cpython/issues/114329 + + (17) https://github.com/python/cpython/issues/111138 + + (18) https://github.com/python/cpython/issues/108014 + + (19) https://github.com/python/cpython/issues/111140 + + (20) https://github.com/python/cpython/issues/86493 + + (21) https://github.com/python/cpython/issues/113024 + + (22) https://github.com/python/cpython/issues/111545 + + (23) https://github.com/python/pythoncapi-compat/ + + (24) https://github.com/python/cpython/issues/107073 + + (25) https://github.com/python/cpython/issues/93502 + + (26) https://github.com/python/cpython/issues/85283 + + (27) https://github.com/python/cpython/issues/108867 + + (28) https://github.com/python/cpython/issues/111696 + + (29) https://github.com/python/cpython/issues/111696 + + (30) https://github.com/python/cpython/issues/110289 + + (31) https://github.com/python/cpython/issues/105927 + + (32) https://github.com/python/cpython/issues/108511 + + +File: python.info, Node: Changed C APIs, Next: Limited C API Changes, Prev: New Features<2>, Up: C API Changes + +1.1.10.2 Changed C APIs +....................... + + * The 'keywords' parameter of *note PyArg_ParseTupleAndKeywords(): + 37e. and *note PyArg_VaParseTupleAndKeywords(): 37f. 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: 380. macro. (Contributed by Serhiy Storchaka in + gh-65210(1).) + + * *note PyArg_ParseTupleAndKeywords(): 37e. 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(): 381. (Contributed by + Bogdan Romanyuk in gh-115781(3).) + + * The *note PyDict_GetItem(): 382, *note PyDict_GetItemString(): 383, + *note PyMapping_HasKey(): 37a, *note PyMapping_HasKeyString(): 37c, + *note PyObject_HasAttr(): 376, *note PyObject_HasAttrString(): 378, + and *note PySys_GetObject(): 384. functions, each of which clears + all errors which occurred when calling them now reports these + errors using *note sys.unraisablehook(): 1f9. 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(): 385.: + + * ‘%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: + 386. 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: 1fb. or *note with + assertions: 387, *note PyTuple_SET_ITEM(): 388. and *note + PyList_SET_ITEM(): 389. 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, Prev: Changed C APIs, Up: C API Changes + +1.1.10.3 Limited C API Changes +.............................. + + * The following functions are now included in the Limited C API: + + * *note PyMem_RawMalloc(): 38b. + + * *note PyMem_RawCalloc(): 38c. + + * *note PyMem_RawRealloc(): 38d. + + * *note PyMem_RawFree(): 38e. + + * *note PySys_Audit(): 36a. + + * *note PySys_AuditTuple(): 369. + + * *note PyType_GetModuleByDef(): 38f. + + (Contributed by Victor Stinner in gh-85283(1), gh-85283(2), and + gh-116936(3).) + + * Python built with *note -with-trace-refs: 390. (tracing references) + now supports the *note Limited API: 391. (Contributed by Victor + Stinner in gh-108634(4).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/85283 + + (2) https://github.com/python/cpython/issues/85283 + + (3) https://github.com/python/cpython/issues/116936 + + (4) https://github.com/python/cpython/issues/108634 + + +File: python.info, Node: Removed C APIs, Next: Deprecated C APIs, Prev: Limited C API Changes, Up: C API Changes + +1.1.10.4 Removed C APIs +....................... + + * 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: 250. 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: 393. instead. + + * ‘PyObject_CheckReadBuffer()’: Use *note + PyObject_CheckBuffer(): 394. to test whether the object + supports the buffer protocol. Note that *note + PyObject_CheckBuffer(): 394. doesn’t guarantee that *note + PyObject_GetBuffer(): 395. will succeed. To test if the + object is actually readable, see the next example of *note + PyObject_GetBuffer(): 395. + + * ‘PyObject_AsCharBuffer()’, ‘PyObject_AsReadBuffer()’: Use + *note PyObject_GetBuffer(): 395. and *note PyBuffer_Release(): + 396. 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(): + 395. and *note PyBuffer_Release(): 396. 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(): 397. or *note PyObject_Call(): + 398. instead. + + Warning: In *note PyObject_Call(): 398, positional + arguments must be a *note tuple: 36b. and must not be + ‘NULL’, and keyword arguments must be a *note dict: 258. + or ‘NULL’, whereas the removed functions checked argument + types and accepted ‘NULL’ positional and keyword + arguments. To replace + ‘PyEval_CallObjectWithKeywords(func, NULL, kwargs)’ with + *note PyObject_Call(): 398, pass an empty tuple as + positional arguments using *note PyTuple_New(0): 399. + + * ‘PyEval_CallFunction()’: Use *note PyObject_CallFunction(): + 39a. instead. + + * ‘PyEval_CallMethod()’: Use *note PyObject_CallMethod(): 39b. + instead. + + * ‘PyCFunction_Call()’: Use *note PyObject_Call(): 398. 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: 39c. instead. + + * ‘PySys_AddWarnOption()’: Use *note PyConfig.warnoptions: 39c. + instead. + + * ‘PySys_AddXOption()’: Use *note PyConfig.xoptions: 39d. + instead. + + * ‘PySys_HasWarnOptions()’: Use *note PyConfig.xoptions: 39d. + instead. + + * ‘PySys_SetPath()’: Set *note PyConfig.module_search_paths: + 39e. instead. + + * ‘Py_SetPath()’: Set *note PyConfig.module_search_paths: 39e. + instead. + + * ‘Py_SetStandardStreamEncoding()’: Set *note + PyConfig.stdio_encoding: 39f. instead, and set also maybe + *note PyConfig.legacy_windows_stdio: 3a0. (on Windows). + + * ‘_Py_SetProgramFullPath()’: Set *note PyConfig.executable: + 3a1. instead. + + Use the new *note PyConfig: 3a2. API of the *note Python + Initialization Configuration: 3a3. 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(): 3a4. and *note + PyEval_RestoreThread(): 3a5.; + + * low-level *note PyEval_AcquireThread(): 3a6. and *note + PyEval_RestoreThread(): 3a5.; + + * or *note PyGILState_Ensure(): 3a7. and *note + PyGILState_Release(): 3a8. + + (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(): 3a9. which was kept for backward + compatibility with Python 3.8. The pythoncapi-compat project(8) + can be used to get *note PyInterpreterState_Get(): 3a9. 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, Prev: Removed C APIs, Up: C API Changes + +1.1.10.5 Deprecated C APIs +.......................... + + * Deprecate old Python initialization functions: + + * *note PySys_ResetWarnOptions(): 3ab.: Clear *note + sys.warnoptions: 3ac. and ‘warnings.filters’ instead. + + * *note Py_GetExecPrefix(): 3ad.: Get *note sys.exec_prefix: + 3ae. instead. + + * *note Py_GetPath(): 3af.: Get *note sys.path: 3b0. instead. + + * *note Py_GetPrefix(): 3b1.: Get *note sys.prefix: 3b2. + instead. + + * *note Py_GetProgramFullPath(): 3b3.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetProgramName(): 3b5.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetPythonHome(): 3b6.: Get *note PyConfig.home: 3b7. + or the *note PYTHONHOME: 3b8. environment variable instead. + + (Contributed by Victor Stinner in gh-105145(1).) + + * *note Soft deprecate: 20b. the *note PyEval_GetBuiltins(): 34c, + *note PyEval_GetGlobals(): 34e, and *note PyEval_GetLocals(): 350. + functions, which return a *note borrowed reference: 339. (Soft + deprecated as part of PEP 667(2).) + + * Deprecate the *note PyImport_ImportModuleNoBlock(): 3b9. function, + which is just an alias to *note PyImport_ImportModule(): 3ba. since + Python 3.3. (Contributed by Victor Stinner in gh-105396(3).) + + * *note Soft deprecate: 20b. the *note PyModule_AddObject(): 361. + function. It should be replaced with *note PyModule_Add(): 35f. or + *note PyModule_AddObjectRef(): 360. (Contributed by Serhiy + Storchaka in gh-86493(4).) + + * Deprecate the old ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’ types and the + ‘Py_UNICODE_WIDE’ define. Use the ‘wchar_t’ type directly instead. + Since Python 3.3, ‘Py_UNICODE’ and ‘PY_UNICODE_TYPE’ are just + aliases to ‘wchar_t’. (Contributed by Victor Stinner in + gh-105156(5).) + + * Deprecate the *note PyWeakref_GetObject(): 374. and *note + PyWeakref_GET_OBJECT(): 3bb. functions, which return a *note + borrowed reference: 339. Replace them with the new *note + PyWeakref_GetRef(): 373. function, which returns a *note strong + reference: 338. The pythoncapi-compat project(6) can be used to + get *note PyWeakref_GetRef(): 373. 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<2>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<2>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<2>. + + ---------- 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<2>, Up: Deprecated C APIs + +1.1.10.6 Pending Removal in Python 3.14 +....................................... + + * The ‘ma_version_tag’ field in *note PyDictObject: 3bd. for + extension modules ( PEP 699(1); gh-101193(2)). + + * Creating *note immutable types: 3be. with mutable bases + (gh-95388(3)). + + * Functions to configure Python’s initialization, deprecated in + Python 3.11: + + * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3c0. + instead. + + * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3b7. instead. + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + * Global configuration variables: + + * *note Py_DebugFlag: 3c2.: Use *note PyConfig.parser_debug: + 3c3. instead. + + * *note Py_VerboseFlag: 3c4.: Use *note PyConfig.verbose: 3c5. + instead. + + * *note Py_QuietFlag: 3c6.: Use *note PyConfig.quiet: 3c7. + instead. + + * *note Py_InteractiveFlag: 3c8.: Use *note + PyConfig.interactive: 3c9. instead. + + * *note Py_InspectFlag: 3ca.: Use *note PyConfig.inspect: 3cb. + instead. + + * *note Py_OptimizeFlag: 3cc.: Use *note + PyConfig.optimization_level: 3cd. instead. + + * *note Py_NoSiteFlag: 3ce.: Use *note PyConfig.site_import: + 3cf. instead. + + * *note Py_BytesWarningFlag: 3d0.: Use *note + PyConfig.bytes_warning: 3d1. instead. + + * *note Py_FrozenFlag: 3d2.: Use *note + PyConfig.pathconfig_warnings: 3d3. instead. + + * *note Py_IgnoreEnvironmentFlag: 3d4.: Use *note + PyConfig.use_environment: 3d5. instead. + + * *note Py_DontWriteBytecodeFlag: 3d6.: Use *note + PyConfig.write_bytecode: 3d7. instead. + + * *note Py_NoUserSiteDirectory: 3d8.: Use *note + PyConfig.user_site_directory: 3d9. instead. + + * *note Py_UnbufferedStdioFlag: 3da.: Use *note + PyConfig.buffered_stdio: 3db. instead. + + * *note Py_HashRandomizationFlag: 3dc.: Use *note + PyConfig.use_hash_seed: 3dd. and *note PyConfig.hash_seed: + 3de. instead. + + * *note Py_IsolatedFlag: 3df.: Use *note PyConfig.isolated: 3e0. + instead. + + * *note Py_LegacyWindowsFSEncodingFlag: 3e1.: Use *note + PyPreConfig.legacy_windows_fs_encoding: 3e2. instead. + + * *note Py_LegacyWindowsStdioFlag: 3e3.: Use *note + PyConfig.legacy_windows_stdio: 3a0. instead. + + * ‘Py_FileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_HasFileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_FileSystemDefaultEncodeErrors’: Use *note + PyConfig.filesystem_errors: 3e5. instead. + + * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 3e6. instead. + (see *note Py_PreInitialize(): 3e7.) + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + ---------- 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<2>, Next: Pending removal in Python 3 16<2>, Prev: Pending Removal in Python 3 14<2>, Up: Deprecated C APIs + +1.1.10.7 Pending Removal in Python 3.15 +....................................... + + * The *note PyImport_ImportModuleNoBlock(): 3b9.: Use *note + PyImport_ImportModule(): 3ba. instead. + + * *note PyWeakref_GetObject(): 374. and *note PyWeakref_GET_OBJECT(): + 3bb.: Use *note PyWeakref_GetRef(): 373. instead. + + * *note Py_UNICODE: 3e9. type and the ‘Py_UNICODE_WIDE’ macro: Use + ‘wchar_t’ instead. + + * Python initialization functions: + + * *note PySys_ResetWarnOptions(): 3ab.: Clear *note + sys.warnoptions: 3ac. and ‘warnings.filters’ instead. + + * *note Py_GetExecPrefix(): 3ad.: Get *note + sys.base_exec_prefix: 3ea. and *note sys.exec_prefix: 3ae. + instead. + + * *note Py_GetPath(): 3af.: Get *note sys.path: 3b0. instead. + + * *note Py_GetPrefix(): 3b1.: Get *note sys.base_prefix: 3eb. + and *note sys.prefix: 3b2. instead. + + * *note Py_GetProgramFullPath(): 3b3.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetProgramName(): 3b5.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetPythonHome(): 3b6.: Get *note PyConfig.home: 3b7. + or the *note PYTHONHOME: 3b8. environment variable instead. + + +File: python.info, Node: Pending removal in Python 3 16<2>, Next: Pending Removal in Future Versions<2>, Prev: Pending Removal in Python 3 15<2>, Up: Deprecated C APIs + +1.1.10.8 Pending removal in Python 3.16 +....................................... + + * The bundled copy of ‘libmpdec’. + + +File: python.info, Node: Pending Removal in Future Versions<2>, Prev: Pending removal in Python 3 16<2>, Up: Deprecated C APIs + +1.1.10.9 Pending Removal in Future Versions +........................................... + +The following APIs are deprecated and will be removed, although there is +currently no date scheduled for their removal. + + * *note Py_TPFLAGS_HAVE_FINALIZE: 3ee.: Unneeded since Python 3.8. + + * *note PyErr_Fetch(): 3ef.: Use *note PyErr_GetRaisedException(): + 3f0. instead. + + * *note PyErr_NormalizeException(): 3f1.: Use *note + PyErr_GetRaisedException(): 3f0. instead. + + * *note PyErr_Restore(): 3f2.: Use *note PyErr_SetRaisedException(): + 3f3. instead. + + * *note PyModule_GetFilename(): 3f4.: Use *note + PyModule_GetFilenameObject(): 3f5. instead. + + * *note PyOS_AfterFork(): 3f6.: Use *note PyOS_AfterFork_Child(): + 3f7. instead. + + * *note PySlice_GetIndicesEx(): 3f8.: Use *note PySlice_Unpack(): + 3f9. and *note PySlice_AdjustIndices(): 3fa. instead. + + * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * *note PyUnicode_READY(): 3fd.: Unneeded since Python 3.12 + + * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 3fe. + instead. + + * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’ + instead. + + * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 3ff. + instead. + + * ‘PyDictObject.ma_version_tag’ member. + + * Thread Local Storage (TLS) API: + + * *note PyThread_create_key(): 400.: Use *note + PyThread_tss_alloc(): 401. instead. + + * *note PyThread_delete_key(): 402.: Use *note + PyThread_tss_free(): 403. instead. + + * *note PyThread_set_key_value(): 404.: Use *note + PyThread_tss_set(): 405. instead. + + * *note PyThread_get_key_value(): 406.: Use *note + PyThread_tss_get(): 407. instead. + + * *note PyThread_delete_key_value(): 408.: Use *note + PyThread_tss_delete(): 409. instead. + + * *note PyThread_ReInitTLS(): 40a.: Unneeded since Python 3.7. + + +File: python.info, Node: Build Changes, Next: Porting to Python 3 13, Prev: C API Changes, Up: What’s New In Python 3 13 + +1.1.11 Build Changes +-------------------- + + * ‘arm64-apple-ios’ and ‘arm64-apple-ios-simulator’ are both now PEP + 11(1) tier 3 platforms. (*note PEP 730: 165. 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: 165. 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: cf. + 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: 40d. + The bundled mimalloc has custom changes, see gh-113141(13) for + details. (Contributed by Dino Viehland in gh-109914(14).) + + * The ‘configure’ option *note -with-system-libmpdec: 40e. now + defaults to ‘yes’. The bundled copy of ‘libmpdec’ will be removed + in Python 3.16. + + * Python built with ‘configure’ *note -with-trace-refs: 390. (tracing + references) is now ABI compatible with the Python release build and + *note debug build: 1fb. (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: 391. (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.1.12 Porting to Python 3.13 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in the Python API:: +* Changes in the C API:: + + +File: python.info, Node: Changes in the Python API, Next: Changes in the C API, Up: Porting to Python 3 13 + +1.1.12.1 Changes in the Python API +.................................. + + * *note PEP 667: 142. introduces several changes to the semantics of + *note locals(): 141. and *note f_locals: 182.: + + * Calling *note locals(): 141. in an *note optimized scope: 17e. + 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(): 141. 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: 182. in an *note optimized + scope: 17e. 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: 410. now emits a *note FutureWarning: 411. + when used as a method. The behavior will change in future Python + versions. Wrap it in *note staticmethod(): 412. if you want to + preserve the old behavior. (Contributed by Serhiy Storchaka in + gh-121027(5).) + + * An *note OSError: 413. is now raised by *note getpass.getuser(): + 414. for any failure to retrieve a username, instead of *note + ImportError: 415. on non-Unix platforms or *note KeyError: 33f. on + Unix platforms where the password database is empty. + + * The value of the ‘mode’ attribute of *note gzip.GzipFile: 416. 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(): 417. is now ‘'rb'’ + instead of ‘'r'’. (Contributed by Serhiy Storchaka in + gh-115961(6).) + + * *note mailbox.Maildir: 418. now ignores files with a leading dot + (‘.’). (Contributed by Zackery Spytz in gh-65559(7).) + + * *note pathlib.Path.glob(): 22f. and *note rglob(): 230. 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: ed. 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: Changes in the C API, Prev: Changes in the Python API, Up: Porting to Python 3 13 + +1.1.12.2 Changes in the C API +............................. + + * ‘Python.h’ no longer includes the ‘’ standard header. It + was included for the ‘finite()’ function which is now provided by + the ‘’ 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: + ‘’, ‘’ and ‘’. If needed, they + should now be included explicitly. For example, ‘’ + provides the ‘clock()’ and ‘gmtime()’ functions, ‘’ + provides the ‘select()’ function, and ‘’ provides the + ‘futimes()’, ‘gettimeofday()’ and ‘setitimer()’ functions. + (Contributed by Victor Stinner in gh-108765(2).) + + * On Windows, ‘Python.h’ no longer includes the ‘’ 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 ‘’ 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: 41a. macro is defined, + ‘Py_BUILD_CORE’, ‘Py_BUILD_CORE_BUILTIN’ and ‘Py_BUILD_CORE_MODULE’ + macros are now undefined by ‘’. (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: 142. introduces several changes to frame-related + functions: + + * The effects of mutating the dictionary returned from *note + PyEval_GetLocals(): 350. in an *note optimized scope: 17e. + have changed. New dict entries added this way will now 'only' + be visible to subsequent *note PyEval_GetLocals(): 350. calls + in that frame, as *note PyFrame_GetLocals(): 41b, *note + locals(): 141, and *note FrameType.f_locals: 182. no longer + access the same underlying cached dictionary. Changes made to + entries for actual variable names and names added via the + write-through proxy interfaces will be overwritten on + subsequent calls to *note PyEval_GetLocals(): 350. 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(): 41b. in an *note optimized + scope: 17e. 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(): 41c.), or by calling the new *note + PyEval_GetFrameLocals(): 34f. 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(): + 41b. was first introduced. + + * ‘PyFrame_LocalsToFast()’ no longer has any effect. Calling + this function is redundant now that *note PyFrame_GetLocals(): + 41b. returns a write-through proxy for *note optimized scopes: + 17e. + + * Python 3.13 removed many private functions. Some of them can be + replaced using these alternatives: + + * ‘_PyDict_Pop()’: *note PyDict_Pop(): 33c. or *note + PyDict_PopString(): 33d.; + + * ‘_PyDict_GetItemWithError()’: *note PyDict_GetItemRef(): 335.; + + * ‘_PyErr_WriteUnraisableMsg()’: *note PyErr_FormatUnraisable(): + 349.; + + * ‘_PyEval_SetTrace()’: *note PyEval_SetTrace(): 41d. or *note + PyEval_SetTraceAllThreads(): 41e.; + + * ‘_PyList_Extend()’: *note PyList_Extend(): 358.; + + * ‘_PyLong_AsInt()’: *note PyLong_AsInt(): 35a.; + + * ‘_PyMem_RawStrdup()’: ‘strdup()’; + + * ‘_PyMem_Strdup()’: ‘strdup()’; + + * ‘_PyObject_ClearManagedDict()’: *note + PyObject_ClearManagedDict(): 365.; + + * ‘_PyObject_VisitManagedDict()’: *note + PyObject_VisitManagedDict(): 364.; + + * ‘_PyThreadState_UncheckedGet()’: *note + PyThreadState_GetUnchecked(): 36c.; + + * ‘_PyTime_AsSecondsDouble()’: *note PyTime_AsSecondsDouble(): + 32b.; + + * ‘_PyTime_GetMonotonicClock()’: *note PyTime_Monotonic(): 32c. + or *note PyTime_MonotonicRaw(): 32d.; + + * ‘_PyTime_GetPerfCounter()’: *note PyTime_PerfCounter(): 32e. + or *note PyTime_PerfCounterRaw(): 32f.; + + * ‘_PyTime_GetSystemClock()’: *note PyTime_Time(): 330. or *note + PyTime_TimeRaw(): 331.; + + * ‘_PyTime_MAX’: *note PyTime_MAX: 32a.; + + * ‘_PyTime_MIN’: *note PyTime_MIN: 329.; + + * ‘_PyTime_t’: *note PyTime_t: 328.; + + * ‘_Py_HashPointer()’: *note Py_HashPointer(): 363.; + + * ‘_Py_IsFinalizing()’: *note Py_IsFinalizing(): 355. + + 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, Next: Notable changes in 3 13 1, Prev: Porting to Python 3 13, Up: What’s New In Python 3 13 + +1.1.13 Regression Test Changes +------------------------------ + + * Python built with ‘configure’ *note -with-pydebug: 420. now + supports a *note -X presite=package.module: 176. 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: Notable changes in 3 13 1, Next: Notable changes in 3 13 4, Prev: Regression Test Changes, Up: What’s New In Python 3 13 + +1.1.14 Notable changes in 3.13.1 +-------------------------------- + +* Menu: + +* sys: sys<2>. + + +File: python.info, Node: sys<2>, Up: Notable changes in 3 13 1 + +1.1.14.1 sys +............ + + * The previously undocumented special function *note + sys.getobjects(): 423, which only exists in specialized builds of + Python, may now return objects from other interpreters than the one + it’s called in. + + +File: python.info, Node: Notable changes in 3 13 4, Prev: Notable changes in 3 13 1, Up: What’s New In Python 3 13 + +1.1.15 Notable changes in 3.13.4 +-------------------------------- + +* Menu: + +* os.path: os path<2>. +* tarfile:: + + +File: python.info, Node: os path<2>, Next: tarfile, Up: Notable changes in 3 13 4 + +1.1.15.1 os.path +................ + + * The 'strict' parameter to *note os.path.realpath(): 227. accepts a + new value, *note os.path.ALLOW_MISSING: 426. If used, errors other + than *note FileNotFoundError: 427. 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: tarfile, Prev: os path<2>, Up: Notable changes in 3 13 4 + +1.1.15.2 tarfile +................ + + * *note data_filter(): 429. now normalizes symbolic link targets in + order to avoid path traversal attacks.Add commentMore actions + (Contributed by Petr Viktorin in gh-127987(1) and CVE + 2025-4138(2).) + + * *note extractall(): 42a. 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(): 42b. and *note extractall(): 42a. 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: 42c. (Contributed by Petr Viktorin for CVE + 2025-4330(5) and CVE 2024-12718(6).) + + * *note extract(): 42b. and *note extractall(): 42a. no longer + extract rejected members when *note errorlevel(): 42d. 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: 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.2 What’s New In Python 3.12 +============================= + + +Editor: Adam Turner + +This article explains the new features in Python 3.12, compared to 3.11. +Python 3.12 was released on October 2, 2023. For full details, see the +*note changelog: 13c. + +See also +........ + +PEP 693(1) – Python 3.12 Release Schedule + +* Menu: + +* Summary – Release highlights:: +* New Features: New Features<3>. +* New Features Related to Type Hints:: +* Other Language Changes: Other Language Changes<2>. +* New Modules: New Modules<2>. +* Improved Modules: Improved Modules<2>. +* Optimizations: Optimizations<2>. +* CPython bytecode changes:: +* Demos and Tools:: +* Deprecated:: +* Removed:: +* Porting to Python 3.12: Porting to Python 3 12. +* Build Changes: Build Changes<2>. +* C API Changes: C API Changes<2>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0693/ + + +File: python.info, Node: Summary – Release highlights, Next: New Features<3>, Up: What’s New In Python 3 12 + +1.2.1 Summary – Release highlights +---------------------------------- + +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: a1. and *note +pathlib: a4. has seen a number of improvements, and several modules have +better performance. + +The language changes focus on usability, as *note f-strings: 431. have +had many limitations removed and ‘Did you mean …’ suggestions continue +to improve. The new *note type parameter syntax: 432. and *note type: +433. statement improve ergonomics for using *note generic types: 434. +and *note type aliases: 435. with static type checkers. + +This article doesn’t attempt to provide a complete specification of all +new features, but instead gives a convenient overview. For full +details, you should refer to the documentation, such as the *note +Library Reference: 144. and *note Language Reference: 145. If you want +to understand the complete implementation and design rationale for a +change, refer to the PEP for a particular new feature; but note that +PEPs usually are not kept up-to-date once a feature has been fully +implemented. + +__________________________________________________________________ + +New syntax features: + + * *note PEP 695: 432, type parameter syntax and the *note type: 433. + statement + +New grammar features: + + * *note PEP 701: 436, *note f-strings: 431. in the grammar + +Interpreter improvements: + + * *note PEP 684: 437, a unique per-interpreter *note GIL: 148. + + * *note PEP 669: 438, low impact monitoring + + * *note Improved 'Did you mean ...' suggestions: 439.for *note + NameError: 43a, *note ImportError: 415, and *note SyntaxError: 18d. + exceptions + +Python data model improvements: + + * *note PEP 688: 43b, using the *note buffer protocol: 393. from + Python + +Significant improvements in the standard library: + + * The *note pathlib.Path: 22b. class now supports subclassing + + * The *note os: a1. module received several improvements for Windows + support + + * A *note command-line interface: 43c. has been added to the *note + sqlite3: cf. module + + * *note isinstance(): 43d. checks against *note runtime-checkable + protocols: 43e. enjoy a speed up of between two and 20 times + + * The *note asyncio: a. package has had a number of performance + improvements, with some benchmarks showing a 75% speed up. + + * A *note command-line interface: 43f. has been added to the *note + uuid: 110. module + + * Due to the changes in *note PEP 701: 436, producing tokens via the + *note tokenize: fb. module is up to 64% faster. + +Security improvements: + + * Replace the builtin *note hashlib: 68. implementations of SHA1, + SHA3, SHA2-384, SHA2-512, and MD5 with formally verified code from + the HACL*(1) project. These builtin implementations remain as + fallbacks that are only used when OpenSSL does not provide them. + +C API improvements: + + * *note PEP 697: 440, unstable C API tier + + * *note PEP 683: 441, immortal objects + +CPython implementation improvements: + + * *note PEP 709: 442, comprehension inlining + + * *note CPython support: 18f. for the Linux ‘perf’ profiler + + * Implement stack overflow protection on supported platforms + +New typing features: + + * *note PEP 692: 443, using *note TypedDict: 162. to annotate *note + **kwargs: 444. + + * *note PEP 698: 445, *note typing.override(): 446. decorator + +Important deprecations, removals or restrictions: + + * PEP 623(2): Remove ‘wstr’ from Unicode objects in Python’s C API, + reducing the size of every *note str: 447. object by at least 8 + bytes. + + * 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): Do not pre-install ‘setuptools’ in virtual + environments created with *note venv: 111. This means that + ‘distutils’, ‘setuptools’, ‘pkg_resources’, and ‘easy_install’ will + no longer available by default; to access these run ‘pip install + setuptools’ in the *note activated: 448. virtual environment. + + * The ‘asynchat’, ‘asyncore’, and ‘imp’ modules have been removed, + along with several *note unittest.TestCase: 449. *note method + aliases: 44a.. + + ---------- 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: New Features<3>, Next: New Features Related to Type Hints, Prev: Summary – Release highlights, Up: What’s New In Python 3 12 + +1.2.2 New Features +------------------ + +* Menu: + +* PEP 695; Type Parameter Syntax: PEP 695 Type Parameter Syntax. +* PEP 701; Syntactic formalization of f-strings: PEP 701 Syntactic formalization of f-strings. +* PEP 684; A Per-Interpreter GIL: PEP 684 A Per-Interpreter GIL. +* PEP 669; Low impact monitoring for CPython: PEP 669 Low impact monitoring for CPython. +* PEP 688; Making the buffer protocol accessible in Python: PEP 688 Making the buffer protocol accessible in Python. +* PEP 709; Comprehension inlining: PEP 709 Comprehension inlining. +* Improved Error Messages:: + + +File: python.info, Node: PEP 695 Type Parameter Syntax, Next: PEP 701 Syntactic formalization of f-strings, Up: New Features<3> + +1.2.2.1 PEP 695: Type Parameter Syntax +...................................... + +Generic classes and functions under PEP 484(1) were declared using a +verbose syntax that left the scope of type parameters unclear and +required explicit declarations of variance. + +PEP 695(2) introduces a new, more compact and explicit way to create +*note generic classes: 44d. and *note functions: 44e.: + + def max[T](args: Iterable[T]) -> T: + ... + + class list[T]: + def __getitem__(self, index: int, /) -> T: + ... + + def append(self, element: T) -> None: + ... + +In addition, the PEP introduces a new way to declare *note type aliases: +44f. using the *note type: 433. statement, which creates an instance of +*note TypeAliasType: 450.: + + type Point = tuple[float, float] + +Type aliases can also be *note generic: 451.: + + type Point[T] = tuple[T, T] + +The new syntax allows declaring *note TypeVarTuple: 15f. and *note +ParamSpec: 15e. parameters, as well as *note TypeVar: 15d. parameters +with bounds or constraints: + + 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 + +The value of type aliases and the bound and constraints of type +variables created through this syntax are evaluated only on demand (see +*note lazy evaluation: 452.). This means type aliases are able to refer +to other types defined later in the file. + +Type parameters declared through a type parameter list are visible +within the scope of the declaration and any nested scopes, but not in +the outer scope. For example, they can be used in the type annotations +for the methods of a generic class or in the class body. However, they +cannot be used in the module scope after the class is defined. See +*note Type parameter lists: 2b5. for a detailed description of the +runtime semantics of type parameters. + +In order to support these scoping semantics, a new kind of scope is +introduced, the *note annotation scope: 188. Annotation scopes behave +for the most part like function scopes, but interact differently with +enclosing class scopes. In Python 3.13, *note annotations: 453. will +also be evaluated in annotation scopes. + +See PEP 695(3) for more details. + +(PEP written by Eric Traut. Implementation by Jelle Zijlstra, Eric +Traut, and others in 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 Syntactic formalization of f-strings, Next: PEP 684 A Per-Interpreter GIL, Prev: PEP 695 Type Parameter Syntax, Up: New Features<3> + +1.2.2.2 PEP 701: Syntactic formalization of f-strings +..................................................... + +PEP 701(1) lifts some restrictions on the usage of *note f-strings: 431. +Expression components inside f-strings can now be any valid Python +expression, including strings reusing the same quote as the containing +f-string, multi-line expressions, comments, backslashes, and unicode +escape sequences. Let’s cover these in detail: + + * Quote reuse: in Python 3.11, reusing the same quotes as the + enclosing f-string raises a *note SyntaxError: 18d, forcing the + user to either use other available quotes (like using double quotes + or triple quotes if the f-string uses single quotes). In Python + 3.12, you can now do things like this: + + >>> 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' + + Note that before this change there was no explicit limit in how + f-strings can be nested, but the fact that string quotes cannot be + reused inside the expression component of f-strings made it + impossible to nest f-strings arbitrarily. In fact, this is the + most nested f-string that could be written: + + >>> f"""{f'''{f'{f"{1+1}"}'}'''}""" + '2' + + As now f-strings can contain any valid Python expression inside + expression components, it is now possible to nest f-strings + arbitrarily: + + >>> f"{f"{f"{f"{f"{f"{1+1}"}"}"}"}"}" + '2' + + * Multi-line expressions and comments: In Python 3.11, f-string + expressions must be defined in a single line, even if the + expression within the f-string could normally span multiple lines + (like literal lists being defined over multiple lines), making them + harder to read. In Python 3.12 you can now define f-strings + spanning multiple lines, and add inline comments: + + >>> 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' + + * Backslashes and unicode characters: before Python 3.12 f-string + expressions couldn’t contain any ‘\’ character. This also affected + unicode *note escape sequences: 455. (such as ‘\N{snowman}’) as + these contain the ‘\N’ part that previously could not be part of + expression components of f-strings. Now, you can define + expressions like this: + + >>> 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 + +See PEP 701(2) for more details. + +As a positive side-effect of how this feature has been implemented (by +parsing f-strings with the PEG parser(3)), now error messages for +f-strings are more precise and include the exact location of the error. +For example, in Python 3.11, the following f-string raises a *note +SyntaxError: 18d.: + + >>> my_string = f"{x z y}" + f"{1 + 1}" + File "", line 1 + (x z y) + ^^^ + SyntaxError: f-string: invalid syntax. Perhaps you forgot a comma? + +but the error message doesn’t include the exact location of the error +within the line and also has the expression artificially surrounded by +parentheses. In Python 3.12, as f-strings are parsed with the PEG +parser, error messages can be more precise and show the entire line: + + >>> my_string = f"{x z y}" + f"{1 + 1}" + File "", line 1 + my_string = f"{x z y}" + f"{1 + 1}" + ^^^ + SyntaxError: invalid syntax. Perhaps you forgot a comma? + +(Contributed by Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou, +Cristián Maureira-Fredes and Marta Gómez in gh-102856(4). PEP written +by Pablo Galindo, Batuhan Taskaya, Lysandros Nikolaou and Marta Gómez). + + ---------- 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 A Per-Interpreter GIL, Next: PEP 669 Low impact monitoring for CPython, Prev: PEP 701 Syntactic formalization of f-strings, Up: New Features<3> + +1.2.2.3 PEP 684: A Per-Interpreter GIL +...................................... + +PEP 684(1) introduces a per-interpreter *note GIL: 148, so that +sub-interpreters may now be created with a unique GIL per interpreter. +This allows Python programs to take full advantage of multiple CPU +cores. This is currently only available through the C-API, though a +Python API is anticipated for 3.13(2). + +Use the new *note Py_NewInterpreterFromConfig(): 457. function to create +an interpreter with its own GIL: + + 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’. + +(Contributed by Eric Snow in gh-104210(3), etc.) + + ---------- 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 Low impact monitoring for CPython, Next: PEP 688 Making the buffer protocol accessible in Python, Prev: PEP 684 A Per-Interpreter GIL, Up: New Features<3> + +1.2.2.4 PEP 669: Low impact monitoring for CPython +.................................................. + +PEP 669(1) defines a new *note API: da. for profilers, debuggers, and +other tools to monitor events in CPython. It covers a wide range of +events, including calls, returns, lines, exceptions, jumps, and more. +This means that you only pay for what you use, providing support for +near-zero overhead debuggers and coverage tools. See *note +sys.monitoring: da. for details. + +(Contributed by Mark Shannon in 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 Making the buffer protocol accessible in Python, Next: PEP 709 Comprehension inlining, Prev: PEP 669 Low impact monitoring for CPython, Up: New Features<3> + +1.2.2.5 PEP 688: Making the buffer protocol accessible in Python +................................................................ + +PEP 688(1) introduces a way to use the *note buffer protocol: 393. from +Python code. Classes that implement the *note __buffer__(): 45a. method +are now usable as buffer types. + +The new *note collections.abc.Buffer: 2c6. ABC provides a standard way +to represent buffer objects, for example in type annotations. The new +*note inspect.BufferFlags: 45b. enum represents the flags that can be +used to customize buffer creation. (Contributed by Jelle Zijlstra in +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 Comprehension inlining, Next: Improved Error Messages, Prev: PEP 688 Making the buffer protocol accessible in Python, Up: New Features<3> + +1.2.2.6 PEP 709: Comprehension inlining +....................................... + +Dictionary, list, and set comprehensions are now inlined, rather than +creating a new single-use function object for each execution of the +comprehension. This speeds up execution of a comprehension by up to two +times. See PEP 709(1) for further details. + +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: d8. 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(): 141. 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: Improved Error Messages, Prev: PEP 709 Comprehension inlining, Up: New Features<3> + +1.2.2.7 Improved Error Messages +............................... + + * Modules from the standard library are now potentially suggested as + part of the error messages displayed by the interpreter when a + *note NameError: 43a. is raised to the top level. (Contributed by + Pablo Galindo in gh-98254(1).) + + >>> sys.version_info + Traceback (most recent call last): + File "", line 1, in + NameError: name 'sys' is not defined. Did you forget to import 'sys'? + + * Improve the error suggestion for *note NameError: 43a. exceptions + for instances. Now if a *note NameError: 43a. 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.’ 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 "", line 1 + somethin = blech + ^^^^^ + NameError: name 'blech' is not defined. Did you mean: 'self.blech'? + + * Improve the *note SyntaxError: 18d. 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 "", line 1 + import a.y.z from b.y.z + ^^^^^^^^^^^^^^^^^^^^^^^ + SyntaxError: Did you mean to use 'from ... import ...' instead? + + * *note ImportError: 415. exceptions raised from failed ‘from + import ’ statements now include suggestions for the + value of ‘’ based on the available names in ‘’. + (Contributed by Pablo Galindo in gh-91058(4).) + + >>> from collections import chainmap + Traceback (most recent call last): + File "", line 1, in + 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: New Features Related to Type Hints, Next: Other Language Changes<2>, Prev: New Features<3>, Up: What’s New In Python 3 12 + +1.2.3 New Features Related to Type Hints +---------------------------------------- + +This section covers major changes affecting type hints(1) and the *note +typing: 104. 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: New Features Related to Type Hints + +1.2.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]): ... + +See PEP 692(3) for more details. + +(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: New Features Related to Type Hints + +1.2.3.2 PEP 698: Override Decorator for Static Typing +..................................................... + +A new decorator *note typing.override(): 446. has been added to the +*note typing: 104. 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. + +Example: + + 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: Other Language Changes<2>, Next: New Modules<2>, Prev: New Features Related to Type Hints, Up: What’s New In Python 3 12 + +1.2.4 Other Language Changes +---------------------------- + + * The parser now raises *note SyntaxError: 18d. 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: 461, instead of *note + DeprecationWarning: 1a5. For example, ‘re.compile("\d+\.\d+")’ now + emits a *note SyntaxWarning: 461. (‘"\d"’ is an invalid escape + sequence, use raw strings for regular expression: + ‘re.compile(r"\d+\.\d+")’). In a future Python version, *note + SyntaxError: 18d. will eventually be raised, instead of *note + SyntaxWarning: 461. (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: 461, + instead of *note DeprecationWarning: 1a5. In a future Python + version they will be eventually a *note SyntaxError: 18d. + (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: 195. 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: 1b6. and raises one other exception, that exception + is no longer wrapped in an *note ExceptionGroup: 1b6. 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(): + 462. 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: 463. + and *note int: 259. (Contributed by Serhiy Storchaka in + gh-60203(10).) + + * *note memoryview: 464. now supports the half-float type (the “e” + format code). (Contributed by Donghee Na and Antoine Pitrou in + gh-90751(11).) + + * *note slice: 465. 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(): 466. 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(): 1a8. now raises *note SyntaxError: 18d. instead + of *note ValueError: 204. when parsing source code containing null + bytes. (Contributed by Pablo Galindo in gh-96670(14).) + + * The extraction methods in *note tarfile: de, and *note + shutil.unpack_archive(): 467, 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: 468. for details. In Python + 3.14, the default will switch to ‘'data'’. (Contributed by Petr + Viktorin in PEP 706(15).) + + * *note types.MappingProxyType: 469. 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: 18f. through the new + environment variable *note PYTHONPERFSUPPORT: 46a. and command-line + option *note -X perf: 176, as well as the new *note + sys.activate_stack_trampoline(): 46b, *note + sys.deactivate_stack_trampoline(): 46c, and *note + sys.is_stack_trampoline_active(): 46d. 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: New Modules<2>, Next: Improved Modules<2>, Prev: Other Language Changes<2>, Up: What’s New In Python 3 12 + +1.2.5 New Modules +----------------- + + * None. + + +File: python.info, Node: Improved Modules<2>, Next: Optimizations<2>, Prev: New Modules<2>, Up: What’s New In Python 3 12 + +1.2.6 Improved Modules +---------------------- + +* Menu: + +* array: array<2>. +* asyncio: asyncio<2>. +* calendar:: +* csv:: +* dis: dis<2>. +* fractions: fractions<2>. +* importlib.resources: importlib resources. +* inspect:: +* itertools: itertools<2>. +* math: math<2>. +* os: os<2>. +* os.path: os path<3>. +* pathlib: pathlib<3>. +* platform:: +* pdb: pdb<2>. +* random: random<2>. +* shutil: shutil<2>. +* sqlite3: sqlite3<2>. +* statistics: statistics<2>. +* sys: sys<3>. +* tempfile: tempfile<2>. +* threading:: +* tkinter: tkinter<2>. +* tokenize:: +* types: types<2>. +* typing: typing<3>. +* unicodedata: unicodedata<2>. +* unittest: unittest<2>. +* uuid:: + + +File: python.info, Node: array<2>, Next: asyncio<2>, Up: Improved Modules<2> + +1.2.6.1 array +............. + + * The *note array.array: 1a0. class now supports subscripting, making + it a *note generic type: 434. (Contributed by Jelle Zijlstra in + gh-98658(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/98658 + + +File: python.info, Node: asyncio<2>, Next: calendar, Prev: array<2>, Up: Improved Modules<2> + +1.2.6.2 asyncio +............... + + * The performance of writing to sockets in *note asyncio: a. has been + significantly improved. ‘asyncio’ now avoids unnecessary copying + when writing to sockets and uses *note sendmsg(): 472. if the + platform supports it. (Contributed by Kumar Aditya in + gh-91166(1).) + + * Add *note asyncio.eager_task_factory(): 473. and *note + asyncio.create_eager_task_factory(): 474. 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: a. uses *note asyncio.PidfdChildWatcher: + 475. by default if *note os.pidfd_open(): 476. is available and + functional instead of *note asyncio.ThreadedChildWatcher: 477. + (Contributed by Kumar Aditya in gh-98024(5).) + + * The event loop now uses the best available child watcher for each + platform (*note asyncio.PidfdChildWatcher: 475. if supported and + *note asyncio.ThreadedChildWatcher: 477. 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(): 478. to allow + specifying a custom event loop factory. (Contributed by Kumar + Aditya in gh-99388(7).) + + * Add C implementation of *note asyncio.current_task(): 479. for + 4x-6x speedup. (Contributed by Itamar Oren and Pranav Thulasiram + Bhat in gh-100344(8).) + + * *note asyncio.iscoroutine(): 47a. now returns ‘False’ for + generators as *note asyncio: a. does not support legacy + generator-based coroutines. (Contributed by Kumar Aditya in + gh-102748(9).) + + * *note asyncio.wait(): 47b. and *note asyncio.as_completed(): 1aa. + 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, Next: csv, Prev: asyncio<2>, Up: Improved Modules<2> + +1.2.6.3 calendar +................ + + * Add enums *note calendar.Month: 47d. and *note calendar.Day: 47e. + defining months of the year and days of the week. (Contributed by + Prince Roshan in gh-103636(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/103636 + + +File: python.info, Node: csv, Next: dis<2>, Prev: calendar, Up: Improved Modules<2> + +1.2.6.4 csv +........... + + * Add *note csv.QUOTE_NOTNULL: 480. and *note csv.QUOTE_STRINGS: 481. + flags to provide finer grained control of ‘None’ and empty strings + by *note reader: 482. and *note writer: 483. objects. + + +File: python.info, Node: dis<2>, Next: fractions<2>, Prev: csv, Up: Improved Modules<2> + +1.2.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: 38. module. *note HAVE_ARGUMENT: 485. is still relevant to + real opcodes, but it is not useful for pseudo instructions. Use + the new *note dis.hasarg: 2a0. collection instead. (Contributed by + Irit Katriel in gh-94216(1).) + + * Add the *note dis.hasexc: 486. 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<2>, Next: importlib resources, Prev: dis<2>, Up: Improved Modules<2> + +1.2.6.6 fractions +................. + + * Objects of type *note fractions.Fraction: 1e9. now support + float-style formatting. (Contributed by Mark Dickinson in + gh-100161(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/100161 + + +File: python.info, Node: importlib resources, Next: inspect, Prev: fractions<2>, Up: Improved Modules<2> + +1.2.6.7 importlib.resources +........................... + + * *note importlib.resources.as_file(): 489. now supports resource + directories. (Contributed by Jason R. Coombs in gh-97930(1).) + + * Rename first parameter of *note importlib.resources.files(): 48a. + 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, Next: itertools<2>, Prev: importlib resources, Up: Improved Modules<2> + +1.2.6.8 inspect +............... + + * Add *note inspect.markcoroutinefunction(): 48c. to mark sync + functions that return a *note coroutine: 48d. for use with *note + inspect.iscoroutinefunction(): 2e8. (Contributed by Carlton Gibson + in gh-99247(1).) + + * Add *note inspect.getasyncgenstate(): 48e. and *note + inspect.getasyncgenlocals(): 48f. for determining the current state + of asynchronous generators. (Contributed by Thomas Krennwallner in + gh-79940(2).) + + * The performance of *note inspect.getattr_static(): 490. 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<2>, Next: math<2>, Prev: inspect, Up: Improved Modules<2> + +1.2.6.9 itertools +................. + + * Add *note itertools.batched(): 203. 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<2>, Next: os<2>, Prev: itertools<2>, Up: Improved Modules<2> + +1.2.6.10 math +............. + + * Add *note math.sumprod(): 493. for computing a sum of products. + (Contributed by Raymond Hettinger in gh-100485(1).) + + * Extend *note math.nextafter(): 494. 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<2>, Next: os path<3>, Prev: math<2>, Up: Improved Modules<2> + +1.2.6.11 os +........... + + * Add *note os.PIDFD_NONBLOCK: 496. to open a file descriptor for a + process with *note os.pidfd_open(): 476. in non-blocking mode. + (Contributed by Kumar Aditya in gh-93312(1).) + + * *note os.DirEntry: 497. now includes an *note + os.DirEntry.is_junction(): 498. method to check if the entry is a + junction. (Contributed by Charles Machalow in gh-99547(2).) + + * Add *note os.listdrives(): 499, *note os.listvolumes(): 49a. and + *note os.listmounts(): 49b. functions on Windows for enumerating + drives, volumes and mount points. (Contributed by Steve Dower in + gh-102519(3).) + + * *note os.stat(): 49c. and *note os.lstat(): 49d. are now more + accurate on Windows. The ‘st_birthtime’ field will now be filled + with the creation time of the file, and ‘st_ctime’ is deprecated + but still contains the creation time (but in the future will return + the last metadata change, for consistency with other platforms). + ‘st_dev’ may be up to 64 bits and ‘st_ino’ up to 128 bits depending + on your file system, and ‘st_rdev’ is always set to zero rather + than incorrect values. Both functions may be significantly faster + on newer releases of Windows. (Contributed by Steve Dower in + gh-99726(4).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/93312 + + (2) https://github.com/python/cpython/issues/99547 + + (3) https://github.com/python/cpython/issues/102519 + + (4) https://github.com/python/cpython/issues/99726 + + +File: python.info, Node: os path<3>, Next: pathlib<3>, Prev: os<2>, Up: Improved Modules<2> + +1.2.6.12 os.path +................ + + * Add *note os.path.isjunction(): 49f. to check if a given path is a + junction. (Contributed by Charles Machalow in gh-99547(1).) + + * Add *note os.path.splitroot(): 4a0. 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<3>, Next: platform, Prev: os path<3>, Up: Improved Modules<2> + +1.2.6.13 pathlib +................ + + * Add support for subclassing *note pathlib.PurePath: 4a2. and *note + pathlib.Path: 22b, plus their Posix- and Windows-specific variants. + Subclasses may override the *note pathlib.PurePath.with_segments(): + 4a3. method to pass information between path instances. + + * Add *note pathlib.Path.walk(): 4a4. for walking the directory trees + and generating all file or directory names within them, similar to + *note os.walk(): 4a5. (Contributed by Stanislav Zmiev in + gh-90385(1).) + + * Add 'walk_up' optional parameter to *note + pathlib.PurePath.relative_to(): 2cd. to allow the insertion of ‘..’ + entries in the result; this behavior is more consistent with *note + os.path.relpath(): 4a6. (Contributed by Domenico Ragusa in + gh-84538(2).) + + * Add *note pathlib.Path.is_junction(): 4a7. as a proxy to *note + os.path.isjunction(): 49f. (Contributed by Charles Machalow in + gh-99547(3).) + + * Add 'case_sensitive' optional parameter to *note + pathlib.Path.glob(): 22f, *note pathlib.Path.rglob(): 230. and + *note pathlib.PurePath.match(): 4a8. 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: platform, Next: pdb<2>, Prev: pathlib<3>, Up: Improved Modules<2> + +1.2.6.14 platform +................. + + * 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<2>, Next: random<2>, Prev: platform, Up: Improved Modules<2> + +1.2.6.15 pdb +............ + + * Add convenience variables to hold values temporarily for debug + session and provide quick access to values like the current frame + or the return value. (Contributed by Tian Gao in gh-103693(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/103693 + + +File: python.info, Node: random<2>, Next: shutil<2>, Prev: pdb<2>, Up: Improved Modules<2> + +1.2.6.16 random +............... + + * Add *note random.binomialvariate(): 4ac. (Contributed by Raymond + Hettinger in gh-81620(1).) + + * Add a default of ‘lambd=1.0’ to *note random.expovariate(): 4ad. + (Contributed by Raymond Hettinger in gh-100234(2).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/81620 + + (2) https://github.com/python/cpython/issues/100234 + + +File: python.info, Node: shutil<2>, Next: sqlite3<2>, Prev: random<2>, Up: Improved Modules<2> + +1.2.6.17 shutil +............... + + * *note shutil.make_archive(): 4af. 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(): 2fb. 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(): 4b0. 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(): 4b0. 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(): 4b0. 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<2>, Next: statistics<2>, Prev: shutil<2>, Up: Improved Modules<2> + +1.2.6.18 sqlite3 +................ + + * Add a *note command-line interface: 43c. (Contributed by Erlend E. + Aasland in gh-77617(1).) + + * Add the *note sqlite3.Connection.autocommit: 4b2. attribute to + *note sqlite3.Connection: 247. and the 'autocommit' parameter to + *note sqlite3.connect(): 2aa. to control PEP 249(2)-compliant *note + transaction handling: 4b3. (Contributed by Erlend E. Aasland in + gh-83638(3).) + + * Add 'entrypoint' keyword-only parameter to *note + sqlite3.Connection.load_extension(): 4b4, for overriding the SQLite + extension entry point. (Contributed by Erlend E. Aasland in + gh-103015(4).) + + * Add *note sqlite3.Connection.getconfig(): 4b5. and *note + sqlite3.Connection.setconfig(): 4b6. to *note sqlite3.Connection: + 247. to make configuration changes to a database connection. + (Contributed by Erlend E. Aasland in gh-103489(5).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/77617 + + (2) https://peps.python.org/pep-0249/ + + (3) https://github.com/python/cpython/issues/83638 + + (4) https://github.com/python/cpython/issues/103015 + + (5) https://github.com/python/cpython/issues/103489 + + +File: python.info, Node: statistics<2>, Next: sys<3>, Prev: sqlite3<2>, Up: Improved Modules<2> + +1.2.6.19 statistics +................... + + * Extend *note statistics.correlation(): 4b8. to include as a + ‘ranked’ method for computing the Spearman correlation of ranked + data. (Contributed by Raymond Hettinger in gh-95861(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/95861 + + +File: python.info, Node: sys<3>, Next: tempfile<2>, Prev: statistics<2>, Up: Improved Modules<2> + +1.2.6.20 sys +............ + + * Add the *note sys.monitoring: da. namespace to expose the new *note + PEP 669: 438. monitoring API. (Contributed by Mark Shannon in + gh-103082(1).) + + * Add *note sys.activate_stack_trampoline(): 46b. and *note + sys.deactivate_stack_trampoline(): 46c. for activating and + deactivating stack profiler trampolines, and *note + sys.is_stack_trampoline_active(): 46d. 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: 4ba. 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: 4bb, *note sys.last_value: 4bc. + and *note sys.last_traceback: 4bd. (Contributed by Irit Katriel in + gh-102778(3).) + + * *note sys._current_exceptions(): 4be. 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(): 4bf. and *note + sys.getrecursionlimit(): 4c0. 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, Prev: sys<3>, Up: Improved Modules<2> + +1.2.6.21 tempfile +................. + + * The *note tempfile.NamedTemporaryFile: 4c2. function has a new + optional parameter 'delete_on_close' (Contributed by Evgeny Zorin + in gh-58451(1).) + + * *note tempfile.mkdtemp(): 221. 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, Next: tkinter<2>, Prev: tempfile<2>, Up: Improved Modules<2> + +1.2.6.22 threading +.................. + + * Add *note threading.settrace_all_threads(): 4c4. and *note + threading.setprofile_all_threads(): 4c5. 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<2>, Next: tokenize, Prev: threading, Up: Improved Modules<2> + +1.2.6.23 tkinter +................ + + * ‘tkinter.Canvas.coords()’ now flattens its arguments. It now + accepts not only coordinates as separate arguments (‘x1, y1, x2, + y2, ...’) and a sequence of coordinates (‘[x1, y1, x2, y2, ...]’), + but also coordinates grouped in pairs (‘(x1, y1), (x2, y2), ...’ + and ‘[(x1, y1), (x2, y2), ...]’), like ‘create_*()’ methods. + (Contributed by Serhiy Storchaka in gh-94473(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/94473 + + +File: python.info, Node: tokenize, Next: types<2>, Prev: tkinter<2>, Up: Improved Modules<2> + +1.2.6.24 tokenize +................. + + * The *note tokenize: fb. 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 Porting to Python 3.12: 4c8. for more + information on the changes to the *note tokenize: fb. module. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0701/ + + (2) https://github.com/python/cpython/issues/102856 + + +File: python.info, Node: types<2>, Next: typing<3>, Prev: tokenize, Up: Improved Modules<2> + +1.2.6.25 types +.............. + + * Add *note types.get_original_bases(): 4ca. to allow for further + introspection of *note User-defined generic types: 4cb. 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<3>, Next: unicodedata<2>, Prev: types<2>, Up: Improved Modules<2> + +1.2.6.26 typing +............... + + * *note isinstance(): 43d. checks against *note runtime-checkable + protocols: 43e. now use *note inspect.getattr_static(): 490. rather + than *note hasattr(): 4ce. to lookup whether attributes exist. + This means that descriptors and *note __getattr__(): 4cf. 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(): 43d. + 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(): 43d. checks against + *note runtime-checkable protocols: 43e. 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: 162. and *note typing.NamedTuple: 2b2. + 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(): 4d0. (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<2>, Next: unittest<2>, Prev: typing<3>, Up: Improved Modules<2> + +1.2.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<2>, Next: uuid, Prev: unicodedata<2>, Up: Improved Modules<2> + +1.2.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, Prev: unittest<2>, Up: Improved Modules<2> + +1.2.6.29 uuid +............. + + * Add a *note command-line interface: 43f. (Contributed by Adam + Chhina in gh-88597(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/88597 + + +File: python.info, Node: Optimizations<2>, Next: CPython bytecode changes, Prev: Improved Modules<2>, Up: What’s New In Python 3 12 + +1.2.7 Optimizations +------------------- + + * 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(): 2a5. and *note re.subn(): 2a6. 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: 1be. creation by deferring expensive + string formatting. (Contributed by Itamar Oren in gh-103793(6).) + + * The *note tokenize.tokenize(): 4d5. and *note + tokenize.generate_tokens(): 4d6. functions are up to 64% faster as + a side effect of the changes required to cover PEP 701(7) in the + *note tokenize: fb. module. (Contributed by Marta Gómez Macías and + Pablo Galindo in gh-102856(8).) + + * Speed up *note super(): 4d7. method calls and attribute loads via + the new *note LOAD_SUPER_ATTR: 4d8. 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 bytecode changes, Next: Demos and Tools, Prev: Optimizations<2>, Up: What’s New In Python 3 12 + +1.2.8 CPython bytecode changes +------------------------------ + + * Remove the ‘LOAD_METHOD’ instruction. It has been merged into + *note LOAD_ATTR: 4da. *note LOAD_ATTR: 4da. 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: 4db. and *note STORE_SLICE: 4dc. + instructions. (Contributed by Mark Shannon in gh-94163(4).) + + * Add the *note CALL_INTRINSIC_1: 4dd. instructions. (Contributed by + Mark Shannon in gh-99005(5).) + + * Add the *note CALL_INTRINSIC_2: 4de. instruction. (Contributed by + Irit Katriel in gh-101799(6).) + + * Add the *note CLEANUP_THROW: 4df. 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: 4e0. instruction as part of the + implementation of PEP 709(9). (Contributed by Carl Meyer in + gh-101441(10).) + + * Add the *note LOAD_FAST_CHECK: 4e1. instruction. (Contributed by + Dennis Sweeney in gh-93143(11).) + + * Add the *note LOAD_FROM_DICT_OR_DEREF: 4e2, *note + LOAD_FROM_DICT_OR_GLOBALS: 4e3, and *note LOAD_LOCALS: 4e4. opcodes + as part of the implementation of PEP 695(12). Remove the + ‘LOAD_CLASSDEREF’ opcode, which can be replaced with *note + LOAD_LOCALS: 4e4. plus *note LOAD_FROM_DICT_OR_DEREF: 4e2. + (Contributed by Jelle Zijlstra in gh-103764(13).) + + * Add the *note LOAD_SUPER_ATTR: 4d8. instruction. (Contributed by + Carl Meyer and Vladimir Matveev in gh-103497(14).) + + * Add the *note RETURN_CONST: 4e5. 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: Deprecated, Prev: CPython bytecode changes, Up: What’s New In Python 3 12 + +1.2.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: Deprecated, Next: Removed, Prev: Demos and Tools, Up: What’s New In Python 3 12 + +1.2.10 Deprecated +----------------- + + * *note argparse: 6.: 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: 8.: The following *note ast: 8. features have been + deprecated in documentation since Python 3.8, now cause a *note + DeprecationWarning: 1a5. 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: 2bb. instead. (Contributed by Serhiy + Storchaka in gh-90953(2).) + + * *note asyncio: a.: + + * The child watcher classes *note asyncio.MultiLoopChildWatcher: + 2bc, *note asyncio.FastChildWatcher: 2bd, *note + asyncio.AbstractChildWatcher: 2be. and *note + asyncio.SafeChildWatcher: 2bf. are deprecated and will be + removed in Python 3.14. (Contributed by Kumar Aditya in + gh-94597(3).) + + * *note asyncio.set_child_watcher(): 2c0, *note + asyncio.get_child_watcher(): 2c1, *note + asyncio.AbstractEventLoopPolicy.set_child_watcher(): 2c2. and + *note asyncio.AbstractEventLoopPolicy.get_child_watcher(): + 2c3. are deprecated and will be removed in Python 3.14. + (Contributed by Kumar Aditya in gh-94597(4).) + + * The *note get_event_loop(): 2c4. method of the default event + loop policy now emits a *note DeprecationWarning: 1a5. 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: 14.: ‘calendar.January’ and ‘calendar.February’ + constants are deprecated and replaced by *note calendar.JANUARY: + 2f3. and *note calendar.FEBRUARY: 2f4. (Contributed by Prince + Roshan in gh-103636(6).) + + * *note collections.abc: 1e.: Deprecated *note + collections.abc.ByteString: 2c5. Prefer ‘Sequence’ or *note + collections.abc.Buffer: 2c6. For use in typing, prefer a union, + like ‘bytes | bytearray’, or *note collections.abc.Buffer: 2c6. + (Contributed by Shantanu Jain in gh-91896(7).) + + * *note datetime: 30.: *note datetime.datetime: 1cc.’s *note + utcnow(): 2f6. and *note utcfromtimestamp(): 2f7. are deprecated + and will be removed in a future version. Instead, use + timezone-aware objects to represent datetimes in UTC: respectively, + call *note now(): 4e8. and *note fromtimestamp(): 4e9. with the + 'tz' parameter set to *note datetime.UTC: 4ea. (Contributed by + Paul Ganssle in gh-103857(8).) + + * *note email: 3b.: Deprecate the 'isdst' parameter in *note + email.utils.localtime(): 2c7. (Contributed by Alan Williams in + gh-72346(9).) + + * *note importlib.abc: 78.: 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: 7c. classes instead: + + * *note importlib.resources.abc.Traversable: 1f5. + + * *note importlib.resources.abc.TraversableResources: 2c8. + + (Contributed by Jason R. Coombs and Hugo van Kemenade in + gh-93963(10).) + + * *note itertools: 81.: 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(11).) + + * *note multiprocessing: 94.: In Python 3.14, the default *note + multiprocessing: 94. 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(12)). 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(): 2c9. or *note + set_start_method(): 2ca. APIs to explicitly specify when your code + 'requires' ‘'fork'’. See *note contexts and start methods: 2cb. + + * *note pkgutil: a9.: *note pkgutil.find_loader(): 2ce. and *note + pkgutil.get_loader(): 2cf. are deprecated and will be removed in + Python 3.14; use *note importlib.util.find_spec(): 2d0. instead. + (Contributed by Nikita Sobolev in gh-97850(13).) + + * *note pty: b1.: 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: 1a5. in 3.12. + Remove them in 3.14. (Contributed by Soumendra Ganguly and Gregory + P. Smith in gh-85984(14).) + + * *note os: a1.: + + * The ‘st_ctime’ fields return by *note os.stat(): 49c. and + *note os.lstat(): 49d. 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(15).) + + * On POSIX platforms, *note os.fork(): 197. can now raise a + *note DeprecationWarning: 1a5. when it can detect being called + from a multithreaded process. There has always been a + fundamental incompatibility with the POSIX platform when doing + so. Even if such code 'appeared' to work. We added the + warning to raise awareness as issues encountered by code doing + this are becoming more frequent. See the *note os.fork(): + 197. documentation for more details along with this discussion + on fork being incompatible with threads(16) for 'why' we’re + now surfacing this longstanding platform compatibility problem + to developers. + + When this warning appears due to usage of *note multiprocessing: + 94. or *note concurrent.futures: 21. the fix is to use a different + *note multiprocessing: 94. start method such as ‘"spawn"’ or + ‘"forkserver"’. + + * *note shutil: c5.: The 'onerror' argument of *note shutil.rmtree(): + 2fb. is deprecated; use 'onexc' instead. (Contributed by Irit + Katriel in gh-102828(17).) + + * *note sqlite3: cf.: + + * *note default adapters and converters: 4eb. are now + deprecated. Instead, use the *note Adapter and converter + recipes: 4ec. and tailor them to your needs. (Contributed by + Erlend E. Aasland in gh-90016(18).) + + * In *note execute(): 2d4, *note DeprecationWarning: 1a5. is now + emitted when *note named placeholders: 2d6. are used together + with parameters supplied as a *note sequence: 4ed. instead of + as a *note dict: 258. Starting from Python 3.14, using named + placeholders with parameters supplied as a sequence will raise + a *note ProgrammingError: 4ee. (Contributed by Erlend E. + Aasland in gh-101698(19).) + + * *note sys: d9.: The *note sys.last_type: 4bb, *note sys.last_value: + 4bc. and *note sys.last_traceback: 4bd. fields are deprecated. Use + *note sys.last_exc: 4ba. instead. (Contributed by Irit Katriel in + gh-102778(20).) + + * *note tarfile: de.: Extracting tar archives without specifying + 'filter' is deprecated until Python 3.14, when ‘'data'’ filter will + become the default. See *note Extraction filters: 468. for + details. + + * *note typing: 104.: + + * *note typing.Hashable: 4ef. and *note typing.Sized: 4f0, + aliases for *note collections.abc.Hashable: 4f1. and *note + collections.abc.Sized: 4f2. respectively, are deprecated. + (gh-94309(21).) + + * *note typing.ByteString: 2d7, deprecated since Python 3.9, now + causes a *note DeprecationWarning: 1a5. to be emitted when it + is used. (Contributed by Alex Waygood in gh-91896(22).) + + * *note xml.etree.ElementTree: 125.: The module now emits *note + DeprecationWarning: 1a5. when testing the truth value of an *note + xml.etree.ElementTree.Element: 30a. Before, the Python + implementation emitted *note FutureWarning: 411, and the C + implementation emitted nothing. (Contributed by Jacob Walls in + gh-83122(23).) + + * The 3-arg signatures (type, value, traceback) of *note coroutine + throw(): 4f3, *note generator throw(): 4f4. and *note async + generator throw(): 4f5. 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(24).) + + * *note DeprecationWarning: 1a5. is now raised when *note + __package__: 2db. on a module differs from *note __spec__.parent: + 2dc. (previously it was *note ImportWarning: 4f6.). (Contributed + by Brett Cannon in gh-65961(25).) + + * Setting *note __package__: 2db. or *note __cached__: 2d9. 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(26).) + + * 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(27).) + + * Accessing *note co_lnotab: 2e4. on code objects was deprecated in + Python 3.10 via PEP 626(28), but it only got a proper *note + DeprecationWarning: 1a5. in 3.12. May be removed in 3.15. + (Contributed by Nikita Sobolev in gh-101866(29).) + +* 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<3>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<3>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<3>. + + ---------- 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://github.com/python/cpython/issues/91896 + + (8) https://github.com/python/cpython/issues/103857 + + (9) https://github.com/python/cpython/issues/72346 + + (10) https://github.com/python/cpython/issues/93963 + + (11) https://github.com/python/cpython/issues/101588 + + (12) https://github.com/python/cpython/issues/84559 + + (13) https://github.com/python/cpython/issues/97850 + + (14) https://github.com/python/cpython/issues/85984 + + (15) https://github.com/python/cpython/issues/99726 + + (16) +https://discuss.python.org/t/concerns-regarding-deprecation-of-fork-with-alive-threads/33555 + + (17) https://github.com/python/cpython/issues/102828 + + (18) https://github.com/python/cpython/issues/90016 + + (19) https://github.com/python/cpython/issues/101698 + + (20) https://github.com/python/cpython/issues/102778 + + (21) https://github.com/python/cpython/issues/94309 + + (22) https://github.com/python/cpython/issues/91896 + + (23) https://github.com/python/cpython/issues/83122 + + (24) https://github.com/python/cpython/issues/89874 + + (25) https://github.com/python/cpython/issues/65961 + + (26) https://github.com/python/cpython/issues/65961 + + (27) https://github.com/python/cpython/issues/103487 + + (28) https://peps.python.org/pep-0626/ + + (29) 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: Deprecated + +1.2.10.1 Pending Removal in Python 3.13 +....................................... + +Modules (see PEP 594(1)): + + * ‘aifc’ + + * ‘audioop’ + + * ‘cgi’ + + * ‘cgitb’ + + * ‘chunk’ + + * ‘crypt’ + + * ‘imghdr’ + + * ‘mailcap’ + + * ‘msilib’ + + * ‘nis’ + + * ‘nntplib’ + + * ‘ossaudiodev’ + + * ‘pipes’ + + * ‘sndhdr’ + + * ‘spwd’ + + * ‘sunau’ + + * ‘telnetlib’ + + * ‘uu’ + + * ‘xdrlib’ + +Other modules: + + * ‘lib2to3’, and the ‘2to3’ program (gh-84540(2)) + +APIs: + + * ‘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: 166. descriptor chaining (gh-89519(11)) + + * *note importlib.resources: 7b. deprecated methods: + + * ‘contents()’ + + * ‘is_resource()’ + + * ‘open_binary()’ + + * ‘open_text()’ + + * ‘path()’ + + * ‘read_binary()’ + + * ‘read_text()’ + + Use *note importlib.resources.files(): 48a. instead. Refer to + importlib-resources: Migrating from Legacy(12) (gh-106531(13)) + + ---------- 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 + + (12) +https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy + + (13) https://github.com/python/cpython/issues/106531 + + +File: python.info, Node: Pending Removal in Python 3 14<3>, Next: Pending Removal in Python 3 15<3>, Prev: Pending Removal in Python 3 13, Up: Deprecated + +1.2.10.2 Pending Removal in Python 3.14 +....................................... + + * *note argparse: 6.: 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: 8.: The following features have been deprecated in + documentation since Python 3.8, now cause a *note + DeprecationWarning: 1a5. 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: 2bb. instead. (Contributed by Serhiy + Storchaka in gh-90953(2).) + + * *note asyncio: a.: + + * The child watcher classes *note MultiLoopChildWatcher: 2bc, + *note FastChildWatcher: 2bd, *note AbstractChildWatcher: 2be. + and *note SafeChildWatcher: 2bf. are deprecated and will be + removed in Python 3.14. (Contributed by Kumar Aditya in + gh-94597(3).) + + * *note asyncio.set_child_watcher(): 2c0, *note + asyncio.get_child_watcher(): 2c1, *note + asyncio.AbstractEventLoopPolicy.set_child_watcher(): 2c2. and + *note asyncio.AbstractEventLoopPolicy.get_child_watcher(): + 2c3. are deprecated and will be removed in Python 3.14. + (Contributed by Kumar Aditya in gh-94597(4).) + + * The *note get_event_loop(): 2c4. method of the default event + loop policy now emits a *note DeprecationWarning: 1a5. 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 collections.abc: 1e.: Deprecated *note ByteString: 2c5. + Prefer ‘Sequence’ or *note Buffer: 2c6. For use in typing, prefer + a union, like ‘bytes | bytearray’, or *note collections.abc.Buffer: + 2c6. (Contributed by Shantanu Jain in gh-91896(6).) + + * *note email: 3b.: Deprecated the 'isdst' parameter in *note + email.utils.localtime(): 2c7. (Contributed by Alan Williams in + gh-72346(7).) + + * *note importlib.abc: 78. deprecated classes: + + * ‘importlib.abc.ResourceReader’ + + * ‘importlib.abc.Traversable’ + + * ‘importlib.abc.TraversableResources’ + + Use *note importlib.resources.abc: 7c. classes instead: + + * *note importlib.resources.abc.Traversable: 1f5. + + * *note importlib.resources.abc.TraversableResources: 2c8. + + (Contributed by Jason R. Coombs and Hugo van Kemenade in + gh-93963(8).) + + * *note itertools: 81. 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(9).) + + * *note multiprocessing: 94.: 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(10)). 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(): 2c9. or *note set_start_method(): 2ca. APIs to + explicitly specify when your code 'requires' ‘'fork'’. See *note + Contexts and start methods: 2cb. + + * *note pathlib: a4.: *note is_relative_to(): 2cc. and *note + relative_to(): 2cd.: passing additional arguments is deprecated. + + * *note pkgutil: a9.: *note find_loader(): 2ce. and *note + get_loader(): 2cf. now raise *note DeprecationWarning: 1a5.; use + *note importlib.util.find_spec(): 2d0. instead. (Contributed by + Nikita Sobolev in gh-97850(11).) + + * *note pty: b1.: + + * ‘master_open()’: use *note pty.openpty(): 2d1. + + * ‘slave_open()’: use *note pty.openpty(): 2d1. + + * *note sqlite3: cf.: + + * *note version: 2d2. and *note version_info: 2d3. + + * *note execute(): 2d4. and *note executemany(): 2d5. if *note + named placeholders: 2d6. are used and 'parameters' is a + sequence instead of a *note dict: 258. + + * *note typing: 104.: *note ByteString: 2d7, deprecated since Python + 3.9, now causes a *note DeprecationWarning: 1a5. to be emitted when + it is used. + + * *note urllib: 108.: ‘urllib.parse.Quoter’ is deprecated: it was not + intended to be a public API. (Contributed by Gregory P. Smith in + gh-88168(12).) + + ---------- 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/91896 + + (7) https://github.com/python/cpython/issues/72346 + + (8) https://github.com/python/cpython/issues/93963 + + (9) https://github.com/python/cpython/issues/101588 + + (10) https://github.com/python/cpython/issues/84559 + + (11) https://github.com/python/cpython/issues/97850 + + (12) https://github.com/python/cpython/issues/88168 + + +File: python.info, Node: Pending Removal in Python 3 15<3>, Next: Pending removal in Python 3 16<3>, Prev: Pending Removal in Python 3 14<3>, Up: Deprecated + +1.2.10.3 Pending Removal in Python 3.15 +....................................... + + * The import system: + + * Setting *note __cached__: 2d9. on a module while failing to + set *note __spec__.cached: 2da. 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__: 2db. on a module while failing to + set *note __spec__.parent: 2dc. 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: 2a.: + + * The undocumented ‘ctypes.SetPointerType()’ function has been + deprecated since Python 3.13. + + * *note http.server: 72.: + + * The obsolete and rarely used *note CGIHTTPRequestHandler: 2a3. + 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: 77.: + + * ‘load_module()’ method: use ‘exec_module()’ instead. + + * *note locale: 86.: + + * The *note getdefaultlocale(): 2dd. function has been + deprecated since Python 3.11. Its removal was originally + planned for Python 3.13 (gh-90817(3)), but has been postponed + to Python 3.15. Use *note getlocale(): 2de, *note + setlocale(): 2df, and *note getencoding(): 2e0. instead. + (Contributed by Hugo van Kemenade in gh-111187(4).) + + * *note pathlib: a4.: + + * *note PurePath.is_reserved(): 2a8. has been deprecated since + Python 3.13. Use *note os.path.isreserved(): 225. to detect + reserved paths on Windows. + + * *note platform: aa.: + + * *note java_ver(): 2a9. 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: db.: + + * The 'check_home' argument of *note + sysconfig.is_python_build(): 2e1. has been deprecated since + Python 3.12. + + * *note threading: ed.: + + * *note RLock(): 2e2. 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: 103.: + + * *note types.CodeType: 2e3.: Accessing *note co_lnotab: 2e4. + was deprecated in PEP 626(5) since 3.10 and was planned to be + removed in 3.12, but it only got a proper *note + DeprecationWarning: 1a5. in 3.12. May be removed in 3.15. + (Contributed by Nikita Sobolev in gh-101866(6).) + + * *note typing: 104.: + + * The undocumented keyword argument syntax for creating *note + NamedTuple: 2b2. classes (e.g. ‘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: 162.s, + failing to pass a value to the 'fields' parameter (‘TD = + TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD", + None)’) has been deprecated since Python 3.13. Use ‘class + TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a + TypedDict with zero field. + + * The *note typing.no_type_check_decorator(): 2b3. decorator + function has been deprecated since Python 3.13. After eight + years in the *note typing: 104. module, it has yet to be + supported by any major type checker. + + * *note wave: 113.: + + * The *note getmark(): 2b6, ‘setmark()’, and *note getmarkers(): + 2b7. methods of the *note Wave_read: 2b8. and *note + Wave_write: 2b9. classes have been deprecated since Python + 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/97879 + + (2) https://github.com/python/cpython/issues/97879 + + (3) https://github.com/python/cpython/issues/90817 + + (4) https://github.com/python/cpython/issues/111187 + + (5) https://peps.python.org/pep-0626/ + + (6) https://github.com/python/cpython/issues/101866 + + +File: python.info, Node: Pending removal in Python 3 16<3>, Next: Pending Removal in Future Versions<3>, Prev: Pending Removal in Python 3 15<3>, Up: Deprecated + +1.2.10.4 Pending removal in Python 3.16 +....................................... + + * The import system: + + * Setting *note __loader__: 2e6. on a module while failing to + set *note __spec__.loader: 2e7. 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: 7.: + + * 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: 29d.) for + Unicode characters instead. + + * *note asyncio: a.: + + * ‘asyncio.iscoroutinefunction()’ is deprecated and will be + removed in Python 3.16, use *note + inspect.iscoroutinefunction(): 2e8. instead. (Contributed by + Jiahao Li and Kumar Aditya in gh-122875(1).) + + * *note builtins: 12.: + + * 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 shutil: c5.: + + * 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: 195. + + * *note symtable: d8.: + + * The *note Class.get_methods: 2e9. method has been deprecated + since Python 3.14. + + * *note sys: d9.: + + * The *note _enablelegacywindowsfsencoding(): 2b0. function has + been deprecated since Python 3.13. Use the *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. environment variable + instead. + + * *note tarfile: de.: + + * The undocumented and unused ‘TarFile.tarfile’ attribute has + been deprecated since Python 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/122875 + + +File: python.info, Node: Pending Removal in Future Versions<3>, Prev: Pending removal in Python 3 16<3>, Up: Deprecated + +1.2.10.5 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: 6.: Nesting argument groups and nesting mutually + exclusive groups are deprecated. + + * *note builtins: 12.: + + * ‘bool(NotImplemented)’. + + * 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: + 2eb, *note else: 18c, *note for: 2ec, *note if: 2ed, *note in: + 2ee, *note is: 2ef. and *note or: 2f0. 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: 259. + + * Support for ‘__float__()’ method returning a strict subclass + of *note float: 2f1.: these methods will be required to return + an instance of *note float: 2f1. + + * Support for ‘__complex__()’ method returning a strict subclass + of *note complex: 2f2.: these methods will be required to + return an instance of *note complex: 2f2. + + * Delegation of ‘int()’ to ‘__trunc__()’ method. + + * Passing a complex number as the 'real' or 'imag' argument in + the *note complex(): 2f2. constructor is now deprecated; it + should only be passed as a single positional argument. + (Contributed by Serhiy Storchaka in gh-109218(2).) + + * *note calendar: 14.: ‘calendar.January’ and ‘calendar.February’ + constants are deprecated and replaced by *note calendar.JANUARY: + 2f3. and *note calendar.FEBRUARY: 2f4. (Contributed by Prince + Roshan in gh-103636(3).) + + * *note codeobject.co_lnotab: 2e4.: use the *note + codeobject.co_lines(): 2f5. method instead. + + * *note datetime: 30.: + + * *note utcnow(): 2f6.: use + ‘datetime.datetime.now(tz=datetime.UTC)’. + + * *note utcfromtimestamp(): 2f7.: use + ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’. + + * *note gettext: 63.: Plural value must be an integer. + + * *note importlib: 77.: + + * *note cache_from_source(): 2f8. 'debug_override' parameter is + deprecated: use the 'optimization' parameter instead. + + * *note importlib.metadata: 7a.: + + * ‘EntryPoints’ tuple interface. + + * Implicit ‘None’ on return values. + + * *note logging: 87.: the ‘warn()’ method has been deprecated since + Python 3.3, use *note warning(): 2f9. instead. + + * *note mailbox: 8b.: Use of StringIO input and text mode is + deprecated, use BytesIO and binary mode instead. + + * *note os: a1.: Calling *note os.register_at_fork(): 2fa. in + multi-threaded process. + + * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter + is deprecated, use an exception instance. + + * *note re: b9.: 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(4).) + + * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules. + + * *note shutil: c5.: *note rmtree(): 2fb.’s 'onerror' parameter is + deprecated in Python 3.12; use the 'onexc' parameter instead. + + * *note ssl: d0. options and protocols: + + * *note ssl.SSLContext: 296. without protocol argument is + deprecated. + + * *note ssl.SSLContext: 296.: *note set_npn_protocols(): 2fc. + 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: ed. methods: + + * ‘threading.Condition.notifyAll()’: use *note notify_all(): + 2fd. + + * ‘threading.Event.isSet()’: use *note is_set(): 2fe. + + * ‘threading.Thread.isDaemon()’, *note + threading.Thread.setDaemon(): 2ff.: use *note + threading.Thread.daemon: 300. attribute. + + * ‘threading.Thread.getName()’, *note + threading.Thread.setName(): 301.: use *note + threading.Thread.name: 302. attribute. + + * ‘threading.currentThread()’: use *note + threading.current_thread(): 303. + + * ‘threading.activeCount()’: use *note threading.active_count(): + 304. + + * *note typing.Text: 305. (gh-92332(5)). + + * *note unittest.IsolatedAsyncioTestCase: 306.: it is deprecated to + return a value that is not ‘None’ from a test case. + + * *note urllib.parse: 10a. deprecated functions: *note urlparse(): + 307. instead + + * ‘splitattr()’ + + * ‘splithost()’ + + * ‘splitnport()’ + + * ‘splitpasswd()’ + + * ‘splitport()’ + + * ‘splitquery()’ + + * ‘splittag()’ + + * ‘splittype()’ + + * ‘splituser()’ + + * ‘splitvalue()’ + + * ‘to_bytes()’ + + * *note urllib.request: 10b.: *note URLopener: 308. and *note + FancyURLopener: 309. style of invoking requests is deprecated. Use + newer *note urlopen(): 295. functions and methods. + + * *note wsgiref: 118.: ‘SimpleHandler.stdout.write()’ should not do + partial writes. + + * *note xml.etree.ElementTree: 125.: Testing the truth value of an + *note Element: 30a. is deprecated. In a future release it will + always return ‘True’. Prefer explicit ‘len(elem)’ or ‘elem is not + None’ tests instead. + + * *note zipimport.zipimporter.load_module(): 30b. is deprecated: use + *note exec_module(): 30c. 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/91760 + + (5) https://github.com/python/cpython/issues/92332 + + +File: python.info, Node: Removed, Next: Porting to Python 3 12, Prev: Deprecated, Up: What’s New In Python 3 12 + +1.2.11 Removed +-------------- + +* Menu: + +* asynchat and asyncore:: +* configparser: configparser<3>. +* distutils:: +* ensurepip:: +* enum: enum<2>. +* ftplib:: +* gzip:: +* hashlib:: +* importlib: importlib<2>. +* imp:: +* io: io<2>. +* locale: locale<2>. +* smtpd:: +* sqlite3: sqlite3<3>. +* ssl: ssl<2>. +* unittest: unittest<3>. +* webbrowser: webbrowser<2>. +* xml.etree.ElementTree: xml etree ElementTree. +* zipimport: zipimport<2>. +* Others:: + + +File: python.info, Node: asynchat and asyncore, Next: configparser<3>, Up: Removed + +1.2.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: a. 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<3>, Next: distutils, Prev: asynchat and asyncore, Up: Removed + +1.2.11.2 configparser +..................... + + * Several names deprecated in the *note configparser: 22. way back in + 3.2 have been removed per gh-89336(1): + + * *note configparser.ParsingError: 500. no longer has a + ‘filename’ attribute or argument. Use the ‘source’ attribute + and argument instead. + + * *note configparser: 22. no longer has a ‘SafeConfigParser’ + class. Use the shorter *note ConfigParser: 1c8. name instead. + + * *note configparser.ConfigParser: 1c8. no longer has a ‘readfp’ + method. Use *note read_file(): 501. instead. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/89336 + + +File: python.info, Node: distutils, Next: ensurepip, Prev: configparser<3>, Up: Removed + +1.2.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: Removed + +1.2.11.4 ensurepip +.................. + + * Remove the bundled setuptools wheel from *note ensurepip: 55, and + stop installing setuptools in environments created by *note venv: + 111. + + ‘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: Removed + +1.2.11.5 enum +............. + + * Remove *note enum: 56.’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: Removed + +1.2.11.6 ftplib +............... + + * Remove *note ftplib: 5e.’s ‘FTP_TLS.ssl_version’ class attribute: + use the 'context' parameter instead. (Contributed by Victor + Stinner in gh-94172(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/94172 + + +File: python.info, Node: gzip, Next: hashlib, Prev: ftplib, Up: Removed + +1.2.11.7 gzip +............. + + * Remove the ‘filename’ attribute of *note gzip: 67.’s *note + gzip.GzipFile: 416, deprecated since Python 2.6, use the *note + name: 508. attribute instead. In write mode, the ‘filename’ + attribute added ‘'.gz'’ file extension if it was not present. + (Contributed by Victor Stinner in gh-94196(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/94196 + + +File: python.info, Node: hashlib, Next: importlib<2>, Prev: gzip, Up: Removed + +1.2.11.8 hashlib +................ + + * Remove the pure Python implementation of *note hashlib: 68.’s *note + hashlib.pbkdf2_hmac(): 50a, deprecated in Python 3.10. Python 3.10 + and newer requires OpenSSL 1.1.1 ( PEP 644(1)): this OpenSSL + version provides a C implementation of *note pbkdf2_hmac(): 50a. + which is faster. (Contributed by Victor Stinner in gh-94199(2).) + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0644/ + + (2) https://github.com/python/cpython/issues/94199 + + +File: python.info, Node: importlib<2>, Next: imp, Prev: hashlib, Up: Removed + +1.2.11.9 importlib +.................. + + * Many previously deprecated cleanups in *note importlib: 77. 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<2>, Prev: importlib<2>, Up: Removed + +1.2.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’ Insert ‘None’ into ‘sys.path_importer_cache’ + + + ‘imp.cache_from_source()’ *note importlib.util.cache_from_source(): 2f8. + + + ‘imp.find_module()’ *note importlib.util.find_spec(): 2d0. + + + ‘imp.get_magic()’ *note importlib.util.MAGIC_NUMBER: 50e. + + + ‘imp.get_suffixes()’ *note importlib.machinery.SOURCE_SUFFIXES: 50f, *note importlib.machinery.EXTENSION_SUFFIXES: 510, and + *note importlib.machinery.BYTECODE_SUFFIXES: 511. + + + ‘imp.get_tag()’ *note sys.implementation.cache_tag: 512. + + + ‘imp.load_module()’ *note importlib.import_module(): 513. + + + ‘imp.new_module(name)’ ‘types.ModuleType(name)’ + + + ‘imp.reload()’ *note importlib.reload(): 514. + + + ‘imp.source_from_cache()’ *note importlib.util.source_from_cache(): 515. + + + ‘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: + + * Undocumented functions: + + * ‘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<2>, Next: locale<2>, Prev: imp, Up: Removed + +1.2.11.11 io +............ + + * Remove *note io: 7f.’s ‘io.OpenWrapper’ and ‘_pyio.OpenWrapper’, + deprecated in Python 3.10: just use *note open(): 517. instead. + The *note open(): 517. (*note io.open(): 518.) function is a + built-in function. Since Python 3.10, ‘_pyio.open()’ is also a + static method. (Contributed by Victor Stinner in gh-94169(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/94169 + + +File: python.info, Node: locale<2>, Next: smtpd, Prev: io<2>, Up: Removed + +1.2.11.12 locale +................ + + * Remove *note locale: 86.’s ‘locale.format()’ function, deprecated + in Python 3.7: use *note locale.format_string(): 51a. 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<3>, Prev: locale<2>, Up: Removed + +1.2.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: a.-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<3>, Next: ssl<2>, Prev: smtpd, Up: Removed + +1.2.11.14 sqlite3 +................. + + * The following undocumented *note sqlite3: cf. 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: 447. 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<2>, Next: unittest<3>, Prev: sqlite3<3>, Up: Removed + +1.2.11.15 ssl +............. + + * Remove *note ssl: d0.’s ‘ssl.RAND_pseudo_bytes()’ function, + deprecated in Python 3.6: use *note os.urandom(): 51e. or *note + ssl.RAND_bytes(): 51f. 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: 296. object and call its + *note ssl.SSLContext.wrap_socket: 520. 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<3>, Next: webbrowser<2>, Prev: ssl<2>, Up: Removed + +1.2.11.16 unittest +.................. + + * Remove many long-deprecated *note unittest: 106. features: + + * A number of *note TestCase: 449. method aliases: + + Deprecated alias Method Name Deprecated in + + ----------------------------------------------------------------------------------------- + + ‘failUnless’ *note assertTrue(): 522. 3.1 + + + ‘failIf’ *note assertFalse(): 523. 3.1 + + + ‘failUnlessEqual’ *note assertEqual(): 524. 3.1 + + + ‘failIfEqual’ *note assertNotEqual(): 525. 3.1 + + + ‘failUnlessAlmostEqual’ *note assertAlmostEqual(): 526. 3.1 + + + ‘failIfAlmostEqual’ *note assertNotAlmostEqual(): 527. 3.1 + + + ‘failUnlessRaises’ *note assertRaises(): 528. 3.1 + + + ‘assert_’ *note assertTrue(): 522. 3.2 + + + ‘assertEquals’ *note assertEqual(): 524. 3.2 + + + ‘assertNotEquals’ *note assertNotEqual(): 525. 3.2 + + + ‘assertAlmostEquals’ *note assertAlmostEqual(): 526. 3.2 + + + ‘assertNotAlmostEquals’ *note assertNotAlmostEqual(): 527. 3.2 + + + ‘assertRegexpMatches’ *note assertRegex(): 529. 3.2 + + + ‘assertRaisesRegexp’ *note assertRaisesRegex(): 52a. 3.2 + + + ‘assertNotRegexpMatches’ *note assertNotRegex(): 52b. 3.5 + + + You can use ‘https://github.com/isidentical/teyit’ to + automatically modernise your unit tests. + + * Undocumented and broken *note TestCase: 449. method + ‘assertDictContainsSubset’ (deprecated in Python 3.2). + + * Undocumented *note TestLoader.loadTestsFromModule: 291. + parameter 'use_load_tests' (deprecated and ignored since + Python 3.5). + + * An alias of the *note TextTestResult: 52c. 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<2>, Next: xml etree ElementTree, Prev: unittest<3>, Up: Removed + +1.2.11.17 webbrowser +.................... + + * Remove support for obsolete browsers from *note webbrowser: 115. + The removed browsers include: Grail, Mosaic, Netscape, Galeon, + Skipstone, Iceape, Firebird, and Firefox versions 35 and below + (gh-102871(1)). + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/102871 + + +File: python.info, Node: xml etree ElementTree, Next: zipimport<2>, Prev: webbrowser<2>, Up: Removed + +1.2.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(): 52f. function instead. The C implementation of *note + xml.etree.ElementTree: 125. has no ‘copy()’ method, only a + ‘__copy__()’ method. (Contributed by Victor Stinner in + gh-94383(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/94383 + + +File: python.info, Node: zipimport<2>, Next: Others, Prev: xml etree ElementTree, Up: Removed + +1.2.11.19 zipimport +................... + + * Remove *note zipimport: 132.’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: Others, Prev: zipimport<2>, Up: Removed + +1.2.11.20 Others +................ + + * 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: 5e, *note imaplib: 74, *note poplib: ac. and *note smtplib: + ca. modules, and the 'key_file', 'cert_file' and 'check_hostname' + parameters from the *note http.client: 6f. module, all deprecated + since Python 3.6. Use the 'context' parameter ('ssl_context' in + *note imaplib: 74.) 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: 2a. 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: Porting to Python 3 12, Next: Build Changes<2>, Prev: Removed, Up: What’s New In Python 3 12 + +1.2.12 Porting to Python 3.12 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in the Python API: Changes in the Python API<2>. + + +File: python.info, Node: Changes in the Python API<2>, Up: Porting to Python 3 12 + +1.2.12.1 Changes in the 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: 534. Also, the + exception raised for non-integer values such as ‘randrange(10.5)’ + or ‘randrange('10')’ has been changed from *note ValueError: 204. + to *note TypeError: 534. 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: 535. 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): 536.) to *note filesystem + encoding and error handler: 537. 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: + a.-based aiosmtpd(3) PyPI module. + + * *note shlex.split(): 538.: Passing ‘None’ for 's' argument now + raises an exception, rather than reading *note sys.stdin: 539. The + feature was deprecated in Python 3.9. (Contributed by Victor + Stinner in gh-94352(4).) + + * The *note os: a1. module no longer accepts bytes-like paths, like + *note bytearray: 53a. and *note memoryview: 464. types: only the + exact *note bytes: 1c2. type is accepted for bytes strings. + (Contributed by Victor Stinner in gh-98393(5).) + + * *note syslog.openlog(): 53b. and *note syslog.closelog(): 53c. now + fail if used in subinterpreters. *note syslog.syslog(): 53d. may + still be used in subinterpreters, but now only if *note + syslog.openlog(): 53b. 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: dc. 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(): 53e. + 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(): 4be. 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: de. or *note + shutil.unpack_archive(): 467, pass the 'filter' argument to limit + features that may be surprising or dangerous. See *note Extraction + filters: 468. for details. + + * The output of the *note tokenize.tokenize(): 4d5. and *note + tokenize.generate_tokens(): 4d6. 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: 53f. as incomplete multiline strings do. + + * Some incomplete or invalid Python code now raises *note + tokenize.TokenError: 53f. 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: 540. + + * The *note threading: ed. 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 Changes<2>, Prev: Porting to Python 3 12, Up: What’s New In Python 3 12 + +1.2.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: 20. 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 Changes<2>, Prev: Build Changes<2>, Up: What’s New In Python 3 12 + +1.2.14 C API Changes +-------------------- + +* Menu: + +* New Features: New Features<4>. +* Porting to Python 3.12: Porting to Python 3 12<2>. +* Deprecated: Deprecated<2>. +* Removed: Removed<2>. + + +File: python.info, Node: New Features<4>, Next: Porting to Python 3 12<2>, Up: C API Changes<2> + +1.2.14.1 New Features +..................... + + * PEP 697(1): Introduce the *note Unstable C API tier: 544, 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: 545. can be zero or negative to + specify inheriting or extending the base class size. + + - *note PyObject_GetTypeData(): 546. and *note + PyType_GetTypeDataSize(): 547. added to allow access to + subclass-specific instance data. + + - *note Py_TPFLAGS_ITEMS_AT_END: 548. and *note + PyObject_GetItemData(): 549. added to allow safely extending + certain variable-sized types, including *note PyType_Type: + 54a. + + - *note Py_RELATIVE_OFFSET: 54b. added to allow defining *note + members: 54c. in terms of a subclass-specific struct. + + (Contributed by Petr Viktorin in gh-103509(5).) + + * Add the new *note limited C API: 391. function *note + PyType_FromMetaclass(): 54d, which generalizes the existing *note + PyType_FromModuleAndSpec(): 54e. 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: 54f. was added to the *note Limited API: 550.: + + * *note Py_TPFLAGS_HAVE_VECTORCALL: 551. + + * *note PyVectorcall_NARGS(): 552. + + * *note PyVectorcall_Call(): 553. + + * *note vectorcallfunc: 554. + + The *note Py_TPFLAGS_HAVE_VECTORCALL: 551. flag is now removed from + a class when the class’s *note __call__(): 555. method is + reassigned. This makes vectorcall safe to use with mutable types + (i.e. heap types without the immutable flag, *note + Py_TPFLAGS_IMMUTABLETYPE: 3be.). Mutable types that do not + override *note tp_call: 556. now inherit the + ‘Py_TPFLAGS_HAVE_VECTORCALL’ flag. (Contributed by Petr Viktorin + in gh-93274(7).) + + The *note Py_TPFLAGS_MANAGED_DICT: 366. and *note + Py_TPFLAGS_MANAGED_WEAKREF: 557. flags have been added. This + allows extensions classes to support object *note __dict__: 558. + and weakrefs with less bookkeeping, using less memory and with + faster access. + + * API for performing calls using *note the vectorcall protocol: 54f. + was added to the *note Limited API: 550.: + + * *note PyObject_Vectorcall(): 559. + + * *note PyObject_VectorcallMethod(): 55a. + + * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 55b. + + This means that both the incoming and outgoing ends of the vector + call protocol are now available in the *note Limited API: 550. + (Contributed by Wenzel Jakob in gh-98586(8).) + + * Add two new public functions, *note PyEval_SetProfileAllThreads(): + 55c. and *note PyEval_SetTraceAllThreads(): 41e, 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(): 55d. to the C + API which sets the vectorcall field of a given *note + PyFunctionObject: 55e. (Contributed by Andrew Frost in + gh-92257(10).) + + * The C API now permits registering callbacks via *note + PyDict_AddWatcher(): 55f, *note PyDict_Watch(): 560. 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(): 561. and *note PyType_Watch(): 562. + API to register callbacks to receive notification on changes to a + type. (Contributed by Carl Meyer in gh-91051(12).) + + * Add *note PyCode_AddWatcher(): 563. and *note + PyCode_ClearWatcher(): 564. 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(): 565. and *note PyFrame_GetVarString(): + 566. functions to get a frame variable by its name. (Contributed + by Victor Stinner in gh-91248(14).) + + * Add *note PyErr_GetRaisedException(): 3f0. and *note + PyErr_SetRaisedException(): 3f3. 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(): 3ef. and *note PyErr_Restore(): + 3f2. 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(): 567. and *note + PyException_SetArgs(): 568. as convenience functions for retrieving + and modifying the *note args: 569. passed to the exception’s + constructor. (Contributed by Mark Shannon in gh-101578(17).) + + * Add *note PyErr_DisplayException(): 3fe, 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(): 457. + function and *note PyInterpreterConfig: 56a, which may be used to + create sub-interpreters with their own GILs. (See *note PEP 684; A + Per-Interpreter GIL: 437. for more info.) (Contributed by Eric + Snow in gh-104110(22).) + + * In the limited C API version 3.12, *note Py_INCREF(): 56b. and + *note Py_DECREF(): 56c. 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: Porting to Python 3 12<2>, Next: Deprecated<2>, Prev: New Features<4>, Up: C API Changes<2> + +1.2.14.2 Porting to 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(): 56e. + 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: 56f. 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__(): 570. (using *note PyObject_CallMethod(): 39b, 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(): 385. and *note PyUnicode_FromFormatV(): + 571. (Contributed by Serhiy Storchaka in gh-98836(1).) + + * An unrecognized format character in *note PyUnicode_FromFormat(): + 385. and *note PyUnicode_FromFormatV(): 571. now sets a *note + SystemError: 572. 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(): 385. and + *note PyUnicode_FromFormatV(): 571. (Contributed by Philip Georgi + in gh-95504(3).) + + * Extension classes wanting to add a *note __dict__: 558. or weak + reference slot should use *note Py_TPFLAGS_MANAGED_DICT: 366. and + *note Py_TPFLAGS_MANAGED_WEAKREF: 557. instead of ‘tp_dictoffset’ + and ‘tp_weaklistoffset’, respectively. The use of ‘tp_dictoffset’ + and ‘tp_weaklistoffset’ is still supported, but does not fully + support multiple inheritance (gh-95589(4)), and performance may be + worse. Classes declaring *note Py_TPFLAGS_MANAGED_DICT: 366. must + call ‘_PyObject_VisitManagedDict()’ and + ‘_PyObject_ClearManagedDict()’ to traverse and clear their + instance’s dictionaries. To clear weakrefs, call *note + PyObject_ClearWeakRefs(): 573, as before. + + * The *note PyUnicode_FSDecoder(): 574. function no longer accepts + bytes-like paths, like *note bytearray: 53a. and *note memoryview: + 464. types: only the exact *note bytes: 1c2. type is accepted for + bytes strings. (Contributed by Victor Stinner in gh-98393(5).) + + * The *note Py_CLEAR: 575, *note Py_SETREF: 576. and *note + Py_XSETREF: 577. 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(): 578, *note PyErr_SetString(): + 579. 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(): 57a. + + * *note PyType_FromSpecWithBases(): 57b. + + * *note PyType_FromModuleAndSpec(): 54e. + + Creating classes whose metaclass overrides *note tp_new: 57c. 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(): 54d. (added in Python 3.12) + already disallows creating classes whose metaclass overrides + ‘tp_new’ (*note __new__(): 57d. 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: 57e. 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: 57f. 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: 580. the metaclass. + + - If you 'know' the ‘tp_new’ can be skipped safely, filter the + deprecation warning out using *note warnings.catch_warnings(): + 581. from Python. + + * *note PyOS_InputHook: 582. and *note PyOS_ReadlineFunctionPointer: + 583. are no longer called in *note subinterpreters: 584. 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: 585. has had its internals changed for better + performance. Although the internals of *note PyLongObject: 585. + are private, they are used by some extension modules. The internal + fields should no longer be accessed directly, instead the API + functions beginning ‘PyLong_...’ should be used instead. Two new + 'unstable' API functions are provided for efficient access to the + value of *note PyLongObject: 585.s which fit into a single machine + word: + + * *note PyUnstable_Long_IsCompact(): 586. + + * *note PyUnstable_Long_CompactValue(): 587. + + * Custom allocators, set via *note PyMem_SetAllocator(): 588, 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: Deprecated<2>, Next: Removed<2>, Prev: Porting to Python 3 12<2>, Up: C API Changes<2> + +1.2.14.3 Deprecated +................... + + * In accordance with PEP 699(1), the ‘ma_version_tag’ field in *note + PyDictObject: 3bd. 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: 3c2.: use *note PyConfig.parser_debug: + 3c3. + + * *note Py_VerboseFlag: 3c4.: use *note PyConfig.verbose: 3c5. + + * *note Py_QuietFlag: 3c6.: use *note PyConfig.quiet: 3c7. + + * *note Py_InteractiveFlag: 3c8.: use *note + PyConfig.interactive: 3c9. + + * *note Py_InspectFlag: 3ca.: use *note PyConfig.inspect: 3cb. + + * *note Py_OptimizeFlag: 3cc.: use *note + PyConfig.optimization_level: 3cd. + + * *note Py_NoSiteFlag: 3ce.: use *note PyConfig.site_import: + 3cf. + + * *note Py_BytesWarningFlag: 3d0.: use *note + PyConfig.bytes_warning: 3d1. + + * *note Py_FrozenFlag: 3d2.: use *note + PyConfig.pathconfig_warnings: 3d3. + + * *note Py_IgnoreEnvironmentFlag: 3d4.: use *note + PyConfig.use_environment: 3d5. + + * *note Py_DontWriteBytecodeFlag: 3d6.: use *note + PyConfig.write_bytecode: 3d7. + + * *note Py_NoUserSiteDirectory: 3d8.: use *note + PyConfig.user_site_directory: 3d9. + + * *note Py_UnbufferedStdioFlag: 3da.: use *note + PyConfig.buffered_stdio: 3db. + + * *note Py_HashRandomizationFlag: 3dc.: use *note + PyConfig.use_hash_seed: 3dd. and *note PyConfig.hash_seed: + 3de. + + * *note Py_IsolatedFlag: 3df.: use *note PyConfig.isolated: 3e0. + + * *note Py_LegacyWindowsFSEncodingFlag: 3e1.: use *note + PyPreConfig.legacy_windows_fs_encoding: 3e2. + + * *note Py_LegacyWindowsStdioFlag: 3e3.: use *note + PyConfig.legacy_windows_stdio: 3a0. + + * ‘Py_FileSystemDefaultEncoding’: use *note + PyConfig.filesystem_encoding: 3e4. + + * ‘Py_HasFileSystemDefaultEncoding’: use *note + PyConfig.filesystem_encoding: 3e4. + + * ‘Py_FileSystemDefaultEncodeErrors’: use *note + PyConfig.filesystem_errors: 3e5. + + * ‘Py_UTF8Mode’: use *note PyPreConfig.utf8_mode: 3e6. (see + *note Py_PreInitialize(): 3e7.) + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. (Contributed by Victor Stinner in + gh-77782(3).) + + * Creating *note immutable types: 3be. 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: 54c, *note PyMember_GetOne(): 58a. and + *note PyMember_SetOne(): 58b. + + - Type macros like *note Py_T_INT: 58c, *note Py_T_DOUBLE: 58d, + etc. (previously ‘T_INT’, ‘T_DOUBLE’, etc.) + + - The flags *note Py_READONLY: 58e. (previously ‘READONLY’) and + *note Py_AUDIT_READ: 58f. (previously all uppercase) + + Several items are not exposed from ‘Python.h’: + + - *note T_OBJECT: 590. (use *note Py_T_OBJECT_EX: 591.) + + - *note T_NONE: 592. (previously undocumented, and pretty + quirky) + + - The macro ‘WRITE_RESTRICTED’ which does nothing. + + - The macros ‘RESTRICTED’ and ‘READ_RESTRICTED’, equivalents of + *note Py_AUDIT_READ: 58f. + + - In some configurations, ‘’ 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(): 3ef. and *note PyErr_Restore(): 3f2. are + deprecated. Use *note PyErr_GetRaisedException(): 3f0. and *note + PyErr_SetRaisedException(): 3f3. instead. (Contributed by Mark + Shannon in gh-101578(6).) + + * ‘PyErr_Display()’ is deprecated. Use *note + PyErr_DisplayException(): 3fe. 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(): 57a, *note + PyType_FromSpecWithBases(): 57b. or *note + PyType_FromModuleAndSpec(): 54e. to create a class whose metaclass + overrides *note tp_new: 57c. 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<4>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<4>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<4>. + + ---------- 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<4>, Up: Deprecated<2> + +1.2.14.4 Pending Removal in Python 3.14 +....................................... + + * The ‘ma_version_tag’ field in *note PyDictObject: 3bd. for + extension modules ( PEP 699(1); gh-101193(2)). + + * Creating *note immutable types: 3be. with mutable bases + (gh-95388(3)). + + * Functions to configure Python’s initialization, deprecated in + Python 3.11: + + * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3c0. + instead. + + * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3b7. instead. + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + * Global configuration variables: + + * *note Py_DebugFlag: 3c2.: Use *note PyConfig.parser_debug: + 3c3. instead. + + * *note Py_VerboseFlag: 3c4.: Use *note PyConfig.verbose: 3c5. + instead. + + * *note Py_QuietFlag: 3c6.: Use *note PyConfig.quiet: 3c7. + instead. + + * *note Py_InteractiveFlag: 3c8.: Use *note + PyConfig.interactive: 3c9. instead. + + * *note Py_InspectFlag: 3ca.: Use *note PyConfig.inspect: 3cb. + instead. + + * *note Py_OptimizeFlag: 3cc.: Use *note + PyConfig.optimization_level: 3cd. instead. + + * *note Py_NoSiteFlag: 3ce.: Use *note PyConfig.site_import: + 3cf. instead. + + * *note Py_BytesWarningFlag: 3d0.: Use *note + PyConfig.bytes_warning: 3d1. instead. + + * *note Py_FrozenFlag: 3d2.: Use *note + PyConfig.pathconfig_warnings: 3d3. instead. + + * *note Py_IgnoreEnvironmentFlag: 3d4.: Use *note + PyConfig.use_environment: 3d5. instead. + + * *note Py_DontWriteBytecodeFlag: 3d6.: Use *note + PyConfig.write_bytecode: 3d7. instead. + + * *note Py_NoUserSiteDirectory: 3d8.: Use *note + PyConfig.user_site_directory: 3d9. instead. + + * *note Py_UnbufferedStdioFlag: 3da.: Use *note + PyConfig.buffered_stdio: 3db. instead. + + * *note Py_HashRandomizationFlag: 3dc.: Use *note + PyConfig.use_hash_seed: 3dd. and *note PyConfig.hash_seed: + 3de. instead. + + * *note Py_IsolatedFlag: 3df.: Use *note PyConfig.isolated: 3e0. + instead. + + * *note Py_LegacyWindowsFSEncodingFlag: 3e1.: Use *note + PyPreConfig.legacy_windows_fs_encoding: 3e2. instead. + + * *note Py_LegacyWindowsStdioFlag: 3e3.: Use *note + PyConfig.legacy_windows_stdio: 3a0. instead. + + * ‘Py_FileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_HasFileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_FileSystemDefaultEncodeErrors’: Use *note + PyConfig.filesystem_errors: 3e5. instead. + + * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 3e6. instead. + (see *note Py_PreInitialize(): 3e7.) + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0699/ + + (2) https://github.com/python/cpython/issues/101193 + + (3) https://github.com/python/cpython/issues/95388 + + +File: python.info, Node: Pending Removal in Python 3 15<4>, Next: Pending removal in Python 3 16<4>, Prev: Pending Removal in Python 3 14<4>, Up: Deprecated<2> + +1.2.14.5 Pending Removal in Python 3.15 +....................................... + + * The *note PyImport_ImportModuleNoBlock(): 3b9.: Use *note + PyImport_ImportModule(): 3ba. instead. + + * *note PyWeakref_GetObject(): 374. and *note PyWeakref_GET_OBJECT(): + 3bb.: Use *note PyWeakref_GetRef(): 373. instead. + + * *note Py_UNICODE: 3e9. type and the ‘Py_UNICODE_WIDE’ macro: Use + ‘wchar_t’ instead. + + * Python initialization functions: + + * *note PySys_ResetWarnOptions(): 3ab.: Clear *note + sys.warnoptions: 3ac. and ‘warnings.filters’ instead. + + * *note Py_GetExecPrefix(): 3ad.: Get *note + sys.base_exec_prefix: 3ea. and *note sys.exec_prefix: 3ae. + instead. + + * *note Py_GetPath(): 3af.: Get *note sys.path: 3b0. instead. + + * *note Py_GetPrefix(): 3b1.: Get *note sys.base_prefix: 3eb. + and *note sys.prefix: 3b2. instead. + + * *note Py_GetProgramFullPath(): 3b3.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetProgramName(): 3b5.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetPythonHome(): 3b6.: Get *note PyConfig.home: 3b7. + or the *note PYTHONHOME: 3b8. environment variable instead. + + +File: python.info, Node: Pending removal in Python 3 16<4>, Next: Pending Removal in Future Versions<4>, Prev: Pending Removal in Python 3 15<4>, Up: Deprecated<2> + +1.2.14.6 Pending removal in Python 3.16 +....................................... + + * The bundled copy of ‘libmpdec’. + + +File: python.info, Node: Pending Removal in Future Versions<4>, Prev: Pending removal in Python 3 16<4>, Up: Deprecated<2> + +1.2.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: 3ee.: Unneeded since Python 3.8. + + * *note PyErr_Fetch(): 3ef.: Use *note PyErr_GetRaisedException(): + 3f0. instead. + + * *note PyErr_NormalizeException(): 3f1.: Use *note + PyErr_GetRaisedException(): 3f0. instead. + + * *note PyErr_Restore(): 3f2.: Use *note PyErr_SetRaisedException(): + 3f3. instead. + + * *note PyModule_GetFilename(): 3f4.: Use *note + PyModule_GetFilenameObject(): 3f5. instead. + + * *note PyOS_AfterFork(): 3f6.: Use *note PyOS_AfterFork_Child(): + 3f7. instead. + + * *note PySlice_GetIndicesEx(): 3f8.: Use *note PySlice_Unpack(): + 3f9. and *note PySlice_AdjustIndices(): 3fa. instead. + + * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * *note PyUnicode_READY(): 3fd.: Unneeded since Python 3.12 + + * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 3fe. + instead. + + * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’ + instead. + + * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 3ff. + instead. + + * ‘PyDictObject.ma_version_tag’ member. + + * Thread Local Storage (TLS) API: + + * *note PyThread_create_key(): 400.: Use *note + PyThread_tss_alloc(): 401. instead. + + * *note PyThread_delete_key(): 402.: Use *note + PyThread_tss_free(): 403. instead. + + * *note PyThread_set_key_value(): 404.: Use *note + PyThread_tss_set(): 405. instead. + + * *note PyThread_get_key_value(): 406.: Use *note + PyThread_tss_get(): 407. instead. + + * *note PyThread_delete_key_value(): 408.: Use *note + PyThread_tss_delete(): 409. instead. + + * *note PyThread_ReInitTLS(): 40a.: Unneeded since Python 3.7. + + +File: python.info, Node: Removed<2>, Prev: Deprecated<2>, Up: C API Changes<2> + +1.2.14.8 Removed +................ + + * 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.3 What’s New In Python 3.11 +============================= + + +Editor: Pablo Galindo Salgado + +This article explains the new features in Python 3.11, compared to 3.10. +Python 3.11 was released on October 24, 2022. For full details, see the +*note changelog: 13c. + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<2>. +* New Features: New Features<5>. +* New Features Related to Type Hints: New Features Related to Type Hints<2>. +* Other Language Changes: Other Language Changes<3>. +* Other CPython Implementation Changes:: +* New Modules: New Modules<3>. +* Improved Modules: Improved Modules<3>. +* Optimizations: Optimizations<3>. +* Faster CPython:: +* CPython bytecode changes: CPython bytecode changes<2>. +* Deprecated: Deprecated<3>. +* Pending Removal in Python 3.12: Pending Removal in Python 3 12. +* Removed: Removed<3>. +* Porting to Python 3.11: Porting to Python 3 11. +* Build Changes: Build Changes<3>. +* C API Changes: C API Changes<3>. +* Notable changes in 3.11.4: Notable changes in 3 11 4. +* Notable changes in 3.11.5: Notable changes in 3 11 5. + + +File: python.info, Node: Summary – Release highlights<2>, Next: New Features<5>, Up: What’s New In Python 3 11 + +1.3.1 Summary – Release highlights +---------------------------------- + + * Python 3.11 is between 10-60% faster than Python 3.10. On average, + we measured a 1.25x speedup on the standard benchmark suite. See + *note Faster CPython: 59c. for details. + +New syntax features: + + * *note PEP 654; Exception Groups and except*: 59d. + +New built-in features: + + * *note PEP 678; Exceptions can be enriched with notes: 59e. + +New standard library modules: + + * PEP 680(1): *note tomllib: fc. — Support for parsing TOML(2) in the + Standard Library + +Interpreter improvements: + + * *note PEP 657; Fine-grained error locations in tracebacks: 59f. + + * New *note -P: 5a0. command line option and *note PYTHONSAFEPATH: + 5a1. environment variable to *note disable automatically prepending + potentially unsafe paths: 5a2. to *note sys.path: 3b0. + +New typing features: + + * *note PEP 646; Variadic generics: 5a3. + + * *note PEP 655; Marking individual TypedDict items as required or + not-required: 5a4. + + * *note PEP 673; Self type: 5a5. + + * *note PEP 675; Arbitrary literal string type: 5a6. + + * *note PEP 681; Data class transforms: 5a7. + +Important deprecations, removals and restrictions: + + * PEP 594(3): *note Many legacy standard library modules have been + deprecated: 5a8. and will be removed in Python 3.13 + + * PEP 624(4): *note Py_UNICODE encoder APIs have been removed: 5a9. + + * PEP 670(5): *note Macros converted to static inline functions: 5aa. + + ---------- 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: New Features<5>, Next: New Features Related to Type Hints<2>, Prev: Summary – Release highlights<2>, Up: What’s New In Python 3 11 + +1.3.2 New Features +------------------ + +* Menu: + +* PEP 657; Fine-grained error locations in tracebacks: PEP 657 Fine-grained error locations in tracebacks. +* PEP 654; Exception Groups and except*: PEP 654 Exception Groups and except*. +* PEP 678; Exceptions can be enriched with notes: PEP 678 Exceptions can be enriched with notes. +* Windows py.exe launcher improvements: Windows py exe launcher improvements. + + +File: python.info, Node: PEP 657 Fine-grained error locations in tracebacks, Next: PEP 654 Exception Groups and except*, Up: New Features<5> + +1.3.2.1 PEP 657: Fine-grained error locations in tracebacks +........................................................... + +When printing tracebacks, the interpreter will now point to the exact +expression that caused the error, instead of just the line. For +example: + + Traceback (most recent call last): + File "distance.py", line 11, in + 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' + +Previous versions of the interpreter would point to just the line, +making it ambiguous which object was ‘None’. These enhanced errors can +also be helpful when dealing with deeply nested *note dict: 258. objects +and multiple function calls: + + Traceback (most recent call last): + File "query.py", line 37, in + 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 + +As well as complex arithmetic expressions: + + Traceback (most recent call last): + File "calculation.py", line 54, in + result = (x / y / z) * (a / b / c) + ~~~~~~^~~ + ZeroDivisionError: division by zero + +Additionally, the information used by the enhanced traceback feature is +made available via a general API, that can be used to correlate *note +bytecode: 187. *note instructions: 5ae. with source code location. This +information can be retrieved using: + + - The *note codeobject.co_positions(): 5af. method in Python. + + - The *note PyCode_Addr2Location(): 5b0. function in the C API. + +See PEP 657(1) for more details. (Contributed by Pablo Galindo, Batuhan +Taskaya and Ammar Askar in bpo-43950(2).) + + Note: This feature requires storing column positions in *note Code + Objects: 5b1, which may result in a small increase in interpreter + memory usage and disk usage for compiled Python files. To avoid + storing the extra information and deactivate printing the extra + traceback information, use the *note -X no_debug_ranges: 176. + command line option or the *note PYTHONNODEBUGRANGES: 5b2. + environment variable. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0657/ + + (2) https://bugs.python.org/issue?@action=redirect&bpo=43950 + + +File: python.info, Node: PEP 654 Exception Groups and except*, Next: PEP 678 Exceptions can be enriched with notes, Prev: PEP 657 Fine-grained error locations in tracebacks, Up: New Features<5> + +1.3.2.2 PEP 654: Exception Groups and ‘except*’ +............................................... + +PEP 654(1) introduces language features that enable a program to raise +and handle multiple unrelated exceptions simultaneously. The builtin +types *note ExceptionGroup: 1b6. and *note BaseExceptionGroup: 261. make +it possible to group exceptions and raise them together, and the new +*note except*: 5b4. syntax generalizes *note except: 18b. to match +subgroups of exception groups. + +See PEP 654(2) for more details. + +(Contributed by Irit Katriel in bpo-45292(3). PEP written by Irit +Katriel, Yury Selivanov and 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 Exceptions can be enriched with notes, Next: Windows py exe launcher improvements, Prev: PEP 654 Exception Groups and except*, Up: New Features<5> + +1.3.2.3 PEP 678: Exceptions can be enriched with notes +...................................................... + +The *note add_note(): 5b6. method is added to *note BaseException: 5b7. +It can be used to enrich exceptions with context information that is not +available at the time when the exception is raised. The added notes +appear in the default traceback. + +See PEP 678(1) for more details. + +(Contributed by Irit Katriel in bpo-45607(2). PEP written by 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 launcher improvements, Prev: PEP 678 Exceptions can be enriched with notes, Up: New Features<5> + +1.3.2.4 Windows ‘py.exe’ launcher improvements +.............................................. + +The copy of the *note Python Launcher for Windows: 5ba. included with +Python 3.11 has been significantly updated. It now supports company/tag +syntax as defined in PEP 514(1) using the ‘-V:/’ argument +instead of the limited ‘-.’. This allows launching +distributions other than ‘PythonCore’, the one hosted on python.org(2). + +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 ‘-’, ‘-.’, +‘--’ or ‘-.-’ 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: New Features Related to Type Hints<2>, Next: Other Language Changes<3>, Prev: New Features<5>, Up: What’s New In Python 3 11 + +1.3.3 New Features Related to Type Hints +---------------------------------------- + +This section covers major changes affecting PEP 484(1) type hints and +the *note typing: 104. 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 type: PEP 673 Self type. +* 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: New Features Related to Type Hints<2> + +1.3.3.1 PEP 646: Variadic generics +.................................. + +PEP 484(1) previously introduced *note TypeVar: 15d, enabling creation +of generics parameterised with a single type. PEP 646(2) adds *note +TypeVarTuple: 15f, enabling parameterisation with an 'arbitrary' number +of types. In other words, a *note TypeVarTuple: 15f. 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. + +See PEP 646(3) for more details. + +(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 type, Prev: PEP 646 Variadic generics, Up: New Features Related to Type Hints<2> + +1.3.3.2 PEP 655: Marking individual ‘TypedDict’ items as required or not-required +................................................................................. + +*note Required: 5c0. and *note NotRequired: 5c1. provide a +straightforward way to mark whether individual items in a *note +TypedDict: 162. 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 + +See PEP 655(1) for more details. + +(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 type, Next: PEP 675 Arbitrary literal string type, Prev: PEP 655 Marking individual TypedDict items as required or not-required, Up: New Features Related to Type Hints<2> + +1.3.3.3 PEP 673: ‘Self’ type +............................ + +The new *note Self: 5c3. 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: 15d.-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: 166.s, and *note __enter__(): 5c4. 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: 5c3. can also be used to annotate method parameters or +attributes of the same type as their enclosing class. + +See PEP 673(2) for more details. + +(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 type, Up: New Features Related to Type Hints<2> + +1.3.3.4 PEP 675: Arbitrary literal string type +.............................................. + +The new *note LiteralString: 5c6. 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}" + ) + +See PEP 675(1) for more details. + +(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: New Features Related to Type Hints<2> + +1.3.3.5 PEP 681: Data class transforms +...................................... + +*note dataclass_transform: 4d0. 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: 1cb.-like behaviors. + +For example: + + # 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") + +See PEP 681(1) for more details. + +(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: New Features Related to Type Hints<2> + +1.3.3.6 PEP 563 may not be the future +..................................... + +PEP 563(1) Postponed Evaluation of Annotations (the ‘from __future__ +import annotations’ *note future statement: 189.) 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: Other Language Changes<3>, Next: Other CPython Implementation Changes, Prev: New Features Related to Type Hints<2>, Up: What’s New In Python 3 11 + +1.3.4 Other Language Changes +---------------------------- + + * Starred unpacking expressions can now be used in *note for: 2ec. + statements. (See bpo-46725(1) for more details.) + + * Asynchronous *note comprehensions: 5cc. are now allowed inside + comprehensions in *note asynchronous functions: 5cd. Outer + comprehensions implicitly become asynchronous in this case. + (Contributed by Serhiy Storchaka in bpo-33346(2).) + + * A *note TypeError: 534. is now raised instead of an *note + AttributeError: 348. in *note with: 5ce. statements and *note + contextlib.ExitStack.enter_context(): 5cf. for objects that do not + support the *note context manager: 5d0. protocol, and in *note + async with: 5d1. statements and *note + contextlib.AsyncExitStack.enter_async_context(): 5d2. for objects + not supporting the *note asynchronous context manager: 5d3. + protocol. (Contributed by Serhiy Storchaka in bpo-12022(3) and + bpo-44471(4).) + + * Added *note object.__getstate__(): 5d4, which provides the default + implementation of the ‘__getstate__()’ method. *note copy: 25.ing + and *note pickle: a6.ing instances of subclasses of builtin types + *note bytearray: 53a, *note set: 5d5, *note frozenset: 5d6, *note + collections.OrderedDict: 5d7, *note collections.deque: 5d8, *note + weakref.WeakSet: 5d9, and *note datetime.tzinfo: 5da. now copies + and pickles instance attributes implemented as *note slots: 5db. + This change has an unintended side effect: It trips up a small + minority of existing Python projects not expecting *note + object.__getstate__(): 5d4. 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: 5a0. command line option and a *note + PYTHONSAFEPATH: 5a1. environment variable, which disable the + automatic prepending to *note sys.path: 3b0. of the script’s + directory when running a script, or the current directory when + using *note -c: 5dc. and *note -m: 5dd. This ensures only stdlib + and installed modules are picked up by *note import: 5de, 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: 1ea. 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: 3b0. 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: + 5df. and *note sys.path_importer_cache: 5e0. when there is a + mixture of *note str: 447. and *note bytes: 1c2. 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: Other CPython Implementation Changes, Next: New Modules<3>, Prev: Other Language Changes<3>, Up: What’s New In Python 3 11 + +1.3.5 Other CPython Implementation Changes +------------------------------------------ + + * The special methods *note __complex__(): 5e3. for *note complex: + 2f2. and *note __bytes__(): 5e4. for *note bytes: 1c2. are + implemented to support the *note typing.SupportsComplex: 5e5. and + *note typing.SupportsBytes: 5e6. 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: 447, *note bytes: 1c2, and some + other types now use it as the default algorithm for *note hash(): + 5e7. PEP 552(2) *note hash-based .pyc files: 5e8. now use + ‘siphash13’ too. (Contributed by Inada Naoki in bpo-29410(3).) + + * When an active exception is re-raised by a *note raise: 5e9. + 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: 18b. 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: 5ea, ‘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: 5eb. field must now be + set to ‘1’ for initialization to use *note + PyConfig.module_search_paths: 39e. to initialize *note sys.path: + 3b0. Otherwise, initialization will recalculate the path and + replace any values added to ‘module_search_paths’. + + * The output of the *note -help: 5ec. option now fits in 50 lines/80 + columns. Information about *note Python environment variables: + 5ed. and *note -X: 176. options is now available using the + respective *note -help-env: 5ee. and *note -help-xoptions: 5ef. + flags, and with the new *note -help-all: 5f0. (Contributed by Éric + Araujo in bpo-46142(7).) + + * Converting between *note int: 259. and *note str: 447. in bases + other than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such + as base 10 (decimal) now raises a *note ValueError: 204. 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: d9. APIs. See the *note integer string conversion + length limitation: 5f1. 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: New Modules<3>, Next: Improved Modules<3>, Prev: Other CPython Implementation Changes, Up: What’s New In Python 3 11 + +1.3.6 New Modules +----------------- + + * *note tomllib: fc.: For parsing TOML(1). See PEP 680(2) for more + details. (Contributed by Taneli Hukkinen in bpo-40059(3).) + + * *note wsgiref.types: 11c.: 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: Improved Modules<3>, Next: Optimizations<3>, Prev: New Modules<3>, Up: What’s New In Python 3 11 + +1.3.7 Improved Modules +---------------------- + +* Menu: + +* asyncio: asyncio<3>. +* contextlib:: +* dataclasses:: +* datetime:: +* enum: enum<3>. +* fcntl:: +* fractions: fractions<3>. +* functools:: +* gzip: gzip<2>. +* hashlib: hashlib<2>. +* IDLE and idlelib:: +* inspect: inspect<2>. +* locale: locale<3>. +* logging:: +* math: math<3>. +* operator:: +* os: os<3>. +* pathlib: pathlib<4>. +* re: re<3>. +* shutil: shutil<3>. +* socket:: +* sqlite3: sqlite3<4>. +* string:: +* sys: sys<4>. +* sysconfig:: +* tempfile: tempfile<3>. +* threading: threading<2>. +* time: time<2>. +* tkinter: tkinter<3>. +* traceback: traceback<2>. +* typing: typing<4>. +* unicodedata: unicodedata<3>. +* unittest: unittest<4>. +* venv: venv<2>. +* warnings: warnings<2>. +* zipfile:: + + +File: python.info, Node: asyncio<3>, Next: contextlib, Up: Improved Modules<3> + +1.3.7.1 asyncio +............... + + * Added the *note TaskGroup: 1b5. class, an *note asynchronous + context manager: 5f8. 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(): 1bf. and *note gather(): 5f9. directly. + (Contributed by Yury Selivanov and others in gh-90908(1).) + + * Added *note timeout(): 5fa, an asynchronous context manager for + setting a timeout on asynchronous operations. For new code this is + recommended over using *note wait_for(): 5fb. directly. + (Contributed by Andrew Svetlov in gh-90927(2).) + + * Added the *note Runner: 5fc. class, which exposes the machinery + used by *note run(): 478. (Contributed by Andrew Svetlov in + gh-91218(3).) + + * Added the *note Barrier: 5fd. class to the synchronization + primitives in the asyncio library, and the related *note + BrokenBarrierError: 5fe. exception. (Contributed by Yves Duprat + and Andrew Svetlov in gh-87518(4).) + + * Added keyword argument 'all_errors' to *note + asyncio.loop.create_connection(): 5ff. so that multiple connection + errors can be raised as an *note ExceptionGroup: 1b6. + + * Added the *note asyncio.StreamWriter.start_tls(): 600. 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(): 601, *note sock_recvfrom(): 602. and *note + sock_recvfrom_into(): 603. These have implementations in *note + SelectorEventLoop: 604. and *note ProactorEventLoop: 605. + (Contributed by Alex Grönholm in bpo-46805(6).) + + * Added *note cancelling(): 1ba. and *note uncancel(): 1bb. methods + to *note Task: 1be. These are primarily intended for internal use, + notably by *note TaskGroup: 1b5. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/90908 + + (2) https://github.com/python/cpython/issues/90927 + + (3) https://github.com/python/cpython/issues/91218 + + (4) https://github.com/python/cpython/issues/87518 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=34975 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=46805 + + +File: python.info, Node: contextlib, Next: dataclasses, Prev: asyncio<3>, Up: Improved Modules<3> + +1.3.7.2 contextlib +.................. + + * Added non parallel-safe *note chdir(): 608. context manager to + change the current working directory and then restore it on exit. + Simple wrapper around *note chdir(): 609. (Contributed by Filipe + Laíns in bpo-25625(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25625 + + +File: python.info, Node: dataclasses, Next: datetime, Prev: contextlib, Up: Improved Modules<3> + +1.3.7.3 dataclasses +................... + + * Change field default mutability check, allowing only defaults which + are *note hashable: 60c. instead of any object which is not an + instance of *note dict: 258, *note list: 60d. or *note set: 5d5. + (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, Next: enum<3>, Prev: dataclasses, Up: Improved Modules<3> + +1.3.7.4 datetime +................ + + * Add *note datetime.UTC: 4ea, a convenience alias for *note + datetime.timezone.utc: 610. (Contributed by Kabir Kwatra in + gh-91973(1).) + + * *note datetime.date.fromisoformat(): 611, *note + datetime.time.fromisoformat(): 612. and *note + datetime.datetime.fromisoformat(): 613. 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, Up: Improved Modules<3> + +1.3.7.5 enum +............ + + * Renamed ‘EnumMeta’ to *note EnumType: 1e7. (‘EnumMeta’ kept as an + alias). + + * Added *note StrEnum: 616, with members that can be used as (and + must be) strings. + + * Added *note ReprEnum: 617, which only modifies the *note + __repr__(): 618. of members while returning their literal values + (rather than names) for *note __str__(): 619. and *note + __format__(): 61a. (used by *note str(): 447, *note format(): 61b. + and *note f-string: 431.s). + + * Changed *note Enum.__format__(): 61c. (the default for *note + format(): 61b, *note str.format(): 61d. and *note f-string: 431.s) + to always produce the same result as *note Enum.__str__(): 61e.: + for enums inheriting from *note ReprEnum: 617. 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: 61f. enums + and the *note FlagBoundary: 620. enum with its options, to control + how to handle out-of-range flag values. + + * Added the *note verify(): 621. enum decorator and the *note + EnumCheck: 622. enum with its options, to check enum classes + against several specific constraints. + + * Added the *note member(): 623. and *note nonmember(): 624. + decorators, to ensure the decorated object is/is not converted to + an enum member. + + * Added the *note property(): 625. decorator, which works like *note + property(): 194. except for enums. Use this instead of *note + types.DynamicClassAttribute(): 626. + + * Added the *note global_enum(): 627. enum decorator, which adjusts + *note __repr__(): 618. and *note __str__(): 619. to show values as + members of their module rather than the enum class. For example, + ‘'re.ASCII'’ for the *note ASCII: 628. member of *note + re.RegexFlag: 629. rather than ‘'RegexFlag.ASCII'’. + + * Enhanced *note Flag: 61f. to support *note len(): 62a, iteration + and *note in: 2ee./*note not in: 62b. on its members. For example, + the following now works: ‘len(AFlag(3)) == 2 and list(AFlag(3)) == + (AFlag.ONE, AFlag.TWO)’ + + * Changed *note Enum: 62c. and *note Flag: 61f. so that members are + now defined before *note __init_subclass__(): 62d. is called; *note + dir(): 62e. now includes methods, etc., from mixed-in data types. + + * Changed *note Flag: 61f. 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<3>, Prev: enum<3>, Up: Improved Modules<3> + +1.3.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<3>, Next: functools, Prev: fcntl, Up: Improved Modules<3> + +1.3.7.7 fractions +................. + + * Support PEP 515(1)-style initialization of *note Fraction: 1e9. + from string. (Contributed by Sergey B Kirpichev in bpo-44258(2).) + + * *note Fraction: 1e9. 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, Next: gzip<2>, Prev: fractions<3>, Up: Improved Modules<3> + +1.3.7.8 functools +................. + + * *note functools.singledispatch(): 635. now supports *note + types.UnionType: 636. and *note typing.Union: 637. as annotations + to the dispatch argument.: + + >>> from functools import singledispatch + >>> @singledispatch + ... def fun(arg, verbose=False): + ... if verbose: + ... print("Let me just say,", end=" ") + ... print(arg) + ... + >>> @fun.register + ... def _(arg: int | float, verbose=False): + ... if verbose: + ... print("Strength in numbers, eh?", end=" ") + ... print(arg) + ... + >>> from typing import Union + >>> @fun.register + ... def _(arg: Union[list, set], verbose=False): + ... if verbose: + ... print("Enumerate this:") + ... for i, elem in enumerate(arg): + ... print(i, elem) + ... + + (Contributed by Yurii Karabas in bpo-46014(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=46014 + + +File: python.info, Node: gzip<2>, Next: hashlib<2>, Prev: functools, Up: Improved Modules<3> + +1.3.7.9 gzip +............ + + * The *note gzip.compress(): 63a. function is now faster when used + with the 'mtime=0' argument as it delegates the compression + entirely to a single *note zlib.compress(): 63b. 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: 67. module. + Now, when using *note compress(): 63a. with 'mtime=0', it may be + set to a different value by the underlying zlib C library Python + was linked against. (See gh-112346(1) for details on the side + effect.) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/112346 + + +File: python.info, Node: hashlib<2>, Next: IDLE and idlelib, Prev: gzip<2>, Up: Improved Modules<3> + +1.3.7.10 hashlib +................ + + * *note hashlib.blake2b(): 63e. and *note hashlib.blake2s(): 63f. 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: 68. 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(): 640, 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 and idlelib, Next: inspect<2>, Prev: hashlib<2>, Up: Improved Modules<3> + +1.3.7.11 IDLE and idlelib +......................... + + * 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<2>, Next: locale<3>, Prev: IDLE and idlelib, Up: Improved Modules<3> + +1.3.7.12 inspect +................ + + * Add *note getmembers_static(): 645. to return all members without + triggering dynamic lookup via the descriptor protocol. + (Contributed by Weipeng Hong in bpo-30533(1).) + + * Add *note ismethodwrapper(): 646. for checking if the type of an + object is a *note MethodWrapperType: 647. (Contributed by Hakan + Çelik in bpo-29418(2).) + + * Change the frame-related functions in the *note inspect: 7e. module + to return new *note FrameInfo: 648. and *note Traceback: 649. class + instances (backwards compatible with the previous *note named + tuple: 64a.-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(): 64b. + + * *note inspect.getouterframes(): 64c. + + * *note inspect.getinnerframes(): 64d, + + * *note inspect.stack(): 64e. + + * *note inspect.trace(): 64f. + + (Contributed by Pablo Galindo in gh-88116(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=30533 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=29418 + + (3) https://peps.python.org/pep-0657/ + + (4) https://github.com/python/cpython/issues/88116 + + +File: python.info, Node: locale<3>, Next: logging, Prev: inspect<2>, Up: Improved Modules<3> + +1.3.7.13 locale +............... + + * Add *note locale.getencoding(): 2e0. to get the current locale + encoding. It is similar to ‘locale.getpreferredencoding(False)’ + but ignores the *note Python UTF-8 Mode: 652. + + +File: python.info, Node: logging, Next: math<3>, Prev: locale<3>, Up: Improved Modules<3> + +1.3.7.14 logging +................ + + * Added *note getLevelNamesMapping(): 655. to return a mapping from + logging level names (e.g. ‘'CRITICAL'’) to the values of their + corresponding *note Logging Levels: 656. (e.g. ‘50’, by default). + (Contributed by Andrei Kulakovin in gh-88024(1).) + + * Added a *note createSocket(): 657. method to *note SysLogHandler: + 658, to match *note SocketHandler.createSocket(): 659. 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<3>, Next: operator, Prev: logging, Up: Improved Modules<3> + +1.3.7.15 math +............. + + * Add *note math.exp2(): 65c.: return 2 raised to the power of x. + (Contributed by Gideon Mitchell in bpo-45917(1).) + + * Add *note math.cbrt(): 65d.: return the cube root of x. + (Contributed by Ajith Ramachandran in bpo-44357(2).) + + * The behaviour of two *note math.pow(): 65e. 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: 204. (Contributed by Mark Dickinson in bpo-44339(3).) + + * The *note math.nan: 65f. 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, Next: os<3>, Prev: math<3>, Up: Improved Modules<3> + +1.3.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<3>, Next: pathlib<4>, Prev: operator, Up: Improved Modules<3> + +1.3.7.17 os +........... + + * On Windows, *note os.urandom(): 51e. 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<4>, Next: re<3>, Prev: os<3>, Up: Improved Modules<3> + +1.3.7.18 pathlib +................ + + * *note glob(): 22f. and *note rglob(): 230. return only directories + if 'pattern' ends with a pathname components separator: *note sep: + 666. or *note altsep: 667. (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<3>, Next: shutil<3>, Prev: pathlib<4>, Up: Improved Modules<3> + +1.3.7.19 re +........... + + * Atomic grouping (‘(?>...)’) and possessive quantifiers (‘*+’, ‘++’, + ‘?+’, ‘{m,n}+’) are now supported in regular expressions. + (Contributed by Jeffrey C. Jacobs and Serhiy Storchaka in + bpo-433030(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=433030 + + +File: python.info, Node: shutil<3>, Next: socket, Prev: re<3>, Up: Improved Modules<3> + +1.3.7.20 shutil +............... + + * Add optional parameter 'dir_fd' in *note shutil.rmtree(): 2fb. + (Contributed by Serhiy Storchaka in bpo-46245(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=46245 + + +File: python.info, Node: socket, Next: sqlite3<4>, Prev: shutil<3>, Up: Improved Modules<3> + +1.3.7.21 socket +............... + + * Add CAN Socket support for NetBSD. (Contributed by Thomas Klausner + in bpo-30512(1).) + + * *note create_connection(): 66e. has an option to raise, in case of + failure to connect, an *note ExceptionGroup: 1b6. 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<4>, Next: string, Prev: socket, Up: Improved Modules<3> + +1.3.7.22 sqlite3 +................ + + * You can now disable the authorizer by passing *note None: 671. to + *note set_authorizer(): 2ad. (Contributed by Erlend E. Aasland in + bpo-44491(1).) + + * Collation name *note create_collation(): 672. can now contain any + Unicode character. Collation names with invalid characters now + raise *note UnicodeEncodeError: 673. instead of *note + sqlite3.ProgrammingError: 4ee. (Contributed by Erlend E. Aasland + in bpo-44688(2).) + + * *note sqlite3: cf. exceptions now include the SQLite extended error + code as *note sqlite_errorcode: 674. and the SQLite error name as + *note sqlite_errorname: 675. (Contributed by Aviv Palivoda, Daniel + Shahaf, and Erlend E. Aasland in bpo-16379(3) and bpo-24139(4).) + + * Add *note setlimit(): 676. and *note getlimit(): 677. to *note + sqlite3.Connection: 247. for setting and getting SQLite limits by + connection basis. (Contributed by Erlend E. Aasland in + bpo-45243(5).) + + * *note sqlite3: cf. now sets *note sqlite3.threadsafety: 678. 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: cf. C callbacks now use unraisable exceptions if + callback tracebacks are enabled. Users can now register an *note + unraisable hook handler: 1f9. to improve their debug experience. + (Contributed by Erlend E. Aasland in bpo-45828(7).) + + * Fetch across rollback no longer raises *note InterfaceError: 679. + Instead we leave it to the SQLite library to handle these cases. + (Contributed by Erlend E. Aasland in bpo-44092(8).) + + * Add *note serialize(): 67a. and *note deserialize(): 67b. to *note + sqlite3.Connection: 247. for serializing and deserializing + databases. (Contributed by Erlend E. Aasland in bpo-41930(9).) + + * Add *note create_window_function(): 67c. to *note + sqlite3.Connection: 247. for creating aggregate window functions. + (Contributed by Erlend E. Aasland in bpo-34916(10).) + + * Add *note blobopen(): 67d. to *note sqlite3.Connection: 247. *note + sqlite3.Blob: 67e. allows incremental I/O operations on blobs. + (Contributed by Aviv Palivoda and Erlend E. Aasland in + bpo-24905(11).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=44491 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=44688 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=16379 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=24139 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=45243 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=45613 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=45828 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=44092 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=41930 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=34916 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=24905 + + +File: python.info, Node: string, Next: sys<4>, Prev: sqlite3<4>, Up: Improved Modules<3> + +1.3.7.23 string +............... + + * Add *note get_identifiers(): 681. and *note is_valid(): 682. to + *note string.Template: 683, which respectively return all valid + placeholders, and whether any invalid placeholders are present. + (Contributed by Ben Kehoe in gh-90465(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/90465 + + +File: python.info, Node: sys<4>, Next: sysconfig, Prev: string, Up: Improved Modules<3> + +1.3.7.24 sys +............ + + * *note sys.exc_info(): 686. 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(): 687. 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: 688. 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, Next: tempfile<3>, Prev: sys<4>, Up: Improved Modules<3> + +1.3.7.25 sysconfig +.................. + + * Three new *note installation schemes: 68b. ('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(): 68c. Third party code that + creates new virtual environments should use the new 'venv' + installation scheme to determine the paths, as does *note venv: + 111. (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<2>, Prev: sysconfig, Up: Improved Modules<3> + +1.3.7.26 tempfile +................. + + * *note SpooledTemporaryFile: 68f. objects now fully implement the + methods of *note io.BufferedIOBase: 690. or *note io.TextIOBase: + 691. (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<2>, Next: time<2>, Prev: tempfile<3>, Up: Improved Modules<3> + +1.3.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(): + 694. method now uses the monotonic clock (*note + time.CLOCK_MONOTONIC: 695.) for the timeout, rather than using the + system clock (*note time.CLOCK_REALTIME: 696.), 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<3>, Prev: threading<2>, Up: Improved Modules<3> + +1.3.7.28 time +............. + + * On Unix, *note time.sleep(): 699. 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(): 699. 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<3>, Next: traceback<2>, Prev: time<2>, Up: Improved Modules<3> + +1.3.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: + 69c. (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<4>, Prev: tkinter<3>, Up: Improved Modules<3> + +1.3.7.30 traceback +.................. + + * Add *note traceback.StackSummary.format_frame_summary(): 69f. 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(): 6a0, which prints + the formatted *note TracebackException: 25e. 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<4>, Next: unicodedata<3>, Prev: traceback<2>, Up: Improved Modules<3> + +1.3.7.31 typing +............... + +For major changes, see *note New Features Related to Type Hints: 5bb. + + * Add *note typing.assert_never(): 6a3. and *note typing.Never: 6a4. + *note typing.assert_never(): 6a3. is useful for asking a type + checker to confirm that a line of code is not reachable. At + runtime, it raises an *note AssertionError: 6a5. (Contributed by + Jelle Zijlstra in gh-90633(1).) + + * Add *note typing.reveal_type(): 6a6. 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(): 6a7. 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: 162. types can now be generic. + (Contributed by Samodya Abeysiriwardane in gh-89026(4).) + + * *note NamedTuple: 2b2. types can now be generic. (Contributed by + Serhiy Storchaka in bpo-43923(5).) + + * Allow subclassing of *note typing.Any: 6a8. 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(): 6a9. decorator now sets the ‘__final__’ + attributed on the decorated object. (Contributed by Jelle Zijlstra + in gh-90500(7).) + + * The *note typing.get_overloads(): 6aa. function can be used for + introspecting the overloads of a function. *note + typing.clear_overloads(): 6ab. can be used to clear all registered + overloads of a function. (Contributed by Jelle Zijlstra in + gh-89263(8).) + + * The *note __init__(): 6ac. method of *note Protocol: 266. + 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(): 6ad. now supports evaluating strings + as forward references in *note PEP 585 generic aliases: 6ae. + (Contributed by Niklas Rosenstein in gh-85542(12).) + + * *note typing.get_type_hints(): 6ad. no longer adds *note Optional: + 6af. to parameters with ‘None’ as a default. (Contributed by + Nikita Sobolev in gh-90353(13).) + + * *note typing.get_type_hints(): 6ad. now supports evaluating bare + stringified *note ClassVar: 268. annotations. (Contributed by + Gregory Beauregard in gh-90711(14).) + + * *note typing.no_type_check(): 6b0. 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<3>, Next: unittest<4>, Prev: typing<4>, Up: Improved Modules<3> + +1.3.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<4>, Next: venv<2>, Prev: unicodedata<3>, Up: Improved Modules<3> + +1.3.7.33 unittest +................. + + * Added methods *note enterContext(): 6b5. and *note + enterClassContext(): 6b6. of class *note TestCase: 449, method + *note enterAsyncContext(): 6b7. of class *note + IsolatedAsyncioTestCase: 306. and function *note + unittest.enterModuleContext(): 6b8. (Contributed by Serhiy + Storchaka in bpo-45046(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=45046 + + +File: python.info, Node: venv<2>, Next: warnings<2>, Prev: unittest<4>, Up: Improved Modules<3> + +1.3.7.34 venv +............. + + * When new Python virtual environments are created, the 'venv' *note + sysconfig installation scheme: 68b. is used to determine the paths + inside the environment. When Python runs in a virtual environment, + the same installation scheme is the default. That means that + downstream distributors can change the default sysconfig install + scheme without changing behavior of virtual environments. Third + party code that also creates new virtual environments should do the + same. (Contributed by Miro Hrončok in bpo-45413(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=45413 + + +File: python.info, Node: warnings<2>, Next: zipfile, Prev: venv<2>, Up: Improved Modules<3> + +1.3.7.35 warnings +................. + + * *note warnings.catch_warnings(): 581. now accepts arguments for + *note warnings.simplefilter(): 6bd, 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, Prev: warnings<2>, Up: Improved Modules<3> + +1.3.7.36 zipfile +................ + + * Added support for specifying member name encoding for reading + metadata in a *note ZipFile: 6c0.’s directory and file headers. + (Contributed by Stephen J. Turnbull and Serhiy Storchaka in + bpo-28080(1).) + + * Added *note ZipFile.mkdir(): 6c1. for creating new directories + inside ZIP archives. (Contributed by Sam Ezeh in gh-49083(2).) + + * Added *note stem: 6c2, *note suffix: 6c3. and *note suffixes: 6c4. + to *note zipfile.Path: 6c5. (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: Optimizations<3>, Next: Faster CPython, Prev: Improved Modules<3>, Up: What’s New In Python 3 11 + +1.3.8 Optimizations +------------------- + +This section covers specific optimizations independent of the *note +Faster CPython: 59c. project, which is covered in its own section. + + * The compiler now optimizes simple *note printf-style % formatting: + 6c8. on string literals containing only the format codes ‘%s’, ‘%r’ + and ‘%a’ and makes it as fast as a corresponding *note f-string: + 431. 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: 259. by a value smaller than ‘2**30’. (Contributed by + Gregory P. Smith and Tim Peters in gh-90564(2).) + + * *note sum(): 466. 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 + ‘list.append()’ by ≈15% and simple *note list comprehension: 6c9.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: 258. 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: 6ca. 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: 8e. functions *note comb(): 6cb. and *note perm(): 6cc. + 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: d2. functions *note mean(): 6cd, *note + variance(): 6ce. and *note stdev(): 6cf. now consume iterators in + one pass rather than converting them to a *note list: 60d. first. + This is twice as fast and can save substantial memory. + (Contributed by Raymond Hettinger in gh-90415(8).) + + * *note unicodedata.normalize(): 6d0. 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 bytecode changes<2>, Prev: Optimizations<3>, Up: What’s New In Python 3 11 + +1.3.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: +6d2. and *note Faster Runtime: 6d3. Optimizations not covered by this +project are listed separately under *note Optimizations: 6c7. + +* 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.3.9.1 Faster Startup +...................... + +* Menu: + +* Frozen imports / Static code objects:: + + +File: python.info, Node: Frozen imports / Static code objects, Up: Faster Startup + +1.3.9.2 Frozen imports / Static code objects +............................................ + +Python caches *note bytecode: 187. in the *note __pycache__: 6d7. +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 Code Objects: 5b1. (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.3.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.3.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: 6db. are now created only when requested +by debuggers or by Python introspection functions such as *note +sys._getframe(): 6dc. and *note inspect.currentframe(): 6dd. 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.3.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(): 4bf.). 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.3.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: 187. + +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.) + +Operation Form 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: 259, *note float: 2f1. and *note str: 447. 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: 60d, 10-25% Irit Katriel, Mark + *note tuple: 36b. and *note dict: 258. directly index the Shannon + underlying data structures. + + Subscripting custom *note __getitem__(): 285. is also + inlined similar to + *note Inlined Python function calls: 6de. + + +Store subscript ‘a[i] = z’ Similar to subscripting specialization above. 10-25% Dennis Sweeney + + +Calls ‘f(arg)’ Calls to common builtin (C) functions and types such as 20% Mark Shannon, Ken Jin + *note len(): 62a. and *note str: 447. 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: 60d. and *note tuple: 36b. 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.3.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: 6e4. 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: b9.’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.3.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.3.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.3.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.3.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.3.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.3.9.13 About +.............. + +Faster CPython explores optimizations for *note CPython: 6f1. 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 bytecode changes<2>, Next: Deprecated<3>, Prev: Faster CPython, Up: What’s New In Python 3 11 + +1.3.10 CPython bytecode changes +------------------------------- + +The bytecode now contains inline cache entries, which take the form of +the newly-added *note CACHE: 6f4. 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 bytecode changes<2> + +1.3.10.1 New opcodes +.................... + + * ‘ASYNC_GEN_WRAP’, *note RETURN_GENERATOR: 6f7. and *note SEND: 6f8, + used in generators and co-routines. + + * *note COPY_FREE_VARS: 6f9, which avoids needing special caller-side + code for closures. + + * *note JUMP_BACKWARD_NO_INTERRUPT: 6fa, for use in certain loops + where handling interrupts is undesirable. + + * *note MAKE_CELL: 6fb, to create *note Cell Objects: 6fc. + + * *note CHECK_EG_MATCH: 6fd. and ‘PREP_RERAISE_STAR’, to handle the + *note new exception groups and except*: 59d. added in PEP 654(1). + + * *note PUSH_EXC_INFO: 6fe, for use in exception handlers. + + * *note RESUME: 30f, 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 bytecode changes<2> + +1.3.10.2 Replaced opcodes +......................... + +Replaced Opcode(s) New Opcode(s) Notes + +-------------------------------------------------------------------------------------------------------------------------------- + + ‘BINARY_*’ *note BINARY_OP: 701. Replaced all numeric binary/in-place + ‘INPLACE_*’ opcodes with a single opcode + + + ‘CALL_FUNCTION’ *note CALL: 702. 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: 703. + + + ‘DUP_TOP’ *note COPY: 704. Stack manipulation instructions + ‘DUP_TOP_TWO’ *note SWAP: 705. + ‘ROT_TWO’ + ‘ROT_THREE’ + ‘ROT_FOUR’ + ‘ROT_N’ + + ‘JUMP_IF_NOT_EXC_MATCH’ *note CHECK_EXC_MATCH: 706. Now performs check but doesn’t jump + + + ‘JUMP_ABSOLUTE’ *note JUMP_BACKWARD: 707. 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’ *note BEFORE_WITH: 708. *note with: 5ce. 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 bytecode changes<2> + +1.3.10.3 Changed/removed opcodes +................................ + + * Changed *note MATCH_CLASS: 70d. and *note MATCH_KEYS: 70e. 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: Deprecated<3>, Next: Pending Removal in Python 3 12, Prev: CPython bytecode changes<2>, Up: What’s New In Python 3 11 + +1.3.11 Deprecated +----------------- + +This section lists Python APIs that have been deprecated in Python 3.11. + +Deprecated C APIs are *note listed separately: 712. +* Menu: + +* Language/Builtins:: +* Modules:: +* Standard Library:: + + +File: python.info, Node: Language/Builtins, Next: Modules, Up: Deprecated<3> + +1.3.11.1 Language/Builtins +.......................... + + * Chaining *note classmethod: 166. descriptors (introduced in + bpo-19072(1)) is now deprecated. It can no longer be used to wrap + other descriptors such as *note property: 194. The core design of + this feature was flawed and caused a number of downstream problems. + To “pass-through” a *note classmethod: 166, 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: + 1a5. In a future Python version, they will raise a *note + SyntaxWarning: 461. and eventually a *note SyntaxError: 18d. + (Contributed by Serhiy Storchaka in gh-81548(3).) + + * The delegation of *note int(): 259. to *note __trunc__(): 716. is + now deprecated. Calling ‘int(a)’ when ‘type(a)’ implements + ‘__trunc__()’ but not *note __int__(): 717. or *note __index__(): + 718. now raises a *note DeprecationWarning: 1a5. (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: Modules, Next: Standard Library, Prev: Language/Builtins, Up: Deprecated<3> + +1.3.11.2 Modules +................ + + * 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: Modules, Up: Deprecated<3> + +1.3.11.3 Standard Library +......................... + + * The following have been deprecated in *note configparser: 22. 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: 22. documentation. It now emits a *note + DeprecationWarning: 1a5. and will be removed in Python 3.13. Use + *note configparser.BasicInterpolation: 71d. or *note + configparser.ExtendedInterpolation: 71e. instead. (Contributed by + Hugo van Kemenade in bpo-46607(2).) + + * The older set of *note importlib.resources: 7b. 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(): 2dd. function is deprecated + and will be removed in Python 3.15. Use *note locale.setlocale(): + 2df, *note locale.getpreferredencoding(False): 536. and *note + locale.getlocale(): 2de. 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: 71f. Only sequences + of ASCII digits will now be accepted as a numerical reference, and + the group name in *note bytes: 1c2. 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: b9. 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(): 720. 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: 305, 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: 447. instead wherever possible. + (Contributed by Alex Waygood in gh-92332(8).) + + * The keyword argument syntax for constructing *note + typing.TypedDict: 162. 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: 115. itself. (Contributed by Donghee Na in + bpo-42255(10).) + + * The behavior of returning a value from a *note TestCase: 449. and + *note IsolatedAsyncioTestCase: 306. test methods (other than the + default ‘None’ value) is now deprecated. + + * Deprecated the following not-formally-documented *note unittest: + 106. functions, scheduled for removal in Python 3.13: + + * ‘unittest.findTestCases()’ + + * ‘unittest.makeSuite()’ + + * ‘unittest.getTestCaseNames()’ + + Use *note TestLoader: 290. methods instead: + + * *note unittest.TestLoader.loadTestsFromModule(): 291. + + * *note unittest.TestLoader.loadTestsFromTestCase(): 292. + + * *note unittest.TestLoader.getTestCaseNames(): 293. + + (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: Removed<3>, Prev: Deprecated<3>, Up: What’s New In Python 3 11 + +1.3.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: 724. + + * The ‘asynchat’ module + + * The ‘asyncore’ module + + * The *note entire distutils package: 725. + + * The ‘imp’ module + + * The *note typing.io: 726. namespace + + * The *note typing.re: 727. 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: 106.: + + Deprecated alias Method Name Deprecated in + + ----------------------------------------------------------------------------------------- + + ‘failUnless’ *note assertTrue(): 522. 3.1 + + + ‘failIf’ *note assertFalse(): 523. 3.1 + + + ‘failUnlessEqual’ *note assertEqual(): 524. 3.1 + + + ‘failIfEqual’ *note assertNotEqual(): 525. 3.1 + + + ‘failUnlessAlmostEqual’ *note assertAlmostEqual(): 526. 3.1 + + + ‘failIfAlmostEqual’ *note assertNotAlmostEqual(): 527. 3.1 + + + ‘failUnlessRaises’ *note assertRaises(): 528. 3.1 + + + ‘assert_’ *note assertTrue(): 522. 3.2 + + + ‘assertEquals’ *note assertEqual(): 524. 3.2 + + + ‘assertNotEquals’ *note assertNotEqual(): 525. 3.2 + + + ‘assertAlmostEquals’ *note assertAlmostEqual(): 526. 3.2 + + + ‘assertNotAlmostEquals’ *note assertNotAlmostEqual(): 527. 3.2 + + + ‘assertRegexpMatches’ *note assertRegex(): 529. 3.2 + + + ‘assertRaisesRegexp’ *note assertRaisesRegex(): 52a. 3.2 + + + ‘assertNotRegexpMatches’ *note assertNotRegex(): 52b. 3.5 + + + +File: python.info, Node: Removed<3>, Next: Porting to Python 3 11, Prev: Pending Removal in Python 3 12, Up: What’s New In Python 3 11 + +1.3.13 Removed +-------------- + +This section lists Python APIs that have been removed in Python 3.11. + +Removed C APIs are *note listed separately: 72b. + + * Removed the ‘@asyncio.coroutine()’ *note decorator: 72c. enabling + legacy generator-based coroutines to be compatible with *note + async: 72d. / *note await: 1b9. code. The function has been + deprecated since Python 3.8 and the removal was initially scheduled + for Python 3.10. Use *note async def: 5cd. 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(): 72e, 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: 10. + functions: + + * ‘binascii.a2b_hqx()’ + + * ‘binascii.b2a_hqx()’ + + * ‘binascii.rlecode_hqx()’ + + * ‘binascii.rldecode_hqx()’ + + The *note binascii.crc_hqx(): 72f. 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__(): 285. methods of *note + xml.dom.pulldom.DOMEventStream: 730, *note + wsgiref.util.FileWrapper: 731. and *note fileinput.FileInput: 732, + deprecated since Python 3.9. (Contributed by Hugo van Kemenade in + bpo-45132(6).) + + * Removed the deprecated *note gettext: 63. 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: 7e. module: + + * The ‘getargspec()’ function, deprecated since Python 3.0; use + *note inspect.signature(): 733. or *note + inspect.getfullargspec(): 734. instead. + + * The ‘formatargspec()’ function, deprecated since Python 3.5; + use the *note inspect.signature(): 733. function or the *note + inspect.Signature: 1cf. object directly. + + * The undocumented ‘Signature.from_builtin()’ and + ‘Signature.from_function()’ methods, deprecated since Python + 3.5; use the *note Signature.from_callable(): 735. method + instead. + + (Contributed by Hugo van Kemenade in bpo-45320(8).) + + * Removed the *note __class_getitem__(): 736. method from *note + pathlib.PurePath: 4a2, 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: 106. + 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: Removed<3>, Up: What’s New In Python 3 11 + +1.3.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: 73a. + + * *note open(): 517, *note io.open(): 518, *note codecs.open(): 73b. + and *note fileinput.FileInput: 732. 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: 73c. to these functions controls how + universal newlines work. (Contributed by Victor Stinner in + bpo-37330(1).) + + * *note ast.AST: 1a6. node positions are now validated when provided + to *note compile(): 192. and other related functions. If invalid + positions are detected, a *note ValueError: 204. will be raised. + (Contributed by Pablo Galindo in gh-93351(2)) + + * Prohibited passing non-*note concurrent.futures.ThreadPoolExecutor: + 73d. executors to *note asyncio.loop.set_default_executor(): 73e. + following a deprecation in Python 3.8. (Contributed by Illia + Volochii in bpo-43234(3).) + + * *note calendar: 14.: The *note calendar.LocaleTextCalendar: 73f. + and *note calendar.LocaleHTMLCalendar: 740. classes now use *note + locale.getlocale(): 2de, instead of using *note + locale.getdefaultlocale(): 2dd, if no locale is specified. + (Contributed by Victor Stinner in bpo-46659(4).) + + * The *note pdb: a5. 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(): 741. must be a + sequence, and automatic conversion of *note set: 5d5.s to *note + list: 60d.s is no longer supported. Also, if the sample size is + larger than the population size, a *note ValueError: 204. is + raised. (Contributed by Raymond Hettinger in bpo-40465(6).) + + * The 'random' optional parameter of *note random.shuffle(): 742. was + removed. It was previously an arbitrary random function to use for + the shuffle; now, *note random.random(): 743. (its previous + default) will always be used. + + * In *note re: b9. *note Regular Expression Syntax: 71f, 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: b9. 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 Changes<3>, Prev: Porting to Python 3 11, Up: What’s New In Python 3 11 + +1.3.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: f0. 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: f0. 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: 746, 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 *note -without-freelists: 747. 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).) + + Note: 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: 259. 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: 748. 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 Changes<3>, Next: Notable changes in 3 11 4, Prev: Build Changes<3>, Up: What’s New In Python 3 11 + +1.3.16 C API Changes +-------------------- + +* Menu: + +* New Features: New Features<6>. +* Porting to Python 3.11: Porting to Python 3 11<2>. +* Deprecated: Deprecated<4>. +* Pending Removal in Python 3.12: Pending Removal in Python 3 12<2>. +* Removed: Removed<4>. + + +File: python.info, Node: New Features<6>, Next: Porting to Python 3 11<2>, Up: C API Changes<3> + +1.3.16.1 New Features +..................... + + * Add a new *note PyType_GetName(): 74d. function to get type’s short + name. (Contributed by Hai Shi in bpo-42035(1).) + + * Add a new *note PyType_GetQualName(): 74e. function to get type’s + qualified name. (Contributed by Hai Shi in bpo-42035(2).) + + * Add new *note PyThreadState_EnterTracing(): 74f. and *note + PyThreadState_LeaveTracing(): 750. 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: 751. constant which bears the same + value as *note PY_VERSION_HEX: 752. (Contributed by Gabriele N. + Tornetta in bpo-43931(4).) + + * *note Py_buffer: 753. and APIs are now part of the limited API and + the stable ABI: + + * *note PyObject_CheckBuffer(): 394. + + * *note PyObject_GetBuffer(): 395. + + * *note PyBuffer_GetPointer(): 754. + + * *note PyBuffer_SizeFromFormat(): 755. + + * *note PyBuffer_ToContiguous(): 756. + + * *note PyBuffer_FromContiguous(): 757. + + * *note PyObject_CopyData(): 758. + + * *note PyBuffer_IsContiguous(): 759. + + * *note PyBuffer_FillContiguousStrides(): 75a. + + * *note PyBuffer_FillInfo(): 75b. + + * *note PyBuffer_Release(): 396. + + * *note PyMemoryView_FromBuffer(): 75c. + + * *note bf_getbuffer: 75d. and *note bf_releasebuffer: 75e. type + slots + + (Contributed by Christian Heimes in bpo-45459(5).) + + * Added the *note PyType_GetModuleByDef(): 38f. function, used to get + the module in which a method was defined, in cases where this + information is not available directly (via *note PyCMethod: 75f.). + (Contributed by Petr Viktorin in bpo-46613(6).) + + * Add new functions to pack and unpack C double (serialize and + deserialize): *note PyFloat_Pack2(): 760, *note PyFloat_Pack4(): + 761, *note PyFloat_Pack8(): 762, *note PyFloat_Unpack2(): 763, + *note PyFloat_Unpack4(): 764. and *note PyFloat_Unpack8(): 765. + (Contributed by Victor Stinner in bpo-46906(7).) + + * Add new functions to get frame object attributes: *note + PyFrame_GetBuiltins(): 766, *note PyFrame_GetGenerator(): 767, + *note PyFrame_GetGlobals(): 768, *note PyFrame_GetLasti(): 769. + + * Added two new functions to get and set the active exception + instance: *note PyErr_GetHandledException(): 76a. and *note + PyErr_SetHandledException(): 76b. These are alternatives to *note + PyErr_SetExcInfo(): 76c. and *note PyErr_GetExcInfo(): 76d. which + work with the legacy 3-tuple representation of exceptions. + (Contributed by Irit Katriel in bpo-46343(8).) + + * Added the *note PyConfig.safe_path: 76e. 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: Deprecated<4>, Prev: New Features<6>, Up: C API Changes<3> + +1.3.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(): 76c. 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(): 76d. 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: 770. 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(): 771. 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: 772. no longer has the ‘co_code’, + ‘co_varnames’, ‘co_cellvars’ and ‘co_freevars’ fields. Instead, + use *note PyCode_GetCode(): 773, *note PyCode_GetVarnames(): 774, + *note PyCode_GetCellvars(): 775. and *note PyCode_GetFreevars(): + 776. 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(): 777. function now raises an error if a + type is defined with the *note Py_TPFLAGS_HAVE_GC: 778. flag set + but has no traverse function (*note PyTypeObject.tp_traverse: + 779.). (Contributed by Victor Stinner in bpo-44263(11).) + + * Heap types with the *note Py_TPFLAGS_IMMUTABLETYPE: 3be. flag can + now inherit the PEP 590(12) vectorcall protocol. Previously, this + was only possible for *note static types: 77a. (Contributed by + Erlend E. Aasland in bpo-43908(13)) + + * Since *note Py_TYPE(): 77b. 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(): 77c. 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(): 77d. 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(): 77e. 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).) + + * ‘’ no longer includes the header files ‘’, + ‘’, ‘’ and ‘’ 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 + ’. (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: 77f. 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 ’, it’s no longer needed to add ‘#include + ’: + + * *note PyFrame_Check(): 780. + + * *note PyFrame_GetBack(): 781. + + * *note PyFrame_GetBuiltins(): 766. + + * *note PyFrame_GetGenerator(): 767. + + * *note PyFrame_GetGlobals(): 768. + + * *note PyFrame_GetLasti(): 769. + + * *note PyFrame_GetLocals(): 41b. + + * *note PyFrame_Type: 782. + + (Contributed by Victor Stinner in gh-93937(19).) + + * The *note PyFrameObject: 784. structure members have been removed + from the public C API. + + While the documentation notes that the *note PyFrameObject: 784. + 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: 784. fields: + + * ‘f_back’: use *note PyFrame_GetBack(): 781. + + * ‘f_blockstack’: removed. + + * ‘f_builtins’: use *note PyFrame_GetBuiltins(): 766. + + * ‘f_code’: use *note PyFrame_GetCode(): 785. + + * ‘f_gen’: use *note PyFrame_GetGenerator(): 767. + + * ‘f_globals’: use *note PyFrame_GetGlobals(): 768. + + * ‘f_iblock’: removed. + + * ‘f_lasti’: use *note PyFrame_GetLasti(): 769. Code using + ‘f_lasti’ with ‘PyCode_Addr2Line()’ should use *note + PyFrame_GetLineNumber(): 786. instead; it may be faster. + + * ‘f_lineno’: use *note PyFrame_GetLineNumber(): 786. + + * ‘f_locals’: use *note PyFrame_GetLocals(): 41b. + + * ‘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: 787. member must not be accessed directly, + since its value is now also computed lazily. The *note + PyFrame_GetBack(): 781. function must be called instead. + + Debuggers that accessed the *note f_locals: 182. directly 'must' + call *note PyFrame_GetLocals(): 41b. 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: 788. structure members: + + * ‘frame’: removed, use *note PyThreadState_GetFrame(): 789. + (function added to Python 3.9 by bpo-40429(21)). Warning: the + function returns a *note strong reference: 338, need to call + *note Py_XDECREF(): 78a. + + * ‘tracing’: changed, use *note PyThreadState_EnterTracing(): + 74f. and *note PyThreadState_LeaveTracing(): 750. (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: 5eb. field must now be + set to 1 for initialization to use *note + PyConfig.module_search_paths: 39e. to initialize *note sys.path: + 3b0. Otherwise, initialization will recalculate the path and + replace any values added to ‘module_search_paths’. + + * *note PyConfig_Read(): 78b. no longer calculates the initial search + path, and will not fill any values into *note + PyConfig.module_search_paths: 39e. To calculate default paths and + then modify them, finish initialization and use *note + PySys_GetObject(): 384. to retrieve *note sys.path: 3b0. 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: Deprecated<4>, Next: Pending Removal in Python 3 12<2>, Prev: Porting to Python 3 11<2>, Up: C API Changes<3> + +1.3.16.3 Deprecated +................... + + * 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: 3a2. API of the *note Python + Initialization Configuration: 3a3. instead ( PEP 587(1)). + (Contributed by Victor Stinner in gh-88279(2).) + + * Deprecate the ‘ob_shash’ member of the *note PyBytesObject: 78d. + Use *note PyObject_Hash(): 3ff. 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: Removed<4>, Prev: Deprecated<4>, Up: C API Changes<3> + +1.3.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(): 3fd. + + * ‘PyUnicode_WSTR_LENGTH()’ + + * ‘_PyUnicode_AsUnicode()’ + + * ‘PyUnicode_WCHAR_KIND’ + + * *note PyUnicodeObject: 78f. + + * ‘PyUnicode_InternImmortal()’ + + +File: python.info, Node: Removed<4>, Prev: Pending Removal in Python 3 12<2>, Up: C API Changes<3> + +1.3.16.5 Removed +................ + + * ‘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()’ + + (Contributed by Victor Stinner in 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 ‘’ + 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: 41a. is defined: + + * *note PyMarshal_WriteLongToFile(): 791. + + * *note PyMarshal_WriteObjectToFile(): 792. + + * *note PyMarshal_ReadObjectFromString(): 793. + + * *note PyMarshal_WriteObjectToString(): 794. + + * the ‘Py_MARSHAL_VERSION’ macro + + These are not part of the *note limited API: 795. + + (Contributed by Victor Stinner in bpo-45474(6).) + + * Exclude *note PyWeakref_GET_OBJECT(): 3bb. 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: 3e9. encoder APIs, as they have been + deprecated since Python 3.3, are little used and are inefficient + relative to the recommended alternatives. + + The removed functions are: + + * ‘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: Notable changes in 3 11 4, Next: Notable changes in 3 11 5, Prev: C API Changes<3>, Up: What’s New In Python 3 11 + +1.3.17 Notable changes in 3.11.4 +-------------------------------- + +* Menu: + +* tarfile: tarfile<2>. + + +File: python.info, Node: tarfile<2>, Up: Notable changes in 3 11 4 + +1.3.17.1 tarfile +................ + + * The extraction methods in *note tarfile: de, and *note + shutil.unpack_archive(): 467, 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: 468. for details. In Python 3.12, use + without the 'filter' argument will show a *note DeprecationWarning: + 1a5. 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: Notable changes in 3 11 5, Prev: Notable changes in 3 11 4, Up: What’s New In Python 3 11 + +1.3.18 Notable changes in 3.11.5 +-------------------------------- + +* Menu: + +* OpenSSL:: + + +File: python.info, Node: OpenSSL, Up: Notable changes in 3 11 5 + +1.3.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.4 What’s New In Python 3.10 +============================= + + +Editor: Pablo Galindo Salgado + +This article explains the new features in Python 3.10, compared to 3.9. +Python 3.10 was released on October 4, 2021. For full details, see the +*note changelog: 13c. + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<3>. +* New Features: New Features<7>. +* New Features Related to Type Hints: New Features Related to Type Hints<3>. +* Other Language Changes: Other Language Changes<4>. +* New Modules: New Modules<4>. +* Improved Modules: Improved Modules<4>. +* Optimizations: Optimizations<4>. +* Deprecated: Deprecated<5>. +* Removed: Removed<5>. +* Porting to Python 3.10: Porting to Python 3 10. +* CPython bytecode changes: CPython bytecode changes<3>. +* Build Changes: Build Changes<4>. +* C API Changes: C API Changes<4>. +* 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: Summary – Release highlights<3>, Next: New Features<7>, Up: What’s New In Python 3 10 + +1.4.1 Summary – Release highlights +---------------------------------- + +New syntax features: + + * PEP 634(1), Structural Pattern Matching: Specification + + * PEP 635(2), Structural Pattern Matching: Motivation and Rationale + + * PEP 636(3), Structural Pattern Matching: Tutorial + + * bpo-12782(4), Parenthesized context managers are now officially + allowed. + +New features in the standard library: + + * PEP 618(5), Add Optional Length-Checking To zip. + +Interpreter improvements: + + * PEP 626(6), Precise line numbers for debugging and other tools. + +New typing features: + + * PEP 604(7), Allow writing union types as X | Y + + * PEP 612(8), Parameter Specification Variables + + * PEP 613(9), Explicit Type Aliases + + * PEP 647(10), User-Defined Type Guards + +Important deprecations, removals or restrictions: + + * PEP 644(11), Require OpenSSL 1.1.1 or newer + + * PEP 632(12), Deprecate distutils module. + + * PEP 623(13), Deprecate and prepare for the removal of the wstr + member in PyUnicodeObject. + + * PEP 624(14), Remove Py_UNICODE encoder APIs + + * PEP 597(15), Add optional 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: New Features<7>, Next: New Features Related to Type Hints<3>, Prev: Summary – Release highlights<3>, Up: What’s New In Python 3 10 + +1.4.2 New Features +------------------ + +* Menu: + +* Parenthesized context managers:: +* Better error messages:: +* PEP 626; Precise line numbers for debugging and other tools: PEP 626 Precise line numbers for debugging and other tools. +* PEP 634; Structural Pattern Matching: PEP 634 Structural Pattern Matching. +* Optional EncodingWarning and encoding="locale" option:: + + +File: python.info, Node: Parenthesized context managers, Next: Better error messages, Up: New Features<7> + +1.4.2.1 Parenthesized context managers +...................................... + +Using enclosing parentheses for continuation across multiple lines in +context managers is now supported. This allows formatting a long +collection of context managers in multiple lines in a similar way as it +was previously possible with import statements. For instance, all these +examples are now valid: + + with (CtxManager() as example): + ... + + with ( + CtxManager1(), + CtxManager2() + ): + ... + + with (CtxManager1() as example, + CtxManager2()): + ... + + with (CtxManager1(), + CtxManager2() as example): + ... + + with ( + CtxManager1() as example1, + CtxManager2() as example2 + ): + ... + +it is also possible to use a trailing comma at the end of the enclosed +group: + + with ( + CtxManager1() as example1, + CtxManager2() as example2, + CtxManager3() as example3, + ): + ... + +This new syntax uses the non LL(1) capacities of the new parser. Check +PEP 617(1) for more details. + +(Contributed by Guido van Rossum, Pablo Galindo and Lysandros Nikolaou +in bpo-12782(2) and 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: Better error messages, Next: PEP 626 Precise line numbers for debugging and other tools, Prev: Parenthesized context managers, Up: New Features<7> + +1.4.2.2 Better error messages +............................. + +* Menu: + +* SyntaxErrors:: +* IndentationErrors:: +* AttributeErrors:: +* NameErrors:: + + +File: python.info, Node: SyntaxErrors, Next: IndentationErrors, Up: Better error messages + +1.4.2.3 SyntaxErrors +.................... + +When parsing code that contains unclosed parentheses or brackets the +interpreter now includes the location of the unclosed bracket of +parentheses instead of displaying 'SyntaxError: unexpected EOF while +parsing' or pointing to some incorrect location. For instance, consider +the following code (notice the unclosed ‘{‘): + + 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() + +Previous versions of the interpreter reported confusing places as the +location of the syntax error: + + File "example.py", line 3 + some_other_code = foo() + ^ + SyntaxError: invalid syntax + +but in Python 3.10 a more informative error is emitted: + + 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 + +In a similar way, errors involving unclosed string literals (single and +triple quoted) now point to the start of the string instead of reporting +EOF/EOL. + +These improvements are inspired by previous work in the PyPy +interpreter. + +(Contributed by Pablo Galindo in bpo-42864(1) and Batuhan Taskaya in +bpo-40176(2).) + +*note SyntaxError: 18d. exceptions raised by the interpreter will now +highlight the full error range of the expression that constitutes the +syntax error itself, instead of just where the problem is detected. In +this way, instead of displaying (before Python 3.10): + + >>> foo(x, z for z in range(10), t, w) + File "", line 1 + foo(x, z for z in range(10), t, w) + ^ + SyntaxError: Generator expression must be parenthesized + +now Python 3.10 will display the exception as: + + >>> foo(x, z for z in range(10), t, w) + File "", line 1 + foo(x, z for z in range(10), t, w) + ^^^^^^^^^^^^^^^^^^^^ + SyntaxError: Generator expression must be parenthesized + +This improvement was contributed by Pablo Galindo in bpo-43914(3). + +A considerable amount of new specialized messages for *note SyntaxError: +18d. exceptions have been incorporated. Some of the most notable ones +are as follows: + + * Missing ‘:’ before blocks: + + >>> if rocket.position > event_horizon + File "", line 1 + if rocket.position > event_horizon + ^ + SyntaxError: expected ':' + + (Contributed by Pablo Galindo in bpo-42997(4).) + + * Unparenthesised tuples in comprehensions targets: + + >>> {x,y for x,y in zip('abcd', '1234')} + File "", line 1 + {x,y for x,y in zip('abcd', '1234')} + ^ + SyntaxError: did you forget parentheses around the comprehension target? + + (Contributed by Pablo Galindo in bpo-43017(5).) + + * Missing commas in collection literals and between expressions: + + >>> items = { + ... x: 1, + ... y: 2 + ... z: 3, + File "", line 3 + y: 2 + ^ + SyntaxError: invalid syntax. Perhaps you forgot a comma? + + (Contributed by Pablo Galindo in bpo-43822(6).) + + * Multiple Exception types without parentheses: + + >>> try: + ... build_dyson_sphere() + ... except NotEnoughScienceError, NotEnoughResourcesError: + File "", line 3 + except NotEnoughScienceError, NotEnoughResourcesError: + ^ + SyntaxError: multiple exception types must be parenthesized + + (Contributed by Pablo Galindo in bpo-43149(7).) + + * Missing ‘:’ and values in dictionary literals: + + >>> values = { + ... x: 1, + ... y: 2, + ... z: + ... } + File "", line 4 + z: + ^ + SyntaxError: expression expected after dictionary key and ':' + + >>> values = {x:1, y:2, z w:3} + File "", line 1 + values = {x:1, y:2, z w:3} + ^ + SyntaxError: ':' expected after dictionary key + + (Contributed by Pablo Galindo in bpo-43823(8).) + + * ‘try’ blocks without ‘except’ or ‘finally’ blocks: + + >>> try: + ... x = 2 + ... something = 3 + File "", line 3 + something = 3 + ^^^^^^^^^ + SyntaxError: expected 'except' or 'finally' block + + (Contributed by Pablo Galindo in bpo-44305(9).) + + * Usage of ‘=’ instead of ‘==’ in comparisons: + + >>> if rocket.position = event_horizon: + File "", line 1 + if rocket.position = event_horizon: + ^ + SyntaxError: cannot assign to attribute here. Maybe you meant '==' instead of '='? + + (Contributed by Pablo Galindo in bpo-43797(10).) + + * Usage of ‘*’ in f-strings: + + >>> f"Black holes {*all_black_holes} and revelations" + File "", line 1 + (*all_black_holes) + ^ + SyntaxError: f-string: cannot use starred expression here + + (Contributed by Pablo Galindo in 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: Better error messages + +1.4.2.4 IndentationErrors +......................... + +Many *note IndentationError: 7a3. exceptions now have more context +regarding what kind of block was expecting an indentation, including the +location of the statement: + + >>> def foo(): + ... if lel: + ... x = 2 + File "", 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: Better error messages + +1.4.2.5 AttributeErrors +....................... + +When printing *note AttributeError: 348, ‘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 "", line 1, in + AttributeError: module 'collections' has no attribute 'namedtoplo'. Did you mean: namedtuple? + +(Contributed by Pablo Galindo in bpo-38530(1).) + + Warning: 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: Better error messages + +1.4.2.6 NameErrors +.................. + +When printing *note NameError: 43a. 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 "", line 1, in + NameError: name 'schwarschild_black_hole' is not defined. Did you mean: schwarzschild_black_hole? + +(Contributed by Pablo Galindo in bpo-38530(1).) + + Warning: 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 Precise line numbers for debugging and other tools, Next: PEP 634 Structural Pattern Matching, Prev: Better error messages, Up: New Features<7> + +1.4.2.7 PEP 626: Precise line numbers for debugging and other tools +................................................................... + +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: 7a7. attribute of frame objects will always contain +the expected line number. + +The *note co_lnotab: 2e4. attribute of *note code objects: 1d2. 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(): 2f5. method +instead. + + +File: python.info, Node: PEP 634 Structural Pattern Matching, Next: Optional EncodingWarning and encoding="locale" option, Prev: PEP 626 Precise line numbers for debugging and other tools, Up: New Features<7> + +1.4.2.8 PEP 634: Structural Pattern Matching +............................................ + +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: + +* Syntax and operations:: +* Declarative approach:: +* Simple pattern; match to a literal: Simple pattern match to a literal. +* Patterns with a literal and variable:: +* Patterns and classes:: +* Nested patterns:: +* Complex patterns and the wildcard:: +* Guard:: +* Other Key Features:: + + +File: python.info, Node: Syntax and operations, Next: Declarative approach, Up: PEP 634 Structural Pattern Matching + +1.4.2.9 Syntax and operations +............................. + +The generic syntax of pattern matching is: + + match subject: + case : + + case : + + case : + + case _: + + +A match statement takes an expression and compares its value to +successive patterns given as one or more case blocks. Specifically, +pattern matching operates by: + + 1. using data with type and shape (the ‘subject’) + + 2. evaluating the ‘subject’ in the ‘match’ statement + + 3. comparing the subject with each pattern in a ‘case’ statement from + top to bottom until a match is confirmed. + + 4. executing the action associated with the pattern of the confirmed + match + + 5. If an exact match is not confirmed, the last case, a wildcard ‘_’, + if provided, will be used as the matching case. If an exact match + is not confirmed and a wildcard case does not exist, the entire + match block is a no-op. + + +File: python.info, Node: Declarative approach, Next: Simple pattern match to a literal, Prev: Syntax and operations, Up: PEP 634 Structural Pattern Matching + +1.4.2.10 Declarative approach +............................. + +Readers may be aware of pattern matching through the simple example of +matching a subject (data object) to a literal (pattern) with the switch +statement found in C, Java or JavaScript (and many other languages). +Often the switch statement is used for comparison of an +object/expression with case statements containing literals. + +More powerful examples of pattern matching can be found in languages +such as Scala and Elixir. With structural pattern matching, the +approach is “declarative” and explicitly states the conditions (the +patterns) for data to match. + +While an “imperative” series of instructions using nested “if” +statements could be used to accomplish something similar to structural +pattern matching, it is less clear than the “declarative” approach. +Instead the “declarative” approach states the conditions to meet for a +match and is more readable through its explicit patterns. While +structural pattern matching can be used in its simplest form comparing a +variable to a literal in a case statement, its true value for Python +lies in its handling of the subject’s type and shape. + + +File: python.info, Node: Simple pattern match to a literal, Next: Patterns with a literal and variable, Prev: Declarative approach, Up: PEP 634 Structural Pattern Matching + +1.4.2.11 Simple pattern: match to a literal +........................................... + +Let’s look at this example as pattern matching in its simplest form: a +value, the subject, being matched to several literals, the patterns. In +the example below, ‘status’ is the subject of the match statement. The +patterns are each of the case statements, where literals represent +request status codes. The associated action to the case is executed +after a match: + + 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" + +If the above function is passed a ‘status’ of 418, “I’m a teapot” is +returned. If the above function is passed a ‘status’ of 500, the case +statement with ‘_’ will match as a wildcard, and “Something’s wrong with +the internet” is returned. Note the last block: the variable name, ‘_’, +acts as a 'wildcard' and insures the subject will always match. The use +of ‘_’ is optional. + +You can combine several literals in a single pattern using ‘|’ (“or”): + + case 401 | 403 | 404: + return "Not allowed" + +* Menu: + +* Behavior without the wildcard:: + + +File: python.info, Node: Behavior without the wildcard, Up: Simple pattern match to a literal + +1.4.2.12 Behavior without the wildcard +...................................... + +If we modify the above example by removing the last case block, the +example becomes: + + def http_error(status): + match status: + case 400: + return "Bad request" + case 404: + return "Not found" + case 418: + return "I'm a teapot" + +Without the use of ‘_’ in a case statement, a match may not exist. If +no match exists, the behavior is a no-op. For example, if ‘status’ of +500 is passed, a no-op occurs. + + +File: python.info, Node: Patterns with a literal and variable, Next: Patterns and classes, Prev: Simple pattern match to a literal, Up: PEP 634 Structural Pattern Matching + +1.4.2.13 Patterns with a literal and variable +............................................. + +Patterns can look like unpacking assignments, and a pattern may be used +to bind variables. In this example, a data point can be unpacked to its +x-coordinate and y-coordinate: + + # point is an (x, y) tuple + 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") + +The first pattern has two literals, ‘(0, 0)’, and may be thought of as +an extension of the literal pattern shown above. The next two patterns +combine a literal and a variable, and the variable 'binds' a value from +the subject (‘point’). The fourth pattern captures two values, which +makes it conceptually similar to the unpacking assignment ‘(x, y) = +point’. + + +File: python.info, Node: Patterns and classes, Next: Nested patterns, Prev: Patterns with a literal and variable, Up: PEP 634 Structural Pattern Matching + +1.4.2.14 Patterns and classes +............................. + +If you are using classes to structure your data, you can use as a +pattern the class name followed by an argument list resembling a +constructor. This pattern has the ability to capture instance +attributes into variables: + + 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("Origin is the point's location.") + case Point(x=0, y=y): + print(f"Y={y} and the point is on the y-axis.") + case Point(x=x, y=0): + print(f"X={x} and the point is on the x-axis.") + case Point(): + print("The point is located somewhere else on the plane.") + case _: + print("Not a point") + +* Menu: + +* Patterns with positional parameters:: + + +File: python.info, Node: Patterns with positional parameters, Up: Patterns and classes + +1.4.2.15 Patterns with positional parameters +............................................ + +You can use positional parameters with some builtin classes that provide +an ordering for their attributes (e.g. dataclasses). You can also +define a specific position for attributes in patterns by setting the +‘__match_args__’ special attribute in your classes. If it’s set to +(“x”, “y”), the following patterns are all equivalent (and all bind the +‘y’ attribute to the ‘var’ variable): + + Point(1, var) + Point(1, y=var) + Point(x=1, y=var) + Point(y=var, x=1) + + +File: python.info, Node: Nested patterns, Next: Complex patterns and the wildcard, Prev: Patterns and classes, Up: PEP 634 Structural Pattern Matching + +1.4.2.16 Nested patterns +........................ + +Patterns can be arbitrarily nested. For example, if our data is a short +list of points, it could be matched like this: + + match points: + case []: + print("No points in the list.") + case [Point(0, 0)]: + print("The origin is the only point in the list.") + case [Point(x, y)]: + print(f"A single point {x}, {y} is in the list.") + case [Point(0, y1), Point(0, y2)]: + print(f"Two points on the Y axis at {y1}, {y2} are in the list.") + case _: + print("Something else is found in the list.") + + +File: python.info, Node: Complex patterns and the wildcard, Next: Guard, Prev: Nested patterns, Up: PEP 634 Structural Pattern Matching + +1.4.2.17 Complex patterns and the wildcard +.......................................... + +To this point, the examples have used ‘_’ alone in the last case +statement. A wildcard can be used in more complex patterns, such as +‘('error', code, _)’. For example: + + match test_variable: + case ('warning', code, 40): + print("A warning has been received.") + case ('error', code, _): + print(f"An error {code} occurred.") + +In the above case, ‘test_variable’ will match for (‘error’, code, 100) +and (‘error’, code, 800). + + +File: python.info, Node: Guard, Next: Other Key Features, Prev: Complex patterns and the wildcard, Up: PEP 634 Structural Pattern Matching + +1.4.2.18 Guard +.............. + +We can add an ‘if’ clause to a pattern, known as a “guard”. If the +guard is false, ‘match’ goes on to try the next case block. Note that +value capture happens before the guard is evaluated: + + match point: + case Point(x, y) if x == y: + print(f"The point is located on the diagonal Y=X at {x}.") + case Point(x, y): + print(f"Point is not on the diagonal.") + + +File: python.info, Node: Other Key Features, Prev: Guard, Up: PEP 634 Structural Pattern Matching + +1.4.2.19 Other Key Features +........................... + +Several other key features: + + - Like unpacking assignments, tuple and list patterns have exactly + the same meaning and actually match arbitrary sequences. + Technically, the subject must be a sequence. Therefore, an + important exception is that patterns don’t match iterators. Also, + to prevent a common mistake, sequence patterns don’t match strings. + + - Sequence patterns support wildcards: ‘[x, y, *rest]’ and ‘(x, y, + *rest)’ work similar to wildcards in unpacking assignments. The + name after ‘*’ may also be ‘_’, so ‘(x, y, *_)’ matches a sequence + of at least two items without binding the remaining items. + + - Mapping patterns: ‘{"bandwidth": b, "latency": l}’ captures the + ‘"bandwidth"’ and ‘"latency"’ values from a dict. Unlike sequence + patterns, extra keys are ignored. A wildcard ‘**rest’ is also + supported. (But ‘**_’ would be redundant, so is not allowed.) + + - Subpatterns may be captured using the ‘as’ keyword: + + case (Point(x1, y1), Point(x2, y2) as p2): ... + + This binds x1, y1, x2, y2 like you would expect without the ‘as’ + clause, and p2 to the entire second item of the subject. + + - Most literals are compared by equality. However, the singletons + ‘True’, ‘False’ and ‘None’ are compared by identity. + + - Named constants may be used in patterns. These named constants + must be dotted names to prevent the constant from being interpreted + as a capture variable: + + 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 :(") + +For the full specification see PEP 634(1). Motivation and rationale are +in PEP 635(2), and a longer tutorial is in 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 Structural Pattern Matching, Up: New Features<7> + +1.4.2.20 Optional ‘EncodingWarning’ and ‘encoding="locale"’ option +.................................................................. + +The default encoding of *note TextIOWrapper: 7b6. and *note open(): 517. +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: 688. is true and +locale-specific default encoding is used. + +‘-X warn_default_encoding’ option and *note PYTHONWARNDEFAULTENCODING: +7b7. are added to enable the warning. + +See *note Text Encoding: 7b8. for more information. + + +File: python.info, Node: New Features Related to Type Hints<3>, Next: Other Language Changes<4>, Prev: New Features<7>, Up: What’s New In Python 3 10 + +1.4.3 New Features Related to Type Hints +---------------------------------------- + +This section covers major changes affecting PEP 484(1) type hints and +the *note typing: 104. 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: New Features Related to Type Hints<3> + +1.4.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: 637, especially in type hints. + +In previous versions of Python, to apply a type hint for functions +accepting arguments of multiple types, *note typing.Union: 637. 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(): 43d. and *note issubclass(): 7bc.: + + >>> isinstance(1, int | str) + True + +See *note Union Type: 7bd. 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: New Features Related to Type Hints<3> + +1.4.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: 104. 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: 15e. +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: +7bf. + +See *note typing.Callable: 7c0, *note typing.ParamSpec: 15e, *note +typing.Concatenate: 7bf, *note typing.ParamSpecArgs: 7c1, *note +typing.ParamSpecKwargs: 7c2, 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: New Features Related to Type Hints<3> + +1.4.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: 104. module has a special value *note TypeAlias: +7c4. which lets you declare type aliases more explicitly: + + StrCache: TypeAlias = 'Cache[str]' # a type alias + LOG_PREFIX = 'LOG[DEBUG]' # a module constant + +See PEP 613(2) for more details. + +(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: New Features Related to Type Hints<3> + +1.4.3.4 PEP 647: User-Defined Type Guards +......................................... + +*note TypeGuard: 164. has been added to the *note typing: 104. module to +annotate type guard functions and improve information provided to static +type checkers during type narrowing. For more information, please see +*note TypeGuard: 164.‘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: Other Language Changes<4>, Next: New Modules<4>, Prev: New Features Related to Type Hints<3>, Up: What’s New In Python 3 10 + +1.4.4 Other Language Changes +---------------------------- + + * The *note int: 259. type has a new method *note int.bit_count(): + 7c7, 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(): 7c8, *note dict.values(): + 7c9. and *note dict.items(): 7ca. now all have a ‘mapping’ + attribute that gives a *note types.MappingProxyType: 469. object + wrapping the original dictionary. (Contributed by Dennis Sweeney + in bpo-40890(2).) + + * PEP 618(3): The *note zip(): 7cb. 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: 29f.s, *note Fraction: 1e9.s and other + objects that can be converted to integers only with a loss (e.g. + that have the *note __int__(): 717. method but do not have the + *note __index__(): 718. method). (Contributed by Serhiy Storchaka + in bpo-37999(4).) + + * If *note object.__ipow__(): 7cc. returns *note NotImplemented: 7cd, + the operator will correctly fall back to *note object.__pow__(): + 7ce. and *note object.__rpow__(): 7cf. 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(): 7d0. and *note anext(): + 7d1. have been added to provide asynchronous counterparts to *note + iter(): 7d2. and *note next(): 7d3, respectively. (Contributed by + Joshua Bronson, Daniel Pope, and Justin Wang in bpo-31861(7).) + + * Static methods (*note @staticmethod: 412.) and class methods (*note + @classmethod: 166.) now inherit the method attributes + (‘__module__’, ‘__name__’, ‘__qualname__’, ‘__doc__’, + ‘__annotations__’) and have a new ‘__wrapped__’ attribute. + Moreover, static methods are now callable as regular functions. + (Contributed by Victor Stinner in bpo-43682(8).) + + * Annotations for complex targets (everything beside ‘simple name’ + targets defined by PEP 526(9)) no longer cause any runtime effects + with ‘from __future__ import annotations’. (Contributed by Batuhan + Taskaya in bpo-42737(10).) + + * Class and module objects now lazy-create empty annotations dicts on + demand. The annotations dicts are stored in the object’s + ‘__dict__’ for backwards compatibility. This improves the best + practices for working with ‘__annotations__’; for more information, + please see *note Annotations Best Practices: 7d4. (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: 2f1. type and *note + decimal.Decimal: 29f. 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: 18d. (instead of a *note NameError: 43a.) will + be raised when deleting the *note __debug__: 7d5. constant. + (Contributed by Donghee Na in bpo-45000(15).) + + * *note SyntaxError: 18d. 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: New Modules<4>, Next: Improved Modules<4>, Prev: Other Language Changes<4>, Up: What’s New In Python 3 10 + +1.4.5 New Modules +----------------- + + * None. + + +File: python.info, Node: Improved Modules<4>, Next: Optimizations<4>, Prev: New Modules<4>, Up: What’s New In Python 3 10 + +1.4.6 Improved Modules +---------------------- + +* Menu: + +* asyncio: asyncio<4>. +* argparse: argparse<2>. +* array: array<3>. +* asynchat, asyncore, smtpd: asynchat asyncore smtpd. +* base64: base64<2>. +* bdb:: +* bisect:: +* codecs:: +* collections.abc: collections abc. +* contextlib: contextlib<2>. +* curses:: +* dataclasses: dataclasses<2>. +* distutils: distutils<2>. +* doctest: doctest<2>. +* encodings:: +* enum: enum<4>. +* fileinput:: +* faulthandler:: +* gc:: +* glob: glob<2>. +* hashlib: hashlib<3>. +* hmac:: +* IDLE and idlelib: IDLE and idlelib<2>. +* importlib.metadata: importlib metadata<2>. +* inspect: inspect<3>. +* itertools: itertools<3>. +* linecache:: +* os: os<4>. +* os.path: os path<4>. +* pathlib: pathlib<5>. +* platform: platform<2>. +* pprint:: +* py_compile:: +* pyclbr:: +* shelve:: +* statistics: statistics<3>. +* site: site<2>. +* socket: socket<2>. +* ssl: ssl<3>. +* sqlite3: sqlite3<5>. +* sys: sys<5>. +* _thread:: +* threading: threading<3>. +* traceback: traceback<3>. +* types: types<3>. +* typing: typing<5>. +* unittest: unittest<5>. +* urllib.parse: urllib parse. +* xml: xml<2>. +* zipimport: zipimport<3>. + + +File: python.info, Node: asyncio<4>, Next: argparse<2>, Up: Improved Modules<4> + +1.4.6.1 asyncio +............... + +Add missing ‘connect_accepted_socket()’ 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<2>, Next: array<3>, Prev: asyncio<4>, Up: Improved Modules<4> + +1.4.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<2>, Up: Improved Modules<4> + +1.4.6.3 array +............. + +The *note index(): 7db. method of *note array.array: 1a0. 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<2>, Prev: array<3>, Up: Improved Modules<4> + +1.4.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: 1a5. has now been added to all three of these +modules. + + +File: python.info, Node: base64<2>, Next: bdb, Prev: asynchat asyncore smtpd, Up: Improved Modules<4> + +1.4.6.5 base64 +.............. + +Add *note base64.b32hexencode(): 7de. and *note base64.b32hexdecode(): +7df. to support the Base32 Encoding with Extended Hex Alphabet. + + +File: python.info, Node: bdb, Next: bisect, Prev: base64<2>, Up: Improved Modules<4> + +1.4.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, Up: Improved Modules<4> + +1.4.6.7 bisect +.............. + +Added the possibility of providing a 'key' function to the APIs in the +*note bisect: 11. module. (Contributed by Raymond Hettinger in +bpo-4356(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4356 + + +File: python.info, Node: codecs, Next: collections abc, Prev: bisect, Up: Improved Modules<4> + +1.4.6.8 codecs +.............. + +Add a *note codecs.unregister(): 7e3. function to unregister a codec +search function. (Contributed by Hai Shi in bpo-41842(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=41842 + + +File: python.info, Node: collections abc, Next: contextlib<2>, Prev: codecs, Up: Improved Modules<4> + +1.4.6.9 collections.abc +....................... + +The ‘__args__’ of the *note parameterized generic: 6ae. for *note +collections.abc.Callable: 7e5. are now consistent with *note +typing.Callable: 7c0. *note collections.abc.Callable: 7e5. generic now +flattens type parameters, similar to what *note typing.Callable: 7c0. +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: +7e6. can now be subclassed, and a subclass will be returned when +subscripting the *note collections.abc.Callable: 7e5. type. Note that a +*note TypeError: 534. may be raised for invalid forms of parameterizing +*note collections.abc.Callable: 7e5. which may have passed silently in +Python 3.9. (Contributed by Ken Jin in bpo-42195(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=42195 + + +File: python.info, Node: contextlib<2>, Next: curses, Prev: collections abc, Up: Improved Modules<4> + +1.4.6.10 contextlib +................... + +Add a *note contextlib.aclosing(): 7e8. 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(): 7e9. (Contributed by Tom Gringauz in +bpo-41543(2).) + +Add *note AsyncContextDecorator: 7ea, 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, Next: dataclasses<2>, Prev: contextlib<2>, Up: Improved Modules<4> + +1.4.6.11 curses +............... + +The extended color functions added in ncurses 6.1 will be used +transparently by *note curses.color_content(): 7ec, *note +curses.init_color(): 7ed, *note curses.init_pair(): 7ee, and *note +curses.pair_content(): 7ef. A new function, *note +curses.has_extended_color_support(): 7f0, 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: 2b. +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: dataclasses<2>, Next: distutils<2>, Prev: curses, Up: Improved Modules<4> + +1.4.6.12 dataclasses +.................... + +* Menu: + +* __slots__:: +* Keyword-only fields:: + + +File: python.info, Node: __slots__, Next: Keyword-only fields, Up: dataclasses<2> + +1.4.6.13 __slots__ +.................. + +Added ‘slots’ parameter in *note dataclasses.dataclass(): 1cb. +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: dataclasses<2> + +1.4.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: dataclasses<2>, Up: Improved Modules<4> + +1.4.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: aa, *note shutil: c5, +*note subprocess: d6. or *note sysconfig: db.). 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: encodings, Prev: distutils<2>, Up: Improved Modules<4> + +1.4.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: encodings, Next: enum<4>, Prev: doctest<2>, Up: Improved Modules<4> + +1.4.6.17 encodings +.................. + +*note encodings.normalize_encoding(): 7f7. 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: encodings, Up: Improved Modules<4> + +1.4.6.18 enum +............. + +*note Enum: 62c. *note __repr__(): 618. now returns +‘enum_name.member_name’ and *note __str__(): 619. now returns +‘member_name’. Stdlib enums available as module constants have a *note +repr(): 7f9. of ‘module_name.member_name’. (Contributed by Ethan Furman +in bpo-40066(1).) + +Add *note enum.StrEnum: 616. 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, Prev: enum<4>, Up: Improved Modules<4> + +1.4.6.19 fileinput +.................. + +Add 'encoding' and 'errors' parameters in *note fileinput.input(): 7fb. +and *note fileinput.FileInput: 732. (Contributed by Inada Naoki in +bpo-43712(1).) + +*note fileinput.hook_compressed(): 7fc. now returns *note TextIOWrapper: +7b6. 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, Next: gc, Prev: fileinput, Up: Improved Modules<4> + +1.4.6.20 faulthandler +..................... + +The *note faulthandler: 58. 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, Next: glob<2>, Prev: faulthandler, Up: Improved Modules<4> + +1.4.6.21 gc +........... + +Add audit hooks for *note gc.get_objects(): 7ff, *note +gc.get_referrers(): 800. and *note gc.get_referents(): 801. +(Contributed by Pablo Galindo in bpo-43439(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=43439 + + +File: python.info, Node: glob<2>, Next: hashlib<3>, Prev: gc, Up: Improved Modules<4> + +1.4.6.22 glob +............. + +Add the 'root_dir' and 'dir_fd' parameters in *note glob(): 2a1. and +*note iglob(): 803. which allow to specify the root directory for +searching. (Contributed by Serhiy Storchaka in bpo-38144(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38144 + + +File: python.info, Node: hashlib<3>, Next: hmac, Prev: glob<2>, Up: Improved Modules<4> + +1.4.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(): 50a. 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, Next: IDLE and idlelib<2>, Prev: hashlib<3>, Up: Improved Modules<4> + +1.4.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 and idlelib<2>, Next: importlib metadata<2>, Prev: hmac, Up: Improved Modules<4> + +1.4.6.25 IDLE and idlelib +......................... + +Make IDLE invoke *note sys.excepthook(): 807. (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: 808. *note match: 809, *note +case: 809, and *note _: 80a. 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<3>, Prev: IDLE and idlelib<2>, Up: Improved Modules<4> + +1.4.6.26 importlib.metadata +........................... + +Feature parity with ‘importlib_metadata’ 4.6 (history(1)). + +*note importlib.metadata entry points: 286. now provide a nicer +experience for selecting entry points by group and name through a new +*note importlib.metadata.EntryPoints: 286. class. See the Compatibility +Note in the docs for more info on the deprecation and usage. + +Added *note importlib.metadata.packages_distributions(): 80c. for +resolving top-level Python modules and packages to their *note +importlib.metadata.Distribution: 80d. + + ---------- Footnotes ---------- + + (1) https://importlib-metadata.readthedocs.io/en/latest/history.html + + +File: python.info, Node: inspect<3>, Next: itertools<3>, Prev: importlib metadata<2>, Up: Improved Modules<4> + +1.4.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(): 80f, which safely computes the +annotations defined on an object. It works around the quirks of +accessing the annotations on various types of objects, and makes very +few assumptions about the object it examines. *note +inspect.get_annotations(): 80f. can also correctly un-stringize +stringized annotations. *note inspect.get_annotations(): 80f. is now +considered best practice for accessing the annotations dict defined on +any Python object; for more information on best practices for working +with annotations, please see *note Annotations Best Practices: 7d4. +Relatedly, *note inspect.signature(): 733, *note +inspect.Signature.from_callable(): 735, and +‘inspect.Signature.from_function()’ now call *note +inspect.get_annotations(): 80f. to retrieve annotations. This means +*note inspect.signature(): 733. and *note +inspect.Signature.from_callable(): 735. 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<3>, Next: linecache, Prev: inspect<3>, Up: Improved Modules<4> + +1.4.6.28 itertools +.................. + +Add *note itertools.pairwise(): 811. (Contributed by Raymond Hettinger +in bpo-38200(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38200 + + +File: python.info, Node: linecache, Next: os<4>, Prev: itertools<3>, Up: Improved Modules<4> + +1.4.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<4>, Next: os path<4>, Prev: linecache, Up: Improved Modules<4> + +1.4.6.30 os +........... + +Add *note os.cpu_count(): 1c5. support for VxWorks RTOS. (Contributed by +Peixing Xin in bpo-41440(1).) + +Add a new function *note os.eventfd(): 814. and related helpers to wrap +the ‘eventfd2’ syscall on Linux. (Contributed by Christian Heimes in +bpo-41001(2).) + +Add *note os.splice(): 815. 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: 816, *note O_FSYNC: 817, *note O_SYMLINK: 818. and +*note O_NOFOLLOW_ANY: 819. for macOS. (Contributed by Donghee Na in +bpo-43106(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=41440 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=41001 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=41625 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=43106 + + +File: python.info, Node: os path<4>, Next: pathlib<5>, Prev: os<4>, Up: Improved Modules<4> + +1.4.6.31 os.path +................ + +*note os.path.realpath(): 227. now accepts a 'strict' keyword-only +argument. When set to ‘True’, *note OSError: 413. 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<5>, Next: platform<2>, Prev: os path<4>, Up: Improved Modules<4> + +1.4.6.32 pathlib +................ + +Add slice support to *note PurePath.parents: 81c. (Contributed by +Joshua Cannon in bpo-35498(1).) + +Add negative indexing support to *note PurePath.parents: 81c. +(Contributed by Yaroslav Pankovych in bpo-21041(2).) + +Add *note Path.hardlink_to: 81d. method that supersedes ‘link_to()’. +The new method has the same argument order as *note symlink_to(): 81e. +(Contributed by Barney Gale in bpo-39950(3).) + +*note pathlib.Path.stat(): 81f. and *note chmod(): 820. now accept a +'follow_symlinks' keyword-only argument for consistency with +corresponding functions in the *note os: a1. 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: platform<2>, Next: pprint, Prev: pathlib<5>, Up: Improved Modules<4> + +1.4.6.33 platform +................. + +Add *note platform.freedesktop_os_release(): 822. to retrieve operation +system identification from freedesktop.org os-release(1) standard file. +(Contributed by Christian Heimes in bpo-28468(2).) + + ---------- Footnotes ---------- + + (1) https://www.freedesktop.org/software/systemd/man/os-release.html + + (2) https://bugs.python.org/issue?@action=redirect&bpo=28468 + + +File: python.info, Node: pprint, Next: py_compile, Prev: platform<2>, Up: Improved Modules<4> + +1.4.6.34 pprint +............... + +*note pprint.pprint(): 824. now accepts a new ‘underscore_numbers’ +keyword argument. (Contributed by sblondon in bpo-42914(1).) + +*note pprint: ae. can now pretty-print *note dataclasses.dataclass: 1cb. +instances. (Contributed by Lewis Gaul in bpo-43080(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=42914 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=43080 + + +File: python.info, Node: py_compile, Next: pyclbr, Prev: pprint, Up: Improved Modules<4> + +1.4.6.35 py_compile +................... + +Add ‘--quiet’ option to command-line interface of *note py_compile: b3. +(Contributed by Gregory Schevchenko in bpo-38731(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38731 + + +File: python.info, Node: pyclbr, Next: shelve, Prev: py_compile, Up: Improved Modules<4> + +1.4.6.36 pyclbr +............... + +Add an ‘end_lineno’ attribute to the ‘Function’ and ‘Class’ objects in +the tree returned by *note pyclbr.readmodule(): 827. and *note +pyclbr.readmodule_ex(): 828. It matches the existing (start) ‘lineno’. +(Contributed by Aviral Srivastava in bpo-38307(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38307 + + +File: python.info, Node: shelve, Next: statistics<3>, Prev: pyclbr, Up: Improved Modules<4> + +1.4.6.37 shelve +............... + +The *note shelve: c3. module now uses *note pickle.DEFAULT_PROTOCOL: +82a. by default instead of *note pickle: a6. protocol ‘3’ when creating +shelves. (Contributed by Zackery Spytz in bpo-34204(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34204 + + +File: python.info, Node: statistics<3>, Next: site<2>, Prev: shelve, Up: Improved Modules<4> + +1.4.6.38 statistics +................... + +Add *note covariance(): 82c, Pearson’s *note correlation(): 4b8, and +simple *note linear_regression(): 82d. 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<2>, Prev: statistics<3>, Up: Improved Modules<4> + +1.4.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<2>, Next: ssl<3>, Prev: site<2>, Up: Improved Modules<4> + +1.4.6.40 socket +............... + +The exception *note socket.timeout: 830. is now an alias of *note +TimeoutError: 831. (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<3>, Next: sqlite3<5>, Prev: socket<2>, Up: Improved Modules<4> + +1.4.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: 833. (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: 1a5. *note ssl.SSLContext.options: 834. has +*note OP_NO_SSLv2: 835. and *note OP_NO_SSLv3: 836. set by default and +therefore cannot warn about setting the flag again. The *note +deprecation section: 837. 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: 296. 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(): +838. 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: 156. 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<5>, Next: sys<5>, Prev: ssl<3>, Up: Improved Modules<4> + +1.4.6.42 sqlite3 +................ + +Add audit events for ‘connect/handle()’, *note enable_load_extension(): +83a, and *note load_extension(): 4b4. (Contributed by Erlend E. Aasland +in bpo-43762(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=43762 + + +File: python.info, Node: sys<5>, Next: _thread, Prev: sqlite3<5>, Up: Improved Modules<4> + +1.4.6.43 sys +............ + +Add *note sys.orig_argv: 83c. 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: 83d, 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<3>, Prev: sys<5>, Up: Improved Modules<4> + +1.4.6.44 _thread +................ + +*note _thread.interrupt_main(): 83f. now takes an optional signal number +to simulate (the default is still *note signal.SIGINT: 840.). +(Contributed by Antoine Pitrou in bpo-43356(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=43356 + + +File: python.info, Node: threading<3>, Next: traceback<3>, Prev: _thread, Up: Improved Modules<4> + +1.4.6.45 threading +.................. + +Add *note threading.gettrace(): 842. and *note threading.getprofile(): +843. to retrieve the functions set by *note threading.settrace(): 844. +and *note threading.setprofile(): 845. respectively. (Contributed by +Mario Corchero in bpo-42251(1).) + +Add *note threading.__excepthook__: 846. to allow retrieving the +original value of *note threading.excepthook(): 847. 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<3>, Prev: threading<3>, Up: Improved Modules<4> + +1.4.6.46 traceback +.................. + +The *note format_exception(): 849, *note format_exception_only(): 84a, +and *note print_exception(): 84b. 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<3>, Next: typing<5>, Prev: traceback<3>, Up: Improved Modules<4> + +1.4.6.47 types +.............. + +Reintroduce the *note types.EllipsisType: 84d, *note types.NoneType: +84e. and *note types.NotImplementedType: 84f. 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<5>, Next: unittest<5>, Prev: types<3>, Up: Improved Modules<4> + +1.4.6.48 typing +............... + +For major changes, see *note New Features Related to Type Hints: 7b9. + +The behavior of *note typing.Literal: 851. 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: 534. exception + during equality comparisons if any of their parameters are not + *note hashable: 60c. 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 "", line 1, in + TypeError: unhashable type: 'set' + +(Contributed by Yurii Karabas in bpo-42345(2).) + +Add new function *note typing.is_typeddict(): 852. to introspect if an +annotation is a *note typing.TypedDict: 162. (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(): 43e. 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: 1a5. 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: 104. 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<5>, Next: urllib parse, Prev: typing<5>, Up: Improved Modules<4> + +1.4.6.49 unittest +................. + +Add new method *note assertNoLogs(): 854. to complement the existing +*note assertLogs(): 855. (Contributed by Kit Yan Choi in bpo-39385(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=39385 + + +File: python.info, Node: urllib parse, Next: xml<2>, Prev: unittest<5>, Up: Improved Modules<4> + +1.4.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(): 27c. and +*note urllib.parse.parse_qsl(): 27b. 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: 10a. +preventing such attacks. The removal characters are controlled by a new +module level variable ‘urllib.parse._UNSAFE_URL_BYTES_TO_REMOVE’. (See +gh-88048(3)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=42967 + + (2) https://datatracker.ietf.org/doc/html/rfc3986.html + + (3) https://github.com/python/cpython/issues/88048 + + +File: python.info, Node: xml<2>, Next: zipimport<3>, Prev: urllib parse, Up: Improved Modules<4> + +1.4.6.51 xml +............ + +Add a *note LexicalHandler: 858. class to the *note xml.sax.handler: +12a. module. (Contributed by Jonathan Gossage and Zackery Spytz in +bpo-35018(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=35018 + + +File: python.info, Node: zipimport<3>, Prev: xml<2>, Up: Improved Modules<4> + +1.4.6.52 zipimport +.................. + +Add methods related to PEP 451(1): *note find_spec(): 85a, *note +zipimport.zipimporter.create_module(): 85b, and *note +zipimport.zipimporter.exec_module(): 30c. (Contributed by Brett Cannon +in bpo-42131(2).) + +Add *note invalidate_caches(): 85c. 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: Optimizations<4>, Next: Deprecated<5>, Prev: Improved Modules<4>, Up: What’s New In Python 3 10 + +1.4.7 Optimizations +------------------- + + * Constructors *note str(): 447, *note bytes(): 1c2. and *note + bytearray(): 53a. are now faster (around 30–40% for small objects). + (Contributed by Serhiy Storchaka in bpo-41334(1).) + + * The *note runpy: be. 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: 85e. 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: 85f. 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: 13. / *note + lzma: 8a. / *note zlib: 133. 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(): 860, *note filter(): + 861, *note reversed(): 862, *note bool(): 463. and *note float(): + 2f1. (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: 863. 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: 67. and *note lzma: 8a. 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: Deprecated<5>, Next: Removed<5>, Prev: Optimizations<4>, Up: What’s New In Python 3 10 + +1.4.8 Deprecated +---------------- + + * 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: 2eb, *note else: 18c, *note for: 2ec, *note if: 2ed, *note in: + 2ee, *note is: 2ef. and *note or: 2f0. 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(): 865.), *note load_module(): 866. + (superseded by *note exec_module(): 867.), ‘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: 77.). + *note ImportWarning: 4f6. and/or *note DeprecationWarning: 1a5. + 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: 725. section for + more information. + + * Non-integer arguments to *note random.randrange(): 868. are + deprecated. The *note ValueError: 204. is deprecated in favor of a + *note TypeError: 534. (Contributed by Serhiy Storchaka and Raymond + Hettinger in bpo-37319(2).) + + * The various ‘load_module()’ methods of *note importlib: 77. have + been documented as deprecated since Python 3.6, but will now also + trigger a *note DeprecationWarning: 1a5. Use *note exec_module(): + 867. instead. (Contributed by Brett Cannon in bpo-26131(3).) + + * ‘zimport.zipimporter.load_module()’ has been deprecated in + preference for *note exec_module(): 30c. (Contributed by Brett + Cannon in bpo-26131(4).) + + * The use of *note load_module(): 866. by the import system now + triggers an *note ImportWarning: 4f6. as *note exec_module(): 867. + 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: 4f6. as *note + importlib.abc.MetaPathFinder.find_spec(): 865. and *note + importlib.abc.PathEntryFinder.find_spec(): 869. are preferred, + respectively. You can use *note importlib.util.spec_from_loader(): + 86a. 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: 4f6. as *note + importlib.abc.PathEntryFinder.find_spec(): 869. is preferred. You + can use *note importlib.util.spec_from_loader(): 86a. 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: 1a5. 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: 86b. + and *note importlib.abc.PathEntryFinder: 86c. 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: 1a5. 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: 447. 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).) + + * The following ‘threading’ methods are now deprecated: + + * ‘threading.currentThread’ => *note threading.current_thread(): + 303. + + * ‘threading.activeCount’ => *note threading.active_count(): + 304. + + * ‘threading.Condition.notifyAll’ => *note + threading.Condition.notify_all(): 2fd. + + * ‘threading.Event.isSet’ => *note threading.Event.is_set(): + 2fe. + + * ‘threading.Thread.setName’ => *note threading.Thread.name: + 302. + + * ‘threading.thread.getName’ => *note threading.Thread.name: + 302. + + * ‘threading.Thread.isDaemon’ => *note threading.Thread.daemon: + 300. + + * ‘threading.Thread.setDaemon’ => *note threading.Thread.daemon: + 300. + + (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(): 81d. 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: d0. 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: 86d. and *note maximum_version: 86e. + + * ‘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: 86f. and *note PROTOCOL_TLS_SERVER: 870. + + * ‘wrap_socket()’ is replaced by *note + ssl.SSLContext.wrap_socket(): 520. + + * ‘match_hostname()’ + + * ‘RAND_pseudo_bytes()’, ‘RAND_egd()’ + + * NPN features like *note ssl.SSLSocket.selected_npn_protocol(): + 871. and *note ssl.SSLContext.set_npn_protocols(): 2fc. 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: 1fb. (Contributed + by Victor Stinner in bpo-44584(19).) + + * Importing from the ‘typing.io’ and ‘typing.re’ submodules will now + emit *note DeprecationWarning: 1a5. These submodules will be + removed in a future version of Python. Anything belonging to these + submodules should be imported directly from *note typing: 104. + 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: Removed<5>, Next: Porting to Python 3 10, Prev: Deprecated<5>, Up: What’s New In Python 3 10 + +1.4.9 Removed +------------- + + * Removed special methods ‘__int__’, ‘__float__’, ‘__floordiv__’, + ‘__mod__’, ‘__divmod__’, ‘__rfloordiv__’, ‘__rmod__’ and + ‘__rdivmod__’ of the *note complex: 2f2. class. They always raised + a *note TypeError: 534. (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: 874. 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 Collections Abstract Base + Classes: 875. from the *note collections: 1d. module. (Contributed + by Victor Stinner in bpo-37324(6).) + + * The ‘loop’ parameter has been removed from most of *note asyncio: + a.‘s *note high-level API: 876. 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 + Changes in the Python API: 877. 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 bytecode changes<3>, Prev: Removed<5>, Up: What’s New In Python 3 10 + +1.4.10 Porting to Python 3.10 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in the Python syntax:: +* Changes in the Python API: Changes in the Python API<3>. +* Changes in the C API: Changes in the C API<2>. + + +File: python.info, Node: Changes in the Python syntax, Next: Changes in the Python API<3>, Up: Porting to Python 3 10 + +1.4.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: Changes in the Python API<3>, Next: Changes in the C API<2>, Prev: Changes in the Python syntax, Up: Porting to Python 3 10 + +1.4.10.2 Changes in the Python API +.................................. + + * The 'etype' parameters of the *note format_exception(): 849, *note + format_exception_only(): 84a, and *note print_exception(): 84b. + functions in the *note traceback: fe. module have been renamed to + 'exc'. (Contributed by Zackery Spytz and Matthias Bussonnier in + bpo-26389(1).) + + * *note atexit: c.: At Python exit, if a callback registered with + *note atexit.register(): 87b. 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: 7e5. generic now flattens type + parameters, similar to what *note typing.Callable: 7c0. 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(): 87c. or ‘__args__’ need to account for this + change. Furthermore, *note TypeError: 534. may be raised for + invalid forms of parameterizing *note collections.abc.Callable: + 7e5. which may have passed silently in Python 3.9. (Contributed by + Ken Jin in bpo-42195(3).) + + * *note socket.htons(): 87d. and *note socket.ntohs(): 87e. now raise + *note OverflowError: 87f. instead of *note DeprecationWarning: 1a5. + 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: + a.‘s *note high-level API: 876. 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(): 880. instead. + + (Contributed by Yurii Karabas, Andrew Svetlov, Yury Selivanov and + Kyle Stanley in bpo-42392(5).) + + * The *note types.FunctionType: 881. 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(): 180. and *note exec(): + 17f. 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: Changes in the C API<2>, Prev: Changes in the Python API<3>, Up: Porting to Python 3 10 + +1.4.10.3 Changes in the 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(): 883. The resulting code + object can then be evaluated using, for example, *note + PyEval_EvalCode(): 884. + + Specifically: + + * A call to ‘PyParser_SimpleParseStringFlags’ followed by + ‘PyNode_Compile’ can be replaced by calling *note + Py_CompileString(): 883. + + * 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(): 883. + + * 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: 7f. module with *note + PyImport_ImportModule(): 3ba, *note PyObject_CallMethod(): + 39b, *note PyBytes_AsString(): 885. and *note + Py_CompileString(): 883, 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: 886. 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(): 887. for example). + Notice as well that the ‘f_lasti’ member of ‘FrameObject’ + objects is not considered stable: please use *note + PyFrame_GetLineNumber(): 786. instead. + + +File: python.info, Node: CPython bytecode changes<3>, Next: Build Changes<4>, Prev: Porting to Python 3 10, Up: What’s New In Python 3 10 + +1.4.11 CPython bytecode changes +------------------------------- + + * 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 Changes<4>, Prev: CPython bytecode changes<3>, Up: What’s New In Python 3 10 + +1.4.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: cf. 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: c. module must now always be built as a built-in + module. (Contributed by Victor Stinner in bpo-42639(6).) + + * Add *note -disable-test-modules: 88a. 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: 88b. to the + ‘./configure’ script. If specified, the *note ensurepip: 55. + 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: 88c. 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: 88d. 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 Changes<4>, Next: Notable security feature in 3 10 7, Prev: Build Changes<4>, Up: What’s New In Python 3 10 + +1.4.13 C API Changes +-------------------- + +* Menu: + +* PEP 652; Maintaining the Stable ABI: PEP 652 Maintaining the Stable ABI. +* New Features: New Features<8>. +* Porting to Python 3.10: Porting to Python 3 10<2>. +* Deprecated: Deprecated<6>. +* Removed: Removed<6>. + + +File: python.info, Node: PEP 652 Maintaining the Stable ABI, Next: New Features<8>, Up: C API Changes<4> + +1.4.13.1 PEP 652: Maintaining the Stable ABI +............................................ + +The Stable ABI (Application Binary Interface) for extension modules or +embedding Python is now explicitly defined. *note C API Stability: 550. +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: New Features<8>, Next: Porting to Python 3 10<2>, Prev: PEP 652 Maintaining the Stable ABI, Up: C API Changes<4> + +1.4.13.2 New Features +..................... + + * The result of *note PyNumber_Index(): 891. now always has exact + type *note int: 259. 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: 892. member to the *note PyConfig: 3a2. + 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(): 893. and *note + PyDateTime_TIME_GET_TZINFO(): 894. macros have been added for + accessing the ‘tzinfo’ attributes of *note datetime.datetime: 1cc. + and *note datetime.time: 1ce. objects. (Contributed by Zackery + Spytz in bpo-30155(3).) + + * Add a *note PyCodec_Unregister(): 895. function to unregister a + codec search function. (Contributed by Hai Shi in bpo-41842(4).) + + * The *note PyIter_Send(): 896. 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(): 897. to the limited C API. + (Contributed by Alex Gaynor in bpo-41784(6).) + + * Add *note PyModule_AddObjectRef(): 360. function: similar to *note + PyModule_AddObject(): 361. but don’t steal a reference to the value + on success. (Contributed by Victor Stinner in bpo-1635741(7).) + + * Add *note Py_NewRef(): 898. and *note Py_XNewRef(): 899. 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(): 57b. and *note + PyType_FromModuleAndSpec(): 54e. functions now accept a single + class as the 'bases' argument. (Contributed by Serhiy Storchaka in + bpo-42423(9).) + + * The *note PyType_FromModuleAndSpec(): 54e. function now accepts + NULL ‘tp_doc’ slot. (Contributed by Hai Shi in bpo-41832(10).) + + * The *note PyType_GetSlot(): 89a. function can accept *note static + types: 77a. (Contributed by Hai Shi and Petr Viktorin in + bpo-41073(11).) + + * Add a new *note PySet_CheckExact(): 89b. function to the C-API to + check if an object is an instance of *note set: 5d5. but not an + instance of a subtype. (Contributed by Pablo Galindo in + bpo-43277(12).) + + * Add *note PyErr_SetInterruptEx(): 89c. 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: 1fb. (if the ‘Py_DEBUG’ macro is defined). In the + limited C API, the *note Py_INCREF(): 56b. and *note Py_DECREF(): + 56c. functions are now implemented as opaque function calls, rather + than accessing directly the *note PyObject.ob_refcnt: 89d. 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: 334. + 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: 390. special build (‘Py_TRACE_REFS’ macro). + (Contributed by Victor Stinner in bpo-43688(15).) + + * Add the *note Py_Is(x, y): 89e. 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(): 89f, *note Py_IsTrue(): 8a0, *note Py_IsFalse(): + 8a1. 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(): 8a2, *note PyGC_Disable(): 8a3, *note + PyGC_IsEnabled(): 8a4. These functions allow to activate, + deactivate and query the state of the garbage collector from C code + without having to import the *note gc: 60. module. + + * Add a new *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 57f. type flag + to disallow creating type instances. (Contributed by Victor + Stinner in bpo-43916(17).) + + * Add a new *note Py_TPFLAGS_IMMUTABLETYPE: 3be. 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: Deprecated<6>, Prev: New Features<8>, Up: C API Changes<4> + +1.4.13.3 Porting to Python 3.10 +............................... + + * The ‘PY_SSIZE_T_CLEAN’ macro must now be defined to use *note + PyArg_ParseTuple(): 56e. and *note Py_BuildValue(): 8a6. formats + which use ‘#’: ‘es#’, ‘et#’, ‘s#’, ‘u#’, ‘y#’, ‘z#’, ‘U#’ and ‘Z#’. + See *note Parsing arguments and building values: 8a7. and PEP + 353(1). (Contributed by Victor Stinner in bpo-40943(2).) + + * Since *note Py_REFCNT(): 8a8. 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(): 8a9. + (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(): 382. without *note GIL: 159. 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(): 8aa. to + allocate Unicode object without initial data. (Contributed by + Inada Naoki in bpo-36346(5).) + + * The private ‘_PyUnicode_Name_CAPI’ structure of the PyCapsule API + ‘unicodedata.ucnhash_CAPI’ has been moved to the internal C API. + (Contributed by Victor Stinner in bpo-42157(6).) + + * *note Py_GetPath(): 3af, *note Py_GetPrefix(): 3b1, *note + Py_GetExecPrefix(): 3ad, *note Py_GetProgramFullPath(): 3b3, *note + Py_GetPythonHome(): 3b6. and *note Py_GetProgramName(): 3b5. + functions now return ‘NULL’ if called before *note Py_Initialize(): + 8ab. (before Python is initialized). Use the new *note Python + Initialization Configuration: 3a3. API to get the *note Python Path + Configuration: 8ac. (Contributed by Victor Stinner in + bpo-42260(7).) + + * *note PyList_SET_ITEM(): 389, *note PyTuple_SET_ITEM(): 388. and + *note PyCell_SET(): 8ad. 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 Include Files: 77f. 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: 3be. type flag to create + immutable type objects. Do not rely on *note Py_TPFLAGS_HEAPTYPE: + 8ae. to decide if a type object is mutable or not; check if *note + Py_TPFLAGS_IMMUTABLETYPE: 3be. 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: Deprecated<6>, Next: Removed<6>, Prev: Porting to Python 3 10<2>, Up: C API Changes<4> + +1.4.13.4 Deprecated +................... + + * The ‘PyUnicode_InternImmortal()’ function is now deprecated and + will be removed in Python 3.12: use *note + PyUnicode_InternInPlace(): 8b0. instead. (Contributed by Victor + Stinner in bpo-41692(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=41692 + + +File: python.info, Node: Removed<6>, Prev: Deprecated<6>, Up: C API Changes<4> + +1.4.13.5 Removed +................ + + * Removed ‘Py_UNICODE_str*’ functions manipulating ‘Py_UNICODE*’ + strings. (Contributed by Inada Naoki in bpo-41123(1).) + + * ‘Py_UNICODE_strlen’: use *note PyUnicode_GetLength(): 8b2. or + *note PyUnicode_GET_LENGTH: 8b3. + + * ‘Py_UNICODE_strcat’: use *note PyUnicode_CopyCharacters(): + 8b4. or *note PyUnicode_FromFormat(): 385. + + * ‘Py_UNICODE_strcpy’, ‘Py_UNICODE_strncpy’: use *note + PyUnicode_CopyCharacters(): 8b4. or *note + PyUnicode_Substring(): 8b5. + + * ‘Py_UNICODE_strcmp’: use *note PyUnicode_Compare(): 8b6. + + * ‘Py_UNICODE_strncmp’: use *note PyUnicode_Tailmatch(): 8b7. + + * ‘Py_UNICODE_strchr’, ‘Py_UNICODE_strrchr’: use *note + PyUnicode_FindChar(): 8b8. + + * 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(): 8b9. (Contributed by Inada Naoki in + bpo-41103(4).) + + * Removed ‘PyUnicode_AsUnicodeCopy()’. Please use *note + PyUnicode_AsUCS4Copy(): 8ba. or *note PyUnicode_AsWideCharString(): + 8bb. (Contributed by Inada Naoki in bpo-41103(5).) + + * Removed ‘_Py_CheckRecursionLimit’ variable: it has been replaced by + ‘ceval.recursion_limit’ of the *note PyInterpreterState: 8bc. + 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: 8bc. 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: 8bd. (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: d8. module instead. (Contributed by + Victor Stinner in bpo-43244(11).) + + * Remove *note PyOS_ReadlineFunctionPointer(): 583. 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 ‘’ header. Use the Python *note + ast: 8. 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 Changes<4>, Up: What’s New In Python 3 10 + +1.4.14 Notable security feature in 3.10.7 +----------------------------------------- + +Converting between *note int: 259. and *note str: 447. in bases other +than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 +(decimal) now raises a *note ValueError: 204. 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: d9. APIs. See the *note +integer string conversion length limitation: 5f1. 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.4.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.4.16 Notable changes in 3.10.12 +--------------------------------- + +* Menu: + +* tarfile: tarfile<3>. + + +File: python.info, Node: tarfile<3>, Up: Notable changes in 3 10 12 + +1.4.16.1 tarfile +................ + + * The extraction methods in *note tarfile: de, and *note + shutil.unpack_archive(): 467, 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: 468. for details. In Python 3.12, use + without the 'filter' argument will show a *note DeprecationWarning: + 1a5. 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.5 What’s New In Python 3.9 +============================ + + +Editor: Ł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: 13c. + +See also +........ + +PEP 596(1) - Python 3.9 Release Schedule + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<4>. +* You should check for DeprecationWarning in your code:: +* New Features: New Features<9>. +* Other Language Changes: Other Language Changes<5>. +* New Modules: New Modules<5>. +* Improved Modules: Improved Modules<5>. +* Optimizations: Optimizations<5>. +* Deprecated: Deprecated<7>. +* Removed: Removed<7>. +* Porting to Python 3.9: Porting to Python 3 9. +* Build Changes: Build Changes<5>. +* C API Changes: C API Changes<5>. +* Notable changes in Python 3.9.1: Notable changes in Python 3 9 1. +* Notable changes in Python 3.9.2: Notable changes in Python 3 9 2. +* Notable changes in Python 3.9.3: Notable changes in Python 3 9 3. +* Notable changes in Python 3.9.5: Notable changes in 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: Summary – Release highlights<4>, Next: You should check for DeprecationWarning in your code, Up: What’s New In Python 3 9 + +1.5.1 Summary – Release highlights +---------------------------------- + +New syntax features: + + * PEP 584(1), union operators added to ‘dict’; + + * PEP 585(2), type hinting generics in standard collections; + + * PEP 614(3), relaxed grammar restrictions on decorators. + +New built-in features: + + * PEP 616(4), string methods to remove prefixes and suffixes. + +New features in the standard library: + + * PEP 593(5), flexible function and variable annotations; + + * *note os.pidfd_open(): 476. added that allows process management + without races and signals. + +Interpreter improvements: + + * PEP 573(6), fast access to module state from methods of C extension + types; + + * PEP 617(7), CPython now uses a new parser based on PEG; + + * a number of Python builtins (range, tuple, set, frozenset, list, + dict) are now sped up using 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: 8e, *note operator: 9f, *note resource: bc, *note time: ee, + ‘_weakref’) now use multiphase initialization as defined by PEP + 489; + + * a number of standard library modules (‘audioop’, *note ast: 8, + *note grp: 66, ‘_hashlib’, *note pwd: b2, ‘_posixsubprocess’, *note + random: b8, *note select: c1, *note struct: d5, *note termios: e1, + *note zlib: 133.) are now using the stable ABI defined by PEP 384. + +New library modules: + + * PEP 615(9), the IANA Time Zone Database is now present in the + standard library in the *note zoneinfo: 134. module; + + * an implementation of a topological sort of a graph is now provided + in the new *note graphlib: 65. module. + +Release process changes: + + * PEP 602(10), CPython adopts an annual release cycle. + + ---------- 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: You should check for DeprecationWarning in your code, Next: New Features<9>, Prev: Summary – Release highlights<4>, Up: What’s New In Python 3 9 + +1.5.2 You should check for DeprecationWarning in your code +---------------------------------------------------------- + +When Python 2.7 was still supported, a lot of functionality in Python 3 +was kept for backward compatibility with Python 2.7. With the end of +Python 2 support, these backward compatibility layers have been removed, +or will be removed soon. Most of them emitted a *note +DeprecationWarning: 1a5. warning for several years. For example, using +‘collections.Mapping’ instead of ‘collections.abc.Mapping’ emits a *note +DeprecationWarning: 1a5. since Python 3.3, released in 2012. + +Test your application with the *note -W: 8c6. ‘default’ command-line +option to see *note DeprecationWarning: 1a5. and *note +PendingDeprecationWarning: 8c7, or even with *note -W: 8c6. ‘error’ to +treat them as errors. *note Warnings Filter: 8c8. can be used to ignore +warnings from third-party code. + +Python 3.9 is the last version providing those Python 2 backward +compatibility layers, to give more time to Python projects maintainers +to organize the removal of the Python 2 support and add support for +Python 3.9. + +Aliases to *note Abstract Base Classes: 875. in the *note collections: +1d. module, like ‘collections.Mapping’ alias to *note +collections.abc.Mapping: 8c9, are kept for one last release for backward +compatibility. They will be removed from Python 3.10. + +More generally, try to run your tests in the *note Python Development +Mode: 1fa. which helps to prepare your code to make it compatible with +the next Python version. + +Note: a number of pre-existing deprecations were removed in this version +of Python as well. Consult the *note Removed: 8ca. section. + + +File: python.info, Node: New Features<9>, Next: Other Language Changes<5>, Prev: You should check for DeprecationWarning in your code, Up: What’s New In Python 3 9 + +1.5.3 New Features +------------------ + +* Menu: + +* Dictionary Merge & Update Operators:: +* New String Methods to Remove Prefixes and Suffixes:: +* Type Hinting Generics in Standard Collections:: +* New Parser:: + + +File: python.info, Node: Dictionary Merge & Update Operators, Next: New String Methods to Remove Prefixes and Suffixes, Up: New Features<9> + +1.5.3.1 Dictionary Merge & Update Operators +........................................... + +Merge (‘|’) and update (‘|=’) operators have been added to the built-in +*note dict: 258. class. Those complement the existing ‘dict.update’ and +‘{**d1, **d2}’ methods of merging dictionaries. + +Example: + + >>> 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'} + +See PEP 584(1) for a full description. (Contributed by Brandt Bucher in +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: New String Methods to Remove Prefixes and Suffixes, Next: Type Hinting Generics in Standard Collections, Prev: Dictionary Merge & Update Operators, Up: New Features<9> + +1.5.3.2 New String Methods to Remove Prefixes and Suffixes +.......................................................... + +*note str.removeprefix(prefix): 8ce. and *note str.removesuffix(suffix): +8cf. have been added to easily remove an unneeded prefix or a suffix +from a string. Corresponding ‘bytes’, ‘bytearray’, and +‘collections.UserString’ methods have also been added. See PEP 616(1) +for a full description. (Contributed by Dennis Sweeney in +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: Type Hinting Generics in Standard Collections, Next: New Parser, Prev: New String Methods to Remove Prefixes and Suffixes, Up: New Features<9> + +1.5.3.3 Type Hinting Generics in Standard Collections +..................................................... + +In type annotations you can now use built-in collection types such as +‘list’ and ‘dict’ as generic types instead of importing the +corresponding capitalized types (e.g. ‘List’ or ‘Dict’) from ‘typing’. +Some other types in the standard library are also now generic, for +example ‘queue.Queue’. + +Example: + + def greet_all(names: list[str]) -> None: + for name in names: + print("Hello", name) + +See PEP 585(1) for more details. (Contributed by Guido van Rossum, +Ethan Smith, and Batuhan Taşkaya in 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: New Parser, Prev: Type Hinting Generics in Standard Collections, Up: New Features<9> + +1.5.3.4 New Parser +.................. + +Python 3.9 uses a new parser, based on PEG(1) instead of LL(1)(2). The +new parser’s performance is roughly comparable to that of the old +parser, but the PEG formalism is more flexible than LL(1) when it comes +to designing new language features. We’ll start using this flexibility +in Python 3.10 and later. + +The *note ast: 8. module uses the new parser and produces the same AST +as the old parser. + +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’). + +See PEP 617(3) for more details. (Contributed by Guido van Rossum, +Pablo Galindo and Lysandros Nikolaou in bpo-40334(4).) + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Parsing_expression_grammar + + (2) https://en.wikipedia.org/wiki/LL_parser + + (3) https://peps.python.org/pep-0617/ + + (4) https://bugs.python.org/issue?@action=redirect&bpo=40334 + + +File: python.info, Node: Other Language Changes<5>, Next: New Modules<5>, Prev: New Features<9>, Up: What’s New In Python 3 9 + +1.5.4 Other Language Changes +---------------------------- + + * *note __import__(): 8d3. now raises *note ImportError: 415. instead + of *note ValueError: 204, 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(): 609. As a + side effect, the traceback also displays the absolute path for + *note __main__: 1. module frames in this case. (Contributed by + Victor Stinner in bpo-20443(2).) + + * In the *note Python Development Mode: 1fa. and in *note debug + build: 1fb, the 'encoding' and 'errors' arguments are now checked + for string encoding and decoding operations. Examples: *note + open(): 517, *note str.encode(): 8d4. and *note bytes.decode(): + 8d5. + + 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: 1c2. and *note + bytearray: 53a. objects. (Contributed by Serhiy Storchaka in + bpo-28029(4).) + + * Any valid expression can now be used as a *note decorator: 72c. + 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: 104. module. Docstrings are + now shown for all special forms and special generic aliases (like + ‘Union’ and ‘List’). Using *note help(): 8d6. 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(): 8d7. / *note asend(): 8d8. / + *note athrow(): 4f5. 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: 2ee. operator and functions + *note contains(): 8d9, *note indexOf(): 8da. and *note countOf(): + 8db. of the *note operator: 9f. 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: New Modules<5>, Next: Improved Modules<5>, Prev: Other Language Changes<5>, Up: What’s New In Python 3 9 + +1.5.5 New Modules +----------------- + +* Menu: + +* zoneinfo:: +* graphlib:: + + +File: python.info, Node: zoneinfo, Next: graphlib, Up: New Modules<5> + +1.5.5.1 zoneinfo +................ + +The *note zoneinfo: 134. module brings support for the IANA time zone +database to the standard library. It adds *note zoneinfo.ZoneInfo: 8de, +a concrete *note datetime.tzinfo: 5da. implementation backed by the +system’s time zone data. + +Example: + + >>> from zoneinfo import ZoneInfo + >>> from datetime import datetime, timedelta + + >>> # Daylight saving time + >>> dt = datetime(2020, 10, 31, 12, tzinfo=ZoneInfo("America/Los_Angeles")) + >>> print(dt) + 2020-10-31 12:00:00-07:00 + >>> dt.tzname() + 'PDT' + + >>> # Standard time + >>> dt += timedelta(days=7) + >>> print(dt) + 2020-11-07 12:00:00-08:00 + >>> print(dt.tzname()) + PST + +As a fall-back source of data for platforms that don’t ship the IANA +database, the tzdata(1) module was released as a first-party package – +distributed via PyPI and maintained by the CPython core team. + +See also +........ + +PEP 615(2) – Support for the IANA Time Zone Database in the Standard Library + + PEP written and implemented by Paul Ganssle + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/tzdata/ + + (2) https://peps.python.org/pep-0615/ + + +File: python.info, Node: graphlib, Prev: zoneinfo, Up: New Modules<5> + +1.5.5.2 graphlib +................ + +A new module, *note graphlib: 65, was added that contains the *note +graphlib.TopologicalSorter: 8e0. 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: Improved Modules<5>, Next: Optimizations<5>, Prev: New Modules<5>, Up: What’s New In Python 3 9 + +1.5.6 Improved Modules +---------------------- + +* Menu: + +* ast: ast<2>. +* asyncio: asyncio<5>. +* compileall: compileall<2>. +* concurrent.futures: concurrent futures<2>. +* curses: curses<2>. +* datetime: datetime<2>. +* distutils: distutils<3>. +* fcntl: fcntl<2>. +* ftplib: ftplib<2>. +* gc: gc<2>. +* hashlib: hashlib<4>. +* http:: +* IDLE and idlelib: IDLE and idlelib<3>. +* imaplib:: +* importlib: importlib<3>. +* inspect: inspect<4>. +* ipaddress: ipaddress<2>. +* math: math<4>. +* multiprocessing: multiprocessing<2>. +* nntplib:: +* os: os<5>. +* pathlib: pathlib<6>. +* pdb: pdb<3>. +* poplib:: +* pprint: pprint<2>. +* pydoc:: +* random: random<3>. +* signal:: +* smtplib:: +* socket: socket<3>. +* time: time<3>. +* sys: sys<6>. +* tracemalloc:: +* typing: typing<6>. +* unicodedata: unicodedata<4>. +* venv: venv<3>. +* xml: xml<3>. + + +File: python.info, Node: ast<2>, Next: asyncio<5>, Up: Improved Modules<5> + +1.5.6.1 ast +........... + +Added the 'indent' option to *note dump(): 8e3. which allows it to +produce a multiline indented output. (Contributed by Serhiy Storchaka +in bpo-37995(1).) + +Added *note ast.unparse(): 8e4. as a function in the *note ast: 8. +module that can be used to unparse an *note ast.AST: 1a6. object and +produce a string with code that would produce an equivalent *note +ast.AST: 1a6. 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<5>, Next: compileall<2>, Prev: ast<2>, Up: Improved Modules<5> + +1.5.6.2 asyncio +............... + +Due to significant security concerns, the 'reuse_address' parameter of +*note asyncio.loop.create_datagram_endpoint(): 72e. is no longer +supported. This is because of the behavior of the socket option +‘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(1).) + +Added a new *note coroutine: 48d. *note shutdown_default_executor(): +8e6. that schedules a shutdown for the default executor that waits on +the *note ThreadPoolExecutor: 73d. to finish closing. Also, *note +asyncio.run(): 478. has been updated to use the new *note coroutine: +48d. (Contributed by Kyle Stanley in bpo-34037(2).) + +Added *note asyncio.PidfdChildWatcher: 475, a Linux-specific child +watcher implementation that polls process file descriptors. +(bpo-38692(3)) + +Added a new *note coroutine: 48d. *note asyncio.to_thread(): 8e7. 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(): 8e8. 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(): +5fb. 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: a. now raises *note TypeError: 534. when calling +incompatible methods with an *note ssl.SSLSocket: 8e9. 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<2>, Prev: asyncio<5>, Up: Improved Modules<5> + +1.5.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<2>, Next: curses<2>, Prev: compileall<2>, Up: Improved Modules<5> + +1.5.6.4 concurrent.futures +.......................... + +Added a new 'cancel_futures' parameter to *note +concurrent.futures.Executor.shutdown(): 8ec. 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: 73d. and *note +ProcessPoolExecutor: 8ed. This improves compatibility with +subinterpreters and predictability in their shutdown processes. +(Contributed by Kyle Stanley in bpo-39812(2).) + +Workers in *note ProcessPoolExecutor: 8ed. 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<2>, Next: datetime<2>, Prev: concurrent futures<2>, Up: Improved Modules<5> + +1.5.6.5 curses +.............. + +Added *note curses.get_escdelay(): 8ef, *note curses.set_escdelay(): +8f0, *note curses.get_tabsize(): 8f1, and *note curses.set_tabsize(): +8f2. functions. (Contributed by Anthony Sottile in bpo-38312(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38312 + + +File: python.info, Node: datetime<2>, Next: distutils<3>, Prev: curses<2>, Up: Improved Modules<5> + +1.5.6.6 datetime +................ + +The *note isocalendar(): 8f4. of *note datetime.date: 1cd. and *note +isocalendar(): 8f5. of *note datetime.datetime: 1cc. methods now returns +a *note namedtuple(): 1ca. instead of a *note tuple: 36b. (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<2>, Up: Improved Modules<5> + +1.5.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: Improved Modules<5> + +1.5.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<2>, Prev: fcntl<2>, Up: Improved Modules<5> + +1.5.6.9 ftplib +.............. + +*note FTP: 8f9. and *note FTP_TLS: 8fa. now raise a *note ValueError: +204. 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<2>, Next: hashlib<4>, Prev: ftplib<2>, Up: Improved Modules<5> + +1.5.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(): 8fc. to check if an object +has been finalized by the garbage collector. (Contributed by Pablo +Galindo in bpo-39322(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=38379 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=39322 + + +File: python.info, Node: hashlib<4>, Next: http, Prev: gc<2>, Up: Improved Modules<5> + +1.5.6.11 hashlib +................ + +The *note hashlib: 68. 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, Next: IDLE and idlelib<3>, Prev: hashlib<4>, Up: Improved Modules<5> + +1.5.6.12 http +............. + +HTTP status codes ‘103 EARLY_HINTS’, ‘418 IM_A_TEAPOT’ and ‘425 +TOO_EARLY’ are added to *note http.HTTPStatus: 8ff. (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 and idlelib<3>, Next: imaplib, Prev: http, Up: Improved Modules<5> + +1.5.6.13 IDLE and idlelib +......................... + +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(): 807. (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, Next: importlib<3>, Prev: IDLE and idlelib<3>, Up: Improved Modules<5> + +1.5.6.14 imaplib +................ + +*note IMAP4: 902. and *note IMAP4_SSL: 903. now have an optional +'timeout' parameter for their constructors. Also, the *note open(): +904. method now has an optional 'timeout' parameter with this change. +The overridden methods of *note IMAP4_SSL: 903. and *note IMAP4_stream: +905. were applied to this change. (Contributed by Donghee Na in +bpo-38615(1).) + +*note imaplib.IMAP4.unselect(): 906. is added. *note +imaplib.IMAP4.unselect(): 906. 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(): +907, 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<4>, Prev: imaplib, Up: Improved Modules<5> + +1.5.6.15 importlib +.................. + +To improve consistency with import statements, *note +importlib.util.resolve_name(): 909. now raises *note ImportError: 415. +instead of *note ValueError: 204. 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(): 48a. 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<4>, Next: ipaddress<2>, Prev: importlib<3>, Up: Improved Modules<5> + +1.5.6.16 inspect +................ + +*note inspect.BoundArguments.arguments: 90b. is changed from +‘OrderedDict’ to regular dict. (Contributed by Inada Naoki in +bpo-36350(1) and 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<4>, Prev: inspect<4>, Up: Improved Modules<5> + +1.5.6.17 ipaddress +.................. + +*note ipaddress: 80. now supports IPv6 Scoped Addresses (IPv6 address +with suffix ‘%’). + +Scoped IPv6 addresses can be parsed using *note ipaddress.IPv6Address: +1ff. If present, scope zone ID is available through the *note scope_id: +90d. attribute. (Contributed by Oleksandr Pavliuk in bpo-34788(1).) + +Starting with Python 3.9.5 the *note ipaddress: 80. 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<4>, Next: multiprocessing<2>, Prev: ipaddress<2>, Up: Improved Modules<5> + +1.5.6.18 math +............. + +Expanded the *note math.gcd(): 90f. function to handle multiple +arguments. Formerly, it only supported two arguments. (Contributed by +Serhiy Storchaka in bpo-39648(1).) + +Added *note math.lcm(): 910.: 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(): 494.: return the next floating-point value +after 'x' towards 'y'. (Contributed by Victor Stinner in bpo-39288(4).) + +Added *note math.ulp(): 911.: 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<2>, Next: nntplib, Prev: math<4>, Up: Improved Modules<5> + +1.5.6.19 multiprocessing +........................ + +The *note multiprocessing.SimpleQueue: 913. class has a new *note +close(): 914. 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<5>, Prev: multiprocessing<2>, Up: Improved Modules<5> + +1.5.6.20 nntplib +................ + +‘NNTP’ and ‘NNTP_SSL’ now raise a *note ValueError: 204. 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<5>, Next: pathlib<6>, Prev: nntplib, Up: Improved Modules<5> + +1.5.6.21 os +........... + +Added *note CLD_KILLED: 917. and *note CLD_STOPPED: 918. for ‘si_code’. +(Contributed by Donghee Na in bpo-38493(1).) + +Exposed the Linux-specific *note os.pidfd_open(): 476. (bpo-38692(2)) +and *note os.P_PIDFD: 919. (bpo-38713(3)) for process management with +file descriptors. + +The *note os.unsetenv(): 91a. function is now also available on Windows. +(Contributed by Victor Stinner in bpo-39413(4).) + +The *note os.putenv(): 91b. and *note os.unsetenv(): 91a. functions are +now always available. (Contributed by Victor Stinner in bpo-39395(5).) + +Added *note os.waitstatus_to_exitcode(): 91c. 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<6>, Next: pdb<3>, Prev: os<5>, Up: Improved Modules<5> + +1.5.6.22 pathlib +................ + +Added *note pathlib.Path.readlink(): 91e. which acts similarly to *note +os.readlink(): 91f. (Contributed by Girts Folkmanis in bpo-30618(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=30618 + + +File: python.info, Node: pdb<3>, Next: poplib, Prev: pathlib<6>, Up: Improved Modules<5> + +1.5.6.23 pdb +............ + +On Windows now *note Pdb: 921. supports ‘~/.pdbrc’. (Contributed by Tim +Hopper and Dan Lidral-Porter in bpo-20523(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=20523 + + +File: python.info, Node: poplib, Next: pprint<2>, Prev: pdb<3>, Up: Improved Modules<5> + +1.5.6.24 poplib +............... + +*note POP3: 923. and *note POP3_SSL: 924. now raise a *note ValueError: +204. if the given timeout for their constructor is zero to prevent the +creation of a non-blocking socket. (Contributed by Donghee Na in +bpo-39259(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=39259 + + +File: python.info, Node: pprint<2>, Next: pydoc, Prev: poplib, Up: Improved Modules<5> + +1.5.6.25 pprint +............... + +*note pprint: ae. can now pretty-print *note types.SimpleNamespace: 1d1. +(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, Next: random<3>, Prev: pprint<2>, Up: Improved Modules<5> + +1.5.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__: 927. +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, Up: Improved Modules<5> + +1.5.6.27 random +............... + +Added a new *note random.Random.randbytes(): 929. 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: Improved Modules<5> + +1.5.6.28 signal +............... + +Exposed the Linux-specific *note signal.pidfd_send_signal(): 92b. 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<3>, Prev: signal, Up: Improved Modules<5> + +1.5.6.29 smtplib +................ + +*note SMTP: 92d. and *note SMTP_SSL: 92e. now raise a *note ValueError: +204. 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: 92f. 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<3>, Next: time<3>, Prev: smtplib, Up: Improved Modules<5> + +1.5.6.30 socket +............... + +The *note socket: cc. module now exports the *note CAN_RAW_JOIN_FILTERS: +931. 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: 932. protocol on +platforms that support it. (Contributed by Karl Ding in bpo-40291(2).) + +The socket module now has the *note socket.send_fds(): 933. and *note +socket.recv_fds(): 934. functions. (Contributed by Joannah Nanjekye, +Shinya Okano and Victor Stinner in bpo-28724(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25780 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=40291 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=28724 + + +File: python.info, Node: time<3>, Next: sys<6>, Prev: socket<3>, Up: Improved Modules<5> + +1.5.6.31 time +............. + +On AIX, *note thread_time(): 936. is now implemented with +‘thread_cputime()’ which has nanosecond resolution, rather than +‘clock_gettime(CLOCK_THREAD_CPUTIME_ID)’ which has a resolution of 10 +milliseconds. (Contributed by Batuhan Taskaya in bpo-40192(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=40192 + + +File: python.info, Node: sys<6>, Next: tracemalloc, Prev: time<3>, Up: Improved Modules<5> + +1.5.6.32 sys +............ + +Added a new *note sys.platlibdir: 938. 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: 939. 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<6>, Prev: sys<6>, Up: Improved Modules<5> + +1.5.6.33 tracemalloc +.................... + +Added *note tracemalloc.reset_peak(): 93b. 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<6>, Next: unicodedata<4>, Prev: tracemalloc, Up: Improved Modules<5> + +1.5.6.34 typing +............... + +PEP 593(1) introduced an *note typing.Annotated: 93d. type to decorate +existing types with context-specific metadata and new ‘include_extras’ +parameter to *note typing.get_type_hints(): 6ad. 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<4>, Next: venv<3>, Prev: typing<6>, Up: Improved Modules<5> + +1.5.6.35 unicodedata +.................... + +The Unicode database has been updated to version 13.0.0. +(bpo-39926(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=39926 + + +File: python.info, Node: venv<3>, Next: xml<3>, Prev: unicodedata<4>, Up: Improved Modules<5> + +1.5.6.36 venv +............. + +The activation scripts provided by *note venv: 111. now all specify +their prompt customization consistently by always using the value +specified by ‘__VENV_PROMPT__’. Previously some scripts unconditionally +used ‘__VENV_PROMPT__’, others only if it happened to be set (which was +the default case), and one used ‘__VENV_NAME__’ instead. (Contributed +by Brett Cannon in bpo-37663(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=37663 + + +File: python.info, Node: xml<3>, Prev: venv<3>, Up: Improved Modules<5> + +1.5.6.37 xml +............ + +White space characters within attributes are now preserved when +serializing *note xml.etree.ElementTree: 125. 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: Optimizations<5>, Next: Deprecated<7>, Prev: Improved Modules<5>, Up: What’s New In Python 3 9 + +1.5.7 Optimizations +------------------- + + * 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: d6. 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(): 942. 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: 943, *note tuple: 36b, + *note set: 5d5, *note frozenset: 5d6, *note list: 60d, *note dict: + 258.) 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: 944. of float operation now has a better + performance. Also the message of *note ZeroDivisionError: 945. 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: Deprecated<7>, Next: Removed<7>, Prev: Optimizations<5>, Up: What’s New In Python 3 9 + +1.5.8 Deprecated +---------------- + + * The distutils ‘bdist_msi’ command is now deprecated, use + ‘bdist_wheel’ (wheel packages) instead. (Contributed by Hugo van + Kemenade in bpo-39586(1).) + + * Currently *note math.factorial(): 947. accepts *note float: 2f1. + instances with non-negative integer values (like ‘5.0’). It raises + a *note ValueError: 204. for non-integral and negative floats. It + is now deprecated. In future Python versions it will raise a *note + TypeError: 534. 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: 8. 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: 7cd. 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: 534. in a future version of Python. (Contributed by + Josh Rosenberg in bpo-35712(3).) + + * The *note random: b8. 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: 671, *note int: + 259, *note float: 2f1, *note str: 447, *note bytes: 1c2, and *note + bytearray: 53a. + + * Opening the *note GzipFile: 416. 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(): + 47b. 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: 10. functions are now + deprecated: + + * ‘b2a_hqx()’, ‘a2b_hqx()’ + + * ‘rlecode_hqx()’, ‘rledecode_hqx()’ + + (Contributed by Victor Stinner in bpo-39353(7).) + + * *note ast: 8. 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: 8. 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: + 159. is initialized by *note Py_Initialize(): 8ab. since Python + 3.7. (Contributed by Victor Stinner in bpo-39877(12).) + + * Passing ‘None’ as the first argument to the *note shlex.split(): + 538. 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: + 8c7. 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).) + + * The 'random' parameter of *note random.shuffle(): 742. has been + deprecated. (Contributed by Raymond Hettinger in 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: Removed<7>, Next: Porting to Python 3 9, Prev: Deprecated<7>, Up: What’s New In Python 3 9 + +1.5.9 Removed +------------- + + * 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: 1a0.: ‘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: + 671. 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(): 949. and *note + sys.setswitchinterval(): 94a. 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(): + 94b. 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: 94c. has been + removed. It was deprecated since Python 3.8. Use *note + is_alive(): 94d. instead. (Contributed by Donghee Na in + bpo-37804(8).) + + * Methods ‘getchildren()’ and ‘getiterator()’ of classes *note + ElementTree: 94e. and *note Element: 30a. in the *note ElementTree: + 125. 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: ab. API has been removed, it was deprecated + since Python 3.4. Use the *note load(): 94f, *note loads(): 950, + *note dump(): 951, and *note dumps(): 952. functions. + Additionally, the 'use_builtin_types' parameter was removed, + standard *note bytes: 1c2. 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(): 953. and *note base64.decodebytes(): 954. + 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(): 90f. + instead. (Contributed by Victor Stinner in bpo-39350(15).) + + * The 'buffering' parameter of *note bz2.BZ2File: 863. has been + removed. Since Python 3.0, it was ignored and using it emitted a + *note DeprecationWarning: 1a5. 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(): 955. has been + removed. As of Python 3.1, it was deprecated and ignored; using it + has emitted a *note DeprecationWarning: 1a5. 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: 3a2. 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: 2b2. + 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(): 479. and *note + asyncio.all_tasks(): 956. instead. (Contributed by Rémi Lapeyre in + bpo-40967(22)) + + * The ‘unescape()’ method in the *note html.parser.HTMLParser: 874. + class has been removed (it was deprecated since Python 3.4). *note + html.unescape(): 957. 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: Porting to Python 3 9, Next: Build Changes<5>, Prev: Removed<7>, Up: What’s New In Python 3 9 + +1.5.10 Porting to Python 3.9 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in the Python API: Changes in the Python API<4>. +* Changes in the C API: Changes in the C API<3>. +* CPython bytecode changes: CPython bytecode changes<4>. + + +File: python.info, Node: Changes in the Python API<4>, Next: Changes in the C API<3>, Up: Porting to Python 3 9 + +1.5.10.1 Changes in the Python API +.................................. + + * *note __import__(): 8d3. and *note importlib.util.resolve_name(): + 909. now raise *note ImportError: 415. where it previously raised + *note ValueError: 204. 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: 111. activation scripts no longer special-case when + ‘__VENV_PROMPT__’ is set to ‘""’. + + * The *note select.epoll.unregister(): 95a. method no longer ignores + the *note EBADF: 95b. error. (Contributed by Victor Stinner in + bpo-39239(1).) + + * The 'compresslevel' parameter of *note bz2.BZ2File: 863. 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: 77. module now ignores the *note PYTHONCASEOK: + 95c. environment variable when the *note -E: 95d. or *note -I: 95e. + command line options are being used. + + * The 'encoding' parameter has been added to the classes *note + ftplib.FTP: 8f9. and *note ftplib.FTP_TLS: 8fa. 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(): 8e6. has been added + to *note AbstractEventLoop: 95f, 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(): 960. 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: 4a2. now returns *note + NotImplemented: 7cd. instead of raising a *note TypeError: 534. + when passed something other than an instance of ‘str’ or *note + PurePath: 4a2. 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: 80. 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(): 961. treats leading zeros as octal notatation. + glibc implementation of modern *note inet_pton(): 962. does not + accept any leading zeros. (Contributed by Christian Heimes in + bpo-36384(10)). + + * *note codecs.lookup(): 963. now normalizes the encoding name the + same way as *note encodings.normalize_encoding(): 7f7, except that + *note codecs.lookup(): 963. 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: Changes in the C API<3>, Next: CPython bytecode changes<4>, Prev: Changes in the Python API<4>, Up: Porting to Python 3 9 + +1.5.10.2 Changes in the C API +............................. + + * Instances of *note heap-allocated types: 965. (such as those + created with *note PyType_FromSpec(): 57a. 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: 779. function, ensure that all custom + ‘tp_traverse’ functions of heap-allocated types visit the object’s + type. + + Example: + + int + foo_traverse(foo_struct *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: 965. 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(): 398. 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 bytecode changes<4>, Prev: Changes in the C API<3>, Up: Porting to Python 3 9 + +1.5.10.3 CPython bytecode changes +................................. + + * The *note LOAD_ASSERTION_ERROR: 967. opcode was added for handling + the *note assert: 968. statement. Previously, the assert statement + would not work correctly if the *note AssertionError: 6a5. + exception was being shadowed. (Contributed by Zackery Spytz in + bpo-34880(1).) + + * The *note COMPARE_OP: 969. 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 Changes<5>, Prev: Porting to Python 3 9, Up: What’s New In Python 3 9 + +1.5.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: 938. attribute. See *note sys.platlibdir: 938. + 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: 96b. 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 Changes<5>, Next: Notable changes in Python 3 9 1, Prev: Build Changes<5>, Up: What’s New In Python 3 9 + +1.5.12 C API Changes +-------------------- + +* Menu: + +* New Features: New Features<10>. +* Porting to Python 3.9: Porting to Python 3 9<2>. +* Removed: Removed<8>. + + +File: python.info, Node: New Features<10>, Next: Porting to Python 3 9<2>, Up: C API Changes<5> + +1.5.12.1 New Features +..................... + + * PEP 573(1): Added *note PyType_FromModuleAndSpec(): 54e. to + associate a module with a class; *note PyType_GetModule(): 96e. and + *note PyType_GetModuleState(): 96f. to retrieve the module and its + state; and *note PyCMethod: 75f. and *note METH_METHOD: 970. 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(): 785. function: get a frame code. + Added *note PyFrame_GetBack(): 781. function: get the frame next + outer frame. (Contributed by Victor Stinner in bpo-40421(3).) + + * Added *note PyFrame_GetLineNumber(): 786. to the limited C API. + (Contributed by Victor Stinner in bpo-40421(4).) + + * Added *note PyThreadState_GetInterpreter(): 971. and *note + PyInterpreterState_Get(): 3a9. functions to get the interpreter. + Added *note PyThreadState_GetFrame(): 789. function to get the + current frame of a Python thread state. Added *note + PyThreadState_GetID(): 972. 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(): 397. 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(): 973. and *note + Py_LeaveRecursiveCall(): 974. 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(): 975. 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(): 976. and *note + PyObject_GC_IsFinalized(): 977. 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(): 978. 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: Porting to Python 3 9<2>, Next: Removed<8>, Prev: New Features<10>, Up: C API Changes<5> + +1.5.12.2 Porting to 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: 97a, *note m_clear: 97b. and + *note m_free: 97c. functions of *note PyModuleDef: 97d. 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: 97e. + function). More precisely, these functions are not called if *note + m_size: 97f. is greater than 0 and the module state (as returned by + *note PyModule_GetState(): 980.) is ‘NULL’. + + Extension modules without module state (‘m_size <= 0’) are not + affected. + + * If *note Py_AddPendingCall(): 981. 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: 3b0. when the ‘-E’ option is used (if *note + PyConfig.use_environment: 3d5. 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: 982. 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(): 983. 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(): 984. macro was converted to a + function. + + * The ‘PyObject_NEW()’ macro becomes an alias to the *note + PyObject_New: 985. macro, and the ‘PyObject_NEW_VAR()’ macro + becomes an alias to the *note PyObject_NewVar: 986. macro. + They no longer access directly the *note + PyTypeObject.tp_basicsize: 987. member. + + * ‘PyObject_GET_WEAKREFS_LISTPTR()’ macro was converted to a + function: the macro accessed directly the *note + PyTypeObject.tp_weaklistoffset: 988. member. + + * *note PyObject_CheckBuffer(): 394. macro was converted to a + function: the macro accessed directly the *note + PyTypeObject.tp_as_buffer: 989. member. + + * *note PyIndex_Check(): 98a. 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: 98b. 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: Removed<8>, Prev: Porting to Python 3 9<2>, Up: C API Changes<5> + +1.5.12.3 Removed +................ + + * 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: 98d. 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(): 98e. 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(): 8b7. + 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: Notable changes in Python 3 9 1, Next: Notable changes in Python 3 9 2, Prev: C API Changes<5>, Up: What’s New In Python 3 9 + +1.5.13 Notable changes in Python 3.9.1 +-------------------------------------- + +* Menu: + +* typing: typing<7>. +* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support. + + +File: python.info, Node: typing<7>, Next: macOS 11 0 Big Sur and Apple Silicon Mac support, Up: Notable changes in Python 3 9 1 + +1.5.13.1 typing +............... + +The behavior of *note typing.Literal: 851. 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: 534. exception + during equality comparisons if any of their parameters are not + *note hashable: 60c. 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 "", line 1, in + TypeError: unhashable type: 'set' + +(Contributed by Yurii Karabas in bpo-42345(2).) + + ---------- 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 and Apple Silicon Mac support, Prev: typing<7>, Up: Notable changes in Python 3 9 1 + +1.5.13.2 macOS 11.0 (Big Sur) and Apple Silicon Mac support +........................................................... + +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”). + +(Contributed by Ronald Oussoren and Lawrence D’Anna in bpo-41100(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=41100 + + +File: python.info, Node: Notable changes in Python 3 9 2, Next: Notable changes in Python 3 9 3, Prev: Notable changes in Python 3 9 1, Up: What’s New In Python 3 9 + +1.5.14 Notable changes in Python 3.9.2 +-------------------------------------- + +* Menu: + +* collections.abc: collections abc<2>. +* urllib.parse: urllib parse<2>. + + +File: python.info, Node: collections abc<2>, Next: urllib parse<2>, Up: Notable changes in Python 3 9 2 + +1.5.14.1 collections.abc +........................ + +*note collections.abc.Callable: 7e5. generic now flattens type +parameters, similar to what *note typing.Callable: 7c0. 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: 7e6. can now be +subclassed, and a subclass will be returned when subscripting the *note +collections.abc.Callable: 7e5. type. Code which accesses the arguments +via *note typing.get_args(): 87c. or ‘__args__’ need to account for this +change. A *note DeprecationWarning: 1a5. may be emitted for invalid +forms of parameterizing *note collections.abc.Callable: 7e5. which may +have passed silently in Python 3.9.1. This *note DeprecationWarning: +1a5. will become a *note TypeError: 534. in Python 3.10. (Contributed +by Ken Jin in bpo-42195(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=42195 + + +File: python.info, Node: urllib parse<2>, Prev: collections abc<2>, Up: Notable changes in Python 3 9 2 + +1.5.14.2 urllib.parse +..................... + +Earlier Python versions allowed using both ‘;’ and ‘&’ as query +parameter separators in *note urllib.parse.parse_qs(): 27c. and *note +urllib.parse.parse_qsl(): 27b. 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 9 3, Next: Notable changes in Python 3 9 5, Prev: Notable changes in Python 3 9 2, Up: What’s New In Python 3 9 + +1.5.15 Notable changes in Python 3.9.3 +-------------------------------------- + +A security fix alters the *note ftplib.FTP: 8f9. 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 9 5, Next: Notable security feature in 3 9 14, Prev: Notable changes in Python 3 9 3, Up: What’s New In Python 3 9 + +1.5.16 Notable changes in Python 3.9.5 +-------------------------------------- + +* Menu: + +* urllib.parse: urllib parse<3>. + + +File: python.info, Node: urllib parse<3>, Up: Notable changes in Python 3 9 5 + +1.5.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: 10a. +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: Notable changes in Python 3 9 5, Up: What’s New In Python 3 9 + +1.5.17 Notable security feature in 3.9.14 +----------------------------------------- + +Converting between *note int: 259. and *note str: 447. in bases other +than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 +(decimal) now raises a *note ValueError: 204. 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: d9. APIs. See the *note +integer string conversion length limitation: 5f1. 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.5.18 Notable changes in 3.9.17 +-------------------------------- + +* Menu: + +* tarfile: tarfile<4>. + + +File: python.info, Node: tarfile<4>, Up: Notable changes in 3 9 17 + +1.5.18.1 tarfile +................ + + * The extraction methods in *note tarfile: de, and *note + shutil.unpack_archive(): 467, 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: 468. for details. In Python 3.12, use + without the 'filter' argument will show a *note DeprecationWarning: + 1a5. 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.6 What’s New In Python 3.8 +============================ + + +Editor: 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: 13c. + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<5>. +* New Features: New Features<11>. +* Other Language Changes: Other Language Changes<6>. +* New Modules: New Modules<6>. +* Improved Modules: Improved Modules<6>. +* Optimizations: Optimizations<6>. +* Build and C API Changes:: +* Deprecated: Deprecated<8>. +* API and Feature Removals:: +* Porting to Python 3.8: Porting to Python 3 8. +* Notable changes in Python 3.8.1: Notable changes in Python 3 8 1. +* Notable changes in Python 3.8.2: Notable changes in Python 3 8 2. +* Notable changes in Python 3.8.3: Notable changes in Python 3 8 3. +* Notable changes in Python 3.8.8: Notable changes in Python 3 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: Summary – Release highlights<5>, Next: New Features<11>, Up: What’s New In Python 3 8 + +1.6.1 Summary – Release highlights +---------------------------------- + + +File: python.info, Node: New Features<11>, Next: Other Language Changes<6>, Prev: Summary – Release highlights<5>, Up: What’s New In Python 3 8 + +1.6.2 New Features +------------------ + +* Menu: + +* Assignment expressions:: +* Positional-only parameters:: +* Parallel filesystem cache for compiled bytecode files:: +* Debug build uses the same ABI as release build:: +* f-strings support = for self-documenting expressions and debugging:: +* PEP 578; Python Runtime Audit Hooks: PEP 578 Python Runtime Audit Hooks. +* PEP 587; Python Initialization Configuration: PEP 587 Python Initialization Configuration. +* PEP 590; Vectorcall; a fast calling protocol for CPython: PEP 590 Vectorcall a fast calling protocol for CPython. +* Pickle protocol 5 with out-of-band data buffers:: + + +File: python.info, Node: Assignment expressions, Next: Positional-only parameters, Up: New Features<11> + +1.6.2.1 Assignment expressions +.............................. + +There is new syntax ‘:=’ that assigns values to variables as part of a +larger expression. It is affectionately known as “the walrus operator” +due to its resemblance to the eyes and tusks of a walrus(1). + +In this example, the assignment expression helps avoid calling *note +len(): 62a. twice: + + if (n := len(a)) > 10: + print(f"List is too long ({n} elements, expected <= 10)") + +A similar benefit arises during regular expression matching where match +objects are needed twice, once to test whether a match occurred and +another to extract a subgroup: + + discount = 0.0 + if (mo := re.search(r'(\d+)% discount', advertisement)): + discount = float(mo.group(1)) / 100.0 + +The operator is also useful with while-loops that compute a value to +test loop termination and then need that same value again in the body of +the loop: + + # Loop over fixed length blocks + while (block := f.read(256)) != '': + process(block) + +Another motivating use case arises in list comprehensions where a value +computed in a filtering condition is also needed in the expression body: + + [clean_name.title() for name in names + if (clean_name := normalize('NFC', name)) in allowed_names] + +Try to limit use of the walrus operator to clean cases that reduce +complexity and improve readability. + +See PEP 572(2) for a full description. + +(Contributed by Emily Morehouse in 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: Positional-only parameters, Next: Parallel filesystem cache for compiled bytecode files, Prev: Assignment expressions, Up: New Features<11> + +1.6.2.2 Positional-only parameters +.................................. + +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. + +In the following example, parameters 'a' and 'b' are positional-only, +while 'c' or 'd' can be positional or keyword, and 'e' or 'f' are +required to be keywords: + + def f(a, b, /, c, d, *, e, f): + print(a, b, c, d, e, f) + +The following is a valid call: + + f(10, 20, 30, d=40, e=50, f=60) + +However, these are invalid calls: + + 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(): 9a1. function does not accept keyword +arguments: + + def divmod(a, b, /): + "Emulate the built in divmod() function" + return (a // b, a % b) + +Another use case is to preclude keyword arguments when the parameter +name is not helpful. For example, the builtin *note len(): 62a. +function has the signature ‘len(obj, /)’. This precludes awkward calls +such as: + + len(obj='hello') # The "obj" keyword argument impairs readability + +A further benefit of marking a parameter as positional-only is that it +allows the parameter name to be changed in the future without risk of +breaking client code. For example, in the *note statistics: d2. module, +the parameter name 'dist' may be changed in the future. This was made +possible with the following function specification: + + 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} + +This greatly simplifies the implementation of functions and methods that +need to accept arbitrary keyword arguments. For example, here is an +excerpt from code in the *note collections: 1d. module: + + class Counter(dict): + + def __init__(self, iterable=None, /, **kwds): + # Note "iterable" is a possible keyword argument + +See PEP 570(2) for a full description. + +(Contributed by Pablo Galindo in 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: Parallel filesystem cache for compiled bytecode files, Next: Debug build uses the same ABI as release build, Prev: Positional-only parameters, Up: New Features<11> + +1.6.2.3 Parallel filesystem cache for compiled bytecode files +............................................................. + +The new *note PYTHONPYCACHEPREFIX: 9a3. setting (also available as *note +-X: 176. ‘pycache_prefix’) configures the implicit bytecode cache to use +a separate parallel filesystem tree, rather than the default +‘__pycache__’ subdirectories within each source directory. + +The location of the cache is reported in *note sys.pycache_prefix: 9a4. +(*note None: 671. indicates the default location in ‘__pycache__’ +subdirectories). + +(Contributed by Carl Meyer in bpo-33499(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=33499 + + +File: python.info, Node: Debug build uses the same ABI as release build, Next: f-strings support = for self-documenting expressions and debugging, Prev: Parallel filesystem cache for compiled bytecode files, Up: New Features<11> + +1.6.2.4 Debug build uses the same ABI as release build +...................................................... + +Python now uses the same ABI whether it’s built in release or debug +mode. 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. + +Release builds and *note debug builds: 1fb. 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(): 423. +function and the *note PYTHONDUMPREFS: 9a6. environment variable, can be +set using the new *note ./configure -with-trace-refs: 390. build option. +(Contributed by Victor Stinner in bpo-36465(1).) + +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. (Contributed +by Victor Stinner in bpo-21536(2).) + +On Unix, when Python is built in debug mode, import now also looks for C +extensions compiled in release mode and for C extensions compiled with +the stable ABI. (Contributed by Victor Stinner in bpo-36722(3).) + +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. + +Add a pkg-config ‘python-3.8-embed’ module to embed Python into an +application: ‘pkg-config python-3.8-embed --libs’ includes +‘-lpython3.8’. To support both 3.8 and older, try ‘pkg-config +python-X.Y-embed --libs’ first and fallback to ‘pkg-config python-X.Y +--libs’ (without ‘--embed’) if the previous command fails (replace ‘X.Y’ +with the Python version). + +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 and Cygwin, whose cases are handled by the script); this change +is backward incompatible on purpose. (Contributed by Victor Stinner in +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-strings support = for self-documenting expressions and debugging, Next: PEP 578 Python Runtime Audit Hooks, Prev: Debug build uses the same ABI as release build, Up: New Features<11> + +1.6.2.5 f-strings support ‘=’ for self-documenting expressions and debugging +............................................................................ + +Added an ‘=’ specifier to *note f-string: 431.s. An f-string such as +‘f'{expr=}'’ will expand to the text of the expression, an equal sign, +then the representation of the evaluated expression. For example: + + >>> user = 'eric_idle' + >>> member_since = date(1975, 7, 31) + >>> f'{user=} {member_since=}' + "user='eric_idle' member_since=datetime.date(1975, 7, 31)" + +The usual *note f-string format specifiers: 9a9. allow more control over +how the result of the expression is displayed: + + >>> delta = date.today() - member_since + >>> f'{user=!s} {delta.days=:,d}' + 'user=eric_idle delta.days=16,075' + +The ‘=’ specifier will display the whole expression so that calculations +can be shown: + + >>> print(f'{theta=} {cos(radians(theta))=:.3f}') + theta=30 cos(radians(theta))=0.866 + +(Contributed by Eric V. Smith and Larry Hastings in bpo-36817(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36817 + + +File: python.info, Node: PEP 578 Python Runtime Audit Hooks, Next: PEP 587 Python Initialization Configuration, Prev: f-strings support = for self-documenting expressions and debugging, Up: New Features<11> + +1.6.2.6 PEP 578: Python Runtime Audit Hooks +........................................... + +The PEP adds an Audit Hook and Verified Open Hook. Both are available +from Python and native code, allowing applications and frameworks +written in pure Python code to take advantage of extra notifications, +while also allowing embedders or system administrators to deploy builds +of Python where auditing is always enabled. + +See PEP 578(1) for full details. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0578/ + + +File: python.info, Node: PEP 587 Python Initialization Configuration, Next: PEP 590 Vectorcall a fast calling protocol for CPython, Prev: PEP 578 Python Runtime Audit Hooks, Up: New Features<11> + +1.6.2.7 PEP 587: Python Initialization Configuration +.................................................... + +The PEP 587(1) adds a new C API to configure the Python Initialization +providing finer control on the whole configuration and better error +reporting. + +New structures: + + * *note PyConfig: 3a2. + + * *note PyPreConfig: 9ac. + + * *note PyStatus: 9ad. + + * *note PyWideStringList: 9ae. + +New functions: + + * *note PyConfig_Clear(): 9af. + + * *note PyConfig_InitIsolatedConfig(): 9b0. + + * *note PyConfig_InitPythonConfig(): 9b1. + + * *note PyConfig_Read(): 78b. + + * *note PyConfig_SetArgv(): 9b2. + + * *note PyConfig_SetBytesArgv(): 9b3. + + * *note PyConfig_SetBytesString(): 9b4. + + * *note PyConfig_SetString(): 9b5. + + * *note PyPreConfig_InitIsolatedConfig(): 9b6. + + * *note PyPreConfig_InitPythonConfig(): 9b7. + + * *note PyStatus_Error(): 9b8. + + * *note PyStatus_Exception(): 9b9. + + * *note PyStatus_Exit(): 9ba. + + * *note PyStatus_IsError(): 9bb. + + * *note PyStatus_IsExit(): 9bc. + + * *note PyStatus_NoMemory(): 9bd. + + * *note PyStatus_Ok(): 9be. + + * *note PyWideStringList_Append(): 9bf. + + * *note PyWideStringList_Insert(): 9c0. + + * *note Py_BytesMain(): 9c1. + + * *note Py_ExitStatusException(): 9c2. + + * *note Py_InitializeFromConfig(): 3c1. + + * *note Py_PreInitialize(): 3e7. + + * *note Py_PreInitializeFromArgs(): 9c3. + + * *note Py_PreInitializeFromBytesArgs(): 9c4. + + * *note Py_RunMain(): 9c5. + +This PEP also adds ‘_PyRuntimeState.preconfig’ (*note PyPreConfig: 9ac. +type) and ‘PyInterpreterState.config’ (*note PyConfig: 3a2. type) fields +to these internal structures. ‘PyInterpreterState.config’ becomes the +new reference configuration, replacing global configuration variables +and other private variables. + +See *note Python Initialization Configuration: 3a3. for the +documentation. + +See PEP 587(2) for a full description. + +(Contributed by Victor Stinner in 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 protocol 5 with out-of-band data buffers, Prev: PEP 587 Python Initialization Configuration, Up: New Features<11> + +1.6.2.8 PEP 590: Vectorcall: a fast calling protocol for CPython +................................................................ + +*note The Vectorcall Protocol: 54f. 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: 77a. implementing a callable +can use this protocol. + +This is currently provisional. The aim is to make it fully public in +Python 3.9. + +See PEP 590(1) for a full description. + +(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 protocol 5 with out-of-band data buffers, Prev: PEP 590 Vectorcall a fast calling protocol for CPython, Up: New Features<11> + +1.6.2.9 Pickle protocol 5 with out-of-band data buffers +....................................................... + +When *note pickle: a6. is used to transfer large data between Python +processes in order to take advantage of multi-core or multi-machine +processing, it is important to optimize the transfer by reducing memory +copies, and possibly by applying custom techniques such as +data-dependent compression. + +The *note pickle: a6. protocol 5 introduces support for out-of-band +buffers where PEP 3118(1)-compatible data can be transmitted separately +from the main pickle stream, at the discretion of the communication +layer. + +See PEP 574(2) for a full description. + +(Contributed by Antoine Pitrou in 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: Other Language Changes<6>, Next: New Modules<6>, Prev: New Features<11>, Up: What’s New In Python 3 8 + +1.6.3 Other Language Changes +---------------------------- + + * A *note continue: 9c9. statement was illegal in the *note finally: + 9ca. clause due to a problem with the implementation. In Python + 3.8 this restriction was lifted. (Contributed by Serhiy Storchaka + in bpo-32489(1).) + + * The *note bool: 463, *note int: 259, and *note fractions.Fraction: + 1e9. types now have an *note as_integer_ratio(): 9cb. method like + that found in *note float: 2f1. and *note decimal.Decimal: 29f. + This minor API extension makes it possible to write ‘numerator, + denominator = x.as_integer_ratio()’ and have it work across + multiple numeric types. (Contributed by Lisa Roach in bpo-33073(2) + and Raymond Hettinger in bpo-37819(3).) + + * Constructors of *note int: 259, *note float: 2f1. and *note + complex: 2f2. will now use the *note __index__(): 718. special + method, if available and the corresponding method *note __int__(): + 717, *note __float__(): 9cc. or *note __complex__(): 5e3. is not + available. (Contributed by Serhiy Storchaka in bpo-20092(4).) + + * Added support of ‘\N{NAME}’ escapes in *note regular expressions: + b9.: + + >>> notice = 'Copyright © 2019' + >>> copyright_year_pattern = re.compile(r'\N{copyright sign}\s*(\d{4})') + >>> int(copyright_year_pattern.search(notice).group(1)) + 2019 + + (Contributed by Jonathan Eunice and Serhiy Storchaka in + bpo-30688(5).) + + * Dict and dictviews are now iterable in reversed insertion order + using *note reversed(): 862. (Contributed by Rémi Lapeyre in + bpo-33462(6).) + + * The syntax allowed for keyword names in function calls was further + restricted. In particular, ‘f((keyword)=arg)’ is no longer + allowed. It was never intended to permit more than a bare name on + the left-hand side of a keyword argument assignment term. + (Contributed by Benjamin Peterson in bpo-34641(7).) + + * Generalized iterable unpacking in *note yield: 9cd. and *note + return: 9ce. statements no longer requires enclosing parentheses. + This brings the 'yield' and 'return' syntax into better agreement + with normal assignment syntax: + + >>> def parse(family): + lastname, *members = family.split() + return lastname.upper(), *members + + >>> parse('simpsons homer marge bart lisa maggie') + ('SIMPSONS', 'homer', 'marge', 'bart', 'lisa', 'maggie') + + (Contributed by David Cuthbert and Jordan Chapman in bpo-32117(8).) + + * When a comma is missed in code such as ‘[(10, 20) (30, 40)]’, the + compiler displays a *note SyntaxWarning: 461. with a helpful + suggestion. This improves on just having a *note TypeError: 534. + indicating that the first tuple was not callable. (Contributed by + Serhiy Storchaka in bpo-15248(9).) + + * Arithmetic operations between subclasses of *note datetime.date: + 1cd. or *note datetime.datetime: 1cc. and *note datetime.timedelta: + 9cf. objects now return an instance of the subclass, rather than + the base class. This also affects the return type of operations + whose implementation (directly or indirectly) uses *note + datetime.timedelta: 9cf. arithmetic, such as *note astimezone(): + 9d0. (Contributed by Paul Ganssle in bpo-32417(10).) + + * When the Python interpreter is interrupted by Ctrl-C (SIGINT) and + the resulting *note KeyboardInterrupt: 9d1. exception is not + caught, the Python process now exits via a SIGINT signal or with + the correct exit code such that the calling process can detect that + it died due to a Ctrl-C. Shells on POSIX and Windows use this to + properly terminate scripts in interactive sessions. (Contributed + by Google via Gregory P. Smith in bpo-1054041(11).) + + * Some advanced styles of programming require updating the *note + types.CodeType: 2e3. object for an existing function. Since code + objects are immutable, a new code object needs to be created, one + that is modeled on the existing code object. With 19 parameters, + this was somewhat tedious. Now, the new ‘replace()’ method makes + it possible to create a clone with a few altered parameters. + + Here’s an example that alters the *note statistics.mean(): 6cd. + function to prevent the 'data' parameter from being used as a + keyword argument: + + >>> 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' + + (Contributed by Victor Stinner in bpo-37032(12).) + + * For integers, the three-argument form of the *note pow(): 9d2. + 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 + + (Contributed by Mark Dickinson in bpo-36027(15).) + + * Dict comprehensions have been synced-up with dict literals so that + the key is computed first and the value second: + + >>> # 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 + + The guaranteed execution order is helpful with assignment + expressions because variables assigned in the key expression will + be available in the value expression: + + >>> 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'} + + (Contributed by Jörn Heissler in bpo-35224(16).) + + * The *note object.__reduce__(): 9d3. 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 ‘__setstate__()’ 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: New Modules<6>, Next: Improved Modules<6>, Prev: Other Language Changes<6>, Up: What’s New In Python 3 8 + +1.6.4 New Modules +----------------- + + * The new *note importlib.metadata: 7a. module provides (provisional) + support for reading metadata from third-party packages. For + example, it can extract an installed package’s version number, list + of entry points, and more: + + >>> # 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')] + + (Contributed by Barry Warsaw and Jason R. Coombs in bpo-34632(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34632 + + +File: python.info, Node: Improved Modules<6>, Next: Optimizations<6>, Prev: New Modules<6>, Up: What’s New In Python 3 8 + +1.6.5 Improved Modules +---------------------- + +* Menu: + +* ast: ast<3>. +* asyncio: asyncio<6>. +* builtins: builtins<2>. +* collections:: +* cProfile:: +* csv: csv<2>. +* curses: curses<3>. +* ctypes: ctypes<2>. +* datetime: datetime<3>. +* functools: functools<2>. +* gc: gc<3>. +* gettext:: +* gzip: gzip<3>. +* IDLE and idlelib: IDLE and idlelib<4>. +* inspect: inspect<5>. +* io: io<3>. +* itertools: itertools<4>. +* json.tool: json tool. +* logging: logging<2>. +* math: math<5>. +* mmap: mmap<2>. +* multiprocessing: multiprocessing<3>. +* os: os<6>. +* os.path: os path<5>. +* pathlib: pathlib<7>. +* pickle:: +* plistlib:: +* pprint: pprint<3>. +* py_compile: py_compile<2>. +* shlex:: +* shutil: shutil<4>. +* socket: socket<4>. +* ssl: ssl<4>. +* statistics: statistics<4>. +* sys: sys<7>. +* tarfile: tarfile<5>. +* threading: threading<4>. +* tokenize: tokenize<2>. +* tkinter: tkinter<4>. +* time: time<4>. +* typing: typing<8>. +* unicodedata: unicodedata<5>. +* unittest: unittest<6>. +* venv: venv<4>. +* weakref:: +* xml: xml<4>. +* xmlrpc:: + + +File: python.info, Node: ast<3>, Next: asyncio<6>, Up: Improved Modules<6> + +1.6.5.1 ast +........... + +AST nodes now have ‘end_lineno’ and ‘end_col_offset’ attributes, which +give the precise location of the end of the node. (This only applies to +nodes that have ‘lineno’ and ‘col_offset’ attributes.) + +New function *note ast.get_source_segment(): 9d7. returns the source +code for a specific AST node. + +(Contributed by Ivan Levkivskyi in bpo-33416(1).) + +The *note ast.parse(): 1a8. function has some new flags: + + * ‘type_comments=True’ causes it to return the text of PEP 484(2) and + PEP 526(3) type comments associated with certain AST nodes; + + * ‘mode='func_type'’ can be used to parse PEP 484(4) “signature type + comments” (returned for function definition AST nodes); + + * ‘feature_version=(3, N)’ allows specifying an earlier Python 3 + version. For example, ‘feature_version=(3, 4)’ will treat *note + async: 72d. and *note await: 1b9. as non-reserved words. + +(Contributed by Guido van Rossum in 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<6>, Next: builtins<2>, Prev: ast<3>, Up: Improved Modules<6> + +1.6.5.2 asyncio +............... + +*note asyncio.run(): 478. has graduated from the provisional to stable +API. This function can be used to execute a *note coroutine: 48d. and +return the result while automatically managing the event loop. For +example: + + import asyncio + + async def main(): + await asyncio.sleep(0) + return 42 + + asyncio.run(main()) + +This is 'roughly' equivalent to: + + 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() + +The actual implementation is significantly more complex. Thus, *note +asyncio.run(): 478. should be the preferred way of running asyncio +programs. + +(Contributed by Yury Selivanov in bpo-32314(1).) + +Running ‘python -m asyncio’ launches a natively async REPL. This allows +rapid experimentation with code that has a top-level *note await: 1b9. +There is no longer a need to directly call ‘asyncio.run()’ which would +spawn a new event loop on every invocation: + + $ 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 + +(Contributed by Yury Selivanov in bpo-37028(2).) + +The exception *note asyncio.CancelledError: 1b8. now inherits from *note +BaseException: 5b7. rather than *note Exception: 9d9. and no longer +inherits from *note concurrent.futures.CancelledError: 9da. +(Contributed by Yury Selivanov in bpo-32528(3).) + +On Windows, the default event loop is now *note ProactorEventLoop: 605. +(Contributed by Victor Stinner in bpo-34687(4).) + +*note ProactorEventLoop: 605. now also supports UDP. (Contributed by +Adam Meily and Andrew Svetlov in bpo-29883(5).) + +*note ProactorEventLoop: 605. can now be interrupted by *note +KeyboardInterrupt: 9d1. (“CTRL+C”). (Contributed by Vladimir Matveev in +bpo-23057(6).) + +Added *note asyncio.Task.get_coro(): 9db. for getting the wrapped +coroutine within an *note asyncio.Task: 1be. (Contributed by Alex +Grönholm in bpo-36999(7).) + +Asyncio tasks can now be named, either by passing the ‘name’ keyword +argument to *note asyncio.create_task(): 1bf. or the *note +create_task(): 1c0. event loop method, or by calling the *note +set_name(): 9dc. method on the task object. The task name is visible in +the ‘repr()’ output of *note asyncio.Task: 1be. and can also be +retrieved using the *note get_name(): 9dd. method. (Contributed by Alex +Grönholm in bpo-34270(8).) + +Added support for Happy Eyeballs(9) to *note +asyncio.loop.create_connection(): 5ff. To specify the behavior, two new +parameters have been added: 'happy_eyeballs_delay' and 'interleave'. +The Happy Eyeballs algorithm improves responsiveness in applications +that support IPv4 and IPv6 by attempting to simultaneously connect using +both. (Contributed by twisteroid ambassador in bpo-33530(10).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32314 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=37028 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=32528 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=34687 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=29883 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=23057 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=36999 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=34270 + + (9) https://en.wikipedia.org/wiki/Happy_Eyeballs + + (10) https://bugs.python.org/issue?@action=redirect&bpo=33530 + + +File: python.info, Node: builtins<2>, Next: collections, Prev: asyncio<6>, Up: Improved Modules<6> + +1.6.5.3 builtins +................ + +The *note compile(): 192. built-in has been improved to accept the +‘ast.PyCF_ALLOW_TOP_LEVEL_AWAIT’ flag. With this new flag passed, *note +compile(): 192. will allow top-level ‘await’, ‘async for’ and ‘async +with’ constructs that are usually considered invalid syntax. +Asynchronous code object marked with the ‘CO_COROUTINE’ flag may then be +returned. (Contributed by Matthias Bussonnier in bpo-34616(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34616 + + +File: python.info, Node: collections, Next: cProfile, Prev: builtins<2>, Up: Improved Modules<6> + +1.6.5.4 collections +................... + +The *note _asdict(): 9e0. method for *note collections.namedtuple(): +1ca. now returns a *note dict: 258. instead of a *note +collections.OrderedDict: 5d7. This works because regular dicts have +guaranteed ordering since Python 3.7. If the extra features of +‘OrderedDict’ are required, the suggested remediation is to cast the +result to the desired type: ‘OrderedDict(nt._asdict())’. (Contributed +by Raymond Hettinger in bpo-35864(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=35864 + + +File: python.info, Node: cProfile, Next: csv<2>, Prev: collections, Up: Improved Modules<6> + +1.6.5.5 cProfile +................ + +The *note cProfile.Profile: 9e2. class can now be used as a context +manager. Profile a block of code by running: + + import cProfile + + with cProfile.Profile() as profiler: + # code to be profiled + ... + +(Contributed by Scott Sanderson in bpo-29235(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=29235 + + +File: python.info, Node: csv<2>, Next: curses<3>, Prev: cProfile, Up: Improved Modules<6> + +1.6.5.6 csv +........... + +The *note csv.DictReader: 9e4. now returns instances of *note dict: 258. +instead of a *note collections.OrderedDict: 5d7. The tool is now faster +and uses less memory while still preserving the field order. +(Contributed by Michael Selik in bpo-34003(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34003 + + +File: python.info, Node: curses<3>, Next: ctypes<2>, Prev: csv<2>, Up: Improved Modules<6> + +1.6.5.7 curses +.............. + +Added a new variable holding structured version information for the +underlying ncurses library: *note ncurses_version: 9e6. (Contributed by +Serhiy Storchaka in bpo-31680(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31680 + + +File: python.info, Node: ctypes<2>, Next: datetime<3>, Prev: curses<3>, Up: Improved Modules<6> + +1.6.5.8 ctypes +.............. + +On Windows, *note CDLL: 9e8. and subclasses now accept a 'winmode' +parameter to specify flags for the underlying ‘LoadLibraryEx’ call. The +default flags are set to only load DLL dependencies from trusted +locations, including the path where the DLL is stored (if a full or +partial path is used to load the initial DLL) and paths added by *note +add_dll_directory(): 9e9. (Contributed by Steve Dower in bpo-36085(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36085 + + +File: python.info, Node: datetime<3>, Next: functools<2>, Prev: ctypes<2>, Up: Improved Modules<6> + +1.6.5.9 datetime +................ + +Added new alternate constructors *note datetime.date.fromisocalendar(): +9eb. and *note datetime.datetime.fromisocalendar(): 9ec, which construct +*note date: 1cd. and *note datetime: 1cc. 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<2>, Next: gc<3>, Prev: datetime<3>, Up: Improved Modules<6> + +1.6.5.10 functools +.................. + +*note functools.lru_cache(): 9ee. can now be used as a straight +decorator rather than as a function returning a decorator. So both of +these are now supported: + + @lru_cache + def f(x): + ... + + @lru_cache(maxsize=256) + def f(x): + ... + +(Contributed by Raymond Hettinger in bpo-36772(1).) + +Added a new *note functools.cached_property(): 53e. decorator, for +computed properties cached for the life of the instance. + + 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) + +(Contributed by Carl Meyer in bpo-21145(2)) + +Added a new *note functools.singledispatchmethod(): 9ef. decorator that +converts methods into *note generic functions: 9f0. using *note single +dispatch: 9f1.: + + 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] + +(Contributed by Ethan Smith in 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<3>, Next: gettext, Prev: functools<2>, Up: Improved Modules<6> + +1.6.5.11 gc +........... + +*note get_objects(): 7ff. can now receive an optional 'generation' +parameter indicating a generation to get objects from. (Contributed by +Pablo Galindo in bpo-36016(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36016 + + +File: python.info, Node: gettext, Next: gzip<3>, Prev: gc<3>, Up: Improved Modules<6> + +1.6.5.12 gettext +................ + +Added *note pgettext(): 9f4. and its variants. (Contributed by Franz +Glasner, Éric Araujo, and Cheryl Sabella in bpo-2504(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=2504 + + +File: python.info, Node: gzip<3>, Next: IDLE and idlelib<4>, Prev: gettext, Up: Improved Modules<6> + +1.6.5.13 gzip +............. + +Added the 'mtime' parameter to *note gzip.compress(): 63a. for +reproducible output. (Contributed by Guo Ci Teo in bpo-34898(1).) + +A *note BadGzipFile: 9f6. exception is now raised instead of *note +OSError: 413. for certain types of invalid or corrupt gzip files. +(Contributed by Filip Gruszczyński, Michele Orrù, and Zackery Spytz in +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 and idlelib<4>, Next: inspect<5>, Prev: gzip<3>, Up: Improved Modules<6> + +1.6.5.14 IDLE and idlelib +......................... + +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).) + +The changes above have been backported to 3.7 maintenance releases. + +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<5>, Next: io<3>, Prev: IDLE and idlelib<4>, Up: Improved Modules<6> + +1.6.5.15 inspect +................ + +The *note inspect.getdoc(): 9f9. function can now find docstrings for +‘__slots__’ if that attribute is a *note dict: 258. where the values are +docstrings. This provides documentation options similar to what we +already have for *note property(): 194, *note classmethod(): 166, and +*note staticmethod(): 412.: + + 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) + +(Contributed by Raymond Hettinger in bpo-36326(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36326 + + +File: python.info, Node: io<3>, Next: itertools<4>, Prev: inspect<5>, Up: Improved Modules<6> + +1.6.5.16 io +........... + +In development mode (*note -X: 176. ‘env’) and in *note debug build: +1fb, the *note io.IOBase: 1f7. 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<4>, Next: json tool, Prev: io<3>, Up: Improved Modules<6> + +1.6.5.17 itertools +.................. + +The *note itertools.accumulate(): 9fc. function added an option +'initial' keyword argument to specify an initial value: + + >>> from itertools import accumulate + >>> list(accumulate([10, 5, 30, 15], initial=1000)) + [1000, 1010, 1015, 1045, 1060] + +(Contributed by Lisa Roach in bpo-34659(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34659 + + +File: python.info, Node: json tool, Next: logging<2>, Prev: itertools<4>, Up: Improved Modules<6> + +1.6.5.18 json.tool +.................. + +Add option ‘--json-lines’ to parse every input line as a separate JSON +object. (Contributed by Weipeng Hong in bpo-31553(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31553 + + +File: python.info, Node: logging<2>, Next: math<5>, Prev: json tool, Up: Improved Modules<6> + +1.6.5.19 logging +................ + +Added a 'force' keyword argument to *note logging.basicConfig(): 9ff. +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<5>, Next: mmap<2>, Prev: logging<2>, Up: Improved Modules<6> + +1.6.5.20 math +............. + +Added new function *note math.dist(): a01. for computing Euclidean +distance between two points. (Contributed by Raymond Hettinger in +bpo-33089(1).) + +Expanded the *note math.hypot(): a02. function to handle multiple +dimensions. Formerly, it only supported the 2-D case. (Contributed by +Raymond Hettinger in bpo-33089(2).) + +Added new function, *note math.prod(): a03, as analogous function to +*note sum(): 466. that returns the product of a ‘start’ value (default: +1) times an iterable of numbers: + + >>> prior = 0.8 + >>> likelihoods = [0.625, 0.84, 0.30] + >>> math.prod(likelihoods, start=prior) + 0.126 + +(Contributed by Pablo Galindo in bpo-35606(3).) + +Added two new combinatoric functions *note math.perm(): 6cc. and *note +math.comb(): 6cb.: + + >>> 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 + +(Contributed by Yash Aggarwal, Keller Fuchs, Serhiy Storchaka, and +Raymond Hettinger in bpo-37128(4), bpo-37178(5), and bpo-35431(6).) + +Added a new function *note math.isqrt(): a04. for computing accurate +integer square roots without conversion to floating point. The new +function supports arbitrarily large integers. It is faster than +‘floor(sqrt(n))’ but slower than *note math.sqrt(): a05.: + + >>> r = 650320427 + >>> s = r ** 2 + >>> isqrt(s - 1) # correct + 650320426 + >>> floor(sqrt(s - 1)) # incorrect + 650320427 + +(Contributed by Mark Dickinson in bpo-36887(7).) + +The function *note math.factorial(): 947. no longer accepts arguments +that are not int-like. (Contributed by Pablo Galindo in bpo-33083(8).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=33089 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=33089 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=35606 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=37128 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=37178 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=35431 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=36887 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=33083 + + +File: python.info, Node: mmap<2>, Next: multiprocessing<3>, Prev: math<5>, Up: Improved Modules<6> + +1.6.5.21 mmap +............. + +The *note mmap.mmap: 20d. class now has an *note madvise(): a07. 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<3>, Next: os<6>, Prev: mmap<2>, Up: Improved Modules<6> + +1.6.5.22 multiprocessing +........................ + +Added new *note multiprocessing.shared_memory: 99. 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<6>, Next: os path<5>, Prev: multiprocessing<3>, Up: Improved Modules<6> + +1.6.5.23 os +........... + +Added new function *note add_dll_directory(): 9e9. on Windows for +providing additional search paths for native dependencies when importing +extension modules or loading DLLs using *note ctypes: 2a. (Contributed +by Steve Dower in bpo-36085(1).) + +A new *note os.memfd_create(): a0a. 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(): 49c. will now traverse +anything supported by the operating system, while *note os.lstat(): 49d. +will only open reparse points that identify as “name surrogates” while +others are opened as for *note os.stat(): 49c. In all cases, +‘stat_result.st_mode’ 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 ‘stat_result.st_reparse_tag’ attribute. + +On Windows, *note os.readlink(): 91f. is now able to read directory +junctions. Note that *note islink(): a0b. will return ‘False’ for +directory junctions, and so code that checks ‘islink’ first will +continue to treat junctions as directories, while code that handles +errors from *note os.readlink(): 91f. may now treat junctions as links. + +(Contributed by Steve Dower in bpo-37834(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36085 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=26836 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=37834 + + +File: python.info, Node: os path<5>, Next: pathlib<7>, Prev: os<6>, Up: Improved Modules<6> + +1.6.5.24 os.path +................ + +*note os.path: a2. functions that return a boolean result like *note +exists(): a0d, *note lexists(): a0e, *note isdir(): a0f, *note isfile(): +a10, *note islink(): a0b, and *note ismount(): a11. now return ‘False’ +instead of raising *note ValueError: 204. or its subclasses *note +UnicodeEncodeError: 673. and *note UnicodeDecodeError: a12. for paths +that contain characters or bytes unrepresentable at the OS level. +(Contributed by Serhiy Storchaka in bpo-33721(1).) + +*note expanduser(): a13. 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(): a0f. on Windows no longer returns ‘True’ for a link to a +non-existent directory. + +*note realpath(): 227. 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<7>, Next: pickle, Prev: os path<5>, Up: Improved Modules<6> + +1.6.5.25 pathlib +................ + +*note pathlib.Path: 22b. methods that return a boolean result like *note +exists(): a15, *note is_dir(): 232, *note is_file(): 231, *note +is_mount(): a16, *note is_symlink(): a17, *note is_block_device(): a18, +*note is_char_device(): a19, *note is_fifo(): a1a, *note is_socket(): +a1b. now return ‘False’ instead of raising *note ValueError: 204. or its +subclass *note UnicodeEncodeError: 673. 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, Next: plistlib, Prev: pathlib<7>, Up: Improved Modules<6> + +1.6.5.26 pickle +............... + +*note pickle: a6. extensions subclassing the C-optimized *note Pickler: +a1d. can now override the pickling logic of functions and classes by +defining the special *note reducer_override(): a1e. method. +(Contributed by Pierre Glaser and Olivier Grisel in bpo-35900(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=35900 + + +File: python.info, Node: plistlib, Next: pprint<3>, Prev: pickle, Up: Improved Modules<6> + +1.6.5.27 plistlib +................. + +Added new *note plistlib.UID: a20. and enabled support for reading and +writing NSKeyedArchiver-encoded binary plists. (Contributed by Jon +Janzen in bpo-26707(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=26707 + + +File: python.info, Node: pprint<3>, Next: py_compile<2>, Prev: plistlib, Up: Improved Modules<6> + +1.6.5.28 pprint +............... + +The *note pprint: ae. 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(): +a22. that is like *note pprint.pprint(): 824. but with 'sort_dicts' +defaulting to ‘False’: + + >>> from pprint import pprint, pp + >>> d = dict(source='input.txt', operation='filter', destination='output.txt') + >>> pp(d, width=40) # Original order + {'source': 'input.txt', + 'operation': 'filter', + 'destination': 'output.txt'} + >>> pprint(d, width=40) # Keys sorted alphabetically + {'destination': 'output.txt', + 'operation': 'filter', + 'source': 'input.txt'} + +(Contributed by Rémi Lapeyre in bpo-30670(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=30670 + + +File: python.info, Node: py_compile<2>, Next: shlex, Prev: pprint<3>, Up: Improved Modules<6> + +1.6.5.29 py_compile +................... + +*note py_compile.compile(): a24. now supports silent mode. (Contributed +by Joannah Nanjekye in bpo-22640(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22640 + + +File: python.info, Node: shlex, Next: shutil<4>, Prev: py_compile<2>, Up: Improved Modules<6> + +1.6.5.30 shlex +.............. + +The new *note shlex.join(): a26. function acts as the inverse of *note +shlex.split(): 538. (Contributed by Bo Bayles in bpo-32102(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32102 + + +File: python.info, Node: shutil<4>, Next: socket<4>, Prev: shlex, Up: Improved Modules<6> + +1.6.5.31 shutil +............... + +*note shutil.copytree(): a28. now accepts a new ‘dirs_exist_ok’ keyword +argument. (Contributed by Josh Bronson in bpo-20849(1).) + +*note shutil.make_archive(): 4af. 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: de. module. (Contributed by C.A.M. Gerlach in +bpo-30661(2).) + +*note shutil.rmtree(): 2fb. 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<4>, Next: ssl<4>, Prev: shutil<4>, Up: Improved Modules<6> + +1.6.5.32 socket +............... + +Added *note create_server(): a2a. and *note has_dualstack_ipv6(): a2b. +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(): a2c, *note socket.if_nametoindex(): +a2d, and *note socket.if_indextoname(): a2e. 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<4>, Next: statistics<4>, Prev: socket<4>, Up: Improved Modules<6> + +1.6.5.33 ssl +............ + +Added *note post_handshake_auth: a30. to enable and *note +verify_client_post_handshake(): a31. to initiate TLS 1.3 post-handshake +authentication. (Contributed by Christian Heimes in bpo-34670(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34670 + + +File: python.info, Node: statistics<4>, Next: sys<7>, Prev: ssl<4>, Up: Improved Modules<6> + +1.6.5.34 statistics +................... + +Added *note statistics.fmean(): a33. as a faster, floating-point variant +of *note statistics.mean(): 6cd. (Contributed by Raymond Hettinger and +Steven D’Aprano in bpo-35904(1).) + +Added *note statistics.geometric_mean(): a34. (Contributed by Raymond +Hettinger in bpo-27181(2).) + +Added *note statistics.multimode(): a35. that returns a list of the most +common values. (Contributed by Raymond Hettinger in bpo-35892(3).) + +Added *note statistics.quantiles(): a36. 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: a37, a tool for creating and +manipulating normal distributions of a random variable. (Contributed by +Raymond Hettinger in bpo-36018(5).) + + >>> temperature_feb = NormalDist.from_samples([4, 12, -3, 2, 7, 14]) + >>> temperature_feb.mean + 6.0 + >>> temperature_feb.stdev + 6.356099432828281 + + >>> temperature_feb.cdf(3) # Chance of being under 3 degrees + 0.3184678262814532 + >>> # Relative chance of being 7 degrees versus 10 degrees + >>> temperature_feb.pdf(7) / temperature_feb.pdf(10) + 1.2039930378537762 + + >>> el_niño = NormalDist(4, 2.5) + >>> temperature_feb += el_niño # Add in a climate effect + >>> temperature_feb + NormalDist(mu=10.0, sigma=6.830080526611674) + + >>> temperature_feb * (9/5) + 32 # Convert to Fahrenheit + NormalDist(mu=50.0, sigma=12.294144947901014) + >>> temperature_feb.samples(3) # Generate random samples + [7.672102882379219, 12.000027119750287, 4.647488369766392] + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=35904 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=27181 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=35892 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=36546 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=36018 + + +File: python.info, Node: sys<7>, Next: tarfile<5>, Prev: statistics<4>, Up: Improved Modules<6> + +1.6.5.35 sys +............ + +Add new *note sys.unraisablehook(): 1f9. 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(): a39.). (Contributed by Victor +Stinner in bpo-36829(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36829 + + +File: python.info, Node: tarfile<5>, Next: threading<4>, Prev: sys<7>, Up: Improved Modules<6> + +1.6.5.36 tarfile +................ + +The *note tarfile: de. 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<4>, Next: tokenize<2>, Prev: tarfile<5>, Up: Improved Modules<6> + +1.6.5.37 threading +.................. + +Add a new *note threading.excepthook(): 847. function which handles +uncaught *note threading.Thread.run(): a3c. exception. It can be +overridden to control how uncaught *note threading.Thread.run(): a3c. +exceptions are handled. (Contributed by Victor Stinner in +bpo-1230540(1).) + +Add a new *note threading.get_native_id(): a3d. function and a *note +native_id: a3e. attribute to the *note threading.Thread: 94c. class. +These return the native integral Thread ID of the current thread +assigned by the kernel. This feature is only available on certain +platforms, see *note get_native_id: a3d. for more information. +(Contributed by Jake Tesler in bpo-36084(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=1230540 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=36084 + + +File: python.info, Node: tokenize<2>, Next: tkinter<4>, Prev: threading<4>, Up: Improved Modules<6> + +1.6.5.38 tokenize +................. + +The *note tokenize: fb. 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<4>, Next: time<4>, Prev: tokenize<2>, Up: Improved Modules<6> + +1.6.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<8>, Prev: tkinter<4>, Up: Improved Modules<6> + +1.6.5.40 time +............. + +Added new clock *note CLOCK_UPTIME_RAW: a42. 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<8>, Next: unicodedata<5>, Prev: time<4>, Up: Improved Modules<6> + +1.6.5.41 typing +............... + +The *note typing: 104. module incorporates several new features: + + * A dictionary type with per-key types. See PEP 589(1) and *note + typing.TypedDict: 162. 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: 851. + 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: 269. and *note typing.final(): 6a9. 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: 266. + and *note typing.runtime_checkable(): 43e. Simple ABCs like *note + typing.SupportsInt: a44. are now ‘Protocol’ subclasses. + + * New protocol class *note typing.SupportsIndex: a45. + + * New functions *note typing.get_origin(): a46. and *note + typing.get_args(): 87c. + + ---------- 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<5>, Next: unittest<6>, Prev: typing<8>, Up: Improved Modules<6> + +1.6.5.42 unicodedata +.................... + +The *note unicodedata: 105. module has been upgraded to use the Unicode +12.1.0(1) release. + +New function *note is_normalized(): a48. 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<6>, Next: venv<4>, Prev: unicodedata<5>, Up: Improved Modules<6> + +1.6.5.43 unittest +................. + +Added *note AsyncMock: a4a. to support an asynchronous version of *note +Mock: a4b. Appropriate new assert functions for testing have been added +as well. (Contributed by Lisa Roach in bpo-26467(1)). + +Added *note addModuleCleanup(): a4c. and *note addClassCleanup(): a4d. +to unittest to support cleanups for ‘setUpModule()’ and *note +setUpClass(): a4e. (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: 106. module gained support for coroutines to be used as +test cases with *note unittest.IsolatedAsyncioTestCase: 306. +(Contributed by Andrew Svetlov in bpo-32972(4).) + +Example: + + import unittest + + + class TestRequest(unittest.IsolatedAsyncioTestCase): + + async def asyncSetUp(self): + self.connection = await AsyncConnection() + + async def test_get(self): + response = await self.connection.get("https://example.com") + self.assertEqual(response.status_code, 200) + + async def asyncTearDown(self): + await self.connection.close() + + + if __name__ == "__main__": + unittest.main() + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=26467 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=24412 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=35047 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=32972 + + +File: python.info, Node: venv<4>, Next: weakref, Prev: unittest<6>, Up: Improved Modules<6> + +1.6.5.44 venv +............. + +*note venv: 111. now includes an ‘Activate.ps1’ script on all platforms +for activating virtual environments under PowerShell Core 6.1. +(Contributed by Brett Cannon in bpo-32718(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32718 + + +File: python.info, Node: weakref, Next: xml<4>, Prev: venv<4>, Up: Improved Modules<6> + +1.6.5.45 weakref +................ + +The proxy objects returned by *note weakref.proxy(): a51. now support +the matrix multiplication operators ‘@’ and ‘@=’ in addition to the +other numeric operators. (Contributed by Mark Dickinson in +bpo-36669(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=36669 + + +File: python.info, Node: xml<4>, Next: xmlrpc, Prev: weakref, Up: Improved Modules<6> + +1.6.5.46 xml +............ + +As mitigation against DTD and external entity retrieval, the *note +xml.dom.minidom: 122. and *note xml.sax: 129. 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: 125. 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: 125. module provides a new function +‘–xml.etree.ElementTree.canonicalize()’ that implements C14N 2.0. +(Contributed by Stefan Behnel in bpo-13611(3).) + +The target object of *note xml.etree.ElementTree.XMLParser: a53. can +receive namespace declaration events through the new callback methods +‘start_ns()’ and ‘end_ns()’. Additionally, the *note +xml.etree.ElementTree.TreeBuilder: a54. target can be configured to +process events about comments and processing instructions to include +them in the generated tree. (Contributed by Stefan Behnel in +bpo-36676(4) and bpo-36673(5).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17239 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=28238 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=13611 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=36676 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=36673 + + +File: python.info, Node: xmlrpc, Prev: xml<4>, Up: Improved Modules<6> + +1.6.5.47 xmlrpc +............... + +*note xmlrpc.client.ServerProxy: a56. 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: Optimizations<6>, Next: Build and C API Changes, Prev: Improved Modules<6>, Up: What’s New In Python 3 8 + +1.6.6 Optimizations +------------------- + + * The *note subprocess: d6. module can now use the *note + os.posix_spawn(): 222. 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(): a58, *note shutil.copy(): a59, *note + shutil.copy2(): a5a, *note shutil.copytree(): a28. and *note + shutil.move(): a5b. use platform-specific “fast-copy” syscalls on + Linux and macOS in order to copy the file more efficiently. + “fast-copy” means that the copying operation occurs within the + kernel, avoiding the use of userspace buffers in Python as in + “‘outfd.write(infd.read())’”. On Windows *note shutil.copyfile(): + a58. uses a bigger default buffer size (1 MiB instead of 16 KiB) + and a *note memoryview(): 464.-based variant of *note + shutil.copyfileobj(): a5c. 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 Platform-dependent efficient copy operations: + a5d. section. (Contributed by Giampaolo Rodolà in bpo-33671(2).) + + * *note shutil.copytree(): a28. uses *note os.scandir(): a5e. + function and all copy functions depending from it use cached *note + os.stat(): 49c. values. The speedup for copying a directory with + 8000 files is around +9% on Linux, +20% on Windows and +30% on a + Windows SMB share. Also the number of *note os.stat(): 49c. + syscalls is reduced by 38% making *note shutil.copytree(): a28. + especially faster on network filesystems. (Contributed by + Giampaolo Rodolà in bpo-33695(3).) + + * The default protocol in the *note pickle: a6. 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: a5f. 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: a60. 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(): a61. 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(): 1ca. 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: 60d. 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: Build and C API Changes, Next: Deprecated<8>, Prev: Optimizations<6>, Up: What’s New In Python 3 8 + +1.6.7 Build and C API Changes +----------------------------- + + * Default *note sys.abiflags: a63. 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(): 56b, *note Py_DECREF(): 56c. + + * *note Py_XINCREF(): a64, *note Py_XDECREF(): 78a. + + * ‘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(): a65. 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(): 35b. and argument parsing functions like *note + PyArg_ParseTuple(): 56e. with integer converting format units like + ‘'i'’ will now use the *note __index__(): 718. special method + instead of *note __int__(): 717, if available. The deprecation + warning will be emitted for objects with the ‘__int__()’ method but + without the ‘__index__()’ method (like *note Decimal: 29f. and + *note Fraction: 1e9.). *note PyNumber_Check(): a66. will now + return ‘1’ for objects implementing ‘__index__()’. *note + PyNumber_Long(): a67, *note PyNumber_Float(): a68. and *note + PyFloat_AsDouble(): a69. 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(): a6a. (and its parallel macro + ‘PyObject_INIT’) instead of in *note PyType_GenericAlloc(): a6b. + 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 (*note Py_GetProgramFullPath(): 3b3.) rather than to the + program name (*note Py_GetProgramName(): 3b5.). (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: Deprecated<8>, Next: API and Feature Removals, Prev: Build and C API Changes, Up: What’s New In Python 3 8 + +1.6.8 Deprecated +---------------- + + * 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: 125. module now emit a *note DeprecationWarning: 1a5. + instead of *note PendingDeprecationWarning: 8c7. 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: 73d. to *note + loop.set_default_executor(): 73e. is deprecated and will be + prohibited in Python 3.9. (Contributed by Elvis Pranskevichus in + bpo-34075(3).) + + * The *note __getitem__(): 285. methods of *note + xml.dom.pulldom.DOMEventStream: 730, *note + wsgiref.util.FileWrapper: 731. and *note fileinput.FileInput: 732. + 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: 2b2. 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: 8. classes ‘Num’, ‘Str’, ‘Bytes’, ‘NameConstant’ and + ‘Ellipsis’ are considered deprecated and will be removed in future + Python versions. *note Constant: 2bb. should be used instead. + (Contributed by Serhiy Storchaka in bpo-32892(6).) + + * *note ast.NodeVisitor: a6d. 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(): a6e. method to handle all constant + nodes. (Contributed by Serhiy Storchaka in bpo-36917(7).) + + * The ‘asyncio.coroutine()’ *note decorator: 72c. is deprecated and + will be removed in version 3.10. Instead of ‘@asyncio.coroutine’, + use *note async def: 5cd. instead. (Contributed by Andrew Svetlov + in bpo-36921(8).) + + * In *note asyncio: a, the explicit passing of a 'loop' argument has + been deprecated and will be removed in version 3.10 for the + following: *note asyncio.sleep(): a6f, *note asyncio.gather(): 5f9, + *note asyncio.shield(): a70, *note asyncio.wait_for(): 5fb, *note + asyncio.wait(): 47b, *note asyncio.as_completed(): 1aa, *note + asyncio.Task: 1be, *note asyncio.Lock: a71, *note asyncio.Event: + a72, *note asyncio.Condition: a73, *note asyncio.Semaphore: a74, + *note asyncio.BoundedSemaphore: a75, *note asyncio.Queue: a76, + *note asyncio.create_subprocess_exec(): a77, and *note + asyncio.create_subprocess_shell(): a78. + + * The explicit passing of coroutine objects to *note asyncio.wait(): + 47b. 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: 63. 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 ‘output_charset()’ + and ‘set_output_charset()’, and the 'codeset' parameter of + functions *note translation(): a79. and *note install(): a7a. 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: 94c. 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: 29f.s, *note + Fraction: 1e9.s and any other objects that can be converted to + integers only with a loss (e.g. that have the *note __int__(): + 717. method but do not have the *note __index__(): 718. 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(): a7b, *note + weakref.finalize(): a7c, *note profile.Profile.runcall(): a7d, + ‘cProfile.Profile.runcall()’, *note bdb.Bdb.runcall(): a7e, + *note trace.Trace.runfunc(): a7f. and *note curses.wrapper(): + a80. + + - 'function' in *note unittest.TestCase.addCleanup(): a81. + + - 'fn' in the *note submit(): a82. method of *note + concurrent.futures.ThreadPoolExecutor: 73d. and *note + concurrent.futures.ProcessPoolExecutor: 8ed. + + - 'callback' in *note contextlib.ExitStack.callback(): a83, + ‘contextlib.AsyncExitStack.callback()’ and *note + contextlib.AsyncExitStack.push_async_callback(): a84. + + - 'c' and 'typeid' in the ‘create()’ method of + ‘multiprocessing.managers.Server’ and + ‘multiprocessing.managers.SharedMemoryServer’. + + - 'obj' in *note weakref.finalize(): a7c. + + In future releases of Python, they will be *note positional-only: + a85. (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 and Feature Removals, Next: Porting to Python 3 8, Prev: Deprecated<8>, Up: What’s New In Python 3 8 + +1.6.9 API and Feature Removals +------------------------------ + +The following features and APIs have been removed from Python 3.8: + + * Starting with Python 3.3, importing ABCs from *note collections: + 1d. was deprecated, and importing should be done from *note + collections.abc: 1e. 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(): a87. 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(): a88. or + *note time.process_time(): a89. 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: de. module. + It is not documented and deprecated since Python 3.3. + + * The *note XMLParser: a53. 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: 2a7. (Contributed + by Serhiy Storchaka in bpo-29209(6).) + + * Removed the ‘doctype()’ method of *note XMLParser: a53. + (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: cf. + module are not exposed to the user. (Contributed by Aviv Palivoda + in bpo-30262(9).) + + * The ‘bufsize’ keyword argument of *note fileinput.input(): 7fb. and + *note fileinput.FileInput(): 732. 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: Porting to Python 3 8, Next: Notable changes in Python 3 8 1, Prev: API and Feature Removals, Up: What’s New In Python 3 8 + +1.6.10 Porting to Python 3.8 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in Python behavior:: +* Changes in the Python API: Changes in the Python API<5>. +* Changes in the C API: Changes in the C API<4>. +* CPython bytecode changes: CPython bytecode changes<5>. +* Demos and Tools: Demos and Tools<2>. + + +File: python.info, Node: Changes in Python behavior, Next: Changes in the Python API<5>, Up: Porting to Python 3 8 + +1.6.10.1 Changes in Python behavior +................................... + + * 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: 461. 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: + 463, *note int: 259, *note float: 2f1, *note complex: 2f2. and few + classes from the standard library. They now inherit ‘__str__()’ + from *note object: a8c. 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: a8d. 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(): 3a5, + *note Py_END_ALLOW_THREADS(): a8e, and *note PyGILState_Ensure(): + 3a7. If this behavior is not desired, guard the call by checking + ‘_Py_IsFinalizing()’ or *note sys.is_finalizing(): a8f. + (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: Changes in the Python API<5>, Next: Changes in the C API<4>, Prev: Changes in Python behavior, Up: Porting to Python 3 8 + +1.6.10.2 Changes in the Python API +.................................. + + * The *note os.getcwdb(): a91. 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: 199. can now use *note os.posix_spawn(): + 222. in some cases for better performance. On Windows Subsystem + for Linux and QEMU User Emulation, the ‘Popen’ constructor using + *note os.posix_spawn(): 222. no longer raises an exception on + errors like “missing program”. Instead the child process fails + with a non-zero ‘returncode’. (Contributed by Joannah Nanjekye and + Victor Stinner in bpo-35537(3).) + + * The 'preexec_fn' argument of * *note subprocess.Popen: 199. is no + longer compatible with subinterpreters. The use of the parameter + in a subinterpreter now raises *note RuntimeError: 195. + (Contributed by Eric Snow in bpo-34651(4), modified by Christian + Heimes in bpo-37951(5).) + + * The ‘imap.IMAP4.logout()’ 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(): a87. instead. + (Contributed by Victor Stinner in bpo-35345(7).) + + * The *note statistics.mode(): a92. 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(): a93. method of the *note + tkinter.ttk.Treeview: a94. 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(): + a95. for changing the selection. (Contributed by Serhiy Storchaka + in bpo-31508(9).) + + * The ‘writexml()’, ‘toxml()’ and ‘toprettyxml()’ methods of *note + xml.dom.minidom: 122, and the ‘write()’ method of ‘xml.etree’, now + preserve the attribute order specified by the user. (Contributed + by Diego Rojas and Raymond Hettinger in bpo-34160(10).) + + * A *note dbm.dumb: 32. database opened with flags ‘'r'’ is now + read-only. *note dbm.dumb.open(): a96. 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: + a53. will no longer be called and will emit a *note RuntimeWarning: + 1bd. instead of a *note DeprecationWarning: 1a5. Define the *note + doctype(): a97. method on a target for handling an XML doctype + declaration. (Contributed by Serhiy Storchaka in bpo-29209(12).) + + * A *note RuntimeError: 195. is now raised when the custom metaclass + doesn’t provide the ‘__classcell__’ entry in the namespace passed + to ‘type.__new__’. A *note DeprecationWarning: 1a5. was emitted in + Python 3.6–3.7. (Contributed by Serhiy Storchaka in + bpo-23722(13).) + + * The ‘cProfile.Profile’ class can now be used as a context manager. + (Contributed by Scott Sanderson in bpo-29235(14).) + + * *note shutil.copyfile(): a58, *note shutil.copy(): a59, *note + shutil.copy2(): a5a, *note shutil.copytree(): a28. and *note + shutil.move(): a5b. use platform-specific “fast-copy” syscalls (see + *note Platform-dependent efficient copy operations: a5d. section). + + * *note shutil.copyfile(): a58. 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: 8bc. 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(): a98. 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: 122. and *note xml.sax: 129. 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: 31. database (*note + dbm.dumb: 32, *note dbm.gnu: 33. or *note dbm.ndbm: 34.) raises + ‘error’ (*note dbm.dumb.error: a99, *note dbm.gnu.error: a9a. or + *note dbm.ndbm.error: a9b.) instead of *note KeyError: 33f. + (Contributed by Xiang Zhang in bpo-33106(19).) + + * Simplified AST for literals. All constants will be represented as + *note ast.Constant: 2bb. 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(): a13. 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: 1b8. now inherits from + *note BaseException: 5b7. rather than *note Exception: 9d9. and no + longer inherits from *note concurrent.futures.CancelledError: 9da. + (Contributed by Yury Selivanov in bpo-32528(22).) + + * The function *note asyncio.wait_for(): 5fb. now correctly waits for + cancellation when using an instance of *note asyncio.Task: 1be. + 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(): a9c. 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: a9d. has graduated to the stable + API. + + * DLL dependencies for extension modules and DLLs loaded with *note + ctypes: 2a. 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(): 9e9. are searched + for load-time dependencies. Specifically, ‘PATH’ and the current + working directory are no longer used, and modifications to these + will no longer have any effect on normal DLL resolution. If your + application relies on these mechanisms, you should check for *note + add_dll_directory(): 9e9. 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: 2e3. has a new parameter in the second + position of the constructor ('posonlyargcount') to support + positional-only arguments defined in PEP 570(27). The first + argument ('argcount') now represents the total number of positional + arguments (including positional-only arguments). The new + ‘replace()’ method of *note types.CodeType: 2e3. can be used to + make the code future-proof. + + * The parameter ‘digestmod’ for *note hmac.new(): a9f. 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: Changes in the C API<4>, Next: CPython bytecode changes<5>, Prev: Changes in the Python API<5>, Up: Porting to Python 3 8 + +1.6.10.3 Changes in the C API +............................. + + * The *note PyCompilerFlags: aa1. 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(): 3f7. 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(): 56e, *note Py_BuildValue(): 8a6, *note + PyObject_CallFunction(): 39a, etc.) without ‘PY_SSIZE_T_CLEAN’ + defined raises ‘DeprecationWarning’ now. It will be removed in + 3.10 or 4.0. Read *note Parsing arguments and building values: + 8a7. for detail. (Contributed by Inada Naoki in bpo-36381(4).) + + * Instances of heap-allocated types (such as those created with *note + PyType_FromSpec(): 57a.) hold a reference to their type object. + Increasing the reference count of these type objects has been moved + from *note PyType_GenericAlloc(): a6b. to the more low-level + functions, *note PyObject_Init(): a6a. and ‘PyObject_INIT()’. This + makes types created through *note PyType_FromSpec(): 57a. behave + like other classes in managed code. + + *note Statically allocated types: 77a. 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: 56b. on the type object after + allocating an instance - if any. This may happen after + calling *note PyObject_New: 985, *note PyObject_NewVar: 986, + *note PyObject_GC_New(): aa2, *note PyObject_GC_NewVar(): aa3, + or any other custom allocator that uses *note PyObject_Init(): + a6a. or ‘PyObject_INIT()’. + + Example: + + 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. + + Example: + + 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(): aa4. macro has been implemented for + MSVC. The macro now must be placed before the symbol name. + + Example: + + 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: aa5. exported by a third-party extension module is + supposed to have all the slots expected in the current Python + version, including *note tp_finalize: aa6. (*note + Py_TPFLAGS_HAVE_FINALIZE: 3ee. is not checked anymore before + reading *note tp_finalize: aa6.). + + (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 Using Python on Windows: aa7. 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 bytecode changes<5>, Next: Demos and Tools<2>, Prev: Changes in the C API<4>, Up: Porting to Python 3 8 + +1.6.10.4 CPython bytecode changes +................................. + + * 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: aa9, *note + continue: 9c9. and *note return: 9ce. + + 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: aaa. for handling exceptions + raised when awaiting a next item in an *note async for: aab. loop. + (Contributed by Serhiy Storchaka in bpo-33041(2).) + + * The *note MAP_ADD: aac. 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 bytecode changes<5>, Up: Porting to Python 3 8 + +1.6.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: Notable changes in Python 3 8 1, Next: Notable changes in Python 3 8 2, Prev: Porting to Python 3 8, Up: What’s New In Python 3 8 + +1.6.11 Notable changes in Python 3.8.1 +-------------------------------------- + +Due to significant security concerns, the 'reuse_address' parameter of +*note asyncio.loop.create_datagram_endpoint(): 72e. is no longer +supported. This is because of the behavior of the socket option +‘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(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=37228 + + +File: python.info, Node: Notable changes in Python 3 8 2, Next: Notable changes in Python 3 8 3, Prev: Notable changes in Python 3 8 1, Up: What’s New In Python 3 8 + +1.6.12 Notable changes in Python 3.8.2 +-------------------------------------- + +Fixed a regression with the ‘ignore’ callback of *note +shutil.copytree(): a28. 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: Notable changes in Python 3 8 8, Prev: Notable changes in Python 3 8 2, Up: What’s New In Python 3 8 + +1.6.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: Notable changes in Python 3 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.6.14 Notable changes in Python 3.8.8 +-------------------------------------- + +Earlier Python versions allowed using both ‘;’ and ‘&’ as query +parameter separators in *note urllib.parse.parse_qs(): 27c. and *note +urllib.parse.parse_qsl(): 27b. 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: Notable changes in Python 3 8 8, Up: What’s New In Python 3 8 + +1.6.15 Notable changes in Python 3.8.9 +-------------------------------------- + +A security fix alters the *note ftplib.FTP: 8f9. 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.6.16 Notable changes in Python 3.8.10 +--------------------------------------- + +* Menu: + +* macOS 11.0 (Big Sur) and Apple Silicon Mac support: macOS 11 0 Big Sur and Apple Silicon Mac support<2>. + + +File: python.info, Node: macOS 11 0 Big Sur and Apple Silicon Mac support<2>, Up: Notable changes in Python 3 8 10 + +1.6.16.1 macOS 11.0 (Big Sur) and Apple Silicon Mac support +........................................................... + +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.6.17 Notable changes in Python 3.8.10 +--------------------------------------- + +* Menu: + +* urllib.parse: urllib parse<4>. + + +File: python.info, Node: urllib parse<4>, Up: Notable changes in Python 3 8 10<2> + +1.6.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: 10a. +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.6.18 Notable changes in Python 3.8.12 +--------------------------------------- + +* Menu: + +* Changes in the Python API: Changes in the Python API<6>. + + +File: python.info, Node: Changes in the Python API<6>, Up: Notable changes in Python 3 8 12 + +1.6.18.1 Changes in the Python API +.................................. + +Starting with Python 3.8.12 the *note ipaddress: 80. 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(): 961. treats +leading zeros as octal notation. glibc implementation of modern *note +inet_pton(): 962. 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.6.19 Notable security feature in 3.8.14 +----------------------------------------- + +Converting between *note int: 259. and *note str: 447. in bases other +than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 +(decimal) now raises a *note ValueError: 204. 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: d9. APIs. See the *note +integer string conversion length limitation: 5f1. 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.6.20 Notable changes in 3.8.17 +-------------------------------- + +* Menu: + +* tarfile: tarfile<6>. + + +File: python.info, Node: tarfile<6>, Up: Notable changes in 3 8 17 + +1.6.20.1 tarfile +................ + + * The extraction methods in *note tarfile: de, and *note + shutil.unpack_archive(): 467, 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: 468. for details. In Python 3.12, use + without the 'filter' argument will show a *note DeprecationWarning: + 1a5. 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.7 What’s New In Python 3.7 +============================ + + +Editor: Elvis Pranskevichus <> + +This article explains the new features in Python 3.7, compared to 3.6. +Python 3.7 was released on June 27, 2018. For full details, see the +*note changelog: 13c. + +* Menu: + +* Summary – Release Highlights: Summary – Release Highlights<2>. +* New Features: New Features<12>. +* Other Language Changes: Other Language Changes<7>. +* New Modules: New Modules<7>. +* Improved Modules: Improved Modules<7>. +* C API Changes: C API Changes<6>. +* Build Changes: Build Changes<6>. +* Optimizations: Optimizations<7>. +* Other CPython Implementation Changes: Other CPython Implementation Changes<2>. +* Deprecated Python Behavior:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods. +* Deprecated functions and types of the C API:: +* Platform Support Removals:: +* API and Feature Removals: API and Feature Removals<2>. +* Module Removals:: +* Windows-only Changes:: +* Porting to Python 3.7: Porting to Python 3 7. +* Notable changes in Python 3.7.1: Notable changes in Python 3 7 1. +* Notable changes in Python 3.7.2: Notable changes in Python 3 7 2. +* Notable changes in Python 3.7.6: Notable changes in Python 3 7 6. +* Notable changes in Python 3.7.10: Notable changes in 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: Summary – Release Highlights<2>, Next: New Features<12>, Up: What’s New In Python 3 7 + +1.7.1 Summary – Release Highlights +---------------------------------- + +New syntax features: + + * *note PEP 563: abf, postponed evaluation of type annotations. + +Backwards incompatible syntax changes: + + * *note async: 72d. and *note await: 1b9. are now reserved keywords. + +New library modules: + + * *note contextvars: 24.: *note PEP 567 – Context Variables: ac0. + + * *note dataclasses: 2f.: *note PEP 557 – Data Classes: ac1. + + * *note importlib.resources: ac2. + +New built-in features: + + * *note PEP 553: ac3, the new *note breakpoint(): 236. function. + +Python data model improvements: + + * *note PEP 562: ac4, customization of access to module attributes. + + * *note PEP 560: ac5, core support for typing module and generic + types. + + * the insertion-order preservation nature of *note dict: ac6. objects + has been declared(1) to be an official part of the Python language + spec. + +Significant improvements in the standard library: + + * The *note asyncio: a. module has received new features, significant + *note usability and performance improvements: ac7. + + * The *note time: ee. module gained support for *note functions with + nanosecond resolution: ac8. + +CPython implementation improvements: + + * Avoiding the use of ASCII as a default text encoding: + + * *note PEP 538: ac9, legacy C locale coercion + + * *note PEP 540: aca, forced UTF-8 runtime mode + + * *note PEP 552: acb, deterministic .pycs + + * *note New Python Development Mode: acc. + + * *note PEP 565: acd, improved *note DeprecationWarning: 1a5. + handling + +C API improvements: + + * *note PEP 539: ace, new C API for thread-local storage + +Documentation improvements: + + * *note PEP 545: acf, Python documentation translations + + * New documentation translations: Japanese(2), French(3), and + Korean(4). + +This release features notable performance improvements in many areas. +The *note Optimizations: ad0. section lists them in detail. + +For a list of changes that may affect compatibility with previous Python +releases please refer to the *note Porting to Python 3.7: ad1. section. + + ---------- 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: New Features<12>, Next: Other Language Changes<7>, Prev: Summary – Release Highlights<2>, Up: What’s New In Python 3 7 + +1.7.2 New Features +------------------ + +* Menu: + +* PEP 563; Postponed Evaluation of Annotations: PEP 563 Postponed Evaluation of Annotations. +* PEP 538; Legacy C Locale Coercion: PEP 538 Legacy C Locale Coercion. +* PEP 540; Forced UTF-8 Runtime Mode: PEP 540 Forced UTF-8 Runtime Mode. +* PEP 553; Built-in breakpoint(): PEP 553 Built-in breakpoint. +* PEP 539; New C API for Thread-Local Storage: PEP 539 New C API for Thread-Local Storage. +* PEP 562; Customization of Access to Module Attributes: PEP 562 Customization of Access to Module Attributes. +* PEP 564; New Time Functions With Nanosecond Resolution: PEP 564 New Time Functions With Nanosecond Resolution. +* PEP 565; Show DeprecationWarning in __main__: PEP 565 Show DeprecationWarning in __main__. +* PEP 560; Core Support for typing module and Generic Types: PEP 560 Core Support for typing module and Generic Types. +* 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 Postponed Evaluation of Annotations, Next: PEP 538 Legacy C Locale Coercion, Up: New Features<12> + +1.7.2.1 PEP 563: Postponed Evaluation of Annotations +.................................................... + +The advent of type hints in Python uncovered two glaring usability +issues with the functionality of annotations added in PEP 3107(1) and +refined further in PEP 526(2): + + * annotations could only use names which were already available in + the current scope, in other words they didn’t support forward + references of any kind; and + + * annotating source code had adverse effects on startup time of + Python programs. + +Both of these issues are fixed by postponing the evaluation of +annotations. Instead of compiling code which executes expressions in +annotations at their definition time, the compiler stores the annotation +in a string form equivalent to the AST of the expression in question. +If needed, annotations can be resolved at runtime using *note +typing.get_type_hints(): 6ad. In the common case where this is not +required, the annotations are cheaper to store (since short strings are +interned by the interpreter) and make startup time faster. + +Usability-wise, annotations now support forward references, making the +following syntax valid: + + class C: + @classmethod + def from_string(cls, source: str) -> C: + ... + + def validate_b(self, obj: B) -> bool: + ... + + class B: + ... + +Since this change breaks compatibility, the new behavior needs to be +enabled on a per-module basis in Python 3.7 using a *note __future__: 0. +import: + + from __future__ import annotations + +It will become the default in Python 3.10. + +See also +........ + +PEP 563(3) – Postponed evaluation of annotations + + 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 Legacy C Locale Coercion, Next: PEP 540 Forced UTF-8 Runtime Mode, Prev: PEP 563 Postponed Evaluation of Annotations, Up: New Features<12> + +1.7.2.2 PEP 538: Legacy C Locale Coercion +......................................... + +An ongoing challenge within the Python 3 series has been determining a +sensible default strategy for handling the “7-bit ASCII” text encoding +assumption currently implied by the use of the default C or POSIX locale +on non-Windows platforms. + +PEP 538(1) updates the default interpreter command line interface to +automatically coerce that locale to an available UTF-8 based locale as +described in the documentation of the new *note PYTHONCOERCECLOCALE: +ad5. environment variable. Automatically setting ‘LC_CTYPE’ this way +means that both the core interpreter and locale-aware C extensions (such +as *note readline: ba.) will assume the use of UTF-8 as the default text +encoding, rather than ASCII. + +The platform support definition in PEP 11(2) has also been updated to +limit full text handling support to suitably configured non-ASCII based +locales. + +As part of this change, the default error handler for *note stdin: 539. +and *note stdout: ad6. is now ‘surrogateescape’ (rather than ‘strict’) +when using any of the defined coercion target locales (currently +‘C.UTF-8’, ‘C.utf8’, and ‘UTF-8’). The default error handler for *note +stderr: 939. continues to be ‘backslashreplace’, regardless of locale. + +Locale coercion is silent by default, but to assist in debugging +potentially locale related integration problems, explicit warnings +(emitted directly on *note stderr: 939.) can be requested by setting +‘PYTHONCOERCECLOCALE=warn’. This setting will also cause the Python +runtime to emit a warning if the legacy C locale remains active when the +core interpreter is initialized. + +While PEP 538(3)’s locale coercion has the benefit of also affecting +extension modules (such as GNU ‘readline’), as well as child processes +(including those running non-Python applications and older versions of +Python), it has the downside of requiring that a suitable target locale +be present on the running system. To better handle the case where no +suitable target locale is available (as occurs on RHEL/CentOS 7, for +example), Python 3.7 also implements *note PEP 540; Forced UTF-8 Runtime +Mode: aca. + +See also +........ + +PEP 538(4) – Coercing the legacy C locale to a UTF-8 based locale + + 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 Forced UTF-8 Runtime Mode, Next: PEP 553 Built-in breakpoint, Prev: PEP 538 Legacy C Locale Coercion, Up: New Features<12> + +1.7.2.3 PEP 540: Forced UTF-8 Runtime Mode +.......................................... + +The new *note -X: 176. ‘utf8’ command line option and *note PYTHONUTF8: +ad8. environment variable can be used to enable the *note Python UTF-8 +Mode: 652. + +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: 539. +and *note sys.stdout: ad6. 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; Forced UTF-8 Runtime Mode: aca.). + +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). + +See also +........ + +PEP 540(3) – Add a new UTF-8 mode + + 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 Built-in breakpoint, Next: PEP 539 New C API for Thread-Local Storage, Prev: PEP 540 Forced UTF-8 Runtime Mode, Up: New Features<12> + +1.7.2.4 PEP 553: Built-in ‘breakpoint()’ +........................................ + +Python 3.7 includes the new built-in *note breakpoint(): 236. function +as an easy and consistent way to enter the Python debugger. + +Built-in ‘breakpoint()’ calls *note sys.breakpointhook(): ada. By +default, the latter imports *note pdb: a5. 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: adb. can be set to the +callable of your debugger of choice. Set ‘PYTHONBREAKPOINT=0’ to +completely disable built-in ‘breakpoint()’. + +See also +........ + +PEP 553(1) – Built-in breakpoint() + + PEP written and implemented by Barry Warsaw + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0553/ + + +File: python.info, Node: PEP 539 New C API for Thread-Local Storage, Next: PEP 562 Customization of Access to Module Attributes, Prev: PEP 553 Built-in breakpoint, Up: New Features<12> + +1.7.2.5 PEP 539: New C API for Thread-Local Storage +................................................... + +While Python provides a C API for thread-local storage support; the +existing *note Thread Local Storage (TLS) API: add. 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: ade. 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: adf. 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. + +See also +........ + +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 Customization of Access to Module Attributes, Next: PEP 564 New Time Functions With Nanosecond Resolution, Prev: PEP 539 New C API for Thread-Local Storage, Up: New Features<12> + +1.7.2.6 PEP 562: Customization of Access to Module Attributes +............................................................. + +Python 3.7 allows defining ‘__getattr__()’ on modules and will call it +whenever a module attribute is otherwise not found. Defining +‘__dir__()’ on modules is now also allowed. + +A typical example of where this may be useful is module attribute +deprecation and lazy loading. + +See also +........ + +PEP 562(1) – Module ‘__getattr__’ and ‘__dir__’ + + PEP written and implemented by Ivan Levkivskyi + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0562/ + + +File: python.info, Node: PEP 564 New Time Functions With Nanosecond Resolution, Next: PEP 565 Show DeprecationWarning in __main__, Prev: PEP 562 Customization of Access to Module Attributes, Up: New Features<12> + +1.7.2.7 PEP 564: New Time Functions With Nanosecond Resolution +.............................................................. + +The resolution of clocks in modern systems can exceed the limited +precision of a floating-point number returned by the *note time.time(): +256. 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: ee. module: + + * *note time.clock_gettime_ns(): ae2. + + * *note time.clock_settime_ns(): ae3. + + * *note time.monotonic_ns(): ae4. + + * *note time.perf_counter_ns(): ae5. + + * *note time.process_time_ns(): ae6. + + * *note time.time_ns(): ae7. + +The new functions return the number of nanoseconds as an integer value. + +Measurements(2) show that on Linux and Windows the resolution of *note +time.time_ns(): ae7. is approximately 3 times better than that of *note +time.time(): 256. + +See also +........ + +PEP 564(3) – Add new time functions with nanosecond resolution + + 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 Core Support for typing module and Generic Types, Prev: PEP 564 New Time Functions With Nanosecond Resolution, Up: New Features<12> + +1.7.2.8 PEP 565: Show DeprecationWarning in ‘__main__’ +...................................................... + +The default handling of *note DeprecationWarning: 1a5. 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: 411.: always displayed by default, recommended + for warnings intended to be seen by application end users (e.g. + for deprecated application configuration settings). + + * *note DeprecationWarning: 1a5.: 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: 8c7.: displayed by default only + when running tests, intended for cases where a future version + upgrade will change the warning category to *note + DeprecationWarning: 1a5. or *note FutureWarning: 411. + +Previously both *note DeprecationWarning: 1a5. and *note +PendingDeprecationWarning: 8c7. 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. + +See also +........ + +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 Core Support for typing module and Generic Types, Next: PEP 552 Hash-based pyc Files, Prev: PEP 565 Show DeprecationWarning in __main__, Up: New Features<12> + +1.7.2.9 PEP 560: Core Support for ‘typing’ module and Generic Types +................................................................... + +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: 104. module are extensively used by the community, +so this restriction is removed. The PEP introduces two special methods +‘__class_getitem__()’ and ‘__mro_entries__’, these methods are now used +by most classes and special constructs in *note typing: 104. As a +result, the speed of various operations with types increased up to 7 +times, the generic types can be used without metaclass conflicts, and +several long standing bugs in *note typing: 104. module are fixed. + +See also +........ + +PEP 560(2) – Core support for typing module and generic types + + 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 Core Support for typing module and Generic Types, Up: New Features<12> + +1.7.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: b3. or *note compileall: 20. + +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 Cached bytecode invalidation: 5e8. for more information. + +See also +........ + +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: New Features<12> + +1.7.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: + + - Japanese: ‘https://docs.python.org/ja/’ + + - French: ‘https://docs.python.org/fr/’ + + - Korean: ‘https://docs.python.org/ko/’ + +See also +........ + +PEP 545(2) – Python Documentation Translations + + 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: New Features<12> + +1.7.2.12 Python Development Mode (-X dev) +......................................... + +The new *note -X: 176. ‘dev’ command line option or the new *note +PYTHONDEVMODE: aed. environment variable can be used to enable *note +Python Development Mode: 1fa. When in development mode, Python performs +additional runtime checks that are too expensive to be enabled by +default. See *note Python Development Mode: 1fa. documentation for the +full description. + + +File: python.info, Node: Other Language Changes<7>, Next: New Modules<7>, Prev: New Features<12>, Up: What’s New In Python 3 7 + +1.7.3 Other Language Changes +---------------------------- + + * An *note await: 1b9. expression and comprehensions containing an + *note async for: aab. clause were illegal in the expressions in + *note formatted string literals: 9a9. 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(): aef. and *note bytearray.fromhex(): af0. now + ignore all ASCII whitespace, not only spaces. (Contributed by + Robert Xiao in bpo-28927(3).) + + * *note str: 447, *note bytes: 1c2, and *note bytearray: 53a. gained + support for the new *note isascii(): af1. 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: 415. 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: af2. can now be instantiated from Python code, + and the *note tb_next: af3. attribute on *note tracebacks: af4. is + now writable. (Contributed by Nathaniel J. Smith in bpo-30579(8).) + + * When using the *note -m: 5dd. 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: 176. ‘importtime’ option or the *note + PYTHONPROFILEIMPORTTIME: af5. 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: New Modules<7>, Next: Improved Modules<7>, Prev: Other Language Changes<7>, Up: What’s New In Python 3 7 + +1.7.4 New Modules +----------------- + +* Menu: + +* contextvars:: +* dataclasses: dataclasses<3>. +* importlib.resources: importlib resources<2>. + + +File: python.info, Node: contextvars, Next: dataclasses<3>, Up: New Modules<7> + +1.7.4.1 contextvars +................... + +The new *note contextvars: 24. module and a set of *note new C APIs: +af8. 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: a. and *note decimal: 36. 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. + +See also +........ + +PEP 567(1) – Context Variables + + PEP written and implemented by Yury Selivanov + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0567/ + + +File: python.info, Node: dataclasses<3>, Next: importlib resources<2>, Prev: contextvars, Up: New Modules<7> + +1.7.4.2 dataclasses +................... + +The new *note dataclass(): 1cb. decorator provides a way to declare +'data classes'. A data class describes its attributes using class +variable annotations. Its constructor and other magic methods, such as +*note __repr__(): 618, *note __eq__(): afa, and *note __hash__(): afb. +are generated automatically. + +Example: + + @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)" + +See also +........ + +PEP 557(1) – Data Classes + + PEP written and implemented by Eric V. Smith + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0557/ + + +File: python.info, Node: importlib resources<2>, Prev: dataclasses<3>, Up: New Modules<7> + +1.7.4.3 importlib.resources +........................... + +The new *note importlib.resources: 7b. 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 +*note importlib.abc.ResourceReader: afd. 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). + +See also +........ + +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: Improved Modules<7>, Next: C API Changes<6>, Prev: New Modules<7>, Up: What’s New In Python 3 7 + +1.7.5 Improved Modules +---------------------- + +* Menu: + +* argparse: argparse<3>. +* asyncio: asyncio<7>. +* binascii:: +* calendar: calendar<2>. +* collections: collections<2>. +* compileall: compileall<3>. +* concurrent.futures: concurrent futures<3>. +* contextlib: contextlib<3>. +* cProfile: cProfile<2>. +* crypt:: +* datetime: datetime<4>. +* dbm: dbm<2>. +* decimal:: +* dis: dis<3>. +* distutils: distutils<4>. +* enum: enum<5>. +* functools: functools<3>. +* gc: gc<4>. +* hmac: hmac<2>. +* http.client: http client. +* http.server: http server. +* idlelib and IDLE:: +* importlib: importlib<4>. +* io: io<4>. +* ipaddress: ipaddress<3>. +* itertools: itertools<5>. +* locale: locale<4>. +* logging: logging<3>. +* math: math<6>. +* mimetypes: mimetypes<2>. +* msilib:: +* multiprocessing: multiprocessing<4>. +* os: os<7>. +* pathlib: pathlib<8>. +* pdb: pdb<4>. +* py_compile: py_compile<3>. +* pydoc: pydoc<2>. +* queue: queue<2>. +* re: re<4>. +* signal: signal<2>. +* socket: socket<5>. +* socketserver:: +* sqlite3: sqlite3<6>. +* ssl: ssl<5>. +* string: string<2>. +* subprocess: subprocess<2>. +* sys: sys<8>. +* time: time<5>. +* tkinter: tkinter<5>. +* tracemalloc: tracemalloc<2>. +* types: types<4>. +* unicodedata: unicodedata<6>. +* unittest: unittest<7>. +* unittest.mock: unittest mock. +* urllib.parse: urllib parse<5>. +* uu:: +* uuid: uuid<2>. +* warnings: warnings<3>. +* xml: xml<5>. +* xml.etree: xml etree. +* xmlrpc.server: xmlrpc server. +* zipapp:: +* zipfile: zipfile<2>. + + +File: python.info, Node: argparse<3>, Next: asyncio<7>, Up: Improved Modules<7> + +1.7.5.1 argparse +................ + +The new *note ArgumentParser.parse_intermixed_args(): b00. 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<7>, Next: binascii, Prev: argparse<3>, Up: Improved Modules<7> + +1.7.5.2 asyncio +............... + +The *note asyncio: a. module has received many new features, usability +and *note performance improvements: b02. Notable changes include: + + * The new *note provisional: b03. *note asyncio.run(): 478. 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: 24. *note + loop.call_soon(): b04, *note loop.call_soon_threadsafe(): b05, + *note loop.call_later(): b06, *note loop.call_at(): b07, and *note + Future.add_done_callback(): b08. have a new optional keyword-only + 'context' parameter. *note Tasks: 1be. 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(): 1bf. 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(): b09. 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(): b0a. 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(): 479. function returns the + currently running *note Task: 1be. instance, and the new *note + asyncio.all_tasks(): 956. 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: a9d. 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(): b0b. function returns the + currently running loop, and raises a *note RuntimeError: 195. if no + loop is running. This is in contrast with *note + asyncio.get_event_loop(): 2c4, 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(): b0c. coroutine method + allows waiting until the stream writer is closed. The new *note + StreamWriter.is_closing(): b0d. 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(): b0e. coroutine method allows + sending files using *note os.sendfile: b0f. when possible. + (Contributed by Andrew Svetlov in bpo-32410(11).) + + * The new *note Future.get_loop(): b10. and ‘Task.get_loop()’ methods + return the instance of the loop on which a task or a future were + created. *note Server.get_loop(): b11. allows doing the same for + *note asyncio.Server: b12. 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: b12. begin serving. Previously, the server would + start serving immediately when created. The new 'start_serving' + keyword argument to *note loop.create_server(): b13. and *note + loop.create_unix_server(): 1ae, as well as *note + Server.start_serving(): b14, and *note Server.serve_forever(): b15. + can be used to decouple server instantiation and serving. The new + *note Server.is_serving(): b16. method returns ‘True’ if the server + is serving. *note Server: b12. 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(): b06. gained + the new *note when(): b17. method which returns an absolute + scheduled callback timestamp. (Contributed by Andrew Svetlov in + bpo-32741(15).) + + * The *note loop.create_datagram_endpoint(): 72e. method gained + support for Unix sockets. (Contributed by Quentin Dawans in + bpo-31245(16).) + + * The *note asyncio.open_connection(): b18, *note + asyncio.start_server(): b19. functions, *note + loop.create_connection(): 5ff, *note loop.create_server(): b13, + *note loop.create_accepted_socket(): b1a. 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(): b1b. 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: + 72d./*note await: 1b9. syntax. (Contributed by Andrew Svetlov in + bpo-32193(19).) + + * The new *note ReadTransport.is_reading(): b1c. method can be used + to determine the reading state of the transport. Additionally, + calls to *note ReadTransport.resume_reading(): b1d. and *note + ReadTransport.pause_reading(): b1e. are now idempotent. + (Contributed by Yury Selivanov in bpo-32356(20).) + + * Loop methods which accept socket paths now support passing *note + path-like objects: 2a2. (Contributed by Yury Selivanov in + bpo-32066(21).) + + * In *note asyncio: a. 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: b1f. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32314 + + (2) https://peps.python.org/pep-0567/ + + (3) https://bugs.python.org/issue?@action=redirect&bpo=32436 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=32311 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=23749 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=31819 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=32250 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=32251 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=32269 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=32391 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=32410 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=32415 + + (13) https://bugs.python.org/issue?@action=redirect&bpo=32418 + + (14) https://bugs.python.org/issue?@action=redirect&bpo=32662 + + (15) https://bugs.python.org/issue?@action=redirect&bpo=32741 + + (16) https://bugs.python.org/issue?@action=redirect&bpo=31245 + + (17) https://bugs.python.org/issue?@action=redirect&bpo=29970 + + (18) https://bugs.python.org/issue?@action=redirect&bpo=31943 + + (19) https://bugs.python.org/issue?@action=redirect&bpo=32193 + + (20) https://bugs.python.org/issue?@action=redirect&bpo=32356 + + (21) https://bugs.python.org/issue?@action=redirect&bpo=32066 + + (22) https://bugs.python.org/issue?@action=redirect&bpo=27456 + + (23) https://bugs.python.org/issue?@action=redirect&bpo=30508 + + (24) https://bugs.python.org/issue?@action=redirect&bpo=33792 + + +File: python.info, Node: binascii, Next: calendar<2>, Prev: asyncio<7>, Up: Improved Modules<7> + +1.7.5.3 binascii +................ + +The *note b2a_uu(): b21. 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<2>, Next: collections<2>, Prev: binascii, Up: Improved Modules<7> + +1.7.5.4 calendar +................ + +The *note HTMLCalendar: b23. class has new class attributes which ease +the customization of CSS classes in the produced HTML calendar. +(Contributed by Oz Tiram in bpo-30095(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=30095 + + +File: python.info, Node: collections<2>, Next: compileall<3>, Prev: calendar<2>, Up: Improved Modules<7> + +1.7.5.5 collections +................... + +‘collections.namedtuple()’ now supports default values. (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<3>, Prev: collections<2>, Up: Improved Modules<7> + +1.7.5.6 compileall +.................. + +*note compileall.compile_dir(): b26. learned the new 'invalidation_mode' +parameter, which can be used to enable *note hash-based .pyc +invalidation: acb. 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<3>, Next: contextlib<3>, Prev: compileall<3>, Up: Improved Modules<7> + +1.7.5.7 concurrent.futures +.......................... + +*note ProcessPoolExecutor: 8ed. and *note ThreadPoolExecutor: 73d. now +support the new 'initializer' and 'initargs' constructor arguments. +(Contributed by Antoine Pitrou in bpo-21423(1).) + +The *note ProcessPoolExecutor: 8ed. can now take the multiprocessing +context via the new 'mp_context' argument. (Contributed by Thomas +Moreau in bpo-31540(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=21423 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=31540 + + +File: python.info, Node: contextlib<3>, Next: cProfile<2>, Prev: concurrent futures<3>, Up: Improved Modules<7> + +1.7.5.8 contextlib +.................. + +The new *note nullcontext(): 7e9. is a simpler and faster no-op context +manager than *note ExitStack: b29. (Contributed by Jesse-Bakker in +bpo-10049(1).) + +The new *note asynccontextmanager(): b2a, *note +AbstractAsyncContextManager: b2b, and *note AsyncExitStack: b2c. have +been added to complement their synchronous counterparts. (Contributed +by Jelle Zijlstra in bpo-29679(2) and bpo-30241(3), and by Alexander +Mohr and Ilya Kulakov in bpo-29302(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10049 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=29679 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=30241 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=29302 + + +File: python.info, Node: cProfile<2>, Next: crypt, Prev: contextlib<3>, Up: Improved Modules<7> + +1.7.5.9 cProfile +................ + +The *note cProfile: 27. 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<4>, Prev: cProfile<2>, Up: Improved Modules<7> + +1.7.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<4>, Next: dbm<2>, Prev: crypt, Up: Improved Modules<7> + +1.7.5.11 datetime +................. + +The new *note datetime.fromisoformat(): 613. method constructs a *note +datetime: 1cc. object from a string in one of the formats output by +*note datetime.isoformat(): b30. (Contributed by Paul Ganssle in +bpo-15873(1).) + +The *note tzinfo: 5da. class now supports sub-minute offsets. +(Contributed by Alexander Belopolsky in bpo-5288(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15873 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=5288 + + +File: python.info, Node: dbm<2>, Next: decimal, Prev: datetime<4>, Up: Improved Modules<7> + +1.7.5.12 dbm +............ + +*note dbm.dumb: 32. now supports reading read-only files and no longer +writes the index file when it is not changed. + + +File: python.info, Node: decimal, Next: dis<3>, Prev: dbm<2>, Up: Improved Modules<7> + +1.7.5.13 decimal +................ + +The *note decimal: 36. module now uses *note context variables: ac0. 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<3>, Next: distutils<4>, Prev: decimal, Up: Improved Modules<7> + +1.7.5.14 dis +............ + +The *note dis(): b34. 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<3>, Up: Improved Modules<7> + +1.7.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<3>, Prev: distutils<4>, Up: Improved Modules<7> + +1.7.5.16 enum +............. + +The *note Enum: 62c. 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 ‘Enum’ +classes will raise a *note TypeError: 534. (e.g. ‘1 in Color’); +similarly, attempting to check for non-Flag objects in a ‘Flag’ member +will raise *note TypeError: 534. (e.g. ‘1 in Perm.RW’); currently, both +operations return *note False: b37. 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<3>, Next: gc<4>, Prev: enum<5>, Up: Improved Modules<7> + +1.7.5.17 functools +.................. + +*note functools.singledispatch(): 635. 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<4>, Next: hmac<2>, Prev: functools<3>, Up: Improved Modules<7> + +1.7.5.18 gc +........... + +The new *note gc.freeze(): b3a. 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(): b3b. functions reverses this operation. Additionally, +*note gc.get_freeze_count(): b3c. 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<2>, Next: http client, Prev: gc<4>, Up: Improved Modules<7> + +1.7.5.19 hmac +............. + +The *note hmac: 6a. module now has an optimized one-shot *note digest(): +b3e. function, which is up to three times faster than ‘HMAC()’. +(Contributed by Christian Heimes in bpo-32433(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32433 + + +File: python.info, Node: http client, Next: http server, Prev: hmac<2>, Up: Improved Modules<7> + +1.7.5.20 http.client +.................... + +*note HTTPConnection: b40. and *note HTTPSConnection: b41. now support +the new 'blocksize' argument for improved upload throughput. +(Contributed by Nir Soffer in bpo-31945(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31945 + + +File: python.info, Node: http server, Next: idlelib and IDLE, Prev: http client, Up: Improved Modules<7> + +1.7.5.21 http.server +.................... + +*note SimpleHTTPRequestHandler: b43. 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: b43. 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: b44. class uses threads to handle +requests using ‘ThreadingMixin’. 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 and IDLE, Next: importlib<4>, Prev: http server, Up: Improved Modules<7> + +1.7.5.22 idlelib and IDLE +......................... + +Multiple fixes for autocompletion. (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).) + +The changes above have been backported to 3.6 maintenance releases. + +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<4>, Prev: idlelib and IDLE, Up: Improved Modules<7> + +1.7.5.23 importlib +.................. + +The *note importlib.abc.ResourceReader: afd. ABC was introduced to +support the loading of resources from packages. See also *note +importlib.resources: ac2. (Contributed by Barry Warsaw, Brett Cannon in +bpo-32248(1).) + +*note importlib.reload(): 514. now raises *note ModuleNotFoundError: +b47. if the module lacks a spec. (Contributed by Garvit Khatri in +bpo-29851(2).) + +‘importlib.find_spec()’ now raises *note ModuleNotFoundError: b47. +instead of *note AttributeError: 348. 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 ‘importlib.source_hash()’ can be used to compute the hash of the +passed source. A *note hash-based .pyc file: acb. 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<4>, Next: ipaddress<3>, Prev: importlib<4>, Up: Improved Modules<7> + +1.7.5.24 io +........... + +The new *note TextIOWrapper.reconfigure(): b49. 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<5>, Prev: io<4>, Up: Improved Modules<7> + +1.7.5.25 ipaddress +.................. + +The new ‘subnet_of()’ and ‘supernet_of()’ methods of *note +ipaddress.IPv6Network: 201. and *note ipaddress.IPv4Network: 200. 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<5>, Next: locale<4>, Prev: ipaddress<3>, Up: Improved Modules<7> + +1.7.5.26 itertools +.................. + +*note itertools.islice(): b4c. now accepts *note integer-like objects: +718. as start, stop, and slice arguments. (Contributed by Will Roberts +in bpo-30537(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=30537 + + +File: python.info, Node: locale<4>, Next: logging<3>, Prev: itertools<5>, Up: Improved Modules<7> + +1.7.5.27 locale +............... + +The new 'monetary' argument to *note locale.format_string(): 51a. 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(): 536. function now always +returns ‘'UTF-8'’ on Android or when in the *note forced UTF-8 mode: +aca. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10379 + + +File: python.info, Node: logging<3>, Next: math<6>, Prev: locale<4>, Up: Improved Modules<7> + +1.7.5.28 logging +................ + +*note Logger: b4f. instances can now be pickled. (Contributed by Vinay +Sajip in bpo-30520(1).) + +The new *note StreamHandler.setStream(): b50. 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(): b51. +(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<6>, Next: mimetypes<2>, Prev: logging<3>, Up: Improved Modules<7> + +1.7.5.29 math +............. + +The new *note math.remainder(): b53. function implements the IEEE +754-style remainder operation. (Contributed by Mark Dickinson in +bpo-29962(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=29962 + + +File: python.info, Node: mimetypes<2>, Next: msilib, Prev: math<6>, Up: Improved Modules<7> + +1.7.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<4>, Prev: mimetypes<2>, Up: Improved Modules<7> + +1.7.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<4>, Next: os<7>, Prev: msilib, Up: Improved Modules<7> + +1.7.5.32 multiprocessing +........................ + +The new *note Process.close(): b57. method explicitly closes the process +object and releases all resources associated with it. *note ValueError: +204. is raised if the underlying process is still running. (Contributed +by Antoine Pitrou in bpo-30596(1).) + +The new *note Process.kill(): b58. method can be used to terminate the +process using the ‘SIGKILL’ signal on Unix. (Contributed by Vitor +Pereira in bpo-30794(2).) + +Non-daemonic threads created by *note Process: b59. 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<7>, Next: pathlib<8>, Prev: multiprocessing<4>, Up: Improved Modules<7> + +1.7.5.33 os +........... + +*note os.fwalk(): b5b. now accepts the 'path' argument as *note bytes: +1c2. (Contributed by Serhiy Storchaka in bpo-28682(1).) + +*note os.scandir(): a5e. gained support for *note file descriptors: b5c. +(Contributed by Serhiy Storchaka in bpo-25996(2).) + +The new *note register_at_fork(): 2fa. function allows registering +Python callbacks to be executed at process fork. (Contributed by +Antoine Pitrou in bpo-16500(3).) + +Added *note os.preadv(): b5d. (combine the functionality of *note +os.readv(): b5e. and *note os.pread(): b5f.) and *note os.pwritev(): +b60. functions (combine the functionality of *note os.writev(): b61. and +*note os.pwrite(): b62.). (Contributed by Pablo Galindo in +bpo-31368(4).) + +The mode argument of *note os.makedirs(): 220. no longer affects the +file permission bits of newly created intermediate-level directories. +(Contributed by Serhiy Storchaka in bpo-19930(5).) + +*note os.dup2(): b63. 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(): 49c. now contains the *note +st_fstype: b64. 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<8>, Next: pdb<4>, Prev: os<7>, Up: Improved Modules<7> + +1.7.5.34 pathlib +................ + +The new *note Path.is_mount(): a16. 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<4>, Next: py_compile<3>, Prev: pathlib<8>, Up: Improved Modules<7> + +1.7.5.35 pdb +............ + +*note pdb.set_trace(): 237. 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: a5. 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<2>, Prev: pdb<4>, Up: Improved Modules<7> + +1.7.5.36 py_compile +................... + +*note py_compile.compile(): a24. – and by extension, *note compileall: +20. – 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<2>, Next: queue<2>, Prev: py_compile<3>, Up: Improved Modules<7> + +1.7.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<4>, Prev: pydoc<2>, Up: Improved Modules<7> + +1.7.5.38 queue +.............. + +The new *note SimpleQueue: b6a. 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<4>, Next: signal<2>, Prev: queue<2>, Up: Improved Modules<7> + +1.7.5.39 re +........... + +The flags *note re.ASCII: 628, *note re.LOCALE: b6c. and *note +re.UNICODE: b6d. can be set within the scope of a group. (Contributed +by Serhiy Storchaka in bpo-31690(1).) + +*note re.split(): 2a4. 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: b6c. 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: 411. 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(): 52f. and *note copy.deepcopy(): b6e. (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<5>, Prev: re<4>, Up: Improved Modules<7> + +1.7.5.40 signal +............... + +The new 'warn_on_full_buffer' argument to the *note +signal.set_wakeup_fd(): b70. 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<5>, Next: socketserver, Prev: signal<2>, Up: Improved Modules<7> + +1.7.5.41 socket +............... + +The new *note socket.getblocking(): b72. 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(): b73. function closes the passed socket +file descriptor. This function should be used instead of *note +os.close(): b74. for better compatibility across platforms. +(Contributed by Christian Heimes in bpo-32454(2).) + +The *note socket: cc. module now exposes the ‘socket.TCP_CONGESTION’ +(Linux 2.6.13), ‘socket.TCP_USER_TIMEOUT’ (Linux 2.6.37), and +‘socket.TCP_NOTSENT_LOWAT’ (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: b75. 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<6>, Prev: socket<5>, Up: Improved Modules<7> + +1.7.5.42 socketserver +..................... + +‘socketserver.ThreadingMixIn.server_close()’ now waits until all +non-daemon threads complete. ‘socketserver.ForkingMixIn.server_close()’ +now waits until all child processes complete. + +Add a new ‘socketserver.ForkingMixIn.block_on_close’ class attribute to +*note socketserver.ForkingMixIn: b77. and *note +socketserver.ThreadingMixIn: b78. classes. Set the class attribute to +‘False’ to get the pre-3.7 behaviour. + + +File: python.info, Node: sqlite3<6>, Next: ssl<5>, Prev: socketserver, Up: Improved Modules<7> + +1.7.5.43 sqlite3 +................ + +*note sqlite3.Connection: 247. now exposes the *note backup(): b7a. +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(): 2aa. now accepts any +*note path-like object: 2a2, 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<5>, Next: string<2>, Prev: sqlite3<6>, Up: Improved Modules<7> + +1.7.5.44 ssl +............ + +The *note ssl: d0. 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: b7c. 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: b7d. (Contributed by Christian +Heimes in bpo-31399(1).) + + Note: 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 Platform + Support Removals: b7e. 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: b7f. 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: b80. (Contributed by Christian Heimes +in bpo-32947(7), bpo-20995(8), bpo-29136(9), bpo-30622(10) and +bpo-33618(11)) + +*note SSLSocket: 8e9. and *note SSLObject: b81. no longer have a public +constructor. Direct instantiation was never a documented and supported +feature. Instances must be created with *note SSLContext: 296. methods +*note wrap_socket(): 520. and *note wrap_bio(): b82. (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: 86d. and +*note SSLContext.maximum_version: 86e. Supported protocols are +indicated by several new flags, such as *note HAS_TLSv1_1: b83. +(Contributed by Christian Heimes in bpo-32609(13).) + +Added *note ssl.SSLContext.post_handshake_auth: a30. to enable and *note +ssl.SSLSocket.verify_client_post_handshake(): a31. to initiate TLS 1.3 +post-handshake authentication. (Contributed by Christian Heimes in +gh-78851(14).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31399 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=32185 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=23033 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=31399 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=31429 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=28414 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=32947 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=20995 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=29136 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=30622 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=33618 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=32951 + + (13) https://bugs.python.org/issue?@action=redirect&bpo=32609 + + (14) https://github.com/python/cpython/issues/78851 + + +File: python.info, Node: string<2>, Next: subprocess<2>, Prev: ssl<5>, Up: Improved Modules<7> + +1.7.5.45 string +............... + +*note string.Template: 683. now lets you to optionally modify the +regular expression pattern for braced placeholders and non-braced +placeholders separately. (Contributed by Barry Warsaw in +bpo-1198569(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=1198569 + + +File: python.info, Node: subprocess<2>, Next: sys<8>, Prev: string<2>, Up: Improved Modules<7> + +1.7.5.46 subprocess +................... + +The *note subprocess.run(): b86. function accepts the new +'capture_output' keyword argument. When true, stdout and stderr will be +captured. This is equivalent to passing *note subprocess.PIPE: b87. as +'stdout' and 'stderr' arguments. (Contributed by Bo Bayles in +bpo-32102(1).) + +The ‘subprocess.run’ function and the *note subprocess.Popen: 199. +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: 199. 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: 9d1. during *note subprocess.call(): b88, *note +subprocess.run(): b86, or in a *note Popen: 199. context manager. It +now waits a short amount of time for the child to exit, before +continuing the handling of the ‘KeyboardInterrupt’ exception. +(Contributed by Gregory P. Smith in bpo-25942(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32102 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=31756 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=19764 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=25942 + + +File: python.info, Node: sys<8>, Next: time<5>, Prev: subprocess<2>, Up: Improved Modules<7> + +1.7.5.47 sys +............ + +The new *note sys.breakpointhook(): ada. hook function is called by the +built-in *note breakpoint(): 236. (Contributed by Barry Warsaw in +bpo-31353(1).) + +On Android, the new *note sys.getandroidapilevel(): b8a. returns the +build-time Android API version. (Contributed by Victor Stinner in +bpo-28740(2).) + +The new *note sys.get_coroutine_origin_tracking_depth(): b8b. function +returns the current coroutine origin tracking depth, as set by the new +*note sys.set_coroutine_origin_tracking_depth(): b8c. *note asyncio: a. +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<5>, Prev: sys<8>, Up: Improved Modules<7> + +1.7.5.48 time +............. + +PEP 564(1) adds six new functions with nanosecond resolution to the +*note time: ee. module: + + * *note time.clock_gettime_ns(): ae2. + + * *note time.clock_settime_ns(): ae3. + + * *note time.monotonic_ns(): ae4. + + * *note time.perf_counter_ns(): ae5. + + * *note time.process_time_ns(): ae6. + + * *note time.time_ns(): ae7. + +New clock identifiers have been added: + + * *note time.CLOCK_BOOTTIME: b8e. (Linux): Identical to *note + time.CLOCK_MONOTONIC: 695, except it also includes any time that + the system is suspended. + + * *note time.CLOCK_PROF: b8f. (FreeBSD, NetBSD and OpenBSD): + High-resolution per-process CPU timer. + + * *note time.CLOCK_UPTIME: b90. (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(): 936. and *note time.thread_time_ns(): +b91. 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(): b92. 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<5>, Next: tracemalloc<2>, Prev: time<5>, Up: Improved Modules<7> + +1.7.5.49 tkinter +................ + +The new *note tkinter.ttk.Spinbox: b94. 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<4>, Prev: tkinter<5>, Up: Improved Modules<7> + +1.7.5.50 tracemalloc +.................... + +*note tracemalloc.Traceback: b96. behaves more like regular tracebacks, +sorting the frames from oldest to most recent. *note +Traceback.format(): b97. 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<4>, Next: unicodedata<6>, Prev: tracemalloc<2>, Up: Improved Modules<7> + +1.7.5.51 types +.............. + +The new *note WrapperDescriptorType: b99, *note MethodWrapperType: 647, +*note MethodDescriptorType: b9a, and *note ClassMethodDescriptorType: +b9b. 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(): b9c. 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<6>, Next: unittest<7>, Prev: types<4>, Up: Improved Modules<7> + +1.7.5.52 unicodedata +.................... + +The internal *note unicodedata: 105. 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<7>, Next: unittest mock, Prev: unicodedata<6>, Up: Improved Modules<7> + +1.7.5.53 unittest +................. + +The new ‘-k’ command-line option allows filtering tests by a name +substring or a Unix shell-like pattern. For example, ‘python -m +unittest -k foo’ runs ‘foo_tests.SomeTest.test_something’, +‘bar_tests.SomeTest.test_foo’, but not +‘bar_tests.FooTest.test_something’. (Contributed by Jonas Haag in +bpo-32071(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32071 + + +File: python.info, Node: unittest mock, Next: urllib parse<5>, Prev: unittest<7>, Up: Improved Modules<7> + +1.7.5.54 unittest.mock +...................... + +The *note sentinel: ba0. attributes now preserve their identity when +they are *note copied: 25. or *note pickled: a6. (Contributed by Serhiy +Storchaka in bpo-20804(1).) + +The new *note seal(): ba1. function allows sealing *note Mock: a4b. +instances, which will disallow further creation of attribute mocks. The +seal is applied recursively to all attributes that are themselves mocks. +(Contributed by Mario Corchero in bpo-30541(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=20804 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=30541 + + +File: python.info, Node: urllib parse<5>, Next: uu, Prev: unittest mock, Up: Improved Modules<7> + +1.7.5.55 urllib.parse +..................... + +*note urllib.parse.quote(): ba3. 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<2>, Prev: urllib parse<5>, Up: Improved Modules<7> + +1.7.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<2>, Next: warnings<3>, Prev: uu, Up: Improved Modules<7> + +1.7.5.57 uuid +............. + +The new *note UUID.is_safe: ba6. 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(): ba7. 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(): ba8. If only locally administered MAC addresses are +available, the first such one found is returned. (Contributed by Barry +Warsaw in bpo-32107(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22807 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=32107 + + +File: python.info, Node: warnings<3>, Next: xml<5>, Prev: uuid<2>, Up: Improved Modules<7> + +1.7.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: 5df. and the new CPython-specific *note -X: 176. ‘dev’ + option) are always passed to the warnings machinery via the *note + sys.warnoptions: 3ac. attribute. + + * warnings filters enabled via the command line or the environment + now have the following order of precedence: + + * the ‘BytesWarning’ filter for *note -b: 5df. (or ‘-bb’) + + * any filters specified with the *note -W: 8c6. option + + * any filters specified with the *note PYTHONWARNINGS: baa. + 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: 1fb, 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__: acd. for details. (Contributed by Nick +Coghlan in bpo-31975(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=20361 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=32043 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=32230 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=31975 + + +File: python.info, Node: xml<5>, Next: xml etree, Prev: warnings<3>, Up: Improved Modules<7> + +1.7.5.59 xml +............ + +As mitigation against DTD and external entity retrieval, the *note +xml.dom.minidom: 122. and *note xml.sax: 129. modules no longer process +external entities by default. (Contributed by Christian Heimes in +gh-61441(1).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/61441 + + +File: python.info, Node: xml etree, Next: xmlrpc server, Prev: xml<5>, Up: Improved Modules<7> + +1.7.5.60 xml.etree +.................. + +*note ElementPath: bad. 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: Improved Modules<7> + +1.7.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<2>, Prev: xmlrpc server, Up: Improved Modules<7> + +1.7.5.62 zipapp +............... + +Function *note create_archive(): bb0. 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(): bb0. 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<2>, Prev: zipapp, Up: Improved Modules<7> + +1.7.5.63 zipfile +................ + +*note ZipFile: 6c0. 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 Changes<6>, Next: Build Changes<6>, Prev: Improved Modules<7>, Up: What’s New In Python 3 7 + +1.7.6 C API Changes +------------------- + +A new API for thread-local storage has been implemented. See *note PEP +539; New C API for Thread-Local Storage: ace. for an overview and *note +Thread Specific Storage (TSS) API: ade. for a complete reference. +(Contributed by Masayuki Yamamoto in bpo-25658(1).) + +The new *note context variables: ac0. functionality exposes a number of +*note new C APIs: af8. + +The new *note PyImport_GetModule(): bb3. function returns the previously +imported module with the given name. (Contributed by Eric Snow in +bpo-28411(2).) + +The new *note Py_RETURN_RICHCOMPARE: bb4. macro eases writing rich +comparison functions. (Contributed by Petr Victorin in bpo-23699(3).) + +The new *note Py_UNREACHABLE: bb5. macro can be used to mark unreachable +code paths. (Contributed by Barry Warsaw in bpo-31338(4).) + +The *note tracemalloc: ff. now exposes a C API through the new *note +PyTraceMalloc_Track(): bb6. and *note PyTraceMalloc_Untrack(): bb7. +functions. (Contributed by Victor Stinner in bpo-30054(5).) + +The new ‘import__find__load__start()’ and ‘import__find__load__done()’ +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: 54c, *note +PyGetSetDef: bb8, *note PyStructSequence_Field: bb9, *note +PyStructSequence_Desc: bba, 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(): 897. and *note +PyUnicode_AsUTF8(): bbb. is now of type ‘const char *’ rather of ‘char +*’. (Contributed by Serhiy Storchaka in bpo-28769(8).) + +The result of *note PyMapping_Keys(): bbc, *note PyMapping_Values(): +bbd. and *note PyMapping_Items(): bbe. 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(): 3f9. and *note +PySlice_AdjustIndices(): 3fa. (Contributed by Serhiy Storchaka in +bpo-27867(10).) + +*note PyOS_AfterFork(): 3f6. is deprecated in favour of the new +functions *note PyOS_BeforeFork(): bbf, *note PyOS_AfterFork_Parent(): +bc0. and *note PyOS_AfterFork_Child(): 3f7. (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(): bc1. and *note PyTimeZone_FromOffsetAndName(): +bc2, and access to the UTC singleton with *note PyDateTime_TimeZone_UTC: +bc3. 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(): bc4. changed from long to unsigned long. +(Contributed by Serhiy Storchaka in bpo-6532(15).) + +*note PyUnicode_AsWideCharString(): 8bb. now raises a *note ValueError: +204. 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(): 8ab. 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 Porting to Python 3.7: ad1. +section in this document and the *note Before Python Initialization: +bc5. section in the C API documentation for more details. + +The new *note PyInterpreterState_GetID(): bc6. returns the unique ID for +a given interpreter. (Contributed by Eric Snow in bpo-29102(17).) + +*note Py_DecodeLocale(): bc7, *note Py_EncodeLocale(): bc8. now use the +UTF-8 encoding when the *note UTF-8 mode: aca. is enabled. (Contributed +by Victor Stinner in bpo-29240(18).) + +*note PyUnicode_DecodeLocaleAndSize(): bc9. and *note +PyUnicode_EncodeLocale(): bca. 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(): 8b8. 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: Optimizations<7>, Prev: C API Changes<6>, Up: What’s New In Python 3 7 + +1.7.7 Build Changes +------------------- + +Support for building ‘--without-threads’ has been removed. The *note +threading: ed. 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: 2a. 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: d0. 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: Optimizations<7>, Next: Other CPython Implementation Changes<2>, Prev: Build Changes<6>, Up: What’s New In Python 3 7 + +1.7.8 Optimizations +------------------- + +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: a. module received +a number of notable optimizations for commonly used functions: + + * The *note asyncio.get_event_loop(): 2c4. 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: bcd. callback management has been optimized. + (Contributed by Yury Selivanov in bpo-32348(9).) + + * *note asyncio.gather(): 5f9. is now up to 15% faster. (Contributed + by Yury Selivanov in bpo-32355(10).) + + * *note asyncio.sleep(): a6f. 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: ac5, the import time of *note typing: +104. 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(): bce. and *note list.sort(): bcf. have been optimized for +common cases to be up to 40-75% faster. (Contributed by Elliot +Gorokhovsky in bpo-28685(14).) + +*note dict.copy(): bd0. is now up to 5.5 times faster. (Contributed by +Yury Selivanov in bpo-31179(15).) + +*note hasattr(): 4ce. and *note getattr(): bd1. are now about 4 times +faster when 'name' is not found and 'obj' does not override *note +object.__getattr__(): 4cf. or *note object.__getattribute__(): bd2. +(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(): 1ca. 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).) + +‘date.fromordinal()’ and ‘date.fromtimestamp()’ are now up to 30% faster +in the common case. (Contributed by Paul Ganssle in bpo-32403(19).) + +The *note os.fwalk(): b5b. function is now up to 2 times faster thanks +to the use of *note os.scandir(): a5e. (Contributed by Serhiy Storchaka +in bpo-25996(20).) + +The speed of the *note shutil.rmtree(): 2fb. function has been improved +by 20–40% thanks to the use of the *note os.scandir(): a5e. function. +(Contributed by Serhiy Storchaka in bpo-28564(21).) + +Optimized case-insensitive matching and searching of *note regular +expressions: b9. Searching some patterns can now be up to 20 times +faster. (Contributed by Serhiy Storchaka in bpo-30285(22).) + +*note re.compile(): bd3. 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(): bd4. methods of classes *note +selectors.EpollSelector: bd5, *note selectors.PollSelector: bd6. and +*note selectors.DevpollSelector: bd7. 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(): 43d. and *note issubclass(): 7bc. 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: 1cd. and *note datetime.datetime: 1cc. 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: 1a0. 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(): bd8. and *note math.erfc(): bd9. 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: Other CPython Implementation Changes<2>, Next: Deprecated Python Behavior, Prev: Optimizations<7>, Up: What’s New In Python 3 7 + +1.7.9 Other CPython Implementation Changes +------------------------------------------ + + * 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: bdb. and *note + f_trace_opcodes: bdc. 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(): 141. 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: Deprecated Python Behavior, Next: Deprecated Python modules functions and methods, Prev: Other CPython Implementation Changes<2>, Up: What’s New In Python 3 7 + +1.7.10 Deprecated Python Behavior +--------------------------------- + +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: bde. +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: 1a5. when +compiled, in Python 3.8 this will be a *note SyntaxError: 18d. +(Contributed by Serhiy Storchaka in bpo-10544(1).) + +Returning a subclass of *note complex: 2f2. from *note +object.__complex__(): 5e3. is deprecated and will be an error in future +Python versions. This makes ‘__complex__()’ consistent with *note +object.__int__(): 717. and *note object.__float__(): 9cc. (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: Deprecated Python modules functions and methods, Next: Deprecated functions and types of the C API, Prev: Deprecated Python Behavior, Up: What’s New In Python 3 7 + +1.7.11 Deprecated Python modules, functions and methods +------------------------------------------------------- + +* Menu: + +* aifc:: +* asyncio: asyncio<8>. +* collections: collections<3>. +* dbm: dbm<3>. +* enum: enum<6>. +* gettext: gettext<2>. +* importlib: importlib<5>. +* locale: locale<5>. +* macpath:: +* threading: threading<5>. +* socket: socket<6>. +* ssl: ssl<6>. +* sunau:: +* sys: sys<9>. +* wave:: + + +File: python.info, Node: aifc, Next: asyncio<8>, Up: Deprecated Python modules functions and methods + +1.7.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<8>, Next: collections<3>, Prev: aifc, Up: Deprecated Python modules functions and methods + +1.7.11.2 asyncio +................ + +Support for directly ‘await’-ing instances of *note asyncio.Lock: a71. +and other asyncio synchronization primitives has been deprecated. An +asynchronous context manager must be used in order to acquire and +release the synchronization resource. (Contributed by Andrew Svetlov in +bpo-32253(1).) + +The ‘asyncio.Task.current_task()’ and ‘asyncio.Task.all_tasks()’ methods +have been deprecated. (Contributed by Andrew Svetlov in bpo-32250(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=32253 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=32250 + + +File: python.info, Node: collections<3>, Next: dbm<3>, Prev: asyncio<8>, Up: Deprecated Python modules functions and methods + +1.7.11.3 collections +.................... + +In Python 3.8, the abstract base classes in *note collections.abc: 1e. +will no longer be exposed in the regular *note collections: 1d. module. +This will help create a clearer distinction between the concrete classes +and the abstract base classes. (Contributed by Serhiy Storchaka in +bpo-25988(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25988 + + +File: python.info, Node: dbm<3>, Next: enum<6>, Prev: collections<3>, Up: Deprecated Python modules functions and methods + +1.7.11.4 dbm +............ + +*note dbm.dumb: 32. now supports reading read-only files and no longer +writes the index file when it is not changed. A deprecation warning is +now emitted if the index file is missing and recreated in the ‘'r'’ and +‘'w'’ modes (this will be an error in future Python releases). +(Contributed by Serhiy Storchaka in bpo-28847(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=28847 + + +File: python.info, Node: enum<6>, Next: gettext<2>, Prev: dbm<3>, Up: Deprecated Python modules functions and methods + +1.7.11.5 enum +............. + +In Python 3.8, attempting to check for non-Enum objects in ‘Enum’ +classes will raise a *note TypeError: 534. (e.g. ‘1 in Color’); +similarly, attempting to check for non-Flag objects in a ‘Flag’ member +will raise *note TypeError: 534. (e.g. ‘1 in Perm.RW’); currently, both +operations return *note False: b37. 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: Deprecated Python modules functions and methods + +1.7.11.6 gettext +................ + +Using non-integer value for selecting a plural form in *note gettext: +63. is now deprecated. It never correctly worked. (Contributed by +Serhiy Storchaka in bpo-28692(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=28692 + + +File: python.info, Node: importlib<5>, Next: locale<5>, Prev: gettext<2>, Up: Deprecated Python modules functions and methods + +1.7.11.7 importlib +.................. + +Methods ‘MetaPathFinder.find_module()’ (replaced by *note +MetaPathFinder.find_spec(): 865.) and ‘PathEntryFinder.find_loader()’ +(replaced by *note PathEntryFinder.find_spec(): 869.) both deprecated in +Python 3.4 now emit *note DeprecationWarning: 1a5. (Contributed by +Matthias Bussonnier in bpo-29576(1).) + +The *note importlib.abc.ResourceLoader: be7. ABC has been deprecated in +favour of *note importlib.abc.ResourceReader: afd. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=29576 + + +File: python.info, Node: locale<5>, Next: macpath, Prev: importlib<5>, Up: Deprecated Python modules functions and methods + +1.7.11.8 locale +............... + +‘locale.format()’ has been deprecated, use *note locale.format_string(): +51a. 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<5>, Prev: locale<5>, Up: Deprecated Python modules functions and methods + +1.7.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<5>, Next: socket<6>, Prev: macpath, Up: Deprecated Python modules functions and methods + +1.7.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: ed. 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<6>, Next: ssl<6>, Prev: threading<5>, Up: Deprecated Python modules functions and methods + +1.7.11.11 socket +................ + +The silent argument value truncation in *note socket.htons(): 87d. and +*note socket.ntohs(): 87e. 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<6>, Next: sunau, Prev: socket<6>, Up: Deprecated Python modules functions and methods + +1.7.11.12 ssl +............. + +‘ssl.wrap_socket()’ is deprecated. Use *note +ssl.SSLContext.wrap_socket(): 520. instead. (Contributed by Christian +Heimes in bpo-28124(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=28124 + + +File: python.info, Node: sunau, Next: sys<9>, Prev: ssl<6>, Up: Deprecated Python modules functions and methods + +1.7.11.13 sunau +............... + +‘sunau.openfp()’ has been deprecated and will be removed in Python 3.9. +Use ‘sunau.open()’ instead. (Contributed by Brian Curtin in +bpo-31985(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31985 + + +File: python.info, Node: sys<9>, Next: wave, Prev: sunau, Up: Deprecated Python modules functions and methods + +1.7.11.14 sys +............. + +Deprecated ‘sys.set_coroutine_wrapper()’ and +‘sys.get_coroutine_wrapper()’. + +The undocumented ‘sys.callstats()’ function has been deprecated and will +be removed in a future Python version. (Contributed by Victor Stinner +in bpo-28799(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=28799 + + +File: python.info, Node: wave, Prev: sys<9>, Up: Deprecated Python modules functions and methods + +1.7.11.15 wave +.............. + +‘wave.openfp()’ has been deprecated and will be removed in Python 3.9. +Use *note wave.open(): 94b. instead. (Contributed by Brian Curtin in +bpo-31985(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=31985 + + +File: python.info, Node: Deprecated functions and types of the C API, Next: Platform Support Removals, Prev: Deprecated Python modules functions and methods, Up: What’s New In Python 3 7 + +1.7.12 Deprecated functions and types of the C API +-------------------------------------------------- + +Function *note PySlice_GetIndicesEx(): 3f8. 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(): 3f6. has been deprecated. Use *note +PyOS_BeforeFork(): bbf, *note PyOS_AfterFork_Parent(): bc0. or *note +PyOS_AfterFork_Child(): 3f7. 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: Platform Support Removals, Next: API and Feature Removals<2>, Prev: Deprecated functions and types of the C API, Up: What’s New In Python 3 7 + +1.7.13 Platform Support Removals +-------------------------------- + + * FreeBSD 9 and older are no longer officially supported. + + * For full Unicode support, including within extension modules, *nix + platforms are now expected to provide at least one of ‘C.UTF-8’ + (full locale), ‘C.utf8’ (full locale) or ‘UTF-8’ (‘LC_CTYPE’-only + locale) as an alternative to the legacy ‘ASCII’-based ‘C’ locale. + + * OpenSSL 0.9.8 and 1.0.1 are no longer supported, which means + building CPython 3.7 with SSL/TLS support on older platforms still + using these versions requires custom build options that link to a + more recent version of OpenSSL. + + Notably, this issue affects the Debian 8 (aka “jessie”) and Ubuntu + 14.04 (aka “Trusty”) LTS Linux distributions, as they still use + OpenSSL 1.0.1 by default. + + Debian 9 (“stretch”) and Ubuntu 16.04 (“xenial”), as well as recent + releases of other LTS Linux releases (e.g. RHEL/CentOS 7.5, SLES + 12-SP3), use OpenSSL 1.0.2 or later, and remain supported in the + default build configuration. + + CPython’s own CI configuration file(1) provides an example of using + the SSL compatibility testing infrastructure(2) in CPython’s test + suite to build and link against OpenSSL 1.1.0 rather than an + outdated system provided OpenSSL. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/blob/v3.7.13/.travis.yml + + (2) +https://github.com/python/cpython/tree/3.13/Tools/ssl/multissltests.py + + +File: python.info, Node: API and Feature Removals<2>, Next: Module Removals, Prev: Platform Support Removals, Up: What’s New In Python 3 7 + +1.7.14 API and Feature Removals +------------------------------- + +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(): 2a5. were deprecated in + Python 3.5, and will now cause an error. + + * Removed support of the 'exclude' argument in *note + tarfile.TarFile.add(): bf3. 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(): bf4. instead. + + * *note collections.namedtuple(): 1ca. 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(): 463, *note float(): 2f1, *note list(): 60d. + and *note tuple(): 36b. no longer take keyword arguments. The + first argument of *note int(): 259. can now be passed only as + positional argument. + + * Removed previously deprecated in Python 2.4 classes ‘Plist’, ‘Dict’ + and ‘_InternalDict’ in the *note plistlib: ab. 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(): bf5. 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: a. no longer exports the *note selectors: c2. and + ‘_overlapped’ modules as ‘asyncio.selectors’ and + ‘asyncio._overlapped’. Replace ‘from asyncio import selectors’ + with ‘import selectors’. + + * Direct instantiation of *note ssl.SSLSocket: 8e9. and *note + ssl.SSLObject: b81. 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: 296. (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 and Feature Removals<2>, Up: What’s New In Python 3 7 + +1.7.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: Porting to Python 3 7, Prev: Module Removals, Up: What’s New In Python 3 7 + +1.7.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: Porting to Python 3 7, Next: Notable changes in Python 3 7 1, Prev: Windows-only Changes, Up: What’s New In Python 3 7 + +1.7.17 Porting to Python 3.7 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in Python Behavior:: +* Changes in the Python API: Changes in the Python API<7>. +* Changes in the C API: Changes in the C API<5>. +* CPython bytecode changes: CPython bytecode changes<6>. +* Windows-only Changes: Windows-only Changes<2>. +* Other CPython implementation changes:: + + +File: python.info, Node: Changes in Python Behavior, Next: Changes in the Python API<7>, Up: Porting to Python 3 7 + +1.7.17.1 Changes in Python Behavior +................................... + + * *note async: 72d. and *note await: 1b9. names are now reserved + keywords. Code using these names as identifiers will now raise a + *note SyntaxError: 18d. (Contributed by Jelle Zijlstra in + bpo-30406(1).) + + * PEP 479(2) is enabled for all code in Python 3.7, meaning that + *note StopIteration: bfa. exceptions raised directly or indirectly + in coroutines and generators are transformed into *note + RuntimeError: 195. exceptions. (Contributed by Yury Selivanov in + bpo-32670(3).) + + * *note object.__aiter__(): bfb. methods can no longer be declared as + asynchronous. (Contributed by Yury Selivanov in bpo-31709(4).) + + * Due to an oversight, earlier Python versions erroneously accepted + the following syntax: + + f(1 for x in [1],) + + class C(1 for x in [1]): + pass + + Python 3.7 now correctly raises a *note SyntaxError: 18d, 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: 5dd. switch, the initial working directory + is now added to *note sys.path: 3b0, 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: Changes in the Python API<7>, Next: Changes in the C API<5>, Prev: Changes in Python Behavior, Up: Porting to Python 3 7 + +1.7.17.2 Changes in the Python API +.................................. + + * ‘socketserver.ThreadingMixIn.server_close()’ now waits until all + non-daemon threads complete. Set the new *note + socketserver.ThreadingMixIn.block_on_close: bfd. class attribute to + ‘False’ to get the pre-3.7 behaviour. (Contributed by Victor + Stinner in bpo-31233(1) and bpo-33540(2).) + + * ‘socketserver.ForkingMixIn.server_close()’ now waits until all + child processes complete. Set the new + ‘socketserver.ForkingMixIn.block_on_close’ 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(): bfe. 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(): bff. now raises a *note ValueError: + 204. 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(): c00. + is now *note positional-only: a85. Passing it as a keyword + argument was deprecated in Python 3.5. (Contributed by Serhiy + Storchaka in bpo-29193(7).) + + * Attributes *note key: c01, *note value: c02. and *note coded_value: + c03. of class *note http.cookies.Morsel: c04. are now read-only. + Assigning to them was deprecated in Python 3.5. Use the *note + set(): c05. method for setting them. (Contributed by Serhiy + Storchaka in bpo-29192(8).) + + * The 'mode' argument of *note os.makedirs(): 220. 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: c06. type is now *note str: 447. + instead of *note bytes: 1c2. (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: cc, calling *note + socket.fromshare(): c07. on a socket created by *note socket.share: + c08. in older Python versions is not supported. + + * ‘repr’ for *note BaseException: 5b7. 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: 9cf. has changed to include + the keyword arguments in the output. (Contributed by Utkarsh + Upadhyay in bpo-30302(13).) + + * Because *note shutil.rmtree(): 2fb. is now implemented using the + *note os.scandir(): a5e. 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: 411. 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: b9. + 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: 411. 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(): 2a5. 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(): c09. 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: b96. frames are now sorted from oldest + to most recent to be more consistent with *note traceback: fe. + (Contributed by Jesse Bakker in bpo-32121(19).) + + * On OSes that support *note socket.SOCK_NONBLOCK: c0a. or *note + socket.SOCK_CLOEXEC: c0b. bit flags, the *note socket.type: c0c. 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: 199. was changed from *note False: b37. to *note + True: c0d. when redirecting the standard handles. If you + previously depended on handles being inherited when using *note + subprocess.Popen: 199. with standard io redirection, you will have + to pass ‘close_fds=False’ to preserve the previous behaviour, or + use *note STARTUPINFO.lpAttributeList: c0e. + + * *note importlib.machinery.PathFinder.invalidate_caches(): c0f. – + which implicitly affects *note importlib.invalidate_caches(): c10. + – now deletes entries in *note sys.path_importer_cache: 5e0. which + are set to ‘None’. (Contributed by Brett Cannon in bpo-33169(21).) + + * In *note asyncio: a, *note loop.sock_recv(): c11, *note + loop.sock_sendall(): c12, *note loop.sock_accept(): c13, *note + loop.getaddrinfo(): c14, *note loop.getnameinfo(): c15. have been + changed to be proper coroutine methods to match their + documentation. Previously, these methods returned *note + asyncio.Future: bcd. instances. (Contributed by Yury Selivanov in + bpo-32327(22).) + + * *note asyncio.Server.sockets: c16. 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: c06. is now a *note str: 447. instance instead + of a *note bytes: 1c2. instance. (Contributed by Victor Stinner in + bpo-21071(24).) + + * *note argparse: 6. subparsers can now be made mandatory by passing + ‘required=True’ to *note ArgumentParser.add_subparsers(): c17. + (Contributed by Anthony Sottile in bpo-26510(25).) + + * *note ast.literal_eval(): c18. is now stricter. Addition and + subtraction of arbitrary numbers are no longer allowed. + (Contributed by Serhiy Storchaka in bpo-31778(26).) + + * *note Calendar.itermonthdates: c19. 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: c1a. and + *note Calendar.itermonthdays4: c1b. can be used. The new methods + return tuples and are not restricted by the range supported by + *note datetime.date: 1cd. (Contributed by Alexander Belopolsky in + bpo-28292(27).) + + * *note collections.ChainMap: c1c. now preserves the order of the + underlying mappings. (Contributed by Raymond Hettinger in + bpo-32792(28).) + + * The ‘submit()’ method of *note + concurrent.futures.ThreadPoolExecutor: 73d. and *note + concurrent.futures.ProcessPoolExecutor: 8ed. now raises a *note + RuntimeError: 195. if called during interpreter shutdown. + (Contributed by Mark Nemec in bpo-33097(29).) + + * The *note configparser.ConfigParser: 1c8. 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: Changes in the C API<5>, Next: CPython bytecode changes<6>, Prev: Changes in the Python API<7>, Up: Porting to Python 3 7 + +1.7.17.3 Changes in the C API +............................. + +The function *note PySlice_GetIndicesEx(): 3f8. is considered unsafe for +resizable sequences. If the slice indices are not instances of *note +int: 259, 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(): 3f9. and *note +PySlice_AdjustIndices(): 3fa. (Contributed by Serhiy Storchaka in +bpo-27867(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=27867 + + +File: python.info, Node: CPython bytecode changes<6>, Next: Windows-only Changes<2>, Prev: Changes in the C API<5>, Up: Porting to Python 3 7 + +1.7.17.4 CPython bytecode changes +................................. + +There are two new opcodes: *note LOAD_METHOD: c1f. 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: Other CPython implementation changes, Prev: CPython bytecode changes<6>, Up: Porting to Python 3 7 + +1.7.17.5 Windows-only Changes +............................. + +The file used to override *note sys.path: 3b0. is now called +‘._pth’ instead of ‘'sys.path'’. See *note Finding +modules: c21. 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: Other CPython implementation changes, Prev: Windows-only Changes<2>, Up: Porting to Python 3 7 + +1.7.17.6 Other CPython implementation changes +............................................. + +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: 3d0. to a value greater than one is +no longer sufficient to both emit *note BytesWarning: c23. 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: Notable changes in Python 3 7 1, Next: Notable changes in Python 3 7 2, Prev: Porting to Python 3 7, Up: What’s New In Python 3 7 + +1.7.18 Notable changes in Python 3.7.1 +-------------------------------------- + +Starting in 3.7.1, *note Py_Initialize(): 8ab. now consistently reads +and respects all of the same environment settings as *note Py_Main(): +c25. (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: 3d4. to 1 before calling *note +Py_Initialize(): 8ab. + +In 3.7.1 the C API for Context Variables *note was updated: c26. to use +*note PyObject: 334. pointers. See also bpo-34762(2). + +In 3.7.1 the *note tokenize: fb. 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: Notable changes in Python 3 7 2, Next: Notable changes in Python 3 7 6, Prev: Notable changes in Python 3 7 1, Up: What’s New In Python 3 7 + +1.7.19 Notable changes in Python 3.7.2 +-------------------------------------- + +In 3.7.2, *note venv: 111. 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: Notable changes in Python 3 7 6, Next: Notable changes in Python 3 7 10, Prev: Notable changes in Python 3 7 2, Up: What’s New In Python 3 7 + +1.7.20 Notable changes in Python 3.7.6 +-------------------------------------- + +Due to significant security concerns, the 'reuse_address' parameter of +*note asyncio.loop.create_datagram_endpoint(): 72e. is no longer +supported. This is because of the behavior of the socket option +‘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(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=37228 + + +File: python.info, Node: Notable changes in Python 3 7 10, Next: Notable changes in Python 3 7 11, Prev: Notable changes in Python 3 7 6, Up: What’s New In Python 3 7 + +1.7.21 Notable changes in Python 3.7.10 +--------------------------------------- + +Earlier Python versions allowed using both ‘;’ and ‘&’ as query +parameter separators in *note urllib.parse.parse_qs(): 27c. and *note +urllib.parse.parse_qsl(): 27b. 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: Notable changes in Python 3 7 10, Up: What’s New In Python 3 7 + +1.7.22 Notable changes in Python 3.7.11 +--------------------------------------- + +A security fix alters the *note ftplib.FTP: 8f9. 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(): 10a. 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.7.23 Notable security feature in 3.7.14 +----------------------------------------- + +Converting between *note int: 259. and *note str: 447. in bases other +than 2 (binary), 4, 8 (octal), 16 (hexadecimal), or 32 such as base 10 +(decimal) now raises a *note ValueError: 204. 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: d9. APIs. See the *note +integer string conversion length limitation: 5f1. 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.8 What’s New In Python 3.6 +============================ + + +Editors: Elvis Pranskevichus <>, Yury Selivanov +<> + +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. + +See also +........ + +PEP 494(2) - Python 3.6 Release Schedule + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<6>. +* New Features: New Features<13>. +* Other Language Changes: Other Language Changes<8>. +* New Modules: New Modules<8>. +* Improved Modules: Improved Modules<8>. +* Optimizations: Optimizations<8>. +* Build and C API Changes: Build and C API Changes<2>. +* Other Improvements:: +* Deprecated: Deprecated<9>. +* Removed: Removed<9>. +* Porting to Python 3.6: Porting to 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: Summary – Release highlights<6>, Next: New Features<13>, Up: What’s New In Python 3 6 + +1.8.1 Summary – Release highlights +---------------------------------- + +New syntax features: + + * *note PEP 498: c2f, formatted string literals. + + * *note PEP 515: c30, underscores in numeric literals. + + * *note PEP 526: c31, syntax for variable annotations. + + * *note PEP 525: c32, asynchronous generators. + + * *note PEP 530: c33.: asynchronous comprehensions. + +New library modules: + + * *note secrets: c0.: *note PEP 506 – Adding A Secrets Module To The + Standard Library: c34. + +CPython implementation improvements: + + * The *note dict: ac6. type has been reimplemented to use a *note + more compact representation: c35. based on a proposal by Raymond + Hettinger(1) and similar to the PyPy dict implementation(2). This + resulted in dictionaries using 20% to 25% less memory when compared + to Python 3.5. + + * Customization of class creation has been simplified with the *note + new protocol: c36. + + * The class attribute definition order is *note now preserved: c37. + + * The order of elements in ‘**kwargs’ now *note corresponds to the + order: c38. in which keyword arguments were passed to the function. + + * DTrace and SystemTap *note probing support: c39. has been added. + + * The new *note PYTHONMALLOC: c3a. environment variable can now be + used to debug the interpreter memory allocation and access errors. + +Significant improvements in the standard library: + + * The *note asyncio: a. 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: c3b. has been implemented to + support *note path-like objects: 2a2. All standard library + functions operating on paths have been updated to work with the new + protocol. + + * The *note datetime: 30. module has gained support for *note Local + Time Disambiguation: c3c. + + * The *note typing: 104. module received a number of *note + improvements: c3d. + + * The *note tracemalloc: ff. module has been significantly reworked + and is now used to provide better output for *note ResourceWarning: + 246. as well as provide better diagnostics for memory allocation + errors. See the *note PYTHONMALLOC section: c3a. for more + information. + +Security improvements: + + * The new *note secrets: c0. 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(): 51e. now blocks until the system + urandom entropy pool is initialized to increase the security. See + the PEP 524(3) for the rationale. + + * The *note hashlib: 68. and *note ssl: d0. modules now support + OpenSSL 1.1.0. + + * The default settings and feature set of the *note ssl: d0. module + have been improved. + + * The *note hashlib: 68. module received support for the BLAKE2, + SHA-3 and SHAKE hash algorithms and the *note scrypt(): c3e. key + derivation function. + +Windows improvements: + + * *note PEP 528: c3f. and *note PEP 529: c40, Windows filesystem and + console encoding changed to UTF-8. + + * The ‘py.exe’ launcher, when used interactively, no longer prefers + Python 2 over Python 3 when the user doesn’t specify a version (via + command line arguments or a config file). Handling of shebang + lines remains unchanged - “python” refers to Python 2 in that case. + + * ‘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: c41. 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: c21. for more information. + + * A ‘python36.zip’ file now works as a landmark to infer *note + PYTHONHOME: 3b8. See *note the documentation: c21. 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: New Features<13>, Next: Other Language Changes<8>, Prev: Summary – Release highlights<6>, Up: What’s New In Python 3 6 + +1.8.2 New Features +------------------ + +* Menu: + +* PEP 498; Formatted string literals: PEP 498 Formatted string literals. +* PEP 526; Syntax for variable annotations: PEP 526 Syntax for variable annotations. +* PEP 515; Underscores in Numeric Literals: PEP 515 Underscores in Numeric Literals. +* PEP 525; Asynchronous Generators: PEP 525 Asynchronous Generators. +* PEP 530; Asynchronous Comprehensions: PEP 530 Asynchronous Comprehensions. +* PEP 487; Simpler customization of class creation: PEP 487 Simpler customization of class creation. +* PEP 487; Descriptor Protocol Enhancements: PEP 487 Descriptor Protocol Enhancements. +* PEP 519; Adding a file system path protocol: PEP 519 Adding a file system path protocol. +* PEP 495; Local Time Disambiguation: PEP 495 Local Time Disambiguation. +* PEP 529; Change Windows filesystem encoding to UTF-8: PEP 529 Change Windows filesystem encoding to UTF-8. +* PEP 528; Change Windows console encoding to UTF-8: PEP 528 Change Windows console encoding to UTF-8. +* PEP 520; Preserving Class Attribute Definition Order: PEP 520 Preserving Class Attribute Definition Order. +* PEP 468; Preserving Keyword Argument Order: PEP 468 Preserving Keyword Argument Order. +* New dict implementation:: +* PEP 523; Adding a frame evaluation API to CPython: PEP 523 Adding a frame evaluation API to CPython. +* PYTHONMALLOC environment variable:: +* DTrace and SystemTap probing support:: + + +File: python.info, Node: PEP 498 Formatted string literals, Next: PEP 526 Syntax for variable annotations, Up: New Features<13> + +1.8.2.1 PEP 498: Formatted string literals +.......................................... + +PEP 498(1) introduces a new kind of string literals: 'f-strings', or +*note formatted string literals: 9a9. + +Formatted string literals are prefixed with ‘'f'’ and are similar to the +format strings accepted by *note str.format(): 61d. They contain +replacement fields surrounded by curly braces. The replacement fields +are expressions, which are evaluated at run time, and then formatted +using the *note format(): 61b. protocol: + + >>> 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' + +See also +........ + +PEP 498(2) – Literal String Interpolation. + + PEP written and implemented by Eric V. Smith. + +*note Feature documentation: 9a9. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0498/ + + (2) https://peps.python.org/pep-0498/ + + +File: python.info, Node: PEP 526 Syntax for variable annotations, Next: PEP 515 Underscores in Numeric Literals, Prev: PEP 498 Formatted string literals, Up: New Features<13> + +1.8.2.2 PEP 526: Syntax for variable annotations +................................................ + +PEP 484(1) introduced the standard for type annotations of function +parameters, a.k.a. type hints. This PEP adds syntax to Python for +annotating the types of variables including class variables and instance +variables: + + primes: List[int] = [] + + captain: str # Note: no initial value! + + class Starship: + stats: Dict[str, int] = {} + +Just as for function annotations, the Python interpreter does not attach +any particular meaning to variable annotations and only stores them in +the ‘__annotations__’ attribute of a class or module. + +In contrast to variable declarations in statically typed languages, the +goal of annotation syntax is to provide an easy way to specify +structured type metadata for third party tools and libraries via the +abstract syntax tree and the ‘__annotations__’ attribute. + +See also +........ + +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. + +Tools that use or will use the new syntax: mypy(3), pytype(4), PyCharm, +etc. + + ---------- 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 Underscores in Numeric Literals, Next: PEP 525 Asynchronous Generators, Prev: PEP 526 Syntax for variable annotations, Up: New Features<13> + +1.8.2.3 PEP 515: Underscores in Numeric Literals +................................................ + +PEP 515(1) adds the ability to use underscores in numeric literals for +improved readability. For example: + + >>> 1_000_000_000_000_000 + 1000000000000000 + >>> 0x_FF_FF_FF_FF + 4294967295 + +Single underscores are allowed between digits and after any base +specifier. Leading, trailing, or multiple underscores in a row are not +allowed. + +The *note string formatting: 1ea. 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' + +See also +........ + +PEP 515(2) – Underscores in Numeric Literals + + 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 Asynchronous Generators, Next: PEP 530 Asynchronous Comprehensions, Prev: PEP 515 Underscores in Numeric Literals, Up: New Features<13> + +1.8.2.4 PEP 525: Asynchronous Generators +........................................ + +PEP 492(1) introduced support for native coroutines and ‘async’ / +‘await’ syntax to Python 3.5. A notable limitation of the Python 3.5 +implementation is that it was not possible to use ‘await’ and ‘yield’ in +the same function body. In Python 3.6 this restriction has been lifted, +making it possible to define 'asynchronous generators': + + 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) + +The new syntax allows for faster and more concise code. + +See also +........ + +PEP 525(2) – Asynchronous Generators + + 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 Asynchronous Comprehensions, Next: PEP 487 Simpler customization of class creation, Prev: PEP 525 Asynchronous Generators, Up: New Features<13> + +1.8.2.5 PEP 530: Asynchronous Comprehensions +............................................ + +PEP 530(1) adds support for using ‘async for’ in list, set, dict +comprehensions and generator expressions: + + result = [i async for i in aiter() if i % 2] + +Additionally, ‘await’ expressions are supported in all kinds of +comprehensions: + + result = [await fun() for fun in funcs if await condition()] + +See also +........ + +PEP 530(2) – Asynchronous Comprehensions + + 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 Descriptor Protocol Enhancements, Prev: PEP 530 Asynchronous Comprehensions, Up: New Features<13> + +1.8.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(): 4d7. calls to work +correctly from *note __init_subclass__(): 62d. implementations, custom +metaclasses must ensure that the new ‘__classcell__’ namespace entry is +propagated to ‘type.__new__’ (as described in *note Creating the class +object: c4a.). + +See also +........ + +PEP 487(1) – Simpler customization of class creation + + PEP written and implemented by Martin Teichmann. + +*note Feature documentation: c4b. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0487/ + + +File: python.info, Node: PEP 487 Descriptor Protocol Enhancements, Next: PEP 519 Adding a file system path protocol, Prev: PEP 487 Simpler customization of class creation, Up: New Features<13> + +1.8.2.7 PEP 487: Descriptor Protocol Enhancements +................................................. + +PEP 487(1) extends the descriptor protocol to include the new optional +*note __set_name__(): c4e. 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() + +See also +........ + +PEP 487(2) – Simpler customization of class creation + + PEP written and implemented by Martin Teichmann. + +*note Feature documentation: c4f. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0487/ + + (2) https://peps.python.org/pep-0487/ + + +File: python.info, Node: PEP 519 Adding a file system path protocol, Next: PEP 495 Local Time Disambiguation, Prev: PEP 487 Descriptor Protocol Enhancements, Up: New Features<13> + +1.8.2.8 PEP 519: Adding a file system path protocol +................................................... + +File system paths have historically been represented as *note str: 447. +or *note bytes: 1c2. 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: 259. 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: a4. from working with pre-existing +code, including Python’s standard library. + +To fix this situation, a new interface represented by *note os.PathLike: +c51. has been defined. By implementing the *note __fspath__(): c52. +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: +447. or *note bytes: 1c2. object. This means an object is considered +*note path-like: 2a2. if it implements *note os.PathLike: c51. or is a +*note str: 447. or *note bytes: 1c2. object which represents a file +system path. Code can use *note os.fspath(): c53, *note os.fsdecode(): +c54, or *note os.fsencode(): c55. to explicitly get a *note str: 447. +and/or *note bytes: 1c2. representation of a path-like object. + +The built-in *note open(): 517. function has been updated to accept +*note os.PathLike: c51. objects, as have all relevant functions in the +*note os: a1. and *note os.path: a2. modules, and most other functions +and classes in the standard library. The *note os.DirEntry: 497. class +and relevant classes in *note pathlib: a4. have also been updated to +implement *note os.PathLike: c51. + +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: 2a2. without any code changes, or at least +very minimal ones (e.g. calling *note os.fspath(): c53. 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: 22b. 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.) + +See also +........ + +PEP 519(1) – Adding a file system path protocol + + PEP written by Brett Cannon and Koos Zevenhoven. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0519/ + + +File: python.info, Node: PEP 495 Local Time Disambiguation, Next: PEP 529 Change Windows filesystem encoding to UTF-8, Prev: PEP 519 Adding a file system path protocol, Up: New Features<13> + +1.8.2.9 PEP 495: Local Time Disambiguation +.......................................... + +In most world locations, there have been and will be times when local +clocks are moved back. In those times, intervals are introduced in +which local clocks show the same time twice in the same day. In these +situations, the information displayed on a local clock (or stored in a +Python datetime instance) is insufficient to identify a particular +moment in time. + +PEP 495(1) adds the new 'fold' attribute to instances of *note +datetime.datetime: 1cc. and *note datetime.time: 1ce. classes to +differentiate between two moments in time for which local times are the +same: + + >>> 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 + +The values of the *note fold: c57. attribute have the value ‘0’ for all +instances except those that represent the second (chronologically) +moment in time in an ambiguous case. + +See also +........ + +PEP 495(2) – Local Time Disambiguation + + 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 Change Windows filesystem encoding to UTF-8, Next: PEP 528 Change Windows console encoding to UTF-8, Prev: PEP 495 Local Time Disambiguation, Up: New Features<13> + +1.8.2.10 PEP 529: Change Windows filesystem encoding to 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(): c59, which now defaults +to ‘'utf-8'’. + +Applications that do not use str to represent paths should use *note +os.fsencode(): c55. and *note os.fsdecode(): c54. to ensure their bytes +are correctly encoded. To revert to the previous behaviour, set *note +PYTHONLEGACYWINDOWSFSENCODING: 2b1. or call *note +sys._enablelegacywindowsfsencoding(): 2b0. + +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 Change Windows console encoding to UTF-8, Next: PEP 520 Preserving Class Attribute Definition Order, Prev: PEP 529 Change Windows filesystem encoding to UTF-8, Up: New Features<13> + +1.8.2.11 PEP 528: Change Windows console encoding to 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: c5b. + +See also +........ + +PEP 528(1) – Change Windows console encoding to UTF-8 + + PEP written and implemented by Steve Dower. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0528/ + + +File: python.info, Node: PEP 520 Preserving Class Attribute Definition Order, Next: PEP 468 Preserving Keyword Argument Order, Prev: PEP 528 Change Windows console encoding to UTF-8, Up: New Features<13> + +1.8.2.12 PEP 520: Preserving Class Attribute Definition Order +............................................................. + +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__: c5d. attribute. + +Also, the effective default class 'execution' namespace (returned from +*note type.__prepare__(): c5e.) is now an insertion-order-preserving +mapping. + +See also +........ + +PEP 520(1) – Preserving Class Attribute Definition Order + + PEP written and implemented by Eric Snow. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0520/ + + +File: python.info, Node: PEP 468 Preserving Keyword Argument Order, Next: New dict implementation, Prev: PEP 520 Preserving Class Attribute Definition Order, Up: New Features<13> + +1.8.2.13 PEP 468: Preserving Keyword Argument Order +................................................... + +‘**kwargs’ in a function signature is now guaranteed to be an +insertion-order-preserving mapping. + +See also +........ + +PEP 468(1) – Preserving Keyword Argument Order + + PEP written and implemented by Eric Snow. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0468/ + + +File: python.info, Node: New dict implementation, Next: PEP 523 Adding a frame evaluation API to CPython, Prev: PEP 468 Preserving Keyword Argument Order, Up: New Features<13> + +1.8.2.14 New dict implementation +................................ + +The *note dict: ac6. 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(): 258. 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 Adding a frame evaluation API to CPython, Next: PYTHONMALLOC environment variable, Prev: New dict implementation, Up: New Features<13> + +1.8.2.15 PEP 523: Adding a frame evaluation API to CPython +.......................................................... + +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. + +See also +........ + +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 environment variable, Next: DTrace and SystemTap probing support, Prev: PEP 523 Adding a frame evaluation API to CPython, Up: New Features<13> + +1.8.2.16 PYTHONMALLOC environment variable +.......................................... + +The new *note PYTHONMALLOC: c64. environment variable allows setting the +Python memory allocators and installing debug hooks. + +It is now possible to install debug hooks on Python memory allocators on +Python compiled in release mode using ‘PYTHONMALLOC=debug’. Effects of +debug hooks: + + * Newly allocated memory is filled with the byte ‘0xCB’ + + * Freed memory is filled with the byte ‘0xDB’ + + * Detect violations of the Python memory allocator API. For example, + *note PyObject_Free(): c65. called on a memory block allocated by + *note PyMem_Malloc(): c66. + + * Detect writes before the start of a buffer (buffer underflows) + + * Detect writes after the end of a buffer (buffer overflows) + + * Check that the *note GIL: 148. is held when allocator functions of + *note PYMEM_DOMAIN_OBJ: c67. (ex: *note PyObject_Malloc(): c68.) + and *note PYMEM_DOMAIN_MEM: c69. (ex: *note PyMem_Malloc(): c66.) + domains are called. + +Checking if the GIL is held is also a new feature of Python 3.6. + +See the *note PyMem_SetupDebugHooks(): c6a. 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: ff. 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 environment variable, Up: New Features<13> + +1.8.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: + + * function call/return + + * garbage collection started/finished + + * line of code executed. + +This can be used to instrument running interpreters in production, +without the need to recompile specific *note debug builds: 1fb. or +providing application-specific profiling/debugging code. + +More details in *note Instrumenting CPython with DTrace and SystemTap: +c6c. + +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: Other Language Changes<8>, Next: New Modules<8>, Prev: New Features<13>, Up: What’s New In Python 3 6 + +1.8.3 Other Language Changes +---------------------------- + +Some smaller changes made to the core Python language are: + + * 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: 461. + + * It is now possible to set a *note special method: c6e. to ‘None’ to + indicate that the corresponding operation is not available. For + example, if a class sets ‘__iter__()’ 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: c6f. for an example). (Contributed by Emanuel Barry in + bpo-26823(2).) + + * Import now raises the new exception *note ModuleNotFoundError: b47. + (subclass of *note ImportError: 415.) 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: New Modules<8>, Next: Improved Modules<8>, Prev: Other Language Changes<8>, Up: What’s New In Python 3 6 + +1.8.4 New Modules +----------------- + +* Menu: + +* secrets:: + + +File: python.info, Node: secrets, Up: New Modules<8> + +1.8.4.1 secrets +............... + +The main purpose of the new *note secrets: c0. 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. + + Warning: Note that the pseudo-random generators in the *note + random: b8. module should 'NOT' be used for security purposes. Use + *note secrets: c0. on Python 3.6+ and *note os.urandom(): 51e. on + Python 3.5 and earlier. + +See also +........ + +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: Improved Modules<8>, Next: Optimizations<8>, Prev: New Modules<8>, Up: What’s New In Python 3 6 + +1.8.5 Improved Modules +---------------------- + +* Menu: + +* array: array<4>. +* ast: ast<4>. +* asyncio: asyncio<9>. +* binascii: binascii<2>. +* cmath:: +* collections: collections<4>. +* concurrent.futures: concurrent futures<4>. +* contextlib: contextlib<4>. +* datetime: datetime<5>. +* decimal: decimal<2>. +* distutils: distutils<5>. +* email: email<2>. +* encodings: encodings<2>. +* enum: enum<7>. +* faulthandler: faulthandler<2>. +* fileinput: fileinput<2>. +* hashlib: hashlib<5>. +* http.client: http client<2>. +* idlelib and IDLE: idlelib and IDLE<2>. +* importlib: importlib<6>. +* inspect: inspect<6>. +* json:: +* logging: logging<4>. +* math: math<7>. +* multiprocessing: multiprocessing<5>. +* os: os<8>. +* pathlib: pathlib<9>. +* pdb: pdb<5>. +* pickle: pickle<2>. +* pickletools:: +* pydoc: pydoc<3>. +* random: random<4>. +* re: re<5>. +* readline:: +* rlcompleter:: +* shlex: shlex<2>. +* site: site<3>. +* sqlite3: sqlite3<7>. +* socket: socket<7>. +* socketserver: socketserver<2>. +* ssl: ssl<7>. +* statistics: statistics<5>. +* struct:: +* subprocess: subprocess<3>. +* sys: sys<10>. +* telnetlib:: +* time: time<6>. +* timeit:: +* tkinter: tkinter<6>. +* traceback: traceback<4>. +* tracemalloc: tracemalloc<3>. +* typing: typing<9>. +* unicodedata: unicodedata<7>. +* unittest.mock: unittest mock<2>. +* urllib.request: urllib request. +* urllib.robotparser: urllib robotparser. +* venv: venv<5>. +* warnings: warnings<4>. +* winreg:: +* winsound:: +* xmlrpc.client: xmlrpc client. +* zipfile: zipfile<3>. +* zlib:: + + +File: python.info, Node: array<4>, Next: ast<4>, Up: Improved Modules<8> + +1.8.5.1 array +............. + +Exhausted iterators of *note array.array: 1a0. 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<4>, Next: asyncio<9>, Prev: array<4>, Up: Improved Modules<8> + +1.8.5.2 ast +........... + +The new *note ast.Constant: 2bb. 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<9>, Next: binascii<2>, Prev: ast<4>, Up: Improved Modules<8> + +1.8.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: a. module since Python 3.5.0 (all +backported to 3.5.x due to the provisional status): + + * The *note get_event_loop(): 2c4. 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(): c76. function and all functions that use + it, such as *note loop.run_until_complete(): c77, now accept all + kinds of *note awaitable objects: 1ad. (Contributed by Yury + Selivanov.) + + * New *note run_coroutine_threadsafe(): 880. function to submit + coroutines to event loops from other threads. (Contributed by + Vincent Michel.) + + * New *note Transport.is_closing(): c78. method to check if the + transport is closing or closed. (Contributed by Yury Selivanov.) + + * The *note loop.create_server(): b13. method can now accept a list + of hosts. (Contributed by Yann Sionneau.) + + * New *note loop.create_future(): c79. method to create Future + objects. This allows alternative event loop implementations, such + as uvloop(2), to provide a faster *note asyncio.Future: bcd. + implementation. (Contributed by Yury Selivanov in bpo-27041(3).) + + * New *note loop.get_exception_handler(): c7a. method to get the + current exception handler. (Contributed by Yury Selivanov in + bpo-27040(4).) + + * New *note StreamReader.readuntil(): 1b4. method to read data from + the stream until a separator bytes sequence appears. (Contributed + by Mark Korenberg.) + + * The performance of *note StreamReader.readexactly(): c7b. has been + improved. (Contributed by Mark Korenberg in bpo-28370(5).) + + * The *note loop.getaddrinfo(): c14. 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(): c7c. 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).) + + * ‘Future.set_exception’ will now raise *note TypeError: 534. when + passed an instance of the *note StopIteration: bfa. exception. + (Contributed by Chris Angelico in bpo-26221(7).) + + * New *note loop.connect_accepted_socket(): b1a. 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(): c7d. to properly close pending + asynchronous generators before closing the loop. (Contributed by + Yury Selivanov in bpo-28003(10).) + + * *note Future: bcd. and *note Task: 1be. classes now have an + optimized C implementation which makes asyncio code up to 30% + faster. (Contributed by Yury Selivanov and INADA Naoki in + bpo-26081(11) and bpo-28544(12).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=28613 + + (2) https://github.com/MagicStack/uvloop + + (3) https://bugs.python.org/issue?@action=redirect&bpo=27041 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=27040 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=28370 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=25593 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=26221 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=27392 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=27456 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=28003 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=26081 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=28544 + + +File: python.info, Node: binascii<2>, Next: cmath, Prev: asyncio<9>, Up: Improved Modules<8> + +1.8.5.4 binascii +................ + +The *note b2a_base64(): c7f. function now accepts an optional 'newline' +keyword argument to control whether the newline character is appended to +the return value. (Contributed by Victor Stinner in bpo-25357(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25357 + + +File: python.info, Node: cmath, Next: collections<4>, Prev: binascii<2>, Up: Improved Modules<8> + +1.8.5.5 cmath +............. + +The new *note cmath.tau: c81. ('τ') constant has been added. +(Contributed by Lisa Roach in bpo-12345(1), see PEP 628(2) for details.) + +New constants: *note cmath.inf: c82. and *note cmath.nan: c83. to match +*note math.inf: c84. and *note math.nan: 65f, and also *note cmath.infj: +c85. and *note cmath.nanj: c86. to match the format used by complex +repr. (Contributed by Mark Dickinson in bpo-23229(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=12345 + + (2) https://peps.python.org/pep-0628/ + + (3) https://bugs.python.org/issue?@action=redirect&bpo=23229 + + +File: python.info, Node: collections<4>, Next: concurrent futures<4>, Prev: cmath, Up: Improved Modules<8> + +1.8.5.6 collections +................... + +The new *note Collection: c88. 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: c89. abstract base class represents iterable +classes that also provide the ‘__reversed__()’ method. (Contributed by +Ivan Levkivskyi in bpo-25987(2).) + +The new *note AsyncGenerator: c8a. abstract base class represents +asynchronous generators. (Contributed by Yury Selivanov in +bpo-28720(3).) + +The *note namedtuple(): 1ca. function now accepts an optional keyword +argument 'module', which, when specified, is used for the *note +__module__: 36f. attribute of the returned named tuple class. +(Contributed by Raymond Hettinger in bpo-17941(4).) + +The 'verbose' and 'rename' arguments for *note namedtuple(): 1ca. are +now keyword-only. (Contributed by Raymond Hettinger in bpo-25628(5).) + +Recursive *note collections.deque: 5d8. 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<4>, Next: contextlib<4>, Prev: collections<4>, Up: Improved Modules<8> + +1.8.5.7 concurrent.futures +.......................... + +The *note ThreadPoolExecutor: 73d. class constructor now accepts an +optional 'thread_name_prefix' argument to make it possible to customize +the names of the threads created by the pool. (Contributed by Gregory +P. Smith in bpo-27664(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=27664 + + +File: python.info, Node: contextlib<4>, Next: datetime<5>, Prev: concurrent futures<4>, Up: Improved Modules<8> + +1.8.5.8 contextlib +.................. + +The *note contextlib.AbstractContextManager: c8d. 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: 104. module as *note typing.ContextManager: +c8e. (Contributed by Brett Cannon in bpo-25609(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25609 + + +File: python.info, Node: datetime<5>, Next: decimal<2>, Prev: contextlib<4>, Up: Improved Modules<8> + +1.8.5.9 datetime +................ + +The *note datetime: 1cc. and *note time: 1ce. classes have the new +‘fold’ attribute used to disambiguate local time when necessary. Many +functions in the *note datetime: 30. have been updated to support local +time disambiguation. See *note Local Time Disambiguation: c3c. section +for more information. (Contributed by Alexander Belopolsky in +bpo-24773(1).) + +The *note datetime.strftime(): c90. and *note date.strftime(): c91. +methods now support ISO 8601 date directives ‘%G’, ‘%u’ and ‘%V’. +(Contributed by Ashley Anderson in bpo-12006(2).) + +The *note datetime.isoformat(): b30. 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(): c92. 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<2>, Next: distutils<5>, Prev: datetime<5>, Up: Improved Modules<8> + +1.8.5.10 decimal +................ + +New *note Decimal.as_integer_ratio(): c94. method that returns a pair +‘(n, d)’ of integers that represent the given *note Decimal: 29f. +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<2>, Prev: decimal<2>, Up: Improved Modules<8> + +1.8.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<2>, Next: encodings<2>, Prev: distutils<5>, Up: Improved Modules<8> + +1.8.5.12 email +.............. + +The new email API, enabled via the 'policy' keyword to various +constructors, is no longer provisional. The *note email: 3b. +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: 45. classes now all accept an optional 'policy' +keyword. (Contributed by Berker Peksag in bpo-27331(2).) + +The *note DecodedGenerator: c97. now supports the 'policy' keyword. + +There is a new *note policy: 4f. attribute, *note message_factory: c98, +that controls what class is used by default when the parser creates new +message objects. For the *note email.policy.compat32: c99. policy this +is *note Message: 27e, for the new policies it is *note EmailMessage: +27d. (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: encodings<2>, Next: enum<7>, Prev: email<2>, Up: Improved Modules<8> + +1.8.5.13 encodings +.................. + +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<2>, Prev: encodings<2>, Up: Improved Modules<8> + +1.8.5.14 enum +............. + +Two new enumeration base classes have been added to the *note enum: 56. +module: *note Flag: 61f. and ‘IntFlags’. 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 ‘IntFlags’ +class for their constants. + +The new *note enum.auto: c9c. 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) + [, , ] + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23591 + + +File: python.info, Node: faulthandler<2>, Next: fileinput<2>, Prev: enum<7>, Up: Improved Modules<8> + +1.8.5.15 faulthandler +..................... + +On Windows, the *note faulthandler: 58. module now installs a handler +for Windows exceptions: see *note faulthandler.enable(): c9e. +(Contributed by Victor Stinner in bpo-23848(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23848 + + +File: python.info, Node: fileinput<2>, Next: hashlib<5>, Prev: faulthandler<2>, Up: Improved Modules<8> + +1.8.5.16 fileinput +.................. + +*note hook_encoded(): ca0. now supports the 'errors' argument. +(Contributed by Joseph Hackman in bpo-25788(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25788 + + +File: python.info, Node: hashlib<5>, Next: http client<2>, Prev: fileinput<2>, Up: Improved Modules<8> + +1.8.5.17 hashlib +................ + +*note hashlib: 68. 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(): 63e. +and *note blake2s(): 63f. 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(): ca2, *note sha3_256(): ca3, +*note sha3_384(): ca4, *note sha3_512(): ca5, and SHAKE hash functions +*note shake_128(): ca6. and *note shake_256(): ca7. 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(): c3e. is now +available with OpenSSL 1.1.0 and newer. (Contributed by Christian +Heimes in bpo-27928(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=26470 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=26798 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=16113 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=27928 + + +File: python.info, Node: http client<2>, Next: idlelib and IDLE<2>, Prev: hashlib<5>, Up: Improved Modules<8> + +1.8.5.18 http.client +.................... + +*note HTTPConnection.request(): ca9. and *note endheaders(): caa. 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 and IDLE<2>, Next: importlib<6>, Prev: http client<2>, Up: Improved Modules<8> + +1.8.5.19 idlelib and 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: + +Multiple fixes for autocompletion. (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<6>, Prev: idlelib and IDLE<2>, Up: Improved Modules<8> + +1.8.5.20 importlib +.................. + +Import now raises the new exception *note ModuleNotFoundError: b47. +(subclass of *note ImportError: 415.) 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: cad. now calls *note create_module(): +cae. on the wrapped loader, removing the restriction that *note +importlib.machinery.BuiltinImporter: caf. and *note +importlib.machinery.ExtensionFileLoader: cb0. couldn’t be used with +*note importlib.util.LazyLoader: cad. + +*note importlib.util.cache_from_source(): 2f8, *note +importlib.util.source_from_cache(): 515, and *note +importlib.util.spec_from_file_location(): cb1. now accept a *note +path-like object: 2a2. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15767 + + +File: python.info, Node: inspect<6>, Next: json, Prev: importlib<6>, Up: Improved Modules<8> + +1.8.5.21 inspect +................ + +The *note inspect.signature(): 733. 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(): 734. has been reversed. While this +function is convenient for single/source Python 2/3 code bases, the +richer *note inspect.signature(): 733. 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, Next: logging<4>, Prev: inspect<6>, Up: Improved Modules<8> + +1.8.5.22 json +............. + +*note json.load(): cb4. and *note json.loads(): 955. now support binary +input. Encoded JSON should be represented using either UTF-8, UTF-16, +or UTF-32. (Contributed by Serhiy Storchaka in bpo-17909(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17909 + + +File: python.info, Node: logging<4>, Next: math<7>, Prev: json, Up: Improved Modules<8> + +1.8.5.23 logging +................ + +The new *note WatchedFileHandler.reopenIfNeeded(): cb6. method has been +added to add the ability to check if the log file needs to be reopened. +(Contributed by Marian Horban in bpo-24884(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=24884 + + +File: python.info, Node: math<7>, Next: multiprocessing<5>, Prev: logging<4>, Up: Improved Modules<8> + +1.8.5.24 math +............. + +The tau ('τ') constant has been added to the *note math: 8e. and *note +cmath: 18. 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<5>, Next: os<8>, Prev: math<7>, Up: Improved Modules<8> + +1.8.5.25 multiprocessing +........................ + +*note Proxy Objects: cb9. returned by *note multiprocessing.Manager(): +cba. 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<8>, Next: pathlib<9>, Prev: multiprocessing<5>, Up: Improved Modules<8> + +1.8.5.26 os +........... + +See the summary of *note PEP 519: c3b. for details on how the *note os: +a1. and *note os.path: a2. modules now support *note path-like objects: +2a2. + +*note scandir(): a5e. now supports *note bytes: 1c2. paths on Windows. + +A new *note close(): cbc. method allows explicitly closing a *note +scandir(): a5e. iterator. The *note scandir(): a5e. iterator now +supports the *note context manager: 5d0. protocol. If a ‘scandir()’ +iterator is neither exhausted nor explicitly closed a *note +ResourceWarning: 246. will be emitted in its destructor. (Contributed +by Serhiy Storchaka in bpo-25994(1).) + +On Linux, *note os.urandom(): 51e. 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(): cbd. 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<9>, Next: pdb<5>, Prev: os<8>, Up: Improved Modules<8> + +1.8.5.27 pathlib +................ + +*note pathlib: a4. now supports *note path-like objects: 2a2. +(Contributed by Brett Cannon in bpo-27186(1).) + +See the summary of *note PEP 519: c3b. for details. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=27186 + + +File: python.info, Node: pdb<5>, Next: pickle<2>, Prev: pathlib<9>, Up: Improved Modules<8> + +1.8.5.28 pdb +............ + +The *note Pdb: 921. class constructor has a new optional 'readrc' +argument to control whether ‘.pdbrc’ files should be read. + + +File: python.info, Node: pickle<2>, Next: pickletools, Prev: pdb<5>, Up: Improved Modules<8> + +1.8.5.29 pickle +............... + +Objects that need ‘__new__’ called with keyword arguments can now be +pickled using *note pickle protocols: cc1. older than protocol version +4. Protocol version 4 already supports this case. (Contributed by +Serhiy Storchaka in bpo-24164(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=24164 + + +File: python.info, Node: pickletools, Next: pydoc<3>, Prev: pickle<2>, Up: Improved Modules<8> + +1.8.5.30 pickletools +.................... + +*note pickletools.dis(): cc3. 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<3>, Next: random<4>, Prev: pickletools, Up: Improved Modules<8> + +1.8.5.31 pydoc +.............. + +The *note pydoc: b5. module has learned to respect the ‘MANPAGER’ +environment variable. (Contributed by Matthias Klose in bpo-8637(1).) + +*note help(): 8d6. and *note pydoc: b5. 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<5>, Prev: pydoc<3>, Up: Improved Modules<8> + +1.8.5.32 random +............... + +The new *note choices(): cc6. 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<5>, Next: readline, Prev: random<4>, Up: Improved Modules<8> + +1.8.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: cc8. objects now support *note index-like objects: 718. 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<5>, Up: Improved Modules<8> + +1.8.5.34 readline +................. + +Added *note set_auto_history(): cca. 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: Improved Modules<8> + +1.8.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: Improved Modules<8> + +1.8.5.36 shlex +.............. + +The *note shlex: ccd. has much *note improved shell compatibility: cce. +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<7>, Prev: shlex<2>, Up: Improved Modules<8> + +1.8.5.37 site +............. + +When specifying paths to add to *note sys.path: 3b0. 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<7>, Next: socket<7>, Prev: site<3>, Up: Improved Modules<8> + +1.8.5.38 sqlite3 +................ + +*note sqlite3.Cursor.lastrowid: cd1. now supports the ‘REPLACE’ +statement. (Contributed by Alex LordThorsen in bpo-16864(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16864 + + +File: python.info, Node: socket<7>, Next: socketserver<2>, Prev: sqlite3<7>, Up: Improved Modules<8> + +1.8.5.39 socket +............... + +The *note ioctl(): cd3. function now supports the *note +SIO_LOOPBACK_FAST_PATH: cd4. control code. (Contributed by Daniel +Stokes in bpo-26536(1).) + +The *note getsockopt(): cd5. constants ‘SO_DOMAIN’, ‘SO_PROTOCOL’, +‘SO_PEERSEC’, and ‘SO_PASSSEC’ are now supported. (Contributed by +Christian Heimes in bpo-26907(2).) + +The *note setsockopt(): cd6. 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: cd7. to +interface with Linux Kernel crypto API. ‘ALG_*’, ‘SOL_ALG’ and *note +sendmsg_afalg(): cd8. 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<7>, Prev: socket<7>, Up: Improved Modules<8> + +1.8.5.40 socketserver +..................... + +Servers based on the *note socketserver: cd. module, including those +defined in *note http.server: 72, *note xmlrpc.server: 12f. and *note +wsgiref.simple_server: 11b, now support the *note context manager: 5d0. +protocol. (Contributed by Aviv Palivoda in bpo-26404(1).) + +The ‘wfile’ attribute of *note StreamRequestHandler: cda. classes now +implements the *note io.BufferedIOBase: 690. writable interface. In +particular, calling *note write(): cdb. 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<7>, Next: statistics<5>, Prev: socketserver<2>, Up: Improved Modules<8> + +1.8.5.41 ssl +............ + +*note ssl: d0. 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: 296. 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: cdd. 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(): cde. 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: cdf. and +‘IntFlags’. (Contributed by Christian Heimes in bpo-28025(6).) + +Server and client-side specific TLS protocols for *note SSLContext: 296. +were added. (Contributed by Christian Heimes in bpo-28085(7).) + +Added *note ssl.SSLContext.post_handshake_auth: a30. to enable and *note +ssl.SSLSocket.verify_client_post_handshake(): a31. 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, Prev: ssl<7>, Up: Improved Modules<8> + +1.8.5.42 statistics +................... + +A new *note harmonic_mean(): ce1. 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, Next: subprocess<3>, Prev: statistics<5>, Up: Improved Modules<8> + +1.8.5.43 struct +............... + +*note struct: d5. now supports IEEE 754 half-precision floats via the +‘'e'’ format specifier. (Contributed by Eli Stevens, Mark Dickinson in +bpo-11734(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11734 + + +File: python.info, Node: subprocess<3>, Next: sys<10>, Prev: struct, Up: Improved Modules<8> + +1.8.5.44 subprocess +................... + +*note subprocess.Popen: 199. destructor now emits a *note +ResourceWarning: 246. warning if the child process is still running. +Use the context manager protocol (‘with proc: ...’) or explicitly call +the *note wait(): ce4. method to read the exit status of the child +process. (Contributed by Victor Stinner in bpo-26741(1).) + +The *note subprocess.Popen: 199. constructor and all functions that pass +arguments through to it now accept 'encoding' and 'errors' arguments. +Specifying either of these will enable text mode for the 'stdin', +'stdout' and 'stderr' streams. (Contributed by Steve Dower in +bpo-6135(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=26741 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=6135 + + +File: python.info, Node: sys<10>, Next: telnetlib, Prev: subprocess<3>, Up: Improved Modules<8> + +1.8.5.45 sys +............ + +The new *note getfilesystemencodeerrors(): ce6. 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(): ce7. +function now includes the 'platform_version' field which contains the +accurate major version, minor version and build number of the current +operating system, rather than the version that is being emulated for the +process (Contributed by Steve Dower in bpo-27932(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=27781 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=27932 + + +File: python.info, Node: telnetlib, Next: time<6>, Prev: sys<10>, Up: Improved Modules<8> + +1.8.5.46 telnetlib +.................. + +‘telnetlib.Telnet’ is now a context manager (contributed by Stéphane +Wirtel in bpo-25485(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25485 + + +File: python.info, Node: time<6>, Next: timeit, Prev: telnetlib, Up: Improved Modules<8> + +1.8.5.47 time +............. + +The *note struct_time: cea. attributes ‘tm_gmtoff’ and ‘tm_zone’ are now +available on all platforms. + + +File: python.info, Node: timeit, Next: tkinter<6>, Prev: time<6>, Up: Improved Modules<8> + +1.8.5.48 timeit +............... + +The new *note Timer.autorange(): cec. convenience method has been added +to call *note Timer.timeit(): ced. 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: ef. 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<6>, Next: traceback<4>, Prev: timeit, Up: Improved Modules<8> + +1.8.5.49 tkinter +................ + +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. (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<6>, Up: Improved Modules<8> + +1.8.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 "", line 1, in + File "", line 1, in f + File "", line 1, in f + File "", 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<9>, Prev: traceback<4>, Up: Improved Modules<8> + +1.8.5.51 tracemalloc +.................... + +The *note tracemalloc: ff. module now supports tracing memory +allocations in multiple different address spaces. + +The new *note DomainFilter: cf1. 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<9>, Next: unicodedata<7>, Prev: tracemalloc<3>, Up: Improved Modules<8> + +1.8.5.52 typing +............... + +Since the *note typing: 104. module is *note provisional: b03, all +changes introduced in Python 3.6 have also been backported to Python +3.5.x. + +The *note typing: 104. 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: c8e. class has been added for +representing *note contextlib.AbstractContextManager: c8d. (Contributed +by Brett Cannon in bpo-25609(2).) + +The *note typing.Collection: cf3. class has been added for representing +*note collections.abc.Collection: c88. (Contributed by Ivan Levkivskyi +in bpo-27598(3).) + +The *note typing.ClassVar: 268. 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: cf4. 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(): cf5. 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<7>, Next: unittest mock<2>, Prev: typing<9>, Up: Improved Modules<8> + +1.8.5.53 unicodedata +.................... + +The *note unicodedata: 105. 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<7>, Up: Improved Modules<8> + +1.8.5.54 unittest.mock +...................... + +The *note Mock: a4b. class has the following improvements: + + * Two new methods, *note Mock.assert_called(): cf8. and *note + Mock.assert_called_once(): cf9. to check if the mock object was + called. (Contributed by Amit Saha in bpo-26323(1).) + + * The *note Mock.reset_mock(): cfa. 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: Improved Modules<8> + +1.8.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, +‘AbstractHTTPHandler’ now falls back to use chunked transfer encoding. +(Contributed by Demian Brecht and Rolf Krahl in bpo-12319(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=12319 + + +File: python.info, Node: urllib robotparser, Next: venv<5>, Prev: urllib request, Up: Improved Modules<8> + +1.8.5.56 urllib.robotparser +........................... + +*note RobotFileParser: cfd. now supports the ‘Crawl-delay’ and +‘Request-rate’ extensions. (Contributed by Nikolay Bogoychev in +bpo-16099(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16099 + + +File: python.info, Node: venv<5>, Next: warnings<4>, Prev: urllib robotparser, Up: Improved Modules<8> + +1.8.5.57 venv +............. + +*note venv: 111. accepts a new parameter ‘--prompt’. This parameter +provides an alternative prefix for the virtual environment. (Proposed +by Łukasz Balcerzak and ported to 3.6 by Stéphane Wirtel in +bpo-22829(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22829 + + +File: python.info, Node: warnings<4>, Next: winreg, Prev: venv<5>, Up: Improved Modules<8> + +1.8.5.58 warnings +................. + +A new optional 'source' parameter has been added to the *note +warnings.warn_explicit(): d00. function: the destroyed object which +emitted a *note ResourceWarning: 246. 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: 246. warning is logged, the *note +tracemalloc: ff. module is now used to try to retrieve the traceback +where the destroyed object was allocated. + +Example with the script ‘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: ff. is tracing Python memory allocations and if the +*note warnings: 112. module was already imported. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=26568 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=26567 + + +File: python.info, Node: winreg, Next: winsound, Prev: warnings<4>, Up: Improved Modules<8> + +1.8.5.59 winreg +............... + +Added the 64-bit integer type *note REG_QWORD: d02. (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: Improved Modules<8> + +1.8.5.60 winsound +................. + +Allowed keyword arguments to be passed to *note Beep: d04, *note +MessageBeep: d05, and *note PlaySound: d06. (bpo-27982(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=27982 + + +File: python.info, Node: xmlrpc client, Next: zipfile<3>, Prev: winsound, Up: Improved Modules<8> + +1.8.5.61 xmlrpc.client +...................... + +The *note xmlrpc.client: 12e. 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<3>, Next: zlib, Prev: xmlrpc client, Up: Improved Modules<8> + +1.8.5.62 zipfile +................ + +A new *note ZipInfo.from_file(): d09. class method allows making a *note +ZipInfo: d0a. instance from a filesystem file. A new *note +ZipInfo.is_dir(): d0b. method can be used to check if the *note ZipInfo: +d0a. instance represents a directory. (Contributed by Thomas Kluyver in +bpo-26039(1).) + +The *note ZipFile.open(): 417. 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, Prev: zipfile<3>, Up: Improved Modules<8> + +1.8.5.63 zlib +............. + +The *note compress(): 63b. and *note decompress(): d0d. 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: Optimizations<8>, Next: Build and C API Changes<2>, Prev: Improved Modules<8>, Up: What’s New In Python 3 6 + +1.8.6 Optimizations +------------------- + + * 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: bcd. class now has an optimized C + implementation. (Contributed by Yury Selivanov and INADA Naoki in + bpo-26081(3).) + + * The *note asyncio.Task: 1be. class now has an optimized C + implementation. (Contributed by Yury Selivanov in bpo-28544(4).) + + * Various implementation improvements in the *note typing: 104. + 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(): aef. and *note bytearray.fromhex(): + af0.: 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(): c66. domain (*note + PYMEM_DOMAIN_MEM: c69.) now use the *note pymalloc memory + allocator: d0f. 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(): d10. and *note pickle.loads(): d11. are now up + to 10% faster when deserializing many small objects (Contributed by + Victor Stinner in bpo-27056(14)). + + * Passing *note keyword arguments: d12. to a function has an overhead + in comparison with passing *note positional arguments: d13. 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(): 2a1. and *note iglob(): 803. functions in + the *note glob: 64. module; they are now about 3–6 times faster. + (Contributed by Serhiy Storchaka in bpo-25596(16)). + + * Optimized globbing in *note pathlib: a4. by using *note + os.scandir(): a5e.; it is now about 1.5–4 times faster. + (Contributed by Serhiy Storchaka in bpo-26032(17)). + + * *note xml.etree.ElementTree: 125. 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: 1e9. 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: Build and C API Changes<2>, Next: Other Improvements, Prev: Optimizations<8>, Up: What’s New In Python 3 6 + +1.8.7 Build and C API Changes +----------------------------- + + * 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: 148. must now be held when allocator functions of + *note PYMEM_DOMAIN_OBJ: c67. (ex: *note PyObject_Malloc(): c68.) + and *note PYMEM_DOMAIN_MEM: c69. (ex: *note PyMem_Malloc(): c66.) + domains are called. + + * New *note Py_FinalizeEx(): d15. API which indicates if flushing + buffered data failed. (Contributed by Martin Panter in + bpo-5319(5).) + + * *note PyArg_ParseTupleAndKeywords(): 37e. now supports *note + positional-only parameters: a85. 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(): d16. function allows + for specifying a subclass of *note ImportError: 415. to raise. + (Contributed by Eric Snow in bpo-15767(8).) + + * The new *note PyErr_ResourceWarning(): d17. function can be used to + generate a *note ResourceWarning: 246. providing the source of the + resource allocation. (Contributed by Victor Stinner in + bpo-26567(9).) + + * The new *note PyOS_FSPath(): d18. function returns the file system + representation of a *note path-like object: 2a2. (Contributed by + Brett Cannon in bpo-27186(10).) + + * The *note PyUnicode_FSConverter(): d19. and *note + PyUnicode_FSDecoder(): 574. functions will now accept *note + path-like objects: 2a2. + + ---------- 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: Other Improvements, Next: Deprecated<9>, Prev: Build and C API Changes<2>, Up: What’s New In Python 3 6 + +1.8.8 Other Improvements +------------------------ + + * When *note -version: d1b. (short form: *note -V: 177.) is supplied + twice, Python prints *note sys.version: 178. for detailed + information. + + $ ./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: Deprecated<9>, Next: Removed<9>, Prev: Other Improvements, Up: What’s New In Python 3 6 + +1.8.9 Deprecated +---------------- + +* Menu: + +* New Keywords:: +* Deprecated Python behavior:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<2>. +* xml: xml<6>. +* Deprecated functions and types of the C API: Deprecated functions and types of the C API<2>. +* Deprecated Build Options:: + + +File: python.info, Node: New Keywords, Next: Deprecated Python behavior, Up: Deprecated<9> + +1.8.9.1 New Keywords +.................... + +‘async’ and ‘await’ are not recommended to be used as variable, class, +function or module names. Introduced by PEP 492(1) in Python 3.5, they +will become proper keywords in Python 3.7. Starting in Python 3.6, the +use of ‘async’ or ‘await’ as names will generate a *note +DeprecationWarning: 1a5. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0492/ + + +File: python.info, Node: Deprecated Python behavior, Next: Deprecated Python modules functions and methods<2>, Prev: New Keywords, Up: Deprecated<9> + +1.8.9.2 Deprecated Python behavior +.................................. + +Raising the *note StopIteration: bfa. exception inside a generator will +now generate a *note DeprecationWarning: 1a5, and will trigger a *note +RuntimeError: 195. in Python 3.7. See *note PEP 479; Change +StopIteration handling inside generators: d1f. for details. + +The ‘__aiter__()’ 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: 1a5. 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: 1a5. Although this will +eventually become a *note SyntaxError: 18d, 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: 4f6. (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: Deprecated Python modules functions and methods<2>, Next: xml<6>, Prev: Deprecated Python behavior, Up: Deprecated<9> + +1.8.9.3 Deprecated Python modules, functions and methods +........................................................ + +* Menu: + +* asynchat:: +* asyncore:: +* dbm: dbm<4>. +* distutils: distutils<6>. +* grp:: +* importlib: importlib<7>. +* os: os<9>. +* re: re<6>. +* ssl: ssl<8>. +* tkinter: tkinter<7>. +* venv: venv<6>. + + +File: python.info, Node: asynchat, Next: asyncore, Up: Deprecated Python modules functions and methods<2> + +1.8.9.4 asynchat +................ + +The ‘asynchat’ has been deprecated in favor of *note asyncio: a. +(Contributed by Mariatta in bpo-25002(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25002 + + +File: python.info, Node: asyncore, Next: dbm<4>, Prev: asynchat, Up: Deprecated Python modules functions and methods<2> + +1.8.9.5 asyncore +................ + +The ‘asyncore’ has been deprecated in favor of *note asyncio: a. +(Contributed by Mariatta in bpo-25002(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25002 + + +File: python.info, Node: dbm<4>, Next: distutils<6>, Prev: asyncore, Up: Deprecated Python modules functions and methods<2> + +1.8.9.6 dbm +........... + +Unlike other *note dbm: 31. implementations, the *note dbm.dumb: 32. +module creates databases with the ‘'rw'’ mode and allows modifying the +database opened with the ‘'r'’ mode. This behavior is now deprecated +and will be removed in 3.8. (Contributed by Serhiy Storchaka in +bpo-21708(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=21708 + + +File: python.info, Node: distutils<6>, Next: grp, Prev: dbm<4>, Up: Deprecated Python modules functions and methods<2> + +1.8.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: Deprecated Python modules functions and methods<2> + +1.8.9.8 grp +........... + +The support of non-integer arguments in *note getgrgid(): d26. has been +deprecated. (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<9>, Prev: grp, Up: Deprecated Python modules functions and methods<2> + +1.8.9.9 importlib +................. + +The *note importlib.machinery.SourceFileLoader.load_module(): d28. and +*note importlib.machinery.SourcelessFileLoader.load_module(): d29. +methods are now deprecated. They were the only remaining +implementations of *note importlib.abc.Loader.load_module(): 866. in +*note importlib: 77. that had not been deprecated in previous versions +of Python in favour of *note importlib.abc.Loader.exec_module(): 867. + +The *note importlib.machinery.WindowsRegistryFinder: d2a. class is now +deprecated. As of 3.6.0, it is still added to *note sys.meta_path: d2b. +by default (on Windows), but this may change in future releases. + + +File: python.info, Node: os<9>, Next: re<6>, Prev: importlib<7>, Up: Deprecated Python modules functions and methods<2> + +1.8.9.10 os +........... + +Undocumented support of general *note bytes-like objects: d2d. as paths +in *note os: a1. functions, *note compile(): 192. 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<6>, Next: ssl<8>, Prev: os<9>, Up: Deprecated Python modules functions and methods<2> + +1.8.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<8>, Next: tkinter<7>, Prev: re<6>, Up: Deprecated Python modules functions and methods<2> + +1.8.9.12 ssl +............ + +OpenSSL 0.9.8, 1.0.0 and 1.0.1 are deprecated and no longer supported. +In the future the *note ssl: d0. module will require at least OpenSSL +1.0.2 or 1.1.0. + +SSL-related arguments like ‘certfile’, ‘keyfile’ and ‘check_hostname’ in +*note ftplib: 5e, *note http.client: 6f, *note imaplib: 74, *note +poplib: ac, and *note smtplib: ca. 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: d0. 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<7>, Next: venv<6>, Prev: ssl<8>, Up: Deprecated Python modules functions and methods<2> + +1.8.9.13 tkinter +................ + +The ‘tkinter.tix’ module is now deprecated. *note tkinter: f0. users +should use *note tkinter.ttk: f9. instead. + + +File: python.info, Node: venv<6>, Prev: tkinter<7>, Up: Deprecated Python modules functions and methods<2> + +1.8.9.14 venv +............. + +The ‘pyvenv’ script has been deprecated in favour of ‘python3 -m venv’. +This prevents confusion as to what Python interpreter ‘pyvenv’ is +connected to and thus what Python interpreter will be used by the +virtual environment. (Contributed by Brett Cannon in bpo-25154(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=25154 + + +File: python.info, Node: xml<6>, Next: Deprecated functions and types of the C API<2>, Prev: Deprecated Python modules functions and methods<2>, Up: Deprecated<9> + +1.8.9.15 xml +............ + + * As mitigation against DTD and external entity retrieval, the *note + xml.dom.minidom: 122. and *note xml.sax: 129. 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: Deprecated functions and types of the C API<2>, Next: Deprecated Build Options, Prev: xml<6>, Up: Deprecated<9> + +1.8.9.16 Deprecated functions and types of the C API +.................................................... + +Undocumented functions ‘PyUnicode_AsEncodedObject()’, +‘PyUnicode_AsDecodedObject()’, ‘PyUnicode_AsEncodedUnicode()’ and +‘PyUnicode_AsDecodedUnicode()’ are deprecated now. Use the *note +generic codec based API: d35. instead. + + +File: python.info, Node: Deprecated Build Options, Prev: Deprecated functions and types of the C API<2>, Up: Deprecated<9> + +1.8.9.17 Deprecated Build Options +................................. + +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: Removed<9>, Next: Porting to Python 3 6, Prev: Deprecated<9>, Up: What’s New In Python 3 6 + +1.8.10 Removed +-------------- + +* Menu: + +* API and Feature Removals: API and Feature Removals<3>. + + +File: python.info, Node: API and Feature Removals<3>, Up: Removed<9> + +1.8.10.1 API and Feature Removals +................................. + + * Unknown escapes consisting of ‘'\'’ and an ASCII letter in regular + expressions will now cause an error. In replacement templates for + *note re.sub(): 2a5. they are still allowed, but deprecated. The + *note re.LOCALE: b6c. flag can now only be used with binary + patterns. + + * ‘inspect.getmoduleinfo()’ was removed (was deprecated since CPython + 3.3). *note inspect.getmodulename(): d39. 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: fe. 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: f0. widget classes were removed (corresponding Tk + commands were obsolete since Tk 4.0). + + * The *note open(): 417. method of the *note zipfile.ZipFile: 6c0. + class no longer supports the ‘'U'’ mode (was deprecated since + Python 3.4). Use *note io.TextIOWrapper: 7b6. for reading + compressed text files in *note universal newlines: d3a. 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). + + * The deprecated ‘asynchat.fifo’ class has been removed. + + ---------- 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: Porting to Python 3 6, Next: Notable changes in Python 3 6 2, Prev: Removed<9>, Up: What’s New In Python 3 6 + +1.8.11 Porting to Python 3.6 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in ‘python’ Command Behavior:: +* Changes in the Python API: Changes in the Python API<8>. +* Changes in the C API: Changes in the C API<6>. +* CPython bytecode changes: CPython bytecode changes<7>. + + +File: python.info, Node: Changes in ‘python’ Command Behavior, Next: Changes in the Python API<8>, Up: Porting to Python 3 6 + +1.8.11.1 Changes in ‘python’ Command Behavior +............................................. + + * 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: Changes in the Python API<8>, Next: Changes in the C API<6>, Prev: Changes in ‘python’ Command Behavior, Up: Porting to Python 3 6 + +1.8.11.2 Changes in the Python API +.................................. + + * *note open(): 517. will no longer allow combining the ‘'U'’ mode + flag with ‘'+'’. (Contributed by Jeff Balogh and John O’Connor in + bpo-2091(1).) + + * *note sqlite3: cf. no longer implicitly commits an open transaction + before DDL statements. + + * On Linux, *note os.urandom(): 51e. now blocks until the system + urandom entropy pool is initialized to increase the security. + + * When *note importlib.abc.Loader.exec_module(): 867. is defined, + *note importlib.abc.Loader.create_module(): cae. must also be + defined. + + * *note PyErr_SetImportError(): d3e. now sets *note TypeError: 534. + when its 'msg' argument is not set. Previously only ‘NULL’ was + returned. + + * The format of the *note co_lnotab: 2e4. 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: 7a7, + ‘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: 20. 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(): d3f. + and *note urlparse(): 307. results now raises *note ValueError: + 204. for out-of-range values, rather than returning *note None: + 671. See bpo-20059(4). + + * The ‘imp’ module now raises a *note DeprecationWarning: 1a5. + instead of *note PendingDeprecationWarning: 8c7. + + * The following modules have had missing APIs added to their + ‘__all__’ attributes to match the documented APIs: *note calendar: + 14, ‘cgi’, *note csv: 29, *note ElementTree: 125, *note enum: 56, + *note fileinput: 5b, *note ftplib: 5e, *note logging: 87, *note + mailbox: 8b, *note mimetypes: 8f, *note optparse: a0, *note + plistlib: ab, ‘smtpd’, *note subprocess: d6, *note tarfile: de, + *note threading: ed. and *note wave: 113. 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: 4f6. + 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: 415. will be raised. Previously, *note + SystemError: 572. could be raised. (Contributed by Brett Cannon in + bpo-18018(7).) + + * Servers based on the *note socketserver: cd. module, including + those defined in *note http.server: 72, *note xmlrpc.server: 12f. + and *note wsgiref.simple_server: 11b, now only catch exceptions + derived from *note Exception: 9d9. Therefore if a request handler + raises an exception like *note SystemExit: d40. or *note + KeyboardInterrupt: 9d1, *note handle_error(): d41. 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: d42. instead + of *note KeyError: 33f. if the user doesn’t have privileges. + + * The *note socket.socket.close(): d43. 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(): d44, *note dumps(): + d45, *note load(): cb4. and *note loads(): 955. functions and *note + JSONEncoder: d46. and *note JSONDecoder: d47. class constructors in + the *note json: 82. module are now *note keyword-only: 2a7. + (Contributed by Serhiy Storchaka in bpo-18726(10).) + + * Subclasses of *note type: d48. which don’t override ‘type.__new__’ + may no longer use the one-argument form to get the type of an + object. + + * As part of PEP 487(11), the handling of keyword arguments passed to + *note type: d48. (other than the metaclass hint, ‘metaclass’) is + now consistently delegated to *note object.__init_subclass__(): + 62d. This means that ‘type.__new__()’ and ‘type.__init__()’ both + now accept arbitrary keyword arguments, but *note + object.__init_subclass__(): 62d. (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: 4d7.) + 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 + + This behavior has also been backported to earlier Python versions + by Setuptools 26.0.0. + + * In the *note urllib.request: 10b. module and the *note + http.client.HTTPConnection.request(): ca9. 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: 9e4. now returns rows of type *note + OrderedDict: 5d7. (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(): 1ca. + are now keyword-only. (Contributed by Raymond Hettinger in + bpo-25628(15).) + + * On Linux, *note ctypes.util.find_library(): d49. now looks in + ‘LD_LIBRARY_PATH’ for shared libraries. (Contributed by Vinay + Sajip in bpo-9998(16).) + + * The *note imaplib.IMAP4: 902. 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 ‘mmap.write()’ 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(): d4a. and *note + pkgutil.walk_packages(): bff. functions now return *note + ModuleInfo: d4b. named tuples. (Contributed by Ramchandra Apte in + bpo-17211(19).) + + * *note re.sub(): 2a5. 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: 6c0. will now raise *note + NotImplementedError: 22a. for unrecognized compression values. + Previously a plain *note RuntimeError: 195. was raised. + Additionally, calling *note ZipFile: 6c0. methods on a closed + ZipFile or calling the *note write(): d4c. method on a ZipFile + created with mode ‘'r'’ will raise a *note ValueError: 204. + Previously, a *note RuntimeError: 195. was raised in those + scenarios. + + * when custom metaclasses are combined with zero-argument *note + super(): 4d7. 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: 1a5. in Python 3.6 and a *note RuntimeError: + 195. in Python 3.8. + + * With the introduction of *note ModuleNotFoundError: b47, import + system consumers may start expecting import system replacements to + raise that more specific exception when appropriate, rather than + the less-specific *note ImportError: 415. To provide future + compatibility with such consumers, implementers of alternative + import systems that completely replace *note __import__(): 8d3. + 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: Changes in the C API<6>, Next: CPython bytecode changes<7>, Prev: Changes in the Python API<8>, Up: Porting to Python 3 6 + +1.8.11.3 Changes in the C API +............................. + + * The *note PyMem_Malloc(): c66. allocator family now uses the *note + pymalloc allocator: d0f. rather than the system ‘malloc()’. + Applications calling *note PyMem_Malloc(): c66. without holding the + GIL can now crash. Set the *note PYTHONMALLOC: c64. environment + variable to ‘debug’ to validate the usage of memory allocators in + your application. See bpo-26249(1). + + * *note Py_Exit(): d4e. (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 bytecode changes<7>, Prev: Changes in the C API<6>, Up: Porting to Python 3 6 + +1.8.11.4 CPython bytecode changes +................................. + +There have been several major changes to the *note bytecode: 187. 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: d50. opcodes as part + of the *note formatted string literal: c2f. implementation. + (Contributed by Eric Smith in bpo-25483(3) and Serhiy Storchaka in + bpo-27078(4).) + + * The new *note BUILD_CONST_KEY_MAP: d51. 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: + d52, ‘CALL_FUNCTION’, ‘CALL_FUNCTION_KW’ and + ‘BUILD_MAP_UNPACK_WITH_CALL’ opcodes have been modified, the new + *note CALL_FUNCTION_EX: d53. 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: d54. and ‘STORE_ANNOTATION’ + opcodes have been added to support the new *note variable + annotation: d55. 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: Porting to Python 3 6, Up: What’s New In Python 3 6 + +1.8.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.8.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. + +(Contributed by Victor Stinner in bpo-23404(2).) + +Added in version 3.6.2. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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.8.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. + +(Contributed by Victor Stinner in bpo-23404(1).) + +Changed in version 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.8.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.8.14 Notable changes in Python 3.6.5 +-------------------------------------- + +The *note locale.localeconv(): bfe. 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.8.15 Notable changes in Python 3.6.7 +-------------------------------------- + +*note xml.dom.minidom: 122. and *note xml.sax: 129. modules no longer +process external entities by default. See also gh-61441(1). + +In 3.6.7 the *note tokenize: fb. 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.8.16 Notable changes in Python 3.6.10 +--------------------------------------- + +Due to significant security concerns, the 'reuse_address' parameter of +*note asyncio.loop.create_datagram_endpoint(): 72e. is no longer +supported. This is because of the behavior of the socket option +‘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(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.8.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(): 27c. and *note +urllib.parse.parse_qsl(): 27b. 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.8.18 Notable changes in Python 3.6.14 +--------------------------------------- + +A security fix alters the *note ftplib.FTP: 8f9. 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(): 10a. 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.9 What’s New In Python 3.5 +============================ + + +Editors: Elvis Pranskevichus <>, Yury Selivanov +<> + +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. + +See also +........ + +PEP 478(2) - Python 3.5 Release Schedule + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<7>. +* New Features: New Features<14>. +* Other Language Changes: Other Language Changes<9>. +* New Modules: New Modules<9>. +* Improved Modules: Improved Modules<9>. +* Other module-level changes:: +* Optimizations: Optimizations<9>. +* Build and C API Changes: Build and C API Changes<3>. +* Deprecated: Deprecated<10>. +* Removed: Removed<10>. +* Porting to Python 3.5: Porting to 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: Summary – Release highlights<7>, Next: New Features<14>, Up: What’s New In Python 3 5 + +1.9.1 Summary – Release highlights +---------------------------------- + +New syntax features: + + * *note PEP 492: d62, coroutines with async and await syntax. + + * *note PEP 465: d63, a new matrix multiplication operator: ‘a @ b’. + + * *note PEP 448: d64, additional unpacking generalizations. + +New library modules: + + * *note typing: 104.: *note PEP 484 – Type Hints: d65. + + * *note zipapp: 130.: *note PEP 441 Improving Python ZIP Application + Support: d66. + +New built-in features: + + * ‘bytes % args’, ‘bytearray % args’: *note PEP 461: d67. – Adding + ‘%’ formatting to bytes and bytearray. + + * New *note bytes.hex(): d68, *note bytearray.hex(): d69. and *note + memoryview.hex(): d6a. methods. (Contributed by Arnon Yaari in + bpo-9951(1).) + + * *note memoryview: 464. now supports tuple indexing (including + multi-dimensional). (Contributed by Antoine Pitrou in + bpo-23632(2).) + + * Generators have a new ‘gi_yieldfrom’ attribute, which returns the + object being iterated by ‘yield from’ expressions. (Contributed by + Benno Leslie and Yury Selivanov in bpo-24450(3).) + + * A new *note RecursionError: d6b. exception is now raised when + maximum recursion depth is reached. (Contributed by Georg Brandl + in bpo-19235(4).) + +CPython implementation improvements: + + * When the ‘LC_TYPE’ locale is the POSIX locale (‘C’ locale), *note + sys.stdin: 539. and *note sys.stdout: ad6. now use the + ‘surrogateescape’ error handler, instead of the ‘strict’ error + handler. (Contributed by Victor Stinner in bpo-19977(5).) + + * ‘.pyo’ files are no longer used and have been replaced by a more + flexible scheme that includes the optimization level explicitly in + ‘.pyc’ name. (See *note PEP 488 overview: d6c.) + + * Builtin and extension modules are now initialized in a multi-phase + process, which is similar to how Python modules are loaded. (See + *note PEP 489 overview: d6d.) + +Significant improvements in the standard library: + + * *note collections.OrderedDict: 5d7. is now *note implemented in C: + d6e, which makes it 4 to 100 times faster. + + * The *note ssl: d0. module gained *note support for Memory BIO: d6f, + which decouples SSL protocol handling from network IO. + + * The new *note os.scandir(): a5e. function provides a *note better + and significantly faster way: d70. of directory traversal. + + * *note functools.lru_cache(): 9ee. has been mostly *note + reimplemented in C: d71, yielding much better performance. + + * The new *note subprocess.run(): b86. function provides a *note + streamlined way to run subprocesses: d72. + + * The *note traceback: fe. module has been significantly *note + enhanced: d73. for improved performance and developer convenience. + +Security improvements: + + * SSLv3 is now disabled throughout the standard library. It can + still be enabled by instantiating a *note ssl.SSLContext: 296. + manually. (See bpo-22638(6) for more details; this change was + backported to CPython 3.4 and 2.7.) + + * HTTP cookie parsing is now stricter, in order to protect against + potential injection attacks. (Contributed by Antoine Pitrou in + bpo-22796(7).) + +Windows improvements: + + * A new installer for Windows has replaced the old MSI. See *note + Using Python on Windows: aa7. for more information. + + * Windows builds now use Microsoft Visual C++ 14.0, and extension + modules should use the same. + +Please read on for a comprehensive list of user-facing changes, +including many other smaller improvements, CPython optimizations, +deprecations, and potential porting issues. + + ---------- 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: New Features<14>, Next: Other Language Changes<9>, Prev: Summary – Release highlights<7>, Up: What’s New In Python 3 5 + +1.9.2 New Features +------------------ + +* Menu: + +* PEP 492 - Coroutines with async and await syntax:: +* PEP 465 - A dedicated infix operator for matrix multiplication:: +* PEP 448 - Additional Unpacking Generalizations:: +* PEP 461 - percent formatting support for bytes and bytearray:: +* PEP 484 - Type Hints:: +* PEP 471 - os.scandir() function – a better and faster directory iterator: PEP 471 - os scandir function – a better and faster directory iterator. +* PEP 475; Retry system calls failing with EINTR: PEP 475 Retry system calls failing with EINTR. +* PEP 479; Change StopIteration handling inside generators: PEP 479 Change StopIteration handling inside generators. +* PEP 485; A function for testing approximate equality: PEP 485 A function for testing approximate equality. +* PEP 486; Make the Python Launcher aware of virtual environments: PEP 486 Make the Python Launcher aware of virtual environments. +* PEP 488; Elimination of PYO files: PEP 488 Elimination of PYO files. +* PEP 489; Multi-phase extension module initialization: PEP 489 Multi-phase extension module initialization. + + +File: python.info, Node: PEP 492 - Coroutines with async and await syntax, Next: PEP 465 - A dedicated infix operator for matrix multiplication, Up: New Features<14> + +1.9.2.1 PEP 492 - Coroutines with async and await syntax +........................................................ + +PEP 492(1) greatly improves support for asynchronous programming in +Python by adding *note awaitable objects: 1ad, *note coroutine +functions: d76, *note asynchronous iteration: d77, and *note +asynchronous context managers: 5d3. + +Coroutine functions are declared using the new *note async def: 5cd. +syntax: + + >>> async def coro(): + ... return 'spam' + +Inside a coroutine function, the new *note await: 1b9. 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: +1ad. protocol by defining the ‘__await__()’ method. + +PEP 492 also adds *note async for: aab. statement for convenient +iteration over asynchronous iterables. + +An example of a rudimentary HTTP client written using the new syntax: + + 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() + +Similarly to asynchronous iteration, there is a new syntax for +asynchronous context managers. The following script: + + 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() + +will output: + + 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 that both *note async for: aab. and *note async with: 5d1. can only +be used inside a coroutine function declared with *note async def: 5cd. + +Coroutine functions are intended to be run inside a compatible event +loop, such as the *note asyncio loop: d78. + + Note: + Changed in version 3.5.2: Starting with CPython 3.5.2, ‘__aiter__’ + can directly return *note asynchronous iterators: 1ab. Returning + an *note awaitable: 1ad. object will result in a *note + PendingDeprecationWarning: 8c7. + + See more details in the *note Asynchronous Iterators: d79. + documentation section. + +See also +........ + +PEP 492(2) – Coroutines with async and await syntax + + 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 - A dedicated infix operator for matrix multiplication, Next: PEP 448 - Additional Unpacking Generalizations, Prev: PEP 492 - Coroutines with async and await syntax, Up: New Features<14> + +1.9.2.2 PEP 465 - A dedicated infix operator for matrix multiplication +...................................................................... + +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 ‘__matmul__()’, ‘__rmatmul__()’, and +‘__imatmul__()’ for regular, reflected, and in-place matrix +multiplication. The semantics of these methods is similar to that of +methods defining other infix arithmetic operators. + +Matrix multiplication is a notably common operation in many fields of +mathematics, science, engineering, and the addition of ‘@’ allows +writing cleaner code: + + S = (H @ beta - r).T @ inv(H @ V @ H.T) @ (H @ beta - r) + +instead of: + + S = dot((dot(H, beta) - r).T, + dot(inv(dot(dot(H, V), H.T)), dot(H, beta) - r)) + +NumPy 1.10 has support for the new operator: + + >>> 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.]) + +See also +........ + +PEP 465(2) – A dedicated infix operator for matrix multiplication + + 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 - Additional Unpacking Generalizations, Next: PEP 461 - percent formatting support for bytes and bytearray, Prev: PEP 465 - A dedicated infix operator for matrix multiplication, Up: New Features<14> + +1.9.2.3 PEP 448 - Additional Unpacking Generalizations +...................................................... + +PEP 448(1) extends the allowed uses of the ‘*’ iterable unpacking +operator and ‘**’ dictionary unpacking operator. It is now possible to +use an arbitrary number of unpackings in *note function calls: d7c.: + + >>> 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 + +Similarly, tuple, list, set, and dictionary displays allow multiple +unpackings (see *note Expression lists: d7d. and *note Dictionary +displays: d7e.): + + >>> *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} + +See also +........ + +PEP 448(2) – Additional Unpacking Generalizations + + 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 - percent formatting support for bytes and bytearray, Next: PEP 484 - Type Hints, Prev: PEP 448 - Additional Unpacking Generalizations, Up: New Features<14> + +1.9.2.4 PEP 461 - percent formatting support for bytes and bytearray +.................................................................... + +PEP 461(1) adds support for the ‘%’ *note interpolation operator: d80. +to *note bytes: 1c2. and *note bytearray: 53a. + +While interpolation is usually thought of as a string operation, there +are cases where interpolation on ‘bytes’ or ‘bytearrays’ makes sense, +and the work needed to make up for this missing functionality detracts +from the overall readability of the code. This issue is particularly +important when dealing with wire format protocols, which are often a +mixture of binary and ASCII compatible text. + +Examples: + + >>> b'Hello %b!' % b'World' + b'Hello World!' + + >>> b'x=%i y=%f' % (1, 2.5) + b'x=1 y=2.500000' + +Unicode is not allowed for ‘%b’, but it is accepted by ‘%a’ (equivalent +of ‘repr(obj).encode('ascii', 'backslashreplace')’): + + >>> b'Hello %b!' % 'World' + Traceback (most recent call last): + File "", line 1, in + TypeError: %b requires bytes, or an object that implements __bytes__, not 'str' + + >>> b'price: %a' % '10€' + b"price: '10\\u20ac'" + +Note that ‘%s’ and ‘%r’ conversion types, although supported, should +only be used in codebases that need compatibility with Python 2. + +See also +........ + +PEP 461(2) – Adding % formatting to bytes and 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 - Type Hints, Next: PEP 471 - os scandir function – a better and faster directory iterator, Prev: PEP 461 - percent formatting support for bytes and bytearray, Up: New Features<14> + +1.9.2.5 PEP 484 - Type Hints +............................ + +Function annotation syntax has been a Python feature since version 3.0 ( +PEP 3107(1)), however the semantics of annotations has been left +undefined. + +Experience has shown that the majority of function annotation uses were +to provide type hints to function parameters and return values. It +became evident that it would be beneficial for Python users, if the +standard library included the base definitions and tools for type +annotations. + +PEP 484(2) introduces a *note provisional module: b03. to provide these +standard definitions and tools, along with some conventions for +situations where annotations are not available. + +For example, here is a simple function whose argument and return type +are declared in the annotations: + + def greeting(name: str) -> str: + return 'Hello ' + name + +While these annotations are available at runtime through the usual +‘__annotations__’ 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. + +The type system supports unions, generic types, and a special type named +*note Any: 6a8. which is consistent with (i.e. assignable to and from) +all types. + +See also +........ + + * *note typing: 104. module documentation + + * + PEP 484(4) – Type Hints + + PEP written by Guido van Rossum, Jukka Lehtosalo, and Łukasz + Langa; implemented by Guido van Rossum. + + * + PEP 483(5) – The Theory of Type Hints + + 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 function – a better and faster directory iterator, Next: PEP 475 Retry system calls failing with EINTR, Prev: PEP 484 - Type Hints, Up: New Features<14> + +1.9.2.6 PEP 471 - os.scandir() function – a better and faster directory iterator +................................................................................ + +PEP 471(1) adds a new directory iteration function, *note os.scandir(): +a5e, to the standard library. Additionally, *note os.walk(): 4a5. is +now implemented using ‘scandir’, which makes it 3 to 5 times faster on +POSIX systems and 7 to 20 times faster on Windows systems. This is +largely achieved by greatly reducing the number of calls to *note +os.stat(): 49c. required to walk a directory tree. + +Additionally, ‘scandir’ returns an iterator, as opposed to returning a +list of file names, which improves memory efficiency when iterating over +very large directories. + +The following example shows a simple use of *note os.scandir(): a5e. to +display all the files (excluding directories) in the given 'path' that +don’t start with ‘'.'’. The *note entry.is_file(): d83. call will +generally not make an additional system call: + + for entry in os.scandir(path): + if not entry.name.startswith('.') and entry.is_file(): + print(entry.name) + +See also +........ + +PEP 471(2) – os.scandir() function – a better and faster directory iterator + + PEP written and implemented by Ben Hoyt with the help of Victor + Stinner. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0471/ + + (2) https://peps.python.org/pep-0471/ + + +File: python.info, Node: PEP 475 Retry system calls failing with EINTR, Next: PEP 479 Change StopIteration handling inside generators, Prev: PEP 471 - os scandir function – a better and faster directory iterator, Up: New Features<14> + +1.9.2.7 PEP 475: Retry system calls failing with EINTR +...................................................... + +An *note errno.EINTR: d86. 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: d87. in such cases. This +meant that, when writing a Python application, the developer had two +choices: + + 1. Ignore the ‘InterruptedError’. + + 2. Handle the ‘InterruptedError’ and attempt to restart the + interrupted system call at every call site. + +The first option makes an application fail intermittently. The second +option adds a large amount of boilerplate that makes the code nearly +unreadable. Compare: + + print("Hello World") + +and: + + while True: + try: + print("Hello World") + break + except InterruptedError: + continue + +PEP 475(1) implements automatic retry of system calls on ‘EINTR’. This +removes the burden of dealing with ‘EINTR’ or *note InterruptedError: +d87. in user code in most situations and makes Python programs, +including the standard library, more robust. Note that the system call +is only retried if the signal handler does not raise an exception. + +Below is a list of functions which are now retried when interrupted by a +signal: + + * *note open(): 517. and *note io.open(): 518.; + + * functions of the *note faulthandler: 58. module; + + * *note os: a1. functions: *note fchdir(): d88, *note fchmod(): 21e, + *note fchown(): d89, *note fdatasync(): d8a, *note fstat(): d8b, + *note fstatvfs(): d8c, *note fsync(): d8d, *note ftruncate(): d8e, + *note mkfifo(): d8f, *note mknod(): d90, *note open(): d91, *note + posix_fadvise(): d92, *note posix_fallocate(): d93, *note pread(): + b5f, *note pwrite(): b62, *note read(): d94, *note readv(): b5e, + *note sendfile(): b0f, *note wait3(): d95, *note wait4(): d96, + *note wait(): d97, *note waitid(): d98, *note waitpid(): d99, *note + write(): d9a, *note writev(): b61.; + + * special cases: *note os.close(): b74. and *note os.dup2(): b63. now + ignore *note EINTR: d86. errors; the syscall is not retried (see + the PEP for the rationale); + + * *note select: c1. functions: *note devpoll.poll(): d9b, *note + epoll.poll(): d9c, *note kqueue.control(): d9d, *note poll.poll(): + d9e, *note select(): d9f.; + + * methods of the *note socket: da0. class: *note accept(): da1, *note + connect(): da2. (except for non-blocking sockets), *note recv(): + da3, *note recvfrom(): da4, *note recvmsg(): da5, *note send(): + da6, *note sendall(): da7, *note sendmsg(): 472, *note sendto(): + da8.; + + * *note signal.sigtimedwait(): da9. and *note signal.sigwaitinfo(): + daa.; + + * *note time.sleep(): 699. + +See also +........ + +PEP 475(2) – Retry system calls failing with EINTR + + PEP and implementation written by Charles-François Natali and + Victor Stinner, with the help of Antoine Pitrou (the French + connection). + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0475/ + + (2) https://peps.python.org/pep-0475/ + + +File: python.info, Node: PEP 479 Change StopIteration handling inside generators, Next: PEP 485 A function for testing approximate equality, Prev: PEP 475 Retry system calls failing with EINTR, Up: New Features<14> + +1.9.2.8 PEP 479: Change StopIteration handling inside generators +................................................................ + +The interaction of generators and *note StopIteration: bfa. in Python +3.4 and earlier was sometimes surprising, and could conceal obscure +bugs. Previously, ‘StopIteration’ raised accidentally inside a +generator function was interpreted as the end of the iteration by the +loop construct driving the generator. + +PEP 479(1) changes the behavior of generators: when a ‘StopIteration’ +exception is raised inside a generator, it is replaced with a *note +RuntimeError: 195. before it exits the generator frame. The main goal +of this change is to ease debugging in the situation where an unguarded +*note next(): 7d3. call raises ‘StopIteration’ and causes the iteration +controlled by the generator to terminate silently. This is particularly +pernicious in combination with the ‘yield from’ construct. + +This is a backwards incompatible change, so to enable the new behavior, +a *note __future__: dac. import is necessary: + + >>> from __future__ import generator_stop + + >>> def gen(): + ... next(iter([])) + ... yield + ... + >>> next(gen()) + Traceback (most recent call last): + File "", line 2, in gen + StopIteration + + The above exception was the direct cause of the following exception: + + Traceback (most recent call last): + File "", line 1, in + RuntimeError: generator raised StopIteration + +Without a ‘__future__’ import, a *note PendingDeprecationWarning: 8c7. +will be raised whenever a *note StopIteration: bfa. exception is raised +inside a generator. + +See also +........ + +PEP 479(2) – Change StopIteration handling inside generators + + 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 A function for testing approximate equality, Next: PEP 486 Make the Python Launcher aware of virtual environments, Prev: PEP 479 Change StopIteration handling inside generators, Up: New Features<14> + +1.9.2.9 PEP 485: A function for testing approximate equality +............................................................ + +PEP 485(1) adds the *note math.isclose(): daf. and *note +cmath.isclose(): db0. functions which tell whether two values are +approximately equal or “close” to each other. Whether or not two values +are considered close is determined according to given absolute and +relative tolerances. Relative tolerance is the maximum allowed +difference between ‘isclose’ arguments, relative to the larger absolute +value: + + >>> 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 + +It is also possible to compare two values using absolute tolerance, +which must be a non-negative value: + + >>> 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 + +See also +........ + +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 Make the Python Launcher aware of virtual environments, Next: PEP 488 Elimination of PYO files, Prev: PEP 485 A function for testing approximate equality, Up: New Features<14> + +1.9.2.10 PEP 486: Make the Python Launcher aware of virtual environments +........................................................................ + +PEP 486(1) makes the Windows launcher (see PEP 397(2)) aware of an +active virtual environment. When the default interpreter would be used +and the ‘VIRTUAL_ENV’ environment variable is set, the interpreter in +the virtual environment will be used. + +See also +........ + +PEP 486(3) – Make the Python Launcher aware of virtual environments + + 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 Elimination of PYO files, Next: PEP 489 Multi-phase extension module initialization, Prev: PEP 486 Make the Python Launcher aware of virtual environments, Up: New Features<14> + +1.9.2.11 PEP 488: Elimination of PYO files +.......................................... + +PEP 488(1) does away with the concept of ‘.pyo’ files. This means that +‘.pyc’ files represent both unoptimized and optimized bytecode. To +prevent the need to constantly regenerate bytecode files, ‘.pyc’ files +now have an optional ‘opt-’ tag in their name when the bytecode is +optimized. This has the side-effect of no more bytecode file name +clashes when running under either *note -O: db4. or *note -OO: db5. +Consequently, bytecode files generated from *note -O: db4, and *note +-OO: db5. may now exist simultaneously. *note +importlib.util.cache_from_source(): 2f8. has an updated API to help with +this change. + +See also +........ + +PEP 488(2) – Elimination of PYO files + + 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 Multi-phase extension module initialization, Prev: PEP 488 Elimination of PYO files, Up: New Features<14> + +1.9.2.12 PEP 489: Multi-phase extension module initialization +............................................................. + +PEP 489(1) updates extension module initialization to take advantage of +the two step module loading mechanism introduced by PEP 451(2) in Python +3.4. + +This change brings the import semantics of extension modules that opt-in +to using the new mechanism much closer to those of Python source and +bytecode modules, including the ability to use any valid identifier as a +module name, rather than being restricted to ASCII. + +See also +........ + +PEP 489(3) – Multi-phase extension module initialization + + PEP written by Petr Viktorin, Stefan Behnel, and Nick Coghlan; + implemented by 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: Other Language Changes<9>, Next: New Modules<9>, Prev: New Features<14>, Up: What’s New In Python 3 5 + +1.9.3 Other Language Changes +---------------------------- + +Some smaller changes made to the core Python language are: + + * Added the ‘"namereplace"’ error handlers. The ‘"backslashreplace"’ + error handlers now work with decoding and translating. + (Contributed by Serhiy Storchaka in bpo-19676(1) and bpo-22286(2).) + + * The *note -b: 5df. option now affects comparisons of *note bytes: + 1c2. with *note int: 259. (Contributed by Serhiy Storchaka in + bpo-23681(3).) + + * New Kazakh ‘kz1048’ and Tajik ‘koi8_t’ *note codecs: db8. + (Contributed by Serhiy Storchaka in bpo-22682(4) and bpo-22681(5).) + + * Property docstrings are now writable. This is especially useful + for *note collections.namedtuple(): 1ca. docstrings. (Contributed + by Berker Peksag in bpo-24064(6).) + + * Circular imports involving relative imports are now supported. + (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: New Modules<9>, Next: Improved Modules<9>, Prev: Other Language Changes<9>, Up: What’s New In Python 3 5 + +1.9.4 New Modules +----------------- + +* Menu: + +* typing: typing<10>. +* zipapp: zipapp<2>. + + +File: python.info, Node: typing<10>, Next: zipapp<2>, Up: New Modules<9> + +1.9.4.1 typing +.............. + +The new *note typing: 104. *note provisional: b03. module provides +standard definitions and tools for function type annotations. See *note +Type Hints: d65. for more information. + + +File: python.info, Node: zipapp<2>, Prev: typing<10>, Up: New Modules<9> + +1.9.4.2 zipapp +.............. + +The new *note zipapp: 130. module (specified in PEP 441(1)) provides an +API and command line tool for creating executable Python Zip +Applications, which were introduced in Python 2.6 in bpo-1739468(2), but +which were not well publicized, either at the time or since. + +With the new module, bundling your application is as simple as putting +all the files, including a ‘__main__.py’ file, into a directory ‘myapp’ +and running: + + $ python -m zipapp myapp + $ python myapp.pyz + +The module implementation has been contributed by Paul Moore in +bpo-23491(3). + +See also +........ + +PEP 441(4) – Improving Python ZIP Application Support + + ---------- 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: Improved Modules<9>, Next: Other module-level changes, Prev: New Modules<9>, Up: What’s New In Python 3 5 + +1.9.5 Improved Modules +---------------------- + +* Menu: + +* argparse: argparse<4>. +* asyncio: asyncio<10>. +* bz2:: +* cgi:: +* cmath: cmath<2>. +* code:: +* collections: collections<5>. +* collections.abc: collections abc<3>. +* compileall: compileall<4>. +* concurrent.futures: concurrent futures<5>. +* configparser: configparser<4>. +* contextlib: contextlib<5>. +* csv: csv<3>. +* curses: curses<4>. +* dbm: dbm<5>. +* difflib:: +* distutils: distutils<7>. +* doctest: doctest<3>. +* email: email<3>. +* enum: enum<8>. +* faulthandler: faulthandler<3>. +* functools: functools<4>. +* glob: glob<3>. +* gzip: gzip<4>. +* heapq:: +* http: http<2>. +* http.client: http client<3>. +* idlelib and IDLE: idlelib and IDLE<3>. +* imaplib: imaplib<2>. +* imghdr:: +* importlib: importlib<8>. +* inspect: inspect<7>. +* io: io<5>. +* ipaddress: ipaddress<4>. +* json: json<2>. +* linecache: linecache<2>. +* locale: locale<6>. +* logging: logging<5>. +* lzma:: +* math: math<8>. +* multiprocessing: multiprocessing<6>. +* operator: operator<2>. +* os: os<10>. +* pathlib: pathlib<10>. +* pickle: pickle<3>. +* poplib: poplib<2>. +* re: re<7>. +* readline: readline<2>. +* selectors:: +* shutil: shutil<5>. +* signal: signal<3>. +* smtpd: smtpd<2>. +* smtplib: smtplib<2>. +* sndhdr:: +* socket: socket<8>. +* ssl: ssl<9>. +* sqlite3: sqlite3<8>. +* subprocess: subprocess<4>. +* sys: sys<11>. +* sysconfig: sysconfig<2>. +* tarfile: tarfile<7>. +* threading: threading<6>. +* time: time<7>. +* timeit: timeit<2>. +* tkinter: tkinter<8>. +* traceback: traceback<5>. +* types: types<5>. +* unicodedata: unicodedata<8>. +* unittest: unittest<8>. +* unittest.mock: unittest mock<3>. +* urllib: urllib<2>. +* wsgiref:: +* xmlrpc: xmlrpc<2>. +* xml.sax: xml sax. +* zipfile: zipfile<4>. + + +File: python.info, Node: argparse<4>, Next: asyncio<10>, Up: Improved Modules<9> + +1.9.5.1 argparse +................ + +The *note ArgumentParser: 535. class now allows disabling *note +abbreviated usage: dbe. of long options by setting *note allow_abbrev: +dbf. to ‘False’. (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<10>, Next: bz2, Prev: argparse<4>, Up: Improved Modules<9> + +1.9.5.2 asyncio +............... + +Since the *note asyncio: a. module is *note provisional: b03, all +changes introduced in Python 3.5 have also been backported to Python +3.4.x. + +Notable changes in the *note asyncio: a. module since Python 3.4.0: + + * New debugging APIs: *note loop.set_debug(): dc1. and *note + loop.get_debug(): dc2. methods. (Contributed by Victor Stinner.) + + * The proactor event loop now supports SSL. (Contributed by Antoine + Pitrou and Victor Stinner in bpo-22560(1).) + + * A new *note loop.is_closed(): dc3. method to check if the event + loop is closed. (Contributed by Victor Stinner in bpo-21326(2).) + + * A new *note loop.create_task(): 1c0. to conveniently create and + schedule a new *note Task: 1be. for a coroutine. The ‘create_task’ + method is also used by all asyncio functions that wrap coroutines + into tasks, such as *note asyncio.wait(): 47b, *note + asyncio.gather(): 5f9, etc. (Contributed by Victor Stinner.) + + * A new *note transport.get_write_buffer_limits(): dc4. 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(): c76. (Contributed by Yury Selivanov.) + + * New *note loop.set_task_factory(): dc5. and *note + loop.get_task_factory(): dc6. methods to customize the task factory + that *note loop.create_task(): 1c0. method uses. (Contributed by + Yury Selivanov.) + + * New *note Queue.join(): dc7. and *note Queue.task_done(): dc8. + queue methods. (Contributed by Victor Stinner.) + + * The ‘JoinableQueue’ class was removed, in favor of the *note + asyncio.Queue: a76. class. (Contributed by Victor Stinner.) + +Updates in 3.5.1: + + * The *note ensure_future(): c76. function and all functions that use + it, such as *note loop.run_until_complete(): c77, now accept all + kinds of *note awaitable objects: 1ad. (Contributed by Yury + Selivanov.) + + * New *note run_coroutine_threadsafe(): 880. function to submit + coroutines to event loops from other threads. (Contributed by + Vincent Michel.) + + * New *note Transport.is_closing(): c78. method to check if the + transport is closing or closed. (Contributed by Yury Selivanov.) + + * The *note loop.create_server(): b13. method can now accept a list + of hosts. (Contributed by Yann Sionneau.) + +Updates in 3.5.2: + + * New *note loop.create_future(): c79. method to create Future + objects. This allows alternative event loop implementations, such + as uvloop(3), to provide a faster *note asyncio.Future: bcd. + implementation. (Contributed by Yury Selivanov.) + + * New *note loop.get_exception_handler(): c7a. method to get the + current exception handler. (Contributed by Yury Selivanov.) + + * New *note StreamReader.readuntil(): 1b4. method to read data from + the stream until a separator bytes sequence appears. (Contributed + by Mark Korenberg.) + + * The *note loop.create_connection(): 5ff. and *note + loop.create_server(): b13. 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): dc9. 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<10>, Up: Improved Modules<9> + +1.9.5.3 bz2 +........... + +The *note BZ2Decompressor.decompress: dcb. method now accepts an +optional 'max_length' argument to limit the maximum size of decompressed +data. (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: Improved Modules<9> + +1.9.5.4 cgi +........... + +The ‘FieldStorage’ class now supports the *note context manager: 5d0. +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: code, Prev: cgi, Up: Improved Modules<9> + +1.9.5.5 cmath +............. + +A new function *note isclose(): db0. provides a way to test for +approximate equality. (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: code, Next: collections<5>, Prev: cmath<2>, Up: Improved Modules<9> + +1.9.5.6 code +............ + +The *note InteractiveInterpreter.showtraceback(): dcf. method now prints +the full chained traceback, just like the interactive interpreter. +(Contributed by Claudiu Popa in bpo-17442(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17442 + + +File: python.info, Node: collections<5>, Next: collections abc<3>, Prev: code, Up: Improved Modules<9> + +1.9.5.7 collections +................... + +The *note OrderedDict: 5d7. class is now implemented in C, which makes +it 4 to 100 times faster. (Contributed by Eric Snow in bpo-16991(1).) + +‘OrderedDict.items()’, ‘OrderedDict.keys()’, ‘OrderedDict.values()’ +views now support *note reversed(): 862. iteration. (Contributed by +Serhiy Storchaka in bpo-19505(2).) + +The *note deque: 5d8. class now defines *note index(): dd1, *note +insert(): dd2, and *note copy(): dd3, and supports the ‘+’ and ‘*’ +operators. This allows deques to be recognized as a *note +MutableSequence: 1a1. and improves their substitutability for lists. +(Contributed by Raymond Hettinger in bpo-23704(3).) + +Docstrings produced by *note namedtuple(): 1ca. can now be updated: + + 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: dd4. class now implements the ‘__getnewargs__()’, +‘__rmod__()’, *note casefold(): dd5, *note format_map(): dd6, *note +isprintable(): dd7, and *note maketrans(): dd8. methods to match the +corresponding methods of *note str: 447. (Contributed by Joe Jevnik in +bpo-22189(5).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16991 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=19505 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=23704 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=24064 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=22189 + + +File: python.info, Node: collections abc<3>, Next: compileall<4>, Prev: collections<5>, Up: Improved Modules<9> + +1.9.5.8 collections.abc +....................... + +The ‘Sequence.index()’ method now accepts 'start' and 'stop' arguments +to match the corresponding methods of *note tuple: 36b, *note list: 60d, +etc. (Contributed by Devin Jeanpierre in bpo-23086(1).) + +A new *note Generator: dda. abstract base class. (Contributed by Stefan +Behnel in bpo-24018(2).) + +New *note Awaitable: ddb, *note Coroutine: ddc, *note AsyncIterator: +ddd, and *note AsyncIterable: dde. abstract base classes. (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<5>, Prev: collections abc<3>, Up: Improved Modules<9> + +1.9.5.9 compileall +.................. + +A new *note compileall: 20. option, ‘-j N’, allows running 'N' workers +simultaneously to perform parallel bytecode compilation. The *note +compile_dir(): b26. 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(): b26, *note +compile_file(): de0, and *note compile_path(): de1. 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<5>, Next: configparser<4>, Prev: compileall<4>, Up: Improved Modules<9> + +1.9.5.10 concurrent.futures +........................... + +The *note Executor.map(): de3. method now accepts a 'chunksize' argument +to allow batching of tasks to improve performance when *note +ProcessPoolExecutor(): 8ed. is used. (Contributed by Dan O’Reilly in +bpo-11271(1).) + +The number of workers in the *note ThreadPoolExecutor: 73d. 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<4>, Next: contextlib<5>, Prev: concurrent futures<5>, Up: Improved Modules<9> + +1.9.5.11 configparser +..................... + +*note configparser: 22. now provides a way to customize the conversion +of values by specifying a dictionary of converters in the *note +ConfigParser: 1c8. constructor, or by defining them as methods in +‘ConfigParser’ subclasses. Converters defined in a parser instance are +inherited by its section proxies. + +Example: + + >>> import configparser + >>> conv = {} + >>> conv['list'] = lambda v: [e.strip() for e in v.split() if e.strip()] + >>> cfg = configparser.ConfigParser(converters=conv) + >>> cfg.read_string(""" + ... [s] + ... list = a b c d e f g + ... """) + >>> cfg.get('s', 'list') + 'a b c d e f g' + >>> cfg.getlist('s', 'list') + ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + >>> section = cfg['s'] + >>> section.getlist('list') + ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + +(Contributed by Łukasz Langa in bpo-18159(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=18159 + + +File: python.info, Node: contextlib<5>, Next: csv<3>, Prev: configparser<4>, Up: Improved Modules<9> + +1.9.5.12 contextlib +................... + +The new *note redirect_stderr(): de6. *note context manager: 5d0. +(similar to *note redirect_stdout(): de7.) makes it easier for utility +scripts to handle inflexible APIs that write their output to *note +sys.stderr: 939. and don’t provide any options to redirect it: + + >>> import contextlib, io, logging + >>> f = io.StringIO() + >>> with contextlib.redirect_stderr(f): + ... logging.warning('warning') + ... + >>> f.getvalue() + 'WARNING:root:warning\n' + +(Contributed by Berker Peksag in bpo-22389(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22389 + + +File: python.info, Node: csv<3>, Next: curses<4>, Prev: contextlib<5>, Up: Improved Modules<9> + +1.9.5.13 csv +............ + +The *note writerow(): de9. method now supports arbitrary iterables, not +just sequences. (Contributed by Serhiy Storchaka in bpo-23171(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23171 + + +File: python.info, Node: curses<4>, Next: dbm<5>, Prev: csv<3>, Up: Improved Modules<9> + +1.9.5.14 curses +............... + +The new *note update_lines_cols(): deb. function updates the ‘LINES’ and +‘COLS’ module variables. This is useful for detecting manual screen +resizing. (Contributed by Arnon Yaari in bpo-4254(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4254 + + +File: python.info, Node: dbm<5>, Next: difflib, Prev: curses<4>, Up: Improved Modules<9> + +1.9.5.15 dbm +............ + +*note dumb.open: a96. 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, Next: distutils<7>, Prev: dbm<5>, Up: Improved Modules<9> + +1.9.5.16 difflib +................ + +The charset of HTML documents generated by *note HtmlDiff.make_file(): +dee. 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(): def. 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, Up: Improved Modules<9> + +1.9.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<3>, Prev: distutils<7>, Up: Improved Modules<9> + +1.9.5.18 doctest +................ + +The *note DocTestSuite(): df2. function returns an empty *note +unittest.TestSuite: df3. if 'module' contains no docstrings, instead of +raising *note ValueError: 204. (Contributed by Glenn Jones in +bpo-15916(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15916 + + +File: python.info, Node: email<3>, Next: enum<8>, Prev: doctest<3>, Up: Improved Modules<9> + +1.9.5.19 email +.............. + +A new policy option *note Policy.mangle_from_: df5. 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: c99. and ‘False’ for all other policies. (Contributed by +Milan Oberkirch in bpo-20098(1).) + +A new *note Message.get_content_disposition(): df6. 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: df7. 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: df8. constructor now accepts a *note +charset.Charset: df9. 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<3>, Prev: email<3>, Up: Improved Modules<9> + +1.9.5.20 enum +............. + +The *note Enum: 62c. callable has a new parameter 'start' to specify the +initial number of enum values if only 'names' are provided: + + >>> Animal = enum.Enum('Animal', 'cat dog', start=10) + >>> Animal.cat + + >>> Animal.dog + + +(Contributed by Ethan Furman in bpo-21706(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=21706 + + +File: python.info, Node: faulthandler<3>, Next: functools<4>, Prev: enum<8>, Up: Improved Modules<9> + +1.9.5.21 faulthandler +..................... + +The *note enable(): c9e, *note register(): dfc, *note dump_traceback(): +dfd. and *note dump_traceback_later(): dfe. functions now accept file +descriptors in addition to file-like objects. (Contributed by Wei Wu in +bpo-23566(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23566 + + +File: python.info, Node: functools<4>, Next: glob<3>, Prev: faulthandler<3>, Up: Improved Modules<9> + +1.9.5.22 functools +.................. + +Most of the *note lru_cache(): 9ee. machinery is now implemented in C, +making it significantly faster. (Contributed by Matt Joiner, Alexey +Kachayev, and Serhiy Storchaka in bpo-14373(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14373 + + +File: python.info, Node: glob<3>, Next: gzip<4>, Prev: functools<4>, Up: Improved Modules<9> + +1.9.5.23 glob +............. + +The *note iglob(): 803. and *note glob(): 2a1. functions now support +recursive search in subdirectories, using the ‘"**"’ pattern. +(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, Prev: glob<3>, Up: Improved Modules<9> + +1.9.5.24 gzip +............. + +The 'mode' argument of the *note GzipFile: 416. constructor now accepts +‘"x"’ to request exclusive creation. (Contributed by Tim Heaney in +bpo-19222(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=19222 + + +File: python.info, Node: heapq, Next: http<2>, Prev: gzip<4>, Up: Improved Modules<9> + +1.9.5.25 heapq +.............. + +Element comparison in *note merge(): e03. can now be customized by +passing a *note key function: e04. 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<2>, Next: http client<3>, Prev: heapq, Up: Improved Modules<9> + +1.9.5.26 http +............. + +A new *note HTTPStatus: 8ff. enum that defines a set of HTTP status +codes, reason phrases and long descriptions written in English. +(Contributed by Demian Brecht in bpo-21793(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=21793 + + +File: python.info, Node: http client<3>, Next: idlelib and IDLE<3>, Prev: http<2>, Up: Improved Modules<9> + +1.9.5.27 http.client +.................... + +*note HTTPConnection.getresponse(): e07. now raises a *note +RemoteDisconnected: e08. exception when a remote server connection is +closed unexpectedly. Additionally, if a *note ConnectionError: e09. (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 and IDLE<3>, Next: imaplib<2>, Prev: http client<3>, Up: Improved Modules<9> + +1.9.5.28 idlelib and IDLE +......................... + +Since idlelib implements the IDLE shell and editor and is not intended +for import by other programs, it gets improvements with every release. +See ‘Lib/idlelib/NEWS.txt’ for a cumulative list of changes since 3.4.0, +as well as changes made in future 3.5.x releases. This file is also +available from the IDLE Help ‣ About IDLE dialog. + + +File: python.info, Node: imaplib<2>, Next: imghdr, Prev: idlelib and IDLE<3>, Up: Improved Modules<9> + +1.9.5.29 imaplib +................ + +The *note IMAP4: 902. class now supports the *note context manager: 5d0. +protocol. When used in a *note with: 5ce. statement, the IMAP4 ‘LOGOUT’ +command will be called automatically at the end of the block. +(Contributed by Tarek Ziadé and Serhiy Storchaka in bpo-4972(1).) + +The *note imaplib: 74. module now supports RFC 5161(2) (ENABLE +Extension) and RFC 6855(3) (UTF-8 Support) via the *note IMAP4.enable(): +e0c. method. A new *note IMAP4.utf8_enabled: e0d. 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: 74. 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<2>, Up: Improved Modules<9> + +1.9.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<7>, Prev: imghdr, Up: Improved Modules<9> + +1.9.5.31 importlib +.................. + +The *note util.LazyLoader: cad. 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(): e10. 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(): e11. function is now the +preferred way to create a new module. As opposed to creating a *note +types.ModuleType: e12. 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<7>, Next: io<5>, Prev: importlib<8>, Up: Improved Modules<9> + +1.9.5.32 inspect +................ + +Both the *note Signature: 1cf. and *note Parameter: 1d0. classes are now +picklable and hashable. (Contributed by Yury Selivanov in bpo-20726(1) +and bpo-20334(2).) + +A new *note BoundArguments.apply_defaults(): e14. 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(): 735. makes +subclassing of *note Signature: 1cf. easier. (Contributed by Yury +Selivanov and Eric Snow in bpo-17373(4).) + +The *note signature(): 733. 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: d76. and +*note coroutine objects: 48d. has been added: *note iscoroutine(): e15, +*note iscoroutinefunction(): 2e8, *note isawaitable(): e16, *note +getcoroutinelocals(): e17, and *note getcoroutinestate(): e18. +(Contributed by Yury Selivanov in bpo-24017(6) and bpo-24400(7).) + +The *note stack(): 64e, *note trace(): 64f, *note getouterframes(): 64c, +and *note getinnerframes(): 64d. 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<5>, Next: ipaddress<4>, Prev: inspect<7>, Up: Improved Modules<9> + +1.9.5.33 io +........... + +A new *note BufferedIOBase.readinto1(): e1a. method, that uses at most +one call to the underlying raw stream’s *note RawIOBase.read(): e1b. or +*note RawIOBase.readinto(): e1c. 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<2>, Prev: io<5>, Up: Improved Modules<9> + +1.9.5.34 ipaddress +.................. + +Both the *note IPv4Network: 200. and *note IPv6Network: 201. 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 ‘reverse_pointer’ attribute for the *note IPv4Network: 200. and +*note IPv6Network: 201. 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<2>, Next: linecache<2>, Prev: ipaddress<4>, Up: Improved Modules<9> + +1.9.5.35 json +............. + +The *note json.tool: 83. 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: e1f. instead of *note +ValueError: 204. 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<2>, Next: locale<6>, Prev: json<2>, Up: Improved Modules<9> + +1.9.5.36 linecache +.................. + +A new *note lazycache(): e21. function can be used to capture +information about a non-file-based module to permit getting its lines +later via *note getline(): e22. This avoids doing I/O until a line is +actually needed, without having to carry the module globals around +indefinitely. (Contributed by Robert Collins in bpo-17911(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17911 + + +File: python.info, Node: locale<6>, Next: logging<5>, Prev: linecache<2>, Up: Improved Modules<9> + +1.9.5.37 locale +............... + +A new *note delocalize(): e24. function can be used to convert a string +into a normalized number string, taking the ‘LC_NUMERIC’ settings into +account: + + >>> import locale + >>> locale.setlocale(locale.LC_NUMERIC, 'de_DE.UTF-8') + 'de_DE.UTF-8' + >>> locale.delocalize('1.234,56') + '1234.56' + >>> locale.setlocale(locale.LC_NUMERIC, 'en_US.UTF-8') + 'en_US.UTF-8' + >>> locale.delocalize('1,234.56') + '1234.56' + +(Contributed by Cédric Krier in bpo-13918(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13918 + + +File: python.info, Node: logging<5>, Next: lzma, Prev: locale<6>, Up: Improved Modules<9> + +1.9.5.38 logging +................ + +All logging methods (*note Logger: b4f. *note log(): e26, *note +exception(): e27, *note critical(): e28, *note debug(): e29, 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: e2a. class now accepts an optional *note +ssl.SSLContext: 296. instance to configure SSL settings used in an HTTP +connection. (Contributed by Alex Gaynor in bpo-22788(2).) + +The *note handlers.QueueListener: e2b. 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<8>, Prev: logging<5>, Up: Improved Modules<9> + +1.9.5.39 lzma +............. + +The *note LZMADecompressor.decompress(): e2d. 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<8>, Next: multiprocessing<6>, Prev: lzma, Up: Improved Modules<9> + +1.9.5.40 math +............. + +Two new constants have been added to the *note math: 8e. module: *note +inf: c84. and *note nan: 65f. (Contributed by Mark Dickinson in +bpo-23185(1).) + +A new function *note isclose(): daf. provides a way to test for +approximate equality. (Contributed by Chris Barker and Tal Einat in +bpo-24270(2).) + +A new *note gcd(): 90f. 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<6>, Next: operator<2>, Prev: math<8>, Up: Improved Modules<9> + +1.9.5.41 multiprocessing +........................ + +*note sharedctypes.synchronized(): e30. objects now support the *note +context manager: 5d0. protocol. (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<2>, Next: os<10>, Prev: multiprocessing<6>, Up: Improved Modules<9> + +1.9.5.42 operator +................. + +*note attrgetter(): e32, *note itemgetter(): a61, and *note +methodcaller(): e33. objects now support pickling. (Contributed by Josh +Rosenberg and Serhiy Storchaka in bpo-22955(1).) + +New *note matmul(): e34. and *note imatmul(): e35. functions to perform +matrix multiplication. (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<10>, Next: pathlib<10>, Prev: operator<2>, Up: Improved Modules<9> + +1.9.5.43 os +........... + +The new *note scandir(): a5e. function returning an iterator of *note +DirEntry: 497. objects has been added. If possible, *note scandir(): +a5e. 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).) + +On Windows, a new *note stat_result.st_file_attributes: e37. attribute +is now available. It corresponds to the ‘dwFileAttributes’ member of +the ‘BY_HANDLE_FILE_INFORMATION’ structure returned by +‘GetFileInformationByHandle()’. (Contributed by Ben Hoyt in +bpo-21719(2).) + +The *note urandom(): 51e. function now uses the ‘getrandom()’ syscall on +Linux 3.17 or newer, and ‘getentropy()’ on OpenBSD 5.6 and newer, +removing the need to use ‘/dev/urandom’ and avoiding failures due to +potential file descriptor exhaustion. (Contributed by Victor Stinner in +bpo-22181(3).) + +New *note get_blocking(): e38. and *note set_blocking(): e39. functions +allow getting and setting a file descriptor’s blocking mode (*note +O_NONBLOCK: e3a.) (Contributed by Victor Stinner in bpo-22054(4).) + +The *note truncate(): e3b. and *note ftruncate(): d8e. functions are now +supported on Windows. (Contributed by Steve Dower in bpo-23668(5).) + +There is a new *note os.path.commonpath(): e3c. function returning the +longest common sub-path of each passed pathname. Unlike the *note +os.path.commonprefix(): e3d. 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<10>, Next: pickle<3>, Prev: os<10>, Up: Improved Modules<9> + +1.9.5.44 pathlib +................ + +The new *note Path.samefile(): e3f. method can be used to check whether +the path points to the same file as another path, which can be either +another *note Path: 22b. 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(): e40. method now accepts a new optional +'exist_ok' argument to match ‘mkdir -p’ and *note os.makedirs(): 220. +functionality. (Contributed by Berker Peksag in bpo-21539(2).) + +There is a new *note Path.expanduser(): e41. method to expand ‘~’ and +‘~user’ prefixes. (Contributed by Serhiy Storchaka and Claudiu Popa in +bpo-19776(3).) + +A new *note Path.home(): e42. class method can be used to get a *note +Path: 22b. instance representing the user’s home directory. +(Contributed by Victor Salgado and Mayank Tripathi in bpo-19777(4).) + +New *note Path.write_text(): e43, *note Path.read_text(): e44, *note +Path.write_bytes(): e45, *note Path.read_bytes(): e46. 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<3>, Next: poplib<2>, Prev: pathlib<10>, Up: Improved Modules<9> + +1.9.5.45 pickle +............... + +Nested objects, such as unbound methods or nested classes, can now be +pickled using *note pickle protocols: cc1. 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<7>, Prev: pickle<3>, Up: Improved Modules<9> + +1.9.5.46 poplib +............... + +A new *note POP3.utf8(): e49. 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<7>, Next: readline<2>, Prev: poplib<2>, Up: Improved Modules<9> + +1.9.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(): 2a5. and *note subn(): 2a6. functions now replace +unmatched groups with empty strings instead of raising an exception. +(Contributed by Serhiy Storchaka in bpo-1519638(3).) + +The ‘re.error’ exceptions have new attributes, ‘msg’, ‘pattern’, ‘pos’, +‘lineno’, and ‘colno’, 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<7>, Up: Improved Modules<9> + +1.9.5.48 readline +................. + +A new *note append_history_file(): e4c. function can be used to append +the specified number of trailing elements in history to the given file. +(Contributed by Bruno Cauet in bpo-22940(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22940 + + +File: python.info, Node: selectors, Next: shutil<5>, Prev: readline<2>, Up: Improved Modules<9> + +1.9.5.49 selectors +.................. + +The new *note DevpollSelector: bd7. supports efficient ‘/dev/poll’ +polling on Solaris. (Contributed by Giampaolo Rodola’ in bpo-18931(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=18931 + + +File: python.info, Node: shutil<5>, Next: signal<3>, Prev: selectors, Up: Improved Modules<9> + +1.9.5.50 shutil +............... + +The *note move(): a5b. function now accepts a 'copy_function' argument, +allowing, for example, the *note copy(): a59. function to be used +instead of the default *note copy2(): a5a. if there is a need to ignore +file metadata when moving. (Contributed by Claudiu Popa in +bpo-19840(1).) + +The *note make_archive(): 4af. function now supports the 'xztar' format. +(Contributed by Serhiy Storchaka in bpo-5411(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=19840 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=5411 + + +File: python.info, Node: signal<3>, Next: smtpd<2>, Prev: shutil<5>, Up: Improved Modules<9> + +1.9.5.51 signal +............... + +On Windows, the *note set_wakeup_fd(): b70. function now also supports +socket handles. (Contributed by Victor Stinner in bpo-22018(1).) + +Various ‘SIG*’ constants in the *note signal: c6. module have been +converted into *note Enums: 56. 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: Improved Modules<9> + +1.9.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: Improved Modules<9> + +1.9.5.53 smtplib +................ + +A new *note SMTP.auth(): e52. method provides a convenient way to +implement custom authentication mechanisms. (Contributed by Milan +Oberkirch in bpo-15014(1).) + +The *note SMTP.set_debuglevel(): e53. 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(): e54. and *note SMTP.send_message(): e55. +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<8>, Prev: smtplib<2>, Up: Improved Modules<9> + +1.9.5.54 sndhdr +............... + +The ‘what()’ and ‘whathdr()’ functions now return a *note namedtuple(): +1ca. (Contributed by Claudiu Popa in bpo-18615(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=18615 + + +File: python.info, Node: socket<8>, Next: ssl<9>, Prev: sndhdr, Up: Improved Modules<9> + +1.9.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(): e58. method allows sending a file over a +socket by using the high-performance *note os.sendfile(): b0f. function +on UNIX, resulting in uploads being from 2 to 3 times faster than when +using plain *note socket.send(): da6. (Contributed by Giampaolo Rodola’ +in bpo-17552(2).) + +The *note socket.sendall(): da7. 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(): e59. method is now +optional. By default it is set to *note SOMAXCONN: e5a. 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<9>, Next: sqlite3<8>, Prev: socket<8>, Up: Improved Modules<9> + +1.9.5.56 ssl +............ + +* Menu: + +* Memory BIO Support:: +* Application-Layer Protocol Negotiation Support:: +* Other Changes:: + + +File: python.info, Node: Memory BIO Support, Next: Application-Layer Protocol Negotiation Support, Up: ssl<9> + +1.9.5.57 Memory BIO Support +........................... + +(Contributed by Geert Jansen in bpo-21965(1).) + +The new *note SSLObject: b81. class has been added to provide SSL +protocol support for cases when the network I/O capabilities of *note +SSLSocket: 8e9. 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: e5d. 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: +8e9.’s readiness model (“select/poll”) is inefficient. + +A new *note SSLContext.wrap_bio(): b82. 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: Other Changes, Prev: Memory BIO Support, Up: ssl<9> + +1.9.5.58 Application-Layer Protocol Negotiation Support +....................................................... + +(Contributed by Benjamin Peterson in bpo-20188(1).) + +Where OpenSSL support is present, the *note ssl: d0. module now +implements the 'Application-Layer Protocol Negotiation' TLS extension as +described in RFC 7301(2). + +The new *note SSLContext.set_alpn_protocols(): e5f. can be used to +specify which protocols a socket should advertise during the TLS +handshake. + +The new *note SSLSocket.selected_alpn_protocol(): e60. returns the +protocol that was selected during the TLS handshake. The *note +HAS_ALPN: e61. 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: Other Changes, Prev: Application-Layer Protocol Negotiation Support, Up: ssl<9> + +1.9.5.59 Other Changes +...................... + +There is a new *note SSLSocket.version(): e63. method to query the +actual protocol version in use. (Contributed by Antoine Pitrou in +bpo-20421(1).) + +The *note SSLSocket: 8e9. 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: e64. or *note ssl.SSLWantWriteError: e65. +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(): e66. 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: 259. (Contributed by Akira Li in +bpo-19940(5).) + +New ‘SSLObject.shared_ciphers()’ and *note SSLSocket.shared_ciphers(): +e67. 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(): e68, *note SSLSocket.read(): e69, +‘SSLSocket.shutdown()’, and *note SSLSocket.write(): e6a. methods of the +*note SSLSocket: 8e9. 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<8>, Next: subprocess<4>, Prev: ssl<9>, Up: Improved Modules<9> + +1.9.5.60 sqlite3 +................ + +The *note Row: e6c. class now fully supports the sequence protocol, in +particular *note reversed(): 862. iteration and slice indexing. +(Contributed by Claudiu Popa in bpo-10203(1); by Lucas Sinclair, Jessica +McKellar, and Serhiy Storchaka in bpo-13583(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10203 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=13583 + + +File: python.info, Node: subprocess<4>, Next: sys<11>, Prev: sqlite3<8>, Up: Improved Modules<9> + +1.9.5.61 subprocess +................... + +The new *note run(): b86. function has been added. It runs the +specified command and returns a *note CompletedProcess: e6e. object, +which describes a finished process. The new API is more consistent and +is the recommended approach to invoking subprocesses in Python code that +does not need to maintain compatibility with earlier Python versions. +(Contributed by Thomas Kluyver in bpo-23342(1).) + +Examples: + + >>> subprocess.run(["ls", "-l"]) # doesn't capture output + CompletedProcess(args=['ls', '-l'], returncode=0) + + >>> subprocess.run("exit 1", shell=True, check=True) + Traceback (most recent call last): + ... + subprocess.CalledProcessError: Command 'exit 1' returned non-zero exit status 1 + + >>> subprocess.run(["ls", "-l", "/dev/null"], stdout=subprocess.PIPE) + CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0, + stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\n') + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23342 + + +File: python.info, Node: sys<11>, Next: sysconfig<2>, Prev: subprocess<4>, Up: Improved Modules<9> + +1.9.5.62 sys +............ + +A new ‘set_coroutine_wrapper()’ function allows setting a global hook +that will be called whenever a *note coroutine object: 48d. is created +by an *note async def: 5cd. function. A corresponding +‘get_coroutine_wrapper()’ can be used to obtain a currently set wrapper. +Both functions are *note provisional: b03, and are intended for +debugging purposes only. (Contributed by Yury Selivanov in +bpo-24017(1).) + +A new *note is_finalizing(): a8f. function can be used to check if the +Python interpreter is *note shutting down: 14e. (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<2>, Next: tarfile<7>, Prev: sys<11>, Up: Improved Modules<9> + +1.9.5.63 sysconfig +.................. + +The name of the user scripts directory on Windows now includes the first +two components of the Python version. (Contributed by Paul Moore in +bpo-23437(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23437 + + +File: python.info, Node: tarfile<7>, Next: threading<6>, Prev: sysconfig<2>, Up: Improved Modules<9> + +1.9.5.64 tarfile +................ + +The 'mode' argument of the *note open(): e72. function now accepts ‘"x"’ +to request exclusive creation. (Contributed by Berker Peksag in +bpo-21717(1).) + +The *note TarFile.extractall(): 42a. and *note TarFile.extract(): 42b. +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(): e73. now accepts an optional 'members' keyword +argument that can be set to a subset of the list returned by *note +TarFile.getmembers(): e74. (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<6>, Next: time<7>, Prev: tarfile<7>, Up: Improved Modules<9> + +1.9.5.65 threading +.................. + +Both the *note Lock.acquire(): 694. and *note RLock.acquire(): e76. +methods now use a monotonic clock for timeout management. (Contributed +by Victor Stinner in bpo-22043(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22043 + + +File: python.info, Node: time<7>, Next: timeit<2>, Prev: threading<6>, Up: Improved Modules<9> + +1.9.5.66 time +............. + +The *note monotonic(): 255. function is now always available. +(Contributed by Victor Stinner in bpo-22043(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=22043 + + +File: python.info, Node: timeit<2>, Next: tkinter<8>, Prev: time<7>, Up: Improved Modules<9> + +1.9.5.67 timeit +............... + +A new command line option ‘-u’ or ‘--unit=U’ can be used to specify the +time unit for the timer output. Supported options are ‘usec’, ‘msec’, +or ‘sec’. (Contributed by Julian Gindi in bpo-18983(1).) + +The *note timeit(): e79. function has a new 'globals' parameter for +specifying the namespace in which the code will be running. +(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<8>, Next: traceback<5>, Prev: timeit<2>, Up: Improved Modules<9> + +1.9.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<5>, Prev: tkinter<8>, Up: Improved Modules<9> + +1.9.5.69 traceback +.................. + +New *note walk_stack(): e7c. and *note walk_tb(): e7d. functions to +conveniently traverse frame and *note traceback objects: af4. +(Contributed by Robert Collins in bpo-17911(1).) + +New lightweight classes: *note TracebackException: 25e, *note +StackSummary: e7e, and *note FrameSummary: e7f. (Contributed by Robert +Collins in bpo-17911(2).) + +Both the *note print_tb(): e80. and *note print_stack(): e81. 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<5>, Next: unicodedata<8>, Prev: traceback<5>, Up: Improved Modules<9> + +1.9.5.70 types +.............. + +A new *note coroutine(): e83. function to transform *note generator: +bde. and *note generator-like: dda. objects into *note awaitables: 1ad. +(Contributed by Yury Selivanov in bpo-24017(1).) + +A new type called *note CoroutineType: e84, which is used for *note +coroutine: 48d. objects created by *note async def: 5cd. functions. +(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<8>, Next: unittest<8>, Prev: types<5>, Up: Improved Modules<9> + +1.9.5.71 unicodedata +.................... + +The *note unicodedata: 105. module now uses data from Unicode 8.0.0(1). + + ---------- Footnotes ---------- + + (1) https://unicode.org/versions/Unicode8.0.0/ + + +File: python.info, Node: unittest<8>, Next: unittest mock<3>, Prev: unicodedata<8>, Up: Improved Modules<9> + +1.9.5.72 unittest +................. + +The *note TestLoader.loadTestsFromModule(): 291. 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: e87. attribute of the *note TestLoader: 290. +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<2>, Prev: unittest<8>, Up: Improved Modules<9> + +1.9.5.73 unittest.mock +...................... + +The *note Mock: a4b. class has the following improvements: + + * The class constructor has a new 'unsafe' parameter, which causes + mock objects to raise *note AttributeError: 348. on attribute names + starting with ‘"assert"’. (Contributed by Kushal Das in + bpo-21238(1).) + + * A new *note Mock.assert_not_called(): e89. method to check if the + mock object was called. (Contributed by Kushal Das in + bpo-21262(2).) + +The *note MagicMock: e8a. class now supports ‘__truediv__()’, +‘__divmod__()’ and ‘__matmul__()’ 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(): e8b. 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<2>, Next: wsgiref, Prev: unittest mock<3>, Up: Improved Modules<9> + +1.9.5.74 urllib +............... + +A new *note request.HTTPPasswordMgrWithPriorAuth: e8d. 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(): e8e. +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(): 295. function accepts an *note +ssl.SSLContext: 296. 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(): e8f. 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<2>, Up: Improved Modules<9> + +1.9.5.75 wsgiref +................ + +The 'headers' argument of the *note headers.Headers: e91. 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: Improved Modules<9> + +1.9.5.76 xmlrpc +............... + +The *note client.ServerProxy: a56. class now supports the *note context +manager: 5d0. protocol. (Contributed by Claudiu Popa in bpo-20627(1).) + +The *note client.ServerProxy: a56. constructor now accepts an optional +*note ssl.SSLContext: 296. instance. (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<4>, Prev: xmlrpc<2>, Up: Improved Modules<9> + +1.9.5.77 xml.sax +................ + +SAX parsers now support a character stream of the *note +xmlreader.InputSource: e94. object. (Contributed by Serhiy Storchaka in +bpo-2175(1).) + +*note parseString(): e95. now accepts a *note str: 447. instance. +(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<4>, Prev: xml sax, Up: Improved Modules<9> + +1.9.5.78 zipfile +................ + +ZIP output can now be written to unseekable streams. (Contributed by +Serhiy Storchaka in bpo-23252(1).) + +The 'mode' argument of *note ZipFile.open(): 417. method now accepts +‘"x"’ to request exclusive creation. (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: Other module-level changes, Next: Optimizations<9>, Prev: Improved Modules<9>, Up: What’s New In Python 3 5 + +1.9.6 Other module-level changes +-------------------------------- + +Many functions in the *note mmap: 90, ‘ossaudiodev’, *note socket: cc, +*note ssl: d0, and *note codecs: 1b. modules now accept writable *note +bytes-like objects: d2d. (Contributed by Serhiy Storchaka in +bpo-23001(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23001 + + +File: python.info, Node: Optimizations<9>, Next: Build and C API Changes<3>, Prev: Other module-level changes, Up: What’s New In Python 3 5 + +1.9.7 Optimizations +------------------- + +The *note os.walk(): 4a5. 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(): a5e. 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: 80. *note IPv4Network: 200. and +*note IPv6Network: 201. have been massively sped up, such as *note +subnets(): e99, *note supernet(): e9a, *note summarize_address_range(): +e9b, *note collapse_addresses(): e9c. 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: 80. objects was optimized to produce +significantly smaller output. (Contributed by Serhiy Storchaka in +bpo-23133(7).) + +Many operations on *note io.BytesIO: e9d. are now 50% to 100% faster. +(Contributed by Serhiy Storchaka in bpo-15381(8) and David Wilson in +bpo-22003(9).) + +The *note marshal.dumps(): e9e. 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).) + +The UTF-32 encoder is now 3 to 7 times faster. (Contributed by Serhiy +Storchaka in bpo-15027(12).) + +Regular expressions are now parsed up to 10% faster. (Contributed by +Serhiy Storchaka in bpo-19380(13).) + +The *note json.dumps(): d45. 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(): e9f. and *note PyObject_IsSubclass(): +ea0. functions have been sped up in the common case that the second +argument has *note type: d48. as its metaclass. (Contributed Georg +Brandl by in bpo-22540(15).) + +Method caching was slightly improved, yielding up to 5% performance +improvement in some benchmarks. (Contributed by Antoine Pitrou in +bpo-22847(16).) + +Objects from the *note random: b8. module now use 50% less memory on +64-bit builds. (Contributed by Serhiy Storchaka in bpo-23488(17).) + +The *note property(): 194. getter calls are up to 25% faster. +(Contributed by Joe Jevnik in bpo-23910(18).) + +Instantiation of *note fractions.Fraction: 1e9. is now up to 30% faster. +(Contributed by Stefan Behnel in bpo-22464(19).) + +String methods *note find(): ea1, *note rfind(): ea2, *note split(): +ea3, *note partition(): ea4. and the *note in: 2ee. 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: Build and C API Changes<3>, Next: Deprecated<10>, Prev: Optimizations<9>, Up: What’s New In Python 3 5 + +1.9.8 Build and C API Changes +----------------------------- + +New ‘calloc’ functions were added: + + * *note PyMem_RawCalloc(): 38c, + + * *note PyMem_Calloc(): ea6, + + * *note PyObject_Calloc(): ea7. + +(Contributed by Victor Stinner in bpo-21233(1).) + +New encoding/decoding helper functions: + + * *note Py_DecodeLocale(): bc7. (replaced ‘_Py_char2wchar()’), + + * *note Py_EncodeLocale(): bc8. (replaced ‘_Py_wchar2char()’). + +(Contributed by Victor Stinner in bpo-18395(2).) + +A new *note PyCodec_NameReplaceErrors(): ea8. function to replace the +unicode encode error with ‘\N{...}’ escapes. (Contributed by Serhiy +Storchaka in bpo-19676(3).) + +A new *note PyErr_FormatV(): ea9. function similar to *note +PyErr_Format(): eaa, but accepts a ‘va_list’ argument. (Contributed by +Antoine Pitrou in bpo-18711(4).) + +A new *note PyExc_RecursionError: eab. exception. (Contributed by Georg +Brandl in bpo-19235(5).) + +New *note PyModule_FromDefAndSpec(): eac, *note +PyModule_FromDefAndSpec2(): ead, and *note PyModule_ExecDef(): eae. +functions introduced by PEP 489(6) – multi-phase extension module +initialization. (Contributed by Petr Viktorin in bpo-24268(7).) + +New *note PyNumber_MatrixMultiply(): eaf. and *note +PyNumber_InPlaceMatrixMultiply(): eb0. 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: aa6. 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). + +Extension modules now include a platform information tag in their +filename on some platforms (the tag is optional, and CPython will import +extensions without it, although if the tag is present and mismatched, +the extension won’t be loaded): + + * On Linux, extension module filenames end with + ‘.cpython-m--.pyd’: + + * ‘’ is the major number of the Python version; for + Python 3.5 this is ‘3’. + + * ‘’ is the minor number of the Python version; for + Python 3.5 this is ‘5’. + + * ‘’ is the hardware architecture the extension + module was built to run on. It’s most commonly either ‘i386’ + for 32-bit Intel platforms or ‘x86_64’ for 64-bit Intel (and + AMD) platforms. + + * ‘’ is always ‘linux-gnu’, except for extensions built to + talk to the 32-bit ABI on 64-bit platforms, in which case it + is ‘linux-gnu32’ (and ‘’ will be ‘x86_64’). + + * On Windows, extension module filenames end with + ‘.cp-.pyd’: + + * ‘’ is the major number of the Python version; for + Python 3.5 this is ‘3’. + + * ‘’ is the minor number of the Python version; for + Python 3.5 this is ‘5’. + + * ‘’ is the platform the extension module was built + for, either ‘win32’ for Win32, ‘win_amd64’ for Win64, + ‘win_ia64’ for Windows Itanium 64, and ‘win_arm’ for Windows + on ARM. + + * If built in debug mode, ‘’ will be ‘_d’, otherwise it + will be blank. + + * On OS X platforms, extension module filenames now end with + ‘-darwin.so’. + + * On all other platforms, extension module filenames are the same as + they were with 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: Deprecated<10>, Next: Removed<10>, Prev: Build and C API Changes<3>, Up: What’s New In Python 3 5 + +1.9.9 Deprecated +---------------- + +* Menu: + +* New Keywords: New Keywords<2>. +* Deprecated Python Behavior: Deprecated Python Behavior<2>. +* Unsupported Operating Systems:: +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<3>. + + +File: python.info, Node: New Keywords<2>, Next: Deprecated Python Behavior<2>, Up: Deprecated<10> + +1.9.9.1 New Keywords +.................... + +‘async’ and ‘await’ are not recommended to be used as variable, class, +function or module names. Introduced by PEP 492(1) in Python 3.5, they +will become proper keywords in Python 3.7. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0492/ + + +File: python.info, Node: Deprecated Python Behavior<2>, Next: Unsupported Operating Systems, Prev: New Keywords<2>, Up: Deprecated<10> + +1.9.9.2 Deprecated Python Behavior +.................................. + +Raising the *note StopIteration: bfa. exception inside a generator will +now generate a silent *note PendingDeprecationWarning: 8c7, which will +become a non-silent deprecation warning in Python 3.6 and will trigger a +*note RuntimeError: 195. in Python 3.7. See *note PEP 479; Change +StopIteration handling inside generators: d1f. for details. + + +File: python.info, Node: Unsupported Operating Systems, Next: Deprecated Python modules functions and methods<3>, Prev: Deprecated Python Behavior<2>, Up: Deprecated<10> + +1.9.9.3 Unsupported Operating Systems +..................................... + +Windows XP is no longer supported by Microsoft, thus, per PEP 11(1), +CPython 3.5 is no longer officially supported on this OS. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0011/ + + +File: python.info, Node: Deprecated Python modules functions and methods<3>, Prev: Unsupported Operating Systems, Up: Deprecated<10> + +1.9.9.4 Deprecated Python modules, functions and methods +........................................................ + +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(): c76. + +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. + +Directly assigning values to the *note key: c01, *note value: c02. and +*note coded_value: c03. of *note http.cookies.Morsel: c04. objects is +deprecated. Use the *note set(): c05. method instead. In addition, the +undocumented 'LegalChars' parameter of *note set(): c05. is deprecated, +and is now ignored. + +Passing a format string as keyword argument 'format_string' to the *note +format(): c00. method of the *note string.Formatter: eb6. class has been +deprecated. (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).) + +The previously undocumented ‘from_function’ and ‘from_builtin’ methods +of *note inspect.Signature: 1cf. are deprecated. Use the new *note +Signature.from_callable(): 735. method instead. (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: 7e. *note getfullargspec(): 734, *note getcallargs(): +eb7, and ‘formatargspec()’ functions are deprecated in favor of the +*note inspect.signature(): 733. API. (Contributed by Yury Selivanov in +bpo-20438(5).) + +*note getargvalues(): eb8. and *note formatargvalues(): eb9. functions +were inadvertently marked as deprecated with the release of Python +3.5.0. + +Use of *note re.LOCALE: b6c. flag with str patterns or *note re.ASCII: +628. is now deprecated. (Contributed by Serhiy Storchaka in +bpo-22407(6).) + +Use of unrecognized special sequences consisting of ‘'\'’ and an ASCII +letter in regular expression patterns and replacement patterns now +raises a deprecation warning and will be forbidden in Python 3.6. +(Contributed by Serhiy Storchaka in bpo-23622(7).) + +The undocumented and unofficial 'use_load_tests' default argument of the +*note unittest.TestLoader.loadTestsFromModule(): 291. method now is +deprecated and ignored. (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: Removed<10>, Next: Porting to Python 3 5, Prev: Deprecated<10>, Up: What’s New In Python 3 5 + +1.9.10 Removed +-------------- + +* Menu: + +* API and Feature Removals: API and Feature Removals<4>. + + +File: python.info, Node: API and Feature Removals<4>, Up: Removed<10> + +1.9.10.1 API and Feature Removals +................................. + +The following obsolete and previously deprecated APIs and features have +been removed: + + * The ‘__version__’ attribute has been dropped from the email + package. The email code hasn’t been shipped separately from the + stdlib for a long time, and the ‘__version__’ string was not + updated in the last few releases. + + * The internal ‘Netrc’ class in the *note ftplib: 5e. module was + deprecated in 3.4, and has now been removed. (Contributed by Matt + Chaput in bpo-6623(1).) + + * The concept of ‘.pyo’ files has been removed. + + * The JoinableQueue class in the provisional *note asyncio: a. module + was deprecated in 3.4.4 and is now removed. (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: Porting to Python 3 5, Next: Notable changes in Python 3 5 4, Prev: Removed<10>, Up: What’s New In Python 3 5 + +1.9.11 Porting to Python 3.5 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in Python behavior: Changes in Python behavior<2>. +* Changes in the Python API: Changes in the Python API<9>. +* Changes in the C API: Changes in the C API<7>. + + +File: python.info, Node: Changes in Python behavior<2>, Next: Changes in the Python API<9>, Up: Porting to Python 3 5 + +1.9.11.1 Changes in Python behavior +................................... + + * Due to an oversight, earlier Python versions erroneously accepted + the following syntax: + + f(1 for x in [1], *args) + f(1 for x in [1], **kwargs) + + Python 3.5 now correctly raises a *note SyntaxError: 18d, as + generator expressions must be put in parentheses if not a sole + argument to a function. + + +File: python.info, Node: Changes in the Python API<9>, Next: Changes in the C API<7>, Prev: Changes in Python behavior<2>, Up: Porting to Python 3 5 + +1.9.11.2 Changes in the Python API +.................................. + + * PEP 475(1): System calls are now retried when interrupted by a + signal instead of raising *note InterruptedError: d87. if the + Python signal handler does not raise an exception. + + * Before Python 3.5, a *note datetime.time: 1ce. 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(2) for full details. + + * The ‘ssl.SSLSocket.send()’ method now raises either *note + ssl.SSLWantReadError: e64. or *note ssl.SSLWantWriteError: e65. on + a non-blocking socket if the operation would block. Previously, it + would return ‘0’. (Contributed by Nikolaus Rath in bpo-20951(3).) + + * The ‘__name__’ attribute of generators is now set from the function + name, instead of being set from the code name. Use + ‘gen.gi_code.co_name’ to retrieve the code name. Generators also + have a new ‘__qualname__’ attribute, the qualified name, which is + now used for the representation of a generator (‘repr(gen)’). + (Contributed by Victor Stinner in bpo-21205(4).) + + * The deprecated “strict” mode and argument of *note HTMLParser: 874, + ‘HTMLParser.error()’, and the ‘HTMLParserError’ exception have been + removed. (Contributed by Ezio Melotti in bpo-15114(5).) The + 'convert_charrefs' argument of *note HTMLParser: 874. is now ‘True’ + by default. (Contributed by Berker Peksag in bpo-21047(6).) + + * Although it is not formally part of the API, it is worth noting for + porting purposes (ie: fixing tests) that error messages that were + previously of the form “‘sometype’ does not support the buffer + protocol” are now of the form “a *note bytes-like object: d2d. is + required, not ‘sometype’”. (Contributed by Ezio Melotti in + bpo-16518(7).) + + * If the current directory is set to a directory that no longer + exists then *note FileNotFoundError: 427. will no longer be raised + and instead *note find_spec(): ebf. will return ‘None’ 'without' + caching ‘None’ in *note sys.path_importer_cache: 5e0, which is + different than the typical case (bpo-22834(8)). + + * HTTP status code and messages from *note http.client: 6f. and *note + http.server: 72. were refactored into a common *note HTTPStatus: + 8ff. enum. The values in *note http.client: 6f. and *note + http.server: 72. remain available for backwards compatibility. + (Contributed by Demian Brecht in bpo-21793(9).) + + * When an import loader defines + ‘importlib.machinery.Loader.exec_module()’ it is now expected to + also define ‘create_module()’ (raises a *note DeprecationWarning: + 1a5. now, will be an error in Python 3.6). If the loader inherits + from *note importlib.abc.Loader: ec0. then there is nothing to do, + else simply define ‘create_module()’ to return ‘None’. + (Contributed by Brett Cannon in bpo-23014(10).) + + * The *note re.split(): 2a4. function always ignored empty pattern + matches, so the ‘"x*"’ pattern worked the same as ‘"x+"’, and the + ‘"\b"’ pattern never worked. Now *note re.split(): 2a4. raises a + warning if the pattern could match an empty string. For + compatibility, use patterns that never match an empty string (e.g. + ‘"x+"’ instead of ‘"x*"’). Patterns that could only match an empty + string (such as ‘"\b"’) now raise an error. (Contributed by Serhiy + Storchaka in bpo-22818(11).) + + * The *note http.cookies.Morsel: c04. dict-like interface has been + made self consistent: morsel comparison now takes the *note key: + c01. and *note value: c02. into account, *note copy(): ec1. now + results in a *note Morsel: c04. instance rather than a *note dict: + 258, and *note update(): ec2. will now raise an exception if any of + the keys in the update dictionary are invalid. In addition, the + undocumented 'LegalChars' parameter of *note set(): c05. is + deprecated and is now ignored. (Contributed by Demian Brecht in + bpo-2211(12).) + + * PEP 488(13) has removed ‘.pyo’ files from Python and introduced the + optional ‘opt-’ tag in ‘.pyc’ file names. The *note + importlib.util.cache_from_source(): 2f8. 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: cc. module now exports the *note + CAN_RAW_FD_FRAMES: ec3. constant on linux 3.6 and greater. + + * The *note ssl.cert_time_to_seconds(): e66. function now interprets + the input time as UTC and not as local time, per RFC 5280(14). + Additionally, the return value is always an *note int: 259. + (Contributed by Akira Li in bpo-19940(15).) + + * The ‘pygettext.py’ Tool now uses the standard +NNNN format for + timezones in the POT-Creation-Date header. + + * The *note smtplib: ca. module now uses *note sys.stderr: 939. + 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. + + * The *note str.startswith(): ec4. and *note str.endswith(): ec5. + methods no longer return ‘True’ when finding the empty string and + the indexes are completely out of range. (Contributed by Serhiy + Storchaka in bpo-24284(16).) + + * The *note inspect.getdoc(): 9f9. function now returns documentation + strings inherited from base classes. Documentation strings no + longer need to be duplicated if the inherited documentation is + appropriate. To suppress an inherited string, an empty string must + be specified (or the documentation may be filled in). This change + affects the output of the *note pydoc: b5. module and the *note + help(): 8d6. function. (Contributed by Serhiy Storchaka in + bpo-15582(17).) + + * Nested *note functools.partial(): 410. calls are now flattened. If + you were relying on the previous behavior, you can now either add + an attribute to a *note functools.partial(): 410. object or you can + create a subclass of *note functools.partial(): 410. (Contributed + by Alexander Belopolsky in bpo-7830(18).) + + ---------- 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/issue?@action=redirect&bpo=22834 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=21793 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=23014 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=22818 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=2211 + + (13) https://peps.python.org/pep-0488/ + + (14) https://datatracker.ietf.org/doc/html/rfc5280.html + + (15) https://bugs.python.org/issue?@action=redirect&bpo=19940 + + (16) https://bugs.python.org/issue?@action=redirect&bpo=24284 + + (17) https://bugs.python.org/issue?@action=redirect&bpo=15582 + + (18) https://bugs.python.org/issue?@action=redirect&bpo=7830 + + +File: python.info, Node: Changes in the C API<7>, Prev: Changes in the Python API<9>, Up: Porting to Python 3 5 + +1.9.11.3 Changes in the 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: ec7. and a new ‘calloc’ field was added. + + * Removed non-documented macro ‘PyObject_REPR()’ which leaked + references. Use format character ‘%R’ in *note + PyUnicode_FromFormat(): 385.-like functions to format the *note + repr(): 7f9. of the object. (Contributed by Serhiy Storchaka in + bpo-22453(1).) + + * Because the lack of the *note __module__: 36f. attribute breaks + pickling and introspection, a deprecation warning is now raised for + builtin types without the *note __module__: 36f. attribute. This + will be an *note AttributeError: 348. 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: aa5. was replaced with a *note tp_as_async: + ec8. slot. Refer to *note Coroutine Objects: ec9. 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: Porting to Python 3 5, Up: What’s New In Python 3 5 + +1.9.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.9.12.1 New ‘make regen-all’ build target +.......................................... + +To simplify cross-compilation, and to ensure that CPython can reliably +be compiled without requiring an existing version of Python to already +be available, the autotools-based build system no longer attempts to +implicitly recompile generated files based on file modification times. + +Instead, a new ‘make regen-all’ command has been added to force +regeneration of these files when desired (e.g. after an initial version +of Python has already been built based on the pregenerated versions). + +More selective regeneration targets are also defined - see +Makefile.pre.in(1) for details. + +(Contributed by Victor Stinner in bpo-23404(2).) + +Added in version 3.5.4. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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.9.12.2 Removal of ‘make touch’ build target +............................................. + +The ‘make touch’ build target previously used to request implicit +regeneration of generated files by updating their modification times has +been removed. + +It has been replaced by the new ‘make regen-all’ target. + +(Contributed by Victor Stinner in bpo-23404(1).) + +Changed in version 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.10 What’s New In Python 3.4 +============================= + + +Author: R. David Murray <> (Editor) + +This article explains the new features in Python 3.4, compared to 3.3. +Python 3.4 was released on March 16, 2014. For full details, see the +changelog(1). + +See also +........ + +PEP 429(2) – Python 3.4 Release Schedule + +* Menu: + +* Summary – Release Highlights: Summary – Release Highlights<3>. +* New Features: New Features<15>. +* New Modules: New Modules<10>. +* Improved Modules: Improved Modules<10>. +* CPython Implementation Changes:: +* Deprecated: Deprecated<11>. +* Removed: Removed<11>. +* Porting to Python 3.4: Porting to Python 3 4. +* Changed in 3.4.3: Changed in 3 4 3. + + ---------- Footnotes ---------- + + (1) https://docs.python.org/3.4/whatsnew/changelog.html + + (2) https://peps.python.org/pep-0429/ + + +File: python.info, Node: Summary – Release Highlights<3>, Next: New Features<15>, Up: What’s New In Python 3 4 + +1.10.1 Summary – Release Highlights +----------------------------------- + +New syntax features: + + * No new syntax features were added in Python 3.4. + +Other new features: + + * *note pip should always be available: ed0. ( PEP 453(1)). + + * *note Newly created file descriptors are non-inheritable: ed1. ( + PEP 446(2)). + + * command line option for *note isolated mode: ed2. (bpo-16499(3)). + + * *note improvements in the handling of codecs: ed3. that are not + text encodings (multiple issues). + + * *note A ModuleSpec Type: ed4. for the Import System ( PEP 451(4)). + (Affects importer authors.) + + * The *note marshal: 8d. format has been made *note more compact and + efficient: ed5. (bpo-16475(5)). + +New library modules: + + * *note asyncio: a.: *note New provisional API for asynchronous IO: + ed6. ( PEP 3156(6)). + + * *note ensurepip: 55.: *note Bootstrapping the pip installer: ed7. ( + PEP 453(7)). + + * *note enum: 56.: *note Support for enumeration types: ed8. ( PEP + 435(8)). + + * *note pathlib: a4.: *note Object-oriented filesystem paths: ed9. ( + PEP 428(9)). + + * *note selectors: c2.: *note High-level and efficient I/O + multiplexing: eda, built upon the *note select: c1. module + primitives (part of PEP 3156(10)). + + * *note statistics: d2.: A basic *note numerically stable statistics + library: edb. ( PEP 450(11)). + + * *note tracemalloc: ff.: *note Trace Python memory allocations: edc. + ( PEP 454(12)). + +Significantly improved library modules: + + * *note Single-dispatch generic functions: edd. in *note functools: + 5f. ( PEP 443(13)). + + * New *note pickle: a6. *note protocol 4: ede. ( PEP 3154(14)). + + * *note multiprocessing: 94. now has *note an option to avoid using + os.fork on Unix: edf. (bpo-8713(15)). + + * *note email: 3b. has a new submodule, *note contentmanager: 3d, and + a new *note Message: 27e. subclass (‘EmailMessage’) that *note + simplify MIME handling: ee0. (bpo-18891(16)). + + * The *note inspect: 7e. and *note pydoc: b5. modules are now capable + of correct introspection of a much wider variety of callable + objects, which improves the output of the Python *note help(): 8d6. + system. + + * The *note ipaddress: 80. module API has been declared stable + +Security improvements: + + * *note Secure and interchangeable hash algorithm: ee1. ( PEP + 456(17)). + + * *note Make newly created file descriptors non-inheritable: ed1. ( + PEP 446(18)) to avoid leaking file descriptors to child processes. + + * New command line option for *note isolated mode: ed2, + (bpo-16499(19)). + + * *note multiprocessing: 94. now has *note an option to avoid using + os.fork on Unix: edf. 'spawn' and 'forkserver' are more secure + because they avoid sharing data with child processes. + + * *note multiprocessing: 94. child processes on Windows no longer + inherit all of the parent’s inheritable handles, only the necessary + ones. + + * A new *note hashlib.pbkdf2_hmac(): 50a. function provides the + PKCS#5 password-based key derivation function 2(20). + + * *note TLSv1.1 and TLSv1.2 support: ee2. for *note ssl: d0. + + * *note Retrieving certificates from the Windows system cert store + support: ee3. for *note ssl: d0. + + * *note Server-side SNI (Server Name Indication) support: ee4. for + *note ssl: d0. + + * The *note ssl.SSLContext: 296. class has a *note lot of + improvements: ee5. + + * 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(): ee6.). + +CPython implementation improvements: + + * *note Safe object finalization: ee7. ( PEP 442(21)). + + * Leveraging PEP 442(22), in most cases *note module globals are no + longer set to None during finalization: ee7. (bpo-18214(23)). + + * *note Configurable memory allocators: ee8. ( PEP 445(24)). + + * *note Argument Clinic: ee9. ( PEP 436(25)). + +Please read on for a comprehensive list of user-facing changes, +including many other smaller improvements, CPython optimizations, +deprecations, and potential porting issues. + + ---------- 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: New Features<15>, Next: New Modules<10>, Prev: Summary – Release Highlights<3>, Up: What’s New In Python 3 4 + +1.10.2 New Features +------------------- + +* Menu: + +* PEP 453; Explicit Bootstrapping of PIP in Python Installations: PEP 453 Explicit Bootstrapping of PIP in Python Installations. +* PEP 446; Newly Created File Descriptors Are Non-Inheritable: PEP 446 Newly Created File Descriptors Are Non-Inheritable. +* Improvements to Codec Handling:: +* PEP 451; A ModuleSpec Type for the Import System: PEP 451 A ModuleSpec Type for the Import System. +* Other Language Changes: Other Language Changes<10>. + + +File: python.info, Node: PEP 453 Explicit Bootstrapping of PIP in Python Installations, Next: PEP 446 Newly Created File Descriptors Are Non-Inheritable, Up: New Features<15> + +1.10.2.1 PEP 453: Explicit Bootstrapping of PIP in Python Installations +....................................................................... + +* Menu: + +* Bootstrapping pip By Default:: +* Documentation Changes:: + + +File: python.info, Node: Bootstrapping pip By Default, Next: Documentation Changes, Up: PEP 453 Explicit Bootstrapping of PIP in Python Installations + +1.10.2.2 Bootstrapping pip By Default +..................................... + +The new *note ensurepip: 55. module (defined in PEP 453(1)) provides a +standard cross-platform mechanism to bootstrap the pip installer into +Python installations and virtual environments. The version of ‘pip’ +included with Python 3.4.0 is ‘pip’ 1.5.4, and future 3.4.x maintenance +releases will update the bundled version to the latest version of ‘pip’ +that is available at the time of creating the release candidate. + +By default, the commands ‘pipX’ and ‘pipX.Y’ will be installed on all +platforms (where X.Y stands for the version of the Python installation), +along with the ‘pip’ Python package and its dependencies. On Windows +and in virtual environments on all platforms, the unversioned ‘pip’ +command will also be installed. On other platforms, the system wide +unversioned ‘pip’ command typically refers to the separately installed +Python 2 version. + +The ‘pyvenv’ command line utility and the *note venv: 111. module make +use of the *note ensurepip: 55. module to make ‘pip’ readily available +in virtual environments. When using the command line utility, ‘pip’ is +installed by default, while when using the *note venv: 111. module *note +API: eed. installation of ‘pip’ must be requested explicitly. + +For CPython *note source builds on POSIX systems: eee, the ‘make +install’ and ‘make altinstall’ commands bootstrap ‘pip’ by default. +This behaviour can be controlled through configure options, and +overridden through Makefile options. + +On Windows and Mac OS X, the CPython installers now default to +installing ‘pip’ along with CPython itself (users may opt out of +installing it during the installation process). Window users will need +to opt in to the automatic ‘PATH’ modifications to have ‘pip’ available +from the command line by default, otherwise it can still be accessed +through the Python launcher for Windows as ‘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). + + Note: To avoid conflicts between parallel Python 2 and Python 3 + installations, only the versioned ‘pip3’ and ‘pip3.4’ commands are + bootstrapped by default when ‘ensurepip’ is invoked directly - the + ‘--default-pip’ option is needed to also request the unversioned + ‘pip’ command. ‘pyvenv’ and the Windows installer ensure that the + unqualified ‘pip’ command is made available in those environments, + and ‘pip’ can always be invoked via the ‘-m’ switch rather than + directly to avoid ambiguity on systems with multiple Python + installations. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0453/ + + (2) +https://peps.python.org/pep-0453/#recommendations-for-downstream-distributors + + +File: python.info, Node: Documentation Changes, Prev: Bootstrapping pip By Default, Up: PEP 453 Explicit Bootstrapping of PIP in Python Installations + +1.10.2.3 Documentation Changes +.............................. + +As part of this change, the *note Installing Python Modules: ef0. and +distributing-index sections of the documentation have been completely +redesigned as short getting started and FAQ documents. Most packaging +documentation has now been moved out to the Python Packaging Authority +maintained Python Packaging User Guide(1) and the documentation of the +individual projects. + +However, as this migration is currently still incomplete, the legacy +versions of those guides remaining available as *note Building C and C++ +Extensions with setuptools: ef1. and *note Building C and C++ Extensions +with setuptools: ef2. + +See also +........ + +PEP 453(2) – Explicit bootstrapping of pip in Python installations + + PEP written by Donald Stufft and Nick Coghlan, implemented by + Donald Stufft, Nick Coghlan, Martin von Löwis and Ned Deily. + + ---------- Footnotes ---------- + + (1) https://packaging.python.org + + (2) https://peps.python.org/pep-0453/ + + +File: python.info, Node: PEP 446 Newly Created File Descriptors Are Non-Inheritable, Next: Improvements to Codec Handling, Prev: PEP 453 Explicit Bootstrapping of PIP in Python Installations, Up: New Features<15> + +1.10.2.4 PEP 446: Newly Created File Descriptors Are Non-Inheritable +.................................................................... + +PEP 446(1) makes newly created file descriptors *note non-inheritable: +ef4. In general, this is the behavior an application will want: when +launching a new process, having currently open files also open in the +new process can lead to all sorts of hard to find bugs, and potentially +to security issues. + +However, there are occasions when inheritance is desired. To support +these cases, the following new functions and methods are available: + + * *note os.get_inheritable(): ef5, *note os.set_inheritable(): ef6. + + * *note os.get_handle_inheritable(): ef7, *note + os.set_handle_inheritable(): ef8. + + * *note socket.socket.get_inheritable(): ef9, *note + socket.socket.set_inheritable(): efa. + +See also +........ + +PEP 446(2) – Make newly created file descriptors non-inheritable + + 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: Improvements to Codec Handling, Next: PEP 451 A ModuleSpec Type for the Import System, Prev: PEP 446 Newly Created File Descriptors Are Non-Inheritable, Up: New Features<15> + +1.10.2.5 Improvements to Codec Handling +....................................... + +Since it was first introduced, the *note codecs: 1b. module has always +been intended to operate as a type-neutral dynamic encoding and decoding +system. However, its close coupling with the Python text model, +especially the type restricted convenience methods on the builtin *note +str: 447, *note bytes: 1c2. and *note bytearray: 53a. types, has +historically obscured that fact. + +As a key step in clarifying the situation, the *note codecs.encode(): +efc. and *note codecs.decode(): efd. convenience functions are now +properly documented in Python 2.7, 3.3 and 3.4. These functions have +existed in the *note codecs: 1b. module (and have been covered by the +regression test suite) since Python 2.4, but were previously only +discoverable through runtime introspection. + +Unlike the convenience methods on *note str: 447, *note bytes: 1c2. and +*note bytearray: 53a, the *note codecs: 1b. convenience functions +support arbitrary codecs in both Python 2 and Python 3, rather than +being limited to Unicode text encodings (in Python 3) or ‘basestring’ +<-> ‘basestring’ conversions (in Python 2). + +In Python 3.4, the interpreter is able to identify the known non-text +encodings provided in the standard library and direct users towards +these general purpose convenience functions when appropriate: + + >>> b"abcdef".decode("hex") + Traceback (most recent call last): + File "", line 1, in + LookupError: 'hex' is not a text encoding; use codecs.decode() to handle arbitrary codecs + + >>> "hello".encode("rot13") + Traceback (most recent call last): + File "", line 1, in + 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 "", line 1, in + LookupError: 'hex' is not a text encoding; use codecs.open() to handle arbitrary codecs + +In a related change, whenever it is feasible without breaking backwards +compatibility, exceptions raised during encoding and decoding operations +are wrapped in a chained exception of the same type that mentions the +name of the codec responsible for producing the error: + + >>> 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 "", line 1, in + 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 "", line 1, in + TypeError: encoding with 'bz2' codec failed (TypeError: 'str' does not support the buffer interface) + +Finally, as the examples above show, these improvements have permitted +the restoration of the convenience aliases for the non-Unicode codecs +that were themselves restored in Python 3.2. This means that encoding +binary data to and from its hexadecimal representation (for example) can +now be written as: + + >>> from codecs import encode, decode + >>> encode(b"hello", "hex") + b'68656c6c6f' + >>> decode(b"68656c6c6f", "hex") + b'hello' + +The binary and text transforms provided in the standard library are +detailed in *note Binary Transforms: efe. and *note Text Transforms: +eff. + +(Contributed by Nick Coghlan in bpo-7475(1), bpo-17827(2), bpo-17828(3) +and bpo-19619(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=7475 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=17827 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=17828 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=19619 + + +File: python.info, Node: PEP 451 A ModuleSpec Type for the Import System, Next: Other Language Changes<10>, Prev: Improvements to Codec Handling, Up: New Features<15> + +1.10.2.6 PEP 451: A ModuleSpec Type for the Import System +......................................................... + +PEP 451(1) provides an encapsulation of the information about a module +that the import machinery will use to load it (that is, a module +specification). This helps simplify both the import implementation and +several import-related APIs. The change is also a stepping stone for +several future import-related improvements(2). + +The public-facing changes from the PEP are entirely backward-compatible. +Furthermore, they should be transparent to everyone but importer +authors. Key finder and loader methods have been deprecated, but they +will continue working. New importers should use the new methods +described in the PEP. Existing importers should be updated to implement +the new methods. See the *note Deprecated: f01. section for a list of +methods that should be replaced and their replacements. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0451/ + + (2) +https://mail.python.org/pipermail/python-dev/2013-November/130111.html + + +File: python.info, Node: Other Language Changes<10>, Prev: PEP 451 A ModuleSpec Type for the Import System, Up: New Features<15> + +1.10.2.7 Other Language Changes +............................... + +Some smaller changes made to the core Python language are: + + * Unicode database updated to UCD version 6.3. + + * *note min(): f03. and *note max(): f04. now accept a 'default' + keyword-only argument that can be used to specify the value they + return if the iterable they are evaluating has no elements. + (Contributed by Julian Berman in bpo-18111(1).) + + * Module objects are now *note weakly referenceable: f05. + + * Module ‘__file__’ attributes (and related values) should now always + contain absolute paths by default, with the sole exception of + ‘__main__.__file__’ when a script has been executed directly using + a relative path. (Contributed by Brett Cannon in bpo-18416(2).) + + * All the UTF-* codecs (except UTF-7) now reject surrogates during + both encoding and decoding unless the ‘surrogatepass’ error handler + is used, with the exception of the UTF-16 decoder (which accepts + valid surrogate pairs) and the UTF-16 encoder (which produces them + while encoding non-BMP characters). (Contributed by Victor + Stinner, Kang-Hao (Kenny) Lu and Serhiy Storchaka in bpo-12892(3).) + + * New German EBCDIC *note codec: db8. ‘cp273’. (Contributed by + Michael Bierenfeld and Andrew Kuchling in bpo-1097797(4).) + + * New Ukrainian *note codec: db8. ‘cp1125’. (Contributed by Serhiy + Storchaka in bpo-19668(5).) + + * *note bytes: 1c2.join() and *note bytearray: 53a.join() now accept + arbitrary buffer objects as arguments. (Contributed by Antoine + Pitrou in bpo-15958(6).) + + * The *note int: 259. constructor now accepts any object that has an + ‘__index__’ method for its 'base' argument. (Contributed by Mark + Dickinson in bpo-16772(7).) + + * Frame objects now have a *note clear(): 282. method that clears all + references to local variables from the frame. (Contributed by + Antoine Pitrou in bpo-17934(8).) + + * *note memoryview: 464. is now registered as a *note Sequence: 1e, + and supports the *note reversed(): 862. builtin. (Contributed by + Nick Coghlan and Claudiu Popa in bpo-18690(9) and bpo-19078(10).) + + * Signatures reported by *note help(): 8d6. have been modified and + improved in several cases as a result of the introduction of + Argument Clinic and other changes to the *note inspect: 7e. and + *note pydoc: b5. modules. + + * *note __length_hint__(): f06. is now part of the formal language + specification (see PEP 424(11)). (Contributed by Armin Ronacher in + bpo-16148(12).) + + ---------- 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=17934 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=18690 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=19078 + + (11) https://peps.python.org/pep-0424/ + + (12) https://bugs.python.org/issue?@action=redirect&bpo=16148 + + +File: python.info, Node: New Modules<10>, Next: Improved Modules<10>, Prev: New Features<15>, Up: What’s New In Python 3 4 + +1.10.3 New Modules +------------------ + +* Menu: + +* asyncio: asyncio<11>. +* ensurepip: ensurepip<2>. +* enum: enum<9>. +* pathlib: pathlib<11>. +* selectors: selectors<2>. +* statistics: statistics<6>. +* tracemalloc: tracemalloc<4>. + + +File: python.info, Node: asyncio<11>, Next: ensurepip<2>, Up: New Modules<10> + +1.10.3.1 asyncio +................ + +The new *note asyncio: a. module (defined in PEP 3156(1)) provides a +standard pluggable event loop model for Python, providing solid +asynchronous IO support in the standard library, and making it easier +for other event loop implementations to interoperate with the standard +library and each other. + +For Python 3.4, this module is considered a *note provisional API: b03. + +See also +........ + +PEP 3156(2) – Asynchronous IO Support Rebooted: the “asyncio” Module + + PEP written and implementation led by Guido van Rossum. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3156/ + + (2) https://peps.python.org/pep-3156/ + + +File: python.info, Node: ensurepip<2>, Next: enum<9>, Prev: asyncio<11>, Up: New Modules<10> + +1.10.3.2 ensurepip +.................. + +The new *note ensurepip: 55. module is the primary infrastructure for +the PEP 453(1) implementation. In the normal course of events end users +will not need to interact with this module, but it can be used to +manually bootstrap ‘pip’ if the automated bootstrapping into an +installation or virtual environment was declined. + +*note ensurepip: 55. includes a bundled copy of ‘pip’, up-to-date as of +the first release candidate of the release of CPython with which it +ships (this applies to both maintenance releases and feature releases). +‘ensurepip’ does not access the internet. If the installation has +internet access, after ‘ensurepip’ is run the bundled ‘pip’ can be used +to upgrade ‘pip’ to a more recent release than the bundled one. (Note +that such an upgraded version of ‘pip’ is considered to be a separately +installed package and will not be removed if Python is uninstalled.) + +The module is named 'ensure'pip because if called when ‘pip’ is already +installed, it does nothing. It also has an ‘--upgrade’ option that will +cause it to install the bundled copy of ‘pip’ if the existing installed +version of ‘pip’ is older than the bundled copy. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0453/ + + +File: python.info, Node: enum<9>, Next: pathlib<11>, Prev: ensurepip<2>, Up: New Modules<10> + +1.10.3.3 enum +............. + +The new *note enum: 56. module (defined in PEP 435(1)) provides a +standard implementation of enumeration types, allowing other modules +(such as *note socket: cc.) to provide more informative error messages +and better debugging support by replacing opaque integer constants with +backwards compatible enumeration values. + +See also +........ + +PEP 435(2) – Adding an Enum type to the Python standard library + + 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<11>, Next: selectors<2>, Prev: enum<9>, Up: New Modules<10> + +1.10.3.4 pathlib +................ + +The new *note pathlib: a4. module offers classes representing filesystem +paths with semantics appropriate for different operating systems. Path +classes are divided between 'pure paths', which provide purely +computational operations without I/O, and 'concrete paths', which +inherit from pure paths but also provide I/O operations. + +For Python 3.4, this module is considered a *note provisional API: b03. + +See also +........ + +PEP 428(1) – The pathlib module – object-oriented filesystem paths + + 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<11>, Up: New Modules<10> + +1.10.3.5 selectors +.................. + +The new *note selectors: c2. module (created as part of implementing PEP +3156(1)) allows high-level and efficient I/O multiplexing, built upon +the *note select: c1. module primitives. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3156/ + + +File: python.info, Node: statistics<6>, Next: tracemalloc<4>, Prev: selectors<2>, Up: New Modules<10> + +1.10.3.6 statistics +................... + +The new *note statistics: d2. module (defined in PEP 450(1)) offers some +core statistics functionality directly in the standard library. This +module supports calculation of the mean, median, mode, variance and +standard deviation of a data series. + +See also +........ + +PEP 450(2) – Adding A Statistics Module To The Standard Library + + 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: New Modules<10> + +1.10.3.7 tracemalloc +.................... + +The new *note tracemalloc: ff. module (defined in PEP 454(1)) is a debug +tool to trace memory blocks allocated by Python. It provides the +following information: + + * Trace where an object was allocated + + * Statistics on allocated memory blocks per filename and per line + number: total size, number and average size of allocated memory + blocks + + * Compute the differences between two snapshots to detect memory + leaks + +See also +........ + +PEP 454(2) – Add a new tracemalloc module to trace Python memory allocations + + 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: Improved Modules<10>, Next: CPython Implementation Changes, Prev: New Modules<10>, Up: What’s New In Python 3 4 + +1.10.4 Improved Modules +----------------------- + +* Menu: + +* abc:: +* aifc: aifc<2>. +* argparse: argparse<5>. +* audioop:: +* base64: base64<3>. +* collections: collections<6>. +* colorsys:: +* contextlib: contextlib<6>. +* dbm: dbm<6>. +* dis: dis<4>. +* doctest: doctest<4>. +* email: email<4>. +* filecmp:: +* functools: functools<5>. +* gc: gc<5>. +* glob: glob<4>. +* hashlib: hashlib<6>. +* hmac: hmac<3>. +* html:: +* http: http<3>. +* idlelib and IDLE: idlelib and IDLE<4>. +* importlib: importlib<9>. +* inspect: inspect<8>. +* ipaddress: ipaddress<5>. +* logging: logging<6>. +* marshal: marshal<2>. +* mmap: mmap<3>. +* multiprocessing: multiprocessing<7>. +* operator: operator<3>. +* os: os<11>. +* pdb: pdb<6>. +* pickle: pickle<4>. +* plistlib: plistlib<2>. +* poplib: poplib<3>. +* pprint: pprint<4>. +* pty:: +* pydoc: pydoc<4>. +* re: re<8>. +* resource:: +* select:: +* shelve: shelve<2>. +* shutil: shutil<6>. +* smtpd: smtpd<3>. +* smtplib: smtplib<3>. +* socket: socket<9>. +* sqlite3: sqlite3<9>. +* ssl: ssl<10>. +* stat:: +* struct: struct<2>. +* subprocess: subprocess<5>. +* sunau: sunau<2>. +* sys: sys<12>. +* tarfile: tarfile<8>. +* textwrap:: +* threading: threading<7>. +* traceback: traceback<6>. +* types: types<6>. +* urllib: urllib<3>. +* unittest: unittest<9>. +* venv: venv<7>. +* wave: wave<2>. +* weakref: weakref<2>. +* xml.etree: xml etree<2>. +* zipfile: zipfile<5>. + + +File: python.info, Node: abc, Next: aifc<2>, Up: Improved Modules<10> + +1.10.4.1 abc +............ + +New function *note abc.get_cache_token(): f11. can be used to know when +to invalidate caches that are affected by changes in the object graph. +(Contributed by Łukasz Langa in bpo-16832(1).) + +New class *note ABC: f12. has *note ABCMeta: f13. as its meta class. +Using ‘ABC’ as a base class has essentially the same effect as +specifying ‘metaclass=abc.ABCMeta’, but is simpler to type and easier to +read. (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<5>, Prev: abc, Up: Improved Modules<10> + +1.10.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: 5ce. 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: d2d. (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<5>, Next: audioop, Prev: aifc<2>, Up: Improved Modules<10> + +1.10.4.3 argparse +................. + +The *note FileType: f16. class now accepts 'encoding' and 'errors' +arguments, which are passed through to *note open(): 517. (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<3>, Prev: argparse<5>, Up: Improved Modules<10> + +1.10.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: d2d. +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<3>, Next: collections<6>, Prev: audioop, Up: Improved Modules<10> + +1.10.4.5 base64 +............... + +The encoding and decoding functions in *note base64: e. now accept any +*note bytes-like object: d2d. in cases where it previously required a +*note bytes: 1c2. or *note bytearray: 53a. instance. (Contributed by +Nick Coghlan in bpo-17839(1).) + +New functions *note a85encode(): f19, *note a85decode(): f1a, *note +b85encode(): f1b, and *note b85decode(): f1c. provide the ability to +encode and decode binary data from and to ‘Ascii85’ and the +git/mercurial ‘Base85’ formats, respectively. The ‘a85’ functions have +options that can be used to make them compatible with the variants of +the ‘Ascii85’ encoding, including the Adobe variant. (Contributed by +Martin Morrison, the Mercurial project, Serhiy Storchaka, and Antoine +Pitrou in bpo-17618(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17839 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=17618 + + +File: python.info, Node: collections<6>, Next: colorsys, Prev: base64<3>, Up: Improved Modules<10> + +1.10.4.6 collections +.................... + +The *note ChainMap.new_child(): f1e. method now accepts an 'm' argument +specifying the child map to add to the chain. This allows an existing +mapping and/or a custom mapping type to be used for the child. +(Contributed by Vinay Sajip in bpo-16613(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16613 + + +File: python.info, Node: colorsys, Next: contextlib<6>, Prev: collections<6>, Up: Improved Modules<10> + +1.10.4.7 colorsys +................. + +The number of digits in the coefficients for the RGB — YIQ conversions +have been expanded so that they match the FCC NTSC versions. The change +in results should be less than 1% and may better match results found +elsewhere. (Contributed by Brian Landers and Serhiy Storchaka in +bpo-14323(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14323 + + +File: python.info, Node: contextlib<6>, Next: dbm<6>, Prev: colorsys, Up: Improved Modules<10> + +1.10.4.8 contextlib +................... + +The new *note contextlib.suppress: f21. context manager helps to clarify +the intent of code that deliberately suppresses exceptions from a single +statement. (Contributed by Raymond Hettinger in bpo-15806(1) and Zero +Piraeus in bpo-19266(2).) + +The new *note contextlib.redirect_stdout(): de7. context manager makes +it easier for utility scripts to handle inflexible APIs that write their +output to *note sys.stdout: ad6. and don’t provide any options to +redirect it. Using the context manager, the *note sys.stdout: ad6. +output can be redirected to any other stream or, in conjunction with +*note io.StringIO: f22, to a string. The latter can be especially +useful, for example, to capture output from a function that was written +to implement a command line interface. It is recommended only for +utility scripts because it affects the global state of *note sys.stdout: +ad6. (Contributed by Raymond Hettinger in bpo-15805(3).) + +The *note contextlib: 23. documentation has also been updated to include +a *note discussion: f23. of the differences between single use, reusable +and reentrant context managers. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15806 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=19266 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=15805 + + +File: python.info, Node: dbm<6>, Next: dis<4>, Prev: contextlib<6>, Up: Improved Modules<10> + +1.10.4.9 dbm +............ + +*note dbm.open(): f25. objects now support the context management +protocol. When used in a *note with: 5ce. statement, the ‘close’ method +of the database object will be called automatically at the end of the +block. (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<4>, Next: doctest<4>, Prev: dbm<6>, Up: Improved Modules<10> + +1.10.4.10 dis +............. + +Functions *note show_code(): f27, *note dis(): b34, ‘distb()’, and *note +disassemble(): f28. now accept a keyword-only 'file' argument that +controls where they write their output. + +The *note dis: 38. module is now built around an *note Instruction: 1dc. +class that provides object oriented access to the details of each +individual bytecode operation. + +A new method, *note get_instructions(): 1db, provides an iterator that +emits the Instruction stream for a given piece of Python code. Thus it +is now possible to write a program that inspects and manipulates a +bytecode object in ways different from those provided by the *note dis: +38. module itself. For example: + + >>> import dis + >>> for instr in dis.get_instructions(lambda x: x + 1): + ... print(instr.opname) + LOAD_FAST + LOAD_CONST + BINARY_ADD + RETURN_VALUE + +The various display tools in the *note dis: 38. module have been +rewritten to use these new components. + +In addition, a new application-friendly class *note Bytecode: f29. +provides an object-oriented API for inspecting bytecode in both in +human-readable form and for iterating over instructions. The *note +Bytecode: f29. constructor takes the same arguments that +‘get_instruction()’ does (plus an optional 'current_offset'), and the +resulting object can be iterated to produce *note Instruction: 1dc. +objects. But it also has a *note dis: f2a. method, equivalent to +calling *note dis: b34. 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: f29. also has a class method, *note from_traceback(): +f2b, that provides the ability to manipulate a traceback (that is, +‘print(Bytecode.from_traceback(tb).dis())’ is equivalent to +‘distb(tb)’). + +(Contributed by Nick Coghlan, Ryan Kelly and Thomas Kluyver in +bpo-11816(1) and Claudiu Popa in bpo-17916(2).) + +New function *note stack_effect(): f2c. computes the effect on the +Python stack of a given opcode and argument, information that is not +otherwise available. (Contributed by Larry Hastings in bpo-19722(3).) + + ---------- 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 + + +File: python.info, Node: doctest<4>, Next: email<4>, Prev: dis<4>, Up: Improved Modules<10> + +1.10.4.11 doctest +................. + +A new *note option flag: f2e, *note FAIL_FAST: f2f, halts test running +as soon as the first failure is detected. (Contributed by R. David +Murray and Daniel Urban in bpo-16522(1).) + +The *note doctest: 3a. command line interface now uses *note argparse: +6, and has two new options, ‘-o’ and ‘-f’. ‘-o’ allows *note doctest +options: f2e. to be specified on the command line, and ‘-f’ is a +shorthand for ‘-o FAIL_FAST’ (to parallel the similar option supported +by the *note unittest: 106. CLI). (Contributed by R. David Murray in +bpo-11390(2).) + +*note doctest: 3a. will now find doctests in extension module ‘__doc__’ +strings. (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<4>, Next: filecmp, Prev: doctest<4>, Up: Improved Modules<10> + +1.10.4.12 email +............... + +*note as_string(): f31. now accepts a 'policy' argument to override the +default policy of the message when generating a string representation of +it. This means that ‘as_string’ can now be used in more circumstances, +instead of having to create and use a *note generator: 40. in order to +pass formatting parameters to its ‘flatten’ method. (Contributed by R. +David Murray in bpo-18600(1).) + +New method *note as_bytes(): f32. added to produce a bytes +representation of the message in a fashion similar to how ‘as_string’ +produces a string representation. It does not accept the 'maxheaderlen' +argument, but does accept the 'unixfrom' and 'policy' arguments. The +*note Message: 27e. *note __bytes__(): f33. method calls it, meaning +that ‘bytes(mymsg)’ will now produce the intuitive result: a bytes +object containing the fully formatted message. (Contributed by R. David +Murray in bpo-18600(2).) + +The *note Message.set_param(): f34. message now accepts a 'replace' +keyword argument. When specified, the associated header will be updated +without changing its location in the list of headers. For backward +compatibility, the default is ‘False’. (Contributed by R. David Murray +in bpo-18891(3).) A pair of new subclasses of *note Message: 27e. have +been added (*note EmailMessage: 27d. and *note MIMEPart: f35.), along +with a new sub-module, *note contentmanager: 3d. and a new *note policy: +4f. attribute *note content_manager: f36. All documentation is +currently in the new module, which is being added as part of email’s new +*note provisional API: b03. These classes provide a number of new +methods that make extracting content from and inserting content into +email messages much easier. For details, see the *note contentmanager: +3d. documentation and the *note email; Examples: f37. These API +additions complete the bulk of the work that was planned as part of the +email6 project. The currently provisional API is scheduled to become +final in Python 3.5 (possibly with a few minor additions in the area of +error handling). (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<5>, Prev: email<4>, Up: Improved Modules<10> + +1.10.4.13 filecmp +................. + +A new *note clear_cache(): f39. function provides the ability to clear +the *note filecmp: 5a. comparison cache, which uses *note os.stat(): +49c. information to determine if the file has changed since the last +compare. This can be used, for example, if the file might have been +changed and re-checked in less time than the resolution of a particular +filesystem’s file modification time field. (Contributed by Mark Levitt +in bpo-18149(1).) + +New module attribute *note DEFAULT_IGNORES: f3a. provides the list of +directories that are used as the default value for the 'ignore' +parameter of the *note dircmp(): f3b. 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<5>, Next: gc<5>, Prev: filecmp, Up: Improved Modules<10> + +1.10.4.14 functools +................... + +The new *note partialmethod(): a7b. descriptor brings partial argument +application to descriptors, just as *note partial(): 410. provides for +normal callables. The new descriptor also makes it easier to get +arbitrary callables (including *note partial(): 410. instances) to +behave like normal instance methods when included in a class definition. +(Contributed by Alon Horev and Nick Coghlan in bpo-4331(1).) The new +*note singledispatch(): 635. decorator brings support for +single-dispatch generic functions to the Python standard library. Where +object oriented programming focuses on grouping multiple operations on a +common set of data into a class, a generic function focuses on grouping +multiple implementations of an operation that allows it to work with +'different' kinds of data. + +See also +........ + +PEP 443(2) – Single-dispatch generic functions + + PEP written and implemented by Łukasz Langa. + +*note total_ordering(): f3d. now supports a return value of *note +NotImplemented: 7cd. from the underlying comparison function. +(Contributed by Katie Miller in bpo-10042(3).) + +A pure-python version of the *note partial(): 410. function is now in +the stdlib; in CPython it is overridden by the C accelerated version, +but it is available for other implementations to use. (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<5>, Next: glob<4>, Prev: functools<5>, Up: Improved Modules<10> + +1.10.4.15 gc +............ + +New function *note get_stats(): f3f. returns a list of three +per-generation dictionaries containing the collections statistics since +interpreter startup. (Contributed by Antoine Pitrou in bpo-16351(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16351 + + +File: python.info, Node: glob<4>, Next: hashlib<6>, Prev: gc<5>, Up: Improved Modules<10> + +1.10.4.16 glob +.............. + +A new function *note escape(): f41. provides a way to escape special +characters in a filename so that they do not become part of the globbing +expansion but are instead matched literally. (Contributed by Serhiy +Storchaka in bpo-8402(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8402 + + +File: python.info, Node: hashlib<6>, Next: hmac<3>, Prev: glob<4>, Up: Improved Modules<10> + +1.10.4.17 hashlib +................. + +A new *note hashlib.pbkdf2_hmac(): 50a. function provides the PKCS#5 +password-based key derivation function 2(1). (Contributed by Christian +Heimes in bpo-18582(2).) + +The *note name: f43. attribute of *note hashlib: 68. hash objects is now +a formally supported interface. It has always existed in CPython’s +*note hashlib: 68. (although it did not return lower case names for all +supported hashes), but it was not a public interface and so some other +Python implementations have not previously supported it. (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<3>, Next: html, Prev: hashlib<6>, Up: Improved Modules<10> + +1.10.4.18 hmac +.............. + +*note hmac: 6a. now accepts ‘bytearray’ as well as ‘bytes’ for the 'key' +argument to the *note new(): a9f. function, and the 'msg' parameter to +both the *note new(): a9f. function and the *note update(): f45. method +now accepts any type supported by the *note hashlib: 68. module. +(Contributed by Jonas Borgström in bpo-18240(1).) + +The 'digestmod' argument to the *note hmac.new(): a9f. function may now +be any hash digest name recognized by *note hashlib: 68. In addition, +the current behavior in which the value of 'digestmod' defaults to ‘MD5’ +is deprecated: in a future version of Python there will be no default +value. (Contributed by Christian Heimes in bpo-17276(2).) + +With the addition of *note block_size: f46. and *note name: f47. +attributes (and the formal documentation of the *note digest_size: f48. +attribute), the *note hmac: 6a. module now conforms fully to the 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<3>, Prev: hmac<3>, Up: Improved Modules<10> + +1.10.4.19 html +.............. + +New function *note unescape(): 957. function converts HTML5 character +references to the corresponding Unicode characters. (Contributed by +Ezio Melotti in bpo-2927(1).) + +*note HTMLParser: 874. accepts a new keyword argument 'convert_charrefs' +that, when ‘True’, automatically converts all character references. For +backward-compatibility, its value defaults to ‘False’, but it will +change to ‘True’ in a future version of Python, so you are invited to +set it explicitly and update your code to use this new feature. +(Contributed by Ezio Melotti in bpo-13633(2).) + +The 'strict' argument of *note HTMLParser: 874. is now deprecated. +(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<3>, Next: idlelib and IDLE<4>, Prev: html, Up: Improved Modules<10> + +1.10.4.20 http +.............. + +*note send_error(): f4b. 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 ‘error_message_format’ attribute +and sent as the body of the error response. (Contributed by Karl Cow in +bpo-12921(1).) + +The *note http.server: 72. *note command line interface: f4c. now has a +‘-b/--bind’ option that causes the server to listen on a specific +address. (Contributed by Malte Swart in bpo-17764(2).) + + ---------- 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 and IDLE<4>, Next: importlib<9>, Prev: http<3>, Up: Improved Modules<10> + +1.10.4.21 idlelib and IDLE +.......................... + +Since idlelib implements the IDLE shell and editor and is not intended +for import by other programs, it gets improvements with every release. +See ‘Lib/idlelib/NEWS.txt’ for a cumulative list of changes since 3.3.0, +as well as changes made in future 3.4.x releases. This file is also +available from the IDLE Help ‣ About IDLE dialog. + + +File: python.info, Node: importlib<9>, Next: inspect<8>, Prev: idlelib and IDLE<4>, Up: Improved Modules<10> + +1.10.4.22 importlib +................... + +The *note InspectLoader: f4f. ABC defines a new method, *note +source_to_code(): e10. that accepts source data and a path and returns a +code object. The default implementation is equivalent to ‘compile(data, +path, 'exec', dont_inherit=True)’. (Contributed by Eric Snow and Brett +Cannon in bpo-15627(1).) + +*note InspectLoader: f4f. also now has a default implementation for the +*note get_code(): f50. method. However, it will normally be desirable +to override the default implementation for performance reasons. +(Contributed by Brett Cannon in bpo-18072(2).) + +The *note reload(): 514. function has been moved from ‘imp’ to *note +importlib: 77. as part of the ‘imp’ module deprecation. (Contributed by +Berker Peksag in bpo-18193(3).) + +*note importlib.util: 7d. now has a *note MAGIC_NUMBER: 50e. 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: 7d. functions *note cache_from_source(): 2f8. +and *note source_from_cache(): 515. replace the same-named functions in +the deprecated ‘imp’ module. (Contributed by Brett Cannon in +bpo-18194(5).) + +The *note importlib: 77. bootstrap *note NamespaceLoader: f51. now +conforms to the *note InspectLoader: f4f. ABC, which means that ‘runpy’ +and ‘python -m’ can now be used with namespace packages. (Contributed +by Brett Cannon in bpo-18058(6).) + +*note importlib.util: 7d. has a new function *note decode_source(): f52. +that decodes source from bytes using universal newline processing. This +is useful for implementing *note InspectLoader.get_source(): f53. +methods. + +*note importlib.machinery.ExtensionFileLoader: cb0. now has a *note +get_filename(): f54. method. This was inadvertently omitted in the +original implementation. (Contributed by Eric Snow in bpo-19152(7).) + + ---------- 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://bugs.python.org/issue?@action=redirect&bpo=19152 + + +File: python.info, Node: inspect<8>, Next: ipaddress<5>, Prev: importlib<9>, Up: Improved Modules<10> + +1.10.4.23 inspect +................. + +The *note inspect: 7e. module now offers a basic *note command line +interface: f56. to quickly display source code and other information for +modules, classes and functions. (Contributed by Claudiu Popa and Nick +Coghlan in bpo-18626(1).) + +*note unwrap(): f57. makes it easy to unravel wrapper function chains +created by *note functools.wraps(): f58. (and any other API that sets +the ‘__wrapped__’ attribute on a wrapper function). (Contributed by +Daniel Urban, Aaron Iles and Nick Coghlan in bpo-13266(2).) + +As part of the implementation of the new *note enum: 56. module, the +*note inspect: 7e. module now has substantially better support for +custom ‘__dir__’ methods and dynamic class attributes provided through +metaclasses. (Contributed by Ethan Furman in bpo-18929(3) and +bpo-19030(4).) + +*note getfullargspec(): 734. and ‘getargspec()’ now use the *note +signature(): 733. 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(): +410. objects and more. Note that, unlike *note signature(): 733, these +functions still ignore ‘__wrapped__’ attributes, and report the already +bound first argument for bound methods, so it is still necessary to +update your code to use *note signature(): 733. directly if those +features are desired. (Contributed by Yury Selivanov in bpo-17481(5).) + +*note signature(): 733. now supports duck types of CPython functions, +which adds support for functions compiled with Cython. (Contributed by +Stefan Behnel and Yury Selivanov in bpo-17159(6).) + + ---------- 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 + + +File: python.info, Node: ipaddress<5>, Next: logging<6>, Prev: inspect<8>, Up: Improved Modules<10> + +1.10.4.24 ipaddress +................... + +*note ipaddress: 80. was added to the standard library in Python 3.3 as +a *note provisional API: b03. With the release of Python 3.4, this +qualification has been removed: *note ipaddress: 80. is now considered a +stable API, covered by the normal standard library requirements to +maintain backwards compatibility. + +A new *note is_global: f5a. property is ‘True’ if an address is globally +routeable. (Contributed by Peter Moody in bpo-17400(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17400 + + +File: python.info, Node: logging<6>, Next: marshal<2>, Prev: ipaddress<5>, Up: Improved Modules<10> + +1.10.4.25 logging +................. + +The *note TimedRotatingFileHandler: f5c. has a new 'atTime' parameter +that can be used to specify the time of day when rollover should happen. +(Contributed by Ronald Oussoren in bpo-9556(1).) + +*note SocketHandler: f5d. and *note DatagramHandler: f5e. now support +Unix domain sockets (by setting 'port' to ‘None’). (Contributed by +Vinay Sajip in commit ce46195b56a9.) + +*note fileConfig(): b51. now accepts a *note +configparser.RawConfigParser: f5f. subclass instance for the 'fname' +parameter. This facilitates using a configuration file when logging +configuration is just a part of the overall application configuration, +or where the application modifies the configuration before passing it to +*note fileConfig(): b51. (Contributed by Vinay Sajip in bpo-16110(2).) + +Logging configuration data received from a socket via the *note +logging.config.listen(): f60. function can now be validated before being +processed by supplying a verification function as the argument to the +new 'verify' keyword argument. (Contributed by Vinay Sajip in +bpo-15452(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9556 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=16110 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=15452 + + +File: python.info, Node: marshal<2>, Next: mmap<3>, Prev: logging<6>, Up: Improved Modules<10> + +1.10.4.26 marshal +................. + +The default *note marshal: 8d. version has been bumped to 3. The code +implementing the new version restores the Python2 behavior of recording +only one copy of interned strings and preserving the interning on +deserialization, and extends this “one copy” ability to any object type +(including handling recursive references). This reduces both the size +of ‘.pyc’ files and the amount of memory a module occupies in memory +when it is loaded from a ‘.pyc’ (or ‘.pyo’) file. (Contributed by +Kristján Valur Jónsson in bpo-16475(1), with additional speedups by +Antoine Pitrou in bpo-19219(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16475 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=19219 + + +File: python.info, Node: mmap<3>, Next: multiprocessing<7>, Prev: marshal<2>, Up: Improved Modules<10> + +1.10.4.27 mmap +.............. + +mmap objects are now *note weakly referenceable: f05. (Contributed by +Valerie Lambert in bpo-4885(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4885 + + +File: python.info, Node: multiprocessing<7>, Next: operator<3>, Prev: mmap<3>, Up: Improved Modules<10> + +1.10.4.28 multiprocessing +......................... + +On Unix two new *note start methods: 2cb, ‘spawn’ and ‘forkserver’, have +been added for starting processes using *note multiprocessing: 94. +These make the mixing of processes with threads more robust, and the +‘spawn’ method matches the semantics that multiprocessing has always +used on Windows. New function *note get_all_start_methods(): f64. +reports all start methods available on the platform, *note +get_start_method(): f65. reports the current start method, and *note +set_start_method(): 2ca. sets the start method. (Contributed by Richard +Oudkerk in bpo-8713(1).) + +*note multiprocessing: 94. also now has the concept of a ‘context’, +which determines how child processes are created. New function *note +get_context(): 2c9. returns a context that uses a specified start +method. It has the same API as the *note multiprocessing: 94. module +itself, so you can use it to create *note Pool: f66.s and other objects +that will operate within that context. This allows a framework and an +application or different parts of the same application to use +multiprocessing without interfering with each other. (Contributed by +Richard Oudkerk in bpo-18999(2).) + +Except when using the old 'fork' start method, child processes no longer +inherit unneeded handles/file descriptors from their parents (part of +bpo-8713(3)). + +*note multiprocessing: 94. now relies on *note runpy: be. (which +implements the ‘-m’ switch) to initialise ‘__main__’ appropriately in +child processes when using the ‘spawn’ or ‘forkserver’ start methods. +This resolves some edge cases where combining multiprocessing, the ‘-m’ +command line switch, and explicit relative imports could cause obscure +failures in child processes. (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<3>, Next: os<11>, Prev: multiprocessing<7>, Up: Improved Modules<10> + +1.10.4.29 operator +.................. + +New function *note length_hint(): f68. provides an implementation of the +specification for how the *note __length_hint__(): f06. special method +should be used, as part of the PEP 424(1) formal specification of this +language feature. (Contributed by Armin Ronacher in bpo-16148(2).) + +There is now a pure-python version of the *note operator: 9f. module +available for reference and for use by alternate implementations of +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<11>, Next: pdb<6>, Prev: operator<3>, Up: Improved Modules<10> + +1.10.4.30 os +............ + +There are new functions to get and set the *note inheritable flag: ef4. +of a file descriptor (*note os.get_inheritable(): ef5, *note +os.set_inheritable(): ef6.) or a Windows handle (*note +os.get_handle_inheritable(): ef7, *note os.set_handle_inheritable(): +ef8.). + +New function *note cpu_count(): 1c5. reports the number of CPUs +available on the platform on which Python is running (or ‘None’ if the +count can’t be determined). The *note multiprocessing.cpu_count(): f6a. +function is now implemented in terms of this function). (Contributed by +Trent Nelson, Yogesh Chaudhari, Victor Stinner, and Charles-François +Natali in bpo-17914(1).) + +*note os.path.samestat(): f6b. is now available on the Windows platform +(and the *note os.path.samefile(): f6c. implementation is now shared +between Unix and Windows). (Contributed by Brian Curtin in +bpo-11939(2).) + +*note os.path.ismount(): a11. now recognizes volumes mounted below a +drive root on Windows. (Contributed by Tim Golden in bpo-9035(3).) + +*note os.open(): d91. supports two new flags on platforms that provide +them, *note O_PATH: f6d. (un-opened file descriptor), and *note +O_TMPFILE: f6e. (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<6>, Next: pickle<4>, Prev: os<11>, Up: Improved Modules<10> + +1.10.4.31 pdb +............. + +*note pdb: a5. has been enhanced to handle generators, *note yield: 9cd, +and ‘yield from’ in a more useful fashion. This is especially helpful +when debugging *note asyncio: a. based programs. (Contributed by Andrew +Svetlov and Xavier de Gaye in bpo-16596(1).) + +The ‘print’ command has been removed from *note pdb: a5, restoring +access to the Python *note print(): f70. function from the pdb command +line. Python2’s ‘pdb’ did not have a ‘print’ command; instead, entering +‘print’ executed the ‘print’ statement. In Python3 ‘print’ was +mistakenly made an alias for the pdb *note p: f71. command. ‘p’, +however, prints the ‘repr’ of its argument, not the ‘str’ like the +Python2 ‘print’ command did. Worse, the Python3 ‘pdb print’ command +shadowed the Python3 ‘print’ function, making it inaccessible at the +‘pdb’ prompt. (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<4>, Next: plistlib<2>, Prev: pdb<6>, Up: Improved Modules<10> + +1.10.4.32 pickle +................ + +*note pickle: a6. 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 ‘__new__()’ method takes keyword-only arguments. It also +provides some efficiency improvements. + +See also +........ + +PEP 3154(1) – Pickle protocol 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<4>, Up: Improved Modules<10> + +1.10.4.33 plistlib +.................. + +*note plistlib: ab. now has an API that is similar to the standard +pattern for stdlib serialization protocols, with new *note load(): 94f, +*note dump(): 951, *note loads(): 950, and *note dumps(): 952. +functions. (The older API is now deprecated.) In addition to the +already supported XML plist format (*note FMT_XML: f74.), it also now +supports the binary plist format (*note FMT_BINARY: f75.). (Contributed +by Ronald Oussoren and others in bpo-14455(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14455 + + +File: python.info, Node: poplib<3>, Next: pprint<4>, Prev: plistlib<2>, Up: Improved Modules<10> + +1.10.4.34 poplib +................ + +Two new methods have been added to *note poplib: ac.: *note capa(): f77, +which returns the list of capabilities advertised by the POP server, and +*note stls(): f78, which switches a clear-text POP3 session into an +encrypted POP3 session if the POP server supports it. (Contributed by +Lorenzo Catucci in bpo-4473(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4473 + + +File: python.info, Node: pprint<4>, Next: pty, Prev: poplib<3>, Up: Improved Modules<10> + +1.10.4.35 pprint +................ + +The *note pprint: ae. module’s *note PrettyPrinter: f7a. class and its +*note pformat(): f7b, and *note pprint(): 824. functions have a new +option, 'compact', that controls how the output is formatted. Currently +setting 'compact' to ‘True’ means that sequences will be printed with as +many sequence elements as will fit within 'width' on each (indented) +line. (Contributed by Serhiy Storchaka in bpo-19132(1).) + +Long strings are now wrapped using Python’s normal line continuation +syntax. (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, Next: pydoc<4>, Prev: pprint<4>, Up: Improved Modules<10> + +1.10.4.36 pty +............. + +*note pty.spawn(): f7d. now returns the status value from *note +os.waitpid(): d99. on the child process, instead of ‘None’. +(Contributed by Gregory P. Smith.) + + +File: python.info, Node: pydoc<4>, Next: re<8>, Prev: pty, Up: Improved Modules<10> + +1.10.4.37 pydoc +............... + +The *note pydoc: b5. module is now based directly on the *note +inspect.signature(): 733. introspection API, allowing it to provide +signature information for a wider variety of callable objects. This +change also means that ‘__wrapped__’ attributes are now taken into +account when displaying help information. (Contributed by Larry +Hastings in bpo-19674(1).) + +The *note pydoc: b5. module no longer displays the ‘self’ parameter for +already bound methods. Instead, it aims to always display the exact +current signature of the supplied callable. (Contributed by Larry +Hastings in bpo-20710(2).) + +In addition to the changes that have been made to *note pydoc: b5. +directly, its handling of custom ‘__dir__’ methods and various +descriptor behaviours has also been improved substantially by the +underlying changes in the *note inspect: 7e. module. + +As the *note help(): 8d6. builtin is based on *note pydoc: b5, the above +changes also affect the behaviour of *note help(): 8d6. + + ---------- 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<8>, Next: resource, Prev: pydoc<4>, Up: Improved Modules<10> + +1.10.4.38 re +............ + +New *note fullmatch(): f80. function and ‘regex.fullmatch()’ 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).) + +The repr of *note regex objects: f81. now includes the pattern and the +flags; the repr of *note match objects: f82. now includes the start, +end, and the part of the string that matched. (Contributed by Hugo +Lopes Tavares and Serhiy Storchaka in bpo-13592(2) and bpo-17087(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16203 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=13592 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=17087 + + +File: python.info, Node: resource, Next: select, Prev: re<8>, Up: Improved Modules<10> + +1.10.4.39 resource +.................. + +New *note prlimit(): f84. function, available on Linux platforms with a +kernel version of 2.6.36 or later and glibc of 2.13 or later, provides +the ability to query or set the resource limits for processes other than +the one making the call. (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: f85, *note RLIMIT_NICE: f86, +*note RLIMIT_RTPRIO: f87, *note RLIMIT_RTTIME: f88, and *note +RLIMIT_SIGPENDING: f89. (Contributed by Christian Heimes in +bpo-19324(2).) + +On FreeBSD version 9 and later, there some new FreeBSD specific +constants: *note RLIMIT_SBSIZE: f8a, *note RLIMIT_SWAP: f8b, and *note +RLIMIT_NPTS: f8c. (Contributed by Claudiu Popa in bpo-19343(3).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16595 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=19324 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=19343 + + +File: python.info, Node: select, Next: shelve<2>, Prev: resource, Up: Improved Modules<10> + +1.10.4.40 select +................ + +*note epoll: f8e. objects now support the context management protocol. +When used in a *note with: 5ce. statement, the *note close(): f8f. +method will be called automatically at the end of the block. +(Contributed by Serhiy Storchaka in bpo-16488(1).) + +*note devpoll: f90. objects now have *note fileno(): f91. and *note +close(): f92. methods, as well as a new attribute *note closed: f93. +(Contributed by Victor Stinner in bpo-18794(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16488 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=18794 + + +File: python.info, Node: shelve<2>, Next: shutil<6>, Prev: select, Up: Improved Modules<10> + +1.10.4.41 shelve +................ + +*note Shelf: f95. instances may now be used in *note with: 5ce. +statements, and will be automatically closed at the end of the ‘with’ +block. (Contributed by Filip Gruszczyński in bpo-13896(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13896 + + +File: python.info, Node: shutil<6>, Next: smtpd<3>, Prev: shelve<2>, Up: Improved Modules<10> + +1.10.4.42 shutil +................ + +*note copyfile(): a58. now raises a specific *note Error: f97. subclass, +*note SameFileError: f98, when the source and destination are the same +file, which allows an application to take appropriate action on this +specific error. (Contributed by Atsuo Ishimoto and Hynek Schlawack in +bpo-1492704(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=1492704 + + +File: python.info, Node: smtpd<3>, Next: smtplib<3>, Prev: shutil<6>, Up: Improved Modules<10> + +1.10.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<9>, Prev: smtpd<3>, Up: Improved Modules<10> + +1.10.4.44 smtplib +................. + +*note SMTPException: f9b. is now a subclass of *note OSError: 413, which +allows both socket level errors and SMTP protocol level errors to be +caught in one try/except statement by code that only cares whether or +not an error occurred. (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<9>, Next: sqlite3<9>, Prev: smtplib<3>, Up: Improved Modules<10> + +1.10.4.45 socket +................ + +The socket module now supports the *note CAN_BCM: f9d. protocol on +platforms that support it. (Contributed by Brian Thorne in +bpo-15359(1).) + +Socket objects have new methods to get or set their *note inheritable +flag: ef4, *note get_inheritable(): ef9. and *note set_inheritable(): +efa. + +The ‘socket.AF_*’ and ‘socket.SOCK_*’ constants are now enumeration +values using the new *note enum: 56. module. This allows meaningful +names to be printed during debugging, instead of integer “magic +numbers”. + +The *note AF_LINK: f9e. constant is now available on BSD and OSX. + +*note inet_pton(): 962. and *note inet_ntop(): f9f. are now supported on +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<9>, Next: ssl<10>, Prev: socket<9>, Up: Improved Modules<10> + +1.10.4.46 sqlite3 +................. + +A new boolean parameter to the *note connect(): 2aa. function, 'uri', +can be used to indicate that the 'database' parameter is a ‘uri’ (see +the SQLite URI documentation(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<10>, Next: stat, Prev: sqlite3<9>, Up: Improved Modules<10> + +1.10.4.47 ssl +............. + +*note PROTOCOL_TLSv1_1: fa2. and *note PROTOCOL_TLSv1_2: fa3. (TLSv1.1 +and TLSv1.2 support) have been added; support for these protocols is +only available if Python is linked with OpenSSL 1.0.1 or later. +(Contributed by Michele Orrù and Antoine Pitrou in bpo-16692(1).) New +function *note create_default_context(): 155. provides a standard way to +obtain an *note SSLContext: 296. whose settings are intended to be a +reasonable balance between compatibility and security. These settings +are more stringent than the defaults provided by the *note SSLContext: +296. constructor, and may be adjusted in the future, without prior +deprecation, if best-practice security requirements change. The new +recommended best practice for using stdlib libraries that support SSL is +to use *note create_default_context(): 155. to obtain an *note +SSLContext: 296. object, modify it if needed, and then pass it as the +'context' argument of the appropriate stdlib API. (Contributed by +Christian Heimes in bpo-19689(2).) + +*note SSLContext: 296. method *note load_verify_locations(): ee6. +accepts a new optional argument 'cadata', which can be used to provide +PEM or DER encoded certificates directly via strings or bytes, +respectively. (Contributed by Christian Heimes in bpo-18138(3).) + +New function *note get_default_verify_paths(): fa4. returns a named +tuple of the paths and environment variables that the *note +set_default_verify_paths(): fa5. method uses to set OpenSSL’s default +‘cafile’ and ‘capath’. This can be an aid in debugging default +verification issues. (Contributed by Christian Heimes in bpo-18143(4).) + +*note SSLContext: 296. has a new method, *note cert_store_stats(): fa6, +that reports the number of loaded ‘X.509’ certs, ‘X.509 CA’ certs, and +certificate revocation lists (‘crl’s), as well as a *note +get_ca_certs(): fa7. method that returns a list of the loaded ‘CA’ +certificates. (Contributed by Christian Heimes in bpo-18147(5).) + +If OpenSSL 0.9.8 or later is available, *note SSLContext: 296. has a new +attribute *note verify_flags: fa8. that can be used to control the +certificate verification process by setting it to some combination of +the new constants *note VERIFY_DEFAULT: fa9, *note +VERIFY_CRL_CHECK_LEAF: faa, *note VERIFY_CRL_CHECK_CHAIN: fab, or *note +VERIFY_X509_STRICT: 157. OpenSSL does not do any CRL verification by +default. (Contributed by Christien Heimes in bpo-8813(6).) + +New *note SSLContext: 296. method *note load_default_certs(): fac. loads +a set of default “certificate authority” (CA) certificates from default +locations, which vary according to the platform. It can be used to load +both TLS web server authentication certificates (‘purpose=’*note +SERVER_AUTH: fad.) for a client to use to verify a server, and +certificates for a server to use in verifying client certificates +(‘purpose=’*note CLIENT_AUTH: fae.). (Contributed by Christian Heimes +in bpo-19292(7).) Two new windows-only functions, *note +enum_certificates(): faf. and *note enum_crls(): fb0. provide the +ability to retrieve certificates, certificate information, and CRLs from +the Windows cert store. (Contributed by Christian Heimes in +bpo-17134(8).) Support for server-side SNI (Server Name Indication) +using the new *note ssl.SSLContext.set_servername_callback(): fb1. +method. (Contributed by Daniel Black in bpo-8109(9).) + +The dictionary returned by *note SSLSocket.getpeercert(): fb2. contains +additional ‘X509v3’ extension items: ‘crlDistributionPoints’, +‘calIssuers’, and ‘OCSP’ URIs. (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<2>, Prev: ssl<10>, Up: Improved Modules<10> + +1.10.4.48 stat +.............. + +The *note stat: d1. 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: fb4. flags, *note S_IFDOOR: fb5, +*note S_IFPORT: fb6, and *note S_IFWHT: fb7. (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<2>, Next: subprocess<5>, Prev: stat, Up: Improved Modules<10> + +1.10.4.49 struct +................ + +New function *note iter_unpack: fb9. and a new *note +struct.Struct.iter_unpack(): fba. method on compiled formats provide +streamed unpacking of a buffer containing repeated instances of a given +format of data. (Contributed by Antoine Pitrou in bpo-17804(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17804 + + +File: python.info, Node: subprocess<5>, Next: sunau<2>, Prev: struct<2>, Up: Improved Modules<10> + +1.10.4.50 subprocess +.................... + +*note check_output(): fbc. now accepts an 'input' argument that can be +used to provide the contents of ‘stdin’ for the command that is run. +(Contributed by Zack Weinberg in bpo-16624(1).) + +‘getstatus()’ and *note getstatusoutput(): fbd. now work on Windows. +This change was actually inadvertently made in 3.3.4. (Contributed by +Tim Golden in bpo-10197(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16624 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=10197 + + +File: python.info, Node: sunau<2>, Next: sys<12>, Prev: subprocess<5>, Up: Improved Modules<10> + +1.10.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: 5ce. 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: d2d. (Contributed by Serhiy Storchaka in +bpo-8311(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=18901 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=18878 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=19261 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=8311 + + +File: python.info, Node: sys<12>, Next: tarfile<8>, Prev: sunau<2>, Up: Improved Modules<10> + +1.10.4.52 sys +............. + +New function *note sys.getallocatedblocks(): fc0. returns the current +number of blocks allocated by the interpreter. (In CPython with the +default ‘--with-pymalloc’ setting, this is allocations made through the +*note PyObject_Malloc(): c68. API.) This can be useful for tracking +memory leaks, especially if automated via a test suite. (Contributed by +Antoine Pitrou in bpo-13390(1).) + +When the Python interpreter starts in *note interactive mode: fc1, it +checks for an *note __interactivehook__: fc2. attribute on the *note +sys: d9. module. If the attribute exists, its value is called with no +arguments just before interactive mode is started. The check is made +after the *note PYTHONSTARTUP: fc3. file is read, so it can be set +there. The *note site: c7. module *note sets it: fc4. to a function +that enables tab completion and history saving (in ‘~/.python-history’) +if the platform supports *note readline: ba. If you do not want this +(new) behavior, you can override it in *note PYTHONSTARTUP: fc3, *note +sitecustomize: c8, or *note usercustomize: 10e. by deleting this +attribute from *note sys: d9. (or setting it to some other callable). +(Contributed by Éric Araujo and Antoine Pitrou in bpo-5845(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13390 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=5845 + + +File: python.info, Node: tarfile<8>, Next: textwrap, Prev: sys<12>, Up: Improved Modules<10> + +1.10.4.53 tarfile +................. + +The *note tarfile: de. module now supports a simple *note Command-Line +Interface: fc6. when called as a script directly or via ‘-m’. This can +be used to create and extract tarfile archives. (Contributed by Berker +Peksag in bpo-13477(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13477 + + +File: python.info, Node: textwrap, Next: threading<7>, Prev: tarfile<8>, Up: Improved Modules<10> + +1.10.4.54 textwrap +.................. + +The *note TextWrapper: fc8. class has two new attributes/constructor +arguments: *note max_lines: fc9, which limits the number of lines in the +output, and *note placeholder: fca, which is a string that will appear +at the end of the output if it has been truncated because of +'max_lines'. Building on these capabilities, a new convenience function +*note shorten(): fcb. collapses all of the whitespace in the input to +single spaces and produces a single line of a given 'width' that ends +with the 'placeholder' (by default, ‘[...]’). (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<7>, Next: traceback<6>, Prev: textwrap, Up: Improved Modules<10> + +1.10.4.55 threading +................... + +The *note Thread: 94c. object representing the main thread can be +obtained from the new *note main_thread(): fcd. function. In normal +conditions this will be the thread from which the Python interpreter was +started. (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<6>, Prev: threading<7>, Up: Improved Modules<10> + +1.10.4.56 traceback +................... + +A new *note traceback.clear_frames(): fcf. function takes a traceback +object and clears the local variables in all of the frames it +references, reducing the amount of memory consumed. (Contributed by +Andrew Kuchling in bpo-1565525(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=1565525 + + +File: python.info, Node: types<6>, Next: urllib<3>, Prev: traceback<6>, Up: Improved Modules<10> + +1.10.4.57 types +............... + +A new *note DynamicClassAttribute(): 626. 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 ‘Enum’ 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<3>, Next: unittest<9>, Prev: types<6>, Up: Improved Modules<10> + +1.10.4.58 urllib +................ + +*note urllib.request: 10b. now supports ‘data:’ URLs via the *note +DataHandler: fd2. class. (Contributed by Mathias Panzenböck in +bpo-16423(1).) + +The http method that will be used by a *note Request: fd3. class can now +be specified by setting a *note method: fd4. class attribute on the +subclass. (Contributed by Jason R Coombs in bpo-18978(2).) + +*note Request: fd3. objects are now reusable: if the *note full_url: +fd5. or *note data: fd6. attributes are modified, all relevant internal +properties are updated. This means, for example, that it is now +possible to use the same *note Request: fd3. object in more than one +*note OpenerDirector.open(): fd7. call with different 'data' arguments, +or to modify a *note Request: fd3.‘s ‘url’ rather than recomputing it +from scratch. There is also a new *note remove_header(): fd8. method +that can be used to remove headers from a *note Request: fd3. +(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: fd9. objects now have a *note headers: fda. attribute +that provides access to the HTTP response headers associated with the +error. (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<9>, Next: venv<7>, Prev: urllib<3>, Up: Improved Modules<10> + +1.10.4.59 unittest +.................. + +The *note TestCase: 449. class has a new method, *note subTest(): fdc, +that produces a context manager whose *note with: 5ce. 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) + +will result in six subtests, each identified in the unittest verbose +output with a label consisting of the variable name ‘i’ and a particular +value for that variable (‘i=0’, ‘i=1’, etc). See *note Distinguishing +test iterations using subtests: fdd. for the full version of this +example. (Contributed by Antoine Pitrou in bpo-16997(1).) + +*note unittest.main(): fde. now accepts an iterable of test names for +'defaultTest', where previously it only accepted a single test name as a +string. (Contributed by Jyrki Pulliainen in bpo-15132(2).) + +If *note SkipTest: fdf. is raised during test discovery (that is, at the +module level in the test file), it is now reported as a skip instead of +an error. (Contributed by Zach Ware in bpo-16935(3).) + +*note discover(): fe0. now sorts the discovered files to provide +consistent test ordering. (Contributed by Martin Melin and Jeff Ramnani +in bpo-16709(4).) + +*note TestSuite: df3. now drops references to tests as soon as the test +has been run, if the test is successful. On Python interpreters that do +garbage collection, this allows the tests to be garbage collected if +nothing else is holding a reference to the test. It is possible to +override this behavior by creating a *note TestSuite: df3. subclass that +defines a custom ‘_removeTestAtIndex’ method. (Contributed by Tom +Wardill, Matt McClure, and Andrew Svetlov in bpo-11798(5).) + +A new test assertion context-manager, *note assertLogs(): 855, will +ensure that a given block of code emits a log message using the *note +logging: 87. module. By default the message can come from any logger +and have a priority of ‘INFO’ or higher, but both the logger name and an +alternative minimum logging level may be specified. The object returned +by the context manager can be queried for the *note LogRecord: fe1.s +and/or formatted messages that were logged. (Contributed by Antoine +Pitrou in bpo-18937(6).) + +Test discovery now works with namespace packages (Contributed by Claudiu +Popa in bpo-17457(7).) + +*note unittest.mock: 107. objects now inspect their specification +signatures when matching calls, which means an argument can now be +matched by either position or name, instead of only by position. +(Contributed by Antoine Pitrou in bpo-17015(8).) + +‘mock_open()’ objects now have ‘readline’ and ‘readlines’ methods. +(Contributed by Toshio Kuratomi in bpo-17467(9).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16997 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=15132 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=16935 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=16709 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=11798 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=18937 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=17457 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=17015 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=17467 + + +File: python.info, Node: venv<7>, Next: wave<2>, Prev: unittest<9>, Up: Improved Modules<10> + +1.10.4.60 venv +.............. + +*note venv: 111. now includes activation scripts for the ‘csh’ and +‘fish’ shells. (Contributed by Andrew Svetlov in bpo-15417(1).) + +*note EnvBuilder: 26c. and the *note create(): 26d. convenience function +take a new keyword argument 'with_pip', which defaults to ‘False’, that +controls whether or not *note EnvBuilder: 26c. ensures that ‘pip’ is +installed in the virtual environment. (Contributed by Nick Coghlan in +bpo-19552(2) as part of the PEP 453(3) implementation.) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15417 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=19552 + + (3) https://peps.python.org/pep-0453/ + + +File: python.info, Node: wave<2>, Next: weakref<2>, Prev: venv<7>, Up: Improved Modules<10> + +1.10.4.61 wave +.............. + +The ‘getparams()’ method now returns a namedtuple rather than a plain +tuple. (Contributed by Claudiu Popa in bpo-17487(1).) + +*note wave.open(): 94b. now supports the context management protocol. +(Contributed by Claudiu Popa in bpo-17616(2).) + +*note wave: 113. can now *note write output to unseekable files: fe4. +(Contributed by David Jones, Guilherme Polo, and Serhiy Storchaka in +bpo-5202(3).) + +The *note writeframesraw(): fe5. and *note writeframes(): fe6. methods +now accept any *note bytes-like object: d2d. (Contributed by Serhiy +Storchaka in bpo-8311(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17487 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=17616 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=5202 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=8311 + + +File: python.info, Node: weakref<2>, Next: xml etree<2>, Prev: wave<2>, Up: Improved Modules<10> + +1.10.4.62 weakref +................. + +New *note WeakMethod: fe8. class simulates weak references to bound +methods. (Contributed by Antoine Pitrou in bpo-14631(1).) + +New *note finalize: a7c. class makes it possible to register a callback +to be invoked when an object is garbage collected, without needing to +carefully manage the lifecycle of the weak reference itself. +(Contributed by Richard Oudkerk in bpo-15528(2).) + +The callback, if any, associated with a *note ref: fe9. is now exposed +via the *note __callback__: fea. attribute. (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<5>, Prev: weakref<2>, Up: Improved Modules<10> + +1.10.4.63 xml.etree +................... + +A new parser, *note XMLPullParser: fec, allows a non-blocking +applications to parse XML documents. An example can be seen at *note +Pull API for non-blocking parsing: fed. (Contributed by Antoine Pitrou +in bpo-17741(1).) + +The *note xml.etree.ElementTree: 125. *note tostring(): fee. and *note +tostringlist(): fef. functions, and the *note ElementTree: 94e. *note +write(): ff0. method, now have a 'short_empty_elements' *note +keyword-only parameter: 2a7. providing control over whether elements +with no content are written in abbreviated (‘’) or expanded +(‘’) form. (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<5>, Prev: xml etree<2>, Up: Improved Modules<10> + +1.10.4.64 zipfile +................. + +The *note writepy(): ff2. method of the *note PyZipFile: ff3. class has +a new 'filterfunc' option that can be used to control which directories +and files are added to the archive. For example, this could be used to +exclude test files from the archive. (Contributed by Christian Tismer +in bpo-19274(1).) + +The 'allowZip64' parameter to *note ZipFile: 6c0. and ‘PyZipfile’ 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 Implementation Changes, Next: Deprecated<11>, Prev: Improved Modules<10>, Up: What’s New In Python 3 4 + +1.10.5 CPython Implementation Changes +------------------------------------- + +* Menu: + +* PEP 445; Customization of CPython Memory Allocators: PEP 445 Customization of CPython Memory Allocators. +* PEP 442; Safe Object Finalization: PEP 442 Safe Object Finalization. +* PEP 456; Secure and Interchangeable Hash Algorithm: PEP 456 Secure and Interchangeable Hash Algorithm. +* PEP 436; Argument Clinic: PEP 436 Argument Clinic. +* Other Build and C API Changes:: +* Other Improvements: Other Improvements<2>. +* Significant Optimizations:: + + +File: python.info, Node: PEP 445 Customization of CPython Memory Allocators, Next: PEP 442 Safe Object Finalization, Up: CPython Implementation Changes + +1.10.5.1 PEP 445: Customization of CPython Memory Allocators +............................................................ + +PEP 445(1) adds new C level interfaces to customize memory allocation in +the CPython interpreter. + +See also +........ + +PEP 445(2) – Add new APIs to customize Python memory allocators + + 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 Safe Object Finalization, Next: PEP 456 Secure and Interchangeable Hash Algorithm, Prev: PEP 445 Customization of CPython Memory Allocators, Up: CPython Implementation Changes + +1.10.5.2 PEP 442: Safe Object Finalization +.......................................... + +PEP 442(1) removes the current limitations and quirks of object +finalization in CPython. With it, objects with ‘__del__()’ methods, as +well as generators with *note finally: 9ca. clauses, can be finalized +when they are part of a reference cycle. + +As part of this change, module globals are no longer forcibly set to +*note None: 671. during interpreter shutdown in most cases, instead +relying on the normal operation of the cyclic garbage collector. This +avoids a whole class of interpreter-shutdown-time errors, usually +involving ‘__del__’ methods, that have plagued Python since the cyclic +GC was first introduced. + +See also +........ + +PEP 442(2) – Safe object finalization + + PEP written and implemented by Antoine Pitrou. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0442/ + + (2) https://peps.python.org/pep-0442/ + + +File: python.info, Node: PEP 456 Secure and Interchangeable Hash Algorithm, Next: PEP 436 Argument Clinic, Prev: PEP 442 Safe Object Finalization, Up: CPython Implementation Changes + +1.10.5.3 PEP 456: Secure and Interchangeable Hash Algorithm +........................................................... + +PEP 456(1) follows up on earlier security fix work done on Python’s hash +algorithm to address certain DOS attacks to which public facing APIs +backed by dictionary lookups may be subject. (See bpo-14621(2) for the +start of the current round of improvements.) The PEP unifies CPython’s +hash code to make it easier for a packager to substitute a different +hash algorithm, and switches Python’s default implementation to a +SipHash implementation on platforms that have a 64 bit data type. Any +performance differences in comparison with the older FNV algorithm are +trivial. + +The PEP adds additional fields to the *note sys.hash_info: ff8. 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: Other Build and C API Changes, Prev: PEP 456 Secure and Interchangeable Hash Algorithm, Up: CPython Implementation Changes + +1.10.5.4 PEP 436: Argument Clinic +................................. + +“Argument Clinic” ( PEP 436(1)) is now part of the CPython build process +and can be used to simplify the process of defining and maintaining +accurate signatures for builtins and standard library extension modules +implemented in C. + +Some standard library extension modules have been converted to use +Argument Clinic in Python 3.4, and *note pydoc: b5. and *note inspect: +7e. have been updated accordingly. + +It is expected that signature metadata for programmatic introspection +will be added to additional callables implemented in C as part of Python +3.4 maintenance releases. + + Note: The Argument Clinic PEP is not fully up to date with the + state of the implementation. This has been deemed acceptable by + the release manager and core development team in this case, as + Argument Clinic will not be made available as a public API for + third party use in Python 3.4. + +See also +........ + +PEP 436(2) – The Argument Clinic DSL + + 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: Other Build and C API Changes, Next: Other Improvements<2>, Prev: PEP 436 Argument Clinic, Up: CPython Implementation Changes + +1.10.5.5 Other Build and C API Changes +...................................... + + * The new *note PyType_GetSlot(): 89a. function has been added to the + stable ABI, allowing retrieval of function pointers from named type + slots when using the limited API. (Contributed by Martin von Löwis + in bpo-17162(1).) + + * 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(2).) + + * Most Python C APIs that don’t mutate string arguments are now + correctly marked as accepting ‘const char *’ rather than ‘char *’. + (Contributed by Serhiy Storchaka in bpo-1772673(3).) + + * A new shell version of ‘python-config’ can be used even when a + python interpreter is not available (for example, in cross + compilation scenarios). + + * *note PyUnicode_FromFormat(): 385. now supports width and precision + specifications for ‘%s’, ‘%A’, ‘%U’, ‘%V’, ‘%S’, and ‘%R’. + (Contributed by Ysj Ray and Victor Stinner in bpo-7330(4).) + + * New function *note PyStructSequence_InitType2(): ffb. supplements + the existing *note PyStructSequence_InitType(): ffc. function. The + difference is that it returns ‘0’ on success and ‘-1’ on failure. + + * The CPython source can now be compiled using the address sanity + checking features of recent versions of GCC and clang: the false + alarms in the small object allocator have been silenced. + (Contributed by Dhiru Kholia in bpo-18596(5).) + + * The Windows build now uses Address Space Layout Randomization(6) + and Data Execution Prevention(7). (Contributed by Christian Heimes + in bpo-16632(8).) + + * New function *note PyObject_LengthHint(): ffd. is the C API + equivalent of *note operator.length_hint(): f68. (Contributed by + Armin Ronacher in bpo-16148(9).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17162 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=16129 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=1772673 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=7330 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=18596 + + (6) https://en.wikipedia.org/wiki/Address_space_layout_randomization + + (7) https://en.wikipedia.org/wiki/Data_Execution_Prevention + + (8) https://bugs.python.org/issue?@action=redirect&bpo=16632 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=16148 + + +File: python.info, Node: Other Improvements<2>, Next: Significant Optimizations, Prev: Other Build and C API Changes, Up: CPython Implementation Changes + +1.10.5.6 Other Improvements +........................... + + * The *note python: 1000. command has a new *note option: 1001, ‘-I’, + which causes it to run in “isolated mode”, which means that *note + sys.path: 3b0. 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).) + + * Tab-completion is now enabled by default in the interactive + interpreter on systems that support *note readline: ba. History is + also enabled by default, and is written to (and read from) the file + ‘~/.python-history’. (Contributed by Antoine Pitrou and Éric + Araujo in bpo-5845(2).) + + * Invoking the Python interpreter with ‘--version’ now outputs the + version to standard output instead of standard error + (bpo-18338(3)). Similar changes were made to *note argparse: 6. + (bpo-18920(4)) and other modules that have script-like invocation + capabilities (bpo-18922(5)). + + * The CPython Windows installer now adds ‘.py’ to the ‘PATHEXT’ + variable when extensions are registered, allowing users to run a + python script at the windows command prompt by just typing its name + without the ‘.py’ extension. (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: 1002. + now also checks for memory allocation leaks, using *note + sys.getallocatedblocks(): fc0. (Contributed by Antoine Pitrou in + bpo-13390(9).) + + * ‘python -m’ now works with namespace packages. + + * The *note stat: d1. module is now implemented in C, which means it + gets the values for its constants from the C header files, instead + of having the values hard-coded in the python module as was + previously the case. + + * Loading multiple python modules from a single OS module (‘.so’, + ‘.dll’) now works correctly (previously it silently returned the + first python module in the file). (Contributed by Václav Šmilauer + in bpo-16421(10).) + + * 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__: c5e. (Contributed by + Benjamin Peterson in bpo-17853(11).) + + * A number of MemoryError-related crashes were identified and fixed + by Victor Stinner using his PEP 445(12)-based ‘pyfailmalloc’ tool + (bpo-18408(13), bpo-18520(14)). + + * The ‘pyvenv’ command now accepts a ‘--copies’ option to use copies + rather than symlinks even on systems where symlinks are the + default. (Contributed by Vinay Sajip in bpo-18807(15).) + + * The ‘pyvenv’ command also accepts a ‘--without-pip’ option to + suppress the otherwise-automatic bootstrapping of pip into the + virtual environment. (Contributed by Nick Coghlan in bpo-19552(16) + as part of the PEP 453(17) implementation.) + + * The encoding name is now optional in the value set for the *note + PYTHONIOENCODING: 1003. environment variable. This makes it + possible to set just the error handler, without changing the + default encoding. (Contributed by Serhiy Storchaka in + bpo-18818(18).) + + * The *note bz2: 13, *note lzma: 8a, and *note gzip: 67. module + ‘open’ functions now support ‘x’ (exclusive creation) mode. + (Contributed by Tim Heaney and Vajrasky Kok in bpo-19201(19), + bpo-19222(20), and bpo-19223(21).) + + ---------- 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=16421 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=17853 + + (12) https://peps.python.org/pep-0445/ + + (13) https://bugs.python.org/issue?@action=redirect&bpo=18408 + + (14) https://bugs.python.org/issue?@action=redirect&bpo=18520 + + (15) https://bugs.python.org/issue?@action=redirect&bpo=18807 + + (16) https://bugs.python.org/issue?@action=redirect&bpo=19552 + + (17) https://peps.python.org/pep-0453/ + + (18) https://bugs.python.org/issue?@action=redirect&bpo=18818 + + (19) https://bugs.python.org/issue?@action=redirect&bpo=19201 + + (20) https://bugs.python.org/issue?@action=redirect&bpo=19222 + + (21) https://bugs.python.org/issue?@action=redirect&bpo=19223 + + +File: python.info, Node: Significant Optimizations, Prev: Other Improvements<2>, Up: CPython Implementation Changes + +1.10.5.7 Significant Optimizations +.................................. + + * The UTF-32 decoder is now 3x to 4x faster. (Contributed by Serhiy + Storchaka in bpo-14625(1).) + + * The cost of hash collisions for sets is now reduced. Each hash + table probe now checks a series of consecutive, adjacent key/hash + pairs before continuing to make random probes through the hash + table. This exploits cache locality to make collision resolution + less expensive. The collision resolution scheme can be described + as a hybrid of linear probing and open addressing. The number of + additional linear probes defaults to nine. This can be changed at + compile-time by defining LINEAR_PROBES to be any value. Set + LINEAR_PROBES=0 to turn-off linear probing entirely. (Contributed + by Raymond Hettinger in bpo-18771(2).) + + * The interpreter starts about 30% faster. A couple of measures lead + to the speedup. The interpreter loads fewer modules on startup, + e.g. the *note re: b9, *note collections: 1d. and *note locale: + 86. modules and their dependencies are no longer imported by + default. The marshal module has been improved to load compiled + Python code faster. (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: 863. is now as fast or faster than the Python2 + version for most cases. *note lzma.LZMAFile: 1005. has also been + optimized. (Contributed by Serhiy Storchaka and Nadeem Vawda in + bpo-16034(8).) + + * *note random.getrandbits(): 1006. is 20%-40% faster for small + integers (the most common use case). (Contributed by Serhiy + Storchaka in bpo-16674(9).) + + * By taking advantage of the new storage format for strings, pickling + of strings is now significantly faster. (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: d6. + (Contributed by Richard Oudkerk in bpo-15758(11).) + + * *note html.escape(): 1007. is now 10x faster. (Contributed by Matt + Bryant in bpo-18020(12).) + + * On Windows, the native ‘VirtualAlloc’ is now used instead of the + CRT ‘malloc’ in ‘obmalloc’. Artificial benchmarks show about a 3% + memory savings. + + * *note os.urandom(): 51e. 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: Deprecated<11>, Next: Removed<11>, Prev: CPython Implementation Changes, Up: What’s New In Python 3 4 + +1.10.6 Deprecated +----------------- + +This section covers various APIs and other features that have been +deprecated in Python 3.4, and will be removed in Python 3.5 or later. +In most (but not all) cases, using the deprecated APIs will produce a +*note DeprecationWarning: 1a5. when the interpreter is run with +deprecation warnings enabled (for example, by using ‘-Wd’). + +* Menu: + +* Deprecations in the Python API:: +* Deprecated Features:: + + +File: python.info, Node: Deprecations in the Python API, Next: Deprecated Features, Up: Deprecated<11> + +1.10.6.1 Deprecations in the Python API +....................................... + + * As mentioned in *note PEP 451; A ModuleSpec Type for the Import + System: ed4, a number of *note importlib: 77. methods and functions + are deprecated: ‘importlib.find_loader()’ is replaced by *note + importlib.util.find_spec(): 2d0.; + ‘importlib.machinery.PathFinder.find_module()’ is replaced by *note + importlib.machinery.PathFinder.find_spec(): 100a.; + ‘importlib.abc.MetaPathFinder.find_module()’ is replaced by *note + importlib.abc.MetaPathFinder.find_spec(): 865.; + ‘importlib.abc.PathEntryFinder.find_loader()’ and ‘find_module()’ + are replaced by *note importlib.abc.PathEntryFinder.find_spec(): + 869.; 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(): 867, *note + importlib.abc.InspectLoader.exec_module(): 100b. *note + importlib.abc.SourceLoader.exec_module(): 100c.) 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. + + * ‘MD5’ as the default 'digestmod' for the *note hmac.new(): a9f. + function is deprecated. Python 3.6 will require an explicit digest + name or constructor as 'digestmod' argument. + + * The internal ‘Netrc’ class in the *note ftplib: 5e. module has been + documented as deprecated in its docstring for quite some time. It + now emits a *note DeprecationWarning: 1a5. and will be removed + completely in Python 3.5. + + * The undocumented 'endtime' argument to *note + subprocess.Popen.wait(): ce4. should not have been exposed and is + hopefully not in use; it is deprecated and will mostly likely be + removed in Python 3.5. + + * The 'strict' argument of *note HTMLParser: 874. is deprecated. + + * The *note plistlib: ab. ‘readPlist()’, ‘writePlist()’, + ‘readPlistFromBytes()’, and ‘writePlistToBytes()’ functions are + deprecated in favor of the corresponding new functions *note + load(): 94f, *note dump(): 951, *note loads(): 950, and *note + dumps(): 952. ‘Data()’ is deprecated in favor of just using the + *note bytes: 1c2. constructor. + + * The *note sysconfig: db. key ‘SO’ is deprecated, it has been + replaced by ‘EXT_SUFFIX’. + + * The ‘U’ mode accepted by various ‘open’ functions is deprecated. + In Python3 it does not do anything useful, and should be replaced + by appropriate uses of *note io.TextIOWrapper: 7b6. (if needed) and + its 'newline' argument. + + * The 'parser' argument of *note xml.etree.ElementTree.iterparse(): + 275. has been deprecated, as has the 'html' argument of *note + XMLParser(): a53. To prepare for the removal of the latter, all + arguments to ‘XMLParser’ should be passed by keyword. + + +File: python.info, Node: Deprecated Features, Prev: Deprecations in the Python API, Up: Deprecated<11> + +1.10.6.2 Deprecated Features +............................ + + * Running *note IDLE — Python editor and shell: 100e. with the ‘-n’ + flag (no subprocess) is deprecated. However, the feature will not + be removed until bpo-18823(1) is resolved. + + * The site module adding a “site-python” directory to sys.path, if it + exists, is deprecated (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: Removed<11>, Next: Porting to Python 3 4, Prev: Deprecated<11>, Up: What’s New In Python 3 4 + +1.10.7 Removed +-------------- + +* Menu: + +* Operating Systems No Longer Supported:: +* API and Feature Removals: API and Feature Removals<5>. +* Code Cleanups:: + + +File: python.info, Node: Operating Systems No Longer Supported, Next: API and Feature Removals<5>, Up: Removed<11> + +1.10.7.1 Operating Systems No Longer Supported +.............................................. + +Support for the following operating systems has been removed from the +source and build tools: + + * OS/2 (bpo-16135(1)). + + * Windows 2000 (changeset e52df05b496a). + + * Windows systems where ‘COMSPEC’ points to ‘command.com’ + (bpo-14470(2)). + + * VMS (bpo-16136(3)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=16135 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=14470 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=16136 + + +File: python.info, Node: API and Feature Removals<5>, Next: Code Cleanups, Prev: Operating Systems No Longer Supported, Up: Removed<11> + +1.10.7.2 API and Feature Removals +................................. + +The following obsolete and previously deprecated APIs and features have +been removed: + + * The unmaintained ‘Misc/TextMate’ and ‘Misc/vim’ directories have + been removed (see the devguide(1) for suggestions on what to use + instead). + + * The ‘SO’ makefile macro is removed (it was replaced by the + ‘SHLIB_SUFFIX’ and ‘EXT_SUFFIX’ macros) (bpo-16754(2)). + + * The ‘PyThreadState.tick_counter’ field has been removed; its value + has been meaningless since Python 3.2, when the “new GIL” was + introduced (bpo-19199(3)). + + * ‘PyLoader’ and ‘PyPycLoader’ have been removed from *note + importlib: 77. (Contributed by Taras Lyapun in bpo-15641(4).) + + * The 'strict' argument to *note HTTPConnection: b40. and *note + HTTPSConnection: b41. has been removed. HTTP 0.9-style “Simple + Responses” are no longer supported. + + * The deprecated *note urllib.request.Request: fd3. getter and setter + methods ‘add_data’, ‘has_data’, ‘get_data’, ‘get_type’, ‘get_host’, + ‘get_selector’, ‘set_proxy’, ‘get_origin_req_host’, and + ‘is_unverifiable’ have been removed (use direct attribute access + instead). + + * Support for loading the deprecated ‘TYPE_INT64’ has been removed + from *note marshal: 8d. (Contributed by Dan Riti in bpo-15480(5).) + + * *note inspect.Signature: 1cf.: positional-only parameters are now + required to have a valid name. + + * *note object.__format__(): 61a. no longer accepts non-empty format + strings, it now raises a *note TypeError: 534. instead. Using a + non-empty string has been deprecated since Python 3.2. This change + has been made to prevent a situation where previously working (but + incorrect) code would start failing if an object gained a + __format__ method, which means that your code may now raise a *note + TypeError: 534. if you are using an ‘'s'’ format code with objects + that do not have a __format__ method that handles it. See + bpo-7994(6) for background. + + * ‘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: 1012. object (bpo-13248(7)). + + ---------- Footnotes ---------- + + (1) https://devguide.python.org + + (2) https://bugs.python.org/issue?@action=redirect&bpo=16754 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=19199 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=15641 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=15480 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=7994 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=13248 + + +File: python.info, Node: Code Cleanups, Prev: API and Feature Removals<5>, Up: Removed<11> + +1.10.7.3 Code Cleanups +...................... + + * The unused and undocumented internal ‘Scanner’ class has been + removed from the *note pydoc: b5. module. + + * The private and effectively unused ‘_gestalt’ module has been + removed, along with the private *note platform: aa. functions + ‘_mac_ver_lookup’, ‘_mac_ver_gstalt’, and ‘_bcd2str’, which would + only have ever been called on badly broken OSX systems (see + bpo-18393(1)). + + * The hardcoded copies of certain *note stat: d1. constants that were + included in the *note tarfile: de. module namespace have been + removed. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=18393 + + +File: python.info, Node: Porting to Python 3 4, Next: Changed in 3 4 3, Prev: Removed<11>, Up: What’s New In Python 3 4 + +1.10.8 Porting to Python 3.4 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Changes in ‘python’ Command Behavior: Changes in ‘python’ Command Behavior<2>. +* Changes in the Python API: Changes in the Python API<10>. +* Changes in the C API: Changes in the C API<8>. + + +File: python.info, Node: Changes in ‘python’ Command Behavior<2>, Next: Changes in the Python API<10>, Up: Porting to Python 3 4 + +1.10.8.1 Changes in ‘python’ Command Behavior +............................................. + + * In a posix shell, setting the ‘PATH’ environment variable to an + empty value is equivalent to not setting it at all. However, + setting *note PYTHONPATH: 1016. to an empty value was 'not' + equivalent to not setting it at all: setting *note PYTHONPATH: + 1016. to an empty value was equivalent to setting it to ‘.’, which + leads to confusion when reasoning by analogy to how ‘PATH’ works. + The behavior now conforms to the posix convention for ‘PATH’. + + * The [X refs, Y blocks] output of a debug (‘--with-pydebug’) build + of the CPython interpreter is now off by default. It can be + re-enabled using the ‘-X showrefcount’ option. (Contributed by + Ezio Melotti in bpo-17323(1).) + + * The python command and most stdlib scripts (as well as *note + argparse: 6.) now output ‘--version’ information to ‘stdout’ + instead of ‘stderr’ (for issue list see *note Other Improvements: + fff. above). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=17323 + + +File: python.info, Node: Changes in the Python API<10>, Next: Changes in the C API<8>, Prev: Changes in ‘python’ Command Behavior<2>, Up: Porting to Python 3 4 + +1.10.8.2 Changes in the Python API +.................................. + + * The ABCs defined in *note importlib.abc: 78. now either raise the + appropriate exception or return a default value instead of raising + *note NotImplementedError: 22a. blindly. This will only affect + code calling *note super(): 4d7. and falling through all the way to + the ABCs. For compatibility, catch both *note NotImplementedError: + 22a. or the appropriate exception as needed. + + * The module type now initializes the *note __package__: 2db. and + *note __loader__: 2e6. 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. + + * Import now resets relevant attributes (e.g. ‘__name__’, + ‘__loader__’, ‘__package__’, ‘__file__’, ‘__cached__’) + unconditionally when reloading. Note that this restores a pre-3.3 + behavior in that it means a module is re-found when re-loaded + (bpo-19413(2)). + + * Frozen packages no longer set ‘__path__’ to a list containing the + package name, they now set it to an empty list. The previous + behavior could cause the import system to do the wrong thing on + submodule imports if there was also a directory with the same name + as the frozen package. The correct way to determine if a module is + a package or not is to use ‘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: + 1018, or if Python 2 compatibility is necessary you can use + ‘imp.is_frozen()’. + + * *note py_compile.compile(): a24. now raises *note FileExistsError: + 1019. if the file path it would write to is a symlink or a + non-regular file. This is to act as a warning that import will + overwrite those files with a regular file regardless of what type + of file path they were originally. + + * *note importlib.abc.SourceLoader.get_source(): 101a. no longer + raises *note ImportError: 415. when the source code being loaded + triggers a *note SyntaxError: 18d. or *note UnicodeDecodeError: + a12. As *note ImportError: 415. is meant to be raised only when + source code cannot be found but it should, it was felt to be + over-reaching/overloading of that meaning when the source code is + found but improperly structured. If you were catching ImportError + before and wish to continue to ignore syntax or decoding issues, + catch all three exceptions now. + + * *note functools.update_wrapper(): 101b. and *note + functools.wraps(): f58. now correctly set the ‘__wrapped__’ + attribute to the function being wrapped, even if that function also + had its ‘__wrapped__’ attribute set. This means ‘__wrapped__’ + attributes now correctly link a stack of decorated functions rather + than every ‘__wrapped__’ attribute in the chain referring to the + innermost function. Introspection libraries that assumed the + previous behaviour was intentional can use *note inspect.unwrap(): + f57. to access the first function in the chain that has no + ‘__wrapped__’ attribute. + + * *note inspect.getfullargspec(): 734. has been reimplemented on top + of *note inspect.signature(): 733. and hence handles a much wider + variety of callable objects than it did in the past. It is + expected that additional builtin and extension module callables + will gain signature metadata over the course of the Python 3.4 + series. Code that assumes that *note inspect.getfullargspec(): + 734. will fail on non-Python callables may need to be adjusted + accordingly. + + * *note importlib.machinery.PathFinder: 101c. now passes on the + current working directory to objects in *note sys.path_hooks: 101d. + for the empty string. This results in *note + sys.path_importer_cache: 5e0. never containing ‘''’, thus iterating + through *note sys.path_importer_cache: 5e0. based on *note + sys.path: 3b0. will not find all keys. A module’s ‘__file__’ when + imported in the current working directory will also now have an + absolute path, including when using ‘-m’ with the interpreter + (except for ‘__main__.__file__’ when a script has been executed + directly using a relative path) (Contributed by Brett Cannon in + bpo-18416(4)). is specified on the command-line) (bpo-18416(5)). + + * The removal of the 'strict' argument to *note HTTPConnection: b40. + and *note HTTPSConnection: b41. changes the meaning of the + remaining arguments if you are specifying them positionally rather + than by keyword. If you’ve been paying attention to deprecation + warnings your code should already be specifying any additional + arguments via keywords. + + * Strings between ‘from __future__ import ...’ statements now + 'always' raise a *note SyntaxError: 18d. Previously if there was + no leading docstring, an interstitial string would sometimes be + ignored. This brings CPython into compliance with the language + spec; Jython and PyPy already were. (bpo-17434(6)). + + * *note ssl.SSLSocket.getpeercert(): fb2. and *note + ssl.SSLSocket.do_handshake(): e68. now raise an *note OSError: 413. + with ‘ENOTCONN’ when the ‘SSLSocket’ is not connected, instead of + the previous behavior of raising an *note AttributeError: 348. In + addition, *note getpeercert(): fb2. will raise a *note ValueError: + 204. if the handshake has not yet been done. + + * *note base64.b32decode(): 101e. now raises a *note binascii.Error: + 101f. when the input string contains non-b32-alphabet characters, + instead of a *note TypeError: 534. This particular *note + TypeError: 534. was missed when the other *note TypeError: 534.s + were converted. (Contributed by Serhiy Storchaka in bpo-18011(7).) + Note: this change was also inadvertently applied in 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. + + * Calling ‘read’ or ‘write’ on a closed SSL socket now raises an + informative *note ValueError: 204. rather than the previous more + mysterious *note AttributeError: 348. (bpo-9177(8)). + + * *note slice.indices(): 1020. no longer produces an *note + OverflowError: 87f. for huge values. As a consequence of this fix, + *note slice.indices(): 1020. now raises a *note ValueError: 204. if + given a negative length; previously it returned nonsense values + (bpo-14794(9)). + + * The *note complex: 2f2. constructor, unlike the *note cmath: 18. + functions, was incorrectly accepting *note float: 2f1. values if an + object’s ‘__complex__’ special method returned one. This now + raises a *note TypeError: 534. (bpo-16290(10).) + + * The *note int: 259. constructor in 3.2 and 3.3 erroneously accepts + *note float: 2f1. values for the 'base' parameter. It is unlikely + anyone was doing this, but if so, it will now raise a *note + TypeError: 534. (bpo-16772(11)). + + * Defaults for keyword-only arguments are now evaluated 'after' + defaults for regular keyword arguments, instead of before. + Hopefully no one wrote any code that depends on the previous buggy + behavior (bpo-16967(12)). + + * Stale thread states are now cleared after *note fork(): 197. This + may cause some system resources to be released that previously were + incorrectly kept perpetually alive (for example, database + connections kept in thread-local storage). (bpo-17094(13).) + + * Parameter names in ‘__annotations__’ dicts are now mangled + properly, similarly to *note __kwdefaults__: 1021. (Contributed by + Yury Selivanov in bpo-20625(14).) + + * *note hashlib.hash.name: f43. now always returns the identifier in + lower case. Previously some builtin hashes had uppercase names, + but now that it is a formal public interface the naming has been + made consistent (bpo-18532(15)). + + * Because *note unittest.TestSuite: df3. now drops references to + tests after they are run, test harnesses that reuse a *note + TestSuite: df3. 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: 106. is designed to provide. However, if the lack of + isolation is considered acceptable, the old behavior can be + restored by creating a *note TestSuite: df3. subclass that defines + a ‘_removeTestAtIndex’ method that does nothing (see *note + TestSuite.__iter__(): 1022.) (bpo-11798(16)). + + * *note unittest: 106. now uses *note argparse: 6. for command line + parsing. There are certain invalid command forms that used to work + that are no longer allowed; in theory this should not cause + backward compatibility issues since the disallowed command forms + didn’t make any sense and are unlikely to be in use. + + * The *note re.split(): 2a4, *note re.findall(): 1023, and *note + re.sub(): 2a5. functions, and the ‘group()’ and ‘groups()’ methods + of ‘match’ objects now always return a 'bytes' object when the + string to be matched is a *note bytes-like object: d2d. 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(17)). + + * The new 'convert_charrefs' argument to *note HTMLParser: 874. + currently defaults to ‘False’ for backward compatibility, but will + eventually be changed to default to ‘True’. It is recommended that + you add this keyword, with the appropriate value, to any *note + HTMLParser: 874. calls in your code (bpo-13633(18)). + + * Since the 'digestmod' argument to the *note hmac.new(): a9f. + function will in the future have no default, all calls to *note + hmac.new(): a9f. should be changed to explicitly specify a + 'digestmod' (bpo-17276(19)). + + * Calling *note sysconfig.get_config_var(): 1024. with the ‘SO’ key, + or looking ‘SO’ up in the results of a call to *note + sysconfig.get_config_vars(): 1025. is deprecated. This key should + be replaced by ‘EXT_SUFFIX’ or ‘SHLIB_SUFFIX’, depending on the + context (bpo-19555(20)). + + * Any calls to ‘open’ functions that specify ‘U’ should be modified. + ‘U’ is ineffective in Python3 and will eventually raise an error if + used. Depending on the function, the equivalent of its old Python2 + behavior can be achieved using either a 'newline' argument, or if + necessary by wrapping the stream in *note TextIOWrapper: 7b6. to + use its 'newline' argument (bpo-15204(21)). + + * If you use ‘pyvenv’ in a script and desire that pip 'not' be + installed, you must add ‘--without-pip’ to your command invocation. + + * The default behavior of *note json.dump(): d44. and *note + json.dumps(): d45. when an indent is specified has changed: it no + longer produces trailing spaces after the item separating commas at + the ends of lines. This will matter only if you have tests that + are doing white-space-sensitive comparisons of such output + (bpo-16333(22)). + + * *note doctest: 3a. now looks for doctests in extension module + ‘__doc__’ strings, so if your doctest test discovery includes + extension modules that have things that look like doctests in them + you may see test failures you’ve never seen before when running + your tests (bpo-3158(23)). + + * The *note collections.abc: 1e. module has been slightly refactored + as part of the Python startup improvements. As a consequence of + this, it is no longer the case that importing *note collections: + 1d. automatically imports *note collections.abc: 1e. If your + program depended on the (undocumented) implicit import, you will + need to add an explicit ‘import collections.abc’ (bpo-20784(24)). + + ---------- 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://bugs.python.org/issue?@action=redirect&bpo=18416 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=18416 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=17434 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=18011 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=9177 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=14794 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=16290 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=16772 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=16967 + + (13) https://bugs.python.org/issue?@action=redirect&bpo=17094 + + (14) https://bugs.python.org/issue?@action=redirect&bpo=20625 + + (15) https://bugs.python.org/issue?@action=redirect&bpo=18532 + + (16) https://bugs.python.org/issue?@action=redirect&bpo=11798 + + (17) https://bugs.python.org/issue?@action=redirect&bpo=16685 + + (18) https://bugs.python.org/issue?@action=redirect&bpo=13633 + + (19) https://bugs.python.org/issue?@action=redirect&bpo=17276 + + (20) https://bugs.python.org/issue?@action=redirect&bpo=19555 + + (21) https://bugs.python.org/issue?@action=redirect&bpo=15204 + + (22) https://bugs.python.org/issue?@action=redirect&bpo=16333 + + (23) https://bugs.python.org/issue?@action=redirect&bpo=3158 + + (24) https://bugs.python.org/issue?@action=redirect&bpo=20784 + + +File: python.info, Node: Changes in the C API<8>, Prev: Changes in the Python API<10>, Up: Porting to Python 3 4 + +1.10.8.3 Changes in the C API +............................. + + * *note PyEval_EvalFrameEx(): 1027, *note PyObject_Repr(): 1028, and + *note PyObject_Str(): 1029, along with some other internal C APIs, + now include a debugging assertion that ensures they are not used in + situations where they may silently discard a currently active + exception. In cases where discarding the active exception is + expected and desired (for example, because it has already been + saved locally with *note PyErr_Fetch(): 3ef. or is being + deliberately replaced with a different exception), an explicit + *note PyErr_Clear(): 102a. call will be needed to avoid triggering + the assertion when invoking these operations (directly or + indirectly) and running against a version of Python that is + compiled with assertions enabled. + + * *note PyErr_SetImportError(): d3e. now sets *note TypeError: 534. + when its 'msg' argument is not set. Previously only ‘NULL’ was + returned with no exception set. + + * The result of the *note PyOS_ReadlineFunctionPointer: 583. callback + must now be a string allocated by *note PyMem_RawMalloc(): 38b. or + *note PyMem_RawRealloc(): 38d, or ‘NULL’ if an error occurred, + instead of a string allocated by *note PyMem_Malloc(): c66. or + *note PyMem_Realloc(): 102b. (bpo-16742(1)) + + * *note PyThread_set_key_value(): 404. now always set the value. In + Python 3.3, the function did nothing if the key already exists (if + the current value is a non-‘NULL’ pointer). + + * The ‘f_tstate’ (thread state) field of the *note PyFrameObject: + 784. structure has been removed to fix a bug: see bpo-14432(2) for + the rationale. + + ---------- 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: Changed in 3 4 3, Prev: Porting to Python 3 4, Up: What’s New In Python 3 4 + +1.10.9 Changed in 3.4.3 +----------------------- + +* Menu: + +* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients. + + +File: python.info, Node: PEP 476 Enabling certificate verification by default for stdlib http clients, Up: Changed in 3 4 3 + +1.10.9.1 PEP 476: Enabling certificate verification by default for stdlib http clients +...................................................................................... + +*note http.client: 6f. and modules which use it, such as *note +urllib.request: 10b. and *note xmlrpc.client: 12e, will now verify that +the server presents a certificate which is signed by a CA in the +platform trust store and whose hostname matches the hostname being +requested by default, significantly improving security for many +applications. + +For applications which require the old previous behavior, they can pass +an alternate context: + + 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.11 What’s New In Python 3.3 +============================= + +This article explains the new features in Python 3.3, compared to 3.2. +Python 3.3 was released on September 29, 2012. For full details, see +the changelog(1). + +See also +........ + +PEP 398(2) - Python 3.3 Release Schedule + +* Menu: + +* Summary – Release highlights: Summary – Release highlights<8>. +* PEP 405; Virtual Environments: PEP 405 Virtual Environments. +* PEP 420; Implicit Namespace Packages: PEP 420 Implicit Namespace Packages. +* PEP 3118; New memoryview implementation and buffer protocol documentation: PEP 3118 New memoryview implementation and buffer protocol documentation. +* PEP 393; Flexible String Representation: PEP 393 Flexible String Representation. +* PEP 397; Python Launcher for Windows: PEP 397 Python Launcher for Windows. +* PEP 3151; Reworking the OS and IO exception hierarchy: PEP 3151 Reworking the OS and IO exception hierarchy. +* PEP 380; Syntax for Delegating to a Subgenerator: PEP 380 Syntax for Delegating to a Subgenerator. +* PEP 409; Suppressing exception context: PEP 409 Suppressing exception context. +* PEP 414; Explicit Unicode literals: PEP 414 Explicit Unicode literals. +* PEP 3155; Qualified name for classes and functions: PEP 3155 Qualified name for classes and functions. +* PEP 412; Key-Sharing Dictionary: PEP 412 Key-Sharing Dictionary. +* PEP 362; Function Signature Object: PEP 362 Function Signature Object. +* PEP 421; Adding sys.implementation: PEP 421 Adding sys implementation. +* Using importlib as the Implementation of Import:: +* Other Language Changes: Other Language Changes<11>. +* A Finer-Grained Import Lock:: +* Builtin functions and types:: +* New Modules: New Modules<11>. +* Improved Modules: Improved Modules<11>. +* Optimizations: Optimizations<10>. +* Build and C API Changes: Build and C API Changes<4>. +* Deprecated: Deprecated<12>. +* Porting to Python 3.3: Porting to Python 3 3. + + ---------- Footnotes ---------- + + (1) https://docs.python.org/3.3/whatsnew/changelog.html + + (2) https://peps.python.org/pep-0398/ + + +File: python.info, Node: Summary – Release highlights<8>, Next: PEP 405 Virtual Environments, Up: What’s New In Python 3 3 + +1.11.1 Summary – Release highlights +----------------------------------- + +New syntax features: + + * New ‘yield from’ expression for *note generator delegation: 1032. + + * The ‘u'unicode'’ syntax is accepted again for *note str: 447. + objects. + +New library modules: + + * *note faulthandler: 58. (helps debugging low-level crashes) + + * *note ipaddress: 80. (high-level objects representing IP addresses + and masks) + + * *note lzma: 8a. (compress data using the XZ / LZMA algorithm) + + * *note unittest.mock: 107. (replace parts of your system under test + with mock objects) + + * *note venv: 111. (Python *note virtual environments: 1033, as in + the popular ‘virtualenv’ package) + +New built-in features: + + * Reworked *note I/O exception hierarchy: 1034. + +Implementation improvements: + + * Rewritten *note import machinery: 1035. based on *note importlib: + 77. + + * More compact *note unicode strings: 1036. + + * More compact *note attribute dictionaries: 1037. + +Significantly Improved Library Modules: + + * C Accelerator for the *note decimal: 1038. module. + + * Better unicode handling in the *note email: 1039. module (*note + provisional: 103a.). + +Security improvements: + + * Hash randomization is switched on by default. + +Please read on for a comprehensive list of user-facing changes. + + +File: python.info, Node: PEP 405 Virtual Environments, Next: PEP 420 Implicit Namespace Packages, Prev: Summary – Release highlights<8>, Up: What’s New In Python 3 3 + +1.11.2 PEP 405: Virtual Environments +------------------------------------ + +Virtual environments help create separate Python setups while sharing a +system-wide base install, for ease of maintenance. Virtual environments +have their own set of private site packages (i.e. locally installed +libraries), and are optionally segregated from the system-wide site +packages. Their concept and implementation are inspired by the popular +‘virtualenv’ third-party package, but benefit from tighter integration +with the interpreter core. + +This PEP adds the *note venv: 111. module for programmatic access, and +the ‘pyvenv’ script for command-line access and administration. The +Python interpreter checks for a ‘pyvenv.cfg’, file whose existence +signals the base of a virtual environment’s directory tree. + +See also +........ + +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 Implicit Namespace Packages, Next: PEP 3118 New memoryview implementation and buffer protocol documentation, Prev: PEP 405 Virtual Environments, Up: What’s New In Python 3 3 + +1.11.3 PEP 420: Implicit Namespace Packages +------------------------------------------- + +Native support for package directories that don’t require ‘__init__.py’ +marker files and can automatically span multiple path segments (inspired +by various third party approaches to namespace packages, as described in +PEP 420(1)) + +See also +........ + +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 New memoryview implementation and buffer protocol documentation, Next: PEP 393 Flexible String Representation, Prev: PEP 420 Implicit Namespace Packages, Up: What’s New In Python 3 3 + +1.11.4 PEP 3118: New memoryview implementation and buffer protocol documentation +-------------------------------------------------------------------------------- + +The implementation of PEP 3118(1) has been significantly improved. + +The new memoryview implementation comprehensively fixes all ownership +and lifetime issues of dynamically allocated fields in the Py_buffer +struct that led to multiple crash reports. Additionally, several +functions that crashed or returned incorrect results for non-contiguous +or multi-dimensional input have been fixed. + +The memoryview object now has a PEP-3118 compliant getbufferproc() that +checks the consumer’s request type. Many new features have been added, +most of them work in full generality for non-contiguous arrays and +arrays with suboffsets. + +The documentation has been updated, clearly spelling out +responsibilities for both exporters and consumers. Buffer request flags +are grouped into basic and compound flags. The memory layout of +non-contiguous and multi-dimensional NumPy-style arrays is explained. + +* Menu: + +* Features:: +* API changes:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3118/ + + +File: python.info, Node: Features, Next: API changes, Up: PEP 3118 New memoryview implementation and buffer protocol documentation + +1.11.4.1 Features +................. + + * All native single character format specifiers in struct module + syntax (optionally prefixed with ‘@’) are now supported. + + * With some restrictions, the cast() method allows changing of format + and shape of C-contiguous arrays. + + * Multi-dimensional list representations are supported for any array + type. + + * Multi-dimensional comparisons are supported for any array type. + + * One-dimensional memoryviews of hashable (read-only) types with + formats B, b or c are now 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 changes, Prev: Features, Up: PEP 3118 New memoryview implementation and buffer protocol documentation + +1.11.4.2 API changes +.................... + + * The maximum number of dimensions is officially limited to 64. + + * The representation of empty shape, strides and suboffsets is now an + empty tuple instead of ‘None’. + + * Accessing a memoryview element with format ‘B’ (unsigned bytes) now + returns an integer (in accordance with the struct module syntax). + For returning a bytes object the view must be cast to ‘c’ first. + + * memoryview comparisons now use the logical structure of the + operands and compare all array elements by value. All format + strings in struct module syntax are supported. Views with + unrecognised format strings are still permitted, but will always + compare as unequal, regardless of view contents. + + * For further changes see *note Build and C API Changes: 1041. and + *note Porting C code: 1042. + +(Contributed by Stefan Krah in bpo-10181(1).) + +See also +........ + +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 Flexible String Representation, Next: PEP 397 Python Launcher for Windows, Prev: PEP 3118 New memoryview implementation and buffer protocol documentation, Up: What’s New In Python 3 3 + +1.11.5 PEP 393: Flexible String Representation +---------------------------------------------- + +The Unicode string type is changed to support multiple internal +representations, depending on the character with the largest Unicode +ordinal (1, 2, or 4 bytes) in the represented string. This allows a +space-efficient representation in common cases, but gives access to full +UCS-4 on all systems. For compatibility with existing APIs, several +representations may exist in parallel; over time, this compatibility +should be phased out. + +On the Python side, there should be no downside to this change. + +On the C API side, PEP 393(1) is fully backward compatible. The legacy +API should remain available at least five years. Applications using the +legacy API will not fully benefit of the memory reduction, or - worse - +may use a bit more memory, because Python may have to maintain two +versions of each string (in the legacy format and in the new efficient +storage). + +* Menu: + +* Functionality:: +* Performance and resource usage:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0393/ + + +File: python.info, Node: Functionality, Next: Performance and resource usage, Up: PEP 393 Flexible String Representation + +1.11.5.1 Functionality +...................... + +Changes introduced by PEP 393(1) are the following: + + * Python now always supports the full range of Unicode code points, + including non-BMP ones (i.e. from ‘U+0000’ to ‘U+10FFFF’). The + distinction between narrow and wide builds no longer exists and + Python now behaves like a wide build, even under Windows. + + * With the death of narrow builds, the problems specific to narrow + builds have also been fixed, for example: + + * *note len(): 62a. now always returns 1 for non-BMP characters, + so ‘len('\U0010FFFF') == 1’; + + * surrogate pairs are not recombined in string literals, so + ‘'\uDBFF\uDFFF' != '\U0010FFFF'’; + + * indexing or slicing non-BMP characters returns the expected + value, so ‘'\U0010FFFF'[0]’ now returns ‘'\U0010FFFF'’ and not + ‘'\uDBFF'’; + + * all other functions in the standard library now correctly + handle non-BMP code points. + + * The value of *note sys.maxunicode: 1045. is now always ‘1114111’ + (‘0x10FFFF’ in hexadecimal). The ‘PyUnicode_GetMax()’ function + still returns either ‘0xFFFF’ or ‘0x10FFFF’ for backward + compatibility, and it should not be used with the new Unicode API + (see bpo-13054(2)). + + * The ‘./configure’ flag ‘--with-wide-unicode’ has been removed. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0393/ + + (2) https://bugs.python.org/issue?@action=redirect&bpo=13054 + + +File: python.info, Node: Performance and resource usage, Prev: Functionality, Up: PEP 393 Flexible String Representation + +1.11.5.2 Performance and resource usage +....................................... + +The storage of Unicode strings now depends on the highest code point in +the string: + + * pure ASCII and Latin1 strings (‘U+0000-U+00FF’) use 1 byte per code + point; + + * BMP strings (‘U+0000-U+FFFF’) use 2 bytes per code point; + + * non-BMP strings (‘U+10000-U+10FFFF’) use 4 bytes per code point. + +The net effect is that for most applications, memory usage of string +storage should decrease significantly - especially compared to former +wide unicode builds - as, in many cases, strings will be pure ASCII even +in international contexts (because many strings store non-human language +data, such as XML fragments, HTTP headers, JSON-encoded data, etc.). We +also hope that it will, for the same reasons, increase CPU cache +efficiency on non-trivial applications. The memory usage of Python 3.3 +is two to three times smaller than Python 3.2, and a little bit better +than Python 2.7, on a Django benchmark (see the PEP for details). + +See also +........ + +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 Python Launcher for Windows, Next: PEP 3151 Reworking the OS and IO exception hierarchy, Prev: PEP 393 Flexible String Representation, Up: What’s New In Python 3 3 + +1.11.6 PEP 397: Python Launcher for Windows +------------------------------------------- + +The Python 3.3 Windows installer now includes a ‘py’ launcher +application that can be used to launch Python applications in a version +independent fashion. + +This launcher is invoked implicitly when double-clicking ‘*.py’ files. +If only a single Python version is installed on the system, that version +will be used to run the file. If multiple versions are installed, the +most recent version is used by default, but this can be overridden by +including a Unix-style “shebang line” in the Python script. + +The launcher can also be used explicitly from the command line as the +‘py’ application. Running ‘py’ follows the same version selection rules +as implicitly launching scripts, but a more specific version can be +selected by passing appropriate arguments (such as ‘-3’ to request +Python 3 when Python 2 is also installed, or ‘-2.6’ to specifically +request an earlier Python version when a more recent version is +installed). + +In addition to the launcher, the Windows installer now includes an +option to add the newly installed Python to the system PATH. +(Contributed by Brian Curtin in bpo-3561(1).) + +See also +........ + +PEP 397(2) - Python Launcher for Windows + + PEP written by Mark Hammond and Martin v. Löwis; implementation by + Vinay Sajip. + +Launcher documentation: *note Python Launcher for Windows: 5ba. + +Installer PATH modification: *note Finding the Python executable: 1049. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=3561 + + (2) https://peps.python.org/pep-0397/ + + +File: python.info, Node: PEP 3151 Reworking the OS and IO exception hierarchy, Next: PEP 380 Syntax for Delegating to a Subgenerator, Prev: PEP 397 Python Launcher for Windows, Up: What’s New In Python 3 3 + +1.11.7 PEP 3151: Reworking the OS and IO exception hierarchy +------------------------------------------------------------ + +The hierarchy of exceptions raised by operating system errors is now +both simplified and finer-grained. + +You don’t have to worry anymore about choosing the appropriate exception +type between *note OSError: 413, *note IOError: 104b, *note +EnvironmentError: 104c, *note WindowsError: 104d, ‘mmap.error’, *note +socket.error: 104e. or *note select.error: 104f. All these exception +types are now only one: *note OSError: 413. The other names are kept as +aliases for compatibility reasons. + +Also, it is now easier to catch a specific error condition. Instead of +inspecting the ‘errno’ attribute (or ‘args[0]’) for a particular +constant from the *note errno: 57. module, you can catch the adequate +*note OSError: 413. subclass. The available subclasses are the +following: + + * *note BlockingIOError: 1050. + + * *note ChildProcessError: 1051. + + * *note ConnectionError: e09. + + * *note FileExistsError: 1019. + + * *note FileNotFoundError: 427. + + * *note InterruptedError: d87. + + * *note IsADirectoryError: 1052. + + * *note NotADirectoryError: 1053. + + * *note PermissionError: d42. + + * *note ProcessLookupError: 1054. + + * *note TimeoutError: 831. + +And the *note ConnectionError: e09. itself has finer-grained subclasses: + + * *note BrokenPipeError: 1055. + + * *note ConnectionAbortedError: 1056. + + * *note ConnectionRefusedError: 1057. + + * *note ConnectionResetError: 1058. + +Thanks to the new exceptions, common usages of the *note errno: 57. can +now be avoided. For example, the following code written for 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 + +can now be written without the *note errno: 57. import and without +manual inspection of exception attributes: + + 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") + +See also +........ + +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 Syntax for Delegating to a Subgenerator, Next: PEP 409 Suppressing exception context, Prev: PEP 3151 Reworking the OS and IO exception hierarchy, Up: What’s New In Python 3 3 + +1.11.8 PEP 380: Syntax for Delegating to a Subgenerator +------------------------------------------------------- + +PEP 380 adds the ‘yield from’ expression, allowing a *note generator: +105a. to delegate part of its operations to another generator. This +allows a section of code containing *note yield: 9cd. to be factored out +and placed in another generator. Additionally, the subgenerator is +allowed to return with a value, and the value is made available to the +delegating generator. + +While designed primarily for use in delegating to a subgenerator, the +‘yield from’ expression actually allows delegation to arbitrary +subiterators. + +For simple iterators, ‘yield from iterable’ is essentially just a +shortened form of ‘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] + +However, unlike an ordinary loop, ‘yield from’ allows subgenerators to +receive sent and thrown values directly from the calling scope, and +return a final value to the outer generator: + + >>> 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] + +The main principle driving this change is to allow even generators that +are designed to be used with the ‘send’ and ‘throw’ methods to be split +into multiple subgenerators as easily as a single large function can be +split into multiple subfunctions. + +See also +........ + +PEP 380(1) - Syntax for Delegating to a Subgenerator + + 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 Suppressing exception context, Next: PEP 414 Explicit Unicode literals, Prev: PEP 380 Syntax for Delegating to a Subgenerator, Up: What’s New In Python 3 3 + +1.11.9 PEP 409: Suppressing exception context +--------------------------------------------- + +PEP 409 introduces new syntax that allows the display of the chained +exception context to be disabled. This allows cleaner error messages in +applications that convert between exception types: + + >>> 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 "", line 1, in + File "", line 8, in __getattr__ + AttributeError: x + +Without the ‘from None’ suffix to suppress the cause, the original +exception would be displayed by default: + + >>> 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 "", line 6, in __getattr__ + KeyError: 'x' + + During handling of the above exception, another exception occurred: + + Traceback (most recent call last): + File "", line 1, in + File "", line 8, in __getattr__ + AttributeError: x + +No debugging capability is lost, as the original exception context +remains available if needed (for example, if an intervening library has +incorrectly suppressed valuable underlying details): + + >>> try: + ... D({}).x + ... except AttributeError as exc: + ... print(repr(exc.__context__)) + ... + KeyError('x',) + +See also +........ + +PEP 409(1) - Suppressing exception context + + 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 Explicit Unicode literals, Next: PEP 3155 Qualified name for classes and functions, Prev: PEP 409 Suppressing exception context, Up: What’s New In Python 3 3 + +1.11.10 PEP 414: Explicit Unicode literals +------------------------------------------ + +To ease the transition from Python 2 for Unicode aware Python +applications that make heavy use of Unicode literals, Python 3.3 once +again supports the “‘u’” prefix for string literals. This prefix has no +semantic significance in Python 3, it is provided solely to reduce the +number of purely mechanical changes in migrating to Python 3, making it +easier for developers to focus on the more significant semantic changes +(such as the stricter default separation of binary and text data). + +See also +........ + +PEP 414(1) - Explicit Unicode literals + + PEP written by Armin Ronacher. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0414/ + + +File: python.info, Node: PEP 3155 Qualified name for classes and functions, Next: PEP 412 Key-Sharing Dictionary, Prev: PEP 414 Explicit Unicode literals, Up: What’s New In Python 3 3 + +1.11.11 PEP 3155: Qualified name for classes and functions +---------------------------------------------------------- + +Functions and class objects have a new *note __qualname__: 105e. +attribute representing the “path” from the module top-level to their +definition. For global functions and classes, this is the same as *note +__name__: 105f. 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. + +Example with (non-bound) methods: + + >>> class C: + ... def meth(self): + ... pass + ... + >>> C.meth.__name__ + 'meth' + >>> C.meth.__qualname__ + 'C.meth' + +Example with nested classes: + + >>> 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' + +Example with nested functions: + + >>> def outer(): + ... def inner(): + ... pass + ... return inner + ... + >>> outer().__name__ + 'inner' + >>> outer().__qualname__ + 'outer..inner' + +The string representation of those objects is also changed to include +the new, more precise information: + + >>> str(C.D) + "" + >>> str(C.D.meth) + '' + +See also +........ + +PEP 3155(1) - Qualified name for classes and functions + + PEP written and implemented by Antoine Pitrou. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3155/ + + +File: python.info, Node: PEP 412 Key-Sharing Dictionary, Next: PEP 362 Function Signature Object, Prev: PEP 3155 Qualified name for classes and functions, Up: What’s New In Python 3 3 + +1.11.12 PEP 412: Key-Sharing Dictionary +--------------------------------------- + +Dictionaries used for the storage of objects’ attributes are now able to +share part of their internal storage between each other (namely, the +part which stores the keys and their respective hashes). This reduces +the memory consumption of programs creating many instances of +non-builtin types. + +See also +........ + +PEP 412(1) - Key-Sharing Dictionary + + PEP written and implemented by Mark Shannon. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0412/ + + +File: python.info, Node: PEP 362 Function Signature Object, Next: PEP 421 Adding sys implementation, Prev: PEP 412 Key-Sharing Dictionary, Up: What’s New In Python 3 3 + +1.11.13 PEP 362: Function Signature Object +------------------------------------------ + +A new function *note inspect.signature(): 733. makes introspection of +python callables easy and straightforward. A broad range of callables +is supported: python functions, decorated or not, classes, and *note +functools.partial(): 410. objects. New classes *note inspect.Signature: +1cf, *note inspect.Parameter: 1d0. and *note inspect.BoundArguments: +1062. hold information about the call signatures, such as, annotations, +default values, parameters kinds, and bound arguments, which +considerably simplifies writing decorators and any code that validates +or amends calling signatures or arguments. + +See also +........ + +PEP 362(1): - Function Signature Object + + 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 Adding sys implementation, Next: Using importlib as the Implementation of Import, Prev: PEP 362 Function Signature Object, Up: What’s New In Python 3 3 + +1.11.14 PEP 421: Adding sys.implementation +------------------------------------------ + +A new attribute on the *note sys: d9. module exposes details specific to +the implementation of the currently running interpreter. The initial +set of attributes on *note sys.implementation: 512. are ‘name’, +‘version’, ‘hexversion’, and ‘cache_tag’. + +The intention of ‘sys.implementation’ is to consolidate into one +namespace the implementation-specific data used by the standard library. +This allows different Python implementations to share a single standard +library code base much more easily. In its initial state, +‘sys.implementation’ holds only a small portion of the +implementation-specific data. Over time that ratio will shift in order +to make the standard library more portable. + +One example of improved standard library portability is ‘cache_tag’. As +of Python 3.3, ‘sys.implementation.cache_tag’ is used by *note +importlib: 77. to support PEP 3147(1) compliance. Any Python +implementation that uses ‘importlib’ for its built-in import system may +use ‘cache_tag’ to control the caching behavior for modules. + +* Menu: + +* SimpleNamespace:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + +File: python.info, Node: SimpleNamespace, Up: PEP 421 Adding sys implementation + +1.11.14.1 SimpleNamespace +......................... + +The implementation of ‘sys.implementation’ also introduces a new type to +Python: *note types.SimpleNamespace: 1d1. In contrast to a +mapping-based namespace, like *note dict: 258, ‘SimpleNamespace’ is +attribute-based, like *note object: a8c. However, unlike ‘object’, +‘SimpleNamespace’ instances are writable. This means that you can add, +remove, and modify the namespace through normal attribute access. + +See also +........ + +PEP 421(1) - Adding sys.implementation + + PEP written and implemented by Eric Snow. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0421/ + + +File: python.info, Node: Using importlib as the Implementation of Import, Next: Other Language Changes<11>, Prev: PEP 421 Adding sys implementation, Up: What’s New In Python 3 3 + +1.11.15 Using importlib as the Implementation of Import +------------------------------------------------------- + +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__ + +The *note __import__(): 8d3. function is now powered by *note +importlib.__import__(): 1066. This work leads to the completion of +“phase 2” of PEP 302(5). There are multiple benefits to this change. +First, it has allowed for more of the machinery powering import to be +exposed instead of being implicit and hidden within the C code. It also +provides a single implementation for all Python VMs supporting Python +3.3 to use, helping to end any VM-specific deviations in import +semantics. And finally it eases the maintenance of import, allowing for +future growth to occur. + +For the common user, there should be no visible change in semantics. +For those whose code currently manipulates import or calls import +programmatically, the code changes that might possibly be required are +covered in the *note Porting Python code: 1067. section of this +document. + +* Menu: + +* New APIs:: +* Visible Changes:: + + ---------- 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: New APIs, Next: Visible Changes, Up: Using importlib as the Implementation of Import + +1.11.15.1 New APIs +.................. + +One of the large benefits of this work is the exposure of what goes into +making the import statement work. That means the various importers that +were once implicit are now fully exposed as part of the *note importlib: +77. package. + +The abstract base classes defined in *note importlib.abc: 78. have been +expanded to properly delineate between *note meta path finders: 1069. +and *note path entry finders: 106a. by introducing *note +importlib.abc.MetaPathFinder: 86b. and *note +importlib.abc.PathEntryFinder: 86c, 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: 106b. 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: +101d. + +For loaders, the new abstract base class *note importlib.abc.FileLoader: +106c. helps write a loader that uses the file system as the storage +mechanism for a module’s code. The loader for source files (*note +importlib.machinery.SourceFileLoader: 106d.), sourceless bytecode files +(*note importlib.machinery.SourcelessFileLoader: 106e.), and extension +modules (*note importlib.machinery.ExtensionFileLoader: cb0.) are now +available for direct use. + +*note ImportError: 415. now has ‘name’ and ‘path’ attributes which are +set when there is relevant data to provide. The message for failed +imports will also provide the full name of the module now instead of +just the tail end of the module’s name. + +The *note importlib.invalidate_caches(): c10. function will now call the +method with the same name on all finders cached in *note +sys.path_importer_cache: 5e0. to help clean up any stored state as +necessary. + + +File: python.info, Node: Visible Changes, Prev: New APIs, Up: Using importlib as the Implementation of Import + +1.11.15.2 Visible Changes +......................... + +For potential required changes to code, see the *note Porting Python +code: 1067. section. + +Beyond the expanse of what *note importlib: 77. now exposes, there are +other visible changes to import. The biggest is that *note +sys.meta_path: d2b. and *note sys.path_hooks: 101d. now store all of the +meta path finders and path entry hooks used by import. Previously the +finders were implicit and hidden within the C code of import instead of +being directly exposed. This means that one can now easily remove or +change the order of the various finders to fit one’s needs. + +Another change is that all modules have a ‘__loader__’ attribute, +storing the loader used to create the module. PEP 302(1) has been +updated to make this attribute mandatory for loaders to implement, so in +the future once 3rd-party loaders have been updated people will be able +to rely on the existence of the attribute. Until such time, though, +import is setting the module post-load. + +Loaders are also now expected to set the ‘__package__’ attribute from +PEP 366(2). Once again, import itself is already setting this on all +loaders from *note importlib: 77. and import itself is setting the +attribute post-load. + +‘None’ is now inserted into *note sys.path_importer_cache: 5e0. when no +finder can be found on *note sys.path_hooks: 101d. Since +‘imp.NullImporter’ is not directly exposed on *note sys.path_hooks: +101d. it could no longer be relied upon to always be available to use as +a value representing no finder found. + +All other changes relate to semantic changes which should be taken into +consideration when updating code for Python 3.3, and thus should be read +about in the *note Porting Python code: 1067. section of this document. + +(Implementation by Brett Cannon) + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0302/ + + (2) https://peps.python.org/pep-0366/ + + +File: python.info, Node: Other Language Changes<11>, Next: A Finer-Grained Import Lock, Prev: Using importlib as the Implementation of Import, Up: What’s New In Python 3 3 + +1.11.16 Other Language Changes +------------------------------ + +Some smaller changes made to the core Python language are: + + * Added support for Unicode name aliases and named sequences. Both + *note unicodedata.lookup(): 1071. and ‘'\N{...}'’ now resolve name + aliases, and *note unicodedata.lookup(): 1071. resolves named + sequences too. + + (Contributed by Ezio Melotti in bpo-12753(1).) + + * Unicode database updated to UCD version 6.1.0 + + * Equality comparisons on *note range(): 943. objects now return a + result reflecting the equality of the underlying sequences + generated by those range objects. (bpo-13201(2)) + + * The ‘count()’, ‘find()’, ‘rfind()’, ‘index()’ and ‘rindex()’ + methods of *note bytes: 1c2. and *note bytearray: 53a. objects now + accept an integer between 0 and 255 as their first argument. + + (Contributed by Petri Lehtinen in bpo-12170(3).) + + * The ‘rjust()’, ‘ljust()’, and ‘center()’ methods of *note bytes: + 1c2. and *note bytearray: 53a. now accept a *note bytearray: 53a. + for the ‘fill’ argument. (Contributed by Petri Lehtinen in + bpo-12380(4).) + + * New methods have been added to *note list: 60d. and *note + bytearray: 53a.: ‘copy()’ and ‘clear()’ (bpo-10516(5)). + Consequently, *note MutableSequence: 1a1. now also defines a + ‘clear()’ method (bpo-11388(6)). + + * Raw bytes literals can now be written ‘rb"..."’ as well as + ‘br"..."’. + + (Contributed by Antoine Pitrou in bpo-13748(7).) + + * *note dict.setdefault(): 1072. now does only one lookup for the + given key, making it atomic when used with built-in types. + + (Contributed by Filip Gruszczyński in bpo-13521(8).) + + * The error messages produced when a function call does not match the + function signature have been significantly improved. + + (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: A Finer-Grained Import Lock, Next: Builtin functions and types, Prev: Other Language Changes<11>, Up: What’s New In Python 3 3 + +1.11.17 A Finer-Grained Import Lock +----------------------------------- + +Previous versions of CPython have always relied on a global import lock. +This led to unexpected annoyances, such as deadlocks when importing a +module would trigger code execution in a different thread as a +side-effect. Clumsy workarounds were sometimes employed, such as the +*note PyImport_ImportModuleNoBlock(): 3b9. C API function. + +In Python 3.3, importing a module takes a per-module lock. This +correctly serializes importation of a given module from multiple threads +(preventing the exposure of incompletely initialized modules), while +eliminating the aforementioned annoyances. + +(Contributed by Antoine Pitrou in bpo-9260(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9260 + + +File: python.info, Node: Builtin functions and types, Next: New Modules<11>, Prev: A Finer-Grained Import Lock, Up: What’s New In Python 3 3 + +1.11.18 Builtin functions and types +----------------------------------- + + * *note open(): 517. 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: 1075. for example. The ‘'x'’ mode + was added: open for exclusive creation, failing if the file already + exists. + + * *note print(): f70.: added the 'flush' keyword argument. If the + 'flush' keyword argument is true, the stream is forcibly flushed. + + * *note hash(): 5e7.: hash randomization is enabled by default, see + *note object.__hash__(): afb. and *note PYTHONHASHSEED: 1076. + + * The *note str: 447. type gets a new *note casefold(): dd5. method: + return a casefolded copy of the string, casefolded strings may be + used for caseless matching. For example, ‘'ß'.casefold()’ returns + ‘'ss'’. + + * The sequence documentation has been substantially rewritten to + better explain the binary/text sequence distinction and to provide + specific documentation sections for the individual builtin sequence + types (bpo-4966(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4966 + + +File: python.info, Node: New Modules<11>, Next: Improved Modules<11>, Prev: Builtin functions and types, Up: What’s New In Python 3 3 + +1.11.19 New Modules +------------------- + +* Menu: + +* faulthandler: faulthandler<4>. +* ipaddress: ipaddress<6>. +* lzma: lzma<2>. + + +File: python.info, Node: faulthandler<4>, Next: ipaddress<6>, Up: New Modules<11> + +1.11.19.1 faulthandler +...................... + +This new debug module *note faulthandler: 58. 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(): c9e. to install fault handlers for the ‘SIGSEGV’, +‘SIGFPE’, ‘SIGABRT’, ‘SIGBUS’, and ‘SIGILL’ signals. You can also +enable them at startup by setting the *note PYTHONFAULTHANDLER: 1079. +environment variable or by using *note -X: 176. ‘faulthandler’ command +line option. + +Example of a segmentation fault on 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 "", line 1 in + Segmentation fault + + +File: python.info, Node: ipaddress<6>, Next: lzma<2>, Prev: faulthandler<4>, Up: New Modules<11> + +1.11.19.2 ipaddress +................... + +The new *note ipaddress: 80. module provides tools for creating and +manipulating objects representing IPv4 and IPv6 addresses, networks and +interfaces (i.e. an IP address associated with a specific IP subnet). + +(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: New Modules<11> + +1.11.19.3 lzma +.............. + +The newly added *note lzma: 8a. 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: Improved Modules<11>, Next: Optimizations<10>, Prev: New Modules<11>, Up: What’s New In Python 3 3 + +1.11.20 Improved Modules +------------------------ + +* Menu: + +* abc: abc<2>. +* array: array<5>. +* base64: base64<4>. +* binascii: binascii<3>. +* bz2: bz2<2>. +* codecs: codecs<2>. +* collections: collections<7>. +* contextlib: contextlib<7>. +* crypt: crypt<2>. +* curses: curses<5>. +* datetime: datetime<6>. +* decimal: decimal<3>. +* email: email<5>. +* ftplib: ftplib<3>. +* functools: functools<6>. +* gc: gc<6>. +* hmac: hmac<4>. +* http: http<4>. +* html: html<2>. +* imaplib: imaplib<3>. +* inspect: inspect<9>. +* io: io<6>. +* itertools: itertools<6>. +* logging: logging<7>. +* math: math<9>. +* mmap: mmap<4>. +* multiprocessing: multiprocessing<8>. +* nntplib: nntplib<2>. +* os: os<12>. +* pdb: pdb<7>. +* pickle: pickle<5>. +* pydoc: pydoc<5>. +* re: re<9>. +* sched:: +* select: select<2>. +* shlex: shlex<3>. +* shutil: shutil<7>. +* signal: signal<4>. +* smtpd: smtpd<4>. +* smtplib: smtplib<4>. +* socket: socket<10>. +* socketserver: socketserver<3>. +* sqlite3: sqlite3<10>. +* ssl: ssl<11>. +* stat: stat<2>. +* struct: struct<3>. +* subprocess: subprocess<6>. +* sys: sys<13>. +* tarfile: tarfile<9>. +* tempfile: tempfile<4>. +* textwrap: textwrap<2>. +* threading: threading<8>. +* time: time<8>. +* types: types<7>. +* unittest: unittest<10>. +* urllib: urllib<4>. +* webbrowser: webbrowser<3>. +* xml.etree.ElementTree: xml etree ElementTree<2>. +* zlib: zlib<2>. + + +File: python.info, Node: abc<2>, Next: array<5>, Up: Improved Modules<11> + +1.11.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: 107e. has been deprecated, use *note + property: 194. with *note abc.abstractmethod(): 107f. instead. + + * *note abc.abstractclassmethod: 1080. has been deprecated, use *note + classmethod: 166. with *note abc.abstractmethod(): 107f. instead. + + * *note abc.abstractstaticmethod: 1081. has been deprecated, use + *note staticmethod: 412. with *note abc.abstractmethod(): 107f. + instead. + +(Contributed by Darren Dale in bpo-11610(1).) + +*note abc.ABCMeta.register(): 1082. now returns the registered subclass, +which means it can now be used as a class decorator (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<4>, Prev: abc<2>, Up: Improved Modules<11> + +1.11.20.2 array +............... + +The *note array: 7. 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<4>, Next: binascii<3>, Prev: array<5>, Up: Improved Modules<11> + +1.11.20.3 base64 +................ + +ASCII-only Unicode strings are now accepted by the decoding functions of +the *note base64: e. modern interface. For example, +‘base64.b64decode('YWJj')’ returns ‘b'abc'’. (Contributed by Catalin +Iacob in bpo-13641(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13641 + + +File: python.info, Node: binascii<3>, Next: bz2<2>, Prev: base64<4>, Up: Improved Modules<11> + +1.11.20.4 binascii +.................. + +In addition to the binary objects they normally accept, the ‘a2b_’ +functions now all also accept ASCII-only strings as input. (Contributed +by Antoine Pitrou in bpo-13637(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13637 + + +File: python.info, Node: bz2<2>, Next: codecs<2>, Prev: binascii<3>, Up: Improved Modules<11> + +1.11.20.5 bz2 +............. + +The *note bz2: 13. module has been rewritten from scratch. In the +process, several new features have been added: + + * New *note bz2.open(): 1087. function: open a bzip2-compressed file + in binary or text mode. + + * *note bz2.BZ2File: 863. can now read from and write to arbitrary + file-like objects, by means of its constructor’s 'fileobj' + argument. + + (Contributed by Nadeem Vawda in bpo-5863(1).) + + * *note bz2.BZ2File: 863. and *note bz2.decompress(): 1088. can now + decompress multi-stream inputs (such as those produced by the + ‘pbzip2’ tool). *note bz2.BZ2File: 863. can now also be used to + create this type of file, using the ‘'a'’ (append) mode. + + (Contributed by Nir Aides in bpo-1625(2).) + + * *note bz2.BZ2File: 863. now implements all of the *note + io.BufferedIOBase: 690. API, except for the ‘detach()’ and + ‘truncate()’ methods. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=5863 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=1625 + + +File: python.info, Node: codecs<2>, Next: collections<7>, Prev: bz2<2>, Up: Improved Modules<11> + +1.11.20.6 codecs +................ + +The *note mbcs: 53. codec has been rewritten to handle correctly +‘replace’ and ‘ignore’ error handlers on all Windows versions. The +*note mbcs: 53. codec now supports all error handlers, instead of only +‘replace’ to encode and ‘ignore’ to decode. + +A new Windows-only codec has been added: ‘cp65001’ (bpo-13216(1)). It +is the Windows code page 65001 (Windows UTF-8, ‘CP_UTF8’). For example, +it is used by ‘sys.stdout’ if the console output code page is set to +cp65001 (e.g., using ‘chcp 65001’ command). + +Multibyte CJK decoders now resynchronize faster. They only ignore the +first byte of an invalid byte sequence. For example, +‘b'\xff\n'.decode('gb2312', 'replace')’ now returns a ‘\n’ after the +replacement character. + +(bpo-12016(2)) + +Incremental CJK codec encoders are no longer reset at each call to their +encode() methods. For example: + + >>> 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.' + +This example gives ‘b'~{Np~}~{J)~}~{l6~}~{HK~}~{!#~} Bye.'’ with older +Python versions. + +(bpo-12100(3)) + +The ‘unicode_internal’ codec has been deprecated. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13216 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=12016 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=12100 + + +File: python.info, Node: collections<7>, Next: contextlib<7>, Prev: codecs<2>, Up: Improved Modules<11> + +1.11.20.7 collections +..................... + +Addition of a new *note ChainMap: c1c. class to allow treating a number +of mappings as a single unit. (Written by Raymond Hettinger for +bpo-11089(1), made public in bpo-11297(2).) + +The abstract base classes have been moved in a new *note +collections.abc: 1e. module, to better differentiate between the +abstract and the concrete collections classes. Aliases for ABCs are +still present in the *note collections: 1d. module to preserve existing +imports. (bpo-11085(3)) + +The *note Counter: 108b. class now supports the unary ‘+’ and ‘-’ +operators, as well as the in-place operators ‘+=’, ‘-=’, ‘|=’, and ‘&=’. +(Contributed by Raymond Hettinger in bpo-13121(4).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11089 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=11297 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=11085 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=13121 + + +File: python.info, Node: contextlib<7>, Next: crypt<2>, Prev: collections<7>, Up: Improved Modules<11> + +1.11.20.8 contextlib +.................... + +*note ExitStack: b29. now provides a solid foundation for programmatic +manipulation of context managers and similar cleanup functionality. +Unlike the previous ‘contextlib.nested’ API (which was deprecated and +removed), the new API is designed to work correctly regardless of +whether context managers acquire their resources in their ‘__init__’ +method (for example, file objects) or in their ‘__enter__’ method (for +example, synchronisation objects from the *note threading: ed. module). + +(bpo-13585(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13585 + + +File: python.info, Node: crypt<2>, Next: curses<5>, Prev: contextlib<7>, Up: Improved Modules<11> + +1.11.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<5>, Next: datetime<6>, Prev: crypt<2>, Up: Improved Modules<11> + +1.11.20.10 curses +................. + + * If the *note curses: 2b. 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()’). + + * Use the locale encoding instead of ‘utf-8’ to encode Unicode + strings. + + * ‘curses.window’ has a new *note curses.window.encoding: 108f. + attribute. + + * The ‘curses.window’ class has a new *note get_wch(): 1090. method + to get a wide character + + * The *note curses: 2b. module has a new *note unget_wch(): 1091. + function to push a wide character so the next *note get_wch(): + 1090. will return it + +(Contributed by Iñigo Serna in bpo-6755(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=6755 + + +File: python.info, Node: datetime<6>, Next: decimal<3>, Prev: curses<5>, Up: Improved Modules<11> + +1.11.20.11 datetime +................... + + * Equality comparisons between naive and aware *note datetime: 1cc. + instances now return *note False: b37. instead of raising *note + TypeError: 534. (bpo-15006(1)). + + * New *note datetime.datetime.timestamp(): 1093. method: Return POSIX + timestamp corresponding to the *note datetime: 1cc. instance. + + * The *note datetime.datetime.strftime(): c90. method supports + formatting years older than 1000. + + * The *note datetime.datetime.astimezone(): 9d0. method can now be + called without arguments to convert datetime instance to the system + timezone. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15006 + + +File: python.info, Node: decimal<3>, Next: email<5>, Prev: datetime<6>, Up: Improved Modules<11> + +1.11.20.12 decimal +.................. + +bpo-7652(1) - integrate fast native decimal arithmetic. + + 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: + +* Features: Features<2>. +* API changes: API changes<2>. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=7652 + + +File: python.info, Node: Features<2>, Next: API changes<2>, Up: decimal<3> + +1.11.20.13 Features +................... + + * The *note FloatOperation: 1096. signal optionally enables stricter + semantics for mixing floats and Decimals. + + * 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: 1097. is set to ‘False’. + + +File: python.info, Node: API changes<2>, Prev: Features<2>, Up: decimal<3> + +1.11.20.14 API changes +...................... + + * The C module has the following context limits, depending on the + machine architecture: + + 32-bit 64-bit + + --------------------------------------------------------------------------- + + ‘MAX_PREC’ ‘425000000’ ‘999999999999999999’ + + + ‘MAX_EMAX’ ‘425000000’ ‘999999999999999999’ + + + ‘MIN_EMIN’ ‘-425000000’ ‘-999999999999999999’ + + + * In the context templates (*note DefaultContext: 1099, *note + BasicContext: 109a. and *note ExtendedContext: 109b.) the magnitude + of *note Emax: 109c. and *note Emin: 109d. has changed to ‘999999’. + + * The *note Decimal: 29f. constructor in decimal.py does not observe + the context limits and converts values with arbitrary exponents or + precision exactly. Since the C version has internal limits, the + following scheme is used: If possible, values are converted + exactly, otherwise *note InvalidOperation: 109e. is raised and the + result is NaN. In the latter case it is always possible to use + *note create_decimal(): 109f. in order to obtain a rounded or + inexact value. + + * 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(): 10a0. and *note ln(): 10a1. functions, but the final + result is only “almost always correctly rounded”. + + * In the C version, the context dictionary containing the signals is + a *note MutableMapping: 10a2. For speed reasons, *note flags: + 10a3. and *note traps: 10a4. always refer to the same *note + MutableMapping: 10a2. that the context was initialized with. If a + new signal dictionary is assigned, *note flags: 10a3. and *note + traps: 10a4. are updated with the new values, but they do not + reference the RHS dictionary. + + * Pickling a *note Context: 10a5. produces a different output in + order to have a common interchange format for the Python and C + versions. + + * The order of arguments in the *note Context: 10a5. constructor has + been changed to match the order displayed by *note repr(): 7f9. + + * The ‘watchexp’ parameter in the *note quantize(): 10a6. method is + deprecated. + + +File: python.info, Node: email<5>, Next: ftplib<3>, Prev: decimal<3>, Up: Improved Modules<11> + +1.11.20.15 email +................ + +* Menu: + +* Policy Framework:: +* Provisional Policy with New Header API:: +* Other API Changes:: + + +File: python.info, Node: Policy Framework, Next: Provisional Policy with New Header API, Up: email<5> + +1.11.20.16 Policy Framework +........................... + +The email package now has a *note policy: 4f. framework. A *note +Policy: 10a9. is an object with several methods and properties that +control how the email package behaves. The primary policy for Python +3.3 is the *note Compat32: 10aa. policy, which provides backward +compatibility with the email package in Python 3.2. A ‘policy’ can be +specified when an email message is parsed by a *note parser: 4e, or when +a *note Message: 27e. object is created, or when an email is serialized +using a *note generator: 40. Unless overridden, a policy passed to a +‘parser’ is inherited by all the ‘Message’ object and sub-objects +created by the ‘parser’. By default a ‘generator’ will use the policy +of the ‘Message’ object it is serializing. The default policy is *note +compat32: c99. + +The minimum set of controls implemented by all ‘policy’ objects are: + +max_line_length The maximum length, excluding the linesep character(s), + individual lines may have when a ‘Message’ is serialized. + Defaults to 78. + + +linesep The character used to separate individual lines when a + ‘Message’ is serialized. Defaults to ‘\n’. + + +cte_type ‘7bit’ or ‘8bit’. ‘8bit’ applies only to a ‘Bytes’ + ‘generator’, and means that non-ASCII may be used where + allowed by the protocol (or where it exists in the + original input). + + +raise_on_defect Causes a ‘parser’ to raise error when defects are + encountered instead of adding them to the ‘Message’ + object’s ‘defects’ list. + + +A new policy instance, with new settings, is created using the *note +clone(): 10ab. method of policy objects. ‘clone’ takes any of the above +controls as keyword arguments. Any control not specified in the call +retains its default value. Thus you can create a policy that uses +‘\r\n’ linesep characters like this: + + mypolicy = compat32.clone(linesep='\r\n') + +Policies can be used to make the generation of messages in the format +needed by your application simpler. Instead of having to remember to +specify ‘linesep='\r\n'’ in all the places you call a ‘generator’, you +can specify it once, when you set the policy used by the ‘parser’ or the +‘Message’, whichever your program uses to create ‘Message’ objects. On +the other hand, if you need to generate messages in multiple forms, you +can still specify the parameters in the appropriate ‘generator’ call. +Or you can have custom policy instances for your different cases, and +pass those in when you create the ‘generator’. + + +File: python.info, Node: Provisional Policy with New Header API, Next: Other API Changes, Prev: Policy Framework, Up: email<5> + +1.11.20.17 Provisional Policy with New Header API +................................................. + +While the policy framework is worthwhile all by itself, the main +motivation for introducing it is to allow the creation of new policies +that implement new features for the email package in a way that +maintains backward compatibility for those who do not use the new +policies. Because the new policies introduce a new API, we are +releasing them in Python 3.3 as a *note provisional policy: 103a. +Backwards incompatible changes (up to and including removal of the code) +may occur if deemed necessary by the core developers. + +The new policies are instances of *note EmailPolicy: 10ad, and add the +following additional controls: + +refold_source Controls whether or not headers parsed by a + *note parser: 4e. are refolded by the + *note generator: 40. It can be ‘none’, ‘long’, or ‘all’. + The default is ‘long’, which means that source headers + with a line longer than ‘max_line_length’ get refolded. + ‘none’ means no line get refolded, and ‘all’ means that + all lines get refolded. + + +header_factory A callable that take a ‘name’ and ‘value’ and produces a + custom header object. + + +The ‘header_factory’ is the key to the new features provided by the new +policies. When one of the new policies is used, any header retrieved +from a ‘Message’ object is an object produced by the ‘header_factory’, +and any time you set a header on a ‘Message’ it becomes an object +produced by ‘header_factory’. All such header objects have a ‘name’ +attribute equal to the header name. Address and Date headers have +additional attributes that give you access to the parsed data of the +header. This means you can now do things like this: + + >>> m = Message(policy=SMTP) + >>> m['To'] = 'Éric ' + >>> m['to'] + 'Éric ' + >>> 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?= + Date: Fri, 25 May 2012 21:44:27 -0400 + +You will note that the unicode display name is automatically encoded as +‘utf-8’ when the message is serialized, but that when the header is +accessed directly, you get the unicode version. This eliminates any +need to deal with the *note email.header: 41. *note decode_header(): +10ae. or *note make_header(): 10af. functions. + +You can also create addresses from parts: + + >>> 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?= + Date: Fri, 25 May 2012 21:44:27 -0400 + cc: pals: Bob , Sally ;, Bonzo + +Decoding to unicode is done automatically: + + >>> m2 = message_from_string(str(m)) + >>> m2['to'] + 'Éric ' + +When you parse a message, you can use the ‘addresses’ and ‘groups’ +attributes of the header objects to access the groups and individual +addresses: + + >>> 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'),)) + +In summary, if you use one of the new policies, header manipulation +works the way it ought to: your application works with unicode strings, +and the email package transparently encodes and decodes the unicode to +and from the RFC standard Content Transfer Encodings. + + +File: python.info, Node: Other API Changes, Prev: Provisional Policy with New Header API, Up: email<5> + +1.11.20.18 Other API Changes +............................ + +New *note BytesHeaderParser: 10b1, added to the *note parser: 4e. module +to complement *note HeaderParser: 10b2. and complete the Bytes API. + +New utility functions: + + * *note format_datetime(): 10b3.: given a *note datetime: 1cc, + produce a string formatted for use in an email header. + + * *note parsedate_to_datetime(): 10b4.: given a date string from an + email header, convert it into an aware *note datetime: 1cc, or a + naive *note datetime: 1cc. if the offset is ‘-0000’. + + * *note localtime(): 2c7.: With no argument, returns the current + local time as an aware *note datetime: 1cc. using the local *note + timezone: 10b5. Given an aware *note datetime: 1cc, converts it + into an aware *note datetime: 1cc. using the local *note timezone: + 10b5. + + +File: python.info, Node: ftplib<3>, Next: functools<6>, Prev: email<5>, Up: Improved Modules<11> + +1.11.20.19 ftplib +................. + + * *note ftplib.FTP: 8f9. now accepts a ‘source_address’ keyword + argument to specify the ‘(host, port)’ to use as the source address + in the bind call when creating the outgoing socket. (Contributed + by Giampaolo Rodolà in bpo-8594(1).) + + * The *note FTP_TLS: 8fa. class now provides a new *note ccc(): 10b7. + function to 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. (Contributed by + Giampaolo Rodolà in bpo-12139(2).) + + * Added *note ftplib.FTP.mlsd(): 10b8. method which provides a + parsable directory listing format and deprecates *note + ftplib.FTP.nlst(): 10b9. and *note ftplib.FTP.dir(): 10ba. + (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<6>, Next: gc<6>, Prev: ftplib<3>, Up: Improved Modules<11> + +1.11.20.20 functools +.................... + +The *note functools.lru_cache(): 9ee. decorator now accepts a ‘typed’ +keyword argument (that defaults to ‘False’ to ensure that it caches +values of different types that compare equal in separate cache slots. +(Contributed by Raymond Hettinger in bpo-13227(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13227 + + +File: python.info, Node: gc<6>, Next: hmac<4>, Prev: functools<6>, Up: Improved Modules<11> + +1.11.20.21 gc +............. + +It is now possible to register callbacks invoked by the garbage +collector before and after collection using the new *note callbacks: +10bd. list. + + +File: python.info, Node: hmac<4>, Next: http<4>, Prev: gc<6>, Up: Improved Modules<11> + +1.11.20.22 hmac +............... + +A new *note compare_digest(): 10bf. function has been added to prevent +side channel attacks on digests through timing analysis. (Contributed +by Nick Coghlan and Christian Heimes in bpo-15061(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=15061 + + +File: python.info, Node: http<4>, Next: html<2>, Prev: hmac<4>, Up: Improved Modules<11> + +1.11.20.23 http +............... + +*note http.server.BaseHTTPRequestHandler: 10c1. now buffers the headers +and writes them all at once when *note end_headers(): 10c2. is called. +A new method *note flush_headers(): 10c3. can be used to directly manage +when the accumulated headers are sent. (Contributed by Andrew Schaaf in +bpo-3709(1).) + +*note http.server: 72. now produces valid ‘HTML 4.01 strict’ output. +(Contributed by Ezio Melotti in bpo-13295(2).) + +*note http.client.HTTPResponse: 10c4. now has a *note readinto(): 10c5. +method, which means it can be used as an *note io.RawIOBase: 10c6. +class. (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<3>, Prev: http<4>, Up: Improved Modules<11> + +1.11.20.24 html +............... + +*note html.parser.HTMLParser: 874. 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).) + +A new *note html5: 10c8. dictionary that maps HTML5 named character +references to the equivalent Unicode character(s) (e.g. ‘html5['gt;'] +== '>'’) has been added to the *note html.entities: 6c. module. The +dictionary is now also used by *note HTMLParser: 874. (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<3>, Next: inspect<9>, Prev: html<2>, Up: Improved Modules<11> + +1.11.20.25 imaplib +.................. + +The *note IMAP4_SSL: 903. constructor now accepts an SSLContext +parameter to control parameters of the secure channel. + +(Contributed by Sijin Joseph in bpo-8808(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8808 + + +File: python.info, Node: inspect<9>, Next: io<6>, Prev: imaplib<3>, Up: Improved Modules<11> + +1.11.20.26 inspect +.................. + +A new *note getclosurevars(): 10cb. function has been added. This +function reports the current binding of all names referenced from the +function body and where those names were resolved, making it easier to +verify correct internal state when testing code that relies on stateful +closures. + +(Contributed by Meador Inge and Nick Coghlan in bpo-13062(1).) + +A new *note getgeneratorlocals(): 10cc. function has been added. This +function reports the current binding of local variables in the +generator’s stack frame, making it easier to verify correct internal +state when testing generators. + +(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<6>, Next: itertools<6>, Prev: inspect<9>, Up: Improved Modules<11> + +1.11.20.27 io +............. + +The *note open(): 518. function has a new ‘'x'’ mode that can be used to +exclusively create a new file, and raise a *note FileExistsError: 1019. +if the file already exists. It is based on the C11 ‘x’ mode to fopen(). + +(Contributed by David Townshend in bpo-12760(1).) + +The constructor of the *note TextIOWrapper: 7b6. class has a new +'write_through' optional argument. If 'write_through' is ‘True’, calls +to ‘write()’ are guaranteed not to be buffered: any data written on the +*note TextIOWrapper: 7b6. 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<6>, Next: logging<7>, Prev: io<6>, Up: Improved Modules<11> + +1.11.20.28 itertools +.................... + +*note accumulate(): 9fc. now takes an optional ‘func’ argument for +providing a user-supplied binary function. + + +File: python.info, Node: logging<7>, Next: math<9>, Prev: itertools<6>, Up: Improved Modules<11> + +1.11.20.29 logging +.................. + +The *note basicConfig(): 9ff. function now supports an optional +‘handlers’ argument taking an iterable of handlers to be added to the +root logger. + +A class level attribute ‘append_nul’ has been added to *note +SysLogHandler: 658. 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<9>, Next: mmap<4>, Prev: logging<7>, Up: Improved Modules<11> + +1.11.20.30 math +............... + +The *note math: 8e. module has a new function, *note log2(): 10d1, which +returns the base-2 logarithm of 'x'. + +(Written by Mark Dickinson in bpo-11888(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11888 + + +File: python.info, Node: mmap<4>, Next: multiprocessing<8>, Prev: math<9>, Up: Improved Modules<11> + +1.11.20.31 mmap +............... + +The *note read(): 10d3. method is now more compatible with other +file-like objects: if the argument is omitted or specified as ‘None’, it +returns the bytes from the current file position to the end of the +mapping. (Contributed by Petri Lehtinen in bpo-12021(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=12021 + + +File: python.info, Node: multiprocessing<8>, Next: nntplib<2>, Prev: mmap<4>, Up: Improved Modules<11> + +1.11.20.32 multiprocessing +.......................... + +The new *note multiprocessing.connection.wait(): 10d5. function allows +polling multiple objects (such as connections, sockets and pipes) with a +timeout. (Contributed by Richard Oudkerk in bpo-12328(1).) + +‘multiprocessing.Connection’ objects can now be transferred over +multiprocessing connections. (Contributed by Richard Oudkerk in +bpo-4892(2).) + +*note multiprocessing.Process: b59. now accepts a ‘daemon’ keyword +argument to override the default behavior of inheriting the ‘daemon’ +flag from the parent process (bpo-6064(3)). + +New attribute *note multiprocessing.Process.sentinel: 10d6. allows a +program to wait on multiple *note Process: b59. objects at one time +using the appropriate OS primitives (for example, *note select: c1. on +posix systems). + +New methods *note multiprocessing.pool.Pool.starmap(): 10d7. and *note +starmap_async(): 10d8. provide *note itertools.starmap(): 10d9. +equivalents to the existing *note multiprocessing.pool.Pool.map(): 10da. +and *note map_async(): 10db. functions. (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<12>, Prev: multiprocessing<8>, Up: Improved Modules<11> + +1.11.20.33 nntplib +.................. + +The ‘nntplib.NNTP’ class now supports the context management protocol to +unconditionally consume *note socket.error: 104e. 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<12>, Next: pdb<7>, Prev: nntplib<2>, Up: Improved Modules<11> + +1.11.20.34 os +............. + + * The *note os: a1. module has a new *note pipe2(): 10de. function + that makes it possible to create a pipe with *note O_CLOEXEC: 1075. + or *note O_NONBLOCK: e3a. flags set atomically. This is especially + useful to avoid race conditions in multi-threaded programs. + + * The *note os: a1. module has a new *note sendfile(): b0f. function + which provides an efficient “zero-copy” way for copying data from + one file (or socket) descriptor to another. The phrase “zero-copy” + refers to the fact that all of the copying of data between the two + descriptors is done entirely by the kernel, with no copying of data + into userspace buffers. *note sendfile(): b0f. can be used to + efficiently copy data from a file on disk to a network socket, e.g. + for downloading a file. + + (Patch submitted by Ross Lagerwall and Giampaolo Rodolà in + bpo-10882(1).) + + * To avoid race conditions like symlink attacks and issues with + temporary files and directories, it is more reliable (and also + faster) to manipulate file descriptors instead of file names. + Python 3.3 enhances existing functions and introduces new functions + to work on file descriptors (bpo-4761(2), bpo-10755(3) and + bpo-14626(4)). + + - The *note os: a1. module has a new *note fwalk(): b5b. + function similar to *note walk(): 4a5. except that it also + yields file descriptors referring to the directories visited. + This is especially useful to avoid symlink races. + + - The following functions get new optional 'dir_fd' (*note paths + relative to directory descriptors: 10df.) and/or + 'follow_symlinks' (*note not following symlinks: 10e0.): *note + access(): 10e1, *note chflags(): 10e2, *note chmod(): 21d, + *note chown(): 10e3, *note link(): 10e4, *note lstat(): 49d, + *note mkdir(): 21f, *note mkfifo(): d8f, *note mknod(): d90, + *note open(): d91, *note readlink(): 91f, *note remove(): + 10e5, *note rename(): 10e6, *note replace(): 10e7, *note + rmdir(): 10e8, *note stat(): 49c, *note symlink(): 10e9, *note + unlink(): 10ea, *note utime(): 10eb. Platform support for + using these parameters can be checked via the sets *note + os.supports_dir_fd: 10ec. and ‘os.supports_follows_symlinks’. + + - The following functions now support a file descriptor for + their path argument: *note chdir(): 609, *note chmod(): 21d, + *note chown(): 10e3, *note execve(): 10ed, *note listdir(): + 10ee, *note pathconf(): 10ef, *note exists(): a0d, *note + stat(): 49c, *note statvfs(): 10f0, *note utime(): 10eb. + Platform support for this can be checked via the *note + os.supports_fd: 10f1. set. + + * *note access(): 10e1. accepts an ‘effective_ids’ keyword argument + to turn on using the effective uid/gid rather than the real uid/gid + in the access check. Platform support for this can be checked via + the *note supports_effective_ids: 10f2. set. + + * The *note os: a1. module has two new functions: *note + getpriority(): 10f3. and *note setpriority(): 10f4. They can be + used to get or set process niceness/priority in a fashion similar + to *note os.nice(): 10f5. but extended to all processes instead of + just the current one. + + (Patch submitted by Giampaolo Rodolà in bpo-10784(5).) + + * The new *note os.replace(): 10e7. function allows cross-platform + renaming of a file with overwriting the destination. With *note + os.rename(): 10e6, an existing destination file is overwritten + under POSIX, but raises an error under Windows. (Contributed by + Antoine Pitrou in bpo-8828(6).) + + * The stat family of functions (*note stat(): 49c, *note fstat(): + d8b, and *note lstat(): 49d.) now support reading a file’s + timestamps with nanosecond precision. Symmetrically, *note + utime(): 10eb. can now write file timestamps with nanosecond + precision. (Contributed by Larry Hastings in bpo-14127(7).) + + * The new *note os.get_terminal_size(): 10f6. function queries the + size of the terminal attached to a file descriptor. See also *note + shutil.get_terminal_size(): 10f7. (Contributed by Zbigniew + Jędrzejewski-Szmek in bpo-13609(8).) + + * New functions to support Linux extended attributes (bpo-12720(9)): + *note getxattr(): 10f8, *note listxattr(): 10f9, *note + removexattr(): 10fa, *note setxattr(): 10fb. + + * New interface to the scheduler. These functions control how a + process is allocated CPU time by the operating system. New + functions: *note sched_get_priority_max(): 10fc, *note + sched_get_priority_min(): 10fd, *note sched_getaffinity(): 10fe, + *note sched_getparam(): 10ff, *note sched_getscheduler(): 1100, + *note sched_rr_get_interval(): 1101, *note sched_setaffinity(): + 1102, *note sched_setparam(): 1103, *note sched_setscheduler(): + 1104, *note sched_yield(): 1105, + + * New functions to control the file system: + + * *note posix_fadvise(): d92.: Announces an intention to access + data in a specific pattern thus allowing the kernel to make + optimizations. + + * *note posix_fallocate(): d93.: Ensures that enough disk space + is allocated for a file. + + * *note sync(): 1106.: Force write of everything to disk. + + * Additional new posix functions: + + * *note lockf(): 1107.: Apply, test or remove a POSIX lock on an + open file descriptor. + + * *note pread(): b5f.: Read from a file descriptor at an offset, + the file offset remains unchanged. + + * *note pwrite(): b62.: Write to a file descriptor from an + offset, leaving the file offset unchanged. + + * *note readv(): b5e.: Read from a file descriptor into a number + of writable buffers. + + * *note truncate(): e3b.: Truncate the file corresponding to + 'path', so that it is at most 'length' bytes in size. + + * *note waitid(): d98.: Wait for the completion of one or more + child processes. + + * *note writev(): b61.: Write the contents of 'buffers' to a + file descriptor, where 'buffers' is an arbitrary sequence of + buffers. + + * *note getgrouplist(): 1108. (bpo-9344(10)): Return list of + group ids that specified user belongs to. + + * *note times(): 1109. and *note uname(): 110a.: Return type changed + from a tuple to a tuple-like object with named attributes. + + * Some platforms now support additional constants for the *note + lseek(): 110b. function, such as ‘os.SEEK_HOLE’ and ‘os.SEEK_DATA’. + + * New constants *note RTLD_LAZY: 110c, *note RTLD_NOW: 110d, *note + RTLD_GLOBAL: 110e, *note RTLD_LOCAL: 110f, *note RTLD_NODELETE: + 1110, *note RTLD_NOLOAD: 1111, and *note RTLD_DEEPBIND: 1112. are + available on platforms that support them. These are for use with + the *note sys.setdlopenflags(): 1113. function, and supersede the + similar constants defined in *note ctypes: 2a. and ‘DLFCN’. + (Contributed by Victor Stinner in bpo-13226(11).) + + * *note os.symlink(): 10e9. now accepts (and ignores) the + ‘target_is_directory’ keyword argument on non-Windows platforms, to + ease cross-platform support. + + ---------- 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<7>, Next: pickle<5>, Prev: os<12>, Up: Improved Modules<11> + +1.11.20.35 pdb +.............. + +Tab-completion is now available not only for command names, but also +their arguments. For example, for the ‘break’ command, function and +file names are completed. + +(Contributed by Georg Brandl in bpo-14210(1)) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14210 + + +File: python.info, Node: pickle<5>, Next: pydoc<5>, Prev: pdb<7>, Up: Improved Modules<11> + +1.11.20.36 pickle +................. + +*note pickle.Pickler: a1d. objects now have an optional *note +dispatch_table: 1116. attribute allowing per-pickler reduction functions +to be set. + +(Contributed by Richard Oudkerk in bpo-14166(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14166 + + +File: python.info, Node: pydoc<5>, Next: re<9>, Prev: pickle<5>, Up: Improved Modules<11> + +1.11.20.37 pydoc +................ + +The Tk GUI and the ‘serve()’ function have been removed from the *note +pydoc: b5. module: ‘pydoc -g’ and ‘serve()’ have been deprecated in +Python 3.2. + + +File: python.info, Node: re<9>, Next: sched, Prev: pydoc<5>, Up: Improved Modules<11> + +1.11.20.38 re +............. + +*note str: 447. regular expressions now support ‘\u’ and ‘\U’ escapes. + +(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<9>, Up: Improved Modules<11> + +1.11.20.39 sched +................ + + * *note run(): 111a. now accepts a 'blocking' parameter which when + set to false makes the method execute the scheduled events due to + expire soonest (if any) and then return immediately. This is + useful in case you want to use the *note scheduler: 111b. in + non-blocking applications. (Contributed by Giampaolo Rodolà in + bpo-13449(1).) + + * *note scheduler: 111b. class can now be safely used in + multi-threaded environments. (Contributed by Josiah Carlson and + Giampaolo Rodolà in bpo-8684(2).) + + * 'timefunc' and 'delayfunct' parameters of *note scheduler: 111b. + class constructor are now optional and defaults to *note + time.time(): 256. and *note time.sleep(): 699. respectively. + (Contributed by Chris Clark in bpo-13245(3).) + + * *note enter(): 111c. and *note enterabs(): 111d. 'argument' + parameter is now optional. (Contributed by Chris Clark in + bpo-13245(4).) + + * *note enter(): 111c. and *note enterabs(): 111d. now accept a + 'kwargs' parameter. (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: Improved Modules<11> + +1.11.20.40 select +................. + +Solaris and derivative platforms have a new class *note select.devpoll: +f90. for high performance asynchronous sockets via ‘/dev/poll’. +(Contributed by Jesús Cea Avión in bpo-6397(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=6397 + + +File: python.info, Node: shlex<3>, Next: shutil<7>, Prev: select<2>, Up: Improved Modules<11> + +1.11.20.41 shlex +................ + +The previously undocumented helper function ‘quote’ from the ‘pipes’ +modules has been moved to the *note shlex: c4. module and documented. +*note quote(): 27f. properly escapes all characters in a string that +might be otherwise given special meaning by the shell. + + +File: python.info, Node: shutil<7>, Next: signal<4>, Prev: shlex<3>, Up: Improved Modules<11> + +1.11.20.42 shutil +................. + + * New functions: + + * *note disk_usage(): 1121.: provides total, used and free disk + space statistics. (Contributed by Giampaolo Rodolà in + bpo-12442(1).) + + * *note chown(): 242.: allows one to change user and/or group of + the given path also specifying the user/group names and not + only their numeric ids. (Contributed by Sandro Tosi in + bpo-12191(2).) + + * *note shutil.get_terminal_size(): 10f7.: returns the size of + the terminal window to which the interpreter is attached. + (Contributed by Zbigniew Jędrzejewski-Szmek in bpo-13609(3).) + + * *note copy2(): a5a. and *note copystat(): 1122. now preserve file + timestamps with nanosecond precision on platforms that support it. + They also preserve file “extended attributes” on Linux. + (Contributed by Larry Hastings in bpo-14127(4) and bpo-15238(5).) + + * Several functions now take an optional ‘symlinks’ argument: when + that parameter is true, symlinks aren’t dereferenced and the + operation instead acts on the symlink itself (or creates one, if + relevant). (Contributed by Hynek Schlawack in bpo-12715(6).) + + * When copying files to a different file system, *note move(): a5b. + now handles symlinks the way the posix ‘mv’ command does, + recreating the symlink rather than copying the target file + contents. (Contributed by Jonathan Niehof in bpo-9993(7).) *note + move(): a5b. now also returns the ‘dst’ argument as its result. + + * *note rmtree(): 2fb. is now resistant to symlink attacks on + platforms which support the new ‘dir_fd’ parameter in *note + os.open(): d91. and *note os.unlink(): 10ea. (Contributed by + Martin von Löwis and Hynek Schlawack in bpo-4489(8).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=12442 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=12191 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=13609 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=14127 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=15238 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=12715 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=9993 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=4489 + + +File: python.info, Node: signal<4>, Next: smtpd<4>, Prev: shutil<7>, Up: Improved Modules<11> + +1.11.20.43 signal +................. + + * The *note signal: c6. module has new functions: + + * *note pthread_sigmask(): 1124.: fetch and/or change the signal + mask of the calling thread (Contributed by Jean-Paul Calderone + in bpo-8407(1)); + + * *note pthread_kill(): 1125.: send a signal to a thread; + + * *note sigpending(): 1126.: examine pending functions; + + * *note sigwait(): 1127.: wait a signal; + + * *note sigwaitinfo(): daa.: wait for a signal, returning + detailed information about it; + + * *note sigtimedwait(): da9.: like *note sigwaitinfo(): daa. but + with a timeout. + + * The signal handler writes the signal number as a single byte + instead of a nul byte into the wakeup file descriptor. So it is + possible to wait more than one signal and know which signals were + raised. + + * *note signal.signal(): 1128. and *note signal.siginterrupt(): 1129. + raise an OSError, instead of a RuntimeError: OSError has an errno + attribute. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8407 + + +File: python.info, Node: smtpd<4>, Next: smtplib<4>, Prev: signal<4>, Up: Improved Modules<11> + +1.11.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<10>, Prev: smtpd<4>, Up: Improved Modules<11> + +1.11.20.45 smtplib +.................. + +The *note SMTP: 92d, *note SMTP_SSL: 92e, and *note LMTP: 92f. classes +now accept a ‘source_address’ keyword argument to specify the ‘(host, +port)’ to use as the source address in the bind call when creating the +outgoing socket. (Contributed by Paulo Scardine in bpo-11281(1).) + +*note SMTP: 92d. now supports the context management protocol, allowing +an ‘SMTP’ instance to be used in a ‘with’ statement. (Contributed by +Giampaolo Rodolà in bpo-11289(2).) + +The *note SMTP_SSL: 92e. constructor and the *note starttls(): 112c. +method now accept an SSLContext parameter to control parameters of the +secure channel. (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<10>, Next: socketserver<3>, Prev: smtplib<4>, Up: Improved Modules<11> + +1.11.20.46 socket +................. + + * The *note socket: da0. class now exposes additional methods to + process ancillary data when supported by the underlying platform: + + * *note sendmsg(): 472. + + * *note recvmsg(): da5. + + * *note recvmsg_into(): 112e. + + (Contributed by David Watson in bpo-6560(1), based on an earlier + patch by Heiko Wundram) + + * The *note socket: da0. class now supports the PF_CAN protocol + family (‘https://en.wikipedia.org/wiki/Socketcan’), on Linux + (‘https://lwn.net/Articles/253425’). + + (Contributed by Matthias Fuchs, updated by Tiago Gonçalves in + bpo-10141(2).) + + * The *note socket: da0. class now supports the PF_RDS protocol + family (‘https://en.wikipedia.org/wiki/Reliable_Datagram_Sockets’ + and https://oss.oracle.com/projects/rds(3)). + + * The *note socket: da0. class now supports the ‘PF_SYSTEM’ protocol + family on OS X. (Contributed by Michael Goderbauer in + bpo-13777(4).) + + * New function *note sethostname(): 112f. 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<10>, Prev: socket<10>, Up: Improved Modules<11> + +1.11.20.47 socketserver +....................... + +*note BaseServer: 1131. now has an overridable method *note +service_actions(): 1132. that is called by the *note serve_forever(): +1133. method in the service loop. *note ForkingMixIn: b77. now uses +this to clean up zombie child processes. (Contributed by Justin +Warkentin in bpo-11109(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11109 + + +File: python.info, Node: sqlite3<10>, Next: ssl<11>, Prev: socketserver<3>, Up: Improved Modules<11> + +1.11.20.48 sqlite3 +.................. + +New *note sqlite3.Connection: 247. method *note set_trace_callback(): +2af. can be used to capture a trace of all sql commands processed by +sqlite. (Contributed by Torsten Landschoff in bpo-11688(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11688 + + +File: python.info, Node: ssl<11>, Next: stat<2>, Prev: sqlite3<10>, Up: Improved Modules<11> + +1.11.20.49 ssl +.............. + + * The *note ssl: d0. module has two new random generation functions: + + * *note RAND_bytes(): 51f.: generate cryptographically strong + pseudo-random bytes. + + * ‘RAND_pseudo_bytes()’: generate pseudo-random bytes. + + (Contributed by Victor Stinner in bpo-12049(1).) + + * The *note ssl: d0. module now exposes a finer-grained exception + hierarchy in order to make it easier to inspect the various kinds + of errors. (Contributed by Antoine Pitrou in bpo-11183(2).) + + * *note load_cert_chain(): 297. now accepts a 'password' argument to + be used if the private key is encrypted. (Contributed by Adam + Simpkins in bpo-12803(3).) + + * Diffie-Hellman key exchange, both regular and Elliptic Curve-based, + is now supported through the *note load_dh_params(): 1136. and + *note set_ecdh_curve(): 1137. methods. (Contributed by Antoine + Pitrou in bpo-13626(4) and bpo-13627(5).) + + * SSL sockets have a new *note get_channel_binding(): 1138. method + allowing the implementation of certain authentication mechanisms + such as SCRAM-SHA-1-PLUS. (Contributed by Jacek Konieczny in + bpo-12551(6).) + + * You can query the SSL compression algorithm used by an SSL socket, + thanks to its new *note compression(): 1139. method. The new + attribute *note OP_NO_COMPRESSION: 113a. can be used to disable + compression. (Contributed by Antoine Pitrou in bpo-13634(7).) + + * Support has been added for the Next Protocol Negotiation extension + using the *note ssl.SSLContext.set_npn_protocols(): 2fc. method. + (Contributed by Colin Marc in bpo-14204(8).) + + * SSL errors can now be introspected more easily thanks to *note + library: 113b. and *note reason: 113c. attributes. (Contributed by + Antoine Pitrou in bpo-14837(9).) + + * The *note get_server_certificate(): 838. function now supports + IPv6. (Contributed by Charles-François Natali in bpo-11811(10).) + + * New attribute *note OP_CIPHER_SERVER_PREFERENCE: 113d. allows + setting SSLv3 server sockets to use the server’s cipher ordering + preference rather than the client’s (bpo-13635(11)). + + ---------- 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://bugs.python.org/issue?@action=redirect&bpo=12551 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=13634 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=14204 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=14837 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=11811 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=13635 + + +File: python.info, Node: stat<2>, Next: struct<3>, Prev: ssl<11>, Up: Improved Modules<11> + +1.11.20.50 stat +............... + +The undocumented tarfile.filemode function has been moved to *note +stat.filemode(): 113f. It can be used to convert a file’s mode to a +string of the form ‘-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<3>, Next: subprocess<6>, Prev: stat<2>, Up: Improved Modules<11> + +1.11.20.51 struct +................. + +The *note struct: d5. module now supports ‘ssize_t’ and ‘size_t’ via the +new codes ‘n’ and ‘N’, respectively. (Contributed by Antoine Pitrou in +bpo-3163(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=3163 + + +File: python.info, Node: subprocess<6>, Next: sys<13>, Prev: struct<3>, Up: Improved Modules<11> + +1.11.20.52 subprocess +..................... + +Command strings can now be bytes objects on posix platforms. +(Contributed by Victor Stinner in bpo-8513(1).) + +A new constant *note DEVNULL: 1142. allows suppressing output in a +platform-independent fashion. (Contributed by Ross Lagerwall in +bpo-5870(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8513 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=5870 + + +File: python.info, Node: sys<13>, Next: tarfile<9>, Prev: subprocess<6>, Up: Improved Modules<11> + +1.11.20.53 sys +.............. + +The *note sys: d9. module has a new *note thread_info: 1144. *note named +tuple: 64a. holding information about the thread implementation +(bpo-11223(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=11223 + + +File: python.info, Node: tarfile<9>, Next: tempfile<4>, Prev: sys<13>, Up: Improved Modules<11> + +1.11.20.54 tarfile +.................. + +*note tarfile: de. now supports ‘lzma’ encoding via the *note lzma: 8a. +module. (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<2>, Prev: tarfile<9>, Up: Improved Modules<11> + +1.11.20.55 tempfile +................... + +*note tempfile.SpooledTemporaryFile: 68f.'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<2>, Next: threading<8>, Prev: tempfile<4>, Up: Improved Modules<11> + +1.11.20.56 textwrap +................... + +The *note textwrap: ec. module has a new *note indent(): 278. that makes +it straightforward to add a common prefix to selected lines in a block +of text (bpo-13857(1)). + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=13857 + + +File: python.info, Node: threading<8>, Next: time<8>, Prev: textwrap<2>, Up: Improved Modules<11> + +1.11.20.57 threading +.................... + +*note threading.Condition: 1149, *note threading.Semaphore: 114a, *note +threading.BoundedSemaphore: 114b, *note threading.Event: 114c, and *note +threading.Timer: 114d, all of which used to be factory functions +returning a class instance, are now classes and may be subclassed. +(Contributed by Éric Araujo in bpo-10968(1).) + +The *note threading.Thread: 94c. constructor now accepts a ‘daemon’ +keyword argument to override the default behavior of inheriting the +‘daemon’ flag value from the parent thread (bpo-6064(2)). + +The formerly private function ‘_thread.get_ident’ is now available as +the public function *note threading.get_ident(): 114e. This eliminates +several cases of direct access to the ‘_thread’ module in the stdlib. +Third party code that used ‘_thread.get_ident’ should likewise be +changed to use the new public interface. + + ---------- 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<7>, Prev: threading<8>, Up: Improved Modules<11> + +1.11.20.58 time +............... + +The PEP 418(1) added new functions to the *note time: ee. module: + + * *note get_clock_info(): 1150.: Get information on a clock. + + * *note monotonic(): 255.: Monotonic clock (cannot go backward), not + affected by system clock updates. + + * *note perf_counter(): a88.: Performance counter with the highest + available resolution to measure a short duration. + + * *note process_time(): a89.: Sum of the system and user CPU time of + the current process. + +Other new functions: + + * *note clock_getres(): 1151, *note clock_gettime(): 1152. and *note + clock_settime(): 1153. functions with ‘CLOCK_XXX’ constants. + (Contributed by Victor Stinner in bpo-10278(2).) + +To improve cross platform consistency, *note sleep(): 699. now raises a +*note ValueError: 204. when passed a negative sleep value. Previously +this was an error on posix, but produced an infinite sleep on Windows. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0418/ + + (2) https://bugs.python.org/issue?@action=redirect&bpo=10278 + + +File: python.info, Node: types<7>, Next: unittest<10>, Prev: time<8>, Up: Improved Modules<11> + +1.11.20.59 types +................ + +Add a new *note types.MappingProxyType: 469. class: Read-only proxy of a +mapping. (bpo-14386(1)) + +The new functions *note types.new_class(): 1155. and *note +types.prepare_class(): 1156. provide support for PEP 3115(2) compliant +dynamic type creation. (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<10>, Next: urllib<4>, Prev: types<7>, Up: Improved Modules<11> + +1.11.20.60 unittest +................... + +*note assertRaises(): 528, *note assertRaisesRegex(): 52a, *note +assertWarns(): 1158, and *note assertWarnsRegex(): 1159. now accept a +keyword argument 'msg' when used as context managers. (Contributed by +Ezio Melotti and Winston Ewert in bpo-10775(1).) + +*note unittest.TestCase.run(): 115a. now returns the *note TestResult: +115b. object. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10775 + + +File: python.info, Node: urllib<4>, Next: webbrowser<3>, Prev: unittest<10>, Up: Improved Modules<11> + +1.11.20.61 urllib +................. + +The *note Request: fd3. class, now accepts a 'method' argument used by +*note get_method(): 115d. to determine what HTTP method should be used. +For example, this will send a ‘'HEAD'’ request: + + >>> 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<3>, Next: xml etree ElementTree<2>, Prev: urllib<4>, Up: Improved Modules<11> + +1.11.20.62 webbrowser +..................... + +The *note webbrowser: 115. module supports more “browsers”: Google +Chrome (named ‘chrome’, ‘chromium’, ‘chrome-browser’ or +‘chromium-browser’ depending on the version and operating system), and +the generic launchers ‘xdg-open’, from the FreeDesktop.org project, and +‘gvfs-open’, which is the default URI handler for GNOME 3. (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<2>, Prev: webbrowser<3>, Up: Improved Modules<11> + +1.11.20.63 xml.etree.ElementTree +................................ + +The *note xml.etree.ElementTree: 125. 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: 30a. 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<2>, Prev: xml etree ElementTree<2>, Up: Improved Modules<11> + +1.11.20.64 zlib +............... + +New attribute *note zlib.Decompress.eof: 1161. 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: 1162. 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: Optimizations<10>, Next: Build and C API Changes<4>, Prev: Improved Modules<11>, Up: What’s New In Python 3 3 + +1.11.21 Optimizations +--------------------- + +Major performance enhancements have been added: + + * Thanks to PEP 393(1), some operations on Unicode strings have been + optimized: + + * the memory footprint is divided by 2 to 4 depending on the + text + + * encode an ASCII string to UTF-8 doesn’t need to encode + characters anymore, the UTF-8 representation is shared with + the ASCII representation + + * the UTF-8 encoder has been optimized + + * repeating a single ASCII letter and getting a substring of an + ASCII string is 4 times faster + + * UTF-8 is now 2x to 4x faster. UTF-16 encoding is now up to 10x + faster. + + (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: Build and C API Changes<4>, Next: Deprecated<12>, Prev: Optimizations<10>, Up: What’s New In Python 3 3 + +1.11.22 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * New PEP 3118(1) related function: + + * *note PyMemoryView_FromMemory(): 1164. + + * PEP 393(2) added new Unicode types, macros and functions: + + * High-level API: + + * *note PyUnicode_CopyCharacters(): 8b4. + + * *note PyUnicode_FindChar(): 8b8. + + * *note PyUnicode_GetLength(): 8b2, *note + PyUnicode_GET_LENGTH: 8b3. + + * *note PyUnicode_New(): 8aa. + + * *note PyUnicode_Substring(): 8b5. + + * *note PyUnicode_ReadChar(): 1165, *note + PyUnicode_WriteChar(): 1166. + + * Low-level API: + + * *note Py_UCS1: 1167, *note Py_UCS2: 1168, *note Py_UCS4: + 29d. types + + * *note PyASCIIObject: 1169. and *note + PyCompactUnicodeObject: 116a. structures + + * *note PyUnicode_READY: 3fd. + + * *note PyUnicode_FromKindAndData(): 116b. + + * *note PyUnicode_AsUCS4(): 116c, *note + PyUnicode_AsUCS4Copy(): 8ba. + + * *note PyUnicode_DATA: 116d, *note PyUnicode_1BYTE_DATA: + 116e, *note PyUnicode_2BYTE_DATA: 116f, *note + PyUnicode_4BYTE_DATA: 1170. + + * *note PyUnicode_KIND: 1171. with ‘PyUnicode_Kind’ enum: + ‘PyUnicode_WCHAR_KIND’, *note PyUnicode_1BYTE_KIND: 1172, + *note PyUnicode_2BYTE_KIND: 1173, *note + PyUnicode_4BYTE_KIND: 1174. + + * *note PyUnicode_READ: 1175, *note PyUnicode_READ_CHAR: + 1176, *note PyUnicode_WRITE: 1177. + + * *note PyUnicode_MAX_CHAR_VALUE: 1178. + + * *note PyArg_ParseTuple: 56e. now accepts a *note bytearray: 53a. + for the ‘c’ format (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: Deprecated<12>, Next: Porting to Python 3 3, Prev: Build and C API Changes<4>, Up: What’s New In Python 3 3 + +1.11.23 Deprecated +------------------ + +* Menu: + +* Unsupported Operating Systems: Unsupported Operating Systems<2>. +* Deprecated Python modules, functions and methods: Deprecated Python modules functions and methods<4>. +* Deprecated functions and types of the C API: Deprecated functions and types of the C API<3>. +* Deprecated features:: + + +File: python.info, Node: Unsupported Operating Systems<2>, Next: Deprecated Python modules functions and methods<4>, Up: Deprecated<12> + +1.11.23.1 Unsupported Operating Systems +....................................... + +OS/2 and VMS are no longer supported due to the lack of a maintainer. + +Windows 2000 and Windows platforms which set ‘COMSPEC’ to ‘command.com’ +are no longer supported due to maintenance burden. + +OSF support, which was deprecated in 3.2, has been completely removed. + + +File: python.info, Node: Deprecated Python modules functions and methods<4>, Next: Deprecated functions and types of the C API<3>, Prev: Unsupported Operating Systems<2>, Up: Deprecated<12> + +1.11.23.2 Deprecated Python modules, functions and methods +.......................................................... + + * Passing a non-empty string to ‘object.__format__()’ is deprecated, + and will produce a *note TypeError: 534. in Python 3.4 + (bpo-9856(1)). + + * The ‘unicode_internal’ codec has been deprecated because of the PEP + 393(2), use UTF-8, UTF-16 (‘utf-16-le’ or ‘utf-16-be’), or UTF-32 + (‘utf-32-le’ or ‘utf-32-be’) + + * *note ftplib.FTP.nlst(): 10b9. and *note ftplib.FTP.dir(): 10ba.: + use *note ftplib.FTP.mlsd(): 10b8. + + * ‘platform.popen()’: use the *note subprocess: d6. module. Check + especially the *note Replacing Older Functions with the subprocess + Module: 117c. section (bpo-11377(3)). + + * bpo-13374(4): The Windows bytes API has been deprecated in the + *note os: a1. module. Use Unicode filenames, instead of bytes + filenames, to not depend on the ANSI code page anymore and to + support any filename. + + * 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(): a88. or *note time.process_time(): + a89. function instead, depending on your requirements, to have a + well defined behaviour. + + * The ‘os.stat_float_times()’ function is deprecated. + + * *note abc: 4. module: + + * *note abc.abstractproperty: 107e. has been deprecated, use + *note property: 194. with *note abc.abstractmethod(): 107f. + instead. + + * *note abc.abstractclassmethod: 1080. has been deprecated, use + *note classmethod: 166. with *note abc.abstractmethod(): 107f. + instead. + + * *note abc.abstractstaticmethod: 1081. has been deprecated, use + *note staticmethod: 412. with *note abc.abstractmethod(): + 107f. instead. + + * *note importlib: 77. package: + + * *note importlib.abc.SourceLoader.path_mtime(): 117d. is now + deprecated in favour of *note + importlib.abc.SourceLoader.path_stats(): 117e. as bytecode + files now store both the modification time and size of the + source file the bytecode file was compiled from. + + ---------- 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: Deprecated functions and types of the C API<3>, Next: Deprecated features, Prev: Deprecated Python modules functions and methods<4>, Up: Deprecated<12> + +1.11.23.3 Deprecated functions and types of the C API +..................................................... + +The *note Py_UNICODE: 3e9. has been deprecated by PEP 393(1) and will be +removed in Python 4. All functions using this type are deprecated: + +Unicode functions and methods using *note Py_UNICODE: 3e9. and *note +Py_UNICODE: 3e9.* types: + + * ‘PyUnicode_FromUnicode’: use *note PyUnicode_FromWideChar(): 1180. + or *note PyUnicode_FromKindAndData(): 116b. + + * ‘PyUnicode_AS_UNICODE’, ‘PyUnicode_AsUnicode()’, + ‘PyUnicode_AsUnicodeAndSize()’: use *note + PyUnicode_AsWideCharString(): 8bb. + + * ‘PyUnicode_AS_DATA’: use *note PyUnicode_DATA: 116d. with *note + PyUnicode_READ: 1175. and *note PyUnicode_WRITE: 1177. + + * ‘PyUnicode_GET_SIZE’, ‘PyUnicode_GetSize()’: use *note + PyUnicode_GET_LENGTH: 8b3. or *note PyUnicode_GetLength(): 8b2. + + * ‘PyUnicode_GET_DATA_SIZE’: use ‘PyUnicode_GET_LENGTH(str) * + PyUnicode_KIND(str)’ (only work on ready strings) + + * ‘PyUnicode_AsUnicodeCopy()’: use *note PyUnicode_AsUCS4Copy(): 8ba. + or *note PyUnicode_AsWideCharString(): 8bb. + + * ‘PyUnicode_GetMax()’ + +Functions and macros manipulating Py_UNICODE* strings: + + * ‘Py_UNICODE_strlen()’: use *note PyUnicode_GetLength(): 8b2. or + *note PyUnicode_GET_LENGTH: 8b3. + + * ‘Py_UNICODE_strcat()’: use *note PyUnicode_CopyCharacters(): 8b4. + or *note PyUnicode_FromFormat(): 385. + + * ‘Py_UNICODE_strcpy()’, ‘Py_UNICODE_strncpy()’, ‘Py_UNICODE_COPY()’: + use *note PyUnicode_CopyCharacters(): 8b4. or *note + PyUnicode_Substring(): 8b5. + + * ‘Py_UNICODE_strcmp()’: use *note PyUnicode_Compare(): 8b6. + + * ‘Py_UNICODE_strncmp()’: use *note PyUnicode_Tailmatch(): 8b7. + + * ‘Py_UNICODE_strchr()’, ‘Py_UNICODE_strrchr()’: use *note + PyUnicode_FindChar(): 8b8. + + * ‘Py_UNICODE_FILL()’: use *note PyUnicode_Fill(): 1181. + + * ‘Py_UNICODE_MATCH’ + +Encoders: + + * ‘PyUnicode_Encode()’: use ‘PyUnicode_AsEncodedObject()’ + + * ‘PyUnicode_EncodeUTF7()’ + + * ‘PyUnicode_EncodeUTF8()’: use *note PyUnicode_AsUTF8(): bbb. or + *note PyUnicode_AsUTF8String(): 1182. + + * ‘PyUnicode_EncodeUTF32()’ + + * ‘PyUnicode_EncodeUTF16()’ + + * ‘PyUnicode_EncodeUnicodeEscape()’ use *note + PyUnicode_AsUnicodeEscapeString(): 1183. + + * ‘PyUnicode_EncodeRawUnicodeEscape()’ use *note + PyUnicode_AsRawUnicodeEscapeString(): 1184. + + * ‘PyUnicode_EncodeLatin1()’: use *note PyUnicode_AsLatin1String(): + 1185. + + * ‘PyUnicode_EncodeASCII()’: use *note PyUnicode_AsASCIIString(): + 1186. + + * ‘PyUnicode_EncodeCharmap()’ + + * ‘PyUnicode_TranslateCharmap()’ + + * ‘PyUnicode_EncodeMBCS()’: use *note PyUnicode_AsMBCSString(): 1187. + or *note PyUnicode_EncodeCodePage(): 1188. (with ‘CP_ACP’ + code_page) + + * ‘PyUnicode_EncodeDecimal()’, ‘PyUnicode_TransformDecimalToASCII()’ + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0393/ + + +File: python.info, Node: Deprecated features, Prev: Deprecated functions and types of the C API<3>, Up: Deprecated<12> + +1.11.23.4 Deprecated features +............................. + +The *note array: 7. module’s ‘'u'’ format code is now deprecated and +will be removed in Python 4 together with the rest of the (*note +Py_UNICODE: 3e9.) API. + + +File: python.info, Node: Porting to Python 3 3, Prev: Deprecated<12>, Up: What’s New In Python 3 3 + +1.11.24 Porting to Python 3.3 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code. + +* Menu: + +* Porting Python code:: +* Porting C code:: +* Building C extensions:: +* Command Line Switch Changes:: + + +File: python.info, Node: Porting Python code, Next: Porting C code, Up: Porting to Python 3 3 + +1.11.24.1 Porting Python code +............................. + + * Hash randomization is enabled by default. Set the *note + PYTHONHASHSEED: 1076. environment variable to ‘0’ to disable hash + randomization. See also the *note object.__hash__(): afb. method. + + * bpo-12326(1): On Linux, sys.platform doesn’t contain the major + version anymore. It is now always ‘linux’, instead of ‘linux2’ or + ‘linux3’ depending on the Linux version used to build Python. + Replace sys.platform == ‘linux2’ with + sys.platform.startswith(‘linux’), or directly sys.platform == + ‘linux’ if you don’t need to support older Python versions. + + * bpo-13847(2), bpo-14180(3): *note time: ee. and *note datetime: + 30.: *note OverflowError: 87f. is now raised instead of *note + ValueError: 204. if a timestamp is out of range. *note OSError: + 413. is now raised if C functions ‘gmtime()’ or ‘localtime()’ + failed. + + * The default finders used by import now utilize a cache of what is + contained within a specific directory. If you create a Python + source file or sourceless bytecode file, make sure to call *note + importlib.invalidate_caches(): c10. to clear out the cache for the + finders to notice the new file. + + * *note ImportError: 415. now uses the full name of the module that + was attempted to be imported. Doctests that check ImportErrors’ + message will need to be updated to use the full name of the module + instead of just the tail of the name. + + * The 'index' argument to *note __import__(): 8d3. now defaults to 0 + instead of -1 and no longer support negative values. It was an + oversight when PEP 328(4) was implemented that the default value + remained -1. If you need to continue to perform a relative import + followed by an absolute import, then perform the relative import + using an index of 1, followed by another import using an index of + 0. It is preferred, though, that you use *note + importlib.import_module(): 513. rather than call *note + __import__(): 8d3. directly. + + * *note __import__(): 8d3. no longer allows one to use an index value + other than 0 for top-level modules. E.g. ‘__import__('sys', + level=1)’ is now an error. + + * Because *note sys.meta_path: d2b. and *note sys.path_hooks: 101d. + now have finders on them by default, you will most likely want to + use ‘list.insert()’ instead of ‘list.append()’ to add to those + lists. + + * Because ‘None’ is now inserted into *note sys.path_importer_cache: + 5e0, if you are clearing out entries in the dictionary of paths + that do not have a finder, you will need to remove keys paired with + values of ‘None’ 'and' ‘imp.NullImporter’ to be + backwards-compatible. This will lead to extra overhead on older + versions of Python that re-insert ‘None’ into *note + sys.path_importer_cache: 5e0. 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: 106a. + + * *note pkgutil: a9. has been converted to use *note importlib: 77. + internally. This eliminates many edge cases where the old + behaviour of the PEP 302(5) import emulation failed to match the + behaviour of the real import system. The import emulation itself + is still present, but is now deprecated. The *note + pkgutil.iter_importers(): 118c. and *note pkgutil.walk_packages(): + bff. functions special case the standard import hooks so they are + still supported even though they do not provide the non-standard + ‘iter_modules()’ method. + + * A longstanding RFC-compliance bug (bpo-1079(6)) in the parsing done + by *note email.header.decode_header(): 10ae. has been fixed. Code + that uses the standard idiom to convert encoded headers into + unicode (‘str(make_header(decode_header(h))’) will see no change, + but code that looks at the individual tuples returned by + decode_header will see that whitespace that precedes or follows + ‘ASCII’ sections is now included in the ‘ASCII’ section. Code that + builds headers using ‘make_header’ should also continue to work + without change, since ‘make_header’ continues to add whitespace + between ‘ASCII’ and non-‘ASCII’ sections if it is not already + present in the input strings. + + * *note email.utils.formataddr(): 118d. now does the correct content + transfer encoding when passed non-‘ASCII’ display names. Any code + that depended on the previous buggy behavior that preserved the + non-‘ASCII’ unicode in the formatted output string will need to be + changed (bpo-1690608(7)). + + * *note poplib.POP3.quit(): 118e. may now raise protocol errors like + all other ‘poplib’ methods. Code that assumes ‘quit’ does not + raise *note poplib.error_proto: 118f. errors may need to be changed + if errors on ‘quit’ are encountered by a particular application + (bpo-11291(8)). + + * The ‘strict’ argument to *note email.parser.Parser: 1190, + deprecated since Python 2.4, has finally been removed. + + * The deprecated method ‘unittest.TestCase.assertSameElements’ has + been removed. + + * The deprecated variable ‘time.accept2dyear’ has been removed. + + * The deprecated ‘Context._clamp’ attribute has been removed from the + *note decimal: 36. module. It was previously replaced by the + public attribute *note clamp: 1191. (See bpo-8540(9).) + + * The undocumented internal helper class ‘SSLFakeFile’ has been + removed from *note smtplib: ca, since its functionality has long + been provided directly by *note socket.socket.makefile(): 1192. + + * Passing a negative value to *note time.sleep(): 699. on Windows now + raises an error instead of sleeping forever. It has always raised + an error on posix. + + * The ‘ast.__version__’ constant has been removed. If you need to + make decisions affected by the AST version, use *note + sys.version_info: 69c. to make the decision. + + * Code that used to work around the fact that the *note threading: + ed. module used factory functions by subclassing the private + classes will need to change to subclass the now-public classes. + + * The undocumented debugging machinery in the threading module has + been removed, simplifying the code. This should have no effect on + production code, but is mentioned here in case any application + debug frameworks were interacting with it (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: Porting C code, Next: Building C extensions, Prev: Porting Python code, Up: Porting to Python 3 3 + +1.11.24.2 Porting C code +........................ + + * In the course of changes to the buffer API the undocumented + ‘smalltable’ member of the *note Py_buffer: 753. structure has been + removed and the layout of the ‘PyMemoryViewObject’ has changed. + + All extensions relying on the relevant parts in ‘memoryobject.h’ or + ‘object.h’ must be rebuilt. + + * Due to *note PEP 393: 1036, the *note Py_UNICODE: 3e9. type and all + functions using this type are deprecated (but will stay available + for at least five years). If you were using low-level Unicode APIs + to construct and access unicode objects and you want to benefit of + the memory footprint reduction provided by PEP 393(1), you have to + convert your code to the new *note Unicode API: 1193. + + However, if you only have been using high-level functions such as + *note PyUnicode_Concat(): 1194, *note PyUnicode_Join(): 1195. or + *note PyUnicode_FromFormat(): 385, your code will automatically + take advantage of the new unicode representations. + + * *note PyImport_GetMagicNumber(): 1196. now returns ‘-1’ upon + failure. + + * As a negative value for the 'level' argument to *note __import__(): + 8d3. is no longer valid, the same now holds for *note + PyImport_ImportModuleLevel(): 1197. This also means that the value + of 'level' used by *note PyImport_ImportModuleEx(): 1198. is now + ‘0’ instead of ‘-1’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0393/ + + +File: python.info, Node: Building C extensions, Next: Command Line Switch Changes, Prev: Porting C code, Up: Porting to Python 3 3 + +1.11.24.3 Building C extensions +............................... + + * The range of possible file names for C extensions has been + narrowed. Very rarely used spellings have been suppressed: under + POSIX, files named ‘xxxmodule.so’, ‘xxxmodule.abi3.so’ and + ‘xxxmodule.cpython-*.so’ are no longer recognized as implementing + the ‘xxx’ module. If you had been generating such files, you have + to switch to the other spellings (i.e., remove the ‘module’ string + from the file names). + + (implemented in bpo-14040(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=14040 + + +File: python.info, Node: Command Line Switch Changes, Prev: Building C extensions, Up: Porting to Python 3 3 + +1.11.24.4 Command Line Switch Changes +..................................... + + * The -Q command-line flag and related artifacts have been removed. + Code checking sys.flags.division_warning will need updating. + + (bpo-10998(1), contributed by Éric Araujo.) + + * When ‘python’ is started with *note -S: 119b, ‘import site’ will no + longer add site-specific paths to the module search paths. In + previous versions, it did. + + (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.12 What’s New In Python 3.2 +============================= + + +Author: 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. + +See also +........ + +PEP 392(2) - Python 3.2 Release Schedule + +* Menu: + +* PEP 384; Defining a Stable ABI: PEP 384 Defining a Stable ABI. +* PEP 389; Argparse Command Line Parsing Module: PEP 389 Argparse Command Line Parsing Module. +* PEP 391; Dictionary Based Configuration for Logging: PEP 391 Dictionary Based Configuration for Logging. +* PEP 3148; The concurrent.futures module: PEP 3148 The concurrent futures module. +* PEP 3147; PYC Repository Directories: PEP 3147 PYC Repository Directories. +* PEP 3149; ABI Version Tagged .so Files: PEP 3149 ABI Version Tagged so Files. +* PEP 3333; Python Web Server Gateway Interface v1.0.1: PEP 3333 Python Web Server Gateway Interface v1 0 1. +* Other Language Changes: Other Language Changes<12>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules. +* Multi-threading:: +* Optimizations: Optimizations<11>. +* Unicode:: +* Codecs:: +* Documentation:: +* IDLE:: +* Code Repository:: +* Build and C API Changes: Build and C API Changes<5>. +* Porting to Python 3.2: Porting to 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 Defining a Stable ABI, Next: PEP 389 Argparse Command Line Parsing Module, Up: What’s New In Python 3 2 + +1.12.1 PEP 384: Defining a Stable ABI +------------------------------------- + +In the past, extension modules built for one Python version were often +not usable with other Python versions. Particularly on Windows, every +feature release of Python required rebuilding all extension modules that +one wanted to use. This requirement was the result of the free access +to Python interpreter internals that extension modules could use. + +With Python 3.2, an alternative approach becomes available: extension +modules which restrict themselves to a limited API (by defining +Py_LIMITED_API) cannot use many of the internals, but are constrained to +a set of API functions that are promised to be stable for several +releases. As a consequence, extension modules built for 3.2 in that +mode will also work with 3.3, 3.4, and so on. Extension modules that +make use of details of memory structures can still be built, but will +need to be recompiled for every feature release. + +See also +........ + +PEP 384(1) - Defining a Stable ABI + + PEP written by Martin von Löwis. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0384/ + + +File: python.info, Node: PEP 389 Argparse Command Line Parsing Module, Next: PEP 391 Dictionary Based Configuration for Logging, Prev: PEP 384 Defining a Stable ABI, Up: What’s New In Python 3 2 + +1.12.2 PEP 389: Argparse Command Line Parsing Module +---------------------------------------------------- + +A new module for command line parsing, *note argparse: 6, was introduced +to overcome the limitations of *note optparse: a0. which did not provide +support for positional arguments (not just options), subcommands, +required options and other common patterns of specifying and validating +options. + +This module has already had widespread success in the community as a +third-party module. Being more fully featured than its predecessor, the +*note argparse: 6. module is now the preferred module for command-line +processing. The older module is still being kept available because of +the substantial amount of legacy code that depends on it. + +Here’s an annotated example parser showing features like limiting +results to a set of choices, specifying a 'metavar' in the help screen, +validating that one or more positional arguments is present, and making +a required option: + + 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') + +Example of calling the parser on a command string: + + >>> 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' + +Example of the parser’s automatically generated help: + + >>> 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 + +An especially nice *note argparse: 6. feature is the ability to define +subparsers, each with their own argument patterns and help displays: + + 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 + +See also +........ + +PEP 389(1) - New Command Line Parsing Module + + PEP written by Steven Bethard. + +*note Migrating optparse code to argparse: 11a0. for details on the +differences from *note optparse: a0. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0389/ + + +File: python.info, Node: PEP 391 Dictionary Based Configuration for Logging, Next: PEP 3148 The concurrent futures module, Prev: PEP 389 Argparse Command Line Parsing Module, Up: What’s New In Python 3 2 + +1.12.3 PEP 391: Dictionary Based Configuration for Logging +---------------------------------------------------------- + +The *note logging: 87. 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: 22. 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. + +To support a more flexible style, the module now offers *note +logging.config.dictConfig(): 11a2. for specifying logging configuration +with plain Python dictionaries. The configuration options include +formatters, handlers, filters, and loggers. Here’s a working example of +a configuration dictionary: + + {"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"]}} + +If that dictionary is stored in a file called ‘conf.json’, it can be +loaded and called with code like this: + + >>> 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 + +See also +........ + +PEP 391(1) - Dictionary Based Configuration for Logging + + PEP written by Vinay Sajip. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0391/ + + +File: python.info, Node: PEP 3148 The concurrent futures module, Next: PEP 3147 PYC Repository Directories, Prev: PEP 391 Dictionary Based Configuration for Logging, Up: What’s New In Python 3 2 + +1.12.4 PEP 3148: The ‘concurrent.futures’ module +------------------------------------------------ + +Code for creating and managing concurrency is being collected in a new +top-level namespace, 'concurrent'. Its first member is a 'futures' +package which provides a uniform high-level interface for managing +threads and processes. + +The design for *note concurrent.futures: 21. was inspired by the +'java.util.concurrent' package. In that model, a running call and its +result are represented by a *note Future: 11a4. object that abstracts +features common to threads, processes, and remote procedure calls. That +object supports status checks (running or done), timeouts, +cancellations, adding callbacks, and access to results or exceptions. + +The primary offering of the new module is a pair of executor classes for +launching and managing calls. The goal of the executors is to make it +easier to use existing tools for making parallel calls. They save the +effort needed to setup a pool of resources, launch the calls, create a +results queue, add time-out handling, and limit the total number of +threads, processes, or remote procedure calls. + +Ideally, each application should share a single executor across multiple +components so that process and thread limits can be centrally managed. +This solves the design challenge that arises when each component has its +own competing strategy for resource management. + +Both classes share a common interface with three methods: *note +submit(): a82. for scheduling a callable and returning a *note Future: +11a4. object; *note map(): de3. for scheduling many asynchronous calls +at a time, and *note shutdown(): 8ec. for freeing resources. The class +is a *note context manager: 5d0. and can be used in a *note with: 5ce. +statement to assure that resources are automatically released when +currently pending futures are done executing. + +A simple of example of *note ThreadPoolExecutor: 73d. is a launch of +four parallel threads for copying files: + + 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') + +See also +........ + +PEP 3148(1) - Futures – Execute Computations Asynchronously + + PEP written by Brian Quinlan. + +*note Code for Threaded Parallel URL reads: 11a5, an example using +threads to fetch multiple web pages in parallel. + +*note Code for computing prime numbers in parallel: 11a6, an example +demonstrating *note ProcessPoolExecutor: 8ed. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3148/ + + +File: python.info, Node: PEP 3147 PYC Repository Directories, Next: PEP 3149 ABI Version Tagged so Files, Prev: PEP 3148 The concurrent futures module, Up: What’s New In Python 3 2 + +1.12.5 PEP 3147: PYC Repository Directories +------------------------------------------- + +Python’s scheme for caching bytecode in '.pyc' files did not work well +in environments with multiple Python interpreters. If one interpreter +encountered a cached file created by another interpreter, it would +recompile the source and overwrite the cached file, thus losing the +benefits of caching. + +The issue of “pyc fights” has become more pronounced as it has become +commonplace for Linux distributions to ship with multiple versions of +Python. These conflicts also arise with CPython alternatives such as +Unladen Swallow. + +To solve this problem, Python’s import machinery has been extended to +use distinct filenames for each interpreter. Instead of Python 3.2 and +Python 3.3 and Unladen Swallow each competing for a file called +“mymodule.pyc”, they will now look for “mymodule.cpython-32.pyc”, +“mymodule.cpython-33.pyc”, and “mymodule.unladen10.pyc”. And to prevent +all of these new files from cluttering source directories, the 'pyc' +files are now collected in a “__pycache__” directory stored under the +package directory. + +Aside from the filenames and target directories, the new scheme has a +few aspects that are visible to the programmer: + + * Imported modules now have a *note __cached__: 2d9. 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' + + * The *note py_compile: b3. and *note compileall: 20. modules have + been updated to reflect the new naming convention and target + directory. The command-line invocation of 'compileall' has new + options: ‘-i’ for specifying a list of files and directories to + compile and ‘-b’ which causes bytecode files to be written to their + legacy location rather than '__pycache__'. + + * The *note importlib.abc: 78. module has been updated with new *note + abstract base classes: 11a8. 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). + +See also +........ + +PEP 3147(1) - PYC Repository Directories + + PEP written by Barry Warsaw. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + +File: python.info, Node: PEP 3149 ABI Version Tagged so Files, Next: PEP 3333 Python Web Server Gateway Interface v1 0 1, Prev: PEP 3147 PYC Repository Directories, Up: What’s New In Python 3 2 + +1.12.6 PEP 3149: ABI Version Tagged .so Files +--------------------------------------------- + +The PYC repository directory allows multiple bytecode cache files to be +co-located. This PEP implements a similar mechanism for shared object +files by giving them a common directory and distinct names for each +version. + +The common directory is “pyshared” and the file names are made distinct +by identifying the Python implementation (such as CPython, PyPy, Jython, +etc.), the major and minor version numbers, and optional build flags +(such as “d” for debug, “m” for pymalloc, “u” for wide-unicode). For an +arbitrary package “foo”, you may see these files when the distribution +package is installed: + + /usr/share/pyshared/foo.cpython-32m.so + /usr/share/pyshared/foo.cpython-33md.so + +In Python itself, the tags are accessible from functions in the *note +sysconfig: db. module: + + >>> 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' + +See also +........ + +PEP 3149(1) - ABI Version Tagged .so Files + + 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: Other Language Changes<12>, Prev: PEP 3149 ABI Version Tagged so Files, Up: What’s New In Python 3 2 + +1.12.7 PEP 3333: Python Web Server Gateway Interface v1.0.1 +----------------------------------------------------------- + +This informational PEP clarifies how bytes/text issues are to be handled +by the WSGI protocol. The challenge is that string handling in Python 3 +is most conveniently handled with the *note str: 447. type even though +the HTTP protocol is itself bytes oriented. + +The PEP differentiates so-called 'native strings' that are used for +request/response headers and metadata versus 'byte strings' which are +used for the bodies of requests and responses. + +The 'native strings' are always of type *note str: 447. 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. + +For developers porting WSGI applications from Python 2, here are the +salient points: + + * If the app already used strings for headers in Python 2, no change + is needed. + + * If instead, the app encoded output headers or decoded input + headers, then the headers will need to be re-encoded to Latin-1. + For example, an output header encoded in utf-8 was using + ‘h.encode('utf-8')’ now needs to convert from bytes to native + strings using ‘h.encode('utf-8').decode('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: 118. module has a +new function, *note wsgiref.handlers.read_environ(): 11ab. for +transcoding CGI variables from *note os.environ: 11ac. into native +strings and returning a new dictionary. + +See also +........ + +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: Other Language Changes<12>, Next: New Improved and Deprecated Modules, Prev: PEP 3333 Python Web Server Gateway Interface v1 0 1, Up: What’s New In Python 3 2 + +1.12.8 Other Language Changes +----------------------------- + +Some smaller changes made to the core Python language are: + + * String formatting for *note format(): 61b. and *note str.format(): + 61d. gained new capabilities for the format character '#'. + Previously, for integers in binary, octal, or hexadecimal, it + caused the output to be prefixed with ‘0b’, ‘0o’, or ‘0x’ + respectively. Now it can also handle floats, complex, and Decimal, + causing the output to always have a decimal point even when no + digits follow it. + + >>> 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(): dd6. method that + extends the capabilities of the existing *note str.format(): 61d. + method by accepting arbitrary *note mapping: 11ae. objects. This + new method makes it possible to use string formatting with any of + Python’s many dictionary-like objects such as *note defaultdict: + 11af, *note Shelf: f95, *note ConfigParser: 1c8, or *note dbm: 31. + It is also useful with custom *note dict: 258. subclasses that + normalize keys before look-up or that supply a ‘__missing__()’ + 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 , welcome to ' + + (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: 688. 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(): 4ce. function works by calling *note + getattr(): bd1. and detecting whether an exception is raised. This + technique allows it to detect methods created dynamically by *note + __getattr__(): 4cf. or *note __getattribute__(): bd2. 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: + 348. 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).) + + * The *note str(): 447. of a float or complex number is now the same + as its *note repr(): 7f9. Previously, the *note str(): 447. form + was shorter but that just caused confusion and is no longer needed + now that the shortest possible *note repr(): 7f9. is displayed by + default: + + >>> import math + >>> repr(math.pi) + '3.141592653589793' + >>> str(math.pi) + '3.141592653589793' + + (Proposed and implemented by Mark Dickinson; bpo-9337(5).) + + * *note memoryview: 464. objects now have a *note release(): 11b0. + 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).) + + * Previously it was illegal to delete a name from the local namespace + if it occurs as a free variable in a nested block: + + def outer(x): + def inner(): + return x + inner() + del x + + This is now allowed. Remember that the target of an *note except: + 18b. clause is cleared, so this code which used to work with Python + 2.6, raised a *note SyntaxError: 18d. with Python 3.1 and now works + again: + + def f(): + def print_error(): + print(e) + try: + something + except Exception as e: + print_error() + # implicit "del e" here + + (See bpo-4617(7).) + + * *note Struct sequence types: 11b1. are now subclasses of tuple. + This means that C structures like those returned by *note + os.stat(): 49c, *note time.gmtime(): 11b2, and *note + sys.version_info: 69c. now work like a *note named tuple: 64a. 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).) + + * Warnings are now easier to control using the *note PYTHONWARNINGS: + baa. environment variable as an alternative to using ‘-W’ at the + command line: + + $ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::' + + (Suggested by Barry Warsaw and implemented by Philip Jenvey in + bpo-7301(9).) + + * A new warning category, *note ResourceWarning: 246, has been added. + It is emitted when potential issues with resource consumption or + cleanup are detected. It is silenced by default in normal release + builds but can be enabled through the means provided by the *note + warnings: 112. module, or on the command line. + + A *note ResourceWarning: 246. is issued at interpreter shutdown if + the *note gc.garbage: 11b3. list isn’t empty, and if *note + gc.DEBUG_UNCOLLECTABLE: 11b4. is set, all uncollectable objects are + printed. This is meant to make the programmer aware that their + code contains object finalization issues. + + A *note ResourceWarning: 246. is also issued when a *note file + object: 11b5. is destroyed without having been explicitly closed. + While the deallocator for such object ensures it closes the + underlying operating system resource (usually, a file descriptor), + the delay in deallocating the object could produce various issues, + especially under Windows. Here is an example of enabling the + warning from the command line: + + $ 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: 943. objects now support 'index' and 'count' methods. + This is part of an effort to make more objects fully implement the + *note collections.Sequence: 11b6. *note abstract base class: 11a8. + As a result, the language will have a more uniform API. In + addition, *note range: 943. objects now support slicing and + negative indices, even with values larger than *note sys.maxsize: + 11b7. 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).) + + * The *note callable(): 11b8. builtin function from Py2.x was + resurrected. It provides a concise, readable alternative to using + an *note abstract base class: 11a8. in an expression like + ‘isinstance(x, collections.Callable)’: + + >>> callable(max) + True + >>> callable(20) + False + + (See bpo-10518(15).) + + * Python’s import mechanism can now load modules installed in + directories with non-ASCII characters in the path name. This + solved an aggravating problem with home directories for users with + non-ASCII characters in their usernames. + + (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: New Improved and Deprecated Modules, Next: Multi-threading, Prev: Other Language Changes<12>, Up: What’s New In Python 3 2 + +1.12.9 New, Improved, and Deprecated Modules +-------------------------------------------- + +Python’s standard library has undergone significant maintenance efforts +and quality improvements. + +The biggest news for Python 3.2 is that the *note email: 3b. package, +*note mailbox: 8b. 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. + +Throughout the standard library, there has been more careful attention +to encodings and text versus bytes issues. In particular, interactions +with the operating system are now better able to exchange non-ASCII data +using the Windows MBCS encoding, locale-aware encodings, or UTF-8. + +Another significant win is the addition of substantially better support +for 'SSL' connections and security certificates. + +In addition, more classes now implement a *note context manager: 5d0. to +support convenient and reliable resource clean-up using a *note with: +5ce. statement. + +* Menu: + +* email: email<6>. +* elementtree:: +* functools: functools<7>. +* itertools: itertools<7>. +* collections: collections<8>. +* threading: threading<9>. +* datetime and time:: +* math: math<10>. +* abc: abc<3>. +* io: io<7>. +* reprlib:: +* logging: logging<8>. +* csv: csv<4>. +* contextlib: contextlib<8>. +* decimal and fractions:: +* ftp:: +* popen:: +* select: select<3>. +* gzip and zipfile:: +* tarfile: tarfile<10>. +* hashlib: hashlib<7>. +* ast: ast<5>. +* os: os<13>. +* shutil: shutil<8>. +* sqlite3: sqlite3<11>. +* html: html<3>. +* socket: socket<11>. +* ssl: ssl<12>. +* nntp:: +* certificates:: +* imaplib: imaplib<4>. +* http.client: http client<4>. +* unittest: unittest<11>. +* random: random<5>. +* poplib: poplib<4>. +* asyncore: asyncore<2>. +* tempfile: tempfile<5>. +* inspect: inspect<10>. +* pydoc: pydoc<6>. +* dis: dis<5>. +* dbm: dbm<7>. +* ctypes: ctypes<3>. +* site: site<4>. +* sysconfig: sysconfig<3>. +* pdb: pdb<8>. +* configparser: configparser<5>. +* urllib.parse: urllib parse<6>. +* mailbox:: +* turtledemo:: + + +File: python.info, Node: email<6>, Next: elementtree, Up: New Improved and Deprecated Modules + +1.12.9.1 email +.............. + +The usability of the *note email: 3b. 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: 1c2. rather than *note str: 447. 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. + + * New functions *note message_from_bytes(): 11bb. and *note + message_from_binary_file(): 11bc, and new classes *note + BytesFeedParser: 11bd. and *note BytesParser: 11be. allow binary + message data to be parsed into model objects. + + * Given bytes input to the model, *note get_payload(): 11bf. will by + default decode a message body that has a + ‘Content-Transfer-Encoding’ of '8bit' using the charset specified + in the MIME headers and return the resulting string. + + * Given bytes input to the model, *note Generator: 11c0. will convert + message bodies that have a ‘Content-Transfer-Encoding’ of '8bit' to + instead have a '7bit' ‘Content-Transfer-Encoding’. + + Headers with unencoded non-ASCII bytes are deemed to be RFC + 2047(1)-encoded using the 'unknown-8bit' character set. + + * A new class *note BytesGenerator: 11c1. produces bytes as output, + preserving any unchanged non-ASCII data that was present in the + input used to build the model, including message bodies with a + ‘Content-Transfer-Encoding’ of '8bit'. + + * The *note smtplib: ca. *note SMTP: 92d. class now accepts a byte + string for the 'msg' argument to the *note sendmail(): e54. method, + and a new method, *note send_message(): e55. accepts a *note + Message: 27e. object and can optionally obtain the 'from_addr' and + 'to_addrs' addresses directly from the object. + +(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<7>, Prev: email<6>, Up: New Improved and Deprecated Modules + +1.12.9.2 elementtree +.................... + +The *note xml.etree.ElementTree: 125. package and its +‘xml.etree.cElementTree’ counterpart have been updated to version 1.3. + +Several new and useful functions and methods have been added: + + * *note xml.etree.ElementTree.fromstringlist(): 11c3. which builds an + XML document from a sequence of fragments + + * *note xml.etree.ElementTree.register_namespace(): 11c4. for + registering a global namespace prefix + + * *note xml.etree.ElementTree.tostringlist(): fef. for string + representation including all sublists + + * *note xml.etree.ElementTree.Element.extend(): 11c5. for appending a + sequence of zero or more elements + + * *note xml.etree.ElementTree.Element.iterfind(): 11c6. searches an + element and subelements + + * *note xml.etree.ElementTree.Element.itertext(): 11c7. creates a + text iterator over an element and its subelements + + * *note xml.etree.ElementTree.TreeBuilder.end(): 11c8. closes the + current element + + * *note xml.etree.ElementTree.TreeBuilder.doctype(): a97. handles a + doctype declaration + +Two methods have been deprecated: + + * ‘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<7>, Next: itertools<7>, Prev: elementtree, Up: New Improved and Deprecated Modules + +1.12.9.3 functools +.................. + + * The *note functools: 5f. module includes a new decorator for + caching function calls. *note functools.lru_cache(): 9ee. can save + repeated queries to an external resource whenever the results are + expected to be the same. + + For example, adding a caching decorator to a database query + function can save database accesses for popular searches: + + >>> 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 + + To help with choosing an effective cache size, the wrapped function + is instrumented for tracking cache statistics: + + >>> get_phone_number.cache_info() + CacheInfo(hits=4805, misses=980, maxsize=300, currsize=300) + + If the phonelist table gets updated, the outdated contents of the + cache can be cleared with: + + >>> 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(): f58. decorator now adds a + ‘__wrapped__’ attribute pointing to the original callable function. + This allows wrapped functions to be introspected. It also copies + *note __annotations__: 11ca. if defined. And now it also + gracefully skips over missing attributes such as *note __doc__: + 11cb. which might not be defined for the wrapped callable. + + In the above example, the cache can be removed by recovering the + original function: + + >>> 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).) + + * To help write classes with rich comparison methods, a new decorator + *note functools.total_ordering(): f3d. will use existing equality + and inequality methods to fill in the remaining methods. + + For example, supplying '__eq__' and '__lt__' will enable *note + total_ordering(): f3d. to fill-in '__le__', '__gt__' and '__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())) + + With the 'total_ordering' decorator, the remaining comparison + methods are filled in automatically. + + (Contributed by Raymond Hettinger.) + + * To aid in porting programs from Python 2, the *note + functools.cmp_to_key(): 11cc. function converts an old-style + comparison function to modern *note key function: e04.: + + >>> # locale-aware sort order + >>> sorted(iterable, key=cmp_to_key(locale.strcoll)) + + For sorting examples and a brief sorting tutorial, see the Sorting + HowTo(8) tutorial. + + (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 + + (8) https://wiki.python.org/moin/HowTo/Sorting/ + + +File: python.info, Node: itertools<7>, Next: collections<8>, Prev: functools<7>, Up: New Improved and Deprecated Modules + +1.12.9.4 itertools +.................. + + * The *note itertools: 81. module has a new *note accumulate(): 9fc. + function modeled on APL’s 'scan' operator and Numpy’s 'accumulate' + function: + + >>> 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] + + For an example using *note accumulate(): 9fc, see the *note + examples for the random module: 11ce. + + (Contributed by Raymond Hettinger and incorporating design + suggestions from Mark Dickinson.) + + +File: python.info, Node: collections<8>, Next: threading<9>, Prev: itertools<7>, Up: New Improved and Deprecated Modules + +1.12.9.5 collections +.................... + + * The *note collections.Counter: 108b. class now has two forms of + in-place subtraction, the existing '-=' operator for saturating + subtraction(1) and the new *note subtract(): 11d0. method for + regular subtraction. The former is suitable for multisets(2) which + only have positive counts, and the latter is more suitable for use + cases that allow negative counts: + + >>> 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.) + + * The *note collections.OrderedDict: 5d7. class has a new method + *note move_to_end(): 11d1. which takes an existing key and moves it + to either the first or last position in the ordered sequence. + + The default is to move an item to the last position. This is + equivalent of renewing an entry with ‘od[k] = od.pop(k)’. + + A fast move-to-end operation is useful for resequencing entries. + For example, an ordered dictionary can be used to track order of + access by aging entries from the oldest to the most recently + accessed. + + >>> 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.) + + * The *note collections.deque: 5d8. class grew two new methods *note + count(): 11d2. and *note reverse(): 11d3. that make them more + substitutable for *note list: 60d. objects: + + >>> 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://en.wikipedia.org/wiki/Multiset + + +File: python.info, Node: threading<9>, Next: datetime and time, Prev: collections<8>, Up: New Improved and Deprecated Modules + +1.12.9.6 threading +.................. + +The *note threading: ed. module has a new *note Barrier: 11d5. +synchronization class for making multiple threads wait until all of them +have reached a common barrier point. Barriers are useful for making +sure that a task with multiple preconditions does not run until all of +the predecessor tasks are complete. + +Barriers can work with an arbitrary number of threads. This is a +generalization of a Rendezvous(1) which is defined for only two threads. + +Implemented as a two-phase cyclic barrier, *note Barrier: 11d5. objects +are suitable for use in loops. The separate 'filling' and 'draining' +phases assure that all threads get released (drained) before any one of +them can loop back and re-enter the barrier. The barrier fully resets +after each cycle. + +Example of using barriers: + + 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() + +In this example, the barrier enforces a rule that votes cannot be +counted at any polling site until all polls are closed. Notice how a +solution with a barrier is similar to one with *note +threading.Thread.join(): 11d6, but the threads stay alive and continue +to do work (summarizing ballots) after the barrier point is crossed. + +If any of the predecessor tasks can hang or be delayed, a barrier can be +created with an optional 'timeout' parameter. Then if the timeout +period elapses before all the predecessor tasks reach the barrier point, +all waiting threads are released and a *note BrokenBarrierError: 11d7. +exception is raised: + + 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) + +In this example, the barrier enforces a more robust rule. If some +election sites do not finish before midnight, the barrier times-out and +the ballots are sealed and deposited in a queue for later handling. + +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 and time, Next: math<10>, Prev: threading<9>, Up: New Improved and Deprecated Modules + +1.12.9.7 datetime and time +.......................... + + * The *note datetime: 30. module has a new type *note timezone: 10b5. + that implements the *note tzinfo: 5da. interface by returning a + fixed UTC offset and timezone name. This makes it easier to create + timezone-aware datetime objects: + + >>> from datetime import datetime, timezone + + >>> datetime.now(timezone.utc) + datetime.datetime(2010, 12, 8, 21, 4, 2, 923754, tzinfo=datetime.timezone.utc) + + >>> datetime.strptime("01/01/2000 12:00 +0000", "%m/%d/%Y %H:%M %z") + datetime.datetime(2000, 1, 1, 12, 0, tzinfo=datetime.timezone.utc) + + * Also, *note timedelta: 9cf. objects can now be multiplied by *note + float: 2f1. and divided by *note float: 2f1. and *note int: 259. + objects. And *note timedelta: 9cf. objects can now divide one + another. + + * The *note datetime.date.strftime(): c91. method is no longer + restricted to years after 1900. The new supported year range is + from 1000 to 9999 inclusive. + + * 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: 1a5. 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(): 11d9. + function will accept any year that fits in a C int, while the *note + time.mktime(): 11da. and *note time.strftime(): 11db. 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<10>, Next: abc<3>, Prev: datetime and time, Up: New Improved and Deprecated Modules + +1.12.9.8 math +............. + +The *note math: 8e. module has been updated with six new functions +inspired by the C99 standard. + +The *note isfinite(): 11dd. function provides a reliable and fast way to +detect special values. It returns ‘True’ for regular numbers and +‘False’ for 'Nan' or 'Infinity': + + >>> from math import isfinite + >>> [isfinite(x) for x in (123, 4.56, float('Nan'), float('Inf'))] + [True, True, False, False] + +The *note expm1(): 11de. function computes ‘e**x-1’ for small values of +'x' without incurring the loss of precision that usually accompanies the +subtraction of nearly equal quantities: + + >>> from math import expm1 + >>> expm1(0.013671875) # more accurate way to compute e**x-1 for a small x + 0.013765762467652909 + +The *note erf(): bd8. function computes a probability integral or +Gaussian error function(1). The complementary error function, *note +erfc(): bd9, is ‘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 + +The *note gamma(): 11df. function is a continuous extension of the +factorial function. See ‘https://en.wikipedia.org/wiki/Gamma_function’ +for details. Because the function is related to factorials, it grows +large even for small values of 'x', so there is also a *note lgamma(): +11e0. function for computing the natural logarithm of the gamma +function: + + >>> 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://en.wikipedia.org/wiki/Error_function + + +File: python.info, Node: abc<3>, Next: io<7>, Prev: math<10>, Up: New Improved and Deprecated Modules + +1.12.9.9 abc +............ + +The *note abc: 4. module now supports *note abstractclassmethod(): 1080. +and *note abstractstaticmethod(): 1081. + +These tools make it possible to define an *note abstract base class: +11a8. that requires a particular *note classmethod(): 166. or *note +staticmethod(): 412. to be implemented: + + 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<7>, Next: reprlib, Prev: abc<3>, Up: New Improved and Deprecated Modules + +1.12.9.10 io +............ + +The *note io.BytesIO: e9d. has a new method, *note getbuffer(): 11e3, +which provides functionality similar to *note memoryview(): 464. It +creates an editable view of the data without making a copy. The +buffer’s random access and support for slice notation are well-suited to +in-place editing: + + >>> REC_LEN, LOC_START, LOC_LEN = 34, 7, 11 + + >>> def change_location(buffer, record_number, location): + ... start = record_number * REC_LEN + LOC_START + ... buffer[start: start+LOC_LEN] = location + + >>> import io + + >>> byte_stream = io.BytesIO( + ... b'G3805 storeroom Main chassis ' + ... b'X7899 shipping Reserve cog ' + ... b'L6988 receiving Primary sprocket' + ... ) + >>> buffer = byte_stream.getbuffer() + >>> change_location(buffer, 1, b'warehouse ') + >>> change_location(buffer, 0, b'showroom ') + >>> print(byte_stream.getvalue()) + b'G3805 showroom Main chassis ' + b'X7899 warehouse Reserve cog ' + b'L6988 receiving Primary sprocket' + +(Contributed by Antoine Pitrou in bpo-5506(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=5506 + + +File: python.info, Node: reprlib, Next: logging<8>, Prev: io<7>, Up: New Improved and Deprecated Modules + +1.12.9.11 reprlib +................. + +When writing a *note __repr__(): 618. 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: 60d. and +*note set: 5d5. handle self-reference by displaying “…” in the recursive +part of the representation string. + +To help write such *note __repr__(): 618. methods, the *note reprlib: +bb. module has a new decorator, *note recursive_repr(): 11e5, for +detecting recursive calls to ‘__repr__()’ and substituting a placeholder +string instead: + + >>> class MyList(list): + ... @recursive_repr() + ... def __repr__(self): + ... return '<' + '|'.join(map(repr, self)) + '>' + ... + >>> m = MyList('abc') + >>> m.append(m) + >>> m.append('x') + >>> print(m) + <'a'|'b'|'c'|...|'x'> + +(Contributed by Raymond Hettinger in bpo-9826(1) and bpo-9840(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9826 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=9840 + + +File: python.info, Node: logging<8>, Next: csv<4>, Prev: reprlib, Up: New Improved and Deprecated Modules + +1.12.9.12 logging +................. + +In addition to dictionary-based configuration described above, the *note +logging: 87. package has many other improvements. + +The logging documentation has been augmented by a *note basic tutorial: +11e7, an *note advanced tutorial: 11e8, and a *note cookbook: 11e9. of +logging recipes. These documents are the fastest way to learn about +logging. + +The *note logging.basicConfig(): 9ff. set-up function gained a 'style' +argument to support three different types of string formatting. It +defaults to “%” for traditional %-formatting, can be set to “{” for the +new *note str.format(): 61d. style, or can be set to “$” for the +shell-style formatting provided by *note string.Template: 683. The +following three configurations are equivalent: + + >>> 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: 11ea. directed +to *note sys.stderr: 939. 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: 11eb. The new default handler +is stored in *note logging.lastResort: 11ec. + +The use of filters has been simplified. Instead of creating a *note +Filter: 11ed. object, the predicate can be any Python callable that +returns ‘True’ or ‘False’. + +There were a number of other improvements that add flexibility and +simplify configuration. See the module documentation for a full listing +of changes in Python 3.2. + + +File: python.info, Node: csv<4>, Next: contextlib<8>, Prev: logging<8>, Up: New Improved and Deprecated Modules + +1.12.9.13 csv +............. + +The *note csv: 29. module now supports a new dialect, *note +unix_dialect: 11ef, which applies quoting for all fields and a +traditional Unix style with ‘'\n'’ as the line terminator. The +registered dialect name is ‘unix’. + +The *note csv.DictWriter: 11f0. has a new method, *note writeheader(): +11f1. for writing-out an initial row to document the field names: + + >>> import csv, sys + >>> w = csv.DictWriter(sys.stdout, ['name', 'dept'], dialect='unix') + >>> w.writeheader() + "name","dept" + >>> w.writerows([ + ... {'name': 'tom', 'dept': 'accounting'}, + ... {'name': 'susan', 'dept': 'Salesl'}]) + "tom","accounting" + "susan","sales" + +(New dialect suggested by Jay Talbot in bpo-5975(1), and the new method +suggested by Ed Abraham in bpo-1537721(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=5975 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=1537721 + + +File: python.info, Node: contextlib<8>, Next: decimal and fractions, Prev: csv<4>, Up: New Improved and Deprecated Modules + +1.12.9.14 contextlib +.................... + +There is a new and slightly mind-blowing tool *note ContextDecorator: +11f3. that is helpful for creating a *note context manager: 5d0. that +does double duty as a function decorator. + +As a convenience, this new functionality is used by *note +contextmanager(): 11f4. so that no extra effort is needed to support +both roles. + +The basic idea is that both context managers and function decorators can +be used for pre-action and post-action wrappers. Context managers wrap +a group of statements using a *note with: 5ce. statement, and function +decorators wrap a group of statements enclosed in a function. So, +occasionally there is a need to write a pre-action or post-action +wrapper that can be used in either role. + +For example, it is sometimes useful to wrap functions or groups of +statements with a logger that can track the time of entry and time of +exit. Rather than writing both a function decorator and a context +manager for the task, the *note contextmanager(): 11f4. provides both +capabilities in a single definition: + + 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) + +Formerly, this would have only been usable as a context manager: + + with track_entry_and_exit('widget loader'): + print('Some time consuming activity goes here') + load_widget() + +Now, it can be used as a decorator as well: + + @track_entry_and_exit('widget loader') + def activity(): + print('Some time consuming activity goes here') + load_widget() + +Trying to fulfill two roles at once places some limitations on the +technique. Context managers normally have the flexibility to return an +argument usable by a *note with: 5ce. statement, but there is no +parallel for function decorators. + +In the above example, there is not a clean way for the +'track_entry_and_exit' context manager to return a logging instance for +use in the body of enclosed statements. + +(Contributed by Michael Foord in bpo-9110(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9110 + + +File: python.info, Node: decimal and fractions, Next: ftp, Prev: contextlib<8>, Up: New Improved and Deprecated Modules + +1.12.9.15 decimal and fractions +............................... + +Mark Dickinson crafted an elegant and efficient scheme for assuring that +different numeric datatypes will have the same hash value whenever their +actual values are equal (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: ff8, 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. + + * The *note decimal.Decimal: 29f. constructor now accepts *note + float: 2f1. objects directly so there in no longer a need to use + the *note from_float(): 11f6. method (bpo-8257(2)). + + * Mixed type comparisons are now fully supported so that *note + Decimal: 29f. objects can be directly compared with *note float: + 2f1. and *note fractions.Fraction: 1e9. (bpo-2531(3) and + bpo-8188(4)). + +Similar changes were made to *note fractions.Fraction: 1e9. so that the +*note from_float(): 11f7. and *note from_decimal(): 11f8. 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: 36. module is that the +*note Context.clamp: 1191. 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 and fractions, Up: New Improved and Deprecated Modules + +1.12.9.16 ftp +............. + +The *note ftplib.FTP: 8f9. class now supports the context management +protocol to unconditionally consume *note socket.error: 104e. exceptions +and to close the FTP connection when done: + + >>> 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 + +Other file-like objects such as *note mmap.mmap: 20d. and *note +fileinput.input(): 7fb. also grew auto-closing context managers: + + 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).) + +The *note FTP_TLS: 8fa. class now accepts a 'context' parameter, which +is a *note ssl.SSLContext: 296. object allowing bundling SSL +configuration options, certificates and private keys into a single +(potentially long-lived) structure. + +(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: New Improved and Deprecated Modules + +1.12.9.17 popen +............... + +The *note os.popen(): a87. and *note subprocess.Popen(): 199. functions +now support *note with: 5ce. statements for auto-closing of the file +descriptors. + +(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 and zipfile, Prev: popen, Up: New Improved and Deprecated Modules + +1.12.9.18 select +................ + +The *note select: c1. module now exposes a new, constant attribute, +*note PIPE_BUF: 11fc, which gives the minimum number of bytes which are +guaranteed not to block when *note select.select(): d9f. 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 and zipfile, Next: tarfile<10>, Prev: select<3>, Up: New Improved and Deprecated Modules + +1.12.9.19 gzip and zipfile +.......................... + +*note gzip.GzipFile: 416. now implements the *note io.BufferedIOBase: +690. *note abstract base class: 11a8. (except for ‘truncate()’). It +also has a *note peek(): 11fe. method and supports unseekable as well as +zero-padded file objects. + +The *note gzip: 67. module also gains the *note compress(): 63a. and +*note decompress(): 11ff. functions for easier in-memory compression and +decompression. Keep in mind that text needs to be encoded as *note +bytes: 1c2. before compressing and decompressing: + + >>> 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: 417. 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: +1200. object for more speedups. It also solves an issue where +interleaved calls to 'read' and 'readline' gave the wrong results. + +(Patch submitted by Nir Aides in bpo-7610(6).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=3488 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=9962 + + (3) https://bugs.python.org/issue?@action=redirect&bpo=1675951 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=7471 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=2846 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=7610 + + +File: python.info, Node: tarfile<10>, Next: hashlib<7>, Prev: gzip and zipfile, Up: New Improved and Deprecated Modules + +1.12.9.20 tarfile +................. + +The *note TarFile: 1202. class can now be used as a context manager. In +addition, its *note add(): bf3. method has a new option, 'filter', that +controls which files are added to the archive and allows the file +metadata to be edited. + +The new 'filter' option replaces the older, less flexible 'exclude' +parameter which is now deprecated. If specified, the optional 'filter' +parameter needs to be a *note keyword argument: d12. The user-supplied +filter function accepts a *note TarInfo: 1203. object and returns an +updated *note TarInfo: 1203. object, or if it wants the file to be +excluded, the function can return ‘None’: + + >>> import tarfile, glob + + >>> def myfilter(tarinfo): + ... if tarinfo.isfile(): # only save real files + ... tarinfo.uname = 'monty' # redact the user name + ... return tarinfo + + >>> with tarfile.open(name='myarchive.tar.gz', mode='w:gz') as tf: + ... for filename in glob.glob('*.txt'): + ... tf.add(filename, filter=myfilter) + ... tf.list() + -rw-r--r-- monty/501 902 2011-01-26 17:59:11 annotations.txt + -rw-r--r-- monty/501 123 2011-01-26 17:59:11 general_questions.txt + -rw-r--r-- monty/501 3514 2011-01-26 17:59:11 prion.txt + -rw-r--r-- monty/501 124 2011-01-26 17:59:11 py_todo.txt + -rw-r--r-- monty/501 1399 2011-01-26 17:59:11 semaphore_notes.txt + +(Proposed by Tarek Ziadé and implemented by Lars Gustäbel in +bpo-6856(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=6856 + + +File: python.info, Node: hashlib<7>, Next: ast<5>, Prev: tarfile<10>, Up: New Improved and Deprecated Modules + +1.12.9.21 hashlib +................. + +The *note hashlib: 68. module has two new constant attributes listing +the hashing algorithms guaranteed to be present in all implementations +and those available on the current implementation: + + >>> 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<5>, Next: os<13>, Prev: hashlib<7>, Up: New Improved and Deprecated Modules + +1.12.9.22 ast +............. + +The *note ast: 8. module has a wonderful a general-purpose tool for +safely evaluating expression strings using the Python literal syntax. +The *note ast.literal_eval(): c18. function serves as a secure +alternative to the builtin *note eval(): 180. function which is easily +abused. Python 3.2 adds *note bytes: 1c2. and *note set: 5d5. literals +to the list of supported types: strings, bytes, numbers, tuples, lists, +dicts, sets, booleans, and ‘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<13>, Next: shutil<8>, Prev: ast<5>, Up: New Improved and Deprecated Modules + +1.12.9.23 os +............ + +Different operating systems use various encodings for filenames and +environment variables. The *note os: a1. module provides two new +functions, *note fsencode(): c55. and *note fsdecode(): c54, for +encoding and decoding filenames: + + >>> 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: 1207. constant +will be true. + +For direct access to encoded environment variables (if available), use +the new *note os.getenvb(): 1208. function or use *note os.environb: +1209. which is a bytes version of *note os.environ: 11ac. + +(Contributed by Victor Stinner.) + + +File: python.info, Node: shutil<8>, Next: sqlite3<11>, Prev: os<13>, Up: New Improved and Deprecated Modules + +1.12.9.24 shutil +................ + +The *note shutil.copytree(): a28. function has two new options: + + * 'ignore_dangling_symlinks': when ‘symlinks=False’ so that the + function copies a file pointed to by a symlink, not the symlink + itself. This option will silence the error raised if the file + doesn’t exist. + + * 'copy_function': is a callable that will be used to copy files. + *note shutil.copy2(): a5a. is used by default. + +(Contributed by Tarek Ziadé.) + +In addition, the *note shutil: c5. module now supports *note archiving +operations: 120b. for zipfiles, uncompressed tarfiles, gzipped tarfiles, +and bzipped tarfiles. And there are functions for registering +additional archiving file formats (such as xz compressed tarfiles or +custom formats). + +The principal functions are *note make_archive(): 4af. and *note +unpack_archive(): 467. By default, both operate on the current +directory (which can be set by *note os.chdir(): 609.) and on any +sub-directories. The archive filename needs to be specified with a full +pathname. The archiving step is non-destructive (the original files are +left unchanged). + + >>> 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<11>, Next: html<3>, Prev: shutil<8>, Up: New Improved and Deprecated Modules + +1.12.9.25 sqlite3 +................. + +The *note sqlite3: cf. module was updated to pysqlite version 2.6.0. It +has two new capabilities. + + * The ‘sqlite3.Connection.in_transit’ attribute is true if there is + an active transaction for uncommitted changes. + + * The *note sqlite3.Connection.enable_load_extension(): 83a. and + *note sqlite3.Connection.load_extension(): 4b4. methods allows you + to load SQLite extensions from “.so” files. One well-known + extension is the fulltext-search extension distributed with 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<11>, Prev: sqlite3<11>, Up: New Improved and Deprecated Modules + +1.12.9.26 html +.............. + +A new *note html: 6b. module was introduced with only a single function, +*note escape(): 1007, which is used for escaping reserved characters +from HTML markup: + + >>> import html + >>> html.escape('x > 2 && x < 7') + 'x > 2 && x < 7' + + +File: python.info, Node: socket<11>, Next: ssl<12>, Prev: html<3>, Up: New Improved and Deprecated Modules + +1.12.9.27 socket +................ + +The *note socket: cc. module has two new improvements. + + * Socket objects now have a *note detach(): 120f. 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(): 66e. now supports the context + management protocol to unconditionally consume *note socket.error: + 104e. exceptions and to close the socket when done. (Contributed + by Giampaolo Rodolà; bpo-9794(2).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8524 + + (2) https://bugs.python.org/issue?@action=redirect&bpo=9794 + + +File: python.info, Node: ssl<12>, Next: nntp, Prev: socket<11>, Up: New Improved and Deprecated Modules + +1.12.9.28 ssl +............. + +The *note ssl: d0. module added a number of features to satisfy common +requirements for secure (encrypted, authenticated) internet connections: + + * A new class, *note SSLContext: 296, serves as a container for + persistent SSL data, such as protocol settings, certificates, + private keys, and various other options. It includes a *note + wrap_socket(): 520. for creating an SSL socket from an SSL context. + + * 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(): 520. constructor function now takes a + 'ciphers' argument. The 'ciphers' string lists the allowed + encryption algorithms using the format described in the OpenSSL + documentation(2). + + * When linked against recent versions of OpenSSL, the *note ssl: d0. + module now supports the Server Name Indication extension to the TLS + protocol, allowing multiple “virtual hosts” using different + certificates on a single IP port. This extension is only supported + in client mode, and is activated by passing the 'server_hostname' + argument to *note ssl.SSLContext.wrap_socket(): 520. + + * Various options have been added to the *note ssl: d0. module, such + as *note OP_NO_SSLv2: 835. which disables the insecure and obsolete + SSLv2 protocol. + + * The extension now loads all the OpenSSL ciphers and digest + algorithms. If some SSL certificates cannot be verified, they are + reported as an “unknown algorithm” error. + + * The version of OpenSSL being used is now accessible using the + module attributes *note ssl.OPENSSL_VERSION: 1211. (a string), + *note ssl.OPENSSL_VERSION_INFO: 1212. (a 5-tuple), and *note + ssl.OPENSSL_VERSION_NUMBER: 1213. (an integer). + +(Contributed by Antoine Pitrou in bpo-8850(3), bpo-1589(4), bpo-8322(5), +bpo-5639(6), bpo-4870(7), bpo-8484(8), and bpo-8321(9).) + + ---------- 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://bugs.python.org/issue?@action=redirect&bpo=8850 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=1589 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=8322 + + (6) https://bugs.python.org/issue?@action=redirect&bpo=5639 + + (7) https://bugs.python.org/issue?@action=redirect&bpo=4870 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=8484 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=8321 + + +File: python.info, Node: nntp, Next: certificates, Prev: ssl<12>, Up: New Improved and Deprecated Modules + +1.12.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<4>, Prev: nntp, Up: New Improved and Deprecated Modules + +1.12.9.30 certificates +...................... + +*note http.client.HTTPSConnection: b41, *note +urllib.request.HTTPSHandler: 1216. and *note urllib.request.urlopen(): +295. now take optional arguments to allow for server certificate +checking against a set of Certificate Authorities, as recommended in +public uses of HTTPS. + +(Added by Antoine Pitrou, bpo-9003(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9003 + + +File: python.info, Node: imaplib<4>, Next: http client<4>, Prev: certificates, Up: New Improved and Deprecated Modules + +1.12.9.31 imaplib +................. + +Support for explicit TLS on standard IMAP4 connections has been added +through the new *note imaplib.IMAP4.starttls: 1218. method. + +(Contributed by Lorenzo M. Catucci and Antoine Pitrou, bpo-4471(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=4471 + + +File: python.info, Node: http client<4>, Next: unittest<11>, Prev: imaplib<4>, Up: New Improved and Deprecated Modules + +1.12.9.32 http.client +..................... + +There were a number of small API improvements in the *note http.client: +6f. module. The old-style HTTP 0.9 simple responses are no longer +supported and the 'strict' parameter is deprecated in all classes. + +The *note HTTPConnection: b40. and *note HTTPSConnection: b41. classes +now have a 'source_address' parameter for a (host, port) tuple +indicating where the HTTP connection is made from. + +Support for certificate checking and HTTPS virtual hosts were added to +*note HTTPSConnection: b41. + +The *note request(): ca9. method on connection objects allowed an +optional 'body' argument so that a *note file object: 11b5. could be +used to supply the content of the request. Conveniently, the 'body' +argument now also accepts an *note iterable: 121a. object so long as it +includes an explicit ‘Content-Length’ header. This extended interface +is much more flexible than before. + +To establish an HTTPS connection through a proxy server, there is a new +*note set_tunnel(): 121b. method that sets the host and port for HTTP +Connect tunneling. + +To match the behavior of *note http.server: 72, the HTTP client library +now also encodes headers with ISO-8859-1 (Latin-1) encoding. It was +already doing that for incoming headers, so now the behavior is +consistent for both incoming and outgoing traffic. (See work by Armin +Ronacher in bpo-10980(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10980 + + +File: python.info, Node: unittest<11>, Next: random<5>, Prev: http client<4>, Up: New Improved and Deprecated Modules + +1.12.9.33 unittest +.................. + +The unittest module has a number of improvements supporting test +discovery for packages, easier experimentation at the interactive +prompt, new testcase methods, improved diagnostic messages for test +failures, and better method names. + + * 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: 449. class can now be instantiated without + arguments: + + >>> from unittest import TestCase + >>> TestCase().assertEqual(pow(2, 3), 8) + + (Contributed by Michael Foord.) + + * The *note unittest: 106. module has two new methods, *note + assertWarns(): 1158. and *note assertWarnsRegex(): 1159. to verify + that a given warning type is triggered by the code under test: + + with self.assertWarns(DeprecationWarning): + legacy_function('XYZ') + + (Contributed by Antoine Pitrou, bpo-9754(2).) + + Another new method, *note assertCountEqual(): 121d. is used to + compare two iterables to determine if their element counts are + equal (whether the same elements are present with the same number + of occurrences regardless of order): + + def test_anagram(self): + self.assertCountEqual('algorithm', 'logarithm') + + (Contributed by Raymond Hettinger.) + + * A principal feature of the unittest module is an effort to produce + meaningful diagnostics when a test fails. When possible, the + failure is recorded along with a diff of the output. This is + especially helpful for analyzing log files of failed test runs. + However, since diffs can sometime be voluminous, there is a new + *note maxDiff: 121e. attribute that sets maximum length of diffs + displayed. + + * In addition, the method names in the module have undergone a number + of clean-ups. + + For example, *note assertRegex(): 529. is the new name for + ‘assertRegexpMatches()’ which was misnamed because the test uses + *note re.search(): 121f, not *note re.match(): 1220. 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: b9. module, and it has unambiguous camel-casing. + + (Contributed by Raymond Hettinger and implemented by Ezio Melotti.) + + * To improve consistency, some long-standing method aliases are being + deprecated in favor of the preferred names: + + Old Name Preferred Name + + ----------------------------------------------------------------------- + + ‘assert_()’ *note assertTrue(): 522. + + + ‘assertEquals()’ *note assertEqual(): 524. + + + ‘assertNotEquals()’ *note assertNotEqual(): 525. + + + ‘assertAlmostEquals()’ *note assertAlmostEqual(): 526. + + + ‘assertNotAlmostEquals()’ *note assertNotAlmostEqual(): 527. + + + 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<11>, Up: New Improved and Deprecated Modules + +1.12.9.34 random +................ + +The integer methods in the *note random: b8. module now do a better job +of producing uniform distributions. Previously, they computed +selections with ‘int(n*random())’ which had a slight bias whenever 'n' +was not a power of two. Now, multiple selections are made from a range +up to the next power of two and a selection is kept only when it falls +within the range ‘0 <= x < n’. The functions and methods affected are +*note randrange(): 868, *note randint(): 1222, *note choice(): 1223, +*note shuffle(): 742. and *note sample(): 741. + +(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: New Improved and Deprecated Modules + +1.12.9.35 poplib +................ + +*note POP3_SSL: 924. class now accepts a 'context' parameter, which is a +*note ssl.SSLContext: 296. object allowing bundling SSL configuration +options, certificates and private keys into a single (potentially +long-lived) structure. + +(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: New Improved and Deprecated Modules + +1.12.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<10>, Prev: asyncore<2>, Up: New Improved and Deprecated Modules + +1.12.9.37 tempfile +.................. + +The *note tempfile: e0. module has a new context manager, *note +TemporaryDirectory: 1227. which provides easy deterministic cleanup of +temporary directories: + + 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<10>, Next: pydoc<6>, Prev: tempfile<5>, Up: New Improved and Deprecated Modules + +1.12.9.38 inspect +................. + + * The *note inspect: 7e. module has a new function *note + getgeneratorstate(): 1229. to easily identify the current state of + a generator-iterator: + + >>> 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).) + + * To support lookups without the possibility of activating a dynamic + attribute, the *note inspect: 7e. module has a new function, *note + getattr_static(): 490. Unlike *note hasattr(): 4ce, this is a true + read-only search, guaranteed not to change state while it is + searching: + + >>> class A: + ... @property + ... def f(self): + ... print('Running') + ... return 10 + ... + >>> a = A() + >>> getattr(a, 'f') + Running + 10 + >>> inspect.getattr_static(a, 'f') + + + (Contributed by Michael Foord.) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=10220 + + +File: python.info, Node: pydoc<6>, Next: dis<5>, Prev: inspect<10>, Up: New Improved and Deprecated Modules + +1.12.9.39 pydoc +............... + +The *note pydoc: b5. 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<5>, Next: dbm<7>, Prev: pydoc<6>, Up: New Improved and Deprecated Modules + +1.12.9.40 dis +............. + +The *note dis: 38. module gained two new functions for inspecting code, +*note code_info(): 122c. and *note show_code(): f27. Both provide +detailed code object information for the supplied function, method, +source code string or code object. The former returns a string and the +latter prints it: + + >>> 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 + +In addition, the *note dis(): b34. function now accepts string arguments +so that the common idiom ‘dis(compile(s, '', 'eval'))’ can be shortened +to ‘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 + +Taken together, these improvements make it easier to explore how CPython +is implemented and to see for yourself what the language syntax does +under-the-hood. + +(Contributed by Nick Coghlan in bpo-9147(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=9147 + + +File: python.info, Node: dbm<7>, Next: ctypes<3>, Prev: dis<5>, Up: New Improved and Deprecated Modules + +1.12.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<3>, Next: site<4>, Prev: dbm<7>, Up: New Improved and Deprecated Modules + +1.12.9.42 ctypes +................ + +A new type, *note ctypes.c_ssize_t: 122f. represents the C ‘ssize_t’ +datatype. + + +File: python.info, Node: site<4>, Next: sysconfig<3>, Prev: ctypes<3>, Up: New Improved and Deprecated Modules + +1.12.9.43 site +.............. + +The *note site: c7. module has three new functions useful for reporting +on the details of a given Python installation. + + * *note getsitepackages(): 1231. lists all global site-packages + directories. + + * *note getuserbase(): 1232. reports on the user’s base directory + where data can be stored. + + * *note getusersitepackages(): 1233. reveals the user-specific + site-packages directory path. + + >>> 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' + +Conveniently, some of site’s functionality is accessible directly from +the command-line: + + $ 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<3>, Next: pdb<8>, Prev: site<4>, Up: New Improved and Deprecated Modules + +1.12.9.44 sysconfig +................... + +The new *note sysconfig: db. module makes it straightforward to discover +installation paths and configuration variables that vary across +platforms and installations. + +The module offers access simple access functions for platform and +version information: + + * *note get_platform(): 1235. returning values like 'linux-i586' or + 'macosx-10.6-ppc'. + + * *note get_python_version(): 1236. returns a Python version string + such as “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(): 1237. makes a dictionary containing installation + paths for the current installation scheme. + + * *note get_config_vars(): 1025. returns a dictionary of platform + specific variables. + +There is also a convenient command-line interface: + + 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<8>, Next: configparser<5>, Prev: sysconfig<3>, Up: New Improved and Deprecated Modules + +1.12.9.45 pdb +............. + +The *note pdb: a5. debugger module gained a number of usability +improvements: + + * ‘pdb.py’ now has a ‘-c’ option that executes commands as given in a + ‘.pdbrc’ script file. + + * A ‘.pdbrc’ script file can contain ‘continue’ and ‘next’ commands + that continue debugging. + + * The *note Pdb: 921. class constructor now accepts a 'nosigint' + argument. + + * New commands: ‘l(list)’, ‘ll(long list)’ and ‘source’ for listing + source code. + + * New commands: ‘display’ and ‘undisplay’ for showing or hiding the + value of an expression if it has changed. + + * New command: ‘interact’ for starting an interactive interpreter + containing the global and local names found in the current scope. + + * Breakpoints can be cleared by breakpoint number. + +(Contributed by Georg Brandl, Antonio Cuni and Ilya Sandler.) + + +File: python.info, Node: configparser<5>, Next: urllib parse<6>, Prev: pdb<8>, Up: New Improved and Deprecated Modules + +1.12.9.46 configparser +...................... + +The *note configparser: 22. 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: 1c8. 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 gained a new API based on the mapping protocol: + + >>> 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)' + +The new API is implemented on top of the classical API, so custom parser +subclasses should be able to use it without modifications. + +The INI file structure accepted by config parsers can now be customized. +Users can specify alternative option/value delimiters and comment +prefixes, change the name of the 'DEFAULT' section or switch the +interpolation syntax. + +There is support for pluggable interpolation including an additional +interpolation handler *note ExtendedInterpolation: 71e.: + + >>> 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' + +A number of smaller features were also introduced, like support for +specifying encoding in read operations, specifying fallback values for +get-functions, or reading directly from dictionaries and strings. + +(All changes contributed by Łukasz Langa.) + + +File: python.info, Node: urllib parse<6>, Next: mailbox, Prev: configparser<5>, Up: New Improved and Deprecated Modules + +1.12.9.47 urllib.parse +...................... + +A number of usability improvements were made for the *note urllib.parse: +10a. module. + +The *note urlparse(): 307. function now supports IPv6(1) addresses as +described in RFC 2732(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='') + +The *note urldefrag(): 123b. function now returns a *note named tuple: +64a.: + + >>> 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' + +And, the *note urlencode(): e8e. function is now much more flexible, +accepting either a string or bytes type for the 'query' argument. If it +is a string, then the 'safe', 'encoding', and 'error' parameters are +sent to *note quote_plus(): 123c. for encoding: + + >>> urllib.parse.urlencode([ + ... ('type', 'telenovela'), + ... ('name', '¿Dónde Está Elisa?')], + ... encoding='latin-1') + 'type=telenovela&name=%BFD%F3nde+Est%E1+Elisa%3F' + +As detailed in *note Parsing ASCII Encoded Bytes: 123d, all the *note +urllib.parse: 10a. functions now accept ASCII-encoded byte strings as +input, so long as they are not mixed with regular strings. If +ASCII-encoded byte strings are given as parameters, the return types +will also be an ASCII-encoded byte strings: + + >>> 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://en.wikipedia.org/wiki/IPv6 + + (2) https://datatracker.ietf.org/doc/html/rfc2732.html + + (3) https://bugs.python.org/issue?@action=redirect&bpo=2987 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=5468 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=9873 + + +File: python.info, Node: mailbox, Next: turtledemo, Prev: urllib parse<6>, Up: New Improved and Deprecated Modules + +1.12.9.48 mailbox +................. + +Thanks to a concerted effort by R. David Murray, the *note mailbox: 8b. +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: 1c2. because various parts of a +message may have different encodings. + +The solution harnessed the *note email: 3b. package’s binary support for +parsing arbitrary email messages. In addition, the solution required a +number of API changes. + +As expected, the *note add(): 123f. method for *note mailbox.Mailbox: +1240. objects now accepts binary input. + +*note StringIO: f22. and text file input are deprecated. Also, string +input will fail early if non-ASCII characters are used. Previously it +would fail when the email was processed in a later step. + +There is also support for binary output. The *note get_file(): 1241. +method now returns a file in the binary mode (where it used to +incorrectly set the file to text-mode). There is also a new *note +get_bytes(): 1242. method that returns a *note bytes: 1c2. +representation of a message corresponding to a given 'key'. + +It is still possible to get non-binary output using the old API’s *note +get_string(): 1243. method, but that approach is not very useful. +Instead, it is best to extract messages from a *note Message: 1244. +object or to load them from binary input. + +(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: New Improved and Deprecated Modules + +1.12.9.49 turtledemo +.................... + +The demonstration code for the *note turtle: 101. 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: 3b0, 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: Multi-threading, Next: Optimizations<11>, Prev: New Improved and Deprecated Modules, Up: What’s New In Python 3 2 + +1.12.10 Multi-threading +----------------------- + + * The mechanism for serializing execution of concurrently running + Python threads (generally known as the *note GIL: 159. 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(): 94a. + It currently defaults to 5 milliseconds. + + Additional details about the implementation can be read from a + python-dev mailing-list message(1) (however, “priority requests” as + exposed in this message have not been kept for inclusion). + + (Contributed by Antoine Pitrou.) + + * Regular and recursive locks now accept an optional 'timeout' + argument to their *note acquire(): 694. method. (Contributed by + Antoine Pitrou; bpo-7316(2).) + + * Similarly, *note threading.Semaphore.acquire(): 1247. also gained a + 'timeout' argument. (Contributed by Torsten Landschoff; + bpo-850728(3).) + + * Regular and recursive lock acquisitions can now be interrupted by + signals on platforms using Pthreads. This means that Python + programs that deadlock while acquiring locks can be successfully + killed by repeatedly sending SIGINT to the process (by pressing + ‘Ctrl’+‘C’ in most shells). (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: Optimizations<11>, Next: Unicode, Prev: Multi-threading, Up: What’s New In Python 3 2 + +1.12.11 Optimizations +--------------------- + +A number of small performance enhancements have been added: + + * 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: 5d5. as a *note frozenset: 5d6. + 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)). + + * Serializing and unserializing data using the *note pickle: a6. + module is now several times faster. + + (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(): bcf. and *note + sorted(): bce. now runs faster and uses less memory when called + with a *note key function: e04. 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).) + + * Recursive locks (created with the *note threading.RLock(): 2e2. + API) now benefit from a C implementation which makes them as fast + as regular locks, and between 10x and 15x faster than their + previous pure Python implementation. + + (Contributed by Antoine Pitrou; bpo-3001(8).) + + * The fast-search algorithm in stringlib is now used by the *note + split(): ea3, *note rsplit(): 1249, *note splitlines(): 124a. and + *note replace(): 19a. methods on *note bytes: 1c2, *note bytearray: + 53a. and *note str: 447. objects. Likewise, the algorithm is also + used by *note rfind(): ea2, *note rindex(): 124b, *note rsplit(): + 1249. and *note rpartition(): 124c. + + (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: 10c1. has more efficient buffering (bpo-3709(14) +by Andrew Schaaf). The *note operator.attrgetter(): e32. function has +been sped-up (bpo-10160(15) by Christos Georgiou). And *note +ConfigParser: 1c8. 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: Optimizations<11>, Up: What’s New In Python 3 2 + +1.12.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: Documentation, Prev: Unicode, Up: What’s New In Python 3 2 + +1.12.13 Codecs +-------------- + +Support was added for 'cp720' Arabic DOS encoding (bpo-1616979(1)). + +MBCS encoding no longer ignores the error handler argument. In the +default strict mode, it raises an *note UnicodeDecodeError: a12. when it +encounters an undecodable byte sequence and an *note UnicodeEncodeError: +673. for an unencodable character. + +The MBCS codec supports ‘'strict'’ and ‘'ignore'’ error handlers for +decoding, and ‘'strict'’ and ‘'replace'’ for encoding. + +To emulate Python3.1 MBCS encoding, select the ‘'ignore'’ handler for +decoding and the ‘'replace'’ handler for encoding. + +On Mac OS X, Python decodes command line arguments with ‘'utf-8'’ rather +than the locale encoding. + +By default, *note tarfile: de. uses ‘'utf-8'’ encoding on Windows +(instead of ‘'mbcs'’) and the ‘'surrogateescape'’ error handler on all +operating systems. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=1616979 + + +File: python.info, Node: Documentation, Next: IDLE, Prev: Codecs, Up: What’s New In Python 3 2 + +1.12.14 Documentation +--------------------- + +The documentation continues to be improved. + + * A table of quick links has been added to the top of lengthy + sections such as *note Built-in Functions: 1250. In the case of + *note itertools: 81, the links are accompanied by tables of + cheatsheet-style summaries to provide an overview and memory jog + without having to read all of the docs. + + * In some cases, the pure Python source code can be a helpful adjunct + to the documentation, so now many modules now feature quick links + to the latest version of the source code. For example, the *note + functools: 5f. module documentation has a quick link at the top + labeled: + + 'Source code' Lib/functools.py(1). + + (Contributed by Raymond Hettinger; see rationale(2).) + + * The docs now contain more examples and recipes. In particular, + *note re: b9. module has an extensive section, *note Regular + Expression Examples: 1251. Likewise, the *note itertools: 81. + module continues to be updated with new *note Itertools Recipes: + 1252. + + * The *note datetime: 30. module now has an auxiliary implementation + in pure Python. No functionality was changed. This just provides + an easier-to-read alternate implementation. + + (Contributed by Alexander Belopolsky in bpo-9528(3).) + + * The unmaintained ‘Demo’ directory has been removed. Some demos + were integrated into the documentation, some were moved to the + ‘Tools/demo’ directory, and others were removed altogether. + + (Contributed by Georg Brandl in bpo-7962(4).) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/functools.py + + (2) +https://rhettinger.wordpress.com/2011/01/28/open-your-source-more/ + + (3) https://bugs.python.org/issue?@action=redirect&bpo=9528 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=7962 + + +File: python.info, Node: IDLE, Next: Code Repository, Prev: Documentation, Up: What’s New In Python 3 2 + +1.12.15 IDLE +------------ + + * The format menu now has an option to clean source files by + stripping trailing whitespace. + + (Contributed by Raymond Hettinger; bpo-5150(1).) + + * IDLE on Mac OS X now works with both Carbon AquaTk and 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: Code Repository, Next: Build and C API Changes<5>, Prev: IDLE, Up: What’s New In Python 3 2 + +1.12.16 Code Repository +----------------------- + +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/’. + +After the 3.2 release, there are plans to switch to Mercurial as the +primary repository. This distributed version control system should make +it easier for members of the community to create and share external +changesets. See PEP 385(2) for details. + +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: Build and C API Changes<5>, Next: Porting to Python 3 2, Prev: Code Repository, Up: What’s New In Python 3 2 + +1.12.17 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * The 'idle', 'pydoc' and '2to3' scripts are now installed with a + version-specific suffix on ‘make altinstall’ (bpo-10679(1)). + + * The C functions that access the Unicode Database now accept and + return characters from the full Unicode range, even on narrow + unicode builds (Py_UNICODE_TOLOWER, Py_UNICODE_ISDECIMAL, and + others). A visible difference in Python is that *note + unicodedata.numeric(): 1256. now returns the correct value for + large code points, and *note repr(): 7f9. may consider more + characters as printable. + + (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).) + + * The option ‘--with-wctype-functions’ was removed. The built-in + unicode database is now used for all functions. + + (Contributed by Amaury Forgeot D’Arc; bpo-9210(4).) + + * Hash values are now values of a new type, *note Py_hash_t: 1257, + which is defined to be the same size as a pointer. Previously they + were of type long, which on some 64-bit operating systems is still + only 32 bits long. As a result of this fix, *note set: 5d5. and + *note dict: 258. can now hold more than ‘2**32’ entries on builds + with 64-bit pointers (previously, they could grow to that size but + their performance degraded catastrophically). + + (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: 1258. without also modifying + *note sys.path: 3b0. (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)). + + * There is a new function *note PyLong_AsLongLongAndOverflow(): 1259. + which is analogous to *note PyLong_AsLongAndOverflow(): 125a. They + both serve to convert Python *note int: 259. into a native + fixed-width type while providing detection of cases where the + conversion won’t fit (bpo-7767(9)). + + * The *note PyUnicode_CompareWithASCIIString(): 125b. function now + returns 'not equal' if the Python string is 'NUL' terminated. + + * There is a new function *note PyErr_NewExceptionWithDoc(): 125c. + that is like *note PyErr_NewException(): 125d. but allows a + docstring to be specified. This lets C exceptions have the same + self-documenting capabilities as their pure Python counterparts + (bpo-7033(10)). + + * When compiled with the ‘--with-valgrind’ option, the pymalloc + allocator will be automatically disabled when running under + Valgrind. This gives improved memory leak detection when running + under Valgrind, while taking advantage of pymalloc at other times + (bpo-2422(11)). + + * Removed the ‘O?’ format from the 'PyArg_Parse' functions. The + format is no longer used and it had never been documented + (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: Porting to Python 3 2, Prev: Build and C API Changes<5>, Up: What’s New In Python 3 2 + +1.12.18 Porting to Python 3.2 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code: + + * The *note configparser: 22. 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: + + * The interpolation syntax is now validated on *note get(): + 125f. and *note set(): 1260. operations. In the default + interpolation scheme, only two tokens with percent signs are + valid: ‘%(name)s’ and ‘%%’, the latter being an escaped + percent sign. + + * The *note set(): 1260. and *note add_section(): 1261. methods + now verify that values are actual strings. Formerly, + unsupported types could be introduced unintentionally. + + * Duplicate sections or options from a single source now raise + either *note DuplicateSectionError: 1262. or *note + DuplicateOptionError: 1263. Formerly, duplicates would + silently overwrite a previous entry. + + * Inline comments are now disabled by default so now the ';' + character can be safely used in values. + + * Comments now can be indented. Consequently, for ';' or '#' to + appear at the start of a line in multiline values, it has to + be interpolated. This keeps comment prefix characters in + values from being mistaken as comments. + + * ‘""’ is now a valid value and is no longer automatically + converted to an empty string. For empty strings, use ‘"option + ="’ in a line. + + * The ‘nntplib’ module was reworked extensively, meaning that its + APIs are often incompatible with the 3.1 APIs. + + * *note bytearray: 53a. objects can no longer be used as filenames; + instead, they should be converted to *note bytes: 1c2. + + * The ‘array.tostring()’ and ‘array.fromstring()’ have been renamed + to *note array.tobytes(): 1264. and *note array.frombytes(): 1265. + for clarity. The old names have been deprecated. (See + bpo-8990(1).) + + * ‘PyArg_Parse*()’ functions: + + * “t#” format has been removed: use “s#” or “s*” instead + + * “w” and “w#” formats has been removed: use “w*” instead + + * The ‘PyCObject’ type, deprecated in 3.1, has been removed. To wrap + opaque C pointers in Python objects, the *note PyCapsule: 1266. 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. + + * The *note random.seed(): 1267. function and method now salt string + seeds with an sha512 hash function. To access the previous version + of 'seed' in order to reproduce Python 3.1 sequences, set the + 'version' argument to '1', ‘random.seed(s, version=1)’. + + * The previously deprecated ‘string.maketrans()’ function has been + removed in favor of the static methods *note bytes.maketrans(): + 1268. and *note bytearray.maketrans(): 1269. This change solves + the confusion around which types were supported by the *note + string: d3. module. Now, *note str: 447, *note bytes: 1c2, and + *note bytearray: 53a. 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: 5ce. 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 '' in line: + outfile.write(line) + + (Contributed by Georg Brandl and Mattias Brändström; appspot issue + 53094(3).) + + * *note struct.pack(): 126a. now only allows bytes for the ‘s’ string + pack code. Formerly, it would accept text arguments and implicitly + encode them to bytes using UTF-8. This was problematic because it + made assumptions about the correct encoding and because a + variable-length encoding can fail when writing to fixed length + segment of a structure. + + Code such as ‘struct.pack('<6sHHBBB', 'GIF87a', x, y)’ should be + rewritten with to use bytes instead of text, + ‘struct.pack('<6sHHBBB', b'GIF87a', x, y)’. + + (Discovered by David Beazley and fixed by Victor Stinner; + bpo-10783(4).) + + * The *note xml.etree.ElementTree: 125. class now raises an *note + xml.etree.ElementTree.ParseError: 126b. when a parse fails. + Previously it raised an *note xml.parsers.expat.ExpatError: 126c. + + * The new, longer *note str(): 447. value on floats may break + doctests which rely on the old output format. + + * In *note subprocess.Popen: 199, the default value for 'close_fds' + is now ‘True’ under Unix; under Windows, it is ‘True’ if the three + standard streams are set to ‘None’, ‘False’ otherwise. Previously, + 'close_fds' was always ‘False’ by default, which produced difficult + to solve bugs or race conditions when open file descriptors would + leak into the child process. + + * Support for legacy HTTP 0.9 has been removed from *note + urllib.request: 10b. and *note http.client: 6f. Such support is + still present on the server side (in *note http.server: 72.). + + (Contributed by Antoine Pitrou, bpo-10711(5).) + + * SSL sockets in timeout mode now raise *note socket.timeout: 830. + when a timeout occurs, rather than a generic *note SSLError: 126d. + + (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(): 3a4. + and *note PyEval_RestoreThread(): 3a5.) 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: 159. implementation, + ‘PyEval_InitThreads()’ cannot be called before *note + Py_Initialize(): 8ab. 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.13 What’s New In Python 3.1 +============================= + + +Author: 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; Ordered Dictionaries: PEP 372 Ordered Dictionaries. +* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator. +* Other Language Changes: Other Language Changes<13>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<2>. +* Optimizations: Optimizations<12>. +* IDLE: IDLE<2>. +* Build and C API Changes: Build and C API Changes<6>. +* Porting to Python 3.1: Porting to Python 3 1. + + +File: python.info, Node: PEP 372 Ordered Dictionaries, Next: PEP 378 Format Specifier for Thousands Separator, Up: What’s New In Python 3 1 + +1.13.1 PEP 372: Ordered Dictionaries +------------------------------------ + +Regular Python dictionaries iterate over key/value pairs in arbitrary +order. Over the years, a number of authors have written alternative +implementations that remember the order that the keys were originally +inserted. Based on the experiences from those implementations, a new +*note collections.OrderedDict: 5d7. class has been introduced. + +The OrderedDict API is substantially the same as regular dictionaries +but will iterate over keys and values in a guaranteed order depending on +when a key was first inserted. If a new entry overwrites an existing +entry, the original insertion position is left unchanged. Deleting an +entry and reinserting it will move it to the end. + +The standard library now supports use of ordered dictionaries in several +modules. The *note configparser: 22. module uses them by default. This +lets configuration files be read, modified, and then written back in +their original order. The '_asdict()' method for *note +collections.namedtuple(): 1ca. now returns an ordered dictionary with +the values appearing in the same order as the underlying tuple indices. +The *note json: 82. module is being built-out with an +'object_pairs_hook' to allow OrderedDicts to be built by the decoder. +Support was also added for third-party tools like PyYAML(1). + +See also +........ + +PEP 372(2) - Ordered Dictionaries + + PEP written by Armin Ronacher and Raymond Hettinger. + Implementation written by Raymond Hettinger. + +Since an ordered dictionary remembers its insertion order, it can be +used in conjunction with sorting to make a sorted dictionary: + + >>> # 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)]) + +The new sorted dictionaries maintain their sort order when entries are +deleted. But when new keys are added, the keys are appended to the end +and the sort is not maintained. + + ---------- Footnotes ---------- + + (1) https://pyyaml.org/ + + (2) https://peps.python.org/pep-0372/ + + +File: python.info, Node: PEP 378 Format Specifier for Thousands Separator, Next: Other Language Changes<13>, Prev: PEP 372 Ordered Dictionaries, Up: What’s New In Python 3 1 + +1.13.2 PEP 378: Format Specifier for Thousands Separator +-------------------------------------------------------- + +The built-in *note format(): 61b. function and the *note str.format(): +61d. method use a mini-language that now includes a simple, non-locale +aware way to format a number with a thousands separator. That provides +a way to humanize a program’s output, improving its professional +appearance and readability: + + >>> 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' + +The supported types are *note int: 259, *note float: 2f1, *note complex: +2f2. and *note decimal.Decimal: 29f. + +Discussions are underway about how to specify alternative separators +like dots, spaces, apostrophes, or underscores. Locale-aware +applications should use the existing 'n' format specifier which already +has some support for thousands separators. + +See also +........ + +PEP 378(1) - Format Specifier for Thousands Separator + + 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: Other Language Changes<13>, Next: New Improved and Deprecated Modules<2>, Prev: PEP 378 Format Specifier for Thousands Separator, Up: What’s New In Python 3 1 + +1.13.3 Other Language Changes +----------------------------- + +Some smaller changes made to the core Python language are: + + * Directories and zip archives containing a ‘__main__.py’ file can + now be executed directly by passing their name to the interpreter. + The directory/zipfile is automatically inserted as the first entry + in sys.path. (Suggestion and initial patch by Andy Chu; revised + patch by Phillip J. Eby and Nick Coghlan; bpo-1739468(1).) + + * The *note int(): 259. type gained a ‘bit_length’ method that + returns the number of bits necessary to represent its argument in + binary: + + >>> 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).) + + * The fields in *note format(): 61b. strings can now be automatically + numbered: + + >>> 'Sir {} of {}'.format('Gallahad', 'Camelot') + 'Sir Gallahad of Camelot' + + Formerly, the string would have required numbered fields such as: + ‘'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(): 1268. and *note + bytearray.maketrans(): 1269. This change solves the confusion + around which types were supported by the *note string: d3. module. + Now, *note str: 447, *note bytes: 1c2, and *note bytearray: 53a. + each have their own 'maketrans' and 'translate' methods with + intermediate translation tables of the appropriate type. + + (Contributed by Georg Brandl; bpo-5675(4).) + + * The syntax of the *note with: 5ce. statement now allows multiple + context managers in a single statement: + + >>> with open('mylog.txt') as infile, open('a.out', 'w') as outfile: + ... for line in infile: + ... if '' in line: + ... outfile.write(line) + + With the new syntax, the ‘contextlib.nested()’ function is no + longer needed and is now deprecated. + + (Contributed by Georg Brandl and Mattias Brändström; appspot issue + 53094(5).) + + * ‘round(x, n)’ now returns an integer if 'x' is an integer. + Previously it returned a float: + + >>> 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). + + The new algorithm for ‘repr(1.1)’ is smarter and returns ‘'1.1'’. + Effectively, it searches all equivalent string representations + (ones that get stored with the same underlying float value) and + returns the shortest representation. + + The new algorithm tends to emit cleaner representations when + possible, but it does not change the underlying values. So, it is + still the case that ‘1.1 + 2.2 != 3.3’ even though the + representations may suggest otherwise. + + 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: New Improved and Deprecated Modules<2>, Next: Optimizations<12>, Prev: Other Language Changes<13>, Up: What’s New In Python 3 1 + +1.13.4 New, Improved, and Deprecated Modules +-------------------------------------------- + + * Added a *note collections.Counter: 108b. class to support + convenient counting of unique items in a sequence or iterable: + + >>> Counter(['red', 'blue', 'red', 'green', 'blue', 'blue']) + Counter({'blue': 3, 'red': 2, 'green': 1}) + + (Contributed by Raymond Hettinger; bpo-1696199(1).) + + * Added a new module, *note tkinter.ttk: f9. for access to the Tk + themed widget set. The basic idea of ttk is to separate, to the + extent possible, the code implementing a widget’s behavior from the + code implementing its appearance. + + (Contributed by Guilherme Polo; bpo-2983(2).) + + * The *note gzip.GzipFile: 416. and *note bz2.BZ2File: 863. classes + now support the context management protocol: + + >>> # Automatically close file after writing + >>> with gzip.GzipFile(filename, "wb") as f: + ... f.write(b"xxx") + + (Contributed by Antoine Pitrou.) + + * The *note decimal: 36. module now supports methods for creating a + decimal object from a binary *note float: 2f1. The conversion is + exact but can sometimes be surprising: + + >>> Decimal.from_float(1.1) + Decimal('1.100000000000000088817841970012523233890533447265625') + + The long decimal result shows the actual binary fraction being + stored for '1.1'. The fraction has many digits because '1.1' + cannot be exactly represented in binary. + + (Contributed by Raymond Hettinger and Mark Dickinson.) + + * The *note itertools: 81. module grew two new functions. The *note + itertools.combinations_with_replacement(): 1274. function is one of + four for generating combinatorics including permutations and + Cartesian products. The *note itertools.compress(): 1275. function + mimics its namesake from APL. Also, the existing *note + itertools.count(): 1276. function now has an optional 'step' + argument and can accept any type of counting sequence including + *note fractions.Fraction: 1e9. and *note decimal.Decimal: 29f.: + + >>> [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(): 1ca. now supports a keyword + argument 'rename' which lets invalid fieldnames be automatically + converted to positional names in the form _0, _1, etc. This is + useful when the field names are being created by an external source + such as a CSV header, SQL field list, or user input: + + >>> 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(3).) + + * The *note re.sub(): 2a5, *note re.subn(): 2a6. and *note + re.split(): 2a4. functions now accept a flags parameter. + + (Contributed by Gregory Smith.) + + * The *note logging: 87. module now implements a simple *note + logging.NullHandler: 1277. class for applications that are not + using logging but are calling library code that does. Setting-up a + null handler will suppress spurious warnings such as “No handlers + could be found for logger foo”: + + >>> h = logging.NullHandler() + >>> logging.getLogger("foo").addHandler(h) + + (Contributed by Vinay Sajip; bpo-4384(4)). + + * The *note runpy: be. module which supports the ‘-m’ command line + switch now supports the execution of packages by looking for and + executing a ‘__main__’ submodule when a package name is supplied. + + (Contributed by Andi Vajda; bpo-4195(5).) + + * The *note pdb: a5. module can now access and display source code + loaded via *note zipimport: 132. (or any other conformant PEP + 302(6) loader). + + (Contributed by Alexander Belopolsky; bpo-4201(7).) + + * *note functools.partial: 410. objects can now be pickled. + + (Suggested by Antoine Pitrou and Jesse Noller. Implemented by Jack + Diederich; bpo-5228(8).) + + * Add *note pydoc: b5. help topics for symbols so that ‘help('@')’ + works as expected in the interactive environment. + + (Contributed by David Laban; bpo-4739(9).) + + * The *note unittest: 106. module now supports skipping individual + tests or classes of tests. And it supports marking a test as an + expected failure, a test that is known to be broken, but shouldn’t + be counted as a failure on a 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): + ... + + Also, tests for exceptions have been builtout to work with context + managers using the *note with: 5ce. statement: + + def test_division_by_zero(self): + with self.assertRaises(ZeroDivisionError): + x / 0 + + In addition, several new assertion methods were added including + *note assertSetEqual(): 1278, *note assertDictEqual(): 1279, + ‘assertDictContainsSubset()’, *note assertListEqual(): 127a, *note + assertTupleEqual(): 127b, *note assertSequenceEqual(): 127c, *note + assertRaisesRegexp(): 52a, *note assertIsNone(): 127d, and *note + assertIsNotNone(): 127e. + + (Contributed by Benjamin Peterson and Antoine Pitrou.) + + * The *note io: 7f. module has three new constants for the *note + seek(): 127f. method: *note SEEK_SET: 1280, *note SEEK_CUR: 1281, + and *note SEEK_END: 1282. + + * The *note sys.version_info: 69c. tuple is now a named tuple: + + >>> sys.version_info + sys.version_info(major=3, minor=1, micro=0, releaselevel='alpha', serial=2) + + (Contributed by Ross Light; bpo-4285(10).) + + * The ‘nntplib’ and *note imaplib: 74. modules now support IPv6. + + (Contributed by Derek Morr; bpo-1655(11) and bpo-1664(12).) + + * The *note pickle: a6. module has been adapted for better + interoperability with Python 2.x when used with protocol 2 or + lower. The reorganization of the standard library changed the + formal reference for many objects. For example, ‘__builtin__.set’ + in Python 2 is called ‘builtins.set’ in Python 3. This change + confounded efforts to share data between different versions of + Python. But now when protocol 2 or lower is selected, the pickler + will automatically use the old Python 2 names for both loading and + dumping. This remapping is turned-on by default but can be + disabled with the 'fix_imports' option: + + >>> 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.' + + An unfortunate but unavoidable side-effect of this change is that + protocol 2 pickles produced by Python 3.1 won’t be readable with + Python 3.0. The latest pickle protocol, protocol 3, should be used + when migrating data between Python 3.x implementations, as it + doesn’t attempt to remain compatible with Python 2.x. + + (Contributed by Alexandre Vassalotti and Antoine Pitrou, + bpo-6137(13).) + + * A new module, *note importlib: 77. was added. It provides a + complete, portable, pure Python reference implementation of the + *note import: 5de. statement and its counterpart, the *note + __import__(): 8d3. function. It represents a substantial step + forward in documenting and defining the actions that take place + during imports. + + (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://bugs.python.org/issue?@action=redirect&bpo=1818 + + (4) https://bugs.python.org/issue?@action=redirect&bpo=4384 + + (5) https://bugs.python.org/issue?@action=redirect&bpo=4195 + + (6) https://peps.python.org/pep-0302/ + + (7) https://bugs.python.org/issue?@action=redirect&bpo=4201 + + (8) https://bugs.python.org/issue?@action=redirect&bpo=5228 + + (9) https://bugs.python.org/issue?@action=redirect&bpo=4739 + + (10) https://bugs.python.org/issue?@action=redirect&bpo=4285 + + (11) https://bugs.python.org/issue?@action=redirect&bpo=1655 + + (12) https://bugs.python.org/issue?@action=redirect&bpo=1664 + + (13) https://bugs.python.org/issue?@action=redirect&bpo=6137 + + +File: python.info, Node: Optimizations<12>, Next: IDLE<2>, Prev: New Improved and Deprecated Modules<2>, Up: What’s New In Python 3 1 + +1.13.5 Optimizations +-------------------- + +Major performance enhancements have been added: + + * 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)). + + * The decoding of UTF-8, UTF-16 and LATIN-1 is now two to four times + faster. + + (Contributed by Antoine Pitrou and Amaury Forgeot d’Arc, + bpo-4868(4).) + + * The *note json: 82. 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: 447, not with *note bytes: 1c2. + 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: Build and C API Changes<6>, Prev: Optimizations<12>, Up: What’s New In Python 3 1 + +1.13.6 IDLE +----------- + + * IDLE’s format menu now provides an option to strip trailing + whitespace from a source file. + + (Contributed by Roger D. Serwy; bpo-5150(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=5150 + + +File: python.info, Node: Build and C API Changes<6>, Next: Porting to Python 3 1, Prev: IDLE<2>, Up: What’s New In Python 3 1 + +1.13.7 Build and C API Changes +------------------------------ + +Changes to Python’s build process and to the C API include: + + * 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 *note sys.int_info: 1286. 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.int_info + sys.int_info(bits_per_digit=30, sizeof_digit=4) + + (Contributed by Mark Dickinson; bpo-4258(1).) + + * The *note PyLong_AsUnsignedLongLong(): 1287. function now handles a + negative 'pylong' by raising *note OverflowError: 87f. instead of + *note TypeError: 534. + + (Contributed by Mark Dickinson and Lisandro Dalcrin; bpo-5175(2).) + + * Deprecated ‘PyNumber_Int()’. Use *note PyNumber_Long(): a67. + instead. + + (Contributed by Mark Dickinson; bpo-4910(3).) + + * Added a new *note PyOS_string_to_double(): 1288. function to + replace the deprecated functions ‘PyOS_ascii_strtod()’ and + ‘PyOS_ascii_atof()’. + + (Contributed by Mark Dickinson; bpo-5914(4).) + + * Added *note PyCapsule: 1266. as a replacement for the ‘PyCObject’ + API. The principal difference is that the new type has a well + defined interface for passing typing safety information and a less + complicated signature for calling a destructor. The old type had a + problematic API and is now deprecated. + + (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: Porting to Python 3 1, Prev: Build and C API Changes<6>, Up: What’s New In Python 3 1 + +1.13.8 Porting to Python 3.1 +---------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code: + + * 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 + ********************************************************************** + + * The automatic name remapping in the pickle module for protocol 2 or + lower can make Python 3.1 pickles unreadable in Python 3.0. One + solution is to use protocol 3. Another solution is to set the + 'fix_imports' option to ‘False’. See the discussion above for more + details. + + +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.14 What’s New In Python 3.0 +============================= + + +Author: Guido van Rossum + +This article explains the new features in Python 3.0, compared to 2.6. +Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever +'intentionally backwards incompatible' Python release. Python 3.0 was +released on December 3, 2008. There are more changes than in a typical +release, and more that are important for all Python users. +Nevertheless, after digesting the changes, you’ll find that Python +really hasn’t changed all that much – by and large, we’re mostly fixing +well-known annoyances and warts, and removing a lot of old cruft. + +This article doesn’t attempt to provide a complete specification of all +new features, but instead tries to give a convenient overview. For full +details, you should refer to the documentation for Python 3.0, and/or +the many PEPs referenced in the text. If you want to understand the +complete implementation and design rationale for a particular feature, +PEPs usually have more details than the regular documentation; but note +that PEPs usually are not kept up-to-date once a feature has been fully +implemented. + +Due to time constraints this document is not as complete as it should +have been. As always for a new release, the ‘Misc/NEWS’ file in the +source distribution contains a wealth of detailed information about +every small thing that was changed. + +* Menu: + +* Common Stumbling Blocks:: +* Overview Of Syntax Changes:: +* Changes Already Present In Python 2.6: Changes Already Present In Python 2 6. +* Library Changes:: +* PEP 3101; A New Approach To String Formatting: PEP 3101 A New Approach To String Formatting. +* Changes To Exceptions:: +* Miscellaneous Other Changes:: +* Build and C API Changes: Build and C API Changes<7>. +* Performance:: +* Porting To Python 3.0: Porting To Python 3 0. + + +File: python.info, Node: Common Stumbling Blocks, Next: Overview Of Syntax Changes, Up: What’s New In Python 3 0 + +1.14.1 Common Stumbling Blocks +------------------------------ + +This section lists those few changes that are most likely to trip you up +if you’re used to Python 2.5. + +* Menu: + +* Print Is A Function:: +* Views And Iterators Instead Of Lists:: +* Ordering Comparisons:: +* Integers:: +* Text Vs. Data Instead Of Unicode Vs. 8-bit: Text Vs Data Instead Of Unicode Vs 8-bit. + + +File: python.info, Node: Print Is A Function, Next: Views And Iterators Instead Of Lists, Up: Common Stumbling Blocks + +1.14.1.1 Print Is A Function +............................ + +The ‘print’ statement has been replaced with a *note print(): f70. +function, with keyword arguments to replace most of the special syntax +of the old ‘print’ statement ( PEP 3105(1)). Examples: + + 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)! + +You can also customize the separator between items, e.g.: + + print("There are <", 2**32, "> possibilities!", sep="") + +which produces: + + There are <4294967296> possibilities! + +Note: + + * The *note print(): f70. function doesn’t support the “softspace” + feature of the old ‘print’ statement. For example, in Python 2.x, + ‘print "A\n", "B"’ would write ‘"A\nB\n"’; but in Python 3.0, + ‘print("A\n", "B")’ writes ‘"A\n B\n"’. + + * Initially, you’ll be finding yourself typing the old ‘print x’ a + lot in interactive mode. Time to retrain your fingers to type + ‘print(x)’ instead! + + * When using the ‘2to3’ source-to-source conversion tool, all ‘print’ + statements are automatically converted to *note print(): f70. + function calls, so this is mostly a non-issue for larger projects. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3105/ + + +File: python.info, Node: Views And Iterators Instead Of Lists, Next: Ordering Comparisons, Prev: Print Is A Function, Up: Common Stumbling Blocks + +1.14.1.2 Views And Iterators Instead Of Lists +............................................. + +Some well-known APIs no longer return lists: + + * *note dict: 258. methods *note dict.keys(): 7c8, *note + dict.items(): 7ca. and *note dict.values(): 7c9. return “views” + instead of lists. For example, this no longer works: ‘k = + d.keys(); k.sort()’. Use ‘k = sorted(d)’ instead (this works in + Python 2.5 too and is just as efficient). + + * Also, the ‘dict.iterkeys()’, ‘dict.iteritems()’ and + ‘dict.itervalues()’ methods are no longer supported. + + * *note map(): 860. and *note filter(): 861. return iterators. If + you really need a list and the input sequences are all of equal + length, a quick fix is to wrap *note map(): 860. in *note list(): + 60d, e.g. ‘list(map(...))’, but a better fix is often to use a + list comprehension (especially when the original code uses *note + lambda: 128f.), or rewriting the code so it doesn’t need a list at + all. Particularly tricky is *note map(): 860. invoked for the side + effects of the function; the correct transformation is to use a + regular *note for: 2ec. loop (since creating a list would just be + wasteful). + + If the input sequences are not of equal length, *note map(): 860. + will stop at the termination of the shortest of the sequences. For + full compatibility with *note map(): 860. from Python 2.x, also + wrap the sequences in *note itertools.zip_longest(): 1290, e.g. + ‘map(func, *sequences)’ becomes ‘list(map(func, + itertools.zip_longest(*sequences)))’. + + * *note range(): 943. now behaves like ‘xrange()’ used to behave, + except it works with values of arbitrary size. The latter no + longer exists. + + * *note zip(): 7cb. now returns an iterator. + + +File: python.info, Node: Ordering Comparisons, Next: Integers, Prev: Views And Iterators Instead Of Lists, Up: Common Stumbling Blocks + +1.14.1.3 Ordering Comparisons +............................. + +Python 3.0 has simplified the rules for ordering comparisons: + + * The ordering comparison operators (‘<’, ‘<=’, ‘>=’, ‘>’) raise a + TypeError exception when the operands don’t have a meaningful + natural ordering. Thus, expressions like ‘1 < ''’, ‘0 > None’ or + ‘len <= len’ are no longer valid, and e.g. ‘None < None’ raises + *note TypeError: 534. instead of returning ‘False’. A corollary is + that sorting a heterogeneous list no longer makes sense – all the + elements must be comparable to each other. Note that this does not + apply to the ‘==’ and ‘!=’ operators: objects of different + incomparable types always compare unequal to each other. + + * *note sorted(): bce. and *note list.sort(): bcf. 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__(): 1292. + for sorting, *note __eq__(): afa. with *note __hash__(): afb, 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: Integers, Next: Text Vs Data Instead Of Unicode Vs 8-bit, Prev: Ordering Comparisons, Up: Common Stumbling Blocks + +1.14.1.4 Integers +................. + + * PEP 237(1): Essentially, ‘long’ renamed to *note int: 259. That + is, there is only one built-in integral type, named *note int: + 259.; 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: 11b7. + 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). + + * The *note repr(): 7f9. of a long integer doesn’t include the + trailing ‘L’ anymore, so code that unconditionally strips that + character will chop off the last digit instead. (Use *note str(): + 447. instead.) + + * Octal literals are no longer of the form ‘0720’; use ‘0o720’ + instead. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0237/ + + (2) https://peps.python.org/pep-0238/ + + +File: python.info, Node: Text Vs Data Instead Of Unicode Vs 8-bit, Prev: Integers, Up: Common Stumbling Blocks + +1.14.1.5 Text Vs. Data Instead Of Unicode Vs. 8-bit +................................................... + +Everything you thought you knew about binary data and Unicode has +changed. + + * Python 3.0 uses the concepts of 'text' and (binary) 'data' instead + of Unicode strings and 8-bit strings. All text is Unicode; however + 'encoded' Unicode is represented as binary data. The type used to + hold text is *note str: 447, the type used to hold data is *note + bytes: 1c2. The biggest difference with the 2.x situation is that + any attempt to mix text and data in Python 3.0 raises *note + TypeError: 534, whereas if you were to mix Unicode and 8-bit + strings in Python 2.x, it would work if the 8-bit string happened + to contain only 7-bit (ASCII) bytes, but you would get *note + UnicodeDecodeError: a12. if it contained non-ASCII values. This + value-specific behavior has caused numerous sad faces over the + years. + + * 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: 447. for binary or encoded data + only. Then the ‘2to3’ tool will do most of the work for you. + + * You can no longer use ‘u"..."’ literals for Unicode text. However, + you must use ‘b"..."’ literals for binary data. + + * As the *note str: 447. and *note bytes: 1c2. types cannot be mixed, + you must always explicitly convert between them. Use *note + str.encode(): 8d4. to go from *note str: 447. to *note bytes: 1c2, + and *note bytes.decode(): 8d5. to go from *note bytes: 1c2. to + *note str: 447. You can also use ‘bytes(s, encoding=...)’ and + ‘str(b, encoding=...)’, respectively. + + * Like *note str: 447, the *note bytes: 1c2. type is immutable. + There is a separate 'mutable' type to hold buffered binary data, + *note bytearray: 53a. Nearly all APIs that accept *note bytes: + 1c2. also accept *note bytearray: 53a. The mutable API is based on + *note collections.MutableSequence: 1a1. + + * All backslashes in raw string literals are interpreted literally. + This means that ‘'\U'’ and ‘'\u'’ escapes in raw strings are not + treated specially. For example, ‘r'\u20ac'’ is a string of 6 + characters in Python 3.0, whereas in 2.6, ‘ur'\u20ac'’ was the + single “euro” character. (Of course, this change only affects raw + string literals; the euro character is ‘'\u20ac'’ in Python 3.0.) + + * The built-in ‘basestring’ abstract type was removed. Use *note + str: 447. instead. The *note str: 447. and *note bytes: 1c2. types + don’t have functionality enough in common to warrant a shared base + class. The ‘2to3’ tool (see below) replaces every occurrence of + ‘basestring’ with *note str: 447. + + * Files opened as text files (still the default mode for *note + open(): 517.) always use an encoding to map between strings (in + memory) and bytes (on disk). Binary files (opened with a ‘b’ in + the mode argument) always use bytes in memory. This means that if + a file is opened using an incorrect mode or encoding, I/O will + likely fail loudly, instead of silently producing incorrect data. + It also means that even Unix users will have to specify the correct + mode (text or binary) when opening a file. There is a + platform-dependent default encoding, which on Unixy platforms can + be set with the ‘LANG’ environment variable (and sometimes also + with some other platform-specific locale-related environment + variables). In many cases, but not all, the system default is + UTF-8; you should never count on this default. Any application + reading or writing more than pure ASCII text should probably have a + way to override the encoding. There is no longer any need for + using the encoding-aware streams in the *note codecs: 1b. module. + + * The initial values of *note sys.stdin: 539, *note sys.stdout: ad6. + and *note sys.stderr: 939. are now unicode-only text files (i.e., + they are instances of *note io.TextIOBase: 691.). To read and + write bytes data with these streams, you need to use their *note + io.TextIOBase.buffer: 1295. attribute. + + * Filenames are passed to and returned from APIs as (Unicode) + strings. This can present platform-specific problems because on + some platforms filenames are arbitrary byte strings. (On the other + hand, on Windows filenames are natively stored as Unicode.) As a + work-around, most APIs (e.g. *note open(): 517. and many functions + in the *note os: a1. module) that take filenames accept *note + bytes: 1c2. objects as well as strings, and a few APIs have a way + to ask for a *note bytes: 1c2. return value. Thus, *note + os.listdir(): 10ee. returns a list of *note bytes: 1c2. instances + if the argument is a *note bytes: 1c2. instance, and *note + os.getcwdb(): a91. returns the current working directory as a *note + bytes: 1c2. instance. Note that when *note os.listdir(): 10ee. + returns a list of strings, filenames that cannot be decoded + properly are omitted rather than raising *note UnicodeError: 1296. + + * Some system APIs like *note os.environ: 11ac. and *note sys.argv: + 1258. can also present problems when the bytes made available by + the system is not interpretable using the default encoding. + Setting the ‘LANG’ variable and rerunning the program is probably + the best approach. + + * PEP 3138(1): The *note repr(): 7f9. of a string no longer escapes + non-ASCII characters. It still escapes control characters and code + points with non-printable status in the Unicode standard, however. + + * PEP 3120(2): The default source encoding is now UTF-8. + + * PEP 3131(3): Non-ASCII letters are now allowed in identifiers. + (However, the standard library remains ASCII-only with the + exception of contributor names in comments.) + + * The ‘StringIO’ and ‘cStringIO’ modules are gone. Instead, import + the *note io: 7f. module and use *note io.StringIO: f22. or *note + io.BytesIO: e9d. for text and data respectively. + + * See also the *note Unicode HOWTO: 1297, which was updated for + 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: Overview Of Syntax Changes, Next: Changes Already Present In Python 2 6, Prev: Common Stumbling Blocks, Up: What’s New In Python 3 0 + +1.14.2 Overview Of Syntax Changes +--------------------------------- + +This section gives a brief overview of every 'syntactic' change in +Python 3.0. + +* Menu: + +* New Syntax:: +* Changed Syntax:: +* Removed Syntax:: + + +File: python.info, Node: New Syntax, Next: Changed Syntax, Up: Overview Of Syntax Changes + +1.14.2.1 New Syntax +................... + + * 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 ‘__annotations__’ attribute. The intent is to encourage + experimentation through metaclasses, decorators or frameworks. + + * PEP 3102(2): Keyword-only arguments. Named parameters occurring + after ‘*args’ in the parameter list 'must' be specified using + keyword syntax in the call. You can also use a bare ‘*’ in the + parameter list to indicate that you don’t accept a variable-length + argument list, but you do have keyword-only arguments. + + * Keyword arguments are allowed after the list of base classes in a + class definition. This is used by the new convention for + specifying a metaclass (see next section), but can be used for + other purposes as well, as long as the metaclass supports it. + + * PEP 3104(3): *note nonlocal: 129a. statement. Using ‘nonlocal x’ + you can now assign directly to a variable in an outer (but + non-global) scope. ‘nonlocal’ is a new reserved word. + + * PEP 3132(4): Extended Iterable Unpacking. You can now write things + like ‘a, b, *rest = some_sequence’. And even ‘*rest, a = stuff’. + The ‘rest’ object is always a (possibly empty) list; the right-hand + side may be any iterable. Example: + + (a, *rest, b) = range(5) + + This sets 'a' to ‘0’, 'b' to ‘4’, and 'rest' to ‘[1, 2, 3]’. + + * Dictionary comprehensions: ‘{k: v for k, v in stuff}’ means the + same thing as ‘dict(stuff)’ but is more flexible. (This is PEP + 274(5) vindicated. :-) + + * Set literals, e.g. ‘{1, 2}’. Note that ‘{}’ is an empty + dictionary; use ‘set()’ for an empty set. Set comprehensions are + also supported; e.g., ‘{x for x in stuff}’ means the same thing as + ‘set(stuff)’ but is more flexible. + + * New octal literals, e.g. ‘0o720’ (already in 2.6). The old octal + literals (‘0720’) are gone. + + * New binary literals, e.g. ‘0b1010’ (already in 2.6), and there is + a new corresponding built-in function, *note bin(): 129b. + + * Bytes literals are introduced with a leading ‘b’ or ‘B’, and there + is a new corresponding built-in function, *note bytes(): 1c2. + + ---------- 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: Changed Syntax, Next: Removed Syntax, Prev: New Syntax, Up: Overview Of Syntax Changes + +1.14.2.2 Changed Syntax +....................... + + * PEP 3109(1) and PEP 3134(2): new *note raise: 5e9. statement + syntax: ‘raise [EXPR [from EXPR]]’. See below. + + * ‘as’ and *note with: 5ce. are now reserved words. (Since 2.6, + actually.) + + * ‘True’, ‘False’, and ‘None’ are reserved words. (2.6 partially + enforced the restrictions on ‘None’ already.) + + * Change from *note except: 18b. 'exc', 'var' to ‘except’ 'exc' ‘as’ + 'var'. See PEP 3110(3). + + * PEP 3115(4): New Metaclass Syntax. Instead of: + + class C: + __metaclass__ = M + ... + + you must now use: + + 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: a8c.) + + * List comprehensions no longer support the syntactic form ‘[... for + VAR in ITEM1, ITEM2, ...]’. Use ‘[... for VAR in (ITEM1, ITEM2, + ...)]’ instead. Also note that list comprehensions have different + semantics: they are closer to syntactic sugar for a generator + expression inside a *note list(): 60d. constructor, and in + particular the loop control variables are no longer leaked into the + surrounding scope. + + * The 'ellipsis' (‘...’) can be used as an atomic expression + anywhere. (Previously it was only allowed in slices.) Also, it + 'must' now be spelled as ‘...’. (Previously it could also be + spelled as ‘. . .’, by a mere accident of the grammar.) + + ---------- 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: Removed Syntax, Prev: Changed Syntax, Up: Overview Of Syntax Changes + +1.14.2.3 Removed Syntax +....................... + + * PEP 3113(1): Tuple parameter unpacking removed. You can no longer + write ‘def foo(a, (b, c)): ...’. Use ‘def foo(a, b_c): b, c = b_c’ + instead. + + * Removed backticks (use *note repr(): 7f9. instead). + + * Removed ‘<>’ (use ‘!=’ instead). + + * Removed keyword: *note exec(): 17f. is no longer a keyword; it + remains as a function. (Fortunately the function syntax was also + accepted in 2.x.) Also note that *note exec(): 17f. no longer + takes a stream argument; instead of ‘exec(f)’ you can use + ‘exec(f.read())’. + + * Integer literals no longer support a trailing ‘l’ or ‘L’. + + * String literals no longer support a leading ‘u’ or ‘U’. + + * The *note from: 129e. 'module' *note import: 5de. ‘*’ syntax is + only allowed at the module level, no longer inside functions. + + * The only acceptable syntax for relative imports is ‘from .[MODULE] + import NAME’. All *note import: 5de. forms not starting with ‘.’ + are interpreted as absolute imports. ( PEP 328(2)) + + * Classic classes are gone. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3113/ + + (2) https://peps.python.org/pep-0328/ + + +File: python.info, Node: Changes Already Present In Python 2 6, Next: Library Changes, Prev: Overview Of Syntax Changes, Up: What’s New In Python 3 0 + +1.14.3 Changes Already Present In Python 2.6 +-------------------------------------------- + +Since many users presumably make the jump straight from Python 2.5 to +Python 3.0, this section reminds the reader of new features that were +originally designed for Python 3.0 but that were back-ported to Python +2.6. The corresponding sections in *note What’s New in Python 2.6: +12a0. should be consulted for longer descriptions. + + * *note PEP 343; The ‘with’ statement: 12a1. The *note with: 5ce. + statement is now a standard feature and no longer needs to be + imported from the *note __future__: 0. Also check out *note + Writing Context Managers: 12a2. and *note The contextlib module: + 12a3. + + * *note PEP 366; Explicit Relative Imports From a Main Module: 12a4. + This enhances the usefulness of the *note -m: 5dd. option when the + referenced module lives in a package. + + * *note PEP 370; Per-user site-packages Directory: 12a5. + + * *note PEP 371; The multiprocessing Package: 12a6. + + * *note PEP 3101; Advanced String Formatting: 12a7. Note: the 2.6 + description mentions the *note format(): 61b. method for both 8-bit + and Unicode strings. In 3.0, only the *note str: 447. type (text + strings with Unicode support) supports this method; the *note + bytes: 1c2. type does not. The plan is to eventually make this the + only API for string formatting, and to start deprecating the ‘%’ + operator in Python 3.1. + + * *note PEP 3105; print As a Function: 12a8. This is now a standard + feature and no longer needs to be imported from *note __future__: + 0. More details were given above. + + * *note PEP 3110; Exception-Handling Changes: 12a9. The *note + except: 18b. '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; Byte Literals: 12aa. The ‘b"..."’ string literal + notation (and its variants like ‘b'...'’, ‘b"""..."""’, and + ‘br"..."’) now produces a literal of type *note bytes: 1c2. + + * *note PEP 3116; New I/O Library: 12ab. The *note io: 7f. module is + now the standard way of doing file I/O. The built-in *note open(): + 517. function is now an alias for *note io.open(): 518. and has + additional keyword arguments 'encoding', 'errors', 'newline' and + 'closefd'. Also note that an invalid 'mode' argument now raises + *note ValueError: 204, not *note IOError: 104b. 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; Revised Buffer Protocol: 12ac. The old builtin + ‘buffer()’ is now really gone; the new builtin *note memoryview(): + 464. provides (mostly) similar functionality. + + * *note PEP 3119; Abstract Base Classes: 12ad. The *note abc: 4. + module and the ABCs defined in the *note collections: 1d. module + plays a somewhat more prominent role in the language now, and + built-in collection types like *note dict: 258. and *note list: + 60d. conform to the *note collections.MutableMapping: 10a2. and + *note collections.MutableSequence: 1a1. ABCs, respectively. + + * *note PEP 3127; Integer Literal Support and Syntax: 12ae. As + mentioned above, the new octal literal notation is the only one + supported, and binary literals have been added. + + * *note PEP 3129; Class Decorators: 12af. + + * *note PEP 3141; A Type Hierarchy for Numbers: 12b0. The *note + numbers: 9e. module is another new use of ABCs, defining Python’s + “numeric tower”. Also note the new *note fractions: 5d. module + which implements *note numbers.Rational: 12b1. + + +File: python.info, Node: Library Changes, Next: PEP 3101 A New Approach To String Formatting, Prev: Changes Already Present In Python 2 6, Up: What’s New In Python 3 0 + +1.14.4 Library Changes +---------------------- + +Due to time constraints, this document does not exhaustively cover the +very extensive changes to the standard library. PEP 3108(1) is the +reference for the major changes to the library. Here’s a capsule +review: + + * Many old modules were removed. Some, like ‘gopherlib’ (no longer + used) and ‘md5’ (replaced by *note hashlib: 68.), were already + deprecated by PEP 4(2). Others were removed as a result of the + removal of support for various platforms such as Irix, BeOS and Mac + OS 9 (see PEP 11(3)). Some modules were also selected for removal + in Python 3.0 due to lack of use or because a better replacement + exists. See PEP 3108(4) for an exhaustive list. + + * 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’. + + * Some modules were renamed because their old name disobeyed PEP + 8(5), or for various other reasons. Here’s the list: + + Old Name New Name + + -------------------------------------------------------- + + _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: a6. and + ‘cPickle’. This places the burden of importing the accelerated + version and falling back on the pure Python version on each user of + these modules. In Python 3.0, the accelerated versions are + considered implementation details of the pure Python versions. + Users should always import the standard version, which attempts to + import the accelerated version and falls back to the pure Python + version. The *note pickle: a6. / ‘cPickle’ pair received this + treatment. The *note profile: af. module is on the list for 3.1. + The ‘StringIO’ module has been turned into a class in the *note io: + 7f. module. + + * Some related modules have been grouped into packages, and usually + the submodule names have been simplified. The resulting new + packages are: + + * *note dbm: 31. (‘anydbm’, ‘dbhash’, ‘dbm’, ‘dumbdbm’, ‘gdbm’, + ‘whichdb’). + + * *note html: 6b. (‘HTMLParser’, ‘htmlentitydefs’). + + * *note http: 6e. (‘httplib’, ‘BaseHTTPServer’, ‘CGIHTTPServer’, + ‘SimpleHTTPServer’, ‘Cookie’, ‘cookielib’). + + * *note tkinter: f0. (all ‘Tkinter’-related modules except *note + turtle: 101.). The target audience of *note turtle: 101. + doesn’t really care about *note tkinter: f0. Also note that + as of Python 2.6, the functionality of *note turtle: 101. has + been greatly enhanced. + + * *note urllib: 108. (‘urllib’, ‘urllib2’, ‘urlparse’, + ‘robotparse’). + + * *note xmlrpc: 12d. (‘xmlrpclib’, ‘DocXMLRPCServer’, + ‘SimpleXMLRPCServer’). + +Some other changes to standard library modules, not covered by PEP +3108(6): + + * Killed ‘sets’. Use the built-in *note set(): 5d5. class. + + * Cleanup of the *note sys: d9. module: removed ‘sys.exitfunc()’, + ‘sys.exc_clear()’, ‘sys.exc_type’, ‘sys.exc_value’, + ‘sys.exc_traceback’. (Note that *note sys.last_type: 4bb. etc. + remain.) + + * Cleanup of the *note array.array: 1a0. type: the ‘read()’ and + ‘write()’ methods are gone; use *note fromfile(): 12b3. and *note + tofile(): 12b4. instead. Also, the ‘'c'’ typecode for array is + gone – use either ‘'b'’ for bytes or ‘'u'’ for Unicode characters. + + * Cleanup of the *note operator: 9f. module: removed + ‘sequenceIncludes()’ and ‘isCallable()’. + + * Cleanup of the ‘thread’ module: ‘acquire_lock()’ and + ‘release_lock()’ are gone; use *note acquire(): 694. and *note + release(): 12b5. instead. + + * Cleanup of the *note random: b8. 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: e0. module. + + * The *note tokenize: fb. module has been changed to work with bytes. + The main entry point is now *note tokenize.tokenize(): 4d5, instead + of generate_tokens. + + * ‘string.letters’ and its friends (‘string.lowercase’ and + ‘string.uppercase’) are gone. Use *note string.ascii_letters: + 12b6. 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: 12. (removing the + underscores, adding an ‘s’). The ‘__builtins__’ variable found in + most global namespaces is unchanged. To modify a builtin, you + should use *note builtins: 12, 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 A New Approach To String Formatting, Next: Changes To Exceptions, Prev: Library Changes, Up: What’s New In Python 3 0 + +'PEP 3101': A New Approach To String Formatting + + * A new system for built-in string formatting operations replaces the + ‘%’ string formatting operator. (However, the ‘%’ operator is + still supported; it will be deprecated in Python 3.1 and removed + from the language at some later time.) Read PEP 3101(1) for the + full scoop. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3101/ + + +File: python.info, Node: Changes To Exceptions, Next: Miscellaneous Other Changes, Prev: PEP 3101 A New Approach To String Formatting, Up: What’s New In Python 3 0 + +1.14.6 Changes To Exceptions +---------------------------- + +The APIs for raising and catching exception have been cleaned up and new +powerful features added: + + * PEP 352(1): All exceptions must be derived (directly or indirectly) + from *note BaseException: 5b7. This is the root of the exception + hierarchy. This is not new as a recommendation, but the + 'requirement' to inherit from *note BaseException: 5b7. is new. + (Python 2.6 still allowed classic classes to be raised, and placed + no restriction on what you can catch.) As a consequence, string + exceptions are finally truly and utterly dead. + + * Almost all exceptions should actually derive from *note Exception: + 9d9.; *note BaseException: 5b7. should only be used as a base class + for exceptions that should only be handled at the top level, such + as *note SystemExit: d40. or *note KeyboardInterrupt: 9d1. The + recommended idiom for handling all exceptions except for this + latter category is to use *note except: 18b. *note Exception: 9d9. + + * ‘StandardError’ was removed. + + * Exceptions no longer behave as sequences. Use the *note args: 569. + 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__: 12b9. attribute (see below). + + * PEP 3110(3): Catching exceptions. You must now use ‘except + SOMEEXCEPTION as VARIABLE’ instead of ‘except SOMEEXCEPTION, + VARIABLE’. Moreover, the 'variable' is explicitly deleted when the + *note except: 18b. block is left. + + * 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: 18b. or *note finally: 9ca. + 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__: 12ba. 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__: 12bb. attribute of the secondary exception. The + traceback printed when an unhandled exception occurs walks the + chain of ‘__cause__’ and *note __context__: 12ba. 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__: 12b9. 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(): 686. + (though the latter is not removed). + + * A few exception messages are improved when Windows fails to load an + extension module. For example, ‘error code 193’ is now ‘%1 is not + a valid Win32 application’. Strings now deal with non-English + locales. + + ---------- 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: Miscellaneous Other Changes, Next: Build and C API Changes<7>, Prev: Changes To Exceptions, Up: What’s New In Python 3 0 + +1.14.7 Miscellaneous Other Changes +---------------------------------- + +* Menu: + +* Operators And Special Methods:: +* Builtins:: + + +File: python.info, Node: Operators And Special Methods, Next: Builtins, Up: Miscellaneous Other Changes + +1.14.7.1 Operators And Special Methods +...................................... + + * ‘!=’ now returns the opposite of ‘==’, unless ‘==’ returns *note + NotImplemented: 7cd. + + * The concept of “unbound methods” has been removed from the + language. When referencing a method as a class attribute, you now + get a plain function object. + + * ‘__getslice__()’, ‘__setslice__()’ and ‘__delslice__()’ were + killed. The syntax ‘a[i:j]’ now translates to + ‘a.__getitem__(slice(i, j))’ (or *note __setitem__(): 12be. or + *note __delitem__(): 12bf, when used as an assignment or deletion + target, respectively). + + * PEP 3114(1): the standard *note next(): 7d3. method has been + renamed to *note __next__(): 12c0. + + * The ‘__oct__()’ and ‘__hex__()’ special methods are removed – *note + oct(): 12c1. and *note hex(): 12c2. use *note __index__(): 718. 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__: + 12c3, *note __code__: 29c, *note __defaults__: 12c4, *note + __dict__: 12c5, *note __doc__: 11cb, *note __globals__: 12c6, *note + __name__: 12c7, respectively. + + * ‘__nonzero__()’ is now *note __bool__(): 12c8. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3114/ + + +File: python.info, Node: Builtins, Prev: Operators And Special Methods, Up: Miscellaneous Other Changes + +1.14.7.2 Builtins +................. + + * PEP 3135(1): New *note super(): 4d7. You can now invoke *note + super(): 4d7. without arguments and (assuming this is in a regular + instance method defined inside a *note class: 12ca. statement) the + right class and instance will automatically be chosen. With + arguments, the behavior of *note super(): 4d7. is unchanged. + + * PEP 3111(2): ‘raw_input()’ was renamed to *note input(): 12cb. + That is, the new *note input(): 12cb. function reads a line from + *note sys.stdin: 539. and returns it with the trailing newline + stripped. It raises *note EOFError: 12cc. if the input is + terminated prematurely. To get the old behavior of *note input(): + 12cb, use ‘eval(input())’. + + * A new built-in function *note next(): 7d3. was added to call the + *note __next__(): 12c0. method on an object. + + * The *note round(): 12cd. function rounding strategy and return type + have changed. Exact halfway cases are now rounded to the nearest + even result instead of away from zero. (For example, ‘round(2.5)’ + now returns ‘2’ rather than ‘3’.) ‘round(x[, n])’ now delegates to + ‘x.__round__([n])’ instead of always returning a float. It + generally returns an integer when called with a single argument and + a value of the same type as ‘x’ when called with two arguments. + + * Moved ‘intern()’ to *note sys.intern(): 12ce. + + * Removed: ‘apply()’. Instead of ‘apply(f, args)’ use ‘f(*args)’. + + * Removed *note callable(): 11b8. 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(): 517. There are now + several different kinds of streams that open can return in the + *note io: 7f. module. + + * Removed ‘reduce()’. Use *note functools.reduce(): 12cf. if you + really need it; however, 99 percent of the time an explicit *note + for: 2ec. loop is more readable. + + * Removed ‘reload()’. Use ‘imp.reload()’. + + * Removed. ‘dict.has_key()’ – use the *note in: 2ee. operator + instead. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3135/ + + (2) https://peps.python.org/pep-3111/ + + +File: python.info, Node: Build and C API Changes<7>, Next: Performance, Prev: Miscellaneous Other Changes, Up: What’s New In Python 3 0 + +1.14.8 Build and C API Changes +------------------------------ + +Due to time constraints, here is a 'very' incomplete list of changes to +the C API. + + * Support for several platforms was dropped, including but not + limited to Mac OS 9, BeOS, RISCOS, Irix, and Tru64. + + * PEP 3118(1): New Buffer API. + + * PEP 3121(2): Extension Module Initialization & Finalization. + + * PEP 3123(3): Making *note PyObject_HEAD: 12d1. conform to standard + C. + + * No more C API support for restricted execution. + + * ‘PyNumber_Coerce()’, ‘PyNumber_CoerceEx()’, ‘PyMember_Get()’, and + ‘PyMember_Set()’ C APIs are removed. + + * New C API *note PyImport_ImportModuleNoBlock(): 3b9, works like + *note PyImport_ImportModule(): 3ba. but won’t block on the import + lock (returning an error instead). + + * Renamed the boolean conversion C-level slot and method: + ‘nb_nonzero’ is now ‘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: Performance, Next: Porting To Python 3 0, Prev: Build and C API Changes<7>, Up: What’s New In Python 3 0 + +1.14.9 Performance +------------------ + +The net result of the 3.0 generalizations is that Python 3.0 runs the +pystone benchmark around 10% slower than Python 2.5. Most likely the +biggest cause is the removal of special-casing for small integers. +There’s room for improvement, but it will happen after 3.0 is released! + + +File: python.info, Node: Porting To Python 3 0, Prev: Performance, Up: What’s New In Python 3 0 + +1.14.10 Porting To Python 3.0 +----------------------------- + +For porting existing Python 2.5 or 2.6 source code to Python 3.0, the +best strategy is the following: + + 0. (Prerequisite:) Start with excellent test coverage. + + 1. Port to Python 2.6. This should be no more work than the average + port from Python 2.x to Python 2.(x+1). Make sure all your tests + pass. + + 2. (Still using 2.6:) Turn on the ‘-3’ command line switch. This + enables warnings about features that will be removed (or change) in + 3.0. Run your test suite again, and fix code that you get warnings + about until there are no warnings left, and all your tests still + pass. + + 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. + +It is not recommended to try to write source code that runs unchanged +under both Python 2.6 and 3.0; you’d have to use a very contorted coding +style, e.g. avoiding ‘print’ statements, metaclasses, and much more. +If you are maintaining a library that needs to support both Python 2.6 +and Python 3.0, the best approach is to modify step 3 above by editing +the 2.6 version of the source code and running the ‘2to3’ translator +again, rather than editing the 3.0 version of the source code. + +For porting C extensions to Python 3.0, please see *note Porting +Extension Modules to Python 3: 12d4. + + +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.15 What’s New in Python 2.7 +============================= + + +Author: A.M. Kuchling (amk at amk.ca) + +This article explains the new features in Python 2.7. Python 2.7 was +released on July 3, 2010. + +Numeric handling has been improved in many ways, for both floating-point +numbers and for the *note Decimal: 29f. class. There are some useful +additions to the standard library, such as a greatly enhanced *note +unittest: 106. module, the *note argparse: 6. module for parsing +command-line options, convenient *note OrderedDict: 5d7. and *note +Counter: 108b. classes in the *note collections: 1d. module, and many +other improvements. + +Python 2.7 is planned to be the last of the 2.x releases, so we worked +on making it a good release for the long term. To help with porting to +Python 3, several new features from the Python 3.x series have been +included in 2.7. + +This article doesn’t attempt to provide a complete specification of the +new features, but instead provides a convenient overview. For full +details, you should refer to the documentation for Python 2.7 at +‘https://docs.python.org’. If you want to understand the rationale for +the design and implementation, refer to the PEP for a particular new +feature or the issue on ‘https://bugs.python.org’ in which a change was +discussed. Whenever possible, “What’s New in Python” links to the +bug/patch item for each change. + +* Menu: + +* The Future for Python 2.x: The Future for Python 2 x. +* Changes to the Handling of Deprecation Warnings:: +* Python 3.1 Features: Python 3 1 Features. +* PEP 372; Adding an Ordered Dictionary to collections: PEP 372 Adding an Ordered Dictionary to collections. +* PEP 378; Format Specifier for Thousands Separator: PEP 378 Format Specifier for Thousands Separator<2>. +* PEP 389; The argparse Module for Parsing Command Lines: PEP 389 The argparse Module for Parsing Command Lines. +* PEP 391; Dictionary-Based Configuration For Logging: PEP 391 Dictionary-Based Configuration For Logging. +* PEP 3106; Dictionary Views: PEP 3106 Dictionary Views. +* PEP 3137; The memoryview Object: PEP 3137 The memoryview Object. +* Other Language Changes: Other Language Changes<14>. +* New and Improved Modules:: +* Build and C API Changes: Build and C API Changes<8>. +* Other Changes and Fixes:: +* Porting to Python 2.7: Porting to Python 2 7. +* New Features Added to Python 2.7 Maintenance Releases: New Features Added to Python 2 7 Maintenance Releases. +* Acknowledgements:: + + +File: python.info, Node: The Future for Python 2 x, Next: Changes to the Handling of Deprecation Warnings, Up: What’s New in Python 2 7 + +1.15.1 The Future for Python 2.x +-------------------------------- + +Python 2.7 is the last major release in the 2.x series, as the Python +maintainers have shifted the focus of their new feature development +efforts to the Python 3.x series. This means that while Python 2 +continues to receive bug fixes, and to be updated to build correctly on +new hardware and versions of supported operated systems, there will be +no new full feature releases for the language or standard library. + +However, while there is a large common subset between Python 2.7 and +Python 3, and many of the changes involved in migrating to that common +subset, or directly to Python 3, can be safely automated, some other +changes (notably those associated with Unicode handling) may require +careful consideration, and preferably robust automated regression test +suites, to migrate effectively. + +This means that Python 2.7 will remain in place for a long time, +providing a stable and supported base platform for production systems +that have not yet been ported to Python 3. The full expected lifecycle +of the Python 2.7 series is detailed in PEP 373(1). + +Some key consequences of the long-term significance of 2.7 are: + + * As noted above, the 2.7 release has a much longer period of + maintenance when compared to earlier 2.x versions. Python 2.7 is + currently expected to remain supported by the core development team + (receiving security updates and other bug fixes) until at least + 2020 (10 years after its initial release, compared to the more + typical support period of 18–24 months). + + * As the Python 2.7 standard library ages, making effective use of + the Python Package Index (either directly or via a redistributor) + becomes more important for Python 2 users. In addition to a wide + variety of third party packages for various tasks, the available + packages include backports of new modules and features from the + Python 3 standard library that are compatible with Python 2, as + well as various tools and libraries that can make it easier to + migrate to Python 3. The Python Packaging User Guide(2) provides + guidance on downloading and installing software from the Python + Package Index. + + * While the preferred approach to enhancing Python 2 is now the + publication of new packages on the Python Package Index, this + approach doesn’t necessarily work in all cases, especially those + related to network security. In exceptional cases that cannot be + handled adequately by publishing new or updated packages on PyPI, + the Python Enhancement Proposal process may be used to make the + case for adding new features directly to the Python 2 standard + library. Any such additions, and the maintenance releases where + they were added, will be noted in the *note New Features Added to + Python 2.7 Maintenance Releases: 12d9. section below. + +For projects wishing to migrate from Python 2 to Python 3, or for +library and framework developers wishing to support users on both Python +2 and Python 3, there are a variety of tools and guides available to +help decide on a suitable approach and manage some of the technical +details involved. The recommended starting point is the pyporting-howto +HOWTO guide. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0373/ + + (2) https://packaging.python.org + + +File: python.info, Node: Changes to the Handling of Deprecation Warnings, Next: Python 3 1 Features, Prev: The Future for Python 2 x, Up: What’s New in Python 2 7 + +1.15.2 Changes to the Handling of Deprecation Warnings +------------------------------------------------------ + +For Python 2.7, a policy decision was made to silence warnings only of +interest to developers by default. *note DeprecationWarning: 1a5. and +its descendants are now ignored unless otherwise requested, preventing +users from seeing warnings triggered by an application. This change was +also made in the branch that became Python 3.2. (Discussed on +stdlib-sig and carried out in bpo-7319(1).) + +In previous releases, *note DeprecationWarning: 1a5. messages were +enabled by default, providing Python developers with a clear indication +of where their code may break in a future major version of Python. + +However, there are increasingly many users of Python-based applications +who are not directly involved in the development of those applications. +*note DeprecationWarning: 1a5. messages are irrelevant to such users, +making them worry about an application that’s actually working correctly +and burdening application developers with responding to these concerns. + +You can re-enable display of *note DeprecationWarning: 1a5. messages by +running Python with the *note -Wdefault: 8c6. (short form: *note -Wd: +8c6.) switch, or by setting the *note PYTHONWARNINGS: baa. environment +variable to ‘"default"’ (or ‘"d"’) before running Python. Python code +can also re-enable them by calling ‘warnings.simplefilter('default')’. + +The ‘unittest’ module also automatically reenables deprecation warnings +when running tests. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=7319 + + +File: python.info, Node: Python 3 1 Features, Next: PEP 372 Adding an Ordered Dictionary to collections, Prev: Changes to the Handling of Deprecation Warnings, Up: What’s New in Python 2 7 + +1.15.3 Python 3.1 Features +-------------------------- + +Much as Python 2.6 incorporated features from Python 3.0, version 2.7 +incorporates some of the new features in Python 3.1. The 2.x series +continues to provide tools for migrating to the 3.x series. + +A partial list of 3.1 features that were backported to 2.7: + + * The syntax for set literals (‘{1,2,3}’ is a mutable set). + + * Dictionary and set comprehensions (‘{i: i*2 for i in range(3)}’). + + * Multiple context managers in a single *note with: 5ce. statement. + + * A new version of the *note io: 7f. library, rewritten in C for + performance. + + * The ordered-dictionary type described in *note PEP 372; Adding an + Ordered Dictionary to collections: 12dc. + + * The new ‘","’ format specifier described in *note PEP 378; Format + Specifier for Thousands Separator: 12dd. + + * The *note memoryview: 464. object. + + * A small subset of the *note importlib: 77. module, *note described + below: 12de. + + * The *note repr(): 7f9. of a float ‘x’ is shorter in many cases: + it’s now based on the shortest decimal string that’s guaranteed to + round back to ‘x’. As in previous versions of Python, it’s + guaranteed that ‘float(repr(x))’ recovers ‘x’. + + * Float-to-string and string-to-float conversions are correctly + rounded. The *note round(): 12cd. function is also now correctly + rounded. + + * The *note PyCapsule: 1266. type, used to provide a C API for + extension modules. + + * The *note PyLong_AsLongAndOverflow(): 125a. C API function. + +Other new Python3-mode warnings include: + + * ‘operator.isCallable()’ and ‘operator.sequenceIncludes()’, which + are not supported in 3.x, now trigger warnings. + + * The ‘-3’ switch now automatically enables the ‘-Qwarn’ switch that + causes warnings about using classic division with integers and long + integers. + + +File: python.info, Node: PEP 372 Adding an Ordered Dictionary to collections, Next: PEP 378 Format Specifier for Thousands Separator<2>, Prev: Python 3 1 Features, Up: What’s New in Python 2 7 + +1.15.4 PEP 372: Adding an Ordered Dictionary to collections +----------------------------------------------------------- + +Regular Python dictionaries iterate over key/value pairs in arbitrary +order. Over the years, a number of authors have written alternative +implementations that remember the order that the keys were originally +inserted. Based on the experiences from those implementations, 2.7 +introduces a new *note OrderedDict: 5d7. class in the *note collections: +1d. module. + +The *note OrderedDict: 5d7. API provides the same interface as regular +dictionaries but iterates over keys and values in a guaranteed order +depending on when a key was first inserted: + + >>> from collections import OrderedDict + >>> d = OrderedDict([('first', 1), + ... ('second', 2), + ... ('third', 3)]) + >>> d.items() + [('first', 1), ('second', 2), ('third', 3)] + +If a new entry overwrites an existing entry, the original insertion +position is left unchanged: + + >>> d['second'] = 4 + >>> d.items() + [('first', 1), ('second', 4), ('third', 3)] + +Deleting an entry and reinserting it will move it to the end: + + >>> del d['second'] + >>> d['second'] = 5 + >>> d.items() + [('first', 1), ('third', 3), ('second', 5)] + +The *note popitem(): 12e0. method has an optional 'last' argument that +defaults to ‘True’. If 'last' is true, the most recently added key is +returned and removed; if it’s false, the oldest key is selected: + + >>> 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) + +Comparing two ordered dictionaries checks both the keys and values, and +requires that the insertion order was the same: + + >>> 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 + +Comparing an *note OrderedDict: 5d7. with a regular dictionary ignores +the insertion order and just compares the keys and values. + +How does the *note OrderedDict: 5d7. 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 standard library now supports use of ordered dictionaries in several +modules. + + * The *note ConfigParser: 22. 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(): 9e0. method for *note + collections.namedtuple(): 1ca. now returns an ordered dictionary + with the values appearing in the same order as the underlying tuple + indices. + + * The *note json: 82. module’s *note JSONDecoder: d47. 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). + +See also +........ + +PEP 372(2) - Adding an ordered dictionary to 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 Format Specifier for Thousands Separator<2>, Next: PEP 389 The argparse Module for Parsing Command Lines, Prev: PEP 372 Adding an Ordered Dictionary to collections, Up: What’s New in Python 2 7 + +1.15.5 PEP 378: Format Specifier for Thousands Separator +-------------------------------------------------------- + +To make program output more readable, it can be useful to add separators +to large numbers, rendering them as 18,446,744,073,709,551,616 instead +of 18446744073709551616. + +The fully general solution for doing this is the *note locale: 86. +module, which can use different separators (“,” in North America, “.” in +Europe) and different grouping sizes, but *note locale: 86. is +complicated to use and unsuitable for multi-threaded applications where +different threads are producing output for different locales. + +Therefore, a simple comma-grouping mechanism has been added to the +mini-language used by the *note str.format(): 61d. method. When +formatting a floating-point number, simply include a comma between the +width and the precision: + + >>> '{:20,.2f}'.format(18446744073709551616.0) + '18,446,744,073,709,551,616.00' + +When formatting an integer, include the comma after the width: + + >>> '{:20,d}'.format(18446744073709551616) + '18,446,744,073,709,551,616' + +This mechanism is not adaptable at all; commas are always used as the +separator and the grouping is always into three-digit groups. The +comma-formatting mechanism isn’t as general as the *note locale: 86. +module, but it’s easier to use. + +See also +........ + +PEP 378(1) - Format Specifier for Thousands Separator + + PEP written by Raymond Hettinger; implemented by Eric Smith. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0378/ + + +File: python.info, Node: PEP 389 The argparse Module for Parsing Command Lines, Next: PEP 391 Dictionary-Based Configuration For Logging, Prev: PEP 378 Format Specifier for Thousands Separator<2>, Up: What’s New in Python 2 7 + +1.15.6 PEP 389: The argparse Module for Parsing Command Lines +------------------------------------------------------------- + +The *note argparse: 6. module for parsing command-line arguments was +added as a more powerful replacement for the *note optparse: a0. module. + +This means Python now supports three different modules for parsing +command-line arguments: *note getopt: 61, *note optparse: a0, and *note +argparse: 6. The *note getopt: 61. module closely resembles the C +library’s ‘getopt()’ function, so it remains useful if you’re writing a +Python prototype that will eventually be rewritten in C. *note optparse: +a0. becomes redundant, but there are no plans to remove it because there +are many scripts still using it, and there’s no automated way to update +these scripts. (Making the *note argparse: 6. API consistent with *note +optparse: a0.’s interface was discussed but rejected as too messy and +difficult.) + +In short, if you’re writing a new script and don’t need to worry about +compatibility with earlier versions of Python, use *note argparse: 6. +instead of *note optparse: a0. + +Here’s an example: + + 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__ + +Unless you override it, ‘-h’ and ‘--help’ switches are automatically +added, and produce neatly formatted output: + + -> ./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 + +As with *note optparse: a0, the command-line switches and arguments are +returned as an object with attributes named by the 'dest' parameters: + + -> ./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: 6. has much fancier validation than *note optparse: a0.; +you can specify an exact number of arguments as an integer, 0 or more +arguments by passing ‘'*'’, 1 or more by passing ‘'+'’, or an optional +argument with ‘'?'’. A top-level parser can contain sub-parsers to +define subcommands that have different sets of switches, as in ‘svn +commit’, ‘svn checkout’, etc. You can specify an argument’s type as +*note FileType: f16, which will automatically open files for you and +understands that ‘'-'’ means standard input or output. + +See also +........ + +*note argparse: 6. documentation + + The documentation page of the argparse module. + +*note Migrating optparse code to argparse: 11a0. + + Part of the Python documentation, describing how to convert code + that uses *note optparse: a0. + +PEP 389(1) - argparse - New Command Line Parsing Module + + PEP written and implemented by Steven Bethard. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0389/ + + +File: python.info, Node: PEP 391 Dictionary-Based Configuration For Logging, Next: PEP 3106 Dictionary Views, Prev: PEP 389 The argparse Module for Parsing Command Lines, Up: What’s New in Python 2 7 + +1.15.7 PEP 391: Dictionary-Based Configuration For Logging +---------------------------------------------------------- + +The *note logging: 87. module is very flexible; applications can define +a tree of logging subsystems, and each logger in this tree can filter +out certain messages, format them differently, and direct messages to a +varying number of handlers. + +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: 87. +also supports a *note fileConfig(): b51. 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(): 11a2. 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 Configuration functions: 12e4. + +The following example configures two loggers, the root logger and a +logger named “network”. Messages sent to the root logger will be sent +to the system log using the syslog protocol, and messages to the +“network” logger will be written to a ‘network.log’ file that will be +rotated once the log reaches 1MB. + + 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') + +Three smaller enhancements to the *note logging: 87. module, all +implemented by Vinay Sajip, are: + + * The *note SysLogHandler: 658. class now supports syslogging over + TCP. The constructor has a 'socktype' parameter giving the type of + socket to use, either *note socket.SOCK_DGRAM: 12e5. for UDP or + *note socket.SOCK_STREAM: 12e6. for TCP. The default protocol + remains UDP. + + * *note Logger: b4f. instances gained a *note getChild(): 12e7. + method that retrieves a descendant logger using a relative path. + For example, once you retrieve a logger by doing ‘log = + getLogger('app')’, calling ‘log.getChild('network.listen')’ is + equivalent to ‘getLogger('app.network.listen')’. + + * The *note LoggerAdapter: 12e8. class gained an *note + isEnabledFor(): 12e9. method that takes a 'level' and returns + whether the underlying logger would process a message of that level + of importance. + +See also +........ + +PEP 391(1) - Dictionary-Based Configuration For Logging + + PEP written and implemented by Vinay Sajip. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0391/ + + +File: python.info, Node: PEP 3106 Dictionary Views, Next: PEP 3137 The memoryview Object, Prev: PEP 391 Dictionary-Based Configuration For Logging, Up: What’s New in Python 2 7 + +1.15.8 PEP 3106: Dictionary Views +--------------------------------- + +The dictionary methods *note keys(): 7c8, *note values(): 7c9, and *note +items(): 7ca. are different in Python 3.x. They return an object called +a 'view' instead of a fully materialized list. + +It’s not possible to change the return values of *note keys(): 7c8, +*note values(): 7c9, and *note items(): 7ca. 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]) + +Views can be iterated over, but the key and item views also behave like +sets. The ‘&’ operator performs intersection, and ‘|’ performs a union: + + >>> 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]) + +The view keeps track of the dictionary and its contents change as the +dictionary is modified: + + >>> vk = d.viewkeys() + >>> vk + dict_keys([0, 130, 10, ..., 250]) + >>> d[260] = '&' + >>> vk + dict_keys([0, 130, 260, 10, ..., 250]) + +However, note that you can’t add or remove keys while you’re iterating +over the view: + + >>> for k in vk: + ... d[k*2] = k + ... + Traceback (most recent call last): + File "", line 1, in + RuntimeError: dictionary changed size during iteration + +You can use the view methods in Python 2.x code, and the 2to3 converter +will change them to the standard *note keys(): 7c8, *note values(): 7c9, +and *note items(): 7ca. methods. + +See also +........ + +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 The memoryview Object, Next: Other Language Changes<14>, Prev: PEP 3106 Dictionary Views, Up: What’s New in Python 2 7 + +1.15.9 PEP 3137: The memoryview Object +-------------------------------------- + +The *note memoryview: 464. object provides a view of another object’s +memory content that matches the *note bytes: 1c2. type’s interface. + + >>> import string + >>> m = memoryview(string.letters) + >>> m + + >>> 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 + + +The content of the view can be converted to a string of bytes or a list +of integers: + + >>> m2.tobytes() + 'abcdefghijklmnopqrstuvwxyz' + >>> m2.tolist() + [97, 98, 99, 100, 101, 102, 103, ... 121, 122] + >>> + +*note memoryview: 464. objects allow modifying the underlying object if +it’s a mutable object. + + >>> m2[0] = 75 + Traceback (most recent call last): + File "", line 1, in + 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') + >>> + +See also +........ + +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: Other Language Changes<14>, Next: New and Improved Modules, Prev: PEP 3137 The memoryview Object, Up: What’s New in Python 2 7 + +1.15.10 Other Language Changes +------------------------------ + +Some smaller changes made to the core Python language are: + + * The syntax for set literals has been backported from Python 3.x. + Curly brackets are used to surround the contents of the resulting + mutable set; set literals are distinguished from dictionaries by + not containing colons and values. ‘{}’ continues to represent an + empty dictionary; use ‘set()’ for an empty 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). + + * Dictionary and set comprehensions are another feature backported + from 3.x, generalizing list/generator comprehensions to use the + literal syntax for sets and dictionaries. + + >>> {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). + + * The *note with: 5ce. statement can now use multiple context + managers in one statement. Context managers are processed from + left to right and each one is treated as beginning a new ‘with’ + statement. This means that: + + with A() as a, B() as b: + ... suite of statements ... + + is equivalent to: + + 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.) + + * Conversions between floating-point numbers and strings are now + correctly rounded on most platforms. These conversions occur in + many different places: *note str(): 447. on floats and complex + numbers; the *note float: 2f1. and *note complex: 2f2. + constructors; numeric formatting; serializing and deserializing + floats and complex numbers using the *note marshal: 8d, *note + pickle: a6. and *note json: 82. modules; parsing of float and + imaginary literals in Python code; and *note Decimal: 29f.-to-float + conversion. + + Related to this, the *note repr(): 7f9. of a floating-point number + 'x' now returns a result based on the shortest decimal string + that’s guaranteed to round back to 'x' under correct rounding (with + round-half-to-even rounding mode). Previously it gave a string + based on rounding x to 17 decimal digits. + + The rounding library responsible for this improvement works on + Windows and on Unix platforms using the gcc, icc, or suncc + compilers. There may be a small number of platforms where correct + operation of this code cannot be guaranteed, so the code is not + used on such systems. You can find out which code is being used by + checking *note sys.float_repr_style: 12ed, which will be ‘short’ if + the new code is in use and ‘legacy’ if it isn’t. + + Implemented by Eric Smith and Mark Dickinson, using David Gay’s + ‘dtoa.c’ library; bpo-7117(3). + + * Conversions from long integers and regular integers to floating + point now round differently, returning the floating-point number + closest to the number. This doesn’t matter for small integers that + can be converted exactly, but for large numbers that will + unavoidably lose precision, Python 2.7 now approximates more + closely. For example, Python 2.6 computed the following: + + >>> n = 295147905179352891391 + >>> float(n) + 2.9514790517935283e+20 + >>> n - long(float(n)) + 65535L + + Python 2.7’s floating-point result is larger, but much closer to + the true value: + + >>> n = 295147905179352891391 + >>> float(n) + 2.9514790517935289e+20 + >>> n - long(float(n)) + -1L + + (Implemented by Mark Dickinson; bpo-3166(4).) + + Integer division is also more accurate in its rounding behaviours. + (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).) + + * The *note str.format(): 61d. method now supports automatic + numbering of the replacement fields. This makes using *note + str.format(): 61d. more closely resemble using ‘%s’ formatting: + + >>> '{}:{}:{}'.format(2009, 04, 'Sunday') + '2009:4:Sunday' + >>> '{}:{}:{day}'.format(2009, 4, day='Sunday') + '2009:4:Sunday' + + The auto-numbering takes the fields from left to right, so the + first ‘{...}’ specifier will use the first argument to *note + str.format(): 61d, the next specifier will use the next argument, + and so on. You can’t mix auto-numbering and explicit numbering – + either number all of your specifier fields or none of them – but + you can mix auto-numbering and named fields, as in the second + example above. (Contributed by Eric Smith; bpo-5237(7).) + + Complex numbers now correctly support usage with *note format(): + 61b, and default to being right-aligned. Specifying a precision or + comma-separation applies to both the real and imaginary parts of + the number, but a specified field width and alignment is applied to + the whole of the resulting ‘1.5+3j’ output. (Contributed by Eric + Smith; bpo-1588(8) and bpo-7988(9).) + + The ‘F’ format code now always formats its output using uppercase + characters, so it will now produce ‘INF’ and ‘NAN’. (Contributed + by Eric Smith; bpo-3382(10).) + + A low-level change: the *note object.__format__(): 61a. method now + triggers a *note PendingDeprecationWarning: 8c7. if it’s passed a + format string, because the ‘__format__()’ method for *note object: + a8c. 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(): 259. 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).) + + * The *note import: 5de. statement will no longer try an absolute + import if a relative import (e.g. ‘from .os import sep’) fails. + This fixes a bug, but could possibly break certain ‘import’ + statements that were only working by accident. (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).) + + * The *note bytearray: 53a. type’s *note translate(): 12ee. method + now accepts ‘None’ as its first argument. (Fixed by Georg Brandl; + bpo-4759(15).) + + * When using *note @classmethod: 166. and *note @staticmethod: 412. + to wrap methods as class or static methods, the wrapper object now + exposes the wrapped function as their *note __func__: 12ef. + attribute. (Contributed by Amaury Forgeot d’Arc, after a + suggestion by George Sakkis; bpo-5982(16).) + + * When a restricted set of attributes were set using ‘__slots__’, + deleting an unset attribute would not raise *note AttributeError: + 348. as you would expect. Fixed by Benjamin Peterson; + bpo-7604(17).) + + * Two new encodings are now supported: “cp720”, used primarily for + Arabic text; and “cp858”, a variant of CP 850 that adds the euro + symbol. (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: 104b. 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)). + + * The Python tokenizer now translates line endings itself, so the + *note compile(): 192. built-in function now accepts code using any + line-ending convention. Additionally, it no longer requires that + the code end in a newline. + + * Extra parentheses in function definitions are illegal in Python + 3.x, meaning that you get a syntax error from ‘def f((x)): pass’. + In Python3-warning mode, Python 2.7 will now warn about this odd + usage. (Noted by James Lingard; bpo-7362(22).) + + * It’s now possible to create weak references to old-style class + objects. New-style classes were always weak-referenceable. (Fixed + by Antoine Pitrou; bpo-8268(23).) + + * When a module object is garbage-collected, the module’s dictionary + is now only cleared if no one else is holding a reference to the + dictionary (bpo-7140(24)). + +* Menu: + +* Interpreter Changes:: +* Optimizations: Optimizations<13>. + + ---------- 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: Interpreter Changes, Next: Optimizations<13>, Up: Other Language Changes<14> + +1.15.10.1 Interpreter Changes +............................. + +A new environment variable, *note PYTHONWARNINGS: baa, allows +controlling warnings. It should be set to a string containing warning +settings, equivalent to those used with the *note -W: 8c6. switch, +separated by commas. (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: 71. 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: Optimizations<13>, Prev: Interpreter Changes, Up: Other Language Changes<14> + +1.15.10.2 Optimizations +....................... + +Several performance enhancements have been added: + + * A new opcode was added to perform the initial setup for *note with: + 5ce. statements, looking up the *note __enter__(): 5c4. and *note + __exit__(): 12f3. methods. (Contributed by Benjamin Peterson.) + + * The garbage collector now performs better for one common usage + pattern: when many objects are being allocated without deallocating + any of them. This would previously take quadratic time for garbage + collection, but now the number of full garbage collections is + reduced as the number of objects on the heap grows. The new logic + only performs a full garbage collection pass when the middle + generation has been collected 10 times and when the number of + survivor objects from the middle generation exceeds 10% of the + number of objects in the oldest generation. (Suggested by Martin + von Löwis and implemented by Antoine Pitrou; bpo-4074(1).) + + * The garbage collector tries to avoid tracking simple containers + which can’t be part of a cycle. In Python 2.7, this is now true + for tuples and dicts containing atomic types (such as ints, + strings, etc.). Transitively, a dict containing tuples of atomic + types won’t be tracked either. This helps reduce the cost of each + garbage collection by decreasing the number of objects to be + considered and traversed by the collector. (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).) + + Another set of changes made long objects a few bytes smaller: 2 + bytes smaller on 32-bit systems and 6 bytes on 64-bit. + (Contributed by Mark Dickinson; bpo-5260(4).) + + * The division algorithm for long integers has been made faster by + tightening the inner loop, doing shifts instead of multiplications, + and fixing an unnecessary extra iteration. Various benchmarks show + speedups of between 50% and 150% for long integer divisions and + modulo operations. (Contributed by Mark Dickinson; bpo-5512(5).) + Bitwise operations are also significantly faster (initial patch by + Gregory Smith; bpo-1087418(6)). + + * The implementation of ‘%’ checks for the left-side operand being a + Python string and special-cases it; this results in a 1–3% + performance increase for applications that frequently use ‘%’ with + strings, such as templating libraries. (Implemented by Collin + Winter; bpo-5176(7).) + + * List comprehensions with an ‘if’ condition are compiled into faster + bytecode. (Patch by Antoine Pitrou, back-ported to 2.7 by Jeffrey + Yasskin; bpo-4715(8).) + + * Converting an integer or long integer to a decimal string was made + faster by special-casing base 10 instead of using a generalized + conversion function that supports arbitrary bases. (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: 53a. 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: a6. 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: New and Improved Modules, Next: Build and C API Changes<8>, Prev: Other Language Changes<14>, Up: What’s New in Python 2 7 + +1.15.11 New and Improved Modules +-------------------------------- + +As in every release, Python’s standard library received a number of +enhancements and bug fixes. Here’s a partial list of the most notable +changes, sorted alphabetically by module name. Consult the ‘Misc/NEWS’ +file in the source tree for a more complete list of changes, or look +through the Subversion logs for all the details. + + * The *note bdb: f. module’s base debugging class *note Bdb: 12f5. + gained a feature for skipping modules. The constructor now takes + an iterable containing glob-style patterns such as ‘django.*’; the + debugger will not step into stack frames from a module that matches + one of these patterns. (Contributed by Maru Newby after a + suggestion by Senthil Kumaran; bpo-5142(1).) + + * The *note binascii: 10. module now supports the buffer API, so it + can be used with *note memoryview: 464. instances and other similar + buffer objects. (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’.) + + * The *note bz2: 13. module’s *note BZ2File: 863. now supports the + context management protocol, so you can write ‘with + bz2.BZ2File(...) as f:’. (Contributed by Hagen Fürstenau; + bpo-3860(5).) + + * New class: the *note Counter: 108b. class in the *note collections: + 1d. module is useful for tallying data. *note Counter: 108b. + instances behave mostly like dictionaries but return zero for + missing keys instead of raising a *note KeyError: 33f.: + + >>> 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 + + There are three additional *note Counter: 108b. methods. *note + most_common(): 12f6. returns the N most common elements and their + counts. *note elements(): 12f7. returns an iterator over the + contained elements, repeating each element as many times as its + count. *note subtract(): 11d0. takes an iterable and subtracts one + for each element instead of adding; if the argument is a dictionary + or another ‘Counter’, the counts are subtracted. + + >>> 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). + + New class: *note OrderedDict: 5d7. is described in the earlier + section *note PEP 372; Adding an Ordered Dictionary to collections: + 12dc. + + New method: The *note deque: 5d8. data type now has a *note + count(): 11d2. method that returns the number of contained elements + equal to the supplied argument 'x', and a *note reverse(): 11d3. + method that reverses the elements of the deque in-place. *note + deque: 5d8. also exposes its maximum length as the read-only *note + maxlen: 12f8. attribute. (Both features added by Raymond + Hettinger.) + + The *note namedtuple: 1ca. class now has an optional 'rename' + parameter. If 'rename' is true, field names that are invalid + because they’ve been repeated or aren’t legal Python identifiers + will be renamed to legal names that are derived from the field’s + position within the list of fields: + + >>> 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: 8c9. abstract base class now returns + *note NotImplemented: 7cd. 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: 22. + 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: 5ce. + statement, has been deprecated, because the ‘with’ statement now + supports multiple context managers. + + * The *note cookielib: 70. 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).) + + * The *note copy: 25. module’s *note deepcopy(): b6e. function will + now correctly copy bound instance methods. (Implemented by Robert + Collins; bpo-1515(11).) + + * The *note ctypes: 2a. module now always converts ‘None’ to a C + ‘NULL’ pointer for arguments declared as pointers. (Changed by + Thomas Heller; bpo-4606(12).) The underlying libffi library(13) + has been updated to version 3.0.9, containing various fixes for + different platforms. (Updated by Matthias Klose; bpo-8142(14).) + + * New method: the *note datetime: 30. module’s *note timedelta: 9cf. + class gained a *note total_seconds(): 12f9. method that returns the + number of seconds in the duration. (Contributed by Brian Quinlan; + bpo-5788(15).) + + * New method: the *note Decimal: 29f. class gained a *note + from_float(): 11f6. 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: 29f. 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).) + + The constructor for *note Decimal: 29f. now accepts floating-point + numbers (added by Raymond Hettinger; bpo-8257(18)) and non-European + Unicode characters such as Arabic-Indic digits (contributed by Mark + Dickinson; bpo-6595(19)). + + Most of the methods of the *note Context: 10a5. class now accept + integers as well as *note Decimal: 29f. instances; the only + exceptions are the *note canonical(): 12fa. and *note + is_canonical(): 12fb. methods. (Patch by Juan José Conti; + bpo-7633(20).) + + When using *note Decimal: 29f. instances with a string’s *note + format(): 61d. method, the default alignment was previously + left-alignment. This has been changed to right-alignment, which is + more sensible for numeric types. (Changed by Mark Dickinson; + bpo-6857(21).) + + Comparisons involving a signaling NaN value (or ‘sNAN’) now signal + *note InvalidOperation: 109e. instead of silently returning a true + or false value depending on the comparison operator. Quiet NaN + values (or ‘NaN’) are now hashable. (Fixed by Mark Dickinson; + bpo-7279(22).) + + * The *note difflib: 37. module now produces output that is more + compatible with modern ‘diff’/‘patch’ tools through one small + change, using a tab character instead of spaces as a separator in + the header giving the filename. (Fixed by Anatoly Techtonik; + bpo-7585(23).) + + * The Distutils ‘sdist’ command now always regenerates the ‘MANIFEST’ + file, since even if the ‘MANIFEST.in’ or ‘setup.py’ files haven’t + been modified, the user might have created some new files that + should be included. (Fixed by Tarek Ziadé; bpo-8688(24).) + + * The *note doctest: 3a. module’s *note IGNORE_EXCEPTION_DETAIL: + 12fc. flag will now ignore the name of the module containing the + exception being tested. (Patch by Lennart Regebro; bpo-7490(25).) + + * The *note email: 3b. module’s *note Message: 27e. 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).) + + * The *note Fraction: 1e9. class now accepts a single float or *note + Decimal: 29f. instance, or two rational numbers, as arguments to + its constructor. (Implemented by Mark Dickinson; rationals added + in bpo-5812(27), and float/decimal in bpo-8294(28).) + + Ordering comparisons (‘<’, ‘<=’, ‘>’, ‘>=’) between fractions and + complex numbers now raise a *note TypeError: 534. This fixes an + oversight, making the *note Fraction: 1e9. match the other numeric + types. + + * New class: *note FTP_TLS: 8fa. in the *note ftplib: 5e. module + provides secure FTP connections using TLS encapsulation of + authentication as well as subsequent control and data transfers. + (Contributed by Giampaolo Rodola; bpo-2054(29).) + + The *note storbinary(): 12fd. method for binary uploads can now + restart uploads thanks to an added 'rest' parameter (patch by Pablo + Mouzo; bpo-6845(30).) + + * New class decorator: *note total_ordering(): f3d. in the *note + functools: 5f. module takes a class that defines an *note __eq__(): + afa. method and one of *note __lt__(): 1292, *note __le__(): 12fe, + *note __gt__(): 12ff, or *note __ge__(): 1300, 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).) + + New function: *note cmp_to_key(): 11cc. will take an old-style + comparison function that expects two arguments and return a new + callable that can be used as the 'key' parameter to functions such + as *note sorted(): bce, *note min(): f03. and *note max(): f04, + etc. The primary intended use is to help with making code + compatible with Python 3.x. (Added by Raymond Hettinger.) + + * New function: the *note gc: 60. module’s *note is_tracked(): 1301. + returns true if a given instance is tracked by the garbage + collector, false otherwise. (Contributed by Antoine Pitrou; + bpo-4688(32).) + + * The *note gzip: 67. module’s *note GzipFile: 416. now supports the + context management protocol, so you can write ‘with + gzip.GzipFile(...) as f:’ (contributed by Hagen Fürstenau; + bpo-3860(33)), and it now implements the *note io.BufferedIOBase: + 690. ABC, so you can wrap it with *note io.BufferedReader: 1200. + for faster processing (contributed by Nir Aides; bpo-7471(34)). + It’s also now possible to override the modification time recorded + in a gzipped file by providing an optional timestamp to the + constructor. (Contributed by Jacques Frechet; bpo-4272(35).) + + Files in gzip format can be padded with trailing zero bytes; the + *note gzip: 67. module will now consume these trailing bytes. + (Fixed by Tadek Pietraszek and Brian Curtin; bpo-2846(36).) + + * New attribute: the *note hashlib: 68. 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: 10c4. class used by the *note + httplib: 6e. 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: b40. and *note HTTPSConnection: b41. + 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.) + + * The *note imaplib: 74. module now supports IPv6 addresses. + (Contributed by Derek Morr; bpo-1655(40).) + + * New function: the *note inspect: 7e. module’s *note getcallargs(): + eb7. takes a callable and its positional and keyword arguments, and + figures out which of the callable’s parameters will receive each + argument, returning a dictionary mapping argument names to their + values. For example: + + >>> 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: 7f. 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: 691. class now + has an *note errors: 1302. attribute giving the error setting used + for encoding and decoding errors (one of ‘'strict'’, ‘'replace'’, + ‘'ignore'’). + + The *note io.FileIO: 1303. class now raises an *note OSError: 413. + when passed an invalid file descriptor. (Implemented by Benjamin + Peterson; bpo-4991(42).) The *note truncate(): 1304. method now + preserves the file position; previously it would change the file + position to the end of the new file. (Fixed by Pascal Chambon; + bpo-6939(43).) + + * New function: ‘itertools.compress(data, selectors)’ takes two + iterators. Elements of 'data' are returned if the corresponding + value in 'selectors' is true: + + itertools.compress('ABCDEF', [1,0,1,0,1,1]) => + A, C, E, F + + New function: ‘itertools.combinations_with_replacement(iter, r)’ + returns all the possible 'r'-length combinations of elements from + the iterable 'iter'. Unlike *note combinations(): 1305, individual + elements can be repeated in the generated combinations: + + itertools.combinations_with_replacement('abc', 2) => + ('a', 'a'), ('a', 'b'), ('a', 'c'), + ('b', 'b'), ('b', 'c'), ('c', 'c') + + Note that elements are treated as unique depending on their + position in the input, not their actual values. + + The *note itertools.count(): 1276. function now has a 'step' + argument that allows incrementing by values other than 1. *note + count(): 1276. also now allows keyword arguments, and using + non-integer values such as floats or *note Decimal: 29f. instances. + (Implemented by Raymond Hettinger; bpo-5032(44).) + + *note itertools.combinations(): 1305. and *note + itertools.product(): 1306. previously raised *note ValueError: 204. + for values of 'r' larger than the input iterable. This was deemed + a specification error, so they now return an empty iterator. + (Fixed by Raymond Hettinger; bpo-4816(45).) + + * Updated module: The *note json: 82. module was upgraded to version + 2.0.9 of the simplejson package, which includes a C extension that + makes encoding and decoding faster. (Contributed by Bob Ippolito; + bpo-4136(46).) + + To support the new *note collections.OrderedDict: 5d7. type, *note + json.load(): cb4. now has an optional 'object_pairs_hook' parameter + that will be called with any object literal that decodes to a list + of pairs. (Contributed by Raymond Hettinger; bpo-5381(47).) + + * The *note mailbox: 8b. module’s *note Maildir: 418. class now + records the timestamp on the directories it reads, and only + re-reads them if the modification time has subsequently changed. + This improves performance by avoiding unneeded directory scans. + (Fixed by A.M. Kuchling and Antoine Pitrou; bpo-1607951(48), + bpo-6896(49).) + + * New functions: the *note math: 8e. module gained *note erf(): bd8. + and *note erfc(): bd9. for the error function and the complementary + error function, *note expm1(): 11de. which computes ‘e**x - 1’ with + more precision than using *note exp(): 1307. and subtracting 1, + *note gamma(): 11df. for the Gamma function, and *note lgamma(): + 11e0. for the natural log of the Gamma function. (Contributed by + Mark Dickinson and nirinA raseliarison; bpo-3366(50).) + + * The *note multiprocessing: 94. 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: f66. 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).) + + * New functions: the *note os: a1. module wraps the following POSIX + system calls: *note getresgid(): 1308. and *note getresuid(): 1309, + which return the real, effective, and saved GIDs and UIDs; *note + setresgid(): 130a. and *note setresuid(): 130b, which set real, + effective, and saved GIDs and UIDs to new values; *note + initgroups(): 130c, which initialize the group access list for the + current process. (GID/UID functions contributed by Travis H.; + bpo-6508(54). Support for initgroups added by Jean-Paul Calderone; + bpo-7333(55).) + + The *note os.fork(): 197. function now re-initializes the import + lock in the child process; this fixes problems on Solaris when + *note fork(): 197. is called from a thread. (Fixed by Zsolt + Cserna; bpo-7242(56).) + + * In the *note os.path: a2. module, the *note normpath(): 130d. and + *note abspath(): 130e. functions now preserve Unicode; if their + input path is a Unicode string, the return value is also a Unicode + string. (*note normpath(): 130d. fixed by Matt Giuca in + bpo-5827(57); *note abspath(): 130e. fixed by Ezio Melotti in + bpo-3426(58).) + + * The *note pydoc: b5. module now has help for the various symbols + that Python uses. You can now do ‘help('<<')’ or ‘help('@')’, for + example. (Contributed by David Laban; bpo-4739(59).) + + * The *note re: b9. module’s *note split(): 2a4, *note sub(): 2a5, + and *note subn(): 2a6. now accept an optional 'flags' argument, for + consistency with the other functions in the module. (Added by + Gregory P. Smith.) + + * New function: *note run_path(): 181. in the *note runpy: be. module + will execute the code at a provided 'path' argument. 'path' can be + the path of a Python source file (‘example.py’), a compiled + bytecode file (‘example.pyc’), a directory (‘./package/’), or a zip + archive (‘example.zip’). If a directory or zip path is provided, + it will be added to the front of ‘sys.path’ and the module *note + __main__: 1. will be imported. It’s expected that the directory or + zip contains a ‘__main__.py’; if it doesn’t, some other + ‘__main__.py’ might be imported from a location later in + ‘sys.path’. This makes more of the machinery of *note runpy: be. + available to scripts that want to mimic the way Python’s command + line processes an explicit path name. (Added by Nick Coghlan; + bpo-6816(60).) + + * New function: in the *note shutil: c5. module, *note + make_archive(): 4af. takes a filename, archive type (zip or + tar-format), and a directory path, and creates an archive + containing the directory’s contents. (Added by Tarek Ziadé.) + + *note shutil: c5.’s *note copyfile(): a58. and *note copytree(): + a28. functions now raise a ‘SpecialFileError’ exception when asked + to copy a named pipe. Previously the code would treat named pipes + like a regular file by opening them for reading, and this would + block indefinitely. (Fixed by Antoine Pitrou; bpo-3002(61).) + + * The *note signal: c6. module no longer re-installs the signal + handler unless this is truly necessary, which fixes a bug that + could make it impossible to catch the EINTR signal robustly. + (Fixed by Charles-Francois Natali; bpo-8354(62).) + + * New functions: in the *note site: c7. module, three new functions + return various site- and user-specific paths. *note + getsitepackages(): 1231. returns a list containing all global + site-packages directories, *note getusersitepackages(): 1233. + returns the path of the user’s site-packages directory, and *note + getuserbase(): 1232. returns the value of the *note USER_BASE: + 130f. environment variable, giving the path to a directory that can + be used to store data. (Contributed by Tarek Ziadé; bpo-6693(63).) + + The *note site: c7. module now reports exceptions occurring when + the *note sitecustomize: c8. module is imported, and will no longer + catch and swallow the *note KeyboardInterrupt: 9d1. exception. + (Fixed by Victor Stinner; bpo-3137(64).) + + * The *note create_connection(): 66e. function gained 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(65).) + + The *note recv_into(): 1310. and *note recvfrom_into(): 1311. + methods will now write into objects that support the buffer API, + most usefully the *note bytearray: 53a. and *note memoryview: 464. + objects. (Implemented by Antoine Pitrou; bpo-8104(66).) + + * The *note SocketServer: cd. module’s *note TCPServer: 1312. 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: 1313. 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(): 1314. will be called and *note handle_request(): + 1315. will return. (Contributed by Kristján Valur Jónsson; + bpo-6192(67) and bpo-6267(68).) + + * Updated module: the *note sqlite3: cf. module has been updated to + version 2.6.0 of the pysqlite package(69). Version 2.6.0 includes + a number of bugfixes, and adds the ability to load SQLite + extensions from shared libraries. Call the + ‘enable_load_extension(True)’ method to enable extensions, and then + call *note load_extension(): 4b4. to load a particular shared + library. (Updated by Gerhard Häring.) + + * The *note ssl: d0. module’s *note SSLSocket: 8e9. 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(): 520. 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).) + + Another change makes the extension load all of OpenSSL’s ciphers + and digest algorithms so that they’re all available. Some SSL + certificates couldn’t be verified, reporting an “unknown algorithm” + error. (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: 1211. (a string), *note + ssl.OPENSSL_VERSION_INFO: 1212. (a 5-tuple), and *note + ssl.OPENSSL_VERSION_NUMBER: 1213. (an integer). (Added by Antoine + Pitrou; bpo-8321(75).) + + * The *note struct: d5. 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: 1316. exception. (Changed by Mark Dickinson; + bpo-1523(76).) The *note pack(): 126a. function will also attempt + to use *note __index__(): 718. to convert and pack non-integers + before trying the *note __int__(): 717. method or reporting an + error. (Changed by Mark Dickinson; bpo-8300(77).) + + * New function: the *note subprocess: d6. module’s *note + check_output(): fbc. runs a command with a specified set of + arguments and returns the command’s output as a string when the + command runs without error, or raises a *note CalledProcessError: + 1317. exception otherwise. + + >>> 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: d6. module will now retry its internal system + calls on receiving an *note EINTR: d86. signal. (Reported by + several people; final patch by Gregory P. Smith in + bpo-1068268(78).) + + * New function: *note is_declared_global(): 1318. in the *note + symtable: d8. module returns true for variables that are explicitly + declared to be global, false for ones that are implicitly global. + (Contributed by Jeremy Hylton.) + + * The *note syslog: dc. module will now use the value of + ‘sys.argv[0]’ as the identifier instead of the previous default + value of ‘'python'’. (Changed by Sean Reifschneider; + bpo-8451(79).) + + * The *note sys.version_info: 69c. 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(): ce7. 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).) + + * The *note tarfile: de. module’s default error handling has changed, + to no longer suppress fatal errors. The default error level was + previously 0, which meant that errors would only result in a + message being written to the debug log, but because the debug log + is not activated by default, these errors go unnoticed. The + default error level is now 1, which raises an exception if there’s + an error. (Changed by Lars Gustäbel; bpo-7357(82).) + + *note tarfile: de. now supports filtering the *note TarInfo: 1203. + objects being added to a tar file. When you call *note add(): bf3, + you may supply an optional 'filter' argument that’s a callable. + The 'filter' callable will be passed the *note TarInfo: 1203. for + every file being added, and can modify and return it. If the + callable returns ‘None’, the file will be excluded from the + resulting archive. This is more powerful than the existing + 'exclude' argument, which has therefore been deprecated. (Added by + Lars Gustäbel; bpo-6856(83).) The *note TarFile: 1202. class also + now supports the context management protocol. (Added by Lars + Gustäbel; bpo-7232(84).) + + * The *note wait(): 1319. method of the *note threading.Event: 114c. + class now returns the internal flag on exit. This means the method + will usually return true because *note wait(): 1319. is supposed to + block until the internal flag becomes true. The return value will + only be false if a timeout was provided and the operation timed + out. (Contributed by Tim Lesher; bpo-1674032(85).) + + * The Unicode database provided by the *note unicodedata: 105. module + is now used internally to determine which characters are numeric, + whitespace, or represent line breaks. The database also includes + information from the ‘Unihan.txt’ data file (patch by Anders + Chrigström and Amaury Forgeot d’Arc; bpo-1571184(86)) and has been + updated to version 5.2.0 (updated by Florent Xicluna; + bpo-8024(87)). + + * The *note urlparse: 10a. module’s *note urlsplit(): d3f. now + handles unknown URL schemes in a fashion compliant with RFC + 3986(88): if the URL is of the form ‘"://..."’, 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 (and Python 2.6.5) will return: + + >>> import urlparse + >>> urlparse.urlsplit('invented://host/filename?query') + ('invented', 'host', '/filename?query', '', '') + + (Python 2.7 actually produces slightly different output, since it + returns a named tuple instead of a standard tuple.) + + The *note urlparse: 10a. 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='') + + * New class: the *note WeakSet: 5d9. class in the *note weakref: 114. + module is a set that only holds weak references to its elements; + elements will be removed once there are no references pointing to + them. (Originally implemented in Python 3.x by Raymond Hettinger, + and backported to 2.7 by Michael Foord.) + + * The *note xml.etree.ElementTree: 125. library, no longer escapes + ampersands and angle brackets when outputting an XML processing + instruction (which looks like ‘’) + or comment (which looks like ‘’). (Patch by Neil + Muller; bpo-2746(91).) + + * The XML-RPC client and server, provided by the *note xmlrpclib: + 12e. and *note SimpleXMLRPCServer: 12f. 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: 131a, which contains a size in + bytes; responses larger than this will be compressed. (Contributed + by Kristján Valur Jónsson; bpo-6267(92).) + + * The *note zipfile: 131. module’s *note ZipFile: 6c0. now supports + the context management protocol, so you can write ‘with + zipfile.ZipFile(...) as f:’. (Contributed by Brian Curtin; + bpo-5511(93).) + + *note zipfile: 131. 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(): 131b. and *note readline(): 131c. now + works correctly. (Contributed by Nir Aides; bpo-7610(95).) + + The *note is_zipfile(): 131d. function now accepts a file object, + in addition to the path names accepted in earlier versions. + (Contributed by Gabriel Genellina; bpo-4756(96).) + + The *note writestr(): 131e. method now has an optional + 'compress_type' parameter that lets you override the default + compression method specified in the *note ZipFile: 6c0. + constructor. (Contributed by Ronald Oussoren; bpo-6003(97).) + +* Menu: + +* New module; importlib: New module importlib. +* New module; sysconfig: New module sysconfig. +* ttk; Themed Widgets for Tk: ttk Themed Widgets for Tk. +* Updated module; unittest: Updated module unittest. +* Updated module; ElementTree 1.3: Updated module 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: New module importlib, Next: New module sysconfig, Up: New and Improved Modules + +1.15.11.1 New module: importlib +............................... + +Python 3.1 includes the *note importlib: 77. package, a +re-implementation of the logic underlying Python’s *note import: 5de. +statement. *note importlib: 77. is useful for implementers of Python +interpreters and to users who wish to write new importers that can +participate in the import process. Python 2.7 doesn’t contain the +complete *note importlib: 77. package, but instead has a tiny subset +that contains a single function, *note import_module(): 513. + +‘import_module(name, package=None)’ imports a module. 'name' is a +string containing the module or package’s name. It’s possible to do +relative imports by providing a string that begins with a ‘.’ character, +such as ‘..utils.errors’. For relative imports, the 'package' argument +must be provided and is the name of the package that will be used as the +anchor for the relative import. *note import_module(): 513. both +inserts the imported module into ‘sys.modules’ and returns the module +object. + +Here are some examples: + + >>> from importlib import import_module + >>> anydbm = import_module('anydbm') # Standard absolute import + >>> anydbm + + >>> # Relative import + >>> file_util = import_module('..file_util', 'distutils.command') + >>> file_util + + +*note importlib: 77. was implemented by Brett Cannon and introduced in +Python 3.1. + + +File: python.info, Node: New module sysconfig, Next: ttk Themed Widgets for Tk, Prev: New module importlib, Up: New and Improved Modules + +1.15.11.2 New module: sysconfig +............................... + +The *note sysconfig: db. module has been pulled out of the Distutils +package, becoming a new top-level module in its own right. *note +sysconfig: db. provides functions for getting information about Python’s +build process: compiler switches, installation paths, the platform name, +and whether Python is running from its source directory. + +Some of the functions in the module are: + + * *note get_config_var(): 1024. returns variables from Python’s + Makefile and the ‘pyconfig.h’ file. + + * *note get_config_vars(): 1025. returns a dictionary containing all + of the configuration variables. + + * *note get_path(): 1321. returns the configured path for a + particular type of module: the standard library, site-specific + modules, platform-specific modules, etc. + + * *note is_python_build(): 2e1. returns true if you’re running a + binary from a Python source tree, and false otherwise. + +Consult the *note sysconfig: db. documentation for more details and for +a complete list of functions. + +The Distutils package and *note sysconfig: db. are now maintained by +Tarek Ziadé, who has also started a Distutils2 package (source +repository at ‘https://hg.python.org/distutils2/’) for developing a +next-generation version of Distutils. + + +File: python.info, Node: ttk Themed Widgets for Tk, Next: Updated module unittest, Prev: New module sysconfig, Up: New and Improved Modules + +1.15.11.3 ttk: Themed Widgets for Tk +.................................... + +Tcl/Tk 8.5 includes a set of themed widgets that re-implement basic Tk +widgets but have a more customizable appearance and can therefore more +closely resemble the native platform’s widgets. This widget set was +originally called Tile, but was renamed to Ttk (for “themed Tk”) on +being added to Tcl/Tck release 8.5. + +To learn more, read the *note ttk: f9. 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: f9. 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: Updated module unittest, Next: Updated module ElementTree 1 3, Prev: ttk Themed Widgets for Tk, Up: New and Improved Modules + +1.15.11.4 Updated module: unittest +.................................. + +The *note unittest: 106. 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 + +Consult the *note unittest: 106. module documentation for more details. +(Developed in bpo-6001(4).) + +The *note main(): fde. function supports some other new options: + + * *note -b: 1325. or ‘--buffer’ will buffer the standard output and + standard error streams during each test. If the test passes, any + resulting output will be discarded; on failure, the buffered output + will be displayed. + + * *note -c: 1326. or ‘--catch’ will cause the control-C interrupt to + be handled more gracefully. Instead of interrupting the test + process immediately, the currently running test will be completed + and then the partial results up to the interruption will be + reported. If you’re impatient, a second press of control-C will + cause an immediate interruption. + + This control-C handler tries to avoid causing problems when the + code being tested or the tests being run have defined a signal + handler of their own, by noticing that a signal handler was already + set and calling it. If this doesn’t work for you, there’s a *note + removeHandler(): 1327. decorator that can be used to mark tests + that should have the control-C handling disabled. + + * *note -f: 1328. or ‘--failfast’ makes test execution stop + immediately when a test fails instead of continuing to execute + further tests. (Suggested by Cliff Dyer and implemented by Michael + Foord; bpo-8074(5).) + +The progress messages now show ‘x’ for expected failures and ‘u’ for +unexpected successes when run in verbose mode. (Contributed by Benjamin +Peterson.) + +Test cases can raise the *note SkipTest: fdf. exception to skip a test +(bpo-1034053(6)). + +The error messages for *note assertEqual(): 524, *note assertTrue(): +522, and *note assertFalse(): 523. failures now provide more +information. If you set the *note longMessage: 1329. attribute of your +*note TestCase: 449. classes to true, both the standard error message +and any additional message you provide will be printed for failures. +(Added by Michael Foord; bpo-5663(7).) + +The *note assertRaises(): 528. method now returns a context handler when +called without providing a callable object to run. For example, you can +write this: + + with self.assertRaises(KeyError): + {}['foo'] + +(Implemented by Antoine Pitrou; bpo-4444(8).) + +Module- and class-level setup and teardown fixtures are now supported. +Modules can contain ‘setUpModule()’ and ‘tearDownModule()’ functions. +Classes can have *note setUpClass(): a4e. and *note tearDownClass(): +132a. methods that must be defined as class methods (using +‘@classmethod’ or equivalent). These functions and methods are invoked +when the test runner switches to a test case in a different module or +class. + +The methods *note addCleanup(): a81. and *note doCleanups(): 132b. were +added. *note addCleanup(): a81. lets you add cleanup functions that +will be called unconditionally (after *note setUp(): 132c. if *note +setUp(): 132c. fails, otherwise after *note tearDown(): 132d.). This +allows for much simpler resource allocation and deallocation during +tests (bpo-5679(9)). + +A number of new methods were added that provide more specialized tests. +Many of these methods were written by Google engineers for use in their +test suites; Gregory P. Smith, Michael Foord, and GvR worked on merging +them into Python’s version of *note unittest: 106. + + * *note assertIsNone(): 127d. and *note assertIsNotNone(): 127e. take + one expression and verify that the result is or is not ‘None’. + + * *note assertIs(): 132e. and *note assertIsNot(): 132f. take two + values and check whether the two values evaluate to the same object + or not. (Added by Michael Foord; bpo-2578(10).) + + * *note assertIsInstance(): 1330. and *note assertNotIsInstance(): + 1331. check whether the resulting object is an instance of a + particular class, or of one of a tuple of classes. (Added by Georg + Brandl; bpo-7031(11).) + + * *note assertGreater(): 1332, *note assertGreaterEqual(): 1333, + *note assertLess(): 1334, and *note assertLessEqual(): 1335. + compare two quantities. + + * *note assertMultiLineEqual(): 1336. compares two strings, and if + they’re not equal, displays a helpful comparison that highlights + the differences in the two strings. This comparison is now used by + default when Unicode strings are compared with *note assertEqual(): + 524. + + * *note assertRegexpMatches(): 529. and *note + assertNotRegexpMatches(): 52b. 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(): 52a. 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(): 1337. and *note assertNotIn(): 1338. tests + whether 'first' is or is not in 'second'. + + * *note assertItemsEqual(): 121d. tests whether two provided + sequences contain the same elements. + + * *note assertSetEqual(): 1278. compares whether two sets are equal, + and only reports the differences between the sets in case of error. + + * Similarly, *note assertListEqual(): 127a. and *note + assertTupleEqual(): 127b. compare the specified types and explain + any differences without necessarily printing their full values; + these methods are now used by default when comparing lists and + tuples using *note assertEqual(): 524. More generally, *note + assertSequenceEqual(): 127c. compares two sequences and can + optionally check whether both sequences are of a particular type. + + * *note assertDictEqual(): 1279. compares two dictionaries and + reports the differences; it’s now used by default when you compare + two dictionaries using *note assertEqual(): 524. + ‘assertDictContainsSubset()’ checks whether all of the key/value + pairs in 'first' are found in 'second'. + + * *note assertAlmostEqual(): 526. and *note assertNotAlmostEqual(): + 527. 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(): 1339. properly honors the *note + suiteClass: 133a. attribute of the *note TestLoader: 290. (Fixed + by Mark Roddy; bpo-6866(13).) + + * A new hook lets you extend the *note assertEqual(): 524. method to + handle new data types. The *note addTypeEqualityFunc(): 133b. + method takes a type object and a function. The function will be + used when both of the objects being compared are of the specified + type. This function should compare the two objects and raise an + exception if they don’t match; it’s a good idea for the function to + provide additional information about why the two objects aren’t + matching, much as the new sequence comparison methods do. + +*note unittest.main(): fde. now takes an optional ‘exit’ argument. If +false, *note main(): fde. doesn’t call *note sys.exit(): 133c, allowing +*note main(): fde. to be used from the interactive interpreter. +(Contributed by J. Pablo Fernández; bpo-3379(14).) + +*note TestResult: 115b. has new *note startTestRun(): 133d. and *note +stopTestRun(): 133e. methods that are called immediately before and +after a test run. (Contributed by Robert Collins; bpo-5728(15).) + +With all these changes, the ‘unittest.py’ was becoming awkwardly large, +so the module was turned into a package and the code split into several +files (by Benjamin Peterson). This doesn’t affect how the module is +imported or used. + +See also +........ + +‘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: Updated module ElementTree 1 3, Prev: Updated module unittest, Up: New and Improved Modules + +1.15.11.5 Updated module: ElementTree 1.3 +......................................... + +The version of the ElementTree library included with Python was updated +to version 1.3. Some of the new features are: + + * The various parsing functions now take a 'parser' keyword argument + giving an *note XMLParser: a53. instance that will be used. This + makes it possible to override the file’s internal encoding: + + p = ET.XMLParser(encoding='utf-8') + t = ET.XML("""""", parser=p) + + Errors in parsing XML now raise a *note ParseError: 126b. + 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(): ff0. 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 ‘’ instead of ‘’, and text mode will skip + over elements and only output the text chunks. If you set the + *note tag: 1341. 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:’ + 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(): 11c4. In + XML mode, you can use the true/false 'xml_declaration' parameter to + suppress the XML declaration. + + * New *note Element: 30a. method: *note extend(): 11c5. appends the + items from a sequence to the element’s children. Elements + themselves behave like sequences, so it’s easy to move children + from one element to another: + + from xml.etree import ElementTree as ET + + t = ET.XML(""" + 1 2 3 + """) + new = ET.XML('') + new.extend(t) + + # Outputs 1... + print ET.tostring(new) + + * New *note Element: 30a. method: *note iter(): 1342. 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: 30a. method: *note itertext(): 11c7. yields all + chunks of text that are descendants of the element. For example: + + t = ET.XML(""" + 1 2 3 + """) + + # Outputs ['\n ', '1', ' ', '2', ' ', '3', '\n'] + print list(t.itertext()) + + * Deprecated: using an element as a Boolean (i.e., ‘if elem:’) would + return true if the element had any children, or false if there were + no children. This behaviour is confusing – ‘None’ is false, but so + is a childless element? – so it will now trigger a *note + FutureWarning: 411. In your code, you should be explicit: write + ‘len(elem) != 0’ if you’re interested in the number of children, or + ‘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: Build and C API Changes<8>, Next: Other Changes and Fixes, Prev: New and Improved Modules, Up: What’s New in Python 2 7 + +1.15.12 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * 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).) + + * If you use the ‘.gdbinit’ file provided with Python, the “pyo” + macro in the 2.7 version now works correctly when the thread being + debugged doesn’t hold the GIL; the macro now acquires it before + printing. (Contributed by Victor Stinner; bpo-3632(3).) + + * *note Py_AddPendingCall(): 981. is now thread-safe, letting any + worker thread submit notifications to the main Python thread. This + is particularly useful for asynchronous IO operations. + (Contributed by Kristján Valur Jónsson; bpo-4293(4).) + + * New function: *note PyCode_NewEmpty(): 1344. 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.) + + * New function: *note PyErr_NewExceptionWithDoc(): 125c. creates a + new exception class, just as the existing *note + PyErr_NewException(): 125d. does, but takes an extra ‘char *’ + argument containing the docstring for the new exception class. + (Added by ‘lekma’ on the Python bug tracker; bpo-7033(5).) + + * New function: *note PyFrame_GetLineNumber(): 786. takes a frame + object and returns the line number that the frame is currently + executing. Previously code would need to get the index of the + bytecode instruction currently executing, and then look up the line + number corresponding to that address. (Added by Jeffrey Yasskin.) + + * New functions: *note PyLong_AsLongAndOverflow(): 125a. and *note + PyLong_AsLongLongAndOverflow(): 1259. 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(): 1288. 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. + + * New macros: the Python header files now define the following + macros: ‘Py_ISALNUM’, ‘Py_ISALPHA’, ‘Py_ISDIGIT’, ‘Py_ISLOWER’, + ‘Py_ISSPACE’, ‘Py_ISUPPER’, ‘Py_ISXDIGIT’, ‘Py_TOLOWER’, and + ‘Py_TOUPPER’. All of these functions are analogous to the C + standard macros for classifying characters, but ignore the current + locale setting, because in several places Python needs to analyze + characters in a locale-independent way. (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(): eaa. functions + now accept ‘%lld’ and ‘%llu’ format codes for displaying C’s long + long types. (Contributed by Mark Dickinson; bpo-7228(12).) + + * The complicated interaction between threads and process forking has + been changed. Previously, the child process created by *note + os.fork(): 197. might fail because the child is created with only a + single thread running, the thread performing the *note os.fork(): + 197. If other threads were holding a lock, such as Python’s import + lock, when the fork was performed, the lock would still be marked + as “held” in the new process. But in the child process nothing + would ever release the lock, since the other threads weren’t + replicated, and the child process would no longer be able to + perform imports. + + Python 2.7 acquires the import lock before performing an *note + os.fork(): 197, and will also clean up any locks created using the + *note threading: ed. module. C extension modules that have + internal locks, or that call ‘fork()’ themselves, will not benefit + from this clean-up. + + (Fixed by Thomas Wouters; bpo-1590864(13).) + + * The *note Py_Finalize(): 1345. 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: 54c. structure to define + attributes of a type, Python will no longer let you try to delete + or set a ‘T_STRING_INPLACE’ attribute. + + * Global symbols defined by the *note ctypes: 2a. module are now + prefixed with ‘Py’, or with ‘_ctypes’. (Implemented by Thomas + Heller; bpo-3102(15).) + + * New configure option: the ‘--with-system-expat’ switch allows + building the *note pyexpat: 126. module to use the system Expat + library. (Contributed by Arfrever Frehtes Taifersar Arahesis; + bpo-7609(16).) + + * New configure option: the ‘--with-valgrind’ option will now disable + the pymalloc allocator, which is difficult for the Valgrind + memory-error detector to analyze correctly. Valgrind will + therefore be better at detecting memory leaks and overruns. + (Contributed by James Henstridge; bpo-2422(17).) + + * New configure option: you can now supply an empty string to + ‘--with-dbmliborder=’ in order to disable all of the various DBM + modules. (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).) + + * The build process now creates the necessary files for pkg-config + support. (Contributed by Clinton Roy; bpo-3585(21).) + + * The build process now supports Subversion 1.7. (Contributed by + Arfrever Frehtes Taifersar Arahesis; bpo-6094(22).) + +* Menu: + +* Capsules:: +* Port-Specific Changes; Windows: Port-Specific Changes Windows. +* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X. +* Port-Specific Changes; FreeBSD: Port-Specific Changes 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: Capsules, Next: Port-Specific Changes Windows, Up: Build and C API Changes<8> + +1.15.12.1 Capsules +.................. + +Python 3.1 adds a new C datatype, *note PyCapsule: 1266, for providing a +C API to an extension module. A capsule is essentially the holder of a +C ‘void *’ pointer, and is made available as a module attribute; for +example, the *note socket: cc. module’s API is exposed as ‘socket.CAPI’, +and *note unicodedata: 105. exposes ‘ucnhash_CAPI’. Other extensions +can import the module, access its dictionary to get the capsule object, +and then get the ‘void *’ pointer, which will usually point to an array +of pointers to the module’s various API functions. + +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"); + +You are assured that ‘vtable’ points to whatever you’re expecting. If a +different capsule was passed in, *note PyCapsule_IsValid(): 1348. would +detect the mismatched name and return false. Refer to *note Providing a +C API for an Extension Module: 1349. for more information on using these +objects. + +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: 8c7, 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: Port-Specific Changes Windows, Next: Port-Specific Changes Mac OS X, Prev: Capsules, Up: Build and C API Changes<8> + +1.15.12.2 Port-Specific Changes: Windows +........................................ + + * The *note msvcrt: 93. module now contains some constants from the + ‘crtassem.h’ header file: *note CRT_ASSEMBLY_VERSION: 134b, *note + VC_ASSEMBLY_PUBLICKEYTOKEN: 134c, and *note + LIBRARIES_ASSEMBLY_NAME_PREFIX: 134d. (Contributed by David + Cournapeau; bpo-4365(1).) + + * The *note _winreg: 116. module for accessing the registry now + implements the *note CreateKeyEx(): 134e. and *note DeleteKeyEx(): + 134f. functions, extended versions of previously supported + functions that take several extra arguments. The *note + DisableReflectionKey(): 1350, *note EnableReflectionKey(): 1351, + and *note QueryReflectionKey(): 1352. 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(): 1353. function now works on Windows. The + signal value can be the constants *note CTRL_C_EVENT: 1354, *note + CTRL_BREAK_EVENT: 1355, 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).) + + * The *note os.listdir(): 10ee. function now correctly fails for an + empty path. (Fixed by Hirokazu Yamamoto; bpo-5913(5).) + + * The *note mimetypes: 8f. 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: Port-Specific Changes Mac OS X, Next: Port-Specific Changes FreeBSD, Prev: Port-Specific Changes Windows, Up: Build and C API Changes<8> + +1.15.12.3 Port-Specific Changes: Mac OS X +......................................... + + * The path ‘/Library/Python/2.7/site-packages’ is now appended to + ‘sys.path’, in order to share added packages between the system + installation and a user-installed copy of the same version. + (Changed by Ronald Oussoren; bpo-4865(1).) + + Changed in version 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: Port-Specific Changes FreeBSD, Prev: Port-Specific Changes Mac OS X, Up: Build and C API Changes<8> + +1.15.12.4 Port-Specific Changes: FreeBSD +........................................ + + * FreeBSD 7.1’s ‘SO_SETFIB’ constant, used with the *note socket(): + da0. methods *note getsockopt(): cd5./*note setsockopt(): cd6. to + select an alternate routing table, is now available in the *note + socket: cc. module. (Added by Kyle VanderBeek; bpo-8235(1).) + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=8235 + + +File: python.info, Node: Other Changes and Fixes, Next: Porting to Python 2 7, Prev: Build and C API Changes<8>, Up: What’s New in Python 2 7 + +1.15.13 Other Changes and Fixes +------------------------------- + + * Two benchmark scripts, ‘iobench’ and ‘ccbench’, were added to the + ‘Tools’ directory. ‘iobench’ measures the speed of the built-in + file I/O objects returned by *note open(): 517. while performing + various operations, and ‘ccbench’ is a concurrency benchmark that + tries to measure computing throughput, thread switching latency, + and IO processing bandwidth when performing several tasks using a + varying number of threads. + + * The ‘Tools/i18n/msgfmt.py’ script now understands plural forms in + ‘.po’ files. (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: 1359. 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).) + + * The ‘regrtest.py’ script now takes a ‘--randseed=’ switch that + takes an integer that will be used as the random seed for the ‘-r’ + option that executes tests in random order. The ‘-r’ option also + reports the seed that was used (Added by Collin Winter.) + + * Another ‘regrtest.py’ switch is ‘-j’, which takes an integer + specifying how many tests run in parallel. This allows reducing + the total runtime on multi-core machines. This option is + compatible with several other options, including the ‘-R’ switch + which is known to produce long runtimes. (Added by Antoine Pitrou, + bpo-6152(3).) This can also be used with a new ‘-F’ switch that + runs selected tests in a loop until they fail. (Added by Antoine + Pitrou; bpo-7312(4).) + + * When executed as a script, the ‘py_compile.py’ module now accepts + ‘'-'’ as an argument, which will read standard input for the list + of filenames to be compiled. (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: Porting to Python 2 7, Next: New Features Added to Python 2 7 Maintenance Releases, Prev: Other Changes and Fixes, Up: What’s New in Python 2 7 + +1.15.14 Porting to Python 2.7 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code: + + * The *note range(): 943. function processes its arguments more + consistently; it will now call *note __int__(): 717. on non-float, + non-integer arguments that are supplied to it. (Fixed by Alexander + Belopolsky; bpo-1533(1).) + + * The string *note format(): 61b. method changed the default + precision used for floating-point and complex numbers from 6 + decimal places to 12, which matches the precision used by *note + str(): 447. (Changed by Eric Smith; bpo-5920(2).) + + * Because of an optimization for the *note with: 5ce. statement, the + special methods *note __enter__(): 5c4. and *note __exit__(): 12f3. + 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: a8c.) and C extension types. (bpo-6101(3).) + + * Due to a bug in Python 2.6, the 'exc_value' parameter to *note + __exit__(): 12f3. 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).) + + * When a restricted set of attributes were set using ‘__slots__’, + deleting an unset attribute would not raise *note AttributeError: + 348. as you would expect. Fixed by Benjamin Peterson; + bpo-7604(5).) + +In the standard library: + + * Operations with *note datetime: 1cc. instances that resulted in a + year falling outside the supported range didn’t always raise *note + OverflowError: 87f. Such errors are now checked more carefully and + will now raise the exception. (Reported by Mark Leander, patch by + Anand B. Pillai and Alexander Belopolsky; bpo-7150(6).) + + * When using *note Decimal: 29f. instances with a string’s *note + format(): 61b. method, the default alignment was previously + left-alignment. This has been changed to right-alignment, which + might change the output of your programs. (Changed by Mark + Dickinson; bpo-6857(7).) + + Comparisons involving a signaling NaN value (or ‘sNAN’) now signal + *note InvalidOperation: 109e. instead of silently returning a true + or false value depending on the comparison operator. Quiet NaN + values (or ‘NaN’) are now hashable. (Fixed by Mark Dickinson; + bpo-7279(8).) + + * The *note xml.etree.ElementTree: 125. library no longer escapes + ampersands and angle brackets when outputting an XML processing + instruction (which looks like ‘’) + or comment (which looks like ‘’). (Patch by Neil + Muller; bpo-2746(9).) + + * The ‘readline()’ method of *note StringIO: f22. objects now does + nothing when a negative length is requested, as other file-like + objects do. (bpo-7348(10)). + + * The *note syslog: dc. module will now use the value of + ‘sys.argv[0]’ as the identifier instead of the previous default + value of ‘'python'’. (Changed by Sean Reifschneider; + bpo-8451(11).) + + * The *note tarfile: de. module’s default error handling has changed, + to no longer suppress fatal errors. The default error level was + previously 0, which meant that errors would only result in a + message being written to the debug log, but because the debug log + is not activated by default, these errors go unnoticed. The + default error level is now 1, which raises an exception if there’s + an error. (Changed by Lars Gustäbel; bpo-7357(12).) + + * The *note urlparse: 10a. module’s *note urlsplit(): d3f. now + handles unknown URL schemes in a fashion compliant with RFC + 3986(13): if the URL is of the form ‘"://..."’, 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 (and Python 2.6.5) will return: + + >>> import urlparse + >>> urlparse.urlsplit('invented://host/filename?query') + ('invented', 'host', '/filename?query', '', '') + + (Python 2.7 actually produces slightly different output, since it + returns a named tuple instead of a standard tuple.) + +For C extensions: + + * C extensions that use integer format codes with the ‘PyArg_Parse*’ + family of functions will now raise a *note TypeError: 534. + exception instead of triggering a *note DeprecationWarning: 1a5. + (bpo-5080(14)). + + * Use the new *note PyOS_string_to_double(): 1288. function instead + of the old ‘PyOS_ascii_strtod()’ and ‘PyOS_ascii_atof()’ functions, + which are now deprecated. + +For applications that embed 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: New Features Added to Python 2 7 Maintenance Releases, Next: Acknowledgements, Prev: Porting to Python 2 7, Up: What’s New in Python 2 7 + +1.15.15 New Features Added to Python 2.7 Maintenance Releases +------------------------------------------------------------- + +New features may be added to Python 2.7 maintenance releases when the +situation genuinely calls for it. Any such additions must go through +the Python Enhancement Proposal process, and make a compelling case for +why they can’t be adequately addressed by either adding the new feature +solely to Python 3, or else by publishing it on the Python Package +Index. + +In addition to the specific proposals listed below, there is a general +exemption allowing new ‘-3’ warnings to be added in any Python 2.7 +maintenance release. + +* Menu: + +* Two new environment variables for debug mode:: +* PEP 434; IDLE Enhancement Exception for All Branches: PEP 434 IDLE Enhancement Exception for All Branches. +* PEP 466; Network Security Enhancements for Python 2.7: PEP 466 Network Security Enhancements for Python 2 7. +* PEP 477; Backport ensurepip (PEP 453) to Python 2.7: PEP 477 Backport ensurepip PEP 453 to Python 2 7. +* PEP 476; Enabling certificate verification by default for stdlib http clients: PEP 476 Enabling certificate verification by default for stdlib http clients<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: Two new environment variables for debug mode, Next: PEP 434 IDLE Enhancement Exception for All Branches, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.15.1 Two new environment variables for debug mode +...................................................... + +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 Enhancement Exception for All Branches, Next: PEP 466 Network Security Enhancements for Python 2 7, Prev: Two new environment variables for debug mode, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.15.2 PEP 434: IDLE Enhancement Exception for All Branches +.............................................................. + +PEP 434(1) describes a general exemption for changes made to the IDLE +development environment shipped along with Python. This exemption makes +it possible for the IDLE developers to provide a more consistent user +experience across all supported versions of Python 2 and 3. + +For details of any IDLE changes, refer to the NEWS file for the specific +release. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0434/ + + +File: python.info, Node: PEP 466 Network Security Enhancements for Python 2 7, Next: PEP 477 Backport ensurepip PEP 453 to Python 2 7, Prev: PEP 434 IDLE Enhancement Exception for All Branches, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.15.3 PEP 466: Network Security Enhancements for Python 2.7 +............................................................... + +PEP 466(1) describes a number of network security enhancement proposals +that have been approved for inclusion in Python 2.7 maintenance +releases, with the first of those changes appearing in the Python 2.7.7 +release. + +PEP 466(2) related features added in Python 2.7.7: + + * *note hmac.compare_digest(): 10bf. was backported from Python 3 to + make a timing attack resistant comparison operation available to + Python 2 applications. (Contributed by Alex Gaynor; bpo-21306(3).) + + * OpenSSL 1.0.1g was upgraded in the official Windows installers + published on python.org. (Contributed by Zachary Ware; + bpo-21462(4).) + +PEP 466(5) related features added in Python 2.7.8: + + * *note hashlib.pbkdf2_hmac(): 50a. was backported from Python 3 to + make a hashing algorithm suitable for secure password storage + broadly available to Python 2 applications. (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).) + +PEP 466(9) related features added in Python 2.7.9: + + * Most of Python 3.4’s *note ssl: d0. module was backported. This + means *note ssl: d0. now supports Server Name Indication, TLS1.x + settings, access to the platform certificate store, the *note + SSLContext: 296. class, and other features. (Contributed by Alex + Gaynor and David Reid; bpo-21308(10).) + + Refer to the “Version added: 2.7.9” notes in the module + documentation for specific details. + + * *note os.urandom(): 51e. was changed to cache a file descriptor to + ‘/dev/urandom’ instead of reopening ‘/dev/urandom’ on every call. + (Contributed by Alex Gaynor; bpo-21305(11).) + + * *note hashlib.algorithms_guaranteed: 135f. and *note + hashlib.algorithms_available: 1360. were backported from Python 3 + to make it easier for Python 2 applications to select the strongest + available hash algorithm. (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 Backport ensurepip PEP 453 to Python 2 7, Next: PEP 476 Enabling certificate verification by default for stdlib http clients<2>, Prev: PEP 466 Network Security Enhancements for Python 2 7, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.15.4 PEP 477: Backport ensurepip (PEP 453) to Python 2.7 +............................................................. + +PEP 477(1) approves the inclusion of the PEP 453(2) ensurepip module and +the improved documentation that was enabled by it in the Python 2.7 +maintenance releases, appearing first in the Python 2.7.9 release. + +* Menu: + +* Bootstrapping pip By Default: Bootstrapping pip By Default<2>. +* Documentation Changes: Documentation Changes<2>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0477/ + + (2) https://peps.python.org/pep-0453/ + + +File: python.info, Node: Bootstrapping pip By Default<2>, Next: Documentation Changes<2>, Up: PEP 477 Backport ensurepip PEP 453 to Python 2 7 + +1.15.15.5 Bootstrapping pip By Default +...................................... + +The new *note ensurepip: 55. module (defined in PEP 453(1)) provides a +standard cross-platform mechanism to bootstrap the pip installer into +Python installations. The version of ‘pip’ included with Python 2.7.9 +is ‘pip’ 1.5.6, and future 2.7.x maintenance releases will update the +bundled version to the latest version of ‘pip’ that is available at the +time of creating the release candidate. + +By default, the commands ‘pip’, ‘pipX’ and ‘pipX.Y’ will be installed on +all platforms (where X.Y stands for the version of the Python +installation), along with the ‘pip’ Python package and its dependencies. + +For CPython *note source builds on POSIX systems: eee, the ‘make +install’ and ‘make altinstall’ commands do not bootstrap ‘pip’ by +default. This behaviour can be controlled through configure options, +and overridden through Makefile options. + +On Windows and Mac OS X, the CPython installers now default to +installing ‘pip’ along with CPython itself (users may opt out of +installing it during the installation process). Window users will need +to opt in to the automatic ‘PATH’ modifications to have ‘pip’ available +from the command line by default, otherwise it can still be accessed +through the Python launcher for Windows as ‘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: Documentation Changes<2>, Prev: Bootstrapping pip By Default<2>, Up: PEP 477 Backport ensurepip PEP 453 to Python 2 7 + +1.15.15.6 Documentation Changes +............................... + +As part of this change, the *note Installing Python Modules: ef0. and +distributing-index sections of the documentation have been completely +redesigned as short getting started and FAQ documents. Most packaging +documentation has now been moved out to the Python Packaging Authority +maintained Python Packaging User Guide(1) and the documentation of the +individual projects. + +However, as this migration is currently still incomplete, the legacy +versions of those guides remaining available as *note Building C and C++ +Extensions with setuptools: ef1. and *note Building C and C++ Extensions +with setuptools: ef2. + +See also +........ + +PEP 453(2) – Explicit bootstrapping of pip in Python installations + + PEP written by Donald Stufft and Nick Coghlan, implemented by + Donald Stufft, Nick Coghlan, Martin von Löwis and Ned Deily. + + ---------- Footnotes ---------- + + (1) https://packaging.python.org + + (2) https://peps.python.org/pep-0453/ + + +File: python.info, Node: PEP 476 Enabling certificate verification by default for stdlib http clients<2>, Next: PEP 493 HTTPS verification migration tools for Python 2 7, Prev: PEP 477 Backport ensurepip PEP 453 to Python 2 7, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.15.7 PEP 476: Enabling certificate verification by default for stdlib http clients +....................................................................................... + +PEP 476(1) updated *note httplib: 6e. and modules which use it, such as +*note urllib2: 10b. and *note xmlrpclib: 12e, 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. + +For applications which require the old previous behavior, they can pass +an alternate context: + + 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 Enabling certificate verification by default for stdlib http clients<2>, Up: New Features Added to Python 2 7 Maintenance Releases + +1.15.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: New Features Added to Python 2 7 Maintenance Releases + +1.15.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. + +(Contributed by Victor Stinner in bpo-23404(2).) + +Added in version 2.7.14. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: New Features Added to Python 2 7 Maintenance Releases + +1.15.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. + +(Contributed by Victor Stinner in bpo-23404(1).) + +Changed in version 2.7.14. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=23404 + + +File: python.info, Node: Acknowledgements, Prev: New Features Added to Python 2 7 Maintenance Releases, Up: What’s New in Python 2 7 + +1.15.16 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: 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.16 What’s New in Python 2.6 +============================= + + +Author: 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. + +Some significant new packages have been added to the standard library, +such as the *note multiprocessing: 94. and *note json: 82. modules, but +there aren’t many new features that aren’t related to Python 3.0 in some +way. + +Python 2.6 also sees a number of improvements and bugfixes throughout +the source. A search through the change logs finds there were 259 +patches applied and 612 bugs fixed between Python 2.5 and 2.6. Both +figures are likely to be underestimates. + +This article doesn’t attempt to provide a complete specification of the +new features, but instead provides a convenient overview. For full +details, you should refer to the documentation for Python 2.6. If you +want to understand the rationale for the design and implementation, +refer to the PEP for a particular new feature. Whenever possible, +“What’s New in Python” links to the bug/patch item for each change. + +* Menu: + +* Python 3.0: Python 3 0. +* Changes to the Development Process:: +* PEP 343; The ‘with’ statement: PEP 343 The ‘with’ statement. +* PEP 366; Explicit Relative Imports From a Main Module: PEP 366 Explicit Relative Imports From a Main Module. +* PEP 370; Per-user site-packages Directory: PEP 370 Per-user site-packages Directory. +* PEP 371; The multiprocessing Package: PEP 371 The multiprocessing Package. +* PEP 3101; Advanced String Formatting: PEP 3101 Advanced String Formatting. +* PEP 3105; print As a Function: PEP 3105 print As a Function. +* PEP 3110; Exception-Handling Changes: PEP 3110 Exception-Handling Changes. +* PEP 3112; Byte Literals: PEP 3112 Byte Literals. +* PEP 3116; New I/O Library: PEP 3116 New I/O Library. +* PEP 3118; Revised Buffer Protocol: PEP 3118 Revised Buffer Protocol. +* PEP 3119; Abstract Base Classes: PEP 3119 Abstract Base Classes. +* PEP 3127; Integer Literal Support and Syntax: PEP 3127 Integer Literal Support and Syntax. +* PEP 3129; Class Decorators: PEP 3129 Class Decorators. +* PEP 3141; A Type Hierarchy for Numbers: PEP 3141 A Type Hierarchy for Numbers. +* Other Language Changes: Other Language Changes<15>. +* New and Improved Modules: New and Improved Modules<2>. +* Deprecations and Removals:: +* Build and C API Changes: Build and C API Changes<9>. +* Porting to Python 2.6: Porting to Python 2 6. +* Acknowledgements: Acknowledgements<2>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0361/ + + +File: python.info, Node: Python 3 0, Next: Changes to the Development Process, Up: What’s New in Python 2 6 + +1.16.1 Python 3.0 +----------------- + +The development cycle for Python versions 2.6 and 3.0 was synchronized, +with the alpha and beta releases for both versions being made on the +same days. The development of 3.0 has influenced many features in 2.6. + +Python 3.0 is a far-ranging redesign of Python that breaks compatibility +with the 2.x series. This means that existing Python code will need +some conversion in order to run on Python 3.0. However, not all the +changes in 3.0 necessarily break compatibility. In cases where new +features won’t cause existing code to break, they’ve been backported to +2.6 and are described in this document in the appropriate place. Some +of the 3.0-derived features are: + + * A ‘__complex__()’ method for converting objects to a complex + number. + + * Alternate syntax for catching exceptions: ‘except TypeError as + exc’. + + * The addition of *note functools.reduce(): 12cf. as a synonym for + the built-in ‘reduce()’ function. + +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(): 129b. 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’. + +See also +........ + +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: Changes to the Development Process, Next: PEP 343 The ‘with’ statement, Prev: Python 3 0, Up: What’s New in Python 2 6 + +1.16.2 Changes to the Development Process +----------------------------------------- + +While 2.6 was being developed, the Python development process underwent +two significant changes: we switched from SourceForge’s issue tracker to +a customized Roundup installation, and the documentation was converted +from LaTeX to reStructuredText. + +* Menu: + +* New Issue Tracker; Roundup: New Issue Tracker Roundup. +* New Documentation Format; reStructuredText Using Sphinx: New Documentation Format reStructuredText Using Sphinx. + + +File: python.info, Node: New Issue Tracker Roundup, Next: New Documentation Format reStructuredText Using Sphinx, Up: Changes to the Development Process + +1.16.2.1 New Issue Tracker: Roundup +................................... + +For a long time, the Python developers had been growing increasingly +annoyed by SourceForge’s bug tracker. SourceForge’s hosted solution +doesn’t permit much customization; for example, it wasn’t possible to +customize the life cycle of issues. + +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. + +After posting a call for volunteers, a new Roundup installation was set +up at ‘https://bugs.python.org’. One installation of Roundup can host +multiple trackers, and this server now also hosts issue trackers for +Jython and for the Python web site. It will surely find other uses in +the future. Where possible, this edition of “What’s New in Python” +links to the bug/patch item for each change. + +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. + +See also +........ + +‘https://bugs.python.org’ + + The Python bug tracker. + +‘https://bugs.jython.org’: + + The Jython bug tracker. + +‘https://roundup.sourceforge.io/’ + + Roundup downloads and documentation. + +‘https://svn.python.org/view/tracker/importer/’ + + Martin von Löwis’s conversion scripts. + + ---------- 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: New Documentation Format reStructuredText Using Sphinx, Prev: New Issue Tracker Roundup, Up: Changes to the Development Process + +1.16.2.2 New Documentation Format: reStructuredText Using Sphinx +................................................................ + +The Python documentation was written using LaTeX since the project +started around 1989. In the 1980s and early 1990s, most documentation +was printed out for later study, not viewed online. LaTeX was widely +used because it provided attractive printed output while remaining +straightforward to write once the basic rules of the markup were +learned. + +Today LaTeX is still used for writing publications destined for +printing, but the landscape for programming tools has shifted. We no +longer print out reams of documentation; instead, we browse through it +online and HTML has become the most important format to support. +Unfortunately, converting LaTeX to HTML is fairly complicated and Fred +L. Drake Jr., the long-time Python documentation editor, spent a lot of +time maintaining the conversion process. Occasionally people would +suggest converting the documentation into SGML and later XML, but +performing a good conversion is a major task and no one ever committed +the time required to finish the job. + +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 concentrates on HTML output, producing attractively styled and +modern HTML; printed output is still supported through conversion to +LaTeX. The input format is reStructuredText, a markup syntax supporting +custom extensions and directives that is commonly used in the Python +community. + +Sphinx is a standalone package that can be used for writing, and almost +two dozen other projects (listed on the Sphinx web site(1)) have adopted +Sphinx as their documentation tool. + +See also +........ + +Documenting Python(2) + + Describes how to write for Python’s documentation. + +Sphinx(3) + + Documentation and code for the Sphinx toolchain. + +Docutils(4) + + The underlying reStructuredText parser and toolset. + + ---------- 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 The ‘with’ statement, Next: PEP 366 Explicit Relative Imports From a Main Module, Prev: Changes to the Development Process, Up: What’s New in Python 2 6 + +1.16.3 PEP 343: The ‘with’ statement +------------------------------------ + +The previous version, Python 2.5, added the ‘*note with: 5ce.’ statement +as an optional feature, to be enabled by a ‘from __future__ import +with_statement’ directive. In 2.6 the statement no longer needs to be +specially enabled; this means that ‘with’ is now always a keyword. The +rest of this section is a copy of the corresponding section from the +“What’s New in Python 2.5” document; if you’re familiar with the +‘‘with’’ statement from Python 2.5, you can skip this section. + +The ‘*note with: 5ce.’ statement clarifies code that previously would +use ‘try...finally’ blocks to ensure that clean-up code is executed. In +this section, I’ll discuss the statement as it will commonly be used. +In the next section, I’ll examine the implementation details and show +how to write objects for use with this statement. + +The ‘*note with: 5ce.’ statement is a control-flow structure whose basic +structure is: + + 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__(): 5c4. and *note __exit__(): 12f3. methods). + +The object’s *note __enter__(): 5c4. 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__(): 12f3. method is called, even if the block raised an +exception, and can therefore run clean-up code. + +Some standard Python objects now support the context management protocol +and can be used with the ‘*note with: 5ce.’ statement. File objects are +one example: + + with open('/etc/passwd', 'r') as f: + for line in f: + print line + ... more processing code ... + +After this statement has executed, the file object in 'f' will have been +automatically closed, even if the *note for: 2ec. loop raised an +exception part-way through the block. + + Note: In this case, 'f' is the same object created by *note open(): + 517, because *note __enter__(): 5c4. returns 'self'. + +The *note threading: ed. module’s locks and condition variables also +support the ‘*note with: 5ce.’ statement: + + lock = threading.Lock() + with lock: + # Critical section of code + ... + +The lock is acquired before the block is executed and always released +once the block is complete. + +The ‘localcontext()’ function in the *note decimal: 36. 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: + +* Writing Context Managers:: +* The contextlib module:: + + +File: python.info, Node: Writing Context Managers, Next: The contextlib module, Up: PEP 343 The ‘with’ statement + +1.16.3.1 Writing Context Managers +................................. + +Under the hood, the ‘*note with: 5ce.’ statement is fairly complicated. +Most people will only use ‘‘with’’ in company with existing objects and +don’t need to know these details, so you can skip the rest of this +section if you like. Authors of new objects will need to understand the +details of the underlying implementation and should keep reading. + +A high-level explanation of the context management protocol is: + + * The expression is evaluated and should result in an object called a + “context manager”. The context manager must have *note + __enter__(): 5c4. and *note __exit__(): 12f3. methods. + + * The context manager’s *note __enter__(): 5c4. method is called. + The value returned is assigned to 'VAR'. If no ‘as VAR’ clause is + present, the value is simply discarded. + + * The code in 'BLOCK' is executed. + + * If 'BLOCK' raises an exception, the context manager’s *note + __exit__(): 12f3. method is called with three arguments, the + exception details (‘type, value, traceback’, the same values + returned by *note sys.exc_info(): 686, 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: 5ce.’ statement will never realize + anything went wrong. + + * If 'BLOCK' didn’t raise an exception, the *note __exit__(): 12f3. + method is still called, but 'type', 'value', and 'traceback' are + all ‘None’. + +Let’s think through an example. I won’t present detailed code but will +only sketch the methods necessary for a database that supports +transactions. + +(For people unfamiliar with database terminology: a set of changes to +the database are grouped into a transaction. Transactions can be either +committed, meaning that all the changes are written into the database, +or rolled back, meaning that the changes are all discarded and the +database is unchanged. See any database textbook for more information.) + +Let’s assume there’s an object representing a database connection. Our +goal will be to let the user write code like this: + + 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__(): 5c4. 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: 5ce.’ 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__(): 12f3. 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. + +In the code below, execution will just fall off the end of the function, +returning the default value of ‘None’. ‘None’ is false, so the +exception will be re-raised automatically. If you wished, you could be +more explicit and add a *note return: 9ce. statement at the marked +location. + + 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: The contextlib module, Prev: Writing Context Managers, Up: PEP 343 The ‘with’ statement + +1.16.3.2 The contextlib module +.............................. + +The *note contextlib: 23. module provides some functions and a decorator +that are useful when writing objects for use with the ‘*note with: 5ce.’ +statement. + +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: 9cd. +will be executed as the *note __enter__(): 5c4. method, and the value +yielded will be the method’s return value that will get bound to the +variable in the ‘*note with: 5ce.’ statement’s ‘as’ clause, if any. The +code after the ‘yield’ will be executed in the *note __exit__(): 12f3. +method. Any exception raised in the block will be raised by the ‘yield’ +statement. + +Using this decorator, our database example from the previous section +could be written as: + + 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: + ... + +The *note contextlib: 23. module also has a ‘nested(mgr1, mgr2, ...)’ +function that combines a number of context managers so you don’t need to +write nested ‘*note with: 5ce.’ statements. In this example, the single +‘‘with’’ statement both starts a database transaction and acquires a +thread lock: + + lock = threading.Lock() + with nested (db_transaction(db), lock) as (cursor, locked): + ... + +Finally, the ‘closing()’ 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) + +See also +........ + +PEP 343(1) - The “with” statement + + PEP written by Guido van Rossum and Nick Coghlan; implemented by + Mike Bland, Guido van Rossum, and Neal Norwitz. The PEP shows the + code generated for a ‘*note with: 5ce.’ statement, which can be + helpful in learning how the statement works. + +The documentation for the *note contextlib: 23. module. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0343/ + + +File: python.info, Node: PEP 366 Explicit Relative Imports From a Main Module, Next: PEP 370 Per-user site-packages Directory, Prev: PEP 343 The ‘with’ statement, Up: What’s New in Python 2 6 + +1.16.4 PEP 366: Explicit Relative Imports From a Main Module +------------------------------------------------------------ + +Python’s *note -m: 5dd. switch allows running a module as a script. +When you ran a module that was located inside a package, relative +imports didn’t work correctly. + +The fix for Python 2.6 adds a *note module.__package__: 2db. attribute. +When this attribute is present, relative imports will be relative to the +value of this attribute instead of the *note __name__: 1374. attribute. + +PEP 302-style importers can then set *note __package__: 2db. as +necessary. The *note runpy: be. module that implements the *note -m: +5dd. switch now does this, so relative imports will now work correctly +in scripts running from inside a package. + + +File: python.info, Node: PEP 370 Per-user site-packages Directory, Next: PEP 371 The multiprocessing Package, Prev: PEP 366 Explicit Relative Imports From a Main Module, Up: What’s New in Python 2 6 + +1.16.5 PEP 370: Per-user ‘site-packages’ Directory +-------------------------------------------------- + +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 introduces a convention for user-specific site directories. +The directory varies depending on the platform: + + * Unix and Mac OS X: ‘~/.local/’ + + * Windows: ‘%APPDATA%/Python’ + +Within this directory, there will be version-specific subdirectories, +such as ‘lib/python2.6/site-packages’ on Unix/Mac OS and +‘Python26/site-packages’ on Windows. + +If you don’t like the default directory, it can be overridden by an +environment variable. *note PYTHONUSERBASE: 1376. 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. + +The feature can be disabled entirely by running Python with the *note +-s: 1377. option or setting the *note PYTHONNOUSERSITE: 1378. +environment variable. + +See also +........ + +PEP 370(1) - Per-user ‘site-packages’ Directory + + PEP written and implemented by Christian Heimes. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0370/ + + +File: python.info, Node: PEP 371 The multiprocessing Package, Next: PEP 3101 Advanced String Formatting, Prev: PEP 370 Per-user site-packages Directory, Up: What’s New in Python 2 6 + +1.16.6 PEP 371: The ‘multiprocessing’ Package +--------------------------------------------- + +The new *note multiprocessing: 94. package lets Python programs create +new processes that will perform a computation and return a result to the +parent. The parent and child processes can communicate using queues and +pipes, synchronize their operations using locks and semaphores, and can +share simple arrays of data. + +The *note multiprocessing: 94. module started out as an exact emulation +of the *note threading: ed. 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 +‘Process’, which is passed a callable object and a collection of +arguments. The ‘start()’ method sets the callable running in a +subprocess, after which you can call the ‘is_alive()’ method to check +whether the subprocess is still running and the ‘join()’ method to wait +for the process to exit. + +Here’s a simple example where the subprocess will calculate a factorial. +The function doing the calculation is written strangely so that it takes +significantly longer when the input argument is a multiple of 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 + +A *note Queue: 137a. is used to communicate the result of the factorial. +The *note Queue: 137a. object is stored in a global variable. The child +process will use the value of the variable when the child was created; +because it’s a *note Queue: 137a, parent and child can use the object to +communicate. (If the parent were to change the value of the global +variable, the child’s value would be unaffected, and vice versa.) + +Two other classes, ‘Pool’ and ‘Manager’, provide higher-level +interfaces. ‘Pool’ will create a fixed number of worker processes, and +requests can then be distributed to the workers by calling ‘apply()’ or +‘apply_async()’ to add a single request, and *note map(): 860. or +‘map_async()’ 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 + +This produces the following output: + + 1 + 39916800 + 51090942171709440000 + 8222838654177922817725562880000000 + 33452526613163807108170062053440751665152000000000 + ... + +The other high-level interface, the ‘Manager’ 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(): 258. 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 +‘Lock()’, ‘RLock()’, and ‘Semaphore()’ 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 + +This will produce the output: + + 1 1 + 11 39916800 + 21 51090942171709440000 + 31 8222838654177922817725562880000000 + 41 33452526613163807108170062053440751665152000000000 + 51 15511187532873822802242430164693032110632597200169861120000... + +See also +........ + +The documentation for the *note multiprocessing: 94. module. + +PEP 371(1) - Addition of the multiprocessing package + + PEP written by Jesse Noller and Richard Oudkerk; implemented by + Richard Oudkerk and Jesse Noller. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0371/ + + +File: python.info, Node: PEP 3101 Advanced String Formatting, Next: PEP 3105 print As a Function, Prev: PEP 371 The multiprocessing Package, Up: What’s New in Python 2 6 + +1.16.7 PEP 3101: Advanced String Formatting +------------------------------------------- + +In Python 3.0, the ‘%’ operator is supplemented by a more powerful +string formatting method, *note format(): 61b. Support for the *note +str.format(): 61d. 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' + +Curly brackets can be escaped by doubling them: + + >>> "Empty dict: {{}}".format() + "Empty dict: {}" + +Field names can be integers indicating positional arguments, such as +‘{0}’, ‘{1}’, etc. or names of keyword arguments. You can also supply +compound field names that read attributes or access dictionary keys: + + >>> 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' + +Note that when using dictionary-style notation such as ‘[.mp4]’, you +don’t need to put any quotation marks around the string; it will look up +the value using ‘.mp4’ as the key. Strings beginning with a number will +be converted to an integer. You can’t write more complicated +expressions inside a format string. + +So far we’ve shown how to specify which field to substitute into the +resulting string. The precise formatting used is also controllable by +adding a colon followed by a format specifier. For example: + + >>> # 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' + +Format specifiers can reference other fields through nesting: + + >>> fmt = '{0:{1}}' + >>> width = 15 + >>> fmt.format('Invoice #1234', width) + 'Invoice #1234 ' + >>> width = 35 + >>> fmt.format('Invoice #1234', width) + 'Invoice #1234 ' + +The alignment of a field within the desired width can be specified: + +Character Effect + +---------------------------------------------------------------------- + +< (default) Left-align + + +> Right-align + + +^ Center + + += (For numeric types only) Pad after the sign. + + +Format specifiers can also include a presentation type, which controls +how the value is formatted. For example, floating-point numbers can be +formatted as a general number or in exponential notation: + + >>> '{0:g}'.format(3.75) + '3.75' + >>> '{0:e}'.format(3.75) + '3.750000e+00' + +A variety of presentation types are available. Consult the 2.6 +documentation for a *note complete list: 137c.; here’s a sample: + +‘b’ Binary. Outputs the number in base 2. + + +‘c’ Character. Converts the integer to the corresponding Unicode character + before printing. + + +‘d’ Decimal Integer. Outputs the number in base 10. + + +‘o’ Octal format. Outputs the number in base 8. + + +‘x’ Hex format. Outputs the number in base 16, using lower-case letters for + the digits above 9. + + +‘e’ Exponent notation. Prints the number in scientific notation using the + letter ‘e’ to indicate the exponent. + + +‘g’ General format. This prints the number as a fixed-point number, unless + the number is too large, in which case it switches to ‘e’ exponent + notation. + + +‘n’ Number. This is the same as ‘g’ (for floats) or ‘d’ (for integers), + except that it uses the current locale setting to insert the appropriate + number separator characters. + + +‘%’ Percentage. Multiplies the number by 100 and displays in fixed (‘f’) + format, followed by a percent sign. + + +Classes and types can define a ‘__format__()’ 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(): 61b. builtin that will format a single +value. It calls the type’s ‘__format__()’ method with the provided +specifier: + + >>> format(75.6564, '.2f') + '75.66' + +See also +........ + +*note Format String Syntax: 137c. + + The reference documentation for format fields. + +PEP 3101(1) - Advanced String Formatting + + PEP written by Talin. Implemented by Eric Smith. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3101/ + + +File: python.info, Node: PEP 3105 print As a Function, Next: PEP 3110 Exception-Handling Changes, Prev: PEP 3101 Advanced String Formatting, Up: What’s New in Python 2 6 + +1.16.8 PEP 3105: ‘print’ As a Function +-------------------------------------- + +The ‘print’ statement becomes the *note print(): f70. function in Python +3.0. Making *note print(): f70. a function makes it possible to replace +the function by doing ‘def print(...)’ or importing a new function from +somewhere else. + +Python 2.6 has a ‘__future__’ import that removes ‘print’ as language +syntax, letting you use the functional form instead. For example: + + >>> from __future__ import print_function + >>> print('# of entries', len(dictionary), file=sys.stderr) + +The signature of the new function is: + + def print(*args, sep=' ', end='\n', file=None) + +The parameters are: + + * 'args': positional arguments whose values will be printed out. + + * 'sep': the separator, which will be printed between arguments. + + * 'end': the ending text, which will be printed after all of the + arguments have been output. + + * 'file': the file object to which the output will be sent. + +See also +........ + +PEP 3105(1) - Make print a function + + PEP written by Georg Brandl. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3105/ + + +File: python.info, Node: PEP 3110 Exception-Handling Changes, Next: PEP 3112 Byte Literals, Prev: PEP 3105 print As a Function, Up: What’s New in Python 2 6 + +1.16.9 PEP 3110: Exception-Handling Changes +------------------------------------------- + +One error that Python programmers occasionally make is writing the +following code: + + try: + ... + except TypeError, ValueError: # Wrong! + ... + +The author is probably trying to catch both *note TypeError: 534. and +*note ValueError: 204. exceptions, but this code actually does something +different: it will catch *note TypeError: 534. and bind the resulting +exception object to the local name ‘"ValueError"’. The *note +ValueError: 204. exception will not be caught at all. The correct code +specifies a tuple of exceptions: + + try: + ... + except (TypeError, ValueError): + ... + +This error happens because the use of the comma here is ambiguous: does +it indicate two different nodes in the parse tree, or a single node +that’s a tuple? + +Python 3.0 makes this unambiguous by replacing the comma with the word +“as”. To catch an exception and store the exception object in the +variable ‘exc’, you must write: + + try: + ... + except TypeError as exc: + ... + +Python 3.0 will only support the use of “as”, and therefore interprets +the first example as catching two different exceptions. Python 2.6 +supports both the comma and “as”, so existing code will continue to +work. We therefore suggest using “as” when writing new Python code that +will only be executed with 2.6. + +See also +........ + +PEP 3110(1) - Catching Exceptions in Python 3000 + + PEP written and implemented by Collin Winter. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3110/ + + +File: python.info, Node: PEP 3112 Byte Literals, Next: PEP 3116 New I/O Library, Prev: PEP 3110 Exception-Handling Changes, Up: What’s New in Python 2 6 + +1.16.10 PEP 3112: Byte Literals +------------------------------- + +Python 3.0 adopts Unicode as the language’s fundamental string type and +denotes 8-bit literals differently, either as ‘b'string'’ or using a +*note bytes: 1c2. constructor. For future compatibility, Python 2.6 +adds *note bytes: 1c2. as a synonym for the *note str: 447. type, and it +also supports the ‘b''’ notation. + +The 2.6 *note str: 447. differs from 3.0’s *note bytes: 1c2. type in +various ways; most notably, the constructor is completely different. In +3.0, ‘bytes([65, 66, 67])’ is 3 elements long, containing the bytes +representing ‘ABC’; in 2.6, ‘bytes([65, 66, 67])’ returns the 12-byte +string representing the *note str(): 447. of the list. + +The primary use of *note bytes: 1c2. in 2.6 will be to write tests of +object type such as ‘isinstance(x, bytes)’. This will help the 2to3 +converter, which can’t tell whether 2.x code intends strings to contain +either characters or 8-bit bytes; you can now use either *note bytes: +1c2. or *note str: 447. to represent your intention exactly, and the +resulting code will also be correct in Python 3.0. + +There’s also a ‘__future__’ import that causes all string literals to +become Unicode strings. This means that ‘\u’ escape sequences can be +used to include Unicode characters: + + 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: 78d. +Python 2.6 uses ‘#define’ to support using the names *note +PyBytesObject(): 78d, *note PyBytes_Check(): 1380, *note +PyBytes_FromStringAndSize(): 1381, and all the other functions and +macros used with strings. + +Instances of the *note bytes: 1c2. type are immutable just as strings +are. A new *note bytearray: 53a. type stores a mutable sequence of +bytes: + + >>> 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 +‘startswith()’/‘endswith()’, ‘find()’/‘rfind()’, and some of the methods +of lists, such as ‘append()’, ‘pop()’, and ‘reverse()’. + + >>> b = bytearray('ABC') + >>> b.append('d') + >>> b.append(ord('e')) + >>> b + bytearray(b'ABCde') + +There’s also a corresponding C API, with *note PyByteArray_FromObject(): +1382, *note PyByteArray_FromStringAndSize(): 1383, and various other +functions. + +See also +........ + +PEP 3112(1) - Bytes literals in Python 3000 + + PEP written by Jason Orendorff; backported to 2.6 by Christian + Heimes. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3112/ + + +File: python.info, Node: PEP 3116 New I/O Library, Next: PEP 3118 Revised Buffer Protocol, Prev: PEP 3112 Byte Literals, Up: What’s New in Python 2 6 + +1.16.11 PEP 3116: New I/O Library +--------------------------------- + +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 *note readline(): ba, for example. Python 3.0 introduces a +layered I/O library in the *note io: 7f. module that separates buffering +and text-handling features from the fundamental read and write +operations. + +There are three levels of abstract base classes provided by the *note +io: 7f. module: + + * ‘RawIOBase’ defines raw I/O operations: ‘read()’, ‘readinto()’, + ‘write()’, ‘seek()’, ‘tell()’, ‘truncate()’, and ‘close()’. Most + of the methods of this class will often map to a single system + call. There are also ‘readable()’, ‘writable()’, and ‘seekable()’ + methods for determining what operations a given object will allow. + + Python 3.0 has concrete implementations of this class for files and + sockets, but Python 2.6 hasn’t restructured its file and socket + objects in this way. + + * ‘BufferedIOBase’ 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 + ‘RawIOBase’, and adds a ‘raw’ attribute holding the underlying raw + object. + + There are five concrete classes implementing this ABC. + ‘BufferedWriter’ and ‘BufferedReader’ are for objects that support + write-only or read-only usage that have a ‘seek()’ method for + random access. ‘BufferedRandom’ objects support read and write + access upon the same underlying stream, and ‘BufferedRWPair’ is for + objects such as TTYs that have both read and write operations + acting upon unconnected streams of data. The ‘BytesIO’ class + supports reading, writing, and seeking over an in-memory buffer. + + * ‘TextIOBase’: Provides functions for reading and writing strings + (remember, strings will be Unicode in Python 3.0), and supporting + *note universal newlines: d3a. ‘TextIOBase’ defines the *note + readline(): ba. method and supports iteration upon objects. + + There are two concrete implementations. ‘TextIOWrapper’ wraps a + buffered I/O object, supporting all of the methods for text I/O and + adding a ‘buffer’ attribute for access to the underlying object. + ‘StringIO’ simply buffers everything in memory without ever writing + anything to disk. + + (In Python 2.6, *note io.StringIO: f22. 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: 7f. module will be rewritten into C for + speed, and perhaps the C implementation will be backported to the + 2.x releases.) + +In Python 2.6, the underlying implementations haven’t been restructured +to build on top of the *note io: 7f. module’s classes. The module is +being provided to make it easier to write code that’s forward-compatible +with 3.0, and to save developers the effort of writing their own +implementations of buffering and text I/O. + +See also +........ + +PEP 3116(1) - New I/O + + PEP written by Daniel Stutzbach, Mike Verdone, and Guido van + Rossum. Code by Guido van Rossum, Georg Brandl, Walter Doerwald, + Jeremy Hylton, Martin von Löwis, Tony Lownds, and others. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3116/ + + +File: python.info, Node: PEP 3118 Revised Buffer Protocol, Next: PEP 3119 Abstract Base Classes, Prev: PEP 3116 New I/O Library, Up: What’s New in Python 2 6 + +1.16.12 PEP 3118: Revised Buffer Protocol +----------------------------------------- + +The buffer protocol is a C-level API that lets Python types exchange +pointers into their internal representations. A memory-mapped file can +be viewed as a buffer of characters, for example, and this lets another +module such as *note re: b9. treat memory-mapped files as a string of +characters to be searched. + +The primary users of the buffer protocol are numeric-processing packages +such as NumPy, which expose the internal representation of arrays so +that callers can write data directly into an array instead of going +through a slower API. This PEP updates the buffer protocol in light of +experience from NumPy development, adding a number of new features such +as indicating the shape of an array or locking a memory region. + +The most important new C API function is ‘PyObject_GetBuffer(PyObject +*obj, Py_buffer *view, int flags)’, which takes an object and a set of +flags, and fills in the ‘Py_buffer’ structure with information about the +object’s memory representation. Objects can use this operation to lock +memory in place while an external caller could be modifying the +contents, so there’s a corresponding ‘PyBuffer_Release(Py_buffer *view)’ +to indicate that the external caller is done. + +The 'flags' argument to *note PyObject_GetBuffer(): 395. specifies +constraints upon the memory returned. Some examples are: + + * *note PyBUF_WRITABLE: 1386. indicates that the memory must be + writable. + + * ‘PyBUF_LOCK’ requests a read-only or exclusive lock on the memory. + + * *note PyBUF_C_CONTIGUOUS: 1387. and *note PyBUF_F_CONTIGUOUS: 1388. + requests a C-contiguous (last dimension varies the fastest) or + Fortran-contiguous (first dimension varies the fastest) array + layout. + +Two new argument codes for *note PyArg_ParseTuple(): 56e, ‘s*’ and ‘z*’, +return locked buffer objects for a parameter. + +See also +........ + +PEP 3118(1) - Revising the buffer protocol + + PEP written by Travis Oliphant and Carl Banks; implemented by + Travis Oliphant. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3118/ + + +File: python.info, Node: PEP 3119 Abstract Base Classes, Next: PEP 3127 Integer Literal Support and Syntax, Prev: PEP 3118 Revised Buffer Protocol, Up: What’s New in Python 2 6 + +1.16.13 PEP 3119: Abstract Base Classes +--------------------------------------- + +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 ‘ABCMeta’, special handling of this +metaclass by the *note isinstance(): 43d. and *note issubclass(): 7bc. +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()’? *note +copy(): 25. and ‘update()’? Iterating over the object with *note +iter(): 7d2.? + +The Python 2.6 *note collections: 1d. module includes a number of +different ABCs that represent these distinctions. ‘Iterable’ indicates +that a class defines ‘__iter__()’, and ‘Container’ means the class +defines a ‘__contains__()’ 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. + +You can derive your own classes from a particular ABC to indicate they +support that ABC’s interface: + + 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 +‘register()’ method: + + import collections + + class Storage: + ... + + collections.MutableMapping.register(Storage) + +For classes that you write, deriving from the ABC is probably clearer. +The ‘register()’ 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) + +Classes should obey the semantics specified by an ABC, but Python can’t +check this; it’s up to the class author to understand the ABC’s +requirements and to implement the code accordingly. + +To check whether an object supports a particular interface, you can now +write: + + def func(d): + if not isinstance(d, collections.MutableMapping): + raise ValueError("Mapping object expected, not %r" % d) + +Don’t feel that you must now begin writing lots of checks as in the +above example. Python has a strong tradition of duck-typing, where +explicit type-checking is never done and code simply calls methods on an +object, trusting that those methods will be there and raising an +exception if they aren’t. Be judicious in checking for ABCs and only do +it where it’s absolutely necessary. + +You can write your own ABCs by using ‘abc.ABCMeta’ as the metaclass in a +class definition: + + 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 ‘@abstractmethod’ 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 "", line 1, in + TypeError: Can't instantiate abstract class Circle with abstract methods draw + >>> + +Abstract data attributes can be declared using the ‘@abstractproperty’ +decorator: + + from abc import abstractproperty + ... + + @abstractproperty + def readonly(self): + return self._x + +Subclasses must then define a ‘readonly()’ property. + +See also +........ + +PEP 3119(1) - Introducing Abstract Base Classes + + PEP written by Guido van Rossum and Talin. Implemented by Guido + van Rossum. Backported to 2.6 by Benjamin Aranguren, with Alex + Martelli. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3119/ + + +File: python.info, Node: PEP 3127 Integer Literal Support and Syntax, Next: PEP 3129 Class Decorators, Prev: PEP 3119 Abstract Base Classes, Up: What’s New in Python 2 6 + +1.16.14 PEP 3127: Integer Literal Support and Syntax +---------------------------------------------------- + +Python 3.0 changes the syntax for octal (base-8) integer literals, +prefixing them with “0o” or “0O” instead of a leading zero, and adds +support for binary (base-2) integer literals, signalled by a “0b” or +“0B” prefix. + +Python 2.6 doesn’t drop support for a leading 0 signalling an octal +number, but it does add support for “0o” and “0b”: + + >>> 0o21, 2*8 + 1 + (17, 17) + >>> 0b101111 + 47 + +The *note oct(): 12c1. builtin still returns numbers prefixed with a +leading zero, and a new *note bin(): 129b. builtin returns the binary +representation for a number: + + >>> oct(42) + '052' + >>> future_builtins.oct(42) + '0o52' + >>> bin(173) + '0b10101101' + +The *note int(): 259. and ‘long()’ builtins will now accept the “0o” and +“0b” prefixes when base-8 or base-2 are requested, or when the 'base' +argument is zero (signalling that the base used should be determined +from the string): + + >>> int ('0o52', 0) + 42 + >>> int('1101', 2) + 13 + >>> int('0b1101', 2) + 13 + >>> int('0b1101', 0) + 13 + +See also +........ + +PEP 3127(1) - Integer Literal Support and Syntax + + PEP written by Patrick Maupin; backported to 2.6 by Eric Smith. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3127/ + + +File: python.info, Node: PEP 3129 Class Decorators, Next: PEP 3141 A Type Hierarchy for Numbers, Prev: PEP 3127 Integer Literal Support and Syntax, Up: What’s New in Python 2 6 + +1.16.15 PEP 3129: Class Decorators +---------------------------------- + +Decorators have been extended from functions to classes. It’s now legal +to write: + + @foo + @bar + class A: + pass + +This is equivalent to: + + class A: + pass + + A = foo(bar(A)) + +See also +........ + +PEP 3129(1) - Class Decorators + + PEP written by Collin Winter. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3129/ + + +File: python.info, Node: PEP 3141 A Type Hierarchy for Numbers, Next: Other Language Changes<15>, Prev: PEP 3129 Class Decorators, Up: What’s New in Python 2 6 + +1.16.16 PEP 3141: A Type Hierarchy for Numbers +---------------------------------------------- + +Python 3.0 adds several abstract base classes for numeric types inspired +by Scheme’s numeric tower. These classes were backported to 2.6 as the +*note numbers: 9e. module. + +The most general ABC is ‘Number’. It defines no operations at all, and +only exists to allow checking if an object is a number by doing +‘isinstance(obj, Number)’. + +‘Complex’ is a subclass of ‘Number’. Complex numbers can undergo the +basic operations of addition, subtraction, multiplication, division, and +exponentiation, and you can retrieve the real and imaginary parts and +obtain a number’s conjugate. Python’s built-in complex type is an +implementation of ‘Complex’. + +‘Real’ further derives from ‘Complex’, and adds operations that only +work on real numbers: ‘floor()’, ‘trunc()’, rounding, taking the +remainder mod N, floor division, and comparisons. + +‘Rational’ numbers derive from ‘Real’, have ‘numerator’ and +‘denominator’ properties, and can be converted to floats. Python 2.6 +adds a simple rational-number class, ‘Fraction’, in the *note fractions: +5d. module. (It’s called ‘Fraction’ instead of ‘Rational’ to avoid a +name clash with *note numbers.Rational: 12b1.) + +‘Integral’ numbers derive from ‘Rational’, and can be shifted left and +right with ‘<<’ and ‘>>’, combined using bitwise operations such as ‘&’ +and ‘|’, and can be used as array indexes and slice boundaries. + +In Python 3.0, the PEP slightly redefines the existing builtins *note +round(): 12cd, *note math.floor(): 138d, *note math.ceil(): 138e, and +adds a new one, *note math.trunc(): 138f, that’s been backported to +Python 2.6. *note math.trunc(): 138f. rounds toward zero, returning the +closest ‘Integral’ that’s between the function’s argument and zero. + +See also +........ + +PEP 3141(1) - A Type Hierarchy for Numbers + + PEP written by Jeffrey Yasskin. + +Scheme's numerical tower(2), from the Guile manual. + +Scheme's number datatypes(3) from the R5RS Scheme specification. + +* Menu: + +* The fractions Module:: + + ---------- 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: The fractions Module, Up: PEP 3141 A Type Hierarchy for Numbers + +1.16.16.1 The ‘fractions’ Module +................................ + +To fill out the hierarchy of numeric types, the *note fractions: 5d. +module provides a rational-number class. Rational numbers store their +values as a numerator and denominator forming a fraction, and can +exactly represent numbers such as ‘2/3’ that floating-point numbers can +only approximate. + +The ‘Fraction’ constructor takes two ‘Integral’ values that will be the +numerator and denominator of the resulting fraction. + + >>> 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) + +Note that values that can only be approximated by floating-point +numbers, such as 1./3, are not simplified to the number being +approximated; the fraction attempts to match the floating-point value +'exactly'. + +The *note fractions: 5d. module is based upon an implementation by +Sjoerd Mullender that was in Python’s ‘Demo/classes/’ directory for a +long time. This implementation was significantly updated by Jeffrey +Yasskin. + + +File: python.info, Node: Other Language Changes<15>, Next: New and Improved Modules<2>, Prev: PEP 3141 A Type Hierarchy for Numbers, Up: What’s New in Python 2 6 + +1.16.17 Other Language Changes +------------------------------ + +Some smaller changes made to the core Python language are: + + * Directories and zip archives containing a ‘__main__.py’ file can + now be executed directly by passing their name to the interpreter. + The directory or zip archive is automatically inserted as the first + entry in sys.path. (Suggestion and initial patch by Andy Chu, + subsequently revised by Phillip J. Eby and Nick Coghlan; + bpo-1739468(1).) + + * The *note hasattr(): 4ce. function was catching and ignoring all + errors, under the assumption that they meant a ‘__getattr__()’ + method was failing somehow and the return value of *note hasattr(): + 4ce. would therefore be ‘False’. This logic shouldn’t be applied + to *note KeyboardInterrupt: 9d1. and *note SystemExit: d40, + however; Python 2.6 will no longer discard such exceptions when + *note hasattr(): 4ce. encounters them. (Fixed by Benjamin + Peterson; bpo-2196(2).) + + * When calling a function using the ‘**’ syntax to provide keyword + arguments, you are no longer required to use a Python dictionary; + any mapping will now work: + + >>> 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).) + + It’s also become legal to provide keyword arguments after a ‘*args’ + argument to a function call. + + >>> def f(*args, **kw): + ... print args, kw + ... + >>> f(1,2,3, *(4,5,6), keyword=13) + (1, 2, 3, 4, 5, 6) {'keyword': 13} + + Previously this would have been a syntax error. (Contributed by + Amaury Forgeot d’Arc; bpo-3473(4).) + + * A new builtin, ‘next(iterator, [default])’ returns the next item + from the specified iterator. If the 'default' argument is + supplied, it will be returned if 'iterator' has been exhausted; + otherwise, the *note StopIteration: bfa. exception will be raised. + (Backported in bpo-2719(5).) + + * Tuples now have ‘index()’ and ‘count()’ methods matching the list + type’s ‘index()’ and ‘count()’ methods: + + >>> t = (0,1,2,3,4,0,1,2) + >>> t.index(3) + 3 + >>> t.count(0) + 2 + + (Contributed by Raymond Hettinger) + + * The built-in types now have improved support for extended slicing + syntax, accepting various combinations of ‘(start, stop, step)’. + Previously, the support was partial and certain corner cases + wouldn’t work. (Implemented by Thomas Wouters.) + + * Properties now have three attributes, ‘getter’, ‘setter’ and + ‘deleter’, that are decorators providing useful shortcuts for + adding a getter, setter or deleter function to an existing + property. You would use them like this: + + 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 + + * Several methods of the built-in set types now accept multiple + iterables: ‘intersection()’, ‘intersection_update()’, ‘union()’, + ‘update()’, ‘difference()’ and ‘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.) + + * Many floating-point features were added. The *note float(): 2f1. + function will now turn the string ‘nan’ into an IEEE 754 Not A + Number value, and ‘+inf’ and ‘-inf’ into positive or negative + infinity. This works on any platform with IEEE 754 semantics. + (Contributed by Christian Heimes; bpo-1635(6).) + + Other functions in the *note math: 8e. module, ‘isinf()’ and + ‘isnan()’, return true if their floating-point argument is infinite + or Not A Number. (bpo-1640(7)) + + Conversion functions were added to convert floating-point numbers + into hexadecimal strings (bpo-3008(8)). These functions convert + floats to and from a string representation without introducing + rounding errors from the conversion between decimal and binary. + Floats have a *note hex(): 12c2. method that returns a string + representation, and the ‘float.fromhex()’ method converts a string + back into a number: + + >>> a = 3.75 + >>> a.hex() + '0x1.e000000000000p+1' + >>> float.fromhex('0x1.e000000000000p+1') + 3.75 + >>> b=1./3 + >>> b.hex() + '0x1.5555555555555p-2' + + * A numerical nicety: when creating a complex number from two floats + on systems that support signed zeros (-0 and +0), the *note + complex(): 2f2. constructor will now preserve the sign of the zero. + (Fixed by Mark T. Dickinson; bpo-1507(9).) + + * Classes that inherit a ‘__hash__()’ method from a parent class can + set ‘__hash__ = None’ to indicate that the class isn’t hashable. + This will make ‘hash(obj)’ raise a *note TypeError: 534. and the + class will not be indicated as implementing the ‘Hashable’ ABC. + + You should do this when you’ve defined a ‘__cmp__()’ or ‘__eq__()’ + method that compares objects by their value rather than by + identity. All objects have a default hash method that uses + ‘id(obj)’ as the hash value. There’s no tidy way to remove the + ‘__hash__()’ method inherited from a parent class, so assigning + ‘None’ was implemented as an override. At the C level, extensions + can set ‘tp_hash’ to *note PyObject_HashNotImplemented(): 1392. + (Fixed by Nick Coghlan and Amaury Forgeot d’Arc; bpo-2235(10).) + + * The *note GeneratorExit: 1393. exception now subclasses *note + BaseException: 5b7. instead of *note Exception: 9d9. This means + that an exception handler that does ‘except Exception:’ will not + inadvertently catch *note GeneratorExit: 1393. (Contributed by + Chad Austin; bpo-1537(11).) + + * Generator objects now have a ‘gi_code’ attribute that refers to the + original code object backing the generator. (Contributed by Collin + Winter; bpo-1473257(12).) + + * The *note compile(): 192. built-in function now accepts keyword + arguments as well as positional parameters. (Contributed by Thomas + Wouters; bpo-1444529(13).) + + * The *note complex(): 2f2. constructor now accepts strings + containing parenthesized complex numbers, meaning that + ‘complex(repr(cplx))’ will now round-trip values. For example, + ‘complex('(3+4j)')’ now returns the value (3+4j). + (bpo-1491866(14)) + + * The string ‘translate()’ method now accepts ‘None’ as the + translation table parameter, which is treated as the identity + transformation. This makes it easier to carry out operations that + only delete characters. (Contributed by Bengt Richter and + implemented by Raymond Hettinger; bpo-1193128(15).) + + * The built-in *note dir(): 62e. function now checks for a + ‘__dir__()’ method on the objects it receives. This method must + return a list of strings containing the names of valid attributes + for the object, and lets the object control the value that *note + dir(): 62e. produces. Objects that have ‘__getattr__()’ or + ‘__getattribute__()’ methods can use this to advertise + pseudo-attributes they will honor. (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__: 1394, and ‘im_func’ is also available as *note + __func__: 12ef. The old names are still supported in Python 2.6, + but are gone in 3.0. + + * An obscure change: when you use the *note locals(): 141. function + inside a *note class: 12ca. statement, the resulting dictionary no + longer returns free variables. (Free variables, in this case, are + variables referenced in the ‘class’ statement that aren’t + attributes of the class.) + +* Menu: + +* Optimizations: Optimizations<14>. +* Interpreter Changes: Interpreter Changes<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: Optimizations<14>, Next: Interpreter Changes<2>, Up: Other Language Changes<15> + +1.16.17.1 Optimizations +....................... + + * The *note warnings: 112. module has been rewritten in C. This makes + it possible to invoke warnings from the parser, and may also make + the interpreter’s startup faster. (Contributed by Neal Norwitz and + Brett Cannon; bpo-1631171(1).) + + * Type objects now have a cache of methods that can reduce the work + required to find the correct method implementation for a particular + class; once cached, the interpreter doesn’t need to traverse base + classes to figure out the right method to call. The cache is + cleared if a base class or the class itself is modified, so the + cache should remain correct even in the face of Python’s dynamic + nature. (Original optimization implemented by Armin Rigo, updated + for Python 2.6 by Kevin Jacobs; bpo-1700288(2).) + + By default, this change is only applied to types that are included + with the Python core. Extension modules may not necessarily be + compatible with this cache, so they must explicitly add + ‘Py_TPFLAGS_HAVE_VERSION_TAG’ to the module’s ‘tp_flags’ field to + enable the method cache. (To be compatible with the method cache, + the extension module’s code must not directly access and modify the + ‘tp_dict’ member of any of the types it implements. Most modules + don’t do this, but it’s impossible for the Python interpreter to + determine that. See bpo-1878(3) for some discussion.) + + * Function calls that use keyword arguments are significantly faster + by doing a quick pointer comparison, usually saving the time of a + full string comparison. (Contributed by Raymond Hettinger, after + an initial implementation by Antoine Pitrou; bpo-1819(4).) + + * All of the functions in the *note struct: d5. module have been + rewritten in C, thanks to work at the Need For Speed sprint. + (Contributed by Raymond Hettinger.) + + * Some of the standard built-in types now set a bit in their type + objects. This speeds up checking whether an object is a subclass + of one of these types. (Contributed by Neal Norwitz.) + + * Unicode strings now use faster code for detecting whitespace and + line breaks; this speeds up the ‘split()’ method by about 25% and + ‘splitlines()’ by 35%. (Contributed by Antoine Pitrou.) Memory + usage is reduced by using pymalloc for the Unicode string’s data. + + * The ‘with’ statement now stores the *note __exit__(): 12f3. method + on the stack, producing a small speedup. (Implemented by Jeffrey + Yasskin.) + + * To reduce memory usage, the garbage collector will now clear + internal free lists when garbage-collecting the highest generation + of objects. This may return memory to the operating system sooner. + + ---------- 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: Interpreter Changes<2>, Prev: Optimizations<14>, Up: Other Language Changes<15> + +1.16.17.2 Interpreter Changes +............................. + +Two command-line options have been reserved for use by other Python +implementations. The *note -J: 1398. switch has been reserved for use +by Jython for Jython-specific options, such as switches that are passed +to the underlying JVM. *note -X: 176. 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 can now be prevented from writing ‘.pyc’ or ‘.pyo’ files by +supplying the *note -B: 1399. switch to the Python interpreter, or by +setting the *note PYTHONDONTWRITEBYTECODE: 139a. environment variable +before running the interpreter. This setting is available to Python +programs as the ‘sys.dont_write_bytecode’ variable, and Python code can +change the value to modify the interpreter’s behaviour. (Contributed by +Neal Norwitz and Georg Brandl.) + +The encoding used for standard input, output, and standard error can be +specified by setting the *note PYTHONIOENCODING: 1003. environment +variable before running the interpreter. The value should be a string +in the form ‘’ or ‘:’. The 'encoding' +part specifies the encoding’s name, e.g. ‘utf-8’ or ‘latin-1’; the +optional 'errorhandler' part specifies what to do with characters that +can’t be handled by the encoding, and should be one of “error”, +“ignore”, or “replace”. (Contributed by Martin von Löwis.) + + +File: python.info, Node: New and Improved Modules<2>, Next: Deprecations and Removals, Prev: Other Language Changes<15>, Up: What’s New in Python 2 6 + +1.16.18 New and Improved Modules +-------------------------------- + +As in every release, Python’s standard library received a number of +enhancements and bug fixes. Here’s a partial list of the most notable +changes, sorted alphabetically by module name. Consult the ‘Misc/NEWS’ +file in the source tree for a more complete list of changes, or look +through the Subversion logs for all the details. + + * 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.) + + * The ‘bsddb’ module also has a new maintainer, Jesús Cea Avión, and + the package is now available as a standalone package. The web page + for the package is www.jcea.es/programacion/pybsddb.htm(2). The + plan is to remove the package from the standard library in Python + 3.0, because its pace of releases is much more frequent than + Python’s. + + The ‘bsddb.dbshelve’ module now uses the highest pickling protocol + available, instead of restricting itself to protocol 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: 10a. module. The + versions still available in the ‘cgi’ module will trigger *note + PendingDeprecationWarning: 8c7. messages in 2.6 (bpo-600362(4)). + + * The *note cmath: 18. module underwent extensive revision, + contributed by Mark Dickinson and Christian Heimes. Five new + functions were added: + + * ‘polar()’ converts a complex number to polar form, returning + the modulus and argument of the complex number. + + * ‘rect()’ does the opposite, turning a modulus, argument pair + back into the corresponding complex number. + + * ‘phase()’ returns the argument (also called the angle) of a + complex number. + + * ‘isnan()’ returns True if either the real or imaginary part of + its argument is a NaN. + + * ‘isinf()’ returns True if either the real or imaginary part of + its argument is infinite. + + The revisions also improved the numerical soundness of the *note + cmath: 18. module. For all functions, the real and imaginary parts + of the results are accurate to within a few units of least + precision (ulps) whenever possible. See bpo-1381(5) for the + details. The branch cuts for ‘asinh()’, ‘atanh()’: and ‘atan()’ + have also been corrected. + + The tests for the module have been greatly expanded; nearly 2000 + new test cases exercise the algebraic functions. + + On IEEE 754 platforms, the *note cmath: 18. module now handles IEEE + 754 special values and floating-point exceptions in a manner + consistent with Annex ‘G’ of the C99 standard. + + * A new data type in the *note collections: 1d. 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.) + + * Another change to the *note collections: 1d. module is that the + ‘deque’ type now supports an optional 'maxlen' parameter; if + supplied, the deque’s size will be restricted to no more than + 'maxlen' items. Adding more items to a full deque causes old items + to be discarded. + + >>> 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: 71. module’s *note Morsel: c04. objects now + support an *note httponly: 139c. attribute. In some browsers. + cookies with this attribute set cannot be accessed or manipulated + by JavaScript code. (Contributed by Arvin Schnell; + bpo-1638033(6).) + + * A new window method in the *note curses: 2b. module, ‘chgat()’, + changes the display attributes for a certain number of characters + on a single line. (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) + + The ‘Textbox’ class in the *note curses.textpad: 2e. module now + supports editing in insert mode as well as overwrite mode. Insert + mode is enabled by supplying a true value for the 'insert_mode' + parameter when creating the ‘Textbox’ instance. + + * The *note datetime: 30. module’s ‘strftime()’ methods now support a + ‘%f’ format code that expands to the number of microseconds in the + object, zero-padded on the left to six places. (Contributed by + Skip Montanaro; bpo-1158(7).) + + * The *note decimal: 36. 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") + + The ‘as_tuple()’ method of ‘Decimal’ objects now returns a named + tuple with ‘sign’, ‘digits’, and ‘exponent’ fields. + + (Implemented by Facundo Batista and Mark Dickinson. Named tuple + support added by Raymond Hettinger.) + + * The *note difflib: 37. module’s ‘SequenceMatcher’ class now returns + named tuples representing matches, with ‘a’, ‘b’, and ‘size’ + attributes. (Contributed by Raymond Hettinger.) + + * An optional ‘timeout’ parameter, specifying a timeout measured in + seconds, was added to the *note ftplib.FTP: 8f9. class constructor + as well as the ‘connect()’ method. (Added by Facundo Batista.) + Also, the ‘FTP’ class’s ‘storbinary()’ and ‘storlines()’ now take + an optional 'callback' parameter that will be called with each + block of data after the data has been sent. (Contributed by Phil + Schwartz; bpo-1221598(9).) + + * The ‘reduce()’ built-in function is also available in the *note + functools: 5f. module. In Python 3.0, the builtin has been dropped + and ‘reduce()’ is only available from *note functools: 5f.; + currently there are no plans to drop the builtin in the 2.x series. + (Patched by Christian Heimes; bpo-1739906(10).) + + * When possible, the *note getpass: 62. module will now use + ‘/dev/tty’ to print a prompt message and read the password, falling + back to standard error and standard input. If the password may be + echoed to the terminal, a warning is printed before the prompt is + displayed. (Contributed by Gregory P. Smith.) + + * The *note glob.glob(): 2a1. function can now return Unicode + filenames if a Unicode path was used and Unicode filenames are + matched within the directory. (bpo-1001604(11)) + + * A new function in the *note heapq: 69. module, ‘merge(iter1, iter2, + ...)’, takes any number of iterables returning data in sorted + order, and returns a new generator that returns the contents of all + the iterators, also in sorted order. For example: + + >>> list(heapq.merge([1, 3, 5, 9], [2, 8, 16])) + [1, 2, 3, 5, 8, 9, 16] + + Another new function, ‘heappushpop(heap, item)’, pushes 'item' onto + 'heap', then pops off and returns the smallest item. This is more + efficient than making a call to ‘heappush()’ and then ‘heappop()’. + + *note heapq: 69. is now implemented to only use less-than + comparison, instead of the less-than-or-equal comparison it + previously used. This makes *note heapq: 69.’s usage of a type + match the *note list.sort(): bcf. method. (Contributed by Raymond + Hettinger.) + + * An optional ‘timeout’ parameter, specifying a timeout measured in + seconds, was added to the *note httplib.HTTPConnection: b40. and + *note HTTPSConnection: b41. class constructors. (Added by Facundo + Batista.) + + * Most of the *note inspect: 7e. module’s functions, such as + ‘getmoduleinfo()’ and ‘getargs()’, now return named tuples. In + addition to behaving like tuples, the elements of the return value + can also be accessed as attributes. (Contributed by Raymond + Hettinger.) + + Some new functions in the module include ‘isgenerator()’, + ‘isgeneratorfunction()’, and ‘isabstract()’. + + * The *note itertools: 81. module gained several new functions. + + ‘izip_longest(iter1, iter2, ...[, fillvalue])’ makes tuples from + each of the elements; if some of the iterables are shorter than + others, the missing values are set to 'fillvalue'. For example: + + >>> 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])’ returns the Cartesian + product of the supplied iterables, a set of tuples containing every + possible combination of the elements returned from each iterable. + + >>> 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)] + + The optional 'repeat' keyword argument is used for taking the + product of an iterable or a set of iterables with themselves, + repeated 'N' times. With a single iterable argument, 'N'-tuples + are returned: + + >>> 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)] + + With two iterables, '2N'-tuples are returned. + + >>> 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)’ returns sub-sequences of length 'r' + from the elements of 'iterable'. + + >>> 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])’ returns all the permutations of length + 'r' of the iterable’s elements. If 'r' is not specified, it will + default to the number of elements produced by the iterable. + + >>> 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)’ is an existing function in *note + itertools: 81. that gained a new constructor in Python 2.6. + ‘itertools.chain.from_iterable(iterable)’ takes a single iterable + that should return other iterables. ‘chain()’ will then return all + the elements of the first iterable, then all the elements of the + second, and so on. + + >>> list(itertools.chain.from_iterable([[1,2,3], [4,5,6]])) + [1, 2, 3, 4, 5, 6] + + (All contributed by Raymond Hettinger.) + + * The *note logging: 87. module’s ‘FileHandler’ class and its + subclasses ‘WatchedFileHandler’, ‘RotatingFileHandler’, and + ‘TimedRotatingFileHandler’ now have an optional 'delay' parameter + to their constructors. If 'delay' is true, opening of the log file + is deferred until the first ‘emit()’ call is made. (Contributed by + Vinay Sajip.) + + ‘TimedRotatingFileHandler’ also has a 'utc' constructor parameter. + If the argument is true, UTC time will be used in determining when + midnight occurs and in generating filenames; otherwise local time + will be used. + + * Several new functions were added to the *note math: 8e. module: + + * *note isinf(): 139d. and *note isnan(): 139e. determine + whether a given float is a (positive or negative) infinity or + a NaN (Not a Number), respectively. + + * *note copysign(): 139f. copies the sign bit of an IEEE 754 + number, returning the absolute value of 'x' combined with the + sign bit of 'y'. For example, ‘math.copysign(1, -0.0)’ + returns -1.0. (Contributed by Christian Heimes.) + + * *note factorial(): 947. computes the factorial of a number. + (Contributed by Raymond Hettinger; bpo-2138(12).) + + * *note fsum(): 13a0. adds up the stream of numbers from an + iterable, and is careful to avoid loss of precision through + using partial sums. (Contributed by Jean Brouwers, Raymond + Hettinger, and Mark Dickinson; bpo-2819(13).) + + * *note acosh(): 13a1, *note asinh(): 13a2. and *note atanh(): + 13a3. compute the inverse hyperbolic functions. + + * *note log1p(): 13a4. returns the natural logarithm of '1+x' + (base 'e'). + + * ‘trunc()’ rounds a number toward zero, returning the closest + ‘Integral’ that’s between the function’s argument and zero. + Added as part of the backport of *note PEP 3141's type + hierarchy for numbers: 12b0. + + * The *note math: 8e. module has been improved to give more + consistent behaviour across platforms, especially with respect to + handling of floating-point exceptions and IEEE 754 special values. + + Whenever possible, the module follows the recommendations of the + C99 standard about 754’s special values. For example, ‘sqrt(-1.)’ + should now give a *note ValueError: 204. across almost all + platforms, while ‘sqrt(float('NaN'))’ should return a NaN on all + IEEE 754 platforms. Where Annex ‘F’ of the C99 standard recommends + signaling ‘divide-by-zero’ or ‘invalid’, Python will raise *note + ValueError: 204. Where Annex ‘F’ of the C99 standard recommends + signaling ‘overflow’, Python will raise *note OverflowError: 87f. + (See bpo-711019(14) and bpo-1640(15).) + + (Contributed by Christian Heimes and Mark Dickinson.) + + * *note mmap: 20d. objects now have a ‘rfind()’ method that searches + for a substring beginning at the end of the string and searching + backwards. The ‘find()’ method also gained an 'end' parameter + giving an index at which to stop searching. (Contributed by John + Lenton.) + + * The *note operator: 9f. module gained a ‘methodcaller()’ function + that takes a name and an optional set of arguments, returning a + callable that will call the named function on any arguments passed + to it. For example: + + >>> # 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.) + + The ‘attrgetter()’ function now accepts dotted names and performs + the corresponding attribute lookups: + + >>> inst_name = operator.attrgetter( + ... '__class__.__name__') + >>> inst_name('') + 'str' + >>> inst_name(help) + '_Helper' + + (Contributed by Georg Brandl, after a suggestion by Barry Warsaw.) + + * The *note os: a1. module now wraps several new system calls. + ‘fchmod(fd, mode)’ and ‘fchown(fd, uid, gid)’ change the mode and + ownership of an opened file, and ‘lchmod(path, mode)’ changes the + mode of a symlink. (Contributed by Georg Brandl and Christian + Heimes.) + + ‘chflags()’ and ‘lchflags()’ are wrappers for the corresponding + system calls (where they’re available), changing the flags set on a + file. Constants for the flag values are defined in the *note stat: + d1. module; some possible values include ‘UF_IMMUTABLE’ to signal + the file may not be changed and ‘UF_APPEND’ to indicate that data + can only be appended to the file. (Contributed by M. Levinson.) + + ‘os.closerange(low, high)’ efficiently closes all file descriptors + from 'low' to 'high', ignoring any errors and not including 'high' + itself. This function is now used by the *note subprocess: d6. + module to make starting processes faster. (Contributed by Georg + Brandl; bpo-1663329(16).) + + * The ‘os.environ’ object’s ‘clear()’ method will now unset the + environment variables using *note os.unsetenv(): 91a. in addition + to clearing the object’s keys. (Contributed by Martin Horcicka; + bpo-1181(17).) + + * The *note os.walk(): 4a5. function now has a ‘followlinks’ + parameter. If set to True, it will follow symlinks pointing to + directories and visit the directory’s contents. For backward + compatibility, the parameter’s default value is false. Note that + the function can fall into an infinite recursion if there’s a + symlink that points to a parent directory. (bpo-1273829(18)) + + * In the *note os.path: a2. module, the ‘splitext()’ function has + been changed to not split on leading period characters. This + produces better results when operating on Unix’s dot-files. For + example, ‘os.path.splitext('.ipython')’ now returns ‘('.ipython', + '')’ instead of ‘('', '.ipython')’. (bpo-1115886(19)) + + A new function, ‘os.path.relpath(path, start='.')’, returns a + relative path from the ‘start’ path, if it’s supplied, or from the + current working directory to the destination ‘path’. (Contributed + by Richard Barran; bpo-1339796(20).) + + On Windows, *note os.path.expandvars(): 13a5. will now expand + environment variables given in the form “%var%”, and “~user” will + be expanded into the user’s home directory path. (Contributed by + Josiah Carlson; bpo-957650(21).) + + * The Python debugger provided by the *note pdb: a5. module gained a + new command: “run” restarts the Python program being debugged and + can optionally take new command-line arguments for the program. + (Contributed by Rocky Bernstein; bpo-1393667(22).) + + * The *note pdb.post_mortem(): 13a6. function, used to begin + debugging a traceback, will now use the traceback returned by *note + sys.exc_info(): 686. if no traceback is supplied. (Contributed by + Facundo Batista; bpo-1106316(23).) + + * The *note pickletools: a7. module now has an ‘optimize()’ function + that takes a string containing a pickle and removes some unused + opcodes, returning a shorter pickle that contains the same data + structure. (Contributed by Raymond Hettinger.) + + * A ‘get_data()’ function was added to the *note pkgutil: a9. module + that returns the contents of resource files included with an + installed Python package. For example: + + >>> import pkgutil + >>> print pkgutil.get_data('test', 'exception_hierarchy.txt') + BaseException + +-- SystemExit + +-- KeyboardInterrupt + +-- GeneratorExit + +-- Exception + +-- StopIteration + +-- StandardError + ... + + (Contributed by Paul Moore; bpo-2439(24).) + + * The ‘pyexpat’ module’s ‘Parser’ objects now allow setting their + ‘buffer_size’ attribute to change the size of the buffer used to + hold character data. (Contributed by Achim Gaedke; bpo-1137(25).) + + * The ‘Queue’ module now provides queue variants that retrieve + entries in different orders. The ‘PriorityQueue’ class stores + queued items in a heap and retrieves them in priority order, and + ‘LifoQueue’ retrieves the most recently added entries first, + meaning that it behaves like a stack. (Contributed by Raymond + Hettinger.) + + * The *note random: b8. module’s ‘Random’ objects can now be pickled + on a 32-bit system and unpickled on a 64-bit system, and vice + versa. Unfortunately, this change also means that Python 2.6’s + ‘Random’ objects can’t be unpickled correctly on earlier versions + of Python. (Contributed by Shawn Ligocki; bpo-1727780(26).) + + The new ‘triangular(low, high, mode)’ function returns random + numbers following a triangular distribution. The returned values + are between 'low' and 'high', not including 'high' itself, and with + 'mode' as the most frequently occurring value in the distribution. + (Contributed by Wladmir van der Laan and Raymond Hettinger; + bpo-1681432(27).) + + * Long regular expression searches carried out by the *note re: b9. + module will check for signals being delivered, so time-consuming + searches can now be interrupted. (Contributed by Josh Hoyt and + Ralf Schmitt; bpo-846388(28).) + + The regular expression module is implemented by compiling bytecodes + for a tiny regex-specific virtual machine. Untrusted code could + create malicious strings of bytecode directly and cause crashes, so + Python 2.6 includes a verifier for the regex bytecode. + (Contributed by Guido van Rossum from work for Google App Engine; + bpo-3487(29).) + + * The *note rlcompleter: bd. module’s ‘Completer.complete()’ method + will now ignore exceptions triggered while evaluating a name. + (Fixed by Lorenz Quack; bpo-2250(30).) + + * The *note sched: bf. module’s ‘scheduler’ instances now have a + read-only *note queue: b6. attribute that returns the contents of + the scheduler’s queue, represented as a list of named tuples with + the fields ‘(time, priority, action, argument)’. (Contributed by + Raymond Hettinger; bpo-1861(31).) + + * The *note select: c1. 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).) + + * The *note shutil.copytree(): a28. function now has an optional + 'ignore' argument that takes a callable object. This callable will + receive each directory path and a list of the directory’s contents, + and returns a list of names that will be ignored, not copied. + + The *note shutil: c5. module also provides an ‘ignore_patterns()’ + function for use with this new parameter. ‘ignore_patterns()’ + takes an arbitrary number of glob-style patterns and returns a + callable that will ignore any files and directories that match any + of these patterns. The following example copies a directory tree, + but skips both ‘.svn’ directories and Emacs backup files, which + have names ending with ‘~’: + + shutil.copytree('Doc/library', '/tmp/library', + ignore=shutil.ignore_patterns('*~', '.svn')) + + (Contributed by Tarek Ziadé; bpo-2663(33).) + + * Integrating signal handling with GUI handling event loops like + those used by Tkinter or GTk+ has long been a problem; most + software ends up polling, waking up every fraction of a second to + check if any GUI events have occurred. The *note signal: c6. + module can now make this more efficient. Calling + ‘signal.set_wakeup_fd(fd)’ sets a file descriptor to be used; when + a signal is received, a byte is written to that file descriptor. + There’s also a C-level function, *note PySignal_SetWakeupFd(): + 13a7, for setting the descriptor. + + 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).) + + The ‘siginterrupt()’ function is now available from Python code, + and allows changing whether signals can interrupt system calls or + not. (Contributed by Ralf Schmitt.) + + The ‘setitimer()’ and ‘getitimer()’ functions have also been added + (where they’re available). ‘setitimer()’ allows setting interval + timers that will cause a signal to be delivered to the process + after a specified time, measured in wall-clock time, consumed + process time, or combined process+system time. (Contributed by + Guilherme Polo; bpo-2240(35).) + + * The *note smtplib: ca. module now supports SMTP over SSL thanks to + the addition of the ‘SMTP_SSL’ class. This class supports an + interface identical to the existing ‘SMTP’ class. (Contributed by + Monty Taylor.) Both class constructors also have an optional + ‘timeout’ parameter that specifies a timeout for the initial + connection attempt, measured in seconds. (Contributed by Facundo + Batista.) + + An implementation of the LMTP protocol ( RFC 2033(36)) was also + added to the module. LMTP is used in place of SMTP when + transferring e-mail between agents that don’t manage a mail queue. + (LMTP implemented by Leif Hedstrom; bpo-957003(37).) + + ‘SMTP.starttls()’ now complies with RFC 3207(38) and forgets any + knowledge obtained from the server not obtained from the TLS + negotiation itself. (Patch contributed by Bill Fenner; + bpo-829951(39).) + + * The *note socket: cc. 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).) + + A new function, ‘create_connection()’, takes an address and + connects to it using an optional timeout value, returning the + connected socket object. This function also looks up the address’s + type and connects to it using IPv4 or IPv6 as appropriate. + Changing your code to use ‘create_connection()’ instead of + ‘socket(socket.AF_INET, ...)’ may be all that’s required to make + your code work with IPv6. + + * The base classes in the *note SocketServer: cd. module now support + calling a *note handle_timeout(): 1314. method after a span of + inactivity specified by the server’s *note timeout: 1313. + attribute. (Contributed by Michael Pomraning.) The *note + serve_forever(): 1133. 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).) + + * The *note sqlite3: cf. module, maintained by Gerhard Häring, has + been updated from version 2.3.2 in Python 2.5 to version 2.4.1. + + * The *note struct: d5. module now supports the C99 _Bool type, using + the format character ‘'?'’. (Contributed by David Remahl.) + + * The *note Popen: 199. objects provided by the *note subprocess: d6. + module now have *note terminate(): 13a8, *note kill(): 13a9, and + *note send_signal(): 13aa. methods. On Windows, ‘send_signal()’ + only supports the *note SIGTERM: 13ab. signal, and all these + methods are aliases for the Win32 API function + ‘TerminateProcess()’. (Contributed by Christian Heimes.) + + * A new variable in the *note sys: d9. module, ‘float_info’, is an + object containing information derived from the ‘float.h’ file about + the platform’s floating-point support. Attributes of this object + include ‘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(43).) + + Another new variable, ‘dont_write_bytecode’, controls whether + Python writes any ‘.pyc’ or ‘.pyo’ files on importing a module. If + this variable is true, the compiled files are not written. The + variable is initially set on start-up by supplying the *note -B: + 1399. switch to the Python interpreter, or by setting the *note + PYTHONDONTWRITEBYTECODE: 139a. environment variable before running + the interpreter. Python code can subsequently change the value of + this variable to control whether bytecode files are written or not. + (Contributed by Neal Norwitz and Georg Brandl.) + + Information about the command-line arguments supplied to the Python + interpreter is available by reading attributes of a named tuple + available as ‘sys.flags’. For example, the ‘verbose’ attribute is + true if Python was executed in verbose mode, ‘debug’ is true in + debugging mode, etc. These attributes are all read-only. + (Contributed by Christian Heimes.) + + A new function, ‘getsizeof()’, takes a Python object and returns + the amount of memory used by the object, measured in bytes. + Built-in objects return correct results; third-party extensions may + not, but can define a ‘__sizeof__()’ method to return the object’s + size. (Contributed by Robert Schuppenies; bpo-2898(44).) + + It’s now possible to determine the current profiler and tracer + functions by calling *note sys.getprofile(): 13ac. and *note + sys.gettrace(): 13ad. (Contributed by Georg Brandl; bpo-1648(45).) + + * The *note tarfile: de. module now supports POSIX.1-2001 (pax) + tarfiles in addition to the POSIX.1-1988 (ustar) and GNU tar + formats that were already supported. The default format is GNU + tar; specify the ‘format’ parameter to open a file using a + different format: + + tar = tarfile.open("output.tar", "w", + format=tarfile.PAX_FORMAT) + + The new ‘encoding’ and ‘errors’ parameters specify an encoding and + an error handling scheme for character conversions. ‘'strict'’, + ‘'ignore'’, and ‘'replace'’ are the three standard ways Python can + handle errors,; ‘'utf-8'’ is a special value that replaces bad + characters with their UTF-8 representation. (Character conversions + occur because the PAX format supports Unicode filenames, defaulting + to UTF-8 encoding.) + + 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.) + + * The *note tempfile.NamedTemporaryFile: 4c2. class usually deletes + the temporary file it created when the file is closed. This + behaviour can now be changed by passing ‘delete=False’ to the + constructor. (Contributed by Damien Miller; bpo-1537850(46).) + + A new class, ‘SpooledTemporaryFile’, behaves like a temporary file + but stores its data in memory until a maximum size is exceeded. On + reaching that limit, the contents will be written to an on-disk + temporary file. (Contributed by Dustin J. Mitchell.) + + The ‘NamedTemporaryFile’ and ‘SpooledTemporaryFile’ classes both + work as context managers, so you can write ‘with + tempfile.NamedTemporaryFile() as tmp: ...’. (Contributed by + Alexander Belopolsky; bpo-2021(47).) + + * The *note test.test_support: e4. module gained a number of context + managers useful for writing tests. *note EnvironmentVarGuard(): + 13ae. is a context manager that temporarily changes environment + variables and automatically restores them to their old values. + + Another context manager, ‘TransientResource’, can surround calls to + resources that may or may not be available; it will catch and + ignore a specified list of exceptions. For example, a network test + may ignore certain failures when connecting to an external web + site: + + with test_support.TransientResource(IOError, + errno=errno.ETIMEDOUT): + f = urllib.urlopen('https://sf.net') + ... + + Finally, ‘check_warnings()’ resets the ‘warning’ module’s warning + filters and returns an object that will record all warning messages + triggered (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: ec. 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).) + + * The *note threading: ed. module API is being changed to use + properties such as ‘daemon’ instead of ‘setDaemon()’ and + ‘isDaemon()’ methods, and some methods have been renamed to use + underscores instead of camel-case; for example, the ‘activeCount()’ + method is renamed to ‘active_count()’. Both the 2.6 and 3.0 + versions of the module support the same properties and renamed + methods, but don’t remove the old methods. No date has been set + for the deprecation of the old APIs in Python 3.x; the old APIs + won’t be removed in any 2.x version. (Carried out by several + people, most notably Benjamin Peterson.) + + The *note threading: ed. module’s ‘Thread’ objects gained an + ‘ident’ property that returns the thread’s identifier, a nonzero + integer. (Contributed by Gregory P. Smith; bpo-2871(50).) + + * The *note timeit: ef. module now accepts callables as well as + strings for the statement being timed and for the setup code. Two + convenience functions were added for creating ‘Timer’ instances: + ‘repeat(stmt, setup, time, repeat, number)’ and ‘timeit(stmt, + setup, time, number)’ create an instance and call the corresponding + method. (Contributed by Erik Demaine; bpo-1533909(51).) + + * The ‘Tkinter’ module now accepts lists and tuples for options, + separating the elements by spaces before passing the resulting + value to Tcl/Tk. (Contributed by Guilherme Polo; bpo-2906(52).) + + * The *note turtle: 101. module for turtle graphics was greatly + enhanced by Gregor Lingl. New features in the module include: + + * Better animation of turtle movement and rotation. + + * Control over turtle movement using the new ‘delay()’, + ‘tracer()’, and ‘speed()’ methods. + + * The ability to set new shapes for the turtle, and to define a + new coordinate system. + + * Turtles now have an ‘undo()’ method that can roll back + actions. + + * Simple support for reacting to input events such as mouse and + keyboard activity, making it possible to write simple games. + + * A ‘turtle.cfg’ file can be used to customize the starting + appearance of the turtle’s screen. + + * The module’s docstrings can be replaced by new docstrings that + have been translated into another language. + + (bpo-1513695(53)) + + * An optional ‘timeout’ parameter was added to the *note + urllib.urlopen: 295. function and the ‘urllib.ftpwrapper’ class + constructor, as well as the *note urllib2.urlopen: 295. 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: + >>> + + (Added by Facundo Batista.) + + * The Unicode database provided by the *note unicodedata: 105. module + has been updated to version 5.1.0. (Updated by Martin von Löwis; + bpo-3811(54).) + + * The *note warnings: 112. module’s ‘formatwarning()’ and + ‘showwarning()’ gained an optional 'line' argument that can be used + to supply the line of source code. (Added as part of + bpo-1631171(55), which re-implemented part of the *note warnings: + 112. module in C code.) + + A new function, ‘catch_warnings()’, is a context manager intended + for testing purposes that lets you temporarily modify the warning + filters and then restore their original values (bpo-3781(56)). + + * The XML-RPC *note SimpleXMLRPCServer: 12f. and *note + DocXMLRPCServer: 12f. 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’ also has a ‘_send_traceback_header’ attribute; + if true, the exception and formatted traceback are returned as HTTP + headers “X-Exception” and “X-Traceback”. This feature is for + debugging purposes only and should not be used on production + servers because the tracebacks might reveal passwords or other + sensitive information. (Contributed by Alan McIntyre as part of + his project for Google’s Summer of Code 2007.) + + * The *note xmlrpclib: 12e. module no longer automatically converts + *note datetime.date: 1cd. and *note datetime.time: 1ce. to the + *note xmlrpclib.DateTime: 13af. type; the conversion semantics were + not necessarily correct for all applications. Code using + ‘xmlrpclib’ should convert ‘date’ and *note time: 1ce. 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 ‘’ in XML-RPC responses (contributed by + Riku Lindblad; bpo-2985(60)). + + * The *note zipfile: 131. module’s ‘ZipFile’ class now has + ‘extract()’ and ‘extractall()’ methods that will unpack a single + file or all the files in the archive to the current directory, or + to a specified directory: + + 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).) + + The *note open(): 517, ‘read()’ and ‘extract()’ methods can now + take either a filename or a ‘ZipInfo’ object. This is useful when + an archive accidentally contains a duplicated filename. + (Contributed by Graham Horler; bpo-1775025(62).) + + Finally, *note zipfile: 131. now supports using Unicode filenames + for archived files. (Contributed by Alexey Borzenkov; + bpo-1734346(63).) + +* Menu: + +* The ast module:: +* The future_builtins module:: +* The json module; JavaScript Object Notation: The json module JavaScript Object Notation. +* The plistlib module; A Property-List Parser: The plistlib module A Property-List Parser. +* ctypes Enhancements:: +* Improved SSL Support:: + + ---------- 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: The ast module, Next: The future_builtins module, Up: New and Improved Modules<2> + +1.16.18.1 The ‘ast’ module +.......................... + +The *note ast: 8. module provides an Abstract Syntax Tree representation +of Python code, and Armin Ronacher contributed a set of helper functions +that perform a variety of common tasks. These will be useful for HTML +templating packages, code analyzers, and similar tools that process +Python code. + +The ‘parse()’ function takes an expression and returns an AST. The +‘dump()’ function outputs a representation of a tree, suitable for +debugging: + + import ast + + t = ast.parse(""" + d = {} + for i in 'abcdefghijklm': + d[i + i] = ord(i) - ord('a') + 1 + print d + """) + print ast.dump(t) + +This outputs a deeply nested tree: + + 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) + ]) + +The ‘literal_eval()’ method takes a string or an AST representing a +literal expression, parses and evaluates it, and returns the resulting +value. A literal expression is a Python expression containing only +strings, numbers, dictionaries, etc. but no statements or function +calls. If you need to evaluate an expression but cannot accept the +security risk of using an *note eval(): 180. call, ‘literal_eval()’ will +handle it safely: + + >>> 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 + +The module also includes ‘NodeVisitor’ and ‘NodeTransformer’ classes for +traversing and modifying an AST, and functions for common +transformations such as changing line numbers. + + +File: python.info, Node: The future_builtins module, Next: The json module JavaScript Object Notation, Prev: The ast module, Up: New and Improved Modules<2> + +1.16.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. + +The functions in this module currently include: + + * ‘ascii(obj)’: equivalent to *note repr(): 7f9. In Python 3.0, + *note repr(): 7f9. will return a Unicode string, while *note + ascii(): 13b2. will return a pure ASCII bytestring. + + * ‘filter(predicate, iterable)’, ‘map(func, iterable1, ...)’: the 3.0 + versions return iterators, unlike the 2.x builtins which return + lists. + + * ‘hex(value)’, ‘oct(value)’: instead of calling the ‘__hex__()’ or + ‘__oct__()’ methods, these versions will call the ‘__index__()’ + method and convert the result to hexadecimal or octal. *note + oct(): 12c1. will use the new ‘0o’ notation for its result. + + +File: python.info, Node: The json module JavaScript Object Notation, Next: The plistlib module A Property-List Parser, Prev: The future_builtins module, Up: New and Improved Modules<2> + +1.16.18.3 The ‘json’ module: JavaScript Object Notation +....................................................... + +The new *note json: 82. module supports the encoding and decoding of +Python types in JSON (Javascript Object Notation). JSON is a +lightweight interchange format often used in web applications. For more +information about JSON, see ‘http://www.json.org’. + +*note json: 82. comes with support for decoding and encoding most +built-in Python types. The following example encodes and decodes a +dictionary: + + >>> 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} + +It’s also possible to write your own decoders and encoders to support +more types. Pretty-printing of the JSON strings is also supported. + +*note json: 82. (originally called simplejson) was written by Bob +Ippolito. + + +File: python.info, Node: The plistlib module A Property-List Parser, Next: ctypes Enhancements, Prev: The json module JavaScript Object Notation, Up: New and Improved Modules<2> + +1.16.18.4 The ‘plistlib’ module: A Property-List Parser +....................................................... + +The ‘.plist’ format is commonly used on Mac OS X to store basic data +types (numbers, strings, lists, and dictionaries) by serializing them +into an XML-based format. It resembles the XML-RPC serialization of +data types. + +Despite being primarily used on Mac OS X, the format has nothing +Mac-specific about it and the Python implementation works on any +platform that Python supports, so the *note plistlib: ab. module has +been promoted to the standard library. + +Using the module is simple: + + import sys + import plistlib + import datetime + + # Create data structure + data_struct = dict(lastAccessed=datetime.datetime.now(), + version=1, + categories=('Personal','Shared','Private')) + + # Create string containing XML. + plist_str = plistlib.writePlistToString(data_struct) + new_struct = plistlib.readPlistFromString(plist_str) + print data_struct + print new_struct + + # Write data structure to a file and read it back. + plistlib.writePlist(data_struct, '/tmp/customizations.plist') + new_struct = plistlib.readPlist('/tmp/customizations.plist') + + # read/writePlist accepts file-like objects as well as paths. + plistlib.writePlist(data_struct, sys.stdout) + + +File: python.info, Node: ctypes Enhancements, Next: Improved SSL Support, Prev: The plistlib module A Property-List Parser, Up: New and Improved Modules<2> + +1.16.18.5 ctypes Enhancements +............................. + +Thomas Heller continued to maintain and enhance the *note ctypes: 2a. +module. + +*note ctypes: 2a. now supports a ‘c_bool’ datatype that represents the +C99 ‘bool’ type. (Contributed by David Remahl; bpo-1649190(1).) + +The *note ctypes: 2a. string, buffer and array types have improved +support for extended slicing syntax, where various combinations of +‘(start, stop, step)’ are supplied. (Implemented by Thomas Wouters.) + +All *note ctypes: 2a. data types now support ‘from_buffer()’ and +‘from_buffer_copy()’ methods that create a ctypes instance based on a +provided buffer object. ‘from_buffer_copy()’ copies the contents of the +object, while ‘from_buffer()’ will share the same memory area. + +A new calling convention tells *note ctypes: 2a. to clear the ‘errno’ or +Win32 LastError variables at the outset of each wrapped call. +(Implemented by Thomas Heller; bpo-1798(2).) + +You can now retrieve the Unix ‘errno’ variable after a function call. +When creating a wrapped function, you can supply ‘use_errno=True’ as a +keyword parameter to the ‘DLL()’ function and then call the module-level +methods ‘set_errno()’ and ‘get_errno()’ to set and retrieve the error +value. + +The Win32 LastError variable is similarly supported by the ‘DLL()’, +‘OleDLL()’, and ‘WinDLL()’ functions. You supply ‘use_last_error=True’ +as a keyword parameter and then call the module-level methods +‘set_last_error()’ and ‘get_last_error()’. + +The ‘byref()’ function, used to retrieve a pointer to a ctypes instance, +now has an optional 'offset' parameter that is a byte count that will be +added to the returned pointer. + + ---------- 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: Improved SSL Support, Prev: ctypes Enhancements, Up: New and Improved Modules<2> + +1.16.18.6 Improved SSL Support +.............................. + +Bill Janssen made extensive improvements to Python 2.6’s support for the +Secure Sockets Layer by adding a new module, *note ssl: d0, that’s built +atop the OpenSSL(1) library. This new module provides more control over +the protocol negotiated, the X.509 certificates used, and has better +support for writing SSL servers (as opposed to clients) in Python. The +existing SSL support in the *note socket: cc. module hasn’t been removed +and continues to work, though it will be removed in Python 3.0. + +To use the new module, you must first create a TCP connection in the +usual way and then pass it to the ‘ssl.wrap_socket()’ function. It’s +possible to specify whether a certificate is required, and to obtain +certificate info by calling the ‘getpeercert()’ method. + +See also +........ + +The documentation for the *note ssl: d0. module. + + ---------- Footnotes ---------- + + (1) https://www.openssl.org/ + + +File: python.info, Node: Deprecations and Removals, Next: Build and C API Changes<9>, Prev: New and Improved Modules<2>, Up: What’s New in Python 2 6 + +1.16.19 Deprecations and Removals +--------------------------------- + + * String exceptions have been removed. Attempting to use them raises + a *note TypeError: 534. + + * Changes to the *note Exception: 9d9. 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: 569. attribute. + + * (3.0-warning mode) Python 3.0 will feature a reorganized standard + library that will drop many outdated modules and rename others. + Python 2.6 running in 3.0-warning mode will warn about these + modules when they are imported. + + 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: 3b. package instead. + + * The ‘md5’ module has been deprecated; use the *note hashlib: 68. + module instead. + + * The ‘posixfile’ module has been deprecated; *note fcntl.lockf(): + 13b8. provides better locking. + + * The ‘popen2’ module has been deprecated; use the *note subprocess: + d6. module. + + * The ‘rgbimg’ module has been removed. + + * The ‘sets’ module has been deprecated; it’s better to use the + built-in *note set: 5d5. and *note frozenset: 5d6. types. + + * The ‘sha’ module has been deprecated; use the *note hashlib: 68. + module instead. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0352/ + + +File: python.info, Node: Build and C API Changes<9>, Next: Porting to Python 2 6, Prev: Deprecations and Removals, Up: What’s New in Python 2 6 + +1.16.20 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * 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 can be built with Microsoft Visual Studio 2008 (version + 9.0), and this is the new default compiler. See the ‘PCbuild’ + directory for the build files. (Implemented by Christian Heimes.) + + * On Mac OS X, Python 2.6 can be compiled as a 4-way universal build. + The ‘configure’ script can take a + ‘--with-universal-archs=[32-bit|64-bit|all]’ switch, controlling + whether the binaries are built for 32-bit architectures (x86, + PowerPC), 64-bit (x86-64 and PPC-64), or both. (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. + + * The BerkeleyDB module now has a C API object, available as + ‘bsddb.db.api’. This object can be used by other C extensions that + wish to use the ‘bsddb’ module for their own purposes. + (Contributed by Duncan Grisby.) + + * The new buffer interface, previously described in *note the PEP + 3118 section: 1385, adds *note PyObject_GetBuffer(): 395. and *note + PyBuffer_Release(): 396, as well as a few other functions. + + * 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: 415. A new API + function, *note PyImport_ImportModuleNoBlock(): 3b9, 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 *note ImportError: 415. is raised. (Contributed by + Christian Heimes.) + + * Several functions return information about the platform’s + floating-point support. *note PyFloat_GetMax(): 13ba. returns the + maximum representable floating-point value, and *note + PyFloat_GetMin(): 13bb. returns the minimum positive value. *note + PyFloat_GetInfo(): 13bc. 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).) + + * C functions and methods that use *note PyComplex_AsCComplex(): + 13bd. will now accept arguments that have a ‘__complex__()’ method. + In particular, the functions in the *note cmath: 18. module will + now accept objects with this method. This is a backport of a + Python 3.0 change. (Contributed by Mark Dickinson; + bpo-1675423(4).) + + * Python’s C API now includes two functions for case-insensitive + string comparisons, ‘PyOS_stricmp(char*, char*)’ and + ‘PyOS_strnicmp(char*, char*, Py_ssize_t)’. (Contributed by + Christian Heimes; bpo-1635(5).) + + * Many C extensions define their own little macro for adding integers + and strings to the module’s dictionary in the ‘init*’ function. + Python 2.6 finally defines standard macros for adding values to a + module, *note PyModule_AddStringMacro: 13be. and *note + PyModule_AddIntMacro(): 13bf. (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(): 77d, ‘Py_Type()’ became *note Py_TYPE(): 77b, and + ‘Py_Refcnt()’ became *note Py_REFCNT(): 8a8. The mixed-case macros + are still available in Python 2.6 for backward compatibility. + (bpo-1629(6)) + + * Distutils now places C extensions it builds in a different + directory when running on a debug version of Python. (Contributed + by Collin Winter; bpo-1530959(7).) + + * Several basic data types, such as integers and strings, maintain + internal free lists of objects that can be re-used. The data + structures for these free lists now follow a naming convention: the + variable is always named ‘free_list’, the counter is always named + ‘numfree’, and a macro ‘Py_MAXFREELIST’ is always + defined. + + * A new Makefile target, “make patchcheck”, prepares the Python + source tree for making a patch: it fixes trailing whitespace in all + modified ‘.py’ files, checks whether the documentation has been + changed, and reports whether the ‘Misc/ACKS’ and ‘Misc/NEWS’ files + have been updated. (Contributed by Brett Cannon.) + + Another new target, “make profile-opt”, compiles a Python binary + using GCC’s profile-guided optimization. It compiles Python with + profiling enabled, runs the test suite to obtain a set of profiling + results, and then compiles using these results for optimization. + (Contributed by Gregory P. Smith.) + +* Menu: + +* Port-Specific Changes; Windows: Port-Specific Changes Windows<2>. +* Port-Specific Changes; Mac OS X: Port-Specific Changes Mac OS X<2>. +* Port-Specific Changes; IRIX: Port-Specific Changes 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: Port-Specific Changes Windows<2>, Next: Port-Specific Changes Mac OS X<2>, Up: Build and C API Changes<9> + +1.16.20.1 Port-Specific Changes: Windows +........................................ + + * The support for Windows 95, 98, ME and NT4 has been dropped. + Python 2.6 requires at least Windows 2000 SP4. + + * The new default compiler on Windows is Visual Studio 2008 (version + 9.0). The build directories for Visual Studio 2003 (version 7.1) + and 2005 (version 8.0) were moved into the PC/ directory. The new + ‘PCbuild’ directory supports cross compilation for X64, debug + builds and Profile Guided Optimization (PGO). PGO builds are + roughly 10% faster than normal builds. (Contributed by Christian + Heimes with help from Amaury Forgeot d’Arc and Martin von Löwis.) + + * The *note msvcrt: 93. module now supports both the normal and wide + char variants of the console I/O API. The *note getwch(): 13c1. + function reads a keypress and returns a Unicode value, as does the + *note getwche(): 13c2. function. The *note putwch(): 13c3. + function takes a Unicode character and writes it to the console. + (Contributed by Christian Heimes.) + + * *note os.path.expandvars(): 13a5. will now expand environment + variables in the form “%var%”, and “~user” will be expanded into + the user’s home directory path. (Contributed by Josiah Carlson; + bpo-957650(1).) + + * The *note socket: cc. module’s socket objects now have an *note + ioctl(): cd3. method that provides a limited interface to the + ‘WSAIoctl()’ system interface. + + * The *note _winreg: 116. module now has a function, *note + ExpandEnvironmentStrings(): 13c4, 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: 5ce. statements. (Contributed by + Christian Heimes.) + + *note _winreg: 116. also has better support for x64 systems, + exposing the *note DisableReflectionKey(): 1350, *note + EnableReflectionKey(): 1351, and *note QueryReflectionKey(): 1352. + 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: Port-Specific Changes Mac OS X<2>, Next: Port-Specific Changes IRIX, Prev: Port-Specific Changes Windows<2>, Up: Build and C API Changes<9> + +1.16.20.2 Port-Specific Changes: Mac OS X +......................................... + + * When compiling a framework build of Python, you can now specify the + framework name to be used by providing the ‘--with-framework-name=’ + option to the ‘configure’ script. + + * 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: Port-Specific Changes IRIX, Prev: Port-Specific Changes Mac OS X<2>, Up: Build and C API Changes<9> + +1.16.20.3 Port-Specific Changes: 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: Porting to Python 2 6, Next: Acknowledgements<2>, Prev: Build and C API Changes<9>, Up: What’s New in Python 2 6 + +1.16.21 Porting to Python 2.6 +----------------------------- + +This section lists previously described changes and other bugfixes that +may require changes to your code: + + * Classes that aren’t supposed to be hashable should set ‘__hash__ = + None’ in their definitions to indicate the fact. + + * String exceptions have been removed. Attempting to use them raises + a *note TypeError: 534. + + * The ‘__init__()’ method of *note collections.deque: 5d8. now clears + any existing contents of the deque before adding elements from the + iterable. This change makes the behavior match ‘list.__init__()’. + + * *note object.__init__(): 6ac. previously accepted arbitrary + arguments and keyword arguments, ignoring them. In Python 2.6, + this is no longer allowed and will result in a *note TypeError: + 534. This will affect ‘__init__()’ methods that end up calling the + corresponding method on *note object: a8c. (perhaps through using + *note super(): 4d7.). See bpo-1683368(1) for discussion. + + * The ‘Decimal’ constructor now accepts leading and trailing + whitespace when passed a string. Previously it would raise an + ‘InvalidOperation’ exception. On the other hand, the + ‘create_decimal()’ method of ‘Context’ objects now explicitly + disallows extra whitespace, raising a ‘ConversionSyntax’ exception. + + * Due to an implementation accident, if you passed a file path to the + built-in *note __import__(): 8d3. function, it would actually + import the specified file. This was never intended to work, + however, and the implementation now explicitly checks for this case + and raises an *note ImportError: 415. + + * C API: the *note PyImport_Import(): 13c8. and *note + PyImport_ImportModule(): 3ba. functions now default to absolute + imports, not relative imports. This will affect C extensions that + import other modules. + + * C API: extension data types that shouldn’t be hashable should + define their ‘tp_hash’ slot to *note PyObject_HashNotImplemented(): + 1392. + + * The *note socket: cc. module exception *note socket.error: 104e. + now inherits from *note IOError: 104b. Previously it wasn’t a + subclass of ‘StandardError’ but now it is, through *note IOError: + 104b. (Implemented by Gregory P. Smith; bpo-1706815(2).) + + * The *note xmlrpclib: 12e. module no longer automatically converts + *note datetime.date: 1cd. and *note datetime.time: 1ce. to the + *note xmlrpclib.DateTime: 13af. type; the conversion semantics were + not necessarily correct for all applications. Code using + ‘xmlrpclib’ should convert ‘date’ and *note time: 1ce. instances. + (bpo-1330538(3)) + + * (3.0-warning mode) The *note Exception: 9d9. class now warns when + accessed using slicing or index access; having *note Exception: + 9d9. behave like a tuple is being phased out. + + * (3.0-warning mode) inequality comparisons between two dictionaries + or two objects that don’t implement comparison methods are reported + as warnings. ‘dict1 == dict2’ still works, but ‘dict1 < dict2’ is + being phased out. + + Comparisons between cells, which are an implementation detail of + Python’s scoping rules, also cause warnings because such + comparisons are forbidden entirely in 3.0. + +For applications that embed 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: Acknowledgements<2>, Prev: Porting to Python 2 6, Up: What’s New in Python 2 6 + +1.16.22 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: 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.17 What’s New in Python 2.5 +============================= + + +Author: 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: 2a. module for calling C functions. + +The language changes are of middling significance. Some pleasant new +features were added, but most of them aren’t features that you’ll use +every day. Conditional expressions were finally added to the language +using a novel syntax; see section *note PEP 308; Conditional +Expressions: 13cd. The new ‘*note with: 5ce.’ statement will make +writing cleanup code easier (section *note PEP 343; The ‘with’ +statement: 13ce.). Values can now be passed into generators (section +*note PEP 342; New Generator Features: 13cf.). Imports are now visible +as either absolute or relative (section *note PEP 328; Absolute and +Relative Imports: 13d0.). Some corner cases of exception handling are +handled better (section *note PEP 341; Unified try/except/finally: +13d1.). All these improvements are worthwhile, but they’re improvements +to one specific language feature or another; none of them are broad +modifications to Python’s semantics. + +As well as the language and library additions, other improvements and +bugfixes were made throughout the source tree. A search through the SVN +change logs finds there were 353 patches applied and 458 bugs fixed +between Python 2.4 and 2.5. (Both figures are likely to be +underestimates.) + +This article doesn’t try to be a complete specification of the new +features; instead changes are briefly introduced using helpful examples. +For full details, you should always refer to the documentation for +Python 2.5 at ‘https://docs.python.org’. If you want to understand the +complete implementation and design rationale, refer to the PEP for a +particular new feature. + +Comments, suggestions, and error reports for this document are welcome; +please e-mail them to the author or open a bug in the Python bug +tracker. + +* Menu: + +* PEP 308; Conditional Expressions: PEP 308 Conditional Expressions. +* PEP 309; Partial Function Application: PEP 309 Partial Function Application. +* PEP 314; Metadata for Python Software Packages v1.1: PEP 314 Metadata for Python Software Packages v1 1. +* PEP 328; Absolute and Relative Imports: PEP 328 Absolute and Relative Imports. +* PEP 338; Executing Modules as Scripts: PEP 338 Executing Modules as Scripts. +* PEP 341; Unified try/except/finally: PEP 341 Unified try/except/finally. +* PEP 342; New Generator Features: PEP 342 New Generator Features. +* PEP 343; The ‘with’ statement: PEP 343 The ‘with’ statement<2>. +* PEP 352; Exceptions as New-Style Classes: PEP 352 Exceptions as New-Style Classes. +* PEP 353; Using ssize_t as the index type: PEP 353 Using ssize_t as the index type. +* PEP 357; The ‘__index__’ method: PEP 357 The ‘__index__’ method. +* Other Language Changes: Other Language Changes<16>. +* New, Improved, and Removed Modules: New Improved and Removed Modules. +* Build and C API Changes: Build and C API Changes<10>. +* Porting to Python 2.5: Porting to Python 2 5. +* Acknowledgements: Acknowledgements<3>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0356/ + + +File: python.info, Node: PEP 308 Conditional Expressions, Next: PEP 309 Partial Function Application, Up: What’s New in Python 2 5 + +1.17.1 PEP 308: Conditional Expressions +--------------------------------------- + +For a long time, people have been requesting a way to write conditional +expressions, which are expressions that return value A or value B +depending on whether a Boolean value is true or false. A conditional +expression lets you write a single assignment statement that has the +same effect as the following: + + if condition: + x = true_value + else: + x = false_value + +There have been endless tedious discussions of syntax on both python-dev +and comp.lang.python. A vote was even held that found the majority of +voters wanted conditional expressions in some form, but there was no +syntax that was preferred by a clear majority. Candidates included C’s +‘cond ? true_v : false_v’, ‘if cond then true_v else false_v’, and 16 +other variations. + +Guido van Rossum eventually chose a surprising syntax: + + x = true_value if condition else false_value + +Evaluation is still lazy as in existing Boolean expressions, so the +order of evaluation jumps around a bit. The 'condition' expression in +the middle is evaluated first, and the 'true_value' expression is +evaluated only if the condition was true. Similarly, the 'false_value' +expression is only evaluated when the condition is false. + +This syntax may seem strange and backwards; why does the condition go in +the 'middle' of the expression, and not in the front as in C’s ‘c ? x : +y’? The decision was checked by applying the new syntax to the modules +in the standard library and seeing how the resulting code read. In many +cases where a conditional expression is used, one value seems to be the +‘common case’ and one value is an ‘exceptional case’, used only on rarer +occasions when the condition isn’t met. The conditional syntax makes +this pattern a bit more obvious: + + contents = ((doc + '\n') if doc else '') + +I read the above statement as meaning “here 'contents' is usually +assigned a value of ‘doc+'\n'’; sometimes 'doc' is empty, in which +special case an empty string is returned.” I doubt I will use +conditional expressions very often where there isn’t a clear common and +uncommon case. + +There was some discussion of whether the language should require +surrounding conditional expressions with parentheses. The decision was +made to 'not' require parentheses in the Python language’s grammar, but +as a matter of style I think you should always use them. Consider these +two statements: + + # First version -- no parens + level = 1 if logging else 0 + + # Second version -- with parens + level = (1 if logging else 0) + +In the first version, I think a reader’s eye might group the statement +into ‘level = 1’, ‘if logging’, ‘else 0’, and think that the condition +decides whether the assignment to 'level' is performed. The second +version reads better, in my opinion, because it makes it clear that the +assignment is always performed and the choice is being made between two +values. + +Another reason for including the brackets: a few odd combinations of +list comprehensions and lambdas could look like incorrect conditional +expressions. See PEP 308(1) for some examples. If you put parentheses +around your conditional expressions, you won’t run into this case. + +See also +........ + +PEP 308(2) - Conditional Expressions + + PEP written by Guido van Rossum and Raymond D. Hettinger; + implemented by Thomas Wouters. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0308/ + + (2) https://peps.python.org/pep-0308/ + + +File: python.info, Node: PEP 309 Partial Function Application, Next: PEP 314 Metadata for Python Software Packages v1 1, Prev: PEP 308 Conditional Expressions, Up: What’s New in Python 2 5 + +1.17.2 PEP 309: Partial Function Application +-------------------------------------------- + +The *note functools: 5f. module is intended to contain tools for +functional-style programming. + +One useful tool in this module is the ‘partial()’ function. For +programs written in a functional style, you’ll sometimes want to +construct variants of existing functions that have some of the +parameters filled in. Consider a Python function ‘f(a, b, c)’; you +could create a new function ‘g(b, c)’ that was equivalent to ‘f(1, b, +c)’. This is called “partial function application”. + +‘partial()’ takes the arguments ‘(function, arg1, arg2, ... +kwarg1=value1, kwarg2=value2)’. The resulting object is callable, so +you can just call it to invoke 'function' with the filled-in arguments. + +Here’s a small but realistic example: + + 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') + +Here’s another example, from a program that uses PyGTK. Here a +context-sensitive pop-up menu is being constructed dynamically. The +callback provided for the menu option is a partially applied version of +the ‘open_item()’ method, where the first argument has been provided. + + ... + 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) ) + +Another function in the *note functools: 5f. module is the +‘update_wrapper(wrapper, wrapped)’ function that helps you write +well-behaved decorators. ‘update_wrapper()’ copies the name, module, +and docstring attribute to a wrapper function so that tracebacks inside +the wrapped function are easier to understand. For example, you might +write: + + def my_decorator(f): + def wrapper(*args, **kwds): + print 'Calling decorated function' + return f(*args, **kwds) + functools.update_wrapper(wrapper, f) + return wrapper + +‘wraps()’ is a decorator that can be used inside your own decorators to +copy the wrapped function’s information. An alternate version of the +previous example would be: + + def my_decorator(f): + @functools.wraps(f) + def wrapper(*args, **kwds): + print 'Calling decorated function' + return f(*args, **kwds) + return wrapper + +See also +........ + +PEP 309(1) - Partial Function Application + + PEP proposed and written by Peter Harris; implemented by Hye-Shik + Chang and Nick Coghlan, with adaptations by Raymond Hettinger. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0309/ + + +File: python.info, Node: PEP 314 Metadata for Python Software Packages v1 1, Next: PEP 328 Absolute and Relative Imports, Prev: PEP 309 Partial Function Application, Up: What’s New in Python 2 5 + +1.17.3 PEP 314: Metadata for Python Software Packages v1.1 +---------------------------------------------------------- + +Some simple dependency support was added to Distutils. The ‘setup()’ +function now has ‘requires’, ‘provides’, and ‘obsoletes’ keyword +parameters. When you build a source distribution using the ‘sdist’ +command, the dependency information will be recorded in the ‘PKG-INFO’ +file. + +Another new keyword parameter is ‘download_url’, which should be set to +a URL for the package’s source code. This means it’s now possible to +look up an entry in the package index, determine the dependencies for a +package, and download the required packages. + + 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), + ) + +Another new enhancement to the Python package index at +‘https://pypi.org’ is storing source and binary archives for a package. +The new ‘upload’ Distutils command will upload a package to the +repository. + +Before a package can be uploaded, you must be able to build a +distribution using the ‘sdist’ Distutils command. Once that works, you +can run ‘python setup.py upload’ to add your package to the PyPI +archive. Optionally you can GPG-sign the package by supplying the +‘--sign’ and ‘--identity’ options. + +Package uploading was implemented by Martin von Löwis and Richard Jones. + +See also +........ + +PEP 314(1) - Metadata for Python Software Packages v1.1 + + PEP proposed and written by A.M. Kuchling, Richard Jones, and Fred + Drake; implemented by Richard Jones and Fred Drake. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0314/ + + +File: python.info, Node: PEP 328 Absolute and Relative Imports, Next: PEP 338 Executing Modules as Scripts, Prev: PEP 314 Metadata for Python Software Packages v1 1, Up: What’s New in Python 2 5 + +1.17.4 PEP 328: Absolute and Relative Imports +--------------------------------------------- + +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. + +The more complicated part has been implemented in Python 2.5: importing +a module can be specified to use absolute or package-relative imports. +The plan is to move toward making absolute imports the default in future +versions of Python. + +Let’s say you have a package directory like this: + + pkg/ + pkg/__init__.py + pkg/main.py + pkg/string.py + +This defines a package named ‘pkg’ containing the ‘pkg.main’ and +‘pkg.string’ submodules. + +Consider the code in the ‘main.py’ module. What happens if it executes +the statement ‘import string’? In Python 2.4 and earlier, it will first +look in the package’s directory to perform a relative import, finds +‘pkg/string.py’, imports the contents of that file as the ‘pkg.string’ +module, and that module is bound to the name ‘string’ in the ‘pkg.main’ +module’s namespace. + +That’s fine if ‘pkg.string’ was what you wanted. But what if you wanted +Python’s standard *note string: d3. module? There’s no clean way to +ignore ‘pkg.string’ and look for the standard module; generally you had +to look at the contents of ‘sys.modules’, which is slightly unclean. +Holger Krekel’s ‘py.std’ package provides a tidier way to perform +imports from the standard library, ‘import py; py.std.string.join()’, +but that package isn’t available on all Python installations. + +Reading code which relies on relative imports is also less clear, +because a reader may be confused about which module, *note string: d3. +or ‘pkg.string’, is intended to be used. Python users soon learned not +to duplicate the names of standard library modules in the names of their +packages’ submodules, but you can’t protect against having your +submodule’s name being used for a new module added in a future version +of Python. + +In Python 2.5, you can switch *note import: 5de.’s behaviour to absolute +imports using a ‘from __future__ import absolute_import’ directive. +This absolute-import behaviour will become the default in a future +version (probably Python 2.7). Once absolute imports are the default, +‘import string’ will always find the standard library’s version. It’s +suggested that users should begin using absolute imports as much as +possible, so it’s preferable to begin writing ‘from pkg import string’ +in your code. + +Relative imports are still possible by adding a leading period to the +module name when using the ‘from ... import’ form: + + # Import names from pkg.string + from .string import name1, name2 + # Import pkg.string + from . import string + +This imports the *note string: d3. module relative to the current +package, so in ‘pkg.main’ this will import 'name1' and 'name2' from +‘pkg.string’. Additional leading periods perform the relative import +starting from the parent of the current package. For example, code in +the ‘A.B.C’ module can do: + + from . import D # Imports A.B.D + from .. import E # Imports A.E + from ..F import G # Imports A.F.G + +Leading periods cannot be used with the ‘import modname’ form of the +import statement, only the ‘from ... import’ form. + +See also +........ + +PEP 328(2) - Imports: Multi-Line and Absolute/Relative + + PEP written by Aahz; implemented by Thomas Wouters. + +‘https://pylib.readthedocs.io/’ + + The py library by Holger Krekel, which contains the ‘py.std’ + package. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0328/ + + (2) https://peps.python.org/pep-0328/ + + +File: python.info, Node: PEP 338 Executing Modules as Scripts, Next: PEP 341 Unified try/except/finally, Prev: PEP 328 Absolute and Relative Imports, Up: What’s New in Python 2 5 + +1.17.5 PEP 338: Executing Modules as Scripts +-------------------------------------------- + +The *note -m: 5dd. switch added in Python 2.4 to execute a module as a +script gained a few more abilities. Instead of being implemented in C +code inside the Python interpreter, the switch now uses an +implementation in a new module, *note runpy: be. + +The *note runpy: be. module implements a more sophisticated import +mechanism so that it’s now possible to run modules in a package such as +‘pychecker.checker’. The module also supports alternative import +mechanisms such as the *note zipimport: 132. module. This means you can +add a .zip archive’s path to ‘sys.path’ and then use the *note -m: 5dd. +switch to execute code from the archive. + +See also +........ + +PEP 338(1) - Executing modules as scripts + + PEP written and implemented by Nick Coghlan. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0338/ + + +File: python.info, Node: PEP 341 Unified try/except/finally, Next: PEP 342 New Generator Features, Prev: PEP 338 Executing Modules as Scripts, Up: What’s New in Python 2 5 + +1.17.6 PEP 341: Unified try/except/finally +------------------------------------------ + +Until Python 2.5, the *note try: 6e4. statement came in two flavours. +You could use a *note finally: 9ca. block to ensure that code is always +executed, or one or more *note except: 18b. 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 spent some time working with Java, which does support +the equivalent of combining *note except: 18b. blocks and a *note +finally: 9ca. block, and this clarified what the statement should mean. +In Python 2.5, you can now write: + + try: + block-1 ... + except Exception1: + handler-1 ... + except Exception2: + handler-2 ... + else: + else-block + finally: + final-block + +The code in 'block-1' is executed. If the code raises an exception, the +various *note except: 18b. blocks are tested: if the exception is of +class ‘Exception1’, 'handler-1' is executed; otherwise if it’s of class +‘Exception2’, 'handler-2' is executed, and so forth. If no exception is +raised, the 'else-block' is executed. + +No matter what happened previously, the 'final-block' is executed once +the code block is complete and any raised exceptions handled. Even if +there’s an error in an exception handler or the 'else-block' and a new +exception is raised, the code in the 'final-block' is still run. + +See also +........ + +PEP 341(1) - Unifying try-except and try-finally + + PEP written by Georg Brandl; implementation by Thomas Lee. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0341/ + + +File: python.info, Node: PEP 342 New Generator Features, Next: PEP 343 The ‘with’ statement<2>, Prev: PEP 341 Unified try/except/finally, Up: What’s New in Python 2 5 + +1.17.7 PEP 342: New Generator Features +-------------------------------------- + +Python 2.5 adds a simple way to pass values 'into' a generator. As +introduced in Python 2.3, generators only produce output; once a +generator’s code was invoked to create an iterator, there was no way to +pass any new information into the function when its execution is +resumed. Sometimes the ability to pass in some information would be +useful. Hackish solutions to this include making the generator’s code +look at a global variable and then changing the global variable’s value, +or passing in some mutable object that callers then modify. + +To refresh your memory of basic generators, here’s a simple example: + + 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: 9cd. 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(): 7d3. method, picking up +after the ‘yield’ statement. + +In Python 2.3, *note yield: 9cd. 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) + +I recommend that you always put parentheses around a *note yield: 9cd. +expression when you’re doing something with the returned value, as in +the above example. The parentheses aren’t always necessary, but it’s +easier to always add them instead of having to remember when they’re +needed. + +( PEP 342(1) explains the exact rules, which are that a *note yield: +9cd.-expression must always be parenthesized except when it occurs at +the top-level expression on the right-hand side of an assignment. This +means you can write ‘val = yield i’ but have to use parentheses when +there’s an operation, as in ‘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: 9cd. +expression returns the specified 'value'. If the regular *note next(): +7d3. method is called, the ‘yield’ returns *note None: 671. + +Here’s the previous example, modified to allow changing the value of the +internal counter. + + 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 + +And here’s an example of changing the counter: + + >>> 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: 9cd. will usually return *note None: 671, so you should +always check for this case. Don’t just use its value in expressions +unless you’re sure that the ‘send()’ method will be the only method used +to resume your generator function. + +In addition to ‘send()’, there are two other new methods on generators: + + * ‘throw(type, value=None, traceback=None)’ is used to raise an + exception inside the generator; the exception is raised by the + *note yield: 9cd. expression where the generator’s execution is + paused. + + * ‘close()’ raises a new *note GeneratorExit: 1393. exception inside + the generator to terminate the iteration. On receiving this + exception, the generator’s code must either raise *note + GeneratorExit: 1393. or *note StopIteration: bfa. Catching the + *note GeneratorExit: 1393. exception and returning a value is + illegal and will trigger a *note RuntimeError: 195.; if the + function raises some other exception, that exception is propagated + to the caller. ‘close()’ will also be called by Python’s garbage + collector when the generator is garbage-collected. + + If you need to run cleanup code when a *note GeneratorExit: 1393. + occurs, I suggest using a ‘try: ... finally:’ suite instead of + catching *note GeneratorExit: 1393. + +The cumulative effect of these changes is to turn generators from +one-way producers of information into both producers and consumers. + +Generators also become 'coroutines', a more generalized form of +subroutines. Subroutines are entered at one point and exited at another +point (the top of the function, and a *note return: 9ce. statement), but +coroutines can be entered, exited, and resumed at many different points +(the *note yield: 9cd. statements). We’ll have to figure out patterns +for using coroutines effectively in 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: 9ca. clause will now always get a chance to run. The syntactic +restriction that you couldn’t mix *note yield: 9cd. 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: 5ce. +statement described by PEP 343(2). I’ll look at this new statement in +the following section. + +Another even more esoteric effect of this change: previously, the +‘gi_frame’ attribute of a generator was always a frame object. It’s now +possible for ‘gi_frame’ to be ‘None’ once the generator has been +exhausted. + +See also +........ + +PEP 342(3) - Coroutines via Enhanced Generators + + PEP written by Guido van Rossum and Phillip J. Eby; implemented by + Phillip J. Eby. Includes examples of some fancier uses of + generators as coroutines. + + Earlier versions of these features were proposed in PEP 288(4) by + Raymond Hettinger and PEP 325(5) by Samuele Pedroni. + +‘https://en.wikipedia.org/wiki/Coroutine’ + + The Wikipedia entry for coroutines. + +‘https://web.archive.org/web/20160321211320/http://www.sidhe.org/~dan/blog/archives/000178.html’ + + An explanation of coroutines from a Perl point of view, written by + Dan Sugalski. + + ---------- 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 The ‘with’ statement<2>, Next: PEP 352 Exceptions as New-Style Classes, Prev: PEP 342 New Generator Features, Up: What’s New in Python 2 5 + +1.17.8 PEP 343: The ‘with’ statement +------------------------------------ + +The ‘*note with: 5ce.’ statement clarifies code that previously would +use ‘try...finally’ blocks to ensure that clean-up code is executed. In +this section, I’ll discuss the statement as it will commonly be used. +In the next section, I’ll examine the implementation details and show +how to write objects for use with this statement. + +The ‘*note with: 5ce.’ statement is a new control-flow structure whose +basic structure is: + + 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__(): 5c4. and *note __exit__(): 12f3. methods. + +The object’s *note __enter__(): 5c4. 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__(): 12f3. method is called, even if the block raised an +exception, and can therefore run clean-up code. + +To enable the statement in Python 2.5, you need to add the following +directive to your module: + + from __future__ import with_statement + +The statement will always be enabled in Python 2.6. + +Some standard Python objects now support the context management protocol +and can be used with the ‘*note with: 5ce.’ statement. File objects are +one example: + + with open('/etc/passwd', 'r') as f: + for line in f: + print line + ... more processing code ... + +After this statement has executed, the file object in 'f' will have been +automatically closed, even if the *note for: 2ec. loop raised an +exception part-way through the block. + + Note: In this case, 'f' is the same object created by *note open(): + 517, because *note __enter__(): 5c4. returns 'self'. + +The *note threading: ed. module’s locks and condition variables also +support the ‘*note with: 5ce.’ statement: + + lock = threading.Lock() + with lock: + # Critical section of code + ... + +The lock is acquired before the block is executed and always released +once the block is complete. + +The new ‘localcontext()’ function in the *note decimal: 36. 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: + +* Writing Context Managers: Writing Context Managers<2>. +* The contextlib module: The contextlib module<2>. + + +File: python.info, Node: Writing Context Managers<2>, Next: The contextlib module<2>, Up: PEP 343 The ‘with’ statement<2> + +1.17.8.1 Writing Context Managers +................................. + +Under the hood, the ‘*note with: 5ce.’ statement is fairly complicated. +Most people will only use ‘‘with’’ in company with existing objects and +don’t need to know these details, so you can skip the rest of this +section if you like. Authors of new objects will need to understand the +details of the underlying implementation and should keep reading. + +A high-level explanation of the context management protocol is: + + * The expression is evaluated and should result in an object called a + “context manager”. The context manager must have *note + __enter__(): 5c4. and *note __exit__(): 12f3. methods. + + * The context manager’s *note __enter__(): 5c4. method is called. + The value returned is assigned to 'VAR'. If no ‘'as VAR'’ clause is + present, the value is simply discarded. + + * The code in 'BLOCK' is executed. + + * If 'BLOCK' raises an exception, the ‘__exit__(type, value, + traceback)’ is called with the exception details, the same values + returned by *note sys.exc_info(): 686. The method’s return value + controls whether the 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: 5ce.’ + statement will never realize anything went wrong. + + * If 'BLOCK' didn’t raise an exception, the *note __exit__(): 12f3. + method is still called, but 'type', 'value', and 'traceback' are + all ‘None’. + +Let’s think through an example. I won’t present detailed code but will +only sketch the methods necessary for a database that supports +transactions. + +(For people unfamiliar with database terminology: a set of changes to +the database are grouped into a transaction. Transactions can be either +committed, meaning that all the changes are written into the database, +or rolled back, meaning that the changes are all discarded and the +database is unchanged. See any database textbook for more information.) + +Let’s assume there’s an object representing a database connection. Our +goal will be to let the user write code like this: + + 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__(): 5c4. 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: 5ce.’ 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__(): 12f3. 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. + +In the code below, execution will just fall off the end of the function, +returning the default value of ‘None’. ‘None’ is false, so the +exception will be re-raised automatically. If you wished, you could be +more explicit and add a *note return: 9ce. statement at the marked +location. + + 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: The contextlib module<2>, Prev: Writing Context Managers<2>, Up: PEP 343 The ‘with’ statement<2> + +1.17.8.2 The contextlib module +.............................. + +The new *note contextlib: 23. module provides some functions and a +decorator that are useful for writing objects for use with the ‘*note +with: 5ce.’ statement. + +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: 9cd. +will be executed as the *note __enter__(): 5c4. method, and the value +yielded will be the method’s return value that will get bound to the +variable in the ‘*note with: 5ce.’ statement’s ‘as’ clause, if any. The +code after the *note yield: 9cd. will be executed in the *note +__exit__(): 12f3. method. Any exception raised in the block will be +raised by the ‘yield’ statement. + +Our database example from the previous section could be written using +this decorator as: + + 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: + ... + +The *note contextlib: 23. module also has a ‘nested(mgr1, mgr2, ...)’ +function that combines a number of context managers so you don’t need to +write nested ‘*note with: 5ce.’ statements. In this example, the single +‘‘with’’ statement both starts a database transaction and acquires a +thread lock: + + lock = threading.Lock() + with nested (db_transaction(db), lock) as (cursor, locked): + ... + +Finally, the ‘closing(object)’ function returns 'object' so that it can +be bound to a variable, and calls ‘object.close’ 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) + +See also +........ + +PEP 343(1) - The “with” statement + + PEP written by Guido van Rossum and Nick Coghlan; implemented by + Mike Bland, Guido van Rossum, and Neal Norwitz. The PEP shows the + code generated for a ‘*note with: 5ce.’ statement, which can be + helpful in learning how the statement works. + +The documentation for the *note contextlib: 23. module. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0343/ + + +File: python.info, Node: PEP 352 Exceptions as New-Style Classes, Next: PEP 353 Using ssize_t as the index type, Prev: PEP 343 The ‘with’ statement<2>, Up: What’s New in Python 2 5 + +1.17.9 PEP 352: Exceptions as New-Style Classes +----------------------------------------------- + +Exception classes can now be new-style classes, not just classic +classes, and the built-in *note Exception: 9d9. class and all the +standard built-in exceptions (*note NameError: 43a, *note ValueError: +204, etc.) are now new-style classes. + +The inheritance hierarchy for exceptions has been rearranged a bit. In +2.5, the inheritance relationships are: + + BaseException # New in Python 2.5 + |- KeyboardInterrupt + |- SystemExit + |- Exception + |- (all other current built-in exceptions) + +This rearrangement was done because people often want to catch all +exceptions that indicate program errors. *note KeyboardInterrupt: 9d1. +and *note SystemExit: d40. aren’t errors, though, and usually represent +an explicit action such as the user hitting ‘Control’-‘C’ or code +calling *note sys.exit(): 133c. A bare ‘except:’ will catch all +exceptions, so you commonly need to list *note KeyboardInterrupt: 9d1. +and *note SystemExit: d40. in order to re-raise them. The usual pattern +is: + + try: + ... + except (KeyboardInterrupt, SystemExit): + raise + except: + # Log error... + # Continue running program... + +In Python 2.5, you can now write ‘except Exception’ to achieve the same +result, catching all the exceptions that usually indicate errors but +leaving *note KeyboardInterrupt: 9d1. and *note SystemExit: d40. alone. +As in previous versions, a bare ‘except:’ still catches all exceptions. + +The goal for Python 3.0 is to require any class raised as an exception +to derive from *note BaseException: 5b7. or some descendant of *note +BaseException: 5b7, and future releases in the Python 2.x series may +begin to enforce this constraint. Therefore, I suggest you begin making +all your exception classes derive from *note Exception: 9d9. now. It’s +been suggested that the bare ‘except:’ form should be removed in Python +3.0, but Guido van Rossum hasn’t decided whether to do this or not. + +Raising of strings as exceptions, as in the statement ‘raise "Error +occurred"’, is deprecated in Python 2.5 and will trigger a warning. The +aim is to be able to remove the string-exception feature in a few +releases. + +See also +........ + +PEP 352(1) - Required Superclass for Exceptions + + PEP written by Brett Cannon and Guido van Rossum; implemented by + Brett Cannon. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0352/ + + +File: python.info, Node: PEP 353 Using ssize_t as the index type, Next: PEP 357 The ‘__index__’ method, Prev: PEP 352 Exceptions as New-Style Classes, Up: What’s New in Python 2 5 + +1.17.10 PEP 353: Using ssize_t as the index type +------------------------------------------------ + +A wide-ranging change to Python’s C API, using a new *note Py_ssize_t: +a5f. 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.) + +A limit of 2147483647 items doesn’t really matter on a 32-bit platform +because you’ll run out of memory before hitting the length limit. Each +list item requires space for a pointer, which is 4 bytes, plus space for +a *note PyObject: 334. representing the item. 2147483647*4 is already +more bytes than a 32-bit address space can contain. + +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.) + +This change most strongly affects authors of C extension modules. +Python strings and container types such as lists and tuples now use +*note Py_ssize_t: a5f. to store their size. Functions such as *note +PyList_Size(): 13e5. now return *note Py_ssize_t: a5f. Code in +extension modules may therefore need to have some variables changed to +*note Py_ssize_t: a5f. + +The *note PyArg_ParseTuple(): 56e. and *note Py_BuildValue(): 8a6. +functions have a new conversion code, ‘n’, for *note Py_ssize_t: a5f. +*note PyArg_ParseTuple(): 56e.’s ‘s#’ and ‘t#’ still output int by +default, but you can define the macro ‘PY_SSIZE_T_CLEAN’ before +including ‘Python.h’ to make them return *note Py_ssize_t: a5f. + +PEP 353(1) has a section on conversion guidelines that extension authors +should read to learn about supporting 64-bit platforms. + +See also +........ + +PEP 353(2) - Using ssize_t as the index type + + PEP written and implemented by 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 The ‘__index__’ method, Next: Other Language Changes<16>, Prev: PEP 353 Using ssize_t as the index type, Up: What’s New in Python 2 5 + +1.17.11 PEP 357: The ‘__index__’ method +--------------------------------------- + +The NumPy developers had a problem that could only be solved by adding a +new special method, ‘__index__()’. When using slice notation, as in +‘[start:stop:step]’, the values of the 'start', 'stop', and 'step' +indexes must all be either integers or long integers. NumPy defines a +variety of specialized integer types corresponding to unsigned and +signed integers of 8, 16, 32, and 64 bits, but there was no way to +signal that these types could be used as slice indexes. + +Slicing can’t just use the existing ‘__int__()’ method because that +method is also used to implement coercion to integers. If slicing used +‘__int__()’, floating-point numbers would also become legal slice +indexes and that’s clearly an undesirable behaviour. + +Instead, a new special method called ‘__index__()’ was added. It takes +no arguments and returns an integer giving the slice index to use. For +example: + + class C: + def __index__ (self): + return self.value + +The return value must be either a Python integer or long integer. The +interpreter will check that the type returned is correct, and raises a +*note TypeError: 534. if this requirement isn’t met. + +A corresponding *note nb_index: 13e8. slot was added to the C-level +*note PyNumberMethods: 13e9. 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. + +See also +........ + +PEP 357(1) - Allowing Any Object to be Used for Slicing + + PEP written and implemented by Travis Oliphant. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0357/ + + +File: python.info, Node: Other Language Changes<16>, Next: New Improved and Removed Modules, Prev: PEP 357 The ‘__index__’ method, Up: What’s New in Python 2 5 + +1.17.12 Other Language Changes +------------------------------ + +Here are all of the changes that Python 2.5 makes to the core Python +language. + + * The *note dict: 258. type has a new hook for letting subclasses + provide a default value when a key isn’t contained in the + dictionary. When a key isn’t found, the dictionary’s + ‘__missing__(key)’ method will be called. This hook is used to + implement the new ‘defaultdict’ class in the *note collections: 1d. + module. The following example defines a dictionary that returns + zero for any missing key: + + 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 + + * Both 8-bit and Unicode strings have new ‘partition(sep)’ and + ‘rpartition(sep)’ methods that simplify a common use case. + + The ‘find(S)’ method is often used to get an index which is then + used to slice the string and obtain the pieces that are before and + after the separator. ‘partition(sep)’ condenses this pattern into + a single method call that returns a 3-tuple containing the + substring before the separator, the separator itself, and the + substring after the separator. If the separator isn’t found, the + first element of the tuple is the entire string and the other two + elements are empty. ‘rpartition(sep)’ also returns a 3-tuple but + starts searching from the end of the string; the ‘r’ stands for + ‘reverse’. + + Some examples: + + >>> ('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.) + + * The ‘startswith()’ and ‘endswith()’ methods of string types now + accept tuples of strings to check for. + + def is_image_file (filename): + return filename.endswith(('.gif', '.jpg', '.tiff')) + + (Implemented by Georg Brandl following a suggestion by Tom Lynn.) + + * The *note min(): f03. and *note max(): f04. built-in functions + gained a ‘key’ keyword parameter analogous to the ‘key’ argument + for ‘sort()’. This parameter supplies a function that takes a + single argument and is called for every value in the list; *note + min(): f03./*note max(): f04. will return the element with the + smallest/largest return value from this function. For example, to + find the longest string in a list, you can do: + + 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.) + + * Two new built-in functions, *note any(): 13ec. and *note all(): + 13ed, evaluate whether an iterator contains any true or false + values. *note any(): 13ec. returns *note True: c0d. if any value + returned by the iterator is true; otherwise it will return *note + False: b37. *note all(): 13ed. returns *note True: c0d. only if + all of the values returned by the iterator evaluate as true. + (Suggested by Guido van Rossum, and implemented by Raymond + Hettinger.) + + * The result of a class’s ‘__hash__()’ method can now be either a + long integer or a regular integer. If a long integer is returned, + the hash of that value is taken. In earlier versions the hash + value was required to be a regular integer, but in 2.5 the *note + id(): 13ee. built-in was changed to always return non-negative + numbers, and users often seem to use ‘id(self)’ in ‘__hash__()’ + methods (though this is discouraged). + + * ASCII is now the default encoding for modules. It’s now a syntax + error if a module contains string literals with 8-bit characters + but doesn’t have an encoding declaration. In Python 2.4 this + triggered a warning, not a syntax error. See PEP 263(1) for how to + declare a module’s encoding; for example, you might add a line like + this near the top of the source file: + + # -*- coding: latin1 -*- + + * A new warning, *note UnicodeWarning: 13ef, is triggered when you + attempt to compare a Unicode string and an 8-bit string that can’t + be converted to Unicode using the default ASCII encoding. The + result of the comparison is false: + + >>> 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 + + Previously this would raise a *note UnicodeDecodeError: a12. + exception, but in 2.5 this could result in puzzling problems when + accessing a dictionary. If you looked up ‘unichr(128)’ and + ‘chr(128)’ was being used as a key, you’d get a *note + UnicodeDecodeError: a12. exception. Other changes in 2.5 resulted + in this exception being raised instead of suppressed by the code in + ‘dictobject.c’ that implements dictionaries. + + Raising an exception for such a comparison is strictly correct, but + the change might have broken code, so instead *note UnicodeWarning: + 13ef. was introduced. + + (Implemented by Marc-André Lemburg.) + + * One error that Python programmers sometimes make is forgetting to + include an ‘__init__.py’ module in a package directory. Debugging + this mistake can be confusing, and usually requires running Python + with the *note -v: 13f0. switch to log all the paths searched. In + Python 2.5, a new *note ImportWarning: 4f6. warning is triggered + when an import would have picked up a directory as a package but no + ‘__init__.py’ was found. This warning is silently ignored by + default; provide the *note -Wd: 8c6. option when running the Python + executable to display the warning message. (Implemented by Thomas + Wouters.) + + * The list of base classes in a class definition can now be empty. + As an example, this is now legal: + + class C(): + pass + + (Implemented by Brett Cannon.) + +* Menu: + +* Interactive Interpreter Changes:: +* Optimizations: Optimizations<15>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0263/ + + +File: python.info, Node: Interactive Interpreter Changes, Next: Optimizations<15>, Up: Other Language Changes<16> + +1.17.12.1 Interactive Interpreter Changes +......................................... + +In the interactive interpreter, ‘quit’ and ‘exit’ have long been strings +so that new users get a somewhat helpful message when they try to quit: + + >>> quit + 'Use Ctrl-D (i.e. EOF) to exit.' + +In Python 2.5, ‘quit’ and ‘exit’ are now objects that still produce +string representations of themselves, but are also callable. Newbies +who try ‘quit()’ or ‘exit()’ will now exit the interpreter as they +expect. (Implemented by Georg Brandl.) + +The Python executable now accepts the standard long options *note -help: +5ec. and *note -version: d1b.; on Windows, it also accepts the *note /?: +13f3. option for displaying a help message. (Implemented by Georg +Brandl.) + + +File: python.info, Node: Optimizations<15>, Prev: Interactive Interpreter Changes, Up: Other Language Changes<16> + +1.17.12.2 Optimizations +....................... + +Several of the optimizations were developed at the NeedForSpeed sprint, +an event held in Reykjavik, Iceland, from May 21–28 2006. The sprint +focused on speed enhancements to the CPython implementation and was +funded by EWT LLC with local support from CCP Games. Those +optimizations added at this sprint are specially marked in the following +list. + + * When they were introduced in Python 2.4, the built-in *note set: + 5d5. and *note frozenset: 5d6. types were built on top of Python’s + dictionary type. In 2.5 the internal data structure has been + customized for implementing sets, and as a result sets will use a + third less memory and are somewhat faster. (Implemented by Raymond + Hettinger.) + + * The speed of some Unicode operations, such as finding substrings, + string splitting, and character map encoding and decoding, has been + improved. (Substring search and splitting improvements were added + by Fredrik Lundh and Andrew Dalke at the NeedForSpeed sprint. + Character maps were improved by Walter Dörwald and 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(): + ba./‘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: 204. from the ‘read*()’ method. (Implemented + by Thomas Wouters.) + + * The *note struct: d5. 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.) + + * The *note re: b9. module got a 1 or 2% speedup by switching to + Python’s allocator functions instead of the system’s ‘malloc()’ and + ‘free()’. (Contributed by Jack Diederich at the NeedForSpeed + sprint.) + + * The code generator’s peephole optimizer now performs simple + constant folding in expressions. If you write something like ‘a = + 2+3’, the code generator will do the arithmetic and produce code + corresponding to ‘a = 5’. (Proposed and implemented by 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: New Improved and Removed Modules, Next: Build and C API Changes<10>, Prev: Other Language Changes<16>, Up: What’s New in Python 2 5 + +1.17.13 New, Improved, and Removed Modules +------------------------------------------ + +The standard library received many enhancements and bug fixes in Python +2.5. Here’s a partial list of the most notable changes, sorted +alphabetically by module name. Consult the ‘Misc/NEWS’ file in the +source tree for a more complete list of changes, or look through the SVN +logs for all the details. + + * The ‘audioop’ module now supports the a-LAW encoding, and the code + for u-LAW encoding has been improved. (Contributed by Lars + Immisch.) + + * The *note codecs: 1b. module gained support for incremental codecs. + The ‘codec.lookup()’ function now returns a ‘CodecInfo’ instance + instead of a tuple. ‘CodecInfo’ instances behave like a 4-tuple to + preserve backward compatibility but also have the attributes + ‘encode’, ‘decode’, ‘incrementalencoder’, ‘incrementaldecoder’, + ‘streamwriter’, and ‘streamreader’. Incremental codecs can receive + input and produce output in multiple chunks; the output is the same + as if the entire input was fed to the non-incremental codec. See + the *note codecs: 1b. module documentation for details. (Designed + and implemented by Walter Dörwald.) + + * The *note collections: 1d. module gained a new type, ‘defaultdict’, + that subclasses the standard *note dict: 258. type. The new type + mostly behaves like a dictionary but constructs a default value + when a key isn’t present, automatically adding it to the dictionary + for the requested key value. + + The first argument to ‘defaultdict’’s constructor is a factory + function that gets called whenever a key is requested but not + found. This factory function receives no arguments, so you can use + built-in type constructors such as *note list(): 60d. or *note + int(): 259. For example, you can make an index of words based on + their initial letter like this: + + 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) + + Printing ‘index’ results in the following output: + + defaultdict(, {'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.) + + * The ‘deque’ double-ended queue type supplied by the *note + collections: 1d. module now has a ‘remove(value)’ method that + removes the first occurrence of 'value' in the queue, raising *note + ValueError: 204. if the value isn’t found. (Contributed by Raymond + Hettinger.) + + * New module: The *note contextlib: 23. module contains helper + functions for use with the new ‘*note with: 5ce.’ statement. See + section *note The contextlib module: 13df. for more about this + module. + + * New module: The *note cProfile: 27. module is a C implementation of + the existing *note profile: af. module that has much lower + overhead. The module’s interface is the same as *note profile: + af.: 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 + *note profile: af. module’s interface, will continue to be + maintained in future versions of Python. (Contributed by Armin + Rigo.) + + Also, the *note pstats: b0. module for analyzing the data measured + by the profiler now supports directing the output to any file + object by supplying a 'stream' argument to the ‘Stats’ constructor. + (Contributed by Skip Montanaro.) + + * The *note csv: 29. 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. + + The CSV parser is now stricter about multi-line quoted fields. + Previously, if a line ended within a quoted field without a + terminating newline character, a newline would be inserted into the + returned field. This behavior caused problems when reading files + that contained carriage return characters within fields, so the + code was changed to return the field without inserting newlines. + As a consequence, if newlines embedded within fields are important, + the input should be split into lines in a manner that preserves the + newline characters. + + (Contributed by Skip Montanaro and Andrew McNamara.) + + * The *note datetime: 1cc. class in the *note datetime: 30. 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(): 13f8. and *note + time.strftime(): 11db.: + + from datetime import datetime + + ts = datetime.strptime('10:13:15 2006-03-07', + '%H:%M:%S %Y-%m-%d') + + * The ‘SequenceMatcher.get_matching_blocks()’ method in the *note + difflib: 37. module now guarantees to return a minimal list of + blocks describing matching subsequences. Previously, the algorithm + would occasionally break a block of matching elements into two list + entries. (Enhancement by Tim Peters.) + + * The *note doctest: 3a. module gained a ‘SKIP’ option that keeps an + example from being executed at all. This is intended for code + snippets that are usage examples intended for the reader and aren’t + actually test cases. + + An 'encoding' parameter was added to the ‘testfile()’ function and + the ‘DocFileSuite’ class to specify the file’s encoding. This + makes it easier to use non-ASCII characters in tests contained + within a docstring. (Contributed by Bjorn Tillenius.) + + * The *note email: 3b. package has been updated to version 4.0. + (Contributed by Barry Warsaw.) + + * The *note fileinput: 5b. module was made more flexible. Unicode + filenames are now supported, and a 'mode' parameter that defaults + to ‘"r"’ was added to the *note input(): 12cb. function to allow + opening files in binary or *note universal newlines: d3a. mode. + Another new parameter, 'openhook', lets you use a function other + than *note open(): 517. to open the input files. Once you’re + iterating over the set of files, the ‘FileInput’ object’s new *note + fileno(): 13f9. returns the file descriptor for the currently + opened file. (Contributed by Georg Brandl.) + + * In the *note gc: 60. module, the new ‘get_count()’ function returns + a 3-tuple containing the current collection counts for the three GC + generations. This is accounting information for the garbage + collector; when these counts reach a specified threshold, a garbage + collection sweep will be made. The existing *note gc.collect(): + a39. function now takes an optional 'generation' argument of 0, 1, + or 2 to specify which generation to collect. (Contributed by Barry + Warsaw.) + + * The ‘nsmallest()’ and ‘nlargest()’ functions in the *note heapq: + 69. module now support a ‘key’ keyword parameter similar to the one + provided by the *note min(): f03./*note max(): f04. functions and + the ‘sort()’ methods. For example: + + >>> 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.) + + * The *note itertools.islice(): b4c. function now accepts ‘None’ for + the start and step arguments. This makes it more compatible with + the attributes of slice objects, so that you can now write the + following: + + s = slice(5) # Create slice object + itertools.islice(iterable, s.start, s.stop, s.step) + + (Contributed by Raymond Hettinger.) + + * The *note format(): 61b. function in the *note locale: 86. module + has been modified and two new functions were added, + ‘format_string()’ and ‘currency()’. + + The *note format(): 61b. function’s 'val' parameter could + previously be a string as long as no more than one %char specifier + appeared; now the parameter must be exactly one %char specifier + with no surrounding text. An optional 'monetary' parameter was + also added which, if ‘True’, will use the locale’s rules for + formatting currency in placing a separator between groups of three + digits. + + To format strings with multiple %char specifiers, use the new + ‘format_string()’ function that works like *note format(): 61b. but + also supports mixing %char specifiers with arbitrary text. + + A new ‘currency()’ function was also added that formats a number + according to the current locale’s settings. + + (Contributed by Georg Brandl.) + + * The *note mailbox: 8b. module underwent a massive rewrite to add + the capability to modify mailboxes in addition to reading them. A + new set of classes that include ‘mbox’, ‘MH’, and ‘Maildir’ are + used to read mailboxes, and have an ‘add(message)’ method to add + messages, ‘remove(key)’ to remove messages, and ‘lock()’/‘unlock()’ + to lock/unlock the mailbox. The following example converts a + maildir-format mailbox into an mbox-format one: + + 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.) + + * The *note operator: 9f. module’s ‘itemgetter()’ and ‘attrgetter()’ + functions now support multiple fields. A call such as + ‘operator.attrgetter('a', 'b')’ will return a function that + retrieves the ‘a’ and ‘b’ attributes. Combining this new feature + with the ‘sort()’ method’s ‘key’ parameter lets you easily sort + lists using multiple fields. (Contributed by Raymond Hettinger.) + + * The *note optparse: a0. module was updated to version 1.5.1 of the + Optik library. The ‘OptionParser’ class gained an ‘epilog’ + attribute, a string that will be printed after the help message, + and a ‘destroy()’ method to break reference cycles created by the + object. (Contributed by Greg Ward.) + + * The *note os: a1. module underwent several changes. The + ‘stat_float_times’ variable now defaults to true, meaning that + *note os.stat(): 49c. will now return time values as floats. (This + doesn’t necessarily mean that *note os.stat(): 49c. will return + times that are precise to fractions of a second; not all systems + support such precision.) + + Constants named *note os.SEEK_SET: 1280, *note os.SEEK_CUR: 1281, + and *note os.SEEK_END: 1282. have been added; these are the + parameters to the *note os.lseek(): 110b. function. Two new + constants for locking are *note os.O_SHLOCK: 13fa. and *note + os.O_EXLOCK: 13fb. + + Two new functions, ‘wait3()’ and ‘wait4()’, were added. They’re + similar the ‘waitpid()’ function which waits for a child process to + exit and returns a tuple of the process ID and its exit status, but + ‘wait3()’ and ‘wait4()’ return additional information. ‘wait3()’ + doesn’t take a process ID as input, so it waits for any child + process to exit and returns a 3-tuple of 'process-id', + 'exit-status', 'resource-usage' as returned from the *note + resource.getrusage(): 13fc. function. ‘wait4(pid)’ does take a + process ID. (Contributed by Chad J. Schroeder.) + + On FreeBSD, the *note os.stat(): 49c. function now returns times + with nanosecond resolution, and the returned object now has + ‘st_gen’ and ‘st_birthtime’. The ‘st_flags’ attribute is also + available, if the platform supports it. (Contributed by Antti + Louko and Diego Pettenò.) + + * The Python debugger provided by the *note pdb: a5. module can now + store lists of commands to execute when a breakpoint is reached and + execution stops. Once breakpoint #1 has been created, enter + ‘commands 1’ and enter a series of commands to be executed, + finishing the list with ‘end’. The command list can include + commands that resume execution, such as ‘continue’ or ‘next’. + (Contributed by Grégoire Dooms.) + + * The *note pickle: a6. and ‘cPickle’ modules no longer accept a + return value of ‘None’ from the *note __reduce__(): 9d3. 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: a9. 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.) + + * The pybench benchmark suite by Marc-André Lemburg is now included + in the ‘Tools/pybench’ directory. The pybench suite is an + improvement on the commonly used ‘pystone.py’ program because + pybench provides a more detailed measurement of the interpreter’s + speed. It times particular operations such as function calls, + tuple slicing, method lookups, and numeric operations, instead of + performing many different operations and reducing the result to a + single number as ‘pystone.py’ does. + + * The ‘pyexpat’ module now uses version 2.0 of the Expat parser. + (Contributed by Trent Mick.) + + * The *note Queue: 137a. 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.) + + * The old ‘regex’ and ‘regsub’ modules, which have been deprecated + ever since Python 2.0, have finally been deleted. Other deleted + modules: ‘statcache’, ‘tzparse’, ‘whrandom’. + + * Also deleted: the ‘lib-old’ directory, which includes ancient + modules such as ‘dircmp’ and ‘ni’, was removed. ‘lib-old’ wasn’t + on the default ‘sys.path’, so unless your programs explicitly added + the directory to ‘sys.path’, this removal shouldn’t affect your + code. + + * The *note rlcompleter: bd. module is no longer dependent on + importing the *note readline: ba. module and therefore now works on + non-Unix platforms. (Patch from Robert Kiendl.) + + * The *note SimpleXMLRPCServer: 12f. and *note DocXMLRPCServer: 12f. + 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: cc. 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)’. + + Two new methods on socket objects, ‘recv_into(buffer)’ and + ‘recvfrom_into(buffer)’, store the received data in an object that + supports the buffer protocol instead of returning the data as a + string. This means you can put the data directly into an array or + a memory-mapped file. + + Socket objects also gained ‘getfamily()’, ‘gettype()’, and + ‘getproto()’ accessor methods to retrieve the family, type, and + protocol values for the socket. + + * New module: the ‘spwd’ module provides functions for accessing the + shadow password database on systems that support shadow passwords. + + * The *note struct: d5. is now faster because it compiles format + strings into ‘Struct’ objects with ‘pack()’ and ‘unpack()’ methods. + This is similar to how the *note re: b9. module lets you create + compiled regular expression objects. You can still use the + module-level ‘pack()’ and ‘unpack()’ functions; they’ll create + ‘Struct’ objects and cache them. Or you can use ‘Struct’ instances + directly: + + 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.) + + * The Python developers switched from CVS to Subversion during the + 2.5 development process. Information about the exact build version + is available as the ‘sys.subversion’ variable, a 3-tuple of + ‘(interpreter-name, branch-name, revision-range)’. For example, at + the time of writing my copy of 2.5 was reporting ‘('CPython', + 'trunk', '45313:45315')’. + + This information is also available to C extensions via the *note + Py_GetBuildInfo(): 13fd. function that returns a string of build + information like this: ‘"trunk:45355:45356M, Apr 13 2006, + 07:42:19"’. (Contributed by Barry Warsaw.) + + * Another new function, *note sys._current_frames(): 13fe, returns + the current stack frames for all running threads as a dictionary + mapping thread identifiers to the topmost stack frame currently + active in that thread at the time the function is called. + (Contributed by Tim Peters.) + + * The ‘TarFile’ class in the *note tarfile: de. module now has an + ‘extractall()’ method that extracts all members from the archive + into the current working directory. It’s also possible to set a + different directory as the extraction target, and to unpack only a + subset of the archive’s members. + + The compression used for a tarfile opened in stream mode can now be + autodetected using the mode ‘'r|*'’. (Contributed by Lars + Gustäbel.) + + * The *note threading: ed. module now lets you set the stack size + used when new threads are created. The ‘stack_size([*size*])’ + function returns the currently configured stack size, and supplying + the optional 'size' parameter sets a new value. Not all platforms + support changing the stack size, but Windows, POSIX threading, and + OS/2 all do. (Contributed by Andrew MacIntyre.) + + * The *note unicodedata: 105. 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: 13ff. + + * New module: the *note uuid: 110. module generates universally + unique identifiers (UUIDs) according to RFC 4122(2). The RFC + defines several different UUID versions that are generated from a + starting string, from system properties, or purely randomly. This + module contains a ‘UUID’ class and functions named ‘uuid1()’, + ‘uuid3()’, ‘uuid4()’, and ‘uuid5()’ to generate different versions + of UUID. (Version 2 UUIDs are not specified in RFC 4122(3) and are + not supported by this 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') + + (Contributed by Ka-Ping Yee.) + + * The *note weakref: 114. module’s ‘WeakKeyDictionary’ and + ‘WeakValueDictionary’ types gained new methods for iterating over + the weak references contained in the dictionary. ‘iterkeyrefs()’ + and ‘keyrefs()’ methods were added to ‘WeakKeyDictionary’, and + ‘itervaluerefs()’ and ‘valuerefs()’ were added to + ‘WeakValueDictionary’. (Contributed by Fred L. Drake, Jr.) + + * The *note webbrowser: 115. 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(): 517. 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: 12e. module now supports returning *note + datetime: 1cc. objects for the XML-RPC date type. Supply + ‘use_datetime=True’ to the *note loads(): 1400. function or the + ‘Unmarshaller’ class to enable this feature. (Contributed by Skip + Montanaro.) + + * The *note zipfile: 131. module now supports the ZIP64 version of + the format, meaning that a .zip archive can now be larger than 4 + GiB and can contain individual files larger than 4 GiB. + (Contributed by Ronald Oussoren.) + + * The *note zlib: 133. module’s ‘Compress’ and ‘Decompress’ objects + now support a *note copy(): 25. method that makes a copy of the + object’s internal state and returns a new ‘Compress’ or + ‘Decompress’ object. (Contributed by Chris AtLee.) + +* Menu: + +* The ctypes package:: +* The ElementTree package:: +* The hashlib package:: +* The sqlite3 package:: +* The wsgiref package:: + + ---------- 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: The ctypes package, Next: The ElementTree package, Up: New Improved and Removed Modules + +1.17.13.1 The ctypes package +............................ + +The *note ctypes: 2a. package, written by Thomas Heller, has been added +to the standard library. *note ctypes: 2a. lets you call arbitrary +functions in shared libraries or DLLs. Long-time users may remember the +‘dl’ module, which provides functions for loading shared libraries and +calling functions in them. The *note ctypes: 2a. package is much +fancier. + +To load a shared library or DLL, you must create an instance of the +‘CDLL’ class and provide the name or path of the shared library or DLL. +Once that’s done, you can call arbitrary functions by accessing them as +attributes of the ‘CDLL’ object. + + 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.) + +You shouldn’t use ‘c_char_p()’ with a Python string when the C function +will be modifying the memory area, because Python strings are supposed +to be immutable; breaking this rule will cause puzzling bugs. When you +need a modifiable memory area, use ‘create_string_buffer()’: + + s = "this is a string" + buf = ctypes.create_string_buffer(s) + libc.strfry(buf) + +C functions are assumed to return integers, but you can set the +‘restype’ attribute of the function object to change this: + + >>> libc.atof('2.71828') + -1783957616 + >>> libc.atof.restype = ctypes.c_double + >>> libc.atof('2.71828') + 2.71828 + +*note ctypes: 2a. 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: 1403. type constructor that will create a *note PyObject: +334.* 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(): 1403.; if it’s omitted you end up +with a segmentation fault. + +*note ctypes: 2a. has been around for a while, but people still write +and distribution hand-coded extension modules because you can’t rely on +*note ctypes: 2a. being present. Perhaps developers will begin to write +Python wrappers atop a library accessed through *note ctypes: 2a. +instead of extension modules, now that *note ctypes: 2a. is included +with core Python. + +See also +........ + +‘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. + +The documentation for the *note ctypes: 2a. module. + + +File: python.info, Node: The ElementTree package, Next: The hashlib package, Prev: The ctypes package, Up: New Improved and Removed Modules + +1.17.13.2 The ElementTree package +................................. + +A subset of Fredrik Lundh’s ElementTree library for processing XML has +been added to the standard library as ‘xml.etree’. The available +modules are ‘ElementTree’, ‘ElementPath’, and ‘ElementInclude’ from +ElementTree 1.2.6. The ‘cElementTree’ accelerator module is also +included. + +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 represents an XML document as a tree of element nodes. The +text content of the document is stored as the ‘text’ and ‘tail’ +attributes of (This is one of the major differences between ElementTree +and the Document Object Model; in the DOM there are many different types +of node, including ‘TextNode’.) + +The most commonly used parsing function is ‘parse()’, that takes either +a string (assumed to contain a filename) or a file-like object and +returns an ‘ElementTree’ instance: + + 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) + +Once you have an ‘ElementTree’ instance, you can call its ‘getroot()’ +method to get the root ‘Element’ node. + +There’s also an ‘XML()’ function that takes a string literal and returns +an ‘Element’ node (not an ‘ElementTree’). This function provides a tidy +way to incorporate XML fragments, approaching the convenience of an XML +literal: + + svg = ET.XML(""" + """) + svg.set('height', '320px') + svg.append(elem1) + +Each XML element supports some dictionary-like and some list-like access +methods. Dictionary-like operations are used to access attribute +values, and list-like operations are used to access child nodes. + +Operation Result + +------------------------------------------------------------------------------------- + +‘elem[n]’ Returns n’th child element. + + +‘elem[m:n]’ Returns list of m’th through n’th child + elements. + + +‘len(elem)’ Returns number of child elements. + + +‘list(elem)’ Returns list of child elements. + + +‘elem.append(elem2)’ Adds 'elem2' as a child. + + +‘elem.insert(index, elem2)’ Inserts 'elem2' at the specified location. + + +‘del elem[n]’ Deletes n’th child element. + + +‘elem.keys()’ Returns list of attribute names. + + +‘elem.get(name)’ Returns value of attribute 'name'. + + +‘elem.set(name, value)’ Sets new value for attribute 'name'. + + +‘elem.attrib’ Retrieves the dictionary containing + attributes. + + +‘del elem.attrib[name]’ Deletes attribute 'name'. + + +Comments and processing instructions are also represented as ‘Element’ +nodes. To check if a node is a comment or processing instructions: + + if elem.tag is ET.Comment: + ... + elif elem.tag is ET.ProcessingInstruction: + ... + +To generate XML output, you should call the ‘ElementTree.write()’ +method. Like ‘parse()’, it can take either a string or a file-like +object: + + # Encoding is US-ASCII + tree.write('output.xml') + + # Encoding is UTF-8 + f = open('output.xml', 'w') + tree.write(f, encoding='utf-8') + +(Caution: the default encoding used for output is ASCII. For general XML +work, where an element’s name may contain arbitrary Unicode characters, +ASCII isn’t a very useful encoding because it will raise an exception if +an element’s name contains any characters with values greater than 127. +Therefore, it’s best to specify a different encoding such as UTF-8 that +can handle any Unicode character.) + +This section is only a partial description of the ElementTree +interfaces. Please read the package’s official documentation for more +details. + +See also +........ + +‘https://web.archive.org/web/20201124024954/http://effbot.org/zone/element-index.htm’ + + Official documentation for ElementTree. + + +File: python.info, Node: The hashlib package, Next: The sqlite3 package, Prev: The ElementTree package, Up: New Improved and Removed Modules + +1.17.13.3 The hashlib package +............................. + +A new *note hashlib: 68. module, written by Gregory P. Smith, has been +added to replace the ‘md5’ and ‘sha’ modules. *note hashlib: 68. 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 + +Once a hash object has been created, its methods are the same as before: +‘update(string)’ hashes the specified string into the current digest +state, ‘digest()’ and ‘hexdigest()’ return the digest value as a binary +string or a string of hex digits, and *note copy(): 25. returns a new +hashing object with the same digest state. + +See also +........ + +The documentation for the *note hashlib: 68. module. + + +File: python.info, Node: The sqlite3 package, Next: The wsgiref package, Prev: The hashlib package, Up: New Improved and Removed Modules + +1.17.13.4 The sqlite3 package +............................. + +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: cf. + +SQLite is a C library that provides a lightweight disk-based database +that doesn’t require a separate server process and allows accessing the +database using a nonstandard variant of the SQL query language. Some +applications can use SQLite for internal data storage. It’s also +possible to prototype an application using SQLite and then port the code +to a larger database such as PostgreSQL or Oracle. + +pysqlite was written by Gerhard Häring and provides a SQL interface +compliant with the DB-API 2.0 specification described by PEP 249(1). + +If you’re compiling the Python source yourself, note that the source +tree doesn’t include the SQLite code, only the wrapper module. You’ll +need to have the SQLite libraries and headers installed before compiling +Python, and the build process will compile the module when the necessary +headers are available. + +To use the module, you must first create a ‘Connection’ object that +represents the database. Here the data will be stored in the +‘/tmp/example’ file: + + conn = sqlite3.connect('/tmp/example') + +You can also supply the special name ‘:memory:’ to create a database in +RAM. + +Once you have a ‘Connection’, you can create a ‘Cursor’ object and call +its ‘execute()’ method to perform SQL commands: + + 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)""") + +Usually your SQL operations will need to use values from Python +variables. You shouldn’t assemble your query using Python’s string +operations because doing so is insecure; it makes your program +vulnerable to an SQL injection attack. + +Instead, use the DB-API’s parameter substitution. Put ‘?’ as a +placeholder wherever you want to use a value, and then provide a tuple +of values as the second argument to the cursor’s ‘execute()’ method. +(Other database modules may use a different placeholder, such as ‘%s’ or +‘:1’.) For example: + + # 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) + +To retrieve data after executing a SELECT statement, you can either +treat the cursor as an iterator, call the cursor’s ‘fetchone()’ method +to retrieve a single matching row, or call ‘fetchall()’ to get a list of +the matching rows. + +This example uses the iterator form: + + >>> 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) + >>> + +For more information about the SQL dialect supported by SQLite, see +‘https://www.sqlite.org’. + +See also +........ + +‘https://www.pysqlite.org’ + + The pysqlite web page. + +‘https://www.sqlite.org’ + + The SQLite web page; the documentation describes the syntax and the + available data types for the supported SQL dialect. + +The documentation for the *note sqlite3: cf. module. + +PEP 249(2) - Database API Specification 2.0 + + PEP written by Marc-André Lemburg. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0249/ + + (2) https://peps.python.org/pep-0249/ + + +File: python.info, Node: The wsgiref package, Prev: The sqlite3 package, Up: New Improved and Removed Modules + +1.17.13.5 The wsgiref package +............................. + +The Web Server Gateway Interface (WSGI) v1.0 defines a standard +interface between web servers and Python web applications and is +described in PEP 333(1). The *note wsgiref: 118. package is a reference +implementation of the WSGI specification. + +The package includes a basic HTTP server that will run a WSGI +application; this server is useful for debugging but isn’t intended for +production use. Setting up a server takes only a few lines of code: + + from wsgiref import simple_server + + wsgi_app = ... + + host = '' + port = 8000 + httpd = simple_server.make_server(host, port, wsgi_app) + httpd.serve_forever() + +See also +........ + +‘https://web.archive.org/web/20160331090247/http://wsgi.readthedocs.org/en/latest/’ + + A central web site for WSGI-related resources. + +PEP 333(2) - Python Web Server Gateway Interface v1.0 + + PEP written by Phillip J. Eby. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0333/ + + (2) https://peps.python.org/pep-0333/ + + +File: python.info, Node: Build and C API Changes<10>, Next: Porting to Python 2 5, Prev: New Improved and Removed Modules, Up: What’s New in Python 2 5 + +1.17.14 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * The Python source tree was converted from CVS to Subversion, in a + complex migration procedure that was supervised and flawlessly + carried out by Martin von Löwis. The procedure was developed as + 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: a5f. type + definition instead of int. See the earlier section *note PEP 353; + Using ssize_t as the index type: 13e3. 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(): 192. 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 + """, "", '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(): c66, *note PyMem_Realloc(): 102b, and *note + PyMem_Free(): 140e. are one family that allocates raw memory, while + *note PyObject_Malloc(): c68, *note PyObject_Realloc(): 140f, and + *note PyObject_Free(): c65. 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. + + * The built-in set types now have an official C API. Call *note + PySet_New(): 1410. and *note PyFrozenSet_New(): 1411. to create a + new set, *note PySet_Add(): 1412. and *note PySet_Discard(): 1413. + to add and remove elements, and *note PySet_Contains(): 1414. and + *note PySet_Size(): 1415. to examine the set’s state. (Contributed + by Raymond Hettinger.) + + * C code can now obtain information about the exact revision of the + Python interpreter by calling the *note Py_GetBuildInfo(): 13fd. + function that returns a string of build information like this: + ‘"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. ‘Py_LOCAL(type)’ declares the function as returning a value + of the specified 'type' and uses a fast-calling qualifier. + ‘Py_LOCAL_INLINE(type)’ 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)’ can now accept a tuple of + base classes as its 'base' argument. (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(): 1416, 2 is the function above that, + and so forth. (Added by Neal Norwitz.) + + * The CPython interpreter is still written in C, but the code can now + be compiled with a C++ compiler without errors. (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: + +* Port-Specific Changes:: + + ---------- 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: Port-Specific Changes, Up: Build and C API Changes<10> + +1.17.14.1 Port-Specific Changes +............................... + + * MacOS X (10.3 and higher): dynamic loading of modules now uses the + ‘dlopen()’ function instead of MacOS-specific functions. + + * 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’ is no longer supported as a filename extension for + extension modules. ‘.pyd’ is now the only filename extension that + will be searched for. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=2573 + + +File: python.info, Node: Porting to Python 2 5, Next: Acknowledgements<3>, Prev: Build and C API Changes<10>, Up: What’s New in Python 2 5 + +1.17.15 Porting to Python 2.5 +----------------------------- + +This section lists previously described changes that may require changes +to your code: + + * ASCII is now the default encoding for modules. It’s now a syntax + error if a module contains string literals with 8-bit characters + but doesn’t have an encoding declaration. In Python 2.4 this + triggered a warning, not a syntax error. + + * Previously, the ‘gi_frame’ attribute of a generator was always a + frame object. Because of the PEP 342(1) changes described in + section *note PEP 342; New Generator Features: 13cf, it’s now + possible for ‘gi_frame’ to be ‘None’. + + * A new warning, *note UnicodeWarning: 13ef, is triggered when you + attempt to compare a Unicode string and an 8-bit string that can’t + be converted to Unicode using the default ASCII encoding. + Previously such comparisons would raise a *note UnicodeDecodeError: + a12. exception. + + * Library: the *note csv: 29. module is now stricter about multi-line + quoted fields. If your files contain newlines embedded within + fields, the input should be split into lines in a manner which + preserves the newline characters. + + * Library: the *note locale: 86. module’s *note format(): 61b. + function’s would previously accept any string as long as no more + than one %char specifier appeared. In Python 2.5, the argument + must be exactly one %char specifier with no surrounding text. + + * Library: The *note pickle: a6. and ‘cPickle’ modules no longer + accept a return value of ‘None’ from the *note __reduce__(): 9d3. + 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: 12f. and *note + DocXMLRPCServer: 12f. 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: a5f. 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; Using + ssize_t as the index type: 13e3. 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: Acknowledgements<3>, Prev: Porting to Python 2 5, Up: What’s New in Python 2 5 + +1.17.16 Acknowledgements +------------------------ + +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.18 What’s New in Python 2.4 +============================= + + +Author: A.M. Kuchling + +This article explains the new features in Python 2.4.1, released on +March 30, 2005. + +Python 2.4 is a medium-sized release. It doesn’t introduce as many +changes as the radical Python 2.2, but introduces more features than the +conservative 2.3 release. The most significant new language features +are function decorators and generator expressions; most other changes +are to the standard library. + +According to the CVS change logs, there were 481 patches applied and 502 +bugs fixed between Python 2.3 and 2.4. Both figures are likely to be +underestimates. + +This article doesn’t attempt to provide a complete specification of +every single new feature, but instead provides a brief introduction to +each feature. For full details, you should refer to the documentation +for Python 2.4, such as the Python Library Reference and the Python +Reference Manual. Often you will be referred to the PEP for a +particular new feature for explanations of the implementation and design +rationale. + +* Menu: + +* PEP 218; Built-In Set Objects: PEP 218 Built-In Set Objects. +* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers. +* PEP 289; Generator Expressions: PEP 289 Generator Expressions. +* PEP 292; Simpler String Substitutions: PEP 292 Simpler String Substitutions. +* PEP 318; Decorators for Functions and Methods: PEP 318 Decorators for Functions and Methods. +* PEP 322; Reverse Iteration: PEP 322 Reverse Iteration. +* PEP 324; New subprocess Module: PEP 324 New subprocess Module. +* PEP 327; Decimal Data Type: PEP 327 Decimal Data Type. +* PEP 328; Multi-line Imports: PEP 328 Multi-line Imports. +* PEP 331; Locale-Independent Float/String Conversions: PEP 331 Locale-Independent Float/String Conversions. +* Other Language Changes: Other Language Changes<17>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<3>. +* Build and C API Changes: Build and C API Changes<11>. +* Porting to Python 2.4: Porting to Python 2 4. +* Acknowledgements: Acknowledgements<4>. + + +File: python.info, Node: PEP 218 Built-In Set Objects, Next: PEP 237 Unifying Long Integers and Integers, Up: What’s New in Python 2 4 + +1.18.1 PEP 218: Built-In Set Objects +------------------------------------ + +Python 2.3 introduced the ‘sets’ module. C implementations of set data +types have now been added to the Python core as two new built-in types, +‘set(iterable)’ and ‘frozenset(iterable)’. They provide high speed +operations for membership testing, for eliminating duplicates from +sequences, and for mathematical operations like unions, intersections, +differences, and symmetric differences. + + >>> 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']) + +The *note frozenset(): 5d6. type is an immutable version of *note set(): +5d5. Since it is immutable and hashable, it may be used as a dictionary +key or as a member of another set. + +The ‘sets’ module remains in the standard library, and may be useful if +you wish to subclass the ‘Set’ or ‘ImmutableSet’ classes. There are +currently no plans to deprecate the module. + +See also +........ + +PEP 218(1) - Adding a Built-In Set Object Type + + Originally proposed by Greg Wilson and ultimately implemented by + Raymond Hettinger. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0218/ + + +File: python.info, Node: PEP 237 Unifying Long Integers and Integers, Next: PEP 289 Generator Expressions, Prev: PEP 218 Built-In Set Objects, Up: What’s New in Python 2 4 + +1.18.2 PEP 237: Unifying Long Integers and Integers +--------------------------------------------------- + +The lengthy transition process for this PEP, begun in Python 2.2, takes +another step forward in Python 2.4. In 2.3, certain integer operations +that would behave differently after int/long unification triggered *note +FutureWarning: 411. warnings and returned values limited to 32 or 64 +bits (depending on your platform). In 2.4, these expressions no longer +produce a warning and instead produce a different result that’s usually +a long integer. + +The problematic expressions are primarily left shifts and lengthy +hexadecimal and octal constants. For example, ‘2 << 32’ results in a +warning in 2.3, evaluating to 0 on 32-bit platforms. In Python 2.4, +this expression now returns the correct answer, 8589934592. + +See also +........ + +PEP 237(1) - Unifying Long Integers and Integers + + Original PEP written by Moshe Zadka and GvR. The changes for 2.4 + were implemented by Kalle Svensson. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0237/ + + +File: python.info, Node: PEP 289 Generator Expressions, Next: PEP 292 Simpler String Substitutions, Prev: PEP 237 Unifying Long Integers and Integers, Up: What’s New in Python 2 4 + +1.18.3 PEP 289: Generator Expressions +------------------------------------- + +The iterator feature introduced in Python 2.2 and the *note itertools: +81. 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: + ... + +instead of + + for link in get_all_links(): + if link.followed: + continue + ... + +The first form is more concise and perhaps more readable, but if you’re +dealing with a large number of link objects you’d have to write the +second form to avoid having all link objects in memory at the same time. + +Generator expressions work similarly to list comprehensions but don’t +materialize the entire list; instead they create a generator that will +return elements one by one. The above example could be written as: + + links = (link for link in get_all_links() if not link.followed) + for link in links: + ... + +Generator expressions always have to be written inside parentheses, as +in the above example. The parentheses signalling a function call also +count, so if you want to create an iterator that will be immediately +passed to a function you could write: + + print sum(obj.count for obj in list_all_objects()) + +Generator expressions differ from list comprehensions in various small +ways. Most notably, the loop variable ('obj' in the above example) is +not accessible outside of the generator expression. List comprehensions +leave the variable assigned to its last value; future versions of Python +will change this, making list comprehensions match generator expressions +in this respect. + +See also +........ + +PEP 289(1) - Generator Expressions + + Proposed by Raymond Hettinger and implemented by Jiwon Seo with + early efforts steered by Hye-Shik Chang. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0289/ + + +File: python.info, Node: PEP 292 Simpler String Substitutions, Next: PEP 318 Decorators for Functions and Methods, Prev: PEP 289 Generator Expressions, Up: What’s New in Python 2 4 + +1.18.4 PEP 292: Simpler String Substitutions +-------------------------------------------- + +Some new classes in the standard library provide an alternative +mechanism for substituting variables into strings; this style of +substitution may be better for applications where untrained users need +to edit templates. + +The usual way of substituting variables by name is the ‘%’ operator: + + >>> '%(page)i: %(title)s' % {'page':2, 'title': 'The Best of Times'} + '2: The Best of Times' + +When writing the template string, it can be easy to forget the ‘i’ or +‘s’ after the closing parenthesis. This isn’t a big problem if the +template is in a Python module, because you run the code, get an +“Unsupported format character” *note ValueError: 204, and fix the +problem. However, consider an application such as Mailman where +template strings or translations are being edited by users who aren’t +aware of the Python language. The format string’s syntax is complicated +to explain to such users, and if they make a mistake, it’s difficult to +provide helpful feedback to them. + +PEP 292 adds a ‘Template’ class to the *note string: d3. module that +uses ‘$’ to indicate a substitution: + + >>> import string + >>> t = string.Template('$page: $title') + >>> t.substitute({'page':2, 'title': 'The Best of Times'}) + '2: The Best of Times' + +If a key is missing from the dictionary, the ‘substitute()’ method will +raise a *note KeyError: 33f. There’s also a ‘safe_substitute()’ method +that ignores missing keys: + + >>> t = string.Template('$page: $title') + >>> t.safe_substitute({'page':3}) + '3: $title' + +See also +........ + +PEP 292(1) - Simpler String Substitutions + + Written and implemented by Barry Warsaw. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0292/ + + +File: python.info, Node: PEP 318 Decorators for Functions and Methods, Next: PEP 322 Reverse Iteration, Prev: PEP 292 Simpler String Substitutions, Up: What’s New in Python 2 4 + +1.18.5 PEP 318: Decorators for Functions and Methods +---------------------------------------------------- + +Python 2.2 extended Python’s object model by adding static methods and +class methods, but it didn’t extend Python’s syntax to provide any new +way of defining static or class methods. Instead, you had to write a +*note def: 1423. statement in the usual way, and pass the resulting +method to a *note staticmethod(): 412. or *note classmethod(): 166. +function that would wrap up the function as a method of the new type. +Your code would look like this: + + class C: + def meth (cls): + ... + + meth = classmethod(meth) # Rebind name to wrapped-up class method + +If the method was very long, it would be easy to miss or forget the +*note classmethod(): 166. invocation after the function body. + +The intention was always to add some syntax to make such definitions +more readable, but at the time of 2.2’s release a good syntax was not +obvious. Today a good syntax 'still' isn’t obvious but users are asking +for easier access to the feature; a new syntactic feature has been added +to meet this need. + +The new feature is called “function decorators”. The name comes from +the idea that *note classmethod(): 166, *note staticmethod(): 412, and +friends are storing additional information on a function object; they’re +'decorating' functions with more details. + +The notation borrows from Java and uses the ‘'@'’ character as an +indicator. Using the new syntax, the example above would be written: + + class C: + + @classmethod + def meth (cls): + ... + +The ‘@classmethod’ is shorthand for the ‘meth=classmethod(meth)’ +assignment. More generally, if you have the following: + + @A + @B + @C + def f (): + ... + +It’s equivalent to the following pre-decorator code: + + def f(): ... + f = A(B(C(f))) + +Decorators must come on the line before a function definition, one +decorator per line, and can’t be on the same line as the def statement, +meaning that ‘@A def f(): ...’ is illegal. You can only decorate +function definitions, either at the module level or inside a class; you +can’t decorate class definitions. + +A decorator is just a function that takes the function to be decorated +as an argument and returns either the same function or some new object. +The return value of the decorator need not be callable (though it +typically is), unless further decorators will be applied to the result. +It’s easy to write your own decorators. The following simple example +just sets an attribute on the function object: + + >>> def deco(func): + ... func.attr = 'decorated' + ... return func + ... + >>> @deco + ... def f(): pass + ... + >>> f + + >>> f.attr + 'decorated' + >>> + +As a slightly more realistic example, the following decorator checks +that the supplied argument is an integer: + + 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 + +An example in PEP 318(1) contains a fancier version of this idea that +lets you both specify the required type and check the returned type. + +Decorator functions can take arguments. If arguments are supplied, your +decorator function is called with only those arguments and must return a +new decorator function; this function must take a single function and +return a function, as previously described. In other words, ‘@A @B +@C(args)’ becomes: + + def f(): ... + _deco = C(args) + f = A(B(_deco(f))) + +Getting this right can be slightly brain-bending, but it’s not too +difficult. + +A small related change makes the *note func_name: 12c7. 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. + +See also +........ + +PEP 318(2) - Decorators for Functions, Methods and Classes + + Written by Kevin D. Smith, Jim Jewett, and Skip Montanaro. Several + people wrote patches implementing function decorators, but the one + that was actually checked in was patch #979728, written by Mark + Russell. + +‘https://wiki.python.org/moin/PythonDecoratorLibrary’ + + This Wiki page contains several examples of decorators. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0318/ + + (2) https://peps.python.org/pep-0318/ + + +File: python.info, Node: PEP 322 Reverse Iteration, Next: PEP 324 New subprocess Module, Prev: PEP 318 Decorators for Functions and Methods, Up: What’s New in Python 2 4 + +1.18.6 PEP 322: Reverse Iteration +--------------------------------- + +A new built-in function, ‘reversed(seq)’, takes a sequence and returns +an iterator that loops over the elements of the sequence in reverse +order. + + >>> for i in reversed(xrange(1,4)): + ... print i + ... + 3 + 2 + 1 + +Compared to extended slicing, such as ‘range(1,4)[::-1]’, *note +reversed(): 862. is easier to read, runs faster, and uses substantially +less memory. + +Note that *note reversed(): 862. only accepts sequences, not arbitrary +iterators. If you want to reverse an iterator, first convert it to a +list with *note list(): 60d. + + >>> input = open('/etc/passwd', 'r') + >>> for line in reversed(list(input)): + ... print line + ... + root:*:0:0:System Administrator:/var/root:/bin/tcsh + ... + +See also +........ + +PEP 322(1) - Reverse Iteration + + Written and implemented by Raymond Hettinger. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0322/ + + +File: python.info, Node: PEP 324 New subprocess Module, Next: PEP 327 Decimal Data Type, Prev: PEP 322 Reverse Iteration, Up: What’s New in Python 2 4 + +1.18.7 PEP 324: New subprocess Module +------------------------------------- + +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: d6. +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: d6. +contains a single class called *note subprocess.Popen: 199. 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' is commonly a sequence of strings that will be the arguments to +the program executed as the subprocess. (If the 'shell' argument is +true, 'args' can be a string which will then be passed on to the shell +for interpretation, just as *note os.system(): 1426. does.) + +'stdin', 'stdout', and 'stderr' specify what the subprocess’s input, +output, and error streams will be. You can provide a file object or a +file descriptor, or you can use the constant ‘subprocess.PIPE’ to create +a pipe between the subprocess and the parent. + +The constructor has a number of handy options: + + * 'close_fds' requests that all file descriptors be closed before + running the subprocess. + + * 'cwd' specifies the working directory in which the subprocess will + be executed (defaulting to whatever the parent’s working directory + is). + + * 'env' is a dictionary specifying environment variables. + + * 'preexec_fn' is a function that gets called before the child is + started. + + * 'universal_newlines' opens the child’s input and output using + Python’s *note universal newlines: d3a. feature. + +Once you’ve created the ‘Popen’ instance, you can call its ‘wait()’ +method to pause until the subprocess has exited, ‘poll()’ to check if +it’s exited without pausing, or ‘communicate(data)’ to send the string +'data' to the subprocess’s standard input. ‘communicate(data)’ then +reads any data that the subprocess has sent to its standard output or +standard error, returning a tuple ‘(stdout_data, stderr_data)’. + +‘call()’ is a shortcut that passes its arguments along to the ‘Popen’ +constructor, waits for the command to complete, and returns the status +code of the subprocess. It can serve as a safer analog to *note +os.system(): 1426.: + + sts = subprocess.call(['dpkg', '-i', '/tmp/new-package.deb']) + if sts == 0: + # Success + ... + else: + # dpkg returned an error + ... + +The command is invoked without use of the shell. If you really do want +to use the shell, you can add ‘shell=True’ as a keyword argument and +provide a string instead of a sequence: + + sts = subprocess.call('dpkg -i /tmp/new-package.deb', shell=True) + +The PEP takes various examples of shell and Python code and shows how +they’d be translated into Python code that uses *note subprocess: d6. +Reading this section of the PEP is highly recommended. + +See also +........ + +PEP 324(1) - subprocess - New process module + + Written and implemented by Peter Åstrand, with assistance from + Fredrik Lundh and others. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0324/ + + +File: python.info, Node: PEP 327 Decimal Data Type, Next: PEP 328 Multi-line Imports, Prev: PEP 324 New subprocess Module, Up: What’s New in Python 2 4 + +1.18.8 PEP 327: Decimal Data Type +--------------------------------- + +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: + +* Why is Decimal needed?:: +* The Decimal type:: +* The Context type:: + + +File: python.info, Node: Why is Decimal needed?, Next: The Decimal type, Up: PEP 327 Decimal Data Type + +1.18.8.1 Why is Decimal needed? +............................... + +The limitations arise from the representation used for floating-point +numbers. FP numbers are made up of three components: + + * The sign, which is positive or negative. + + * The mantissa, which is a single-digit binary number followed by a + fractional part. For example, ‘1.01’ in base-2 notation is ‘1 + + 0/2 + 1/4’, or 1.25 in decimal notation. + + * The exponent, which tells where the decimal point is located in the + number represented. + +For example, the number 1.25 has positive sign, a mantissa value of 1.01 +(in binary), and an exponent of 0 (the decimal point doesn’t need to be +shifted). The number 5 has the same sign and mantissa, but the exponent +is 2 because the mantissa is multiplied by 4 (2 to the power of the +exponent 2); 1.25 * 4 equals 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. + +Sometimes you can see this inaccuracy when the number is printed: + + >>> 1.1 + 1.1000000000000001 + +The inaccuracy isn’t always visible when you print the number because +the FP-to-decimal-string conversion is provided by the C library, and +most C libraries try to produce sensible output. Even if it’s not +displayed, however, the inaccuracy is still there and subsequent +operations can magnify the error. + +For many applications this doesn’t matter. If I’m plotting points and +displaying them on my monitor, the difference between 1.1 and +1.1000000000000001 is too small to be visible. Reports often limit +output to a certain number of decimal places, and if you round the +number to two or three or even eight decimal places, the error is never +apparent. However, for applications where it does matter, it’s a lot of +work to implement your own custom arithmetic routines. + +Hence, the ‘Decimal’ type was created. + + +File: python.info, Node: The Decimal type, Next: The Context type, Prev: Why is Decimal needed?, Up: PEP 327 Decimal Data Type + +1.18.8.2 The ‘Decimal’ type +........................... + +A new module, *note decimal: 36, was added to Python’s standard library. +It contains two classes, ‘Decimal’ and ‘Context’. ‘Decimal’ instances +represent numbers, and ‘Context’ instances are used to wrap up various +settings such as the precision and default rounding mode. + +‘Decimal’ instances are immutable, like regular Python integers and FP +numbers; once it’s been created, you can’t change the value an instance +represents. ‘Decimal’ instances can be created from integers or +strings: + + >>> import decimal + >>> decimal.Decimal(1972) + Decimal("1972") + >>> decimal.Decimal("1.1") + Decimal("1.1") + +You can also provide tuples containing the sign, the mantissa +represented as a tuple of decimal digits, and the exponent: + + >>> decimal.Decimal((1, (1, 4, 7, 5), -2)) + Decimal("-14.75") + +Cautionary note: the sign bit is a Boolean value, so 0 is positive and 1 +is negative. + +Converting from floating-point numbers poses a bit of a problem: should +the FP number representing 1.1 turn into the decimal number for exactly +1.1, or for 1.1 plus whatever inaccuracies are introduced? The decision +was to dodge the issue and leave such a conversion out of the API. +Instead, you should convert the floating-point number into a string +using the desired precision and pass the string to the ‘Decimal’ +constructor: + + >>> f = 1.1 + >>> decimal.Decimal(str(f)) + Decimal("1.1") + >>> decimal.Decimal('%.12f' % f) + Decimal("1.100000000000") + +Once you have ‘Decimal’ instances, you can perform the usual +mathematical operations on them. One limitation: exponentiation +requires an integer exponent: + + >>> 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) + +You can combine ‘Decimal’ instances with integers, but not with +floating-point numbers: + + >>> 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’ numbers can be used with the *note math: 8e. and *note cmath: +18. modules, but note that they’ll be immediately converted to +floating-point numbers before the operation is performed, resulting in a +possible loss of precision and accuracy. You’ll also get back a regular +floating-point number and not a ‘Decimal’. + + >>> import math, cmath + >>> d = decimal.Decimal('123456789012.345') + >>> math.sqrt(d) + 351364.18288201344 + >>> cmath.sqrt(-d) + 351364.18288201344j + +‘Decimal’ instances have a ‘sqrt()’ method that returns a ‘Decimal’, but +if you need other things such as trigonometric functions you’ll have to +implement them. + + >>> d.sqrt() + Decimal("351364.1828820134592177245001") + + +File: python.info, Node: The Context type, Prev: The Decimal type, Up: PEP 327 Decimal Data Type + +1.18.8.3 The ‘Context’ type +........................... + +Instances of the ‘Context’ class encapsulate several settings for +decimal operations: + + * ‘prec’ is the precision, the number of decimal places. + + * ‘rounding’ specifies the rounding mode. The *note decimal: 36. + module has constants for the various possibilities: ‘ROUND_DOWN’, + ‘ROUND_CEILING’, ‘ROUND_HALF_EVEN’, and various others. + + * ‘traps’ is a dictionary specifying what happens on encountering + certain error conditions: either an exception is raised or a value + is returned. Some examples of error conditions are division by + zero, loss of precision, and overflow. + +There’s a thread-local default context available by calling +‘getcontext()’; you can change the properties of this context to alter +the default precision, rounding, or trap handling. The following +example shows the effect of changing the precision of the default +context: + + >>> 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") + +The default action for error conditions is selectable; the module can +either return a special value such as infinity or not-a-number, or +exceptions can be raised: + + >>> 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") + >>> + +The ‘Context’ instance also has various methods for formatting numbers +such as ‘to_eng_string()’ and ‘to_sci_string()’. + +For more information, see the documentation for the *note decimal: 36. +module, which includes a quick-start tutorial and a reference. + +See also +........ + +PEP 327(1) - Decimal Data Type + + Written by Facundo Batista and implemented by Facundo Batista, Eric + Price, Raymond Hettinger, Aahz, and Tim Peters. + +http://www.lahey.com/float.htm(2) + + The article uses Fortran code to illustrate many of the problems + that floating-point inaccuracy can cause. + +‘https://speleotrove.com/decimal/’ + + A description of a decimal-based representation. This + representation is being proposed as a standard, and underlies the + new Python decimal type. Much of this material was written by Mike + Cowlishaw, designer of the Rexx language. + + ---------- 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 Multi-line Imports, Next: PEP 331 Locale-Independent Float/String Conversions, Prev: PEP 327 Decimal Data Type, Up: What’s New in Python 2 4 + +1.18.9 PEP 328: Multi-line Imports +---------------------------------- + +One language change is a small syntactic tweak aimed at making it easier +to import many names from a module. In a ‘from module import names’ +statement, 'names' is a sequence of names separated by commas. If the +sequence is very long, you can either write multiple imports from the +same module, or you can use backslashes to escape the line endings like +this: + + from SimpleXMLRPCServer import SimpleXMLRPCServer,\ + SimpleXMLRPCRequestHandler,\ + CGIXMLRPCRequestHandler,\ + resolve_dotted_attribute + +The syntactic change in Python 2.4 simply allows putting the names +within parentheses. Python ignores newlines within a parenthesized +expression, so the backslashes are no longer needed: + + from SimpleXMLRPCServer import (SimpleXMLRPCServer, + SimpleXMLRPCRequestHandler, + CGIXMLRPCRequestHandler, + resolve_dotted_attribute) + +The PEP also proposes that all *note import: 5de. statements be absolute +imports, with a leading ‘.’ character to indicate a relative import. +This part of the PEP was not implemented for Python 2.4, but was +completed for Python 2.5. + +See also +........ + +PEP 328(1) - Imports: Multi-Line and Absolute/Relative + + Written by Aahz. Multi-line imports were implemented by Dima + Dorfman. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0328/ + + +File: python.info, Node: PEP 331 Locale-Independent Float/String Conversions, Next: Other Language Changes<17>, Prev: PEP 328 Multi-line Imports, Up: What’s New in Python 2 4 + +1.18.10 PEP 331: Locale-Independent Float/String Conversions +------------------------------------------------------------ + +The *note locale: 86. modules lets Python software select various +conversions and display conventions that are localized to a particular +country or language. However, the module was careful to not change the +numeric locale because various functions in Python’s implementation +required that the numeric locale remain set to the ‘'C'’ locale. Often +this was because the code was using the C library’s ‘atof()’ function. + +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. + +The solution described in the PEP is to add three new functions to the +Python API that perform ASCII-only conversions, ignoring the locale +setting: + + * ‘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: 86. module can now change the +numeric locale, letting extensions such as GTK+ produce the correct +results. + +See also +........ + +PEP 331(2) - Locale-Independent Float/String Conversions + + Written by Christian R. Reis, and implemented by 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: Other Language Changes<17>, Next: New Improved and Deprecated Modules<3>, Prev: PEP 331 Locale-Independent Float/String Conversions, Up: What’s New in Python 2 4 + +1.18.11 Other Language Changes +------------------------------ + +Here are all of the changes that Python 2.4 makes to the core Python +language. + + * Decorators for functions and methods were added ( PEP 318(1)). + + * Built-in *note set(): 5d5. and *note frozenset(): 5d6. types were + added ( PEP 218(2)). Other new built-ins include the + ‘reversed(seq)’ function ( PEP 322(3)). + + * Generator expressions were added ( PEP 289(4)). + + * Certain numeric expressions no longer return values restricted to + 32 or 64 bits ( PEP 237(5)). + + * You can now put parentheses around the list of names in a ‘from + module import names’ statement ( PEP 328(6)). + + * The *note dict.update(): 142e. method now accepts the same argument + forms as the *note dict: 258. constructor. This includes any + mapping, any iterable of key/value pairs, and keyword arguments. + (Contributed by Raymond Hettinger.) + + * The string methods ‘ljust()’, ‘rjust()’, and ‘center()’ now take an + optional argument for specifying a fill character other than a + space. (Contributed by Raymond Hettinger.) + + * Strings also gained an ‘rsplit()’ method that works like the + ‘split()’ method but splits from the end of the string. + (Contributed by Sean Reifschneider.) + + >>> 'www.python.org'.split('.', 1) + ['www', 'python.org'] + 'www.python.org'.rsplit('.', 1) + ['www.python', 'org'] + + * Three keyword parameters, 'cmp', 'key', and 'reverse', were added + to the ‘sort()’ method of lists. These parameters make some common + usages of ‘sort()’ simpler. All of these parameters are optional. + + For the 'cmp' parameter, the value should be a comparison function + that takes two parameters and returns -1, 0, or +1 depending on how + the parameters compare. This function will then be used to sort + the list. Previously this was the only parameter that could be + provided to ‘sort()’. + + 'key' should be a single-parameter function that takes a list + element and returns a comparison key for the element. The list is + then sorted using the comparison keys. The following example sorts + a list case-insensitively: + + >>> 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'] + + The last example, which uses the 'cmp' parameter, is the old way to + perform a case-insensitive sort. It works but is slower than using + a 'key' parameter. Using 'key' calls ‘lower()’ method once for + each element in the list while using 'cmp' will call it twice for + each comparison, so using 'key' saves on invocations of the + ‘lower()’ method. + + For simple key functions and comparison functions, it is often + possible to avoid a *note lambda: 128f. expression by using an + unbound method instead. For example, the above case-insensitive + sort is best written as: + + >>> L.sort(key=str.lower) + >>> L + ['A', 'b', 'c', 'D'] + + Finally, the 'reverse' parameter takes a Boolean value. If the + value is true, the list will be sorted into reverse order. Instead + of ‘L.sort(); L.reverse()’, you can now write + ‘L.sort(reverse=True)’. + + The results of sorting are now guaranteed to be stable. This means + that two entries with equal keys will be returned in the same order + as they were input. For example, you can sort a list of people by + name, and then sort the list by age, resulting in a list sorted by + age where people with the same age are in name-sorted order. + + (All changes to ‘sort()’ contributed by Raymond Hettinger.) + + * There is a new built-in function ‘sorted(iterable)’ that works like + the in-place *note list.sort(): bcf. method but can be used in + expressions. The differences are: + + * the input may be any iterable; + + * a newly formed copy is sorted, leaving the original intact; and + + * the expression returns the new sorted copy + + >>> 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.) + + * Integer operations will no longer trigger an ‘OverflowWarning’. + The ‘OverflowWarning’ warning will disappear in Python 2.5. + + * The interpreter gained a new switch, *note -m: 5dd, that takes a + name, searches for the corresponding module on ‘sys.path’, and runs + the module as a script. For example, you can now run the Python + profiler with ‘python -m profile’. (Contributed by Nick Coghlan.) + + * The ‘eval(expr, globals, locals)’ and ‘execfile(filename, globals, + locals)’ functions and the ‘exec’ statement now accept any mapping + type for the 'locals' parameter. Previously this had to be a + regular Python dictionary. (Contributed by Raymond Hettinger.) + + * The *note zip(): 7cb. built-in function and ‘itertools.izip()’ now + return an empty list if called with no arguments. Previously they + raised a *note TypeError: 534. exception. This makes them more + suitable for use with variable length argument lists: + + >>> 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: 671. is now a constant; code that binds a new value to + the name ‘None’ is now a syntax error. (Contributed by Raymond + Hettinger.) + +* Menu: + +* Optimizations: Optimizations<16>. + + ---------- 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: Optimizations<16>, Up: Other Language Changes<17> + +1.18.11.1 Optimizations +....................... + + * 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. ‘list.extend()’ was also optimized and no longer converts + its argument into a temporary list before extending the base list. + (Contributed by Raymond Hettinger.) + + * *note list(): 60d, *note tuple(): 36b, *note map(): 860, *note + filter(): 861, and *note zip(): 7cb. 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: New Improved and Deprecated Modules<3>, Next: Build and C API Changes<11>, Prev: Other Language Changes<17>, Up: What’s New in Python 2 4 + +1.18.12 New, Improved, and Deprecated Modules +--------------------------------------------- + +As usual, Python’s standard library received a number of enhancements +and bug fixes. Here’s a partial list of the most notable changes, +sorted alphabetically by module name. Consult the ‘Misc/NEWS’ file in +the source tree for a more complete list of changes, or look through the +CVS logs for all the details. + + * 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: e. 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.) + + * The *note bisect: 11. module now has an underlying C implementation + for improved performance. (Contributed by Dmitry Vasiliev.) + + * The CJKCodecs collections of East Asian codecs, maintained by + Hye-Shik Chang, was integrated into 2.4. The new encodings are: + + * 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 + + * Some other new encodings were added: HP Roman8, ISO_8859-11, + ISO_8859-16, PCTP-154, and TIS-620. + + * The UTF-8 and UTF-16 codecs now cope better with receiving partial + input. Previously the ‘StreamReader’ class would try to read more + data, making it impossible to resume decoding from the stream. The + ‘read()’ method will now return as much data as it can and future + calls will resume decoding where previous ones left off. + (Implemented by Walter Dörwald.) + + * There is a new *note collections: 1d. 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 + + Several modules, such as the ‘Queue’ and *note threading: ed. + modules, now take advantage of *note collections.deque: 5d8. for + improved performance. (Contributed by Raymond Hettinger.) + + * The *note ConfigParser: 22. classes have been enhanced slightly. + The *note read(): 1431. method now returns a list of the files that + were successfully parsed, and the *note set(): 1260. method raises + *note TypeError: 534. if passed a 'value' argument that isn’t a + string. (Contributed by John Belmonte and David Goodger.) + + * The *note curses: 2b. module now supports the ncurses extension + ‘use_default_colors()’. On platforms where the terminal supports + transparency, this makes it possible to use a transparent + background. (Contributed by Jörg Lehmann.) + + * The *note difflib: 37. module now includes an ‘HtmlDiff’ class that + creates an HTML table showing a side by side comparison of two + versions of a text. (Contributed by Dan Gass.) + + * The *note email: 3b. package was updated to version 3.0, which + dropped various deprecated APIs and removes support for Python + versions earlier than 2.3. The 3.0 version of the package uses a + new incremental parser for MIME messages, available in the + ‘email.FeedParser’ module. The new parser doesn’t require reading + the entire message into memory, and doesn’t raise exceptions if a + message is malformed; instead it records any problems in the + ‘defect’ attribute of the message. (Developed by Anthony Baxter, + Barry Warsaw, Thomas Wouters, and others.) + + * The *note heapq: 69. module has been converted to C. The resulting + tenfold improvement in speed makes the module suitable for handling + high volumes of data. In addition, the module has two new + functions ‘nlargest()’ and ‘nsmallest()’ that use heaps to find the + N largest or smallest values in a dataset without the expense of a + full sort. (Contributed by Raymond Hettinger.) + + * The *note httplib: 6e. 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.) + + * The *note imaplib: 74. module now supports IMAP’s THREAD command + (contributed by Yves Dionne) and new ‘deleteacl()’ and ‘myrights()’ + methods (contributed by Arnaud Mazin). + + * The *note itertools: 81. module gained a ‘groupby(iterable[, + *func*])’ function. 'iterable' is something that can be iterated + over to return a stream of elements, and the optional 'func' + parameter is a function that takes an element and returns a key + value; if omitted, the key is simply the element itself. + ‘groupby()’ then groups the elements into subsequences which have + matching values of the key, and returns a series of 2-tuples + containing the key value and an iterator over the subsequence. + + Here’s an example to make this clearer. The 'key' function simply + returns whether a number is even or odd, so the result of + ‘groupby()’ is to return consecutive runs of odd or even numbers. + + >>> 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()’ is typically used with sorted input. The logic for + ‘groupby()’ is similar to the Unix ‘uniq’ filter which makes it + handy for eliminating, counting, or identifying duplicate elements: + + >>> 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: 81. also gained a function named ‘tee(iterator, + N)’ that returns 'N' independent iterators that replicate + 'iterator'. If 'N' is omitted, the default is 2. + + >>> L = [1,2,3] + >>> i1, i2 = itertools.tee(L) + >>> i1,i2 + (, ) + >>> list(i1) # Run the first iterator to exhaustion + [1, 2, 3] + >>> list(i2) # Run the second iterator to exhaustion + [1, 2, 3] + + Note that ‘tee()’ has to keep copies of the values returned by the + iterator; in the worst case, it may need to keep all of them. This + should therefore be used carefully if the leading iterator can run + far ahead of the trailing iterator in a long stream of inputs. If + the separation is large, then you might as well use *note list(): + 60d. instead. When the iterators track closely with one another, + ‘tee()’ is ideal. Possible applications include bookmarking, + windowing, or lookahead iterators. (Contributed by Raymond + Hettinger.) + + * A number of functions were added to the *note locale: 86. 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.) + + * Some keyword arguments were added to the *note logging: 87. + package’s ‘basicConfig()’ function to simplify log configuration. + The default behavior is to log messages to standard error, but + various keyword arguments can be specified to log to a particular + file, change the logging format, or set the logging level. For + example: + + import logging + logging.basicConfig(filename='/var/log/application.log', + level=0, # Log all messages + format='%(levelname):%(process):%(thread):%(message)') + + Other additions to the *note logging: 87. package include a + ‘log(level, msg)’ convenience method, as well as a + ‘TimedRotatingFileHandler’ class that rotates its log files at a + timed interval. The module already had ‘RotatingFileHandler’, + which rotated logs once the file exceeded a certain size. Both + classes derive from a new ‘BaseRotatingHandler’ class that can be + used to implement other rotating handlers. + + (Changes implemented by Vinay Sajip.) + + * The *note marshal: 8d. module now shares interned strings on + unpacking a data structure. This may shrink the size of certain + pickle strings, but the primary effect is to make ‘.pyc’ files + significantly smaller. (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.) + + * Two new functions were added to the *note operator: 9f. module, + ‘attrgetter(attr)’ and ‘itemgetter(index)’. Both functions return + callables that take a single argument and return the corresponding + attribute or item; these callables make excellent data extractors + when used with *note map(): 860. or *note sorted(): bce. For + example: + + >>> 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.) + + * The *note optparse: a0. module was updated in various ways. The + module now passes its messages through *note gettext.gettext(): + 1432, making it possible to internationalize Optik’s help and error + messages. Help messages for options can now include the string + ‘'%default'’, which will be replaced by the option’s default value. + (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: 3b. package. To + this end, the *note email.Utils.formatdate: 1433. 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.) + + * A new ‘urandom(n)’ function was added to the *note os: a1. module, + returning a string containing 'n' bytes of random data. This + function provides access to platform-specific sources of randomness + such as ‘/dev/urandom’ on Linux or the Windows CryptoAPI. + (Contributed by Trevor Perrin.) + + * Another new function: ‘os.path.lexists(path)’ returns true if the + file specified by 'path' exists, whether or not it’s a symbolic + link. This differs from the existing ‘os.path.exists(path)’ + function, which returns false if 'path' is a symlink that points to + a destination that doesn’t exist. (Contributed by Beni + Cherniavsky.) + + * A new ‘getsid()’ function was added to the *note posix: ad. module + that underlies the *note os: a1. module. (Contributed by J. + Raynor.) + + * The *note poplib: ac. module now supports POP over SSL. + (Contributed by Hector Urtubia.) + + * The *note profile: af. module can now profile C extension + functions. (Contributed by Nick Bastin.) + + * The *note random: b8. module has a new method called + ‘getrandbits(N)’ that returns a long integer 'N' bits in length. + The existing ‘randrange()’ method now uses ‘getrandbits()’ where + appropriate, making generation of arbitrarily large random numbers + more efficient. (Contributed by Raymond Hettinger.) + + * The regular expression language accepted by the *note re: b9. + module was extended with simple conditional expressions, written as + ‘(?(group)A|B)’. 'group' is either a numeric group ID or a group + name defined with ‘(?P...)’ earlier in the expression. If + the specified group matched, the regular expression pattern 'A' + will be tested against the string; if the group didn’t match, the + pattern 'B' will be used instead. (Contributed by Gustavo + Niemeyer.) + + * The *note re: b9. module is also no longer recursive, thanks to a + massive amount of work by Gustavo Niemeyer. In a recursive regular + expression engine, certain patterns result in a large amount of C + stack space being consumed, and it was possible to overflow the + stack. For example, if you matched a 30000-byte string of ‘a’ + characters against the expression ‘(a|b)+’, one stack frame was + consumed per character. Python 2.3 tried to check for stack + overflow and raise a *note RuntimeError: 195. exception, but + certain patterns could sidestep the checking and if you were + unlucky Python could segfault. Python 2.4’s regular expression + engine can match this pattern without problems. + + * The *note signal: c6. module now performs tighter error-checking on + the parameters to the *note signal.signal(): 1128. function. For + example, you can’t set a handler on the ‘SIGKILL’ signal; previous + versions of Python would quietly accept this, but 2.4 will raise a + *note RuntimeError: 195. exception. + + * Two new functions were added to the *note socket: cc. module. + ‘socketpair()’ returns a pair of connected sockets and + ‘getservbyport(port)’ looks up the service name for a given port + number. (Contributed by Dave Cole and Barry Warsaw.) + + * The ‘sys.exitfunc()’ function has been deprecated. Code should be + using the existing *note atexit: c. module, which correctly handles + calling multiple exit functions. Eventually ‘sys.exitfunc()’ will + become a purely internal interface, accessed only by *note atexit: + c. + + * The *note tarfile: de. module now generates GNU-format tar files by + default. (Contributed by Lars Gustäbel.) + + * The *note threading: ed. module now has an elegantly simple way to + support thread-local data. The module contains a ‘local’ class + whose attribute values are local to different threads. + + import threading + + data = threading.local() + data.number = 42 + data.url = ('www.python.org', 80) + + Other threads can assign and retrieve their own values for the + ‘number’ and ‘url’ attributes. You can subclass ‘local’ to + initialize attributes or to add methods. (Contributed by Jim + Fulton.) + + * The *note timeit: ef. module now automatically disables periodic + garbage collection during the timing loop. This change makes + consecutive timings more comparable. (Contributed by Raymond + Hettinger.) + + * The *note weakref: 114. module now supports a wider variety of + objects including Python functions, class instances, sets, + frozensets, deques, arrays, files, sockets, and regular expression + pattern objects. (Contributed by Raymond Hettinger.) + + * The *note xmlrpclib: 12e. module now supports a multi-call + extension for transmitting multiple XML-RPC calls in a single HTTP + operation. (Contributed by Brian Quinlan.) + + * The ‘mpz’, ‘rotor’, and ‘xreadlines’ modules have been removed. + +* Menu: + +* cookielib:: +* doctest: doctest<5>. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc3548.html + + +File: python.info, Node: cookielib, Next: doctest<5>, Up: New Improved and Deprecated Modules<3> + +1.18.12.1 cookielib +................... + +The *note cookielib: 70. library supports client-side handling for HTTP +cookies, mirroring the *note Cookie: 71. 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. + +In order to store cookies across sessions, two implementations of cookie +jars are provided: one that stores cookies in the Netscape format so +applications can use the Mozilla or Lynx cookie files, and one that +stores cookies in the same format as the Perl libwww library. + +*note urllib2: 10b. has been changed to interact with *note cookielib: +70.: ‘HTTPCookieProcessor’ manages a cookie jar that is used when +accessing URLs. + +This module was contributed by John J. Lee. + + +File: python.info, Node: doctest<5>, Prev: cookielib, Up: New Improved and Deprecated Modules<3> + +1.18.12.2 doctest +................. + +The *note doctest: 3a. module underwent considerable refactoring thanks +to Edward Loper and Tim Peters. Testing can still be as simple as +running *note doctest.testmod(): 1436, but the refactorings allow +customizing the module’s operation in various ways + +The new ‘DocTestFinder’ class extracts the tests from a given object’s +docstrings: + + 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) + +The new ‘DocTestRunner’ class then runs individual tests and can produce +a summary of the results: + + runner = doctest.DocTestRunner() + for t in tests: + tried, failed = runner.run(t) + + runner.summarize(verbose=1) + +The above example produces the following output: + + 1 items passed all tests: + 2 tests in f + 2 tests in 1 items. + 2 passed and 0 failed. + Test passed. + +‘DocTestRunner’ uses an instance of the ‘OutputChecker’ class to compare +the expected output with the actual output. This class takes a number +of different flags that customize its behaviour; ambitious users can +also write a completely new subclass of ‘OutputChecker’. + +The default output checker provides a number of handy features. For +example, with the *note doctest.ELLIPSIS: 1437. option flag, an ellipsis +(‘...’) in the expected output matches any substring, making it easier +to accommodate outputs that vary in minor ways: + + def o (n): + """>>> o(1) + <__main__.C instance at 0x...> + >>> + """ + +Another special string, ‘’, matches a blank line: + + def p (n): + """>>> p(1) + + >>> + """ + +Another new capability is producing a diff-style display of the output +by specifying the *note doctest.REPORT_UDIFF: 1438. (unified diffs), +*note doctest.REPORT_CDIFF: 1439. (context diffs), or *note +doctest.REPORT_NDIFF: 143a. (delta-style) option flags. For example: + + 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: +1438. 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: Build and C API Changes<11>, Next: Porting to Python 2 4, Prev: New Improved and Deprecated Modules<3>, Up: What’s New in Python 2 4 + +1.18.13 Build and C API Changes +------------------------------- + +Some of the changes to Python’s build process and to the C API are: + + * Three new convenience macros were added for common return values + from extension functions: *note Py_RETURN_NONE: 143c, *note + Py_RETURN_TRUE: 143d, and *note Py_RETURN_FALSE: 143e. + (Contributed by Brett Cannon.) + + * Another new macro, *note Py_CLEAR: 575, decreases the reference + count of 'obj' and sets 'obj' to the null pointer. (Contributed by + Jim Fulton.) + + * A new function, ‘PyTuple_Pack(N, obj1, obj2, ..., objN)’, + constructs tuples from a variable length argument list of Python + objects. (Contributed by Raymond Hettinger.) + + * A new function, ‘PyDict_Contains(d, k)’, implements fast dictionary + lookups without masking exceptions raised during the look-up + process. (Contributed by Raymond Hettinger.) + + * The Py_IS_NAN(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.) + + * A new function, *note PyArg_VaParseTupleAndKeywords(): 37f, is the + same as *note PyArg_ParseTupleAndKeywords(): 37e. but takes a + ‘va_list’ instead of a number of arguments. (Contributed by Greg + Chapman.) + + * A new method flag, *note METH_COEXIST: 143f, allows a function + defined in slots to co-exist with a *note PyCFunction: 1440. 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: + +* Port-Specific Changes: Port-Specific Changes<2>. + + +File: python.info, Node: Port-Specific Changes<2>, Up: Build and C API Changes<11> + +1.18.13.1 Port-Specific Changes +............................... + + * The Windows port now builds under MSVC++ 7.1 as well as version 6. + (Contributed by Martin von Löwis.) + + +File: python.info, Node: Porting to Python 2 4, Next: Acknowledgements<4>, Prev: Build and C API Changes<11>, Up: What’s New in Python 2 4 + +1.18.14 Porting to Python 2.4 +----------------------------- + +This section lists previously described changes that may require changes +to your code: + + * Left shifts and hexadecimal/octal constants that are too large no + longer trigger a *note FutureWarning: 411. and return a value + limited to 32 or 64 bits; instead they return a long integer. + + * Integer operations will no longer trigger an ‘OverflowWarning’. + The ‘OverflowWarning’ warning will disappear in Python 2.5. + + * The *note zip(): 7cb. built-in function and ‘itertools.izip()’ now + return an empty list instead of raising a *note TypeError: 534. + exception if called with no arguments. + + * You can no longer compare the ‘date’ and *note datetime: 1cc. + instances provided by the *note datetime: 30. module. Two + instances of different classes will now always be unequal, and + relative comparisons (‘<’, ‘>’) will raise a *note TypeError: 534. + + * ‘dircache.listdir()’ now passes exceptions to the caller instead of + returning empty lists. + + * ‘LexicalHandler.startDTD()’ used to receive the public and system + IDs in the wrong order. This has been corrected; applications + relying on the wrong order need to be fixed. + + * *note fcntl.ioctl(): 1443. now warns if the 'mutate' argument is + omitted and relevant. + + * The *note tarfile: de. module now generates GNU-format tar files by + default. + + * Encountering a failure while importing a module no longer leaves a + partially initialized module object in ‘sys.modules’. + + * *note None: 671. is now a constant; code that binds a new value to + the name ‘None’ is now a syntax error. + + * The ‘signals.signal()’ function now raises a *note RuntimeError: + 195. exception for certain illegal values; previously these errors + would pass silently. For example, you can no longer set a handler + on the ‘SIGKILL’ signal. + + +File: python.info, Node: Acknowledgements<4>, Prev: Porting to Python 2 4, Up: What’s New in Python 2 4 + +1.18.15 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: 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.19 What’s New in Python 2.3 +============================= + + +Author: A.M. Kuchling + +This article explains the new features in Python 2.3. Python 2.3 was +released on July 29, 2003. + +The main themes for Python 2.3 are polishing some of the features added +in 2.2, adding various small but useful enhancements to the core +language, and expanding the standard library. The new object model +introduced in the previous version has benefited from 18 months of +bugfixes and from optimization efforts that have improved the +performance of new-style classes. A few new built-in functions have +been added such as *note sum(): 466. and *note enumerate(): 1448. The +*note in: 2ee. operator can now be used for substring searches (e.g. +‘"ab" in "abc"’ returns *note True: c0d.). + +Some of the many new library features include Boolean, set, heap, and +date/time data types, the ability to import modules from ZIP-format +archives, metadata support for the long-awaited Python catalog, an +updated version of IDLE, and modules for logging messages, wrapping +text, parsing CSV files, processing command-line options, using +BerkeleyDB databases… the list of new and enhanced modules is lengthy. + +This article doesn’t attempt to provide a complete specification of the +new features, but instead provides a convenient overview. For full +details, you should refer to the documentation for Python 2.3, such as +the Python Library Reference and the Python Reference Manual. If you +want to understand the complete implementation and design rationale, +refer to the PEP for a particular new feature. + +* Menu: + +* PEP 218; A Standard Set Datatype: PEP 218 A Standard Set Datatype. +* PEP 255; Simple Generators: PEP 255 Simple Generators. +* PEP 263; Source Code Encodings: PEP 263 Source Code Encodings. +* PEP 273; Importing Modules from ZIP Archives: PEP 273 Importing Modules from ZIP Archives. +* PEP 277; Unicode file name support for Windows NT: PEP 277 Unicode file name support for Windows NT. +* PEP 278; Universal Newline Support: PEP 278 Universal Newline Support. +* PEP 279; enumerate(): PEP 279 enumerate. +* PEP 282; The logging Package: PEP 282 The logging Package. +* PEP 285; A Boolean Type: PEP 285 A Boolean Type. +* PEP 293; Codec Error Handling Callbacks: PEP 293 Codec Error Handling Callbacks. +* PEP 301; Package Index and Metadata for Distutils: PEP 301 Package Index and Metadata for Distutils. +* PEP 302; New Import Hooks: PEP 302 New Import Hooks. +* PEP 305; Comma-separated Files: PEP 305 Comma-separated Files. +* PEP 307; Pickle Enhancements: PEP 307 Pickle Enhancements. +* Extended Slices:: +* Other Language Changes: Other Language Changes<18>. +* New, Improved, and Deprecated Modules: New Improved and Deprecated Modules<4>. +* Pymalloc; A Specialized Object Allocator: Pymalloc A Specialized Object Allocator. +* Build and C API Changes: Build and C API Changes<12>. +* Other Changes and Fixes: Other Changes and Fixes<2>. +* Porting to Python 2.3: Porting to Python 2 3. +* Acknowledgements: Acknowledgements<5>. + + +File: python.info, Node: PEP 218 A Standard Set Datatype, Next: PEP 255 Simple Generators, Up: What’s New in Python 2 3 + +1.19.1 PEP 218: A Standard Set Datatype +--------------------------------------- + +The new ‘sets’ module contains an implementation of a set datatype. The +‘Set’ class is for mutable sets, sets that can have members added and +removed. The ‘ImmutableSet’ class is for sets that can’t be modified, +and instances of ‘ImmutableSet’ can therefore be used as dictionary +keys. Sets are built on top of dictionaries, so the elements within a +set must be hashable. + +Here’s a simple example: + + >>> 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(): 144a. and *note intersection(): 144b. 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(): 144c. + + >>> 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(): 144d. + + >>> 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]) + >>> + +There are also ‘issubset()’ and ‘issuperset()’ methods for checking +whether one set is a subset or superset of another: + + >>> S1 = sets.Set([1,2,3]) + >>> S2 = sets.Set([2,3]) + >>> S2.issubset(S1) + True + >>> S1.issubset(S2) + False + >>> S1.issuperset(S2) + True + >>> + +See also +........ + +PEP 218(1) - Adding a Built-In Set Object Type + + PEP written by Greg V. Wilson. Implemented by Greg V. Wilson, Alex + Martelli, and GvR. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0218/ + + +File: python.info, Node: PEP 255 Simple Generators, Next: PEP 263 Source Code Encodings, Prev: PEP 218 A Standard Set Datatype, Up: What’s New in Python 2 3 + +1.19.2 PEP 255: Simple Generators +--------------------------------- + +In Python 2.2, generators were added as an optional feature, to be +enabled by a ‘from __future__ import generators’ directive. In 2.3 +generators no longer need to be specially enabled, and are now always +present; this means that *note yield: 9cd. is now always a keyword. The +rest of this section is a copy of the description of generators from the +“What’s New in Python 2.2” document; if you read it back when Python 2.2 +came out, you can skip the rest of this section. + +You’re doubtless familiar with how function calls work in Python or C. +When you call a function, it gets a private namespace where its local +variables are created. When the function reaches a *note return: 9ce. +statement, the local variables are destroyed and the resulting value is +returned to the caller. A later call to the same function will get a +fresh new set of local variables. But, what if the local variables +weren’t thrown away on exiting a function? What if you could later +resume the function where it left off? This is what generators provide; +they can be thought of as resumable functions. + +Here’s the simplest example of a generator function: + + def generate_ints(N): + for i in range(N): + yield i + +A new keyword, *note yield: 9cd, was introduced for generators. Any +function containing a ‘yield’ statement is a generator function; this is +detected by Python’s bytecode compiler which compiles the function +specially as a result. + +When you call a generator function, it doesn’t return a single value; +instead it returns a generator object that supports the iterator +protocol. On executing the *note yield: 9cd. statement, the generator +outputs the value of ‘i’, similar to a *note return: 9ce. statement. +The big difference between ‘yield’ and a ‘return’ statement is that on +reaching a ‘yield’ the generator’s state of execution is suspended and +local variables are preserved. On the next call to the generator’s +‘.next()’ method, the function will resume executing immediately after +the ‘yield’ statement. (For complicated reasons, the ‘yield’ statement +isn’t allowed inside the *note try: 6e4. block of a ‘try’…‘finally’ +statement; read PEP 255(1) for a full explanation of the interaction +between ‘yield’ and exceptions.) + +Here’s a sample usage of the ‘generate_ints()’ generator: + + >>> gen = generate_ints(3) + >>> gen + + >>> 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 + +You could equally write ‘for i in generate_ints(5)’, or ‘a,b,c = +generate_ints(3)’. + +Inside a generator function, the *note return: 9ce. statement can only +be used without a value, and signals the end of the procession of +values; afterwards the generator cannot return any further values. +‘return’ with a value, such as ‘return 5’, is a syntax error inside a +generator function. The end of the generator’s results can also be +indicated by raising *note StopIteration: bfa. manually, or by just +letting the flow of execution fall off the bottom of the function. + +You could achieve the effect of generators manually by writing your own +class and storing all the local variables of the generator as instance +variables. For example, returning a list of integers could be done by +setting ‘self.count’ to 0, and having the *note next(): 7d3. method +increment ‘self.count’ and return it. However, for a moderately +complicated generator, writing a corresponding class would be much +messier. ‘Lib/test/test_generators.py’ contains a number of more +interesting examples. The simplest one implements an in-order traversal +of a tree using generators recursively. + + # 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 + +Two other examples in ‘Lib/test/test_generators.py’ produce solutions +for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so +that no queen threatens another) and the Knight’s Tour (a route that +takes a knight to every square of an $NxN$ chessboard without visiting +any square twice). + +The idea of generators comes from other programming languages, +especially Icon (‘https://www2.cs.arizona.edu/icon/’), where the idea of +generators is central. In Icon, every expression and function call +behaves like a generator. One example from “An Overview of the Icon +Programming Language” at +‘https://www2.cs.arizona.edu/icon/docs/ipd266.htm’ gives an idea of what +this looks like: + + sentence := "Store it in the neighboring harbor" + if (i := find("or", sentence)) > 5 then write(i) + +In Icon the ‘find()’ function returns the indexes at which the substring +“or” is found: 3, 23, 33. In the *note if: 2ed. statement, ‘i’ is first +assigned a value of 3, but 3 is less than 5, so the comparison fails, +and Icon retries it with the second value of 23. 23 is greater than 5, +so the comparison now succeeds, and the code prints the value 23 to the +screen. + +Python doesn’t go nearly as far as Icon in adopting generators as a +central concept. Generators are considered part of the core Python +language, but learning or using them isn’t compulsory; if they don’t +solve any problems that you have, feel free to ignore them. One novel +feature of Python’s interface as compared to Icon’s is that a +generator’s state is represented as a concrete object (the iterator) +that can be passed around to other functions or stored in a data +structure. + +See also +........ + +PEP 255(2) - Simple Generators + + Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. + Implemented mostly by Neil Schemenauer and Tim Peters, with other + fixes from the Python Labs crew. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0255/ + + (2) https://peps.python.org/pep-0255/ + + +File: python.info, Node: PEP 263 Source Code Encodings, Next: PEP 273 Importing Modules from ZIP Archives, Prev: PEP 255 Simple Generators, Up: What’s New in Python 2 3 + +1.19.3 PEP 263: Source Code Encodings +------------------------------------- + +Python source files can now be declared as being in different character +set encodings. Encodings are declared by including a specially +formatted comment in the first or second line of the source file. For +example, a UTF-8 file can be declared with: + + #!/usr/bin/env python + # -*- coding: UTF-8 -*- + +Without such an encoding declaration, the default encoding used is 7-bit +ASCII. Executing or importing modules that contain string literals with +8-bit characters and have no encoding declaration will result in a *note +DeprecationWarning: 1a5. being signalled by Python 2.3; in 2.4 this will +be a syntax error. + +The encoding declaration only affects Unicode string literals, which +will be converted to Unicode using the specified encoding. Note that +Python identifiers are still restricted to ASCII characters, so you +can’t have variable names that use characters outside of the usual +alphanumerics. + +See also +........ + +PEP 263(1) - Defining Python Source Code Encodings + + Written by Marc-André Lemburg and Martin von Löwis; implemented by + Suzuki Hisao and Martin von Löwis. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0263/ + + +File: python.info, Node: PEP 273 Importing Modules from ZIP Archives, Next: PEP 277 Unicode file name support for Windows NT, Prev: PEP 263 Source Code Encodings, Up: What’s New in Python 2 3 + +1.19.4 PEP 273: Importing Modules from ZIP Archives +--------------------------------------------------- + +The new *note zipimport: 132. module adds support for importing modules +from a ZIP-format archive. You don’t need to import the module +explicitly; it will be automatically imported if a ZIP archive’s +filename is added to ‘sys.path’. For example: + + 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' + >>> + +An entry in ‘sys.path’ can now be the filename of a ZIP archive. The +ZIP archive can contain any kind of files, but only files named ‘*.py’, +‘*.pyc’, or ‘*.pyo’ can be imported. If an archive only contains ‘*.py’ +files, Python will not attempt to modify the archive by adding the +corresponding ‘*.pyc’ file, meaning that if a ZIP archive doesn’t +contain ‘*.pyc’ files, importing may be rather slow. + +A path within the archive can also be specified to only import from a +subdirectory; for example, the path ‘/tmp/example.zip/lib/’ would only +import from the ‘lib/’ subdirectory within the archive. + +See also +........ + +PEP 273(1) - Import Modules from Zip Archives + + Written by James C. Ahlstrom, who also provided an implementation. + Python 2.3 follows the specification in PEP 273(2), but uses an + implementation written by Just van Rossum that uses the import + hooks described in PEP 302(3). See section *note PEP 302; New + Import Hooks: 1453. for a description of the new import hooks. + + ---------- 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 Unicode file name support for Windows NT, Next: PEP 278 Universal Newline Support, Prev: PEP 273 Importing Modules from ZIP Archives, Up: What’s New in Python 2 3 + +1.19.5 PEP 277: Unicode file name support for Windows NT +-------------------------------------------------------- + +On Windows NT, 2000, and XP, the system stores file names as Unicode +strings. Traditionally, Python has represented file names as byte +strings, which is inadequate because it renders some file names +inaccessible. + +Python now allows using arbitrary Unicode strings (within the +limitations of the file system) for all functions that expect file +names, most notably the *note open(): 517. built-in function. If a +Unicode string is passed to *note os.listdir(): 10ee, Python now returns +a list of Unicode strings. A new function, ‘os.getcwdu()’, returns the +current directory as a Unicode string. + +Byte strings still work as file names, and on Windows Python will +transparently convert them to Unicode using the ‘mbcs’ encoding. + +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: 1296. to be raised. Applications can test whether +arbitrary Unicode strings are supported as file names by checking *note +os.path.supports_unicode_filenames: 1455, a Boolean value. + +Under MacOS, *note os.listdir(): 10ee. may now return Unicode filenames. + +See also +........ + +PEP 277(1) - Unicode file name support for Windows NT + + Written by Neil Hodgson; implemented by Neil Hodgson, Martin von + Löwis, and Mark Hammond. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0277/ + + +File: python.info, Node: PEP 278 Universal Newline Support, Next: PEP 279 enumerate, Prev: PEP 277 Unicode file name support for Windows NT, Up: What’s New in Python 2 3 + +1.19.6 PEP 278: Universal Newline Support +----------------------------------------- + +The three major operating systems used today are Microsoft Windows, +Apple’s Macintosh OS, and the various Unix derivatives. A minor +irritation of cross-platform work is that these three platforms all use +different characters to mark the ends of lines in text files. Unix uses +the linefeed (ASCII character 10), MacOS uses the carriage return (ASCII +character 13), and Windows uses a two-character sequence of a carriage +return plus a newline. + +Python’s file objects can now support end of line conventions other than +the one followed by the platform on which Python is running. Opening a +file with the mode ‘'U'’ or ‘'rU'’ will open a file for reading in *note +universal newlines: d3a. mode. All three line ending conventions will +be translated to a ‘'\n'’ in the strings returned by the various file +methods such as ‘read()’ and ‘readline()’. + +Universal newline support is also used when importing modules and when +executing a file with the ‘execfile()’ function. This means that Python +modules can be shared between all three operating systems without +needing to convert the line-endings. + +This feature can be disabled when compiling Python by specifying the +‘--without-universal-newlines’ switch when running Python’s ‘configure’ +script. + +See also +........ + +PEP 278(1) - Universal Newline Support + + Written and implemented by Jack Jansen. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0278/ + + +File: python.info, Node: PEP 279 enumerate, Next: PEP 282 The logging Package, Prev: PEP 278 Universal Newline Support, Up: What’s New in Python 2 3 + +1.19.7 PEP 279: enumerate() +--------------------------- + +A new built-in function, *note enumerate(): 1448, will make certain +loops a bit clearer. ‘enumerate(thing)’, where 'thing' is either an +iterator or a sequence, returns an iterator that will return ‘(0, +thing[0])’, ‘(1, thing[1])’, ‘(2, thing[2])’, and so forth. + +A common idiom to change every element of a list looks like this: + + for i in range(len(L)): + item = L[i] + # ... compute some result based on item ... + L[i] = result + +This can be rewritten using *note enumerate(): 1448. as: + + for i, item in enumerate(L): + # ... compute some result based on item ... + L[i] = result + +See also +........ + +PEP 279(1) - The enumerate() built-in function + + Written and implemented by Raymond D. Hettinger. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0279/ + + +File: python.info, Node: PEP 282 The logging Package, Next: PEP 285 A Boolean Type, Prev: PEP 279 enumerate, Up: What’s New in Python 2 3 + +1.19.8 PEP 282: The logging Package +----------------------------------- + +A standard package for writing logs, *note logging: 87, has been added +to Python 2.3. It provides a powerful and flexible mechanism for +generating logging output which can then be filtered and processed in +various ways. A configuration file written in a standard format can be +used to control the logging behavior of a program. Python includes +handlers that will write log records to standard error or to a file or +socket, send them to the system log, or even e-mail them to a particular +address; of course, it’s also possible to write your own handler +classes. + +The *note Logger: b4f. class is the primary class. Most application +code will deal with one or more *note Logger: b4f. objects, each one +used by a particular subsystem of the application. Each *note Logger: +b4f. is identified by a name, and names are organized into a hierarchy +using ‘.’ as the component separator. For example, you might have *note +Logger: b4f. instances named ‘server’, ‘server.auth’ and +‘server.network’. The latter two instances are below ‘server’ in the +hierarchy. This means that if you turn up the verbosity for ‘server’ or +direct ‘server’ messages to a different handler, the changes will also +apply to records logged to ‘server.auth’ and ‘server.network’. There’s +also a root *note Logger: b4f. that’s the parent of all other loggers. + +For simple uses, the *note logging: 87. package contains some +convenience functions that always use the root log: + + 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') + +This produces the following output: + + 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(): 145a. method on the root logger. + +Notice the *note warning(): 2f9. 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(): 145b. 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() + +This produces the following output: + + 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 + +Slightly more advanced programs will use a logger other than the root +logger. The ‘getLogger(name)’ function is used to get a particular log, +creating it if it doesn’t exist yet. ‘getLogger(None)’ returns the root +logger. + + 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: b4f. can prevent this by setting its *note propagate: 145c. +attribute to *note False: b37. + +There are more classes provided by the *note logging: 87. package that +can be customized. When a *note Logger: b4f. instance is told to log a +message, it creates a *note LogRecord: fe1. instance that is sent to any +number of different *note Handler: 145d. instances. Loggers and +handlers can also have an attached list of filters, and each filter can +cause the *note LogRecord: fe1. to be ignored or can modify the record +before passing it along. When they’re finally output, *note LogRecord: +fe1. instances are converted to text by a *note Formatter: 145e. class. +All of these classes can be replaced by your own specially written +classes. + +With all of these features the *note logging: 87. package should provide +enough flexibility for even the most complicated applications. This is +only an incomplete overview of its features, so please see the package’s +reference documentation for all of the details. Reading PEP 282(1) will +also be helpful. + +See also +........ + +PEP 282(2) - A Logging System + + Written by Vinay Sajip and Trent Mick; implemented by Vinay Sajip. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0282/ + + (2) https://peps.python.org/pep-0282/ + + +File: python.info, Node: PEP 285 A Boolean Type, Next: PEP 293 Codec Error Handling Callbacks, Prev: PEP 282 The logging Package, Up: What’s New in Python 2 3 + +1.19.9 PEP 285: A Boolean Type +------------------------------ + +A Boolean type was added to Python 2.3. Two new constants were added to +the ‘__builtin__’ module, *note True: c0d. and *note False: b37. (*note +True: c0d. and *note False: b37. 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.) + +The type object for this new type is named *note bool: 463.; the +constructor for it takes any Python value and converts it to *note True: +c0d. or *note False: b37. + + >>> bool(1) + True + >>> bool(0) + False + >>> bool([]) + False + >>> bool( (1,) ) + True + +Most of the standard library modules and built-in functions have been +changed to return Booleans. + + >>> obj = [] + >>> hasattr(obj, 'append') + True + >>> isinstance(obj, list) + True + >>> isinstance(obj, tuple) + False + +Python’s Booleans were added with the primary goal of making code +clearer. For example, if you’re reading a function and encounter the +statement ‘return 1’, you might wonder whether the ‘1’ represents a +Boolean truth value, an index, or a coefficient that multiplies some +other quantity. If the statement is ‘return True’, however, the meaning +of the return value is quite clear. + +Python’s Booleans were 'not' added for the sake of strict type-checking. +A very strict language such as Pascal would also prevent you performing +arithmetic with Booleans, and would require that the expression in an +*note if: 2ed. statement always evaluate to a Boolean result. Python is +not this strict and never will be, as PEP 285(1) explicitly says. This +means you can still use any expression in an ‘if’ statement, even ones +that evaluate to a list or tuple or some random object. The Boolean +type is a subclass of the *note int: 259. class so that arithmetic using +a Boolean still works. + + >>> True + 1 + 2 + >>> False + 1 + 1 + >>> False * 75 + 0 + >>> True * 75 + 75 + +To sum up *note True: c0d. and *note False: b37. in a sentence: they’re +alternative ways to spell the integer values 1 and 0, with the single +difference that *note str(): 447. and *note repr(): 7f9. return the +strings ‘'True'’ and ‘'False'’ instead of ‘'1'’ and ‘'0'’. + +See also +........ + +PEP 285(2) - Adding a bool type + + Written and implemented by GvR. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0285/ + + (2) https://peps.python.org/pep-0285/ + + +File: python.info, Node: PEP 293 Codec Error Handling Callbacks, Next: PEP 301 Package Index and Metadata for Distutils, Prev: PEP 285 A Boolean Type, Up: What’s New in Python 2 3 + +1.19.10 PEP 293: Codec Error Handling Callbacks +----------------------------------------------- + +When encoding a Unicode string into a byte string, unencodable +characters may be encountered. So far, Python has allowed specifying +the error processing as either “strict” (raising *note UnicodeError: +1296.), “ignore” (skipping the character), or “replace” (using a +question mark in the output string), with “strict” being the default +behavior. It may be desirable to specify alternative processing of such +errors, such as inserting an XML character reference or HTML entity +reference into the converted string. + +Python now has a flexible framework to add different processing +strategies. New error handlers can be added with *note +codecs.register_error(): 1462, and codecs then can access the error +handler with *note codecs.lookup_error(): 1463. An equivalent C API has +been added for codecs written in C. The error handler gets the necessary +state information such as the string being converted, the position in +the string where the error was detected, and the target encoding. The +handler can then either raise an exception or return a replacement +string. + +Two additional error handlers have been implemented using this +framework: “backslashreplace” uses Python backslash quoting to represent +unencodable characters and “xmlcharrefreplace” emits XML character +references. + +See also +........ + +PEP 293(1) - Codec Error Handling Callbacks + + Written and implemented by Walter Dörwald. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0293/ + + +File: python.info, Node: PEP 301 Package Index and Metadata for Distutils, Next: PEP 302 New Import Hooks, Prev: PEP 293 Codec Error Handling Callbacks, Up: What’s New in Python 2 3 + +1.19.11 PEP 301: Package Index and Metadata for Distutils +--------------------------------------------------------- + +Support for the long-requested Python catalog makes its first appearance +in 2.3. + +The heart of the catalog is the new Distutils ‘register’ command. +Running ‘python setup.py register’ will collect the metadata describing +a package, such as its name, version, maintainer, description, &c., and +send it to a central catalog server. The resulting catalog is available +from ‘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. + +Here’s an example ‘setup.py’ with classifiers, written to be compatible +with older versions of the 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) + +The full list of classifiers can be obtained by running ‘python setup.py +register --list-classifiers’. + +See also +........ + +PEP 301(2) - Package Index and Metadata for Distutils + + Written and implemented by Richard Jones. + + ---------- Footnotes ---------- + + (1) http://catb.org/~esr/trove/ + + (2) https://peps.python.org/pep-0301/ + + +File: python.info, Node: PEP 302 New Import Hooks, Next: PEP 305 Comma-separated Files, Prev: PEP 301 Package Index and Metadata for Distutils, Up: What’s New in Python 2 3 + +1.19.12 PEP 302: New Import Hooks +--------------------------------- + +While it’s been possible to write custom import hooks ever since the +‘ihooks’ module was introduced in Python 1.3, no one has ever been +really happy with it because writing new import hooks is difficult and +messy. There have been various proposed alternatives such as the +‘imputil’ and ‘iu’ modules, but none of them has ever gained much +acceptance, and none of them were easily usable from C code. + +PEP 302(1) borrows ideas from its predecessors, especially from Gordon +McMillan’s ‘iu’ module. Three new items are added to the *note sys: d9. +module: + + * ‘sys.path_hooks’ is a list of callable objects; most often they’ll + be classes. Each callable takes a string containing a path and + either returns an importer object that will handle imports from + this path or raises an *note ImportError: 415. exception if it + can’t handle this path. + + * ‘sys.path_importer_cache’ caches importer objects for each path, so + ‘sys.path_hooks’ will only need to be traversed once for each path. + + * ‘sys.meta_path’ is a list of importer objects that will be + traversed before ‘sys.path’ is checked. This list is initially + empty, but user code can add objects to it. Additional built-in + and frozen modules can be imported by an object added to this list. + +Importer objects must have a single method, ‘find_module(fullname, +path=None)’. 'fullname' will be a module or package name, e.g. +‘string’ or ‘distutils.core’. ‘find_module()’ must return a loader +object that has a single method, ‘load_module(fullname)’, that creates +and returns the corresponding module object. + +Pseudo-code for Python’s new import logic, therefore, looks something +like this (simplified a bit; see PEP 302(2) for the full details): + + for mp in sys.meta_path: + loader = mp(fullname) + if loader is not None: + = 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) + = loader.load_module(fullname) + + # Not found! + raise ImportError + +See also +........ + +PEP 302(3) - New Import Hooks + + Written by Just van Rossum and Paul Moore. Implemented by 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 Comma-separated Files, Next: PEP 307 Pickle Enhancements, Prev: PEP 302 New Import Hooks, Up: What’s New in Python 2 3 + +1.19.13 PEP 305: Comma-separated Files +-------------------------------------- + +Comma-separated files are a format frequently used for exporting data +from databases and spreadsheets. Python 2.3 adds a parser for +comma-separated files. + +Comma-separated format is deceptively simple at first glance: + + Costs,150,200,3.95 + +Read a line and call ‘line.split(',')’: what could be simpler? But toss +in string data that can contain commas, and things get more complicated: + + "Costs",150,200,3.95,"Includes taxes, shipping, and sundry items" + +A big ugly regular expression can parse this, but using the new *note +csv: 29. package is much simpler: + + import csv + + input = open('datafile', 'rb') + reader = csv.reader(input) + for line in reader: + print line + +The *note reader(): 482. 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. + +Different dialects of comma-separated files can be defined and +registered; currently there are two dialects, both used by Microsoft +Excel. A separate *note csv.writer: 483. class will generate +comma-separated files from a succession of tuples or lists, quoting +strings that contain the delimiter. + +See also +........ + +PEP 305(1) - CSV File API + + Written and implemented by 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 Enhancements, Next: Extended Slices, Prev: PEP 305 Comma-separated Files, Up: What’s New in Python 2 3 + +1.19.14 PEP 307: Pickle Enhancements +------------------------------------ + +The *note pickle: a6. 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. + +The solution was to invent a new pickle protocol. The *note +pickle.dumps(): 146b. function has supported a text-or-binary flag for a +long time. In 2.3, this flag is redefined from a Boolean to an integer: +0 is the old text-mode pickle format, 1 is the old binary format, and +now 2 is a new 2.3-specific format. A new constant, *note +pickle.HIGHEST_PROTOCOL: 146c, can be used to select the fanciest +protocol available. + +Unpickling is no longer considered a safe operation. 2.2’s *note +pickle: a6. 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__(): 5d4, *note __setstate__(): 146d, and *note +__getnewargs__(): 146e. Consult PEP 307(2) for the full semantics of +these methods. + +As a way to compress pickles yet further, it’s now possible to use +integer codes instead of long strings to identify pickled classes. The +Python Software Foundation will maintain a list of standardized codes; +there’s also a range of codes for private use. Currently no codes have +been specified. + +See also +........ + +PEP 307(3) - Extensions to the pickle protocol + + Written and implemented by Guido van Rossum and 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: Extended Slices, Next: Other Language Changes<18>, Prev: PEP 307 Pickle Enhancements, Up: What’s New in Python 2 3 + +1.19.15 Extended Slices +----------------------- + +Ever since Python 1.4, the slicing syntax has supported an optional +third “step” or “stride” argument. For example, these are all legal +Python syntax: ‘L[1:10:2]’, ‘L[:-1:1]’, ‘L[::-1]’. This was added to +Python at the request of the developers of Numerical Python, which uses +the third argument extensively. However, Python’s built-in list, tuple, +and string sequence types have never supported this feature, raising a +*note TypeError: 534. if you tried it. Michael Hudson contributed a +patch to fix this shortcoming. + +For example, you can now easily extract the elements of a list that have +even indexes: + + >>> L = range(10) + >>> L[::2] + [0, 2, 4, 6, 8] + +Negative values also work to make a copy of the same list in reverse +order: + + >>> L[::-1] + [9, 8, 7, 6, 5, 4, 3, 2, 1, 0] + +This also works for tuples, arrays, and strings: + + >>> s='abcd' + >>> s[::2] + 'ac' + >>> s[::-1] + 'dcba' + +If you have a mutable sequence such as a list or an array you can assign +to or delete an extended slice, but there are some differences between +assignment to extended and regular slices. Assignment to a regular +slice can be used to change the length of the sequence: + + >>> a = range(3) + >>> a + [0, 1, 2] + >>> a[1:3] = [4, 5, 6] + >>> a + [0, 4, 5, 6] + +Extended slices aren’t this flexible. When assigning to an extended +slice, the list on the right hand side of the statement must contain the +same number of items as the slice it is replacing: + + >>> 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 "", line 1, in ? + ValueError: attempt to assign sequence of size 3 to extended slice of size 2 + +Deletion is more straightforward: + + >>> 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__(): 285. +methods of the built-in sequences: + + >>> range(10).__getitem__(slice(0, 5, 2)) + [0, 2, 4] + +Or use slice objects directly in subscripts: + + >>> 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(): 943. ‘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) + +From this example you can also see that the built-in *note slice: 465. +object is now the type object for the slice type, and is no longer a +function. This is consistent with Python 2.2, where *note int: 259, +*note str: 447, etc., underwent the same change. + + +File: python.info, Node: Other Language Changes<18>, Next: New Improved and Deprecated Modules<4>, Prev: Extended Slices, Up: What’s New in Python 2 3 + +1.19.16 Other Language Changes +------------------------------ + +Here are all of the changes that Python 2.3 makes to the core Python +language. + + * The *note yield: 9cd. statement is now always a keyword, as + described in section *note PEP 255; Simple Generators: 144f. of + this document. + + * A new built-in function *note enumerate(): 1448. was added, as + described in section *note PEP 279; enumerate(): 1458. of this + document. + + * Two new constants, *note True: c0d. and *note False: b37. were + added along with the built-in *note bool: 463. type, as described + in section *note PEP 285; A Boolean Type: 1460. of this document. + + * The *note int(): 259. type constructor will now return a long + integer instead of raising an *note OverflowError: 87f. when a + string or floating-point number is too large to fit into an + integer. This can lead to the paradoxical result that + ‘isinstance(int(expression), int)’ is false, but that seems + unlikely to cause problems in practice. + + * Built-in types now support the extended slicing syntax, as + described in section *note Extended Slices: 1470. of this document. + + * A new built-in function, ‘sum(iterable, start=0)’, adds up the + numeric items in the iterable object and returns their sum. *note + sum(): 466. only accepts numbers, meaning that you can’t use it to + concatenate a bunch of strings. (Contributed by Alex Martelli.) + + * ‘list.insert(pos, value)’ used to insert 'value' at the front of + the list when 'pos' was negative. The behaviour has now been + changed to be consistent with slice indexing, so when 'pos' is -1 + the value will be inserted before the last element, and so forth. + + * ‘list.index(value)’, which searches for 'value' within the list and + returns its index, now takes optional 'start' and 'stop' arguments + to limit the search to only part of the list. + + * Dictionaries have a new method, ‘pop(key[, *default*])’, that + returns the value corresponding to 'key' and removes that key/value + pair from the dictionary. If the requested key isn’t present in + the dictionary, 'default' is returned if it’s specified and *note + KeyError: 33f. raised if it isn’t. + + >>> 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 + {} + >>> + + There’s also a new class method, ‘dict.fromkeys(iterable, value)’, + that creates a dictionary with keys taken from the supplied + iterator 'iterable' and all values set to 'value', defaulting to + ‘None’. + + (Patches contributed by Raymond Hettinger.) + + Also, the *note dict(): 258. constructor now accepts keyword + arguments to simplify creating small dictionaries: + + >>> dict(red=1, blue=2, green=3, black=4) + {'blue': 2, 'black': 4, 'green': 3, 'red': 1} + + (Contributed by Just van Rossum.) + + * The *note assert: 968. statement no longer checks the ‘__debug__’ + flag, so you can no longer disable assertions by assigning to + ‘__debug__’. Running Python with the *note -O: db4. switch will + still generate code that doesn’t execute any assertions. + + * Most type objects are now callable, so you can use them to create + new objects such as functions, classes, and modules. (This means + that the ‘new’ module can be deprecated in a future Python version, + because you can now use the type objects available in the *note + types: 103. module.) For example, you can create a new module + object with the following code: + + >>> import types + >>> m = types.ModuleType('abc','docstring') + >>> m + + >>> m.__doc__ + 'docstring' + + * A new warning, *note PendingDeprecationWarning: 8c7. was added to + indicate features which are in the process of being deprecated. + The warning will 'not' be printed by default. To check for use of + features that will be deprecated in the future, supply *note + -Walways;;PendingDeprecationWarning;;: 8c6. on the command line or + use *note warnings.filterwarnings(): 1472. + + * The process of deprecating string-based exceptions, as in ‘raise + "Error occurred"’, has begun. Raising a string will now trigger + *note PendingDeprecationWarning: 8c7. + + * Using ‘None’ as a variable name will now result in a *note + SyntaxWarning: 461. warning. In a future version of Python, ‘None’ + may finally become a keyword. + + * 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: + 1473, 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. + + * One minor but far-reaching change is that the names of extension + types defined by the modules included with Python now contain the + module and a ‘'.'’ in front of the type name. For example, in + Python 2.2, if you created a socket and printed its ‘__class__’, + you’d get this output: + + >>> s = socket.socket() + >>> s.__class__ + + + In 2.3, you get this: + + >>> s.__class__ + + + * One of the noted incompatibilities between old- and new-style + classes has been removed: you can now assign to the *note __name__: + 1474. and *note __bases__: 1475. 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__: 1476. attribute. + +* Menu: + +* String Changes:: +* Optimizations: Optimizations<17>. + + ---------- Footnotes ---------- + + (1) https://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.3910 + + +File: python.info, Node: String Changes, Next: Optimizations<17>, Up: Other Language Changes<18> + +1.19.16.1 String Changes +........................ + + * The *note in: 2ee. operator now works differently for strings. + Previously, when evaluating ‘X in Y’ where 'X' and 'Y' are strings, + 'X' could only be a single character. That’s now changed; 'X' can + be a string of any length, and ‘X in Y’ will return *note True: + c0d. if 'X' is a substring of 'Y'. If 'X' is the empty string, the + result is always *note True: c0d. + + >>> 'ab' in 'abcd' + True + >>> 'ad' in 'abcd' + False + >>> '' in 'abcd' + True + + Note that this doesn’t tell you where the substring starts; if you + need that information, use the *note find(): ea1. string method. + + * The *note strip(): 1478, *note lstrip(): 1479, and *note rstrip(): + 147a. string methods now have an optional argument for specifying + the characters to strip. The default is still to remove all + whitespace characters: + + >>> ' abc '.strip() + 'abc' + >>> '><><><>'.strip('<>') + '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(): ec4. and *note endswith(): ec5. string + methods now accept negative numbers for the 'start' and 'end' + parameters. + + * Another new string method is *note zfill(): 147b, originally a + function in the *note string: d3. module. *note zfill(): 147b. + pads a numeric string with zeros on the left until it’s the + specified width. Note that the ‘%’ operator is still more flexible + and powerful than *note zfill(): 147b. + + >>> '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: c0d. for + either kind of string. It’s a completely abstract type, so you + can’t create ‘basestring’ instances. + + * Interned strings are no longer immortal and will now be + garbage-collected in the usual way when the only reference to them + is from the internal dictionary of interned strings. (Implemented + by Oren Tirosh.) + + +File: python.info, Node: Optimizations<17>, Prev: String Changes, Up: Other Language Changes<18> + +1.19.16.2 Optimizations +....................... + + * The creation of new-style class instances has been made much + faster; they’re now faster than classic classes! + + * The *note sort(): bcf. 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 Other Changes and Fixes: 147d. 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: New Improved and Deprecated Modules<4>, Next: Pymalloc A Specialized Object Allocator, Prev: Other Language Changes<18>, Up: What’s New in Python 2 3 + +1.19.17 New, Improved, and Deprecated Modules +--------------------------------------------- + +As usual, Python’s standard library received a number of enhancements +and bug fixes. Here’s a partial list of the most notable changes, +sorted alphabetically by module name. Consult the ‘Misc/NEWS’ file in +the source tree for a more complete list of changes, or look through the +CVS logs for all the details. + + * The *note array: 7. module now supports arrays of Unicode + characters using the ‘'u'’ format character. Arrays also now + support using the ‘+=’ assignment operator to add another array’s + contents, and the ‘*=’ assignment operator to repeat an array. + (Contributed by Jason Orendorff.) + + * The ‘bsddb’ module has been replaced by version 4.1.6 of the + PyBSDDB(1) package, providing a more complete interface to the + transactional features of the BerkeleyDB library. + + The old version of the module has been renamed to ‘bsddb185’ and is + no longer built automatically; you’ll have to edit ‘Modules/Setup’ + to enable it. Note that the new ‘bsddb’ package is intended to be + compatible with the old module, so be sure to file bugs if you + discover any incompatibilities. When upgrading to Python 2.3, if + the new interpreter is compiled with a new version of the + underlying BerkeleyDB library, you will almost certainly have to + convert your database files to the new version. You can do this + fairly easily with the new scripts ‘db2pickle.py’ and + ‘pickle2db.py’ which you will find in the distribution’s + ‘Tools/scripts’ directory. If you’ve already been using the + PyBSDDB package and importing it as ‘bsddb3’, you will have to + change your ‘import’ statements to import it as ‘bsddb’. + + * The new *note bz2: 13. module is an interface to the bz2 data + compression library. bz2-compressed data is usually smaller than + corresponding *note zlib: 133.-compressed data. (Contributed by + Gustavo Niemeyer.) + + * A set of standard date/time types has been added in the new *note + datetime: 30. module. See the following section for more details. + + * 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"]) + + Modifying ‘sample.h’ would then cause the module to be recompiled. + (Contributed by Jeremy Hylton.) + + * Other minor changes to Distutils: it now checks for the *note CC: + 147f, *note CFLAGS: 1480, ‘CPP’, *note LDFLAGS: 1481, and *note + CPPFLAGS: 1482. environment variables, using them to override the + settings in Python’s configuration (contributed by Robert Weber). + + * Previously the *note doctest: 3a. 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(): + df2. function creates a *note unittest.TestSuite: df3. object from + a set of *note doctest: 3a. tests. + + * The new ‘gc.get_referents(object)’ function returns a list of all + the objects referenced by 'object'. + + * The *note getopt: 61. module gained a new function, *note + gnu_getopt(): 1483, that supports the same arguments as the + existing *note getopt(): 1484. function but uses GNU-style scanning + mode. The existing *note getopt(): 1484. 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.) + + * The *note grp: 66, *note pwd: b2, and *note resource: bc. modules + now return enhanced tuples: + + >>> import grp + >>> g = grp.getgrnam('amk') + >>> g.gr_name, g.gr_gid + ('amk', 500) + + * The *note gzip: 67. module can now handle files exceeding 2 GiB. + + * The new *note heapq: 69. 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: 69. module provides *note heappush(): 1485. and + *note heappop(): 1486. 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: 73. package. + + * The *note imaplib: 74. module now supports IMAP over SSL. + (Contributed by Piers Lauder and Tino Lange.) + + * The *note itertools: 81. 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: c0d, 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.) + + * Two new functions in the *note math: 8e. module, ‘degrees(rads)’ + and ‘radians(degs)’, convert between radians and degrees. Other + functions in the *note math: 8e. module such as *note math.sin(): + 1487. and *note math.cos(): 1488. have always required input values + measured in radians. Also, an optional 'base' argument was added + to *note math.log(): 1489. to make it easier to compute logarithms + for bases other than ‘e’ and ‘10’. (Contributed by Raymond + Hettinger.) + + * Several new POSIX functions (‘getpgid()’, ‘killpg()’, ‘lchown()’, + ‘loadavg()’, ‘major()’, ‘makedev()’, ‘minor()’, and ‘mknod()’) were + added to the *note posix: ad. module that underlies the *note os: + a1. module. (Contributed by Gustavo Niemeyer, Geert Jansen, and + Denis S. Otkidach.) + + * In the *note os: a1. 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(): 256. + + 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: 148a. 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 + + In Python 2.4, the default will change to always returning floats. + + 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. + + * The *note optparse: a0. module contains a new parser for + command-line arguments that can convert option values to a + particular Python type and will automatically generate a usage + message. See the following section for more details. + + * 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.) + + * The new *note platform: aa. module contains a number of functions + that try to determine various properties of the platform you’re + running on. There are functions for getting the architecture, CPU + type, the Windows OS version, and even the Linux distribution + version. (Contributed by Marc-André Lemburg.) + + * The parser objects provided by the *note pyexpat: 126. 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: 148b. attribute to + *note True: c0d. will enable buffering. + + * The ‘sample(population, k)’ function was added to the *note random: + b8. module. 'population' is a sequence or ‘xrange’ object + containing the elements of a population, and *note sample(): 741. + 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 "", 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] + + The *note random: b8. module now uses a new algorithm, the Mersenne + Twister, implemented in C. It’s faster and more extensively studied + than the previous algorithm. + + (All changes contributed by Raymond Hettinger.) + + * The *note readline: ba. module also gained a number of new + functions: *note get_history_item(): 148c, *note + get_current_history_length(): 148d, and *note redisplay(): 148e. + + * The ‘rexec’ and ‘Bastion’ modules have been declared dead, and + attempts to import them will fail with a *note RuntimeError: 195. + 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. + + * The *note shutil: c5. module gained a ‘move(src, dest)’ function + that recursively moves a file or directory to a new location. + + * Support for more advanced POSIX signal handling was added to the + *note signal: c6. but then removed again as it proved impossible to + make it work reliably across platforms. + + * The *note socket: cc. module now supports timeouts. You can call + the ‘settimeout(t)’ method on a socket object to set a timeout of + 't' seconds. Subsequent socket operations that take longer than + 't' seconds to complete will abort and raise a *note + socket.timeout: 830. exception. + + The original timeout implementation was by Tim O’Malley. Michael + Gilfix integrated it into the Python *note socket: cc. module and + shepherded it through a lengthy review. After the code was checked + in, Guido van Rossum rewrote parts of it. (This is a good example + of a collaborative development process in action.) + + * On Windows, the *note socket: cc. module now ships with Secure + Sockets Layer (SSL) support. + + * 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. + + * The new *note tarfile: de. module allows reading from and writing + to ‘tar’-format archive files. (Contributed by Lars Gustäbel.) + + * The new *note textwrap: ec. 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(): 148f. is built on top of *note wrap(): 1490. 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: fc8. class that + actually implements the text wrapping strategy. Both the *note + TextWrapper: fc8. class and the *note wrap(): 1490. and *note + fill(): 148f. 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: ed. 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: ed. module. Code can call functions and use + classes in ‘_threading’ whether or not threads are supported, + avoiding an *note if: 2ed. 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. + + * The *note time: ee. module’s *note strptime(): 13f8. function has + long been an annoyance because it uses the platform C library’s + *note strptime(): 13f8. implementation, and different platforms + sometimes have odd bugs. Brett Cannon contributed a portable + implementation that’s written in pure Python and should behave + identically on all platforms. + + * The new *note timeit: ef. module helps measure how long snippets of + Python code take to execute. The ‘timeit.py’ file can be run + directly from the command line, or the module’s *note Timer: 1491. + class can be imported and used directly. Here’s a short example + that figures out whether it’s faster to convert an 8-bit string to + Unicode by appending an empty Unicode string to it or by using the + ‘unicode()’ function: + + 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] + + * The ‘Tix’ module has received various bug fixes and updates for the + current version of the Tix package. + + * The ‘Tkinter’ module now works with a thread-enabled version of + Tcl. Tcl’s threading model requires that widgets only be accessed + from the thread in which they’re created; accesses from another + thread can cause Tcl to panic. For certain Tcl interfaces, + ‘Tkinter’ will now automatically avoid this when a widget is + accessed from a different thread by marshalling a command, passing + it to the correct thread, and waiting for the results. Other + interfaces can’t be handled automatically but ‘Tkinter’ will now + raise an exception on such an access so that you can at least find + out about the problem. See + ‘https://mail.python.org/pipermail/python-dev/2002-December/031107.html’ + for a more detailed explanation of this change. (Implemented by + Martin von Löwis.) + + * Calling Tcl methods through ‘_tkinter’ no longer returns only + strings. Instead, if Tcl returns other objects those objects are + converted to their Python equivalent, if one exists, or wrapped + with a ‘_tkinter.Tcl_Obj’ object if no Python equivalent exists. + This behavior can be controlled through the ‘wantobjects()’ method + of ‘tkapp’ objects. + + When using ‘_tkinter’ through the ‘Tkinter’ module (as most Tkinter + applications will), this feature is always activated. It should + not cause compatibility problems, since Tkinter would always + convert string results to Python types where possible. + + If any incompatibilities are found, the old behavior can be + restored by setting the ‘wantobjects’ variable in the ‘Tkinter’ + module to false before creating the first ‘tkapp’ object. + + import Tkinter + Tkinter.wantobjects = 0 + + Any breakage caused by this change should be reported as a bug. + + * The ‘UserDict’ module has a new ‘DictMixin’ class which defines all + dictionary methods for classes that already have a minimum mapping + interface. This greatly simplifies writing classes that need to be + substitutable for dictionaries, such as the classes in the *note + shelve: c3. module. + + Adding the mix-in as a superclass provides the full dictionary + interface whenever the class defines *note __getitem__(): 285, + *note __setitem__(): 12be, *note __delitem__(): 12bf, and ‘keys()’. + For example: + + >>> 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: 122. can now + generate XML output in a particular encoding by providing an + optional encoding argument to the *note toxml(): 1492. and *note + toprettyxml(): 1493. methods of DOM nodes. + + * The ‘xmlrpclib’ module now supports an XML-RPC extension for + handling nil data values such as Python’s ‘None’. Nil values are + always supported on unmarshalling an XML-RPC response. To generate + requests containing ‘None’, you must supply a true value for the + 'allow_none' parameter when creating a ‘Marshaller’ instance. + + * The new ‘DocXMLRPCServer’ module allows writing self-documenting + XML-RPC servers. Run it in demo mode (as a program) to see it in + action. Pointing the web browser to the RPC server produces + pydoc-style documentation; pointing xmlrpclib to the server allows + invoking the actual methods. (Contributed by Brian Quinlan.) + + * Support for internationalized domain names (RFCs 3454, 3490, 3491, + and 3492) has been added. The “idna” encoding can be used to + convert between a Unicode domain name and the ASCII-compatible + encoding (ACE) of that name. + + >{}>{}> u"www.Alliancefrançaise.nu".encode("idna") + 'www.xn--alliancefranaise-npb.nu' + + The *note socket: cc. module has also been extended to + transparently convert Unicode hostnames to the ACE version before + passing them to the C library. Modules that deal with hostnames + such as ‘httplib’ and *note ftplib: 5e.) also support Unicode host + names; ‘httplib’ also sends HTTP ‘Host’ headers using the ACE + version of the domain name. *note urllib: 108. supports Unicode + URLs with non-ASCII host names as long as the ‘path’ part of the + URL is ASCII only. + + To implement this change, the *note stringprep: d4. module, the + ‘mkstringprep’ tool and the ‘punycode’ encoding have been added. + +* Menu: + +* Date/Time Type:: +* The optparse Module:: + + ---------- Footnotes ---------- + + (1) https://pybsddb.sourceforge.net + + +File: python.info, Node: Date/Time Type, Next: The optparse Module, Up: New Improved and Deprecated Modules<4> + +1.19.17.1 Date/Time Type +........................ + +Date and time types suitable for expressing timestamps were added as the +*note datetime: 30. module. The types don’t support different calendars +or many fancy features, and just stick to the basics of representing +time. + +The three primary types are: *note date: 1cd, representing a day, month, +and year; *note time: 1ce, consisting of hour, minute, and second; and +*note datetime: 1cc, which contains all the attributes of both *note +date: 1cd. and *note time: 1ce. There’s also a *note timedelta: 9cf. +class representing differences between two points in time, and time zone +logic is implemented by classes inheriting from the abstract *note +tzinfo: 5da. class. + +You can create instances of *note date: 1cd. and *note time: 1ce. 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(): 1495. class +method returns the current local date. + +Once created, instances of the date/time classes are all immutable. +There are a number of methods for producing formatted strings from +objects: + + >>> import datetime + >>> now = datetime.datetime.now() + >>> now.isoformat() + '2002-12-30T21:27:03.994956' + >>> now.ctime() # Only available on date, datetime + 'Mon Dec 30 21:27:03 2002' + >>> now.strftime('%Y %d %b') + '2002 30 Dec' + +The *note replace(): 1496. method allows modifying one or more fields of +a *note date: 1cd. or *note datetime: 1cc. instance, returning a new +instance: + + >>> d = datetime.datetime.now() + >>> d + datetime.datetime(2002, 12, 30, 22, 15, 38, 827738) + >>> d.replace(year=2001, hour = 12) + datetime.datetime(2001, 12, 30, 12, 15, 38, 827738) + >>> + +Instances can be compared, hashed, and converted to strings (the result +is the same as that of *note isoformat(): b30.). *note date: 1cd. and +*note datetime: 1cc. instances can be subtracted from each other, and +added to *note timedelta: 9cf. instances. The largest missing feature +is that there’s no standard library support for parsing strings and +getting back a *note date: 1cd. or *note datetime: 1cc. + +For more information, refer to the module’s reference documentation. +(Contributed by Tim Peters.) + + +File: python.info, Node: The optparse Module, Prev: Date/Time Type, Up: New Improved and Deprecated Modules<4> + +1.19.17.2 The optparse Module +............................. + +The *note getopt: 61. module provides simple parsing of command-line +arguments. The new *note optparse: a0. module (originally named Optik) +provides more elaborate command-line parsing that follows the Unix +conventions, automatically creates the output for ‘--help’, and can +perform different actions for different options. + +You start by creating an instance of *note OptionParser: 1498. and +telling it what your program’s options are. + + 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') + +Parsing a command line is then done by calling the *note parse_args(): +1499. method. + + options, args = op.parse_args(sys.argv[1:]) + print options + print args + +This returns an object containing all of the option values, and a list +of strings containing the remaining arguments. + +Invoking the script with the various arguments now works as you’d expect +it to. Note that the length argument is automatically converted to an +integer. + + $ ./python opt.py -i data arg1 + + ['arg1'] + $ ./python opt.py --input=data --length=4 + + [] + $ + +The help message is automatically generated for you: + + $ ./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 + $ + +See the module’s documentation for more details. + +Optik was written by Greg Ward, with suggestions from the readers of the +Getopt SIG. + + +File: python.info, Node: Pymalloc A Specialized Object Allocator, Next: Build and C API Changes<12>, Prev: New Improved and Deprecated Modules<4>, Up: What’s New in Python 2 3 + +1.19.18 Pymalloc: A Specialized Object Allocator +------------------------------------------------ + +Pymalloc, a specialized object allocator written by Vladimir Marangozov, +was a feature added to Python 2.1. Pymalloc is intended to be faster +than the system ‘malloc()’ and to have less memory overhead for +allocation patterns typical of Python programs. The allocator uses C’s +‘malloc()’ function to get large pools of memory and then fulfills +smaller memory requests from these pools. + +In 2.1 and 2.2, pymalloc was an experimental feature and wasn’t enabled +by default; you had to explicitly enable it when compiling Python by +providing the ‘--with-pymalloc’ option to the ‘configure’ script. In +2.3, pymalloc has had further enhancements and is now enabled by +default; you’ll have to supply ‘--without-pymalloc’ to disable it. + +This change is transparent to code written in Python; however, pymalloc +may expose bugs in C extensions. Authors of C extension modules should +test their code with pymalloc enabled, because some incorrect code may +cause core dumps at runtime. + +There’s one particularly common error that causes problems. There are a +number of memory allocation functions in Python’s C API that have +previously just been 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 may get you a core dump. For +example, if memory was allocated using *note PyObject_Malloc(): c68, it +has to be freed using *note PyObject_Free(): c65, 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. + +As part of this change, the confusing multiple interfaces for allocating +memory have been consolidated down into two API families. Memory +allocated with one family must not be manipulated with functions from +the other family. There is one family for allocating chunks of memory +and another family of functions specifically for allocating Python +objects. + + * To allocate and free an undistinguished chunk of memory use the + “raw memory” family: *note PyMem_Malloc(): c66, *note + PyMem_Realloc(): 102b, and *note PyMem_Free(): 140e. + + * The “object memory” family is the interface to the pymalloc + facility described above and is biased towards a large number of + “small” allocations: *note PyObject_Malloc(): c68, *note + PyObject_Realloc(): 140f, and *note PyObject_Free(): c65. + + * To allocate and free Python objects, use the “object” family *note + PyObject_New: 985, *note PyObject_NewVar: 986, and *note + PyObject_Del(): 149c. + +Thanks to lots of work by Tim Peters, pymalloc in 2.3 also provides +debugging features to catch memory overwrites and doubled frees in both +extension modules and in the interpreter itself. To enable this +support, compile a debugging version of the Python interpreter by +running ‘configure’ with ‘--with-pydebug’. + +To aid extension writers, a header file ‘Misc/pymemcompat.h’ is +distributed with the source to Python 2.3 that allows Python extensions +to use the 2.3 interfaces to memory allocation while compiling against +any version of Python since 1.5.2. You would copy the file from +Python’s source distribution and bundle it with the source of your +extension. + +See also +........ + +‘https://hg.python.org/cpython/file/default/Objects/obmalloc.c’ + + For the full details of the pymalloc implementation, see the + comments at the top of the file ‘Objects/obmalloc.c’ in the Python + source code. The above link points to the file within the + python.org SVN browser. + + +File: python.info, Node: Build and C API Changes<12>, Next: Other Changes and Fixes<2>, Prev: Pymalloc A Specialized Object Allocator, Up: What’s New in Python 2 3 + +1.19.19 Build and C API Changes +------------------------------- + +Changes to Python’s build process and to the C API include: + + * The cycle detection implementation used by the garbage collection + has proven to be stable, so it’s now been made mandatory. You can + no longer compile Python without it, and the ‘--with-cycle-gc’ + switch to ‘configure’ has been removed. + + * Python can now optionally be built as a shared library + (‘libpython2.3.so’) by supplying ‘--enable-shared’ when running + Python’s ‘configure’ script. (Contributed by Ondrej Palkovsky.) + + * The ‘DL_EXPORT’ and ‘DL_IMPORT’ macros are now deprecated. + Initialization functions for Python extension modules should now be + declared using the new macro *note PyMODINIT_FUNC: 149e, while the + Python core will generally use the ‘PyAPI_FUNC’ and ‘PyAPI_DATA’ + macros. + + * The interpreter can be compiled without any docstrings for the + built-in functions and modules by supplying ‘--without-doc-strings’ + to the ‘configure’ script. This makes the Python executable about + 10% smaller, but will also mean that you can’t get help for + Python’s built-ins. (Contributed by Gustavo Niemeyer.) + + * The ‘PyArg_NoArgs()’ macro is now deprecated, and code that uses it + should be changed. For Python 2.2 and later, the method definition + table can specify the *note METH_NOARGS: 149f. flag, signalling + that there are no arguments, and the argument checking can then be + removed. If compatibility with pre-2.2 versions of Python is + important, the code could use ‘PyArg_ParseTuple(args, "")’ instead, + but this will be slower than using *note METH_NOARGS: 149f. + + * *note PyArg_ParseTuple(): 56e. accepts new format characters for + various sizes of unsigned integers: ‘B’ for unsigned char, ‘H’ for + unsigned short int, ‘I’ for unsigned int, and ‘K’ for unsigned long + long. + + * A new function, ‘PyObject_DelItemString(mapping, char *key)’ was + added as shorthand for ‘PyObject_DelItem(mapping, + PyString_New(key))’. + + * File objects now manage their internal string buffer differently, + increasing it exponentially when needed. This results in the + benchmark tests in ‘Lib/test/test_bufio.py’ speeding up + considerably (from 57 seconds to 1.7 seconds, according to one + measurement). + + * It’s now possible to define class and static methods for a C + extension type by setting either the *note METH_CLASS: 14a0. or + *note METH_STATIC: 14a1. flags in a method’s *note PyMethodDef: + 14a2. structure. + + * Python now includes a copy of the Expat XML parser’s source code, + removing any dependence on a system version or local installation + of 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__: 36f. and *note __name__: 1474. 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: + +* Port-Specific Changes: Port-Specific Changes<3>. + + +File: python.info, Node: Port-Specific Changes<3>, Up: Build and C API Changes<12> + +1.19.19.1 Port-Specific Changes +............................... + +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(): 59. 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: Other Changes and Fixes<2>, Next: Porting to Python 2 3, Prev: Build and C API Changes<12>, Up: What’s New in Python 2 3 + +1.19.20 Other Changes and Fixes +------------------------------- + +As usual, there were a bunch of other improvements and bugfixes +scattered throughout the source tree. A search through the CVS change +logs finds there were 523 patches applied and 514 bugs fixed between +Python 2.2 and 2.3. Both figures are likely to be underestimates. + +Some of the more notable changes are: + + * If the *note PYTHONINSPECT: 14a5. environment variable is set, the + Python interpreter will enter the interactive prompt after running + a Python program, as if Python had been invoked with the *note -i: + 14a6. option. The environment variable can be set before running + the Python interpreter, or it can be set by the Python program as + part of its execution. + + * The ‘regrtest.py’ script now provides a way to allow “all resources + except 'foo'.” A resource name passed to the ‘-u’ option can now be + prefixed with a hyphen (‘'-'’) to mean “remove this resource.” For + example, the option ‘‘-uall,-bsddb’’ could be used to enable the + use of all resources except ‘bsddb’. + + * The tools used to build the documentation now work under Cygwin as + well as Unix. + + * The ‘SET_LINENO’ opcode has been removed. Back in the mists of + time, this opcode was needed to produce line numbers in tracebacks + and support trace functions (for, e.g., *note pdb: a5.). Since + Python 1.5, the line numbers in tracebacks have been computed using + a different mechanism that works with “python -O”. For Python 2.3 + Michael Hudson implemented a similar scheme to determine when to + call the trace function, removing the need for ‘SET_LINENO’ + entirely. + + It would be difficult to detect any resulting difference from + Python code, apart from a slight speed up when Python is run + without *note -O: db4. + + C extensions that access the *note f_lineno: 7a7. field of frame + objects should instead call ‘PyCode_Addr2Line(f->f_code, + f->f_lasti)’. This will have the added effect of making the code + work as desired under “python -O” in earlier versions of Python. + + A nifty new feature is that trace functions can now assign to the + *note f_lineno: 7a7. attribute of frame objects, changing the line + that will be executed next. A ‘jump’ command has been added to the + *note pdb: a5. debugger taking advantage of this new feature. + (Implemented by Richie Hindle.) + + +File: python.info, Node: Porting to Python 2 3, Next: Acknowledgements<5>, Prev: Other Changes and Fixes<2>, Up: What’s New in Python 2 3 + +1.19.21 Porting to Python 2.3 +----------------------------- + +This section lists previously described changes that may require changes +to your code: + + * *note yield: 9cd. is now always a keyword; if it’s used as a + variable name in your code, a different name must be chosen. + + * For strings 'X' and 'Y', ‘X in Y’ now works if 'X' is more than one + character long. + + * The *note int(): 259. type constructor will now return a long + integer instead of raising an *note OverflowError: 87f. when a + string or floating-point number is too large to fit into an + integer. + + * If you have Unicode strings that contain 8-bit characters, you must + declare the file’s encoding (UTF-8, Latin-1, or whatever) by adding + a comment to the top of the file. See section *note PEP 263; + Source Code Encodings: 1451. for more information. + + * Calling Tcl methods through ‘_tkinter’ no longer returns only + strings. Instead, if Tcl returns other objects those objects are + converted to their Python equivalent, if one exists, or wrapped + with a ‘_tkinter.Tcl_Obj’ object if no Python equivalent exists. + + * Large octal and hex literals such as ‘0xffffffff’ now trigger a + *note FutureWarning: 411. Currently they’re stored as 32-bit + numbers and result in a negative value, but in Python 2.4 they’ll + become positive long integers. + + There are a few ways to fix this warning. If you really need a + positive number, just add an ‘L’ to the end of the literal. If + you’re trying to get a 32-bit integer with low bits set and have + previously used an expression such as ‘~(1 << 31)’, it’s probably + clearest to start with all bits set and clear the desired upper + bits. For example, to clear just the top bit (bit 31), you could + write ‘0xffffffffL &~(1L<<31)’. + + * You can no longer disable assertions by assigning to ‘__debug__’. + + * The Distutils ‘setup()’ function has gained various new keyword + arguments such as 'depends'. Old versions of the Distutils will + abort if passed unknown keywords. A solution is to check for the + presence of the new ‘get_distutil_options()’ function in your + ‘setup.py’ and only uses the new keywords with a version of the + Distutils that supports them: + + from distutils import core + + kw = {'sources': 'foo.c', ...} + if hasattr(core, 'get_distutil_options'): + kw['depends'] = ['foo.h'] + ext = Extension(**kw) + + * Using ‘None’ as a variable name will now result in a *note + SyntaxWarning: 461. warning. + + * Names of extension types defined by the modules included with + Python now contain the module and a ‘'.'’ in front of the type + name. + + +File: python.info, Node: Acknowledgements<5>, Prev: Porting to Python 2 3, Up: What’s New in Python 2 3 + +1.19.22 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: 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.20 What’s New in Python 2.2 +============================= + + +Author: A.M. Kuchling + +* Menu: + +* Introduction:: +* PEPs 252 and 253; Type and Class Changes: PEPs 252 and 253 Type and Class Changes. +* PEP 234; Iterators: PEP 234 Iterators. +* PEP 255; Simple Generators: PEP 255 Simple Generators<2>. +* PEP 237; Unifying Long Integers and Integers: PEP 237 Unifying Long Integers and Integers<2>. +* PEP 238; Changing the Division Operator: PEP 238 Changing the Division Operator. +* Unicode Changes:: +* PEP 227; Nested Scopes: PEP 227 Nested Scopes. +* New and Improved Modules: New and Improved Modules<3>. +* Interpreter Changes and Fixes:: +* Other Changes and Fixes: Other Changes and Fixes<3>. +* Acknowledgements: Acknowledgements<6>. + + +File: python.info, Node: Introduction, Next: PEPs 252 and 253 Type and Class Changes, Up: What’s New in Python 2 2 + +1.20.1 Introduction +------------------- + +This article explains the new features in Python 2.2.2, released on +October 14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, +originally released on December 21, 2001. + +Python 2.2 can be thought of as the “cleanup release”. There are some +features such as generators and iterators that are completely new, but +most of the changes, significant and far-reaching though they may be, +are aimed at cleaning up irregularities and dark corners of the language +design. + +This article doesn’t attempt to provide a complete specification of the +new features, but instead provides a convenient overview. For full +details, you should refer to the documentation for Python 2.2, such as +the Python Library Reference(1) and the Python Reference Manual(2). If +you want to understand the complete implementation and design rationale +for a change, refer to the PEP for a particular new feature. + + ---------- 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: PEPs 252 and 253 Type and Class Changes, Next: PEP 234 Iterators, Prev: Introduction, Up: What’s New in Python 2 2 + +1.20.2 PEPs 252 and 253: Type and Class Changes +----------------------------------------------- + +The largest and most far-reaching changes in Python 2.2 are to Python’s +model of objects and classes. The changes should be backward +compatible, so it’s likely that your code will continue to run +unchanged, but the changes provide some amazing new capabilities. +Before beginning this, the longest and most complicated section of this +article, I’ll provide an overview of the changes and offer some +comments. + +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: 14ae. instance. + +Python 2.2 fixes this, and in the process adds some exciting new +capabilities. A brief summary: + + * You can subclass built-in types such as lists and even integers, + and your subclasses should work in every place that requires the + original type. + + * It’s now possible to define static and class methods, in addition + to the instance methods available in previous versions of Python. + + * 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__(): 4cf. 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. + + * The list of legal attributes for an instance can be limited to a + particular set using 'slots', making it possible to safeguard + against typos and perhaps make more optimizations possible in + future versions of Python. + +Some users have voiced concern about all these changes. Sure, they say, +the new features are neat and lend themselves to all sorts of tricks +that weren’t possible in previous versions of Python, but they also make +the language more complicated. Some people have said that they’ve +always recommended Python for its simplicity, and feel that its +simplicity is being lost. + +Personally, I think there’s no need to worry. Many of the new features +are quite esoteric, and you can write a lot of Python code without ever +needed to be aware of them. Writing a simple class is no more difficult +than it ever was, so you don’t need to bother learning or teaching them +unless they’re actually needed. Some very complicated tasks that were +previously only possible from C will now be possible in pure Python, and +to my mind that’s all for the better. + +I’m not going to attempt to cover every single corner case and small +change that were required to make the new features work. Instead this +section will paint only the broad strokes. See section *note Related +Links: 14af, “Related Links”, for further sources of information about +Python 2.2’s new object model. + +* Menu: + +* Old and New Classes:: +* Descriptors:: +* Multiple Inheritance; The Diamond Rule: Multiple Inheritance The Diamond Rule. +* Attribute Access:: +* Related Links:: + + +File: python.info, Node: Old and New Classes, Next: Descriptors, Up: PEPs 252 and 253 Type and Class Changes + +1.20.2.1 Old and New Classes +............................ + +First, you should know that Python 2.2 really has two kinds of classes: +classic or old-style classes, and new-style classes. The old-style +class model is exactly the same as the class model in earlier versions +of Python. All the new features described in this section apply only to +new-style classes. This divergence isn’t intended to last forever; +eventually old-style classes will be dropped, possibly in Python 3.0. + +So how do you define a new-style class? You do it by subclassing an +existing new-style class. Most of Python’s built-in types, such as +integers, lists, dictionaries, and even files, are new-style classes +now. A new-style class named *note object: a8c, the base class for all +built-in types, has also been added so if no built-in type is suitable, +you can just subclass *note object: a8c.: + + class C(object): + def __init__ (self): + ... + ... + +This means that *note class: 12ca. 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: a8c.) + +The type objects for the built-in types are available as built-ins, +named using a clever trick. Python has always had built-in functions +named *note int(): 259, *note float(): 2f1, and *note str(): 447. In +2.2, they aren’t functions any more, but type objects that behave as +factories when called. + + >>> int + + >>> int('123') + 123 + +To make the set of types complete, new type objects such as *note +dict(): 258. 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: Descriptors, Next: Multiple Inheritance The Diamond Rule, Prev: Old and New Classes, Up: PEPs 252 and 253 Type and Class Changes + +1.20.2.2 Descriptors +.................... + +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__: 558. of an object, but +when class inheritance or an arbitrary ‘__getattr__()’ hook were in use +this could still be inaccurate. + +The one big idea underlying the new class model is that an API for +describing the attributes of an object using 'descriptors' has been +formalized. Descriptors specify the value of an attribute, stating +whether it’s a method or a field. With the descriptor API, static +methods and class methods become possible, as well as more exotic +constructs. + +Attribute descriptors are objects that live inside class objects, and +have a few attributes of their own: + + * *note __name__: 105f. is the attribute’s name. + + * *note __doc__: 927. is the attribute’s docstring. + + * ‘__get__(object)’ is a method that retrieves the attribute value + from 'object'. + + * ‘__set__(object, value)’ sets the attribute on 'object' to 'value'. + + * ‘__delete__(object, value)’ deletes the 'value' attribute of + 'object'. + +For example, when you write ‘obj.x’, the steps that Python actually +performs are: + + descriptor = obj.__class__.x + descriptor.__get__(obj) + +For methods, *note descriptor.__get__: 14b2. 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(): 412. 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. + +More new features, such as slots and properties, are also implemented as +new kinds of descriptors, and it’s not difficult to write a descriptor +class that does something novel. For example, it would be possible to +write a descriptor class that made it possible to write Eiffel-style +preconditions and postconditions for a method. A class that used this +feature might be defined like this: + + 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: Multiple Inheritance The Diamond Rule, Next: Attribute Access, Prev: Descriptors, Up: PEPs 252 and 253 Type and Class Changes + +1.20.2.3 Multiple Inheritance: The Diamond Rule +............................................... + +Multiple inheritance has also been made more useful through changing the +rules under which names are resolved. Consider this set of classes +(diagram taken from PEP 253(1) by Guido van Rossum): + + 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. + +New-style classes follow a different algorithm that’s a bit more +complicated to explain, but does the right thing in this situation. +(Note that Python 2.3 changes this algorithm to one that produces the +same results in most cases, but produces more useful results for really +complicated inheritance graphs.) + + 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(): +4d7, 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(): 4d7. can also return unbound superclass objects when +called as ‘super(class)’ or ‘super(class1, class2)’, but this probably +won’t often be useful. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0253/ + + +File: python.info, Node: Attribute Access, Next: Related Links, Prev: Multiple Inheritance The Diamond Rule, Up: PEPs 252 and 253 Type and Class Changes + +1.20.2.4 Attribute Access +......................... + +A fair number of sophisticated Python classes define hooks for attribute +access using *note __getattr__(): 4cf.; 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. + +First, ‘__getattr__(attr_name)’ is still supported by new-style classes, +and nothing about it has changed. As before, it will be called when an +attempt is made to access ‘obj.foo’ and no attribute named ‘foo’ is +found in the instance’s dictionary. + +New-style classes also support a new method, +‘__getattribute__(attr_name)’. The difference between the two methods +is that *note __getattribute__(): bd2. is 'always' called whenever any +attribute is accessed, while the old *note __getattr__(): 4cf. 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__: 558. *note __getattr__(): 4cf. methods also end up +being called by Python when it checks for other methods such as *note +__repr__(): 618. 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: 194. 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__: 558. 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. + +Finally, it’s possible to constrain the list of attributes that can be +referenced on an object using the new *note __slots__: 14b5. class +attribute. Python objects are usually very dynamic; at any time it’s +possible to define a new attribute on an instance by just doing +‘obj.new_attr=1’. A new-style class can define a class attribute named +*note __slots__: 14b5. to limit the legal attributes to a particular set +of names. An example will make this clear: + + >>> 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 "", line 1, in ? + AttributeError: 'C' object has no attribute 'newattr' + +Note how you get an *note AttributeError: 348. on the attempt to assign +to an attribute not listed in *note __slots__: 14b5. + + +File: python.info, Node: Related Links, Prev: Attribute Access, Up: PEPs 252 and 253 Type and Class Changes + +1.20.2.5 Related Links +...................... + +This section has just been a quick overview of the new features, giving +enough of an explanation to start you programming, but many details have +been simplified or ignored. Where should you go to get a more complete +picture? + +The *note Descriptor Guide: 14b7. 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. + +Next, there are two relevant PEPs, PEP 252(1) and PEP 253(2). PEP +252(3) is titled “Making Types Look More Like Classes”, and covers the +descriptor API. PEP 253(4) is titled “Subtyping Built-in Types”, and +describes the changes to type objects that make it possible to subtype +built-in objects. PEP 253(5) is the more complicated PEP of the two, +and at a few points the necessary explanations of types and meta-types +may cause your head to explode. Both PEPs were written and implemented +by Guido van Rossum, with substantial assistance from the rest of the +Zope Corp. team. + +Finally, there’s the ultimate authority: the source code. Most of the +machinery for the type handling is in ‘Objects/typeobject.c’, but you +should only resort to it after all other avenues have been exhausted, +including posting a question to python-list or 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 Iterators, Next: PEP 255 Simple Generators<2>, Prev: PEPs 252 and 253 Type and Class Changes, Up: What’s New in Python 2 2 + +1.20.3 PEP 234: Iterators +------------------------- + +Another significant addition to 2.2 is an iteration interface at both +the C and Python levels. Objects can define how they can be looped over +by callers. + +In Python versions up to 2.1, the usual way to make ‘for item in obj’ +work is to define a *note __getitem__(): 285. method that looks +something like this: + + def __getitem__(self, index): + return + +*note __getitem__(): 285. 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: 2ec. loops. Consider some file-like object that +wants to be looped over; the 'index' parameter is essentially +meaningless, as the class probably assumes that a series of *note +__getitem__(): 285. calls will be made with 'index' incrementing by one +each time. In other words, the presence of the *note __getitem__(): +285. 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__(): 285. 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: 14b9. function in order to return an +iterator, and extension types that want to behave as iterators can +define a *note tp_iternext: 14ba. function. + +So, after all this, what do iterators actually do? They have one +required method, *note next(): 7d3, which takes no arguments and returns +the next value. When there are no more values to be returned, calling +*note next(): 7d3. should raise the *note StopIteration: bfa. exception. + + >>> L = [1,2,3] + >>> i = iter(L) + >>> print i + + >>> i.next() + 1 + >>> i.next() + 2 + >>> i.next() + 3 + >>> i.next() + Traceback (most recent call last): + File "", line 1, in ? + StopIteration + >>> + +In 2.2, Python’s *note for: 2ec. statement no longer expects a sequence; +it expects something for which *note iter(): 7d2. 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: 14b9. 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) + +Iterator support has been added to some of Python’s basic types. +Calling *note iter(): 7d2. on a dictionary will return an iterator which +loops over its keys: + + >>> 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: 2ee. operator now works on +dictionaries, so ‘key in dict’ is now equivalent to ‘dict.has_key(key)’. + +Files also provide an iterator, which calls the *note readline(): ba. +method until there are no more lines in the file. This means you can +now read each line of a file using code like this: + + for line in file: + # do something for each line + ... + +Note that you can only go forward in an iterator; there’s no way to get +the previous element, reset the iterator, or make a copy of it. An +iterator object could provide such additional capabilities, but the +iterator protocol only requires a *note next(): 7d3. method. + +See also +........ + +PEP 234(1) - Iterators + + Written by Ka-Ping Yee and GvR; implemented by the Python Labs + crew, mostly by GvR and Tim Peters. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0234/ + + +File: python.info, Node: PEP 255 Simple Generators<2>, Next: PEP 237 Unifying Long Integers and Integers<2>, Prev: PEP 234 Iterators, Up: What’s New in Python 2 2 + +1.20.4 PEP 255: Simple Generators +--------------------------------- + +Generators are another new feature, one that interacts with the +introduction of iterators. + +You’re doubtless familiar with how function calls work in Python or C. +When you call a function, it gets a private namespace where its local +variables are created. When the function reaches a *note return: 9ce. +statement, the local variables are destroyed and the resulting value is +returned to the caller. A later call to the same function will get a +fresh new set of local variables. But, what if the local variables +weren’t thrown away on exiting a function? What if you could later +resume the function where it left off? This is what generators provide; +they can be thought of as resumable functions. + +Here’s the simplest example of a generator function: + + def generate_ints(N): + for i in range(N): + yield i + +A new keyword, *note yield: 9cd, was introduced for generators. Any +function containing a ‘yield’ statement is a generator function; this is +detected by Python’s bytecode compiler which compiles the function +specially as a result. Because a new keyword was introduced, generators +must be explicitly enabled in a module by including a ‘from __future__ +import generators’ statement near the top of the module’s source code. +In Python 2.3 this statement will become unnecessary. + +When you call a generator function, it doesn’t return a single value; +instead it returns a generator object that supports the iterator +protocol. On executing the *note yield: 9cd. statement, the generator +outputs the value of ‘i’, similar to a *note return: 9ce. statement. +The big difference between ‘yield’ and a ‘return’ statement is that on +reaching a ‘yield’ the generator’s state of execution is suspended and +local variables are preserved. On the next call to the generator’s +‘next()’ method, the function will resume executing immediately after +the ‘yield’ statement. (For complicated reasons, the ‘yield’ statement +isn’t allowed inside the ‘try’ block of a *note try: 6e4.…*note finally: +9ca. statement; read PEP 255(1) for a full explanation of the +interaction between ‘yield’ and exceptions.) + +Here’s a sample usage of the ‘generate_ints()’ generator: + + >>> gen = generate_ints(3) + >>> gen + + >>> gen.next() + 0 + >>> gen.next() + 1 + >>> gen.next() + 2 + >>> gen.next() + Traceback (most recent call last): + File "", line 1, in ? + File "", line 2, in generate_ints + StopIteration + +You could equally write ‘for i in generate_ints(5)’, or ‘a,b,c = +generate_ints(3)’. + +Inside a generator function, the *note return: 9ce. statement can only +be used without a value, and signals the end of the procession of +values; afterwards the generator cannot return any further values. +‘return’ with a value, such as ‘return 5’, is a syntax error inside a +generator function. The end of the generator’s results can also be +indicated by raising *note StopIteration: bfa. manually, or by just +letting the flow of execution fall off the bottom of the function. + +You could achieve the effect of generators manually by writing your own +class and storing all the local variables of the generator as instance +variables. For example, returning a list of integers could be done by +setting ‘self.count’ to 0, and having the *note next(): 7d3. method +increment ‘self.count’ and return it. However, for a moderately +complicated generator, writing a corresponding class would be much +messier. ‘Lib/test/test_generators.py’ contains a number of more +interesting examples. The simplest one implements an in-order traversal +of a tree using generators recursively. + + # 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 + +Two other examples in ‘Lib/test/test_generators.py’ produce solutions +for the N-Queens problem (placing $N$ queens on an $NxN$ chess board so +that no queen threatens another) and the Knight’s Tour (a route that +takes a knight to every square of an $NxN$ chessboard without visiting +any square twice). + +The idea of generators comes from other programming languages, +especially Icon (‘https://www2.cs.arizona.edu/icon/’), where the idea of +generators is central. In Icon, every expression and function call +behaves like a generator. One example from “An Overview of the Icon +Programming Language” at +‘https://www2.cs.arizona.edu/icon/docs/ipd266.htm’ gives an idea of what +this looks like: + + sentence := "Store it in the neighboring harbor" + if (i := find("or", sentence)) > 5 then write(i) + +In Icon the ‘find()’ function returns the indexes at which the substring +“or” is found: 3, 23, 33. In the *note if: 2ed. statement, ‘i’ is first +assigned a value of 3, but 3 is less than 5, so the comparison fails, +and Icon retries it with the second value of 23. 23 is greater than 5, +so the comparison now succeeds, and the code prints the value 23 to the +screen. + +Python doesn’t go nearly as far as Icon in adopting generators as a +central concept. Generators are considered a new part of the core +Python language, but learning or using them isn’t compulsory; if they +don’t solve any problems that you have, feel free to ignore them. One +novel feature of Python’s interface as compared to Icon’s is that a +generator’s state is represented as a concrete object (the iterator) +that can be passed around to other functions or stored in a data +structure. + +See also +........ + +PEP 255(2) - Simple Generators + + Written by Neil Schemenauer, Tim Peters, Magnus Lie Hetland. + Implemented mostly by Neil Schemenauer and Tim Peters, with other + fixes from the Python Labs crew. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0255/ + + (2) https://peps.python.org/pep-0255/ + + +File: python.info, Node: PEP 237 Unifying Long Integers and Integers<2>, Next: PEP 238 Changing the Division Operator, Prev: PEP 255 Simple Generators<2>, Up: What’s New in Python 2 2 + +1.20.5 PEP 237: Unifying Long Integers and Integers +--------------------------------------------------- + +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: 534. exception with the message ‘slice index +must be int’. + +Python 2.2 will shift values from short to long integers as required. +The ‘L’ suffix is no longer needed to indicate a long integer literal, +as now the compiler will choose the appropriate type. (Using the ‘L’ +suffix will be discouraged in future 2.x versions of Python, triggering +a warning in Python 2.4, and probably dropped in Python 3.0.) Many +operations that used to raise an *note OverflowError: 87f. will now +return a long integer as their result. For example: + + >>> 1234567890123 + 1234567890123L + >>> 2 ** 64 + 18446744073709551616L + +In most cases, integers and long integers will now be treated +identically. You can still distinguish them with the *note type(): d48. +built-in function, but that’s rarely needed. + +See also +........ + +PEP 237(1) - Unifying Long Integers and Integers + + Written by Moshe Zadka and Guido van Rossum. Implemented mostly by + Guido van Rossum. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0237/ + + +File: python.info, Node: PEP 238 Changing the Division Operator, Next: Unicode Changes, Prev: PEP 237 Unifying Long Integers and Integers<2>, Up: What’s New in Python 2 2 + +1.20.6 PEP 238: Changing the Division Operator +---------------------------------------------- + +The most controversial change in Python 2.2 heralds the start of an +effort to fix an old design flaw that’s been in Python from the +beginning. Currently Python’s division operator, ‘/’, behaves like C’s +division operator when presented with two integer arguments: it returns +an integer result that’s truncated down when there would be a fractional +part. For example, ‘3/2’ is 1, not 1.5, and ‘(-1)/2’ is -1, not -0.5. +This means that the results of division can vary unexpectedly depending +on the type of the two operands and because Python is dynamically typed, +it can be difficult to determine the possible types of the operands. + +(The controversy is over whether this is 'really' a design flaw, and +whether it’s worth breaking existing code to fix this. It’s caused +endless discussions on python-dev, and in July 2001 erupted into a storm +of acidly sarcastic postings on ‘comp.lang.python’. I won’t argue for +either side here and will stick to describing what’s implemented in 2.2. +Read PEP 238(1) for a summary of arguments and counter-arguments.) + +Because this change might break code, it’s being introduced very +gradually. Python 2.2 begins the transition, but the switch won’t be +complete until Python 3.0. + +First, I’ll borrow some terminology from PEP 238(2). “True division” is +the division that most non-programmers are familiar with: 3/2 is 1.5, +1/4 is 0.25, and so forth. “Floor division” is what Python’s ‘/’ +operator currently does when given integer operands; the result is the +floor of the value returned by true division. “Classic division” is the +current mixed behaviour of ‘/’; it returns the result of floor division +when the operands are integers, and returns the result of true division +when one of the operands is a floating-point number. + +Here are the changes 2.2 introduces: + + * A new operator, ‘//’, is the floor division operator. (Yes, we + know it looks like C++’s comment symbol.) ‘//’ 'always' performs + floor division no matter what the types of its operands are, so ‘1 + // 2’ is 0 and ‘1.0 // 2.0’ is also 0.0. + + ‘//’ is always available in Python 2.2; you don’t need to enable it + using a ‘__future__’ statement. + + * By including a ‘from __future__ import division’ in a module, the + ‘/’ operator will be changed to return the result of true division, + so ‘1/2’ is 0.5. Without the ‘__future__’ statement, ‘/’ still + means classic division. The default meaning of ‘/’ will not change + until Python 3.0. + + * Classes can define methods called *note __truediv__(): 14be. and + *note __floordiv__(): 14bf. to overload the two division operators. + At the C level, there are also slots in the *note PyNumberMethods: + 13e9. structure so extension types can define the two operators. + + * Python 2.2 supports some command-line arguments for testing whether + code will work with the changed division semantics. Running python + with ‘-Q warn’ will cause a warning to be issued whenever division + is applied to two integers. You can use this to find code that’s + affected by the change and fix it. By default, Python 2.2 will + simply perform classic division without a warning; the warning will + be turned on by default in Python 2.3. + +See also +........ + +PEP 238(3) - Changing the Division Operator + + Written by Moshe Zadka and Guido van Rossum. Implemented by 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 Changes, Next: PEP 227 Nested Scopes, Prev: PEP 238 Changing the Division Operator, Up: What’s New in Python 2 2 + +1.20.7 Unicode Changes +---------------------- + +Python’s Unicode support has been enhanced a bit in 2.2. Unicode +strings are usually stored as UCS-2, as 16-bit unsigned integers. +Python 2.2 can also be compiled to use UCS-4, 32-bit unsigned integers, +as its internal encoding by supplying ‘--enable-unicode=ucs4’ to the +configure script. (It’s also possible to specify ‘--disable-unicode’ to +completely disable Unicode support.) + +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: 204. +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. + +Using this new feature, codecs have been added for tasks not directly +related to Unicode. For example, codecs have been added for +uu-encoding, MIME’s base64 encoding, and compression with the *note +zlib: 133. module: + + >>> 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 + M2&5R92!I=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. + +See also +........ + +PEP 261(2) - Support for ‘wide’ Unicode characters + + Written by Paul Prescod. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0261/ + + (2) https://peps.python.org/pep-0261/ + + +File: python.info, Node: PEP 227 Nested Scopes, Next: New and Improved Modules<3>, Prev: Unicode Changes, Up: What’s New in Python 2 2 + +1.20.8 PEP 227: Nested Scopes +----------------------------- + +In Python 2.1, statically nested scopes were added as an optional +feature, to be enabled by a ‘from __future__ import nested_scopes’ +directive. In 2.2 nested scopes no longer need to be specially enabled, +and are now always present. The rest of this section is a copy of the +description of nested scopes from my “What’s New in Python 2.1” +document; if you read it when 2.1 came out, you can skip the rest of +this section. + +The largest change introduced in Python 2.1, and made complete in 2.2, +is to Python’s scoping rules. In Python 2.0, at any given time there +are at most three namespaces used to look up variable names: local, +module-level, and the built-in namespace. This often surprised people +because it didn’t match their intuitive expectations. For example, a +nested recursive function definition doesn’t work: + + def f(): + ... + def g(value): + ... + return g(value-1) + 1 + ... + +The function ‘g()’ will always raise a *note NameError: 43a. 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: 128f. 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 + +The readability of Python code written in a strongly functional style +suffers greatly as a result. + +The most significant change to Python 2.2 is that static scoping has +been added to the language to fix this problem. As a first effect, the +‘name=name’ default argument is now unnecessary in the above example. +Put simply, when a given variable name is not assigned a value within a +function (by an assignment, or the *note def: 1423, *note class: 12ca, +or *note import: 5de. statements), references to the variable will be +looked up in the local namespace of the enclosing scope. A more +detailed explanation of the rules, and a dissection of the +implementation, can be found in the PEP. + +This change may cause some compatibility problems for code where the +same variable name is used both at the module level and as a local +variable within a function that contains further function definitions. +This seems rather unlikely though, since such code would have been +pretty confusing to read in the first place. + +One side effect of the change is that the ‘from module import *’ and +‘exec’ statements have been made illegal inside a function scope under +certain conditions. The Python reference manual has said all along that +‘from module import *’ is only legal at the top level of a module, but +the CPython interpreter has never enforced this before. As part of the +implementation of nested scopes, the compiler which turns Python source +into bytecodes has to generate different code to access variables in a +containing scope. ‘from module import *’ and ‘exec’ make it impossible +for the compiler to figure this out, because they add names to the local +namespace that are unknowable at compile time. Therefore, if a function +contains function definitions or *note lambda: 128f. expressions with +free variables, the compiler will flag this by raising a *note +SyntaxError: 18d. exception. + +To make the preceding explanation a bit clearer, here’s an example: + + 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()’. + +This shouldn’t be much of a limitation, since ‘exec’ is rarely used in +most Python code (and when it is used, it’s often a sign of a poor +design anyway). + +See also +........ + +PEP 227(1) - Statically Nested Scopes + + Written and implemented by Jeremy Hylton. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0227/ + + +File: python.info, Node: New and Improved Modules<3>, Next: Interpreter Changes and Fixes, Prev: PEP 227 Nested Scopes, Up: What’s New in Python 2 2 + +1.20.9 New and Improved Modules +------------------------------- + + * The *note xmlrpclib: 12e. 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: 12f. module makes it easy to create + straightforward XML-RPC servers. See + ‘http://xmlrpc.scripting.com/’ for more information about XML-RPC. + + * The new *note hmac: 6a. module implements the HMAC algorithm + described by RFC 2104(1). (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: + 14c3. The enhanced functions include *note stat(): 49c, *note + fstat(): d8b, *note statvfs(): 10f0, and *note fstatvfs(): d8c. in + the *note os: a1. module, and *note localtime(): 14c4, *note + gmtime(): 11b2, and *note strptime(): 13f8. in the *note time: ee. + module. + + For example, to obtain a file’s size using the old tuples, you’d + end up writing something like ‘file_size = + os.stat(filename)[stat.ST_SIZE]’, but now this can be written more + clearly as ‘file_size = os.stat(filename).st_size’. + + The original patch for this feature was contributed by Nick + Mathewson. + + * The Python profiler has been extensively reworked and various + errors in its output have been corrected. (Contributed by Fred L. + Drake, Jr. and Tim Peters.) + + * The *note socket: cc. module can be compiled to support IPv6; + specify the ‘--enable-ipv6’ option to Python’s configure script. + (Contributed by Jun-ichiro “itojun” Hagino.) + + * Two new format characters were added to the *note struct: d5. + 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.) + + * In the interpreter’s interactive mode, there’s a new built-in + function *note help(): 8d6. that uses the *note pydoc: b5. module + introduced in Python 2.1 to provide interactive help. + ‘help(object)’ displays any available help text about 'object'. + *note help(): 8d6. with no argument puts you in an online help + utility, where you can enter the names of functions, classes, or + modules to read their help text. (Contributed by Guido van Rossum, + using Ka-Ping Yee’s *note pydoc: b5. module.) + + * Various bugfixes and performance improvements have been made to the + SRE engine underlying the *note re: b9. module. For example, the + *note re.sub(): 2a5. and *note re.split(): 2a4. 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(): + 14c5. 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.) + + * The *note smtplib: ca. module now supports RFC 2487(2), “Secure + SMTP over TLS”, so it’s now possible to encrypt the SMTP traffic + between a Python program and the mail transport agent being handed + a message. *note smtplib: ca. also supports SMTP authentication. + (Contributed by Gerhard Häring.) + + * The *note imaplib: 74. module, maintained by Piers Lauder, has + support for several new extensions: the NAMESPACE extension defined + in RFC 2342(3), SORT, GETACL and 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: 3b, 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: 37. 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: d3. 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: 8f. module now makes it easier to use + alternative MIME-type databases by the addition of a *note + MimeTypes: 14c6. class, which takes a list of filenames to be + parsed. (Contributed by Fred L. Drake, Jr.) + + * A *note Timer: 114d. class was added to the *note threading: ed. + 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: Interpreter Changes and Fixes, Next: Other Changes and Fixes<3>, Prev: New and Improved Modules<3>, Up: What’s New in Python 2 2 + +1.20.10 Interpreter Changes and Fixes +------------------------------------- + +Some of the changes only affect people who deal with the Python +interpreter at the C level because they’re writing Python extension +modules, embedding the interpreter, or just hacking on the interpreter +itself. If you only write Python code, none of the changes described +here will affect you very much. + + * Profiling and tracing functions can now be implemented in C, which + can operate at much higher speeds than Python-based functions and + should reduce the overhead of profiling and tracing. This will be + of interest to authors of development environments for Python. Two + new C functions were added to Python’s API, *note + PyEval_SetProfile(): 14c8. and *note PyEval_SetTrace(): 41d. The + existing *note sys.setprofile(): 14c9. and *note sys.settrace(): + 14ca. functions still exist, and have simply been changed to use + the new C-level interface. (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(): 14cb. and *note + PyInterpreterState_Next(): 14cc. let a caller walk through all the + existing interpreter objects; *note + PyInterpreterState_ThreadHead(): 14cd. and *note + PyThreadState_Next(): 14ce. allow looping over all the thread + states for a given interpreter. (Contributed by David Beazley.) + + * The C-level interface to the garbage collector has been changed to + make it easier to write extension types that support garbage + collection and to debug misuses of the functions. Various + functions have slightly different semantics, so a bunch of + functions had to be renamed. Extensions that use the old API will + still compile but will 'not' participate in garbage collection, so + updating them for 2.2 should be considered fairly high priority. + + To upgrade an extension module to the new API, perform the + following steps: + + * Rename ‘Py_TPFLAGS_GC’ to *note Py_TPFLAGS_HAVE_GC: 778. + + * + Use *note PyObject_GC_New(): aa2. or *note PyObject_GC_NewVar(): aa3. to allocate + + objects, and *note PyObject_GC_Del(): 14cf. to deallocate + them. + + * Rename ‘PyObject_GC_Init()’ to *note PyObject_GC_Track(): 14d0. and + ‘PyObject_GC_Fini()’ to *note PyObject_GC_UnTrack(): 14d1. + + * Remove ‘PyGC_HEAD_SIZE’ from object size calculations. + + * Remove calls to ‘PyObject_AS_GC()’ and ‘PyObject_FROM_GC()’. + + * A new ‘et’ format sequence was added to *note PyArg_ParseTuple(): + 56e.; ‘et’ takes both a parameter and an encoding name, and + converts the parameter to the given encoding if the parameter turns + out to be a Unicode string, or leaves it alone if it’s an 8-bit + string, assuming it to already be in the desired encoding. This + differs from the ‘es’ format character, which assumes that 8-bit + strings are in Python’s default ASCII encoding and converts them to + the specified new encoding. (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(): + 14d2, 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: 334.* variables that will be filled in with + argument values. + + * Two new flags *note METH_NOARGS: 149f. and *note METH_O: 14d3. 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: 14d4. Also, the old ‘METH_OLDARGS’ + style of writing C methods is now officially deprecated. + + * Two new wrapper functions, *note PyOS_snprintf(): 14d5. and *note + PyOS_vsnprintf(): 14d6. 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.) + + * The *note _PyTuple_Resize(): 14d7. function has lost an unused + parameter, so now it takes 2 parameters instead of 3. The third + argument was never used, and can simply be discarded when porting + code from earlier versions to Python 2.2. + + +File: python.info, Node: Other Changes and Fixes<3>, Next: Acknowledgements<6>, Prev: Interpreter Changes and Fixes, Up: What’s New in Python 2 2 + +1.20.11 Other Changes and Fixes +------------------------------- + +As usual there were a bunch of other improvements and bugfixes scattered +throughout the source tree. A search through the CVS change logs finds +there were 527 patches applied and 683 bugs fixed between Python 2.1 and +2.2; 2.2.1 applied 139 patches and fixed 143 bugs; 2.2.2 applied 106 +patches and fixed 82 bugs. These figures are likely to be +underestimates. + +Some of the more notable changes are: + + * 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. + + * Keyword arguments passed to built-in functions that don’t take them + now cause a *note TypeError: 534. exception to be raised, with the + message “'function' takes no keyword arguments”. + + * Weak references, added in Python 2.1 as an extension module, are + now part of the core because they’re used in the implementation of + new-style classes. The *note ReferenceError: 14d9. exception has + therefore moved from the *note weakref: 114. module to become a + built-in exception. + + * A new script, ‘Tools/scripts/cleanfuture.py’ by Tim Peters, + automatically removes obsolete ‘__future__’ statements from Python + source code. + + * An additional 'flags' argument has been added to the built-in + function *note compile(): 192, so the behaviour of ‘__future__’ + statements can now be correctly observed in simulated shells, such + as those presented by IDLE and other development environments. + This is described in PEP 264(1). (Contributed by Michael Hudson.) + + * The new license introduced with Python 1.6 wasn’t GPL-compatible. + This is fixed by some minor textual changes to the 2.2 license, so + it’s now legal to embed Python inside a GPLed program again. Note + that Python itself is not GPLed, but instead is under a license + that’s essentially equivalent to the BSD license, same as it always + was. The license changes were also applied to the Python 2.0.1 and + 2.1.1 releases. + + * When presented with a Unicode filename on Windows, Python will now + convert it to an MBCS encoded string, as used by the Microsoft file + APIs. As MBCS is explicitly used by the file APIs, Python’s choice + of ASCII as the default encoding turns out to be an annoyance. On + Unix, the locale’s character set is used if + ‘locale.nl_langinfo(CODESET)’ is available. (Windows support was + contributed by Mark Hammond with assistance from Marc-André + Lemburg. Unix support was added by Martin von Löwis.) + + * Large file support is now enabled on Windows. (Contributed by Tim + Peters.) + + * The ‘Tools/scripts/ftpmirror.py’ script now parses a ‘.netrc’ file, + if you have one. (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: 2ee. 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. + + * There were a bunch of patches to the dictionary implementation, + mostly to fix potential core dumps if a dictionary contains objects + that sneakily changed their hash value, or mutated the dictionary + they were contained in. For a while python-dev fell into a gentle + rhythm of Michael Hudson finding a case that dumped core, Tim + Peters fixing the bug, Michael finding another case, and round and + round it went. + + * 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.) + + * Files ending in ‘.pyw’ can now be imported on Windows. ‘.pyw’ is a + Windows-only thing, used to indicate that a script needs to be run + using PYTHONW.EXE instead of PYTHON.EXE in order to prevent a DOS + console from popping up to display the output. This patch makes it + possible to import such scripts, in case they’re also usable as + modules. (Implemented by David Bolen.) + + * On platforms where Python uses the C ‘dlopen()’ function to load + extension modules, it’s now possible to set the flags used by + ‘dlopen()’ using the *note sys.getdlopenflags(): 14da. and *note + sys.setdlopenflags(): 1113. functions. (Contributed by Bram + Stolk.) + + * The *note pow(): 9d2. 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: 534. exception. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0264/ + + +File: python.info, Node: Acknowledgements<6>, Prev: Other Changes and Fixes<3>, Up: What’s New in Python 2 2 + +1.20.12 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: 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.21 What’s New in Python 2.1 +============================= + + +Author: A.M. Kuchling + +* Menu: + +* Introduction: Introduction<2>. +* PEP 227; Nested Scopes: PEP 227 Nested Scopes<2>. +* PEP 236; __future__ Directives: PEP 236 __future__ Directives. +* PEP 207; Rich Comparisons: PEP 207 Rich Comparisons. +* PEP 230; Warning Framework: PEP 230 Warning Framework. +* PEP 229; New Build System: PEP 229 New Build System. +* PEP 205; Weak References: PEP 205 Weak References. +* PEP 232; Function Attributes: PEP 232 Function Attributes. +* PEP 235; Importing Modules on Case-Insensitive Platforms: PEP 235 Importing Modules on Case-Insensitive Platforms. +* PEP 217; Interactive Display Hook: PEP 217 Interactive Display Hook. +* PEP 208; New Coercion Model: PEP 208 New Coercion Model. +* PEP 241; Metadata in Python Packages: PEP 241 Metadata in Python Packages. +* New and Improved Modules: New and Improved Modules<4>. +* Other Changes and Fixes: Other Changes and Fixes<4>. +* Acknowledgements: Acknowledgements<7>. + + +File: python.info, Node: Introduction<2>, Next: PEP 227 Nested Scopes<2>, Up: What’s New in Python 2 1 + +1.21.1 Introduction +------------------- + +This article explains the new features in Python 2.1. While there +aren’t as many changes in 2.1 as there were in Python 2.0, there are +still some pleasant surprises in store. 2.1 is the first release to be +steered through the use of Python Enhancement Proposals, or PEPs, so +most of the sizable changes have accompanying PEPs that provide more +complete documentation and a design rationale for the change. This +article doesn’t attempt to document the new features completely, but +simply provides an overview of the new features for Python programmers. +Refer to the Python 2.1 documentation, or to the specific PEP, for more +details about any new feature that particularly interests you. + +One recent goal of the Python development team has been to accelerate +the pace of new releases, with a new release coming every 6 to 9 months. +2.1 is the first release to come out at this faster pace, with the first +alpha appearing in January, 3 months after the final version of 2.0 was +released. + +The final release of Python 2.1 was made on April 17, 2001. + + +File: python.info, Node: PEP 227 Nested Scopes<2>, Next: PEP 236 __future__ Directives, Prev: Introduction<2>, Up: What’s New in Python 2 1 + +1.21.2 PEP 227: Nested Scopes +----------------------------- + +The largest change in Python 2.1 is to Python’s scoping rules. In +Python 2.0, at any given time there are at most three namespaces used to +look up variable names: local, module-level, and the built-in namespace. +This often surprised people because it didn’t match their intuitive +expectations. For example, a nested recursive function definition +doesn’t work: + + def f(): + ... + def g(value): + ... + return g(value-1) + 1 + ... + +The function ‘g()’ will always raise a *note NameError: 43a. 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: 128f. expression +clumsier, and this was a problem in practice. In code which uses *note +lambda: 128f. 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 + +The readability of Python code written in a strongly functional style +suffers greatly as a result. + +The most significant change to Python 2.1 is that static scoping has +been added to the language to fix this problem. As a first effect, the +‘name=name’ default argument is now unnecessary in the above example. +Put simply, when a given variable name is not assigned a value within a +function (by an assignment, or the *note def: 1423, *note class: 12ca, +or *note import: 5de. statements), references to the variable will be +looked up in the local namespace of the enclosing scope. A more +detailed explanation of the rules, and a dissection of the +implementation, can be found in the PEP. + +This change may cause some compatibility problems for code where the +same variable name is used both at the module level and as a local +variable within a function that contains further function definitions. +This seems rather unlikely though, since such code would have been +pretty confusing to read in the first place. + +One side effect of the change is that the ‘from module import *’ and +‘exec’ statements have been made illegal inside a function scope under +certain conditions. The Python reference manual has said all along that +‘from module import *’ is only legal at the top level of a module, but +the CPython interpreter has never enforced this before. As part of the +implementation of nested scopes, the compiler which turns Python source +into bytecodes has to generate different code to access variables in a +containing scope. ‘from module import *’ and ‘exec’ make it impossible +for the compiler to figure this out, because they add names to the local +namespace that are unknowable at compile time. Therefore, if a function +contains function definitions or *note lambda: 128f. expressions with +free variables, the compiler will flag this by raising a *note +SyntaxError: 18d. exception. + +To make the preceding explanation a bit clearer, here’s an example: + + 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()’. + +This shouldn’t be much of a limitation, since ‘exec’ is rarely used in +most Python code (and when it is used, it’s often a sign of a poor +design anyway). + +Compatibility concerns have led to nested scopes being introduced +gradually; in Python 2.1, they aren’t enabled by default, but can be +turned on within a module by using a future statement as described in +PEP 236(1). (See the following section for further discussion of PEP +236(2).) In Python 2.2, nested scopes will become the default and there +will be no way to turn them off, but users will have had all of 2.1’s +lifetime to fix any breakage resulting from their introduction. + +See also +........ + +PEP 227(3) - Statically Nested Scopes + + Written and implemented by 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__ Directives, Next: PEP 207 Rich Comparisons, Prev: PEP 227 Nested Scopes<2>, Up: What’s New in Python 2 1 + +1.21.3 PEP 236: __future__ Directives +------------------------------------- + +The reaction to nested scopes was widespread concern about the dangers +of breaking code with the 2.1 release, and it was strong enough to make +the Pythoneers take a more conservative approach. This approach +consists of introducing a convention for enabling optional functionality +in release N that will become compulsory in release N+1. + +The syntax uses a ‘from...import’ statement using the reserved module +name *note __future__: 0. Nested scopes can be enabled by the following +statement: + + from __future__ import nested_scopes + +While it looks like a normal *note import: 5de. statement, it’s not; +there are strict rules on where such a future statement can be put. +They can only be at the top of a module, and must precede any Python +code or regular ‘import’ statements. This is because such statements +can affect how the Python bytecode compiler parses code and generates +bytecode, so they must precede any statement that will result in +bytecodes being produced. + +See also +........ + +PEP 236(1) - Back to the *note __future__: 0. + + Written by Tim Peters, and primarily implemented by Jeremy Hylton. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0236/ + + +File: python.info, Node: PEP 207 Rich Comparisons, Next: PEP 230 Warning Framework, Prev: PEP 236 __future__ Directives, Up: What’s New in Python 2 1 + +1.21.4 PEP 207: Rich Comparisons +-------------------------------- + +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. + +In Python 2.1, rich comparisons were added in order to support this +need. Python classes can now individually overload each of the ‘<’, +‘<=’, ‘>’, ‘>=’, ‘==’, and ‘!=’ operations. The new magic method names +are: + +Operation Method name + +--------------------------------------------- + +‘<’ *note __lt__(): 1292. + + +‘<=’ *note __le__(): 12fe. + + +‘>’ *note __gt__(): 12ff. + + +‘>=’ *note __ge__(): 1300. + + +‘==’ *note __eq__(): afa. + + +‘!=’ *note __ne__(): 14e2. + + +(The magic methods are named after the corresponding Fortran operators +‘.LT.’. ‘.LE.’, &c. Numeric programmers are almost certainly quite +familiar with these names and will find them easy to remember.) + +Each of these magic methods is of the form ‘method(self, other)’, where +‘self’ will be the object on the left-hand side of the operator, while +‘other’ will be the object on the right-hand side. For example, the +expression ‘A < B’ will cause ‘A.__lt__(B)’ to be called. + +Each of these magic methods can return anything at all: a Boolean, a +matrix, a list, or any other Python object. Alternatively they can +raise an exception if the comparison is impossible, inconsistent, or +otherwise meaningless. + +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. + +There are also corresponding changes of interest to C programmers; +there’s a new slot ‘tp_richcmp’ in type objects and an API for +performing a given rich comparison. I won’t cover the C API here, but +will refer you to PEP 207(1), or to 2.1’s C API documentation, for the +full list of related functions. + +See also +........ + +PEP 207(2) - Rich Comparisons + + Written by Guido van Rossum, heavily based on earlier work by David + Ascher, and implemented by Guido van Rossum. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0207/ + + (2) https://peps.python.org/pep-0207/ + + +File: python.info, Node: PEP 230 Warning Framework, Next: PEP 229 New Build System, Prev: PEP 207 Rich Comparisons, Up: What’s New in Python 2 1 + +1.21.5 PEP 230: Warning Framework +--------------------------------- + +Over its 10 years of existence, Python has accumulated a certain number +of obsolete modules and features along the way. It’s difficult to know +when a feature is safe to remove, since there’s no way of knowing how +much code uses it — perhaps no programs depend on the feature, or +perhaps many do. To enable removing old features in a more structured +way, a warning framework was added. When the Python developers want to +get rid of a feature, it will first trigger a warning in the next +version of Python. The following Python version can then drop the +feature, and users will have had a full release cycle to remove uses of +the old feature. + +Python 2.1 adds the warning framework to be used in this scheme. It +adds a *note warnings: 112. module that provide functions to issue +warnings, and to filter out warnings that you don’t want to be +displayed. Third-party modules can also use this framework to deprecate +old features that they no longer wish to support. + +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 + >>> + +Warnings can be issued by calling the *note warnings.warn(): 14e4. +function: + + warnings.warn("feature X no longer supported") + +The first parameter is the warning message; an additional optional +parameters can be used to specify a particular warning category. + +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: b9. 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: 1a5. 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). + +Functions were also added to Python’s C API for issuing warnings; refer +to PEP 230 or to Python’s API documentation for the details. + +See also +........ + +PEP 5(1) - Guidelines for Language Evolution + + Written by Paul Prescod, to specify procedures to be followed when + removing old features from Python. The policy described in this + PEP hasn’t been officially adopted, but the eventual policy + probably won’t be too different from Prescod’s proposal. + +PEP 230(2) - Warning Framework + + Written and implemented by Guido van Rossum. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0005/ + + (2) https://peps.python.org/pep-0230/ + + +File: python.info, Node: PEP 229 New Build System, Next: PEP 205 Weak References, Prev: PEP 230 Warning Framework, Up: What’s New in Python 2 1 + +1.21.6 PEP 229: New Build System +-------------------------------- + +When compiling Python, the user had to go in and edit the +‘Modules/Setup’ file in order to enable various additional modules; the +default set is relatively small and limited to modules that compile on +most Unix platforms. This means that on Unix platforms with many more +features, most notably Linux, Python installations often don’t contain +all useful modules they could. + +Python 2.0 added the Distutils, a set of modules for distributing and +installing extensions. In Python 2.1, the Distutils are used to compile +much of the standard library of extension modules, autodetecting which +ones are supported on the current machine. It’s hoped that this will +make Python installations easier and more featureful. + +Instead of having to edit the ‘Modules/Setup’ file in order to enable +modules, a ‘setup.py’ script in the top directory of the Python source +distribution is run at build time, and attempts to discover which +modules can be enabled by examining the modules and header files on the +system. If a module is configured in ‘Modules/Setup’, the ‘setup.py’ +script won’t attempt to compile that module and will defer to the +‘Modules/Setup’ file’s contents. This provides a way to specific any +strange command-line flags or libraries that are required for a specific +platform. + +In another far-reaching change to the build mechanism, Neil Schemenauer +restructured things so Python now uses a single makefile that isn’t +recursive, instead of makefiles in the top directory and in each of the +‘Python/’, ‘Parser/’, ‘Objects/’, and ‘Modules/’ subdirectories. This +makes building Python faster and also makes hacking the Makefiles +clearer and simpler. + +See also +........ + +PEP 229(1) - Using Distutils to Build Python + + Written and implemented by A.M. Kuchling. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0229/ + + +File: python.info, Node: PEP 205 Weak References, Next: PEP 232 Function Attributes, Prev: PEP 229 New Build System, Up: What’s New in Python 2 1 + +1.21.7 PEP 205: Weak References +------------------------------- + +Weak references, available through the *note weakref: 114. module, are a +minor but useful new data type in the Python programmer’s toolbox. + +Storing a reference to an object (say, in a dictionary or a list) has +the side effect of keeping that object alive forever. There are a few +specific cases where this behaviour is undesirable, object caches being +the most common one, and another being circular references in data +structures such as trees. + +For example, consider a memoizing function that caches the results of +another function ‘f(x)’ by storing the function’s argument and its +result in a dictionary: + + _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. + +Weak references provide a way to implement a cache that won’t keep +objects alive beyond their time. If an object is only accessible +through weak references, the object will be deallocated and the weak +references will now indicate that the object it referred to no longer +exists. A weak reference to an object 'obj' is created by calling ‘wr = +weakref.ref(obj)’. The object being referred to is returned by calling +the weak reference as if it were a function: ‘wr()’. It will return the +referenced object, or ‘None’ if the object no longer exists. + +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: 114. 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 + +See also +........ + +PEP 205(1) - Weak References + + Written and implemented by Fred L. Drake, Jr. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0205/ + + +File: python.info, Node: PEP 232 Function Attributes, Next: PEP 235 Importing Modules on Case-Insensitive Platforms, Prev: PEP 205 Weak References, Up: What’s New in Python 2 1 + +1.21.8 PEP 232: Function Attributes +----------------------------------- + +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__: 11cb. 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. + +Arbitrary attributes can now be set and retrieved on functions using the +regular Python syntax: + + 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__: 12c5. Unlike the *note __dict__: c5d. attribute of +class instances, in functions you can actually assign a new dictionary +to *note __dict__: 12c5, 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. + +See also +........ + +PEP 232(1) - Function Attributes + + Written and implemented by Barry Warsaw. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0232/ + + +File: python.info, Node: PEP 235 Importing Modules on Case-Insensitive Platforms, Next: PEP 217 Interactive Display Hook, Prev: PEP 232 Function Attributes, Up: What’s New in Python 2 1 + +1.21.9 PEP 235: Importing Modules on Case-Insensitive Platforms +--------------------------------------------------------------- + +Some operating systems have filesystems that are case-insensitive, MacOS +and Windows being the primary examples; on these systems, it’s +impossible to distinguish the filenames ‘FILE.PY’ and ‘file.py’, even +though they do store the file’s name in its original case (they’re +case-preserving, too). + +In Python 2.1, the *note import: 5de. statement will work to simulate +case-sensitivity on case-insensitive platforms. Python will now search +for the first case-sensitive match by default, raising an *note +ImportError: 415. if no such file is found, so ‘import file’ will not +import a module named ‘FILE.PY’. Case-insensitive matching can be +requested by setting the *note PYTHONCASEOK: 95c. environment variable +before starting the Python interpreter. + + +File: python.info, Node: PEP 217 Interactive Display Hook, Next: PEP 208 New Coercion Model, Prev: PEP 235 Importing Modules on Case-Insensitive Platforms, Up: What’s New in Python 2 1 + +1.21.10 PEP 217: Interactive Display Hook +----------------------------------------- + +When using the Python interpreter interactively, the output of commands +is displayed using the built-in *note repr(): 7f9. function. In Python +2.1, the variable *note sys.displayhook(): 14ea. can be set to a +callable object which will be called instead of *note repr(): 7f9. For +example, you can set it to a special pretty-printing function: + + >>> # 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, ] + >>> + +See also +........ + +PEP 217(1) - Display Hook for Interactive Use + + Written and implemented by Moshe Zadka. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0217/ + + +File: python.info, Node: PEP 208 New Coercion Model, Next: PEP 241 Metadata in Python Packages, Prev: PEP 217 Interactive Display Hook, Up: What’s New in Python 2 1 + +1.21.11 PEP 208: New Coercion Model +----------------------------------- + +How numeric coercion is done at the C level was significantly modified. +This will only affect the authors of C extensions to Python, allowing +them more flexibility in writing extension types that support numeric +operations. + +Extension types can now set the type flag ‘Py_TPFLAGS_CHECKTYPES’ in +their ‘PyTypeObject’ structure to indicate that they support the new +coercion model. In such extension types, the numeric slot functions can +no longer assume that they’ll be passed two arguments of the same type; +instead they may be passed two arguments of differing types, and can +then perform their own internal coercion. If the slot function is +passed a type it can’t handle, it can indicate the failure by returning +a reference to the ‘Py_NotImplemented’ singleton value. The numeric +functions of the other type will then be tried, and perhaps they can +handle the operation; if the other type also returns +‘Py_NotImplemented’, then a *note TypeError: 534. will be raised. +Numeric methods written in Python can also return ‘Py_NotImplemented’, +causing the interpreter to act as if the method did not exist (perhaps +raising a *note TypeError: 534, perhaps trying another object’s numeric +methods). + +See also +........ + +PEP 208(1) - Reworking the Coercion Model + + Written and implemented by Neil Schemenauer, heavily based upon + earlier work by Marc-André Lemburg. Read this to understand the + fine points of how numeric operations will now be processed at the + C level. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0208/ + + +File: python.info, Node: PEP 241 Metadata in Python Packages, Next: New and Improved Modules<4>, Prev: PEP 208 New Coercion Model, Up: What’s New in Python 2 1 + +1.21.12 PEP 241: Metadata in Python Packages +-------------------------------------------- + +A common complaint from Python users is that there’s no single catalog +of all the Python modules in existence. T. Middleton’s Vaults of +Parnassus at ‘www.vex.net/parnassus/’ (retired in February 2009, +available in the Internet Archive Wayback Machine(1)) was the largest +catalog of Python modules, but registering software at the Vaults is +optional, and many people did not bother. + +As a first small step toward fixing the problem, Python software +packaged using the Distutils ‘sdist’ command will include a file named +‘PKG-INFO’ containing information about the package such as its name, +version, and author (metadata, in cataloguing terminology). PEP 241(2) +contains the full list of fields that can be present in the ‘PKG-INFO’ +file. As people began to package their software using Python 2.1, more +and more packages will include metadata, making it possible to build +automated cataloguing systems and experiment with them. With the result +experience, perhaps it’ll be possible to design a really good catalog +and then build support for it into Python 2.2. For example, the +Distutils ‘sdist’ and ‘bdist_*’ commands could support an ‘upload’ +option that would automatically upload your package to a catalog server. + +You can start creating packages containing ‘PKG-INFO’ even if you’re not +using Python 2.1, since a new release of the Distutils will be made for +users of earlier Python versions. Version 1.0.2 of the Distutils +includes the changes described in PEP 241(3), as well as various +bugfixes and enhancements. It will be available from the Distutils SIG +at ‘https://www.python.org/community/sigs/current/distutils-sig/’. + +See also +........ + +PEP 241(4) - Metadata for Python Software Packages + + Written and implemented by A.M. Kuchling. + +PEP 243(5) - Module Repository Upload Mechanism + + Written by Sean Reifschneider, this draft PEP describes a proposed + mechanism for uploading Python packages to a central server. + + ---------- Footnotes ---------- + + (1) +https://web.archive.org/web/20090130140102/http://www.vex.net/parnassus/ + + (2) https://peps.python.org/pep-0241/ + + (3) https://peps.python.org/pep-0241/ + + (4) https://peps.python.org/pep-0241/ + + (5) https://peps.python.org/pep-0243/ + + +File: python.info, Node: New and Improved Modules<4>, Next: Other Changes and Fixes<4>, Prev: PEP 241 Metadata in Python Packages, Up: What’s New in Python 2 1 + +1.21.13 New and Improved Modules +-------------------------------- + + * 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’ also includes a Tk-based interactive help browser. ‘pydoc’ + quickly becomes addictive; try it out! + + * Two different modules for unit testing were added to the standard + library. The *note doctest: 3a. 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: 37. module contains a class, *note + SequenceMatcher: 1012, 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: 2d, a wrapper for the panel library, part of + ncurses and of SYSV curses, was contributed by Thomas Gellekum. + The panel library provides windows with the additional feature of + depth. Windows can be moved higher or lower in the depth ordering, + and the panel library figures out where panels overlap and which + sections are visible. + + * 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: 120. + 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. + + * Ping also contributed another hook for handling uncaught + exceptions. *note sys.excepthook(): 807. can be set to a callable + object. When an exception isn’t caught by any *note try: + 6e4.…*note except: 18b. blocks, the exception will be passed to + *note sys.excepthook(): 807, which can then do whatever it likes. + At the Ninth Python Conference, Ping demonstrated an application + for this hook: printing an extended traceback that not only lists + the stack frames, but also lists the function arguments and the + local variables for each frame. + + * Various functions in the *note time: ee. module, such as *note + asctime(): 11d9. and *note localtime(): 14c4, 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. + + This change was proposed and implemented by Thomas Wouters. + + * The *note ftplib: 5e. module now defaults to retrieving files in + passive mode, because passive mode is more likely to work from + behind a firewall. This request came from the Debian bug tracking + system, since other Debian packages use *note ftplib: 5e. to + retrieve files and then don’t work from behind a firewall. It’s + deemed unlikely that this will cause problems for anyone, because + Netscape defaults to passive mode and few people complain, but if + passive mode is unsuitable for your application or network setup, + call ‘set_pasv(0)’ on FTP objects to disable passive mode. + + * Support for raw socket access has been added to the *note socket: + cc. module, contributed by Grant Edwards. + + * The *note pstats: b0. module now contains a simple interactive + statistics browser for displaying timing profiles for Python + programs, invoked when the module is run as a script. Contributed + by Eric S. Raymond. + + * A new implementation-dependent function, ‘sys._getframe([depth])’, + has been added to return a given frame object from the current call + stack. *note sys._getframe(): 6dc. returns the frame at the top of + the call stack; if the optional integer argument 'depth' is + supplied, the function returns the frame that is 'depth' calls + below the top of the stack. For example, ‘sys._getframe(1)’ + returns the caller’s frame object. + + This function is only present in CPython, not in Jython or the .NET + implementation. Use it for debugging, and resist the temptation to + put it into production code. + + +File: python.info, Node: Other Changes and Fixes<4>, Next: Acknowledgements<7>, Prev: New and Improved Modules<4>, Up: What’s New in Python 2 1 + +1.21.14 Other Changes and Fixes +------------------------------- + +There were relatively few smaller changes made in Python 2.1 due to the +shorter release cycle. A search through the CVS change logs turns up +117 patches applied, and 136 bugs fixed; both figures are likely to be +underestimates. Some of the more notable changes are: + + * 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: + 14ef, it has to be freed using *note PyMem_Del(): 14f0, 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. + + The object allocator was contributed by 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(): ba. + 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 ... + ... + + For a fuller discussion of the line I/O changes, see the python-dev + summary for January 1–15, 2001 at + ‘https://mail.python.org/pipermail/python-dev/2001-January/’. + + * A new method, *note popitem(): 14f1, 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. + + * Modules can now control which names are imported when ‘from module + import *’ is used, by defining an ‘__all__’ attribute containing a + list of names that will be imported. One common complaint is that + if the module imports other modules such as *note sys: d9. or *note + string: d3, ‘from module import *’ will add them to the importing + module’s namespace. To fix this, simply list the public names in + ‘__all__’: + + # List public names + __all__ = ['Database', 'open'] + + A stricter version of this patch was first suggested and + implemented by Ben Wolfson, but after some python-dev discussion, a + weaker final version was checked in. + + * Applying *note repr(): 7f9. to strings previously used octal + escapes for non-printable characters; for example, a newline was + ‘'\012'’. This was a vestigial trace of Python’s C ancestry, but + today octal is of very little practical use. Ka-Ping Yee suggested + using hex escapes instead of octal ones, and using the ‘\n’, ‘\t’, + ‘\r’ escapes for the appropriate characters, and implemented this + new formatting. + + * Syntax errors detected at compile-time can now raise exceptions + containing the filename and line number of the error, a pleasant + side effect of the compiler reorganization done by Jeremy Hylton. + + * C extensions which import other modules have been changed to use + *note PyImport_ImportModule(): 3ba, 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. + + * The size of the Unicode character database was shrunk by another + 340K thanks to Fredrik Lundh. + + * Some new ports were contributed: MacOS X (by Steven Majewski), + Cygwin (by Jason Tishler); RISCOS (by Dietmar Schwertberger); + Unixware 7 (by Billy G. Allie). + +And there’s the usual list of minor bugfixes, minor memory leaks, +docstring edits, and other tweaks, too lengthy to be worth itemizing; +see the CVS logs for the full details if you want them. + + +File: python.info, Node: Acknowledgements<7>, Prev: Other Changes and Fixes<4>, Up: What’s New in Python 2 1 + +1.21.15 Acknowledgements +------------------------ + +The author would like to thank the following people for offering +suggestions on various drafts of this article: 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: Changelog, Prev: What’s New in Python 2 1, Up: What’s New in Python + +1.22 What’s New in Python 2.0 +============================= + + +Author: A.M. Kuchling and Moshe Zadka + +* Menu: + +* Introduction: Introduction<3>. +* What About Python 1.6?: What About Python 1 6?. +* New Development Process:: +* Unicode: Unicode<2>. +* List Comprehensions:: +* Augmented Assignment:: +* String Methods:: +* Garbage Collection of Cycles:: +* Other Core Changes:: +* Porting to 2.0: Porting to 2 0. +* Extending/Embedding Changes:: +* Distutils; Making Modules Easy to Install: Distutils Making Modules Easy to Install. +* XML Modules:: +* Module changes:: +* New modules:: +* IDLE Improvements:: +* Deleted and Deprecated Modules:: +* Acknowledgements: Acknowledgements<8>. + + +File: python.info, Node: Introduction<3>, Next: What About Python 1 6?, Up: What’s New in Python 2 0 + +1.22.1 Introduction +------------------- + +A new release of Python, version 2.0, was released on October 16, 2000. +This article covers the exciting new features in 2.0, highlights some +other useful changes, and points out a few incompatible changes that may +require rewriting code. + +Python’s development never completely stops between releases, and a +steady flow of bug fixes and improvements are always being submitted. A +host of minor fixes, a few optimizations, additional docstrings, and +better error messages went into 2.0; to list them all would be +impossible, but they’re certainly significant. Consult the publicly +available CVS logs if you want to see the full list. This progress is +due to the five developers working for PythonLabs are now getting paid +to spend their days fixing bugs, and also due to the improved +communication resulting from moving to SourceForge. + + +File: python.info, Node: What About Python 1 6?, Next: New Development Process, Prev: Introduction<3>, Up: What’s New in Python 2 0 + +1.22.2 What About Python 1.6? +----------------------------- + +Python 1.6 can be thought of as the Contractual Obligations Python +release. After the core development team left CNRI in May 2000, CNRI +requested that a 1.6 release be created, containing all the work on +Python that had been performed at CNRI. Python 1.6 therefore represents +the state of the CVS tree as of May 2000, with the most significant new +feature being Unicode support. Development continued after May, of +course, so the 1.6 tree received a few fixes to ensure that it’s +forward-compatible with Python 2.0. 1.6 is therefore part of Python’s +evolution, and not a side branch. + +So, should you take much interest in Python 1.6? Probably not. The +1.6final and 2.0beta1 releases were made on the same day (September 5, +2000), the plan being to finalize Python 2.0 within a month or so. If +you have applications to maintain, there seems little point in breaking +things by moving to 1.6, fixing them, and then having another round of +breakage within a month by moving to 2.0; you’re better off just going +straight to 2.0. Most of the really interesting features described in +this document are only in 2.0, because a lot of work was done between +May and September. + + +File: python.info, Node: New Development Process, Next: Unicode<2>, Prev: What About Python 1 6?, Up: What’s New in Python 2 0 + +1.22.3 New Development Process +------------------------------ + +The most important change in Python 2.0 may not be to the code at all, +but to how Python is developed: in May 2000 the Python developers began +using the tools made available by SourceForge for storing source code, +tracking bug reports, and managing the queue of patch submissions. To +report bugs or submit patches for Python 2.0, use the bug tracking and +patch manager tools available from Python’s project page, located at +‘https://sourceforge.net/projects/python/’. + +The most important of the services now hosted at SourceForge is the +Python CVS tree, the version-controlled repository containing the source +code for Python. Previously, there were roughly 7 or so people who had +write access to the CVS tree, and all patches had to be inspected and +checked in by one of the people on this short list. Obviously, this +wasn’t very scalable. By moving the CVS tree to SourceForge, it became +possible to grant write access to more people; as of September 2000 +there were 27 people able to check in changes, a fourfold increase. +This makes possible large-scale changes that wouldn’t be attempted if +they’d have to be filtered through the small group of core developers. +For example, one day Peter Schneider-Kamp took it into his head to drop +K&R C compatibility and convert the C source for Python to ANSI C. After +getting approval on the python-dev mailing list, he launched into a +flurry of checkins that lasted about a week, other developers joined in +to help, and the job was done. If there were only 5 people with write +access, probably that task would have been viewed as “nice, but not +worth the time and effort needed” and it would never have gotten done. + +The shift to using SourceForge’s services has resulted in a remarkable +increase in the speed of development. Patches now get submitted, +commented on, revised by people other than the original submitter, and +bounced back and forth between people until the patch is deemed worth +checking in. Bugs are tracked in one central location and can be +assigned to a specific person for fixing, and we can count the number of +open bugs to measure progress. This didn’t come without a cost: +developers now have more e-mail to deal with, more mailing lists to +follow, and special tools had to be written for the new environment. +For example, SourceForge sends default patch and bug notification e-mail +messages that are completely unhelpful, so Ka-Ping Yee wrote an HTML +screen-scraper that sends more useful messages. + +The ease of adding code caused a few initial growing pains, such as code +was checked in before it was ready or without getting clear agreement +from the developer group. The approval process that has emerged is +somewhat similar to that used by the Apache group. Developers can vote ++1, +0, -0, or -1 on a patch; +1 and -1 denote acceptance or rejection, +while +0 and -0 mean the developer is mostly indifferent to the change, +though with a slight positive or negative slant. The most significant +change from the Apache model is that the voting is essentially advisory, +letting Guido van Rossum, who has Benevolent Dictator For Life status, +know what the general opinion is. He can still ignore the result of a +vote, and approve or reject a change even if the community disagrees +with him. + +Producing an actual patch is the last step in adding a new feature, and +is usually easy compared to the earlier task of coming up with a good +design. Discussions of new features can often explode into lengthy +mailing list threads, making the discussion hard to follow, and no one +can read every posting to python-dev. Therefore, a relatively formal +process has been set up to write Python Enhancement Proposals (PEPs), +modelled on the internet RFC process. PEPs are draft documents that +describe a proposed new feature, and are continually revised until the +community reaches a consensus, either accepting or rejecting the +proposal. Quoting from the introduction to PEP 1(1), “PEP Purpose and +Guidelines”: + + PEP stands for Python Enhancement Proposal. A PEP is a design + document providing information to the Python community, or + describing a new feature for Python. The PEP should provide a + concise technical specification of the feature and a rationale for + the feature. + + We intend PEPs to be the primary mechanisms for proposing new + features, for collecting community input on an issue, and for + documenting the design decisions that have gone into Python. The + PEP author is responsible for building consensus within the + community and documenting dissenting opinions. + +Read the rest of PEP 1(2) for the details of the PEP editorial process, +style, and format. PEPs are kept in the Python CVS tree on SourceForge, +though they’re not part of the Python 2.0 distribution, and are also +available in HTML form from ‘https://peps.python.org/’. As of September +2000, there are 25 PEPs, ranging from PEP 201(3), “Lockstep Iteration”, +to PEP 225, “Elementwise/Objectwise Operators”. + + ---------- 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: List Comprehensions, Prev: New Development Process, Up: What’s New in Python 2 0 + +1.22.4 Unicode +-------------- + +The largest new feature in Python 2.0 is a new fundamental data type: +Unicode strings. Unicode uses 16-bit numbers to represent characters +instead of the 8-bit number used by ASCII, meaning that 65,536 distinct +characters can be supported. + +The final interface for Unicode support was arrived at through countless +often-stormy discussions on the python-dev mailing list, and mostly +implemented by Marc-André Lemburg, based on a Unicode string type +implementation by Fredrik Lundh. A detailed explanation of the +interface was written up as PEP 100(1), “Python Unicode Integration”. +This article will simply cover the most significant points about the +Unicode interfaces. + +In Python source code, Unicode strings are written as ‘u"string"’. +Arbitrary Unicode characters can be written using a new escape sequence, +‘\uHHHH’, where 'HHHH' is a 4-digit hexadecimal number from 0000 to +FFFF. The existing ‘\xHH’ escape sequence can also be used, and octal +escapes can be used for characters up to U+01FF, which is represented by +‘\777’. + +Unicode strings, just like regular strings, are an immutable sequence +type. They can be indexed and sliced, but not modified in place. +Unicode strings have an ‘encode( [encoding] )’ method that returns an +8-bit string in the desired encoding. Encodings are named by strings, +such as ‘'ascii'’, ‘'utf-8'’, ‘'iso-8859-1'’, or whatever. A codec API +is defined for implementing and registering new encodings that are then +available throughout a Python program. If an encoding isn’t specified, +the default encoding is usually 7-bit ASCII, though it can be changed +for your Python installation by calling the +‘sys.setdefaultencoding(encoding)’ function in a customized version of +‘site.py’. + +Combining 8-bit and Unicode strings always coerces to Unicode, using the +default ASCII encoding; the result of ‘'a' + u'bc'’ is ‘u'abc'’. + +New built-in functions have been added, and existing built-ins modified +to support Unicode: + + * ‘unichr(ch)’ returns a Unicode string 1 character long, containing + the character 'ch'. + + * ‘ord(u)’, where 'u' is a 1-character regular or Unicode string, + returns the number of the character as an integer. + + * ‘unicode(string [, encoding] [, errors] )’ creates a Unicode string + from an 8-bit string. ‘encoding’ is a string naming the encoding + to use. The ‘errors’ parameter specifies the treatment of + characters that are invalid for the current encoding; passing + ‘'strict'’ as the value causes an exception to be raised on any + encoding error, while ‘'ignore'’ causes errors to be silently + ignored and ‘'replace'’ uses U+FFFD, the official replacement + character, in case of any problems. + + * The ‘exec’ statement, and various built-ins such as ‘eval()’, + ‘getattr()’, and ‘setattr()’ will also accept Unicode strings as + well as regular strings. (It’s possible that the process of fixing + this missed some built-ins; if you find a built-in function that + accepts strings but doesn’t accept Unicode strings at all, please + report it as a bug.) + +A new module, *note unicodedata: 105, provides an interface to Unicode +character properties. For example, ‘unicodedata.category(u'A')’ returns +the 2-character string ‘Lu’, the ‘L’ denoting it’s a letter, and ‘u’ +meaning that it’s uppercase. ‘unicodedata.bidirectional(u'\u0660')’ +returns ‘AN’, meaning that U+0660 is an Arabic number. + +The *note codecs: 1b. module contains functions to look up existing +encodings and register new ones. Unless you want to implement a new +encoding, you’ll most often use the ‘codecs.lookup(encoding)’ function, +which returns a 4-element tuple: ‘(encode_func, decode_func, +stream_reader, stream_writer)’. + + * 'encode_func' is a function that takes a Unicode string, and + returns a 2-tuple ‘(string, length)’. 'string' is an 8-bit string + containing a portion (perhaps all) of the Unicode string converted + into the given encoding, and 'length' tells you how much of the + Unicode string was converted. + + * 'decode_func' is the opposite of 'encode_func', taking an 8-bit + string and returning a 2-tuple ‘(ustring, length)’, consisting of + the resulting Unicode string 'ustring' and the integer 'length' + telling how much of the 8-bit string was consumed. + + * '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. + +For example, the following code writes a Unicode string into a file, +encoding it as 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() + +The following code would then read UTF-8 input from the file: + + input = UTF8_streamreader( open( '/tmp/output', 'rb') ) + print repr(input.read()) + input.close() + +Unicode-aware regular expressions are available through the *note re: +b9. module, which has a new underlying implementation called SRE written +by Fredrik Lundh of Secret Labs AB. + +A ‘-U’ command line option was added which causes the Python compiler to +interpret all string literals as Unicode string literals. This is +intended to be used in testing and future-proofing your Python code, +since some future version of Python may drop support for 8-bit strings +and provide only Unicode strings. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0100/ + + +File: python.info, Node: List Comprehensions, Next: Augmented Assignment, Prev: Unicode<2>, Up: What’s New in Python 2 0 + +1.22.5 List Comprehensions +-------------------------- + +Lists are a workhorse data type in Python, and many programs manipulate +a list at some point. Two common operations on lists are to loop over +them, and either pick out the elements that meet a certain criterion, or +apply some function to each element. For example, given a list of +strings, you might want to pull out all the strings containing a given +substring, or strip off trailing whitespace from each line. + +The existing *note map(): 860. and *note filter(): 861. functions can be +used for this purpose, but they require a function as one of their +arguments. This is fine if there’s an existing built-in function that +can be passed directly, but if there isn’t, you have to create a little +function to do the required work, and Python’s scoping rules make the +result ugly if the little function needs additional information. Take +the first example in the previous paragraph, finding all the strings in +the list containing a given substring. You could write the following to +do it: + + # 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) + +Because of Python’s scoping rules, a default argument is used so that +the anonymous function created by the *note lambda: 128f. expression +knows what substring is being searched for. List comprehensions make +this cleaner: + + sublist = [ s for s in L if string.find(s, S) != -1 ] + +List comprehensions have the form: + + [ expression for expr in sequence1 + for expr2 in sequence2 ... + for exprN in sequenceN + if condition ] + +The ‘for’…‘in’ clauses contain the sequences to be iterated over. The +sequences do not have to be the same length, because they are 'not' +iterated over in parallel, but from left to right; this is explained +more clearly in the following paragraphs. The elements of the generated +list will be the successive values of 'expression'. The final ‘if’ +clause is optional; if present, 'expression' is only evaluated and added +to the result if 'condition' is true. + +To make the semantics very clear, a list comprehension is equivalent to +the following Python code: + + for expr1 in sequence1: + for expr2 in sequence2: + ... + for exprN in sequenceN: + if (condition): + # Append the value of + # the expression to the + # resulting list. + +This means that when there are multiple ‘for’…‘in’ clauses, the +resulting list will be equal to the product of the lengths of all the +sequences. If you have two lists of length 3, the output list is 9 +elements long: + + 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)] + +To avoid introducing an ambiguity into Python’s grammar, if 'expression' +is creating a tuple, it must be surrounded with parentheses. The first +list comprehension below is a syntax error, while the second one is +correct: + + # Syntax error + [ x,y for x in seq1 for y in seq2] + # Correct + [ (x,y) for x in seq1 for y in seq2] + +The idea of list comprehensions originally comes from the functional +programming language Haskell (‘https://www.haskell.org’). Greg Ewing +argued most effectively for adding them to Python and wrote the initial +list comprehension patch, which was then discussed for a seemingly +endless time on the python-dev mailing list and kept up-to-date by Skip +Montanaro. + + +File: python.info, Node: Augmented Assignment, Next: String Methods, Prev: List Comprehensions, Up: What’s New in Python 2 0 + +1.22.6 Augmented Assignment +--------------------------- + +Augmented assignment operators, another long-requested feature, have +been added to Python 2.0. Augmented assignment operators include ‘+=’, +‘-=’, ‘*=’, and so forth. For example, the statement ‘a += 2’ +increments the value of the variable ‘a’ by 2, equivalent to the +slightly lengthier ‘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. + +Augmented assignment operators were first introduced in the C +programming language, and most C-derived languages, such as ‘awk’, C++, +Java, Perl, and PHP also support them. The augmented assignment patch +was implemented by Thomas Wouters. + + +File: python.info, Node: String Methods, Next: Garbage Collection of Cycles, Prev: Augmented Assignment, Up: What’s New in Python 2 0 + +1.22.7 String Methods +--------------------- + +Until now string-manipulation functionality was in the *note string: d3. +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. + +Instead, Python 2.0 pushes the problem onto the string type, making +string manipulation functionality available through methods on both +8-bit strings and Unicode strings. + + >>> 'andrew'.capitalize() + 'Andrew' + >>> 'hostname'.replace('os', 'linux') + 'hlinuxtname' + >>> 'moshe'.find('sh') + 2 + +One thing that hasn’t changed, a noteworthy April Fools’ joke +notwithstanding, is that Python strings are immutable. Thus, the string +methods return new strings, and do not modify the string on which they +operate. + +The old *note string: d3. module is still around for backwards +compatibility, but it mostly acts as a front-end to the new string +methods. + +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: d3. module, with the arguments reversed. In other words, +‘s.join(seq)’ is equivalent to the old ‘string.join(seq, s)’. + + +File: python.info, Node: Garbage Collection of Cycles, Next: Other Core Changes, Prev: String Methods, Up: What’s New in Python 2 0 + +1.22.8 Garbage Collection of Cycles +----------------------------------- + +The C implementation of Python uses reference counting to implement +garbage collection. Every Python object maintains a count of the number +of references pointing to itself, and adjusts the count as references +are created or destroyed. Once the reference count reaches zero, the +object is no longer accessible, since you need to have a reference to an +object to access it, and if the count is zero, no references exist any +longer. + +Reference counting has some pleasant properties: it’s easy to understand +and implement, and the resulting implementation is portable, fairly +fast, and reacts well with other libraries that implement their own +memory handling schemes. The major problem with reference counting is +that it sometimes doesn’t realise that objects are no longer accessible, +resulting in a memory leak. This happens when there are cycles of +references. + +Consider the simplest possible cycle, a class instance which has a +reference to itself: + + instance = SomeClass() + instance.myself = instance + +After the above two lines of code have been executed, the reference +count of ‘instance’ is 2; one reference is from the variable named +‘'instance'’, and the other is from the ‘myself’ attribute of the +instance. + +If the next line of code is ‘del instance’, what happens? The reference +count of ‘instance’ is decreased by 1, so it has a reference count of 1; +the reference in the ‘myself’ attribute still exists. Yet the instance +is no longer accessible through Python code, and it could be deleted. +Several objects can participate in a cycle if they have references to +each other, causing all of the objects to be leaked. + +Python 2.0 fixes this problem by periodically executing a cycle +detection algorithm which looks for inaccessible cycles and deletes the +objects involved. A new *note gc: 60. module provides functions to +perform a garbage collection, obtain debugging statistics, and tuning +the collector’s parameters. + +Running the cycle detection algorithm takes some time, and therefore +will result in some additional overhead. It is hoped that after we’ve +gotten experience with the cycle collection from using 2.0, Python 2.1 +will be able to minimize the overhead with careful tuning. It’s not yet +obvious how much performance is lost, because benchmarking this is +tricky and depends crucially on how often the program creates and +destroys objects. The detection of cycles can be disabled when Python +is compiled, if you can’t afford even a tiny speed penalty or suspect +that the cycle collection is buggy, by specifying the +‘--without-cycle-gc’ switch when running the ‘configure’ script. + +Several people tackled this problem and contributed to a solution. An +early implementation of the cycle detection approach was written by Toby +Kelsey. The current algorithm was suggested by Eric Tiedemann during a +visit to CNRI, and Guido van Rossum and Neil Schemenauer wrote two +different implementations, which were later integrated by Neil. Lots of +other people offered suggestions along the way; the March 2000 archives +of the python-dev mailing list contain most of the relevant discussion, +especially in the threads titled “Reference cycle collection for Python” +and “Finalization again”. + + +File: python.info, Node: Other Core Changes, Next: Porting to 2 0, Prev: Garbage Collection of Cycles, Up: What’s New in Python 2 0 + +1.22.9 Other Core Changes +------------------------- + +Various minor changes have been made to Python’s syntax and built-in +functions. None of the changes are very far-reaching, but they’re handy +conveniences. + +* Menu: + +* Minor Language Changes:: +* Changes to Built-in Functions:: + + +File: python.info, Node: Minor Language Changes, Next: Changes to Built-in Functions, Up: Other Core Changes + +1.22.9.1 Minor Language Changes +............................... + +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" + +Modules can now be renamed on importing them, using the syntax ‘import +module as name’ or ‘from module import name as othername’. The patch +was submitted by Thomas Wouters. + +A new format style is available when using the ‘%’ operator; ‘%r’ will +insert the *note repr(): 7f9. of its argument. This was also added from +symmetry considerations, this time for symmetry with the existing ‘%s’ +format style, which inserts the *note str(): 447. of its argument. For +example, ‘'%r %s' % ('abc', 'abc')’ returns a string containing ‘'abc' +abc’. + +Previously there was no way to implement a class that overrode Python’s +built-in *note in: 2ee. 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: 14ff. 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. + +Earlier versions of Python used a recursive algorithm for deleting +objects. Deeply nested data structures could cause the interpreter to +fill up the C stack and crash; Christian Tismer rewrote the deletion +logic to fix this problem. On a related note, comparing recursive +objects recursed infinitely and crashed; Jeremy Hylton rewrote the code +to no longer crash, producing a useful result instead. For example, +after this code: + + 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. + +An attempt has been made to alleviate one of Python’s warts, the +often-confusing *note NameError: 43a. exception when code refers to a +local variable before the variable has been assigned a value. For +example, the following code raises an exception on the ‘print’ statement +in both 1.5.2 and 2.0; in 1.5.2 a *note NameError: 43a. exception is +raised, while 2.0 raises a new *note UnboundLocalError: 1500. exception. +*note UnboundLocalError: 1500. is a subclass of *note NameError: 43a, so +any existing code that expects *note NameError: 43a. to be raised should +still work. + + def f(): + print "i=",i + i = i + 1 + f() + +Two new exceptions, *note TabError: 540. and *note IndentationError: +7a3, have been introduced. They’re both subclasses of *note +SyntaxError: 18d, and are raised when Python code is found to be +improperly indented. + + +File: python.info, Node: Changes to Built-in Functions, Prev: Minor Language Changes, Up: Other Core Changes + +1.22.9.2 Changes to Built-in Functions +...................................... + +A new built-in, ‘zip(seq1, seq2, ...)’, has been added. *note zip(): +7cb. returns a list of tuples where each tuple contains the i-th element +from each of the argument sequences. The difference between *note +zip(): 7cb. and ‘map(None, seq1, seq2)’ is that *note map(): 860. pads +the sequences with ‘None’ if the sequences aren’t all of the same +length, while *note zip(): 7cb. truncates the returned list to the +length of the shortest argument sequence. + +The *note int(): 259. 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: 534. exception with the message “can’t convert +non-string with explicit base”. + +A new variable holding more detailed version information has been added +to the *note sys: d9. module. ‘sys.version_info’ is a tuple ‘(major, +minor, micro, level, serial)’ For example, in a hypothetical 2.0.1beta1, +‘sys.version_info’ would be ‘(2, 0, 1, 'beta', 1)’. 'level' is a string +such as ‘"alpha"’, ‘"beta"’, or ‘"final"’ for a final release. + +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] + +can be reduced to a single ‘return dict.setdefault(key, [])’ statement. + +The interpreter sets a maximum recursion depth in order to catch runaway +recursion before filling the C stack and causing a core dump or GPF.. +Previously this limit was fixed when you compiled Python, but in 2.0 the +maximum recursion depth can be read and modified using *note +sys.getrecursionlimit(): 4c0. and *note sys.setrecursionlimit(): 4bf. +The default value is 1000, and a rough maximum value for a given +platform can be found by running a new script, +‘Misc/find_recursionlimit.py’. + + +File: python.info, Node: Porting to 2 0, Next: Extending/Embedding Changes, Prev: Other Core Changes, Up: What’s New in Python 2 0 + +1.22.10 Porting to 2.0 +---------------------- + +New Python releases try hard to be compatible with previous releases, +and the record has been pretty good. However, some changes are +considered useful enough, usually because they fix initial design +decisions that turned out to be actively mistaken, that breaking +backward compatibility can’t always be avoided. This section lists the +changes in Python 2.0 that may cause old Python code to break. + +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 ‘append()’ and ‘insert()’. 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: 534. 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(): 56e, 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. + +Some of the functions in the *note socket: cc. module are still +forgiving in this way. For example, ‘socket.connect( ('hostname', 25) +)’ is the correct form, passing a tuple representing an IP address, but +‘socket.connect('hostname', 25)’ also works. *note socket.connect_ex: +1503. and *note socket.bind: 1504. are similarly easy-going. 2.0alpha1 +tightened these functions up, but because the documentation actually +used the erroneous multiple argument form, many people wrote code which +would break with the stricter checking. GvR backed out the changes in +the face of public reaction, so for the *note socket: cc. module, the +documentation was fixed and the multiple argument form is simply marked +as deprecated; it 'will' be tightened up again in a future Python +version. + +The ‘\x’ escape in string literals now takes exactly 2 hex digits. +Previously it would consume all the hex digits following the ‘x’ and +take the lowest 8 bits of the result, so ‘\x123456’ was equivalent to +‘\x56’. + +The *note AttributeError: 348. and *note NameError: 43a. exceptions have +a more friendly error message, whose text will be something like ‘'Spam' +instance has no attribute 'eggs'’ or ‘name 'eggs' is not defined’. +Previously the error message was just the missing attribute name ‘eggs’, +and code written to take advantage of this fact will break in 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: 534. 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’. + +The subtlest long integer change of all is that the *note str(): 447. of +a long integer no longer has a trailing ‘L’ character, though *note +repr(): 7f9. still includes it. The ‘L’ annoyed many people who wanted +to print long integers that looked just like regular integers, since +they had to go out of their way to chop off the character. This is no +longer a problem in 2.0, but code which does ‘str(longval)[:-1]’ and +assumes the ‘L’ is there, will now lose the final digit. + +Taking the *note repr(): 7f9. of a float now uses a different formatting +precision than *note str(): 447. *note repr(): 7f9. uses ‘%.17g’ format +string for C’s ‘sprintf()’, while *note str(): 447. uses ‘%.12g’ as +before. The effect is that *note repr(): 7f9. may occasionally show +more decimal places than *note str(): 447, 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: Extending/Embedding Changes, Next: Distutils Making Modules Easy to Install, Prev: Porting to 2 0, Up: What’s New in Python 2 0 + +1.22.11 Extending/Embedding Changes +----------------------------------- + +Some of the changes are under the covers, and will only be apparent to +people writing C extension modules or embedding a Python interpreter in +a larger application. If you aren’t dealing with Python’s C API, you +can safely skip this section. + +The version number of the Python C API was incremented, so C extensions +compiled for 1.5.2 must be recompiled in order to work with 2.0. On +Windows, it’s not possible for Python 2.0 to import a third party +extension built for Python 1.5.x due to how Windows DLLs work, so Python +will raise an exception and the import will fail. + +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(): 43d. and *note issubclass(): 7bc. 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)’. + +The ‘Python/importdl.c’ file, which was a mass of #ifdefs to support +dynamic loading on many different platforms, was cleaned up and +reorganised by Greg Stein. ‘importdl.c’ is now quite small, and +platform-specific code has been moved into a bunch of +‘Python/dynload_*.c’ files. Another cleanup: there were also a number +of ‘my*.h’ files in the Include/ directory that held various portability +hacks; they’ve been merged into a single file, ‘Include/pyport.h’. + +Vladimir Marangozov’s long-awaited malloc restructuring was completed, +to make it easy to have the Python interpreter use a custom allocator +instead of C’s standard ‘malloc()’. For documentation, read the +comments in ‘Include/pymem.h’ and ‘Include/objimpl.h’. For the lengthy +discussions during which the interface was hammered out, see the web +archives of the ‘patches’ and ‘python-dev’ lists at python.org. + +Recent versions of the GUSI development environment for MacOS support +POSIX threads. Therefore, Python’s POSIX threading support now works on +the Macintosh. Threading support using the user-space GNU ‘pth’ library +was also contributed. + +Threading support on Windows was enhanced, too. Windows supports thread +locks that use kernel objects only in case of contention; in the common +case when there’s no contention, they use simpler functions which are an +order of magnitude faster. A threaded version of Python 1.5.2 on NT is +twice as slow as an unthreaded version; with the 2.0 changes, the +difference is only 10%. These improvements were contributed by Yakov +Markovitch. + +Python 2.0’s source now uses only ANSI C prototypes, so compiling Python +now requires an ANSI C compiler, and can no longer be done using a +compiler that only supports 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(): 361, *note PyModule_AddIntConstant(): 1506, and +*note PyModule_AddStringConstant(): 1507. 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. + +A wrapper API was added for Unix-style signal handlers. *note +PyOS_getsig(): 1508. gets a signal handler and *note PyOS_setsig(): +1509. will set a new handler. + + +File: python.info, Node: Distutils Making Modules Easy to Install, Next: XML Modules, Prev: Extending/Embedding Changes, Up: What’s New in Python 2 0 + +1.22.12 Distutils: Making Modules Easy to Install +------------------------------------------------- + +Before Python 2.0, installing modules was a tedious affair – there was +no way to figure out automatically where Python is installed, or what +compiler options to use for extension modules. Software authors had to +go through an arduous ritual of editing Makefiles and configuration +files, which only really work on Unix and leave Windows and MacOS +unsupported. Python users faced wildly differing installation +instructions which varied between different extension packages, which +made administering a Python installation something of a chore. + +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. + +In order to use the Distutils, you need to write a ‘setup.py’ script. +For the simple case, when the software contains only .py files, a +minimal ‘setup.py’ can be just a few lines long: + + from distutils.core import setup + setup (name = "foo", version = "1.0", + py_modules = ["module1", "module2"]) + +The ‘setup.py’ file isn’t much more complicated if the software consists +of a few packages: + + from distutils.core import setup + setup (name = "foo", version = "1.0", + packages = ["package", "package.subpackage"]) + +A C extension can be the most complicated case; here’s an example taken +from the PyXML package: + + 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 ] ) + +The Distutils can also take care of creating source and binary +distributions. The “sdist” command, run by “‘python setup.py sdist’’, +builds a source distribution such as ‘foo-1.0.tar.gz’. Adding new +commands isn’t difficult, “bdist_rpm” and “bdist_wininst” commands have +already been contributed to create an RPM distribution and a Windows +installer for the software, respectively. Commands to create other +distribution formats such as Debian packages and Solaris ‘.pkg’ files +are in various stages of development. + +All this is documented in a new manual, 'Distributing Python Modules', +that joins the basic set of Python documentation. + + +File: python.info, Node: XML Modules, Next: Module changes, Prev: Distutils Making Modules Easy to Install, Up: What’s New in Python 2 0 + +1.22.13 XML Modules +------------------- + +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: 120. 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 Support:: +* DOM Support:: +* Relationship to PyXML:: + + +File: python.info, Node: SAX2 Support, Next: DOM Support, Up: XML Modules + +1.22.13.1 SAX2 Support +...................... + +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(): 150d. +and *note endElement(): 150e. methods are called for every starting and +end tag encountered by the parser, the *note characters(): 150f. method +is called for every chunk of character data, and so forth. + +The advantage of the event-driven approach is that the whole document +doesn’t have to be resident in memory at any one time, which matters if +you are processing really huge documents. However, writing the SAX +handler class can get very complicated if you’re trying to modify the +document structure in some elaborate way. + +For example, this little example program defines a handler that prints a +message for every starting and ending tag, and then parses the file +‘hamlet.xml’ using it: + + 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 Support, Next: Relationship to PyXML, Prev: SAX2 Support, Up: XML Modules + +1.22.13.2 DOM Support +..................... + +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. + +The DOM is useful for modifying XML documents, because you can create a +DOM tree, modify it by adding new nodes or rearranging subtrees, and +then produce a new XML document as output. You can also construct a DOM +tree manually and convert it to XML, which can be a more flexible way of +producing XML output than simply writing ‘’…‘’ to a file. + +The DOM implementation included with Python lives in the *note +xml.dom.minidom: 122. 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() + +For the 'Hamlet' XML file, the above few lines output: + + CLAUDIUS, king of Denmark. + HAMLET, son to the late, and nephew to the present king. + +The root element of the document is available as ‘doc.documentElement’, +and its children can be easily modified by deleting, adding, or removing +nodes: + + 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: Relationship to PyXML, Prev: DOM Support, Up: XML Modules + +1.22.13.3 Relationship to 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: 120. package. + +The answer is that Python 2.0’s *note xml: 120. package isn’t compatible +with PyXML, but can be made compatible by installing a recent version +PyXML. Many applications can get by with the XML support that is +included with Python 2.0, but more complicated applications will require +that the full PyXML package will be installed. When installed, PyXML +versions 0.6.0 or greater will replace the *note xml: 120. package +shipped with Python, and will be a strict superset of the standard +package, adding a bunch of additional features. Some of the additional +features in PyXML include: + + * 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: Module changes, Next: New modules, Prev: XML Modules, Up: What’s New in Python 2 0 + +1.22.14 Module changes +---------------------- + +Lots of improvements and bugfixes were made to Python’s extensive +standard library; some of the affected modules include *note readline: +ba, *note ConfigParser: 22, ‘cgi’, *note calendar: 14, *note posix: ad, +*note readline: ba, ‘xmllib’, ‘aifc’, ‘chunk’, *note wave: 113, *note +random: b8, *note shelve: c3, and ‘nntplib’. Consult the CVS logs for +the exact patch-by-patch details. + +Brian Gallew contributed OpenSSL support for the *note socket: cc. +module. OpenSSL is an implementation of the Secure Socket Layer, which +encrypts the data being sent over a socket. When compiling Python, you +can edit ‘Modules/Setup’ to include SSL support, which adds an +additional function to the *note socket: cc. module: ‘socket.ssl(socket, +keyfile, certfile)’, which takes a socket object and returns an SSL +socket. The *note httplib: 6e. and *note urllib: 108. modules were also +changed to support ‘https://’ URLs, though no one has implemented FTP or +SMTP over SSL. + +The *note httplib: 6e. 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. + +The *note curses: 2b. module has been greatly extended, starting from +Oliver Andrich’s enhanced version, to provide many additional functions +from ncurses and SYSV curses, such as colour, alternative character set +support, pads, and mouse support. This means the module is no longer +compatible with operating systems that only have BSD curses, but there +don’t seem to be any currently maintained OSes that fall into this +category. + +As mentioned in the earlier discussion of 2.0’s Unicode support, the +underlying implementation of the regular expressions provided by the +*note re: b9. module has been changed. SRE, a new regular expression +engine written by Fredrik Lundh and partially funded by Hewlett Packard, +supports matching against both 8-bit strings and Unicode strings. + + +File: python.info, Node: New modules, Next: IDLE Improvements, Prev: Module changes, Up: What’s New in Python 2 0 + +1.22.15 New modules +------------------- + +A number of new modules were added. We’ll simply list them with brief +descriptions; consult the 2.0 documentation for the details of a +particular module. + + * *note atexit: c.: For registering functions to be called before the + Python interpreter exits. Code that currently sets ‘sys.exitfunc’ + directly should be changed to use the *note atexit: c. module + instead, importing *note atexit: c. and calling *note + atexit.register(): 87b. with the function to be called on exit. + (Contributed by Skip Montanaro.) + + * *note codecs: 1b, ‘encodings’, *note unicodedata: 105.: Added as + part of the new Unicode support. + + * *note filecmp: 5a.: Supersedes the old ‘cmp’, ‘cmpcache’ and + ‘dircmp’ modules, which have now become deprecated. (Contributed + by Gordon MacMillan and Moshe Zadka.) + + * *note gettext: 63.: This module provides internationalization + (I18N) and localization (L10N) support for Python programs by + providing an interface to the GNU gettext message catalog library. + (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: 90.: An interface to memory-mapped files on both + Windows and Unix. A file’s contents can be mapped directly into + memory, at which point it behaves like a mutable string, so its + contents can be read and modified. They can even be passed to + functions that expect ordinary strings, such as the *note re: b9. + module. (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: 10d.: 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: dd.: A module/script to check Python source code + for ambiguous indentation. (Contributed by Tim Peters.) + + * ‘UserString’: A base class useful for deriving objects that behave + like strings. + + * *note webbrowser: 115.: A module that provides a platform + independent way to launch a web browser on a specific URL. For each + platform, various browsers are tried in a specific order. The user + can alter which browser is launched by setting the 'BROWSER' + environment variable. (Originally inspired by Eric S. Raymond’s + patch to *note urllib: 108. which added similar functionality, but + the final module comes from code originally implemented by Fred + Drake as ‘Tools/idle/BrowserControl.py’, and adapted for the + standard library by Fred.) + + * *note _winreg: 116.: 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: 131.: A module for reading and writing ZIP-format + archives. These are archives produced by ‘PKZIP’ on DOS/Windows or + ‘zip’ on Unix, not to be confused with ‘gzip’-format files (which + are supported by the *note gzip: 67. module) (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 Improvements, Next: Deleted and Deprecated Modules, Prev: New modules, Up: What’s New in Python 2 0 + +1.22.16 IDLE Improvements +------------------------- + +IDLE is the official Python cross-platform IDE, written using Tkinter. +Python 2.0 includes IDLE 0.6, which adds a number of new features and +improvements. A partial list: + + * UI improvements and optimizations, especially in the area of syntax + highlighting and auto-indentation. + + * The class browser now shows more information, such as the top level + functions in a module. + + * Tab width is now a user settable option. When opening an existing + Python file, IDLE automatically detects the indentation + conventions, and adapts. + + * There is now support for calling browsers on various platforms, + used to open the Python documentation in a browser. + + * IDLE now has a command line, which is largely similar to the + vanilla Python interpreter. + + * Call tips were added in many places. + + * IDLE can now be installed as a package. + + * In the editor window, there is now a line/column bar at the bottom. + + * Three new keystroke commands: Check module (‘Alt’-‘F5’), Import + module (‘F5’) and Run script (‘Ctrl’-‘F5’). + + +File: python.info, Node: Deleted and Deprecated Modules, Next: Acknowledgements<8>, Prev: IDLE Improvements, Up: What’s New in Python 2 0 + +1.22.17 Deleted and Deprecated Modules +-------------------------------------- + +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: Acknowledgements<8>, Prev: Deleted and Deprecated Modules, Up: What’s New in Python 2 0 + +1.22.18 Acknowledgements +------------------------ + +The authors would like to thank the following people for offering +suggestions on various drafts of this article: 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. + +The “Changelog” is an HTML version of the file built(1) from the +contents of the Misc/NEWS.d(2) directory tree, which contains 'all' +nontrivial changes to Python for the current version. + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/blurb/ + + (2) https://github.com/python/cpython/tree/3.13/Misc/NEWS.d + + +File: python.info, Node: Changelog, Prev: What’s New in Python 2 0, Up: What’s New in Python + +1.23 Changelog +============== + +* Menu: + +* Python 3.13.7 final: Python 3 13 7 final. +* Python 3.13.6 final: Python 3 13 6 final. +* Python 3.13.5 final: Python 3 13 5 final. +* Python 3.13.4 final: Python 3 13 4 final. +* Python 3.13.3 final: Python 3 13 3 final. +* Python 3.13.2 final: Python 3 13 2 final. +* Python 3.13.1 final: Python 3 13 1 final. +* Python 3.13.0 final: Python 3 13 0 final. +* Python 3.13.0 release candidate 3: Python 3 13 0 release candidate 3. +* Python 3.13.0 release candidate 2: Python 3 13 0 release candidate 2. +* Python 3.13.0 release candidate 1: Python 3 13 0 release candidate 1. +* Python 3.13.0 beta 4: Python 3 13 0 beta 4. +* Python 3.13.0 beta 3: Python 3 13 0 beta 3. +* Python 3.13.0 beta 2: Python 3 13 0 beta 2. +* 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 3 13 7 final, Next: Python 3 13 6 final, Up: Changelog + +1.23.1 Python 3.13.7 final +-------------------------- + +'Release date: 2025-08-14' + +* Menu: + +* Library:: +* Documentation: Documentation<2>. +* Core and Builtins:: + + +File: python.info, Node: Library, Next: Documentation<2>, Up: Python 3 13 7 final + +1.23.1.1 Library +................ + + - gh-137583(1): Fix a deadlock introduced in 3.13.6 when a call to + *note ssl.SSLSocket.recv: da3. was blocked in one thread, and then + another method on the object (such as *note ssl.SSLSocket.send: + da6.) was subsequently called in another thread. + + - gh-137044(2): Return large limit values as positive integers + instead of negative integers in *note resource.getrlimit(): 151b. + Accept large values and reject negative values (except *note + RLIM_INFINITY: 151c.) for limits in *note resource.setrlimit(): + 151d. + + - gh-136914(3): Fix retrieval of *note doctest.DocTest.lineno: 151e. + for objects decorated with *note functools.cache(): 151f. or *note + functools.cached_property: 53e. + + - gh-131788(4): Make ‘ResourceTracker.send’ from *note + multiprocessing: 94. re-entrant safe + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/137583 + + (2) https://github.com/python/cpython/issues/137044 + + (3) https://github.com/python/cpython/issues/136914 + + (4) https://github.com/python/cpython/issues/131788 + + +File: python.info, Node: Documentation<2>, Next: Core and Builtins, Prev: Library, Up: Python 3 13 7 final + +1.23.1.2 Documentation +...................... + + - gh-136155(1): We are now checking for fatal errors in EPUB builds + in CI. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/136155 + + +File: python.info, Node: Core and Builtins, Prev: Documentation<2>, Up: Python 3 13 7 final + +1.23.1.3 Core and Builtins +.......................... + + - gh-137400(1): Fix a crash in the *note free threading: 1522. build + when disabling profiling or tracing across all threads with *note + PyEval_SetProfileAllThreads(): 55c. or *note + PyEval_SetTraceAllThreads(): 41e. or their Python equivalents *note + threading.settrace_all_threads(): 4c4. and *note + threading.setprofile_all_threads(): 4c5. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/137400 + + +File: python.info, Node: Python 3 13 6 final, Next: Python 3 13 5 final, Prev: Python 3 13 7 final, Up: Changelog + +1.23.2 Python 3.13.6 final +-------------------------- + +'Release date: 2025-08-06' + +* Menu: + +* macOS:: +* Windows:: +* Tools/Demos:: +* Tests:: +* Security:: +* Library: Library<2>. +* Documentation: Documentation<3>. +* Core and Builtins: Core and Builtins<2>. +* Build:: + + +File: python.info, Node: macOS, Next: Windows, Up: Python 3 13 6 final + +1.23.2.1 macOS +.............. + + - gh-137450(1): macOS installer shell path management improvements: + separate the installer ‘Shell profile updater’ postinstall script + from the ‘Update Shell Profile.command’ to enable more robust error + handling. + + - gh-137134(2): Update macOS installer to ship with SQLite version + 3.50.4. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/137450 + + (2) https://github.com/python/cpython/issues/137134 + + +File: python.info, Node: Windows, Next: Tools/Demos, Prev: macOS, Up: Python 3 13 6 final + +1.23.2.2 Windows +................ + + - gh-137134(1): Update Windows installer to ship with SQLite 3.50.4. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/137134 + + +File: python.info, Node: Tools/Demos, Next: Tests, Prev: Windows, Up: Python 3 13 6 final + +1.23.2.3 Tools/Demos +.................... + + - gh-135968(1): Stubs for ‘strip’ are now provided as part of an iOS + install. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135968 + + +File: python.info, Node: Tests, Next: Security, Prev: Tools/Demos, Up: Python 3 13 6 final + +1.23.2.4 Tests +.............. + + - gh-135966(1): The iOS testbed now handles the ‘app_packages’ folder + as a site directory. + + - gh-135494(2): Fix regrtest to support excluding tests from ‘--pgo’ + tests. Patch by Victor Stinner. + + - gh-135489(3): Show verbose output for failing tests during PGO + profiling step with –enable-optimizations. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135966 + + (2) https://github.com/python/cpython/issues/135494 + + (3) https://github.com/python/cpython/issues/135489 + + +File: python.info, Node: Security, Next: Library<2>, Prev: Tests, Up: Python 3 13 6 final + +1.23.2.5 Security +................. + + - gh-135661(1): Fix parsing start and end tags in *note + html.parser.HTMLParser: 874. according to the HTML5 standard. + + * Whitespaces no longer accepted between ‘’ 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. ‘’. + + * Multiple slashes and whitespaces between the last attribute + and closing ‘>’ are now ignored in both start and end tags. + E.g. ‘’. + + * Multiple ‘=’ between attribute name and value are no longer + collapsed. E.g. ‘’ produces attribute “foo” with + value “=bar”. + + - gh-102555(2): Fix comment parsing in *note html.parser.HTMLParser: + 874. according to the HTML5 standard. ‘--!>’ now ends the comment. + ‘-- >’ no longer ends the comment. Support abnormally ended empty + comments ‘<-->’ and ‘<--->’. + + - gh-135462(3): Fix quadratic complexity in processing specially + crafted input in *note html.parser.HTMLParser: 874. End-of-file + errors are now handled according to the HTML5 specs – comments and + declarations are automatically closed, tags are ignored. + + - gh-118350(4): Fix support of escapable raw text mode (elements + “textarea” and “title”) in *note html.parser.HTMLParser: 874. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135661 + + (2) https://github.com/python/cpython/issues/102555 + + (3) https://github.com/python/cpython/issues/135462 + + (4) https://github.com/python/cpython/issues/118350 + + +File: python.info, Node: Library<2>, Next: Documentation<3>, Prev: Security, Up: Python 3 13 6 final + +1.23.2.6 Library +................ + + - gh-132710(1): If possible, ensure that *note uuid.getnode(): ba7. + 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-137273(2): Fix debug assertion failure in *note + locale.setlocale(): 2df. on Windows. + + - gh-137257(3): Bump the version of pip bundled in ensurepip to + version 25.2 + + - gh-81325(4): *note tarfile.TarFile: 1202. now accepts a *note + path-like: 2a2. when working on a tar archive. (Contributed by + Alexander Enrique Urieles Nieto in gh-81325(5).) + + - gh-130522(6): Fix unraisable *note TypeError: 534. raised during + *note interpreter shutdown: 14e. in the *note threading: ed. + module. + + - gh-130577(7): *note tarfile: de. now validates archives to ensure + member offsets are non-negative. (Contributed by Alexander Enrique + Urieles Nieto in gh-130577(8).) + + - gh-136549(9): Fix signature of *note threading.excepthook(): 847. + + - gh-136523(10): Fix *note wave.Wave_write: 2b9. emitting an + unraisable when open raises. + + - gh-52876(11): Add missing ‘keepends’ (default ‘True’) parameter to + ‘codecs.StreamReaderWriter.readline()’ and + ‘codecs.StreamReaderWriter.readlines()’. + + - gh-85702(12): If ‘zoneinfo._common.load_tzdata’ is given a package + without a resource a *note zoneinfo.ZoneInfoNotFoundError: 152a. is + raised rather than a *note PermissionError: d42. Patch by Victor + Stinner. + + - gh-134759(13): Fix *note UnboundLocalError: 1500. in *note + email.message.Message.get_payload(): 11bf. when the payload to + decode is a *note bytes: 1c2. object. Patch by Kliment Lamonov. + + - gh-136028(14): Fix parsing month names containing “İ” (U+0130, + LATIN CAPITAL LETTER I WITH DOT ABOVE) in *note time.strptime(): + 13f8. This affects locales az_AZ, ber_DZ, ber_MA and crh_UA. + + - gh-135995(15): In the palmos encoding, make byte ‘0x9b’ decode to + ‘›’ (U+203A - SINGLE RIGHT-POINTING ANGLE QUOTATION MARK). + + - gh-53203(16): Fix *note time.strptime(): 13f8. for ‘%c’ and ‘%x’ + formats on locales byn_ER, wal_ET and lzh_TW, and for ‘%X’ format + on locales ar_SA, bg_BG and lzh_TW. + + - gh-91555(17): An earlier change, which was introduced in 3.13.4, + has been reverted. It disabled logging for a logger during + handling of log messages for that logger. Since the reversion, the + behaviour should be as it was before 3.13.4. + + - gh-135878(18): Fixes a crash of *note types.SimpleNamespace: 1d1. + on *note free threading: 1522. builds, when several threads were + calling its *note __repr__(): 618. method at the same time. + + - gh-135836(19): Fix *note IndexError: 14ff. in *note + asyncio.loop.create_connection(): 5ff. that could occur when + non-*note OSError: 413. exception is raised during connection and + socket’s ‘close()’ raises ‘OSError’. + + - gh-135836(20): Fix *note IndexError: 14ff. in *note + asyncio.loop.create_connection(): 5ff. that could occur when the + Happy Eyeballs algorithm resulted in an empty exceptions list + during connection attempts. + + - gh-135855(21): Raise *note TypeError: 534. instead of *note + SystemError: 572. when ‘_interpreters.set___main___attrs()’ is + passed a non-dict object. Patch by Brian Schubert. + + - gh-135815(22): *note netrc: 9b.: skip security checks if *note + os.getuid(): 152b. is missing. Patch by Bénédikt Tran. + + - gh-135640(23): Address bug where it was possible to call *note + xml.etree.ElementTree.ElementTree.write(): ff0. on an ElementTree + object with an invalid root element. This behavior blanked the + file passed to ‘write’ if it already existed. + + - gh-135444(24): Fix *note asyncio.DatagramTransport.sendto(): 1af. + to account for datagram header size when data cannot be sent. + + - gh-135497(25): Fix *note os.getlogin(): 152c. failing for longer + usernames on BSD-based platforms. + + - gh-135487(26): Fix ‘reprlib.Repr.repr_int()’ when given integers + with more than *note sys.get_int_max_str_digits(): 152d. digits. + Patch by Bénédikt Tran. + + - gh-135335(27): *note multiprocessing: 94.: Flush ‘stdout’ and + ‘stderr’ after preloading modules in the ‘forkserver’. + + - gh-135244(28): *note uuid: 110.: 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(29). This affects *note uuid1(): ba8. + + - gh-135069(30): Fix the “Invalid error handling” exception in + ‘encodings.idna.IncrementalDecoder’ to correctly replace the + ‘errors’ parameter. + + - gh-134698(31): Fix a crash when calling methods of *note + ssl.SSLContext: 296. or *note ssl.SSLSocket: 8e9. across multiple + threads. + + - gh-132124(32): 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 'forkserver' start method. Patch by Bénédikt Tran. + + - gh-133439(33): Fix dot commands with trailing spaces are mistaken + for multi-line SQL statements in the sqlite3 command-line + interface. + + - gh-132969(34): Prevent the *note ProcessPoolExecutor: 8ed. executor + thread, which remains running when *note shutdown(wait=False): 8ec, + 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-130664(35): Support the ‘'_'’ digit separator in formatting of + the integral part of *note Decimal: 29f.’s. Patch by Sergey B + Kirpichev. + + - gh-85702(36): If ‘zoneinfo._common.load_tzdata’ is given a package + without a resource a ‘ZoneInfoNotFoundError’ is raised rather than + a *note IsADirectoryError: 1052. + + - gh-130664(37): Handle corner-case for *note Fraction: 1e9.’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: + 2f1.’s. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/132710 + + (2) https://github.com/python/cpython/issues/137273 + + (3) https://github.com/python/cpython/issues/137257 + + (4) https://github.com/python/cpython/issues/81325 + + (5) https://github.com/python/cpython/issues/81325 + + (6) https://github.com/python/cpython/issues/130522 + + (7) https://github.com/python/cpython/issues/130577 + + (8) https://github.com/python/cpython/issues/130577 + + (9) https://github.com/python/cpython/issues/136549 + + (10) https://github.com/python/cpython/issues/136523 + + (11) https://github.com/python/cpython/issues/52876 + + (12) https://github.com/python/cpython/issues/85702 + + (13) https://github.com/python/cpython/issues/134759 + + (14) https://github.com/python/cpython/issues/136028 + + (15) https://github.com/python/cpython/issues/135995 + + (16) https://github.com/python/cpython/issues/53203 + + (17) https://github.com/python/cpython/issues/91555 + + (18) https://github.com/python/cpython/issues/135878 + + (19) https://github.com/python/cpython/issues/135836 + + (20) https://github.com/python/cpython/issues/135836 + + (21) https://github.com/python/cpython/issues/135855 + + (22) https://github.com/python/cpython/issues/135815 + + (23) https://github.com/python/cpython/issues/135640 + + (24) https://github.com/python/cpython/issues/135444 + + (25) https://github.com/python/cpython/issues/135497 + + (26) https://github.com/python/cpython/issues/135487 + + (27) https://github.com/python/cpython/issues/135335 + + (28) https://github.com/python/cpython/issues/135244 + + (29) +https://datatracker.ietf.org/doc/html/rfc9562.html#section-6.10-3 + + (30) https://github.com/python/cpython/issues/135069 + + (31) https://github.com/python/cpython/issues/134698 + + (32) https://github.com/python/cpython/issues/132124 + + (33) https://github.com/python/cpython/issues/133439 + + (34) https://github.com/python/cpython/issues/132969 + + (35) https://github.com/python/cpython/issues/130664 + + (36) https://github.com/python/cpython/issues/85702 + + (37) https://github.com/python/cpython/issues/130664 + + +File: python.info, Node: Documentation<3>, Next: Core and Builtins<2>, Prev: Library<2>, Up: Python 3 13 6 final + +1.23.2.7 Documentation +...................... + + - gh-135171(1): Document that the *note iterator: 1ac. for the + leftmost ‘for’ clause in the generator expression is created + immediately. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135171 + + +File: python.info, Node: Core and Builtins<2>, Next: Build, Prev: Documentation<3>, Up: Python 3 13 6 final + +1.23.2.8 Core and Builtins +.......................... + + - gh-58124(1): 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-137314(2): Fixed a regression where raw f-strings incorrectly + interpreted escape sequences in format specifications. Raw + f-strings now properly preserve literal backslashes in format + specs, matching the behavior from Python 3.11. For example, + ‘rf"{obj:\xFF}"’ now correctly produces ‘'\\xFF'’ instead of ‘'ÿ'’. + Patch by Pablo Galindo. + + - gh-136541(3): Fix some issues with the perf trampolines on x86-64 + and aarch64. The trampolines were not being generated correctly + for some cases, which could lead to the perf integration not + working correctly. Patch by Pablo Galindo. + + - gh-109700(4): Fix memory error handling in *note + PyDict_SetDefault(): 33b. + + - gh-78465(5): Fix error message for ‘cls.__new__(cls, ...)’ where + ‘cls’ is not instantiable builtin or extension type (with ‘tp_new’ + set to ‘NULL’). + + - gh-135871(6): Non-blocking mutex lock attempts now return + immediately when the lock is busy instead of briefly spinning in + the *note free threading: 1522. build. + + - gh-135607(7): Fix potential *note weakref: 114. races in an + object’s destructor on the *note free threaded: 1522. build. + + - gh-135496(8): Fix typo in the f-string conversion type error + (“exclamanation” -> “exclamation”). + + - gh-130077(9): Properly raise custom syntax errors when incorrect + syntax containing names that are prefixes of soft keywords is + encountered. Patch by Pablo Galindo. + + - gh-135148(10): Fixed a bug where f-string debug expressions (using + =) would incorrectly strip out parts of strings containing escaped + quotes and # characters. Patch by Pablo Galindo. + + - gh-133136(11): Limit excess memory usage in the *note free + threading: 1522. build when a large dictionary or list is resized + and accessed by multiple threads. + + - gh-132617(12): Fix *note dict.update(): 142e. 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-91153(13): Fix a crash when a *note bytearray: 53a. is + concurrently mutated during item assignment. + + - gh-127971(14): Fix off-by-one read beyond the end of a string in + string search. + + - gh-125723(15): 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/58124 + + (2) https://github.com/python/cpython/issues/137314 + + (3) https://github.com/python/cpython/issues/136541 + + (4) https://github.com/python/cpython/issues/109700 + + (5) https://github.com/python/cpython/issues/78465 + + (6) https://github.com/python/cpython/issues/135871 + + (7) https://github.com/python/cpython/issues/135607 + + (8) https://github.com/python/cpython/issues/135496 + + (9) https://github.com/python/cpython/issues/130077 + + (10) https://github.com/python/cpython/issues/135148 + + (11) https://github.com/python/cpython/issues/133136 + + (12) https://github.com/python/cpython/issues/132617 + + (13) https://github.com/python/cpython/issues/91153 + + (14) https://github.com/python/cpython/issues/127971 + + (15) https://github.com/python/cpython/issues/125723 + + +File: python.info, Node: Build, Prev: Core and Builtins<2>, Up: Python 3 13 6 final + +1.23.2.9 Build +.............. + + - gh-135497(1): Fix the detection of ‘MAXLOGNAME’ in the + ‘configure.ac’ script. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135497 + + +File: python.info, Node: Python 3 13 5 final, Next: Python 3 13 4 final, Prev: Python 3 13 6 final, Up: Changelog + +1.23.3 Python 3.13.5 final +-------------------------- + +'Release date: 2025-06-11' + +* Menu: + +* Windows: Windows<2>. +* Tests: Tests<2>. +* Library: Library<3>. +* Core and Builtins: Core and Builtins<3>. +* C API:: + + +File: python.info, Node: Windows<2>, Next: Tests<2>, Up: Python 3 13 5 final + +1.23.3.1 Windows +................ + + - gh-135151(1): Avoid distributing modified ‘pyconfig.h’ in the + traditional installer. Extension module builds must always specify + ‘Py_GIL_DISABLED’ when targeting the free-threaded runtime. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135151 + + +File: python.info, Node: Tests<2>, Next: Library<3>, Prev: Windows<2>, Up: Python 3 13 5 final + +1.23.3.2 Tests +.............. + + - gh-135120(1): Add ‘test.support.subTests()’. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135120 + + +File: python.info, Node: Library<3>, Next: Core and Builtins<3>, Prev: Tests<2>, Up: Python 3 13 5 final + +1.23.3.3 Library +................ + + - gh-133967(1): Do not normalize *note locale: 86. name ‘C.UTF-8’ to + ‘en_US.UTF-8’. + + - gh-135326(2): Restore support of integer-like objects with + ‘__index__()’ in *note random.getrandbits(): 1006. + + - gh-135321(3): Raise a correct exception for values greater than + 0x7fffffff for the ‘BINSTRING’ opcode in the C implementation of + *note pickle: a6. + + - gh-135276(4): Backported bugfixes in zipfile.Path from zipp 3.23. + Fixed ‘.name’, ‘.stem’ and other basename-based properties on + Windows when working with a zipfile on disk. + + - gh-134151(5): *note email: 3b.: Fix *note TypeError: 534. in *note + email.utils.decode_params(): 1535. when sorting RFC 2231(6) + continuations that contain an unnumbered section. + + - gh-134152(7): *note email: 3b.: Fix parsing of email message ID + with invalid domain. + + - gh-127081(8): Fix libc thread safety issues with *note os: a1. by + replacing ‘getlogin’ with ‘getlogin_r’ re-entrant version. + + - gh-131884(9): Fix formatting issues in *note json.dump(): d44. when + both 'indent' and 'skipkeys' are used. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/133967 + + (2) https://github.com/python/cpython/issues/135326 + + (3) https://github.com/python/cpython/issues/135321 + + (4) https://github.com/python/cpython/issues/135276 + + (5) https://github.com/python/cpython/issues/134151 + + (6) https://datatracker.ietf.org/doc/html/rfc2231.html + + (7) https://github.com/python/cpython/issues/134152 + + (8) https://github.com/python/cpython/issues/127081 + + (9) https://github.com/python/cpython/issues/131884 + + +File: python.info, Node: Core and Builtins<3>, Next: C API, Prev: Library<3>, Up: Python 3 13 5 final + +1.23.3.4 Core and Builtins +.......................... + + - gh-135171(1): Roll back changes to generator and list + comprehensions that went into 3.13.4 to fix gh-127682(2), but which + involved semantic and bytecode changes not appropriate for a bugfix + release. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135171 + + (2) https://github.com/python/cpython/issues/127682 + + +File: python.info, Node: C API, Prev: Core and Builtins<3>, Up: Python 3 13 5 final + +1.23.3.5 C API +.............. + + - gh-134989(1): Fix ‘Py_RETURN_NONE’, ‘Py_RETURN_TRUE’ and + ‘Py_RETURN_FALSE’ macros in the limited C API 3.11 and older: don’t + treat ‘Py_None’, ‘Py_True’ and ‘Py_False’ as immortal. Patch by + Victor Stinner. + + - gh-134989(2): Implement *note PyObject_DelAttr(): 1538. and *note + PyObject_DelAttrString(): 1539. as macros in the limited C API 3.12 + and older. Patch by Victor Stinner. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/134989 + + (2) https://github.com/python/cpython/issues/134989 + + +File: python.info, Node: Python 3 13 4 final, Next: Python 3 13 3 final, Prev: Python 3 13 5 final, Up: Changelog + +1.23.4 Python 3.13.4 final +-------------------------- + +'Release date: 2025-06-03' + +* Menu: + +* Windows: Windows<3>. +* Tests: Tests<3>. +* Security: Security<2>. +* Library: Library<4>. +* IDLE: IDLE<3>. +* Documentation: Documentation<4>. +* Core and Builtins: Core and Builtins<4>. +* C API: C API<2>. +* Build: Build<2>. + + +File: python.info, Node: Windows<3>, Next: Tests<3>, Up: Python 3 13 4 final + +1.23.4.1 Windows +................ + + - gh-130727(1): Fix a race in internal calls into WMI that can result + in an “invalid handle” exception under high load. Patch by Chris + Eibl. + + - gh-76023(2): Make *note os.path.realpath(): 227. ignore Windows + error 1005 when in non-strict mode. + + - gh-133626(3): Ensures packages are not accidentally bundled into + the traditional installer. + + - gh-133512(4): Add warnings to *note Python Launcher for Windows: + 5ba. about use of subcommands belonging to the Python install + manager. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/130727 + + (2) https://github.com/python/cpython/issues/76023 + + (3) https://github.com/python/cpython/issues/133626 + + (4) https://github.com/python/cpython/issues/133512 + + +File: python.info, Node: Tests<3>, Next: Security<2>, Prev: Windows<3>, Up: Python 3 13 4 final + +1.23.4.2 Tests +.............. + + - gh-133744(1): Fix multiprocessing interrupt test. Add an event to + synchronize the parent process with the child process: wait until + the child process starts sleeping. Patch by Victor Stinner. + + - gh-133639(2): Fix ‘TestPyReplAutoindent.test_auto_indent_default()’ + doesn’t run ‘input_code’. + + - gh-133131(3): The iOS testbed will now select the most recently + released “SE-class” device for testing if a device isn’t explicitly + specified. + + - gh-109981(4): 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. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/133744 + + (2) https://github.com/python/cpython/issues/133639 + + (3) https://github.com/python/cpython/issues/133131 + + (4) https://github.com/python/cpython/issues/109981 + + +File: python.info, Node: Security<2>, Next: Library<4>, Prev: Tests<3>, Up: Python 3 13 4 final + +1.23.4.3 Security +................. + + - gh-135034(1): 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(2), CVE 2025-4138(3), CVE 2025-4330(4), + and CVE 2025-4517(5). + + - gh-133767(6): Fix use-after-free in the “unicode-escape” decoder + with a non-“strict” error handler. + + - gh-128840(7): Short-circuit the processing of long IPv6 addresses + early in *note ipaddress: 80. to prevent excessive memory + consumption and a minor denial-of-service. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/135034 + + (2) https://www.cve.org/CVERecord?id=CVE-2024-12718 + + (3) https://www.cve.org/CVERecord?id=CVE-2025-4138 + + (4) https://www.cve.org/CVERecord?id=CVE-2025-4330 + + (5) https://www.cve.org/CVERecord?id=CVE-2025-4517 + + (6) https://github.com/python/cpython/issues/133767 + + (7) https://github.com/python/cpython/issues/128840 + + +File: python.info, Node: Library<4>, Next: IDLE<3>, Prev: Security<2>, Up: Python 3 13 4 final + +1.23.4.4 Library +................ + + - gh-134718(1): *note ast.dump(): 8e3. now only omits ‘None’ and ‘[]’ + values if they are default values. + + - gh-128840(2): Fix parsing long IPv6 addresses with embedded IPv4 + address. + + - gh-134696(3): Built-in HACL* and OpenSSL implementations of hash + function constructors now correctly accept the same 'documented' + named arguments. For instance, *note md5(): 153f. 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-134210(4): *note curses.window.getch(): 1540. now correctly + handles signals. Patch by Bénédikt Tran. + + - gh-80334(5): *note multiprocessing.freeze_support(): 1541. now + checks for work on any “spawn” start method platform rather than + only on Windows. + + - gh-114177(6): Fix *note asyncio: a. to not close subprocess pipes + which would otherwise error out when the event loop is already + closed. + + - gh-134152(7): Fixed *note UnboundLocalError: 1500. that could occur + during *note email: 3b. header parsing if an expected trailing + delimiter is missing in some contexts. + + - gh-62184(8): Remove import of C implementation of *note io.FileIO: + 1303. from Python implementation which has its own implementation + + - gh-133982(9): Emit *note RuntimeWarning: 1bd. in the Python + implementation of *note io: 7f. when the *note file-like object: + 11b5. is not closed explicitly in the presence of multiple I/O + layers. + + - gh-133890(10): The *note tarfile: de. module now handles *note + UnicodeEncodeError: 673. in the same way as *note OSError: 413. + when cannot extract a member. + + - gh-134097(11): Fix interaction of the new *note REPL: 16a. and + *note -X showrefcount: 176. command line option. + + - gh-133889(12): The generated directory listing page in *note + http.server.SimpleHTTPRequestHandler: b43. now only shows the + decoded path component of the requested URL, and not the query and + fragment. + + - gh-134098(13): Fix handling paths that end with a percent-encoded + slash (‘%2f’ or ‘%2F’) in *note + http.server.SimpleHTTPRequestHandler: b43. + + - gh-134062(14): *note ipaddress: 80.: fix collisions in *note + __hash__(): afb. for *note IPv4Network: 200. and *note IPv6Network: + 201. objects. + + - gh-133745(15): In 3.13.3 we accidentally changed the signature of + the asyncio ‘create_task()’ family of methods and how it calls a + custom task factory in a backwards incompatible way. Since some + 3rd party libraries have already made changes to work around the + issue that might break if we simply reverted the changes, we’re + instead changing things to be backwards compatible with 3.13.2 + while still supporting those workarounds for 3.13.3. In + particular, the special-casing of ‘name’ and ‘context’ is back + (until 3.14) and consequently eager tasks may still find that their + name hasn’t been set before they execute their first yielding + await. + + - gh-71253(16): Raise *note ValueError: 204. in *note open(): 517. if + 'opener' returns a negative file-descriptor in the Python + implementation of *note io: 7f. to match the C implementation. + + - gh-77057(17): Fix handling of invalid markup declarations in *note + html.parser.HTMLParser: 874. + + - gh-133489(18): *note random.getrandbits(): 1006. can now generate + more that 2^31 bits. *note random.randbytes(): 1542. can now + generate more that 256 MiB. + + - gh-133290(19): Fix attribute caching issue when setting *note + ctypes._Pointer._type_: 1543. in the undocumented and deprecated + ‘ctypes.SetPointerType()’ function and the undocumented + ‘set_type()’ method. + + - gh-132876(20): ‘ldexp()’ on Windows doesn’t round subnormal results + before Windows 11, but should. Python’s *note math.ldexp(): 1544. + wrapper now does round them, so results may change slightly, in + rare cases of very small results, on Windows versions before 11. + + - gh-133089(21): Use original timeout value for *note + subprocess.TimeoutExpired: 1545. when the func *note + subprocess.run(): b86. is called with a timeout instead of + sometimes a confusing partial remaining time out value used + internally on the final ‘wait()’. + + - gh-133009(22): *note xml.etree.ElementTree: 125.: Fix a crash in + *note Element.__deepcopy__: 1546. when the element is concurrently + mutated. Patch by Bénédikt Tran. + + - gh-132995(23): Bump the version of pip bundled in ensurepip to + version 25.1.1 + + - gh-132017(24): Fix error when ‘pyrepl’ is suspended, then resumed + and terminated. + + - gh-132673(25): Fix a crash when using ‘_align_ = 0’ and ‘_fields_ = + []’ in a *note ctypes.Structure: 1d4. + + - gh-132527(26): Include the valid typecode ‘w’ in the error message + when an invalid typecode is passed to *note array.array: 1a0. + + - gh-132439(27): Fix ‘PyREPL’ on Windows: characters entered via + AltGr are swallowed. Patch by Chris Eibl. + + - gh-132429(28): Fix support of Bluetooth sockets on NetBSD and + DragonFly BSD. + + - gh-132106(29): *note QueueListener.start: 1547. now raises a *note + RuntimeError: 195. if the listener is already started. + + - gh-132417(30): Fix a ‘NULL’ pointer dereference when a C function + called using *note ctypes: 2a. with ‘restype’ *note py_object: + 1403. returns ‘NULL’. + + - gh-132385(31): Fix instance error suggestions trigger potential + exceptions in *note object.__getattr__(): 4cf. in *note traceback: + fe. + + - gh-132308(32): A *note traceback.TracebackException: 25e. now + correctly renders the ‘__context__’ and ‘__cause__’ attributes from + *note falsey: 1548. *note Exception: 9d9, and the ‘exceptions’ + attribute from falsey *note ExceptionGroup: 1b6. + + - gh-132250(33): Fixed the *note SystemError: 572. in *note cProfile: + 27. when locating the actual C function of a method raises an + exception. + + - gh-132063(34): 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: 8ed. and *note + concurrent.futures.ThreadPoolExecutor: 73d. + + - gh-119605(35): Respect ‘follow_wrapped’ for ‘__init__()’ and + ‘__new__()’ methods when getting the class signature for a class + with *note inspect.signature(): 733. Preserve class signature + after wrapping with *note warnings.deprecated(): 160. Patch by + Xuehai Pan. + + - gh-91555(36): Ignore log messages generated during handling of log + messages, to avoid deadlock or infinite recursion. [NOTE: This + change has since been reverted.] + + - gh-131434(37): Improve error reporting for incorrect format in + *note time.strptime(): 13f8. + + - gh-131127(38): Systems using LibreSSL now successfully build. + + - gh-130999(39): Avoid exiting the new REPL and offer suggestions + even if there are non-string candidates when errors occur. + + - gh-130941(40): Fix *note configparser.ConfigParser: 1c8. parsing + empty interpolation with ‘allow_no_value’ set to ‘True’. + + - gh-129098(41): Fix REPL traceback reporting when using *note + compile(): 192. with an inexisting file. Patch by Bénédikt Tran. + + - gh-130631(42): ‘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-129719(43): Fix missing ‘socket.CAN_RAW_ERR_FILTER’ constant in + the socket module on Linux systems. It was missing since Python + 3.11. + + - gh-124096(44): 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-122559(45): Remove ‘__reduce__()’ and ‘__reduce_ex__()’ methods + that always raise *note TypeError: 534. in the C implementation of + *note io.FileIO: 1303, *note io.BufferedReader: 1200, *note + io.BufferedWriter: 1549. and *note io.BufferedRandom: 154a. 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(46): *note hashlib.file_digest(): 640. now raises *note + BlockingIOError: 1050. when no data is available during + non-blocking I/O. Before, it added spurious null bytes to the + digest. + + - gh-86155(47): *note html.parser.HTMLParser.close(): 154b. no longer + loses data when the ‘’ and + ‘’). + + -- Method: HTMLParser.handle_entityref (name) + + This method is called to process a named character reference of the + form ‘&name;’ (e.g. ‘>’), where 'name' is a general entity + reference (e.g. ‘'gt'’). This method is never called if + 'convert_charrefs' is ‘True’. + + -- Method: 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 ‘>’ is ‘>’, whereas the + hexadecimal is ‘>’; in this case the method will receive + ‘'62'’ or ‘'x3E'’. This method is never called if + 'convert_charrefs' is ‘True’. + + -- Method: HTMLParser.handle_comment (data) + + This method is called when a comment is encountered (e.g. + ‘’). + + For example, the comment ‘’ will cause this method + to be called with the argument ‘' comment '’. + + The content of Internet Explorer conditional comments (condcoms) + will also be sent to this method, so, for ‘’, this method will receive + ‘'[if IE 9]>IE9-specific content’). + + The 'decl' parameter will be the entire contents of the declaration + inside the ‘’ markup (e.g. ‘'DOCTYPE html'’). + + -- Method: HTMLParser.handle_pi (data) + + Method called when a processing instruction is encountered. The + 'data' parameter will contain the entire processing instruction. + For example, for the processing instruction ‘’, + this method would be called as ‘handle_pi("proc color='red'")’. It + is intended to be overridden by a derived class; the base class + implementation does nothing. + + Note: The *note HTMLParser: 874. class uses the SGML syntactic + rules for processing instructions. An XHTML processing + instruction using the trailing ‘'?'’ will cause the ‘'?'’ to + be included in 'data'. + + -- Method: HTMLParser.unknown_decl (data) + + This method is called when an unrecognized declaration is read by + the parser. + + The 'data' parameter will be the entire contents of the declaration + inside the ‘’ markup. It is sometimes useful to be + overridden by a derived class. The base class implementation does + nothing. + + +File: python.info, Node: Examples<24>, Prev: HTMLParser Methods, Up: html parser — Simple HTML and XHTML parser + +5.21.2.3 Examples +................. + +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('') + 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('The Python logo') + Start tag: img + attr: ('src', 'python-logo.png') + attr: ('alt', 'The Python logo') + >>> + >>> parser.feed('

Python

') + Start tag: h1 + Data : Python + End tag : h1 + +The content of ‘script’ and ‘style’ elements is returned as is, without +further parsing: + + >>> parser.feed('') + Start tag: style + attr: ('type', 'text/css') + Data : #python { color: green } + End tag : style + + >>> parser.feed('') + Start tag: script + attr: ('type', 'text/javascript') + Data : alert("hello!"); + End tag : script + +Parsing comments: + + >>> parser.feed('' + ... '') + Comment : a comment + Comment : [if IE 9]>IE-specific content'’): + + >>> parser = MyHTMLParser() + >>> parser.feed('>>>') + Data : >>> + + >>> parser = MyHTMLParser(convert_charrefs=False) + >>> parser.feed('>>>') + Named ent: > + Num ent : > + Num ent : > + +Feeding incomplete chunks to *note feed(): 375c. works, but *note +handle_data(): 3763. might be called more than once (unless +'convert_charrefs' is set to ‘True’): + + >>> for chunk in ['buff', 'ered', ' text']: + ... 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('

tag soup

') + 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 — Definitions of HTML general entities, Next: XML Processing Modules, Prev: html parser — Simple HTML and XHTML parser, Up: Structured Markup Processing Tools + +5.21.3 ‘html.entities’ — Definitions of HTML general entities +------------------------------------------------------------- + +'Source code:' Lib/html/entities.py(1) + +__________________________________________________________________ + +This module defines four dictionaries, *note html5: 10c8, *note +name2codepoint: 376e, *note codepoint2name: 376f, and *note entitydefs: +3770. + + -- Data: html.entities.html5 + + A dictionary that maps HTML5 named character references (2) to the + equivalent Unicode character(s), e.g. ‘html5['gt;'] == '>'’. Note + that the trailing semicolon is included in the name (e.g. + ‘'gt;'’), however some of the names are accepted by the standard + even without the semicolon: in this case the name is present with + and without the ‘';'’. See also *note html.unescape(): 957. + + Added in version 3.3. + + -- Data: html.entities.entitydefs + + A dictionary mapping XHTML 1.0 entity definitions to their + replacement text in ISO Latin-1. + + -- Data: html.entities.name2codepoint + + A dictionary that maps HTML4 entity names to the Unicode code + points. + + -- Data: html.entities.codepoint2name + + A dictionary that maps Unicode code points to HTML4 entity names. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/html/entities.py + + (2) See +‘https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references’ + + +File: python.info, Node: XML Processing Modules, Next: xml etree ElementTree — The ElementTree XML API, Prev: html entities — Definitions of HTML general entities, Up: Structured Markup Processing Tools + +5.21.4 XML Processing Modules +----------------------------- + +'Source code:' Lib/xml/(1) + +__________________________________________________________________ + +Python’s interfaces for processing XML are grouped in the ‘xml’ package. + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +It is important to note that modules in the *note xml: 120. 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: 126. module will always be available. + +The documentation for the *note xml.dom: 121. and *note xml.sax: 129. +packages are the definition of the Python bindings for the DOM and SAX +interfaces. + +The XML handling submodules are: + + * *note xml.etree.ElementTree: 125.: the ElementTree API, a simple + and lightweight XML processor + + * *note xml.dom: 121.: the DOM API definition + + * *note xml.dom.minidom: 122.: a minimal DOM implementation + + * *note xml.dom.pulldom: 123.: support for building partial DOM trees + + * *note xml.sax: 129.: SAX2 base classes and convenience functions + + * *note xml.parsers.expat: 126.: the Expat parser binding +* Menu: + +* XML security:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/xml/ + + +File: python.info, Node: XML security, Up: XML Processing Modules + +5.21.4.1 XML security +..................... + +An attacker can abuse XML features to carry out denial of service +attacks, access local files, generate network connections to other +machines, or circumvent firewalls. + +Expat versions lower that 2.6.0 may be vulnerable to “billion laughs”, +“quadratic blowup” and “large tokens”. Python may be vulnerable if it +uses such older versions of Expat as a system-provided library. Check +‘pyexpat.EXPAT_VERSION’. + +*note xmlrpc: 12d. is 'vulnerable' to the “decompression bomb” attack. + +billion laughs / exponential entity expansion + + The Billion Laughs(1) attack – also known as exponential entity + expansion – uses multiple levels of nested entities. Each entity + refers to another entity several times, and the final entity + definition contains a small string. The exponential expansion + results in several gigabytes of text and consumes lots of memory + and CPU time. + +quadratic blowup entity expansion + + A quadratic blowup attack is similar to a Billion Laughs(2) attack; + it abuses entity expansion, too. Instead of nested entities it + repeats one large entity with a couple of thousand chars over and + over again. The attack isn’t as efficient as the exponential case + but it avoids triggering parser countermeasures that forbid deeply + nested entities. + +decompression bomb + + Decompression bombs (aka ZIP bomb(3)) apply to all XML libraries + that can parse compressed XML streams such as gzipped HTTP streams + or LZMA-compressed files. For an attacker it can reduce the amount + of transmitted data by three magnitudes or more. + +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(4). + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Billion_laughs + + (2) https://en.wikipedia.org/wiki/Billion_laughs + + (3) https://en.wikipedia.org/wiki/Zip_bomb + + (4) https://www.cve.org/CVERecord?id=CVE-2023-52425 + + +File: python.info, Node: xml etree ElementTree — The ElementTree XML API, Next: xml dom — The Document Object Model API, Prev: XML Processing Modules, Up: Structured Markup Processing Tools + +5.21.5 ‘xml.etree.ElementTree’ — The ElementTree XML API +-------------------------------------------------------- + +'Source code:' Lib/xml/etree/ElementTree.py(1) + +__________________________________________________________________ + +The *note xml.etree.ElementTree: 125. module implements a simple and +efficient API for parsing and creating XML data. + +Changed in version 3.3: This module will use a fast implementation +whenever available. + +Deprecated since version 3.3: The ‘xml.etree.cElementTree’ module is +deprecated. + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +* Menu: + +* Tutorial: Tutorial<3>. +* XPath support:: +* Reference: Reference<4>. +* XInclude support:: +* Reference: Reference<5>. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/etree/ElementTree.py + + +File: python.info, Node: Tutorial<3>, Next: XPath support, Up: xml etree ElementTree — The ElementTree XML API + +5.21.5.1 Tutorial +................. + +This is a short tutorial for using *note xml.etree.ElementTree: 125. +(‘ET’ in short). The goal is to demonstrate some of the building blocks +and basic concepts of the module. + +* Menu: + +* XML tree and elements:: +* Parsing XML:: +* Pull API for non-blocking parsing:: +* Finding interesting elements:: +* Modifying an XML File:: +* Building XML documents:: +* Parsing XML with Namespaces:: + + +File: python.info, Node: XML tree and elements, Next: Parsing XML, Up: Tutorial<3> + +5.21.5.2 XML tree and elements +.............................. + +XML is an inherently hierarchical data format, and the most natural way +to represent it is with a tree. ‘ET’ has two classes for this purpose - +*note ElementTree: 94e. represents the whole XML document as a tree, and +*note Element: 30a. represents a single node in this tree. Interactions +with the whole document (reading and writing to/from files) are usually +done on the *note ElementTree: 94e. level. Interactions with a single +XML element and its sub-elements are done on the *note Element: 30a. +level. + + +File: python.info, Node: Parsing XML, Next: Pull API for non-blocking parsing, Prev: XML tree and elements, Up: Tutorial<3> + +5.21.5.3 Parsing XML +.................... + +We’ll be using the fictive ‘country_data.xml’ XML document as the sample +data for this section: + + + + + 1 + 2008 + 141100 + + + + + 4 + 2011 + 59900 + + + + 68 + 2011 + 13600 + + + + + +We can import this data by reading from a file: + + import xml.etree.ElementTree as ET + tree = ET.parse('country_data.xml') + root = tree.getroot() + +Or directly from a string: + + root = ET.fromstring(country_data_as_string) + +*note fromstring(): 377d. parses XML from a string directly into an +*note Element: 30a, which is the root element of the parsed tree. Other +parsing functions may create an *note ElementTree: 94e. Check the +documentation to be sure. + +As an *note Element: 30a, ‘root’ has a tag and a dictionary of +attributes: + + >>> root.tag + 'data' + >>> root.attrib + {} + +It also has children nodes over which we can iterate: + + >>> for child in root: + ... print(child.tag, child.attrib) + ... + country {'name': 'Liechtenstein'} + country {'name': 'Singapore'} + country {'name': 'Panama'} + +Children are nested, and we can access specific child nodes by index: + + >>> root[0][1].text + '2008' + + Note: Not all elements of the XML input will end up as elements of + the parsed tree. Currently, this module skips over any XML + comments, processing instructions, and document type declarations + in the input. Nevertheless, trees built using this module’s API + rather than parsing from XML text can have comments and processing + instructions in them; they will be included when generating XML + output. A document type declaration may be accessed by passing a + custom *note TreeBuilder: a54. instance to the *note XMLParser: + a53. constructor. + + +File: python.info, Node: Pull API for non-blocking parsing, Next: Finding interesting elements, Prev: Parsing XML, Up: Tutorial<3> + +5.21.5.4 Pull API for non-blocking parsing +.......................................... + +Most parsing functions provided by this module require the whole +document to be read at once before returning any result. It is possible +to use an *note XMLParser: a53. and feed data into it incrementally, but +it is a push API that calls methods on a callback target, which is too +low-level and inconvenient for most needs. Sometimes what the user +really wants is to be able to parse XML incrementally, without blocking +operations, while enjoying the convenience of fully constructed *note +Element: 30a. objects. + +The most powerful tool for doing this is *note XMLPullParser: fec. It +does not require a blocking read to obtain the XML data, and is instead +fed with data incrementally with *note XMLPullParser.feed(): 377f. +calls. To get the parsed XML elements, call *note +XMLPullParser.read_events(): 3780. Here is an example: + + >>> parser = ET.XMLPullParser(['start', 'end']) + >>> parser.feed('sometext') + >>> list(parser.read_events()) + [('start', )] + >>> parser.feed(' more text') + >>> for event, elem in parser.read_events(): + ... print(event) + ... print(elem.tag, 'text=', elem.text) + ... + end + mytag text= sometext more text + +The obvious use case is applications that operate in a non-blocking +fashion where the XML data is being received from a socket or read +incrementally from some storage device. In such cases, blocking reads +are unacceptable. + +Because it’s so flexible, *note XMLPullParser: fec. can be inconvenient +to use for simpler use-cases. If you don’t mind your application +blocking on reading XML data but would still like to have incremental +parsing capabilities, take a look at *note iterparse(): 275. It can be +useful when you’re reading a large XML document and don’t want to hold +it wholly in memory. + +Where 'immediate' feedback through events is wanted, calling method +*note XMLPullParser.flush(): 272. can help reduce delay; please make +sure to study the related security notes. + + +File: python.info, Node: Finding interesting elements, Next: Modifying an XML File, Prev: Pull API for non-blocking parsing, Up: Tutorial<3> + +5.21.5.5 Finding interesting elements +..................................... + +*note Element: 30a. has some useful methods that help iterate +recursively over all the sub-tree below it (its children, their +children, and so on). For example, *note Element.iter(): 1342.: + + >>> 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(): 1567. finds only elements with a tag which are +direct children of the current element. *note Element.find(): 1565. +finds the 'first' child with a particular tag, and *note Element.text: +3782. accesses the element’s text content. *note Element.get(): 3783. +accesses the element’s attributes: + + >>> for country in root.findall('country'): + ... rank = country.find('rank').text + ... name = country.get('name') + ... print(name, rank) + ... + Liechtenstein 1 + Singapore 4 + Panama 68 + +More sophisticated specification of which elements to look for is +possible by using *note XPath: bad. + + +File: python.info, Node: Modifying an XML File, Next: Building XML documents, Prev: Finding interesting elements, Up: Tutorial<3> + +5.21.5.6 Modifying an XML File +.............................. + +*note ElementTree: 94e. provides a simple way to build XML documents and +write them to files. The *note ElementTree.write(): ff0. method serves +this purpose. + +Once created, an *note Element: 30a. object may be manipulated by +directly changing its fields (such as *note Element.text: 3782.), adding +and modifying attributes (*note Element.set(): 3785. method), as well as +adding new children (for example with *note Element.append(): 3786.). + +Let’s say we want to add one to each country’s rank, and add an +‘updated’ attribute to the rank element: + + >>> 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') + +Our XML now looks like this: + + + + + 2 + 2008 + 141100 + + + + + 5 + 2011 + 59900 + + + + 69 + 2011 + 13600 + + + + + +We can remove elements using *note Element.remove(): 1569. Let’s say we +want to remove all countries with a rank higher than 50: + + >>> 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. + +Our XML now looks like this: + + + + + 2 + 2008 + 141100 + + + + + 5 + 2011 + 59900 + + + + + +File: python.info, Node: Building XML documents, Next: Parsing XML with Namespaces, Prev: Modifying an XML File, Up: Tutorial<3> + +5.21.5.7 Building XML documents +............................... + +The *note SubElement(): 3788. function also provides a convenient way to +create new sub-elements for a given element: + + >>> a = ET.Element('a') + >>> b = ET.SubElement(a, 'b') + >>> c = ET.SubElement(a, 'c') + >>> d = ET.SubElement(c, 'd') + >>> ET.dump(a) + + + +File: python.info, Node: Parsing XML with Namespaces, Prev: Building XML documents, Up: Tutorial<3> + +5.21.5.8 Parsing XML with Namespaces +.................................... + +If the XML input has namespaces(1), tags and attributes with prefixes in +the form ‘prefix:sometag’ get expanded to ‘{uri}sometag’ where the +'prefix' is replaced by the full 'URI'. Also, if there is a default +namespace(2), that full URI gets prepended to all of the non-prefixed +tags. + +Here is an XML example that incorporates two namespaces, one with the +prefix “fictional” and the other serving as the default namespace: + + + + + John Cleese + Lancelot + Archie Leach + + + Eric Idle + Sir Robin + Gunther + Commander Clement + + + +One way to search and explore this XML example is to manually add the +URI to every tag or attribute in the xpath of a *note find(): 1565. or +*note findall(): 1567.: + + 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) + +A better way to search the namespaced XML example is to create a +dictionary with your own prefixes and use those in the search functions: + + 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) + +These two approaches both output: + + 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 support, Next: Reference<4>, Prev: Tutorial<3>, Up: xml etree ElementTree — The ElementTree XML API + +5.21.5.9 XPath support +...................... + +This module provides limited support for XPath expressions(1) for +locating elements in a tree. The goal is to support a small subset of +the abbreviated syntax; a full XPath engine is outside the scope of the +module. + +* Menu: + +* Example: Example<8>. +* Supported XPath syntax:: + + ---------- Footnotes ---------- + + (1) https://www.w3.org/TR/xpath + + +File: python.info, Node: Example<8>, Next: Supported XPath syntax, Up: XPath support + +5.21.5.10 Example +................. + +Here’s an example that demonstrates some of the XPath capabilities of +the module. We’ll be using the ‘countrydata’ XML document from the +*note Parsing XML: 377b. section: + + 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: Supported XPath syntax, Prev: Example<8>, Up: XPath support + +5.21.5.11 Supported XPath syntax +................................ + +Syntax Meaning + +--------------------------------------------------------------------------------------- + +‘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. + + Changed in version 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’. + + +‘.’ Selects the current node. This is mostly useful at the + beginning of the path, to indicate that it’s a relative + path. + + +‘//’ Selects all subelements, on all levels beneath the + current element. For example, ‘.//egg’ selects all + ‘egg’ elements in the entire tree. + + +‘..’ Selects the parent element. Returns ‘None’ if the path + attempts to reach the ancestors of the start element + (the element ‘find’ was called on). + + +‘[@attrib]’ Selects all elements that have the given attribute. + + +‘[@attrib='value']’ Selects all elements for which the given attribute has + the given value. The value cannot contain quotes. + + +‘[@attrib!='value']’ Selects all elements for which the given attribute does + not have the given value. The value cannot contain + quotes. + + Added in version 3.10. + + +‘[tag]’ Selects all elements that have a child named ‘tag’. + Only immediate children are supported. + + +‘[.='text']’ Selects all elements whose complete text content, + including descendants, equals the given ‘text’. + + Added in version 3.7. + + +‘[.!='text']’ Selects all elements whose complete text content, + including descendants, does not equal the given ‘text’. + + Added in version 3.10. + + +‘[tag='text']’ Selects all elements that have a child named ‘tag’ whose + complete text content, including descendants, equals the + given ‘text’. + + +‘[tag!='text']’ Selects all elements that have a child named ‘tag’ whose + complete text content, including descendants, does not + equal the given ‘text’. + + Added in version 3.10. + + +‘[position]’ Selects all elements that are located at the given + position. The position can be either an integer (1 is + the first position), the expression ‘last()’ (for the + last position), or a position relative to the last + position (e.g. ‘last()-1’). + + +Predicates (expressions within square brackets) must be preceded by a +tag name, an asterisk, or another predicate. ‘position’ predicates must +be preceded by a tag name. + + +File: python.info, Node: Reference<4>, Next: XInclude support, Prev: XPath support, Up: xml etree ElementTree — The ElementTree XML API + +5.21.5.12 Reference +................... + +* Menu: + +* Functions: Functions<9>. + + +File: python.info, Node: Functions<9>, Up: Reference<4> + +5.21.5.13 Functions +................... + + -- Function: 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. + + Typical uses: + + xml_data = "..." + 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 + + (default: false) + + - + 'rewrite_prefixes': set to true to replace namespace prefixes by “n{number}” + + (default: 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. + + -- Function: xml.etree.ElementTree.Comment (text=None) + + Comment element factory. This factory function creates a special + element that will be serialized as an XML comment by the standard + serializer. The comment string can be either a bytestring or a + Unicode string. 'text' is a string containing the comment string. + Returns an element instance representing a comment. + + Note that *note XMLParser: a53. skips over comments in the input + instead of creating comment objects for them. An *note + ElementTree: 94e. will only contain comment nodes if they have been + inserted into to the tree using one of the *note Element: 30a. + methods. + + -- Function: xml.etree.ElementTree.dump (elem) + + Writes an element tree or element structure to sys.stdout. This + function should be used for debugging only. + + The exact output format is implementation dependent. In this + version, it’s written as an ordinary XML file. + + 'elem' is an element tree or an individual element. + + Changed in version 3.8: The *note dump(): 3792. function now + preserves the attribute order specified by the user. + + -- Function: xml.etree.ElementTree.fromstring (text, parser=None) + + Parses an XML section from a string constant. Same as *note XML(): + 3793. 'text' is a string containing XML data. 'parser' is an + optional parser instance. If not given, the standard *note + XMLParser: a53. parser is used. Returns an *note Element: 30a. + instance. + + -- Function: xml.etree.ElementTree.fromstringlist (sequence, + parser=None) + + Parses an XML document from a sequence of string fragments. + 'sequence' is a list or other sequence containing XML data + fragments. 'parser' is an optional parser instance. If not given, + the standard *note XMLParser: a53. parser is used. Returns an + *note Element: 30a. instance. + + Added in version 3.2. + + -- Function: 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. + + -- Function: xml.etree.ElementTree.iselement (element) + + Check if an object appears to be a valid element object. 'element' + is an element instance. Return ‘True’ if this is an element + object. + + -- Function: 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: 11b5. 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: a53. parser is used. 'parser' must + be a subclass of *note XMLParser: a53. and can only use the default + *note TreeBuilder: a54. as a target. Returns an *note iterator: + 1ac. 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 that while *note iterparse(): 275. builds the tree + incrementally, it issues blocking reads on 'source' (or the file it + names). As such, it’s unsuitable for applications where blocking + reads can’t be made. For fully non-blocking parsing, see *note + XMLPullParser: fec. + + Note: *note iterparse(): 275. only guarantees that it has seen + the “>” character of a starting tag when it emits a “start” + event, so the attributes are defined, but the contents of the + text and tail attributes are undefined at that point. The + same applies to the element children; they may or may not be + present. + + If you need a fully populated element, look for “end” events + instead. + + Deprecated since version 3.4: The 'parser' argument. + + Changed in version 3.8: The ‘comment’ and ‘pi’ events were added. + + Changed in version 3.13: Added the ‘close()’ method. + + -- Function: xml.etree.ElementTree.parse (source, parser=None) + + Parses an XML section into an element tree. 'source' is a filename + or file object containing XML data. 'parser' is an optional parser + instance. If not given, the standard *note XMLParser: a53. parser + is used. Returns an *note ElementTree: 94e. instance. + + -- Function: xml.etree.ElementTree.ProcessingInstruction (target, + text=None) + + PI element factory. This factory function creates a special + element that will be serialized as an XML processing instruction. + 'target' is a string containing the PI target. 'text' is a string + containing the PI contents, if given. Returns an element instance, + representing a processing instruction. + + Note that *note XMLParser: a53. skips over processing instructions + in the input instead of creating PI objects for them. An *note + ElementTree: 94e. will only contain processing instruction nodes if + they have been inserted into to the tree using one of the *note + Element: 30a. methods. + + -- Function: xml.etree.ElementTree.register_namespace (prefix, uri) + + Registers a namespace prefix. The registry is global, and any + existing mapping for either the given prefix or the namespace URI + will be removed. 'prefix' is a namespace prefix. 'uri' is a + namespace uri. Tags and attributes in this namespace will be + serialized with the given prefix, if at all possible. + + Added in version 3.2. + + -- Function: xml.etree.ElementTree.SubElement (parent, tag, attrib={}, + **extra) + + Subelement factory. This function creates an element instance, and + appends it to an existing element. + + The element name, attribute names, and attribute values can be + either bytestrings or Unicode strings. 'parent' is the parent + element. 'tag' is the subelement name. 'attrib' is an optional + dictionary, containing element attributes. 'extra' contains + additional attributes, given as keyword arguments. Returns an + element instance. + + -- Function: xml.etree.ElementTree.tostring (element, + encoding='us-ascii', method='xml', *, xml_declaration=None, + default_namespace=None, short_empty_elements=True) + + Generates a string representation of an XML element, including all + subelements. 'element' is an *note Element: 30a. instance. + 'encoding' (2) is the output encoding (default is US-ASCII). Use + ‘encoding="unicode"’ to generate a Unicode string (otherwise, a + bytestring is generated). 'method' is either ‘"xml"’, ‘"html"’ or + ‘"text"’ (default is ‘"xml"’). 'xml_declaration', + 'default_namespace' and 'short_empty_elements' has the same meaning + as in *note ElementTree.write(): ff0. Returns an (optionally) + encoded string containing the XML data. + + Changed in version 3.4: Added the 'short_empty_elements' parameter. + + Changed in version 3.8: Added the 'xml_declaration' and + 'default_namespace' parameters. + + Changed in version 3.8: The *note tostring(): fee. function now + preserves the attribute order specified by the user. + + -- Function: xml.etree.ElementTree.tostringlist (element, + encoding='us-ascii', method='xml', *, xml_declaration=None, + default_namespace=None, short_empty_elements=True) + + Generates a string representation of an XML element, including all + subelements. 'element' is an *note Element: 30a. instance. + 'encoding' (3) is the output encoding (default is US-ASCII). Use + ‘encoding="unicode"’ to generate a Unicode string (otherwise, a + bytestring is generated). 'method' is either ‘"xml"’, ‘"html"’ or + ‘"text"’ (default is ‘"xml"’). 'xml_declaration', + 'default_namespace' and 'short_empty_elements' has the same meaning + as in *note ElementTree.write(): ff0. Returns a list of + (optionally) encoded strings containing the XML data. It does not + guarantee any specific sequence, except that + ‘b"".join(tostringlist(element)) == tostring(element)’. + + Added in version 3.2. + + Changed in version 3.4: Added the 'short_empty_elements' parameter. + + Changed in version 3.8: Added the 'xml_declaration' and + 'default_namespace' parameters. + + Changed in version 3.8: The *note tostringlist(): fef. function now + preserves the attribute order specified by the user. + + -- Function: xml.etree.ElementTree.XML (text, parser=None) + + Parses an XML section from a string constant. This function can be + used to embed “XML literals” in Python code. 'text' is a string + containing XML data. 'parser' is an optional parser instance. If + not given, the standard *note XMLParser: a53. parser is used. + Returns an *note Element: 30a. instance. + + -- Function: xml.etree.ElementTree.XMLID (text, parser=None) + + Parses an XML section from a string constant, and also returns a + dictionary which maps from element id:s to elements. 'text' is a + string containing XML data. 'parser' is an optional parser + instance. If not given, the standard *note XMLParser: a53. parser + is used. Returns a tuple containing an *note Element: 30a. + instance and a dictionary. + + ---------- Footnotes ---------- + + (1) https://www.w3.org/TR/xml-c14n2/ + + (2) The encoding string included in XML output should conform to the +appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + (3) The encoding string included in XML output should conform to the +appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + +File: python.info, Node: XInclude support, Next: Reference<5>, Prev: Reference<4>, Up: xml etree ElementTree — The ElementTree XML API + +5.21.5.14 XInclude support +.......................... + +This module provides limited support for XInclude directives(1), via the +*note xml.etree.ElementInclude: 124. helper module. This module can be +used to insert subtrees and text strings into element trees, based on +information in the tree. + +* Menu: + +* Example: Example<9>. + + ---------- Footnotes ---------- + + (1) https://www.w3.org/TR/xinclude/ + + +File: python.info, Node: Example<9>, Up: XInclude support + +5.21.5.15 Example +................. + +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. + + + + + + +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 +*note xml.etree.ElementTree: 125. 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: + + + This is a paragraph. + + +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”: + + + + Copyright (c) . + + +The result might look something like: + + + Copyright (c) 2003. + + + +File: python.info, Node: Reference<5>, Prev: XInclude support, Up: xml etree ElementTree — The ElementTree XML API + +5.21.5.16 Reference +................... + +* Menu: + +* Functions: Functions<10>. +* Element Objects:: +* ElementTree Objects:: +* QName Objects:: +* TreeBuilder Objects:: +* XMLParser Objects:: +* XMLPullParser Objects:: +* Exceptions: Exceptions<19>. + + +File: python.info, Node: Functions<10>, Next: Element Objects, Up: Reference<5> + +5.21.5.17 Functions +................... + + -- Function: 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: 30a. instance. If the + parse mode is ‘"text"’, this is a string. If the loader fails, it + can return ‘None’ or raise an exception. + + -- Function: 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: 30a. or an + *note ElementTree: 94e. instance to find such element. 'loader' is + an optional resource loader. If omitted, it defaults to *note + default_loader(): 379f. If given, it should be a callable that + implements the same interface as *note default_loader(): 379f. + '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. + + Changed in version 3.9: Added the 'base_url' and 'max_depth' + parameters. + + +File: python.info, Node: Element Objects, Next: ElementTree Objects, Prev: Functions<10>, Up: Reference<5> + +5.21.5.18 Element Objects +......................... + + -- Class: xml.etree.ElementTree.Element (tag, attrib={}, **extra) + + Element class. This class defines the Element interface, and + provides a reference implementation of this interface. + + The element name, attribute names, and attribute values can be + either bytestrings or Unicode strings. 'tag' is the element name. + 'attrib' is an optional dictionary, containing element attributes. + 'extra' contains additional attributes, given as keyword arguments. + + -- Attribute: tag + + A string identifying what kind of data this element represents + (the element type, in other words). + + -- Attribute: text + -- Attribute: tail + + These attributes can be used to hold additional data + associated with the element. Their values are usually strings + but may be any application-specific object. If the element is + created from an XML file, the 'text' attribute holds either + the text between the element’s start tag and its first child + or end tag, or ‘None’, and the 'tail' attribute holds either + the text between the element’s end tag and the next tag, or + ‘None’. For the XML data + + 1234 + + the 'a' element has ‘None’ for both 'text' and 'tail' + attributes, the 'b' element has 'text' ‘"1"’ and 'tail' ‘"4"’, + the 'c' element has 'text' ‘"2"’ and 'tail' ‘None’, and the + 'd' element has 'text' ‘None’ and 'tail' ‘"3"’. + + To collect the inner text of an element, see *note itertext(): + 11c7, for example ‘"".join(element.itertext())’. + + Applications may store arbitrary objects in these attributes. + + -- Attribute: attrib + + A dictionary containing the element’s attributes. Note that + while the 'attrib' value is always a real mutable Python + dictionary, an ElementTree implementation may choose to use + another internal representation, and create the dictionary + only if someone asks for it. To take advantage of such + implementations, use the dictionary methods below whenever + possible. + + The following dictionary-like methods work on the element + attributes. + + -- Method: clear () + + Resets an element. This function removes all subelements, + clears all attributes, and sets the text and tail attributes + to ‘None’. + + -- Method: get (key, default=None) + + Gets the element attribute named 'key'. + + Returns the attribute value, or 'default' if the attribute was + not found. + + -- Method: items () + + Returns the element attributes as a sequence of (name, value) + pairs. The attributes are returned in an arbitrary order. + + -- Method: keys () + + Returns the elements attribute names as a list. The names are + returned in an arbitrary order. + + -- Method: set (key, value) + + Set the attribute 'key' on the element to 'value'. + + The following methods work on the element’s children (subelements). + + -- Method: append (subelement) + + Adds the element 'subelement' to the end of this element’s + internal list of subelements. Raises *note TypeError: 534. if + 'subelement' is not an *note Element: 30a. + + -- Method: extend (subelements) + + Appends 'subelements' from an iterable of elements. Raises + *note TypeError: 534. if a subelement is not an *note Element: + 30a. + + Added in version 3.2. + + -- Method: find (match, namespaces=None) + + Finds the first subelement matching 'match'. 'match' may be a + tag name or a *note path: bad. 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. + + -- Method: findall (match, namespaces=None) + + Finds all matching subelements, by tag name or *note path: + bad. 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. + + -- Method: findtext (match, default=None, namespaces=None) + + Finds text for the first subelement matching 'match'. 'match' + may be a tag name or a *note path: bad. 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. + + -- Method: insert (index, subelement) + + Inserts 'subelement' at the given position in this element. + Raises *note TypeError: 534. if 'subelement' is not an *note + Element: 30a. + + -- Method: iter (tag=None) + + Creates a tree *note iterator: 1ac. with the current element + as the root. The iterator iterates over this element and all + elements below it, in document (depth first) order. If 'tag' + is not ‘None’ or ‘'*'’, only elements whose tag equals 'tag' + are returned from the iterator. If the tree structure is + modified during iteration, the result is undefined. + + Added in version 3.2. + + -- Method: iterfind (match, namespaces=None) + + Finds all matching subelements, by tag name or *note path: + bad. Returns an iterable yielding all matching elements in + document order. 'namespaces' is an optional mapping from + namespace prefix to full name. + + Added in version 3.2. + + -- Method: itertext () + + Creates a text iterator. The iterator loops over this element + and all subelements, in document order, and returns all inner + text. + + Added in version 3.2. + + -- Method: makeelement (tag, attrib) + + Creates a new element object of the same type as this element. + Do not call this method, use the *note SubElement(): 3788. + factory function instead. + + -- Method: remove (subelement) + + Removes 'subelement' from the element. Unlike the find* + methods this method compares elements based on the instance + identity, not on tag value or contents. + + *note Element: 30a. objects also support the following sequence + type methods for working with subelements: *note __delitem__(): + 12bf, *note __getitem__(): 285, *note __setitem__(): 12be, *note + __len__(): 1f63. + + 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") + + Changed in version 3.12: Testing the truth value of an Element + emits *note DeprecationWarning: 1a5. + + 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(): 3790. 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 Objects, Next: QName Objects, Prev: Element Objects, Up: Reference<5> + +5.21.5.19 ElementTree Objects +............................. + + -- Class: xml.etree.ElementTree.ElementTree (element=None, file=None) + + ElementTree wrapper class. This class represents an entire element + hierarchy, and adds some extra support for serialization to and + from standard XML. + + 'element' is the root element. The tree is initialized with the + contents of the XML 'file' if given. + + -- Method: _setroot (element) + + Replaces the root element for this tree. This discards the + current contents of the tree, and replaces it with the given + element. Use with care. 'element' is an element instance. + + -- Method: find (match, namespaces=None) + + Same as *note Element.find(): 1565, starting at the root of + the tree. + + -- Method: findall (match, namespaces=None) + + Same as *note Element.findall(): 1567, starting at the root of + the tree. + + -- Method: findtext (match, default=None, namespaces=None) + + Same as *note Element.findtext(): 1566, starting at the root + of the tree. + + -- Method: getroot () + + Returns the root element for this tree. + + -- Method: iter (tag=None) + + Creates and returns a tree iterator for the root element. The + iterator loops over all elements in this tree, in section + order. 'tag' is the tag to look for (default is to return all + elements). + + -- Method: iterfind (match, namespaces=None) + + Same as *note Element.iterfind(): 11c6, starting at the root + of the tree. + + Added in version 3.2. + + -- Method: parse (source, parser=None) + + Loads an external XML section into this element tree. + 'source' is a file name or *note file object: 11b5. 'parser' + is an optional parser instance. If not given, the standard + *note XMLParser: a53. parser is used. Returns the section + root element. + + -- Method: write (file, encoding='us-ascii', xml_declaration=None, + default_namespace=None, method='xml', *, + short_empty_elements=True) + + Writes the element tree to a file, as XML. 'file' is a file + name, or a *note file object: 11b5. opened for writing. + 'encoding' (1) is the output encoding (default is US-ASCII). + 'xml_declaration' controls if an XML declaration should be + added to the file. Use ‘False’ for never, ‘True’ for always, + ‘None’ for only if not US-ASCII or UTF-8 or Unicode (default + is ‘None’). 'default_namespace' sets the default XML + namespace (for “xmlns”). 'method' is either ‘"xml"’, ‘"html"’ + or ‘"text"’ (default is ‘"xml"’). The keyword-only + 'short_empty_elements' parameter controls the formatting of + elements that contain no content. If ‘True’ (the default), + they are emitted as a single self-closed tag, otherwise they + are emitted as a pair of start/end tags. + + The output is either a string (*note str: 447.) or binary + (*note bytes: 1c2.). This is controlled by the 'encoding' + argument. If 'encoding' is ‘"unicode"’, the output is a + string; otherwise, it’s binary. Note that this may conflict + with the type of 'file' if it’s an open *note file object: + 11b5.; make sure you do not try to write a string to a binary + stream and vice versa. + + Changed in version 3.4: Added the 'short_empty_elements' + parameter. + + Changed in version 3.8: The *note write(): ff0. method now + preserves the attribute order specified by the user. + +This is the XML file that is going to be manipulated: + + + + Example page + + +

Moved to example.org + or example.com.

+ + + +Example of changing the attribute “target” of every link in first +paragraph: + + >>> from xml.etree.ElementTree import ElementTree + >>> tree = ElementTree() + >>> tree.parse("index.xhtml") + + >>> p = tree.find("body/p") # Finds first occurrence of tag p in body + >>> p + + >>> links = list(p.iter("a")) # Returns list of all links + >>> links + [, ] + >>> for i in links: # Iterates through all found links + ... i.attrib["target"] = "blank" + ... + >>> tree.write("output.xhtml") + + ---------- Footnotes ---------- + + (1) The encoding string included in XML output should conform to the +appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + +File: python.info, Node: QName Objects, Next: TreeBuilder Objects, Prev: ElementTree Objects, Up: Reference<5> + +5.21.5.20 QName Objects +....................... + + -- Class: xml.etree.ElementTree.QName (text_or_uri, tag=None) + + QName wrapper. This can be used to wrap a QName attribute value, + in order to get proper namespace handling on output. 'text_or_uri' + is a string containing the QName value, in the form {uri}local, or, + if the tag argument is given, the URI part of a QName. If 'tag' is + given, the first argument is interpreted as a URI, and this + argument is interpreted as a local name. *note QName: 37b6. + instances are opaque. + + +File: python.info, Node: TreeBuilder Objects, Next: XMLParser Objects, Prev: QName Objects, Up: Reference<5> + +5.21.5.21 TreeBuilder Objects +............................. + + -- Class: xml.etree.ElementTree.TreeBuilder (element_factory=None, *, + comment_factory=None, pi_factory=None, insert_comments=False, + insert_pis=False) + + Generic element structure builder. This builder converts a + sequence of start, data, end, comment and pi method calls to a + well-formed element structure. You can use this class to build an + element structure using a custom XML parser, or a parser for some + other XML-like format. + + '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(): 3791. and *note + ProcessingInstruction(): 3797. 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). + + -- Method: close () + + Flushes the builder buffers, and returns the toplevel document + element. Returns an *note Element: 30a. instance. + + -- Method: data (data) + + Adds text to the current element. 'data' is a string. This + should be either a bytestring, or a Unicode string. + + -- Method: end (tag) + + Closes the current element. 'tag' is the element name. + Returns the closed element. + + -- Method: start (tag, attrs) + + Opens a new element. 'tag' is the element name. 'attrs' is a + dictionary containing element attributes. Returns the opened + element. + + -- Method: 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. + + -- Method: 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. + + In addition, a custom *note TreeBuilder: a54. object can provide + the following methods: + + -- Method: doctype (name, pubid, system) + + Handles a doctype declaration. 'name' is the doctype name. + 'pubid' is the public identifier. 'system' is the system + identifier. This method does not exist on the default *note + TreeBuilder: a54. class. + + Added in version 3.2. + + -- Method: 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. + + -- Method: 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. + + -- Class: 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(): 3790. 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 Objects, Next: XMLPullParser Objects, Prev: TreeBuilder Objects, Up: Reference<5> + +5.21.5.22 XMLParser Objects +........................... + + -- Class: xml.etree.ElementTree.XMLParser (*, target=None, + encoding=None) + + This class is the low-level building block of the module. It uses + *note xml.parsers.expat: 126. for efficient, event-based parsing of + XML. It can be fed XML data incrementally with the *note feed(): + 37c2. method, and parsing events are translated to a push API - by + invoking callbacks on the 'target' object. If 'target' is omitted, + the standard *note TreeBuilder: a54. is used. If 'encoding' (1) is + given, the value overrides the encoding specified in the XML file. + + Changed in version 3.8: Parameters are now *note keyword-only: 2a7. + The 'html' argument is no longer supported. + + -- Method: close () + + Finishes feeding data to the parser. Returns the result of + calling the ‘close()’ method of the 'target' passed during + construction; by default, this is the toplevel document + element. + + -- Method: feed (data) + + Feeds data to the parser. 'data' is encoded data. + + -- Method: flush () + + Triggers parsing of any previously fed unparsed data, which + can be used to ensure more immediate feedback, in particular + with Expat >=2.6.0. The implementation of *note flush(): 271. + 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(): 274. + for details. + + Note that *note flush(): 271. has been backported to some + prior releases of CPython as a security fix. Check for + availability of *note flush(): 271. using *note hasattr(): + 4ce. if used in code running across a variety of Python + versions. + + Added in version 3.13. + + *note XMLParser.feed(): 37c2. calls 'target"s ‘start(tag, + attrs_dict)’ method for each opening tag, its ‘end(tag)’ method for + each closing tag, and data is processed by method ‘data(data)’. + For further supported callback methods, see the *note TreeBuilder: + a54. class. *note XMLParser.close(): 37c3. calls 'target"s method + ‘close()’. *note XMLParser: a53. can be used not only for building + a tree structure. This is an example of counting the maximum depth + of an XML file: + + >>> 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 = """ + ... + ... + ... + ... + ... + ... + ... + ... + ... + ... """ + >>> parser.feed(exampleXml) + >>> parser.close() + 4 + + ---------- Footnotes ---------- + + (1) The encoding string included in XML output should conform to the +appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + +File: python.info, Node: XMLPullParser Objects, Next: Exceptions<19>, Prev: XMLParser Objects, Up: Reference<5> + +5.21.5.23 XMLPullParser Objects +............................... + + -- Class: xml.etree.ElementTree.XMLPullParser (events=None) + + A pull parser suitable for non-blocking applications. Its + input-side API is similar to that of *note XMLParser: a53, but + instead of pushing calls to a callback target, *note XMLPullParser: + fec. collects an internal list of parsing events and lets the user + read from it. '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. + + -- Method: feed (data) + + Feed the given bytes data to the parser. + + -- Method: flush () + + Triggers parsing of any previously fed unparsed data, which + can be used to ensure more immediate feedback, in particular + with Expat >=2.6.0. The implementation of *note flush(): 272. + 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(): 274. + for details. + + Note that *note flush(): 272. has been backported to some + prior releases of CPython as a security fix. Check for + availability of *note flush(): 272. using *note hasattr(): + 4ce. if used in code running across a variety of Python + versions. + + Added in version 3.13. + + -- Method: close () + + Signal the parser that the data stream is terminated. Unlike + *note XMLParser.close(): 37c3, this method always returns + *note None: 671. Any events not yet retrieved when the parser + is closed can still be read with *note read_events(): 3780. + + -- Method: 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: 30a. 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: 671. (this may change in a future + version) + + Events provided in a previous call to *note read_events(): + 3780. will not be yielded again. Events are consumed from the + internal queue only when they are retrieved from the iterator, + so multiple readers iterating in parallel over iterators + obtained from *note read_events(): 3780. will have + unpredictable results. + + Note: *note XMLPullParser: fec. only guarantees that it has + seen the “>” character of a starting tag when it emits a + “start” event, so the attributes are defined, but the contents + of the text and tail attributes are undefined at that point. + The same applies to the element children; they may or may not + be present. + + If you need a fully populated element, look for “end” events + instead. + + Added in version 3.4. + + Changed in version 3.8: The ‘comment’ and ‘pi’ events were added. + + +File: python.info, Node: Exceptions<19>, Prev: XMLPullParser Objects, Up: Reference<5> + +5.21.5.24 Exceptions +.................... + + -- Class: xml.etree.ElementTree.ParseError + + XML parse error, raised by the various parsing methods in this + module when parsing fails. The string representation of an + instance of this exception will contain a user-friendly error + message. In addition, it will have the following attributes + available: + + -- Attribute: code + + A numeric error code from the expat parser. See the + documentation of *note xml.parsers.expat: 126. for the list of + error codes and their meanings. + + -- Attribute: position + + A tuple of 'line', 'column' numbers, specifying where the + error occurred. + + +File: python.info, Node: xml dom — The Document Object Model API, Next: xml dom minidom — Minimal DOM implementation, Prev: xml etree ElementTree — The ElementTree XML API, Up: Structured Markup Processing Tools + +5.21.6 ‘xml.dom’ — The Document Object Model API +------------------------------------------------ + +'Source code:' Lib/xml/dom/__init__.py(1) + +__________________________________________________________________ + +The Document Object Model, or “DOM,” is a cross-language API from the +World Wide Web Consortium (W3C) for accessing and modifying XML +documents. A DOM implementation presents an XML document as a tree +structure, or allows client code to build such a structure from scratch. +It then gives access to the structure through a set of objects which +provided well-known interfaces. + +The DOM is extremely useful for random-access applications. SAX only +allows you a view of one bit of the document at a time. If you are +looking at one SAX element, you have no access to another. If you are +looking at a text node, you have no access to a containing element. +When you write a SAX application, you need to keep track of your +program’s position in the document somewhere in your own code. SAX does +not do it for you. Also, if you need to look ahead in the XML document, +you are just out of luck. + +Some applications are simply impossible in an event driven model with no +access to a tree. Of course you could build some sort of tree yourself +in SAX events, but the DOM allows you to avoid writing that code. The +DOM is a standard tree representation for XML data. + +The Document Object Model is being defined by the W3C in stages, or +“levels” in their terminology. The Python mapping of the API is +substantially based on the DOM Level 2 recommendation. + +DOM applications typically start by parsing some XML into a DOM. How +this is accomplished is not covered at all by DOM Level 1, and Level 2 +provides only limited improvements: There is a ‘DOMImplementation’ +object class which provides access to ‘Document’ creation methods, but +no way to access an XML reader/parser/Document builder in an +implementation-independent way. There is also no well-defined way to +access these methods without an existing ‘Document’ object. In Python, +each DOM implementation will provide a function *note +getDOMImplementation(): 37cc. DOM Level 3 adds a Load/Store +specification, which defines an interface to the reader, but this is not +yet available in the Python standard library. + +Once you have a DOM document object, you can access the parts of your +XML document through its properties and methods. These properties are +defined in the DOM specification; this portion of the reference manual +describes the interpretation of the specification in Python. + +The specification provided by the W3C defines the DOM API for Java, +ECMAScript, and OMG IDL. The Python mapping defined here is based in +large part on the IDL version of the specification, but strict +compliance is not required (though implementations are free to support +the strict mapping from IDL). See section *note Conformance: 37cd. for a +detailed discussion of mapping requirements. + +See also +........ + +Document Object Model (DOM) Level 2 Specification(2) + + The W3C recommendation upon which the Python DOM API is based. + +Document Object Model (DOM) Level 1 Specification(3) + + The W3C recommendation for the DOM supported by *note + xml.dom.minidom: 122. + +Python Language Mapping Specification(4) + + This specifies the mapping from OMG IDL to Python. + +* Menu: + +* Module Contents: Module Contents<4>. +* Objects in the DOM:: +* Conformance:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/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: Module Contents<4>, Next: Objects in the DOM, Up: xml dom — The Document Object Model API + +5.21.6.1 Module Contents +........................ + +The *note xml.dom: 121. contains the following functions: + + -- Function: xml.dom.registerDOMImplementation (name, factory) + + Register the 'factory' function with the name 'name'. The factory + function should return an object which implements the + ‘DOMImplementation’ interface. The factory function can return the + same object every time, or a new one for each call, as appropriate + for the specific implementation (e.g. if that implementation + supports some customization). + + -- Function: xml.dom.getDOMImplementation (name=None, features=()) + + Return a suitable DOM implementation. The 'name' is either + well-known, the module name of a DOM implementation, or ‘None’. If + it is not ‘None’, imports the corresponding module and returns a + ‘DOMImplementation’ object if the import succeeds. If no name is + given, and if the environment variable ‘PYTHON_DOM’ is set, this + variable is used to find the implementation. + + If name is not given, this examines the available implementations + to find one with the required feature set. If no implementation + can be found, raise an *note ImportError: 415. The features list + must be a sequence of ‘(feature, version)’ pairs which are passed + to the ‘hasFeature()’ method on available ‘DOMImplementation’ + objects. + +Some convenience constants are also provided: + + -- Data: xml.dom.EMPTY_NAMESPACE + + The value used to indicate that no namespace is associated with a + node in the DOM. This is typically found as the ‘namespaceURI’ of a + node, or used as the 'namespaceURI' parameter to a + namespaces-specific method. + + -- Data: xml.dom.XML_NAMESPACE + + The namespace URI associated with the reserved prefix ‘xml’, as + defined by Namespaces in XML(1) (section 4). + + -- Data: xml.dom.XMLNS_NAMESPACE + + The namespace URI for namespace declarations, as defined by + Document Object Model (DOM) Level 2 Core Specification(2) (section + 1.1.8). + + -- Data: xml.dom.XHTML_NAMESPACE + + The URI of the XHTML namespace as defined by XHTML 1.0: The + Extensible HyperText Markup Language(3) (section 3.1.1). + +In addition, *note xml.dom: 121. 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: Objects in the DOM, Next: Conformance, Prev: Module Contents<4>, Up: xml dom — The Document Object Model API + +5.21.6.2 Objects in the DOM +........................... + +The definitive documentation for the DOM is the DOM specification from +the W3C. + +Note that DOM attributes may also be manipulated as nodes instead of as +simple strings. It is fairly rare that you must do this, however, so +this usage is not yet documented. + +Interface Section Purpose + +------------------------------------------------------------------------------------------------------------------- + +‘DOMImplementation’ *note DOMImplementation Objects: 37d6. Interface to the underlying + implementation. + + +‘Node’ *note Node Objects: 37d7. Base interface for most objects in + a document. + + +‘NodeList’ *note NodeList Objects: 37d8. Interface for a sequence of nodes. + + +‘DocumentType’ *note DocumentType Objects: 37d9. Information about the declarations + needed to process a document. + + +‘Document’ *note Document Objects: 37da. Object which represents an entire + document. + + +‘Element’ *note Element Objects: 37db. Element nodes in the document + hierarchy. + + +‘Attr’ *note Attr Objects: 37dc. Attribute value nodes on element + nodes. + + +‘Comment’ *note Comment Objects: 37dd. Representation of comments in the + source document. + + +‘Text’ *note Text and CDATASection Objects: 37de.Nodes containing textual content + from the document. + + +‘ProcessingInstruction’ *note ProcessingInstruction Objects: 37df.Processing instruction + representation. + + +An additional section describes the exceptions defined for working with +the DOM in Python. + +* Menu: + +* DOMImplementation Objects:: +* Node Objects:: +* NodeList Objects:: +* DocumentType Objects:: +* Document Objects:: +* Element Objects: Element Objects<2>. +* Attr Objects:: +* NamedNodeMap Objects:: +* Comment Objects:: +* Text and CDATASection Objects:: +* ProcessingInstruction Objects:: +* Exceptions: Exceptions<20>. + + +File: python.info, Node: DOMImplementation Objects, Next: Node Objects, Up: Objects in the DOM + +5.21.6.3 DOMImplementation Objects +.................................. + +The ‘DOMImplementation’ interface provides a way for applications to +determine the availability of particular features in the DOM they are +using. DOM Level 2 added the ability to create new ‘Document’ and +‘DocumentType’ objects using the ‘DOMImplementation’ as well. + + -- Method: DOMImplementation.hasFeature (feature, version) + + Return ‘True’ if the feature identified by the pair of strings + 'feature' and 'version' is implemented. + + -- Method: DOMImplementation.createDocument (namespaceUri, + qualifiedName, doctype) + + Return a new ‘Document’ object (the root of the DOM), with a child + ‘Element’ object having the given 'namespaceUri' and + 'qualifiedName'. The 'doctype' must be a ‘DocumentType’ object + created by *note createDocumentType(): 37e3, or ‘None’. In the + Python DOM API, the first two arguments can also be ‘None’ in order + to indicate that no ‘Element’ child is to be created. + + -- Method: DOMImplementation.createDocumentType (qualifiedName, + publicId, systemId) + + Return a new ‘DocumentType’ object that encapsulates the given + 'qualifiedName', 'publicId', and 'systemId' strings, representing + the information contained in an XML document type declaration. + + +File: python.info, Node: Node Objects, Next: NodeList Objects, Prev: DOMImplementation Objects, Up: Objects in the DOM + +5.21.6.4 Node Objects +..................... + +All of the components of an XML document are subclasses of ‘Node’. + + -- Attribute: Node.nodeType + + An integer representing the node type. Symbolic constants for the + types are on the ‘Node’ object: ‘ELEMENT_NODE’, ‘ATTRIBUTE_NODE’, + ‘TEXT_NODE’, ‘CDATA_SECTION_NODE’, ‘ENTITY_NODE’, + ‘PROCESSING_INSTRUCTION_NODE’, ‘COMMENT_NODE’, ‘DOCUMENT_NODE’, + ‘DOCUMENT_TYPE_NODE’, ‘NOTATION_NODE’. This is a read-only + attribute. + + -- Attribute: Node.parentNode + + The parent of the current node, or ‘None’ for the document node. + The value is always a ‘Node’ object or ‘None’. For ‘Element’ + nodes, this will be the parent element, except for the root + element, in which case it will be the ‘Document’ object. For + ‘Attr’ nodes, this is always ‘None’. This is a read-only + attribute. + + -- Attribute: Node.attributes + + A ‘NamedNodeMap’ of attribute objects. Only elements have actual + values for this; others provide ‘None’ for this attribute. This is + a read-only attribute. + + -- Attribute: Node.previousSibling + + The node that immediately precedes this one with the same parent. + For instance the element with an end-tag that comes just before the + 'self' element’s start-tag. Of course, XML documents are made up + of more than just elements so the previous sibling could be text, a + comment, or something else. If this node is the first child of the + parent, this attribute will be ‘None’. This is a read-only + attribute. + + -- Attribute: Node.nextSibling + + The node that immediately follows this one with the same parent. + See also *note previousSibling: 37e8. If this is the last child of + the parent, this attribute will be ‘None’. This is a read-only + attribute. + + -- Attribute: Node.childNodes + + A list of nodes contained within this node. This is a read-only + attribute. + + -- Attribute: Node.firstChild + + The first child of the node, if there are any, or ‘None’. This is + a read-only attribute. + + -- Attribute: Node.lastChild + + The last child of the node, if there are any, or ‘None’. This is a + read-only attribute. + + -- Attribute: Node.localName + + The part of the ‘tagName’ following the colon if there is one, else + the entire ‘tagName’. The value is a string. + + -- Attribute: Node.prefix + + The part of the ‘tagName’ preceding the colon if there is one, else + the empty string. The value is a string, or ‘None’. + + -- Attribute: Node.namespaceURI + + The namespace associated with the element name. This will be a + string or ‘None’. This is a read-only attribute. + + -- Attribute: Node.nodeName + + This has a different meaning for each node type; see the DOM + specification for details. You can always get the information you + would get here from another property such as the ‘tagName’ property + for elements or the ‘name’ property for attributes. For all node + types, the value of this attribute will be either a string or + ‘None’. This is a read-only attribute. + + -- Attribute: Node.nodeValue + + This has a different meaning for each node type; see the DOM + specification for details. The situation is similar to that with + *note nodeName: 37f0. The value is a string or ‘None’. + + -- Method: Node.hasAttributes () + + Return ‘True’ if the node has any attributes. + + -- Method: Node.hasChildNodes () + + Return ‘True’ if the node has any child nodes. + + -- Method: Node.isSameNode (other) + + Return ‘True’ if 'other' refers to the same node as this node. + This is especially useful for DOM implementations which use any + sort of proxy architecture (because more than one object can refer + to the same node). + + Note: This is based on a proposed DOM Level 3 API which is + still in the “working draft” stage, but this particular + interface appears uncontroversial. Changes from the W3C will + not necessarily affect this method in the Python DOM interface + (though any new W3C API for this would also be supported). + + -- Method: Node.appendChild (newChild) + + Add a new child node to this node at the end of the list of + children, returning 'newChild'. If the node was already in the + tree, it is removed first. + + -- Method: Node.insertBefore (newChild, refChild) + + Insert a new child node before an existing child. It must be the + case that 'refChild' is a child of this node; if not, *note + ValueError: 204. is raised. 'newChild' is returned. If 'refChild' + is ‘None’, it inserts 'newChild' at the end of the children’s list. + + -- Method: Node.removeChild (oldChild) + + Remove a child node. 'oldChild' must be a child of this node; if + not, *note ValueError: 204. is raised. 'oldChild' is returned on + success. If 'oldChild' will not be used further, its ‘unlink()’ + method should be called. + + -- Method: Node.replaceChild (newChild, oldChild) + + Replace an existing node with a new node. It must be the case that + 'oldChild' is a child of this node; if not, *note ValueError: 204. + is raised. + + -- Method: Node.normalize () + + Join adjacent text nodes so that all stretches of text are stored + as single ‘Text’ instances. This simplifies processing text from a + DOM tree for many applications. + + -- Method: Node.cloneNode (deep) + + Clone this node. Setting 'deep' means to clone all child nodes as + well. This returns the clone. + + +File: python.info, Node: NodeList Objects, Next: DocumentType Objects, Prev: Node Objects, Up: Objects in the DOM + +5.21.6.5 NodeList Objects +......................... + +A ‘NodeList’ represents a sequence of nodes. These objects are used in +two ways in the DOM Core recommendation: an ‘Element’ object provides +one as its list of child nodes, and the ‘getElementsByTagName()’ and +‘getElementsByTagNameNS()’ methods of ‘Node’ return objects with this +interface to represent query results. + +The DOM Level 2 recommendation defines one method and one attribute for +these objects: + + -- Method: NodeList.item (i) + + Return the 'i'’th item from the sequence, if there is one, or + ‘None’. The index 'i' is not allowed to be less than zero or + greater than or equal to the length of the sequence. + + -- Attribute: NodeList.length + + The number of nodes in the sequence. + +In addition, the Python DOM interface requires that some additional +support is provided to allow ‘NodeList’ objects to be used as Python +sequences. All ‘NodeList’ implementations must include support for +*note __len__(): 1f63. and *note __getitem__(): 285.; this allows +iteration over the ‘NodeList’ in *note for: 2ec. statements and proper +support for the *note len(): 62a. built-in function. + +If a DOM implementation supports modification of the document, the +‘NodeList’ implementation must also support the *note __setitem__(): +12be. and *note __delitem__(): 12bf. methods. + + +File: python.info, Node: DocumentType Objects, Next: Document Objects, Prev: NodeList Objects, Up: Objects in the DOM + +5.21.6.6 DocumentType Objects +............................. + +Information about the notations and entities declared by a document +(including the external subset if the parser uses it and can provide the +information) is available from a ‘DocumentType’ object. The +‘DocumentType’ for a document is available from the ‘Document’ object’s +‘doctype’ attribute; if there is no ‘DOCTYPE’ declaration for the +document, the document’s ‘doctype’ attribute will be set to ‘None’ +instead of an instance of this interface. + +‘DocumentType’ is a specialization of ‘Node’, and adds the following +attributes: + + -- Attribute: DocumentType.publicId + + The public identifier for the external subset of the document type + definition. This will be a string or ‘None’. + + -- Attribute: DocumentType.systemId + + The system identifier for the external subset of the document type + definition. This will be a URI as a string, or ‘None’. + + -- Attribute: DocumentType.internalSubset + + A string giving the complete internal subset from the document. + This does not include the brackets which enclose the subset. If + the document has no internal subset, this should be ‘None’. + + -- Attribute: DocumentType.name + + The name of the root element as given in the ‘DOCTYPE’ declaration, + if present. + + -- Attribute: DocumentType.entities + + This is a ‘NamedNodeMap’ giving the definitions of external + entities. For entity names defined more than once, only the first + definition is provided (others are ignored as required by the XML + recommendation). This may be ‘None’ if the information is not + provided by the parser, or if no entities are defined. + + -- Attribute: DocumentType.notations + + This is a ‘NamedNodeMap’ giving the definitions of notations. For + notation names defined more than once, only the first definition is + provided (others are ignored as required by the XML + recommendation). This may be ‘None’ if the information is not + provided by the parser, or if no notations are defined. + + +File: python.info, Node: Document Objects, Next: Element Objects<2>, Prev: DocumentType Objects, Up: Objects in the DOM + +5.21.6.7 Document Objects +......................... + +A ‘Document’ represents an entire XML document, including its +constituent elements, attributes, processing instructions, comments etc. +Remember that it inherits properties from ‘Node’. + + -- Attribute: Document.documentElement + + The one and only root element of the document. + + -- Method: Document.createElement (tagName) + + Create and return a new element node. The element is not inserted + into the document when it is created. You need to explicitly + insert it with one of the other methods such as ‘insertBefore()’ or + ‘appendChild()’. + + -- Method: Document.createElementNS (namespaceURI, tagName) + + Create and return a new element with a namespace. The 'tagName' + may have a prefix. The element is not inserted into the document + when it is created. You need to explicitly insert it with one of + the other methods such as ‘insertBefore()’ or ‘appendChild()’. + + -- Method: Document.createTextNode (data) + + Create and return a text node containing the data passed as a + parameter. As with the other creation methods, this one does not + insert the node into the tree. + + -- Method: Document.createComment (data) + + Create and return a comment node containing the data passed as a + parameter. As with the other creation methods, this one does not + insert the node into the tree. + + -- Method: Document.createProcessingInstruction (target, data) + + Create and return a processing instruction node containing the + 'target' and 'data' passed as parameters. As with the other + creation methods, this one does not insert the node into the tree. + + -- Method: Document.createAttribute (name) + + Create and return an attribute node. This method does not + associate the attribute node with any particular element. You must + use ‘setAttributeNode()’ on the appropriate ‘Element’ object to use + the newly created attribute instance. + + -- Method: Document.createAttributeNS (namespaceURI, qualifiedName) + + Create and return an attribute node with a namespace. The + 'tagName' may have a prefix. This method does not associate the + attribute node with any particular element. You must use + ‘setAttributeNode()’ on the appropriate ‘Element’ object to use the + newly created attribute instance. + + -- Method: Document.getElementsByTagName (tagName) + + Search for all descendants (direct children, children’s children, + etc.) with a particular element type name. + + -- Method: Document.getElementsByTagNameNS (namespaceURI, localName) + + Search for all descendants (direct children, children’s children, + etc.) with a particular namespace URI and localname. The + localname is the part of the namespace after the prefix. + + +File: python.info, Node: Element Objects<2>, Next: Attr Objects, Prev: Document Objects, Up: Objects in the DOM + +5.21.6.8 Element Objects +........................ + +‘Element’ is a subclass of ‘Node’, so inherits all the attributes of +that class. + + -- Attribute: Element.tagName + + The element type name. In a namespace-using document it may have + colons in it. The value is a string. + + -- Method: Element.getElementsByTagName (tagName) + + Same as equivalent method in the ‘Document’ class. + + -- Method: Element.getElementsByTagNameNS (namespaceURI, localName) + + Same as equivalent method in the ‘Document’ class. + + -- Method: Element.hasAttribute (name) + + Return ‘True’ if the element has an attribute named by 'name'. + + -- Method: Element.hasAttributeNS (namespaceURI, localName) + + Return ‘True’ if the element has an attribute named by + 'namespaceURI' and 'localName'. + + -- Method: Element.getAttribute (name) + + Return the value of the attribute named by 'name' as a string. If + no such attribute exists, an empty string is returned, as if the + attribute had no value. + + -- Method: Element.getAttributeNode (attrname) + + Return the ‘Attr’ node for the attribute named by 'attrname'. + + -- Method: Element.getAttributeNS (namespaceURI, localName) + + Return the value of the attribute named by 'namespaceURI' and + 'localName' as a string. If no such attribute exists, an empty + string is returned, as if the attribute had no value. + + -- Method: Element.getAttributeNodeNS (namespaceURI, localName) + + Return an attribute value as a node, given a 'namespaceURI' and + 'localName'. + + -- Method: Element.removeAttribute (name) + + Remove an attribute by name. If there is no matching attribute, a + *note NotFoundErr: 381b. is raised. + + -- Method: Element.removeAttributeNode (oldAttr) + + Remove and return 'oldAttr' from the attribute list, if present. + If 'oldAttr' is not present, *note NotFoundErr: 381b. is raised. + + -- Method: Element.removeAttributeNS (namespaceURI, localName) + + Remove an attribute by name. Note that it uses a localName, not a + qname. No exception is raised if there is no matching attribute. + + -- Method: Element.setAttribute (name, value) + + Set an attribute value from a string. + + -- Method: Element.setAttributeNode (newAttr) + + Add a new attribute node to the element, replacing an existing + attribute if necessary if the ‘name’ attribute matches. If a + replacement occurs, the old attribute node will be returned. If + 'newAttr' is already in use, *note InuseAttributeErr: 3820. will be + raised. + + -- Method: Element.setAttributeNodeNS (newAttr) + + Add a new attribute node to the element, replacing an existing + attribute if necessary if the ‘namespaceURI’ and ‘localName’ + attributes match. If a replacement occurs, the old attribute node + will be returned. If 'newAttr' is already in use, *note + InuseAttributeErr: 3820. will be raised. + + -- Method: Element.setAttributeNS (namespaceURI, qname, value) + + Set an attribute value from a string, given a 'namespaceURI' and a + 'qname'. Note that a qname is the whole attribute name. This is + different than above. + + +File: python.info, Node: Attr Objects, Next: NamedNodeMap Objects, Prev: Element Objects<2>, Up: Objects in the DOM + +5.21.6.9 Attr Objects +..................... + +‘Attr’ inherits from ‘Node’, so inherits all its attributes. + + -- Attribute: Attr.name + + The attribute name. In a namespace-using document it may include a + colon. + + -- Attribute: Attr.localName + + The part of the name following the colon if there is one, else the + entire name. This is a read-only attribute. + + -- Attribute: Attr.prefix + + The part of the name preceding the colon if there is one, else the + empty string. + + -- Attribute: Attr.value + + The text value of the attribute. This is a synonym for the + ‘nodeValue’ attribute. + + +File: python.info, Node: NamedNodeMap Objects, Next: Comment Objects, Prev: Attr Objects, Up: Objects in the DOM + +5.21.6.10 NamedNodeMap Objects +.............................. + +‘NamedNodeMap’ does 'not' inherit from ‘Node’. + + -- Attribute: NamedNodeMap.length + + The length of the attribute list. + + -- Method: NamedNodeMap.item (index) + + Return an attribute with a particular index. The order you get the + attributes in is arbitrary but will be consistent for the life of a + DOM. Each item is an attribute node. Get its value with the + ‘value’ attribute. + +There are also experimental methods that give this class more mapping +behavior. You can use them or you can use the standardized +‘getAttribute*()’ family of methods on the ‘Element’ objects. + + +File: python.info, Node: Comment Objects, Next: Text and CDATASection Objects, Prev: NamedNodeMap Objects, Up: Objects in the DOM + +5.21.6.11 Comment Objects +......................... + +‘Comment’ represents a comment in the XML document. It is a subclass of +‘Node’, but cannot have child nodes. + + -- Attribute: Comment.data + + The content of the comment as a string. The attribute contains all + characters between the leading ‘’, but + does not include them. + + +File: python.info, Node: Text and CDATASection Objects, Next: ProcessingInstruction Objects, Prev: Comment Objects, Up: Objects in the DOM + +5.21.6.12 Text and CDATASection Objects +....................................... + +The ‘Text’ interface represents text in the XML document. If the parser +and DOM implementation support the DOM’s XML extension, portions of the +text enclosed in CDATA marked sections are stored in ‘CDATASection’ +objects. These two interfaces are identical, but provide different +values for the ‘nodeType’ attribute. + +These interfaces extend the ‘Node’ interface. They cannot have child +nodes. + + -- Attribute: Text.data + + The content of the text node as a string. + + Note: The use of a ‘CDATASection’ node does not indicate that the + node represents a complete CDATA marked section, only that the + content of the node was part of a CDATA section. A single CDATA + section may be represented by more than one node in the document + tree. There is no way to determine whether two adjacent + ‘CDATASection’ nodes represent different CDATA marked sections. + + +File: python.info, Node: ProcessingInstruction Objects, Next: Exceptions<20>, Prev: Text and CDATASection Objects, Up: Objects in the DOM + +5.21.6.13 ProcessingInstruction Objects +....................................... + +Represents a processing instruction in the XML document; this inherits +from the ‘Node’ interface and cannot have child nodes. + + -- Attribute: ProcessingInstruction.target + + The content of the processing instruction up to the first + whitespace character. This is a read-only attribute. + + -- Attribute: ProcessingInstruction.data + + The content of the processing instruction following the first + whitespace character. + + +File: python.info, Node: Exceptions<20>, Prev: ProcessingInstruction Objects, Up: Objects in the DOM + +5.21.6.14 Exceptions +.................... + +The DOM Level 2 recommendation defines a single exception, *note +DOMException: 3835, and a number of constants that allow applications to +determine what sort of error occurred. *note DOMException: 3835. +instances carry a *note code: 1a. attribute that provides the +appropriate value for the specific exception. + +The Python DOM interface provides the constants, but also expands the +set of exceptions so that a specific exception exists for each of the +exception codes defined by the DOM. The implementations must raise the +appropriate specific exception, each of which carries the appropriate +value for the *note code: 1a. attribute. + + -- Exception: xml.dom.DOMException + + Base exception class used for all specific DOM exceptions. This + exception class cannot be directly instantiated. + + -- Exception: xml.dom.DomstringSizeErr + + Raised when a specified range of text does not fit into a string. + This is not known to be used in the Python DOM implementations, but + may be received from DOM implementations not written in Python. + + -- Exception: xml.dom.HierarchyRequestErr + + Raised when an attempt is made to insert a node where the node type + is not allowed. + + -- Exception: xml.dom.IndexSizeErr + + Raised when an index or size parameter to a method is negative or + exceeds the allowed values. + + -- Exception: xml.dom.InuseAttributeErr + + Raised when an attempt is made to insert an ‘Attr’ node that is + already present elsewhere in the document. + + -- Exception: xml.dom.InvalidAccessErr + + Raised if a parameter or an operation is not supported on the + underlying object. + + -- Exception: xml.dom.InvalidCharacterErr + + This exception is raised when a string parameter contains a + character that is not permitted in the context it’s being used in + by the XML 1.0 recommendation. For example, attempting to create + an ‘Element’ node with a space in the element type name will cause + this error to be raised. + + -- Exception: xml.dom.InvalidModificationErr + + Raised when an attempt is made to modify the type of a node. + + -- Exception: xml.dom.InvalidStateErr + + Raised when an attempt is made to use an object that is not defined + or is no longer usable. + + -- Exception: xml.dom.NamespaceErr + + If an attempt is made to change any object in a way that is not + permitted with regard to the Namespaces in XML(1) recommendation, + this exception is raised. + + -- Exception: xml.dom.NotFoundErr + + Exception when a node does not exist in the referenced context. + For example, ‘NamedNodeMap.removeNamedItem()’ will raise this if + the node passed in does not exist in the map. + + -- Exception: xml.dom.NotSupportedErr + + Raised when the implementation does not support the requested type + of object or operation. + + -- Exception: xml.dom.NoDataAllowedErr + + This is raised if data is specified for a node which does not + support data. + + -- Exception: xml.dom.NoModificationAllowedErr + + Raised on attempts to modify an object where modifications are not + allowed (such as for read-only nodes). + + -- Exception: xml.dom.SyntaxErr + + Raised when an invalid or illegal string is specified. + + -- Exception: xml.dom.WrongDocumentErr + + Raised when a node is inserted in a different document than it + currently belongs to, and the implementation does not support + migrating the node from one document to the other. + +The exception codes defined in the DOM recommendation map to the +exceptions described above according to this table: + +Constant Exception + +--------------------------------------------------------------------------------- + +‘DOMSTRING_SIZE_ERR’ *note DomstringSizeErr: 3836. + + +‘HIERARCHY_REQUEST_ERR’ *note HierarchyRequestErr: 3837. + + +‘INDEX_SIZE_ERR’ *note IndexSizeErr: 3838. + + +‘INUSE_ATTRIBUTE_ERR’ *note InuseAttributeErr: 3820. + + +‘INVALID_ACCESS_ERR’ *note InvalidAccessErr: 3839. + + +‘INVALID_CHARACTER_ERR’ *note InvalidCharacterErr: 383a. + + +‘INVALID_MODIFICATION_ERR’ *note InvalidModificationErr: 383b. + + +‘INVALID_STATE_ERR’ *note InvalidStateErr: 383c. + + +‘NAMESPACE_ERR’ *note NamespaceErr: 383d. + + +‘NOT_FOUND_ERR’ *note NotFoundErr: 381b. + + +‘NOT_SUPPORTED_ERR’ *note NotSupportedErr: 383e. + + +‘NO_DATA_ALLOWED_ERR’ *note NoDataAllowedErr: 383f. + + +‘NO_MODIFICATION_ALLOWED_ERR’ *note NoModificationAllowedErr: 3840. + + +‘SYNTAX_ERR’ *note SyntaxErr: 3841. + + +‘WRONG_DOCUMENT_ERR’ *note WrongDocumentErr: 3842. + + + ---------- Footnotes ---------- + + (1) https://www.w3.org/TR/REC-xml-names/ + + +File: python.info, Node: Conformance, Prev: Objects in the DOM, Up: xml dom — The Document Object Model API + +5.21.6.15 Conformance +..................... + +This section describes the conformance requirements and relationships +between the Python DOM API, the W3C DOM recommendations, and the OMG IDL +mapping for Python. + +* Menu: + +* Type Mapping:: +* Accessor Methods:: + + +File: python.info, Node: Type Mapping, Next: Accessor Methods, Up: Conformance + +5.21.6.16 Type Mapping +...................... + +The IDL types used in the DOM specification are mapped to Python types +according to the following table. + +IDL Type Python Type + +----------------------------------------------------------------------- + +‘boolean’ ‘bool’ or ‘int’ + + +‘int’ ‘int’ + + +‘long int’ ‘int’ + + +‘unsigned int’ ‘int’ + + +‘DOMString’ ‘str’ or ‘bytes’ + + +‘null’ ‘None’ + + + +File: python.info, Node: Accessor Methods, Prev: Type Mapping, Up: Conformance + +5.21.6.17 Accessor Methods +.......................... + +The mapping from OMG IDL to Python defines accessor functions for IDL +‘attribute’ declarations in much the way the Java mapping does. Mapping +the IDL declarations + + readonly attribute string someValue; + attribute string anotherValue; + +yields three accessor functions: a “get” method for ‘someValue’ +(‘_get_someValue()’), and “get” and “set” methods for ‘anotherValue’ +(‘_get_anotherValue()’ and ‘_set_anotherValue()’). The mapping, in +particular, does not require that the IDL attributes are accessible as +normal Python attributes: ‘object.someValue’ is 'not' required to work, +and may raise an *note AttributeError: 348. + +The Python DOM API, however, 'does' require that normal attribute access +work. This means that the typical surrogates generated by Python IDL +compilers are not likely to work, and wrapper objects may be needed on +the client if the DOM objects are accessed via CORBA. While this does +require some additional consideration for CORBA DOM clients, the +implementers with experience using DOM over CORBA from Python do not +consider this a problem. Attributes that are declared ‘readonly’ may +not restrict write access in all DOM implementations. + +In the Python DOM API, accessor functions are not required. If +provided, they should take the form defined by the Python IDL mapping, +but these methods are considered unnecessary since the attributes are +accessible directly from Python. “Set” accessors should never be +provided for ‘readonly’ attributes. + +The IDL definitions do not fully embody the requirements of the W3C DOM +API, such as the notion of certain objects, such as the return value of +‘getElementsByTagName()’, being “live”. The Python DOM API does not +require implementations to enforce such requirements. + + +File: python.info, Node: xml dom minidom — Minimal DOM implementation, Next: xml dom pulldom — Support for building partial DOM trees, Prev: xml dom — The Document Object Model API, Up: Structured Markup Processing Tools + +5.21.7 ‘xml.dom.minidom’ — Minimal DOM implementation +----------------------------------------------------- + +'Source code:' Lib/xml/dom/minidom.py(1) + +__________________________________________________________________ + +*note xml.dom.minidom: 122. 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: 125. module for their +XML processing instead. + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +DOM applications typically start by parsing some XML into a DOM. With +*note xml.dom.minidom: 122, 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('Some data some more data') + +The *note parse(): 384a. function can take either a filename or an open +file object. + + -- Function: xml.dom.minidom.parse (filename_or_file, parser=None, + bufsize=None) + + Return a ‘Document’ from the given input. 'filename_or_file' may + be either a file name, or a file-like object. 'parser', if given, + must be a SAX2 parser object. This function will change the + document handler of the parser and activate namespace support; + other parser configuration (like setting an entity resolver) must + have been done in advance. + +If you have XML in a string, you can use the *note parseString(): 384b. +function instead: + + -- Function: xml.dom.minidom.parseString (string, parser=None) + + Return a ‘Document’ that represents the 'string'. This method + creates an *note io.StringIO: f22. object for the string and passes + that on to *note parse(): 384a. + +Both functions return a ‘Document’ object representing the content of +the document. + +What the *note parse(): 384a. and *note parseString(): 384b. 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 name +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: 121. package or +the *note xml.dom.minidom: 122. 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) + +Once you have a DOM document object, you can access the parts of your +XML document through its properties and methods. These properties are +defined in the DOM specification. The main property of the document +object is the ‘documentElement’ property. It gives you the main element +in the XML document: the one that holds all others. Here is an example +program: + + dom3 = parseString("Some data") + 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 *note xml.dom.minidom: 122.-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. + +See also +........ + +Document Object Model (DOM) Level 1 Specification(2) + + The W3C recommendation for the DOM supported by *note + xml.dom.minidom: 122. + +* Menu: + +* DOM Objects:: +* DOM Example:: +* minidom and the DOM standard:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/dom/minidom.py + + (2) https://www.w3.org/TR/REC-DOM-Level-1/ + + +File: python.info, Node: DOM Objects, Next: DOM Example, Up: xml dom minidom — Minimal DOM implementation + +5.21.7.1 DOM Objects +.................... + +The definition of the DOM API for Python is given as part of the *note +xml.dom: 121. module documentation. This section lists the differences +between the API and *note xml.dom.minidom: 122. + + -- Method: Node.unlink () + + Break internal references within the DOM so that it will be garbage + collected on versions of Python without cyclic GC. Even when cyclic + GC is available, using this can make large amounts of memory + available sooner, so calling this on DOM objects as soon as they + are no longer needed is good practice. This only needs to be + called on the ‘Document’ object, but may be called on child nodes + to discard children of that node. + + You can avoid calling this method explicitly by using the *note + with: 5ce. statement. The following code will automatically unlink + 'dom' when the ‘with’ block is exited: + + with xml.dom.minidom.parse(datasource) as dom: + ... # Work with dom. + + -- Method: Node.writexml (writer, indent='', addindent='', newl='', + encoding=None, standalone=None) + + Write XML to the writer object. The writer receives texts but not + bytes as input, it should have a ‘write()’ method which matches + that of the file object interface. The 'indent' parameter is the + indentation of the current node. The 'addindent' parameter is the + incremental indentation to use for subnodes of the current one. + The 'newl' parameter specifies the string to use to terminate + newlines. + + For the ‘Document’ node, an additional keyword argument 'encoding' + can be used to specify the encoding field of the XML header. + + Similarly, explicitly stating the 'standalone' argument causes the + standalone document declarations to be added to the prologue of the + XML document. If the value is set to ‘True’, ‘standalone="yes"’ is + added, otherwise it is set to ‘"no"’. Not stating the argument + will omit the declaration from the document. + + Changed in version 3.8: The *note writexml(): 384f. method now + preserves the attribute order specified by the user. + + Changed in version 3.9: The 'standalone' parameter was added. + + -- Method: Node.toxml (encoding=None, standalone=None) + + Return a string or byte string containing the XML represented by + the DOM node. + + With an explicit 'encoding' (1) argument, the result is a byte + string in the specified encoding. With no 'encoding' argument, the + result is a Unicode string, and the XML declaration in the + resulting string does not specify an encoding. Encoding this + string in an encoding other than UTF-8 is likely incorrect, since + UTF-8 is the default encoding of XML. + + The 'standalone' argument behaves exactly as in *note writexml(): + 384f. + + Changed in version 3.8: The *note toxml(): 1492. method now + preserves the attribute order specified by the user. + + Changed in version 3.9: The 'standalone' parameter was added. + + -- Method: Node.toprettyxml (indent='\t', newl='\n', encoding=None, + standalone=None) + + Return a pretty-printed version of the document. 'indent' + specifies the indentation string and defaults to a tabulator; + 'newl' specifies the string emitted at the end of each line and + defaults to ‘\n’. + + The 'encoding' argument behaves like the corresponding argument of + *note toxml(): 1492. + + The 'standalone' argument behaves exactly as in *note writexml(): + 384f. + + Changed in version 3.8: The *note toprettyxml(): 1493. method now + preserves the attribute order specified by the user. + + Changed in version 3.9: The 'standalone' parameter was added. + + ---------- Footnotes ---------- + + (1) The encoding name included in the XML output should conform to +the appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not valid in an XML document’s declaration, even though Python accepts +it as an encoding name. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + +File: python.info, Node: DOM Example, Next: minidom and the DOM standard, Prev: DOM Objects, Up: xml dom minidom — Minimal DOM implementation + +5.21.7.2 DOM Example +.................... + +This example program is a fairly realistic example of a simple program. +In this particular case, we do not take much advantage of the +flexibility of the DOM. + + import xml.dom.minidom + + document = """\ + + Demo slideshow + Slide title + This is a demo + Of a program for processing slides + + + Another demo slide + It is important + To have more than + one slide + + + """ + + 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("") + handleSlideshowTitle(slideshow.getElementsByTagName("title")[0]) + slides = slideshow.getElementsByTagName("slide") + handleToc(slides) + handleSlides(slides) + print("") + + 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"{getText(title.childNodes)}") + + def handleSlideTitle(title): + print(f"

{getText(title.childNodes)}

") + + def handlePoints(points): + print("
    ") + for point in points: + handlePoint(point) + print("
") + + def handlePoint(point): + print(f"
  • {getText(point.childNodes)}
  • ") + + def handleToc(slides): + for slide in slides: + title = slide.getElementsByTagName("title")[0] + print(f"

    {getText(title.childNodes)}

    ") + + handleSlideshow(dom) + + +File: python.info, Node: minidom and the DOM standard, Prev: DOM Example, Up: xml dom minidom — Minimal DOM implementation + +5.21.7.3 minidom and the DOM standard +..................................... + +The *note xml.dom.minidom: 122. module is essentially a DOM +1.0-compatible DOM with some DOM 2 features (primarily namespace +features). + +Usage of the DOM interface in Python is straight-forward. The following +mapping rules apply: + + * Interfaces are accessed through instance objects. Applications + should not instantiate the classes themselves; they should use the + creator functions available on the ‘Document’ object. Derived + interfaces support all operations (and attributes) from the base + interfaces, plus any new operations. + + * Operations are used as methods. Since the DOM uses only *note in: + 2ee. parameters, the arguments are passed in normal order (from + left to right). There are no optional arguments. ‘void’ + operations return ‘None’. + + * IDL attributes map to instance attributes. For compatibility with + the OMG IDL language mapping for Python, an attribute ‘foo’ can + also be accessed through accessor methods ‘_get_foo()’ and + ‘_set_foo()’. ‘readonly’ attributes must not be changed; this is + not enforced at runtime. + + * The types ‘short int’, ‘unsigned int’, ‘unsigned long long’, and + ‘boolean’ all map to Python integer objects. + + * The type ‘DOMString’ maps to Python strings. *note + xml.dom.minidom: 122. 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’ declarations map to variables in their respective scope + (e.g. ‘xml.dom.minidom.Node.PROCESSING_INSTRUCTION_NODE’); they + must not be changed. + + * ‘DOMException’ is currently not supported in *note xml.dom.minidom: + 122. Instead, *note xml.dom.minidom: 122. uses standard Python + exceptions such as *note TypeError: 534. and *note AttributeError: + 348. + + * ‘NodeList’ objects are implemented using Python’s built-in list + type. These objects provide the interface defined in the DOM + specification, but with earlier versions of Python they do not + support the official API. They are, however, much more “Pythonic” + than the interface defined in the W3C recommendations. + +The following interfaces have no implementation in *note +xml.dom.minidom: 122.: + + * ‘DOMTimeStamp’ + + * ‘EntityReference’ + +Most of these reflect information in the XML document that is not of +general utility to most DOM users. + + +File: python.info, Node: xml dom pulldom — Support for building partial DOM trees, Next: xml sax — Support for SAX2 parsers, Prev: xml dom minidom — Minimal DOM implementation, Up: Structured Markup Processing Tools + +5.21.8 ‘xml.dom.pulldom’ — Support for building partial DOM trees +----------------------------------------------------------------- + +'Source code:' Lib/xml/dom/pulldom.py(1) + +__________________________________________________________________ + +The *note xml.dom.pulldom: 123. 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. + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +Changed in version 3.7.1: The SAX parser no longer processes general +external entities by default to increase security by default. To enable +processing of external entities, pass a custom parser instance in: + + 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) + +Example: + + 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’ is a constant and can be one of: + + * ‘START_ELEMENT’ + + * ‘END_ELEMENT’ + + * ‘COMMENT’ + + * ‘START_DOCUMENT’ + + * ‘END_DOCUMENT’ + + * ‘CHARACTERS’ + + * ‘PROCESSING_INSTRUCTION’ + + * ‘IGNORABLE_WHITESPACE’ + +‘node’ is an object of type ‘xml.dom.minidom.Document’, +‘xml.dom.minidom.Element’ or ‘xml.dom.minidom.Text’. + +Since the document is treated as a “flat” stream of events, the document +“tree” is implicitly traversed and the desired elements are found +regardless of their depth in the tree. In other words, one does not +need to consider hierarchical issues such as recursive searching of the +document nodes, although if the context of elements were important, one +would either need to maintain some context-related state (i.e. +remembering where one is in the document at any given point) or to make +use of the *note DOMEventStream.expandNode(): 3856. method and switch to +DOM-related processing. + + -- Class: xml.dom.pulldom.PullDom (documentFactory=None) + + Subclass of *note xml.sax.handler.ContentHandler: 3858. + + -- Class: xml.dom.pulldom.SAX2DOM (documentFactory=None) + + Subclass of *note xml.sax.handler.ContentHandler: 3858. + + -- Function: xml.dom.pulldom.parse (stream_or_string, parser=None, + bufsize=None) + + Return a *note DOMEventStream: 730. from the given input. + 'stream_or_string' may be either a file name, or a file-like + object. 'parser', if given, must be an *note XMLReader: 385b. + object. This function will change the document handler of the + parser and activate namespace support; other parser configuration + (like setting an entity resolver) must have been done in advance. + +If you have XML in a string, you can use the *note parseString(): 385c. +function instead: + + -- Function: xml.dom.pulldom.parseString (string, parser=None) + + Return a *note DOMEventStream: 730. that represents the (Unicode) + 'string'. + + -- Data: xml.dom.pulldom.default_bufsize + + Default value for the 'bufsize' parameter to *note parse(): 385a. + + The value of this variable can be changed before calling *note + parse(): 385a. and the new value will take effect. + +* Menu: + +* DOMEventStream Objects:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/dom/pulldom.py + + +File: python.info, Node: DOMEventStream Objects, Up: xml dom pulldom — Support for building partial DOM trees + +5.21.8.1 DOMEventStream Objects +............................... + + -- Class: xml.dom.pulldom.DOMEventStream (stream, parser, bufsize) + + Changed in version 3.11: Support for *note __getitem__(): 285. + method has been removed. + + -- Method: getEvent () + + Return a tuple containing 'event' and the current 'node' as + ‘xml.dom.minidom.Document’ if event equals ‘START_DOCUMENT’, + ‘xml.dom.minidom.Element’ if event equals ‘START_ELEMENT’ or + ‘END_ELEMENT’ or ‘xml.dom.minidom.Text’ if event equals + ‘CHARACTERS’. The current node does not contain information + about its children, unless *note expandNode(): 3856. is + called. + + -- Method: expandNode (node) + + Expands all children of 'node' into 'node'. Example: + + from xml.dom import pulldom + + xml = 'Foo

    Some text

    and more

    ' + doc = pulldom.parseString(xml) + for event, node in doc: + if event == pulldom.START_ELEMENT and node.tagName == 'p': + # Following statement only prints '

    ' + print(node.toxml()) + doc.expandNode(node) + # Following statement prints node with all its children '

    Some text

    and more

    ' + print(node.toxml()) + + -- Method: reset () + + +File: python.info, Node: xml sax — Support for SAX2 parsers, Next: xml sax handler — Base classes for SAX handlers, Prev: xml dom pulldom — Support for building partial DOM trees, Up: Structured Markup Processing Tools + +5.21.9 ‘xml.sax’ — Support for SAX2 parsers +------------------------------------------- + +'Source code:' Lib/xml/sax/__init__.py(1) + +__________________________________________________________________ + +The *note xml.sax: 129. 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. + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +Changed in version 3.7.1: The SAX parser no longer processes general +external entities by default to increase security. Before, the parser +created network connections to fetch remote files or loaded local files +from the file system for DTD and entities. The feature can be enabled +again with method *note setFeature(): 3864. on the parser object and +argument *note feature_external_ges: 3865. + +The convenience functions are: + + -- Function: xml.sax.make_parser (parser_list=[]) + + Create and return a SAX *note XMLReader: 385b. object. The first + parser found will be used. If 'parser_list' is provided, it must + be an iterable of strings which name modules that have a function + named ‘create_parser()’. Modules listed in 'parser_list' will be + used before modules in the default list of parsers. + + Changed in version 3.8: The 'parser_list' argument can be any + iterable, not just a list. + + -- Function: xml.sax.parse (filename_or_stream, handler, + error_handler=handler.ErrorHandler()) + + Create a SAX parser and use it to parse a document. The document, + passed in as 'filename_or_stream', can be a filename or a file + object. The 'handler' parameter needs to be a SAX *note + ContentHandler: 3858. instance. If 'error_handler' is given, it + must be a SAX *note ErrorHandler: 3866. instance; if omitted, *note + SAXParseException: 3867. will be raised on all errors. There is no + return value; all work must be done by the 'handler' passed in. + + -- Function: xml.sax.parseString (string, handler, + error_handler=handler.ErrorHandler()) + + Similar to *note parse(): 1a03, but parses from a buffer 'string' + received as a parameter. 'string' must be a *note str: 447. + instance or a *note bytes-like object: d2d. + + Changed in version 3.5: Added support of *note str: 447. instances. + +A typical SAX application uses three kinds of objects: readers, handlers +and input sources. “Reader” in this context is another term for parser, +i.e. some piece of code that reads the bytes or characters from the +input source, and produces a sequence of events. The events then get +distributed to the handler objects, i.e. the reader invokes a method on +the handler. A SAX application must therefore obtain a reader object, +create or open the input sources, create the handlers, and connect these +objects all together. As the final step of preparation, the reader is +called to parse the input. During parsing, methods on the handler +objects are called based on structural and syntactic events from the +input data. + +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: e94, *note Locator: +3868, ‘Attributes’, ‘AttributesNS’, and *note XMLReader: 385b. +interfaces are defined in the module *note xml.sax.xmlreader: 12c. The +handler interfaces are defined in *note xml.sax.handler: 12a. For +convenience, *note InputSource: e94. (which is often instantiated +directly) and the handler classes are also available from *note xml.sax: +129. These interfaces are described below. + +In addition to these classes, *note xml.sax: 129. provides the following +exception classes. + + -- Exception: xml.sax.SAXException (msg, exception=None) + + Encapsulate an XML error or warning. This class can contain basic + error or warning information from either the XML parser or the + application: it can be subclassed to provide additional + functionality or to add localization. Note that although the + handlers defined in the *note ErrorHandler: 3866. interface receive + instances of this exception, it is not required to actually raise + the exception — it is also useful as a container for information. + + When instantiated, 'msg' should be a human-readable description of + the error. The optional 'exception' parameter, if given, should be + ‘None’ or an exception that was caught by the parsing code and is + being passed along as information. + + This is the base class for the other SAX exception classes. + + -- Exception: xml.sax.SAXParseException (msg, exception, locator) + + Subclass of *note SAXException: 3869. raised on parse errors. + Instances of this class are passed to the methods of the SAX *note + ErrorHandler: 3866. interface to provide information about the + parse error. This class supports the SAX *note Locator: 3868. + interface as well as the *note SAXException: 3869. interface. + + -- Exception: xml.sax.SAXNotRecognizedException (msg, exception=None) + + Subclass of *note SAXException: 3869. raised when a SAX *note + XMLReader: 385b. is confronted with an unrecognized feature or + property. SAX applications and extensions may use this class for + similar purposes. + + -- Exception: xml.sax.SAXNotSupportedException (msg, exception=None) + + Subclass of *note SAXException: 3869. raised when a SAX *note + XMLReader: 385b. is asked to enable a feature that is not + supported, or to set a property to a value that the implementation + does not support. SAX applications and extensions may use this + class for similar purposes. + +See also +........ + +SAX: The Simple API for XML(2) + + This site is the focal point for the definition of the SAX API. It + provides a Java implementation and online documentation. Links to + implementations and historical information are also available. + +Module *note xml.sax.handler: 12a. + + Definitions of the interfaces for application-provided objects. + +Module *note xml.sax.saxutils: 12b. + + Convenience functions for use in SAX applications. + +Module *note xml.sax.xmlreader: 12c. + + Definitions of the interfaces for parser-provided objects. + +* Menu: + +* SAXException Objects:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/sax/__init__.py + + (2) http://www.saxproject.org/ + + +File: python.info, Node: SAXException Objects, Up: xml sax — Support for SAX2 parsers + +5.21.9.1 SAXException Objects +............................. + +The *note SAXException: 3869. exception class supports the following +methods: + + -- Method: SAXException.getMessage () + + Return a human-readable message describing the error condition. + + -- Method: SAXException.getException () + + Return an encapsulated exception object, or ‘None’. + + +File: python.info, Node: xml sax handler — Base classes for SAX handlers, Next: xml sax saxutils — SAX Utilities, Prev: xml sax — Support for SAX2 parsers, Up: Structured Markup Processing Tools + +5.21.10 ‘xml.sax.handler’ — Base classes for SAX handlers +--------------------------------------------------------- + +'Source code:' 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 *note +xml.sax.handler: 12a, so that all methods get default implementations. + + -- Class: xml.sax.handler.ContentHandler + + This is the main callback interface in SAX, and the one most + important to applications. The order of events in this interface + mirrors the order of the information in the document. + + -- Class: xml.sax.handler.DTDHandler + + Handle DTD events. + + This interface specifies only those DTD events required for basic + parsing (unparsed entities and attributes). + + -- Class: xml.sax.handler.EntityResolver + + Basic interface for resolving entities. If you create an object + implementing this interface, then register the object with your + Parser, the parser will call the method in your object to resolve + all external entities. + + -- Class: xml.sax.handler.ErrorHandler + + Interface used by the parser to present error and warning messages + to the application. The methods of this object control whether + errors are immediately converted to exceptions or are handled in + some other way. + + -- Class: 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, *note xml.sax.handler: 12a. provides +symbolic constants for the feature and property names. + + -- Data: xml.sax.handler.feature_namespaces + + value: ‘"http://xml.org/sax/features/namespaces"’ + true: Perform Namespace processing. + false: Optionally do not perform Namespace processing (implies namespace-prefixes; default). + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.feature_namespace_prefixes + + value: ‘"http://xml.org/sax/features/namespace-prefixes"’ + true: Report the original prefixed names and attributes used for Namespace declarations. + false: Do not report attributes used for Namespace declarations, and optionally do not report original prefixed names (default). + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.feature_string_interning + + value: ‘"http://xml.org/sax/features/string-interning"’ + true: All element names, prefixes, attribute names, Namespace URIs, and local names are interned using the built-in intern function. + false: Names are not necessarily interned, although they may be (default). + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.feature_validation + + value: ‘"http://xml.org/sax/features/validation"’ + true: Report all validation errors (implies external-general-entities and external-parameter-entities). + false: Do not report validation errors. + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.feature_external_ges + + value: ‘"http://xml.org/sax/features/external-general-entities"’ + true: Include all external general (text) entities. + false: Do not include external general entities. + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.feature_external_pes + + value: ‘"http://xml.org/sax/features/external-parameter-entities"’ + true: Include all external parameter entities, including the external DTD subset. + false: Do not include any external parameter entities, even the external DTD subset. + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.all_features + + List of all features. + + -- Data: xml.sax.handler.property_lexical_handler + + value: ‘"http://xml.org/sax/properties/lexical-handler"’ + data type: xml.sax.handler.LexicalHandler (not supported in Python 2) + description: An optional extension handler for lexical events like comments. + access: read/write + + -- Data: xml.sax.handler.property_declaration_handler + + value: ‘"http://xml.org/sax/properties/declaration-handler"’ + data type: xml.sax.sax2lib.DeclHandler (not supported in Python 2) + description: An optional extension handler for DTD-related events other than notations and unparsed entities. + access: read/write + + -- Data: xml.sax.handler.property_dom_node + + value: ‘"http://xml.org/sax/properties/dom-node"’ + data type: org.w3c.dom.Node (not supported in Python 2) + description: When parsing, the current DOM node being visited if this is a DOM iterator; when not parsing, the root DOM node for iteration. + access: (parsing) read-only; (not parsing) read/write + + -- Data: xml.sax.handler.property_xml_string + + value: ‘"http://xml.org/sax/properties/xml-string"’ + data type: Bytes + description: The literal string of characters that was the source for the current event. + access: read-only + + -- Data: xml.sax.handler.all_properties + + List of all known property names. + +* Menu: + +* ContentHandler Objects:: +* DTDHandler Objects:: +* EntityResolver Objects:: +* ErrorHandler Objects:: +* LexicalHandler Objects:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/sax/handler.py + + +File: python.info, Node: ContentHandler Objects, Next: DTDHandler Objects, Up: xml sax handler — Base classes for SAX handlers + +5.21.10.1 ContentHandler Objects +................................ + +Users are expected to subclass *note ContentHandler: 3858. to support +their application. The following methods are called by the parser on +the appropriate events in the input document: + + -- Method: ContentHandler.setDocumentLocator (locator) + + Called by the parser to give the application a locator for locating + the origin of document events. + + SAX parsers are strongly encouraged (though not absolutely + required) to supply a locator: if it does so, it must supply the + locator to the application by invoking this method before invoking + any of the other methods in the DocumentHandler interface. + + The locator allows the application to determine the end position of + any document-related event, even if the parser is not reporting an + error. Typically, the application will use this information for + reporting its own errors (such as character content that does not + match an application’s business rules). The information returned + by the locator is probably not sufficient for use with a search + engine. + + Note that the locator will return correct information only during + the invocation of the events in this interface. The application + should not attempt to use it at any other time. + + -- Method: ContentHandler.startDocument () + + Receive notification of the beginning of a document. + + The SAX parser will invoke this method only once, before any other + methods in this interface or in DTDHandler (except for *note + setDocumentLocator(): 3881.). + + -- Method: ContentHandler.endDocument () + + Receive notification of the end of a document. + + The SAX parser will invoke this method only once, and it will be + the last method invoked during the parse. The parser shall not + invoke this method until it has either abandoned parsing (because + of an unrecoverable error) or reached the end of input. + + -- Method: ContentHandler.startPrefixMapping (prefix, uri) + + Begin the scope of a prefix-URI Namespace mapping. + + The information from this event is not necessary for normal + Namespace processing: the SAX XML reader will automatically replace + prefixes for element and attribute names when the + ‘feature_namespaces’ feature is enabled (the default). + + There are cases, however, when applications need to use prefixes in + character data or in attribute values, where they cannot safely be + expanded automatically; the *note startPrefixMapping(): 3884. and + *note endPrefixMapping(): 3885. events supply the information to + the application to expand prefixes in those contexts itself, if + necessary. + + Note that *note startPrefixMapping(): 3884. and *note + endPrefixMapping(): 3885. events are not guaranteed to be properly + nested relative to each-other: all *note startPrefixMapping(): + 3884. events will occur before the corresponding *note + startElement(): 150d. event, and all *note endPrefixMapping(): + 3885. events will occur after the corresponding *note endElement(): + 150e. event, but their order is not guaranteed. + + -- Method: ContentHandler.endPrefixMapping (prefix) + + End the scope of a prefix-URI mapping. + + See *note startPrefixMapping(): 3884. for details. This event will + always occur after the corresponding *note endElement(): 150e. + event, but the order of *note endPrefixMapping(): 3885. events is + not otherwise guaranteed. + + -- Method: ContentHandler.startElement (name, attrs) + + Signals the start of an element in non-namespace mode. + + 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 + ‘Attributes’ interface (see *note The Attributes Interface: 3886.) + 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(): 25. method of the + 'attrs' object. + + -- Method: ContentHandler.endElement (name) + + Signals the end of an element in non-namespace mode. + + The 'name' parameter contains the name of the element type, just as + with the *note startElement(): 150d. event. + + -- Method: ContentHandler.startElementNS (name, qname, attrs) + + Signals the start of an element in namespace mode. + + 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 ‘AttributesNS’ interface (see *note The + AttributesNS Interface: 3888.) 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(): 25. method of the + 'attrs' object. + + Parsers may set the 'qname' parameter to ‘None’, unless the + ‘feature_namespace_prefixes’ feature is activated. + + -- Method: ContentHandler.endElementNS (name, qname) + + Signals the end of an element in namespace mode. + + The 'name' parameter contains the name of the element type, just as + with the *note startElementNS(): 3887. method, likewise the 'qname' + parameter. + + -- Method: ContentHandler.characters (content) + + Receive notification of character data. + + The Parser will call this method to report each chunk of character + data. SAX parsers may return all contiguous character data in a + single chunk, or they may split it into several chunks; however, + all of the characters in any single event must come from the same + external entity so that the Locator provides useful information. + + 'content' may be a string or bytes instance; the ‘expat’ reader + module always produces strings. + + Note: The earlier SAX 1 interface provided by the Python XML + Special Interest Group used a more Java-like interface for + this method. Since most parsers used from Python did not take + advantage of the older interface, the simpler signature was + chosen to replace it. To convert old code to the new + interface, use 'content' instead of slicing content with the + old 'offset' and 'length' parameters. + + -- Method: ContentHandler.ignorableWhitespace (whitespace) + + Receive notification of ignorable whitespace in element content. + + Validating Parsers must use this method to report each chunk of + ignorable whitespace (see the W3C XML 1.0 recommendation, section + 2.10): non-validating parsers may also use this method if they are + capable of parsing and using content models. + + SAX parsers may return all contiguous whitespace in a single chunk, + or they may split it into several chunks; however, all of the + characters in any single event must come from the same external + entity, so that the Locator provides useful information. + + -- Method: ContentHandler.processingInstruction (target, data) + + Receive notification of a processing instruction. + + The Parser will invoke this method once for each processing + instruction found: note that processing instructions may occur + before or after the main document element. + + A SAX parser should never report an XML declaration (XML 1.0, + section 2.8) or a text declaration (XML 1.0, section 4.3.1) using + this method. + + -- Method: ContentHandler.skippedEntity (name) + + Receive notification of a skipped entity. + + The Parser will invoke this method once for each entity skipped. + Non-validating processors may skip entities if they have not seen + the declarations (because, for example, the entity was declared in + an external DTD subset). All processors may skip external + entities, depending on the values of the ‘feature_external_ges’ and + the ‘feature_external_pes’ properties. + + +File: python.info, Node: DTDHandler Objects, Next: EntityResolver Objects, Prev: ContentHandler Objects, Up: xml sax handler — Base classes for SAX handlers + +5.21.10.2 DTDHandler Objects +............................ + +*note DTDHandler: 3872. instances provide the following methods: + + -- Method: DTDHandler.notationDecl (name, publicId, systemId) + + Handle a notation declaration event. + + -- Method: DTDHandler.unparsedEntityDecl (name, publicId, systemId, + ndata) + + Handle an unparsed entity declaration event. + + +File: python.info, Node: EntityResolver Objects, Next: ErrorHandler Objects, Prev: DTDHandler Objects, Up: xml sax handler — Base classes for SAX handlers + +5.21.10.3 EntityResolver Objects +................................ + + -- Method: EntityResolver.resolveEntity (publicId, systemId) + + Resolve the system identifier of an entity and return either the + system identifier to read from as a string, or an InputSource to + read from. The default implementation returns 'systemId'. + + +File: python.info, Node: ErrorHandler Objects, Next: LexicalHandler Objects, Prev: EntityResolver Objects, Up: xml sax handler — Base classes for SAX handlers + +5.21.10.4 ErrorHandler Objects +.............................. + +Objects with this interface are used to receive error and warning +information from the *note XMLReader: 385b. If you create an object +that implements this interface, then register the object with your *note +XMLReader: 385b, 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: 3867. as the only +parameter. Errors and warnings may be converted to an exception by +raising the passed-in exception object. + + -- Method: ErrorHandler.error (exception) + + Called when the parser encounters a recoverable error. If this + method does not raise an exception, parsing may continue, but + further document information should not be expected by the + application. Allowing the parser to continue may allow additional + errors to be discovered in the input document. + + -- Method: ErrorHandler.fatalError (exception) + + Called when the parser encounters an error it cannot recover from; + parsing is expected to terminate when this method returns. + + -- Method: ErrorHandler.warning (exception) + + Called when the parser presents minor warning information to the + application. Parsing is expected to continue when this method + returns, and document information will continue to be passed to the + application. Raising an exception in this method will cause + parsing to end. + + +File: python.info, Node: LexicalHandler Objects, Prev: ErrorHandler Objects, Up: xml sax handler — Base classes for SAX handlers + +5.21.10.5 LexicalHandler Objects +................................ + +Optional SAX2 handler for lexical events. + +This handler is used to obtain lexical information about an XML +document. Lexical information includes information describing the +document encoding used and XML comments embedded in the document, as +well as section boundaries for the DTD and for any CDATA sections. The +lexical handlers are used in the same manner as content handlers. + +Set the LexicalHandler of an XMLReader by using the setProperty method +with the property identifier +‘'http://xml.org/sax/properties/lexical-handler'’. + + -- Method: LexicalHandler.comment (content) + + Reports a comment anywhere in the document (including the DTD and + outside the document element). + + -- Method: LexicalHandler.startDTD (name, public_id, system_id) + + Reports the start of the DTD declarations if the document has an + associated DTD. + + -- Method: LexicalHandler.endDTD () + + Reports the end of DTD declaration. + + -- Method: LexicalHandler.startCDATA () + + Reports the start of a CDATA marked section. + + The contents of the CDATA marked section will be reported through + the characters handler. + + -- Method: LexicalHandler.endCDATA () + + Reports the end of a CDATA marked section. + + +File: python.info, Node: xml sax saxutils — SAX Utilities, Next: xml sax xmlreader — Interface for XML parsers, Prev: xml sax handler — Base classes for SAX handlers, Up: Structured Markup Processing Tools + +5.21.11 ‘xml.sax.saxutils’ — SAX Utilities +------------------------------------------ + +'Source code:' Lib/xml/sax/saxutils.py(1) + +__________________________________________________________________ + +The module *note xml.sax.saxutils: 12b. contains a number of classes and +functions that are commonly useful when creating SAX applications, +either in direct use, or as base classes. + + -- Function: xml.sax.saxutils.escape (data, entities={}) + + Escape ‘'&'’, ‘'<'’, and ‘'>'’ in a string of data. + + You can escape 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. + The characters ‘'&'’, ‘'<'’ and ‘'>'’ are always escaped, even if + 'entities' is provided. + + Note: This function should only be used to escape characters + that can’t be used directly in XML. Do not use this function + as a general string translation function. + + -- Function: xml.sax.saxutils.unescape (data, entities={}) + + Unescape ‘'&'’, ‘'<'’, and ‘'>'’ in a string of data. + + 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. + ‘'&'’, ‘'<'’, and ‘'>'’ are always unescaped, even if + 'entities' is provided. + + -- Function: xml.sax.saxutils.quoteattr (data, entities={}) + + Similar to *note escape(): 38a2, but also prepares 'data' to be + used as an attribute value. The return value is a quoted version + of 'data' with any additional required replacements. *note + quoteattr(): 38a4. will select a quote character based on the + content of 'data', attempting to avoid encoding any quote + characters in the string. If both single- and double-quote + characters are already in 'data', the double-quote characters will + be encoded and 'data' will be wrapped in double-quotes. The + resulting string can be used directly as an attribute value: + + >>> print("" % quoteattr("ab ' cd \" ef")) + + + This function is useful when generating attribute values for HTML + or any SGML using the reference concrete syntax. + + -- Class: xml.sax.saxutils.XMLGenerator (out=None, + encoding='iso-8859-1', short_empty_elements=False) + + This class implements the *note ContentHandler: 3858. interface by + writing SAX events back into an XML document. In other words, + using an *note XMLGenerator: 38a5. as the content handler will + reproduce the original document being parsed. 'out' should be a + file-like object which will default to 'sys.stdout'. 'encoding' is + the encoding of the output stream which defaults to ‘'iso-8859-1'’. + 'short_empty_elements' controls the formatting of elements that + contain no content: if ‘False’ (the default) they are emitted as a + pair of start/end tags, if set to ‘True’ they are emitted as a + single self-closed tag. + + Changed in version 3.2: Added the 'short_empty_elements' parameter. + + -- Class: xml.sax.saxutils.XMLFilterBase (base) + + This class is designed to sit between an *note XMLReader: 385b. and + the client application’s event handlers. By default, it does + nothing but pass requests up to the reader and events on to the + handlers unmodified, but subclasses can override specific methods + to modify the event stream or the configuration requests as they + pass through. + + -- Function: xml.sax.saxutils.prepare_input_source (source, base='') + + This function takes an input source and an optional base URL and + returns a fully resolved *note InputSource: e94. object ready for + reading. The input source can be given as a string, a file-like + object, or an *note InputSource: e94. object; parsers will use this + function to implement the polymorphic 'source' argument to their + *note parse(): 38a8. method. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/sax/saxutils.py + + +File: python.info, Node: xml sax xmlreader — Interface for XML parsers, Next: xml parsers expat — Fast XML parsing using Expat, Prev: xml sax saxutils — SAX Utilities, Up: Structured Markup Processing Tools + +5.21.12 ‘xml.sax.xmlreader’ — Interface for XML parsers +------------------------------------------------------- + +'Source code:' Lib/xml/sax/xmlreader.py(1) + +__________________________________________________________________ + +SAX parsers implement the *note XMLReader: 385b. interface. They are +implemented in a Python module, which must provide a function +‘create_parser()’. This function is invoked by *note +xml.sax.make_parser(): 1a3a. with no arguments to create a new parser +object. + + -- Class: xml.sax.xmlreader.XMLReader + + Base class which can be inherited by SAX parsers. + + -- Class: xml.sax.xmlreader.IncrementalParser + + In some cases, it is desirable not to parse an input source at + once, but to feed chunks of the document as they get available. + Note that the reader will normally not read the entire file, but + read it in chunks as well; still ‘parse()’ won’t return until the + entire document is processed. So these interfaces should be used + if the blocking behaviour of ‘parse()’ is not desirable. + + When the parser is instantiated it is ready to begin accepting data + from the feed method immediately. After parsing has been finished + with a call to close the reset method must be called to make the + parser ready to accept new data, either from feed or using the + parse method. + + Note that these methods must 'not' be called during parsing, that + is, after parse has been called and before it returns. + + By default, the class also implements the parse method of the + XMLReader interface using the feed, close and reset methods of the + IncrementalParser interface as a convenience to SAX 2.0 driver + writers. + + -- Class: xml.sax.xmlreader.Locator + + Interface for associating a SAX event with a document location. A + locator object will return valid results only during calls to + DocumentHandler methods; at any other time, the results are + unpredictable. If information is not available, methods may return + ‘None’. + + -- Class: xml.sax.xmlreader.InputSource (system_id=None) + + Encapsulation of the information needed by the *note XMLReader: + 385b. to read entities. + + This class may include information about the public identifier, + system identifier, byte stream (possibly with character encoding + information) and/or the character stream of an entity. + + Applications will create objects of this class for use in the *note + XMLReader.parse(): 38a8. method and for returning from + EntityResolver.resolveEntity. + + An *note InputSource: e94. belongs to the application, the *note + XMLReader: 385b. is not allowed to modify *note InputSource: e94. + objects passed to it from the application, although it may make + copies and modify those. + + -- Class: xml.sax.xmlreader.AttributesImpl (attrs) + + This is an implementation of the ‘Attributes’ interface (see + section *note The Attributes Interface: 3886.). This is a + dictionary-like object which represents the element attributes in a + ‘startElement()’ call. In addition to the most useful dictionary + operations, it supports a number of other methods as described by + the interface. Objects of this class should be instantiated by + readers; 'attrs' must be a dictionary-like object containing a + mapping from attribute names to attribute values. + + -- Class: xml.sax.xmlreader.AttributesNSImpl (attrs, qnames) + + Namespace-aware variant of *note AttributesImpl: 38ac, which will + be passed to ‘startElementNS()’. It is derived from *note + AttributesImpl: 38ac, but understands attribute names as two-tuples + of 'namespaceURI' and 'localname'. In addition, it provides a + number of methods expecting qualified names as they appear in the + original document. This class implements the ‘AttributesNS’ + interface (see section *note The AttributesNS Interface: 3888.). + +* Menu: + +* XMLReader Objects:: +* IncrementalParser Objects:: +* Locator Objects:: +* InputSource Objects:: +* The Attributes Interface:: +* The AttributesNS Interface:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/xml/sax/xmlreader.py + + +File: python.info, Node: XMLReader Objects, Next: IncrementalParser Objects, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.1 XMLReader Objects +........................... + +The *note XMLReader: 385b. interface supports the following methods: + + -- Method: XMLReader.parse (source) + + Process an input source, producing SAX events. The 'source' object + can be a system identifier (a string identifying the input source – + typically a file name or a URL), a *note pathlib.Path: 22b. or + *note path-like: 2a2. object, or an *note InputSource: e94. object. + When *note parse(): 38a8. returns, the input is completely + processed, and the parser object can be discarded or reset. + + Changed in version 3.5: Added support of character streams. + + Changed in version 3.8: Added support of path-like objects. + + -- Method: XMLReader.getContentHandler () + + Return the current *note ContentHandler: 3858. + + -- Method: XMLReader.setContentHandler (handler) + + Set the current *note ContentHandler: 3858. If no *note + ContentHandler: 3858. is set, content events will be discarded. + + -- Method: XMLReader.getDTDHandler () + + Return the current *note DTDHandler: 3872. + + -- Method: XMLReader.setDTDHandler (handler) + + Set the current *note DTDHandler: 3872. If no *note DTDHandler: + 3872. is set, DTD events will be discarded. + + -- Method: XMLReader.getEntityResolver () + + Return the current *note EntityResolver: 3873. + + -- Method: XMLReader.setEntityResolver (handler) + + Set the current *note EntityResolver: 3873. If no *note + EntityResolver: 3873. is set, attempts to resolve an external + entity will result in opening the system identifier for the entity, + and fail if it is not available. + + -- Method: XMLReader.getErrorHandler () + + Return the current *note ErrorHandler: 3866. + + -- Method: XMLReader.setErrorHandler (handler) + + Set the current error handler. If no *note ErrorHandler: 3866. is + set, errors will be raised as exceptions, and warnings will be + printed. + + -- Method: XMLReader.setLocale (locale) + + Allow an application to set the locale for errors and warnings. + + SAX parsers are not required to provide localization for errors and + warnings; if they cannot support the requested locale, however, + they must raise a SAX exception. Applications may request a locale + change in the middle of a parse. + + -- Method: XMLReader.getFeature (featurename) + + Return the current setting for feature 'featurename'. If the + feature is not recognized, ‘SAXNotRecognizedException’ is raised. + The well-known featurenames are listed in the module *note + xml.sax.handler: 12a. + + -- Method: XMLReader.setFeature (featurename, value) + + Set the 'featurename' to 'value'. If the feature is not + recognized, ‘SAXNotRecognizedException’ is raised. If the feature + or its setting is not supported by the parser, + 'SAXNotSupportedException' is raised. + + -- Method: XMLReader.getProperty (propertyname) + + Return the current setting for property 'propertyname'. If the + property is not recognized, a ‘SAXNotRecognizedException’ is + raised. The well-known propertynames are listed in the module + *note xml.sax.handler: 12a. + + -- Method: XMLReader.setProperty (propertyname, value) + + Set the 'propertyname' to 'value'. If the property is not + recognized, ‘SAXNotRecognizedException’ is raised. If the property + or its setting is not supported by the parser, + 'SAXNotSupportedException' is raised. + + +File: python.info, Node: IncrementalParser Objects, Next: Locator Objects, Prev: XMLReader Objects, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.2 IncrementalParser Objects +................................... + +Instances of *note IncrementalParser: 38ab. offer the following +additional methods: + + -- Method: IncrementalParser.feed (data) + + Process a chunk of 'data'. + + -- Method: IncrementalParser.close () + + Assume the end of the document. That will check well-formedness + conditions that can be checked only at the end, invoke handlers, + and may clean up resources allocated during parsing. + + -- Method: IncrementalParser.reset () + + This method is called after close has been called to reset the + parser so that it is ready to parse new documents. The results of + calling parse or feed after close without calling reset are + undefined. + + +File: python.info, Node: Locator Objects, Next: InputSource Objects, Prev: IncrementalParser Objects, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.3 Locator Objects +......................... + +Instances of *note Locator: 3868. provide these methods: + + -- Method: Locator.getColumnNumber () + + Return the column number where the current event begins. + + -- Method: Locator.getLineNumber () + + Return the line number where the current event begins. + + -- Method: Locator.getPublicId () + + Return the public identifier for the current event. + + -- Method: Locator.getSystemId () + + Return the system identifier for the current event. + + +File: python.info, Node: InputSource Objects, Next: The Attributes Interface, Prev: Locator Objects, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.4 InputSource Objects +............................. + + -- Method: InputSource.setPublicId (id) + + Sets the public identifier of this *note InputSource: e94. + + -- Method: InputSource.getPublicId () + + Returns the public identifier of this *note InputSource: e94. + + -- Method: InputSource.setSystemId (id) + + Sets the system identifier of this *note InputSource: e94. + + -- Method: InputSource.getSystemId () + + Returns the system identifier of this *note InputSource: e94. + + -- Method: InputSource.setEncoding (encoding) + + Sets the character encoding of this *note InputSource: e94. + + The encoding must be a string acceptable for an XML encoding + declaration (see section 4.3.3 of the XML recommendation). + + The encoding attribute of the *note InputSource: e94. is ignored if + the *note InputSource: e94. also contains a character stream. + + -- Method: InputSource.getEncoding () + + Get the character encoding of this InputSource. + + -- Method: InputSource.setByteStream (bytefile) + + Set the byte stream (a *note binary file: 1c87.) for this input + source. + + The SAX parser will ignore this if there is also a character stream + specified, but it will use a byte stream in preference to opening a + URI connection itself. + + If the application knows the character encoding of the byte stream, + it should set it with the setEncoding method. + + -- Method: InputSource.getByteStream () + + Get the byte stream for this input source. + + The getEncoding method will return the character encoding for this + byte stream, or ‘None’ if unknown. + + -- Method: InputSource.setCharacterStream (charfile) + + Set the character stream (a *note text file: 1c86.) for this input + source. + + If there is a character stream specified, the SAX parser will + ignore any byte stream and will not attempt to open a URI + connection to the system identifier. + + -- Method: InputSource.getCharacterStream () + + Get the character stream for this input source. + + +File: python.info, Node: The Attributes Interface, Next: The AttributesNS Interface, Prev: InputSource Objects, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.5 The ‘Attributes’ Interface +.................................... + +‘Attributes’ objects implement a portion of the *note mapping protocol: +11ae, including the methods ‘copy()’, ‘get()’, *note __contains__(): +1f5e, ‘items()’, ‘keys()’, and ‘values()’. The following methods are +also provided: + + -- Method: Attributes.getLength () + + Return the number of attributes. + + -- Method: Attributes.getNames () + + Return the names of the attributes. + + -- Method: Attributes.getType (name) + + Returns the type of the attribute 'name', which is normally + ‘'CDATA'’. + + -- Method: Attributes.getValue (name) + + Return the value of attribute 'name'. + + +File: python.info, Node: The AttributesNS Interface, Prev: The Attributes Interface, Up: xml sax xmlreader — Interface for XML parsers + +5.21.12.6 The ‘AttributesNS’ Interface +...................................... + +This interface is a subtype of the ‘Attributes’ interface (see section +*note The Attributes Interface: 3886.). All methods supported by that +interface are also available on ‘AttributesNS’ objects. + +The following methods are also available: + + -- Method: AttributesNS.getValueByQName (name) + + Return the value for a qualified name. + + -- Method: AttributesNS.getNameByQName (name) + + Return the ‘(namespace, localname)’ pair for a qualified 'name'. + + -- Method: AttributesNS.getQNameByName (name) + + Return the qualified name for a ‘(namespace, localname)’ pair. + + -- Method: AttributesNS.getQNames () + + Return the qualified names of all attributes. + + +File: python.info, Node: xml parsers expat — Fast XML parsing using Expat, Prev: xml sax xmlreader — Interface for XML parsers, Up: Structured Markup Processing Tools + +5.21.13 ‘xml.parsers.expat’ — Fast XML parsing using Expat +---------------------------------------------------------- + +__________________________________________________________________ + + Note: If you need to parse untrusted or unauthenticated data, see + *note XML security: 3774. + +The *note xml.parsers.expat: 126. 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. + +This module uses the ‘pyexpat’ module to provide access to the Expat +parser. Direct use of the ‘pyexpat’ module is deprecated. + +This module provides one exception and one type object: + + -- Exception: xml.parsers.expat.ExpatError + + The exception raised when Expat reports an error. See section + *note ExpatError Exceptions: 38df. for more information on + interpreting Expat errors. + + -- Exception: xml.parsers.expat.error + + Alias for *note ExpatError: 126c. + + -- Data: xml.parsers.expat.XMLParserType + + The type of the return values from the *note ParserCreate(): 38e2. + function. + +The *note xml.parsers.expat: 126. module contains two functions: + + -- Function: xml.parsers.expat.ErrorString (errno) + + Returns an explanatory string for a given error number 'errno'. + + -- Function: xml.parsers.expat.ParserCreate (encoding=None, + namespace_separator=None) + + Creates and returns a new ‘xmlparser’ object. 'encoding', if + specified, must be a string naming the encoding used by the XML + data. Expat doesn’t support as many encodings as Python does, and + its repertoire of encodings can’t be extended; it supports UTF-8, + UTF-16, ISO-8859-1 (Latin1), and ASCII. If 'encoding' (1) is given + it will override the implicit or explicit encoding of the document. + + Expat can optionally do XML namespace processing for you, enabled + by providing a value for 'namespace_separator'. The value must be + a one-character string; a *note ValueError: 204. will be raised if + the string has an illegal length (‘None’ is considered the same as + omission). When namespace processing is enabled, element type + names and attribute names that belong to a namespace will be + expanded. The element name passed to the element handlers + ‘StartElementHandler’ and ‘EndElementHandler’ will be the + concatenation of the namespace URI, the namespace separator + character, and the local part of the name. If the namespace + separator is a zero byte (‘chr(0)’) then the namespace URI and the + local part will be concatenated without any separator. + + For example, if 'namespace_separator' is set to a space character + (‘' '’) and the following document is parsed: + + + + + + + + ‘StartElementHandler’ will receive the following strings for each + element: + + http://default-namespace.org/ root + http://www.python.org/ns/ elem1 + elem2 + + Due to limitations in the ‘Expat’ library used by ‘pyexpat’, the + ‘xmlparser’ instance returned can only be used to parse a single + XML document. Call ‘ParserCreate’ for each document to provide + unique parser instances. + +See also +........ + +The Expat XML Parser(2) + + Home page of the Expat project. + +* Menu: + +* XMLParser Objects: XMLParser Objects<2>. +* ExpatError Exceptions:: +* Example: Example<10>. +* Content Model Descriptions:: +* Expat error constants:: + + ---------- Footnotes ---------- + + (1) The encoding string included in XML output should conform to the +appropriate standards. For example, “UTF-8” is valid, but “UTF8” is +not. See +‘https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl’ and +‘https://www.iana.org/assignments/character-sets/character-sets.xhtml’. + + (2) http://www.libexpat.org/ + + +File: python.info, Node: XMLParser Objects<2>, Next: ExpatError Exceptions, Up: xml parsers expat — Fast XML parsing using Expat + +5.21.13.1 XMLParser Objects +........................... + +‘xmlparser’ objects have the following methods: + + -- Method: xmlparser.Parse (data[, isfinal]) + + Parses the contents of the string 'data', calling the appropriate + handler functions to process the parsed data. 'isfinal' must be + true on the final call to this method; it allows the parsing of a + single file in fragments, not the submission of multiple files. + 'data' can be the empty string at any time. + + -- Method: xmlparser.ParseFile (file) + + Parse XML data reading from the object 'file'. 'file' only needs + to provide the ‘read(nbytes)’ method, returning the empty string + when there’s no more data. + + -- Method: xmlparser.SetBase (base) + + Sets the base to be used for resolving relative URIs in system + identifiers in declarations. Resolving relative identifiers is + left to the application: this value will be passed through as the + 'base' argument to the *note ExternalEntityRefHandler(): 38e9, + *note NotationDeclHandler(): 38ea, and *note + UnparsedEntityDeclHandler(): 38eb. functions. + + -- Method: xmlparser.GetBase () + + Returns a string containing the base set by a previous call to + *note SetBase(): 38e8, or ‘None’ if *note SetBase(): 38e8. hasn’t + been called. + + -- Method: xmlparser.GetInputContext () + + Returns the input data that generated the current event as a + string. The data is in the encoding of the entity which contains + the text. When called while an event handler is not active, the + return value is ‘None’. + + -- Method: xmlparser.ExternalEntityParserCreate (context[, encoding]) + + Create a “child” parser which can be used to parse an external + parsed entity referred to by content parsed by the parent parser. + The 'context' parameter should be the string passed to the *note + ExternalEntityRefHandler(): 38e9. handler function, described + below. The child parser is created with the *note + ordered_attributes: 38ef. and *note specified_attributes: 38f0. set + to the values of this parser. + + -- Method: xmlparser.SetParamEntityParsing (flag) + + Control parsing of parameter entities (including the external DTD + subset). Possible 'flag' values are + ‘XML_PARAM_ENTITY_PARSING_NEVER’, + ‘XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE’ and + ‘XML_PARAM_ENTITY_PARSING_ALWAYS’. Return true if setting the flag + was successful. + + -- Method: xmlparser.UseForeignDTD ([flag]) + + Calling this with a true value for 'flag' (the default) will cause + Expat to call the *note ExternalEntityRefHandler: 38e9. with *note + None: 671. for all arguments to allow an alternate DTD to be + loaded. If the document does not contain a document type + declaration, the *note ExternalEntityRefHandler: 38e9. will still + be called, but the *note StartDoctypeDeclHandler: 38f3. and *note + EndDoctypeDeclHandler: 38f4. will not be called. + + Passing a false value for 'flag' will cancel a previous call that + passed a true value, but otherwise has no effect. + + This method can only be called before the *note Parse(): 38e6. or + *note ParseFile(): 38e7. methods are called; calling it after + either of those have been called causes *note ExpatError: 126c. to + be raised with the *note code: 1a. attribute set to + ‘errors.codes[errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING]’. + + -- Method: xmlparser.SetReparseDeferralEnabled (enabled) + + Warning: Calling ‘SetReparseDeferralEnabled(False)’ has + security implications, as detailed below; please make sure to + understand these consequences prior to using the + ‘SetReparseDeferralEnabled’ method. + + Expat 2.6.0 introduced a security mechanism called “reparse + deferral” where instead of causing denial of service through + quadratic runtime from reparsing large tokens, reparsing of + unfinished tokens is now delayed by default until a sufficient + amount of input is reached. Due to this delay, registered handlers + may — depending of the sizing of input chunks pushed to Expat — no + longer be called right after pushing new input to the parser. + Where immediate feedback and taking over responsibility of + protecting against denial of service from large tokens are both + wanted, calling ‘SetReparseDeferralEnabled(False)’ disables reparse + deferral for the current Expat parser instance, temporarily or + altogether. Calling ‘SetReparseDeferralEnabled(True)’ allows + re-enabling reparse deferral. + + Note that *note SetReparseDeferralEnabled(): 274. has been + backported to some prior releases of CPython as a security fix. + Check for availability of *note SetReparseDeferralEnabled(): 274. + using *note hasattr(): 4ce. if used in code running across a + variety of Python versions. + + Added in version 3.13. + + -- Method: 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 attributes: + + -- Attribute: xmlparser.buffer_size + + The size of the buffer used when *note buffer_text: 148b. is true. + A new buffer size can be set by assigning a new integer value to + this attribute. When the size is changed, the buffer will be + flushed. + + -- Attribute: 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(): 38f6. 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. + + -- Attribute: xmlparser.buffer_used + + If *note buffer_text: 148b. is enabled, the number of bytes stored + in the buffer. These bytes represent UTF-8 encoded text. This + attribute has no meaningful interpretation when *note buffer_text: + 148b. is false. + + -- Attribute: xmlparser.ordered_attributes + + Setting this attribute to a non-zero integer causes the attributes + to be reported as a list rather than a dictionary. The attributes + are presented in the order found in the document text. For each + attribute, two list entries are presented: the attribute name and + the attribute value. (Older versions of this module also used this + format.) By default, this attribute is false; it may be changed at + any time. + + -- Attribute: xmlparser.specified_attributes + + If set to a non-zero integer, the parser will report only those + attributes which were specified in the document instance and not + those which were derived from attribute declarations. Applications + which set this need to be especially careful to use what additional + information is available from the declarations as needed to comply + with the standards for the behavior of XML processors. By default, + this attribute is false; it may be changed at any time. + +The following attributes contain values relating to the most recent +error encountered by an ‘xmlparser’ object, and will only have correct +values once a call to ‘Parse()’ or ‘ParseFile()’ has raised an *note +xml.parsers.expat.ExpatError: 126c. exception. + + -- Attribute: xmlparser.ErrorByteIndex + + Byte index at which an error occurred. + + -- Attribute: xmlparser.ErrorCode + + Numeric code specifying the problem. This value can be passed to + the *note ErrorString(): 38e3. function, or compared to one of the + constants defined in the ‘errors’ object. + + -- Attribute: xmlparser.ErrorColumnNumber + + Column number at which an error occurred. + + -- Attribute: xmlparser.ErrorLineNumber + + Line number at which an error occurred. + +The following attributes contain values relating to the current parse +location in an ‘xmlparser’ object. During a callback reporting a parse +event they indicate the location of the first of the sequence of +characters that generated the event. When called outside of a callback, +the position indicated will be just past the last parse event +(regardless of whether there was an associated callback). + + -- Attribute: xmlparser.CurrentByteIndex + + Current byte index in the parser input. + + -- Attribute: xmlparser.CurrentColumnNumber + + Current column number in the parser input. + + -- Attribute: xmlparser.CurrentLineNumber + + Current line number in the parser input. + +Here is the list of handlers that can be set. To set a handler on an +‘xmlparser’ object 'o', use ‘o.handlername = func’. 'handlername' must +be taken from the following list, and 'func' must be a callable object +accepting the correct number of arguments. The arguments are all +strings, unless otherwise stated. + + -- Method: xmlparser.XmlDeclHandler (version, encoding, standalone) + + Called when the XML declaration is parsed. The XML declaration is + the (optional) declaration of the applicable version of the XML + recommendation, the encoding of the document text, and an optional + “standalone” declaration. 'version' and 'encoding' will be + strings, and 'standalone' will be ‘1’ if the document is declared + standalone, ‘0’ if it is declared not to be standalone, or ‘-1’ if + the standalone clause was omitted. This is only available with + Expat version 1.95.0 or newer. + + -- Method: xmlparser.StartDoctypeDeclHandler (doctypeName, systemId, + publicId, has_internal_subset) + + Called when Expat begins parsing the document type declaration + (‘'’. + + -- Method: xmlparser.StartCdataSectionHandler () + + Called at the start of a CDATA section. This and *note + EndCdataSectionHandler: 3906. are needed to be able to identify the + syntactical start and end for CDATA sections. + + -- Method: xmlparser.EndCdataSectionHandler () + + Called at the end of a CDATA section. + + -- Method: xmlparser.DefaultHandler (data) + + Called for any characters in the XML document for which no + applicable handler has been specified. This means characters that + are part of a construct which could be reported, but for which no + handler has been supplied. + + -- Method: xmlparser.DefaultHandlerExpand (data) + + This is the same as the *note DefaultHandler(): 390b, but doesn’t + inhibit expansion of internal entities. The entity reference will + not be passed to the default handler. + + -- Method: xmlparser.NotStandaloneHandler () + + Called if the XML document hasn’t been declared as being a + standalone document. This happens when there is an external subset + or a reference to a parameter entity, but the XML declaration does + not set standalone to ‘yes’ in an XML declaration. If this handler + returns ‘0’, then the parser will raise an + ‘XML_ERROR_NOT_STANDALONE’ error. If this handler is not set, no + exception is raised by the parser for this condition. + + -- Method: xmlparser.ExternalEntityRefHandler (context, base, systemId, + publicId) + + Called for references to external entities. 'base' is the current + base, as set by a previous call to *note SetBase(): 38e8. The + public and system identifiers, 'systemId' and 'publicId', are + strings if given; if the public identifier is not given, 'publicId' + will be ‘None’. The 'context' value is opaque and should only be + used as described below. + + For external entities to be parsed, this handler must be + implemented. It is responsible for creating the sub-parser using + ‘ExternalEntityParserCreate(context)’, initializing it with the + appropriate callbacks, and parsing the entity. This handler should + return an integer; if it returns ‘0’, the parser will raise an + ‘XML_ERROR_EXTERNAL_ENTITY_HANDLING’ error, otherwise parsing will + continue. + + If this handler is not provided, external entities are reported by + the *note DefaultHandler: 390b. callback, if provided. + + +File: python.info, Node: ExpatError Exceptions, Next: Example<10>, Prev: XMLParser Objects<2>, Up: xml parsers expat — Fast XML parsing using Expat + +5.21.13.2 ExpatError Exceptions +............................... + +*note ExpatError: 126c. exceptions have a number of interesting +attributes: + + -- Attribute: ExpatError.code + + Expat’s internal error number for the specific error. The *note + errors.messages: 3910. dictionary maps these error numbers to + Expat’s error messages. For example: + + 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]) + + The *note errors: 127. module also provides error message constants + and a dictionary *note codes: 3911. mapping these messages back to + the error codes, see below. + + -- Attribute: ExpatError.lineno + + Line number on which the error was detected. The first line is + numbered ‘1’. + + -- Attribute: ExpatError.offset + + Character offset into the line where the error occurred. The first + column is numbered ‘0’. + + +File: python.info, Node: Example<10>, Next: Content Model Descriptions, Prev: ExpatError Exceptions, Up: xml parsers expat — Fast XML parsing using Expat + +5.21.13.3 Example +................. + +The following program defines three handlers that just print out their +arguments. + + 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(""" + Text goes here + More text + """, 1) + +The output from this program is: + + 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: Content Model Descriptions, Next: Expat error constants, Prev: Example<10>, Up: xml parsers expat — Fast XML parsing using Expat + +5.21.13.4 Content Model Descriptions +.................................... + +Content models are described using nested tuples. Each tuple contains +four values: the type, the quantifier, the name, and a tuple of +children. Children are simply additional content model descriptions. + +The values of the first two fields are constants defined in the *note +xml.parsers.expat.model: 128. module. These constants can be collected +in two groups: the model type group and the quantifier group. + +The constants in the model type group are: + + -- Data: xml.parsers.expat.model.XML_CTYPE_ANY + + The element named by the model name was declared to have a content + model of ‘ANY’. + + -- Data: xml.parsers.expat.model.XML_CTYPE_CHOICE + + The named element allows a choice from a number of options; this is + used for content models such as ‘(A | B | C)’. + + -- Data: xml.parsers.expat.model.XML_CTYPE_EMPTY + + Elements which are declared to be ‘EMPTY’ have this model type. + + -- Data: xml.parsers.expat.model.XML_CTYPE_MIXED + + -- Data: xml.parsers.expat.model.XML_CTYPE_NAME + + -- Data: xml.parsers.expat.model.XML_CTYPE_SEQ + + Models which represent a series of models which follow one after + the other are indicated with this model type. This is used for + models such as ‘(A, B, C)’. + +The constants in the quantifier group are: + + -- Data: xml.parsers.expat.model.XML_CQUANT_NONE + + No modifier is given, so it can appear exactly once, as for ‘A’. + + -- Data: xml.parsers.expat.model.XML_CQUANT_OPT + + The model is optional: it can appear once or not at all, as for + ‘A?’. + + -- Data: xml.parsers.expat.model.XML_CQUANT_PLUS + + The model must occur one or more times (like ‘A+’). + + -- Data: xml.parsers.expat.model.XML_CQUANT_REP + + The model must occur zero or more times, as for ‘A*’. + + +File: python.info, Node: Expat error constants, Prev: Content Model Descriptions, Up: xml parsers expat — Fast XML parsing using Expat + +5.21.13.5 Expat error constants +............................... + +The following constants are provided in the *note +xml.parsers.expat.errors: 127. 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: +1a. attribute with ‘errors.codes[errors.XML_ERROR_CONSTANT_NAME]’. + +The ‘errors’ module has the following attributes: + + -- Data: xml.parsers.expat.errors.codes + + A dictionary mapping string descriptions to their error codes. + + Added in version 3.2. + + -- Data: xml.parsers.expat.errors.messages + + A dictionary mapping numeric error codes to their string + descriptions. + + Added in version 3.2. + + -- Data: xml.parsers.expat.errors.XML_ERROR_ASYNC_ENTITY + + -- Data: + xml.parsers.expat.errors.XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF + + An entity reference in an attribute value referred to an external + entity instead of an internal entity. + + -- Data: xml.parsers.expat.errors.XML_ERROR_BAD_CHAR_REF + + A character reference referred to a character which is illegal in + XML (for example, character ‘0’, or ‘‘�’’). + + -- Data: xml.parsers.expat.errors.XML_ERROR_BINARY_ENTITY_REF + + An entity reference referred to an entity which was declared with a + notation, so cannot be parsed. + + -- Data: xml.parsers.expat.errors.XML_ERROR_DUPLICATE_ATTRIBUTE + + An attribute was used more than once in a start tag. + + -- Data: xml.parsers.expat.errors.XML_ERROR_INCORRECT_ENCODING + + -- Data: xml.parsers.expat.errors.XML_ERROR_INVALID_TOKEN + + Raised when an input byte could not properly be assigned to a + character; for example, a NUL byte (value ‘0’) in a UTF-8 input + stream. + + -- Data: xml.parsers.expat.errors.XML_ERROR_JUNK_AFTER_DOC_ELEMENT + + Something other than whitespace occurred after the document + element. + + -- Data: xml.parsers.expat.errors.XML_ERROR_MISPLACED_XML_PI + + An XML declaration was found somewhere other than the start of the + input data. + + -- Data: xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS + + The document contains no elements (XML requires all documents to + contain exactly one top-level element).. + + -- Data: xml.parsers.expat.errors.XML_ERROR_NO_MEMORY + + Expat was not able to allocate memory internally. + + -- Data: xml.parsers.expat.errors.XML_ERROR_PARAM_ENTITY_REF + + A parameter entity reference was found where it was not allowed. + + -- Data: xml.parsers.expat.errors.XML_ERROR_PARTIAL_CHAR + + An incomplete character was found in the input. + + -- Data: xml.parsers.expat.errors.XML_ERROR_RECURSIVE_ENTITY_REF + + An entity reference contained another reference to the same entity; + possibly via a different name, and possibly indirectly. + + -- Data: xml.parsers.expat.errors.XML_ERROR_SYNTAX + + Some unspecified syntax error was encountered. + + -- Data: xml.parsers.expat.errors.XML_ERROR_TAG_MISMATCH + + An end tag did not match the innermost open start tag. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNCLOSED_TOKEN + + Some token (such as a start tag) was not closed before the end of + the stream or the next token was encountered. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNDEFINED_ENTITY + + A reference was made to an entity which was not defined. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNKNOWN_ENCODING + + The document encoding is not supported by Expat. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNCLOSED_CDATA_SECTION + + A CDATA marked section was not closed. + + -- Data: xml.parsers.expat.errors.XML_ERROR_EXTERNAL_ENTITY_HANDLING + + -- Data: xml.parsers.expat.errors.XML_ERROR_NOT_STANDALONE + + The parser determined that the document was not “standalone” though + it declared itself to be in the XML declaration, and the + ‘NotStandaloneHandler’ was set and returned ‘0’. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNEXPECTED_STATE + + -- Data: xml.parsers.expat.errors.XML_ERROR_ENTITY_DECLARED_IN_PE + + -- Data: 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 *note + xml.parsers.expat: 126. module. + + -- Data: + xml.parsers.expat.errors.XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING + + A behavioral change was requested after parsing started that can + only be changed before parsing has started. This is (currently) + only raised by ‘UseForeignDTD()’. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNBOUND_PREFIX + + An undeclared prefix was found when namespace processing was + enabled. + + -- Data: xml.parsers.expat.errors.XML_ERROR_UNDECLARING_PREFIX + + The document attempted to remove the namespace declaration + associated with a prefix. + + -- Data: xml.parsers.expat.errors.XML_ERROR_INCOMPLETE_PE + + A parameter entity contained incomplete markup. + + -- Data: xml.parsers.expat.errors.XML_ERROR_XML_DECL + + The document contained no document element at all. + + -- Data: xml.parsers.expat.errors.XML_ERROR_TEXT_DECL + + There was an error parsing a text declaration in an external + entity. + + -- Data: xml.parsers.expat.errors.XML_ERROR_PUBLICID + + Characters were found in the public id that are not allowed. + + -- Data: xml.parsers.expat.errors.XML_ERROR_SUSPENDED + + The requested operation was made on a suspended parser, but isn’t + allowed. This includes attempts to provide additional input or to + stop the parser. + + -- Data: xml.parsers.expat.errors.XML_ERROR_NOT_SUSPENDED + + An attempt to resume the parser was made when the parser had not + been suspended. + + -- Data: xml.parsers.expat.errors.XML_ERROR_ABORTED + + This should not be reported to Python applications. + + -- Data: xml.parsers.expat.errors.XML_ERROR_FINISHED + + The requested operation was made on a parser which was finished + parsing input, but isn’t allowed. This includes attempts to + provide additional input or to stop the parser. + + -- Data: xml.parsers.expat.errors.XML_ERROR_SUSPEND_PE + + -- Data: 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. + + -- Data: xml.parsers.expat.errors.XML_ERROR_RESERVED_PREFIX_XMLNS + + An attempt was made to declare or undeclare reserved namespace + prefix ‘xmlns’. + + -- Data: 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. + + -- Data: xml.parsers.expat.errors.XML_ERROR_INVALID_ARGUMENT + + This should not be reported to Python applications. + + -- Data: xml.parsers.expat.errors.XML_ERROR_NO_BUFFER + + This should not be reported to Python applications. + + -- Data: xml.parsers.expat.errors.XML_ERROR_AMPLIFICATION_LIMIT_BREACH + + The limit on input amplification factor (from DTD and entities) has + been breached. + + +File: python.info, Node: Internet Protocols and Support, Next: Multimedia Services, Prev: Structured Markup Processing Tools, Up: The Python Standard Library + +5.22 Internet Protocols and Support +=================================== + +The modules described in this chapter implement internet protocols and +support for related technology. They are all implemented in Python. +Most of these modules require the presence of the system-dependent +module *note socket: cc, which is currently supported on most popular +platforms. Here is an overview: + +* Menu: + +* webbrowser — Convenient web-browser controller:: +* wsgiref — WSGI Utilities and Reference Implementation:: +* urllib — URL handling modules:: +* urllib.request — Extensible library for opening URLs: urllib request — Extensible library for opening URLs. +* urllib.response — Response classes used by urllib: urllib response — Response classes used by urllib. +* urllib.parse — Parse URLs into components: urllib parse — Parse URLs into components. +* urllib.error — Exception classes raised by urllib.request: urllib error — Exception classes raised by urllib request. +* urllib.robotparser — Parser for robots.txt: urllib robotparser — Parser for robots txt. +* http — HTTP modules:: +* http.client — HTTP protocol client: http client — HTTP protocol client. +* ftplib — FTP protocol client:: +* poplib — POP3 protocol client:: +* imaplib — IMAP4 protocol client:: +* smtplib — SMTP protocol client:: +* uuid — UUID objects according to RFC 4122:: +* socketserver — A framework for network servers:: +* http.server — HTTP servers: http server — HTTP servers. +* http.cookies — HTTP state management: http cookies — HTTP state management. +* http.cookiejar — Cookie handling for HTTP clients: http cookiejar — Cookie handling for HTTP clients. +* xmlrpc — XMLRPC server and client modules:: +* xmlrpc.client — XML-RPC client access: xmlrpc client — XML-RPC client access. +* xmlrpc.server — Basic XML-RPC servers: xmlrpc server — Basic XML-RPC servers. +* ipaddress — IPv4/IPv6 manipulation library:: + + +File: python.info, Node: webbrowser — Convenient web-browser controller, Next: wsgiref — WSGI Utilities and Reference Implementation, Up: Internet Protocols and Support + +5.22.1 ‘webbrowser’ — Convenient web-browser controller +------------------------------------------------------- + +'Source code:' Lib/webbrowser.py(1) + +__________________________________________________________________ + +The *note webbrowser: 115. module provides a high-level interface to +allow displaying web-based documents to users. Under most +circumstances, simply calling the *note open(): 394a. function from this +module will do the right thing. + +Under Unix, graphical browsers are preferred under X11, but text-mode +browsers will be used if graphical browsers are not available or an X11 +display isn’t available. If text-mode browsers are used, the calling +process will block until the user exits the browser. + +If the environment variable ‘BROWSER’ exists, it is interpreted as the +*note os.pathsep: 1d44.-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 part does not +contain ‘%s’, it is simply interpreted as the name of the browser to +launch. (2) + +For non-Unix platforms, or when a remote browser is available on Unix, +the controlling process will not wait for the user to finish with the +browser, but allow the remote browser to maintain its own windows on the +display. If remote browsers are not available on Unix, the controlling +process will launch a new browser and wait. + +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 *note webbrowser: 115. module on iOS +requires the *note ctypes: 2a. module. If *note ctypes: 2a. isn’t +available, calls to *note open(): 394a. will fail. + +The script ‘webbrowser’ can be used as a command-line interface for the +module. It accepts a URL as the argument. It accepts the following +optional parameters: + + -- 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: 1d54.: not WASI, not Android. + +The following exception is defined: + + -- Exception: webbrowser.Error + + Exception raised when a browser control error occurs. + +The following functions are defined: + + -- Function: webbrowser.open (url, new=0, autoraise=True) + + Display 'url' using the default browser. If 'new' is 0, the 'url' + is opened in the same browser window if possible. If 'new' is 1, a + new browser window is opened if possible. If 'new' is 2, a new + browser page (“tab”) is opened if possible. If 'autoraise' is + ‘True’, the window is raised if possible (note that under many + window managers this will occur regardless of the setting of this + variable). + + Returns ‘True’ if a browser was successfully launched, ‘False’ + otherwise. + + Note that on some platforms, trying to open a filename using this + function, may work and start the operating system’s associated + program. However, this is neither supported nor portable. + + Raises an *note auditing event: 18ba. ‘webbrowser.open’ with + argument ‘url’. + + -- Function: webbrowser.open_new (url) + + Open 'url' in a new window of the default browser, if possible, + otherwise, open 'url' in the only browser window. + + Returns ‘True’ if a browser was successfully launched, ‘False’ + otherwise. + + -- Function: webbrowser.open_new_tab (url) + + Open 'url' in a new page (“tab”) of the default browser, if + possible, otherwise equivalent to *note open_new(): 3950. + + Returns ‘True’ if a browser was successfully launched, ‘False’ + otherwise. + + -- Function: webbrowser.get (using=None) + + Return a controller object for the browser type 'using'. If + 'using' is ‘None’, return a controller for a default browser + appropriate to the caller’s environment. + + -- Function: webbrowser.register (name, constructor, instance=None, *, + preferred=False) + + Register the browser type 'name'. Once a browser type is + registered, the *note get(): 3952. function can return a controller + for that browser type. If 'instance' is not provided, or is + ‘None’, 'constructor' will be called without parameters to create + an instance when needed. If 'instance' is provided, 'constructor' + will never be called, and may be ‘None’. + + Setting 'preferred' to ‘True’ makes this browser a preferred result + for a *note get(): 3952. call with no argument. Otherwise, this + entry point is only useful if you plan to either set the ‘BROWSER’ + variable or call *note get(): 3952. with a nonempty argument + matching the name of a handler you declare. + + Changed in version 3.7: 'preferred' keyword-only parameter was + added. + +A number of browser types are predefined. This table gives the type +names that may be passed to the *note get(): 3952. function and the +corresponding instantiations for the controller classes, all defined in +this module. + +Type Name Class Name Notes + +--------------------------------------------------------------------------------------- + +‘'mozilla'’ ‘Mozilla('mozilla')’ + + +‘'firefox'’ ‘Mozilla('mozilla')’ + + +‘'epiphany'’ ‘Epiphany('epiphany')’ + + +‘'kfmclient'’ ‘Konqueror()’ (1) + + +‘'konqueror'’ ‘Konqueror()’ (1) + + +‘'kfm'’ ‘Konqueror()’ (1) + + +‘'opera'’ ‘Opera()’ + + +‘'links'’ ‘GenericBrowser('links')’ + + +‘'elinks'’ ‘Elinks('elinks')’ + + +‘'lynx'’ ‘GenericBrowser('lynx')’ + + +‘'w3m'’ ‘GenericBrowser('w3m')’ + + +‘'windows-default'’ ‘WindowsDefault’ (2) + + +‘'macosx'’ ‘MacOSXOSAScript('default')’ (3) + + +‘'safari'’ ‘MacOSXOSAScript('safari')’ (3) + + +‘'google-chrome'’ ‘Chrome('google-chrome')’ + + +‘'chrome'’ ‘Chrome('chrome')’ + + +‘'chromium'’ ‘Chromium('chromium')’ + + +‘'chromium-browser'’ ‘Chromium('chromium-browser')’ + + +‘'iosbrowser'’ ‘IOSBrowser’ (4) + + +Notes: + + 1. “Konqueror” is the file manager for the KDE desktop environment for + Unix, and only makes sense to use if KDE is running. Some way of + reliably detecting KDE would be nice; the ‘KDEDIR’ variable is not + sufficient. Note also that the name “kfm” is used even when using + the ‘konqueror’ command with KDE 2 — the implementation selects the + best strategy for running Konqueror. + + 2. Only on Windows platforms. + + 3. Only on macOS. + + 4. Only on iOS. + +Added in version 3.2: A new ‘MacOSXOSAScript’ class has been added and +is used on Mac instead of the previous ‘MacOSX’ class. This adds +support for opening browsers not currently set as the OS default. + +Added in version 3.3: Support for Chrome/Chromium has been added. + +Changed in version 3.12: Support for several obsolete browsers has been +removed. Removed browsers include Grail, Mosaic, Netscape, Galeon, +Skipstone, Iceape, and Firefox versions 35 and below. + +Changed in version 3.13: Support for iOS has been added. + +Here are some simple examples: + + 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) + +* Menu: + +* Browser Controller Objects:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/webbrowser.py + + (2) Executables named here without a full path will be searched in +the directories given in the ‘PATH’ environment variable. + + +File: python.info, Node: Browser Controller Objects, Up: webbrowser — Convenient web-browser controller + +5.22.1.1 Browser Controller Objects +................................... + +Browser controllers provide the *note name: 299. attribute, and the +following three methods which parallel module-level convenience +functions: + + -- Attribute: controller.name + + System-dependent name for the browser. + + -- Method: controller.open (url, new=0, autoraise=True) + + Display 'url' using the browser handled by this controller. If + 'new' is 1, a new browser window is opened if possible. If 'new' + is 2, a new browser page (“tab”) is opened if possible. + + -- Method: controller.open_new (url) + + Open 'url' in a new window of the browser handled by this + controller, if possible, otherwise, open 'url' in the only browser + window. Alias *note open_new(): 3950. + + -- Method: controller.open_new_tab (url) + + Open 'url' in a new page (“tab”) of the browser handled by this + controller, if possible, otherwise equivalent to *note open_new(): + 3950. + + +File: python.info, Node: wsgiref — WSGI Utilities and Reference Implementation, Next: urllib — URL handling modules, Prev: webbrowser — Convenient web-browser controller, Up: Internet Protocols and Support + +5.22.2 ‘wsgiref’ — WSGI Utilities and Reference Implementation +-------------------------------------------------------------- + +'Source code:' Lib/wsgiref(1) + +__________________________________________________________________ + +The Web Server Gateway Interface (WSGI) is a standard interface between +web server software and web applications written in Python. Having a +standard interface makes it easy to use an application that supports +WSGI with a number of different web servers. + +Only authors of web servers and programming frameworks need to know +every detail and corner case of the WSGI design. You don’t need to +understand every detail of WSGI just to install a WSGI application or to +write a web application using an existing framework. + +*note wsgiref: 118. 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)). + +See wsgi.readthedocs.io(3) for more information about WSGI, and links to +tutorials and other resources. + +* Menu: + +* wsgiref.util – WSGI environment utilities: wsgiref util – WSGI environment utilities. +* wsgiref.headers – WSGI response header tools: wsgiref headers – WSGI response header tools. +* wsgiref.simple_server – a simple WSGI HTTP server: wsgiref simple_server – a simple WSGI HTTP server. +* wsgiref.validate — WSGI conformance checker: wsgiref validate — WSGI conformance checker. +* wsgiref.handlers – server/gateway base classes: wsgiref handlers – server/gateway base classes. +* wsgiref.types – WSGI types for static type checking: wsgiref types – WSGI types for static type checking. +* Examples: Examples<25>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 Utilities and Reference Implementation + +5.22.2.1 ‘wsgiref.util’ – WSGI environment utilities +.................................................... + +This module provides a variety of utility functions for working with +WSGI environments. A WSGI environment is a dictionary containing HTTP +request variables as described in PEP 3333(1). All of the functions +taking an 'environ' parameter expect a WSGI-compliant dictionary to be +supplied; please see PEP 3333(2) for a detailed specification and *note +WSGIEnvironment: 395c. for a type alias that can be used in type +annotations. + + -- Function: wsgiref.util.guess_scheme (environ) + + Return a guess for whether ‘wsgi.url_scheme’ should be “http” or + “https”, by checking for a ‘HTTPS’ environment variable in the + 'environ' dictionary. The return value is a string. + + This function is useful when creating a gateway that wraps CGI or a + CGI-like protocol such as FastCGI. Typically, servers providing + such protocols will include a ‘HTTPS’ variable with a value of “1”, + “yes”, or “on” when a request is received via SSL. So, this + function returns “https” if such a value is found, and “http” + otherwise. + + -- Function: wsgiref.util.request_uri (environ, include_query=True) + + Return the full request URI, optionally including the query string, + using the algorithm found in the “URL Reconstruction” section of + PEP 3333(3). If 'include_query' is false, the query string is not + included in the resulting URI. + + -- Function: wsgiref.util.application_uri (environ) + + Similar to *note request_uri(): 395e, except that the ‘PATH_INFO’ + and ‘QUERY_STRING’ variables are ignored. The result is the base + URI of the application object addressed by the request. + + -- Function: wsgiref.util.shift_path_info (environ) + + Shift a single name from ‘PATH_INFO’ to ‘SCRIPT_NAME’ and return + the name. The 'environ' dictionary is 'modified' in-place; use a + copy if you need to keep the original ‘PATH_INFO’ or ‘SCRIPT_NAME’ + intact. + + If there are no remaining path segments in ‘PATH_INFO’, ‘None’ is + returned. + + Typically, this routine is used to process each portion of a + request URI path, for example to treat the path as a series of + dictionary keys. This routine modifies the passed-in environment + to make it suitable for invoking another WSGI application that is + located at the target URI. For example, if there is a WSGI + application at ‘/foo’, and the request URI path is ‘/foo/bar/baz’, + and the WSGI application at ‘/foo’ calls *note shift_path_info(): + 3960, it will receive the string “bar”, and the environment will be + updated to be suitable for passing to a WSGI application at + ‘/foo/bar’. That is, ‘SCRIPT_NAME’ will change from ‘/foo’ to + ‘/foo/bar’, and ‘PATH_INFO’ will change from ‘/bar/baz’ to ‘/baz’. + + When ‘PATH_INFO’ is just a “/”, this routine returns an empty + string and appends a trailing slash to ‘SCRIPT_NAME’, even though + empty path segments are normally ignored, and ‘SCRIPT_NAME’ doesn’t + normally end in a slash. This is intentional behavior, to ensure + that an application can tell the difference between URIs ending in + ‘/x’ from ones ending in ‘/x/’ when using this routine to do object + traversal. + + -- Function: wsgiref.util.setup_testing_defaults (environ) + + Update 'environ' with trivial defaults for testing purposes. + + This routine adds various parameters required for WSGI, including + ‘HTTP_HOST’, ‘SERVER_NAME’, ‘SERVER_PORT’, ‘REQUEST_METHOD’, + ‘SCRIPT_NAME’, ‘PATH_INFO’, and all of the PEP 3333(4)-defined + ‘wsgi.*’ variables. It only supplies default values, and does not + replace any existing settings for these variables. + + This routine is intended to make it easier for unit tests of WSGI + servers and applications to set up dummy environments. It should + NOT be used by actual WSGI servers or applications, since the data + is fake! + + Example usage (see also *note demo_app(): 3962. 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 *note wsgiref.util: +11d. module also provides these miscellaneous utilities: + + -- Function: wsgiref.util.is_hop_by_hop (header_name) + + Return ‘True’ if ‘header_name’ is an HTTP/1.1 “Hop-by-Hop” header, + as defined by RFC 2616(5). + + -- Class: wsgiref.util.FileWrapper (filelike, blksize=8192) + + A concrete implementation of the *note wsgiref.types.FileWrapper: + 3963. protocol used to convert a file-like object to an *note + iterator: 1ac. The resulting objects are *note iterable: 121a.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. + + If 'filelike' has a ‘close()’ method, the returned object will also + have a ‘close()’ method, and it will invoke the 'filelike' object’s + ‘close()’ method when called. + + Example usage: + + 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) + + Changed in version 3.11: Support for *note __getitem__(): 285. + method has been removed. + + ---------- 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 Utilities and Reference Implementation + +5.22.2.2 ‘wsgiref.headers’ – WSGI response header tools +....................................................... + +This module provides a single class, *note Headers: e91, for convenient +manipulation of WSGI response headers using a mapping-like interface. + + -- Class: wsgiref.headers.Headers ([headers]) + + Create a mapping-like object wrapping 'headers', which must be a + list of header name/value tuples as described in PEP 3333(1). The + default value of 'headers' is an empty list. + + *note Headers: e91. objects support typical mapping operations + including *note __getitem__(): 285, *note get(): 2242, *note + __setitem__(): 12be, *note setdefault(): 1072, *note __delitem__(): + 12bf. and *note __contains__(): 1f5e. 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. + + Unlike a dictionary, *note Headers: e91. objects do not raise an + error when you try to get or delete a key that isn’t in the wrapped + header list. Getting a nonexistent header just returns ‘None’, and + deleting a nonexistent header does nothing. + + *note Headers: e91. objects also support ‘keys()’, ‘values()’, and + ‘items()’ methods. The lists returned by ‘keys()’ and ‘items()’ + can include the same key more than once if there is a multi-valued + header. The ‘len()’ of a *note Headers: e91. object is the same as + the length of its ‘items()’, which is the same as the length of the + wrapped header list. In fact, the ‘items()’ method just returns a + copy of the wrapped header list. + + Calling ‘bytes()’ on a *note Headers: e91. object returns a + formatted bytestring suitable for transmission as HTTP response + headers. Each header is placed on a line with its value, separated + by a colon and a space. Each line is terminated by a carriage + return and line feed, and the bytestring is terminated with a blank + line. + + In addition to their mapping interface and formatting features, + *note Headers: e91. objects also have the following methods for + querying and adding multi-valued headers, and for adding headers + with MIME parameters: + + -- Method: get_all (name) + + Return a list of all the values for the named header. + + The returned list will be sorted in the order they appeared in + the original header list or were added to this instance, and + may contain duplicates. Any fields deleted and re-inserted + are always appended to the header list. If no fields exist + with the given name, returns an empty list. + + -- Method: add_header (name, value, **_params) + + Add a (possibly multi-valued) header, with optional MIME + parameters specified via keyword arguments. + + 'name' is the header field to add. Keyword arguments can be + used to set MIME parameters for the header field. Each + parameter must be a string or ‘None’. Underscores in + parameter names are converted to dashes, since dashes are + illegal in Python identifiers, but many MIME parameter names + include dashes. If the parameter value is a string, it is + added to the header value parameters in the form + ‘name="value"’. If it is ‘None’, only the parameter name is + added. (This is used for MIME parameters without a value.) + Example usage: + + h.add_header('content-disposition', 'attachment', filename='bud.gif') + + The above will add a header that looks like this: + + Content-Disposition: attachment; filename="bud.gif" + + Changed in version 3.5: 'headers' parameter is optional. + + ---------- 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 Utilities and Reference Implementation + +5.22.2.3 ‘wsgiref.simple_server’ – a simple WSGI HTTP server +............................................................ + +This module implements a simple HTTP server (based on *note http.server: +72.) that serves WSGI applications. Each server instance serves a +single WSGI application on a given host and port. If you want to serve +multiple applications on a single host and port, you should create a +WSGI application that parses ‘PATH_INFO’ to select which application to +invoke for each request. (E.g., using the ‘shift_path_info()’ function +from *note wsgiref.util: 11d.) + + -- Function: wsgiref.simple_server.make_server (host, port, app, + server_class=WSGIServer, handler_class=WSGIRequestHandler) + + Create a new WSGI server listening on 'host' and 'port', accepting + connections for 'app'. The return value is an instance of the + supplied 'server_class', and will process requests using the + specified 'handler_class'. 'app' must be a WSGI application + object, as defined by PEP 3333(1). + + Example usage: + + 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() + + -- Function: 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 *note + wsgiref.simple_server: 11b.) is able to run a simple WSGI + application correctly. + + The 'start_response' callable should follow the *note + StartResponse: 3969. protocol. + + -- Class: wsgiref.simple_server.WSGIServer (server_address, + RequestHandlerClass) + + Create a *note WSGIServer: 396a. instance. 'server_address' should + be a ‘(host,port)’ tuple, and 'RequestHandlerClass' should be the + subclass of *note http.server.BaseHTTPRequestHandler: 10c1. that + will be used to process requests. + + You do not normally need to call this constructor, as the *note + make_server(): 3968. function can handle all the details for you. + + *note WSGIServer: 396a. is a subclass of *note + http.server.HTTPServer: 396b, so all of its methods (such as + ‘serve_forever()’ and ‘handle_request()’) are available. *note + WSGIServer: 396a. also provides these WSGI-specific methods: + + -- Method: set_app (application) + + Sets the callable 'application' as the WSGI application that + will receive requests. + + -- Method: get_app () + + Returns the currently set application callable. + + Normally, however, you do not need to use these additional methods, + as *note set_app(): 396c. is normally called by *note + make_server(): 3968, and the *note get_app(): 396d. exists mainly + for the benefit of request handler instances. + + -- Class: wsgiref.simple_server.WSGIRequestHandler (request, + client_address, server) + + Create an HTTP handler for the given 'request' (i.e. a socket), + 'client_address' (a ‘(host,port)’ tuple), and 'server' (*note + WSGIServer: 396a. instance). + + You do not need to create instances of this class directly; they + are automatically created as needed by *note WSGIServer: 396a. + objects. You can, however, subclass this class and supply it as a + 'handler_class' to the *note make_server(): 3968. function. Some + possibly relevant methods for overriding in subclasses: + + -- Method: get_environ () + + Return a *note WSGIEnvironment: 395c. dictionary for a + request. The default implementation copies the contents of + the *note WSGIServer: 396a. object’s ‘base_environ’ dictionary + attribute and then adds various headers derived from the HTTP + request. Each call to this method should return a new + dictionary containing all of the relevant CGI environment + variables as specified in PEP 3333(2). + + -- Method: get_stderr () + + Return the object that should be used as the ‘wsgi.errors’ + stream. The default implementation just returns ‘sys.stderr’. + + -- Method: handle () + + Process the HTTP request. The default implementation creates + a handler instance using a *note wsgiref.handlers: 119. class + to implement the actual WSGI application interface. + + ---------- 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 Utilities and Reference Implementation + +5.22.2.4 ‘wsgiref.validate’ — WSGI conformance checker +...................................................... + +When creating new WSGI application objects, frameworks, servers, or +middleware, it can be useful to validate the new code’s conformance +using *note wsgiref.validate: 11e. 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. + +Note that this utility does not guarantee complete PEP 3333(1) +compliance; an absence of errors from this module does not necessarily +mean that errors do not exist. However, if this module does produce an +error, then it is virtually certain that either the server or +application is not 100% compliant. + +This module is based on the ‘paste.lint’ module from Ian Bicking’s +“Python Paste” library. + + -- Function: wsgiref.validate.validator (application) + + Wrap 'application' and return a new WSGI application object. The + returned application will forward all requests to the original + 'application', and will check that both the 'application' and the + server invoking it are conforming to the WSGI specification and to + RFC 2616(2). + + Any detected nonconformance results in an *note AssertionError: + 6a5. being raised; note, however, that how these errors are handled + is server-dependent. For example, *note wsgiref.simple_server: + 11b. and other servers based on *note wsgiref.handlers: 119. (that + don’t override the error handling methods to do something else) + will simply output a message that an error has occurred, and dump + the traceback to ‘sys.stderr’ or some other error stream. + + This wrapper may also generate output using the *note warnings: + 112. module to indicate behaviors that are questionable but which + may not actually be prohibited by PEP 3333(3). Unless they are + suppressed using Python command-line options or the *note warnings: + 112. API, any such warnings will be written to ‘sys.stderr’ ('not' + ‘wsgi.errors’, unless they happen to be the same object). + + Example usage: + + 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 Utilities and Reference Implementation + +5.22.2.5 ‘wsgiref.handlers’ – server/gateway base classes +......................................................... + +This module provides base handler classes for implementing WSGI servers +and gateways. These base classes handle most of the work of +communicating with a WSGI application, as long as they are given a +CGI-like environment, along with input, output, and error streams. + + -- Class: wsgiref.handlers.CGIHandler + + CGI-based invocation via ‘sys.stdin’, ‘sys.stdout’, ‘sys.stderr’ + and ‘os.environ’. This is useful when you have a WSGI application + and want to run it as a CGI script. Simply invoke + ‘CGIHandler().run(app)’, where ‘app’ is the WSGI application object + you wish to invoke. + + This class is a subclass of *note BaseCGIHandler: 3976. that sets + ‘wsgi.run_once’ to true, ‘wsgi.multithread’ to false, and + ‘wsgi.multiprocess’ to true, and always uses *note sys: d9. and + *note os: a1. to obtain the necessary CGI streams and environment. + + -- Class: wsgiref.handlers.IISCGIHandler + + A specialized alternative to *note CGIHandler: 3975, for use when + deploying on Microsoft’s IIS web server, without having set the + config allowPathInfo option (IIS>=7) or metabase + allowPathInfoForScriptMappings (IIS<7). + + 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: 3975, i.e., by calling + ‘IISCGIHandler().run(app)’, where ‘app’ is the WSGI application + object you wish to invoke. + + Added in version 3.2. + + -- Class: wsgiref.handlers.BaseCGIHandler (stdin, stdout, stderr, + environ, multithread=True, multiprocess=False) + + Similar to *note CGIHandler: 3975, but instead of using the *note + sys: d9. and *note os: a1. modules, the CGI environment and I/O + streams are specified explicitly. The 'multithread' and + 'multiprocess' values are used to set the ‘wsgi.multithread’ and + ‘wsgi.multiprocess’ flags for any applications run by the handler + instance. + + This class is a subclass of *note SimpleHandler: 3978. intended for + use with software other than HTTP “origin servers”. If you are + writing a gateway protocol implementation (such as CGI, FastCGI, + SCGI, etc.) that uses a ‘Status:’ header to send an HTTP status, + you probably want to subclass this instead of *note SimpleHandler: + 3978. + + -- Class: wsgiref.handlers.SimpleHandler (stdin, stdout, stderr, + environ, multithread=True, multiprocess=False) + + Similar to *note BaseCGIHandler: 3976, but designed for use with + HTTP origin servers. If you are writing an HTTP server + implementation, you will probably want to subclass this instead of + *note BaseCGIHandler: 3976. + + This class is a subclass of *note BaseHandler: 19ef. It overrides + the ‘__init__()’, *note get_stdin(): 3979, *note get_stderr(): + 397a, *note add_cgi_vars(): 397b, *note _write(): 397c, and *note + _flush(): 397d. 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(): cdb. method of 'stdout' should write each chunk + in full, like *note io.BufferedIOBase: 690. + + -- Class: wsgiref.handlers.BaseHandler + + This is an abstract base class for running WSGI applications. Each + instance will handle a single HTTP request, although in principle + you could create a subclass that was reusable for multiple + requests. + + *note BaseHandler: 19ef. instances have only one method intended + for external use: + + -- Method: run (app) + + Run the specified WSGI application, 'app'. + + All of the other *note BaseHandler: 19ef. methods are invoked by + this method in the process of running the application, and thus + exist primarily to allow customizing the process. + + The following methods MUST be overridden in a subclass: + + -- Method: _write (data) + + Buffer the bytes 'data' for transmission to the client. It’s + okay if this method actually transmits the data; *note + BaseHandler: 19ef. just separates write and flush operations + for greater efficiency when the underlying system actually has + such a distinction. + + -- Method: _flush () + + Force buffered data to be transmitted to the client. It’s + okay if this method is a no-op (i.e., if *note _write(): 397c. + actually sends the data). + + -- Method: get_stdin () + + Return an object compatible with *note InputStream: 397f. + suitable for use as the ‘wsgi.input’ of the request currently + being processed. + + -- Method: get_stderr () + + Return an object compatible with *note ErrorStream: 3980. + suitable for use as the ‘wsgi.errors’ of the request currently + being processed. + + -- Method: add_cgi_vars () + + Insert CGI variables for the current request into the + ‘environ’ attribute. + + Here are some other methods and attributes you may wish to + override. This list is only a summary, however, and does not + include every method that can be overridden. You should consult + the docstrings and source code for additional information before + attempting to create a customized *note BaseHandler: 19ef. + subclass. + + Attributes and methods for customizing the WSGI environment: + + -- Attribute: wsgi_multithread + + The value to be used for the ‘wsgi.multithread’ environment + variable. It defaults to true in *note BaseHandler: 19ef, but + may have a different default (or be set by the constructor) in + the other subclasses. + + -- Attribute: wsgi_multiprocess + + The value to be used for the ‘wsgi.multiprocess’ environment + variable. It defaults to true in *note BaseHandler: 19ef, but + may have a different default (or be set by the constructor) in + the other subclasses. + + -- Attribute: wsgi_run_once + + The value to be used for the ‘wsgi.run_once’ environment + variable. It defaults to false in *note BaseHandler: 19ef, + but *note CGIHandler: 3975. sets it to true by default. + + -- Attribute: 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 *note wsgiref.handlers: 119. 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. + + -- Attribute: server_software + + If the *note origin_server: 3986. attribute is set, this + attribute’s value is used to set the default ‘SERVER_SOFTWARE’ + WSGI environment variable, and also to set a default ‘Server:’ + header in HTTP responses. It is ignored for handlers (such as + *note BaseCGIHandler: 3976. and *note CGIHandler: 3975.) that + are not HTTP origin servers. + + Changed in version 3.3: The term “Python” is replaced with + implementation specific term like “CPython”, “Jython” etc. + + -- Method: get_scheme () + + Return the URL scheme being used for the current request. The + default implementation uses the ‘guess_scheme()’ function from + *note wsgiref.util: 11d. to guess whether the scheme should be + “http” or “https”, based on the current request’s ‘environ’ + variables. + + -- Method: setup_environ () + + Set the ‘environ’ attribute to a fully populated WSGI + environment. The default implementation uses all of the above + methods and attributes, plus the *note get_stdin(): 3979, + *note get_stderr(): 397a, and *note add_cgi_vars(): 397b. + methods and the *note wsgi_file_wrapper: 3989. attribute. It + also inserts a ‘SERVER_SOFTWARE’ key if not present, as long + as the *note origin_server: 3986. attribute is a true value + and the *note server_software: 3985. attribute is set. + + Methods and attributes for customizing exception handling: + + -- Method: log_exception (exc_info) + + Log the 'exc_info' tuple in the server log. 'exc_info' is a + ‘(type, value, traceback)’ tuple. The default implementation + simply writes the traceback to the request’s ‘wsgi.errors’ + stream and flushes it. Subclasses can override this method to + change the format or retarget the output, mail the traceback + to an administrator, or whatever other action may be deemed + suitable. + + -- Attribute: traceback_limit + + The maximum number of frames to include in tracebacks output + by the default *note log_exception(): 398a. method. If + ‘None’, all frames are included. + + -- Method: error_output (environ, start_response) + + This method is a WSGI application to generate an error page + for the user. It is only invoked if an error occurs before + headers are sent to the client. + + 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: 3969. protocol. + + The default implementation just uses the *note error_status: + 398d, *note error_headers: 398e, and *note error_body: 398f. + attributes to generate an output page. Subclasses can + override this to produce more dynamic error output. + + Note, however, that it’s not recommended from a security + perspective to spit out diagnostics to any old user; ideally, + you should have to do something special to enable diagnostic + output, which is why the default implementation doesn’t + include any. + + -- Attribute: error_status + + The HTTP status used for error responses. This should be a + status string as defined in PEP 3333(2); it defaults to a 500 + code and message. + + -- Attribute: error_headers + + The HTTP headers used for error responses. This should be a + list of WSGI response headers (‘(name, value)’ tuples), as + described in PEP 3333(3). The default list just sets the + content type to ‘text/plain’. + + -- Attribute: error_body + + The error response body. This should be an HTTP response body + bytestring. It defaults to the plain text, “A server error + occurred. Please contact the administrator.” + + Methods and attributes for PEP 3333(4)’s “Optional + Platform-Specific File Handling” feature: + + -- Attribute: wsgi_file_wrapper + + A ‘wsgi.file_wrapper’ factory, compatible with *note + wsgiref.types.FileWrapper: 3963, or ‘None’. The default value + of this attribute is the *note wsgiref.util.FileWrapper: 731. + class. + + -- Method: sendfile () + + Override to implement platform-specific file transmission. + This method is called only if the application’s return value + is an instance of the class specified by the *note + wsgi_file_wrapper: 3989. attribute. It should return a true + value if it was able to successfully transmit the file, so + that the default transmission code will not be executed. The + default implementation of this method just returns a false + value. + + Miscellaneous methods and attributes: + + -- Attribute: origin_server + + This attribute should be set to a true value if the handler’s + *note _write(): 397c. and *note _flush(): 397d. are being used + to communicate directly to the client, rather than via a + CGI-like gateway protocol that wants the HTTP status in a + special ‘Status:’ header. + + This attribute’s default value is true in *note BaseHandler: + 19ef, but false in *note BaseCGIHandler: 3976. and *note + CGIHandler: 3975. + + -- Attribute: http_version + + If *note origin_server: 3986. is true, this string attribute + is used to set the HTTP version of the response set to the + client. It defaults to ‘"1.0"’. + + -- Function: 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: 3975. and *note IISCGIHandler: 3977. 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: Examples<25>, Prev: wsgiref handlers – server/gateway base classes, Up: wsgiref — WSGI Utilities and Reference Implementation + +5.22.2.6 ‘wsgiref.types’ – WSGI types for static type checking +.............................................................. + +This module provides various types for static type checking as described +in PEP 3333(1). + +Added in version 3.11. + + -- Class: wsgiref.types.StartResponse + + A *note typing.Protocol: 266. describing start_response()(2) + callables ( PEP 3333(3)). + + -- Data: wsgiref.types.WSGIEnvironment + + A type alias describing a WSGI environment dictionary. + + -- Data: wsgiref.types.WSGIApplication + + A type alias describing a WSGI application callable. + + -- Class: wsgiref.types.InputStream + + A *note typing.Protocol: 266. describing a WSGI Input Stream(4). + + -- Class: wsgiref.types.ErrorStream + + A *note typing.Protocol: 266. describing a WSGI Error Stream(5). + + -- Class: wsgiref.types.FileWrapper + + A *note typing.Protocol: 266. describing a file wrapper(6). See + *note wsgiref.util.FileWrapper: 731. 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: Examples<25>, Prev: wsgiref types – WSGI types for static type checking, Up: wsgiref — WSGI Utilities and Reference Implementation + +5.22.2.7 Examples +................. + +This is a working “Hello World” WSGI application, where the +'start_response' callable should follow the *note StartResponse: 3969. +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 handling modules, Next: urllib request — Extensible library for opening URLs, Prev: wsgiref — WSGI Utilities and Reference Implementation, Up: Internet Protocols and Support + +5.22.3 ‘urllib’ — URL handling modules +-------------------------------------- + +'Source code:' Lib/urllib/(1) + +__________________________________________________________________ + +‘urllib’ is a package that collects several modules for working with +URLs: + + * *note urllib.request: 10b. for opening and reading URLs + + * *note urllib.error: 109. containing the exceptions raised by *note + urllib.request: 10b. + + * *note urllib.parse: 10a. for parsing URLs + + * *note urllib.robotparser: 10d. for parsing ‘robots.txt’ files + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/urllib/ + + +File: python.info, Node: urllib request — Extensible library for opening URLs, Next: urllib response — Response classes used by urllib, Prev: urllib — URL handling modules, Up: Internet Protocols and Support + +5.22.4 ‘urllib.request’ — Extensible library for opening URLs +------------------------------------------------------------- + +'Source code:' Lib/urllib/request.py(1) + +__________________________________________________________________ + +The *note urllib.request: 10b. module defines functions and classes +which help in opening URLs (mostly HTTP) in a complex world — basic and +digest authentication, redirections, cookies and more. + +See also +........ + +The Requests package(2) is recommended for a higher-level HTTP client +interface. + + Warning: On macOS it is unsafe to use this module in programs using + *note os.fork(): 197. because the *note getproxies(): 3999. + 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: 1d54.: not WASI. + +This module does not work or is not available on WebAssembly. See *note +WebAssembly platforms: 17e0. for more information. + +The *note urllib.request: 10b. module defines the following functions: + + -- Function: 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: fd3. object. + + 'data' must be an object specifying additional data to be sent to + the server, or ‘None’ if no such data is needed. See *note + Request: fd3. for details. + + urllib.request module uses HTTP/1.1 and includes ‘Connection:close’ + header in its HTTP requests. + + 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). This actually + only works for HTTP, HTTPS and FTP connections. + + If 'context' is specified, it must be a *note ssl.SSLContext: 296. + instance describing the various SSL options. See *note + HTTPSConnection: b41. for more details. + + This function always returns an object which can work as a *note + context manager: 5d0. and has the properties 'url', 'headers', and + 'status'. See *note urllib.response.addinfourl: 399a. for more + detail on these properties. + + For HTTP and HTTPS URLs, this function returns a *note + http.client.HTTPResponse: 10c4. object slightly modified. In + addition to the three new methods above, the msg attribute contains + the same information as the *note reason: 399b. attribute — the + reason phrase returned by server — instead of the response headers + as it is specified in the documentation for *note HTTPResponse: + 10c4. + + For FTP, file, and data URLs and requests explicitly handled by + legacy *note URLopener: 308. and *note FancyURLopener: 309. + classes, this function returns a *note urllib.response.addinfourl: + 399a. object. + + Raises *note URLError: 399c. on protocol errors. + + Note that ‘None’ may be returned if no handler handles the request + (though the default installed global *note OpenerDirector: 399d. + uses *note UnknownHandler: 399e. to ensure this never happens). + + In addition, if proxy settings are detected (for example, when a + ‘*_proxy’ environment variable like ‘http_proxy’ is set), *note + ProxyHandler: 19cf. is default installed and makes sure the + requests are handled through the proxy. + + The legacy ‘urllib.urlopen’ function from Python 2.6 and earlier + has been discontinued; *note urllib.request.urlopen(): 295. + corresponds to the old ‘urllib2.urlopen’. Proxy handling, which + was done by passing a dictionary parameter to ‘urllib.urlopen’, can + be obtained by using *note ProxyHandler: 19cf. objects. + + The default opener raises an *note auditing event: 18ba. + ‘urllib.Request’ with arguments ‘fullurl’, ‘data’, ‘headers’, + ‘method’ taken from the request object. + + Changed in version 3.2: 'cafile' and 'capath' were added. + + HTTPS virtual hosts are now supported if possible (that is, if + *note ssl.HAS_SNI: 3480. is true). + + 'data' can be an iterable object. + + Changed in version 3.3: 'cadefault' was added. + + Changed in version 3.4.3: 'context' was added. + + Changed in version 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(): e5f. + + Changed in version 3.13: Remove 'cafile', 'capath' and 'cadefault' + parameters: use the 'context' parameter instead. + + -- Function: urllib.request.install_opener (opener) + + Install an *note OpenerDirector: 399d. instance as the default + global opener. Installing an opener is only necessary if you want + urlopen to use that opener; otherwise, simply call *note + OpenerDirector.open(): fd7. instead of *note urlopen(): 295. The + code does not check for a real *note OpenerDirector: 399d, and any + class with the appropriate interface will work. + + -- Function: urllib.request.build_opener ([handler, ...]) + + Return an *note OpenerDirector: 399d. instance, which chains the + handlers in the order given. 'handler's can be either instances of + *note BaseHandler: 39a1, or subclasses of *note BaseHandler: 39a1. + (in which case it must be possible to call the constructor without + any parameters). Instances of the following classes will be in + front of the 'handler's, unless the 'handler's contain them, + instances of them or subclasses of them: *note ProxyHandler: 19cf. + (if proxy settings are detected), *note UnknownHandler: 399e, *note + HTTPHandler: 39a2, *note HTTPDefaultErrorHandler: 39a3, *note + HTTPRedirectHandler: 39a4, *note FTPHandler: 39a5, *note + FileHandler: 39a6, *note HTTPErrorProcessor: 39a7. + + If the Python installation has SSL support (i.e., if the *note ssl: + d0. module can be imported), *note HTTPSHandler: 1216. will also be + added. + + A *note BaseHandler: 39a1. subclass may also change its + ‘handler_order’ attribute to modify its position in the handlers + list. + + -- Function: urllib.request.pathname2url (path) + + Convert the given local path to a ‘file:’ URL. This function uses + *note quote(): ba3. function to encode the path. For historical + reasons, the return value omits the ‘file:’ scheme prefix. This + example shows the function being used on Windows: + + >>> from urllib.request import pathname2url + >>> path = 'C:\\Program Files' + >>> 'file:' + pathname2url(path) + 'file:///C:/Program%20Files' + + -- Function: urllib.request.url2pathname (url) + + Convert the given ‘file:’ URL to a local path. This function uses + *note unquote(): 1785. to decode the URL. For historical reasons, + the given value 'must' omit the ‘file:’ scheme prefix. This + example shows the function being used on Windows: + + >>> from urllib.request import url2pathname + >>> url = 'file:///C:/Program%20Files' + >>> url2pathname(url.removeprefix('file:')) + 'C:\\Program Files' + + -- Function: urllib.request.getproxies () + + This helper function returns a dictionary of scheme to proxy server + URL mappings. It scans the environment for variables named + ‘_proxy’, in a case insensitive approach, for all operating + systems first, and when it cannot find it, looks for proxy + information from System Configuration for macOS and Windows Systems + Registry for Windows. If both lowercase and uppercase environment + variables exist (and disagree), lowercase is preferred. + + Note: If the environment variable ‘REQUEST_METHOD’ is set, + which usually indicates your script is running in a CGI + environment, the environment variable ‘HTTP_PROXY’ (uppercase + ‘_PROXY’) will be ignored. This is because that variable can + be injected by a client using the “Proxy:” HTTP header. If + you need to use an HTTP proxy in a CGI environment, either use + ‘ProxyHandler’ explicitly, or make sure the variable name is + in lowercase (or at least the ‘_proxy’ suffix). + +The following classes are provided: + + -- Class: urllib.request.Request (url, data=None, headers={}, + origin_req_host=None, unverifiable=False, method=None) + + This class is an abstraction of a URL request. + + '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: 39a2. 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(3), Section 3.3.1 will be used to send files + and other iterables. + + For an HTTP POST request method, 'data' should be a buffer in the + standard ‘application/x-www-form-urlencoded’ format. The *note + urllib.parse.urlencode(): e8e. function takes a mapping or sequence + of 2-tuples and returns an ASCII string in this format. It should + be encoded to bytes before being used as the 'data' parameter. + + 'headers' should be a dictionary, and will be treated as if *note + add_header(): 39a8. was called with each key and value as + arguments. This is often used to “spoof” the ‘User-Agent’ header + value, which is used by a browser to identify itself – some HTTP + servers only allow requests coming from common browsers as opposed + to scripts. For example, Mozilla Firefox may identify itself as + ‘"Mozilla/5.0 (X11; U; Linux i686) Gecko/20071127 + Firefox/2.0.0.11"’, while *note urllib: 108.’s default user agent + string is ‘"Python-urllib/2.6"’ (on Python 2.6). All header keys + are sent in camel case. + + 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. + + The next two arguments are only of interest for correct handling of + third-party HTTP cookies: + + 'origin_req_host' should be the request-host of the origin + transaction, as defined by RFC 2965(4). It defaults to + ‘http.cookiejar.request_host(self)’. This is the host name or IP + address of the original request that was initiated by the user. + For example, if the request is for an image in an HTML document, + this should be the request-host of the request for the page + containing the image. + + 'unverifiable' should indicate whether the request is unverifiable, + as defined by RFC 2965(5). It defaults to ‘False’. An + unverifiable request is one whose URL the user did not have the + option to approve. For example, if the request is for an image in + an HTML document, and the user had no option to approve the + automatic fetching of the image, this should be true. + + 'method' should be a string that indicates the HTTP request method + that will be used (e.g. ‘'HEAD'’). If provided, its value is + stored in the *note method: fd4. attribute and is used by *note + get_method(): 115d. The default is ‘'GET'’ if 'data' is ‘None’ or + ‘'POST'’ otherwise. Subclasses may indicate a different default + method by setting the *note method: fd4. attribute in the class + itself. + + Note: 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. + + Changed in version 3.3: *note Request.method: fd4. argument is + added to the Request class. + + Changed in version 3.4: Default *note Request.method: fd4. may be + indicated at the class level. + + Changed in version 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. + + -- Class: urllib.request.OpenerDirector + + The *note OpenerDirector: 399d. class opens URLs via *note + BaseHandler: 39a1.s chained together. It manages the chaining of + handlers, and recovery from errors. + + -- Class: urllib.request.BaseHandler + + This is the base class for all registered handlers — and handles + only the simple mechanics of registration. + + -- Class: urllib.request.HTTPDefaultErrorHandler + + A class which defines a default handler for HTTP error responses; + all responses are turned into *note HTTPError: fd9. exceptions. + + -- Class: urllib.request.HTTPRedirectHandler + + A class to handle redirections. + + -- Class: urllib.request.HTTPCookieProcessor (cookiejar=None) + + A class to handle HTTP Cookies. + + -- Class: urllib.request.ProxyHandler (proxies=None) + + Cause requests to go through a proxy. If 'proxies' is given, it + must be a dictionary mapping protocol names to URLs of proxies. + The default is to read the list of proxies from the environment + variables ‘_proxy’. If no proxy environment variables + are set, then in a Windows environment proxy settings are obtained + from the registry’s Internet Settings section, and in a macOS + environment proxy information is retrieved from the System + Configuration Framework. + + To disable autodetected proxy pass an empty dictionary. + + The ‘no_proxy’ environment variable can be used to specify hosts + which shouldn’t be reached via proxy; if set, it should be a + comma-separated list of hostname suffixes, optionally with ‘:port’ + appended, for example ‘cern.ch,ncsa.uiuc.edu,some.host:8080’. + + Note: ‘HTTP_PROXY’ will be ignored if a variable + ‘REQUEST_METHOD’ is set; see the documentation on *note + getproxies(): 3999. + + -- Class: urllib.request.HTTPPasswordMgr + + Keep a database of ‘(realm, uri) -> (user, password)’ mappings. + + -- Class: urllib.request.HTTPPasswordMgrWithDefaultRealm + + Keep a database of ‘(realm, uri) -> (user, password)’ mappings. A + realm of ‘None’ is considered a catch-all realm, which is searched + if no other realm fits. + + -- Class: urllib.request.HTTPPasswordMgrWithPriorAuth + + A variant of *note HTTPPasswordMgrWithDefaultRealm: 39ab. that also + has a database of ‘uri -> is_authenticated’ mappings. Can be used + by a BasicAuth handler to determine when to send authentication + credentials immediately instead of waiting for a ‘401’ response + first. + + Added in version 3.5. + + -- Class: urllib.request.AbstractBasicAuthHandler (password_mgr=None) + + This is a mixin class that helps with HTTP authentication, both to + the remote host and to a proxy. 'password_mgr', if given, should + be something that is compatible with *note HTTPPasswordMgr: 39aa.; + refer to section *note HTTPPasswordMgr Objects: 39ac. for + information on the interface that must be supported. If + 'passwd_mgr' also provides ‘is_authenticated’ and + ‘update_authenticated’ methods (see *note + HTTPPasswordMgrWithPriorAuth Objects: 39ad.), then the handler will + use the ‘is_authenticated’ result for a given URI to determine + whether or not to send authentication credentials with the request. + If ‘is_authenticated’ returns ‘True’ for the URI, credentials are + sent. If ‘is_authenticated’ is ‘False’, credentials are not sent, + and then if a ‘401’ response is received the request is re-sent + with the authentication credentials. If authentication succeeds, + ‘update_authenticated’ is called to set ‘is_authenticated’ ‘True’ + for the URI, so that subsequent requests to the URI or any of its + super-URIs will automatically include the authentication + credentials. + + Added in version 3.5: Added ‘is_authenticated’ support. + + -- Class: urllib.request.HTTPBasicAuthHandler (password_mgr=None) + + Handle authentication with the remote host. 'password_mgr', if + given, should be something that is compatible with *note + HTTPPasswordMgr: 39aa.; refer to section *note HTTPPasswordMgr + Objects: 39ac. for information on the interface that must be + supported. HTTPBasicAuthHandler will raise a *note ValueError: + 204. when presented with a wrong Authentication scheme. + + -- Class: urllib.request.ProxyBasicAuthHandler (password_mgr=None) + + Handle authentication with the proxy. 'password_mgr', if given, + should be something that is compatible with *note HTTPPasswordMgr: + 39aa.; refer to section *note HTTPPasswordMgr Objects: 39ac. for + information on the interface that must be supported. + + -- Class: urllib.request.AbstractDigestAuthHandler (password_mgr=None) + + This is a mixin class that helps with HTTP authentication, both to + the remote host and to a proxy. 'password_mgr', if given, should + be something that is compatible with *note HTTPPasswordMgr: 39aa.; + refer to section *note HTTPPasswordMgr Objects: 39ac. for + information on the interface that must be supported. + + -- Class: urllib.request.HTTPDigestAuthHandler (password_mgr=None) + + Handle authentication with the remote host. 'password_mgr', if + given, should be something that is compatible with *note + HTTPPasswordMgr: 39aa.; refer to section *note HTTPPasswordMgr + Objects: 39ac. for information on the interface that must be + supported. When both Digest Authentication Handler and Basic + Authentication Handler are both added, Digest Authentication is + always tried first. If the Digest Authentication returns a 40x + response again, it is sent to Basic Authentication handler to + Handle. This Handler method will raise a *note ValueError: 204. + when presented with an authentication scheme other than Digest or + Basic. + + Changed in version 3.3: Raise *note ValueError: 204. on unsupported + Authentication Scheme. + + -- Class: urllib.request.ProxyDigestAuthHandler (password_mgr=None) + + Handle authentication with the proxy. 'password_mgr', if given, + should be something that is compatible with *note HTTPPasswordMgr: + 39aa.; refer to section *note HTTPPasswordMgr Objects: 39ac. for + information on the interface that must be supported. + + -- Class: urllib.request.HTTPHandler + + A class to handle opening of HTTP URLs. + + -- Class: urllib.request.HTTPSHandler (debuglevel=0, context=None, + check_hostname=None) + + A class to handle opening of HTTPS URLs. 'context' and + 'check_hostname' have the same meaning as in *note + http.client.HTTPSConnection: b41. + + Changed in version 3.2: 'context' and 'check_hostname' were added. + + -- Class: urllib.request.FileHandler + + Open local files. + + -- Class: urllib.request.DataHandler + + Open data URLs. + + Added in version 3.4. + + -- Class: urllib.request.FTPHandler + + Open FTP URLs. + + -- Class: urllib.request.CacheFTPHandler + + Open FTP URLs, keeping a cache of open FTP connections to minimize + delays. + + -- Class: urllib.request.UnknownHandler + + A catch-all class to handle unknown URLs. + + -- Class: urllib.request.HTTPErrorProcessor + + Process HTTP error responses. + +* Menu: + +* Request Objects:: +* OpenerDirector Objects:: +* BaseHandler Objects:: +* HTTPRedirectHandler Objects:: +* HTTPCookieProcessor Objects:: +* ProxyHandler Objects:: +* HTTPPasswordMgr Objects:: +* HTTPPasswordMgrWithPriorAuth Objects:: +* AbstractBasicAuthHandler Objects:: +* HTTPBasicAuthHandler Objects:: +* ProxyBasicAuthHandler Objects:: +* AbstractDigestAuthHandler Objects:: +* HTTPDigestAuthHandler Objects:: +* ProxyDigestAuthHandler Objects:: +* HTTPHandler Objects:: +* HTTPSHandler Objects:: +* FileHandler Objects:: +* DataHandler Objects:: +* FTPHandler Objects:: +* CacheFTPHandler Objects:: +* UnknownHandler Objects:: +* HTTPErrorProcessor Objects:: +* Examples: Examples<26>. +* Legacy interface:: +* urllib.request Restrictions: urllib request Restrictions. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/urllib/request.py + + (2) https://requests.readthedocs.io/en/master/ + + (3) https://datatracker.ietf.org/doc/html/rfc7230.html + + (4) https://datatracker.ietf.org/doc/html/rfc2965.html + + (5) https://datatracker.ietf.org/doc/html/rfc2965.html + + +File: python.info, Node: Request Objects, Next: OpenerDirector Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.1 Request Objects +........................ + +The following methods describe *note Request: fd3.’s public interface, +and so all may be overridden in subclasses. It also defines several +public attributes that can be used by clients to inspect the parsed +request. + + -- Attribute: Request.full_url + + The original URL passed to the constructor. + + Changed in version 3.4. + + Request.full_url is a property with setter, getter and a deleter. + Getting *note full_url: fd5. returns the original request URL with + the fragment, if it was present. + + -- Attribute: Request.type + + The URI scheme. + + -- Attribute: Request.host + + The URI authority, typically a host, but may also contain a port + separated by a colon. + + -- Attribute: Request.origin_req_host + + The original host for the request, without port. + + -- Attribute: Request.selector + + The URI path. If the *note Request: fd3. uses a proxy, then + selector will be the full URL that is passed to the proxy. + + -- Attribute: Request.data + + The entity body for the request, or ‘None’ if not specified. + + Changed in version 3.4: Changing value of *note Request.data: fd6. + now deletes “Content-Length” header if it was previously set or + calculated. + + -- Attribute: Request.unverifiable + + boolean, indicates whether the request is unverifiable as defined + by RFC 2965(1). + + -- Attribute: Request.method + + The HTTP request method to use. By default its value is *note + None: 671, which means that *note get_method(): 115d. will do its + normal computation of the method to be used. Its value can be set + (thus overriding the default computation in *note get_method(): + 115d.) either by providing a default value by setting it at the + class level in a *note Request: fd3. subclass, or by passing a + value in to the *note Request: fd3. constructor via the 'method' + argument. + + Added in version 3.3. + + Changed in version 3.4: A default value can now be set in + subclasses; previously it could only be set via the constructor + argument. + + -- Method: Request.get_method () + + Return a string indicating the HTTP request method. If *note + Request.method: fd4. is not ‘None’, return its value, otherwise + return ‘'GET'’ if *note Request.data: fd6. is ‘None’, or ‘'POST'’ + if it’s not. This is only meaningful for HTTP requests. + + Changed in version 3.3: get_method now looks at the value of *note + Request.method: fd4. + + -- Method: Request.add_header (key, val) + + Add another header to the request. Headers are currently ignored + by all handlers except HTTP handlers, where they are added to the + list of headers sent to the server. Note that there cannot be more + than one header with the same name, and later calls will overwrite + previous calls in case the 'key' collides. Currently, this is no + loss of HTTP functionality, since all headers which have meaning + when used more than once have a (header-specific) way of gaining + the same functionality using only one header. Note that headers + added using this method are also added to redirected requests. + + -- Method: Request.add_unredirected_header (key, header) + + Add a header that will not be added to a redirected request. + + -- Method: Request.has_header (header) + + Return whether the instance has the named header (checks both + regular and unredirected). + + -- Method: Request.remove_header (header) + + Remove named header from the request instance (both from regular + and unredirected headers). + + Added in version 3.4. + + -- Method: Request.get_full_url () + + Return the URL given in the constructor. + + Changed in version 3.4. + + Returns *note Request.full_url: fd5. + + -- Method: Request.set_proxy (host, type) + + Prepare the request by connecting to a proxy server. The 'host' + and 'type' will replace those of the instance, and the instance’s + selector will be the original URL given in the constructor. + + -- Method: Request.get_header (header_name, default=None) + + Return the value of the given header. If the header is not + present, return the default value. + + -- Method: Request.header_items () + + Return a list of tuples (header_name, header_value) of the Request + headers. + +Changed in version 3.4: The request methods add_data, has_data, +get_data, get_type, get_host, get_selector, get_origin_req_host and +is_unverifiable that were deprecated since 3.3 have been removed. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2965.html + + +File: python.info, Node: OpenerDirector Objects, Next: BaseHandler Objects, Prev: Request Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.2 OpenerDirector Objects +............................... + +*note OpenerDirector: 399d. instances have the following methods: + + -- Method: OpenerDirector.add_handler (handler) + + 'handler' should be an instance of *note BaseHandler: 39a1. 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. + + * ‘_open()’ — signal that the handler knows how to + open 'protocol' URLs. + + See *note BaseHandler._open(): 39c2. for more + information. + + * ‘http_error_()’ — signal that the handler knows how to + handle HTTP errors with HTTP error code 'type'. + + See *note BaseHandler.http_error_(): 39c3. for more + information. + + * ‘_error()’ — signal that the handler knows how to + handle errors from (non-‘http’) 'protocol'. + + * ‘_request()’ — signal that the handler knows how to + pre-process 'protocol' requests. + + See *note BaseHandler._request(): 39c4. for more + information. + + * ‘_response()’ — signal that the handler knows how to + post-process 'protocol' responses. + + See *note BaseHandler._response(): 39c5. for more + information. + + -- Method: OpenerDirector.open (url, data=None[, timeout]) + + Open the given 'url' (which can be a request object or a string), + optionally passing the given 'data'. Arguments, return values and + exceptions raised are the same as those of *note urlopen(): 295. + (which simply calls the *note open(): 517. method on the currently + installed global *note OpenerDirector: 399d.). 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). The timeout feature + actually works only for HTTP, HTTPS and FTP connections. + + -- Method: OpenerDirector.error (proto, *args) + + Handle an error of the given protocol. This will call the + registered error handlers for the given protocol with the given + arguments (which are protocol specific). The HTTP protocol is a + special case which uses the HTTP response code to determine the + specific error handler; refer to the ‘http_error_()’ methods + of the handler classes. + + Return values and exceptions raised are the same as those of *note + urlopen(): 295. + +OpenerDirector objects open URLs in three stages: + +The order in which these methods are called within each stage is +determined by sorting the handler instances. + + 1. Every handler with a method named like ‘_request()’ has + that method called to pre-process the request. + + 2. Handlers with a method named like ‘_open()’ are called to + handle the request. This stage ends when a handler either returns + a non-*note None: 671. value (ie. a response), or raises an + exception (usually *note URLError: 399c.). Exceptions are allowed + to propagate. + + In fact, the above algorithm is first tried for methods named *note + default_open(): 39c7. If all such methods return *note None: 671, + the algorithm is repeated for methods named like + ‘_open()’. If all such methods return *note None: 671, + the algorithm is repeated for methods named *note unknown_open(): + 39c8. + + Note that the implementation of these methods may involve calls of + the parent *note OpenerDirector: 399d. instance’s *note open(): + fd7. and *note error(): 39c6. methods. + + 3. Every handler with a method named like ‘_response()’ has + that method called to post-process the response. + + +File: python.info, Node: BaseHandler Objects, Next: HTTPRedirectHandler Objects, Prev: OpenerDirector Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.3 BaseHandler Objects +............................ + +*note BaseHandler: 39a1. objects provide a couple of methods that are +directly useful, and others that are meant to be used by derived +classes. These are intended for direct use: + + -- Method: BaseHandler.add_parent (director) + + Add a director as parent. + + -- Method: BaseHandler.close () + + Remove any parents. + +The following attribute and methods should only be used by classes +derived from *note BaseHandler: 39a1. + + Note: The convention has been adopted that subclasses defining + ‘_request()’ or ‘_response()’ methods are named + ‘*Processor’; all others are named ‘*Handler’. + + -- Attribute: BaseHandler.parent + + A valid *note OpenerDirector: 399d, which can be used to open using + a different protocol, or handle errors. + + -- Method: BaseHandler.default_open (req) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should define it if they want to catch all URLs. + + This method, if implemented, will be called by the parent *note + OpenerDirector: 399d. It should return a file-like object as + described in the return value of the *note open(): fd7. method of + *note OpenerDirector: 399d, or ‘None’. It should raise *note + URLError: 399c, unless a truly exceptional thing happens (for + example, *note MemoryError: 1576. should not be mapped to *note + URLError: 399c.). + + This method will be called before any protocol-specific open + method. + + -- Method: BaseHandler._open(req) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should define it if they want to handle URLs with the + given protocol. + + This method, if defined, will be called by the parent *note + OpenerDirector: 399d. Return values should be the same as for + *note default_open(): 39c7. + + -- Method: BaseHandler.unknown_open (req) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should define it if they want to catch all URLs with no + specific registered handler to open it. + + This method, if implemented, will be called by the *note parent: + 39cd. *note OpenerDirector: 399d. Return values should be the same + as for *note default_open(): 39c7. + + -- Method: BaseHandler.http_error_default (req, fp, code, msg, hdrs) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should override it if they intend to provide a catch-all + for otherwise unhandled HTTP errors. It will be called + automatically by the *note OpenerDirector: 399d. getting the error, + and should not normally be called in other circumstances. + + *note OpenerDirector: 399d. will call this method with five + positional arguments: + + 1. a *note Request: fd3. object, + + 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. + + Return values and exceptions raised should be the same as those of + *note urlopen(): 295. + + -- Method: BaseHandler.http_error_(req, fp, code, msg, hdrs) + + 'nnn' should be a three-digit HTTP error code. This method is also + not defined in *note BaseHandler: 39a1, but will be called, if it + exists, on an instance of a subclass, when an HTTP error with code + 'nnn' occurs. + + Subclasses should override this method to handle specific HTTP + errors. + + Arguments, return values and exceptions raised should be the same + as for *note http_error_default(): 39ce. + + -- Method: BaseHandler._request(req) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should define it if they want to pre-process requests of + the given protocol. + + This method, if defined, will be called by the parent *note + OpenerDirector: 399d. 'req' will be a *note Request: fd3. object. + The return value should be a *note Request: fd3. object. + + -- Method: BaseHandler._response(req, response) + + This method is 'not' defined in *note BaseHandler: 39a1, but + subclasses should define it if they want to post-process responses + of the given protocol. + + This method, if defined, will be called by the parent *note + OpenerDirector: 399d. 'req' will be a *note Request: fd3. object. + 'response' will be an object implementing the same interface as the + return value of *note urlopen(): 295. The return value should + implement the same interface as the return value of *note + urlopen(): 295. + + +File: python.info, Node: HTTPRedirectHandler Objects, Next: HTTPCookieProcessor Objects, Prev: BaseHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.4 HTTPRedirectHandler Objects +.................................... + + Note: Some HTTP redirections require action from this module’s + client code. If this is the case, *note HTTPError: fd9. is raised. + See RFC 2616(1) for details of the precise meanings of the various + redirection codes. + + An *note HTTPError: fd9. exception raised as a security + consideration if the HTTPRedirectHandler is presented with a + redirected URL which is not an HTTP, HTTPS or FTP URL. + + -- Method: HTTPRedirectHandler.redirect_request (req, fp, code, msg, + hdrs, newurl) + + Return a *note Request: fd3. or ‘None’ in response to a redirect. + This is called by the default implementations of the + ‘http_error_30*()’ methods when a redirection is received from the + server. If a redirection should take place, return a new *note + Request: fd3. to allow ‘http_error_30*()’ to perform the redirect + to 'newurl'. Otherwise, raise *note HTTPError: fd9. if no other + handler should try to handle this URL, or return ‘None’ if you + can’t but another handler might. + + Note: The default implementation of this method does not + strictly follow RFC 2616(2), which says that 301 and 302 + responses to ‘POST’ requests must not be automatically + redirected without confirmation by the user. In reality, + browsers do allow automatic redirection of these responses, + changing the POST to a ‘GET’, and the default implementation + reproduces this behavior. + + -- Method: HTTPRedirectHandler.http_error_301 (req, fp, code, msg, + hdrs) + + Redirect to the ‘Location:’ or ‘URI:’ URL. This method is called by + the parent *note OpenerDirector: 399d. when getting an HTTP ‘moved + permanently’ response. + + -- Method: HTTPRedirectHandler.http_error_302 (req, fp, code, msg, + hdrs) + + The same as *note http_error_301(): 39d2, but called for the + ‘found’ response. + + -- Method: HTTPRedirectHandler.http_error_303 (req, fp, code, msg, + hdrs) + + The same as *note http_error_301(): 39d2, but called for the ‘see + other’ response. + + -- Method: HTTPRedirectHandler.http_error_307 (req, fp, code, msg, + hdrs) + + The same as *note http_error_301(): 39d2, but called for the + ‘temporary redirect’ response. It does not allow changing the + request method from ‘POST’ to ‘GET’. + + -- Method: HTTPRedirectHandler.http_error_308 (req, fp, code, msg, + hdrs) + + The same as *note http_error_301(): 39d2, 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 + + +File: python.info, Node: HTTPCookieProcessor Objects, Next: ProxyHandler Objects, Prev: HTTPRedirectHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.5 HTTPCookieProcessor Objects +.................................... + +*note HTTPCookieProcessor: 39a9. instances have one attribute: + + -- Attribute: HTTPCookieProcessor.cookiejar + + The *note http.cookiejar.CookieJar: 39da. in which cookies are + stored. + + +File: python.info, Node: ProxyHandler Objects, Next: HTTPPasswordMgr Objects, Prev: HTTPCookieProcessor Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.6 ProxyHandler Objects +............................. + + -- Method: ProxyHandler._open(request) + + The *note ProxyHandler: 19cf. will have a method + ‘_open()’ for every 'protocol' which has a proxy in the + 'proxies' dictionary given in the constructor. The method will + modify requests to go through the proxy, by calling + ‘request.set_proxy()’, and call the next handler in the chain to + actually execute the protocol. + + +File: python.info, Node: HTTPPasswordMgr Objects, Next: HTTPPasswordMgrWithPriorAuth Objects, Prev: ProxyHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.7 HTTPPasswordMgr Objects +................................ + +These methods are available on *note HTTPPasswordMgr: 39aa. and *note +HTTPPasswordMgrWithDefaultRealm: 39ab. objects. + + -- Method: HTTPPasswordMgr.add_password (realm, uri, user, passwd) + + 'uri' can be either a single URI, or a sequence of URIs. 'realm', + 'user' and 'passwd' must be strings. This causes ‘(user, passwd)’ + to be used as authentication tokens when authentication for 'realm' + and a super-URI of any of the given URIs is given. + + -- Method: HTTPPasswordMgr.find_user_password (realm, authuri) + + Get user/password for given realm and URI, if any. This method + will return ‘(None, None)’ if there is no matching user/password. + + For *note HTTPPasswordMgrWithDefaultRealm: 39ab. objects, the realm + ‘None’ will be searched if the given 'realm' has no matching + user/password. + + +File: python.info, Node: HTTPPasswordMgrWithPriorAuth Objects, Next: AbstractBasicAuthHandler Objects, Prev: HTTPPasswordMgr Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.8 HTTPPasswordMgrWithPriorAuth Objects +............................................. + +This password manager extends *note HTTPPasswordMgrWithDefaultRealm: +39ab. to support tracking URIs for which authentication credentials +should always be sent. + + -- Method: HTTPPasswordMgrWithPriorAuth.add_password (realm, uri, user, + passwd, is_authenticated=False) + + 'realm', 'uri', 'user', 'passwd' are as for *note + HTTPPasswordMgr.add_password(): 39de. 'is_authenticated' sets the + initial value of the ‘is_authenticated’ flag for the given URI or + list of URIs. If 'is_authenticated' is specified as ‘True’, + 'realm' is ignored. + + -- Method: HTTPPasswordMgrWithPriorAuth.find_user_password (realm, + authuri) + + Same as for *note HTTPPasswordMgrWithDefaultRealm: 39ab. objects + + -- Method: HTTPPasswordMgrWithPriorAuth.update_authenticated (self, + uri, is_authenticated=False) + + Update the ‘is_authenticated’ flag for the given 'uri' or list of + URIs. + + -- Method: HTTPPasswordMgrWithPriorAuth.is_authenticated (self, + authuri) + + Returns the current state of the ‘is_authenticated’ flag for the + given URI. + + +File: python.info, Node: AbstractBasicAuthHandler Objects, Next: HTTPBasicAuthHandler Objects, Prev: HTTPPasswordMgrWithPriorAuth Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.9 AbstractBasicAuthHandler Objects +......................................... + + -- Method: AbstractBasicAuthHandler.http_error_auth_reqed (authreq, + host, req, headers) + + Handle an authentication request by getting a user/password pair, + and re-trying the request. 'authreq' should be the name of the + header where the information about the realm is included in the + request, 'host' specifies the URL and path to authenticate for, + 'req' should be the (failed) *note Request: fd3. object, and + 'headers' should be the error headers. + + 'host' is either an authority (e.g. ‘"python.org"’) or a URL + containing an authority component (e.g. ‘"http://python.org/"’). + In either case, the authority must not contain a userinfo component + (so, ‘"python.org"’ and ‘"python.org:80"’ are fine, + ‘"joe:password@python.org"’ is not). + + +File: python.info, Node: HTTPBasicAuthHandler Objects, Next: ProxyBasicAuthHandler Objects, Prev: AbstractBasicAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.10 HTTPBasicAuthHandler Objects +...................................... + + -- Method: HTTPBasicAuthHandler.http_error_401 (req, fp, code, msg, + hdrs) + + Retry the request with authentication information, if available. + + +File: python.info, Node: ProxyBasicAuthHandler Objects, Next: AbstractDigestAuthHandler Objects, Prev: HTTPBasicAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.11 ProxyBasicAuthHandler Objects +....................................... + + -- Method: ProxyBasicAuthHandler.http_error_407 (req, fp, code, msg, + hdrs) + + Retry the request with authentication information, if available. + + +File: python.info, Node: AbstractDigestAuthHandler Objects, Next: HTTPDigestAuthHandler Objects, Prev: ProxyBasicAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.12 AbstractDigestAuthHandler Objects +........................................... + + -- Method: AbstractDigestAuthHandler.http_error_auth_reqed (authreq, + host, req, headers) + + 'authreq' should be the name of the header where the information + about the realm is included in the request, 'host' should be the + host to authenticate to, 'req' should be the (failed) *note + Request: fd3. object, and 'headers' should be the error headers. + + +File: python.info, Node: HTTPDigestAuthHandler Objects, Next: ProxyDigestAuthHandler Objects, Prev: AbstractDigestAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.13 HTTPDigestAuthHandler Objects +....................................... + + -- Method: HTTPDigestAuthHandler.http_error_401 (req, fp, code, msg, + hdrs) + + Retry the request with authentication information, if available. + + +File: python.info, Node: ProxyDigestAuthHandler Objects, Next: HTTPHandler Objects, Prev: HTTPDigestAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.14 ProxyDigestAuthHandler Objects +........................................ + + -- Method: ProxyDigestAuthHandler.http_error_407 (req, fp, code, msg, + hdrs) + + Retry the request with authentication information, if available. + + +File: python.info, Node: HTTPHandler Objects, Next: HTTPSHandler Objects, Prev: ProxyDigestAuthHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.15 HTTPHandler Objects +............................. + + -- Method: HTTPHandler.http_open (req) + + Send an HTTP request, which can be either GET or POST, depending on + ‘req.data’. + + +File: python.info, Node: HTTPSHandler Objects, Next: FileHandler Objects, Prev: HTTPHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.16 HTTPSHandler Objects +.............................. + + -- Method: HTTPSHandler.https_open (req) + + Send an HTTPS request, which can be either GET or POST, depending + on ‘req.data’. + + +File: python.info, Node: FileHandler Objects, Next: DataHandler Objects, Prev: HTTPSHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.17 FileHandler Objects +............................. + + -- Method: FileHandler.file_open (req) + + Open the file locally, if there is no host name, or the host name + is ‘'localhost'’. + + Changed in version 3.2: This method is applicable only for local + hostnames. When a remote hostname is given, a *note URLError: + 399c. is raised. + + +File: python.info, Node: DataHandler Objects, Next: FTPHandler Objects, Prev: FileHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.18 DataHandler Objects +............................. + + -- Method: 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: 204. in that case. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2397.html + + +File: python.info, Node: FTPHandler Objects, Next: CacheFTPHandler Objects, Prev: DataHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.19 FTPHandler Objects +............................ + + -- Method: FTPHandler.ftp_open (req) + + Open the FTP file indicated by 'req'. The login is always done + with empty username and password. + + +File: python.info, Node: CacheFTPHandler Objects, Next: UnknownHandler Objects, Prev: FTPHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.20 CacheFTPHandler Objects +................................. + +*note CacheFTPHandler: 1728. objects are *note FTPHandler: 39a5. objects +with the following additional methods: + + -- Method: CacheFTPHandler.setTimeout (t) + + Set timeout of connections to 't' seconds. + + -- Method: CacheFTPHandler.setMaxConns (m) + + Set maximum number of cached connections to 'm'. + + +File: python.info, Node: UnknownHandler Objects, Next: HTTPErrorProcessor Objects, Prev: CacheFTPHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.21 UnknownHandler Objects +................................ + + -- Method: UnknownHandler.unknown_open () + + Raise a *note URLError: 399c. exception. + + +File: python.info, Node: HTTPErrorProcessor Objects, Next: Examples<26>, Prev: UnknownHandler Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.22 HTTPErrorProcessor Objects +.................................... + + -- Method: HTTPErrorProcessor.http_response (request, response) + + Process HTTP error responses. + + For 200 error codes, the response object is returned immediately. + + For non-200 error codes, this simply passes the job on to the + ‘http_error_()’ handler methods, via *note + OpenerDirector.error(): 39c6. Eventually, *note + HTTPDefaultErrorHandler: 39a3. will raise an *note HTTPError: fd9. + if no other handler handles the error. + + -- Method: HTTPErrorProcessor.https_response (request, response) + + Process HTTPS error responses. + + The behavior is same as *note http_response(): 3a0d. + + +File: python.info, Node: Examples<26>, Next: Legacy interface, Prev: HTTPErrorProcessor Objects, Up: urllib request — Extensible library for opening URLs + +5.22.4.23 Examples +.................. + +In addition to the examples below, more examples are given in *note +HOWTO Fetch Internet Resources Using The urllib Package: 3a11. + +This example gets the python.org main page and displays the first 300 +bytes of it: + + >>> import urllib.request + >>> with urllib.request.urlopen('http://www.python.org/') as f: + ... print(f.read(300)) + ... + b'\n\n\n + >> import urllib.request + >>> f = urllib.request.urlopen('http://www.python.org/') + >>> try: + ... print(f.read(100).decode('utf-8')) + ... finally: + ... f.close() + ... + + + | UnixStreamServer | + +-----------+ +------------------+ + | + v + +-----------+ +--------------------+ + | UDPServer |------->| UnixDatagramServer | + +-----------+ +--------------------+ + +Note that *note UnixDatagramServer: 3b3b. derives from *note UDPServer: +3b39, not from *note UnixStreamServer: 3b3a. — the only difference +between an IP and a Unix server is the address family. + + -- Class: socketserver.ForkingMixIn + -- Class: socketserver.ThreadingMixIn + + Forking and threading versions of each type of server can be + created using these mix-in classes. For instance, *note + ThreadingUDPServer: 3b40. is created as follows: + + class ThreadingUDPServer(ThreadingMixIn, UDPServer): + pass + + The mix-in class comes first, since it overrides a method defined + in *note UDPServer: 3b39. Setting the various attributes also + changes the behavior of the underlying server mechanism. + + *note ForkingMixIn: b77. and the Forking classes mentioned below + are only available on POSIX platforms that support *note fork(): + 197. + + -- Attribute: block_on_close + + *note ForkingMixIn.server_close: 3b3e. waits until all child + processes complete, except if *note block_on_close: bfd. + attribute is ‘False’. + + *note ThreadingMixIn.server_close: 3b3e. waits until all + non-daemon threads complete, except if *note block_on_close: + bfd. attribute is ‘False’. + + -- Attribute: daemon_threads + + For *note ThreadingMixIn: b78. use daemonic threads by setting + *note ThreadingMixIn.daemon_threads: 3b41. to ‘True’ to not + wait until threads complete. + + Changed in version 3.7: *note ForkingMixIn.server_close: 3b3e. and + *note ThreadingMixIn.server_close: 3b3e. now waits until all child + processes and non-daemonic threads complete. Add a new *note + ForkingMixIn.block_on_close: bfd. class attribute to opt-in for the + pre-3.7 behaviour. + + -- Class: socketserver.ForkingTCPServer + -- Class: socketserver.ForkingUDPServer + -- Class: socketserver.ThreadingTCPServer + -- Class: socketserver.ThreadingUDPServer + -- Class: socketserver.ForkingUnixStreamServer + -- Class: socketserver.ForkingUnixDatagramServer + -- Class: socketserver.ThreadingUnixStreamServer + -- Class: socketserver.ThreadingUnixDatagramServer + + These classes are pre-defined using the mix-in classes. + +Added in version 3.12: The ‘ForkingUnixStreamServer’ and +‘ForkingUnixDatagramServer’ classes were added. + +To implement a service, you must derive a class from *note +BaseRequestHandler: 3b3c. and redefine its *note handle(): 3b3d. method. +You can then run various versions of the service by combining one of the +server classes with your request handler class. The request handler +class must be different for datagram or stream services. This can be +hidden by using the handler subclasses *note StreamRequestHandler: cda. +or *note DatagramRequestHandler: 3b49. + +Of course, you still have to use your head! For instance, it makes no +sense to use a forking server if the service contains state in memory +that can be modified by different requests, since the modifications in +the child process would never reach the initial state kept in the parent +process and passed to each child. In this case, you can use a threading +server, but you will probably have to use locks to protect the integrity +of the shared data. + +On the other hand, if you are building an HTTP server where all data is +stored externally (for instance, in the file system), a synchronous +class will essentially render the service “deaf” while one request is +being handled – which may be for a very long time if a client is slow to +receive all the data it has requested. Here a threading or forking +server is appropriate. + +In some cases, it may be appropriate to process part of a request +synchronously, but to finish processing in a forked child depending on +the request data. This can be implemented by using a synchronous server +and doing an explicit fork in the request handler class *note handle(): +3b3d. method. + +Another approach to handling multiple simultaneous requests in an +environment that supports neither threads nor *note fork(): 197. (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: c2. 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 Objects<2>, Next: Request Handler Objects, Prev: Server Creation Notes, Up: socketserver — A framework for network servers + +5.22.16.2 Server Objects +........................ + + -- Class: 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: 3b4b. and *note + RequestHandlerClass: 3b4c. attributes. + + -- Method: fileno () + + Return an integer file descriptor for the socket on which the + server is listening. This function is most commonly passed to + *note selectors: c2, to allow monitoring multiple servers in + the same process. + + -- Method: handle_request () + + Process a single request. This function calls the following + methods in order: *note get_request(): 3b4e, *note + verify_request(): 3b4f, and *note process_request(): 3b50. If + the user-provided *note handle(): 3b3d. method of the handler + class raises an exception, the server’s *note handle_error(): + d41. method will be called. If no request is received within + *note timeout: 1313. seconds, *note handle_timeout(): 1314. + will be called and *note handle_request(): 1315. will return. + + -- Method: serve_forever (poll_interval=0.5) + + Handle requests until an explicit *note shutdown(): 1a34. + request. Poll for shutdown every 'poll_interval' seconds. + Ignores the *note timeout: 1313. attribute. It also calls + *note service_actions(): 1132, which may be used by a subclass + or mixin to provide actions specific to a given service. For + example, the *note ForkingMixIn: b77. class uses *note + service_actions(): 1132. to clean up zombie child processes. + + Changed in version 3.3: Added ‘service_actions’ call to the + ‘serve_forever’ method. + + -- Method: service_actions () + + This is called in the *note serve_forever(): 1133. 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. + + -- Method: shutdown () + + Tell the *note serve_forever(): 1133. loop to stop and wait + until it does. *note shutdown(): 1a34. must be called while + *note serve_forever(): 1133. is running in a different thread + otherwise it will deadlock. + + -- Method: server_close () + + Clean up the server. May be overridden. + + -- Attribute: address_family + + The family of protocols to which the server’s socket belongs. + Common examples are *note socket.AF_INET: 181c, *note + socket.AF_INET6: 181d, and *note socket.AF_UNIX: 181e. + Subclass the TCP or UDP server classes in this module with + class attribute ‘address_family = AF_INET6’ set if you want + IPv6 server classes. + + -- Attribute: RequestHandlerClass + + The user-provided request handler class; an instance of this + class is created for each request. + + -- Attribute: server_address + + The address on which the server is listening. The format of + addresses varies depending on the protocol family; see the + documentation for the *note socket: cc. module for details. + For internet protocols, this is a tuple containing a string + giving the address, and an integer port number: ‘('127.0.0.1', + 80)’, for example. + + -- Attribute: socket + + The socket object on which the server will listen for incoming + requests. + + The server classes support the following class variables: + + -- Attribute: allow_reuse_address + + Whether the server will allow the reuse of an address. This + defaults to *note False: b37, and can be set in subclasses to + change the policy. + + -- Attribute: request_queue_size + + The size of the request queue. If it takes a long time to + process a single request, any requests that arrive while the + server is busy are placed into a queue, up to *note + request_queue_size: 3b54. requests. Once the queue is full, + further requests from clients will get a “Connection denied” + error. The default value is usually 5, but this can be + overridden by subclasses. + + -- Attribute: socket_type + + The type of socket used by the server; *note + socket.SOCK_STREAM: 12e6. and *note socket.SOCK_DGRAM: 12e5. + are two common values. + + -- Attribute: timeout + + Timeout duration, measured in seconds, or *note None: 671. if + no timeout is desired. If *note handle_request(): 1315. + receives no incoming requests within the timeout period, the + *note handle_timeout(): 1314. method is called. + + There are various server methods that can be overridden by + subclasses of base server classes like *note TCPServer: 1312.; + these methods aren’t useful to external users of the server object. + + -- Method: finish_request (request, client_address) + + Actually processes the request by instantiating *note + RequestHandlerClass: 3b4c. and calling its *note handle(): + 3b3d. method. + + -- Method: get_request () + + Must accept a request from the socket, and return a 2-tuple + containing the 'new' socket object to be used to communicate + with the client, and the client’s address. + + -- Method: handle_error (request, client_address) + + This function is called if the *note handle(): 3b3d. method of + a *note RequestHandlerClass: 3b4c. instance raises an + exception. The default action is to print the traceback to + standard error and continue handling further requests. + + Changed in version 3.6: Now only called for exceptions derived + from the *note Exception: 9d9. class. + + -- Method: handle_timeout () + + This function is called when the *note timeout: 1313. + attribute has been set to a value other than *note None: 671. + and the timeout period has passed with no requests being + received. The default action for forking servers is to + collect the status of any child processes that have exited, + while in threading servers this method does nothing. + + -- Method: process_request (request, client_address) + + Calls *note finish_request(): 3b56. to create an instance of + the *note RequestHandlerClass: 3b4c. If desired, this + function can create a new process or thread to handle the + request; the *note ForkingMixIn: b77. and *note + ThreadingMixIn: b78. classes do this. + + -- Method: server_activate () + + Called by the server’s constructor to activate the server. + The default behavior for a TCP server just invokes *note + listen(): e59. on the server’s socket. May be overridden. + + -- Method: server_bind () + + Called by the server’s constructor to bind the socket to the + desired address. May be overridden. + + -- Method: verify_request (request, client_address) + + Must return a Boolean value; if the value is *note True: c0d, + the request will be processed, and if it’s *note False: b37, + the request will be denied. This function can be overridden + to implement access controls for a server. The default + implementation always returns *note True: c0d. + + Changed in version 3.6: Support for the *note context manager: 5d0. + protocol was added. Exiting the context manager is equivalent to + calling *note server_close(): 3b3e. + + +File: python.info, Node: Request Handler Objects, Next: Examples<28>, Prev: Server Objects<2>, Up: socketserver — A framework for network servers + +5.22.16.3 Request Handler Objects +................................. + + -- Class: 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(): 3b3d. method, and can override + any of the other methods. A new instance of the subclass is + created for each request. + + -- Method: setup () + + Called before the *note handle(): 3b3d. method to perform any + initialization actions required. The default implementation + does nothing. + + -- Method: 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: 3b59.; the client address as *note + client_address: 3b5a.; and the server instance as *note + server: 3b5b, in case it needs access to per-server + information. + + The type of *note request: 3b59. is different for datagram or + stream services. For stream services, *note request: 3b59. is + a socket object; for datagram services, *note request: 3b59. + is a pair of string and socket. + + -- Method: finish () + + Called after the *note handle(): 3b3d. method to perform any + clean-up actions required. The default implementation does + nothing. If *note setup(): 3b58. raises an exception, this + function will not be called. + + -- Attribute: request + + The 'new' *note socket.socket: da0. object to be used to + communicate with the client. + + -- Attribute: client_address + + Client address returned by *note BaseServer.get_request(): + 3b4e. + + -- Attribute: server + + *note BaseServer: 1131. object used for handling the request. + + -- Class: socketserver.StreamRequestHandler + -- Class: socketserver.DatagramRequestHandler + + These *note BaseRequestHandler: 3b3c. subclasses override the *note + setup(): 3b58. and *note finish(): 3b5c. methods, and provide *note + rfile: 3b5d. and *note wfile: 3b5e. attributes. + + -- Attribute: rfile + + A file object from which receives the request is read. + Support the *note io.BufferedIOBase: 690. readable interface. + + -- Attribute: wfile + + A file object to which the reply is written. Support the + *note io.BufferedIOBase: 690. writable interface + + Changed in version 3.6: *note wfile: 3b5e. also supports the *note + io.BufferedIOBase: 690. writable interface. + + +File: python.info, Node: Examples<28>, Prev: Request Handler Objects, Up: socketserver — A framework for network servers + +5.22.16.4 Examples +.................. + +* Menu: + +* socketserver.TCPServer Example: socketserver TCPServer Example. +* socketserver.UDPServer Example: socketserver UDPServer Example. +* Asynchronous Mixins:: + + +File: python.info, Node: socketserver TCPServer Example, Next: socketserver UDPServer Example, Up: Examples<28> + +5.22.16.5 ‘socketserver.TCPServer’ Example +.......................................... + +This is the server side: + + 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() + +An alternative request handler class that makes use of streams +(file-like objects that simplify communication by providing the standard +file interface): + + 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 no correlation between client ‘send()’ or ‘sendall()’ calls +and the number of ‘recv()’ calls on the server required to receive it. + +This is the client side: + + 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) + +The output of the example should look something like this: + +Server: + + $ python TCPServer.py + 127.0.0.1 wrote: + b'hello world with TCP' + 127.0.0.1 wrote: + b'python is nice' + +Client: + + $ 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 Example, Next: Asynchronous Mixins, Prev: socketserver TCPServer Example, Up: Examples<28> + +5.22.16.6 ‘socketserver.UDPServer’ Example +.......................................... + +This is the server side: + + 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() + +This is the client side: + + 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) + +The output of the example should look exactly like for the TCP server +example. + + +File: python.info, Node: Asynchronous Mixins, Prev: socketserver UDPServer Example, Up: Examples<28> + +5.22.16.7 Asynchronous Mixins +............................. + +To build asynchronous handlers, use the *note ThreadingMixIn: b78. and +*note ForkingMixIn: b77. classes. + +An example for the *note ThreadingMixIn: b78. class: + + 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() + +The output of the example should look something like this: + + $ 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 + +The *note ForkingMixIn: b77. class is used in the same way, except that +the server will spawn a new process for each request. Available only on +POSIX platforms that support *note fork(): 197. + + +File: python.info, Node: http server — HTTP servers, Next: http cookies — HTTP state management, Prev: socketserver — A framework for network servers, Up: Internet Protocols and Support + +5.22.17 ‘http.server’ — HTTP servers +------------------------------------ + +'Source code:' Lib/http/server.py(1) + +__________________________________________________________________ + +This module defines classes for implementing HTTP servers. + + Warning: *note http.server: 72. is not recommended for production. + It only implements *note basic security checks: 3b65. + +*note Availability: 1d54.: not WASI. + +This module does not work or is not available on WebAssembly. See *note +WebAssembly platforms: 17e0. for more information. + +One class, *note HTTPServer: 396b, is a *note socketserver.TCPServer: +1312. subclass. It creates and listens at the HTTP socket, dispatching +the requests to a handler. Code to create and run the server looks like +this: + + def run(server_class=HTTPServer, handler_class=BaseHTTPRequestHandler): + server_address = ('', 8000) + httpd = server_class(server_address, handler_class) + httpd.serve_forever() + + -- Class: http.server.HTTPServer (server_address, RequestHandlerClass) + + This class builds on the *note TCPServer: 1312. class by storing + the server address as instance variables named ‘server_name’ and + ‘server_port’. The server is accessible by the handler, typically + through the handler’s ‘server’ instance variable. + + -- Class: http.server.ThreadingHTTPServer (server_address, + RequestHandlerClass) + + This class is identical to HTTPServer but uses threads to handle + requests by using the *note ThreadingMixIn: b78. This is useful to + handle web browsers pre-opening sockets, on which *note HTTPServer: + 396b. would wait indefinitely. + + Added in version 3.7. + +The *note HTTPServer: 396b. and *note ThreadingHTTPServer: b44. must be +given a 'RequestHandlerClass' on instantiation, of which this module +provides three different variants: + + -- Class: 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 (e.g. GET or + POST). *note BaseHTTPRequestHandler: 10c1. 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: 10c1. has the following instance + variables: + + -- Attribute: client_address + + Contains a tuple of the form ‘(host, port)’ referring to the + client’s address. + + -- Attribute: server + + Contains the server instance. + + -- Attribute: close_connection + + Boolean that should be set before *note handle_one_request(): + 3b69. returns, indicating if another request may be expected, + or if the connection should be shut down. + + -- Attribute: requestline + + Contains the string representation of the HTTP request line. + The terminating CRLF is stripped. This attribute should be + set by *note handle_one_request(): 3b69. If no valid request + line was processed, it should be set to the empty string. + + -- Attribute: command + + Contains the command (request type). For example, ‘'GET'’. + + -- Attribute: 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’. + + -- Attribute: request_version + + Contains the version string from the request. For example, + ‘'HTTP/1.0'’. + + -- Attribute: headers + + Holds an instance of the class specified by the *note + MessageClass: 3b6e. class variable. This instance parses and + manages the headers in the HTTP request. The *note + parse_headers(): 1a48. function from *note http.client: 6f. is + used to parse the headers and it requires that the HTTP + request provide a valid RFC 2822(3) style header. + + -- Attribute: rfile + + An *note io.BufferedIOBase: 690. input stream, ready to read + from the start of the optional input data. + + -- Attribute: 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. + + Changed in version 3.6: This is an *note io.BufferedIOBase: + 690. stream. + + *note BaseHTTPRequestHandler: 10c1. has the following attributes: + + -- Attribute: server_version + + Specifies the server software version. You may want to + override this. The format is multiple whitespace-separated + strings, where each string is of the form name[/version]. For + example, ‘'BaseHTTP/0.2'’. + + -- Attribute: sys_version + + Contains the Python system version, in a form usable by the + *note version_string: 3b73. method and the *note + server_version: 3b71. class variable. For example, + ‘'Python/1.4'’. + + -- Attribute: error_message_format + + Specifies a format string that should be used by *note + send_error(): f4b. method for building an error response to + the client. The string is filled by default with variables + from *note responses: 3a3a. based on the status code that + passed to *note send_error(): f4b. + + -- Attribute: error_content_type + + Specifies the Content-Type HTTP header of error responses sent + to the client. The default value is ‘'text/html'’. + + -- Attribute: 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(): + 3b77.) in all of its responses to clients. For backwards + compatibility, the setting defaults to ‘'HTTP/1.0'’. + + -- Attribute: MessageClass + + Specifies an *note email.message.Message: 27e.-like class to + parse HTTP headers. Typically, this is not overridden, and it + defaults to *note http.client.HTTPMessage: 3a51. + + -- Attribute: 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(): 3b78. and *note + send_error(): f4b. methods. + + A *note BaseHTTPRequestHandler: 10c1. instance has the following + methods: + + -- Method: handle () + + Calls *note handle_one_request(): 3b69. 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. + + -- Method: handle_one_request () + + This method will parse and dispatch the request to the + appropriate ‘do_*()’ method. You should never need to + override it. + + -- Method: 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 e.g. server can choose to send ‘417 + Expectation Failed’ as a response header and ‘return False’. + + Added in version 3.2. + + -- Method: 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: 3b74. attribute and + emitted, after a complete set of headers, as the response + body. The *note responses: 3a3a. 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’. + + Changed in version 3.4: The error response includes a + Content-Length header. Added the 'explain' argument. + + -- Method: 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(): 3b73. and *note date_time_string(): 3b7c. + methods, respectively. If the server does not intend to send + any other headers using the *note send_header(): 3b77. method, + then *note send_response(): 3b7b. should be followed by an + *note end_headers(): 10c2. call. + + Changed in version 3.3: Headers are stored to an internal + buffer and *note end_headers(): 10c2. needs to be called + explicitly. + + -- Method: 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(): + 10c2. or *note flush_headers(): 10c3. is invoked. 'keyword' + should specify the header keyword, with 'value' specifying its + value. Note that, after the send_header calls are done, *note + end_headers(): 10c2. MUST BE called in order to complete the + operation. + + Changed in version 3.2: Headers are stored in an internal + buffer. + + -- Method: send_response_only (code, message=None) + + Sends the response header only, used for the purposes when + ‘100 Continue’ response is sent by the server to the client. + The headers not buffered and sent directly the output + stream.If the 'message' is not specified, the HTTP message + corresponding the response 'code' is sent. + + Added in version 3.2. + + -- Method: 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(): 10c3. + + Changed in version 3.2: The buffered headers are written to + the output stream. + + -- Method: flush_headers () + + Finally send the headers to the output stream and flush the + internal headers buffer. + + Added in version 3.3. + + -- Method: log_request (code='-', size='-') + + Logs an accepted (successful) request. 'code' should specify + the numeric HTTP code associated with the response. If a size + of the response is available, then it should be passed as the + 'size' parameter. + + -- Method: log_error (...) + + Logs an error when a request cannot be fulfilled. By default, + it passes the message to *note log_message(): 3b7f, so it + takes the same arguments ('format' and additional values). + + -- Method: log_message (format, ...) + + Logs an arbitrary message to ‘sys.stderr’. This is typically + overridden to create custom error logging mechanisms. The + 'format' argument is a standard printf-style format string, + where the additional arguments to *note log_message(): 3b7f. + are applied as inputs to the formatting. The client ip + address and current date and time are prefixed to every + message logged. + + -- Method: version_string () + + Returns the server software’s version string. This is a + combination of the *note server_version: 3b71. and *note + sys_version: 3b72. attributes. + + -- Method: date_time_string (timestamp=None) + + Returns the date and time given by 'timestamp' (which must be + ‘None’ or in the format returned by *note time.time(): 256.), + formatted for a message header. If 'timestamp' is omitted, it + uses the current date and time. + + The result looks like ‘'Sun, 06 Nov 1994 08:49:37 GMT'’. + + -- Method: log_date_time_string () + + Returns the current date and time, formatted for logging. + + -- Method: address_string () + + Returns the client address. + + Changed in version 3.3: Previously, a name lookup was + performed. To avoid name resolution delays, it now always + returns the IP address. + + -- Class: http.server.SimpleHTTPRequestHandler (request, + client_address, server, directory=None) + + This class serves files from the directory 'directory' and below, + or the current directory if 'directory' is not provided, directly + mapping the directory structure to HTTP requests. + + Changed in version 3.7: Added the 'directory' parameter. + + Changed in version 3.9: The 'directory' parameter accepts a *note + path-like object: 2a2. + + A lot of the work, such as parsing the request, is done by the base + class *note BaseHTTPRequestHandler: 10c1. This class implements + the *note do_GET(): 3b82. and *note do_HEAD(): 3b83. functions. + + The following are defined as class-level attributes of *note + SimpleHTTPRequestHandler: b43.: + + -- Attribute: server_version + + This will be ‘"SimpleHTTP/" + __version__’, where + ‘__version__’ is defined at the module level. + + -- Attribute: 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. + + Changed in version 3.9: This dictionary is no longer filled + with the default system mappings, but only contains overrides. + + The *note SimpleHTTPRequestHandler: b43. class defines the + following methods: + + -- Method: do_HEAD () + + This method serves the ‘'HEAD'’ request type: it sends the + headers it would send for the equivalent ‘GET’ request. See + the *note do_GET(): 3b82. method for a more complete + explanation of the possible headers. + + -- Method: do_GET () + + The request is mapped to a local file by interpreting the + request as a path relative to the current working directory. + + If the request was mapped to a directory, the directory is + checked for a file named ‘index.html’ or ‘index.htm’ (in that + order). If found, the file’s contents are returned; otherwise + a directory listing is generated by calling the + ‘list_directory()’ method. This method uses *note + os.listdir(): 10ee. to scan the directory, and returns a ‘404’ + error response if the *note listdir(): 10ee. fails. + + If the request was mapped to a file, it is opened. Any *note + OSError: 413. 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. + + A ‘'Content-type:'’ header with the guessed content type is + output, followed by a ‘'Content-Length:'’ header with the + file’s size and a ‘'Last-Modified:'’ header with the file’s + modification time. + + 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). + + Changed in version 3.7: Support of the ‘'If-Modified-Since'’ + header. + +The *note SimpleHTTPRequestHandler: b43. 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: b43. can also be subclassed to enhance +behavior, such as using different index file names by overriding the +class attribute ‘index_pages’. + + -- Class: http.server.CGIHTTPRequestHandler (request, client_address, + server) + + This class is used to serve either files or output of CGI scripts + from the current directory and below. Note that mapping HTTP + hierarchic structure to local directory structure is exactly as in + *note SimpleHTTPRequestHandler: b43. + + Note: CGI scripts run by the *note CGIHTTPRequestHandler: 2a3. + class cannot execute redirects (HTTP code 302), because code + 200 (script output follows) is sent prior to execution of the + CGI script. This pre-empts the status code. + + The class will however, run the CGI script, instead of serving it + as a file, if it guesses it to be a CGI script. Only + directory-based CGI are used — the other common server + configuration is to treat special extensions as denoting CGI + scripts. + + The ‘do_GET()’ and ‘do_HEAD()’ functions are modified to run CGI + scripts and serve the output, instead of serving files, if the + request leads to somewhere below the ‘cgi_directories’ path. + + The *note CGIHTTPRequestHandler: 2a3. defines the following data + member: + + -- Attribute: cgi_directories + + This defaults to ‘['/cgi-bin', '/htbin']’ and describes + directories to treat as containing CGI scripts. + + The *note CGIHTTPRequestHandler: 2a3. defines the following method: + + -- Method: do_POST () + + This method serves the ‘'POST'’ request type, only allowed for + CGI scripts. Error 501, “Can only POST to CGI scripts”, is + output when trying to POST to a non-CGI url. + + Note that CGI scripts will be run with UID of user nobody, for + security reasons. Problems with the CGI script will be translated + to error 403. + + Deprecated since version 3.13, will be removed in version 3.15: + *note CGIHTTPRequestHandler: 2a3. is being removed in 3.15. CGI + has not been considered a good way to do things for well over a + decade. This code has been unmaintained for a while now and sees + very little practical use. Retaining it could lead to further + *note security considerations: 3b65. + +* Menu: + +* Command-line interface: Command-line interface<2>. +* Security considerations: Security considerations<3>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/http/server.py + + (2) https://datatracker.ietf.org/doc/html/rfc3986.html + + (3) https://datatracker.ietf.org/doc/html/rfc2822.html + + (4) https://github.com/python/cpython/tree/3.13/Lib/http/server.py + + +File: python.info, Node: Command-line interface<2>, Next: Security considerations<3>, Up: http server — HTTP servers + +5.22.17.1 Command-line interface +................................ + +*note http.server: 72. can also be invoked directly using the *note -m: +5dd. switch of the interpreter. The following example illustrates how +to serve files relative to the current directory: + + python -m http.server [OPTIONS] [port] + +The following options are accepted: + + -- 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
    + + 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. + + Changed in version 3.8: Support IPv6 in the ‘--bind’ option. + + -- Option: -d, --directory + + 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 + + Specifies the HTTP version to which the server is conformant. By + default, the server is conformant to HTTP/1.0. For example, the + following command runs an HTTP/1.1 conformant server: + + python -m http.server --protocol HTTP/1.1 + + Added in version 3.11. + + -- Option: --cgi + + *note CGIHTTPRequestHandler: 2a3. can be enabled in the command + line by passing the ‘--cgi’ option: + + python -m http.server --cgi + + Deprecated since version 3.13, will be removed in version 3.15: + *note http.server: 72. command line ‘--cgi’ support is being + removed because *note CGIHTTPRequestHandler: 2a3. is being removed. + + Warning: *note CGIHTTPRequestHandler: 2a3. and the ‘--cgi’ + command-line option are not intended for use by untrusted clients + and may be vulnerable to exploitation. Always use within a secure + environment. + + +File: python.info, Node: Security considerations<3>, Prev: Command-line interface<2>, Up: http server — HTTP servers + +5.22.17.2 Security considerations +................................. + +*note SimpleHTTPRequestHandler: b43. will follow symbolic links when +handling requests, this makes it possible for files outside of the +specified directory to be served. + +Earlier versions of Python did not scrub control characters from the log +messages emitted to stderr from ‘python -m http.server’ or the default +*note BaseHTTPRequestHandler: 10c1. ‘.log_message’ implementation. This +could allow remote clients connecting to your server to send nefarious +control codes to your terminal. + +Changed in version 3.12: Control characters are scrubbed in stderr logs. + + +File: python.info, Node: http cookies — HTTP state management, Next: http cookiejar — Cookie handling for HTTP clients, Prev: http server — HTTP servers, Up: Internet Protocols and Support + +5.22.18 ‘http.cookies’ — HTTP state management +---------------------------------------------- + +'Source code:' Lib/http/cookies.py(1) + +__________________________________________________________________ + +The *note http.cookies: 71. 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. + +The module formerly strictly applied the parsing rules described in the +RFC 2109(2) and RFC 2068(3) specifications. It has since been +discovered that MSIE 3.0x didn’t follow the character rules outlined in +those specs; many current-day browsers and servers have also relaxed +parsing rules when it comes to cookie handling. As a result, this +module now uses parsing rules that are a bit less strict than they once +were. + +The character set, *note string.ascii_letters: 12b6, *note +string.digits: 22c2. and ‘!#$%&'*+-.^_`|~:’ denote the set of valid +characters allowed by this module in a cookie name (as *note key: c01.). + +Changed in version 3.3: Allowed ‘:’ as a valid cookie name character. + + Note: On encountering an invalid cookie, *note CookieError: 3b94. + is raised, so if your cookie data comes from a browser you should + always prepare for invalid data and catch *note CookieError: 3b94. + on parsing. + + -- Exception: http.cookies.CookieError + + Exception failing because of RFC 2109(4) invalidity: incorrect + attributes, incorrect ‘Set-Cookie’ header, etc. + + -- Class: http.cookies.BaseCookie ([input]) + + This class is a dictionary-like object whose keys are strings and + whose values are *note Morsel: c04. instances. Note that upon + setting a key to a value, the value is first converted to a *note + Morsel: c04. containing the key and the value. + + If 'input' is given, it is passed to the *note load(): 3b96. + method. + + -- Class: http.cookies.SimpleCookie ([input]) + + This class derives from *note BaseCookie: 3b95. and overrides *note + value_decode(): 3b97. and *note value_encode(): 3b98. + ‘SimpleCookie’ supports strings as cookie values. When setting the + value, ‘SimpleCookie’ calls the builtin *note str(): 447. to + convert the value to a string. Values received from HTTP are kept + as strings. + +See also +........ + +Module *note http.cookiejar: 70. + + HTTP cookie handling for web 'clients'. The *note http.cookiejar: + 70. and *note http.cookies: 71. modules do not depend on each + other. + +RFC 2109(5) - HTTP State Management Mechanism + + This is the state management specification implemented by this + module. + +* Menu: + +* Cookie Objects:: +* Morsel Objects:: +* Example: Example<12>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 Objects, Next: Morsel Objects, Up: http cookies — HTTP state management + +5.22.18.1 Cookie Objects +........................ + + -- Method: BaseCookie.value_decode (val) + + Return a tuple ‘(real_value, coded_value)’ from a string + representation. ‘real_value’ can be any type. This method does no + decoding in *note BaseCookie: 3b95. — it exists so it can be + overridden. + + -- Method: BaseCookie.value_encode (val) + + Return a tuple ‘(real_value, coded_value)’. 'val' can be any type, + but ‘coded_value’ will always be converted to a string. This + method does no encoding in *note BaseCookie: 3b95. — it exists so + it can be overridden. + + In general, it should be the case that *note value_encode(): 3b98. + and *note value_decode(): 3b97. are inverses on the range of + 'value_decode'. + + -- Method: 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: c04.’s *note + output(): 3b9c. method. 'sep' is used to join the headers + together, and is by default the combination ‘'\r\n'’ (CRLF). + + -- Method: BaseCookie.js_output (attrs=None) + + Return an embeddable JavaScript snippet, which, if run on a browser + which supports JavaScript, will act the same as if the HTTP headers + was sent. + + The meaning for 'attrs' is the same as in *note output(): 3b9b. + + -- Method: BaseCookie.load (rawdata) + + If 'rawdata' is a string, parse it as an ‘HTTP_COOKIE’ and add the + values found there as *note Morsel: c04.s. If it is a dictionary, + it is equivalent to: + + for k, v in rawdata.items(): + cookie[k] = v + + +File: python.info, Node: Morsel Objects, Next: Example<12>, Prev: Cookie Objects, Up: http cookies — HTTP state management + +5.22.18.2 Morsel Objects +........................ + + -- Class: http.cookies.Morsel + + Abstract a key/value pair, which has some RFC 2109(1) attributes. + + Morsels are dictionary-like objects, whose set of keys is constant + — the valid RFC 2109(2) attributes, which are: + + -- Attribute: expires + -- Attribute: path + -- Attribute: comment + -- Attribute: domain + + -- Attribute: max-age + -- Attribute: secure + -- Attribute: version + -- Attribute: httponly + -- Attribute: samesite + + The attribute *note httponly: 139c. specifies that the cookie is + only transferred in HTTP requests, and is not accessible through + JavaScript. This is intended to mitigate some forms of cross-site + scripting. + + The attribute *note samesite: 3ba6. 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 keys are case-insensitive and their default value is ‘''’. + + Changed in version 3.5: ‘__eq__()’ now takes *note key: c01. and + *note value: c02. into account. + + Changed in version 3.7: Attributes *note key: c01, *note value: + c02. and *note coded_value: c03. are read-only. Use *note set(): + c05. for setting them. + + Changed in version 3.8: Added support for the *note samesite: 3ba6. + attribute. + + -- Attribute: Morsel.value + + The value of the cookie. + + -- Attribute: Morsel.coded_value + + The encoded value of the cookie — this is what should be sent. + + -- Attribute: Morsel.key + + The name of the cookie. + + -- Method: Morsel.set (key, value, coded_value) + + Set the 'key', 'value' and 'coded_value' attributes. + + -- Method: Morsel.isReservedKey (K) + + Whether 'K' is a member of the set of keys of a *note Morsel: c04. + + -- Method: Morsel.output (attrs=None, header='Set-Cookie:') + + Return a string representation of the Morsel, suitable to be sent + as an HTTP header. By default, all the attributes are included, + unless 'attrs' is given, in which case it should be a list of + attributes to use. 'header' is by default ‘"Set-Cookie:"’. + + -- Method: Morsel.js_output (attrs=None) + + Return an embeddable JavaScript snippet, which, if run on a browser + which supports JavaScript, will act the same as if the HTTP header + was sent. + + The meaning for 'attrs' is the same as in *note output(): 3b9c. + + -- Method: Morsel.OutputString (attrs=None) + + Return a string representing the Morsel, without any surrounding + HTTP or JavaScript. + + The meaning for 'attrs' is the same as in *note output(): 3b9c. + + -- Method: Morsel.update (values) + + Update the values in the Morsel dictionary with the values in the + dictionary 'values'. Raise an error if any of the keys in the + 'values' dict is not a valid RFC 2109(3) attribute. + + Changed in version 3.5: an error is raised for invalid keys. + + -- Method: Morsel.copy (value) + + Return a shallow copy of the Morsel object. + + Changed in version 3.5: return a Morsel object instead of a dict. + + -- Method: Morsel.setdefault (key, value=None) + + Raise an error if key is not a valid RFC 2109(4) attribute, + otherwise behave the same as *note dict.setdefault(): 1072. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2109.html + + (2) https://datatracker.ietf.org/doc/html/rfc2109.html + + (3) https://datatracker.ietf.org/doc/html/rfc2109.html + + (4) https://datatracker.ietf.org/doc/html/rfc2109.html + + +File: python.info, Node: Example<12>, Prev: Morsel Objects, Up: http cookies — HTTP state management + +5.22.18.3 Example +................. + +The following example demonstrates how to use the *note http.cookies: +71. 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=\\012;";') + >>> print(C) + Set-Cookie: keebler="E=everybody; L=\"Loves\"; fudge=\012;" + >>> 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 — Cookie handling for HTTP clients, Next: xmlrpc — XMLRPC server and client modules, Prev: http cookies — HTTP state management, Up: Internet Protocols and Support + +5.22.19 ‘http.cookiejar’ — Cookie handling for HTTP clients +----------------------------------------------------------- + +'Source code:' Lib/http/cookiejar.py(1) + +__________________________________________________________________ + +The *note http.cookiejar: 70. module defines classes for automatic +handling of HTTP cookies. It is useful for accessing web sites 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. *note http.cookiejar: 70. 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. + + Note: The various named parameters found in ‘Set-Cookie’ and + ‘Set-Cookie2’ headers (eg. ‘domain’ and ‘expires’) are + conventionally referred to as 'attributes'. To distinguish them + from Python attributes, the documentation for this module uses the + term 'cookie-attribute' instead. + +The module defines the following exception: + + -- Exception: http.cookiejar.LoadError + + Instances of *note FileCookieJar: 3bb0. raise this exception on + failure to load cookies from a file. *note LoadError: 3baf. is a + subclass of *note OSError: 413. + + Changed in version 3.3: *note LoadError: 3baf. used to be a subtype + of *note IOError: 104b, which is now an alias of *note OSError: + 413. + +The following classes are provided: + + -- Class: http.cookiejar.CookieJar (policy=None) + + 'policy' is an object implementing the *note CookiePolicy: 3bb1. + interface. + + The *note CookieJar: 39da. class stores HTTP cookies. It extracts + cookies from HTTP requests, and returns them in HTTP responses. + *note CookieJar: 39da. instances automatically expire contained + cookies when necessary. Subclasses are also responsible for + storing and retrieving cookies from a file or database. + + -- Class: http.cookiejar.FileCookieJar (filename=None, delayload=None, + policy=None) + + 'policy' is an object implementing the *note CookiePolicy: 3bb1. + interface. For the other arguments, see the documentation for the + corresponding attributes. + + A *note CookieJar: 39da. which can load cookies from, and perhaps + save cookies to, a file on disk. Cookies are 'NOT' loaded from the + named file until either the *note load(): 3bb2. or *note revert(): + 3bb3. method is called. Subclasses of this class are documented in + section *note FileCookieJar subclasses and co-operation with web + browsers: 3bb4. + + This should not be initialized directly – use its subclasses below + instead. + + Changed in version 3.8: The filename parameter supports a *note + path-like object: 2a2. + + -- Class: http.cookiejar.CookiePolicy + + This class is responsible for deciding whether each cookie should + be accepted from / returned to the server. + + -- Class: 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')) + + Constructor arguments should be passed as keyword arguments only. + 'blocked_domains' is a sequence of domain names that we never + accept cookies from, nor return cookies to. 'allowed_domains' if + not *note None: 671, this is a sequence of the only domains for + which we accept and return cookies. 'secure_protocols' is a + sequence of protocols for which secure cookies can be added to. By + default 'https' and 'wss' (secure websocket) are considered secure + protocols. For all other arguments, see the documentation for + *note CookiePolicy: 3bb1. and *note DefaultCookiePolicy: 1a10. + objects. + + *note DefaultCookiePolicy: 1a10. implements the standard accept / + reject rules for Netscape and RFC 2965(4) cookies. By default, RFC + 2109(5) cookies (ie. cookies received in a ‘Set-Cookie’ header + with a version cookie-attribute of 1) are treated according to the + RFC 2965 rules. However, if RFC 2965 handling is turned off or + *note rfc2109_as_netscape: 3bb5. is ‘True’, RFC 2109 cookies are + ‘downgraded’ by the *note CookieJar: 39da. instance to Netscape + cookies, by setting the ‘version’ attribute of the *note Cookie: + 3bb6. instance to 0. *note DefaultCookiePolicy: 1a10. also + provides some parameters to allow some fine-tuning of policy. + + -- Class: http.cookiejar.Cookie + + This class represents Netscape, RFC 2109(6) and RFC 2965(7) + cookies. It is not expected that users of *note http.cookiejar: + 70. construct their own *note Cookie: 3bb6. instances. Instead, if + necessary, call ‘make_cookies()’ on a *note CookieJar: 39da. + instance. + +See also +........ + +Module *note urllib.request: 10b. + + URL opening with automatic cookie handling. + +Module *note http.cookies: 71. + + HTTP cookie classes, principally useful for server-side code. The + *note http.cookiejar: 70. and *note http.cookies: 71. 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 *note http.cookiejar: + 70.) only bears a passing resemblance to the one sketched out in + ‘cookie_spec.html’. + +RFC 2109(8) - HTTP State Management Mechanism + + Obsoleted by RFC 2965(9). Uses ‘Set-Cookie’ with version=1. + +RFC 2965(10) - HTTP State Management Mechanism + + The Netscape protocol with the bugs fixed. Uses ‘Set-Cookie2’ in + place of ‘Set-Cookie’. Not widely used. + +‘https://kristol.org/cookie/errata.html’ + + Unfinished errata to RFC 2965(11). + +RFC 2964(12) - Use of HTTP State Management + +* Menu: + +* CookieJar and FileCookieJar Objects:: +* FileCookieJar subclasses and co-operation with web browsers:: +* CookiePolicy Objects:: +* DefaultCookiePolicy Objects:: +* Cookie Objects: Cookie Objects<2>. +* Examples: Examples<29>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 and FileCookieJar Objects, Next: FileCookieJar subclasses and co-operation with web browsers, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.1 CookieJar and FileCookieJar Objects +............................................. + +*note CookieJar: 39da. objects support the *note iterator: 1ac. protocol +for iterating over contained *note Cookie: 3bb6. objects. + +*note CookieJar: 39da. has the following methods: + + -- Method: CookieJar.add_cookie_header (request) + + Add correct ‘Cookie’ header to 'request'. + + If policy allows (ie. the ‘rfc2965’ and ‘hide_cookie2’ attributes + of the *note CookieJar: 39da.’s *note CookiePolicy: 3bb1. instance + are true and false respectively), the ‘Cookie2’ header is also + added when appropriate. + + The 'request' object (usually a *note urllib.request.Request: fd3. + instance) must support the methods ‘get_full_url()’, + ‘has_header()’, ‘get_header()’, ‘header_items()’, + ‘add_unredirected_header()’ and the attributes ‘host’, ‘type’, + ‘unverifiable’ and ‘origin_req_host’ as documented by *note + urllib.request: 10b. + + Changed in version 3.3: 'request' object needs ‘origin_req_host’ + attribute. Dependency on a deprecated method + ‘get_origin_req_host()’ has been removed. + + -- Method: CookieJar.extract_cookies (response, request) + + Extract cookies from HTTP 'response' and store them in the *note + CookieJar: 39da, where allowed by policy. + + The *note CookieJar: 39da. will look for allowable ‘Set-Cookie’ and + ‘Set-Cookie2’ headers in the 'response' argument, and store cookies + as appropriate (subject to the *note CookiePolicy.set_ok(): 3bbb. + method’s approval). + + The 'response' object (usually the result of a call to *note + urllib.request.urlopen(): 295, or similar) should support an + ‘info()’ method, which returns an *note email.message.Message: 27e. + instance. + + The 'request' object (usually a *note urllib.request.Request: fd3. + instance) must support the method ‘get_full_url()’ and the + attributes ‘host’, ‘unverifiable’ and ‘origin_req_host’, as + documented by *note urllib.request: 10b. The request is used to + set default values for cookie-attributes as well as for checking + that the cookie is allowed to be set. + + Changed in version 3.3: 'request' object needs ‘origin_req_host’ + attribute. Dependency on a deprecated method + ‘get_origin_req_host()’ has been removed. + + -- Method: CookieJar.set_policy (policy) + + Set the *note CookiePolicy: 3bb1. instance to be used. + + -- Method: CookieJar.make_cookies (response, request) + + Return sequence of *note Cookie: 3bb6. objects extracted from + 'response' object. + + See the documentation for *note extract_cookies(): 3bba. for the + interfaces required of the 'response' and 'request' arguments. + + -- Method: CookieJar.set_cookie_if_ok (cookie, request) + + Set a *note Cookie: 3bb6. if policy says it’s OK to do so. + + -- Method: CookieJar.set_cookie (cookie) + + Set a *note Cookie: 3bb6, without checking with policy to see + whether or not it should be set. + + -- Method: CookieJar.clear ([domain[, path[, name]]]) + + Clear some cookies. + + If invoked without arguments, clear all cookies. If given a single + argument, only cookies belonging to that 'domain' will be removed. + If given two arguments, cookies belonging to the specified 'domain' + and URL 'path' are removed. If given three arguments, then the + cookie with the specified 'domain', 'path' and 'name' is removed. + + Raises *note KeyError: 33f. if no matching cookie exists. + + -- Method: CookieJar.clear_session_cookies () + + Discard all session cookies. + + Discards all contained cookies that have a true ‘discard’ attribute + (usually because they had either no ‘max-age’ or ‘expires’ + cookie-attribute, or an explicit ‘discard’ cookie-attribute). For + interactive browsers, the end of a session usually corresponds to + closing the browser window. + + Note that the ‘save()’ method won’t save session cookies anyway, + unless you ask otherwise by passing a true 'ignore_discard' + argument. + +*note FileCookieJar: 3bb0. implements the following additional methods: + + -- Method: FileCookieJar.save (filename=None, ignore_discard=False, + ignore_expires=False) + + Save cookies to a file. + + This base class raises *note NotImplementedError: 22a. Subclasses + may leave this method unimplemented. + + 'filename' is the name of file in which to save cookies. If + 'filename' is not specified, ‘self.filename’ is used (whose default + is the value passed to the constructor, if any); if ‘self.filename’ + is *note None: 671, *note ValueError: 204. is raised. + + 'ignore_discard': save even cookies set to be discarded. + 'ignore_expires': save even cookies that have expired + + The file is overwritten if it already exists, thus wiping all the + cookies it contains. Saved cookies can be restored later using the + *note load(): 3bb2. or *note revert(): 3bb3. methods. + + -- Method: FileCookieJar.load (filename=None, ignore_discard=False, + ignore_expires=False) + + Load cookies from a file. + + Old cookies are kept unless overwritten by newly loaded ones. + + Arguments are as for *note save(): 3bc2. + + The named file must be in the format understood by the class, or + *note LoadError: 3baf. will be raised. Also, *note OSError: 413. + may be raised, for example if the file does not exist. + + Changed in version 3.3: *note IOError: 104b. used to be raised, it + is now an alias of *note OSError: 413. + + -- Method: FileCookieJar.revert (filename=None, ignore_discard=False, + ignore_expires=False) + + Clear all cookies and reload cookies from a saved file. + + *note revert(): 3bb3. can raise the same exceptions as *note + load(): 3bb2. If there is a failure, the object’s state will not + be altered. + +*note FileCookieJar: 3bb0. instances have the following public +attributes: + + -- Attribute: FileCookieJar.filename + + Filename of default file in which to keep cookies. This attribute + may be assigned to. + + -- Attribute: FileCookieJar.delayload + + If true, load cookies lazily from disk. This attribute should not + be assigned to. This is only a hint, since this only affects + performance, not behaviour (unless the cookies on disk are + changing). A *note CookieJar: 39da. object may ignore it. None of + the *note FileCookieJar: 3bb0. classes included in the standard + library lazily loads cookies. + + +File: python.info, Node: FileCookieJar subclasses and co-operation with web browsers, Next: CookiePolicy Objects, Prev: CookieJar and FileCookieJar Objects, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.2 FileCookieJar subclasses and co-operation with web browsers +..................................................................... + +The following *note CookieJar: 39da. subclasses are provided for reading +and writing. + + -- Class: http.cookiejar.MozillaCookieJar (filename=None, + delayload=None, policy=None) + + A *note FileCookieJar: 3bb0. that can load from and save cookies to + disk in the Mozilla ‘cookies.txt’ file format (which is also used + by curl and the Lynx and Netscape browsers). + + Note: This loses information about RFC 2965(1) cookies, and + also about newer or non-standard cookie-attributes such as + ‘port’. + + Warning: Back up your cookies before saving if you have + cookies whose loss / corruption would be inconvenient (there + are some subtleties which may lead to slight changes in the + file over a load / save round-trip). + + Also note that cookies saved while Mozilla is running will get + clobbered by Mozilla. + + -- Class: http.cookiejar.LWPCookieJar (filename=None, delayload=None, + policy=None) + + A *note FileCookieJar: 3bb0. that can load from and save cookies to + disk in format compatible with the libwww-perl library’s + ‘Set-Cookie3’ file format. This is convenient if you want to store + cookies in a human-readable file. + + Changed in version 3.8: The filename parameter supports a *note + path-like object: 2a2. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2965.html + + +File: python.info, Node: CookiePolicy Objects, Next: DefaultCookiePolicy Objects, Prev: FileCookieJar subclasses and co-operation with web browsers, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.3 CookiePolicy Objects +.............................. + +Objects implementing the *note CookiePolicy: 3bb1. interface have the +following methods: + + -- Method: CookiePolicy.set_ok (cookie, request) + + Return boolean value indicating whether cookie should be accepted + from server. + + 'cookie' is a *note Cookie: 3bb6. instance. 'request' is an object + implementing the interface defined by the documentation for *note + CookieJar.extract_cookies(): 3bba. + + -- Method: CookiePolicy.return_ok (cookie, request) + + Return boolean value indicating whether cookie should be returned + to server. + + 'cookie' is a *note Cookie: 3bb6. instance. 'request' is an object + implementing the interface defined by the documentation for *note + CookieJar.add_cookie_header(): 3bb9. + + -- Method: CookiePolicy.domain_return_ok (domain, request) + + Return ‘False’ if cookies should not be returned, given cookie + domain. + + This method is an optimization. It removes the need for checking + every cookie with a particular domain (which might involve reading + many files). Returning true from *note domain_return_ok(): 3bcb. + and *note path_return_ok(): 3bcc. leaves all the work to *note + return_ok(): 3bca. + + If *note domain_return_ok(): 3bcb. returns true for the cookie + domain, *note path_return_ok(): 3bcc. is called for the cookie + path. Otherwise, *note path_return_ok(): 3bcc. and *note + return_ok(): 3bca. are never called for that cookie domain. If + *note path_return_ok(): 3bcc. returns true, *note return_ok(): + 3bca. is called with the *note Cookie: 3bb6. object itself for a + full check. Otherwise, *note return_ok(): 3bca. is never called + for that cookie path. + + Note that *note domain_return_ok(): 3bcb. is called for every + 'cookie' domain, not just for the 'request' domain. For example, + the function might be called with both ‘".example.com"’ and + ‘"www.example.com"’ if the request domain is ‘"www.example.com"’. + The same goes for *note path_return_ok(): 3bcc. + + The 'request' argument is as documented for *note return_ok(): + 3bca. + + -- Method: CookiePolicy.path_return_ok (path, request) + + Return ‘False’ if cookies should not be returned, given cookie + path. + + See the documentation for *note domain_return_ok(): 3bcb. + +In addition to implementing the methods above, implementations of the +*note CookiePolicy: 3bb1. interface must also supply the following +attributes, indicating which protocols should be used, and how. All of +these attributes may be assigned to. + + -- Attribute: CookiePolicy.netscape + + Implement Netscape protocol. + + -- Attribute: CookiePolicy.rfc2965 + + Implement RFC 2965(1) protocol. + + -- Attribute: CookiePolicy.hide_cookie2 + + Don’t add ‘Cookie2’ header to requests (the presence of this header + indicates to the server that we understand RFC 2965(2) cookies). + +The most useful way to define a *note CookiePolicy: 3bb1. class is by +subclassing from *note DefaultCookiePolicy: 1a10. and overriding some or +all of the methods above. *note CookiePolicy: 3bb1. itself may be used +as a ‘null policy’ to allow setting and receiving any and all cookies +(this is unlikely to be useful). + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2965.html + + (2) https://datatracker.ietf.org/doc/html/rfc2965.html + + +File: python.info, Node: DefaultCookiePolicy Objects, Next: Cookie Objects<2>, Prev: CookiePolicy Objects, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.4 DefaultCookiePolicy Objects +..................................... + +Implements the standard rules for accepting and returning cookies. + +Both RFC 2965(1) and Netscape cookies are covered. RFC 2965 handling is +switched off by default. + +The easiest way to provide your own policy is to override this class and +call its methods in your overridden implementations before adding your +own additional checks: + + 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 + +In addition to the features required to implement the *note +CookiePolicy: 3bb1. interface, this class allows you to block and allow +domains from setting and receiving cookies. There are also some +strictness switches that allow you to tighten up the rather loose +Netscape protocol rules a little bit (at the cost of blocking some +benign cookies). + +A domain blocklist and allowlist is provided (both off by default). +Only domains not in the blocklist and present in the allowlist (if the +allowlist is active) participate in cookie setting and returning. Use +the 'blocked_domains' constructor argument, and ‘blocked_domains()’ and +‘set_blocked_domains()’ methods (and the corresponding argument and +methods for 'allowed_domains'). If you set an allowlist, you can turn +it off again by setting it to *note None: 671. + +Domains in block or allow lists that do not start with a dot must equal +the cookie domain to be matched. For example, ‘"example.com"’ matches a +blocklist entry of ‘"example.com"’, but ‘"www.example.com"’ does not. +Domains that do start with a dot are matched by more specific domains +too. For example, both ‘"www.example.com"’ and +‘"www.coyote.example.com"’ match ‘".example.com"’ (but ‘"example.com"’ +itself does not). IP addresses are an exception, and must match +exactly. For example, if blocked_domains contains ‘"192.168.1.2"’ and +‘".168.1.2"’, 192.168.1.2 is blocked, but 193.168.1.2 is not. + +*note DefaultCookiePolicy: 1a10. implements the following additional +methods: + + -- Method: DefaultCookiePolicy.blocked_domains () + + Return the sequence of blocked domains (as a tuple). + + -- Method: DefaultCookiePolicy.set_blocked_domains (blocked_domains) + + Set the sequence of blocked domains. + + -- Method: DefaultCookiePolicy.is_blocked (domain) + + Return ‘True’ if 'domain' is on the blocklist for setting or + receiving cookies. + + -- Method: DefaultCookiePolicy.allowed_domains () + + Return *note None: 671, or the sequence of allowed domains (as a + tuple). + + -- Method: DefaultCookiePolicy.set_allowed_domains (allowed_domains) + + Set the sequence of allowed domains, or *note None: 671. + + -- Method: DefaultCookiePolicy.is_not_allowed (domain) + + Return ‘True’ if 'domain' is not on the allowlist for setting or + receiving cookies. + +*note DefaultCookiePolicy: 1a10. instances have the following +attributes, which are all initialised from the constructor arguments of +the same name, and which may all be assigned to. + + -- Attribute: DefaultCookiePolicy.rfc2109_as_netscape + + If true, request that the *note CookieJar: 39da. instance downgrade + RFC 2109(2) cookies (ie. cookies received in a ‘Set-Cookie’ header + with a version cookie-attribute of 1) to Netscape cookies by + setting the version attribute of the *note Cookie: 3bb6. instance + to 0. The default value is *note None: 671, in which case RFC 2109 + cookies are downgraded if and only if RFC 2965(3) handling is + turned off. Therefore, RFC 2109 cookies are downgraded by default. + +General strictness switches: + + -- Attribute: DefaultCookiePolicy.strict_domain + + Don’t allow sites to set two-component domains with country-code + top-level domains like ‘.co.uk’, ‘.gov.uk’, ‘.co.nz’.etc. This is + far from perfect and isn’t guaranteed to work! + +RFC 2965(4) protocol strictness switches: + + -- Attribute: DefaultCookiePolicy.strict_rfc2965_unverifiable + + Follow RFC 2965(5) rules on unverifiable transactions (usually, an + unverifiable transaction is one resulting from a redirect or a + request for an image hosted on another site). If this is false, + cookies are 'never' blocked on the basis of verifiability + +Netscape protocol strictness switches: + + -- Attribute: DefaultCookiePolicy.strict_ns_unverifiable + + Apply RFC 2965(6) rules on unverifiable transactions even to + Netscape cookies. + + -- Attribute: DefaultCookiePolicy.strict_ns_domain + + Flags indicating how strict to be with domain-matching rules for + Netscape cookies. See below for acceptable values. + + -- Attribute: DefaultCookiePolicy.strict_ns_set_initial_dollar + + Ignore cookies in Set-Cookie: headers that have names starting with + ‘'$'’. + + -- Attribute: DefaultCookiePolicy.strict_ns_set_path + + Don’t allow setting cookies whose path doesn’t path-match request + URI. + +*note strict_ns_domain: 3bdb. is a collection of flags. Its value is +constructed by or-ing together (for example, +‘DomainStrictNoDots|DomainStrictNonDomain’ means both flags are set). + + -- Attribute: DefaultCookiePolicy.DomainStrictNoDots + + When setting cookies, the ‘host prefix’ must not contain a dot (eg. + ‘www.foo.bar.com’ can’t set a cookie for ‘.bar.com’, because + ‘www.foo’ contains a dot). + + -- Attribute: DefaultCookiePolicy.DomainStrictNonDomain + + Cookies that did not explicitly specify a ‘domain’ cookie-attribute + can only be returned to a domain equal to the domain that set the + cookie (eg. ‘spam.example.com’ won’t be returned cookies from + ‘example.com’ that had no ‘domain’ cookie-attribute). + + -- Attribute: DefaultCookiePolicy.DomainRFC2965Match + + When setting cookies, require a full RFC 2965(7) domain-match. + +The following attributes are provided for convenience, and are the most +useful combinations of the above flags: + + -- Attribute: DefaultCookiePolicy.DomainLiberal + + Equivalent to 0 (ie. all of the above Netscape domain strictness + flags switched off). + + -- Attribute: DefaultCookiePolicy.DomainStrict + + Equivalent to ‘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 Objects<2>, Next: Examples<29>, Prev: DefaultCookiePolicy Objects, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.5 Cookie Objects +........................ + +*note Cookie: 3bb6. 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 +*note http.cookiejar: 70. from version 1 to version 0 (Netscape) +cookies. + +Assignment to these attributes should not be necessary other than in +rare circumstances in a *note CookiePolicy: 3bb1. method. The class +does not enforce internal consistency, so you should know what you’re +doing if you do that. + + -- Attribute: Cookie.version + + Integer or *note None: 671. Netscape cookies have *note version: + 3be4. 0. RFC 2965(2) and RFC 2109(3) cookies have a ‘version’ + cookie-attribute of 1. However, note that *note http.cookiejar: + 70. may ‘downgrade’ RFC 2109 cookies to Netscape cookies, in which + case *note version: 3be4. is 0. + + -- Attribute: Cookie.name + + Cookie name (a string). + + -- Attribute: Cookie.value + + Cookie value (a string), or *note None: 671. + + -- Attribute: Cookie.port + + String representing a port or a set of ports (eg. ‘80’, or + ‘80,8080’), or *note None: 671. + + -- Attribute: Cookie.domain + + Cookie domain (a string). + + -- Attribute: Cookie.path + + Cookie path (a string, eg. ‘'/acme/rocket_launchers'’). + + -- Attribute: Cookie.secure + + ‘True’ if cookie should only be returned over a secure connection. + + -- Attribute: Cookie.expires + + Integer expiry date in seconds since epoch, or *note None: 671. + See also the *note is_expired(): 3bec. method. + + -- Attribute: Cookie.discard + + ‘True’ if this is a session cookie. + + -- Attribute: Cookie.comment + + String comment from the server explaining the function of this + cookie, or *note None: 671. + + -- Attribute: Cookie.comment_url + + URL linking to a comment from the server explaining the function of + this cookie, or *note None: 671. + + -- Attribute: 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 *note http.cookiejar: 70. may ‘downgrade’ RFC 2109 + cookies to Netscape cookies, in which case *note version: 3be4. is + 0. + + -- Attribute: Cookie.port_specified + + ‘True’ if a port or set of ports was explicitly specified by the + server (in the ‘Set-Cookie’ / ‘Set-Cookie2’ header). + + -- Attribute: Cookie.domain_specified + + ‘True’ if a domain was explicitly specified by the server. + + -- Attribute: Cookie.domain_initial_dot + + ‘True’ if the domain explicitly specified by the server began with + a dot (‘'.'’). + +Cookies may have additional non-standard cookie-attributes. These may +be accessed using the following methods: + + -- Method: Cookie.has_nonstandard_attr (name) + + Return ‘True’ if cookie has the named cookie-attribute. + + -- Method: Cookie.get_nonstandard_attr (name, default=None) + + If cookie has the named cookie-attribute, return its value. + Otherwise, return 'default'. + + -- Method: Cookie.set_nonstandard_attr (name, value) + + Set the value of the named cookie-attribute. + +The *note Cookie: 3bb6. class also defines the following method: + + -- Method: Cookie.is_expired (now=None) + + ‘True’ if cookie has passed the time at which the server requested + it should expire. If 'now' is given (in seconds since the epoch), + return whether the cookie has expired at the specified time. + + ---------- 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: Examples<29>, Prev: Cookie Objects<2>, Up: http cookiejar — Cookie handling for HTTP clients + +5.22.19.6 Examples +.................. + +The first example shows the most common usage of *note http.cookiejar: +70.: + + import http.cookiejar, urllib.request + cj = http.cookiejar.CookieJar() + opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) + r = opener.open("http://example.com/") + +This example illustrates how to open a URL using your Netscape, Mozilla, +or Lynx cookies (assumes Unix/Netscape convention for location of the +cookies file): + + 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/") + +The next example illustrates the use of *note DefaultCookiePolicy: 1a10. +Turn on RFC 2965(1) cookies, be more strict about domains when setting +and returning Netscape cookies, and block some domains from setting +cookies or having them returned: + + 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 server and client modules, Next: xmlrpc client — XML-RPC client access, Prev: http cookiejar — Cookie handling for HTTP clients, Up: Internet Protocols and Support + +5.22.20 ‘xmlrpc’ — XMLRPC server and client modules +--------------------------------------------------- + +XML-RPC is a Remote Procedure Call method that uses XML passed via HTTP +as a transport. With it, a client can call methods with parameters on a +remote server (the server is named by a URI) and get back structured +data. + +‘xmlrpc’ is a package that collects server and client modules +implementing XML-RPC. The modules are: + + * *note xmlrpc.client: 12e. + + * *note xmlrpc.server: 12f. + + +File: python.info, Node: xmlrpc client — XML-RPC client access, Next: xmlrpc server — Basic XML-RPC servers, Prev: xmlrpc — XMLRPC server and client modules, Up: Internet Protocols and Support + +5.22.21 ‘xmlrpc.client’ — XML-RPC client access +----------------------------------------------- + +'Source code:' Lib/xmlrpc/client.py(1) + +__________________________________________________________________ + +XML-RPC is a Remote Procedure Call method that uses XML passed via +HTTP(S) as a transport. With it, a client can call methods with +parameters on a remote server (the server is named by a URI) and get +back structured data. This module supports writing XML-RPC client code; +it handles all the details of translating between conformable Python +objects and XML on the wire. + + Warning: The *note xmlrpc.client: 12e. module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data, see *note XML security: 3774. + +Changed in version 3.5: For HTTPS URIs, *note xmlrpc.client: 12e. now +performs all the necessary certificate and hostname checks by default. + +*note Availability: 1d54.: not WASI. + +This module does not work or is not available on WebAssembly. See *note +WebAssembly platforms: 17e0. for more information. + + -- Class: xmlrpc.client.ServerProxy (uri, transport=None, + encoding=None, verbose=False, allow_none=False, + use_datetime=False, use_builtin_types=False, *, headers=(), + context=None) + + A *note ServerProxy: a56. instance is an object that manages + communication with a remote XML-RPC server. The required first + argument is a URI (Uniform Resource Indicator), and will normally + be the URL of the server. The optional second argument is a + transport factory instance; by default it is an internal + ‘SafeTransport’ instance for https: URLs and an internal HTTP + ‘Transport’ instance otherwise. The optional third argument is an + encoding, by default UTF-8. The optional fourth argument is a + debugging flag. + + 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: 534. 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: 1cc. + objects and binary data to be presented as *note bytes: 1c2. + objects; this flag is false by default. *note datetime.datetime: + 1cc, *note bytes: 1c2. and *note bytearray: 53a. 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: 296. 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. + + Changed in version 3.3: The 'use_builtin_types' flag was added. + + Changed in version 3.8: The 'headers' parameter was added. + + Both the HTTP and HTTPS transports support the URL syntax extension + for HTTP Basic Authentication: ‘http://user:pass@host:port/path’. + The ‘user:pass’ portion will be base64-encoded as an HTTP + ‘Authorization’ header, and sent to the remote server as part of + the connection process when invoking an XML-RPC method. You only + need to use this if the remote server requires a Basic + Authentication user and password. + + The returned instance is a proxy object with methods that can be + used to invoke corresponding RPC calls on the remote server. If + the remote server supports the introspection API, the proxy can + also be used to query the remote server for the methods it supports + (service discovery) and fetch other server-associated metadata. + + Types that are conformable (e.g. that can be marshalled through + XML), include the following (and except where noted, they are + unmarshalled as the same Python type): + + XML-RPC type Python type + + --------------------------------------------------------------------------------------- + + ‘boolean’ *note bool: 463. + + + ‘int’, ‘i1’, ‘i2’, ‘i4’, *note int: 259. in range from -2147483648 to 2147483647. + ‘i8’ or ‘biginteger’ Values get the ‘’ tag. + + + ‘double’ or ‘float’ *note float: 2f1. Values get the ‘’ tag. + + + ‘string’ *note str: 447. + + + ‘array’ *note list: 60d. or *note tuple: 36b. containing + conformable elements. Arrays are returned as + *note lists: 60d. + + + ‘struct’ *note dict: 258. Keys must be strings, values may be any + conformable type. Objects of user-defined classes can be + passed in; only their *note __dict__: 558. attribute is + transmitted. + + + ‘dateTime.iso8601’ *note DateTime: 13af. or *note datetime.datetime: 1cc. + Returned type depends on values of 'use_builtin_types' + and 'use_datetime' flags. + + + ‘base64’ *note Binary: 3bfc, *note bytes: 1c2. or + *note bytearray: 53a. Returned type depends on the value + of the 'use_builtin_types' flag. + + + ‘nil’ The ‘None’ constant. Passing is allowed only if + 'allow_none' is true. + + + ‘bigdecimal’ *note decimal.Decimal: 29f. Returned type only. + + + This is the full set of data types supported by XML-RPC. Method + calls may also raise a special *note Fault: 3bfd. instance, used to + signal XML-RPC server errors, or *note ProtocolError: 3bfe. used to + signal an error in the HTTP/HTTPS transport layer. Both *note + Fault: 3bfd. and *note ProtocolError: 3bfe. derive from a base + class called ‘Error’. Note that the xmlrpc client module currently + does not marshal instances of subclasses of built-in types. + + When passing strings, characters special to XML such as ‘<’, ‘>’, + and ‘&’ will be automatically escaped. However, it’s the caller’s + responsibility to ensure that the string is free of characters that + aren’t allowed in XML, such as the control characters with ASCII + values between 0 and 31 (except, of course, tab, newline and + carriage return); failing to do this will result in an XML-RPC + request that isn’t well-formed XML. If you have to pass arbitrary + bytes via XML-RPC, use *note bytes: 1c2. or *note bytearray: 53a. + classes or the *note Binary: 3bfc. wrapper class described below. + + ‘Server’ is retained as an alias for *note ServerProxy: a56. for + backwards compatibility. New code should use *note ServerProxy: + a56. + + Changed in version 3.5: Added the 'context' argument. + + Changed in version 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. + +See also +........ + +XML-RPC HOWTO(3) + + A good description of XML-RPC operation and client software in + several languages. Contains pretty much everything an XML-RPC + client developer needs to know. + +XML-RPC Introspection(4) + + Describes the XML-RPC protocol extension for introspection. + +XML-RPC Specification(5) + + The official specification. + +* Menu: + +* ServerProxy Objects:: +* DateTime Objects:: +* Binary Objects:: +* Fault Objects:: +* ProtocolError Objects:: +* MultiCall Objects:: +* Convenience Functions:: +* Example of Client Usage:: +* Example of Client and Server Usage:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 Objects, Next: DateTime Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.1 ServerProxy Objects +............................. + +A *note ServerProxy: a56. instance has a method corresponding to each +remote procedure call accepted by the XML-RPC server. Calling the +method performs an RPC, dispatched by both name and argument signature +(e.g. the same method name can be overloaded with multiple argument +signatures). The RPC finishes by returning a value, which may be either +returned data in a conformant type or a *note Fault: 3bfd. or *note +ProtocolError: 3bfe. object indicating an error. + +Servers that support the XML introspection API support some common +methods grouped under the reserved ‘system’ attribute: + + -- Method: ServerProxy.system.listMethods () + + This method returns a list of strings, one for each (non-system) + method supported by the XML-RPC server. + + -- Method: ServerProxy.system.methodSignature (name) + + This method takes one parameter, the name of a method implemented + by the XML-RPC server. It returns an array of possible signatures + for this method. A signature is an array of types. The first of + these types is the return type of the method, the rest are + parameters. + + Because multiple signatures (ie. overloading) is permitted, this + method returns a list of signatures rather than a singleton. + + Signatures themselves are restricted to the top level parameters + expected by a method. For instance if a method expects one array + of structs as a parameter, and it returns a string, its signature + is simply “string, array”. If it expects three integers and + returns a string, its signature is “string, int, int, int”. + + If no signature is defined for the method, a non-array value is + returned. In Python this means that the type of the returned value + will be something other than list. + + -- Method: ServerProxy.system.methodHelp (name) + + This method takes one parameter, the name of a method implemented + by the XML-RPC server. It returns a documentation string + describing the use of that method. If no such string is available, + an empty string is returned. The documentation string may contain + HTML markup. + +Changed in version 3.5: Instances of *note ServerProxy: a56. support the +*note context manager: 5d0. protocol for closing the underlying +transport. + +A working example follows. The server code: + + 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() + +The client code for the preceding server: + + 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 Objects, Next: Binary Objects, Prev: ServerProxy Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.2 DateTime Objects +.......................... + + -- Class: xmlrpc.client.DateTime + + This class may be initialized with seconds since the epoch, a time + tuple, an ISO 8601 time/date string, or a *note datetime.datetime: + 1cc. instance. It has the following methods, supported mainly for + internal use by the marshalling/unmarshalling code: + + -- Method: decode (string) + + Accept a string as the instance’s new time value. + + -- Method: encode (out) + + Write the XML-RPC encoding of this *note DateTime: 13af. item + to the 'out' stream object. + + It also supports certain of Python’s built-in operators through + *note rich comparison: 1292. and *note __repr__(): 618. methods. + +A working example follows. The server code: + + import datetime + from xmlrpc.server import SimpleXMLRPCServer + import xmlrpc.client + + def today(): + today = datetime.datetime.today() + return xmlrpc.client.DateTime(today) + + server = SimpleXMLRPCServer(("localhost", 8000)) + print("Listening on port 8000...") + server.register_function(today, "today") + server.serve_forever() + +The client code for the preceding server: + + import xmlrpc.client + import datetime + + proxy = xmlrpc.client.ServerProxy("http://localhost:8000/") + + today = proxy.today() + # convert the ISO8601 string to a datetime object + converted = datetime.datetime.strptime(today.value, "%Y%m%dT%H:%M:%S") + print("Today: %s" % converted.strftime("%d.%m.%Y, %H:%M")) + + +File: python.info, Node: Binary Objects, Next: Fault Objects, Prev: DateTime Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.3 Binary Objects +........................ + + -- Class: xmlrpc.client.Binary + + This class may be initialized from bytes data (which may include + NULs). The primary access to the content of a *note Binary: 3bfc. + object is provided by an attribute: + + -- Attribute: data + + The binary data encapsulated by the *note Binary: 3bfc. + instance. The data is provided as a *note bytes: 1c2. object. + + *note Binary: 3bfc. objects have the following methods, supported + mainly for internal use by the marshalling/unmarshalling code: + + -- Method: decode (bytes) + + Accept a base64 *note bytes: 1c2. object and decode it as the + instance’s new data. + + -- Method: encode (out) + + Write the XML-RPC base 64 encoding of this binary item to the + 'out' stream object. + + The encoded data will have newlines every 76 characters as per + RFC 2045 section 6.8(1), which was the de facto standard + base64 specification when the XML-RPC spec was written. + + It also supports certain of Python’s built-in operators through + *note __eq__(): afa. and *note __ne__(): 14e2. methods. + +Example usage of the binary objects. We’re going to transfer an image +over XMLRPC: + + 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() + +The client gets the image and saves it to a file: + + 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 Objects, Next: ProtocolError Objects, Prev: Binary Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.4 Fault Objects +....................... + + -- Class: xmlrpc.client.Fault + + A *note Fault: 3bfd. object encapsulates the content of an XML-RPC + fault tag. Fault objects have the following attributes: + + -- Attribute: faultCode + + An int indicating the fault type. + + -- Attribute: faultString + + A string containing a diagnostic message associated with the + fault. + +In the following example we’re going to intentionally cause a *note +Fault: 3bfd. by returning a complex type object. The server code: + + 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() + +The client code for the preceding server: + + 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 Objects, Next: MultiCall Objects, Prev: Fault Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.5 ProtocolError Objects +............................... + + -- Class: xmlrpc.client.ProtocolError + + A *note ProtocolError: 3bfe. object describes a protocol error in + the underlying transport layer (such as a 404 ‘not found’ error if + the server named by the URI does not exist). It has the following + attributes: + + -- Attribute: url + + The URI or URL that triggered the error. + + -- Attribute: errcode + + The error code. + + -- Attribute: errmsg + + The error message or diagnostic string. + + -- Attribute: headers + + A dict containing the headers of the HTTP/HTTPS request that + triggered the error. + +In the following example we’re going to intentionally cause a *note +ProtocolError: 3bfe. by providing an invalid URI: + + 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 Objects, Next: Convenience Functions, Prev: ProtocolError Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.6 MultiCall Objects +........................... + +The *note MultiCall: 3c18. object provides a way to encapsulate multiple +calls to a remote server into a single request (1). + + -- Class: xmlrpc.client.MultiCall (server) + + Create an object used to boxcar method calls. 'server' is the + eventual target of the call. Calls can be made to the result + object, but they will immediately return ‘None’, and only store the + call name and parameters in the *note MultiCall: 3c18. 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: 105a.; iterating over this generator yields the + individual results. + +A usage example of this class follows. The server code: + + 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() + +The client code for the preceding server: + + 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) This approach has been first presented in a discussion on +xmlrpc.com +(https://web.archive.org/web/20060624230303/http://www.xmlrpc.com/discuss/msgReader$1208?mode=topic). + + +File: python.info, Node: Convenience Functions, Next: Example of Client Usage, Prev: MultiCall Objects, Up: xmlrpc client — XML-RPC client access + +5.22.21.7 Convenience Functions +............................... + + -- Function: 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: 3bfd. 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: 671. value cannot be used in + standard XML-RPC; to allow using it via an extension, provide a + true value for 'allow_none'. + + -- Function: xmlrpc.client.loads (data, use_datetime=False, + use_builtin_types=False) + + Convert an XML-RPC request or response into Python objects, a + ‘(params, methodname)’. 'params' is a tuple of argument; + 'methodname' is a string, or ‘None’ if no method name is present in + the packet. If the XML-RPC packet represents a fault condition, + this function will raise a *note Fault: 3bfd. exception. The + 'use_builtin_types' flag can be used to cause date/time values to + be presented as *note datetime.datetime: 1cc. objects and binary + data to be presented as *note bytes: 1c2. objects; this flag is + false by default. + + The obsolete 'use_datetime' flag is similar to 'use_builtin_types' + but it applies only to date/time values. + + Changed in version 3.3: The 'use_builtin_types' flag was added. + + +File: python.info, Node: Example of Client Usage, Next: Example of Client and Server Usage, Prev: Convenience Functions, Up: xmlrpc client — XML-RPC client access + +5.22.21.8 Example of Client Usage +................................. + + # 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) + +To access an XML-RPC server through a HTTP proxy, you need to define a +custom transport. The following example shows how: + + 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: Example of Client and Server Usage, Prev: Example of Client Usage, Up: xmlrpc client — XML-RPC client access + +5.22.21.9 Example of Client and Server Usage +............................................ + +See *note SimpleXMLRPCServer Example: 3c1e. + + +File: python.info, Node: xmlrpc server — Basic XML-RPC servers, Next: ipaddress — IPv4/IPv6 manipulation library, Prev: xmlrpc client — XML-RPC client access, Up: Internet Protocols and Support + +5.22.22 ‘xmlrpc.server’ — Basic XML-RPC servers +----------------------------------------------- + +'Source code:' Lib/xmlrpc/server.py(1) + +__________________________________________________________________ + +The *note xmlrpc.server: 12f. module provides a basic server framework +for XML-RPC servers written in Python. Servers can either be free +standing, using *note SimpleXMLRPCServer: 3c21, or embedded in a CGI +environment, using *note CGIXMLRPCRequestHandler: 3c22. + + Warning: The *note xmlrpc.server: 12f. module is not secure against + maliciously constructed data. If you need to parse untrusted or + unauthenticated data, see *note XML security: 3774. + +*note Availability: 1d54.: not WASI. + +This module does not work or is not available on WebAssembly. See *note +WebAssembly platforms: 17e0. for more information. + + -- Class: xmlrpc.server.SimpleXMLRPCServer (addr, + requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, + allow_none=False, encoding=None, bind_and_activate=True, + use_builtin_types=False) + + Create a new server instance. This class provides methods for + registration of functions that can be called by the XML-RPC + protocol. The 'requestHandler' parameter should be a factory for + request handler instances; it defaults to *note + SimpleXMLRPCRequestHandler: 131a. The 'addr' and 'requestHandler' + parameters are passed to the *note socketserver.TCPServer: 1312. + constructor. If 'logRequests' is true (the default), requests will + be logged; setting this parameter to false will turn off logging. + The 'allow_none' and 'encoding' parameters are passed on to *note + xmlrpc.client: 12e. and control the XML-RPC responses that will be + returned from the server. The 'bind_and_activate' parameter + controls whether ‘server_bind()’ and ‘server_activate()’ are called + immediately by the constructor; it defaults to true. Setting it to + false allows code to manipulate the 'allow_reuse_address' class + variable before the address is bound. The 'use_builtin_types' + parameter is passed to the *note loads(): 1400. function and + controls which types are processed when date/times values or binary + data are received; it defaults to false. + + Changed in version 3.3: The 'use_builtin_types' flag was added. + + -- Class: xmlrpc.server.CGIXMLRPCRequestHandler (allow_none=False, + encoding=None, use_builtin_types=False) + + Create a new instance to handle XML-RPC requests in a CGI + environment. The 'allow_none' and 'encoding' parameters are passed + on to *note xmlrpc.client: 12e. and control the XML-RPC responses + that will be returned from the server. The 'use_builtin_types' + parameter is passed to the *note loads(): 1400. function and + controls which types are processed when date/times values or binary + data are received; it defaults to false. + + Changed in version 3.3: The 'use_builtin_types' flag was added. + + -- Class: xmlrpc.server.SimpleXMLRPCRequestHandler + + Create a new request handler instance. This request handler + supports ‘POST’ requests and modifies logging so that the + 'logRequests' parameter to the *note SimpleXMLRPCServer: 3c21. + constructor parameter is honored. + +* Menu: + +* SimpleXMLRPCServer Objects:: +* CGIXMLRPCRequestHandler:: +* Documenting XMLRPC server:: +* DocXMLRPCServer Objects:: +* DocCGIXMLRPCRequestHandler:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/xmlrpc/server.py + + +File: python.info, Node: SimpleXMLRPCServer Objects, Next: CGIXMLRPCRequestHandler, Up: xmlrpc server — Basic XML-RPC servers + +5.22.22.1 SimpleXMLRPCServer Objects +.................................... + +The *note SimpleXMLRPCServer: 3c21. class is based on *note +socketserver.TCPServer: 1312. and provides a means of creating simple, +stand alone XML-RPC servers. + + -- Method: SimpleXMLRPCServer.register_function (function=None, + name=None) + + Register a function that can respond to XML-RPC requests. If + 'name' is given, it will be the method name associated with + 'function', otherwise *note function.__name__: 12c7. will be used. + 'name' is a string, and may contain characters not legal in Python + identifiers, including the period character. + + This method can also be used as a decorator. When used as a + decorator, 'name' can only be given as a keyword argument to + register 'function' under 'name'. If no 'name' is given, *note + function.__name__: 12c7. will be used. + + Changed in version 3.7: *note register_function(): 3c25. can be + used as a decorator. + + -- Method: SimpleXMLRPCServer.register_instance (instance, + allow_dotted_names=False) + + Register an object which is used to expose method names which have + not been registered using *note register_function(): 3c25. If + 'instance' contains a ‘_dispatch()’ method, it is called with the + requested method name and the parameters from the request. Its API + is ‘def _dispatch(self, method, params)’ (note that 'params' does + not represent a variable argument list). If it calls an underlying + function to perform its task, that function is called as + ‘func(*params)’, expanding the parameter list. The return value + from ‘_dispatch()’ is returned to the client as the result. If + 'instance' does not have a ‘_dispatch()’ method, it is searched for + an attribute matching the name of the requested method. + + If the optional 'allow_dotted_names' argument is true and the + instance does not have a ‘_dispatch()’ method, then if the + requested method name contains periods, each component of the + method name is searched for individually, with the effect that a + simple hierarchical search is performed. The value found from this + search is then called with the parameters from the request, and the + return value is passed back to the client. + + Warning: 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 option on a secure, closed network. + + -- Method: SimpleXMLRPCServer.register_introspection_functions () + + Registers the XML-RPC introspection functions ‘system.listMethods’, + ‘system.methodHelp’ and ‘system.methodSignature’. + + -- Method: SimpleXMLRPCServer.register_multicall_functions () + + Registers the XML-RPC multicall function system.multicall. + + -- Attribute: SimpleXMLRPCRequestHandler.rpc_paths + + An attribute value that must be a tuple listing valid path portions + of the URL for receiving XML-RPC requests. Requests posted to + other paths will result in a 404 “no such page” HTTP error. If + this tuple is empty, all paths will be considered valid. The + default value is ‘('/', '/RPC2')’. + +* Menu: + +* SimpleXMLRPCServer Example:: + + +File: python.info, Node: SimpleXMLRPCServer Example, Up: SimpleXMLRPCServer Objects + +5.22.22.2 SimpleXMLRPCServer Example +.................................... + +Server code: + + 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() + +The following client code will call the methods made available by the +preceding server: + + 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()’ can also be used as a decorator. The previous +server example can register functions in a decorator way: + + 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() + +The following example included in the ‘Lib/xmlrpc/server.py’ module +shows a server allowing dotted names and registering a multicall +function. + + Warning: 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 only + within a secure, closed network. + + import datetime + + class ExampleService: + def getData(self): + return '42' + + class currentTime: + @staticmethod + def getCurrentTime(): + return datetime.datetime.now() + + with SimpleXMLRPCServer(("localhost", 8000)) as server: + server.register_function(pow) + server.register_function(lambda x,y: x+y, 'add') + server.register_instance(ExampleService(), allow_dotted_names=True) + server.register_multicall_functions() + print('Serving XML-RPC on localhost port 8000') + try: + server.serve_forever() + except KeyboardInterrupt: + print("\nKeyboard interrupt received, exiting.") + sys.exit(0) + +This ExampleService demo can be invoked from the command line: + + python -m xmlrpc.server + +The client that interacts with the above server is included in +‘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) + +This client which interacts with the demo XMLRPC server can be invoked +as: + + python -m xmlrpc.client + + +File: python.info, Node: CGIXMLRPCRequestHandler, Next: Documenting XMLRPC server, Prev: SimpleXMLRPCServer Objects, Up: xmlrpc server — Basic XML-RPC servers + +5.22.22.3 CGIXMLRPCRequestHandler +................................. + +The *note CGIXMLRPCRequestHandler: 3c22. class can be used to handle +XML-RPC requests sent to Python CGI scripts. + + -- Method: CGIXMLRPCRequestHandler.register_function (function=None, + name=None) + + Register a function that can respond to XML-RPC requests. If + 'name' is given, it will be the method name associated with + 'function', otherwise *note function.__name__: 12c7. will be used. + 'name' is a string, and may contain characters not legal in Python + identifiers, including the period character. + + This method can also be used as a decorator. When used as a + decorator, 'name' can only be given as a keyword argument to + register 'function' under 'name'. If no 'name' is given, *note + function.__name__: 12c7. will be used. + + Changed in version 3.7: *note register_function(): 3c2c. can be + used as a decorator. + + -- Method: CGIXMLRPCRequestHandler.register_instance (instance) + + Register an object which is used to expose method names which have + not been registered using *note register_function(): 3c2c. If + instance contains a ‘_dispatch()’ method, it is called with the + requested method name and the parameters from the request; the + return value is returned to the client as the result. If instance + does not have a ‘_dispatch()’ method, it is searched for an + attribute matching the name of the requested method; if the + requested method name contains periods, each component of the + method name is searched for individually, with the effect that a + simple hierarchical search is performed. The value found from this + search is then called with the parameters from the request, and the + return value is passed back to the client. + + -- Method: CGIXMLRPCRequestHandler.register_introspection_functions () + + Register the XML-RPC introspection functions ‘system.listMethods’, + ‘system.methodHelp’ and ‘system.methodSignature’. + + -- Method: CGIXMLRPCRequestHandler.register_multicall_functions () + + Register the XML-RPC multicall function ‘system.multicall’. + + -- Method: CGIXMLRPCRequestHandler.handle_request (request_text=None) + + Handle an XML-RPC request. If 'request_text' is given, it should + be the POST data provided by the HTTP server, otherwise the + contents of stdin will be used. + +Example: + + 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: Documenting XMLRPC server, Next: DocXMLRPCServer Objects, Prev: CGIXMLRPCRequestHandler, Up: xmlrpc server — Basic XML-RPC servers + +5.22.22.4 Documenting XMLRPC server +................................... + +These classes extend the above classes to serve HTML documentation in +response to HTTP GET requests. Servers can either be free standing, +using *note DocXMLRPCServer: 19bd, or embedded in a CGI environment, +using *note DocCGIXMLRPCRequestHandler: 3c32. + + -- Class: xmlrpc.server.DocXMLRPCServer (addr, + requestHandler=DocXMLRPCRequestHandler, logRequests=True, + allow_none=False, encoding=None, bind_and_activate=True, + use_builtin_types=True) + + Create a new server instance. All parameters have the same meaning + as for *note SimpleXMLRPCServer: 3c21.; 'requestHandler' defaults + to *note DocXMLRPCRequestHandler: 3c33. + + Changed in version 3.3: The 'use_builtin_types' flag was added. + + -- Class: xmlrpc.server.DocCGIXMLRPCRequestHandler + + Create a new instance to handle XML-RPC requests in a CGI + environment. + + -- Class: xmlrpc.server.DocXMLRPCRequestHandler + + Create a new request handler instance. This request handler + supports XML-RPC POST requests, documentation GET requests, and + modifies logging so that the 'logRequests' parameter to the *note + DocXMLRPCServer: 19bd. constructor parameter is honored. + + +File: python.info, Node: DocXMLRPCServer Objects, Next: DocCGIXMLRPCRequestHandler, Prev: Documenting XMLRPC server, Up: xmlrpc server — Basic XML-RPC servers + +5.22.22.5 DocXMLRPCServer Objects +................................. + +The *note DocXMLRPCServer: 19bd. class is derived from *note +SimpleXMLRPCServer: 3c21. and provides a means of creating +self-documenting, stand alone XML-RPC servers. HTTP POST requests are +handled as XML-RPC method calls. HTTP GET requests are handled by +generating pydoc-style HTML documentation. This allows a server to +provide its own web-based documentation. + + -- Method: DocXMLRPCServer.set_server_title (server_title) + + Set the title used in the generated HTML documentation. This title + will be used inside the HTML “title” element. + + -- Method: DocXMLRPCServer.set_server_name (server_name) + + Set the name used in the generated HTML documentation. This name + will appear at the top of the generated documentation inside a “h1” + element. + + -- Method: DocXMLRPCServer.set_server_documentation + (server_documentation) + + Set the description used in the generated HTML documentation. This + description will appear as a paragraph, below the server name, in + the documentation. + + +File: python.info, Node: DocCGIXMLRPCRequestHandler, Prev: DocXMLRPCServer Objects, Up: xmlrpc server — Basic XML-RPC servers + +5.22.22.6 DocCGIXMLRPCRequestHandler +.................................... + +The *note DocCGIXMLRPCRequestHandler: 3c32. class is derived from *note +CGIXMLRPCRequestHandler: 3c22. and provides a means of creating +self-documenting, XML-RPC CGI scripts. HTTP POST requests are handled +as XML-RPC method calls. HTTP GET requests are handled by generating +pydoc-style HTML documentation. This allows a server to provide its own +web-based documentation. + + -- Method: DocCGIXMLRPCRequestHandler.set_server_title (server_title) + + Set the title used in the generated HTML documentation. This title + will be used inside the HTML “title” element. + + -- Method: DocCGIXMLRPCRequestHandler.set_server_name (server_name) + + Set the name used in the generated HTML documentation. This name + will appear at the top of the generated documentation inside a “h1” + element. + + -- Method: DocCGIXMLRPCRequestHandler.set_server_documentation + (server_documentation) + + Set the description used in the generated HTML documentation. This + description will appear as a paragraph, below the server name, in + the documentation. + + +File: python.info, Node: ipaddress — IPv4/IPv6 manipulation library, Prev: xmlrpc server — Basic XML-RPC servers, Up: Internet Protocols and Support + +5.22.23 ‘ipaddress’ — IPv4/IPv6 manipulation library +---------------------------------------------------- + +'Source code:' Lib/ipaddress.py(1) + +__________________________________________________________________ + +*note ipaddress: 80. provides the capabilities to create, manipulate and +operate on IPv4 and IPv6 addresses and networks. + +The functions and classes in this module make it straightforward to +handle various tasks related to IP addresses, including checking whether +or not two hosts are on the same subnet, iterating over all hosts in a +particular subnet, checking whether or not a string represents a valid +IP address or network definition, and so on. + +This is the full module API reference—for an overview and introduction, +see *note An introduction to the ipaddress module: 3c3f. + +Added in version 3.3. + +* Menu: + +* Convenience factory functions:: +* IP Addresses:: +* IP Network definitions:: +* Interface objects:: +* Other Module Level Functions:: +* Custom Exceptions:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/ipaddress.py + + +File: python.info, Node: Convenience factory functions, Next: IP Addresses, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.1 Convenience factory functions +....................................... + +The *note ipaddress: 80. module provides factory functions to +conveniently create IP addresses, networks and interfaces: + + -- Function: ipaddress.ip_address (address) + + Return an *note IPv4Address: 1fe. or *note IPv6Address: 1ff. object + depending on the IP address passed as argument. Either IPv4 or + IPv6 addresses may be supplied; integers less than ‘2**32’ will be + considered to be IPv4 by default. A *note ValueError: 204. is + raised if 'address' does not represent a valid IPv4 or IPv6 + address. + + >>> ipaddress.ip_address('192.168.0.1') + IPv4Address('192.168.0.1') + >>> ipaddress.ip_address('2001:db8::') + IPv6Address('2001:db8::') + + -- Function: ipaddress.ip_network (address, strict=True) + + Return an *note IPv4Network: 200. or *note IPv6Network: 201. object + depending on the IP address passed as argument. 'address' is a + string or integer representing the IP network. Either IPv4 or IPv6 + networks may be supplied; integers less than ‘2**32’ will be + considered to be IPv4 by default. 'strict' is passed to *note + IPv4Network: 200. or *note IPv6Network: 201. constructor. A *note + ValueError: 204. is raised if 'address' does not represent a valid + IPv4 or IPv6 address, or if the network has host bits set. + + >>> ipaddress.ip_network('192.168.0.0/28') + IPv4Network('192.168.0.0/28') + + -- Function: ipaddress.ip_interface (address) + + Return an *note IPv4Interface: 180d. or *note IPv6Interface: 180e. + object depending on the IP address passed as argument. 'address' + is a string or integer representing the IP address. Either IPv4 or + IPv6 addresses may be supplied; integers less than ‘2**32’ will be + considered to be IPv4 by default. A *note ValueError: 204. is + raised if 'address' does not represent a valid IPv4 or IPv6 + address. + +One downside of these convenience functions is that the need to handle +both IPv4 and IPv6 formats means that error messages provide minimal +information on the precise error, as the functions don’t know whether +the IPv4 or IPv6 format was intended. More detailed error reporting can +be obtained by calling the appropriate version specific class +constructors directly. + + +File: python.info, Node: IP Addresses, Next: IP Network definitions, Prev: Convenience factory functions, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.2 IP Addresses +...................... + +* Menu: + +* Address objects:: +* Conversion to Strings and Integers:: +* Operators: Operators<3>. + + +File: python.info, Node: Address objects, Next: Conversion to Strings and Integers, Up: IP Addresses + +5.22.23.3 Address objects +......................... + +The *note IPv4Address: 1fe. and *note IPv6Address: 1ff. objects share a +lot of common attributes. Some attributes that are only meaningful for +IPv6 addresses are also implemented by *note IPv4Address: 1fe. objects, +in order to make it easier to write code that handles both IP versions +correctly. Address objects are *note hashable: 60c, so they can be used +as keys in dictionaries. + + -- Class: ipaddress.IPv4Address (address) + + Construct an IPv4 address. An *note AddressValueError: 3c46. is + raised if 'address' is not a valid IPv4 address. + + The following constitutes a valid IPv4 address: + + 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. An integer that fits into 32 bits. + + 3. An integer packed into a *note bytes: 1c2. object of length 4 + (most significant octet first). + + >>> 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') + + Changed in version 3.8: Leading zeros are tolerated, even in + ambiguous cases that look like octal notation. + + Changed in version 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(): 962. + + -- Attribute: version + + The appropriate version number: ‘4’ for IPv4, ‘6’ for IPv6. + + -- Attribute: max_prefixlen + + The total number of bits in the address representation for + this version: ‘32’ for IPv4, ‘128’ for IPv6. + + The prefix defines the number of leading bits in an address + that are compared to determine whether or not an address is + part of a network. + + -- Attribute: compressed + + -- Attribute: exploded + + The string representation in dotted decimal notation. Leading + zeroes are never included in the representation. + + As IPv4 does not define a shorthand notation for addresses + with octets set to zero, these two attributes are always the + same as ‘str(addr)’ for IPv4 addresses. Exposing these + attributes makes it easier to write display code that can + handle both IPv4 and IPv6 addresses. + + -- Attribute: packed + + The binary representation of this address - a *note bytes: + 1c2. object of the appropriate length (most significant octet + first). This is 4 bytes for IPv4 and 16 bytes for IPv6. + + -- Attribute: 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. + + -- Attribute: is_multicast + + ‘True’ if the address is reserved for multicast use. See RFC + 3171(1) (for IPv4) or RFC 2373(2) (for IPv6). + + -- Attribute: 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: 3c4e.): + + address.is_private == address.ipv4_mapped.is_private + + ‘is_private’ has value opposite to *note is_global: f5a, + except for the shared address space (‘100.64.0.0/10’ range) + where they are both ‘False’. + + Changed in version 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. + + -- Attribute: 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: 3c4e.): + + address.is_global == address.ipv4_mapped.is_global + + ‘is_global’ has value opposite to *note is_private: 1649, + except for the shared address space (‘100.64.0.0/10’ range) + where they are both ‘False’. + + Added in version 3.4. + + Changed in version 3.13: Fixed some false positives and false + negatives, see *note is_private: 1649. for details. + + -- Attribute: is_unspecified + + ‘True’ if the address is unspecified. See RFC 5735(7) (for + IPv4) or RFC 2373(8) (for IPv6). + + -- Attribute: 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. + + Note: For IPv4, ‘is_reserved’ is not related to the + address block value of the ‘Reserved-by-Protocol’ column + in iana-ipv4-special-registry(10). + + Caution: For IPv6, ‘fec0::/10’ a former Site-Local scoped + address prefix is currently excluded from that list (see + *note is_site_local: 3c51. & RFC 3879(11)). + + -- Attribute: is_loopback + + ‘True’ if this is a loopback address. See RFC 3330(12) (for + IPv4) or RFC 2373(13) (for IPv6). + + -- Attribute: is_link_local + + ‘True’ if the address is reserved for link-local usage. See + RFC 3927(14). + + -- Attribute: ipv6_mapped + + *note IPv4Address: 1fe. object representing the IPv4-mapped + IPv6 address. See RFC 4291(15). + + Added in version 3.13. + + -- Method: 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(): 447, ‘'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. + + -- Class: ipaddress.IPv6Address (address) + + Construct an IPv6 address. An *note AddressValueError: 3c46. is + raised if 'address' is not a valid IPv6 address. + + The following constitutes a valid IPv6 address: + + 1. A string consisting of eight groups of four hexadecimal + digits, each group representing 16 bits. The groups are + separated by colons. This describes an 'exploded' (longhand) + notation. The string can also be 'compressed' (shorthand + notation) by various means. See RFC 4291(16) for details. + For example, ‘"0000:0000:0000:0000:0000:0abc:0007:0def"’ can + be compressed to ‘"::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. An integer that fits into 128 bits. + + 3. An integer packed into a *note bytes: 1c2. object of length + 16, big-endian. + + >>> ipaddress.IPv6Address('2001:db8::1000') + IPv6Address('2001:db8::1000') + >>> ipaddress.IPv6Address('ff02::5678%1') + IPv6Address('ff02::5678%1') + + -- Attribute: compressed + + The short form of the address representation, with leading zeroes + in groups omitted and the longest sequence of groups consisting + entirely of zeroes collapsed to a single empty group. + + This is also the value returned by ‘str(addr)’ for IPv6 addresses. + + -- Attribute: exploded + + The long form of the address representation, with all leading + zeroes and groups consisting entirely of zeroes included. + + For the following attributes and methods, see the corresponding + documentation of the *note IPv4Address: 1fe. class: + + -- Attribute: packed + + -- Attribute: reverse_pointer + + -- Attribute: version + + -- Attribute: max_prefixlen + + -- Attribute: is_multicast + + -- Attribute: is_private + + -- Attribute: is_global + + Added in version 3.4. + + -- Attribute: is_unspecified + + -- Attribute: is_reserved + + -- Attribute: is_loopback + + -- Attribute: is_link_local + + -- Attribute: is_site_local + + ‘True’ if the address is reserved for site-local usage. Note + that the site-local address space has been deprecated by RFC + 3879(18). Use *note is_private: 1649. to test if this address + is in the space of unique local addresses as defined by RFC + 4193(19). + + -- Attribute: ipv4_mapped + + For addresses that appear to be IPv4 mapped addresses + (starting with ‘::FFFF/96’), this property will report the + embedded IPv4 address. For any other address, this property + will be ‘None’. + + -- Attribute: scope_id + + For scoped addresses as defined by RFC 4007(20), this property + identifies the particular zone of the address’s scope that the + address belongs to, as a string. When no scope zone is + specified, this property will be ‘None’. + + -- Attribute: sixtofour + + For addresses that appear to be 6to4 addresses (starting with + ‘2002::/16’) as defined by RFC 3056(21), this property will + report the embedded IPv4 address. For any other address, this + property will be ‘None’. + + -- Attribute: teredo + + For addresses that appear to be Teredo addresses (starting + with ‘2001::/32’) as defined by RFC 4380(22), this property + will report the embedded ‘(server, client)’ IP address pair. + For any other address, this property will be ‘None’. + + -- Method: IPv6Address.__format__ (fmt) + + Refer to the corresponding method documentation in *note + IPv4Address: 1fe. + + Added in version 3.9. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc3171.html + + (2) https://datatracker.ietf.org/doc/html/rfc2373.html + + (3) +https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml + + (4) +https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml + + (5) +https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml + + (6) +https://www.iana.org/assignments/iana-ipv6-special-registry/iana-ipv6-special-registry.xhtml + + (7) https://datatracker.ietf.org/doc/html/rfc5735.html + + (8) https://datatracker.ietf.org/doc/html/rfc2373.html + + (9) +https://www.iana.org/assignments/ipv6-address-space/ipv6-address-space.xhtml + + (10) +https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml + + (11) https://datatracker.ietf.org/doc/html/rfc3879.html + + (12) https://datatracker.ietf.org/doc/html/rfc3330.html + + (13) https://datatracker.ietf.org/doc/html/rfc2373.html + + (14) https://datatracker.ietf.org/doc/html/rfc3927.html + + (15) https://datatracker.ietf.org/doc/html/rfc4291.html + + (16) https://datatracker.ietf.org/doc/html/rfc4291.html + + (17) https://datatracker.ietf.org/doc/html/rfc4007.html + + (18) https://datatracker.ietf.org/doc/html/rfc3879.html + + (19) https://datatracker.ietf.org/doc/html/rfc4193.html + + (20) https://datatracker.ietf.org/doc/html/rfc4007.html + + (21) https://datatracker.ietf.org/doc/html/rfc3056.html + + (22) https://datatracker.ietf.org/doc/html/rfc4380.html + + +File: python.info, Node: Conversion to Strings and Integers, Next: Operators<3>, Prev: Address objects, Up: IP Addresses + +5.22.23.4 Conversion to Strings and Integers +............................................ + +To interoperate with networking interfaces such as the socket module, +addresses must be converted to strings or integers. This is handled +using the *note str(): 447. and *note int(): 259. builtin functions: + + >>> 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: Operators<3>, Prev: Conversion to Strings and Integers, Up: IP Addresses + +5.22.23.5 Operators +................... + +Address objects support some operators. Unless stated otherwise, +operators can only be applied between compatible objects (i.e. IPv4 +with IPv4, IPv6 with IPv6). + +* Menu: + +* Comparison operators:: +* Arithmetic operators:: + + +File: python.info, Node: Comparison operators, Next: Arithmetic operators, Up: Operators<3> + +5.22.23.6 Comparison operators +.............................. + +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: Arithmetic operators, Prev: Comparison operators, Up: Operators<3> + +5.22.23.7 Arithmetic operators +.............................. + +Integers can be added to or subtracted from address objects. Some +examples: + + >>> 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 "", line 1, in + ipaddress.AddressValueError: 4294967296 (>= 2**32) is not permitted as an IPv4 address + + +File: python.info, Node: IP Network definitions, Next: Interface objects, Prev: IP Addresses, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.8 IP Network definitions +................................ + +The *note IPv4Network: 200. and *note IPv6Network: 201. objects provide +a mechanism for defining and inspecting IP network definitions. A +network definition consists of a 'mask' and a 'network address', and as +such defines a range of IP addresses that equal the network address when +masked (binary AND) with the mask. For example, a network definition +with the mask ‘255.255.255.0’ and the network address ‘192.168.1.0’ +consists of IP addresses in the inclusive range ‘192.168.1.0’ to +‘192.168.1.255’. + +* Menu: + +* Prefix, net mask and host mask: Prefix net mask and host mask. +* Network objects:: +* Operators: Operators<4>. + + +File: python.info, Node: Prefix net mask and host mask, Next: Network objects, Up: IP Network definitions + +5.22.23.9 Prefix, net mask and host mask +........................................ + +There are several equivalent ways to specify IP network masks. A +'prefix' ‘/’ is a notation that denotes how many high-order bits +are set in the network mask. A 'net mask' is an IP address with some +number of high-order bits set. Thus the prefix ‘/24’ is equivalent to +the net mask ‘255.255.255.0’ in IPv4, or ‘ffff:ff00::’ in IPv6. In +addition, a 'host mask' is the logical inverse of a 'net mask', and is +sometimes used (for example in Cisco access control lists) to denote a +network mask. The host mask equivalent to ‘/24’ in IPv4 is ‘0.0.0.255’. + + +File: python.info, Node: Network objects, Next: Operators<4>, Prev: Prefix net mask and host mask, Up: IP Network definitions + +5.22.23.10 Network objects +.......................... + +All attributes implemented by address objects are implemented by network +objects as well. In addition, network objects implement additional +attributes. All of these are common between *note IPv4Network: 200. and +*note IPv6Network: 201, so to avoid duplication they are only documented +for *note IPv4Network: 200. Network objects are *note hashable: 60c, so +they can be used as keys in dictionaries. + + -- Class: ipaddress.IPv4Network (address, strict=True) + + Construct an IPv4 network definition. 'address' can be one of the + following: + + 1. A string consisting of an IP address and an optional mask, + separated by a slash (‘/’). The IP address is the network + address, and the mask can be either a single number, which + means it’s a 'prefix', or a string representation of an IPv4 + address. If it’s the latter, the mask is interpreted as a + 'net mask' if it starts with a non-zero field, or as a 'host + mask' if it starts with a zero field, with the single + exception of an all-zero mask which is treated as a 'net + mask'. If no mask is provided, it’s considered to be ‘/32’. + + For example, the following 'address' specifications are + equivalent: ‘192.168.1.0/24’, ‘192.168.1.0/255.255.255.0’ and + ‘192.168.1.0/0.0.0.255’. + + 2. An integer that fits into 32 bits. This is equivalent to a + single-address network, with the network address being + 'address' and the mask being ‘/32’. + + 3. An integer packed into a *note bytes: 1c2. object of length 4, + big-endian. The interpretation is similar to an integer + '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 IPv4Address 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’). + + An *note AddressValueError: 3c46. is raised if 'address' is not a + valid IPv4 address. A *note NetmaskValueError: 3c68. is raised if + the mask is not valid for an IPv4 address. + + If 'strict' is ‘True’ and host bits are set in the supplied + address, then *note ValueError: 204. is raised. Otherwise, the + host bits are masked out to determine the appropriate network + address. + + Unless stated otherwise, all network methods accepting other + network/address objects will raise *note TypeError: 534. if the + argument’s IP version is incompatible to ‘self’. + + Changed in version 3.5: Added the two-tuple form for the 'address' + constructor parameter. + + -- Attribute: version + + -- Attribute: max_prefixlen + + Refer to the corresponding attribute documentation in *note + IPv4Address: 1fe. + + -- Attribute: is_multicast + + -- Attribute: is_private + + -- Attribute: is_unspecified + + -- Attribute: is_reserved + + -- Attribute: is_loopback + + -- Attribute: 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. + + -- Attribute: network_address + + The network address for the network. The network address and + the prefix length together uniquely define a network. + + -- Attribute: broadcast_address + + The broadcast address for the network. Packets sent to the + broadcast address should be received by every host on the + network. + + -- Attribute: hostmask + + The host mask, as an *note IPv4Address: 1fe. object. + + -- Attribute: netmask + + The net mask, as an *note IPv4Address: 1fe. object. + + -- Attribute: with_prefixlen + + -- Attribute: compressed + + -- Attribute: 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. + + -- Attribute: with_netmask + + A string representation of the network, with the mask in net + mask notation. + + -- Attribute: with_hostmask + + A string representation of the network, with the mask in host + mask notation. + + -- Attribute: num_addresses + + The total number of addresses in the network. + + -- Attribute: prefixlen + + Length of the network prefix, in bits. + + -- Method: 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')] + + -- Method: overlaps (other) + + ‘True’ if this network is partly or wholly contained in + 'other' or 'other' is wholly contained in this network. + + -- Method: 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: 204. 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')] + + -- Method: 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 "", line 1, in + 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')] + + -- Method: 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') + + -- Method: subnet_of (other) + + Return ‘True’ if this network is a subnet of 'other'. + + >>> 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. + + -- Method: supernet_of (other) + + Return ‘True’ if this network is a supernet of 'other'. + + >>> 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. + + -- Method: compare_networks (other) + + Compare this network to 'other'. In this comparison only the + network addresses are considered; host bits aren’t. Returns + either ‘-1’, ‘0’ or ‘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 + + Deprecated since version 3.7: It uses the same ordering and + comparison algorithm as “<”, “==”, and “>” + + -- Class: ipaddress.IPv6Network (address, strict=True) + + Construct an IPv6 network definition. 'address' can be one of the + following: + + 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. An integer that fits into 128 bits. This is equivalent to a + single-address network, with the network address being + 'address' and the mask being ‘/128’. + + 3. An integer packed into a *note bytes: 1c2. object of length + 16, big-endian. The interpretation is similar to an integer + '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 IPv6Address object; + and the netmask is an integer representing the prefix length. + + An *note AddressValueError: 3c46. is raised if 'address' is not a + valid IPv6 address. A *note NetmaskValueError: 3c68. is raised if + the mask is not valid for an IPv6 address. + + If 'strict' is ‘True’ and host bits are set in the supplied + address, then *note ValueError: 204. is raised. Otherwise, the + host bits are masked out to determine the appropriate network + address. + + Changed in version 3.5: Added the two-tuple form for the 'address' + constructor parameter. + + -- Attribute: version + + -- Attribute: max_prefixlen + + -- Attribute: is_multicast + + -- Attribute: is_private + + -- Attribute: is_unspecified + + -- Attribute: is_reserved + + -- Attribute: is_loopback + + -- Attribute: is_link_local + + -- Attribute: network_address + + -- Attribute: broadcast_address + + -- Attribute: hostmask + + -- Attribute: netmask + + -- Attribute: with_prefixlen + + -- Attribute: compressed + + -- Attribute: exploded + + -- Attribute: with_netmask + + -- Attribute: with_hostmask + + -- Attribute: num_addresses + + -- Attribute: prefixlen + + -- Method: 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. + + -- Method: overlaps (other) + + -- Method: address_exclude (network) + + -- Method: subnets (prefixlen_diff=1, new_prefix=None) + + -- Method: supernet (prefixlen_diff=1, new_prefix=None) + + -- Method: subnet_of (other) + + -- Method: supernet_of (other) + + -- Method: compare_networks (other) + + Refer to the corresponding attribute documentation in *note + IPv4Network: 200. + + -- Attribute: is_site_local + + These 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: Operators<4>, Prev: Network objects, Up: IP Network definitions + +5.22.23.11 Operators +.................... + +Network objects support some operators. Unless stated otherwise, +operators can only be applied between compatible objects (i.e. IPv4 +with IPv4, IPv6 with IPv6). + +* Menu: + +* Logical operators:: +* Iteration:: +* Networks as containers of addresses:: + + +File: python.info, Node: Logical operators, Next: Iteration, Up: Operators<4> + +5.22.23.12 Logical operators +............................ + +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: Iteration, Next: Networks as containers of addresses, Prev: Logical operators, Up: Operators<4> + +5.22.23.13 Iteration +.................... + +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(): 3c7c. 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: Networks as containers of addresses, Prev: Iteration, Up: Operators<4> + +5.22.23.14 Networks as containers of addresses +.............................................. + +Network objects can act as containers of addresses. Some examples: + + >>> 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: Interface objects, Next: Other Module Level Functions, Prev: IP Network definitions, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.15 Interface objects +............................ + +Interface objects are *note hashable: 60c, so they can be used as keys +in dictionaries. + + -- Class: ipaddress.IPv4Interface (address) + + Construct an IPv4 interface. The meaning of 'address' is as in the + constructor of *note IPv4Network: 200, except that arbitrary host + addresses are always accepted. + + *note IPv4Interface: 180d. is a subclass of *note IPv4Address: 1fe, + so it inherits all the attributes from that class. In addition, + the following attributes are available: + + -- Attribute: ip + + The address (*note IPv4Address: 1fe.) without network + information. + + >>> interface = IPv4Interface('192.0.2.5/24') + >>> interface.ip + IPv4Address('192.0.2.5') + + -- Attribute: network + + The network (*note IPv4Network: 200.) this interface belongs + to. + + >>> interface = IPv4Interface('192.0.2.5/24') + >>> interface.network + IPv4Network('192.0.2.0/24') + + -- Attribute: 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' + + -- Attribute: 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' + + -- Attribute: 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' + + -- Class: ipaddress.IPv6Interface (address) + + Construct an IPv6 interface. The meaning of 'address' is as in the + constructor of *note IPv6Network: 201, except that arbitrary host + addresses are always accepted. + + *note IPv6Interface: 180e. is a subclass of *note IPv6Address: 1ff, + so it inherits all the attributes from that class. In addition, + the following attributes are available: + + -- Attribute: ip + + -- Attribute: network + + -- Attribute: with_prefixlen + + -- Attribute: with_netmask + + -- Attribute: with_hostmask + + Refer to the corresponding attribute documentation in *note + IPv4Interface: 180d. + +* Menu: + +* Operators: Operators<5>. + + +File: python.info, Node: Operators<5>, Up: Interface objects + +5.22.23.16 Operators +.................... + +Interface objects support some operators. Unless stated otherwise, +operators can only be applied between compatible objects (i.e. IPv4 +with IPv4, IPv6 with IPv6). + +* Menu: + +* Logical operators: Logical operators<2>. + + +File: python.info, Node: Logical operators<2>, Up: Operators<5> + +5.22.23.17 Logical operators +............................ + +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: Other Module Level Functions, Next: Custom Exceptions, Prev: Interface objects, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.18 Other Module Level Functions +....................................... + +The module also provides the following module level functions: + + -- Function: ipaddress.v4_int_to_packed (address) + + Represent an address as 4 packed bytes in network (big-endian) + order. 'address' is an integer representation of an IPv4 IP + address. A *note ValueError: 204. is raised if the integer is + negative or too large to be an IPv4 IP address. + + >>> ipaddress.ip_address(3221225985) + IPv4Address('192.0.2.1') + >>> ipaddress.v4_int_to_packed(3221225985) + b'\xc0\x00\x02\x01' + + -- Function: ipaddress.v6_int_to_packed (address) + + Represent an address as 16 packed bytes in network (big-endian) + order. 'address' is an integer representation of an IPv6 IP + address. A *note ValueError: 204. is raised if the integer is + negative or too large to be an IPv6 IP address. + + -- Function: ipaddress.summarize_address_range (first, last) + + Return an iterator of the summarized network range given the first + and last IP addresses. 'first' is the first *note IPv4Address: + 1fe. or *note IPv6Address: 1ff. in the range and 'last' is the last + *note IPv4Address: 1fe. or *note IPv6Address: 1ff. in the range. A + *note TypeError: 534. is raised if 'first' or 'last' are not IP + addresses or are not of the same version. A *note ValueError: 204. + is raised if 'last' is not greater than 'first' or if 'first' + address version is not 4 or 6. + + >>> [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')] + + -- Function: ipaddress.collapse_addresses (addresses) + + Return an iterator of the collapsed *note IPv4Network: 200. or + *note IPv6Network: 201. objects. 'addresses' is an *note iterable: + 121a. of *note IPv4Network: 200. or *note IPv6Network: 201. + objects. A *note TypeError: 534. 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')] + + -- Function: ipaddress.get_mixed_type_key (obj) + + Return a key suitable for sorting between networks and addresses. + Address and Network objects are not sortable by default; they’re + fundamentally different, so the expression: + + 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 *note ipaddress: 80. sort these anyway. If you need + to do this, you can use this function as the 'key' argument to + *note sorted(): bce. + + 'obj' is either a network or address object. + + +File: python.info, Node: Custom Exceptions, Prev: Other Module Level Functions, Up: ipaddress — IPv4/IPv6 manipulation library + +5.22.23.19 Custom Exceptions +............................ + +To support more specific error reporting from class constructors, the +module defines the following exceptions: + + -- Exception: ipaddress.AddressValueError (ValueError) + + Any value error related to the address. + + -- Exception: ipaddress.NetmaskValueError (ValueError) + + Any value error related to the net mask. + + +File: python.info, Node: Multimedia Services, Next: Internationalization, Prev: Internet Protocols and Support, Up: The Python Standard Library + +5.23 Multimedia Services +======================== + +The modules described in this chapter implement various algorithms or +interfaces that are mainly useful for multimedia applications. They are +available at the discretion of the installation. Here’s an overview: + +* Menu: + +* wave — Read and write WAV files:: +* colorsys — Conversions between color systems:: + + +File: python.info, Node: wave — Read and write WAV files, Next: colorsys — Conversions between color systems, Up: Multimedia Services + +5.23.1 ‘wave’ — Read and write WAV files +---------------------------------------- + +'Source code:' Lib/wave.py(1) + +__________________________________________________________________ + +The *note wave: 113. module provides a convenient interface to the +Waveform Audio “WAVE” (or “WAV”) file format. Only uncompressed PCM +encoded wave files are supported. + +Changed in version 3.12: Support for ‘WAVE_FORMAT_EXTENSIBLE’ headers +was added, provided that the extended format is +‘KSDATAFORMAT_SUBTYPE_PCM’. + +The *note wave: 113. module defines the following function and +exception: + + -- Function: wave.open (file, mode=None) + + If 'file' is a string, open the file by that name, otherwise treat + it as a file-like object. 'mode' can be: + + ‘'rb'’ + + Read only mode. + + ‘'wb'’ + + Write only mode. + + Note that it does not allow read/write WAV files. + + A 'mode' of ‘'rb'’ returns a *note Wave_read: 2b8. object, while a + 'mode' of ‘'wb'’ returns a *note Wave_write: 2b9. object. If + 'mode' is omitted and a file-like object is passed as 'file', + ‘file.mode’ is used as the default value for 'mode'. + + If you pass in a file-like object, the wave object will not close + it when its ‘close()’ method is called; it is the caller’s + responsibility to close the file object. + + The *note open(): 94b. function may be used in a *note with: 5ce. + statement. When the ‘with’ block completes, the *note + Wave_read.close(): 3cb9. or *note Wave_write.close(): 3cba. method + is called. + + Changed in version 3.4: Added support for unseekable files. + + -- Exception: wave.Error + + An error raised when something is impossible because it violates + the WAV specification or hits an implementation deficiency. + +* Menu: + +* Wave_read Objects:: +* Wave_write Objects:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/wave.py + + +File: python.info, Node: Wave_read Objects, Next: Wave_write Objects, Up: wave — Read and write WAV files + +5.23.1.1 Wave_read Objects +.......................... + + -- Class: wave.Wave_read + + Read a WAV file. + + Wave_read objects, as returned by *note open(): 94b, have the + following methods: + + -- Method: close () + + Close the stream if it was opened by *note wave: 113, and make + the instance unusable. This is called automatically on object + collection. + + -- Method: getnchannels () + + Returns number of audio channels (‘1’ for mono, ‘2’ for + stereo). + + -- Method: getsampwidth () + + Returns sample width in bytes. + + -- Method: getframerate () + + Returns sampling frequency. + + -- Method: getnframes () + + Returns number of audio frames. + + -- Method: getcomptype () + + Returns compression type (‘'NONE'’ is the only supported + type). + + -- Method: getcompname () + + Human-readable version of *note getcomptype(): 3cc2. Usually + ‘'not compressed'’ parallels ‘'NONE'’. + + -- Method: getparams () + + Returns a *note namedtuple(): 1ca. ‘(nchannels, sampwidth, + framerate, nframes, comptype, compname)’, equivalent to output + of the ‘get*()’ methods. + + -- Method: readframes (n) + + Reads and returns at most 'n' frames of audio, as a *note + bytes: 1c2. object. + + -- Method: rewind () + + Rewind the file pointer to the beginning of the audio stream. + + The following two methods are defined for compatibility with the + old ‘aifc’ module, and don’t do anything interesting. + + -- Method: getmarkers () + + Returns ‘None’. + + Deprecated since version 3.13, will be removed in version + 3.15: The method only existed for compatibility with the + ‘aifc’ module which has been removed in Python 3.13. + + -- Method: getmark (id) + + Raise an error. + + Deprecated since version 3.13, will be removed in version + 3.15: The method only existed for compatibility with the + ‘aifc’ module which has been removed in Python 3.13. + + The following two methods define a term “position” which is + compatible between them, and is otherwise implementation dependent. + + -- Method: setpos (pos) + + Set the file pointer to the specified position. + + -- Method: tell () + + Return current file pointer position. + + +File: python.info, Node: Wave_write Objects, Prev: Wave_read Objects, Up: wave — Read and write WAV files + +5.23.1.2 Wave_write Objects +........................... + + -- Class: wave.Wave_write + + Write a WAV file. + + Wave_write objects, as returned by *note open(): 94b. + + 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(): 3cca. or *note + setparams(): 3ccb. with the number of frames that will be written + before *note close(): 3cba. is called and then using *note + writeframesraw(): fe5. to write the frame data, or by calling *note + writeframes(): fe6. with all of the frame data to be written. In + the latter case *note writeframes(): fe6. will calculate the number + of frames in the data and set 'nframes' accordingly before writing + the frame data. + + Changed in version 3.4: Added support for unseekable files. + + Wave_write objects have the following methods: + + -- Method: close () + + Make sure 'nframes' is correct, and close the file if it was + opened by *note wave: 113. 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. + + -- Method: setnchannels (n) + + Set the number of channels. + + -- Method: setsampwidth (n) + + Set the sample width to 'n' bytes. + + -- Method: setframerate (n) + + Set the frame rate to 'n'. + + Changed in version 3.2: A non-integral input to this method is + rounded to the nearest integer. + + -- Method: setnframes (n) + + Set the number of frames to 'n'. This will be changed later + if the number of frames actually written is different (this + update attempt will raise an error if the output stream is not + seekable). + + -- Method: setcomptype (type, name) + + Set the compression type and description. At the moment, only + compression type ‘NONE’ is supported, meaning no compression. + + -- Method: setparams (tuple) + + The 'tuple' should be ‘(nchannels, sampwidth, framerate, + nframes, comptype, compname)’, with values valid for the + ‘set*()’ methods. Sets all parameters. + + -- Method: tell () + + Return current position in the file, with the same disclaimer + for the *note Wave_read.tell(): 3cc8. and *note + Wave_read.setpos(): 3cc7. methods. + + -- Method: writeframesraw (data) + + Write audio frames, without correcting 'nframes'. + + Changed in version 3.4: Any *note bytes-like object: d2d. is + now accepted. + + -- Method: writeframes (data) + + Write audio frames and make sure 'nframes' is correct. It + will raise an error if the output stream is not seekable and + the total number of frames that have been written after 'data' + has been written does not match the previously set value for + 'nframes'. + + Changed in version 3.4: Any *note bytes-like object: d2d. is + now accepted. + + Note that it is invalid to set any parameters after calling + *note writeframes(): fe6. or *note writeframesraw(): fe5, and + any attempt to do so will raise *note wave.Error: 3cbb. + + +File: python.info, Node: colorsys — Conversions between color systems, Prev: wave — Read and write WAV files, Up: Multimedia Services + +5.23.2 ‘colorsys’ — Conversions between color systems +----------------------------------------------------- + +'Source code:' Lib/colorsys.py(1) + +__________________________________________________________________ + +The *note colorsys: 1f. 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. + +See also +........ + +More information about color spaces can be found at +‘https://poynton.ca/ColorFAQ.html’ and +‘https://www.cambridgeincolour.com/tutorials/color-spaces.htm’. + +The *note colorsys: 1f. module defines the following functions: + + -- Function: colorsys.rgb_to_yiq (r, g, b) + + Convert the color from RGB coordinates to YIQ coordinates. + + -- Function: colorsys.yiq_to_rgb (y, i, q) + + Convert the color from YIQ coordinates to RGB coordinates. + + -- Function: colorsys.rgb_to_hls (r, g, b) + + Convert the color from RGB coordinates to HLS coordinates. + + -- Function: colorsys.hls_to_rgb (h, l, s) + + Convert the color from HLS coordinates to RGB coordinates. + + -- Function: colorsys.rgb_to_hsv (r, g, b) + + Convert the color from RGB coordinates to HSV coordinates. + + -- Function: colorsys.hsv_to_rgb (h, s, v) + + Convert the color from HSV coordinates to RGB coordinates. + +Example: + + >>> import colorsys + >>> colorsys.rgb_to_hsv(0.2, 0.4, 0.4) + (0.5, 0.5, 0.4) + >>> colorsys.hsv_to_rgb(0.5, 0.5, 0.4) + (0.2, 0.4, 0.4) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/colorsys.py + + +File: python.info, Node: Internationalization, Next: Program Frameworks, Prev: Multimedia Services, Up: The Python Standard Library + +5.24 Internationalization +========================= + +The modules described in this chapter help you write software that is +independent of language and locale by providing mechanisms for selecting +a language to be used in program messages or by tailoring output to +match local conventions. + +The list of modules described in this chapter is: + +* Menu: + +* gettext — Multilingual internationalization services:: +* locale — Internationalization services:: + + +File: python.info, Node: gettext — Multilingual internationalization services, Next: locale — Internationalization services, Up: Internationalization + +5.24.1 ‘gettext’ — Multilingual internationalization services +------------------------------------------------------------- + +'Source code:' Lib/gettext.py(1) + +__________________________________________________________________ + +The *note gettext: 63. 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. + +Some hints on localizing your Python modules and applications are also +given. + +* Menu: + +* GNU gettext API:: +* Class-based API:: +* Internationalizing your programs and modules:: +* Acknowledgements: Acknowledgements<9>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/gettext.py + + +File: python.info, Node: GNU gettext API, Next: Class-based API, Up: gettext — Multilingual internationalization services + +5.24.1.1 GNU ‘gettext’ API +.......................... + +The *note gettext: 63. 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. + + -- Function: gettext.bindtextdomain (domain, localedir=None) + + Bind the 'domain' to the locale directory 'localedir'. More + concretely, *note gettext: 63. 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. + + If 'localedir' is omitted or ‘None’, then the current binding for + 'domain' is returned. (1) + + -- Function: gettext.textdomain (domain=None) + + Change or query the current global domain. If 'domain' is ‘None’, + then the current global domain is returned, otherwise the global + domain is set to 'domain', which is returned. + + -- Function: 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). + + -- Function: gettext.dgettext (domain, message) + + Like *note gettext(): 1432, but look the message up in the + specified 'domain'. + + -- Function: gettext.ngettext (singular, plural, n) + + Like *note gettext(): 1432, but consider plural forms. If a + translation is found, apply the plural formula to 'n', and return + the resulting message (some languages have more than two plural + forms). If no translation is found, return 'singular' if 'n' is 1; + return 'plural' otherwise. + + The Plural formula is taken from the catalog header. It is a C or + Python expression that has a free variable 'n'; the expression + evaluates to the index of the plural in the catalog. See the GNU + gettext documentation(2) for the precise syntax to be used in ‘.po’ + files and the formulas for a variety of languages. + + -- Function: gettext.dngettext (domain, singular, plural, n) + + Like *note ngettext(): 3ce1, but look the message up in the + specified 'domain'. + + -- Function: gettext.pgettext (context, message) + + -- Function: gettext.dpgettext (domain, context, message) + + -- Function: gettext.npgettext (context, singular, plural, n) + + -- Function: gettext.dnpgettext (domain, context, singular, plural, n) + + Similar to the corresponding functions without the ‘p’ in the + prefix (that is, *note gettext(): 63, *note dgettext(): 3ce0, *note + ngettext(): 3ce1, *note dngettext(): 3ce2.), 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. + +Here’s an example of typical usage for this 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: 3eb.). For +this reason, it is always best to call *note bindtextdomain(): 3cde. +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: Class-based API, Next: Internationalizing your programs and modules, Prev: GNU gettext API, Up: gettext — Multilingual internationalization services + +5.24.1.2 Class-based API +........................ + +The class-based API of the *note gettext: 63. 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: 3ce7. 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 ‘_()’. + + -- Function: gettext.find (domain, localedir=None, languages=None, + all=False) + + This function implements the standard ‘.mo’ file search algorithm. + It takes a 'domain', identical to what *note textdomain(): 3cdf. + takes. Optional 'localedir' is as in *note bindtextdomain(): 3cde. + Optional 'languages' is a list of strings, where each string is a + language code. + + If 'localedir' is not given, then the default system locale + directory is used. (1) If 'languages' is not given, then the + following environment variables are searched: ‘LANGUAGE’, ‘LC_ALL’, + ‘LC_MESSAGES’, and ‘LANG’. The first one returning a non-empty + value is used for the 'languages' variable. The environment + variables should contain a colon separated list of languages, which + will be split on the colon to produce the expected list of language + code strings. + + *note find(): 3ce8. then expands and normalizes the languages, and + then iterates through them, searching for an existing file built of + these components: + + ‘`localedir'/`language'/LC_MESSAGES/`domain'.mo’ + + The first such file name that exists is returned by *note find(): + 3ce8. If no such file is found, then ‘None’ is returned. If 'all' + is given, it returns a list of all file names, in the order in + which they appear in the languages list or the environment + variables. + + -- Function: 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(): 3ce8. 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: 3ce7. The class’s constructor must take a single + *note file object: 11b5. argument. + + If multiple files are found, later files are used as fallbacks for + earlier ones. To allow setting the fallback, *note copy.copy(): + 52f. is used to clone each translation object from the cache; the + actual instance data is still shared with the cache. + + If no ‘.mo’ file is found, this function raises *note OSError: 413. + if 'fallback' is false (which is the default), and returns a *note + NullTranslations: 3ce9. instance if 'fallback' is true. + + Changed in version 3.3: *note IOError: 104b. used to be raised, it + is now an alias of *note OSError: 413. + + Changed in version 3.11: 'codeset' parameter is removed. + + -- Function: 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(): a79. + + For the 'names' parameter, please see the description of the + translation object’s *note install(): 3cea. method. + + 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. + + Changed in version 3.11: 'names' is now a keyword-only parameter. + +* Menu: + +* The NullTranslations class:: +* The GNUTranslations class:: +* Solaris message catalog support:: +* The Catalog constructor:: + + ---------- Footnotes ---------- + + (1) See the footnote for *note bindtextdomain(): 3cde. above. + + +File: python.info, Node: The NullTranslations class, Next: The GNUTranslations class, Up: Class-based API + +5.24.1.3 The ‘NullTranslations’ class +..................................... + +Translation classes are what actually implement the translation of +original source file message strings to translated message strings. The +base class used by all translation classes is *note NullTranslations: +3ce9.; this provides the basic interface you can use to write your own +specialized translation classes. Here are the methods of +‘NullTranslations’: + + -- Class: gettext.NullTranslations (fp=None) + + Takes an optional *note file object: 11b5. 'fp', which is ignored + by the base class. Initializes “protected” instance variables + '_info' and '_charset' which are set by derived classes, as well as + '_fallback', which is set through *note add_fallback(): 3cec. It + then calls ‘self._parse(fp)’ if 'fp' is not ‘None’. + + -- Method: _parse (fp) + + No-op in the base class, this method takes file object 'fp', + and reads the data from the file, initializing its message + catalog. If you have an unsupported message catalog file + format, you should override this method to parse your format. + + -- Method: add_fallback (fallback) + + Add 'fallback' as the fallback object for the current + translation object. A translation object should consult the + fallback if it cannot provide a translation for a given + message. + + -- Method: gettext (message) + + If a fallback has been set, forward ‘gettext()’ to the + fallback. Otherwise, return 'message'. Overridden in derived + classes. + + -- Method: ngettext (singular, plural, n) + + If a fallback has been set, forward ‘ngettext()’ to the + fallback. Otherwise, return 'singular' if 'n' is 1; return + 'plural' otherwise. Overridden in derived classes. + + -- Method: pgettext (context, message) + + If a fallback has been set, forward *note pgettext(): 9f4. to + the fallback. Otherwise, return the translated message. + Overridden in derived classes. + + Added in version 3.8. + + -- Method: npgettext (context, singular, plural, n) + + If a fallback has been set, forward *note npgettext(): 3ce4. + to the fallback. Otherwise, return the translated message. + Overridden in derived classes. + + Added in version 3.8. + + -- Method: info () + + Return a dictionary containing the metadata found in the + message catalog file. + + -- Method: charset () + + Return the encoding of the message catalog file. + + -- Method: install (names=None) + + This method installs *note gettext(): 3cee. into the built-in + namespace, binding it to ‘_’. + + 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. + + Changed in version 3.8: Added ‘'pgettext'’ and ‘'npgettext'’. + + +File: python.info, Node: The GNUTranslations class, Next: Solaris message catalog support, Prev: The NullTranslations class, Up: Class-based API + +5.24.1.4 The ‘GNUTranslations’ class +.................................... + +The ‘gettext’ module provides one additional class derived from *note +NullTranslations: 3ce9.: *note GNUTranslations: 3ce7. This class +overrides ‘_parse()’ to enable reading GNU ‘gettext’ format ‘.mo’ files +in both big-endian and little-endian format. + +*note GNUTranslations: 3ce7. 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. + +If the ‘.mo’ file’s magic number is invalid, the major version number is +unexpected, or if other problems occur while reading the file, +instantiating a *note GNUTranslations: 3ce7. class can raise *note +OSError: 413. + + -- Class: gettext.GNUTranslations + + The following methods are overridden from the base class + implementation: + + -- Method: gettext (message) + + Look up the 'message' id in the catalog and return the + corresponding message string, as a Unicode string. If there + is no entry in the catalog for the 'message' id, and a + fallback has been set, the look up is forwarded to the + fallback’s *note gettext(): 3cee. method. Otherwise, the + 'message' id is returned. + + -- Method: ngettext (singular, plural, n) + + Do a plural-forms lookup of a message id. 'singular' is used + as the message id for purposes of lookup in the catalog, while + 'n' is used to determine which plural form to use. The + returned message string is a Unicode string. + + If the message id is not found in the catalog, and a fallback + is specified, the request is forwarded to the fallback’s *note + ngettext(): 3cef. method. Otherwise, when 'n' is 1 'singular' + is returned, and 'plural' is returned in all other cases. + + Here is an example: + + 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} + + -- Method: pgettext (context, message) + + Look up the 'context' and 'message' id in the catalog and + return the corresponding message string, as a Unicode string. + If there is no entry in the catalog for the 'message' id and + 'context', and a fallback has been set, the look up is + forwarded to the fallback’s *note pgettext(): 9f4. method. + Otherwise, the 'message' id is returned. + + Added in version 3.8. + + -- Method: npgettext (context, singular, plural, n) + + Do a plural-forms lookup of a message id. 'singular' is used + as the message id for purposes of lookup in the catalog, while + 'n' is used to determine which plural form to use. + + If the message id for 'context' is not found in the catalog, + and a fallback is specified, the request is forwarded to the + fallback’s *note npgettext(): 3ce4. method. Otherwise, when + 'n' is 1 'singular' is returned, and 'plural' is returned in + all other cases. + + Added in version 3.8. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc822.html + + +File: python.info, Node: Solaris message catalog support, Next: The Catalog constructor, Prev: The GNUTranslations class, Up: Class-based API + +5.24.1.5 Solaris message catalog support +........................................ + +The Solaris operating system defines its own binary ‘.mo’ file format, +but since no documentation can be found on this format, it is not +supported at this time. + + +File: python.info, Node: The Catalog constructor, Prev: Solaris message catalog support, Up: Class-based API + +5.24.1.6 The Catalog constructor +................................ + +GNOME uses a version of the *note gettext: 63. 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(): a79. function described above. + +One difference between this module and Henstridge’s: his catalog objects +supported access through a mapping API, but this appears to be unused +and so is not currently supported. + + +File: python.info, Node: Internationalizing your programs and modules, Next: Acknowledgements<9>, Prev: Class-based API, Up: gettext — Multilingual internationalization services + +5.24.1.7 Internationalizing your programs and modules +..................................................... + +Internationalization (I18N) refers to the operation by which a program +is made aware of multiple languages. Localization (L10N) refers to the +adaptation of your program, once internationalized, to the local +language and cultural habits. In order to provide multilingual messages +for your Python programs, you need to take the following steps: + + 1. prepare your program or module by specially marking translatable + strings + + 2. run a suite of tools over your marked files to generate raw + messages catalogs + + 3. create language-specific translations of the message catalogs + + 4. use the *note gettext: 63. 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 _: 63. For example: + + filename = 'mylog.txt' + message = _('writing a log message') + with open(filename, 'w') as fp: + fp.write(message) + +In this example, the string ‘'writing a log message'’ is marked as a +candidate for translation, while the strings ‘'mylog.txt'’ and ‘'w'’ are +not. + +There are a few tools to extract the strings meant for translation. The +original GNU ‘gettext’ only supported C or C++ source code but its +extended version ‘xgettext’ scans code written in a number of languages, +including Python, to find strings marked as translatable. Babel(1) is a +Python internationalization library that includes a ‘pybabel’ script to +extract and compile message catalogs. François Pinard’s program called +‘xpot’ does a similar job and is available as part of his po-utils +package(2). + +(Python also includes pure-Python versions of these programs, called +‘pygettext.py’ and ‘msgfmt.py’; some Python distributions will install +them for you. ‘pygettext.py’ is similar to ‘xgettext’, but only +understands Python source code and cannot handle other programming +languages such as C or C++. ‘pygettext.py’ supports a command-line +interface similar to ‘xgettext’; for details on its use, run +‘pygettext.py --help’. ‘msgfmt.py’ is binary compatible with GNU +‘msgfmt’. With these two programs, you may not need the GNU ‘gettext’ +package to internationalize your Python applications.) + +‘xgettext’, ‘pygettext’, and similar tools generate ‘.po’ files that are +message catalogs. They are structured human-readable files that contain +every marked string in the source code, along with a placeholder for the +translated versions of these strings. + +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 +‘.po’ file that’s compiled into a machine-readable ‘.mo’ +binary catalog file using the ‘msgfmt’ program. The ‘.mo’ files are +used by the *note gettext: 63. module for the actual translation +processing at run-time. + +How you use the *note gettext: 63. 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: + +* Localizing your module:: +* Localizing your application:: +* Changing languages on the fly:: +* Deferred translations:: + + ---------- Footnotes ---------- + + (1) https://babel.pocoo.org/ + + (2) https://github.com/pinard/po-utils + + +File: python.info, Node: Localizing your module, Next: Localizing your application, Up: Internationalizing your programs and modules + +5.24.1.8 Localizing your module +............................... + +If you are localizing your module, you must take care not to make global +changes, e.g. to the built-in namespace. You should not use the GNU +‘gettext’ API but instead the class-based API. + +Let’s say your module is called “spam” and the module’s various natural +language translation ‘.mo’ files reside in ‘/usr/share/locale’ in GNU +‘gettext’ format. Here’s what you would put at the top of your module: + + import gettext + t = gettext.translation('spam', '/usr/share/locale') + _ = t.gettext + + +File: python.info, Node: Localizing your application, Next: Changing languages on the fly, Prev: Localizing your module, Up: Internationalizing your programs and modules + +5.24.1.9 Localizing your application +.................................... + +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. + +In the simple case then, you need only add the following bit of code to +the main driver file of your application: + + import gettext + gettext.install('myapplication') + +If you need to set the locale directory, you can pass it into the *note +install(): a7a. function: + + import gettext + gettext.install('myapplication', '/usr/share/locale') + + +File: python.info, Node: Changing languages on the fly, Next: Deferred translations, Prev: Localizing your application, Up: Internationalizing your programs and modules + +5.24.1.10 Changing languages on the fly +....................................... + +If your program needs to support many languages at the same time, you +may want to create multiple translation instances and then switch +between them explicitly, like so: + + 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: Deferred translations, Prev: Changing languages on the fly, Up: Internationalizing your programs and modules + +5.24.1.11 Deferred translations +............................... + +In most coding situations, strings are translated where they are coded. +Occasionally however, you need to mark strings for translation, but +defer actual translation until later. A classic example is: + + animals = ['mollusk', + 'albatross', + 'rat', + 'penguin', + 'python', ] + # ... + for a in animals: + print(a) + +Here, you want to mark the strings in the ‘animals’ list as being +translatable, but you don’t actually want to translate them until they +are printed. + +Here is one way you can handle this situation: + + 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: +17a6. 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. + +Another way to handle this is with the following example: + + 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: Acknowledgements<9>, Prev: Internationalizing your programs and modules, Up: gettext — Multilingual internationalization services + +5.24.1.12 Acknowledgements +.......................... + +The following people contributed code, feedback, design suggestions, +previous implementations, and valuable experience to the creation of +this module: + + * 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 — Internationalization services, Prev: gettext — Multilingual internationalization services, Up: Internationalization + +5.24.2 ‘locale’ — Internationalization services +----------------------------------------------- + +'Source code:' Lib/locale.py(1) + +__________________________________________________________________ + +The *note locale: 86. 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 *note locale: 86. module is implemented on top of the ‘_locale’ +module, which in turn uses an ANSI C locale implementation if available. + +The *note locale: 86. module defines the following exception and +functions: + + -- Exception: locale.Error + + Exception raised when the locale passed to *note setlocale(): 2df. + is not recognized. + + -- Function: locale.setlocale (category, locale=None) + + If 'locale' is given and not ‘None’, *note setlocale(): 2df. + modifies the locale setting for the 'category'. The available + categories are listed in the data description below. 'locale' may + be a *note string: 3d04, 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: 3d03. + 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: 3d04, but without encoding and ‘@’-modifier. + The language code and encoding can be ‘None’. + + If 'locale' is omitted or ‘None’, the current setting for + 'category' is returned. + + *note setlocale(): 2df. is not thread-safe on most systems. + Applications typically start with a call of + + import locale + locale.setlocale(locale.LC_ALL, '') + + This sets the locale for all categories to the user’s default + setting (typically specified in the ‘LANG’ environment variable). + If the locale is not changed thereafter, using multithreading + should not cause problems. + + -- Function: locale.localeconv () + + Returns the database of the local conventions as a dictionary. + This dictionary has the following strings as keys: + + Category Key Meaning + + ---------------------------------------------------------------------------------------------------------- + + *note LC_NUMERIC: 3d05. ‘'decimal_point'’ Decimal point character. + + + ‘'grouping'’ Sequence of numbers specifying + which relative positions the + ‘'thousands_sep'’ is expected. If + the sequence is terminated with + *note CHAR_MAX: 3d06, no further + grouping is performed. If the + sequence terminates with a ‘0’, + the last group size is repeatedly + used. + + + ‘'thousands_sep'’ Character used between groups. + + + *note LC_MONETARY: 3d07. ‘'int_curr_symbol'’ International currency symbol. + + + ‘'currency_symbol'’ Local currency symbol. + + + ‘'p_cs_precedes/n_cs_precedes'’ Whether the currency symbol + precedes the value (for positive + resp. negative values). + + + ‘'p_sep_by_space/n_sep_by_space'’ Whether the currency symbol is + separated from the value by a + space (for positive resp. + negative values). + + + ‘'mon_decimal_point'’ Decimal point used for monetary + values. + + + ‘'frac_digits'’ Number of fractional digits used + in local formatting of monetary + values. + + + ‘'int_frac_digits'’ Number of fractional digits used + in international formatting of + monetary values. + + + ‘'mon_thousands_sep'’ Group separator used for monetary + values. + + + ‘'mon_grouping'’ Equivalent to ‘'grouping'’, used + for monetary values. + + + ‘'positive_sign'’ Symbol used to annotate a positive + monetary value. + + + ‘'negative_sign'’ Symbol used to annotate a negative + monetary value. + + + ‘'p_sign_posn/n_sign_posn'’ The position of the sign (for + positive resp. negative values), + see below. + + + All numeric values can be set to *note CHAR_MAX: 3d06. to indicate + that there is no value specified in this locale. + + The possible values for ‘'p_sign_posn'’ and ‘'n_sign_posn'’ are + given below. + + Value Explanation + + ----------------------------------------------------------------- + + ‘0’ Currency and value are surrounded by + parentheses. + + + ‘1’ The sign should precede the value and + currency symbol. + + + ‘2’ The sign should follow the value and + currency symbol. + + + ‘3’ The sign should immediately precede the + value. + + + ‘4’ The sign should immediately follow the + value. + + + ‘CHAR_MAX’ Nothing is specified in this locale. + + + The function temporarily sets the ‘LC_CTYPE’ locale to the + ‘LC_NUMERIC’ locale or the ‘LC_MONETARY’ locale if locales are + different and numeric or monetary strings are non-ASCII. This + temporary change affects other threads. + + Changed in version 3.7: The function now temporarily sets the + ‘LC_CTYPE’ locale to the ‘LC_NUMERIC’ locale in some cases. + + -- Function: locale.nl_langinfo (option) + + Return some locale-specific information as a string. This function + is not available on all systems, and the set of possible options + might also vary across platforms. The possible argument values are + numbers, for which symbolic constants are available in the locale + module. + + The *note nl_langinfo(): 3d08. function accepts one of the + following keys. Most descriptions are taken from the corresponding + description in the GNU C library. + + -- Data: locale.CODESET + + Get a string with the name of the character encoding used in + the selected locale. + + -- Data: locale.D_T_FMT + + Get a string that can be used as a format string for *note + time.strftime(): 11db. to represent date and time in a + locale-specific way. + + -- Data: locale.D_FMT + + Get a string that can be used as a format string for *note + time.strftime(): 11db. to represent a date in a + locale-specific way. + + -- Data: locale.T_FMT + + Get a string that can be used as a format string for *note + time.strftime(): 11db. to represent a time in a + locale-specific way. + + -- Data: locale.T_FMT_AMPM + + Get a format string for *note time.strftime(): 11db. to + represent time in the am/pm format. + + -- Data: locale.DAY_1 + -- Data: locale.DAY_2 + -- Data: locale.DAY_3 + -- Data: locale.DAY_4 + -- Data: locale.DAY_5 + -- Data: locale.DAY_6 + -- Data: locale.DAY_7 + + Get the name of the n-th day of the week. + + Note: This follows the US convention of *note DAY_1: + 3d0e. being Sunday, not the international convention (ISO + 8601) that Monday is the first day of the week. + + -- Data: locale.ABDAY_1 + -- Data: locale.ABDAY_2 + -- Data: locale.ABDAY_3 + -- Data: locale.ABDAY_4 + -- Data: locale.ABDAY_5 + -- Data: locale.ABDAY_6 + -- Data: locale.ABDAY_7 + + Get the abbreviated name of the n-th day of the week. + + -- Data: locale.MON_1 + -- Data: locale.MON_2 + -- Data: locale.MON_3 + -- Data: locale.MON_4 + -- Data: locale.MON_5 + -- Data: locale.MON_6 + -- Data: locale.MON_7 + -- Data: locale.MON_8 + -- Data: locale.MON_9 + -- Data: locale.MON_10 + -- Data: locale.MON_11 + -- Data: locale.MON_12 + + Get the name of the n-th month. + + -- Data: locale.ABMON_1 + -- Data: locale.ABMON_2 + -- Data: locale.ABMON_3 + -- Data: locale.ABMON_4 + -- Data: locale.ABMON_5 + -- Data: locale.ABMON_6 + -- Data: locale.ABMON_7 + -- Data: locale.ABMON_8 + -- Data: locale.ABMON_9 + -- Data: locale.ABMON_10 + -- Data: locale.ABMON_11 + -- Data: locale.ABMON_12 + + Get the abbreviated name of the n-th month. + + -- Data: locale.RADIXCHAR + + Get the radix character (decimal dot, decimal comma, etc.). + + -- Data: locale.THOUSEP + + Get the separator character for thousands (groups of three + digits). + + -- Data: locale.YESEXPR + + Get a regular expression that can be used with the regex + function to recognize a positive response to a yes/no + question. + + -- Data: 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. + + Note: The regular expressions for *note YESEXPR: 3d36. + and *note NOEXPR: 3d37. use syntax suitable for the + ‘regex’ function from the C library, which might differ + from the syntax used in *note re: b9. + + -- Data: locale.CRNCYSTR + + Get the currency symbol, preceded by “-” if the symbol should + appear before the value, “+” if the symbol should appear after + the value, or “.” if the symbol should replace the radix + character. + + -- Data: locale.ERA + + Get a string which describes how years are counted and + displayed for each era in a locale. + + Most locales do not define this value. An example of a locale + which does define this value is the Japanese one. In Japan, + the traditional representation of dates includes the name of + the era corresponding to the then-emperor’s reign. + + Normally it should not be necessary to use this value + directly. Specifying the ‘E’ modifier in their format strings + causes the *note time.strftime(): 11db. 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). + + -- Data: locale.ERA_D_T_FMT + + Get a format string for *note time.strftime(): 11db. to + represent date and time in a locale-specific era-based way. + + -- Data: locale.ERA_D_FMT + + Get a format string for *note time.strftime(): 11db. to + represent a date in a locale-specific era-based way. + + -- Data: locale.ERA_T_FMT + + Get a format string for *note time.strftime(): 11db. to + represent a time in a locale-specific era-based way. + + -- Data: 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. + + -- Function: locale.getdefaultlocale ([envvars]) + + Tries to determine the default locale settings and returns them as + a tuple of the form ‘(language code, encoding)’. + + According to POSIX, a program which has not called + ‘setlocale(LC_ALL, '')’ runs using the portable ‘'C'’ locale. + Calling ‘setlocale(LC_ALL, '')’ lets it use the default locale as + defined by the ‘LANG’ variable. Since we do not want to interfere + with the current locale setting we thus emulate the behavior in the + way described above. + + To maintain compatibility with other platforms, not only the ‘LANG’ + variable is tested, but a list of variables given as envvars + parameter. The first found to be defined will be used. 'envvars' + defaults to the search path used in GNU gettext; it must always + contain the variable name ‘'LANG'’. The GNU gettext search path + contains ‘'LC_ALL'’, ‘'LC_CTYPE'’, ‘'LANG'’ and ‘'LANGUAGE'’, in + that order. + + The language code has the same format as a *note locale name: 3d04, + but without encoding and ‘@’-modifier. The language code and + encoding may be ‘None’ if their values cannot be determined. The + “C” locale is represented as ‘(None, None)’. + + Deprecated since version 3.11, will be removed in version 3.15. + + -- Function: 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: 3d3e. It defaults to + *note LC_CTYPE: 3d3f. + + The language code has the same format as a *note locale name: 3d04, + 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)’. + + -- Function: locale.getpreferredencoding (do_setlocale=True) + + Return the *note locale encoding: 244. used for text data, + according to user preferences. User preferences are expressed + differently on different systems, and might not be available + programmatically on some systems, so this function only returns a + guess. + + On some systems, it is necessary to invoke *note setlocale(): 2df. + to obtain the user preferences, so this function is not + thread-safe. If invoking setlocale is not necessary or desired, + 'do_setlocale' should be set to ‘False’. + + On Android or if the *note Python UTF-8 Mode: 652. is enabled, + always return ‘'utf-8'’, the *note locale encoding: 244. and the + 'do_setlocale' argument are ignored. + + The *note Python preinitialization: 3d40. configures the LC_CTYPE + locale. See also the *note filesystem encoding and error handler: + 537. + + Changed in version 3.7: The function now always returns ‘"utf-8"’ + on Android or if the *note Python UTF-8 Mode: 652. is enabled. + + -- Function: locale.getencoding () + + Get the current *note locale encoding: 244.: + + * On Android and VxWorks, return ‘"utf-8"’. + + * On Unix, return the encoding of the current *note LC_CTYPE: + 3d3f. 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: 3d40. configures the LC_CTYPE + locale. See also the *note filesystem encoding and error handler: + 537. + + This function is similar to *note getpreferredencoding(False): 536. + except this function ignores the *note Python UTF-8 Mode: 652. + + Added in version 3.11. + + -- Function: locale.normalize (localename) + + Returns a normalized locale code for the given locale name. The + returned locale code is formatted for use with *note setlocale(): + 2df. If normalization fails, the original name is returned + unchanged. + + If the given encoding is not known, the function defaults to the + default encoding for the locale code just like *note setlocale(): + 2df. + + -- Function: locale.strcoll (string1, string2) + + Compares two strings according to the current *note LC_COLLATE: + 3d43. setting. As any other compare function, returns a negative, + or a positive value, or ‘0’, depending on whether 'string1' + collates before or after 'string2' or is equal to it. + + -- Function: locale.strxfrm (string) + + Transforms a string to one that can be used in locale-aware + comparisons. For example, ‘strxfrm(s1) < strxfrm(s2)’ is + equivalent to ‘strcoll(s1, s2) < 0’. This function can be used + when the same string is compared repeatedly, e.g. when collating a + sequence of strings. + + -- Function: locale.format_string (format, val, grouping=False, + monetary=False) + + Formats a number 'val' according to the current *note LC_NUMERIC: + 3d05. 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. + + If 'monetary' is true, the conversion uses monetary thousands + separator and grouping strings. + + Processes formatting specifiers as in ‘format % val’, but takes the + current locale settings into account. + + Changed in version 3.7: The 'monetary' keyword parameter was added. + + -- Function: locale.currency (val, symbol=True, grouping=False, + international=False) + + Formats a number 'val' according to the current *note LC_MONETARY: + 3d07. settings. + + The returned string includes the currency symbol if 'symbol' is + true, which is the default. If 'grouping' is ‘True’ (which is not + the default), grouping is done with the value. If 'international' + is ‘True’ (which is not the default), the international currency + symbol is used. + + Note: This function will not work with the ‘C’ locale, so you + have to set a locale via *note setlocale(): 2df. first. + + -- Function: 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. + + -- Function: locale.delocalize (string) + + Converts a string into a normalized number string, following the + *note LC_NUMERIC: 3d05. settings. + + Added in version 3.5. + + -- Function: locale.localize (string, grouping=False, monetary=False) + + Converts a normalized number string into a formatted string + following the *note LC_NUMERIC: 3d05. settings. + + Added in version 3.10. + + -- Function: locale.atof (string, func=float) + + Converts a string to a number, following the *note LC_NUMERIC: + 3d05. settings, by calling 'func' on the result of calling *note + delocalize(): e24. on 'string'. + + -- Function: locale.atoi (string) + + Converts a string to an integer, following the *note LC_NUMERIC: + 3d05. conventions. + + -- Data: 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, an internal + ‘pyctype.h’ provides locale-independent equivalents like + ‘Py_TOLOWER’. + + -- Data: locale.LC_COLLATE + + Locale category for sorting strings. The functions *note + strcoll(): 3d42. and *note strxfrm(): 3d44. of the *note locale: + 86. module are affected. + + -- Data: locale.LC_TIME + + Locale category for the formatting of time. The function *note + time.strftime(): 11db. follows these conventions. + + -- Data: locale.LC_MONETARY + + Locale category for formatting of monetary values. The available + options are available from the *note localeconv(): bfe. function. + + -- Data: locale.LC_MESSAGES + + Locale category for message display. Python currently does not + support application specific locale-aware messages. Messages + displayed by the operating system, like those returned by *note + os.strerror(): 2b2f. might be affected by this category. + + This value may not be available on operating systems not conforming + to the POSIX standard, most notably Windows. + + -- Data: locale.LC_NUMERIC + + Locale category for formatting numbers. The functions *note + format_string(): 51a, *note atoi(): 3d49, *note atof(): 3d48. and + *note str(): 3d46. of the *note locale: 86. module are affected by + that category. All other numeric formatting operations are not + affected. + + -- Data: locale.LC_ALL + + Combination of all locale settings. If this flag is used when the + locale is changed, setting the locale for all categories is + attempted. If that fails for any category, no category is changed + at all. When the locale is retrieved using this flag, a string + indicating the setting for all categories is returned. This string + can be later used to restore the settings. + + -- Data: locale.CHAR_MAX + + This is a symbolic constant used for different values returned by + *note localeconv(): bfe. + +Example: + + >>> import locale + >>> loc = locale.getlocale() # get current locale + # use German locale; name might vary with platform + >>> locale.setlocale(locale.LC_ALL, 'de_DE') + >>> 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 + +* Menu: + +* Background, details, hints, tips and caveats: Background details hints tips and caveats. +* Locale names:: +* For extension writers and programs that embed Python:: +* Access to message catalogs:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: Background details hints tips and caveats, Next: Locale names, Up: locale — Internationalization services + +5.24.2.1 Background, details, hints, tips and caveats +..................................................... + +The C standard defines the locale as a program-wide property that may be +relatively expensive to change. On top of that, some implementations +are broken in such a way that frequent locale changes may cause core +dumps. This makes the locale somewhat painful to use correctly. + +Initially, when a program is started, the locale is the ‘C’ locale, no +matter what the user’s preferred locale is. There is one exception: the +*note LC_CTYPE: 3d3f. category is changed at startup to set the current +locale encoding to the user’s preferred locale encoding. The program +must explicitly say that it wants the user’s preferred locale settings +for other categories by calling ‘setlocale(LC_ALL, '')’. + +It is generally a bad idea to call *note setlocale(): 2df. in some +library routine, since as a side effect it affects the entire program. +Saving and restoring it is almost as bad: it is expensive and affects +other threads that happen to run before the settings have been restored. + +If, when coding a module for general use, you need a locale independent +version of an operation that is affected by the locale (such as certain +formats used with *note time.strftime(): 11db.), you will have to find a +way to do it without using the standard library routine. Even better is +convincing yourself that using locale settings is okay. Only as a last +resort should you document that your module is not compatible with +non-‘C’ locale settings. + +The only way to perform numeric operations according to the locale is to +use the special functions defined by this module: *note atof(): 3d48, +*note atoi(): 3d49, *note format_string(): 51a, *note str(): 3d46. + +There is no way to perform case conversions and character +classifications according to the locale. For (Unicode) text strings +these are done according to the character value only, while for byte +strings, the conversions and classifications are done according to the +ASCII value of the byte, and bytes whose high bit is set (i.e., +non-ASCII bytes) are never converted or considered part of a character +class such as letter or whitespace. + + +File: python.info, Node: Locale names, Next: For extension writers and programs that embed Python, Prev: Background details hints tips and caveats, Up: locale — Internationalization services + +5.24.2.2 Locale names +..................... + +The format of the locale name is platform dependent, and the set of +supported locales can depend on the system configuration. + +On Posix platforms, it usually has the format (1): + + language ["_" territory] ["." charset] ["@" modifier] + +where 'language' is a two- or three-letter language code from ISO +639(2), 'territory' is a two-letter country or region code from ISO +3166(3), 'charset' is a locale encoding, and 'modifier' is a script +name, a language subtag, a sort order identifier, or other locale +modifier (for example, “latin”, “valencia”, “stroke” and “euro”). + +On Windows, several formats are supported. (4) (5) A subset of IETF +BCP 47(6) tags: + + language ["-" script] ["-" territory] ["." charset] + language ["-" script] "-" territory "-" modifier + +where 'language' and 'territory' have the same meaning as in Posix, +'script' is a four-letter script code from ISO 15924(7), and 'modifier' +is a language subtag, a sort order identifier or custom modifier (for +example, “valencia”, “stroke” or “x-python”). Both hyphen (‘'-'’) and +underscore (‘'_'’) separators are supported. Only UTF-8 encoding is +allowed for BCP 47 tags. + +Windows also supports locale names in the format: + + language ["_" territory] ["." charset] + +where 'language' and 'territory' are full names, such as “English” and +“United States”, and 'charset' is either a code page number (for +example, “1252”) or UTF-8. Only the underscore separator is supported +in this format. + +The “C” locale is supported on all platforms. + + ---------- Footnotes ---------- + + (1) IEEE Std 1003.1-2024; 8.2 Internationalization Variables +(https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap08.html#tag_08_02) + + (2) https://www.iso.org/iso-639-language-code + + (3) https://www.iso.org/iso-3166-country-codes.html + + (4) UCRT Locale names, Languages, and Country/Region strings +(https://learn.microsoft.com/en-us/cpp/c-runtime-library/locale-names-languages-and-country-region-strings) + + (5) Locale Names +(https://learn.microsoft.com/en-us/windows/win32/intl/locale-names) + + (6) https://www.rfc-editor.org/info/bcp47 + + (7) https://www.unicode.org/iso15924/ + + +File: python.info, Node: For extension writers and programs that embed Python, Next: Access to message catalogs, Prev: Locale names, Up: locale — Internationalization services + +5.24.2.3 For extension writers and programs that embed Python +............................................................. + +Extension modules should never call *note setlocale(): 2df, except to +find out what the current locale is. But since the return value can +only be used portably to restore it, that is not very useful (except +perhaps to find out whether or not the locale is ‘C’). + +When Python code uses the *note locale: 86. 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: Access to message catalogs, Prev: For extension writers and programs that embed Python, Up: locale — Internationalization services + +5.24.2.4 Access to message catalogs +................................... + + -- Function: locale.gettext (msg) + + -- Function: locale.dgettext (domain, msg) + + -- Function: locale.dcgettext (domain, msg, category) + + -- Function: locale.textdomain (domain) + + -- Function: locale.bindtextdomain (domain, dir) + + -- Function: locale.bind_textdomain_codeset (domain, codeset) + +The locale module exposes the C library’s gettext interface on systems +that provide this interface. It consists of the functions *note +gettext(): 63, *note dgettext(): 3d53, *note dcgettext(): 3d54, *note +textdomain(): 3d55, *note bindtextdomain(): 3d56, and *note +bind_textdomain_codeset(): 3d57. These are similar to the same +functions in the *note gettext: 63. module, but use the C library’s +binary format for message catalogs, and the C library’s search +algorithms for locating message catalogs. + +Python applications should normally find no need to invoke these +functions, and should use *note gettext: 63. 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: Program Frameworks, Next: Graphical User Interfaces with Tk, Prev: Internationalization, Up: The Python Standard Library + +5.25 Program Frameworks +======================= + +The modules described in this chapter are frameworks that will largely +dictate the structure of your program. Currently the modules described +here are all oriented toward writing command-line interfaces. + +The full list of modules described in this chapter is: + +* Menu: + +* turtle — Turtle graphics:: +* cmd — Support for line-oriented command interpreters:: +* shlex — Simple lexical analysis:: + + +File: python.info, Node: turtle — Turtle graphics, Next: cmd — Support for line-oriented command interpreters, Up: Program Frameworks + +5.25.1 ‘turtle’ — Turtle graphics +--------------------------------- + +'Source code:' Lib/turtle.py(1) + +__________________________________________________________________ + +* Menu: + +* Introduction: Introduction<11>. +* Get started:: +* Tutorial: Tutorial<4>. +* How to…:: +* Turtle graphics reference:: +* Methods of RawTurtle/Turtle and corresponding functions:: +* Methods of TurtleScreen/Screen and corresponding functions:: +* Public classes:: +* Explanation: Explanation<2>. +* Help and configuration:: +* turtledemo — Demo scripts:: +* Changes since Python 2.6: Changes since Python 2 6. +* Changes since Python 3.0: Changes since Python 3 0. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/turtle.py + + +File: python.info, Node: Introduction<11>, Next: Get started, Up: turtle — Turtle graphics + +5.25.1.1 Introduction +..................... + +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. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Turtle_(robot) + + +File: python.info, Node: Get started, Next: Tutorial<4>, Prev: Introduction<11>, Up: turtle — Turtle graphics + +5.25.1.2 Get started +.................... + +Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an +‘import turtle’, give it the command ‘turtle.forward(15)’, and it moves +(on-screen!) 15 pixels in the direction it is facing, drawing a line as +it moves. Give it the command ‘turtle.right(25)’, and it rotates +in-place 25 degrees clockwise. + +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: Tutorial<4>, Next: How to…, Prev: Get started, Up: turtle — Turtle graphics + +5.25.1.3 Tutorial +................. + +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: Tutorial<4> + +5.25.1.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: f0. on your system. + + +File: python.info, Node: Basic drawing, Next: Making algorithmic patterns, Prev: Starting a turtle environment, Up: Tutorial<4> + +5.25.1.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 control:: +* The turtle’s position:: + + +File: python.info, Node: Pen control, Next: The turtle’s position, Up: Basic drawing + +5.25.1.6 Pen control +.................... + +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 control, Up: Basic drawing + +5.25.1.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: Tutorial<4> + +5.25.1.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: Tutorial<4>, Up: turtle — Turtle graphics + +5.25.1.9 How to… +................ + +This section covers some typical turtle use-cases and approaches. + +* Menu: + +* Get started as quickly as possible:: +* 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: Use the turtle module namespace, Up: How to… + +5.25.1.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: 3d5f. 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(): 3d69. 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: f0. 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: Use the turtle module namespace, Next: Use turtle graphics in a script, Prev: Get started as quickly as possible, Up: How to… + +5.25.1.11 Use the ‘turtle’ module namespace +........................................... + +Using ‘from turtle import *’ is convenient - but be warned that it +imports a rather large collection of objects, and if you’re doing +anything but turtle graphics you run the risk of a name conflict (this +becomes even more an issue if you’re using turtle graphics in a script +where other modules might be imported). + +The solution is to use ‘import turtle’ - ‘fd()’ becomes ‘turtle.fd()’, +‘width()’ becomes ‘turtle.width()’ and so on. (If typing “turtle” over +and over again becomes tedious, use for example ‘import turtle as t’ +instead.) + + +File: python.info, Node: Use turtle graphics in a script, Next: Use object-oriented turtle graphics, Prev: Use the turtle module namespace, Up: How to… + +5.25.1.12 Use turtle graphics in a script +......................................... + +It’s recommended to use the ‘turtle’ module namespace as described +immediately above, for example: + + import turtle as t + from random import random + + for i in range(100): + steps = int(random() * 100) + angle = int(random() * 360) + t.right(angle) + t.fd(steps) + +Another step is also required though - as soon as the script ends, +Python will also close the turtle’s window. Add: + + t.mainloop() + +to the end of the script. The script will now wait to be dismissed and +will not exit until it is terminated, for example by closing the turtle +graphics window. + + +File: python.info, Node: Use object-oriented turtle graphics, Prev: Use turtle graphics in a script, Up: How to… + +5.25.1.13 Use object-oriented turtle graphics +............................................. + +See also +........ + +*note Explanation of the object-oriented interface: 3d6e. + +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: +3d6f. 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: Methods of RawTurtle/Turtle and corresponding functions, Prev: How to…, Up: turtle — Turtle graphics + +5.25.1.14 Turtle graphics reference +................................... + + Note: In the following documentation the argument list for + functions is given. Methods, of course, have the additional first + argument 'self' which is omitted here. + +* Menu: + +* Turtle methods:: +* Methods of TurtleScreen/Screen:: + + +File: python.info, Node: Turtle methods, Next: Methods of TurtleScreen/Screen, Up: Turtle graphics reference + +5.25.1.15 Turtle methods +........................ + +Turtle motion + + Move and draw + + *note forward(): 3d69. | *note fd(): 3d72. + *note backward(): 3d73. | *note bk(): 3d74. | *note back(): 3d75. + *note right(): 3d76. | *note rt(): 3d77. + *note left(): 3d78. | *note lt(): 3d79. + *note goto(): 3d7a. | *note setpos(): 3d7b. | *note setposition(): 3d7c. + *note teleport(): 1726. + *note setx(): 3d7d. + *note sety(): 3d7e. + *note setheading(): 3d7f. | *note seth(): 3d80. + *note home(): 3d81. + *note circle(): 3d82. + *note dot(): 3d83. + *note stamp(): 3d84. + *note clearstamp(): 3d85. + *note clearstamps(): 3d86. + *note undo(): 3d87. + *note speed(): 3d88. + + Tell Turtle’s state + + *note position(): 3d89. | *note pos(): 3d8a. + *note towards(): 3d8b. + *note xcor(): 3d8c. + *note ycor(): 3d8d. + *note heading(): 3d8e. + *note distance(): 3d8f. + + Setting and measurement + + *note degrees(): 3d90. + *note radians(): 3d91. + +Pen control + + Drawing state + + *note pendown(): 3d92. | *note pd(): 3d93. | *note down(): 3d94. + *note penup(): 3d95. | *note pu(): 3d96. | *note up(): 3d97. + *note pensize(): 3d98. | *note width(): 3d99. + *note pen(): 3d9a. + *note isdown(): 3d9b. + + Color control + + *note color(): 3d9c. + *note pencolor(): 3d9d. + *note fillcolor(): 3d9e. + + Filling + + *note filling(): 3d9f. + *note begin_fill(): 3da0. + *note end_fill(): 3da1. + + More drawing control + + *note reset(): 3da2. + *note clear(): 3da3. + *note write(): 3da4. + +Turtle state + + Visibility + + *note showturtle(): 3da5. | *note st(): 3da6. + *note hideturtle(): 3da7. | *note ht(): 3da8. + *note isvisible(): 3da9. + + Appearance + + *note shape(): 3daa. + *note resizemode(): 3dab. + *note shapesize(): 3dac. | *note turtlesize(): 3dad. + *note shearfactor(): 3dae. + *note tiltangle(): 720. + *note tilt(): 3daf. + *note shapetransform(): 3db0. + *note get_shapepoly(): 3db1. + +Using events + + *note onclick(): 3db2. + *note onrelease(): 3db3. + *note ondrag(): 3db4. + +Special Turtle methods + + *note begin_poly(): 3db5. + *note end_poly(): 3db6. + *note get_poly(): 3db7. + *note clone(): 3db8. + *note getturtle(): 3db9. | *note getpen(): 3dba. + *note getscreen(): 3dbb. + *note setundobuffer(): 3dbc. + *note undobufferentries(): 3dbd. + + +File: python.info, Node: Methods of TurtleScreen/Screen, Prev: Turtle methods, Up: Turtle graphics reference + +5.25.1.16 Methods of TurtleScreen/Screen +........................................ + +Window control + + *note bgcolor(): 3dbf. + *note bgpic(): 3dc0. + *note clearscreen(): 3dc1. + *note resetscreen(): 3dc2. + *note screensize(): 3dc3. + *note setworldcoordinates(): 3dc4. + +Animation control + + *note delay(): 3dc5. + *note tracer(): 3dc6. + *note update(): 3dc7. + +Using screen events + + *note listen(): 3dc8. + *note onkey(): 3dc9. | *note onkeyrelease(): 3dca. + *note onkeypress(): 3dcb. + *note onclick(): 3db2. | *note onscreenclick(): 3dcc. + *note ontimer(): 3dcd. + *note mainloop(): 3dce. | *note done(): 3dcf. + +Settings and special methods + + *note mode(): 3dd0. + *note colormode(): 3dd1. + *note getcanvas(): 3dd2. + *note getshapes(): 3dd3. + *note register_shape(): 3dd4. | *note addshape(): 3dd5. + *note turtles(): 3dd6. + *note window_height(): 3dd7. + *note window_width(): 3dd8. + +Input methods + + *note textinput(): 18c2. + *note numinput(): 18c3. + +Methods specific to Screen + + *note bye(): 3dd9. + *note exitonclick(): 3dda. + *note setup(): 3ddb. + *note title(): 3ddc. + + +File: python.info, Node: Methods of RawTurtle/Turtle and corresponding functions, Next: Methods of TurtleScreen/Screen and corresponding functions, Prev: Turtle graphics reference, Up: turtle — Turtle graphics + +5.25.1.17 Methods of RawTurtle/Turtle and corresponding functions +................................................................. + +Most of the examples in this section refer to a Turtle instance called +‘turtle’. + +* Menu: + +* Turtle motion:: +* Tell Turtle’s state:: +* Settings for measurement:: +* Pen control: Pen control<2>. +* Turtle state:: +* Using events:: +* Special Turtle methods:: +* Compound shapes:: + + +File: python.info, Node: Turtle motion, Next: Tell Turtle’s state, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.18 Turtle motion +....................... + + -- Function: turtle.forward (distance) + -- Function: turtle.fd (distance) + + + Parameters: ‘distance’ – a number (integer or float) + + Move the turtle forward by the specified 'distance', in the + direction the turtle is headed. + + >>> turtle.position() + (0.00,0.00) + >>> turtle.forward(25) + >>> turtle.position() + (25.00,0.00) + >>> turtle.forward(-75) + >>> turtle.position() + (-50.00,0.00) + + -- Function: turtle.back (distance) + -- Function: turtle.bk (distance) + -- Function: turtle.backward (distance) + + + Parameters: ‘distance’ – a number + + Move the turtle backward by 'distance', opposite to the direction + the turtle is headed. Do not change the turtle’s heading. + + >>> turtle.position() + (0.00,0.00) + >>> turtle.backward(30) + >>> turtle.position() + (-30.00,0.00) + + -- Function: turtle.right (angle) + -- Function: turtle.rt (angle) + + + Parameters: ‘angle’ – a number (integer or float) + + Turn turtle right by 'angle' units. (Units are by default degrees, + but can be set via the *note degrees(): 3d90. and *note radians(): + 3d91. functions.) Angle orientation depends on the turtle mode, + see *note mode(): 3dd0. + + >>> turtle.heading() + 22.0 + >>> turtle.right(45) + >>> turtle.heading() + 337.0 + + -- Function: turtle.left (angle) + -- Function: turtle.lt (angle) + + + Parameters: ‘angle’ – a number (integer or float) + + Turn turtle left by 'angle' units. (Units are by default degrees, + but can be set via the *note degrees(): 3d90. and *note radians(): + 3d91. functions.) Angle orientation depends on the turtle mode, + see *note mode(): 3dd0. + + >>> turtle.heading() + 22.0 + >>> turtle.left(45) + >>> turtle.heading() + 67.0 + + -- Function: turtle.goto (x, y=None) + -- Function: turtle.setpos (x, y=None) + -- Function: turtle.setposition (x, y=None) + + + Parameters: + + * ‘x’ – a number or a pair/vector of numbers + + * ‘y’ – a number or ‘None’ + + If 'y' is ‘None’, 'x' must be a pair of coordinates or a *note + Vec2D: 3ddf. (e.g. as returned by *note pos(): 3d8a.). + + Move turtle to an absolute position. If the pen is down, draw + line. Do not change the turtle’s orientation. + + >>> 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) + + -- Function: turtle.teleport (x, y=None, *, fill_gap=False) + + + Parameters: + + * ‘x’ – a number or ‘None’ + + * ‘y’ – a number or ‘None’ + + * ‘fill_gap’ – a boolean + + 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. + + -- Function: turtle.setx (x) + + + Parameters: ‘x’ – a number (integer or float) + + Set the turtle’s first coordinate to 'x', leave second coordinate + unchanged. + + >>> turtle.position() + (0.00,240.00) + >>> turtle.setx(10) + >>> turtle.position() + (10.00,240.00) + + -- Function: turtle.sety (y) + + + Parameters: ‘y’ – a number (integer or float) + + Set the turtle’s second coordinate to 'y', leave first coordinate + unchanged. + + >>> turtle.position() + (0.00,40.00) + >>> turtle.sety(-10) + >>> turtle.position() + (0.00,-10.00) + + -- Function: turtle.setheading (to_angle) + -- Function: turtle.seth (to_angle) + + + Parameters: ‘to_angle’ – a number (integer or float) + + Set the orientation of the turtle to 'to_angle'. Here are some + common directions in degrees: + + standard mode logo mode + + ------------------------------------------------- + + 0 - east 0 - north + + + 90 - north 90 - east + + + 180 - west 180 - south + + + 270 - south 270 - west + + + >>> turtle.setheading(90) + >>> turtle.heading() + 90.0 + + -- Function: turtle.home () + + Move turtle to the origin – coordinates (0,0) – and set its heading + to its start-orientation (which depends on the mode, see *note + mode(): 3dd0.). + + >>> turtle.heading() + 90.0 + >>> turtle.position() + (0.00,-10.00) + >>> turtle.home() + >>> turtle.position() + (0.00,0.00) + >>> turtle.heading() + 0.0 + + -- Function: turtle.circle (radius, extent=None, steps=None) + + + Parameters: + + * ‘radius’ – a number + + * ‘extent’ – a number (or ‘None’) + + * ‘steps’ – an integer (or ‘None’) + + Draw a circle with given 'radius'. The center is 'radius' units + left of the turtle; 'extent' – an angle – determines which part of + the circle is drawn. If 'extent' is not given, draw the entire + circle. If 'extent' is not a full circle, one endpoint of the arc + is the current pen position. Draw the arc in counterclockwise + direction if 'radius' is positive, otherwise in clockwise + direction. Finally the direction of the turtle is changed by the + amount of 'extent'. + + As the circle is approximated by an inscribed regular polygon, + 'steps' determines the number of steps to use. If not given, it + will be calculated automatically. May be used to draw regular + polygons. + + >>> 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 + + -- Function: turtle.dot (size=None, *color) + + + Parameters: + + * ‘size’ – an integer >= 1 (if given) + + * ‘color’ – a colorstring or a numeric color tuple + + 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 + + -- Function: turtle.stamp () + + Stamp a copy of the turtle shape onto the canvas at the current + turtle position. Return a stamp_id for that stamp, which can be + used to delete it by calling ‘clearstamp(stamp_id)’. + + >>> turtle.color("blue") + >>> stamp_id = turtle.stamp() + >>> turtle.fd(50) + + -- Function: turtle.clearstamp (stampid) + + + Parameters: ‘stampid’ – an integer, must be return value of + previous *note stamp(): 3d84. call + + Delete stamp with given '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) + + -- Function: turtle.clearstamps (n=None) + + + Parameters: ‘n’ – an integer (or ‘None’) + + Delete all or first/last 'n' of turtle’s stamps. If 'n' is ‘None’, + delete all stamps, if 'n' > 0 delete first 'n' stamps, else if 'n' + < 0 delete last 'n' stamps. + + >>> for i in range(8): + ... unused_stamp_id = turtle.stamp() + ... turtle.fd(30) + >>> turtle.clearstamps(2) + >>> turtle.clearstamps(-2) + >>> turtle.clearstamps() + + -- Function: turtle.undo () + + Undo (repeatedly) the last turtle action(s). Number of available + undo actions is determined by the size of the undobuffer. + + >>> for i in range(4): + ... turtle.fd(50); turtle.lt(80) + ... + >>> for i in range(8): + ... turtle.undo() + + -- Function: turtle.speed (speed=None) + + + Parameters: ‘speed’ – an integer in the range 0..10 or a + speedstring (see below) + + Set the turtle’s speed to an integer value in the range 0..10. If + no argument is given, return current speed. + + If input is a number greater than 10 or smaller than 0.5, speed is + set to 0. Speedstrings are mapped to speedvalues as follows: + + * “fastest”: 0 + + * “fast”: 10 + + * “normal”: 6 + + * “slow”: 3 + + * “slowest”: 1 + + Speeds from 1 to 10 enforce increasingly faster animation of line + drawing and turtle turning. + + Attention: 'speed' = 0 means that 'no' animation takes place. + forward/back makes turtle jump and likewise left/right make the + turtle turn instantly. + + >>> turtle.speed() + 3 + >>> turtle.speed('normal') + >>> turtle.speed() + 6 + >>> turtle.speed(9) + >>> turtle.speed() + 9 + + +File: python.info, Node: Tell Turtle’s state, Next: Settings for measurement, Prev: Turtle motion, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.19 Tell Turtle’s state +............................. + + -- Function: turtle.position () + -- Function: turtle.pos () + + Return the turtle’s current location (x,y) (as a *note Vec2D: 3ddf. + vector). + + >>> turtle.pos() + (440.00,-0.00) + + -- Function: turtle.towards (x, y=None) + + + Parameters: + + * ‘x’ – a number or a pair/vector of numbers or a turtle + instance + + * ‘y’ – a number if 'x' is a number, else ‘None’ + + Return the angle between the line from turtle position to position + specified by (x,y), the vector or the other turtle. This depends + on the turtle’s start orientation which depends on the mode - + “standard”/”world” or “logo”. + + >>> turtle.goto(10, 10) + >>> turtle.towards(0,0) + 225.0 + + -- Function: turtle.xcor () + + Return the turtle’s x coordinate. + + >>> turtle.home() + >>> turtle.left(50) + >>> turtle.forward(100) + >>> turtle.pos() + (64.28,76.60) + >>> print(round(turtle.xcor(), 5)) + 64.27876 + + -- Function: turtle.ycor () + + Return the turtle’s y coordinate. + + >>> turtle.home() + >>> turtle.left(60) + >>> turtle.forward(100) + >>> print(turtle.pos()) + (50.00,86.60) + >>> print(round(turtle.ycor(), 5)) + 86.60254 + + -- Function: turtle.heading () + + Return the turtle’s current heading (value depends on the turtle + mode, see *note mode(): 3dd0.). + + >>> turtle.home() + >>> turtle.left(67) + >>> turtle.heading() + 67.0 + + -- Function: turtle.distance (x, y=None) + + + Parameters: + + * ‘x’ – a number or a pair/vector of numbers or a turtle + instance + + * ‘y’ – a number if 'x' is a number, else ‘None’ + + Return the distance from the turtle to (x,y), the given vector, or + the given other turtle, in turtle step units. + + >>> 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: Settings for measurement, Next: Pen control<2>, Prev: Tell Turtle’s state, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.20 Settings for measurement +.................................. + + -- Function: turtle.degrees (fullcircle=360.0) + + + Parameters: ‘fullcircle’ – a number + + Set angle measurement units, i.e. set number of “degrees” for a + full circle. Default value is 360 degrees. + + >>> 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 + + -- Function: turtle.radians () + + Set the angle measurement units to radians. Equivalent to + ‘degrees(2*math.pi)’. + + >>> turtle.home() + >>> turtle.left(90) + >>> turtle.heading() + 90.0 + >>> turtle.radians() + >>> turtle.heading() + 1.5707963267948966 + + +File: python.info, Node: Pen control<2>, Next: Turtle state, Prev: Settings for measurement, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.21 Pen control +..................... + +* Menu: + +* Drawing state:: +* Color control:: +* Filling:: +* More drawing control:: + + +File: python.info, Node: Drawing state, Next: Color control, Up: Pen control<2> + +5.25.1.22 Drawing state +....................... + + -- Function: turtle.pendown () + -- Function: turtle.pd () + -- Function: turtle.down () + + Pull the pen down – drawing when moving. + + -- Function: turtle.penup () + -- Function: turtle.pu () + -- Function: turtle.up () + + Pull the pen up – no drawing when moving. + + -- Function: turtle.pensize (width=None) + -- Function: turtle.width (width=None) + + + Parameters: ‘width’ – a positive number + + Set the line thickness to 'width' or return it. If resizemode is + set to “auto” and turtleshape is a polygon, that polygon is drawn + with the same line thickness. If no argument is given, the current + pensize is returned. + + >>> turtle.pensize() + 1 + >>> turtle.pensize(10) # from here on lines of width 10 are drawn + + -- Function: turtle.pen (pen=None, **pendict) + + + Parameters: + + * ‘pen’ – a dictionary with some or all of the below listed keys + + * ‘pendict’ – one or more keyword-arguments with the below + listed keys as keywords + + Return or set the pen’s attributes in a “pen-dictionary” with the + following key/value pairs: + + * “shown”: True/False + + * “pendown”: True/False + + * “pencolor”: color-string or color-tuple + + * “fillcolor”: color-string or color-tuple + + * “pensize”: positive number + + * “speed”: number in range 0..10 + + * “resizemode”: “auto” or “user” or “noresize” + + * “stretchfactor”: (positive number, positive number) + + * “outline”: positive number + + * “tilt”: number + + This dictionary can be used as argument for a subsequent call to + *note pen(): 3d9a. to restore the former pen-state. Moreover one + or more of these attributes can be provided as keyword-arguments. + This can be used to set several pen attributes in one statement. + + >>> 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')] + + -- Function: turtle.isdown () + + Return ‘True’ if pen is down, ‘False’ if it’s up. + + >>> turtle.penup() + >>> turtle.isdown() + False + >>> turtle.pendown() + >>> turtle.isdown() + True + + +File: python.info, Node: Color control, Next: Filling, Prev: Drawing state, Up: Pen control<2> + +5.25.1.23 Color control +....................... + + -- Function: turtle.pencolor (*args) + + Return or set the pencolor. + + Four input formats are allowed: + + ‘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 call. + + ‘pencolor(colorstring)’ + + Set pencolor to 'colorstring', which is a Tk color + specification string, such as ‘"red"’, ‘"yellow"’, or + ‘"#33cc8c"’. + + ‘pencolor((r, g, b))’ + + Set pencolor 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(): 3dd1.). + + ‘pencolor(r, g, b)’ + + Set pencolor to the RGB color represented by 'r', 'g', and + 'b'. Each of 'r', 'g', and 'b' must be in the range + 0..colormode. + + If turtleshape is a polygon, the outline of that polygon is drawn + with the newly set pencolor. + + >>> 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) + + -- Function: turtle.fillcolor (*args) + + Return or set the fillcolor. + + Four input formats are allowed: + + ‘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 call. + + ‘fillcolor(colorstring)’ + + Set fillcolor to 'colorstring', which is a Tk color + specification string, such as ‘"red"’, ‘"yellow"’, or + ‘"#33cc8c"’. + + ‘fillcolor((r, g, b))’ + + Set fillcolor 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(): 3dd1.). + + ‘fillcolor(r, g, b)’ + + Set fillcolor to the RGB color represented by 'r', 'g', and + 'b'. Each of 'r', 'g', and 'b' must be in the range + 0..colormode. + + If turtleshape is a polygon, the interior of that polygon is drawn + with the newly set fillcolor. + + >>> 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) + + -- Function: turtle.color (*args) + + Return or set pencolor and fillcolor. + + Several input formats are allowed. They use 0 to 3 arguments as + follows: + + ‘color()’ + + Return the current pencolor and the current fillcolor as a + pair of color specification strings or tuples as returned by + *note pencolor(): 3d9d. and *note fillcolor(): 3d9e. + + ‘color(colorstring)’, ‘color((r,g,b))’, ‘color(r,g,b)’ + + Inputs as in *note pencolor(): 3d9d, set both, fillcolor and + pencolor, to the given value. + + ‘color(colorstring1, colorstring2)’, ‘color((r1,g1,b1), (r2,g2,b2))’ + + Equivalent to ‘pencolor(colorstring1)’ and + ‘fillcolor(colorstring2)’ and analogously if the other input + format is used. + + If turtleshape is a polygon, outline and interior of that polygon + is drawn with the newly set colors. + + >>> turtle.color("red", "green") + >>> turtle.color() + ('red', 'green') + >>> color("#285078", "#a0c8f0") + >>> color() + ((40.0, 80.0, 120.0), (160.0, 200.0, 240.0)) + +See also: Screen method *note colormode(): 3dd1. + + +File: python.info, Node: Filling, Next: More drawing control, Prev: Color control, Up: Pen control<2> + +5.25.1.24 Filling +................. + + -- Function: turtle.filling () + + Return fillstate (‘True’ if filling, ‘False’ else). + + >>> turtle.begin_fill() + >>> if turtle.filling(): + ... turtle.pensize(5) + ... else: + ... turtle.pensize(3) + + -- Function: turtle.begin_fill () + + To be called just before drawing a shape to be filled. + + -- Function: turtle.end_fill () + + Fill the shape drawn after the last call to *note begin_fill(): + 3da0. + + 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: More drawing control, Prev: Filling, Up: Pen control<2> + +5.25.1.25 More drawing control +.............................. + + -- Function: turtle.reset () + + Delete the turtle’s drawings from the screen, re-center the turtle + and set variables to the default values. + + >>> 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 + + -- Function: turtle.clear () + + Delete the turtle’s drawings from the screen. Do not move turtle. + State and position of the turtle as well as drawings of other + turtles are not affected. + + -- Function: turtle.write (arg, move=False, align='left', + font=('Arial', 8, 'normal')) + + + Parameters: + + * ‘arg’ – object to be written to the TurtleScreen + + * ‘move’ – True/False + + * ‘align’ – one of the strings “left”, “center” or right” + + * ‘font’ – a triple (fontname, fontsize, fonttype) + + Write text - the string representation of 'arg' - at the current + turtle position according to 'align' (“left”, “center” or “right”) + and with the given font. If 'move' is true, the pen is moved to + the bottom-right corner of the text. By default, 'move' is + ‘False’. + + >>> turtle.write("Home = ", True, align="center") + >>> turtle.write((0,0), True) + + +File: python.info, Node: Turtle state, Next: Using events, Prev: Pen control<2>, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.26 Turtle state +...................... + +* Menu: + +* Visibility:: +* Appearance:: + + +File: python.info, Node: Visibility, Next: Appearance, Up: Turtle state + +5.25.1.27 Visibility +.................... + + -- Function: turtle.hideturtle () + -- Function: turtle.ht () + + Make the turtle invisible. It’s a good idea to do this while + you’re in the middle of doing some complex drawing, because hiding + the turtle speeds up the drawing observably. + + >>> turtle.hideturtle() + + -- Function: turtle.showturtle () + -- Function: turtle.st () + + Make the turtle visible. + + >>> turtle.showturtle() + + -- Function: turtle.isvisible () + + Return ‘True’ if the Turtle is shown, ‘False’ if it’s hidden. + + >>> turtle.hideturtle() + >>> turtle.isvisible() + False + >>> turtle.showturtle() + >>> turtle.isvisible() + True + + +File: python.info, Node: Appearance, Prev: Visibility, Up: Turtle state + +5.25.1.28 Appearance +.................... + + -- Function: turtle.shape (name=None) + + + Parameters: ‘name’ – a string which is a valid shapename + + Set turtle shape to shape with given 'name' or, if name is not + given, return name of current shape. Shape with 'name' must exist + in the TurtleScreen’s shape dictionary. Initially there are the + following polygon shapes: “arrow”, “turtle”, “circle”, “square”, + “triangle”, “classic”. To learn about how to deal with shapes see + Screen method *note register_shape(): 3dd4. + + >>> turtle.shape() + 'classic' + >>> turtle.shape("turtle") + >>> turtle.shape() + 'turtle' + + -- Function: turtle.resizemode (rmode=None) + + + Parameters: ‘rmode’ – one of the strings “auto”, “user”, “noresize” + + Set resizemode to one of the values: “auto”, “user”, “noresize”. + If 'rmode' is not given, return current resizemode. Different + resizemodes have the following effects: + + - “auto”: adapts the appearance of the turtle corresponding to + the value of pensize. + + - “user”: adapts the appearance of the turtle according to the + values of stretchfactor and outlinewidth (outline), which are + set by *note shapesize(): 3dac. + + - “noresize”: no adaption of the turtle’s appearance takes + place. + + ‘resizemode("user")’ is called by *note shapesize(): 3dac. when + used with arguments. + + >>> turtle.resizemode() + 'noresize' + >>> turtle.resizemode("auto") + >>> turtle.resizemode() + 'auto' + + -- Function: turtle.shapesize (stretch_wid=None, stretch_len=None, + outline=None) + -- Function: turtle.turtlesize (stretch_wid=None, stretch_len=None, + outline=None) + + + Parameters: + + * ‘stretch_wid’ – positive number + + * ‘stretch_len’ – positive number + + * ‘outline’ – positive number + + Return or set the pen’s attributes x/y-stretchfactors and/or + outline. Set resizemode to “user”. If and only if resizemode is + set to “user”, the turtle will be displayed stretched according to + its stretchfactors: 'stretch_wid' is stretchfactor perpendicular to + its orientation, 'stretch_len' is stretchfactor in direction of its + orientation, 'outline' determines the width of the shape’s 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) + + -- Function: turtle.shearfactor (shear=None) + + + Parameters: ‘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 + + -- Function: turtle.tilt (angle) + + + Parameters: ‘angle’ – a number + + Rotate the turtleshape by 'angle' from its current tilt-angle, but + do 'not' change the turtle’s heading (direction of movement). + + >>> turtle.reset() + >>> turtle.shape("circle") + >>> turtle.shapesize(5,2) + >>> turtle.tilt(30) + >>> turtle.fd(50) + >>> turtle.tilt(30) + >>> turtle.fd(50) + + -- Function: turtle.tiltangle (angle=None) + + + Parameters: ‘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 + + -- Function: turtle.shapetransform (t11=None, t12=None, t21=None, + t22=None) + + + Parameters: + + * ‘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) + + -- Function: 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: Using events, Next: Special Turtle methods, Prev: Turtle state, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.29 Using events +...................... + + -- Function: turtle.onclick (fun, btn=1, add=None) + + + Parameters: + + * ‘fun’ – a function with two arguments which will be called + with the coordinates of the clicked point on the canvas + + * ‘btn’ – number of the mouse-button, defaults to 1 (left mouse + button) + + * ‘add’ – ‘True’ or ‘False’ – if ‘True’, a new binding will be + added, otherwise it will replace a former binding + + Bind 'fun' to mouse-click events on this turtle. If 'fun' is + ‘None’, existing bindings are removed. Example for the anonymous + turtle, i.e. the procedural way: + + >>> def turn(x, y): + ... left(180) + ... + >>> onclick(turn) # Now clicking into the turtle will turn it. + >>> onclick(None) # event-binding will be removed + + -- Function: turtle.onrelease (fun, btn=1, add=None) + + + Parameters: + + * ‘fun’ – a function with two arguments which will be called + with the coordinates of the clicked point on the canvas + + * ‘btn’ – number of the mouse-button, defaults to 1 (left mouse + button) + + * ‘add’ – ‘True’ or ‘False’ – if ‘True’, a new binding will be + added, otherwise it will replace a former binding + + Bind 'fun' to mouse-button-release events on this turtle. If 'fun' + is ‘None’, existing bindings are removed. + + >>> 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. + + -- Function: turtle.ondrag (fun, btn=1, add=None) + + + Parameters: + + * ‘fun’ – a function with two arguments which will be called + with the coordinates of the clicked point on the canvas + + * ‘btn’ – number of the mouse-button, defaults to 1 (left mouse + button) + + * ‘add’ – ‘True’ or ‘False’ – if ‘True’, a new binding will be + added, otherwise it will replace a former binding + + Bind 'fun' to mouse-move events on this turtle. If 'fun' is + ‘None’, existing bindings are removed. + + Remark: Every sequence of mouse-move-events on a turtle is preceded + by a mouse-click event on that turtle. + + >>> turtle.ondrag(turtle.goto) + + Subsequently, clicking and dragging the Turtle will move it across + the screen thereby producing handdrawings (if pen is down). + + +File: python.info, Node: Special Turtle methods, Next: Compound shapes, Prev: Using events, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.30 Special Turtle methods +................................ + + -- Function: turtle.begin_poly () + + Start recording the vertices of a polygon. Current turtle position + is first vertex of polygon. + + -- Function: turtle.end_poly () + + Stop recording the vertices of a polygon. Current turtle position + is last vertex of polygon. This will be connected with the first + vertex. + + -- Function: turtle.get_poly () + + Return the last recorded polygon. + + >>> 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) + + -- Function: turtle.clone () + + Create and return a clone of the turtle with same position, heading + and turtle properties. + + >>> mick = Turtle() + >>> joe = mick.clone() + + -- Function: turtle.getturtle () + -- Function: turtle.getpen () + + Return the Turtle object itself. Only reasonable use: as a + function to return the “anonymous turtle”: + + >>> pet = getturtle() + >>> pet.fd(50) + >>> pet + + + -- Function: turtle.getscreen () + + Return the *note TurtleScreen: 3dec. object the turtle is drawing + on. TurtleScreen methods can then be called for that object. + + >>> ts = turtle.getscreen() + >>> ts + + >>> ts.bgcolor("pink") + + -- Function: turtle.setundobuffer (size) + + + Parameters: ‘size’ – an integer or ‘None’ + + Set or disable undobuffer. If 'size' is an integer, an empty + undobuffer of given size is installed. 'size' gives the maximum + number of turtle actions that can be undone by the *note undo(): + 3d87. method/function. If 'size' is ‘None’, the undobuffer is + disabled. + + >>> turtle.setundobuffer(42) + + -- Function: turtle.undobufferentries () + + Return number of entries in the undobuffer. + + >>> while undobufferentries(): + ... undo() + + +File: python.info, Node: Compound shapes, Prev: Special Turtle methods, Up: Methods of RawTurtle/Turtle and corresponding functions + +5.25.1.31 Compound shapes +......................... + +To use compound turtle shapes, which consist of several polygons of +different color, you must use the helper class *note Shape: 3def. +explicitly as described below: + + 1. Create an empty Shape object of type “compound”. + + 2. Add as many components to this object as desired, using the *note + addcomponent(): 3df0. method. + + For example: + + >>> 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. Now add the Shape to the Screen’s shapelist and use it: + + >>> register_shape("myshape", s) + >>> shape("myshape") + + Note: The *note Shape: 3def. class is used internally by the *note + register_shape(): 3dd4. method in different ways. The application + programmer has to deal with the Shape class 'only' when using + compound shapes like shown above! + + +File: python.info, Node: Methods of TurtleScreen/Screen and corresponding functions, Next: Public classes, Prev: Methods of RawTurtle/Turtle and corresponding functions, Up: turtle — Turtle graphics + +5.25.1.32 Methods of TurtleScreen/Screen and corresponding functions +.................................................................... + +Most of the examples in this section refer to a TurtleScreen instance +called ‘screen’. + +* Menu: + +* Window control:: +* Animation control:: +* Using screen events:: +* Input methods:: +* Settings and special methods:: +* Methods specific to Screen, not inherited from TurtleScreen: Methods specific to Screen not inherited from TurtleScreen. + + +File: python.info, Node: Window control, Next: Animation control, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.33 Window control +........................ + + -- Function: turtle.bgcolor (*args) + + + Parameters: ‘args’ – a color string or three numbers in the range + 0..colormode or a 3-tuple of such numbers + + Set or return background color of the TurtleScreen. + + >>> screen.bgcolor("orange") + >>> screen.bgcolor() + 'orange' + >>> screen.bgcolor("#800080") + >>> screen.bgcolor() + (128.0, 0.0, 128.0) + + -- Function: turtle.bgpic (picname=None) + + + Parameters: ‘picname’ – a string, name of a gif-file or ‘"nopic"’, + or ‘None’ + + Set background image or return name of current backgroundimage. If + 'picname' is a filename, set the corresponding image as background. + If 'picname' is ‘"nopic"’, delete background image, if present. If + 'picname' is ‘None’, return the filename of the current + backgroundimage. + + >>> screen.bgpic() + 'nopic' + >>> screen.bgpic("landscape.gif") + >>> screen.bgpic() + "landscape.gif" + + -- Function: turtle.clear () + + Note: This TurtleScreen method is available as a global + function only under the name ‘clearscreen’. The global + function ‘clear’ is a different one derived from the Turtle + method ‘clear’. + + -- Function: turtle.clearscreen () + + Delete all drawings and all turtles from the TurtleScreen. Reset + the now empty TurtleScreen to its initial state: white background, + no background image, no event bindings and tracing on. + + -- Function: turtle.reset () + + Note: This TurtleScreen method is available as a global + function only under the name ‘resetscreen’. The global + function ‘reset’ is another one derived from the Turtle method + ‘reset’. + + -- Function: turtle.resetscreen () + + Reset all Turtles on the Screen to their initial state. + + -- Function: turtle.screensize (canvwidth=None, canvheight=None, + bg=None) + + + Parameters: + + * ‘canvwidth’ – positive integer, new width of canvas in pixels + + * ‘canvheight’ – positive integer, new height of canvas in + pixels + + * ‘bg’ – colorstring or color-tuple, new background color + + If no arguments are given, return current (canvaswidth, + canvasheight). Else resize the canvas the turtles are drawing on. + Do not alter the drawing window. To observe hidden parts of the + canvas, use the scrollbars. With this method, one can make visible + those parts of a drawing which were outside the canvas before. + + >>> screen.screensize() + (400, 300) + >>> screen.screensize(2000,1500) + >>> screen.screensize() + (2000, 1500) + + e.g. to search for an erroneously escaped turtle ;-) + + -- Function: turtle.setworldcoordinates (llx, lly, urx, ury) + + + Parameters: + + * ‘llx’ – a number, x-coordinate of lower left corner of canvas + + * ‘lly’ – a number, y-coordinate of lower left corner of canvas + + * ‘urx’ – a number, x-coordinate of upper right corner of canvas + + * ‘ury’ – a number, y-coordinate of upper right corner of canvas + + Set up user-defined coordinate system and switch to mode “world” if + necessary. This performs a ‘screen.reset()’. If mode “world” is + already active, all drawings are redrawn according to the new + coordinates. + + 'ATTENTION': in user-defined coordinate systems angles may appear + distorted. + + >>> 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: Animation control, Next: Using screen events, Prev: Window control, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.34 Animation control +........................... + + -- Function: turtle.delay (delay=None) + + + Parameters: ‘delay’ – positive integer + + Set or return the drawing 'delay' in milliseconds. (This is + approximately the time interval between two consecutive canvas + updates.) The longer the drawing delay, the slower the animation. + + Optional argument: + + >>> screen.delay() + 10 + >>> screen.delay(5) + >>> screen.delay() + 5 + + -- Function: turtle.tracer (n=None, delay=None) + + + Parameters: + + * ‘n’ – nonnegative integer + + * ‘delay’ – nonnegative integer + + Turn turtle animation on/off and set delay for update drawings. If + 'n' is given, only each n-th regular screen update is really + performed. (Can be used to accelerate the drawing of complex + graphics.) When called without arguments, returns the currently + stored value of n. Second argument sets delay value (see *note + delay(): 3dc5.). + + >>> screen.tracer(8, 25) + >>> dist = 2 + >>> for i in range(200): + ... fd(dist) + ... rt(90) + ... dist += 2 + + -- Function: turtle.update () + + Perform a TurtleScreen update. To be used when tracer is turned + off. + +See also the RawTurtle/Turtle method *note speed(): 3d88. + + +File: python.info, Node: Using screen events, Next: Input methods, Prev: Animation control, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.35 Using screen events +............................. + + -- Function: turtle.listen (xdummy=None, ydummy=None) + + Set focus on TurtleScreen (in order to collect key-events). Dummy + arguments are provided in order to be able to pass *note listen(): + 3dc8. to the onclick method. + + -- Function: turtle.onkey (fun, key) + -- Function: turtle.onkeyrelease (fun, key) + + + Parameters: + + * ‘fun’ – a function with no arguments or ‘None’ + + * ‘key’ – a string: key (e.g. “a”) or key-symbol (e.g. + “space”) + + Bind 'fun' to key-release event of key. If 'fun' is ‘None’, event + bindings are removed. Remark: in order to be able to register + key-events, TurtleScreen must have the focus. (See method *note + listen(): 3dc8.) + + >>> def f(): + ... fd(50) + ... lt(60) + ... + >>> screen.onkey(f, "Up") + >>> screen.listen() + + -- Function: turtle.onkeypress (fun, key=None) + + + Parameters: + + * ‘fun’ – a function with no arguments or ‘None’ + + * ‘key’ – a string: key (e.g. “a”) or key-symbol (e.g. + “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(): 3dc8.) + + >>> def f(): + ... fd(50) + ... + >>> screen.onkey(f, "Up") + >>> screen.listen() + + -- Function: turtle.onclick (fun, btn=1, add=None) + -- Function: turtle.onscreenclick (fun, btn=1, add=None) + + + Parameters: + + * ‘fun’ – a function with two arguments which will be called + with the coordinates of the clicked point on the canvas + + * ‘btn’ – number of the mouse-button, defaults to 1 (left mouse + button) + + * ‘add’ – ‘True’ or ‘False’ – if ‘True’, a new binding will be + added, otherwise it will replace a former binding + + Bind 'fun' to mouse-click events on this screen. If 'fun' is + ‘None’, existing bindings are removed. + + Example for a TurtleScreen instance named ‘screen’ and a Turtle + instance named ‘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 + + Note: This TurtleScreen method is available as a global + function only under the name ‘onscreenclick’. The global + function ‘onclick’ is another one derived from the Turtle + method ‘onclick’. + + -- Function: turtle.ontimer (fun, t=0) + + + Parameters: + + * ‘fun’ – a function with no arguments + + * ‘t’ – a number >= 0 + + Install a timer that calls 'fun' after 't' milliseconds. + + >>> running = True + >>> def f(): + ... if running: + ... fd(50) + ... lt(60) + ... screen.ontimer(f, 250) + >>> f() ### makes the turtle march around + >>> running = False + + -- Function: turtle.mainloop () + -- Function: 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: Input methods, Next: Settings and special methods, Prev: Using screen events, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.36 Input methods +....................... + + -- Function: turtle.textinput (title, prompt) + + + Parameters: + + * ‘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:") + + -- Function: turtle.numinput (title, prompt, default=None, minval=None, + maxval=None) + + + Parameters: + + * ‘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: Settings and special methods, Next: Methods specific to Screen not inherited from TurtleScreen, Prev: Input methods, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.37 Settings and special methods +...................................... + + -- Function: turtle.mode (mode=None) + + + Parameters: ‘mode’ – one of the strings “standard”, “logo” or + “world” + + Set turtle mode (“standard”, “logo” or “world”) and perform reset. + If mode is not given, current mode is returned. + + Mode “standard” is compatible with old *note turtle: 101. 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. + + Mode Initial turtle heading positive angles + + ----------------------------------------------------------------------- + + “standard” to the right (east) counterclockwise + + + “logo” upward (north) clockwise + + + >>> mode("logo") # resets turtle heading to north + >>> mode() + 'logo' + + -- Function: turtle.colormode (cmode=None) + + + Parameters: ‘cmode’ – one of the values 1.0 or 255 + + Return the colormode or set it to 1.0 or 255. Subsequently 'r', + 'g', 'b' values of color triples have to be in the range + 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) + + -- Function: turtle.getcanvas () + + Return the Canvas of this TurtleScreen. Useful for insiders who + know what to do with a Tkinter Canvas. + + >>> cv = screen.getcanvas() + >>> cv + + + -- Function: turtle.getshapes () + + Return a list of names of all currently available turtle shapes. + + >>> screen.getshapes() + ['arrow', 'blank', 'circle', ..., 'turtle'] + + -- Function: turtle.register_shape (name, shape=None) + -- Function: turtle.addshape (name, shape=None) + + There are three different ways to call this function: + + 1. 'name' is the name of a gif-file and 'shape' is ‘None’: + Install the corresponding image shape. + + >>> screen.register_shape("turtle.gif") + + Note: Image shapes 'do not' rotate when turning the + turtle, so they do not display the heading of the turtle! + + 2. 'name' is an arbitrary string and 'shape' is a tuple of pairs + of coordinates: Install the corresponding polygon shape. + + >>> screen.register_shape("triangle", ((5,-3), (0,5), (-5,-3))) + + 3. 'name' is an arbitrary string and 'shape' is a (compound) + *note Shape: 3def. object: Install the corresponding compound + shape. + + Add a turtle shape to TurtleScreen’s shapelist. Only thusly + registered shapes can be used by issuing the command + ‘shape(shapename)’. + + -- Function: turtle.turtles () + + Return the list of turtles on the screen. + + >>> for turtle in screen.turtles(): + ... turtle.color("red") + + -- Function: turtle.window_height () + + Return the height of the turtle window. + + >>> screen.window_height() + 480 + + -- Function: turtle.window_width () + + Return the width of the turtle window. + + >>> screen.window_width() + 640 + + +File: python.info, Node: Methods specific to Screen not inherited from TurtleScreen, Prev: Settings and special methods, Up: Methods of TurtleScreen/Screen and corresponding functions + +5.25.1.38 Methods specific to Screen, not inherited from TurtleScreen +..................................................................... + + -- Function: turtle.bye () + + Shut the turtlegraphics window. + + -- Function: turtle.exitonclick () + + Bind ‘bye()’ method to mouse clicks on the Screen. + + If the value “using_IDLE” in the configuration dictionary is + ‘False’ (default value), also enter mainloop. Remark: If IDLE with + the ‘-n’ switch (no subprocess) is used, this value should be set + to ‘True’ in ‘turtle.cfg’. In this case IDLE’s own mainloop is + active also for the client script. + + -- Function: turtle.setup (width=_CFG['width'], height=_CFG['height'], + startx=_CFG['leftright'], starty=_CFG['topbottom']) + + Set the size and position of the main window. Default values of + arguments are stored in the configuration dictionary and can be + changed via a ‘turtle.cfg’ file. + + + Parameters: + + * ‘width’ – if an integer, a size in pixels, if a float, a + fraction of the screen; default is 50% of screen + + * ‘height’ – if an integer, the height in pixels, if a float, a + fraction of the screen; default is 75% of screen + + * ‘startx’ – if positive, starting position in pixels from the + left edge of the screen, if negative from the right edge, if + ‘None’, center window horizontally + + * ‘starty’ – if positive, starting position in pixels from the + top edge of the screen, if negative from the bottom edge, if + ‘None’, center window vertically + + >>> 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 + + -- Function: turtle.title (titlestring) + + + Parameters: ‘titlestring’ – a string that is shown in the titlebar + of the turtle graphics window + + Set title of turtle window to 'titlestring'. + + >>> screen.title("Welcome to the turtle zoo!") + + +File: python.info, Node: Public classes, Next: Explanation<2>, Prev: Methods of TurtleScreen/Screen and corresponding functions, Up: turtle — Turtle graphics + +5.25.1.39 Public classes +........................ + + -- Class: turtle.RawTurtle (canvas) + -- Class: turtle.RawPen (canvas) + + + Parameters: ‘canvas’ – a ‘tkinter.Canvas’, a *note ScrolledCanvas: + 3dfc. or a *note TurtleScreen: 3dec. + + Create a turtle. The turtle has all methods described above as + “methods of Turtle/RawTurtle”. + + -- Class: turtle.Turtle + + Subclass of RawTurtle, has the same interface but draws on a + default *note Screen: 3d6f. object created automatically when + needed for the first time. + + -- Class: turtle.TurtleScreen (cv) + + + Parameters: ‘cv’ – a ‘tkinter.Canvas’ + + Provides screen oriented methods like *note bgcolor(): 3dbf. etc. + that are described above. + + -- Class: turtle.Screen + + Subclass of TurtleScreen, with *note four methods added: 3df8. + + -- Class: turtle.ScrolledCanvas (master) + + + Parameters: ‘master’ – some Tkinter widget to contain the + ScrolledCanvas, i.e. a Tkinter-canvas with scrollbars added + + Used by class Screen, which thus automatically provides a + ScrolledCanvas as playground for the turtles. + + -- Class: turtle.Shape (type_, data) + + + Parameters: ‘type_’ – one of the strings “polygon”, “image”, + “compound” + + Data structure modeling shapes. The pair ‘(type_, data)’ must + follow this specification: + + 'type_' 'data' + + ------------------------------------------------------------------------------- + + “polygon” a polygon-tuple, i.e. a tuple of pairs of coordinates + + + “image” an image (in this form only used internally!) + + + “compound” ‘None’ (a compound shape has to be constructed using the + *note addcomponent(): 3df0. method) + + + -- Method: addcomponent (poly, fill, outline=None) + + + Parameters: + + * ‘poly’ – a polygon, i.e. a tuple of pairs of numbers + + * ‘fill’ – a color the 'poly' will be filled with + + * ‘outline’ – a color for the poly’s outline (if given) + + Example: + + >>> 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() + + See *note Compound shapes: 3dee. + + -- Class: turtle.Vec2D (x, y) + + A two-dimensional vector class, used as a helper class for + implementing turtle graphics. May be useful for turtle graphics + programs too. Derived from tuple, so a vector is a tuple! + + Provides (for 'a', 'b' vectors, 'k' number): + + * ‘a + b’ vector addition + + * ‘a - b’ vector subtraction + + * ‘a * b’ inner product + + * ‘k * a’ and ‘a * k’ multiplication with scalar + + * ‘abs(a)’ absolute value of a + + * ‘a.rotate(angle)’ rotation + + +File: python.info, Node: Explanation<2>, Next: Help and configuration, Prev: Public classes, Up: turtle — Turtle graphics + +5.25.1.40 Explanation +..................... + +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: 3dfd. instance will automatically create a *note Screen: +3d6f. instance if one is not already present. + +‘Turtle’ is a subclass of *note RawTurtle: 3dfa, 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: 3dfc. or *note TurtleScreen: 3dec. + +*note TurtleScreen: 3dec. is the basic drawing surface for a turtle. +*note Screen: 3d6f. is a subclass of ‘TurtleScreen’, and includes *note +some additional methods: 3df8. for managing its appearance (including +size and title) and behaviour. ‘TurtleScreen’’s constructor needs a +‘tkinter.Canvas’ or a *note ScrolledCanvas: 3dfc. 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: Help and configuration, Next: turtledemo — Demo scripts, Prev: Explanation<2>, Up: turtle — Turtle graphics + +5.25.1.41 Help and configuration +................................ + +* Menu: + +* How to use help:: +* Translation of docstrings into different languages:: +* How to configure Screen and Turtles:: + + +File: python.info, Node: How to use help, Next: Translation of docstrings into different languages, Up: Help and configuration + +5.25.1.42 How to use help +......................... + +The public methods of the Screen and Turtle classes are documented +extensively via docstrings. So these can be used as online-help via the +Python help facilities: + + - When using IDLE, tooltips show the signatures and first lines of + the docstrings of typed in function-/method calls. + + - Calling *note help(): 8d6. on methods or functions displays the + docstrings: + + >>> 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() + + - The docstrings of the functions which are derived from methods have + a modified form: + + >>> 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() + +These modified docstrings are created automatically together with the +function definitions that are derived from the methods at import time. + + +File: python.info, Node: Translation of docstrings into different languages, Next: How to configure Screen and Turtles, Prev: How to use help, Up: Help and configuration + +5.25.1.43 Translation of docstrings into different languages +............................................................ + +There is a utility to create a dictionary the keys of which are the +method names and the values of which are the docstrings of the public +methods of the classes Screen and Turtle. + + -- Function: turtle.write_docstringdict + (filename='turtle_docstringdict') + + + Parameters: ‘filename’ – a string, used as filename + + Create and write docstring-dictionary to a Python script with the + given filename. This function has to be called explicitly (it is + not used by the turtle graphics classes). The docstring dictionary + will be written to the Python script ‘`filename'.py’. It is + intended to serve as a template for translation of the docstrings + into different languages. + +If you (or your students) want to use *note turtle: 101. 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’. + +If you have an appropriate entry in your ‘turtle.cfg’ file this +dictionary will be read in at import time and will replace the original +English docstrings. + +At the time of this writing there are docstring dictionaries in German +and in Italian. (Requests please to .) + + +File: python.info, Node: How to configure Screen and Turtles, Prev: Translation of docstrings into different languages, Up: Help and configuration + +5.25.1.44 How to configure Screen and Turtles +............................................. + +The built-in default configuration mimics the appearance and behaviour +of the old turtle module in order to retain best possible compatibility +with it. + +If you want to use a different configuration which better reflects the +features of this module or which better fits to your needs, e.g. for +use in a classroom, you can prepare a configuration file ‘turtle.cfg’ +which will be read at import time and modify the configuration according +to its settings. + +The built in configuration would correspond to the following +‘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 + +Short explanation of selected entries: + + - The first four lines correspond to the arguments of the *note + Screen.setup: 3ddb. method. + + - Line 5 and 6 correspond to the arguments of the method *note + Screen.screensize: 3dc3. + + - 'shape' can be any of the built-in shapes, e.g: arrow, turtle, etc. + For more info try ‘help(shape)’. + + - If you want to use no fill color (i.e. make the turtle + transparent), you have to write ‘fillcolor = ""’ (but all nonempty + strings must not have quotes in the cfg file). + + - If you want to reflect the turtle its state, you have to use + ‘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 *note + turtle: 101.). + + - The entries 'exampleturtle' and 'examplescreen' define the names of + these objects as they occur in the docstrings. The transformation + of method-docstrings to function-docstrings will delete these names + from the docstrings. + + - 'using_IDLE': Set this to ‘True’ if you regularly work with IDLE + and its ‘-n’ switch (“no subprocess”). This will prevent *note + exitonclick(): 3dda. to enter the mainloop. + +There can be a ‘turtle.cfg’ file in the directory where *note turtle: +101. is stored and an additional one in the current working directory. +The latter will override the settings of the first one. + +The ‘Lib/turtledemo’ directory contains a ‘turtle.cfg’ file. You can +study it as an example and see its effects when running the demos +(preferably not from within the demo-viewer). + + +File: python.info, Node: turtledemo — Demo scripts, Next: Changes since Python 2 6, Prev: Help and configuration, Up: turtle — Turtle graphics + +5.25.1.45 ‘turtledemo’ — Demo scripts +..................................... + +The *note turtledemo: 102. package includes a set of demo scripts. +These scripts can be run and viewed using the supplied demo viewer as +follows: + + python -m turtledemo + +Alternatively, you can run the demo scripts individually. For example, + + python -m turtledemo.bytedesign + +The *note turtledemo: 102. package directory contains: + + - A demo viewer ‘__main__.py’ which can be used to view the + sourcecode of the scripts and run them at the same time. + + - Multiple scripts demonstrating different features of the *note + turtle: 101. module. Examples can be accessed via the Examples + menu. They can also be run standalone. + + - A ‘turtle.cfg’ file which serves as an example of how to write and + use such files. + +The demo scripts are: + +Name Description Features + +------------------------------------------------------------------------------------ + +bytedesign complex classical turtle *note tracer(): 3dc6, + graphics pattern delay, + *note update(): 3dc7. + + +chaos graphs Verhulst dynamics, shows world coordinates + that computer’s computations can + generate results sometimes + against the common sense + expectations + + +clock analog clock showing time of turtles as clock’s hands, + your computer ontimer + + +colormixer experiment with r, g, b *note ondrag(): 3db4. + + +forest 3 breadth-first trees randomization + + +fractalcurves Hilbert & Koch curves recursion + + +lindenmayer ethnomathematics (indian kolams) L-System + + +minimal_hanoi Towers of Hanoi Rectangular Turtles as + Hanoi discs (shape, + shapesize) + + +nim play the classical nim game with turtles as nimsticks, + three heaps of sticks against event driven (mouse, + the computer. keyboard) + + +paint super minimalistic drawing *note onclick(): 3db2. + program + + +peace elementary turtle: appearance and + animation + + +penrose aperiodic tiling with kites and *note stamp(): 3d84. + darts + + +planet_and_moon simulation of gravitational compound shapes, + system *note Vec2D: 3ddf. + + +rosette a pattern from the wikipedia *note clone(): 3db8, + article on turtle graphics *note undo(): 3d87. + + +round_dance dancing turtles rotating compound shapes, clone + pairwise in opposite direction shapesize, tilt, + get_shapepoly, update + + +sorting_animate visual demonstration of simple alignment, + different sorting methods randomization + + +tree a (graphical) breadth first tree *note clone(): 3db8. + (using generators) + + +two_canvases simple design turtles on two canvases + + +yinyang another elementary example *note circle(): 3d82. + + +Have fun! + + +File: python.info, Node: Changes since Python 2 6, Next: Changes since Python 3 0, Prev: turtledemo — Demo scripts, Up: turtle — Turtle graphics + +5.25.1.46 Changes since Python 2.6 +.................................. + + - The methods *note Turtle.tracer: 3dc6, *note Turtle.window_width: + 3dd8. and *note Turtle.window_height: 3dd7. have been eliminated. + Methods with these names and functionality are now available only + as methods of *note Screen: 3d6f. The functions derived from these + remain available. (In fact already in Python 2.6 these methods + were merely duplications of the corresponding *note TurtleScreen: + 3dec./*note Screen: 3d6f. methods.) + + - The method ‘Turtle.fill()’ has been eliminated. The behaviour of + *note begin_fill(): 3da0. and *note end_fill(): 3da1. have changed + slightly: now every filling process must be completed with an + ‘end_fill()’ call. + + - A method *note Turtle.filling: 3d9f. 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: Changes since Python 3 0, Prev: Changes since Python 2 6, Up: turtle — Turtle graphics + +5.25.1.47 Changes since Python 3.0 +.................................. + + - The *note Turtle: 3dfd. methods *note shearfactor(): 3dae, *note + shapetransform(): 3db0. and *note get_shapepoly(): 3db1. have been + added. Thus the full range of regular linear transforms is now + available for transforming turtle shapes. *note tiltangle(): 720. + has been enhanced in functionality: it now can be used to get or + set the tilt angle. + + - The *note Screen: 3d6f. method *note onkeypress(): 3dcb. has been + added as a complement to *note onkey(): 3dc9. As the latter binds + actions to the key release event, an alias: *note onkeyrelease(): + 3dca. was also added for it. + + - The method *note Screen.mainloop: 3dce. has been added, so there is + no longer a need to use the standalone *note mainloop(): 3dce. + function when working with *note Screen: 3d6f. and *note Turtle: + 3dfd. objects. + + - Two input methods have been added: *note Screen.textinput: 18c2. + and *note Screen.numinput: 18c3. These pop up input dialogs and + return strings and numbers respectively. + + - Two example scripts ‘tdemo_nim.py’ and ‘tdemo_round_dance.py’ have + been added to the ‘Lib/turtledemo’ directory. + + +File: python.info, Node: cmd — Support for line-oriented command interpreters, Next: shlex — Simple lexical analysis, Prev: turtle — Turtle graphics, Up: Program Frameworks + +5.25.2 ‘cmd’ — Support for line-oriented command interpreters +------------------------------------------------------------- + +'Source code:' Lib/cmd.py(1) + +__________________________________________________________________ + +The *note Cmd: 16c5. class provides a simple framework for writing +line-oriented command interpreters. These are often useful for test +harnesses, administrative tools, and prototypes that will later be +wrapped in a more sophisticated interface. + + -- Class: cmd.Cmd (completekey='tab', stdin=None, stdout=None) + + A *note Cmd: 16c5. instance or subclass instance is a line-oriented + interpreter framework. There is no good reason to instantiate + *note Cmd: 16c5. itself; rather, it’s useful as a superclass of an + interpreter class you define yourself in order to inherit *note + Cmd: 16c5.’s methods and encapsulate action methods. + + The optional argument 'completekey' is the *note readline: ba. name + of a completion key; it defaults to ‘Tab’. If 'completekey' is not + *note None: 671. and *note readline: ba. is available, command + completion is done automatically. + + The default, ‘'tab'’, is treated specially, so that it refers to + the ‘Tab’ key on every *note readline.backend: 16af. Specifically, + if *note readline.backend: 16af. 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. + + The optional arguments 'stdin' and 'stdout' specify the input and + output file objects that the Cmd instance or subclass instance will + use for input and output. If not specified, they will default to + *note sys.stdin: 539. and *note sys.stdout: ad6. + + If you want a given 'stdin' to be used, make sure to set the + instance’s *note use_rawinput: 3e09. attribute to ‘False’, + otherwise 'stdin' will be ignored. + + Changed in version 3.13: ‘completekey='tab'’ is replaced by ‘'^I'’ + for ‘editline’. + +* Menu: + +* Cmd Objects:: +* Cmd Example:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/cmd.py + + +File: python.info, Node: Cmd Objects, Next: Cmd Example, Up: cmd — Support for line-oriented command interpreters + +5.25.2.1 Cmd Objects +.................... + +A *note Cmd: 16c5. instance has the following methods: + + -- Method: Cmd.cmdloop (intro=None) + + Repeatedly issue a prompt, accept input, parse an initial prefix + off the received input, and dispatch to action methods, passing + them the remainder of the line as argument. + + The optional argument is a banner or intro string to be issued + before the first prompt (this overrides the *note intro: 3e0d. + class attribute). + + If the *note readline: ba. module is loaded, input will + automatically inherit ‘bash’-like history-list editing (e.g. + ‘Control’-‘P’ scrolls back to the last command, ‘Control’-‘N’ + forward to the next one, ‘Control’-‘F’ moves the cursor to the + right non-destructively, ‘Control’-‘B’ moves the cursor to the left + non-destructively, etc.). + + An end-of-file on input is passed back as the string ‘'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(): 16b4. 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(): 3e0e. method + returns a true value. The 'stop' argument to *note postcmd(): + 3e0e. 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. + + -- Method: Cmd.do_help (arg) + + All subclasses of *note Cmd: 16c5. 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. + + -- Method: 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(): 3e10. and *note postcmd(): 3e0e. + 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(): 3e11. method is returned. + + -- Method: Cmd.emptyline () + + Method called when an empty line is entered in response to the + prompt. If this method is not overridden, it repeats the last + nonempty command entered. + + -- Method: Cmd.default (line) + + Method called on an input line when the command prefix is not + recognized. If this method is not overridden, it prints an error + message and returns. + + -- Method: 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. + + -- Method: 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. + + -- Method: Cmd.precmd (line) + + Hook method executed just before the command line 'line' is + interpreted, but after the input prompt is generated and issued. + This method is a stub in *note Cmd: 16c5.; it exists to be + overridden by subclasses. The return value is used as the command + which will be executed by the *note onecmd(): 3e0f. method; the + *note precmd(): 3e10. implementation may re-write the command or + simply return 'line' unchanged. + + -- Method: Cmd.postcmd (stop, line) + + Hook method executed just after a command dispatch is finished. + This method is a stub in *note Cmd: 16c5.; it exists to be + overridden by subclasses. 'line' is the command line which was + executed, and 'stop' is a flag which indicates whether execution + will be terminated after the call to *note postcmd(): 3e0e.; this + will be the return value of the *note onecmd(): 3e0f. method. The + return value of this method will be used as the new value for the + internal flag which corresponds to 'stop'; returning false will + cause interpretation to continue. + + -- Method: Cmd.preloop () + + Hook method executed once when *note cmdloop(): 3e0c. is called. + This method is a stub in *note Cmd: 16c5.; it exists to be + overridden by subclasses. + + -- Method: Cmd.postloop () + + Hook method executed once when *note cmdloop(): 3e0c. is about to + return. This method is a stub in *note Cmd: 16c5.; it exists to be + overridden by subclasses. + +Instances of *note Cmd: 16c5. subclasses have some public instance +variables: + + -- Attribute: Cmd.prompt + + The prompt issued to solicit input. + + -- Attribute: Cmd.identchars + + The string of characters accepted for the command prefix. + + -- Attribute: Cmd.lastcmd + + The last nonempty command prefix seen. + + -- Attribute: Cmd.cmdqueue + + A list of queued input lines. The cmdqueue list is checked in + *note cmdloop(): 3e0c. when new input is needed; if it is nonempty, + its elements will be processed in order, as if entered at the + prompt. + + -- Attribute: Cmd.intro + + A string to issue as an intro or banner. May be overridden by + giving the *note cmdloop(): 3e0c. method an argument. + + -- Attribute: Cmd.doc_header + + The header to issue if the help output has a section for documented + commands. + + -- Attribute: 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). + + -- Attribute: 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). + + -- Attribute: Cmd.ruler + + The character used to draw separator lines under the help-message + headers. If empty, no ruler line is drawn. It defaults to ‘'='’. + + -- Attribute: Cmd.use_rawinput + + A flag, defaulting to true. If true, *note cmdloop(): 3e0c. uses + *note input(): 12cb. to display a prompt and read the next command; + if false, *note sys.stdout.write(): ad6. and *note + sys.stdin.readline(): 539. are used. (This means that by importing + *note readline: ba, on systems that support it, the interpreter + will automatically support ‘Emacs’-like line editing and + command-history keystrokes.) + + +File: python.info, Node: Cmd Example, Prev: Cmd Objects, Up: cmd — Support for line-oriented command interpreters + +5.25.2.2 Cmd Example +.................... + +The *note cmd: 19. module is mainly useful for building custom shells +that let a user work with a program interactively. + +This section presents a simple example of how to build a shell around a +few of the commands in the *note turtle: 101. module. + +Basic turtle commands such as *note forward(): 3d69. are added to a +*note Cmd: 16c5. 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(): 3e10. 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: 3e19. 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() + +Here is a sample session with the turtle shell showing the help +functions, using blank lines to repeat commands, and the simple record +and playback facility: + + Welcome to the turtle shell. Type help or ? to list commands. + + (turtle) ? + + Documented commands (type help ): + ======================================== + 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: shlex — Simple lexical analysis, Prev: cmd — Support for line-oriented command interpreters, Up: Program Frameworks + +5.25.3 ‘shlex’ — Simple lexical analysis +---------------------------------------- + +'Source code:' Lib/shlex.py(1) + +__________________________________________________________________ + +The *note shlex: ccd. class makes it easy to write lexical analyzers for +simple syntaxes resembling that of the Unix shell. This will often be +useful for writing minilanguages, (for example, in run control files for +Python applications) or for parsing quoted strings. + +The *note shlex: c4. module defines the following functions: + + -- Function: shlex.split (s, comments=False, posix=True) + + Split the string 's' using shell-like syntax. If 'comments' is + *note False: b37. (the default), the parsing of comments in the + given string will be disabled (setting the *note commenters: 3e22. + attribute of the *note shlex: ccd. instance to the empty string). + This function operates in POSIX mode by default, but uses non-POSIX + mode if the 'posix' argument is false. + + Changed in version 3.12: Passing ‘None’ for 's' argument now raises + an exception, rather than reading *note sys.stdin: 539. + + -- Function: shlex.join (split_command) + + Concatenate the tokens of the list 'split_command' and return a + string. This function is the inverse of *note split(): 538. + + >>> 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(): 27f.). + + Added in version 3.8. + + -- Function: shlex.quote (s) + + Return a shell-escaped version of the string 's'. The returned + value is a string that can safely be used as one token in a shell + command line, for cases where you cannot use a list. + Warning: The ‘shlex’ module is 'only designed for Unix + shells'. + + The *note quote(): 27f. 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(): b86. with ‘shell=False’. + + This idiom would be unsafe: + + >>> filename = 'somefile; rm -rf ~' + >>> command = 'ls -l {}'.format(filename) + >>> print(command) # executed by a shell: boom! + ls -l somefile; rm -rf ~ + + *note quote(): 27f. lets you plug the security hole: + + >>> 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 ~'"'"'' + + The quoting is compatible with UNIX shells and with *note split(): + 538.: + + >>> 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 *note shlex: c4. module defines the following class: + + -- Class: shlex.shlex (instream=None, infile=None, posix=False, + punctuation_chars=False) + + A *note shlex: ccd. 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(): 1c85. and *note + readline(): 1cbd. 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: 3e23. attribute. If the 'instream' argument is omitted or + equal to ‘sys.stdin’, this second argument defaults to “stdin”. + The 'posix' argument defines the operational mode: when 'posix' is + not true (default), the *note shlex: ccd. instance will operate in + compatibility mode. When operating in POSIX mode, *note shlex: + ccd. 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: 3e24. attribute that appear in + 'punctuation_chars' will be removed from *note wordchars: 3e24. + See *note Improved Compatibility with Shells: cce. for more + information. 'punctuation_chars' can be set only upon *note shlex: + ccd. instance creation and can’t be modified later. + + Changed in version 3.6: The 'punctuation_chars' parameter was + added. + +See also +........ + +Module *note configparser: 22. + + Parser for configuration files similar to the Windows ‘.ini’ files. + +* Menu: + +* shlex Objects:: +* Parsing Rules:: +* Improved Compatibility with Shells:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/shlex.py + + +File: python.info, Node: shlex Objects, Next: Parsing Rules, Up: shlex — Simple lexical analysis + +5.25.3.1 shlex Objects +...................... + +A *note shlex: ccd. instance has the following methods: + + -- Method: shlex.get_token () + + Return a token. If tokens have been stacked using *note + push_token(): 3e28, pop a token off the stack. Otherwise, read one + from the input stream. If reading encounters an immediate + end-of-file, *note eof: 3e29. is returned (the empty string (‘''’) + in non-POSIX mode, and ‘None’ in POSIX mode). + + -- Method: shlex.push_token (str) + + Push the argument onto the token stack. + + -- Method: shlex.read_token () + + Read a raw token. Ignore the pushback stack, and do not interpret + source requests. (This is not ordinarily a useful entry point, and + is documented here only for the sake of completeness.) + + -- Method: shlex.sourcehook (filename) + + When *note shlex: ccd. detects a source request (see *note source: + 3e2c. below) this method is given the following token as argument, + and expected to return a tuple consisting of a filename and an open + file-like object. + + Normally, this method first strips any quotes off the argument. If + the result is an absolute pathname, or there was no previous source + request in effect, or the previous source was a stream (such as + ‘sys.stdin’), the result is left alone. Otherwise, if the result + is a relative pathname, the directory part of the name of the file + immediately before it on the source inclusion stack is prepended + (this behavior is like the way the C preprocessor handles ‘#include + "file.h"’). + + The result of the manipulations is treated as a filename, and + returned as the first component of the tuple, with *note open(): + 517. called on it to yield the second component. (Note: this is + the reverse of the order of arguments in instance initialization!) + + This hook is exposed so that you can use it to implement directory + search paths, addition of file extensions, and other namespace + hacks. There is no corresponding ‘close’ hook, but a shlex + instance will call the *note close(): 1f8. method of the sourced + input stream when it returns EOF. + + For more explicit control of source stacking, use the *note + push_source(): 3e2d. and *note pop_source(): 3e2e. methods. + + -- Method: shlex.push_source (newstream, newfile=None) + + Push an input source stream onto the input stack. If the filename + argument is specified it will later be available for use in error + messages. This is the same method used internally by the *note + sourcehook(): 3e2b. method. + + -- Method: shlex.pop_source () + + Pop the last-pushed input source from the input stack. This is the + same method used internally when the lexer reaches EOF on a stacked + input stream. + + -- Method: shlex.error_leader (infile=None, lineno=None) + + This method generates an error message leader in the format of a + Unix C compiler error label; the format is ‘'"%s", line %d: '’, + where the ‘%s’ is replaced with the name of the current source file + and the ‘%d’ with the current input line number (the optional + arguments can be used to override these). + + This convenience is provided to encourage *note shlex: c4. users to + generate error messages in the standard, parseable format + understood by Emacs and other Unix tools. + +Instances of *note shlex: ccd. subclasses have some public instance +variables which either control lexical analysis or can be used for +debugging: + + -- Attribute: shlex.commenters + + The string of characters that are recognized as comment beginners. + All characters from the comment beginner to end of line are + ignored. Includes just ‘'#'’ by default. + + -- Attribute: 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: 19d0. 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: 3e30. is set to ‘True’, + this will have no effect. + + -- Attribute: shlex.whitespace + + Characters that will be considered whitespace and skipped. + Whitespace bounds tokens. By default, includes space, tab, + linefeed and carriage-return. + + -- Attribute: shlex.escape + + Characters that will be considered as escape. This will be only + used in POSIX mode, and includes just ‘'\'’ by default. + + -- Attribute: shlex.quotes + + Characters that will be considered string quotes. The token + accumulates until the same quote is encountered again (thus, + different quote types protect each other as in the shell.) By + default, includes ASCII single and double quotes. + + -- Attribute: shlex.escapedquotes + + Characters in *note quotes: 3e33. that will interpret escape + characters defined in *note escape: 3e32. This is only used in + POSIX mode, and includes just ‘'"'’ by default. + + -- Attribute: shlex.whitespace_split + + If ‘True’, tokens will only be split in whitespaces. This is + useful, for example, for parsing command lines with *note shlex: + ccd, getting tokens in a similar way to shell arguments. When used + in combination with *note punctuation_chars: 19d0, tokens will be + split on whitespace in addition to those characters. + + Changed in version 3.8: The *note punctuation_chars: 19d0. + attribute was made compatible with the *note whitespace_split: + 3e30. attribute. + + -- Attribute: shlex.infile + + The name of the current input file, as initially set at class + instantiation time or stacked by later source requests. It may be + useful to examine this when constructing error messages. + + -- Attribute: shlex.instream + + The input stream from which this *note shlex: ccd. instance is + reading characters. + + -- Attribute: shlex.source + + This attribute is ‘None’ by default. If you assign a string to it, + that string will be recognized as a lexical-level inclusion request + similar to the ‘source’ keyword in various shells. That is, the + immediately following token will be opened as a filename and input + will be taken from that stream until EOF, at which point the *note + close(): 1f8. method of that stream will be called and the input + source will again become the original input stream. Source + requests may be stacked any number of levels deep. + + -- Attribute: shlex.debug + + If this attribute is numeric and ‘1’ or more, a *note shlex: ccd. + instance will print verbose progress output on its behavior. If + you need to use this, you can read the module source code to learn + the details. + + -- Attribute: shlex.lineno + + Source line number (count of newlines seen so far plus one). + + -- Attribute: shlex.token + + The token buffer. It may be useful to examine this when catching + exceptions. + + -- Attribute: shlex.eof + + Token used to determine end of file. This will be set to the empty + string (‘''’), in non-POSIX mode, and to ‘None’ in POSIX mode. + + -- Attribute: 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: Parsing Rules, Next: Improved Compatibility with Shells, Prev: shlex Objects, Up: shlex — Simple lexical analysis + +5.25.3.2 Parsing Rules +...................... + +When operating in non-POSIX mode, *note shlex: ccd. will try to obey to +the following rules. + + * Quote characters are not recognized within words (‘Do"Not"Separate’ + is parsed as the single word ‘Do"Not"Separate’); + + * Escape characters are not recognized; + + * Enclosing characters in quotes preserve the literal value of all + characters within the quotes; + + * Closing quotes separate words (‘"Do"Separate’ is parsed as ‘"Do"’ + and ‘Separate’); + + * If *note whitespace_split: 3e30. is ‘False’, any character not + declared to be a word character, whitespace, or a quote will be + returned as a single-character token. If it is ‘True’, *note + shlex: ccd. will only split words in whitespaces; + + * EOF is signaled with an empty string (‘''’); + + * It’s not possible to parse empty strings, even if quoted. + +When operating in POSIX mode, *note shlex: ccd. will try to obey to the +following parsing rules. + + * Quotes are stripped out, and do not separate words + (‘"Do"Not"Separate"’ is parsed as the single word ‘DoNotSeparate’); + + * Non-quoted escape characters (e.g. ‘'\'’) preserve the literal + value of the next character that follows; + + * Enclosing characters in quotes which are not part of *note + escapedquotes: 3e34. (e.g. ‘"'"’) preserve the literal value of + all characters within the quotes; + + * Enclosing characters in quotes which are part of *note + escapedquotes: 3e34. (e.g. ‘'"'’) preserves the literal value of + all characters within the quotes, with the exception of the + characters mentioned in *note escape: 3e32. The escape characters + retain its 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. + + * EOF is signaled with a *note None: 671. value; + + * Quoted empty strings (‘''’) are allowed. + + +File: python.info, Node: Improved Compatibility with Shells, Prev: Parsing Rules, Up: shlex — Simple lexical analysis + +5.25.3.3 Improved Compatibility with Shells +........................................... + +Added in version 3.6. + +The *note shlex: c4. 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'] + + Note: When ‘punctuation_chars’ is specified, the *note wordchars: + 3e24. 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: 3e30. + when using *note punctuation_chars: 19d0, which will negate *note + wordchars: 3e24. entirely. + +For best effect, ‘punctuation_chars’ should be set in conjunction with +‘posix=True’. (Note that ‘posix=False’ is the default for *note shlex: +ccd.) + + +File: python.info, Node: Graphical User Interfaces with Tk, Next: Development Tools, Prev: Program Frameworks, Up: The Python Standard Library + +5.26 Graphical User Interfaces with Tk +====================================== + +Tk/Tcl has long been an integral part of Python. It provides a robust +and platform independent windowing toolkit, that is available to Python +programmers using the *note tkinter: f0. package, and its extension, the +*note tkinter.ttk: f9. module. + +The *note tkinter: f0. package is a thin object-oriented layer on top of +Tcl/Tk. To use *note tkinter: f0, you don’t need to write Tcl code, but +you will need to consult the Tk documentation, and occasionally the Tcl +documentation. *note tkinter: f0. is a set of wrappers that implement +the Tk widgets as Python classes. + +*note tkinter: f0.’s chief virtues are that it is fast, and that it +usually comes bundled with Python. Although its standard documentation +is weak, good material is available, which includes: references, +tutorials, a book and others. *note tkinter: f0. is also famous for +having an outdated look and feel, which has been vastly improved in Tk +8.5. Nevertheless, there are many other GUI libraries that you could be +interested in. The Python wiki lists several alternative GUI frameworks +and tools(1). + +* Menu: + +* tkinter — Python interface to Tcl/Tk:: +* tkinter.colorchooser — Color choosing dialog: tkinter colorchooser — Color choosing dialog. +* tkinter.font — Tkinter font wrapper: tkinter font — Tkinter font wrapper. +* Tkinter Dialogs:: +* tkinter.messagebox — Tkinter message prompts: tkinter messagebox — Tkinter message prompts. +* tkinter.scrolledtext — Scrolled Text Widget: tkinter scrolledtext — Scrolled Text Widget. +* tkinter.dnd — Drag and drop support: tkinter dnd — Drag and drop support. +* tkinter.ttk — Tk themed widgets: tkinter ttk — Tk themed widgets. +* IDLE — Python editor and shell: IDLE — Python editor and shell<2>. + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/GuiProgramming + + +File: python.info, Node: tkinter — Python interface to Tcl/Tk, Next: tkinter colorchooser — Color choosing dialog, Up: Graphical User Interfaces with Tk + +5.26.1 ‘tkinter’ — Python interface to Tcl/Tk +--------------------------------------------- + +'Source code:' Lib/tkinter/__init__.py(1) + +__________________________________________________________________ + +The *note tkinter: f0. package (“Tk interface”) is the standard Python +interface to the Tcl/Tk GUI toolkit. Both Tk and *note tkinter: f0. are +available on most Unix platforms, including macOS, as well as on Windows +systems. + +Running ‘python -m tkinter’ from the command line should open a window +demonstrating a simple Tk interface, letting you know that *note +tkinter: f0. is properly installed on your system, and also showing what +version of Tcl/Tk is installed, so you can read the Tcl/Tk documentation +specific to that version. + +Tkinter supports a range of Tcl/Tk versions, built either with or +without thread support. The official Python binary release bundles +Tcl/Tk 8.6 threaded. See the source code for the *note _tkinter: 3. +module for more information about supported versions. + +Tkinter is not a thin wrapper, but adds a fair amount of its own logic +to make the experience more pythonic. This documentation will +concentrate on these additions and changes, and refer to the official +Tcl/Tk documentation for details that are unchanged. + + Note: 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. + +See also +........ + + * + TkDocs(2) + + Extensive tutorial on creating user interfaces with Tkinter. + Explains key concepts, and illustrates recommended approaches + using the modern API. + + * + Tkinter 8.5 reference: a GUI for Python(3) + + Reference documentation for Tkinter 8.5 detailing available + classes, methods, and options. + +Tcl/Tk Resources: + + * + Tk commands(4) + + Comprehensive reference to each of the underlying Tcl/Tk + commands used by Tkinter. + + * + Tcl/Tk Home Page(5) + + Additional documentation, and links to Tcl/Tk core + development. + +Books: + + * + Modern Tkinter for Busy Python Developers(6) + + By Mark Roseman. (ISBN 978-1999149567) + + * + Python GUI programming with Tkinter(7) + + By Alan D. Moore. (ISBN 978-1788835886) + + * + Programming Python(8) + + By Mark Lutz; has excellent coverage of Tkinter. (ISBN + 978-0596158101) + + * + Tcl and the Tk Toolkit (2nd edition)(9) + + By John Ousterhout, inventor of Tcl/Tk, and Ken Jones; does + not cover Tkinter. (ISBN 978-0321336330) + +* Menu: + +* Architecture:: +* Tkinter Modules:: +* Tkinter Life Preserver:: +* Threading model:: +* Handy Reference:: +* File Handlers:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/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 Modules, Up: tkinter — Python interface to Tcl/Tk + +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: + 3e42. 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: 1636. 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: f9. + +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 *note tkinter: f0. module first assembles a Tcl/Tk command +string. It passes that Tcl command string to an internal *note +_tkinter: 3. binary module, which then calls the Tcl interpreter to +evaluate it. The Tcl interpreter will then call into the Tk and/or Ttk +packages, which will in turn make calls to Xlib, Cocoa, or GDI. + + ---------- Footnotes ---------- + + (1) https://wiki.tcl-lang.org/37432 + + +File: python.info, Node: Tkinter Modules, Next: Tkinter Life Preserver, Prev: Architecture, Up: tkinter — Python interface to Tcl/Tk + +5.26.1.2 Tkinter Modules +........................ + +Support for Tkinter is spread across several modules. Most applications +will need the main *note tkinter: f0. module, as well as the *note +tkinter.ttk: f9. module, which provides the modern themed widget set and +API: + + from tkinter import * + from tkinter import ttk + + -- Class: tkinter.Tk (screenName=None, baseName=None, className='Tk', + useTk=True, sync=False, use=None) + + Construct a toplevel Tk widget, which is usually the main window of + an application, and initialize a Tcl interpreter for this widget. + Each instance has its own associated Tcl interpreter. + + The *note Tk: 1636. 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(): 3e44. function sets this to ‘False’. + + 'sync' + + If ‘True’, execute all X server commands synchronously, so + that errors are reported immediately. Can be used for + debugging. (X11 only) + + 'use' + + Specifies the 'id' of the window in which to embed the + application, instead of it being created as an independent + toplevel window. 'id' must be specified in the same way as + the value for the -use option for toplevel widgets (that is, + it has a form like that returned by ‘winfo_id()’). + + Note that on some platforms this will only work correctly if + 'id' refers to a Tk frame or toplevel that has its -container + option enabled. + + *note Tk: 1636. reads and interprets profile files, named + ‘.`className'.tcl’ and ‘.`baseName'.tcl’, into the Tcl interpreter + and calls *note exec(): 17f. 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: 27e4. + + -- Attribute: tk + + The Tk application object created by instantiating *note Tk: + 1636. This provides access to the Tcl interpreter. Each + widget that is attached the same instance of *note Tk: 1636. + has the same value for its *note tk: 3e45. attribute. + + -- Attribute: master + + The widget object that contains this widget. For *note Tk: + 1636, the 'master' is *note None: 671. 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 *note master: 3e46. returns the object. + 'parent'/'child' reflects the tree-like relationship while + 'master'/'slave' reflects the container structure. + + -- Attribute: children + + The immediate descendants of this widget as a *note dict: 258. + with the child widget names as the keys and the child instance + objects as the values. + + -- Function: tkinter.Tcl (screenName=None, baseName=None, + className='Tk', useTk=False) + + The *note Tcl(): 3e44. function is a factory function which creates + an object much like that created by the *note Tk: 1636. class, + except that it does not initialize the Tk subsystem. This is most + often useful when driving the Tcl interpreter in an environment + where one doesn’t want to create extraneous toplevel windows, or + where one cannot (such as Unix/Linux systems without an X server). + An object created by the *note Tcl(): 3e44. object can have a + Toplevel window created (and the Tk subsystem initialized) by + calling its ‘loadtk()’ method. + +The modules that provide Tk support include: + +*note tkinter: f0. + + Main Tkinter module. + +*note tkinter.colorchooser: f1. + + Dialog to let the user choose a color. + +*note tkinter.commondialog: f2. + + Base class for the dialogs defined in the other modules listed + here. + +*note tkinter.filedialog: f4. + + Common dialogs to allow the user to specify a file to open or save. + +*note tkinter.font: f5. + + Utilities to help work with fonts. + +*note tkinter.messagebox: f6. + + Access to standard Tk dialog boxes. + +*note tkinter.scrolledtext: f7. + + Text widget with a vertical scroll bar built in. + +*note tkinter.simpledialog: f8. + + Basic dialogs and convenience functions. + +*note tkinter.ttk: f9. + + Themed widget set introduced in Tk 8.5, providing modern + alternatives for many of the classic widgets in the main *note + tkinter: f0. 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 *note tkinter: f0. 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: 73. + + Python’s Integrated Development and Learning Environment (IDLE). + Based on *note tkinter: f0. + +‘tkinter.constants’ + + Symbolic constants that can be used in place of strings when + passing various parameters to Tkinter calls. Automatically + imported by the main *note tkinter: f0. module. + +*note tkinter.dnd: f3. + + (experimental) Drag-and-drop support for *note tkinter: f0. This + will become deprecated when it is replaced with the Tk DND. + +*note turtle: 101. + + Turtle graphics in a Tk window. + + +File: python.info, Node: Tkinter Life Preserver, Next: Threading model, Prev: Tkinter Modules, Up: tkinter — Python interface to Tcl/Tk + +5.26.1.3 Tkinter Life Preserver +............................... + +This section is not designed to be an exhaustive tutorial on either Tk +or Tkinter. For that, refer to one of the external resources noted +earlier. Instead, this section provides a very quick orientation to +what a Tkinter application looks like, identifies foundational Tk +concepts, and explains how the Tkinter wrapper is structured. + +The remainder of this section will help you to identify the classes, +methods, and options you’ll need in your Tkinter application, and where +to find more detailed documentation on them, including in the official +Tcl/Tk reference manual. + +* Menu: + +* A Hello World Program:: +* Important Tk Concepts:: +* Understanding How Tkinter Wraps Tcl/Tk:: +* How do I…? What option does…?:: +* Navigating the Tcl/Tk Reference Manual:: + + +File: python.info, Node: A Hello World Program, Next: Important Tk Concepts, Up: Tkinter Life Preserver + +5.26.1.4 A Hello World Program +.............................. + +We’ll start by walking through a “Hello World” application in Tkinter. +This isn’t the smallest one we could write, but has enough to illustrate +some key concepts you’ll need to know. + + from tkinter import * + from tkinter import ttk + root = Tk() + frm = ttk.Frame(root, padding=10) + frm.grid() + ttk.Label(frm, text="Hello World!").grid(column=0, row=0) + ttk.Button(frm, text="Quit", command=root.destroy).grid(column=1, row=0) + root.mainloop() + +After the imports, the next line creates an instance of the ‘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 Life Preserver + +5.26.1.5 Important Tk Concepts +.............................. + +Even this simple program illustrates the following key Tk concepts: + +widgets + + A Tkinter user interface is made up of individual 'widgets'. Each + widget is represented as a Python object, instantiated from classes + like ‘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 Life Preserver + +5.26.1.6 Understanding How Tkinter Wraps Tcl/Tk +............................................... + +When your application uses Tkinter’s classes and methods, internally +Tkinter is assembling strings representing Tcl/Tk commands, and +executing those commands in the Tcl interpreter attached to your +application’s ‘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 would is used in Tkinter. + + +File: python.info, Node: How do I…? What option does…?, Next: Navigating the Tcl/Tk Reference Manual, Prev: Understanding How Tkinter Wraps Tcl/Tk, Up: Tkinter Life Preserver + +5.26.1.7 How do I…? What option does…? +...................................... + +If you’re not sure how to do something in Tkinter, and you can’t +immediately find it in the tutorial or reference documentation you’re +using, there are a few strategies that can be helpful. + +First, remember that the details of how individual widgets work may vary +across different versions of both Tkinter and Tcl/Tk. If you’re +searching documentation, make sure it corresponds to the Python and +Tcl/Tk versions installed on your system. + +When searching for how to use an API, it helps to know the exact name of +the class, option, or method that you’re using. Introspection, either +in an interactive Python shell or with *note print(): f70, 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(): 62e. function. If you try it, you’ll see +there are over 200 common widget methods, so again identifying those +specific to a widget class is helpful. + + print(dir(btn)) + print(set(dir(btn)) - set(dir(frm))) + + +File: python.info, Node: Navigating the Tcl/Tk Reference Manual, Prev: How do I…? What option does…?, Up: Tkinter Life Preserver + +5.26.1.8 Navigating the Tcl/Tk Reference Manual +............................................... + +As noted, the official Tk commands(1) reference manual (man pages) is +often the most accurate description of what specific operations on +widgets do. Even when you know the name of the option or method that +you need, you may still have a few places to look. + +While all operations in Tkinter are implemented as method calls on +widget objects, you’ve seen that many Tcl/Tk operations appear as +commands that take a widget pathname as its first parameter, followed by +optional parameters, 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. + + Note: 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: Handy Reference, Prev: Tkinter Life Preserver, Up: tkinter — Python interface to Tcl/Tk + +5.26.1.9 Threading model +........................ + +Python and Tcl/Tk have very different threading models, which *note +tkinter: f0. 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 *note tkinter: f0. contains a Tcl +interpreter. It also keeps track of which thread created that +interpreter. Calls to *note tkinter: f0. 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 *note tkinter: f0. 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, *note tkinter: f0. 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 *note tkinter: f0. 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 *note tkinter: f0. functions that presently + work only when called from the thread that created the Tcl + interpreter. + + +File: python.info, Node: Handy Reference, Next: File Handlers, Prev: Threading model, Up: tkinter — Python interface to Tcl/Tk + +5.26.1.10 Handy Reference +......................... + +* Menu: + +* Setting Options:: +* The Packer:: +* Packer Options:: +* Coupling Widget Variables:: +* The Window Manager:: +* Tk Option Data Types:: +* Bindings and Events:: +* The index Parameter:: +* Images:: + + +File: python.info, Node: Setting Options, Next: The Packer, Up: Handy Reference + +5.26.1.11 Setting Options +......................... + +Options control things like the color and border width of a widget. +Options can be set in three ways: + +At object creation time, using keyword arguments + + fred = Button(self, fg="red", bg="blue") + +After object creation, treating the option name like a dictionary index + + fred["fg"] = "red" + fred["bg"] = "blue" + +Use the config() method to update multiple attrs subsequent to object creation + + fred.config(fg="red", bg="blue") + +For a complete explanation of a given option and its behavior, see the +Tk man pages for the widget in question. + +Note that the man pages list “STANDARD OPTIONS” and “WIDGET SPECIFIC +OPTIONS” for each widget. The former is a list of options that are +common to many widgets, the latter are the options that are +idiosyncratic to that particular widget. The Standard Options are +documented on the ‘options(3)(1)’ man page. + +No distinction between standard and widget-specific options is made in +this document. Some options don’t apply to some kinds of widgets. +Whether a given widget responds to a particular option depends on the +class of the widget; buttons have a ‘command’ option, labels do not. + +The options supported by a given widget are listed in that widget’s man +page, or can be queried at runtime by calling the ‘config()’ method +without arguments, or by calling the ‘keys()’ method on that widget. +The return value of these calls is a dictionary whose key is the name of +the option as a string (for example, ‘'relief'’) and whose values are +5-tuples. + +Some options, like ‘bg’ are synonyms for common options with long names +(‘bg’ is shorthand for “background”). Passing the ‘config()’ method the +name of a shorthand option will return a 2-tuple, not 5-tuple. The +2-tuple passed back will contain the name of the synonym and the “real” +option (such as ‘('bg', 'background')’). + +Index Meaning Example + +--------------------------------------------------------------------- + +0 option name ‘'relief'’ + + +1 option name for database lookup ‘'relief'’ + + +2 option class for database lookup ‘'Relief'’ + + +3 default value ‘'raised'’ + + +4 current value ‘'groove'’ + + +Example: + + >>> print(fred.config()) + {'relief': ('relief', 'relief', 'Relief', 'raised', 'groove')} + +Of course, the dictionary printed will include all the options available +and their values. This is meant only as an example. + + ---------- Footnotes ---------- + + (1) https://manpages.debian.org/options(3) + + +File: python.info, Node: The Packer, Next: Packer Options, Prev: Setting Options, Up: Handy Reference + +5.26.1.12 The Packer +.................... + +The packer is one of Tk’s geometry-management mechanisms. Geometry +managers are used to specify the relative positioning of widgets within +their container - their mutual 'master'. 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 'master' widget is determined by the size of the “slave +widgets” inside. The packer is used to control where slave widgets +appear inside the master into which they are packed. You can pack +widgets into frames, and frames into other frames, in order to achieve +the kind of layout you desire. Additionally, the arrangement is +dynamically adjusted to accommodate incremental changes to the +configuration, once it is packed. + +Note that widgets do not appear until they have had their geometry +specified with a geometry manager. It’s a common early mistake to leave +out the geometry specification, and then be surprised when the widget is +created but nothing appears. A widget will appear only after it has +had, for example, the packer’s ‘pack()’ method applied to it. + +The pack() method can be called with keyword-option/value pairs that +control where the widget is to appear within its container, and how it +is to behave when the main application window is resized. Here are some +examples: + + fred.pack() # defaults to side = "top" + fred.pack(side="left") + fred.pack(expand=1) + + +File: python.info, Node: Packer Options, Next: Coupling Widget Variables, Prev: The Packer, Up: Handy Reference + +5.26.1.13 Packer Options +........................ + +For more extensive information on the packer and the options that it can +take, see the man pages and page 183 of John Ousterhout’s book. + +anchor + + Anchor type. Denotes where the packer is to place each slave in + its parcel. + +expand + + Boolean, ‘0’ or ‘1’. + +fill + + Legal values: ‘'x'’, ‘'y'’, ‘'both'’, ‘'none'’. + +ipadx and ipady + + A distance - designating internal padding on each side of the slave + widget. + +padx and pady + + A distance - designating external padding on each side of the slave + widget. + +side + + Legal values are: ‘'left'’, ‘'right'’, ‘'top'’, ‘'bottom'’. + + +File: python.info, Node: Coupling Widget Variables, Next: The Window Manager, Prev: Packer Options, Up: Handy Reference + +5.26.1.14 Coupling Widget Variables +................................... + +The current-value setting of some widgets (like text entry widgets) can +be connected directly to application variables by using special options. +These options are ‘variable’, ‘textvariable’, ‘onvalue’, ‘offvalue’, and +‘value’. This connection works both ways: if the variable changes for +any reason, the widget it’s connected to will be updated to reflect the +new value. + +Unfortunately, in the current implementation of *note tkinter: f0. 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 *note tkinter: f0. + +There are many useful subclasses of Variable already defined: +‘StringVar’, ‘IntVar’, ‘DoubleVar’, and ‘BooleanVar’. To read the +current value of such a variable, call the ‘get()’ method on it, and to +change its value you call the ‘set()’ method. If you follow this +protocol, the widget will always track the value of the variable, with +no further intervention on your part. + +For example: + + 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('', + self.print_contents) + + def print_contents(self, event): + print("Hi. The current entry content is:", + self.contents.get()) + + root = tk.Tk() + myapp = App(root) + myapp.mainloop() + + +File: python.info, Node: The Window Manager, Next: Tk Option Data Types, Prev: Coupling Widget Variables, Up: Handy Reference + +5.26.1.15 The Window Manager +............................ + +In Tk, there is a utility command, ‘wm’, for interacting with the window +manager. Options to the ‘wm’ command allow you to control things like +titles, placement, icon bitmaps, and the like. In *note tkinter: f0, +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. + +Here are some examples of typical usage: + + import tkinter as tk + + class App(tk.Frame): + def __init__(self, master=None): + super().__init__(master) + self.pack() + + # create the application + myapp = App() + + # + # here are method calls to the window manager class + # + myapp.master.title("My Do-Nothing Application") + myapp.master.maxsize(1000, 400) + + # start the program + myapp.mainloop() + + +File: python.info, Node: Tk Option Data Types, Next: Bindings and Events, Prev: The Window Manager, Up: Handy Reference + +5.26.1.16 Tk Option Data Types +.............................. + +anchor + + Legal values are points of the compass: ‘"n"’, ‘"ne"’, ‘"e"’, + ‘"se"’, ‘"s"’, ‘"sw"’, ‘"w"’, ‘"nw"’, and also ‘"center"’. + +bitmap + + There are eight built-in, named bitmaps: ‘'error'’, ‘'gray25'’, + ‘'gray50'’, ‘'hourglass'’, ‘'info'’, ‘'questhead'’, ‘'question'’, + ‘'warning'’. To specify an X bitmap filename, give the full path + to the file, preceded with an ‘@’, as in + ‘"@/usr/contrib/bitmap/gumby.bit"’. + +boolean + + You can pass integers 0 or 1 or the strings ‘"yes"’ or ‘"no"’. + +callback + + This is any Python function that takes no arguments. For example: + + def print_it(): + print("hi there") + fred["command"] = print_it + +color + + Colors can be given as the names of X colors in the rgb.txt file, + or as strings representing RGB values in 4 bit: ‘"#RGB"’, 8 bit: + ‘"#RRGGBB"’, 12 bit: ‘"#RRRGGGBBB"’, or 16 bit: ‘"#RRRRGGGGBBBB"’ + ranges, where R,G,B here represent any legal hex digit. See page + 160 of Ousterhout’s book for details. + +cursor + + The standard X cursor names from ‘cursorfont.h’ can be used, + without the ‘XC_’ prefix. For example to get a hand cursor + (‘XC_hand2’), use the string ‘"hand2"’. You can also specify a + bitmap and mask file of your own. See page 179 of Ousterhout’s + book. + +distance + + Screen distances can be specified in either pixels or absolute + distances. Pixels are given as numbers and absolute distances as + strings, with the trailing character denoting units: ‘c’ for + centimetres, ‘i’ for inches, ‘m’ for millimetres, ‘p’ for printer’s + points. For example, 3.5 inches is expressed as ‘"3.5i"’. + +font + + Tk uses a list font name format, such as ‘{courier 10 bold}’. Font + sizes with positive numbers are measured in points; sizes with + negative numbers are measured in pixels. + +geometry + + This is a string of the form ‘widthxheight’, where width and height + are measured in pixels for most widgets (in characters for widgets + displaying text). For example: ‘fred["geometry"] = "200x100"’. + +justify + + Legal values are the strings: ‘"left"’, ‘"center"’, ‘"right"’, and + ‘"fill"’. + +region + + This is a string with four space-delimited elements, each of which + is a legal distance (see above). For example: ‘"2 3 4 5"’ and ‘"3i + 2i 4.5i 2i"’ and ‘"3c 2c 4c 10.43c"’ are all legal regions. + +relief + + Determines what the border style of a widget will be. Legal values + are: ‘"raised"’, ‘"sunken"’, ‘"flat"’, ‘"groove"’, and ‘"ridge"’. + +scrollcommand + + This is almost always the ‘set()’ method of some scrollbar widget, + but can be any widget method that takes a single argument. + +wrap + + Must be one of: ‘"none"’, ‘"char"’, or ‘"word"’. + + +File: python.info, Node: Bindings and Events, Next: The index Parameter, Prev: Tk Option Data Types, Up: Handy Reference + +5.26.1.17 Bindings and Events +............................. + +The bind method from the widget command allows you to watch for certain +events and to have a callback function trigger when that event type +occurs. The form of the bind method is: + + def bind(self, sequence, func, add=''): + +where: + +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 + + is a Python function, taking one argument, to be invoked when the + event occurs. An Event instance will be passed as the argument. + (Functions deployed this way are commonly known as 'callbacks'.) + +add + + is optional, either ‘''’ or ‘'+'’. Passing an empty string denotes + that this binding is to replace any other bindings that this event + is associated with. Passing a ‘'+'’ means that this function is to + be added to the list of functions bound to this event type. + +For example: + + def turn_red(self, event): + event.widget["activeforeground"] = "red" + + self.button.bind("", self.turn_red) + +Notice how the widget field of the event is being accessed in the +‘turn_red()’ callback. This field contains the widget that caught the X +event. The following table lists the other event fields you can access, +and how they are denoted in Tk, which can be useful when referring to +the Tk man pages. + +Tk Tkinter Event Field Tk Tkinter Event Field + +---------------------------------------------------------------------- + +%f focus %A char + + +%h height %E send_event + + +%k keycode %K keysym + + +%s state %N keysym_num + + +%t time %T type + + +%w width %W widget + + +%x x %X x_root + + +%y y %Y y_root + + + ---------- Footnotes ---------- + + (1) https://manpages.debian.org/bind(3tk) + + +File: python.info, Node: The index Parameter, Next: Images, Prev: Bindings and Events, Up: Handy Reference + +5.26.1.18 The index Parameter +............................. + +A number of widgets require “index” parameters to be passed. These are +used to point at a specific place in a Text widget, or to particular +characters in an Entry widget, or to particular menu items in a Menu +widget. + +Entry widget indexes (index, view index, etc.) + + Entry widgets have options that refer to character positions in the + text being displayed. You can use these *note tkinter: f0. + functions to access these special points in text widgets: + +Text widget indexes + + The index notation for Text widgets is very rich and is best + described in the Tk man pages. + +Menu indexes (menu.invoke(), menu.entryconfig(), etc.) + + Some options and methods for menus manipulate specific menu + entries. Anytime a menu index is needed for an option or a + parameter, you may pass in: + + * an integer which refers to the numeric position of the entry + in the widget, counted from the top, starting with 0; + + * the string ‘"active"’, which refers to the menu position that + is currently under the cursor; + + * the string ‘"last"’ which refers to the last menu item; + + * An integer preceded by ‘@’, as in ‘@6’, where the integer is + interpreted as a y pixel coordinate in the menu’s coordinate + system; + + * the string ‘"none"’, which indicates no menu entry at all, + most often used with menu.activate() to deactivate all + entries, and finally, + + * a text string that is pattern matched against the label of the + menu entry, as scanned from the top of the menu to the bottom. + Note that this index type is considered after all the others, + which means that matches for menu items labelled ‘last’, + ‘active’, or ‘none’ may be interpreted as the above literals, + instead. + + +File: python.info, Node: Images, Prev: The index Parameter, Up: Handy Reference + +5.26.1.19 Images +................ + +Images of different formats can be created through the corresponding +subclass of ‘tkinter.Image’: + + * ‘BitmapImage’ for images in XBM format. + + * ‘PhotoImage’ for images in PGM, PPM, GIF and PNG formats. The + latter is supported starting with Tk 8.6. + +Either type of image is created through either the ‘file’ or the ‘data’ +option (other options are available as well). + +Changed in version 3.13: Added the ‘PhotoImage’ method ‘copy_replace()’ +to copy a region from one image to other image, possibly with pixel +zooming and/or subsampling. Add 'from_coords' parameter to ‘PhotoImage’ +methods ‘copy()’, ‘zoom()’ and ‘subsample()’. Add 'zoom' and +'subsample' parameters to ‘PhotoImage’ method ‘copy()’. + +The image object can then be used wherever an ‘image’ option is +supported by some widget (e.g. labels, buttons, menus). In these +cases, Tk will not keep a reference to the image. When the last Python +reference to the image object is deleted, the image data is deleted as +well, and Tk will display an empty box wherever the image was used. + +See also +........ + +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: File Handlers, Prev: Handy Reference, Up: tkinter — Python interface to Tcl/Tk + +5.26.1.20 File Handlers +....................... + +Tk allows you to register and unregister a callback function which will +be called from the Tk mainloop when I/O is possible on a file +descriptor. Only one handler may be registered per file descriptor. +Example code: + + import tkinter + widget = tkinter.Tk() + mask = tkinter.READABLE | tkinter.WRITABLE + widget.tk.createfilehandler(file, mask, callback) + ... + widget.tk.deletefilehandler(file) + +This feature is not available on Windows. + +Since you don’t know how many bytes are available for reading, you may +not want to use the *note BufferedIOBase: 690. or *note TextIOBase: 691. +*note read(): 131b. or *note readline(): 131c. methods, since these will +insist on reading a predefined number of bytes. For sockets, the *note +recv(): da3. or *note recvfrom(): da4. methods will work fine; for other +files, use raw reads or ‘os.read(file.fileno(), maxbytecount)’. + + -- Method: Widget.tk.createfilehandler (file, mask, func) + + Registers the file handler callback function 'func'. The 'file' + argument may either be an object with a *note fileno(): 2856. + method (such as a file or socket object), or an integer file + descriptor. The 'mask' argument is an ORed combination of any of + the three constants below. The callback is called as follows: + + callback(file, mask) + + -- Method: Widget.tk.deletefilehandler (file) + + Unregisters a file handler. + + -- Data: _tkinter.READABLE + -- Data: _tkinter.WRITABLE + -- Data: _tkinter.EXCEPTION + + Constants used in the 'mask' arguments. + + +File: python.info, Node: tkinter colorchooser — Color choosing dialog, Next: tkinter font — Tkinter font wrapper, Prev: tkinter — Python interface to Tcl/Tk, Up: Graphical User Interfaces with Tk + +5.26.2 ‘tkinter.colorchooser’ — Color choosing dialog +----------------------------------------------------- + +'Source code:' Lib/tkinter/colorchooser.py(1) + +__________________________________________________________________ + +The *note tkinter.colorchooser: f1. module provides the *note Chooser: +3e63. 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: 3e64. class. + + -- Class: tkinter.colorchooser.Chooser (master=None, **options) + + -- Function: tkinter.colorchooser.askcolor (color=None, **options) + + Create a color choosing dialog. A call to this method will show + the window, wait for the user to make a selection, and return the + selected color (or ‘None’) to the caller. + +See also +........ + +Module *note tkinter.commondialog: f2. + + Tkinter standard dialog module + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/colorchooser.py + + +File: python.info, Node: tkinter font — Tkinter font wrapper, Next: Tkinter Dialogs, Prev: tkinter colorchooser — Color choosing dialog, Up: Graphical User Interfaces with Tk + +5.26.3 ‘tkinter.font’ — Tkinter font wrapper +-------------------------------------------- + +'Source code:' Lib/tkinter/font.py(1) + +__________________________________________________________________ + +The *note tkinter.font: f5. module provides the *note Font: 190a. class +for creating and using named fonts. + +The different font weights and slants are: + + -- Data: tkinter.font.NORMAL + -- Data: tkinter.font.BOLD + -- Data: tkinter.font.ITALIC + -- Data: tkinter.font.ROMAN + + -- Class: tkinter.font.Font (root=None, font=None, name=None, + exists=False, **options) + + The *note Font: 190a. 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) + + -- Method: actual (option=None, displayof=None) + + Return the attributes of the font. + + -- Method: cget (option) + + Retrieve an attribute of the font. + + -- Method: config (**options) + + Modify attributes of the font. + + -- Method: copy () + + Return new instance of the current font. + + -- Method: 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. + + -- Method: 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 + + -- Function: tkinter.font.families (root=None, displayof=None) + + Return the different font families. + + -- Function: tkinter.font.names (root=None) + + Return the names of defined fonts. + + -- Function: tkinter.font.nametofont (name, root=None) + + Return a *note Font: 190a. representation of a tk named font. + + Changed in version 3.10: The 'root' parameter was added. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tkinter/font.py + + +File: python.info, Node: Tkinter Dialogs, Next: tkinter messagebox — Tkinter message prompts, Prev: tkinter font — Tkinter font wrapper, Up: Graphical User Interfaces with Tk + +5.26.4 Tkinter Dialogs +---------------------- + +* Menu: + +* tkinter.simpledialog — Standard Tkinter input dialogs: tkinter simpledialog — Standard Tkinter input dialogs. +* tkinter.filedialog — File selection dialogs: tkinter filedialog — File selection dialogs. +* tkinter.commondialog — Dialog window templates: tkinter commondialog — Dialog window templates. + + +File: python.info, Node: tkinter simpledialog — Standard Tkinter input dialogs, Next: tkinter filedialog — File selection dialogs, Up: Tkinter Dialogs + +5.26.4.1 ‘tkinter.simpledialog’ — Standard Tkinter input dialogs +................................................................ + +'Source code:' Lib/tkinter/simpledialog.py(1) + +__________________________________________________________________ + +The *note tkinter.simpledialog: f8. module contains convenience classes +and functions for creating simple modal dialogs to get a value from the +user. + + -- Function: tkinter.simpledialog.askfloat (title, prompt, **kw) + -- Function: tkinter.simpledialog.askinteger (title, prompt, **kw) + -- Function: tkinter.simpledialog.askstring (title, prompt, **kw) + + The above three functions provide dialogs that prompt the user to + enter a value of the desired type. + + -- Class: tkinter.simpledialog.Dialog (parent, title=None) + + The base class for custom dialogs. + + -- Method: body (master) + + Override to construct the dialog’s interface and return the + widget that should have initial focus. + + -- Method: buttonbox () + + Default behaviour adds OK and Cancel buttons. Override for + custom button layouts. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/simpledialog.py + + +File: python.info, Node: tkinter filedialog — File selection dialogs, Next: tkinter commondialog — Dialog window templates, Prev: tkinter simpledialog — Standard Tkinter input dialogs, Up: Tkinter Dialogs + +5.26.4.2 ‘tkinter.filedialog’ — File selection dialogs +...................................................... + +'Source code:' Lib/tkinter/filedialog.py(1) + +__________________________________________________________________ + +The *note tkinter.filedialog: f4. module provides classes and factory +functions for creating file/directory selection windows. + +* Menu: + +* Native Load/Save Dialogs:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/filedialog.py + + +File: python.info, Node: Native Load/Save Dialogs, Up: tkinter filedialog — File selection dialogs + +5.26.4.3 Native Load/Save Dialogs +................................. + +The following classes and functions provide file dialog windows that +combine a native look-and-feel with configuration options to customize +behaviour. The following keyword arguments are applicable to the +classes and functions listed below: + + 'parent' - the window to place the dialog on top of + + 'title' - the title of the window + + 'initialdir' - the directory that the dialog starts in + + 'initialfile' - the file selected upon opening of the dialog + + 'filetypes' - a sequence of (label, pattern) tuples, ‘*’ wildcard is allowed + + 'defaultextension' - default extension to append to file (save dialogs) + + 'multiple' - when true, selection of multiple items is allowed + +'Static factory functions' + +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. + + -- Function: tkinter.filedialog.askopenfile (mode='r', **options) + -- Function: tkinter.filedialog.askopenfiles (mode='r', **options) + + The above two functions create an *note Open: 3e80. dialog and + return the opened file object(s) in read-only mode. + + -- Function: tkinter.filedialog.asksaveasfile (mode='w', **options) + + Create a *note SaveAs: 3e82. dialog and return a file object opened + in write-only mode. + + -- Function: tkinter.filedialog.askopenfilename (**options) + -- Function: tkinter.filedialog.askopenfilenames (**options) + + The above two functions create an *note Open: 3e80. dialog and + return the selected filename(s) that correspond to existing + file(s). + + -- Function: tkinter.filedialog.asksaveasfilename (**options) + + Create a *note SaveAs: 3e82. dialog and return the selected + filename. + + -- Function: tkinter.filedialog.askdirectory (**options) + + Prompt user to select a directory. + Additional keyword option: + 'mustexist' - determines if selection must be an existing directory. + + -- Class: tkinter.filedialog.Open (master=None, **options) + -- Class: tkinter.filedialog.SaveAs (master=None, **options) + + The above two classes provide native dialog windows for saving and + loading files. + +'Convenience classes' + +The below classes are used for creating file/directory windows from +scratch. These do not emulate the native look-and-feel of the platform. + + -- Class: tkinter.filedialog.Directory (master=None, **options) + + Create a dialog prompting the user to select a directory. + + Note: The 'FileDialog' class should be subclassed for custom event + handling and behaviour. + + -- Class: tkinter.filedialog.FileDialog (master, title=None) + + Create a basic file selection dialog. + + -- Method: cancel_command (event=None) + + Trigger the termination of the dialog window. + + -- Method: dirs_double_event (event) + + Event handler for double-click event on directory. + + -- Method: dirs_select_event (event) + + Event handler for click event on directory. + + -- Method: files_double_event (event) + + Event handler for double-click event on file. + + -- Method: files_select_event (event) + + Event handler for single-click event on file. + + -- Method: filter_command (event=None) + + Filter the files by directory. + + -- Method: get_filter () + + Retrieve the file filter currently in use. + + -- Method: get_selection () + + Retrieve the currently selected item. + + -- Method: go (dir_or_file=os.curdir, pattern='*', default='', + key=None) + + Render dialog and start event loop. + + -- Method: ok_event (event) + + Exit dialog returning current selection. + + -- Method: quit (how=None) + + Exit dialog returning filename, if any. + + -- Method: set_filter (dir, pat) + + Set the file filter. + + -- Method: set_selection (file) + + Update the current file selection to 'file'. + + -- Class: tkinter.filedialog.LoadFileDialog (master, title=None) + + A subclass of FileDialog that creates a dialog window for selecting + an existing file. + + -- Method: ok_command () + + Test that a file is provided and that the selection indicates + an already existing file. + + -- Class: tkinter.filedialog.SaveFileDialog (master, title=None) + + A subclass of FileDialog that creates a dialog window for selecting + a destination file. + + -- Method: 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 Dialogs + +5.26.4.4 ‘tkinter.commondialog’ — Dialog window templates +......................................................... + +'Source code:' Lib/tkinter/commondialog.py(1) + +__________________________________________________________________ + +The *note tkinter.commondialog: f2. module provides the *note Dialog: +3e64. class that is the base class for dialogs defined in other +supporting modules. + + -- Class: tkinter.commondialog.Dialog (master=None, **options) + + -- Method: show (**options) + + Render the Dialog window. + +See also +........ + +Modules *note tkinter.messagebox: f6, *note Reading and Writing Files: +1c7f. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/commondialog.py + + +File: python.info, Node: tkinter messagebox — Tkinter message prompts, Next: tkinter scrolledtext — Scrolled Text Widget, Prev: Tkinter Dialogs, Up: Graphical User Interfaces with Tk + +5.26.5 ‘tkinter.messagebox’ — Tkinter message prompts +----------------------------------------------------- + +'Source code:' Lib/tkinter/messagebox.py(1) + +__________________________________________________________________ + +The *note tkinter.messagebox: f6. 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: 3e9e, *note CANCEL: 3e9f, *note YES: +3ea0, *note NO: 3ea1.) 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 + -- Class: 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: 3ea3. of the default + button for this message window (*note OK: 3e9e, *note + CANCEL: 3e9f, 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: 3ea4. to display. If this + option is not specified, then the *note INFO: 3ea5. 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: 3ea6. to + be displayed. + + -- Method: 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. + +'Information message box' + + -- Function: tkinter.messagebox.showinfo (title=None, message=None, + **options) + + Creates and displays an information message box with the specified + title and message. + +'Warning message boxes' + + -- Function: tkinter.messagebox.showwarning (title=None, message=None, + **options) + + Creates and displays a warning message box with the specified title + and message. + + -- Function: tkinter.messagebox.showerror (title=None, message=None, + **options) + + Creates and displays an error message box with the specified title + and message. + +'Question message boxes' + + -- Function: tkinter.messagebox.askquestion (title=None, message=None, + *, type=YESNO, **options) + + Ask a question. By default shows buttons *note YES: 3ea0. and + *note NO: 3ea1. Returns the symbolic name of the selected button. + + -- Function: tkinter.messagebox.askokcancel (title=None, message=None, + **options) + + Ask if operation should proceed. Shows buttons *note OK: 3e9e. and + *note CANCEL: 3e9f. Returns ‘True’ if the answer is ok and ‘False’ + otherwise. + + -- Function: tkinter.messagebox.askretrycancel (title=None, + message=None, **options) + + Ask if operation should be retried. Shows buttons *note RETRY: + 3eae. and *note CANCEL: 3e9f. Return ‘True’ if the answer is yes + and ‘False’ otherwise. + + -- Function: tkinter.messagebox.askyesno (title=None, message=None, + **options) + + Ask a question. Shows buttons *note YES: 3ea0. and *note NO: 3ea1. + Returns ‘True’ if the answer is yes and ‘False’ otherwise. + + -- Function: tkinter.messagebox.askyesnocancel (title=None, + message=None, **options) + + Ask a question. Shows buttons *note YES: 3ea0, *note NO: 3ea1. and + *note CANCEL: 3e9f. Return ‘True’ if the answer is yes, ‘None’ if + cancelled, and ‘False’ otherwise. +Symbolic names of buttons: + + -- Data: tkinter.messagebox.ABORT = 'abort' + + -- Data: tkinter.messagebox.RETRY = 'retry' + + -- Data: tkinter.messagebox.IGNORE = 'ignore' + + -- Data: tkinter.messagebox.OK = 'ok' + + -- Data: tkinter.messagebox.CANCEL = 'cancel' + + -- Data: tkinter.messagebox.YES = 'yes' + + -- Data: tkinter.messagebox.NO = 'no' +Predefined sets of buttons: + + -- Data: tkinter.messagebox.ABORTRETRYIGNORE = 'abortretryignore' + + Displays three buttons whose symbolic names are *note ABORT: 3eb1, + *note RETRY: 3eae. and *note IGNORE: 3eb2. + + -- Data: tkinter.messagebox.OK = 'ok' + + Displays one button whose symbolic name is *note OK: 3e9e. + + -- Data: tkinter.messagebox.OKCANCEL = 'okcancel' + + Displays two buttons whose symbolic names are *note OK: 3e9e. and + *note CANCEL: 3e9f. + + -- Data: tkinter.messagebox.RETRYCANCEL = 'retrycancel' + + Displays two buttons whose symbolic names are *note RETRY: 3eae. + and *note CANCEL: 3e9f. + + -- Data: tkinter.messagebox.YESNO = 'yesno' + + Displays two buttons whose symbolic names are *note YES: 3ea0. and + *note NO: 3ea1. + + -- Data: tkinter.messagebox.YESNOCANCEL = 'yesnocancel' + + Displays three buttons whose symbolic names are *note YES: 3ea0, + *note NO: 3ea1. and *note CANCEL: 3e9f. +Icon images: + + -- Data: tkinter.messagebox.ERROR = 'error' + + -- Data: tkinter.messagebox.INFO = 'info' + + -- Data: tkinter.messagebox.QUESTION = 'question' + + -- Data: tkinter.messagebox.WARNING = 'warning' + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/messagebox.py + + +File: python.info, Node: tkinter scrolledtext — Scrolled Text Widget, Next: tkinter dnd — Drag and drop support, Prev: tkinter messagebox — Tkinter message prompts, Up: Graphical User Interfaces with Tk + +5.26.6 ‘tkinter.scrolledtext’ — Scrolled Text Widget +---------------------------------------------------- + +'Source code:' Lib/tkinter/scrolledtext.py(1) + +__________________________________________________________________ + +The *note tkinter.scrolledtext: f7. 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: +3ebd. class is a lot easier than setting up a text widget and scroll bar +directly. + +The text widget and scrollbar are packed together in a ‘Frame’, and the +methods of the ‘Grid’ and ‘Pack’ geometry managers are acquired from the +‘Frame’ object. This allows the *note ScrolledText: 3ebd. widget to be +used directly to achieve most normal geometry management behavior. + +Should more specific control be necessary, the following attributes are +available: + + -- Class: tkinter.scrolledtext.ScrolledText (master=None, **kw) + + -- Attribute: frame + + The frame which surrounds the text and scroll bar widgets. + + -- Attribute: vbar + + The scroll bar widget. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/tkinter/scrolledtext.py + + +File: python.info, Node: tkinter dnd — Drag and drop support, Next: tkinter ttk — Tk themed widgets, Prev: tkinter scrolledtext — Scrolled Text Widget, Up: Graphical User Interfaces with Tk + +5.26.7 ‘tkinter.dnd’ — Drag and drop support +-------------------------------------------- + +'Source code:' Lib/tkinter/dnd.py(1) + +__________________________________________________________________ + + Note: This is experimental and due to be deprecated when it is + replaced with the Tk DND. + +The *note tkinter.dnd: f3. module provides drag-and-drop support for +objects within a single application, within the same window or between +windows. To enable an object to be dragged, you must create an event +binding for it that starts the drag-and-drop process. Typically, you +bind a ButtonPress event to a callback function that you write (see +*note Bindings and Events: 3e56.). The function should call *note +dnd_start(): 3ec2, 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 '.dnd_leave(source, event)' + + 3. Call to '.dnd_enter(source, event)' + + 4. Call to '.dnd_commit(source, event)' to notify of drop + + 5. Call to '.dnd_end(target, event)' to signal end of + drag-and-drop + + -- Class: 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. + + -- Method: cancel (event=None) + + Cancel the drag-and-drop process. + + -- Method: finish (event, commit=0) + + Execute end of drag-and-drop functions. + + -- Method: on_motion (event) + + Inspect area below mouse for target objects while drag is + performed. + + -- Method: on_release (event) + + Signal end of drag when the release pattern is triggered. + + -- Function: tkinter.dnd.dnd_start (source, event) + + Factory function for drag-and-drop process. + +See also +........ + +*note Bindings and Events: 3e56. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tkinter/dnd.py + + +File: python.info, Node: tkinter ttk — Tk themed widgets, Next: IDLE — Python editor and shell<2>, Prev: tkinter dnd — Drag and drop support, Up: Graphical User Interfaces with Tk + +5.26.8 ‘tkinter.ttk’ — Tk themed widgets +---------------------------------------- + +'Source code:' Lib/tkinter/ttk.py(1) + +__________________________________________________________________ + +The *note tkinter.ttk: f9. 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 *note tkinter.ttk: f9. is to separate, to the extent +possible, the code implementing a widget’s behavior from the code +implementing its appearance. + +See also +........ + +Tk Widget Styling Support(2) + + A document introducing theming support for Tk + +* Menu: + +* Using Ttk:: +* Ttk Widgets:: +* Widget:: +* Combobox:: +* Spinbox:: +* Notebook:: +* Progressbar:: +* Separator:: +* Sizegrip:: +* Treeview:: +* Ttk Styling:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tkinter/ttk.py + + (2) https://core.tcl.tk/tips/doc/trunk/tip/48.md + + +File: python.info, Node: Using Ttk, Next: Ttk Widgets, Up: tkinter ttk — Tk themed widgets + +5.26.8.1 Using Ttk +.................. + +To start using Ttk, import its module: + + from tkinter import ttk + +To override the basic Tk widgets, the import should follow the Tk +import: + + from tkinter import * + from tkinter.ttk import * + +That code causes several *note tkinter.ttk: f9. widgets (‘Button’, +‘Checkbutton’, ‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’, ‘Menubutton’, +‘PanedWindow’, ‘Radiobutton’, ‘Scale’ and ‘Scrollbar’) to automatically +replace the Tk widgets. + +This has the direct benefit of using the new widgets which gives a +better look and feel across platforms; however, the replacement widgets +are not completely compatible. The main difference is that widget +options such as “fg”, “bg” and others related to widget styling are no +longer present in Ttk widgets. Instead, use the ‘ttk.Style’ class for +improved styling effects. + +See also +........ + +Converting existing applications to use Tile widgets(1) + + A monograph (using Tcl terminology) about differences typically + encountered when moving applications to use the new widgets. + + ---------- Footnotes ---------- + + (1) https://tktable.sourceforge.net/tile/doc/converting.txt + + +File: python.info, Node: Ttk Widgets, Next: Widget, Prev: Using Ttk, Up: tkinter ttk — Tk themed widgets + +5.26.8.2 Ttk Widgets +.................... + +Ttk comes with 18 widgets, twelve of which already existed in tkinter: +‘Button’, ‘Checkbutton’, ‘Entry’, ‘Frame’, ‘Label’, ‘LabelFrame’, +‘Menubutton’, ‘PanedWindow’, ‘Radiobutton’, ‘Scale’, ‘Scrollbar’, and +*note Spinbox: b94. The other six are new: *note Combobox: 3ecc, *note +Notebook: 3ecd, *note Progressbar: 3ece, ‘Separator’, ‘Sizegrip’ and +*note Treeview: a94. And all them are subclasses of *note Widget: 3ecf. + +Using the Ttk widgets gives the application an improved look and feel. +As discussed above, there are differences in how the styling is coded. + +Tk code: + + l1 = tkinter.Label(text="Test", fg="black", bg="white") + l2 = tkinter.Label(text="Test", fg="black", bg="white") + +Ttk code: + + 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") + +For more information about *note TtkStyling: 3ed0, see the *note Style: +25b. class documentation. + + +File: python.info, Node: Widget, Next: Combobox, Prev: Ttk Widgets, Up: tkinter ttk — Tk themed widgets + +5.26.8.3 Widget +............... + +‘ttk.Widget’ defines standard options and methods supported by Tk themed +widgets and is not supposed to be directly instantiated. + +* Menu: + +* Standard Options:: +* Scrollable Widget Options:: +* Label Options:: +* Compatibility Options:: +* Widget States:: +* ttk.Widget: ttk Widget. + + +File: python.info, Node: Standard Options, Next: Scrollable Widget Options, Up: Widget + +5.26.8.4 Standard Options +......................... + +All the ‘ttk’ Widgets accept the following options: + +Option Description + +----------------------------------------------------------------------------------- + +class Specifies the window class. The class is used when querying the + option database for the window’s other options, to determine the + default bindtags for the window, and to select the widget’s + default layout and style. This option is read-only, and may + only be specified when the window is created. + + +cursor Specifies the mouse cursor to be used for the widget. If set to + the empty string (the default), the cursor is inherited for the + parent widget. + + +takefocus Determines whether the window accepts the focus during keyboard + traversal. 0, 1 or an empty string is returned. If 0 is + returned, it means that the window should be skipped entirely + during keyboard traversal. If 1, it means that the window + should receive the input focus as long as it is viewable. And + an empty string means that the traversal scripts make the + decision about whether or not to focus on the window. + + +style May be used to specify a custom widget style. + + + +File: python.info, Node: Scrollable Widget Options, Next: Label Options, Prev: Standard Options, Up: Widget + +5.26.8.5 Scrollable Widget Options +.................................. + +The following options are supported by widgets that are controlled by a +scrollbar. + +Option Description + +----------------------------------------------------------------------------------- + +xscrollcommand Used to communicate with horizontal scrollbars. + + When the view in the widget’s window change, the widget + will generate a Tcl command based on the scrollcommand. + + Usually this option consists of the method + ‘Scrollbar.set()’ of some scrollbar. This will cause the + scrollbar to be updated whenever the view in the window + changes. + + +yscrollcommand Used to communicate with vertical scrollbars. For some + more information, see above. + + + +File: python.info, Node: Label Options, Next: Compatibility Options, Prev: Scrollable Widget Options, Up: Widget + +5.26.8.6 Label Options +...................... + +The following options are supported by labels, buttons and other +button-like widgets. + +Option Description + +----------------------------------------------------------------------------------- + +text Specifies a text string to be displayed inside the widget. + + +textvariable Specifies a name whose value will be used in place of the + text option resource. + + +underline If set, specifies the index (0-based) of a character to + underline in the text string. The underline character is + used for mnemonic activation. + + +image Specifies an image to display. This is a list of 1 or more + elements. The first element is the default image name. The + rest of the list if a sequence of statespec/value pairs as + defined by *note Style.map(): 191d, specifying different + images to use when the widget is in a particular state or a + combination of states. All images in the list should have + the same size. + + +compound Specifies how to display the image relative to the text, in + the case both text and images options are present. Valid + values are: + + * text: display text only + + * image: display image only + + * top, bottom, left, right: display image above, below, + left of, or right of the text, respectively. + + * none: the default. display the image if present, + otherwise the text. + + +width If greater than zero, specifies how much space, in character + widths, to allocate for the text label, if less than zero, + specifies a minimum width. If zero or unspecified, the + natural width of the text label is used. + + + +File: python.info, Node: Compatibility Options, Next: Widget States, Prev: Label Options, Up: Widget + +5.26.8.7 Compatibility Options +.............................. + +Option Description + +---------------------------------------------------------------------------------- + +state May be set to “normal” or “disabled” to control the “disabled” + state bit. This is a write-only option: setting it changes the + widget state, but the *note Widget.state(): 3ed6. method does not + affect this option. + + + +File: python.info, Node: Widget States, Next: ttk Widget, Prev: Compatibility Options, Up: Widget + +5.26.8.8 Widget States +...................... + +The widget state is a bitmap of independent state flags. + +Flag Description + +----------------------------------------------------------------------------------- + +active The mouse cursor is over the widget and pressing a mouse button + will cause some action to occur + + +disabled Widget is disabled under program control + + +focus Widget has keyboard focus + + +pressed Widget is being pressed + + +selected “On”, “true”, or “current” for things like Checkbuttons and + radiobuttons + + +background Windows and Mac have a notion of an “active” or foreground + window. The 'background' state is set for widgets in a + background window, and cleared for those in the foreground + window + + +readonly Widget should not allow user modification + + +alternate A widget-specific alternate display format + + +invalid The widget’s value is invalid + + +A state specification is a sequence of state names, optionally prefixed +with an exclamation point indicating that the bit is off. + + +File: python.info, Node: ttk Widget, Prev: Widget States, Up: Widget + +5.26.8.9 ttk.Widget +................... + +Besides the methods described below, the ‘ttk.Widget’ supports the +methods ‘tkinter.Widget.cget()’ and ‘tkinter.Widget.configure()’. + + -- Class: tkinter.ttk.Widget + + -- Method: identify (x, y) + + Returns the name of the element at position 'x' 'y', or the + empty string if the point does not lie within any element. + + 'x' and 'y' are pixel coordinates relative to the widget. + + -- Method: instate (statespec, callback=None, *args, **kw) + + Test the widget’s state. If a callback is not specified, + returns ‘True’ if the widget state matches 'statespec' and + ‘False’ otherwise. If callback is specified then it is called + with args if widget state matches 'statespec'. + + -- Method: state (statespec=None) + + Modify or inquire widget state. If 'statespec' is specified, + sets the widget state according to it and return a new + 'statespec' indicating which flags were changed. If + 'statespec' is not specified, returns the currently enabled + state flags. + + 'statespec' will usually be a list or a tuple. + + +File: python.info, Node: Combobox, Next: Spinbox, Prev: Widget, Up: tkinter ttk — Tk themed widgets + +5.26.8.10 Combobox +.................. + +The ‘ttk.Combobox’ widget combines a text field with a pop-down list of +values. This widget is a subclass of ‘Entry’. + +Besides the methods inherited from *note Widget: 3ecf.: ‘Widget.cget()’, +‘Widget.configure()’, *note Widget.identify(): 3ed9, *note +Widget.instate(): 3eda. and *note Widget.state(): 3ed6, and the +following inherited from ‘Entry’: ‘Entry.bbox()’, ‘Entry.delete()’, +‘Entry.icursor()’, ‘Entry.index()’, ‘Entry.insert()’, +‘Entry.selection()’, ‘Entry.xview()’, it has some other methods, +described at ‘ttk.Combobox’. + +* Menu: + +* Options:: +* Virtual events:: +* ttk.Combobox: ttk Combobox. + + +File: python.info, Node: Options, Next: Virtual events, Up: Combobox + +5.26.8.11 Options +................. + +This widget accepts the following specific options: + +Option Description + +----------------------------------------------------------------------------------- + +exportselection Boolean value. If set, the widget selection is linked to + the Window Manager selection (which can be returned by + invoking Misc.selection_get, for example). + + +justify Specifies how the text is aligned within the widget. One + of “left”, “center”, or “right”. + + +height Specifies the height of the pop-down listbox, in rows. + + +postcommand A script (possibly registered with Misc.register) that is + called immediately before displaying the values. It may + specify which values to display. + + +state One of “normal”, “readonly”, or “disabled”. In the + “readonly” state, the value may not be edited directly, + and the user can only selection of the values from the + dropdown list. In the “normal” state, the text field is + directly editable. In the “disabled” state, no + interaction is possible. + + +textvariable Specifies a name whose value is linked to the widget + value. Whenever the value associated with that name + changes, the widget value is updated, and vice versa. See + ‘tkinter.StringVar’. + + +values Specifies the list of values to display in the drop-down + listbox. + + +width Specifies an integer value indicating the desired width of + the entry window, in average-size characters of the + widget’s font. + + + +File: python.info, Node: Virtual events, Next: ttk Combobox, Prev: Options, Up: Combobox + +5.26.8.12 Virtual events +........................ + +The combobox widgets generates a '<>' virtual event +when the user selects an element from the list of values. + + +File: python.info, Node: ttk Combobox, Prev: Virtual events, Up: Combobox + +5.26.8.13 ttk.Combobox +...................... + + -- Class: tkinter.ttk.Combobox + + -- Method: current (newindex=None) + + If 'newindex' is specified, sets the combobox value to the + element position 'newindex'. Otherwise, returns the index of + the current value or -1 if the current value is not in the + values list. + + -- Method: get () + + Returns the current value of the combobox. + + -- Method: set (value) + + Sets the value of the combobox to 'value'. + + +File: python.info, Node: Spinbox, Next: Notebook, Prev: Combobox, Up: tkinter ttk — Tk themed widgets + +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’. + +Besides the methods inherited from *note Widget: 3ecf.: ‘Widget.cget()’, +‘Widget.configure()’, *note Widget.identify(): 3ed9, *note +Widget.instate(): 3eda. and *note Widget.state(): 3ed6, and the +following inherited from ‘Entry’: ‘Entry.bbox()’, ‘Entry.delete()’, +‘Entry.icursor()’, ‘Entry.index()’, ‘Entry.insert()’, ‘Entry.xview()’, +it has some other methods, described at ‘ttk.Spinbox’. + +* Menu: + +* Options: Options<2>. +* Virtual events: Virtual events<2>. +* ttk.Spinbox: ttk Spinbox. + + +File: python.info, Node: Options<2>, Next: Virtual events<2>, Up: Spinbox + +5.26.8.15 Options +................. + +This widget accepts the following specific options: + +Option Description + +-------------------------------------------------------------------------------------- + +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: Virtual events<2>, Next: ttk Spinbox, Prev: Options<2>, Up: Spinbox + +5.26.8.16 Virtual events +........................ + +The spinbox widget generates an '<>' virtual event when the +user presses , and a '<>' virtual event when the user +presses . + + +File: python.info, Node: ttk Spinbox, Prev: Virtual events<2>, Up: Spinbox + +5.26.8.17 ttk.Spinbox +..................... + + -- Class: tkinter.ttk.Spinbox + + -- Method: get () + + Returns the current value of the spinbox. + + -- Method: set (value) + + Sets the value of the spinbox to 'value'. + + +File: python.info, Node: Notebook, Next: Progressbar, Prev: Spinbox, Up: tkinter ttk — Tk themed widgets + +5.26.8.18 Notebook +.................. + +Ttk Notebook widget manages a collection of windows and displays a +single one at a time. Each child window is associated with a tab, which +the user may select to change the currently displayed window. + +* Menu: + +* Options: Options<3>. +* Tab Options:: +* Tab Identifiers:: +* Virtual Events:: +* ttk.Notebook: ttk Notebook. + + +File: python.info, Node: Options<3>, Next: Tab Options, Up: Notebook + +5.26.8.19 Options +................. + +This widget accepts the following specific options: + +Option Description + +----------------------------------------------------------------------------------- + +height If present and greater than zero, specifies the desired height of + the pane area (not including internal padding or tabs). + Otherwise, the maximum height of all panes is used. + + +padding Specifies the amount of extra space to add around the outside of + the notebook. The padding is a list up to four length + specifications left top right bottom. If fewer than four elements + are specified, bottom defaults to top, right defaults to left, and + top defaults to left. + + +width If present and greater than zero, specified the desired width of + the pane area (not including internal padding). Otherwise, the + maximum width of all panes is used. + + + +File: python.info, Node: Tab Options, Next: Tab Identifiers, Prev: Options<3>, Up: Notebook + +5.26.8.20 Tab Options +..................... + +There are also specific options for tabs: + +Option Description + +----------------------------------------------------------------------------------- + +state Either “normal”, “disabled” or “hidden”. If “disabled”, then + the tab is not selectable. If “hidden”, then the tab is not + shown. + + +sticky Specifies how the child window is positioned within the pane + area. Value is a string containing zero or more of the + characters “n”, “s”, “e” or “w”. Each letter refers to a side + (north, south, east or west) that the child window will stick + to, as per the ‘grid()’ geometry manager. + + +padding Specifies the amount of extra space to add between the notebook + and this pane. Syntax is the same as for the option padding + used by this widget. + + +text Specifies a text to be displayed in the tab. + + +image Specifies an image to display in the tab. See the option image + described in *note Widget: 3ecf. + + +compound Specifies how to display the image relative to the text, in the + case both options text and image are present. See + *note Label Options: 3ed4. for legal values. + + +underline Specifies the index (0-based) of a character to underline in the + text string. The underlined character is used for mnemonic + activation if *note Notebook.enable_traversal(): 3eeb. is + called. + + + +File: python.info, Node: Tab Identifiers, Next: Virtual Events, Prev: Tab Options, Up: Notebook + +5.26.8.21 Tab Identifiers +......................... + +The tab_id present in several methods of ‘ttk.Notebook’ may take any of +the following forms: + + * An integer between zero and the number of tabs + + * The name of a child window + + * A positional specification of the form “@x,y”, which identifies the + tab + + * The literal string “current”, which identifies the currently + selected tab + + * The literal string “end”, which returns the number of tabs (only + valid for *note Notebook.index(): 3eed.) + + +File: python.info, Node: Virtual Events, Next: ttk Notebook, Prev: Tab Identifiers, Up: Notebook + +5.26.8.22 Virtual Events +........................ + +This widget generates a '<>' virtual event after a +new tab is selected. + + +File: python.info, Node: ttk Notebook, Prev: Virtual Events, Up: Notebook + +5.26.8.23 ttk.Notebook +...................... + + -- Class: tkinter.ttk.Notebook + + -- Method: add (child, **kw) + + Adds a new tab to the notebook. + + If window is currently managed by the notebook but hidden, it + is restored to its previous position. + + See *note Tab Options: 3eea. for the list of available + options. + + -- Method: forget (tab_id) + + Removes the tab specified by 'tab_id', unmaps and unmanages + the associated window. + + -- Method: hide (tab_id) + + Hides the tab specified by 'tab_id'. + + The tab will not be displayed, but the associated window + remains managed by the notebook and its configuration + remembered. Hidden tabs may be restored with the *note add(): + 3ef0. command. + + -- Method: identify (x, y) + + Returns the name of the tab element at position 'x', 'y', or + the empty string if none. + + -- Method: index (tab_id) + + Returns the numeric index of the tab specified by 'tab_id', or + the total number of tabs if 'tab_id' is the string “end”. + + -- Method: insert (pos, child, **kw) + + Inserts a pane at the specified position. + + 'pos' is either the string “end”, an integer index, or the + name of a managed child. If 'child' is already managed by the + notebook, moves it to the specified position. + + See *note Tab Options: 3eea. for the list of available + options. + + -- Method: select (tab_id=None) + + Selects the specified 'tab_id'. + + The associated child window will be displayed, and the + previously selected window (if different) is unmapped. If + 'tab_id' is omitted, returns the widget name of the currently + selected pane. + + -- Method: tab (tab_id, option=None, **kw) + + Query or modify the options of the specific 'tab_id'. + + If 'kw' is not given, returns a dictionary of the tab option + values. If 'option' is specified, returns the value of that + 'option'. Otherwise, sets the options to the corresponding + values. + + -- Method: tabs () + + Returns a list of windows managed by the notebook. + + -- Method: enable_traversal () + + Enable keyboard traversal for a toplevel window containing + this notebook. + + This will extend the bindings for the toplevel window + containing the notebook as follows: + + * ‘Control’-‘Tab’: selects the tab following the currently + selected one. + + * ‘Shift’-‘Control’-‘Tab’: selects the tab preceding the + currently selected one. + + * ‘Alt’-‘K’: where 'K' is the mnemonic (underlined) + character of any tab, will select that tab. + + Multiple notebooks in a single toplevel may be enabled for + traversal, including nested notebooks. However, notebook + traversal only works properly if all panes have the notebook + they are in as master. + + +File: python.info, Node: Progressbar, Next: Separator, Prev: Notebook, Up: tkinter ttk — Tk themed widgets + +5.26.8.24 Progressbar +..................... + +The ‘ttk.Progressbar’ widget shows the status of a long-running +operation. It can operate in two modes: 1) the determinate mode which +shows the amount completed relative to the total amount of work to be +done and 2) the indeterminate mode which provides an animated display to +let the user know that work is progressing. + +* Menu: + +* Options: Options<4>. +* ttk.Progressbar: ttk Progressbar. + + +File: python.info, Node: Options<4>, Next: ttk Progressbar, Up: Progressbar + +5.26.8.25 Options +................. + +This widget accepts the following specific options: + +Option Description + +----------------------------------------------------------------------------------- + +orient One of “horizontal” or “vertical”. Specifies the orientation of + the progress bar. + + +length Specifies the length of the long axis of the progress bar (width + if horizontal, height if vertical). + + +mode One of “determinate” or “indeterminate”. + + +maximum A number specifying the maximum value. Defaults to 100. + + +value The current value of the progress bar. In “determinate” mode, + this represents the amount of work completed. In “indeterminate” + mode, it is interpreted as modulo 'maximum'; that is, the + progress bar completes one “cycle” when its value increases by + 'maximum'. + + +variable A name which is linked to the option value. If specified, the + value of the progress bar is automatically set to the value of + this name whenever the latter is modified. + + +phase Read-only option. The widget periodically increments the value + of this option whenever its value is greater than 0 and, in + determinate mode, less than maximum. This option may be used by + the current theme to provide additional animation effects. + + + +File: python.info, Node: ttk Progressbar, Prev: Options<4>, Up: Progressbar + +5.26.8.26 ttk.Progressbar +......................... + + -- Class: tkinter.ttk.Progressbar + + -- Method: start (interval=None) + + Begin autoincrement mode: schedules a recurring timer event + that calls *note Progressbar.step(): 3efc. every 'interval' + milliseconds. If omitted, 'interval' defaults to 50 + milliseconds. + + -- Method: step (amount=None) + + Increments the progress bar’s value by 'amount'. + + 'amount' defaults to 1.0 if omitted. + + -- Method: stop () + + Stop autoincrement mode: cancels any recurring timer event + initiated by *note Progressbar.start(): 3efb. for this + progress bar. + + +File: python.info, Node: Separator, Next: Sizegrip, Prev: Progressbar, Up: tkinter ttk — Tk themed widgets + +5.26.8.27 Separator +................... + +The ‘ttk.Separator’ widget displays a horizontal or vertical separator +bar. + +It has no other methods besides the ones inherited from ‘ttk.Widget’. + +* Menu: + +* Options: Options<5>. + + +File: python.info, Node: Options<5>, Up: Separator + +5.26.8.28 Options +................. + +This widget accepts the following specific option: + +Option Description + +---------------------------------------------------------------------------------- + +orient One of “horizontal” or “vertical”. Specifies the orientation of + the separator. + + + +File: python.info, Node: Sizegrip, Next: Treeview, Prev: Separator, Up: tkinter ttk — Tk themed widgets + +5.26.8.29 Sizegrip +.................. + +The ‘ttk.Sizegrip’ widget (also known as a grow box) allows the user to +resize the containing toplevel window by pressing and dragging the grip. + +This widget has neither specific options nor specific methods, besides +the ones inherited from ‘ttk.Widget’. + +* Menu: + +* Platform-specific notes:: +* Bugs:: + + +File: python.info, Node: Platform-specific notes, Next: Bugs, Up: Sizegrip + +5.26.8.30 Platform-specific notes +................................. + + * On macOS, toplevel windows automatically include a built-in size + grip by default. Adding a ‘Sizegrip’ is harmless, since the + built-in grip will just mask the widget. + + +File: python.info, Node: Bugs, Prev: Platform-specific notes, Up: Sizegrip + +5.26.8.31 Bugs +.............. + + * If the containing toplevel’s position was specified relative to the + right or bottom of the screen (e.g. ….), the ‘Sizegrip’ widget + will not resize the window. + + * This widget supports only “southeast” resizing. + + +File: python.info, Node: Treeview, Next: Ttk Styling, Prev: Sizegrip, Up: tkinter ttk — Tk themed widgets + +5.26.8.32 Treeview +.................. + +The ‘ttk.Treeview’ widget displays a hierarchical collection of items. +Each item has a textual label, an optional image, and an optional list +of data values. The data values are displayed in successive columns +after the tree label. + +The order in which data values are displayed may be controlled by +setting the widget option ‘displaycolumns’. The tree widget can also +display column headings. Columns may be accessed by number or symbolic +names listed in the widget option columns. See *note Column +Identifiers: 3f04. + +Each item is identified by a unique name. The widget will generate item +IDs if they are not supplied by the caller. There is a distinguished +root item, named ‘{}’. The root item itself is not displayed; its +children appear at the top level of the hierarchy. + +Each item also has a list of tags, which can be used to associate event +bindings with individual items and control the appearance of the item. + +The Treeview widget supports horizontal and vertical scrolling, +according to the options described in *note Scrollable Widget Options: +3ed3. and the methods *note Treeview.xview(): 3f05. and *note +Treeview.yview(): 3f06. + +* Menu: + +* Options: Options<6>. +* Item Options:: +* Tag Options:: +* Column Identifiers:: +* Virtual Events: Virtual Events<2>. +* ttk.Treeview: ttk Treeview. + + +File: python.info, Node: Options<6>, Next: Item Options, Up: Treeview + +5.26.8.33 Options +................. + +This widget accepts the following specific options: + +Option Description + +---------------------------------------------------------------------------------- + +columns A list of column identifiers, specifying the number of + columns and their names. + + +displaycolumns A list of column identifiers (either symbolic or integer + indices) specifying which data columns are displayed and + the order in which they appear, or the string “#all”. + + +height Specifies the number of rows which should be visible. + Note: the requested width is determined from the sum of + the column widths. + + +padding Specifies the internal padding for the widget. The + padding is a list of up to four length specifications. + + +selectmode Controls how the built-in class bindings manage the + selection. One of “extended”, “browse” or “none”. If set + to “extended” (the default), multiple items may be + selected. If “browse”, only a single item will be + selected at a time. If “none”, the selection will not be + changed. + + Note that the application code and tag bindings can set + the selection however they wish, regardless of the value + of this option. + + +show A list containing zero or more of the following values, + specifying which elements of the tree to display. + + * tree: display tree labels in column #0. + + * headings: display the heading row. + + The default is “tree headings”, i.e., show all elements. + + 'Note': Column #0 always refers to the tree column, even + if show=”tree” is not specified. + + + +File: python.info, Node: Item Options, Next: Tag Options, Prev: Options<6>, Up: Treeview + +5.26.8.34 Item Options +...................... + +The following item options may be specified for items in the insert and +item widget commands. + +Option Description + +--------------------------------------------------------------------------------- + +text The textual label to display for the item. + + +image A Tk Image, displayed to the left of the label. + + +values The list of values associated with the item. + + Each item should have the same number of values as the widget + option columns. If there are fewer values than columns, the + remaining values are assumed empty. If there are more values + than columns, the extra values are ignored. + + +open ‘True’/‘False’ value indicating whether the item’s children + should be displayed or hidden. + + +tags A list of tags associated with this item. + + + +File: python.info, Node: Tag Options, Next: Column Identifiers, Prev: Item Options, Up: Treeview + +5.26.8.35 Tag Options +..................... + +The following options may be specified on tags: + +Option Description + +--------------------------------------------------------------------------------- + +foreground Specifies the text foreground color. + + +background Specifies the cell or item background color. + + +font Specifies the font to use when drawing text. + + +image Specifies the item image, in case the item’s image option is + empty. + + + +File: python.info, Node: Column Identifiers, Next: Virtual Events<2>, Prev: Tag Options, Up: Treeview + +5.26.8.36 Column Identifiers +............................ + +Column identifiers take any of the following forms: + + * A symbolic name from the list of columns option. + + * An integer n, specifying the nth data column. + + * A string of the form #n, where n is an integer, specifying the nth + display column. + +Notes: + + * Item’s option values may be displayed in a different order than the + order in which they are stored. + + * Column #0 always refers to the tree column, even if show=”tree” is + not specified. + +A data column number is an index into an item’s option values list; a +display column number is the column number in the tree where the values +are displayed. Tree labels are displayed in column #0. If option +displaycolumns is not set, then data column n is displayed in column +#n+1. Again, 'column #0 always refers to the tree column'. + + +File: python.info, Node: Virtual Events<2>, Next: ttk Treeview, Prev: Column Identifiers, Up: Treeview + +5.26.8.37 Virtual Events +........................ + +The Treeview widget generates the following virtual events. + +Event Description + +-------------------------------------------------------------------------------- + +<> Generated whenever the selection changes. + + +<> Generated just before settings the focus item to + open=True. + + +<> Generated just after setting the focus item to + open=False. + + +The *note Treeview.focus(): 3f0b. and *note Treeview.selection(): a93. +methods can be used to determine the affected item or items. + + +File: python.info, Node: ttk Treeview, Prev: Virtual Events<2>, Up: Treeview + +5.26.8.38 ttk.Treeview +...................... + + -- Class: tkinter.ttk.Treeview + + -- Method: bbox (item, column=None) + + Returns the bounding box (relative to the treeview widget’s + window) of the specified 'item' in the form (x, y, width, + height). + + If 'column' is specified, returns the bounding box of that + cell. If the 'item' is not visible (i.e., if it is a + descendant of a closed item or is scrolled offscreen), returns + an empty string. + + -- Method: get_children (item=None) + + Returns the list of children belonging to 'item'. + + If 'item' is not specified, returns root children. + + -- Method: set_children (item, *newchildren) + + Replaces 'item'’s child with 'newchildren'. + + Children present in 'item' that are not present in + 'newchildren' are detached from the tree. No items in + 'newchildren' may be an ancestor of 'item'. Note that not + specifying 'newchildren' results in detaching 'item'’s + children. + + -- Method: column (column, option=None, **kw) + + Query or modify the options for the specified 'column'. + + If 'kw' is not given, returns a dict of the column option + values. If 'option' is specified then the value for that + 'option' is returned. Otherwise, sets the options to the + corresponding values. + + The valid options/values are: + + 'id' + + Returns the column name. This is a read-only option. + + 'anchor': One of the standard Tk anchor values. + + Specifies how the text in this column should be aligned + with respect to the cell. + + 'minwidth': width + + The minimum width of the column in pixels. The treeview + widget will not make the column any smaller than + specified by this option when the widget is resized or + the user drags a column. + + 'stretch': ‘True’/‘False’ + + Specifies whether the column’s width should be adjusted + when the widget is resized. + + 'width': width + + The width of the column in pixels. + + To configure the tree column, call this with column = “#0” + + -- Method: delete (*items) + + Delete all specified 'items' and all their descendants. + + The root item may not be deleted. + + -- Method: detach (*items) + + Unlinks all of the specified 'items' from the tree. + + The items and all of their descendants are still present, and + may be reinserted at another point in the tree, but will not + be displayed. + + The root item may not be detached. + + -- Method: exists (item) + + Returns ‘True’ if the specified 'item' is present in the tree. + + -- Method: focus (item=None) + + If 'item' is specified, sets the focus item to 'item'. + Otherwise, returns the current focus item, or ‘’ if there is + none. + + -- Method: heading (column, option=None, **kw) + + Query or modify the heading options for the specified + 'column'. + + If 'kw' is not given, returns a dict of the heading option + values. If 'option' is specified then the value for that + 'option' is returned. Otherwise, sets the options to the + corresponding values. + + The valid options/values are: + + 'text': text + + The text to display in the column heading. + + 'image': imageName + + Specifies an image to display to the right of the column + heading. + + 'anchor': anchor + + Specifies how the heading text should be aligned. One of + the standard Tk anchor values. + + 'command': callback + + A callback to be invoked when the heading label is + pressed. + + To configure the tree column heading, call this with column = + “#0”. + + -- Method: identify (component, x, y) + + Returns a description of the specified 'component' under the + point given by 'x' and 'y', or the empty string if no such + 'component' is present at that position. + + -- Method: identify_row (y) + + Returns the item ID of the item at position 'y'. + + -- Method: identify_column (x) + + Returns the data column identifier of the cell at position + 'x'. + + The tree column has ID #0. + + -- Method: identify_region (x, y) + + Returns one of: + + region meaning + + ----------------------------------------------------------- + + heading Tree heading area. + + + separator Space between two columns headings. + + + tree The tree area. + + + cell A data cell. + + + Availability: Tk 8.6. + + -- Method: identify_element (x, y) + + Returns the element at position 'x', 'y'. + + Availability: Tk 8.6. + + -- Method: index (item) + + Returns the integer index of 'item' within its parent’s list + of children. + + -- Method: insert (parent, index, iid=None, **kw) + + Creates a new item and returns the item identifier of the + newly created item. + + 'parent' is the item ID of the parent item, or the empty + string to create a new top-level item. 'index' is an integer, + or the value “end”, specifying where in the list of parent’s + children to insert the new item. If 'index' is less than or + equal to zero, the new node is inserted at the beginning; if + 'index' is greater than or equal to the current number of + children, it is inserted at the end. If 'iid' is specified, + it is used as the item identifier; 'iid' must not already + exist in the tree. Otherwise, a new unique identifier is + generated. + + See *note Item Options: 3f08. for the list of available + options. + + -- Method: item (item, option=None, **kw) + + Query or modify the options for the specified 'item'. + + If no options are given, a dict with options/values for the + item is returned. If 'option' is specified then the value for + that option is returned. Otherwise, sets the options to the + corresponding values as given by 'kw'. + + -- Method: move (item, parent, index) + + Moves 'item' to position 'index' in 'parent'’s list of + children. + + It is illegal to move an item under one of its descendants. + If 'index' is less than or equal to zero, 'item' is moved to + the beginning; if greater than or equal to the number of + children, it is moved to the end. If 'item' was detached it + is reattached. + + -- Method: next (item) + + Returns the identifier of 'item'’s next sibling, or ‘’ if + 'item' is the last child of its parent. + + -- Method: parent (item) + + Returns the ID of the parent of 'item', or ‘’ if 'item' is at + the top level of the hierarchy. + + -- Method: prev (item) + + Returns the identifier of 'item'’s previous sibling, or ‘’ if + 'item' is the first child of its parent. + + -- Method: reattach (item, parent, index) + + An alias for *note Treeview.move(): 3f1d. + + -- Method: see (item) + + Ensure that 'item' is visible. + + Sets all of 'item'’s ancestors open option to ‘True’, and + scrolls the widget if necessary so that 'item' is within the + visible portion of the tree. + + -- Method: selection () + + Returns a tuple of selected items. + + Changed in version 3.8: ‘selection()’ no longer takes + arguments. For changing the selection state use the following + selection methods. + + -- Method: selection_set (*items) + + 'items' becomes the new selection. + + Changed in version 3.6: 'items' can be passed as separate + arguments, not just as a single tuple. + + -- Method: selection_add (*items) + + Add 'items' to the selection. + + Changed in version 3.6: 'items' can be passed as separate + arguments, not just as a single tuple. + + -- Method: selection_remove (*items) + + Remove 'items' from the selection. + + Changed in version 3.6: 'items' can be passed as separate + arguments, not just as a single tuple. + + -- Method: selection_toggle (*items) + + Toggle the selection state of each item in 'items'. + + Changed in version 3.6: 'items' can be passed as separate + arguments, not just as a single tuple. + + -- Method: set (item, column=None, value=None) + + With one argument, returns a dictionary of column/value pairs + for the specified 'item'. With two arguments, returns the + current value of the specified 'column'. With three + arguments, sets the value of given 'column' in given 'item' to + the specified 'value'. + + -- Method: tag_bind (tagname, sequence=None, callback=None) + + Bind a callback for the given event 'sequence' to the tag + 'tagname'. When an event is delivered to an item, the + callbacks for each of the item’s tags option are called. + + -- Method: tag_configure (tagname, option=None, **kw) + + Query or modify the options for the specified 'tagname'. + + If 'kw' is not given, returns a dict of the option settings + for 'tagname'. If 'option' is specified, returns the value + for that 'option' for the specified 'tagname'. Otherwise, + sets the options to the corresponding values for the given + 'tagname'. + + -- Method: tag_has (tagname, item=None) + + If 'item' is specified, returns 1 or 0 depending on whether + the specified 'item' has the given 'tagname'. Otherwise, + returns a list of all items that have the specified tag. + + Availability: Tk 8.6 + + -- Method: xview (*args) + + Query or modify horizontal position of the treeview. + + -- Method: yview (*args) + + Query or modify vertical position of the treeview. + + +File: python.info, Node: Ttk Styling, Prev: Treeview, Up: tkinter ttk — Tk themed widgets + +5.26.8.39 Ttk Styling +..................... + +Each widget in ‘ttk’ is assigned a style, which specifies the set of +elements making up the widget and how they are arranged, along with +dynamic and default settings for element options. By default the style +name is the same as the widget’s class name, but it may be overridden by +the widget’s style option. If you don’t know the class name of a +widget, use the method ‘Misc.winfo_class()’ (somewidget.winfo_class()). + +See also +........ + +Tcl'2004 conference presentation(1) + + This document explains how the theme engine works + + -- Class: tkinter.ttk.Style + + This class is used to manipulate the style database. + + -- Method: configure (style, query_opt=None, **kw) + + Query or set the default value of the specified option(s) in + 'style'. + + Each key in 'kw' is an option and each value is a string + identifying the value for that option. + + For example, to change every default button to be a flat + button with some padding and a different background color: + + 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() + + -- Method: map (style, query_opt=None, **kw) + + Query or sets dynamic values of the specified option(s) in + 'style'. + + Each key in 'kw' is an option and each value should be a list + or a tuple (usually) containing statespecs grouped in tuples, + lists, or some other preference. A statespec is a compound of + one or more states and then a value. + + An example may make it more understandable: + + 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() + + Note that the order of the (states, value) sequences for an + option does matter, if the order is changed to ‘[('active', + 'blue'), ('pressed', 'red')]’ in the foreground option, for + example, the result would be a blue foreground when the widget + were in active or pressed states. + + -- Method: lookup (style, option, state=None, default=None) + + Returns the value specified for 'option' in 'style'. + + If 'state' is specified, it is expected to be a sequence of + one or more states. If the 'default' argument is set, it is + used as a fallback value in case no specification for option + is found. + + To check what font a Button uses by default: + + from tkinter import ttk + + print(ttk.Style().lookup("TButton", "font")) + + -- Method: layout (style, layoutspec=None) + + Define the widget layout for given 'style'. If 'layoutspec' + is omitted, return the layout specification for given style. + + 'layoutspec', if specified, is expected to be a list or some + other sequence type (excluding strings), where each item + should be a tuple and the first item is the layout name and + the second item should have the format described in *note + Layouts: 3f2e. + + To understand the format, see the following example (it is not + intended to do anything useful): + + 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() + + -- Method: 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. + + If “image” is used, 'args' should contain the default image + name followed by statespec/value pairs (this is the + imagespec), and 'kw' may have the following options: + + border=padding + + padding is a list of up to four integers, specifying the + left, top, right, and bottom borders, respectively. + + height=height + + Specifies a minimum height for the element. If less than + zero, the base image’s height is used as a default. + + padding=padding + + Specifies the element’s interior padding. Defaults to + border’s value if not specified. + + sticky=spec + + Specifies how the image is placed within the final + parcel. spec contains zero or more characters “n”, “s”, + “w”, or “e”. + + width=width + + Specifies a minimum width for the element. If less than + zero, the base image’s width is used as a default. + + Example: + + 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') + + If “from” is used as the value of 'etype', *note + element_create(): 25a. will clone an existing element. 'args' + is expected to contain a themename, from which the element + will be cloned, and optionally an element to clone from. If + this element to clone from is not specified, an empty element + will be used. 'kw' is discarded. + + Example: + + style = ttk.Style(root) + style.element_create('plain.background', 'from', 'default') + + If “vsapi” is used as the value of 'etype', *note + element_create(): 25a. 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'. + + Example: + + 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') + + Changed in version 3.13: Added support of the “vsapi” element + factory. + + -- Method: element_names () + + Returns the list of elements defined in the current theme. + + -- Method: element_options (elementname) + + Returns the list of 'elementname'’s options. + + -- Method: theme_create (themename, parent=None, settings=None) + + Create a new theme. + + It is an error if 'themename' already exists. If 'parent' is + specified, the new theme will inherit styles, elements and + layouts from the parent theme. If 'settings' are present they + are expected to have the same syntax used for *note + theme_settings(): 3f32. + + -- Method: theme_settings (themename, settings) + + Temporarily sets the current theme to 'themename', apply + specified 'settings' and then restore the previous theme. + + Each key in 'settings' is a style and each value may contain + the keys ‘configure’, ‘map’, ‘layout’ and ‘element create’ and + they are expected to have the same format as specified by the + methods *note Style.configure(): 3f2b, *note Style.map(): + 191d, *note Style.layout(): 3f2d. and *note + Style.element_create(): 25a. respectively. + + As an example, let’s change the Combobox for the default theme + a bit: + + 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() + + -- Method: theme_names () + + Returns a list of all known themes. + + -- Method: theme_use (themename=None) + + If 'themename' is not given, returns the theme in use. + Otherwise, sets the current theme to 'themename', refreshes + all widgets and emits a <> event. + +* Menu: + +* Layouts:: + + ---------- Footnotes ---------- + + (1) https://tktable.sourceforge.net/tile/tile-tcl2004.pdf + + +File: python.info, Node: Layouts, Up: Ttk Styling + +5.26.8.40 Layouts +................. + +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. + +The valid options/values are: + +'side': whichside + + Specifies which side of the cavity to place the element; one of + top, right, bottom or left. If omitted, the element occupies the + entire cavity. + +'sticky': nswe + + Specifies where the element is placed inside its allocated parcel. + +'unit': 0 or 1 + + If set to 1, causes the element and all of its descendants to be + treated as a single element for the purposes of *note + Widget.identify(): 3ed9. et al. It’s used for things like + scrollbar thumbs with grips. + +'children': [sublayout… ] + + Specifies a list of elements to place inside the element. Each + element is a tuple (or other sequence type) where the first item is + the layout name, and the other is a *note Layout: 3f2e. + + +File: python.info, Node: IDLE — Python editor and shell<2>, Prev: tkinter ttk — Tk themed widgets, Up: Graphical User Interfaces with Tk + +5.26.9 IDLE — Python editor and shell +------------------------------------- + +'Source code:' Lib/idlelib/(1) + +__________________________________________________________________ + +IDLE is Python’s Integrated Development and Learning Environment. + +IDLE has the following features: + + * cross-platform: works mostly the same on Windows, Unix, and macOS + + * Python shell window (interactive interpreter) with colorizing of + code input, output, and error messages + + * multi-window text editor with multiple undo, Python colorizing, + smart indent, call tips, auto completion, and other features + + * search within any window, replace within editor windows, and search + through multiple files (grep) + + * debugger with persistent breakpoints, stepping, and viewing of + global and local namespaces + + * configuration, browsers, and other dialogs + +* Menu: + +* Menus:: +* Editing and Navigation:: +* Startup and Code Execution:: +* Help and Preferences:: +* idlelib — implementation of IDLE application:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/idlelib/ + + +File: python.info, Node: Menus, Next: Editing and Navigation, Up: IDLE — Python editor and shell<2> + +5.26.9.1 Menus +.............. + +IDLE has two main window types, the Shell window and the Editor window. +It is possible to have multiple editor windows simultaneously. On +Windows and Linux, each has its own top menu. Each menu documented +below indicates which window type it is associated with. + +Output windows, such as used for Edit => Find in Files, are a subtype of +editor window. They currently have the same top menu but a different +default title and context menu. + +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 menu (Shell and Editor): File menu Shell and Editor. +* Edit menu (Shell and Editor): Edit menu Shell and Editor. +* Format menu (Editor window only): Format menu Editor window only. +* Run menu (Editor window only): Run menu Editor window only. +* Shell menu (Shell window only): Shell menu Shell window only. +* Debug menu (Shell window only): Debug menu Shell window only. +* Options menu (Shell and Editor): Options menu Shell and Editor. +* Window menu (Shell and Editor): Window menu Shell and Editor. +* Help menu (Shell and Editor): Help menu Shell and Editor. +* Context menus:: + + +File: python.info, Node: File menu Shell and Editor, Next: Edit menu Shell and Editor, Up: Menus + +5.26.9.2 File menu (Shell and Editor) +..................................... + +New File + + Create a new file editing window. + +Open… + + Open an existing file with an Open dialog. + +Open Module… + + Open an existing module (searches sys.path). + +Recent Files + + Open a list of recent files. Click one to open it. + +Module Browser + + Show functions, classes, and methods in the current Editor file in + a tree structure. In the shell, open a module first. + +Path Browser + + Show sys.path directories, modules, functions, classes and methods + in a tree structure. + +Save + + Save the current window to the associated file, if there is one. + Windows that have been changed since being opened or last saved + have a * before and after the window title. If there is no + associated file, do Save As instead. + +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 + namager 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 + + Print the current window to the default printer. + +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 menu Shell and Editor, Next: Format menu Editor window only, Prev: File menu Shell and Editor, Up: Menus + +5.26.9.3 Edit menu (Shell and Editor) +..................................... + +Undo + + Undo the last change to the current window. A maximum of 1000 + changes may be undone. + +Redo + + Redo the last undone change to the current window. + +Select All + + Select the entire contents of the current window. + +Cut + + Copy selection into the system-wide clipboard; then delete the + selection. + +Copy + + Copy selection into the system-wide clipboard. + +Paste + + Insert contents of the system-wide clipboard into the current + window. + +The clipboard functions are also available in context menus. + +Find… + + Open a search dialog with many options + +Find Again + + Repeat the last search, if there is one. + +Find Selection + + Search for the currently selected string, if there is one. + +Find in Files… + + Open a file search dialog. Put results in a new output window. + +Replace… + + Open a search-and-replace dialog. + +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: 3f3b. in the Editing and navigation section + below. + +Expand Word + + Expand a prefix you have typed to match a full word in the same + window; repeat to get a different expansion. + +Show Call Tip + + After an unclosed parenthesis for a function, open a small window + with function parameter hints. See *note Calltips: 3f3c. in the + Editing and navigation section below. + +Show Surrounding Parens + + Highlight the surrounding parenthesis. + + +File: python.info, Node: Format menu Editor window only, Next: Run menu Editor window only, Prev: Edit menu Shell and Editor, Up: Menus + +5.26.9.4 Format menu (Editor window only) +......................................... + +Format Paragraph + + Reformat the current blank-line-delimited paragraph in comment + block or multiline string or selected line in a string. All lines + in the paragraph will be formatted to less than N columns, where N + defaults to 72. + +Indent Region + + Shift selected lines right by the indent width (default 4 spaces). + +Dedent Region + + Shift selected lines left by the indent width (default 4 spaces). + +Comment Out Region + + Insert ## in front of selected lines. + +Uncomment Region + + Remove leading # or ## from selected lines. + +Tabify Region + + Turn 'leading' stretches of spaces into tabs. (Note: We recommend + using 4 space blocks to indent Python code.) + +Untabify Region + + Turn 'all' tabs into the correct number of spaces. + +Toggle Tabs + + Open a dialog to switch between indenting with spaces and tabs. + +New Indent Width + + Open a dialog to change indent width. The accepted default by the + Python community is 4 spaces. + +Strip Trailing Chitespace + + Remove trailing space and other whitespace characters after the + last non-whitespace character of a line by applying str.rstrip 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 menu Editor window only, Next: Shell menu Shell window only, Prev: Format menu Editor window only, Up: Menus + +5.26.9.5 Run menu (Editor window only) +...................................... + +Run Module + + Do *note Check Module: 3f41. If no error, restart the shell to + clean the environment, then execute the module. Output is + displayed in the Shell window. Note that output requires use of + ‘print’ or ‘write’. When execution is complete, the Shell retains + focus and displays a prompt. At this point, one may interactively + explore the result of execution. This is similar to executing a + file with ‘python -i file’ at a command line. + +Run… Customized + + Same as *note Run Module: 3f40, but run the module with customized + settings. 'Command Line Arguments' extend *note sys.argv: 1258. as + if passed on a command line. The module can be run in the Shell + without restarting. + +Check Module + + Check the syntax of the module currently open in the Editor window. + If the module has not been saved IDLE will either prompt the user + to save or autosave, as selected in the General tab of the Idle + Settings dialog. If there is a syntax error, the approximate + location is indicated in the Editor window. + +Python Shell + + Open or wake up the Python Shell window. + + +File: python.info, Node: Shell menu Shell window only, Next: Debug menu Shell window only, Prev: Run menu Editor window only, Up: Menus + +5.26.9.6 Shell menu (Shell window only) +....................................... + +View Last Restart + + Scroll the shell window to the last Shell restart. + +Restart 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 + + Stop a running program. + + +File: python.info, Node: Debug menu Shell window only, Next: Options menu Shell and Editor, Prev: Shell menu Shell window only, Up: Menus + +5.26.9.7 Debug menu (Shell window only) +....................................... + +Go to File/Line + + Look on the current line. with the cursor, and the line above for + a filename and line number. If found, open the file if not already + open, and show the line. Use this to view source lines referenced + in an exception traceback and lines found by Find in Files. Also + available in the context menu of the Shell window and Output + windows. + +Debugger (toggle) + + When activated, code entered in the Shell or run from an Editor + will run under the debugger. In the Editor, breakpoints can be set + with the context menu. This feature is still incomplete and + somewhat experimental. + +Stack Viewer + + Show the stack traceback of the last exception in a tree widget, + with access to locals and globals. + +Auto-open Stack Viewer + + Toggle automatically opening the stack viewer on an unhandled + exception. + + +File: python.info, Node: Options menu Shell and Editor, Next: Window menu Shell and Editor, Prev: Debug menu Shell window only, Up: Menus + +5.26.9.8 Options menu (Shell and Editor) +........................................ + +Configure 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: 3f47. 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) + + Open a pane at the top of the edit window which shows the block + context of the code which has scrolled above the top of the window. + See *note Code Context: 3f48. in the Editing and Navigation section + below. + +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: 3f47.). + +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 menu Shell and Editor, Next: Help menu Shell and Editor, Prev: Options menu Shell and Editor, Up: Menus + +5.26.9.9 Window menu (Shell and 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 menu Shell and Editor, Next: Context menus, Prev: Window menu Shell and Editor, Up: Menus + +5.26.9.10 Help menu (Shell and Editor) +...................................... + +About IDLE + + Display version, copyright, license, credits, and more. + +IDLE Help + + Display this IDLE document, detailing the menu options, basic + editing and navigation, and other tips. + +Python Docs + + Access local Python documentation, if installed, or start a web + browser and open docs.python.org showing the latest Python + documentation. + +Turtle Demo + + Run the turtledemo module with example Python code and turtle + drawings. + +Additional help sources may be added here with the Configure IDLE dialog +under the General tab. See the *note Help sources: 3f4b. subsection +below for more on Help menu choices. + + +File: python.info, Node: Context menus, Prev: Help menu Shell and Editor, Up: Menus + +5.26.9.11 Context menus +....................... + +Open a context menu by right-clicking in a window (Control-click on +macOS). Context menus have the standard clipboard functions also on the +Edit menu. + +Cut + + Copy selection into the system-wide clipboard; then delete the + selection. + +Copy + + Copy selection into the system-wide clipboard. + +Paste + + Insert contents of the system-wide clipboard into the current + window. + +Editor windows also have breakpoint functions. Lines with a breakpoint +set are specially marked. Breakpoints only have an effect when running +under the debugger. Breakpoints for a file are saved in the user’s +‘.idlerc’ directory. + +Set Breakpoint + + Set a breakpoint on the current line. + +Clear Breakpoint + + Clear the breakpoint on that line. + +Shell and Output windows also have the following. + +Go to file/line + + Same as in Debug menu. + +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: Menus, Up: IDLE — Python editor and shell<2> + +5.26.9.12 Editing and Navigation +................................ + +* Menu: + +* Editor windows:: +* Key bindings:: +* Automatic indentation:: +* Search and Replace:: +* Completions:: +* Calltips:: +* Code Context:: +* Shell window:: +* Text colors:: + + +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: Automatic indentation, 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. + +Standard keybindings (like ‘C’-‘c’ to copy and ‘C’-‘v’ to paste) may +work. Keybindings are selected in the Configure IDLE dialog. + + +File: python.info, Node: Automatic indentation, Next: Search and Replace, Prev: Key bindings, Up: Editing and Navigation + +5.26.9.15 Automatic indentation +............................... + +After a block-opening statement, the next line is indented by 4 spaces +(in the Python Shell window by one tab). After certain keywords (break, +return etc.) the next line is dedented. In leading indentation, +‘Backspace’ deletes up to 4 spaces if they are there. ‘Tab’ inserts +spaces (in the Python Shell window one tab), number depends on Indent +width. Currently, tabs are restricted to four spaces due to Tcl/Tk +limitations. + +See also the indent/dedent region commands on the *note Format menu: +3f3d. + + +File: python.info, Node: Search and Replace, Next: Completions, Prev: Automatic indentation, Up: Editing and Navigation + +5.26.9.16 Search and Replace +............................ + +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: Search and Replace, 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: 666. or *note os.altsep: 667. 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: Code Context, 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: Code Context, Next: Shell window, Prev: Calltips, Up: Editing and Navigation + +5.26.9.19 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: Text colors, Prev: Code Context, Up: Editing and Navigation + +5.26.9.20 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: 18d. 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: Text colors, Prev: Shell window, Up: Editing and Navigation + +5.26.9.21 Text colors +..................... + +Idle defaults to black on white text, but colors text with special +meanings. For the shell, these are shell output, shell error, user +output, and user error. For Python code, at the shell prompt or in an +editor, these are keywords, builtin class and function names, names +following ‘class’ and ‘def’, strings, and comments. For any text +window, these are the cursor (when present), found text (when possible), +and selected text. + +IDLE also highlights the *note soft keywords: 808. *note match: 809, +*note case: 809, and *note _: 80a. in pattern-matching statements. +However, this highlighting is not perfect and will be incorrect in some +rare cases, including some ‘_’-s in ‘case’ patterns. + +Text coloring is done in the background, so uncolorized text is +occasionally visible. To change the color scheme, use the Configure +IDLE dialog Highlighting tab. The marking of debugger breakpoint lines +in the editor and text in popups and dialogs is not user-configurable. + + +File: python.info, Node: Startup and Code Execution, Next: Help and Preferences, Prev: Editing and Navigation, Up: IDLE — Python editor and shell<2> + +5.26.9.22 Startup and Code Execution +.................................... + +Upon startup with the ‘-s’ option, IDLE will execute the file referenced +by the environment variables ‘IDLESTARTUP’ or *note PYTHONSTARTUP: fc3. +IDLE first checks for ‘IDLESTARTUP’; if ‘IDLESTARTUP’ is present the +file referenced is run. If ‘IDLESTARTUP’ is not present, IDLE checks +for ‘PYTHONSTARTUP’. Files referenced by these environment variables +are convenient places to store functions that are used frequently from +the IDLE shell, or for executing import statements to import common +modules. + +In addition, ‘Tk’ also loads a startup file if it is present. Note that +the Tk file is loaded unconditionally. This additional file is +‘.Idle.py’ and is looked for in the user’s home directory. Statements +in this file will be executed in the Tk namespace, so this file is not +useful for importing functions to be used from IDLE’s Python shell. + +* Menu: + +* Command line usage:: +* Startup failure:: +* Running user code:: +* User output in Shell:: +* Developing tkinter applications:: +* Running without a subprocess:: + + +File: python.info, Node: Command line usage, Next: Startup failure, Up: Startup and Code Execution + +5.26.9.23 Command line usage +............................ + +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 + + 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 + + Run the specified file in the shell window. + + -- Option: -s + + Run the startup file (as defined by the environment variables + ‘IDLESTARTUP’ or *note PYTHONSTARTUP: fc3.) before opening the + shell window. + + -- Option: -t + + 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: Command line usage, Up: Startup and Code Execution + +5.26.9.24 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.25 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(): 21ab. 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.26 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: Running without a subprocess, Prev: User output in Shell, Up: Startup and Code Execution + +5.26.9.27 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: Running without a subprocess, Prev: Developing tkinter applications, Up: Startup and Code Execution + +5.26.9.28 Running without a subprocess +...................................... + +By default, IDLE executes user code in a separate subprocess via a +socket, which uses the internal loopback interface. This connection is +not externally visible and no data is sent to or received from the +internet. If firewall software complains anyway, you can ignore it. + +If the attempt to make the socket connection fails, Idle will notify +you. Such failures are sometimes transient, but if persistent, the +problem may be either a firewall blocking the connection or +misconfiguration of a particular system. Until the problem is fixed, +one can run Idle with the -n command line switch. + +If IDLE is started with the -n command line switch it will run in a +single process and will not create the subprocess which runs the RPC +Python execution server. This can be useful if Python cannot create the +subprocess or the RPC socket interface on your platform. However, in +this mode user code is not isolated from IDLE itself. Also, the +environment is not restarted when Run/Run Module (F5) is selected. If +your code has been modified, you must reload() the affected modules and +re-import any specific items (e.g. from foo import baz) if the changes +are to take effect. For these reasons, it is preferable to run IDLE +with the default subprocess if at all possible. + +Deprecated since version 3.4. + + +File: python.info, Node: Help and Preferences, Next: idlelib — implementation of IDLE application, Prev: Startup and Code Execution, Up: IDLE — Python editor and shell<2> + +5.26.9.29 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.30 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.31 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.32 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.33 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 editor and shell<2> + +5.26.9.34 idlelib — implementation of IDLE application +...................................................... + +'Source code:' Lib/idlelib(1) + +__________________________________________________________________ + +The Lib/idlelib package implements the IDLE application. See the rest +of this page for how to use IDLE. + +The files in idlelib are described in idlelib/README.txt. Access it +either in idlelib or click Help => About IDLE on the IDLE menu. This +file also maps IDLE menu items to the code that implements the item. +Except for files listed under ‘Startup’, the idlelib code is ‘private’ +in sense that feature changes can be backported (see PEP 434(2)). + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/idlelib + + (2) https://peps.python.org/pep-0434/ + + +File: python.info, Node: Development Tools, Next: Debugging and Profiling, Prev: Graphical User Interfaces with Tk, Up: The Python Standard Library + +5.27 Development Tools +====================== + +The modules described in this chapter help you write software. For +example, the *note pydoc: b5. module takes a module and generates +documentation based on the module’s contents. The *note doctest: 3a. +and *note unittest: 106. modules contains frameworks for writing unit +tests that automatically exercise code and verify that the expected +output is produced. + +The list of modules described in this chapter is: + +* Menu: + +* typing — Support for type hints:: +* pydoc — Documentation generator and online help system:: +* Python Development Mode:: +* doctest — Test interactive Python examples:: +* unittest — Unit testing framework:: +* unittest.mock — mock object library: unittest mock — mock object library. +* unittest.mock — getting started: unittest mock — getting started. +* test — Regression tests package for Python:: +* test.support — Utilities for the Python test suite: test support — Utilities for the Python test suite. +* test.support.socket_helper — Utilities for socket tests: test support socket_helper — Utilities for socket tests. +* test.support.script_helper — Utilities for the Python execution tests: test support script_helper — Utilities for the Python execution tests. +* test.support.bytecode_helper — Support tools for testing correct bytecode generation: test support bytecode_helper — Support tools for testing correct bytecode generation. +* test.support.threading_helper — Utilities for threading tests: test support threading_helper — Utilities for threading tests. +* test.support.os_helper — Utilities for os tests: test support os_helper — Utilities for os tests. +* test.support.import_helper — Utilities for import tests: test support import_helper — Utilities for import tests. +* test.support.warnings_helper — Utilities for warnings tests: test support warnings_helper — Utilities for warnings tests. + + +File: python.info, Node: typing — Support for type hints, Next: pydoc — Documentation generator and online help system, Up: Development Tools + +5.27.1 ‘typing’ — Support for type hints +---------------------------------------- + +Added in version 3.5. + +'Source code:' Lib/typing.py(1) + + Note: The Python runtime does not enforce function and variable + type annotations. They can be used by third party tools such as + *note type checkers: 26f, IDEs, linters, etc. + +__________________________________________________________________ + +This module provides runtime support for type hints. + +Consider the function below: + + def surface_area_of_cube(edge_length: float) -> str: + return f"The surface area of the cube is {6 * edge_length ** 2}." + +The function ‘surface_area_of_cube’ takes an argument expected to be an +instance of *note float: 2f1, as indicated by the *note type hint: 1f81. +‘edge_length: float’. The function is expected to return an instance of +*note str: 447, as indicated by the ‘-> str’ hint. + +While type hints can be simple classes like *note float: 2f1. or *note +str: 447, they can also be more complex. The *note typing: 104. module +provides a vocabulary of more advanced type hints. + +New features are frequently added to the ‘typing’ module. The +typing_extensions(2) package provides backports of these new features to +older versions of Python. + +See also +........ + +Typing cheat sheet(3) + + A quick overview of type hints (hosted at the mypy docs) + +Type System Reference section of the mypy docs(4) + + The Python typing system is standardised via PEPs, so this + reference should broadly apply to most Python type checkers. (Some + parts may still be specific to mypy.) + +Static Typing with Python(5) + + Type-checker-agnostic documentation written by the community + detailing type system features, useful typing related tools and + typing best practices. + +* Menu: + +* Specification for the Python Type System:: +* Type aliases:: +* NewType:: +* Annotating callable objects:: +* Generics:: +* Annotating tuples:: +* The type of class objects:: +* Annotating generators and coroutines:: +* User-defined generic types:: +* The Any type:: +* Nominal vs structural subtyping:: +* Module contents: Module contents<3>. +* Deprecation Timeline of Major Features:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: Specification for the Python Type System, Next: Type aliases, Up: typing — Support for type hints + +5.27.1.1 Specification for the Python Type System +................................................. + +The canonical, up-to-date specification of the Python type system can be +found at Specification for the Python type system(1). + + ---------- Footnotes ---------- + + (1) https://typing.python.org/en/latest/spec/index.html + + +File: python.info, Node: Type aliases, Next: NewType, Prev: Specification for the Python Type System, Up: typing — Support for type hints + +5.27.1.2 Type aliases +..................... + +A type alias is defined using the *note type: 433. statement, which +creates an instance of *note TypeAliasType: 450. In this example, +‘Vector’ and ‘list[float]’ will be treated equivalently by static type +checkers: + + type Vector = list[float] + + def scale(scalar: float, vector: Vector) -> Vector: + return [scalar * num for num in vector] + + # passes type checking; a list of floats qualifies as a Vector. + new_vector = scale(2.0, [1.0, -4.2, 5.4]) + +Type aliases are useful for simplifying complex type signatures. For +example: + + 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: + ... + + # The static type checker will treat the previous type signature as + # being exactly equivalent to this one. + def broadcast_message( + message: str, + servers: Sequence[tuple[tuple[str, int], dict[str, str]]] + ) -> None: + ... + +The *note type: 433. statement is new in Python 3.12. For backwards +compatibility, type aliases can also be created through simple +assignment: + + Vector = list[float] + +Or marked with *note TypeAlias: 7c4. to make it explicit that this is a +type alias, not a normal variable assignment: + + from typing import TypeAlias + + Vector: TypeAlias = list[float] + + +File: python.info, Node: NewType, Next: Annotating callable objects, Prev: Type aliases, Up: typing — Support for type hints + +5.27.1.3 NewType +................ + +Use the *note NewType: cf5. helper to create distinct types: + + 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. This is useful in helping catch logical errors: + + def get_user_name(user_id: UserId) -> str: + ... + + # passes type checking + user_a = get_user_name(UserId(42351)) + + # fails type checking; an int is not a UserId + user_b = get_user_name(-1) + +You may still perform all ‘int’ operations on a variable of type +‘UserId’, but the result will always be of type ‘int’. This lets you +pass in a ‘UserId’ wherever an ‘int’ might be expected, but will prevent +you from accidentally creating a ‘UserId’ in an invalid way: + + # 'output' is of type 'int', not 'UserId' + output = UserId(23413) + UserId(54341) + +Note that these checks are enforced only by the static type checker. At +runtime, the statement ‘Derived = NewType('Derived', Base)’ will make +‘Derived’ a callable that immediately returns whatever parameter you +pass it. That means the expression ‘Derived(some_value)’ does not +create a new class or introduce much overhead beyond that of a regular +function call. + +More precisely, the expression ‘some_value is Derived(some_value)’ is +always true at runtime. + +It is invalid to create a subtype of ‘Derived’: + + from typing import NewType + + UserId = NewType('UserId', int) + + # Fails at runtime and does not pass type checking + class AdminUserId(UserId): pass + +However, it is possible to create a *note NewType: cf5. based on a +‘derived’ ‘NewType’: + + from typing import NewType + + UserId = NewType('UserId', int) + + ProUserId = NewType('ProUserId', UserId) + +and typechecking for ‘ProUserId’ will work as expected. + +See PEP 484(1) for more details. + + Note: Recall that the use of a type alias declares two types to be + 'equivalent' to one another. Doing ‘type Alias = Original’ will + make the static type checker treat ‘Alias’ as being 'exactly + equivalent' to ‘Original’ in all cases. This is useful when you + want to simplify complex type signatures. + + In contrast, ‘NewType’ declares one type to be a 'subtype' of + another. Doing ‘Derived = NewType('Derived', Original)’ will make + the static type checker treat ‘Derived’ as a 'subclass' of + ‘Original’, which means a value of type ‘Original’ cannot be used + in places where a value of type ‘Derived’ is expected. This is + useful when you want to prevent logic errors with minimal runtime + cost. + +Added in version 3.5.2. + +Changed in version 3.10: ‘NewType’ is now a class rather than a +function. As a result, there is some additional runtime cost when +calling ‘NewType’ over a regular function. + +Changed in version 3.11: The performance of calling ‘NewType’ has been +restored to its level in Python 3.9. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0484/ + + +File: python.info, Node: Annotating callable objects, Next: Generics, Prev: NewType, Up: typing — Support for type hints + +5.27.1.4 Annotating callable objects +.................................... + +Functions – or other *note callable: 28f7. objects – can be annotated +using *note collections.abc.Callable: 7e5. or deprecated *note +typing.Callable: 7c0. ‘Callable[[int], str]’ signifies a function that +takes a single parameter of type *note int: 259. and returns a *note +str: 447. + +For example: + + from collections.abc import Callable, Awaitable + + def feeder(get_next_item: Callable[[], str]) -> None: + ... # Body + + def async_query(on_success: Callable[[int], None], + on_error: Callable[[int, Exception], None]) -> None: + ... # Body + + async def on_update(value: str) -> None: + ... # Body + + callback: Callable[[str], Awaitable[None]] = on_update + +The subscription syntax must always be used with exactly two values: the +argument list and the return type. The argument list must be a list of +types, a *note ParamSpec: 15e, *note Concatenate: 7bf, or an ellipsis. +The return type must be a single type. + +If a literal ellipsis ‘...’ is given as the argument list, it indicates +that a callable with any arbitrary parameter list would be acceptable: + + def concat(x: str, y: str) -> str: + return x + y + + x: Callable[..., str] + x = str # OK + x = concat # Also OK + +‘Callable’ cannot express complex signatures such as functions that take +a variadic number of arguments, *note overloaded functions: 3f79, or +functions that have keyword-only parameters. However, these signatures +can be expressed by defining a *note Protocol: 266. class with a *note +__call__(): 555. method: + + from collections.abc import Iterable + from typing import Protocol + + class Combiner(Protocol): + def __call__(self, *vals: bytes, maxlen: int | None = None) -> list[bytes]: ... + + def batch_proc(data: Iterable[bytes], cb_results: Combiner) -> bytes: + for item in data: + ... + + def good_cb(*vals: bytes, maxlen: int | None = None) -> list[bytes]: + ... + def bad_cb(*vals: bytes, maxitems: int | None) -> list[bytes]: + ... + + batch_proc([], good_cb) # OK + batch_proc([], bad_cb) # Error! Argument 2 has incompatible type because of + # different name and kind in the callback + +Callables which take other callables as arguments may indicate that +their parameter types are dependent on each other using *note ParamSpec: +15e. Additionally, if that callable adds or removes arguments from +other callables, the *note Concatenate: 7bf. operator may be used. They +take the form ‘Callable[ParamSpecVariable, ReturnType]’ and +‘Callable[Concatenate[Arg1Type, Arg2Type, ..., ParamSpecVariable], +ReturnType]’ respectively. + +Changed in version 3.10: ‘Callable’ now supports *note ParamSpec: 15e. +and *note Concatenate: 7bf. See PEP 612(1) for more details. + +See also +........ + +The documentation for *note ParamSpec: 15e. and *note Concatenate: 7bf. +provides examples of usage in ‘Callable’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0612/ + + +File: python.info, Node: Generics, Next: Annotating tuples, Prev: Annotating callable objects, Up: typing — Support for type hints + +5.27.1.5 Generics +................. + +Since type information about objects kept in containers cannot be +statically inferred in a generic way, many container classes in the +standard library support subscription to denote the expected types of +container elements. + + from collections.abc import Mapping, Sequence + + class Employee: ... + + # Sequence[Employee] indicates that all elements in the sequence + # must be instances of "Employee". + # Mapping[str, str] indicates that all keys and all values in the mapping + # must be strings. + def notify_by_email(employees: Sequence[Employee], + overrides: Mapping[str, str]) -> None: ... + +Generic functions and classes can be parameterized by using *note type +parameter syntax: 2b5.: + + from collections.abc import Sequence + + def first[T](l: Sequence[T]) -> T: # Function is generic over the TypeVar "T" + return l[0] + +Or by using the *note TypeVar: 15d. factory directly: + + from collections.abc import Sequence + from typing import TypeVar + + U = TypeVar('U') # Declare type variable "U" + + def second(l: Sequence[U]) -> U: # Function is generic over the TypeVar "U" + return l[1] + +Changed in version 3.12: Syntactic support for generics is new in Python +3.12. + + +File: python.info, Node: Annotating tuples, Next: The type of class objects, Prev: Generics, Up: typing — Support for type hints + +5.27.1.6 Annotating tuples +.......................... + +For most containers in Python, the typing system assumes that all +elements in the container will be of the same type. For example: + + from collections.abc import Mapping + + # Type checker will infer that all elements in ``x`` are meant to be ints + x: list[int] = [] + + # Type checker error: ``list`` only accepts a single type argument: + y: list[int, str] = [1, 'foo'] + + # Type checker will infer that all keys in ``z`` are meant to be strings, + # and that all values in ``z`` are meant to be either strings or ints + z: Mapping[str, str | int] = {} + +*note list: 60d. only accepts one type argument, so a type checker would +emit an error on the ‘y’ assignment above. Similarly, *note Mapping: +8c9. only accepts two type arguments: the first indicates the type of +the keys, and the second indicates the type of the values. + +Unlike most other Python containers, however, it is common in idiomatic +Python code for tuples to have elements which are not all of the same +type. For this reason, tuples are special-cased in Python’s typing +system. *note tuple: 36b. accepts 'any number' of type arguments: + + # OK: ``x`` is assigned to a tuple of length 1 where the sole element is an int + x: tuple[int] = (5,) + + # OK: ``y`` is assigned to a tuple of length 2; + # element 1 is an int, element 2 is a str + y: tuple[int, str] = (5, "foo") + + # Error: the type annotation indicates a tuple of length 1, + # but ``z`` has been assigned to a tuple of length 3 + z: tuple[int] = (1, 2, 3) + +To denote a tuple which could be of 'any' length, and in which all +elements are of the same type ‘T’, use ‘tuple[T, ...]’. To denote an +empty tuple, use ‘tuple[()]’. Using plain ‘tuple’ as an annotation is +equivalent to using ‘tuple[Any, ...]’: + + x: tuple[int, ...] = (1, 2) + # These reassignments are OK: ``tuple[int, ...]`` indicates x can be of any length + x = (1, 2, 3) + x = () + # This reassignment is an error: all elements in ``x`` must be ints + x = ("foo", "bar") + + # ``y`` can only ever be assigned to an empty tuple + y: tuple[()] = () + + z: tuple = ("foo", "bar") + # These reassignments are OK: plain ``tuple`` is equivalent to ``tuple[Any, ...]`` + z = (1, 2, 3) + z = () + + +File: python.info, Node: The type of class objects, Next: Annotating generators and coroutines, Prev: Annotating tuples, Up: typing — Support for type hints + +5.27.1.7 The type of class objects +.................................. + +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]: 3f7f.) 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: d48. are classes, *note Any: +6a8, *note type variables: 1f7f, 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: d48, which is the root of +Python’s *note metaclass hierarchy: 1f73. + + +File: python.info, Node: Annotating generators and coroutines, Next: User-defined generic types, Prev: The type of class objects, Up: typing — Support for type hints + +5.27.1.8 Annotating generators and coroutines +............................................. + +A generator can be annotated using the generic type *note +Generator[YieldType, SendType, ReturnType]: dda. 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: dda. 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]: 224d. or *note +Iterator[YieldType]: 224e.: + + 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]: +c8a.). 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]: dde. and +*note AsyncIterator[YieldType]: ddd. 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]: ddc. Generic arguments correspond to those of *note +Generator: dda, 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: User-defined generic types, Next: The Any type, Prev: Annotating generators and coroutines, Up: typing — Support for type hints + +5.27.1.9 User-defined generic types +................................... + +A user-defined class can be defined as a generic class. + + 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: 3f82. ‘T’ . This also makes ‘T’ valid as +a type within the class body. + +Generic classes implicitly inherit from *note Generic: 1619. For +compatibility with Python 3.11 and lower, it is also possible to inherit +explicitly from *note Generic: 1619. to indicate a generic class: + + from typing import TypeVar, Generic + + T = TypeVar('T') + + class LoggedVar(Generic[T]): + ... + +Generic classes have *note __class_getitem__(): 736. 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: 15d. 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]): + ... + +Each type variable argument to *note Generic: 1619. must be distinct. +This is thus invalid: + + 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]): + ... + +In this case ‘MyDict’ has a single parameter, ‘T’. + +Using a generic class without specifying type parameters assumes *note +Any: 6a8. 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 + +Changed in version 3.7: *note Generic: 1619. no longer has a custom +metaclass. + +Changed in version 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: 1619. 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: 15e.: + + >>> 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: 15e. can also be created using +explicit inheritance from *note Generic: 1619. In this case, ‘**’ is +not used: + + from typing import ParamSpec, Generic + + P = ParamSpec('P') + + class Z(Generic[P]): + ... + +Another difference between *note TypeVar: 15d. and *note ParamSpec: 15e. +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: 15e. may not have correct +‘__parameters__’ after substitution in some cases because they are +intended primarily for static type checking. + +Changed in version 3.10: *note Generic: 1619. can now be parameterized +over parameter expressions. See *note ParamSpec: 15e. 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: 60c. and comparable for equality. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0612/ + + +File: python.info, Node: The Any type, Next: Nominal vs structural subtyping, Prev: User-defined generic types, Up: typing — Support for type hints + +5.27.1.10 The ‘Any’ type +........................ + +A special kind of type is *note Any: 6a8. A static type checker will +treat every type as being compatible with *note Any: 6a8. and *note Any: +6a8. as being compatible with every type. + +This means that it is possible to perform any operation or method call +on a value of type *note Any: 6a8. and assign it to any variable: + + 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() + ... + +Notice that no type checking is performed when assigning a value of type +*note Any: 6a8. to a more precise type. For example, the static type +checker did not report an error when assigning ‘a’ to ‘s’ even though +‘s’ was declared to be of type *note str: 447. and receives an *note +int: 259. value at runtime! + +Furthermore, all functions without a return type or parameter types will +implicitly default to using *note Any: 6a8.: + + 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 + +This behavior allows *note Any: 6a8. to be used as an 'escape hatch' +when you need to mix dynamically and statically typed code. + +Contrast the behavior of *note Any: 6a8. with the behavior of *note +object: a8c. Similar to *note Any: 6a8, every type is a subtype of +*note object: a8c. However, unlike *note Any: 6a8, the reverse is not +true: *note object: a8c. is 'not' a subtype of every other type. + +That means when the type of a value is *note object: a8c, a type checker +will reject almost all operations on it, and assigning it to a variable +(or using it as a return value) of a more specialized type is a type +error. For example: + + 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") + +Use *note object: a8c. to indicate that a value could be any type in a +typesafe manner. Use *note Any: 6a8. to indicate that a value is +dynamically typed. + + +File: python.info, Node: Nominal vs structural subtyping, Next: Module contents<3>, Prev: The Any type, Up: typing — Support for type hints + +5.27.1.11 Nominal vs structural subtyping +......................................... + +Initially PEP 484(1) defined the Python static type system as using +'nominal subtyping'. This means that a class ‘A’ is allowed where a +class ‘B’ is expected if and only if ‘A’ is a subclass of ‘B’. + +This requirement previously also applied to abstract base classes, such +as *note Iterable: 224d. The problem with this approach is that a class +had to be explicitly marked to support them, which is unpythonic and +unlike what one would normally do in idiomatic dynamically typed Python +code. For example, this conforms to 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) allows to solve 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 + +Moreover, by subclassing a special class *note Protocol: 266, a user can +define new custom protocols to fully enjoy structural subtyping (see +examples below). + + ---------- 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: Module contents<3>, Next: Deprecation Timeline of Major Features, Prev: Nominal vs structural subtyping, Up: typing — Support for type hints + +5.27.1.12 Module contents +......................... + +The ‘typing’ module defines the following classes, functions and +decorators. + +* Menu: + +* Special typing primitives:: +* Protocols: Protocols<3>. +* ABCs for working with IO:: +* Functions and decorators:: +* Introspection helpers:: +* Constant:: +* Deprecated aliases:: + + +File: python.info, Node: Special typing primitives, Next: Protocols<3>, Up: Module contents<3> + +5.27.1.13 Special typing primitives +................................... + +* Menu: + +* Special types:: +* Special forms:: +* Building generic types and type aliases:: +* Other special directives:: + + +File: python.info, Node: Special types, Next: Special forms, Up: Special typing primitives + +5.27.1.14 Special types +....................... + +These can be used as types in annotations. They do not support +subscription using ‘[]’. + + -- Data: typing.Any + + Special type indicating an unconstrained type. + + * Every type is compatible with *note Any: 6a8. + + * *note Any: 6a8. is compatible with every type. + + Changed in version 3.11: *note Any: 6a8. 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. + + -- Data: typing.AnyStr + + A *note constrained type variable: 3f88. + + Definition: + + AnyStr = TypeVar('AnyStr', str, bytes) + + ‘AnyStr’ is meant to be used for functions that may accept *note + str: 447. or *note bytes: 1c2. arguments but cannot allow the two + to mix. + + For example: + + 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: 6a8. type, nor does it mean “any string”. In + particular, ‘AnyStr’ and ‘str | bytes’ are different from each + other and have different use cases: + + # Invalid use of AnyStr: + # The type variable is used only once in the function signature, + # so cannot be "solved" by the type checker + def greet_bad(cond: bool) -> AnyStr: + return "hi there!" if cond else b"greetings!" + + # The better way of annotating this function: + def greet_proper(cond: bool) -> str | bytes: + return "hi there!" if cond else b"greetings!" + + Deprecated since version 3.13, will be removed in version 3.18: + Deprecated in favor of the new *note type parameter syntax: 2b5. + 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. + + -- Data: 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’. + + Example: + + 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. + + See PEP 675(2) for more details. + + Added in version 3.11. + + -- Data: typing.Never + -- Data: 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(): 133c.: + + 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(): 6a3.: + + from typing import Never # or NoReturn + + def never_call_me(arg: Never) -> None: + pass + + def int_or_str(arg: int | str) -> None: + never_call_me(arg) # type checker error + match arg: + case int(): + print("It's an int") + case str(): + print("It's a str") + case _: + never_call_me(arg) # OK, arg is of type Never (or NoReturn) + + ‘Never’ and ‘NoReturn’ have the same meaning in the type system and + static type checkers treat both equivalently. + + Added in version 3.6.2: Added *note NoReturn: 3f89. + + Added in version 3.11: Added *note Never: 6a4. + + -- Data: typing.Self + + Special type to represent the current enclosed class. + + For example: + + 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: 166.s that are used as alternative + constructors and return instances of the ‘cls’ parameter. + + - Annotating an *note __enter__(): 5c4. 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() + + See PEP 673(4) for more details. + + Added in version 3.11. + + -- Data: typing.TypeAlias + + Special annotation for explicitly declaring a *note type alias: + 44f. + + For example: + + 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: ... + + See PEP 613(5) for more details. + + Added in version 3.10. + + Deprecated since version 3.12: *note TypeAlias: 7c4. is deprecated + in favor of the *note type: 433. statement, which creates instances + of *note TypeAliasType: 450. and which natively supports forward + references. Note that while *note TypeAlias: 7c4. and *note + TypeAliasType: 450. serve similar purposes and have similar names, + they are distinct and the latter is not the type of the former. + Removal of *note TypeAlias: 7c4. is not currently planned, but + users are encouraged to migrate to *note type: 433. 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: Special forms, Next: Building generic types and type aliases, Prev: Special types, Up: Special typing primitives + +5.27.1.15 Special forms +....................... + +These can be used as types in annotations. They all support +subscription using ‘[]’, but each has a unique syntax. + + -- Data: typing.Union + + Union type; ‘Union[X, Y]’ is equivalent to ‘X | Y’ and means either + X or Y. + + To define a union, use e.g. ‘Union[int, str]’ or the shorthand + ‘int | str’. Using that shorthand is recommended. Details: + + * The arguments must be types and there must be at least one. + + * Unions of unions are flattened, e.g.: + + 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: 450.: + + type A = Union[int, str] + Union[A, float] != Union[int, str, float] + + * Unions of a single argument vanish, e.g.: + + Union[int] == int # The constructor actually returns int + + * Redundant arguments are skipped, e.g.: + + Union[int, str, int] == Union[int, str] == int | str + + * When comparing unions, the argument order is ignored, e.g.: + + Union[int, str] == Union[str, int] + + * You cannot subclass or instantiate a ‘Union’. + + * You cannot write ‘Union[X][Y]’. + + Changed in version 3.7: Don’t remove explicit subclasses from + unions at runtime. + + Changed in version 3.10: Unions can now be written as ‘X | Y’. See + *note union type expressions: 7bd. + + -- Data: typing.Optional + + ‘Optional[X]’ is equivalent to ‘X | None’ (or ‘Union[X, None]’). + + Note that this is not the same concept as an optional argument, + which is one that has a default. An optional argument with a + default does not require the ‘Optional’ qualifier on its type + annotation just because it is optional. For example: + + def foo(arg: int = 0) -> None: + ... + + On the other hand, if an explicit value of ‘None’ is allowed, the + use of ‘Optional’ is appropriate, whether the argument is optional + or not. For example: + + def foo(arg: Optional[int] = None) -> None: + ... + + Changed in version 3.10: Optional can now be written as ‘X | None’. + See *note union type expressions: 7bd. + + -- Data: typing.Concatenate + + Special form for annotating higher-order functions. + + ‘Concatenate’ can be used in conjunction with *note Callable: 2533. + and *note ParamSpec: 15e. to annotate a higher-order callable which + adds, removes, or transforms parameters of another callable. Usage + is in the form ‘Concatenate[Arg1Type, Arg2Type, ..., + ParamSpecVariable]’. ‘Concatenate’ is currently only valid when + used as the first argument to a *note Callable: 2533. The last + parameter to ‘Concatenate’ must be a *note ParamSpec: 15e. or + ellipsis (‘...’). + + For example, to annotate a decorator ‘with_lock’ which provides a + *note threading.Lock: 1677. 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: 15e. 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. + + See also + ........ + + * PEP 612(1) – Parameter Specification Variables (the PEP which + introduced ‘ParamSpec’ and ‘Concatenate’) + + * *note ParamSpec: 15e. + + * *note Annotating callable objects: 2533. + + -- Data: 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. + + For example: + + 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[...]’ cannot be subclassed. At runtime, an arbitrary + value is allowed as type argument to ‘Literal[...]’, but type + checkers may impose restrictions. See PEP 586(2) for more details + about literal types. + + 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: 450.: + + type A = Literal[1, 2] + assert Literal[A, 3] != Literal[1, 2, 3] + + * Redundant arguments are skipped, e.g.: + + 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. + + Changed in version 3.9.1: ‘Literal’ now de-duplicates parameters. + Equality comparisons of ‘Literal’ objects are no longer order + dependent. ‘Literal’ objects will now raise a *note TypeError: + 534. exception during equality comparisons if one of their + parameters are not *note hashable: 60c. + + -- Data: typing.ClassVar + + Special type construct to mark class variables. + + As introduced in PEP 526(3), 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. + Usage: + + class Starship: + stats: ClassVar[dict[str, int]] = {} # class variable + damage: int = 10 # instance variable + + *note ClassVar: 268. accepts only types and cannot be further + subscribed. + + *note ClassVar: 268. is not a class itself, and should not be used + with *note isinstance(): 43d. or *note issubclass(): 7bc. *note + ClassVar: 268. does not change Python runtime behavior, but it can + be used by third-party type checkers. For example, a type checker + might flag the following code as an error: + + enterprise_d = Starship(3000) + enterprise_d.stats = {} # Error, setting class variable on instance + Starship.stats = {} # This is OK + + Added in version 3.5.3. + + Changed in version 3.13: *note ClassVar: 268. can now be nested in + *note Final: 269. and vice versa. + + -- Data: 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. + + For example: + + 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 + + There is no runtime checking of these properties. See PEP 591(4) + for more details. + + Added in version 3.8. + + Changed in version 3.13: *note Final: 269. can now be nested in + *note ClassVar: 268. and vice versa. + + -- Data: typing.Required + + Special typing construct to mark a *note TypedDict: 162. key as + required. + + This is mainly useful for ‘total=False’ TypedDicts. See *note + TypedDict: 162. and PEP 655(5) for more details. + + Added in version 3.11. + + -- Data: typing.NotRequired + + Special typing construct to mark a *note TypedDict: 162. key as + potentially missing. + + See *note TypedDict: 162. and PEP 655(6) for more details. + + Added in version 3.11. + + -- Data: typing.ReadOnly + + A special typing construct to mark an item of a *note TypedDict: + 162. as read-only. + + For example: + + 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: 162. and PEP 705(7) for more details. + + Added in version 3.13. + + -- Data: 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: 6b0. 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(): 43d.). + + -- 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: 450.: + + 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: + 15f.: + + type Variadic[*Ts] = Annotated[*Ts, Ann1] = Annotated[T1, T2, T3, ..., Ann1] # NOT valid + + where ‘T1’, ‘T2’, … are *note TypeVars: 15d. This is invalid as + only one type should be passed to Annotated. + + By default, *note get_type_hints(): 6ad. 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(): a46. will return ‘Annotated’ + itself: + + >>> get_origin(Password) + typing.Annotated + + See also + ........ + + PEP 593(8) - Flexible function and variable annotations + + The PEP introducing ‘Annotated’ to the standard library. + + Added in version 3.9. + + -- Data: 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: 164. 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’. + + For example: + + from typing import assert_type, final, TypeIs + + class Parent: pass + class Child(Parent): pass + @final + class Unrelated: pass + + def is_parent(val: object) -> TypeIs[Parent]: + return isinstance(val, Parent) + + def run(arg: Child | Unrelated): + if is_parent(arg): + # Type of ``arg`` is narrowed to the intersection + # of ``Parent`` and ``Child``, which is equivalent to + # ``Child``. + assert_type(arg, Child) + else: + # Type of ``arg`` is narrowed to exclude ``Parent``, + # so only ``Unrelated`` is left. + assert_type(arg, Unrelated) + + The type inside ‘TypeIs’ must be consistent with the type of the + function’s argument; if it is not, static type checkers will raise + an error. An incorrectly written ‘TypeIs’ function can lead to + unsound behavior in the type system; it is the user’s + responsibility to write such functions in a type-safe manner. + + If a ‘TypeIs’ function is a class or instance method, then the type + in ‘TypeIs’ maps to the type of the second parameter (after ‘cls’ + or ‘self’). + + In short, the form ‘def foo(arg: TypeA) -> TypeIs[TypeB]: ...’, + means that if ‘foo(arg)’ returns ‘True’, then ‘arg’ is an instance + of ‘TypeB’, and if it returns ‘False’, it is not an instance of + ‘TypeB’. + + ‘TypeIs’ also works with type variables. For more information, see + PEP 742(9) (Narrowing types with ‘TypeIs’). + + Added in version 3.13. + + -- Data: 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: 163, but has subtly + different effects on type checking behavior (see below). + + Using ‘-> TypeGuard’ tells the static type checker that for a given + function: + + 1. The return value is a boolean. + + 2. If the return value is ‘True’, the type of its argument is the + type inside ‘TypeGuard’. + + ‘TypeGuard’ also works with type variables. See PEP 647(10) for + more details. + + For example: + + 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. + + -- Data: 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: 3f8b. 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: 15f. and *note + builtins.tuple: 36b. 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: 162. + for typing ‘**kwargs’ in a function signature: + + from typing import TypedDict, Unpack + + class Movie(TypedDict): + name: str + year: int + + # This function expects two keyword arguments - `name` of type `str` + # and `year` of type `int`. + def foo(**kwargs: Unpack[Movie]): ... + + See PEP 692(11) for more details on using ‘Unpack’ for ‘**kwargs’ + typing. + + Added in version 3.11. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0612/ + + (2) https://peps.python.org/pep-0586/ + + (3) https://peps.python.org/pep-0526/ + + (4) https://peps.python.org/pep-0591/ + + (5) https://peps.python.org/pep-0655/ + + (6) https://peps.python.org/pep-0655/ + + (7) https://peps.python.org/pep-0705/ + + (8) https://peps.python.org/pep-0593/ + + (9) https://peps.python.org/pep-0742/ + + (10) https://peps.python.org/pep-0647/ + + (11) https://peps.python.org/pep-0692/ + + +File: python.info, Node: Building generic types and type aliases, Next: Other special directives, Prev: Special forms, Up: Special typing primitives + +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: 2b5. and the *note type: 433. statement). For +compatibility with Python 3.11 and earlier, they can also be created +without the dedicated syntax, as documented below. + + -- Class: typing.Generic + + Abstract base class for generic types. + + 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: 44d. + + This class can then be used as follows: + + 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: 44e. + + 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. + + -- Class: typing.TypeVar (name, *constraints, bound=None, + covariant=False, contravariant=False, infer_variance=False, + default=typing.NoDefault) + + Type variable. + + The preferred way to construct a type variable is via the dedicated + syntax for *note generic functions: 44e, *note generic classes: + 44d, and *note generic type aliases: 451.: + + 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: 1619. 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: 2b5. 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: 534. + + -- Attribute: __name__ + + The name of the type variable. + + -- Attribute: __covariant__ + + Whether the type var has been explicitly marked as covariant. + + -- Attribute: __contravariant__ + + Whether the type var has been explicitly marked as + contravariant. + + -- Attribute: __infer_variance__ + + Whether the type variable’s variance should be inferred by + type checkers. + + Added in version 3.12. + + -- Attribute: __bound__ + + The upper bound of the type variable, if any. + + Changed in version 3.12: For type variables created through + *note type parameter syntax: 2b5, the bound is evaluated only + when the attribute is accessed, not when the type variable is + created (see *note Lazy evaluation: 452.). + + -- Attribute: __constraints__ + + A tuple containing the constraints of the type variable, if + any. + + Changed in version 3.12: For type variables created through + *note type parameter syntax: 2b5, the constraints are + evaluated only when the attribute is accessed, not when the + type variable is created (see *note Lazy evaluation: 452.). + + -- Attribute: __default__ + + The default value of the type variable, or *note + typing.NoDefault: 264. if it has no default. + + Added in version 3.13. + + -- Method: has_default () + + Return whether or not the type variable has a default value. + This is equivalent to checking whether *note __default__: + 3f93. is not the *note typing.NoDefault: 264. singleton, + except that it does not force evaluation of the *note lazily + evaluated: 452. default value. + + Added in version 3.13. + + Changed in version 3.12: Type variables can now be declared using + the *note type parameter: 2b5. syntax introduced by PEP 695(3). + The ‘infer_variance’ parameter was added. + + Changed in version 3.13: Support for default values was added. + + -- Class: typing.TypeVarTuple (name, *, default=typing.NoDefault) + + Type variable tuple. A specialized form of *note type variable: + 3f82. that enables 'variadic' generics. + + Type variable tuples can be declared in *note type parameter lists: + 2b5. 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: 162f. 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. + + -- Attribute: __name__ + + The name of the type variable tuple. + + -- Attribute: __default__ + + The default value of the type variable tuple, or *note + typing.NoDefault: 264. if it has no default. + + Added in version 3.13. + + -- Method: has_default () + + Return whether or not the type variable tuple has a default + value. This is equivalent to checking whether *note + __default__: 3f96. is not the *note typing.NoDefault: 264. + singleton, except that it does not force evaluation of the + *note lazily evaluated: 452. default value. + + Added in version 3.13. + + Added in version 3.11. + + Changed in version 3.12: Type variable tuples can now be declared + using the *note type parameter: 2b5. syntax introduced by PEP + 695(5). + + Changed in version 3.13: Support for default values was added. + + -- Class: typing.ParamSpec (name, *, bound=None, covariant=False, + contravariant=False, default=typing.NoDefault) + + Parameter specification variable. A specialized version of *note + type variables: 3f82. + + In *note type parameter lists: 2b5, 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: 1619. 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: 15d. 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: 6a8. + + 2. *note cast(): 3f98. 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’. + + -- Attribute: args + + -- Attribute: 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: 7c1. and *note ParamSpecKwargs: 7c2. + + -- Attribute: __name__ + + The name of the parameter specification. + + -- Attribute: __default__ + + The default value of the parameter specification, or *note + typing.NoDefault: 264. if it has no default. + + Added in version 3.13. + + -- Method: has_default () + + Return whether or not the parameter specification has a + default value. This is equivalent to checking whether *note + __default__: 3f9c. is not the *note typing.NoDefault: 264. + singleton, except that it does not force evaluation of the + *note lazily evaluated: 452. 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: 15d. However the actual + semantics of these keywords are yet to be decided. + + Added in version 3.10. + + Changed in version 3.12: Parameter specifications can now be + declared using the *note type parameter: 2b5. syntax introduced by + PEP 695(6). + + Changed in version 3.13: Support for default values was added. + + Note: Only parameter specification variables defined in global + scope can be pickled. + + See also + ........ + + * PEP 612(7) – Parameter Specification Variables (the PEP which + introduced ‘ParamSpec’ and ‘Concatenate’) + + * *note Concatenate: 7bf. + + * *note Annotating callable objects: 2533. + + -- Data: typing.ParamSpecArgs + -- Data: typing.ParamSpecKwargs + + Arguments and keyword arguments attributes of a *note ParamSpec: + 15e. 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(): a46. 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. + + -- Class: typing.TypeAliasType (name, value, *, type_params=()) + + The type of type aliases created through the *note type: 433. + statement. + + Example: + + >>> type Alias = int + >>> type(Alias) + <class 'typing.TypeAliasType'> + + Added in version 3.12. + + -- Attribute: __name__ + + The name of the type alias: + + >>> type Alias = int + >>> Alias.__name__ + 'Alias' + + -- Attribute: __module__ + + The module in which the type alias was defined: + + >>> type Alias = int + >>> Alias.__module__ + '__main__' + + -- Attribute: __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__ + () + + -- Attribute: __value__ + + The type alias’s value. This is *note lazily evaluated: 452, + 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 + + ---------- 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: Special typing primitives + +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. + + -- Class: typing.NamedTuple + + Typed version of *note collections.namedtuple(): 1ca. + + Usage: + + class Employee(NamedTuple): + name: str + id: int + + This is equivalent to: + + Employee = collections.namedtuple('Employee', ['name', 'id']) + + To give a field a default value, you can assign to it in the class + body: + + class Employee(NamedTuple): + name: str + id: int = 3 + + employee = Employee('Guido') + assert employee.id == 3 + + Fields with a default value must come after any fields without a + default. + + The resulting class has an extra attribute ‘__annotations__’ giving + a dict that maps the field names to the field types. (The field + names are in the ‘_fields’ attribute and the default values are in + the ‘_field_defaults’ attribute, both of which are part of the + *note namedtuple(): 1ca. API.) + + ‘NamedTuple’ subclasses can also have docstrings and methods: + + 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] + + Backward-compatible usage: + + # 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)]) + + Changed in version 3.6: Added support for PEP 526(1) variable + annotation syntax. + + Changed in version 3.6.1: Added support for default values, + methods, and docstrings. + + Changed in version 3.8: The ‘_field_types’ and ‘__annotations__’ + attributes are now regular dictionaries instead of instances of + ‘OrderedDict’. + + Changed in version 3.9: Removed the ‘_field_types’ attribute in + favor of the more standard ‘__annotations__’ attribute which has + the same information. + + Changed in version 3.11: Added support for generic namedtuples. + + Deprecated since version 3.13, will be removed in version 3.15: The + undocumented keyword argument syntax for creating NamedTuple + classes (‘NT = NamedTuple("NT", x=int)’) is deprecated, and will be + disallowed in 3.15. Use the class-based syntax or the functional + syntax instead. + + Deprecated since version 3.13, will be removed in version 3.15: + When using the functional syntax to create a NamedTuple class, + failing to pass a value to the ‘fields’ parameter (‘NT = + NamedTuple("NT")’) is deprecated. Passing ‘None’ to the ‘fields’ + parameter (‘NT = NamedTuple("NT", None)’) is also deprecated. Both + will be disallowed in Python 3.15. To create a NamedTuple class + with 0 fields, use ‘class NT(NamedTuple): pass’ or ‘NT = + NamedTuple("NT", [])’. + + -- Class: typing.NewType (name, tp) + + Helper class to create low-overhead *note distinct types: 3f76. + + A ‘NewType’ is considered a distinct type by a typechecker. At + runtime, however, calling a ‘NewType’ returns its argument + unchanged. + + Usage: + + UserId = NewType('UserId', int) # Declare the NewType "UserId" + first_user = UserId(1) # "UserId" returns the argument unchanged at runtime + + -- Attribute: __module__ + + The module in which the new type is defined. + + -- Attribute: __name__ + + The name of the new type. + + -- Attribute: __supertype__ + + The type that the new type is based on. + + Added in version 3.5.2. + + Changed in version 3.10: ‘NewType’ is now a class rather than a + function. + + -- Class: typing.Protocol (Generic) + + Base class for protocol classes. + + Protocol classes are defined like this: + + class Proto(Protocol): + def meth(self) -> int: + ... + + Such classes are primarily used with static type checkers that + recognize structural subtyping (static duck-typing), for example: + + 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(): 43e. (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(): 43d. or *note issubclass(): 7bc. + + Protocol classes can be generic, for example: + + 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. + + -- Function: @typing.runtime_checkable + + Mark a protocol class as a runtime protocol. + + Such a protocol can be used with *note isinstance(): 43d. and *note + issubclass(): 7bc. This allows a simple-minded structural check, + very similar to “one trick ponies” in *note collections.abc: 1e. + such as *note Iterable: 224d. For example: + + @runtime_checkable + class Closable(Protocol): + def close(self): ... + + assert isinstance(open('/some/file'), Closable) + + @runtime_checkable + class Named(Protocol): + name: str + + import threading + assert isinstance(threading.Thread(name='Bob'), Named) + + This decorator raises *note TypeError: 534. when applied to a + non-protocol class. + + Note: ‘runtime_checkable()’ will check only the presence of + the required methods or attributes, not their type signatures + or types. For example, *note ssl.SSLObject: b81. is a class, + therefore it passes an *note issubclass(): 7bc. check against + *note Callable: 2533. However, the ‘ssl.SSLObject.__init__’ + method exists only to raise a *note TypeError: 534. with a + more informative message, therefore making it impossible to + call (instantiate) *note ssl.SSLObject: b81. + + Note: An *note isinstance(): 43d. 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(): + 4ce. calls for structural checks in performance-sensitive + code. + + Added in version 3.8. + + Changed in version 3.12: The internal implementation of *note + isinstance(): 43d. checks against runtime-checkable protocols now + uses *note inspect.getattr_static(): 490. to look up attributes + (previously, *note hasattr(): 4ce. 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. + + Changed in version 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(): 43d. checks comparing objects to the + protocol. See *note What’s new in Python 3.12: 4cd. for more + details. + + -- Class: typing.TypedDict (dict) + + Special construct to add type hints to a dictionary. At runtime it + is a plain *note dict: 258. + + ‘TypedDict’ declares a dictionary type that expects all of its + instances to have a certain set of keys, where each key is + associated with a value of a consistent type. This expectation is + not checked at runtime but is only enforced by type checkers. + Usage: + + 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: 258.: + + Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str}) + + This functional syntax allows defining keys which are not valid + *note identifiers: 1e94, for example because they are keywords or + contain hyphens, or when key names must not be *note mangled: 1cba. + 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: 5c1.: + + 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: 5c0.: + + class Point2D(TypedDict, total=False): + x: Required[int] + y: Required[int] + label: str + + # Alternative syntax + Point2D = TypedDict('Point2D', { + 'x': Required[int], + 'y': Required[int], + 'label': str + }, total=False) + + It is possible for a ‘TypedDict’ type to inherit from one or more + other ‘TypedDict’ types using the class-based syntax. Usage: + + class Point3D(Point2D): + z: int + + ‘Point3D’ has three items: ‘x’, ‘y’ and ‘z’. It is equivalent to + this definition: + + class Point3D(TypedDict): + x: int + y: int + z: int + + A ‘TypedDict’ cannot inherit from a non-‘TypedDict’ class, except + for *note Generic: 1619. 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: 1619. explicitly: + + T = TypeVar("T") + + class Group(TypedDict, Generic[T]): + key: T + group: list[T] + + A ‘TypedDict’ can be introspected via annotations dicts (see *note + Annotations Best Practices: 7d4. for more information on + annotations best practices), *note __total__: 3fa6, *note + __required_keys__: 3fa7, and *note __optional_keys__: 3fa8. + + -- Attribute: __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: 5c1, or it may inherit from another ‘TypedDict’ + with ‘total=False’. Therefore, it is generally better to use + *note __required_keys__: 3fa7. and *note __optional_keys__: + 3fa8. for introspection. + + -- Attribute: __required_keys__ + + Added in version 3.9. + + -- Attribute: __optional_keys__ + + ‘Point2D.__required_keys__’ and ‘Point2D.__optional_keys__’ + return *note frozenset: 5d6. objects containing required and + non-required keys, respectively. + + Keys marked with *note Required: 5c0. will always appear in + ‘__required_keys__’ and keys marked with *note NotRequired: + 5c1. 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. + + Note: If ‘from __future__ import annotations’ is used or + if annotations are given as strings, annotations are not + evaluated when the ‘TypedDict’ is defined. Therefore, + the runtime introspection that ‘__required_keys__’ and + ‘__optional_keys__’ rely on may not work properly, and + the values of the attributes may be incorrect. + + Support for *note ReadOnly: 161. is reflected in the following + attributes: + + -- Attribute: __readonly_keys__ + + A *note frozenset: 5d6. containing the names of all read-only + keys. Keys are read-only if they carry the *note ReadOnly: + 161. qualifier. + + Added in version 3.13. + + -- Attribute: __mutable_keys__ + + A *note frozenset: 5d6. containing the names of all mutable + keys. Keys are mutable if they do not carry the *note + ReadOnly: 161. qualifier. + + Added in version 3.13. + + See PEP 589(3) for more examples and detailed rules of using + ‘TypedDict’. + + Added in version 3.8. + + Changed in version 3.11: Added support for marking individual keys + as *note Required: 5c0. or *note NotRequired: 5c1. See PEP 655(4). + + Changed in version 3.11: Added support for generic ‘TypedDict’s. + + Changed in version 3.13: Removed support for the keyword-argument + method of creating ‘TypedDict’s. + + Changed in version 3.13: Support for the *note ReadOnly: 161. + qualifier was added. + + Deprecated since version 3.13, will be removed in version 3.15: + When using the functional syntax to create a TypedDict class, + failing to pass a value to the ‘fields’ parameter (‘TD = + TypedDict("TD")’) is deprecated. Passing ‘None’ to the ‘fields’ + parameter (‘TD = TypedDict("TD", None)’) is also deprecated. Both + will be disallowed in Python 3.15. To create a TypedDict class + with 0 fields, use ‘class TD(TypedDict): pass’ or ‘TD = + TypedDict("TD", {})’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0526/ + + (2) https://peps.python.org/pep-0544/ + + (3) https://peps.python.org/pep-0589/ + + (4) https://peps.python.org/pep-0655/ + + +File: python.info, Node: Protocols<3>, Next: ABCs for working with IO, Prev: Special typing primitives, Up: Module contents<3> + +5.27.1.18 Protocols +................... + +The following protocols are provided by the ‘typing’ module. All are +decorated with *note @runtime_checkable: 43e. + + -- Class: typing.SupportsAbs + + An ABC with one abstract method ‘__abs__’ that is covariant in its + return type. + + -- Class: typing.SupportsBytes + + An ABC with one abstract method ‘__bytes__’. + + -- Class: typing.SupportsComplex + + An ABC with one abstract method ‘__complex__’. + + -- Class: typing.SupportsFloat + + An ABC with one abstract method ‘__float__’. + + -- Class: typing.SupportsIndex + + An ABC with one abstract method ‘__index__’. + + Added in version 3.8. + + -- Class: typing.SupportsInt + + An ABC with one abstract method ‘__int__’. + + -- Class: typing.SupportsRound + + An ABC with one abstract method ‘__round__’ that is covariant in + its return type. + + +File: python.info, Node: ABCs for working with IO, Next: Functions and decorators, Prev: Protocols<3>, Up: Module contents<3> + +5.27.1.19 ABCs for working with IO +.................................. + + -- Class: typing.IO + -- Class: typing.TextIO + -- Class: typing.BinaryIO + + Generic type ‘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(): 517. + + +File: python.info, Node: Functions and decorators, Next: Introspection helpers, Prev: ABCs for working with IO, Up: Module contents<3> + +5.27.1.20 Functions and decorators +.................................. + + -- Function: typing.cast (typ, val) + + Cast a value to a type. + + This returns the value unchanged. To the type checker this signals + that the return value has the designated type, but at runtime we + intentionally don’t check anything (we want this to be as fast as + possible). + + -- Function: 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. + + -- Function: typing.assert_never (arg, /) + + Ask a static type checker to confirm that a line of code is + unreachable. + + Example: + + 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: 259. + or a *note str: 447, 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: 2f1. 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: 6a4, and nothing else. + + At runtime, this throws an exception when called. + + See also + ........ + + Unreachable Code and Exhaustiveness Checking(1) has more + information about exhaustiveness checking with static typing. + + Added in version 3.11. + + -- Function: 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: 939. 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. + + -- Function: @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: 1cb.-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: 1cb. + + 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: 1cb. 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: + 1cb. 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: + + + Parameters: + + * ‘eq_default’ (*note bool: 463.) – 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: 463.) – 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: 463.) – 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: 463.) – 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: 36b.‘[’*note Callable: + 7e5.‘[’‘...’‘, ’‘Any’‘]’‘, ’‘...’‘]’) – Specifies a static + list of supported classes or functions that describe fields, + similar to *note dataclasses.field(): 1a1f. 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 Description + + -------------------------------------------------------------------------------------------------------------- + + ‘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. + + See PEP 681(2) for more details. + + Added in version 3.11. + + -- Function: @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: 22a. + + 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 + + See PEP 484(3) for more details and comparison with other typing + semantics. + + Changed in version 3.11: Overloaded functions can now be + introspected at runtime using *note get_overloads(): 6aa. + + -- Function: typing.get_overloads (func) + + Return a sequence of *note @overload: 3fb3.-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: 3fb3, + ‘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. + + -- Function: 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. + + -- Function: @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. + + For example: + + 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 + ... + + There is no runtime checking of these properties. See PEP 591(4) + for more details. + + Added in version 3.8. + + Changed in version 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. + + -- Function: @typing.no_type_check + + Decorator to indicate that annotations are not type hints. + + This works as a class or function *note decorator: 72c. 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. + + -- Function: @typing.no_type_check_decorator + + Decorator to give another decorator the *note no_type_check(): 6b0. + effect. + + This wraps the decorator with something that wraps the decorated + function in *note no_type_check(): 6b0. + + Deprecated since version 3.13, will be removed in version 3.15: No + type checker ever added support for ‘@no_type_check_decorator’. It + is therefore deprecated, and will be removed in Python 3.15. + + -- Function: @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. + + For example: + + 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. + + -- Function: @typing.type_check_only + + Decorator to mark a class or function as unavailable at runtime. + + This decorator is itself not available at runtime. It is mainly + intended to mark classes that are defined in type stub files if an + implementation returns an instance of a private class: + + @type_check_only + class Response: # private or not available at runtime + code: int + def get_header(self, name: str) -> str: ... + + def fetch_response() -> Response: ... + + Note that returning instances of private classes is not + recommended. It is usually preferable to make such classes public. + + ---------- 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: Constant, Prev: Functions and decorators, Up: Module contents<3> + +5.27.1.21 Introspection helpers +............................... + + -- Function: typing.get_type_hints (obj, globalns=None, localns=None, + include_extras=False) + + Return a dictionary containing type hints for a function, method, + module or class object. + + This is often the same as ‘obj.__annotations__’, but this function + makes the following changes to the annotations dictionary: + + * Forward references encoded as string literals or *note + ForwardRef: 1843. objects are handled by evaluating them in + 'globalns', 'localns', and (where applicable) 'obj'’s *note + type parameter: 2b5. namespace. If 'globalns' or 'localns' is + not given, appropriate namespace dictionaries are inferred + from 'obj'. + + * ‘None’ is replaced with *note types.NoneType: 84e. + + * If *note @no_type_check: 6b0. 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__: + 1f29. and iteratively combining ‘__annotations__’ + dictionaries. Annotations on classes appearing earlier in the + *note method resolution order: 2180. always take precedence + over annotations on classes appearing later in the method + resolution order. + + * The function recursively replaces all occurrences of + ‘Annotated[T, ...]’ with ‘T’, unless 'include_extras' is set + to ‘True’ (see *note Annotated: 93d. for more information). + + See also *note inspect.get_annotations(): 80f, a lower-level + function that returns annotations more directly. + + Note: If any forward references in the annotations of 'obj' + are not resolvable or are not valid Python code, this function + will raise an exception such as *note NameError: 43a. For + example, this can happen with imported *note type aliases: + 44f. that include forward references, or with names imported + under *note if TYPE_CHECKING: cf4. + + Changed in version 3.9: Added ‘include_extras’ parameter as part of + PEP 593(1). See the documentation on *note Annotated: 93d. for + more information. + + Changed in version 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. + + -- Function: 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: + 1d. class, it will be normalized to the original class. If ‘X’ is + an instance of *note ParamSpecArgs: 7c1. or *note ParamSpecKwargs: + 7c2, return the underlying *note ParamSpec: 15e. Return ‘None’ for + unsupported objects. + + Examples: + + 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. + + -- Function: 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: 851. 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. + + Examples: + + 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. + + -- Function: typing.get_protocol_members (tp) + + Return the set of members defined in a *note Protocol: 266. + + >>> 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: 534. for arguments that are not Protocols. + + Added in version 3.13. + + -- Function: typing.is_protocol (tp) + + Determine if a type is a *note Protocol: 266. + + For example: + + class P(Protocol): + def a(self) -> str: ... + b: int + + is_protocol(P) # => True + is_protocol(int) # => False + + Added in version 3.13. + + -- Function: typing.is_typeddict (tp) + + Check if a type is a *note TypedDict: 162. + + For example: + + class Film(TypedDict): + title: str + year: int + + assert is_typeddict(Film) + assert not is_typeddict(list | str) + + # TypedDict is a factory for creating typed dicts, + # not a typed dict itself + assert not is_typeddict(TypedDict) + + Added in version 3.10. + + -- Class: 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. + + Note: 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. + + -- Data: typing.NoDefault + + A sentinel object used to indicate that a type parameter has no + default value. For example: + + >>> T = TypeVar("T") + >>> T.__default__ is typing.NoDefault + True + >>> S = TypeVar("S", default=None) + >>> S.__default__ is None + True + + Added in version 3.13. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0593/ + + (2) https://peps.python.org/pep-0585/ + + +File: python.info, Node: Constant, Next: Deprecated aliases, Prev: Introspection helpers, Up: Module contents<3> + +5.27.1.22 Constant +.................. + + -- Data: typing.TYPE_CHECKING + + A special constant that is assumed to be ‘True’ by 3rd party static + type checkers. It is ‘False’ at runtime. + + Usage: + + if TYPE_CHECKING: + import expensive_mod + + def fun(arg: 'expensive_mod.SomeType') -> None: + local_var: expensive_mod.AnotherType = other_fun() + + The first type annotation must be enclosed in quotes, making it a + “forward reference”, to hide the ‘expensive_mod’ reference from the + interpreter runtime. Type annotations for local variables are not + evaluated, so the second annotation does not need to be enclosed in + quotes. + + Note: If ‘from __future__ import annotations’ is used, + annotations are not evaluated at function definition time. + Instead, they are stored as strings in ‘__annotations__’. + This makes it unnecessary to use quotes around the annotation + (see PEP 563(1)). + + Added in version 3.5.2. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0563/ + + +File: python.info, Node: Deprecated aliases, Prev: Constant, Up: Module contents<3> + +5.27.1.23 Deprecated aliases +............................ + +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: Deprecated aliases + +5.27.1.24 Aliases to built-in types +................................... + + -- Class: typing.Dict (dict, MutableMapping[KT, VT]) + + Deprecated alias to *note dict: 258. + + Note that to annotate arguments, it is preferred to use an abstract + collection type such as *note Mapping: 8c9. rather than to use + *note dict: 258. or ‘typing.Dict’. + + Deprecated since version 3.9: *note builtins.dict: 258. now + supports subscripting (‘[]’). See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.List (list, MutableSequence[T]) + + Deprecated alias to *note list: 60d. + + Note that to annotate arguments, it is preferred to use an abstract + collection type such as *note Sequence: 11b6. or *note Iterable: + 224d. rather than to use *note list: 60d. or ‘typing.List’. + + Deprecated since version 3.9: *note builtins.list: 60d. now + supports subscripting (‘[]’). See PEP 585(2) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Set (set, MutableSet[T]) + + Deprecated alias to *note builtins.set: 5d5. + + Note that to annotate arguments, it is preferred to use an abstract + collection type such as *note collections.abc.Set: 2245. rather + than to use *note set: 5d5. or *note typing.Set: 3fbe. + + Deprecated since version 3.9: *note builtins.set: 5d5. now supports + subscripting (‘[]’). See PEP 585(3) and *note Generic Alias Type: + 6ae. + + -- Class: typing.FrozenSet (frozenset, AbstractSet[T_co]) + + Deprecated alias to *note builtins.frozenset: 5d6. + + Deprecated since version 3.9: *note builtins.frozenset: 5d6. now + supports subscripting (‘[]’). See PEP 585(4) and *note Generic + Alias Type: 6ae. + + -- Data: typing.Tuple + + Deprecated alias for *note tuple: 36b. + + *note tuple: 36b. and ‘Tuple’ are special-cased in the type system; + see *note Annotating tuples: 3f7b. for more details. + + Deprecated since version 3.9: *note builtins.tuple: 36b. now + supports subscripting (‘[]’). See PEP 585(5) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Type (Generic[CT_co]) + + Deprecated alias to *note type: d48. + + See *note The type of class objects: 3f7e. for details on using + *note type: d48. or ‘typing.Type’ in type annotations. + + Added in version 3.5.2. + + Deprecated since version 3.9: *note builtins.type: d48. now + supports subscripting (‘[]’). See PEP 585(6) and *note Generic + Alias Type: 6ae. + + ---------- 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: Deprecated aliases + +5.27.1.25 Aliases to types in ‘collections’ +........................................... + + -- Class: typing.DefaultDict (collections.defaultdict, + MutableMapping[KT, VT]) + + Deprecated alias to *note collections.defaultdict: 11af. + + Added in version 3.5.2. + + Deprecated since version 3.9: *note collections.defaultdict: 11af. + now supports subscripting (‘[]’). See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.OrderedDict (collections.OrderedDict, + MutableMapping[KT, VT]) + + Deprecated alias to *note collections.OrderedDict: 5d7. + + Added in version 3.7.2. + + Deprecated since version 3.9: *note collections.OrderedDict: 5d7. + now supports subscripting (‘[]’). See PEP 585(2) and *note Generic + Alias Type: 6ae. + + -- Class: typing.ChainMap (collections.ChainMap, MutableMapping[KT, + VT]) + + Deprecated alias to *note collections.ChainMap: c1c. + + Added in version 3.6.1. + + Deprecated since version 3.9: *note collections.ChainMap: c1c. now + supports subscripting (‘[]’). See PEP 585(3) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Counter (collections.Counter, Dict[T, int]) + + Deprecated alias to *note collections.Counter: 108b. + + Added in version 3.6.1. + + Deprecated since version 3.9: *note collections.Counter: 108b. now + supports subscripting (‘[]’). See PEP 585(4) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Deque (deque, MutableSequence[T]) + + Deprecated alias to *note collections.deque: 5d8. + + Added in version 3.6.1. + + Deprecated since version 3.9: *note collections.deque: 5d8. now + supports subscripting (‘[]’). See PEP 585(5) and *note Generic + Alias Type: 6ae. + + ---------- 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: Deprecated aliases + +5.27.1.26 Aliases to other concrete types +......................................... + + -- Class: typing.Pattern + -- Class: typing.Match + + Deprecated aliases corresponding to the return types from *note + re.compile(): bd3. and *note re.match(): 1220. + + These types (and the corresponding functions) are generic over + *note AnyStr: 2b4. ‘Pattern’ can be specialised as ‘Pattern[str]’ + or ‘Pattern[bytes]’; ‘Match’ can be specialised as ‘Match[str]’ or + ‘Match[bytes]’. + + Deprecated since version 3.9: Classes ‘Pattern’ and ‘Match’ from + *note re: b9. now support ‘[]’. See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Text + + Deprecated alias for *note str: 447. + + ‘Text’ is provided to supply a forward compatible path for Python 2 + code: in Python 2, ‘Text’ is an alias for ‘unicode’. + + Use ‘Text’ to indicate that a value must contain a unicode string + in a manner that is compatible with both Python 2 and Python 3: + + def add_unicode_checkmark(text: Text) -> Text: + return text + u' \u2713' + + Added in version 3.5.2. + + Deprecated since version 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: 447. 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: Deprecated aliases + +5.27.1.27 Aliases to container ABCs in ‘collections.abc’ +........................................................ + + -- Class: typing.AbstractSet (Collection[T_co]) + + Deprecated alias to *note collections.abc.Set: 2245. + + Deprecated since version 3.9: *note collections.abc.Set: 2245. now + supports subscripting (‘[]’). See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.ByteString (Sequence[int]) + + This type represents the types *note bytes: 1c2, *note bytearray: + 53a, and *note memoryview: 464. of byte sequences. + + Deprecated since version 3.9, will be removed in version 3.14: + Prefer *note collections.abc.Buffer: 2c6, or a union like ‘bytes | + bytearray | memoryview’. + + -- Class: typing.Collection (Sized, Iterable[T_co], Container[T_co]) + + Deprecated alias to *note collections.abc.Collection: c88. + + Added in version 3.6. + + Deprecated since version 3.9: *note collections.abc.Collection: + c88. now supports subscripting (‘[]’). See PEP 585(2) and *note + Generic Alias Type: 6ae. + + -- Class: typing.Container (Generic[T_co]) + + Deprecated alias to *note collections.abc.Container: 224f. + + Deprecated since version 3.9: *note collections.abc.Container: + 224f. now supports subscripting (‘[]’). See PEP 585(3) and *note + Generic Alias Type: 6ae. + + -- Class: typing.ItemsView (MappingView, AbstractSet[tuple[KT_co, + VT_co]]) + + Deprecated alias to *note collections.abc.ItemsView: 2253. + + Deprecated since version 3.9: *note collections.abc.ItemsView: + 2253. now supports subscripting (‘[]’). See PEP 585(4) and *note + Generic Alias Type: 6ae. + + -- Class: typing.KeysView (MappingView, AbstractSet[KT_co]) + + Deprecated alias to *note collections.abc.KeysView: 2252. + + Deprecated since version 3.9: *note collections.abc.KeysView: 2252. + now supports subscripting (‘[]’). See PEP 585(5) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Mapping (Collection[KT], Generic[KT, VT_co]) + + Deprecated alias to *note collections.abc.Mapping: 8c9. + + Deprecated since version 3.9: *note collections.abc.Mapping: 8c9. + now supports subscripting (‘[]’). See PEP 585(6) and *note Generic + Alias Type: 6ae. + + -- Class: typing.MappingView (Sized) + + Deprecated alias to *note collections.abc.MappingView: 2251. + + Deprecated since version 3.9: *note collections.abc.MappingView: + 2251. now supports subscripting (‘[]’). See PEP 585(7) and *note + Generic Alias Type: 6ae. + + -- Class: typing.MutableMapping (Mapping[KT, VT]) + + Deprecated alias to *note collections.abc.MutableMapping: 10a2. + + Deprecated since version 3.9: *note collections.abc.MutableMapping: + 10a2. now supports subscripting (‘[]’). See PEP 585(8) and *note + Generic Alias Type: 6ae. + + -- Class: typing.MutableSequence (Sequence[T]) + + Deprecated alias to *note collections.abc.MutableSequence: 1a1. + + Deprecated since version 3.9: *note + collections.abc.MutableSequence: 1a1. now supports subscripting + (‘[]’). See PEP 585(9) and *note Generic Alias Type: 6ae. + + -- Class: typing.MutableSet (AbstractSet[T]) + + Deprecated alias to *note collections.abc.MutableSet: 2250. + + Deprecated since version 3.9: *note collections.abc.MutableSet: + 2250. now supports subscripting (‘[]’). See PEP 585(10) and *note + Generic Alias Type: 6ae. + + -- Class: typing.Sequence (Reversible[T_co], Collection[T_co]) + + Deprecated alias to *note collections.abc.Sequence: 11b6. + + Deprecated since version 3.9: *note collections.abc.Sequence: 11b6. + now supports subscripting (‘[]’). See PEP 585(11) and *note + Generic Alias Type: 6ae. + + -- Class: typing.ValuesView (MappingView, Collection[_VT_co]) + + Deprecated alias to *note collections.abc.ValuesView: 2254. + + Deprecated since version 3.9: *note collections.abc.ValuesView: + 2254. now supports subscripting (‘[]’). See PEP 585(12) and *note + Generic Alias Type: 6ae. + + ---------- 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/ + + (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/ + + +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: Deprecated aliases + +5.27.1.28 Aliases to asynchronous ABCs in ‘collections.abc’ +........................................................... + + -- Class: typing.Coroutine (Awaitable[ReturnType], Generic[YieldType, + SendType, ReturnType]) + + Deprecated alias to *note collections.abc.Coroutine: ddc. + + See *note Annotating generators and coroutines: 2534. for details + on using *note collections.abc.Coroutine: ddc. and + ‘typing.Coroutine’ in type annotations. + + Added in version 3.5.3. + + Deprecated since version 3.9: *note collections.abc.Coroutine: ddc. + now supports subscripting (‘[]’). See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.AsyncGenerator (AsyncIterator[YieldType], + Generic[YieldType, SendType]) + + Deprecated alias to *note collections.abc.AsyncGenerator: c8a. + + See *note Annotating generators and coroutines: 2534. for details + on using *note collections.abc.AsyncGenerator: c8a. and + ‘typing.AsyncGenerator’ in type annotations. + + Added in version 3.6.1. + + Deprecated since version 3.9: *note collections.abc.AsyncGenerator: + c8a. now supports subscripting (‘[]’). See PEP 585(2) and *note + Generic Alias Type: 6ae. + + Changed in version 3.13: The ‘SendType’ parameter now has a + default. + + -- Class: typing.AsyncIterable (Generic[T_co]) + + Deprecated alias to *note collections.abc.AsyncIterable: dde. + + Added in version 3.5.2. + + Deprecated since version 3.9: *note collections.abc.AsyncIterable: + dde. now supports subscripting (‘[]’). See PEP 585(3) and *note + Generic Alias Type: 6ae. + + -- Class: typing.AsyncIterator (AsyncIterable[T_co]) + + Deprecated alias to *note collections.abc.AsyncIterator: ddd. + + Added in version 3.5.2. + + Deprecated since version 3.9: *note collections.abc.AsyncIterator: + ddd. now supports subscripting (‘[]’). See PEP 585(4) and *note + Generic Alias Type: 6ae. + + -- Class: typing.Awaitable (Generic[T_co]) + + Deprecated alias to *note collections.abc.Awaitable: ddb. + + Added in version 3.5.2. + + Deprecated since version 3.9: *note collections.abc.Awaitable: ddb. + now supports subscripting (‘[]’). See PEP 585(5) and *note Generic + Alias Type: 6ae. + + ---------- 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: Deprecated aliases + +5.27.1.29 Aliases to other ABCs in ‘collections.abc’ +.................................................... + + -- Class: typing.Iterable (Generic[T_co]) + + Deprecated alias to *note collections.abc.Iterable: 224d. + + Deprecated since version 3.9: *note collections.abc.Iterable: 224d. + now supports subscripting (‘[]’). See PEP 585(1) and *note Generic + Alias Type: 6ae. + + -- Class: typing.Iterator (Iterable[T_co]) + + Deprecated alias to *note collections.abc.Iterator: 224e. + + Deprecated since version 3.9: *note collections.abc.Iterator: 224e. + now supports subscripting (‘[]’). See PEP 585(2) and *note Generic + Alias Type: 6ae. + + -- Data: typing.Callable + + Deprecated alias to *note collections.abc.Callable: 7e5. + + See *note Annotating callable objects: 2533. for details on how to + use *note collections.abc.Callable: 7e5. and ‘typing.Callable’ in + type annotations. + + Deprecated since version 3.9: *note collections.abc.Callable: 7e5. + now supports subscripting (‘[]’). See PEP 585(3) and *note Generic + Alias Type: 6ae. + + Changed in version 3.10: ‘Callable’ now supports *note ParamSpec: + 15e. and *note Concatenate: 7bf. See PEP 612(4) for more details. + + -- Class: typing.Generator (Iterator[YieldType], Generic[YieldType, + SendType, ReturnType]) + + Deprecated alias to *note collections.abc.Generator: dda. + + See *note Annotating generators and coroutines: 2534. for details + on using *note collections.abc.Generator: dda. and + ‘typing.Generator’ in type annotations. + + Deprecated since version 3.9: *note collections.abc.Generator: dda. + now supports subscripting (‘[]’). See PEP 585(5) and *note Generic + Alias Type: 6ae. + + Changed in version 3.13: Default values for the send and return + types were added. + + -- Class: typing.Hashable + + Deprecated alias to *note collections.abc.Hashable: 4f1. + + Deprecated since version 3.12: Use *note collections.abc.Hashable: + 4f1. directly instead. + + -- Class: typing.Reversible (Iterable[T_co]) + + Deprecated alias to *note collections.abc.Reversible: c89. + + Deprecated since version 3.9: *note collections.abc.Reversible: + c89. now supports subscripting (‘[]’). See PEP 585(6) and *note + Generic Alias Type: 6ae. + + -- Class: typing.Sized + + Deprecated alias to *note collections.abc.Sized: 4f2. + + Deprecated since version 3.12: Use *note collections.abc.Sized: + 4f2. directly instead. + + ---------- 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: Deprecated aliases + +5.27.1.30 Aliases to ‘contextlib’ ABCs +...................................... + + -- Class: typing.ContextManager (Generic[T_co, ExitT_co]) + + Deprecated alias to *note contextlib.AbstractContextManager: c8d. + + The first type parameter, ‘T_co’, represents the type returned by + the *note __enter__(): 5c4. method. The optional second type + parameter, ‘ExitT_co’, which defaults to ‘bool | None’, represents + the type returned by the *note __exit__(): 12f3. method. + + Added in version 3.5.4. + + Deprecated since version 3.9: *note + contextlib.AbstractContextManager: c8d. now supports subscripting + (‘[]’). See PEP 585(1) and *note Generic Alias Type: 6ae. + + Changed in version 3.13: Added the optional second type parameter, + ‘ExitT_co’. + + -- Class: typing.AsyncContextManager (Generic[T_co, AExitT_co]) + + Deprecated alias to *note contextlib.AbstractAsyncContextManager: + b2b. + + The first type parameter, ‘T_co’, represents the type returned by + the *note __aenter__(): 1fd0. method. The optional second type + parameter, ‘AExitT_co’, which defaults to ‘bool | None’, represents + the type returned by the *note __aexit__(): 162a. method. + + Added in version 3.6.2. + + Deprecated since version 3.9: *note + contextlib.AbstractAsyncContextManager: b2b. now supports + subscripting (‘[]’). See PEP 585(2) and *note Generic Alias Type: + 6ae. + + Changed in version 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: Deprecation Timeline of Major Features, Prev: Module contents<3>, Up: typing — Support for type hints + +5.27.1.31 Deprecation Timeline of Major Features +................................................ + +Certain features in ‘typing’ are deprecated and may be removed in a +future version of Python. The following table summarizes major +deprecations for your convenience. This is subject to change, and not +all deprecations are listed. + +Feature Deprecated in Projected removal PEP/issue + +------------------------------------------------------------------------------------------------------------------------ + +‘typing’ versions of 3.9 Undecided (see PEP 585(1) +standard collections *note Deprecated aliases: 3fb8. + for more information) + + +*note typing.ByteString: 2d7. 3.9 3.14 gh-91896(2) + + +*note typing.Text: 305. 3.11 Undecided gh-92332(3) + + +*note typing.Hashable: 4ef. 3.12 Undecided gh-94309(4) +and +*note typing.Sized: 4f0. + +*note typing.TypeAlias: 7c4. 3.12 Undecided PEP 695(5) + + +*note @typing.no_type_check_decorator: 2b3.3.13 3.15 gh-106309(6) + + +*note typing.AnyStr: 2b4. 3.13 3.18 gh-105578(7) + + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0585/ + + (2) https://github.com/python/cpython/issues/91896 + + (3) https://github.com/python/cpython/issues/92332 + + (4) https://github.com/python/cpython/issues/94309 + + (5) https://peps.python.org/pep-0695/ + + (6) https://github.com/python/cpython/issues/106309 + + (7) https://github.com/python/cpython/issues/105578 + + +File: python.info, Node: pydoc — Documentation generator and online help system, Next: Python Development Mode, Prev: typing — Support for type hints, Up: Development Tools + +5.27.2 ‘pydoc’ — Documentation generator and online help system +--------------------------------------------------------------- + +'Source code:' 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__: 927. 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(): 15c7.). + +The built-in function *note help(): 8d6. 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 + +at a shell prompt will display documentation on the *note sys: d9. +module, in a style similar to the manual pages shown by the Unix ‘man’ +command. The argument to ‘pydoc’ can be the name of a function, module, +or package, or a dotted reference to a class, method, or function within +a module or module in a package. If the argument to ‘pydoc’ looks like +a path (that is, it contains the path separator for your operating +system, such as a slash in Unix), and refers to an existing Python +source file, then documentation is produced for that file. + + Note: 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. + +Specifying a ‘-w’ flag before the argument will cause HTML documentation +to be written out to a file in the current directory, instead of +displaying text on the console. + +Specifying a ‘-k’ flag before the argument will search the synopsis +lines of all available modules for the keyword given as the argument, +again in a manner similar to the Unix ‘man’ command. The synopsis line +of a module is the first line of its documentation string. + +You can also use ‘pydoc’ to start an HTTP server on the local machine +that will serve documentation to visiting web browsers. ‘python -m +pydoc -p 1234’ will start a HTTP server on port 1234, allowing you to +browse the documentation at ‘http://localhost:1234/’ in your preferred +web browser. Specifying ‘0’ as the port number will select an arbitrary +unused port. + +‘python -m pydoc -n <hostname>’ will start the server listening at the +given hostname. By default the hostname is ‘localhost’ but if you want +the server to be reached from other machines, you may want to change the +host name that the server responds to. During development this is +especially useful if you want to run pydoc from within a container. + +‘python -m pydoc -b’ will start the server and additionally open a web +browser to a module index page. Each served page has a navigation bar +at the top where you can 'Get' help on an individual item, 'Search' all +modules with a keyword in their synopsis line, and go to the 'Module +index', 'Topics' and 'Keywords' pages. + +When ‘pydoc’ generates documentation, it uses the current environment +and path to locate modules. Thus, invoking ‘pydoc spam’ documents +precisely the version of the module you would get if you started the +Python interpreter and typed ‘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. + +Changed in version 3.2: Added the ‘-b’ option. + +Changed in version 3.3: The ‘-g’ command line option was removed. + +Changed in version 3.4: ‘pydoc’ now uses *note inspect.signature(): 733. +rather than *note inspect.getfullargspec(): 734. to extract signature +information from callables. + +Changed in version 3.7: Added the ‘-n’ option. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pydoc.py + + +File: python.info, Node: Python Development Mode, Next: doctest — Test interactive Python examples, Prev: pydoc — Documentation generator and online help system, Up: Development Tools + +5.27.3 Python Development Mode +------------------------------ + +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: 176. command line option or by +setting the *note PYTHONDEVMODE: aed. environment variable to ‘1’. + +See also *note Python debug build: 1fb. + +* Menu: + +* Effects of the Python Development Mode:: +* ResourceWarning Example:: +* Bad file descriptor error example:: + + +File: python.info, Node: Effects of the Python Development Mode, Next: ResourceWarning Example, Up: Python Development Mode + +5.27.3.1 Effects of the Python Development Mode +............................................... + +Enabling the Python Development Mode is similar to the following +command, but with additional effects described below: + + PYTHONMALLOC=debug PYTHONASYNCIODEBUG=1 python -W default -X faulthandler + +Effects of the Python Development Mode: + + * Add ‘default’ *note warning filter: 1d39. The following warnings + are shown: + + * *note DeprecationWarning: 1a5. + + * *note ImportWarning: 4f6. + + * *note PendingDeprecationWarning: 8c7. + + * *note ResourceWarning: 246. + + Normally, the above warnings are filtered by the default *note + warning filters: 1d39. + + It behaves as if the *note -W default: 8c6. command line option is + used. + + Use the *note -W error: 8c6. command line option or set the *note + PYTHONWARNINGS: baa. 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(): c6a. C function. + + It behaves as if the *note PYTHONMALLOC: c64. environment variable + is set to ‘debug’. + + To enable the Python Development Mode without installing debug + hooks on memory allocators, set the *note PYTHONMALLOC: c64. + environment variable to ‘default’. + + * Call *note faulthandler.enable(): c9e. at Python startup to install + handlers for the *note SIGSEGV: 1d49, *note SIGFPE: 1d4a, *note + SIGABRT: 1d4b, *note SIGBUS: 1d4c. and *note SIGILL: 1d4d. signals + to dump the Python traceback on a crash. + + It behaves as if the *note -X faulthandler: 176. command line + option is used or if the *note PYTHONFAULTHANDLER: 1079. + environment variable is set to ‘1’. + + * Enable *note asyncio debug mode: 1d4f. For example, *note asyncio: + a. checks for coroutines that were not awaited and logs them. + + It behaves as if the *note PYTHONASYNCIODEBUG: 1d4e. environment + variable is set to ‘1’. + + * Check the 'encoding' and 'errors' arguments for string encoding and + decoding operations. Examples: *note open(): 517, *note + str.encode(): 8d4. and *note bytes.decode(): 8d5. + + 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: 1f7. destructor logs ‘close()’ exceptions. + + * Set the *note dev_mode: 1aa0. attribute of *note sys.flags: 688. to + ‘True’. + +The Python Development Mode does not enable the *note tracemalloc: ff. +module by default, because the overhead cost (to performance and memory) +would be too large. Enabling the *note tracemalloc: ff. module provides +additional information on the origin of some errors. For example, *note +ResourceWarning: 246. 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: db4. command +line option from removing *note assert: 968. statements nor from setting +*note __debug__: 7d5. 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: 688. + +Changed in version 3.8: The *note io.IOBase: 1f7. destructor now logs +‘close()’ exceptions. + +Changed in version 3.9: The 'encoding' and 'errors' arguments are now +checked for string encoding and decoding operations. + + +File: python.info, Node: ResourceWarning Example, Next: Bad file descriptor error example, Prev: Effects of the Python Development Mode, Up: Python Development Mode + +5.27.3.2 ResourceWarning Example +................................ + +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) + # The file is closed implicitly + + 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: +246. 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: ff. 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(): + # Close the file explicitly when exiting the with block + 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 Example, Up: Python Development Mode + +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()) + # The file is closed implicitly + + main() + +By default, Python does not emit any warning: + + $ python script.py + import os + +The Python Development Mode shows a *note ResourceWarning: 246. 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 — Test interactive Python examples, Next: unittest — Unit testing framework, Prev: Python Development Mode, Up: Development Tools + +5.27.4 ‘doctest’ — Test interactive Python examples +--------------------------------------------------- + +'Source code:' Lib/doctest.py(1) + +__________________________________________________________________ + +The *note doctest: 3a. 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: + + * To check that a module’s docstrings are up-to-date by verifying + that all interactive examples still work as documented. + + * To perform regression testing by verifying that interactive + examples from a test file or a test object work as expected. + + * To write tutorial documentation for a package, liberally + illustrated with input-output examples. Depending on whether the + examples or the expository text are emphasized, this has the flavor + of “literate testing” or “executable documentation”. + +Here’s a complete but small example module: + + """ + 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, *note doctest: +3a. 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 *note doctest: 3a. 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 + +And so on, eventually ending with: + + 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 *note +doctest: 3a.! 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’. + +* Menu: + +* Simple Usage; Checking Examples in Docstrings: Simple Usage Checking Examples in Docstrings. +* Simple Usage; Checking Examples in a Text File: Simple Usage Checking Examples in a Text File. +* Command-line Usage:: +* How It Works:: +* Basic API:: +* Unittest API:: +* Advanced API:: +* Debugging:: +* Soapbox:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/doctest.py + + +File: python.info, Node: Simple Usage Checking Examples in Docstrings, Next: Simple Usage Checking Examples in a Text File, Up: doctest — Test interactive Python examples + +5.27.4.1 Simple Usage: Checking Examples in Docstrings +...................................................... + +The simplest way to start using doctest (but not necessarily the way +you’ll continue to do it) is to end each module ‘M’ with: + + if __name__ == "__main__": + import doctest + doctest.testmod() + +‘doctest’ then examines docstrings in module ‘M’. + +Running the module as a script causes the examples in the docstrings to +get executed and verified: + + python M.py + +This won’t display anything unless an example fails, in which case the +failing example(s) and the cause(s) of the failure(s) are printed to +stdout, and the final line of output is ‘***Test Failed*** N failures.’, +where 'N' is the number of examples that failed. + +Run it with the ‘-v’ switch instead: + + python M.py -v + +and a detailed report of all examples tried is printed to standard +output, along with assorted summaries at the end. + +You can force verbose mode by passing ‘verbose=True’ to *note testmod(): +1436, or prohibit it by passing ‘verbose=False’. In either of those +cases, *note sys.argv: 1258. is not examined by *note testmod(): 1436. +(so passing ‘-v’ or not has no effect). + +There is also a command line shortcut for running *note testmod(): 1436, +see section *note Command-line Usage: 3ff1. + +For more information on *note testmod(): 1436, see section *note Basic +API: 3ff2. + + +File: python.info, Node: Simple Usage Checking Examples in a Text File, Next: Command-line Usage, Prev: Simple Usage Checking Examples in Docstrings, Up: doctest — Test interactive Python examples + +5.27.4.2 Simple Usage: Checking Examples in a Text File +....................................................... + +Another simple application of doctest is testing interactive examples in +a text file. This can be done with the *note testfile(): 3ff5. +function: + + import doctest + doctest.testfile("example.txt") + +That short script executes and verifies any interactive Python examples +contained in the file ‘example.txt’. The file content is treated as if +it were a single giant docstring; the file doesn’t need to contain a +Python program! For example, perhaps ‘example.txt’ contains this: + + 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 + +Running ‘doctest.testfile("example.txt")’ then finds the error in this +documentation: + + File "./example.txt", line 14, in example.txt + Failed example: + factorial(6) + Expected: + 120 + Got: + 720 + +As with *note testmod(): 1436, *note testfile(): 3ff5. won’t display +anything unless an example fails. If an example does fail, then the +failing example(s) and the cause(s) of the failure(s) are printed to +stdout, using the same format as ‘testmod()’. + +By default, *note testfile(): 3ff5. looks for files in the calling +module’s directory. See section *note Basic API: 3ff2. for a +description of the optional arguments that can be used to tell it to +look for files in other locations. + +Like *note testmod(): 1436, *note testfile(): 3ff5.’s verbosity can be +set with the ‘-v’ command-line switch or with the optional keyword +argument 'verbose'. + +There is also a command line shortcut for running *note testfile(): +3ff5, see section *note Command-line Usage: 3ff1. + +For more information on *note testfile(): 3ff5, see section *note Basic +API: 3ff2. + + +File: python.info, Node: Command-line Usage, Next: How It Works, Prev: Simple Usage Checking Examples in a Text File, Up: doctest — Test interactive Python examples + +5.27.4.3 Command-line Usage +........................... + +The *note doctest: 3a. 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 + + This will import ‘example.py’ as a standalone module and run *note + testmod(): 1436. on it. Note that this may not work correctly if + the file is part of a package and imports other submodules from + that package. + + If the file name does not end with ‘.py’, ‘doctest’ infers that it + must be run with *note testfile(): 3ff5. instead: + + python -m doctest -v example.txt + + -- Option: -o, --option <option> + + Option flags control various aspects of doctest’s behavior, see + section *note Option Flags: f2e. + + 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: How It Works, Next: Basic API, Prev: Command-line Usage, Up: doctest — Test interactive Python examples + +5.27.4.4 How It Works +..................... + +This section examines in detail how doctest works: which docstrings it +looks at, how it finds interactive examples, what execution context it +uses, how it handles exceptions, and how option flags can be used to +control its behavior. This is the information that you need to know to +write doctest examples; for information about actually running doctest +on these examples, see the following sections. + +* Menu: + +* Which Docstrings Are Examined?:: +* How are Docstring Examples Recognized?:: +* What’s the Execution Context?:: +* What About Exceptions?:: +* Option Flags:: +* Directives:: +* Warnings: Warnings<2>. + + +File: python.info, Node: Which Docstrings Are Examined?, Next: How are Docstring Examples Recognized?, Up: How It Works + +5.27.4.5 Which Docstrings Are Examined? +....................................... + +The module docstring, and all function, class and method docstrings are +searched. Objects imported into the module are not searched. + +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. + +Any classes found are recursively searched similarly, to test docstrings +in their contained methods and nested classes. + + +File: python.info, Node: How are Docstring Examples Recognized?, Next: What’s the Execution Context?, Prev: Which Docstrings Are Examined?, Up: How It Works + +5.27.4.6 How are Docstring Examples Recognized? +............................................... + +In most cases a copy-and-paste of an interactive console session works +fine, but doctest isn’t trying to do an exact emulation of any specific +Python shell. + + >>> # comments are ignored + >>> x = 12 + >>> x + 12 + >>> if x == 13: + ... print("yes") + ... else: + ... print("no") + ... print("NO") + ... print("NO!!!") + ... + no + NO + NO!!! + >>> + +Any expected output must immediately follow the final ‘'>>> '’ or ‘'... +'’ line containing the code, and the expected output (if any) extends to +the next ‘'>>> '’ or all-whitespace line. + +The fine print: + + * Expected output cannot contain an all-whitespace line, since such a + line is taken to signal the end of expected output. If expected + output does contain a blank line, put ‘<BLANKLINE>’ in your doctest + example each place a blank line is expected. + + * All hard tab characters are expanded to spaces, using 8-column tab + stops. Tabs in output generated by the tested code are not + modified. Because any hard tabs in the sample output 'are' + expanded, this means that if the code output includes hard tabs, + the only way the doctest can pass is if the *note + NORMALIZE_WHITESPACE: 4004. option or *note directive: 4005. is in + effect. Alternatively, the test can be rewritten to capture the + output and compare it to an expected value as part of the test. + This handling of tabs in the source was arrived at through trial + and error, and has proven to be the least error prone way of + handling them. It is possible to use a different algorithm for + handling tabs by writing a custom *note DocTestParser: 4006. class. + + * Output to stdout is captured, but not output to stderr (exception + tracebacks are captured via a different means). + + * If you continue a line via backslashing in an interactive session, + or for any other reason use a backslash, you should use a raw + docstring, which will preserve your backslashes exactly as you type + them: + + >>> def f(x): + ... r'''Backslashes in a raw docstring: m\n''' + ... + >>> print(f.__doc__) + Backslashes in a raw docstring: m\n + + Otherwise, the backslash will be interpreted as part of the string. + For example, the ‘\n’ above would be interpreted as a newline + character. Alternatively, you can double each backslash in the + doctest version (and not use a raw string): + + >>> def f(x): + ... '''Backslashes in a raw docstring: m\\n''' + ... + >>> print(f.__doc__) + Backslashes in a raw docstring: m\n + + * The starting column doesn’t matter: + + >>> assert "Easy!" + >>> import math + >>> math.floor(1.9) + 1 + + and as many leading whitespace characters are stripped from the + expected output as appeared in the initial ‘'>>> '’ line that + started the example. + + +File: python.info, Node: What’s the Execution Context?, Next: What About Exceptions?, Prev: How are Docstring Examples Recognized?, Up: How It Works + +5.27.4.7 What’s the Execution Context? +...................................... + +By default, each time *note doctest: 3a. 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. + +You can force use of your own dict as the execution context by passing +‘globs=your_dict’ to *note testmod(): 1436. or *note testfile(): 3ff5. +instead. + + +File: python.info, Node: What About Exceptions?, Next: Option Flags, Prev: What’s the Execution Context?, Up: How It Works + +5.27.4.8 What About Exceptions? +............................... + +No problem, provided that the traceback is the only output produced by +the example: just paste in the traceback. (1) Since tracebacks contain +details that are likely to change rapidly (for example, exact file paths +and line numbers), this is one case where doctest works hard to be +flexible in what it accepts. + +Simple example: + + >>> [1, 2, 3].remove(42) + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + ValueError: list.remove(x): x not in list + +That doctest succeeds if *note ValueError: 204. is raised, with the +‘list.remove(x): x not in list’ detail as shown. + +The expected output for an exception must start with a traceback header, +which may be either of the following two lines, indented the same as the +first line of the example: + + Traceback (most recent call last): + Traceback (innermost last): + +The traceback header is followed by an optional traceback stack, whose +contents are ignored by doctest. The traceback stack is typically +omitted, or copied verbatim from an interactive session. + +The traceback stack is followed by the most interesting part: the +line(s) containing the exception type and detail. This is usually the +last line of a traceback, but can extend across multiple lines if the +exception has a multi-line detail: + + >>> raise ValueError('multi\n line\ndetail') + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + ValueError: multi + line + detail + +The last three lines (starting with *note ValueError: 204.) are compared +against the exception’s type and detail, and the rest are ignored. + +Best practice is to omit the traceback stack, unless it adds significant +documentation value to the example. So the last example is probably +better as: + + >>> raise ValueError('multi\n line\ndetail') + Traceback (most recent call last): + ... + ValueError: multi + line + detail + +Note that tracebacks are treated very specially. In particular, in the +rewritten example, the use of ‘...’ is independent of doctest’s *note +ELLIPSIS: 1437. option. The ellipsis in that example could be left out, +or could just as well be three (or three hundred) commas or digits, or +an indented transcript of a Monty Python skit. + +Some details you should read once, but won’t need to remember: + + * Doctest can’t guess whether your expected output came from an + exception traceback or from ordinary printing. So, e.g., an + example that expects ‘ValueError: 42 is prime’ will pass whether + *note ValueError: 204. is actually raised or if the example merely + prints that traceback text. In practice, ordinary output rarely + begins with a traceback header line, so this doesn’t create real + problems. + + * Each line of the traceback stack (if present) must be indented + further than the first line of the example, 'or' start with a + non-alphanumeric character. The first line following the traceback + header indented the same and starting with an alphanumeric is taken + to be the start of the exception detail. Of course this does the + right thing for genuine tracebacks. + + * When the *note IGNORE_EXCEPTION_DETAIL: 12fc. doctest option is + specified, everything following the leftmost colon and any module + information in the exception name is ignored. + + * The interactive shell omits the traceback header line for some + *note SyntaxError: 18d.s. But doctest uses the traceback header + line to distinguish exceptions from non-exceptions. So in the rare + case where you need to test a ‘SyntaxError’ that omits the + traceback header, you will need to manually add the traceback + header line to your test example. + + * 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' + + Since the lines showing the position of the error come before the + exception type and detail, they are not checked by doctest. For + example, the following test would pass, even though it puts the ‘^’ + marker in the wrong location: + + >>> 1 + None + File "<stdin>", line 1 + 1 + None + ^~~~~~~~ + TypeError: unsupported operand type(s) for +: 'int' and 'NoneType' + + ---------- Footnotes ---------- + + (1) Examples containing both expected output and an exception are not +supported. Trying to guess where one ends and the other begins is too +error-prone, and that also makes for a confusing test. + + +File: python.info, Node: Option Flags, Next: Directives, Prev: What About Exceptions?, Up: How It Works + +5.27.4.9 Option Flags +..................... + +A number of option flags control various aspects of doctest’s behavior. +Symbolic names for the flags are supplied as module constants, which can +be *note bitwise ORed: 2071. together and passed to various functions. +The names can also be used in *note doctest directives: 4005, and may be +passed to the doctest command line interface via the ‘-o’ option. + +The first group of options define test semantics, controlling aspects of +how doctest decides whether actual output matches an example’s expected +output: + + -- Data: doctest.DONT_ACCEPT_TRUE_FOR_1 + + By default, if an expected output block contains just ‘1’, an + actual output block containing just ‘1’ or just ‘True’ is + considered to be a match, and similarly for ‘0’ versus ‘False’. + When *note DONT_ACCEPT_TRUE_FOR_1: 400d. is specified, neither + substitution is allowed. The default behavior caters to that + Python changed the return type of many functions from integer to + boolean; doctests expecting “little integer” output still work in + these cases. This option will probably go away, but not for + several years. + + -- Data: doctest.DONT_ACCEPT_BLANKLINE + + By default, if an expected output block contains a line containing + only the string ‘<BLANKLINE>’, then that line will match a blank + line in the actual output. Because a genuinely blank line delimits + the expected output, this is the only way to communicate that a + blank line is expected. When *note DONT_ACCEPT_BLANKLINE: 400e. is + specified, this substitution is not allowed. + + -- Data: doctest.NORMALIZE_WHITESPACE + + When specified, all sequences of whitespace (blanks and newlines) + are treated as equal. Any sequence of whitespace within the + expected output will match any sequence of whitespace within the + actual output. By default, whitespace must match exactly. *note + NORMALIZE_WHITESPACE: 4004. is especially useful when a line of + expected output is very long, and you want to wrap it across + multiple lines in your source. + + -- Data: doctest.ELLIPSIS + + When specified, an ellipsis marker (‘...’) in the expected output + can match any substring in the actual output. This includes + substrings that span line boundaries, and empty substrings, so it’s + best to keep usage of this simple. Complicated uses can lead to + the same kinds of “oops, it matched too much!” surprises that ‘.*’ + is prone to in regular expressions. + + -- Data: 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: 534. 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: 1437. 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. + + Changed in version 3.2: *note IGNORE_EXCEPTION_DETAIL: 12fc. now + also ignores any information relating to the module containing the + exception under test. + + -- Data: doctest.SKIP + + When specified, do not run the example at all. This can be useful + in contexts where doctest examples serve as both documentation and + test cases, and an example should be included for documentation + purposes, but should not be checked. E.g., the example’s output + might be random; or the example might depend on resources which + would be unavailable to the test driver. + + The SKIP flag can also be used for temporarily “commenting out” + examples. + + -- Data: doctest.COMPARISON_FLAGS + + A bitmask or’ing together all the comparison flags above. + +The second group of options controls how test failures are reported: + + -- Data: doctest.REPORT_UDIFF + + When specified, failures that involve multi-line expected and + actual outputs are displayed using a unified diff. + + -- Data: doctest.REPORT_CDIFF + + When specified, failures that involve multi-line expected and + actual outputs will be displayed using a context diff. + + -- Data: doctest.REPORT_NDIFF + + When specified, differences are computed by ‘difflib.Differ’, using + the same algorithm as the popular ‘ndiff.py’ utility. This is the + only method that marks differences within lines as well as across + lines. For example, if a line of expected output contains digit + ‘1’ where actual output contains letter ‘l’, a line is inserted + with a caret marking the mismatching column positions. + + -- Data: doctest.REPORT_ONLY_FIRST_FAILURE + + When specified, display the first failing example in each doctest, + but suppress output for all remaining examples. This will prevent + doctest from reporting correct examples that break because of + earlier failures; but it might also hide incorrect examples that + fail independently of the first failure. When *note + REPORT_ONLY_FIRST_FAILURE: 4011. is specified, the remaining + examples are still run, and still count towards the total number of + failures reported; only the output is suppressed. + + -- Data: doctest.FAIL_FAST + + When specified, exit after the first failing example and don’t + attempt to run the remaining examples. Thus, the number of + failures reported will be at most 1. This flag may be useful + during debugging, since examples after the first failure won’t even + produce debugging output. + + -- Data: doctest.REPORTING_FLAGS + + A bitmask or’ing together all the reporting flags above. + +There is also a way to register new option flag names, though this isn’t +useful unless you intend to extend *note doctest: 3a. internals via +subclassing: + + -- Function: doctest.register_optionflag (name) + + Create a new option flag with a given name, and return the new + flag’s integer value. *note register_optionflag(): 4013. can be + used when subclassing *note OutputChecker: 4014. or *note + DocTestRunner: 4015. to create new options that are supported by + your subclasses. *note register_optionflag(): 4013. should always + be called using the following idiom: + + MY_FLAG = register_optionflag('MY_FLAG') + + +File: python.info, Node: Directives, Next: Warnings<2>, Prev: Option Flags, Up: How It Works + +5.27.4.10 Directives +.................... + +Doctest directives may be used to modify the *note option flags: f2e. +for an individual example. Doctest directives are special Python +comments following an example’s source code: + + directive ::= "#" "doctest:" *note directive_options: 4018. + directive_options ::= *note directive_option: 4019. ("," *note directive_option: 4019.)* + directive_option ::= *note on_or_off: 401a. *note directive_option_name: 401b. + on_or_off ::= "+" | "-" + directive_option_name ::= "DONT_ACCEPT_BLANKLINE" | "NORMALIZE_WHITESPACE" | ... + +Whitespace is not allowed between the ‘+’ or ‘-’ and the directive +option name. The directive option name can be any of the option flag +names explained above. + +An example’s doctest directives modify doctest’s behavior for that +single example. Use ‘+’ to enable the named behavior, or ‘-’ to disable +it. + +For example, this test passes: + + >>> 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] + +Without the directive it would fail, both because the actual output +doesn’t have two blanks before the single-digit list elements, and +because the actual output is on a single line. This test also passes, +and also requires a directive to do so: + + >>> print(list(range(20))) # doctest: +ELLIPSIS + [0, 1, ..., 18, 19] + +Multiple directives can be used on a single physical line, separated by +commas: + + >>> print(list(range(20))) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE + [0, 1, ..., 18, 19] + +If multiple directive comments are used for a single example, then they +are combined: + + >>> print(list(range(20))) # doctest: +ELLIPSIS + ... # doctest: +NORMALIZE_WHITESPACE + [0, 1, ..., 18, 19] + +As the previous example shows, you can add ‘...’ lines to your example +containing only directives. This can be useful when an example is too +long for a directive to comfortably fit on the same line: + + >>> print(list(range(5)) + list(range(10, 20)) + list(range(30, 40))) + ... # doctest: +ELLIPSIS + [0, ..., 4, 10, ..., 19, 30, ..., 39] + +Note that since all options are disabled by default, and directives +apply only to the example they appear in, enabling options (via ‘+’ in a +directive) is usually the only meaningful choice. However, option flags +can also be passed to functions that run doctests, establishing +different defaults. In such cases, disabling an option via ‘-’ in a +directive can be useful. + + +File: python.info, Node: Warnings<2>, Prev: Directives, Up: How It Works + +5.27.4.11 Warnings +.................. + +*note doctest: 3a. 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"} + +is vulnerable! One workaround is to do + + >>> foo() == {"spam", "eggs"} + True + +instead. Another is to do + + >>> d = sorted(foo()) + >>> d + ['eggs', 'spam'] + +There are others, but you get the idea. + +Another bad idea is to print things that embed an object address, like + + >>> 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> + +The *note ELLIPSIS: 1437. directive gives a nice approach for the last +example: + + >>> 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 + +Numbers of the form ‘I/2.**J’ are safe across all platforms, and I often +contrive doctest examples to produce numbers of that form: + + >>> 3./4 # utterly safe + 0.75 + +Simple fractions are also easier for people to understand, and that +makes for better documentation. + + +File: python.info, Node: Basic API, Next: Unittest API, Prev: How It Works, Up: doctest — Test interactive Python examples + +5.27.4.12 Basic API +................... + +The functions *note testmod(): 1436. and *note testfile(): 3ff5. provide +a simple interface to doctest that should be sufficient for most basic +uses. For a less formal introduction to these two functions, see +sections *note Simple Usage; Checking Examples in Docstrings: 3fef. and +*note Simple Usage; Checking Examples in a Text File: 3ff3. + + -- Function: 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) + + All arguments except 'filename' are optional, and should be + specified in keyword form. + + Test examples in the file named 'filename'. Return + ‘(failure_count, test_count)’. + + Optional argument 'module_relative' specifies how the filename + should be interpreted: + + * If 'module_relative' is ‘True’ (the default), then 'filename' + specifies an OS-independent module-relative path. By default, + this path is relative to the calling module’s directory; but + if the 'package' argument is specified, then it is relative to + that package. To ensure OS-independence, 'filename' should + use ‘/’ characters to separate path segments, and may not be + an absolute path (i.e., it may not begin with ‘/’). + + * If 'module_relative' is ‘False’, then 'filename' specifies an + OS-specific path. The path may be absolute or relative; + relative paths are resolved with respect to the current + working directory. + + Optional argument 'name' gives the name of the test; by default, or + if ‘None’, ‘os.path.basename(filename)’ is used. + + Optional argument 'package' is a Python package or the name of a + Python package whose directory should be used as the base directory + for a module-relative filename. If no package is specified, then + the calling module’s directory is used as the base directory for + module-relative filenames. It is an error to specify 'package' if + 'module_relative' is ‘False’. + + Optional argument 'globs' gives a dict to be used as the globals + when executing examples. A new shallow copy of this dict is + created for the doctest, so its examples start with a clean slate. + By default, or if ‘None’, a new empty dict is used. + + Optional argument 'extraglobs' gives a dict merged into the globals + used to execute examples. This works like *note dict.update(): + 142e.: if 'globs' and 'extraglobs' have a common key, the + associated value in 'extraglobs' appears in the combined dict. By + default, or if ‘None’, no extra globals are used. This is an + advanced feature that allows parameterization of doctests. For + example, a doctest can be written for a base class, using a generic + name for the class, then reused to test any number of subclasses by + passing an 'extraglobs' dict mapping the generic name to the + subclass to be tested. + + Optional argument 'verbose' prints lots of stuff if true, and + prints only failures if false; by default, or if ‘None’, it’s true + if and only if ‘'-v'’ is in *note sys.argv: 1258. + + Optional argument 'report' prints a summary at the end when true, + else prints nothing at the end. In verbose mode, the summary is + detailed, else the summary is very brief (in fact, empty if all + tests passed). + + Optional argument 'optionflags' (default value ‘0’) takes the *note + bitwise OR: 2071. of option flags. See section *note Option Flags: + f2e. + + Optional argument 'raise_on_error' defaults to false. If true, an + exception is raised upon the first failure or unexpected exception + in an example. This allows failures to be post-mortem debugged. + Default behavior is to continue running examples. + + Optional argument 'parser' specifies a *note DocTestParser: 4006. + (or subclass) that should be used to extract tests from the files. + It defaults to a normal parser (i.e., ‘DocTestParser()’). + + Optional argument 'encoding' specifies an encoding that should be + used to convert the file to unicode. + + -- Function: doctest.testmod (m=None, name=None, globs=None, + verbose=None, report=True, optionflags=0, extraglobs=None, + raise_on_error=False, exclude_empty=False) + + All arguments are optional, and all except for 'm' should be + specified in keyword form. + + Test examples in docstrings in functions and classes reachable from + module 'm' (or module *note __main__: 1. if 'm' is not supplied or + is ‘None’), starting with ‘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. + + Only docstrings attached to objects belonging to module 'm' are + searched. + + Return ‘(failure_count, test_count)’. + + Optional argument 'name' gives the name of the module; by default, + or if ‘None’, ‘m.__name__’ is used. + + Optional argument 'exclude_empty' defaults to false. If true, + objects for which no doctests are found are excluded from + consideration. The default is a backward compatibility hack, so + that code still using *note doctest.master.summarize: 401f. in + conjunction with *note testmod(): 1436. continues to get output for + objects with no tests. The 'exclude_empty' argument to the newer + *note DocTestFinder: 1632. constructor defaults to true. + + Optional arguments 'extraglobs', 'verbose', 'report', + 'optionflags', 'raise_on_error', and 'globs' are the same as for + function *note testfile(): 3ff5. above, except that 'globs' + defaults to ‘m.__dict__’. + + -- Function: doctest.run_docstring_examples (f, globs, verbose=False, + name='NoName', compileflags=None, optionflags=0) + + Test examples associated with object 'f'; for example, 'f' may be a + string, a module, a function, or a class object. + + A shallow copy of dictionary argument 'globs' is used for the + execution context. + + Optional argument 'name' is used in failure messages, and defaults + to ‘"NoName"’. + + If optional argument 'verbose' is true, output is generated even if + there are no failures. By default, output is generated only in + case of an example failure. + + Optional argument 'compileflags' gives the set of flags that should + be used by the Python compiler when running the examples. By + default, or if ‘None’, flags are deduced corresponding to the set + of future features found in 'globs'. + + Optional argument 'optionflags' works as for function *note + testfile(): 3ff5. above. + + +File: python.info, Node: Unittest API, Next: Advanced API, Prev: Basic API, Up: doctest — Test interactive Python examples + +5.27.4.13 Unittest API +...................... + +As your collection of doctest’ed modules grows, you’ll want a way to run +all their doctests systematically. *note doctest: 3a. provides two +functions that can be used to create *note unittest: 106. test suites +from modules and text files containing doctests. To integrate with +*note unittest: 106. test discovery, include a *note load_tests: 4023. +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 + +There are two main functions for creating *note unittest.TestSuite: df3. +instances from text files and modules with doctests: + + -- Function: doctest.DocFileSuite (*paths, module_relative=True, + package=None, setUp=None, tearDown=None, globs=None, + optionflags=0, parser=DocTestParser(), encoding=None) + + Convert doctest tests from one or more text files to a *note + unittest.TestSuite: df3. + + The returned *note unittest.TestSuite: df3. is to be run by the + unittest framework and runs the interactive examples in each file. + If an example in any file fails, then the synthesized unit test + fails, and a *note failureException: 4025. exception is raised + showing the name of the file containing the test and a (sometimes + approximate) line number. If all the examples in a file are + skipped, then the synthesized unit test is also marked as skipped. + + Pass one or more paths (as strings) to text files to be examined. + + Options may be provided as keyword arguments: + + Optional argument 'module_relative' specifies how the filenames in + 'paths' should be interpreted: + + * If 'module_relative' is ‘True’ (the default), then each + filename in 'paths' specifies an OS-independent + module-relative path. By default, this path is relative to + the calling module’s directory; but if the 'package' argument + is specified, then it is relative to that package. To ensure + OS-independence, each filename should use ‘/’ characters to + separate path segments, and may not be an absolute path (i.e., + it may not begin with ‘/’). + + * If 'module_relative' is ‘False’, then each filename in 'paths' + specifies an OS-specific path. The path may be absolute or + relative; relative paths are resolved with respect to the + current working directory. + + Optional argument 'package' is a Python package or the name of a + Python package whose directory should be used as the base directory + for module-relative filenames in 'paths'. If no package is + specified, then the calling module’s directory is used as the base + directory for module-relative filenames. It is an error to specify + 'package' if 'module_relative' is ‘False’. + + Optional argument 'setUp' specifies a set-up function for the test + suite. This is called before running the tests in each file. The + 'setUp' function will be passed a *note DocTest: 16b2. object. The + 'setUp' function can access the test globals as the *note globs: + 4026. attribute of the test passed. + + Optional argument 'tearDown' specifies a tear-down function for the + test suite. This is called after running the tests in each file. + The 'tearDown' function will be passed a *note DocTest: 16b2. + object. The 'tearDown' function can access the test globals as the + *note globs: 4026. attribute of the test passed. + + 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 a new empty + dictionary. + + Optional argument 'optionflags' specifies the default doctest + options for the tests, created by or-ing together individual option + flags. See section *note Option Flags: f2e. See function *note + set_unittest_reportflags(): 4027. below for a better way to set + reporting options. + + Optional argument 'parser' specifies a *note DocTestParser: 4006. + (or subclass) that should be used to extract tests from the files. + It defaults to a normal parser (i.e., ‘DocTestParser()’). + + Optional argument 'encoding' specifies an encoding that should be + used to convert the file to unicode. + + The global ‘__file__’ is added to the globals provided to doctests + loaded from a text file using *note DocFileSuite(): 4024. + + -- Function: doctest.DocTestSuite (module=None, globs=None, + extraglobs=None, test_finder=None, setUp=None, tearDown=None, + optionflags=0, checker=None) + + Convert doctest tests for a module to a *note unittest.TestSuite: + df3. + + The returned *note unittest.TestSuite: df3. is to be run by the + unittest framework and runs each doctest in the module. Each + docstring is run as a separate unit test. If any of the doctests + fail, then the synthesized unit test fails, and a *note + unittest.TestCase.failureException: 4025. exception is raised + showing the name of the file containing the test and a (sometimes + approximate) line number. If all the examples in a docstring are + skipped, then the + + Optional argument 'module' provides the module to be tested. It + can be a module object or a (possibly dotted) module name. If not + specified, the module calling this function is used. + + 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__: 1f22. + + Optional argument 'extraglobs' specifies an extra set of global + variables, which is merged into 'globs'. By default, no extra + globals are used. + + Optional argument 'test_finder' is the *note DocTestFinder: 1632. + object (or a drop-in replacement) that is used to extract doctests + from the module. + + Optional arguments 'setUp', 'tearDown', and 'optionflags' are the + same as for function *note DocFileSuite(): 4024. above, but they + are called for each docstring. + + This function uses the same search technique as *note testmod(): + 1436. + + Changed in version 3.5: *note DocTestSuite(): df2. returns an empty + *note unittest.TestSuite: df3. if 'module' contains no docstrings + instead of raising *note ValueError: 204. + +Under the covers, *note DocTestSuite(): df2. creates a *note +unittest.TestSuite: df3. out of ‘doctest.DocTestCase’ instances, and +‘DocTestCase’ is a subclass of *note unittest.TestCase: 449. +‘DocTestCase’ isn’t documented here (it’s an internal detail), but +studying its code can answer questions about the exact details of *note +unittest: 106. integration. + +Similarly, *note DocFileSuite(): 4024. creates a *note +unittest.TestSuite: df3. out of ‘doctest.DocFileCase’ instances, and +‘DocFileCase’ is a subclass of ‘DocTestCase’. + +So both ways of creating a *note unittest.TestSuite: df3. run instances +of ‘DocTestCase’. This is important for a subtle reason: when you run +*note doctest: 3a. 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: 106. 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, *note doctest: 3a. also supports a notion of ‘doctest’ +reporting flags specific to *note unittest: 106. support, via this +function: + + -- Function: doctest.set_unittest_reportflags (flags) + + Set the *note doctest: 3a. reporting flags to use. + + Argument 'flags' takes the *note bitwise OR: 2071. of option flags. + See section *note Option Flags: f2e. Only “reporting flags” can be + used. + + This is a module-global setting, and affects all future doctests + run by module *note unittest: 106.: 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: + 2071. into the option flags, and the option flags so augmented are + passed to the *note DocTestRunner: 4015. 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. + + The value of the *note unittest: 106. reporting flags in effect + before the function was called is returned by the function. + + +File: python.info, Node: Advanced API, Next: Debugging, Prev: Unittest API, Up: doctest — Test interactive Python examples + +5.27.4.14 Advanced API +...................... + +The basic API is a simple wrapper that’s intended to make doctest easy +to use. It is fairly flexible, and should meet most users’ needs; +however, if you require more fine-grained control over testing, or wish +to extend doctest’s capabilities, then you should use the advanced API. + +The advanced API revolves around two container classes, which are used +to store the interactive examples extracted from doctest cases: + + * *note Example: 402a.: A single Python *note statement: 278b, paired + with its expected output. + + * *note DocTest: 16b2.: A collection of *note Example: 402a.s, + typically extracted from a single docstring or text file. + +Additional processing classes are defined to find, parse, and run, and +check doctest examples: + + * *note DocTestFinder: 1632.: Finds all docstrings in a given module, + and uses a *note DocTestParser: 4006. to create a *note DocTest: + 16b2. from every docstring that contains interactive examples. + + * *note DocTestParser: 4006.: Creates a *note DocTest: 16b2. object + from a string (such as an object’s docstring). + + * *note DocTestRunner: 4015.: Executes the examples in a *note + DocTest: 16b2, and uses an *note OutputChecker: 4014. to verify + their output. + + * *note OutputChecker: 4014.: Compares the actual output from a + doctest example with the expected output, and decides whether they + match. + +The relationships among these processing classes are summarized in the +following diagram: + + list of: + +------+ +---------+ + |module| --DocTestFinder-> | DocTest | --DocTestRunner-> results + +------+ | ^ +---------+ | ^ (printed) + | | | Example | | | + v | | ... | v | + DocTestParser | Example | OutputChecker + +---------+ + +* Menu: + +* DocTest Objects:: +* Example Objects:: +* DocTestFinder objects:: +* DocTestParser objects:: +* TestResults objects:: +* DocTestRunner objects:: +* OutputChecker objects:: + + +File: python.info, Node: DocTest Objects, Next: Example Objects, Up: Advanced API + +5.27.4.15 DocTest Objects +......................... + + -- Class: doctest.DocTest (examples, globs, name, filename, lineno, + docstring) + + A collection of doctest examples that should be run in a single + namespace. The constructor arguments are used to initialize the + attributes of the same names. + + *note DocTest: 16b2. defines the following attributes. They are + initialized by the constructor, and should not be modified + directly. + + -- Attribute: examples + + A list of *note Example: 402a. objects encoding the individual + interactive Python examples that should be run by this test. + + -- Attribute: globs + + The namespace (aka globals) that the examples should be run + in. This is a dictionary mapping names to values. Any + changes to the namespace made by the examples (such as binding + new variables) will be reflected in *note globs: 4026. after + the test is run. + + -- Attribute: name + + A string name identifying the *note DocTest: 16b2. Typically, + this is the name of the object or file that the test was + extracted from. + + -- Attribute: filename + + The name of the file that this *note DocTest: 16b2. was + extracted from; or ‘None’ if the filename is unknown, or if + the ‘DocTest’ was not extracted from a file. + + -- Attribute: lineno + + The line number within *note filename: 402f. where this *note + DocTest: 16b2. begins, or ‘None’ if the line number is + unavailable. This line number is zero-based with respect to + the beginning of the file. + + -- Attribute: docstring + + The string that the test was extracted from, or ‘None’ if the + string is unavailable, or if the test was not extracted from a + string. + + +File: python.info, Node: Example Objects, Next: DocTestFinder objects, Prev: DocTest Objects, Up: Advanced API + +5.27.4.16 Example Objects +......................... + + -- Class: doctest.Example (source, want, exc_msg=None, lineno=0, + indent=0, options=None) + + A single interactive example, consisting of a Python statement and + its expected output. The constructor arguments are used to + initialize the attributes of the same names. + + *note Example: 402a. defines the following attributes. They are + initialized by the constructor, and should not be modified + directly. + + -- Attribute: source + + A string containing the example’s source code. This source + code consists of a single Python statement, and always ends + with a newline; the constructor adds a newline when necessary. + + -- Attribute: want + + The expected output from running the example’s source code + (either from stdout, or a traceback in case of exception). + *note want: 4034. ends with a newline unless no output is + expected, in which case it’s an empty string. The constructor + adds a newline when necessary. + + -- Attribute: exc_msg + + The exception message generated by the example, if the example + is expected to generate an exception; or ‘None’ if it is not + expected to generate an exception. This exception message is + compared against the return value of *note + traceback.format_exception_only(): 84a. *note exc_msg: 4035. + ends with a newline unless it’s ‘None’. The constructor adds + a newline if needed. + + -- Attribute: lineno + + The line number within the string containing this example + where the example begins. This line number is zero-based with + respect to the beginning of the containing string. + + -- Attribute: indent + + The example’s indentation in the containing string, i.e., the + number of space characters that precede the example’s first + prompt. + + -- Attribute: 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: + 4015.’s *note optionflags: f2e.). By default, no options are + set. + + +File: python.info, Node: DocTestFinder objects, Next: DocTestParser objects, Prev: Example Objects, Up: Advanced API + +5.27.4.17 DocTestFinder objects +............................... + + -- Class: doctest.DocTestFinder (verbose=False, parser=DocTestParser(), + recurse=True, exclude_empty=True) + + A processing class used to extract the *note DocTest: 16b2.s that + are relevant to a given object, from its docstring and the + docstrings of its contained objects. *note DocTest: 16b2.s can be + extracted from modules, classes, functions, methods, staticmethods, + classmethods, and properties. + + The optional argument 'verbose' can be used to display the objects + searched by the finder. It defaults to ‘False’ (no output). + + The optional argument 'parser' specifies the *note DocTestParser: + 4006. object (or a drop-in replacement) that is used to extract + doctests from docstrings. + + If the optional argument 'recurse' is false, then *note + DocTestFinder.find(): 16fe. will only examine the given object, and + not any contained objects. + + If the optional argument 'exclude_empty' is false, then *note + DocTestFinder.find(): 16fe. will include tests for objects with + empty docstrings. + + *note DocTestFinder: 1632. defines the following method: + + -- Method: find (obj[, name][, module][, globs][, extraglobs]) + + Return a list of the *note DocTest: 16b2.s that are defined by + 'obj'’s docstring, or by any of its contained objects’ + docstrings. + + The optional argument 'name' specifies the object’s name; this + name will be used to construct names for the returned *note + DocTest: 16b2.s. If 'name' is not specified, then + ‘obj.__name__’ is used. + + The optional parameter 'module' is the module that contains + the given object. If the module is not specified or is + ‘None’, then the test finder will attempt to automatically + determine the correct module. The object’s module is used: + + * As a default namespace, if 'globs' is not specified. + + * To prevent the DocTestFinder from extracting DocTests + from objects that are imported from other modules. + (Contained objects with modules other than 'module' are + ignored.) + + * To find the name of the file containing the object. + + * To help find the line number of the object within its + file. + + If 'module' is ‘False’, no attempt to find the module will be + made. This is obscure, of use mostly in testing doctest + itself: if 'module' is ‘False’, or is ‘None’ but cannot be + found automatically, then all objects are considered to belong + to the (non-existent) module, so all contained objects will + (recursively) be searched for doctests. + + The globals for each *note DocTest: 16b2. 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__: 1f22, if specified, or ‘{}’ otherwise. If + 'extraglobs' is not specified, then it defaults to ‘{}’. + + +File: python.info, Node: DocTestParser objects, Next: TestResults objects, Prev: DocTestFinder objects, Up: Advanced API + +5.27.4.18 DocTestParser objects +............................... + + -- Class: doctest.DocTestParser + + A processing class used to extract interactive examples from a + string, and use them to create a *note DocTest: 16b2. object. + + *note DocTestParser: 4006. defines the following methods: + + -- Method: get_doctest (string, globs, name, filename, lineno) + + Extract all doctest examples from the given string, and + collect them into a *note DocTest: 16b2. object. + + 'globs', 'name', 'filename', and 'lineno' are attributes for + the new ‘DocTest’ object. See the documentation for *note + DocTest: 16b2. for more information. + + -- Method: get_examples (string, name='<string>') + + Extract all doctest examples from the given string, and return + them as a list of *note Example: 402a. objects. Line numbers + are 0-based. The optional argument 'name' is a name + identifying this string, and is only used for error messages. + + -- Method: parse (string, name='<string>') + + Divide the given string into examples and intervening text, + and return them as a list of alternating *note Example: 402a.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 objects, Prev: DocTestParser objects, Up: Advanced API + +5.27.4.19 TestResults objects +............................. + + -- Class: doctest.TestResults (failed, attempted) + + -- Attribute: failed + + Number of failed tests. + + -- Attribute: attempted + + Number of attempted tests. + + -- Attribute: skipped + + Number of skipped tests. + + Added in version 3.13. + + +File: python.info, Node: DocTestRunner objects, Next: OutputChecker objects, Prev: TestResults objects, Up: Advanced API + +5.27.4.20 DocTestRunner objects +............................... + + -- Class: doctest.DocTestRunner (checker=None, verbose=None, + optionflags=0) + + A processing class used to execute and verify the interactive + examples in a *note DocTest: 16b2. + + The comparison between expected outputs and actual outputs is done + by an *note OutputChecker: 4014. This comparison may be customized + with a number of option flags; see section *note Option Flags: f2e. + 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(): 1de.; this + function will be called with strings that should be displayed. It + defaults to ‘sys.stdout.write’. If capturing the output is not + sufficient, then the display output can be also customized by + subclassing DocTestRunner, and overriding the methods *note + report_start(): 4046, *note report_success(): 4047, *note + report_unexpected_exception(): 4048, and *note report_failure(): + 4049. + + The optional keyword argument 'checker' specifies the *note + OutputChecker: 4014. object (or drop-in replacement) that should be + used to compare the expected outputs to the actual outputs of + doctest examples. + + The optional keyword argument 'verbose' controls the *note + DocTestRunner: 4015.’s verbosity. If 'verbose' is ‘True’, then + information is printed about each example, as it is run. If + 'verbose' is ‘False’, then only failures are printed. If 'verbose' + is unspecified, or ‘None’, then verbose output is used iff the + command-line switch ‘-v’ is used. + + The optional keyword argument 'optionflags' can be used to control + how the test runner compares expected output to actual output, and + how it displays failures. For more information, see section *note + Option Flags: f2e. + + The test runner accumulates statistics. The aggregated number of + attempted, failed and skipped examples is also available via the + *note tries: 404a, *note failures: 404b. and *note skips: 1df. + attributes. The *note run(): 1de. and *note summarize(): 401f. + methods return a *note TestResults: 4041. instance. + + *note DocTestRunner: 4015. defines the following methods: + + -- Method: report_start (out, test, example) + + Report that the test runner is about to process the given + example. This method is provided to allow subclasses of *note + DocTestRunner: 4015. 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(): 1de. + + -- Method: report_success (out, test, example, got) + + Report that the given example ran successfully. This method + is provided to allow subclasses of *note DocTestRunner: 4015. + to customize their output; it should not be called directly. + + 'example' is the example about to be processed. 'got' is the + actual output from the example. 'test' is the test containing + 'example'. 'out' is the output function that was passed to + *note DocTestRunner.run(): 1de. + + -- Method: report_failure (out, test, example, got) + + Report that the given example failed. This method is provided + to allow subclasses of *note DocTestRunner: 4015. to customize + their output; it should not be called directly. + + 'example' is the example about to be processed. 'got' is the + actual output from the example. 'test' is the test containing + 'example'. 'out' is the output function that was passed to + *note DocTestRunner.run(): 1de. + + -- Method: report_unexpected_exception (out, test, example, + exc_info) + + Report that the given example raised an unexpected exception. + This method is provided to allow subclasses of *note + DocTestRunner: 4015. to customize their output; it should not + be called directly. + + 'example' is the example about to be processed. 'exc_info' is + a tuple containing information about the unexpected exception + (as returned by *note sys.exc_info(): 686.). 'test' is the + test containing 'example'. 'out' is the output function that + was passed to *note DocTestRunner.run(): 1de. + + -- Method: run (test, compileflags=None, out=None, + clear_globs=True) + + Run the examples in 'test' (a *note DocTest: 16b2. object), + and display the results using the writer function 'out'. + Return a *note TestResults: 4041. instance. + + The examples are run in the namespace ‘test.globs’. If + 'clear_globs' is true (the default), then this namespace will + be cleared after the test runs, to help with garbage + collection. If you would like to examine the namespace after + the test completes, then use 'clear_globs=False'. + + 'compileflags' gives the set of flags that should be used by + the Python compiler when running the examples. If not + specified, then it will default to the set of future-import + flags that apply to 'globs'. + + The output of each example is checked using the *note + DocTestRunner: 4015.’s output checker, and the results are + formatted by the ‘DocTestRunner.report_*()’ methods. + + -- Method: summarize (verbose=None) + + Print a summary of all the test cases that have been run by + this DocTestRunner, and return a *note TestResults: 4041. + instance. + + The optional 'verbose' argument controls how detailed the + summary is. If the verbosity is not specified, then the *note + DocTestRunner: 4015.’s verbosity is used. + + *note DocTestParser: 4006. has the following attributes: + + -- Attribute: tries + + Number of attempted examples. + + -- Attribute: failures + + Number of failed examples. + + -- Attribute: skips + + Number of skipped examples. + + Added in version 3.13. + + +File: python.info, Node: OutputChecker objects, Prev: DocTestRunner objects, Up: Advanced API + +5.27.4.21 OutputChecker objects +............................... + + -- Class: doctest.OutputChecker + + A class used to check the whether the actual output from a doctest + example matches the expected output. *note OutputChecker: 4014. + defines two methods: *note check_output(): 404e, which compares a + given pair of outputs, and returns ‘True’ if they match; and *note + output_difference(): 404f, which returns a string describing the + differences between two outputs. + + *note OutputChecker: 4014. defines the following methods: + + -- Method: check_output (want, got, optionflags) + + Return ‘True’ iff the actual output from an example ('got') + matches the expected output ('want'). These strings are + always considered to match if they are identical; but + depending on what option flags the test runner is using, + several non-exact match types are also possible. See section + *note Option Flags: f2e. for more information about option + flags. + + -- Method: output_difference (example, got, optionflags) + + Return a string describing the differences between the + expected output for a given example ('example') and the actual + output ('got'). 'optionflags' is the set of option flags used + to compare 'want' and 'got'. + + +File: python.info, Node: Debugging, Next: Soapbox, Prev: Advanced API, Up: doctest — Test interactive Python examples + +5.27.4.22 Debugging +................... + +Doctest provides several mechanisms for debugging doctest examples: + + * Several functions convert doctests to executable Python programs, + which can be run under the Python debugger, *note pdb: a5. + + * The *note DebugRunner: 4052. class is a subclass of *note + DocTestRunner: 4015. that raises an exception for the first failing + example, containing information about that example. This + information can be used to perform post-mortem debugging on the + example. + + * The *note unittest: 106. cases generated by *note DocTestSuite(): + df2. support the *note debug(): 4053. method defined by *note + unittest.TestCase: 449. + + * You can add a call to *note pdb.set_trace(): 237. in a doctest + example, and you’ll drop into the Python debugger when that line is + executed. Then you can inspect current values of variables, and so + on. For example, suppose ‘a.py’ contains just this module + docstring: + + """ + >>> def f(x): + ... g(x*2) + >>> def g(x): + ... print(x+3) + ... import pdb; pdb.set_trace() + >>> f(3) + 9 + """ + + Then an interactive Python session may look like this: + + >>> 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) + >>> + +Functions that convert doctests to Python code, and possibly run the +synthesized code under the debugger: + + -- Function: doctest.script_from_examples (s) + + Convert text with examples to a script. + + Argument 's' is a string containing doctest examples. The string + is converted to a Python script, where doctest examples in 's' are + converted to regular code, and everything else is converted to + Python comments. The generated script is returned as a string. + For example, + + 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 + """)) + + displays: + + # Set x and y to 1 and 2. + x, y = 1, 2 + # + # Print their sum: + print(x+y) + # Expected: + ## 3 + + This function is used internally by other functions (see below), + but can also be useful when you want to transform an interactive + Python session into a Python script. + + -- Function: doctest.testsource (module, name) + + Convert the doctest for an object to a script. + + 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(): 4054. 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. + + -- Function: doctest.debug (module, name, pm=False) + + Debug the doctests for an object. + + The 'module' and 'name' arguments are the same as for function + *note testsource(): 4055. above. The synthesized Python script for + the named object’s docstring is written to a temporary file, and + then that file is run under the control of the Python debugger, + *note pdb: a5. + + A shallow copy of ‘module.__dict__’ is used for both local and + global execution context. + + Optional argument 'pm' controls whether post-mortem debugging is + used. If 'pm' has a true value, the script file is run directly, + and the debugger gets involved only if the script terminates via + raising an unhandled exception. If it does, then post-mortem + debugging is invoked, via *note pdb.post_mortem(): 13a6, passing + the traceback object from the unhandled exception. If 'pm' is not + specified, or is false, the script is run under the debugger from + the start, via passing an appropriate *note exec(): 17f. call to + *note pdb.run(): 4056. + + -- Function: doctest.debug_src (src, pm=False, globs=None) + + Debug the doctests in a string. + + This is like function *note debug(): 4053. above, except that a + string containing doctest examples is specified directly, via the + 'src' argument. + + Optional argument 'pm' has the same meaning as in function *note + debug(): 4053. above. + + Optional argument 'globs' gives a dictionary to use as both local + and global execution context. If not specified, or ‘None’, an + empty dictionary is used. If specified, a shallow copy of the + dictionary is used. + +The *note DebugRunner: 4052. class, and the special exceptions it may +raise, are of most interest to testing framework authors, and will only +be sketched here. See the source code, and especially *note +DebugRunner: 4052.’s docstring (which is a doctest!) for more details: + + -- Class: doctest.DebugRunner (checker=None, verbose=None, + optionflags=0) + + A subclass of *note DocTestRunner: 4015. that raises an exception + as soon as a failure is encountered. If an unexpected exception + occurs, an *note UnexpectedException: 4058. exception is raised, + containing the test, the example, and the original exception. If + the output doesn’t match, then a *note DocTestFailure: 4059. + exception is raised, containing the test, the example, and the + actual output. + + For information about the constructor parameters and methods, see + the documentation for *note DocTestRunner: 4015. in section *note + Advanced API: 4029. + +There are two exceptions that may be raised by *note DebugRunner: 4052. +instances: + + -- Exception: doctest.DocTestFailure (test, example, got) + + An exception raised by *note DocTestRunner: 4015. to signal that a + doctest example’s actual output did not match its expected output. + The constructor arguments are used to initialize the attributes of + the same names. + +*note DocTestFailure: 4059. defines the following attributes: + + -- Attribute: DocTestFailure.test + + The *note DocTest: 16b2. object that was being run when the example + failed. + + -- Attribute: DocTestFailure.example + + The *note Example: 402a. that failed. + + -- Attribute: DocTestFailure.got + + The example’s actual output. + + -- Exception: doctest.UnexpectedException (test, example, exc_info) + + An exception raised by *note DocTestRunner: 4015. to signal that a + doctest example raised an unexpected exception. The constructor + arguments are used to initialize the attributes of the same names. + +*note UnexpectedException: 4058. defines the following attributes: + + -- Attribute: UnexpectedException.test + + The *note DocTest: 16b2. object that was being run when the example + failed. + + -- Attribute: UnexpectedException.example + + The *note Example: 402a. that failed. + + -- Attribute: UnexpectedException.exc_info + + A tuple containing information about the unexpected exception, as + returned by *note sys.exc_info(): 686. + + +File: python.info, Node: Soapbox, Prev: Debugging, Up: doctest — Test interactive Python examples + +5.27.4.23 Soapbox +................. + +As mentioned in the introduction, *note doctest: 3a. has grown to have +three primary uses: + + 1. Checking examples in docstrings. + + 2. Regression testing. + + 3. Executable documentation / literate testing. + +These uses have different requirements, and it is important to +distinguish them. In particular, filling your docstrings with obscure +test cases makes for bad documentation. + +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 *note doctest: 3a. examples stops +working after a “harmless” change. + +Doctest also makes an excellent tool for regression testing, especially +if you don’t skimp on explanatory text. By interleaving prose and +examples, it becomes much easier to keep track of what’s actually being +tested, and why. When a test fails, good prose can make it much easier +to figure out what the problem is, and how it should be fixed. It’s +true that you could write extensive comments in code-based testing, but +few programmers do. Many have found that using doctest approaches +instead leads to much clearer tests. Perhaps this is simply because +doctest makes writing prose a little easier than writing code, while +writing comments in code is a little harder. I think it goes deeper +than just that: the natural attitude when writing a doctest-based test +is that you want to explain the fine points of your software, and +illustrate them with examples. This in turn naturally leads to test +files that start with the simplest features, and logically progress to +complications and edge cases. A coherent narrative is the result, +instead of a collection of isolated functions that test isolated bits of +functionality seemingly at random. It’s a different attitude, and +produces different results, blurring the distinction between testing and +explaining. + +Regression testing is best confined to dedicated objects or files. +There are several options for organizing tests: + + * Write text files containing test cases as interactive examples, and + test the files using *note testfile(): 3ff5. or *note + DocFileSuite(): 4024. This is recommended, although is easiest to + do for new projects, designed from the start to use doctest. + + * Define functions named ‘_regrtest_topic’ that consist of single + docstrings, containing test cases for the named topics. These + functions can be included in the same file as the module, or + separated out into a separate test file. + + * Define a *note __test__: 4001. dictionary mapping from regression + test topics to docstrings containing test cases. + +When you have placed your tests in a module, the module can itself be +the test runner. When a test fails, you can arrange for your test +runner to re-run only the failing doctest while you debug the problem. +Here is a minimal example of such a test runner: + + 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 — Unit testing framework, Next: unittest mock — mock object library, Prev: doctest — Test interactive Python examples, Up: Development Tools + +5.27.5 ‘unittest’ — Unit testing framework +------------------------------------------ + +'Source code:' Lib/unittest/__init__.py(1) + +__________________________________________________________________ + +(If you are already familiar with the basic concepts of testing, you +might want to skip to *note the list of assert methods: 4064.) + +The *note unittest: 106. 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, *note unittest: 106. supports some important concepts +in an object-oriented way: + +test fixture + + A 'test fixture' represents the preparation needed to perform one + or more tests, and any associated cleanup actions. This may + involve, for example, creating temporary or proxy databases, + directories, or starting a server process. + +test case + + A 'test case' is the individual unit of testing. It checks for a + specific response to a particular set of inputs. *note unittest: + 106. provides a base class, *note TestCase: 449, which may be used + to create new test cases. + +test suite + + A 'test suite' is a collection of test cases, test suites, or both. + It is used to aggregate tests that should be executed together. + +test runner + + A 'test runner' is a component which orchestrates the execution of + tests and provides the outcome to the user. The runner may use a + graphical interface, a textual interface, or return a special value + to indicate the results of executing the tests. + +See also +........ + +Module *note doctest: 3a. + + Another test-support module with a very different flavor. + +Simple Smalltalk Testing: With Patterns(2) + + Kent Beck’s original paper on testing frameworks using the pattern + shared by *note unittest: 106. + +pytest(3) + + Third-party unittest framework with a lighter-weight syntax for + writing tests. For example, ‘assert func(10) == 42’. + +The Python Testing Tools Taxonomy(4) + + An extensive list of Python testing tools including functional + testing frameworks and mock object libraries. + +Testing in Python Mailing List(5) + + A special-interest-group for discussion of testing, and testing + tools, in Python. + +The script ‘Tools/unittestgui/unittestgui.py’ in the Python source +distribution is a GUI tool for test discovery and execution. This is +intended largely for ease of use for those new to unit testing. For +production environments it is recommended that tests be driven by a +continuous integration system such as Buildbot(6), Jenkins(7), GitHub +Actions(8), or AppVeyor(9). + +* Menu: + +* Basic example:: +* Command-Line Interface: Command-Line Interface<3>. +* Test Discovery:: +* Organizing test code:: +* Re-using old test code:: +* Skipping tests and expected failures:: +* Distinguishing test iterations using subtests:: +* Classes and functions:: +* Class and Module Fixtures:: +* Signal Handling:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/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: Basic example, Next: Command-Line Interface<3>, Up: unittest — Unit testing framework + +5.27.5.1 Basic example +...................... + +The *note unittest: 106. 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. + +Here is a short script to test three string methods: + + 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() + +A test case is created by subclassing *note unittest.TestCase: 449. The +three individual tests are defined with methods whose names start with +the letters ‘test’. This naming convention informs the test runner +about which methods represent tests. + +The crux of each test is a call to *note assertEqual(): 524. to check +for an expected result; *note assertTrue(): 522. or *note assertFalse(): +523. to verify a condition; or *note assertRaises(): 528. to verify that +a specific exception gets raised. These methods are used instead of the +*note assert: 968. statement so the test runner can accumulate all test +results and produce a report. + +The *note setUp(): 132c. and *note tearDown(): 132d. methods allow you +to define instructions that will be executed before and after each test +method. They are covered in more detail in the section *note Organizing +test code: 4067. + +The final block shows a simple way to run the tests. *note +unittest.main(): fde. provides a command-line interface to the test +script. When run from the command line, the above script produces an +output that looks like this: + + ... + ---------------------------------------------------------------------- + Ran 3 tests in 0.000s + + OK + +Passing the ‘-v’ option to your test script will instruct *note +unittest.main(): fde. to enable a higher level of verbosity, and produce +the following output: + + 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 *note unittest: 106. +features which are sufficient to meet many everyday testing needs. The +remainder of the documentation explores the full feature set from first +principles. + +Changed in version 3.11: The behavior of returning a value from a test +method (other than the default ‘None’ value), is now deprecated. + + +File: python.info, Node: Command-Line Interface<3>, Next: Test Discovery, Prev: Basic example, Up: unittest — Unit testing framework + +5.27.5.2 Command-Line Interface +............................... + +The unittest module can be used from the command line to run tests from +modules, classes or even individual test methods: + + python -m unittest test_module1 test_module2 + python -m unittest test_module.TestClass + python -m unittest test_module.TestClass.test_method + +You can pass in a list with any combination of module names, and fully +qualified class or method names. + +Test modules can be specified by file path as well: + + python -m unittest tests/test_something.py + +This allows you to use the shell filename completion to specify the test +module. The file specified must still be importable as a module. The +path is converted to a module name by removing the ‘.py’ and converting +path separators into ‘.’. If you want to execute a test file that isn’t +importable as a module you should execute the file directly instead. + +You can run tests with more detail (higher verbosity) by passing in the +-v flag: + + python -m unittest -v test_module + +When executed without arguments *note Test Discovery: 406a. is started: + + python -m unittest + +For a list of all the command-line options: + + python -m unittest -h + +Changed in version 3.2: In earlier versions it was only possible to run +individual test methods and not modules or classes. + +* Menu: + +* Command-line options: Command-line options<3>. + + +File: python.info, Node: Command-line options<3>, Up: Command-Line Interface<3> + +5.27.5.3 Command-line options +............................. + +‘unittest’ supports these command-line options: + + -- Option: -b, --buffer + + The standard output and standard error streams are buffered during + the test run. Output during a passing test is discarded. Output + is echoed normally on test fail or error and is added to the + failure messages. + + -- Option: -c, --catch + + ‘Control’-‘C’ during the test run waits for the current test to end + and then reports all the results so far. A second ‘Control’-‘C’ + raises the normal *note KeyboardInterrupt: 9d1. exception. + + See *note Signal Handling: 406e. for the functions that provide + this functionality. + + -- Option: -f, --failfast + + Stop the test run on the first error or failure. + + -- Option: -k + + Only run test methods and classes that match the pattern or + substring. This option may be used multiple times, in which case + all test cases that match any of the given patterns are included. + + Patterns that contain a wildcard character (‘*’) are matched + against the test name using *note fnmatch.fnmatchcase(): 18a0.; + otherwise simple case-sensitive substring matching is used. + + Patterns are matched against the fully qualified test method name + as imported by the test loader. + + For example, ‘-k foo’ matches ‘foo_tests.SomeTest.test_something’, + ‘bar_tests.SomeTest.test_foo’, but not + ‘bar_tests.FooTest.test_something’. + + -- Option: --locals + + Show local variables in tracebacks. + + -- Option: --durations N + + Show the N slowest test cases (N=0 for all). + +Added in version 3.2: The command-line options ‘-b’, ‘-c’ and ‘-f’ were +added. + +Added in version 3.5: The command-line option ‘--locals’. + +Added in version 3.7: The command-line option ‘-k’. + +Added in version 3.12: The command-line option ‘--durations’. + +The command line can also be used for test discovery, for running all of +the tests in a project or just a subset. + + +File: python.info, Node: Test Discovery, Next: Organizing test code, Prev: Command-Line Interface<3>, Up: unittest — Unit testing framework + +5.27.5.4 Test Discovery +....................... + +Added in version 3.2. + +Unittest supports simple test discovery. In order to be compatible with +test discovery, all of the test files must be *note modules: 1c56. or +*note packages: 1c67. importable from the top-level directory of the +project (this means that their filenames must be valid *note +identifiers: 1e94.). + +Test discovery is implemented in *note TestLoader.discover(): fe0, but +can also be used from the command line. The basic command-line usage +is: + + cd project_directory + python -m unittest discover + + Note: As a shortcut, ‘python -m unittest’ is the equivalent of + ‘python -m unittest discover’. If you want to pass arguments to + test discovery the ‘discover’ sub-command must be used explicitly. + +The ‘discover’ sub-command has the following options: + + -- Option: -v, --verbose + + Verbose output + + -- Option: -s, --start-directory directory + + Directory to start discovery (‘.’ default) + + -- Option: -p, --pattern pattern + + Pattern to match test files (‘test*.py’ default) + + -- Option: -t, --top-level-directory directory + + Top level directory of project (defaults to start directory) + +The *note -s: 4076, *note -p: 4078, and *note -t: 407a. options can be +passed in as positional arguments in that order. The following two +command lines are equivalent: + + python -m unittest discover -s project_directory -p "*_test.py" + python -m unittest discover project_directory "*_test.py" + +As well as being a path it is possible to pass a package name, for +example ‘myproject.subpackage.test’, as the start directory. The +package name you supply will then be imported and its location on the +filesystem will be used as the start directory. + + Caution: Test discovery loads tests by importing them. Once test + discovery has found all the test files from the start directory you + specify it turns the paths into package names to import. For + example ‘foo/bar/baz.py’ will be imported as ‘foo.bar.baz’. + + If you have a package installed globally and attempt test discovery + on a different copy of the package then the import 'could' happen + from the wrong place. If this happens test discovery will warn you + and exit. + + If you supply the start directory as a package name rather than a + path to a directory then discover assumes that whichever location + it imports from is the location you intended, so you will not get + the warning. + +Test modules and packages can customize test loading and discovery by +through the *note load_tests protocol: 407c. + +Changed in version 3.4: Test discovery supports *note namespace +packages: 1c68. for the start directory. Note that you need to specify +the top level directory too (e.g. ‘python -m unittest discover -s +root/namespace -t root’). + +Changed in version 3.11: *note unittest: 106. dropped the *note +namespace packages: 1c68. support in Python 3.11. It has been broken +since Python 3.7. Start directory and subdirectories containing tests +must be regular package that have ‘__init__.py’ file. + +Directories containing start directory still can be a namespace package. +In this case, you need to specify start directory as dotted package +name, and target directory explicitly. For example: + + # proj/ <-- current directory + # namespace/ + # mypkg/ + # __init__.py + # test_mypkg.py + + python -m unittest discover -s namespace.mypkg -t . + + +File: python.info, Node: Organizing test code, Next: Re-using old test code, Prev: Test Discovery, Up: unittest — Unit testing framework + +5.27.5.5 Organizing test code +............................. + +The basic building blocks of unit testing are 'test cases' — single +scenarios that must be set up and checked for correctness. In *note +unittest: 106, test cases are represented by *note unittest.TestCase: +449. instances. To make your own test cases you must write subclasses +of *note TestCase: 449. or use *note FunctionTestCase: 1708. + +The testing code of a *note TestCase: 449. instance should be entirely +self contained, such that it can be run either in isolation or in +arbitrary combination with any number of other test cases. + +The simplest *note TestCase: 449. subclass will simply implement a test +method (i.e. a method whose name starts with ‘test’) in order to +perform specific testing code: + + 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: 4064. provided by the *note TestCase: 449. base class. If the +test fails, an exception will be raised with an explanatory message, and +*note unittest: 106. will identify the test case as a 'failure'. Any +other exceptions will be treated as 'errors'. + +Tests can be numerous, and their set-up can be repetitive. Luckily, we +can factor out set-up code by implementing a method called *note +setUp(): 132c, which the testing framework will automatically call for +every single test we run: + + 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: The order in which the various tests will be run is + determined by sorting the test method names with respect to the + built-in ordering for strings. + +If the *note setUp(): 132c. method raises an exception while the test is +running, the framework will consider the test to have suffered an error, +and the test method will not be executed. + +Similarly, we can provide a *note tearDown(): 132d. method that tidies +up after the test method has been run: + + import unittest + + class WidgetTestCase(unittest.TestCase): + def setUp(self): + self.widget = Widget('The widget') + + def tearDown(self): + self.widget.dispose() + +If *note setUp(): 132c. succeeded, *note tearDown(): 132d. will be run +whether the test method succeeded or not. + +Such a working environment for the testing code is called a 'test +fixture'. A new TestCase instance is created as a unique test fixture +used to execute each individual test method. Thus *note setUp(): 132c, +*note tearDown(): 132d, and ‘__init__()’ will be called once per test. + +It is recommended that you use TestCase implementations to group tests +together according to the features they test. *note unittest: 106. +provides a mechanism for this: the 'test suite', represented by *note +unittest: 106.’s *note TestSuite: df3. class. In most cases, calling +*note unittest.main(): fde. will do the right thing and collect all the +module’s test cases for you and execute them. + +However, should you want to customize the building of your test suite, +you can do it yourself: + + 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()) + +You can place the definitions of test cases and test suites in the same +modules as the code they are to test (such as ‘widget.py’), but there +are several advantages to placing the test code in a separate module, +such as ‘test_widget.py’: + + * The test module can be run standalone from the command line. + + * The test code can more easily be separated from shipped code. + + * There is less temptation to change test code to fit the code it + tests without a good reason. + + * Test code should be modified much less frequently than the code it + tests. + + * Tested code can be refactored more easily. + + * Tests for modules written in C must be in separate modules anyway, + so why not be consistent? + + * If the testing strategy changes, there is no need to change the + source code. + + +File: python.info, Node: Re-using old test code, Next: Skipping tests and expected failures, Prev: Organizing test code, Up: unittest — Unit testing framework + +5.27.5.6 Re-using old test code +............................... + +Some users will find that they have existing test code that they would +like to run from *note unittest: 106, without converting every old test +function to a *note TestCase: 449. subclass. + +For this reason, *note unittest: 106. provides a *note FunctionTestCase: +1708. class. This subclass of *note TestCase: 449. can be used to wrap +an existing test function. Set-up and tear-down functions can also be +provided. + +Given the following test function: + + def testSomething(): + something = makeSomething() + assert something.name is not None + # ... + +one can create an equivalent test case instance as follows, with +optional set-up and tear-down methods: + + testcase = unittest.FunctionTestCase(testSomething, + setUp=makeSomethingDB, + tearDown=deleteSomethingDB) + + Note: Even though *note FunctionTestCase: 1708. can be used to + quickly convert an existing test base over to a *note unittest: + 106.-based system, this approach is not recommended. Taking the + time to set up proper *note TestCase: 449. subclasses will make + future test refactorings infinitely easier. + +In some cases, the existing tests may have been written using the *note +doctest: 3a. module. If so, *note doctest: 3a. provides a +‘DocTestSuite’ class that can automatically build *note +unittest.TestSuite: df3. instances from the existing *note doctest: +3a.-based tests. + + +File: python.info, Node: Skipping tests and expected failures, Next: Distinguishing test iterations using subtests, Prev: Re-using old test code, Up: unittest — Unit testing framework + +5.27.5.7 Skipping tests and expected failures +............................................. + +Added in version 3.1. + +Unittest supports skipping individual test methods and even whole +classes of tests. In addition, it supports marking a test as an +“expected failure,” a test that is broken and will fail, but shouldn’t +be counted as a failure on a *note TestResult: 115b. + +Skipping a test is simply a matter of using the *note skip(): 19d8. +*note decorator: 72c. or one of its conditional variants, calling *note +TestCase.skipTest(): 4082. within a *note setUp(): 132c. or test method, +or raising *note SkipTest: fdf. directly. + +Basic skipping looks like this: + + 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 + +This is the output of running the example above in verbose mode: + + 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) + +Classes can be skipped just like methods: + + @unittest.skip("showing class skipping") + class MySkippedTestCase(unittest.TestCase): + def test_not_run(self): + pass + +*note TestCase.setUp(): 132c. can also skip the test. This is useful +when a resource that needs to be set up is not available. + +Expected failures use the *note expectedFailure(): 4083. decorator. + + class ExpectedFailureTestCase(unittest.TestCase): + @unittest.expectedFailure + def test_fail(self): + self.assertEqual(1, 0, "broken") + +It’s easy to roll your own skipping decorators by making a decorator +that calls *note skip(): 19d8. on the test when it wants it to be +skipped. This decorator skips the test unless the passed object has a +certain attribute: + + def skipUnlessHasattr(obj, attr): + if hasattr(obj, attr): + return lambda func: func + return unittest.skip("{!r} doesn't have {!r}".format(obj, attr)) + +The following decorators and exception implement test skipping and +expected failures: + + -- Function: @unittest.skip (reason) + + Unconditionally skip the decorated test. 'reason' should describe + why the test is being skipped. + + -- Function: @unittest.skipIf (condition, reason) + + Skip the decorated test if 'condition' is true. + + -- Function: @unittest.skipUnless (condition, reason) + + Skip the decorated test unless 'condition' is true. + + -- Function: @unittest.expectedFailure + + Mark the test as an expected failure or error. If the test fails + or errors in the test function itself (rather than in one of the + 'test fixture' methods) then it will be considered a success. If + the test passes, it will be considered a failure. + + -- Exception: unittest.SkipTest (reason) + + This exception is raised to skip a test. + + Usually you can use *note TestCase.skipTest(): 4082. or one of the + skipping decorators instead of raising this directly. + +Skipped tests will not have *note setUp(): 132c. or *note tearDown(): +132d. run around them. Skipped classes will not have *note +setUpClass(): a4e. or *note tearDownClass(): 132a. run. Skipped modules +will not have ‘setUpModule()’ or ‘tearDownModule()’ run. + + +File: python.info, Node: Distinguishing test iterations using subtests, Next: Classes and functions, Prev: Skipping tests and expected failures, Up: unittest — Unit testing framework + +5.27.5.8 Distinguishing test iterations using subtests +...................................................... + +Added in version 3.4. + +When there are very small differences among your tests, for instance +some parameters, unittest allows you to distinguish them inside the body +of a test method using the *note subTest(): fdc. context manager. + +For example, the following test: + + 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) + +will produce the following output: + + ====================================================================== + 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 + +Without using a subtest, execution would stop after the first failure, +and the error would be less easy to diagnose because the value of ‘i’ +wouldn’t be displayed: + + ====================================================================== + 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: Classes and functions, Next: Class and Module Fixtures, Prev: Distinguishing test iterations using subtests, Up: unittest — Unit testing framework + +5.27.5.9 Classes and functions +.............................. + +This section describes in depth the API of *note unittest: 106. + +* Menu: + +* Test cases:: +* Grouping tests:: +* Loading and running tests:: + + +File: python.info, Node: Test cases, Next: Grouping tests, Up: Classes and functions + +5.27.5.10 Test cases +.................... + + -- Class: unittest.TestCase (methodName='runTest') + + Instances of the *note TestCase: 449. class represent the logical + test units in the *note unittest: 106. 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. + + Each instance of *note TestCase: 449. will run a single base + method: the method named 'methodName'. In most uses of *note + TestCase: 449, you will neither change the 'methodName' nor + reimplement the default ‘runTest()’ method. + + Changed in version 3.2: *note TestCase: 449. can be instantiated + successfully without providing a 'methodName'. This makes it + easier to experiment with *note TestCase: 449. from the interactive + interpreter. + + *note TestCase: 449. instances provide three groups of methods: one + group used to run the test, another used by the test implementation + to check conditions and report failures, and some inquiry methods + allowing information about the test itself to be gathered. + + Methods in the first group (running the test) are: + + -- Method: setUp () + + Method called to prepare the test fixture. This is called + immediately before calling the test method; other than *note + AssertionError: 6a5. or *note SkipTest: fdf, any exception + raised by this method will be considered an error rather than + a test failure. The default implementation does nothing. + + -- Method: tearDown () + + Method called immediately after the test method has been + called and the result recorded. This is called even if the + test method raised an exception, so the implementation in + subclasses may need to be particularly careful about checking + internal state. Any exception, other than *note + AssertionError: 6a5. or *note SkipTest: fdf, raised by this + method will be considered an additional error rather than a + test failure (thus increasing the total number of reported + errors). This method will only be called if the *note + setUp(): 132c. succeeds, regardless of the outcome of the test + method. The default implementation does nothing. + + -- Method: setUpClass () + + A class method called before tests in an individual class are + run. ‘setUpClass’ is called with the class as the only + argument and must be decorated as a *note classmethod(): 166.: + + @classmethod + def setUpClass(cls): + ... + + See *note Class and Module Fixtures: 408b. for more details. + + Added in version 3.2. + + -- Method: tearDownClass () + + A class method called after tests in an individual class have + run. ‘tearDownClass’ is called with the class as the only + argument and must be decorated as a *note classmethod(): 166.: + + @classmethod + def tearDownClass(cls): + ... + + See *note Class and Module Fixtures: 408b. for more details. + + Added in version 3.2. + + -- Method: run (result=None) + + Run the test, collecting the result into the *note TestResult: + 115b. object passed as 'result'. If 'result' is omitted or + ‘None’, a temporary result object is created (by calling the + *note defaultTestResult(): 408c. method) and used. The result + object is returned to *note run(): 115a.’s caller. + + The same effect may be had by simply calling the *note + TestCase: 449. instance. + + Changed in version 3.3: Previous versions of ‘run’ did not + return the result. Neither did calling an instance. + + -- Method: skipTest (reason) + + Calling this during a test method or *note setUp(): 132c. + skips the current test. See *note Skipping tests and expected + failures: 4081. for more information. + + Added in version 3.1. + + -- Method: subTest (msg=None, **params) + + Return a context manager which executes the enclosed code + block as a subtest. 'msg' and 'params' are optional, + arbitrary values which are displayed whenever a subtest fails, + allowing you to identify them clearly. + + A test case can contain any number of subtest declarations, + and they can be arbitrarily nested. + + See *note Distinguishing test iterations using subtests: fdd. + for more information. + + Added in version 3.4. + + -- Method: debug () + + Run the test without collecting the result. This allows + exceptions raised by the test to be propagated to the caller, + and can be used to support running tests under a debugger. + The *note TestCase: 449. class provides several assert methods to + check for and report failures. The following table lists the most + commonly used methods (see the tables below for more assert + methods): + + Method Checks that New in + + ---------------------------------------------------------------------------------------------------- + + *note assertEqual(a, b): 524. ‘a == b’ + + + *note assertNotEqual(a, b): 525. ‘a != b’ + + + *note assertTrue(x): 522. ‘bool(x) is True’ + + + *note assertFalse(x): 523. ‘bool(x) is False’ + + + *note assertIs(a, b): 132e. ‘a is b’ 3.1 + + + *note assertIsNot(a, b): 132f. ‘a is not b’ 3.1 + + + *note assertIsNone(x): 127d. ‘x is None’ 3.1 + + + *note assertIsNotNone(x): 127e. ‘x is not None’ 3.1 + + + *note assertIn(a, b): 1337. ‘a in b’ 3.1 + + + *note assertNotIn(a, b): 1338. ‘a not in b’ 3.1 + + + *note assertIsInstance(a, b): 1330. ‘isinstance(a, b)’ 3.2 + + + *note assertNotIsInstance(a, b): 1331. ‘not isinstance(a, b)’ 3.2 + + + All the assert methods accept a 'msg' argument that, if specified, + is used as the error message on failure (see also *note + longMessage: 1329.). Note that the 'msg' keyword argument can be + passed to *note assertRaises(): 528, *note assertRaisesRegex(): + 52a, *note assertWarns(): 1158, *note assertWarnsRegex(): 1159. + only when they are used as a context manager. + + -- Method: assertEqual (first, second, msg=None) + + Test that 'first' and 'second' are equal. If the values do + not compare equal, the test will fail. + + In addition, if 'first' and 'second' are the exact same type + and one of list, tuple, dict, set, frozenset or str or any + type that a subclass registers with *note + addTypeEqualityFunc(): 133b. the type-specific equality + function will be called in order to generate a more useful + default error message (see also the *note list of + type-specific methods: 408d.). + + Changed in version 3.1: Added the automatic calling of + type-specific equality function. + + Changed in version 3.2: *note assertMultiLineEqual(): 1336. + added as the default type equality function for comparing + strings. + + -- Method: assertNotEqual (first, second, msg=None) + + Test that 'first' and 'second' are not equal. If the values + do compare equal, the test will fail. + + -- Method: assertTrue (expr, msg=None) + -- Method: assertFalse (expr, msg=None) + + Test that 'expr' is true (or false). + + Note that this is equivalent to ‘bool(expr) is True’ and not + to ‘expr is True’ (use ‘assertIs(expr, True)’ for the latter). + This method should also be avoided when more specific methods + are available (e.g. ‘assertEqual(a, b)’ instead of + ‘assertTrue(a == b)’), because they provide a better error + message in case of failure. + + -- Method: assertIs (first, second, msg=None) + -- Method: assertIsNot (first, second, msg=None) + + Test that 'first' and 'second' are (or are not) the same + object. + + Added in version 3.1. + + -- Method: assertIsNone (expr, msg=None) + -- Method: assertIsNotNone (expr, msg=None) + + Test that 'expr' is (or is not) ‘None’. + + Added in version 3.1. + + -- Method: assertIn (member, container, msg=None) + -- Method: assertNotIn (member, container, msg=None) + + Test that 'member' is (or is not) in 'container'. + + Added in version 3.1. + + -- Method: assertIsInstance (obj, cls, msg=None) + -- Method: assertNotIsInstance (obj, cls, msg=None) + + Test that 'obj' is (or is not) an instance of 'cls' (which can + be a class or a tuple of classes, as supported by *note + isinstance(): 43d.). To check for the exact type, use *note + assertIs(type(obj), cls): 132e. + + Added in version 3.2. + + It is also possible to check the production of exceptions, + warnings, and log messages using the following methods: + + Method Checks that New in + + -------------------------------------------------------------------------------------------------------------------------- + + *note assertRaises(exc, fun, *args, **kwds): 528. ‘fun(*args, **kwds)’ raises 'exc' + + + *note assertRaisesRegex(exc, r, fun, *args, **kwds): 52a. ‘fun(*args, **kwds)’ raises 'exc' and 3.1 + the message matches regex 'r' + + + *note assertWarns(warn, fun, *args, **kwds): 1158. ‘fun(*args, **kwds)’ raises 'warn' 3.2 + + + *note assertWarnsRegex(warn, r, fun, *args, **kwds): 1159. ‘fun(*args, **kwds)’ raises 'warn' and 3.2 + the message matches regex 'r' + + + *note assertLogs(logger, level): 855. The ‘with’ block logs on 'logger' with 3.4 + minimum 'level' + + + *note assertNoLogs(logger, level): 854. The ‘with’ block does not log on 3.10 + + 'logger' with minimum 'level' + + + -- Method: assertRaises (exception, callable, *args, **kwds) + + -- Method: assertRaises (exception, *, msg=None) + + Test that an exception is raised when 'callable' is called + with any positional or keyword arguments that are also passed + to *note assertRaises(): 528. The test passes if 'exception' + is raised, is an error if another exception is raised, or + fails if no exception is raised. To catch any of a group of + exceptions, a tuple containing the exception classes may be + passed as 'exception'. + + If only the 'exception' and possibly the 'msg' arguments are + given, return a context manager so that the code under test + can be written inline rather than as a function: + + with self.assertRaises(SomeException): + do_something() + + When used as a context manager, *note assertRaises(): 528. + accepts the additional keyword argument 'msg'. + + The context manager will store the caught exception object in + its ‘exception’ attribute. This can be useful if the + intention is to perform additional checks on the exception + raised: + + with self.assertRaises(SomeException) as cm: + do_something() + + the_exception = cm.exception + self.assertEqual(the_exception.error_code, 3) + + Changed in version 3.1: Added the ability to use *note + assertRaises(): 528. as a context manager. + + Changed in version 3.2: Added the ‘exception’ attribute. + + Changed in version 3.3: Added the 'msg' keyword argument when + used as a context manager. + + -- Method: assertRaisesRegex (exception, regex, callable, *args, + **kwds) + + -- Method: assertRaisesRegex (exception, regex, *, msg=None) + + Like *note assertRaises(): 528. but also tests that 'regex' + matches on the string representation of the raised exception. + 'regex' may be a regular expression object or a string + containing a regular expression suitable for use by *note + re.search(): 121f. Examples: + + self.assertRaisesRegex(ValueError, "invalid literal for.*XYZ'$", + int, 'XYZ') + + or: + + with self.assertRaisesRegex(ValueError, 'literal'): + int('XYZ') + + Added in version 3.1: Added under the name + ‘assertRaisesRegexp’. + + Changed in version 3.2: Renamed to *note assertRaisesRegex(): + 52a. + + Changed in version 3.3: Added the 'msg' keyword argument when + used as a context manager. + + -- Method: assertWarns (warning, callable, *args, **kwds) + + -- Method: assertWarns (warning, *, msg=None) + + Test that a warning is triggered when 'callable' is called + with any positional or keyword arguments that are also passed + to *note assertWarns(): 1158. The test passes if 'warning' is + triggered and fails if it isn’t. Any exception is an error. + To catch any of a group of warnings, a tuple containing the + warning classes may be passed as 'warnings'. + + If only the 'warning' and possibly the 'msg' arguments are + given, return a context manager so that the code under test + can be written inline rather than as a function: + + with self.assertWarns(SomeWarning): + do_something() + + When used as a context manager, *note assertWarns(): 1158. + accepts the additional keyword argument 'msg'. + + The context manager will store the caught warning object in + its ‘warning’ attribute, and the source line which triggered + the warnings in the ‘filename’ and ‘lineno’ attributes. This + can be useful if the intention is to perform additional checks + on the warning caught: + + with self.assertWarns(SomeWarning) as cm: + do_something() + + self.assertIn('myfile.py', cm.filename) + self.assertEqual(320, cm.lineno) + + This method works regardless of the warning filters in place + when it is called. + + Added in version 3.2. + + Changed in version 3.3: Added the 'msg' keyword argument when + used as a context manager. + + -- Method: assertWarnsRegex (warning, regex, callable, *args, + **kwds) + + -- Method: assertWarnsRegex (warning, regex, *, msg=None) + + Like *note assertWarns(): 1158. but also tests that 'regex' + matches on the message of the triggered warning. 'regex' may + be a regular expression object or a string containing a + regular expression suitable for use by *note re.search(): + 121f. Example: + + self.assertWarnsRegex(DeprecationWarning, + r'legacy_function\(\) is deprecated', + legacy_function, 'XYZ') + + or: + + with self.assertWarnsRegex(RuntimeWarning, 'unsafe frobnicating'): + frobnicate('/etc/passwd') + + Added in version 3.2. + + Changed in version 3.3: Added the 'msg' keyword argument when + used as a context manager. + + -- Method: assertLogs (logger=None, level=None) + + A context manager to test that at least one message is logged + on the 'logger' or one of its children, with at least the + given 'level'. + + If given, 'logger' should be a *note logging.Logger: b4f. + object or a *note str: 447. 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. + + If given, 'level' should be either a numeric logging level or + its string equivalent (for example either ‘"ERROR"’ or *note + logging.ERROR: 1cf5.). The default is *note logging.INFO: + 1cf3. + + The test passes if at least one message emitted inside the + ‘with’ block matches the 'logger' and 'level' conditions, + otherwise it fails. + + The object returned by the context manager is a recording + helper which keeps tracks of the matching log messages. It + has two attributes: + + -- Attribute: records + + A list of *note logging.LogRecord: fe1. objects of the + matching log messages. + + -- Attribute: output + + A list of *note str: 447. objects with the formatted + output of matching messages. + + Example: + + 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. + + -- Method: 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'. + + If given, 'logger' should be a *note logging.Logger: b4f. + object or a *note str: 447. giving the name of a logger. The + default is the root logger, which will catch all messages. + + If given, 'level' should be either a numeric logging level or + its string equivalent (for example either ‘"ERROR"’ or *note + logging.ERROR: 1cf5.). The default is *note logging.INFO: + 1cf3. + + Unlike *note assertLogs(): 855, nothing will be returned by + the context manager. + + Added in version 3.10. + + There are also other methods used to perform more specific checks, + such as: + + Method Checks that New in + + ---------------------------------------------------------------------------------------------------- + + *note assertAlmostEqual(a, b): 526. ‘round(a-b, 7) == 0’ + + + *note assertNotAlmostEqual(a, b): 527. ‘round(a-b, 7) != 0’ + + + *note assertGreater(a, b): 1332. ‘a > b’ 3.1 + + + *note assertGreaterEqual(a, b): 1333. ‘a >= b’ 3.1 + + + *note assertLess(a, b): 1334. ‘a < b’ 3.1 + + + *note assertLessEqual(a, b): 1335. ‘a <= b’ 3.1 + + + *note assertRegex(s, r): 529. ‘r.search(s)’ 3.1 + + + *note assertNotRegex(s, r): 52b. ‘not r.search(s)’ 3.2 + + + *note assertCountEqual(a, b): 121d. 'a' and 'b' have the same elements 3.2 + in the same number, regardless of + their order. + + + -- Method: assertAlmostEqual (first, second, places=7, msg=None, + delta=None) + -- Method: assertNotAlmostEqual (first, second, places=7, + msg=None, delta=None) + + Test that 'first' and 'second' are approximately (or not + approximately) equal by computing the difference, rounding to + the given number of decimal 'places' (default 7), and + comparing to zero. Note that these methods round the values + to the given number of 'decimal places' (i.e. like the *note + round(): 12cd. function) and not 'significant digits'. + + If 'delta' is supplied instead of 'places' then the difference + between 'first' and 'second' must be less or equal to (or + greater than) 'delta'. + + Supplying both 'delta' and 'places' raises a *note TypeError: + 534. + + Changed in version 3.2: *note assertAlmostEqual(): 526. + automatically considers almost equal objects that compare + equal. *note assertNotAlmostEqual(): 527. automatically fails + if the objects compare equal. Added the 'delta' keyword + argument. + + -- Method: assertGreater (first, second, msg=None) + -- Method: assertGreaterEqual (first, second, msg=None) + -- Method: assertLess (first, second, msg=None) + -- Method: assertLessEqual (first, second, msg=None) + + Test that 'first' is respectively >, >=, < or <= than 'second' + depending on the method name. If not, the test will fail: + + >>> self.assertGreaterEqual(3, 4) + AssertionError: "3" unexpectedly not greater than or equal to "4" + + Added in version 3.1. + + -- Method: assertRegex (text, regex, msg=None) + -- Method: assertNotRegex (text, regex, msg=None) + + Test that a 'regex' search matches (or does not match) 'text'. + In case of failure, the error message will include the pattern + and the 'text' (or the pattern and the part of 'text' that + unexpectedly matched). 'regex' may be a regular expression + object or a string containing a regular expression suitable + for use by *note re.search(): 121f. + + Added in version 3.1: Added under the name + ‘assertRegexpMatches’. + + Changed in version 3.2: The method ‘assertRegexpMatches()’ has + been renamed to *note assertRegex(): 529. + + Added in version 3.2: *note assertNotRegex(): 52b. + + -- Method: assertCountEqual (first, second, msg=None) + + Test that sequence 'first' contains the same elements as + 'second', regardless of their order. When they don’t, an + error message listing the differences between the sequences + will be generated. + + Duplicate elements are 'not' ignored when comparing 'first' + and 'second'. It verifies whether each element has the same + count in both sequences. Equivalent to: + ‘assertEqual(Counter(list(first)), Counter(list(second)))’ but + works with sequences of unhashable objects as well. + + Added in version 3.2. + + The *note assertEqual(): 524. method dispatches the equality check + for objects of the same type to different type-specific methods. + These methods are already implemented for most of the built-in + types, but it’s also possible to register new methods using *note + addTypeEqualityFunc(): 133b.: + + -- Method: addTypeEqualityFunc (typeobj, function) + + Registers a type-specific method called by *note + assertEqual(): 524. to check if two objects of exactly the + same 'typeobj' (not subclasses) compare equal. 'function' + must take two positional arguments and a third msg=None + keyword argument just as *note assertEqual(): 524. does. It + must raise *note self.failureException(msg): 4025. when + inequality between the first two parameters is detected – + possibly providing useful information and explaining the + inequalities in details in the error message. + + Added in version 3.1. + + The list of type-specific methods automatically used by *note + assertEqual(): 524. are summarized in the following table. Note + that it’s usually not necessary to invoke these methods directly. + + Method Used to compare New in + + --------------------------------------------------------------------------------------------------- + + *note assertMultiLineEqual(a, b): 1336. strings 3.1 + + + *note assertSequenceEqual(a, b): 127c. sequences 3.1 + + + *note assertListEqual(a, b): 127a. lists 3.1 + + + *note assertTupleEqual(a, b): 127b. tuples 3.1 + + + *note assertSetEqual(a, b): 1278. sets or frozensets 3.1 + + + *note assertDictEqual(a, b): 1279. dicts 3.1 + + + -- Method: assertMultiLineEqual (first, second, msg=None) + + Test that the multiline string 'first' is equal to the string + 'second'. When not equal a diff of the two strings + highlighting the differences will be included in the error + message. This method is used by default when comparing + strings with *note assertEqual(): 524. + + Added in version 3.1. + + -- Method: assertSequenceEqual (first, second, msg=None, + seq_type=None) + + Tests that two sequences are equal. If a 'seq_type' is + supplied, both 'first' and 'second' must be instances of + 'seq_type' or a failure will be raised. If the sequences are + different an error message is constructed that shows the + difference between the two. + + This method is not called directly by *note assertEqual(): + 524, but it’s used to implement *note assertListEqual(): 127a. + and *note assertTupleEqual(): 127b. + + Added in version 3.1. + + -- Method: assertListEqual (first, second, msg=None) + -- Method: assertTupleEqual (first, second, msg=None) + + Tests that two lists or tuples are equal. If not, an error + message is constructed that shows only the differences between + the two. An error is also raised if either of the parameters + are of the wrong type. These methods are used by default when + comparing lists or tuples with *note assertEqual(): 524. + + Added in version 3.1. + + -- Method: assertSetEqual (first, second, msg=None) + + Tests that two sets are equal. If not, an error message is + constructed that lists the differences between the sets. This + method is used by default when comparing sets or frozensets + with *note assertEqual(): 524. + + Fails if either of 'first' or 'second' does not have a + ‘set.difference()’ method. + + Added in version 3.1. + + -- Method: assertDictEqual (first, second, msg=None) + + Test that two dictionaries are equal. If not, an error + message is constructed that shows the differences in the + dictionaries. This method will be used by default to compare + dictionaries in calls to *note assertEqual(): 524. + + Added in version 3.1. + + Finally the *note TestCase: 449. provides the following methods and + attributes: + + -- Method: fail (msg=None) + + Signals a test failure unconditionally, with 'msg' or ‘None’ + for the error message. + + -- Attribute: failureException + + This class attribute gives the exception raised by the test + method. If a test framework needs to use a specialized + exception, possibly to carry additional information, it must + subclass this exception in order to “play fair” with the + framework. The initial value of this attribute is *note + AssertionError: 6a5. + + -- Attribute: longMessage + + This class attribute determines what happens when a custom + failure message is passed as the msg argument to an assertXYY + call that fails. ‘True’ is the default value. In this case, + the custom message is appended to the end of the standard + failure message. When set to ‘False’, the custom message + replaces the standard message. + + The class setting can be overridden in individual test methods + by assigning an instance attribute, self.longMessage, to + ‘True’ or ‘False’ before calling the assert methods. + + The class setting gets reset before each test call. + + Added in version 3.1. + + -- Attribute: maxDiff + + This attribute controls the maximum length of diffs output by + assert methods that report diffs on failure. It defaults to + 80*8 characters. Assert methods affected by this attribute + are *note assertSequenceEqual(): 127c. (including all the + sequence comparison methods that delegate to it), *note + assertDictEqual(): 1279. and *note assertMultiLineEqual(): + 1336. + + Setting ‘maxDiff’ to ‘None’ means that there is no maximum + length of diffs. + + Added in version 3.2. + + Testing frameworks can use the following methods to collect + information on the test: + + -- Method: countTestCases () + + Return the number of tests represented by this test object. + For *note TestCase: 449. instances, this will always be ‘1’. + + -- Method: defaultTestResult () + + Return an instance of the test result class that should be + used for this test case class (if no other result instance is + provided to the *note run(): 115a. method). + + For *note TestCase: 449. instances, this will always be an + instance of *note TestResult: 115b.; subclasses of *note + TestCase: 449. should override this as necessary. + + -- Method: id () + + Return a string identifying the specific test case. This is + usually the full name of the test method, including the module + and class name. + + -- Method: shortDescription () + + Returns a description of the test, or ‘None’ if no description + has been provided. The default implementation of this method + returns the first line of the test method’s docstring, if + available, or ‘None’. + + Changed in version 3.1: In 3.1 this was changed to add the + test name to the short description even in the presence of a + docstring. This caused compatibility issues with unittest + extensions and adding the test name was moved to the *note + TextTestResult: 52c. in Python 3.2. + + -- Method: addCleanup (function, /, *args, **kwargs) + + Add a function to be called after *note tearDown(): 132d. to + cleanup resources used during the test. Functions will be + called in reverse order to the order they are added (LIFO). + They are called with any arguments and keyword arguments + passed into *note addCleanup(): a81. when they are added. + + If *note setUp(): 132c. fails, meaning that *note tearDown(): + 132d. is not called, then any cleanup functions added will + still be called. + + Added in version 3.1. + + -- Method: enterContext (cm) + + Enter the supplied *note context manager: 5d0. If successful, + also add its *note __exit__(): 12f3. method as a cleanup + function by *note addCleanup(): a81. and return the result of + the *note __enter__(): 5c4. method. + + Added in version 3.11. + + -- Method: doCleanups () + + This method is called unconditionally after *note tearDown(): + 132d, or after *note setUp(): 132c. if *note setUp(): 132c. + raises an exception. + + It is responsible for calling all the cleanup functions added + by *note addCleanup(): a81. If you need cleanup functions to + be called 'prior' to *note tearDown(): 132d. then you can call + *note doCleanups(): 132b. yourself. + + *note doCleanups(): 132b. pops methods off the stack of + cleanup functions one at a time, so it can be called at any + time. + + Added in version 3.1. + + -- Method: classmethod addClassCleanup (function, /, *args, + **kwargs) + + Add a function to be called after *note tearDownClass(): 132a. + to cleanup resources used during the test class. Functions + will be called in reverse order to the order they are added + (LIFO). They are called with any arguments and keyword + arguments passed into *note addClassCleanup(): a4d. when they + are added. + + If *note setUpClass(): a4e. fails, meaning that *note + tearDownClass(): 132a. is not called, then any cleanup + functions added will still be called. + + Added in version 3.8. + + -- Method: classmethod enterClassContext (cm) + + Enter the supplied *note context manager: 5d0. If successful, + also add its *note __exit__(): 12f3. method as a cleanup + function by *note addClassCleanup(): a4d. and return the + result of the *note __enter__(): 5c4. method. + + Added in version 3.11. + + -- Method: classmethod doClassCleanups () + + This method is called unconditionally after *note + tearDownClass(): 132a, or after *note setUpClass(): a4e. if + *note setUpClass(): a4e. raises an exception. + + It is responsible for calling all the cleanup functions added + by *note addClassCleanup(): a4d. If you need cleanup + functions to be called 'prior' to *note tearDownClass(): 132a. + then you can call *note doClassCleanups(): 4095. yourself. + + *note doClassCleanups(): 4095. pops methods off the stack of + cleanup functions one at a time, so it can be called at any + time. + + Added in version 3.8. + + -- Class: unittest.IsolatedAsyncioTestCase (methodName='runTest') + + This class provides an API similar to *note TestCase: 449. and also + accepts coroutines as test functions. + + Added in version 3.8. + + -- Attribute: loop_factory + + The 'loop_factory' passed to *note asyncio.Runner: 5fc. + Override in subclasses with *note asyncio.EventLoop: 16f6. to + avoid using the asyncio policy system. + + Added in version 3.13. + + -- Method: async asyncSetUp () + + Method called to prepare the test fixture. This is called + after ‘setUp()’. This is called immediately before calling + the test method; other than *note AssertionError: 6a5. or + *note SkipTest: fdf, any exception raised by this method will + be considered an error rather than a test failure. The + default implementation does nothing. + + -- Method: async asyncTearDown () + + Method called immediately after the test method has been + called and the result recorded. This is called before + ‘tearDown()’. This is called even if the test method raised + an exception, so the implementation in subclasses may need to + be particularly careful about checking internal state. Any + exception, other than *note AssertionError: 6a5. or *note + SkipTest: fdf, raised by this method will be considered an + additional error rather than a test failure (thus increasing + the total number of reported errors). This method will only + be called if the *note asyncSetUp(): 4097. succeeds, + regardless of the outcome of the test method. The default + implementation does nothing. + + -- Method: addAsyncCleanup (function, /, *args, **kwargs) + + This method accepts a coroutine that can be used as a cleanup + function. + + -- Method: async enterAsyncContext (cm) + + Enter the supplied *note asynchronous context manager: 5d3. + If successful, also add its *note __aexit__(): 162a. method as + a cleanup function by *note addAsyncCleanup(): 4099. and + return the result of the *note __aenter__(): 1fd0. method. + + Added in version 3.11. + + -- Method: run (result=None) + + Sets up a new event loop to run the test, collecting the + result into the *note TestResult: 115b. object passed as + 'result'. If 'result' is omitted or ‘None’, a temporary + result object is created (by calling the ‘defaultTestResult()’ + method) and used. The result object is returned to *note + run(): 409a.’s caller. At the end of the test all the tasks + in the event loop are cancelled. + + An example illustrating the order: + + 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() + + After running the test, ‘events’ would contain ‘["setUp", + "asyncSetUp", "test_response", "asyncTearDown", "tearDown", + "cleanup"]’. + + -- Class: unittest.FunctionTestCase (testFunc, setUp=None, + tearDown=None, description=None) + + This class implements the portion of the *note TestCase: 449. + 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 *note unittest: 106.-based test + framework. + + +File: python.info, Node: Grouping tests, Next: Loading and running tests, Prev: Test cases, Up: Classes and functions + +5.27.5.11 Grouping tests +........................ + + -- Class: unittest.TestSuite (tests=()) + + This class represents an aggregation of individual test cases and + test suites. The class presents the interface needed by the test + runner to allow it to be run as any other test case. Running a + *note TestSuite: df3. instance is the same as iterating over the + suite, running each test individually. + + If 'tests' is given, it must be an iterable of individual test + cases or other test suites that will be used to build the suite + initially. Additional methods are provided to add test cases and + suites to the collection later on. + + *note TestSuite: df3. objects behave much like *note TestCase: 449. + objects, except they do not actually implement a test. Instead, + they are used to aggregate tests into groups of tests that should + be run together. Some additional methods are available to add + tests to *note TestSuite: df3. instances: + + -- Method: addTest (test) + + Add a *note TestCase: 449. or *note TestSuite: df3. to the + suite. + + -- Method: addTests (tests) + + Add all the tests from an iterable of *note TestCase: 449. and + *note TestSuite: df3. instances to this test suite. + + This is equivalent to iterating over 'tests', calling *note + addTest(): 409d. for each element. + + *note TestSuite: df3. shares the following methods with *note + TestCase: 449.: + + -- Method: run (result) + + Run the tests associated with this suite, collecting the + result into the test result object passed as 'result'. Note + that unlike *note TestCase.run(): 115a, *note TestSuite.run(): + 409f. requires the result object to be passed in. + + -- Method: debug () + + Run the tests associated with this suite without collecting + the result. This allows exceptions raised by the test to be + propagated to the caller and can be used to support running + tests under a debugger. + + -- Method: countTestCases () + + Return the number of tests represented by this test object, + including all individual tests and sub-suites. + + -- Method: __iter__ () + + Tests grouped by a *note TestSuite: df3. are always accessed + by iteration. Subclasses can lazily provide tests by + overriding ‘__iter__()’. Note that this method may be called + several times on a single suite (for example when counting + tests or comparing for equality) so the tests returned by + repeated iterations before *note TestSuite.run(): 409f. must + be the same for each call iteration. After *note + TestSuite.run(): 409f, callers should not rely on the tests + returned by this method unless the caller uses a subclass that + overrides ‘TestSuite._removeTestAtIndex()’ to preserve test + references. + + Changed in version 3.2: In earlier versions the *note + TestSuite: df3. accessed tests directly rather than through + iteration, so overriding ‘__iter__()’ wasn’t sufficient for + providing tests. + + Changed in version 3.4: In earlier versions the *note + TestSuite: df3. held references to each *note TestCase: 449. + after *note TestSuite.run(): 409f. Subclasses can restore + that behavior by overriding ‘TestSuite._removeTestAtIndex()’. + + In the typical usage of a *note TestSuite: df3. object, the *note + run(): 409f. method is invoked by a ‘TestRunner’ rather than by the + end-user test harness. + + +File: python.info, Node: Loading and running tests, Prev: Grouping tests, Up: Classes and functions + +5.27.5.12 Loading and running tests +................................... + + -- Class: unittest.TestLoader + + The *note TestLoader: 290. class is used to create test suites from + classes and modules. Normally, there is no need to create an + instance of this class; the *note unittest: 106. module provides an + instance that can be shared as *note unittest.defaultTestLoader: + 40a3. Using a subclass or instance, however, allows customization + of some configurable properties. + + *note TestLoader: 290. objects have the following attributes: + + -- Attribute: errors + + A list of the non-fatal errors encountered while loading + tests. Not reset by the loader at any point. Fatal errors + are signalled by the relevant method raising an exception to + the caller. Non-fatal errors are also indicated by a + synthetic test that will raise the original error when run. + + Added in version 3.5. + + *note TestLoader: 290. objects have the following methods: + + -- Method: loadTestsFromTestCase (testCaseClass) + + Return a suite of all test cases contained in the *note + TestCase: 449.-derived ‘testCaseClass’. + + A test case instance is created for each method named by *note + getTestCaseNames(): 293. By default these are the method + names beginning with ‘test’. If *note getTestCaseNames(): + 293. returns no methods, but the ‘runTest()’ method is + implemented, a single test case is created for that method + instead. + + -- Method: loadTestsFromModule (module, *, pattern=None) + + Return a suite of all test cases contained in the given + module. This method searches 'module' for classes derived + from *note TestCase: 449. and creates an instance of the class + for each test method defined for the class. + + Note: While using a hierarchy of *note TestCase: + 449.-derived classes can be convenient in sharing + fixtures and helper functions, defining test methods on + base classes that are not intended to be instantiated + directly does not play well with this method. Doing so, + however, can be useful when the fixtures are different + and defined in subclasses. + + If a module provides a ‘load_tests’ function it will be called + to load the tests. This allows modules to customize test + loading. This is the *note load_tests protocol: 407c. The + 'pattern' argument is passed as the third argument to + ‘load_tests’. + + Changed in version 3.2: Support for ‘load_tests’ added. + + Changed in version 3.5: Support for a keyword-only argument + 'pattern' has been added. + + Changed in version 3.12: The undocumented and unofficial + 'use_load_tests' parameter has been removed. + + -- Method: loadTestsFromName (name, module=None) + + Return a suite of all test cases given a string specifier. + + The specifier 'name' is a “dotted name” that may resolve + either to a module, a test case class, a test method within a + test case class, a *note TestSuite: df3. instance, or a + callable object which returns a *note TestCase: 449. or *note + TestSuite: df3. instance. These checks are applied in the + order listed here; that is, a method on a possible test case + class will be picked up as “a test method within a test case + class”, rather than “a callable object”. + + For example, if you have a module ‘SampleTests’ containing a + *note TestCase: 449.-derived class ‘SampleTestCase’ with three + test methods (‘test_one()’, ‘test_two()’, and ‘test_three()’), + the specifier ‘'SampleTests.SampleTestCase'’ would cause this + method to return a suite which will run all three test + methods. Using the specifier + ‘'SampleTests.SampleTestCase.test_two'’ would cause it to + return a test suite which will run only the ‘test_two()’ test + method. The specifier can refer to modules and packages which + have not been imported; they will be imported as a + side-effect. + + The method optionally resolves 'name' relative to the given + 'module'. + + Changed in version 3.5: If an *note ImportError: 415. or *note + AttributeError: 348. occurs while traversing 'name' then a + synthetic test that raises that error when run will be + returned. These errors are included in the errors accumulated + by self.errors. + + -- Method: loadTestsFromNames (names, module=None) + + Similar to *note loadTestsFromName(): 1339, but takes a + sequence of names rather than a single name. The return value + is a test suite which supports all the tests defined for each + name. + + -- Method: getTestCaseNames (testCaseClass) + + Return a sorted sequence of method names found within + 'testCaseClass'; this should be a subclass of *note TestCase: + 449. + + -- Method: discover (start_dir, pattern='test*.py', + top_level_dir=None) + + Find all the test modules by recursing into subdirectories + from the specified start directory, and return a TestSuite + object containing them. Only test files that match 'pattern' + will be loaded. (Using shell style pattern matching.) Only + module names that are importable (i.e. are valid Python + identifiers) will be loaded. + + All test modules must be importable from the top level of the + project. If the start directory is not the top level + directory then 'top_level_dir' must be specified separately. + + If importing a module fails, for example due to a syntax + error, then this will be recorded as a single error and + discovery will continue. If the import failure is due to + *note SkipTest: fdf. being raised, it will be recorded as a + skip instead of an error. + + If a package (a directory containing a file named + ‘__init__.py’) is found, the package will be checked for a + ‘load_tests’ function. If this exists then it will be called + ‘package.load_tests(loader, tests, pattern)’. Test discovery + takes care to ensure that a package is only checked for tests + once during an invocation, even if the load_tests function + itself calls ‘loader.discover’. + + If ‘load_tests’ exists then discovery does 'not' recurse into + the package, ‘load_tests’ is responsible for loading all tests + in the package. + + 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' can be a dotted module name as well as a + directory. + + Added in version 3.2. + + Changed in version 3.4: Modules that raise *note SkipTest: + fdf. on import are recorded as skips, not errors. + + Changed in version 3.4: 'start_dir' can be a *note namespace + packages: 1c68. + + Changed in version 3.4: Paths are sorted before being imported + so that execution order is the same even if the underlying + file system’s ordering is not dependent on file name. + + Changed in version 3.5: 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. + + Changed in version 3.11: 'start_dir' can not be a *note + namespace packages: 1c68. It has been broken since Python 3.7 + and Python 3.11 officially remove it. + + Changed in version 3.13: 'top_level_dir' is only stored for + the duration of 'discover' call. + + The following attributes of a *note TestLoader: 290. can be + configured either by subclassing or assignment on an instance: + + -- Attribute: testMethodPrefix + + String giving the prefix of method names which will be + interpreted as test methods. The default value is ‘'test'’. + + This affects *note getTestCaseNames(): 293. and all the + ‘loadTestsFrom*’ methods. + + -- Attribute: sortTestMethodsUsing + + Function to be used to compare method names when sorting them + in *note getTestCaseNames(): 293. and all the ‘loadTestsFrom*’ + methods. + + -- Attribute: suiteClass + + Callable object that constructs a test suite from a list of + tests. No methods on the resulting object are needed. The + default value is the *note TestSuite: df3. class. + + This affects all the ‘loadTestsFrom*’ methods. + + -- Attribute: testNamePatterns + + List of Unix shell-style wildcard test name patterns that test + methods have to match to be included in test suites (see ‘-k’ + option). + + If this attribute is not ‘None’ (the default), all test + methods to be included in test suites must match one of the + patterns in this list. Note that matches are always performed + using *note fnmatch.fnmatchcase(): 18a0, so unlike patterns + passed to the ‘-k’ option, simple substring patterns will have + to be converted using ‘*’ wildcards. + + This affects all the ‘loadTestsFrom*’ methods. + + Added in version 3.7. + + -- Class: unittest.TestResult + + This class is used to compile information about which tests have + succeeded and which have failed. + + A *note TestResult: 115b. object stores the results of a set of + tests. The *note TestCase: 449. and *note TestSuite: df3. classes + ensure that results are properly recorded; test authors do not need + to worry about recording the outcome of tests. + + Testing frameworks built on top of *note unittest: 106. may want + access to the *note TestResult: 115b. object generated by running a + set of tests for reporting purposes; a *note TestResult: 115b. + instance is returned by the ‘TestRunner.run()’ method for this + purpose. + + *note TestResult: 115b. instances have the following attributes + that will be of interest when inspecting the results of running a + set of tests: + + -- Attribute: errors + + A list containing 2-tuples of *note TestCase: 449. instances + and strings holding formatted tracebacks. Each tuple + represents a test which raised an unexpected exception. + + -- Attribute: failures + + A list containing 2-tuples of *note TestCase: 449. instances + and strings holding formatted tracebacks. Each tuple + represents a test where a failure was explicitly signalled + using the *note assert* methods: 4064. + + -- Attribute: skipped + + A list containing 2-tuples of *note TestCase: 449. instances + and strings holding the reason for skipping the test. + + Added in version 3.1. + + -- Attribute: expectedFailures + + A list containing 2-tuples of *note TestCase: 449. instances + and strings holding formatted tracebacks. Each tuple + represents an expected failure or error of the test case. + + -- Attribute: unexpectedSuccesses + + A list containing *note TestCase: 449. instances that were + marked as expected failures, but succeeded. + + -- Attribute: 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. + + -- Attribute: shouldStop + + Set to ‘True’ when the execution of tests should stop by *note + stop(): 40ae. + + -- Attribute: testsRun + + The total number of tests run so far. + + -- Attribute: buffer + + If set to true, ‘sys.stdout’ and ‘sys.stderr’ will be buffered + in between *note startTest(): 40b1. and *note stopTest(): + 40b2. being called. Collected output will only be echoed onto + the real ‘sys.stdout’ and ‘sys.stderr’ if the test fails or + errors. Any output is also attached to the failure / error + message. + + Added in version 3.2. + + -- Attribute: failfast + + If set to true *note stop(): 40ae. will be called on the first + failure or error, halting the test run. + + Added in version 3.2. + + -- Attribute: tb_locals + + If set to true then local variables will be shown in + tracebacks. + + Added in version 3.5. + + -- Method: wasSuccessful () + + Return ‘True’ if all tests run so far have passed, otherwise + returns ‘False’. + + Changed in version 3.4: Returns ‘False’ if there were any + *note unexpectedSuccesses: 40ac. from tests marked with the + *note expectedFailure(): 4083. decorator. + + -- Method: stop () + + This method can be called to signal that the set of tests + being run should be aborted by setting the *note shouldStop: + 40ad. attribute to ‘True’. ‘TestRunner’ objects should + respect this flag and return without running any additional + tests. + + For example, this feature is used by the *note TextTestRunner: + 1745. class to stop the test framework when the user signals + an interrupt from the keyboard. Interactive tools which + provide ‘TestRunner’ implementations can use this in a similar + manner. + + The following methods of the *note TestResult: 115b. class are used + to maintain the internal data structures, and may be extended in + subclasses to support additional reporting requirements. This is + particularly useful in building tools which support interactive + reporting while tests are being run. + + -- Method: startTest (test) + + Called when the test case 'test' is about to be run. + + -- Method: stopTest (test) + + Called after the test case 'test' has been executed, + regardless of the outcome. + + -- Method: startTestRun () + + Called once before any tests are executed. + + Added in version 3.1. + + -- Method: stopTestRun () + + Called once after all tests are executed. + + Added in version 3.1. + + -- Method: addError (test, err) + + Called when the test case 'test' raises an unexpected + exception. 'err' is a tuple of the form returned by *note + sys.exc_info(): 686.: ‘(type, value, traceback)’. + + The default implementation appends a tuple ‘(test, + formatted_err)’ to the instance’s *note errors: 40a8. + attribute, where 'formatted_err' is a formatted traceback + derived from 'err'. + + -- Method: addFailure (test, err) + + Called when the test case 'test' signals a failure. 'err' is + a tuple of the form returned by *note sys.exc_info(): 686.: + ‘(type, value, traceback)’. + + The default implementation appends a tuple ‘(test, + formatted_err)’ to the instance’s *note failures: 40a9. + attribute, where 'formatted_err' is a formatted traceback + derived from 'err'. + + -- Method: addSuccess (test) + + Called when the test case 'test' succeeds. + + The default implementation does nothing. + + -- Method: addSkip (test, reason) + + Called when the test case 'test' is skipped. 'reason' is the + reason the test gave for skipping. + + The default implementation appends a tuple ‘(test, reason)’ to + the instance’s *note skipped: 40aa. attribute. + + -- Method: addExpectedFailure (test, err) + + Called when the test case 'test' fails or errors, but was + marked with the *note expectedFailure(): 4083. decorator. + + The default implementation appends a tuple ‘(test, + formatted_err)’ to the instance’s *note expectedFailures: + 40ab. attribute, where 'formatted_err' is a formatted + traceback derived from 'err'. + + -- Method: addUnexpectedSuccess (test) + + Called when the test case 'test' was marked with the *note + expectedFailure(): 4083. decorator, but succeeded. + + The default implementation appends the test to the instance’s + *note unexpectedSuccesses: 40ac. attribute. + + -- Method: addSubTest (test, subtest, outcome) + + Called when a subtest finishes. 'test' is the test case + corresponding to the test method. 'subtest' is a custom *note + TestCase: 449. instance describing the subtest. + + If 'outcome' is *note None: 671, the subtest succeeded. + Otherwise, it failed with an exception where 'outcome' is a + tuple of the form returned by *note sys.exc_info(): 686.: + ‘(type, value, traceback)’. + + The default implementation does nothing when the outcome is a + success, and records subtest failures as normal failures. + + Added in version 3.4. + + -- Method: 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. + + -- Class: unittest.TextTestResult (stream, descriptions, verbosity, *, + durations=None) + + A concrete implementation of *note TestResult: 115b. used by the + *note TextTestRunner: 1745. Subclasses should accept ‘**kwargs’ to + ensure compatibility as the interface changes. + + Added in version 3.2. + + Changed in version 3.12: Added the 'durations' keyword parameter. + + -- Data: unittest.defaultTestLoader + + Instance of the *note TestLoader: 290. class intended to be shared. + If no customization of the *note TestLoader: 290. is needed, this + instance can be used instead of repeatedly creating new instances. + + -- Class: unittest.TextTestRunner (stream=None, descriptions=True, + verbosity=1, failfast=False, buffer=False, resultclass=None, + warnings=None, *, tb_locals=False, durations=None) + + A basic test runner implementation that outputs results to a + stream. If 'stream' is ‘None’, the default, *note sys.stderr: 939. + is used as the output stream. This class has a few configurable + parameters, but is essentially very simple. Graphical applications + which run test suites should provide alternate implementations. + Such implementations should accept ‘**kwargs’ as the interface to + construct runners changes when features are added to unittest. + + By default this runner shows *note DeprecationWarning: 1a5, *note + PendingDeprecationWarning: 8c7, *note ResourceWarning: 246. and + *note ImportWarning: 4f6. even if they are *note ignored by + default: 40b9. This behavior can be overridden using Python’s + ‘-Wd’ or ‘-Wa’ options (see *note Warning control: 1d38.) and + leaving 'warnings' to ‘None’. + + Changed in version 3.2: Added the 'warnings' parameter. + + Changed in version 3.2: The default stream is set to *note + sys.stderr: 939. at instantiation time rather than import time. + + Changed in version 3.5: Added the 'tb_locals' parameter. + + Changed in version 3.12: Added the 'durations' parameter. + + -- Method: _makeResult () + + This method returns the instance of ‘TestResult’ used by *note + run(): 40bb. It is not intended to be called directly, but + can be overridden in subclasses to provide a custom + ‘TestResult’. + + ‘_makeResult()’ instantiates the class or callable passed in + the ‘TextTestRunner’ constructor as the ‘resultclass’ + argument. It defaults to *note TextTestResult: 52c. if no + ‘resultclass’ is provided. The result class is instantiated + with the following arguments: + + stream, descriptions, verbosity + + -- Method: run (test) + + This method is the main public interface to the + ‘TextTestRunner’. This method takes a *note TestSuite: df3. + or *note TestCase: 449. instance. A *note TestResult: 115b. + is created by calling *note _makeResult(): 40ba. and the + test(s) are run and the results printed to stdout. + + -- Function: 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) + + A command-line program that loads a set of tests from 'module' and + runs them; this is primarily for making test modules conveniently + executable. The simplest use for this function is to include the + following line at the end of a test script: + + if __name__ == '__main__': + unittest.main() + + You can run tests with more detailed information by passing in the + verbosity argument: + + if __name__ == '__main__': + unittest.main(verbosity=2) + + The 'defaultTest' argument is either the name of a single test or + an iterable of test names to run if no test names are specified via + 'argv'. If not specified or ‘None’ and no test names are provided + via 'argv', all tests found in 'module' are run. + + The 'argv' argument can be a list of options passed to the program, + with the first element being the program name. If not specified or + ‘None’, the values of *note sys.argv: 1258. are used. + + The 'testRunner' argument can either be a test runner class or an + already created instance of it. By default ‘main’ calls *note + sys.exit(): 133c. 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. + + The 'testLoader' argument has to be a *note TestLoader: 290. + instance, and defaults to *note defaultTestLoader: 40a3. + + ‘main’ supports being used from the interactive interpreter by + passing in the argument ‘exit=False’. This displays the result on + standard output without calling *note sys.exit(): 133c.: + + >>> from unittest import main + >>> main(module='test_module', exit=False) + + The 'failfast', 'catchbreak' and 'buffer' parameters have the same + effect as the same-name *note command-line options: 406b. + + The 'warnings' argument specifies the *note warning filter: 8c8. + that should be used while running the tests. If it’s not + specified, it will remain ‘None’ if a ‘-W’ option is passed to + ‘python’ (see *note Warning control: 1d38.), otherwise it will be + set to ‘'default'’. + + Calling ‘main’ returns an object with the ‘result’ attribute that + contains the result of the tests run as a *note + unittest.TestResult: 115b. + + Changed in version 3.1: The 'exit' parameter was added. + + Changed in version 3.2: The 'verbosity', 'failfast', 'catchbreak', + 'buffer' and 'warnings' parameters were added. + + Changed in version 3.4: The 'defaultTest' parameter was changed to + also accept an iterable of test names. + +* Menu: + +* load_tests Protocol:: + + +File: python.info, Node: load_tests Protocol, Up: Loading and running tests + +5.27.5.13 load_tests Protocol +............................. + +Added in version 3.2. + +Modules or packages can customize how tests are loaded from them during +normal test runs or test discovery by implementing a function called +‘load_tests’. + +If a test module defines ‘load_tests’ it will be called by *note +TestLoader.loadTestsFromModule(): 291. with the following arguments: + + load_tests(loader, standard_tests, pattern) + +where 'pattern' is passed straight through from ‘loadTestsFromModule’. +It defaults to ‘None’. + +It should return a *note TestSuite: df3. + +'loader' is the instance of *note TestLoader: 290. doing the loading. +'standard_tests' are the tests that would be loaded by default from the +module. It is common for test modules to only want to add or remove +tests from the standard set of tests. The third argument is used when +loading packages as part of test discovery. + +A typical ‘load_tests’ function that loads tests from a specific set of +*note TestCase: 449. classes may look like: + + 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 + +If discovery is started in a directory containing a package, either from +the command line or by calling *note TestLoader.discover(): fe0, then +the package ‘__init__.py’ will be checked for ‘load_tests’. If that +function does not exist, discovery will recurse into the package as +though it were just another directory. Otherwise, discovery of the +package’s tests will be left up to ‘load_tests’ which is called with the +following arguments: + + load_tests(loader, standard_tests, pattern) + +This should return a *note TestSuite: df3. representing all the tests +from the package. (‘standard_tests’ will only contain tests collected +from ‘__init__.py’.) + +Because the pattern is passed into ‘load_tests’ the package is free to +continue (and potentially modify) test discovery. A ‘do nothing’ +‘load_tests’ function for a test package would look like: + + 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 + +Changed in version 3.5: Discovery no longer checks package names for +matching 'pattern' due to the impossibility of package names matching +the default pattern. + + +File: python.info, Node: Class and Module Fixtures, Next: Signal Handling, Prev: Classes and functions, Up: unittest — Unit testing framework + +5.27.5.14 Class and Module Fixtures +................................... + +Class and module level fixtures are implemented in *note TestSuite: df3. +When the test suite encounters a test from a new class then +‘tearDownClass()’ from the previous class (if there is one) is called, +followed by ‘setUpClass()’ from the new class. + +Similarly if a test is from a different module from the previous test +then ‘tearDownModule’ from the previous module is run, followed by +‘setUpModule’ from the new module. + +After all the tests have run the final ‘tearDownClass’ and +‘tearDownModule’ are run. + +Note that shared fixtures do not play well with [potential] features +like test parallelization and they break test isolation. They should be +used with care. + +The default ordering of tests created by the unittest test loaders is to +group all tests from the same modules and classes together. This will +lead to ‘setUpClass’ / ‘setUpModule’ (etc) being called exactly once per +class and module. If you randomize the order, so that tests from +different modules and classes are adjacent to each other, then these +shared fixture functions may be called multiple times in a single test +run. + +Shared fixtures are not intended to work with suites with non-standard +ordering. A ‘BaseTestSuite’ still exists for frameworks that don’t want +to support shared fixtures. + +If there are any exceptions raised during one of the shared fixture +functions the test is reported as an error. Because there is no +corresponding test instance an ‘_ErrorHolder’ object (that has the same +interface as a *note TestCase: 449.) is created to represent the error. +If you are just using the standard unittest test runner then this detail +doesn’t matter, but if you are a framework author it may be relevant. + +* Menu: + +* setUpClass and tearDownClass:: +* setUpModule and tearDownModule:: + + +File: python.info, Node: setUpClass and tearDownClass, Next: setUpModule and tearDownModule, Up: Class and Module Fixtures + +5.27.5.15 setUpClass and tearDownClass +...................................... + +These must be implemented as class methods: + + import unittest + + class Test(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls._connection = createExpensiveConnectionObject() + + @classmethod + def tearDownClass(cls): + cls._connection.destroy() + +If you want the ‘setUpClass’ and ‘tearDownClass’ on base classes called +then you must call up to them yourself. The implementations in *note +TestCase: 449. are empty. + +If an exception is raised during a ‘setUpClass’ then the tests in the +class are not run and the ‘tearDownClass’ is not run. Skipped classes +will not have ‘setUpClass’ or ‘tearDownClass’ run. If the exception is +a *note SkipTest: fdf. exception then the class will be reported as +having been skipped instead of as an error. + + +File: python.info, Node: setUpModule and tearDownModule, Prev: setUpClass and tearDownClass, Up: Class and Module Fixtures + +5.27.5.16 setUpModule and tearDownModule +........................................ + +These should be implemented as functions: + + def setUpModule(): + createConnection() + + def tearDownModule(): + closeConnection() + +If an exception is raised in a ‘setUpModule’ then none of the tests in +the module will be run and the ‘tearDownModule’ will not be run. If the +exception is a *note SkipTest: fdf. exception then the module will be +reported as having been skipped instead of as an error. + +To add cleanup code that must be run even in the case of an exception, +use ‘addModuleCleanup’: + + -- Function: unittest.addModuleCleanup (function, /, *args, **kwargs) + + Add a function to be called after ‘tearDownModule()’ to cleanup + resources used during the test class. Functions will be called in + reverse order to the order they are added (LIFO). They are called + with any arguments and keyword arguments passed into *note + addModuleCleanup(): a4c. when they are added. + + If ‘setUpModule()’ fails, meaning that ‘tearDownModule()’ is not + called, then any cleanup functions added will still be called. + + Added in version 3.8. + + -- Function: unittest.enterModuleContext (cm) + + Enter the supplied *note context manager: 5d0. If successful, also + add its *note __exit__(): 12f3. method as a cleanup function by + *note addModuleCleanup(): a4c. and return the result of the *note + __enter__(): 5c4. method. + + Added in version 3.11. + + -- Function: unittest.doModuleCleanups () + + This function is called unconditionally after ‘tearDownModule()’, + or after ‘setUpModule()’ if ‘setUpModule()’ raises an exception. + + It is responsible for calling all the cleanup functions added by + *note addModuleCleanup(): a4c. If you need cleanup functions to be + called 'prior' to ‘tearDownModule()’ then you can call *note + doModuleCleanups(): 183c. yourself. + + *note doModuleCleanups(): 183c. pops methods off the stack of + cleanup functions one at a time, so it can be called at any time. + + Added in version 3.8. + + +File: python.info, Node: Signal Handling, Prev: Class and Module Fixtures, Up: unittest — Unit testing framework + +5.27.5.17 Signal Handling +......................... + +Added in version 3.2. + +The *note -c/-catch: 1326. command-line option to unittest, along with +the ‘catchbreak’ parameter to *note unittest.main(): fde, provide more +friendly handling of control-C during a test run. With catch break +behavior enabled control-C will allow the currently running test to +complete, and the test run will then end and report all the results so +far. A second control-c will raise a *note KeyboardInterrupt: 9d1. in +the usual way. + +The control-c handling signal handler attempts to remain compatible with +code or tests that install their own *note signal.SIGINT: 840. handler. +If the ‘unittest’ handler is called but 'isn’t' the installed *note +signal.SIGINT: 840. handler, i.e. it has been replaced by the system +under test and delegated to, then it calls the default handler. This +will normally be the expected behavior by code that replaces an +installed handler and delegates to it. For individual tests that need +‘unittest’ control-c handling disabled the *note removeHandler(): 1327. +decorator can be used. + +There are a few utility functions for framework authors to enable +control-c handling functionality within test frameworks. + + -- Function: unittest.installHandler () + + Install the control-c handler. When a *note signal.SIGINT: 840. is + received (usually in response to the user pressing control-c) all + registered results have *note stop(): 40ae. called. + + -- Function: unittest.registerResult (result) + + Register a *note TestResult: 115b. object for control-c handling. + Registering a result stores a weak reference to it, so it doesn’t + prevent the result from being garbage collected. + + Registering a *note TestResult: 115b. object has no side-effects if + control-c handling is not enabled, so test frameworks can + unconditionally register all results they create independently of + whether or not handling is enabled. + + -- Function: unittest.removeResult (result) + + Remove a registered result. Once a result has been removed then + *note stop(): 40ae. will no longer be called on that result object + in response to a control-c. + + -- Function: unittest.removeHandler (function=None) + + When called without arguments this function removes the control-c + handler if it has been installed. This function can also be used + as a test decorator to temporarily remove the handler while the + test is being executed: + + @unittest.removeHandler + def test_signal_handling(self): + ... + + +File: python.info, Node: unittest mock — mock object library, Next: unittest mock — getting started, Prev: unittest — Unit testing framework, Up: Development Tools + +5.27.6 ‘unittest.mock’ — mock object library +-------------------------------------------- + +Added in version 3.3. + +'Source code:' Lib/unittest/mock.py(1) + +__________________________________________________________________ + +*note unittest.mock: 107. 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. + +*note unittest.mock: 107. provides a core *note Mock: a4b. 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. + +Additionally, mock provides a *note patch(): e8b. decorator that handles +patching module and class level attributes within the scope of a test, +along with *note sentinel: ba0. for creating unique objects. See the +*note quick guide: 40c3. for some examples of how to use *note Mock: +a4b, *note MagicMock: e8a. and *note patch(): e8b. + +Mock is designed for use with *note unittest: 106. and is based on the +‘action -> assertion’ pattern instead of ‘record -> replay’ used by many +mocking frameworks. + +There is a backport of *note unittest.mock: 107. for earlier versions of +Python, available as mock(2) on PyPI. + +* Menu: + +* Quick Guide:: +* The Mock Class:: +* The patchers:: +* MagicMock and magic method support:: +* Helpers:: +* Order of precedence of side_effect, return_value and wraps: Order of precedence of side_effect return_value and wraps. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/unittest/mock.py + + (2) https://pypi.org/project/mock/ + + +File: python.info, Node: Quick Guide, Next: The Mock Class, Up: unittest mock — mock object library + +5.27.6.1 Quick Guide +.................... + +*note Mock: a4b. and *note MagicMock: e8a. objects create all attributes +and methods as you access them and store details of how they have been +used. You can configure them, to specify return values or limit what +attributes are available, and then make assertions about how they have +been used: + + >>> 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: 40c4. allows you to perform side effects, including +raising an exception when a mock is called: + + >>> 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) + +Mock has many other ways you can configure it and control its behaviour. +For example the 'spec' argument configures the mock to take its +specification from another object. Attempting to access attributes or +methods on the mock that don’t exist on the spec will fail with an *note +AttributeError: 348. + +The *note patch(): e8b. decorator / context manager makes it easy to +mock classes or objects in a module under test. The object you specify +will be replaced with a mock (or other object) during the test and +restored when the test ends: + + >>> 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() + + Note: When you nest patch decorators the mocks are passed in to the + decorated function in the same order they applied (the normal + 'Python' order that decorators are applied). This means from the + bottom up, so in the example above the mock for ‘module.ClassName1’ + is passed in first. + + With *note patch(): e8b. it matters that you patch objects in the + namespace where they are looked up. This is normally + straightforward, but for a quick guide read *note where to patch: + 40c5. + +As well as a decorator *note patch(): e8b. can be used as a context +manager in a with statement: + + >>> 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) + +There is also *note patch.dict(): 19f2. for setting values in a +dictionary just during a scope and restoring the dictionary to its +original state when the test ends: + + >>> foo = {'key': 'value'} + >>> original = foo.copy() + >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True): + ... assert foo == {'newkey': 'newvalue'} + ... + >>> assert foo == original + +Mock supports the mocking of Python *note magic methods: 40c6. The +easiest way of using magic methods is with the *note MagicMock: e8a. +class. It allows you to do things like: + + >>> mock = MagicMock() + >>> mock.__str__.return_value = 'foobarbaz' + >>> str(mock) + 'foobarbaz' + >>> mock.__str__.assert_called_with() + +Mock allows you to assign functions (or other Mock instances) to magic +methods and they will be called appropriately. The *note MagicMock: +e8a. class is just a Mock variant that has all of the magic methods +pre-created for you (well, all the useful ones anyway). + +The following is an example of using magic methods with the ordinary +Mock class: + + >>> mock = Mock() + >>> mock.__str__ = Mock(return_value='wheeeeee') + >>> str(mock) + 'wheeeeee' + +For ensuring that the mock objects in your tests have the same api as +the objects they are replacing, you can use *note auto-speccing: 40c7. +Auto-speccing can be done through the 'autospec' argument to patch, or +the *note create_autospec(): 1608. function. Auto-speccing creates mock +objects that have the same attributes and methods as the objects they +are replacing, and any functions and methods (including constructors) +have the same call signature as the real object. + +This ensures that your mocks will fail in the same way as your +production code if they are used incorrectly: + + >>> 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(): 1608. can also be used on classes, where it +copies the signature of the ‘__init__’ method, and on callable objects +where it copies the signature of the ‘__call__’ method. + + +File: python.info, Node: The Mock Class, Next: The patchers, Prev: Quick Guide, Up: unittest mock — mock object library + +5.27.6.2 The Mock Class +....................... + +*note Mock: a4b. is a flexible mock object intended to replace the use +of stubs and test doubles throughout your code. Mocks are callable and +create attributes as new mocks when you access them (1). Accessing the +same attribute will always return the same mock. Mocks record how you +use them, allowing you to make assertions about what your code has done +to them. + +*note MagicMock: e8a. is a subclass of *note Mock: a4b. with all the +magic methods pre-created and ready to use. There are also non-callable +variants, useful when you are mocking out objects that aren’t callable: +*note NonCallableMock: 40c9. and *note NonCallableMagicMock: 40ca. + +The *note patch(): e8b. decorators makes it easy to temporarily replace +classes in a particular module with a *note Mock: a4b. object. By +default *note patch(): e8b. will create a *note MagicMock: e8a. for you. +You can specify an alternative class of *note Mock: a4b. using the +'new_callable' argument to *note patch(): e8b. + + -- Class: unittest.mock.Mock (spec=None, side_effect=None, + return_value=DEFAULT, wraps=None, name=None, spec_set=None, + unsafe=False, **kwargs) + + Create a new *note Mock: a4b. object. *note Mock: a4b. takes + several optional arguments that specify the behaviour of the Mock + object: + + * 'spec': This can be either a list of strings or an existing + object (a class or instance) that acts as the specification + for the mock object. If you pass in an object then a list of + strings is formed by calling dir on the object (excluding + unsupported magic attributes and methods). Accessing any + attribute not in this list will raise an *note AttributeError: + 348. + + If 'spec' is an object (rather than a list of strings) then + *note __class__: 1476. returns the class of the spec object. + This allows mocks to pass *note isinstance(): 43d. tests. + + * 'spec_set': A stricter variant of 'spec'. If used, attempting + to 'set' or get an attribute on the mock that isn’t on the + object passed as 'spec_set' will raise an *note + AttributeError: 348. + + * 'side_effect': A function to be called whenever the Mock is + called. See the *note side_effect: 40c4. attribute. Useful + for raising exceptions or dynamically changing return values. + The function is called with the same arguments as the mock, + and unless it returns *note DEFAULT: 40cb, the return value of + this function is used as the return value. + + Alternatively 'side_effect' can be an exception class or + instance. In this case the exception will be raised when the + mock is called. + + If 'side_effect' is an iterable then each call to the mock + will return the next value from the iterable. + + A 'side_effect' can be cleared by setting it to ‘None’. + + * 'return_value': The value returned when the mock is called. + By default this is a new Mock (created on first access). See + the *note return_value: 40cc. attribute. + + * 'unsafe': By default, accessing any attribute whose name + starts with 'assert', 'assret', 'asert', 'aseert' or 'assrt' + will raise an *note AttributeError: 348. Passing + ‘unsafe=True’ will allow access to these attributes. + + Added in version 3.5. + + * 'wraps': Item for the mock object to wrap. If 'wraps' is not + ‘None’ then calling the Mock will pass the call through to the + wrapped object (returning the real result). Attribute access + on the mock will return a Mock object that wraps the + corresponding attribute of the wrapped object (so attempting + to access an attribute that doesn’t exist will raise an *note + AttributeError: 348.). + + If the mock has an explicit 'return_value' set then calls are + not passed to the wrapped object and the 'return_value' is + returned instead. + + * 'name': If the mock has a name then it will be used in the + repr of the mock. This can be useful for debugging. The name + is propagated to child mocks. + + Mocks can also be called with arbitrary keyword arguments. These + will be used to set attributes on the mock after it is created. + See the *note configure_mock(): 40cd. method for details. + + -- Method: assert_called () + + Assert that the mock was called at least once. + + >>> mock = Mock() + >>> mock.method() + <Mock name='mock.method()' id='...'> + >>> mock.method.assert_called() + + Added in version 3.6. + + -- Method: assert_called_once () + + Assert that the mock was called exactly 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. + + -- Method: 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') + + -- Method: assert_called_once_with (*args, **kwargs) + + Assert that the mock was called exactly once and that call was + with the specified arguments. + + >>> 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')]. + + -- Method: assert_any_call (*args, **kwargs) + + assert the mock has been called with the specified arguments. + + The assert passes if the mock has 'ever' been called, unlike + *note assert_called_with(): 1a20. and *note + assert_called_once_with(): 40ce. that only pass if the call is + the most recent one, and in the case of *note + assert_called_once_with(): 40ce. 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') + + -- Method: assert_has_calls (calls, any_order=False) + + assert the mock has been called with the specified calls. The + *note mock_calls: 40d0. list is checked for the calls. + + If 'any_order' is false then the calls must be sequential. + There can be extra calls before or after the specified calls. + + If 'any_order' is true then the calls can be in any order, but + they must all appear in *note mock_calls: 40d0. + + >>> 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) + + -- Method: assert_not_called () + + Assert the mock was never 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. + + -- Method: reset_mock (*, return_value=False, side_effect=False) + + The reset_mock method resets all the call attributes on a mock + object: + + >>> 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: 40cc.: + + >>> 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: 40c4.: + + >>> mock = Mock(side_effect=ValueError) + >>> mock('hello') + Traceback (most recent call last): + ... + ValueError + >>> mock.reset_mock(side_effect=True) + >>> mock('hello') + <Mock name='mock()' id='...'> + + Note that *note reset_mock(): cfa. 'doesn’t' clear the *note + return_value: 40cc, *note side_effect: 40c4. or any child + attributes you have set using normal assignment by default. + + Child mocks are reset as well. + + Changed in version 3.6: Added two keyword-only arguments to + the reset_mock function. + + -- Method: mock_add_spec (spec, spec_set=False) + + Add a spec to a mock. 'spec' can either be an object or a + list of strings. Only attributes on the 'spec' can be fetched + as attributes from the mock. + + If 'spec_set' is true then only attributes on the spec can be + set. + + -- Method: attach_mock (mock, attribute) + + Attach a mock as an attribute of this one, replacing its name + and parent. Calls to the attached mock will be recorded in + the *note method_calls: 40d2. and *note mock_calls: 40d0. + attributes of this one. + + -- Method: configure_mock (**kwargs) + + Set attributes on the mock through keyword arguments. + + Attributes plus return values and side effects can be set on + child mocks using standard dot notation and unpacking a + dictionary in the method call: + + >>> 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 + + The same thing can be achieved in the constructor call to + mocks: + + >>> 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(): 40cd. exists to make it easier to do + configuration after the mock has been created. + + -- Method: __dir__ () + + *note Mock: a4b. objects limit the results of ‘dir(some_mock)’ + to useful results. For mocks with a 'spec' this includes all + the permitted attributes for the mock. + + See *note FILTER_DIR: 40d4. for what this filtering does, and + how to switch it off. + + -- Method: _get_child_mock (**kw) + + Create the child mocks for attributes and return value. By + default child mocks will be the same type as the parent. + Subclasses of Mock may want to override this to customize the + way child mocks are made. + + For non-callable mocks the callable variant will be used + (rather than any custom subclass). + + -- Attribute: called + + A boolean representing whether or not the mock object has been + called: + + >>> mock = Mock(return_value=None) + >>> mock.called + False + >>> mock() + >>> mock.called + True + + -- Attribute: call_count + + An integer telling you how many times the mock object has been + called: + + >>> mock = Mock(return_value=None) + >>> mock.call_count + 0 + >>> mock() + >>> mock() + >>> mock.call_count + 2 + + -- Attribute: return_value + + Set this to configure the value returned by calling the mock: + + >>> mock = Mock() + >>> mock.return_value = 'fish' + >>> mock() + 'fish' + + The default return value is a mock object and you can + configure it in the normal way: + + >>> mock = Mock() + >>> mock.return_value.attribute = sentinel.Attribute + >>> mock.return_value() + <Mock name='mock()()' id='...'> + >>> mock.return_value.assert_called_with() + + *note return_value: 40cc. can also be set in the constructor: + + >>> mock = Mock(return_value=3) + >>> mock.return_value + 3 + >>> mock() + 3 + + -- Attribute: side_effect + + This can either be a function to be called when the mock is + called, an iterable or an exception (class or instance) to be + raised. + + If you pass in a function it will be called with same + arguments as the mock and unless the function returns the + *note DEFAULT: 40cb. singleton the call to the mock will then + return whatever the function returns. If the function returns + *note DEFAULT: 40cb. then the mock will return its normal + value (from the *note return_value: 40cc.). + + If you pass in an iterable, it is used to retrieve an iterator + which must yield a value on every call. This value can either + be an exception instance to be raised, or a value to be + returned from the call to the mock (*note DEFAULT: 40cb. + handling is identical to the function case). + + An example of a mock that raises an exception (to test + exception handling of an API): + + >>> mock = Mock() + >>> mock.side_effect = Exception('Boom!') + >>> mock() + Traceback (most recent call last): + ... + Exception: Boom! + + Using *note side_effect: 40c4. to return a sequence of values: + + >>> mock = Mock() + >>> mock.side_effect = [3, 2, 1] + >>> mock(), mock(), mock() + (3, 2, 1) + + Using a callable: + + >>> mock = Mock(return_value=3) + >>> def side_effect(*args, **kwargs): + ... return DEFAULT + ... + >>> mock.side_effect = side_effect + >>> mock() + 3 + + *note side_effect: 40c4. can be set in the constructor. + Here’s an example that adds one to the value the mock is + called with and returns it: + + >>> side_effect = lambda value: value + 1 + >>> mock = Mock(side_effect=side_effect) + >>> mock(3) + 4 + >>> mock(-8) + -7 + + Setting *note side_effect: 40c4. to ‘None’ clears it: + + >>> m = Mock(side_effect=KeyError, return_value=3) + >>> m() + Traceback (most recent call last): + ... + KeyError + >>> m.side_effect = None + >>> m() + 3 + + -- Attribute: 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: 197f, along with members of the lists *note + call_args_list: 40d8, *note method_calls: 40d2. and *note + mock_calls: 40d0. are *note call: 19cd. objects. These are + tuples, so they can be unpacked to get at the individual + arguments and make more complex assertions. See *note calls + as tuples: 40d9. + + Changed in version 3.8: Added ‘args’ and ‘kwargs’ properties. + + -- Attribute: call_args_list + + This is a list of all the calls made to the mock object in + sequence (so the length of the list is the number of times it + has been called). Before any calls have been made it is an + empty list. The *note call: 19cd. object can be used for + conveniently constructing lists of calls to compare with *note + call_args_list: 40d8. + + >>> 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 + + Members of *note call_args_list: 40d8. are *note call: 19cd. + objects. These can be unpacked as tuples to get at the + individual arguments. See *note calls as tuples: 40d9. + + -- Attribute: method_calls + + As well as tracking calls to themselves, mocks also track + calls to methods and attributes, and 'their' methods and + attributes: + + >>> 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()] + + Members of *note method_calls: 40d2. are *note call: 19cd. + objects. These can be unpacked as tuples to get at the + individual arguments. See *note calls as tuples: 40d9. + + -- Attribute: mock_calls + + *note mock_calls: 40d0. records 'all' calls to the mock + object, its methods, magic methods 'and' return value mocks. + + >>> 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 + + Members of *note mock_calls: 40d0. are *note call: 19cd. + objects. These can be unpacked as tuples to get at the + individual arguments. See *note calls as tuples: 40d9. + + Note: The way *note mock_calls: 40d0. 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 + + -- Attribute: __class__ + + Normally the ‘__class__’ attribute of an object will return + its type. For a mock object with a ‘spec’, ‘__class__’ + returns the spec class instead. This allows mock objects to + pass *note isinstance(): 43d. tests for the object they are + replacing / masquerading as: + + >>> mock = Mock(spec=3) + >>> isinstance(mock, int) + True + + ‘__class__’ is assignable to, this allows a mock to pass an + *note isinstance(): 43d. check without forcing you to use a + spec: + + >>> mock = Mock() + >>> mock.__class__ = dict + >>> isinstance(mock, dict) + True + + -- Class: unittest.mock.NonCallableMock (spec=None, wraps=None, + name=None, spec_set=None, **kwargs) + + A non-callable version of *note Mock: a4b. The constructor + parameters have the same meaning of *note Mock: a4b, with the + exception of 'return_value' and 'side_effect' which have no meaning + on a non-callable mock. + +Mock objects that use a class or an instance as a ‘spec’ or ‘spec_set’ +are able to pass *note isinstance(): 43d. tests: + + >>> mock = Mock(spec=SomeClass) + >>> isinstance(mock, SomeClass) + True + >>> mock = Mock(spec_set=SomeClass()) + >>> isinstance(mock, SomeClass) + True + +The *note Mock: a4b. classes have support for mocking magic methods. +See *note magic methods: 40c6. for the full details. + +The mock classes and the *note patch(): e8b. decorators all take +arbitrary keyword arguments for configuration. For the *note patch(): +e8b. decorators the keywords are passed to the constructor of the mock +being created. The keyword arguments are for configuring attributes of +the mock: + + >>> m = MagicMock(attribute=3, other='fish') + >>> m.attribute + 3 + >>> m.other + 'fish' + +The return value and side effect of child mocks can be set in the same +way, using dotted notation. As you can’t use dotted names directly in a +call you have to create a dictionary and unpack it using ‘**’: + + >>> 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 + +A callable mock which was created with a 'spec' (or a 'spec_set') will +introspect the specification object’s signature when matching calls to +the mock. Therefore, it can match the actual call’s arguments +regardless of whether they were passed positionally or by name: + + >>> 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) + +This applies to *note assert_called_with(): 1a20, *note +assert_called_once_with(): 40ce, *note assert_has_calls(): 16a8. and +*note assert_any_call(): 40cf. When *note Autospeccing: 40c7, it will +also apply to method calls on the mock object. + +Changed in version 3.4: Added signature introspection on specced and +autospecced mock objects. + + -- Class: unittest.mock.PropertyMock (*args, **kwargs) + + A mock intended to be used as a *note property: 194, or other *note + descriptor: 1572, on a class. *note PropertyMock: 40db. provides + *note __get__(): 14b2. and *note __set__(): 1f6a. methods so you + can specify a return value when it is fetched. + + Fetching a *note PropertyMock: 40db. instance from an object calls + the mock, with no args. Setting it calls the mock with the value + being set. + + >>> 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)] + +Because of the way mock attributes are stored you can’t directly attach +a *note PropertyMock: 40db. to a mock object. Instead you can attach it +to the mock type object: + + >>> m = MagicMock() + >>> p = PropertyMock(return_value=3) + >>> type(m).foo = p + >>> m.foo + 3 + >>> p.assert_called_once_with() + + Caution: If an *note AttributeError: 348. is raised by *note + PropertyMock: 40db, it will be interpreted as a missing descriptor + and *note __getattr__(): 4cf. 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'> + + See *note __getattr__(): 4cf. for details. + + -- Class: 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: e8a. The *note + AsyncMock: a4a. object will behave so the object is recognized as + an async function, and the result of a call is an awaitable. + + >>> mock = AsyncMock() + >>> asyncio.iscoroutinefunction(mock) + True + >>> inspect.isawaitable(mock()) + True + + The result of ‘mock()’ is an async function which will have the + outcome of ‘side_effect’ or ‘return_value’ after it has been + awaited: + + - if ‘side_effect’ is a function, the async function will return + the result of that function, + + - if ‘side_effect’ is an exception, the async function will + raise the exception, + + - if ‘side_effect’ is an iterable, the async function will + return the next value of the iterable, however, if the + sequence of result is exhausted, ‘StopAsyncIteration’ is + raised immediately, + + - if ‘side_effect’ is not defined, the async function will + return the value defined by ‘return_value’, hence, by default, + the async function returns a new *note AsyncMock: a4a. object. + + Setting the 'spec' of a *note Mock: a4b. or *note MagicMock: e8a. + 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: a4b, *note MagicMock: e8a, or + *note AsyncMock: a4a. to a class with asynchronous and synchronous + functions will automatically detect the synchronous functions and + set them as *note MagicMock: e8a. (if the parent mock is *note + AsyncMock: a4a. or *note MagicMock: e8a.) or *note Mock: a4b. (if + the parent mock is *note Mock: a4b.). All asynchronous functions + will be *note AsyncMock: a4a. + + >>> 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. + + -- Method: 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() + + -- Method: 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. + + -- Method: 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') + + -- Method: 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. + + -- Method: 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 + + -- Method: assert_has_awaits (calls, any_order=False) + + Assert the mock has been awaited with the specified calls. + The *note await_args_list: 197e. 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: 197e. + + >>> 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) + + -- Method: assert_not_awaited () + + Assert that the mock was never awaited. + + >>> mock = AsyncMock() + >>> mock.assert_not_awaited() + + -- Method: reset_mock (*args, **kwargs) + + See *note Mock.reset_mock(): cfa. Also sets *note + await_count: 40e4. to 0, *note await_args: 40e5. to None, and + clears the *note await_args_list: 197e. + + -- Attribute: 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 + + -- Attribute: 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: 197f. + + >>> 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') + + -- Attribute: 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')] + + -- Class: 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: e8a. for multithreading tests. The + *note ThreadingMock: 40e6. 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: 40e7. attribute, + which defaults to blocking (‘None’). + + You can configure the global default timeout by setting *note + ThreadingMock.DEFAULT_TIMEOUT: 40e7. + + -- Method: 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: 6a5. 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() + + -- Method: 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: 6a5. 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() + + -- Attribute: DEFAULT_TIMEOUT + + Global default timeout in seconds to create instances of *note + ThreadingMock: 40e6. + + Added in version 3.13. + +* Menu: + +* Calling:: +* Deleting Attributes:: +* Mock names and the name attribute:: +* Attaching Mocks as Attributes:: + + ---------- Footnotes ---------- + + (1) The only exceptions are magic methods and attributes (those that +have leading and trailing double underscores). Mock doesn’t create +these but instead raises an *note AttributeError: 348. This is because +the interpreter will often implicitly request these methods, and gets +'very' confused to get a new Mock object when it expects a magic method. +If you need magic method support see *note magic methods: 40c6. + + +File: python.info, Node: Calling, Next: Deleting Attributes, Up: The Mock Class + +5.27.6.3 Calling +................ + +Mock objects are callable. The call will return the value set as the +*note return_value: 40cc. attribute. The default return value is a new +Mock object; it is created the first time the return value is accessed +(either explicitly or by calling the Mock) - but it is stored and the +same one returned each time. + +Calls made to the object will be recorded in the attributes like *note +call_args: 197f. and *note call_args_list: 40d8. + +If *note side_effect: 40c4. 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. + +The simplest way to make a mock raise an exception when called is to +make *note side_effect: 40c4. an exception class or instance: + + >>> 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: 40c4. 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: 40cc. from inside *note side_effect: +40c4, or return *note DEFAULT: 40cb.: + + >>> 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: 40c4, 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: 40c4. 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: bfa. is raised): + + >>> m = MagicMock(side_effect=[1, 2, 3]) + >>> m() + 1 + >>> m() + 2 + >>> m() + 3 + >>> m() + Traceback (most recent call last): + ... + StopIteration + +If any members of the iterable are exceptions they will be raised +instead of returned: + + >>> iterable = (33, ValueError, 66) + >>> m = MagicMock(side_effect=iterable) + >>> m() + 33 + >>> m() + Traceback (most recent call last): + ... + ValueError + >>> m() + 66 + + +File: python.info, Node: Deleting Attributes, Next: Mock names and the name attribute, Prev: Calling, Up: The Mock Class + +5.27.6.4 Deleting Attributes +............................ + +Mock objects create attributes on demand. This allows them to pretend +to be objects of any type. + +You may want a mock object to return ‘False’ to a *note hasattr(): 4ce. +call, or raise an *note AttributeError: 348. 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. + +You “block” attributes by deleting them. Once deleted, accessing an +attribute will raise an *note AttributeError: 348. + + >>> 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 names and the name attribute, Next: Attaching Mocks as Attributes, Prev: Deleting Attributes, Up: The Mock Class + +5.27.6.5 Mock names and the name attribute +.......................................... + +Since “name” is an argument to the *note Mock: a4b. constructor, if you +want your mock object to have a “name” attribute you can’t just pass it +in at creation time. There are two alternatives. One option is to use +*note configure_mock(): 40cd.: + + >>> mock = MagicMock() + >>> mock.configure_mock(name='my_name') + >>> mock.name + 'my_name' + +A simpler option is to simply set the “name” attribute after mock +creation: + + >>> mock = MagicMock() + >>> mock.name = "foo" + + +File: python.info, Node: Attaching Mocks as Attributes, Prev: Mock names and the name attribute, Up: The Mock Class + +5.27.6.6 Attaching Mocks as Attributes +...................................... + +When you attach a mock as an attribute of another mock (or as the return +value) it becomes a “child” of that mock. Calls to the child are +recorded in the *note method_calls: 40d2. and *note mock_calls: 40d0. +attributes of the parent. This is useful for configuring child mocks +and then attaching them to the parent, or for attaching mocks to a +parent that records all calls to the children and allows you to make +assertions about the order of calls between mocks: + + >>> 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)] + +The exception to this is if the mock has a name. This allows you to +prevent the “parenting” if for some reason you don’t want it to happen. + + >>> 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 + [] + +Mocks created for you by *note patch(): e8b. are automatically given +names. To attach mocks that have names to a parent you use the *note +attach_mock(): 160f. method: + + >>> 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: The patchers, Next: MagicMock and magic method support, Prev: The Mock Class, Up: unittest mock — mock object library + +5.27.6.7 The patchers +..................... + +The patch decorators are used for patching objects only within the scope +of the function they decorate. They automatically handle the unpatching +for you, even if exceptions are raised. All of these functions can also +be used in with statements or as class decorators. + +* Menu: + +* patch:: +* patch.object: patch object. +* patch.dict: patch dict. +* patch.multiple: patch multiple. +* patch methods; start and stop: patch methods start and stop. +* patch builtins:: +* TEST_PREFIX:: +* Nesting Patch Decorators:: +* Where to patch:: +* Patching Descriptors and Proxy Objects:: + + +File: python.info, Node: patch, Next: patch object, Up: The patchers + +5.27.6.8 patch +.............. + + Note: The key is to do the patching in the right namespace. See + the section *note where to patch: 40f1. + + -- Function: unittest.mock.patch (target, new=DEFAULT, spec=None, + create=False, spec_set=None, autospec=None, new_callable=None, + **kwargs) + + *note patch(): e8b. acts as a function decorator, class decorator + or a context manager. Inside the body of the function or with + statement, the 'target' is patched with a 'new' object. When the + function/with statement exits the patch is undone. + + If 'new' is omitted, then the target is replaced with an *note + AsyncMock: a4a. if the patched object is an async function or a + *note MagicMock: e8a. otherwise. If *note patch(): e8b. is used as + a decorator and 'new' is omitted, the created mock is passed in as + an extra argument to the decorated function. If *note patch(): + e8b. is used as a context manager the created mock is returned by + the context manager. + + 'target' should be a string in the form + ‘'package.module.ClassName'’. The 'target' is imported and the + specified object replaced with the 'new' object, so the 'target' + must be importable from the environment you are calling *note + patch(): e8b. from. The target is imported when the decorated + function is executed, not at decoration time. + + The 'spec' and 'spec_set' keyword arguments are passed to the *note + MagicMock: e8a. if patch is creating one for you. + + In addition you can pass ‘spec=True’ or ‘spec_set=True’, which + causes patch to pass in the object being mocked as the + spec/spec_set object. + + '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: a4a. is used for async functions and *note + MagicMock: e8a. for the rest. + + A more powerful form of 'spec' is 'autospec'. If you set + ‘autospec=True’ then the mock will be created with a spec from the + object being replaced. All attributes of the mock will also have + the spec of the corresponding attribute of the object being + replaced. Methods and functions being mocked will have their + arguments checked and will raise a *note TypeError: 534. if they + are called with the wrong signature. For mocks replacing a class, + their return value (the ‘instance’) will have the same spec as the + class. See the *note create_autospec(): 1608. function and *note + Autospeccing: 40c7. + + Instead of ‘autospec=True’ you can pass ‘autospec=some_object’ to + use an arbitrary object as the spec instead of the one being + replaced. + + By default *note patch(): e8b. 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! + + Note: + Changed in version 3.5: If you are patching builtins in a + module then you don’t need to pass ‘create=True’, it will be + added by default. + + Patch can be used as a *note TestCase: 449. class decorator. It + works by decorating each test method in the class. This reduces + the boilerplate code when your test methods share a common + patchings set. *note patch(): e8b. finds tests by looking for + method names that start with ‘patch.TEST_PREFIX’. By default this + is ‘'test'’, which matches the way *note unittest: 106. finds + tests. You can specify an alternative prefix by setting + ‘patch.TEST_PREFIX’. + + Patch can be used as a context manager, with the with statement. + Here the patching applies to the indented block after the with + statement. If you use “as” then the patched object will be bound + to the name after the “as”; very useful if *note patch(): e8b. is + creating a mock object for you. + + *note patch(): e8b. takes arbitrary keyword arguments. These will + be passed to *note AsyncMock: a4a. if the patched object is + asynchronous, to *note MagicMock: e8a. otherwise or to + 'new_callable' if specified. + + ‘patch.dict(...)’, ‘patch.multiple(...)’ and ‘patch.object(...)’ + are available for alternate use-cases. + +*note patch(): e8b. as function decorator, creating the mock for you and +passing it into the decorated function: + + >>> @patch('__main__.SomeClass') + ... def function(normal_argument, mock_class): + ... print(mock_class is SomeClass) + ... + >>> function(None) + True + +Patching a class replaces the class with a *note MagicMock: e8a. +'instance'. If the class is instantiated in the code under test then it +will be the *note return_value: 40cc. of the mock that will be used. + +If the class is instantiated multiple times you could use *note +side_effect: 40c4. to return a new mock each time. Alternatively you +can set the 'return_value' to be anything you want. + +To configure return values on methods of 'instances' on the patched +class you must do this on the *note return_value: 40cc. 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' + ... + +If you use 'spec' or 'spec_set' and *note patch(): e8b. is replacing a +'class', then the return value of the created mock will have the same +spec. + + >>> Original = Class + >>> patcher = patch('__main__.Class', spec=True) + >>> MockClass = patcher.start() + >>> instance = MockClass() + >>> assert isinstance(instance, Original) + >>> patcher.stop() + +The 'new_callable' argument is useful where you want to use an +alternative class to the default *note MagicMock: e8a. for the created +mock. For example, if you wanted a *note NonCallableMock: 40c9. to be +used: + + >>> 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 + +Another use case might be to replace an object with an *note +io.StringIO: f22. instance: + + >>> 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() + +When *note patch(): e8b. is creating a mock for you, it is common that +the first thing you need to do is to configure the mock. Some of that +configuration can be done in the call to patch. Any arbitrary keywords +you pass into the call will be used to set attributes on the created +mock: + + >>> patcher = patch('__main__.thing', first='one', second='two') + >>> mock_thing = patcher.start() + >>> mock_thing.first + 'one' + >>> mock_thing.second + 'two' + +As well as attributes on the created mock attributes, like the *note +return_value: 40cc. and *note side_effect: 40c4, of child mocks can also +be configured. These aren’t syntactically valid to pass in directly as +keyword arguments, but a dictionary with these as keys can still be +expanded into a *note patch(): e8b. call using ‘**’: + + >>> 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: 348.: + + >>> @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(): e8b. 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() + +Changed in version 3.8: *note patch(): e8b. now returns an *note +AsyncMock: a4a. if the target is an async function. + + +File: python.info, Node: patch object, Next: patch dict, Prev: patch, Up: The patchers + +5.27.6.9 patch.object +..................... + + -- Function: patch.object (target, attribute, new=DEFAULT, spec=None, + create=False, spec_set=None, autospec=None, new_callable=None, + **kwargs) + + patch the named member ('attribute') on an object ('target') with a + mock object. + + *note patch.object(): 1598. can be used as a decorator, class + decorator or a context manager. Arguments 'new', 'spec', 'create', + 'spec_set', 'autospec' and 'new_callable' have the same meaning as + for *note patch(): e8b. Like *note patch(): e8b, *note + patch.object(): 1598. takes arbitrary keyword arguments for + configuring the mock object it creates. + + When used as a class decorator *note patch.object(): 1598. honours + ‘patch.TEST_PREFIX’ for choosing which methods to wrap. + +You can either call *note patch.object(): 1598. with three arguments or +two arguments. The three argument form takes the object to be patched, +the attribute name and the object to replace the attribute with. + +When calling with the two argument form you omit the replacement object, +and a mock is created for you and passed in as an extra argument to the +decorated function: + + >>> @patch.object(SomeClass, 'class_method') + ... def test(mock_method): + ... SomeClass.class_method(3) + ... mock_method.assert_called_with(3) + ... + >>> test() + +'spec', 'create' and the other arguments to *note patch.object(): 1598. +have the same meaning as they do for *note patch(): e8b. + + +File: python.info, Node: patch dict, Next: patch multiple, Prev: patch object, Up: The patchers + +5.27.6.10 patch.dict +.................... + + -- Function: 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. + + 'in_dict' can be a dictionary or a mapping like container. If it + is a mapping then it must at least support getting, setting and + deleting items plus iterating over keys. + + 'in_dict' can also be a string specifying the name of the + dictionary, which will then be fetched by importing it. + + 'values' can be a dictionary of values to set in the dictionary. + 'values' can also be an iterable of ‘(key, value)’ pairs. + + If 'clear' is true then the dictionary will be cleared before the + new values are set. + + *note patch.dict(): 19f2. can also be called with arbitrary keyword + arguments to set values in the dictionary. + + Changed in version 3.8: *note patch.dict(): 19f2. now returns the + patched dictionary when used as a context manager. + +*note patch.dict(): 19f2. 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(): 19f2. 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: +40f4. + +*note patch.dict(): 19f2. can be used to add members to a dictionary, or +simply let a test change a dictionary, and ensure the dictionary is +restored when the test ends. + + >>> 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 + +Keywords can be used in the *note patch.dict(): 19f2. call to set values +in the dictionary: + + >>> mymodule = MagicMock() + >>> mymodule.function.return_value = 'fish' + >>> with patch.dict('sys.modules', mymodule=mymodule): + ... import mymodule + ... mymodule.function('some', 'args') + ... + 'fish' + +*note patch.dict(): 19f2. 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__(): 285, *note +__setitem__(): 12be, *note __delitem__(): 12bf. and either *note +__iter__(): 1cc1. or *note __contains__(): 1f5e. + + >>> 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 methods start and stop, Prev: patch dict, Up: The patchers + +5.27.6.11 patch.multiple +........................ + + -- Function: patch.multiple (target, spec=None, create=False, + spec_set=None, autospec=None, new_callable=None, **kwargs) + + Perform multiple patches in a single call. It takes the object to + be patched (either as an object or a string to fetch the object by + importing) and keyword arguments for the patches: + + with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): + ... + + Use *note DEFAULT: 40cb. as the value if you want *note + patch.multiple(): 40f6. to create mocks for you. In this case the + created mocks are passed into a decorated function by keyword, and + a dictionary is returned when *note patch.multiple(): 40f6. is used + as a context manager. + + *note patch.multiple(): 40f6. can be used as a decorator, class + decorator or a context manager. The arguments 'spec', 'spec_set', + 'create', 'autospec' and 'new_callable' have the same meaning as + for *note patch(): e8b. These arguments will be applied to 'all' + patches done by *note patch.multiple(): 40f6. + + When used as a class decorator *note patch.multiple(): 40f6. + honours ‘patch.TEST_PREFIX’ for choosing which methods to wrap. + +If you want *note patch.multiple(): 40f6. to create mocks for you, then +you can use *note DEFAULT: 40cb. as the value. If you use *note +patch.multiple(): 40f6. as a decorator then the created mocks are passed +into the decorated function by keyword. + + >>> 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(): 40f6. can be nested with other ‘patch’ +decorators, but put arguments passed by keyword 'after' any of the +standard arguments created by *note patch(): e8b.: + + >>> @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() + +If *note patch.multiple(): 40f6. is used as a context manager, the value +returned by the context manager is a dictionary where created mocks are +keyed by name: + + >>> 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 methods start and stop, Next: patch builtins, Prev: patch multiple, Up: The patchers + +5.27.6.12 patch methods: start and 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(): e8b, *note patch.object(): 1598. or +*note patch.dict(): 19f2. 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. + +If you are using *note patch(): e8b. to create a mock for you then it +will be returned by the call to ‘patcher.start’. + + >>> 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: 449.: + + >>> 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() + + Caution: If you use this technique you must ensure that the + patching is “undone” by calling ‘stop’. This can be fiddlier than + you might think, because if an exception is raised in the ‘setUp’ + then ‘tearDown’ is not called. *note + unittest.TestCase.addCleanup(): a81. makes this easier: + + >>> 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 + ... + + As an added bonus you no longer need to keep a reference to the + ‘patcher’ object. + +It is also possible to stop all patches which have been started by using +*note patch.stopall(): 40f9. + + -- Function: patch.stopall () + + Stop all active patches. Only stops patches started with ‘start’. + + +File: python.info, Node: patch builtins, Next: TEST_PREFIX, Prev: patch methods start and stop, Up: The patchers + +5.27.6.13 patch builtins +........................ + +You can patch any builtins within a module. The following example +patches builtin *note ord(): 1ef2.: + + >>> @patch('__main__.ord') + ... def test(mock_ord): + ... mock_ord.return_value = 101 + ... print(ord('c')) + ... + >>> test() + 101 + + +File: python.info, Node: TEST_PREFIX, Next: Nesting Patch Decorators, Prev: patch builtins, Up: The patchers + +5.27.6.14 TEST_PREFIX +..................... + +All of the patchers can be used as class decorators. When used in this +way they wrap every test method on the class. The patchers recognise +methods that start with ‘'test'’ as being test methods. This is the +same way that the *note unittest.TestLoader: 290. finds test methods by +default. + +It is possible that you want to use a different prefix for your tests. +You can inform the patchers of the different prefix by setting +‘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: Nesting Patch Decorators, Next: Where to patch, Prev: TEST_PREFIX, Up: The patchers + +5.27.6.15 Nesting Patch Decorators +.................................. + +If you want to perform multiple patches then you can simply stack up the +decorators. + +You can stack up multiple patch decorators using this pattern: + + >>> @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') + +Note that the decorators are applied from the bottom upwards. This is +the standard way that Python applies decorators. The order of the +created mocks passed into your test function matches this order. + + +File: python.info, Node: Where to patch, Next: Patching Descriptors and Proxy Objects, Prev: Nesting Patch Decorators, Up: The patchers + +5.27.6.16 Where to patch +........................ + +*note patch(): e8b. works by (temporarily) changing the object that a +'name' points to with another one. There can be many names pointing to +any individual object, so for patching to work you must ensure that you +patch the name used by the system under test. + +The basic principle is that you patch where an object is 'looked up', +which is not necessarily the same place as where it is defined. A +couple of examples will help to clarify this. + +Imagine we have a project that we want to test with the following +structure: + + 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(): e8b. The problem is that when we import module b, +which we will have to do when it imports ‘SomeClass’ from module a. If +we use *note patch(): e8b. 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. + +The key is to patch out ‘SomeClass’ where it is used (or where it is +looked up). In this case ‘some_function’ will actually look up +‘SomeClass’ in module b, where we have imported it. The patching should +look like: + + @patch('b.SomeClass') + +However, consider the alternative scenario where instead of ‘from a +import SomeClass’ module b does ‘import a’ and ‘some_function’ uses +‘a.SomeClass’. Both of these import forms are common. In this case the +class we want to patch is being looked up in the module and so we have +to patch ‘a.SomeClass’ instead: + + @patch('a.SomeClass') + + +File: python.info, Node: Patching Descriptors and Proxy Objects, Prev: Where to patch, Up: The patchers + +5.27.6.17 Patching Descriptors and Proxy Objects +................................................ + +Both *note patch: 40f0. and *note patch.object: 40f2. correctly patch +and restore descriptors: class methods, static methods and properties. +You should patch these on the 'class' rather than an instance. They +also work with 'some' objects that proxy attribute access, like the +django settings object(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 and magic method support, Next: Helpers, Prev: The patchers, Up: unittest mock — mock object library + +5.27.6.18 MagicMock and magic method support +............................................ + +* Menu: + +* Mocking Magic Methods:: +* Magic Mock:: + + +File: python.info, Node: Mocking Magic Methods, Next: Magic Mock, Up: MagicMock and magic method support + +5.27.6.19 Mocking Magic Methods +............................... + +*note Mock: a4b. supports mocking the Python protocol methods, also +known as *note “magic methods”: 4101. This allows mock objects to +replace containers or other objects that implement Python protocols. + +Because magic methods are looked up differently from normal methods (1), +this support has been specially implemented. This means that only +specific magic methods are supported. The supported list includes +'almost' all of them. If there are any missing that you need please let +us know. + +You mock magic methods by setting the method you are interested in to a +function or a mock instance. If you are using a function then it 'must' +take ‘self’ as the first argument (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) + [] + +One use case for this is for mocking objects used as context managers in +a *note with: 5ce. statement: + + >>> 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) + +Calls to magic methods do not appear in *note method_calls: 40d2, but +they are recorded in *note mock_calls: 40d0. + + Note: If you use the 'spec' keyword argument to create a mock then + attempting to set a magic method that isn’t in the spec will raise + an *note AttributeError: 348. + +The full list of supported magic methods is: + + * ‘__hash__’, ‘__sizeof__’, ‘__repr__’ and ‘__str__’ + + * ‘__dir__’, ‘__format__’ and ‘__subclasses__’ + + * ‘__round__’, ‘__floor__’, ‘__trunc__’ and ‘__ceil__’ + + * Comparisons: ‘__lt__’, ‘__gt__’, ‘__le__’, ‘__ge__’, ‘__eq__’ and + ‘__ne__’ + + * Container methods: ‘__getitem__’, ‘__setitem__’, ‘__delitem__’, + ‘__contains__’, ‘__len__’, ‘__iter__’, ‘__reversed__’ and + ‘__missing__’ + + * Context manager: ‘__enter__’, ‘__exit__’, ‘__aenter__’ and + ‘__aexit__’ + + * Unary numeric methods: ‘__neg__’, ‘__pos__’ and ‘__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__’ + + * Numeric conversion methods: ‘__complex__’, ‘__int__’, ‘__float__’ + and ‘__index__’ + + * Descriptor methods: ‘__get__’, ‘__set__’ and ‘__delete__’ + + * Pickling: ‘__reduce__’, ‘__reduce_ex__’, ‘__getinitargs__’, + ‘__getnewargs__’, ‘__getstate__’ and ‘__setstate__’ + + * File system path representation: ‘__fspath__’ + + * Asynchronous iteration methods: ‘__aiter__’ and ‘__anext__’ + +Changed in version 3.8: Added support for *note +os.PathLike.__fspath__(): c52. + +Changed in version 3.8: Added support for ‘__aenter__’, ‘__aexit__’, +‘__aiter__’ and ‘__anext__’. + +The following methods exist but are 'not' supported as they are either +in use by mock, can’t be set dynamically, or can cause problems: + + * ‘__getattr__’, ‘__setattr__’, ‘__init__’ and ‘__new__’ + + * ‘__prepare__’, ‘__instancecheck__’, ‘__subclasscheck__’, ‘__del__’ + + ---------- Footnotes ---------- + + (1) Magic methods 'should' be looked up on the class rather than the +instance. Different versions of Python are inconsistent about applying +this rule. The supported protocol methods should work with all +supported versions of Python. + + (2) The function is basically hooked up to the class, but each ‘Mock’ +instance is kept isolated from the others. + + +File: python.info, Node: Magic Mock, Prev: Mocking Magic Methods, Up: MagicMock and magic method support + +5.27.6.20 Magic Mock +.................... + +There are two ‘MagicMock’ variants: *note MagicMock: e8a. and *note +NonCallableMagicMock: 40ca. + + -- Class: unittest.mock.MagicMock (*args, **kw) + + ‘MagicMock’ is a subclass of *note Mock: a4b. with default + implementations of most of the *note magic methods: 4101. You can + use ‘MagicMock’ without having to configure the magic methods + yourself. + + The constructor parameters have the same meaning as for *note Mock: + a4b. + + If you use the 'spec' or 'spec_set' arguments then 'only' magic + methods that exist in the spec will be created. + + -- Class: unittest.mock.NonCallableMagicMock (*args, **kw) + + A non-callable version of *note MagicMock: e8a. + + The constructor parameters have the same meaning as for *note + MagicMock: e8a, with the exception of 'return_value' and + 'side_effect' which have no meaning on a non-callable mock. + +The magic methods are setup with *note MagicMock: e8a. objects, so you +can configure them and use them in the usual way: + + >>> mock = MagicMock() + >>> mock[3] = 'fish' + >>> mock.__setitem__.assert_called_with(3, 'fish') + >>> mock.__getitem__.return_value = 'result' + >>> mock[2] + 'result' + +By default many of the protocol methods are required to return objects +of a specific type. These methods are preconfigured with a default +return value, so that they can be used without you having to do anything +if you aren’t interested in the return value. You can still 'set' the +return value manually if you want to change the default. + +Methods and their defaults: + + * ‘__lt__’: *note NotImplemented: 7cd. + + * ‘__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__’: default hash for the mock + + * ‘__str__’: default str for the mock + + * ‘__sizeof__’: default sizeof for the mock + +For example: + + >>> 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: 40c4. attribute, unless you change their return value to +return something else: + + >>> MagicMock() == 3 + False + >>> MagicMock() != 3 + True + >>> mock = MagicMock() + >>> mock.__eq__.return_value = True + >>> mock == 3 + True + +The return value of ‘MagicMock.__iter__()’ can be any iterable object +and isn’t required to be an iterator: + + >>> mock = MagicMock() + >>> mock.__iter__.return_value = ['a', 'b', 'c'] + >>> list(mock) + ['a', 'b', 'c'] + >>> list(mock) + ['a', 'b', 'c'] + +If the return value 'is' an iterator, then iterating over it once will +consume it and subsequent iterations will result in an empty list: + + >>> mock.__iter__.return_value = iter(['a', 'b', 'c']) + >>> list(mock) + ['a', 'b', 'c'] + >>> list(mock) + [] + +‘MagicMock’ has all of the supported magic methods configured except for +some of the obscure and obsolete ones. You can still set these up if +you want. + +Magic methods that are supported but not setup by default in ‘MagicMock’ +are: + + * ‘__subclasses__’ + + * ‘__dir__’ + + * ‘__format__’ + + * ‘__get__’, ‘__set__’ and ‘__delete__’ + + * ‘__reversed__’ and ‘__missing__’ + + * ‘__reduce__’, ‘__reduce_ex__’, ‘__getinitargs__’, ‘__getnewargs__’, + ‘__getstate__’ and ‘__setstate__’ + + * ‘__getformat__’ + + +File: python.info, Node: Helpers, Next: Order of precedence of side_effect return_value and wraps, Prev: MagicMock and magic method support, Up: unittest mock — mock object library + +5.27.6.21 Helpers +................. + +* Menu: + +* sentinel:: +* DEFAULT:: +* call:: +* create_autospec:: +* ANY:: +* FILTER_DIR:: +* mock_open:: +* Autospeccing:: +* Sealing mocks:: + + +File: python.info, Node: sentinel, Next: DEFAULT, Up: Helpers + +5.27.6.22 sentinel +.................. + + -- Data: unittest.mock.sentinel + + The ‘sentinel’ object provides a convenient way of providing unique + objects for your tests. + + Attributes are created on demand when you access them by name. + Accessing the same attribute will always return the same object. + The objects returned have a sensible repr so that test failure + messages are readable. + + Changed in version 3.7: The ‘sentinel’ attributes now preserve + their identity when they are *note copied: 25. or *note pickled: + a6. + +Sometimes when testing you need to test that a specific object is passed +as an argument to another method, or returned. It can be common to +create named sentinel objects to test this. *note sentinel: ba0. +provides a convenient way of creating and testing the identity of +objects like this. + +In this example we monkey patch ‘method’ to return +‘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: Helpers + +5.27.6.23 DEFAULT +................. + + -- Data: unittest.mock.DEFAULT + + The *note DEFAULT: 40cb. object is a pre-created sentinel (actually + ‘sentinel.DEFAULT’). It can be used by *note side_effect: 40c4. + functions to indicate that the normal return value should be used. + + +File: python.info, Node: call, Next: create_autospec, Prev: DEFAULT, Up: Helpers + +5.27.6.24 call +.............. + + -- Function: unittest.mock.call (*args, **kwargs) + + *note call(): 19cd. is a helper object for making simpler + assertions, for comparing with *note call_args: 197f, *note + call_args_list: 40d8, *note mock_calls: 40d0. and *note + method_calls: 40d2. *note call(): 19cd. can also be used with + *note assert_has_calls(): 16a8. + + >>> 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 + + -- Method: call.call_list () + + For a call object that represents multiple calls, *note + call_list(): 4107. returns a list of all the intermediate calls as + well as the final call. + +‘call_list’ is particularly useful for making assertions on “chained +calls”. A chained call is multiple calls on a single line of code. +This results in multiple entries in *note mock_calls: 40d0. on a mock. +Manually constructing the sequence of calls can be tedious. + +*note call_list(): 4107. can construct the sequence of calls from the +same chained 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 +A ‘call’ object is either a tuple of (positional args, keyword args) or +(name, positional args, keyword args) depending on how it was +constructed. When you construct them yourself this isn’t particularly +interesting, but the ‘call’ objects that are in the *note +Mock.call_args: 197f, *note Mock.call_args_list: 40d8. and *note +Mock.mock_calls: 40d0. attributes can be introspected to get at the +individual arguments they contain. + +The ‘call’ objects in *note Mock.call_args: 197f. and *note +Mock.call_args_list: 40d8. are two-tuples of (positional args, keyword +args) whereas the ‘call’ objects in *note Mock.mock_calls: 40d0, along +with ones you construct yourself, are three-tuples of (name, positional +args, keyword args). + +You can use their “tupleness” to pull out the individual arguments for +more complex introspection and assertions. The positional arguments are +a tuple (an empty tuple if there are no positional arguments) and the +keyword arguments are a dictionary: + + >>> 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: Helpers + +5.27.6.25 create_autospec +......................... + + -- Function: unittest.mock.create_autospec (spec, spec_set=False, + instance=False, **kwargs) + + Create a mock object using another object as a spec. Attributes on + the mock will use the corresponding attribute on the 'spec' object + as their spec. + + Functions or methods being mocked will have their arguments checked + to ensure that they are called with the correct signature. + + If 'spec_set' is ‘True’ then attempting to set attributes that + don’t exist on the spec object will raise an *note AttributeError: + 348. + + If a class is used as a spec then the return value of the mock (the + instance of the class) will have the same spec. You can use a + class as the spec for an instance object by passing + ‘instance=True’. The returned mock will only be callable if + instances of the mock are callable. + + *note create_autospec(): 1608. also takes arbitrary keyword + arguments that are passed to the constructor of the created mock. + +See *note Autospeccing: 40c7. for examples of how to use auto-speccing +with *note create_autospec(): 1608. and the 'autospec' argument to *note +patch(): e8b. + +Changed in version 3.8: *note create_autospec(): 1608. now returns an +*note AsyncMock: a4a. if the target is an async function. + + +File: python.info, Node: ANY, Next: FILTER_DIR, Prev: create_autospec, Up: Helpers + +5.27.6.26 ANY +............. + + -- Data: unittest.mock.ANY + +Sometimes you may need to make assertions about 'some' of the arguments +in a call to mock, but either not care about some of the arguments or +want to pull them individually out of *note call_args: 197f. and make +more complex assertions on them. + +To ignore certain arguments you can pass in objects that compare equal +to 'everything'. Calls to *note assert_called_with(): 1a20. and *note +assert_called_once_with(): 40ce. will then succeed no matter what was +passed in. + + >>> mock = Mock(return_value=None) + >>> mock('foo', bar=object()) + >>> mock.assert_called_once_with('foo', bar=ANY) + +*note ANY: 19cb. can also be used in comparisons with call lists like +*note mock_calls: 40d0.: + + >>> m = MagicMock(return_value=None) + >>> m(1) + >>> m(1, 2) + >>> m(object()) + >>> m.mock_calls == [call(1), call(1, 2), ANY] + True + +*note ANY: 19cb. 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: Helpers + +5.27.6.27 FILTER_DIR +.................... + + -- Data: unittest.mock.FILTER_DIR + +*note FILTER_DIR: 40d4. is a module level variable that controls the way +mock objects respond to *note dir(): 62e. The default is ‘True’, which +uses the filtering described below, to only show useful members. If you +dislike this filtering, or need to switch it off for diagnostic +purposes, then set ‘mock.FILTER_DIR = False’. + +With filtering on, ‘dir(some_mock)’ shows only useful attributes and +will include any dynamically created attributes that wouldn’t normally +be shown. If the mock was created with a 'spec' (or 'autospec' of +course) then all the attributes from the original are shown, even if +they haven’t been accessed yet: + + >>> 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', + ... + +Many of the not-very-useful (private to *note Mock: a4b. rather than the +thing being mocked) underscore and double underscore prefixed attributes +have been filtered from the result of calling *note dir(): 62e. on a +*note Mock: a4b. If you dislike this behaviour you can switch it off by +setting the module level switch *note FILTER_DIR: 40d4.: + + >>> 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: 40d4. + + +File: python.info, Node: mock_open, Next: Autospeccing, Prev: FILTER_DIR, Up: Helpers + +5.27.6.28 mock_open +................... + + -- Function: unittest.mock.mock_open (mock=None, read_data=None) + + A helper function to create a mock to replace the use of *note + open(): 517. It works for *note open(): 517. called directly or + used as a context manager. + + The 'mock' argument is the mock object to configure. If ‘None’ + (the default) then a *note MagicMock: e8a. will be created for you, + with the API limited to methods or attributes available on standard + file handles. + + 'read_data' is a string for the *note read(): e1b, *note + readline(): 131c, and *note readlines(): 2333. 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. + + Changed in version 3.4: Added *note readline(): 131c. and *note + readlines(): 2333. support. The mock of *note read(): e1b. changed + to consume 'read_data' rather than returning it on each call. + + Changed in version 3.5: 'read_data' is now reset on each call to + the 'mock'. + + Changed in version 3.8: Added *note __iter__(): 1cc1. to + implementation so that iteration (such as in for loops) correctly + consumes 'read_data'. + +Using *note open(): 517. as a context manager is a great way to ensure +your file handles are closed properly and is becoming common: + + with open('/some/path', 'w') as f: + f.write('something') + +The issue is that even if you mock out the call to *note open(): 517. it +is the 'returned object' that is used as a context manager (and has +*note __enter__(): 5c4. and *note __exit__(): 12f3. called). + +Mocking context managers with a *note MagicMock: e8a. is common enough +and fiddly enough that a helper function is useful. + + >>> 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') + +And for reading files: + + >>> 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: Autospeccing, Next: Sealing mocks, Prev: mock_open, Up: Helpers + +5.27.6.29 Autospeccing +...................... + +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: 534. if they are called incorrectly. + +Before I explain how auto-speccing works, here’s why it is needed. + +*note Mock: a4b. 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. + +Changed in version 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. + +Note that this is another reason why you need integration tests as well +as unit tests. Testing everything in isolation is all fine and dandy, +but if you don’t test how your units are “wired together” there is still +lots of room for bugs that tests might have caught. + +*note unittest.mock: 107. 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' + +The spec only applies to the mock itself, so we still have the same +issue with any methods on the mock: + + >>> mock.header_items() + <mock.Mock object at 0x...> + >>> mock.header_items.assret_called_with() # Intentional typo! + +Auto-speccing solves this problem. You can either pass ‘autospec=True’ +to *note patch(): e8b. / *note patch.object(): 1598. or use the *note +create_autospec(): 1608. function to create a mock with a spec. If you +use the ‘autospec=True’ argument to *note patch(): e8b. then the object +that is being replaced will be used as the spec object. Because the +speccing is done “lazily” (the spec is created as attributes on the mock +are accessed) you can use it with very complex or deeply nested objects +(like modules that import modules that import modules) without a big +performance hit. + +Here’s an example of it in use: + + >>> 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) + +The spec also applies to instantiated classes (i.e. the return value of +specced mocks): + + >>> 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') + +In many cases you will just be able to add ‘autospec=True’ to your +existing *note patch(): e8b. calls and then be protected against bugs +due to typos and api changes. + +As well as using 'autospec' through *note patch(): e8b. there is a *note +create_autospec(): 1608. for creating autospecced mocks directly: + + >>> from urllib import request + >>> mock_request = create_autospec(request) + >>> mock_request.Request('foo', 'bar') + <NonCallableMagicMock name='mock.Request()' spec='Request' id='...'> + +This isn’t without caveats and limitations however, which is why it is +not the default behaviour. In order to know what attributes are +available on the spec object, autospec has to introspect (access +attributes) the spec. As you traverse attributes on the mock a +corresponding traversal of the original object is happening under the +hood. If any of your specced objects have properties or descriptors +that can trigger code execution then you may not be able to use +autospec. On the other hand it is much better to design your objects so +that introspection is safe (1). + +A more serious problem is that it is common for instance attributes to +be created in the *note __init__(): 6ac. 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' + +There are a few different ways of resolving this problem. The easiest, +but not necessarily the least annoying, way is to simply set the +required attributes on the mock after creation. Just because 'autospec' +doesn’t allow you to fetch attributes that don’t exist on the spec it +doesn’t prevent you setting them: + + >>> with patch('__main__.Something', autospec=True): + ... thing = Something() + ... thing.a = 33 + ... + +There is a more aggressive version of both 'spec' and 'autospec' that +'does' prevent you setting non-existent attributes. This is useful if +you want to ensure your code only 'sets' valid attributes too, but +obviously it prevents this particular scenario: + + >>> 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__(): +6ac. 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 + +This brings up another issue. It is relatively common to provide a +default value of ‘None’ for members that will later be an object of a +different type. ‘None’ would be useless as a spec because it wouldn’t +let you access 'any' attributes or methods on it. As ‘None’ is 'never' +going to be useful as a spec, and probably indicates a member that will +normally of some other type, autospec doesn’t use a spec for members +that are set to ‘None’. These will just be ordinary mocks (well - +MagicMocks): + + >>> class Something: + ... member = None + ... + >>> mock = create_autospec(Something) + >>> mock.member.foo.bar.baz() + <MagicMock name='mock.member.foo.bar.baz()' id='...'> + +If modifying your production classes to add defaults isn’t to your +liking then there are more options. One of these is simply to use an +instance as the spec rather than the class. The other is to create a +subclass of the production class and add the defaults to the subclass +without affecting the production class. Both of these require you to +use an alternative object as the spec. Thankfully *note patch(): e8b. +supports this - you can simply pass the alternative object as the +'autospec' argument: + + >>> 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) This only applies to classes or already instantiated objects. +Calling a mocked class to create a mock instance 'does not' create a +real instance. It is only attribute lookups - along with calls to *note +dir(): 62e. - that are done. + + +File: python.info, Node: Sealing mocks, Prev: Autospeccing, Up: Helpers + +5.27.6.30 Sealing mocks +....................... + + -- Function: 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: Helpers, Up: unittest mock — mock object library + +5.27.6.31 Order of precedence of ‘side_effect’, ‘return_value’ and 'wraps' +.......................................................................... + +The order of their precedence is: + + 1. *note side_effect: 40c4. + + 2. *note return_value: 40cc. + + 3. 'wraps' + +If all three are set, mock will return the value from *note side_effect: +40c4, ignoring *note return_value: 40cc. 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: 40c4, if you +reassign its value back to ‘None’, the order of precedence will be +checked between *note return_value: 40cc. and the wrapped object, +ignoring *note side_effect: 40c4. + + >>> order_mock.get_value.side_effect = None + >>> order_mock.get_value() + 'second' + +If the value being returned by *note side_effect: 40c4. is *note +DEFAULT: 40cb, 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: a4b. wraps an object, the default value of *note +return_value: 40cc. will be *note DEFAULT: 40cb. + + >>> 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: 40c4. 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 — getting started, Next: test — Regression tests package for Python, Prev: unittest mock — mock object library, Up: Development Tools + +5.27.7 ‘unittest.mock’ — getting started +---------------------------------------- + +Added in version 3.3. + +* Menu: + +* Using Mock:: +* Patch Decorators:: +* Further Examples:: + + +File: python.info, Node: Using Mock, Next: Patch Decorators, Up: unittest mock — getting started + +5.27.7.1 Using Mock +................... + +* Menu: + +* Mock Patching Methods:: +* Mock for Method Calls on an Object:: +* Mocking Classes:: +* Naming your mocks:: +* Tracking all Calls:: +* Setting Return Values and Attributes:: +* Raising exceptions with mocks:: +* Side effect functions and iterables:: +* Mocking asynchronous iterators:: +* Mocking asynchronous context manager:: +* 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: Using Mock + +5.27.7.2 Mock Patching Methods +.............................. + +Common uses for *note Mock: a4b. objects include: + + * Patching methods + + * Recording method calls on objects + +You might want to replace a method on an object to check that it is +called with the correct arguments by another part of the system: + + >>> real = SomeClass() + >>> real.method = MagicMock(name='method') + >>> real.method(3, 4, 5, key='value') + <MagicMock name='method()' id='...'> + +Once our mock has been used (‘real.method’ in this example) it has +methods and attributes that allow you to make assertions about how it +has been used. + + Note: In most of these examples the *note Mock: a4b. and *note + MagicMock: e8a. classes are interchangeable. As the ‘MagicMock’ is + the more capable class it makes a sensible one to use by default. + +Once the mock has been called its *note called: 40d6. attribute is set +to ‘True’. More importantly we can use the *note assert_called_with(): +1a20. or *note assert_called_once_with(): 40ce. method to check that it +was called with the correct arguments. + +This example tests that calling ‘ProductionClass().method’ results in a +call to the ‘something’ method: + + >>> 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: Using Mock + +5.27.7.3 Mock for Method Calls on an Object +........................................... + +In the last example we patched a method directly on an object to check +that it was called correctly. Another common use case is to pass an +object into a method (or some part of the system under test) and then +check that it is used in the correct way. + +The simple ‘ProductionClass’ below has a ‘closer’ method. If it is +called with an object then it calls ‘close’ on it. + + >>> class ProductionClass: + ... def closer(self, something): + ... something.close() + ... + +So to test it we need to pass in an object with a ‘close’ method and +check that it was called correctly. + + >>> real = ProductionClass() + >>> mock = Mock() + >>> real.closer(mock) + >>> mock.close.assert_called_with() + +We don’t have to do any work to provide the ‘close’ method on our mock. +Accessing close creates it. So, if ‘close’ hasn’t already been called +then accessing it in the test will create it, but *note +assert_called_with(): 1a20. will raise a failure exception. + + +File: python.info, Node: Mocking Classes, Next: Naming your mocks, Prev: Mock for Method Calls on an Object, Up: Using Mock + +5.27.7.4 Mocking Classes +........................ + +A common use case is to mock out classes instantiated by your code under +test. When you patch a class, then that class is replaced with a mock. +Instances are created by 'calling the class'. This means you access the +“mock instance” by looking at the return value of the mocked class. + +In the example below we have a function ‘some_function’ that +instantiates ‘Foo’ and calls a method on it. The call to *note patch(): +e8b. replaces the class ‘Foo’ with a mock. The ‘Foo’ instance is the +result of calling the mock, so it is configured by modifying the mock +*note return_value: 40cc. + + >>> 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: Naming your mocks, Next: Tracking all Calls, Prev: Mocking Classes, Up: Using Mock + +5.27.7.5 Naming your mocks +.......................... + +It can be useful to give your mocks a name. The name is shown in the +repr of the mock and can be helpful when the mock appears in test +failure messages. The name is also propagated to attributes or methods +of the mock: + + >>> 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: Naming your mocks, Up: Using Mock + +5.27.7.6 Tracking all Calls +........................... + +Often you want to track more than a single call to a method. The *note +mock_calls: 40d0. attribute records all calls to child attributes of the +mock - and also to their children. + + >>> 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)] + +If you make an assertion about ‘mock_calls’ and any unexpected methods +have been called, then the assertion will fail. This is useful because +as well as asserting that the calls you expected have been made, you are +also checking that they were made in the right order and with no +additional calls: + +You use the *note call: 19cd. object to construct lists for comparing +with ‘mock_calls’: + + >>> 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: Raising exceptions with mocks, Prev: Tracking all Calls, Up: Using Mock + +5.27.7.7 Setting Return Values and Attributes +............................................. + +Setting the return values on a mock object is trivially easy: + + >>> mock = Mock() + >>> mock.return_value = 3 + >>> mock() + 3 + +Of course you can do the same for methods on the mock: + + >>> mock = Mock() + >>> mock.method.return_value = 3 + >>> mock.method() + 3 + +The return value can also be set in the constructor: + + >>> mock = Mock(return_value=3) + >>> mock() + 3 + +If you need an attribute setting on your mock, just do it: + + >>> mock = Mock() + >>> mock.x = 3 + >>> mock.x + 3 + +Sometimes you want to mock up a more complex situation, like for example +‘mock.connection.cursor().execute("SELECT 1")’. If we wanted this call +to return a list, then we have to configure the result of the nested +call. + +We can use *note call: 19cd. to construct the set of calls in a “chained +call” like this for easy assertion afterwards: + + >>> 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 + +It is the call to ‘.call_list()’ that turns our call object into a list +of calls representing the chained calls. + + +File: python.info, Node: Raising exceptions with mocks, Next: Side effect functions and iterables, Prev: Setting Return Values and Attributes, Up: Using Mock + +5.27.7.8 Raising exceptions with mocks +...................................... + +A useful attribute is *note side_effect: 40c4. If you set this to an +exception class or instance then the exception will be raised when the +mock is called. + + >>> mock = Mock(side_effect=Exception('Boom!')) + >>> mock() + Traceback (most recent call last): + ... + Exception: Boom! + + +File: python.info, Node: Side effect functions and iterables, Next: Mocking asynchronous iterators, Prev: Raising exceptions with mocks, Up: Using Mock + +5.27.7.9 Side effect functions and iterables +............................................ + +‘side_effect’ can also be set to a function or an iterable. The use +case for ‘side_effect’ as an iterable is where your mock is going to be +called several times, and you want each call to return a different +value. When you set ‘side_effect’ to an iterable every call to the mock +returns the next value from the iterable: + + >>> mock = MagicMock(side_effect=[4, 5, 6]) + >>> mock() + 4 + >>> mock() + 5 + >>> mock() + 6 + +For more advanced use cases, like dynamically varying the return values +depending on what the mock is called with, ‘side_effect’ can be a +function. The function will be called with the same arguments as the +mock. Whatever the function returns is what the call returns: + + >>> 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: Mocking asynchronous iterators, Next: Mocking asynchronous context manager, Prev: Side effect functions and iterables, Up: Using Mock + +5.27.7.10 Mocking asynchronous iterators +........................................ + +Since Python 3.8, ‘AsyncMock’ and ‘MagicMock’ have support to mock *note +Asynchronous Iterators: d79. through ‘__aiter__’. The *note +return_value: 40cc. attribute of ‘__aiter__’ can be used to set the +return values to be used for iteration. + + >>> 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: Mocking asynchronous context manager, Next: Creating a Mock from an Existing Object, Prev: Mocking asynchronous iterators, Up: Using Mock + +5.27.7.11 Mocking asynchronous context manager +.............................................. + +Since Python 3.8, ‘AsyncMock’ and ‘MagicMock’ have support to mock *note +Asynchronous Context Managers: 5f8. through ‘__aenter__’ and +‘__aexit__’. By default, ‘__aenter__’ and ‘__aexit__’ are ‘AsyncMock’ +instances that return an async function. + + >>> 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: Mocking asynchronous context manager, Up: Using Mock + +5.27.7.12 Creating a Mock from an Existing Object +................................................. + +One problem with over use of mocking is that it couples your tests to +the implementation of your mocks rather than your real code. Suppose +you have a class that implements ‘some_method’. In a test for another +class, you provide a mock of this object that 'also' provides +‘some_method’. If later you refactor the first class, so that it no +longer has ‘some_method’ - then your tests will continue to pass even +though your code is now broken! + +*note Mock: a4b. allows you to provide an object as a specification for +the mock, using the 'spec' keyword argument. Accessing methods / +attributes on the mock that don’t exist on your specification object +will immediately raise an attribute error. If you change the +implementation of your specification, then tests that use that class +will start failing immediately without you having to instantiate the +class in those tests. + + >>> 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'? + +Using a specification also enables a smarter matching of calls made to +the mock, regardless of whether some parameters were passed as +positional or named arguments: + + >>> 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) + +If you want this smarter matching to also work with method calls on the +mock, you can use *note auto-speccing: 40c7. + +If you want a stronger form of specification that prevents the setting +of arbitrary attributes as well as the getting of them then you can use +'spec_set' instead of 'spec'. + + +File: python.info, Node: Using side_effect to return per file content, Prev: Creating a Mock from an Existing Object, Up: Using Mock + +5.27.7.13 Using side_effect to return per file content +...................................................... + +*note mock_open(): 1709. is used to patch *note open(): 517. method. +*note side_effect: 40c4. 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: Using Mock, Up: unittest mock — getting started + +5.27.7.14 Patch Decorators +.......................... + + Note: With *note patch(): e8b. it matters that you patch objects in + the namespace where they are looked up. This is normally + straightforward, but for a quick guide read *note where to patch: + 40c5. + +A common need in tests is to patch a class attribute or a module +attribute, for example patching a builtin or patching a class in a +module to test that it is instantiated. Modules and classes are +effectively global, so patching on them has to be undone after the test +or the patch will persist into other tests and cause hard to diagnose +problems. + +mock provides three convenient decorators for this: *note patch(): e8b, +*note patch.object(): 1598. and *note patch.dict(): 19f2. ‘patch’ takes +a single string, of the form ‘package.module.Class.attribute’ to specify +the attribute you are patching. It also optionally takes a value that +you want the attribute (or class or whatever) to be replaced with. +‘patch.object’ takes an object and the name of the attribute you would +like patched, plus optionally the value to patch it with. + +‘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() + +If you are patching a module (including *note builtins: 12.) then use +*note patch(): e8b. instead of *note patch.object(): 1598.: + + >>> 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" + +The module name can be ‘dotted’, in the form ‘package.module’ if needed: + + >>> @patch('package.module.ClassName.attribute', sentinel.attribute) + ... def test(): + ... from package.module import ClassName + ... assert ClassName.attribute == sentinel.attribute + ... + >>> test() + +A nice pattern is to actually decorate test methods themselves: + + >>> 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 + +If you want to patch with a Mock, you can use *note patch(): e8b. with +only one argument (or *note patch.object(): 1598. with two arguments). +The mock will be created for you and passed into the test function / +method: + + >>> 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() + +You can stack up multiple patch decorators using this pattern: + + >>> 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() + +When you nest patch decorators the mocks are passed in to the decorated +function in the same order they applied (the normal 'Python' order that +decorators are applied). This means from the bottom up, so in the +example above the mock for ‘test_module.ClassName2’ is passed in first. + +There is also *note patch.dict(): 19f2. for setting values in a +dictionary just during a scope and restoring the dictionary to its +original state when the test ends: + + >>> foo = {'key': 'value'} + >>> original = foo.copy() + >>> with patch.dict(foo, {'newkey': 'newvalue'}, clear=True): + ... assert foo == {'newkey': 'newvalue'} + ... + >>> assert foo == original + +‘patch’, ‘patch.object’ and ‘patch.dict’ can all be used as context +managers. + +Where you use *note patch(): e8b. to create a mock for you, you can get +a reference to the mock using the “as” form of the with statement: + + >>> 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) + +As an alternative ‘patch’, ‘patch.object’ and ‘patch.dict’ can be used +as class decorators. When used in this way it is the same as applying +the decorator individually to every method whose name starts with +“test”. + + +File: python.info, Node: Further Examples, Prev: Patch Decorators, Up: unittest mock — getting started + +5.27.7.15 Further Examples +.......................... + +Here are some more examples for some slightly more advanced scenarios. + +* Menu: + +* Mocking chained calls:: +* Partial mocking:: +* Mocking a Generator Method:: +* Applying the same patch to every test method:: +* Mocking Unbound Methods:: +* Checking multiple calls with mock:: +* Coping with mutable arguments:: +* Nesting Patches:: +* Mocking a dictionary with MagicMock:: +* Mock subclasses and their attributes:: +* Mocking imports with patch.dict: Mocking imports with patch dict. +* Tracking order of calls and less verbose call assertions:: +* More complex argument matching:: + + +File: python.info, Node: Mocking chained calls, Next: Partial mocking, Up: Further Examples + +5.27.7.16 Mocking chained calls +............................... + +Mocking chained calls is actually straightforward with mock once you +understand the *note return_value: 40cc. attribute. When a mock is +called for the first time, or you fetch its ‘return_value’ before it has +been called, a new *note Mock: a4b. is created. + +This means that you can see how the object returned from a call to a +mocked object has been used by interrogating the ‘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) + +From here it is a simple step to configure and then make assertions +about chained calls. Of course another alternative is writing your code +in a more testable way in the first place… + +So, suppose we have some code that looks a little bit like this: + + >>> 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 + +Assuming that ‘BackendProvider’ is already well tested, how do we test +‘method()’? Specifically, we want to test that the code section ‘# more +code’ uses the response object in the correct way. + +As this chain of calls is made from an instance attribute we can monkey +patch the ‘backend’ attribute on a ‘Something’ instance. In this +particular case we are only interested in the return value from the +final call to ‘start_call’ so we don’t have much configuration to do. +Let’s assume the object it returns is ‘file-like’, so we’ll ensure that +our response object uses the builtin *note open(): 517. as its ‘spec’. + +To do this we create a mock instance as our mock backend and create a +mock response object for it. To set the response as the return value +for that final ‘start_call’ we could do this: + + mock_backend.get_endpoint.return_value.create_call.return_value.start_call.return_value = mock_response + +We can do that in a slightly nicer way using the *note configure_mock(): +40cd. method to directly set the return value for us: + + >>> 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) + +With these we monkey patch the “mock backend” in place and can make the +real call: + + >>> something.backend = mock_backend + >>> something.method() + +Using *note mock_calls: 40d0. we can check the chained call with a +single assert. A chained call is several calls in one line of code, so +there will be several entries in ‘mock_calls’. We can use *note +call.call_list(): 4107. to create this list of calls for us: + + >>> 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: Partial mocking, Next: Mocking a Generator Method, Prev: Mocking chained calls, Up: Further Examples + +5.27.7.17 Partial mocking +......................... + +In some tests I wanted to mock out a call to *note +datetime.date.today(): 1495. to return a known date, but I didn’t want +to prevent the code under test from creating new date objects. +Unfortunately *note datetime.date: 1cd. is written in C, and so I +couldn’t just monkey-patch out the static *note datetime.date.today(): +1495. method. + +I found a simple way of doing this that involved effectively wrapping +the date class with a mock, but passing through calls to the constructor +to the real class (and returning real instances). + +The *note patch decorator: e8b. is used here to mock out the ‘date’ +class in the module under test. The *note side_effect: 40c4. attribute +on the mock date class is then set to a lambda function that returns a +real date. When the mock date class is called a real date will be +constructed and returned by ‘side_effect’. + + >>> from datetime import date + >>> with patch('mymodule.date') as mock_date: + ... mock_date.today.return_value = date(2010, 10, 8) + ... mock_date.side_effect = lambda *args, **kw: date(*args, **kw) + ... + ... assert mymodule.date.today() == date(2010, 10, 8) + ... assert mymodule.date(2009, 6, 8) == date(2009, 6, 8) + +Note that we don’t patch *note datetime.date: 1cd. globally, we patch +‘date’ in the module that 'uses' it. See *note where to patch: 40c5. + +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. + +Calls to the date constructor are recorded in the ‘mock_date’ attributes +(‘call_count’ and friends) which may also be useful for your tests. + +An alternative way of dealing with mocking dates, or other builtin +classes, is discussed in this blog entry(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: Applying the same patch to every test method, Prev: Partial mocking, Up: Further Examples + +5.27.7.18 Mocking a Generator Method +.................................... + +A Python generator is a function or method that uses the *note yield: +9cd. statement to return a series of values when iterated over (1). + +A generator method / function is called to return the generator object. +It is the generator object that is then iterated over. The protocol +method for iteration is *note __iter__(): 1cc1, so we can mock this +using a *note MagicMock: e8a. + +Here’s an example class with an “iter” method implemented as a +generator: + + >>> class Foo: + ... def iter(self): + ... for i in [1, 2, 3]: + ... yield i + ... + >>> foo = Foo() + >>> list(foo.iter()) + [1, 2, 3] + +How would we mock this class, and in particular its “iter” method? + +To configure the values returned from the iteration (implicit in the +call to *note list: 60d.), we need to configure the object returned by +the call to ‘foo.iter()’. + + >>> mock_foo = MagicMock() + >>> mock_foo.iter.return_value = iter([1, 2, 3]) + >>> list(mock_foo.iter()) + [1, 2, 3] + + ---------- Footnotes ---------- + + (1) There are also generator expressions and more advanced uses +(http://www.dabeaz.com/coroutines/index.html) of generators, but we +aren’t concerned about them here. A very good introduction to +generators and how powerful they are is: Generator Tricks for Systems +Programmers (http://www.dabeaz.com/generators/). + + +File: python.info, Node: Applying the same patch to every test method, Next: Mocking Unbound Methods, Prev: Mocking a Generator Method, Up: Further Examples + +5.27.7.19 Applying the same patch to every test method +...................................................... + +If you want several patches in place for multiple test methods the +obvious way is to apply the patch decorators to every method. This can +feel like unnecessary repetition. Instead, you can use *note patch(): +e8b. (in all its various forms) as a class decorator. This applies the +patches to all test methods on the class. A test method is identified +by methods whose names start with ‘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' + +An alternative way of managing patches is to use the *note patch +methods; start and stop: 40f8. These allow you to move the patching +into your ‘setUp’ and ‘tearDown’ methods. + + >>> 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() + +If you use this technique you must ensure that the patching is “undone” +by calling ‘stop’. This can be fiddlier than you might think, because +if an exception is raised in the setUp then tearDown is not called. +*note unittest.TestCase.addCleanup(): a81. makes this easier: + + >>> 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: Checking multiple calls with mock, Prev: Applying the same patch to every test method, Up: Further Examples + +5.27.7.20 Mocking Unbound Methods +................................. + +Whilst writing tests today I needed to patch an 'unbound method' +(patching the method on the class rather than on the instance). I +needed self to be passed in as the first argument because I want to make +asserts about which objects were calling this particular method. 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(): e8b. 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 I wanted: + + >>> 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) + +If we don’t use ‘autospec=True’ then the unbound method is patched out +with a Mock instance instead, and isn’t called with ‘self’. + + +File: python.info, Node: Checking multiple calls with mock, Next: Coping with mutable arguments, Prev: Mocking Unbound Methods, Up: Further Examples + +5.27.7.21 Checking multiple calls with mock +........................................... + +mock has a nice API for making assertions about how your mock objects +are used. + + >>> 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(): 40ce. method that also asserts that the *note +call_count: 40d7. 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: 40d8.: + + >>> 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()] + +The *note call: 19cd. helper makes it easy to make assertions about +these calls. You can build up a list of expected calls and compare it +to ‘call_args_list’. This looks remarkably similar to the repr of the +‘call_args_list’: + + >>> expected = [call(1, 2, 3), call(4, 5, 6), call()] + >>> mock.call_args_list == expected + True + + +File: python.info, Node: Coping with mutable arguments, Next: Nesting Patches, Prev: Checking multiple calls with mock, Up: Further Examples + +5.27.7.22 Coping with mutable arguments +....................................... + +Another situation is rare, but can bite you, is when your mock is called +with mutable arguments. ‘call_args’ and ‘call_args_list’ store +'references' to the arguments. If the arguments are mutated by the code +under test then you can no longer make assertions about what the values +were when the mock was called. + +Here’s some example code that shows the problem. Imagine the following +functions defined in ‘mymodule’: + + def frob(val): + pass + + def grob(val): + "First frob and then clear val" + frob(val) + val.clear() + +When we try to test that ‘grob’ calls ‘frob’ with the correct argument +look what happens: + + >>> 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(),), {}) + +One possibility would be for mock to copy the arguments you pass in. +This could then cause problems if you do assertions that rely on object +identity for equality. + +Here’s one solution that uses the *note side_effect: 40c4. +functionality. If you provide a ‘side_effect’ function for a mock then +‘side_effect’ will be called with the same args as the mock. This gives +us an opportunity to copy the arguments and store them for later +assertions. In this example I’m using 'another' mock to store the +arguments so that I can use the mock methods for doing the assertion. +Again a helper function sets this up for me. + + >>> from copy import deepcopy + >>> from unittest.mock import Mock, patch, DEFAULT + >>> def copy_call_args(mock): + ... new_mock = Mock() + ... def side_effect(*args, **kwargs): + ... args = deepcopy(args) + ... kwargs = deepcopy(kwargs) + ... new_mock(*args, **kwargs) + ... return DEFAULT + ... mock.side_effect = side_effect + ... return new_mock + ... + >>> with patch('mymodule.frob') as mock_frob: + ... new_mock = copy_call_args(mock_frob) + ... val = {6} + ... mymodule.grob(val) + ... + >>> new_mock.assert_called_with({6}) + >>> new_mock.call_args + call({6}) + +‘copy_call_args’ is called with the mock that will be called. It +returns a new mock that we do the assertion on. The ‘side_effect’ +function makes a copy of the args and calls our ‘new_mock’ with the +copy. + + Note: If your mock is only going to be used once there is an easier + way of checking arguments at the point they are called. You can + simply do the checking inside a ‘side_effect’ function. + + >>> def side_effect(arg): + ... assert arg == {6} + ... + >>> mock = Mock(side_effect=side_effect) + >>> mock({6}) + >>> mock(set()) + Traceback (most recent call last): + ... + AssertionError + +An alternative approach is to create a subclass of *note Mock: a4b. or +*note MagicMock: e8a. that copies (using *note copy.deepcopy(): b6e.) +the arguments. Here’s an example implementation: + + >>> 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: Mocking a dictionary with MagicMock, Prev: Coping with mutable arguments, 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 methods; start and +stop: 40f8. 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: Mocking a dictionary with MagicMock, Next: Mock subclasses and their attributes, Prev: Nesting Patches, Up: Further Examples + +5.27.7.24 Mocking a dictionary with 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: e8a, which will behave like a +dictionary, and using *note side_effect: 40c4. to delegate dictionary +access to a real underlying dictionary that is under our control. + +When the *note __getitem__(): 285. and *note __setitem__(): 12be. +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: 40d8. 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 + + Note: 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: 33f. 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 subclasses and their attributes, Next: Mocking imports with patch dict, Prev: Mocking a dictionary with MagicMock, Up: Further Examples + +5.27.7.25 Mock subclasses and their attributes +.............................................. + +There are various reasons why you might want to subclass *note Mock: +a4b. 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: Mocking imports with patch dict, Next: Tracking order of calls and less verbose call assertions, Prev: Mock subclasses and their attributes, Up: Further Examples + +5.27.7.26 Mocking imports with patch.dict +......................................... + +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: 1550. +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(): 19f2. to 'temporarily' put a +mock in place in *note sys.modules: 1550. 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: 1550. + +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: Mocking imports with patch dict, Up: Further Examples + +5.27.7.27 Tracking order of calls and less verbose call assertions +.................................................................. + +The *note Mock: a4b. class allows you to track the 'order' of method +calls on your mock objects through the *note method_calls: 40d2. +attribute. This doesn’t allow you to track the order of calls between +separate mock objects, however we can use *note mock_calls: 40d0. 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(): 160f. +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(): 16a8. method. This takes a list of calls +(constructed with the *note call: 19cd. object). If that sequence of +calls are in *note mock_calls: 40d0. 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: 19cb. 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(): 1a20. 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) + ... + +Putting all this together: + + >>> 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: 6a5. 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: 6a5. 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 — getting started, Up: Development Tools + +5.27.8 ‘test’ — Regression tests package for Python +--------------------------------------------------- + + Note: The *note test: e2. 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 *note test: e2. package contains all regression tests for Python as +well as the modules *note test.support: e4. and *note test.regrtest: e3. +*note test.support: e4. is used to enhance your tests while *note +test.regrtest: e3. drives the testing suite. + +Each module in the *note test: e2. 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: 106. or *note doctest: +3a. 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. + +See also +........ + +Module *note unittest: 106. + + Writing PyUnit regression tests. + +Module *note doctest: 3a. + + Tests embedded in documentation strings. + +* Menu: + +* Writing Unit Tests for the test package:: +* Running tests using the command-line interface:: + + +File: python.info, Node: Writing Unit Tests for the test package, Next: Running tests using the command-line interface, Up: test — Regression tests package for Python + +5.27.8.1 Writing Unit Tests for the ‘test’ package +.................................................. + +It is preferred that tests that use the *note unittest: 106. module +follow a few guidelines. One is to name the test module by starting it +with ‘test_’ and end it with the name of the module being tested. The +test methods in the test module should start with ‘test_’ and end with a +description of what the method is testing. This is needed so that the +methods are recognized by the test driver as test methods. Also, no +documentation string for the method should be included. A comment (such +as ‘# Tests function returns only True or False’) should be used to +provide documentation for test methods. This is done because +documentation strings get printed out if they exist and thus what test +is being run is not stated. + +A basic boilerplate is often used: + + 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() + +This code pattern allows the testing suite to be run by *note +test.regrtest: e3, on its own as a script that supports the *note +unittest: 106. CLI, or via the ‘python -m unittest’ CLI. + +The goal for regression testing is to try to break code. This leads to +a few guidelines to be followed: + + * The testing suite should exercise all classes, functions, and + constants. This includes not just the external API that is to be + presented to the outside world but also “private” code. + + * Whitebox testing (examining the code being tested when the tests + are being written) is preferred. Blackbox testing (testing only + the published user interface) is not complete enough to make sure + all boundary and edge cases are tested. + + * Make sure all possible values are tested including invalid ones. + This makes sure that not only all valid values are acceptable but + also that improper values are handled correctly. + + * Exhaust as many code paths as possible. Test where branching + occurs and thus tailor input to make sure as many different paths + through the code are taken. + + * Add an explicit test for any bugs discovered for the tested code. + This will make sure that the error does not crop up again if the + code is changed in the future. + + * Make sure to clean up after your tests (such as close and remove + all temporary files). + + * If a test is dependent on a specific condition of the operating + system then verify the condition already exists before attempting + the test. + + * Import as few modules as possible and do it as soon as possible. + This minimizes external dependencies of tests and also minimizes + possible anomalous behavior from side-effects of importing a + module. + + * Try to maximize code reuse. On occasion, tests will vary by + something as small as what type of input is used. Minimize code + duplication by subclassing a basic test class with a class that + specifies the input: + + 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: 449. are run as tests. The + ‘TestFuncAcceptsSequencesMixin’ class in the example above does not + have any data and so can’t be run by itself, thus it does not + inherit from *note unittest.TestCase: 449. + +See also +........ + +Test Driven Development + + A book by Kent Beck on writing tests before code. + + +File: python.info, Node: Running tests using the command-line interface, Prev: Writing Unit Tests for the test package, Up: test — Regression tests package for Python + +5.27.8.2 Running tests using the command-line interface +....................................................... + +The *note test: e2. package can be run as a script to drive Python’s +regression test suite, thanks to the *note -m: 5dd. option: ‘python -m +test’. Under the hood, it uses *note test.regrtest: e3.; 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 *note test: e2. 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 *note test: e2. 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 *note test: e2. 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’. + +Some other ways to execute the regression tests depend on what platform +the tests are being executed on. On Unix, you can run ‘make test’ at +the top-level directory where Python was built. On Windows, executing +‘rt.bat’ from your ‘PCbuild’ directory will run all regression tests. + + +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: Development Tools + +5.27.9 ‘test.support’ — Utilities for the Python test suite +----------------------------------------------------------- + +The *note test.support: e4. module provides support for Python’s +regression test suite. + + Note: *note test.support: e4. 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. + +This module defines the following exceptions: + + -- Exception: test.support.TestFailed + + Exception to be raised when a test fails. This is deprecated in + favor of *note unittest: 106.-based tests and *note + unittest.TestCase: 449.’s assertion methods. + + -- Exception: test.support.ResourceDenied + + Subclass of *note unittest.SkipTest: fdf. Raised when a resource + (such as a network connection) is not available. Raised by the + *note requires(): 4137. function. + +The *note test.support: e4. module defines the following constants: + + -- Data: test.support.verbose + + ‘True’ when verbose output is enabled. Should be checked when more + detailed information is desired about a running test. 'verbose' is + set by *note test.regrtest: e3. + + -- Data: test.support.is_jython + + ‘True’ if the running interpreter is Jython. + + -- Data: test.support.is_android + + ‘True’ if the system is Android. + + -- Data: test.support.unix_shell + + Path for shell if not on Windows; otherwise ‘None’. + + -- Data: 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(): da2, *note + recv(): da3. and *note send(): da6. methods of *note socket.socket: + da0. + + Its default value is 5 seconds. + + See also *note INTERNET_TIMEOUT: 19b4. + + -- Data: 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: 19b4. should not + mark a test as failed, but skip the test instead: see *note + transient_internet(): 413c. + + Its default value is 1 minute. + + See also *note LOOPBACK_TIMEOUT: 19b3. + + -- Data: test.support.SHORT_TIMEOUT + + Timeout in seconds to mark a test as failed if the test takes “too + long”. + + The timeout value depends on the regrtest ‘--timeout’ command line + option. + + If a test using *note SHORT_TIMEOUT: 18ae. starts to fail randomly + on slow buildbots, use *note LONG_TIMEOUT: 19b5. instead. + + Its default value is 30 seconds. + + -- Data: 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. + + Its default value is 5 minutes. + + See also *note LOOPBACK_TIMEOUT: 19b3, *note INTERNET_TIMEOUT: + 19b4. and *note SHORT_TIMEOUT: 18ae. + + -- Data: test.support.PGO + + Set when tests can be skipped when they are not useful for PGO. + + -- Data: test.support.PIPE_MAX_SIZE + + A constant that is likely larger than the underlying OS pipe buffer + size, to make writes blocking. + + -- Data: test.support.Py_DEBUG + + ‘True’ if Python was built with the *note Py_DEBUG: 4140. macro + defined, that is, if Python was *note built in debug mode: 1fb. + + Added in version 3.12. + + -- Data: test.support.SOCK_MAX_SIZE + + A constant that is likely larger than the underlying OS socket + buffer size, to make writes blocking. + + -- Data: test.support.TEST_SUPPORT_DIR + + Set to the top level directory that contains *note test.support: + e4. + + -- Data: test.support.TEST_HOME_DIR + + Set to the top level directory for the test package. + + -- Data: test.support.TEST_DATA_DIR + + Set to the ‘data’ directory within the test package. + + -- Data: test.support.MAX_Py_ssize_t + + Set to *note sys.maxsize: 11b7. for big memory tests. + + -- Data: test.support.max_memuse + + Set by *note set_memlimit(): 4147. as the memory limit for big + memory tests. Limited by *note MAX_Py_ssize_t: 4145. + + -- Data: test.support.real_max_memuse + + Set by *note set_memlimit(): 4147. as the memory limit for big + memory tests. Not limited by *note MAX_Py_ssize_t: 4145. + + -- Data: 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: 1db1. option. + + See also the *note HAVE_DOCSTRINGS: 414a. variable. + + -- Data: test.support.HAVE_DOCSTRINGS + + Set to ‘True’ if function docstrings are available. See the *note + python -OO: db4. option, which strips docstrings of functions + implemented in Python. + + See also the *note MISSING_C_DOCSTRINGS: 4149. variable. + + -- Data: test.support.TEST_HTTP_URL + + Define the URL of a dedicated HTTP server for the network tests. + + -- Data: test.support.ALWAYS_EQ + + Object that is equal to anything. Used to test mixed type + comparison. + + -- Data: test.support.NEVER_EQ + + Object that is not equal to anything (even to *note ALWAYS_EQ: + 414c.). Used to test mixed type comparison. + + -- Data: test.support.LARGEST + + Object that is greater than anything (except itself). Used to test + mixed type comparison. + + -- Data: test.support.SMALLEST + + Object that is less than anything (except itself). Used to test + mixed type comparison. + +The *note test.support: e4. module defines the following functions: + + -- Function: 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: 6a5. if + 'error' is true, or just stop the loop if 'error' is false. + + Example: + + 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') + + -- Function: 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(): 4150. 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') + + -- Function: test.support.is_resource_enabled (resource) + + Return ‘True’ if 'resource' is enabled and available. The list of + available resources is only set when *note test.regrtest: e3. is + executing the tests. + + -- Function: test.support.python_is_optimized () + + Return ‘True’ if Python was not built with ‘-O0’ or ‘-Og’. + + -- Function: test.support.with_pymalloc () + + Return ‘_testcapi.WITH_PYMALLOC’. + + -- Function: test.support.requires (resource, msg=None) + + Raise *note ResourceDenied: 4136. if 'resource' is not available. + 'msg' is the argument to *note ResourceDenied: 4136. if it is + raised. Always returns ‘True’ if called by a function whose + ‘__name__’ is ‘'__main__'’. Used when tests are executed by *note + test.regrtest: e3. + + -- Function: test.support.sortdict (dict) + + Return a repr of 'dict' with keys sorted. + + -- Function: test.support.findfile (filename, subdir=None) + + Return the path to the file named 'filename'. If no match is found + 'filename' is returned. This does not equal a failure since it + could be the path to the file. + + Setting 'subdir' indicates a relative path to use to find the file + rather than looking directly in the path directories. + + -- Function: test.support.get_pagesize () + + Get size of a page in bytes. + + Added in version 3.12. + + -- Function: test.support.setswitchinterval (interval) + + Set the *note sys.setswitchinterval(): 94a. to the given + 'interval'. Defines a minimum interval for Android systems to + prevent the system from hanging. + + -- Function: 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. + + -- Function: test.support.set_memlimit (limit) + + Set the values for *note max_memuse: 4146. and *note + real_max_memuse: 4148. for big memory tests. + + -- Function: test.support.record_original_stdout (stdout) + + Store the value from 'stdout'. It is meant to hold the stdout at + the time the regrtest began. + + -- Function: test.support.get_original_stdout () + + Return the original stdout set by *note record_original_stdout(): + 415a. or ‘sys.stdout’ if it’s not set. + + -- Function: test.support.args_from_interpreter_flags () + + Return a list of command line arguments reproducing the current + settings in ‘sys.flags’ and ‘sys.warnoptions’. + + -- Function: test.support.optim_args_from_interpreter_flags () + + Return a list of command line arguments reproducing the current + optimization settings in ‘sys.flags’. + + -- Function: test.support.captured_stdin () + -- Function: test.support.captured_stdout () + -- Function: test.support.captured_stderr () + + A context managers that temporarily replaces the named stream with + *note io.StringIO: f22. object. + + Example use with output streams: + + 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" + + Example use with input stream: + + 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") + + -- Function: test.support.disable_faulthandler () + + A context manager that temporary disables *note faulthandler: 58. + + -- Function: 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. + + -- Function: 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. + + -- Function: test.support.swap_attr (obj, attr, new_val) + + Context manager to swap out an attribute with a new object. + + Usage: + + 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. + + -- Function: test.support.swap_item (obj, attr, new_val) + + Context manager to swap out an item with a new object. + + Usage: + + 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. + + -- Function: test.support.flush_std_streams () + + Call the ‘flush()’ method on *note sys.stdout: ad6. and then on + *note sys.stderr: 939. It can be used to make sure that the logs + order is consistent before writing into stderr. + + Added in version 3.11. + + -- Function: test.support.print_warning (msg) + + Print a warning into *note sys.__stderr__: 4167. 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. + + -- Function: 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: 6a5. if the process exit code is not + equal to 'exitcode'. + + If the process runs longer than 'timeout' seconds (*note + SHORT_TIMEOUT: 18ae. by default), kill the process and raise an + *note AssertionError: 6a5. The timeout feature is not available on + Windows. + + Added in version 3.9. + + -- Function: test.support.calcobjsize (fmt) + + Return the size of the *note PyObject: 334. whose structure members + are defined by 'fmt'. The returned value includes the size of the + Python object header and alignment. + + -- Function: test.support.calcvobjsize (fmt) + + Return the size of the *note PyVarObject: 416a. whose structure + members are defined by 'fmt'. The returned value includes the size + of the Python object header and alignment. + + -- Function: test.support.checksizeof (test, o, size) + + For testcase 'test', assert that the ‘sys.getsizeof’ for 'o' plus + the GC header size equals 'size'. + + -- Function: @test.support.anticipate_failure (condition) + + A decorator to conditionally mark tests with *note + unittest.expectedFailure(): 4083. Any use of this decorator should + have an associated comment identifying the relevant tracker issue. + + -- Function: test.support.system_must_validate_cert (f) + + A decorator that skips the decorated test on TLS certification + validation failures. + + -- Function: @test.support.run_with_locale (catstr, *locales) + + A decorator for running a function in a different locale, correctly + resetting it after it has finished. 'catstr' is the locale + category as a string (for example ‘"LC_ALL"’). The 'locales' + passed will be tried sequentially, and the first valid locale will + be used. + + -- Function: @test.support.run_with_tz (tz) + + A decorator for running a function in a specific timezone, + correctly resetting it after it has finished. + + -- Function: @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. + + -- Function: @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. + + -- Function: @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. + + -- Function: @test.support.requires_gil_enabled + + Decorator for skipping tests on the free-threaded build. If the + *note GIL: 159. is disabled, the test is skipped. + + -- Function: @test.support.requires_IEEE_754 + + Decorator for skipping tests on non-IEEE 754 platforms. + + -- Function: @test.support.requires_zlib + + Decorator for skipping tests if *note zlib: 133. doesn’t exist. + + -- Function: @test.support.requires_gzip + + Decorator for skipping tests if *note gzip: 67. doesn’t exist. + + -- Function: @test.support.requires_bz2 + + Decorator for skipping tests if *note bz2: 13. doesn’t exist. + + -- Function: @test.support.requires_lzma + + Decorator for skipping tests if *note lzma: 8a. doesn’t exist. + + -- Function: @test.support.requires_resource (resource) + + Decorator for skipping tests if 'resource' is not available. + + -- Function: @test.support.requires_docstrings + + Decorator for only running the test if *note HAVE_DOCSTRINGS: 414a. + + -- Function: @test.support.requires_limited_api + + Decorator for only running the test if *note Limited C API: 391. is + available. + + -- Function: @test.support.cpython_only + + Decorator for tests only applicable to CPython. + + -- Function: @test.support.impl_detail (msg=None, **guards) + + Decorator for invoking *note check_impl_detail(): 4159. on + 'guards'. If that returns ‘False’, then uses 'msg' as the reason + for skipping the test. + + -- Function: @test.support.no_tracing + + Decorator to temporarily turn off tracing for the duration of the + test. + + -- Function: @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. + + -- 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. + + -- Function: @test.support.bigaddrspacetest + + Decorator for tests that fill the address space. + + -- Function: 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: 106. instance for + the test. 'errtext' is the regular expression which should match + the string representation of the raised *note SyntaxError: 18d. If + 'lineno' is not ‘None’, compares to the line of the exception. If + 'offset' is not ‘None’, compares to the offset of the exception. + + -- Function: test.support.open_urlresource (url, *args, **kw) + + Open 'url'. If open fails, raises *note TestFailed: 4135. + + -- Function: 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. + + -- Function: test.support.get_attribute (obj, name) + + Get an attribute, raising *note unittest.SkipTest: fdf. if *note + AttributeError: 348. is raised. + + -- Function: test.support.catch_unraisable_exception () + + Context manager catching unraisable exception using *note + sys.unraisablehook(): 1f9. + + 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. + + Usage: + + 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. + + -- Function: test.support.load_package_tests (pkg_dir, loader, + standard_tests, pattern) + + Generic implementation of the *note unittest: 106. ‘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) + + -- Function: 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. + + -- Function: 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'. + + -- Function: test.support.run_in_subinterp (code) + + Run 'code' in subinterpreter. Raise *note unittest.SkipTest: fdf. + if *note tracemalloc: ff. is enabled. + + -- Function: test.support.check_free_after_iterating (test, iter, cls, + args=()) + + Assert instances of 'cls' are deallocated after iterating. + + -- Function: 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. + + -- Function: 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__: 2276. 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. + + Example use: + + 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. + + -- Function: 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: 413. + + Added in version 3.10. + + -- Function: 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. + + -- Function: 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(): 17be. 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 *note test.support: e4. module defines the following classes: + + -- Class: 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(): 151d. is used to set *note + resource.RLIMIT_CORE: 418f.’s soft limit to 0 to prevent coredump + file creation. + + On both platforms, the old value is restored by *note __exit__(): + 12f3. + + -- Class: test.support.SaveSignals + + Class to save and restore signal handlers registered by the Python + signal handler. + + -- Method: save (self) + + Save the signal handlers to a dictionary mapping signal + numbers to the current signal handler. + + -- Method: restore (self) + + Set the signal numbers from the *note save(): 4191. dictionary + to the saved handler. + + -- Class: test.support.Matcher + + -- Method: matches (self, d, **kwargs) + + Try to match a single dict with the supplied arguments. + + -- Method: 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: Development Tools + +5.27.10 ‘test.support.socket_helper’ — Utilities for socket tests +----------------------------------------------------------------- + +The *note test.support.socket_helper: e9. module provides support for +socket tests. + +Added in version 3.9. + + -- Data: test.support.socket_helper.IPV6_ENABLED + + Set to ‘True’ if IPv6 is enabled on this host, ‘False’ otherwise. + + -- Function: 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: 181c, *note + SOCK_STREAM: 12e6.), 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(): 4199. should be used for + any tests where a server socket needs to be bound to a particular + port for the duration of the test. Which one to use depends on + whether the calling code is creating a Python socket, or if an + unused port needs to be provided in a constructor or passed to an + external program (i.e. the ‘-accept’ argument to openssl’s + s_server mode). Always prefer *note bind_port(): 4199. over *note + find_unused_port(): 4198. 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. + + -- Function: 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: 181c. and + ‘sock.type’ is *note SOCK_STREAM: 12e6, 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. + + -- Function: test.support.socket_helper.bind_unix_socket (sock, addr) + + Bind a Unix socket, raising *note unittest.SkipTest: fdf. if *note + PermissionError: d42. is raised. + + -- Function: @test.support.socket_helper.skip_unless_bind_unix_socket + + A decorator for running tests that require a functional ‘bind()’ + for Unix sockets. + + -- Function: test.support.socket_helper.transient_internet + (resource_name, *, timeout=30.0, errnos=()) + + A context manager that raises *note ResourceDenied: 4136. 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: Development Tools + +5.27.11 ‘test.support.script_helper’ — Utilities for the Python execution tests +------------------------------------------------------------------------------- + +The *note test.support.script_helper: e8. module provides support for +Python’s script execution tests. + + -- Function: + 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: 3b8. is one way to get most of the + testsuite to run in that situation. *note PYTHONPATH: 1016. or + ‘PYTHONUSERSITE’ are other common environment variables that might + impact whether or not the interpreter can start. + + -- Function: 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’. + + Changed in version 3.9: The function no longer strips whitespaces + from 'stderr'. + + -- Function: 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’. + + Changed in version 3.9: The function no longer strips whitespaces + from 'stderr'. + + -- Function: 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(): 419f. for more options. + + Changed in version 3.9: The function no longer strips whitespaces + from 'stderr'. + + -- Function: 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(): + 199. Returns a *note subprocess.Popen: 199. object. + + -- Function: test.support.script_helper.kill_python (p) + + Run the given *note subprocess.Popen: 199. process until completion + and return stdout. + + -- Function: 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. + + -- Function: 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)’. + + -- Function: 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. + + -- Function: 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: Development Tools + +5.27.12 ‘test.support.bytecode_helper’ — Support tools for testing correct bytecode generation +---------------------------------------------------------------------------------------------- + +The *note test.support.bytecode_helper: e5. module provides support for +testing and inspecting bytecode generation. + +Added in version 3.9. + +The module defines the following class: + + -- Class: test.support.bytecode_helper.BytecodeTestCase + (unittest.TestCase) + + This class has custom assertion methods for inspecting bytecode. + + -- Method: BytecodeTestCase.get_disassembly_as_string (co) + + Return the disassembly of 'co' as string. + + -- Method: BytecodeTestCase.assertInBytecode (x, opname, + argval=_UNSPECIFIED) + + Return instr if 'opname' is found, otherwise throws *note + AssertionError: 6a5. + + -- Method: BytecodeTestCase.assertNotInBytecode (x, opname, + argval=_UNSPECIFIED) + + Throws *note AssertionError: 6a5. 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: Development Tools + +5.27.13 ‘test.support.threading_helper’ — Utilities for threading tests +----------------------------------------------------------------------- + +The *note test.support.threading_helper: ea. module provides support for +threading tests. + +Added in version 3.10. + + -- Function: test.support.threading_helper.join_thread (thread, + timeout=None) + + Join a 'thread' within 'timeout'. Raise an *note AssertionError: + 6a5. if thread is still alive after 'timeout' seconds. + + -- Function: @test.support.threading_helper.reap_threads + + Decorator to ensure the threads are cleaned up even if the test + fails. + + -- Function: 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(): 311d. ‘start_threads’ will attempt to join + the started threads upon exit. + + -- Function: 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. + + -- Function: test.support.threading_helper.threading_setup () + + Return current thread count and copy of dangling threads. + + -- Function: test.support.threading_helper.wait_threads_exit + (timeout=None) + + Context manager to wait until all threads created in the ‘with’ + statement exit. + + -- Function: test.support.threading_helper.catch_threading_exception () + + Context manager catching *note threading.Thread: 94c. exception + using *note threading.excepthook(): 847. + + Attributes set when an exception is caught: + + * ‘exc_type’ + + * ‘exc_value’ + + * ‘exc_traceback’ + + * ‘thread’ + + See *note threading.excepthook(): 847. documentation. + + These attributes are deleted at the context manager exit. + + Usage: + + 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. + + +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: Development Tools + +5.27.14 ‘test.support.os_helper’ — Utilities for os tests +--------------------------------------------------------- + +The *note test.support.os_helper: e7. module provides support for os +tests. + +Added in version 3.10. + + -- Data: test.support.os_helper.FS_NONASCII + + A non-ASCII character encodable by *note os.fsencode(): c55. + + -- Data: test.support.os_helper.SAVEDCWD + + Set to *note os.getcwd(): 159b. + + -- Data: test.support.os_helper.TESTFN + + Set to a name that is safe to use as the name of a temporary file. + Any temporary file that is created should be closed and unlinked + (removed). + + -- Data: test.support.os_helper.TESTFN_NONASCII + + Set to a filename containing the *note FS_NONASCII: 41b5. + 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. + + -- Data: test.support.os_helper.TESTFN_UNENCODABLE + + Set to a filename (str type) that should not be able to be encoded + by file system encoding in strict mode. It may be ‘None’ if it’s + not possible to generate such a filename. + + -- Data: test.support.os_helper.TESTFN_UNDECODABLE + + Set to a filename (bytes type) that should not be able to be + decoded by file system encoding in strict mode. It may be ‘None’ + if it’s not possible to generate such a filename. + + -- Data: test.support.os_helper.TESTFN_UNICODE + + Set to a non-ASCII name for a temporary file. + + -- Class: test.support.os_helper.EnvironmentVarGuard + + Class used to temporarily set or unset environment variables. + Instances can be used as a context manager and have a complete + dictionary interface for querying/modifying the underlying + ‘os.environ’. After exit from the context manager all changes to + environment variables done through this instance will be rolled + back. + + Changed in version 3.1: Added dictionary interface. + + -- Class: test.support.os_helper.FakePath (path) + + Simple *note path-like object: 2a2. It implements the *note + __fspath__(): c52. method which just returns the 'path' argument. + If 'path' is an exception, it will be raised in ‘__fspath__()’. + + -- Method: EnvironmentVarGuard.set (envvar, value) + + Temporarily set the environment variable ‘envvar’ to the value of + ‘value’. + + -- Method: EnvironmentVarGuard.unset (envvar) + + Temporarily unset the environment variable ‘envvar’. + + -- Function: test.support.os_helper.can_symlink () + + Return ‘True’ if the OS supports symbolic links, ‘False’ otherwise. + + -- Function: test.support.os_helper.can_xattr () + + Return ‘True’ if the OS supports xattr, ‘False’ otherwise. + + -- Function: test.support.os_helper.change_cwd (path, quiet=False) + + A context manager that temporarily changes the current working + directory to 'path' and yields the directory. + + If 'quiet' is ‘False’, the context manager raises an exception on + error. Otherwise, it issues only a warning and keeps the current + working directory the same. + + -- Function: test.support.os_helper.create_empty_file (filename) + + Create an empty file with 'filename'. If it already exists, + truncate it. + + -- Function: test.support.os_helper.fd_count () + + Count the number of open file descriptors. + + -- Function: test.support.os_helper.fs_is_case_insensitive (directory) + + Return ‘True’ if the file system for 'directory' is + case-insensitive. + + -- Function: test.support.os_helper.make_bad_fd () + + Create an invalid file descriptor by opening and closing a + temporary file, and returning its descriptor. + + -- Function: test.support.os_helper.rmdir (filename) + + Call *note os.rmdir(): 10e8. 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. + + -- Function: test.support.os_helper.rmtree (path) + + Call *note shutil.rmtree(): 2fb. on 'path' or call *note + os.lstat(): 49d. and *note os.rmdir(): 10e8. to remove a path and + its contents. As with *note rmdir(): 41c6, on Windows platforms + this is wrapped with a wait loop that checks for the existence of + the files. + + -- Function: @test.support.os_helper.skip_unless_symlink + + A decorator for running tests that require support for symbolic + links. + + -- Function: @test.support.os_helper.skip_unless_xattr + + A decorator for running tests that require support for xattr. + + -- Function: test.support.os_helper.temp_cwd (name='tempcwd', + quiet=False) + + A context manager that temporarily creates a new directory and + changes the current working directory (CWD). + + The context manager creates a temporary directory in the current + directory with name 'name' before temporarily changing the current + working directory. If 'name' is ‘None’, the temporary directory is + created using *note tempfile.mkdtemp(): 221. + + If 'quiet' is ‘False’ and it is not possible to create or change + the CWD, an error is raised. Otherwise, only a warning is raised + and the original CWD is used. + + -- Function: test.support.os_helper.temp_dir (path=None, quiet=False) + + A context manager that creates a temporary directory at 'path' and + yields the directory. + + If 'path' is ‘None’, the temporary directory is created using *note + tempfile.mkdtemp(): 221. 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. + + -- Function: test.support.os_helper.temp_umask (umask) + + A context manager that temporarily sets the process umask. + + -- Function: test.support.os_helper.unlink (filename) + + Call *note os.unlink(): 10ea. on 'filename'. As with *note + rmdir(): 41c6, 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: Development Tools + +5.27.15 ‘test.support.import_helper’ — Utilities for import tests +----------------------------------------------------------------- + +The *note test.support.import_helper: e6. module provides support for +import tests. + +Added in version 3.10. + + -- Function: test.support.import_helper.forget (module_name) + + Remove the module named 'module_name' from ‘sys.modules’ and delete + any byte-compiled files of the module. + + -- Function: test.support.import_helper.import_fresh_module (name, + fresh=(), blocked=(), deprecated=False) + + This function imports and returns a fresh copy of the named Python + module by removing the named module from ‘sys.modules’ before doing + the import. Note that unlike ‘reload()’, the original module is + not affected by this operation. + + 'fresh' is an iterable of additional module names that are also + removed from the ‘sys.modules’ cache before doing the import. + + 'blocked' is an iterable of module names that are replaced with + ‘None’ in the module cache during the import to ensure that + attempts to import them raise *note ImportError: 415. + + The named module and any modules named in the 'fresh' and 'blocked' + parameters are saved before starting the import and then reinserted + into ‘sys.modules’ when the fresh import is complete. + + Module and package deprecation messages are suppressed during this + import if 'deprecated' is ‘True’. + + This function will raise *note ImportError: 415. if the named + module cannot be imported. + + Example use: + + # 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. + + -- Function: test.support.import_helper.import_module (name, + deprecated=False, *, required_on=()) + + This function imports and returns the named module. Unlike a + normal import, this function raises *note unittest.SkipTest: fdf. + if the module cannot be imported. + + 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: a8d. + + Added in version 3.1. + + -- Function: test.support.import_helper.modules_setup () + + Return a copy of *note sys.modules: 1550. + + -- Function: test.support.import_helper.modules_cleanup (oldmodules) + + Remove modules except for 'oldmodules' and ‘encodings’ in order to + preserve internal cache. + + -- Function: test.support.import_helper.unload (name) + + Delete 'name' from ‘sys.modules’. + + -- Function: 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. + + -- Class: 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: 1a5. on import. Example + usage: + + with CleanImport('foo'): + importlib.import_module('foo') # New reference. + + -- Class: test.support.import_helper.DirsOnSysPath (*paths) + + A context manager to temporarily add directories to *note sys.path: + 3b0. + + This makes a copy of *note sys.path: 3b0, appends any directories + given as positional arguments, then reverts *note sys.path: 3b0. to + the copied settings when the context ends. + + Note that 'all' *note sys.path: 3b0. 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: Development Tools + +5.27.16 ‘test.support.warnings_helper’ — Utilities for warnings tests +--------------------------------------------------------------------- + +The *note test.support.warnings_helper: eb. module provides support for +warnings tests. + +Added in version 3.10. + + -- Function: test.support.warnings_helper.ignore_warnings (*, category) + + Suppress warnings that are instances of 'category', which must be + *note Warning: 22b3. or a subclass. Roughly equivalent to *note + warnings.catch_warnings(): 581. with *note + warnings.simplefilter('ignore', category=category): 6bd. For + example: + + @warning_helper.ignore_warnings(category=DeprecationWarning) + def test_suppress_warning(): + # do something + + Added in version 3.8. + + -- Function: test.support.warnings_helper.check_no_resource_warning + (testcase) + + Context manager to check that no *note ResourceWarning: 246. was + raised. You must remove the object which may emit *note + ResourceWarning: 246. before the end of the context manager. + + -- Function: 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: 461. is + emitted only once, and that it will be converted to a *note + SyntaxError: 18d. when turned into error. 'testcase' is the *note + unittest: 106. instance for the test. 'errtext' is the regular + expression which should match the string representation of the + emitted *note SyntaxWarning: 461. and raised *note SyntaxError: + 18d. 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. + + -- Function: test.support.warnings_helper.check_warnings (*filters, + quiet=True) + + A convenience wrapper for *note warnings.catch_warnings(): 581. + 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(): 6bd. set to ‘always’ and with the option + to automatically validate the results that are recorded. + + ‘check_warnings’ accepts 2-tuples of the form ‘("message regexp", + WarningCategory)’ as positional arguments. If one or more + 'filters' are provided, or if the optional keyword argument 'quiet' + is ‘False’, it checks to make sure the warnings are as expected: + each specified filter must match at least one of the warnings + raised by the enclosed code or the test fails, and if any warnings + are raised that do not match any of the specified filters the test + fails. To disable the first of these checks, set 'quiet' to + ‘True’. + + If no arguments are specified, it defaults to: + + check_warnings(("", Warning), quiet=True) + + In this case all warnings are caught and no errors are raised. + + On entry to the context manager, a ‘WarningRecorder’ instance is + returned. The underlying warnings list from *note + catch_warnings(): 581. is available via the recorder object’s *note + warnings: 112. attribute. As a convenience, the attributes of the + object representing the most recent warning can also be accessed + directly through the recorder object (see example below). If no + warning has been raised, then any of the attributes that would + otherwise be expected on an object representing a warning will + return ‘None’. + + The recorder object also has a ‘reset()’ method, which clears the + warnings list. + + The context manager is designed to be used like this: + + with check_warnings(("assertion is always true", SyntaxWarning), + ("", UserWarning)): + exec('assert(False, "Hey!")') + warnings.warn(UserWarning("Hide me!")) + + In this case if either warning was not raised, or some other + warning was raised, *note check_warnings(): 41db. would raise an + error. + + When a test needs to look more deeply into the warnings, rather + than just checking whether or not they occurred, code like this can + be used: + + 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 + + Here all warnings will be caught, and the test code tests the + captured warnings directly. + + Changed in version 3.2: New optional arguments 'filters' and + 'quiet'. + + -- Class: test.support.warnings_helper.WarningsRecorder + + Class used to record warnings for unit tests. See documentation of + *note check_warnings(): 41db. above for more details. + + +File: python.info, Node: Debugging and Profiling, Next: Software Packaging and Distribution, Prev: Development Tools, Up: The Python Standard Library + +5.28 Debugging and Profiling +============================ + +These libraries help you with Python development: the debugger enables +you to step through code, analyze stack frames and set breakpoints etc., +and the profilers run code and give you a detailed breakdown of +execution times, allowing you to identify bottlenecks in your programs. +Auditing events provide visibility into runtime behaviors that would +otherwise require intrusive debugging or patching. + +* Menu: + +* Audit events table:: +* bdb — Debugger framework:: +* faulthandler — Dump the Python traceback:: +* pdb — The Python Debugger:: +* The Python Profilers:: +* timeit — Measure execution time of small code snippets:: +* trace — Trace or track Python statement execution:: +* tracemalloc — Trace memory allocations:: + + +File: python.info, Node: Audit events table, Next: bdb — Debugger framework, Up: Debugging and Profiling + +5.28.1 Audit events table +------------------------- + +This table contains all events raised by *note sys.audit(): 15b9. or +*note PySys_Audit(): 36a. calls throughout the CPython runtime and the +standard library. These calls were added in 3.8 or later (see PEP +578(1)). + +See *note sys.addaudithook(): 41e1. and *note PySys_AddAuditHook(): +41e2. for information on handling these events. + +'CPython implementation detail:' This table is generated from the +CPython documentation, and may not represent events raised by other +implementations. See your runtime specific documentation for actual +events raised. + +Audit event Arguments References + +------------------------------------------------------------------------------------------------------------------- + +_thread.start_new_thread ‘function’, ‘args’, ‘kwargs’ *note [1]: 41e3. + + +array.__new__ ‘typecode’, ‘initializer’ *note [1]: 1a0. + + +builtins.breakpoint ‘breakpointhook’ *note [1]: 236. + + +builtins.id ‘id’ *note [1]: 13ee. + + +builtins.input ‘prompt’ *note [1]: 12cb. + + +builtins.input/result ‘result’ *note [1]: 12cb. + + +code.__new__ ‘code’, ‘filename’, ‘name’, ‘argcount’, *note [1]: 2e3. + ‘posonlyargcount’, ‘kwonlyargcount’, ‘nlocals’, + ‘stacksize’, ‘flags’ + + +compile ‘source’, ‘filename’ *note [1]: 192. + + +cpython.PyInterpreterState_Clear *note [1]: 41e4. + + +cpython.PyInterpreterState_New *note [1]: 41e5. + + +cpython._PySys_ClearAuditHooks *note [1]: d15. + + +cpython.run_command ‘command’ *note [1]: 5dc. + + +cpython.run_file ‘filename’ *note [1]: 41e6. + + +cpython.run_interactivehook ‘hook’ *note [1]: fc2. + + +cpython.run_module ‘module-name’ *note [1]: 5dd. + + +cpython.run_startup ‘filename’ *note [1]: fc3. + + +cpython.run_stdin *note [1]: 41e7.*note [2]: 41e8.*note [3]: 41e9. + + +ctypes.addressof ‘obj’ *note [1]: 2e47. + + +ctypes.call_function ‘func_pointer’, ‘arguments’ *note [1]: 2e3f. + + +ctypes.cdata ‘address’ *note [1]: 2e59. + + +ctypes.cdata/buffer ‘pointer’, ‘size’, ‘offset’ *note [1]: 2e57.*note [2]: 2e58. + + +ctypes.create_string_buffer ‘init’, ‘size’ *note [1]: 2dfc. + + +ctypes.create_unicode_buffer ‘init’, ‘size’ *note [1]: 19ce. + + +ctypes.dlopen ‘name’ *note [1]: 2e3d. + + +ctypes.dlsym ‘library’, ‘name’ *note [1]: 2e3d. + + +ctypes.dlsym/handle ‘handle’, ‘name’ *note [1]: 2e3d. + + +ctypes.get_errno *note [1]: 2e37. + + +ctypes.get_last_error *note [1]: 2e39. + + +ctypes.set_errno ‘errno’ *note [1]: 2e38. + + +ctypes.set_exception ‘code’ *note [1]: 2e3f. + + +ctypes.set_last_error ‘error’ *note [1]: 2e3a. + + +ctypes.string_at ‘ptr’, ‘size’ *note [1]: 2e50. + + +ctypes.wstring_at ‘ptr’, ‘size’ *note [1]: 2e52. + + +ensurepip.bootstrap ‘root’ *note [1]: 41ea. + + +exec ‘code_object’ *note [1]: 180.*note [2]: 17f. + + +fcntl.fcntl ‘fd’, ‘cmd’, ‘arg’ *note [1]: 344b. + + +fcntl.flock ‘fd’, ‘operation’ *note [1]: 41eb. + + +fcntl.ioctl ‘fd’, ‘request’, ‘arg’ *note [1]: 1443. + + +fcntl.lockf ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’ *note [1]: 13b8. + + +ftplib.connect ‘self’, ‘host’, ‘port’ *note [1]: 3a84. + + +ftplib.sendcmd ‘self’, ‘cmd’ *note [1]: 3a89.*note [2]: 3a8a. + + +function.__new__ ‘code’ *note [1]: 881. + + +gc.get_objects ‘generation’ *note [1]: 7ff. + + +gc.get_referents ‘objs’ *note [1]: 801. + + +gc.get_referrers ‘objs’ *note [1]: 800. + + +glob.glob ‘pathname’, ‘recursive’ *note [1]: 2a1.*note [2]: 803. + + +glob.glob/2 ‘pathname’, ‘recursive’, ‘root_dir’, ‘dir_fd’ *note [1]: 2a1.*note [2]: 803. + + +http.client.connect ‘self’, ‘host’, ‘port’ *note [1]: 3a67. + + +http.client.send ‘self’, ‘data’ *note [1]: 3a6c. + + +imaplib.open ‘self’, ‘host’, ‘port’ *note [1]: 904. + + +imaplib.send ‘self’, ‘data’ *note [1]: 3adb. + + +import ‘module’, ‘filename’, ‘sys.path’, ‘sys.meta_path’, *note [1]: 5de. + ‘sys.path_hooks’ + + +marshal.dumps ‘value’, ‘version’ *note [1]: 28c1. + + +marshal.load *note [1]: 1a12. + + +marshal.loads ‘bytes’ *note [1]: 1a12. + + +mmap.__new__ ‘fileno’, ‘length’, ‘access’, ‘offset’ *note [1]: 20d. + + +msvcrt.get_osfhandle ‘fd’ *note [1]: 41ec. + + +msvcrt.locking ‘fd’, ‘mode’, ‘nbytes’ *note [1]: 41ed. + + +msvcrt.open_osfhandle ‘handle’, ‘flags’ *note [1]: 41ee. + + +object.__delattr__ ‘obj’, ‘name’ *note [1]: 1f2e. + + +object.__getattr__ ‘obj’, ‘name’ *note [1]: bd2. + + +object.__setattr__ ‘obj’, ‘name’, ‘value’ *note [1]: 1f2d. + + +open ‘path’, ‘mode’, ‘flags’ *note [1]: 517.*note [2]: 518.*note [3]: d91. + + +os.add_dll_directory ‘path’ *note [1]: 9e9. + + +os.chdir ‘path’ *note [1]: 609.*note [2]: d88. + + +os.chflags ‘path’, ‘flags’ *note [1]: 10e2.*note [2]: 2b86. + + +os.chmod ‘path’, ‘mode’, ‘dir_fd’ *note [1]: 21d.*note [2]: 21e.*note [3]: 21c. + + +os.chown ‘path’, ‘uid’, ‘gid’, ‘dir_fd’ *note [1]: 10e3.*note [2]: d89.*note [3]: 2b87. + + +os.exec ‘path’, ‘args’, ‘env’ *note [1]: 2bc3. + + +os.fork *note [1]: 197. + + +os.forkpty *note [1]: 198. + + +os.fwalk ‘top’, ‘topdown’, ‘onerror’, ‘follow_symlinks’, ‘dir_fd’ *note [1]: b5b. + + +os.getxattr ‘path’, ‘attribute’ *note [1]: 10f8. + + +os.kill ‘pid’, ‘sig’ *note [1]: 1353. + + +os.killpg ‘pgid’, ‘sig’ *note [1]: 19d5. + + +os.link ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ *note [1]: 10e4. + + +os.listdir ‘path’ *note [1]: 10ee. + + +os.listdrives *note [1]: 499. + + +os.listmounts ‘volume’ *note [1]: 49b. + + +os.listvolumes *note [1]: 49a. + + +os.listxattr ‘path’ *note [1]: 10f9. + + +os.lockf ‘fd’, ‘cmd’, ‘len’ *note [1]: 1107. + + +os.mkdir ‘path’, ‘mode’, ‘dir_fd’ *note [1]: 220.*note [2]: 21f. + + +os.posix_spawn ‘path’, ‘argv’, ‘env’ *note [1]: 222.*note [2]: 1a2e. + + +os.putenv ‘key’, ‘value’ *note [1]: 91b. + + +os.remove ‘path’, ‘dir_fd’ *note [1]: 10e5.*note [2]: 2b8b.*note [3]: 10ea. + + +os.removexattr ‘path’, ‘attribute’ *note [1]: 10fa. + + +os.rename ‘src’, ‘dst’, ‘src_dir_fd’, ‘dst_dir_fd’ *note [1]: 10e6.*note [2]: 2b8c.*note [3]: 10e7. + + +os.rmdir ‘path’, ‘dir_fd’ *note [1]: 10e8. + + +os.scandir ‘path’ *note [1]: a5e. + + +os.setxattr ‘path’, ‘attribute’, ‘value’, ‘flags’ *note [1]: 10fb. + + +os.spawn ‘mode’, ‘path’, ‘args’, ‘env’ *note [1]: 1731. + + +os.startfile ‘path’, ‘operation’ *note [1]: 18cb. + + +os.startfile/2 ‘path’, ‘operation’, ‘arguments’, ‘cwd’, ‘show_cmd’ *note [1]: 18cb. + + +os.symlink ‘src’, ‘dst’, ‘dir_fd’ *note [1]: 10e9. + + +os.system ‘command’ *note [1]: 1426. + + +os.truncate ‘fd’, ‘length’ *note [1]: d8e.*note [2]: e3b. + + +os.unsetenv ‘key’ *note [1]: 91a. + + +os.utime ‘path’, ‘times’, ‘ns’, ‘dir_fd’ *note [1]: 10eb. + + +os.walk ‘top’, ‘topdown’, ‘onerror’, ‘followlinks’ *note [1]: 4a5. + + +pathlib.Path.glob ‘self’, ‘pattern’ *note [1]: 22f. + + +pathlib.Path.rglob ‘self’, ‘pattern’ *note [1]: 230. + + +pdb.Pdb *note [1]: 921. + + +pickle.find_class ‘module’, ‘name’ *note [1]: 289f. + + +poplib.connect ‘self’, ‘host’, ‘port’ *note [1]: 923.*note [2]: 924. + + +poplib.putline ‘self’, ‘line’ *note [1]: 923.*note [2]: 924. + + +pty.spawn ‘argv’ *note [1]: f7d. + + +resource.prlimit ‘pid’, ‘resource’, ‘limits’ *note [1]: f84. + + +resource.setrlimit ‘resource’, ‘limits’ *note [1]: 151d. + + +setopencodehook *note [1]: 1729. + + +shutil.chown ‘path’, ‘user’, ‘group’ *note [1]: 242. + + +shutil.copyfile ‘src’, ‘dst’ *note [1]: a59.*note [2]: a5a.*note [3]: a58. + + +shutil.copymode ‘src’, ‘dst’ *note [1]: a59.*note [2]: 16ab. + + +shutil.copystat ‘src’, ‘dst’ *note [1]: a5a.*note [2]: 1122. + + +shutil.copytree ‘src’, ‘dst’ *note [1]: a28. + + +shutil.make_archive ‘base_name’, ‘format’, ‘root_dir’, ‘base_dir’ *note [1]: 4af. + + +shutil.move ‘src’, ‘dst’ *note [1]: a5b. + + +shutil.rmtree ‘path’, ‘dir_fd’ *note [1]: 2fb. + + +shutil.unpack_archive ‘filename’, ‘extract_dir’, ‘format’ *note [1]: 467. + + +signal.pthread_kill ‘thread_id’, ‘signalnum’ *note [1]: 1125. + + +smtplib.connect ‘self’, ‘host’, ‘port’ *note [1]: 19c9. + + +smtplib.send ‘self’, ‘data’ *note [1]: 92d. + + +socket.__new__ ‘self’, ‘family’, ‘type’, ‘protocol’ *note [1]: da0. + + +socket.bind ‘self’, ‘address’ *note [1]: 1504. + + +socket.connect ‘self’, ‘address’ *note [1]: da2.*note [2]: 1503. + + +socket.getaddrinfo ‘host’, ‘port’, ‘family’, ‘type’, ‘protocol’ *note [1]: 1752. + + +socket.gethostbyaddr ‘ip_address’ *note [1]: 18cc. + + +socket.gethostbyname ‘hostname’ *note [1]: 3440.*note [2]: 18cd. + + +socket.gethostname *note [1]: 2b31. + + +socket.getnameinfo ‘sockaddr’ *note [1]: 16c3. + + +socket.getservbyname ‘servicename’, ‘protocolname’ *note [1]: 3442. + + +socket.getservbyport ‘port’, ‘protocolname’ *note [1]: 3443. + + +socket.sendmsg ‘self’, ‘address’ *note [1]: 472. + + +socket.sendto ‘self’, ‘address’ *note [1]: da8. + + +socket.sethostname ‘name’ *note [1]: 112f. + + +sqlite3.connect ‘database’ *note [1]: 2aa. + + +sqlite3.connect/handle ‘connection_handle’ *note [1]: 2aa. + + +sqlite3.enable_load_extension ‘connection’, ‘enabled’ *note [1]: 83a. + + +sqlite3.load_extension ‘connection’, ‘path’ *note [1]: 4b4. + + +subprocess.Popen ‘executable’, ‘args’, ‘cwd’, ‘env’ *note [1]: 199. + + +sys._current_exceptions *note [1]: 4be. + + +sys._current_frames *note [1]: 13fe. + + +sys._getframe ‘frame’ *note [1]: 6dc. + + +sys._getframemodulename ‘depth’ *note [1]: 176e. + + +sys.addaudithook *note [1]: 41e2.*note [2]: 41e1. + + +sys.excepthook ‘hook’, ‘type’, ‘value’, ‘traceback’ *note [1]: 807. + + +sys.monitoring.register_callback ‘func’ *note [1]: 41ef. + + +sys.set_asyncgen_hooks_finalizer *note [1]: 1626. + + +sys.set_asyncgen_hooks_firstiter *note [1]: 1626. + + +sys.setprofile *note [1]: 14c9. + + +sys.settrace *note [1]: 14ca. + + +sys.unraisablehook ‘hook’, ‘unraisable’ *note [1]: 1f9. + + +syslog.closelog *note [1]: 53c. + + +syslog.openlog ‘ident’, ‘logoption’, ‘facility’ *note [1]: 53b. + + +syslog.setlogmask ‘maskpri’ *note [1]: 41f0. + + +syslog.syslog ‘priority’, ‘message’ *note [1]: 53d. + + +tempfile.mkdtemp ‘fullpath’ *note [1]: 1227.*note [2]: 221. + + +tempfile.mkstemp ‘fullpath’ *note [1]: 4c2.*note [2]: 2853.*note [3]: 2854. + + +time.sleep ‘secs’ *note [1]: 41f1. + + +urllib.Request ‘fullurl’, ‘data’, ‘headers’, ‘method’ *note [1]: 295. + + +webbrowser.open ‘url’ *note [1]: 394a. + + +winreg.ConnectRegistry ‘computer_name’, ‘key’ *note [1]: 41f2. + + +winreg.CreateKey ‘key’, ‘sub_key’, ‘access’ *note [1]: 41f3.*note [2]: 134e. + + +winreg.DeleteKey ‘key’, ‘sub_key’, ‘access’ *note [1]: 41f4.*note [2]: 134f. + + +winreg.DeleteValue ‘key’, ‘value’ *note [1]: 41f5. + + +winreg.DisableReflectionKey ‘key’ *note [1]: 1350. + + +winreg.EnableReflectionKey ‘key’ *note [1]: 1351. + + +winreg.EnumKey ‘key’, ‘index’ *note [1]: 41f6. + + +winreg.EnumValue ‘key’, ‘index’ *note [1]: 41f7. + + +winreg.ExpandEnvironmentStrings ‘str’ *note [1]: 13c4. + + +winreg.LoadKey ‘key’, ‘sub_key’, ‘file_name’ *note [1]: 41f8. + + +winreg.OpenKey ‘key’, ‘sub_key’, ‘access’ *note [1]: 41f9. + + +winreg.OpenKey/result ‘key’ *note [1]: 41f3.*note [2]: 134e.*note [3]: 41f9. + + +winreg.PyHKEY.Detach ‘key’ *note [1]: 41fa. + + +winreg.QueryInfoKey ‘key’ *note [1]: 41fb. + + +winreg.QueryReflectionKey ‘key’ *note [1]: 1352. + + +winreg.QueryValue ‘key’, ‘sub_key’, ‘value_name’ *note [1]: 41fc.*note [2]: 41fd. + + +winreg.SaveKey ‘key’, ‘file_name’ *note [1]: 41fe. + + +winreg.SetValue ‘key’, ‘sub_key’, ‘type’, ‘value’ *note [1]: 41ff.*note [2]: 178d. + + +The following events are raised internally and do not correspond to any +public API of CPython: + +Audit event Arguments + +------------------------------------------------------------------------------- + +_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’ + + +ctypes.PyObj_FromPtr ‘obj’ + + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0578/ + + +File: python.info, Node: bdb — Debugger framework, Next: faulthandler — Dump the Python traceback, Prev: Audit events table, Up: Debugging and Profiling + +5.28.2 ‘bdb’ — Debugger framework +--------------------------------- + +'Source code:' Lib/bdb.py(1) + +__________________________________________________________________ + +The *note bdb: f. module handles basic debugger functions, like setting +breakpoints or managing execution via the debugger. + +The following exception is defined: + + -- Exception: bdb.BdbQuit + + Exception raised by the *note Bdb: 12f5. class for quitting the + debugger. + +The *note bdb: f. module also defines two classes: + + -- Class: bdb.Breakpoint (self, file, line, temporary=False, cond=None, + funcname=None) + + This class implements temporary breakpoints, ignore counts, + disabling and (re-)enabling, and conditionals. + + Breakpoints are indexed by number through a list called *note + bpbynumber: 4204. and by ‘(file, line)’ pairs through *note bplist: + 4205. The former points to a single instance of class *note + Breakpoint: 4203. The latter points to a list of such instances + since there may be more than one breakpoint per line. + + When creating a breakpoint, its associated *note file name: 4206. + should be in canonical form. If a *note funcname: 4207. is + defined, a breakpoint *note hit: 4208. will be counted when the + first line of that function is executed. A *note conditional: + 4209. breakpoint always counts a *note hit: 4208. + + *note Breakpoint: 4203. instances have the following methods: + + -- Method: deleteMe () + + Delete the breakpoint from the list associated to a file/line. + If it is the last breakpoint in that position, it also deletes + the entry for the file/line. + + -- Method: enable () + + Mark the breakpoint as enabled. + + -- Method: disable () + + Mark the breakpoint as disabled. + + -- Method: bpformat () + + Return a string with all the information about the breakpoint, + nicely formatted: + + * 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. + + -- Method: bpprint (out=None) + + Print the output of *note bpformat(): 420d. to the file 'out', + or if it is ‘None’, to standard output. + + *note Breakpoint: 4203. instances have the following attributes: + + -- Attribute: file + + File name of the *note Breakpoint: 4203. + + -- Attribute: line + + Line number of the *note Breakpoint: 4203. within *note file: + 4206. + + -- Attribute: temporary + + ‘True’ if a *note Breakpoint: 4203. at (file, line) is + temporary. + + -- Attribute: cond + + Condition for evaluating a *note Breakpoint: 4203. at (file, + line). + + -- Attribute: funcname + + Function name that defines whether a *note Breakpoint: 4203. + is hit upon entering the function. + + -- Attribute: enabled + + ‘True’ if *note Breakpoint: 4203. is enabled. + + -- Attribute: bpbynumber + + Numeric index for a single instance of a *note Breakpoint: + 4203. + + -- Attribute: bplist + + Dictionary of *note Breakpoint: 4203. instances indexed by + (*note file: 4206, *note line: 420f.) tuples. + + -- Attribute: ignore + + Number of times to ignore a *note Breakpoint: 4203. + + -- Attribute: hits + + Count of the number of times a *note Breakpoint: 4203. has + been hit. + + -- Class: bdb.Bdb (skip=None) + + The *note Bdb: 12f5. class acts as a generic Python debugger base + class. + + This class takes care of the details of the trace facility; a + derived class should implement user interaction. The standard + debugger class (*note pdb.Pdb: 921.) is an example. + + The 'skip' argument, if given, must be an iterable of glob-style + module name patterns. The debugger will not step into frames that + originate in a module that matches one of these patterns. Whether + a frame is considered to originate in a certain module is + determined by the ‘__name__’ in the frame globals. + + Changed in version 3.1: Added the 'skip' parameter. + + The following methods of *note Bdb: 12f5. normally don’t need to be + overridden. + + -- Method: canonic (filename) + + Return canonical form of 'filename'. + + For real file names, the canonical form is an + operating-system-dependent, *note case-normalized: 27e3. *note + absolute path: 130e. A 'filename' with angle brackets, such + as ‘"<stdin>"’ generated in interactive mode, is returned + unchanged. + + -- Method: reset () + + Set the ‘botframe’, ‘stopframe’, ‘returnframe’ and *note + quitting: 4215. attributes with values ready to start + debugging. + + -- Method: trace_dispatch (frame, event, arg) + + This function is installed as the trace function of debugged + frames. Its return value is the new trace function (in most + cases, that is, itself). + + The default implementation decides how to dispatch a frame, + depending on the type of event (passed as a string) that is + about to be executed. 'event' can be one of the following: + + * ‘"line"’: A new line of code is going to be executed. + + * ‘"call"’: A function is about to be called, or another + code block entered. + + * ‘"return"’: A function or other code block is about to + return. + + * ‘"exception"’: An exception has occurred. + + * ‘"c_call"’: A C function is about to be called. + + * ‘"c_return"’: A C function has returned. + + * ‘"c_exception"’: A C function has raised an exception. + + For the Python events, specialized functions (see below) are + called. For the C events, no action is taken. + + The 'arg' parameter depends on the previous event. + + See the documentation for *note sys.settrace(): 14ca. for more + information on the trace function. For more information on + code and frame objects, refer to *note The standard type + hierarchy: 1ee7. + + -- Method: dispatch_line (frame) + + If the debugger should stop on the current line, invoke the + *note user_line(): 4218. method (which should be overridden in + subclasses). Raise a *note BdbQuit: 4202. exception if the + *note quitting: 4215. flag is set (which can be set from *note + user_line(): 4218.). Return a reference to the *note + trace_dispatch(): 4216. method for further tracing in that + scope. + + -- Method: dispatch_call (frame, arg) + + If the debugger should stop on this function call, invoke the + *note user_call(): 421a. method (which should be overridden in + subclasses). Raise a *note BdbQuit: 4202. exception if the + *note quitting: 4215. flag is set (which can be set from *note + user_call(): 421a.). Return a reference to the *note + trace_dispatch(): 4216. method for further tracing in that + scope. + + -- Method: dispatch_return (frame, arg) + + If the debugger should stop on this function return, invoke + the *note user_return(): 421c. method (which should be + overridden in subclasses). Raise a *note BdbQuit: 4202. + exception if the *note quitting: 4215. flag is set (which can + be set from *note user_return(): 421c.). Return a reference + to the *note trace_dispatch(): 4216. method for further + tracing in that scope. + + -- Method: dispatch_exception (frame, arg) + + If the debugger should stop at this exception, invokes the + *note user_exception(): 421e. method (which should be + overridden in subclasses). Raise a *note BdbQuit: 4202. + exception if the *note quitting: 4215. flag is set (which can + be set from *note user_exception(): 421e.). Return a + reference to the *note trace_dispatch(): 4216. method for + further tracing in that scope. + + Normally derived classes don’t override the following methods, but + they may if they want to redefine the definition of stopping and + breakpoints. + + -- Method: is_skipped_line (module_name) + + Return ‘True’ if 'module_name' matches any skip pattern. + + -- Method: stop_here (frame) + + Return ‘True’ if 'frame' is below the starting frame in the + stack. + + -- Method: 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(): 4222. + + -- Method: break_anywhere (frame) + + Return ‘True’ if any breakpoint exists for 'frame'’s filename. + + Derived classes should override these methods to gain control over + debugger operation. + + -- Method: user_call (frame, argument_list) + + Called from *note dispatch_call(): 4219. 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. + + -- Method: user_line (frame) + + Called from *note dispatch_line(): 4217. when either *note + stop_here(): 4220. or *note break_here(): 4221. returns + ‘True’. + + -- Method: user_return (frame, return_value) + + Called from *note dispatch_return(): 421b. when *note + stop_here(): 4220. returns ‘True’. + + -- Method: user_exception (frame, exc_info) + + Called from *note dispatch_exception(): 421d. when *note + stop_here(): 4220. returns ‘True’. + + -- Method: do_clear (arg) + + Handle how a breakpoint must be removed when it is a temporary + one. + + This method must be implemented by derived classes. + + Derived classes and clients can call the following methods to + affect the stepping state. + + -- Method: set_step () + + Stop after one line of code. + + -- Method: set_next (frame) + + Stop on the next line in or below the given frame. + + -- Method: set_return (frame) + + Stop when returning from the given frame. + + -- Method: set_until (frame, lineno=None) + + Stop when the line with the 'lineno' greater than the current + one is reached or when returning from current frame. + + -- Method: set_trace ([frame]) + + Start debugging from 'frame'. If 'frame' is not specified, + debugging starts from caller’s frame. + + Changed in version 3.13: *note set_trace(): 422a. will enter + the debugger immediately, rather than on the next line of code + to be executed. + + -- Method: set_continue () + + Stop only at breakpoints or when finished. If there are no + breakpoints, set the system trace function to ‘None’. + + -- Method: set_quit () + + Set the ‘quitting’ attribute to ‘True’. This raises *note + BdbQuit: 4202. in the next call to one of the ‘dispatch_*()’ + methods. + + Derived classes and clients can call the following methods to + manipulate breakpoints. These methods return a string containing + an error message if something went wrong, or ‘None’ if all is well. + + -- Method: set_break (filename, lineno, temporary=False, + cond=None, funcname=None) + + Set a new breakpoint. If the 'lineno' line doesn’t exist for + the 'filename' passed as argument, return an error message. + The 'filename' should be in canonical form, as described in + the *note canonic(): 4213. method. + + -- Method: clear_break (filename, lineno) + + Delete the breakpoints in 'filename' and 'lineno'. If none + were set, return an error message. + + -- Method: clear_bpbynumber (arg) + + Delete the breakpoint which has the index 'arg' in the *note + Breakpoint.bpbynumber: 4204. If 'arg' is not numeric or out + of range, return an error message. + + -- Method: clear_all_file_breaks (filename) + + Delete all breakpoints in 'filename'. If none were set, + return an error message. + + -- Method: clear_all_breaks () + + Delete all existing breakpoints. If none were set, return an + error message. + + -- Method: get_bpbynumber (arg) + + Return a breakpoint specified by the given number. If 'arg' + is a string, it will be converted to a number. If 'arg' is a + non-numeric string, if the given breakpoint never existed or + has been deleted, a *note ValueError: 204. is raised. + + Added in version 3.2. + + -- Method: get_break (filename, lineno) + + Return ‘True’ if there is a breakpoint for 'lineno' in + 'filename'. + + -- Method: get_breaks (filename, lineno) + + Return all breakpoints for 'lineno' in 'filename', or an empty + list if none are set. + + -- Method: get_file_breaks (filename) + + Return all breakpoints in 'filename', or an empty list if none + are set. + + -- Method: get_all_breaks () + + Return all breakpoints that are set. + + Derived classes and clients can call the following methods to get a + data structure representing a stack trace. + + -- Method: 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. + + -- Method: 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. + + * The function name or ‘"<lambda>"’. + + * The input arguments. + + * The return value. + + * The line of code (if it exists). + + The following two methods can be called by clients to use a + debugger to debug a *note statement: 278b, given as a string. + + -- Method: run (cmd, globals=None, locals=None) + + Debug a statement executed via the *note exec(): 17f. + function. 'globals' defaults to ‘__main__.__dict__’, 'locals' + defaults to 'globals'. + + -- Method: runeval (expr, globals=None, locals=None) + + Debug an expression executed via the *note eval(): 180. + function. 'globals' and 'locals' have the same meaning as in + *note run(): 4238. + + -- Method: runctx (cmd, globals, locals) + + For backwards compatibility. Calls the *note run(): 4238. + method. + + -- Method: runcall (func, /, *args, **kwds) + + Debug a single function call, and return its result. + +Finally, the module defines the following functions: + + -- Function: bdb.checkfuncname (b, frame) + + Return ‘True’ if we should break here, depending on the way the + *note Breakpoint: 4203. 'b' was set. + + If it was set via line number, it checks if *note b.line: 420f. is + the same as the one in 'frame'. If the breakpoint was set via + *note function name: 4207, we have to check we are in the right + 'frame' (the right function) and if we are on its first executable + line. + + -- Function: 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: 4205. + for the (*note file: 4206, *note line: 420f.) (which must exist) + that is *note enabled: 4211, for which *note checkfuncname(): 423b. + is true, and that has neither a false *note condition: 4209. nor + positive *note ignore: 4212. count. The 'flag', meaning that a + temporary breakpoint should be deleted, is ‘False’ only when the + *note cond: 4209. cannot be evaluated (in which case, *note ignore: + 4212. count is ignored). + + If no such entry exists, then ‘(None, None)’ is returned. + + -- Function: bdb.set_trace () + + Start debugging with a *note Bdb: 12f5. instance from caller’s + frame. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/bdb.py + + +File: python.info, Node: faulthandler — Dump the Python traceback, Next: pdb — The Python Debugger, Prev: bdb — Debugger framework, Up: Debugging and Profiling + +5.28.3 ‘faulthandler’ — Dump the Python traceback +------------------------------------------------- + +Added in version 3.3. + +__________________________________________________________________ + +This module contains functions to dump Python tracebacks explicitly, on +a fault, after a timeout, or on a user signal. Call *note +faulthandler.enable(): c9e. to install fault handlers for the *note +SIGSEGV: 1d49, *note SIGFPE: 1d4a, *note SIGABRT: 1d4b, *note SIGBUS: +1d4c, and *note SIGILL: 1d4d. signals. You can also enable them at +startup by setting the *note PYTHONFAULTHANDLER: 1079. environment +variable or by using the *note -X: 176. ‘faulthandler’ command line +option. + +The fault handler is compatible with system fault handlers like Apport +or the Windows fault handler. The module uses an alternative stack for +signal handlers if the ‘sigaltstack()’ function is available. This +allows it to dump the traceback even on a stack overflow. + +The fault handler is called on catastrophic cases and therefore can only +use signal-safe functions (e.g. it cannot allocate memory on the heap). +Because of this limitation traceback dumping is minimal compared to +normal Python tracebacks: + + * Only ASCII is supported. The ‘backslashreplace’ error handler is + used on encoding. + + * Each string is limited to 500 characters. + + * Only the filename, the function name and the line number are + displayed. (no source code) + + * It is limited to 100 frames and 100 threads. + + * The order is reversed: the most recent call is shown first. + +By default, the Python traceback is written to *note sys.stderr: 939. +To see tracebacks, applications must be run in the terminal. A log file +can alternatively be passed to *note faulthandler.enable(): c9e. + +The module is implemented in C, so tracebacks can be dumped on a crash +or when Python is deadlocked. + +The *note Python Development Mode: 1fa. calls *note +faulthandler.enable(): c9e. at Python startup. + +See also +........ + +Module *note pdb: a5. + + Interactive source code debugger for Python programs. + +Module *note traceback: fe. + + Standard interface to extract, format and print stack traces of + Python programs. + +* Menu: + +* Dumping the traceback:: +* Fault handler state:: +* Dumping the tracebacks after a timeout:: +* Dumping the traceback on a user signal:: +* Issue with file descriptors:: +* Example: Example<13>. + + +File: python.info, Node: Dumping the traceback, Next: Fault handler state, Up: faulthandler — Dump the Python traceback + +5.28.3.1 Dumping the traceback +.............................. + + -- Function: faulthandler.dump_traceback (file=sys.stderr, + all_threads=True) + + Dump the tracebacks of all threads into 'file'. If 'all_threads' + is ‘False’, dump only the current thread. + + See also + ........ + + *note traceback.print_tb(): e80, which can be used to print a + traceback object. + + Changed in version 3.5: Added support for passing file descriptor + to this function. + + +File: python.info, Node: Fault handler state, Next: Dumping the tracebacks after a timeout, Prev: Dumping the traceback, Up: faulthandler — Dump the Python traceback + +5.28.3.2 Fault handler state +............................ + + -- Function: faulthandler.enable (file=sys.stderr, all_threads=True) + + Enable the fault handler: install handlers for the *note SIGSEGV: + 1d49, *note SIGFPE: 1d4a, *note SIGABRT: 1d4b, *note SIGBUS: 1d4c. + and *note SIGILL: 1d4d. 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: 4240. + + Changed in version 3.5: Added support for passing file descriptor + to this function. + + Changed in version 3.6: On Windows, a handler for Windows exception + is also installed. + + Changed in version 3.10: The dump now mentions if a garbage + collector collection is running if 'all_threads' is true. + + -- Function: faulthandler.disable () + + Disable the fault handler: uninstall the signal handlers installed + by *note enable(): c9e. + + -- Function: faulthandler.is_enabled () + + Check if the fault handler is enabled. + + +File: python.info, Node: Dumping the tracebacks after a timeout, Next: Dumping the traceback on a user signal, Prev: Fault handler state, Up: faulthandler — Dump the Python traceback + +5.28.3.3 Dumping the tracebacks after a timeout +............................................... + + -- Function: faulthandler.dump_traceback_later (timeout, repeat=False, + file=sys.stderr, exit=False) + + Dump the tracebacks of all threads, after a timeout of 'timeout' + seconds, or every 'timeout' seconds if 'repeat' is ‘True’. If + 'exit' is ‘True’, call ‘_exit()’ with status=1 after dumping the + tracebacks. (Note ‘_exit()’ exits the process immediately, which + means it doesn’t do any cleanup like flushing file buffers.) If + the function is called twice, the new call replaces previous + parameters and resets the timeout. The timer has a sub-second + resolution. + + The 'file' must be kept open until the traceback is dumped or *note + cancel_dump_traceback_later(): 4244. is called: see *note issue + with file descriptors: 4240. + + This function is implemented using a watchdog thread. + + Changed in version 3.5: Added support for passing file descriptor + to this function. + + Changed in version 3.7: This function is now always available. + + -- Function: faulthandler.cancel_dump_traceback_later () + + Cancel the last call to *note dump_traceback_later(): dfe. + + +File: python.info, Node: Dumping the traceback on a user signal, Next: Issue with file descriptors, Prev: Dumping the tracebacks after a timeout, Up: faulthandler — Dump the Python traceback + +5.28.3.4 Dumping the traceback on a user signal +............................................... + + -- Function: faulthandler.register (signum, file=sys.stderr, + all_threads=True, chain=False) + + Register a user signal: install a handler for the 'signum' signal + to dump the traceback of all threads, or of the current thread if + 'all_threads' is ‘False’, into 'file'. Call the previous handler + if chain is ‘True’. + + The 'file' must be kept open until the signal is unregistered by + *note unregister(): 4246.: see *note issue with file descriptors: + 4240. + + Not available on Windows. + + Changed in version 3.5: Added support for passing file descriptor + to this function. + + -- Function: faulthandler.unregister (signum) + + Unregister a user signal: uninstall the handler of the 'signum' + signal installed by *note register(): dfc. Return ‘True’ if the + signal was registered, ‘False’ otherwise. + + Not available on Windows. + + +File: python.info, Node: Issue with file descriptors, Next: Example<13>, Prev: Dumping the traceback on a user signal, Up: faulthandler — Dump the Python traceback + +5.28.3.5 Issue with file descriptors +.................................... + +*note enable(): c9e, *note dump_traceback_later(): dfe. and *note +register(): dfc. keep the file descriptor of their 'file' argument. If +the file is closed and its file descriptor is reused by a new file, or +if *note os.dup2(): b63. is used to replace the file descriptor, the +traceback will be written into a different file. Call these functions +again each time that the file is replaced. + + +File: python.info, Node: Example<13>, Prev: Issue with file descriptors, Up: faulthandler — Dump the Python traceback + +5.28.3.6 Example +................ + +Example of a segmentation fault on Linux with and without enabling the +fault handler: + + $ 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 "/home/python/cpython/Lib/ctypes/__init__.py", line 486 in string_at + File "<stdin>", line 1 in <module> + Segmentation fault + + +File: python.info, Node: pdb — The Python Debugger, Next: The Python Profilers, Prev: faulthandler — Dump the Python traceback, Up: Debugging and Profiling + +5.28.4 ‘pdb’ — The Python Debugger +---------------------------------- + +'Source code:' Lib/pdb.py(1) + +__________________________________________________________________ + +The module *note pdb: a5. 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. + +The debugger is extensible – it is actually defined as the class *note +Pdb: 921. This is currently undocumented but easily understood by +reading the source. The extension interface uses the modules *note bdb: +f. and *note cmd: 19. + +See also +........ + +Module *note faulthandler: 58. + + Used to dump Python tracebacks explicitly, on a fault, after a + timeout, or on a user signal. + +Module *note traceback: fe. + + 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() + +Or: + + 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: +424c. command. + +Changed in version 3.7: The built-in *note breakpoint(): 236, 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 + +Changed in version 3.3: Tab-completion via the *note readline: ba. +module is available for commands and command arguments, e.g. the +current global and local names are offered as arguments of the ‘p’ +command. + +You can also invoke *note pdb: a5. from the command line to debug other +scripts. For example: + + python -m pdb [-c command] (-m module | pyfile) [args ...] + +When invoked as a module, pdb will automatically enter post-mortem +debugging if the program being debugged exits abnormally. After +post-mortem debugging (or after normal exit of the program), pdb will +restart the program. Automatic restarting preserves pdb’s state (such +as breakpoints) and in most cases is more useful than quitting the +debugger upon program’s exit. + + -- Option: -c, --command <command> + + To execute commands as if given in a ‘.pdbrc’ file; see *note + Debugger Commands: 424f. + + Changed in version 3.2: Added the ‘-c’ option. + + -- 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. + + Changed in version 3.7: Added the ‘-m’ option. + +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 + >>> + +The typical usage to inspect a crashed program is: + + >>> 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) + +Changed in version 3.13: The implementation of PEP 667(2) means that +name assignments made via ‘pdb’ will immediately affect the active +scope, even when running inside an *note optimized scope: 17e. + +The module defines the following functions; each enters the debugger in +a slightly different way: + + -- Function: pdb.run (statement, globals=None, locals=None) + + Execute the 'statement' (given as a string or a code object) under + debugger control. The debugger prompt appears before any code is + executed; you can set breakpoints and type *note continue: 424c, or + you can step through the statement using *note step: 4251. or *note + next: 4252. (all these commands are explained below). The optional + 'globals' and 'locals' arguments specify the environment in which + the code is executed; by default the dictionary of the module *note + __main__: 1. is used. (See the explanation of the built-in *note + exec(): 17f. or *note eval(): 180. functions.) + + -- Function: pdb.runeval (expression, globals=None, locals=None) + + Evaluate the 'expression' (given as a string or a code object) + under debugger control. When *note runeval(): 4253. returns, it + returns the value of the 'expression'. Otherwise this function is + similar to *note run(): 4056. + + -- Function: pdb.runcall (function, *args, **kwds) + + Call the 'function' (a function or method object, not a string) + with the given arguments. When *note runcall(): 4254. returns, it + returns whatever the function call returned. The debugger prompt + appears as soon as the function is entered. + + -- Function: pdb.set_trace (*, header=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. + + Changed in version 3.7: The keyword-only argument 'header'. + + Changed in version 3.13: *note set_trace(): 237. will enter the + debugger immediately, rather than on the next line of code to be + executed. + + -- Function: pdb.post_mortem (t=None) + + Enter post-mortem debugging of the given exception or *note + traceback object: af4. If no value is given, it uses the exception + that is currently being handled, or raises ‘ValueError’ if there + isn’t one. + + Changed in version 3.13: Support for exception objects was added. + + -- Function: pdb.pm () + + Enter post-mortem debugging of the exception found in *note + sys.last_exc: 4ba. + +The ‘run*’ functions and *note set_trace(): 237. are aliases for +instantiating the *note Pdb: 921. class and calling the method of the +same name. If you want to access further features, you have to do this +yourself: + + -- Class: pdb.Pdb (completekey='tab', stdin=None, stdout=None, + skip=None, nosigint=False, readrc=True) + + *note Pdb: 921. is the debugger class. + + The 'completekey', 'stdin' and 'stdout' arguments are passed to the + underlying *note cmd.Cmd: 16c5. class; see the description there. + + The 'skip' argument, if given, must be an iterable of glob-style + module name patterns. The debugger will not step into frames that + originate in a module that matches one of these patterns. (3) + + By default, Pdb sets a handler for the SIGINT signal (which is sent + when the user presses ‘Ctrl’-‘C’ on the console) when you give a + *note continue: 424c. command. This allows you to break into the + debugger again by pressing ‘Ctrl’-‘C’. If you want Pdb not to + touch the SIGINT handler, set 'nosigint' to true. + + The 'readrc' argument defaults to true and controls whether Pdb + will load .pdbrc files from the filesystem. + + Example call to enable tracing with 'skip': + + import pdb; pdb.Pdb(skip=['django.*']).set_trace() + + Raises an *note auditing event: 18ba. ‘pdb.Pdb’ with no arguments. + + Changed in version 3.1: Added the 'skip' parameter. + + Changed in version 3.2: Added the 'nosigint' parameter. + Previously, a SIGINT handler was never set by Pdb. + + Changed in version 3.6: The 'readrc' argument. + + -- Method: run (statement, globals=None, locals=None) + -- Method: runeval (expression, globals=None, locals=None) + -- Method: runcall (function, *args, **kwds) + -- Method: set_trace () + + See the documentation for the functions explained above. + +* Menu: + +* Debugger Commands:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pdb.py + + (2) https://peps.python.org/pep-0667/ + + (3) Whether a frame is considered to originate in a certain module is +determined by the ‘__name__’ in the frame globals. + + +File: python.info, Node: Debugger Commands, Up: pdb — The Python Debugger + +5.28.4.1 Debugger Commands +.......................... + +The commands recognized by the debugger are listed below. Most commands +can be abbreviated to one or two letters as indicated; e.g. ‘h(elp)’ +means that either ‘h’ or ‘help’ can be used to enter the help command +(but not ‘he’ or ‘hel’, nor ‘H’ or ‘Help’ or ‘HELP’). Arguments to +commands must be separated by whitespace (spaces or tabs). Optional +arguments are enclosed in square brackets (‘[]’) in the command syntax; +the square brackets must not be typed. Alternatives in the command +syntax are separated by a vertical bar (‘|’). + +Entering a blank line repeats the last command entered. Exception: if +the last command was a *note list: 425a. command, the next 11 lines are +listed. + +Commands that the debugger doesn’t recognize are assumed to be Python +statements and are executed in the context of the program being +debugged. Python statements can also be prefixed with an exclamation +point (‘!’). This is a powerful way to inspect the program being +debugged; it is even possible to change a variable or call a function. +When an exception occurs in such a statement, the exception name is +printed but the debugger’s state is not changed. + +Changed in version 3.13: Expressions/Statements whose prefix is a pdb +command are now correctly identified and executed. + +The debugger supports *note aliases: 425b. Aliases can have parameters +which allows one a certain level of adaptability to the context under +examination. + +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 three 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 + +Added in version 3.12: Added the 'convenience variable' feature. + +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. + +Changed in version 3.2: ‘.pdbrc’ can now contain commands that continue +debugging, such as *note continue: 424c. or *note next: 4252. +Previously, these commands had no effect. + +Changed in version 3.11: ‘.pdbrc’ is now read with ‘'utf-8'’ encoding. +Previously, it was read with the system locale encoding. + + -- Pdbcommand: h(elp) [command] + + Without argument, print the list of available commands. With a + 'command' as argument, print help about that command. ‘help pdb’ + displays the full documentation (the docstring of the *note pdb: + a5. module). Since the 'command' argument must be an identifier, + ‘help exec’ must be entered to get help on the ‘!’ command. + + -- Pdbcommand: w(here) + + Print a stack trace, with the most recent frame at the bottom. An + arrow (‘>’) indicates the current frame, which determines the + context of most commands. + + -- Pdbcommand: d(own) [count] + + Move the current frame 'count' (default one) levels down in the + stack trace (to a newer frame). + + -- Pdbcommand: u(p) [count] + + Move the current frame 'count' (default one) levels up in the stack + trace (to an older frame). + + -- 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: 3b0. Accepatable 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. + + If a second argument is present, it is an expression which must + evaluate to true before the breakpoint is honored. + + Without argument, list all breaks, including for each breakpoint, + the number of times that breakpoint has been hit, the current + ignore count, and the associated condition if any. + + Each breakpoint is assigned a number to which all the other + breakpoint commands refer. + + -- Pdbcommand: tbreak [([filename:]lineno | function) [, condition]] + + Temporary breakpoint, which is removed automatically when it is + first hit. The arguments are the same as for *note break: 4260. + + -- Pdbcommand: cl(ear) [filename:lineno | bpnumber ...] + + With a 'filename:lineno' argument, clear all the breakpoints at + this line. With a space separated list of breakpoint numbers, + clear those breakpoints. Without argument, clear all breaks (but + first ask confirmation). + + -- Pdbcommand: disable bpnumber [bpnumber ...] + + Disable the breakpoints given as a space separated list of + breakpoint numbers. Disabling a breakpoint means it cannot cause + the program to stop execution, but unlike clearing a breakpoint, it + remains in the list of breakpoints and can be (re-)enabled. + + -- Pdbcommand: enable bpnumber [bpnumber ...] + + Enable the breakpoints specified. + + -- Pdbcommand: ignore bpnumber [count] + + Set the ignore count for the given breakpoint number. If 'count' + is omitted, the ignore count is set to 0. A breakpoint becomes + active when the ignore count is zero. When non-zero, the 'count' + is decremented each time the breakpoint is reached and the + breakpoint is not disabled and any associated condition evaluates + to true. + + -- Pdbcommand: condition bpnumber [condition] + + Set a new 'condition' for the breakpoint, an expression which must + evaluate to true before the breakpoint is honored. If 'condition' + is absent, any existing condition is removed; i.e., the breakpoint + is made unconditional. + + -- Pdbcommand: commands [bpnumber] + + Specify a list of commands for breakpoint number 'bpnumber'. The + commands themselves appear on the following lines. Type a line + containing just ‘end’ to terminate the commands. An example: + + (Pdb) commands 1 + (com) p some_variable + (com) end + (Pdb) + + To remove all commands from a breakpoint, type ‘commands’ and + follow it immediately with ‘end’; that is, give no commands. + + With no 'bpnumber' argument, ‘commands’ refers to the last + breakpoint set. + + You can use breakpoint commands to start your program up again. + Simply use the *note continue: 424c. command, or *note step: 4251, + or any other command that resumes execution. + + Specifying any command resuming execution (currently *note + continue: 424c, *note step: 4251, *note next: 4252, *note return: + 4268, *note jump: 4269, *note quit: 426a. 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 you use the ‘silent’ command in the command list, the usual + message about stopping at a breakpoint is not printed. This may be + desirable for breakpoints that are to print a specific message and + then continue. If none of the other commands print anything, you + see no sign that the breakpoint was reached. + + -- Pdbcommand: s(tep) + + Execute the current line, stop at the first possible occasion + (either in a function that is called or on the next line in the + current function). + + -- Pdbcommand: n(ext) + + Continue execution until the next line in the current function is + reached or it returns. (The difference between *note next: 4252. + and *note step: 4251. is that *note step: 4251. stops inside a + called function, while *note next: 4252. executes called functions + at (nearly) full speed, only stopping at the next line in the + current function.) + + -- Pdbcommand: unt(il) [lineno] + + Without argument, continue execution until the line with a number + greater than the current one is reached. + + With 'lineno', continue execution until a line with a number + greater or equal to 'lineno' is reached. In both cases, also stop + when the current frame returns. + + Changed in version 3.2: Allow giving an explicit line number. + + -- Pdbcommand: r(eturn) + + Continue execution until the current function returns. + + -- Pdbcommand: c(ont(inue)) + + Continue execution, only stop when a breakpoint is encountered. + + -- Pdbcommand: j(ump) lineno + + Set the next line that will be executed. Only available in the + bottom-most frame. This lets you jump back and execute code again, + or jump forward to skip code that you don’t want to run. + + It should be noted that not all jumps are allowed – for instance it + is not possible to jump into the middle of a *note for: 2ec. loop + or out of a *note finally: 9ca. clause. + + -- Pdbcommand: l(ist) [first[, last]] + + List source code for the current file. Without arguments, list 11 + lines around the current line or continue the previous listing. + With ‘.’ as argument, list 11 lines around the current line. With + one argument, list 11 lines around at that line. With two + arguments, list the given range; if the second argument is less + than the first, it is interpreted as a count. + + The current line in the current frame is indicated by ‘->’. If an + exception is being debugged, the line where the exception was + originally raised or propagated is indicated by ‘>>’, if it differs + from the current line. + + Changed in version 3.2: Added the ‘>>’ marker. + + -- Pdbcommand: ll | longlist + + List all source code for the current function or frame. + Interesting lines are marked as for *note list: 425a. + + Added in version 3.2. + + -- Pdbcommand: a(rgs) + + Print the arguments of the current function and their current + values. + + -- Pdbcommand: p expression + + Evaluate 'expression' in the current context and print its value. + + Note: ‘print()’ can also be used, but is not a debugger + command — this executes the Python *note print(): f70. + function. + + -- Pdbcommand: pp expression + + Like the *note p: f71. command, except the value of 'expression' is + pretty-printed using the *note pprint: ae. module. + + -- Pdbcommand: whatis expression + + Print the type of 'expression'. + + -- Pdbcommand: source expression + + Try to get source code of 'expression' and display it. + + Added in version 3.2. + + -- Pdbcommand: display [expression] + + Display the value of 'expression' if it changed, each time + execution stops in the current frame. + + Without 'expression', list all display expressions for the current + frame. + + Note: 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. + + Example: + + 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] + + Do not display 'expression' anymore in the current frame. Without + 'expression', clear all display expressions for the current frame. + + Added in version 3.2. + + -- Pdbcommand: interact + + Start an interactive interpreter (using the *note code: 1a. 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. + + Note: 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. + + Changed in version 3.13: ‘exit()’ and ‘quit()’ can be used to exit + the *note interact: 4273. command. + + Changed in version 3.13: *note interact: 4273. directs its output + to the debugger’s output channel rather than *note sys.stderr: 939. + + -- 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. + + Aliases may be nested and can contain anything that can be legally + typed at the pdb prompt. Note that internal pdb commands 'can' be + overridden by aliases. Such a command is then hidden until the + alias is removed. Aliasing is recursively applied to the first + word of the command line; all other words in the line are left + alone. + + As an example, here are two useful aliases (especially when placed + in the ‘.pdbrc’ file): + + # 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 + + Delete the specified alias '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: 18a. statement on the same line, e.g.: + + (Pdb) global list_options; list_options = ['-l'] + (Pdb) + + -- Pdbcommand: run [args ...] + -- Pdbcommand: restart [args ...] + + Restart the debugged Python program. If 'args' is supplied, it is + split with *note shlex: c4. and the result is used as the new *note + sys.argv: 1258. History, breakpoints, actions and debugger options + are preserved. *note restart: 4278. is an alias for *note run: + 4277. + + -- Pdbcommand: q(uit) + + Quit from the debugger. The program being executed is aborted. + + -- 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. + + Example: + + def out(): + try: + middle() + except Exception as e: + raise ValueError("reraise middle() error") from e + + def middle(): + try: + return inner(0) + except Exception as e: + raise ValueError("Middle fail") + + def inner(x): + 1 / x + + out() + + calling ‘pdb.pm()’ will allow to move between exceptions: + + > example.py(5)out() + -> raise ValueError("reraise middle() error") from e + + (Pdb) exceptions + 0 ZeroDivisionError('division by zero') + 1 ValueError('Middle fail') + > 2 ValueError('reraise middle() error') + + (Pdb) exceptions 0 + > example.py(16)inner() + -> 1 / x + + (Pdb) up + > example.py(10)middle() + -> return inner(0) + + Added in version 3.13. + + +File: python.info, Node: The Python Profilers, Next: timeit — Measure execution time of small code snippets, Prev: pdb — The Python Debugger, Up: Debugging and Profiling + +5.28.5 The Python Profilers +--------------------------- + +'Source code:' Lib/profile.py(1) and Lib/pstats.py(2) + +__________________________________________________________________ + +* Menu: + +* Introduction to the profilers:: +* Instant User’s Manual:: +* profile and cProfile Module Reference:: +* The Stats Class:: +* What Is Deterministic Profiling?:: +* Limitations:: +* Calibration:: +* Using a custom timer:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/profile.py + + (2) https://github.com/python/cpython/tree/3.13/Lib/pstats.py + + +File: python.info, Node: Introduction to the profilers, Next: Instant User’s Manual, Up: The Python Profilers + +5.28.5.1 Introduction to the profilers +...................................... + +*note cProfile: 27. and *note profile: af. provide 'deterministic +profiling' of Python programs. A 'profile' is a set of statistics that +describes how often and for how long various parts of the program +executed. These statistics can be formatted into reports via the *note +pstats: b0. module. + +The Python standard library provides two different implementations of +the same profiling interface: + + 1. *note cProfile: 27. is recommended for most users; it’s a C + extension with reasonable overhead that makes it suitable for + profiling long-running programs. Based on ‘lsprof’, contributed by + Brett Rosen and Ted Czotter. + + 2. *note profile: af, a pure Python module whose interface is imitated + by *note cProfile: 27, but which adds significant overhead to + profiled programs. If you’re trying to extend the profiler in some + way, the task might be easier with this module. Originally + designed and written by Jim Roskind. + + Note: The profiler modules are designed to provide an execution + profile for a given program, not for benchmarking purposes (for + that, there is *note timeit: ef. for reasonably accurate results). + This particularly applies to benchmarking Python code against C + code: the profilers introduce overhead for Python code, but not for + C-level functions, and so the C code would seem faster than any + Python one. + + +File: python.info, Node: Instant User’s Manual, Next: profile and cProfile Module Reference, Prev: Introduction to the profilers, Up: The Python Profilers + +5.28.5.2 Instant User’s Manual +.............................. + +This section is provided for users that “don’t want to read the manual.” +It provides a very brief overview, and allows a user to rapidly perform +profiling on an existing application. + +To profile a function that takes a single argument, you can do: + + import cProfile + import re + cProfile.run('re.compile("foo|bar")') + +(Use *note profile: af. instead of *note cProfile: 27. if the latter is +not available on your system.) + +The above action would run *note re.compile(): bd3. and print profile +results like the following: + + 214 function calls (207 primitive calls) in 0.002 seconds + + Ordered by: cumulative time + + ncalls tottime percall cumtime percall filename:lineno(function) + 1 0.000 0.000 0.002 0.002 {built-in method builtins.exec} + 1 0.000 0.000 0.001 0.001 <string>:1(<module>) + 1 0.000 0.000 0.001 0.001 __init__.py:250(compile) + 1 0.000 0.000 0.001 0.001 __init__.py:289(_compile) + 1 0.000 0.000 0.000 0.000 _compiler.py:759(compile) + 1 0.000 0.000 0.000 0.000 _parser.py:937(parse) + 1 0.000 0.000 0.000 0.000 _compiler.py:598(_code) + 1 0.000 0.000 0.000 0.000 _parser.py:435(_parse_sub) + +The first line indicates that 214 calls were monitored. Of those calls, +207 were 'primitive', meaning that the call was not induced via +recursion. The next line: ‘Ordered by: cumulative time’ indicates the +output is sorted by the ‘cumtime’ values. The column headings include: + +ncalls + + for the number of calls. + +tottime + + for the total time spent in the given function (and excluding time + made in calls to sub-functions) + +percall + + is the quotient of ‘tottime’ divided by ‘ncalls’ + +cumtime + + is the cumulative time spent in this and all subfunctions (from + invocation till exit). This figure is accurate 'even' for + recursive functions. + +percall + + is the quotient of ‘cumtime’ divided by primitive calls + +filename:lineno(function) + + provides the respective data of each function + +When there are two numbers in the first column (for example ‘3/1’), it +means that the function recursed. The second value is the number of +primitive calls and the former is the total number of calls. Note that +when the function does not recurse, these two values are the same, and +only the single figure is printed. + +Instead of printing the output at the end of the profile run, you can +save the results to a file by specifying a filename to the ‘run()’ +function: + + import cProfile + import re + cProfile.run('re.compile("foo|bar")', 'restats') + +The *note pstats.Stats: 4282. class reads profile results from a file +and formats them in various ways. The files *note cProfile: 27. and +*note profile: af. can also be invoked as a script to profile another +script. For example: + + python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py) + + -- Option: -o <output_file> + + Writes the profile results to a file instead of to stdout. + + -- Option: -s <sort_order> + + Specifies one of the *note sort_stats(): 4286. sort values to sort + the output by. This only applies when *note -o: 4284. is not + supplied. + + -- Option: -m <module> + + Specifies that a module is being profiled instead of a script. + + Added in version 3.7: Added the ‘-m’ option to *note cProfile: 27. + + Added in version 3.8: Added the ‘-m’ option to *note profile: af. + +The *note pstats: b0. module’s *note Stats: 4282. class has a variety of +methods for manipulating and printing the data saved into a profile +results file: + + import pstats + from pstats import SortKey + p = pstats.Stats('restats') + p.strip_dirs().sort_stats(-1).print_stats() + +The *note strip_dirs(): 4288. method removed the extraneous path from +all the module names. The *note sort_stats(): 4286. method sorted all +the entries according to the standard module/line/name string that is +printed. The *note print_stats(): 4289. method printed out all the +statistics. You might try the following sort calls: + + p.sort_stats(SortKey.NAME) + p.print_stats() + +The first call will actually sort the list by function name, and the +second call will print out the statistics. The following are some +interesting calls to experiment with: + + p.sort_stats(SortKey.CUMULATIVE).print_stats(10) + +This sorts the profile by cumulative time in a function, and then only +prints the ten most significant lines. If you want to understand what +algorithms are taking time, the above line is what you would use. + +If you were looking to see what functions were looping a lot, and taking +a lot of time, you would do: + + p.sort_stats(SortKey.TIME).print_stats(10) + +to sort according to time spent within each function, and then print the +statistics for the top ten functions. + +You might also try: + + p.sort_stats(SortKey.FILENAME).print_stats('__init__') + +This will sort all the statistics by file name, and then print out +statistics for only the class init methods (since they are spelled with +‘__init__’ in them). As one final example, you could try: + + p.sort_stats(SortKey.TIME, SortKey.CUMULATIVE).print_stats(.5, 'init') + +This line sorts statistics with a primary key of time, and a secondary +key of cumulative time, and then prints out some of the statistics. To +be specific, the list is first culled down to 50% (re: ‘.5’) of its +original size, then only lines containing ‘init’ are maintained, and +that sub-sub-list is printed. + +If you wondered what functions called the above functions, you could now +(‘p’ is still sorted according to the last criteria) do: + + p.print_callers(.5, 'init') + +and you would get a list of callers for each of the listed functions. + +If you want more functionality, you’re going to have to read the manual, +or guess what the following functions do: + + p.print_callees() + p.add('restats') + +Invoked as a script, the *note pstats: b0. module is a statistics +browser for reading and examining profile dumps. It has a simple +line-oriented interface (implemented using *note cmd: 19.) and +interactive help. + + +File: python.info, Node: profile and cProfile Module Reference, Next: The Stats Class, Prev: Instant User’s Manual, Up: The Python Profilers + +5.28.5.3 ‘profile’ and ‘cProfile’ Module Reference +.................................................. + +Both the *note profile: af. and *note cProfile: 27. modules provide the +following functions: + + -- Function: profile.run (command, filename=None, sort=-1) + + This function takes a single argument that can be passed to the + *note exec(): 17f. function, and an optional file name. In all + cases this routine executes: + + exec(command, __main__.__dict__, __main__.__dict__) + + and gathers profiling statistics from the execution. If no file + name is present, then this function automatically creates a *note + Stats: 4282. instance and prints a simple profiling report. If the + sort value is specified, it is passed to this *note Stats: 4282. + instance to control how the results are sorted. + + -- Function: profile.runctx (command, globals, locals, filename=None, + sort=-1) + + This function is similar to *note run(): 428b, with added arguments + to supply the globals and locals mappings for the 'command' string. + This routine executes: + + exec(command, globals, locals) + + and gathers profiling statistics as in the *note run(): 428b. + function above. + + -- Class: profile.Profile (timer=None, timeunit=0.0, subcalls=True, + builtins=True) + + This class is normally only used if more precise control over + profiling is needed than what the ‘cProfile.run()’ function + provides. + + A custom timer can be supplied for measuring how long code takes to + run via the 'timer' argument. This must be a function that returns + a single number representing the current time. If the number is an + integer, the 'timeunit' specifies a multiplier that specifies the + duration of each unit of time. For example, if the timer returns + times measured in thousands of seconds, the time unit would be + ‘.001’. + + Directly using the *note Profile: 9e2. class allows formatting + profile results without writing the profile data to a file: + + import cProfile, pstats, io + from pstats import SortKey + pr = cProfile.Profile() + pr.enable() + # ... do something ... + pr.disable() + s = io.StringIO() + sortby = SortKey.CUMULATIVE + ps = pstats.Stats(pr, stream=s).sort_stats(sortby) + ps.print_stats() + print(s.getvalue()) + + The *note Profile: 9e2. class can also be used as a context manager + (supported only in *note cProfile: 27. module. see *note Context + Manager Types: 1fbf.): + + import cProfile + + with cProfile.Profile() as pr: + # ... do something ... + + pr.print_stats() + + Changed in version 3.8: Added context manager support. + + -- Method: enable () + + Start collecting profiling data. Only in *note cProfile: 27. + + -- Method: disable () + + Stop collecting profiling data. Only in *note cProfile: 27. + + -- Method: create_stats () + + Stop collecting profiling data and record the results + internally as the current profile. + + -- Method: print_stats (sort=-1) + + Create a *note Stats: 4282. object based on the current + profile and print the results to stdout. + + The 'sort' parameter specifies the sorting order of the + displayed statistics. It accepts a single key or a tuple of + keys to enable multi-level sorting, as in *note + Stats.sort_stats: 4286. + + Added in version 3.13: *note print_stats(): 4290. now accepts + a tuple of keys. + + -- Method: dump_stats (filename) + + Write the results of the current profile to 'filename'. + + -- Method: run (cmd) + + Profile the cmd via *note exec(): 17f. + + -- Method: runctx (cmd, globals, locals) + + Profile the cmd via *note exec(): 17f. with the specified + global and local environment. + + -- Method: runcall (func, /, *args, **kwargs) + + Profile ‘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(): 133c. call during the called command/function execution) no +profiling results will be printed. + + +File: python.info, Node: The Stats Class, Next: What Is Deterministic Profiling?, Prev: profile and cProfile Module Reference, Up: The Python Profilers + +5.28.5.4 The ‘Stats’ Class +.......................... + +Analysis of the profiler data is done using the *note Stats: 4282. +class. + + -- Class: pstats.Stats (*filenames or profile, stream=sys.stdout) + + This class constructor creates an instance of a “statistics object” + from a 'filename' (or list of filenames) or from a ‘Profile’ + instance. Output will be printed to the stream specified by + 'stream'. + + The file selected by the above constructor must have been created + by the corresponding version of *note profile: af. or *note + cProfile: 27. To be specific, there is 'no' file compatibility + guaranteed with future versions of this profiler, and there is no + compatibility with files produced by other profilers, or the same + profiler run on a different operating system. If several files are + provided, all the statistics for identical functions will be + coalesced, so that an overall view of several processes can be + considered in a single report. If additional files need to be + combined with data in an existing *note Stats: 4282. object, the + *note add(): 4296. method can be used. + + Instead of reading the profile data from a file, a + ‘cProfile.Profile’ or *note profile.Profile: 9e2. object can be + used as the profile data source. + + *note Stats: 4282. objects have the following methods: + + -- Method: strip_dirs () + + This method for the *note Stats: 4282. class removes all + leading path information from file names. It is very useful + in reducing the size of the printout to fit within (close to) + 80 columns. This method modifies the object, and the stripped + information is lost. After performing a strip operation, the + object is considered to have its entries in a “random” order, + as it was just after object initialization and loading. If + *note strip_dirs(): 4288. causes two function names to be + indistinguishable (they are on the same line of the same + filename, and have the same function name), then the + statistics for these two entries are accumulated into a single + entry. + + -- Method: add (*filenames) + + This method of the *note Stats: 4282. class accumulates + additional profiling information into the current profiling + object. Its arguments should refer to filenames created by + the corresponding version of *note profile.run(): 428b. or + ‘cProfile.run()’. Statistics for identically named (re: file, + line, name) functions are automatically accumulated into + single function statistics. + + -- Method: dump_stats (filename) + + Save the data loaded into the *note Stats: 4282. object to a + file named 'filename'. The file is created if it does not + exist, and is overwritten if it already exists. This is + equivalent to the method of the same name on the *note + profile.Profile: 9e2. and ‘cProfile.Profile’ classes. + + -- Method: sort_stats (*keys) + + This method modifies the *note Stats: 4282. object by sorting + it according to the supplied criteria. The argument can be + either a string or a SortKey enum identifying the basis of a + sort (example: ‘'time'’, ‘'name'’, ‘SortKey.TIME’ or + ‘SortKey.NAME’). The SortKey enums argument have advantage + over the string argument in that it is more robust and less + error prone. + + When more than one key is provided, then additional keys are + used as secondary criteria when there is equality in all keys + selected before them. For example, ‘sort_stats(SortKey.NAME, + SortKey.FILE)’ will sort all the entries according to their + function name, and resolve all ties (identical function names) + by sorting by file name. + + For the string argument, abbreviations can be used for any key + names, as long as the abbreviation is unambiguous. + + The following are the valid string and SortKey: + + Valid String Arg Valid enum Arg Meaning + + ---------------------------------------------------------------------------- + + ‘'calls'’ SortKey.CALLS call count + + + ‘'cumulative'’ SortKey.CUMULATIVE cumulative time + + + ‘'cumtime'’ N/A cumulative time + + + ‘'file'’ N/A file name + + + ‘'filename'’ SortKey.FILENAME file name + + + ‘'module'’ N/A file name + + + ‘'ncalls'’ N/A call count + + + ‘'pcalls'’ SortKey.PCALLS primitive call count + + + ‘'line'’ SortKey.LINE line number + + + ‘'name'’ SortKey.NAME function name + + + ‘'nfl'’ SortKey.NFL name/file/line + + + ‘'stdname'’ SortKey.STDNAME standard name + + + ‘'time'’ SortKey.TIME internal time + + + ‘'tottime'’ N/A internal time + + + Note that all sorts on statistics are in descending order + (placing most time consuming items first), where as name, + file, and line number searches are in ascending order + (alphabetical). The subtle distinction between ‘SortKey.NFL’ + and ‘SortKey.STDNAME’ is that the standard name is a sort of + the name as printed, which means that the embedded line + numbers get compared in an odd way. For example, lines 3, 20, + and 40 would (if the file names were the same) appear in the + string order 20, 3 and 40. In contrast, ‘SortKey.NFL’ does a + numeric compare of the line numbers. In fact, + ‘sort_stats(SortKey.NFL)’ is the same as + ‘sort_stats(SortKey.NAME, SortKey.FILENAME, SortKey.LINE)’. + + For backward-compatibility reasons, the numeric arguments + ‘-1’, ‘0’, ‘1’, and ‘2’ are permitted. They are interpreted + as ‘'stdname'’, ‘'calls'’, ‘'time'’, and ‘'cumulative'’ + respectively. If this old style format (numeric) is used, + only one sort key (the numeric key) will be used, and + additional arguments will be silently ignored. + + Added in version 3.7: Added the SortKey enum. + + -- Method: reverse_order () + + This method for the *note Stats: 4282. class reverses the + ordering of the basic list within the object. Note that by + default ascending vs descending order is properly selected + based on the sort key of choice. + + -- Method: print_stats (*restrictions) + + This method for the *note Stats: 4282. class prints out a + report as described in the *note profile.run(): 428b. + definition. + + The order of the printing is based on the last *note + sort_stats(): 4286. operation done on the object (subject to + caveats in *note add(): 4296. and *note strip_dirs(): 4288.). + + The arguments provided (if any) can be used to limit the list + down to the significant entries. Initially, the list is taken + to be the complete set of profiled functions. Each + restriction is either an integer (to select a count of lines), + or a decimal fraction between 0.0 and 1.0 inclusive (to select + a percentage of lines), or a string that will interpreted as a + regular expression (to pattern match the standard name that is + printed). If several restrictions are provided, then they are + applied sequentially. For example: + + print_stats(.1, 'foo:') + + would first limit the printing to first 10% of list, and then + only print functions that were part of filename ‘.*foo:’. In + contrast, the command: + + print_stats('foo:', .1) + + would limit the list to all functions having file names + ‘.*foo:’, and then proceed to only print the first 10% of + them. + + -- Method: print_callers (*restrictions) + + This method for the *note Stats: 4282. class prints a list of + all functions that called each function in the profiled + database. The ordering is identical to that provided by *note + print_stats(): 4289, and the definition of the restricting + argument is also identical. Each caller is reported on its + own line. The format differs slightly depending on the + profiler that produced the stats: + + * With *note profile: af, a number is shown in parentheses + after each caller to show how many times this specific + call was made. For convenience, a second + non-parenthesized number repeats the cumulative time + spent in the function at the right. + + * With *note cProfile: 27, each caller is preceded by three + numbers: the number of times this specific call was made, + and the total and cumulative times spent in the current + function while it was invoked by this specific caller. + + -- Method: print_callees (*restrictions) + + This method for the *note Stats: 4282. class prints a list of + all function that were called by the indicated function. + Aside from this reversal of direction of calls (re: called vs + was called by), the arguments and ordering are identical to + the *note print_callers(): 4299. method. + + -- Method: get_stats_profile () + + This method returns an instance of StatsProfile, which + contains a mapping of function names to instances of + FunctionProfile. Each FunctionProfile instance holds + information related to the function’s profile such as how long + the function took to run, how many times it was called, etc… + + Added in version 3.9: Added the following dataclasses: + StatsProfile, FunctionProfile. Added the following function: + get_stats_profile. + + +File: python.info, Node: What Is Deterministic Profiling?, Next: Limitations, Prev: The Stats Class, Up: The Python Profilers + +5.28.5.5 What Is Deterministic Profiling? +......................................... + +'Deterministic profiling' is meant to reflect the fact that all +'function call', 'function return', and 'exception' events are +monitored, and precise timings are made for the intervals between these +events (during which time the user’s code is executing). In contrast, +'statistical profiling' (which is not done by this module) randomly +samples the effective instruction pointer, and deduces where time is +being spent. The latter technique traditionally involves less overhead +(as the code does not need to be instrumented), but provides only +relative indications of where time is being spent. + +In Python, since there is an interpreter active during execution, the +presence of instrumented code is not required in order to do +deterministic profiling. Python automatically provides a 'hook' +(optional callback) for each event. In addition, the interpreted nature +of Python tends to add so much overhead to execution, that deterministic +profiling tends to only add small processing overhead in typical +applications. The result is that deterministic profiling is not that +expensive, yet provides extensive run time statistics about the +execution of a Python program. + +Call count statistics can be used to identify bugs in code (surprising +counts), and to identify possible inline-expansion points (high call +counts). Internal time statistics can be used to identify “hot loops” +that should be carefully optimized. Cumulative time statistics should +be used to identify high level errors in the selection of algorithms. +Note that the unusual handling of cumulative times in this profiler +allows statistics for recursive implementations of algorithms to be +directly compared to iterative implementations. + + +File: python.info, Node: Limitations, Next: Calibration, Prev: What Is Deterministic Profiling?, Up: The Python Profilers + +5.28.5.6 Limitations +.................... + +One limitation has to do with accuracy of timing information. There is +a fundamental problem with deterministic profilers involving accuracy. +The most obvious restriction is that the underlying “clock” is only +ticking at a rate (typically) of about .001 seconds. Hence no +measurements will be more accurate than the underlying clock. If enough +measurements are taken, then the “error” will tend to average out. +Unfortunately, removing this first error induces a second source of +error. + +The second problem is that it “takes a while” from when an event is +dispatched until the profiler’s call to get the time actually 'gets' the +state of the clock. Similarly, there is a certain lag when exiting the +profiler event handler from the time that the clock’s value was obtained +(and then squirreled away), until the user’s code is once again +executing. As a result, functions that are called many times, or call +many functions, will typically accumulate this error. The error that +accumulates in this fashion is typically less than the accuracy of the +clock (less than one clock tick), but it 'can' accumulate and become +very significant. + +The problem is more important with *note profile: af. than with the +lower-overhead *note cProfile: 27. For this reason, *note profile: af. +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: Calibration, Next: Using a custom timer, Prev: Limitations, Up: The Python Profilers + +5.28.5.7 Calibration +.................... + +The profiler of the *note profile: af. 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 Limitations: 429f.). + + import profile + pr = profile.Profile() + for i in range(5): + print(pr.calibrate(10000)) + +The method executes the number of Python calls given by the argument, +directly and again under the profiler, measuring the time for both. It +then computes the hidden overhead per profiler event, and returns that +as a float. For example, on a 1.8Ghz Intel Core i5 running macOS, and +using Python’s time.process_time() as the timer, the magical number is +about 4.04e-6. + +The object of this exercise is to get a fairly consistent result. If +your computer is 'very' fast, or your timer function has poor +resolution, you might have to pass 100000, or even 1000000, to get +consistent results. + +When you have a consistent answer, there are three ways you can use it: + + 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) + +If you have a choice, you are better off choosing a smaller constant, +and then your results will “less often” show up as negative in profile +statistics. + + +File: python.info, Node: Using a custom timer, Prev: Calibration, Up: The Python Profilers + +5.28.5.8 Using a custom timer +............................. + +If you want to change how current time is determined (for example, to +force use of wall-clock time or elapsed process time), pass the timing +function you want to the ‘Profile’ class constructor: + + pr = profile.Profile(your_time_func) + +The resulting profiler will then call ‘your_time_func’. Depending on +whether you are using *note profile.Profile: 9e2. or ‘cProfile.Profile’, +‘your_time_func’’s return value will be interpreted differently: + +*note profile.Profile: 9e2. + + ‘your_time_func’ should return a single number, or a list of + numbers whose sum is the current time (like what *note os.times(): + 1109. returns). If the function returns a single time number, or + the list of returned numbers has length 2, then you will get an + especially fast version of the dispatch routine. + + Be warned that you should calibrate the profiler class for the + timer function that you choose (see *note Calibration: 42a1.). 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(): 1109. is 'pretty' bad, as it returns a tuple of + floating-point values). If you want to substitute a better timer + in the cleanest fashion, derive a class and hardwire a replacement + dispatch method that best handles your timer call, along with the + appropriate calibration constant. + +‘cProfile.Profile’ + + ‘your_time_func’ should return a single number. If it returns + integers, you can also invoke the class constructor with a second + argument specifying the real duration of one unit of time. For + example, if ‘your_integer_time_func’ returns times measured in + thousands of seconds, you would construct the ‘Profile’ instance as + follows: + + pr = cProfile.Profile(your_integer_time_func, 0.001) + + As the ‘cProfile.Profile’ class cannot be calibrated, custom timer + functions should be used with care and should be as fast as + possible. For the best results with a custom timer, it might be + necessary to hard-code it in the C source of the internal ‘_lsprof’ + module. + +Python 3.3 adds several new functions in *note time: ee. that can be +used to make precise measurements of process or wall-clock time. For +example, see *note time.perf_counter(): a88. + + +File: python.info, Node: timeit — Measure execution time of small code snippets, Next: trace — Trace or track Python statement execution, Prev: The Python Profilers, Up: Debugging and Profiling + +5.28.6 ‘timeit’ — Measure execution time of small code snippets +--------------------------------------------------------------- + +'Source code:' Lib/timeit.py(1) + +__________________________________________________________________ + +This module provides a simple way to time small bits of Python code. It +has both a *note Command-Line Interface: 42a6. as well as a *note +callable: 42a7. one. It avoids a number of common traps for measuring +execution times. See also Tim Peters’ introduction to the “Algorithms” +chapter in the second edition of 'Python Cookbook', published by +O’Reilly. + +* Menu: + +* Basic Examples: Basic Examples<2>. +* Python Interface:: +* Command-Line Interface: Command-Line Interface<4>. +* Examples: Examples<30>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/timeit.py + + +File: python.info, Node: Basic Examples<2>, Next: Python Interface, Up: timeit — Measure execution time of small code snippets + +5.28.6.1 Basic Examples +....................... + +The following example shows how the *note Command-Line Interface: 42a6. +can be used to compare three different expressions: + + $ 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 + +This can be achieved from the *note Python Interface: 42a7. with: + + >>> 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 + +A callable can also be passed from the *note Python Interface: 42a7.: + + >>> timeit.timeit(lambda: "-".join(map(str, range(100))), number=10000) + 0.19665591977536678 + +Note however that *note timeit(): e79. will automatically determine the +number of repetitions only when the command-line interface is used. In +the *note Examples: 42a9. section you can find more advanced examples. + + +File: python.info, Node: Python Interface, Next: Command-Line Interface<4>, Prev: Basic Examples<2>, Up: timeit — Measure execution time of small code snippets + +5.28.6.2 Python Interface +......................... + +The module defines three convenience functions and a public class: + + -- Function: timeit.timeit (stmt='pass', setup='pass', timer=<default + timer>, number=1000000, globals=None) + + Create a *note Timer: 1491. instance with the given statement, + 'setup' code and 'timer' function and run its *note timeit(): ced. + method with 'number' executions. The optional 'globals' argument + specifies a namespace in which to execute the code. + + Changed in version 3.5: The optional 'globals' parameter was added. + + -- Function: timeit.repeat (stmt='pass', setup='pass', timer=<default + timer>, repeat=5, number=1000000, globals=None) + + Create a *note Timer: 1491. instance with the given statement, + 'setup' code and 'timer' function and run its *note repeat(): 42ac. + method with the given 'repeat' count and 'number' executions. The + optional 'globals' argument specifies a namespace in which to + execute the code. + + Changed in version 3.5: The optional 'globals' parameter was added. + + Changed in version 3.7: Default value of 'repeat' changed from 3 to + 5. + + -- Function: timeit.default_timer () + + The default timer, which is always time.perf_counter(), returns + float seconds. An alternative, time.perf_counter_ns, returns + integer nanoseconds. + + Changed in version 3.3: *note time.perf_counter(): a88. is now the + default timer. + + -- Class: timeit.Timer (stmt='pass', setup='pass', timer=<timer + function>, globals=None) + + Class for timing execution speed of small code snippets. + + The constructor takes a statement to be timed, an additional + statement used for setup, and a timer function. Both statements + default to ‘'pass'’; the timer function is platform-dependent (see + the module doc string). 'stmt' and 'setup' may also contain + multiple statements separated by ‘;’ or newlines, as long as they + don’t contain multi-line string literals. The statement will by + default be executed within timeit’s namespace; this behavior can be + controlled by passing a namespace to 'globals'. + + To measure the execution time of the first statement, use the *note + timeit(): ced. method. The *note repeat(): 42ac. and *note + autorange(): cec. methods are convenience methods to call *note + timeit(): ced. multiple times. + + The execution time of 'setup' is excluded from the overall timed + execution run. + + The 'stmt' and 'setup' parameters can also take objects that are + callable without arguments. This will embed calls to them in a + timer function that will then be executed by *note timeit(): ced. + Note that the timing overhead is a little larger in this case + because of the extra function calls. + + Changed in version 3.5: The optional 'globals' parameter was added. + + -- Method: timeit (number=1000000) + + Time 'number' executions of the main statement. This executes + the setup statement once, and then returns the time it takes + to execute the main statement a number of times. The default + timer returns seconds as a float. The argument is the number + of times through the loop, defaulting to one million. The + main statement, the setup statement and the timer function to + be used are passed to the constructor. + + Note: By default, *note timeit(): ced. temporarily turns + off *note garbage collection: 1919. during the timing. + The advantage of this approach is that it makes + independent timings more comparable. The disadvantage is + that GC may be an important component of the performance + of the function being measured. If so, GC can be + re-enabled as the first statement in the 'setup' string. + For example: + + timeit.Timer('for i in range(10): oct(i)', 'gc.enable()').timeit() + + -- Method: autorange (callback=None) + + Automatically determine how many times to call *note timeit(): + ced. + + This is a convenience function that calls *note timeit(): ced. + repeatedly so that the total time >= 0.2 second, returning the + eventual (number of loops, time taken for that number of + loops). It calls *note timeit(): ced. with increasing numbers + from the sequence 1, 2, 5, 10, 20, 50, … until the time taken + is at least 0.2 seconds. + + If 'callback' is given and is not ‘None’, it will be called + after each trial with two arguments: ‘callback(number, + time_taken)’. + + Added in version 3.6. + + -- Method: repeat (repeat=5, number=1000000) + + Call *note timeit(): ced. a few times. + + This is a convenience function that calls the *note timeit(): + ced. repeatedly, returning a list of results. The first + argument specifies how many times to call *note timeit(): ced. + The second argument specifies the 'number' argument for *note + timeit(): ced. + + Note: It’s tempting to calculate mean and standard + deviation from the result vector and report these. + However, this is not very useful. In a typical case, the + lowest value gives a lower bound for how fast your + machine can run the given code snippet; higher values in + the result vector are typically not caused by variability + in Python’s speed, but by other processes interfering + with your timing accuracy. So the *note min(): f03. of + the result is probably the only number you should be + interested in. After that, you should look at the entire + vector and apply common sense rather than statistics. + + Changed in version 3.7: Default value of 'repeat' changed from + 3 to 5. + + -- Method: print_exc (file=None) + + Helper to print a traceback from the timed code. + + Typical use: + + t = Timer(...) # outside the try/except + try: + t.timeit(...) # or t.repeat(...) + except Exception: + t.print_exc() + + The advantage over the standard traceback is that source lines + in the compiled template will be displayed. The optional + 'file' argument directs where the traceback is sent; it + defaults to *note sys.stderr: 939. + + +File: python.info, Node: Command-Line Interface<4>, Next: Examples<30>, Prev: Python Interface, Up: timeit — Measure execution time of small code snippets + +5.28.6.3 Command-Line Interface +............................... + +When called as a program from the command line, the following form is +used: + + python -m timeit [-n N] [-r N] [-u U] [-s S] [-p] [-v] [-h] [statement ...] + +Where the following options are understood: + + -- Option: -n N, --number=N + + how many times to execute ‘statement’ + + -- Option: -r N, --repeat=N + + how many times to repeat the timer (default 5) + + -- Option: -s S, --setup=S + + statement to be executed once initially (default ‘pass’) + + -- Option: -p, --process + + measure process time, not wallclock time, using *note + time.process_time(): a89. instead of *note time.perf_counter(): + a88, which is the default + + Added in version 3.3. + + -- Option: -u, --unit=U + + specify a time unit for timer output; can select ‘nsec’, ‘usec’, + ‘msec’, or ‘sec’ + + Added in version 3.5. + + -- Option: -v, --verbose + + print raw timing results; repeat for more digits precision + + -- Option: -h, --help + + print a short usage message and exit + +A multi-line statement may be given by specifying each line as a +separate statement argument; indented lines are possible by enclosing an +argument in quotes and using leading spaces. Multiple *note -s: 42b4. +options are treated similarly. + +If *note -n: 42b0. is not given, a suitable number of loops is +calculated by trying increasing numbers from the sequence 1, 2, 5, 10, +20, 50, … until the total time is at least 0.2 seconds. + +*note default_timer(): 42ad. measurements can be affected by other +programs running on the same machine, so the best thing to do when +accurate timing is necessary is to repeat the timing a few times and use +the best time. The *note -r: 42b2. option is good for this; the default +of 5 repetitions is probably enough in most cases. You can use *note +time.process_time(): a89. to measure CPU time. + + Note: There is a certain baseline overhead associated with + executing a pass statement. The code here doesn’t try to hide it, + but you should be aware of it. The baseline overhead can be + measured by invoking the program without arguments, and it might + differ between Python versions. + + +File: python.info, Node: Examples<30>, Prev: Command-Line Interface<4>, Up: timeit — Measure execution time of small code snippets + +5.28.6.4 Examples +................. + +It is possible to provide a setup statement that is executed only once +at the beginning: + + $ 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 + +In the output, there are three fields. The loop count, which tells you +how many times the statement body was run per timing loop repetition. +The repetition count (‘best of 5’) which tells you how many times the +timing loop was repeated, and finally the time the statement body took +on average within the best repetition of the timing loop. That is, the +time the fastest repetition took divided by the loop count. + + >>> 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 + +The same can be done using the *note Timer: 1491. class and its methods: + + >>> 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] + +The following examples show how to time expressions that contain +multiple lines. Here we compare the cost of using *note hasattr(): 4ce. +vs. *note try: 6e4./*note except: 18b. to test for missing and present +object attributes: + + $ 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 *note timeit: ef. 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")) + +Another option is to pass *note globals(): 1867. to the 'globals' +parameter, which will cause the code to be executed within your current +global namespace. This can be more convenient than individually +specifying imports: + + 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 — Trace or track Python statement execution, Next: tracemalloc — Trace memory allocations, Prev: timeit — Measure execution time of small code snippets, Up: Debugging and Profiling + +5.28.7 ‘trace’ — Trace or track Python statement execution +---------------------------------------------------------- + +'Source code:' Lib/trace.py(1) + +__________________________________________________________________ + +The *note trace: fd. 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. + +See also +........ + +Coverage.py(2) + + A popular third-party coverage tool that provides HTML output along + with advanced features such as branch coverage. + +* Menu: + +* Command-Line Usage: Command-Line Usage<3>. +* Programmatic Interface:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/trace.py + + (2) https://coverage.readthedocs.io/ + + +File: python.info, Node: Command-Line Usage<3>, Next: Programmatic Interface, Up: trace — Trace or track Python statement execution + +5.28.7.1 Command-Line Usage +........................... + +The *note trace: fd. module can be invoked from the command line. It +can be as simple as + + python -m trace --count -C . somefile.py ... + +The above will execute ‘somefile.py’ and generate annotated listings of +all Python modules imported during the execution into the current +directory. + + -- Option: --help + + Display usage and exit. + + -- Option: --version + + Display the version of the module and exit. + +Added in version 3.8: Added ‘--module’ option that allows to run an +executable module. + +* Menu: + +* Main options:: +* Modifiers:: +* Filters:: + + +File: python.info, Node: Main options, Next: Modifiers, Up: Command-Line Usage<3> + +5.28.7.2 Main options +..................... + +At least one of the following options must be specified when invoking +*note trace: fd. The *note -listfuncs: 42c6. option is mutually +exclusive with the *note -trace: 42c7. and *note -count: 42c8. options. +When *note -listfuncs: 42c6. is provided, neither *note -count: 42c8. +nor *note -trace: 42c7. are accepted, and vice versa. + + -- Option: -c, --count + + Produce a set of annotated listing files upon program completion + that shows how many times each statement was executed. See also + *note -coverdir: 42ca, *note -file: 42cb. and *note -no-report: + 42cc. below. + + -- Option: -t, --trace + + Display lines as they are executed. + + -- Option: -l, --listfuncs + + Display the functions executed by running the program. + + -- Option: -r, --report + + Produce an annotated list from an earlier program run that used the + *note -count: 42c8. and *note -file: 42cb. option. This does not + execute any code. + + -- Option: -T, --trackcalls + + Display the calling relationships exposed by running the program. + + +File: python.info, Node: Modifiers, Next: Filters, Prev: Main options, Up: Command-Line Usage<3> + +5.28.7.3 Modifiers +.................. + + -- Option: -f, --file=<file> + + Name of a file to accumulate counts over several tracing runs. + Should be used with the *note -count: 42c8. option. + + -- Option: -C, --coverdir=<dir> + + Directory where the report files go. The coverage report for + ‘package.module’ is written to file + ‘`dir'/`package'/`module'.cover’. + + -- Option: -m, --missing + + When generating annotated listings, mark lines which were not + executed with ‘>>>>>>’. + + -- Option: -s, --summary + + When using *note -count: 42c8. or *note -report: 42cf, write a + brief summary to stdout for each file processed. + + -- Option: -R, --no-report + + Do not generate annotated listings. This is useful if you intend + to make several runs with *note -count: 42c8, and then produce a + single set of annotated listings at the end. + + -- Option: -g, --timing + + Prefix each line with the time since the program started. Only + used while tracing. + + +File: python.info, Node: Filters, Prev: Modifiers, Up: Command-Line Usage<3> + +5.28.7.4 Filters +................ + +These options may be repeated multiple times. + + -- Option: --ignore-module=<mod> + + Ignore each of the given module names and its submodules (if it is + a package). The argument can be a list of names separated by a + comma. + + -- Option: --ignore-dir=<dir> + + Ignore all modules and packages in the named directory and + subdirectories. The argument can be a list of directories + separated by *note os.pathsep: 1d44. + + +File: python.info, Node: Programmatic Interface, Prev: Command-Line Usage<3>, Up: trace — Trace or track Python statement execution + +5.28.7.5 Programmatic Interface +............................... + + -- Class: trace.Trace (count=1, trace=1, countfuncs=0, countcallers=0, + ignoremods=(), ignoredirs=(), infile=None, outfile=None, + timing=False) + + Create an object to trace execution of a single statement or + expression. All parameters are optional. 'count' enables counting + of line numbers. 'trace' enables line execution tracing. + 'countfuncs' enables listing of the functions called during the + run. 'countcallers' enables call relationship tracking. + 'ignoremods' is a list of modules or packages to ignore. + 'ignoredirs' is a list of directories whose modules or packages + should be ignored. 'infile' is the name of the file from which to + read stored count information. 'outfile' is the name of the file + in which to write updated count information. 'timing' enables a + timestamp relative to when tracing was started to be displayed. + + -- Method: run (cmd) + + Execute the command and gather statistics from the execution + with the current tracing parameters. 'cmd' must be a string + or code object, suitable for passing into *note exec(): 17f. + + -- Method: runctx (cmd, globals=None, locals=None) + + Execute the command and gather statistics from the execution + with the current tracing parameters, in the defined global and + local environments. If not defined, 'globals' and 'locals' + default to empty dictionaries. + + -- Method: runfunc (func, /, *args, **kwds) + + Call 'func' with the given arguments under control of the + *note Trace: 42e2. object with the current tracing parameters. + + -- Method: results () + + Return a *note CoverageResults: 42e6. object that contains the + cumulative results of all previous calls to ‘run’, ‘runctx’ + and ‘runfunc’ for the given *note Trace: 42e2. instance. Does + not reset the accumulated trace results. + + -- Class: trace.CoverageResults + + A container for coverage results, created by *note Trace.results(): + 42e5. Should not be created directly by the user. + + -- Method: update (other) + + Merge in data from another *note CoverageResults: 42e6. + object. + + -- Method: write_results (show_missing=True, summary=False, + coverdir=None, *, ignore_missing_files=False) + + Write coverage results. Set 'show_missing' to show lines that + had no hits. Set 'summary' to include in the output the + coverage summary per module. 'coverdir' specifies the + directory into which the coverage result files will be output. + If ‘None’, the results for each source file are placed in its + directory. + + If 'ignore_missing_files' is ‘True’, coverage counts for files + that no longer exist are silently ignored. Otherwise, a + missing file will raise a *note FileNotFoundError: 427. + + Changed in version 3.13: Added 'ignore_missing_files' + parameter. + +A simple example demonstrating the use of the programmatic interface: + + 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 — Trace memory allocations, Prev: trace — Trace or track Python statement execution, Up: Debugging and Profiling + +5.28.8 ‘tracemalloc’ — Trace memory allocations +----------------------------------------------- + +Added in version 3.4. + +'Source code:' Lib/tracemalloc.py(1) + +__________________________________________________________________ + +The tracemalloc module is a debug tool to trace memory blocks allocated +by Python. It provides the following information: + + * Traceback where an object was allocated + + * Statistics on allocated memory blocks per filename and per line + number: total size, number and average size of allocated memory + blocks + + * Compute the differences between two snapshots to detect memory + leaks + +To trace most memory blocks allocated by Python, the module should be +started as early as possible by setting the *note PYTHONTRACEMALLOC: +1d3c. environment variable to ‘1’, or by using *note -X: 176. +‘tracemalloc’ command line option. The *note tracemalloc.start(): 1d3b. +function can be called at runtime to start tracing Python memory +allocations. + +By default, a trace of an allocated memory block only stores the most +recent frame (1 frame). To store 25 frames at startup: set the *note +PYTHONTRACEMALLOC: 1d3c. environment variable to ‘25’, or use the *note +-X: 176. ‘tracemalloc=25’ command line option. + +* Menu: + +* Examples: Examples<31>. +* API:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tracemalloc.py + + +File: python.info, Node: Examples<31>, Next: API, Up: tracemalloc — Trace memory allocations + +5.28.8.1 Examples +................. + +* Menu: + +* Display the top 10:: +* Compute differences:: +* Get the traceback of a memory block:: +* Pretty top:: + + +File: python.info, Node: Display the top 10, Next: Compute differences, Up: Examples<31> + +5.28.8.2 Display the top 10 +........................... + +Display the 10 files allocating the most memory: + + 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) + +Example of output of the Python test suite: + + [ 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 + +We can see that Python loaded ‘4855 KiB’ data (bytecode and constants) +from modules and that the *note collections: 1d. module allocated ‘244 +KiB’ to build *note namedtuple: 1ca. types. + +See *note Snapshot.statistics(): 42ed. for more options. + + +File: python.info, Node: Compute differences, Next: Get the traceback of a memory block, Prev: Display the top 10, Up: Examples<31> + +5.28.8.3 Compute differences +............................ + +Take two snapshots and display the differences: + + 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) + +Example of output before/after running some tests of the Python test +suite: + + [ 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 + +We can see that Python has loaded ‘8173 KiB’ of module data (bytecode +and constants), and that this is ‘4428 KiB’ more than had been loaded +before the tests, when the previous snapshot was taken. Similarly, the +*note linecache: 85. module has cached ‘940 KiB’ of Python source code +to format tracebacks, all of it since the previous snapshot. + +If the system has little free memory, snapshots can be written on disk +using the *note Snapshot.dump(): 42ef. method to analyze the snapshot +offline. Then use the *note Snapshot.load(): 42f0. method reload the +snapshot. + + +File: python.info, Node: Get the traceback of a memory block, Next: Pretty top, Prev: Compute differences, Up: Examples<31> + +5.28.8.4 Get the traceback of a memory block +............................................ + +Code to display the traceback of the biggest memory block: + + 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) + +Example of output of the Python test suite (traceback limited to 25 +frames): + + 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: +77. module to load data (bytecode and constants) from modules: ‘870.1 +KiB’. The traceback is where the *note importlib: 77. loaded data most +recently: on the ‘import pdb’ line of the *note doctest: 3a. module. +The traceback may change if a new module is loaded. + + +File: python.info, Node: Pretty top, Prev: Get the traceback of a memory block, Up: Examples<31> + +5.28.8.5 Pretty top +................... + +Code to display the 10 lines allocating the most memory with a pretty +output, ignoring ‘<frozen importlib._bootstrap>’ and ‘<unknown>’ files: + + 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) + +Example of output of the Python test suite: + + 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 + +See *note Snapshot.statistics(): 42ed. for more options. + +* 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: Pretty top + +5.28.8.6 Record the current and peak size of all traced memory blocks +..................................................................... + +The following code computes two sums like ‘0 + 1 + 2 + ...’ +inefficiently, by creating a list of those numbers. This list consumes +a lot of memory temporarily. We can use *note get_traced_memory(): +42f4. and *note reset_peak(): 93b. 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=}") + +Output: + + first_size=664, first_peak=3592984 + second_size=804, second_peak=29704 + +Using *note reset_peak(): 93b. 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(): 1d3b. call. Without the call to *note reset_peak(): 93b, +‘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: 60d, and writing +‘sum(range(...))’). + + +File: python.info, Node: API, Prev: Examples<31>, Up: tracemalloc — Trace memory allocations + +5.28.8.7 API +............ + +* Menu: + +* Functions: Functions<11>. +* DomainFilter:: +* Filter:: +* Frame:: +* Snapshot:: +* Statistic:: +* StatisticDiff:: +* Trace:: +* Traceback:: + + +File: python.info, Node: Functions<11>, Next: DomainFilter, Up: API + +5.28.8.8 Functions +.................. + + -- Function: tracemalloc.clear_traces () + + Clear traces of memory blocks allocated by Python. + + See also *note stop(): 1582. + + -- Function: tracemalloc.get_object_traceback (obj) + + Get the traceback where the Python object 'obj' was allocated. + Return a *note Traceback: b96. instance, or ‘None’ if the *note + tracemalloc: ff. module is not tracing memory allocations or did + not trace the allocation of the object. + + See also *note gc.get_referrers(): 800. and *note sys.getsizeof(): + 176a. functions. + + -- Function: tracemalloc.get_traceback_limit () + + Get the maximum number of frames stored in the traceback of a + trace. + + The *note tracemalloc: ff. module must be tracing memory + allocations to get the limit, otherwise an exception is raised. + + The limit is set by the *note start(): 1d3b. function. + + -- Function: tracemalloc.get_traced_memory () + + Get the current size and peak size of memory blocks traced by the + *note tracemalloc: ff. module as a tuple: ‘(current: int, peak: + int)’. + + -- Function: tracemalloc.reset_peak () + + Set the peak size of memory blocks traced by the *note tracemalloc: + ff. module to the current size. + + Do nothing if the *note tracemalloc: ff. 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(): 42f7. + Snapshots taken with *note take_snapshot(): 42f9. before a call to + *note reset_peak(): 93b. can be meaningfully compared to snapshots + taken after the call. + + See also *note get_traced_memory(): 42f4. + + Added in version 3.9. + + -- Function: tracemalloc.get_tracemalloc_memory () + + Get the memory usage in bytes of the *note tracemalloc: ff. module + used to store traces of memory blocks. Return an *note int: 259. + + -- Function: tracemalloc.is_tracing () + + ‘True’ if the *note tracemalloc: ff. module is tracing Python + memory allocations, ‘False’ otherwise. + + See also *note start(): 1d3b. and *note stop(): 1582. functions. + + -- Function: tracemalloc.start (nframe: int = 1) + + Start tracing Python memory allocations: install hooks on Python + memory allocators. Collected tracebacks of traces will be limited + to 'nframe' frames. By default, a trace of a memory block only + stores the most recent frame: the limit is ‘1’. 'nframe' must be + greater or equal to ‘1’. + + You can still read the original number of total frames that + composed the traceback by looking at the *note + Traceback.total_nframe: 42fc. attribute. + + Storing more than ‘1’ frame is only useful to compute statistics + grouped by ‘'traceback'’ or to compute cumulative statistics: see + the *note Snapshot.compare_to(): 42fd. and *note + Snapshot.statistics(): 42ed. methods. + + Storing more frames increases the memory and CPU overhead of the + *note tracemalloc: ff. module. Use the *note + get_tracemalloc_memory(): 42fa. function to measure how much memory + is used by the *note tracemalloc: ff. module. + + The *note PYTHONTRACEMALLOC: 1d3c. environment variable + (‘PYTHONTRACEMALLOC=NFRAME’) and the *note -X: 176. + ‘tracemalloc=NFRAME’ command line option can be used to start + tracing at startup. + + See also *note stop(): 1582, *note is_tracing(): 42fb. and *note + get_traceback_limit(): 42f8. functions. + + -- Function: tracemalloc.stop () + + Stop tracing Python memory allocations: uninstall hooks on Python + memory allocators. Also clears all previously collected traces of + memory blocks allocated by Python. + + Call *note take_snapshot(): 42f9. function to take a snapshot of + traces before clearing them. + + See also *note start(): 1d3b, *note is_tracing(): 42fb. and *note + clear_traces(): 42f7. functions. + + -- Function: tracemalloc.take_snapshot () + + Take a snapshot of traces of memory blocks allocated by Python. + Return a new *note Snapshot: 42fe. instance. + + The snapshot does not include memory blocks allocated before the + *note tracemalloc: ff. module started to trace memory allocations. + + Tracebacks of traces are limited to *note get_traceback_limit(): + 42f8. frames. Use the 'nframe' parameter of the *note start(): + 1d3b. function to store more frames. + + The *note tracemalloc: ff. module must be tracing memory + allocations to take a snapshot, see the *note start(): 1d3b. + function. + + See also the *note get_object_traceback(): 1b57. function. + + +File: python.info, Node: DomainFilter, Next: Filter, Prev: Functions<11>, Up: API + +5.28.8.9 DomainFilter +..................... + + -- Class: tracemalloc.DomainFilter (inclusive: bool, domain: int) + + Filter traces of memory blocks by their address space (domain). + + Added in version 3.6. + + -- Attribute: inclusive + + If 'inclusive' is ‘True’ (include), match memory blocks + allocated in the address space *note domain: 4301. + + If 'inclusive' is ‘False’ (exclude), match memory blocks not + allocated in the address space *note domain: 4301. + + -- Attribute: domain + + Address space of a memory block (‘int’). Read-only property. + + +File: python.info, Node: Filter, Next: Frame, Prev: DomainFilter, Up: API + +5.28.8.10 Filter +................ + + -- Class: tracemalloc.Filter (inclusive: bool, filename_pattern: str, + lineno: int = None, all_frames: bool = False, domain: int = + None) + + Filter on traces of memory blocks. + + See the *note fnmatch.fnmatch(): 189f. function for the syntax of + 'filename_pattern'. The ‘'.pyc'’ file extension is replaced with + ‘'.py'’. + + Examples: + + * ‘Filter(True, subprocess.__file__)’ only includes traces of + the *note subprocess: d6. module + + * ‘Filter(False, tracemalloc.__file__)’ excludes traces of the + *note tracemalloc: ff. module + + * ‘Filter(False, "<unknown>")’ excludes empty tracebacks + + Changed in version 3.5: The ‘'.pyo'’ file extension is no longer + replaced with ‘'.py'’. + + Changed in version 3.6: Added the *note domain: 4304. attribute. + + -- Attribute: 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. + + -- Attribute: inclusive + + If 'inclusive' is ‘True’ (include), only match memory blocks + allocated in a file with a name matching *note + filename_pattern: 4306. at line number *note lineno: 4307. + + If 'inclusive' is ‘False’ (exclude), ignore memory blocks + allocated in a file with a name matching *note + filename_pattern: 4306. at line number *note lineno: 4307. + + -- Attribute: lineno + + Line number (‘int’) of the filter. If 'lineno' is ‘None’, the + filter matches any line number. + + -- Attribute: filename_pattern + + Filename pattern of the filter (‘str’). Read-only property. + + -- Attribute: all_frames + + If 'all_frames' is ‘True’, all frames of the traceback are + checked. If 'all_frames' is ‘False’, only the most recent + frame is checked. + + This attribute has no effect if the traceback limit is ‘1’. + See the *note get_traceback_limit(): 42f8. function and *note + Snapshot.traceback_limit: 4309. attribute. + + +File: python.info, Node: Frame, Next: Snapshot, Prev: Filter, Up: API + +5.28.8.11 Frame +............... + + -- Class: tracemalloc.Frame + + Frame of a traceback. + + The *note Traceback: b96. class is a sequence of *note Frame: 430b. + instances. + + -- Attribute: filename + + Filename (‘str’). + + -- Attribute: lineno + + Line number (‘int’). + + +File: python.info, Node: Snapshot, Next: Statistic, Prev: Frame, Up: API + +5.28.8.12 Snapshot +.................. + + -- Class: tracemalloc.Snapshot + + Snapshot of traces of memory blocks allocated by Python. + + The *note take_snapshot(): 42f9. function creates a snapshot + instance. + + -- Method: compare_to (old_snapshot: Snapshot, key_type: str, + cumulative: bool = False) + + Compute the differences with an old snapshot. Get statistics + as a sorted list of *note StatisticDiff: 430f. instances + grouped by 'key_type'. + + See the *note Snapshot.statistics(): 42ed. method for + 'key_type' and 'cumulative' parameters. + + The result is sorted from the biggest to the smallest by: + absolute value of *note StatisticDiff.size_diff: 4310, *note + StatisticDiff.size: 4311, absolute value of *note + StatisticDiff.count_diff: 4312, *note Statistic.count: 4313. + and then by *note StatisticDiff.traceback: 4314. + + -- Method: dump (filename) + + Write the snapshot into a file. + + Use *note load(): 42f0. to reload the snapshot. + + -- Method: filter_traces (filters) + + Create a new *note Snapshot: 42fe. instance with a filtered + *note traces: 4316. sequence, 'filters' is a list of *note + DomainFilter: cf1. and *note Filter: 4303. instances. If + 'filters' is an empty list, return a new *note Snapshot: 42fe. + 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. + + Changed in version 3.6: *note DomainFilter: cf1. instances are + now also accepted in 'filters'. + + -- Method: classmethod load (filename) + + Load a snapshot from a file. + + See also *note dump(): 42ef. + + -- Method: statistics (key_type: str, cumulative: bool = False) + + Get statistics as a sorted list of *note Statistic: 4317. + instances grouped by 'key_type': + + key_type description + + ------------------------------------------------------- + + ‘'filename'’ filename + + + ‘'lineno'’ filename and line number + + + ‘'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' equals to ‘'filename'’ and ‘'lineno'’. + + The result is sorted from the biggest to the smallest by: + *note Statistic.size: 4318, *note Statistic.count: 4313. and + then by *note Statistic.traceback: 4319. + + -- Attribute: traceback_limit + + Maximum number of frames stored in the traceback of *note + traces: 4316.: result of the *note get_traceback_limit(): + 42f8. when the snapshot was taken. + + -- Attribute: traces + + Traces of all memory blocks allocated by Python: sequence of + *note Trace: 431a. instances. + + The sequence has an undefined order. Use the *note + Snapshot.statistics(): 42ed. method to get a sorted list of + statistics. + + +File: python.info, Node: Statistic, Next: StatisticDiff, Prev: Snapshot, Up: API + +5.28.8.13 Statistic +................... + + -- Class: tracemalloc.Statistic + + Statistic on memory allocations. + + *note Snapshot.statistics(): 42ed. returns a list of *note + Statistic: 4317. instances. + + See also the *note StatisticDiff: 430f. class. + + -- Attribute: count + + Number of memory blocks (‘int’). + + -- Attribute: size + + Total size of memory blocks in bytes (‘int’). + + -- Attribute: traceback + + Traceback where the memory block was allocated, *note + Traceback: b96. instance. + + +File: python.info, Node: StatisticDiff, Next: Trace, Prev: Statistic, Up: API + +5.28.8.14 StatisticDiff +....................... + + -- Class: tracemalloc.StatisticDiff + + Statistic difference on memory allocations between an old and a new + *note Snapshot: 42fe. instance. + + *note Snapshot.compare_to(): 42fd. returns a list of *note + StatisticDiff: 430f. instances. See also the *note Statistic: + 4317. class. + + -- Attribute: count + + Number of memory blocks in the new snapshot (‘int’): ‘0’ if + the memory blocks have been released in the new snapshot. + + -- Attribute: count_diff + + Difference of number of memory blocks between the old and the + new snapshots (‘int’): ‘0’ if the memory blocks have been + allocated in the new snapshot. + + -- Attribute: size + + Total size of memory blocks in bytes in the new snapshot + (‘int’): ‘0’ if the memory blocks have been released in the + new snapshot. + + -- Attribute: size_diff + + Difference of total size of memory blocks in bytes between the + old and the new snapshots (‘int’): ‘0’ if the memory blocks + have been allocated in the new snapshot. + + -- Attribute: traceback + + Traceback where the memory blocks were allocated, *note + Traceback: b96. instance. + + +File: python.info, Node: Trace, Next: Traceback, Prev: StatisticDiff, Up: API + +5.28.8.15 Trace +............... + + -- Class: tracemalloc.Trace + + Trace of a memory block. + + The *note Snapshot.traces: 4316. attribute is a sequence of *note + Trace: 431a. instances. + + Changed in version 3.6: Added the *note domain: 431f. attribute. + + -- Attribute: 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. + + -- Attribute: size + + Size of the memory block in bytes (‘int’). + + -- Attribute: traceback + + Traceback where the memory block was allocated, *note + Traceback: b96. instance. + + +File: python.info, Node: Traceback, Prev: Trace, Up: API + +5.28.8.16 Traceback +................... + + -- Class: tracemalloc.Traceback + + Sequence of *note Frame: 430b. 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(): 42f8. frames. See the *note + take_snapshot(): 42f9. function. The original number of frames of + the traceback is stored in the *note Traceback.total_nframe: 42fc. + attribute. That allows to know if a traceback has been truncated + by the traceback limit. + + The *note Trace.traceback: 4321. attribute is an instance of *note + Traceback: b96. instance. + + Changed in version 3.7: Frames are now sorted from the oldest to + the most recent, instead of most recent to oldest. + + -- Attribute: 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. + + Changed in version 3.9: The *note Traceback.total_nframe: 42fc. + attribute was added. + + -- Method: format (limit=None, most_recent_first=False) + + Format the traceback as a list of lines. Use the *note + linecache: 85. 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(): 4323. function, + except that *note format(): b97. does not include newlines. + + Example: + + print("Traceback (most recent call first):") + for line in traceback: + print(line) + + Output: + + 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: Software Packaging and Distribution, Next: Python Runtime Services, Prev: Debugging and Profiling, Up: The Python Standard Library + +5.29 Software Packaging and Distribution +======================================== + +These libraries help you with publishing and installing Python software. +While these modules are designed to work in conjunction with the Python +Package Index(1), they can also be used with a local index server, or +without any index server at all. + +* Menu: + +* ensurepip — Bootstrapping the pip installer:: +* venv — Creation of virtual environments:: +* zipapp — Manage executable Python zip archives:: + + ---------- Footnotes ---------- + + (1) https://pypi.org + + +File: python.info, Node: ensurepip — Bootstrapping the pip installer, Next: venv — Creation of virtual environments, Up: Software Packaging and Distribution + +5.29.1 ‘ensurepip’ — Bootstrapping the ‘pip’ installer +------------------------------------------------------ + +Added in version 3.4. + +'Source code:' Lib/ensurepip(1) + +__________________________________________________________________ + +The *note ensurepip: 55. 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. + +In most cases, end users of Python shouldn’t need to invoke this module +directly (as ‘pip’ should be bootstrapped by default), but it may be +needed if installing ‘pip’ was skipped when installing Python (or when +creating a virtual environment) or after explicitly uninstalling ‘pip’. + + Note: This module 'does not' access the internet. All of the + components needed to bootstrap ‘pip’ are included as internal parts + of the package. + +See also +........ + +*note Installing Python Modules: ef0. + + The end user guide for installing Python packages + +PEP 453(2): Explicit bootstrapping of pip in Python installations + + The original rationale and specification for this module. + +*note Availability: 1d54.: not Android, not iOS, not WASI. + +This module is not supported on *note mobile platforms: 1e55. or *note +WebAssembly platforms: 17e0. + +* Menu: + +* Command line interface:: +* Module API:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/ensurepip + + (2) https://peps.python.org/pep-0453/ + + +File: python.info, Node: Command line interface, Next: Module API, Up: ensurepip — Bootstrapping the pip installer + +5.29.1.1 Command line interface +............................... + +The command line interface is invoked using the interpreter’s ‘-m’ +switch. + +The simplest possible invocation is: + + python -m ensurepip + +This invocation will install ‘pip’ if it is not already installed, but +otherwise does nothing. To ensure the installed version of ‘pip’ is at +least as recent as the one available in ‘ensurepip’, pass the +‘--upgrade’ option: + + python -m ensurepip --upgrade + +By default, ‘pip’ is installed into the current virtual environment (if +one is active) or into the system site packages (if there is no active +virtual environment). The installation location can be controlled +through two additional command line options: + + -- 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). + +By default, the scripts ‘pipX’ and ‘pipX.Y’ will be installed (where X.Y +stands for the version of Python used to invoke ‘ensurepip’). The +scripts installed can be controlled through two additional command line +options: + + -- 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. + +Providing both of the script selection options will trigger an +exception. + + +File: python.info, Node: Module API, Prev: Command line interface, Up: ensurepip — Bootstrapping the pip installer + +5.29.1.2 Module API +................... + +*note ensurepip: 55. exposes two functions for programmatic use: + + -- Function: ensurepip.version () + + Returns a string specifying the available version of pip that will + be installed when bootstrapping an environment. + + -- Function: ensurepip.bootstrap (root=None, upgrade=False, user=False, + altinstall=False, default_pip=False, verbosity=0) + + Bootstraps ‘pip’ into the current or designated environment. + + 'root' specifies an alternative root directory to install relative + to. If 'root' is ‘None’, then installation uses the default + install location for the current environment. + + 'upgrade' indicates whether or not to upgrade an existing + installation of an earlier version of ‘pip’ to the available + version. + + 'user' indicates whether to use the user scheme rather than + installing globally. + + By default, the scripts ‘pipX’ and ‘pipX.Y’ will be installed + (where X.Y stands for the current version of Python). + + If 'altinstall' is set, then ‘pipX’ will 'not' be installed. + + If 'default_pip' is set, then ‘pip’ will be installed in addition + to the two regular scripts. + + Setting both 'altinstall' and 'default_pip' will trigger *note + ValueError: 204. + + 'verbosity' controls the level of output to *note sys.stdout: ad6. + from the bootstrapping operation. + + Raises an *note auditing event: 18ba. ‘ensurepip.bootstrap’ with + argument ‘root’. + + Note: The bootstrapping process has side effects on both + ‘sys.path’ and ‘os.environ’. Invoking the command line + interface in a subprocess instead allows these side effects to + be avoided. + + Note: The bootstrapping process may install additional modules + required by ‘pip’, but other software should not assume those + dependencies will always be present by default (as the + dependencies may be removed in a future version of ‘pip’). + + +File: python.info, Node: venv — Creation of virtual environments, Next: zipapp — Manage executable Python zip archives, Prev: ensurepip — Bootstrapping the pip installer, Up: Software Packaging and Distribution + +5.29.2 ‘venv’ — Creation of virtual environments +------------------------------------------------ + +Added in version 3.3. + +'Source code:' 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: c7. 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. + +When used from within a virtual environment, common installation tools +such as pip(2) will install Python packages into a virtual environment +without needing to be told to do so explicitly. + +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. + +See PEP 405(3) for more background on Python virtual environments. + +See also +........ + +Python Packaging User Guide: Creating and using virtual environments(4) + +*note Availability: 1d54.: not Android, not iOS, not WASI. + +This module is not supported on *note mobile platforms: 1e55. or *note +WebAssembly platforms: 17e0. + +* Menu: + +* Creating virtual environments:: +* How venvs work:: +* API: API<2>. +* An example of extending EnvBuilder:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: Creating virtual environments, Next: How venvs work, Up: venv — Creation of virtual environments + +5.29.2.1 Creating virtual environments +...................................... + +*note Virtual environments: 4331. 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 +‘Libsite-packages’). If an existing directory is specified, it will be +re-used. + +Changed in version 3.5: The use of ‘venv’ is now recommended for +creating virtual environments. + +Deprecated since version 3.6, removed in version 3.8: ‘pyvenv’ was the +recommended tool for creating virtual environments for Python 3.3 and +3.4, and replaced in 3.5 by executing ‘venv’ directly. + +On Windows, invoke the ‘venv’ command as follows: + + PS> python -m venv C:\path\to\new\virtual\environment + +The command, if run with ‘-h’, will show the available options: + + 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). + +Changed in version 3.4: Installs pip by default, added the +‘--without-pip’ and ‘--copies’ options. + +Changed in version 3.4: In earlier versions, if the target directory +already existed, an error was raised, unless the ‘--clear’ or +‘--upgrade’ option was provided. + +Changed in version 3.9: Add ‘--upgrade-deps’ option to upgrade pip + +setuptools to the latest on PyPI. + +Changed in version 3.12: ‘setuptools’ is no longer a core venv +dependency. + +Changed in version 3.13: Added the ‘--without-scm-ignore-files’ option. + +Changed in version 3.13: ‘venv’ now creates a ‘.gitignore’ file for Git +by default. + + Note: While symlinks are supported on Windows, they are not + recommended. Of particular note is that double-clicking + ‘python.exe’ in File Explorer will resolve the symlink eagerly and + ignore the virtual environment. + + Note: On Microsoft Windows, it may be required to enable the + ‘Activate.ps1’ script by setting the execution policy for the user. + You can do this by issuing the following PowerShell command: + + PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + + See About Execution Policies(1) for more information. + +The created ‘pyvenv.cfg’ file also includes the +‘include-system-site-packages’ key, set to ‘true’ if ‘venv’ is run with +the ‘--system-site-packages’ option, ‘false’ otherwise. + +Unless the ‘--without-pip’ option is given, *note ensurepip: 55. will be +invoked to bootstrap ‘pip’ into the virtual environment. + +Multiple paths can be given to ‘venv’, in which case an identical +virtual environment will be created, according to the given options, at +each provided path. + + ---------- Footnotes ---------- + + (1) https://go.microsoft.com/fwlink/?LinkID=135170 + + +File: python.info, Node: How venvs work, Next: API<2>, Prev: Creating virtual environments, Up: venv — Creation of virtual environments + +5.29.2.2 How venvs work +....................... + +When a Python interpreter is running from a virtual environment, *note +sys.prefix: 3b2. and *note sys.exec_prefix: 3ae. point to the +directories of the virtual environment, whereas *note sys.base_prefix: +3eb. and *note sys.base_exec_prefix: 3ea. point to those of the base +Python used to create the environment. It is sufficient to check +‘sys.prefix != sys.base_prefix’ to determine if the current interpreter +is running from a virtual environment. + +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): + +Platform Shell Command to activate 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’ and ‘csh’ activation scripts. + +Added in version 3.8: PowerShell activation scripts installed under +POSIX for PowerShell Core support. + +You don’t specifically 'need' to activate a virtual environment, as you +can just specify the full path to that environment’s Python interpreter +when invoking Python. Furthermore, all scripts installed in the +environment should be runnable without activating it. + +In order to achieve this, scripts installed into virtual environments +have a “shebang” line which points to the environment’s Python +interpreter, ‘#!/<PATH-TO-VENV>/bin/python’. This means that the script +will run with that interpreter regardless of the value of ‘PATH’. On +Windows, “shebang” line processing is supported if you have the *note +Python Launcher for Windows: 5ba. installed. Thus, double-clicking an +installed script in a Windows Explorer window should run it with the +correct interpreter without the environment needing to be activated or +on the ‘PATH’. + +When a virtual environment has been activated, the ‘VIRTUAL_ENV’ +environment variable is set to the path of the environment. Since +explicitly activating a virtual environment is not required to use it, +‘VIRTUAL_ENV’ cannot be relied upon to determine whether a virtual +environment is being used. + + Warning: Because scripts installed in environments should not + expect the environment to be activated, their shebang lines contain + the absolute paths to their environment’s interpreters. Because of + this, environments are inherently non-portable, in the general + case. You should always have a simple means of recreating an + environment (for example, if you have a requirements file + ‘requirements.txt’, you can invoke ‘pip install -r + requirements.txt’ using the environment’s ‘pip’ to install all of + the packages needed by the environment). If for any reason you + need to move the environment to a new location, you should recreate + it at the desired location and delete the one at the old location. + If you move an environment because you moved a parent directory of + it, you should recreate the environment in its new location. + Otherwise, software installed into the environment may not work as + expected. + +You can deactivate a virtual environment by typing ‘deactivate’ in your +shell. The exact mechanism is platform-specific and is an internal +implementation detail (typically, a script or shell function will be +used). + + +File: python.info, Node: API<2>, Next: An example of extending EnvBuilder, Prev: How venvs work, Up: venv — Creation of virtual environments + +5.29.2.3 API +............ + +The high-level method described above makes use of a simple API which +provides mechanisms for third-party virtual environment creators to +customize environment creation according to their needs, the *note +EnvBuilder: 26c. class. + + -- Class: venv.EnvBuilder (system_site_packages=False, clear=False, + symlinks=False, upgrade=False, with_pip=False, prompt=None, + upgrade_deps=False, *, scm_ignore_files=frozenset()) + + The *note EnvBuilder: 26c. class accepts the following keyword + arguments on instantiation: + + * 'system_site_packages' – a boolean value indicating that the + system Python site-packages should be available to the + environment (defaults to ‘False’). + + * 'clear' – a boolean value which, if true, will delete the + contents of any existing target directory, before creating the + environment. + + * 'symlinks' – a boolean value indicating whether to attempt to + symlink the Python binary rather than copying. + + * 'upgrade' – a boolean value which, if true, will upgrade an + existing environment with the running Python - for use when + that Python has been upgraded in-place (defaults to ‘False’). + + * 'with_pip' – a boolean value which, if true, ensures pip is + installed in the virtual environment. This uses *note + ensurepip: 55. with the ‘--default-pip’ option. + + * 'prompt' – a string to be used after virtual environment is + activated (defaults to ‘None’ which means directory name of + the environment would be used). If the special string ‘"."’ + is provided, the basename of the current directory is used as + the prompt. + + * 'upgrade_deps' – Update the base venv modules to the latest on + 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(): 4341. + + Changed in version 3.4: Added the ‘with_pip’ parameter + + Changed in version 3.6: Added the ‘prompt’ parameter + + Changed in version 3.9: Added the ‘upgrade_deps’ parameter + + Changed in version 3.13: Added the ‘scm_ignore_files’ parameter + + *note EnvBuilder: 26c. may be used as a base class. + + -- Method: create (env_dir) + + Create a virtual environment by specifying the target + directory (absolute or relative to the current directory) + which is to contain the virtual environment. The ‘create’ + method will either create the environment in the specified + directory, or raise an appropriate exception. + + The ‘create’ method of the *note EnvBuilder: 26c. class + illustrates the hooks available for subclass customization: + + 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) + + Each of the methods *note ensure_directories(): 4343, *note + create_configuration(): 4344, *note setup_python(): 4345, + *note setup_scripts(): 4346. and *note post_setup(): 4347. can + be overridden. + + -- Method: ensure_directories (env_dir) + + Creates the environment directory and all necessary + subdirectories that don’t already exist, and returns a context + object. This context object is just a holder for attributes + (such as paths) for use by the other methods. If the *note + EnvBuilder: 26c. is created with the arg ‘clear=True’, + contents of the environment directory will be cleared and then + all necessary subdirectories will be recreated. + + The returned context object is a *note types.SimpleNamespace: + 1d1. with the following attributes: + + * ‘env_dir’ - The location of the virtual environment. + Used for ‘__VENV_DIR__’ in activation scripts (see *note + install_scripts(): 4348.). + + * ‘env_name’ - The name of the virtual environment. Used + for ‘__VENV_NAME__’ in activation scripts (see *note + install_scripts(): 4348.). + + * ‘prompt’ - The prompt to be used by the activation + scripts. Used for ‘__VENV_PROMPT__’ in activation + scripts (see *note install_scripts(): 4348.). + + * ‘executable’ - The underlying Python executable used by + the virtual environment. This takes into account the + case where a virtual environment is created from another + virtual environment. + + * ‘inc_path’ - The include path for the virtual + environment. + + * ‘lib_path’ - The purelib path for the virtual + environment. + + * ‘bin_path’ - The script path for the virtual environment. + + * ‘bin_name’ - The name of the script path relative to the + virtual environment location. Used for + ‘__VENV_BIN_NAME__’ in activation scripts (see *note + install_scripts(): 4348.). + + * ‘env_exe’ - The name of the Python interpreter in the + virtual environment. Used for ‘__VENV_PYTHON__’ in + activation scripts (see *note install_scripts(): 4348.). + + * ‘env_exec_cmd’ - The name of the Python interpreter, + taking into account filesystem redirections. This can be + used to run Python in the virtual environment. + + Changed in version 3.11: The 'venv' *note sysconfig + installation scheme: 68b. is used to construct the paths of + the created directories. + + Changed in version 3.12: The attribute ‘lib_path’ was added to + the context, and the context object was documented. + + -- Method: create_configuration (context) + + Creates the ‘pyvenv.cfg’ configuration file in the + environment. + + -- Method: setup_python (context) + + Creates a copy or symlink to the Python executable in the + environment. On POSIX systems, if a specific executable + ‘python3.x’ was used, symlinks to ‘python’ and ‘python3’ will + be created pointing to that executable, unless files with + those names already exist. + + -- Method: setup_scripts (context) + + Installs activation scripts appropriate to the platform into + the virtual environment. + + -- Method: upgrade_dependencies (context) + + Upgrades the core venv dependency packages (currently pip(1)) + in the environment. This is done by shelling out to the ‘pip’ + executable in the environment. + + Added in version 3.9. + + Changed in version 3.12: setuptools(2) is no longer a core + venv dependency. + + -- Method: post_setup (context) + + A placeholder method which can be overridden in third party + implementations to pre-install packages in the virtual + environment or perform other post-creation steps. + + -- Method: install_scripts (context, path) + + This method can be called from *note setup_scripts(): 4346. or + *note post_setup(): 4347. in subclasses to assist in + installing custom scripts into the virtual environment. + + 'path' is the path to a directory that should contain + subdirectories ‘common’, ‘posix’, ‘nt’; each containing + scripts destined for the ‘bin’ directory in the environment. + The contents of ‘common’ and the directory corresponding to + *note os.name: 2b0e. are copied after some text replacement of + placeholders: + + * ‘__VENV_DIR__’ is replaced with the absolute path of the + environment directory. + + * ‘__VENV_NAME__’ is replaced with the environment name + (final path segment of environment directory). + + * ‘__VENV_PROMPT__’ is replaced with the prompt (the + environment name surrounded by parentheses and with a + following space) + + * ‘__VENV_BIN_NAME__’ is replaced with the name of the bin + directory (either ‘bin’ or ‘Scripts’). + + * ‘__VENV_PYTHON__’ is replaced with the absolute path of + the environment’s executable. + + The directories are allowed to exist (for when an existing + environment is being upgraded). + + -- Method: 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. + + Changed in version 3.7.2: Windows now uses redirector scripts for + ‘python[w].exe’ instead of copying the actual binaries. In 3.7.2 + only *note setup_python(): 4345. does nothing unless running from a + build in the source tree. + + Changed in version 3.7.3: Windows copies the redirector scripts as + part of *note setup_python(): 4345. instead of *note + setup_scripts(): 4346. This was not the case in 3.7.2. When using + symlinks, the original executables will be linked. + +There is also a module-level convenience function: + + -- Function: venv.create (env_dir, system_site_packages=False, + clear=False, symlinks=False, with_pip=False, prompt=None, + upgrade_deps=False, *, scm_ignore_files=frozenset()) + + Create an *note EnvBuilder: 26c. with the given keyword arguments, + and call its *note create(): 4342. method with the 'env_dir' + argument. + + Added in version 3.3. + + Changed in version 3.4: Added the 'with_pip' parameter + + Changed in version 3.6: Added the 'prompt' parameter + + Changed in version 3.9: Added the 'upgrade_deps' parameter + + Changed in version 3.13: Added the 'scm_ignore_files' parameter + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/pip/ + + (2) https://pypi.org/project/setuptools/ + + +File: python.info, Node: An example of extending EnvBuilder, Prev: API<2>, Up: venv — Creation of virtual environments + +5.29.2.4 An example of extending ‘EnvBuilder’ +............................................. + +The following script shows how to extend *note EnvBuilder: 26c. by +implementing a subclass which installs setuptools and pip into a created +virtual environment: + + import os + import os.path + from subprocess import Popen, PIPE + import sys + from threading import Thread + from urllib.parse import urlparse + 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, _, _, _ = urlparse(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) + +This script is also available for download online(1). + + ---------- Footnotes ---------- + + (1) https://gist.github.com/vsajip/4673395 + + +File: python.info, Node: zipapp — Manage executable Python zip archives, Prev: venv — Creation of virtual environments, Up: Software Packaging and Distribution + +5.29.3 ‘zipapp’ — Manage executable Python zip archives +------------------------------------------------------- + +Added in version 3.5. + +'Source code:' Lib/zipapp.py(1) + +__________________________________________________________________ + +This module provides tools to manage the creation of zip files +containing Python code, which can be *note executed directly by the +Python interpreter: 1d29. The module provides both a *note Command-Line +Interface: 434d. and a *note Python API: 434e. + +* Menu: + +* Basic Example:: +* Command-Line Interface: Command-Line Interface<5>. +* Python API:: +* Examples: Examples<32>. +* Specifying the Interpreter:: +* Creating Standalone Applications with zipapp:: +* The Python Zip Application Archive Format:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/zipapp.py + + +File: python.info, Node: Basic Example, Next: Command-Line Interface<5>, Up: zipapp — Manage executable Python zip archives + +5.29.3.1 Basic Example +...................... + +The following example shows how the *note Command-Line Interface: 434d. +can be used to create an executable archive from a directory containing +Python code. When run, the archive will execute the ‘main’ function +from the module ‘myapp’ in the archive. + + $ python -m zipapp myapp -m "myapp:main" + $ python myapp.pyz + <output from myapp> + + +File: python.info, Node: Command-Line Interface<5>, Next: Python API, Prev: Basic Example, Up: zipapp — Manage executable Python zip archives + +5.29.3.2 Command-Line Interface +............................... + +When called as a program from the command line, the following form is +used: + + $ python -m zipapp source [options] + +If 'source' is a directory, this will create an archive from the +contents of 'source'. If 'source' is a file, it should be an archive, +and it will be copied to the target archive (or the contents of its +shebang line will be displayed if the –info option is specified). + +The following options are understood: + + -- Option: -o <output>, --output=<output> + + Write the output to a file named 'output'. If this option is not + specified, the output filename will be the same as the input + 'source', with the extension ‘.pyz’ added. If an explicit filename + is given, it is used as is (so a ‘.pyz’ extension should be + included if required). + + An output filename must be specified if the 'source' is an archive + (and in that case, 'output' must not be the same as 'source'). + + -- Option: -p <interpreter>, --python=<interpreter> + + Add a ‘#!’ line to the archive specifying 'interpreter' as the + command to run. Also, on POSIX, make the archive executable. The + default is to write no ‘#!’ line, and not make the file executable. + + -- Option: -m <mainfn>, --main=<mainfn> + + Write a ‘__main__.py’ file to the archive that executes 'mainfn'. + The 'mainfn' argument should have the form “pkg.mod:fn”, where + “pkg.mod” is a package/module in the archive, and “fn” is a + callable in the given module. The ‘__main__.py’ file will execute + that callable. + + *note -main: 4355. cannot be specified when copying an archive. + + -- 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: 4357. has no effect when copying an archive. + + Added in version 3.7. + + -- Option: --info + + Display the interpreter embedded in the archive, for diagnostic + purposes. In this case, any other options are ignored and SOURCE + must be an archive, not a directory. + + -- Option: -h, --help + + Print a short usage message and exit. + + +File: python.info, Node: Python API, Next: Examples<32>, Prev: Command-Line Interface<5>, Up: zipapp — Manage executable Python zip archives + +5.29.3.3 Python API +................... + +The module defines two convenience functions: + + -- Function: zipapp.create_archive (source, target=None, + interpreter=None, main=None, filter=None, compressed=False) + + Create an application archive from 'source'. The source can be any + of the following: + + * The name of a directory, or a *note path-like object: 2a2. + referring to a directory, in which case a new application + archive will be created from the content of that directory. + + * The name of an existing application archive file, or a *note + path-like object: 2a2. referring to such a file, in which case + the file is copied to the target (modifying it to reflect the + value given for the 'interpreter' argument). The file name + should include the ‘.pyz’ extension, if required. + + * A file object open for reading in bytes mode. The content of + the file should be an application archive, and the file object + is assumed to be positioned at the start of the archive. + + The 'target' argument determines where the resulting archive will + be written: + + * If it is the name of a file, or a *note path-like object: 2a2, + the archive will be written to that file. + + * If it is an open file object, the archive will be written to + that file object, which must be open for writing in bytes + mode. + + * If the target is omitted (or ‘None’), the source must be a + directory and the target will be a file with the same name as + the source, with a ‘.pyz’ extension added. + + The 'interpreter' argument specifies the name of the Python + interpreter with which the archive will be executed. It is written + as a “shebang” line at the start of the archive. On POSIX, this + will be interpreted by the OS, and on Windows it will be handled by + the Python launcher. Omitting the 'interpreter' results in no + shebang line being written. If an interpreter is specified, and + the target is a filename, the executable bit of the target file + will be set. + + The 'main' argument specifies the name of a callable which will be + used as the main program for the archive. It can only be specified + if the source is a directory, and the source does not already + contain a ‘__main__.py’ file. The 'main' argument should take the + form “pkg.module:callable” and the archive will be run by importing + “pkg.module” and executing the given callable with no arguments. + It is an error to omit 'main' if the source is a directory and does + not contain a ‘__main__.py’ file, as otherwise the resulting + archive would not be executable. + + 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. + + If a file object is specified for 'source' or 'target', it is the + caller’s responsibility to close it after calling create_archive. + + When copying an existing archive, file objects supplied only need + ‘read’ and ‘readline’, or ‘write’ methods. When creating an + archive from a directory, if the target is a file object it will be + passed to the ‘zipfile.ZipFile’ class, and must supply the methods + needed by that class. + + Changed in version 3.7: Added the 'filter' and 'compressed' + parameters. + + -- Function: zipapp.get_interpreter (archive) + + Return the interpreter specified in the ‘#!’ line at the start of + the archive. If there is no ‘#!’ line, return *note None: 671. + The 'archive' argument can be a filename or a file-like object open + for reading in bytes mode. It is assumed to be at the start of the + archive. + + +File: python.info, Node: Examples<32>, Next: Specifying the Interpreter, Prev: Python API, Up: zipapp — Manage executable Python zip archives + +5.29.3.4 Examples +................. + +Pack up a directory into an archive, and run it. + + $ python -m zipapp myapp + $ python myapp.pyz + <output from myapp> + +The same can be done using the *note create_archive(): bb0. function: + + >>> import zipapp + >>> zipapp.create_archive('myapp', 'myapp.pyz') + +To make the application directly executable on POSIX, specify an +interpreter to use. + + $ python -m zipapp myapp -p "/usr/bin/env python" + $ ./myapp.pyz + <output from myapp> + +To replace the shebang line on an existing archive, create a modified +archive using the *note create_archive(): bb0. function: + + >>> import zipapp + >>> zipapp.create_archive('old_archive.pyz', 'new_archive.pyz', '/usr/bin/python3') + +To update the file in place, do the replacement in memory using a *note +BytesIO: e9d. object, and then overwrite the source afterwards. Note +that there is a risk when overwriting a file in place that an error will +result in the loss of the original file. This code does not protect +against such errors, but production code should do so. Also, this +method will only work if the archive fits in memory: + + >>> 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: Specifying the Interpreter, Next: Creating Standalone Applications with zipapp, Prev: Examples<32>, Up: zipapp — Manage executable Python zip archives + +5.29.3.5 Specifying the Interpreter +................................... + +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: Specifying the Interpreter, Up: zipapp — Manage executable Python zip archives + +5.29.3.6 Creating Standalone Applications with zipapp +..................................................... + +Using the *note zipapp: 130. 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 +Specifying the Interpreter: 4361. 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 — Manage executable Python zip archives + +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: 3b0. 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(): c59. on POSIX. + + 2. Standard zipfile data, as generated by the *note zipfile: 131. + 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 Runtime Services, Next: Custom Python Interpreters, Prev: Software Packaging and Distribution, Up: The Python Standard Library + +5.30 Python Runtime Services +============================ + +The modules described in this chapter provide a wide range of services +related to the Python interpreter and its interaction with its +environment. Here’s an overview: + +* Menu: + +* sys — System-specific parameters and functions:: +* sys.monitoring — Execution event monitoring: sys monitoring — Execution event monitoring. +* sysconfig — Provide access to Python’s configuration information:: +* builtins — Built-in objects:: +* __main__ — Top-level code environment:: +* warnings — Warning control:: +* dataclasses — Data Classes:: +* contextlib — Utilities for with-statement contexts:: +* abc — Abstract Base Classes:: +* atexit — Exit handlers:: +* traceback — Print or retrieve a stack traceback:: +* __future__ — Future statement definitions:: +* gc — Garbage Collector interface:: +* inspect — Inspect live objects:: +* site — Site-specific configuration hook:: + + +File: python.info, Node: sys — System-specific parameters and functions, Next: sys monitoring — Execution event monitoring, Up: Python Runtime Services + +5.30.1 ‘sys’ — System-specific parameters and functions +------------------------------------------------------- + +__________________________________________________________________ + +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. + + -- Data: sys.abiflags + + On POSIX systems where Python was built with the standard + ‘configure’ script, this contains the ABI flags as specified by PEP + 3149(1). + + Added in version 3.2. + + Changed in version 3.8: Default flags became an empty string (‘m’ + flag for pymalloc has been removed). + + *note Availability: 1d54.: Unix. + + -- Function: sys.addaudithook (hook) + + Append the callable 'hook' to the list of active auditing hooks for + the current (sub)interpreter. + + When an auditing event is raised through the *note sys.audit(): + 15b9. 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(): 41e2. 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(): 41e2. before initialising the runtime, + and any modules allowing arbitrary memory modification (such as + *note ctypes: 2a.) should be completely removed or closely + monitored. + + Calling *note sys.addaudithook(): 41e1. will itself raise an + auditing event named ‘sys.addaudithook’ with no arguments. If any + existing hooks raise an exception derived from *note RuntimeError: + 195, 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: 1870. for all events raised by + CPython, and PEP 578(2) for the original design discussion. + + Added in version 3.8. + + Changed in version 3.8.1: Exceptions derived from *note Exception: + 9d9. but not *note RuntimeError: 195. are no longer suppressed. + + 'CPython implementation detail:' When tracing is enabled (see *note + settrace(): 14ca.), 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. + + -- Data: sys.argv + + The list of command line arguments passed to a Python script. + ‘argv[0]’ is the script name (it is operating system dependent + whether this is a full pathname or not). If the command was + executed using the *note -c: 5dc. command line option to the + interpreter, ‘argv[0]’ is set to the string ‘'-c'’. If no script + name was passed to the Python interpreter, ‘argv[0]’ is the empty + string. + + To loop over the standard input, or the list of files given on the + command line, see the *note fileinput: 5b. module. + + See also *note sys.orig_argv: 83c. + + Note: On Unix, command line arguments are passed by bytes from + OS. Python decodes them with filesystem encoding and + “surrogateescape” error handler. When you need original + bytes, you can get it by ‘[os.fsencode(arg) for arg in + sys.argv]’. + + -- Function: 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(): 15b9. 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(): 41e1. or *note + PySys_AddAuditHook(): 41e2. functions. + + The native equivalent of this function is *note PySys_Audit(): 36a. + Using the native function is preferred when possible. + + See the *note audit events table: 1870. for all events raised by + CPython. + + Added in version 3.8. + + -- Data: sys.base_exec_prefix + + Set during Python startup, before ‘site.py’ is run, to the same + value as *note exec_prefix: 3ae. If not running in a *note virtual + environment: 4331, the values will stay the same; if ‘site.py’ + finds that a virtual environment is in use, the values of *note + prefix: 3b2. and *note exec_prefix: 3ae. will be changed to point + to the virtual environment, whereas *note base_prefix: 3eb. and + *note base_exec_prefix: 3ea. will remain pointing to the base + Python installation (the one which the virtual environment was + created from). + + Added in version 3.3. + + -- Data: sys.base_prefix + + Set during Python startup, before ‘site.py’ is run, to the same + value as *note prefix: 3b2. If not running in a *note virtual + environment: 4331, the values will stay the same; if ‘site.py’ + finds that a virtual environment is in use, the values of *note + prefix: 3b2. and *note exec_prefix: 3ae. will be changed to point + to the virtual environment, whereas *note base_prefix: 3eb. and + *note base_exec_prefix: 3ea. will remain pointing to the base + Python installation (the one which the virtual environment was + created from). + + Added in version 3.3. + + -- Data: sys.byteorder + + An indicator of the native byte order. This will have the value + ‘'big'’ on big-endian (most-significant byte first) platforms, and + ‘'little'’ on little-endian (least-significant byte first) + platforms. + + -- Data: sys.builtin_module_names + + A tuple of strings containing the names of all modules that are + compiled into this Python interpreter. (This information is not + available in any other way — ‘modules.keys()’ only lists the + imported modules.) + + See also the *note sys.stdlib_module_names: 83d. list. + + -- Function: 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(): 14ca. or *note setprofile(): 14c9. to avoid infinite + recursion. ‘call_tracing()’ enables explicit recursion of the + tracing function. + + -- Data: sys.copyright + + A string containing the copyright pertaining to the Python + interpreter. + + -- Function: sys._clear_type_cache () + + Clear the internal type cache. The type cache is used to speed up + attribute and method lookups. Use the function 'only' to drop + unnecessary references during reference leak debugging. + + This function should be used for internal and specialized purposes + only. + + Deprecated since version 3.13: Use the more general *note + _clear_internal_caches(): 1670. function instead. + + -- Function: 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. + + -- Function: sys._current_frames () + + Return a dictionary mapping each thread’s identifier to the topmost + stack frame currently active in that thread at the time the + function is called. Note that functions in the *note traceback: + fe. module can build the call stack given such a frame. + + This is most useful for debugging deadlock: this function does not + require the deadlocked threads’ cooperation, and such threads’ call + stacks are frozen for as long as they remain deadlocked. The frame + returned for a non-deadlocked thread may bear no relationship to + that thread’s current activity by the time calling code examines + the frame. + + This function should be used for internal and specialized purposes + only. + + Raises an *note auditing event: 18ba. ‘sys._current_frames’ with no + arguments. + + -- Function: 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. + + This function should be used for internal and specialized purposes + only. + + Raises an *note auditing event: 18ba. ‘sys._current_exceptions’ + with no arguments. + + Changed in version 3.12: Each value in the dictionary is now a + single exception instance, rather than a 3-tuple as returned from + ‘sys.exc_info()’. + + -- Function: sys.breakpointhook () + + This hook function is called by built-in *note breakpoint(): 236. + By default, it drops you into the *note pdb: a5. debugger, but it + can be set to any other function so that you can choose which + debugger gets used. + + The signature of this function is dependent on what it calls. For + example, the default binding (e.g. ‘pdb.set_trace()’) expects no + arguments, but you might bind it to a function that expects + additional arguments (positional and/or keyword). The built-in + ‘breakpoint()’ function passes its ‘*args’ and ‘**kws’ straight + through. Whatever ‘breakpointhooks()’ returns is returned from + ‘breakpoint()’. + + The default implementation first consults the environment variable + *note PYTHONBREAKPOINT: adb. If that is set to ‘"0"’ then this + function returns immediately; i.e. it is a no-op. If the + environment variable is not set, or is set to the empty string, + ‘pdb.set_trace()’ is called. Otherwise this variable should name a + function to run, using Python’s dotted-import nomenclature, e.g. + ‘package.subpackage.module.function’. In this case, + ‘package.subpackage.module’ would be imported and the resulting + module must have a callable named ‘function()’. This is run, + passing in ‘*args’ and ‘**kws’, and whatever ‘function()’ returns, + ‘sys.breakpointhook()’ returns to the built-in *note breakpoint(): + 236. function. + + Note that if anything goes wrong while importing the callable named + by *note PYTHONBREAKPOINT: adb, a *note RuntimeWarning: 1bd. is + reported and the breakpoint is ignored. + + Also note that if ‘sys.breakpointhook()’ is overridden + programmatically, *note PYTHONBREAKPOINT: adb. is 'not' consulted. + + Added in version 3.7. + + -- Function: sys._debugmallocstats () + + Print low-level information to stderr about the state of CPython’s + memory allocator. + + If Python is *note built in debug mode: 1fb. (*note configure + -with-pydebug option: 420.), it also performs some expensive + internal consistency checks. + + Added in version 3.3. + + 'CPython implementation detail:' This function is specific to + CPython. The exact output format is not defined here, and may + change. + + -- Data: sys.dllhandle + + Integer specifying the handle of the Python DLL. + + *note Availability: 1d54.: Windows. + + -- Function: sys.displayhook (value) + + If 'value' is not ‘None’, this function prints ‘repr(value)’ to + ‘sys.stdout’, and saves 'value' in ‘builtins._’. If ‘repr(value)’ + is not encodable to ‘sys.stdout.encoding’ with ‘sys.stdout.errors’ + error handler (which is probably ‘'strict'’), encode it to + ‘sys.stdout.encoding’ with ‘'backslashreplace'’ error handler. + + ‘sys.displayhook’ is called on the result of evaluating an *note + expression: 1f85. entered in an interactive Python session. The + display of these values can be customized by assigning another + one-argument function to ‘sys.displayhook’. + + Pseudo-code: + + 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 + + Changed in version 3.2: Use ‘'backslashreplace'’ error handler on + *note UnicodeEncodeError: 673. + + -- Data: sys.dont_write_bytecode + + If this is true, Python won’t try to write ‘.pyc’ files on the + import of source modules. This value is initially set to ‘True’ or + ‘False’ depending on the *note -B: 1399. command line option and + the *note PYTHONDONTWRITEBYTECODE: 139a. environment variable, but + you can set it yourself to control bytecode file generation. + + -- Data: sys._emscripten_info + + A *note named tuple: 64a. holding information about the environment + on the 'wasm32-emscripten' platform. The named tuple is + provisional and may change in the future. + + -- Attribute: _emscripten_info.emscripten_version + + Emscripten version as tuple of ints (major, minor, micro), + e.g. ‘(3, 1, 8)’. + + -- Attribute: _emscripten_info.runtime + + Runtime string, e.g. browser user agent, ‘'Node.js + v14.18.2'’, or ‘'UNKNOWN'’. + + -- Attribute: _emscripten_info.pthreads + + ‘True’ if Python is compiled with Emscripten pthreads support. + + -- Attribute: _emscripten_info.shared_memory + + ‘True’ if Python is compiled with shared memory support. + + *note Availability: 1d54.: Emscripten. + + Added in version 3.11. + + -- Data: 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: 20. 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: + 176. ‘pycache_prefix=PATH’ command-line option or the *note + PYTHONPYCACHEPREFIX: 9a3. environment variable (command-line takes + precedence). If neither are set, it is ‘None’. + + Added in version 3.8. + + -- Function: sys.excepthook (type, value, traceback) + + This function prints out a given traceback and exception to + ‘sys.stderr’. + + When an exception other than *note SystemExit: d40. 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: 195. the call to the + hook will be suppressed. Otherwise, the audit hook exception will + be reported as unraisable and ‘sys.excepthook’ will be called. + + See also + ........ + + The *note sys.unraisablehook(): 1f9. function handles unraisable + exceptions and the *note threading.excepthook(): 847. function + handles exception raised by *note threading.Thread.run(): a3c. + + -- Data: sys.__breakpointhook__ + -- Data: sys.__displayhook__ + -- Data: sys.__excepthook__ + -- Data: sys.__unraisablehook__ + + These objects contain the original values of ‘breakpointhook’, + ‘displayhook’, ‘excepthook’, and ‘unraisablehook’ at the start of + the program. They are saved so that ‘breakpointhook’, + ‘displayhook’ and ‘excepthook’, ‘unraisablehook’ can be restored in + case they happen to get replaced with broken or alternative + objects. + + Added in version 3.7: __breakpointhook__ + + Added in version 3.8: __unraisablehook__ + + -- Function: 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. + + -- Function: sys.exc_info () + + This function returns the old-style representation of the handled + exception. If an exception ‘e’ is currently handled (so *note + exception(): 687. would return ‘e’), *note exc_info(): 686. returns + the tuple ‘(type(e), e, e.__traceback__)’. That is, a tuple + containing the type of the exception (a subclass of *note + BaseException: 5b7.), the exception itself, and a *note traceback + object: af4. 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. + + Changed in version 3.11: The ‘type’ and ‘traceback’ fields are now + derived from the ‘value’ (the exception instance), so when an + exception is modified while it is being handled, the changes are + reflected in the results of subsequent calls to *note exc_info(): + 686. + + -- Data: sys.exec_prefix + + A string giving the site-specific directory prefix where the + platform-dependent Python files are installed; by default, this is + also ‘'/usr/local'’. This can be set at build time with the + ‘--exec-prefix’ argument to the ‘configure’ script. Specifically, + all configuration files (e.g. the ‘pyconfig.h’ header file) are + installed in the directory ‘`exec_prefix'/lib/python`X.Y'/config’, + and shared library modules are installed in + ‘`exec_prefix'/lib/python`X.Y'/lib-dynload’, where 'X.Y' is the + version number of Python, for example ‘3.2’. + + Note: If a *note virtual environment: 4331. is in effect, this + value will be changed in ‘site.py’ to point to the virtual + environment. The value for the Python installation will still + be available, via *note base_exec_prefix: 3ea. + + -- Data: sys.executable + + A string giving the absolute path of the executable binary for the + Python interpreter, on systems where this makes sense. If Python + is unable to retrieve the real path to its executable, *note + sys.executable: 3b4. will be an empty string or ‘None’. + + -- Function: sys.exit ([arg]) + + Raise a *note SystemExit: d40. 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 kind of + errors. If another type of object is passed, ‘None’ is equivalent + to passing zero, and any other object is printed to *note stderr: + 939. 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(): 2189. ultimately “only” raises an exception, it + will only exit the process when called from the main thread, and + the exception is not intercepted. Cleanup actions specified by + finally clauses of *note try: 6e4. statements are honored, and it + is possible to intercept the exit attempt at an outer level. + + Changed in version 3.6: If an error occurs in the cleanup after the + Python interpreter has caught *note SystemExit: d40. (such as an + error flushing buffered data in the standard streams), the exit + status is changed to 120. + + -- Data: sys.flags + + The *note named tuple: 64a. 'flags' exposes the status of command + line flags. The attributes are read only. + + -- Attribute: flags.debug *note -d: 1d31. + + + -- Attribute: flags.inspect *note -i: 14a6. + + + -- Attribute: flags.interactive *note -i: 14a6. + + + -- Attribute: flags.isolated *note -I: 95e. + + + -- Attribute: flags.optimize *note -O: db4. or *note -OO: db5. + + + -- Attribute: flags.dont_write_bytecode *note -B: 1399. + + + -- Attribute: flags.no_user_site *note -s: 1377. + + + -- Attribute: flags.no_site *note -S: 119b. + + + -- Attribute: flags.ignore_environment *note -E: 95d. + + + -- Attribute: flags.verbose *note -v: 13f0. + + + -- Attribute: flags.bytes_warning *note -b: 5df. + + + -- Attribute: flags.quiet *note -q: 1d34. + + + -- Attribute: flags.hash_randomization *note -R: 1a96. + + + -- Attribute: flags.dev_mode *note -X dev: 176. + (*note Python Development Mode: 1fa.) + + + -- Attribute: flags.utf8_mode *note -X utf8: 176. + + + -- Attribute: flags.safe_path *note -P: 5a0. + + + -- Attribute: flags.int_max_str_digits *note -X int_max_str_digits: 176. + (*note integer string conversion length limitation: 5f1.) + + + -- Attribute: flags.warn_default_encoding *note -X warn_default_encoding: 176. + + + Changed in version 3.2: Added ‘quiet’ attribute for the new *note + -q: 1d34. flag. + + Added in version 3.2.3: The ‘hash_randomization’ attribute. + + Changed in version 3.3: Removed obsolete ‘division_warning’ + attribute. + + Changed in version 3.4: Added ‘isolated’ attribute for *note -I: + 95e. ‘isolated’ flag. + + Changed in version 3.7: Added the ‘dev_mode’ attribute for the new + *note Python Development Mode: 1fa. and the ‘utf8_mode’ attribute + for the new *note -X: 176. ‘utf8’ flag. + + Changed in version 3.10: Added ‘warn_default_encoding’ attribute + for *note -X: 176. ‘warn_default_encoding’ flag. + + Changed in version 3.11: Added the ‘safe_path’ attribute for *note + -P: 5a0. option. + + Changed in version 3.11: Added the ‘int_max_str_digits’ attribute. + + -- Data: sys.float_info + + A *note named tuple: 64a. holding information about the float type. + It contains low level information about the precision and internal + representation. The values correspond to the various + floating-point constants defined in the standard header file + ‘float.h’ for the ‘C’ programming language; see section 5.2.4.2.2 + of the 1999 ISO/IEC C standard *note [C99]: 4385, ‘Characteristics + of floating types’, for details. Attributes of the ‘float_info’ + named tuple + + attribute float.h macro explanation + + ------------------------------------------------------------------------------------------------------------------ + + -- Attribute: float_info.epsilon ‘DBL_EPSILON’ difference between 1.0 and the + least value greater than 1.0 that + is representable as a float. + + See also *note math.ulp(): 911. + + + -- Attribute: float_info.dig ‘DBL_DIG’ The maximum number of decimal + digits that can be faithfully + represented in a float; see below. + + + -- Attribute: float_info.mant_dig ‘DBL_MANT_DIG’ Float precision: the number of + base-‘radix’ digits in the + significand of a float. + + + -- Attribute: float_info.max ‘DBL_MAX’ The maximum representable positive + finite float. + + + -- Attribute: float_info.max_exp ‘DBL_MAX_EXP’ The maximum integer 'e' such that + ‘radix**(e-1)’ is a representable + finite float. + + + -- Attribute: ‘DBL_MAX_10_EXP’ The maximum integer 'e' such that + float_info.max_10_exp ‘10**e’ is in the range of + representable finite floats. + + + -- Attribute: float_info.min ‘DBL_MIN’ The minimum representable positive + 'normalized' float. + + Use *note math.ulp(0.0): 911. to + get the smallest positive + 'denormalized' representable float. + + + -- Attribute: float_info.min_exp ‘DBL_MIN_EXP’ The minimum integer 'e' such that + ‘radix**(e-1)’ is a normalized + float. + + + -- Attribute: ‘DBL_MIN_10_EXP’ The minimum integer 'e' such that + float_info.min_10_exp ‘10**e’ is a normalized float. + + + -- Attribute: float_info.radix ‘FLT_RADIX’ The radix of exponent + representation. + + + -- Attribute: 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: 4387. 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' + + But for strings with more than *note sys.float_info.dig: 4387. + significant digits, this isn’t always true: + + >>> s = '9876543211234567' # 16 significant digits is too many! + >>> format(float(s), '.16g') # conversion changes value + '9876543211234568' + + -- Data: sys.float_repr_style + + A string indicating how the *note repr(): 7f9. function behaves for + floats. If the string has value ‘'short'’ then for a finite float + ‘x’, ‘repr(x)’ aims to produce a short string with the property + that ‘float(repr(x)) == x’. This is the usual behaviour in Python + 3.1 and later. Otherwise, ‘float_repr_style’ has value ‘'legacy'’ + and ‘repr(x)’ behaves in the same way as it did in versions of + Python prior to 3.1. + + Added in version 3.1. + + -- Function: 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(): 1670. + and *note gc.collect(): a39. to get more predictable results. + + If a Python build or implementation cannot reasonably compute this + information, *note getallocatedblocks(): fc0. is allowed to return + 0 instead. + + Added in version 3.4. + + -- Function: sys.getunicodeinternedsize () + + Return the number of unicode objects that have been interned. + + Added in version 3.12. + + -- Function: 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(): 164c. + + *note Availability: 1d54.: Android. + + Added in version 3.7. + + -- Function: sys.getdefaultencoding () + + Return ‘'utf-8'’. This is the name of the default string encoding, + used in methods like *note str.encode(): 8d4. + + -- Function: 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: a1. module (‘RTLD_XXX’ constants, e.g. *note + os.RTLD_LAZY: 110c.). + + *note Availability: 1d54.: Unix. + + -- Function: sys.getfilesystemencoding () + + Get the *note filesystem encoding: 537.: the encoding used with the + *note filesystem error handler: 537. to convert between Unicode + filenames and bytes filenames. The filesystem error handler is + returned from *note getfilesystemencodeerrors(): ce6. + + For best compatibility, str should be used for filenames in all + cases, although representing filenames as bytes is also supported. + Functions accepting or returning filenames should support either + str or bytes and internally convert to the system’s preferred + representation. + + *note os.fsencode(): c55. and *note os.fsdecode(): c54. should be + used to ensure that the correct encoding and errors mode are used. + + The *note filesystem encoding and error handler: 537. are + configured at Python startup by the *note PyConfig_Read(): 78b. + function: see *note filesystem_encoding: 3e4. and *note + filesystem_errors: 3e5. members of *note PyConfig: 3a2. + + Changed in version 3.2: *note getfilesystemencoding(): c59. result + cannot be ‘None’ anymore. + + Changed in version 3.6: Windows is no longer guaranteed to return + ‘'mbcs'’. See PEP 529(3) and *note + _enablelegacywindowsfsencoding(): 2b0. for more information. + + Changed in version 3.7: Return ‘'utf-8'’ if the *note Python UTF-8 + Mode: 652. is enabled. + + -- Function: sys.getfilesystemencodeerrors () + + Get the *note filesystem error handler: 537.: the error handler + used with the *note filesystem encoding: 537. to convert between + Unicode filenames and bytes filenames. The filesystem encoding is + returned from *note getfilesystemencoding(): c59. + + *note os.fsencode(): c55. and *note os.fsdecode(): c54. should be + used to ensure that the correct encoding and errors mode are used. + + The *note filesystem encoding and error handler: 537. are + configured at Python startup by the *note PyConfig_Read(): 78b. + function: see *note filesystem_encoding: 3e4. and *note + filesystem_errors: 3e5. members of *note PyConfig: 3a2. + + Added in version 3.6. + + -- Function: sys.get_int_max_str_digits () + + Returns the current value for the *note integer string conversion + length limitation: 5f1. See also *note set_int_max_str_digits(): + 17be. + + Added in version 3.11. + + -- Function: sys.getrefcount (object) + + Return the reference count of the 'object'. The count returned is + generally one higher than you might expect, because it includes the + (temporary) reference as an argument to *note getrefcount(): 4393. + + Note that the returned value may not actually reflect how many + references to the object are actually held. For example, some + objects are *note immortal: 4394. and have a very high refcount + that does not reflect the actual number of references. + Consequently, do not rely on the returned value to be accurate, + other than a value of 0 or 1. + + Changed in version 3.12: Immortal objects have very large refcounts + that do not match the actual number of references to the object. + + -- Function: sys.getrecursionlimit () + + Return the current value of the recursion limit, the maximum depth + of the Python interpreter stack. This limit prevents infinite + recursion from causing an overflow of the C stack and crashing + Python. It can be set by *note setrecursionlimit(): 4bf. + + -- Function: sys.getsizeof (object[, default]) + + Return the size of an object in bytes. The object can be any type + of object. All built-in objects will return correct results, but + this does not have to hold true for third-party extensions as it is + implementation specific. + + Only the memory consumption directly attributed to the object is + accounted for, not the memory consumption of objects it refers to. + + If given, 'default' will be returned if the object does not provide + means to retrieve the size. Otherwise a *note TypeError: 534. will + be raised. + + *note getsizeof(): 176a. calls the object’s ‘__sizeof__’ method and + adds an additional garbage collector overhead if the object is + managed by the garbage collector. + + See recursive sizeof recipe(4) for an example of using *note + getsizeof(): 176a. recursively to find the size of containers and + all their contents. + + -- Function: sys.getswitchinterval () + + Return the interpreter’s “thread switch interval” in seconds; see + *note setswitchinterval(): 94a. + + Added in version 3.2. + + -- Function: sys._getframe ([depth]) + + Return a frame object from the call stack. If optional integer + 'depth' is given, return the frame object that many calls below the + top of the stack. If that is deeper than the call stack, *note + ValueError: 204. is raised. The default for 'depth' is zero, + returning the frame at the top of the call stack. + + Raises an *note auditing event: 18ba. ‘sys._getframe’ with argument + ‘frame’. + + 'CPython implementation detail:' This function should be used for + internal and specialized purposes only. It is not guaranteed to + exist in all implementations of Python. + + -- Function: 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: 18ba. ‘sys._getframemodulename’ + with argument ‘depth’. + + 'CPython implementation detail:' This function should be used for + internal and specialized purposes only. It is not guaranteed to + exist in all implementations of Python. + + Added in version 3.12. + + -- Function: sys.getobjects (limit[, type]) + + This function only exists if CPython was built using the + specialized configure option *note -with-trace-refs: 390. 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: 4395. set to 1 or using + *note Py_NewInterpreter(): 17b6, and the *note main interpreter: + 584.). Mixing objects from different interpreters may lead to + crashes or other unexpected behavior. + + 'CPython implementation detail:' This function should be used for + specialized purposes only. It is not guaranteed to exist in all + implementations of Python. + + Changed in version 3.13.1: The result may include objects from + other interpreters. + + -- Function: sys.getprofile () + + Get the profiler function as set by *note setprofile(): 14c9. + + -- Function: sys.gettrace () + + Get the trace function as set by *note settrace(): 14ca. + + 'CPython implementation detail:' The *note gettrace(): 13ad. + function is intended only for implementing debuggers, profilers, + coverage tools and the like. Its behavior is part of the + implementation platform, rather than part of the language + definition, and thus may not be available in all Python + implementations. + + -- Function: sys.getwindowsversion () + + Return a named tuple describing the Windows version currently + running. The named elements are 'major', 'minor', 'build', + 'platform', 'service_pack', 'service_pack_minor', + 'service_pack_major', 'suite_mask', 'product_type' and + 'platform_version'. 'service_pack' contains a string, + 'platform_version' a 3-tuple and all other values are integers. + The components can also be accessed by name, so + ‘sys.getwindowsversion()[0]’ is equivalent to + ‘sys.getwindowsversion().major’. For compatibility with prior + versions, only the first 5 elements are retrievable by indexing. + + 'platform' will be ‘2’ (VER_PLATFORM_WIN32_NT). + + 'product_type' may be one of the following values: + + Constant Meaning + + ---------------------------------------------------------------------------------- + + ‘1’ (VER_NT_WORKSTATION) The system is a workstation. + + + ‘2’ (VER_NT_DOMAIN_CONTROLLER) The system is a domain controller. + + + ‘3’ (VER_NT_SERVER) The system is a server, but not a + domain controller. + + + This function wraps the Win32 ‘GetVersionEx()’ function; see the + Microsoft documentation on ‘OSVERSIONINFOEX()’ for more information + about these fields. + + 'platform_version' returns the major version, minor version and + build number of the current operating system, rather than the + version that is being emulated for the process. It is intended for + use in logging rather than for feature detection. + + Note: 'platform_version' derives the version from kernel32.dll + which can be of a different version than the OS version. + Please use *note platform: aa. module for achieving accurate + OS version. + + *note Availability: 1d54.: Windows. + + Changed in version 3.2: Changed to a named tuple and added + 'service_pack_minor', 'service_pack_major', 'suite_mask', and + 'product_type'. + + Changed in version 3.6: Added 'platform_version' + + -- Function: sys.get_asyncgen_hooks () + + Returns an 'asyncgen_hooks' object, which is similar to a *note + namedtuple: 1ca. of the form ‘(firstiter, finalizer)’, where + 'firstiter' and 'finalizer' are expected to be either ‘None’ or + functions which take an *note asynchronous generator iterator: + 4396. as an argument, and are used to schedule finalization of an + asynchronous generator by an event loop. + + Added in version 3.6: See PEP 525(5) for more details. + + Note: This function has been added on a provisional basis (see + PEP 411(6) for details.) + + -- Function: sys.get_coroutine_origin_tracking_depth () + + Get the current coroutine origin tracking depth, as set by *note + set_coroutine_origin_tracking_depth(): b8c. + + Added in version 3.7. + + Note: This function has been added on a provisional basis (see + PEP 411(7) for details.) Use it only for debugging purposes. + + -- Data: sys.hash_info + + A *note named tuple: 64a. giving parameters of the numeric hash + implementation. For more details about hashing of numeric types, + see *note Hashing of numeric types: 21a0. + + -- Attribute: hash_info.width + + The width in bits used for hash values + + -- Attribute: hash_info.modulus + + The prime modulus P used for numeric hash scheme + + -- Attribute: hash_info.inf + + The hash value returned for a positive infinity + + -- Attribute: hash_info.nan + + (This attribute is no longer used) + + -- Attribute: hash_info.imag + + The multiplier used for the imaginary part of a complex number + + -- Attribute: hash_info.algorithm + + The name of the algorithm for hashing of str, bytes, and + memoryview + + -- Attribute: hash_info.hash_bits + + The internal output size of the hash algorithm + + -- Attribute: hash_info.seed_bits + + The size of the seed key of the hash algorithm + + Added in version 3.2. + + Changed in version 3.4: Added 'algorithm', 'hash_bits' and + 'seed_bits' + + -- Data: sys.hexversion + + The version number encoded as a single integer. This is guaranteed + to increase with each version, including proper support for + non-production releases. For example, to test that the Python + interpreter is at least version 1.5.2, use: + + if sys.hexversion >= 0x010502F0: + # use some advanced feature + ... + else: + # use an alternative implementation or warn the user + ... + + This is called ‘hexversion’ since it only really looks meaningful + when viewed as the result of passing it to the built-in *note + hex(): 12c2. function. The *note named tuple: 64a. *note + sys.version_info: 69c. may be used for a more human-friendly + encoding of the same information. + + More details of ‘hexversion’ can be found at *note API and ABI + Versioning: 439f. + + -- Data: sys.implementation + + An object containing information about the implementation of the + currently running Python interpreter. The following attributes are + required to exist in all Python implementations. + + 'name' is the implementation’s identifier, e.g. ‘'cpython'’. The + actual string is defined by the Python implementation, but it is + guaranteed to be lower case. + + 'version' is a named tuple, in the same format as *note + sys.version_info: 69c. It represents the version of the Python + 'implementation'. This has a distinct meaning from the specific + version of the Python 'language' to which the currently running + interpreter conforms, which ‘sys.version_info’ represents. For + example, for PyPy 1.8 ‘sys.implementation.version’ might be + ‘sys.version_info(1, 8, 0, 'final', 0)’, whereas ‘sys.version_info’ + would be ‘sys.version_info(2, 7, 2, 'final', 0)’. For CPython they + are the same value, since it is the reference implementation. + + 'hexversion' is the implementation version in hexadecimal format, + like *note sys.hexversion: 439e. + + 'cache_tag' is the tag used by the import machinery in the + filenames of cached modules. By convention, it would be a + composite of the implementation’s name and version, like + ‘'cpython-33'’. However, a Python implementation may use some + other value if appropriate. If ‘cache_tag’ is set to ‘None’, it + indicates that module caching should be disabled. + + *note sys.implementation: 512. may contain additional attributes + specific to the Python implementation. These non-standard + attributes must start with an underscore, and are not described + here. Regardless of its contents, *note sys.implementation: 512. + will not change during a run of the interpreter, nor between + implementation versions. (It may change between Python language + versions, however.) See PEP 421(8) for more information. + + Added in version 3.3. + + Note: The addition of new required attributes must go through + the normal PEP process. See PEP 421(9) for more information. + + -- Data: sys.int_info + + A *note named tuple: 64a. that holds information about Python’s + internal representation of integers. The attributes are read only. + + -- Attribute: 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’. + + -- Attribute: int_info.sizeof_digit + + The size in bytes of the C type used to represent a digit. + + -- Attribute: int_info.default_max_str_digits + + The default value for *note sys.get_int_max_str_digits(): + 152d. when it is not otherwise explicitly configured. + + -- Attribute: int_info.str_digits_check_threshold + + The minimum non-zero value for *note + sys.set_int_max_str_digits(): 17be, *note + PYTHONINTMAXSTRDIGITS: 17bd, or *note -X int_max_str_digits: + 176. + + Added in version 3.1. + + Changed in version 3.11: Added *note default_max_str_digits: 227b. + and *note str_digits_check_threshold: 43a2. + + -- Data: sys.__interactivehook__ + + When this attribute exists, its value is automatically called (with + no arguments) when the interpreter is launched in *note interactive + mode: fc1. This is done after the *note PYTHONSTARTUP: fc3. file + is read, so that you can set this hook there. The *note site: c7. + module *note sets this: fc4. + + Raises an *note auditing event: 18ba. ‘cpython.run_interactivehook’ + with the hook object as the argument when the hook is called on + startup. + + Added in version 3.4. + + -- Function: sys.intern (string) + + Enter 'string' in the table of “interned” strings and return the + interned string – which is 'string' itself or a copy. Interning + strings is useful to gain a little performance on dictionary lookup + – if the keys in a dictionary are interned, and the lookup key is + interned, the key comparisons (after hashing) can be done by a + pointer compare instead of a string compare. Normally, the names + used in Python programs are automatically interned, and the + dictionaries used to hold module, class or instance attributes have + interned keys. + + Interned strings are not *note immortal: 4394.; you must keep a + reference to the return value of *note intern(): 12ce. around to + benefit from it. + + -- Function: sys._is_gil_enabled () + + Return *note True: c0d. if the *note GIL: 159. is enabled and *note + False: b37. if it is disabled. + + Added in version 3.13. + + 'CPython implementation detail:' It is not guaranteed to exist in + all implementations of Python. + + -- Function: sys.is_finalizing () + + Return *note True: c0d. if the main Python interpreter is *note + shutting down: 14e. Return *note False: b37. otherwise. + + See also the *note PythonFinalizationError: 14d. exception. + + Added in version 3.5. + + -- Data: 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: a5. module for more + information.) + + Added in version 3.12. + + -- Function: sys._is_interned (string) + + Return *note True: c0d. if the given string is “interned”, *note + False: b37. otherwise. + + Added in version 3.13. + + 'CPython implementation detail:' It is not guaranteed to exist in + all implementations of Python. + + -- Data: sys.last_type + -- Data: sys.last_value + -- Data: sys.last_traceback + + These three variables are deprecated; use *note sys.last_exc: 4ba. + instead. They hold the legacy representation of ‘sys.last_exc’, as + returned from *note exc_info(): 686. above. + + -- Data: sys.maxsize + + An integer giving the maximum value a variable of type *note + Py_ssize_t: a5f. can take. It’s usually ‘2**31 - 1’ on a 32-bit + platform and ‘2**63 - 1’ on a 64-bit platform. + + -- Data: sys.maxunicode + + An integer giving the value of the largest Unicode code point, i.e. + ‘1114111’ (‘0x10FFFF’ in hexadecimal). + + Changed in version 3.3: Before PEP 393(10), ‘sys.maxunicode’ used + to be either ‘0xFFFF’ or ‘0x10FFFF’, depending on the configuration + option that specified whether Unicode characters were stored as + UCS-2 or UCS-4. + + -- Data: sys.meta_path + + A list of *note meta path finder: 1069. objects that have their + *note find_spec(): 865. methods called to see if one of the objects + can find the module to be imported. By default, it holds entries + that implement Python’s default import semantics. The *note + find_spec(): 865. 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__: + 1c6e. attribute is passed in as a second argument. The method + returns a *note module spec: 1f16, or ‘None’ if the module cannot + be found. + + See also + ........ + + *note importlib.abc.MetaPathFinder: 86b. + + The abstract base class defining the interface of finder + objects on *note meta_path: d2b. + + *note importlib.machinery.ModuleSpec: 1e64. + + The concrete class which *note find_spec(): 865. should return + instances of. + + Changed in version 3.4: *note Module specs: 1f16. were introduced + in Python 3.4, by PEP 451(11). + + Changed in version 3.12: Removed the fallback that looked for a + ‘find_module()’ method if a *note meta_path: d2b. entry didn’t have + a *note find_spec(): 865. method. + + -- Data: 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. + + -- Data: sys.orig_argv + + The list of the original command line arguments passed to the + Python executable. + + The elements of *note sys.orig_argv: 83c. are the arguments to the + Python interpreter, while the elements of *note sys.argv: 1258. are + the arguments to the user’s program. Arguments consumed by the + interpreter itself will be present in *note sys.orig_argv: 83c. and + missing from *note sys.argv: 1258. + + Added in version 3.10. + + -- Data: sys.path + + A list of strings that specifies the search path for modules. + Initialized from the environment variable *note PYTHONPATH: 1016, + plus an installation-dependent default. + + By default, as initialized upon program startup, a potentially + unsafe path is prepended to *note sys.path: 3b0. ('before' the + entries inserted as a result of *note PYTHONPATH: 1016.): + + * ‘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: 5a0. + command line option or the *note PYTHONSAFEPATH: 5a1. environment + variable. + + A program is free to modify this list for its own purposes. Only + strings should be added to *note sys.path: 3b0.; all other data + types are ignored during import. + + See also + ........ + + * Module *note site: c7. This describes how to use .pth files to + extend *note sys.path: 3b0. + + -- Data: sys.path_hooks + + A list of callables that take a path argument to try to create a + *note finder: 1f1e. for the path. If a finder can be created, it + is to be returned by the callable, else raise *note ImportError: + 415. + + Originally specified in PEP 302(12). + + -- Data: sys.path_importer_cache + + A dictionary acting as a cache for *note finder: 1f1e. objects. + The keys are paths that have been passed to *note sys.path_hooks: + 101d. and the values are the finders that are found. If a path is + a valid file system path but no finder is found on *note + sys.path_hooks: 101d. then ‘None’ is stored. + + Originally specified in PEP 302(13). + + -- Data: sys.platform + + A string containing a platform identifier. Known values are: + + System ‘platform’ value + + ----------------------------------------------------- + + AIX ‘'aix'’ + + + Android ‘'android'’ + + + Emscripten ‘'emscripten'’ + + + 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'’ + or ‘'freebsd8'’, '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('freebsd'): + # FreeBSD-specific code here... + + Changed in version 3.3: On Linux, *note sys.platform: a8d. doesn’t + contain the major version anymore. It is always ‘'linux'’, instead + of ‘'linux2'’ or ‘'linux3'’. + + Changed in version 3.8: On AIX, *note sys.platform: a8d. doesn’t + contain the major version anymore. It is always ‘'aix'’, instead + of ‘'aix5'’ or ‘'aix7'’. + + Changed in version 3.13: On Android, *note sys.platform: a8d. now + returns ‘'android'’ rather than ‘'linux'’. + + See also + ........ + + *note os.name: 2b0e. has a coarser granularity. *note os.uname(): + 110a. gives system-dependent version information. + + The *note platform: aa. module provides detailed checks for the + system’s identity. + + -- Data: 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: a1. module) + + * ‘/usr/lib64/pythonX.Y/lib-dynload/’: C extension modules of + the standard library (like the *note errno: 57. module, the + exact filename is platform specific) + + * ‘/usr/lib/pythonX.Y/site-packages/’ (always use ‘lib’, not + *note sys.platlibdir: 938.): Third-party modules + + * ‘/usr/lib64/pythonX.Y/site-packages/’: C extension modules of + third-party packages + + Added in version 3.9. + + -- Data: 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: 1d62. argument to the ‘configure’ script. See *note + Installation paths: 68b. for derived paths. + + Note: If a *note virtual environment: 4331. is in effect, this + value will be changed in ‘site.py’ to point to the virtual + environment. The value for the Python installation will still + be available, via *note base_prefix: 3eb. + + -- Data: sys.ps1 + -- Data: sys.ps2 + + Strings specifying the primary and secondary prompt of the + interpreter. These are only defined if the interpreter is in + interactive mode. Their initial values in this case are ‘'>>> '’ + and ‘'... '’. If a non-string object is assigned to either + variable, its *note str(): 447. is re-evaluated each time the + interpreter prepares to read a new interactive command; this can be + used to implement a dynamic prompt. + + -- Function: 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: a1. module (‘RTLD_XXX’ + constants, e.g. *note os.RTLD_LAZY: 110c.). + + *note Availability: 1d54.: Unix. + + -- Function: sys.set_int_max_str_digits (maxdigits) + + Set the *note integer string conversion length limitation: 5f1. + used by this interpreter. See also *note get_int_max_str_digits(): + 152d. + + Added in version 3.11. + + -- Function: sys.setprofile (profilefunc) + + Set the system’s profile function, which allows you to implement a + Python source code profiler in Python. See chapter *note The + Python Profilers: 427c. for more information on the Python + profiler. The system’s profile function is called similarly to the + system’s trace function (see *note settrace(): 14ca.), 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. + + Note: The same tracing mechanism is used for ‘setprofile()’ as + *note settrace(): 14ca. To trace calls with ‘setprofile()’ + inside a tracing function (e.g. in a debugger breakpoint), + see *note call_tracing(): 1832. + + Profile functions should have three arguments: 'frame', 'event', + and 'arg'. 'frame' is the current stack frame. 'event' is a + string: ‘'call'’, ‘'return'’, ‘'c_call'’, ‘'c_return'’, or + ‘'c_exception'’. 'arg' depends on the event type. + + The events have the following meaning: + + ‘'call'’ + + A function is called (or some other code block entered). The + profile function is called; 'arg' is ‘None’. + + ‘'return'’ + + A function (or other code block) is about to return. The + profile function is called; 'arg' is the value that will be + returned, or ‘None’ if the event is caused by an exception + being raised. + + ‘'c_call'’ + + A C function is about to be called. This may be an extension + function or a built-in. 'arg' is the C function object. + + ‘'c_return'’ + + A C function has returned. 'arg' is the C function object. + + ‘'c_exception'’ + + A C function has raised an exception. 'arg' is the C function + object. + + Raises an *note auditing event: 18ba. ‘sys.setprofile’ with no + arguments. + + -- Function: sys.setrecursionlimit (limit) + + Set the maximum depth of the Python interpreter stack to 'limit'. + This limit prevents infinite recursion from causing an overflow of + the C stack and crashing Python. + + The highest possible limit is platform-dependent. A user may need + to set the limit higher when they have a program that requires deep + recursion and a platform that supports a higher limit. This should + be done with care, because a too-high limit can lead to a crash. + + If the new limit is too low at the current recursion depth, a *note + RecursionError: d6b. exception is raised. + + Changed in version 3.5.1: A *note RecursionError: d6b. exception is + now raised if the new limit is too low at the current recursion + depth. + + -- Function: sys.setswitchinterval (interval) + + Set the interpreter’s thread switch interval (in seconds). This + floating-point value determines the ideal duration of the + “timeslices” allocated to concurrently running Python threads. + Please note that the actual value can be higher, especially if + long-running internal functions or methods are used. Also, which + thread becomes scheduled at the end of the interval is the + operating system’s decision. The interpreter doesn’t have its own + scheduler. + + Added in version 3.2. + + -- Function: sys.settrace (tracefunc) + + Set the system’s trace function, which allows you to implement a + Python source code debugger in Python. The function is + thread-specific; for a debugger to support multiple threads, it + must register a trace function using *note settrace(): 14ca. for + each thread being debugged or use *note threading.settrace(): 844. + + Trace functions should have three arguments: 'frame', 'event', and + 'arg'. 'frame' is the current stack frame. 'event' is a string: + ‘'call'’, ‘'line'’, ‘'return'’, ‘'exception'’ or ‘'opcode'’. 'arg' + depends on the event type. + + The trace function is invoked (with 'event' set to ‘'call'’) + whenever a new local scope is entered; it should return a reference + to a local trace function to be used for the new scope, or ‘None’ + if the scope shouldn’t be traced. + + 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. + + Note: Tracing is disabled while calling the trace function + (e.g. a function set by ‘settrace()’). For recursive tracing + see *note call_tracing(): 1832. + + The events have the following meaning: + + ‘'call'’ + + A function is called (or some other code block entered). The + global trace function is called; 'arg' is ‘None’; the return + value specifies the local trace function. + + ‘'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: bdb. + to *note False: b37. on that *note frame: 6db. + + ‘'return'’ + + A function (or other code block) is about to return. The + local trace function is called; 'arg' is the value that will + be returned, or ‘None’ if the event is caused by an exception + being raised. The trace function’s return value is ignored. + + ‘'exception'’ + + An exception has occurred. The local trace function is + called; 'arg' is a tuple ‘(exception, value, traceback)’; the + return value specifies the new local trace function. + + ‘'opcode'’ + + The interpreter is about to execute a new opcode (see *note + dis: 38. 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: bdc. to *note True: c0d. on the *note frame: + 6db. + + Note that as an exception is propagated down the chain of callers, + an ‘'exception'’ event is generated at each level. + + For more fine-grained usage, it’s possible to set a trace function + by assigning ‘frame.f_trace = tracefunc’ explicitly, rather than + relying on it being set indirectly via the return value from an + already installed trace function. This is also required for + activating the trace function on the current frame, which *note + settrace(): 14ca. doesn’t do. Note that in order for this to work, + a global tracing function must have been installed with *note + settrace(): 14ca. 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). + + For more information on code and frame objects, refer to *note The + standard type hierarchy: 1ee7. + + Raises an *note auditing event: 18ba. ‘sys.settrace’ with no + arguments. + + 'CPython implementation detail:' The *note settrace(): 14ca. + function is intended only for implementing debuggers, profilers, + coverage tools and the like. Its behavior is part of the + implementation platform, rather than part of the language + definition, and thus may not be available in all Python + implementations. + + Changed in version 3.7: ‘'opcode'’ event type added; *note + f_trace_lines: bdb. and *note f_trace_opcodes: bdc. attributes + added to frames + + -- Function: sys.set_asyncgen_hooks ([firstiter] [, finalizer]) + + Accepts two optional keyword arguments which are callables that + accept an *note asynchronous generator iterator: 4396. 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. + + Raises an *note auditing event: 18ba. + ‘sys.set_asyncgen_hooks_firstiter’ with no arguments. + + Raises an *note auditing event: 18ba. + ‘sys.set_asyncgen_hooks_finalizer’ with no arguments. + + 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(14) 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(15) + + Note: This function has been added on a provisional basis (see + PEP 411(16) for details.) + + -- Function: 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, + pass set 'depth' to zero. + + This setting is thread-specific. + + Added in version 3.7. + + Note: This function has been added on a provisional basis (see + PEP 411(17) for details.) Use it only for debugging purposes. + + -- Function: sys.activate_stack_trampoline (backend, /) + + Activate the stack profiler trampoline 'backend'. The only + supported backend is ‘"perf"’. + + *note Availability: 1d54.: Linux. + + Added in version 3.12. + + See also + ........ + + * *note Python support for the Linux perf profiler: 18f. + + * ‘https://perf.wiki.kernel.org’ + + -- Function: sys.deactivate_stack_trampoline () + + Deactivate the current stack profiler trampoline backend. + + If no stack profiler is activated, this function has no effect. + + *note Availability: 1d54.: Linux. + + Added in version 3.12. + + -- Function: sys.is_stack_trampoline_active () + + Return ‘True’ if a stack profiler trampoline is active. + + *note Availability: 1d54.: Linux. + + Added in version 3.12. + + -- Function: sys._enablelegacywindowsfsencoding () + + Changes the *note filesystem encoding and error handler: 537. to + ‘mbcs’ and ‘replace’ respectively, for consistency with versions of + Python prior to 3.6. + + This is equivalent to defining the *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. environment variable before + launching Python. + + See also *note sys.getfilesystemencoding(): c59. and *note + sys.getfilesystemencodeerrors(): ce6. + + *note Availability: 1d54.: Windows. + + Note: Changing the filesystem encoding after Python startup is + risky because the old fsencoding or paths encoded by the old + fsencoding may be cached somewhere. Use *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. instead. + + Added in version 3.6: See PEP 529(18) for more details. + + Deprecated since version 3.13, will be removed in version 3.16: Use + *note PYTHONLEGACYWINDOWSFSENCODING: 2b1. instead. + + -- Data: sys.stdin + -- Data: sys.stdout + -- Data: sys.stderr + + *note File objects: 11b5. used by the interpreter for standard + input, output and errors: + + * ‘stdin’ is used for all interactive input (including calls to + *note input(): 12cb.); + + * ‘stdout’ is used for the output of *note print(): f70. and + *note expression: 1f85. statements and for the prompts of + *note input(): 12cb.; + + * The interpreter’s own prompts and its error messages go to + ‘stderr’. + + These streams are regular *note text files: 1c86. like those + returned by the *note open(): 517. function. Their parameters are + chosen as follows: + + * The encoding and error handling are is initialized from *note + PyConfig.stdio_encoding: 39f. and *note PyConfig.stdio_errors: + 43a4. + + 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: 244. 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: 1003. environment + variable before starting Python or by using the new *note -X: + 176. ‘utf8’ command line option and *note PYTHONUTF8: ad8. + environment variable. However, for the Windows console, this + only applies when *note PYTHONLEGACYWINDOWSSTDIO: c5b. 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: 19a3. + command-line option or setting the *note PYTHONUNBUFFERED: + 19a4. environment variable. + + Changed in version 3.9: Non-interactive ‘stderr’ is now + line-buffered instead of fully buffered. + + Note: To write or read binary data from/to the standard + streams, use the underlying binary *note buffer: 1295. object. + For example, to write bytes to *note stdout: ad6, use + ‘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: f22. which do not support the ‘buffer’ + attribute. + + -- Data: sys.__stdin__ + -- Data: sys.__stdout__ + -- Data: sys.__stderr__ + + These objects contain the original values of ‘stdin’, ‘stderr’ and + ‘stdout’ at the start of the program. They are used during + finalization, and could be useful to print to the actual standard + stream no matter if the ‘sys.std*’ object has been redirected. + + It can also be used to restore the actual files to known working + file objects in case they have been overwritten with a broken + object. However, the preferred way to do this is to explicitly + save the previous stream before replacing it, and restore the saved + object. + + Note: Under some conditions ‘stdin’, ‘stdout’ and ‘stderr’ as + well as the original values ‘__stdin__’, ‘__stdout__’ and + ‘__stderr__’ can be ‘None’. It is usually the case for + Windows GUI apps that aren’t connected to a console and Python + apps started with ‘pythonw’. + + -- Data: 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: 1c5f. list. + + Added in version 3.10. + + -- Data: sys.thread_info + + A *note named tuple: 64a. holding information about the thread + implementation. + + -- Attribute: 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 + + -- Attribute: 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’ if this information is unknown + + -- Attribute: 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. + + -- Data: sys.tracebacklimit + + When this variable is set to an integer value, it determines the + maximum number of levels of traceback information printed when an + unhandled exception occurs. The default is ‘1000’. When set to + ‘0’ or less, all traceback information is suppressed and only the + exception type and value are printed. + + -- Function: 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(): a39.). + + The 'unraisable' argument has the following attributes: + + * ‘exc_type’: Exception type. + + * ‘exc_value’: Exception value, can be ‘None’. + + * ‘exc_traceback’: Exception traceback, can be ‘None’. + + * ‘err_msg’: Error message, can be ‘None’. + + * ‘object’: Object causing the exception, can be ‘None’. + + The default hook formats ‘err_msg’ and ‘object’ as: ‘f'{err_msg}: + {object!r}'’; use “Exception ignored in” error message if ‘err_msg’ + is ‘None’. + + *note sys.unraisablehook(): 1f9. can be overridden to control how + unraisable exceptions are handled. + + See also + ........ + + *note excepthook(): 807. which handles uncaught exceptions. + + Warning: 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. + + -- Data: sys.version + + A string containing the version number of the Python interpreter + plus additional information on the build number and compiler used. + This string is displayed when the interactive interpreter is + started. Do not extract version information out of it, rather, use + *note version_info: 69c. and the functions provided by the *note + platform: aa. module. + + -- Data: sys.api_version + + The C API version for this interpreter. Programmers may find this + useful when debugging version conflicts between Python and + extension modules. + + -- Data: sys.version_info + + A tuple containing the five components of the version number: + 'major', 'minor', 'micro', 'releaselevel', and 'serial'. All + values except 'releaselevel' are integers; the release level is + ‘'alpha'’, ‘'beta'’, ‘'candidate'’, or ‘'final'’. The + ‘version_info’ value corresponding to the Python version 2.0 is + ‘(2, 0, 0, 'final', 0)’. The components can also be accessed by + name, so ‘sys.version_info[0]’ is equivalent to + ‘sys.version_info.major’ and so on. + + Changed in version 3.1: Added named component attributes. + + -- Data: sys.warnoptions + + This is an implementation detail of the warnings framework; do not + modify this value. Refer to the *note warnings: 112. module for + more information on the warnings framework. + + -- Data: 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 *note sys: d9. module for + informational purposes; modifying this value has no effect on the + registry keys used by Python. + + *note Availability: 1d54.: Windows. + + -- Data: sys.monitoring + + Namespace containing functions and constants for register callbacks + and controlling monitoring events. See *note sys.monitoring: da. + for details. + + -- Data: sys._xoptions + + A dictionary of the various implementation-specific flags passed + through the *note -X: 176. command-line option. Option names are + either mapped to their values, if given explicitly, or to *note + True: c0d. Example: + + $ ./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} + + 'CPython implementation detail:' This is a CPython-specific way of + accessing options passed through *note -X: 176. Other + implementations may export them through other means, or not at all. + + Added in version 3.2. + +Citations +......... + +(C99) ISO/IEC 9899:1999. “Programming languages – C.” A public draft of +this standard is available at +‘https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3149/ + + (2) https://peps.python.org/pep-0578/ + + (3) https://peps.python.org/pep-0529/ + + (4) +https://code.activestate.com/recipes/577504-compute-memory-footprint-of-an-object-and-its-cont/ + + (5) https://peps.python.org/pep-0525/ + + (6) https://peps.python.org/pep-0411/ + + (7) https://peps.python.org/pep-0411/ + + (8) https://peps.python.org/pep-0421/ + + (9) https://peps.python.org/pep-0421/ + + (10) https://peps.python.org/pep-0393/ + + (11) https://peps.python.org/pep-0451/ + + (12) https://peps.python.org/pep-0302/ + + (13) https://peps.python.org/pep-0302/ + + (14) https://peps.python.org/pep-0525/ + + (15) +https://github.com/python/cpython/tree/3.13/Lib/asyncio/base_events.py + + (16) https://peps.python.org/pep-0411/ + + (17) https://peps.python.org/pep-0411/ + + (18) https://peps.python.org/pep-0529/ + + +File: python.info, Node: sys monitoring — Execution event monitoring, Next: sysconfig — Provide access to Python’s configuration information, Prev: sys — System-specific parameters and functions, Up: Python Runtime Services + +5.30.2 ‘sys.monitoring’ — Execution event monitoring +---------------------------------------------------- + +Added in version 3.12. + +__________________________________________________________________ + + Note: *note sys.monitoring: da. is a namespace within the *note + sys: d9. module, not an independent module, so there is no need to + ‘import sys.monitoring’, simply ‘import sys’ and then use + ‘sys.monitoring’. + +This namespace provides access to the functions and constants necessary +to activate and control event monitoring. + +As programs execute, events occur that might be of interest to tools +that monitor execution. The *note sys.monitoring: da. namespace +provides means to receive callbacks when events of interest occur. + +The monitoring API consists of three components: + + * *note Tool identifiers: 43ad. + + * *note Events: 43ae. + + * *note Callbacks: 43af. + +* Menu: + +* Tool identifiers:: +* Events:: +* Turning events on and off:: +* Registering callback functions:: + + +File: python.info, Node: Tool identifiers, Next: Events, Up: sys monitoring — Execution event 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 +.................................... + + -- Function: 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: 204. if + 'tool_id' is in use. + + -- Function: sys.monitoring.free_tool_id (tool_id: int, /) -> None + + Should be called once a tool no longer requires 'tool_id'. + + Note: *note free_tool_id(): 43b2. will not disable global or local + events associated with 'tool_id', nor will it unregister any + callback functions. This function is only intended to be used to + notify the VM that the particular 'tool_id' is no longer in use. + + -- Function: 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 — Execution event monitoring + +5.30.2.3 Events +............... + +The following events are supported: + + -- monitoring-event: sys.monitoring.events.BRANCH + + A conditional branch is taken (or not). + + -- 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. + + -- 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: 43c1. event. + + -- monitoring-event: sys.monitoring.events.RERAISE + + An exception is re-raised, for example at the end of a *note + finally: 9ca. block. + + -- monitoring-event: sys.monitoring.events.STOP_ITERATION + + An artificial *note StopIteration: bfa. is raised; see *note the + STOP_ITERATION event: 43c3. + +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: 43bc. and *note PY_START: +43bd. 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: + ... + +Events are divided into three groups: + +* Menu: + +* Local events:: +* Ancillary events:: +* Other events:: +* The STOP_ITERATION event:: + + +File: python.info, Node: Local events, Next: Ancillary events, Up: Events + +5.30.2.4 Local events +..................... + +Local events are associated with normal execution of the program and +happen at clearly defined locations. All local events can be disabled. +The local events are: + + * *note PY_START: 43bd. + + * *note PY_RESUME: 43bb. + + * *note PY_RETURN: 43bc. + + * *note PY_YIELD: 43c0. + + * *note CALL: 1646. + + * *note LINE: 43ba. + + * *note INSTRUCTION: 43b8. + + * *note JUMP: 43b9. + + * *note BRANCH: 43b4. + + * *note STOP_ITERATION: 43c1. + + +File: python.info, Node: Ancillary events, Next: Other events, Prev: Local events, Up: Events + +5.30.2.5 Ancillary events +......................... + +Ancillary events can be monitored like other events, but are controlled +by another event: + + * *note C_RAISE: 43b5. + + * *note C_RETURN: 43b6. + +The *note C_RETURN: 43b6. and *note C_RAISE: 43b5. events are controlled +by the *note CALL: 1646. event. *note C_RETURN: 43b6. and *note +C_RAISE: 43b5. events will only be seen if the corresponding *note CALL: +1646. event is being monitored. + + +File: python.info, Node: Other events, Next: The STOP_ITERATION event, Prev: Ancillary events, Up: Events + +5.30.2.6 Other events +..................... + +Other events are not necessarily tied to a specific location in the +program and cannot be individually disabled. + +The other events that can be monitored are: + + * *note PY_THROW: 43be. + + * *note PY_UNWIND: 43bf. + + * *note RAISE: 15f0. + + * *note EXCEPTION_HANDLED: 43b7. + + +File: python.info, Node: The STOP_ITERATION event, Prev: Other events, Up: Events + +5.30.2.7 The STOP_ITERATION event +................................. + +PEP 380(1) specifies that a *note StopIteration: bfa. 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: 43c1. event is +provided. *note STOP_ITERATION: 43c1. can be locally disabled, unlike +*note RAISE: 15f0. + + ---------- 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 — Execution event monitoring + +5.30.2.8 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 or for a particular code object. + +* 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.9 Setting events globally +................................ + +Events can be controlled globally by modifying the set of events being +monitored. + + -- Function: sys.monitoring.get_events (tool_id: int, /) -> int + + Returns the ‘int’ representing all the active events. + + -- Function: sys.monitoring.set_events (tool_id: int, event_set: int, + /) -> None + + Activates all events which are set in 'event_set'. Raises a *note + ValueError: 204. 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.10 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: 2e3. should be +prepared to accept a look-alike object from functions which are not +defined in Python (see *note Monitoring C API: 15c.). + + -- Function: sys.monitoring.get_local_events (tool_id: int, code: + CodeType, /) -> int + + Returns all the local events for 'code' + + -- Function: sys.monitoring.set_local_events (tool_id: int, code: + CodeType, event_set: int, /) -> None + + Activates all the local events for 'code' which are set in + 'event_set'. Raises a *note ValueError: 204. if 'tool_id' is not + in use. + +Local events add to global events, but do not mask them. In other +words, all global events will trigger for a code object, regardless of +the local events. + + +File: python.info, Node: Disabling events, Prev: Per code object events, Up: Turning events on and off + +5.30.2.11 Disabling events +.......................... + + -- Data: sys.monitoring.DISABLE + + A special value that can be returned from a callback function to + disable events for the current code location. + +Local events can be disabled for a specific code location by returning +*note sys.monitoring.DISABLE: 43d1. from a callback function. This does +not change which events are set, or any other code locations for the +same event. + +Disabling events for specific locations is very important for high +performance monitoring. For example, a program can be run under a +debugger with no overhead if the debugger disables all monitoring except +for a few breakpoints. + + -- Function: sys.monitoring.restart_events () -> None + + Enable all the events that were disabled by *note + sys.monitoring.DISABLE: 43d1. for all tools. + + +File: python.info, Node: Registering callback functions, Prev: Turning events on and off, Up: sys monitoring — Execution event monitoring + +5.30.2.12 Registering callback functions +........................................ + +To register a callable for events call + + -- Function: sys.monitoring.register_callback (tool_id: int, event: + int, func: Callable | None, /) -> Callable | None + + Registers the callable 'func' for the 'event' with the given + 'tool_id' + + If another callback was registered for the given 'tool_id' and + 'event', it is unregistered and returned. Otherwise *note + register_callback(): 41ef. returns ‘None’. + + Raises an *note auditing event: 18ba. + ‘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. + +* Menu: + +* Callback function arguments:: + + +File: python.info, Node: Callback function arguments, Up: Registering callback functions + +5.30.2.13 Callback function arguments +..................................... + + -- Data: 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. +Different events will provide the callback function with different +arguments, as follows: + + * *note PY_START: 43bd. and *note PY_RESUME: 43bb.: + + func(code: CodeType, instruction_offset: int) -> DISABLE | Any + + * *note PY_RETURN: 43bc. and *note PY_YIELD: 43c0.: + + func(code: CodeType, instruction_offset: int, retval: object) -> DISABLE | Any + + * *note CALL: 1646, *note C_RAISE: 43b5. and *note C_RETURN: 43b6.: + + func(code: CodeType, instruction_offset: int, callable: object, arg0: object | MISSING) -> DISABLE | Any + + If there are no arguments, 'arg0' is set to *note + sys.monitoring.MISSING: 43d5. + + * *note RAISE: 15f0, *note RERAISE: 43c2, *note EXCEPTION_HANDLED: + 43b7, *note PY_UNWIND: 43bf, *note PY_THROW: 43be. and *note + STOP_ITERATION: 43c1.: + + func(code: CodeType, instruction_offset: int, exception: BaseException) -> DISABLE | Any + + * *note LINE: 43ba.: + + func(code: CodeType, line_number: int) -> DISABLE | Any + + * *note BRANCH: 43b4. and *note JUMP: 43b9.: + + func(code: CodeType, instruction_offset: int, destination_offset: int) -> DISABLE | Any + + Note that the 'destination_offset' is where the code will next + execute. For an untaken branch this will be the offset of the + instruction following the branch. + + * *note INSTRUCTION: 43b8.: + + func(code: CodeType, instruction_offset: int) -> DISABLE | Any + + +File: python.info, Node: sysconfig — Provide access to Python’s configuration information, Next: builtins — Built-in objects, Prev: sys monitoring — Execution event monitoring, Up: Python Runtime Services + +5.30.3 ‘sysconfig’ — Provide access to Python’s configuration information +------------------------------------------------------------------------- + +Added in version 3.2. + +'Source code:' Lib/sysconfig(1) + +__________________________________________________________________ + +The *note sysconfig: db. module provides access to Python’s +configuration information like the list of installation paths and the +configuration variables relevant for the current platform. + +* Menu: + +* Configuration variables:: +* Installation paths:: +* User scheme:: +* Home scheme:: +* Prefix scheme:: +* Installation path functions:: +* Other functions: Other functions<3>. +* Command-line usage: Command-line usage<3>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/sysconfig + + +File: python.info, Node: Configuration variables, Next: Installation paths, Up: sysconfig — Provide access to Python’s configuration information + +5.30.3.1 Configuration variables +................................ + +A Python distribution contains a ‘Makefile’ and a ‘pyconfig.h’ header +file that are necessary to build both the Python binary itself and +third-party C extensions compiled using ‘setuptools’. + +*note sysconfig: db. puts all variables found in these files in a +dictionary that can be accessed using *note get_config_vars(): 1025. or +*note get_config_var(): 1024. + +Notice that on Windows, it’s a much smaller set. + + -- Function: sysconfig.get_config_vars (*args) + + With no arguments, return a dictionary of all configuration + variables relevant for the current platform. + + With arguments, return a list of values that result from looking up + each argument in the configuration variable dictionary. + + For each argument, if the value is not found, return ‘None’. + + -- Function: sysconfig.get_config_var (name) + + Return the value of a single variable 'name'. Equivalent to + ‘get_config_vars().get(name)’. + + If 'name' is not found, return ‘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: Installation paths, Next: User scheme, Prev: Configuration variables, Up: sysconfig — Provide access to Python’s configuration information + +5.30.3.2 Installation paths +........................... + +Python uses an installation scheme that differs depending on the +platform and on the installation options. These schemes are stored in +*note sysconfig: db. under unique identifiers based on the value +returned by *note os.name: 2b0e. The schemes are used by package +installers to determine where to copy files to. + +Python currently supports nine schemes: + + - 'posix_prefix': scheme for POSIX platforms like Linux or macOS. + This is the default scheme used when Python or a component is + installed. + + - '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: 130f.). + + - 'posix_venv': scheme for *note Python virtual environments: 111. 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: 111. 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': scheme for macOS, when the 'user' option is + used. + +Each scheme is itself composed of a series of paths and each path has a +unique identifier. Python currently uses eight paths: + + - 'stdlib': directory containing the standard Python library files + that are not platform-specific. + + - 'platstdlib': directory containing the standard Python library + files that are platform-specific. + + - 'platlib': directory for site-specific, platform-specific files. + + - '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': directory for script files. + + - 'data': directory for data files. + + +File: python.info, Node: User scheme, Next: Home scheme, Prev: Installation paths, Up: sysconfig — Provide access to Python’s configuration information + +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: +130f. (written as ‘`userbase'’ hereafter). This scheme installs pure +Python modules and extension modules in the same location (also known as +*note site.USER_SITE: 1d35.). + +* 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 Installation directory + +----------------------------------------------------------------------------------- + +'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 Installation directory + +----------------------------------------------------------------------------------- + +'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 Installation directory + +----------------------------------------------------------------------------------- + +'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 — Provide access to Python’s configuration information + +5.30.3.7 Home scheme +.................... + +The idea behind the “home scheme” is that you build and maintain a +personal stash of Python modules. This scheme’s name is derived from +the idea of a “home” directory on Unix, since it’s not unusual for a +Unix user to make their home directory have a layout similar to ‘/usr/’ +or ‘/usr/local/’. This scheme can be used by anyone, regardless of the +operating system they are installing for. + +* Menu: + +* posix_home:: + + +File: python.info, Node: posix_home, Up: Home scheme + +5.30.3.8 ‘posix_home’ +..................... + +Path Installation directory + +----------------------------------------------------------------------------------- + +'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 — Provide access to Python’s configuration information + +5.30.3.9 Prefix scheme +...................... + +The “prefix scheme” is useful when you wish to use one Python +installation to perform the build/install (i.e., to run the setup +script), but install modules into the third-party module directory of a +different Python installation (or something that looks like a different +Python installation). If this sounds a trifle unusual, it is—that’s why +the user and home schemes come before. However, there are at least two +known cases where the prefix scheme will be useful. + +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 Installation directory + +---------------------------------------------------------------------------------- + +'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 Installation directory + +---------------------------------------------------------------------------------- + +'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: Other functions<3>, Prev: Prefix scheme, Up: sysconfig — Provide access to Python’s configuration information + +5.30.3.12 Installation path functions +..................................... + +*note sysconfig: db. provides some functions to determine these +installation paths. + + -- Function: sysconfig.get_scheme_names () + + Return a tuple containing all schemes currently supported in *note + sysconfig: db. + + -- Function: 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. + + Changed in version 3.11: When Python runs from a virtual + environment, the 'venv' scheme is returned. + + -- Function: 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(): 43e6. It can be passed to *note sysconfig: db. + functions that take a 'scheme' argument, such as *note get_paths(): + 1237. + + Added in version 3.10. + + Changed in version 3.11: When Python runs from a virtual + environment and ‘key="prefix"’, the 'venv' scheme is returned. + + -- Function: 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(): 1823. and *note get_preferred_scheme(): 68c. + instead. + + Added in version 3.10. + + -- Function: sysconfig.get_path_names () + + Return a tuple containing all path names currently supported in + *note sysconfig: db. + + -- Function: sysconfig.get_path (name[, scheme[, vars[, expand]]]) + + Return an installation path corresponding to the path 'name', from + the install scheme named 'scheme'. + + 'name' has to be a value from the list returned by *note + get_path_names(): 43e8. + + *note sysconfig: db. 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(): 1321. will use the variables returned by *note + get_config_vars(): 1025. to expand the path. All variables have + default values for each platform so one may call this function and + get the default value. + + If 'scheme' is provided, it must be a value from the list returned + by *note get_scheme_names(): 43e6. Otherwise, the default scheme + for the current platform is used. + + If 'vars' is provided, it must be a dictionary of variables that + will update the dictionary returned by *note get_config_vars(): + 1025. + + If 'expand' is set to ‘False’, the path will not be expanded using + the variables. + + If 'name' is not found, raise a *note KeyError: 33f. + + -- Function: sysconfig.get_paths ([scheme[, vars[, expand]]]) + + Return a dictionary containing all installation paths corresponding + to an installation scheme. See *note get_path(): 1321. for more + information. + + If 'scheme' is not provided, will use the default scheme for the + current platform. + + If 'vars' is provided, it must be a dictionary of variables that + will update the dictionary used to expand the paths. + + If 'expand' is set to false, the paths will not be expanded. + + If 'scheme' is not an existing scheme, *note get_paths(): 1237. + will raise a *note KeyError: 33f. + + +File: python.info, Node: Other functions<3>, Next: Command-line usage<3>, Prev: Installation path functions, Up: sysconfig — Provide access to Python’s configuration information + +5.30.3.13 Other functions +......................... + + -- Function: sysconfig.get_python_version () + + Return the ‘MAJOR.MINOR’ Python version number as a string. + Similar to ‘'%d.%d' % sys.version_info[:2]’. + + -- Function: sysconfig.get_platform () + + Return a string that identifies the current 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(): 110a.), although the exact information + included depends on the OS; e.g., on Linux, the kernel version + isn’t particularly important. + + Examples of returned values: + + - linux-i586 + + - linux-alpha (?) + + - solaris-2.6-sun4u + + Windows will return one of: + + - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and + EM64T) + + - win-arm64 (64-bit Windows on ARM64, aka AArch64) + + - win32 (all others - specifically, sys.platform is returned) + + macOS can return: + + - macosx-10.6-ppc + + - macosx-10.4-ppc64 + + - macosx-10.3-i386 + + - macosx-10.4-fat + + For other non-POSIX platforms, currently just returns *note + sys.platform: a8d. + + -- Function: sysconfig.is_python_build () + + Return ‘True’ if the running Python interpreter was built from + source and is being run from its built location, and not from a + location resulting from e.g. running ‘make install’ or installing + via a binary installer. + + -- Function: sysconfig.parse_config_h (fp[, vars]) + + Parse a ‘config.h’-style file. + + 'fp' is a file-like object pointing to the ‘config.h’-like file. + + A dictionary containing name/value pairs is returned. If an + optional dictionary is passed in as the second argument, it is used + instead of a new dictionary, and updated with the values read in + the file. + + -- Function: sysconfig.get_config_h_filename () + + Return the path of ‘pyconfig.h’. + + -- Function: sysconfig.get_makefile_filename () + + Return the path of ‘Makefile’. + + +File: python.info, Node: Command-line usage<3>, Prev: Other functions<3>, Up: sysconfig — Provide access to Python’s configuration information + +5.30.3.14 Command-line usage +............................ + +You can use *note sysconfig: db. 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" + ... + +This call will print in the standard output the information returned by +*note get_platform(): 1235, *note get_python_version(): 1236, *note +get_path(): 1321. and *note get_config_vars(): 1025. + + +File: python.info, Node: builtins — Built-in objects, Next: __main__ — Top-level code environment, Prev: sysconfig — Provide access to Python’s configuration information, Up: Python Runtime Services + +5.30.4 ‘builtins’ — Built-in objects +------------------------------------ + +__________________________________________________________________ + +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(): 517. + +This module is not normally accessed explicitly by most applications, +but can be useful in modules that provide objects with the same name as +a built-in value, but in which the built-in of that name is also needed. +For example, in a module that wants to implement an *note open(): 517. +function that wraps the built-in *note open(): 517, this module can be +used directly: + + 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() + + # ... + +As an implementation detail, most modules have the name ‘__builtins__’ +made available as part of their globals. The value of ‘__builtins__’ is +normally either this module or the value of this module’s *note +__dict__: 558. attribute. Since this is an implementation detail, it +may not be used by alternate implementations of Python. + +See also +........ + + * *note Built-in Constants: 2184. + + * *note Built-in Exceptions: 1883. + + * *note Built-in Functions: 1250. + + * *note Built-in Types: 218e. + + +File: python.info, Node: __main__ — Top-level code environment, Next: warnings — Warning control, Prev: builtins — Built-in objects, Up: Python Runtime Services + +5.30.5 ‘__main__’ — Top-level code environment +---------------------------------------------- + +__________________________________________________________________ + +In Python, the special name ‘__main__’ is used for two important +constructs: + + 1. the name of the top-level environment of the program, which can be + checked using the ‘__name__ == '__main__'’ expression; and + + 2. the ‘__main__.py’ file in Python packages. + +Both of these mechanisms are related to Python modules; how users +interact with them and how they interact with each other. They are +explained in detail below. If you’re new to Python modules, see the +tutorial section *note Modules: 1c56. for an introduction. + +* 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__ — Top-level code environment + +5.30.5.1 ‘__name__ == '__main__'’ +................................. + +When a Python module or package is imported, ‘__name__’ is set to the +module’s name. Usually, this is the name of the Python file itself +without the ‘.py’ extension: + + >>> import configparser + >>> configparser.__name__ + 'configparser' + +If the file is part of a package, ‘__name__’ will also include the +parent package’s path: + + >>> from concurrent.futures import process + >>> process.__name__ + 'concurrent.futures.process' + +However, if the module is executed in the top-level code environment, +its ‘__name__’ is set to the string ‘'__main__'’. + +* Menu: + +* What is the “top-level code environment”?:: +* Idiomatic Usage:: +* Packaging Considerations:: + + +File: python.info, Node: What is the “top-level code environment”?, Next: Idiomatic Usage, Up: __name__ == '__main__' + +5.30.5.2 What is the “top-level code environment”? +.................................................. + +‘__main__’ is the name of the environment where top-level code is run. +“Top-level code” is the first user-specified Python module that starts +running. It’s “top-level” because it imports all other modules that the +program needs. Sometimes “top-level code” is called an 'entry point' to +the application. + +The top-level code environment can be: + + * the scope of an interactive prompt: + + >>> __name__ + '__main__' + + * the Python module passed to the Python interpreter as a file + argument: + + $ python helloworld.py + Hello, world! + + * the Python module or package passed to the Python interpreter with + the *note -m: 5dd. argument: + + $ python -m tarfile + usage: tarfile.py [-h] [-v] (...) + + * Python code read by the Python interpreter from standard input: + + $ echo "import this" | python + The Zen of Python, by Tim Peters + + Beautiful is better than ugly. + Explicit is better than implicit. + ... + + * Python code passed to the Python interpreter with the *note -c: + 5dc. argument: + + $ python -c "import this" + The Zen of Python, by Tim Peters + + Beautiful is better than ugly. + Explicit is better than implicit. + ... + +In each of these situations, the top-level module’s ‘__name__’ is set to +‘'__main__'’. + +As a result, a module can discover whether or not it is running in the +top-level environment by checking its own ‘__name__’, which allows a +common idiom for conditionally executing code when the module is not +initialized from an import statement: + + if __name__ == '__main__': + # Execute when the module is not initialized from an import statement. + ... + +See also +........ + +For a more detailed look at how ‘__name__’ is set in all situations, see +the tutorial section *note Modules: 1c56. + + +File: python.info, Node: Idiomatic Usage, Next: Packaging Considerations, Prev: What is the “top-level code environment”?, Up: __name__ == '__main__' + +5.30.5.3 Idiomatic Usage +........................ + +Some modules contain code that is intended for script use only, like +parsing command-line arguments or fetching data from standard input. If +a module like this was imported from a different module, for example to +unit test it, the script code would unintentionally execute as well. + +This is where using the ‘if __name__ == '__main__'’ code block comes in +handy. Code within this block won’t run unless the module is executed +in the top-level environment. + +Putting as few statements as possible in the block below ‘if __name__ == +'__main__'’ can improve code clarity and correctness. Most often, a +function named ‘main’ encapsulates the program’s primary behavior: + + # 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 + +Note that if the module didn’t encapsulate code inside the ‘main’ +function but instead put it directly within the ‘if __name__ == +'__main__'’ block, the ‘phrase’ variable would be global to the entire +module. This is error-prone as other functions within the module could +be unintentionally using the global variable instead of a local name. A +‘main’ function solves this problem. + +Using a ‘main’ function has the added benefit of the ‘echo’ function +itself being isolated and importable elsewhere. When ‘echo.py’ is +imported, the ‘echo’ and ‘main’ functions will be defined, but neither +of them will be called, because ‘__name__ != '__main__'’. + + +File: python.info, Node: Packaging Considerations, Prev: Idiomatic Usage, Up: __name__ == '__main__' + +5.30.5.4 Packaging Considerations +................................. + +‘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(): 133c. For +example: + + sys.exit(main()) + +Since the call to ‘main’ is wrapped in *note sys.exit(): 133c, the +expectation is that your function will return some value acceptable as +an input to *note sys.exit(): 133c.; 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(): 133c. 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: +939. The ‘echo.py’ example from earlier exemplifies using the +‘sys.exit(main())’ convention. + +See also +........ + +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__ — Top-level code environment + +5.30.5.5 ‘__main__.py’ in Python Packages +......................................... + +If you are not familiar with Python packages, see section *note +Packages: 1c67. 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: 5dd. 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 Intra-package References: +1c6c. in the *note Modules: 1c56. section of the tutorial. + +* Menu: + +* Idiomatic Usage: Idiomatic Usage<2>. + + +File: python.info, Node: Idiomatic Usage<2>, Up: __main__ py in Python Packages + +5.30.5.6 Idiomatic Usage +........................ + +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 also +........ + +See *note venv: 111. 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: be. for more details on the *note -m: 5dd. flag to the +interpreter executable. + +See *note zipapp: 130. 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__ — Top-level code environment + +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: 1c57.) 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`!') + + if '__file__' in dir(__main__): + print(__main__.my_name, "found in file", __main__.__file__) + else: + 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 found in file /path/to/start.py + +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: 1550. at +interpreter startup, and populates it by running top-level code. In our +example this is the ‘start’ module which runs line by line and imports +‘namely’. In turn, ‘namely’ imports ‘__main__’ (which is really +‘start’). That’s an import cycle! Fortunately, since the partially +populated ‘__main__’ module is present in *note sys.modules: 1550, +Python passes that to ‘namely’. See *note Special considerations for +__main__: 200b. 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 + +Note that in this case the ‘__main__’ scope doesn’t contain a ‘__file__’ +attribute as it’s interactive. + +The ‘__main__’ scope is used in the implementation of *note pdb: a5. and +*note rlcompleter: bd. + + +File: python.info, Node: warnings — Warning control, Next: dataclasses — Data Classes, Prev: __main__ — Top-level code environment, Up: Python Runtime Services + +5.30.6 ‘warnings’ — Warning control +----------------------------------- + +'Source code:' Lib/warnings.py(1) + +__________________________________________________________________ + +Warning messages are typically issued in situations where it is useful +to alert the user of some condition in a program, where that condition +(normally) doesn’t warrant raising an exception and terminating the +program. For example, one might want to issue a warning when a program +uses an obsolete module. + +Python programmers issue warnings by calling the *note warn(): 14e4. +function defined in this module. (C programmers use *note +PyErr_WarnEx(): 1416.; see *note Exception Handling: 43fe. for details). + +Warning messages are normally written to *note sys.stderr: 939, but +their disposition can be changed flexibly, from ignoring all warnings to +turning them into exceptions. The disposition of warnings can vary +based on the *note warning category: 22b2, the text of the warning +message, and the source location where it is issued. Repetitions of a +particular warning for the same source location are typically +suppressed. + +There are two stages in warning control: first, each time a warning is +issued, a determination is made whether a message should be issued or +not; next, if a message is to be issued, it is formatted and printed +using a user-settable hook. + +The determination whether to issue a warning message is controlled by +the *note warning filter: 8c8, which is a sequence of matching rules and +actions. Rules can be added to the filter by calling *note +filterwarnings(): 1472. and reset to its default state by calling *note +resetwarnings(): 43ff. + +The printing of warning messages is done by calling *note showwarning(): +4400, which may be overridden; the default implementation of this +function formats the message by calling *note formatwarning(): 1a14, +which is also available for use by custom implementations. + +See also +........ + +*note logging.captureWarnings(): 2cb6. allows you to handle all warnings +with the standard logging infrastructure. + +* Menu: + +* Warning Categories:: +* The Warnings Filter:: +* Temporarily Suppressing Warnings:: +* Testing Warnings:: +* Updating Code For New Versions of Dependencies:: +* Available Functions:: +* Available Context Managers:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/warnings.py + + +File: python.info, Node: Warning Categories, Next: The Warnings Filter, Up: warnings — Warning control + +5.30.6.1 Warning Categories +........................... + +There are a number of built-in exceptions that represent warning +categories. This categorization is useful to be able to filter out +groups of warnings. + +While these are technically *note built-in exceptions: 22b0, they are +documented here, because conceptually they belong to the warnings +mechanism. + +User code can define additional warning categories by subclassing one of +the standard warning categories. A warning category must always be a +subclass of the *note Warning: 22b3. class. + +The following warnings category classes are currently defined: + +Class Description + +------------------------------------------------------------------------------------------- + +*note Warning: 22b3. This is the base class of all warning category + classes. It is a subclass of + *note Exception: 9d9. + + +*note UserWarning: 22b4. The default category for *note warn(): 14e4. + + +*note DeprecationWarning: 1a5. Base category for warnings about deprecated + features when those warnings are intended for + other Python developers (ignored by default, + unless triggered by code in ‘__main__’). + + +*note SyntaxWarning: 461. Base category for warnings about dubious + syntactic features. + + +*note RuntimeWarning: 1bd. Base category for warnings about dubious runtime + features. + + +*note FutureWarning: 411. Base category for warnings about deprecated + features when those warnings are intended for end + users of applications that are written in Python. + + +*note PendingDeprecationWarning: 8c7. Base category for warnings about features that + will be deprecated in the future (ignored by + default). + + +*note ImportWarning: 4f6. Base category for warnings triggered during the + process of importing a module (ignored by + default). + + +*note UnicodeWarning: 13ef. Base category for warnings related to Unicode. + + +*note BytesWarning: c23. Base category for warnings related to + *note bytes: 1c2. and *note bytearray: 53a. + + +*note ResourceWarning: 246. Base category for warnings related to resource + usage (ignored by default). + + +Changed in version 3.7: Previously *note DeprecationWarning: 1a5. and +*note FutureWarning: 411. 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: The Warnings Filter, Next: Temporarily Suppressing Warnings, Prev: Warning Categories, Up: warnings — Warning control + +5.30.6.2 The Warnings Filter +............................ + +The warnings filter controls whether warnings are ignored, displayed, or +turned into errors (raising an exception). + +Conceptually, the warnings filter maintains an ordered list of filter +specifications; any specific warning is matched against each filter +specification in the list in turn until a match is found; the filter +determines the disposition of the match. Each entry is a tuple of the +form ('action', 'message', 'category', 'module', 'lineno'), where: + + * 'action' is one of the following strings: + + Value Disposition + + ----------------------------------------------------------------------- + + ‘"default"’ print the first occurrence of matching warnings + for each location (module + line number) where + the warning is issued + + + ‘"error"’ turn matching warnings into exceptions + + + ‘"ignore"’ never print matching warnings + + + ‘"always"’ always print matching warnings + + + ‘"module"’ print the first occurrence of matching warnings + for each module where the warning is issued + (regardless of line number) + + + ‘"once"’ print only the first occurrence of matching + warnings, regardless of location + + + * 'message' is a string containing a regular expression that the + start of the warning message must match, case-insensitively. In + *note -W: 8c6. and *note PYTHONWARNINGS: baa, 'message' is a + literal string that the start of the warning message must contain + (case-insensitively), ignoring any whitespace at the start or end + of 'message'. + + * 'category' is a class (a subclass of *note Warning: 22b3.) of which + the warning category must be a subclass in order to match. + + * 'module' is a string containing a regular expression that the start + of the fully qualified module name must match, case-sensitively. + In *note -W: 8c6. and *note PYTHONWARNINGS: baa, 'module' is a + literal string that the fully qualified module name must be equal + to (case-sensitively), ignoring any whitespace at the start or end + of 'module'. + + * 'lineno' is an integer that the line number where the warning + occurred must match, or ‘0’ to match all line numbers. + +Since the *note Warning: 22b3. class is derived from the built-in *note +Exception: 9d9. class, to turn a warning into an error we simply raise +‘category(message)’. + +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:: +* Default Warning Filter:: +* Overriding the default filter:: + + +File: python.info, Node: Repeated Warning Suppression Criteria, Next: Describing Warning Filters, Up: The Warnings Filter + +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: Default Warning Filter, Prev: Repeated Warning Suppression Criteria, Up: The Warnings Filter + +5.30.6.4 Describing Warning Filters +................................... + +The warnings filter is initialized by *note -W: 8c6. options passed to +the Python interpreter command line and the *note PYTHONWARNINGS: baa. +environment variable. The interpreter saves the arguments for all +supplied entries without interpretation in *note sys.warnoptions: 3ac.; +the *note warnings: 112. module parses these when it is first imported +(invalid options are ignored, after printing a message to *note +sys.stderr: 939.). + +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 The +Warnings Filter: 8c8. When listing multiple filters on a single line +(as for *note PYTHONWARNINGS: baa.), 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: Default Warning Filter, Next: Overriding the default filter, Prev: Describing Warning Filters, Up: The Warnings Filter + +5.30.6.5 Default Warning Filter +............................... + +By default, Python installs several warning filters, which can be +overridden by the *note -W: 8c6. command-line option, the *note +PYTHONWARNINGS: baa. environment variable and calls to *note +filterwarnings(): 1472. + +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: 1fb, the list of default warning filters is +empty. + +Changed in version 3.2: *note DeprecationWarning: 1a5. is now ignored by +default in addition to *note PendingDeprecationWarning: 8c7. + +Changed in version 3.7: *note DeprecationWarning: 1a5. is once again +shown by default when triggered directly by code in ‘__main__’. + +Changed in version 3.7: *note BytesWarning: c23. no longer appears in +the default filter list and is instead configured via *note +sys.warnoptions: 3ac. when *note -b: 5df. is specified twice. + + +File: python.info, Node: Overriding the default filter, Prev: Default Warning Filter, Up: The Warnings Filter + +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: 3ac. 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: 1a5. 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: Temporarily Suppressing Warnings, Next: Testing Warnings, Prev: The Warnings Filter, Up: warnings — Warning control + +5.30.6.7 Temporarily Suppressing Warnings +......................................... + +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: 581. +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. Note: this can only be +guaranteed in a single-threaded application. If two or more threads use +the *note catch_warnings: 581. context manager at the same time, the +behavior is undefined. + + +File: python.info, Node: Testing Warnings, Next: Updating Code For New Versions of Dependencies, Prev: Temporarily Suppressing Warnings, Up: warnings — Warning control + +5.30.6.8 Testing Warnings +......................... + +To test warnings raised by code, use the *note catch_warnings: 581. +context manager. With it you can temporarily mutate the warnings filter +to facilitate your testing. For instance, do the following to capture +all raised warnings to check: + + 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) + +One can also cause all warnings to be exceptions by using ‘error’ +instead of ‘always’. One thing to be aware of is that if a warning has +already been raised because of a ‘once’/‘default’ rule, then no matter +what filters are set the warning will not be seen again unless the +warnings registry related to the warning has been cleared. + +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. The *note showwarning(): 4400. function in +the module is also restored to its original value. Note: this can only +be guaranteed in a single-threaded application. If two or more threads +use the *note catch_warnings: 581. context manager at the same time, the +behavior is undefined. + +When testing multiple operations that raise the same kind of warning, it +is important to test them in a manner that confirms each operation is +raising a new warning (e.g. set warnings to be raised as exceptions and +check the operations raise exceptions, check that the length of the +warning list continues to increase after each operation, or else delete +the previous entries from the warnings list before each new operation). + + +File: python.info, Node: Updating Code For New Versions of Dependencies, Next: Available Functions, Prev: Testing Warnings, Up: warnings — Warning control + +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: 1a5. (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: 106. +module does this). + +In less ideal cases, applications can be checked for use of deprecated +interfaces by passing *note -Wd: 8c6. to the Python interpreter (this is +shorthand for ‘-W default’) or setting ‘PYTHONWARNINGS=default’ in the +environment. This enables default handling for all warnings, including +those that are ignored by default. To change what action is taken for +encountered warnings you can change what argument is passed to *note -W: +8c6. (e.g. ‘-W error’). See the *note -W: 8c6. flag for more details +on what is possible. + + +File: python.info, Node: Available Functions, Next: Available Context Managers, Prev: Updating Code For New Versions of Dependencies, Up: warnings — Warning control + +5.30.6.10 Available Functions +............................. + + -- Function: warnings.warn (message, category=None, stacklevel=1, + source=None, *, skip_file_prefixes=()) + + Issue a warning, or maybe ignore it or raise an exception. The + 'category' argument, if given, must be a *note warning category + class: 22b2.; it defaults to *note UserWarning: 22b4. + Alternatively, 'message' can be a *note Warning: 22b3. instance, in + which case 'category' will be ignored and ‘message.__class__’ will + be used. In this case, the message text will be ‘str(message)’. + This function raises an exception if the particular warning issued + is changed into an error by the *note warnings filter: 8c8. The + 'stacklevel' argument can be used by wrapper functions written in + Python, like this: + + 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', if supplied, is the destroyed object which emitted a + *note ResourceWarning: 246. + + Changed in version 3.6: Added 'source' parameter. + + Changed in version 3.12: Added 'skip_file_prefixes'. + + -- Function: 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(): + 14e4, passing in explicitly the message, category, filename and + line number, and optionally the module name and the registry (which + should be the ‘__warningregistry__’ dictionary of the module). The + module name defaults to the filename with ‘.py’ stripped; if no + registry is passed, the warning is never suppressed. 'message' + must be a string and 'category' a subclass of *note Warning: 22b3. + or 'message' may be a *note Warning: 22b3. instance, in which case + 'category' will be ignored. + + 'module_globals', if supplied, should be the global namespace in + use by the code for which the warning is issued. (This argument is + used to support displaying source for modules found in zipfiles or + other non-filesystem import sources). + + 'source', if supplied, is the destroyed object which emitted a + *note ResourceWarning: 246. + + Changed in version 3.6: Add the 'source' parameter. + + -- Function: warnings.showwarning (message, category, filename, lineno, + file=None, line=None) + + Write a warning to a file. The default implementation calls + ‘formatwarning(message, category, filename, lineno, line)’ and + writes the resulting string to 'file', which defaults to *note + sys.stderr: 939. You may replace this function with any callable + by assigning to ‘warnings.showwarning’. 'line' is a line of source + code to be included in the warning message; if 'line' is not + supplied, *note showwarning(): 4400. will try to read the line + specified by 'filename' and 'lineno'. + + -- Function: warnings.formatwarning (message, category, filename, + lineno, line=None) + + Format a warning the standard way. This returns a string which may + contain embedded newlines and ends in a newline. 'line' is a line + of source code to be included in the warning message; if 'line' is + not supplied, *note formatwarning(): 1a14. will try to read the + line specified by 'filename' and 'lineno'. + + -- Function: warnings.filterwarnings (action, message='', + category=Warning, module='', lineno=0, append=False) + + Insert an entry into the list of *note warnings filter + specifications: 8c8. The entry is inserted at the front by + default; if 'append' is true, it is inserted at the end. This + checks the types of the arguments, compiles the 'message' and + 'module' regular expressions, and inserts them as a tuple in the + list of warnings filters. Entries closer to the front of the list + override entries later in the list, if both match a particular + warning. Omitted arguments default to a value that matches + everything. + + -- Function: warnings.simplefilter (action, category=Warning, lineno=0, + append=False) + + Insert a simple entry into the list of *note warnings filter + specifications: 8c8. The meaning of the function parameters is as + for *note filterwarnings(): 1472, but regular expressions are not + needed as the filter inserted always matches any message in any + module as long as the category and line number match. + + -- Function: warnings.resetwarnings () + + Reset the warnings filter. This discards the effect of all + previous calls to *note filterwarnings(): 1472, including that of + the *note -W: 8c6. command line options and calls to *note + simplefilter(): 6bd. + + -- Function: @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: 26f. will also generate a diagnostic on usage of the + deprecated object. + + Usage: + + 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 @overload: 3fb3. + decorator for the attribute to exist on the overload as returned by + *note typing.get_overloads(): 6aa. + + Added in version 3.13: See PEP 702(1). + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0702/ + + +File: python.info, Node: Available Context Managers, Prev: Available Functions, Up: warnings — Warning control + +5.30.6.11 Available Context Managers +.................................... + + -- Class: warnings.catch_warnings (*, record=False, module=None, + action=None, category=Warning, lineno=0, append=False) + + A context manager that copies and, upon exit, restores the warnings + filter and the *note showwarning(): 4400. function. If the + 'record' argument is *note False: b37. (the default) the context + manager returns *note None: 671. on entry. If 'record' is *note + True: c0d, a list is returned that is progressively populated with + objects as seen by a custom *note showwarning(): 4400. function + (which also suppresses output to ‘sys.stdout’). Each object in the + list has attributes with the same names as the arguments to *note + showwarning(): 4400. + + The 'module' argument takes a module that will be used instead of + the module returned when you import *note warnings: 112. whose + filter will be protected. This argument exists primarily for + testing the *note warnings: 112. module itself. + + If the 'action' argument is not ‘None’, the remaining arguments are + passed to *note simplefilter(): 6bd. as if it were called + immediately on entering the context. + + See *note The Warnings Filter: 8c8. for the meaning of the + 'category' and 'lineno' parameters. + + Note: The *note catch_warnings: 581. manager works by + replacing and then later restoring the module’s *note + showwarning(): 4400. function and internal list of filter + specifications. This means the context manager is modifying + global state and therefore is not thread-safe. + + Changed in version 3.11: Added the 'action', 'category', 'lineno', + and 'append' parameters. + + +File: python.info, Node: dataclasses — Data Classes, Next: contextlib — Utilities for with-statement contexts, Prev: warnings — Warning control, Up: Python Runtime Services + +5.30.7 ‘dataclasses’ — Data Classes +----------------------------------- + +'Source code:' Lib/dataclasses.py(1) + +__________________________________________________________________ + +This module provides a decorator and functions for automatically adding +generated *note special methods: 18ab. such as *note __init__(): 6ac. +and *note __repr__(): 618. to user-defined classes. It was originally +described in PEP 557(2). + +The member variables to use in these generated methods are defined using +PEP 526(3) type annotations. For example, this code: + + 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 + +will add, among other things, a ‘__init__()’ that looks like: + + 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 + +Note that this method is automatically added to the class: it is not +directly specified in the ‘InventoryItem’ definition shown above. + +Added in version 3.7. + +* Menu: + +* Module contents: Module contents<4>. +* Post-init processing:: +* Class variables:: +* Init-only variables:: +* Frozen instances:: +* Inheritance: Inheritance<2>. +* Re-ordering of keyword-only parameters in __init__(): Re-ordering of keyword-only parameters in __init__. +* Default factory functions:: +* Mutable default values:: +* Descriptor-typed fields:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/dataclasses.py + + (2) https://peps.python.org/pep-0557/ + + (3) https://peps.python.org/pep-0526/ + + +File: python.info, Node: Module contents<4>, Next: Post-init processing, Up: dataclasses — Data Classes + +5.30.7.1 Module contents +........................ + + -- Function: @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) + + This function is a *note decorator: 72c. that is used to add + generated *note special methods: 18ab. to classes, as described + below. + + The ‘@dataclass’ decorator examines the class to find ‘field’s. A + ‘field’ is defined as a class variable that has a *note type + annotation: d55. With two exceptions described below, nothing in + ‘@dataclass’ examines the type specified in the variable + annotation. + + The order of the fields in all of the generated methods is the + order in which they appear in the class definition. + + The ‘@dataclass’ decorator will add various “dunder” methods to the + class, described below. If any of the added methods already exist + in the class, the behavior depends on the parameter, as documented + below. The decorator returns the same class that it is called on; + no new class is created. + + 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__(): 6ac. method + will be generated. + + If the class already defines ‘__init__()’, this parameter is + ignored. + + - 'repr': If true (the default), a *note __repr__(): 618. 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__(): afa. 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__(): + 1292, *note __le__(): 12fe, *note __gt__(): 12ff, and *note + __ge__(): 1300. 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: 204. is + raised. + + If the class already defines any of ‘__lt__()’, ‘__le__()’, + ‘__gt__()’, or ‘__ge__()’, then *note TypeError: 534. is + raised. + + - 'unsafe_hash': If true, force ‘dataclasses’ to create a *note + __hash__(): afb. method, even though it may not be safe to do + so. Otherwise, generate a *note __hash__(): afb. method + according to how 'eq' and 'frozen' are set. The default value + is ‘False’. + + ‘__hash__()’ is used by built-in *note hash(): 5e7, 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__(): afb. 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: + 534. + + 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: a8c, 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. If *note __setattr__(): 1f2d. or *note + __delattr__(): 1f2e. is defined in the class, then *note + TypeError: 534. is raised. See the discussion below. + + - 'match_args': If true (the default is ‘True’), the *note + __match_args__: 18bf. tuple will be created from the list of + non keyword-only parameters to the generated *note __init__(): + 6ac. 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__(): 6ac. parameter generated from a keyword-only field + must be specified with a keyword when ‘__init__()’ is called. + See the *note parameter: 1eff. glossary entry for details. + Also see the *note KW_ONLY: 4415. section. + + Keyword-only fields are not included in ‘__match_args__’. + + Added in version 3.10. + + - 'slots': If true (the default is ‘False’), *note __slots__: + 14b5. 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: 534. is + raised. + + Warning: Calling no-arg *note super(): 4d7. in + dataclasses using ‘slots=True’ will result in the + following exception being raised: ‘TypeError: super(type, + obj): obj must be an instance or subtype of type’. The + two-arg *note super(): 4d7. is a valid workaround. See + gh-90562(1) for full details. + + Warning: Passing parameters to a base class *note + __init_subclass__(): 62d. when using ‘slots=True’ will + result in a *note TypeError: 534. Either use + ‘__init_subclass__’ with no parameters or use default + values as a workaround. See gh-91126(2) for full + details. + + Added in version 3.10. + + Changed in version 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: + 1f6f. Therefore, do not use ‘__slots__’ to retrieve the field + names of a dataclass. Use *note fields(): 1742. 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: fe9. It is an error to specify + ‘weakref_slot=True’ without also specifying ‘slots=True’. + + Added in version 3.11. + + ‘field’s may optionally specify a default value, using normal + Python syntax: + + @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__(): 6ac. method, which will be defined as: + + def __init__(self, a: int, b: int = 0): + + *note TypeError: 534. will be raised if a field without a default + value follows a field with a default value. This is true whether + this occurs in a single class, or as a result of class inheritance. + + -- Function: dataclasses.field (*, default=MISSING, + default_factory=MISSING, init=True, repr=True, hash=None, + compare=True, metadata=None, kw_only=MISSING) + + 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: 4416. value is a sentinel object + used to detect if some parameters are provided by the user. This + sentinel is used because ‘None’ is a valid value for some + parameters with a distinct meaning. No code should directly use + the *note MISSING: 4416. 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__(): 6ac. method. + + - 'repr': If true (the default), this field is included in the + string returned by the generated *note __repr__(): 618. + method. + + - 'hash': This can be a bool or ‘None’. If true, this field is + included in the generated *note __hash__(): afb. method. If + false, this field is excluded from the generated *note + __hash__(): afb. 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. + + One possible reason to set ‘hash=False’ but ‘compare=True’ + would be if a field is expensive to compute a hash value for, + that field is needed for equality testing, and there are other + fields that contribute to the type’s hash value. Even if a + field is excluded from the hash, it will still be used for + comparisons. + + - 'compare': If true (the default), this field is included in + the generated equality and comparison methods (*note __eq__(): + afa, *note __gt__(): 12ff, et al.). + + - 'metadata': This can be a mapping or ‘None’. ‘None’ is + treated as an empty dict. This value is wrapped in *note + MappingProxyType(): 469. to make it read-only, and exposed on + the *note Field: 2255. 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__(): 6ac. + method’s parameters are computed. + + Keyword-only fields are also not included in ‘__match_args__’. + + Added in version 3.10. + + 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: 1cb. 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. + + -- Class: dataclasses.Field + + ‘Field’ objects describe each defined field. These objects are + created internally, and are returned by the *note fields(): 1742. + 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(): 1a1f. + function. + + Other attributes may exist, but they are private and must not be + inspected or relied on. + + -- Class: dataclasses.InitVar + + ‘InitVar[T]’ type annotations describe variables that are *note + init-only: 4417. Fields annotated with ‘InitVar’ are considered + pseudo-fields, and thus are neither returned by the *note fields(): + 1742. function nor used in any way except adding them as parameters + to *note __init__(): 6ac. and an optional *note __post_init__(): + 4418. + + -- Function: dataclasses.fields (class_or_instance) + + Returns a tuple of *note Field: 2255. objects that define the + fields for this dataclass. Accepts either a dataclass, or an + instance of a dataclass. Raises *note TypeError: 534. if not + passed a dataclass or instance of one. Does not return + pseudo-fields which are ‘ClassVar’ or ‘InitVar’. + + -- Function: dataclasses.asdict (obj, *, dict_factory=dict) + + Converts the dataclass 'obj' to a dict (by using the factory + function 'dict_factory'). Each dataclass is converted to a dict of + its fields, as ‘name: value’ pairs. dataclasses, dicts, lists, and + tuples are recursed into. Other objects are copied with *note + copy.deepcopy(): b6e. + + 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: 534. if 'obj' is not a dataclass + instance. + + -- Function: dataclasses.astuple (obj, *, tuple_factory=tuple) + + Converts the dataclass 'obj' to a tuple (by using the factory + function 'tuple_factory'). Each dataclass is converted to a tuple + of its field values. dataclasses, dicts, lists, and tuples are + recursed into. Other objects are copied with *note + copy.deepcopy(): b6e. + + Continuing from the previous example: + + 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: 534. if 'obj' is not a + dataclass instance. + + -- Function: 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) + + 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: 6a8. 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: 1cb. + + 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. + + This function is not strictly required, because any Python + mechanism for creating a new class with ‘__annotations__’ can then + apply the *note @dataclass: 1cb. 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}) + + Is equivalent to: + + @dataclass + class C: + x: int + y: 'typing.Any' + z: int = 5 + + def add_one(self): + return self.x + 1 + + -- Function: 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: 534. If keys in 'changes' are not field names of + the given dataclass, raises *note TypeError: 534. + + The newly returned object is created by calling the *note + __init__(): 6ac. method of the dataclass. This ensures that *note + __post_init__(): 4418, 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__(): 4418. + + It is an error for 'changes' to contain any fields that are defined + as having ‘init=False’. A *note ValueError: 204. 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__(): 4418, 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(): 151. + + -- Function: dataclasses.is_dataclass (obj) + + Return ‘True’ if its parameter is a dataclass (including subclasses + of a dataclass) or an instance of one, otherwise return ‘False’. + + If you need to know if a class is an instance of a dataclass (and + not a dataclass itself), then add a further check for ‘not + isinstance(obj, type)’: + + def is_dataclass_instance(obj): + return is_dataclass(obj) and not isinstance(obj, type) + + -- Data: dataclasses.MISSING + + A sentinel value signifying a missing default or default_factory. + + -- Data: 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__(): 6ac. parameters that + must be specified as keywords when the class is instantiated. + + In this example, the fields ‘y’ and ‘z’ will be marked as + keyword-only fields: + + @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. + + -- Exception: dataclasses.FrozenInstanceError + + Raised when an implicitly defined *note __setattr__(): 1f2d. or + *note __delattr__(): 1f2e. is called on a dataclass which was + defined with ‘frozen=True’. It is a subclass of *note + AttributeError: 348. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/90562 + + (2) https://github.com/python/cpython/issues/91126 + + +File: python.info, Node: Post-init processing, Next: Class variables, Prev: Module contents<4>, Up: dataclasses — Data Classes + +5.30.7.2 Post-init processing +............................. + + -- Function: dataclasses.__post_init__ () + + When defined on the class, it will be called by the generated *note + __init__(): 6ac, 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. + + Among other uses, this allows for initializing field values that + depend on one or more other fields. For example: + + @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__(): 6ac. method generated by *note @dataclass: 1cb. +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__(): 4418. 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. + +See the section below on init-only variables for ways to pass parameters +to ‘__post_init__()’. Also see the warning about how *note replace(): +16f9. handles ‘init=False’ fields. + + +File: python.info, Node: Class variables, Next: Init-only variables, Prev: Post-init processing, Up: dataclasses — Data Classes + +5.30.7.3 Class variables +........................ + +One of the few places where *note @dataclass: 1cb. 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: 268. 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(): 1742. function. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0526/ + + +File: python.info, Node: Init-only variables, Next: Frozen instances, Prev: Class variables, Up: dataclasses — Data Classes + +5.30.7.4 Init-only variables +............................ + +Another place where *note @dataclass: 1cb. 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: 1822. If a +field is an *note InitVar: 1822, 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(): 1742. function. Init-only fields are +added as parameters to the generated *note __init__(): 6ac. method, and +are passed to the optional *note __post_init__(): 4418. method. They +are not otherwise used by dataclasses. + +For example, suppose a field will be initialized from a database, if a +value is not provided when creating the class: + + @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(): 1742. will return *note Field: 2255. +objects for ‘i’ and ‘j’, but not for ‘database’. + + +File: python.info, Node: Frozen instances, Next: Inheritance<2>, Prev: Init-only variables, Up: dataclasses — Data Classes + +5.30.7.5 Frozen instances +......................... + +It is not possible to create truly immutable Python objects. However, +by passing ‘frozen=True’ to the *note @dataclass: 1cb. decorator you can +emulate immutability. In that case, dataclasses will add *note +__setattr__(): 1f2d. and *note __delattr__(): 1f2e. methods to the +class. These methods will raise a *note FrozenInstanceError: 4419. when +invoked. + +There is a tiny performance penalty when using ‘frozen=True’: *note +__init__(): 6ac. cannot use simple assignment to initialize fields, and +must use ‘object.__setattr__()’. + + +File: python.info, Node: Inheritance<2>, Next: Re-ordering of keyword-only parameters in __init__, Prev: Frozen instances, Up: dataclasses — Data Classes + +5.30.7.6 Inheritance +.................... + +When the dataclass is being created by the *note @dataclass: 1cb. +decorator, it looks through all of the class’s base classes in reverse +MRO (that is, starting at *note object: a8c.) 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: 259, as specified in class ‘C’. + +The generated *note __init__(): 6ac. 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: Default factory functions, Prev: Inheritance<2>, Up: dataclasses — Data Classes + +5.30.7.7 Re-ordering of keyword-only parameters in ‘__init__()’ +............................................................... + +After the parameters needed for *note __init__(): 6ac. are computed, any +keyword-only parameters are moved to come after all regular +(non-keyword-only) parameters. This is a requirement of how +keyword-only parameters are implemented in Python: they must come after +non-keyword-only parameters. + +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): + +Note that the parameters have been re-ordered from how they appear in +the list of fields: parameters derived from regular fields are followed +by parameters derived from keyword-only fields. + +The relative ordering of keyword-only parameters is maintained in the +re-ordered ‘__init__()’ parameter list. + + +File: python.info, Node: Default factory functions, Next: Mutable default values, Prev: Re-ordering of keyword-only parameters in __init__, Up: dataclasses — Data Classes + +5.30.7.8 Default factory functions +.................................. + +If a *note field(): 1a1f. 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__(): 6ac. (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: Mutable default values, Next: Descriptor-typed fields, Prev: Default factory functions, Up: dataclasses — Data Classes + +5.30.7.9 Mutable default values +............................... + +Python stores default member variable values in class attributes. +Consider this example, not using dataclasses: + + 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. + +Using dataclasses, 'if' this code was valid: + + @dataclass + class D: + x: list = [] # This code raises ValueError + def add(self, element): + self.x.append(element) + +it would generate code similar to: + + 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: 1cb. decorator will raise a +*note ValueError: 204. 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. + +Using default factory functions is a way to create new instances of +mutable types as default values for fields: + + @dataclass + class D: + x: list = field(default_factory=list) + + assert D().x is not D().x + +Changed in version 3.11: Instead of looking for and disallowing objects +of type *note list: 60d, *note dict: 258, or *note set: 5d5, unhashable +objects are now not allowed as default values. Unhashability is used to +approximate mutability. + + +File: python.info, Node: Descriptor-typed fields, Prev: Mutable default values, Up: dataclasses — Data Classes + +5.30.7.10 Descriptor-typed fields +................................. + +Fields that are assigned *note descriptor objects: c4f. as their default +value have the following special behaviors: + + * The value for the field passed to the dataclass’s *note __init__(): + 6ac. method is passed to the descriptor’s *note __set__(): 1f6a. + method rather than overwriting the descriptor object. + + * Similarly, when getting or setting the field, the descriptor’s + *note __get__(): 14b2. or ‘__set__()’ method is called rather than + returning or overwriting the descriptor object. + + * To determine whether a field contains a default value, *note + @dataclass: 1cb. 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: 348. 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 — Utilities for with-statement contexts, Next: abc — Abstract Base Classes, Prev: dataclasses — Data Classes, Up: Python Runtime Services + +5.30.8 ‘contextlib’ — Utilities for ‘with’-statement contexts +------------------------------------------------------------- + +'Source code:' Lib/contextlib.py(1) + +__________________________________________________________________ + +This module provides utilities for common tasks involving the *note +with: 5ce. statement. For more information see also *note Context +Manager Types: 1fbf. and *note With Statement Context Managers: 1fbd. + +* Menu: + +* Utilities:: +* Examples and Recipes: Examples and Recipes<3>. +* Single use, reusable and reentrant context managers: Single use reusable and reentrant context managers. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/contextlib.py + + +File: python.info, Node: Utilities, Next: Examples and Recipes<3>, Up: contextlib — Utilities for with-statement contexts + +5.30.8.1 Utilities +.................. + +Functions and classes provided: + + -- Class: contextlib.AbstractContextManager + + An *note abstract base class: 11a8. for classes that implement + *note object.__enter__(): 5c4. and *note object.__exit__(): 12f3. + A default implementation for *note object.__enter__(): 5c4. is + provided which returns ‘self’ while *note object.__exit__(): 12f3. + is an abstract method which by default returns ‘None’. See also + the definition of *note Context Manager Types: 1fbf. + + Added in version 3.6. + + -- Class: contextlib.AbstractAsyncContextManager + + An *note abstract base class: 11a8. for classes that implement + *note object.__aenter__(): 1fd0. and *note object.__aexit__(): + 162a. A default implementation for *note object.__aenter__(): + 1fd0. is provided which returns ‘self’ while *note + object.__aexit__(): 162a. is an abstract method which by default + returns ‘None’. See also the definition of *note Asynchronous + Context Managers: 5f8. + + Added in version 3.7. + + -- Function: @contextlib.contextmanager + + This function is a *note decorator: 72c. that can be used to define + a factory function for *note with: 5ce. statement context managers, + without needing to create a class or separate *note __enter__(): + 5c4. and *note __exit__(): 12f3. methods. + + 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’. + + An abstract example would be the following to ensure correct + resource management: + + 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) + + The function can then be used like this: + + >>> 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 + + The function being decorated must return a *note generator: + 105a.-iterator when called. This iterator must yield exactly one + value, which will be bound to the targets in the *note with: 5ce. + statement’s ‘as’ clause, if any. + + At the point where the generator yields, the block nested in the + *note with: 5ce. statement is executed. The generator is then + resumed after the block is exited. If an unhandled exception + occurs in the block, it is reraised inside the generator at the + point where the yield occurred. Thus, you can use a *note try: + 6e4.…*note except: 18b.…*note finally: 9ca. statement to trap the + error (if any), or ensure that some cleanup takes place. If an + exception is trapped merely in order to log it or to perform some + action (rather than to suppress it entirely), the generator must + reraise that exception. Otherwise the generator context manager + will indicate to the ‘with’ statement that the exception has been + handled, and execution will resume with the statement immediately + following the ‘with’ statement. + + *note contextmanager(): 11f4. uses *note ContextDecorator: 11f3. so + the context managers it creates can be used as decorators as well + as in *note with: 5ce. statements. When used as a decorator, a new + generator instance is implicitly created on each function call + (this allows the otherwise “one-shot” context managers created by + *note contextmanager(): 11f4. to meet the requirement that context + managers support multiple invocations in order to be used as + decorators). + + Changed in version 3.2: Use of *note ContextDecorator: 11f3. + + -- Function: @contextlib.asynccontextmanager + + Similar to *note contextmanager(): 11f4, but creates an *note + asynchronous context manager: 5f8. + + This function is a *note decorator: 72c. that can be used to define + a factory function for *note async with: 5d1. statement + asynchronous context managers, without needing to create a class or + separate *note __aenter__(): 1fd0. and *note __aexit__(): 162a. + methods. It must be applied to an *note asynchronous generator: + 203e. function. + + A simple example: + + 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. + + Context managers defined with *note asynccontextmanager(): b2a. can + be used either as decorators or with *note async with: 5d1. + statements: + + 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 ... + + When used as a decorator, a new generator instance is implicitly + created on each function call. This allows the otherwise + “one-shot” context managers created by *note asynccontextmanager(): + b2a. to meet the requirement that context managers support multiple + invocations in order to be used as decorators. + + Changed in version 3.10: Async context managers created with *note + asynccontextmanager(): b2a. can be used as decorators. + + -- Function: contextlib.closing (thing) + + Return a context manager that closes 'thing' upon completion of the + block. This is basically equivalent to: + + from contextlib import contextmanager + + @contextmanager + def closing(thing): + try: + yield thing + finally: + thing.close() + + And lets you write code like this: + + from contextlib import closing + from urllib.request import urlopen + + with closing(urlopen('https://www.python.org')) as page: + for line in page: + print(line) + + without needing to explicitly close ‘page’. Even if an error + occurs, ‘page.close()’ will be called when the *note with: 5ce. + block is exited. + + Note: Most types managing resources support the *note context + manager: 5d0. protocol, which closes 'thing' on leaving the + *note with: 5ce. 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(): 295. would normally be used in a context + manager. + + -- Function: contextlib.aclosing (thing) + + Return an async context manager that calls the ‘aclose()’ method of + 'thing' upon completion of the block. This is basically equivalent + to: + + from contextlib import asynccontextmanager + + @asynccontextmanager + async def aclosing(thing): + try: + yield thing + finally: + await thing.aclose() + + Significantly, ‘aclosing()’ supports deterministic cleanup of async + generators when they happen to exit early by *note break: aa9. or + an exception. For example: + + from contextlib import aclosing + + async with aclosing(my_generator()) as values: + async for value in values: + if value == 42: + break + + This pattern ensures that the generator’s async exit code is + executed in the same context as its iterations (so that exceptions + and context variables work as expected, and the exit code isn’t run + after the lifetime of some task it depends on). + + Added in version 3.10. + + -- Function: contextlib.nullcontext (enter_result=None) + + Return a context manager that returns 'enter_result' from + ‘__enter__’, 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 + + An example using '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 + + It can also be used as a stand-in for *note asynchronous context + managers: 5f8.: + + 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. + + Changed in version 3.10: *note asynchronous context manager: 5d3. + support was added. + + -- Function: contextlib.suppress (*exceptions) + + Return a context manager that suppresses any of the specified + exceptions if they occur in the body of a ‘with’ statement and then + resumes execution with the first statement following the end of the + ‘with’ statement. + + As with any other mechanism that completely suppresses exceptions, + this context manager should be used only to cover very specific + errors where silently continuing with program execution is known to + be the right thing to do. + + For example: + + from contextlib import suppress + + with suppress(FileNotFoundError): + os.remove('somefile.tmp') + + with suppress(FileNotFoundError): + os.remove('someotherfile.tmp') + + This code is equivalent to: + + try: + os.remove('somefile.tmp') + except FileNotFoundError: + pass + + try: + os.remove('someotherfile.tmp') + except FileNotFoundError: + pass + + This context manager is *note reentrant: 442b. + + If the code within the ‘with’ block raises a *note + BaseExceptionGroup: 261, 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(): 16c0. method. + + Added in version 3.4. + + Changed in version 3.12: ‘suppress’ now supports suppressing + exceptions raised as part of a *note BaseExceptionGroup: 261. + + -- Function: contextlib.redirect_stdout (new_target) + + Context manager for temporarily redirecting *note sys.stdout: ad6. + to another file or file-like object. + + This tool adds flexibility to existing functions or classes whose + output is hardwired to stdout. + + For example, the output of *note help(): 8d6. normally is sent to + 'sys.stdout'. You can capture that output in a string by + redirecting the output to an *note io.StringIO: f22. object. The + replacement stream is returned from the ‘__enter__’ method and so + is available as the target of the *note with: 5ce. statement: + + with redirect_stdout(io.StringIO()) as f: + help(pow) + s = f.getvalue() + + To send the output of *note help(): 8d6. to a file on disk, + redirect the output to a regular file: + + with open('help.txt', 'w') as f: + with redirect_stdout(f): + help(pow) + + To send the output of *note help(): 8d6. to 'sys.stderr': + + with redirect_stdout(sys.stderr): + help(pow) + + Note that the global side effect on *note sys.stdout: ad6. means + that this context manager is not suitable for use in library code + and most threaded applications. It also has no effect on the + output of subprocesses. However, it is still a useful approach for + many utility scripts. + + This context manager is *note reentrant: 442b. + + Added in version 3.4. + + -- Function: contextlib.redirect_stderr (new_target) + + Similar to *note redirect_stdout(): de7. but redirecting *note + sys.stderr: 939. to another file or file-like object. + + This context manager is *note reentrant: 442b. + + Added in version 3.5. + + -- Function: contextlib.chdir (path) + + Non parallel-safe context manager to change the current working + directory. As this changes a global state, the working directory, + it is not suitable for use in most threaded or async contexts. It + is also not suitable for most non-linear code execution, like + generators, where the program execution is temporarily relinquished + – unless explicitly desired, you should not yield when this context + manager is active. + + This is a simple wrapper around *note chdir(): 609, it changes the + current working directory upon entering and restores the old one on + exit. + + This context manager is *note reentrant: 442b. + + Added in version 3.11. + + -- Class: contextlib.ContextDecorator + + A base class that enables a context manager to also be used as a + decorator. + + Context managers inheriting from ‘ContextDecorator’ have to + implement ‘__enter__’ and ‘__exit__’ as normal. ‘__exit__’ retains + its optional exception handling even when used as a decorator. + + ‘ContextDecorator’ is used by *note contextmanager(): 11f4, so you + get this functionality automatically. + + Example of ‘ContextDecorator’: + + from contextlib import ContextDecorator + + class mycontext(ContextDecorator): + def __enter__(self): + print('Starting') + return self + + def __exit__(self, *exc): + print('Finishing') + return False + + The class can then be used like this: + + >>> @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 + + This change is just syntactic sugar for any construct of the + following form: + + def f(): + with cm(): + # Do stuff + + ‘ContextDecorator’ lets you instead write: + + @cm() + def f(): + # Do stuff + + It makes it clear that the ‘cm’ applies to the whole function, + rather than just a piece of it (and saving an indentation level is + nice, too). + + Existing context managers that already have a base class can be + extended by using ‘ContextDecorator’ as a mixin class: + + from contextlib import ContextDecorator + + class mycontext(ContextBaseClass, ContextDecorator): + def __enter__(self): + return self + + def __exit__(self, *exc): + return False + + Note: As the decorated function must be able to be called + multiple times, the underlying context manager must support + use in multiple *note with: 5ce. statements. If this is not + the case, then the original construct with the explicit ‘with’ + statement inside the function should be used. + + Added in version 3.2. + + -- Class: contextlib.AsyncContextDecorator + + Similar to *note ContextDecorator: 11f3. but only for asynchronous + functions. + + Example of ‘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 + + The class can then be used like this: + + >>> @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. + + -- Class: contextlib.ExitStack + + A context manager that is designed to make it easy to + programmatically combine other context managers and cleanup + functions, especially those that are optional or otherwise driven + by input data. + + For example, a set of files may easily be handled in a single with + statement as follows: + + 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__(): 5c4. method returns the *note ExitStack: + b29. instance, and performs no additional operations. + + Each instance maintains a stack of registered callbacks that are + called in reverse order when the instance is closed (either + explicitly or implicitly at the end of a *note with: 5ce. + statement). Note that callbacks are 'not' invoked implicitly when + the context stack instance is garbage collected. + + This stack model is used so that context managers that acquire + their resources in their ‘__init__’ method (such as file objects) + can be handled correctly. + + Since registered callbacks are invoked in the reverse order of + registration, this ends up behaving as if multiple nested *note + with: 5ce. statements had been used with the registered set of + callbacks. This even extends to exception handling - if an inner + callback suppresses or replaces an exception, then outer callbacks + will be passed arguments based on that updated state. + + This is a relatively low level API that takes care of the details + of correctly unwinding the stack of exit callbacks. It provides a + suitable foundation for higher level context managers that + manipulate the exit stack in application specific ways. + + Added in version 3.3. + + -- Method: enter_context (cm) + + Enters a new context manager and adds its *note __exit__(): + 12f3. method to the callback stack. The return value is the + result of the context manager’s own *note __enter__(): 5c4. + method. + + These context managers may suppress exceptions just as they + normally would if used directly as part of a *note with: 5ce. + statement. + + Changed in version 3.11: Raises *note TypeError: 534. instead + of *note AttributeError: 348. if 'cm' is not a context + manager. + + -- Method: push (exit) + + Adds a context manager’s *note __exit__(): 12f3. method to the + callback stack. + + As ‘__enter__’ is 'not' invoked, this method can be used to + cover part of an *note __enter__(): 5c4. implementation with a + context manager’s own *note __exit__(): 12f3. 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__(): 12f3. 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__(): + 12f3. methods can. + + The passed in object is returned from the function, allowing + this method to be used as a function decorator. + + -- Method: callback (callback, /, *args, **kwds) + + Accepts an arbitrary callback function and arguments and adds + it to the callback stack. + + Unlike the other methods, callbacks added this way cannot + suppress exceptions (as they are never passed the exception + details). + + The passed in callback is returned from the function, allowing + this method to be used as a function decorator. + + -- Method: pop_all () + + Transfers the callback stack to a fresh *note ExitStack: b29. + instance and returns it. No callbacks are invoked by this + operation - instead, they will now be invoked when the new + stack is closed (either explicitly or implicitly at the end of + a *note with: 5ce. statement). + + For example, a group of files can be opened as an “all or + nothing” operation as follows: + + 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. + + -- Method: close () + + Immediately unwinds the callback stack, invoking callbacks in + the reverse order of registration. For any context managers + and exit callbacks registered, the arguments passed in will + indicate that no exception occurred. + + -- Class: contextlib.AsyncExitStack + + An *note asynchronous context manager: 5f8, similar to *note + ExitStack: b29, that supports combining both synchronous and + asynchronous context managers, as well as having coroutines for + cleanup logic. + + The *note close(): 442e. method is not implemented; *note aclose(): + 442f. must be used instead. + + -- Method: async enter_async_context (cm) + + Similar to *note ExitStack.enter_context(): 5cf. but expects + an asynchronous context manager. + + Changed in version 3.11: Raises *note TypeError: 534. instead + of *note AttributeError: 348. if 'cm' is not an asynchronous + context manager. + + -- Method: push_async_exit (exit) + + Similar to *note ExitStack.push(): 442c. but expects either an + asynchronous context manager or a coroutine function. + + -- Method: push_async_callback (callback, /, *args, **kwds) + + Similar to *note ExitStack.callback(): a83. but expects a + coroutine function. + + -- Method: async aclose () + + Similar to *note ExitStack.close(): 442e. but properly handles + awaitables. + + Continuing the example for *note asynccontextmanager(): b2a.: + + 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: Examples and Recipes<3>, Next: Single use reusable and reentrant context managers, Prev: Utilities, Up: contextlib — Utilities for with-statement contexts + +5.30.8.2 Examples and Recipes +............................. + +This section describes some examples and recipes for making effective +use of the tools provided by *note contextlib: 23. + +* Menu: + +* Supporting a variable number of context managers:: +* Catching exceptions from __enter__ methods:: +* Cleaning up in an __enter__ implementation:: +* Replacing any use of try-finally and flag variables:: +* Using a context manager as a function decorator:: + + +File: python.info, Node: Supporting a variable number of context managers, Next: Catching exceptions from __enter__ methods, Up: Examples and Recipes<3> + +5.30.8.3 Supporting a variable number of context managers +......................................................... + +The primary use case for *note ExitStack: b29. is the one given in the +class documentation: supporting a variable number of context managers +and other cleanup operations in a single *note with: 5ce. statement. +The variability may come from the number of context managers needed +being driven by user input (such as opening a user specified collection +of files), or from some of the context managers being optional: + + 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 + +As shown, *note ExitStack: b29. also makes it quite easy to use *note +with: 5ce. statements to manage arbitrary resources that don’t natively +support the context management protocol. + + +File: python.info, Node: Catching exceptions from __enter__ methods, Next: Cleaning up in an __enter__ implementation, Prev: Supporting a variable number of context managers, Up: Examples and Recipes<3> + +5.30.8.4 Catching exceptions from ‘__enter__’ methods +..................................................... + +It is occasionally desirable to catch exceptions from an ‘__enter__’ +method implementation, 'without' inadvertently catching exceptions from +the *note with: 5ce. statement body or the context manager’s ‘__exit__’ +method. By using *note ExitStack: b29. 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 + +Actually needing to do this is likely to indicate that the underlying +API should be providing a direct resource management interface for use +with *note try: 6e4./*note except: 18b./*note finally: 9ca. statements, +but not all APIs are well designed in that regard. When a context +manager is the only resource management API provided, then *note +ExitStack: b29. can make it easier to handle various situations that +can’t be handled directly in a *note with: 5ce. statement. + + +File: python.info, Node: Cleaning up in an __enter__ implementation, Next: Replacing any use of try-finally and flag variables, Prev: Catching exceptions from __enter__ methods, Up: Examples and Recipes<3> + +5.30.8.5 Cleaning up in an ‘__enter__’ implementation +..................................................... + +As noted in the documentation of *note ExitStack.push(): 442c, this +method can be useful in cleaning up an already allocated resource if +later steps in the *note __enter__(): 5c4. implementation fail. + +Here’s an example of doing this for a context manager that accepts +resource acquisition and release functions, along with an optional +validation function, and maps them to the context management protocol: + + 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: Replacing any use of try-finally and flag variables, Next: Using a context manager as a function decorator, Prev: Cleaning up in an __enter__ implementation, Up: Examples and Recipes<3> + +5.30.8.6 Replacing any use of ‘try-finally’ and flag variables +.............................................................. + +A pattern you will sometimes see is a ‘try-finally’ statement with a +flag variable to indicate whether or not the body of the ‘finally’ +clause should be executed. In its simplest form (that can’t already be +handled just by using an ‘except’ clause instead), it looks something +like this: + + cleanup_needed = True + try: + result = perform_operation() + if result: + cleanup_needed = False + finally: + if cleanup_needed: + cleanup_resources() + +As with any ‘try’ statement based code, this can cause problems for +development and review, because the setup code and the cleanup code can +end up being separated by arbitrarily long sections of code. + +*note ExitStack: b29. makes it possible to instead register a callback +for execution at the end of a ‘with’ statement, and then later decide to +skip executing that callback: + + 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. + +If a particular application uses this pattern a lot, it can be +simplified even further by means of a small helper class: + + 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() + +If the resource cleanup isn’t already neatly bundled into a standalone +function, then it is still possible to use the decorator form of *note +ExitStack.callback(): a83. to declare the resource cleanup in advance: + + from contextlib import ExitStack + + with ExitStack() as stack: + @stack.callback + def cleanup_resources(): + ... + result = perform_operation() + if result: + stack.pop_all() + +Due to the way the decorator protocol works, a callback function +declared this way cannot take any parameters. Instead, any resources to +be released must be accessed as closure variables. + + +File: python.info, Node: Using a context manager as a function decorator, Prev: Replacing any use of try-finally and flag variables, Up: Examples and Recipes<3> + +5.30.8.7 Using a context manager as a function decorator +........................................................ + +*note ContextDecorator: 11f3. makes it possible to use a context manager +in both an ordinary ‘with’ statement and also as a function decorator. + +For example, it is sometimes useful to wrap functions or groups of +statements with a logger that can track the time of entry and time of +exit. Rather than writing both a function decorator and a context +manager for the task, inheriting from *note ContextDecorator: 11f3. +provides both capabilities in a single definition: + + 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) + +Instances of this class can be used as both a context manager: + + with track_entry_and_exit('widget loader'): + print('Some time consuming activity goes here') + load_widget() + +And also as a function decorator: + + @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__(): 5c4. If that value is needed, then it is still +necessary to use an explicit ‘with’ statement. + +See also +........ + +PEP 343(1) - The “with” statement + + The specification, background, and examples for the Python *note + with: 5ce. statement. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0343/ + + +File: python.info, Node: Single use reusable and reentrant context managers, Prev: Examples and Recipes<3>, Up: contextlib — Utilities for with-statement contexts + +5.30.8.8 Single use, reusable and reentrant context managers +............................................................ + +Most context managers are written in a way that means they can only be +used effectively in a *note with: 5ce. statement once. These single use +context managers must be created afresh each time they’re used - +attempting to use them a second time will trigger an exception or +otherwise not work correctly. + +This common limitation means that it is generally advisable to create +context managers directly in the header of the *note with: 5ce. +statement where they are used (as shown in all of the usage examples +above). + +Files are an example of effectively single use context managers, since +the first *note with: 5ce. statement will close the file, preventing any +further IO operations using that file object. + +Context managers created using *note contextmanager(): 11f4. are also +single use context managers, and will complain about the underlying +generator failing to yield if an attempt is made to use them a second +time: + + >>> 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: + +* Reentrant context managers:: +* Reusable context managers:: + + +File: python.info, Node: Reentrant context managers, Next: Reusable context managers, Up: Single use reusable and reentrant context managers + +5.30.8.9 Reentrant context managers +................................... + +More sophisticated context managers may be “reentrant”. These context +managers can not only be used in multiple *note with: 5ce. statements, +but may also be used 'inside' a ‘with’ statement that is already using +the same context manager. + +*note threading.RLock: 2e2. is an example of a reentrant context +manager, as are *note suppress(): f21, *note redirect_stdout(): de7, and +*note chdir(): 608. Here’s a very simple example of reentrant use: + + >>> 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 + +Real world examples of reentrancy are more likely to involve multiple +functions calling each other and hence be far more complicated than this +example. + +Note also that being reentrant is 'not' the same thing as being thread +safe. *note redirect_stdout(): de7, for example, is definitely not +thread safe, as it makes a global modification to the system state by +binding *note sys.stdout: ad6. to a different stream. + + +File: python.info, Node: Reusable context managers, Prev: Reentrant context managers, Up: Single use reusable and reentrant context managers + +5.30.8.10 Reusable context managers +................................... + +Distinct from both single use and reentrant context managers are +“reusable” context managers (or, to be completely explicit, “reusable, +but not reentrant” context managers, since reentrant context managers +are also reusable). These context managers support being used multiple +times, but will fail (or otherwise not work correctly) if the specific +context manager instance has already been used in a containing with +statement. + +*note threading.Lock: 1677. is an example of a reusable, but not +reentrant, context manager (for a reentrant lock, it is necessary to use +*note threading.RLock: 2e2. instead). + +Another example of a reusable, but not reentrant, context manager is +*note ExitStack: b29, as it invokes 'all' currently registered callbacks +when leaving any with statement, regardless of where those callbacks +were added: + + >>> 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 + +As the output from the example shows, reusing a single stack object +across multiple with statements works correctly, but attempting to nest +them will cause the stack to be cleared at the end of the innermost with +statement, which is unlikely to be desirable behaviour. + +Using separate *note ExitStack: b29. instances instead of reusing a +single instance avoids that problem: + + >>> 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 — Abstract Base Classes, Next: atexit — Exit handlers, Prev: contextlib — Utilities for with-statement contexts, Up: Python Runtime Services + +5.30.9 ‘abc’ — Abstract Base Classes +------------------------------------ + +'Source code:' Lib/abc.py(1) + +__________________________________________________________________ + +This module provides the infrastructure for defining *note abstract base +classes: 11a8. (ABCs) in Python, as outlined in PEP 3119(2); see the PEP +for why this was added to Python. (See also PEP 3141(3) and the *note +numbers: 9e. module regarding a type hierarchy for numbers based on +ABCs.) + +The *note collections: 1d. module has some concrete classes that derive +from ABCs; these can, of course, be further derived. In addition, the +*note collections.abc: 1e. submodule has some ABCs that can be used to +test whether a class or instance provides a particular interface, for +example, if it is *note hashable: 60c. or if it is a *note mapping: +11ae. + +This module provides the metaclass *note ABCMeta: f13. for defining ABCs +and a helper class *note ABC: f12. to alternatively define ABCs through +inheritance: + + -- Class: abc.ABC + + A helper class that has *note ABCMeta: f13. as its metaclass. With + this class, an abstract base class can be created by simply + deriving from ‘ABC’ avoiding sometimes confusing metaclass usage, + for example: + + from abc import ABC + + class MyABC(ABC): + pass + + Note that the type of ‘ABC’ is still *note ABCMeta: f13, 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. + + -- Class: abc.ABCMeta + + Metaclass for defining Abstract Base Classes (ABCs). + + Use this metaclass to create an ABC. An ABC can be subclassed + directly, and then acts as a mix-in class. You can also register + unrelated concrete classes (even built-in classes) and unrelated + ABCs as “virtual subclasses” – these and their descendants will be + considered subclasses of the registering ABC by the built-in *note + issubclass(): 7bc. function, but the registering ABC won’t show up + in their MRO (Method Resolution Order) nor will method + implementations defined by the registering ABC be callable (not + even via *note super(): 4d7.). (4) + + Classes created with a metaclass of ‘ABCMeta’ have the following + method: + + -- Method: register (subclass) + + Register 'subclass' as a “virtual subclass” of this ABC. For + example: + + from abc import ABC + + class MyABC(ABC): + pass + + MyABC.register(tuple) + + assert issubclass(tuple, MyABC) + assert isinstance((), MyABC) + + Changed in version 3.3: Returns the registered subclass, to + allow usage as a class decorator. + + Changed in version 3.4: To detect calls to ‘register()’, you + can use the *note get_cache_token(): f11. function. + + You can also override this method in an abstract base class: + + -- Method: __subclasshook__ (subclass) + + (Must be defined as a class method.) + + Check whether 'subclass' is considered a subclass of this ABC. + This means that you can customize the behavior of *note + issubclass(): 7bc. further without the need to call *note + register(): 1082. on every class you want to consider a + subclass of the ABC. (This class method is called from the + *note __subclasscheck__(): 1f7d. method of the ABC.) + + This method should return ‘True’, ‘False’ or *note + NotImplemented: 7cd. 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. + + For a demonstration of these concepts, look at this example ABC + definition: + + 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__(): 1f5c, 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__(): 2531. class method defined here says + that any class that has an *note __iter__(): 1f5c. method in its + *note __dict__: 558. (or in that of one of its base classes, + accessed via the *note __mro__: 1f29. 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__(): + 1f5c. method (it uses the old-style iterable protocol, defined in + terms of *note __len__(): 1f63. and *note __getitem__(): 285.). + 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: + + -- Function: @abc.abstractmethod + + A decorator indicating abstract methods. + + Using this decorator requires that the class’s metaclass is *note + ABCMeta: f13. 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(): 443d. function. The ‘abstractmethod()’ + only affects subclasses derived using regular inheritance; “virtual + subclasses” registered with the ABC’s *note register(): 1082. + 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: 194. 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)) + + Note: Unlike Java abstract methods, these abstract methods may + have an implementation. This implementation can be called via + the *note super(): 4d7. mechanism from the class that + overrides it. This could be useful as an end-point for a + super-call in a framework that uses cooperative + multiple-inheritance. + +The ‘abc’ module also supports the following legacy decorators: + + -- Function: @abc.abstractclassmethod + + Added in version 3.2. + + Deprecated since version 3.3: It is now possible to use *note + classmethod: 166. with *note abstractmethod(): 107f, making this + decorator redundant. + + A subclass of the built-in *note classmethod(): 166, indicating an + abstract classmethod. Otherwise it is similar to *note + abstractmethod(): 107f. + + This special case is deprecated, as the *note classmethod(): 166. + decorator is now correctly identified as abstract when applied to + an abstract method: + + class C(ABC): + @classmethod + @abstractmethod + def my_abstract_classmethod(cls, arg): + ... + + -- Function: @abc.abstractstaticmethod + + Added in version 3.2. + + Deprecated since version 3.3: It is now possible to use *note + staticmethod: 412. with *note abstractmethod(): 107f, making this + decorator redundant. + + A subclass of the built-in *note staticmethod(): 412, indicating an + abstract staticmethod. Otherwise it is similar to *note + abstractmethod(): 107f. + + This special case is deprecated, as the *note staticmethod(): 412. + decorator is now correctly identified as abstract when applied to + an abstract method: + + class C(ABC): + @staticmethod + @abstractmethod + def my_abstract_staticmethod(arg): + ... + + -- Function: @abc.abstractproperty + + Deprecated since version 3.3: It is now possible to use *note + property: 194, *note property.getter(): 165a, *note + property.setter(): 165b. and *note property.deleter(): 165c. with + *note abstractmethod(): 107f, making this decorator redundant. + + A subclass of the built-in *note property(): 194, indicating an + abstract property. + + This special case is deprecated, as the *note property(): 194. + decorator is now correctly identified as abstract when applied to + an abstract method: + + class C(ABC): + @property + @abstractmethod + def my_abstract_property(self): + ... + + The above example defines a read-only property; you can also define + a read-write abstract property by appropriately marking one or more + of the underlying methods as abstract: + + class C(ABC): + @property + def x(self): + ... + + @x.setter + @abstractmethod + def x(self, val): + ... + + If only some components are abstract, only those components need to + be updated to create a concrete property in a subclass: + + class D(C): + @C.x.setter + def x(self, val): + ... + +The ‘abc’ module also provides the following functions: + + -- Function: abc.get_cache_token () + + Returns the current abstract base class cache token. + + The token is an opaque object (that supports equality testing) + identifying the current version of the abstract base class cache + for virtual subclasses. The token changes with every call to *note + ABCMeta.register(): 1082. on any ABC. + + Added in version 3.4. + + -- Function: 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: f13, does nothing. + + Note: This function assumes that 'cls'’s superclasses are + already updated. It does not update any subclasses. + + Added in version 3.10. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/abc.py + + (2) https://peps.python.org/pep-3119/ + + (3) https://peps.python.org/pep-3141/ + + (4) C++ programmers should note that Python’s virtual base class +concept is not the same as C++’s. + + +File: python.info, Node: atexit — Exit handlers, Next: traceback — Print or retrieve a stack traceback, Prev: abc — Abstract Base Classes, Up: Python Runtime Services + +5.30.10 ‘atexit’ — Exit handlers +-------------------------------- + +__________________________________________________________________ + +The *note atexit: c. module defines functions to register and unregister +cleanup functions. Functions thus registered are automatically executed +upon normal interpreter termination. *note atexit: c. 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’. + +'Note:' The functions registered via this module are not called when the +program is killed by a signal not handled by Python, when a Python fatal +internal error is detected, or when *note os._exit(): 2298. is called. + +'Note:' The effect of registering or unregistering functions from within +a cleanup function is undefined. + +Changed in version 3.7: When used with C-API subinterpreters, registered +functions are local to the interpreter they were registered in. + + -- Function: atexit.register (func, *args, **kwargs) + + Register 'func' as a function to be executed at termination. Any + optional arguments that are to be passed to 'func' must be passed + as arguments to *note register(): 87b. It is possible to register + the same function and arguments more than once. + + At normal program termination (for instance, if *note sys.exit(): + 133c. is called or the main module’s execution completes), all + functions registered are called in last in, first out order. The + assumption is that lower level modules will normally be imported + before higher level modules and thus must be cleaned up later. + + If an exception is raised during execution of the exit handlers, a + traceback is printed (unless *note SystemExit: d40. is raised) and + the exception information is saved. After all exit handlers have + had a chance to run, the last exception to be raised is re-raised. + + This function returns 'func', which makes it possible to use it as + a decorator. + + Warning: Starting new threads or calling *note os.fork(): 197. + from a registered function can lead to race condition between + the main Python runtime thread freeing thread states while + internal *note threading: ed. routines or the new process try + to use that state. This can lead to crashes rather than clean + shutdown. + + Changed in version 3.12: Attempts to start a new thread or *note + os.fork(): 197. a new process in a registered function now leads to + *note RuntimeError: 195. + + -- Function: atexit.unregister (func) + + Remove 'func' from the list of functions to be run at interpreter + shutdown. *note unregister(): 4440. silently does nothing if + 'func' was not previously registered. If 'func' has been + registered more than once, every occurrence of that function in the + *note atexit: c. call stack will be removed. Equality comparisons + (‘==’) are used internally during unregistration, so function + references do not need to have matching identities. + +See also +........ + +Module *note readline: ba. + + Useful example of *note atexit: c. to read and write *note + readline: ba. history files. + +* Menu: + +* atexit Example:: + + +File: python.info, Node: atexit Example, Up: atexit — Exit handlers + +5.30.10.1 ‘atexit’ Example +.......................... + +The following simple example demonstrates how a module can initialize a +counter from a file when it is imported and save the counter’s updated +value automatically when the program terminates without relying on the +application making an explicit call into this module at termination. + + 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) + +Positional and keyword arguments may also be passed to *note register(): +87b. to be passed along to the registered function when it is called: + + 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') + +Usage as a *note decorator: 72c.: + + import atexit + + @atexit.register + def goodbye(): + print('You are now leaving the Python sector.') + +This only works with functions that can be called without arguments. + + +File: python.info, Node: traceback — Print or retrieve a stack traceback, Next: __future__ — Future statement definitions, Prev: atexit — Exit handlers, Up: Python Runtime Services + +5.30.11 ‘traceback’ — Print or retrieve a stack traceback +--------------------------------------------------------- + +'Source code:' 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: af4. — these are objects of +type *note types.TracebackType: af2, which are assigned to the *note +__traceback__: 12b9. field of *note BaseException: 5b7. instances. + +See also +........ + +Module *note faulthandler: 58. + + Used to dump Python tracebacks explicitly, on a fault, after a + timeout, or on a user signal. + +Module *note pdb: a5. + + 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: 25e. class and its helper classes *note + StackSummary: e7e. and *note FrameSummary: e7f. 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. + +* Menu: + +* Module-Level Functions: Module-Level Functions<2>. +* TracebackException Objects:: +* StackSummary Objects:: +* FrameSummary Objects:: +* Examples of Using the Module-Level Functions:: +* Examples of Using TracebackException:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/traceback.py + + +File: python.info, Node: Module-Level Functions<2>, Next: TracebackException Objects, Up: traceback — Print or retrieve a stack traceback + +5.30.11.1 Module-Level Functions +................................ + + -- Function: traceback.print_tb (tb, limit=None, file=None) + + Print up to 'limit' stack trace entries from *note traceback + object: af4. '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: 939.; + otherwise it should be an open *note file: 11b5. or *note file-like + object: 258f. to receive the output. + + Note: The meaning of the 'limit' parameter is different than + the meaning of *note sys.tracebacklimit: 15db. 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’. + + Changed in version 3.5: Added negative 'limit' support. + + -- Function: traceback.print_exception (exc, /[, value, tb], + limit=None, file=None, chain=True) + + Print exception information and stack trace entries from *note + traceback object: af4. 'tb' to 'file'. This differs from *note + print_tb(): e80. in the following ways: + + * if 'tb' is not ‘None’, it prints a header ‘Traceback (most + recent call last):’ + + * it prints the exception type and 'value' after the stack trace + + * if 'type(value)' is *note SyntaxError: 18d. and 'value' has + the appropriate format, it prints the line where the syntax + error occurred with a caret indicating the approximate + position of the error. + + 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. + + The optional 'limit' argument has the same meaning as for *note + print_tb(): e80. If 'chain' is true (the default), then chained + exceptions (the *note __cause__: 12bb. or *note __context__: 12ba. + attributes of the exception) will be printed as well, like the + interpreter itself does when printing an unhandled exception. + + Changed in version 3.5: The 'etype' argument is ignored and + inferred from the type of 'value'. + + Changed in version 3.10: The 'etype' parameter has been renamed to + 'exc' and is now positional-only. + + -- Function: traceback.print_exc (limit=None, file=None, chain=True) + + This is a shorthand for ‘print_exception(sys.exception(), + limit=limit, file=file, chain=chain)’. + + -- Function: traceback.print_last (limit=None, file=None, chain=True) + + This is a shorthand for ‘print_exception(sys.last_exc, limit=limit, + file=file, chain=chain)’. In general it will work only after an + exception has reached an interactive prompt (see *note + sys.last_exc: 4ba.). + + -- Function: traceback.print_stack (f=None, limit=None, file=None) + + Print up to 'limit' stack trace entries (starting from the + invocation point) if 'limit' is positive. Otherwise, print the + last ‘abs(limit)’ entries. If 'limit' is omitted or ‘None’, all + entries are printed. The optional 'f' argument can be used to + specify an alternate *note stack frame: 6db. to start. The + optional 'file' argument has the same meaning as for *note + print_tb(): e80. + + Changed in version 3.5: Added negative 'limit' support. + + -- Function: traceback.extract_tb (tb, limit=None) + + Return a *note StackSummary: e7e. object representing a list of + “pre-processed” stack trace entries extracted from the *note + traceback object: af4. 'tb'. It is useful for alternate formatting + of stack traces. The optional 'limit' argument has the same + meaning as for *note print_tb(): e80. A “pre-processed” stack + trace entry is a *note FrameSummary: e7f. object containing + attributes *note filename: 4448, *note lineno: 4449, *note name: + 444a, and *note line: 444b. representing the information that is + usually printed for a stack trace. + + -- Function: traceback.extract_stack (f=None, limit=None) + + Extract the raw traceback from the current *note stack frame: 6db. + The return value has the same format as for *note extract_tb(): + 4447. The optional 'f' and 'limit' arguments have the same meaning + as for *note print_stack(): e81. + + -- Function: traceback.print_list (extracted_list, file=None) + + Print the list of tuples as returned by *note extract_tb(): 4447. + or *note extract_stack(): 444c. as a formatted stack trace to the + given file. If 'file' is ‘None’, the output is written to *note + sys.stderr: 939. + + -- Function: traceback.format_list (extracted_list) + + Given a list of tuples or *note FrameSummary: e7f. objects as + returned by *note extract_tb(): 4447. or *note extract_stack(): + 444c, return a list of strings ready for printing. Each string in + the resulting list corresponds to the item with the same index in + the argument list. Each string ends in a newline; the strings may + contain internal newlines as well, for those items whose source + text line is not ‘None’. + + -- Function: 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: 4bc. 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: 18d. 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: 2282. + + 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: 261, the nested exceptions are included + as well, recursively, with indentation relative to their nesting + depth. + + Changed in version 3.10: The 'etype' parameter has been renamed to + 'exc' and is now positional-only. + + Changed in version 3.11: The returned list now includes any *note + notes: 2282. attached to the exception. + + Changed in version 3.13: 'show_group' parameter was added. + + -- Function: traceback.format_exception (exc, /[, value, tb], + limit=None, chain=True) + + Format a stack trace and the exception information. The arguments + have the same meaning as the corresponding arguments to *note + print_exception(): 84b. The return value is a list of strings, + each ending in a newline and some containing internal newlines. + When these lines are concatenated and printed, exactly the same + text is printed as does *note print_exception(): 84b. + + Changed in version 3.5: The 'etype' argument is ignored and + inferred from the type of 'value'. + + Changed in version 3.10: This function’s behavior and signature + were modified to match *note print_exception(): 84b. + + -- Function: traceback.format_exc (limit=None, chain=True) + + This is like ‘print_exc(limit)’ but returns a string instead of + printing to a file. + + -- Function: traceback.format_tb (tb, limit=None) + + A shorthand for ‘format_list(extract_tb(tb, limit))’. + + -- Function: traceback.format_stack (f=None, limit=None) + + A shorthand for ‘format_list(extract_stack(f, limit))’. + + -- Function: traceback.clear_frames (tb) + + Clears the local variables of all the stack frames in a *note + traceback: af4. 'tb' by calling the *note clear(): 282. method of + each *note frame object: 6db. + + Added in version 3.4. + + -- Function: traceback.walk_stack (f) + + Walk a stack following *note f.f_back: 787. 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(): 4451. + + Added in version 3.5. + + -- Function: traceback.walk_tb (tb) + + Walk a traceback following *note tb_next: af3. yielding the frame + and line number for each frame. This helper is used with *note + StackSummary.extract(): 4451. + + Added in version 3.5. + + +File: python.info, Node: TracebackException Objects, Next: StackSummary Objects, Prev: Module-Level Functions<2>, Up: traceback — Print or retrieve a stack traceback + +5.30.11.2 ‘TracebackException’ Objects +...................................... + +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: af4. and *note frame: 6db. objects. In addition, they expose +more options to configure the output compared to the module-level +functions described above. + + -- Class: 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: e7e. class. + + If 'compact' is true, only data that is required by + ‘TracebackException’’s *note format(): 61b. method is saved in the + class attributes. In particular, the *note __context__: 4453. + field is calculated only if *note __cause__: 4454. is ‘None’ and + *note __suppress_context__: 4455. is false. + + Note that when locals are captured, they are also shown in the + traceback. + + 'max_group_width' and 'max_group_depth' control the formatting of + exception groups (see *note BaseExceptionGroup: 261.). 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. + + Changed in version 3.10: Added the 'compact' parameter. + + Changed in version 3.11: Added the 'max_group_width' and + 'max_group_depth' parameters. + + -- Attribute: __cause__ + + A ‘TracebackException’ of the original *note __cause__: 12bb. + + -- Attribute: __context__ + + A ‘TracebackException’ of the original *note __context__: + 12ba. + + -- Attribute: exceptions + + If ‘self’ represents an *note ExceptionGroup: 1b6, this field + holds a list of ‘TracebackException’ instances representing + the nested exceptions. Otherwise it is ‘None’. + + Added in version 3.11. + + -- Attribute: __suppress_context__ + + The *note __suppress_context__: 20b8. value from the original + exception. + + -- Attribute: __notes__ + + The *note __notes__: 2282. 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. + + -- Attribute: stack + + A *note StackSummary: e7e. representing the traceback. + + -- Attribute: exc_type + + The class of the original traceback. + + Deprecated since version 3.13. + + -- Attribute: exc_type_str + + String display of the class of the original exception. + + Added in version 3.13. + + -- Attribute: filename + + For syntax errors - the file name where the error occurred. + + -- Attribute: lineno + + For syntax errors - the line number where the error occurred. + + -- Attribute: end_lineno + + For syntax errors - the end line number where the error + occurred. Can be ‘None’ if not present. + + Added in version 3.10. + + -- Attribute: text + + For syntax errors - the text where the error occurred. + + -- Attribute: offset + + For syntax errors - the offset into the text where the error + occurred. + + -- Attribute: 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. + + -- Attribute: msg + + For syntax errors - the compiler error message. + + -- Method: classmethod from_exception (exc, *, limit=None, + lookup_lines=True, capture_locals=False) + + Capture an exception for later rendering. 'limit', + 'lookup_lines' and 'capture_locals' are as for the *note + StackSummary: e7e. class. + + Note that when locals are captured, they are also shown in the + traceback. + + -- Method: print (*, file=None, chain=True) + + Print to 'file' (default ‘sys.stderr’) the exception + information returned by *note format(): 61b. + + Added in version 3.11. + + -- Method: format (*, chain=True) + + Format the exception. + + If 'chain' is not ‘True’, *note __cause__: 4454. and *note + __context__: 4453. will not be formatted. + + The return value is a generator of strings, each ending in a + newline and some containing internal newlines. *note + print_exception(): 84b. is a wrapper around this method which + just prints the lines to a file. + + -- Method: format_exception_only (*, show_group=False) + + Format the exception part of the traceback. + + The return value is a generator of strings, each ending in a + newline. + + 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: 18d. 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: 261, the nested exceptions are + included as well, recursively, with indentation relative to + their nesting depth. + + Changed in version 3.11: The exception’s *note notes: 2282. + are now included in the output. + + Changed in version 3.13: Added the 'show_group' parameter. + + +File: python.info, Node: StackSummary Objects, Next: FrameSummary Objects, Prev: TracebackException Objects, Up: traceback — Print or retrieve a stack traceback + +5.30.11.3 ‘StackSummary’ Objects +................................ + +Added in version 3.5. + +‘StackSummary’ objects represent a call stack ready for formatting. + + -- Class: traceback.StackSummary + + -- Method: classmethod extract (frame_gen, *, limit=None, + lookup_lines=True, capture_locals=False) + + Construct a ‘StackSummary’ object from a frame generator (such + as is returned by *note walk_stack(): e7c. or *note walk_tb(): + e7d.). + + If 'limit' is supplied, only this many frames are taken from + 'frame_gen'. If 'lookup_lines' is ‘False’, the returned *note + FrameSummary: e7f. 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. + + Changed in version 3.12: Exceptions raised from *note repr(): + 7f9. on a local variable (when 'capture_locals' is ‘True’) are + no longer propagated to the caller. + + -- Method: classmethod from_list (a_list) + + Construct a ‘StackSummary’ object from a supplied list of + *note FrameSummary: e7f. objects or old-style list of tuples. + Each tuple should be a 4-tuple with 'filename', 'lineno', + 'name', 'line' as the elements. + + -- Method: format () + + Returns a list of strings ready for printing. Each string in + the resulting list corresponds to a single *note frame: 6db. + 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. + + Changed in version 3.6: Long sequences of repeated frames are + now abbreviated. + + -- Method: format_frame_summary (frame_summary) + + Returns a string for printing one of the *note frames: 6db. + involved in the stack. This method is called for each *note + FrameSummary: e7f. object to be printed by *note + StackSummary.format(): 4464. If it returns ‘None’, the frame + is omitted from the output. + + Added in version 3.11. + + +File: python.info, Node: FrameSummary Objects, Next: Examples of Using the Module-Level Functions, Prev: StackSummary Objects, Up: traceback — Print or retrieve a stack traceback + +5.30.11.4 ‘FrameSummary’ Objects +................................ + +Added in version 3.5. + +A ‘FrameSummary’ object represents a single *note frame: 6db. in a *note +traceback: af4. + + -- Class: 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: 6db. in the *note traceback: af4. + 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: 444b. attribute accessed + (which also happens when casting it to a *note tuple: 36b.). *note + line: 444b. 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’ instances have the following attributes: + + -- Attribute: filename + + The filename of the source code for this frame. Equivalent to + accessing *note f.f_code.co_filename: 1359. on a *note frame + object: 6db. 'f'. + + -- Attribute: lineno + + The line number of the source code for this frame. + + -- Attribute: name + + Equivalent to accessing *note f.f_code.co_name: 1f36. on a + *note frame object: 6db. 'f'. + + -- Attribute: 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’. + + -- Attribute: 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. + + Changed in version 3.13: The default value changed from ‘None’ + to ‘lineno’. + + -- Attribute: colno + + The column number of the source code for this frame. By + default, it is ‘None’ and indexation starts from 0. + + -- Attribute: 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 Objects, Up: traceback — Print or retrieve a stack traceback + +5.30.11.5 Examples of Using the Module-Level Functions +...................................................... + +This simple example implements a basic read-eval-print loop, similar to +(but less useful than) the standard Python interactive interpreter loop. +For a more complete implementation of the interpreter loop, refer to the +*note code: 1a. module. + + 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) + +The following example demonstrates the different ways to print and +format the exception and traceback: + + 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) + +The output for the example would look similar to this: + + *** 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 + +The following example shows the different ways to print and format the +stack: + + >>> 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'] + +This last example demonstrates the final few formatting functions: + + >>> 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 — Print or retrieve a stack 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 statement definitions, Next: gc — Garbage Collector interface, Prev: traceback — Print or retrieve a stack traceback, Up: Python Runtime Services + +5.30.12 ‘__future__’ — Future statement definitions +--------------------------------------------------- + +'Source code:' Lib/__future__.py(1) + +__________________________________________________________________ + +Imports of the form ‘from __future__ import feature’ are called *note +future statements: 189. These are special-cased by the Python compiler +to allow the use of new Python features in modules containing the future +statement before the release in which the feature becomes standard. + +While these future statements are given additional special meaning by +the Python compiler, they are still executed like any other import +statement and the *note __future__: 0. exists and is handled by the +import system the same way any other Python module would be. This +design serves three purposes: + + * To avoid confusing existing tools that analyze import statements + and expect to find the modules they’re importing. + + * 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 *note __future__: 0. and examining its contents. + + * To ensure that *note future statements: 189. run under releases + prior to Python 2.1 at least yield runtime exceptions (the import + of *note __future__: 0. will fail, because there was no module of + that name prior to 2.1). + +* Menu: + +* Module Contents: Module Contents<5>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/__future__.py + + +File: python.info, Node: Module Contents<5>, Up: __future__ — Future statement definitions + +5.30.12.1 Module Contents +......................... + +No feature description will ever be deleted from *note __future__: 0. +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 + +------------------------------------------------------------------------------------------------------------------------ + + -- Data: 2.1.0b1 2.2 PEP 227(1): 'Statically + __future__.nested_scopes Nested Scopes' + + + -- Data: 2.2.0a1 2.3 PEP 255(2): 'Simple + __future__.generators Generators' + + + -- Data: 2.2.0a2 3.0 PEP 238(3): 'Changing the + __future__.division Division Operator' + + + -- Data: 2.5.0a1 3.0 PEP 328(4): 'Imports: + __future__.absolute_import Multi-Line and + Absolute/Relative' + + + -- Data: 2.5.0a1 2.6 PEP 343(5): 'The “with” + __future__.with_statement Statement' + + + -- Data: 2.6.0a2 3.0 PEP 3105(6): 'Make print a + __future__.print_function function' + + + -- Data: 2.6.0a2 3.0 PEP 3112(7): 'Bytes + __future__.unicode_literals literals in Python 3000' + + + -- Data: 3.5.0b1 3.7 PEP 479(8): 'StopIteration + __future__.generator_stop handling inside generators' + + + -- Data: 3.7.0b1 Never (9) PEP 563(10): 'Postponed + __future__.annotations evaluation of annotations' + + + -- Class: __future__._Feature + + Each statement in ‘__future__.py’ is of the form: + + FeatureName = _Feature(OptionalRelease, MandatoryRelease, + CompilerFlag) + + where, normally, 'OptionalRelease' is less than 'MandatoryRelease', + and both are 5-tuples of the same form as *note sys.version_info: + 69c.: + + (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 + ) + + -- Method: _Feature.getOptionalRelease () + + 'OptionalRelease' records the first release in which the feature + was accepted. + + -- Method: _Feature.getMandatoryRelease () + + In the case of a 'MandatoryRelease' that has not yet occurred, + 'MandatoryRelease' predicts the release in which the feature will + become part of the language. + + Else 'MandatoryRelease' records when the feature became part of the + language; in releases at or after that, modules no longer need a + future statement to use the feature in question, but may continue + to use such imports. + + 'MandatoryRelease' may also be ‘None’, meaning that a planned + feature got dropped or that it is not yet decided. + + -- Attribute: _Feature.compiler_flag + + 'CompilerFlag' is the (bitfield) flag that should be passed in the + fourth argument to the built-in function *note compile(): 192. to + enable the feature in dynamically compiled code. This flag is + stored in the *note _Feature.compiler_flag: 1f46. attribute on + *note _Feature: 2165. instances. + +See also +........ + +*note Future statements: 189. + + How the compiler treats future imports. + +PEP 236(11) - Back to the __future__ + + The original proposal for the __future__ mechanism. + + ---------- 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 Python Steering Council twice +decided to delay the change (announcement for Python 3.10 +(https://mail.python.org/archives/list/python-dev@python.org/message/CLVXXPQ2T2LQ5MP2Y53VVQFCXYWQJHKZ/); +announcement for Python 3.11 +(https://mail.python.org/archives/list/python-dev@python.org/message/VIZEBX5EYMSYIJNDBF6DMUMZOCWHARSO/)). +No final decision has been made yet. See also PEP 563 +(https://peps.python.org/pep-0563/) and PEP 649 +(https://peps.python.org/pep-0649/). + + (10) https://peps.python.org/pep-0563/ + + (11) https://peps.python.org/pep-0236/ + + +File: python.info, Node: gc — Garbage Collector interface, Next: inspect — Inspect live objects, Prev: __future__ — Future statement definitions, Up: Python Runtime Services + +5.30.13 ‘gc’ — Garbage Collector interface +------------------------------------------ + +__________________________________________________________________ + +This module provides an interface to the optional garbage collector. It +provides the ability to disable the collector, tune the collection +frequency, and set debugging options. It also provides access to +unreachable objects that the collector found but cannot free. Since the +collector supplements the reference counting already used in Python, you +can disable the collector if you are sure your program does not create +reference cycles. Automatic collection can be disabled by calling +‘gc.disable()’. To debug a leaking program call +‘gc.set_debug(gc.DEBUG_LEAK)’. Notice that this includes +‘gc.DEBUG_SAVEALL’, causing garbage-collected objects to be saved in +gc.garbage for inspection. + +The *note gc: 60. module provides the following functions: + + -- Function: gc.enable () + + Enable automatic garbage collection. + + -- Function: gc.disable () + + Disable automatic garbage collection. + + -- Function: gc.isenabled () + + Return ‘True’ if automatic collection is enabled. + + -- Function: 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: 204. is raised if the + generation number is invalid. The sum of collected objects and + uncollectable objects is returned. + + The free lists maintained for a number of built-in types are + cleared whenever a full collection or collection of the highest + generation (2) is run. Not all items in some free lists may be + freed due to the particular implementation, in particular *note + float: 2f1. + + The effect of calling ‘gc.collect()’ while the interpreter is + already performing a collection is undefined. + + -- Function: gc.set_debug (flags) + + Set the garbage collection debugging flags. Debugging information + will be written to ‘sys.stderr’. See below for a list of debugging + flags which can be combined using bit operations to control + debugging. + + -- Function: gc.get_debug () + + Return the debugging flags currently set. + + -- Function: 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. + + Changed in version 3.8: New 'generation' parameter. + + Raises an *note auditing event: 18ba. ‘gc.get_objects’ with + argument ‘generation’. + + -- Function: gc.get_stats () + + Return a list of three per-generation dictionaries containing + collection statistics since interpreter start. The number of keys + may change in the future, but currently each dictionary will + contain the following items: + + * ‘collections’ is the number of times this generation was + collected; + + * ‘collected’ is the total number of objects collected inside + this generation; + + * ‘uncollectable’ is the total number of objects which were + found to be uncollectable (and were therefore moved to the + *note garbage: 11b3. list) inside this generation. + + Added in version 3.4. + + -- Function: gc.set_threshold (threshold0[, threshold1[, threshold2]]) + + Set the garbage collection thresholds (the collection frequency). + Setting 'threshold0' to zero disables collection. + + 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. + + -- Function: gc.get_count () + + Return the current collection counts as a tuple of ‘(count0, + count1, count2)’. + + -- Function: gc.get_threshold () + + Return the current collection thresholds as a tuple of + ‘(threshold0, threshold1, threshold2)’. + + -- Function: gc.get_referrers (*objs) + + Return the list of objects that directly refer to any of objs. + This function will only locate those containers which support + garbage collection; extension types which do refer to other objects + but do not support garbage collection will not be found. + + Note that objects which have already been dereferenced, but which + live in cycles and have not yet been collected by the garbage + collector can be listed among the resulting referrers. To get only + currently live objects, call *note collect(): a39. before calling + *note get_referrers(): 800. + + Warning: Care must be taken when using objects returned by + *note get_referrers(): 800. because some of them could still + be under construction and hence in a temporarily invalid + state. Avoid using *note get_referrers(): 800. for any + purpose other than debugging. + + Raises an *note auditing event: 18ba. ‘gc.get_referrers’ with + argument ‘objs’. + + -- Function: gc.get_referents (*objs) + + Return a list of objects directly referred to by any of the + arguments. The referents returned are those objects visited by the + arguments’ C-level *note tp_traverse: 779. methods (if any), and + may not be all objects actually directly reachable. *note + tp_traverse: 779. methods are supported only by objects that + support garbage collection, and are only required to visit objects + that may be involved in a cycle. So, for example, if an integer is + directly reachable from an argument, that integer object may or may + not appear in the result list. + + Raises an *note auditing event: 18ba. ‘gc.get_referents’ with + argument ‘objs’. + + -- Function: gc.is_tracked (obj) + + Returns ‘True’ if the object is currently tracked by the garbage + collector, ‘False’ otherwise. As a general rule, instances of + atomic types aren’t tracked and instances of non-atomic types + (containers, user-defined objects…) are. However, some + type-specific optimizations can be present in order to suppress the + garbage collector footprint of simple instances (e.g. dicts + containing only atomic keys and values): + + >>> gc.is_tracked(0) + False + >>> gc.is_tracked("a") + False + >>> gc.is_tracked([]) + True + >>> gc.is_tracked({}) + False + >>> gc.is_tracked({"a": 1}) + False + >>> gc.is_tracked({"a": []}) + True + + Added in version 3.1. + + -- Function: 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. + + -- Function: 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. + + -- Function: gc.unfreeze () + + Unfreeze the objects in the permanent generation, put them back + into the oldest generation. + + Added in version 3.7. + + -- Function: gc.get_freeze_count () + + Return the number of objects in the permanent generation. + + Added in version 3.7. + +The following variables are provided for read-only access (you can +mutate the values but should not rebind them): + + -- Data: gc.garbage + + A list of objects which the collector found to be unreachable but + could not be freed (uncollectable objects). Starting with Python + 3.4, this list should be empty most of the time, except when using + instances of C extension types with a non-‘NULL’ ‘tp_del’ slot. + + If *note DEBUG_SAVEALL: 4485. is set, then all unreachable objects + will be added to this list rather than freed. + + Changed in version 3.2: If this list is non-empty at *note + interpreter shutdown: 14e, a *note ResourceWarning: 246. is + emitted, which is silent by default. If *note DEBUG_UNCOLLECTABLE: + 11b4. is set, in addition all uncollectable objects are printed. + + Changed in version 3.4: Following PEP 442(2), objects with a *note + __del__(): 1f61. method don’t end up in *note gc.garbage: 11b3. + anymore. + + -- Data: gc.callbacks + + A list of callbacks that will be invoked by the garbage collector + before and after collection. The callbacks will be called with two + arguments, 'phase' and 'info'. + + 'phase' can be one of two values: + + “start”: The garbage collection is about to start. + + “stop”: The garbage collection has finished. + + 'info' is a dict providing more information for the callback. The + following keys are currently defined: + + “generation”: The oldest generation being collected. + + “collected”: When 'phase' is “stop”, the number of objects + successfully collected. + + “uncollectable”: When 'phase' is “stop”, the number of objects + that could not be collected and were put in *note garbage: + 11b3. + + Applications can add their own callbacks to this list. The primary + use cases are: + + Gathering statistics about garbage collection, such as how + often various generations are collected, and how long the + collection takes. + + Allowing applications to identify and clear their own + uncollectable types when they appear in *note garbage: 11b3. + + Added in version 3.3. + +The following constants are provided for use with *note set_debug(): +4480.: + + -- Data: gc.DEBUG_STATS + + Print statistics during collection. This information can be useful + when tuning the collection frequency. + + -- Data: gc.DEBUG_COLLECTABLE + + Print information on collectable objects found. + + -- Data: gc.DEBUG_UNCOLLECTABLE + + Print information of uncollectable objects found (objects which are + not reachable but cannot be freed by the collector). These objects + will be added to the ‘garbage’ list. + + Changed in version 3.2: Also print the contents of the *note + garbage: 11b3. list at *note interpreter shutdown: 14e, if it isn’t + empty. + + -- Data: gc.DEBUG_SAVEALL + + When set, all unreachable objects found will be appended to + 'garbage' rather than being freed. This can be useful for + debugging a leaking program. + + -- Data: gc.DEBUG_LEAK + + The debugging flags necessary for the collector to print + information about a leaking program (equal to ‘DEBUG_COLLECTABLE | + DEBUG_UNCOLLECTABLE | DEBUG_SAVEALL’). + + ---------- Footnotes ---------- + + (1) +https://devguide.python.org/garbage_collector/#collecting-the-oldest-generation + + (2) https://peps.python.org/pep-0442/ + + +File: python.info, Node: inspect — Inspect live objects, Next: site — Site-specific configuration hook, Prev: gc — Garbage Collector interface, Up: Python Runtime Services + +5.30.14 ‘inspect’ — Inspect live objects +---------------------------------------- + +'Source code:' Lib/inspect.py(1) + +__________________________________________________________________ + +The *note inspect: 7e. 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. + +There are four main kinds of services provided by this module: type +checking, getting source code, inspecting classes and functions, and +examining the interpreter stack. + +* Menu: + +* Types and members:: +* Retrieving source code:: +* Introspecting callables with the Signature object:: +* Classes and functions: Classes and functions<2>. +* The interpreter stack:: +* Fetching attributes statically:: +* Current State of Generators, Coroutines, and Asynchronous Generators: Current State of Generators Coroutines and Asynchronous Generators. +* Code Objects Bit Flags:: +* Buffer flags:: +* Command Line Interface: Command Line Interface<3>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/inspect.py + + +File: python.info, Node: Types and members, Next: Retrieving source code, Up: inspect — Inspect live objects + +5.30.14.1 Types and members +........................... + +The *note getmembers(): 1854. function retrieves the members of an +object such as a class or module. The functions whose names begin with +“is” are mainly provided as convenient choices for the second argument +to *note getmembers(): 1854. They also help you determine when you can +expect to find the following special attributes (see *note +Import-related attributes on module objects: 1f14. for module +attributes): + +Type Attribute Description + +------------------------------------------------------------------------------ + +class __doc__ documentation string + + + __name__ name with which this class + was defined + + + __qualname__ qualified name + + + __module__ name of module in which this + class was defined + + + __type_params__ A tuple containing the + *note type parameters: 2b5. + of a generic class + + +method __doc__ documentation string + + + __name__ name with which this method + was defined + + + __qualname__ qualified name + + + __func__ function object containing + implementation of method + + + __self__ instance to which this method + is bound, or ‘None’ + + + __module__ name of module in which this + method was defined + + +function __doc__ documentation string + + + __name__ name with which this function + was defined + + + __qualname__ qualified name + + + __code__ code object containing + compiled function + *note bytecode: 187. + + + __defaults__ tuple of any default values + for positional or keyword + parameters + + + __kwdefaults__ mapping of any default values + for keyword-only parameters + + + __globals__ global namespace in which + this function was defined + + + __builtins__ builtins namespace + + + __annotations__ mapping of parameters names + to annotations; ‘"return"’ + key is reserved for return + annotations. + + + __type_params__ A tuple containing the + *note type parameters: 2b5. + of a generic function + + + __module__ name of module in which this + function was defined + + +traceback tb_frame frame object at this level + + + tb_lasti index of last attempted + instruction in bytecode + + + tb_lineno current line number in Python + source code + + + tb_next next inner traceback object + (called by this level) + + +frame f_back next outer frame object (this + frame’s caller) + + + f_builtins builtins namespace seen by + this frame + + + f_code code object being executed in + this frame + + + f_globals global namespace seen by this + frame + + + f_lasti index of last attempted + instruction in bytecode + + + f_lineno current line number in Python + source code + + + f_locals local namespace seen by this + frame + + + f_trace tracing function for this + frame, or ‘None’ + + +code co_argcount number of arguments (not + including keyword only + arguments, * or ** args) + + + co_code string of raw compiled + bytecode + + + co_cellvars tuple of names of cell + variables (referenced by + containing scopes) + + + co_consts tuple of constants used in + the bytecode + + + co_filename name of file in which this + code object was created + + + co_firstlineno number of first line in + Python source code + + + co_flags bitmap of ‘CO_*’ flags, read + more *note here: 1f45. + + + co_lnotab encoded mapping of line + numbers to bytecode indices + + + co_freevars tuple of names of free + variables (referenced via a + function’s closure) + + + co_posonlyargcount number of positional only + arguments + + + co_kwonlyargcount number of keyword only + arguments (not including ** + arg) + + + co_name name with which this code + object was defined + + + co_qualname fully qualified name with + which this code object was + defined + + + co_names tuple of names other than + arguments and function locals + + + co_nlocals number of local variables + + + co_stacksize virtual machine stack space + required + + + co_varnames tuple of names of arguments + and local variables + + +generator __name__ name + + + __qualname__ qualified name + + + gi_frame frame + + + gi_running is the generator running? + + + gi_code code + + + gi_yieldfrom object being iterated by + ‘yield from’, or ‘None’ + + +async generator __name__ name + + + __qualname__ qualified name + + + ag_await object being awaited on, or + ‘None’ + + + ag_frame frame + + + ag_running is the generator running? + + + ag_code code + + +coroutine __name__ name + + + __qualname__ qualified name + + + cr_await object being awaited on, or + ‘None’ + + + cr_frame frame + + + cr_running is the coroutine running? + + + cr_code code + + + cr_origin where coroutine was created, + or ‘None’. See + *note sys.set_coroutine_origin_tracking_depth(): b8c. + + +builtin __doc__ documentation string + + + __name__ original name of this + function or method + + + __qualname__ qualified name + + + __self__ instance to which a method is + bound, or ‘None’ + + +Changed in version 3.5: Add ‘__qualname__’ and ‘gi_yieldfrom’ attributes +to generators. + +The ‘__name__’ attribute of generators is now set from the function +name, instead of the code name, and it can now be modified. + +Changed in version 3.7: Add ‘cr_origin’ attribute to coroutines. + +Changed in version 3.10: Add ‘__builtins__’ attribute to functions. + + -- Function: inspect.getmembers (object[, predicate]) + + Return all the members of an object in a list of ‘(name, value)’ + pairs sorted by name. If the optional 'predicate' argument—which + will be called with the ‘value’ object of each member—is supplied, + only members for which the predicate returns a true value are + included. + + Note: *note getmembers(): 1854. will only return class + attributes defined in the metaclass when the argument is a + class and those attributes have been listed in the metaclass’ + custom *note __dir__(): 1f67. + + -- Function: inspect.getmembers_static (object[, predicate]) + + Return all the members of an object in a list of ‘(name, value)’ + pairs sorted by name without triggering dynamic lookup via the + descriptor protocol, __getattr__ or __getattribute__. Optionally, + only return members that satisfy a given predicate. + + Note: *note getmembers_static(): 645. may not be able to + retrieve all members that getmembers can fetch (like + dynamically created attributes) and may find members that + getmembers can’t (like descriptors that raise AttributeError). + It can also return descriptor objects instead of instance + members in some cases. + + Added in version 3.11. + + -- Function: inspect.getmodulename (path) + + Return the name of the module named by the file 'path', without + including the names of enclosing packages. The file extension is + checked against all of the entries in *note + importlib.machinery.all_suffixes(): 448c. If it matches, the final + path component is returned with the extension removed. Otherwise, + ‘None’ is returned. + + Note that this function 'only' returns a meaningful name for actual + Python modules - paths that potentially refer to Python packages + will still return ‘None’. + + Changed in version 3.3: The function is based directly on *note + importlib: 77. + + -- Function: inspect.ismodule (object) + + Return ‘True’ if the object is a module. + + -- Function: inspect.isclass (object) + + Return ‘True’ if the object is a class, whether built-in or created + in Python code. + + -- Function: inspect.ismethod (object) + + Return ‘True’ if the object is a bound method written in Python. + + -- Function: inspect.isfunction (object) + + Return ‘True’ if the object is a Python function, which includes + functions created by a *note lambda: 2743. expression. + + -- Function: inspect.isgeneratorfunction (object) + + Return ‘True’ if the object is a Python generator function. + + Changed in version 3.8: Functions wrapped in *note + functools.partial(): 410. now return ‘True’ if the wrapped function + is a Python generator function. + + Changed in version 3.13: Functions wrapped in *note + functools.partialmethod(): a7b. now return ‘True’ if the wrapped + function is a Python generator function. + + -- Function: inspect.isgenerator (object) + + Return ‘True’ if the object is a generator. + + -- Function: inspect.iscoroutinefunction (object) + + Return ‘True’ if the object is a *note coroutine function: d76. (a + function defined with an *note async def: 5cd. syntax), a *note + functools.partial(): 410. wrapping a *note coroutine function: d76, + or a sync function marked with *note markcoroutinefunction(): 48c. + + Added in version 3.5. + + Changed in version 3.8: Functions wrapped in *note + functools.partial(): 410. now return ‘True’ if the wrapped function + is a *note coroutine function: d76. + + Changed in version 3.12: Sync functions marked with *note + markcoroutinefunction(): 48c. now return ‘True’. + + Changed in version 3.13: Functions wrapped in *note + functools.partialmethod(): a7b. now return ‘True’ if the wrapped + function is a *note coroutine function: d76. + + -- Function: inspect.markcoroutinefunction (func) + + Decorator to mark a callable as a *note coroutine function: d76. if + it would not otherwise be detected by *note iscoroutinefunction(): + 2e8. + + This may be of use for sync functions that return a *note + coroutine: 48d, if the function is passed to an API that requires + *note iscoroutinefunction(): 2e8. + + When possible, using an *note async def: 5cd. function is + preferred. Also acceptable is calling the function and testing the + return with *note iscoroutine(): e15. + + Added in version 3.12. + + -- Function: inspect.iscoroutine (object) + + Return ‘True’ if the object is a *note coroutine: 48d. created by + an *note async def: 5cd. function. + + Added in version 3.5. + + -- Function: inspect.isawaitable (object) + + Return ‘True’ if the object can be used in *note await: 1b9. + expression. + + Can also be used to distinguish generator-based coroutines from + regular generators: + + import types + + def gen(): + yield + @types.coroutine + def gen_coro(): + yield + + assert not isawaitable(gen()) + assert isawaitable(gen_coro()) + + Added in version 3.5. + + -- Function: inspect.isasyncgenfunction (object) + + Return ‘True’ if the object is an *note asynchronous generator: + 203e. function, for example: + + >>> async def agen(): + ... yield 1 + ... + >>> inspect.isasyncgenfunction(agen) + True + + Added in version 3.6. + + Changed in version 3.8: Functions wrapped in *note + functools.partial(): 410. now return ‘True’ if the wrapped function + is an *note asynchronous generator: 203e. function. + + Changed in version 3.13: Functions wrapped in *note + functools.partialmethod(): a7b. now return ‘True’ if the wrapped + function is a *note coroutine function: d76. + + -- Function: inspect.isasyncgen (object) + + Return ‘True’ if the object is an *note asynchronous generator + iterator: 4396. created by an *note asynchronous generator: 203e. + function. + + Added in version 3.6. + + -- Function: inspect.istraceback (object) + + Return ‘True’ if the object is a traceback. + + -- Function: inspect.isframe (object) + + Return ‘True’ if the object is a frame. + + -- Function: inspect.iscode (object) + + Return ‘True’ if the object is a code. + + -- Function: inspect.isbuiltin (object) + + Return ‘True’ if the object is a built-in function or a bound + built-in method. + + -- Function: inspect.ismethodwrapper (object) + + Return ‘True’ if the type of object is a *note MethodWrapperType: + 647. + + These are instances of *note MethodWrapperType: 647, such as *note + __str__(): 619, *note __eq__(): afa. and *note __repr__(): 618. + + Added in version 3.11. + + -- Function: inspect.isroutine (object) + + Return ‘True’ if the object is a user-defined or built-in function + or method. + + -- Function: inspect.isabstract (object) + + Return ‘True’ if the object is an abstract base class. + + -- Function: inspect.ismethoddescriptor (object) + + Return ‘True’ if the object is a method descriptor, but not if + *note ismethod(): 448f, *note isclass(): 448e, *note isfunction(): + 4490. or *note isbuiltin(): 4496. are true. + + This, for example, is true of ‘int.__add__’. An object passing + this test has a *note __get__(): 14b2. method, but not a *note + __set__(): 1f6a. method or a *note __delete__(): 1609. method. + Beyond that, the set of attributes varies. A *note __name__: 105f. + attribute is usually sensible, and *note __doc__: 927. often is. + + Methods implemented via descriptors that also pass one of the other + tests return ‘False’ from the *note ismethoddescriptor(): 15eb. + test, simply because the other tests promise more – you can, e.g., + count on having the *note __func__: 12ef. attribute (etc) when an + object passes *note ismethod(): 448f. + + Changed in version 3.13: This function no longer incorrectly + reports objects with *note __get__(): 14b2. and *note __delete__(): + 1609, but not *note __set__(): 1f6a, as being method descriptors + (such objects are data descriptors, not method descriptors). + + -- Function: inspect.isdatadescriptor (object) + + Return ‘True’ if the object is a data descriptor. + + Data descriptors have a *note __set__: 1f6a. or a *note __delete__: + 1609. method. Examples are properties (defined in Python), + getsets, and members. The latter two are defined in C and there + are more specific tests available for those types, which is robust + across Python implementations. Typically, data descriptors will + also have *note __name__: 105f. and ‘__doc__’ attributes + (properties, getsets, and members have both of these attributes), + but this is not guaranteed. + + -- Function: inspect.isgetsetdescriptor (object) + + Return ‘True’ if the object is a getset descriptor. + + 'CPython implementation detail:' getsets are attributes defined in + extension modules via *note PyGetSetDef: bb8. structures. For + Python implementations without such types, this method will always + return ‘False’. + + -- Function: inspect.ismemberdescriptor (object) + + Return ‘True’ if the object is a member descriptor. + + 'CPython implementation detail:' Member descriptors are attributes + defined in extension modules via *note PyMemberDef: 54c. + structures. For Python implementations without such types, this + method will always return ‘False’. + + +File: python.info, Node: Retrieving source code, Next: Introspecting callables with the Signature object, Prev: Types and members, Up: inspect — Inspect live objects + +5.30.14.2 Retrieving source code +................................ + + -- Function: inspect.getdoc (object) + + Get the documentation string for an object, cleaned up with *note + cleandoc(): 16b5. If the documentation string for an object is not + provided and the object is a class, a method, a property or a + descriptor, retrieve the documentation string from the inheritance + hierarchy. Return ‘None’ if the documentation string is invalid or + missing. + + Changed in version 3.5: Documentation strings are now inherited if + not overridden. + + -- Function: inspect.getcomments (object) + + Return in a single string any lines of comments immediately + preceding the object’s source code (for a class, function, or + method), or at the top of the Python source file (if the object is + a module). If the object’s source code is unavailable, return + ‘None’. This could happen if the object has been defined in C or + the interactive shell. + + -- Function: inspect.getfile (object) + + Return the name of the (text or binary) file in which an object was + defined. This will fail with a *note TypeError: 534. if the object + is a built-in module, class, or function. + + -- Function: inspect.getmodule (object) + + Try to guess which module an object was defined in. Return ‘None’ + if the module cannot be determined. + + -- Function: inspect.getsourcefile (object) + + Return the name of the Python source file in which an object was + defined or ‘None’ if no way can be identified to get the source. + This will fail with a *note TypeError: 534. if the object is a + built-in module, class, or function. + + -- Function: inspect.getsourcelines (object) + + Return a list of source lines and starting line number for an + object. The argument may be a module, class, method, function, + traceback, frame, or code object. The source code is returned as a + list of the lines corresponding to the object and the line number + indicates where in the original source file the first line of code + was found. An *note OSError: 413. is raised if the source code + cannot be retrieved. A *note TypeError: 534. is raised if the + object is a built-in module, class, or function. + + Changed in version 3.3: *note OSError: 413. is raised instead of + *note IOError: 104b, now an alias of the former. + + -- Function: inspect.getsource (object) + + Return the text of the source code for an object. The argument may + be a module, class, method, function, traceback, frame, or code + object. The source code is returned as a single string. An *note + OSError: 413. is raised if the source code cannot be retrieved. A + *note TypeError: 534. is raised if the object is a built-in module, + class, or function. + + Changed in version 3.3: *note OSError: 413. is raised instead of + *note IOError: 104b, now an alias of the former. + + -- Function: inspect.cleandoc (doc) + + Clean up indentation from docstrings that are indented to line up + with blocks of code. + + All leading whitespace is removed from the first line. Any leading + whitespace that can be uniformly removed from the second line + onwards is removed. Empty lines at the beginning and end are + subsequently removed. Also, all tabs are expanded to spaces. + + +File: python.info, Node: Introspecting callables with the Signature object, Next: Classes and functions<2>, Prev: Retrieving source code, Up: inspect — Inspect live objects + +5.30.14.3 Introspecting callables with the Signature object +........................................................... + +Added in version 3.3. + +The *note Signature: 1cf. object represents the call signature of a +callable object and its return annotation. To retrieve a ‘Signature’ +object, use the ‘signature()’ function. + + -- Function: inspect.signature (callable, *, follow_wrapped=True, + globals=None, locals=None, eval_str=False) + + Return a *note Signature: 1cf. object for the given 'callable': + + >>> 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'> + + Accepts a wide range of Python callables, from plain functions and + classes to *note functools.partial(): 410. objects. + + For objects defined in modules using stringized annotations (‘from + __future__ import annotations’), *note signature(): 733. will + attempt to automatically un-stringize the annotations using *note + get_annotations(): 80f. The 'globals', 'locals', and 'eval_str' + parameters are passed into *note get_annotations(): 80f. when + resolving the annotations; see the documentation for *note + get_annotations(): 80f. for instructions on how to use these + parameters. + + Raises *note ValueError: 204. if no signature can be provided, and + *note TypeError: 534. if that type of object is not supported. + Also, if the annotations are stringized, and 'eval_str' is not + false, the ‘eval()’ call(s) to un-stringize the annotations in + *note get_annotations(): 80f. could potentially raise any kind of + exception. + + A slash(/) in the signature of a function denotes that the + parameters prior to it are positional-only. For more info, see + *note the FAQ entry on positional-only parameters: 2174. + + Changed in version 3.5: The 'follow_wrapped' parameter was added. + Pass ‘False’ to get a signature of 'callable' specifically + (‘callable.__wrapped__’ will not be used to unwrap decorated + callables.) + + Changed in version 3.10: The 'globals', 'locals', and 'eval_str' + parameters were added. + + Note: Some callables may not be introspectable in certain + implementations of Python. For example, in CPython, some + built-in functions defined in C provide no metadata about + their arguments. + + 'CPython implementation detail:' If the passed object has a + ‘__signature__’ attribute, we may use it to create the signature. + The exact semantics are an implementation detail and are subject to + unannounced changes. Consult the source code for current + semantics. + + -- Class: inspect.Signature (parameters=None, *, + return_annotation=Signature.empty) + + A ‘Signature’ object represents the call signature of a function + and its return annotation. For each parameter accepted by the + function it stores a *note Parameter: 1d0. object in its *note + parameters: 44a0. collection. + + The optional 'parameters' argument is a sequence of *note + Parameter: 1d0. objects, which is validated to check that there are + no parameters with duplicate names, and that the parameters are in + the right order, i.e. positional-only first, then + positional-or-keyword, and that parameters with defaults follow + parameters without defaults. + + The optional 'return_annotation' argument can be an arbitrary + Python object. It represents the “return” annotation of the + callable. + + ‘Signature’ objects are 'immutable'. Use *note + Signature.replace(): 44a1. or *note copy.replace(): 151. to make a + modified copy. + + Changed in version 3.5: ‘Signature’ objects are now picklable and + *note hashable: 60c. + + -- Attribute: empty + + A special class-level marker to specify absence of a return + annotation. + + -- Attribute: parameters + + An ordered mapping of parameters’ names to the corresponding + *note Parameter: 1d0. objects. Parameters appear in strict + definition order, including keyword-only parameters. + + Changed in version 3.7: Python only explicitly guaranteed that + it preserved the declaration order of keyword-only parameters + as of version 3.7, although in practice this order had always + been preserved in Python 3. + + -- Attribute: return_annotation + + The “return” annotation for the callable. If the callable has + no “return” annotation, this attribute is set to *note + Signature.empty: 44a2. + + -- Method: bind (*args, **kwargs) + + Create a mapping from positional and keyword arguments to + parameters. Returns *note BoundArguments: 1062. if ‘*args’ + and ‘**kwargs’ match the signature, or raises a *note + TypeError: 534. + + -- Method: bind_partial (*args, **kwargs) + + Works the same way as *note Signature.bind(): 1562, but allows + the omission of some required arguments (mimics *note + functools.partial(): 410. behavior.) Returns *note + BoundArguments: 1062, or raises a *note TypeError: 534. if the + passed arguments do not match the signature. + + -- Method: replace (*[, parameters][, return_annotation]) + + Create a new *note Signature: 1cf. instance based on the + instance *note replace(): 44a1. was invoked on. It is + possible to pass different 'parameters' and/or + 'return_annotation' to override the corresponding properties + of the base signature. To remove ‘return_annotation’ from the + copied ‘Signature’, pass in *note Signature.empty: 44a2. + + >>> 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: 1cf. objects are also supported by the + generic function *note copy.replace(): 151. + + -- Method: format (*, max_width=None) + + Create a string representation of the *note Signature: 1cf. + object. + + If 'max_width' is passed, the method will attempt to fit the + signature into lines of at most 'max_width' characters. If + the signature is longer than 'max_width', all parameters will + be on separate lines. + + Added in version 3.13. + + -- Method: classmethod from_callable (obj, *, follow_wrapped=True, + globals=None, locals=None, eval_str=False) + + Return a *note Signature: 1cf. (or its subclass) object for a + given callable 'obj'. + + This method simplifies subclassing of *note Signature: 1cf.: + + class MySignature(Signature): + pass + sig = MySignature.from_callable(sum) + assert isinstance(sig, MySignature) + + Its behavior is otherwise identical to that of *note + signature(): 733. + + Added in version 3.5. + + Changed in version 3.10: The 'globals', 'locals', and + 'eval_str' parameters were added. + + -- Class: inspect.Parameter (name, kind, *, default=Parameter.empty, + annotation=Parameter.empty) + + ‘Parameter’ objects are 'immutable'. Instead of modifying a + ‘Parameter’ object, you can use *note Parameter.replace(): 44a6. or + *note copy.replace(): 151. to create a modified copy. + + Changed in version 3.5: Parameter objects are now picklable and + *note hashable: 60c. + + -- Attribute: empty + + A special class-level marker to specify absence of default + values and annotations. + + -- Attribute: name + + The name of the parameter as a string. The name must be a + valid Python identifier. + + 'CPython implementation detail:' CPython generates implicit + parameter names of the form ‘.0’ on the code objects used to + implement comprehensions and generator expressions. + + Changed in version 3.6: These parameter names are now exposed + by this module as names like ‘implicit0’. + + -- Attribute: default + + The default value for the parameter. If the parameter has no + default value, this attribute is set to *note Parameter.empty: + 44a7. + + -- Attribute: annotation + + The annotation for the parameter. If the parameter has no + annotation, this attribute is set to *note Parameter.empty: + 44a7. + + -- Attribute: kind + + Describes how argument values are bound to the parameter. The + possible values are accessible via *note Parameter: 1d0. (like + ‘Parameter.KEYWORD_ONLY’), and support comparison and + ordering, in the following order: + + Name Meaning + + -------------------------------------------------------------------------------- + + 'POSITIONAL_ONLY' Value must be supplied as a positional argument. + Positional only parameters are those which + appear before a ‘/’ entry (if present) in a + Python function definition. + + + 'POSITIONAL_OR_KEYWORD' Value may be supplied as either a keyword or + positional argument (this is the standard + binding behaviour for functions implemented in + Python.) + + + 'VAR_POSITIONAL' A tuple of positional arguments that aren’t + bound to any other parameter. This corresponds + to a ‘*args’ parameter in a Python function + definition. + + + 'KEYWORD_ONLY' Value must be supplied as a keyword argument. + Keyword only parameters are those which appear + after a ‘*’ or ‘*args’ entry in a Python + function definition. + + + 'VAR_KEYWORD' A dict of keyword arguments that aren’t bound to + any other parameter. This corresponds to a + ‘**kwargs’ parameter in a Python function + definition. + + + Example: print all keyword-only arguments without default + values: + + >>> 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 + + -- Attribute: kind.description + + Describes an enum value of *note Parameter.kind: 44ab. + + Added in version 3.8. + + Example: print all descriptions of arguments: + + >>> 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 + + -- Method: replace (*[, name][, kind][, default][, annotation]) + + Create a new *note Parameter: 1d0. instance based on the + instance replaced was invoked on. To override a ‘Parameter’ + attribute, pass the corresponding argument. To remove a + default value or/and an annotation from a ‘Parameter’, pass + *note Parameter.empty: 44a7. + + >>> 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: 1d0. objects are also supported by the + generic function *note copy.replace(): 151. + + Changed in version 3.4: In Python 3.3 *note Parameter: 1d0. objects + were allowed to have ‘name’ set to ‘None’ if their ‘kind’ was set + to ‘POSITIONAL_ONLY’. This is no longer permitted. + + -- Class: inspect.BoundArguments + + Result of a *note Signature.bind(): 1562. or *note + Signature.bind_partial(): 44a4. call. Holds the mapping of + arguments to the function’s parameters. + + -- Attribute: arguments + + A mutable mapping of parameters’ names to arguments’ values. + Contains only explicitly bound arguments. Changes in *note + arguments: 90b. will reflect in *note args: 44ad. and *note + kwargs: 44ae. + + Should be used in conjunction with *note Signature.parameters: + 44a0. for any argument processing purposes. + + Note: Arguments for which *note Signature.bind(): 1562. + or *note Signature.bind_partial(): 44a4. relied on a + default value are skipped. However, if needed, use *note + BoundArguments.apply_defaults(): e14. to add them. + + Changed in version 3.9: *note arguments: 90b. is now of type + *note dict: 258. Formerly, it was of type *note + collections.OrderedDict: 5d7. + + -- Attribute: args + + A tuple of positional arguments values. Dynamically computed + from the *note arguments: 90b. attribute. + + -- Attribute: kwargs + + A dict of keyword arguments values. Dynamically computed from + the *note arguments: 90b. attribute. Arguments that can be + passed positionally are included in *note args: 44ad. instead. + + -- Attribute: signature + + A reference to the parent *note Signature: 1cf. object. + + -- Method: apply_defaults () + + Set default values for missing arguments. + + For variable-positional arguments (‘*args’) the default is an + empty tuple. + + For variable-keyword arguments (‘**kwargs’) the default is an + empty dict. + + >>> 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. + + The *note args: 44ad. and *note kwargs: 44ae. properties can be + used to invoke functions: + + def test(a, *, b): + ... + + sig = signature(test) + ba = sig.bind(10, b=20) + test(*ba.args, **ba.kwargs) + +See also +........ + +PEP 362(1) - Function Signature Object. + + The detailed specification, implementation details and examples. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0362/ + + +File: python.info, Node: Classes and functions<2>, Next: The interpreter stack, Prev: Introspecting callables with the Signature object, Up: inspect — Inspect live objects + +5.30.14.4 Classes and functions +............................... + + -- Function: inspect.getclasstree (classes, unique=False) + + Arrange the given list of classes into a hierarchy of nested lists. + Where a nested list appears, it contains classes derived from the + class whose entry immediately precedes the list. Each entry is a + 2-tuple containing a class and a tuple of its base classes. If the + 'unique' argument is true, exactly one entry appears in the + returned structure for each class in the given list. Otherwise, + classes using multiple inheritance and their descendants will + appear multiple times. + + -- Function: inspect.getfullargspec (func) + + Get the names and default values of a Python function’s parameters. + A *note named tuple: 64a. is returned: + + ‘FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, + kwonlydefaults, annotations)’ + + 'args' is a list of the positional parameter names. 'varargs' is + the name of the ‘*’ parameter or ‘None’ if arbitrary positional + arguments are not accepted. 'varkw' is the name of the ‘**’ + parameter or ‘None’ if arbitrary keyword arguments are not + accepted. 'defaults' is an 'n'-tuple of default argument values + corresponding to the last 'n' positional parameters, or ‘None’ if + there are no such defaults defined. 'kwonlyargs' is a list of + keyword-only parameter names in declaration order. + 'kwonlydefaults' is a dictionary mapping parameter names from + 'kwonlyargs' to the default values used if no argument is supplied. + 'annotations' is a dictionary mapping parameter names to + annotations. The special key ‘"return"’ is used to report the + function return value annotation (if any). + + Note that *note signature(): 733. and *note Signature Object: 449e. + provide the recommended API for callable introspection, and support + additional behaviours (like positional-only arguments) that are + sometimes encountered in extension module APIs. This function is + retained primarily for use in code that needs to maintain + compatibility with the Python 2 ‘inspect’ module API. + + Changed in version 3.4: This function is now based on *note + signature(): 733, but still ignores ‘__wrapped__’ attributes and + includes the already bound first parameter in the signature output + for bound methods. + + Changed in version 3.6: This method was previously documented as + deprecated in favour of *note signature(): 733. 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. + + Changed in version 3.7: Python only explicitly guaranteed that it + preserved the declaration order of keyword-only parameters as of + version 3.7, although in practice this order had always been + preserved in Python 3. + + -- Function: inspect.getargvalues (frame) + + Get information about arguments passed into a particular frame. A + *note named tuple: 64a. ‘ArgInfo(args, varargs, keywords, locals)’ + is returned. 'args' is a list of the argument names. 'varargs' + and 'keywords' are the names of the ‘*’ and ‘**’ arguments or + ‘None’. 'locals' is the locals dictionary of the given frame. + + Note: This function was inadvertently marked as deprecated in + Python 3.5. + + -- Function: inspect.formatargvalues (args[, varargs, varkw, locals, + formatarg, formatvarargs, formatvarkw, formatvalue]) + + Format a pretty argument spec from the four values returned by + *note getargvalues(): eb8. The format* arguments are the + corresponding optional formatting functions that are called to turn + names and values into strings. + + Note: This function was inadvertently marked as deprecated in + Python 3.5. + + -- Function: inspect.getmro (cls) + + Return a tuple of class cls’s base classes, including cls, in + method resolution order. No class appears more than once in this + tuple. Note that the method resolution order depends on cls’s + type. Unless a very peculiar user-defined metatype is in use, cls + will be the first element of the tuple. + + -- Function: inspect.getcallargs (func, /, *args, **kwds) + + Bind the 'args' and 'kwds' to the argument names of the Python + function or method 'func', as if it was called with them. For + bound methods, bind also the first argument (typically named + ‘self’) to the associated instance. A dict is returned, mapping + the argument names (including the names of the ‘*’ and ‘**’ + arguments, if any) to their values from 'args' and 'kwds'. In case + of invoking 'func' incorrectly, i.e. whenever ‘func(*args, + **kwds)’ would raise an exception because of incompatible + signature, an exception of the same type and the same or similar + message is raised. For example: + + >>> 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. + + Deprecated since version 3.5: Use *note Signature.bind(): 1562. and + *note Signature.bind_partial(): 44a4. instead. + + -- Function: inspect.getclosurevars (func) + + Get the mapping of external name references in a Python function or + method 'func' to their current values. A *note named tuple: 64a. + ‘ClosureVars(nonlocals, globals, builtins, unbound)’ is returned. + 'nonlocals' maps referenced names to lexical closure variables, + 'globals' to the function’s module globals and 'builtins' to the + builtins visible from the function body. 'unbound' is the set of + names referenced in the function that could not be resolved at all + given the current module globals and builtins. + + *note TypeError: 534. is raised if 'func' is not a Python function + or method. + + Added in version 3.3. + + -- Function: inspect.unwrap (func, *, stop=None) + + Get the object wrapped by 'func'. It follows the chain of + ‘__wrapped__’ attributes returning the last object in the chain. + + 'stop' is an optional callback accepting an object in the wrapper + chain as its sole argument that allows the unwrapping to be + terminated early if the callback returns a true value. If the + callback never returns a true value, the last object in the chain + is returned as usual. For example, *note signature(): 733. uses + this to stop unwrapping if any object in the chain has a + ‘__signature__’ attribute defined. + + *note ValueError: 204. is raised if a cycle is encountered. + + Added in version 3.4. + + -- Function: inspect.get_annotations (obj, *, globals=None, + locals=None, eval_str=False) + + Compute the annotations dict for an object. + + ‘obj’ may be a callable, class, or module. Passing in an object of + any other type raises *note TypeError: 534. + + 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(): 180. This is intended for + use with stringized annotations (‘from __future__ import + annotations’). + + * 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. 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. + + * Always, always, always returns a freshly created dict. + + ‘eval_str’ controls whether or not values of type ‘str’ are + replaced with the result of calling *note eval(): 180. on those + values: + + * If eval_str is true, *note eval(): 180. is called on values of + type ‘str’. (Note that ‘get_annotations’ doesn’t catch + exceptions; if *note eval(): 180. 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(): 180.; see the + documentation for *note eval(): 180. 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__: 12c6, although if ‘obj’ is a wrapped function + (using *note functools.update_wrapper(): 101b.) it is first + unwrapped. + + Calling ‘get_annotations’ is best practice for accessing the + annotations dict of any object. See *note Annotations Best + Practices: 7d4. for more information on annotations best practices. + + Added in version 3.10. + + +File: python.info, Node: The interpreter stack, Next: Fetching attributes statically, Prev: Classes and functions<2>, Up: inspect — Inspect live objects + +5.30.14.5 The interpreter stack +............................... + +Some of the following functions return *note FrameInfo: 648. objects. +For backwards compatibility these objects allow tuple-like operations on +all attributes except ‘positions’. This behavior is considered +deprecated and may be removed in the future. + + -- Class: inspect.FrameInfo + + -- Attribute: frame + + The *note frame object: 6db. that the record corresponds to. + + -- Attribute: filename + + The file name associated with the code being executed by the + frame this record corresponds to. + + -- Attribute: lineno + + The line number of the current line associated with the code + being executed by the frame this record corresponds to. + + -- Attribute: function + + The function name that is being executed by the frame this + record corresponds to. + + -- Attribute: code_context + + A list of lines of context from the source code that’s being + executed by the frame this record corresponds to. + + -- Attribute: index + + The index of the current line being executed in the *note + code_context: 44ba. list. + + -- Attribute: positions + + A *note dis.Positions: 44bd. object containing the start line + number, end line number, start column offset, and end column + offset associated with the instruction being executed by the + frame this record corresponds to. + + Changed in version 3.5: Return a *note named tuple: 64a. instead of + a *note tuple: 36b. + + Changed in version 3.11: ‘FrameInfo’ is now a class instance (that + is backwards compatible with the previous *note named tuple: 64a.). + + -- Class: inspect.Traceback + + -- Attribute: filename + + The file name associated with the code being executed by the + frame this traceback corresponds to. + + -- Attribute: lineno + + The line number of the current line associated with the code + being executed by the frame this traceback corresponds to. + + -- Attribute: function + + The function name that is being executed by the frame this + traceback corresponds to. + + -- Attribute: code_context + + A list of lines of context from the source code that’s being + executed by the frame this traceback corresponds to. + + -- Attribute: index + + The index of the current line being executed in the *note + code_context: 44c1. list. + + -- Attribute: positions + + A *note dis.Positions: 44bd. object containing the start line + number, end line number, start column offset, and end column + offset associated with the instruction being executed by the + frame this traceback corresponds to. + + Changed in version 3.11: ‘Traceback’ is now a class instance (that + is backwards compatible with the previous *note named tuple: 64a.). + + Note: Keeping references to frame objects, as found in the first + element of the frame records these functions return, can cause your + program to create reference cycles. Once a reference cycle has + been created, the lifespan of all objects which can be accessed + from the objects which form the cycle can become much longer even + if Python’s optional cycle detector is enabled. If such cycles + must be created, it is important to ensure they are explicitly + broken to avoid the delayed destruction of objects and increased + memory consumption which occurs. + + Though the cycle detector will catch these, destruction of the + frames (and local variables) can be made deterministic by removing + the cycle in a *note finally: 9ca. clause. This is also important + if the cycle detector was disabled when Python was compiled or + using *note gc.disable(): 447e. For example: + + def handle_stackframe_without_leak(): + frame = inspect.currentframe() + try: + # do something with the frame + finally: + del frame + + If you want to keep the frame around (for example to print a + traceback later), you can also break reference cycles by using the + *note frame.clear(): 282. method. + +The optional 'context' argument supported by most of these functions +specifies the number of lines of context to return, which are centered +around the current line. + + -- Function: inspect.getframeinfo (frame, context=1) + + Get information about a frame or traceback object. A *note + Traceback: 649. object is returned. + + Changed in version 3.11: A *note Traceback: 649. object is returned + instead of a named tuple. + + -- Function: inspect.getouterframes (frame, context=1) + + Get a list of *note FrameInfo: 648. objects for a frame and all + outer frames. These frames represent the calls that lead to the + creation of 'frame'. The first entry in the returned list + represents 'frame'; the last entry represents the outermost call on + 'frame'’s stack. + + Changed in version 3.5: A list of *note named tuples: 64a. + ‘FrameInfo(frame, filename, lineno, function, code_context, index)’ + is returned. + + Changed in version 3.11: A list of *note FrameInfo: 648. objects is + returned. + + -- Function: inspect.getinnerframes (traceback, context=1) + + Get a list of *note FrameInfo: 648. objects for a traceback’s frame + and all inner frames. These frames represent calls made as a + consequence of 'frame'. The first entry in the list represents + 'traceback'; the last entry represents where the exception was + raised. + + Changed in version 3.5: A list of *note named tuples: 64a. + ‘FrameInfo(frame, filename, lineno, function, code_context, index)’ + is returned. + + Changed in version 3.11: A list of *note FrameInfo: 648. objects is + returned. + + -- Function: inspect.currentframe () + + Return the frame object for the caller’s stack frame. + + 'CPython implementation detail:' This function relies on Python + stack frame support in the interpreter, which isn’t guaranteed to + exist in all implementations of Python. If running in an + implementation without Python stack frame support this function + returns ‘None’. + + -- Function: inspect.stack (context=1) + + Return a list of *note FrameInfo: 648. objects for the caller’s + stack. The first entry in the returned list represents the caller; + the last entry represents the outermost call on the stack. + + Changed in version 3.5: A list of *note named tuples: 64a. + ‘FrameInfo(frame, filename, lineno, function, code_context, index)’ + is returned. + + Changed in version 3.11: A list of *note FrameInfo: 648. objects is + returned. + + -- Function: inspect.trace (context=1) + + Return a list of *note FrameInfo: 648. objects for the stack + between the current frame and the frame in which an exception + currently being handled was raised in. The first entry in the list + represents the caller; the last entry represents where the + exception was raised. + + Changed in version 3.5: A list of *note named tuples: 64a. + ‘FrameInfo(frame, filename, lineno, function, code_context, index)’ + is returned. + + Changed in version 3.11: A list of *note FrameInfo: 648. objects is + returned. + + +File: python.info, Node: Fetching attributes statically, Next: Current State of Generators Coroutines and Asynchronous Generators, Prev: The interpreter stack, Up: inspect — Inspect live objects + +5.30.14.6 Fetching attributes statically +........................................ + +Both *note getattr(): bd1. and *note hasattr(): 4ce. can trigger code +execution when fetching or checking for the existence of attributes. +Descriptors, like properties, will be invoked and *note __getattr__(): +4cf. and *note __getattribute__(): bd2. may be called. + +For cases where you want passive introspection, like documentation +tools, this can be inconvenient. *note getattr_static(): 490. has the +same signature as *note getattr(): bd1. but avoids executing code when +it fetches attributes. + + -- Function: inspect.getattr_static (obj, attr, default=None) + + Retrieve attributes without triggering dynamic lookup via the + descriptor protocol, *note __getattr__(): 4cf. or *note + __getattribute__(): bd2. + + 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__: 558. 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(): 490. 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: Fetching attributes statically, Up: inspect — Inspect live objects + +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(): 1229. allows the current state +of a generator to be determined easily. + + -- Function: inspect.getgeneratorstate (generator) + + Get current state of a generator-iterator. + + Possible states are: + + * GEN_CREATED: Waiting to start execution. + + * GEN_RUNNING: Currently being executed by the interpreter. + + * GEN_SUSPENDED: Currently suspended at a yield expression. + + * GEN_CLOSED: Execution has completed. + + Added in version 3.2. + + -- Function: 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: 5cd. + functions, but will accept any coroutine-like object that has + ‘cr_running’ and ‘cr_frame’ attributes. + + Possible states are: + + * CORO_CREATED: Waiting to start execution. + + * CORO_RUNNING: Currently being executed by the interpreter. + + * CORO_SUSPENDED: Currently suspended at an await expression. + + * CORO_CLOSED: Execution has completed. + + Added in version 3.5. + + -- Function: 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: 5cd. functions which use the *note + yield: 9cd. statement, but will accept any asynchronous + generator-like object that has ‘ag_running’ and ‘ag_frame’ + attributes. + + Possible states are: + + * 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. + +The current internal state of the generator can also be queried. This +is mostly useful for testing purposes, to ensure that internal state is +being updated as expected: + + -- Function: 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(): + 141. in the body of the generator, and all the same caveats apply. + + If 'generator' is a *note generator: 105a. with no currently + associated frame, then an empty dictionary is returned. *note + TypeError: 534. is raised if 'generator' is not a Python generator + object. + + 'CPython implementation detail:' 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. + + -- Function: inspect.getcoroutinelocals (coroutine) + + This function is analogous to *note getgeneratorlocals(): 10cc, but + works for coroutine objects created by *note async def: 5cd. + functions. + + Added in version 3.5. + + -- Function: inspect.getasyncgenlocals (agen) + + This function is analogous to *note getgeneratorlocals(): 10cc, but + works for asynchronous generator objects created by *note async + def: 5cd. functions which use the *note yield: 9cd. 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 — Inspect live objects + +5.30.14.8 Code Objects Bit Flags +................................ + +Python code objects have a *note co_flags: 1f44. attribute, which is a +bitmap of the following flags: + + -- Data: inspect.CO_OPTIMIZED + + The code object is optimized, using fast locals. + + -- Data: inspect.CO_NEWLOCALS + + If set, a new dict will be created for the frame’s *note f_locals: + 182. when the code object is executed. + + -- Data: inspect.CO_VARARGS + + The code object has a variable positional parameter (‘*args’-like). + + -- Data: inspect.CO_VARKEYWORDS + + The code object has a variable keyword parameter (‘**kwargs’-like). + + -- Data: inspect.CO_NESTED + + The flag is set when the code object is a nested function. + + -- Data: 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. + + -- Data: 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. + + -- Data: 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. + + -- Data: 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. + + Note: 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 + *note inspect: 7e. 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: Command Line Interface<3>, Prev: Code Objects Bit Flags, Up: inspect — Inspect live objects + +5.30.14.9 Buffer flags +...................... + + -- Class: inspect.BufferFlags + + This is an *note enum.IntFlag: 22fa. that represents the flags that + can be passed to the *note __buffer__(): 45a. method of objects + implementing the *note buffer protocol: 393. + + The meaning of the flags is explained at *note Buffer request + types: 44d1. + + -- Attribute: SIMPLE + + -- Attribute: WRITABLE + + -- Attribute: FORMAT + + -- Attribute: ND + + -- Attribute: STRIDES + + -- Attribute: C_CONTIGUOUS + + -- Attribute: F_CONTIGUOUS + + -- Attribute: ANY_CONTIGUOUS + + -- Attribute: INDIRECT + + -- Attribute: CONTIG + + -- Attribute: CONTIG_RO + + -- Attribute: STRIDED + + -- Attribute: STRIDED_RO + + -- Attribute: RECORDS + + -- Attribute: RECORDS_RO + + -- Attribute: FULL + + -- Attribute: FULL_RO + + -- Attribute: READ + + -- Attribute: WRITE + + Added in version 3.12. + + +File: python.info, Node: Command Line Interface<3>, Prev: Buffer flags, Up: inspect — Inspect live objects + +5.30.14.10 Command Line Interface +................................. + +The *note inspect: 7e. module also provides a basic introspection +capability from the command line. + +By default, accepts the name of a module and prints the source of that +module. A class or function within the module can be printed instead by +appended a colon and the qualified name of the target object. + + -- Option: --details + + Print information about the specified object rather than the source + code + + +File: python.info, Node: site — Site-specific configuration hook, Prev: inspect — Inspect live objects, Up: Python Runtime Services + +5.30.15 ‘site’ — Site-specific configuration hook +------------------------------------------------- + +'Source code:' Lib/site.py(1) + +__________________________________________________________________ + +'This module is automatically imported during initialization.' The +automatic import can be suppressed using the interpreter’s *note -S: +119b. option. + +Importing this module normally appends site-specific paths to the module +search path and adds *note callables: 2187, including *note help(): 8d6. +to the built-in namespace. However, Python startup option *note -S: +119b. 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(): 1d36. function. + +Changed in version 3.3: Importing the module used to trigger paths +manipulation even when using *note -S: 119b. + +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 threading: 1522. build, and is +appended if ‘"t"’ is present in the *note sys.abiflags: a63. 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. + +Changed in version 3.5: Support for the “site-python” directory has been +removed. + +Changed in version 3.13: On Unix, *note Free threading: 1522. Python +installations are identified by the “t” suffix in the version-specific +directory name, such as ‘lib/python3.13t/’. + +If a file named “pyvenv.cfg” exists one directory above sys.executable, +sys.prefix and sys.exec_prefix are set to that directory and it is also +checked for site-packages (sys.base_prefix and sys.base_exec_prefix will +always be the “real” prefixes of the Python installation). If +“pyvenv.cfg” (a bootstrap configuration file) contains the key +“include-system-site-packages” set to anything other than “true” +(case-insensitive), the system-level prefixes will not be searched for +site-packages; otherwise they will. + +A path configuration file is a file whose name has the form ‘`name'.pth’ +and exists in one of the four directories mentioned above; its contents +are additional items (one per line) to be added to ‘sys.path’. +Non-existing items are never added to ‘sys.path’, and no check is made +that the item refers to a directory rather than a file. No item is +added to ‘sys.path’ more than once. Blank lines and lines beginning +with ‘#’ are skipped. Lines starting with ‘import’ (followed by space +or tab) are executed. + + Note: An executable line in a ‘.pth’ file is run at every Python + startup, regardless of whether a particular module is actually + going to be used. Its impact should thus be kept to a minimum. + The primary intended purpose of executable lines is to make the + corresponding module(s) importable (load 3rd-party import hooks, + adjust ‘PATH’ etc). Any other initialization is supposed to be + done upon a module’s actual import, if and when it happens. + Limiting a code chunk to a single line is a deliberate measure to + discourage putting anything more complex here. + +Changed in version 3.13: The ‘.pth’ files are now decoded by UTF-8 at +first and then by the *note locale encoding: 244. if it fails. + +For example, suppose ‘sys.prefix’ and ‘sys.exec_prefix’ are set to +‘/usr/local’. The Python X.Y library is then installed in +‘/usr/local/lib/python`X.Y'’. Suppose this has a subdirectory +‘/usr/local/lib/python`X.Y'/site-packages’ with three subsubdirectories, +‘foo’, ‘bar’ and ‘spam’, and two path configuration files, ‘foo.pth’ and +‘bar.pth’. Assume ‘foo.pth’ contains the following: + + # foo package configuration + + foo + bar + bletch + +and ‘bar.pth’ contains: + + # bar package configuration + + bar + +Then the following version-specific directories are added to ‘sys.path’, +in this order: + + /usr/local/lib/pythonX.Y/site-packages/bar + /usr/local/lib/pythonX.Y/site-packages/foo + +Note that ‘bletch’ is omitted because it doesn’t exist; the ‘bar’ +directory precedes the ‘foo’ directory because ‘bar.pth’ comes +alphabetically before ‘foo.pth’; and ‘spam’ is omitted because it is not +mentioned in either path configuration file. + +* Menu: + +* sitecustomize:: +* usercustomize:: +* Readline configuration:: +* Module contents: Module contents<5>. +* Command Line Interface: Command Line Interface<4>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/site.py + + +File: python.info, Node: sitecustomize, Next: usercustomize, Up: site — Site-specific configuration hook + +5.30.15.1 ‘sitecustomize’ +......................... + +After these path manipulations, an attempt is made to import a module +named *note sitecustomize: c8, 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: 415. or its subclass exception, and the exception’s *note +name: 2288. attribute equals to ‘'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 *note sitecustomize: c8. is ignored. Any other +exception causes a silent and perhaps mysterious failure of the process. + + +File: python.info, Node: usercustomize, Next: Readline configuration, Prev: sitecustomize, Up: site — Site-specific configuration hook + +5.30.15.2 ‘usercustomize’ +......................... + +After this, an attempt is made to import a module named *note +usercustomize: 10e, which can perform arbitrary user-specific +customizations, if *note ENABLE_USER_SITE: 44e9. 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: 1377. If this +import fails with an *note ImportError: 415. or its subclass exception, +and the exception’s *note name: 2288. attribute equals to +‘'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: c8. and *note usercustomize: 10e. is still +attempted. + + +File: python.info, Node: Readline configuration, Next: Module contents<5>, Prev: usercustomize, Up: site — Site-specific configuration hook + +5.30.15.3 Readline configuration +................................ + +On systems that support *note readline: ba, this module will also import +and configure the *note rlcompleter: bd. module, if Python is started in +*note interactive mode: fc1. and without the *note -S: 119b. option. +The default behavior is enable tab-completion and to use +‘~/.python_history’ as the history save file. To disable it, delete (or +override) the *note sys.__interactivehook__: fc2. attribute in your +*note sitecustomize: c8. or *note usercustomize: 10e. module or your +*note PYTHONSTARTUP: fc3. file. + +Changed in version 3.4: Activation of rlcompleter and history was made +automatic. + + +File: python.info, Node: Module contents<5>, Next: Command Line Interface<4>, Prev: Readline configuration, Up: site — Site-specific configuration hook + +5.30.15.4 Module contents +......................... + + -- Data: site.PREFIXES + + A list of prefixes for site-packages directories. + + -- Data: site.ENABLE_USER_SITE + + Flag showing the status of the user site-packages directory. + ‘True’ means that it is enabled and was added to ‘sys.path’. + ‘False’ means that it was disabled by user request (with *note -s: + 1377. or *note PYTHONNOUSERSITE: 1378.). ‘None’ means it was + disabled for security reasons (mismatch between user or group id + and effective id) or by an administrator. + + -- Data: site.USER_SITE + + Path to the user site-packages for the running Python. Can be + ‘None’ if *note getusersitepackages(): 1233. 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. + + -- Data: site.USER_BASE + + Path to the base directory for the user site-packages. Can be + ‘None’ if *note getuserbase(): 1232. hasn’t been called yet. + Default value is ‘~/.local’ for UNIX and macOS non-framework + builds, ‘~/Library/Python/`X.Y'’ for macOS framework builds, and + ‘`%APPDATA%'\Python’ for Windows. This value is used to compute + the installation directories for scripts, data files, Python + modules, etc. for the *note user installation scheme: 1d47. See + also *note PYTHONUSERBASE: 1376. + + -- Function: site.main () + + Adds all the standard site-specific directories to the module + search path. This function is called automatically when this + module is imported, unless the Python interpreter was started with + the *note -S: 119b. flag. + + Changed in version 3.3: This function used to be called + unconditionally. + + -- Function: site.addsitedir (sitedir, known_paths=None) + + Add a directory to sys.path and process its ‘.pth’ files. + Typically used in *note sitecustomize: c8. or *note usercustomize: + 10e. (see above). + + -- Function: site.getsitepackages () + + Return a list containing all global site-packages directories. + + Added in version 3.2. + + -- Function: site.getuserbase () + + Return the path of the user base directory, *note USER_BASE: 130f. + If it is not initialized yet, this function will also set it, + respecting *note PYTHONUSERBASE: 1376. + + Added in version 3.2. + + -- Function: site.getusersitepackages () + + Return the path of the user-specific site-packages directory, *note + USER_SITE: 1d35. If it is not initialized yet, this function will + also set it, respecting *note USER_BASE: 130f. To determine if the + user-specific site-packages was added to ‘sys.path’ *note + ENABLE_USER_SITE: 44e9. should be used. + + Added in version 3.2. + + +File: python.info, Node: Command Line Interface<4>, Prev: Module contents<5>, Up: site — Site-specific configuration hook + +5.30.15.5 Command Line Interface +................................ + +The *note site: c7. 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 + +If it is called without arguments, it will print the contents of *note +sys.path: 3b0. on the standard output, followed by the value of *note +USER_BASE: 130f. and whether the directory exists, then the same thing +for *note USER_SITE: 1d35, and finally the value of *note +ENABLE_USER_SITE: 44e9. + + -- Option: --user-base + + Print the path to the user base directory. + + -- Option: --user-site + + Print the path to the user site-packages directory. + +If both options are given, user base and user site will be printed +(always in this order), separated by *note os.pathsep: 1d44. + +If any option is given, the script will exit with one of these values: +‘0’ if the user site-packages directory is enabled, ‘1’ if it was +disabled by the user, ‘2’ if it is disabled for security reasons or by +an administrator, and a value greater than 2 if there is an error. + +See also +........ + + * PEP 370(1) – Per user site-packages directory + + * *note The initialization of the sys.path module search path: 1c60. + – The initialization of *note sys.path: 3b0. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0370/ + + +File: python.info, Node: Custom Python Interpreters, Next: Importing Modules, Prev: Python Runtime Services, Up: The Python Standard Library + +5.31 Custom Python Interpreters +=============================== + +The modules described in this chapter allow writing interfaces similar +to Python’s interactive interpreter. If you want a Python interpreter +that supports some special feature in addition to the Python language, +you should look at the *note code: 1a. module. (The *note codeop: 1c. +module is lower-level, used to support compiling a possibly incomplete +chunk of Python code.) + +The full list of modules described in this chapter is: + +* Menu: + +* code — Interpreter base classes:: +* codeop — Compile Python code:: + + +File: python.info, Node: code — Interpreter base classes, Next: codeop — Compile Python code, Up: Custom Python Interpreters + +5.31.1 ‘code’ — Interpreter base classes +---------------------------------------- + +'Source code:' Lib/code.py(1) + +__________________________________________________________________ + +The ‘code’ module provides facilities to implement read-eval-print loops +in Python. Two classes and convenience functions are included which can +be used to build applications which provide an interactive interpreter +prompt. + + -- Class: code.InteractiveInterpreter (locals=None) + + This class deals with parsing and interpreter state (the user’s + namespace); it does not deal with input buffering or prompting or + input file naming (the filename is always passed in explicitly). + The optional 'locals' argument specifies a mapping to use as the + namespace in which code will be executed; it defaults to a newly + created dictionary with key ‘'__name__'’ set to ‘'__console__'’ and + key ‘'__doc__'’ set to ‘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. + + -- Class: code.InteractiveConsole (locals=None, filename='<console>', + local_exit=False) + + Closely emulate the behavior of the interactive Python interpreter. + This class builds on *note InteractiveInterpreter: 15da. and adds + prompting using the familiar ‘sys.ps1’ and ‘sys.ps2’, and input + buffering. If 'local_exit' is true, ‘exit()’ and ‘quit()’ in the + console will not raise *note SystemExit: d40, but instead return to + the calling code. + + Changed in version 3.13: Added 'local_exit' parameter. + + -- Function: code.interact (banner=None, readfunc=None, local=None, + exitmsg=None, local_exit=False) + + Convenience function to run a read-eval-print loop. This creates a + new instance of *note InteractiveConsole: 239c. and sets 'readfunc' + to be used as the *note InteractiveConsole.raw_input(): 44f6. + method, if provided. If 'local' is provided, it is passed to the + *note InteractiveConsole: 239c. constructor for use as the default + namespace for the interpreter loop. If 'local_exit' is provided, + it is passed to the *note InteractiveConsole: 239c. constructor. + The *note interact(): 44f7. method of the instance is then run with + 'banner' and 'exitmsg' passed as the banner and exit message to + use, if provided. The console object is discarded after use. + + Changed in version 3.6: Added 'exitmsg' parameter. + + Changed in version 3.13: Added 'local_exit' parameter. + + -- Function: code.compile_command (source, filename='<input>', + symbol='single') + + This function is useful for programs that want to emulate Python’s + interpreter main loop (a.k.a. the read-eval-print loop). The + tricky part is to determine when the user has entered an incomplete + command that can be completed by entering more text (as opposed to + a complete command or a syntax error). This function 'almost' + always makes the same decision as the real interpreter main loop. + + 'source' is the source string; 'filename' is the optional filename + from which source was read, defaulting to ‘'<input>'’; and 'symbol' + is the optional grammar start symbol, which should be ‘'single'’ + (the default), ‘'eval'’ or ‘'exec'’. + + Returns a code object (the same as ‘compile(source, filename, + symbol)’) if the command is complete and valid; ‘None’ if the + command is incomplete; raises *note SyntaxError: 18d. if the + command is complete and contains a syntax error, or raises *note + OverflowError: 87f. or *note ValueError: 204. if the command + contains an invalid literal. + +* Menu: + +* Interactive Interpreter Objects:: +* Interactive Console Objects:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/code.py + + +File: python.info, Node: Interactive Interpreter Objects, Next: Interactive Console Objects, Up: code — Interpreter base classes + +5.31.1.1 Interactive Interpreter Objects +........................................ + + -- Method: InteractiveInterpreter.runsource (source, + filename='<input>', symbol='single') + + Compile and run some source in the interpreter. Arguments are the + same as for *note compile_command(): 44f8.; the default for + 'filename' is ‘'<input>'’, and for 'symbol' is ‘'single'’. One of + several things can happen: + + * The input is incorrect; *note compile_command(): 44f8. raised + an exception (*note SyntaxError: 18d. or *note OverflowError: + 87f.). A syntax traceback will be printed by calling the + *note showsyntaxerror(): 44fc. method. *note runsource(): + 44fb. returns ‘False’. + + * The input is incomplete, and more input is required; *note + compile_command(): 44f8. returned ‘None’. *note runsource(): + 44fb. returns ‘True’. + + * The input is complete; *note compile_command(): 44f8. returned + a code object. The code is executed by calling the *note + runcode(): 44fd. (which also handles run-time exceptions, + except for *note SystemExit: d40.). *note runsource(): 44fb. + returns ‘False’. + + The return value can be used to decide whether to use ‘sys.ps1’ or + ‘sys.ps2’ to prompt the next line. + + -- Method: InteractiveInterpreter.runcode (code) + + Execute a code object. When an exception occurs, *note + showtraceback(): dcf. is called to display a traceback. All + exceptions are caught except *note SystemExit: d40, which is + allowed to propagate. + + A note about *note KeyboardInterrupt: 9d1.: this exception may + occur elsewhere in this code, and may not always be caught. The + caller should be prepared to deal with it. + + -- Method: InteractiveInterpreter.showsyntaxerror (filename=None) + + Display the syntax error that just occurred. This does not display + a stack trace because there isn’t one for syntax errors. If + 'filename' is given, it is stuffed into the exception instead of + the default filename provided by Python’s parser, because it always + uses ‘'<string>'’ when reading from a string. The output is + written by the *note write(): 44fe. method. + + -- Method: InteractiveInterpreter.showtraceback () + + Display the exception that just occurred. We remove the first + stack item because it is within the interpreter object + implementation. The output is written by the *note write(): 44fe. + method. + + Changed in version 3.5: The full chained traceback is displayed + instead of just the primary traceback. + + -- Method: InteractiveInterpreter.write (data) + + Write a string to the standard error stream (‘sys.stderr’). + Derived classes should override this to provide the appropriate + output handling as needed. + + +File: python.info, Node: Interactive Console Objects, Prev: Interactive Interpreter Objects, Up: code — Interpreter base classes + +5.31.1.2 Interactive Console Objects +.................................... + +The *note InteractiveConsole: 239c. class is a subclass of *note +InteractiveInterpreter: 15da, and so offers all the methods of the +interpreter objects as well as the following additions. + + -- Method: InteractiveConsole.interact (banner=None, exitmsg=None) + + Closely emulate the interactive Python console. The optional + 'banner' argument specify the banner to print before the first + interaction; by default it prints a banner similar to the one + printed by the standard Python interpreter, followed by the class + name of the console object in parentheses (so as not to confuse + this with the real interpreter – since it’s so close!). + + The optional 'exitmsg' argument specifies an exit message printed + when exiting. Pass the empty string to suppress the exit message. + If 'exitmsg' is not given or ‘None’, a default message is printed. + + Changed in version 3.4: To suppress printing any banner, pass an + empty string. + + Changed in version 3.6: Print an exit message when exiting. + + -- Method: InteractiveConsole.push (line) + + Push a line of source text to the interpreter. The line should not + have a trailing newline; it may have internal newlines. The line + is appended to a buffer and the interpreter’s *note runsource(): + 44fb. method is called with the concatenated contents of the buffer + as source. If this indicates that the command was executed or + invalid, the buffer is reset; otherwise, the command is incomplete, + and the buffer is left as it was after the line was appended. The + return value is ‘True’ if more input is required, ‘False’ if the + line was dealt with in some way (this is the same as + ‘runsource()’). + + -- Method: InteractiveConsole.resetbuffer () + + Remove any unhandled source text from the input buffer. + + -- Method: InteractiveConsole.raw_input (prompt='') + + Write a prompt and read a line. The returned line does not include + the trailing newline. When the user enters the EOF key sequence, + *note EOFError: 12cc. is raised. The base implementation reads + from ‘sys.stdin’; a subclass may replace this with a different + implementation. + + +File: python.info, Node: codeop — Compile Python code, Prev: code — Interpreter base classes, Up: Custom Python Interpreters + +5.31.2 ‘codeop’ — Compile Python code +------------------------------------- + +'Source code:' Lib/codeop.py(1) + +__________________________________________________________________ + +The *note codeop: 1c. module provides utilities upon which the Python +read-eval-print loop can be emulated, as is done in the *note code: 1a. +module. As a result, you probably don’t want to use the module +directly; if you want to include such a loop in your program you +probably want to use the *note code: 1a. module instead. + +There are two parts to this job: + + 1. Being able to tell if a line of input completes a Python statement: + in short, telling whether to print ‘‘>>>’’ or ‘‘...’’ next. + + 2. Remembering which future statements the user has entered, so + subsequent input can be compiled with these in effect. + +The *note codeop: 1c. module provides a way of doing each of these +things, and a way of doing them both. + +To do just the former: + + -- Function: codeop.compile_command (source, filename='<input>', + symbol='single') + + Tries to compile 'source', which should be a string of Python code + and return a code object if 'source' is valid Python code. In that + case, the filename attribute of the code object will be 'filename', + which defaults to ‘'<input>'’. Returns ‘None’ if 'source' is 'not' + valid Python code, but is a prefix of valid Python code. + + If there is a problem with 'source', an exception will be raised. + *note SyntaxError: 18d. is raised if there is invalid Python + syntax, and *note OverflowError: 87f. or *note ValueError: 204. if + there is an invalid literal. + + The 'symbol' argument determines whether 'source' is compiled as a + statement (‘'single'’, the default), as a sequence of *note + statement: 278b. (‘'exec'’) or as an *note expression: 1f85. + (‘'eval'’). Any other value will cause *note ValueError: 204. to + be raised. + + Note: It is possible (but not likely) that the parser stops + parsing with a successful outcome before reaching the end of + the source; in this case, trailing symbols may be ignored + instead of causing an error. For example, a backslash + followed by two newlines may be followed by arbitrary garbage. + This will be fixed once the API for the parser is better. + + -- Class: codeop.Compile + + Instances of this class have *note __call__(): 555. methods + identical in signature to the built-in function *note compile(): + 192, but with the difference that if the instance compiles program + text containing a *note __future__: 0. statement, the instance + ‘remembers’ and compiles all subsequent program texts with the + statement in force. + + -- Class: codeop.CommandCompiler + + Instances of this class have *note __call__(): 555. methods + identical in signature to *note compile_command(): 17c8.; the + difference is that if the instance compiles program text containing + a *note __future__: 0. statement, the instance ‘remembers’ and + compiles all subsequent program texts with the statement in force. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/codeop.py + + +File: python.info, Node: Importing Modules, Next: Python Language Services, Prev: Custom Python Interpreters, Up: The Python Standard Library + +5.32 Importing Modules +====================== + +The modules described in this chapter provide new ways to import other +Python modules and hooks for customizing the import process. + +The full list of modules described in this chapter is: + +* Menu: + +* zipimport — Import modules from Zip archives:: +* pkgutil — Package extension utility:: +* modulefinder — Find modules used by a script:: +* runpy — Locating and executing Python modules:: +* importlib — The implementation of import:: +* importlib.resources – Package resource reading, opening and access: importlib resources – Package resource reading opening and access. +* importlib.resources.abc – Abstract base classes for resources: importlib resources abc – Abstract base classes for resources. +* importlib.metadata – Accessing package metadata: importlib metadata – Accessing package metadata. +* The initialization of the sys.path module search path: The initialization of the sys path module search path. + + +File: python.info, Node: zipimport — Import modules from Zip archives, Next: pkgutil — Package extension utility, Up: Importing Modules + +5.32.1 ‘zipimport’ — Import modules from Zip archives +----------------------------------------------------- + +'Source code:' 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 *note zipimport: 132. module explicitly; it is automatically used by +the built-in *note import: 5de. mechanism for *note sys.path: 3b0. items +that are paths to ZIP archives. + +Typically, *note sys.path: 3b0. is a list of directory names as strings. +This module also allows an item of *note sys.path: 3b0. to be a string +naming a ZIP file archive. The ZIP archive can contain a subdirectory +structure to support package imports, and a path within the archive can +be specified to only import from a subdirectory. For example, the path +‘example.zip/lib/’ would only import from the ‘lib/’ subdirectory within +the archive. + +Any files may be present in the ZIP archive, but importers are only +invoked for ‘.py’ and ‘.pyc’ files. ZIP import of dynamic modules +(‘.pyd’, ‘.so’) is disallowed. Note that if an archive only contains +‘.py’ files, Python will not attempt to modify the archive by adding the +corresponding ‘.pyc’ file, meaning that if a ZIP archive doesn’t contain +‘.pyc’ files, importing may be rather slow. + +Changed in version 3.13: ZIP64 is supported + +Changed in version 3.8: Previously, ZIP archives with an archive comment +were not supported. + +See also +........ + +PKZIP Application Note(2) + + Documentation on the ZIP file format by Phil Katz, the creator of + the format and algorithms used. + +PEP 273(3) - Import Modules from Zip Archives + + Written by James C. Ahlstrom, who also provided an implementation. + Python 2.3 follows the specification in PEP 273(4), but uses an + implementation written by Just van Rossum that uses the import + hooks described in PEP 302(5). + +*note importlib: 77. - The implementation of the import machinery + + Package providing the relevant protocols for all importers to + implement. + +This module defines an exception: + + -- Exception: zipimport.ZipImportError + + Exception raised by zipimporter objects. It’s a subclass of *note + ImportError: 415, so it can be caught as *note ImportError: 415, + too. + +* Menu: + +* zipimporter Objects:: +* Examples: Examples<33>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 Objects, Next: Examples<33>, Up: zipimport — Import modules from Zip archives + +5.32.1.1 zipimporter Objects +............................ + +*note zipimporter: 450f. is the class for importing ZIP files. + + -- Class: zipimport.zipimporter (archivepath) + + Create a new zipimporter instance. 'archivepath' must be a path to + a ZIP file, or to a specific path within a ZIP file. For example, + an 'archivepath' of ‘foo/bar.zip/lib’ will look for modules in the + ‘lib’ directory inside the ZIP file ‘foo/bar.zip’ (provided that it + exists). + + *note ZipImportError: 450c. is raised if 'archivepath' doesn’t + point to a valid ZIP archive. + + Changed in version 3.12: Methods ‘find_loader()’ and + ‘find_module()’, deprecated in 3.10 are now removed. Use *note + find_spec(): 85a. instead. + + -- Method: create_module (spec) + + Implementation of *note importlib.abc.Loader.create_module(): + cae. that returns *note None: 671. to explicitly request the + default semantics. + + Added in version 3.10. + + -- Method: exec_module (module) + + Implementation of *note importlib.abc.Loader.exec_module(): + 867. + + Added in version 3.10. + + -- Method: find_spec (fullname, target=None) + + An implementation of *note + importlib.abc.PathEntryFinder.find_spec(): 869. + + Added in version 3.10. + + -- Method: get_code (fullname) + + Return the code object for the specified module. Raise *note + ZipImportError: 450c. if the module couldn’t be imported. + + -- Method: get_data (pathname) + + Return the data associated with 'pathname'. Raise *note + OSError: 413. if the file wasn’t found. + + Changed in version 3.3: *note IOError: 104b. used to be + raised, it is now an alias of *note OSError: 413. + + -- Method: get_filename (fullname) + + Return the value ‘__file__’ would be set to if the specified + module was imported. Raise *note ZipImportError: 450c. if the + module couldn’t be imported. + + Added in version 3.1. + + -- Method: get_source (fullname) + + Return the source code for the specified module. Raise *note + ZipImportError: 450c. if the module couldn’t be found, return + *note None: 671. if the archive does contain the module, but + has no source for it. + + -- Method: is_package (fullname) + + Return ‘True’ if the module specified by 'fullname' is a + package. Raise *note ZipImportError: 450c. if the module + couldn’t be found. + + -- Method: load_module (fullname) + + Load the module specified by 'fullname'. 'fullname' must be + the fully qualified (dotted) module name. Returns the + imported module on success, raises *note ZipImportError: 450c. + on failure. + + Deprecated since version 3.10: Use *note exec_module(): 30c. + instead. + + -- Method: invalidate_caches () + + Clear out the internal cache of information about files found + within the ZIP archive. + + Added in version 3.10. + + -- Attribute: archive + + The file name of the importer’s associated ZIP file, without a + possible subpath. + + -- Attribute: prefix + + The subpath within the ZIP file where modules are searched. + This is the empty string for zipimporter objects which point + to the root of the ZIP file. + + The *note archive: 4515. and *note prefix: 4516. attributes, when + combined with a slash, equal the original 'archivepath' argument + given to the *note zipimporter: 450f. constructor. + + +File: python.info, Node: Examples<33>, Prev: zipimporter Objects, Up: zipimport — Import modules from Zip archives + +5.32.1.2 Examples +................. + +Here is an example that imports a module from a ZIP archive - note that +the *note zipimport: 132. module is not explicitly used. + + $ unzip -l example.zip + Archive: example.zip + Length Date Time Name + -------- ---- ---- ---- + 8467 11-26-02 22:30 jwzthreading.py + -------- ------- + 8467 1 file + $ ./python + Python 2.3 (#1, Aug 1 2003, 19:54:32) + >>> import sys + >>> sys.path.insert(0, 'example.zip') # Add .zip file to front of path + >>> import jwzthreading + >>> jwzthreading.__file__ + 'example.zip/jwzthreading.py' + + +File: python.info, Node: pkgutil — Package extension utility, Next: modulefinder — Find modules used by a script, Prev: zipimport — Import modules from Zip archives, Up: Importing Modules + +5.32.2 ‘pkgutil’ — Package extension utility +-------------------------------------------- + +'Source code:' Lib/pkgutil.py(1) + +__________________________________________________________________ + +This module provides utilities for the import system, in particular +package support. + + -- Class: pkgutil.ModuleInfo (module_finder, name, ispkg) + + A namedtuple that holds a brief summary of a module’s info. + + Added in version 3.6. + + -- Function: pkgutil.extend_path (path, name) + + Extend the search path for the modules which comprise a package. + Intended use is to place the following code in a package’s + ‘__init__.py’: + + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) + + For each directory on *note sys.path: 3b0. that has a subdirectory + that matches the package name, add the subdirectory to the + package’s *note __path__: 1c6e. 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: c7. 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). + + If the input path is not a list (as is the case for frozen + packages) it is returned unchanged. The input path is not + modified; an extended copy is returned. Items are only appended to + the copy at the end. + + It is assumed that *note sys.path: 3b0. is a sequence. Items of + *note sys.path: 3b0. that are not strings referring to existing + directories are ignored. Unicode items on *note sys.path: 3b0. + that cause errors when used as filenames may cause this function to + raise an exception (in line with *note os.path.isdir(): a0f. + behavior). + + -- Function: pkgutil.find_loader (fullname) + + Retrieve a module *note loader: 16b0. for the given 'fullname'. + + This is a backwards compatibility wrapper around *note + importlib.util.find_spec(): 2d0. that converts most failures to + *note ImportError: 415. and only returns the loader rather than the + full *note importlib.machinery.ModuleSpec: 1e64. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(2) import emulation. + + Changed in version 3.4: Updated to be based on PEP 451(3) + + Deprecated since version 3.12, will be removed in version 3.14: Use + *note importlib.util.find_spec(): 2d0. instead. + + -- Function: pkgutil.get_importer (path_item) + + Retrieve a *note finder: 1f1e. for the given 'path_item'. + + The returned finder is cached in *note sys.path_importer_cache: + 5e0. if it was newly created by a path hook. + + The cache (or part of it) can be cleared manually if a rescan of + *note sys.path_hooks: 101d. is necessary. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(4) import emulation. + + -- Function: pkgutil.get_loader (module_or_name) + + Get a *note loader: 16b0. object for 'module_or_name'. + + If the module or package is accessible via the normal import + mechanism, a wrapper around the relevant part of that machinery is + returned. Returns ‘None’ if the module cannot be found or + imported. If the named module is not already imported, its + containing package (if any) is imported, in order to establish the + package ‘__path__’. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(5) import emulation. + + Changed in version 3.4: Updated to be based on PEP 451(6) + + Deprecated since version 3.12, will be removed in version 3.14: Use + *note importlib.util.find_spec(): 2d0. instead. + + -- Function: pkgutil.iter_importers (fullname='') + + Yield *note finder: 1f1e. 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: d2b. and + *note sys.path_hooks: 101d.). + + If the named module is in a package, that package is imported as a + side effect of invoking this function. + + If no module name is specified, all top level finders are produced. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(7) import emulation. + + -- Function: pkgutil.iter_modules (path=None, prefix='') + + Yields *note ModuleInfo: d4b. for all submodules on 'path', or, if + 'path' is ‘None’, all top-level modules on *note sys.path: 3b0. + + 'path' should be either ‘None’ or a list of paths to look for + modules in. + + 'prefix' is a string to output on the front of every module name on + output. + + Note: Only works for a *note finder: 1f1e. which defines an + ‘iter_modules()’ method. This interface is non-standard, so + the module also provides implementations for *note + importlib.machinery.FileFinder: 106b. and *note + zipimport.zipimporter: 450f. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(8) import emulation. + + -- Function: pkgutil.walk_packages (path=None, prefix='', onerror=None) + + Yields *note ModuleInfo: d4b. for all modules recursively on + 'path', or, if 'path' is ‘None’, all accessible modules. + + 'path' should be either ‘None’ or a list of paths to look for + modules in. + + 'prefix' is a string to output on the front of every module name on + output. + + Note that this function must import all 'packages' ('not' all + modules!) on the given 'path', in order to access the ‘__path__’ + attribute to find submodules. + + 'onerror' is a function which gets called with one argument (the + name of the package which was being imported) if any exception + occurs while trying to import a package. If no 'onerror' function + is supplied, *note ImportError: 415.s are caught and ignored, while + all other exceptions are propagated, terminating the search. + + Examples: + + # list all modules python can access + walk_packages() + + # list all submodules of ctypes + walk_packages(ctypes.__path__, ctypes.__name__ + '.') + + Note: Only works for a *note finder: 1f1e. which defines an + ‘iter_modules()’ method. This interface is non-standard, so + the module also provides implementations for *note + importlib.machinery.FileFinder: 106b. and *note + zipimport.zipimporter: 450f. + + Changed in version 3.3: Updated to be based directly on *note + importlib: 77. rather than relying on the package internal PEP + 302(9) import emulation. + + -- Function: pkgutil.get_data (package, resource) + + Get a resource from a package. + + This is a wrapper for the *note loader: 16b0. *note get_data: 451d. + 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. The parent directory name ‘..’ is not allowed, and nor + is a rooted name (starting with a ‘/’). + + The function returns a binary string that is the contents of the + specified resource. + + For packages located in the filesystem, which have already been + imported, this is the rough equivalent of: + + d = os.path.dirname(sys.modules[package].__file__) + data = open(os.path.join(d, resource), 'rb').read() + + If the package cannot be located or loaded, or it uses a *note + loader: 16b0. which does not support *note get_data: 451d, then + ‘None’ is returned. In particular, the *note loader: 16b0. for + *note namespace packages: 1c68. does not support *note get_data: + 451d. + + -- Function: pkgutil.resolve_name (name) + + Resolve a name to an object. + + This functionality is used in numerous places in the standard + library (see bpo-12915(10)) - and equivalent functionality is also + in widely used third-party packages such as setuptools, Django and + Pyramid. + + It is expected that 'name' will be a string in one of the following + formats, where W is shorthand for a valid Python identifier and dot + stands for a literal period in these pseudo-regexes: + + * ‘W(.W)*’ + + * ‘W(.W)*:(W(.W)*)?’ + + The first form is intended for backward compatibility only. It + assumes that some part of the dotted name is a package, and the + rest is an object somewhere within that package, possibly nested + inside other objects. Because the place where the package stops + and the object hierarchy starts can’t be inferred by inspection, + repeated attempts to import must be done with this form. + + In the second form, the caller makes the division point clear + through the provision of a single colon: the dotted name to the + left of the colon is a package to be imported, and the dotted name + to the right is the object hierarchy within that package. Only one + import is needed in this form. If it ends with the colon, then a + module object is returned. + + The function will return an object (which might be a module), or + raise one of the following exceptions: + + *note ValueError: 204. – if 'name' isn’t in a recognised format. + + *note ImportError: 415. – if an import failed when it shouldn’t + have. + + *note AttributeError: 348. – If a failure occurred when traversing + the object hierarchy within the imported package to get to the + desired object. + + Added in version 3.9. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pkgutil.py + + (2) https://peps.python.org/pep-0302/ + + (3) https://peps.python.org/pep-0451/ + + (4) https://peps.python.org/pep-0302/ + + (5) https://peps.python.org/pep-0302/ + + (6) https://peps.python.org/pep-0451/ + + (7) https://peps.python.org/pep-0302/ + + (8) https://peps.python.org/pep-0302/ + + (9) https://peps.python.org/pep-0302/ + + (10) https://bugs.python.org/issue?@action=redirect&bpo=12915 + + +File: python.info, Node: modulefinder — Find modules used by a script, Next: runpy — Locating and executing Python modules, Prev: pkgutil — Package extension utility, Up: Importing Modules + +5.32.3 ‘modulefinder’ — Find modules used by a script +----------------------------------------------------- + +'Source code:' Lib/modulefinder.py(1) + +__________________________________________________________________ + +This module provides a *note ModuleFinder: 1a02. class that can be used +to determine the set of modules imported by a script. ‘modulefinder.py’ +can also be run as a script, giving the filename of a Python script as +its argument, after which a report of the imported modules will be +printed. + + -- Function: modulefinder.AddPackagePath (pkg_name, path) + + Record that the package named 'pkg_name' can be found in the + specified 'path'. + + -- Function: modulefinder.ReplacePackage (oldname, newname) + + Allows specifying that the module named 'oldname' is in fact the + package named 'newname'. + + -- Class: modulefinder.ModuleFinder (path=None, debug=0, excludes=[], + replace_paths=[]) + + This class provides *note run_script(): 4523. and *note report(): + 4524. methods to determine the set of modules imported by a script. + 'path' can be a list of directories to search for modules; if not + specified, ‘sys.path’ is used. 'debug' sets the debugging level; + higher values make the class print debugging messages about what + it’s doing. 'excludes' is a list of module names to exclude from + the analysis. 'replace_paths' is a list of ‘(oldpath, newpath)’ + tuples that will be replaced in module paths. + + -- Method: report () + + Print a report to standard output that lists the modules + imported by the script and their paths, as well as modules + that are missing or seem to be missing. + + -- Method: run_script (pathname) + + Analyze the contents of the 'pathname' file, which must + contain Python code. + + -- Attribute: modules + + A dictionary mapping module names to modules. See *note + Example usage of ModuleFinder: 4526. + +* Menu: + +* Example usage of ModuleFinder:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/modulefinder.py + + +File: python.info, Node: Example usage of ModuleFinder, Up: modulefinder — Find modules used by a script + +5.32.3.1 Example usage of ‘ModuleFinder’ +........................................ + +The script that is going to get analyzed later on (bacon.py): + + import re, itertools + + try: + import baconhameggs + except ImportError: + pass + + try: + import guido.python.ham + except ImportError: + pass + +The script that will output the report of 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())) + +Sample output (may vary depending on the architecture): + + 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 — Locating and executing Python modules, Next: importlib — The implementation of import, Prev: modulefinder — Find modules used by a script, Up: Importing Modules + +5.32.4 ‘runpy’ — Locating and executing Python modules +------------------------------------------------------ + +'Source code:' Lib/runpy.py(1) + +__________________________________________________________________ + +The *note runpy: be. module is used to locate and run Python modules +without importing them first. Its main use is to implement the *note +-m: 5dd. command line switch that allows scripts to be located using the +Python module namespace rather than the filesystem. + +Note that this is 'not' a sandbox module - all code is executed in the +current process, and any side effects (such as cached imports of other +modules) will remain in place after the functions have returned. + +Furthermore, any functions and classes defined by the executed code are +not guaranteed to work correctly after a *note runpy: be. function has +returned. If that limitation is not acceptable for a given use case, +*note importlib: 77. is likely to be a more suitable choice than this +module. + +The *note runpy: be. module provides two functions: + + -- Function: runpy.run_module (mod_name, init_globals=None, + run_name=None, alter_sys=False) + + Execute the code of the specified module and return the resulting + module’s globals dictionary. The module’s code is first located + using the standard import mechanism (refer to PEP 302(2) for + details) and then executed in a fresh module namespace. + + The 'mod_name' argument should be an absolute module name. If the + module name refers to a package rather than a normal module, then + that package is imported and the *note __main__: 1. submodule + within that package is then executed and the resulting module + globals dictionary returned. + + The optional dictionary argument 'init_globals' may be used to + pre-populate the module’s globals dictionary before the code is + executed. 'init_globals' will not be modified. If any of the + special global variables below are defined in 'init_globals', those + definitions are overridden by *note run_module(): 180b. + + The special global variables ‘__name__’, ‘__spec__’, ‘__file__’, + ‘__cached__’, ‘__loader__’ and ‘__package__’ are set in the globals + dictionary before the module code is executed. (Note that this is + a minimal set of variables - other variables may be set implicitly + as an interpreter implementation detail.) + + ‘__name__’ is set to 'run_name' if this optional argument is not + *note None: 671, to ‘mod_name + '.__main__'’ if the named module is + a package and to the 'mod_name' argument otherwise. + + ‘__spec__’ will be set appropriately for the 'actually' imported + module (that is, ‘__spec__.name’ will always be 'mod_name' or + ‘mod_name + '.__main__'’, never 'run_name'). + + ‘__file__’, ‘__cached__’, ‘__loader__’ and ‘__package__’ are *note + set as normal: 1f14. based on the module spec. + + If the argument 'alter_sys' is supplied and evaluates to *note + True: c0d, then ‘sys.argv[0]’ is updated with the value of + ‘__file__’ and ‘sys.modules[__name__]’ is updated with a temporary + module object for the module being executed. Both ‘sys.argv[0]’ + and ‘sys.modules[__name__]’ are restored to their original values + before the function returns. + + Note that this manipulation of *note sys: d9. 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. + + See also + ........ + + The *note -m: 5dd. option offering equivalent functionality from + the command line. + + Changed in version 3.1: Added ability to execute packages by + looking for a *note __main__: 1. submodule. + + Changed in version 3.2: Added ‘__cached__’ global variable (see PEP + 3147(3)). + + Changed in version 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’. + + Changed in version 3.12: The setting of ‘__cached__’, ‘__loader__’, + and ‘__package__’ are deprecated. See *note ModuleSpec: 1e64. for + alternatives. + + -- Function: 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: 3b0. 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: 3b0. entry + (typically a zipfile or directory), the entry is first added to the + beginning of ‘sys.path’. The function then looks for and executes + a *note __main__: 1. module using the updated path. Note that + there is no special protection against invoking an existing + ‘__main__’ entry located elsewhere on ‘sys.path’ if there is no + such module at the specified location. + + The optional dictionary argument 'init_globals' may be used to + pre-populate the module’s globals dictionary before the code is + executed. 'init_globals' will not be modified. If any of the + special global variables below are defined in 'init_globals', those + definitions are overridden by *note run_path(): 181. + + The special global variables ‘__name__’, ‘__spec__’, ‘__file__’, + ‘__cached__’, ‘__loader__’ and ‘__package__’ are set in the globals + dictionary before the module code is executed. (Note that this is + a minimal set of variables - other variables may be set implicitly + as an interpreter implementation detail.) + + ‘__name__’ is set to 'run_name' if this optional argument is not + *note None: 671. and to ‘'<run_path>'’ otherwise. + + If 'file_path' directly references a script file (whether as source + or as precompiled byte code), then ‘__file__’ will be set to + 'file_path', and ‘__spec__’, ‘__cached__’, ‘__loader__’ and + ‘__package__’ will all be set to *note None: 671. + + If 'file_path' is a reference to a valid *note sys.path: 3b0. + entry, then ‘__spec__’ will be set appropriately for the imported + *note __main__: 1. module (that is, ‘__spec__.name’ will always be + ‘__main__’). ‘__file__’, ‘__cached__’, ‘__loader__’ and + ‘__package__’ will be *note set as normal: 1f14. based on the + module spec. + + A number of alterations are also made to the *note sys: d9. module. + Firstly, *note sys.path: 3b0. may be altered as described above. + ‘sys.argv[0]’ is updated with the value of 'file_path' and + ‘sys.modules[__name__]’ is updated with a temporary module object + for the module being executed. All modifications to items in *note + sys: d9. are reverted before the function returns. + + Note that, unlike *note run_module(): 180b, the alterations made to + *note sys: d9. are not optional in this function as these + adjustments are essential to allowing the execution of *note + sys.path: 3b0. 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. + + See also + ........ + + *note Interface options: 1d29. for equivalent functionality on the + command line (‘python path/to/script’). + + Added in version 3.2. + + Changed in version 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: 3b0. entry rather than being executed directly. + + Changed in version 3.12: The setting of ‘__cached__’, ‘__loader__’, + and ‘__package__’ are deprecated. + +See also +........ + +PEP 338(6) – Executing modules as scripts + + PEP written and implemented by Nick Coghlan. + +PEP 366(7) – Main module explicit relative imports + + PEP written and implemented by Nick Coghlan. + +PEP 451(8) – A ModuleSpec Type for the Import System + + PEP written and implemented by Eric Snow + +*note Command line and environment: 19be. - CPython command line details + +The *note importlib.import_module(): 513. function + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 — The implementation of import, Next: importlib resources – Package resource reading opening and access, Prev: runpy — Locating and executing Python modules, Up: Importing Modules + +5.32.5 ‘importlib’ — The implementation of ‘import’ +--------------------------------------------------- + +Added in version 3.1. + +'Source code:' Lib/importlib/__init__.py(1) + +__________________________________________________________________ + +* Menu: + +* Introduction: Introduction<12>. +* Functions: Functions<12>. +* importlib.abc – Abstract base classes related to import: importlib abc – Abstract base classes related to import. +* importlib.machinery – Importers and path hooks: importlib machinery – Importers and path hooks. +* importlib.util – Utility code for importers: importlib util – Utility code for importers. +* Examples: Examples<34>. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/importlib/__init__.py + + +File: python.info, Node: Introduction<12>, Next: Functions<12>, Up: importlib — The implementation of import + +5.32.5.1 Introduction +..................... + +The purpose of the *note importlib: 77. package is three-fold. + +One is to provide the implementation of the *note import: 5de. statement +(and thus, by extension, the *note __import__(): 8d3. function) in +Python source code. This provides an implementation of ‘import’ which +is portable to any Python interpreter. This also provides an +implementation which is easier to comprehend than one implemented in a +programming language other than Python. + +Two, the components to implement *note import: 5de. are exposed in this +package, making it easier for users to create their own custom objects +(known generically as an *note importer: 1ff5.) to participate in the +import process. + +Three, the package contains modules exposing additional functionality +for managing aspects of Python packages: + + * *note importlib.metadata: 7a. presents access to metadata from + third-party distributions. + + * *note importlib.resources: 7b. provides routines for accessing + non-code “resources” from Python packages. + +See also +........ + +*note The import statement: 5de. + + The language reference for the *note import: 5de. statement. + +Packages specification(1) + + Original specification of packages. Some semantics have changed + since the writing of this document (e.g. redirecting based on + ‘None’ in *note sys.modules: 1550.). + +The *note __import__(): 1066. function + + The *note import: 5de. statement is syntactic sugar for this + function. + +*note The initialization of the sys.path module search path: 1c60. + + The initialization of *note sys.path: 3b0. + +PEP 235(2) + + Import on Case-Insensitive Platforms + +PEP 263(3) + + Defining Python Source Code Encodings + +PEP 302(4) + + New Import Hooks + +PEP 328(5) + + Imports: Multi-Line and Absolute/Relative + +PEP 366(6) + + Main module explicit relative imports + +PEP 420(7) + + Implicit namespace packages + +PEP 451(8) + + A ModuleSpec Type for the Import System + +PEP 488(9) + + Elimination of PYO files + +PEP 489(10) + + Multi-phase extension module initialization + +PEP 552(11) + + Deterministic pycs + +PEP 3120(12) + + Using UTF-8 as the Default Source Encoding + +PEP 3147(13) + + PYC Repository Directories + + ---------- 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: Functions<12>, Next: importlib abc – Abstract base classes related to import, Prev: Introduction<12>, Up: importlib — The implementation of import + +5.32.5.2 Functions +.................. + + -- Function: importlib.__import__ (name, globals=None, locals=None, + fromlist=(), level=0) + + An implementation of the built-in *note __import__(): 8d3. + function. + + Note: Programmatic importing of modules should use *note + import_module(): 513. instead of this function. + + -- Function: importlib.import_module (name, package=None) + + Import a module. The 'name' argument specifies what module to + import in absolute or relative terms (e.g. either ‘pkg.mod’ or + ‘..mod’). If the name is specified in relative terms, then the + 'package' argument must be set to the name of the package which is + to act as the anchor for resolving the package name (e.g. + ‘import_module('..mod', 'pkg.subpkg')’ will import ‘pkg.mod’). + + The *note import_module(): 513. function acts as a simplifying + wrapper around *note importlib.__import__(): 1066. This means all + semantics of the function are derived from *note + importlib.__import__(): 1066. The most important difference + between these two functions is that *note import_module(): 513. + returns the specified package or module (e.g. ‘pkg.mod’), while + *note __import__(): 8d3. returns the top-level package or module + (e.g. ‘pkg’). + + If you are dynamically importing a module that was created since + the interpreter began execution (e.g., created a Python source + file), you may need to call *note invalidate_caches(): c10. in + order for the new module to be noticed by the import system. + + Changed in version 3.3: Parent packages are automatically imported. + + -- Function: importlib.invalidate_caches () + + Invalidate the internal caches of finders stored at *note + sys.meta_path: d2b. If a finder implements ‘invalidate_caches()’ + then it will be called to perform the invalidation. This function + should be called if any modules are created/installed while your + program is running to guarantee all finders will notice the new + module’s existence. + + Added in version 3.3. + + Changed in version 3.10: Namespace packages created/installed in a + different *note sys.path: 3b0. location after the same namespace + was already imported are noticed. + + -- Function: importlib.reload (module) + + Reload a previously imported 'module'. The argument must be a + module object, so it must have been successfully imported before. + This is useful if you have edited the module source file using an + external editor and want to try out the new version without leaving + the Python interpreter. The return value is the module object + (which can be different if re-importing causes a different object + to be placed in *note sys.modules: 1550.). + + When *note reload(): 514. is executed: + + * Python module’s code is recompiled and the module-level code + re-executed, defining a new set of objects which are bound to + names in the module’s dictionary by reusing the *note loader: + 16b0. which originally loaded the module. The ‘init’ function + of extension modules is not called a second time. + + * As with all other objects in Python the old objects are only + reclaimed after their reference counts drop to zero. + + * The names in the module namespace are updated to point to any + new or changed objects. + + * Other references to the old objects (such as names external to + the module) are not rebound to refer to the new objects and + must be updated in each namespace where they occur if that is + desired. + + There are a number of other caveats: + + When a module is reloaded, its dictionary (containing the module’s + global variables) is retained. Redefinitions of names will + override the old definitions, so this is generally not a problem. + If the new version of a module does not define a name that was + defined by the old version, the old definition remains. This + feature can be used to the module’s advantage if it maintains a + global table or cache of objects — with a *note try: 6e4. statement + it can test for the table’s presence and skip its initialization if + desired: + + try: + cache + except NameError: + cache = {} + + It is generally not very useful to reload built-in or dynamically + loaded modules. Reloading *note sys: d9, *note __main__: 1, *note + builtins: 12. and other key modules is not recommended. In many + cases extension modules are not designed to be initialized more + than once, and may fail in arbitrary ways when reloaded. + + If a module imports objects from another module using *note from: + 129e. … *note import: 5de. …, calling *note reload(): 514. for the + other module does not redefine the objects imported from it — one + way around this is to re-execute the ‘from’ statement, another is + to use ‘import’ and qualified names ('module.name') instead. + + If a module instantiates instances of a class, reloading the module + that defines the class does not affect the method definitions of + the instances — they continue to use the old class definition. The + same is true for derived classes. + + Added in version 3.4. + + Changed in version 3.7: *note ModuleNotFoundError: b47. is raised + when the module being reloaded lacks a *note ModuleSpec: 1e64. + + Warning: 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: 1677. 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: Functions<12>, Up: importlib — The implementation of import + +5.32.5.3 ‘importlib.abc’ – Abstract base classes related to import +.................................................................. + +'Source code:' Lib/importlib/abc.py(1) + +__________________________________________________________________ + +The *note importlib.abc: 78. module contains all of the core abstract +base classes used by *note import: 5de. Some subclasses of the core +abstract base classes are also provided to help in implementing the core +ABCs. + +ABC hierarchy: + + object + +-- MetaPathFinder + +-- PathEntryFinder + +-- Loader + +-- ResourceLoader --------+ + +-- InspectLoader | + +-- ExecutionLoader --+ + +-- FileLoader + +-- SourceLoader + + -- Class: importlib.abc.MetaPathFinder + + An abstract base class representing a *note meta path finder: 1069. + + Added in version 3.3. + + Changed in version 3.10: No longer a subclass of ‘Finder’. + + -- Method: find_spec (fullname, path, target=None) + + An abstract method for finding a *note spec: 1f16. 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__: 1c6e. + 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(): 86a. + may be useful for implementing concrete ‘MetaPathFinders’. + + Added in version 3.4. + + -- Method: invalidate_caches () + + An optional method which, when called, should invalidate any + internal cache used by the finder. Used by *note + importlib.invalidate_caches(): c10. when invalidating the + caches of all finders on *note sys.meta_path: d2b. + + Changed in version 3.4: Returns ‘None’ when called instead of + *note NotImplemented: 7cd. + + -- Class: importlib.abc.PathEntryFinder + + An abstract base class representing a *note path entry finder: + 106a. Though it bears some similarities to *note MetaPathFinder: + 86b, ‘PathEntryFinder’ is meant for use only within the path-based + import subsystem provided by *note importlib.machinery.PathFinder: + 101c. + + Added in version 3.3. + + Changed in version 3.10: No longer a subclass of ‘Finder’. + + -- Method: find_spec (fullname, target=None) + + An abstract method for finding a *note spec: 1f16. for the + specified module. The finder will search for the module only + within the *note path entry: 2004. to which it is assigned. + 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(): 86a. may be useful for + implementing concrete ‘PathEntryFinders’. + + Added in version 3.4. + + -- Method: invalidate_caches () + + An optional method which, when called, should invalidate any + internal cache used by the finder. Used by *note + importlib.machinery.PathFinder.invalidate_caches(): c0f. when + invalidating the caches of all cached finders. + + -- Class: importlib.abc.Loader + + An abstract base class for a *note loader: 16b0. See PEP 302(2) + for the exact definition for a loader. + + Loaders that wish to support resource reading should implement a + ‘get_resource_reader()’ method as specified by *note + importlib.resources.abc.ResourceReader: 4531. + + Changed in version 3.7: Introduced the optional + ‘get_resource_reader()’ method. + + -- Method: create_module (spec) + + A method that returns the module object to use when importing + a module. This method may return ‘None’, indicating that + default module creation semantics should take place. + + Added in version 3.4. + + Changed in version 3.6: This method is no longer optional when + *note exec_module(): 867. is defined. + + -- Method: exec_module (module) + + An abstract method that executes the module in its own + namespace when a module is imported or reloaded. The module + should already be initialized when *note exec_module(): 867. + is called. When this method exists, *note create_module(): + cae. must be defined. + + Added in version 3.4. + + Changed in version 3.6: *note create_module(): cae. must also + be defined. + + -- Method: load_module (fullname) + + A legacy method for loading a module. If the module cannot be + loaded, *note ImportError: 415. is raised, otherwise the + loaded module is returned. + + If the requested module already exists in *note sys.modules: + 1550, that module should be used and reloaded. Otherwise the + loader should create a new module and insert it into *note + sys.modules: 1550. before any loading begins, to prevent + recursion from the import. If the loader inserted a module + and the load fails, it must be removed by the loader from + *note sys.modules: 1550.; modules already in *note + sys.modules: 1550. before the loader began execution should be + left alone. + + The loader should set several attributes on the module (note + that some of these attributes can change when a module is + reloaded): + + - *note module.__name__: 1374. + + - *note module.__file__: 1f1d. + + - *note module.__cached__: 2d9. '(deprecated)' + + - *note module.__path__: 1c6e. + + - *note module.__package__: 2db. '(deprecated)' + + - *note module.__loader__: 2e6. '(deprecated)' + + When *note exec_module(): 867. is available then + backwards-compatible functionality is provided. + + Changed in version 3.4: Raise *note ImportError: 415. when + called instead of *note NotImplementedError: 22a. + Functionality provided when *note exec_module(): 867. is + available. + + Deprecated since version 3.4, will be removed in version 3.15: + The recommended API for loading a module is *note + exec_module(): 867. (and *note create_module(): cae.). + Loaders should implement it instead of *note load_module(): + 866. The import machinery takes care of all the other + responsibilities of *note load_module(): 866. when *note + exec_module(): 867. is implemented. + + -- Class: importlib.abc.ResourceLoader + + 'Superseded by TraversableResources' + + An abstract base class for a *note loader: 16b0. which + implements the optional PEP 302(3) protocol for loading + arbitrary resources from the storage back-end. + + Deprecated since version 3.7: This ABC is deprecated in favour + of supporting resource loading through *note + importlib.resources.abc.TraversableResources: 2c8. + + -- Method: 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: 413. is + to be raised if the 'path' cannot be found. The + 'path' is expected to be constructed using a + module’s *note __file__: 1f1d. attribute or an item + from a package’s *note __path__: 1c6e. + + Changed in version 3.4: Raises *note OSError: 413. + instead of *note NotImplementedError: 22a. + + -- Class: importlib.abc.InspectLoader + + An abstract base class for a *note loader: 16b0. which implements + the optional PEP 302(4) protocol for loaders that inspect modules. + + -- Method: get_code (fullname) + + Return the code object for a module, or ‘None’ if the module + does not have a code object (as would be the case, for + example, for a built-in module). Raise an *note ImportError: + 415. if loader cannot find the requested module. + + Note: While the method has a default implementation, it + is suggested that it be overridden if possible for + performance. + + Changed in version 3.4: No longer abstract and a concrete + implementation is provided. + + -- Method: abstractmethod get_source (fullname) + + An abstract method to return the source of a module. It + is returned as a text string using *note universal + newlines: d3a, translating all recognized line separators + into ‘'\n'’ characters. Returns ‘None’ if no source is + available (e.g. a built-in module). Raises *note + ImportError: 415. if the loader cannot find the module + specified. + + Changed in version 3.4: Raises *note ImportError: 415. + instead of *note NotImplementedError: 22a. + + -- Method: is_package (fullname) + + An optional method to return a true value if the module is a + package, a false value otherwise. *note ImportError: 415. is + raised if the *note loader: 16b0. cannot find the module. + + Changed in version 3.4: Raises *note ImportError: 415. instead + of *note NotImplementedError: 22a. + + -- Method: static source_to_code (data, path='<string>') + + Create a code object from Python source. + + The 'data' argument can be whatever the *note compile(): 192. + function supports (i.e. string or bytes). The 'path' + argument should be the “path” to where the source code + originated from, which can be an abstract concept (e.g. + location in a zip file). + + With the subsequent code object one can execute it in a module + by running ‘exec(code, module.__dict__)’. + + Added in version 3.4. + + Changed in version 3.5: Made the method static. + + -- Method: exec_module (module) + + Implementation of *note Loader.exec_module(): 867. + + Added in version 3.4. + + -- Method: load_module (fullname) + + Implementation of *note Loader.load_module(): 866. + + Deprecated since version 3.4, will be removed in version 3.15: + use *note exec_module(): 100b. instead. + + -- Class: importlib.abc.ExecutionLoader + + An abstract base class which inherits from *note InspectLoader: + f4f. that, when implemented, helps a module to be executed as a + script. The ABC represents an optional PEP 302(5) protocol. + + -- Method: abstractmethod get_filename (fullname) + + An abstract method that is to return the value of *note + __file__: 1f1d. for the specified module. If no path is + available, *note ImportError: 415. is raised. + + If source code is available, then the method should + return the path to the source file, regardless of whether + a bytecode was used to load the module. + + Changed in version 3.4: Raises *note ImportError: 415. + instead of *note NotImplementedError: 22a. + + -- Class: importlib.abc.FileLoader (fullname, path) + + An abstract base class which inherits from *note ResourceLoader: + be7. and *note ExecutionLoader: 4534, providing concrete + implementations of *note ResourceLoader.get_data(): 451d. and *note + ExecutionLoader.get_filename(): 4535. + + The 'fullname' argument is a fully resolved name of the module the + loader is to handle. The 'path' argument is the path to the file + for the module. + + Added in version 3.3. + + -- Attribute: name + + The name of the module the loader can handle. + + -- Attribute: path + + Path to the file of the module. + + -- Method: load_module (fullname) + + Calls super’s ‘load_module()’. + + Deprecated since version 3.4, will be removed in version 3.15: + Use *note Loader.exec_module(): 867. instead. + + -- Method: abstractmethod get_filename (fullname) + + Returns *note path: 4537. + + -- Method: abstractmethod get_data (path) + + Reads 'path' as a binary file and returns the bytes from it. + + -- Class: importlib.abc.SourceLoader + + An abstract base class for implementing source (and optionally + bytecode) file loading. The class inherits from both *note + ResourceLoader: be7. and *note ExecutionLoader: 4534, requiring the + implementation of: + + * *note ResourceLoader.get_data(): 451d. + + * + *note ExecutionLoader.get_filename(): 4535. + + Should only return the path to the source file; + sourceless loading is not supported. + + The abstract methods defined by this class are to add optional + bytecode file support. Not implementing these optional methods (or + causing them to raise *note NotImplementedError: 22a.) causes the + loader to only work with source code. Implementing the methods + allows the loader to work with source 'and' bytecode files; it does + not allow for 'sourceless' loading where only bytecode is provided. + Bytecode files are an optimization to speed up loading by removing + the parsing step of Python’s compiler, and so no bytecode-specific + API is exposed. + + -- Method: path_stats (path) + + Optional abstract method which returns a *note dict: 258. + containing metadata about the specified path. Supported + dictionary keys are: + + - ‘'mtime'’ (mandatory): an integer or floating-point + number representing the modification time of the source + code; + + - ‘'size'’ (optional): the size in bytes of the source + code. + + Any other keys in the dictionary are ignored, to allow for + future extensions. If the path cannot be handled, *note + OSError: 413. is raised. + + Added in version 3.3. + + Changed in version 3.4: Raise *note OSError: 413. instead of + *note NotImplementedError: 22a. + + -- Method: path_mtime (path) + + Optional abstract method which returns the modification time + for the specified path. + + Deprecated since version 3.3: This method is deprecated in + favour of *note path_stats(): 117e. You don’t have to + implement it, but it is still available for compatibility + purposes. Raise *note OSError: 413. if the path cannot be + handled. + + Changed in version 3.4: Raise *note OSError: 413. instead of + *note NotImplementedError: 22a. + + -- Method: set_data (path, data) + + Optional abstract method which writes the specified bytes to a + file path. Any intermediate directories which do not exist + are to be created automatically. + + When writing to the path fails because the path is read-only + (*note errno.EACCES: 22ad./*note PermissionError: d42.), do + not propagate the exception. + + Changed in version 3.4: No longer raises *note + NotImplementedError: 22a. when called. + + -- Method: get_code (fullname) + + Concrete implementation of *note InspectLoader.get_code(): + f50. + + -- Method: exec_module (module) + + Concrete implementation of *note Loader.exec_module(): 867. + + Added in version 3.4. + + -- Method: load_module (fullname) + + Concrete implementation of *note Loader.load_module(): 866. + + Deprecated since version 3.4, will be removed in version 3.15: + Use *note exec_module(): 100c. instead. + + -- Method: get_source (fullname) + + Concrete implementation of *note InspectLoader.get_source(): + f53. + + -- Method: is_package (fullname) + + Concrete implementation of *note InspectLoader.is_package(): + 4532. A module is determined to be a package if its file path + (as provided by *note ExecutionLoader.get_filename(): 4535.) + is a file named ‘__init__’ when the file extension is removed + 'and' the module name itself does not end in ‘__init__’. + + -- Class: importlib.abc.ResourceReader + + 'Superseded by TraversableResources' + + An *note abstract base class: 11a8. to provide the ability to read + 'resources'. + + 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: 2a2. 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: 671. An object compatible with this ABC should only be + returned when the specified module is a package. + + Added in version 3.7. + + Deprecated since version 3.12, will be removed in version 3.14: Use + *note importlib.resources.abc.TraversableResources: 2c8. instead. + + -- Method: abstractmethod open_resource (resource) + + Returns an opened, *note file-like object: 258f. for + binary reading of the 'resource'. + + If the resource cannot be found, *note FileNotFoundError: + 427. is raised. + + -- Method: abstractmethod resource_path (resource) + + Returns the file system path to the 'resource'. + + If the resource does not concretely exist on the file + system, raise *note FileNotFoundError: 427. + + -- Method: abstractmethod is_resource (name) + + Returns ‘True’ if the named 'name' is considered a + resource. *note FileNotFoundError: 427. is raised if + 'name' does not exist. + + -- Method: abstractmethod contents () + + Returns an *note iterable: 121a. 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(): 4542. 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. + + -- Class: importlib.abc.Traversable + + An object with a subset of *note pathlib.Path: 22b. methods + suitable for traversing directories and opening files. + + For a representation of the object on the file-system, use *note + importlib.resources.as_file(): 489. + + Added in version 3.9. + + Deprecated since version 3.12, will be removed in version 3.14: Use + *note importlib.resources.abc.Traversable: 1f5. instead. + + -- Attribute: name + + Abstract. The base name of this object without any parent + references. + + -- Method: abstractmethod iterdir () + + Yield ‘Traversable’ objects in ‘self’. + + -- Method: abstractmethod is_dir () + + Return ‘True’ if ‘self’ is a directory. + + -- Method: abstractmethod is_file () + + Return ‘True’ if ‘self’ is a file. + + -- Method: abstractmethod joinpath (child) + + Return Traversable child in ‘self’. + + -- Method: abstractmethod __truediv__ (child) + + Return ‘Traversable’ child in ‘self’. + + -- Method: 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: + 27cb.). + + When opening as text, accepts encoding parameters such as + those accepted by *note io.TextIOWrapper: 7b6. + + -- Method: read_bytes () + + Read contents of ‘self’ as bytes. + + -- Method: read_text (encoding=None) + + Read contents of ‘self’ as text. + + -- Class: importlib.abc.TraversableResources + + An abstract base class for resource readers capable of serving the + *note importlib.resources.files(): 48a. interface. Subclasses + *note importlib.resources.abc.ResourceReader: 4531. and provides + concrete implementations of the *note + importlib.resources.abc.ResourceReader: 4531.’s abstract methods. + Therefore, any loader supplying *note + importlib.abc.TraversableResources: 1882. also supplies + ResourceReader. + + Loaders that wish to support resource reading are expected to + implement this interface. + + Added in version 3.9. + + Deprecated since version 3.12, will be removed in version 3.14: Use + *note importlib.resources.abc.TraversableResources: 2c8. instead. + + -- Method: abstractmethod files () + + Returns a *note importlib.resources.abc.Traversable: 1f5. + object for the loaded package. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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 — The implementation of import + +5.32.5.4 ‘importlib.machinery’ – Importers and path hooks +......................................................... + +'Source code:' Lib/importlib/machinery.py(1) + +__________________________________________________________________ + +This module contains the various objects that help *note import: 5de. +find and load modules. + + -- Data: importlib.machinery.SOURCE_SUFFIXES + + A list of strings representing the recognized file suffixes for + source modules. + + Added in version 3.3. + + -- Data: importlib.machinery.DEBUG_BYTECODE_SUFFIXES + + A list of strings representing the file suffixes for non-optimized + bytecode modules. + + Added in version 3.3. + + Deprecated since version 3.5: Use *note BYTECODE_SUFFIXES: 511. + instead. + + -- Data: importlib.machinery.OPTIMIZED_BYTECODE_SUFFIXES + + A list of strings representing the file suffixes for optimized + bytecode modules. + + Added in version 3.3. + + Deprecated since version 3.5: Use *note BYTECODE_SUFFIXES: 511. + instead. + + -- Data: importlib.machinery.BYTECODE_SUFFIXES + + A list of strings representing the recognized file suffixes for + bytecode modules (including the leading dot). + + Added in version 3.3. + + Changed in version 3.5: The value is no longer dependent on + ‘__debug__’. + + -- Data: importlib.machinery.EXTENSION_SUFFIXES + + A list of strings representing the recognized file suffixes for + extension modules. + + Added in version 3.3. + + -- Function: importlib.machinery.all_suffixes () + + Returns a combined list of strings representing all file suffixes + for modules recognized by the standard import machinery. This is a + helper for code which simply needs to know if a filesystem path + potentially refers to a module without needing any details on the + kind of module (for example, *note inspect.getmodulename(): d39.). + + Added in version 3.3. + + -- Class: importlib.machinery.BuiltinImporter + + An *note importer: 1ff5. for built-in modules. All known built-in + modules are listed in *note sys.builtin_module_names: 1c5f. This + class implements the *note importlib.abc.MetaPathFinder: 86b. and + *note importlib.abc.InspectLoader: f4f. ABCs. + + Only class methods are defined by this class to alleviate the need + for instantiation. + + Changed in version 3.5: As part of PEP 489(2), the builtin importer + now implements ‘Loader.create_module()’ and ‘Loader.exec_module()’ + + -- Class: importlib.machinery.FrozenImporter + + An *note importer: 1ff5. for frozen modules. This class implements + the *note importlib.abc.MetaPathFinder: 86b. and *note + importlib.abc.InspectLoader: f4f. ABCs. + + Only class methods are defined by this class to alleviate the need + for instantiation. + + Changed in version 3.4: Gained ‘create_module()’ and + ‘exec_module()’ methods. + + -- Class: importlib.machinery.WindowsRegistryFinder + + *note Finder: 1f1e. for modules declared in the Windows registry. + This class implements the *note importlib.abc.MetaPathFinder: 86b. + ABC. + + Only class methods are defined by this class to alleviate the need + for instantiation. + + Added in version 3.3. + + Deprecated since version 3.6: Use *note site: c7. configuration + instead. Future versions of Python may not enable this finder by + default. + + -- Class: importlib.machinery.PathFinder + + A *note Finder: 1f1e. for *note sys.path: 3b0. and package + ‘__path__’ attributes. This class implements the *note + importlib.abc.MetaPathFinder: 86b. ABC. + + Only class methods are defined by this class to alleviate the need + for instantiation. + + -- Method: classmethod find_spec (fullname, path=None, + target=None) + + Class method that attempts to find a *note spec: 1f16. for the + module specified by 'fullname' on *note sys.path: 3b0. or, if + defined, on 'path'. For each path entry that is searched, + *note sys.path_importer_cache: 5e0. is checked. If a + non-false object is found then it is used as the *note path + entry finder: 106a. to look for the module being searched for. + If no entry is found in *note sys.path_importer_cache: 5e0, + then *note sys.path_hooks: 101d. is searched for a finder for + the path entry and, if found, is stored in *note + sys.path_importer_cache: 5e0. along with being queried about + the module. If no finder is ever found then ‘None’ is both + stored in the cache and returned. + + Added in version 3.4. + + Changed in version 3.5: If the current working directory – + represented by an empty string – is no longer valid then + ‘None’ is returned but no value is cached in *note + sys.path_importer_cache: 5e0. + + -- Method: classmethod invalidate_caches () + + Calls *note importlib.abc.PathEntryFinder.invalidate_caches(): + 4530. on all finders stored in *note sys.path_importer_cache: + 5e0. that define the method. Otherwise entries in *note + sys.path_importer_cache: 5e0. set to ‘None’ are deleted. + + Changed in version 3.7: Entries of ‘None’ in *note + sys.path_importer_cache: 5e0. are deleted. + + Changed in version 3.4: Calls objects in *note sys.path_hooks: + 101d. with the current working directory for ‘''’ (i.e. the empty + string). + + -- Class: importlib.machinery.FileFinder (path, *loader_details) + + A concrete implementation of *note importlib.abc.PathEntryFinder: + 86c. which caches results from the file system. + + The 'path' argument is the directory for which the finder is in + charge of searching. + + The 'loader_details' argument is a variable number of 2-item tuples + each containing a loader and a sequence of file suffixes the loader + recognizes. The loaders are expected to be callables which accept + two arguments of the module’s name and the path to the file found. + + The finder will cache the directory contents as necessary, making + stat calls for each module search to verify the cache is not + outdated. Because cache staleness relies upon the granularity of + the operating system’s state information of the file system, there + is a potential race condition of searching for a module, creating a + new file, and then searching for the module the new file + represents. If the operations happen fast enough to fit within the + granularity of stat calls, then the module search will fail. To + prevent this from happening, when you create a module dynamically, + make sure to call *note importlib.invalidate_caches(): c10. + + Added in version 3.3. + + -- Attribute: path + + The path the finder will search in. + + -- Method: find_spec (fullname, target=None) + + Attempt to find the spec to handle 'fullname' within *note + path: 4550. + + Added in version 3.4. + + -- Method: invalidate_caches () + + Clear out the internal cache. + + -- Method: classmethod path_hook (*loader_details) + + A class method which returns a closure for use on *note + sys.path_hooks: 101d. An instance of *note FileFinder: 106b. + is returned by the closure using the path argument given to + the closure directly and 'loader_details' indirectly. + + If the argument to the closure is not an existing directory, + *note ImportError: 415. is raised. + + -- Class: importlib.machinery.SourceFileLoader (fullname, path) + + A concrete implementation of *note importlib.abc.SourceLoader: + 453b. by subclassing *note importlib.abc.FileLoader: 106c. and + providing some concrete implementations of other methods. + + Added in version 3.3. + + -- Attribute: name + + The name of the module that this loader will handle. + + -- Attribute: path + + The path to the source file. + + -- Method: is_package (fullname) + + Return ‘True’ if *note path: 4554. appears to be for a + package. + + -- Method: path_stats (path) + + Concrete implementation of *note + importlib.abc.SourceLoader.path_stats(): 117e. + + -- Method: set_data (path, data) + + Concrete implementation of *note + importlib.abc.SourceLoader.set_data(): 453c. + + -- Method: load_module (name=None) + + Concrete implementation of *note + importlib.abc.Loader.load_module(): 866. where specifying the + name of the module to load is optional. + + Deprecated since version 3.6, will be removed in version 3.15: + Use *note importlib.abc.Loader.exec_module(): 867. instead. + + -- Class: importlib.machinery.SourcelessFileLoader (fullname, path) + + A concrete implementation of *note importlib.abc.FileLoader: 106c. + which can import bytecode files (i.e. no source code files exist). + + Please note that direct use of bytecode files (and thus not source + code files) inhibits your modules from being usable by all Python + implementations or new versions of Python which change the bytecode + format. + + Added in version 3.3. + + -- Attribute: name + + The name of the module the loader will handle. + + -- Attribute: path + + The path to the bytecode file. + + -- Method: is_package (fullname) + + Determines if the module is a package based on *note path: + 4559. + + -- Method: get_code (fullname) + + Returns the code object for *note name: 4558. created from + *note path: 4559. + + -- Method: get_source (fullname) + + Returns ‘None’ as bytecode files have no source when this + loader is used. + + -- Method: load_module (name=None) + + Concrete implementation of *note + importlib.abc.Loader.load_module(): 866. where specifying the name + of the module to load is optional. + + Deprecated since version 3.6, will be removed in version 3.15: Use + *note importlib.abc.Loader.exec_module(): 867. instead. + + -- Class: importlib.machinery.ExtensionFileLoader (fullname, path) + + A concrete implementation of *note importlib.abc.ExecutionLoader: + 4534. for extension modules. + + The 'fullname' argument specifies the name of the module the loader + is to support. The 'path' argument is the path to the extension + module’s file. + + 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. + + Changed in version 3.12: Multi-phase init is now required for use + in subinterpreters. + + -- Attribute: name + + Name of the module the loader supports. + + -- Attribute: path + + Path to the extension module. + + -- Method: create_module (spec) + + Creates the module object from the given specification in + accordance with PEP 489(4). + + Added in version 3.5. + + -- Method: exec_module (module) + + Initializes the given module object in accordance with PEP + 489(5). + + Added in version 3.5. + + -- Method: is_package (fullname) + + Returns ‘True’ if the file path points to a package’s + ‘__init__’ module based on *note EXTENSION_SUFFIXES: 510. + + -- Method: get_code (fullname) + + Returns ‘None’ as extension modules lack a code object. + + -- Method: get_source (fullname) + + Returns ‘None’ as extension modules do not have source code. + + -- Method: get_filename (fullname) + + Returns *note path: 455e. + + Added in version 3.4. + + -- Class: importlib.machinery.NamespaceLoader (name, path, path_finder) + + A concrete implementation of *note importlib.abc.InspectLoader: + f4f. 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. + + -- Class: 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__: 1f17. + 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__: 1f1d. at runtime and this will not be automatically + reflected in the module’s *note __spec__.origin: 4564, and vice + versa. + + Added in version 3.4. + + -- Attribute: name + + The module’s fully qualified name (see *note module.__name__: + 1374.). The *note finder: 1f1e. should always set this + attribute to a non-empty string. + + -- Attribute: loader + + The *note loader: 16b0. used to load the module (see *note + module.__loader__: 2e6.). The *note finder: 1f1e. should + always set this attribute. + + -- Attribute: origin + + The location the *note loader: 16b0. should use to load the + module (see *note module.__file__: 1f1d.). For example, for + modules loaded from a ‘.py’ file this is the filename. The + *note finder: 1f1e. should always set this attribute to a + meaningful value for the *note loader: 16b0. to use. In the + uncommon case that there is not one (like for namespace + packages), it should be set to ‘None’. + + -- Attribute: submodule_search_locations + + A (possibly empty) *note sequence: 4ed. of strings enumerating + the locations in which a package’s submodules will be found + (see *note module.__path__: 1c6e.). Most of the time there + will only be a single directory in this list. + + The *note finder: 1f1e. 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. + + -- Attribute: loader_state + + The *note finder: 1f1e. 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’. + + -- Attribute: cached + + The filename of a compiled version of the module’s code (see + *note module.__cached__: 2d9.). The *note finder: 1f1e. + should always set this attribute but it may be ‘None’ for + modules that do not need compiled code stored. + + -- Attribute: 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__: 2db. If the module is a package then this + is the same as *note name: 1f18. + + -- Attribute: has_location + + ‘True’ if the spec’s *note origin: 4564. refers to a loadable + location, ‘False’ otherwise. This value impacts how ‘origin’ + is interpreted and how the module’s *note __file__: 1f1d. is + populated. + + -- Class: importlib.machinery.AppleFrameworkLoader (name, path) + + A specialization of *note importlib.machinery.ExtensionFileLoader: + cb0. that is able to load extension modules in Framework format. + + For compatibility with the iOS App Store, 'all' binary modules in + an iOS app must be dynamic libraries, contained in a framework with + appropriate metadata, stored in the ‘Frameworks’ folder of the + packaged app. There can be only a single binary per framework, and + there can be no executable binary material outside the Frameworks + folder. + + 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 be 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. + + For example, consider the case of an import ‘from foo.bar import + _whiz’, where ‘_whiz’ is implemented with the binary module + ‘sources/foo/bar/_whiz.abi3.so’, with ‘sources’ being the location + registered on ‘sys.path’, relative to the application bundle. This + module 'must' be distributed as + ‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz’ (creating the + framework name from the full import path of the module), with an + ‘Info.plist’ file in the ‘.framework’ directory identifying the + binary as a framework. The ‘foo.bar._whiz’ module would be + represented in the original location with a + ‘sources/foo/bar/_whiz.abi3.fwork’ marker file, containing the path + ‘Frameworks/foo.bar._whiz/foo.bar._whiz’. The framework would also + contain ‘Frameworks/foo.bar._whiz.framework/foo.bar._whiz.origin’, + containing the path to the ‘.fwork’ file. + + 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 traveral. 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: 1d54.: iOS. + + -- Attribute: name + + Name of the module the loader supports. + + -- Attribute: path + + Path to the ‘.fwork’ file for the extension module. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/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: Examples<34>, Prev: importlib machinery – Importers and path hooks, Up: importlib — The implementation of import + +5.32.5.5 ‘importlib.util’ – Utility code for importers +...................................................... + +'Source code:' Lib/importlib/util.py(1) + +__________________________________________________________________ + +This module contains the various objects that help in the construction +of an *note importer: 1ff5. + + -- Data: importlib.util.MAGIC_NUMBER + + The bytes which represent the bytecode version number. If you need + help with loading/writing bytecode then consider *note + importlib.abc.SourceLoader: 453b. + + Added in version 3.4. + + -- Function: importlib.util.cache_from_source (path, + debug_override=None, *, optimization=None) + + Return the PEP 3147(2)/ PEP 488(3) path to the byte-compiled file + associated with the source 'path'. For example, if 'path' is + ‘/foo/bar/baz.py’ the return value would be + ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ for Python 3.2. The + ‘cpython-32’ string comes from the current magic tag (see + ‘get_tag()’; if ‘sys.implementation.cache_tag’ is not defined then + *note NotImplementedError: 22a. will be raised). + + The 'optimization' parameter is used to specify the optimization + level of the bytecode file. An empty string represents no + optimization, so ‘/foo/bar/baz.py’ with an 'optimization' of ‘''’ + will result in a bytecode path of + ‘/foo/bar/__pycache__/baz.cpython-32.pyc’. ‘None’ causes the + interpreter’s optimization level to be used. Any other value’s + string representation is used, so ‘/foo/bar/baz.py’ with an + 'optimization' of ‘2’ will lead to the bytecode path of + ‘/foo/bar/__pycache__/baz.cpython-32.opt-2.pyc’. The string + representation of 'optimization' can only be alphanumeric, else + *note ValueError: 204. is raised. + + The 'debug_override' parameter is deprecated and can be used to + override the system’s value for ‘__debug__’. A ‘True’ value is the + equivalent of setting 'optimization' to the empty string. A + ‘False’ value is the same as setting 'optimization' to ‘1’. If + both 'debug_override' an 'optimization' are not ‘None’ then *note + TypeError: 534. is raised. + + Added in version 3.4. + + Changed in version 3.5: The 'optimization' parameter was added and + the 'debug_override' parameter was deprecated. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + + -- Function: importlib.util.source_from_cache (path) + + Given the 'path' to a PEP 3147(4) file name, return the associated + source code file path. For example, if 'path' is + ‘/foo/bar/__pycache__/baz.cpython-32.pyc’ the returned path would + be ‘/foo/bar/baz.py’. 'path' need not exist, however if it does + not conform to PEP 3147(5) or PEP 488(6) format, a *note + ValueError: 204. is raised. If ‘sys.implementation.cache_tag’ is + not defined, *note NotImplementedError: 22a. is raised. + + Added in version 3.4. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + + -- Function: importlib.util.decode_source (source_bytes) + + Decode the given bytes representing source code and return it as a + string with universal newlines (as required by *note + importlib.abc.InspectLoader.get_source(): f53.). + + Added in version 3.4. + + -- Function: importlib.util.resolve_name (name, package) + + Resolve a relative module name to an absolute one. + + If 'name' has no leading dots, then 'name' is simply returned. + This allows for usage such as ‘importlib.util.resolve_name('sys', + __spec__.parent)’ without doing a check to see if the 'package' + argument is needed. + + *note ImportError: 415. is raised if 'name' is a relative module + name but 'package' is a false value (e.g. ‘None’ or the empty + string). *note ImportError: 415. is also raised if a relative name + would escape its containing package (e.g. requesting ‘..bacon’ + from within the ‘spam’ package). + + Added in version 3.3. + + Changed in version 3.9: To improve consistency with import + statements, raise *note ImportError: 415. instead of *note + ValueError: 204. for invalid relative import attempts. + + -- Function: importlib.util.find_spec (name, package=None) + + Find the *note spec: 1f16. for a module, optionally relative to the + specified 'package' name. If the module is in *note sys.modules: + 1550, then ‘sys.modules[name].__spec__’ is returned (unless the + spec would be ‘None’ or is not set, in which case *note ValueError: + 204. is raised). Otherwise a search using *note sys.meta_path: + d2b. is done. ‘None’ is returned if no spec is found. + + If 'name' is for a submodule (contains a dot), the parent module is + automatically imported. + + 'name' and 'package' work the same as for ‘import_module()’. + + Added in version 3.4. + + Changed in version 3.7: Raises *note ModuleNotFoundError: b47. + instead of *note AttributeError: 348. if 'package' is in fact not a + package (i.e. lacks a *note __path__: 1c6e. attribute). + + -- Function: importlib.util.module_from_spec (spec) + + Create a new module based on 'spec' and *note + spec.loader.create_module: cae. + + If *note spec.loader.create_module: cae. does not return ‘None’, + then any pre-existing attributes will not be reset. Also, no *note + AttributeError: 348. will be raised if triggered while accessing + 'spec' or setting an attribute on the module. + + This function is preferred over using *note types.ModuleType: e12. + to create a new module as 'spec' is used to set as many + import-controlled attributes on the module as possible. + + Added in version 3.5. + + -- Function: importlib.util.spec_from_loader (name, loader, *, + origin=None, is_package=None) + + A factory function for creating a *note ModuleSpec: 1e64. instance + based on a loader. The parameters have the same meaning as they do + for ModuleSpec. The function uses available *note loader: 16b0. + APIs, such as ‘InspectLoader.is_package()’, to fill in any missing + information on the spec. + + Added in version 3.4. + + -- Function: importlib.util.spec_from_file_location (name, location, *, + loader=None, submodule_search_locations=None) + + A factory function for creating a *note ModuleSpec: 1e64. instance + based on the path to a file. Missing information will be filled in + on the spec by making use of loader APIs and by the implication + that the module will be file-based. + + Added in version 3.4. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + + -- Function: importlib.util.source_hash (source_bytes) + + Return the hash of 'source_bytes' as bytes. A hash-based ‘.pyc’ + file embeds the *note source_hash(): 456a. of the corresponding + source file’s contents in its header. + + Added in version 3.7. + + -- Function: 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). + + Warning: 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. + + -- Class: importlib.util.LazyLoader (loader) + + A class which postpones the execution of the loader of a module + until the module has an attribute accessed. + + This class 'only' works with loaders that define *note + exec_module(): 867. as control over what module type is used for + the module is required. For those same reasons, the loader’s *note + create_module(): cae. method must return ‘None’ or a type for which + its ‘__class__’ attribute can be mutated along with not using *note + slots: 5db. Finally, modules which substitute the object placed + into *note sys.modules: 1550. will not work as there is no way to + properly replace the module references throughout the interpreter + safely; *note ValueError: 204. is raised if such a substitution is + detected. + + Note: For projects where startup time is critical, this class + allows for potentially minimizing the cost of loading a module + if it is never used. For projects where startup time is not + essential then use of this class is 'heavily' discouraged due + to error messages created during loading being postponed and + thus occurring out of context. + + Added in version 3.5. + + Changed in version 3.6: Began calling *note create_module(): cae, + removing the compatibility warning for *note + importlib.machinery.BuiltinImporter: caf. and *note + importlib.machinery.ExtensionFileLoader: cb0. + + -- Method: classmethod factory (loader) + + A class method which returns a callable that creates a lazy + loader. This is meant to be used in situations where the + loader is passed by class instead of by instance. + + suffixes = importlib.machinery.SOURCE_SUFFIXES + loader = importlib.machinery.SourceFileLoader + lazy_loader = importlib.util.LazyLoader.factory(loader) + finder = importlib.machinery.FileFinder(path, (lazy_loader, suffixes)) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: Examples<34>, Prev: importlib util – Utility code for importers, Up: importlib — The implementation of import + +5.32.5.6 Examples +................. + +* Menu: + +* Importing programmatically:: +* Checking if a module can be imported:: +* Importing a source file directly:: +* Implementing lazy imports:: +* Setting up an importer:: +* Approximating importlib.import_module(): Approximating importlib import_module. + + +File: python.info, Node: Importing programmatically, Next: Checking if a module can be imported, Up: Examples<34> + +5.32.5.7 Importing programmatically +................................... + +To programmatically import a module, use *note +importlib.import_module(): 513. + + import importlib + + itertools = importlib.import_module('itertools') + + +File: python.info, Node: Checking if a module can be imported, Next: Importing a source file directly, Prev: Importing programmatically, Up: Examples<34> + +5.32.5.8 Checking if a module can be imported +............................................. + +If you need to find out if a module can be imported without actually +doing the import, then you should use *note importlib.util.find_spec(): +2d0. + +Note that if ‘name’ is a submodule (contains a dot), *note +importlib.util.find_spec(): 2d0. 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: Importing a source file directly, Next: Implementing lazy imports, Prev: Checking if a module can be imported, Up: Examples<34> + +5.32.5.9 Importing a source file directly +......................................... + +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: 3b0. being searched. Alternatives should first be +considered first, such as modifying *note sys.path: 3b0. when a proper +module is required, or using *note runpy.run_path(): 181. 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: Setting up an importer, Prev: Importing a source file directly, Up: Examples<34> + +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: Setting up an importer, Next: Approximating importlib import_module, Prev: Implementing lazy imports, Up: Examples<34> + +5.32.5.11 Setting up an importer +................................ + +For deep customizations of import, you typically want to implement an +*note importer: 1ff5. This means managing both the *note finder: 1f1e. +and *note loader: 16b0. side of things. For finders there are two +flavours to choose from depending on your needs: a *note meta path +finder: 1069. or a *note path entry finder: 106a. The former is what +you would put on *note sys.meta_path: d2b. while the latter is what you +create using a *note path entry hook: 2006. on *note sys.path_hooks: +101d. which works with *note sys.path: 3b0. 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: Setting up an importer, Up: Examples<34> + +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(): 513.: + + 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 – Package resource reading opening and access, Next: importlib resources abc – Abstract base classes for resources, Prev: importlib — The implementation of import, Up: Importing Modules + +5.32.6 ‘importlib.resources’ – Package resource reading, opening and access +--------------------------------------------------------------------------- + +'Source code:' 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: 225. 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. + +Resources are roughly akin to files inside directories, though it’s +important to keep in mind that this is just a metaphor. Resources and +packages 'do not' have to exist as physical files and directories on the +file system: for example, a package and its resources can be imported +from a zip file using *note zipimport: 132. + + Note: This module provides functionality similar to + pkg_resources(2) Basic Resource Access(3) without the performance + overhead of that package. This makes reading resources included in + packages easier, with more stable and consistent semantics. + + The standalone backport of this module provides more information on + using importlib.resources(4) and migrating from pkg_resources to + importlib.resources(5). + +*note Loaders: ec0. that wish to support resource reading should +implement a ‘get_resource_reader(fullname)’ method as specified by *note +importlib.resources.abc.ResourceReader: 4531. + + -- Class: importlib.resources.Anchor + + Represents an anchor for resources, either a *note module object: + e12. or a module name as a string. Defined as ‘Union[str, + ModuleType]’. + + -- Function: importlib.resources.files (anchor: Anchor | None = None) + + Returns a *note Traversable: 1f5. 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: 4577. 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. + + Changed in version 3.12: 'package' parameter was renamed to + 'anchor'. 'anchor' can now be a non-package module and if omitted + will default to the caller’s module. 'package' is still accepted + for compatibility but will raise a *note DeprecationWarning: 1a5. + Consider passing the anchor positionally or using + ‘importlib_resources >= 5.10’ for a compatible interface on older + Pythons. + + -- Function: importlib.resources.as_file (traversable) + + Given a *note Traversable: 1f5. object representing a file or + directory, typically from *note importlib.resources.files(): 48a, + return a context manager for use in a *note with: 5ce. statement. + The context manager provides a *note pathlib.Path: 22b. 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. + + Changed in version 3.12: Added support for 'traversable' + representing a directory. + +* Menu: + +* Functional API:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/importlib/resources/__init__.py + + (2) https://setuptools.readthedocs.io/en/latest/pkg_resources.html + + (3) +https://setuptools.readthedocs.io/en/latest/pkg_resources.html#basic-resource-access + + (4) https://importlib-resources.readthedocs.io/en/latest/using.html + + (5) +https://importlib-resources.readthedocs.io/en/latest/migration.html + + +File: python.info, Node: Functional API, Up: importlib resources – Package resource reading opening and access + +5.32.6.1 Functional 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: 4577, as in *note files(): 48a. + 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: 1f5, 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') + + -- Function: importlib.resources.open_binary (anchor, *path_names) + + Open the named resource for binary reading. + + See *note the introduction: 4579. for details on 'anchor' and + 'path_names'. + + This function returns a *note BinaryIO: 3fb1. object, that is, a + binary stream open for reading. + + This function is roughly equivalent to: + + files(anchor).joinpath(*path_names).open('rb') + + Changed in version 3.13: Multiple 'path_names' are accepted. + + -- Function: 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: 4579. for details on 'anchor' and + 'path_names'. 'encoding' and 'errors' have the same meaning as in + built-in *note open(): 517. + + 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: 3fb0. object, that is, a text + stream open for reading. + + This function is roughly equivalent to: + + files(anchor).joinpath(*path_names).open('r', encoding=encoding) + + Changed in version 3.13: Multiple 'path_names' are accepted. + 'encoding' and 'errors' must be given as keyword arguments. + + -- Function: importlib.resources.read_binary (anchor, *path_names) + + Read and return the contents of the named resource as *note bytes: + 1c2. + + See *note the introduction: 4579. for details on 'anchor' and + 'path_names'. + + This function is roughly equivalent to: + + files(anchor).joinpath(*path_names).read_bytes() + + Changed in version 3.13: Multiple 'path_names' are accepted. + + -- Function: importlib.resources.read_text (anchor, *path_names, + encoding='utf-8', errors='strict') + + Read and return the contents of the named resource as *note str: + 447. By default, the contents are read as strict UTF-8. + + See *note the introduction: 4579. for details on 'anchor' and + 'path_names'. 'encoding' and 'errors' have the same meaning as in + built-in *note open(): 517. + + 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) + + Changed in version 3.13: Multiple 'path_names' are accepted. + 'encoding' and 'errors' must be given as keyword arguments. + + -- Function: 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: + 5ce. statement. The context manager provides a *note pathlib.Path: + 22b. 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(): 81f. 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: 4579. for details on 'anchor' and + 'path_names'. + + This function is roughly equivalent to: + + as_file(files(anchor).joinpath(*path_names)) + + Changed in version 3.13: Multiple 'path_names' are accepted. + 'encoding' and 'errors' must be given as keyword arguments. + + -- Function: 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: 4579. for details on 'anchor' and + 'path_names'. + + This function is roughly equivalent to: + + files(anchor).joinpath(*path_names).is_file() + + Changed in version 3.13: Multiple 'path_names' are accepted. + + -- Function: 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: 447. The iterable + does not recurse into subdirectories. + + See *note the introduction: 4579. 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 + + Deprecated since version 3.11: Prefer ‘iterdir()’ as above, which + offers more control over the results and richer functionality. + + +File: python.info, Node: importlib resources abc – Abstract base classes for resources, Next: importlib metadata – Accessing package metadata, Prev: importlib resources – Package resource reading opening and access, Up: Importing Modules + +5.32.7 ‘importlib.resources.abc’ – Abstract base classes for resources +---------------------------------------------------------------------- + +'Source code:' Lib/importlib/resources/abc.py(1) + +__________________________________________________________________ + +Added in version 3.11. + + -- Class: importlib.resources.abc.ResourceReader + + 'Superseded by TraversableResources' + + An *note abstract base class: 11a8. to provide the ability to read + 'resources'. + + 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: 2a2. 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: 671. An object compatible with this ABC should only be + returned when the specified module is a package. + + Deprecated since version 3.12: Use *note + importlib.resources.abc.TraversableResources: 2c8. instead. + + -- Method: abstractmethod open_resource (resource) + + Returns an opened, *note file-like object: 258f. for binary + reading of the 'resource'. + + If the resource cannot be found, *note FileNotFoundError: 427. + is raised. + + -- Method: abstractmethod resource_path (resource) + + Returns the file system path to the 'resource'. + + If the resource does not concretely exist on the file system, + raise *note FileNotFoundError: 427. + + -- Method: abstractmethod is_resource (name) + + Returns ‘True’ if the named 'name' is considered a resource. + *note FileNotFoundError: 427. is raised if 'name' does not + exist. + + -- Method: abstractmethod contents () + + Returns an *note iterable: 121a. 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(): + 457e. 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. + + -- Class: importlib.resources.abc.Traversable + + An object with a subset of *note pathlib.Path: 22b. methods + suitable for traversing directories and opening files. + + For a representation of the object on the file-system, use *note + importlib.resources.as_file(): 489. + + -- Attribute: name + + Abstract. The base name of this object without any parent + references. + + -- Method: abstractmethod iterdir () + + Yield Traversable objects in self. + + -- Method: abstractmethod is_dir () + + Return ‘True’ if self is a directory. + + -- Method: abstractmethod is_file () + + Return ‘True’ if self is a file. + + -- Method: 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') + + Changed in version 3.11: ‘joinpath’ accepts multiple + 'pathsegments', and these segments may contain forward slashes + as path separators. Previously, only a single 'child' + argument was accepted. + + -- Method: abstractmethod __truediv__ (child) + + Return Traversable child in self. Equivalent to + ‘joinpath(child)’. + + -- Method: 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: + 27cb.). + + When opening as text, accepts encoding parameters such as + those accepted by *note io.TextIOWrapper: 7b6. + + -- Method: read_bytes () + + Read contents of self as bytes. + + -- Method: read_text (encoding=None) + + Read contents of self as text. + + -- Class: importlib.resources.abc.TraversableResources + + An abstract base class for resource readers capable of serving the + *note importlib.resources.files(): 48a. interface. Subclasses + *note ResourceReader: 4531. 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. + + -- Method: abstractmethod files () + + Returns a *note importlib.resources.abc.Traversable: 1f5. + object for the loaded package. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/importlib/resources/abc.py + + +File: python.info, Node: importlib metadata – Accessing package metadata, Next: The initialization of the sys path module search path, Prev: importlib resources abc – Abstract base classes for resources, Up: Importing Modules + +5.32.8 ‘importlib.metadata’ – Accessing package metadata +-------------------------------------------------------- + +Added in version 3.8. + +Changed in version 3.10: ‘importlib.metadata’ is no longer provisional. + +'Source code:' Lib/importlib/metadata/__init__.py(1) + +‘importlib.metadata’ is a library that provides access to the metadata +of an installed Distribution Package(2), such as its entry points or its +top-level names (Import Package(3)s, modules, if any). Built in part on +Python’s import system, this library intends to replace similar +functionality in the entry point API(4) and metadata API(5) of +‘pkg_resources’. Along with *note importlib.resources: 7b, this package +can eliminate the need to use the older and less efficient +‘pkg_resources’ package. + +‘importlib.metadata’ operates on third-party 'distribution packages' +installed into Python’s ‘site-packages’ directory via tools such as +pip(6). Specifically, it works with distributions with discoverable +‘dist-info’ or ‘egg-info’ directories, and metadata defined by the Core +metadata specifications(7). + + Important: These are 'not' necessarily equivalent to or correspond + 1:1 with the top-level 'import package' names that can be imported + inside Python code. One 'distribution package' can contain + multiple 'import packages' (and single modules), and one top-level + 'import package' may map to multiple 'distribution packages' if it + is a namespace package. You can use *note + packages_distributions(): 80c. to get a mapping between them. + +By default, distribution metadata can live on the file system or in zip +archives on *note sys.path: 3b0. Through an extension mechanism, the +metadata can live almost anywhere. + +See also +........ + +‘https://importlib-metadata.readthedocs.io/’ + + The documentation for ‘importlib_metadata’, which supplies a + backport of ‘importlib.metadata’. This includes an API + reference(8) for this module’s classes and functions, as well as a + migration guide(9) for existing users of ‘pkg_resources’. + +* Menu: + +* Overview: Overview<3>. +* Functional API: Functional API<2>. +* Distributions:: +* Distribution Discovery:: +* Extending the search algorithm:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/importlib/metadata/__init__.py + + (2) +https://packaging.python.org/en/latest/glossary/#term-Distribution-Package + + (3) +https://packaging.python.org/en/latest/glossary/#term-Import-Package + + (4) +https://setuptools.readthedocs.io/en/latest/pkg_resources.html#entry-points + + (5) +https://setuptools.readthedocs.io/en/latest/pkg_resources.html#metadata-api + + (6) https://pypi.org/project/pip/ + + (7) +https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata + + (8) https://importlib-metadata.readthedocs.io/en/latest/api.html + + (9) +https://importlib-metadata.readthedocs.io/en/latest/migration.html + + +File: python.info, Node: Overview<3>, Next: Functional API<2>, Up: importlib metadata – Accessing package metadata + +5.32.8.1 Overview +................. + +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 + +You can get the version string for ‘wheel’ by running the following: + + (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: 286. objects. + +You can get the *note metadata for a distribution: 458e.: + + >>> 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'] + +You can also get a *note distribution’s version number: 458f, list its +*note constituent files: 4590, and get a list of the distribution’s +*note Distribution requirements: 4591. + + -- Exception: importlib.metadata.PackageNotFoundError + + Subclass of *note ModuleNotFoundError: b47. 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: Functional API<2>, Next: Distributions, Prev: Overview<3>, Up: importlib metadata – Accessing package metadata + +5.32.8.2 Functional API +....................... + +This package provides the following functionality via its public API. + +* Menu: + +* Entry points:: +* Distribution metadata:: +* Distribution versions:: +* Distribution files:: +* Distribution requirements:: +* Mapping import to distribution packages:: + + +File: python.info, Node: Entry points, Next: Distribution metadata, Up: Functional API<2> + +5.32.8.3 Entry points +..................... + + -- Function: importlib.metadata.entry_points (**select_params) + + Returns a *note EntryPoints: 4596. instance describing entry points + for the current environment. Any given keyword parameters are + passed to the ‘select()’ method for comparison to the attributes of + the individual entry point definitions. + + Note: it is not currently possible to query for entry points based + on their ‘EntryPoint.dist’ attribute (as different ‘Distribution’ + instances do not currently compare equal, even if they have the + same attributes) + + -- Class: 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. + + -- Class: 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. + +Query all entry points: + + >>> 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') + +Pick out a specific script named “wheel” (found in the wheel project): + + >>> 'wheel' in scripts.names + True + >>> wheel = scripts['wheel'] + +Equivalently, query for that entry point during selection: + + >>> (wheel,) = entry_points(group='console_scripts', name='wheel') + >>> (wheel,) = entry_points().select(group='console_scripts', name='wheel') + +Inspect the resolved entry point: + + >>> 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. + +Changed in version 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. + +Changed in version 3.13: ‘EntryPoint’ objects no longer present a +tuple-like interface (*note __getitem__(): 285.). + + ---------- 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: Distribution metadata, Next: Distribution versions, Prev: Entry points, Up: Functional API<2> + +5.32.8.4 Distribution metadata +.............................. + + -- Function: importlib.metadata.metadata (distribution_name) + + Return the distribution metadata corresponding to the named + distribution package as a *note PackageMetadata: 459a. instance. + + Raises *note PackageNotFoundError: 4592. if the named distribution + package is not installed in the current Python environment. + + -- Class: 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: 459a. 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. + +Changed in version 3.10: The ‘Description’ is now included in the +metadata when presented through the payload. Line continuation +characters have been removed. + +The ‘json’ attribute was added. + + ---------- 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: Distribution versions, Next: Distribution files, Prev: Distribution metadata, Up: Functional API<2> + +5.32.8.5 Distribution versions +.............................. + + -- Function: importlib.metadata.version (distribution_name) + + Return the installed distribution package version(1) for the named + distribution package. + + Raises *note PackageNotFoundError: 4592. 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: Distribution files, Next: Distribution requirements, Prev: Distribution versions, Up: Functional API<2> + +5.32.8.6 Distribution files +........................... + + -- Function: importlib.metadata.files (distribution_name) + + Return the full set of files contained within the named + distribution package. + + Raises *note PackageNotFoundError: 4592. if the named distribution + package is not installed in the current Python environment. + + Returns *note None: 671. if the distribution is found but the + installation database records reporting the files associated with + the distribuion package are missing. + + -- Class: importlib.metadata.PackagePath + + A *note pathlib.PurePath: 4a2. derived object with additional + ‘dist’, ‘size’, and ‘hash’ properties corresponding to the + distribution package’s installation metadata for that file. + +The ‘files()’ function takes a Distribution Package(1) name and returns +all of the files installed by this distribution. Each file is reported +as a *note PackagePath: 459e. instance. For example: + + >>> util = [p for p in files('wheel') if 'util.py' in str(p)][0] + >>> util + PackagePath('wheel/util.py') + >>> util.size + 859 + >>> util.dist + <importlib.metadata._hooks.PathDistribution object at 0x101e0cef0> + >>> util.hash + <FileHash mode: sha256 value: bYkw5oMccfazVCoYQwKkkemoVyMAFoR34mmKBx8R1NI> + +Once you have the file, you can also read its contents: + + >>> 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: 671. 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: Distribution requirements, Next: Mapping import to distribution packages, Prev: Distribution files, Up: Functional API<2> + +5.32.8.7 Distribution requirements +.................................. + + -- Function: importlib.metadata.requires (distribution_name) + + Return the declared dependency specifiers for the named + distribution package. + + Raises *note PackageNotFoundError: 4592. 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: Distribution requirements, Up: Functional API<2> + +5.32.8.8 Mapping import to distribution packages +................................................ + + -- Function: importlib.metadata.packages_distributions () + + Return a mapping from the top level module and import package names + found via *note sys.meta_path: d2b. 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. + +A convenience method to resolve the Distribution Package(1) name (or +names, in the case of a namespace package) that provide each importable +top-level Python module or Import Package(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/en/latest/glossary/#term-Distribution-Package + + (2) +https://packaging.python.org/en/latest/glossary/#term-Import-Package + + (3) https://github.com/pypa/packaging-problems/issues/609 + + +File: python.info, Node: Distributions, Next: Distribution Discovery, Prev: Functional API<2>, Up: importlib metadata – Accessing package metadata + +5.32.8.9 Distributions +...................... + + -- Function: importlib.metadata.distribution (distribution_name) + + Return a *note Distribution: 45a6. instance describing the named + distribution package. + + Raises *note PackageNotFoundError: 4592. if the named distribution + package is not installed in the current Python environment. + + -- Class: importlib.metadata.Distribution + + Details of an installed distribution package. + + Note: different ‘Distribution’ instances do not currently compare + equal, even if they relate to the same installed distribution and + accordingly have the same attributes. + +While the module level API described above is the most common and +convenient usage, you can get all of that information from the +‘Distribution’ class. ‘Distribution’ is an abstract object that +represents the metadata for a Python Distribution Package(1). You can +get the concrete ‘Distribution’ subclass instance for an installed +distribution package by calling the *note distribution(): 45a5. +function: + + >>> from importlib.metadata import distribution + >>> dist = distribution('wheel') + >>> type(dist) + <class 'importlib.metadata.PathDistribution'> + +Thus, an alternative way to get the version number is through the +‘Distribution’ instance: + + >>> dist.version + '0.32.3' + +There are all kinds of additional metadata available on ‘Distribution’ +instances: + + >>> dist.metadata['Requires-Python'] + '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*' + >>> dist.metadata['License'] + 'MIT' + +For editable packages, an ‘origin’ property may present PEP 610(2) +metadata: + + >>> dist.origin.url + 'file:///path/to/wheel-0.32.3.editable-py3-none-any.whl' + +The full set of available metadata is not described here. See the PyPA +Core metadata specification(3) for additional details. + +Added in version 3.13: The ‘.origin’ property was added. + + ---------- Footnotes ---------- + + (1) +https://packaging.python.org/en/latest/glossary/#term-Distribution-Package + + (2) https://peps.python.org/pep-0610/ + + (3) +https://packaging.python.org/en/latest/specifications/core-metadata/#core-metadata + + +File: python.info, Node: Distribution Discovery, Next: Extending the search algorithm, Prev: Distributions, Up: importlib metadata – Accessing package metadata + +5.32.8.10 Distribution Discovery +................................ + +By default, this package provides built-in support for discovery of +metadata for file system and zip file Distribution Package(1)s. This +metadata finder search defaults to ‘sys.path’, but varies slightly in +how it interprets those values from how other import machinery does. In +particular: + + - ‘importlib.metadata’ does not honor *note bytes: 1c2. objects on + ‘sys.path’. + + - ‘importlib.metadata’ will incidentally honor *note pathlib.Path: + 22b. objects on ‘sys.path’ even though such values will be ignored + for imports. + + ---------- Footnotes ---------- + + (1) +https://packaging.python.org/en/latest/glossary/#term-Distribution-Package + + +File: python.info, Node: Extending the search algorithm, Prev: Distribution Discovery, Up: importlib metadata – Accessing package metadata + +5.32.8.11 Extending the search algorithm +........................................ + +Because Distribution Package(1) metadata is not available through *note +sys.path: 3b0. searches, or package loaders directly, the metadata for a +distribution is found through import system *note finders: 1ff3. To +find a distribution package’s metadata, ‘importlib.metadata’ queries the +list of *note meta path finders: 1069. on *note sys.meta_path: d2b. + +By default ‘importlib.metadata’ installs a finder for distribution +packages found on the file system. This finder doesn’t actually find +any 'distributions', but it can find their metadata. + +The abstract class *note importlib.abc.MetaPathFinder: 86b. 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: +d2b. and presents this extended interface as the ‘DistributionFinder’ +abstract base class, which defines this abstract method: + + @abc.abstractmethod + def find_distributions(context=DistributionFinder.Context()): + """Return an iterable of all Distribution instances capable of + loading the metadata for packages for the indicated ``context``. + """ + +The ‘DistributionFinder.Context’ object provides ‘.path’ and ‘.name’ +properties indicating the path to search and name to match and may +supply other relevant context. + +What this means in practice is that 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: + +* Example: Example<14>. + + ---------- Footnotes ---------- + + (1) +https://packaging.python.org/en/latest/glossary/#term-Distribution-Package + + +File: python.info, Node: Example<14>, Up: Extending the search algorithm + +5.32.8.12 Example +................. + +Consider for example a custom finder that loads Python modules from a +database: + + class DatabaseImporter(importlib.abc.MetaPathFinder): + def __init__(self, db): + self.db = db + + def find_spec(self, fullname, target=None) -> ModuleSpec: + return self.db.spec_from_name(fullname) + + sys.meta_path.append(DatabaseImporter(connect_db(...))) + +That importer now presumably provides importable modules from a +database, but it provides no metadata or entry points. For this custom +importer to provide metadata, it would also need to implement +‘DistributionFinder’: + + from importlib.metadata import DistributionFinder + + class DatabaseImporter(DistributionFinder): + ... + + def find_distributions(self, context=DistributionFinder.Context()): + query = dict(name=context.name) if context.name else {} + for dist_record in self.db.query_distributions(query): + yield DatabaseDistribution(dist_record) + +In this way, ‘query_distributions’ would return records for each +distribution served by the database matching the query. For example, if +‘requests-1.0’ is in the database, ‘find_distributions’ would yield a +‘DatabaseDistribution’ for ‘Context(name='requests')’ or +‘Context(name=None)’. + +For the sake of simplicity, this example ignores ‘context.path’. The +‘path’ attribute defaults to ‘sys.path’ and is the set of import paths +to be considered in the search. A ‘DatabaseImporter’ could potentially +function without any concern for a search path. Assuming the importer +does no partitioning, the “path” would be irrelevant. In order to +illustrate the purpose of ‘path’, the example would need to illustrate a +more complex ‘DatabaseImporter’ whose behavior varied depending on +‘sys.path’/‘PYTHONPATH’. In that case, the ‘find_distributions’ should +honor the ‘context.path’ and only yield ‘Distribution’s pertinent to +that path. + +‘DatabaseDistribution’, then, would look something like: + + class DatabaseDistribution(importlib.metadata.Distribution): + def __init__(self, record): + self.record = record + + def read_text(self, filename): + """ + Read a file like "METADATA" for the current distribution. + """ + if filename == "METADATA": + return f"""Name: {self.record.name} + Version: {self.record.version} + """ + if filename == "entry_points.txt": + return "\n".join( + f"""[{ep.group}]\n{ep.name}={ep.value}""" + for ep in self.record.entry_points) + + def locate_file(self, path): + raise RuntimeError("This distribution has no file system") + +This basic implementation should provide metadata and entry points for +packages served by the ‘DatabaseImporter’, assuming that the ‘record’ +supplies suitable ‘.name’, ‘.version’, and ‘.entry_points’ attributes. + +The ‘DatabaseDistribution’ may also provide other metadata files, like +‘RECORD’ (required for ‘Distribution.files’) or override the +implementation of ‘Distribution.files’. See the source for more +inspiration. + + +File: python.info, Node: The initialization of the sys path module search path, Prev: importlib metadata – Accessing package metadata, Up: Importing Modules + +5.32.9 The initialization of the ‘sys.path’ module search path +-------------------------------------------------------------- + +A module search path is initialized when Python starts. This module +search path may be accessed at *note sys.path: 3b0. + +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: 5dc. command, or *note -m: 5dd. module. + +The *note PYTHONPATH: 1016. 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: *note PYTHONPATH: 1016. will affect all installed Python + versions/environments. Be wary of setting this in your shell + profile or global environment variables. The *note site: c7. + 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: 45ac.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: 3b8. 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: 938. and *note PYTHONPLATLIBDIR: 1940. + +Once found, ‘prefix’ and ‘exec_prefix’ are available at *note +sys.prefix: 3b2. and *note sys.exec_prefix: 3ae. respectively. + +Finally, the *note site: c7. module is processed and ‘site-packages’ +directories are added to the module search path. A common way to +customize the search path is to create *note sitecustomize: c8. or *note +usercustomize: 10e. modules as described in the *note site: c7. module +documentation. + + Note: Certain command line options may further affect path + calculations. See *note -E: 95d, *note -I: 95e, *note -s: 1377. + and *note -S: 119b. for further details. + +* Menu: + +* Virtual environments: Virtual environments<2>. +* _pth files:: +* Embedded Python:: + + +File: python.info, Node: Virtual environments<2>, Next: _pth files, Up: The initialization of the sys path module search path + +5.32.9.1 Virtual environments +............................. + +If Python is run in a virtual environment (as described at *note Virtual +Environments and Packages: 1cfe.) then ‘prefix’ and ‘exec_prefix’ are +specific to the virtual environment. + +If a ‘pyvenv.cfg’ file is found alongside the main executable, or in the +directory one level above the executable, the following variations +apply: + + * If ‘home’ is an absolute path and *note PYTHONHOME: 3b8. is not + set, this path is used instead of the path to the main executable + when deducing ‘prefix’ and ‘exec_prefix’. + + +File: python.info, Node: _pth files, Next: Embedded Python, Prev: Virtual environments<2>, Up: The initialization of the sys path module search path + +5.32.9.2 _pth files +................... + +To completely override *note sys.path: 3b0. create a ‘._pth’ file with +the same name as the shared library or executable (‘python._pth’ or +‘python311._pth’). The shared library path is always known on Windows, +however it may not be available on other platforms. In the ‘._pth’ file +specify one line for each path to add to *note sys.path: 3b0. 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. + +When the file exists, all registry and environment variables are +ignored, isolated mode is enabled, and *note site: c7. is not imported +unless one line in the file specifies ‘import site’. Blank paths and +lines starting with ‘#’ are ignored. Each path may be absolute or +relative to the location of the file. Import statements other than to +‘site’ are not permitted, and arbitrary code cannot be specified. + +Note that ‘.pth’ files (without leading underscore) will be processed +normally by the *note site: c7. module when ‘import site’ has been +specified. + + +File: python.info, Node: Embedded Python, Prev: _pth files, Up: The initialization of the sys path module search path + +5.32.9.3 Embedded Python +........................ + +If Python is embedded within another application *note +Py_InitializeFromConfig(): 3c1. and the *note PyConfig: 3a2. structure +can be used to initialize Python. The path specific details are +described at *note Python Path Configuration: 8ac. + +See also +........ + + * *note Finding modules: c21. for detailed Windows notes. + + * *note Using Python on Unix platforms: 1d58. for Unix details. + + +File: python.info, Node: Python Language Services, Next: MS Windows Specific Services, Prev: Importing Modules, Up: The Python Standard Library + +5.33 Python Language Services +============================= + +Python provides a number of modules to assist in working with the Python +language. These modules support tokenizing, parsing, syntax analysis, +bytecode disassembly, and various other facilities. + +These modules include: + +* Menu: + +* ast — Abstract Syntax Trees:: +* symtable — Access to the compiler’s symbol tables:: +* token — Constants used with Python parse trees:: +* keyword — Testing for Python keywords:: +* tokenize — Tokenizer for Python source:: +* tabnanny — Detection of ambiguous indentation:: +* pyclbr — Python module browser support:: +* py_compile — Compile Python source files:: +* compileall — Byte-compile Python libraries:: +* dis — Disassembler for Python bytecode:: +* pickletools — Tools for pickle developers:: + + +File: python.info, Node: ast — Abstract Syntax Trees, Next: symtable — Access to the compiler’s symbol tables, Up: Python Language Services + +5.33.1 ‘ast’ — Abstract Syntax Trees +------------------------------------ + +'Source code:' Lib/ast.py(1) + +__________________________________________________________________ + +The *note ast: 8. 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. + +An abstract syntax tree can be generated by passing *note +ast.PyCF_ONLY_AST: 45b5. as a flag to the *note compile(): 192. built-in +function, or using the *note parse(): 1a8. helper provided in this +module. The result will be a tree of objects whose classes all inherit +from *note ast.AST: 1a6. An abstract syntax tree can be compiled into a +Python code object using the built-in *note compile(): 192. function. + +* Menu: + +* Abstract Grammar:: +* Node classes:: +* ast Helpers:: +* Compiler Flags:: +* Command-Line Usage: Command-Line Usage<4>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/ast.py + + +File: python.info, Node: Abstract Grammar, Next: Node classes, Up: ast — Abstract Syntax Trees + +5.33.1.1 Abstract Grammar +......................... + +The abstract grammar is currently defined as follows: + + -- ASDL's 4 builtin types are: + -- identifier, int, string, constant + + module Python + { + mod = Module(stmt* body, type_ignore* type_ignores) + | Interactive(stmt* body) + | Expression(expr body) + | FunctionType(expr* argtypes, expr returns) + + stmt = FunctionDef(identifier name, arguments args, + stmt* body, expr* decorator_list, expr? returns, + string? type_comment, type_param* type_params) + | AsyncFunctionDef(identifier name, arguments args, + stmt* body, expr* decorator_list, expr? returns, + string? type_comment, type_param* type_params) + + | ClassDef(identifier name, + expr* bases, + keyword* keywords, + stmt* body, + expr* decorator_list, + type_param* type_params) + | Return(expr? value) + + | Delete(expr* targets) + | Assign(expr* targets, expr value, string? type_comment) + | TypeAlias(expr name, type_param* type_params, expr value) + | AugAssign(expr target, operator op, expr value) + -- 'simple' indicates that we annotate simple name without parens + | AnnAssign(expr target, expr annotation, expr? value, int simple) + + -- use 'orelse' because else is a keyword in target languages + | For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment) + | AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment) + | While(expr test, stmt* body, stmt* orelse) + | If(expr test, stmt* body, stmt* orelse) + | With(withitem* items, stmt* body, string? type_comment) + | AsyncWith(withitem* items, stmt* body, string? type_comment) + + | Match(expr subject, match_case* cases) + + | Raise(expr? exc, expr? cause) + | Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) + | TryStar(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody) + | Assert(expr test, expr? msg) + + | Import(alias* names) + | ImportFrom(identifier? module, alias* names, int? level) + + | Global(identifier* names) + | Nonlocal(identifier* names) + | Expr(expr value) + | Pass | Break | Continue + + -- col_offset is the byte offset in the utf8 string the parser uses + attributes (int lineno, int col_offset, int? end_lineno, int? end_col_offset) + + -- BoolOp() can use left & right? + expr = BoolOp(boolop op, expr* values) + | NamedExpr(expr target, expr value) + | BinOp(expr left, operator op, expr right) + | UnaryOp(unaryop op, expr operand) + | Lambda(arguments args, expr body) + | IfExp(expr test, expr body, expr orelse) + | Dict(expr* keys, expr* values) + | Set(expr* elts) + | ListComp(expr elt, comprehension* generators) + | SetComp(expr elt, comprehension* generators) + | DictComp(expr key, expr value, comprehension* generators) + | GeneratorExp(expr elt, comprehension* generators) + -- the grammar constrains where yield expressions can occur + | Await(expr value) + | Yield(expr? value) + | YieldFrom(expr value) + -- need sequences for compare to distinguish between + -- x < 4 < 3 and (x < 4) < 3 + | Compare(expr left, cmpop* ops, expr* comparators) + | Call(expr func, expr* args, keyword* keywords) + | FormattedValue(expr value, int conversion, expr? format_spec) + | JoinedStr(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 classes, Next: ast Helpers, Prev: Abstract Grammar, Up: ast — Abstract Syntax Trees + +5.33.1.2 Node classes +..................... + + -- Class: ast.AST + + This is the base of all AST node classes. The actual node classes + are derived from the ‘Parser/Python.asdl’ file, which is reproduced + *note above: 45b6. They are defined in the ‘_ast’ C module and + re-exported in *note ast: 8. + + There is one class defined for each left-hand side symbol in the + abstract grammar (for example, ‘ast.stmt’ or ‘ast.expr’). In + addition, there is one class defined for each constructor on the + right-hand side; these classes inherit from the classes for the + left-hand side trees. For example, *note ast.BinOp: 19cc. inherits + from ‘ast.expr’. For production rules with alternatives (aka + “sums”), the left-hand side class is abstract: only instances of + specific constructor nodes are ever created. + + -- Attribute: _fields + + Each concrete class has an attribute ‘_fields’ which gives the + names of all child nodes. + + Each instance of a concrete class has one attribute for each + child node, of the type as defined in the grammar. For + example, *note ast.BinOp: 19cc. instances have an attribute + ‘left’ of type ‘ast.expr’. + + If these attributes are marked as optional in the grammar + (using a question mark), the value might be ‘None’. If the + attributes can have zero-or-more values (marked with an + asterisk), the values are represented as Python lists. All + possible attributes must be present and have valid values when + compiling an AST with *note compile(): 192. + + -- Attribute: _field_types + + The ‘_field_types’ attribute on each concrete class is a + dictionary mapping field names (as also listed in *note + _fields: 15a4.) to their types. + + >>> ast.TypeVar._field_types + {'name': <class 'str'>, 'bound': ast.expr | None, 'default_value': ast.expr | None} + + Added in version 3.13. + + -- Attribute: lineno + -- Attribute: col_offset + -- Attribute: end_lineno + -- Attribute: end_col_offset + + Instances of ‘ast.expr’ and ‘ast.stmt’ subclasses have *note + lineno: 45b9, *note col_offset: 45ba, *note end_lineno: 45bb, + and *note end_col_offset: 45bc. attributes. The *note lineno: + 45b9. and *note end_lineno: 45bb. are the first and last line + numbers of source text span (1-indexed so the first line is + line 1) and the *note col_offset: 45ba. and *note + end_col_offset: 45bc. are the corresponding UTF-8 byte offsets + of the first and last tokens that generated the node. The + UTF-8 offset is recorded because the parser uses UTF-8 + internally. + + Note that the end positions are not required by the compiler + and are therefore optional. The end offset is 'after' the + last symbol, for example one can get the source segment of a + one-line expression node using ‘source_line[node.col_offset : + node.end_col_offset]’. + + The constructor of a class ‘ast.T’ parses its arguments as follows: + + * If there are positional arguments, there must be as many as + there are items in ‘T._fields’; they will be assigned as + attributes of these names. + + * If there are keyword arguments, they will set the attributes + of the same names to the given values. + + For example, to create and populate an *note ast.UnaryOp: 45bd. + node, you could use + + 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(): 1a4. If any other field + is omitted, a *note DeprecationWarning: 1a5. is raised and the AST + node will not have this field. In Python 3.15, this condition will + raise an error. + +Changed in version 3.8: Class *note ast.Constant: 2bb. is now used for +all constants. + +Changed in version 3.9: Simple indices are represented by their value, +extended slices are represented as tuples. + +Deprecated since version 3.8: Old classes ‘ast.Num’, ‘ast.Str’, +‘ast.Bytes’, ‘ast.NameConstant’ and ‘ast.Ellipsis’ are still available, +but they will be removed in future Python releases. In the meantime, +instantiating them will return an instance of a different class. + +Deprecated since version 3.9: Old classes ‘ast.Index’ and ‘ast.ExtSlice’ +are still available, but they will be removed in future Python releases. +In the meantime, instantiating them will return an instance of a +different class. + +Deprecated since version 3.13, will be removed in version 3.15: Previous +versions of Python allowed the creation of AST nodes that were missing +required fields. Similarly, AST node constructors allowed arbitrary +keyword arguments that were set as attributes of the AST node, even if +they did not match any of the fields of the AST node. This behavior is +deprecated and will be removed in Python 3.15. + + Note: The descriptions of the specific node classes displayed here + were initially adapted from the fantastic Green Tree Snakes(1) + project and all its contributors. + +* Menu: + +* Root nodes:: +* Literals: Literals<3>. +* Variables:: +* Expressions: Expressions<2>. +* Statements:: +* Control flow:: +* Pattern matching:: +* Type annotations:: +* Type parameters:: +* Function and class definitions:: +* Async and await:: + + ---------- Footnotes ---------- + + (1) https://greentreesnakes.readthedocs.io/en/latest/ + + +File: python.info, Node: Root nodes, Next: Literals<3>, Up: Node classes + +5.33.1.3 Root nodes +................... + + -- Class: ast.Module (body, type_ignores) + + A Python module, as with *note file input: 213e. Node type + generated by *note ast.parse(): 1a8. in the default ‘"exec"’ + 'mode'. + + ‘body’ is a *note list: 60d. of the module’s *note Statements: + 45c1. + + ‘type_ignores’ is a *note list: 60d. of the module’s type ignore + comments; see *note ast.parse(): 1a8. 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))]) + + -- Class: ast.Expression (body) + + A single Python *note expression input: 2144. Node type generated + by *note ast.parse(): 1a8. when 'mode' is ‘"eval"’. + + ‘body’ is a single node, one of the *note expression types: 45c3. + + >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4)) + Expression( + body=Constant(value=123)) + + -- Class: ast.Interactive (body) + + A single *note interactive input: 2141, like in *note Interactive + Mode: 16f. Node type generated by *note ast.parse(): 1a8. when + 'mode' is ‘"single"’. + + ‘body’ is a *note list: 60d. of *note statement nodes: 45c1. + + >>> 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))]) + + -- Class: 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(): 1a8. 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: 60d. of *note expression nodes: 45c3. + + ‘returns’ is a single *note expression node: 45c3. + + >>> print(ast.dump(ast.parse('(int, str) -> List[int]', mode='func_type'), indent=4)) + FunctionType( + argtypes=[ + Name(id='int', ctx=Load()), + Name(id='str', ctx=Load())], + returns=Subscript( + value=Name(id='List', ctx=Load()), + slice=Name(id='int', ctx=Load()), + ctx=Load())) + + Added in version 3.8. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0484/ + + +File: python.info, Node: Literals<3>, Next: Variables, Prev: Root nodes, Up: Node classes + +5.33.1.4 Literals +................. + + -- Class: ast.Constant (value) + + A constant value. The ‘value’ attribute of the ‘Constant’ literal + contains the Python object it represents. The values represented + can be instances of *note str: 447, *note bytes: 1c2, *note int: + 259, *note float: 2f1, *note complex: 2f2, and *note bool: 463, and + the constants *note None: 671. and *note Ellipsis: 2185. + + >>> print(ast.dump(ast.parse('123', mode='eval'), indent=4)) + Expression( + body=Constant(value=123)) + + -- Class: ast.FormattedValue (value, conversion, format_spec) + + Node representing a single formatting field in an f-string. If the + string contains a single formatting field and nothing else the node + can be isolated otherwise it appears in *note JoinedStr: 16ea. + + * ‘value’ is any expression node (such as a literal, a variable, + or a function call). + + * ‘conversion’ is an integer: + + * -1: no formatting + + * 115: ‘!s’ string formatting + + * 114: ‘!r’ repr formatting + + * 97: ‘!a’ ascii formatting + + * ‘format_spec’ is a *note JoinedStr: 16ea. 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. + + -- Class: ast.JoinedStr (values) + + An f-string, comprising a series of *note FormattedValue: 45c7. and + *note Constant: 2bb. nodes. + + >>> print(ast.dump(ast.parse('f"sin({a}) is {sin(a):.3}"', mode='eval'), indent=4)) + Expression( + body=JoinedStr( + values=[ + Constant(value='sin('), + FormattedValue( + value=Name(id='a', ctx=Load()), + conversion=-1), + Constant(value=') is '), + FormattedValue( + value=Call( + func=Name(id='sin', ctx=Load()), + args=[ + Name(id='a', ctx=Load())]), + conversion=-1, + format_spec=JoinedStr( + values=[ + Constant(value='.3')]))])) + + -- Class: ast.List (elts, ctx) + -- Class: ast.Tuple (elts, ctx) + + A list or tuple. ‘elts’ holds a list of nodes representing the + elements. ‘ctx’ is *note Store: 45ca. if the container is an + assignment target (i.e. ‘(x,y)=something’), and *note Load: 1a4. + otherwise. + + >>> print(ast.dump(ast.parse('[1, 2, 3]', mode='eval'), indent=4)) + Expression( + body=List( + elts=[ + Constant(value=1), + Constant(value=2), + Constant(value=3)], + ctx=Load())) + >>> print(ast.dump(ast.parse('(1, 2, 3)', mode='eval'), indent=4)) + Expression( + body=Tuple( + elts=[ + Constant(value=1), + Constant(value=2), + Constant(value=3)], + ctx=Load())) + + -- Class: ast.Set (elts) + + A set. ‘elts’ holds a list of nodes representing the set’s + elements. + + >>> 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)])) + + -- Class: ast.Dict (keys, values) + + A dictionary. ‘keys’ and ‘values’ hold lists of nodes representing + the keys and the values respectively, in matching order (what would + be returned when calling ‘dictionary.keys()’ and + ‘dictionary.values()’). + + When doing dictionary unpacking using dictionary literals the + expression to be expanded goes in the ‘values’ list, with a ‘None’ + at the corresponding position in ‘keys’. + + >>> print(ast.dump(ast.parse('{"a":1, **d}', mode='eval'), indent=4)) + Expression( + body=Dict( + keys=[ + Constant(value='a'), + None], + values=[ + Constant(value=1), + Name(id='d', ctx=Load())])) + + +File: python.info, Node: Variables, Next: Expressions<2>, Prev: Literals<3>, Up: Node classes + +5.33.1.5 Variables +.................. + + -- Class: ast.Name (id, ctx) + + A variable name. ‘id’ holds the name as a string, and ‘ctx’ is one + of the following types. + + -- Class: ast.Load + -- Class: ast.Store + -- Class: ast.Del + + Variable references can be used to load the value of a variable, to + assign a new value to it, or to delete it. Variable references are + given a context to distinguish these cases. + + >>> print(ast.dump(ast.parse('a'), indent=4)) + Module( + body=[ + Expr( + value=Name(id='a', ctx=Load()))]) + + >>> print(ast.dump(ast.parse('a = 1'), indent=4)) + Module( + body=[ + Assign( + targets=[ + Name(id='a', ctx=Store())], + value=Constant(value=1))]) + + >>> print(ast.dump(ast.parse('del a'), indent=4)) + Module( + body=[ + Delete( + targets=[ + Name(id='a', ctx=Del())])]) + + -- Class: ast.Starred (value, ctx) + + A ‘*var’ variable reference. ‘value’ holds the variable, typically + a *note Name: 193f. node. This type must be used when building a + *note Call: 45cf. node with ‘*args’. + + >>> print(ast.dump(ast.parse('a, *b = it'), indent=4)) + Module( + body=[ + Assign( + targets=[ + Tuple( + elts=[ + Name(id='a', ctx=Store()), + Starred( + value=Name(id='b', ctx=Store()), + ctx=Store())], + ctx=Store())], + value=Name(id='it', ctx=Load()))]) + + +File: python.info, Node: Expressions<2>, Next: Statements, Prev: Variables, Up: Node classes + +5.33.1.6 Expressions +.................... + + -- Class: ast.Expr (value) + + When an expression, such as a function call, appears as a statement + by itself with its return value not used or stored, it is wrapped + in this container. ‘value’ holds one of the other nodes in this + section, a *note Constant: 2bb, a *note Name: 193f, a *note Lambda: + 45d2, a *note Yield: 45d3. or *note YieldFrom: 45d4. node. + + >>> print(ast.dump(ast.parse('-a'), indent=4)) + Module( + body=[ + Expr( + value=UnaryOp( + op=USub(), + operand=Name(id='a', ctx=Load())))]) + + -- Class: ast.UnaryOp (op, operand) + + A unary operation. ‘op’ is the operator, and ‘operand’ any + expression node. + + -- Class: ast.UAdd + -- Class: ast.USub + -- Class: ast.Not + -- Class: ast.Invert + + Unary operator tokens. *note Not: 45d7. is the ‘not’ keyword, + *note Invert: 45d8. is the ‘~’ operator. + + >>> print(ast.dump(ast.parse('not x', mode='eval'), indent=4)) + Expression( + body=UnaryOp( + op=Not(), + operand=Name(id='x', ctx=Load()))) + + -- Class: ast.BinOp (left, op, right) + + A binary operation (like addition or division). ‘op’ is the + operator, and ‘left’ and ‘right’ are any expression nodes. + + >>> print(ast.dump(ast.parse('x + y', mode='eval'), indent=4)) + Expression( + body=BinOp( + left=Name(id='x', ctx=Load()), + op=Add(), + right=Name(id='y', ctx=Load()))) + + -- Class: ast.Add + -- Class: ast.Sub + -- Class: ast.Mult + -- Class: ast.Div + -- Class: ast.FloorDiv + -- Class: ast.Mod + -- Class: ast.Pow + -- Class: ast.LShift + -- Class: ast.RShift + -- Class: ast.BitOr + -- Class: ast.BitXor + -- Class: ast.BitAnd + -- Class: ast.MatMult + + Binary operator tokens. + + -- Class: ast.BoolOp (op, values) + + A boolean operation, ‘or’ or ‘and’. ‘op’ is *note Or: 45e7. or + *note And: 45e8. ‘values’ are the values involved. Consecutive + operations with the same operator, such as ‘a or b or c’, are + collapsed into one node with several values. + + This doesn’t include ‘not’, which is a *note UnaryOp: 45bd. + + >>> print(ast.dump(ast.parse('x or y', mode='eval'), indent=4)) + Expression( + body=BoolOp( + op=Or(), + values=[ + Name(id='x', ctx=Load()), + Name(id='y', ctx=Load())])) + + -- Class: ast.And + -- Class: ast.Or + + Boolean operator tokens. + + -- Class: ast.Compare (left, ops, comparators) + + A comparison of two or more values. ‘left’ is the first value in + the comparison, ‘ops’ the list of operators, and ‘comparators’ the + list of values after the first element in the comparison. + + >>> print(ast.dump(ast.parse('1 <= a < 10', mode='eval'), indent=4)) + Expression( + body=Compare( + left=Constant(value=1), + ops=[ + LtE(), + Lt()], + comparators=[ + Name(id='a', ctx=Load()), + Constant(value=10)])) + + -- Class: ast.Eq + -- Class: ast.NotEq + -- Class: ast.Lt + -- Class: ast.LtE + -- Class: ast.Gt + -- Class: ast.GtE + -- Class: ast.Is + -- Class: ast.IsNot + -- Class: ast.In + -- Class: ast.NotIn + + Comparison operator tokens. + + -- Class: ast.Call (func, args, keywords) + + A function call. ‘func’ is the function, which will often be a + *note Name: 193f. or *note Attribute: 45f4. object. Of the + arguments: + + * ‘args’ holds a list of the arguments passed by position. + + * ‘keywords’ holds a list of *note keyword: 45f5. objects + representing arguments passed by keyword. + + The ‘args’ and ‘keywords’ arguments are optional and default to + empty lists. + + >>> print(ast.dump(ast.parse('func(a, b=c, *d, **e)', mode='eval'), indent=4)) + Expression( + body=Call( + func=Name(id='func', ctx=Load()), + args=[ + Name(id='a', ctx=Load()), + Starred( + value=Name(id='d', ctx=Load()), + ctx=Load())], + keywords=[ + keyword( + arg='b', + value=Name(id='c', ctx=Load())), + keyword( + value=Name(id='e', ctx=Load()))])) + + -- Class: ast.keyword (arg, value) + + A keyword argument to a function call or class definition. ‘arg’ + is a raw string of the parameter name, ‘value’ is a node to pass + in. + + -- Class: ast.IfExp (test, body, orelse) + + An expression such as ‘a if b else c’. Each field holds a single + node, so in the following example, all three are *note Name: 193f. + nodes. + + >>> print(ast.dump(ast.parse('a if b else c', mode='eval'), indent=4)) + Expression( + body=IfExp( + test=Name(id='b', ctx=Load()), + body=Name(id='a', ctx=Load()), + orelse=Name(id='c', ctx=Load()))) + + -- Class: ast.Attribute (value, attr, ctx) + + Attribute access, e.g. ‘d.keys’. ‘value’ is a node, typically a + *note Name: 193f. ‘attr’ is a bare string giving the name of the + attribute, and ‘ctx’ is *note Load: 1a4, *note Store: 45ca. or + *note Del: 45cd. according to how the attribute is acted on. + + >>> print(ast.dump(ast.parse('snake.colour', mode='eval'), indent=4)) + Expression( + body=Attribute( + value=Name(id='snake', ctx=Load()), + attr='colour', + ctx=Load())) + + -- Class: ast.NamedExpr (target, value) + + A named expression. This AST node is produced by the assignment + expressions operator (also known as the walrus operator). As + opposed to the *note Assign: 45f8. node in which the first argument + can be multiple nodes, in this case both ‘target’ and ‘value’ must + be single nodes. + + >>> 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:: +* Comprehensions:: + + +File: python.info, Node: Subscripting, Next: Comprehensions, Up: Expressions<2> + +5.33.1.7 Subscripting +..................... + + -- Class: ast.Subscript (value, slice, ctx) + + A subscript, such as ‘l[1]’. ‘value’ is the subscripted object + (usually sequence or mapping). ‘slice’ is an index, slice or key. + It can be a *note Tuple: 45c9. and contain a *note Slice: 45fb. + ‘ctx’ is *note Load: 1a4, *note Store: 45ca. or *note Del: 45cd. + according to the action performed with the subscript. + + >>> print(ast.dump(ast.parse('l[1:2, 3]', mode='eval'), indent=4)) + Expression( + body=Subscript( + value=Name(id='l', ctx=Load()), + slice=Tuple( + elts=[ + Slice( + lower=Constant(value=1), + upper=Constant(value=2)), + Constant(value=3)], + ctx=Load()), + ctx=Load())) + + -- Class: ast.Slice (lower, upper, step) + + Regular slicing (on the form ‘lower:upper’ or ‘lower:upper:step’). + Can occur only inside the 'slice' field of *note Subscript: 45fa, + either directly or as an element of *note Tuple: 45c9. + + >>> print(ast.dump(ast.parse('l[1:2]', mode='eval'), indent=4)) + Expression( + body=Subscript( + value=Name(id='l', ctx=Load()), + slice=Slice( + lower=Constant(value=1), + upper=Constant(value=2)), + ctx=Load())) + + +File: python.info, Node: Comprehensions, Prev: Subscripting, Up: Expressions<2> + +5.33.1.8 Comprehensions +....................... + + -- Class: ast.ListComp (elt, generators) + -- Class: ast.SetComp (elt, generators) + -- Class: ast.GeneratorExp (elt, generators) + -- Class: ast.DictComp (key, value, generators) + + List and set comprehensions, generator expressions, and dictionary + comprehensions. ‘elt’ (or ‘key’ and ‘value’) is a single node + representing the part that will be evaluated for each item. + + ‘generators’ is a list of *note comprehension: 4601. nodes. + + >>> print(ast.dump( + ... ast.parse('[x for x in numbers]', mode='eval'), + ... indent=4, + ... )) + Expression( + body=ListComp( + elt=Name(id='x', ctx=Load()), + generators=[ + comprehension( + target=Name(id='x', ctx=Store()), + iter=Name(id='numbers', ctx=Load()), + is_async=0)])) + >>> print(ast.dump( + ... ast.parse('{x: x**2 for x in numbers}', mode='eval'), + ... indent=4, + ... )) + Expression( + body=DictComp( + key=Name(id='x', ctx=Load()), + value=BinOp( + left=Name(id='x', ctx=Load()), + op=Pow(), + right=Constant(value=2)), + generators=[ + comprehension( + target=Name(id='x', ctx=Store()), + iter=Name(id='numbers', ctx=Load()), + is_async=0)])) + >>> print(ast.dump( + ... ast.parse('{x for x in numbers}', mode='eval'), + ... indent=4, + ... )) + Expression( + body=SetComp( + elt=Name(id='x', ctx=Load()), + generators=[ + comprehension( + target=Name(id='x', ctx=Store()), + iter=Name(id='numbers', ctx=Load()), + is_async=0)])) + + -- Class: ast.comprehension (target, iter, ifs, is_async) + + One ‘for’ clause in a comprehension. ‘target’ is the reference to + use for each element - typically a *note Name: 193f. or *note + Tuple: 45c9. node. ‘iter’ is the object to iterate over. ‘ifs’ is + a list of test expressions: each ‘for’ clause can have multiple + ‘ifs’. + + ‘is_async’ indicates a comprehension is asynchronous (using an + ‘async for’ instead of ‘for’). The value is an integer (0 or 1). + + >>> print(ast.dump(ast.parse('[ord(c) for line in file for c in line]', mode='eval'), + ... indent=4)) # Multiple comprehensions in one. + Expression( + body=ListComp( + elt=Call( + func=Name(id='ord', ctx=Load()), + args=[ + Name(id='c', ctx=Load())]), + generators=[ + comprehension( + target=Name(id='line', ctx=Store()), + iter=Name(id='file', ctx=Load()), + is_async=0), + comprehension( + target=Name(id='c', ctx=Store()), + iter=Name(id='line', ctx=Load()), + is_async=0)])) + + >>> print(ast.dump(ast.parse('(n**2 for n in it if n>5 if n<10)', mode='eval'), + ... indent=4)) # generator comprehension + Expression( + body=GeneratorExp( + elt=BinOp( + left=Name(id='n', ctx=Load()), + op=Pow(), + right=Constant(value=2)), + generators=[ + comprehension( + target=Name(id='n', ctx=Store()), + iter=Name(id='it', ctx=Load()), + ifs=[ + Compare( + left=Name(id='n', ctx=Load()), + ops=[ + Gt()], + comparators=[ + Constant(value=5)]), + Compare( + left=Name(id='n', ctx=Load()), + ops=[ + Lt()], + comparators=[ + Constant(value=10)])], + is_async=0)])) + + >>> print(ast.dump(ast.parse('[i async for i in soc]', mode='eval'), + ... indent=4)) # Async comprehension + Expression( + body=ListComp( + elt=Name(id='i', ctx=Load()), + generators=[ + comprehension( + target=Name(id='i', ctx=Store()), + iter=Name(id='soc', ctx=Load()), + is_async=1)])) + + +File: python.info, Node: Statements, Next: Control flow, Prev: Expressions<2>, Up: Node classes + +5.33.1.9 Statements +................... + + -- Class: ast.Assign (targets, value, type_comment) + + An assignment. ‘targets’ is a list of nodes, and ‘value’ is a + single node. + + Multiple nodes in ‘targets’ represents assigning the same value to + each. Unpacking is represented by putting a *note Tuple: 45c9. or + *note List: 45c8. within ‘targets’. + + -- Attribute: type_comment + + ‘type_comment’ is an optional string with the type annotation + as a comment. + + >>> print(ast.dump(ast.parse('a = b = 1'), indent=4)) # Multiple assignment + Module( + body=[ + Assign( + targets=[ + Name(id='a', ctx=Store()), + Name(id='b', ctx=Store())], + value=Constant(value=1))]) + + >>> print(ast.dump(ast.parse('a,b = c'), indent=4)) # Unpacking + Module( + body=[ + Assign( + targets=[ + Tuple( + elts=[ + Name(id='a', ctx=Store()), + Name(id='b', ctx=Store())], + ctx=Store())], + value=Name(id='c', ctx=Load()))]) + + -- Class: ast.AnnAssign (target, annotation, value, simple) + + An assignment with a type annotation. ‘target’ is a single node + and can be a *note Name: 193f, an *note Attribute: 45f4. or a *note + Subscript: 45fa. ‘annotation’ is the annotation, such as a *note + Constant: 2bb. or *note Name: 193f. 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: 193f. node that does not appear between + parentheses; all other targets are considered complex. Only simple + targets appear in the ‘__annotations__’ dictionary of modules and + classes. + + >>> print(ast.dump(ast.parse('c: int'), indent=4)) + Module( + body=[ + AnnAssign( + target=Name(id='c', ctx=Store()), + annotation=Name(id='int', ctx=Load()), + simple=1)]) + + >>> print(ast.dump(ast.parse('(a): int = 1'), indent=4)) # Annotation with parenthesis + Module( + body=[ + AnnAssign( + target=Name(id='a', ctx=Store()), + annotation=Name(id='int', ctx=Load()), + value=Constant(value=1), + simple=0)]) + + >>> print(ast.dump(ast.parse('a.b: int'), indent=4)) # Attribute annotation + Module( + body=[ + AnnAssign( + target=Attribute( + value=Name(id='a', ctx=Load()), + attr='b', + ctx=Store()), + annotation=Name(id='int', ctx=Load()), + simple=0)]) + + >>> print(ast.dump(ast.parse('a[1]: int'), indent=4)) # Subscript annotation + Module( + body=[ + AnnAssign( + target=Subscript( + value=Name(id='a', ctx=Load()), + slice=Constant(value=1), + ctx=Store()), + annotation=Name(id='int', ctx=Load()), + simple=0)]) + + -- Class: ast.AugAssign (target, op, value) + + Augmented assignment, such as ‘a += 1’. In the following example, + ‘target’ is a *note Name: 193f. node for ‘x’ (with the *note Store: + 45ca. context), ‘op’ is *note Add: 45d9, and ‘value’ is a *note + Constant: 2bb. with value for 1. + + The ‘target’ attribute cannot be of class *note Tuple: 45c9. or + *note List: 45c8, unlike the targets of *note Assign: 45f8. + + >>> print(ast.dump(ast.parse('x += 2'), indent=4)) + Module( + body=[ + AugAssign( + target=Name(id='x', ctx=Store()), + op=Add(), + value=Constant(value=2))]) + + -- Class: ast.Raise (exc, cause) + + A ‘raise’ statement. ‘exc’ is the exception object to be raised, + normally a *note Call: 45cf. or *note Name: 193f, or ‘None’ for a + standalone ‘raise’. ‘cause’ is the optional part for ‘y’ in ‘raise + x from y’. + + >>> print(ast.dump(ast.parse('raise x from y'), indent=4)) + Module( + body=[ + Raise( + exc=Name(id='x', ctx=Load()), + cause=Name(id='y', ctx=Load()))]) + + -- Class: ast.Assert (test, msg) + + An assertion. ‘test’ holds the condition, such as a *note Compare: + 45e9. node. ‘msg’ holds the failure message. + + >>> print(ast.dump(ast.parse('assert x,y'), indent=4)) + Module( + body=[ + Assert( + test=Name(id='x', ctx=Load()), + msg=Name(id='y', ctx=Load()))]) + + -- Class: ast.Delete (targets) + + Represents a ‘del’ statement. ‘targets’ is a list of nodes, such + as *note Name: 193f, *note Attribute: 45f4. or *note Subscript: + 45fa. nodes. + + >>> 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())])]) + + -- Class: ast.Pass + + A ‘pass’ statement. + + >>> print(ast.dump(ast.parse('pass'), indent=4)) + Module( + body=[ + Pass()]) + + -- Class: ast.TypeAlias (name, type_params, value) + + A *note type alias: 44f. created through the *note type: 433. + statement. ‘name’ is the name of the alias, ‘type_params’ is a + list of *note type parameters: 460a, and ‘value’ is the value of + the type alias. + + >>> print(ast.dump(ast.parse('type Alias = int'), indent=4)) + Module( + body=[ + TypeAlias( + name=Name(id='Alias', ctx=Store()), + value=Name(id='int', ctx=Load()))]) + + Added in version 3.12. + +Other statements which are only applicable inside functions or loops are +described in other sections. + +* Menu: + +* Imports:: + + +File: python.info, Node: Imports, Up: Statements + +5.33.1.10 Imports +................. + + -- Class: ast.Import (names) + + An import statement. ‘names’ is a list of *note alias: 18be. + nodes. + + >>> print(ast.dump(ast.parse('import x,y,z'), indent=4)) + Module( + body=[ + Import( + names=[ + alias(name='x'), + alias(name='y'), + alias(name='z')])]) + + -- Class: ast.ImportFrom (module, names, level) + + Represents ‘from x import y’. ‘module’ is a raw string of the + ‘from’ name, without any leading dots, or ‘None’ for statements + such as ‘from . import foo’. ‘level’ is an integer holding the + level of the relative import (0 means absolute import). + + >>> 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)]) + + -- Class: ast.alias (name, asname) + + Both parameters are raw strings of the names. ‘asname’ can be + ‘None’ if the regular name is to be used. + + >>> print(ast.dump(ast.parse('from ..foo.bar import a as b, c'), indent=4)) + Module( + body=[ + ImportFrom( + module='foo.bar', + names=[ + alias(name='a', asname='b'), + alias(name='c')], + level=2)]) + + +File: python.info, Node: Control flow, Next: Pattern matching, Prev: Statements, Up: Node classes + +5.33.1.11 Control flow +...................... + + Note: Optional clauses such as ‘else’ are stored as an empty list + if they’re not present. + + -- Class: ast.If (test, body, orelse) + + An ‘if’ statement. ‘test’ holds a single node, such as a *note + Compare: 45e9. node. ‘body’ and ‘orelse’ each hold a list of + nodes. + + ‘elif’ clauses don’t have a special representation in the AST, but + rather appear as extra *note If: 460f. nodes within the ‘orelse’ + section of the previous one. + + >>> print(ast.dump(ast.parse(""" + ... if x: + ... ... + ... elif y: + ... ... + ... else: + ... ... + ... """), indent=4)) + Module( + body=[ + If( + test=Name(id='x', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))], + orelse=[ + If( + test=Name(id='y', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))], + orelse=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + -- Class: 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: 193f, *note Tuple: 45c9, *note List: 45c8, + *note Attribute: 45f4. or *note Subscript: 45fa. 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. + + -- Attribute: type_comment + + ‘type_comment’ is an optional string with the type annotation + as a comment. + + >>> print(ast.dump(ast.parse(""" + ... for x in y: + ... ... + ... else: + ... ... + ... """), indent=4)) + Module( + body=[ + For( + target=Name(id='x', ctx=Store()), + iter=Name(id='y', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))], + orelse=[ + Expr( + value=Constant(value=Ellipsis))])]) + + -- Class: ast.While (test, body, orelse) + + A ‘while’ loop. ‘test’ holds the condition, such as a *note + Compare: 45e9. node. + + >>> print(ast.dump(ast.parse(""" + ... while x: + ... ... + ... else: + ... ... + ... """), indent=4)) + Module( + body=[ + While( + test=Name(id='x', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))], + orelse=[ + Expr( + value=Constant(value=Ellipsis))])]) + + -- Class: ast.Break + -- Class: ast.Continue + + The ‘break’ and ‘continue’ statements. + + >>> print(ast.dump(ast.parse("""\ + ... for a in b: + ... if a > 5: + ... break + ... else: + ... continue + ... + ... """), indent=4)) + Module( + body=[ + For( + target=Name(id='a', ctx=Store()), + iter=Name(id='b', ctx=Load()), + body=[ + If( + test=Compare( + left=Name(id='a', ctx=Load()), + ops=[ + Gt()], + comparators=[ + Constant(value=5)]), + body=[ + Break()], + orelse=[ + Continue()])])]) + + -- Class: ast.Try (body, handlers, orelse, finalbody) + + ‘try’ blocks. All attributes are list of nodes to execute, except + for ‘handlers’, which is a list of *note ExceptHandler: 4616. + nodes. + + >>> print(ast.dump(ast.parse(""" + ... try: + ... ... + ... except Exception: + ... ... + ... except OtherException as e: + ... ... + ... else: + ... ... + ... finally: + ... ... + ... """), indent=4)) + Module( + body=[ + Try( + body=[ + Expr( + value=Constant(value=Ellipsis))], + handlers=[ + ExceptHandler( + type=Name(id='Exception', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + ExceptHandler( + type=Name(id='OtherException', ctx=Load()), + name='e', + body=[ + Expr( + value=Constant(value=Ellipsis))])], + orelse=[ + Expr( + value=Constant(value=Ellipsis))], + finalbody=[ + Expr( + value=Constant(value=Ellipsis))])]) + + -- Class: ast.TryStar (body, handlers, orelse, finalbody) + + ‘try’ blocks which are followed by ‘except*’ clauses. The + attributes are the same as for *note Try: 4615. but the *note + ExceptHandler: 4616. nodes in ‘handlers’ are interpreted as + ‘except*’ blocks rather then ‘except’. + + >>> print(ast.dump(ast.parse(""" + ... try: + ... ... + ... except* Exception: + ... ... + ... """), indent=4)) + Module( + body=[ + TryStar( + body=[ + Expr( + value=Constant(value=Ellipsis))], + handlers=[ + ExceptHandler( + type=Name(id='Exception', ctx=Load()), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.11. + + -- Class: ast.ExceptHandler (type, name, body) + + A single ‘except’ clause. ‘type’ is the exception type it will + match, typically a *note Name: 193f. node (or ‘None’ for a + catch-all ‘except:’ clause). ‘name’ is a raw string for the name + to hold the exception, or ‘None’ if the clause doesn’t have ‘as + foo’. ‘body’ is a list of nodes. + + >>> print(ast.dump(ast.parse("""\ + ... try: + ... a + 1 + ... except TypeError: + ... pass + ... """), indent=4)) + Module( + body=[ + Try( + body=[ + Expr( + value=BinOp( + left=Name(id='a', ctx=Load()), + op=Add(), + right=Constant(value=1)))], + handlers=[ + ExceptHandler( + type=Name(id='TypeError', ctx=Load()), + body=[ + Pass()])])]) + + -- Class: ast.With (items, body, type_comment) + + A ‘with’ block. ‘items’ is a list of *note withitem: 4619. nodes + representing the context managers, and ‘body’ is the indented block + inside the context. + + -- Attribute: type_comment + + ‘type_comment’ is an optional string with the type annotation + as a comment. + + -- Class: ast.withitem (context_expr, optional_vars) + + A single context manager in a ‘with’ block. ‘context_expr’ is the + context manager, often a *note Call: 45cf. node. ‘optional_vars’ + is a *note Name: 193f, *note Tuple: 45c9. or *note List: 45c8. for + the ‘as foo’ part, or ‘None’ if that isn’t used. + + >>> print(ast.dump(ast.parse("""\ + ... with a as b, c as d: + ... something(b, d) + ... """), indent=4)) + Module( + body=[ + With( + items=[ + withitem( + context_expr=Name(id='a', ctx=Load()), + optional_vars=Name(id='b', ctx=Store())), + withitem( + context_expr=Name(id='c', ctx=Load()), + optional_vars=Name(id='d', ctx=Store()))], + body=[ + Expr( + value=Call( + func=Name(id='something', ctx=Load()), + args=[ + Name(id='b', ctx=Load()), + Name(id='d', ctx=Load())]))])]) + + +File: python.info, Node: Pattern matching, Next: Type annotations, Prev: Control flow, Up: Node classes + +5.33.1.12 Pattern matching +.......................... + + -- Class: 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: 461d. nodes with the + different cases. + + Added in version 3.10. + + -- Class: 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: 1a6. nodes produced for patterns differ from + those produced for expressions, even when they share the same + syntax. + + The ‘guard’ attribute contains an expression that will be evaluated + if the pattern matches the subject. + + ‘body’ contains a list of nodes to execute if the pattern matches + and the result of evaluating the guard expression is true. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case [x] if x>0: + ... ... + ... case tuple(): + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchSequence( + patterns=[ + MatchAs(name='x')]), + guard=Compare( + left=Name(id='x', ctx=Load()), + ops=[ + Gt()], + comparators=[ + Constant(value=0)]), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + match_case( + pattern=MatchClass( + cls=Name(id='tuple', ctx=Load())), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchValue (value) + + A match literal or value pattern that compares by equality. + ‘value’ is an expression node. Permitted value nodes are + restricted as described in the match statement documentation. This + pattern succeeds if the match subject is equal to the evaluated + value. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case "Relevant": + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchValue( + value=Constant(value='Relevant')), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchSingleton (value) + + A match literal pattern that compares by identity. ‘value’ is the + singleton to be compared against: ‘None’, ‘True’, or ‘False’. This + pattern succeeds if the match subject is the given constant. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case None: + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchSingleton(value=None), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchSequence (patterns) + + A match sequence pattern. ‘patterns’ contains the patterns to be + matched against the subject elements if the subject is a sequence. + Matches a variable length sequence if one of the subpatterns is a + ‘MatchStar’ node, otherwise matches a fixed length sequence. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case [1, 2]: + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchSequence( + patterns=[ + MatchValue( + value=Constant(value=1)), + MatchValue( + value=Constant(value=2))]), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchStar (name) + + Matches the rest of the sequence in a variable length match + sequence pattern. If ‘name’ is not ‘None’, a list containing the + remaining sequence elements is bound to that name if the overall + sequence pattern is successful. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case [1, 2, *rest]: + ... ... + ... case [*_]: + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchSequence( + patterns=[ + MatchValue( + value=Constant(value=1)), + MatchValue( + value=Constant(value=2)), + MatchStar(name='rest')]), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + match_case( + pattern=MatchSequence( + patterns=[ + MatchStar()]), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchMapping (keys, patterns, rest) + + A match mapping pattern. ‘keys’ is a sequence of expression nodes. + ‘patterns’ is a corresponding sequence of pattern nodes. ‘rest’ is + an optional name that can be specified to capture the remaining + mapping elements. Permitted key expressions are restricted as + described in the match statement documentation. + + This pattern succeeds if the subject is a mapping, all evaluated + key expressions are present in the mapping, and the value + corresponding to each key matches the corresponding subpattern. If + ‘rest’ is not ‘None’, a dict containing the remaining mapping + elements is bound to that name if the overall mapping pattern is + successful. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case {1: _, 2: _}: + ... ... + ... case {**rest}: + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchMapping( + keys=[ + Constant(value=1), + Constant(value=2)], + patterns=[ + MatchAs(), + MatchAs()]), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + match_case( + pattern=MatchMapping(rest='rest'), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchClass (cls, patterns, kwd_attrs, kwd_patterns) + + A match class pattern. ‘cls’ is an expression giving the nominal + class to be matched. ‘patterns’ is a sequence of pattern nodes to + be matched against the class defined sequence of pattern matching + attributes. ‘kwd_attrs’ is a sequence of additional attributes to + be matched (specified as keyword arguments in the class pattern), + ‘kwd_patterns’ are the corresponding patterns (specified as keyword + values in the class pattern). + + This pattern succeeds if the subject is an instance of the + nominated class, all positional patterns match the corresponding + class-defined attributes, and any specified keyword attributes + match their corresponding pattern. + + Note: classes may define a property that returns self in order to + match a pattern node against the instance being matched. Several + builtin types are also matched that way, as described in the match + statement documentation. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case Point2D(0, 0): + ... ... + ... case Point3D(x=0, y=0, z=0): + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchClass( + cls=Name(id='Point2D', ctx=Load()), + patterns=[ + MatchValue( + value=Constant(value=0)), + MatchValue( + value=Constant(value=0))]), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + match_case( + pattern=MatchClass( + cls=Name(id='Point3D', ctx=Load()), + kwd_attrs=[ + 'x', + 'y', + 'z'], + kwd_patterns=[ + MatchValue( + value=Constant(value=0)), + MatchValue( + value=Constant(value=0)), + MatchValue( + value=Constant(value=0))]), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchAs (pattern, name) + + A match “as-pattern”, capture pattern or wildcard pattern. + ‘pattern’ contains the match pattern that the subject will be + matched against. If the pattern is ‘None’, the node represents a + capture pattern (i.e a bare name) and will always succeed. + + The ‘name’ attribute contains the name that will be bound if the + pattern is successful. If ‘name’ is ‘None’, ‘pattern’ must also be + ‘None’ and the node represents the wildcard pattern. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case [x] as y: + ... ... + ... case _: + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchAs( + pattern=MatchSequence( + patterns=[ + MatchAs(name='x')]), + name='y'), + body=[ + Expr( + value=Constant(value=Ellipsis))]), + match_case( + pattern=MatchAs(), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + -- Class: ast.MatchOr (patterns) + + A match “or-pattern”. An or-pattern matches each of its + subpatterns in turn to the subject, until one succeeds. The + or-pattern is then deemed to succeed. If none of the subpatterns + succeed the or-pattern fails. The ‘patterns’ attribute contains a + list of match pattern nodes that will be matched against the + subject. + + >>> print(ast.dump(ast.parse(""" + ... match x: + ... case [x] | (y): + ... ... + ... """), indent=4)) + Module( + body=[ + Match( + subject=Name(id='x', ctx=Load()), + cases=[ + match_case( + pattern=MatchOr( + patterns=[ + MatchSequence( + patterns=[ + MatchAs(name='x')]), + MatchAs(name='y')]), + body=[ + Expr( + value=Constant(value=Ellipsis))])])]) + + Added in version 3.10. + + +File: python.info, Node: Type annotations, Next: Type parameters, Prev: Pattern matching, Up: Node classes + +5.33.1.13 Type annotations +.......................... + + -- Class: ast.TypeIgnore (lineno, tag) + + A ‘# type: ignore’ comment located at 'lineno'. 'tag' is the + optional tag specified by the form ‘# type: ignore <tag>’. + + >>> print(ast.dump(ast.parse('x = 1 # type: ignore', type_comments=True), indent=4)) + Module( + body=[ + Assign( + targets=[ + Name(id='x', ctx=Store())], + value=Constant(value=1))], + type_ignores=[ + TypeIgnore(lineno=1, tag='')]) + >>> print(ast.dump(ast.parse('x: bool = 1 # type: ignore[assignment]', type_comments=True), indent=4)) + Module( + body=[ + AnnAssign( + target=Name(id='x', ctx=Store()), + annotation=Name(id='bool', ctx=Load()), + value=Constant(value=1), + simple=1)], + type_ignores=[ + TypeIgnore(lineno=1, tag='[assignment]')]) + + Note: ‘TypeIgnore’ nodes are not generated when the + 'type_comments' parameter is set to ‘False’ (default). See + *note ast.parse(): 1a8. for more details. + + Added in version 3.8. + + +File: python.info, Node: Type parameters, Next: Function and class definitions, Prev: Type annotations, Up: Node classes + +5.33.1.14 Type parameters +......................... + +*note Type parameters: 2b5. can exist on classes, functions, and type +aliases. + + -- Class: ast.TypeVar (name, bound, default_value) + + A *note typing.TypeVar: 15d. ‘name’ is the name of the type + variable. ‘bound’ is the bound or constraints, if any. If ‘bound’ + is a *note Tuple: 45c9, it represents constraints; otherwise it + represents the bound. ‘default_value’ is the default value; if the + ‘TypeVar’ has no default, this attribute will be set to ‘None’. + + >>> print(ast.dump(ast.parse("type Alias[T: int = bool] = list[T]"), indent=4)) + Module( + body=[ + TypeAlias( + name=Name(id='Alias', ctx=Store()), + type_params=[ + TypeVar( + name='T', + bound=Name(id='int', ctx=Load()), + default_value=Name(id='bool', ctx=Load()))], + value=Subscript( + value=Name(id='list', ctx=Load()), + slice=Name(id='T', ctx=Load()), + ctx=Load()))]) + + Added in version 3.12. + + Changed in version 3.13: Added the 'default_value' parameter. + + -- Class: ast.ParamSpec (name, default_value) + + A *note typing.ParamSpec: 15e. ‘name’ is the name of the parameter + specification. ‘default_value’ is the default value; if the + ‘ParamSpec’ has no default, this attribute will be set to ‘None’. + + >>> print(ast.dump(ast.parse("type Alias[**P = [int, str]] = Callable[P, int]"), indent=4)) + Module( + body=[ + TypeAlias( + name=Name(id='Alias', ctx=Store()), + type_params=[ + ParamSpec( + name='P', + default_value=List( + elts=[ + Name(id='int', ctx=Load()), + Name(id='str', ctx=Load())], + ctx=Load()))], + value=Subscript( + value=Name(id='Callable', ctx=Load()), + slice=Tuple( + elts=[ + Name(id='P', ctx=Load()), + Name(id='int', ctx=Load())], + ctx=Load()), + ctx=Load()))]) + + Added in version 3.12. + + Changed in version 3.13: Added the 'default_value' parameter. + + -- Class: ast.TypeVarTuple (name, default_value) + + A *note typing.TypeVarTuple: 15f. ‘name’ is the name of the type + variable tuple. ‘default_value’ is the default value; if the + ‘TypeVarTuple’ has no default, this attribute will be set to + ‘None’. + + >>> print(ast.dump(ast.parse("type Alias[*Ts = ()] = tuple[*Ts]"), indent=4)) + Module( + body=[ + TypeAlias( + name=Name(id='Alias', ctx=Store()), + type_params=[ + TypeVarTuple( + name='Ts', + default_value=Tuple(ctx=Load()))], + value=Subscript( + value=Name(id='tuple', ctx=Load()), + slice=Tuple( + elts=[ + Starred( + value=Name(id='Ts', ctx=Load()), + ctx=Load())], + ctx=Load()), + ctx=Load()))]) + + Added in version 3.12. + + Changed in version 3.13: Added the 'default_value' parameter. + + +File: python.info, Node: Function and class definitions, Next: Async and await, Prev: Type parameters, Up: Node classes + +5.33.1.15 Function and class definitions +........................................ + + -- Class: ast.FunctionDef (name, args, body, decorator_list, returns, + type_comment, type_params) + + A function definition. + + * ‘name’ is a raw string of the function name. + + * ‘args’ is an *note arguments: 462c. node. + + * ‘body’ is the list of nodes inside the function. + + * ‘decorator_list’ is the list of decorators to be applied, + stored outermost first (i.e. the first in the list will be + applied last). + + * ‘returns’ is the return annotation. + + * ‘type_params’ is a list of *note type parameters: 460a. + + -- Attribute: type_comment + + ‘type_comment’ is an optional string with the type annotation + as a comment. + + Changed in version 3.12: Added ‘type_params’. + + -- Class: ast.Lambda (args, body) + + ‘lambda’ is a minimal function definition that can be used inside + an expression. Unlike *note FunctionDef: 1707, ‘body’ holds a + single node. + + >>> 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)))]) + + -- Class: ast.arguments (posonlyargs, args, vararg, kwonlyargs, + kw_defaults, kwarg, defaults) + + The arguments for a function. + + * ‘posonlyargs’, ‘args’ and ‘kwonlyargs’ are lists of *note arg: + 462e. nodes. + + * ‘vararg’ and ‘kwarg’ are single *note arg: 462e. nodes, + referring to the ‘*args, **kwargs’ parameters. + + * ‘kw_defaults’ is a list of default values for keyword-only + arguments. If one is ‘None’, the corresponding argument is + required. + + * ‘defaults’ is a list of default values for arguments that can + be passed positionally. If there are fewer defaults, they + correspond to the last n arguments. + + -- Class: 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: 193f. + node. + + -- Attribute: type_comment + + ‘type_comment’ is an optional string with the type annotation + as a comment + + >>> print(ast.dump(ast.parse("""\ + ... @decorator1 + ... @decorator2 + ... def f(a: 'annotation', b=1, c=2, *d, e, f=3, **g) -> 'return annotation': + ... pass + ... """), indent=4)) + Module( + body=[ + FunctionDef( + name='f', + args=arguments( + args=[ + arg( + arg='a', + annotation=Constant(value='annotation')), + arg(arg='b'), + arg(arg='c')], + vararg=arg(arg='d'), + kwonlyargs=[ + arg(arg='e'), + arg(arg='f')], + kw_defaults=[ + None, + Constant(value=3)], + kwarg=arg(arg='g'), + defaults=[ + Constant(value=1), + Constant(value=2)]), + body=[ + Pass()], + decorator_list=[ + Name(id='decorator1', ctx=Load()), + Name(id='decorator2', ctx=Load())], + returns=Constant(value='return annotation'))]) + + -- Class: ast.Return (value) + + A ‘return’ statement. + + >>> print(ast.dump(ast.parse('return 4'), indent=4)) + Module( + body=[ + Return( + value=Constant(value=4))]) + + -- Class: ast.Yield (value) + -- Class: ast.YieldFrom (value) + + A ‘yield’ or ‘yield from’ expression. Because these are + expressions, they must be wrapped in an *note Expr: 45d1. node if + the value sent back is not used. + + >>> print(ast.dump(ast.parse('yield x'), indent=4)) + Module( + body=[ + Expr( + value=Yield( + value=Name(id='x', ctx=Load())))]) + + >>> print(ast.dump(ast.parse('yield from x'), indent=4)) + Module( + body=[ + Expr( + value=YieldFrom( + value=Name(id='x', ctx=Load())))]) + + -- Class: ast.Global (names) + -- Class: ast.Nonlocal (names) + + ‘global’ and ‘nonlocal’ statements. ‘names’ is a list of raw + strings. + + >>> 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'])]) + + -- Class: ast.ClassDef (name, bases, keywords, body, decorator_list, + type_params) + + A class definition. + + * ‘name’ is a raw string for the class name + + * ‘bases’ is a list of nodes for explicitly specified base + classes. + + * ‘keywords’ is a list of *note keyword: 45f5. nodes, + principally for ‘metaclass’. Other keywords will be passed to + the metaclass, as per PEP 3115(1). + + * ‘body’ is a list of nodes representing the code within the + class definition. + + * ‘decorator_list’ is a list of nodes, as in *note FunctionDef: + 1707. + + * ‘type_params’ is a list of *note type parameters: 460a. + + >>> print(ast.dump(ast.parse("""\ + ... @decorator1 + ... @decorator2 + ... class Foo(base1, base2, metaclass=meta): + ... pass + ... """), indent=4)) + Module( + body=[ + ClassDef( + name='Foo', + bases=[ + Name(id='base1', ctx=Load()), + Name(id='base2', ctx=Load())], + keywords=[ + keyword( + arg='metaclass', + value=Name(id='meta', ctx=Load()))], + body=[ + Pass()], + decorator_list=[ + Name(id='decorator1', ctx=Load()), + Name(id='decorator2', ctx=Load())])]) + + Changed in version 3.12: Added ‘type_params’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3115/ + + +File: python.info, Node: Async and await, Prev: Function and class definitions, Up: Node classes + +5.33.1.16 Async and await +......................... + + -- Class: ast.AsyncFunctionDef (name, args, body, decorator_list, + returns, type_comment, type_params) + + An ‘async def’ function definition. Has the same fields as *note + FunctionDef: 1707. + + Changed in version 3.12: Added ‘type_params’. + + -- Class: ast.Await (value) + + An ‘await’ expression. ‘value’ is what it waits for. Only valid + in the body of an *note AsyncFunctionDef: 1706. + + >>> print(ast.dump(ast.parse("""\ + ... async def f(): + ... await other_func() + ... """), indent=4)) + Module( + body=[ + AsyncFunctionDef( + name='f', + args=arguments(), + body=[ + Expr( + value=Await( + value=Call( + func=Name(id='other_func', ctx=Load()))))])]) + + -- Class: ast.AsyncFor (target, iter, body, orelse, type_comment) + -- Class: ast.AsyncWith (items, body, type_comment) + + ‘async for’ loops and ‘async with’ context managers. They have the + same fields as *note For: 4610. and *note With: 4618, respectively. + Only valid in the body of an *note AsyncFunctionDef: 1706. + + Note: When a string is parsed by *note ast.parse(): 1a8, 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 (e.g. *note ast.Add: 45d9.). + + +File: python.info, Node: ast Helpers, Next: Compiler Flags, Prev: Node classes, Up: ast — Abstract Syntax Trees + +5.33.1.17 ‘ast’ Helpers +....................... + +Apart from the node classes, the *note ast: 8. module defines these +utility functions and classes for traversing abstract syntax trees: + + -- Function: ast.parse (source, filename='<unknown>', mode='exec', *, + type_comments=False, feature_version=None, optimize=-1) + + Parse the source into an AST node. Equivalent to ‘compile(source, + filename, mode, flags=FLAGS_VALUE, optimize=optimize)’, where + ‘FLAGS_VALUE’ is ‘ast.PyCF_ONLY_AST’ if ‘optimize <= 0’ and + ‘ast.PyCF_OPTIMIZED_AST’ otherwise. + + If ‘type_comments=True’ is given, the parser is modified to check + and return type comments as specified by PEP 484(1) and PEP 526(2). + This is equivalent to adding *note ast.PyCF_TYPE_COMMENTS: 4638. to + the flags passed to *note compile(): 192. 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: 45c0. (otherwise it is always an empty + list). + + In addition, if ‘mode’ is ‘'func_type'’, the input syntax is + modified to correspond to PEP 484(3) “signature type comments”, + e.g. ‘(str, int) -> List[str]’. + + 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: 809. 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: 204. + is raised. + + Warning: 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: 18d. 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(): 1a8. won’t do any scoping + checks, which the compilation step does. + + Warning: It is possible to crash the Python interpreter with a + sufficiently large/complex string due to stack depth + limitations in Python’s AST compiler. + + Changed in version 3.8: Added ‘type_comments’, ‘mode='func_type'’ + and ‘feature_version’. + + Changed in version 3.13: The minimum supported version for + ‘feature_version’ is now ‘(3, 7)’. The ‘optimize’ argument was + added. + + -- Function: ast.unparse (ast_obj) + + Unparse an *note ast.AST: 1a6. object and generate a string with + code that would produce an equivalent *note ast.AST: 1a6. object if + parsed back with *note ast.parse(): 1a8. + + Warning: The produced code string will not necessarily be + equal to the original code that generated the *note ast.AST: + 1a6. object (without any compiler optimizations, such as + constant tuples/frozensets). + + Warning: Trying to unparse a highly complex expression would + result with *note RecursionError: d6b. + + Added in version 3.9. + + -- Function: ast.literal_eval (node_or_string) + + Evaluate an expression node or a string containing only a Python + literal or container display. The string or node provided may only + consist of the following Python literal structures: strings, bytes, + numbers, tuples, lists, dicts, sets, booleans, ‘None’ and + ‘Ellipsis’. + + This can be used for evaluating strings containing Python values + without the need to parse the values oneself. It is not capable of + evaluating arbitrarily complex expressions, for example involving + operators or indexing. + + 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(): 180. 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. + + Warning: It is possible to crash the Python interpreter due to + stack depth limitations in Python’s AST compiler. + + It can raise *note ValueError: 204, *note TypeError: 534, + *note SyntaxError: 18d, *note MemoryError: 1576. and *note + RecursionError: d6b. depending on the malformed input. + + Changed in version 3.2: Now allows bytes and set literals. + + Changed in version 3.9: Now supports creating empty sets with + ‘'set()'’. + + Changed in version 3.10: For string inputs, leading spaces and tabs + are now stripped. + + -- Function: ast.get_docstring (node, clean=True) + + Return the docstring of the given 'node' (which must be a *note + FunctionDef: 1707, *note AsyncFunctionDef: 1706, *note ClassDef: + 1705, or *note Module: 45c0. node), or ‘None’ if it has no + docstring. If 'clean' is true, clean up the docstring’s + indentation with *note inspect.cleandoc(): 16b5. + + Changed in version 3.5: *note AsyncFunctionDef: 1706. is now + supported. + + -- Function: ast.get_source_segment (source, node, *, padded=False) + + Get source code segment of the 'source' that generated 'node'. If + some location information (*note lineno: 45b9, *note end_lineno: + 45bb, *note col_offset: 45ba, or *note end_col_offset: 45bc.) is + missing, return ‘None’. + + If 'padded' is ‘True’, the first line of a multi-line statement + will be padded with spaces to match its original position. + + Added in version 3.8. + + -- Function: ast.fix_missing_locations (node) + + When you compile a node tree with *note compile(): 192, the + compiler expects *note lineno: 45b9. and *note col_offset: 45ba. + 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'. + + -- Function: ast.increment_lineno (node, n=1) + + Increment the line number and end line number of each node in the + tree starting at 'node' by 'n'. This is useful to “move code” to a + different location in a file. + + -- Function: ast.copy_location (new_node, old_node) + + Copy source location (*note lineno: 45b9, *note col_offset: 45ba, + *note end_lineno: 45bb, and *note end_col_offset: 45bc.) from + 'old_node' to 'new_node' if possible, and return 'new_node'. + + -- Function: ast.iter_fields (node) + + Yield a tuple of ‘(fieldname, value)’ for each field in + ‘node._fields’ that is present on 'node'. + + -- Function: ast.iter_child_nodes (node) + + Yield all direct child nodes of 'node', that is, all fields that + are nodes and all items of fields that are lists of nodes. + + -- Function: ast.walk (node) + + Recursively yield all descendant nodes in the tree starting at + 'node' (including 'node' itself), in no specified order. This is + useful if you only want to modify nodes in place and don’t care + about the context. + + -- Class: ast.NodeVisitor + + A node visitor base class that walks the abstract syntax tree and + calls a visitor function for every node found. This function may + return a value which is forwarded by the *note visit(): 463e. + method. + + This class is meant to be subclassed, with the subclass adding + visitor methods. + + -- Method: visit (node) + + Visit a node. The default implementation calls the method + called ‘self.visit_CLASSNAME’ where 'classname' is the name of + the node class, or *note generic_visit(): 463f. if that method + doesn’t exist. + + -- Method: generic_visit (node) + + This visitor calls *note visit(): 463e. on all children of the + node. + + Note that child nodes of nodes that have a custom visitor + method won’t be visited unless the visitor calls *note + generic_visit(): 463f. or visits them itself. + + -- Method: visit_Constant (node) + + Handles all constant nodes. + + Don’t use the *note NodeVisitor: a6d. if you want to apply changes + to nodes during traversal. For this a special visitor exists + (*note NodeTransformer: 4640.) that allows modifications. + + Deprecated since version 3.8: 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(): a6e. method to handle all constant + nodes. + + -- Class: ast.NodeTransformer + + A *note NodeVisitor: a6d. subclass that walks the abstract syntax + tree and allows modification of nodes. + + The *note NodeTransformer: 4640. will walk the AST and use the + return value of the visitor methods to replace or remove the old + node. If the return value of the visitor method is ‘None’, the + node will be removed from its location, otherwise it is replaced + with the return value. The return value may be the original node + in which case no replacement takes place. + + Here is an example transformer that rewrites all occurrences of + name lookups (‘foo’) to ‘data['foo']’: + + class RewriteName(NodeTransformer): + + def visit_Name(self, node): + return Subscript( + value=Name(id='data', ctx=Load()), + slice=Constant(value=node.id), + ctx=node.ctx + ) + + Keep in mind that if the node you’re operating on has child nodes + you must either transform the child nodes yourself or call the + *note generic_visit(): 463f. method for the node first. + + For nodes that were part of a collection of statements (that + applies to all statement nodes), the visitor may also return a list + of nodes rather than just a single node. + + If *note NodeTransformer: 4640. introduces new nodes (that weren’t + part of original tree) without giving them location information + (such as *note lineno: 45b9.), *note fix_missing_locations(): 4639. + 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)) + + Usually you use the transformer like this: + + node = YourTransformer().visit(node) + + -- Function: ast.dump (node, annotate_fields=True, + include_attributes=False, *, indent=None, show_empty=False) + + Return a formatted dump of the tree in 'node'. This is mainly + useful for debugging purposes. If 'annotate_fields' is true (by + default), the returned string will show the names and the values + for fields. If 'annotate_fields' is false, the result string will + be more compact by omitting unambiguous field names. Attributes + such as line numbers and column offsets are not dumped by default. + If this is wanted, 'include_attributes' can be set to true. + + If 'indent' is a non-negative integer or string, then the tree will + be pretty-printed with that indent level. An indent level of 0, + negative, or ‘""’ will only insert newlines. ‘None’ (the default) + selects the single line representation. Using a positive integer + indent indents that many spaces per level. If 'indent' is a string + (such as ‘"\t"’), that string is used to indent each level. + + If 'show_empty' is false (the default), optional empty lists will + be omitted from the output. Optional ‘None’ values are always + omitted. + + Changed in version 3.9: Added the 'indent' option. + + Changed in version 3.13: Added the 'show_empty' option. + + >>> print(ast.dump(ast.parse("""\ + ... async def f(): + ... await other_func() + ... """), indent=4, show_empty=True)) + Module( + body=[ + AsyncFunctionDef( + name='f', + args=arguments( + posonlyargs=[], + args=[], + kwonlyargs=[], + kw_defaults=[], + defaults=[]), + body=[ + Expr( + value=Await( + value=Call( + func=Name(id='other_func', ctx=Load()), + args=[], + keywords=[])))], + decorator_list=[], + type_params=[])], + type_ignores=[]) + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0484/ + + (2) https://peps.python.org/pep-0526/ + + (3) https://peps.python.org/pep-0484/ + + +File: python.info, Node: Compiler Flags, Next: Command-Line Usage<4>, Prev: ast Helpers, Up: ast — Abstract Syntax Trees + +5.33.1.18 Compiler Flags +........................ + +The following flags may be passed to *note compile(): 192. in order to +change effects on the compilation of a program: + + -- Data: ast.PyCF_ALLOW_TOP_LEVEL_AWAIT + + Enables support for top-level ‘await’, ‘async for’, ‘async with’ + and async comprehensions. + + Added in version 3.8. + + -- Data: ast.PyCF_ONLY_AST + + Generates and returns an abstract syntax tree instead of returning + a compiled code object. + + -- Data: ast.PyCF_OPTIMIZED_AST + + The returned AST is optimized according to the 'optimize' argument + in *note compile(): 192. or *note ast.parse(): 1a8. + + Added in version 3.13. + + -- Data: ast.PyCF_TYPE_COMMENTS + + Enables support for PEP 484(1) and PEP 526(2) style type comments + (‘# 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: Command-Line Usage<4>, Prev: Compiler Flags, Up: ast — Abstract Syntax Trees + +5.33.1.19 Command-Line Usage +............................ + +Added in version 3.9. + +The *note ast: 8. module can be executed as a script from the command +line. It is as simple as: + + python -m ast [-m <mode>] [-a] [infile] + +The following options are accepted: + + -- Option: -h, --help + + Show the help message and exit. + + -- Option: -m <mode> + -- Option: --mode <mode> + + Specify what kind of code must be compiled, like the 'mode' + argument in *note parse(): 1a8. + + -- Option: --no-type-comments + + Don’t parse type comments. + + -- Option: -a, --include-attributes + + Include attributes such as line numbers and column offsets. + + -- Option: -i <indent> + -- Option: --indent <indent> + + Indentation of nodes in AST (number of spaces). + +If ‘infile’ is specified its contents are parsed to AST and dumped to +stdout. Otherwise, the content is read from stdin. + +See also +........ + +Green Tree Snakes(1), an external documentation resource, has good +details on working with Python ASTs. + +ASTTokens(2) annotates Python ASTs with the positions of tokens and text +in the source code that generated them. This is helpful for tools that +make source code transformations. + +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) parses code as a Concrete Syntax Tree that looks like an ast +tree and keeps all formatting details. It’s useful for building +automated refactoring (codemod) applications and linters. + +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 — Access to the compiler’s symbol tables, Next: token — Constants used with Python parse trees, Prev: ast — Abstract Syntax Trees, Up: Python Language Services + +5.33.2 ‘symtable’ — Access to the compiler’s symbol tables +---------------------------------------------------------- + +'Source code:' 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. *note symtable: d8. provides +an interface to examine these tables. + +* Menu: + +* Generating Symbol Tables:: +* Examining Symbol Tables:: +* Command-Line Usage: Command-Line Usage<5>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/symtable.py + + +File: python.info, Node: Generating Symbol Tables, Next: Examining Symbol Tables, Up: symtable — Access to the compiler’s symbol tables + +5.33.2.1 Generating Symbol Tables +................................. + + -- Function: symtable.symtable (code, filename, compile_type) + + Return the toplevel *note SymbolTable: 4652. 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(): 192. + + +File: python.info, Node: Examining Symbol Tables, Next: Command-Line Usage<5>, Prev: Generating Symbol Tables, Up: symtable — Access to the compiler’s symbol tables + +5.33.2.2 Examining Symbol Tables +................................ + + -- Class: symtable.SymbolTableType + + An enumeration indicating the type of a *note SymbolTable: 4652. + object. + + -- Attribute: MODULE = "module" + + Used for the symbol table of a module. + + -- Attribute: FUNCTION = "function" + + Used for the symbol table of a function. + + -- Attribute: CLASS = "class" + + Used for the symbol table of a class. + + The following members refer to different flavors of *note + annotation scopes: 188. + + -- Attribute: ANNOTATION = "annotation" + + Used for annotations if ‘from __future__ import annotations’ + is active. + + -- Attribute: TYPE_ALIAS = "type alias" + + Used for the symbol table of *note type: 433. constructions. + + -- Attribute: TYPE_PARAMETERS = "type parameters" + + Used for the symbol table of *note generic functions: 44e. or + *note generic classes: 44d. + + -- Attribute: 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. + + -- Class: symtable.SymbolTable + + A namespace table for a block. The constructor is not public. + + -- Method: get_type () + + Return the type of the symbol table. Possible values are + members of the *note SymbolTableType: 160d. enumeration. + + Changed in version 3.12: Added ‘'annotation'’, ‘'TypeVar + bound'’, ‘'type alias'’, and ‘'type parameter'’ as possible + return values. + + Changed in version 3.13: Return values are members of the + *note SymbolTableType: 160d. enumeration. + + The exact values of the returned string may change in the + future, and thus, it is recommended to use *note + SymbolTableType: 160d. members instead of hard-coded strings. + + -- Method: get_id () + + Return the table’s identifier. + + -- Method: 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(): 160e. 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: 15d. bound scopes, + it is the name of the ‘TypeVar’. + + -- Method: get_lineno () + + Return the number of the first line in the block this table + represents. + + -- Method: is_optimized () + + Return ‘True’ if the locals in this table can be optimized. + + -- Method: is_nested () + + Return ‘True’ if the block is a nested class or function. + + -- Method: has_children () + + Return ‘True’ if the block has nested namespaces within it. + These can be obtained with *note get_children(): 4661. + + -- Method: get_identifiers () + + Return a view object containing the names of symbols in the + table. See the *note documentation of view objects: 2243. + + -- Method: lookup (name) + + Lookup 'name' in the table and return a *note Symbol: 16ce. + instance. + + -- Method: get_symbols () + + Return a list of *note Symbol: 16ce. instances for names in + the table. + + -- Method: get_children () + + Return a list of the nested symbol tables. + + -- Class: symtable.Function + + A namespace for a function or method. This class inherits from + *note SymbolTable: 4652. + + -- Method: get_parameters () + + Return a tuple containing names of parameters to this + function. + + -- Method: get_locals () + + Return a tuple containing names of locals in this function. + + -- Method: get_globals () + + Return a tuple containing names of globals in this function. + + -- Method: get_nonlocals () + + Return a tuple containing names of explicitly declared + nonlocals in this function. + + -- Method: get_frees () + + Return a tuple containing names of *note free (closure) + variables: 1f3f. in this function. + + -- Class: symtable.Class + + A namespace of a class. This class inherits from *note + SymbolTable: 4652. + + -- Method: get_methods () + + Return a tuple containing the names of method-like functions + declared in the class. + + Here, the term ‘method’ designates 'any' function defined in + the class body via *note def: 1423. or *note async def: 5cd. + + Functions defined in a deeper scope (e.g., in an inner class) + are not picked up by *note get_methods(): 2e9. + + For example: + + >>> import symtable + >>> st = symtable.symtable(''' + ... def outer(): pass + ... + ... class A: + ... def f(): + ... def w(): pass + ... + ... def g(self): pass + ... + ... @classmethod + ... async def h(cls): pass + ... + ... global outer + ... def outer(self): pass + ... ''', 'test', 'exec') + >>> class_A = st.get_children()[1] + >>> class_A.get_methods() + ('f', 'g', 'h') + + Although ‘A().f()’ raises *note TypeError: 534. at runtime, + ‘A.f’ is still considered as a method-like function. + + -- Class: symtable.Symbol + + An entry in a *note SymbolTable: 4652. corresponding to an + identifier in the source. The constructor is not public. + + -- Method: get_name () + + Return the symbol’s name. + + -- Method: is_referenced () + + Return ‘True’ if the symbol is used in its block. + + -- Method: is_imported () + + Return ‘True’ if the symbol is created from an import + statement. + + -- Method: is_parameter () + + Return ‘True’ if the symbol is a parameter. + + -- Method: is_global () + + Return ‘True’ if the symbol is global. + + -- Method: is_nonlocal () + + Return ‘True’ if the symbol is nonlocal. + + -- Method: is_declared_global () + + Return ‘True’ if the symbol is declared global with a global + statement. + + -- Method: is_local () + + Return ‘True’ if the symbol is local to its block. + + -- Method: is_annotated () + + Return ‘True’ if the symbol is annotated. + + Added in version 3.6. + + -- Method: is_free () + + Return ‘True’ if the symbol is referenced in its block, but + not assigned to. + + -- Method: is_assigned () + + Return ‘True’ if the symbol is assigned to in its block. + + -- Method: is_namespace () + + Return ‘True’ if name binding introduces new namespace. + + If the name is used as the target of a function or class + statement, this will be true. + + For example: + + >>> table = symtable.symtable("def some_func(): pass", "string", "exec") + >>> table.lookup("some_func").is_namespace() + True + + Note that a single name can be bound to multiple objects. If + the result is ‘True’, the name may also be bound to other + objects, like an int or list, that does not introduce a new + namespace. + + -- Method: get_namespaces () + + Return a list of namespaces bound to this name. + + -- Method: get_namespace () + + Return the namespace bound to this name. If more than one or + no namespace is bound to this name, a *note ValueError: 204. + is raised. + + +File: python.info, Node: Command-Line Usage<5>, Prev: Examining Symbol Tables, Up: symtable — Access to the compiler’s symbol tables + +5.33.2.3 Command-Line Usage +........................... + +Added in version 3.13. + +The *note symtable: d8. 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 — Constants used with Python parse trees, Next: keyword — Testing for Python keywords, Prev: symtable — Access to the compiler’s symbol tables, Up: Python Language Services + +5.33.3 ‘token’ — Constants used with Python parse trees +------------------------------------------------------- + +'Source code:' Lib/token.py(1) + +__________________________________________________________________ + +This module provides constants which represent the numeric values of +leaf nodes of the parse tree (terminal tokens). Refer to the file +‘Grammar/Tokens’ in the Python distribution for the definitions of the +names in the context of the language grammar. The specific numeric +values which the names map to may change between Python versions. + +The module also provides a mapping from numeric codes to names and some +functions. The functions mirror definitions in the Python C header +files. + +Note that a token’s value may depend on tokenizer options. For example, +a ‘"+"’ token may be reported as either *note PLUS: 467c. or *note OP: +467d, or a ‘"match"’ token may be either *note NAME: 467e. or *note +SOFT_KEYWORD: 467f. + + -- Data: token.tok_name + + Dictionary mapping the numeric values of the constants defined in + this module back to name strings, allowing more human-readable + representation of parse trees to be generated. + + -- Function: token.ISTERMINAL (x) + + Return ‘True’ for terminal token values. + + -- Function: token.ISNONTERMINAL (x) + + Return ‘True’ for non-terminal token values. + + -- Function: token.ISEOF (x) + + Return ‘True’ if 'x' is the marker indicating the end of input. + +The token constants are: + + -- Data: token.NAME + + Token value that indicates an *note identifier: 1e94. Note that + keywords are also initially tokenized as ‘NAME’ tokens. + + -- Data: token.NUMBER + + Token value that indicates a *note numeric literal: 1ec5. + + -- Data: token.STRING + + Token value that indicates a *note string or byte literal: 1ea4, + excluding *note formatted string literals: 9a9. 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. + + -- Data: token.OP + + A generic token value that indicates an *note operator: 1edf. or + *note delimiter: 1ee0. + + 'CPython implementation detail:' This value is only reported by the + *note tokenize: fb. module. Internally, the tokenizer uses *note + exact token types: 4686. instead. + + -- Data: token.COMMENT + + Token value used to indicate a comment. The parser ignores + ‘COMMENT’ tokens. + + -- Data: token.NEWLINE + + Token value that indicates the end of a *note logical line: 1e81. + + -- Data: 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. + + -- Data: token.INDENT + + Token value used at the beginning of a *note logical line: 1e81. to + indicate the start of an *note indented block: 1e8f. + + -- Data: token.DEDENT + + Token value used at the beginning of a *note logical line: 1e81. to + indicate the end of an *note indented block: 1e8f. + + -- Data: token.FSTRING_START + + Token value used to indicate the beginning of an *note f-string + literal: 9a9. + + 'CPython implementation detail:' The token string includes the + prefix and the opening quote(s), but none of the contents of the + literal. + + -- Data: token.FSTRING_MIDDLE + + Token value used for literal text inside an *note f-string literal: + 9a9, including format specifications. + + 'CPython implementation detail:' Replacement fields (that is, the + non-literal parts of f-strings) use the same tokens as other + expressions, and are delimited by *note LBRACE: 468d, *note RBRACE: + 468e, *note EXCLAMATION: 468f. and *note COLON: 4690. tokens. + + -- Data: token.FSTRING_END + + Token value used to indicate the end of a *note f-string: 9a9. + + 'CPython implementation detail:' The token string contains the + closing quote(s). + + -- Data: token.ENDMARKER + + Token value that indicates the end of input. + + -- Data: token.ENCODING + + Token value that indicates the encoding used to decode the source + bytes into text. The first token returned by *note + tokenize.tokenize(): 4d5. will always be an ‘ENCODING’ token. + + 'CPython implementation detail:' This token type isn’t used by the + C tokenizer but is needed for the *note tokenize: fb. module. + +The following token types are not produced by the *note tokenize: fb. +module, and are defined for special uses in the tokenizer or parser: + + -- Data: token.TYPE_IGNORE + + Token value indicating that a ‘type: ignore’ comment was + recognized. Such tokens are produced instead of regular *note + COMMENT: 4687. tokens only with the *note PyCF_TYPE_COMMENTS: 4638. + flag. + + -- Data: token.TYPE_COMMENT + + Token value indicating that a type comment was recognized. Such + tokens are produced instead of regular *note COMMENT: 4687. tokens + only with the *note PyCF_TYPE_COMMENTS: 4638. flag. + + -- Data: token.SOFT_KEYWORD + + Token value indicating a *note soft keyword: 808. + + The tokenizer never produces this value. To check for a soft + keyword, pass a *note NAME: 467e. token’s string to *note + keyword.issoftkeyword(): 4696. + + -- Data: token.ERRORTOKEN + + Token value used to indicate wrong input. + + The *note tokenize: fb. module generally indicates errors by + raising exceptions instead of emitting this token. It can also + emit tokens such as *note OP: 467d. or *note NAME: 467e. with + strings that are later rejected by the parser. +The remaining tokens represent specific *note operators: 1edf. and *note +delimiters: 1ee0. (The *note tokenize: fb. module reports these as +*note OP: 467d.; see ‘exact_type’ in the *note tokenize: fb. +documentation for details.) + +Token Value + +-------------------------------------------------------------------------------------------------------------- + + -- Data: token.LPAR ‘"("’ + + + -- Data: token.RPAR ‘")"’ + + + -- Data: token.LSQB ‘"["’ + + + -- Data: token.RSQB ‘"]"’ + + + -- Data: token.COLON ‘":"’ + + + -- Data: token.COMMA ‘","’ + + + -- Data: token.SEMI ‘";"’ + + + -- Data: token.PLUS ‘"+"’ + + + -- Data: token.MINUS ‘"-"’ + + + -- Data: token.STAR ‘"*"’ + + + -- Data: token.SLASH ‘"/"’ + + + -- Data: token.VBAR ‘"|"’ + + + -- Data: token.AMPER ‘"&"’ + + + -- Data: token.LESS ‘"<"’ + + + -- Data: token.GREATER ‘">"’ + + + -- Data: token.EQUAL ‘"="’ + + + -- Data: token.DOT ‘"."’ + + + -- Data: token.PERCENT ‘"%"’ + + + -- Data: token.LBRACE ‘"{"’ + + + -- Data: token.RBRACE ‘"}"’ + + + -- Data: token.EQEQUAL ‘"=="’ + + + -- Data: token.NOTEQUAL ‘"!="’ + + + -- Data: token.LESSEQUAL ‘"<="’ + + + -- Data: token.GREATEREQUAL ‘">="’ + + + -- Data: token.TILDE ‘"~"’ + + + -- Data: token.CIRCUMFLEX ‘"^"’ + + + -- Data: token.LEFTSHIFT ‘"<<"’ + + + -- Data: token.RIGHTSHIFT ‘">>"’ + + + -- Data: token.DOUBLESTAR ‘"**"’ + + + -- Data: token.PLUSEQUAL ‘"+="’ + + + -- Data: token.MINEQUAL ‘"-="’ + + + -- Data: token.STAREQUAL ‘"*="’ + + + -- Data: token.SLASHEQUAL ‘"/="’ + + + -- Data: token.PERCENTEQUAL ‘"%="’ + + + -- Data: token.AMPEREQUAL ‘"&="’ + + + -- Data: token.VBAREQUAL ‘"|="’ + + + -- Data: token.CIRCUMFLEXEQUAL ‘"^="’ + + + -- Data: token.LEFTSHIFTEQUAL ‘"<<="’ + + + -- Data: token.RIGHTSHIFTEQUAL ‘">>="’ + + + -- Data: token.DOUBLESTAREQUAL ‘"**="’ + + + -- Data: token.DOUBLESLASH ‘"//"’ + + + -- Data: token.DOUBLESLASHEQUAL ‘"//="’ + + + -- Data: token.AT ‘"@"’ + + + -- Data: token.ATEQUAL ‘"@="’ + + + -- Data: token.RARROW ‘"->"’ + + + -- Data: token.ELLIPSIS ‘"..."’ + + + -- Data: token.COLONEQUAL ‘":="’ + + + -- Data: token.EXCLAMATION ‘"!"’ + + +The following non-token constants are provided: + + -- Data: token.N_TOKENS + + The number of token types defined in this module. + + -- Data: token.EXACT_TOKEN_TYPES + + A dictionary mapping the string representation of a token to its + numeric code. + + Added in version 3.8. + +Changed in version 3.5: Added ‘AWAIT’ and ‘ASYNC’ tokens. + +Changed in version 3.7: Added *note COMMENT: 4687, *note NL: 4689. and +*note ENCODING: 4693. tokens. + +Changed in version 3.7: Removed ‘AWAIT’ and ‘ASYNC’ tokens. “async” and +“await” are now tokenized as *note NAME: 467e. tokens. + +Changed in version 3.8: Added *note TYPE_COMMENT: 4695, *note +TYPE_IGNORE: 4694, *note COLONEQUAL: 46c2. Added ‘AWAIT’ and ‘ASYNC’ +tokens back (they’re needed to support parsing older Python versions for +*note ast.parse(): 1a8. with ‘feature_version’ set to 6 or lower). + +Changed in version 3.12: Added *note EXCLAMATION: 468f. + +Changed in version 3.13: Removed ‘AWAIT’ and ‘ASYNC’ tokens again. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/token.py + + +File: python.info, Node: keyword — Testing for Python keywords, Next: tokenize — Tokenizer for Python source, Prev: token — Constants used with Python parse trees, Up: Python Language Services + +5.33.4 ‘keyword’ — Testing for Python keywords +---------------------------------------------- + +'Source code:' Lib/keyword.py(1) + +__________________________________________________________________ + +This module allows a Python program to determine if a string is a *note +keyword: 1e9c. or *note soft keyword: 808. + + -- Function: keyword.iskeyword (s) + + Return ‘True’ if 's' is a Python *note keyword: 1e9c. + + -- Data: keyword.kwlist + + Sequence containing all the *note keywords: 1e9c. defined for the + interpreter. If any keywords are defined to only be active when + particular *note __future__: 0. statements are in effect, these + will be included as well. + + -- Function: keyword.issoftkeyword (s) + + Return ‘True’ if 's' is a Python *note soft keyword: 808. + + Added in version 3.9. + + -- Data: keyword.softkwlist + + Sequence containing all the *note soft keywords: 808. defined for + the interpreter. If any soft keywords are defined to only be + active when particular *note __future__: 0. statements are in + effect, these will be included as well. + + Added in version 3.9. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/keyword.py + + +File: python.info, Node: tokenize — Tokenizer for Python source, Next: tabnanny — Detection of ambiguous indentation, Prev: keyword — Testing for Python keywords, Up: Python Language Services + +5.33.5 ‘tokenize’ — Tokenizer for Python source +----------------------------------------------- + +'Source code:' Lib/tokenize.py(1) + +__________________________________________________________________ + +The *note tokenize: fb. 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. + +To simplify token stream handling, all *note operator: 1edf. and *note +delimiter: 1ee0. tokens and *note Ellipsis: 2185. are returned using the +generic *note OP: 467d. token type. The exact type can be determined by +checking the ‘exact_type’ property on the *note named tuple: 64a. +returned from *note tokenize.tokenize(): 4d5. + + Warning: 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(): 1a8.). The behavior of the + functions in this module is 'undefined' when providing invalid + Python code and it can change at any point. + +* Menu: + +* Tokenizing Input:: +* Command-Line Usage: Command-Line Usage<6>. +* Examples: Examples<35>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tokenize.py + + +File: python.info, Node: Tokenizing Input, Next: Command-Line Usage<6>, Up: tokenize — Tokenizer for Python source + +5.33.5.1 Tokenizing Input +......................... + +The primary entry point is a *note generator: 105a.: + + -- Function: tokenize.tokenize (readline) + + The *note tokenize(): 4d5. generator requires one argument, + 'readline', which must be a callable object which provides the same + interface as the *note io.IOBase.readline(): 131c. method of file + objects. Each call to the function should return one line of input + as bytes. + + The generator produces 5-tuples with these members: the token type; + the token string; a 2-tuple ‘(srow, scol)’ of ints specifying the + row and column where the token begins in the source; a 2-tuple + ‘(erow, ecol)’ of ints specifying the row and column where the + token ends in the source; and the line on which the token was + found. The line passed (the last tuple item) is the 'physical' + line. The 5 tuple is returned as a *note named tuple: 64a. with + the field names: ‘type string start end line’. + + The returned *note named tuple: 64a. has an additional property + named ‘exact_type’ that contains the exact operator type for *note + OP: 467d. tokens. For all other token types ‘exact_type’ equals + the named tuple ‘type’ field. + + Changed in version 3.1: Added support for named tuples. + + Changed in version 3.3: Added support for ‘exact_type’. + + *note tokenize(): 4d5. determines the source encoding of the file + by looking for a UTF-8 BOM or encoding cookie, according to PEP + 263(1). + + -- Function: tokenize.generate_tokens (readline) + + Tokenize a source reading unicode strings instead of bytes. + + Like *note tokenize(): 4d5, the 'readline' argument is a callable + returning a single line of input. However, *note + generate_tokens(): 4d6. expects 'readline' to return a str object + rather than bytes. + + The result is an iterator yielding named tuples, exactly like *note + tokenize(): 4d5. It does not yield an *note ENCODING: 4693. token. + +All constants from the *note token: fa. module are also exported from +*note tokenize: fb. + +Another function is provided to reverse the tokenization process. This +is useful for creating tools that tokenize a script, modify the token +stream, and write back the modified script. + + -- Function: tokenize.untokenize (iterable) + + Converts tokens back into Python source code. The 'iterable' must + return sequences with at least two elements, the token type and the + token string. Any additional sequence elements are ignored. + + 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: 4693. token, + which is the first token sequence output by *note tokenize(): 4d5. + If there is no encoding token in the input, it returns a str + instead. + +*note tokenize(): 4d5. needs to detect the encoding of source files it +tokenizes. The function it uses to do this is available: + + -- Function: tokenize.detect_encoding (readline) + + The *note detect_encoding(): 2868. function is used to detect the + encoding that should be used to decode a Python source file. It + requires one argument, readline, in the same way as the *note + tokenize(): 4d5. generator. + + It will call readline a maximum of twice, and return the encoding + used (as a string) and a list of any lines (not decoded from bytes) + it has read in. + + It detects the encoding from the presence of a UTF-8 BOM or an + encoding cookie as specified in PEP 263(2). If both a BOM and a + cookie are present, but disagree, a *note SyntaxError: 18d. will be + raised. Note that if the BOM is found, ‘'utf-8-sig'’ will be + returned as an encoding. + + If no encoding is specified, then the default of ‘'utf-8'’ will be + returned. + + Use *note open(): 2867. to open Python source files: it uses *note + detect_encoding(): 2868. to detect the file encoding. + + -- Function: tokenize.open (filename) + + Open a file in read only mode using the encoding detected by *note + detect_encoding(): 2868. + + Added in version 3.2. + + -- Exception: tokenize.TokenError + + Raised when either a docstring or expression that may be split over + several lines is not completed anywhere in the file, for example: + + """Beginning of + docstring + + or: + + [1, + 2, + 3 + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0263/ + + (2) https://peps.python.org/pep-0263/ + + +File: python.info, Node: Command-Line Usage<6>, Next: Examples<35>, Prev: Tokenizing Input, Up: tokenize — Tokenizer for Python source + +5.33.5.2 Command-Line Usage +........................... + +Added in version 3.3. + +The *note tokenize: fb. module can be executed as a script from the +command line. It is as simple as: + + python -m tokenize [-e] [filename.py] + +The following options are accepted: + + -- Option: -h, --help + + show this help message and exit + + -- Option: -e, --exact + + display token names using the exact type + +If ‘filename.py’ is specified its contents are tokenized to stdout. +Otherwise, tokenization is performed on stdin. + + +File: python.info, Node: Examples<35>, Prev: Command-Line Usage<6>, Up: tokenize — Tokenizer for Python source + +5.33.5.3 Examples +................. + +Example of a script rewriter that transforms float literals into Decimal +objects: + + 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') + +Example of tokenizing from the command line. The script: + + 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 '' + +The exact token type names can be displayed using the *note -e: 46cf. +option: + + $ 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(): 4d6.: + + 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(): 4d5.: + + 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 — Detection of ambiguous indentation, Next: pyclbr — Python module browser support, Prev: tokenize — Tokenizer for Python source, Up: Python Language Services + +5.33.6 ‘tabnanny’ — Detection of ambiguous indentation +------------------------------------------------------ + +'Source code:' Lib/tabnanny.py(1) + +__________________________________________________________________ + +For the time being this module is intended to be called as a script. +However it is possible to import it into an IDE and use the function +*note check(): 46d4. described below. + + Note: The API provided by this module is likely to change in future + releases; such changes may not be backward compatible. + + -- Function: tabnanny.check (file_or_dir) + + If 'file_or_dir' is a directory and not a symbolic link, then + recursively descend the directory tree named by 'file_or_dir', + checking all ‘.py’ files along the way. If 'file_or_dir' is an + ordinary Python source file, it is checked for whitespace related + problems. The diagnostic messages are written to standard output + using the *note print(): f70. function. + + -- Data: tabnanny.verbose + + Flag indicating whether to print verbose messages. This is + incremented by the ‘-v’ option if called as a script. + + -- Data: tabnanny.filename_only + + Flag indicating whether to print only the filenames of files + containing whitespace related problems. This is set to true by the + ‘-q’ option if called as a script. + + -- Exception: tabnanny.NannyNag + + Raised by *note process_tokens(): 46d8. if detecting an ambiguous + indent. Captured and handled in *note check(): 46d4. + + -- Function: tabnanny.process_tokens (tokens) + + This function is used by *note check(): 46d4. to process tokens + generated by the *note tokenize: fb. module. + +See also +........ + +Module *note tokenize: fb. + + Lexical scanner for Python source code. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tabnanny.py + + +File: python.info, Node: pyclbr — Python module browser support, Next: py_compile — Compile Python source files, Prev: tabnanny — Detection of ambiguous indentation, Up: Python Language Services + +5.33.7 ‘pyclbr’ — Python module browser support +----------------------------------------------- + +'Source code:' Lib/pyclbr.py(1) + +__________________________________________________________________ + +The *note pyclbr: b4. 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. + + -- Function: 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. + + -- Function: 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 Objects:: +* Class Objects: Class Objects<2>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pyclbr.py + + +File: python.info, Node: Function Objects, Next: Class Objects<2>, Up: pyclbr — Python module browser support + +5.33.7.1 Function Objects +......................... + + -- Class: pyclbr.Function + + Class ‘Function’ instances describe functions defined by def + statements. They have the following attributes: + + -- Attribute: file + + Name of the file in which the function is defined. + + -- Attribute: module + + The name of the module defining the function described. + + -- Attribute: name + + The name of the function. + + -- Attribute: lineno + + The line number in the file where the definition starts. + + -- Attribute: parent + + For top-level functions, ‘None’. For nested functions, the + parent. + + Added in version 3.7. + + -- Attribute: children + + A *note dictionary: 258. mapping names to descriptors for + nested functions and classes. + + Added in version 3.7. + + -- Attribute: is_async + + ‘True’ for functions that are defined with the *note async: + 5cd. prefix, ‘False’ otherwise. + + Added in version 3.10. + + +File: python.info, Node: Class Objects<2>, Prev: Function Objects, Up: pyclbr — Python module browser support + +5.33.7.2 Class Objects +...................... + + -- Class: pyclbr.Class + + Class ‘Class’ instances describe classes defined by class + statements. They have the same attributes as *note Functions: + 46dd. and two more. + + -- Attribute: file + + Name of the file in which the class is defined. + + -- Attribute: module + + The name of the module defining the class described. + + -- Attribute: name + + The name of the class. + + -- Attribute: lineno + + The line number in the file where the definition starts. + + -- Attribute: parent + + For top-level classes, ‘None’. For nested classes, the + parent. + + Added in version 3.7. + + -- Attribute: children + + A dictionary mapping names to descriptors for nested functions + and classes. + + Added in version 3.7. + + -- Attribute: 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(): 828. are listed as a string with the class + name instead of as ‘Class’ objects. + + -- Attribute: methods + + A *note dictionary: 258. mapping method names to line numbers. + This can be derived from the newer *note children: 46ed. + dictionary, but remains for back-compatibility. + + +File: python.info, Node: py_compile — Compile Python source files, Next: compileall — Byte-compile Python libraries, Prev: pyclbr — Python module browser support, Up: Python Language Services + +5.33.8 ‘py_compile’ — Compile Python source files +------------------------------------------------- + +'Source code:' Lib/py_compile.py(1) + +__________________________________________________________________ + +The *note py_compile: b3. 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. + +Though not often needed, this function can be useful when installing +modules for shared use, especially if some of the users may not have +permission to write the byte-code cache files in the directory +containing the source code. + + -- Exception: py_compile.PyCompileError + + Exception raised when an error occurs while attempting to compile + the file. + + -- Function: 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: 46f2. 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: 46f2. is + raised instead. However if 'quiet' is 2, no message is written, + and 'doraise' has no effect. + + If the path that 'cfile' becomes (either explicitly specified or + computed) is a symlink or non-regular file, *note FileExistsError: + 1019. will be raised. This is to act as a warning that import will + turn those paths into regular files if it is allowed to write + byte-compiled files to those paths. This is a side-effect of + import using file renaming to place the final byte-compiled file + into place to prevent concurrent file writing issues. + + 'optimize' controls the optimization level and is passed to the + built-in *note compile(): 192. function. The default of ‘-1’ + selects the optimization level of the current interpreter. + + 'invalidation_mode' should be a member of the *note + PycInvalidationMode: 46f3. enum and controls how the generated + bytecode cache is invalidated at runtime. The default is *note + PycInvalidationMode.CHECKED_HASH: 46f4. if the ‘SOURCE_DATE_EPOCH’ + environment variable is set, otherwise the default is *note + PycInvalidationMode.TIMESTAMP: 46f5. + + Changed in version 3.2: Changed default value of 'cfile' to be PEP + 3147(4)-compliant. Previous default was 'file' + ‘'c'’ (‘'o'’ if + optimization was enabled). Also added the 'optimize' parameter. + + Changed in version 3.4: Changed code to use *note importlib: 77. + for the byte-code cache file writing. This means file + creation/writing semantics now match what *note importlib: 77. + does, e.g. permissions, write-and-move semantics, etc. Also added + the caveat that *note FileExistsError: 1019. is raised if 'cfile' + is a symlink or non-regular file. + + Changed in version 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: 46f4. + + Changed in version 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. + + Changed in version 3.8: The 'quiet' parameter was added. + + -- Class: 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 Cached bytecode invalidation: 5e8. for more + information on how Python invalidates ‘.pyc’ files at runtime. + + Added in version 3.7. + + -- Attribute: 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. + + -- Attribute: 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. + + -- Attribute: UNCHECKED_HASH + + Like *note CHECKED_HASH: 46f4, 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: + +* Command-Line Interface: Command-Line Interface<6>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/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: Command-Line Interface<6>, Up: py_compile — Compile Python source files + +5.33.8.1 Command-Line Interface +............................... + +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. + +Changed in version 3.2: Added support for ‘-’. + +Changed in version 3.10: Added support for *note -q: 46fb. + +See also +........ + +Module *note compileall: 20. + + Utilities to compile all Python source files in a directory tree. + + +File: python.info, Node: compileall — Byte-compile Python libraries, Next: dis — Disassembler for Python bytecode, Prev: py_compile — Compile Python source files, Up: Python Language Services + +5.33.9 ‘compileall’ — Byte-compile Python libraries +--------------------------------------------------- + +'Source code:' Lib/compileall.py(1) + +__________________________________________________________________ + +This module provides some utility functions to support installing Python +libraries. These functions compile Python source files in a directory +tree. This module can be used to create the cached byte-code files at +library installation time, which makes them available for use even by +users who don’t have write permission to the library directories. + +*note Availability: 1d54.: not WASI. + +This module does not work or is not available on WebAssembly. See *note +WebAssembly platforms: 17e0. for more information. + +* Menu: + +* Command-line use:: +* Public functions:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/compileall.py + + +File: python.info, Node: Command-line use, Next: Public functions, Up: compileall — Byte-compile Python libraries + +5.33.9.1 Command-line use +......................... + +This module can work as a script (using ‘python -m compileall’) to +compile Python sources. + + -- Option: directory ... + -- Option: file ... + + Positional arguments are files to compile or directories that + contain source files, traversed recursively. If no argument is + given, behave as if the command line was ‘-l <DIRECTORIES FROM + SYS.PATH>’. + + -- Option: -l + + Do not recurse into subdirectories, only compile source code files + directly contained in the named or implied directories. + + -- Option: -f + + Force rebuild even if timestamps are up-to-date. + + -- Option: -q + + Do not print the list of files compiled. If passed once, error + messages will still be printed. If passed twice (‘-qq’), all + output is suppressed. + + -- Option: -d destdir + + Directory prepended to the path to each file being compiled. This + will appear in compilation time tracebacks, and is also compiled in + to the byte-code file, where it will be used in tracebacks and + other messages in cases where the source file does not exist at the + time the byte-code file is executed. + + -- 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 is used to search the full path to each file considered for + compilation, and if the regex produces a match, the file is + skipped. + + -- Option: -i list + + Read the file ‘list’ and add each line that it contains to the list + of files and directories to compile. If ‘list’ is ‘-’, read lines + from ‘stdin’. + + -- Option: -b + + Write the byte-code files to their legacy locations and names, + which may overwrite byte-code files created by another version of + Python. The default is to write files to their PEP 3147(1) + locations and names, which allows byte-code files from multiple + versions of Python to coexist. + + -- Option: -r + + Control the maximum recursion level for subdirectories. If this is + given, then ‘-l’ option will not be taken into account. ‘python -m + compileall <directory> -r 0’ is equivalent to ‘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(): + 1c4. will be used. + + -- Option: --invalidation-mode [timestamp|checked-hash|unchecked-hash] + + Control how the generated byte-code files are invalidated at + runtime. The ‘timestamp’ value, means that ‘.pyc’ files with the + source timestamp and size embedded will be generated. The + ‘checked-hash’ and ‘unchecked-hash’ values cause hash-based pycs to + be generated. Hash-based pycs embed a hash of the source file + contents rather than a timestamp. See *note Cached bytecode + invalidation: 5e8. for more information on how Python validates + bytecode cache files at runtime. The default is ‘timestamp’ if the + ‘SOURCE_DATE_EPOCH’ environment variable is not set, and + ‘checked-hash’ if the ‘SOURCE_DATE_EPOCH’ environment variable is + set. + + -- 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. + +Changed in version 3.2: Added the ‘-i’, ‘-b’ and ‘-h’ options. + +Changed in version 3.5: Added the ‘-j’, ‘-r’, and ‘-qq’ options. ‘-q’ +option was changed to a multilevel value. ‘-b’ will always produce a +byte-code file ending in ‘.pyc’, never ‘.pyo’. + +Changed in version 3.7: Added the ‘--invalidation-mode’ option. + +Changed in version 3.9: Added the ‘-s’, ‘-p’, ‘-e’ and +‘--hardlink-dupes’ options. Raised the default recursion limit from 10 +to *note sys.getrecursionlimit(): 4c0. Added the possibility to specify +the ‘-o’ option multiple times. + +There is no command-line option to control the optimization level used +by the *note compile(): 192. function, because the Python interpreter +itself already provides the option: ‘python -O -m compileall’. + +Similarly, the *note compile(): 192. function respects the *note +sys.pycache_prefix: 9a4. setting. The generated bytecode cache will +only be useful if *note compile(): 192. is run with the same *note +sys.pycache_prefix: 9a4. (if any) that will be used at runtime. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + +File: python.info, Node: Public functions, Prev: Command-line use, Up: compileall — Byte-compile Python libraries + +5.33.9.2 Public functions +......................... + + -- Function: 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) + + Recursively descend the directory tree named by 'dir', compiling + all ‘.py’ files along the way. Return a true value if all the + files compiled successfully, and a false value otherwise. + + The 'maxlevels' parameter is used to limit the depth of the + recursion; it defaults to ‘sys.getrecursionlimit()’. + + If 'ddir' is given, it is prepended to the path to each file being + compiled for use in compilation time tracebacks, and is also + compiled in to the byte-code file, where it will be used in + tracebacks and other messages in cases where the source file does + not exist at the time the byte-code file is executed. + + If 'force' is true, modules are re-compiled even if the timestamps + are up to date. + + 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: f81. + object. + + If 'quiet' is ‘False’ or ‘0’ (the default), the filenames and other + information are printed to standard out. Set to ‘1’, only errors + are printed. Set to ‘2’, all output is suppressed. + + If 'legacy' is true, byte-code files are written to their legacy + locations and names, which may overwrite byte-code files created by + another version of Python. The default is to write files to their + PEP 3147(1) locations and names, which allows byte-code files from + multiple versions of Python to coexist. + + 'optimize' specifies the optimization level for the compiler. It + is passed to the built-in *note compile(): 192. 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: 204. + will be raised. + + 'invalidation_mode' should be a member of the *note + py_compile.PycInvalidationMode: 46f3. enum and controls how the + generated pycs are invalidated at runtime. + + 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: c51. + + If 'hardlink_dupes' is true and two ‘.pyc’ files with different + optimization level have the same content, use hard links to + consolidate duplicate files. + + Changed in version 3.2: Added the 'legacy' and 'optimize' + parameter. + + Changed in version 3.5: Added the 'workers' parameter. + + Changed in version 3.5: 'quiet' parameter was changed to a + multilevel value. + + Changed in version 3.5: The 'legacy' parameter only writes out + ‘.pyc’ files, not ‘.pyo’ files no matter what the value of + 'optimize' is. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + + Changed in version 3.7: The 'invalidation_mode' parameter was + added. + + Changed in version 3.7.2: The 'invalidation_mode' parameter’s + default value is updated to ‘None’. + + Changed in version 3.8: Setting 'workers' to 0 now chooses the + optimal number of cores. + + Changed in version 3.9: Added 'stripdir', 'prependdir', + 'limit_sl_dest' and 'hardlink_dupes' arguments. Default value of + 'maxlevels' was changed from ‘10’ to ‘sys.getrecursionlimit()’ + + -- Function: 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) + + Compile the file with path 'fullname'. Return a true value if the + file compiled successfully, and a false value otherwise. + + If 'ddir' is given, it is prepended to the path to the file being + compiled for use in compilation time tracebacks, and is also + compiled in to the byte-code file, where it will be used in + tracebacks and other messages in cases where the source file does + not exist at the time the byte-code file is executed. + + 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: f81. object. + + If 'quiet' is ‘False’ or ‘0’ (the default), the filenames and other + information are printed to standard out. Set to ‘1’, only errors + are printed. Set to ‘2’, all output is suppressed. + + If 'legacy' is true, byte-code files are written to their legacy + locations and names, which may overwrite byte-code files created by + another version of Python. The default is to write files to their + PEP 3147(2) locations and names, which allows byte-code files from + multiple versions of Python to coexist. + + 'optimize' specifies the optimization level for the compiler. It + is passed to the built-in *note compile(): 192. function. Accepts + also a sequence of optimization levels which lead to multiple + compilations of one ‘.py’ file in one call. + + 'invalidation_mode' should be a member of the *note + py_compile.PycInvalidationMode: 46f3. enum and controls how the + generated pycs are invalidated at runtime. + + 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: c51. + + 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. + + Changed in version 3.5: 'quiet' parameter was changed to a + multilevel value. + + Changed in version 3.5: The 'legacy' parameter only writes out + ‘.pyc’ files, not ‘.pyo’ files no matter what the value of + 'optimize' is. + + Changed in version 3.7: The 'invalidation_mode' parameter was + added. + + Changed in version 3.7.2: The 'invalidation_mode' parameter’s + default value is updated to ‘None’. + + Changed in version 3.9: Added 'stripdir', 'prependdir', + 'limit_sl_dest' and 'hardlink_dupes' arguments. + + -- Function: compileall.compile_path (skip_curdir=True, maxlevels=0, + force=False, quiet=0, legacy=False, optimize=-1, + invalidation_mode=None) + + Byte-compile all the ‘.py’ files found along ‘sys.path’. Return a + true value if all the files compiled successfully, and a false + value otherwise. + + If 'skip_curdir' is true (the default), the current directory is + not included in the search. All other parameters are passed to the + *note compile_dir(): b26. function. Note that unlike the other + compile functions, ‘maxlevels’ defaults to ‘0’. + + Changed in version 3.2: Added the 'legacy' and 'optimize' + parameter. + + Changed in version 3.5: 'quiet' parameter was changed to a + multilevel value. + + Changed in version 3.5: The 'legacy' parameter only writes out + ‘.pyc’ files, not ‘.pyo’ files no matter what the value of + 'optimize' is. + + Changed in version 3.7: The 'invalidation_mode' parameter was + added. + + Changed in version 3.7.2: The 'invalidation_mode' parameter’s + default value is updated to ‘None’. + +To force a recompile of all the ‘.py’ files in the ‘Lib/’ subdirectory +and all its subdirectories: + + 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) + +See also +........ + +Module *note py_compile: b3. + + Byte-compile a single source file. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + (2) https://peps.python.org/pep-3147/ + + +File: python.info, Node: dis — Disassembler for Python bytecode, Next: pickletools — Tools for pickle developers, Prev: compileall — Byte-compile Python libraries, Up: Python Language Services + +5.33.10 ‘dis’ — Disassembler for Python bytecode +------------------------------------------------ + +'Source code:' Lib/dis.py(1) + +__________________________________________________________________ + +The *note dis: 38. module supports the analysis of CPython *note +bytecode: 187. 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 implementation detail:' Bytecode is an implementation detail of +the CPython interpreter. No guarantees are made that bytecode will not +be added, removed, or changed between versions of Python. Use of this +module should not be considered to work across Python VMs or Python +releases. + +Changed in version 3.6: Use 2 bytes for each instruction. Previously +the number of bytes varied by instruction. + +Changed in version 3.10: The argument of jump, exception handling and +loop instructions is now the instruction offset rather than the byte +offset. + +Changed in version 3.11: Some instructions are accompanied by one or +more inline cache entries, which take the form of *note CACHE: 6f4. +instructions. These instructions are hidden by default, but can be +shown by passing ‘show_caches=True’ to any *note dis: 38. 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’. + +Changed in version 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: 6f4. entries. + +As a consequence, the presence of the *note CACHE: 6f4. instructions is +transparent for forward jumps but needs to be taken into account when +reasoning about backward jumps. + +Changed in version 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. + +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 0 (alist) + CALL 1 + RETURN_VALUE + +(The “2” is a line number). + +* Menu: + +* Command-line interface: Command-line interface<3>. +* Bytecode analysis:: +* Analysis functions:: +* Python Bytecode Instructions:: +* Opcode collections:: + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/dis.py + + +File: python.info, Node: Command-line interface<3>, Next: Bytecode analysis, Up: dis — Disassembler for Python bytecode + +5.33.10.1 Command-line interface +................................ + +The *note dis: 38. module can be invoked as a script from the command +line: + + python -m dis [-h] [-C] [-O] [infile] + +The following options are accepted: + + -- Option: -h, --help + + Display usage and exit. + + -- 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. + +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: Bytecode analysis, Next: Analysis functions, Prev: Command-line interface<3>, Up: dis — Disassembler for Python bytecode + +5.33.10.2 Bytecode analysis +........................... + +Added in version 3.4. + +The bytecode analysis API allows pieces of Python code to be wrapped in +a *note Bytecode: f29. object that provides easy access to details of +the compiled code. + + -- Class: dis.Bytecode (x, *, first_line=None, current_offset=None, + show_caches=False, adaptive=False, show_offsets=False) + + Analyse the bytecode corresponding to a function, generator, + asynchronous generator, coroutine, method, string of source code, + or a code object (as returned by *note compile(): 192.). + + This is a convenience wrapper around many of the functions listed + below, most notably *note get_instructions(): 1db, as iterating + over a *note Bytecode: f29. instance yields the bytecode operations + as *note Instruction: 1dc. instances. + + If 'first_line' is not ‘None’, it indicates the line number that + should be reported for the first source line in the disassembled + code. Otherwise, the source line information (if any) is taken + directly from the disassembled code object. + + If 'current_offset' is not ‘None’, it refers to an instruction + offset in the disassembled code. Setting this means *note dis(): + f2a. will display a “current instruction” marker against the + specified opcode. + + If 'show_caches' is ‘True’, *note dis(): f2a. will display inline + cache entries used by the interpreter to specialize the bytecode. + + If 'adaptive' is ‘True’, *note dis(): f2a. will display specialized + bytecode that may be different from the original bytecode. + + If 'show_offsets' is ‘True’, *note dis(): f2a. will include + instruction offsets in the output. + + -- Method: classmethod from_traceback (tb, *, show_caches=False) + + Construct a *note Bytecode: f29. instance from the given + traceback, setting 'current_offset' to the instruction + responsible for the exception. + + -- Data: codeobj + + The compiled code object. + + -- Data: first_line + + The first source line of the code object (if available) + + -- Method: dis () + + Return a formatted view of the bytecode operations (the same + as printed by *note dis.dis(): b34, but returned as a + multi-line string). + + -- Method: info () + + Return a formatted multi-line string with detailed information + about the code object, like *note code_info(): 122c. + + Changed in version 3.7: This can now handle coroutine and + asynchronous generator objects. + + Changed in version 3.11: Added the 'show_caches' and 'adaptive' + parameters. + +Example: + + >>> bytecode = dis.Bytecode(myfunc) + >>> for instr in bytecode: + ... print(instr.opname) + ... + RESUME + LOAD_GLOBAL + LOAD_FAST + CALL + RETURN_VALUE + + +File: python.info, Node: Analysis functions, Next: Python Bytecode Instructions, Prev: Bytecode analysis, Up: dis — Disassembler for Python bytecode + +5.33.10.3 Analysis functions +............................ + +The *note dis: 38. 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: + + -- Function: dis.code_info (x) + + Return a formatted multi-line string with detailed code object + information for the supplied function, generator, asynchronous + generator, coroutine, method, source code string or code object. + + Note that the exact contents of code info strings are highly + implementation dependent and they may change arbitrarily across + Python VMs or Python releases. + + Added in version 3.2. + + Changed in version 3.7: This can now handle coroutine and + asynchronous generator objects. + + -- Function: dis.show_code (x, *, file=None) + + Print detailed code object information for the supplied function, + method, source code string or code object to 'file' (or + ‘sys.stdout’ if 'file' is not specified). + + This is a convenient shorthand for ‘print(code_info(x), + file=file)’, intended for interactive exploration at the + interpreter prompt. + + Added in version 3.2. + + Changed in version 3.4: Added 'file' parameter. + + -- Function: dis.dis (x=None, *, file=None, depth=None, + show_caches=False, adaptive=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: + 188. Strings are first compiled to code objects with the *note + compile(): 192. built-in function before being disassembled. If no + object is provided, this function disassembles the last traceback. + + The disassembly is written as text to the supplied 'file' argument + if provided and to ‘sys.stdout’ otherwise. + + 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. + + Changed in version 3.4: Added 'file' parameter. + + Changed in version 3.7: Implemented recursive disassembling and + added 'depth' parameter. + + Changed in version 3.7: This can now handle coroutine and + asynchronous generator objects. + + Changed in version 3.11: Added the 'show_caches' and 'adaptive' + parameters. + + -- Function: distb(tb=None, *, file=None, show_caches=False, + adaptive=False, + + -- Function: show_offset=False) + + Disassemble the top-of-stack function of a traceback, using the + last traceback if none was passed. The instruction causing the + exception is indicated. + + The disassembly is written as text to the supplied 'file' argument + if provided and to ‘sys.stdout’ otherwise. + + Changed in version 3.4: Added 'file' parameter. + + Changed in version 3.11: Added the 'show_caches' and 'adaptive' + parameters. + + Changed in version 3.13: Added the 'show_offsets' parameter. + + -- Function: dis.disassemble (code, lasti=-1, *, file=None, + show_caches=False, adaptive=False) + + -- Function: disco(code, lasti=-1, *, file=None, show_caches=False, + adaptive=False, + + -- Function: show_offsets=False) + + Disassemble a code object, indicating the last instruction if + 'lasti' was provided. The output is divided in the following + columns: + + 1. the line number, for the first instruction of each line + + 2. the current instruction, indicated as ‘-->’, + + 3. a labelled instruction, indicated with ‘>>’, + + 4. the address of the instruction, + + 5. the operation code name, + + 6. operation parameters, and + + 7. interpretation of the parameters in parentheses. + + The parameter interpretation recognizes local and global variable + names, constant values, branch targets, and compare operators. + + The disassembly is written as text to the supplied 'file' argument + if provided and to ‘sys.stdout’ otherwise. + + Changed in version 3.4: Added 'file' parameter. + + Changed in version 3.11: Added the 'show_caches' and 'adaptive' + parameters. + + Changed in version 3.13: Added the 'show_offsets' parameter. + + -- Function: dis.get_instructions (x, *, first_line=None, + show_caches=False, adaptive=False) + + Return an iterator over the instructions in the supplied function, + method, source code string or code object. + + The iterator generates a series of *note Instruction: 1dc. named + tuples giving the details of each operation in the supplied code. + + If 'first_line' is not ‘None’, it indicates the line number that + should be reported for the first source line in the disassembled + code. Otherwise, the source line information (if any) is taken + directly from the disassembled code object. + + The 'adaptive' parameter works as it does in *note dis(): 38. + + Added in version 3.4. + + Changed in version 3.11: Added the 'show_caches' and 'adaptive' + parameters. + + Changed in version 3.13: The 'show_caches' parameter is deprecated + and has no effect. The iterator generates the *note Instruction: + 1dc. 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. + + -- Function: dis.findlinestarts (code) + + This generator function uses the *note co_lines(): 2f5. method of + the *note code object: 1d2. 'code' to find the offsets which are + starts of lines in the source code. They are generated as + ‘(offset, lineno)’ pairs. + + Changed in version 3.6: Line numbers can be decreasing. Before, + they were always increasing. + + Changed in version 3.10: The PEP 626(1) *note co_lines(): 2f5. + method is used instead of the *note co_firstlineno: 1f42. and *note + co_lnotab: 2e4. attributes of the *note code object: 1d2. + + Changed in version 3.13: Line numbers can be ‘None’ for bytecode + that does not map to source lines. + + -- Function: dis.findlabels (code) + + Detect all offsets in the raw compiled bytecode string 'code' which + are jump targets, and return a list of these offsets. + + -- Function: dis.stack_effect (opcode, oparg=None, *, jump=None) + + Compute the stack effect of 'opcode' with argument 'oparg'. + + If the code has a jump target and 'jump' is ‘True’, *note + stack_effect(): f2c. 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. + + Changed in version 3.8: Added 'jump' parameter. + + Changed in version 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 Bytecode Instructions, Next: Opcode collections, Prev: Analysis functions, Up: dis — Disassembler for Python bytecode + +5.33.10.4 Python Bytecode Instructions +...................................... + +The *note get_instructions(): 1db. function and *note Bytecode: f29. +class provide details of bytecode instructions as *note Instruction: +1dc. instances: + + -- Class: dis.Instruction + + Details for a bytecode operation + + -- Data: opcode + + numeric code for operation, corresponding to the opcode values + listed below and the bytecode values in the *note Opcode + collections: 4725. + + -- Data: opname + + human readable name for operation + + -- Data: baseopcode + + numeric code for the base operation if operation is + specialized; otherwise equal to *note opcode: 4724. + + -- Data: baseopname + + human readable name for the base operation if operation is + specialized; otherwise equal to *note opname: 4729. + + -- Data: arg + + numeric argument to operation (if any), otherwise ‘None’ + + -- Data: oparg + + alias for *note arg: 472a. + + -- Data: argval + + resolved arg value (if any), otherwise ‘None’ + + -- Data: argrepr + + human readable description of operation argument (if any), + otherwise an empty string. + + -- Data: offset + + start index of operation within bytecode sequence + + -- Data: start_offset + + start index of operation within bytecode sequence, including + prefixed ‘EXTENDED_ARG’ operations if present; otherwise equal + to *note offset: 472e. + + -- Data: cache_offset + + start index of the cache entries following the operation + + -- Data: end_offset + + end index of the cache entries following the operation + + -- Data: starts_line + + ‘True’ if this opcode starts a source line, otherwise ‘False’ + + -- Data: line_number + + source line number associated with this opcode (if any), + otherwise ‘None’ + + -- Data: is_jump_target + + ‘True’ if other code jumps to here, otherwise ‘False’ + + -- Data: jump_target + + bytecode index of the jump target if this is a jump operation, + otherwise ‘None’ + + -- Data: positions + + *note dis.Positions: 44bd. object holding the start and end + locations that are covered by this instruction. + + -- Data: 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. + + Changed in version 3.11: Field ‘positions’ is added. + + Changed in version 3.13: Changed field ‘starts_line’. + + Added fields ‘start_offset’, ‘cache_offset’, ‘end_offset’, + ‘baseopname’, ‘baseopcode’, ‘jump_target’, ‘oparg’, ‘line_number’ + and ‘cache_info’. + + -- Class: dis.Positions + + In case the information is not available, some fields might be + ‘None’. + + -- Data: lineno + + -- Data: end_lineno + + -- Data: col_offset + + -- Data: end_col_offset + + Added in version 3.11. + +The Python compiler currently generates the following bytecode +instructions. + +'General instructions' + +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: 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. + +'Unary operations' + +Unary operations take the top of the stack, apply the operation, and +push the result back on the stack. + + -- Opcode: UNARY_NEGATIVE + + Implements ‘STACK[-1] = -STACK[-1]’. + + -- Opcode: UNARY_NOT + + Implements ‘STACK[-1] = not STACK[-1]’. + + Changed in version 3.13: This instruction now requires an exact + *note bool: 463. 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: bde. or *note + coroutine: 48d. 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. + + -- Opcode: BINARY_SUBSCR + + Implements: + + key = STACK.pop() + container = STACK.pop() + STACK.append(container[key]) + + -- 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() + values = STACK.pop() + container[start:end] = value + + Added in version 3.12. + +'Coroutine opcodes' + + -- 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: 44ce. 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. + + Changed in version 3.11: Previously, this instruction did not have + an oparg. + + -- Opcode: GET_AITER + + Implements ‘STACK[-1] = STACK[-1].__aiter__()’. + + Added in version 3.5. + + Changed in version 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: aab. 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: + 1a2c, it is re-raised. + + Added in version 3.8. + + Changed in version 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(): 4f4. or *note + close(): 16f4. call through the current frame. If ‘STACK[-1]’ is + an instance of *note StopIteration: bfa, pop three values from the + stack and push its ‘value’ member. Otherwise, re-raise + ‘STACK[-1]’. + + Added in version 3.12. + + -- Opcode: BEFORE_ASYNC_WITH + + Resolves ‘__aenter__’ and ‘__aexit__’ from ‘STACK[-1]’. Pushes + ‘__aexit__’ and result of ‘__aenter__()’ to the stack: + + STACK.extend((__aexit__, __aenter__()) + + Added in version 3.5. + +'Miscellaneous opcodes' + + -- 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. + + Changed in version 3.8: Map value is ‘STACK[-1]’ and map key is + ‘STACK[-2]’. Before, those were reversed. + +For all of the *note SET_ADD: 4748, *note LIST_APPEND: 4749. and *note +MAP_ADD: aac. instructions, while the added value or key/value pair is +popped off, the container object remains on the stack so that it is +available for further iterations of the loop. + + -- Opcode: RETURN_VALUE + + Returns with ‘STACK[-1]’ to the caller of the function. + + -- Opcode: RETURN_CONST (consti) + + Returns with ‘co_consts[consti]’ to the caller of the function. + + Added in version 3.12. + + -- Opcode: YIELD_VALUE + + Yields ‘STACK.pop()’ from a *note generator: 105a. + + Changed in version 3.11: oparg set to be the stack depth. + + Changed in version 3.12: oparg set to be the exception block depth, + for efficient closing of generators. + + Changed in version 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: d55. + statically. + + Added in version 3.6. + + -- Opcode: POP_EXCEPT + + Pops a value from the stack, which is used to restore the exception + state. + + Changed in version 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: 886. of the current frame. + + Added in version 3.9. + + Changed in version 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: 5ce. statement. + + Added in version 3.9. + + Changed in version 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_ASSERTION_ERROR + + Pushes *note AssertionError: 6a5. onto the stack. Used by the + *note assert: 968. statement. + + Added in version 3.9. + + -- Opcode: LOAD_BUILD_CLASS + + Pushes ‘builtins.__build_class__()’ onto the stack. It is later + called to construct a class. + + -- Opcode: BEFORE_WITH + + This opcode performs several operations before a with block starts. + First, it loads *note __exit__(): 12f3. from the context manager + and pushes it onto the stack for later use by *note + WITH_EXCEPT_START: 474c. Then, *note __enter__(): 5c4. is called. + Finally, the result of calling the ‘__enter__()’ method is pushed + onto the stack. + + Added in version 3.11. + + -- Opcode: GET_LEN + + Perform ‘STACK.append(len(STACK[-1]))’. Used in *note match: 809. + 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: + 8c9. (or, more technically: if it has the *note Py_TPFLAGS_MAPPING: + 18a3. flag set in its *note tp_flags: 18bd.), 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: + 11b6. and is 'not' an instance of *note str: 447./*note bytes: + 1c2./*note bytearray: 53a. (or, more technically: if it has the + *note Py_TPFLAGS_SEQUENCE: 18a4. flag set in its *note tp_flags: + 18bd.), 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: 36b. containing the corresponding + values. Otherwise, push ‘None’. + + Added in version 3.10. + + Changed in version 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: 1f41. of the *note code object: 1d2. + The compiler tries to use *note STORE_FAST: 16f1. or *note + STORE_GLOBAL: 4752. if possible. + + -- Opcode: DELETE_NAME (namei) + + Implements ‘del name’, where 'namei' is the index into *note + co_names: 1f41. attribute of the *note code object: 1d2. + + -- 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: 1f41. of the + *note code object: 1d2. + + -- Opcode: DELETE_ATTR (namei) + + Implements: + + obj = STACK.pop() + del obj.name + + where 'namei' is the index of name into *note co_names: 1f41. of + the *note code object: 1d2. + + -- Opcode: STORE_GLOBAL (namei) + + Works as *note STORE_NAME: 4751, but stores the name as a global. + + -- Opcode: DELETE_GLOBAL (namei) + + Works as *note DELETE_NAME: 4753, but deletes a global name. + + -- Opcode: LOAD_CONST (consti) + + Pushes ‘co_consts[consti]’ onto the stack. + + -- 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: 4e2. and *note LOAD_FROM_DICT_OR_GLOBALS: + 4e3. + + 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: + 16e9. This is used for loading global variables in *note + annotation scopes: 188. within class bodies. + + Added in version 3.12. + + -- 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) + + Works as *note BUILD_TUPLE: 4759, but creates a list. + + -- Opcode: BUILD_SET (count) + + Works as *note BUILD_TUPLE: 4759, but creates a 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]}’. + + Changed in version 3.5: The dictionary is created from stack items + instead of creating an empty dictionary pre-sized to hold 'count' + items. + + -- Opcode: BUILD_CONST_KEY_MAP (count) + + The version of *note BUILD_MAP: 16e2. specialized for constant + keys. Pops the top element on the stack which contains a tuple of + keys, then starting from ‘STACK[-2]’, pops 'count' values to form + values in the built dictionary. + + Added in version 3.6. + + -- 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: 475e. 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: 702. or *note CALL_KW: + 16e3. when calling the unbound method. Otherwise, ‘NULL’ and the + object returned by the attribute lookup are pushed. + + Changed in version 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(): 4d7, 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: 4da, 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: 4da, 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(): 4d7. (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’. + + Changed in version 3.13: The fifth-lowest bit of the oparg now + indicates a forced conversion to *note bool: 463. + + -- 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__(): 8d3. The module object is pushed onto the + stack. The current namespace is not affected: for a proper import + statement, a subsequent *note STORE_FAST: 16f1. 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: 16f1. instruction. + + -- Opcode: JUMP_FORWARD (delta) + + Increments bytecode counter by '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. + + Changed in version 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). + + Changed in version 3.12: This is no longer a pseudo-instruction. + + Changed in version 3.13: This instruction now requires an exact + *note bool: 463. operand. + + -- Opcode: POP_JUMP_IF_FALSE (delta) + + If ‘STACK[-1]’ is false, increments the bytecode counter by + 'delta'. ‘STACK[-1]’ is popped. + + Changed in version 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). + + Changed in version 3.12: This is no longer a pseudo-instruction. + + Changed in version 3.13: This instruction now requires an exact + *note bool: 463. 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. + + Changed in version 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. + + Changed in version 3.12: This is no longer a pseudo-instruction. + + -- Opcode: FOR_ITER (delta) + + ‘STACK[-1]’ is an *note iterator: 1ac. Call its *note __next__(): + 12c0. 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'. + + Changed in version 3.12: Up until 3.11 the iterator was popped when + it was exhausted. + + -- Opcode: LOAD_GLOBAL (namei) + + Loads the global named ‘co_names[namei>>1]’ onto the stack. + + Changed in version 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) + + Pushes a reference to the local ‘co_varnames[var_num]’ onto the + stack. + + Changed in version 3.12: This opcode is now only used in situations + where the local variable is guaranteed to be initialized. It + cannot raise *note UnboundLocalError: 1500. + + -- 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_CHECK (var_num) + + Pushes a reference to the local ‘co_varnames[var_num]’ onto the + stack, raising an *note UnboundLocalError: 1500. 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) + + Deletes local ‘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. + + Changed in version 3.11: ‘i’ is no longer offset by the length of + *note co_varnames: 1f3c. + + -- 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: 4769. This is used for loading *note + closure variables: 1f3f. in class bodies (which previously used + ‘LOAD_CLASSDEREF’) and in *note annotation scopes: 188. 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. + + Changed in version 3.11: ‘i’ is no longer offset by the length of + *note co_varnames: 1f3c. + + -- Opcode: DELETE_DEREF (i) + + Empties the cell contained in slot ‘i’ of the “fast locals” + storage. Used by the *note del: 17a6. statement. + + Added in version 3.2. + + Changed in version 3.11: ‘i’ is no longer offset by the length of + *note co_varnames: 1f3c. + + -- Opcode: COPY_FREE_VARS (n) + + Copies the ‘n’ *note free (closure) variables: 1f3f. 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. + + Changed in version 3.13: The callable now always appears at the + same position on the stack. + + Changed in version 3.13: Calls with keyword arguments are now + handled by *note CALL_KW: 16e3. + + -- 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: 36b. 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_METHOD: c1f. 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]’. + + Changed in version 3.10: Flag value ‘0x04’ is a tuple of strings + instead of dictionary + + Changed in version 3.11: Qualified name at ‘STACK[-1]’ was removed. + + Changed in version 3.13: Extra function attributes on the stack, + signaled by oparg flags, were removed. They now use *note + SET_FUNCTION_ATTRIBUTE: 476d. + + -- 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 + + Added in version 3.13. + + -- 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(): 465. 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(): 447. on 'value' + + * ‘oparg == 2’: call *note repr(): 7f9. on 'value' + + * ‘oparg == 3’: call *note ascii(): 13b2. 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. + + Changed in version 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’ oparand 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. + + Changed in version 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: bfa, 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: 2a0. collection instead. + + Changed in version 3.6: Now every instruction has an argument, but + opcodes ‘< HAVE_ARGUMENT’ ignore it. Before, only opcodes ‘>= + HAVE_ARGUMENT’ had an argument. + + Changed in version 3.12: Pseudo instructions were added to the + *note dis: 38. module, and for them it is not true that comparison + with ‘HAVE_ARGUMENT’ indicates whether they use their arg. + + Deprecated since version 3.13: Use *note hasarg: 2a0. 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 Description + + -------------------------------------------------------------------------------- + + ‘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: 15d. + + + ‘INTRINSIC_PARAMSPEC’ Creates a + *note typing.ParamSpec: 15e. + + + ‘INTRINSIC_TYPEVARTUPLE’ Creates a + *note typing.TypeVarTuple: 15f. + + + ‘INTRINSIC_SUBSCRIPT_GENERIC’ Returns *note typing.Generic: 1619. + subscripted with the argument + + + ‘INTRINSIC_TYPEALIAS’ Creates a + *note typing.TypeAliasType: 450.; + used in the *note type: 433. + 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 Description + + ------------------------------------------------------------------------------------- + + ‘INTRINSIC_2_INVALID’ Not valid + + + ‘INTRINSIC_PREP_RERAISE_STAR’ Calculates the + *note ExceptionGroup: 1b6. to raise + from a ‘try-except*’. + + + ‘INTRINSIC_TYPEVAR_WITH_BOUND’ Creates a *note typing.TypeVar: 15d. + with a bound. + + + ‘INTRINSIC_TYPEVAR_WITH_CONSTRAINTS’ Creates a *note typing.TypeVar: 15d. + with constraints. + + + ‘INTRINSIC_SET_FUNCTION_TYPE_PARAMS’ Sets the ‘__type_params__’ attribute + of a function. + + + Added in version 3.12. + +'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: 5ce. and *note async with: 5d1. + constructs, which push the return value of the context manager’s + *note __enter__(): 5c4. or *note __aenter__(): 1fd0. 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: 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. + + Changed in version 3.13: This opcode is now a pseudo-instruction. + + -- Opcode: LOAD_METHOD + + Optimized unbound method lookup. Emitted as a ‘LOAD_ATTR’ opcode + with a flag set in the arg. + + +File: python.info, Node: Opcode collections, Prev: Python Bytecode Instructions, Up: dis — Disassembler for Python bytecode + +5.33.10.5 Opcode collections +............................ + +These collections are provided for automatic introspection of bytecode +instructions: + +Changed in version 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’. + + -- Data: dis.opname + + Sequence of operation names, indexable using the bytecode. + + -- Data: dis.opmap + + Dictionary mapping operation names to bytecodes. + + -- Data: dis.cmp_op + + Sequence of all compare operation names. + + -- Data: dis.hasarg + + Sequence of bytecodes that use their argument. + + Added in version 3.12. + + -- Data: dis.hasconst + + Sequence of bytecodes that access a constant. + + -- Data: dis.hasfree + + Sequence of bytecodes that access a *note free (closure) variable: + 1f3f. ‘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. + + -- Data: dis.hasname + + Sequence of bytecodes that access an attribute by name. + + -- Data: dis.hasjump + + Sequence of bytecodes that have a jump target. All jumps are + relative. + + Added in version 3.13. + + -- Data: dis.haslocal + + Sequence of bytecodes that access a local variable. + + -- Data: dis.hascompare + + Sequence of bytecodes of Boolean operations. + + -- Data: dis.hasexc + + Sequence of bytecodes that set an exception handler. + + Added in version 3.12. + + -- Data: dis.hasjrel + + Sequence of bytecodes that have a relative jump target. + + Deprecated since version 3.13: All jumps are now relative. Use + *note hasjump: 477d. + + -- Data: dis.hasjabs + + Sequence of bytecodes that have an absolute jump target. + + Deprecated since version 3.13: All jumps are now relative. This + list is empty. + + +File: python.info, Node: pickletools — Tools for pickle developers, Prev: dis — Disassembler for Python bytecode, Up: Python Language Services + +5.33.11 ‘pickletools’ — Tools for pickle developers +--------------------------------------------------- + +'Source code:' Lib/pickletools.py(1) + +__________________________________________________________________ + +This module contains various constants relating to the intimate details +of the *note pickle: a6. module, some lengthy comments about the +implementation, and a few useful functions for analyzing pickled data. +The contents of this module are useful for Python core developers who +are working on the *note pickle: a6.; ordinary users of the *note +pickle: a6. module probably won’t find the *note pickletools: a7. module +relevant. + +* Menu: + +* Command line usage: Command line usage<2>. +* Programmatic Interface: Programmatic Interface<2>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pickletools.py + + +File: python.info, Node: Command line usage<2>, Next: Programmatic Interface<2>, Up: pickletools — Tools for pickle developers + +5.33.11.1 Command line usage +............................ + +Added in version 3.2. + +When invoked from the command line, ‘python -m pickletools’ will +disassemble the contents of one or more pickle files. Note that if you +want to see the Python object stored in the pickle rather than the +details of pickle format, you may want to use ‘-m pickle’ instead. +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. + +For example, with a tuple ‘(1, 2)’ pickled in file ‘x.pickle’: + + $ 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: + +* Command line options: Command line options<3>. + + +File: python.info, Node: Command line options<3>, Up: Command line usage<2> + +5.33.11.2 Command line options +.............................. + + -- Option: -a, --annotate + + Annotate each line with a short opcode description. + + -- Option: -o, --output=<file> + + Name of a file where the output should be written. + + -- Option: -l, --indentlevel=<num> + + The number of blanks by which to indent a new MARK level. + + -- Option: -m, --memo + + When multiple objects are disassembled, preserve memo between + disassemblies. + + -- Option: -p, --preamble=<preamble> + + When more than one pickle file are specified, print given preamble + before each disassembly. + + +File: python.info, Node: Programmatic Interface<2>, Prev: Command line usage<2>, Up: pickletools — Tools for pickle developers + +5.33.11.3 Programmatic Interface +................................ + + -- Function: pickletools.dis (pickle, out=None, memo=None, + indentlevel=4, annotate=0) + + Outputs a symbolic disassembly of the pickle to the file-like + object 'out', defaulting to ‘sys.stdout’. 'pickle' can be a string + or a file-like object. 'memo' can be a Python dictionary that will + be used as the pickle’s memo; it can be used to perform + disassemblies across multiple pickles created by the same pickler. + Successive levels, indicated by ‘MARK’ opcodes in the stream, are + indented by 'indentlevel' spaces. If a nonzero value is given to + 'annotate', each opcode in the output is annotated with a short + description. The value of 'annotate' is used as a hint for the + column where annotation should start. + + Changed in version 3.2: Added the 'annotate' parameter. + + -- Function: pickletools.genops (pickle) + + Provides an *note iterator: 1ac. over all of the opcodes in a + pickle, returning a sequence of ‘(opcode, arg, pos)’ triples. + 'opcode' is an instance of an ‘OpcodeInfo’ class; 'arg' is the + decoded value, as a Python object, of the opcode’s argument; 'pos' + is the position at which this opcode is located. 'pickle' can be a + string or a file-like object. + + -- Function: pickletools.optimize (picklestring) + + Returns a new equivalent pickle string after eliminating unused + ‘PUT’ opcodes. The optimized pickle is shorter, takes less + transmission time, requires less storage space, and unpickles more + efficiently. + + +File: python.info, Node: MS Windows Specific Services, Next: Unix Specific Services, Prev: Python Language Services, Up: The Python Standard Library + +5.34 MS Windows Specific Services +================================= + +This chapter describes modules that are only available on MS Windows +platforms. + +* Menu: + +* msvcrt — Useful routines from the MS VC++ runtime:: +* winreg — Windows registry access:: +* winsound — Sound-playing interface for Windows:: + + +File: python.info, Node: msvcrt — Useful routines from the MS VC++ runtime, Next: winreg — Windows registry access, Up: MS Windows Specific Services + +5.34.1 ‘msvcrt’ — Useful routines from the MS VC++ runtime +---------------------------------------------------------- + +__________________________________________________________________ + +These functions provide access to some useful capabilities on Windows +platforms. Some higher-level modules use these functions to build the +Windows implementations of their services. For example, the *note +getpass: 62. module uses this in the implementation of the *note +getpass(): 62. function. + +Further documentation on these functions can be found in the Platform +API documentation. + +The module implements both the normal and wide char variants of the +console I/O api. The normal API deals only with ASCII characters and is +of limited use for internationalized applications. The wide char API +should be used where ever possible. + +Changed in version 3.3: Operations in this module now raise *note +OSError: 413. where *note IOError: 104b. was raised. + +* Menu: + +* File Operations:: +* Console I/O:: +* Other Functions:: + + +File: python.info, Node: File Operations, Next: Console I/O, Up: msvcrt — Useful routines from the MS VC++ runtime + +5.34.1.1 File Operations +........................ + + -- Function: msvcrt.locking (fd, mode, nbytes) + + Lock part of a file based on file descriptor 'fd' from the C + runtime. Raises *note OSError: 413. 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. + + Raises an *note auditing event: 18ba. ‘msvcrt.locking’ with + arguments ‘fd’, ‘mode’, ‘nbytes’. + + -- Data: msvcrt.LK_LOCK + -- Data: 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: 413. is + raised. + + -- Data: msvcrt.LK_NBLCK + -- Data: msvcrt.LK_NBRLCK + + Locks the specified bytes. If the bytes cannot be locked, *note + OSError: 413. is raised. + + -- Data: msvcrt.LK_UNLCK + + Unlocks the specified bytes, which must have been previously + locked. + + -- Function: msvcrt.setmode (fd, flags) + + Set the line-end translation mode for the file descriptor 'fd'. To + set it to text mode, 'flags' should be *note os.O_TEXT: 2b60.; for + binary, it should be *note os.O_BINARY: 2b51. + + -- Function: 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: + 2b53, *note os.O_RDONLY: 2b4f, *note os.O_TEXT: 2b60. and *note + os.O_NOINHERIT: 2b5b. The returned file descriptor may be used as + a parameter to *note os.fdopen(): 1f32. to create a file object. + + The file descriptor is inheritable by default. Pass *note + os.O_NOINHERIT: 2b5b. flag to make it non inheritable. + + Raises an *note auditing event: 18ba. ‘msvcrt.open_osfhandle’ with + arguments ‘handle’, ‘flags’. + + -- Function: msvcrt.get_osfhandle (fd) + + Return the file handle for the file descriptor 'fd'. Raises *note + OSError: 413. if 'fd' is not recognized. + + Raises an *note auditing event: 18ba. ‘msvcrt.get_osfhandle’ with + argument ‘fd’. + + +File: python.info, Node: Console I/O, Next: Other Functions, Prev: File Operations, Up: msvcrt — Useful routines from the MS VC++ runtime + +5.34.1.2 Console I/O +.................... + + -- Function: msvcrt.kbhit () + + Returns a nonzero value if a keypress is waiting to be read. + Otherwise, return 0. + + -- Function: 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. + + -- Function: msvcrt.getwch () + + Wide char variant of *note getch(): 47a2, returning a Unicode + value. + + -- Function: msvcrt.getche () + + Similar to *note getch(): 47a2, but the keypress will be echoed if + it represents a printable character. + + -- Function: msvcrt.getwche () + + Wide char variant of *note getche(): 47a3, returning a Unicode + value. + + -- Function: msvcrt.putch (char) + + Print the byte string 'char' to the console without buffering. + + -- Function: msvcrt.putwch (unicode_char) + + Wide char variant of *note putch(): 47a4, accepting a Unicode + value. + + -- Function: msvcrt.ungetch (char) + + Cause the byte string 'char' to be “pushed back” into the console + buffer; it will be the next character read by *note getch(): 47a2. + or *note getche(): 47a3. + + -- Function: msvcrt.ungetwch (unicode_char) + + Wide char variant of *note ungetch(): 47a5, accepting a Unicode + value. + + +File: python.info, Node: Other Functions, Prev: Console I/O, Up: msvcrt — Useful routines from the MS VC++ runtime + +5.34.1.3 Other Functions +........................ + + -- Function: msvcrt.heapmin () + + Force the ‘malloc()’ heap to clean itself up and return unused + blocks to the operating system. On failure, this raises *note + OSError: 413. + + -- Function: 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: 47ab. + Returns the old setting or -1 if an error occurs. Only available + in *note debug build of Python: 1fb. + + -- Data: msvcrt.OUT_TO_DEFAULT + + Error sink is determined by the app’s type. Only available in + *note debug build of Python: 1fb. + + -- Data: msvcrt.OUT_TO_STDERR + + Error sink is a standard error. Only available in *note debug + build of Python: 1fb. + + -- Data: msvcrt.OUT_TO_MSGBOX + + Error sink is a message box. Only available in *note debug build + of Python: 1fb. + + -- Data: msvcrt.REPORT_ERRMODE + + Report the current error mode value. Only available in *note debug + build of Python: 1fb. + + -- Function: 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: 1fb. + + -- Function: msvcrt.CrtSetReportFile (type, file) + + After you use *note CrtSetReportMode(): 47af. to specify *note + CRTDBG_MODE_FILE: 47b1, 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: 1fb. + + -- Data: msvcrt.CRT_WARN + + Warnings, messages, and information that doesn’t need immediate + attention. + + -- Data: msvcrt.CRT_ERROR + + Errors, unrecoverable problems, and issues that require immediate + attention. + + -- Data: msvcrt.CRT_ASSERT + + Assertion failures. + + -- Data: msvcrt.CRTDBG_MODE_DEBUG + + Writes the message to the debugger’s output window. + + -- Data: msvcrt.CRTDBG_MODE_FILE + + Writes the message to a user-supplied file handle. *note + CrtSetReportFile(): 47b0. should be called to define the specific + file or stream to use as the destination. + + -- Data: msvcrt.CRTDBG_MODE_WNDW + + Creates a message box to display the message along with the + ‘Abort’, ‘Retry’, and ‘Ignore’ buttons. + + -- Data: msvcrt.CRTDBG_REPORT_MODE + + Returns current 'mode' for the specified 'type'. + + -- Data: msvcrt.CRT_ASSEMBLY_VERSION + + The CRT Assembly version, from the ‘crtassem.h’ header file. + + -- Data: msvcrt.VC_ASSEMBLY_PUBLICKEYTOKEN + + The VC Assembly public key token, from the ‘crtassem.h’ header + file. + + -- Data: msvcrt.LIBRARIES_ASSEMBLY_NAME_PREFIX + + The Libraries Assembly name prefix, from the ‘crtassem.h’ header + file. + + +File: python.info, Node: winreg — Windows registry access, Next: winsound — Sound-playing interface for Windows, Prev: msvcrt — Useful routines from the MS VC++ runtime, Up: MS Windows Specific Services + +5.34.2 ‘winreg’ — Windows registry access +----------------------------------------- + +__________________________________________________________________ + +These functions expose the Windows registry API to Python. Instead of +using an integer as the registry handle, a *note handle object: 47ba. is +used to ensure that the handles are closed correctly, even if the +programmer neglects to explicitly close them. + +Changed in version 3.3: Several functions in this module used to raise a +*note WindowsError: 104d, which is now an alias of *note OSError: 413. + +* Menu: + +* Functions: Functions<13>. +* Constants: Constants<10>. +* Registry Handle Objects:: + + +File: python.info, Node: Functions<13>, Next: Constants<10>, Up: winreg — Windows registry access + +5.34.2.1 Functions +.................. + +This module offers the following functions: + + -- Function: winreg.CloseKey (hkey) + + Closes a previously opened registry key. The 'hkey' argument + specifies a previously opened key. + + Note: If 'hkey' is not closed using this method (or via *note + hkey.Close(): 47bf.), it is closed when the 'hkey' object is + destroyed by Python. + + -- Function: winreg.ConnectRegistry (computer_name, key) + + Establishes a connection to a predefined registry handle on another + computer, and returns a *note handle object: 47ba. + + 'computer_name' is the name of the remote computer, of the form + ‘r"\\computername"’. If ‘None’, the local computer is used. + + 'key' is the predefined handle to connect to. + + The return value is the handle of the opened key. If the function + fails, an *note OSError: 413. exception is raised. + + Raises an *note auditing event: 18ba. ‘winreg.ConnectRegistry’ with + arguments ‘computer_name’, ‘key’. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.CreateKey (key, sub_key) + + Creates or opens the specified key, returning a *note handle + object: 47ba. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that names the key this method opens or + creates. + + If 'key' is one of the predefined keys, 'sub_key' may be ‘None’. + In that case, the handle returned is the same key handle passed in + to the function. + + If the key already exists, this function opens the existing key. + + The return value is the handle of the opened key. If the function + fails, an *note OSError: 413. exception is raised. + + Raises an *note auditing event: 18ba. ‘winreg.CreateKey’ with + arguments ‘key’, ‘sub_key’, ‘access’. + + Raises an *note auditing event: 18ba. ‘winreg.OpenKey/result’ with + argument ‘key’. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.CreateKeyEx (key, sub_key, reserved=0, + access=KEY_WRITE) + + Creates or opens the specified key, returning a *note handle + object: 47ba. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that names the key this method opens or + creates. + + 'reserved' is a reserved integer, and must be zero. The default is + zero. + + 'access' is an integer that specifies an access mask that describes + the desired security access for the key. Default is *note + KEY_WRITE: 47c1. See *note Access Rights: 47c2. for other allowed + values. + + If 'key' is one of the predefined keys, 'sub_key' may be ‘None’. + In that case, the handle returned is the same key handle passed in + to the function. + + If the key already exists, this function opens the existing key. + + The return value is the handle of the opened key. If the function + fails, an *note OSError: 413. exception is raised. + + Raises an *note auditing event: 18ba. ‘winreg.CreateKey’ with + arguments ‘key’, ‘sub_key’, ‘access’. + + Raises an *note auditing event: 18ba. ‘winreg.OpenKey/result’ with + argument ‘key’. + + Added in version 3.2. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.DeleteKey (key, sub_key) + + Deletes the specified key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that must be a subkey of the key identified + by the 'key' parameter. This value must not be ‘None’, and the key + may not have subkeys. + + 'This method can not delete keys with subkeys.' + + If the method succeeds, the entire key, including all of its + values, is removed. If the method fails, an *note OSError: 413. + exception is raised. + + Raises an *note auditing event: 18ba. ‘winreg.DeleteKey’ with + arguments ‘key’, ‘sub_key’, ‘access’. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.DeleteKeyEx (key, sub_key, access=KEY_WOW64_64KEY, + reserved=0) + + Deletes the specified key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that must be a subkey of the key identified + by the 'key' parameter. This value must not be ‘None’, and the key + may not have subkeys. + + 'reserved' is a reserved integer, and must be zero. The default is + zero. + + 'access' is an integer that specifies an access mask that describes + the desired security access for the key. Default is *note + KEY_WOW64_64KEY: 47c3. On 32-bit Windows, the WOW64 constants are + ignored. See *note Access Rights: 47c2. for other allowed values. + + 'This method can not delete keys with subkeys.' + + If the method succeeds, the entire key, including all of its + values, is removed. If the method fails, an *note OSError: 413. + exception is raised. + + On unsupported Windows versions, *note NotImplementedError: 22a. is + raised. + + Raises an *note auditing event: 18ba. ‘winreg.DeleteKey’ with + arguments ‘key’, ‘sub_key’, ‘access’. + + Added in version 3.2. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.DeleteValue (key, value) + + Removes a named value from a registry key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'value' is a string that identifies the value to remove. + + Raises an *note auditing event: 18ba. ‘winreg.DeleteValue’ with + arguments ‘key’, ‘value’. + + -- Function: winreg.EnumKey (key, index) + + Enumerates subkeys of an open registry key, returning a string. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'index' is an integer that identifies the index of the key to + retrieve. + + The function retrieves the name of one subkey each time it is + called. It is typically called repeatedly until an *note OSError: + 413. exception is raised, indicating, no more values are available. + + Raises an *note auditing event: 18ba. ‘winreg.EnumKey’ with + arguments ‘key’, ‘index’. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.EnumValue (key, index) + + Enumerates values of an open registry key, returning a tuple. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'index' is an integer that identifies the index of the value to + retrieve. + + The function retrieves the name of one subkey each time it is + called. It is typically called repeatedly, until an *note OSError: + 413. exception is raised, indicating no more values. + + The result is a tuple of 3 items: + + Index Meaning + + ------------------------------------------------------------- + + ‘0’ A string that identifies the value name + + + ‘1’ An object that holds the value data, and whose + type depends on the underlying registry type + + + ‘2’ An integer that identifies the type of the + value data (see table in docs for + *note SetValueEx(): 178d.) + + + Raises an *note auditing event: 18ba. ‘winreg.EnumValue’ with + arguments ‘key’, ‘index’. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.ExpandEnvironmentStrings (str) + + Expands environment variable placeholders ‘%NAME%’ in strings like + *note REG_EXPAND_SZ: 47c4.: + + >>> ExpandEnvironmentStrings('%windir%') + 'C:\\Windows' + + Raises an *note auditing event: 18ba. + ‘winreg.ExpandEnvironmentStrings’ with argument ‘str’. + + -- Function: winreg.FlushKey (key) + + Writes all the attributes of a key to the registry. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + It is not necessary to call *note FlushKey(): 47c5. to change a + key. Registry changes are flushed to disk by the registry using + its lazy flusher. Registry changes are also flushed to disk at + system shutdown. Unlike *note CloseKey(): 47be, the *note + FlushKey(): 47c5. method returns only when all the data has been + written to the registry. An application should only call *note + FlushKey(): 47c5. if it requires absolute certainty that registry + changes are on disk. + + Note: If you don’t know whether a *note FlushKey(): 47c5. call + is required, it probably isn’t. + + -- Function: winreg.LoadKey (key, sub_key, file_name) + + Creates a subkey under the specified key and stores registration + information from a specified file into that subkey. + + 'key' is a handle returned by *note ConnectRegistry(): 41f2. or one + of the constants *note HKEY_USERS: 47c6. or *note + HKEY_LOCAL_MACHINE: 47c7. + + 'sub_key' is a string that identifies the subkey to load. + + 'file_name' is the name of the file to load registry data from. + This file must have been created with the *note SaveKey(): 41fe. + function. Under the file allocation table (FAT) file system, the + filename may not have an extension. + + A call to *note LoadKey(): 41f8. 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. + + If 'key' is a handle returned by *note ConnectRegistry(): 41f2, + then the path specified in 'file_name' is relative to the remote + computer. + + Raises an *note auditing event: 18ba. ‘winreg.LoadKey’ with + arguments ‘key’, ‘sub_key’, ‘file_name’. + + -- Function: winreg.OpenKey (key, sub_key, reserved=0, access=KEY_READ) + -- Function: winreg.OpenKeyEx (key, sub_key, reserved=0, + access=KEY_READ) + + Opens the specified key, returning a *note handle object: 47ba. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that identifies the sub_key to open. + + 'reserved' is a reserved integer, and must be zero. The default is + zero. + + 'access' is an integer that specifies an access mask that describes + the desired security access for the key. Default is *note + KEY_READ: 47c9. See *note Access Rights: 47c2. for other allowed + values. + + The result is a new handle to the specified key. + + If the function fails, *note OSError: 413. is raised. + + Raises an *note auditing event: 18ba. ‘winreg.OpenKey’ with + arguments ‘key’, ‘sub_key’, ‘access’. + + Raises an *note auditing event: 18ba. ‘winreg.OpenKey/result’ with + argument ‘key’. + + Changed in version 3.2: Allow the use of named arguments. + + Changed in version 3.3: See *note above: 47bb. + + -- Function: winreg.QueryInfoKey (key) + + Returns information about a key, as a tuple. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + The result is a tuple of 3 items: + + Index Meaning + + -------------------------------------------------------------- + + ‘0’ An integer giving the number of sub keys this + key has. + + + ‘1’ An integer giving the number of values this key + has. + + + ‘2’ An integer giving when the key was last + modified (if available) as 100’s of nanoseconds + since Jan 1, 1601. + + + Raises an *note auditing event: 18ba. ‘winreg.QueryInfoKey’ with + argument ‘key’. + + -- Function: winreg.QueryValue (key, sub_key) + + Retrieves the unnamed value for a key, as a string. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that holds the name of the subkey with which + the value is associated. If this parameter is ‘None’ or empty, the + function retrieves the value set by the *note SetValue(): 41ff. + method for the key identified by 'key'. + + Values in the registry have name, type, and data components. This + method retrieves the data for a key’s first value that has a ‘NULL’ + name. But the underlying API call doesn’t return the type, so + always use *note QueryValueEx(): 41fd. if possible. + + Raises an *note auditing event: 18ba. ‘winreg.QueryValue’ with + arguments ‘key’, ‘sub_key’, ‘value_name’. + + -- Function: winreg.QueryValueEx (key, value_name) + + Retrieves the type and data for a specified value name associated + with an open registry key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'value_name' is a string indicating the value to query. + + The result is a tuple of 2 items: + + Index Meaning + + ---------------------------------------------------------- + + ‘0’ The value of the registry item. + + + ‘1’ An integer giving the registry type for + this value (see table in docs for + *note SetValueEx(): 178d.) + + + Raises an *note auditing event: 18ba. ‘winreg.QueryValue’ with + arguments ‘key’, ‘sub_key’, ‘value_name’. + + -- Function: winreg.SaveKey (key, file_name) + + Saves the specified key, and all its subkeys to the specified file. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'file_name' is the name of the file to save registry data to. This + file cannot already exist. If this filename includes an extension, + it cannot be used on file allocation table (FAT) file systems by + the *note LoadKey(): 41f8. method. + + 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. + + This function passes ‘NULL’ for 'security_attributes' to the API. + + Raises an *note auditing event: 18ba. ‘winreg.SaveKey’ with + arguments ‘key’, ‘file_name’. + + -- Function: winreg.SetValue (key, sub_key, type, value) + + Associates a value with a specified key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'sub_key' is a string that names the subkey with which the value is + associated. + + 'type' is an integer that specifies the type of the data. + Currently this must be *note REG_SZ: 47ca, meaning only strings are + supported. Use the *note SetValueEx(): 178d. function for support + for other data types. + + 'value' is a string that specifies the new value. + + If the key specified by the 'sub_key' parameter does not exist, the + SetValue function creates it. + + Value lengths are limited by available memory. Long values (more + than 2048 bytes) should be stored as files with the filenames + stored in the configuration registry. This helps the registry + perform efficiently. + + The key identified by the 'key' parameter must have been opened + with *note KEY_SET_VALUE: 47cb. access. + + Raises an *note auditing event: 18ba. ‘winreg.SetValue’ with + arguments ‘key’, ‘sub_key’, ‘type’, ‘value’. + + -- Function: winreg.SetValueEx (key, value_name, reserved, type, value) + + Stores data in the value field of an open registry key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + 'value_name' is a string that names the subkey with which the value + is associated. + + 'reserved' can be anything – zero is always passed to the API. + + 'type' is an integer that specifies the type of the data. See + *note Value Types: 47cc. for the available types. + + 'value' is a string that specifies the new value. + + This method can also set additional value and type information for + the specified key. The key identified by the key parameter must + have been opened with *note KEY_SET_VALUE: 47cb. access. + + To open the key, use the *note CreateKey(): 41f3. or *note + OpenKey(): 41f9. methods. + + Value lengths are limited by available memory. Long values (more + than 2048 bytes) should be stored as files with the filenames + stored in the configuration registry. This helps the registry + perform efficiently. + + Raises an *note auditing event: 18ba. ‘winreg.SetValue’ with + arguments ‘key’, ‘sub_key’, ‘type’, ‘value’. + + -- Function: winreg.DisableReflectionKey (key) + + Disables registry reflection for 32-bit processes running on a + 64-bit operating system. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + Will generally raise *note NotImplementedError: 22a. if executed on + a 32-bit operating system. + + If the key is not on the reflection list, the function succeeds but + has no effect. Disabling reflection for a key does not affect + reflection of any subkeys. + + Raises an *note auditing event: 18ba. ‘winreg.DisableReflectionKey’ + with argument ‘key’. + + -- Function: winreg.EnableReflectionKey (key) + + Restores registry reflection for the specified disabled key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + Will generally raise *note NotImplementedError: 22a. if executed on + a 32-bit operating system. + + Restoring reflection for a key does not affect reflection of any + subkeys. + + Raises an *note auditing event: 18ba. ‘winreg.EnableReflectionKey’ + with argument ‘key’. + + -- Function: winreg.QueryReflectionKey (key) + + Determines the reflection state for the specified key. + + 'key' is an already open key, or one of the predefined *note HKEY_* + constants: 47c0. + + Returns ‘True’ if reflection is disabled. + + Will generally raise *note NotImplementedError: 22a. if executed on + a 32-bit operating system. + + Raises an *note auditing event: 18ba. ‘winreg.QueryReflectionKey’ + with argument ‘key’. + + ---------- 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: Constants<10>, Next: Registry Handle Objects, Prev: Functions<13>, Up: winreg — Windows registry access + +5.34.2.2 Constants +.................. + +The following constants are defined for use in many *note winreg: 116. +functions. + +* Menu: + +* HKEY_* Constants:: +* Access Rights:: +* Value Types:: + + +File: python.info, Node: HKEY_* Constants, Next: Access Rights, Up: Constants<10> + +5.34.2.3 HKEY_* Constants +......................... + + -- Data: winreg.HKEY_CLASSES_ROOT + + Registry entries subordinate to this key define types (or classes) + of documents and the properties associated with those types. Shell + and COM applications use the information stored under this key. + + -- Data: winreg.HKEY_CURRENT_USER + + Registry entries subordinate to this key define the preferences of + the current user. These preferences include the settings of + environment variables, data about program groups, colors, printers, + network connections, and application preferences. + + -- Data: winreg.HKEY_LOCAL_MACHINE + + Registry entries subordinate to this key define the physical state + of the computer, including data about the bus type, system memory, + and installed hardware and software. + + -- Data: winreg.HKEY_USERS + + Registry entries subordinate to this key define the default user + configuration for new users on the local computer and the user + configuration for the current user. + + -- Data: winreg.HKEY_PERFORMANCE_DATA + + Registry entries subordinate to this key allow you to access + performance data. The data is not actually stored in the registry; + the registry functions cause the system to collect the data from + its source. + + -- Data: winreg.HKEY_CURRENT_CONFIG + + Contains information about the current hardware profile of the + local computer system. + + -- Data: winreg.HKEY_DYN_DATA + + This key is not used in versions of Windows after 98. + + +File: python.info, Node: Access Rights, Next: Value Types, Prev: HKEY_* Constants, Up: Constants<10> + +5.34.2.4 Access Rights +...................... + +For more information, see Registry Key Security and Access(1). + + -- Data: winreg.KEY_ALL_ACCESS + + Combines the STANDARD_RIGHTS_REQUIRED, *note KEY_QUERY_VALUE: 47d7, + *note KEY_SET_VALUE: 47cb, *note KEY_CREATE_SUB_KEY: 47d8, *note + KEY_ENUMERATE_SUB_KEYS: 47d9, *note KEY_NOTIFY: 47da, and *note + KEY_CREATE_LINK: 47db. access rights. + + -- Data: winreg.KEY_WRITE + + Combines the STANDARD_RIGHTS_WRITE, *note KEY_SET_VALUE: 47cb, and + *note KEY_CREATE_SUB_KEY: 47d8. access rights. + + -- Data: winreg.KEY_READ + + Combines the STANDARD_RIGHTS_READ, *note KEY_QUERY_VALUE: 47d7, + *note KEY_ENUMERATE_SUB_KEYS: 47d9, and *note KEY_NOTIFY: 47da. + values. + + -- Data: winreg.KEY_EXECUTE + + Equivalent to *note KEY_READ: 47c9. + + -- Data: winreg.KEY_QUERY_VALUE + + Required to query the values of a registry key. + + -- Data: winreg.KEY_SET_VALUE + + Required to create, delete, or set a registry value. + + -- Data: winreg.KEY_CREATE_SUB_KEY + + Required to create a subkey of a registry key. + + -- Data: winreg.KEY_ENUMERATE_SUB_KEYS + + Required to enumerate the subkeys of a registry key. + + -- Data: winreg.KEY_NOTIFY + + Required to request change notifications for a registry key or for + subkeys of a registry key. + + -- Data: winreg.KEY_CREATE_LINK + + Reserved for system use. + +* Menu: + +* 64-bit Specific:: + + ---------- Footnotes ---------- + + (1) +https://msdn.microsoft.com/en-us/library/ms724878%28v=VS.85%29.aspx + + +File: python.info, Node: 64-bit Specific, Up: Access Rights + +5.34.2.5 64-bit Specific +........................ + +For more information, see Accessing an Alternate Registry View(1). + + -- Data: winreg.KEY_WOW64_64KEY + + Indicates that an application on 64-bit Windows should operate on + the 64-bit registry view. On 32-bit Windows, this constant is + ignored. + + -- Data: winreg.KEY_WOW64_32KEY + + Indicates that an application on 64-bit Windows should operate on + the 32-bit registry view. On 32-bit Windows, this constant is + ignored. + + ---------- Footnotes ---------- + + (1) https://msdn.microsoft.com/en-us/library/aa384129(v=VS.85).aspx + + +File: python.info, Node: Value Types, Prev: Access Rights, Up: Constants<10> + +5.34.2.6 Value Types +.................... + +For more information, see Registry Value Types(1). + + -- Data: winreg.REG_BINARY + + Binary data in any form. + + -- Data: winreg.REG_DWORD + + 32-bit number. + + -- Data: winreg.REG_DWORD_LITTLE_ENDIAN + + A 32-bit number in little-endian format. Equivalent to *note + REG_DWORD: 47e2. + + -- Data: winreg.REG_DWORD_BIG_ENDIAN + + A 32-bit number in big-endian format. + + -- Data: winreg.REG_EXPAND_SZ + + Null-terminated string containing references to environment + variables (‘%PATH%’). + + -- Data: winreg.REG_LINK + + A Unicode symbolic link. + + -- Data: winreg.REG_MULTI_SZ + + A sequence of null-terminated strings, terminated by two null + characters. (Python handles this termination automatically.) + + -- Data: winreg.REG_NONE + + No defined value type. + + -- Data: winreg.REG_QWORD + + A 64-bit number. + + Added in version 3.6. + + -- Data: winreg.REG_QWORD_LITTLE_ENDIAN + + A 64-bit number in little-endian format. Equivalent to *note + REG_QWORD: d02. + + Added in version 3.6. + + -- Data: winreg.REG_RESOURCE_LIST + + A device-driver resource list. + + -- Data: winreg.REG_FULL_RESOURCE_DESCRIPTOR + + A hardware setting. + + -- Data: winreg.REG_RESOURCE_REQUIREMENTS_LIST + + A hardware resource list. + + -- Data: winreg.REG_SZ + + A null-terminated string. + + ---------- Footnotes ---------- + + (1) +https://msdn.microsoft.com/en-us/library/ms724884%28v=VS.85%29.aspx + + +File: python.info, Node: Registry Handle Objects, Prev: Constants<10>, Up: winreg — Windows registry access + +5.34.2.7 Registry Handle Objects +................................ + +This object wraps a Windows HKEY object, automatically closing it when +the object is destroyed. To guarantee cleanup, you can call either the +*note Close(): 47bf. method on the object, or the *note CloseKey(): +47be. function. + +All registry functions in this module return one of these objects. + +All registry functions in this module which accept a handle object also +accept an integer, however, use of the handle object is encouraged. + +Handle objects provide semantics for *note __bool__(): 12c8. – thus + + if handle: + print("Yes") + +will print ‘Yes’ if the handle is currently valid (has not been closed +or detached). + +The object also support comparison semantics, so handle objects will +compare true if they both reference the same underlying Windows handle +value. + +Handle objects can be converted to an integer (e.g., using the built-in +*note int(): 259. function), in which case the underlying Windows handle +value is returned. You can also use the *note Detach(): 41fa. method to +return the integer handle, and also disconnect the Windows handle from +the handle object. + + -- Method: PyHKEY.Close () + + Closes the underlying Windows handle. + + If the handle is already closed, no error is raised. + + -- Method: PyHKEY.Detach () + + Detaches the Windows handle from the handle object. + + The result is an integer that holds the value of the handle before + it is detached. If the handle is already detached or closed, this + will return zero. + + After calling this function, the handle is effectively invalidated, + but the handle is not closed. You would call this function when + you need the underlying Win32 handle to exist beyond the lifetime + of the handle object. + + Raises an *note auditing event: 18ba. ‘winreg.PyHKEY.Detach’ with + argument ‘key’. + + -- Method: PyHKEY.__enter__ () + -- Method: PyHKEY.__exit__ (*exc_info) + + The HKEY object implements *note __enter__(): 5c4. and *note + __exit__(): 12f3. and thus supports the context protocol for the + *note with: 5ce. statement: + + with OpenKey(HKEY_LOCAL_MACHINE, "foo") as key: + ... # work with key + + will automatically close 'key' when control leaves the *note with: + 5ce. block. + + +File: python.info, Node: winsound — Sound-playing interface for Windows, Prev: winreg — Windows registry access, Up: MS Windows Specific Services + +5.34.3 ‘winsound’ — Sound-playing interface for Windows +------------------------------------------------------- + +__________________________________________________________________ + +The *note winsound: 117. module provides access to the basic +sound-playing machinery provided by Windows platforms. It includes +functions and several constants. + + -- Function: winsound.Beep (frequency, duration) + + Beep the PC’s speaker. The 'frequency' parameter specifies + frequency, in hertz, of the sound, and must be in the range 37 + through 32,767. The 'duration' parameter specifies the number of + milliseconds the sound should last. If the system is not able to + beep the speaker, *note RuntimeError: 195. is raised. + + -- Function: winsound.PlaySound (sound, flags) + + Call the underlying ‘PlaySound()’ function from the Platform API. + The 'sound' parameter may be a filename, a system sound alias, + audio data as a *note bytes-like object: d2d, or ‘None’. Its + interpretation depends on the value of 'flags', which can be a + bitwise ORed combination of the constants described below. If the + 'sound' parameter is ‘None’, any currently playing waveform sound + is stopped. If the system indicates an error, *note RuntimeError: + 195. is raised. + + -- Function: winsound.MessageBeep (type=MB_OK) + + Call the underlying ‘MessageBeep()’ function from the Platform API. + This plays a sound as specified in the registry. The 'type' + argument specifies which sound to play; possible values are ‘-1’, + ‘MB_ICONASTERISK’, ‘MB_ICONEXCLAMATION’, ‘MB_ICONHAND’, + ‘MB_ICONQUESTION’, and ‘MB_OK’, all described below. The value + ‘-1’ produces a “simple beep”; this is the final fallback if a + sound cannot be played otherwise. If the system indicates an + error, *note RuntimeError: 195. is raised. + + -- Data: winsound.SND_FILENAME + + The 'sound' parameter is the name of a WAV file. Do not use with + *note SND_ALIAS: 47f1. + + -- Data: winsound.SND_ALIAS + + The 'sound' parameter is a sound association name from the + registry. If the registry contains no such name, play the system + default sound unless *note SND_NODEFAULT: 47f2. is also specified. + If no default sound is registered, raise *note RuntimeError: 195. + Do not use with *note SND_FILENAME: 47f0. + + All Win32 systems support at least the following; most systems + support many more: + + *note PlaySound(): d06. Corresponding Control Panel Sound name + 'name' + + ---------------------------------------------------------------------------- + + ‘'SystemAsterisk'’ Asterisk + + + ‘'SystemExclamation'’ Exclamation + + + ‘'SystemExit'’ Exit Windows + + + ‘'SystemHand'’ Critical Stop + + + ‘'SystemQuestion'’ Question + + + For example: + + 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) + + -- Data: winsound.SND_LOOP + + Play the sound repeatedly. The *note SND_ASYNC: 47f4. flag must + also be used to avoid blocking. Cannot be used with *note + SND_MEMORY: 47f5. + + -- Data: winsound.SND_MEMORY + + The 'sound' parameter to *note PlaySound(): d06. is a memory image + of a WAV file, as a *note bytes-like object: d2d. + + Note: This module does not support playing from a memory image + asynchronously, so a combination of this flag and *note + SND_ASYNC: 47f4. will raise *note RuntimeError: 195. + + -- Data: winsound.SND_PURGE + + Stop playing all instances of the specified sound. + + Note: This flag is not supported on modern Windows platforms. + + -- Data: winsound.SND_ASYNC + + Return immediately, allowing sounds to play asynchronously. + + -- Data: winsound.SND_NODEFAULT + + If the specified sound cannot be found, do not play the system + default sound. + + -- Data: winsound.SND_NOSTOP + + Do not interrupt sounds currently playing. + + -- Data: winsound.SND_NOWAIT + + Return immediately if the sound driver is busy. + + Note: This flag is not supported on modern Windows platforms. + + -- Data: winsound.SND_APPLICATION + + The 'sound' parameter is an application-specific alias in the + registry. This flag can be combined with the *note SND_ALIAS: + 47f1. flag to specify an application-defined sound alias. + + -- Data: winsound.MB_ICONASTERISK + + Play the ‘SystemDefault’ sound. + + -- Data: winsound.MB_ICONEXCLAMATION + + Play the ‘SystemExclamation’ sound. + + -- Data: winsound.MB_ICONHAND + + Play the ‘SystemHand’ sound. + + -- Data: winsound.MB_ICONQUESTION + + Play the ‘SystemQuestion’ sound. + + -- Data: winsound.MB_OK + + Play the ‘SystemDefault’ sound. + + +File: python.info, Node: Unix Specific Services, Next: Modules command-line interface CLI, Prev: MS Windows Specific Services, Up: The Python Standard Library + +5.35 Unix Specific Services +=========================== + +The modules described in this chapter provide interfaces to features +that are unique to the Unix operating system, or in some cases to some +or many variants of it. Here’s an overview: + +* Menu: + +* posix — The most common POSIX system calls:: +* pwd — The password database:: +* grp — The group database:: +* termios — POSIX style tty control:: +* tty — Terminal control functions:: +* pty — Pseudo-terminal utilities:: +* fcntl — The fcntl and ioctl system calls:: +* resource — Resource usage information:: +* syslog — Unix syslog library routines:: + + +File: python.info, Node: posix — The most common POSIX system calls, Next: pwd — The password database, Up: Unix Specific Services + +5.35.1 ‘posix’ — The most common POSIX system calls +--------------------------------------------------- + +__________________________________________________________________ + +This module provides access to operating system functionality that is +standardized by the C Standard and the POSIX standard (a thinly +disguised Unix interface). + +*note Availability: 1d54.: Unix. + +'Do not import this module directly.' Instead, import the module *note +os: a1, which provides a 'portable' version of this interface. On Unix, +the *note os: a1. module provides a superset of the *note posix: ad. +interface. On non-Unix operating systems the *note posix: ad. module is +not available, but a subset is always available through the *note os: +a1. interface. Once *note os: a1. is imported, there is 'no' +performance penalty in using it instead of *note posix: ad. In +addition, *note os: a1. provides some additional functionality, such as +automatically calling *note putenv(): 91b. when an entry in ‘os.environ’ +is changed. + +Errors are reported as exceptions; the usual exceptions are given for +type errors, while errors reported by the system calls raise *note +OSError: 413. + +* Menu: + +* Large File Support:: +* Notable Module Contents:: + + +File: python.info, Node: Large File Support, Next: Notable Module Contents, Up: posix — The most common POSIX system calls + +5.35.1.1 Large File Support +........................... + +Several operating systems (including AIX and Solaris) provide support +for files that are larger than 2 GiB from a C programming model where +int and long are 32-bit values. This is typically accomplished by +defining the relevant size and offset types as 64-bit values. Such +files are sometimes referred to as 'large files'. + +Large file support is enabled in Python when the size of an ‘off_t’ is +larger than a long and the long long is at least as large as an ‘off_t’. +It may be necessary to configure and compile Python with certain +compiler flags to enable this mode. For example, with Solaris 2.6 and +2.7 you need to do something like: + + CFLAGS="`getconf LFS_CFLAGS`" OPT="-g -O2 $CFLAGS" \ + ./configure + +On large-file-capable Linux systems, this might work: + + CFLAGS='-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64' OPT="-g -O2 $CFLAGS" \ + ./configure + + +File: python.info, Node: Notable Module Contents, Prev: Large File Support, Up: posix — The most common POSIX system calls + +5.35.1.2 Notable Module Contents +................................ + +In addition to many functions described in the *note os: a1. module +documentation, *note posix: ad. defines the following data item: + + -- Data: posix.environ + + A dictionary representing the string environment at the time the + interpreter was started. Keys and values are bytes on Unix and str + on Windows. For example, ‘environ[b'HOME']’ (‘environ['HOME']’ on + Windows) is the pathname of your home directory, equivalent to + ‘getenv("HOME")’ in C. + + Modifying this dictionary does not affect the string environment + passed on by *note execv(): 2b24, *note popen(): a87. or *note + system(): 1426.; if you need to change the environment, pass + ‘environ’ to *note execve(): 10ed. or add variable assignments and + export statements to the command string for *note system(): 1426. + or *note popen(): a87. + + Changed in version 3.2: On Unix, keys and values are bytes. + + Note: The *note os: a1. module provides an alternate + implementation of ‘environ’ which updates the environment on + modification. Note also that updating *note os.environ: 11ac. + will render this dictionary obsolete. Use of the *note os: + a1. module version of this is recommended over direct access + to the *note posix: ad. module. + + +File: python.info, Node: pwd — The password database, Next: grp — The group database, Prev: posix — The most common POSIX system calls, Up: Unix Specific Services + +5.35.2 ‘pwd’ — The password database +------------------------------------ + +__________________________________________________________________ + +This module provides access to the Unix user account and password +database. It is available on all Unix versions. + +*note Availability: 1d54.: Unix, not WASI, not iOS. + +Password database entries are reported as a tuple-like object, whose +attributes correspond to the members of the ‘passwd’ structure +(Attribute field below, see ‘<pwd.h>’): + +Index Attribute Meaning + +------------------------------------------------------------------ + +0 ‘pw_name’ Login name + + +1 ‘pw_passwd’ Optional encrypted password + + +2 ‘pw_uid’ Numerical user ID + + +3 ‘pw_gid’ Numerical group ID + + +4 ‘pw_gecos’ User name or comment field + + +5 ‘pw_dir’ User home directory + + +6 ‘pw_shell’ User command interpreter + + +The uid and gid items are integers, all others are strings. *note +KeyError: 33f. is raised if the entry asked for cannot be found. + + Note: In traditional Unix the field ‘pw_passwd’ usually contains a + password encrypted with a DES derived algorithm. However most + modern unices use a so-called 'shadow password' system. On those + unices the 'pw_passwd' field only contains an asterisk (‘'*'’) or + the letter ‘'x'’ where the encrypted password is stored in a file + ‘/etc/shadow’ which is not world readable. Whether the 'pw_passwd' + field contains anything useful is system-dependent. + +It defines the following items: + + -- Function: pwd.getpwuid (uid) + + Return the password database entry for the given numeric user ID. + + -- Function: pwd.getpwnam (name) + + Return the password database entry for the given user name. + + -- Function: pwd.getpwall () + + Return a list of all available password database entries, in + arbitrary order. + +See also +........ + +Module *note grp: 66. + + An interface to the group database, similar to this. + + +File: python.info, Node: grp — The group database, Next: termios — POSIX style tty control, Prev: pwd — The password database, Up: Unix Specific Services + +5.35.3 ‘grp’ — The group database +--------------------------------- + +__________________________________________________________________ + +This module provides access to the Unix group database. It is available +on all Unix versions. + +*note Availability: 1d54.: Unix, not WASI, not Android, not iOS. + +Group database entries are reported as a tuple-like object, whose +attributes correspond to the members of the ‘group’ structure (Attribute +field below, see ‘<grp.h>’): + +Index Attribute Meaning + +------------------------------------------------------------------ + +0 gr_name the name of the group + + +1 gr_passwd the (encrypted) group password; + often empty + + +2 gr_gid the numerical group ID + + +3 gr_mem all the group member’s user names + + +The gid is an integer, name and password are strings, and the member +list is a list of strings. (Note that most users are not explicitly +listed as members of the group they are in according to the password +database. Check both databases to get complete membership information. +Also note that a ‘gr_name’ that starts with a ‘+’ or ‘-’ is likely to be +a YP/NIS reference and may not be accessible via *note getgrnam(): 3206. +or *note getgrgid(): d26.) + +It defines the following items: + + -- Function: grp.getgrgid (id) + + Return the group database entry for the given numeric group ID. + *note KeyError: 33f. is raised if the entry asked for cannot be + found. + + Changed in version 3.10: *note TypeError: 534. is raised for + non-integer arguments like floats or strings. + + -- Function: grp.getgrnam (name) + + Return the group database entry for the given group name. *note + KeyError: 33f. is raised if the entry asked for cannot be found. + + -- Function: grp.getgrall () + + Return a list of all available group entries, in arbitrary order. + +See also +........ + +Module *note pwd: b2. + + An interface to the user database, similar to this. + + +File: python.info, Node: termios — POSIX style tty control, Next: tty — Terminal control functions, Prev: grp — The group database, Up: Unix Specific Services + +5.35.4 ‘termios’ — POSIX style tty control +------------------------------------------ + +__________________________________________________________________ + +This module provides an interface to the POSIX calls for tty I/O +control. For a complete description of these calls, see ‘termios(3)(1)’ +Unix manual page. It is only available for those Unix versions that +support POSIX 'termios' style tty I/O control configured during +installation. + +*note Availability: 1d54.: Unix. + +All functions in this module take a file descriptor 'fd' as their first +argument. This can be an integer file descriptor, such as returned by +‘sys.stdin.fileno()’, or a *note file object: 11b5, such as ‘sys.stdin’ +itself. + +This module also defines all the constants needed to work with the +functions provided here; these have the same name as their counterparts +in C. Please refer to your system documentation for more information on +using these terminal control interfaces. + +The module defines the following functions: + + -- Function: 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 *note termios: e1. module. + + -- Function: 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(): 1676. The 'when' argument determines when the + attributes are changed: + + -- Data: termios.TCSANOW + + Change attributes immediately. + + -- Data: termios.TCSADRAIN + + Change attributes after transmitting all queued output. + + -- Data: termios.TCSAFLUSH + + Change attributes after transmitting all queued output and + discarding all queued input. + + -- Function: termios.tcsendbreak (fd, duration) + + Send a break on file descriptor 'fd'. A zero 'duration' sends a + break for 0.25–0.5 seconds; a nonzero 'duration' has a system + dependent meaning. + + -- Function: termios.tcdrain (fd) + + Wait until all output written to file descriptor 'fd' has been + transmitted. + + -- Function: termios.tcflush (fd, queue) + + Discard queued data on file descriptor 'fd'. The 'queue' selector + specifies which queue: ‘TCIFLUSH’ for the input queue, ‘TCOFLUSH’ + for the output queue, or ‘TCIOFLUSH’ for both queues. + + -- Function: termios.tcflow (fd, action) + + Suspend or resume input or output on file descriptor 'fd'. The + 'action' argument can be ‘TCOOFF’ to suspend output, ‘TCOON’ to + restart output, ‘TCIOFF’ to suspend input, or ‘TCION’ to restart + input. + + -- Function: 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. + + -- Function: 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(): 4817. Requires at least one of the pairs + (‘termios.TIOCGWINSZ’, ‘termios.TIOCSWINSZ’); (‘termios.TIOCGSIZE’, + ‘termios.TIOCSSIZE’) to be defined. + + Added in version 3.11. + +See also +........ + +Module *note tty: 100. + + Convenience functions for common terminal control operations. + +* Menu: + +* Example: Example<15>. + + ---------- Footnotes ---------- + + (1) https://manpages.debian.org/termios(3) + + +File: python.info, Node: Example<15>, Up: termios — POSIX style tty control + +5.35.4.1 Example +................ + +Here’s a function that prompts for a password with echoing turned off. +Note the technique using a separate *note tcgetattr(): 1676. call and a +*note try: 6e4. … *note finally: 9ca. statement to ensure that the old +tty attributes are restored exactly no matter what happens: + + 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 — Terminal control functions, Next: pty — Pseudo-terminal utilities, Prev: termios — POSIX style tty control, Up: Unix Specific Services + +5.35.5 ‘tty’ — Terminal control functions +----------------------------------------- + +'Source code:' Lib/tty.py(1) + +__________________________________________________________________ + +The *note tty: 100. module defines functions for putting the tty into +cbreak and raw modes. + +*note Availability: 1d54.: Unix. + +Because it requires the *note termios: e1. module, it will work only on +Unix. + +The *note tty: 100. module defines the following functions: + + -- Function: tty.cfmakeraw (mode) + + Convert the tty attribute list 'mode', which is a list like the one + returned by *note termios.tcgetattr(): 1676, to that of a tty in + raw mode. + + Added in version 3.12. + + -- Function: tty.cfmakecbreak (mode) + + Convert the tty attribute list 'mode', which is a list like the one + returned by *note termios.tcgetattr(): 1676, 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. + + Changed in version 3.12.2: The ‘ICRNL’ flag is no longer cleared. + This matches Linux and macOS ‘stty cbreak’ behavior and what *note + setcbreak(): 1678. historically did. + + -- Function: 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: 4812, and is + passed to *note termios.tcsetattr(): 16f8. The return value of + *note termios.tcgetattr(): 1676. is saved before setting 'fd' to + raw mode; this value is returned. + + Changed in version 3.12: The return value is now the original tty + attributes, instead of ‘None’. + + -- Function: 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: 4812, and is + passed to *note termios.tcsetattr(): 16f8. The return value of + *note termios.tcgetattr(): 1676. 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. + + Changed in version 3.12: The return value is now the original tty + attributes, instead of ‘None’. + + Changed in version 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. + +See also +........ + +Module *note termios: e1. + + Low-level terminal control interface. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/tty.py + + +File: python.info, Node: pty — Pseudo-terminal utilities, Next: fcntl — The fcntl and ioctl system calls, Prev: tty — Terminal control functions, Up: Unix Specific Services + +5.35.6 ‘pty’ — Pseudo-terminal utilities +---------------------------------------- + +'Source code:' Lib/pty.py(1) + +__________________________________________________________________ + +The *note pty: b1. 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: 1d54.: 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 *note pty: b1. module defines the following functions: + + -- Function: pty.fork () + + Fork. Connect the child’s controlling terminal to a + pseudo-terminal. Return value is ‘(pid, fd)’. Note that the child + gets 'pid' 0, and the 'fd' is 'invalid'. The parent’s return value + is the 'pid' of the child, and 'fd' is a file descriptor connected + to the child’s controlling terminal (and also to the child’s + standard input and output). + + Warning: On macOS the use of this function is unsafe when + mixed with using higher-level system APIs, and that includes + using *note urllib.request: 10b. + + -- Function: pty.openpty () + + Open a new pseudo-terminal pair, using *note os.openpty(): 2b66. if + possible, or emulation code for generic Unix systems. Return a + pair of file descriptors ‘(master, slave)’, for the master and the + slave end, respectively. + + -- Function: 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(): d99. on the + child process. + + *note os.waitstatus_to_exitcode(): 91c. can be used to convert the + exit status into an exit code. + + Raises an *note auditing event: 18ba. ‘pty.spawn’ with argument + ‘argv’. + + Changed in version 3.4: *note spawn(): f7d. now returns the status + value from *note os.waitpid(): d99. on the child process. + +* Menu: + +* Example: Example<16>. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/pty.py + + +File: python.info, Node: Example<16>, Up: pty — Pseudo-terminal utilities + +5.35.6.1 Example +................ + +The following program acts like the Unix command ‘script(1)(1)’, using a +pseudo-terminal to record all input and output of a terminal session in +a “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 — The fcntl and ioctl system calls, Next: resource — Resource usage information, Prev: pty — Pseudo-terminal utilities, Up: Unix Specific Services + +5.35.7 ‘fcntl’ — The ‘fcntl’ and ‘ioctl’ system calls +----------------------------------------------------- + +__________________________________________________________________ + +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: 1d54.: Unix, not WASI. + +All functions in this module take a file descriptor 'fd' as their first +argument. This can be an integer file descriptor, such as returned by +‘sys.stdin.fileno()’, or an *note io.IOBase: 1f7. object, such as +‘sys.stdin’ itself, which provides a *note fileno(): 2856. that returns +a genuine file descriptor. + +Changed in version 3.3: Operations in this module used to raise an *note +IOError: 104b. where they now raise an *note OSError: 413. + +Changed in version 3.8: The ‘fcntl’ module now contains ‘F_ADD_SEALS’, +‘F_GET_SEALS’, and ‘F_SEAL_*’ constants for sealing of *note +os.memfd_create(): a0a. file descriptors. + +Changed in version 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. + +Changed in version 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. + +Changed in version 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. + +Changed in version 3.12: On Linux >= 4.5, the *note fcntl: 59. 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”. + +Changed in version 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. + +The module defines the following functions: + + -- Function: fcntl.fcntl (fd, cmd, arg=0, /) + + Perform the operation 'cmd' on file descriptor 'fd' (file objects + providing a *note fileno(): 2856. method are accepted as well). + The values used for 'cmd' are operating system dependent, and are + available as constants in the *note fcntl: 59. 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: 1c2. object, + 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, it represents a binary structure, for + example, created by *note struct.pack(): 126a. 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: 1c2. object. The length of the + returned object will be the same as the length of the 'arg' + argument. This is limited to 1024 bytes. + + If the ‘fcntl()’ call fails, an *note OSError: 413. is raised. + + Note: If the type or the size of 'arg' does not match the type + or size of the argument of the operation (for example, if an + integer is passed when a pointer is expected, or the + information returned in the buffer by the operating system is + larger than 1024 bytes), this is most likely to result in a + segmentation violation or a more subtle data corruption. + + Raises an *note auditing event: 18ba. ‘fcntl.fcntl’ with arguments + ‘fd’, ‘cmd’, ‘arg’. + + -- Function: fcntl.ioctl (fd, request, arg=0, mutate_flag=True, /) + + This function is identical to the *note fcntl(): 344b. function, + except that the argument handling is even more complicated. + + 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: e1. 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: + d2d, 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(): 344b. + function. + + If 'arg' supports the read-write buffer interface (like *note + bytearray: 53a.) and 'mutate_flag' is true (the default), then the + buffer is (in effect) passed to the underlying ‘ioctl()’ system + call, the latter’s return code is passed back to the calling + Python, and the buffer’s new contents reflect the action of the + ‘ioctl()’. This is a slight simplification, because if the + supplied buffer is less than 1024 bytes long it is first copied + into a static buffer 1024 bytes long which is then passed to *note + ioctl(): 1443. and copied back into the supplied buffer. + + If the ‘ioctl()’ call fails, an *note OSError: 413. exception is + raised. + + Note: If the type or size of 'arg' does not match the type or + size of the operation’s argument (for example, if an integer + is passed when a pointer is expected, or the information + returned in the buffer by the operating system is larger than + 1024 bytes, or the size of the mutable bytes-like object is + too small), this is most likely to result in a segmentation + violation or a more subtle data corruption. + + An example: + + >>> 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]) + + Raises an *note auditing event: 18ba. ‘fcntl.ioctl’ with arguments + ‘fd’, ‘request’, ‘arg’. + + -- Function: fcntl.flock (fd, operation, /) + + Perform the lock operation 'operation' on file descriptor 'fd' + (file objects providing a *note fileno(): 2856. method are accepted + as well). See the Unix manual ‘flock(2)(3)’ for details. (On some + systems, this function is emulated using ‘fcntl()’.) + + If the ‘flock()’ call fails, an *note OSError: 413. exception is + raised. + + Raises an *note auditing event: 18ba. ‘fcntl.flock’ with arguments + ‘fd’, ‘operation’. + + -- Function: fcntl.lockf (fd, cmd, len=0, start=0, whence=0, /) + + This is essentially a wrapper around the *note fcntl(): 344b. + locking calls. 'fd' is the file descriptor (file objects providing + a *note fileno(): 2856. method are accepted as well) of the file to + lock or unlock, and 'cmd' is one of the following values: + + -- Data: fcntl.LOCK_UN + + Release an existing lock. + + -- Data: fcntl.LOCK_SH + + Acquire a shared lock. + + -- Data: fcntl.LOCK_EX + + Acquire an exclusive lock. + + -- Data: 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: 413. will be raised and the exception will have an 'errno' + attribute set to *note EACCES: 22ad. or *note EAGAIN: 229e. + (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' is the number of bytes to lock, 'start' is the byte offset at + which the lock starts, relative to 'whence', and 'whence' is as + with *note io.IOBase.seek(): 127f, specifically: + + * ‘0’ – relative to the start of the file (*note os.SEEK_SET: + 1280.) + + * ‘1’ – relative to the current buffer position (*note + os.SEEK_CUR: 1281.) + + * ‘2’ – relative to the end of the file (*note os.SEEK_END: + 1282.) + + The default for 'start' is 0, which means to start at the beginning + of the file. The default for 'len' is 0 which means to lock to the + end of the file. The default for 'whence' is also 0. + + Raises an *note auditing event: 18ba. ‘fcntl.lockf’ with arguments + ‘fd’, ‘cmd’, ‘len’, ‘start’, ‘whence’. + +Examples (all on a SVR4 compliant system): + + 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) + +Note that in the first example the return value variable 'rv' will hold +an integer value; in the second example it will hold a *note bytes: 1c2. +object. The structure lay-out for the 'lockdata' variable is system +dependent — therefore using the *note flock(): 41eb. call may be better. + +See also +........ + +Module *note os: a1. + + If the locking flags *note O_SHLOCK: 13fa. and *note O_EXLOCK: + 13fb. are present in the *note os: a1. module (on BSD only), the + *note os.open(): d91. function provides an alternative to the *note + lockf(): 13b8. and *note flock(): 41eb. 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 — Resource usage information, Next: syslog — Unix syslog library routines, Prev: fcntl — The fcntl and ioctl system calls, Up: Unix Specific Services + +5.35.8 ‘resource’ — Resource usage information +---------------------------------------------- + +__________________________________________________________________ + +This module provides basic mechanisms for measuring and controlling +system resources utilized by a program. + +*note Availability: 1d54.: Unix, not WASI. + +Symbolic constants are used to specify particular system resources and +to request usage information about either the current process or its +children. + +An *note OSError: 413. is raised on syscall failure. + + -- Exception: resource.error + + A deprecated alias of *note OSError: 413. + + Changed in version 3.3: Following PEP 3151(1), this class was made + an alias of *note OSError: 413. + +* Menu: + +* Resource Limits:: +* Resource Usage:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3151/ + + +File: python.info, Node: Resource Limits, Next: Resource Usage, Up: resource — Resource usage information + +5.35.8.1 Resource Limits +........................ + +Resources usage can be limited using the *note setrlimit(): 151d. +function described below. Each resource is controlled by a pair of +limits: a soft limit and a hard limit. The soft limit is the current +limit, and may be lowered or raised by a process over time. The soft +limit can never exceed the hard limit. The hard limit can be lowered to +any value greater than the soft limit, but not raised. (Only processes +with the effective UID of the super-user can raise a hard limit.) + +The specific resources that can be limited are system dependent. They +are described in the ‘getrlimit(2)(1)’ man page. The resources listed +below are supported when the underlying operating system supports them; +resources which cannot be checked or controlled by the operating system +are not defined in this module for those platforms. + + -- Data: resource.RLIM_INFINITY + + Constant used to represent the limit for an unlimited resource. + + -- Function: resource.getrlimit (resource) + + Returns a tuple ‘(soft, hard)’ with the current soft and hard + limits of 'resource'. Raises *note ValueError: 204. if an invalid + resource is specified, or *note error: 4828. if the underlying + system call fails unexpectedly. + + -- Function: 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: 151c. can be used + to request a limit that is unlimited. + + Raises *note ValueError: 204. 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: 151c. when the hard or system limit for that + resource is not unlimited will result in a *note ValueError: 204. + A process with the effective UID of super-user can request any + valid limit value, including unlimited, but *note ValueError: 204. + will still be raised if the requested limit exceeds the system + imposed limit. + + ‘setrlimit’ may also raise *note error: 4828. if the underlying + system call fails. + + VxWorks only supports setting *note RLIMIT_NOFILE: 482a. + + Raises an *note auditing event: 18ba. ‘resource.setrlimit’ with + arguments ‘resource’, ‘limits’. + + -- Function: resource.prlimit (pid, resource[, limits]) + + Combines *note setrlimit(): 151d. and *note getrlimit(): 151b. in + one function and supports to get and set the resources limits of an + arbitrary process. If 'pid' is 0, then the call applies to the + current process. 'resource' and 'limits' have the same meaning as + in *note setrlimit(): 151d, except that 'limits' is optional. + + When 'limits' is not given the function returns the 'resource' + limit of the process 'pid'. When 'limits' is given the 'resource' + limit of the process is set and the former resource limit is + returned. + + Raises *note ProcessLookupError: 1054. when 'pid' can’t be found + and *note PermissionError: d42. when the user doesn’t have + ‘CAP_SYS_RESOURCE’ for the process. + + Raises an *note auditing event: 18ba. ‘resource.prlimit’ with + arguments ‘pid’, ‘resource’, ‘limits’. + + *note Availability: 1d54.: Linux >= 2.6.36 with glibc >= 2.13. + + Added in version 3.4. + +These symbols define resources whose consumption can be controlled using +the *note setrlimit(): 151d. and *note getrlimit(): 151b. functions +described below. The values of these symbols are exactly the constants +used by C programs. + +The Unix man page for ‘getrlimit(2)(2)’ lists the available resources. +Note that not all systems use the same symbol or same value to denote +the same resource. This module does not attempt to mask platform +differences — symbols not defined for a platform will not be available +from this module on that platform. + + -- Data: resource.RLIMIT_CORE + + The maximum size (in bytes) of a core file that the current process + can create. This may result in the creation of a partial core file + if a larger core would be required to contain the entire process + image. + + -- Data: resource.RLIMIT_CPU + + The maximum amount of processor time (in seconds) that a process + can use. If this limit is exceeded, a ‘SIGXCPU’ signal is sent to + the process. (See the *note signal: c6. module documentation for + information about how to catch this signal and do something useful, + e.g. flush open files to disk.) + + -- Data: resource.RLIMIT_FSIZE + + The maximum size of a file which the process may create. + + -- Data: resource.RLIMIT_DATA + + The maximum size (in bytes) of the process’s heap. + + -- Data: resource.RLIMIT_STACK + + The maximum size (in bytes) of the call stack for the current + process. This only affects the stack of the main thread in a + multi-threaded process. + + -- Data: resource.RLIMIT_RSS + + The maximum resident set size that should be made available to the + process. + + -- Data: resource.RLIMIT_NPROC + + The maximum number of processes the current process may create. + + -- Data: resource.RLIMIT_NOFILE + + The maximum number of open file descriptors for the current + process. + + -- Data: resource.RLIMIT_OFILE + + The BSD name for *note RLIMIT_NOFILE: 482a. + + -- Data: resource.RLIMIT_MEMLOCK + + The maximum address space which may be locked in memory. + + -- Data: resource.RLIMIT_VMEM + + The largest area of mapped memory which the process may occupy. + + *note Availability: 1d54.: FreeBSD >= 11. + + -- Data: resource.RLIMIT_AS + + The maximum area (in bytes) of address space which may be taken by + the process. + + -- Data: resource.RLIMIT_MSGQUEUE + + The number of bytes that can be allocated for POSIX message queues. + + *note Availability: 1d54.: Linux >= 2.6.8. + + Added in version 3.4. + + -- Data: resource.RLIMIT_NICE + + The ceiling for the process’s nice level (calculated as 20 - + rlim_cur). + + *note Availability: 1d54.: Linux >= 2.6.12. + + Added in version 3.4. + + -- Data: resource.RLIMIT_RTPRIO + + The ceiling of the real-time priority. + + *note Availability: 1d54.: Linux >= 2.6.12. + + Added in version 3.4. + + -- Data: resource.RLIMIT_RTTIME + + The time limit (in microseconds) on CPU time that a process can + spend under real-time scheduling without making a blocking syscall. + + *note Availability: 1d54.: Linux >= 2.6.25. + + Added in version 3.4. + + -- Data: resource.RLIMIT_SIGPENDING + + The number of signals which the process may queue. + + *note Availability: 1d54.: Linux >= 2.6.8. + + Added in version 3.4. + + -- Data: resource.RLIMIT_SBSIZE + + The maximum size (in bytes) of socket buffer usage for this user. + This limits the amount of network memory, and hence the amount of + mbufs, that this user may hold at any time. + + *note Availability: 1d54.: FreeBSD. + + Added in version 3.4. + + -- Data: resource.RLIMIT_SWAP + + The maximum size (in bytes) of the swap space that may be reserved + or used by all of this user id’s processes. This limit is enforced + only if bit 1 of the vm.overcommit sysctl is set. Please see + tuning(7)(3) for a complete description of this sysctl. + + *note Availability: 1d54.: FreeBSD. + + Added in version 3.4. + + -- Data: resource.RLIMIT_NPTS + + The maximum number of pseudo-terminals created by this user id. + + *note Availability: 1d54.: FreeBSD. + + Added in version 3.4. + + -- Data: resource.RLIMIT_KQUEUES + + The maximum number of kqueues this user id is allowed to create. + + *note Availability: 1d54.: FreeBSD >= 11. + + Added in version 3.10. + + ---------- Footnotes ---------- + + (1) https://manpages.debian.org/getrlimit(2) + + (2) https://manpages.debian.org/getrlimit(2) + + (3) https://man.freebsd.org/cgi/man.cgi?query=tuning&sektion=7 + + +File: python.info, Node: Resource Usage, Prev: Resource Limits, Up: resource — Resource usage information + +5.35.8.2 Resource Usage +....................... + +These functions are used to retrieve resource usage information: + + -- Function: 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. + + A simple example: + + 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 + is user mode or number of times the process was swapped out of main + memory. Some values are dependent on the clock tick internal, e.g. + the amount of memory the process is using. + + For backward compatibility, the return value is also accessible as + a tuple of 16 elements. + + 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: + + Index Field Resource + + ----------------------------------------------------------------------------------- + + ‘0’ ‘ru_utime’ time in user mode (float seconds) + + + ‘1’ ‘ru_stime’ time in system mode (float seconds) + + + ‘2’ ‘ru_maxrss’ maximum resident set size + + + ‘3’ ‘ru_ixrss’ shared memory size + + + ‘4’ ‘ru_idrss’ unshared memory size + + + ‘5’ ‘ru_isrss’ unshared stack size + + + ‘6’ ‘ru_minflt’ page faults not requiring I/O + + + ‘7’ ‘ru_majflt’ page faults requiring I/O + + + ‘8’ ‘ru_nswap’ number of swap outs + + + ‘9’ ‘ru_inblock’ block input operations + + + ‘10’ ‘ru_oublock’ block output operations + + + ‘11’ ‘ru_msgsnd’ messages sent + + + ‘12’ ‘ru_msgrcv’ messages received + + + ‘13’ ‘ru_nsignals’ signals received + + + ‘14’ ‘ru_nvcsw’ voluntary context switches + + + ‘15’ ‘ru_nivcsw’ involuntary context switches + + + This function will raise a *note ValueError: 204. if an invalid + 'who' parameter is specified. It may also raise *note error: 4828. + exception in unusual circumstances. + + -- Function: resource.getpagesize () + + Returns the number of bytes in a system page. (This need not be + the same as the hardware page size.) + +The following ‘RUSAGE_*’ symbols are passed to the *note getrusage(): +13fc. function to specify which processes information should be provided +for. + + -- Data: resource.RUSAGE_SELF + + Pass to *note getrusage(): 13fc. to request resources consumed by + the calling process, which is the sum of resources used by all + threads in the process. + + -- Data: resource.RUSAGE_CHILDREN + + Pass to *note getrusage(): 13fc. to request resources consumed by + child processes of the calling process which have been terminated + and waited for. + + -- Data: resource.RUSAGE_BOTH + + Pass to *note getrusage(): 13fc. to request resources consumed by + both the current process and child processes. May not be available + on all systems. + + -- Data: resource.RUSAGE_THREAD + + Pass to *note getrusage(): 13fc. to request resources consumed by + the current thread. May not be available on all systems. + + Added in version 3.2. + + ---------- Footnotes ---------- + + (1) https://manpages.debian.org/getrusage(2) + + +File: python.info, Node: syslog — Unix syslog library routines, Prev: resource — Resource usage information, Up: Unix Specific Services + +5.35.9 ‘syslog’ — Unix syslog library routines +---------------------------------------------- + +__________________________________________________________________ + +This module provides an interface to the Unix ‘syslog’ library routines. +Refer to the Unix manual pages for a detailed description of the +‘syslog’ facility. + +*note Availability: 1d54.: Unix, not WASI, not iOS. + +This module wraps the system ‘syslog’ family of routines. A pure Python +library that can speak to a syslog server is available in the *note +logging.handlers: 89. module as *note SysLogHandler: 658. + +The module defines the following functions: + + -- Function: syslog.syslog (message) + + -- Function: syslog.syslog (priority, message) + + Send the string 'message' to the system logger. A trailing newline + is added if necessary. Each message is tagged with a priority + composed of a 'facility' and a 'level'. The optional 'priority' + argument, which defaults to *note LOG_INFO: 483d, determines the + message priority. If the facility is not encoded in 'priority' + using logical-or (‘LOG_INFO | LOG_USER’), the value given in the + *note openlog(): 53b. call is used. + + If *note openlog(): 53b. has not been called prior to the call to + *note syslog(): dc, *note openlog(): 53b. will be called with no + arguments. + + Raises an *note auditing event: 18ba. ‘syslog.syslog’ with + arguments ‘priority’, ‘message’. + + Changed in version 3.2: In previous versions, *note openlog(): 53b. + would not be called automatically if it wasn’t called prior to the + call to *note syslog(): dc, deferring to the syslog implementation + to call ‘openlog()’. + + Changed in version 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(): 53b. must be called in the main interpreter before + *note syslog(): dc. may be used in a subinterpreter. Otherwise it + will raise *note RuntimeError: 195. + + -- Function: syslog.openlog ([ident[, logoption[, facility]]]) + + Logging options of subsequent *note syslog(): dc. calls can be set + by calling *note openlog(): 53b. *note syslog(): dc. will call + *note openlog(): 53b. with no arguments if the log is not currently + open. + + The optional 'ident' keyword argument is a string which is + prepended to every message, and defaults to ‘sys.argv[0]’ with + leading path components stripped. The optional 'logoption' keyword + argument (default is 0) is a bit field – see below for possible + values to combine. The optional 'facility' keyword argument + (default is *note LOG_USER: 483e.) sets the default facility for + messages which do not have a facility explicitly encoded. + + Raises an *note auditing event: 18ba. ‘syslog.openlog’ with + arguments ‘ident’, ‘logoption’, ‘facility’. + + Changed in version 3.2: In previous versions, keyword arguments + were not allowed, and 'ident' was required. + + Changed in version 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: 195. if called in a subinterpreter. + + -- Function: syslog.closelog () + + Reset the syslog module values and call the system library + ‘closelog()’. + + This causes the module to behave as it does when initially + imported. For example, *note openlog(): 53b. will be called on the + first *note syslog(): dc. call (if *note openlog(): 53b. hasn’t + already been called), and 'ident' and other *note openlog(): 53b. + parameters are reset to defaults. + + Raises an *note auditing event: 18ba. ‘syslog.closelog’ with no + arguments. + + Changed in version 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: 195. if called in a subinterpreter. + + -- Function: syslog.setlogmask (maskpri) + + Set the priority mask to 'maskpri' and return the previous mask + value. Calls to *note syslog(): dc. with a priority level not set + in 'maskpri' are ignored. The default is to log all priorities. + The function ‘LOG_MASK(pri)’ calculates the mask for the individual + priority 'pri'. The function ‘LOG_UPTO(pri)’ calculates the mask + for all priorities up to and including 'pri'. + + Raises an *note auditing event: 18ba. ‘syslog.setlogmask’ with + argument ‘maskpri’. + +The module defines the following constants: + + -- Data: syslog.LOG_EMERG + -- Data: syslog.LOG_ALERT + -- Data: syslog.LOG_CRIT + -- Data: syslog.LOG_ERR + -- Data: syslog.LOG_WARNING + -- Data: syslog.LOG_NOTICE + -- Data: syslog.LOG_INFO + -- Data: syslog.LOG_DEBUG + + Priority levels (high to low). + + -- Data: syslog.LOG_AUTH + -- Data: syslog.LOG_AUTHPRIV + -- Data: syslog.LOG_CRON + -- Data: syslog.LOG_DAEMON + -- Data: syslog.LOG_FTP + -- Data: syslog.LOG_INSTALL + -- Data: syslog.LOG_KERN + -- Data: syslog.LOG_LAUNCHD + -- Data: syslog.LOG_LPR + -- Data: syslog.LOG_MAIL + -- Data: syslog.LOG_NETINFO + -- Data: syslog.LOG_NEWS + -- Data: syslog.LOG_RAS + -- Data: syslog.LOG_REMOTEAUTH + -- Data: syslog.LOG_SYSLOG + -- Data: syslog.LOG_USER + -- Data: syslog.LOG_UUCP + -- Data: syslog.LOG_LOCAL0 + -- Data: syslog.LOG_LOCAL1 + -- Data: syslog.LOG_LOCAL2 + -- Data: syslog.LOG_LOCAL3 + -- Data: syslog.LOG_LOCAL4 + -- Data: syslog.LOG_LOCAL5 + -- Data: syslog.LOG_LOCAL6 + -- Data: syslog.LOG_LOCAL7 + + Facilities, depending on availability in ‘<syslog.h>’ for *note + LOG_AUTHPRIV: 4847, *note LOG_FTP: 484a, *note LOG_NETINFO: 4850, + *note LOG_REMOTEAUTH: 4853, *note LOG_INSTALL: 484b. and *note + LOG_RAS: 4852. + + Changed in version 3.13: Added *note LOG_FTP: 484a, *note + LOG_NETINFO: 4850, *note LOG_REMOTEAUTH: 4853, *note LOG_INSTALL: + 484b, *note LOG_RAS: 4852, and *note LOG_LAUNCHD: 484d. + + -- Data: syslog.LOG_PID + -- Data: syslog.LOG_CONS + -- Data: syslog.LOG_NDELAY + -- Data: syslog.LOG_ODELAY + -- Data: syslog.LOG_NOWAIT + -- Data: syslog.LOG_PERROR + + Log options, depending on availability in ‘<syslog.h>’ for *note + LOG_ODELAY: 4861, *note LOG_NOWAIT: 4862. and *note LOG_PERROR: + 4863. + +* Menu: + +* Examples: Examples<36>. + + +File: python.info, Node: Examples<36>, Up: syslog — Unix syslog library routines + +5.35.9.1 Examples +................. + +* Menu: + +* Simple example:: + + +File: python.info, Node: Simple example, Up: Examples<36> + +5.35.9.2 Simple example +....................... + +A simple set of examples: + + import syslog + + syslog.syslog('Processing started') + if error: + syslog.syslog(syslog.LOG_ERR, 'Processing started') + +An example of setting some log options, these would include the process +ID in logged messages, and write the messages to the destination +facility used for mail logging: + + syslog.openlog(logoption=syslog.LOG_PID, facility=syslog.LOG_MAIL) + syslog.syslog('E-mail processing initiated...') + + +File: python.info, Node: Modules command-line interface CLI, Next: Superseded Modules, Prev: Unix Specific Services, Up: The Python Standard Library + +5.36 Modules command-line interface (CLI) +========================================= + +The following modules have a command-line interface. + + * *note ast: 4644. + + * *note asyncio: 3284. + + * *note base64: e. + + * *note calendar: 24f1. + + * *note code: 1a. + + * *note compileall: 4700. + + * *note cProfile: 27.: see *note profile: 4283. + + * *note difflib: 2335. + + * *note dis: 4716. + + * *note doctest: 3ff1. + + * ‘encodings.rot_13’ + + * *note ensurepip: 55. + + * *note filecmp: 5a. + + * *note fileinput: 5b. + + * *note ftplib: 5e. + + * *note gzip: 2971. + + * *note http.server: f4c. + + * ‘idlelib’ + + * *note inspect: f56. + + * *note json.tool: 366f. + + * *note mimetypes: 8f. + + * *note pdb: a5. + + * *note pickle: a6. + + * *note pickletools: 4785. + + * *note platform: 2d54. + + * *note poplib: ac. + + * *note profile: 4283. + + * *note pstats: b0. + + * *note py_compile: 46f8. + + * *note pyclbr: b4. + + * *note pydoc: b5. + + * *note quopri: b7. + + * *note random: 154. + + * *note runpy: be. + + * *note site: 44ee. + + * *note sqlite3: 43c. + + * *note symtable: 4679. + + * *note sysconfig: 43ed. + + * *note tabnanny: dd. + + * *note tarfile: fc6. + + * ‘this’ + + * *note timeit: 42a6. + + * *note tokenize: 46cc. + + * *note trace: 42c2. + + * *note turtledemo: 102. + + * *note unittest: 4069. + + * *note uuid: 43f. + + * *note venv: 111. + + * *note webbrowser: 115. + + * *note zipapp: 434d. + + * *note zipfile: 29df. + +See also the *note Python command-line interface: 19be. + + +File: python.info, Node: Superseded Modules, Next: Removed Modules, Prev: Modules command-line interface CLI, Up: The Python Standard Library + +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: +61. 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: a0. and *note +argparse: 6.). + +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: 20b. 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 — C-style parser for command line options:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0594/ + + +File: python.info, Node: getopt — C-style parser for command line options, Up: Superseded Modules + +5.37.1 ‘getopt’ — C-style parser for command line options +--------------------------------------------------------- + +'Source code:' Lib/getopt.py(1) + + Note: This module is considered feature complete. A more + declarative and extensible alternative to this API is provided in + the *note optparse: a0. 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: + 6. 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: 6. 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: a0. module. +See *note Choosing an argument parsing library: 2e6d. for additional +details. + +This module provides two functions and an exception: + + -- Function: 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 (‘':'’; i.e., the same format that Unix ‘getopt()’ uses). + + Note: 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 + (‘'='’). Optional arguments are not supported. 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: 486d. will be raised. + + The return value consists of two elements: the first is a list of + ‘(option, value)’ pairs; the second is the list of program + arguments left after the option list was stripped (this is a + trailing slice of 'args'). Each option-and-value pair returned has + the option as its first element, prefixed with a hyphen for short + options (e.g., ‘'-x'’) or two hyphens for long options (e.g., + ‘'--long-option'’), and the option argument as its second element, + or an empty string if the option has no argument. The options + occur in the list in the same order in which they were found, thus + allowing multiple occurrences. Long and short options may be + mixed. + + -- Function: getopt.gnu_getopt (args, shortopts, longopts=[]) + + This function works like *note getopt(): 61, except that GNU style + scanning mode is used by default. This means that option and + non-option arguments may be intermixed. The *note getopt(): 61. + function stops processing options as soon as a non-option argument + is encountered. + + 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. + + -- Exception: 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. + + -- Exception: getopt.error + + Alias for *note GetoptError: 486d.; for backward compatibility. + +An example using only Unix style options: + + >>> 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'] + +Using long option names is equally easy: + + >>> 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'] + +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: a0. 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: 6. 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: 2e6d. for details on how +the ‘argparse’ version of this code differs in behaviour from the +‘optparse’ (and ‘getopt’) version. + +See also +........ + +Module *note optparse: a0. + + Declarative command line option parsing. + +Module *note argparse: 6. + + More opinionated command line option and argument parsing library. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Lib/getopt.py + + +File: python.info, Node: Removed Modules, Next: Security Considerations<3>, Prev: Superseded Modules, Up: The Python Standard Library + +5.38 Removed Modules +==================== + +The modules described in this chapter have been removed from the Python +standard library. They are documented here to help people find +replacements. + +* Menu: + +* aifc — Read and write AIFF and AIFC files:: +* asynchat — Asynchronous socket command/response handler:: +* asyncore — Asynchronous socket handler:: +* audioop — Manipulate raw audio data:: +* cgi — Common Gateway Interface support:: +* cgitb — Traceback manager for CGI scripts:: +* chunk — Read IFF chunked data:: +* crypt — Function to check Unix passwords:: +* distutils — Building and installing Python modules:: +* imghdr — Determine the type of an image:: +* imp — Access the import internals:: +* mailcap — Mailcap file handling:: +* msilib — Read and write Microsoft Installer files:: +* nis — Interface to Sun’s NIS (Yellow Pages): nis — Interface to Sun’s NIS Yellow Pages. +* nntplib — NNTP protocol client:: +* ossaudiodev — Access to OSS-compatible audio devices:: +* pipes — Interface to shell pipelines:: +* smtpd — SMTP Server:: +* sndhdr — Determine type of sound file:: +* spwd — The shadow password database:: +* sunau — Read and write Sun AU files:: +* telnetlib — Telnet client:: +* uu — Encode and decode uuencode files:: +* xdrlib — 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: Removed Modules + +5.38.1 ‘aifc’ — Read and write AIFF and AIFC files +-------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.2 ‘asynchat’ — Asynchronous socket command/response handler +---------------------------------------------------------------- + +Deprecated since version 3.6, removed in version 3.12. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.12: 4fd. after being deprecated in Python 3.6. +The removal was decided in PEP 594(1). + +Applications should use the *note asyncio: a. 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: Removed Modules + +5.38.3 ‘asyncore’ — Asynchronous socket handler +----------------------------------------------- + +Deprecated since version 3.6, removed in version 3.12. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.12: 4fd. after being deprecated in Python 3.6. +The removal was decided in PEP 594(1). + +Applications should use the *note asyncio: a. 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 support, Prev: asyncore — Asynchronous socket handler, Up: Removed Modules + +5.38.4 ‘audioop’ — Manipulate raw audio data +-------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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 support, Next: cgitb — Traceback manager for CGI scripts, Prev: audioop — Manipulate raw audio data, Up: Removed Modules + +5.38.5 ‘cgi’ — Common Gateway Interface support +----------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in PEP 594(1). + +A fork of the module on PyPI can 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 ‘cgi’ 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/cgi.html + + +File: python.info, Node: cgitb — Traceback manager for CGI scripts, Next: chunk — Read IFF chunked data, Prev: cgi — Common Gateway Interface support, Up: Removed Modules + +5.38.6 ‘cgitb’ — Traceback manager for CGI scripts +-------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.7 ‘chunk’ — Read IFF chunked data +-------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.8 ‘crypt’ — Function to check Unix passwords +------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in PEP 594(1). + +Applications can use the *note hashlib: 68. module from the standard +library. Other possible replacements are third-party libraries from +PyPI: legacycrypt(2), bcrypt(3), argon2-cffi(4), or passlib(5). 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(6). + + ---------- 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://pypi.org/project/passlib/ + + (6) 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: Removed Modules + +5.38.9 ‘distutils’ — Building and installing Python modules +----------------------------------------------------------- + +Deprecated since version 3.10, removed in version 3.12. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.12: 503. 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: Removed Modules + +5.38.10 ‘imghdr’ — Determine the type of an image +------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.11 ‘imp’ — Access the import internals +------------------------------------------- + +Deprecated since version 3.4, removed in version 3.12. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.12: 50d. after being deprecated in Python 3.4. + +The *note removal notice: 50d. includes guidance for migrating code from +‘imp’ to *note importlib: 77. + +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: Removed Modules + +5.38.12 ‘mailcap’ — Mailcap file handling +----------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.13 ‘msilib’ — Read and write Microsoft Installer files +----------------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.14 ‘nis’ — Interface to Sun’s NIS (Yellow Pages) +----------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.15 ‘nntplib’ — NNTP protocol client +---------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.16 ‘ossaudiodev’ — Access to OSS-compatible audio devices +-------------------------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.17 ‘pipes’ — Interface to shell pipelines +---------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in PEP 594(1). + +Applications should use the *note subprocess: d6. 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: Removed Modules + +5.38.18 ‘smtpd’ — SMTP Server +----------------------------- + +Deprecated since version 3.6, removed in version 3.12. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.12: 4fd. 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: Removed Modules + +5.38.19 ‘sndhdr’ — Determine type of sound file +----------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.20 ‘spwd’ — The shadow password database +--------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.21 ‘sunau’ — Read and write Sun AU files +--------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.22 ‘telnetlib’ — Telnet client +----------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.23 ‘uu’ — Encode and decode uuencode files +----------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Removed Modules + +5.38.24 ‘xdrlib’ — Encode and decode XDR data +--------------------------------------------- + +Deprecated since version 3.11, removed in version 3.13. + +This module is no longer part of the Python standard library. It was +*note removed in Python 3.13: 143. after being deprecated in Python +3.11. The removal was decided in 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: Security Considerations<3>, Prev: Removed Modules, Up: The Python Standard Library + +5.39 Security Considerations +============================ + +The following modules have specific security considerations: + + * *note base64: e.: *note base64 security considerations: 3746. in + RFC 4648(1) + + * *note hashlib: 68.: *note all constructors take a “usedforsecurity” + keyword-only argument disabling known insecure and blocked + algorithms: 2ad7. + + * *note http.server: 72. is not suitable for production use, only + implementing basic security checks. See the *note security + considerations: 3b65. + + * *note logging: 87.: *note Logging configuration uses eval(): 2cbe. + + * *note multiprocessing: 94.: *note Connection.recv() uses pickle: + 3171. + + * *note pickle: a6.: *note Restricting globals in pickle: 28a0. + + * *note random: b8. shouldn’t be used for security purposes, use + *note secrets: c0. instead + + * *note shelve: c3.: *note shelve is based on pickle and thus + unsuitable for dealing with untrusted sources: 28bc. + + * *note ssl: d0.: *note SSL/TLS security considerations: 334b. + + * *note subprocess: d6.: *note Subprocess security considerations: + 3216. + + * *note tempfile: e0.: *note mktemp is deprecated due to + vulnerability to race conditions: 285f. + + * *note xml: 120.: *note XML security: 3774. + + * *note zipfile: 131.: *note maliciously prepared .zip files can + cause disk volume exhaustion: 29ee. + +The *note -I: 95e. command line option can be used to run Python in +isolated mode. When it cannot be used, the *note -P: 5a0. option or the +*note PYTHONSAFEPATH: 5a1. environment variable can be used to not +prepend a potentially unsafe path to *note sys.path: 3b0. 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: Extending and Embedding the Python Interpreter, Next: Python/C API Reference Manual, Prev: The Python Standard Library, Up: Top + +6 Extending and Embedding the Python Interpreter +************************************************ + +This document describes how to write modules in C or C++ to extend the +Python interpreter with new modules. Those modules can not only define +new functions but also new object types and their methods. The document +also describes how to embed the Python interpreter in another +application, for use as an extension language. Finally, it shows how to +compile and link extension modules so that they can be loaded +dynamically (at run time) into the interpreter, if the underlying +operating system supports this feature. + +This document assumes basic knowledge about Python. For an informal +introduction to the language, see *note The Python Tutorial: 1bd9. +*note The Python Language Reference: 145. gives a more formal definition +of the language. *note The Python Standard Library: 144. documents the +existing object types, functions and modules (both built-in and written +in Python) that give the language its wide application range. + +For a detailed description of the whole Python/C API, see the separate +*note Python/C API Reference Manual: 1bdb. + +* Menu: + +* Recommended third party tools:: +* Creating extensions without third party tools:: +* Embedding the CPython runtime in a larger application:: + + +File: python.info, Node: Recommended third party tools, Next: Creating extensions without third party tools, Up: Extending and Embedding the Python Interpreter + +6.1 Recommended third party tools +================================= + +This guide only covers the basic tools for creating extensions provided +as part of this version of CPython. Some *note third party tools: 48a8. +offer both simpler and more sophisticated approaches to creating C and +C++ extensions for Python. + + +File: python.info, Node: Creating extensions without third party tools, Next: Embedding the CPython runtime in a larger application, Prev: Recommended third party tools, Up: Extending and Embedding the Python Interpreter + +6.2 Creating extensions without third party tools +================================================= + +This section of the guide covers creating C and C++ extensions without +assistance from third party tools. It is intended primarily for +creators of those tools, rather than being a recommended way to create +your own C extensions. + +See also +........ + +PEP 489(1) – Multi-phase extension module initialization + +* Menu: + +* Extending Python with C or C++:: +* Defining Extension Types; Tutorial: Defining Extension Types Tutorial. +* Defining Extension Types; Assorted Topics: Defining Extension Types Assorted Topics. +* Building C and C++ Extensions:: +* Building C and C++ Extensions on Windows:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0489/ + + +File: python.info, Node: Extending Python with C or C++, Next: Defining Extension Types Tutorial, Up: Creating extensions without third party tools + +6.2.1 Extending Python with C or C++ +------------------------------------ + +It is quite easy to add new built-in modules to Python, if you know how +to program in C. Such 'extension modules' can do two things that can’t +be done directly in Python: they can implement new built-in object +types, and they can call C library functions and system calls. + +To support extensions, the Python API (Application Programmers +Interface) defines a set of functions, macros and variables that provide +access to most aspects of the Python run-time system. The Python API is +incorporated in a C source file by including the header ‘"Python.h"’. + +The compilation of an extension module depends on its intended use as +well as on your system setup; details are given in later chapters. + + Note: The C extension interface is specific to CPython, and + extension modules do not work on other Python implementations. In + many cases, it is possible to avoid writing C extensions and + preserve portability to other implementations. For example, if + your use case is calling C library functions or system calls, you + should consider using the *note ctypes: 2a. module or the cffi(1) + library rather than writing custom C code. These modules let you + write Python code to interface with C code and are more portable + between implementations of Python than writing and compiling a C + extension module. + +* Menu: + +* A Simple Example:: +* Intermezzo; Errors and Exceptions: Intermezzo Errors and Exceptions. +* Back to the Example:: +* The Module’s Method Table and Initialization Function:: +* Compilation and Linkage:: +* Calling Python Functions from C:: +* Extracting Parameters in Extension Functions:: +* Keyword Parameters for Extension Functions:: +* Building Arbitrary Values:: +* Reference Counts:: +* Writing Extensions in C++:: +* Providing a C API for an Extension Module:: + + ---------- Footnotes ---------- + + (1) https://cffi.readthedocs.io/ + + +File: python.info, Node: A Simple Example, Next: Intermezzo Errors and Exceptions, Up: Extending Python with C or C++ + +6.2.1.1 A Simple Example +........................ + +Let’s create an extension module called ‘spam’ (the favorite food of +Monty Python fans…) and let’s say we want to create a Python interface +to the C library function ‘system()’ (1). This function takes a +null-terminated character string as argument and returns an integer. We +want this function to be callable from Python as follows: + + >>> import spam + >>> status = spam.system("ls -l") + +Begin by creating a file ‘spammodule.c’. (Historically, if a module is +called ‘spam’, the C file containing its implementation is called +‘spammodule.c’; if the module name is very long, like ‘spammify’, the +module name can be just ‘spammify.c’.) + +The first two lines of our file can be: + + #define PY_SSIZE_T_CLEAN + #include <Python.h> + +which pulls in the Python API (you can add a comment describing the +purpose of the module and a copyright notice if you like). + + Note: Since Python may define some pre-processor definitions which + affect the standard headers on some systems, you 'must' include + ‘Python.h’ before any standard headers are included. + + ‘#define PY_SSIZE_T_CLEAN’ was used to indicate that ‘Py_ssize_t’ + should be used in some APIs instead of ‘int’. It is not necessary + since Python 3.13, but we keep it here for backward compatibility. + See *note Strings and buffers: 386. for a description of this + macro. + +All user-visible symbols defined by ‘Python.h’ have a prefix of ‘Py’ or +‘PY’, except those defined in standard header files. + + Tip: For backward compatibility, ‘Python.h’ includes several + standard header files. C extensions should include the standard + headers that they use, and should not rely on these implicit + includes. If using the limited C API version 3.13 or newer, the + implicit includes are: + + * ‘<assert.h>’ + + * ‘<intrin.h>’ (on Windows) + + * ‘<inttypes.h>’ + + * ‘<limits.h>’ + + * ‘<math.h>’ + + * ‘<stdarg.h>’ + + * ‘<wchar.h>’ + + * ‘<sys/types.h>’ (if present) + + If *note Py_LIMITED_API: 41a. is not defined, or is set to version + 3.12 or older, the headers below are also included: + + * ‘<ctype.h>’ + + * ‘<unistd.h>’ (on POSIX) + + If *note Py_LIMITED_API: 41a. is not defined, or is set to version + 3.10 or older, the headers below are also included: + + * ‘<errno.h>’ + + * ‘<stdio.h>’ + + * ‘<stdlib.h>’ + + * ‘<string.h>’ + +The next thing we add to our module file is the C function that will be +called when the Python expression ‘spam.system(string)’ is evaluated +(we’ll see shortly how it ends up being called): + + static PyObject * + spam_system(PyObject *self, PyObject *args) + { + const char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + return PyLong_FromLong(sts); + } + +There is a straightforward translation from the argument list in Python +(for example, the single expression ‘"ls -l"’) to the arguments passed +to the C function. The C function always has two arguments, +conventionally named 'self' and 'args'. + +The 'self' argument points to the module object for module-level +functions; for a method it would point to the object instance. + +The 'args' argument will be a pointer to a Python tuple object +containing the arguments. Each item of the tuple corresponds to an +argument in the call’s argument list. The arguments are Python objects +— in order to do anything with them in our C function we have to convert +them to C values. The function *note PyArg_ParseTuple(): 56e. in the +Python API checks the argument types and converts them to C values. It +uses a template string to determine the required types of the arguments +as well as the types of the C variables into which to store the +converted values. More about this later. + +*note PyArg_ParseTuple(): 56e. returns true (nonzero) if all arguments +have the right type and its components have been stored in the variables +whose addresses are passed. It returns false (zero) if an invalid +argument list was passed. In the latter case it also raises an +appropriate exception so the calling function can return ‘NULL’ +immediately (as we saw in the example). + + ---------- Footnotes ---------- + + (1) An interface for this function already exists in the standard +module *note os: a1. — it was chosen as a simple and straightforward +example. + + +File: python.info, Node: Intermezzo Errors and Exceptions, Next: Back to the Example, Prev: A Simple Example, Up: Extending Python with C or C++ + +6.2.1.2 Intermezzo: Errors and Exceptions +......................................... + +An important convention throughout the Python interpreter is the +following: when a function fails, it should set an exception condition +and return an error value (usually ‘-1’ or a ‘NULL’ pointer). Exception +information is stored in three members of the interpreter’s thread +state. These are ‘NULL’ if there is no exception. Otherwise they are +the C equivalents of the members of the Python tuple returned by *note +sys.exc_info(): 686. 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. + +The Python API defines a number of functions to set various types of +exceptions. + +The most common one is *note PyErr_SetString(): 579. Its arguments are +an exception object and a C string. The exception object is usually a +predefined object like *note PyExc_ZeroDivisionError: 48b1. The C +string indicates the cause of the error and is converted to a Python +string object and stored as the “associated value” of the exception. + +Another useful function is *note PyErr_SetFromErrno(): 48b2, which only +takes an exception argument and constructs the associated value by +inspection of the global variable ‘errno’. The most general function is +*note PyErr_SetObject(): 578, which takes two object arguments, the +exception and its associated value. You don’t need to *note +Py_INCREF(): 56b. the objects passed to any of these functions. + +You can test non-destructively whether an exception has been set with +*note PyErr_Occurred(): 18f1. This returns the current exception +object, or ‘NULL’ if no exception has occurred. You normally don’t need +to call *note PyErr_Occurred(): 18f1. to see whether an error occurred +in a function call, since you should be able to tell from the return +value. + +When a function 'f' that calls another function 'g' detects that the +latter fails, 'f' should itself return an error value (usually ‘NULL’ or +‘-1’). It should 'not' call one of the ‘PyErr_*’ functions — one has +already been called by 'g'. 'f'’s caller is then supposed to also +return an error indication to 'its' caller, again 'without' calling +‘PyErr_*’, and so on — the most detailed cause of the error was already +reported by the function that first detected it. Once the error reaches +the Python interpreter’s main loop, this aborts the currently executing +Python code and tries to find an exception handler specified by the +Python programmer. + +(There are situations where a module can actually give a more detailed +error message by calling another ‘PyErr_*’ function, and in such cases +it is fine to do so. As a general rule, however, this is not necessary, +and can cause information about the cause of the error to be lost: most +operations can fail for a variety of reasons.) + +To ignore an exception set by a function call that failed, the exception +condition must be cleared explicitly by calling *note PyErr_Clear(): +102a. The only time C code should call *note PyErr_Clear(): 102a. is if +it doesn’t want to pass the error on to the interpreter but wants to +handle it completely by itself (possibly by trying something else, or +pretending nothing went wrong). + +Every failing ‘malloc()’ call must be turned into an exception — the +direct caller of ‘malloc()’ (or ‘realloc()’) must call *note +PyErr_NoMemory(): 48b3. and return a failure indicator itself. All the +object-creating functions (for example, *note PyLong_FromLong(): 1839.) +already do this, so this note is only relevant to those who call +‘malloc()’ directly. + +Also note that, with the important exception of *note +PyArg_ParseTuple(): 56e. and friends, functions that return an integer +status usually return a positive value or zero for success and ‘-1’ for +failure, like Unix system calls. + +Finally, be careful to clean up garbage (by making *note Py_XDECREF(): +78a. or *note Py_DECREF(): 56c. calls for objects you have already +created) when you return an error indicator! + +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: 48b1, which you can use directly. +Of course, you should choose exceptions wisely — don’t use *note +PyExc_TypeError: 48b4. to mean that a file couldn’t be opened (that +should probably be *note PyExc_OSError: 48b5.). If something’s wrong +with the argument list, the *note PyArg_ParseTuple(): 56e. function +usually raises *note PyExc_TypeError: 48b4. If you have an argument +whose value must be in a particular range or must satisfy other +conditions, *note PyExc_ValueError: 48b6. 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(): 125d. in the +module’s *note Py_mod_exec: 97e. 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: 97e. +function is called. + +For now, let’s avoid the issue: we will block repeated initialization by +raising an *note ImportError: 415.: + + 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(): 125d. function may create a class with the +base class being *note Exception: 9d9. (unless another class is passed +in instead of ‘NULL’), described in *note Built-in Exceptions: 1883. + +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(): 56c. 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: 149e. 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(): 579. as shown below: + + static PyObject * + spam_system(PyObject *self, PyObject *args) + { + const char *command; + int sts; + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + sts = system(command); + if (sts < 0) { + PyErr_SetString(SpamError, "System command failed"); + return NULL; + } + return PyLong_FromLong(sts); + } + + +File: python.info, Node: Back to the Example, Next: The Module’s Method Table and Initialization Function, Prev: Intermezzo Errors and Exceptions, Up: Extending Python with C or C++ + +6.2.1.3 Back to the Example +........................... + +Going back to our example function, you should now be able to understand +this statement: + + if (!PyArg_ParseTuple(args, "s", &command)) + return NULL; + +It returns ‘NULL’ (the error indicator for functions returning object +pointers) if an error is detected in the argument list, relying on the +exception set by *note PyArg_ParseTuple(): 56e. Otherwise the string +value of the argument has been copied to the local variable ‘command’. +This is a pointer assignment and you are not supposed to modify the +string to which it points (so in Standard C, the variable ‘command’ +should properly be declared as ‘const char *command’). + +The next statement is a call to the Unix function ‘system()’, passing it +the string we just got from *note PyArg_ParseTuple(): 56e.: + + sts = system(command); + +Our ‘spam.system()’ function must return the value of ‘sts’ as a Python +object. This is done using the function *note PyLong_FromLong(): 1839. + + return PyLong_FromLong(sts); + +In this case, it will return an integer object. (Yes, even integers are +objects on the heap in Python!) + +If you have a C function that returns no useful argument (a function +returning void), the corresponding Python function must return ‘None’. +You need this idiom to do so (which is implemented by the *note +Py_RETURN_NONE: 143c. macro): + + Py_INCREF(Py_None); + return Py_None; + +*note Py_None: 48b9. is the C name for the special Python object ‘None’. +It is a genuine Python object rather than a ‘NULL’ pointer, which means +“error” in most contexts, as we have seen. + + +File: python.info, Node: The Module’s Method Table and Initialization Function, Next: Compilation and Linkage, Prev: Back to the Example, Up: Extending Python with C or C++ + +6.2.1.4 The Module’s Method Table and Initialization Function +............................................................. + +I promised to show how ‘spam_system()’ is called from Python programs. +First, we need to list its name and address in a “method table”: + + static PyMethodDef spam_methods[] = { + ... + {"system", spam_system, METH_VARARGS, + "Execute a shell command."}, + ... + {NULL, NULL, 0, NULL} /* Sentinel */ + }; + +Note the third entry (‘METH_VARARGS’). This is a flag telling the +interpreter the calling convention to be used for the C function. It +should normally always be ‘METH_VARARGS’ or ‘METH_VARARGS | +METH_KEYWORDS’; a value of ‘0’ means that an obsolete variant of *note +PyArg_ParseTuple(): 56e. is used. + +When using only ‘METH_VARARGS’, the function should expect the +Python-level parameters to be passed in as a tuple acceptable for +parsing via *note PyArg_ParseTuple(): 56e.; more information on this +function is provided below. + +The *note METH_KEYWORDS: 48bc. bit may be set in the third field if +keyword arguments should be passed to the function. In this case, the C +function should accept a third ‘PyObject *’ parameter which will be a +dictionary of keywords. Use *note PyArg_ParseTupleAndKeywords(): 37e. +to parse the arguments to such a function. + +The method table must be referenced in the module definition structure: + + static struct PyModuleDef spam_module = { + ... + .m_methods = spam_methods, + ... + }; + +This structure, in turn, must be passed to the interpreter in the +module’s initialization function. The initialization function must be +named ‘PyInit_name()’, where 'name' is the name of the module, and +should be the only non-‘static’ item defined in the module file: + + PyMODINIT_FUNC + PyInit_spam(void) + { + return PyModuleDef_Init(&spam_module); + } + +Note that *note PyMODINIT_FUNC: 149e. declares the function as ‘PyObject +*’ return type, declares any special linkage declarations required by +the platform, and for C++ declares the function as ‘extern "C"’. + +‘PyInit_spam()’ is called when each interpreter imports its module +‘spam’ for the first time. (See below for comments about embedding +Python.) A pointer to the module definition must be returned via *note +PyModuleDef_Init(): 48bd, so that the import machinery can create the +module and store it in ‘sys.modules’. + +When embedding Python, the ‘PyInit_spam()’ function is not called +automatically unless there’s an entry in the ‘PyImport_Inittab’ table. +To add the module to the initialization table, use *note +PyImport_AppendInittab(): 17a3, optionally followed by an import of the +module: + + #define PY_SSIZE_T_CLEAN + #include <Python.h> + + int + main(int argc, char *argv[]) + { + PyStatus status; + PyConfig config; + PyConfig_InitPythonConfig(&config); + + /* Add a built-in module, before Py_Initialize */ + if (PyImport_AppendInittab("spam", PyInit_spam) == -1) { + fprintf(stderr, "Error: could not extend in-built modules table\n"); + exit(1); + } + + /* Pass argv[0] to the Python interpreter */ + status = PyConfig_SetBytesString(&config, &config.program_name, argv[0]); + if (PyStatus_Exception(status)) { + goto exception; + } + + /* Initialize the Python interpreter. Required. + If this step fails, it will be a fatal error. */ + status = Py_InitializeFromConfig(&config); + if (PyStatus_Exception(status)) { + goto exception; + } + PyConfig_Clear(&config); + + /* Optionally import the module; alternatively, + import can be deferred until the embedded script + imports it. */ + PyObject *pmodule = PyImport_ImportModule("spam"); + if (!pmodule) { + PyErr_Print(); + fprintf(stderr, "Error: could not import module 'spam'\n"); + } + + // ... use Python C API here ... + + return 0; + + exception: + PyConfig_Clear(&config); + Py_ExitStatusException(status); + } + + Note: If you declare a global variable or a local static one, the + module may experience unintended side-effects on re-initialisation, + for example when removing entries from ‘sys.modules’ or importing + compiled modules into multiple interpreters within a process (or + following a ‘fork()’ without an intervening ‘exec()’). If module + state is not yet fully *note isolated: 48be, authors should + consider marking the module as having no support for + subinterpreters (via *note + Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED: 48bf.). + +A more substantial example module is included in the Python source +distribution as ‘Modules/xxlimited.c’. This file may be used as a +template or simply read as an example. + + +File: python.info, Node: Compilation and Linkage, Next: Calling Python Functions from C, Prev: The Module’s Method Table and Initialization Function, Up: Extending Python with C or C++ + +6.2.1.5 Compilation and Linkage +............................... + +There are two more things to do before you can use your new extension: +compiling and linking it with the Python system. If you use dynamic +loading, the details may depend on the style of dynamic loading your +system uses; see the chapters about building extension modules (chapter +*note Building C and C++ Extensions: 48c2.) and additional information +that pertains only to building on Windows (chapter *note Building C and +C++ Extensions on Windows: 1e38.) for more information about this. + +If you can’t use dynamic loading, or if you want to make your module a +permanent part of the Python interpreter, you will have to change the +configuration setup and rebuild the interpreter. Luckily, this is very +simple on Unix: just place your file (‘spammodule.c’ for example) in the +‘Modules/’ directory of an unpacked source distribution, add a line to +the file ‘Modules/Setup.local’ describing your file: + + spam spammodule.o + +and rebuild the interpreter by running ‘make’ in the toplevel directory. +You can also run ‘make’ in the ‘Modules/’ subdirectory, but then you +must first rebuild ‘Makefile’ there by running ‘‘make’ Makefile’. (This +is necessary each time you change the ‘Setup’ file.) + +If your module requires additional libraries to link with, these can be +listed on the line in the configuration file as well, for instance: + + spam spammodule.o -lX11 + + +File: python.info, Node: Calling Python Functions from C, Next: Extracting Parameters in Extension Functions, Prev: Compilation and Linkage, Up: Extending Python with C or C++ + +6.2.1.6 Calling Python Functions from C +....................................... + +So far we have concentrated on making C functions callable from Python. +The reverse is also useful: calling Python functions from C. This is +especially the case for libraries that support so-called “callback” +functions. If a C interface makes use of callbacks, the equivalent +Python often needs to provide a callback mechanism to the Python +programmer; the implementation will require calling the Python callback +functions from a C callback. Other uses are also imaginable. + +Fortunately, the Python interpreter is easily called recursively, and +there is a standard interface to call a Python function. (I won’t dwell +on how to call the Python parser with a particular string as input — if +you’re interested, have a look at the implementation of the *note -c: +5dc. command line option in ‘Modules/main.c’ from the Python source +code.) + +Calling a Python function is easy. First, the Python program must +somehow pass you the Python function object. You should provide a +function (or some other interface) to do this. When this function is +called, save a pointer to the Python function object (be careful to +*note Py_INCREF(): 56b. it!) in a global variable — or wherever you see +fit. For example, the following function might be part of a module +definition: + + 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: 14d4. flag; this is described in section *note The +Module’s Method Table and Initialization Function: 48ba. The *note +PyArg_ParseTuple(): 56e. function and its arguments are documented in +section *note Extracting Parameters in Extension Functions: 48c5. + +The macros *note Py_XINCREF(): a64. and *note Py_XDECREF(): 78a. +increment/decrement the reference count of an object and are safe in the +presence of ‘NULL’ pointers (but note that 'temp' will not be ‘NULL’ in +this context). More info on them in section *note Reference Counts: +48c6. + +Later, when it is time to call the function, you call the C function +*note PyObject_CallObject(): 48c7. This function has two arguments, +both pointers to arbitrary Python objects: the Python function, and the +argument list. The argument list must always be a tuple object, whose +length is the number of arguments. To call the Python function with no +arguments, pass in ‘NULL’, or an empty tuple; to call it with one +argument, pass a singleton tuple. *note Py_BuildValue(): 8a6. returns a +tuple when its format string consists of zero or more format codes +between parentheses. For example: + + 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(): 48c7. returns a Python object pointer: this +is the return value of the Python function. *note +PyObject_CallObject(): 48c7. is “reference-count-neutral” with respect +to its arguments. In the example a new tuple was created to serve as +the argument list, which is *note Py_DECREF(): 56c.-ed immediately after +the *note PyObject_CallObject(): 48c7. call. + +The return value of *note PyObject_CallObject(): 48c7. is “new”: either +it is a brand new object, or it is an existing object whose reference +count has been incremented. So, unless you want to save it in a global +variable, you should somehow *note Py_DECREF(): 56c. the result, even +(especially!) if you are not interested in its value. + +Before you do this, however, it is important to check that the return +value isn’t ‘NULL’. If it is, the Python function terminated by raising +an exception. If the C code that called *note PyObject_CallObject(): +48c7. is called from Python, it should now return an error indication to +its Python caller, so the interpreter can print a stack trace, or the +calling Python code can handle the exception. If this is not possible +or desirable, the exception should be cleared by calling *note +PyErr_Clear(): 102a. For example: + + if (result == NULL) + return NULL; /* Pass error back */ + ...use result... + Py_DECREF(result); + +Depending on the desired interface to the Python callback function, you +may also have to provide an argument list to *note +PyObject_CallObject(): 48c7. In some cases the argument list is also +provided by the Python program, through the same interface that +specified the callback function. It can then be saved and used in the +same manner as the function object. In other cases, you may have to +construct a new tuple to pass as the argument list. The simplest way to +do this is to call *note Py_BuildValue(): 8a6. For example, if you want +to pass an integral event code, you might use the following code: + + 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); + +Note the placement of ‘Py_DECREF(arglist)’ immediately after the call, +before the error check! Also note that strictly speaking this code is +not complete: *note Py_BuildValue(): 8a6. may run out of memory, and +this should be checked. + +You may also call a function with keyword arguments by using *note +PyObject_Call(): 398, which supports arguments and keyword arguments. +As in the above example, we use *note Py_BuildValue(): 8a6. to construct +the dictionary. + + 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: Extracting Parameters in Extension Functions, Next: Keyword Parameters for Extension Functions, Prev: Calling Python Functions from C, Up: Extending Python with C or C++ + +6.2.1.7 Extracting Parameters in Extension Functions +.................................................... + +The *note PyArg_ParseTuple(): 56e. function is declared as follows: + + int PyArg_ParseTuple(PyObject *arg, const char *format, ...); + +The 'arg' argument must be a tuple object containing an argument list +passed from Python to a C function. The 'format' argument must be a +format string, whose syntax is explained in *note Parsing arguments and +building values: 8a7. in the Python/C API Reference Manual. The +remaining arguments must be addresses of variables whose type is +determined by the format string. + +Note that while *note PyArg_ParseTuple(): 56e. checks that the Python +arguments have the required types, it cannot check the validity of the +addresses of C variables passed to the call: if you make mistakes there, +your code will probably crash or at least overwrite random bits in +memory. So be careful! + +Note that any Python object references which are provided to the caller +are 'borrowed' references; do not decrement their reference count! + +Some example calls: + + #define PY_SSIZE_T_CLEAN + #include <Python.h> + + int ok; + int i, j; + long k, l; + const char *s; + Py_ssize_t size; + + ok = PyArg_ParseTuple(args, ""); /* No arguments */ + /* Python call: f() */ + + ok = PyArg_ParseTuple(args, "s", &s); /* A string */ + /* Possible Python call: f('whoops!') */ + + ok = PyArg_ParseTuple(args, "lls", &k, &l, &s); /* Two longs and a string */ + /* Possible Python call: f(1, 2, 'three') */ + + ok = PyArg_ParseTuple(args, "(ii)s#", &i, &j, &s, &size); + /* A pair of ints and a string, whose size is also returned */ + /* Possible Python call: f((1, 2), 'three') */ + + { + const char *file; + const char *mode = "r"; + int bufsize = 0; + ok = PyArg_ParseTuple(args, "s|si", &file, &mode, &bufsize); + /* A string, and optionally another string and an integer */ + /* Possible Python calls: + f('spam') + f('spam', 'w') + f('spam', 'wb', 100000) */ + } + + { + int left, top, right, bottom, h, v; + ok = PyArg_ParseTuple(args, "((ii)(ii))(ii)", + &left, &top, &right, &bottom, &h, &v); + /* A rectangle and a point */ + /* Possible Python call: + f(((0, 0), (400, 300)), (10, 10)) */ + } + + { + Py_complex c; + ok = PyArg_ParseTuple(args, "D:myfunction", &c); + /* a complex, also providing a function name for errors */ + /* Possible Python call: myfunction(1+2j) */ + } + + +File: python.info, Node: Keyword Parameters for Extension Functions, Next: Building Arbitrary Values, Prev: Extracting Parameters in Extension Functions, Up: Extending Python with C or C++ + +6.2.1.8 Keyword Parameters for Extension Functions +.................................................. + +The *note PyArg_ParseTupleAndKeywords(): 37e. function is declared as +follows: + + int PyArg_ParseTupleAndKeywords(PyObject *arg, PyObject *kwdict, + const char *format, char * const *kwlist, ...); + +The 'arg' and 'format' parameters are identical to those of the *note +PyArg_ParseTuple(): 56e. function. The 'kwdict' parameter is the +dictionary of keywords received as the third parameter from the Python +runtime. The 'kwlist' parameter is a ‘NULL’-terminated list of strings +which identify the parameters; the names are matched with the type +information from 'format' from left to right. On success, *note +PyArg_ParseTupleAndKeywords(): 37e. returns true, otherwise it returns +false and raises an appropriate exception. + + Note: Nested tuples cannot be parsed when using keyword arguments! + Keyword parameters passed in which are not present in the 'kwlist' + will cause *note TypeError: 534. to be raised. + +Here is an example module which uses keywords, based on an example by +Geoff Philbrick (<philbrick@hks.com>): + + #define PY_SSIZE_T_CLEAN + #include <Python.h> + + static PyObject * + keywdarg_parrot(PyObject *self, PyObject *args, PyObject *keywds) + { + int voltage; + const char *state = "a stiff"; + const char *action = "voom"; + const char *type = "Norwegian Blue"; + + static char *kwlist[] = {"voltage", "state", "action", "type", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, keywds, "i|sss", kwlist, + &voltage, &state, &action, &type)) + return NULL; + + printf("-- This parrot wouldn't %s if you put %i Volts through it.\n", + action, voltage); + printf("-- Lovely plumage, the %s -- It's %s!\n", type, state); + + Py_RETURN_NONE; + } + + static PyMethodDef keywdarg_methods[] = { + /* The cast of the function is necessary since PyCFunction values + * only take two PyObject* parameters, and keywdarg_parrot() takes + * three. + */ + {"parrot", (PyCFunction)(void(*)(void))keywdarg_parrot, METH_VARARGS | METH_KEYWORDS, + "Print a lovely skit to standard output."}, + {NULL, NULL, 0, NULL} /* sentinel */ + }; + + static struct PyModuleDef keywdarg_module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "keywdarg", + .m_size = 0, + .m_methods = keywdarg_methods, + }; + + PyMODINIT_FUNC + PyInit_keywdarg(void) + { + return PyModuleDef_Init(&keywdarg_module); + } + + +File: python.info, Node: Building Arbitrary Values, Next: Reference Counts, Prev: Keyword Parameters for Extension Functions, Up: Extending Python with C or C++ + +6.2.1.9 Building Arbitrary Values +................................. + +This function is the counterpart to *note PyArg_ParseTuple(): 56e. It +is declared as follows: + + PyObject *Py_BuildValue(const char *format, ...); + +It recognizes a set of format units similar to the ones recognized by +*note PyArg_ParseTuple(): 56e, but the arguments (which are input to the +function, not output) must not be pointers, just values. It returns a +new Python object, suitable for returning from a C function called from +Python. + +One difference with *note PyArg_ParseTuple(): 56e.: while the latter +requires its first argument to be a tuple (since Python argument lists +are always represented as tuples internally), *note Py_BuildValue(): +8a6. does not always build a tuple. It builds a tuple only if its +format string contains two or more format units. If the format string +is empty, it returns ‘None’; if it contains exactly one format unit, it +returns whatever object is described by that format unit. To force it +to return a tuple of size 0 or one, parenthesize the format string. + +Examples (to the left the call, to the right the resulting Python +value): + + 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: Reference Counts, Next: Writing Extensions in C++, Prev: Building Arbitrary Values, Up: Extending Python with C or C++ + +6.2.1.10 Reference Counts +......................... + +In languages like C or C++, the programmer is responsible for dynamic +allocation and deallocation of memory on the heap. In C, this is done +using the functions ‘malloc()’ and ‘free()’. In C++, the operators +‘new’ and ‘delete’ are used with essentially the same meaning and we’ll +restrict the following discussion to the C case. + +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. + +Common causes of memory leaks are unusual paths through the code. For +instance, a function may allocate a block of memory, do some +calculation, and then free the block again. Now a change in the +requirements for the function may add a test to the calculation that +detects an error condition and can return prematurely from the function. +It’s easy to forget to free the allocated memory block when taking this +premature exit, especially when it is added later to the code. Such +leaks, once introduced, often go undetected for a long time: the error +exit is taken only in a small fraction of all calls, and most modern +machines have plenty of virtual memory, so the leak only becomes +apparent in a long-running process that uses the leaking function +frequently. Therefore, it’s important to prevent leaks from happening +by having a coding convention or strategy that minimizes this kind of +errors. + +Since Python makes heavy use of ‘malloc()’ and ‘free()’, it needs a +strategy to avoid memory leaks as well as the use of freed memory. The +chosen method is called 'reference counting'. The principle is simple: +every object contains a counter, which is incremented when a reference +to the object is stored somewhere, and which is decremented when a +reference to it is deleted. When the counter reaches zero, the last +reference to the object has been deleted and the object is freed. + +An alternative strategy is called 'automatic garbage collection'. +(Sometimes, reference counting is also referred to as a garbage +collection strategy, hence my use of “automatic” to distinguish the +two.) The big advantage of automatic garbage collection is that the +user doesn’t need to call ‘free()’ explicitly. (Another claimed +advantage is an improvement in speed or memory usage — this is no hard +fact however.) The disadvantage is that for C, there is no truly +portable automatic garbage collector, while reference counting can be +implemented portably (as long as the functions ‘malloc()’ and ‘free()’ +are available — which the C Standard guarantees). Maybe some day a +sufficiently portable automatic garbage collector will be available for +C. Until then, we’ll have to live with reference counts. + +While Python uses the traditional reference counting implementation, it +also offers a cycle detector that works to detect reference cycles. +This allows applications to not worry about creating direct or indirect +circular references; these are the weakness of garbage collection +implemented using only reference counting. Reference cycles consist of +objects which contain (possibly indirect) references to themselves, so +that each object in the cycle has a reference count which is non-zero. +Typical reference counting implementations are not able to reclaim the +memory belonging to any objects in a reference cycle, or referenced from +the objects in the cycle, even though there are no further references to +the cycle itself. + +The cycle detector is able to detect garbage cycles and can reclaim +them. The *note gc: 60. module exposes a way to run the detector (the +*note collect(): a39. function), as well as configuration interfaces and +the ability to disable the detector at runtime. + +* Menu: + +* Reference Counting in Python:: +* Ownership Rules:: +* Thin Ice:: +* NULL Pointers:: + + +File: python.info, Node: Reference Counting in Python, Next: Ownership Rules, Up: Reference Counts + +6.2.1.11 Reference Counting in Python +..................................... + +There are two macros, ‘Py_INCREF(x)’ and ‘Py_DECREF(x)’, which handle +the incrementing and decrementing of the reference count. *note +Py_DECREF(): 56c. also frees the object when the count reaches zero. +For flexibility, it doesn’t call ‘free()’ directly — rather, it makes a +call through a function pointer in the object’s 'type object'. For this +purpose (and others), every object also contains a pointer to its type +object. + +The big question now remains: when to use ‘Py_INCREF(x)’ and +‘Py_DECREF(x)’? Let’s first introduce some terms. Nobody “owns” an +object; however, you can 'own a reference' to an object. An object’s +reference count is now defined as the number of owned references to it. +The owner of a reference is responsible for calling *note Py_DECREF(): +56c. when the reference is no longer needed. Ownership of a reference +can be transferred. There are three ways to dispose of an owned +reference: pass it on, store it, or call *note Py_DECREF(): 56c. +Forgetting to dispose of an owned reference creates a memory leak. + +It is also possible to 'borrow' (1) a reference to an object. The +borrower of a reference should not call *note Py_DECREF(): 56c. 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). + +The advantage of borrowing over owning a reference is that you don’t +need to take care of disposing of the reference on all possible paths +through the code — in other words, with a borrowed reference you don’t +run the risk of leaking when a premature exit is taken. The +disadvantage of borrowing over owning is that there are some subtle +situations where in seemingly correct code a borrowed reference can be +used after the owner from which it was borrowed has in fact disposed of +it. + +A borrowed reference can be changed into an owned reference by calling +*note Py_INCREF(): 56b. This does not affect the status of the owner +from which the reference was borrowed — it creates a new owned +reference, and gives full owner responsibilities (the new owner must +dispose of the reference properly, as well as the previous owner). + + ---------- Footnotes ---------- + + (1) The metaphor of “borrowing” a reference is not completely +correct: the owner still has a copy of the reference. + + (2) Checking that the reference count is at least 1 'does not work' — +the reference count itself could be in freed memory and may thus be +reused for another object! + + +File: python.info, Node: Ownership Rules, Next: Thin Ice, Prev: Reference Counting in Python, Up: Reference Counts + +6.2.1.12 Ownership Rules +........................ + +Whenever an object reference is passed into or out of a function, it is +part of the function’s interface specification whether ownership is +transferred with the reference or not. + +Most functions that return a reference to an object pass on ownership +with the reference. In particular, all functions whose function it is +to create a new object, such as *note PyLong_FromLong(): 1839. and *note +Py_BuildValue(): 8a6, pass ownership to the receiver. Even if the +object is not actually new, you still receive ownership of a new +reference to that object. For instance, *note PyLong_FromLong(): 1839. +maintains a cache of popular values and can return a reference to a +cached item. + +Many functions that extract objects from other objects also transfer +ownership with the reference, for instance *note +PyObject_GetAttrString(): 347. The picture is less clear, here, +however, since a few common routines are exceptions: *note +PyTuple_GetItem(): 48d2, *note PyList_GetItem(): 357, *note +PyDict_GetItem(): 382, and *note PyDict_GetItemString(): 383. all return +references that you borrow from the tuple, list or dictionary. + +The function *note PyImport_AddModule(): 354. also returns a borrowed +reference, even though it may actually create the object it returns: +this is possible because an owned reference to the object is stored in +‘sys.modules’. + +When you pass an object reference into another function, in general, the +function borrows the reference from you — if it needs to store it, it +will use *note Py_INCREF(): 56b. to become an independent owner. There +are exactly two important exceptions to this rule: *note +PyTuple_SetItem(): 48d3. and *note PyList_SetItem(): 1577. These +functions take over ownership of the item passed to them — even if they +fail! (Note that *note PyDict_SetItem(): 48d4. and friends don’t take +over ownership — they are “normal.”) + +When a C function is called from Python, it borrows references to its +arguments from the caller. The caller owns a reference to the object, +so the borrowed reference’s lifetime is guaranteed until the function +returns. Only when such a borrowed reference must be stored or passed +on, it must be turned into an owned reference by calling *note +Py_INCREF(): 56b. + +The object reference returned from a C function that is called from +Python must be an owned reference — ownership is transferred from the +function to its caller. + + +File: python.info, Node: Thin Ice, Next: NULL Pointers, Prev: Ownership Rules, Up: Reference Counts + +6.2.1.13 Thin Ice +................. + +There are a few situations where seemingly harmless use of a borrowed +reference can lead to problems. These all have to do with implicit +invocations of the interpreter, which can cause the owner of a reference +to dispose of it. + +The first and most important case to know about is using *note +Py_DECREF(): 56c. on an unrelated object while borrowing a reference to +a list item. For instance: + + void + bug(PyObject *list) + { + PyObject *item = PyList_GetItem(list, 0); + + PyList_SetItem(list, 1, PyLong_FromLong(0L)); + PyObject_Print(item, stdout, 0); /* BUG! */ + } + +This function first borrows a reference to ‘list[0]’, then replaces +‘list[1]’ with the value ‘0’, and finally prints the borrowed reference. +Looks harmless, right? But it’s not! + +Let’s follow the control flow into *note PyList_SetItem(): 1577. 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. + +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’. + +The solution, once you know the source of the problem, is easy: +temporarily increment the reference count. The correct version of the +function reads: + + 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: +148. protecting Python’s entire object space. However, it is possible +to temporarily release this lock using the macro *note +Py_BEGIN_ALLOW_THREADS: 48d7, and to re-acquire it using *note +Py_END_ALLOW_THREADS: a8e. 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! */ + } + + +File: python.info, Node: NULL Pointers, Prev: Thin Ice, Up: Reference Counts + +6.2.1.14 NULL Pointers +...................... + +In general, functions that take object references as arguments do not +expect you to pass them ‘NULL’ pointers, and will dump core (or cause +later core dumps) if you do so. Functions that return object references +generally return ‘NULL’ only to indicate that an exception occurred. +The reason for not testing for ‘NULL’ arguments is that functions often +pass the objects they receive on to other function — if each function +were to test for ‘NULL’, there would be a lot of redundant tests and the +code would run more slowly. + +It is better to test for ‘NULL’ only at the “source:” when a pointer +that may be ‘NULL’ is received, for example, from ‘malloc()’ or from a +function that may raise an exception. + +The macros *note Py_INCREF(): 56b. and *note Py_DECREF(): 56c. do not +check for ‘NULL’ pointers — however, their variants *note Py_XINCREF(): +a64. and *note Py_XDECREF(): 78a. do. + +The macros for checking for a particular object type (‘Pytype_Check()’) +don’t check for ‘NULL’ pointers — again, there is much code that calls +several of these in a row to test an object against various different +expected types, and this would generate redundant tests. There are no +variants with ‘NULL’ checking. + +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). + +It is a severe error to ever let a ‘NULL’ pointer “escape” to the Python +user. + + ---------- Footnotes ---------- + + (1) These guarantees don’t hold when you use the “old” style calling +convention — this is still found in much existing code. + + +File: python.info, Node: Writing Extensions in C++, Next: Providing a C API for an Extension Module, Prev: Reference Counts, Up: Extending Python with C or C++ + +6.2.1.15 Writing Extensions in C++ +.................................. + +It is possible to write extension modules in C++. Some restrictions +apply. If the main program (the Python interpreter) is compiled and +linked by the C compiler, global or static objects with constructors +cannot be used. This is not a problem if the main program is linked by +the C++ compiler. Functions that will be called by the Python +interpreter (in particular, module initialization functions) have to be +declared using ‘extern "C"’. It is unnecessary to enclose the Python +header files in ‘extern "C" {...}’ — they use this form already if the +symbol ‘__cplusplus’ is defined (all recent C++ compilers define this +symbol). + + +File: python.info, Node: Providing a C API for an Extension Module, Prev: Writing Extensions in C++, Up: Extending Python with C or C++ + +6.2.1.16 Providing a C API for an Extension Module +.................................................. + +Many extension modules just provide new functions and types to be used +from Python, but sometimes the code in an extension module can be useful +for other extension modules. For example, an extension module could +implement a type “collection” which works like lists without order. +Just like the standard Python list type has a C API which permits +extension modules to create and manipulate lists, this new collection +type should have a set of C functions for direct manipulation from other +extension modules. + +At first sight this seems easy: just write the functions (without +declaring them ‘static’, of course), provide an appropriate header file, +and document the C API. And in fact this would work if all extension +modules were always linked statically with the Python interpreter. When +modules are used as shared libraries, however, the symbols defined in +one module may not be visible to another module. The details of +visibility depend on the operating system; some systems use one global +namespace for the Python interpreter and all extension modules (Windows, +for example), whereas others require an explicit list of imported +symbols at module link time (AIX is one example), or offer a choice of +different strategies (most Unices). And even if symbols are globally +visible, the module whose functions one wishes to call might not have +been loaded yet! + +Portability therefore requires not to make any assumptions about symbol +visibility. This means that all symbols in extension modules should be +declared ‘static’, except for the module’s initialization function, in +order to avoid name clashes with other extension modules (as discussed +in section *note The Module’s Method Table and Initialization Function: +48ba.). And it means that symbols that 'should' be accessible from +other extension modules must be exported in a different way. + +Python provides a special mechanism to pass C-level information +(pointers) from one extension module to another one: Capsules. A +Capsule is a Python data type which stores a pointer (void*). Capsules +can only be created and accessed via their C API, but they can be passed +around like any other Python object. In particular, they can be +assigned to a name in an extension module’s namespace. Other extension +modules can then import this module, retrieve the value of this name, +and then retrieve the pointer from the Capsule. + +There are many ways in which Capsules can be used to export the C API of +an extension module. Each function could get its own Capsule, or all C +API pointers could be stored in an array whose address is published in a +Capsule. And the various tasks of storing and retrieving the pointers +can be distributed in different ways between the module providing the +code and the client modules. + +Whichever method you choose, it’s important to name your Capsules +properly. The function *note PyCapsule_New(): 48dd. takes a name +parameter (const char*); you’re permitted to pass in a ‘NULL’ name, but +we strongly encourage you to specify a name. Properly named Capsules +provide a degree of runtime type-safety; there is no feasible way to +tell one unnamed Capsule from another. + +In particular, Capsules used to expose C APIs should be given a name +following this convention: + + modulename.attributename + +The convenience function *note PyCapsule_Import(): 186d. makes it easy +to load a C API provided via a Capsule, but only if the Capsule’s name +matches this convention. This behavior gives C API users a high degree +of certainty that the Capsule they load contains the correct C API. + +The following example demonstrates an approach that puts most of the +burden on the writer of the exporting module, which is appropriate for +commonly used library modules. It stores all C API pointers (just one +in the example!) in an array of void pointers which becomes the value +of a Capsule. The header file corresponding to the module provides a +macro that takes care of importing the module and retrieving its C API +pointers; client modules only have to call this macro before accessing +the C API. + +The exporting module is a modification of the ‘spam’ module from section +*note A Simple Example: 48ae. 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); + } + +In the beginning of the module, right after the line + + #include <Python.h> + +two more lines must be added: + + #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: 97e. 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! + +The bulk of the work is in the header file ‘spammodule.h’, which looks +like this: + + #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: 97e. function: + + static int + client_module_exec(PyObject *m) + { + if (import_spam() < 0) { + return -1; + } + /* additional initialization can happen here */ + return 0; + } + +The main disadvantage of this approach is that the file ‘spammodule.h’ +is rather complicated. However, the basic structure is the same for +each function that is exported, so it has to be learned only once. + +Finally it should be mentioned that Capsules offer additional +functionality, which is especially useful for memory allocation and +deallocation of the pointer stored in a Capsule. The details are +described in the Python/C API Reference Manual in the section *note +Capsules: 2584. and in the implementation of Capsules (files +‘Include/pycapsule.h’ and ‘Objects/pycapsule.c’ in the Python source +code distribution). + + +File: python.info, Node: Defining Extension Types Tutorial, Next: Defining Extension Types Assorted Topics, Prev: Extending Python with C or C++, Up: Creating extensions without third party tools + +6.2.2 Defining Extension Types: Tutorial +---------------------------------------- + +Python allows the writer of a C extension module to define new types +that can be manipulated from Python code, much like the built-in *note +str: 447. and *note list: 60d. types. The code for all extension types +follows a pattern, but there are some details that you need to +understand before you can get started. This document is a gentle +introduction to the topic. + +* Menu: + +* The Basics:: +* Adding data and methods to the Basic example:: +* Providing finer control over data attributes:: +* Supporting cyclic garbage collection:: +* Subclassing other types:: + + +File: python.info, Node: The Basics, Next: Adding data and methods to the Basic example, Up: Defining Extension Types Tutorial + +6.2.2.1 The Basics +.................. + +The *note CPython: 6f1. runtime sees all Python objects as variables of +type *note PyObject: 334.*, which serves as a “base type” for all Python +objects. The *note PyObject: 334. structure itself only contains the +object’s *note reference count: 48e2. and a pointer to the object’s +“type object”. This is where the action is; the type object determines +which (C) functions get called by the interpreter when, for instance, an +attribute gets looked up on an object, a method called, or it is +multiplied by another object. These C functions are called “type +methods”. + +So, if you want to define a new extension type, you need to create a new +type object. + +This sort of thing can only be explained by example, so here’s a +minimal, but complete, module that defines a new type named ‘Custom’ +inside a C extension module ‘custom’: + + Note: What we’re showing here is the traditional way of defining + 'static' extension types. It should be adequate for most uses. + The C API also allows defining heap-allocated extension types using + the *note PyType_FromSpec(): 57a. function, which isn’t covered in + this tutorial. + + #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); + } + +Now that’s quite a bit to take in at once, but hopefully bits will seem +familiar from the previous chapter. This file defines three things: + + 1. What a ‘Custom’ 'object' contains: this is the ‘CustomObject’ + struct, which is allocated once for each ‘Custom’ instance. + + 2. How the ‘Custom’ 'type' behaves: this is the ‘CustomType’ struct, + which defines a set of flags and function pointers that the + interpreter inspects when specific operations are requested. + + 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. + +The first bit is: + + typedef struct { + PyObject_HEAD + } CustomObject; + +This is what a Custom object will contain. ‘PyObject_HEAD’ is mandatory +at the start of each object struct and defines a field called ‘ob_base’ +of type *note PyObject: 334, containing a pointer to a type object and a +reference count (these can be accessed using the macros *note Py_TYPE: +77b. and *note Py_REFCNT: 8a8. respectively). The reason for the macro +is to abstract away the layout and to enable additional fields in *note +debug builds: 1fb. + + Note: There is no semicolon above after the *note PyObject_HEAD: + 12d1. macro. Be wary of adding one by accident: some compilers + will complain. + +Of course, objects generally store additional data besides the standard +‘PyObject_HEAD’ boilerplate; for example, here is the definition for +standard Python floats: + + typedef struct { + PyObject_HEAD + double ob_fval; + } PyFloatObject; + +The second bit is the definition of the type object. + + 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, + }; + + Note: We recommend using C99-style designated initializers as + above, to avoid listing all the *note PyTypeObject: aa5. fields + that you don’t care about and also to avoid caring about the + fields’ declaration order. + +The actual definition of *note PyTypeObject: aa5. in ‘object.h’ has many +more *note fields: 98d. than the definition above. The remaining fields +will be filled with zeros by the C compiler, and it’s common practice to +not specify them explicitly unless you need them. + +We’re going to pick it apart, one field at a time: + + .ob_base = PyVarObject_HEAD_INIT(NULL, 0) + +This line is mandatory boilerplate to initialize the ‘ob_base’ field +mentioned above. + + .tp_name = "custom.Custom", + +The name of our type. This will appear in the default textual +representation of our objects and in some error messages, for example: + + >>> "" + custom.Custom() + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + TypeError: can only concatenate str (not "custom.Custom") to str + +Note that the name is a dotted name that includes both the module name +and the name of the type within the module. The module in this case is +‘custom’ and the type is ‘Custom’, so we set the type name to +‘custom.Custom’. Using the real dotted import path is important to make +your type compatible with the *note pydoc: b5. and *note pickle: a6. +modules. + + .tp_basicsize = sizeof(CustomObject), + .tp_itemsize = 0, + +This is so that Python knows how much memory to allocate when creating +new ‘Custom’ instances. *note tp_itemsize: 1f70. is only used for +variable-sized objects and should otherwise be zero. + + Note: If you want your type to be subclassable from Python, and + your type has the same *note tp_basicsize: 987. 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__: 1475, or else it will not be able to call your type’s + *note __new__(): 57d. method without getting an error. You can + avoid this problem by ensuring that your type has a larger value + for *note tp_basicsize: 987. than its base type does. Most of the + time, this will be true anyway, because either your base type will + be *note object: a8c, or else you will be adding data members to + your base type, and therefore increasing its size. + +We set the class flags to *note Py_TPFLAGS_DEFAULT: 48e3. + + .tp_flags = Py_TPFLAGS_DEFAULT, + +All types should include this constant in their flags. It enables all +of the members defined until at least Python 3.3. If you need further +members, you will need to OR the corresponding flags. + +We provide a doc string for the type in *note tp_doc: 48e4. + + .tp_doc = PyDoc_STR("Custom objects"), + +To enable object creation, we have to provide a *note tp_new: 57c. +handler. This is the equivalent of the Python method *note __new__(): +57d, but has to be specified explicitly. In this case, we can just use +the default implementation provided by the API function *note +PyType_GenericNew(): 48e5. + + .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; + } + +This initializes the ‘Custom’ type, filling in a number of members to +the appropriate default values, including *note ob_type: 48e6. that we +initially set to ‘NULL’. + + if (PyModule_AddObjectRef(m, "Custom", (PyObject *) &CustomType) < 0) { + return -1; + } + +This adds the type to the module dictionary. This allows us to create +‘Custom’ instances by calling the ‘Custom’ class: + + >>> import custom + >>> mycustom = custom.Custom() + +That’s it! All that remains is to build it; put the above code in a +file called ‘custom.c’, + + [build-system] + requires = ["setuptools"] + build-backend = "setuptools.build_meta" + + [project] + name = "custom" + version = "1" + +in a file called ‘pyproject.toml’, and + + from setuptools import Extension, setup + setup(ext_modules=[Extension("custom", ["custom.c"])]) + +in a file called ‘setup.py’; then typing + + $ python -m pip install . + +in a shell should produce a file ‘custom.so’ in a subdirectory and +install it; now fire up Python — you should be able to ‘import custom’ +and play around with ‘Custom’ objects. + +That wasn’t so hard, was it? + +Of course, the current Custom type is pretty uninteresting. It has no +data and doesn’t do anything. It can’t even be subclassed. + + +File: python.info, Node: Adding data and methods to the Basic example, Next: Providing finer control over data attributes, Prev: The Basics, Up: Defining Extension Types Tutorial + +6.2.2.2 Adding data and methods to the Basic example +.................................................... + +Let’s extend the basic example to add some data and methods. Let’s also +make the type usable as a base class. We’ll create a new module, +‘custom2’ that adds these capabilities: + + #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(CustomObject *self) + { + Py_XDECREF(self->first); + Py_XDECREF(self->last); + Py_TYPE(self)->tp_free((PyObject *) 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 = 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; + } + + static int + Custom_init(CustomObject *self, PyObject *args, PyObject *kwds) + { + 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(CustomObject *self, PyObject *Py_UNUSED(ignored)) + { + 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", (PyCFunction) 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 = (initproc) Custom_init, + .tp_dealloc = (destructor) 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); + } + +This version of the module has a number of changes. + +The ‘Custom’ type now has three data attributes in its C struct, +'first', 'last', and 'number'. The 'first' and 'last' variables are +Python strings containing first and last names. The 'number' attribute +is a C integer. + +The object structure is updated accordingly: + + typedef struct { + PyObject_HEAD + PyObject *first; /* first name */ + PyObject *last; /* last name */ + int number; + } CustomObject; + +Because we now have data to manage, we have to be more careful about +object allocation and deallocation. At a minimum, we need a +deallocation method: + + static void + Custom_dealloc(CustomObject *self) + { + Py_XDECREF(self->first); + Py_XDECREF(self->last); + Py_TYPE(self)->tp_free((PyObject *) self); + } + +which is assigned to the *note tp_dealloc: 48e8. member: + + .tp_dealloc = (destructor) Custom_dealloc, + +This method first clears the reference counts of the two Python +attributes. *note Py_XDECREF(): 78a. correctly handles the case where +its argument is ‘NULL’ (which might happen here if ‘tp_new’ failed +midway). It then calls the *note tp_free: 48e9. member of the object’s +type (computed by ‘Py_TYPE(self)’) to free the object’s memory. Note +that the object’s type might not be ‘CustomType’, because the object may +be an instance of a subclass. + + Note: The explicit cast to ‘destructor’ above is needed because we + defined ‘Custom_dealloc’ to take a ‘CustomObject *’ argument, but + the ‘tp_dealloc’ function pointer expects to receive a ‘PyObject *’ + argument. Otherwise, the compiler will emit a warning. This is + object-oriented polymorphism, in C! + +We want to make sure that the first and last names are initialized to +empty strings, so we provide a ‘tp_new’ implementation: + + 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; + } + +and install it in the *note tp_new: 57c. member: + + .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__(): 57d. method. It is not required to define a ‘tp_new’ member, +and indeed many extension types will simply reuse *note +PyType_GenericNew(): 48e5. 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. + + Note: ‘tp_new’ shouldn’t call ‘tp_init’ explicitly, as the + interpreter will do it itself. + +The ‘tp_new’ implementation calls the *note tp_alloc: 48ea. slot to +allocate memory: + + self = (CustomObject *) type->tp_alloc(type, 0); + +Since memory allocation may fail, we must check the *note tp_alloc: +48ea. result against ‘NULL’ before proceeding. + + Note: We didn’t fill the *note tp_alloc: 48ea. slot ourselves. + Rather *note PyType_Ready(): 777. fills it for us by inheriting it + from our base class, which is *note object: a8c. by default. Most + types use the default allocation strategy. + + Note: If you are creating a co-operative *note tp_new: 57c. (one + that calls a base type’s *note tp_new: 57c. or *note __new__(): + 57d.), you must 'not' try to determine what method to call using + method resolution order at runtime. Always statically determine + what type you are going to call, and call its *note tp_new: 57c. + directly, or via ‘type->tp_base->tp_new’. If you do not do this, + Python subclasses of your type that also inherit from other + Python-defined classes may not work correctly. (Specifically, you + may not be able to create instances of such subclasses without + getting a *note TypeError: 534.) + +We also define an initialization function which accepts arguments to +provide initial values for our instance: + + static int + Custom_init(CustomObject *self, PyObject *args, PyObject *kwds) + { + 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; + } + +by filling the *note tp_init: 57e. slot. + + .tp_init = (initproc) Custom_init, + +The *note tp_init: 57e. slot is exposed in Python as the *note +__init__(): 6ac. 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: a6. module by default +doesn’t call *note __init__(): 6ac. 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 release the *note Global +interpreter Lock: 159. 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? + + * when we absolutely know that the reference count is greater than 1; + + * when we know that deallocation of the object (1) will neither + release the *note GIL: 159. nor cause any calls back into our + type’s code; + + * when decrementing a reference count in a *note tp_dealloc: 48e8. + handler on a type which doesn’t support cyclic garbage collection + (2). + +We want to expose our instance variables as attributes. There are a +number of ways to do that. The simplest way is to define member +definitions: + + 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 */ + }; + +and put the definitions in the *note tp_members: 48eb. slot: + + .tp_members = Custom_members, + +Each member definition has a member name, type, offset, access flags and +documentation string. See the *note Generic Attribute Management: 48ec. +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(CustomObject *self, PyObject *Py_UNUSED(ignored)) + { + 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. + +Now that we’ve defined the method, we need to create an array of method +definitions: + + static PyMethodDef Custom_methods[] = { + {"name", (PyCFunction) Custom_name, METH_NOARGS, + "Return the name, combining the first and last name" + }, + {NULL} /* Sentinel */ + }; + +(note that we used the *note METH_NOARGS: 149f. flag to indicate that +the method is expecting no arguments other than 'self') + +and assign it to the *note tp_methods: 48ed. 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: 48ee. 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: 97d. struct, and update the full class +name in the *note PyTypeObject: aa5. 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) This is true when we know that the object is a basic type, like a +string or a float. + + (2) We relied on this in the *note tp_dealloc: 48e8. handler in this +example, because our type doesn’t support garbage collection. + + +File: python.info, Node: Providing finer control over data attributes, Next: Supporting cyclic garbage collection, Prev: Adding data and methods to the Basic example, Up: Defining Extension Types Tutorial + +6.2.2.3 Providing finer control over data attributes +.................................................... + +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(CustomObject *self) + { + Py_XDECREF(self->first); + Py_XDECREF(self->last); + Py_TYPE(self)->tp_free((PyObject *) 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 = 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; + } + + static int + Custom_init(CustomObject *self, PyObject *args, PyObject *kwds) + { + 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(CustomObject *self, void *closure) + { + return Py_NewRef(self->first); + } + + static int + Custom_setfirst(CustomObject *self, PyObject *value, void *closure) + { + 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(CustomObject *self, void *closure) + { + return Py_NewRef(self->last); + } + + static int + Custom_setlast(CustomObject *self, PyObject *value, void *closure) + { + 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", (getter) Custom_getfirst, (setter) Custom_setfirst, + "first name", NULL}, + {"last", (getter) Custom_getlast, (setter) Custom_setlast, + "last name", NULL}, + {NULL} /* Sentinel */ + }; + + static PyObject * + Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored)) + { + return PyUnicode_FromFormat("%S %S", self->first, self->last); + } + + static PyMethodDef Custom_methods[] = { + {"name", (PyCFunction) 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 = (initproc) Custom_init, + .tp_dealloc = (destructor) 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(CustomObject *self, void *closure) + { + Py_INCREF(self->first); + return self->first; + } + + static int + Custom_setfirst(CustomObject *self, PyObject *value, void *closure) + { + 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. + +We create an array of *note PyGetSetDef: bb8. structures: + + static PyGetSetDef Custom_getsetters[] = { + {"first", (getter) Custom_getfirst, (setter) Custom_setfirst, + "first name", NULL}, + {"last", (getter) Custom_getlast, (setter) Custom_setlast, + "last name", NULL}, + {NULL} /* Sentinel */ + }; + +and register it in the *note tp_getset: 48f0. slot: + + .tp_getset = Custom_getsetters, + +The last item in a *note PyGetSetDef: bb8. structure is the “closure” +mentioned above. In this case, we aren’t using a closure, so we just +pass ‘NULL’. + +We also remove the member definitions for these attributes: + + static PyMemberDef Custom_members[] = { + {"number", Py_T_INT, offsetof(CustomObject, number), 0, + "custom number"}, + {NULL} /* Sentinel */ + }; + +We also need to update the *note tp_init: 57e. handler to only allow +strings (1) to be passed: + + static int + Custom_init(CustomObject *self, PyObject *args, PyObject *kwds) + { + 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(): 78a. calls can +be converted to *note Py_DECREF(): 56c. 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’. + +We also rename the module initialization function and module name in the +initialization function, as we did before, and we add an extra +definition to the ‘setup.py’ file. + + ---------- 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: Supporting cyclic garbage collection, Next: Subclassing other types, Prev: Providing finer control over data attributes, Up: Defining Extension Types Tutorial + +6.2.2.4 Supporting cyclic garbage collection +............................................ + +Python has a *note cyclic garbage collector (GC): 1919. that can +identify unneeded objects even when their reference counts are not zero. +This can happen when objects are involved in cycles. For example, +consider: + + >>> l = [] + >>> l.append(l) + >>> del l + +In this example, we create a list that contains itself. When we delete +it, it still has a reference from itself. Its reference count doesn’t +drop to zero. Fortunately, Python’s cyclic garbage collector will +eventually figure out that the list is garbage and free it. + +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(CustomObject *self, visitproc visit, void *arg) + { + Py_VISIT(self->first); + Py_VISIT(self->last); + return 0; + } + + static int + Custom_clear(CustomObject *self) + { + Py_CLEAR(self->first); + Py_CLEAR(self->last); + return 0; + } + + static void + Custom_dealloc(CustomObject *self) + { + PyObject_GC_UnTrack(self); + Custom_clear(self); + Py_TYPE(self)->tp_free((PyObject *) 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 = 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; + } + + static int + Custom_init(CustomObject *self, PyObject *args, PyObject *kwds) + { + 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(CustomObject *self, void *closure) + { + return Py_NewRef(self->first); + } + + static int + Custom_setfirst(CustomObject *self, PyObject *value, void *closure) + { + 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(CustomObject *self, void *closure) + { + return Py_NewRef(self->last); + } + + static int + Custom_setlast(CustomObject *self, PyObject *value, void *closure) + { + 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", (getter) Custom_getfirst, (setter) Custom_setfirst, + "first name", NULL}, + {"last", (getter) Custom_getlast, (setter) Custom_setlast, + "last name", NULL}, + {NULL} /* Sentinel */ + }; + + static PyObject * + Custom_name(CustomObject *self, PyObject *Py_UNUSED(ignored)) + { + return PyUnicode_FromFormat("%S %S", self->first, self->last); + } + + static PyMethodDef Custom_methods[] = { + {"name", (PyCFunction) 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 = (initproc) Custom_init, + .tp_dealloc = (destructor) Custom_dealloc, + .tp_traverse = (traverseproc) Custom_traverse, + .tp_clear = (inquiry) 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(CustomObject *self, visitproc visit, void *arg) + { + 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(): 48f2. macro that automates calling +visit functions. With *note Py_VISIT(): 48f2, we can minimize the +amount of boilerplate in ‘Custom_traverse’: + + static int + Custom_traverse(CustomObject *self, visitproc visit, void *arg) + { + Py_VISIT(self->first); + Py_VISIT(self->last); + return 0; + } + + Note: The *note tp_traverse: 779. implementation must name its + arguments exactly 'visit' and 'arg' in order to use *note + Py_VISIT(): 48f2. + +Second, we need to provide a method for clearing any subobjects that can +participate in cycles: + + static int + Custom_clear(CustomObject *self) + { + Py_CLEAR(self->first); + Py_CLEAR(self->last); + return 0; + } + +Notice the use of the *note Py_CLEAR(): 575. 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(): 78a. 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). + + Note: You could emulate *note Py_CLEAR(): 575. 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(): 575. 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(): +14d1. before clearing members. Here is our reimplemented deallocator +using *note PyObject_GC_UnTrack(): 14d1. and ‘Custom_clear’: + + static void + Custom_dealloc(CustomObject *self) + { + PyObject_GC_UnTrack(self); + Custom_clear(self); + Py_TYPE(self)->tp_free((PyObject *) self); + } + +Finally, we add the *note Py_TPFLAGS_HAVE_GC: 778. flag to the class +flags: + + .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, + +That’s pretty much it. If we had written custom *note tp_alloc: 48ea. +or *note tp_free: 48e9. handlers, we’d need to modify them for cyclic +garbage collection. Most extensions will use the versions automatically +provided. + + ---------- Footnotes ---------- + + (1) Also, even with our attributes restricted to strings instances, +the user could pass arbitrary *note str: 447. subclasses and therefore +still create reference cycles. + + +File: python.info, Node: Subclassing other types, Prev: Supporting cyclic garbage collection, Up: Defining Extension Types Tutorial + +6.2.2.5 Subclassing other types +............................... + +It is possible to create new extension types that are derived from +existing types. It is easiest to inherit from the built in types, since +an extension can easily use the *note PyTypeObject: aa5. it needs. It +can be difficult to share these *note PyTypeObject: aa5. structures +between extension modules. + +In this example we will create a ‘SubList’ type that inherits from the +built-in *note list: 60d. 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(SubListObject *self, PyObject *unused) + { + self->state++; + return PyLong_FromLong(self->state); + } + + static PyMethodDef SubList_methods[] = { + {"increment", (PyCFunction) SubList_increment, METH_NOARGS, + PyDoc_STR("increment state counter")}, + {NULL}, + }; + + static int + SubList_init(SubListObject *self, PyObject *args, PyObject *kwds) + { + if (PyList_Type.tp_init((PyObject *) self, 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 = (initproc) 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(): 12d1. 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(SubListObject *self, PyObject *args, PyObject *kwds) + { + if (PyList_Type.tp_init((PyObject *) self, args, kwds) < 0) + return -1; + self->state = 0; + return 0; + } + +We see above how to call through to the *note __init__(): 6ac. method of +the base type. + +This pattern is important when writing a type with custom *note tp_new: +57c. and *note tp_dealloc: 48e8. members. The *note tp_new: 57c. +handler should not actually create the memory for the object with its +*note tp_alloc: 48ea, but let the base class handle it by calling its +own *note tp_new: 57c. + +The *note PyTypeObject: aa5. struct supports a *note tp_base: 48f4. +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: 48f5.; it should be done in the *note Py_mod_exec: +97e. 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; + } + +Before calling *note PyType_Ready(): 777, the type structure must have +the *note tp_base: 48f4. slot filled in. When we are deriving an +existing type, it is not necessary to fill out the *note tp_alloc: 48ea. +slot with *note PyType_GenericNew(): 48e5. – the allocation function +from the base type will be inherited. + +After that, calling *note PyType_Ready(): 777. and adding the type +object to the module is the same as with the basic ‘Custom’ examples. + + +File: python.info, Node: Defining Extension Types Assorted Topics, Next: Building C and C++ Extensions, Prev: Defining Extension Types Tutorial, Up: Creating extensions without third party tools + +6.2.3 Defining Extension Types: Assorted Topics +----------------------------------------------- + +This section aims to give a quick fly-by on the various type methods you +can implement and what they do. + +Here is the definition of *note PyTypeObject: aa5, with some fields only +used in *note debug builds: 1fb. omitted: + + 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 */ + struct PyMethodDef *tp_methods; + struct PyMemberDef *tp_members; + struct PyGetSetDef *tp_getset; + // Strong reference on a heap type, borrowed reference on a static type + struct _typeobject *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; + PyObject *tp_subclasses; + PyObject *tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + + destructor tp_finalize; + vectorcallfunc tp_vectorcall; + + /* bitset of which type-watchers care about this type */ + unsigned char tp_watched; + } PyTypeObject; + +Now that’s a 'lot' of methods. Don’t worry too much though – if you +have a type you want to define, the chances are very good that you will +only implement a handful of these. + +As you probably expect by now, we’re going to go over this and give more +information about the various handlers. We won’t go in the order they +are defined in the structure, because there is a lot of historical +baggage that impacts the ordering of the fields. It’s often easiest to +find an example that includes the fields you need and then change the +values to suit your new type. + + const char *tp_name; /* For printing */ + +The name of the type – as mentioned in the previous chapter, this will +appear in various places, almost entirely for diagnostic purposes. Try +to choose something that will be helpful in such a situation! + + Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ + +These fields tell the runtime how much memory to allocate when new +objects of this type are created. Python has some built-in support for +variable length structures (think: strings, tuples) which is where the +*note tp_itemsize: 1f70. field comes in. This will be dealt with later. + + const char *tp_doc; + +Here you can put a string (or its address) that you want returned when +the Python script references ‘obj.__doc__’ to retrieve the doc string. + +Now we come to the basic type methods – the ones most extension types +will implement. + +* Menu: + +* Finalization and De-allocation:: +* Object Presentation:: +* Attribute Management:: +* Object Comparison:: +* Abstract Protocol Support:: +* Weak Reference Support:: +* More Suggestions:: + + +File: python.info, Node: Finalization and De-allocation, Next: Object Presentation, Up: Defining Extension Types Assorted Topics + +6.2.3.1 Finalization and De-allocation +...................................... + + destructor tp_dealloc; + +This function is called when the reference count of the instance of your +type is reduced to zero and the Python interpreter wants to reclaim it. +If your type has memory to free or other clean-up to perform, you can +put it here. The object itself needs to be freed here as well. Here is +an example of this function: + + static void + newdatatype_dealloc(newdatatypeobject *obj) + { + free(obj->obj_UnderlyingDatatypePtr); + Py_TYPE(obj)->tp_free((PyObject *)obj); + } + +If your type supports garbage collection, the destructor should call +*note PyObject_GC_UnTrack(): 14d1. before clearing any member fields: + + static void + newdatatype_dealloc(newdatatypeobject *obj) + { + PyObject_GC_UnTrack(obj); + Py_CLEAR(obj->other_obj); + ... + Py_TYPE(obj)->tp_free((PyObject *)obj); + } + +One important requirement of the deallocator function is that it leaves +any pending exceptions alone. This is important since deallocators are +frequently called as the interpreter unwinds the Python stack; when the +stack is unwound due to an exception (rather than normal returns), +nothing is done to protect the deallocators from seeing that an +exception has already been set. Any actions which a deallocator +performs which may cause additional Python code to be executed may +detect that an exception has been set. This can lead to misleading +errors from the interpreter. The proper way to protect against this is +to save a pending exception before performing the unsafe action, and +restoring it when done. This can be done using the *note PyErr_Fetch(): +3ef. and *note PyErr_Restore(): 3f2. functions: + + 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(obj)->tp_free((PyObject*)self); + } + + Note: There are limitations to what you can safely do in a + deallocator function. First, if your type supports garbage + collection (using *note tp_traverse: 779. and/or *note tp_clear: + 48fb.), some of the object’s members can have been cleared or + finalized by the time *note tp_dealloc: 48e8. is called. Second, + in *note tp_dealloc: 48e8, your object is in an unstable state: its + reference count is equal to zero. Any call to a non-trivial object + or API (as in the example above) might end up calling *note + tp_dealloc: 48e8. again, causing a double free and a crash. + + Starting with Python 3.4, it is recommended not to put any complex + finalization code in *note tp_dealloc: 48e8, and instead use the + new *note tp_finalize: aa6. type method. + + See also + ........ + + PEP 442(1) explains the new finalization scheme. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0442/ + + +File: python.info, Node: Object Presentation, Next: Attribute Management, Prev: Finalization and De-allocation, Up: Defining Extension Types Assorted Topics + +6.2.3.2 Object Presentation +........................... + +In Python, there are two ways to generate a textual representation of an +object: the *note repr(): 7f9. function, and the *note str(): 447. +function. (The *note print(): f70. function just calls *note str(): +447.) These handlers are both optional. + + reprfunc tp_repr; + reprfunc tp_str; + +The *note tp_repr: 48fd. handler should return a string object +containing a representation of the instance for which it is called. +Here is a simple example: + + static PyObject * + newdatatype_repr(newdatatypeobject *obj) + { + return PyUnicode_FromFormat("Repr-ified_newdatatype{{size:%d}}", + obj->obj_UnderlyingDatatypePtr->size); + } + +If no *note tp_repr: 48fd. handler is specified, the interpreter will +supply a representation that uses the type’s *note tp_name: 18f2. and a +uniquely identifying value for the object. + +The *note tp_str: 48fe. handler is to *note str(): 447. what the *note +tp_repr: 48fd. handler described above is to *note repr(): 7f9.; that +is, it is called when Python code calls *note str(): 447. on an instance +of your object. Its implementation is very similar to the *note +tp_repr: 48fd. function, but the resulting string is intended for human +consumption. If *note tp_str: 48fe. is not specified, the *note +tp_repr: 48fd. handler is used instead. + +Here is a simple example: + + static PyObject * + newdatatype_str(newdatatypeobject *obj) + { + return PyUnicode_FromFormat("Stringified_newdatatype{{size:%d}}", + obj->obj_UnderlyingDatatypePtr->size); + } + + +File: python.info, Node: Attribute Management, Next: Object Comparison, Prev: Object Presentation, Up: Defining Extension Types Assorted Topics + +6.2.3.3 Attribute Management +............................ + +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: 334.*. 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: 334.* 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: + +* Generic Attribute Management:: +* Type-specific Attribute Management:: + + +File: python.info, Node: Generic Attribute Management, Next: Type-specific Attribute Management, Up: Attribute Management + +6.2.3.4 Generic Attribute Management +.................................... + +Most extension types only use 'simple' attributes. So, what makes the +attributes simple? There are only a couple of conditions that must be +met: + + 1. The name of the attributes must be known when *note PyType_Ready(): + 777. is called. + + 2. No special processing is needed to record that an attribute was + looked up or set, nor do actions need to be taken based on the + value. + +Note that this list does not place any restrictions on the values of the +attributes, when the values are computed, or how relevant data is +stored. + +When *note PyType_Ready(): 777. is called, it uses three tables +referenced by the type object to create *note descriptor: 1572.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: 16f2. and *note tp_setattro: 4901. fields +‘NULL’ as well, allowing the base type to handle attributes. + +The tables are declared as three fields of the type object: + + struct PyMethodDef *tp_methods; + struct PyMemberDef *tp_members; + struct PyGetSetDef *tp_getset; + +If *note tp_methods: 48ed. is not ‘NULL’, it must refer to an array of +*note PyMethodDef: 14a2. 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: 4902. field of the sentinel must +be ‘NULL’. + +The second table is used to define attributes which map directly to data +stored in the instance. A variety of primitive C types are supported, +and access may be read-only or read-write. The structures in the table +are defined as: + + 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: 1572. will be +constructed and added to the type which will be able to extract a value +from the instance structure. The *note type: 4903. field should contain +a type code like *note Py_T_INT: 58c. or *note Py_T_DOUBLE: 58d.; the +value will be used to determine how to convert Python values to and from +C values. The *note flags: 4904. field is used to store flags which +control how the attribute can be accessed: you can set it to *note +Py_READONLY: 58e. to prevent Python code from setting it. + +An interesting advantage of using the *note tp_members: 48eb. 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__: 1cac. attribute. + +As with the *note tp_methods: 48ed. table, a sentinel entry with a *note +ml_name: 4902. value of ‘NULL’ is required. + + +File: python.info, Node: Type-specific Attribute Management, Prev: Generic Attribute Management, Up: Attribute Management + +6.2.3.5 Type-specific Attribute Management +.......................................... + +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: 334.* 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: 4906. handler is called when the object requires +an attribute look-up. It is called in the same situations where the +*note __getattr__(): 4cf. method of a class would be called. + +Here is an example: + + static PyObject * + newdatatype_getattr(newdatatypeobject *obj, char *name) + { + if (strcmp(name, "data") == 0) + { + return PyLong_FromLong(obj->data); + } + + PyErr_Format(PyExc_AttributeError, + "'%.100s' object has no attribute '%.400s'", + Py_TYPE(obj)->tp_name, name); + return NULL; + } + +The *note tp_setattr: 4907. handler is called when the *note +__setattr__(): 1f2d. or *note __delattr__(): 1f2e. method of a class +instance would be called. When an attribute should be deleted, the +third parameter will be ‘NULL’. Here is an example that simply raises +an exception; if this were really all you wanted, the *note tp_setattr: +4907. handler should be set to ‘NULL’. + + static int + newdatatype_setattr(newdatatypeobject *obj, char *name, PyObject *v) + { + PyErr_Format(PyExc_RuntimeError, "Read-only attribute: %s", name); + return -1; + } + + +File: python.info, Node: Object Comparison, Next: Abstract Protocol Support, Prev: Attribute Management, Up: Defining Extension Types Assorted Topics + +6.2.3.6 Object Comparison +......................... + + richcmpfunc tp_richcompare; + +The *note tp_richcompare: 4909. handler is called when comparisons are +needed. It is analogous to the *note rich comparison methods: 1f62, +like ‘__lt__()’, and also called by *note PyObject_RichCompare(): 490a. +and *note PyObject_RichCompareBool(): 19a2. + +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. + +Here is a sample implementation, for a datatype that is considered equal +if the size of an internal pointer is equal: + + static PyObject * + newdatatype_richcmp(newdatatypeobject *obj1, newdatatypeobject *obj2, int op) + { + 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; + Py_INCREF(result); + return result; + } + + +File: python.info, Node: Abstract Protocol Support, Next: Weak Reference Support, Prev: Object Comparison, Up: Defining Extension Types Assorted Topics + +6.2.3.7 Abstract Protocol Support +................................. + +Python supports a variety of 'abstract' ‘protocols;’ the specific +interfaces provided to use these interfaces are documented in *note +Abstract Objects Layer: 490c. + +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; + +If you wish your object to be able to act like a number, a sequence, or +a mapping object, then you place the address of a structure that +implements the C type *note PyNumberMethods: 13e9, *note +PySequenceMethods: 490d, or *note PyMappingMethods: 490e, respectively. +It is up to you to fill in this structure with appropriate values. You +can find examples of the use of each of these in the ‘Objects’ directory +of the Python source distribution. + + hashfunc tp_hash; + +This function, if you choose to provide it, should return a hash number +for an instance of your data type. Here is a simple example: + + static Py_hash_t + newdatatype_hash(newdatatypeobject *obj) + { + Py_hash_t result; + result = obj->some_size + 32767 * obj->some_number; + if (result == -1) + result = -2; + return result; + } + +*note Py_hash_t: 1257. is a signed integer type with a platform-varying +width. Returning ‘-1’ from *note tp_hash: 490f. 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; + +This function is called when an instance of your data type is “called”, +for example, if ‘obj1’ is an instance of your data type and the Python +script contains ‘obj1('hello')’, the *note tp_call: 556. handler is +invoked. + +This function takes three arguments: + + 1. 'self' is the instance of the data type which is the subject of the + call. If the call is ‘obj1('hello')’, then 'self' is ‘obj1’. + + 2. 'args' is a tuple containing the arguments to the call. You can + use *note PyArg_ParseTuple(): 56e. to extract the arguments. + + 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(): 37e. to extract the arguments. If + you do not want to support keyword arguments and this is + non-‘NULL’, raise a *note TypeError: 534. with a message saying + that keyword arguments are not supported. + +Here is a toy ‘tp_call’ implementation: + + static PyObject * + newdatatype_call(newdatatypeobject *obj, PyObject *args, PyObject *kwds) + { + 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", + obj->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: 14b9. +corresponds to the Python *note __iter__(): 1f5c. method, while *note +tp_iternext: 14ba. corresponds to the Python *note __next__(): 12c0. +method. + +Any *note iterable: 121a. object must implement the *note tp_iter: 14b9. +handler, which must return an *note iterator: 1ac. 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: 14b9. + + * Objects which can only be iterated over once (usually due to side + effects of iteration, such as file objects) can implement *note + tp_iter: 14b9. by returning a new reference to themselves – and + should also therefore implement the *note tp_iternext: 14ba. + handler. + +Any *note iterator: 1ac. object should implement both *note tp_iter: +14b9. and *note tp_iternext: 14ba. An iterator’s *note tp_iter: 14b9. +handler should return a new reference to the iterator. Its *note +tp_iternext: 14ba. handler should return a new reference to the next +object in the iteration, if there is one. If the iteration has reached +the end, *note tp_iternext: 14ba. may return ‘NULL’ without setting an +exception, or it may set *note StopIteration: bfa. 'in addition' to +returning ‘NULL’; avoiding the exception can yield slightly better +performance. If an actual error occurs, *note tp_iternext: 14ba. should +always set an exception and return ‘NULL’. + + +File: python.info, Node: Weak Reference Support, Next: More Suggestions, Prev: Abstract Protocol Support, Up: Defining Extension Types Assorted Topics + +6.2.3.8 Weak Reference Support +.............................. + +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). + +See also +........ + +Documentation for the *note weakref: 114. module. + +For an object to be weakly referenceable, the extension type must set +the ‘Py_TPFLAGS_MANAGED_WEAKREF’ bit of the *note tp_flags: 18bd. field. +The legacy *note tp_weaklistoffset: 988. field should be left as zero. + +Concretely, here is how the statically declared type object would look: + + static PyTypeObject TrivialType = { + PyVarObject_HEAD_INIT(NULL, 0) + /* ... other members omitted for brevity ... */ + .tp_flags = Py_TPFLAGS_MANAGED_WEAKREF | ..., + }; + +The only further addition is that ‘tp_dealloc’ needs to clear any weak +references (by calling *note PyObject_ClearWeakRefs(): 573.): + + static void + Trivial_dealloc(TrivialObject *self) + { + /* Clear weakrefs first before calling any destructors */ + PyObject_ClearWeakRefs((PyObject *) self); + /* ... remainder of destruction code omitted for brevity ... */ + Py_TYPE(self)->tp_free((PyObject *) self); + } + + +File: python.info, Node: More Suggestions, Prev: Weak Reference Support, Up: Defining Extension Types Assorted Topics + +6.2.3.9 More Suggestions +........................ + +In order to learn how to implement any specific method for your new data +type, get the *note CPython: 6f1. 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(): 18f7. +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; + } + +See also +........ + +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: Building C and C++ Extensions, Next: Building C and C++ Extensions on Windows, Prev: Defining Extension Types Assorted Topics, Up: Creating extensions without third party tools + +6.2.4 Building C and C++ Extensions +----------------------------------- + +A C extension for CPython is a shared library (e.g. a ‘.so’ file on +Linux, ‘.pyd’ on Windows), which exports an 'initialization function'. + +To be importable, the shared library must be available on *note +PYTHONPATH: 1016, and must be named after the module name, with an +appropriate extension. When using setuptools, the correct filename is +generated automatically. + +The initialization function has the signature: + + -- C Function: *note PyObject: 334. *PyInit_modulename (void) + +It returns either a fully initialized module, or a *note PyModuleDef: +97d. instance. See *note Initializing C modules: 4915. for details. + +For modules with ASCII-only names, the function must be named +‘PyInit_<NAME>’, with ‘<name>’ replaced by the name of the module. When +using *note Multi-phase initialization: 4916, non-ASCII module names are +allowed. In this case, the initialization function name is +‘PyInitU_<NAME>’, with ‘<name>’ encoded using Python’s 'punycode' +encoding with hyphens replaced by underscores. In Python: + + def initfunc_name(name): + try: + suffix = b'_' + name.encode('ascii') + except UnicodeEncodeError: + suffix = b'U_' + name.encode('punycode').replace(b'-', b'_') + return b'PyInit' + suffix + +It is possible to export multiple modules from a single shared library +by defining multiple initialization functions. However, importing them +requires using symbolic links or a custom importer, because by default +only the function corresponding to the filename is found. See the +'“Multiple modules in one library”' section in PEP 489(1) for details. +* Menu: + +* Building C and C++ Extensions with setuptools:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0489/ + + +File: python.info, Node: Building C and C++ Extensions with setuptools, Up: Building C and C++ Extensions + +6.2.4.1 Building C and C++ Extensions with setuptools +..................................................... + +Python 3.12 and newer no longer come with distutils. Please refer to +the ‘setuptools’ documentation at +‘https://setuptools.readthedocs.io/en/latest/setuptools.html’ to learn +more about how build and distribute C/C++ extensions with setuptools. + + +File: python.info, Node: Building C and C++ Extensions on Windows, Prev: Building C and C++ Extensions, Up: Creating extensions without third party tools + +6.2.5 Building C and C++ Extensions on Windows +---------------------------------------------- + +This chapter briefly explains how to create a Windows extension module +for Python using Microsoft Visual C++, and follows with more detailed +background information on how it works. The explanatory material is +useful for both the Windows programmer learning to build Python +extensions and the Unix programmer interested in producing software +which can be successfully built on both Unix and Windows. + +Module authors are encouraged to use the distutils approach for building +extension modules, instead of the one described in this section. You +will still need the C compiler that was used to build Python; typically +Microsoft Visual C++. + + Note: This chapter mentions a number of filenames that include an + encoded Python version number. These filenames are represented + with the version number shown as ‘XY’; in practice, ‘'X'’ will be + the major version number and ‘'Y'’ will be the minor version number + of the Python release you’re working with. For example, if you are + using Python 2.2.1, ‘XY’ will actually be ‘22’. + +* Menu: + +* A Cookbook Approach:: +* Differences Between Unix and Windows:: +* Using DLLs in Practice:: + + +File: python.info, Node: A Cookbook Approach, Next: Differences Between Unix and Windows, Up: Building C and C++ Extensions on Windows + +6.2.5.1 A Cookbook Approach +........................... + +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 Building C and C++ +Extensions with setuptools: ef2. If you find you really need to do +things manually, it may be instructive to study the project file for the +winsound(1) standard library module. + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/PCbuild/winsound.vcxproj + + +File: python.info, Node: Differences Between Unix and Windows, Next: Using DLLs in Practice, Prev: A Cookbook Approach, Up: Building C and C++ Extensions on Windows + +6.2.5.2 Differences Between Unix and Windows +............................................ + +Unix and Windows use completely different paradigms for run-time loading +of code. Before you try to build a module that can be dynamically +loaded, be aware of how your system works. + +In Unix, a shared object (‘.so’) file contains code to be used by the +program, and also the names of functions and data that it expects to +find in the program. When the file is joined to the program, all +references to those functions and data in the file’s code are changed to +point to the actual locations in the program where the functions and +data are placed in memory. This is basically a link operation. + +In Windows, a dynamic-link library (‘.dll’) file has no dangling +references. Instead, an access to functions or data goes through a +lookup table. So the DLL code does not have to be fixed up at runtime +to refer to the program’s memory; instead, the code already uses the +DLL’s lookup table, and the lookup table is modified at runtime to point +to the functions and data. + +In Unix, there is only one type of library file (‘.a’) which contains +code from several object files (‘.o’). During the link step to create a +shared object file (‘.so’), the linker may find that it doesn’t know +where an identifier is defined. The linker will look for it in the +object files in the libraries; if it finds it, it will include all the +code from that object file. + +In Windows, there are two types of library, a static library and an +import library (both called ‘.lib’). A static library is like a Unix +‘.a’ file; it contains code to be included as necessary. An import +library is basically used only to reassure the linker that a certain +identifier is legal, and will be present in the program when the DLL is +loaded. So the linker uses the information from the import library to +build the lookup table for using identifiers that are not included in +the DLL. When an application or a DLL is linked, an import library may +be generated, which will need to be used for all future DLLs that depend +on the symbols in the application or DLL. + +Suppose you are building two dynamic-load modules, B and C, which should +share another block of code A. On Unix, you would 'not' pass ‘A.a’ to +the linker for ‘B.so’ and ‘C.so’; that would cause it to be included +twice, so that B and C would each have their own copy. In Windows, +building ‘A.dll’ will also build ‘A.lib’. You 'do' pass ‘A.lib’ to the +linker for B and C. ‘A.lib’ does not contain code; it just contains +information which will be used at runtime to access A’s code. + +In Windows, using an import library is sort of like using ‘import spam’; +it gives you access to spam’s names, but does not create a separate +copy. On Unix, linking with a library is more like ‘from spam import +*’; it does create a separate copy. + + +File: python.info, Node: Using DLLs in Practice, Prev: Differences Between Unix and Windows, Up: Building C and C++ Extensions on Windows + +6.2.5.3 Using DLLs in Practice +.............................. + +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 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 /I/python/include spam.c ../libs/pythonXY.lib + cl /LD /I/python/include ni.c spam.lib ../libs/pythonXY.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(): 56e.), but it does know how to find the Python +code thanks to ‘pythonXY.lib’. + +The second command created ‘ni.dll’ (and ‘.obj’ and ‘.lib’), which knows +how to find the necessary functions from spam, and also from the Python +executable. + +Not every identifier is exported to the lookup table. If you want any +other modules (including Python) to be able to see your identifiers, you +have to say ‘_declspec(dllexport)’, as in ‘void _declspec(dllexport) +initspam(void)’ or ‘PyObject _declspec(dllexport) *NiGetSpamData(void)’. + +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: Embedding the CPython runtime in a larger application, Prev: Creating extensions without third party tools, Up: Extending and Embedding the Python Interpreter + +6.3 Embedding the CPython runtime in a larger application +========================================================= + +Sometimes, rather than creating an extension that runs inside the Python +interpreter as the main application, it is desirable to instead embed +the CPython runtime inside a larger application. This section covers +some of the details involved in doing that successfully. + +* Menu: + +* Embedding Python in Another Application:: + + +File: python.info, Node: Embedding Python in Another Application, Up: Embedding the CPython runtime in a larger application + +6.3.1 Embedding Python in Another Application +--------------------------------------------- + +The previous chapters discussed how to extend Python, that is, how to +extend the functionality of Python by attaching a library of C functions +to it. It is also possible to do it the other way around: enrich your +C/C++ application by embedding Python in it. Embedding provides your +application with the ability to implement some of the functionality of +your application in Python rather than C or C++. This can be used for +many purposes; one example would be to allow users to tailor the +application to their needs by writing some scripts in Python. You can +also use it yourself if some of the functionality can be written in +Python more easily. + +Embedding Python is similar to extending it, but not quite. The +difference is that when you extend Python, the main program of the +application is still the Python interpreter, while if you embed Python, +the main program may have nothing to do with Python — instead, some +parts of the application occasionally call the Python interpreter to run +some Python code. + +So if you are embedding Python, you are providing your own main program. +One of the things this main program has to do is initialize the Python +interpreter. At the very least, you have to call the function *note +Py_Initialize(): 8ab. There are optional calls to pass command line +arguments to Python. Then later you can call the interpreter from any +part of the application. + +There are several different ways to call the interpreter: you can pass a +string containing Python statements to *note PyRun_SimpleString(): 4923, +or you can pass a stdio file pointer and a file name (for identification +in error messages only) to *note PyRun_SimpleFile(): 4924. You can also +call the lower-level operations described in the previous chapters to +construct and use Python objects. + +See also +........ + +*note Python/C API Reference Manual: 1bdb. + + The details of Python’s C interface are given in this manual. A + great deal of necessary information can be found here. + +* Menu: + +* Very High Level Embedding:: +* Beyond Very High Level Embedding; An overview: Beyond Very High Level Embedding An overview. +* Pure Embedding:: +* Extending Embedded Python:: +* Embedding Python in C++:: +* Compiling and Linking under Unix-like systems:: + + +File: python.info, Node: Very High Level Embedding, Next: Beyond Very High Level Embedding An overview, Up: Embedding Python in Another Application + +6.3.1.1 Very High Level Embedding +................................. + +The simplest form of embedding Python is the use of the very high level +interface. This interface is intended to execute a Python script +without needing to interact with the application directly. This can for +example be used to perform some operation on a file. + + #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); + } + + Note: ‘#define PY_SSIZE_T_CLEAN’ was used to indicate that + ‘Py_ssize_t’ should be used in some APIs instead of ‘int’. It is + not necessary since Python 3.13, but we keep it here for backward + compatibility. See *note Strings and buffers: 386. for a + description of this macro. + +Setting *note PyConfig.program_name: 3c0. should be called before *note +Py_InitializeFromConfig(): 3c1. to inform the interpreter about paths to +Python run-time libraries. Next, the Python interpreter is initialized +with *note Py_Initialize(): 8ab, followed by the execution of a +hard-coded Python script that prints the date and time. Afterwards, the +*note Py_FinalizeEx(): d15. 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(): 4924. function, which saves +you the trouble of allocating memory space and loading the file +contents. + + +File: python.info, Node: Beyond Very High Level Embedding An overview, Next: Pure Embedding, Prev: Very High Level Embedding, Up: Embedding Python in Another Application + +6.3.1.2 Beyond Very High Level Embedding: An overview +..................................................... + +The high level interface gives you the ability to execute arbitrary +pieces of Python code from your application, but exchanging data values +is quite cumbersome to say the least. If you want that, you should use +lower level calls. At the cost of having to write more C code, you can +achieve almost anything. + +It should be noted that extending Python and embedding Python is quite +the same activity, despite the different intent. Most topics discussed +in the previous chapters are still valid. To show this, consider what +the extension code from Python to C really does: + + 1. Convert data values from Python to C, + + 2. Perform a function call to a C routine using the converted values, + and + + 3. Convert the data values from the call from C to Python. + +When embedding Python, the interface code does: + + 1. Convert data values from C to Python, + + 2. Perform a function call to a Python interface routine using the + converted values, and + + 3. Convert the data values from the call from Python to C. + +As you can see, the data conversion steps are simply swapped to +accommodate the different direction of the cross-language transfer. The +only difference is the routine that you call between both data +conversions. When extending, you call a C routine, when embedding, you +call a Python routine. + +This chapter will not discuss how to convert data from Python to C and +vice versa. Also, proper use of references and dealing with errors is +assumed to be understood. Since these aspects do not differ from +extending the interpreter, you can refer to earlier chapters for the +required information. + + +File: python.info, Node: Pure Embedding, Next: Extending Embedded Python, Prev: Beyond Very High Level Embedding An overview, Up: Embedding Python in Another Application + +6.3.1.3 Pure Embedding +...................... + +The first program aims to execute a function in a Python script. Like +in the section about the very high level interface, the Python +interpreter does not directly interact with the application (but that +will change in the next section). + +The code to run a function defined in a Python script is: + + #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; + } + +This code loads a Python script using ‘argv[1]’, and calls the function +named in ‘argv[2]’. Its integer arguments are the other values of the +‘argv’ array. If you *note compile and link: 492b. this program (let’s +call the finished executable ‘call’), and use it to execute a Python +script, such as: + + def multiply(a,b): + print("Will compute", a, "times", b) + c = 0 + for i in range(0, a): + c = c + b + return c + +then the result should be: + + $ call multiply multiply 3 2 + Will compute 3 times 2 + Result of call: 6 + +Although the program is quite large for its functionality, most of the +code is for data conversion between Python and C, and for error +reporting. The interesting part with respect to embedding Python starts +with + + 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(): 13c8. This routine needs a Python string as its +argument, which is constructed using the *note +PyUnicode_DecodeFSDefault(): 171a. data conversion routine. + + pFunc = PyObject_GetAttrString(pModule, argv[2]); + /* pFunc is a new reference */ + + if (pFunc && PyCallable_Check(pFunc)) { + ... + } + Py_XDECREF(pFunc); + +Once the script is loaded, the name we’re looking for is retrieved using +*note PyObject_GetAttrString(): 347. If the name exists, and the object +returned is callable, you can safely assume that it is a function. The +program then proceeds by constructing a tuple of arguments as normal. +The call to the Python function is then made with: + + pValue = PyObject_CallObject(pFunc, pArgs); + +Upon return of the function, ‘pValue’ is either ‘NULL’ or it contains a +reference to the return value of the function. Be sure to release the +reference after examining the value. + + +File: python.info, Node: Extending Embedded Python, Next: Embedding Python in C++, Prev: Pure Embedding, Up: Embedding Python in Another Application + +6.3.1.4 Extending Embedded Python +................................. + +Until now, the embedded Python interpreter had no access to +functionality from the application itself. The Python API allows this +by extending the embedded interpreter. That is, the embedded +interpreter gets extended with routines provided by the application. +While it sounds complex, it is not so bad. Simply forget for a while +that the application starts the Python interpreter. Instead, consider +the application to be a set of subroutines, and write some glue code +that gives Python access to those routines, just like you would write a +normal Python extension. For example: + + 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); + } + +Insert the above code just above the ‘main()’ function. Also, insert +the following two statements before the call to *note Py_Initialize(): +8ab.: + + 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()) + +In a real application, the methods will expose an API of the application +to Python. + + +File: python.info, Node: Embedding Python in C++, Next: Compiling and Linking under Unix-like systems, Prev: Extending Embedded Python, Up: Embedding Python in Another Application + +6.3.1.5 Embedding Python in C++ +............................... + +It is also possible to embed Python in a C++ program; precisely how this +is done will depend on the details of the C++ system used; in general +you will need to write the main program in C++, and use the C++ compiler +to compile and link your program. There is no need to recompile Python +itself using C++. + + +File: python.info, Node: Compiling and Linking under Unix-like systems, Prev: Embedding Python in C++, Up: Embedding Python in Another Application + +6.3.1.6 Compiling and Linking under Unix-like systems +..................................................... + +It is not necessarily trivial to find the right flags to pass to your +compiler (and linker) in order to embed the Python interpreter into your +application, particularly because Python needs to load library modules +implemented as C dynamic extensions (‘.so’ files) linked against it. + +To find out the required compiler and linker flags, you can execute the +‘python`X.Y'-config’ script which is generated as part of the +installation process (a ‘python3-config’ script may also be available). +This script has several options, of which the following will be directly +useful to you: + + * ‘pythonX.Y-config --cflags’ will give you the recommended flags + when compiling: + + $ /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’ will give you the recommended + flags when linking: + + $ /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 + + Note: To avoid confusion between several Python installations (and + especially between the system Python and your own compiled Python), + it is recommended that you use the absolute path to + ‘python`X.Y'-config’, as in the above example. + +If this procedure doesn’t work for you (it is not guaranteed to work for +all Unix-like platforms; however, we welcome *note bug reports: 4931.) +you will have to read your system’s documentation about dynamic linking +and/or examine Python’s ‘Makefile’ (use *note +sysconfig.get_makefile_filename(): 43ec. to find its location) and +compilation options. In this case, the *note sysconfig: db. module is a +useful tool to programmatically extract the configuration values that +you will want to combine together. For example: + + >>> import sysconfig + >>> sysconfig.get_config_var('LIBS') + '-lpthread -ldl -lutil' + >>> sysconfig.get_config_var('LINKFORSHARED') + '-Xlinker -export-dynamic' + + +File: python.info, Node: Python/C API Reference Manual, Next: Installing Python Modules, Prev: Extending and Embedding the Python Interpreter, Up: Top + +7 Python/C API Reference Manual +******************************* + +This manual documents the API used by C and C++ programmers who want to +write extension modules or embed Python. It is a companion to *note +Extending and Embedding the Python Interpreter: 1bda, which describes +the general principles of extension writing but does not document the +API functions in detail. + +* Menu: + +* Introduction: Introduction<13>. +* C API Stability:: +* The Very High Level Layer:: +* Reference Counting:: +* Exception Handling:: +* Utilities: Utilities<2>. +* Abstract Objects Layer:: +* Concrete Objects Layer:: +* Initialization, Finalization, and Threads: Initialization Finalization and Threads. +* Python Initialization Configuration:: +* Memory Management:: +* Object Implementation Support:: +* API and ABI Versioning:: +* Monitoring C API:: +* Generating Execution Events:: + + +File: python.info, Node: Introduction<13>, Next: C API Stability, Up: Python/C API Reference Manual + +7.1 Introduction +================ + +The Application Programmer’s Interface to Python gives C and C++ +programmers access to the Python interpreter at a variety of levels. +The API is equally usable from C++, but for brevity it is generally +referred to as the Python/C API. There are two fundamentally different +reasons for using the Python/C API. The first reason is to write +'extension modules' for specific purposes; these are C modules that +extend the Python interpreter. This is probably the most common use. +The second reason is to use Python as a component in a larger +application; this technique is generally referred to as 'embedding' +Python in an application. + +Writing an extension module is a relatively well-understood process, +where a “cookbook” approach works well. There are several tools that +automate the process to some extent. While people have embedded Python +in other applications since its early existence, the process of +embedding Python is less straightforward than writing an extension. + +Many API functions are useful independent of whether you’re embedding or +extending Python; moreover, most applications that embed Python will +need to provide a custom extension as well, so it’s probably a good idea +to become familiar with writing an extension before attempting to embed +Python in a real application. + +* Menu: + +* Coding standards:: +* Include Files:: +* Useful macros:: +* Objects, Types and Reference Counts: Objects Types and Reference Counts. +* Exceptions: Exceptions<21>. +* Embedding Python: Embedding Python<2>. +* Debugging Builds:: +* Recommended third party tools: Recommended third party tools<2>. + + +File: python.info, Node: Coding standards, Next: Include Files, Up: Introduction<13> + +7.1.1 Coding standards +---------------------- + +If you’re writing C code for inclusion in CPython, you 'must' follow the +guidelines and standards defined in PEP 7(1). These guidelines apply +regardless of the version of Python you are contributing to. Following +these conventions is not necessary for your own third party extension +modules, unless you eventually expect to contribute them to Python. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0007/ + + +File: python.info, Node: Include Files, Next: Useful macros, Prev: Coding standards, Up: Introduction<13> + +7.1.2 Include Files +------------------- + +All function, type and macro definitions needed to use the Python/C API +are included in your code by the following line: + + #define PY_SSIZE_T_CLEAN + #include <Python.h> + +This implies inclusion of the following standard headers: ‘<stdio.h>’, +‘<string.h>’, ‘<errno.h>’, ‘<limits.h>’, ‘<assert.h>’ and ‘<stdlib.h>’ +(if available). + + Note: Since Python may define some pre-processor definitions which + affect the standard headers on some systems, you 'must' include + ‘Python.h’ before any standard headers are included. + + It is recommended to always define ‘PY_SSIZE_T_CLEAN’ before + including ‘Python.h’. See *note Parsing arguments and building + values: 8a7. for a description of this macro. + +All user visible names defined by Python.h (except those defined by the +included standard headers) have one of the prefixes ‘Py’ or ‘_Py’. +Names beginning with ‘_Py’ are for internal use by the Python +implementation and should not be used by extension writers. Structure +member names do not have a reserved prefix. + + Note: User code should never define names that begin with ‘Py’ or + ‘_Py’. This confuses the reader, and jeopardizes the portability + of the user code to future Python versions, which may define + additional names beginning with one of these prefixes. + +The header files are typically installed with Python. On Unix, these +are located in the directories ‘`prefix'/include/pythonversion/’ and +‘`exec_prefix'/include/pythonversion/’, where *note prefix: 1d62. and +*note exec_prefix: 1d63. are defined by the corresponding parameters to +Python’s ‘configure’ script and 'version' is ‘'%d.%d' % +sys.version_info[:2]’. On Windows, the headers are installed in +‘`prefix'/include’, where ‘prefix’ is the installation directory +specified to the installer. + +To include the headers, place both directories (if different) on your +compiler’s search path for includes. Do 'not' place the parent +directories on the search path and then use ‘#include +<pythonX.Y/Python.h>’; this will break on multi-platform builds since +the platform independent headers under *note prefix: 1d62. include the +platform specific headers from *note exec_prefix: 1d63. + +C++ users should note that although the API is defined entirely using C, +the header files properly declare the entry points to be ‘extern "C"’. +As a result, there is no need to do anything special to use the API from +C++. + + +File: python.info, Node: Useful macros, Next: Objects Types and Reference Counts, Prev: Include Files, Up: Introduction<13> + +7.1.3 Useful macros +------------------- + +Several useful macros are defined in the Python header files. Many are +defined closer to where they are useful (e.g. *note Py_RETURN_NONE: +143c.). Others of a more general utility are defined here. This is not +necessarily a complete listing. + + -- C Macro: PyMODINIT_FUNC + + Declare an extension module ‘PyInit’ initialization function. The + function return type is *note PyObject: 334.*. The macro declares + any special linkage declarations required by the platform, and for + C++ declares the function as ‘extern "C"’. + + The initialization function must be named ‘PyInit_NAME’, where + 'name' is the name of the module, and should be the only + non-‘static’ item defined in the module file. Example: + + static struct PyModuleDef spam_module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "spam", + ... + }; + + PyMODINIT_FUNC + PyInit_spam(void) + { + return PyModuleDef_Init(&spam_module); + } + + -- C Macro: Py_ABS (x) + + Return the absolute value of ‘x’. + + Added in version 3.3. + + -- C Macro: 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. + + 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: 1fb. (if the *note + Py_DEBUG: 4140. macro is defined), the *note Py_ALWAYS_INLINE: + 18b6. 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 Macro: Py_CHARMASK (c) + + Argument must be a character or an integer in the range [-128, 127] + or [0, 255]. This macro returns ‘c’ cast to an ‘unsigned char’. + + -- C Macro: Py_DEPRECATED (version) + + Use this for deprecated declarations. The macro must be placed + before the symbol name. + + Example: + + Py_DEPRECATED(3.8) PyAPI_FUNC(int) Py_OldFunction(void); + + Changed in version 3.8: MSVC support was added. + + -- C Macro: Py_GETENV (s) + + Like ‘getenv(s)’, but returns ‘NULL’ if *note -E: 95d. was passed + on the command line (see *note PyConfig.use_environment: 3d5.). + + -- C Macro: Py_MAX (x, y) + + Return the maximum value between ‘x’ and ‘y’. + + Added in version 3.3. + + -- C Macro: Py_MEMBER_SIZE (type, member) + + Return the size of a structure (‘type’) ‘member’ in bytes. + + Added in version 3.6. + + -- C Macro: Py_MIN (x, y) + + Return the minimum value between ‘x’ and ‘y’. + + Added in version 3.3. + + -- C Macro: 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)). + + Usage: + + Py_NO_INLINE static int random(void) { return 4; } + + Added in version 3.11. + + -- C Macro: Py_STRINGIFY (x) + + Convert ‘x’ to a C string. E.g. ‘Py_STRINGIFY(123)’ returns + ‘"123"’. + + Added in version 3.4. + + -- C Macro: 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. + + A use for ‘Py_UNREACHABLE()’ is following a call a function that + never returns but that is not declared ‘_Py_NO_RETURN’. + + 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(): 983. can be used. + + Added in version 3.7. + + -- C Macro: Py_UNUSED (arg) + + Use this for unused arguments in a function definition to silence + compiler warnings. Example: ‘int func(int a, int Py_UNUSED(b)) { + return a; }’. + + Added in version 3.4. + + -- C Macro: PyDoc_STRVAR (name, str) + + Creates a variable with name ‘name’ that can be used in docstrings. + If Python is built without docstrings, the value will be empty. + + Use *note PyDoc_STRVAR: 1971. for docstrings to support building + Python without docstrings, as specified in PEP 7(2). + + Example: + + PyDoc_STRVAR(pop_doc, "Remove and return the rightmost element."); + + static PyMethodDef deque_methods[] = { + // ... + {"pop", (PyCFunction)deque_pop, METH_NOARGS, pop_doc}, + // ... + } + + -- C Macro: PyDoc_STR (str) + + Creates a docstring for the given input string or an empty string + if docstrings are disabled. + + Use *note PyDoc_STR: 180a. in specifying docstrings to support + building Python without docstrings, as specified in PEP 7(3). + + Example: + + static PyMethodDef pysqlite_row_methods[] = { + {"keys", (PyCFunction)pysqlite_row_keys, METH_NOARGS, + PyDoc_STR("Returns the keys of the row.")}, + {NULL, NULL} + }; + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=33720 + + (2) https://peps.python.org/pep-0007/ + + (3) https://peps.python.org/pep-0007/ + + +File: python.info, Node: Objects Types and Reference Counts, Next: Exceptions<21>, Prev: Useful macros, Up: Introduction<13> + +7.1.4 Objects, Types and Reference Counts +----------------------------------------- + +Most Python/C API functions have one or more arguments as well as a +return value of type *note PyObject: 334.*. This type is a pointer to +an opaque data type representing an arbitrary Python object. Since all +Python object types are treated the same way by the Python language in +most situations (e.g., assignments, scope rules, and argument passing), +it is only fitting that they should be represented by a single C type. +Almost all Python objects live on the heap: you never declare an +automatic or static variable of type *note PyObject: 334, only pointer +variables of type *note PyObject: 334.* can be declared. The sole +exception are the type objects; since these must never be deallocated, +they are typically static *note PyTypeObject: aa5. objects. + +All Python objects (even Python integers) have a 'type' and a 'reference +count'. An object’s type determines what kind of object it is (e.g., an +integer, a list, or a user-defined function; there are many more as +explained in *note The standard type hierarchy: 1ee7.). For each of the +well-known types there is a macro to check whether an object is of that +type; for instance, ‘PyList_Check(a)’ is true if (and only if) the +object pointed to by 'a' is a Python list. + +* Menu: + +* Reference Counts: Reference Counts<2>. +* Types:: + + +File: python.info, Node: Reference Counts<2>, Next: Types, Up: Objects Types and Reference Counts + +7.1.4.1 Reference Counts +........................ + +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: 338. to an object. +Such a place could be another object, or a global (or static) C +variable, or a local variable in some C function. When the last *note +strong reference: 338. 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(): 56b. to take a new reference to an +object (i.e. increment its reference count by one), and *note +Py_DECREF(): 56c. to release that reference (i.e. decrement the +reference count by one). The *note Py_DECREF(): 56c. 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: 338. (i.e. +increment the reference count) for every local variable that contains a +pointer to an object. In theory, the object’s reference count goes up +by one when the variable is made to point to it and it goes down by one +when the variable goes out of scope. However, these two cancel each +other out, so at the end the reference count hasn’t changed. The only +real reason to use the reference count is to prevent the object from +being deallocated as long as our variable is pointing to it. If we know +that there is at least one other reference to the object that lives at +least as long as our variable, there is no need to take a new *note +strong reference: 338. (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(): 56c, 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: 338. (i.e. increment the reference count) of the object they +return. This leaves the caller with the responsibility to call *note +Py_DECREF(): 56c. when they are done with the result; this soon becomes +second nature. + +* Menu: + +* Reference Count Details:: + + +File: python.info, Node: Reference Count Details, Up: Reference Counts<2> + +7.1.4.2 Reference Count Details +............................... + +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(): 56c. or *note Py_XDECREF(): 78a. 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: 339. + +Conversely, when a calling function passes in a reference to an object, +there are two possibilities: the function 'steals' a reference to the +object, or it does not. 'Stealing a reference' means that when you pass +a reference to a function, that function assumes that it now owns that +reference, and you are not responsible for it any longer. + +Few functions steal references; the two notable exceptions are *note +PyList_SetItem(): 1577. and *note PyTuple_SetItem(): 48d3, which steal a +reference to the item (but not to the tuple or list into which the item +is put!). These functions were designed to steal a reference because of +a common idiom for populating a tuple or list with newly created +objects; for example, the code to create the tuple ‘(1, 2, "three")’ +could look like this (forgetting about error handling for the moment; a +better way to code this is shown below): + + 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")); + +Here, *note PyLong_FromLong(): 1839. returns a new reference which is +immediately stolen by *note PyTuple_SetItem(): 48d3. When you want to +keep using an object although the reference to it will be stolen, use +*note Py_INCREF(): 56b. to grab another reference before calling the +reference-stealing function. + +Incidentally, *note PyTuple_SetItem(): 48d3. is the 'only' way to set +tuple items; *note PySequence_SetItem(): 1a53. and *note +PyObject_SetItem(): 4947. refuse to do this since tuples are an +immutable data type. You should only use *note PyTuple_SetItem(): 48d3. +for tuples that you are creating yourself. + +Equivalent code for populating a list can be written using *note +PyList_New(): 4948. and *note PyList_SetItem(): 1577. + +However, in practice, you will rarely use these ways of creating and +populating a tuple or list. There’s a generic function, *note +Py_BuildValue(): 8a6, that can create most common objects from C values, +directed by a 'format string'. For example, the above two blocks of +code could be replaced by the following (which also takes care of the +error checking): + + 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(): 4947. 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; + } + +The situation is slightly different for function return values. While +passing a reference to most functions does not change your ownership +responsibilities for that reference, many functions that return a +reference to an object give you ownership of the reference. The reason +is simple: in many cases, the returned object is created on the fly, and +the reference you get is the only reference to the object. Therefore, +the generic functions that return object references, like *note +PyObject_GetItem(): 342. and *note PySequence_GetItem(): 1a52, always +return a new reference (the caller becomes the owner of the reference). + +It is important to realize that whether you own a reference returned by +a function depends on which function you call only — 'the plumage' (the +type of the object passed as an argument to the function) 'doesn’t enter +into it!' Thus, if you extract an item from a list using *note +PyList_GetItem(): 357, you don’t own the reference — but if you obtain +the same item from the same list using *note PySequence_GetItem(): 1a52. +(which happens to take exactly the same arguments), you do own a +reference to the returned object. + +Here is an example of how you could write a function that computes the +sum of the items in a list of integers; once using *note +PyList_GetItem(): 357, and once using *note PySequence_GetItem(): 1a52. + + 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: Types, Prev: Reference Counts<2>, Up: Objects Types and Reference Counts + +7.1.4.3 Types +............. + +There are few other data types that play a significant role in the +Python/C API; most are simple C types such as int, long, double and +char*. A few structure types are used to describe static tables used to +list the functions exported by a module or the data attributes of a new +object type, and another is used to describe the value of a complex +number. These will be discussed together with the functions that use +them. + + -- C Type: type Py_ssize_t + ' Part of the *note Stable ABI: 550.' 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: a5f. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0353/ + + +File: python.info, Node: Exceptions<21>, Next: Embedding Python<2>, Prev: Objects Types and Reference Counts, Up: Introduction<13> + +7.1.5 Exceptions +---------------- + +The Python programmer only needs to deal with exceptions if specific +error handling is required; unhandled exceptions are automatically +propagated to the caller, then to the caller’s caller, and so on, until +they reach the top-level interpreter, where they are reported to the +user accompanied by a stack traceback. + +For C programmers, however, error checking always has to be explicit. +All functions in the Python/C API can raise exceptions, unless an +explicit claim is made otherwise in a function’s documentation. In +general, when a function encounters an error, it sets an exception, +discards any object references that it owns, and returns an error +indicator. If not documented otherwise, this indicator is either ‘NULL’ +or ‘-1’, depending on the function’s return type. A few functions +return a Boolean true/false result, with false indicating an error. +Very few functions return no explicit error indicator or have an +ambiguous return value, and require explicit testing for errors with +*note PyErr_Occurred(): 18f1. These exceptions are always explicitly +documented. + +Exception state is maintained in per-thread storage (this is equivalent +to using global storage in an unthreaded application). A thread can be +in one of two states: an exception has occurred, or not. The function +*note PyErr_Occurred(): 18f1. can be used to check for this: it returns +a borrowed reference to the exception type object when an exception has +occurred, and ‘NULL’ otherwise. There are a number of functions to set +the exception state: *note PyErr_SetString(): 579. is the most common +(though not the most general) function to set the exception state, and +*note PyErr_Clear(): 102a. clears the exception state. + +The full exception state consists of three objects (all of which can be +‘NULL’): the exception type, the corresponding exception value, and the +traceback. These have the same meanings as the Python result of +‘sys.exc_info()’; however, they are not the same: the Python objects +represent the last exception being handled by a Python *note try: 6e4. … +*note except: 18b. statement, while the C level exception state only +exists while an exception is being passed on between C functions until +it reaches the Python bytecode interpreter’s main loop, which takes care +of transferring it to ‘sys.exc_info()’ and friends. + +Note that starting with Python 1.5, the preferred, thread-safe way to +access the exception state from Python code is to call the function +*note sys.exc_info(): 686, which returns the per-thread exception state +for Python code. Also, the semantics of both ways to access the +exception state have changed so that a function which catches an +exception will save and restore its thread’s exception state so as to +preserve the exception state of its caller. This prevents common bugs +in exception handling code caused by an innocent-looking function +overwriting the exception being handled; it also reduces the often +unwanted lifetime extension for objects that are referenced by the stack +frames in the traceback. + +As a general principle, a function that calls another function to +perform some task should check whether the called function raised an +exception, and if so, pass the exception state on to its caller. It +should discard any object references that it owns, and return an error +indicator, but it should 'not' set another exception — that would +overwrite the exception that was just raised, and lose important +information about the exact cause of the error. + +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 + +Here is the corresponding C code, in all its glory: + + 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 */ + } + +This example represents an endorsed use of the ‘goto’ statement in C! It +illustrates the use of *note PyErr_ExceptionMatches(): 494d. and *note +PyErr_Clear(): 102a. to handle specific exceptions, and the use of *note +Py_XDECREF(): 78a. to dispose of owned references that may be ‘NULL’ +(note the ‘'X'’ in the name; *note Py_DECREF(): 56c. would crash when +confronted with a ‘NULL’ reference). It is important that the variables +used to hold owned references are initialized to ‘NULL’ for this to +work; likewise, the proposed return value is initialized to ‘-1’ +(failure) and only set to success after the final call made is +successful. + + +File: python.info, Node: Embedding Python<2>, Next: Debugging Builds, Prev: Exceptions<21>, Up: Introduction<13> + +7.1.6 Embedding Python +---------------------- + +The one important task that only embedders (as opposed to extension +writers) of the Python interpreter have to worry about is the +initialization, and possibly the finalization, of the Python +interpreter. Most functionality of the interpreter can only be used +after the interpreter has been initialized. + +The basic initialization function is *note Py_Initialize(): 8ab. This +initializes the table of loaded modules, and creates the fundamental +modules *note builtins: 12, *note __main__: 1, and *note sys: d9. It +also initializes the module search path (‘sys.path’). + +*note Py_Initialize(): 8ab. 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: 3bf. and *note +PyConfig.parse_argv: 1928. must be set: see *note Python Initialization +Configuration: 3a3. + +On most systems (in particular, on Unix and Windows, although the +details are slightly different), *note Py_Initialize(): 8ab. calculates +the module search path based upon its best guess for the location of the +standard Python interpreter executable, assuming that the Python library +is found in a fixed location relative to the Python interpreter +executable. In particular, it looks for a directory named +‘lib/python`X.Y'’ relative to the parent directory where the executable +named ‘python’ is found on the shell command search path (the +environment variable ‘PATH’). + +For instance, if the Python executable is found in +‘/usr/local/bin/python’, it will assume that the libraries are in +‘/usr/local/lib/python`X.Y'’. (In fact, this particular path is also +the “fallback” location, used when no executable file named ‘python’ is +found along ‘PATH’.) The user can override this behavior by setting the +environment variable *note PYTHONHOME: 3b8, or insert additional +directories in front of the standard path by setting *note PYTHONPATH: +1016. + +The embedding application can steer the search by setting *note +PyConfig.program_name: 3c0. 'before' calling *note +Py_InitializeFromConfig(): 3c1. Note that *note PYTHONHOME: 3b8. still +overrides this and *note PYTHONPATH: 1016. is still inserted in front of +the standard path. An application that requires total control has to +provide its own implementation of *note Py_GetPath(): 3af, *note +Py_GetPrefix(): 3b1, *note Py_GetExecPrefix(): 3ad, and *note +Py_GetProgramFullPath(): 3b3. (all defined in ‘Modules/getpath.c’). + +Sometimes, it is desirable to “uninitialize” Python. For instance, the +application may want to start over (make another call to *note +Py_Initialize(): 8ab.) or the application is simply done with its use of +Python and wants to free memory allocated by Python. This can be +accomplished by calling *note Py_FinalizeEx(): d15. The function *note +Py_IsInitialized(): 4950. returns true if Python is currently in the +initialized state. More information about these functions is given in a +later chapter. Notice that *note Py_FinalizeEx(): d15. does 'not' free +all memory allocated by the Python interpreter, e.g. memory allocated +by extension modules currently cannot be released. + + +File: python.info, Node: Debugging Builds, Next: Recommended third party tools<2>, Prev: Embedding Python<2>, Up: Introduction<13> + +7.1.7 Debugging Builds +---------------------- + +Python can be built with several macros to enable extra checks of the +interpreter and extension modules. These checks tend to add a large +amount of overhead to the runtime so they are not enabled by default. + +A full list of the various types of debugging builds is in the file +‘Misc/SpecialBuilds.txt’ in the Python source distribution. Builds are +available that support tracing of reference counts, debugging the memory +allocator, or low-level profiling of the main interpreter loop. Only +the most frequently used builds will be described in the remainder of +this section. + + -- C Macro: Py_DEBUG + +Compiling the interpreter with the ‘Py_DEBUG’ macro defined produces +what is generally meant by *note a debug build of Python: 1fb. +‘Py_DEBUG’ is enabled in the Unix build by adding *note -with-pydebug: +420. to the ‘./configure’ command. It is also implied by the presence +of the not-Python-specific ‘_DEBUG’ macro. When ‘Py_DEBUG’ is enabled +in the Unix build, compiler optimization is disabled. + +In addition to the reference count debugging described below, extra +checks are performed, see *note Python Debug Build: 1fb. + +Defining ‘Py_TRACE_REFS’ enables reference tracing (see the *note +configure -with-trace-refs option: 390.). When defined, a circular +doubly linked list of active objects is maintained by adding two extra +fields to every *note PyObject: 334. Total allocations are tracked as +well. Upon exit, all existing references are printed. (In interactive +mode this happens after every statement run by the interpreter.) + +Please refer to ‘Misc/SpecialBuilds.txt’ in the Python source +distribution for more detailed information. + + +File: python.info, Node: Recommended third party tools<2>, Prev: Debugging Builds, Up: Introduction<13> + +7.1.8 Recommended third party tools +----------------------------------- + +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. + +See also +........ + +Python Packaging User Guide: Binary Extensions(9) + + The Python Packaging User Guide not only covers several available + tools that simplify the creation of binary extensions, but also + discusses the various reasons why creating an extension module may + be desirable in the first place. + + ---------- Footnotes ---------- + + (1) https://cython.org/ + + (2) https://cffi.readthedocs.io + + (3) https://hpyproject.org/ + + (4) https://github.com/wjakob/nanobind + + (5) https://numba.pydata.org/ + + (6) https://pybind11.readthedocs.io/ + + (7) https://pyo3.rs/ + + (8) https://www.swig.org + + (9) https://packaging.python.org/guides/packaging-binary-extensions/ + + +File: python.info, Node: C API Stability, Next: The Very High Level Layer, Prev: Introduction<13>, Up: Python/C API Reference Manual + +7.2 C API Stability +=================== + +Unless documented otherwise, Python’s C API is covered by the Backwards +Compatibility Policy, PEP 387(1). Most changes to it are +source-compatible (typically by only adding new API). Changing existing +API or removing API is only done after a deprecation period or to fix +serious issues. + +CPython’s Application Binary Interface (ABI) is forward- and +backwards-compatible across a minor release (if these are compiled the +same way; see *note Platform Considerations: 4956. 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: 544, may change in minor versions without a + deprecation period. It is marked by the ‘PyUnstable’ prefix in + names. + + - *note Limited API: 391, is compatible across several minor + releases. When *note Py_LIMITED_API: 41a. is defined, only this + subset is exposed from ‘Python.h’. + +These are discussed in more detail below. + +Names prefixed by an underscore, such as ‘_Py_InternalState’, are +private API that can change without notice even in patch releases. If +you need to use this API, consider reaching out to CPython developers(2) +to discuss adding public API for your use case. + +* Menu: + +* Unstable C API:: +* Stable Application Binary Interface:: +* Platform Considerations:: +* Contents of Limited API:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0387/ + + (2) https://discuss.python.org/c/core-dev/c-api/30 + + +File: python.info, Node: Unstable C API, Next: Stable Application Binary Interface, Up: C API Stability + +7.2.1 Unstable C API +-------------------- + +Any API named with the ‘PyUnstable’ prefix exposes CPython +implementation details, and may change in every minor release (e.g. +from 3.9 to 3.10) without any deprecation warnings. However, it will +not change in a bugfix release (e.g. from 3.10.0 to 3.10.1). + +It is generally intended for specialized, low-level tools like +debuggers. + +Projects that use this API are expected to follow CPython development +and spend extra effort adjusting to changes. + + +File: python.info, Node: Stable Application Binary Interface, Next: Platform Considerations, Prev: Unstable C API, Up: C API Stability + +7.2.2 Stable Application Binary Interface +----------------------------------------- + +For simplicity, this document talks about 'extensions', but the Limited +API and Stable ABI work the same way for all uses of the API – for +example, embedding Python. + +* Menu: + +* Limited C API:: +* Stable ABI:: +* Limited API Scope and Performance:: +* Limited API Caveats:: + + +File: python.info, Node: Limited C API, Next: Stable ABI, Up: Stable Application Binary Interface + +7.2.2.1 Limited C API +..................... + +Python 3.2 introduced the 'Limited API', a subset of Python’s C API. +Extensions that only use the Limited API can be compiled once and be +loaded on multiple versions of Python. Contents of the Limited API are +*note listed below: 795. + + -- C Macro: Py_LIMITED_API + + Define this macro before including ‘Python.h’ to opt in to only use + the Limited API, and to select the Limited API version. + + Define ‘Py_LIMITED_API’ to the value of *note PY_VERSION_HEX: 752. + corresponding to the lowest Python version your extension supports. + The extension will be ABI-compatible with all Python 3 releases + from the specified one onward, and can use Limited API introduced + up to that version. + + Rather than using the ‘PY_VERSION_HEX’ macro directly, hardcode a + minimum minor version (e.g. ‘0x030A0000’ for Python 3.10) for + stability when compiling with future Python versions. + + You can also define ‘Py_LIMITED_API’ to ‘3’. This works the same + as ‘0x03020000’ (Python 3.2, the version that introduced Limited + API). + + +File: python.info, Node: Stable ABI, Next: Limited API Scope and Performance, Prev: Limited C API, Up: Stable Application Binary Interface + +7.2.2.2 Stable ABI +.................. + +To enable this, Python provides a 'Stable ABI': a set of symbols that +will remain ABI-compatible across Python 3.x versions. + + Note: The Stable ABI prevents ABI issues, like linker errors due to + missing symbols or data corruption due to changes in structure + layouts or function signatures. However, other changes in Python + can change the 'behavior' of extensions. See Python’s Backwards + Compatibility Policy ( PEP 387(1)) for details. + +The Stable ABI contains symbols exposed in the *note Limited API: 391, +but also other ones – for example, functions necessary to support older +versions of the Limited API. + +On Windows, extensions that use the Stable ABI should be linked against +‘python3.dll’ rather than a version-specific library such as +‘python39.dll’. + +On some platforms, Python will look for and load shared library files +named with the ‘abi3’ tag (e.g. ‘mymodule.abi3.so’). It does not check +if such extensions conform to a Stable ABI. The user (or their packaging +tools) need to ensure that, for example, extensions built with the 3.10+ +Limited API are not installed for lower versions of Python. + +All functions in the Stable ABI are present as functions in Python’s +shared library, not solely as macros. This makes them usable from +languages that don’t use the C preprocessor. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0387/ + + +File: python.info, Node: Limited API Scope and Performance, Next: Limited API Caveats, Prev: Stable ABI, Up: Stable Application Binary Interface + +7.2.2.3 Limited API Scope and Performance +......................................... + +The goal for the Limited API is to allow everything that is possible +with the full C API, but possibly with a performance penalty. + +For example, while *note PyList_GetItem(): 357. is available, its +“unsafe” macro variant *note PyList_GET_ITEM(): 495d. is not. The macro +can be faster because it can rely on version-specific implementation +details of the list object. + +Without ‘Py_LIMITED_API’ defined, some C API functions are inlined or +replaced by macros. Defining ‘Py_LIMITED_API’ disables this inlining, +allowing stability as Python’s data structures are improved, but +possibly reducing performance. + +By leaving out the ‘Py_LIMITED_API’ definition, it is possible to +compile a Limited API extension with a version-specific ABI. This can +improve performance for that Python version, but will limit +compatibility. Compiling with ‘Py_LIMITED_API’ will then yield an +extension that can be distributed where a version-specific one is not +available – for example, for prereleases of an upcoming Python version. + + +File: python.info, Node: Limited API Caveats, Prev: Limited API Scope and Performance, Up: Stable Application Binary Interface + +7.2.2.4 Limited API Caveats +........................... + +Note that compiling with ‘Py_LIMITED_API’ is 'not' a complete guarantee +that code conforms to the *note Limited API: 391. or the *note Stable +ABI: 495b. ‘Py_LIMITED_API’ only covers definitions, but an API also +includes other issues, such as expected semantics. + +One issue that ‘Py_LIMITED_API’ does not guard against is calling a +function with arguments that are invalid in a lower Python version. For +example, consider a function that starts accepting ‘NULL’ for an +argument. In Python 3.9, ‘NULL’ now selects a default behavior, but in +Python 3.8, the argument will be used directly, causing a ‘NULL’ +dereference and crash. A similar argument works for fields of structs. + +Another issue is that some struct fields are currently not hidden when +‘Py_LIMITED_API’ is defined, even though they’re part of the Limited +API. + +For these reasons, we recommend testing an extension with 'all' minor +Python versions it supports, and preferably to build with the 'lowest' +such version. + +We also recommend reviewing documentation of all used API to check if it +is explicitly part of the Limited API. Even with ‘Py_LIMITED_API’ +defined, a few private declarations are exposed for technical reasons +(or even unintentionally, as bugs). + +Also note that the Limited API is not necessarily stable: compiling with +‘Py_LIMITED_API’ with Python 3.8 means that the extension will run with +Python 3.12, but it will not necessarily 'compile' with Python 3.12. In +particular, parts of the Limited API may be deprecated and removed, +provided that the Stable ABI stays stable. + + +File: python.info, Node: Platform Considerations, Next: Contents of Limited API, Prev: Stable Application Binary Interface, Up: C API Stability + +7.2.3 Platform Considerations +----------------------------- + +ABI stability depends not only on Python, but also on the compiler used, +lower-level libraries and compiler options. For the purposes of the +*note Stable ABI: 495b, these details define a “platform”. They usually +depend on the OS type and processor architecture + +It is the responsibility of each particular distributor of Python to +ensure that all Python versions on a particular platform are built in a +way that does not break the Stable ABI. This is the case with Windows +and macOS releases from ‘python.org’ and many third-party distributors. + + +File: python.info, Node: Contents of Limited API, Prev: Platform Considerations, Up: C API Stability + +7.2.4 Contents of Limited API +----------------------------- + +Currently, the *note Limited API: 391. includes the following items: + + * *note PY_VECTORCALL_ARGUMENTS_OFFSET: 55b. + + * *note PyAIter_Check(): 4961. + + * *note PyArg_Parse(): 19e3. + + * *note PyArg_ParseTuple(): 56e. + + * *note PyArg_ParseTupleAndKeywords(): 37e. + + * *note PyArg_UnpackTuple(): 14d2. + + * *note PyArg_VaParse(): 4962. + + * *note PyArg_VaParseTupleAndKeywords(): 37f. + + * *note PyArg_ValidateKeywordArguments(): 4963. + + * *note PyBaseObject_Type: 4964. + + * *note PyBool_FromLong(): 4965. + + * *note PyBool_Type: 4966. + + * *note PyBuffer_FillContiguousStrides(): 75a. + + * *note PyBuffer_FillInfo(): 75b. + + * *note PyBuffer_FromContiguous(): 757. + + * *note PyBuffer_GetPointer(): 754. + + * *note PyBuffer_IsContiguous(): 759. + + * *note PyBuffer_Release(): 396. + + * *note PyBuffer_SizeFromFormat(): 755. + + * *note PyBuffer_ToContiguous(): 756. + + * ‘PyByteArrayIter_Type’ + + * *note PyByteArray_AsString(): 4967. + + * *note PyByteArray_Concat(): 4968. + + * *note PyByteArray_FromObject(): 1382. + + * *note PyByteArray_FromStringAndSize(): 1383. + + * *note PyByteArray_Resize(): 4969. + + * *note PyByteArray_Size(): 496a. + + * *note PyByteArray_Type: 496b. + + * ‘PyBytesIter_Type’ + + * *note PyBytes_AsString(): 885. + + * *note PyBytes_AsStringAndSize(): 496c. + + * *note PyBytes_Concat(): 496d. + + * *note PyBytes_ConcatAndDel(): 496e. + + * ‘PyBytes_DecodeEscape()’ + + * *note PyBytes_FromFormat(): 1a28. + + * *note PyBytes_FromFormatV(): 496f. + + * *note PyBytes_FromObject(): 4970. + + * *note PyBytes_FromString(): 4971. + + * *note PyBytes_FromStringAndSize(): 1381. + + * ‘PyBytes_Repr()’ + + * *note PyBytes_Size(): 4972. + + * *note PyBytes_Type: 4973. + + * *note PyCFunction: 1440. + + * *note PyCFunctionFast: 4974. + + * *note PyCFunctionFastWithKeywords: 4975. + + * *note PyCFunctionWithKeywords: 4976. + + * ‘PyCFunction_GetFlags()’ + + * ‘PyCFunction_GetFunction()’ + + * ‘PyCFunction_GetSelf()’ + + * *note PyCFunction_New(): 18f3. + + * *note PyCFunction_NewEx(): 198c. + + * ‘PyCFunction_Type’ + + * *note PyCMethod_New(): 18ed. + + * *note PyCallIter_New(): 4977. + + * *note PyCallIter_Type: 4978. + + * *note PyCallable_Check(): 4979. + + * *note PyCapsule_Destructor: 497a. + + * *note PyCapsule_GetContext(): 497b. + + * *note PyCapsule_GetDestructor(): 497c. + + * *note PyCapsule_GetName(): 497d. + + * *note PyCapsule_GetPointer(): 497e. + + * *note PyCapsule_Import(): 186d. + + * *note PyCapsule_IsValid(): 1348. + + * *note PyCapsule_New(): 48dd. + + * *note PyCapsule_SetContext(): 497f. + + * *note PyCapsule_SetDestructor(): 4980. + + * *note PyCapsule_SetName(): 4981. + + * *note PyCapsule_SetPointer(): 4982. + + * ‘PyCapsule_Type’ + + * ‘PyClassMethodDescr_Type’ + + * *note PyCodec_BackslashReplaceErrors(): 4983. + + * *note PyCodec_Decode(): 3fb. + + * *note PyCodec_Decoder(): 4984. + + * *note PyCodec_Encode(): 3fc. + + * *note PyCodec_Encoder(): 4985. + + * *note PyCodec_IgnoreErrors(): 4986. + + * *note PyCodec_IncrementalDecoder(): 4987. + + * *note PyCodec_IncrementalEncoder(): 4988. + + * *note PyCodec_KnownEncoding(): 4989. + + * *note PyCodec_LookupError(): 498a. + + * *note PyCodec_NameReplaceErrors(): ea8. + + * *note PyCodec_Register(): 498b. + + * *note PyCodec_RegisterError(): 498c. + + * *note PyCodec_ReplaceErrors(): 498d. + + * *note PyCodec_StreamReader(): 498e. + + * *note PyCodec_StreamWriter(): 498f. + + * *note PyCodec_StrictErrors(): 4990. + + * *note PyCodec_Unregister(): 895. + + * *note PyCodec_XMLCharRefReplaceErrors(): 4991. + + * *note PyComplex_FromDoubles(): 4992. + + * *note PyComplex_ImagAsDouble(): 1698. + + * *note PyComplex_RealAsDouble(): 1697. + + * *note PyComplex_Type: 4993. + + * *note PyDescr_NewClassMethod(): 4994. + + * *note PyDescr_NewGetSet(): 4995. + + * *note PyDescr_NewMember(): 4996. + + * *note PyDescr_NewMethod(): 198b. + + * ‘PyDictItems_Type’ + + * ‘PyDictIterItem_Type’ + + * ‘PyDictIterKey_Type’ + + * ‘PyDictIterValue_Type’ + + * ‘PyDictKeys_Type’ + + * *note PyDictProxy_New(): 4997. + + * ‘PyDictProxy_Type’ + + * ‘PyDictRevIterItem_Type’ + + * ‘PyDictRevIterKey_Type’ + + * ‘PyDictRevIterValue_Type’ + + * ‘PyDictValues_Type’ + + * *note PyDict_Clear(): 4998. + + * *note PyDict_Contains(): 333. + + * *note PyDict_Copy(): 41c. + + * *note PyDict_DelItem(): 4999. + + * *note PyDict_DelItemString(): 499a. + + * *note PyDict_GetItem(): 382. + + * *note PyDict_GetItemRef(): 335. + + * *note PyDict_GetItemString(): 383. + + * *note PyDict_GetItemStringRef(): 336. + + * *note PyDict_GetItemWithError(): 337. + + * *note PyDict_Items(): 499b. + + * *note PyDict_Keys(): 499c. + + * *note PyDict_Merge(): 499d. + + * *note PyDict_MergeFromSeq2(): 499e. + + * *note PyDict_New(): 499f. + + * *note PyDict_Next(): 1612. + + * *note PyDict_SetItem(): 48d4. + + * *note PyDict_SetItemString(): 1601. + + * *note PyDict_Size(): 49a0. + + * *note PyDict_Type: 49a1. + + * *note PyDict_Update(): 49a2. + + * *note PyDict_Values(): 49a3. + + * *note PyEllipsis_Type: 49a4. + + * ‘PyEnum_Type’ + + * *note PyErr_BadArgument(): 49a5. + + * *note PyErr_BadInternalCall(): 49a6. + + * *note PyErr_CheckSignals(): 462. + + * *note PyErr_Clear(): 102a. + + * ‘PyErr_Display()’ + + * *note PyErr_DisplayException(): 3fe. + + * *note PyErr_ExceptionMatches(): 494d. + + * *note PyErr_Fetch(): 3ef. + + * *note PyErr_Format(): eaa. + + * *note PyErr_FormatV(): ea9. + + * *note PyErr_GetExcInfo(): 76d. + + * *note PyErr_GetHandledException(): 76a. + + * *note PyErr_GetRaisedException(): 3f0. + + * *note PyErr_GivenExceptionMatches(): 49a7. + + * *note PyErr_NewException(): 125d. + + * *note PyErr_NewExceptionWithDoc(): 125c. + + * *note PyErr_NoMemory(): 48b3. + + * *note PyErr_NormalizeException(): 3f1. + + * *note PyErr_Occurred(): 18f1. + + * *note PyErr_Print(): 1945. + + * *note PyErr_PrintEx(): 49a8. + + * ‘PyErr_ProgramText()’ + + * *note PyErr_ResourceWarning(): d17. + + * *note PyErr_Restore(): 3f2. + + * *note PyErr_SetExcFromWindowsErr(): 49a9. + + * *note PyErr_SetExcFromWindowsErrWithFilename(): 1718. + + * *note PyErr_SetExcFromWindowsErrWithFilenameObject(): 49aa. + + * *note PyErr_SetExcFromWindowsErrWithFilenameObjects(): 49ab. + + * *note PyErr_SetExcInfo(): 76c. + + * *note PyErr_SetFromErrno(): 48b2. + + * *note PyErr_SetFromErrnoWithFilename(): 1717. + + * *note PyErr_SetFromErrnoWithFilenameObject(): 49ac. + + * *note PyErr_SetFromErrnoWithFilenameObjects(): 49ad. + + * *note PyErr_SetFromWindowsErr(): 49ae. + + * *note PyErr_SetFromWindowsErrWithFilename(): 1719. + + * *note PyErr_SetHandledException(): 76b. + + * *note PyErr_SetImportError(): d3e. + + * *note PyErr_SetImportErrorSubclass(): d16. + + * *note PyErr_SetInterrupt(): 49af. + + * *note PyErr_SetInterruptEx(): 89c. + + * *note PyErr_SetNone(): 49b0. + + * *note PyErr_SetObject(): 578. + + * *note PyErr_SetRaisedException(): 3f3. + + * *note PyErr_SetString(): 579. + + * *note PyErr_SyntaxLocation(): 49b1. + + * *note PyErr_SyntaxLocationEx(): 49b2. + + * *note PyErr_WarnEx(): 1416. + + * *note PyErr_WarnExplicit(): 171f. + + * *note PyErr_WarnFormat(): 49b3. + + * *note PyErr_WriteUnraisable(): 34a. + + * *note PyEval_AcquireThread(): 3a6. + + * *note PyEval_EvalCode(): 884. + + * *note PyEval_EvalCodeEx(): 1769. + + * *note PyEval_EvalFrame(): 49b4. + + * *note PyEval_EvalFrameEx(): 1027. + + * *note PyEval_GetBuiltins(): 34c. + + * *note PyEval_GetFrame(): 17bc. + + * *note PyEval_GetFrameBuiltins(): 34b. + + * *note PyEval_GetFrameGlobals(): 34d. + + * *note PyEval_GetFrameLocals(): 34f. + + * *note PyEval_GetFuncDesc(): 49b5. + + * *note PyEval_GetFuncName(): 49b6. + + * *note PyEval_GetGlobals(): 34e. + + * *note PyEval_GetLocals(): 350. + + * *note PyEval_InitThreads(): 1641. + + * *note PyEval_ReleaseThread(): 49b7. + + * *note PyEval_RestoreThread(): 3a5. + + * *note PyEval_SaveThread(): 3a4. + + * *note PyExc_ArithmeticError: 49b8. + + * *note PyExc_AssertionError: 49b9. + + * *note PyExc_AttributeError: 49ba. + + * *note PyExc_BaseException: 49bb. + + * *note PyExc_BaseExceptionGroup: 49bc. + + * *note PyExc_BlockingIOError: 49bd. + + * *note PyExc_BrokenPipeError: 49be. + + * *note PyExc_BufferError: 49bf. + + * *note PyExc_BytesWarning: 49c0. + + * *note PyExc_ChildProcessError: 49c1. + + * *note PyExc_ConnectionAbortedError: 49c2. + + * *note PyExc_ConnectionError: 49c3. + + * *note PyExc_ConnectionRefusedError: 49c4. + + * *note PyExc_ConnectionResetError: 49c5. + + * *note PyExc_DeprecationWarning: 49c6. + + * *note PyExc_EOFError: 49c7. + + * *note PyExc_EncodingWarning: 49c8. + + * *note PyExc_EnvironmentError: 49c9. + + * *note PyExc_Exception: 49ca. + + * *note PyExc_FileExistsError: 49cb. + + * *note PyExc_FileNotFoundError: 49cc. + + * *note PyExc_FloatingPointError: 49cd. + + * *note PyExc_FutureWarning: 49ce. + + * *note PyExc_GeneratorExit: 49cf. + + * *note PyExc_IOError: 49d0. + + * *note PyExc_ImportError: 49d1. + + * *note PyExc_ImportWarning: 49d2. + + * *note PyExc_IndentationError: 49d3. + + * *note PyExc_IndexError: 49d4. + + * *note PyExc_InterruptedError: 49d5. + + * *note PyExc_IsADirectoryError: 49d6. + + * *note PyExc_KeyError: 49d7. + + * *note PyExc_KeyboardInterrupt: 49d8. + + * *note PyExc_LookupError: 49d9. + + * *note PyExc_MemoryError: 49da. + + * *note PyExc_ModuleNotFoundError: 49db. + + * *note PyExc_NameError: 49dc. + + * *note PyExc_NotADirectoryError: 49dd. + + * *note PyExc_NotImplementedError: 49de. + + * *note PyExc_OSError: 48b5. + + * *note PyExc_OverflowError: 49df. + + * *note PyExc_PendingDeprecationWarning: 49e0. + + * *note PyExc_PermissionError: 49e1. + + * *note PyExc_ProcessLookupError: 49e2. + + * *note PyExc_RecursionError: eab. + + * *note PyExc_ReferenceError: 49e3. + + * *note PyExc_ResourceWarning: 49e4. + + * *note PyExc_RuntimeError: 49e5. + + * *note PyExc_RuntimeWarning: 49e6. + + * *note PyExc_StopAsyncIteration: 49e7. + + * *note PyExc_StopIteration: 49e8. + + * *note PyExc_SyntaxError: 49e9. + + * *note PyExc_SyntaxWarning: 49ea. + + * *note PyExc_SystemError: 49eb. + + * *note PyExc_SystemExit: 49ec. + + * *note PyExc_TabError: 49ed. + + * *note PyExc_TimeoutError: 49ee. + + * *note PyExc_TypeError: 48b4. + + * *note PyExc_UnboundLocalError: 49ef. + + * *note PyExc_UnicodeDecodeError: 49f0. + + * *note PyExc_UnicodeEncodeError: 49f1. + + * *note PyExc_UnicodeError: 49f2. + + * *note PyExc_UnicodeTranslateError: 49f3. + + * *note PyExc_UnicodeWarning: 49f4. + + * *note PyExc_UserWarning: 49f5. + + * *note PyExc_ValueError: 48b6. + + * *note PyExc_Warning: 49f6. + + * *note PyExc_WindowsError: 49f7. + + * *note PyExc_ZeroDivisionError: 48b1. + + * *note PyExceptionClass_Name(): a65. + + * *note PyException_GetArgs(): 567. + + * *note PyException_GetCause(): 49f8. + + * *note PyException_GetContext(): 49f9. + + * *note PyException_GetTraceback(): 49fa. + + * *note PyException_SetArgs(): 568. + + * *note PyException_SetCause(): 49fb. + + * *note PyException_SetContext(): 49fc. + + * *note PyException_SetTraceback(): 19e9. + + * *note PyFile_FromFd(): 49fd. + + * *note PyFile_GetLine(): 49fe. + + * *note PyFile_WriteObject(): 49ff. + + * *note PyFile_WriteString(): 4a00. + + * ‘PyFilter_Type’ + + * *note PyFloat_AsDouble(): a69. + + * *note PyFloat_FromDouble(): 4a01. + + * *note PyFloat_FromString(): 4a02. + + * *note PyFloat_GetInfo(): 13bc. + + * *note PyFloat_GetMax(): 13ba. + + * *note PyFloat_GetMin(): 13bb. + + * *note PyFloat_Type: 4a03. + + * *note PyFrameObject: 784. + + * *note PyFrame_GetCode(): 785. + + * *note PyFrame_GetLineNumber(): 786. + + * *note PyFrozenSet_New(): 1411. + + * *note PyFrozenSet_Type: 4a04. + + * *note PyGC_Collect(): 98e. + + * *note PyGC_Disable(): 8a3. + + * *note PyGC_Enable(): 8a2. + + * *note PyGC_IsEnabled(): 8a4. + + * *note PyGILState_Ensure(): 3a7. + + * *note PyGILState_GetThisThreadState(): 4a05. + + * *note PyGILState_Release(): 3a8. + + * ‘PyGILState_STATE’ + + * *note PyGetSetDef: bb8. + + * ‘PyGetSetDescr_Type’ + + * *note PyImport_AddModule(): 354. + + * *note PyImport_AddModuleObject(): 4a06. + + * *note PyImport_AddModuleRef(): 353. + + * *note PyImport_AppendInittab(): 17a3. + + * *note PyImport_ExecCodeModule(): 4a07. + + * *note PyImport_ExecCodeModuleEx(): 4a08. + + * *note PyImport_ExecCodeModuleObject(): 4a09. + + * *note PyImport_ExecCodeModuleWithPathnames(): 4a0a. + + * *note PyImport_GetImporter(): 1716. + + * *note PyImport_GetMagicNumber(): 1196. + + * *note PyImport_GetMagicTag(): 4a0b. + + * *note PyImport_GetModule(): bb3. + + * *note PyImport_GetModuleDict(): 4a0c. + + * *note PyImport_Import(): 13c8. + + * *note PyImport_ImportFrozenModule(): 4a0d. + + * *note PyImport_ImportFrozenModuleObject(): 4a0e. + + * *note PyImport_ImportModule(): 3ba. + + * *note PyImport_ImportModuleLevel(): 1197. + + * *note PyImport_ImportModuleLevelObject(): 4a0f. + + * *note PyImport_ImportModuleNoBlock(): 3b9. + + * *note PyImport_ReloadModule(): 4a10. + + * *note PyIndex_Check(): 98a. + + * *note PyInterpreterState: 8bc. + + * *note PyInterpreterState_Clear(): 41e4. + + * *note PyInterpreterState_Delete(): 4a11. + + * *note PyInterpreterState_Get(): 3a9. + + * *note PyInterpreterState_GetDict(): 4a12. + + * *note PyInterpreterState_GetID(): bc6. + + * *note PyInterpreterState_New(): 41e5. + + * *note PyIter_Check(): 18f4. + + * *note PyIter_Next(): 4a13. + + * *note PyIter_Send(): 896. + + * ‘PyListIter_Type’ + + * ‘PyListRevIter_Type’ + + * *note PyList_Append(): 4a14. + + * *note PyList_AsTuple(): 4a15. + + * *note PyList_GetItem(): 357. + + * *note PyList_GetItemRef(): 356. + + * *note PyList_GetSlice(): 4a16. + + * *note PyList_Insert(): 1575. + + * *note PyList_New(): 4948. + + * *note PyList_Reverse(): 4a17. + + * *note PyList_SetItem(): 1577. + + * *note PyList_SetSlice(): 4a18. + + * *note PyList_Size(): 13e5. + + * *note PyList_Sort(): 4a19. + + * *note PyList_Type: 48f5. + + * *note PyLongObject: 585. + + * ‘PyLongRangeIter_Type’ + + * *note PyLong_AsDouble(): 4a1a. + + * *note PyLong_AsInt(): 35a. + + * *note PyLong_AsLong(): 35b. + + * *note PyLong_AsLongAndOverflow(): 125a. + + * *note PyLong_AsLongLong(): 4a1b. + + * *note PyLong_AsLongLongAndOverflow(): 1259. + + * *note PyLong_AsSize_t(): 4a1c. + + * *note PyLong_AsSsize_t(): 4a1d. + + * *note PyLong_AsUnsignedLong(): 4a1e. + + * *note PyLong_AsUnsignedLongLong(): 1287. + + * *note PyLong_AsUnsignedLongLongMask(): 19e5. + + * *note PyLong_AsUnsignedLongMask(): 4a1f. + + * *note PyLong_AsVoidPtr(): 4a20. + + * *note PyLong_FromDouble(): 942. + + * *note PyLong_FromLong(): 1839. + + * *note PyLong_FromLongLong(): 183a. + + * *note PyLong_FromSize_t(): 19c2. + + * *note PyLong_FromSsize_t(): 4a21. + + * *note PyLong_FromString(): 4a22. + + * *note PyLong_FromUnsignedLong(): 19c0. + + * *note PyLong_FromUnsignedLongLong(): 19c1. + + * *note PyLong_FromVoidPtr(): 4a23. + + * *note PyLong_GetInfo(): 4a24. + + * *note PyLong_Type: 4a25. + + * ‘PyMap_Type’ + + * *note PyMapping_Check(): 4a26. + + * *note PyMapping_GetItemString(): 343. + + * *note PyMapping_GetOptionalItem(): 340. + + * *note PyMapping_GetOptionalItemString(): 341. + + * *note PyMapping_HasKey(): 37a. + + * *note PyMapping_HasKeyString(): 37c. + + * *note PyMapping_HasKeyStringWithError(): 37b. + + * *note PyMapping_HasKeyWithError(): 379. + + * *note PyMapping_Items(): bbe. + + * *note PyMapping_Keys(): bbc. + + * *note PyMapping_Length(): 4a27. + + * *note PyMapping_SetItemString(): 4a28. + + * *note PyMapping_Size(): 1a55. + + * *note PyMapping_Values(): bbd. + + * *note PyMem_Calloc(): ea6. + + * *note PyMem_Free(): 140e. + + * *note PyMem_Malloc(): c66. + + * *note PyMem_RawCalloc(): 38c. + + * *note PyMem_RawFree(): 38e. + + * *note PyMem_RawMalloc(): 38b. + + * *note PyMem_RawRealloc(): 38d. + + * *note PyMem_Realloc(): 102b. + + * *note PyMemberDef: 54c. + + * ‘PyMemberDescr_Type’ + + * *note PyMember_GetOne(): 58a. + + * *note PyMember_SetOne(): 58b. + + * *note PyMemoryView_FromBuffer(): 75c. + + * *note PyMemoryView_FromMemory(): 1164. + + * *note PyMemoryView_FromObject(): 4a29. + + * *note PyMemoryView_GetContiguous(): 4a2a. + + * ‘PyMemoryView_Type’ + + * *note PyMethodDef: 14a2. + + * ‘PyMethodDescr_Type’ + + * *note PyModuleDef: 97d. + + * ‘PyModuleDef_Base’ + + * *note PyModuleDef_Init(): 48bd. + + * ‘PyModuleDef_Type’ + + * *note PyModule_Add(): 35f. + + * *note PyModule_AddFunctions(): 4a2b. + + * *note PyModule_AddIntConstant(): 1506. + + * *note PyModule_AddObject(): 361. + + * *note PyModule_AddObjectRef(): 360. + + * *note PyModule_AddStringConstant(): 1507. + + * *note PyModule_AddType(): 975. + + * *note PyModule_Create2(): 4a2c. + + * *note PyModule_ExecDef(): eae. + + * *note PyModule_FromDefAndSpec2(): ead. + + * *note PyModule_GetDef(): 4a2d. + + * *note PyModule_GetDict(): 4a2e. + + * *note PyModule_GetFilename(): 3f4. + + * *note PyModule_GetFilenameObject(): 3f5. + + * *note PyModule_GetName(): 4a2f. + + * *note PyModule_GetNameObject(): 4a30. + + * *note PyModule_GetState(): 980. + + * *note PyModule_New(): 4a31. + + * *note PyModule_NewObject(): 4a32. + + * *note PyModule_SetDocString(): 4a33. + + * *note PyModule_Type: 4a34. + + * *note PyNumber_Absolute(): 4a35. + + * *note PyNumber_Add(): 4a36. + + * *note PyNumber_And(): 4a37. + + * *note PyNumber_AsSsize_t(): 4a38. + + * *note PyNumber_Check(): a66. + + * *note PyNumber_Divmod(): 4a39. + + * *note PyNumber_Float(): a68. + + * *note PyNumber_FloorDivide(): 4a3a. + + * *note PyNumber_InPlaceAdd(): 4a3b. + + * *note PyNumber_InPlaceAnd(): 4a3c. + + * *note PyNumber_InPlaceFloorDivide(): 4a3d. + + * *note PyNumber_InPlaceLshift(): 4a3e. + + * *note PyNumber_InPlaceMatrixMultiply(): eb0. + + * *note PyNumber_InPlaceMultiply(): 4a3f. + + * *note PyNumber_InPlaceOr(): 4a40. + + * *note PyNumber_InPlacePower(): 4a41. + + * *note PyNumber_InPlaceRemainder(): 4a42. + + * *note PyNumber_InPlaceRshift(): 4a43. + + * *note PyNumber_InPlaceSubtract(): 4a44. + + * *note PyNumber_InPlaceTrueDivide(): 4a45. + + * *note PyNumber_InPlaceXor(): 4a46. + + * *note PyNumber_Index(): 891. + + * *note PyNumber_Invert(): 4a47. + + * *note PyNumber_Long(): a67. + + * *note PyNumber_Lshift(): 4a48. + + * *note PyNumber_MatrixMultiply(): eaf. + + * *note PyNumber_Multiply(): 4a49. + + * *note PyNumber_Negative(): 4a4a. + + * *note PyNumber_Or(): 4a4b. + + * *note PyNumber_Positive(): 4a4c. + + * *note PyNumber_Power(): 4a4d. + + * *note PyNumber_Remainder(): 4a4e. + + * *note PyNumber_Rshift(): 4a4f. + + * *note PyNumber_Subtract(): 4a50. + + * *note PyNumber_ToBase(): 17e9. + + * *note PyNumber_TrueDivide(): 4a51. + + * *note PyNumber_Xor(): 4a52. + + * *note PyOS_AfterFork(): 3f6. + + * *note PyOS_AfterFork_Child(): 3f7. + + * *note PyOS_AfterFork_Parent(): bc0. + + * *note PyOS_BeforeFork(): bbf. + + * *note PyOS_CheckStack(): 1815. + + * *note PyOS_FSPath(): d18. + + * *note PyOS_InputHook: 582. + + * ‘PyOS_InterruptOccurred()’ + + * *note PyOS_double_to_string(): 4a53. + + * *note PyOS_getsig(): 1508. + + * ‘PyOS_mystricmp()’ + + * ‘PyOS_mystrnicmp()’ + + * *note PyOS_setsig(): 1509. + + * *note PyOS_sighandler_t: 4a54. + + * *note PyOS_snprintf(): 14d5. + + * *note PyOS_string_to_double(): 1288. + + * *note PyOS_strtol(): 4a55. + + * *note PyOS_strtoul(): 4a56. + + * *note PyOS_vsnprintf(): 14d6. + + * *note PyObject: 334. + + * *note PyObject.ob_refcnt: 89d. + + * *note PyObject.ob_type: 48e6. + + * *note PyObject_ASCII(): 4a57. + + * *note PyObject_AsFileDescriptor(): 4a58. + + * *note PyObject_Bytes(): 4a59. + + * *note PyObject_Call(): 398. + + * *note PyObject_CallFunction(): 39a. + + * *note PyObject_CallFunctionObjArgs(): 4a5a. + + * *note PyObject_CallMethod(): 39b. + + * *note PyObject_CallMethodObjArgs(): 19fc. + + * *note PyObject_CallNoArgs(): 397. + + * *note PyObject_CallObject(): 48c7. + + * *note PyObject_Calloc(): ea7. + + * *note PyObject_CheckBuffer(): 394. + + * *note PyObject_ClearWeakRefs(): 573. + + * *note PyObject_CopyData(): 758. + + * *note PyObject_DelAttr(): 1538. + + * *note PyObject_DelAttrString(): 1539. + + * *note PyObject_DelItem(): 4a5b. + + * *note PyObject_DelItemString(): 4a5c. + + * *note PyObject_Dir(): 4a5d. + + * *note PyObject_Format(): 4a5e. + + * *note PyObject_Free(): c65. + + * *note PyObject_GC_Del(): 14cf. + + * *note PyObject_GC_IsFinalized(): 977. + + * *note PyObject_GC_IsTracked(): 976. + + * *note PyObject_GC_Track(): 14d0. + + * *note PyObject_GC_UnTrack(): 14d1. + + * *note PyObject_GenericGetAttr(): 4a5f. + + * *note PyObject_GenericGetDict(): 193a. + + * *note PyObject_GenericSetAttr(): 4a60. + + * *note PyObject_GenericSetDict(): 4a61. + + * *note PyObject_GetAIter(): 4a62. + + * *note PyObject_GetAttr(): 346. + + * *note PyObject_GetAttrString(): 347. + + * *note PyObject_GetBuffer(): 395. + + * *note PyObject_GetItem(): 342. + + * *note PyObject_GetIter(): 4a63. + + * *note PyObject_GetOptionalAttr(): 344. + + * *note PyObject_GetOptionalAttrString(): 345. + + * *note PyObject_GetTypeData(): 546. + + * *note PyObject_HasAttr(): 376. + + * *note PyObject_HasAttrString(): 378. + + * *note PyObject_HasAttrStringWithError(): 377. + + * *note PyObject_HasAttrWithError(): 375. + + * *note PyObject_Hash(): 3ff. + + * *note PyObject_HashNotImplemented(): 1392. + + * *note PyObject_Init(): a6a. + + * *note PyObject_InitVar(): 1955. + + * *note PyObject_IsInstance(): e9f. + + * *note PyObject_IsSubclass(): ea0. + + * *note PyObject_IsTrue(): 4a64. + + * *note PyObject_Length(): 4a65. + + * *note PyObject_Malloc(): c68. + + * *note PyObject_Not(): 4a66. + + * *note PyObject_Realloc(): 140f. + + * *note PyObject_Repr(): 1028. + + * *note PyObject_RichCompare(): 490a. + + * *note PyObject_RichCompareBool(): 19a2. + + * *note PyObject_SelfIter(): 4a67. + + * *note PyObject_SetAttr(): 4a68. + + * *note PyObject_SetAttrString(): 1602. + + * *note PyObject_SetItem(): 4947. + + * *note PyObject_Size(): 4a69. + + * *note PyObject_Str(): 1029. + + * *note PyObject_Type(): 4a6a. + + * *note PyObject_Vectorcall(): 559. + + * *note PyObject_VectorcallMethod(): 55a. + + * *note PyProperty_Type: 4a6b. + + * ‘PyRangeIter_Type’ + + * ‘PyRange_Type’ + + * ‘PyReversed_Type’ + + * *note PySeqIter_New(): 4a6c. + + * *note PySeqIter_Type: 4a6d. + + * *note PySequence_Check(): 4a6e. + + * *note PySequence_Concat(): 4a6f. + + * *note PySequence_Contains(): 4a70. + + * *note PySequence_Count(): 4a71. + + * *note PySequence_DelItem(): 1a54. + + * *note PySequence_DelSlice(): 4a72. + + * *note PySequence_Fast(): 4a73. + + * *note PySequence_GetItem(): 1a52. + + * *note PySequence_GetSlice(): 4a74. + + * ‘PySequence_In()’ + + * *note PySequence_InPlaceConcat(): 4a75. + + * *note PySequence_InPlaceRepeat(): 4a76. + + * *note PySequence_Index(): 4a77. + + * *note PySequence_Length(): 4a78. + + * *note PySequence_List(): 4a79. + + * *note PySequence_Repeat(): 4a7a. + + * *note PySequence_SetItem(): 1a53. + + * *note PySequence_SetSlice(): 4a7b. + + * *note PySequence_Size(): 1a51. + + * *note PySequence_Tuple(): 4a7c. + + * ‘PySetIter_Type’ + + * *note PySet_Add(): 1412. + + * *note PySet_Clear(): 4a7d. + + * *note PySet_Contains(): 1414. + + * *note PySet_Discard(): 1413. + + * *note PySet_New(): 1410. + + * *note PySet_Pop(): 4a7e. + + * *note PySet_Size(): 1415. + + * *note PySet_Type: 4a7f. + + * *note PySlice_AdjustIndices(): 3fa. + + * *note PySlice_GetIndices(): 4a80. + + * *note PySlice_GetIndicesEx(): 3f8. + + * *note PySlice_New(): 4a81. + + * *note PySlice_Type: 4a82. + + * *note PySlice_Unpack(): 3f9. + + * *note PyState_AddModule(): 4a83. + + * *note PyState_FindModule(): 4a84. + + * *note PyState_RemoveModule(): 4a85. + + * *note PyStructSequence_Desc: bba. + + * *note PyStructSequence_Field: bb9. + + * *note PyStructSequence_GetItem(): 4a86. + + * *note PyStructSequence_New(): 4a87. + + * *note PyStructSequence_NewType(): 4a88. + + * *note PyStructSequence_SetItem(): 4a89. + + * *note PyStructSequence_UnnamedField: 982. + + * ‘PySuper_Type’ + + * *note PySys_Audit(): 36a. + + * *note PySys_AuditTuple(): 369. + + * *note PySys_FormatStderr(): 4a8a. + + * *note PySys_FormatStdout(): 4a8b. + + * *note PySys_GetObject(): 384. + + * *note PySys_GetXOptions(): 4a8c. + + * *note PySys_ResetWarnOptions(): 3ab. + + * *note PySys_SetArgv(): 1640. + + * *note PySys_SetArgvEx(): 163f. + + * *note PySys_SetObject(): 4a8d. + + * *note PySys_WriteStderr(): 4a8e. + + * *note PySys_WriteStdout(): 4a8f. + + * *note PyThreadState: 788. + + * *note PyThreadState_Clear(): 1621. + + * *note PyThreadState_Delete(): 199f. + + * *note PyThreadState_Get(): 36d. + + * *note PyThreadState_GetDict(): 4a90. + + * *note PyThreadState_GetFrame(): 789. + + * *note PyThreadState_GetID(): 972. + + * *note PyThreadState_GetInterpreter(): 971. + + * *note PyThreadState_New(): 4a91. + + * *note PyThreadState_SetAsyncExc(): bc4. + + * *note PyThreadState_Swap(): 4a92. + + * ‘PyThread_GetInfo()’ + + * *note PyThread_ReInitTLS(): 40a. + + * ‘PyThread_acquire_lock()’ + + * ‘PyThread_acquire_lock_timed()’ + + * ‘PyThread_allocate_lock()’ + + * *note PyThread_create_key(): 400. + + * *note PyThread_delete_key(): 402. + + * *note PyThread_delete_key_value(): 408. + + * ‘PyThread_exit_thread()’ + + * ‘PyThread_free_lock()’ + + * *note PyThread_get_key_value(): 406. + + * ‘PyThread_get_stacksize()’ + + * ‘PyThread_get_thread_ident()’ + + * ‘PyThread_get_thread_native_id()’ + + * ‘PyThread_init_thread()’ + + * ‘PyThread_release_lock()’ + + * *note PyThread_set_key_value(): 404. + + * ‘PyThread_set_stacksize()’ + + * ‘PyThread_start_new_thread()’ + + * *note PyThread_tss_alloc(): 401. + + * *note PyThread_tss_create(): 4a93. + + * *note PyThread_tss_delete(): 409. + + * *note PyThread_tss_free(): 403. + + * *note PyThread_tss_get(): 407. + + * *note PyThread_tss_is_created(): 4a94. + + * *note PyThread_tss_set(): 405. + + * ‘PyTraceBack_Here()’ + + * ‘PyTraceBack_Print()’ + + * ‘PyTraceBack_Type’ + + * ‘PyTupleIter_Type’ + + * *note PyTuple_GetItem(): 48d2. + + * *note PyTuple_GetSlice(): 4a95. + + * *note PyTuple_New(): 399. + + * *note PyTuple_Pack(): 4a96. + + * *note PyTuple_SetItem(): 48d3. + + * *note PyTuple_Size(): 4a97. + + * *note PyTuple_Type: 4a98. + + * *note PyTypeObject: aa5. + + * *note PyType_ClearCache(): 4a99. + + * *note PyType_FromMetaclass(): 54d. + + * *note PyType_FromModuleAndSpec(): 54e. + + * *note PyType_FromSpec(): 57a. + + * *note PyType_FromSpecWithBases(): 57b. + + * *note PyType_GenericAlloc(): a6b. + + * *note PyType_GenericNew(): 48e5. + + * *note PyType_GetFlags(): 1954. + + * *note PyType_GetFullyQualifiedName(): 36e. + + * *note PyType_GetModule(): 96e. + + * *note PyType_GetModuleByDef(): 38f. + + * *note PyType_GetModuleName(): 370. + + * *note PyType_GetModuleState(): 96f. + + * *note PyType_GetName(): 74d. + + * *note PyType_GetQualName(): 74e. + + * *note PyType_GetSlot(): 89a. + + * *note PyType_GetTypeDataSize(): 547. + + * *note PyType_IsSubtype(): 4a9a. + + * *note PyType_Modified(): 17f1. + + * *note PyType_Ready(): 777. + + * *note PyType_Slot: 4a9b. + + * *note PyType_Spec: 171b. + + * *note PyType_Type: 54a. + + * *note PyUnicodeDecodeError_Create(): 4a9c. + + * *note PyUnicodeDecodeError_GetEncoding(): 4a9d. + + * *note PyUnicodeDecodeError_GetEnd(): 4a9e. + + * *note PyUnicodeDecodeError_GetObject(): 4a9f. + + * *note PyUnicodeDecodeError_GetReason(): 4aa0. + + * *note PyUnicodeDecodeError_GetStart(): 4aa1. + + * *note PyUnicodeDecodeError_SetEnd(): 4aa2. + + * *note PyUnicodeDecodeError_SetReason(): 4aa3. + + * *note PyUnicodeDecodeError_SetStart(): 4aa4. + + * *note PyUnicodeEncodeError_GetEncoding(): 4aa5. + + * *note PyUnicodeEncodeError_GetEnd(): 4aa6. + + * *note PyUnicodeEncodeError_GetObject(): 4aa7. + + * *note PyUnicodeEncodeError_GetReason(): 4aa8. + + * *note PyUnicodeEncodeError_GetStart(): 4aa9. + + * *note PyUnicodeEncodeError_SetEnd(): 4aaa. + + * *note PyUnicodeEncodeError_SetReason(): 4aab. + + * *note PyUnicodeEncodeError_SetStart(): 4aac. + + * *note PyUnicodeIter_Type: 4aad. + + * *note PyUnicodeTranslateError_GetEnd(): 4aae. + + * *note PyUnicodeTranslateError_GetObject(): 4aaf. + + * *note PyUnicodeTranslateError_GetReason(): 4ab0. + + * *note PyUnicodeTranslateError_GetStart(): 4ab1. + + * *note PyUnicodeTranslateError_SetEnd(): 4ab2. + + * *note PyUnicodeTranslateError_SetReason(): 4ab3. + + * *note PyUnicodeTranslateError_SetStart(): 4ab4. + + * ‘PyUnicode_Append()’ + + * ‘PyUnicode_AppendAndDel()’ + + * *note PyUnicode_AsASCIIString(): 1186. + + * *note PyUnicode_AsCharmapString(): 4ab5. + + * ‘PyUnicode_AsDecodedObject()’ + + * ‘PyUnicode_AsDecodedUnicode()’ + + * ‘PyUnicode_AsEncodedObject()’ + + * *note PyUnicode_AsEncodedString(): 4ab6. + + * ‘PyUnicode_AsEncodedUnicode()’ + + * *note PyUnicode_AsLatin1String(): 1185. + + * *note PyUnicode_AsMBCSString(): 1187. + + * *note PyUnicode_AsRawUnicodeEscapeString(): 1184. + + * *note PyUnicode_AsUCS4(): 116c. + + * *note PyUnicode_AsUCS4Copy(): 8ba. + + * *note PyUnicode_AsUTF16String(): 4ab7. + + * *note PyUnicode_AsUTF32String(): 4ab8. + + * *note PyUnicode_AsUTF8AndSize(): 897. + + * *note PyUnicode_AsUTF8String(): 1182. + + * *note PyUnicode_AsUnicodeEscapeString(): 1183. + + * *note PyUnicode_AsWideChar(): 1a56. + + * *note PyUnicode_AsWideCharString(): 8bb. + + * *note PyUnicode_BuildEncodingMap(): 16f0. + + * *note PyUnicode_Compare(): 8b6. + + * *note PyUnicode_CompareWithASCIIString(): 125b. + + * *note PyUnicode_Concat(): 1194. + + * *note PyUnicode_Contains(): 4ab9. + + * *note PyUnicode_Count(): 4aba. + + * *note PyUnicode_Decode(): 19e1. + + * *note PyUnicode_DecodeASCII(): 4abb. + + * *note PyUnicode_DecodeCharmap(): 4abc. + + * *note PyUnicode_DecodeCodePageStateful(): 4abd. + + * *note PyUnicode_DecodeFSDefault(): 171a. + + * *note PyUnicode_DecodeFSDefaultAndSize(): 4abe. + + * *note PyUnicode_DecodeLatin1(): 4abf. + + * *note PyUnicode_DecodeLocale(): 4ac0. + + * *note PyUnicode_DecodeLocaleAndSize(): bc9. + + * *note PyUnicode_DecodeMBCS(): 4ac1. + + * *note PyUnicode_DecodeMBCSStateful(): 4ac2. + + * *note PyUnicode_DecodeRawUnicodeEscape(): 4ac3. + + * *note PyUnicode_DecodeUTF16(): 4ac4. + + * *note PyUnicode_DecodeUTF16Stateful(): 4ac5. + + * *note PyUnicode_DecodeUTF32(): 4ac6. + + * *note PyUnicode_DecodeUTF32Stateful(): 4ac7. + + * *note PyUnicode_DecodeUTF7(): 4ac8. + + * *note PyUnicode_DecodeUTF7Stateful(): 4ac9. + + * *note PyUnicode_DecodeUTF8(): 4aca. + + * *note PyUnicode_DecodeUTF8Stateful(): 179f. + + * *note PyUnicode_DecodeUnicodeEscape(): 4acb. + + * *note PyUnicode_EncodeCodePage(): 1188. + + * *note PyUnicode_EncodeFSDefault(): 1a50. + + * *note PyUnicode_EncodeLocale(): bca. + + * *note PyUnicode_EqualToUTF8(): 372. + + * *note PyUnicode_EqualToUTF8AndSize(): 371. + + * *note PyUnicode_FSConverter(): d19. + + * *note PyUnicode_FSDecoder(): 574. + + * *note PyUnicode_Find(): 4acc. + + * *note PyUnicode_FindChar(): 8b8. + + * *note PyUnicode_Format(): 4acd. + + * *note PyUnicode_FromEncodedObject(): 4ace. + + * *note PyUnicode_FromFormat(): 385. + + * *note PyUnicode_FromFormatV(): 571. + + * *note PyUnicode_FromObject(): 4acf. + + * *note PyUnicode_FromOrdinal(): 4ad0. + + * *note PyUnicode_FromString(): 4ad1. + + * *note PyUnicode_FromStringAndSize(): 4ad2. + + * *note PyUnicode_FromWideChar(): 1180. + + * *note PyUnicode_GetDefaultEncoding(): 4ad3. + + * *note PyUnicode_GetLength(): 8b2. + + * *note PyUnicode_InternFromString(): 1600. + + * *note PyUnicode_InternInPlace(): 8b0. + + * *note PyUnicode_IsIdentifier(): 199c. + + * *note PyUnicode_Join(): 1195. + + * *note PyUnicode_Partition(): 156f. + + * *note PyUnicode_RPartition(): 1570. + + * *note PyUnicode_RSplit(): 156e. + + * *note PyUnicode_ReadChar(): 1165. + + * *note PyUnicode_Replace(): 4ad4. + + * ‘PyUnicode_Resize()’ + + * *note PyUnicode_RichCompare(): 4ad5. + + * *note PyUnicode_Split(): 4ad6. + + * *note PyUnicode_Splitlines(): 4ad7. + + * *note PyUnicode_Substring(): 8b5. + + * *note PyUnicode_Tailmatch(): 8b7. + + * *note PyUnicode_Translate(): 4ad8. + + * *note PyUnicode_Type: 4ad9. + + * *note PyUnicode_WriteChar(): 1166. + + * *note PyVarObject: 416a. + + * ‘PyVarObject.ob_base’ + + * *note PyVarObject.ob_size: 4ada. + + * *note PyVectorcall_Call(): 553. + + * *note PyVectorcall_NARGS(): 552. + + * ‘PyWeakReference’ + + * *note PyWeakref_GetObject(): 374. + + * *note PyWeakref_GetRef(): 373. + + * *note PyWeakref_NewProxy(): 4adb. + + * *note PyWeakref_NewRef(): 184e. + + * ‘PyWrapperDescr_Type’ + + * *note PyWrapper_New(): 4adc. + + * ‘PyZip_Type’ + + * *note Py_AddPendingCall(): 981. + + * *note Py_AtExit(): 4add. + + * *note Py_BEGIN_ALLOW_THREADS: 48d7. + + * *note Py_BLOCK_THREADS: 4ade. + + * *note Py_BuildValue(): 8a6. + + * *note Py_BytesMain(): 9c1. + + * *note Py_CompileString(): 883. + + * *note Py_DecRef(): 4adf. + + * *note Py_DecodeLocale(): bc7. + + * *note Py_END_ALLOW_THREADS: a8e. + + * *note Py_EncodeLocale(): bc8. + + * *note Py_EndInterpreter(): 185f. + + * *note Py_EnterRecursiveCall(): 973. + + * *note Py_Exit(): d4e. + + * *note Py_FatalError(): 983. + + * ‘Py_FileSystemDefaultEncodeErrors’ + + * ‘Py_FileSystemDefaultEncoding’ + + * *note Py_Finalize(): 1345. + + * *note Py_FinalizeEx(): d15. + + * *note Py_GenericAlias(): 4ae0. + + * *note Py_GenericAliasType: 4ae1. + + * *note Py_GetBuildInfo(): 13fd. + + * *note Py_GetCompiler(): 4ae2. + + * *note Py_GetConstant(): 351. + + * *note Py_GetConstantBorrowed(): 352. + + * *note Py_GetCopyright(): 4ae3. + + * *note Py_GetExecPrefix(): 3ad. + + * *note Py_GetPath(): 3af. + + * *note Py_GetPlatform(): 4ae4. + + * *note Py_GetPrefix(): 3b1. + + * *note Py_GetProgramFullPath(): 3b3. + + * *note Py_GetProgramName(): 3b5. + + * *note Py_GetPythonHome(): 3b6. + + * ‘Py_GetRecursionLimit()’ + + * *note Py_GetVersion(): 4ae5. + + * ‘Py_HasFileSystemDefaultEncoding’ + + * *note Py_IncRef(): 4ae6. + + * *note Py_Initialize(): 8ab. + + * *note Py_InitializeEx(): 4ae7. + + * *note Py_Is(): 89e. + + * *note Py_IsFalse(): 8a1. + + * *note Py_IsFinalizing(): 355. + + * *note Py_IsInitialized(): 4950. + + * *note Py_IsNone(): 89f. + + * *note Py_IsTrue(): 8a0. + + * *note Py_LeaveRecursiveCall(): 974. + + * *note Py_Main(): c25. + + * ‘Py_MakePendingCalls()’ + + * *note Py_NewInterpreter(): 17b6. + + * *note Py_NewRef(): 898. + + * *note Py_ReprEnter(): 4ae8. + + * *note Py_ReprLeave(): 4ae9. + + * *note Py_SetProgramName(): 163e. + + * *note Py_SetPythonHome(): 163d. + + * ‘Py_SetRecursionLimit()’ + + * *note Py_UCS4: 29d. + + * *note Py_UNBLOCK_THREADS: 4aea. + + * ‘Py_UTF8Mode’ + + * *note Py_VaBuildValue(): 4aeb. + + * *note Py_Version: 751. + + * *note Py_XNewRef(): 899. + + * *note Py_buffer: 753. + + * ‘Py_intptr_t’ + + * *note Py_ssize_t: a5f. + + * ‘Py_uintptr_t’ + + * *note allocfunc: 4aec. + + * *note binaryfunc: 4aed. + + * *note descrgetfunc: 4aee. + + * *note descrsetfunc: 4aef. + + * *note destructor: 4af0. + + * *note getattrfunc: 4af1. + + * *note getattrofunc: 4af2. + + * *note getbufferproc: 4af3. + + * *note getiterfunc: 4af4. + + * *note getter: 4af5. + + * *note hashfunc: 4af6. + + * *note initproc: 4af7. + + * *note inquiry: 4af8. + + * *note iternextfunc: 4af9. + + * *note lenfunc: 4afa. + + * *note newfunc: 4afb. + + * *note objobjargproc: 4afc. + + * *note objobjproc: 4afd. + + * *note releasebufferproc: 4afe. + + * *note reprfunc: 4aff. + + * *note richcmpfunc: 4b00. + + * *note setattrfunc: 4b01. + + * *note setattrofunc: 4b02. + + * *note setter: 4b03. + + * *note ssizeargfunc: 4b04. + + * *note ssizeobjargproc: 4b05. + + * ‘ssizessizeargfunc’ + + * ‘ssizessizeobjargproc’ + + * ‘symtable’ + + * *note ternaryfunc: 4b06. + + * *note traverseproc: 4b07. + + * *note unaryfunc: 4b08. + + * *note vectorcallfunc: 554. + + * *note visitproc: 4b09. + + +File: python.info, Node: The Very High Level Layer, Next: Reference Counting, Prev: C API Stability, Up: Python/C API Reference Manual + +7.3 The Very High Level Layer +============================= + +The functions in this chapter will let you execute Python source code +given in a file or a buffer, but they will not let you interact in a +more detailed way with the interpreter. + +Several of these functions accept a start symbol from the grammar as a +parameter. The available start symbols are *note Py_eval_input: 4b0d, +*note Py_file_input: 4b0e, and *note Py_single_input: 4b0f. 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 Function: int PyRun_AnyFile (FILE *fp, const char *filename) + + This is a simplified interface to *note PyRun_AnyFileExFlags(): + 4b11. below, leaving 'closeit' set to ‘0’ and 'flags' set to + ‘NULL’. + + -- C Function: int PyRun_AnyFileFlags (FILE *fp, const char *filename, + PyCompilerFlags *flags) + + This is a simplified interface to *note PyRun_AnyFileExFlags(): + 4b11. below, leaving the 'closeit' argument set to ‘0’. + + -- C Function: int PyRun_AnyFileEx (FILE *fp, const char *filename, int + closeit) + + This is a simplified interface to *note PyRun_AnyFileExFlags(): + 4b11. below, leaving the 'flags' argument set to ‘NULL’. + + -- C Function: int PyRun_AnyFileExFlags (FILE *fp, const char + *filename, int closeit, PyCompilerFlags *flags) + + If 'fp' refers to a file associated with an interactive device + (console or terminal input or Unix pseudo-terminal), return the + value of *note PyRun_InteractiveLoop(): 4b14, otherwise return the + result of *note PyRun_SimpleFile(): 4924. 'filename' is decoded + from the filesystem encoding (*note sys.getfilesystemencoding(): + c59.). If 'filename' is ‘NULL’, this function uses ‘"???"’ as the + filename. If 'closeit' is true, the file is closed before + ‘PyRun_SimpleFileExFlags()’ returns. + + -- C Function: int PyRun_SimpleString (const char *command) + + This is a simplified interface to *note PyRun_SimpleStringFlags(): + 4b15. below, leaving the *note PyCompilerFlags: aa1.* argument set + to ‘NULL’. + + -- C Function: int PyRun_SimpleStringFlags (const char *command, + PyCompilerFlags *flags) + + Executes the Python source code from 'command' in the *note + __main__: 1. module according to the 'flags' argument. If *note + __main__: 1. does not already exist, it is created. Returns ‘0’ on + success or ‘-1’ if an exception was raised. If there was an error, + there is no way to get the exception information. For the meaning + of 'flags', see below. + + Note that if an otherwise unhandled *note SystemExit: d40. is + raised, this function will not return ‘-1’, but exit the process, + as long as *note PyConfig.inspect: 3cb. is zero. + + -- C Function: int PyRun_SimpleFile (FILE *fp, const char *filename) + + This is a simplified interface to *note PyRun_SimpleFileExFlags(): + 1908. below, leaving 'closeit' set to ‘0’ and 'flags' set to + ‘NULL’. + + -- C Function: int PyRun_SimpleFileEx (FILE *fp, const char *filename, + int closeit) + + This is a simplified interface to *note PyRun_SimpleFileExFlags(): + 1908. below, leaving 'flags' set to ‘NULL’. + + -- C Function: int PyRun_SimpleFileExFlags (FILE *fp, const char + *filename, int closeit, PyCompilerFlags *flags) + + Similar to *note PyRun_SimpleStringFlags(): 4b15, but the Python + source code is read from 'fp' instead of an in-memory string. + 'filename' should be the name of the file, it is decoded from *note + filesystem encoding and error handler: 537. If 'closeit' is true, + the file is closed before ‘PyRun_SimpleFileExFlags()’ returns. + + Note: On Windows, 'fp' should be opened as binary mode (e.g. + ‘fopen(filename, "rb")’). Otherwise, Python may not handle + script file with LF line ending correctly. + + -- C Function: int PyRun_InteractiveOne (FILE *fp, const char + *filename) + + This is a simplified interface to *note + PyRun_InteractiveOneFlags(): 4b18. below, leaving 'flags' set to + ‘NULL’. + + -- C Function: int PyRun_InteractiveOneFlags (FILE *fp, const char + *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' is + decoded from the *note filesystem encoding and error handler: 537. + + Returns ‘0’ when the input was executed successfully, ‘-1’ if there + was an exception, or an error code from the ‘errcode.h’ include + file distributed as part of Python if there was a parse error. + (Note that ‘errcode.h’ is not included by ‘Python.h’, so must be + included specifically if needed.) + + -- C Function: int PyRun_InteractiveLoop (FILE *fp, const char + *filename) + + This is a simplified interface to *note + PyRun_InteractiveLoopFlags(): 4b19. below, leaving 'flags' set to + ‘NULL’. + + -- C Function: int PyRun_InteractiveLoopFlags (FILE *fp, const char + *filename, PyCompilerFlags *flags) + + Read and execute statements from a file associated with an + interactive device until EOF is reached. The user will be prompted + using ‘sys.ps1’ and ‘sys.ps2’. 'filename' is decoded from the + *note filesystem encoding and error handler: 537. Returns ‘0’ at + EOF or a negative number upon failure. + + -- C Variable: int (*PyOS_InputHook)(void) + ' Part of the *note Stable ABI: 550.' 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 the + ‘Modules/_tkinter.c’ in the Python source code. + + Changed in version 3.12: This function is only called from the + *note main interpreter: 584. + + -- C Variable: char *(*PyOS_ReadlineFunctionPointer)(FILE*, FILE*, + const char*) + + Can be set to point to a function with the prototype ‘char + *func(FILE *stdin, FILE *stdout, char *prompt)’, overriding the + default function used to read a single line of input at the + interpreter’s prompt. The function is expected to output the + string 'prompt' if it’s not ‘NULL’, and then read a line of input + from the provided standard input file, returning the resulting + string. For example, The *note readline: ba. module sets this hook + to provide line-editing and tab-completion features. + + The result must be a string allocated by *note PyMem_RawMalloc(): + 38b. or *note PyMem_RawRealloc(): 38d, or ‘NULL’ if an error + occurred. + + Changed in version 3.4: The result must be allocated by *note + PyMem_RawMalloc(): 38b. or *note PyMem_RawRealloc(): 38d, instead + of being allocated by *note PyMem_Malloc(): c66. or *note + PyMem_Realloc(): 102b. + + Changed in version 3.12: This function is only called from the + *note main interpreter: 584. + + -- C Function: *note PyObject: 334. *PyRun_String (const char *str, int + start, PyObject *globals, PyObject *locals) + 'Return value: New reference.' This is a simplified interface to + *note PyRun_StringFlags(): 4b1a. below, leaving 'flags' set to + ‘NULL’. + + -- C Function: *note PyObject: 334. *PyRun_StringFlags (const char + *str, int start, PyObject *globals, PyObject *locals, + PyCompilerFlags *flags) + 'Return value: New reference.' 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 + token that should be used to parse the source code. + + Returns the result of executing the code as a Python object, or + ‘NULL’ if an exception was raised. + + -- C Function: *note PyObject: 334. *PyRun_File (FILE *fp, const char + *filename, int start, PyObject *globals, PyObject *locals) + 'Return value: New reference.' This is a simplified interface to + *note PyRun_FileExFlags(): 4b1c. below, leaving 'closeit' set to + ‘0’ and 'flags' set to ‘NULL’. + + -- C Function: *note PyObject: 334. *PyRun_FileEx (FILE *fp, const char + *filename, int start, PyObject *globals, PyObject *locals, int + closeit) + 'Return value: New reference.' This is a simplified interface to + *note PyRun_FileExFlags(): 4b1c. below, leaving 'flags' set to + ‘NULL’. + + -- C Function: *note PyObject: 334. *PyRun_FileFlags (FILE *fp, const + char *filename, int start, PyObject *globals, PyObject + *locals, PyCompilerFlags *flags) + 'Return value: New reference.' This is a simplified interface to + *note PyRun_FileExFlags(): 4b1c. below, leaving 'closeit' set to + ‘0’. + + -- C Function: *note PyObject: 334. *PyRun_FileExFlags (FILE *fp, const + char *filename, int start, PyObject *globals, PyObject + *locals, int closeit, PyCompilerFlags *flags) + 'Return value: New reference.' Similar to *note + PyRun_StringFlags(): 4b1a, but the Python source code is read from + 'fp' instead of an in-memory string. 'filename' should be the name + of the file, it is decoded from the *note filesystem encoding and + error handler: 537. If 'closeit' is true, the file is closed + before *note PyRun_FileExFlags(): 4b1c. returns. + + -- C Function: *note PyObject: 334. *Py_CompileString (const char *str, + const char *filename, int start) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is a simplified interface to *note + Py_CompileStringFlags(): 4b1f. below, leaving 'flags' set to + ‘NULL’. + + -- C Function: *note PyObject: 334. *Py_CompileStringFlags (const char + *str, const char *filename, int start, PyCompilerFlags *flags) + 'Return value: New reference.' This is a simplified interface to + *note Py_CompileStringExFlags(): 4b20. below, with 'optimize' set + to ‘-1’. + + -- C Function: *note PyObject: 334. *Py_CompileStringObject (const char + *str, PyObject *filename, int start, PyCompilerFlags *flags, + int optimize) + 'Return value: New reference.' Parse and compile the Python source + code in 'str', returning the resulting code object. The start + token is given by 'start'; this can be used to constrain the code + which can be compiled and should be *note Py_eval_input: 4b0d, + *note Py_file_input: 4b0e, or *note Py_single_input: 4b0f. The + filename specified by 'filename' is used to construct the code + object and may appear in tracebacks or *note SyntaxError: 18d. + exception messages. This returns ‘NULL’ if the code cannot be + parsed or compiled. + + The integer 'optimize' specifies the optimization level of the + compiler; a value of ‘-1’ selects the optimization level of the + interpreter as given by *note -O: db4. options. Explicit levels + are ‘0’ (no optimization; ‘__debug__’ is true), ‘1’ (asserts are + removed, ‘__debug__’ is false) or ‘2’ (docstrings are removed too). + + Added in version 3.4. + + -- C Function: *note PyObject: 334. *Py_CompileStringExFlags (const + char *str, const char *filename, int start, PyCompilerFlags + *flags, int optimize) + 'Return value: New reference.' Like *note + Py_CompileStringObject(): 4b21, but 'filename' is a byte string + decoded from the *note filesystem encoding and error handler: 537. + + Added in version 3.2. + + -- C Function: *note PyObject: 334. *PyEval_EvalCode (PyObject *co, + PyObject *globals, PyObject *locals) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is a simplified interface to *note PyEval_EvalCodeEx(): + 1769, with just the code object, and global and local variables. + The other arguments are set to ‘NULL’. + + -- C Function: *note PyObject: 334. *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) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Evaluate a precompiled code object, given a particular + environment for its evaluation. This environment consists of a + dictionary of global variables, a mapping object of local + variables, arrays of arguments, keywords and defaults, a dictionary + of default values for *note keyword-only: 2a7. arguments and a + closure tuple of cells. + + -- C Function: *note PyObject: 334. *PyEval_EvalFrame (PyFrameObject + *f) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Evaluate an execution frame. This is a simplified interface + to *note PyEval_EvalFrameEx(): 1027, for backward compatibility. + + -- C Function: *note PyObject: 334. *PyEval_EvalFrameEx (PyFrameObject + *f, int throwflag) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is the main, unvarnished function of Python + interpretation. The code object associated with the execution + frame 'f' is executed, interpreting bytecode and executing calls as + needed. The additional 'throwflag' parameter can mostly be ignored + - if true, then it causes an exception to immediately be thrown; + this is used for the *note throw(): 4f4. methods of generator + objects. + + Changed in version 3.4: This function now includes a debug + assertion to help ensure that it does not silently discard an + active exception. + + -- C Function: int PyEval_MergeCompilerFlags (PyCompilerFlags *cf) + + This function changes the flags of the current evaluation frame, + and returns true on success, false on failure. + + -- C Variable: int Py_eval_input + + The start symbol from the Python grammar for isolated expressions; + for use with *note Py_CompileString(): 883. + + -- C Variable: int Py_file_input + + The start symbol from the Python grammar for sequences of + statements as read from a file or other source; for use with *note + Py_CompileString(): 883. This is the symbol to use when compiling + arbitrarily long Python source code. + + -- C Variable: int Py_single_input + + The start symbol from the Python grammar for a single statement; + for use with *note Py_CompileString(): 883. This is the symbol + used for the interactive interpreter loop. + + -- C Struct: struct PyCompilerFlags + + This is the structure used to hold compiler flags. In cases where + code is only being compiled, it is passed as ‘int flags’, and in + cases where code is being executed, it is passed as + ‘PyCompilerFlags *flags’. In this case, ‘from __future__ import’ + can modify 'flags'. + + Whenever ‘PyCompilerFlags *flags’ is ‘NULL’, *note cf_flags: 4b23. + is treated as equal to ‘0’, and any modification due to ‘from + __future__ import’ is discarded. + + -- C Member: int cf_flags + + Compiler flags. + + -- C Member: 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: 4b23. + + Changed in version 3.8: Added 'cf_feature_version' field. + + The available compiler flags are accessible as macros: + + -- C Macro: PyCF_ALLOW_TOP_LEVEL_AWAIT + -- C Macro: PyCF_ONLY_AST + -- C Macro: PyCF_OPTIMIZED_AST + -- C Macro: PyCF_TYPE_COMMENTS + + See *note compiler flags: 2164. 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: 4b29. to enable features + normally selectable using *note future statements: 189. See *note + Code Object Flags: 4b2a. for a complete list. + + +File: python.info, Node: Reference Counting, Next: Exception Handling, Prev: The Very High Level Layer, Up: Python/C API Reference Manual + +7.4 Reference Counting +====================== + +The functions and macros in this section are used for managing reference +counts of Python objects. + + -- C Function: *note Py_ssize_t: a5f. Py_REFCNT (PyObject *o) + + Get the reference count of the Python object 'o'. + + Note that the returned value may not actually reflect how many + references to the object are actually held. For example, some + objects are *note immortal: 4394. and have a very high refcount + that does not reflect the actual number of references. + Consequently, do not rely on the returned value to be accurate, + other than a value of 0 or 1. + + Use the *note Py_SET_REFCNT(): 8a9. function to set an object + reference count. + + Changed in version 3.10: *note Py_REFCNT(): 8a8. is changed to the + inline static function. + + Changed in version 3.11: The parameter type is no longer const + *note PyObject: 334.*. + + -- C Function: void Py_SET_REFCNT (PyObject *o, Py_ssize_t refcnt) + + Set the object 'o' reference counter to 'refcnt'. + + On *note Python build with Free Threading: 1d7a, if 'refcnt' is + larger than ‘UINT32_MAX’, the object is made *note immortal: 4394. + + This function has no effect on *note immortal: 4394. objects. + + Added in version 3.9. + + Changed in version 3.12: Immortal objects are not modified. + + -- C Function: void Py_INCREF (PyObject *o) + + Indicate taking a new *note strong reference: 338. to object 'o', + indicating it is in use and should not be destroyed. + + This function has no effect on *note immortal: 4394. objects. + + This function is usually used to convert a *note borrowed + reference: 339. to a *note strong reference: 338. in-place. The + *note Py_NewRef(): 898. function can be used to create a new *note + strong reference: 338. + + When done using the object, release is by calling *note + Py_DECREF(): 56c. + + The object must not be ‘NULL’; if you aren’t sure that it isn’t + ‘NULL’, use *note Py_XINCREF(): a64. + + Do not expect this function to actually modify 'o' in any way. For + at least some objects(1), this function has no effect. + + Changed in version 3.12: Immortal objects are not modified. + + -- C Function: void Py_XINCREF (PyObject *o) + + Similar to *note Py_INCREF(): 56b, but the object 'o' can be + ‘NULL’, in which case this has no effect. + + See also *note Py_XNewRef(): 899. + + -- C Function: *note PyObject: 334. *Py_NewRef (PyObject *o) + ' Part of the *note Stable ABI: 550. since version 3.10.' Create a + new *note strong reference: 338. to an object: call *note + Py_INCREF(): 56b. on 'o' and return the object 'o'. + + When the *note strong reference: 338. is no longer needed, *note + Py_DECREF(): 56c. should be called on it to release the reference. + + The object 'o' must not be ‘NULL’; use *note Py_XNewRef(): 899. if + 'o' can be ‘NULL’. + + For example: + + Py_INCREF(obj); + self->attr = obj; + + can be written as: + + self->attr = Py_NewRef(obj); + + See also *note Py_INCREF(): 56b. + + Added in version 3.10. + + -- C Function: *note PyObject: 334. *Py_XNewRef (PyObject *o) + ' Part of the *note Stable ABI: 550. since version 3.10.' Similar + to *note Py_NewRef(): 898, but the object 'o' can be NULL. + + If the object 'o' is ‘NULL’, the function just returns ‘NULL’. + + Added in version 3.10. + + -- C Function: void Py_DECREF (PyObject *o) + + Release a *note strong reference: 338. to object 'o', indicating + the reference is no longer used. + + This function has no effect on *note immortal: 4394. objects. + + Once the last *note strong reference: 338. 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: + 338. before exiting its scope. + + The object must not be ‘NULL’; if you aren’t sure that it isn’t + ‘NULL’, use *note Py_XDECREF(): 78a. + + Do not expect this function to actually modify 'o' in any way. For + at least some objects(2), this function has no effect. + + Warning: The deallocation function can cause arbitrary Python + code to be invoked (e.g. when a class instance with a *note + __del__(): 1f61. 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(): 56c. is invoked. + For example, code to delete an object from a list should copy + a reference to the deleted object in a temporary variable, + update the list data structure, and then call *note + Py_DECREF(): 56c. for the temporary variable. + + Changed in version 3.12: Immortal objects are not modified. + + -- C Function: void Py_XDECREF (PyObject *o) + + Similar to *note Py_DECREF(): 56c, but the object 'o' can be + ‘NULL’, in which case this has no effect. The same warning from + *note Py_DECREF(): 56c. applies here as well. + + -- C Function: void Py_CLEAR (PyObject *o) + + Release a *note strong reference: 338. 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(): 56c, except that the + argument is also set to ‘NULL’. The warning for *note Py_DECREF(): + 56c. 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. + + Changed in version 3.12: The macro argument is now only evaluated + once. If the argument has side effects, these are no longer + duplicated. + + -- C Function: void Py_IncRef (PyObject *o) + ' Part of the *note Stable ABI: 550.' Indicate taking a new *note + strong reference: 338. to object 'o'. A function version of *note + Py_XINCREF(): a64. It can be used for runtime dynamic embedding of + Python. + + -- C Function: void Py_DecRef (PyObject *o) + ' Part of the *note Stable ABI: 550.' Release a *note strong + reference: 338. to object 'o'. A function version of *note + Py_XDECREF(): 78a. It can be used for runtime dynamic embedding of + Python. + + -- C Macro: Py_SETREF (dst, src) + + Macro safely releasing a *note strong reference: 338. to object + 'dst' and setting 'dst' to 'src'. + + As in case of *note Py_CLEAR(): 575, “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. + + Changed in version 3.12: The macro arguments are now only evaluated + once. If an argument has side effects, these are no longer + duplicated. + + -- C Macro: Py_XSETREF (dst, src) + + Variant of *note Py_SETREF: 576. macro that uses *note + Py_XDECREF(): 78a. instead of *note Py_DECREF(): 56c. + + Added in version 3.6. + + Changed in version 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: Exception Handling, Next: Utilities<2>, Prev: Reference Counting, Up: Python/C API Reference Manual + +7.5 Exception Handling +====================== + +The functions described in this chapter will let you handle and raise +Python exceptions. It is important to understand some of the basics of +Python exception handling. It works somewhat like the POSIX ‘errno’ +variable: there is a global indicator (per thread) of the last error +that occurred. Most C API functions don’t clear this on success, but +will set it to indicate the cause of the error on failure. Most C API +functions also return an error indicator, usually ‘NULL’ if they are +supposed to return a pointer, or ‘-1’ if they return an integer +(exception: the ‘PyArg_*’ functions return ‘1’ for success and ‘0’ for +failure). + +Concretely, the error indicator consists of three object pointers: the +exception’s type, the exception’s value, and the traceback object. Any +of those pointers can be ‘NULL’ if non-set (although some combinations +are forbidden, for example you can’t have a non-‘NULL’ traceback if the +exception type is ‘NULL’). + +When a function must fail because some function it called failed, it +generally doesn’t set the error indicator; the function it called +already set it. It is responsible for either handling the error and +clearing the exception or returning after cleaning up any resources it +holds (such as object references or memory allocations); it should 'not' +continue normally if it is not prepared to handle the error. If +returning due to an error, it is important to indicate to the caller +that an error has been set. If the error is not handled or carefully +propagated, additional calls into the Python/C API may not behave as +intended and may fail in mysterious ways. + + Note: The error indicator is 'not' the result of *note + sys.exc_info(): 686. 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: + +* Printing and clearing:: +* Raising exceptions:: +* Issuing warnings:: +* Querying the error indicator:: +* Signal Handling: Signal Handling<2>. +* Exception Classes:: +* Exception Objects:: +* Unicode Exception Objects:: +* Recursion Control:: +* Exception and warning types:: + + +File: python.info, Node: Printing and clearing, Next: Raising exceptions, Up: Exception Handling + +7.5.1 Printing and clearing +--------------------------- + + -- C Function: void PyErr_Clear () + ' Part of the *note Stable ABI: 550.' Clear the error indicator. + If the error indicator is not set, there is no effect. + + -- C Function: void PyErr_PrintEx (int set_sys_last_vars) + ' Part of the *note Stable ABI: 550.' Print a standard traceback + to ‘sys.stderr’ and clear the error indicator. 'Unless' the error + is a ‘SystemExit’, in that case no traceback is printed and the + Python process will exit with the error code specified by the + ‘SystemExit’ instance. + + Call this function 'only' when the error indicator is set. + Otherwise it will cause a fatal error! + + If 'set_sys_last_vars' is nonzero, the variable *note sys.last_exc: + 4ba. is set to the printed exception. For backwards compatibility, + the deprecated variables *note sys.last_type: 4bb, *note + sys.last_value: 4bc. and *note sys.last_traceback: 4bd. are also + set to the type, value and traceback of this exception, + respectively. + + Changed in version 3.12: The setting of *note sys.last_exc: 4ba. + was added. + + -- C Function: void PyErr_Print () + ' Part of the *note Stable ABI: 550.' Alias for + ‘PyErr_PrintEx(1)’. + + -- C Function: void PyErr_WriteUnraisable (PyObject *obj) + ' Part of the *note Stable ABI: 550.' Call *note + sys.unraisablehook(): 1f9. using the current exception and 'obj' + argument. + + 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__(): 1f61. 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. + + An exception must be set when calling this function. + + Changed in version 3.4: Print a traceback. Print only traceback if + 'obj' is ‘NULL’. + + Changed in version 3.8: Use *note sys.unraisablehook(): 1f9. + + -- C Function: void PyErr_FormatUnraisable (const char *format, ...) + + Similar to *note PyErr_WriteUnraisable(): 34a, but the 'format' and + subsequent parameters help format the warning message; they have + the same meaning and values as in *note PyUnicode_FromFormat(): + 385. ‘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 Function: void PyErr_DisplayException (PyObject *exc) + ' Part of the *note Stable ABI: 550. since version 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: Raising exceptions, Next: Issuing warnings, Prev: Printing and clearing, Up: Exception Handling + +7.5.2 Raising exceptions +------------------------ + +These functions help you set the current thread’s error indicator. For +convenience, some of these functions will always return a ‘NULL’ pointer +for use in a ‘return’ statement. + + -- C Function: void PyErr_SetString (PyObject *type, const char + *message) + ' Part of the *note Stable ABI: 550.' 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: 49e5. You need not create a new *note + strong reference: 338. to it (e.g. with *note Py_INCREF(): 56b.). + The second argument is an error message; it is decoded from + ‘'utf-8'’. + + -- C Function: void PyErr_SetObject (PyObject *type, PyObject *value) + ' Part of the *note Stable ABI: 550.' This function is similar to + *note PyErr_SetString(): 579. but lets you specify an arbitrary + Python object for the “value” of the exception. + + -- C Function: *note PyObject: 334. *PyErr_Format (PyObject *exception, + const char *format, ...) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + This function sets the error indicator and returns ‘NULL’. + 'exception' should be a Python exception class. The 'format' and + subsequent parameters help format the error message; they have the + same meaning and values as in *note PyUnicode_FromFormat(): 385. + 'format' is an ASCII-encoded string. + + -- C Function: *note PyObject: 334. *PyErr_FormatV (PyObject + *exception, const char *format, va_list vargs) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. + since version 3.5.' Same as *note PyErr_Format(): eaa, but taking + a ‘va_list’ argument rather than a variable number of arguments. + + Added in version 3.5. + + -- C Function: void PyErr_SetNone (PyObject *type) + ' Part of the *note Stable ABI: 550.' This is a shorthand for + ‘PyErr_SetObject(type, Py_None)’. + + -- C Function: int PyErr_BadArgument () + ' Part of the *note Stable ABI: 550.' This is a shorthand for + ‘PyErr_SetString(PyExc_TypeError, message)’, where 'message' + indicates that a built-in operation was invoked with an illegal + argument. It is mostly for internal use. + + -- C Function: *note PyObject: 334. *PyErr_NoMemory () + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + This is a shorthand for ‘PyErr_SetNone(PyExc_MemoryError)’; it + returns ‘NULL’ so an object allocation function can write ‘return + PyErr_NoMemory();’ when it runs out of memory. + + -- C Function: *note PyObject: 334. *PyErr_SetFromErrno (PyObject + *type) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + + 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(): 462, 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 Function: *note PyObject: 334. + *PyErr_SetFromErrnoWithFilenameObject (PyObject *type, + PyObject *filenameObject) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + Similar to *note PyErr_SetFromErrno(): 48b2, 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: 413. exception, this is used to define the + ‘filename’ attribute of the exception instance. + + -- C Function: *note PyObject: 334. + *PyErr_SetFromErrnoWithFilenameObjects (PyObject *type, + PyObject *filenameObject, PyObject *filenameObject2) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. + since version 3.7.' Similar to *note + PyErr_SetFromErrnoWithFilenameObject(): 49ac, but takes a second + filename object, for raising errors when a function that takes two + filenames fails. + + Added in version 3.4. + + -- C Function: *note PyObject: 334. *PyErr_SetFromErrnoWithFilename + (PyObject *type, const char *filename) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + Similar to *note PyErr_SetFromErrnoWithFilenameObject(): 49ac, but + the filename is given as a C string. 'filename' is decoded from + the *note filesystem encoding and error handler: 537. + + -- C Function: *note PyObject: 334. *PyErr_SetFromWindowsErr (int ierr) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' This is a convenience function to + raise *note OSError: 413. If called with 'ierr' of ‘0’, the error + code returned by a call to ‘GetLastError()’ is used instead. It + calls the Win32 function ‘FormatMessage()’ to retrieve the Windows + description of error code given by 'ierr' or ‘GetLastError()’, then + it constructs a *note OSError: 413. object with the *note winerror: + 228e. attribute set to the error code, the *note strerror: 228f. + 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: 1d54.: Windows. + + -- C Function: *note PyObject: 334. *PyErr_SetExcFromWindowsErr + (PyObject *type, int ierr) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' Similar to *note + PyErr_SetFromWindowsErr(): 49ae, with an additional parameter + specifying the exception type to be raised. + + *note Availability: 1d54.: Windows. + + -- C Function: *note PyObject: 334. + *PyErr_SetFromWindowsErrWithFilename (int ierr, const char + *filename) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' Similar to *note + PyErr_SetFromWindowsErr(): 49ae, with the additional behavior that + if 'filename' is not ‘NULL’, it is decoded from the filesystem + encoding (*note os.fsdecode(): c54.) and passed to the constructor + of *note OSError: 413. as a third parameter to be used to define + the ‘filename’ attribute of the exception instance. + + *note Availability: 1d54.: Windows. + + -- C Function: *note PyObject: 334. + *PyErr_SetExcFromWindowsErrWithFilenameObject (PyObject *type, + int ierr, PyObject *filename) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' Similar to *note + PyErr_SetExcFromWindowsErr(): 49a9, with the additional behavior + that if 'filename' is not ‘NULL’, it is passed to the constructor + of *note OSError: 413. as a third parameter to be used to define + the ‘filename’ attribute of the exception instance. + + *note Availability: 1d54.: Windows. + + -- C Function: *note PyObject: 334. + *PyErr_SetExcFromWindowsErrWithFilenameObjects (PyObject + *type, int ierr, PyObject *filename, PyObject *filename2) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' Similar to *note + PyErr_SetExcFromWindowsErrWithFilenameObject(): 49aa, but accepts a + second filename object. + + *note Availability: 1d54.: Windows. + + Added in version 3.4. + + -- C Function: *note PyObject: 334. + *PyErr_SetExcFromWindowsErrWithFilename (PyObject *type, int + ierr, const char *filename) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. on + Windows since version 3.7.' Similar to *note + PyErr_SetFromWindowsErrWithFilename(): 1719, with an additional + parameter specifying the exception type to be raised. + + *note Availability: 1d54.: Windows. + + -- C Function: *note PyObject: 334. *PyErr_SetImportError (PyObject + *msg, PyObject *name, PyObject *path) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. + since version 3.7.' This is a convenience function to raise *note + ImportError: 415. 'msg' will be set as the exception’s message + string. 'name' and 'path', both of which can be ‘NULL’, will be + set as the *note ImportError: 415.’s respective ‘name’ and ‘path’ + attributes. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyErr_SetImportErrorSubclass + (PyObject *exception, PyObject *msg, PyObject *name, PyObject + *path) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550. + since version 3.6.' Much like *note PyErr_SetImportError(): d3e. + but this function allows for specifying a subclass of *note + ImportError: 415. to raise. + + Added in version 3.6. + + -- C Function: void PyErr_SyntaxLocationObject (PyObject *filename, int + lineno, int col_offset) + + Set file, line, and offset information for the current exception. + If the current exception is not a *note SyntaxError: 18d, then it + sets additional attributes, which make the exception printing + subsystem think the exception is a *note SyntaxError: 18d. + + Added in version 3.4. + + -- C Function: void PyErr_SyntaxLocationEx (const char *filename, int + lineno, int col_offset) + ' Part of the *note Stable ABI: 550. since version 3.7.' Like + *note PyErr_SyntaxLocationObject(): 4b32, but 'filename' is a byte + string decoded from the *note filesystem encoding and error + handler: 537. + + Added in version 3.2. + + -- C Function: void PyErr_SyntaxLocation (const char *filename, int + lineno) + ' Part of the *note Stable ABI: 550.' Like *note + PyErr_SyntaxLocationEx(): 49b2, but the 'col_offset' parameter is + omitted. + + -- C Function: void PyErr_BadInternalCall () + ' Part of the *note Stable ABI: 550.' This is a shorthand for + ‘PyErr_SetString(PyExc_SystemError, message)’, where 'message' + indicates that an internal operation (e.g. a Python/C API + function) was invoked with an illegal argument. It is mostly for + internal use. + + +File: python.info, Node: Issuing warnings, Next: Querying the error indicator, Prev: Raising exceptions, Up: Exception Handling + +7.5.3 Issuing warnings +---------------------- + +Use these functions to issue warnings from C code. They mirror similar +functions exported by the Python *note warnings: 112. module. They +normally print a warning message to 'sys.stderr'; however, it is also +possible that the user has specified that warnings are to be turned into +errors, and in that case they will raise an exception. It is also +possible that the functions raise an exception because of a problem with +the warning machinery. The return value is ‘0’ if no exception is +raised, or ‘-1’ if an exception is raised. (It is not possible to +determine whether a warning message is actually printed, nor what the +reason is for the exception; this is intentional.) If an exception is +raised, the caller should do its normal exception handling (for example, +*note Py_DECREF(): 56c. owned references and return an error value). + + -- C Function: int PyErr_WarnEx (PyObject *category, const char + *message, Py_ssize_t stack_level) + ' Part of the *note Stable ABI: 550.' Issue a warning message. + The 'category' argument is a warning category (see below) or + ‘NULL’; the 'message' argument is a UTF-8 encoded string. + 'stack_level' is a positive number giving a number of stack frames; + the warning will be issued from the currently executing line of + code in that stack frame. A 'stack_level' of 1 is the function + calling *note PyErr_WarnEx(): 1416, 2 is the function above that, + and so forth. + + Warning categories must be subclasses of *note PyExc_Warning: + 49f6.; *note PyExc_Warning: 49f6. is a subclass of *note + PyExc_Exception: 49ca.; the default warning category is *note + PyExc_RuntimeWarning: 49e6. The standard Python warning categories + are available as global variables whose names are enumerated at + *note Warning types: 4b34. + + For information about warning control, see the documentation for + the *note warnings: 112. module and the *note -W: 8c6. option in + the command line documentation. There is no C API for warning + control. + + -- C Function: int PyErr_WarnExplicitObject (PyObject *category, + PyObject *message, PyObject *filename, int lineno, PyObject + *module, PyObject *registry) + + Issue a warning message with explicit control over all warning + attributes. This is a straightforward wrapper around the Python + function *note warnings.warn_explicit(): d00.; see there for more + information. The 'module' and 'registry' arguments may be set to + ‘NULL’ to get the default effect described there. + + Added in version 3.4. + + -- C Function: int PyErr_WarnExplicit (PyObject *category, const char + *message, const char *filename, int lineno, const char + *module, PyObject *registry) + ' Part of the *note Stable ABI: 550.' Similar to *note + PyErr_WarnExplicitObject(): 4b35. except that 'message' and + 'module' are UTF-8 encoded strings, and 'filename' is decoded from + the *note filesystem encoding and error handler: 537. + + -- C Function: int PyErr_WarnFormat (PyObject *category, Py_ssize_t + stack_level, const char *format, ...) + ' Part of the *note Stable ABI: 550.' Function similar to *note + PyErr_WarnEx(): 1416, but use *note PyUnicode_FromFormat(): 385. to + format the warning message. 'format' is an ASCII-encoded string. + + Added in version 3.2. + + -- C Function: int PyErr_ResourceWarning (PyObject *source, Py_ssize_t + stack_level, const char *format, ...) + ' Part of the *note Stable ABI: 550. since version 3.6.' Function + similar to *note PyErr_WarnFormat(): 49b3, but 'category' is *note + ResourceWarning: 246. and it passes 'source' to + ‘warnings.WarningMessage’. + + Added in version 3.6. + + +File: python.info, Node: Querying the error indicator, Next: Signal Handling<2>, Prev: Issuing warnings, Up: Exception Handling + +7.5.4 Querying the error indicator +---------------------------------- + + -- C Function: *note PyObject: 334. *PyErr_Occurred () + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Test whether the error indicator is set. If set, return the + exception 'type' (the first argument to the last call to one of the + ‘PyErr_Set*’ functions or to *note PyErr_Restore(): 3f2.). If not + set, return ‘NULL’. You do not own a reference to the return + value, so you do not need to *note Py_DECREF(): 56c. it. + + The caller must hold the GIL. + + Note: Do not compare the return value to a specific exception; + use *note PyErr_ExceptionMatches(): 494d. instead, shown + below. (The comparison could easily fail since the exception + may be an instance instead of a class, in the case of a class + exception, or it may be a subclass of the expected exception.) + + -- C Function: int PyErr_ExceptionMatches (PyObject *exc) + ' Part of the *note Stable ABI: 550.' Equivalent to + ‘PyErr_GivenExceptionMatches(PyErr_Occurred(), exc)’. This should + only be called when an exception is actually set; a memory access + violation will occur if no exception has been raised. + + -- C Function: int PyErr_GivenExceptionMatches (PyObject *given, + PyObject *exc) + ' Part of the *note Stable ABI: 550.' Return true if the 'given' + exception matches the exception type in 'exc'. If 'exc' is a class + object, this also returns true when 'given' is an instance of a + subclass. If 'exc' is a tuple, all exception types in the tuple + (and recursively in subtuples) are searched for a match. + + -- C Function: *note PyObject: 334. *PyErr_GetRaisedException (void) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.12.' Return the exception currently being raised, + clearing the error indicator at the same time. Return ‘NULL’ if + the error indicator is not set. + + This function is used by code that needs to catch exceptions, or + code that needs to save and restore the error indicator + temporarily. + + For example: + + { + PyObject *exc = PyErr_GetRaisedException(); + + /* ... code that might produce other errors ... */ + + PyErr_SetRaisedException(exc); + } + + See also + ........ + + *note PyErr_GetHandledException(): 76a, to save the exception + currently being handled. + + Added in version 3.12. + + -- C Function: void PyErr_SetRaisedException (PyObject *exc) + ' Part of the *note Stable ABI: 550. since version 3.12.' Set + 'exc' as the exception currently being raised, clearing the + existing exception if one is set. + + Warning: This call steals a reference to 'exc', which must be + a valid exception. + + Added in version 3.12. + + -- C Function: void PyErr_Fetch (PyObject **ptype, PyObject **pvalue, + PyObject **ptraceback) + ' Part of the *note Stable ABI: 550.' + + Deprecated since version 3.12: Use *note + PyErr_GetRaisedException(): 3f0. instead. + + Retrieve the error indicator into three variables whose addresses + are passed. If the error indicator is not set, set all three + variables to ‘NULL’. If it is set, it will be cleared and you own + a reference to each object retrieved. The value and traceback + object may be ‘NULL’ even when the type object is not. + + Note: This function is normally only used by legacy code that + needs to catch exceptions or save and restore the error + indicator temporarily. + + For example: + + { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + /* ... code that might produce other errors ... */ + + PyErr_Restore(type, value, traceback); + } + + -- C Function: void PyErr_Restore (PyObject *type, PyObject *value, + PyObject *traceback) + ' Part of the *note Stable ABI: 550.' + + Deprecated since version 3.12: Use *note + PyErr_SetRaisedException(): 3f3. 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.) + + Note: This function is normally only used by legacy code that + needs to save and restore the error indicator temporarily. + Use *note PyErr_Fetch(): 3ef. to save the current error + indicator. + + -- C Function: void PyErr_NormalizeException (PyObject **exc, PyObject + **val, PyObject **tb) + ' Part of the *note Stable ABI: 550.' + + Deprecated since version 3.12: Use *note + PyErr_GetRaisedException(): 3f0. instead, to avoid any possible + de-normalization. + + Under certain circumstances, the values returned by *note + PyErr_Fetch(): 3ef. below can be “unnormalized”, meaning that + ‘*exc’ is a class object but ‘*val’ is not an instance of the same + class. This function can be used to instantiate the class in that + case. If the values are already normalized, nothing happens. The + delayed normalization is implemented to improve performance. + + Note: This function 'does not' implicitly set the *note + __traceback__: 12b9. 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 Function: *note PyObject: 334. *PyErr_GetHandledException (void) + ' Part of the *note Stable ABI: 550. since version 3.11.' Retrieve + the active exception instance, as would be returned by *note + sys.exception(): 687. 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: This function is not normally used by code that wants to + handle exceptions. Rather, it can be used when code needs to + save and restore the exception state temporarily. Use *note + PyErr_SetHandledException(): 76b. to restore or clear the + exception state. + + Added in version 3.11. + + -- C Function: void PyErr_SetHandledException (PyObject *exc) + ' Part of the *note Stable ABI: 550. since version 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: This function is not normally used by code that wants to + handle exceptions. Rather, it can be used when code needs to + save and restore the exception state temporarily. Use *note + PyErr_GetHandledException(): 76a. to get the exception state. + + Added in version 3.11. + + -- C Function: void PyErr_GetExcInfo (PyObject **ptype, PyObject + **pvalue, PyObject **ptraceback) + ' Part of the *note Stable ABI: 550. since version 3.7.' Retrieve + the old-style representation of the exception info, as known from + *note sys.exc_info(): 686. 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(): 76a. + + Note: This function is not normally used by code that wants to + handle exceptions. Rather, it can be used when code needs to + save and restore the exception state temporarily. Use *note + PyErr_SetExcInfo(): 76c. to restore or clear the exception + state. + + Added in version 3.3. + + -- C Function: void PyErr_SetExcInfo (PyObject *type, PyObject *value, + PyObject *traceback) + ' Part of the *note Stable ABI: 550. since version 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(): 76b. + + Note: This function is not normally used by code that wants to + handle exceptions. Rather, it can be used when code needs to + save and restore the exception state temporarily. Use *note + PyErr_GetExcInfo(): 76d. to read the exception state. + + Added in version 3.3. + + Changed in version 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: Signal Handling<2>, Next: Exception Classes, Prev: Querying the error indicator, Up: Exception Handling + +7.5.5 Signal Handling +--------------------- + + -- C Function: int PyErr_CheckSignals () + ' Part of the *note Stable ABI: 550.' + + This function interacts with Python’s signal handling. + + If the function is called from the main thread and under the main + Python interpreter, it checks whether a signal has been sent to the + processes and if so, invokes the corresponding signal handler. If + the *note signal: c6. module is supported, this can invoke a signal + handler written in Python. + + The function attempts to handle all pending signals, and then + returns ‘0’. However, if a Python signal handler raises an + exception, the error indicator is set and the function returns ‘-1’ + immediately (such that other pending signals may not have been + handled yet: they will be on the next *note PyErr_CheckSignals(): + 462. invocation). + + If the function is called from a non-main thread, or under a + non-main Python interpreter, it does nothing and returns ‘0’. + + This function can be called by long-running C code that wants to be + interruptible by user requests (such as by pressing Ctrl-C). + + Note: The default Python signal handler for ‘SIGINT’ raises + the *note KeyboardInterrupt: 9d1. exception. + + -- C Function: void PyErr_SetInterrupt () + ' Part of the *note Stable ABI: 550.' + + Simulate the effect of a ‘SIGINT’ signal arriving. This is + equivalent to ‘PyErr_SetInterruptEx(SIGINT)’. + + Note: This function is async-signal-safe. It can be called + without the *note GIL: 159. and from a C signal handler. + + -- C Function: int PyErr_SetInterruptEx (int signum) + ' Part of the *note Stable ABI: 550. since version 3.10.' + + Simulate the effect of a signal arriving. The next time *note + PyErr_CheckSignals(): 462. is called, the Python signal handler for + the given signal number will be called. + + 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: 1820. or *note signal.SIG_IGN: 181f.), 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. + + Note: This function is async-signal-safe. It can be called + without the *note GIL: 159. and from a C signal handler. + + Added in version 3.10. + + -- C Function: int PySignal_SetWakeupFd (int fd) + + This utility function specifies a file descriptor to which the + signal number is written as a single byte whenever a signal is + received. 'fd' must be non-blocking. It returns the previous such + file descriptor. + + The value ‘-1’ disables the feature; this is the initial state. + This is equivalent to *note signal.set_wakeup_fd(): b70. in Python, + but without any error checking. 'fd' should be a valid file + descriptor. The function should only be called from the main + thread. + + Changed in version 3.5: On Windows, the function now also supports + socket handles. + + +File: python.info, Node: Exception Classes, Next: Exception Objects, Prev: Signal Handling<2>, Up: Exception Handling + +7.5.6 Exception Classes +----------------------- + + -- C Function: *note PyObject: 334. *PyErr_NewException (const char + *name, PyObject *base, PyObject *dict) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This utility function creates and returns a new exception + class. The 'name' argument must be the name of the new exception, + a C string of the form ‘module.classname’. The 'base' and 'dict' + arguments are normally ‘NULL’. This creates a class object derived + from *note Exception: 9d9. (accessible in C as *note + PyExc_Exception: 49ca.). + + The *note __module__: 36f. 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 Function: *note PyObject: 334. *PyErr_NewExceptionWithDoc (const + char *name, const char *doc, PyObject *base, PyObject *dict) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Same as *note PyErr_NewException(): 125d, except that the + new exception class can easily be given a docstring: If 'doc' is + non-‘NULL’, it will be used as the docstring for the exception + class. + + Added in version 3.2. + + -- C Function: int PyExceptionClass_Check (PyObject *ob) + + Return non-zero if 'ob' is an exception class, zero otherwise. + This function always succeeds. + + -- C Function: const char *PyExceptionClass_Name (PyObject *ob) + ' Part of the *note Stable ABI: 550. since version 3.8.' Return + *note tp_name: 18f2. of the exception class 'ob'. + + +File: python.info, Node: Exception Objects, Next: Unicode Exception Objects, Prev: Exception Classes, Up: Exception Handling + +7.5.7 Exception Objects +----------------------- + + -- C Function: *note PyObject: 334. *PyException_GetTraceback (PyObject + *ex) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the traceback associated with the exception as a new + reference, as accessible from Python through the *note + __traceback__: 12b9. attribute. If there is no traceback + associated, this returns ‘NULL’. + + -- C Function: int PyException_SetTraceback (PyObject *ex, PyObject + *tb) + ' Part of the *note Stable ABI: 550.' Set the traceback associated + with the exception to 'tb'. Use ‘Py_None’ to clear it. + + -- C Function: *note PyObject: 334. *PyException_GetContext (PyObject + *ex) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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__: + 12ba. attribute. If there is no context associated, this returns + ‘NULL’. + + -- C Function: void PyException_SetContext (PyObject *ex, PyObject + *ctx) + ' Part of the *note Stable ABI: 550.' Set the context associated + with the exception to 'ctx'. Use ‘NULL’ to clear it. There is no + type check to make sure that 'ctx' is an exception instance. This + steals a reference to 'ctx'. + + -- C Function: *note PyObject: 334. *PyException_GetCause (PyObject + *ex) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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__: + 12bb. attribute. + + -- C Function: void PyException_SetCause (PyObject *ex, PyObject + *cause) + ' Part of the *note Stable ABI: 550.' 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__: 20b8. attribute is implicitly set + to ‘True’ by this function. + + -- C Function: *note PyObject: 334. *PyException_GetArgs (PyObject *ex) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.12.' Return *note args: 569. of exception 'ex'. + + -- C Function: void PyException_SetArgs (PyObject *ex, PyObject *args) + ' Part of the *note Stable ABI: 550. since version 3.12.' Set + *note args: 569. of exception 'ex' to 'args'. + + -- C Function: *note PyObject: 334. *PyUnstable_Exc_PrepReraiseStar + (PyObject *orig, PyObject *excs) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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: 1b6. 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 Exception Objects, Next: Recursion Control, Prev: Exception Objects, Up: Exception Handling + +7.5.8 Unicode Exception Objects +------------------------------- + +The following functions are used to create and modify Unicode exceptions +from C. + + -- C Function: *note PyObject: 334. *PyUnicodeDecodeError_Create (const + char *encoding, const char *object, Py_ssize_t length, + Py_ssize_t start, Py_ssize_t end, const char *reason) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a *note UnicodeDecodeError: a12. object with the + attributes 'encoding', 'object', 'length', 'start', 'end' and + 'reason'. 'encoding' and 'reason' are UTF-8 encoded strings. + + -- C Function: *note PyObject: 334. *PyUnicodeDecodeError_GetEncoding + (PyObject *exc) + -- C Function: *note PyObject: 334. *PyUnicodeEncodeError_GetEncoding + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the 'encoding' attribute of the given exception + object. + + -- C Function: *note PyObject: 334. *PyUnicodeDecodeError_GetObject + (PyObject *exc) + -- C Function: *note PyObject: 334. *PyUnicodeEncodeError_GetObject + (PyObject *exc) + -- C Function: *note PyObject: 334. *PyUnicodeTranslateError_GetObject + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the 'object' attribute of the given exception object. + + -- C Function: int PyUnicodeDecodeError_GetStart (PyObject *exc, + Py_ssize_t *start) + -- C Function: int PyUnicodeEncodeError_GetStart (PyObject *exc, + Py_ssize_t *start) + -- C Function: int PyUnicodeTranslateError_GetStart (PyObject *exc, + Py_ssize_t *start) + ' Part of the *note Stable ABI: 550.' Get the 'start' attribute of + the given exception object and place it into '*start'. 'start' + must not be ‘NULL’. Return ‘0’ on success, ‘-1’ on failure. + + -- C Function: int PyUnicodeDecodeError_SetStart (PyObject *exc, + Py_ssize_t start) + -- C Function: int PyUnicodeEncodeError_SetStart (PyObject *exc, + Py_ssize_t start) + -- C Function: int PyUnicodeTranslateError_SetStart (PyObject *exc, + Py_ssize_t start) + ' Part of the *note Stable ABI: 550.' Set the 'start' attribute of + the given exception object to 'start'. Return ‘0’ on success, ‘-1’ + on failure. + + -- C Function: int PyUnicodeDecodeError_GetEnd (PyObject *exc, + Py_ssize_t *end) + -- C Function: int PyUnicodeEncodeError_GetEnd (PyObject *exc, + Py_ssize_t *end) + -- C Function: int PyUnicodeTranslateError_GetEnd (PyObject *exc, + Py_ssize_t *end) + ' Part of the *note Stable ABI: 550.' Get the 'end' attribute of + the given exception object and place it into '*end'. 'end' must + not be ‘NULL’. Return ‘0’ on success, ‘-1’ on failure. + + -- C Function: int PyUnicodeDecodeError_SetEnd (PyObject *exc, + Py_ssize_t end) + -- C Function: int PyUnicodeEncodeError_SetEnd (PyObject *exc, + Py_ssize_t end) + -- C Function: int PyUnicodeTranslateError_SetEnd (PyObject *exc, + Py_ssize_t end) + ' Part of the *note Stable ABI: 550.' Set the 'end' attribute of + the given exception object to 'end'. Return ‘0’ on success, ‘-1’ + on failure. + + -- C Function: *note PyObject: 334. *PyUnicodeDecodeError_GetReason + (PyObject *exc) + -- C Function: *note PyObject: 334. *PyUnicodeEncodeError_GetReason + (PyObject *exc) + -- C Function: *note PyObject: 334. *PyUnicodeTranslateError_GetReason + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the 'reason' attribute of the given exception object. + + -- C Function: int PyUnicodeDecodeError_SetReason (PyObject *exc, const + char *reason) + -- C Function: int PyUnicodeEncodeError_SetReason (PyObject *exc, const + char *reason) + -- C Function: int PyUnicodeTranslateError_SetReason (PyObject *exc, + const char *reason) + ' Part of the *note Stable ABI: 550.' Set the 'reason' attribute + of the given exception object to 'reason'. Return ‘0’ on success, + ‘-1’ on failure. + + +File: python.info, Node: Recursion Control, Next: Exception and warning types, Prev: Unicode Exception Objects, Up: Exception Handling + +7.5.9 Recursion Control +----------------------- + +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: 580. takes +care of recursion handling. + + -- C Function: int Py_EnterRecursiveCall (const char *where) + ' Part of the *note Stable ABI: 550. since version 3.9.' Marks a + point where a recursive C-level call is about to be performed. + + If ‘USE_STACKCHECK’ is defined, this function checks if the OS + stack overflowed using *note PyOS_CheckStack(): 1815. If this is + the case, it sets a *note MemoryError: 1576. and returns a nonzero + value. + + The function then checks if the recursion limit is reached. If + this is the case, a *note RecursionError: d6b. is set and a nonzero + value is returned. Otherwise, zero is returned. + + 'where' should be a UTF-8 encoded string such as ‘" in instance + check"’ to be concatenated to the *note RecursionError: d6b. + message caused by the recursion depth limit. + + Changed in version 3.9: This function is now also available in the + *note limited API: 391. + + -- C Function: void Py_LeaveRecursiveCall (void) + ' Part of the *note Stable ABI: 550. since version 3.9.' Ends a + *note Py_EnterRecursiveCall(): 973. Must be called once for each + 'successful' invocation of *note Py_EnterRecursiveCall(): 973. + + Changed in version 3.9: This function is now also available in the + *note limited API: 391. + +Properly implementing *note tp_repr: 48fd. for container types requires +special recursion handling. In addition to protecting the stack, *note +tp_repr: 48fd. also needs to track objects to prevent cycles. The +following two functions facilitate this functionality. Effectively, +these are the C equivalent to *note reprlib.recursive_repr(): 11e5. + + -- C Function: int Py_ReprEnter (PyObject *object) + ' Part of the *note Stable ABI: 550.' Called at the beginning of + the *note tp_repr: 48fd. implementation to detect cycles. + + If the object has already been processed, the function returns a + positive integer. In that case the *note tp_repr: 48fd. + implementation should return a string object indicating a cycle. + As examples, *note dict: 258. objects return ‘{...}’ and *note + list: 60d. objects return ‘[...]’. + + The function will return a negative integer if the recursion limit + is reached. In that case the *note tp_repr: 48fd. implementation + should typically return ‘NULL’. + + Otherwise, the function returns zero and the *note tp_repr: 48fd. + implementation can continue normally. + + -- C Function: void Py_ReprLeave (PyObject *object) + ' Part of the *note Stable ABI: 550.' Ends a *note Py_ReprEnter(): + 4ae8. Must be called once for each invocation of *note + Py_ReprEnter(): 4ae8. that returns zero. + + +File: python.info, Node: Exception and warning types, Prev: Recursion Control, Up: Exception Handling + +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: 334.*; 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 Variable: *note PyObject: 334. *note BaseException: 5b7. + *PyExc_BaseException + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note BaseExceptionGroup: 261. + *PyExc_BaseExceptionGroup + ' Part of the *note Stable ABI: 550. since + version 3.11.' + + -- C Variable: *note PyObject: 334. *note Exception: 9d9. + *PyExc_Exception + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ArithmeticError: 2283. + *PyExc_ArithmeticError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note AssertionError: 6a5. + *PyExc_AssertionError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note AttributeError: 348. + *PyExc_AttributeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note BlockingIOError: 1050. + *PyExc_BlockingIOError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note BrokenPipeError: 1055. + *PyExc_BrokenPipeError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note BufferError: 1824. + *PyExc_BufferError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ChildProcessError: 1051. + *PyExc_ChildProcessError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ConnectionAbortedError: 1056. + *PyExc_ConnectionAbortedError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ConnectionError: e09. + *PyExc_ConnectionError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ConnectionRefusedError: 1057. + *PyExc_ConnectionRefusedError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ConnectionResetError: 1058. + *PyExc_ConnectionResetError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *PyExc_EOFError *note EOFError: 12cc. + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note FileExistsError: 1019. + *PyExc_FileExistsError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note FileNotFoundError: 427. + *PyExc_FileNotFoundError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note FloatingPointError: 2284. + *PyExc_FloatingPointError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note GeneratorExit: 1393. + *PyExc_GeneratorExit + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ImportError: 415. + *PyExc_ImportError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note IndentationError: 7a3. + *PyExc_IndentationError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note IndexError: 14ff. + *PyExc_IndexError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note InterruptedError: d87. + *PyExc_InterruptedError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note IsADirectoryError: 1052. + *PyExc_IsADirectoryError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *PyExc_KeyError *note KeyError: 33f. + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note KeyboardInterrupt: 9d1. + *PyExc_KeyboardInterrupt + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note LookupError: 21cc. + *PyExc_LookupError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note MemoryError: 1576. + *PyExc_MemoryError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ModuleNotFoundError: b47. + *PyExc_ModuleNotFoundError + ' Part of the *note Stable ABI: 550. since + version 3.6.' + + -- C Variable: *note PyObject: 334. *note NameError: 43a. + *PyExc_NameError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note NotADirectoryError: 1053. + *PyExc_NotADirectoryError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note NotImplementedError: 22a. + *PyExc_NotImplementedError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *PyExc_OSError *note OSError: 413. + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note OverflowError: 87f. + *PyExc_OverflowError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note PermissionError: d42. + *PyExc_PermissionError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ProcessLookupError: 1054. + *PyExc_ProcessLookupError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note PythonFinalizationError: 14d. + *PyExc_PythonFinalizationError + + -- C Variable: *note PyObject: 334. *note RecursionError: d6b. + *PyExc_RecursionError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note ReferenceError: 14d9. + *PyExc_ReferenceError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note RuntimeError: 195. + *PyExc_RuntimeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note StopAsyncIteration: 1a2c. + *PyExc_StopAsyncIteration + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note StopIteration: bfa. + *PyExc_StopIteration + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note SyntaxError: 18d. + *PyExc_SyntaxError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note SystemError: 572. + *PyExc_SystemError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note SystemExit: d40. + *PyExc_SystemExit + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *PyExc_TabError *note TabError: 540. + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note TimeoutError: 831. + *PyExc_TimeoutError + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note TypeError: 534. + *PyExc_TypeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnboundLocalError: 1500. + *PyExc_UnboundLocalError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnicodeDecodeError: a12. + *PyExc_UnicodeDecodeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnicodeEncodeError: 673. + *PyExc_UnicodeEncodeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnicodeError: 1296. + *PyExc_UnicodeError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnicodeTranslateError: 229d. + *PyExc_UnicodeTranslateError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ValueError: 204. + *PyExc_ValueError + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ZeroDivisionError: 945. + *PyExc_ZeroDivisionError + ' Part of the *note Stable ABI: 550.' + +Added in version 3.3: *note PyExc_BlockingIOError: 49bd, *note +PyExc_BrokenPipeError: 49be, *note PyExc_ChildProcessError: 49c1, *note +PyExc_ConnectionError: 49c3, *note PyExc_ConnectionAbortedError: 49c2, +*note PyExc_ConnectionRefusedError: 49c4, *note +PyExc_ConnectionResetError: 49c5, *note PyExc_FileExistsError: 49cb, +*note PyExc_FileNotFoundError: 49cc, *note PyExc_InterruptedError: 49d5, +*note PyExc_IsADirectoryError: 49d6, *note PyExc_NotADirectoryError: +49dd, *note PyExc_PermissionError: 49e1, *note PyExc_ProcessLookupError: +49e2. and *note PyExc_TimeoutError: 49ee. were introduced following PEP +3151(1). + +Added in version 3.5: *note PyExc_StopAsyncIteration: 49e7. and *note +PyExc_RecursionError: eab. + +Added in version 3.6: *note PyExc_ModuleNotFoundError: 49db. + +Added in version 3.11: *note PyExc_BaseExceptionGroup: 49bc. + + ---------- 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: 48b5. + +Changed in version 3.3: These aliases used to be separate exception +types. + +C name Python name Notes + +------------------------------------------------------------------------------------------------------------------ + + -- C Variable: *note OSError: 413. + *note PyObject: 334. + *PyExc_EnvironmentError + ' Part of the + *note Stable ABI: 550.' + + -- C Variable: *note OSError: 413. + *note PyObject: 334. + *PyExc_IOError + ' Part of the + *note Stable ABI: 550.' + + -- C Variable: *note OSError: 413. *note [win]: 4b45. + *note PyObject: 334. + *PyExc_WindowsError + ' Part of the + *note Stable ABI: 550. on + Windows since version 3.7.' + +Notes: + +(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 Variable: *note PyObject: 334. *PyExc_Warning *note Warning: 22b3. + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note BytesWarning: c23. + *PyExc_BytesWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note DeprecationWarning: 1a5. + *PyExc_DeprecationWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note EncodingWarning: 1d3d. + *PyExc_EncodingWarning + ' Part of the *note Stable ABI: 550. since + version 3.10.' + + -- C Variable: *note PyObject: 334. *note FutureWarning: 411. + *PyExc_FutureWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ImportWarning: 4f6. + *PyExc_ImportWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note PendingDeprecationWarning: 8c7. + *PyExc_PendingDeprecationWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note ResourceWarning: 246. + *PyExc_ResourceWarning + ' Part of the *note Stable ABI: 550. since + version 3.7.' + + -- C Variable: *note PyObject: 334. *note RuntimeWarning: 1bd. + *PyExc_RuntimeWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note SyntaxWarning: 461. + *PyExc_SyntaxWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UnicodeWarning: 13ef. + *PyExc_UnicodeWarning + ' Part of the *note Stable ABI: 550.' + + -- C Variable: *note PyObject: 334. *note UserWarning: 22b4. + *PyExc_UserWarning + ' Part of the *note Stable ABI: 550.' + +Added in version 3.2: *note PyExc_ResourceWarning: 49e4. + +Added in version 3.10: *note PyExc_EncodingWarning: 49c8. + + +File: python.info, Node: Utilities<2>, Next: Abstract Objects Layer, Prev: Exception Handling, Up: Python/C API Reference Manual + +7.6 Utilities +============= + +The functions in this chapter perform various utility tasks, ranging +from helping C code be more portable across platforms, using Python +modules from C, and parsing function arguments and constructing Python +values from C values. + +* Menu: + +* Operating System Utilities:: +* System Functions:: +* Process Control:: +* Importing Modules: Importing Modules<2>. +* Data marshalling support:: +* Parsing arguments and building values:: +* String conversion and formatting:: +* PyHash API:: +* Reflection:: +* Codec registry and support functions:: +* PyTime C API:: +* Support for Perf Maps:: + + +File: python.info, Node: Operating System Utilities, Next: System Functions, Up: Utilities<2> + +7.6.1 Operating System Utilities +-------------------------------- + + -- C Function: *note PyObject: 334. *PyOS_FSPath (PyObject *path) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.6.' Return the file system representation for + 'path'. If the object is a *note str: 447. or *note bytes: 1c2. + object, then a new *note strong reference: 338. is returned. If + the object implements the *note os.PathLike: c51. interface, then + *note __fspath__(): c52. is returned as long as it is a *note str: + 447. or *note bytes: 1c2. object. Otherwise *note TypeError: 534. + is raised and ‘NULL’ is returned. + + Added in version 3.6. + + -- C Function: 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: 3c9. 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 Function: void PyOS_BeforeFork () + ' Part of the *note Stable ABI: 550. on platforms with fork() since + version 3.7.' Function to prepare some internal state before a + process fork. This should be called before calling ‘fork()’ or any + similar function that clones the current process. Only available + on systems where ‘fork()’ is defined. + + Warning: The C ‘fork()’ call should only be made from the + *note “main” thread: 4b4e. (of the *note “main” interpreter: + 584.). The same is true for ‘PyOS_BeforeFork()’. + + Added in version 3.7. + + -- C Function: void PyOS_AfterFork_Parent () + ' Part of the *note Stable ABI: 550. on platforms with fork() since + version 3.7.' Function to update some internal state after a + process fork. This should be called from the parent process after + calling ‘fork()’ or any similar function that clones the current + process, regardless of whether process cloning was successful. + Only available on systems where ‘fork()’ is defined. + + Warning: The C ‘fork()’ call should only be made from the + *note “main” thread: 4b4e. (of the *note “main” interpreter: + 584.). The same is true for ‘PyOS_AfterFork_Parent()’. + + Added in version 3.7. + + -- C Function: void PyOS_AfterFork_Child () + ' Part of the *note Stable ABI: 550. on platforms with fork() since + version 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. + + Warning: The C ‘fork()’ call should only be made from the + *note “main” thread: 4b4e. (of the *note “main” interpreter: + 584.). The same is true for ‘PyOS_AfterFork_Child()’. + + Added in version 3.7. + + See also + ........ + + *note os.register_at_fork(): 2fa. allows registering custom Python + functions to be called by *note PyOS_BeforeFork(): bbf, *note + PyOS_AfterFork_Parent(): bc0. and *note PyOS_AfterFork_Child(): + 3f7. + + -- C Function: void PyOS_AfterFork () + ' Part of the *note Stable ABI: 550. on platforms with fork().' + Function to update some internal state after a process fork; this + should be called in the new process if the Python interpreter will + continue to be used. If a new executable is loaded into the new + process, this function does not need to be called. + + Deprecated since version 3.7: This function is superseded by *note + PyOS_AfterFork_Child(): 3f7. + + -- C Function: int PyOS_CheckStack () + ' Part of the *note Stable ABI: 550. on platforms with + USE_STACKCHECK since version 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 Type: typedef void (*PyOS_sighandler_t)(int) + ' Part of the *note Stable ABI: 550.' + + -- C Function: *note PyOS_sighandler_t: 4a54. PyOS_getsig (int i) + ' Part of the *note Stable ABI: 550.' 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 Function: *note PyOS_sighandler_t: 4a54. PyOS_setsig (int i, + PyOS_sighandler_t h) + ' Part of the *note Stable ABI: 550.' 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 Function: wchar_t *Py_DecodeLocale (const char *arg, size_t *size) + ' Part of the *note Stable ABI: 550. since version 3.7.' + Warning: This function should not be called directly: use the + *note PyConfig: 3a2. API with the *note + PyConfig_SetBytesString(): 9b4. function which ensures that + *note Python is preinitialized: 3d40. + + This function must not be called before *note Python is + preinitialized: 3d40. and so that the LC_CTYPE locale is + properly configured: see the *note Py_PreInitialize(): 3e7. + function. + + Decode a byte string from the *note filesystem encoding and error + handler: 537. If the error handler is *note surrogateescape error + handler: 23e6, undecodable bytes are decoded as characters in range + U+DC80..U+DCFF; and if a byte sequence can be decoded as a + surrogate character, the bytes are escaped using the + surrogateescape error handler instead of decoding them. + + Return a pointer to a newly allocated wide character string, use + *note PyMem_RawFree(): 38e. to free the memory. If size is not + ‘NULL’, write the number of wide characters excluding the null + character into ‘*size’ + + Return ‘NULL’ on decoding error or memory allocation error. If + 'size' is not ‘NULL’, ‘*size’ is set to ‘(size_t)-1’ on memory + error or set to ‘(size_t)-2’ on decoding error. + + The *note filesystem encoding and error handler: 537. are selected + by *note PyConfig_Read(): 78b.: see *note filesystem_encoding: 3e4. + and *note filesystem_errors: 3e5. members of *note PyConfig: 3a2. + + Decoding errors should never happen, unless there is a bug in the C + library. + + Use the *note Py_EncodeLocale(): bc8. function to encode the + character string back to a byte string. + + See also + ........ + + The *note PyUnicode_DecodeFSDefaultAndSize(): 4abe. and *note + PyUnicode_DecodeLocaleAndSize(): bc9. functions. + + Added in version 3.5. + + Changed in version 3.7: The function now uses the UTF-8 encoding in + the *note Python UTF-8 Mode: 652. + + Changed in version 3.8: The function now uses the UTF-8 encoding on + Windows if *note PyPreConfig.legacy_windows_fs_encoding: 3e2. is + zero; + + -- C Function: char *Py_EncodeLocale (const wchar_t *text, size_t + *error_pos) + ' Part of the *note Stable ABI: 550. since version 3.7.' Encode a + wide character string to the *note filesystem encoding and error + handler: 537. If the error handler is *note surrogateescape error + handler: 23e6, surrogate characters in the range U+DC80..U+DCFF are + converted to bytes 0x80..0xFF. + + Return a pointer to a newly allocated byte string, use *note + PyMem_Free(): 140e. to free the memory. Return ‘NULL’ on encoding + error or memory allocation error. + + 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: 537. are selected + by *note PyConfig_Read(): 78b.: see *note filesystem_encoding: 3e4. + and *note filesystem_errors: 3e5. members of *note PyConfig: 3a2. + + Use the *note Py_DecodeLocale(): bc7. function to decode the bytes + string back to a wide character string. + + Warning: This function must not be called before *note Python + is preinitialized: 3d40. and so that the LC_CTYPE locale is + properly configured: see the *note Py_PreInitialize(): 3e7. + function. + + See also + ........ + + The *note PyUnicode_EncodeFSDefault(): 1a50. and *note + PyUnicode_EncodeLocale(): bca. functions. + + Added in version 3.5. + + Changed in version 3.7: The function now uses the UTF-8 encoding in + the *note Python UTF-8 Mode: 652. + + Changed in version 3.8: The function now uses the UTF-8 encoding on + Windows if *note PyPreConfig.legacy_windows_fs_encoding: 3e2. is + zero. + + +File: python.info, Node: System Functions, Next: Process Control, Prev: Operating System Utilities, Up: Utilities<2> + +7.6.2 System Functions +---------------------- + +These are utility functions that make functionality from the *note sys: +d9. module accessible to C code. They all work with the current +interpreter thread’s *note sys: d9. module’s dict, which is contained in +the internal thread state structure. + + -- C Function: *note PyObject: 334. *PySys_GetObject (const char *name) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return the object 'name' from the *note sys: d9. module or + ‘NULL’ if it does not exist, without setting an exception. + + -- C Function: int PySys_SetObject (const char *name, PyObject *v) + ' Part of the *note Stable ABI: 550.' Set 'name' in the *note sys: + d9. module to 'v' unless 'v' is ‘NULL’, in which case 'name' is + deleted from the sys module. Returns ‘0’ on success, ‘-1’ on + error. + + -- C Function: void PySys_ResetWarnOptions () + ' Part of the *note Stable ABI: 550.' Reset *note sys.warnoptions: + 3ac. to an empty list. This function may be called prior to *note + Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: + Clear *note sys.warnoptions: 3ac. and ‘warnings.filters’ instead. + + -- C Function: void PySys_WriteStdout (const char *format, ...) + ' Part of the *note Stable ABI: 550.' Write the output string + described by 'format' to *note sys.stdout: ad6. No exceptions are + raised, even if truncation occurs (see below). + + 'format' should limit the total size of the formatted output string + to 1000 bytes or less – after 1000 bytes, the output string is + truncated. In particular, this means that no unrestricted “%s” + formats should occur; these should be limited using “%.<N>s” where + <N> is a decimal number calculated so that <N> plus the maximum + size of other formatted text does not exceed 1000 bytes. Also + watch out for “%f”, which can print hundreds of digits for very + large numbers. + + If a problem occurs, or *note sys.stdout: ad6. is unset, the + formatted message is written to the real (C level) 'stdout'. + + -- C Function: void PySys_WriteStderr (const char *format, ...) + ' Part of the *note Stable ABI: 550.' As *note + PySys_WriteStdout(): 4a8f, but write to *note sys.stderr: 939. or + 'stderr' instead. + + -- C Function: void PySys_FormatStdout (const char *format, ...) + ' Part of the *note Stable ABI: 550.' Function similar to + PySys_WriteStdout() but format the message using *note + PyUnicode_FromFormatV(): 571. and don’t truncate the message to an + arbitrary length. + + Added in version 3.2. + + -- C Function: void PySys_FormatStderr (const char *format, ...) + ' Part of the *note Stable ABI: 550.' As *note + PySys_FormatStdout(): 4a8b, but write to *note sys.stderr: 939. or + 'stderr' instead. + + Added in version 3.2. + + -- C Function: *note PyObject: 334. *PySys_GetXOptions () + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550. since version 3.7.' Return the current dictionary of *note + -X: 176. options, similarly to *note sys._xoptions: 1d3f. On + error, ‘NULL’ is returned and an exception is set. + + Added in version 3.2. + + -- C Function: int PySys_Audit (const char *event, const char *format, + ...) + ' Part of the *note Stable ABI: 550. since version 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(): 8a6. 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: a5f, regardless of whether ‘PY_SSIZE_T_CLEAN’ was + defined. + + *note sys.audit(): 15b9. performs the same function from Python + code. + + See also *note PySys_AuditTuple(): 369. + + Added in version 3.8. + + Changed in version 3.8.2: Require *note Py_ssize_t: a5f. for ‘#’ + format characters. Previously, an unavoidable deprecation warning + was raised. + + -- C Function: int PySys_AuditTuple (const char *event, PyObject *args) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note PySys_Audit(): 36a, but pass arguments as a Python object. + 'args' must be a *note tuple: 36b. To pass no arguments, 'args' + can be 'NULL'. + + Added in version 3.13. + + -- C Function: 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. + + The 'userData' pointer is passed into the hook function. Since + hook functions may be called from different runtimes, this pointer + should not refer directly to Python state. + + This function is safe to call before *note Py_Initialize(): 8ab. + When called after runtime initialization, existing audit hooks are + notified and may silently abort the operation by raising an error + subclassed from *note Exception: 9d9. (other errors will not be + silenced). + + The hook function is always called with the GIL held 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: 1870. 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: 9d9, 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 Type: typedef int (*Py_AuditHookFunction)(const char *event, + *note PyObject: 334. *args, void *userData) + + The type of the hook function. 'event' is the C string event + argument passed to *note PySys_Audit(): 36a. or *note + PySys_AuditTuple(): 369. 'args' is guaranteed to be a *note + PyTupleObject: 4b52. '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: Process Control, Next: Importing Modules<2>, Prev: System Functions, Up: Utilities<2> + +7.6.3 Process Control +--------------------- + + -- C Function: void Py_FatalError (const char *message) + ' Part of the *note Stable ABI: 550.' + + 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. + + Changed in version 3.9: Log the function name automatically. + + -- C Function: void Py_Exit (int status) + ' Part of the *note Stable ABI: 550.' + + Exit the current process. This calls *note Py_FinalizeEx(): d15. + and then calls the standard C library function ‘exit(status)’. If + *note Py_FinalizeEx(): d15. indicates an error, the exit status is + set to 120. + + Changed in version 3.6: Errors from finalization no longer ignored. + + -- C Function: int Py_AtExit (void (*func)()) + ' Part of the *note Stable ABI: 550.' + + Register a cleanup function to be called by *note Py_FinalizeEx(): + d15. The cleanup function will be called with no arguments and + should return no value. At most 32 cleanup functions can be + registered. When the registration is successful, *note + Py_AtExit(): 4add. returns ‘0’; on failure, it returns ‘-1’. The + cleanup function registered last is called first. Each cleanup + function will be called at most once. Since Python’s internal + finalization will have completed before the cleanup function, no + Python APIs should be called by 'func'. + + See also + ........ + + *note PyUnstable_AtExit(): 158b. for passing a ‘void *data’ + argument. + + +File: python.info, Node: Importing Modules<2>, Next: Data marshalling support, Prev: Process Control, Up: Utilities<2> + +7.6.4 Importing Modules +----------------------- + + -- C Function: *note PyObject: 334. *PyImport_ImportModule (const char + *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + This is a wrapper around *note PyImport_Import(): 13c8. which takes + a const char* as an argument instead of a *note PyObject: 334.*. + + -- C Function: *note PyObject: 334. *PyImport_ImportModuleNoBlock + (const char *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This function is a deprecated alias of *note + PyImport_ImportModule(): 3ba. + + Changed in version 3.3: This function used to fail immediately when + the import lock was held by another thread. In Python 3.3 though, + the locking scheme switched to per-module locks for most purposes, + so this function’s special behaviour isn’t needed anymore. + + Deprecated since version 3.13, will be removed in version 3.15: Use + *note PyImport_ImportModule(): 3ba. instead. + + -- C Function: *note PyObject: 334. *PyImport_ImportModuleEx (const + char *name, PyObject *globals, PyObject *locals, PyObject + *fromlist) + 'Return value: New reference.' + + Import a module. This is best described by referring to the + built-in Python function *note __import__(): 8d3. + + The return value is a new reference to the imported module or + top-level package, or ‘NULL’ with an exception set on failure. + Like for *note __import__(): 8d3, the return value when a submodule + of a package was requested is normally the top-level package, + unless a non-empty 'fromlist' was given. + + Failing imports remove incomplete module objects, like with *note + PyImport_ImportModule(): 3ba. + + -- C Function: *note PyObject: 334. *PyImport_ImportModuleLevelObject + (PyObject *name, PyObject *globals, PyObject *locals, PyObject + *fromlist, int level) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Import a module. This is best described by + referring to the built-in Python function *note __import__(): 8d3, + as the standard *note __import__(): 8d3. function calls this + function directly. + + The return value is a new reference to the imported module or + top-level package, or ‘NULL’ with an exception set on failure. + Like for *note __import__(): 8d3, the return value when a submodule + of a package was requested is normally the top-level package, + unless a non-empty 'fromlist' was given. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyImport_ImportModuleLevel (const + char *name, PyObject *globals, PyObject *locals, PyObject + *fromlist, int level) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Similar to *note PyImport_ImportModuleLevelObject(): 4a0f, + but the name is a UTF-8 encoded string instead of a Unicode object. + + Changed in version 3.3: Negative values for 'level' are no longer + accepted. + + -- C Function: *note PyObject: 334. *PyImport_Import (PyObject *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is a higher-level interface that calls the current + “import hook function” (with an explicit 'level' of 0, meaning + absolute import). It invokes the *note __import__(): 8d3. function + from the ‘__builtins__’ of the current globals. This means that + the import is done using whatever import hooks are installed in the + current environment. + + This function always uses absolute imports. + + -- C Function: *note PyObject: 334. *PyImport_ReloadModule (PyObject + *m) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Reload a module. Return a new reference to the reloaded + module, or ‘NULL’ with an exception set on failure (the module + still exists in this case). + + -- C Function: *note PyObject: 334. *PyImport_AddModuleRef (const char + *name) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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: 338. 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(): 3ba. 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 Function: *note PyObject: 334. *PyImport_AddModuleObject (PyObject + *name) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550. since version 3.7.' Similar to *note PyImport_AddModuleRef(): + 353, but return a *note borrowed reference: 339. and 'name' is a + Python *note str: 447. object. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyImport_AddModule (const char + *name) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Similar to *note PyImport_AddModuleRef(): 353, but return a + *note borrowed reference: 339. + + -- C Function: *note PyObject: 334. *PyImport_ExecCodeModule (const + char *name, PyObject *co) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + 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(): 192, 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: + 1550. in error cases, even if 'name' was already in *note + sys.modules: 1550. on entry to *note PyImport_ExecCodeModule(): + 4a07. Leaving incompletely initialized modules in *note + sys.modules: 1550. 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__: 1f17. and *note __loader__: 2e6. 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: 106d. otherwise. + + The module’s *note __file__: 1f1d. attribute will be set to the + code object’s *note co_filename: 1359. If applicable, *note + __cached__: 2d9. will also be set. + + This function will reload the module if it was already imported. + See *note PyImport_ReloadModule(): 4a10. for the intended way to + reload a module. + + If 'name' points to a dotted name of the form ‘package.module’, any + package structures not already created will still not be created. + + See also *note PyImport_ExecCodeModuleEx(): 4a08. and *note + PyImport_ExecCodeModuleWithPathnames(): 4a0a. + + Changed in version 3.12: The setting of *note __cached__: 2d9. and + *note __loader__: 2e6. is deprecated. See *note ModuleSpec: 1e64. + for alternatives. + + -- C Function: *note PyObject: 334. *PyImport_ExecCodeModuleEx (const + char *name, PyObject *co, const char *pathname) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Like *note PyImport_ExecCodeModule(): 4a07, but the *note + __file__: 1f1d. attribute of the module object is set to 'pathname' + if it is non-‘NULL’. + + See also *note PyImport_ExecCodeModuleWithPathnames(): 4a0a. + + -- C Function: *note PyObject: 334. *PyImport_ExecCodeModuleObject + (PyObject *name, PyObject *co, PyObject *pathname, PyObject + *cpathname) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Like *note PyImport_ExecCodeModuleEx(): 4a08, + but the *note __cached__: 2d9. attribute of the module object is + set to 'cpathname' if it is non-‘NULL’. Of the three functions, + this is the preferred one to use. + + Added in version 3.3. + + Changed in version 3.12: Setting *note __cached__: 2d9. is + deprecated. See *note ModuleSpec: 1e64. for alternatives. + + -- C Function: *note PyObject: 334. + *PyImport_ExecCodeModuleWithPathnames (const char *name, + PyObject *co, const char *pathname, const char *cpathname) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Like *note PyImport_ExecCodeModuleObject(): 4a09, but + 'name', 'pathname' and 'cpathname' are UTF-8 encoded strings. + Attempts are also made to figure out what the value for 'pathname' + should be from 'cpathname' if the former is set to ‘NULL’. + + Added in version 3.2. + + Changed in version 3.3: Uses ‘imp.source_from_cache()’ in + calculating the source path if only the bytecode path is provided. + + Changed in version 3.12: No longer uses the removed ‘imp’ module. + + -- C Function: long PyImport_GetMagicNumber () + ' Part of the *note Stable ABI: 550.' Return the magic number for + Python bytecode files (a.k.a. ‘.pyc’ file). The magic number + should be present in the first four bytes of the bytecode file, in + little-endian byte order. Returns ‘-1’ on error. + + Changed in version 3.3: Return value of ‘-1’ upon failure. + + -- C Function: const char *PyImport_GetMagicTag () + ' Part of the *note Stable ABI: 550.' Return the magic tag string + for PEP 3147(1) format Python bytecode file names. Keep in mind + that the value at ‘sys.implementation.cache_tag’ is authoritative + and should be used instead of this function. + + Added in version 3.2. + + -- C Function: *note PyObject: 334. *PyImport_GetModuleDict () + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return the dictionary used for the module administration + (a.k.a. ‘sys.modules’). Note that this is a per-interpreter + variable. + + -- C Function: *note PyObject: 334. *PyImport_GetModule (PyObject + *name) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.8.' Return the already imported module with the + given name. If the module has not been imported yet then returns + ‘NULL’ but does not set an error. Returns ‘NULL’ and sets an error + if the lookup failed. + + Added in version 3.7. + + -- C Function: *note PyObject: 334. *PyImport_GetImporter (PyObject + *path) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a finder object for a *note sys.path: + 3b0./‘pkg.__path__’ item 'path', possibly by fetching it from the + *note sys.path_importer_cache: 5e0. dict. If it wasn’t yet cached, + traverse *note sys.path_hooks: 101d. 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: 1ff9. could not find a + finder for this path item. Cache the result in *note + sys.path_importer_cache: 5e0. Return a new reference to the finder + object. + + -- C Function: int PyImport_ImportFrozenModuleObject (PyObject *name) + ' Part of the *note Stable ABI: 550. since version 3.7.' Load a + frozen module named 'name'. Return ‘1’ for success, ‘0’ if the + module is not found, and ‘-1’ with an exception set if the + initialization failed. To access the imported module on a + successful load, use *note PyImport_ImportModule(): 3ba. (Note the + misnomer — this function would reload the module if it was already + imported.) + + Added in version 3.3. + + Changed in version 3.4: The ‘__file__’ attribute is no longer set + on the module. + + -- C Function: int PyImport_ImportFrozenModule (const char *name) + ' Part of the *note Stable ABI: 550.' Similar to *note + PyImport_ImportFrozenModuleObject(): 4a0e, but the name is a UTF-8 + encoded string instead of a Unicode object. + + -- C Struct: struct _frozen + + This is the structure type definition for frozen module + descriptors, as generated by the ‘freeze’ utility (see + ‘Tools/freeze/’ in the Python source distribution). Its + definition, found in ‘Include/import.h’, is: + + struct _frozen { + const char *name; + const unsigned char *code; + int size; + bool is_package; + }; + + Changed in version 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 Variable: const struct *note _frozen: 770. *PyImport_FrozenModules + + This pointer is initialized to point to an array of *note _frozen: + 770. records, terminated by one whose members are all ‘NULL’ or + zero. When a frozen module is imported, it is searched in this + table. Third-party code could play tricks with this to provide a + dynamically created collection of frozen modules. + + -- C Function: int PyImport_AppendInittab (const char *name, PyObject + *(*initfunc)(void)) + ' Part of the *note Stable ABI: 550.' Add a single module to the + existing table of built-in modules. This is a convenience wrapper + around *note PyImport_ExtendInittab(): 17a4, returning ‘-1’ if the + table could not be extended. 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. This should be + called before *note Py_Initialize(): 8ab. + + -- 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(): + 17a4. to provide additional built-in modules. The structure + consists of two members: + + -- C Member: const char *name + + The module name, as an ASCII encoded string. + + -- C Member: *note PyObject: 334. *(*initfunc)(void) + + Initialization function for a module built into the + interpreter. + + -- C Function: 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: 4b59. 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(): + 8ab. + + If Python is initialized multiple times, *note + PyImport_AppendInittab(): 17a3. or *note PyImport_ExtendInittab(): + 17a4. must be called before each Python initialization. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + +File: python.info, Node: Data marshalling support, Next: Parsing arguments and building values, Prev: Importing Modules<2>, Up: Utilities<2> + +7.6.5 Data marshalling support +------------------------------ + +These routines allow C code to work with serialized objects using the +same data format as the *note marshal: 8d. module. There are functions +to write data into the serialization format, and additional functions +that can be used to read the data back. Files used to store marshalled +data must be opened in binary mode. + +Numeric values are stored with the least significant byte first. + +The module supports two versions of the data format: version 0 is the +historical version, version 1 shares interned strings in the file, and +upon unmarshalling. Version 2 uses a binary format for floating-point +numbers. ‘Py_MARSHAL_VERSION’ indicates the current file format +(currently 2). + + -- C Function: void PyMarshal_WriteLongToFile (long value, FILE *file, + int version) + + Marshal a long integer, 'value', to 'file'. This will only write + the least-significant 32 bits of 'value'; regardless of the size of + the native long type. 'version' indicates the file format. + + This function can fail, in which case it sets the error indicator. + Use *note PyErr_Occurred(): 18f1. to check for that. + + -- C Function: void PyMarshal_WriteObjectToFile (PyObject *value, FILE + *file, int version) + + Marshal a Python object, 'value', to 'file'. 'version' indicates + the file format. + + This function can fail, in which case it sets the error indicator. + Use *note PyErr_Occurred(): 18f1. to check for that. + + -- C Function: *note PyObject: 334. *PyMarshal_WriteObjectToString + (PyObject *value, int version) + 'Return value: New reference.' Return a bytes object containing + the marshalled representation of 'value'. 'version' indicates the + file format. + +The following functions allow marshalled values to be read back in. + + -- C Function: long PyMarshal_ReadLongFromFile (FILE *file) + + Return a C long from the data stream in a FILE* opened for reading. + Only a 32-bit value can be read in using this function, regardless + of the native size of long. + + On error, sets the appropriate exception (*note EOFError: 12cc.) + and returns ‘-1’. + + -- C Function: int PyMarshal_ReadShortFromFile (FILE *file) + + Return a C short from the data stream in a FILE* opened for + reading. Only a 16-bit value can be read in using this function, + regardless of the native size of short. + + On error, sets the appropriate exception (*note EOFError: 12cc.) + and returns ‘-1’. + + -- C Function: *note PyObject: 334. *PyMarshal_ReadObjectFromFile (FILE + *file) + 'Return value: New reference.' Return a Python object from the + data stream in a FILE* opened for reading. + + On error, sets the appropriate exception (*note EOFError: 12cc, + *note ValueError: 204. or *note TypeError: 534.) and returns + ‘NULL’. + + -- C Function: *note PyObject: 334. *PyMarshal_ReadLastObjectFromFile + (FILE *file) + 'Return value: New reference.' Return a Python object from the + data stream in a FILE* opened for reading. Unlike *note + PyMarshal_ReadObjectFromFile(): 4b60, 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 these variant if + you are certain that you won’t be reading anything else from the + file. + + On error, sets the appropriate exception (*note EOFError: 12cc, + *note ValueError: 204. or *note TypeError: 534.) and returns + ‘NULL’. + + -- C Function: *note PyObject: 334. *PyMarshal_ReadObjectFromString + (const char *data, Py_ssize_t len) + 'Return value: New reference.' Return a Python object from the + data stream in a byte buffer containing 'len' bytes pointed to by + 'data'. + + On error, sets the appropriate exception (*note EOFError: 12cc, + *note ValueError: 204. or *note TypeError: 534.) and returns + ‘NULL’. + + +File: python.info, Node: Parsing arguments and building values, Next: String conversion and formatting, Prev: Data marshalling support, Up: Utilities<2> + +7.6.6 Parsing arguments and building values +------------------------------------------- + +These functions are useful when creating your own extension functions +and methods. Additional information and examples are available in *note +Extending and Embedding the Python Interpreter: 1bda. + +The first three of these functions described, *note PyArg_ParseTuple(): +56e, *note PyArg_ParseTupleAndKeywords(): 37e, and *note PyArg_Parse(): +19e3, all use 'format strings' which are used to tell the function about +the expected arguments. The format strings use the same syntax for each +of these functions. + +* Menu: + +* Parsing arguments: Parsing arguments<2>. +* Building values:: + + +File: python.info, Node: Parsing arguments<2>, Next: Building values, Up: Parsing arguments and building values + +7.6.6.1 Parsing arguments +......................... + +A format string consists of zero or more “format units.” A format unit +describes one Python object; it is usually a single character or a +parenthesized sequence of format units. With a few exceptions, a format +unit that is not a parenthesized sequence normally corresponds to a +single address argument to these functions. In the following +description, the quoted form is the format unit; the entry in (round) +parentheses is the Python object type that matches the format unit; and +the entry in [square] brackets is the type of the C variable(s) whose +address should be passed. + +* Menu: + +* Strings and buffers:: +* Numbers: Numbers<2>. +* Other objects:: +* API Functions:: + + +File: python.info, Node: Strings and buffers, Next: Numbers<2>, Up: Parsing arguments<2> + +7.6.6.2 Strings and buffers +........................... + + Note: On Python 3.12 and older, the macro ‘PY_SSIZE_T_CLEAN’ must + be defined before including ‘Python.h’ to use all ‘#’ variants of + formats (‘s#’, ‘y#’, etc.) explained below. This is not necessary + on Python 3.13 and later. + +These formats allow accessing an object as a contiguous chunk of memory. +You don’t have to provide raw storage for the returned unicode or bytes +area. + +Unless otherwise stated, buffers are not NUL-terminated. + +There are three ways strings and buffers can be converted to C: + + * Formats such as ‘y*’ and ‘s*’ fill a *note Py_buffer: 753. + structure. This locks the underlying buffer so that the caller can + subsequently use the buffer even inside a *note + Py_BEGIN_ALLOW_THREADS: 48d7. block without the risk of mutable + data being resized or destroyed. As a result, 'you have to call' + *note PyBuffer_Release(): 396. after you have finished processing + the data (or in any early abort case). + + * The ‘es’, ‘es#’, ‘et’ and ‘et#’ formats allocate the result buffer. + 'You have to call' *note PyMem_Free(): 140e. after you have + finished processing the data (or in any early abort case). + + * Other formats take a *note str: 447. or a read-only *note + bytes-like object: d2d, such as *note bytes: 1c2, and provide a + ‘const char *’ pointer to its buffer. In this case the buffer is + “borrowed”: it is managed by the corresponding Python object, and + shares the lifetime of this object. You won’t have to release any + memory yourself. + + To ensure that the underlying buffer may be safely borrowed, the + object’s *note PyBufferProcs.bf_releasebuffer: 75e. field must be + ‘NULL’. This disallows common mutable objects such as *note + bytearray: 53a, but also some read-only objects such as *note + memoryview: 464. of *note bytes: 1c2. + + Besides this ‘bf_releasebuffer’ requirement, there is no check to + verify whether the input object is immutable (e.g. whether it + would honor a request for a writable buffer, or whether another + thread can mutate the data). + +‘s’ (*note str: 447.) [const char *] + + Convert a Unicode object to a C pointer to a character string. A + pointer to an existing string is stored in the character pointer + variable whose address you pass. The C string is NUL-terminated. + The Python string must not contain embedded null code points; if it + does, a *note ValueError: 204. exception is raised. Unicode + objects are converted to C strings using ‘'utf-8'’ encoding. If + this conversion fails, a *note UnicodeError: 1296. is raised. + + Note: This format does not accept *note bytes-like objects: + d2d. If you want to accept filesystem paths and convert them + to C character strings, it is preferable to use the ‘O&’ + format with *note PyUnicode_FSConverter(): d19. as + 'converter'. + + Changed in version 3.5: Previously, *note TypeError: 534. was + raised when embedded null code points were encountered in the + Python string. + +‘s*’ (*note str: 447. or *note bytes-like object: d2d.) [Py_buffer] + + This format accepts Unicode objects as well as bytes-like objects. + It fills a *note Py_buffer: 753. structure provided by the caller. + In this case the resulting C string may contain embedded NUL bytes. + Unicode objects are converted to C strings using ‘'utf-8'’ + encoding. + +‘s#’ (*note str: 447, read-only *note bytes-like object: d2d.) [const char *, *note Py_ssize_t: a5f.] + + Like ‘s*’, except that it provides a *note borrowed buffer: 4b66. + The result is stored into two C variables, the first one a pointer + to a C string, the second one its length. The string may contain + embedded null bytes. Unicode objects are converted to C strings + using ‘'utf-8'’ encoding. + +‘z’ (*note str: 447. or ‘None’) [const char *] + + Like ‘s’, but the Python object may also be ‘None’, in which case + the C pointer is set to ‘NULL’. + +‘z*’ (*note str: 447, *note bytes-like object: d2d. or ‘None’) [Py_buffer] + + Like ‘s*’, but the Python object may also be ‘None’, in which case + the ‘buf’ member of the *note Py_buffer: 753. structure is set to + ‘NULL’. + +‘z#’ (*note str: 447, read-only *note bytes-like object: d2d. or ‘None’) [const char *, *note Py_ssize_t: a5f.] + + Like ‘s#’, but the Python object may also be ‘None’, in which case + the C pointer is set to ‘NULL’. + +‘y’ (read-only *note bytes-like object: d2d.) [const char *] + + This format converts a bytes-like object to a C pointer to a *note + borrowed: 4b66. character string; it does not accept Unicode + objects. The bytes buffer must not contain embedded null bytes; if + it does, a *note ValueError: 204. exception is raised. + + Changed in version 3.5: Previously, *note TypeError: 534. was + raised when embedded null bytes were encountered in the bytes + buffer. + +‘y*’ (*note bytes-like object: d2d.) [Py_buffer] + + This variant on ‘s*’ doesn’t accept Unicode objects, only + bytes-like objects. 'This is the recommended way to accept binary + data.' + +‘y#’ (read-only *note bytes-like object: d2d.) [const char *, *note Py_ssize_t: a5f.] + + This variant on ‘s#’ doesn’t accept Unicode objects, only + bytes-like objects. + +‘S’ (*note bytes: 1c2.) [PyBytesObject *] + + Requires that the Python object is a *note bytes: 1c2. object, + without attempting any conversion. Raises *note TypeError: 534. if + the object is not a bytes object. The C variable may also be + declared as *note PyObject: 334.*. + +‘Y’ (*note bytearray: 53a.) [PyByteArrayObject *] + + Requires that the Python object is a *note bytearray: 53a. object, + without attempting any conversion. Raises *note TypeError: 534. if + the object is not a *note bytearray: 53a. object. The C variable + may also be declared as *note PyObject: 334.*. + +‘U’ (*note str: 447.) [PyObject *] + + Requires that the Python object is a Unicode object, without + attempting any conversion. Raises *note TypeError: 534. if the + object is not a Unicode object. The C variable may also be + declared as *note PyObject: 334.*. + +‘w*’ (read-write *note bytes-like object: d2d.) [Py_buffer] + + This format accepts any object which implements the read-write + buffer interface. It fills a *note Py_buffer: 753. structure + provided by the caller. The buffer may contain embedded null + bytes. The caller have to call *note PyBuffer_Release(): 396. when + it is done with the buffer. + +‘es’ (*note str: 447.) [const char *encoding, char **buffer] + + This variant on ‘s’ is used for encoding Unicode into a character + buffer. It only works for encoded data without embedded NUL bytes. + + This format requires two arguments. The first is only used as + input, and must be a const char* which points to the name of an + encoding as a NUL-terminated string, or ‘NULL’, in which case + ‘'utf-8'’ encoding is used. An exception is raised if the named + encoding is not known to Python. The second argument must be a + char**; the value of the pointer it references will be set to a + buffer with the contents of the argument text. The text will be + encoded in the encoding specified by the first argument. + + *note PyArg_ParseTuple(): 56e. will allocate a buffer of the needed + size, copy the encoded data into this buffer and adjust '*buffer' + to reference the newly allocated storage. The caller is + responsible for calling *note PyMem_Free(): 140e. to free the + allocated buffer after use. + +‘et’ (*note str: 447, *note bytes: 1c2. or *note bytearray: 53a.) [const char *encoding, char **buffer] + + Same as ‘es’ except that byte string objects are passed through + without recoding them. Instead, the implementation assumes that + the byte string object uses the encoding passed in as parameter. + +‘es#’ (*note str: 447.) [const char *encoding, char **buffer, *note Py_ssize_t: a5f. *buffer_length] + + This variant on ‘s#’ is used for encoding Unicode into a character + buffer. Unlike the ‘es’ format, this variant allows input data + which contains NUL characters. + + It requires three arguments. The first is only used as input, and + must be a const char* which points to the name of an encoding as a + NUL-terminated string, or ‘NULL’, in which case ‘'utf-8'’ encoding + is used. An exception is raised if the named encoding is not known + to Python. The second argument must be a char**; the value of the + pointer it references will be set to a buffer with the contents of + the argument text. The text will be encoded in the encoding + specified by the first argument. The third argument must be a + pointer to an integer; the referenced integer will be set to the + number of bytes in the output buffer. + + There are two modes of operation: + + If '*buffer' points a ‘NULL’ pointer, the function will allocate a + buffer of the needed size, copy the encoded data into this buffer + and set '*buffer' to reference the newly allocated storage. The + caller is responsible for calling *note PyMem_Free(): 140e. to free + the allocated buffer after usage. + + If '*buffer' points to a non-‘NULL’ pointer (an already allocated + buffer), *note PyArg_ParseTuple(): 56e. will use this location as + the buffer and interpret the initial value of '*buffer_length' as + the buffer size. It will then copy the encoded data into the + buffer and NUL-terminate it. If the buffer is not large enough, a + *note ValueError: 204. will be set. + + In both cases, '*buffer_length' is set to the length of the encoded + data without the trailing NUL byte. + +‘et#’ (*note str: 447, *note bytes: 1c2. or *note bytearray: 53a.) [const char *encoding, char **buffer, *note Py_ssize_t: a5f. *buffer_length] + + Same as ‘es#’ except that byte string objects are passed through + without recoding them. Instead, the implementation assumes that + the byte string object uses the encoding passed in as parameter. + +Changed in version 3.12: ‘u’, ‘u#’, ‘Z’, and ‘Z#’ are removed because +they used a legacy ‘Py_UNICODE*’ representation. + + +File: python.info, Node: Numbers<2>, Next: Other objects, Prev: Strings and buffers, Up: Parsing arguments<2> + +7.6.6.3 Numbers +............... + +These formats allow representing Python numbers or single characters as +C numbers. Formats that require *note int: 259, *note float: 2f1. or +*note complex: 2f2. can also use the corresponding special methods *note +__index__(): 718, *note __float__(): 9cc. or *note __complex__(): 5e3. +to convert the Python object to the required type. + +For signed integer formats, *note OverflowError: 87f. is raised if the +value is out of range for the C type. For unsigned integer formats, no +range checking is done — the most significant bits are silently +truncated when the receiving field is too small to receive the value. + +‘b’ (*note int: 259.) [unsigned char] + + Convert a nonnegative Python integer to an unsigned tiny integer, + stored in a C unsigned char. + +‘B’ (*note int: 259.) [unsigned char] + + Convert a Python integer to a tiny integer without overflow + checking, stored in a C unsigned char. + +‘h’ (*note int: 259.) [short int] + + Convert a Python integer to a C short int. + +‘H’ (*note int: 259.) [unsigned short int] + + Convert a Python integer to a C unsigned short int, without + overflow checking. + +‘i’ (*note int: 259.) [int] + + Convert a Python integer to a plain C int. + +‘I’ (*note int: 259.) [unsigned int] + + Convert a Python integer to a C unsigned int, without overflow + checking. + +‘l’ (*note int: 259.) [long int] + + Convert a Python integer to a C long int. + +‘k’ (*note int: 259.) [unsigned long] + + Convert a Python integer to a C unsigned long without overflow + checking. + +‘L’ (*note int: 259.) [long long] + + Convert a Python integer to a C long long. + +‘K’ (*note int: 259.) [unsigned long long] + + Convert a Python integer to a C unsigned long long without overflow + checking. + +‘n’ (*note int: 259.) [*note Py_ssize_t: a5f.] + + Convert a Python integer to a C *note Py_ssize_t: a5f. + +‘c’ (*note bytes: 1c2. or *note bytearray: 53a. of length 1) [char] + + Convert a Python byte, represented as a *note bytes: 1c2. or *note + bytearray: 53a. object of length 1, to a C char. + + Changed in version 3.3: Allow *note bytearray: 53a. objects. + +‘C’ (*note str: 447. of length 1) [int] + + Convert a Python character, represented as a *note str: 447. object + of length 1, to a C int. + +‘f’ (*note float: 2f1.) [float] + + Convert a Python floating-point number to a C float. + +‘d’ (*note float: 2f1.) [double] + + Convert a Python floating-point number to a C double. + +‘D’ (*note complex: 2f2.) [Py_complex] + + Convert a Python complex number to a C *note Py_complex: 4b68. + structure. + + +File: python.info, Node: Other objects, Next: API Functions, Prev: Numbers<2>, Up: Parsing arguments<2> + +7.6.6.4 Other objects +..................... + +‘O’ (object) [PyObject *] + + Store a Python object (without any conversion) in a C object + pointer. The C program thus receives the actual object that was + passed. A new *note strong reference: 338. to the object is not + created (i.e. its reference count is not increased). The pointer + stored is not ‘NULL’. + +‘O!’ (object) ['typeobject', PyObject *] + + Store a Python object in a C object pointer. This is similar to + ‘O’, but takes two C arguments: the first is the address of a + Python type object, the second is the address of the C variable (of + type *note PyObject: 334.*) into which the object pointer is + stored. If the Python object does not have the required type, + *note TypeError: 534. is raised. + +‘O&’ (object) ['converter', 'address'] + + Convert a Python object to a C variable through a 'converter' + function. This takes two arguments: the first is a function, the + second is the address of a C variable (of arbitrary type), + converted to void*. The 'converter' function in turn is called as + follows: + + status = converter(object, address); + + where 'object' is the Python object to be converted and 'address' + is the void* argument that was passed to the ‘PyArg_Parse*’ + function. The returned 'status' should be ‘1’ for a successful + conversion and ‘0’ if the conversion has failed. When the + conversion fails, the 'converter' function should raise an + exception and leave the content of 'address' unmodified. + + 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(): d19. and + *note PyUnicode_FSDecoder(): 574. + + Changed in version 3.1: ‘Py_CLEANUP_SUPPORTED’ was added. + +‘p’ (*note bool: 463.) [int] + + Tests the value passed in for truth (a boolean 'p'redicate) and + converts the result to its equivalent C true/false integer value. + Sets the int to ‘1’ if the expression was true and ‘0’ if it was + false. This accepts any valid Python value. See *note Truth Value + Testing: 1548. for more information about how Python tests values + for truth. + + Added in version 3.3. + +‘(items)’ (*note tuple: 36b.) ['matching-items'] + + The object must be a Python sequence 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. + +A few other characters have a meaning in a format string. These may not +occur inside nested parentheses. They are: + +‘|’ + + Indicates that the remaining arguments in the Python argument list + are optional. The C variables corresponding to optional arguments + should be initialized to their default value — when an optional + argument is not specified, *note PyArg_ParseTuple(): 56e. does not + touch the contents of the corresponding C variable(s). + +‘$’ + + *note PyArg_ParseTupleAndKeywords(): 37e. only: Indicates that the + remaining arguments in the Python argument list are keyword-only. + Currently, all keyword-only arguments must also be optional + arguments, so ‘|’ must always be specified before ‘$’ in the format + string. + + Added in version 3.3. + +‘:’ + + The list of format units ends here; the string after the colon is + used as the function name in error messages (the “associated value” + of the exception that *note PyArg_ParseTuple(): 56e. raises). + +‘;’ + + The list of format units ends here; the string after the semicolon + is used as the error message 'instead' of the default error + message. ‘:’ and ‘;’ mutually exclude each other. + +Note that any Python object references which are provided to the caller +are 'borrowed' references; do not release them (i.e. do not decrement +their reference count)! + +Additional arguments passed to these functions must be addresses of +variables whose type is determined by the format string; these are used +to store values from the input tuple. There are a few cases, as +described in the list of format units above, where these parameters are +used as input values; they should match what is specified for the +corresponding format unit in that case. + +For the conversion to succeed, the 'arg' object must match the format +and the format must be exhausted. On success, the ‘PyArg_Parse*’ +functions return true, otherwise they return false and raise an +appropriate exception. When the ‘PyArg_Parse*’ functions fail due to +conversion failure in one of the format units, the variables at the +addresses corresponding to that and the following format units are left +untouched. + + +File: python.info, Node: API Functions, Prev: Other objects, Up: Parsing arguments<2> + +7.6.6.5 API Functions +..................... + + -- C Function: int PyArg_ParseTuple (PyObject *args, const char + *format, ...) + ' Part of the *note Stable ABI: 550.' Parse the parameters of a + function that takes only positional parameters into local + variables. Returns true on success; on failure, it returns false + and raises the appropriate exception. + + -- C Function: int PyArg_VaParse (PyObject *args, const char *format, + va_list vargs) + ' Part of the *note Stable ABI: 550.' Identical to *note + PyArg_ParseTuple(): 56e, except that it accepts a va_list rather + than a variable number of arguments. + + -- C Function: int PyArg_ParseTupleAndKeywords (PyObject *args, + PyObject *kw, const char *format, char *const *keywords, ...) + ' Part of the *note Stable ABI: 550.' 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: a85. Returns true on success; on + failure, it returns false and raises the appropriate exception. + + Note: 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: 380. macro. + + Changed in version 3.6: Added support for *note positional-only + parameters: a85. + + Changed in version 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 Function: int PyArg_VaParseTupleAndKeywords (PyObject *args, + PyObject *kw, const char *format, char *const *keywords, + va_list vargs) + ' Part of the *note Stable ABI: 550.' Identical to *note + PyArg_ParseTupleAndKeywords(): 37e, except that it accepts a + va_list rather than a variable number of arguments. + + -- C Function: int PyArg_ValidateKeywordArguments (PyObject*) + ' Part of the *note Stable ABI: 550.' Ensure that the keys in the + keywords argument dictionary are strings. This is only needed if + *note PyArg_ParseTupleAndKeywords(): 37e. is not used, since the + latter already does this check. + + Added in version 3.2. + + -- C Function: int PyArg_Parse (PyObject *args, const char *format, + ...) + ' Part of the *note Stable ABI: 550.' 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. + + Example: + + // 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 Function: int PyArg_UnpackTuple (PyObject *args, const char *name, + Py_ssize_t min, Py_ssize_t max, ...) + ' Part of the *note Stable ABI: 550.' A simpler form of parameter + retrieval which does not use a format string to specify the types + of the arguments. Functions which use this method to retrieve + their parameters should be declared as *note METH_VARARGS: 14d4. in + function or method tables. The tuple containing the actual + parameters should be passed as 'args'; it must actually be a tuple. + The length of the tuple must be at least 'min' and no more than + 'max'; 'min' and 'max' may be equal. Additional arguments must be + passed to the function, each of which should be a pointer to a + *note PyObject: 334.* variable; these will be filled in with the + values from 'args'; they will contain *note borrowed references: + 339. The variables which correspond to optional parameters not + given by 'args' will not be filled in; these should be initialized + by the caller. This function returns true on success and false if + 'args' is not a tuple or contains the wrong number of elements; an + exception will be set if there was a failure. + + This is an example of the use of this function, taken from the + sources for the ‘_weakref’ helper module for weak references: + + 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; + } + + The call to *note PyArg_UnpackTuple(): 14d2. in this example is + entirely equivalent to this call to *note PyArg_ParseTuple(): 56e.: + + PyArg_ParseTuple(args, "O|O:ref", &object, &callback) + + -- C Macro: PY_CXX_CONST + + The value to be inserted, if any, before char *const* in the + 'keywords' parameter declaration of *note + PyArg_ParseTupleAndKeywords(): 37e. and *note + PyArg_VaParseTupleAndKeywords(): 37f. 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: Building values, Prev: Parsing arguments<2>, Up: Parsing arguments and building values + +7.6.6.6 Building values +....................... + + -- C Function: *note PyObject: 334. *Py_BuildValue (const char *format, + ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a new value based on a format string similar to those + accepted by the ‘PyArg_Parse*’ family of functions and a sequence + of values. Returns the value or ‘NULL’ in the case of an error; an + exception will be raised if ‘NULL’ is returned. + + *note Py_BuildValue(): 8a6. does not always build a tuple. It + builds a tuple only if its format string contains two or more + format units. If the format string is empty, it returns ‘None’; if + it contains exactly one format unit, it returns whatever object is + described by that format unit. To force it to return a tuple of + size 0 or one, parenthesize the format string. + + When memory buffers are passed as parameters to supply data to + build objects, as for the ‘s’ and ‘s#’ formats, the required data + is copied. Buffers provided by the caller are never referenced by + the objects created by *note Py_BuildValue(): 8a6. In other words, + if your code invokes ‘malloc()’ and passes the allocated memory to + *note Py_BuildValue(): 8a6, your code is responsible for calling + ‘free()’ for that memory once *note Py_BuildValue(): 8a6. returns. + + In the following description, the quoted form is the format unit; + the entry in (round) parentheses is the Python object type that the + format unit will return; and the entry in [square] brackets is the + type of the C value(s) to be passed. + + The characters space, tab, colon and comma are ignored in format + strings (but not within format units such as ‘s#’). This can be + used to make long format strings a tad more readable. + + ‘s’ (*note str: 447. or ‘None’) [const char *] + + Convert a null-terminated C string to a Python *note str: 447. + object using ‘'utf-8'’ encoding. If the C string pointer is + ‘NULL’, ‘None’ is used. + + ‘s#’ (*note str: 447. or ‘None’) [const char *, *note Py_ssize_t: a5f.] + + Convert a C string and its length to a Python *note str: 447. + object using ‘'utf-8'’ encoding. If the C string pointer is + ‘NULL’, the length is ignored and ‘None’ is returned. + + ‘y’ (*note bytes: 1c2.) [const char *] + + This converts a C string to a Python *note bytes: 1c2. object. + If the C string pointer is ‘NULL’, ‘None’ is returned. + + ‘y#’ (*note bytes: 1c2.) [const char *, *note Py_ssize_t: a5f.] + + This converts a C string and its lengths to a Python object. + If the C string pointer is ‘NULL’, ‘None’ is returned. + + ‘z’ (*note str: 447. or ‘None’) [const char *] + + Same as ‘s’. + + ‘z#’ (*note str: 447. or ‘None’) [const char *, *note Py_ssize_t: a5f.] + + Same as ‘s#’. + + ‘u’ (*note str: 447.) [const wchar_t *] + + Convert a null-terminated ‘wchar_t’ buffer of Unicode (UTF-16 + or UCS-4) data to a Python Unicode object. If the Unicode + buffer pointer is ‘NULL’, ‘None’ is returned. + + ‘u#’ (*note str: 447.) [const wchar_t *, *note Py_ssize_t: a5f.] + + Convert a Unicode (UTF-16 or UCS-4) data buffer and its length + to a Python Unicode object. If the Unicode buffer pointer is + ‘NULL’, the length is ignored and ‘None’ is returned. + + ‘U’ (*note str: 447. or ‘None’) [const char *] + + Same as ‘s’. + + ‘U#’ (*note str: 447. or ‘None’) [const char *, *note Py_ssize_t: a5f.] + + Same as ‘s#’. + + ‘i’ (*note int: 259.) [int] + + Convert a plain C int to a Python integer object. + + ‘b’ (*note int: 259.) [char] + + Convert a plain C char to a Python integer object. + + ‘h’ (*note int: 259.) [short int] + + Convert a plain C short int to a Python integer object. + + ‘l’ (*note int: 259.) [long int] + + Convert a C long int to a Python integer object. + + ‘B’ (*note int: 259.) [unsigned char] + + Convert a C unsigned char to a Python integer object. + + ‘H’ (*note int: 259.) [unsigned short int] + + Convert a C unsigned short int to a Python integer object. + + ‘I’ (*note int: 259.) [unsigned int] + + Convert a C unsigned int to a Python integer object. + + ‘k’ (*note int: 259.) [unsigned long] + + Convert a C unsigned long to a Python integer object. + + ‘L’ (*note int: 259.) [long long] + + Convert a C long long to a Python integer object. + + ‘K’ (*note int: 259.) [unsigned long long] + + Convert a C unsigned long long to a Python integer object. + + ‘n’ (*note int: 259.) [*note Py_ssize_t: a5f.] + + Convert a C *note Py_ssize_t: a5f. to a Python integer. + + ‘c’ (*note bytes: 1c2. of length 1) [char] + + Convert a C int representing a byte to a Python *note bytes: + 1c2. object of length 1. + + ‘C’ (*note str: 447. of length 1) [int] + + Convert a C int representing a character to Python *note str: + 447. object of length 1. + + ‘d’ (*note float: 2f1.) [double] + + Convert a C double to a Python floating-point number. + + ‘f’ (*note float: 2f1.) [float] + + Convert a C float to a Python floating-point number. + + ‘D’ (*note complex: 2f2.) [Py_complex *] + + Convert a C *note Py_complex: 4b68. structure to a Python + complex number. + + ‘O’ (object) [PyObject *] + + Pass a Python object untouched but create a new *note strong + reference: 338. to it (i.e. its reference count is + incremented by one). If the object passed in is a ‘NULL’ + pointer, it is assumed that this was caused because the call + producing the argument found an error and set an exception. + Therefore, *note Py_BuildValue(): 8a6. will return ‘NULL’ but + won’t raise an exception. If no exception has been raised + yet, *note SystemError: 572. is set. + + ‘S’ (object) [PyObject *] + + Same as ‘O’. + + ‘N’ (object) [PyObject *] + + Same as ‘O’, except it doesn’t create a new *note strong + reference: 338. Useful when the object is created by a call + to an object constructor in the argument list. + + ‘O&’ (object) ['converter', 'anything'] + + Convert 'anything' to a Python object through a 'converter' + function. The function is called with 'anything' (which + should be compatible with void*) as its argument and should + return a “new” Python object, or ‘NULL’ if an error occurred. + + ‘(items)’ (*note tuple: 36b.) ['matching-items'] + + Convert a sequence of C values to a Python tuple with the same + number of items. + + ‘[items]’ (*note list: 60d.) ['matching-items'] + + Convert a sequence of C values to a Python list with the same + number of items. + + ‘{items}’ (*note dict: 258.) ['matching-items'] + + Convert a sequence of C values to a Python dictionary. Each + pair of consecutive C values adds one item to the dictionary, + serving as key and value, respectively. + + If there is an error in the format string, the *note SystemError: + 572. exception is set and ‘NULL’ returned. + + -- C Function: *note PyObject: 334. *Py_VaBuildValue (const char + *format, va_list vargs) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Identical to *note Py_BuildValue(): 8a6, except that it + accepts a va_list rather than a variable number of arguments. + + +File: python.info, Node: String conversion and formatting, Next: PyHash API, Prev: Parsing arguments and building values, Up: Utilities<2> + +7.6.7 String conversion and formatting +-------------------------------------- + +Functions for number conversion and formatted string output. + + -- C Function: int PyOS_snprintf (char *str, size_t size, const char + *format, ...) + ' Part of the *note Stable ABI: 550.' Output not more than 'size' + bytes to 'str' according to the format string 'format' and the + extra arguments. See the Unix man page ‘snprintf(3)(1)’. + + -- C Function: int PyOS_vsnprintf (char *str, size_t size, const char + *format, va_list va) + ' Part of the *note Stable ABI: 550.' Output not more than 'size' + bytes to 'str' according to the format string 'format' and the + variable argument list 'va'. Unix man page ‘vsnprintf(3)(2)’. + +*note PyOS_snprintf(): 14d5. and *note PyOS_vsnprintf(): 14d6. wrap the +Standard C library functions ‘snprintf()’ and ‘vsnprintf()’. Their +purpose is to guarantee consistent behavior in corner cases, which the +Standard C functions do not. + +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. + +The return value ('rv') for these functions should be interpreted as +follows: + + * When ‘0 <= rv < size’, the output conversion was successful and + 'rv' characters were written to 'str' (excluding the trailing + ‘'\0'’ byte at ‘str[rv]’). + + * When ‘rv >= size’, the output conversion was truncated and a buffer + with ‘rv + 1’ bytes would have been needed to succeed. + ‘str[size-1]’ is ‘'\0'’ in this case. + + * When ‘rv < 0’, “something bad happened.” ‘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. + +The following functions provide locale-independent string to number +conversions. + + -- C Function: unsigned long PyOS_strtoul (const char *str, char **ptr, + int base) + ' Part of the *note Stable ABI: 550.' 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 Function: long PyOS_strtol (const char *str, char **ptr, int base) + ' Part of the *note Stable ABI: 550.' 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(): 4a56, 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 Function: double PyOS_string_to_double (const char *s, char + **endptr, PyObject *overflow_exception) + ' Part of the *note Stable ABI: 550.' Convert a string ‘s’ to a + double, raising a Python exception on failure. The set of accepted + strings corresponds to the set of strings accepted by Python’s + *note float(): 2f1. constructor, except that ‘s’ must not have + leading or trailing whitespace. The conversion is independent of + the current locale. + + If ‘endptr’ is ‘NULL’, convert the whole string. Raise *note + ValueError: 204. and return ‘-1.0’ if the string is not a valid + representation of a floating-point number. + + If endptr is not ‘NULL’, convert as much of the string as possible + and set ‘*endptr’ to point to the first unconverted character. If + no initial segment of the string is the valid representation of a + floating-point number, set ‘*endptr’ to point to the beginning of + the string, raise ValueError, and return ‘-1.0’. + + If ‘s’ represents a value that is too large to store in a float + (for example, ‘"1e500"’ is such a string on many platforms) then if + ‘overflow_exception’ is ‘NULL’ return ‘Py_HUGE_VAL’ (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. + + If any other error occurs during the conversion (for example an + out-of-memory error), set the appropriate Python exception and + return ‘-1.0’. + + Added in version 3.1. + + -- C Function: char *PyOS_double_to_string (double val, char + format_code, int precision, int flags, int *ptype) + ' Part of the *note Stable ABI: 550.' Convert a double 'val' to a + string using supplied 'format_code', 'precision', and 'flags'. + + 'format_code' must be one of ‘'e'’, ‘'E'’, ‘'f'’, ‘'F'’, ‘'g'’, + ‘'G'’ or ‘'r'’. For ‘'r'’, the supplied 'precision' must be 0 and + is ignored. The ‘'r'’ format code specifies the standard *note + repr(): 7f9. format. + + 'flags' can be zero or more of the values ‘Py_DTSF_SIGN’, + ‘Py_DTSF_ADD_DOT_0’, or ‘Py_DTSF_ALT’, or-ed together: + + * ‘Py_DTSF_SIGN’ means to always precede the returned string + with a sign character, even if 'val' is non-negative. + + * ‘Py_DTSF_ADD_DOT_0’ means to ensure that the returned string + will not look like an integer. + + * ‘Py_DTSF_ALT’ means to apply “alternate” formatting rules. + See the documentation for the *note PyOS_snprintf(): 14d5. + ‘'#'’ specifier for details. + + If 'ptype' is non-‘NULL’, then the value it points to will be set + to one of ‘Py_DTST_FINITE’, ‘Py_DTST_INFINITE’, or ‘Py_DTST_NAN’, + signifying that 'val' is a finite number, an infinite number, or + not a number, respectively. + + The return value is a pointer to 'buffer' with the converted string + or ‘NULL’ if the conversion failed. The caller is responsible for + freeing the returned string by calling *note PyMem_Free(): 140e. + + Added in version 3.1. + + -- C Function: int PyOS_stricmp (const char *s1, const char *s2) + + Case insensitive comparison of strings. The function works almost + identically to ‘strcmp()’ except that it ignores the case. + + -- C Function: int PyOS_strnicmp (const char *s1, const char *s2, + Py_ssize_t size) + + Case insensitive comparison of strings. The function works almost + identically to ‘strncmp()’ except that it ignores the case. + + ---------- 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: PyHash API, Next: Reflection, Prev: String conversion and formatting, Up: Utilities<2> + +7.6.8 PyHash API +---------------- + +See also the *note PyTypeObject.tp_hash: 490f. member and *note Hashing +of numeric types: 21a0. + + -- C Type: type Py_hash_t + + Hash value type: signed integer. + + Added in version 3.2. + + -- C Type: type Py_uhash_t + + Hash value type: unsigned integer. + + Added in version 3.2. + + -- C Macro: PyHASH_MODULUS + + The Mersenne prime(1) ‘P = 2**n -1’, used for numeric hash scheme. + + Added in version 3.13. + + -- C Macro: PyHASH_BITS + + The exponent ‘n’ of ‘P’ in *note PyHASH_MODULUS: 1669. + + Added in version 3.13. + + -- C Macro: PyHASH_MULTIPLIER + + Prime multiplier used in string and various other hashes. + + Added in version 3.13. + + -- C Macro: PyHASH_INF + + The hash value returned for a positive infinity. + + Added in version 3.13. + + -- C Macro: PyHASH_IMAG + + The multiplier used for the imaginary part of a complex number. + + Added in version 3.13. + + -- C Type: type PyHash_FuncDef + + Hash function definition used by *note PyHash_GetFuncDef(): 4b77. + + -- C Member: *note Py_hash_t: 1257. (*const hash)(const void*, + *note Py_ssize_t: a5f.) + + Hash function. + + -- C Member: const char *name + + Hash function name (UTF-8 encoded string). + + -- C Member: const int hash_bits + + Internal size of the hash value in bits. + + -- C Member: const int seed_bits + + Size of seed input in bits. + + Added in version 3.4. + + -- C Function: *note PyHash_FuncDef: 4b76. *PyHash_GetFuncDef (void) + + Get the hash function definition. + + See also + ........ + + PEP 456(2) “Secure and interchangeable hash algorithm”. + + Added in version 3.4. + + -- C Function: *note Py_hash_t: 1257. 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 Function: *note Py_hash_t: 1257. 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 implementation detail:' In CPython, it is equivalent to + *note Py_HashPointer(): 363. + + 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: Reflection, Next: Codec registry and support functions, Prev: PyHash API, Up: Utilities<2> + +7.6.9 Reflection +---------------- + + -- C Function: *note PyObject: 334. *PyEval_GetBuiltins (void) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' + + Deprecated since version 3.13: Use *note PyEval_GetFrameBuiltins(): + 34b. instead. + + Return a dictionary of the builtins in the current execution frame, + or the interpreter of the thread state if no frame is currently + executing. + + -- C Function: *note PyObject: 334. *PyEval_GetLocals (void) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' + + Deprecated since version 3.13: Use either *note + PyEval_GetFrameLocals(): 34f. to obtain the same behaviour as + calling *note locals(): 141. in Python code, or else call *note + PyFrame_GetLocals(): 41b. on the result of *note PyEval_GetFrame(): + 17bc. to access the *note f_locals: 182. 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(): 141. for details of the mapping returned + at different scopes. + + As this function returns a *note borrowed reference: 339, the + dictionary returned for *note optimized scopes: 17e. is cached on + the frame object and will remain alive as long as the frame object + does. Unlike *note PyEval_GetFrameLocals(): 34f. and *note + locals(): 141, 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. + + Changed in version 3.13: As part of PEP 667(1), *note + PyFrame_GetLocals(): 41b, *note locals(): 141, and *note + FrameType.f_locals: 182. no longer make use of the shared cache + dictionary. Refer to the *note What’s New entry: 142. for + additional details. + + -- C Function: *note PyObject: 334. *PyEval_GetGlobals (void) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' + + Deprecated since version 3.13: Use *note PyEval_GetFrameGlobals(): + 34d. instead. + + Return a dictionary of the global variables in the current + execution frame, or ‘NULL’ if no frame is currently executing. + + -- C Function: *note PyFrameObject: 784. *PyEval_GetFrame (void) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return the current thread state’s frame, which is ‘NULL’ if + no frame is currently executing. + + See also *note PyThreadState_GetFrame(): 789. + + -- C Function: *note PyObject: 334. *PyEval_GetFrameBuiltins (void) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.13.' Return a dictionary of the builtins in the + current execution frame, or the interpreter of the thread state if + no frame is currently executing. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyEval_GetFrameLocals (void) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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(): 141. in Python + code. + + To access *note f_locals: 182. on the current frame without making + an independent snapshot in *note optimized scopes: 17e, call *note + PyFrame_GetLocals(): 41b. on the result of *note PyEval_GetFrame(): + 17bc. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyEval_GetFrameGlobals (void) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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(): 1867. in Python + code. + + Added in version 3.13. + + -- C Function: const char *PyEval_GetFuncName (PyObject *func) + ' Part of the *note Stable ABI: 550.' Return the name of 'func' if + it is a function, class or instance object, else the name of + 'func's type. + + -- C Function: const char *PyEval_GetFuncDesc (PyObject *func) + ' Part of the *note Stable ABI: 550.' Return a description string, + depending on the type of 'func'. Return values include “()” for + functions and methods, “ constructor”, “ instance”, and “ object”. + Concatenated with the result of *note PyEval_GetFuncName(): 49b6, + the result will be a description of 'func'. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0667/ + + +File: python.info, Node: Codec registry and support functions, Next: PyTime C API, Prev: Reflection, Up: Utilities<2> + +7.6.10 Codec registry and support functions +------------------------------------------- + + -- C Function: int PyCodec_Register (PyObject *search_function) + ' Part of the *note Stable ABI: 550.' Register a new codec search + function. + + As 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 Function: int PyCodec_Unregister (PyObject *search_function) + ' Part of the *note Stable ABI: 550. since version 3.10.' + Unregister a codec search function and clear the registry’s cache. + If the search function is not registered, do nothing. Return 0 on + success. Raise an exception and return -1 on error. + + Added in version 3.10. + + -- C Function: int PyCodec_KnownEncoding (const char *encoding) + ' Part of the *note Stable ABI: 550.' Return ‘1’ or ‘0’ depending + on whether there is a registered codec for the given 'encoding'. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PyCodec_Encode (PyObject *object, + const char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Generic codec based encoding API. + + 'object' is passed through the encoder 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: 21cc. if no encoder can be + found. + + -- C Function: *note PyObject: 334. *PyCodec_Decode (PyObject *object, + const char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Generic codec based decoding 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: 21cc. if no encoder can be + found. + +* Menu: + +* Codec lookup API:: +* Registry API for Unicode encoding error handlers:: + + +File: python.info, Node: Codec lookup API, Next: Registry API for Unicode encoding error handlers, Up: Codec registry and support functions + +7.6.10.1 Codec lookup API +......................... + +In the following functions, the 'encoding' string is looked up converted +to all lower-case characters, which makes encodings looked up through +this mechanism effectively case-insensitive. If no codec is found, a +*note KeyError: 33f. is set and ‘NULL’ returned. + + -- C Function: *note PyObject: 334. *PyCodec_Encoder (const char + *encoding) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get an encoder function for the given 'encoding'. + + -- C Function: *note PyObject: 334. *PyCodec_Decoder (const char + *encoding) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get a decoder function for the given 'encoding'. + + -- C Function: *note PyObject: 334. *PyCodec_IncrementalEncoder (const + char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get an *note IncrementalEncoder: 23c9. object for the given + 'encoding'. + + -- C Function: *note PyObject: 334. *PyCodec_IncrementalDecoder (const + char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get an *note IncrementalDecoder: 23ca. object for the given + 'encoding'. + + -- C Function: *note PyObject: 334. *PyCodec_StreamReader (const char + *encoding, PyObject *stream, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get a *note StreamReader: 23ce. factory function for the + given 'encoding'. + + -- C Function: *note PyObject: 334. *PyCodec_StreamWriter (const char + *encoding, PyObject *stream, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Get a *note StreamWriter: 23cd. factory function for the + given 'encoding'. + + +File: python.info, Node: Registry API for Unicode encoding error handlers, Prev: Codec lookup API, Up: Codec registry and support functions + +7.6.10.2 Registry API for Unicode encoding error handlers +......................................................... + + -- C Function: int PyCodec_RegisterError (const char *name, PyObject + *error) + ' Part of the *note Stable ABI: 550.' Register the error handling + callback function 'error' under the given 'name'. This callback + function will be called by a codec when it encounters unencodable + characters/undecodable bytes and 'name' is specified as the error + parameter in the call to the encode/decode function. + + The callback gets a single argument, an instance of *note + UnicodeEncodeError: 673, *note UnicodeDecodeError: a12. or *note + UnicodeTranslateError: 229d. that holds information about the + problematic sequence of characters or bytes and their offset in the + original string (see *note Unicode Exception Objects: 4b3d. for + functions to extract this information). The callback must either + raise the given exception, or return a two-item tuple containing + the replacement for the problematic sequence, and an integer giving + the offset in the original string at which encoding/decoding should + be resumed. + + Return ‘0’ on success, ‘-1’ on error. + + -- C Function: *note PyObject: 334. *PyCodec_LookupError (const char + *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Lookup the error handling callback function registered under + 'name'. As a special case ‘NULL’ can be passed, in which case the + error handling callback for “strict” will be returned. + + -- C Function: *note PyObject: 334. *PyCodec_StrictErrors (PyObject + *exc) + 'Return value: Always NULL.'' Part of the *note Stable ABI: 550.' + Raise 'exc' as an exception. + + -- C Function: *note PyObject: 334. *PyCodec_IgnoreErrors (PyObject + *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Ignore the unicode error, skipping the faulty input. + + -- C Function: *note PyObject: 334. *PyCodec_ReplaceErrors (PyObject + *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Replace the unicode encode error with ‘?’ or ‘U+FFFD’. + + -- C Function: *note PyObject: 334. *PyCodec_XMLCharRefReplaceErrors + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Replace the unicode encode error with XML character + references. + + -- C Function: *note PyObject: 334. *PyCodec_BackslashReplaceErrors + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Replace the unicode encode error with backslash escapes + (‘\x’, ‘\u’ and ‘\U’). + + -- C Function: *note PyObject: 334. *PyCodec_NameReplaceErrors + (PyObject *exc) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Replace the unicode encode error with + ‘\N{...}’ escapes. + + Added in version 3.5. + + +File: python.info, Node: PyTime C API, Next: Support for Perf Maps, Prev: Codec registry and support functions, Up: Utilities<2> + +7.6.11 PyTime C API +------------------- + +Added in version 3.13. + +The clock C API provides access to system clocks. It is similar to the +Python *note time: ee. module. + +For C API related to the *note datetime: 30. module, see *note DateTime +Objects: 4b84. + +* Menu: + +* Types: Types<2>. +* Clock Functions:: +* Raw Clock Functions:: +* Conversion functions:: + + +File: python.info, Node: Types<2>, Next: Clock Functions, Up: PyTime C API + +7.6.11.1 Types +.............. + + -- C Type: 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(): 330. 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 Variable: *note PyTime_t: 328. PyTime_MIN + + Minimum value of *note PyTime_t: 328. + + -- C Variable: *note PyTime_t: 328. PyTime_MAX + + Maximum value of *note PyTime_t: 328. + + +File: python.info, Node: Clock Functions, Next: Raw Clock Functions, Prev: Types<2>, Up: PyTime C API + +7.6.11.2 Clock Functions +........................ + +The following functions take a pointer to a *note PyTime_t: 328. 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: 49df. +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 the *note GIL: 159. held. + + -- C Function: int PyTime_Monotonic (PyTime_t *result) + + Read the monotonic clock. See *note time.monotonic(): 255. for + important details on this clock. + + -- C Function: int PyTime_PerfCounter (PyTime_t *result) + + Read the performance counter. See *note time.perf_counter(): a88. + for important details on this clock. + + -- C Function: int PyTime_Time (PyTime_t *result) + + Read the “wall clock” time. See *note time.time(): 256. for + details important on this clock. + + +File: python.info, Node: Raw Clock Functions, Next: Conversion functions, Prev: Clock Functions, Up: PyTime C API + +7.6.11.3 Raw Clock Functions +............................ + +Similar to clock functions, but don’t set an exception on error and +don’t require the caller to hold the GIL. + +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, acquire the GIL and call +the regular (non-‘Raw’) function. Note that the regular function may +succeed after the ‘Raw’ one failed. + + -- C Function: int PyTime_MonotonicRaw (PyTime_t *result) + + Similar to *note PyTime_Monotonic(): 32c, but don’t set an + exception on error and don’t require holding the GIL. + + -- C Function: int PyTime_PerfCounterRaw (PyTime_t *result) + + Similar to *note PyTime_PerfCounter(): 32e, but don’t set an + exception on error and don’t require holding the GIL. + + -- C Function: int PyTime_TimeRaw (PyTime_t *result) + + Similar to *note PyTime_Time(): 330, but don’t set an exception on + error and don’t require holding the GIL. + + +File: python.info, Node: Conversion functions, Prev: Raw Clock Functions, Up: PyTime C API + +7.6.11.4 Conversion functions +............................. + + -- C Function: 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: Utilities<2> + +7.6.12 Support for Perf Maps +---------------------------- + +On supported platforms (as of this writing, only Linux), the runtime can +take advantage of 'perf map files' to make Python functions visible to +an external profiling tool (such as perf(1)). A running process may +create a file in the ‘/tmp’ directory, which contains entries that can +map a section of executable code to a name. This interface is described +in the documentation of the Linux Perf tool(2). + +In Python, these helper APIs can be used by libraries and features that +rely on generating machine code on the fly. + +Note that holding the Global Interpreter Lock (GIL) is not required for +these APIs. + + -- C Function: int PyUnstable_PerfMapState_Init (void) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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(): + 1739.). Normally, there’s no need to call this explicitly; just + use *note PyUnstable_WritePerfMapEntry(): 1739. 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 Function: int PyUnstable_WritePerfMapEntry (const void *code_addr, + unsigned int code_size, const char *entry_name) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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(): 173a. before + writing the entry, if the perf map file is not already opened. + Returns ‘0’ on success, or the same error codes as *note + PyUnstable_PerfMapState_Init(): 173a. on failure. + + -- C Function: void PyUnstable_PerfMapState_Fini (void) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Close the perf map file opened by *note + PyUnstable_PerfMapState_Init(): 173a. This is called by the + runtime itself during interpreter shut-down. In general, there + shouldn’t be a reason to explicitly call this, except to handle + specific scenarios such as forking. + + ---------- Footnotes ---------- + + (1) https://perf.wiki.kernel.org/index.php/Main_Page + + (2) +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/Documentation/jit-interface.txt + + +File: python.info, Node: Abstract Objects Layer, Next: Concrete Objects Layer, Prev: Utilities<2>, Up: Python/C API Reference Manual + +7.7 Abstract Objects Layer +========================== + +The functions in this chapter interact with Python objects regardless of +their type, or with wide classes of object types (e.g. all numerical +types, or all sequence types). When used on object types for which they +do not apply, they will raise a Python exception. + +It is not possible to use these functions on objects that are not +properly initialized, such as a list object that has been created by +*note PyList_New(): 4948, but whose items have not been set to some +non-‘NULL’ value yet. + +* Menu: + +* Object Protocol:: +* Call Protocol:: +* Number Protocol:: +* Sequence Protocol:: +* Mapping Protocol:: +* Iterator Protocol:: +* Buffer Protocol:: + + +File: python.info, Node: Object Protocol, Next: Call Protocol, Up: Abstract Objects Layer + +7.7.1 Object Protocol +--------------------- + + -- C Function: *note PyObject: 334. *Py_GetConstant (unsigned int + constant_id) + ' Part of the *note Stable ABI: 550. since version 3.13.' Get a + *note strong reference: 338. 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 Value Returned object + + ------------------------------------------------------------------------------------- + + -- C Macro: Py_CONSTANT_NONE ‘0’ *note None: 671. + + + -- C Macro: Py_CONSTANT_FALSE ‘1’ *note False: b37. + + + -- C Macro: Py_CONSTANT_TRUE ‘2’ *note True: c0d. + + + -- C Macro: Py_CONSTANT_ELLIPSIS ‘3’ *note Ellipsis: 2185. + + + -- C Macro: Py_CONSTANT_NOT_IMPLEMENTED ‘4’ *note NotImplemented: 7cd. + + + -- C Macro: Py_CONSTANT_ZERO ‘5’ ‘0’ + + + -- C Macro: Py_CONSTANT_ONE ‘6’ ‘1’ + + + -- C Macro: Py_CONSTANT_EMPTY_STR ‘7’ ‘''’ + + + -- C Macro: Py_CONSTANT_EMPTY_BYTES ‘8’ ‘b''’ + + + -- C Macro: Py_CONSTANT_EMPTY_TUPLE ‘9’ ‘()’ + + + Numeric values are only given for projects which cannot use the + constant identifiers. + + Added in version 3.13. + + 'CPython implementation detail:' In CPython, all of these constants + are *note immortal: 4394. + + -- C Function: *note PyObject: 334. *Py_GetConstantBorrowed (unsigned + int constant_id) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note Py_GetConstant(): 351, but return a *note borrowed + reference: 339. + + This function is primarily intended for backwards compatibility: + using *note Py_GetConstant(): 351. 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 Variable: *note PyObject: 334. *Py_NotImplemented + + The ‘NotImplemented’ singleton, used to signal that an operation is + not implemented for the given type combination. + + -- C Macro: Py_RETURN_NOTIMPLEMENTED + + Properly handle returning *note Py_NotImplemented: 4b9b. from + within a C function (that is, create a new *note strong reference: + 338. to *note NotImplemented: 7cd. and return it). + + -- C Macro: Py_PRINT_RAW + + Flag to be used with multiple functions that print the object (like + *note PyObject_Print(): 15f2. and *note PyFile_WriteObject(): + 49ff.). If passed, these function would use the *note str(): 447. + of the object instead of the *note repr(): 7f9. + + -- C Function: 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: 4b9d.; if + given, the *note str(): 447. of the object is written instead of + the *note repr(): 7f9. + + -- C Function: int PyObject_HasAttrWithError (PyObject *o, PyObject + *attr_name) + ' Part of the *note Stable ABI: 550. since version 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 Function: int PyObject_HasAttrStringWithError (PyObject *o, const + char *attr_name) + ' Part of the *note Stable ABI: 550. since version 3.13.' This is + the same as *note PyObject_HasAttrWithError(): 375, but 'attr_name' + is specified as a const char* UTF-8 encoded bytes string, rather + than a *note PyObject: 334.*. + + Added in version 3.13. + + -- C Function: int PyObject_HasAttr (PyObject *o, PyObject *attr_name) + ' Part of the *note Stable ABI: 550.' Returns ‘1’ if 'o' has the + attribute 'attr_name', and ‘0’ otherwise. This function always + succeeds. + + Note: Exceptions that occur when this calls *note + __getattr__(): 4cf. and *note __getattribute__(): bd2. methods + aren’t propagated, but instead given to *note + sys.unraisablehook(): 1f9. For proper error handling, use + *note PyObject_HasAttrWithError(): 375, *note + PyObject_GetOptionalAttr(): 344. or *note PyObject_GetAttr(): + 346. instead. + + -- C Function: int PyObject_HasAttrString (PyObject *o, const char + *attr_name) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyObject_HasAttr(): 376, but 'attr_name' is specified as a const + char* UTF-8 encoded bytes string, rather than a *note PyObject: + 334.*. + + Note: Exceptions that occur when this calls *note + __getattr__(): 4cf. and *note __getattribute__(): bd2. methods + or while creating the temporary *note str: 447. object are + silently ignored. For proper error handling, use *note + PyObject_HasAttrStringWithError(): 377, *note + PyObject_GetOptionalAttrString(): 345. or *note + PyObject_GetAttrString(): 347. instead. + + -- C Function: *note PyObject: 334. *PyObject_GetAttr (PyObject *o, + PyObject *attr_name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Retrieve an attribute named 'attr_name' from object 'o'. + Returns the attribute value on success, or ‘NULL’ on failure. This + is the equivalent of the Python expression ‘o.attr_name’. + + If the missing attribute should not be treated as a failure, you + can use *note PyObject_GetOptionalAttr(): 344. instead. + + -- C Function: *note PyObject: 334. *PyObject_GetAttrString (PyObject + *o, const char *attr_name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is the same as *note PyObject_GetAttr(): 346, but + 'attr_name' is specified as a const char* UTF-8 encoded bytes + string, rather than a *note PyObject: 334.*. + + If the missing attribute should not be treated as a failure, you + can use *note PyObject_GetOptionalAttrString(): 345. instead. + + -- C Function: int PyObject_GetOptionalAttr (PyObject *obj, PyObject + *attr_name, PyObject **result); + ' Part of the *note Stable ABI: 550. since version 3.13.' Variant + of *note PyObject_GetAttr(): 346. which doesn’t raise *note + AttributeError: 348. if the attribute is not found. + + If the attribute is found, return ‘1’ and set '*result' to a new + *note strong reference: 338. to the attribute. If the attribute is + not found, return ‘0’ and set '*result' to ‘NULL’; the *note + AttributeError: 348. is silenced. If an error other than *note + AttributeError: 348. is raised, return ‘-1’ and set '*result' to + ‘NULL’. + + Added in version 3.13. + + -- C Function: int PyObject_GetOptionalAttrString (PyObject *obj, const + char *attr_name, PyObject **result); + ' Part of the *note Stable ABI: 550. since version 3.13.' This is + the same as *note PyObject_GetOptionalAttr(): 344, but 'attr_name' + is specified as a const char* UTF-8 encoded bytes string, rather + than a *note PyObject: 334.*. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyObject_GenericGetAttr (PyObject + *o, PyObject *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Generic attribute getter function that is meant to be put + into a type object’s ‘tp_getattro’ slot. It looks for a descriptor + in the dictionary of classes in the object’s MRO as well as an + attribute in the object’s *note __dict__: 558. (if present). As + outlined in *note Implementing Descriptors: c4f, data descriptors + take preference over instance attributes, while non-data + descriptors don’t. Otherwise, an *note AttributeError: 348. is + raised. + + -- C Function: int PyObject_SetAttr (PyObject *o, PyObject *attr_name, + PyObject *v) + ' Part of the *note Stable ABI: 550.' Set the value of the + attribute named 'attr_name', for object 'o', to the value 'v'. + Raise an exception and return ‘-1’ on failure; return ‘0’ on + success. This is the equivalent of the Python statement + ‘o.attr_name = v’. + + If 'v' is ‘NULL’, the attribute is deleted. This behaviour is + deprecated in favour of using *note PyObject_DelAttr(): 1538, but + there are currently no plans to remove it. + + -- C Function: int PyObject_SetAttrString (PyObject *o, const char + *attr_name, PyObject *v) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyObject_SetAttr(): 4a68, but 'attr_name' is specified as a const + char* UTF-8 encoded bytes string, rather than a *note PyObject: + 334.*. + + If 'v' is ‘NULL’, the attribute is deleted, but this feature is + deprecated in favour of using *note PyObject_DelAttrString(): 1539. + + 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(): 4ad1. + and *note PyObject_SetAttr(): 4a68. directly. For more details, + see *note PyUnicode_InternFromString(): 1600, which may be used + internally to create a key object. + + -- C Function: int PyObject_GenericSetAttr (PyObject *o, PyObject + *name, PyObject *value) + ' Part of the *note Stable ABI: 550.' Generic attribute setter and + deleter function that is meant to be put into a type object’s *note + tp_setattro: 4901. slot. It looks for a data descriptor in the + dictionary of classes in the object’s MRO, and if found it takes + preference over setting or deleting the attribute in the instance + dictionary. Otherwise, the attribute is set or deleted in the + object’s *note __dict__: 558. (if present). On success, ‘0’ is + returned, otherwise an *note AttributeError: 348. is raised and + ‘-1’ is returned. + + -- C Function: int PyObject_DelAttr (PyObject *o, PyObject *attr_name) + ' Part of the *note Stable ABI: 550. since version 3.13.' Delete + attribute named 'attr_name', for object 'o'. Returns ‘-1’ on + failure. This is the equivalent of the Python statement ‘del + o.attr_name’. + + -- C Function: int PyObject_DelAttrString (PyObject *o, const char + *attr_name) + ' Part of the *note Stable ABI: 550. since version 3.13.' This is + the same as *note PyObject_DelAttr(): 1538, but 'attr_name' is + specified as a const char* UTF-8 encoded bytes string, rather than + a *note PyObject: 334.*. + + 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(): 4ad1. + and *note PyObject_DelAttr(): 1538. directly. For more details, + see *note PyUnicode_InternFromString(): 1600, which may be used + internally to create a key object for lookup. + + -- C Function: *note PyObject: 334. *PyObject_GenericGetDict (PyObject + *o, void *context) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.10.' A generic implementation for the getter of a + ‘__dict__’ descriptor. It creates the dictionary if necessary. + + This function may also be called to get the *note __dict__: 558. 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(): 346. when + accessing an attribute on the object. + + On failure, returns ‘NULL’ with an exception set. + + Added in version 3.3. + + -- C Function: int PyObject_GenericSetDict (PyObject *o, PyObject + *value, void *context) + ' Part of the *note Stable ABI: 550. since version 3.7.' A generic + implementation for the setter of a ‘__dict__’ descriptor. This + implementation does not allow the dictionary to be deleted. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. **_PyObject_GetDictPtr (PyObject + *obj) + + Return a pointer to *note __dict__: 558. 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(): 346. when + accessing an attribute on the object. + + -- C Function: *note PyObject: 334. *PyObject_RichCompare (PyObject + *o1, PyObject *o2, int opid) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Compare the values of 'o1' and 'o2' using the operation + specified by 'opid', which must be one of *note Py_LT: 4b9f, *note + Py_LE: 4ba0, *note Py_EQ: 4ba1, *note Py_NE: 4ba2, *note Py_GT: + 4ba3, or *note Py_GE: 4ba4, 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 Function: int PyObject_RichCompareBool (PyObject *o1, PyObject + *o2, int opid) + ' Part of the *note Stable ABI: 550.' Compare the values of 'o1' + and 'o2' using the operation specified by 'opid', like *note + PyObject_RichCompare(): 490a, but returns ‘-1’ on error, ‘0’ if the + result is false, ‘1’ otherwise. + + Note: If 'o1' and 'o2' are the same object, *note + PyObject_RichCompareBool(): 19a2. will always return ‘1’ for *note + Py_EQ: 4ba1. and ‘0’ for *note Py_NE: 4ba2. + + -- C Function: *note PyObject: 334. *PyObject_Format (PyObject *obj, + PyObject *format_spec) + ' Part of the *note Stable ABI: 550.' 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 Function: *note PyObject: 334. *PyObject_Repr (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Compute a string representation of object 'o'. Returns the string + representation on success, ‘NULL’ on failure. This is the + equivalent of the Python expression ‘repr(o)’. Called by the *note + repr(): 7f9. built-in function. + + Changed in version 3.4: This function now includes a debug + assertion to help ensure that it does not silently discard an + active exception. + + -- C Function: *note PyObject: 334. *PyObject_ASCII (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + As *note PyObject_Repr(): 1028, compute a string representation of + object 'o', but escape the non-ASCII characters in the string + returned by *note PyObject_Repr(): 1028. with ‘\x’, ‘\u’ or ‘\U’ + escapes. This generates a string similar to that returned by *note + PyObject_Repr(): 1028. in Python 2. Called by the *note ascii(): + 13b2. built-in function. + + -- C Function: *note PyObject: 334. *PyObject_Str (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Compute a string representation of object 'o'. Returns the + string representation on success, ‘NULL’ on failure. This is the + equivalent of the Python expression ‘str(o)’. Called by the *note + str(): 447. built-in function and, therefore, by the *note print(): + f70. function. + + Changed in version 3.4: This function now includes a debug + assertion to help ensure that it does not silently discard an + active exception. + + -- C Function: *note PyObject: 334. *PyObject_Bytes (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Compute a bytes representation of object 'o'. ‘NULL’ is returned + on failure and a bytes object on success. This is equivalent to + the Python expression ‘bytes(o)’, when 'o' is not an integer. + Unlike ‘bytes(o)’, a TypeError is raised when 'o' is an integer + instead of a zero-initialized bytes object. + + -- C Function: int PyObject_IsSubclass (PyObject *derived, PyObject + *cls) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if the class + 'derived' is identical to or derived from the class 'cls', + otherwise return ‘0’. In case of an error, return ‘-1’. + + If 'cls' is a tuple, the check will be done against every entry in + 'cls'. The result will be ‘1’ when at least one of the checks + returns ‘1’, otherwise it will be ‘0’. + + If 'cls' has a *note __subclasscheck__(): 1f7d. 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__: + 1f29. + + Normally only class objects, i.e. instances of *note type: d48. or + a derived class, are considered classes. However, objects can + override this by having a *note __bases__: 1475. attribute (which + must be a tuple of base classes). + + -- C Function: int PyObject_IsInstance (PyObject *inst, PyObject *cls) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if 'inst' is an + instance of the class 'cls' or a subclass of 'cls', or ‘0’ if not. + On error, returns ‘-1’ and sets an exception. + + If 'cls' is a tuple, the check will be done against every entry in + 'cls'. The result will be ‘1’ when at least one of the checks + returns ‘1’, otherwise it will be ‘0’. + + If 'cls' has a *note __instancecheck__(): 1f7c. 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__: 1476. attribute. + + An object 'cls' can override if it is considered a class, and what + its base classes are, by having a *note __bases__: 1475. attribute + (which must be a tuple of base classes). + + -- C Function: *note Py_hash_t: 1257. PyObject_Hash (PyObject *o) + ' Part of the *note Stable ABI: 550.' + + Compute and return the hash value of an object 'o'. On failure, + return ‘-1’. This is the equivalent of the Python expression + ‘hash(o)’. + + Changed in version 3.2: The return type is now Py_hash_t. This is + a signed integer the same size as *note Py_ssize_t: a5f. + + -- C Function: *note Py_hash_t: 1257. PyObject_HashNotImplemented + (PyObject *o) + ' Part of the *note Stable ABI: 550.' Set a *note TypeError: 534. + indicating that ‘type(o)’ is not *note hashable: 60c. 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 Function: int PyObject_IsTrue (PyObject *o) + ' Part of the *note Stable ABI: 550.' Returns ‘1’ if the object + 'o' is considered to be true, and ‘0’ otherwise. This is + equivalent to the Python expression ‘not not o’. On failure, + return ‘-1’. + + -- C Function: int PyObject_Not (PyObject *o) + ' Part of the *note Stable ABI: 550.' Returns ‘0’ if the object + 'o' is considered to be true, and ‘1’ otherwise. This is + equivalent to the Python expression ‘not o’. On failure, return + ‘-1’. + + -- C Function: *note PyObject: 334. *PyObject_Type (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + When 'o' is non-‘NULL’, returns a type object corresponding to the + object type of object 'o'. On failure, raises *note SystemError: + 572. and returns ‘NULL’. This is equivalent to the Python + expression ‘type(o)’. This function creates a new *note strong + reference: 338. to the return value. There’s really no reason to + use this function instead of the *note Py_TYPE(): 77b. function, + which returns a pointer of type *note PyTypeObject: aa5.*, except + when a new *note strong reference: 338. is needed. + + -- C Function: 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 Function: *note Py_ssize_t: a5f. PyObject_Size (PyObject *o) + -- C Function: *note Py_ssize_t: a5f. PyObject_Length (PyObject *o) + ' Part of the *note Stable ABI: 550.' + + Return the length of object 'o'. If the object 'o' provides either + the sequence and mapping protocols, the sequence length is + returned. On error, ‘-1’ is returned. This is the equivalent to + the Python expression ‘len(o)’. + + -- C Function: *note Py_ssize_t: a5f. PyObject_LengthHint (PyObject *o, + Py_ssize_t defaultvalue) + + Return an estimated length for the object 'o'. First try to return + its actual length, then an estimate using *note __length_hint__(): + f06, and finally return the default value. On error return ‘-1’. + This is the equivalent to the Python expression + ‘operator.length_hint(o, defaultvalue)’. + + Added in version 3.4. + + -- C Function: *note PyObject: 334. *PyObject_GetItem (PyObject *o, + PyObject *key) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return element of 'o' corresponding to the object 'key' or + ‘NULL’ on failure. This is the equivalent of the Python expression + ‘o[key]’. + + -- C Function: int PyObject_SetItem (PyObject *o, PyObject *key, + PyObject *v) + ' Part of the *note Stable ABI: 550.' Map the object 'key' to the + value 'v'. Raise an exception and return ‘-1’ on failure; return + ‘0’ on success. This is the equivalent of the Python statement + ‘o[key] = v’. This function 'does not' steal a reference to 'v'. + + -- C Function: int PyObject_DelItem (PyObject *o, PyObject *key) + ' Part of the *note Stable ABI: 550.' Remove the mapping for the + object 'key' from the object 'o'. Return ‘-1’ on failure. This is + equivalent to the Python statement ‘del o[key]’. + + -- C Function: int PyObject_DelItemString (PyObject *o, const char + *key) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyObject_DelItem(): 4a5b, but 'key' is specified as a const char* + UTF-8 encoded bytes string, rather than a *note PyObject: 334.*. + + -- C Function: *note PyObject: 334. *PyObject_Dir (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is equivalent to the Python expression ‘dir(o)’, + returning a (possibly empty) list of strings appropriate for the + object argument, or ‘NULL’ if there was an error. If the argument + is ‘NULL’, this is like the Python ‘dir()’, returning the names of + the current locals; in this case, if no execution frame is active + then ‘NULL’ is returned but *note PyErr_Occurred(): 18f1. will + return false. + + -- C Function: *note PyObject: 334. *PyObject_GetIter (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is equivalent to the Python expression ‘iter(o)’. It + returns a new iterator for the object argument, or the object + itself if the object is already an iterator. Raises *note + TypeError: 534. and returns ‘NULL’ if the object cannot be + iterated. + + -- C Function: *note PyObject: 334. *PyObject_SelfIter (PyObject *obj) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is equivalent to the Python ‘__iter__(self): return + self’ method. It is intended for *note iterator: 1ac. types, to be + used in the *note PyTypeObject.tp_iter: 14b9. slot. + + -- C Function: *note PyObject: 334. *PyObject_GetAIter (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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: 534. and returns ‘NULL’ if the object cannot be + iterated. + + Added in version 3.10. + + -- C Function: void *PyObject_GetTypeData (PyObject *o, PyTypeObject + *cls) + ' Part of the *note Stable ABI: 550. since version 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: 545. + Python does not check this. + + On error, set an exception and return ‘NULL’. + + Added in version 3.12. + + -- C Function: *note Py_ssize_t: a5f. PyType_GetTypeDataSize + (PyTypeObject *cls) + ' Part of the *note Stable ABI: 550. since version 3.12.' Return + the size of the instance memory space reserved for 'cls', i.e. the + size of the memory *note PyObject_GetTypeData(): 546. returns. + + This may be larger than requested using *note + -PyType_Spec.basicsize: 545.; 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: 545. Python does not check this. + + On error, set an exception and return a negative value. + + Added in version 3.12. + + -- C Function: void *PyObject_GetItemData (PyObject *o) + + Get a pointer to per-item data for a class with *note + Py_TPFLAGS_ITEMS_AT_END: 548. + + On error, set an exception and return ‘NULL’. *note TypeError: + 534. is raised if 'o' does not have *note Py_TPFLAGS_ITEMS_AT_END: + 548. set. + + Added in version 3.12. + + -- C Function: 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: 366. flag set. + + Added in version 3.13. + + -- C Function: void PyObject_ClearManagedDict (PyObject *obj) + + Clear 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: 366. flag set. + + Added in version 3.13. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3119/ + + (2) https://peps.python.org/pep-3119/ + + +File: python.info, Node: Call Protocol, Next: Number Protocol, Prev: Object Protocol, Up: Abstract Objects Layer + +7.7.2 Call Protocol +------------------- + +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 Protocol + +7.7.2.1 The 'tp_call' Protocol +.............................. + +Instances of classes that set *note tp_call: 556. 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: 57c. and +*note tp_init: 57e. also pass arguments this way. + +To call an object, use *note PyObject_Call(): 398. or another *note call +API: 4ba8. + + +File: python.info, Node: The Vectorcall Protocol, Next: Object Calling API, Prev: The tp_call Protocol, Up: Call Protocol + +7.7.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(): 398.). Therefore, a class supporting +vectorcall must also implement *note tp_call: 556. Moreover, the +callable must behave the same regardless of which protocol is used. The +recommended way to achieve this is by setting *note tp_call: 556. to +*note PyVectorcall_Call(): 553. This bears repeating: + + Warning: A class supporting vectorcall 'must' also implement *note + tp_call: 556. with the same semantics. + +Changed in version 3.12: The *note Py_TPFLAGS_HAVE_VECTORCALL: 551. flag +is now removed from a class when the class’s *note __call__(): 555. +method is reassigned. (This internally sets *note tp_call: 556. only, +and thus may make it behave differently than the vectorcall function.) +In earlier Python versions, vectorcall should only be used with *note +immutable: 3be. 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: 551. flag and setting *note +tp_vectorcall_offset: 4baa. to the offset inside the object structure +where a 'vectorcallfunc' appears. This is a pointer to a function with +the following signature: + + -- C Type: typedef *note PyObject: 334. *(*vectorcallfunc)(*note + PyObject: 334. *callable, *note PyObject: 334. *const *args, + size_t nargsf, *note PyObject: 334. *kwnames) + ' Part of the *note Stable ABI: 550. since version 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: 55b. flag. To get the + actual number of positional arguments from 'nargsf', use *note + PyVectorcall_NARGS(): 552. + + - + '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 Macro: PY_VECTORCALL_ARGUMENTS_OFFSET + ' Part of the *note Stable ABI: 550. since version 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(): 55a, 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: + 55b. 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: +4ba8. function as with any other callable. *note PyObject_Vectorcall(): +559. will usually be most efficient. + +* Menu: + +* Recursion Control: Recursion Control<2>. +* Vectorcall Support API:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0590/ + + +File: python.info, Node: Recursion Control<2>, Next: Vectorcall Support API, Up: The Vectorcall Protocol + +7.7.2.3 Recursion Control +......................... + +When using 'tp_call', callees do not need to worry about *note +recursion: 4b3e.: CPython uses *note Py_EnterRecursiveCall(): 973. and +*note Py_LeaveRecursiveCall(): 974. 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: Recursion Control<2>, Up: The Vectorcall Protocol + +7.7.2.4 Vectorcall Support API +.............................. + + -- C Function: *note Py_ssize_t: a5f. PyVectorcall_NARGS (size_t + nargsf) + ' Part of the *note Stable ABI: 550. since version 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 Function: *note vectorcallfunc: 554. 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 Function: *note PyObject: 334. *PyVectorcall_Call (PyObject + *callable, PyObject *tuple, PyObject *dict) + ' Part of the *note Stable ABI: 550. since version 3.12.' Call + 'callable'’s *note vectorcallfunc: 554. 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: 556. slot or be used in an implementation of ‘tp_call’. + It does not check the *note Py_TPFLAGS_HAVE_VECTORCALL: 551. 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 Protocol + +7.7.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. + +Function callable args kwargs + +------------------------------------------------------------------------------------------------------------------- + +*note PyObject_Call(): 398. ‘PyObject *’ tuple dict/‘NULL’ + + +*note PyObject_CallNoArgs(): 397. ‘PyObject *’ — — + + +*note PyObject_CallOneArg(): 978. ‘PyObject *’ 1 object — + + +*note PyObject_CallObject(): 48c7. ‘PyObject *’ tuple/‘NULL’ — + + +*note PyObject_CallFunction(): 39a. ‘PyObject *’ format — + + +*note PyObject_CallMethod(): 39b. obj + ‘char*’ format — + + +*note PyObject_CallFunctionObjArgs(): 4a5a. ‘PyObject *’ variadic — + + +*note PyObject_CallMethodObjArgs(): 19fc. obj + name variadic — + + +*note PyObject_CallMethodNoArgs(): 4baf. obj + name — — + + +*note PyObject_CallMethodOneArg(): 4bb0. obj + name 1 object — + + +*note PyObject_Vectorcall(): 559. ‘PyObject *’ vectorcall vectorcall + + +*note PyObject_VectorcallDict(): 4bb1. ‘PyObject *’ vectorcall dict/‘NULL’ + + +*note PyObject_VectorcallMethod(): 55a. arg + name vectorcall vectorcall + + + -- C Function: *note PyObject: 334. *PyObject_Call (PyObject *callable, + PyObject *args, PyObject *kwargs) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call a callable Python object 'callable', with arguments + given by the tuple 'args', and named arguments given by the + dictionary 'kwargs'. + + 'args' must not be 'NULL'; use an empty tuple if no arguments are + needed. If no named arguments are needed, 'kwargs' can be 'NULL'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + This is the equivalent of the Python expression: ‘callable(*args, + **kwargs)’. + + -- C Function: *note PyObject: 334. *PyObject_CallNoArgs (PyObject + *callable) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyObject_CallOneArg (PyObject + *callable, PyObject *arg) + 'Return value: New reference.' Call a callable Python object + 'callable' with exactly 1 positional argument 'arg' and no keyword + arguments. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyObject_CallObject (PyObject + *callable, PyObject *args) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call a callable Python object 'callable', with arguments + given by the tuple 'args'. If no arguments are needed, then 'args' + can be 'NULL'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + This is the equivalent of the Python expression: ‘callable(*args)’. + + -- C Function: *note PyObject: 334. *PyObject_CallFunction (PyObject + *callable, const char *format, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call a callable Python object 'callable', with a variable + number of C arguments. The C arguments are described using a *note + Py_BuildValue(): 8a6. style format string. The format can be + 'NULL', indicating that no arguments are provided. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + This is the equivalent of the Python expression: ‘callable(*args)’. + + Note that if you only pass *note PyObject: 334.* args, *note + PyObject_CallFunctionObjArgs(): 4a5a. is a faster alternative. + + Changed in version 3.4: The type of 'format' was changed from ‘char + *’. + + -- C Function: *note PyObject: 334. *PyObject_CallMethod (PyObject + *obj, const char *name, const char *format, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call the method named 'name' of object 'obj' with a variable + number of C arguments. The C arguments are described by a *note + Py_BuildValue(): 8a6. format string that should produce a tuple. + + The format can be 'NULL', indicating that no arguments are + provided. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + This is the equivalent of the Python expression: ‘obj.name(arg1, + arg2, ...)’. + + Note that if you only pass *note PyObject: 334.* args, *note + PyObject_CallMethodObjArgs(): 19fc. is a faster alternative. + + Changed in version 3.4: The types of 'name' and 'format' were + changed from ‘char *’. + + -- C Function: *note PyObject: 334. *PyObject_CallFunctionObjArgs + (PyObject *callable, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call a callable Python object 'callable', with a variable + number of *note PyObject: 334.* arguments. The arguments are + provided as a variable number of parameters followed by 'NULL'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + This is the equivalent of the Python expression: ‘callable(arg1, + arg2, ...)’. + + -- C Function: *note PyObject: 334. *PyObject_CallMethodObjArgs + (PyObject *obj, PyObject *name, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Call a method of the Python object 'obj', where the name of + the method is given as a Python string object in 'name'. It is + called with a variable number of *note PyObject: 334.* arguments. + The arguments are provided as a variable number of parameters + followed by 'NULL'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + -- C Function: *note PyObject: 334. *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'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *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'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyObject_Vectorcall (PyObject + *callable, PyObject *const *args, size_t nargsf, PyObject + *kwnames) + ' Part of the *note Stable ABI: 550. since version 3.12.' Call a + callable Python object 'callable'. The arguments are the same as + for *note vectorcallfunc: 554. If 'callable' supports *note + vectorcall: 54f, this directly calls the vectorcall function stored + in 'callable'. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyObject_VectorcallDict (PyObject + *callable, PyObject *const *args, size_t nargsf, PyObject + *kwdict) + + Call 'callable' with positional arguments passed exactly as in the + *note vectorcall: 54f. 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 Function: *note PyObject: 334. *PyObject_VectorcallMethod + (PyObject *name, PyObject *const *args, size_t nargsf, + PyObject *kwnames) + ' Part of the *note Stable ABI: 550. since version 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: 55b. if the value of ‘args[0]’ may + temporarily be changed. Keyword arguments can be passed just like + in *note PyObject_Vectorcall(): 559. + + If the object has the *note Py_TPFLAGS_METHOD_DESCRIPTOR: 4bb2. + feature, this will call the unbound method object with the full + 'args' vector as arguments. + + Return the result of the call on success, or raise an exception and + return 'NULL' on failure. + + Added in version 3.9. + + +File: python.info, Node: Call Support API, Prev: Object Calling API, Up: Call Protocol + +7.7.2.6 Call Support API +........................ + + -- C Function: int PyCallable_Check (PyObject *o) + ' Part of the *note Stable ABI: 550.' Determine if the object 'o' + is callable. Return ‘1’ if the object is callable and ‘0’ + otherwise. This function always succeeds. + + +File: python.info, Node: Number Protocol, Next: Sequence Protocol, Prev: Call Protocol, Up: Abstract Objects Layer + +7.7.3 Number Protocol +--------------------- + + -- C Function: int PyNumber_Check (PyObject *o) + ' Part of the *note Stable ABI: 550.' Returns ‘1’ if the object + 'o' provides numeric protocols, and false otherwise. This function + always succeeds. + + Changed in version 3.8: Returns ‘1’ if 'o' is an index integer. + + -- C Function: *note PyObject: 334. *PyNumber_Add (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of adding 'o1' and 'o2', or ‘NULL’ on + failure. This is the equivalent of the Python expression ‘o1 + + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Subtract (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of subtracting 'o2' from 'o1', or ‘NULL’ + on failure. This is the equivalent of the Python expression ‘o1 - + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Multiply (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of multiplying 'o1' and 'o2', or ‘NULL’ + on failure. This is the equivalent of the Python expression ‘o1 * + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_MatrixMultiply (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Returns the result of matrix multiplication on + 'o1' and 'o2', or ‘NULL’ on failure. This is the equivalent of the + Python expression ‘o1 @ o2’. + + Added in version 3.5. + + -- C Function: *note PyObject: 334. *PyNumber_FloorDivide (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the floor of 'o1' divided by 'o2', or ‘NULL’ on + failure. This is the equivalent of the Python expression ‘o1 // + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_TrueDivide (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyNumber_Remainder (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the remainder of dividing 'o1' by 'o2', or ‘NULL’ on + failure. This is the equivalent of the Python expression ‘o1 % + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Divmod (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + See the built-in function *note divmod(): 9a1. Returns ‘NULL’ on + failure. This is the equivalent of the Python expression + ‘divmod(o1, o2)’. + + -- C Function: *note PyObject: 334. *PyNumber_Power (PyObject *o1, + PyObject *o2, PyObject *o3) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + See the built-in function *note pow(): 9d2. Returns ‘NULL’ on + failure. This is the equivalent of the Python expression ‘pow(o1, + o2, o3)’, where 'o3' is optional. If 'o3' is to be ignored, pass + *note Py_None: 48b9. in its place (passing ‘NULL’ for 'o3' would + cause an illegal memory access). + + -- C Function: *note PyObject: 334. *PyNumber_Negative (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the negation of 'o' on success, or ‘NULL’ on + failure. This is the equivalent of the Python expression ‘-o’. + + -- C Function: *note PyObject: 334. *PyNumber_Positive (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns 'o' on success, or ‘NULL’ on failure. This is the + equivalent of the Python expression ‘+o’. + + -- C Function: *note PyObject: 334. *PyNumber_Absolute (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Returns the absolute value of 'o', or ‘NULL’ on failure. This is + the equivalent of the Python expression ‘abs(o)’. + + -- C Function: *note PyObject: 334. *PyNumber_Invert (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the bitwise negation of 'o' on success, or ‘NULL’ on + failure. This is the equivalent of the Python expression ‘~o’. + + -- C Function: *note PyObject: 334. *PyNumber_Lshift (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of left shifting 'o1' by 'o2' on success, + or ‘NULL’ on failure. This is the equivalent of the Python + expression ‘o1 << o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Rshift (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of right shifting 'o1' by 'o2' on + success, or ‘NULL’ on failure. This is the equivalent of the + Python expression ‘o1 >> o2’. + + -- C Function: *note PyObject: 334. *PyNumber_And (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise and” of 'o1' and 'o2' on success and + ‘NULL’ on failure. This is the equivalent of the Python expression + ‘o1 & o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Xor (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise exclusive or” of 'o1' by 'o2' on + success, or ‘NULL’ on failure. This is the equivalent of the + Python expression ‘o1 ^ o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Or (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise or” of 'o1' and 'o2' on success, or + ‘NULL’ on failure. This is the equivalent of the Python expression + ‘o1 | o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceAdd (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of adding 'o1' and 'o2', or ‘NULL’ on + failure. The operation is done 'in-place' when 'o1' supports it. + This is the equivalent of the Python statement ‘o1 += o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceSubtract (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of subtracting 'o2' from 'o1', or ‘NULL’ + on failure. The operation is done 'in-place' when 'o1' supports + it. This is the equivalent of the Python statement ‘o1 -= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceMultiply (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of multiplying 'o1' and 'o2', or ‘NULL’ + on failure. The operation is done 'in-place' when 'o1' supports + it. This is the equivalent of the Python statement ‘o1 *= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceMatrixMultiply + (PyObject *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Returns the result of matrix multiplication on + 'o1' and 'o2', or ‘NULL’ on failure. The operation is done + 'in-place' when 'o1' supports it. This is the equivalent of the + Python statement ‘o1 @= o2’. + + Added in version 3.5. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceFloorDivide + (PyObject *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the mathematical floor of dividing 'o1' by 'o2', or + ‘NULL’ on failure. The operation is done 'in-place' when 'o1' + supports it. This is the equivalent of the Python statement ‘o1 + //= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceTrueDivide + (PyObject *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyNumber_InPlaceRemainder + (PyObject *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the remainder of dividing 'o1' by 'o2', or ‘NULL’ on + failure. The operation is done 'in-place' when 'o1' supports it. + This is the equivalent of the Python statement ‘o1 %= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlacePower (PyObject + *o1, PyObject *o2, PyObject *o3) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + See the built-in function *note pow(): 9d2. Returns ‘NULL’ on + failure. The operation is done 'in-place' when 'o1' supports it. + This is the equivalent of the Python statement ‘o1 **= o2’ when o3 + is *note Py_None: 48b9, or an in-place variant of ‘pow(o1, o2, o3)’ + otherwise. If 'o3' is to be ignored, pass *note Py_None: 48b9. in + its place (passing ‘NULL’ for 'o3' would cause an illegal memory + access). + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceLshift (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of left shifting 'o1' by 'o2' on success, + or ‘NULL’ on failure. The operation is done 'in-place' when 'o1' + supports it. This is the equivalent of the Python statement ‘o1 + <<= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceRshift (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the result of right shifting 'o1' by 'o2' on + success, or ‘NULL’ on failure. The operation is done 'in-place' + when 'o1' supports it. This is the equivalent of the Python + statement ‘o1 >>= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceAnd (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise and” of 'o1' and 'o2' on success and + ‘NULL’ on failure. The operation is done 'in-place' when 'o1' + supports it. This is the equivalent of the Python statement ‘o1 &= + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceXor (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise exclusive or” of 'o1' by 'o2' on + success, or ‘NULL’ on failure. The operation is done 'in-place' + when 'o1' supports it. This is the equivalent of the Python + statement ‘o1 ^= o2’. + + -- C Function: *note PyObject: 334. *PyNumber_InPlaceOr (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the “bitwise or” of 'o1' and 'o2' on success, or + ‘NULL’ on failure. The operation is done 'in-place' when 'o1' + supports it. This is the equivalent of the Python statement ‘o1 |= + o2’. + + -- C Function: *note PyObject: 334. *PyNumber_Long (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Returns the 'o' converted to an integer object on success, or + ‘NULL’ on failure. This is the equivalent of the Python expression + ‘int(o)’. + + -- C Function: *note PyObject: 334. *PyNumber_Float (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Returns the 'o' converted to a float object on success, or ‘NULL’ + on failure. This is the equivalent of the Python expression + ‘float(o)’. + + -- C Function: *note PyObject: 334. *PyNumber_Index (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the 'o' converted to a Python int on success or + ‘NULL’ with a *note TypeError: 534. exception raised on failure. + + Changed in version 3.10: The result always has exact type *note + int: 259. Previously, the result could have been an instance of a + subclass of ‘int’. + + -- C Function: *note PyObject: 334. *PyNumber_ToBase (PyObject *n, int + base) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Returns the integer 'n' converted to base 'base' as a + string. The 'base' argument must be one of 2, 8, 10, or 16. For + base 2, 8, or 16, the returned string is prefixed with a base + marker of ‘'0b'’, ‘'0o'’, or ‘'0x'’, respectively. If 'n' is not a + Python int, it is converted with *note PyNumber_Index(): 891. + first. + + -- C Function: *note Py_ssize_t: a5f. PyNumber_AsSsize_t (PyObject *o, + PyObject *exc) + ' Part of the *note Stable ABI: 550.' Returns 'o' converted to a + *note Py_ssize_t: a5f. value if 'o' can be interpreted as an + integer. If the call fails, an exception is raised and ‘-1’ is + returned. + + If 'o' can be converted to a Python int but the attempt to convert + to a *note Py_ssize_t: a5f. value would raise an *note + OverflowError: 87f, then the 'exc' argument is the type of + exception that will be raised (usually *note IndexError: 14ff. or + *note OverflowError: 87f.). If 'exc' is ‘NULL’, then the exception + is cleared and the value is clipped to ‘PY_SSIZE_T_MIN’ for a + negative integer or ‘PY_SSIZE_T_MAX’ for a positive integer. + + -- C Function: int PyIndex_Check (PyObject *o) + ' Part of the *note Stable ABI: 550. since version 3.8.' Returns + ‘1’ if 'o' is an index integer (has the ‘nb_index’ slot of the + ‘tp_as_number’ structure filled in), and ‘0’ otherwise. This + function always succeeds. + + +File: python.info, Node: Sequence Protocol, Next: Mapping Protocol, Prev: Number Protocol, Up: Abstract Objects Layer + +7.7.4 Sequence Protocol +----------------------- + + -- C Function: int PySequence_Check (PyObject *o) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if the object + provides the sequence protocol, and ‘0’ otherwise. Note that it + returns ‘1’ for Python classes with a *note __getitem__(): 285. + method, unless they are *note dict: 258. subclasses, since in + general it is impossible to determine what type of keys the class + supports. This function always succeeds. + + -- C Function: *note Py_ssize_t: a5f. PySequence_Size (PyObject *o) + -- C Function: *note Py_ssize_t: a5f. PySequence_Length (PyObject *o) + ' Part of the *note Stable ABI: 550.' + + Returns the number of objects in sequence 'o' on success, and ‘-1’ + on failure. This is equivalent to the Python expression ‘len(o)’. + + -- C Function: *note PyObject: 334. *PySequence_Concat (PyObject *o1, + PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the concatenation of 'o1' and 'o2' on success, and + ‘NULL’ on failure. This is the equivalent of the Python expression + ‘o1 + o2’. + + -- C Function: *note PyObject: 334. *PySequence_Repeat (PyObject *o, + Py_ssize_t count) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the result of repeating sequence object 'o' 'count' + times, or ‘NULL’ on failure. This is the equivalent of the Python + expression ‘o * count’. + + -- C Function: *note PyObject: 334. *PySequence_InPlaceConcat (PyObject + *o1, PyObject *o2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the concatenation of 'o1' and 'o2' on success, and + ‘NULL’ on failure. The operation is done 'in-place' when 'o1' + supports it. This is the equivalent of the Python expression ‘o1 + += o2’. + + -- C Function: *note PyObject: 334. *PySequence_InPlaceRepeat (PyObject + *o, Py_ssize_t count) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the result of repeating sequence object 'o' 'count' + times, or ‘NULL’ on failure. The operation is done 'in-place' when + 'o' supports it. This is the equivalent of the Python expression + ‘o *= count’. + + -- C Function: *note PyObject: 334. *PySequence_GetItem (PyObject *o, + Py_ssize_t i) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the 'i'th element of 'o', or ‘NULL’ on failure. This + is the equivalent of the Python expression ‘o[i]’. + + -- C Function: *note PyObject: 334. *PySequence_GetSlice (PyObject *o, + Py_ssize_t i1, Py_ssize_t i2) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the slice of sequence object 'o' between 'i1' and + 'i2', or ‘NULL’ on failure. This is the equivalent of the Python + expression ‘o[i1:i2]’. + + -- C Function: int PySequence_SetItem (PyObject *o, Py_ssize_t i, + PyObject *v) + ' Part of the *note Stable ABI: 550.' Assign object 'v' to the + 'i'th element of 'o'. Raise an exception and return ‘-1’ on + failure; return ‘0’ on success. This is the equivalent of the + Python statement ‘o[i] = v’. This function 'does not' steal a + reference to 'v'. + + If 'v' is ‘NULL’, the element is deleted, but this feature is + deprecated in favour of using *note PySequence_DelItem(): 1a54. + + -- C Function: int PySequence_DelItem (PyObject *o, Py_ssize_t i) + ' Part of the *note Stable ABI: 550.' Delete the 'i'th element of + object 'o'. Returns ‘-1’ on failure. This is the equivalent of + the Python statement ‘del o[i]’. + + -- C Function: int PySequence_SetSlice (PyObject *o, Py_ssize_t i1, + Py_ssize_t i2, PyObject *v) + ' Part of the *note Stable ABI: 550.' Assign the sequence object + 'v' to the slice in sequence object 'o' from 'i1' to 'i2'. This is + the equivalent of the Python statement ‘o[i1:i2] = v’. + + -- C Function: int PySequence_DelSlice (PyObject *o, Py_ssize_t i1, + Py_ssize_t i2) + ' Part of the *note Stable ABI: 550.' Delete the slice in sequence + object 'o' from 'i1' to 'i2'. Returns ‘-1’ on failure. This is + the equivalent of the Python statement ‘del o[i1:i2]’. + + -- C Function: *note Py_ssize_t: a5f. PySequence_Count (PyObject *o, + PyObject *value) + ' Part of the *note Stable ABI: 550.' Return the number of + occurrences of 'value' in 'o', that is, return the number of keys + for which ‘o[key] == value’. On failure, return ‘-1’. This is + equivalent to the Python expression ‘o.count(value)’. + + -- C Function: int PySequence_Contains (PyObject *o, PyObject *value) + ' Part of the *note Stable ABI: 550.' Determine if 'o' contains + 'value'. If an item in 'o' is equal to 'value', return ‘1’, + otherwise return ‘0’. On error, return ‘-1’. This is equivalent + to the Python expression ‘value in o’. + + -- C Function: *note Py_ssize_t: a5f. PySequence_Index (PyObject *o, + PyObject *value) + ' Part of the *note Stable ABI: 550.' Return the first index 'i' + for which ‘o[i] == value’. On error, return ‘-1’. This is + equivalent to the Python expression ‘o.index(value)’. + + -- C Function: *note PyObject: 334. *PySequence_List (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a list object with the same contents as the sequence + or iterable 'o', or ‘NULL’ on failure. The returned list is + guaranteed to be new. This is equivalent to the Python expression + ‘list(o)’. + + -- C Function: *note PyObject: 334. *PySequence_Tuple (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Return a tuple object with the same contents as the sequence or + iterable 'o', or ‘NULL’ on failure. If 'o' is a tuple, a new + reference will be returned, otherwise a tuple will be constructed + with the appropriate contents. This is equivalent to the Python + expression ‘tuple(o)’. + + -- C Function: *note PyObject: 334. *PySequence_Fast (PyObject *o, + const char *m) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the sequence or iterable 'o' as an object usable by + the other ‘PySequence_Fast*’ family of functions. If the object is + not a sequence or iterable, raises *note TypeError: 534. with 'm' + as the message text. Returns ‘NULL’ on failure. + + The ‘PySequence_Fast*’ functions are thus named because they assume + 'o' is a *note PyTupleObject: 4b52. or a *note PyListObject: 4bba. + and access the data fields of 'o' directly. + + As a CPython implementation detail, if 'o' is already a sequence or + list, it will be returned. + + -- C Function: *note Py_ssize_t: a5f. PySequence_Fast_GET_SIZE + (PyObject *o) + + Returns the length of 'o', assuming that 'o' was returned by *note + PySequence_Fast(): 4a73. and that 'o' is not ‘NULL’. The size can + also be retrieved by calling *note PySequence_Size(): 1a51. on 'o', + but *note PySequence_Fast_GET_SIZE(): 4bbb. is faster because it + can assume 'o' is a list or tuple. + + -- C Function: *note PyObject: 334. *PySequence_Fast_GET_ITEM (PyObject + *o, Py_ssize_t i) + 'Return value: Borrowed reference.' Return the 'i'th element of + 'o', assuming that 'o' was returned by *note PySequence_Fast(): + 4a73, 'o' is not ‘NULL’, and that 'i' is within bounds. + + -- C Function: *note PyObject: 334. **PySequence_Fast_ITEMS (PyObject + *o) + + Return the underlying array of PyObject pointers. Assumes that 'o' + was returned by *note PySequence_Fast(): 4a73. and 'o' is not + ‘NULL’. + + Note, if a list gets resized, the reallocation may relocate the + items array. So, only use the underlying array pointer in contexts + where the sequence cannot change. + + -- C Function: *note PyObject: 334. *PySequence_ITEM (PyObject *o, + Py_ssize_t i) + 'Return value: New reference.' Return the 'i'th element of 'o' or + ‘NULL’ on failure. Faster form of *note PySequence_GetItem(): + 1a52. but without checking that *note PySequence_Check(): 4a6e. on + 'o' is true and without adjustment for negative indices. + + +File: python.info, Node: Mapping Protocol, Next: Iterator Protocol, Prev: Sequence Protocol, Up: Abstract Objects Layer + +7.7.5 Mapping Protocol +---------------------- + +See also *note PyObject_GetItem(): 342, *note PyObject_SetItem(): 4947. +and *note PyObject_DelItem(): 4a5b. + + -- C Function: int PyMapping_Check (PyObject *o) + ' Part of the *note Stable ABI: 550.' 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__(): 285. method, since in general it is impossible + to determine what type of keys the class supports. This function + always succeeds. + + -- C Function: *note Py_ssize_t: a5f. PyMapping_Size (PyObject *o) + -- C Function: *note Py_ssize_t: a5f. PyMapping_Length (PyObject *o) + ' Part of the *note Stable ABI: 550.' + + Returns the number of keys in object 'o' on success, and ‘-1’ on + failure. This is equivalent to the Python expression ‘len(o)’. + + -- C Function: *note PyObject: 334. *PyMapping_GetItemString (PyObject + *o, const char *key) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' This is the same as *note PyObject_GetItem(): 342, but 'key' + is specified as a const char* UTF-8 encoded bytes string, rather + than a *note PyObject: 334.*. + + -- C Function: int PyMapping_GetOptionalItem (PyObject *obj, PyObject + *key, PyObject **result) + ' Part of the *note Stable ABI: 550. since version 3.13.' Variant + of *note PyObject_GetItem(): 342. which doesn’t raise *note + KeyError: 33f. if the key is not found. + + If the key is found, return ‘1’ and set '*result' to a new *note + strong reference: 338. to the corresponding value. If the key is + not found, return ‘0’ and set '*result' to ‘NULL’; the *note + KeyError: 33f. is silenced. If an error other than *note KeyError: + 33f. is raised, return ‘-1’ and set '*result' to ‘NULL’. + + Added in version 3.13. + + -- C Function: int PyMapping_GetOptionalItemString (PyObject *obj, + const char *key, PyObject **result) + ' Part of the *note Stable ABI: 550. since version 3.13.' This is + the same as *note PyMapping_GetOptionalItem(): 340, but 'key' is + specified as a const char* UTF-8 encoded bytes string, rather than + a *note PyObject: 334.*. + + Added in version 3.13. + + -- C Function: int PyMapping_SetItemString (PyObject *o, const char + *key, PyObject *v) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyObject_SetItem(): 4947, but 'key' is specified as a const char* + UTF-8 encoded bytes string, rather than a *note PyObject: 334.*. + + -- C Function: int PyMapping_DelItem (PyObject *o, PyObject *key) + + This is an alias of *note PyObject_DelItem(): 4a5b. + + -- C Function: int PyMapping_DelItemString (PyObject *o, const char + *key) + + This is the same as *note PyObject_DelItem(): 4a5b, but 'key' is + specified as a const char* UTF-8 encoded bytes string, rather than + a *note PyObject: 334.*. + + -- C Function: int PyMapping_HasKeyWithError (PyObject *o, PyObject + *key) + ' Part of the *note Stable ABI: 550. since version 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 Function: int PyMapping_HasKeyStringWithError (PyObject *o, const + char *key) + ' Part of the *note Stable ABI: 550. since version 3.13.' This is + the same as *note PyMapping_HasKeyWithError(): 379, but 'key' is + specified as a const char* UTF-8 encoded bytes string, rather than + a *note PyObject: 334.*. + + Added in version 3.13. + + -- C Function: int PyMapping_HasKey (PyObject *o, PyObject *key) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if the mapping + object has the key 'key' and ‘0’ otherwise. This is equivalent to + the Python expression ‘key in o’. This function always succeeds. + + Note: Exceptions which occur when this calls *note + __getitem__(): 285. method are silently ignored. For proper + error handling, use *note PyMapping_HasKeyWithError(): 379, + *note PyMapping_GetOptionalItem(): 340. or *note + PyObject_GetItem(): 342. instead. + + -- C Function: int PyMapping_HasKeyString (PyObject *o, const char + *key) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyMapping_HasKey(): 37a, but 'key' is specified as a const char* + UTF-8 encoded bytes string, rather than a *note PyObject: 334.*. + + Note: Exceptions that occur when this calls *note + __getitem__(): 285. method or while creating the temporary + *note str: 447. object are silently ignored. For proper error + handling, use *note PyMapping_HasKeyStringWithError(): 37b, + *note PyMapping_GetOptionalItemString(): 341. or *note + PyMapping_GetItemString(): 343. instead. + + -- C Function: *note PyObject: 334. *PyMapping_Keys (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' On success, return a list of the keys in object 'o'. On + failure, return ‘NULL’. + + Changed in version 3.7: Previously, the function returned a list or + a tuple. + + -- C Function: *note PyObject: 334. *PyMapping_Values (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' On success, return a list of the values in object 'o'. On + failure, return ‘NULL’. + + Changed in version 3.7: Previously, the function returned a list or + a tuple. + + -- C Function: *note PyObject: 334. *PyMapping_Items (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' On success, return a list of the items in object 'o', where + each item is a tuple containing a key-value pair. On failure, + return ‘NULL’. + + Changed in version 3.7: Previously, the function returned a list or + a tuple. + + +File: python.info, Node: Iterator Protocol, Next: Buffer Protocol, Prev: Mapping Protocol, Up: Abstract Objects Layer + +7.7.6 Iterator Protocol +----------------------- + +There are two functions specifically for working with iterators. + + -- C Function: int PyIter_Check (PyObject *o) + ' Part of the *note Stable ABI: 550. since version 3.8.' Return + non-zero if the object 'o' can be safely passed to *note + PyIter_Next(): 4a13, and ‘0’ otherwise. This function always + succeeds. + + -- C Function: int PyAIter_Check (PyObject *o) + ' Part of the *note Stable ABI: 550. since version 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 Function: *note PyObject: 334. *PyIter_Next (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the next value from the iterator 'o'. The object + must be an iterator according to *note PyIter_Check(): 18f4. (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. + +To write a loop which iterates over an iterator, the C code should look +something like this: + + PyObject *iterator = PyObject_GetIter(obj); + PyObject *item; + + if (iterator == NULL) { + /* propagate error */ + } + + while ((item = PyIter_Next(iterator))) { + /* do something with item */ + ... + /* release reference when done */ + Py_DECREF(item); + } + + Py_DECREF(iterator); + + if (PyErr_Occurred()) { + /* propagate error */ + } + else { + /* continue doing useful work */ + } + + -- C Type: type PySendResult + + The enum value used to represent different results of *note + PyIter_Send(): 896. + + Added in version 3.10. + + -- C Function: *note PySendResult: 4bc7. PyIter_Send (PyObject *iter, + PyObject *arg, PyObject **presult) + ' Part of the *note Stable ABI: 550. since version 3.10.' Sends + the 'arg' value into the iterator 'iter'. Returns: + + - ‘PYGEN_RETURN’ if iterator returns. Return value is returned + via 'presult'. + + - ‘PYGEN_NEXT’ if iterator yields. Yielded value is returned + via 'presult'. + + - ‘PYGEN_ERROR’ if iterator has raised and exception. 'presult' + is set to ‘NULL’. + + Added in version 3.10. + + +File: python.info, Node: Buffer Protocol, Prev: Iterator Protocol, Up: Abstract Objects Layer + +7.7.7 Buffer Protocol +--------------------- + +Certain objects available in Python wrap access to an underlying memory +array or 'buffer'. Such objects include the built-in *note bytes: 1c2. +and *note bytearray: 53a, and some extension types like *note +array.array: 1a0. Third-party libraries may define their own types for +special purposes, such as image processing or numeric analysis. + +While each of these types have their own semantics, they share the +common characteristic of being backed by a possibly large memory buffer. +It is then desirable, in some situations, to access that buffer directly +and without intermediate copying. + +Python provides such a facility at the C and Python level in the form of +the *note buffer protocol: 393. 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 Structures: 4bca.; for Python see *note + Emulating buffer types: 1fc3. + + - 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: 464. + +Simple objects such as *note bytes: 1c2. and *note bytearray: 53a. +expose their underlying buffer in byte-oriented form. Other forms are +possible; for example, the elements exposed by an *note array.array: +1a0. can be multi-byte values. + +An example consumer of the buffer interface is the *note write(): cdb. +method of file objects: any object that can export a series of bytes +through the buffer interface can be written to a file. While ‘write()’ +only needs read-only access to the internal contents of the object +passed to it, other methods such as *note readinto(): 2c27. need write +access to the contents of their argument. The buffer interface allows +objects to selectively allow or reject exporting of read-write and +read-only buffers. + +There are two ways for a consumer of the buffer interface to acquire a +buffer over a target object: + + * call *note PyObject_GetBuffer(): 395. with the right parameters; + + * call *note PyArg_ParseTuple(): 56e. (or one of its siblings) with + one of the ‘y*’, ‘w*’ or ‘s*’ *note format codes: 8a7. + +In both cases, *note PyBuffer_Release(): 396. must be called when the +buffer isn’t needed anymore. Failure to do so could lead to various +issues such as resource leaks. + +Added in version 3.12: The buffer protocol is now accessible in Python, +see *note Emulating buffer types: 1fc3. and *note memoryview: 464. + +* Menu: + +* Buffer structure:: +* Buffer request types:: +* Complex arrays:: +* Buffer-related functions:: + + +File: python.info, Node: Buffer structure, Next: Buffer request types, Up: Buffer Protocol + +7.7.7.1 Buffer structure +........................ + +Buffer structures (or simply “buffers”) are useful as a way to expose +the binary data from another object to the Python programmer. They can +also be used as a zero-copy slicing mechanism. Using their ability to +reference a block of memory, it is possible to expose any data to the +Python programmer quite easily. The memory could be a large, constant +array in a C extension, it could be a raw block of memory for +manipulation before passing to an operating system library, or it could +be used to pass around structured data in its native, in-memory format. + +Contrary to most data types exposed by the Python interpreter, buffers +are not *note PyObject: 334. pointers but rather simple C structures. +This allows them to be created and copied very simply. When a generic +wrapper around a buffer is needed, a *note memoryview: 4bcd. object can +be created. + +For short instructions how to write an exporting object, see *note +Buffer Object Structures: 4bca. For obtaining a buffer, see *note +PyObject_GetBuffer(): 395. + + -- C Type: type Py_buffer + ' Part of the *note Stable ABI: 550. (including all members) since + version 3.11.' + -- C Member: void *buf + + A pointer to the start of the logical structure described by + the buffer fields. This can be any location within the + underlying physical memory block of the exporter. For + example, with negative *note strides: 4bcf. the value may + point to the end of the memory block. + + For *note contiguous: 2227. arrays, the value points to the + beginning of the memory block. + + -- C Member: *note PyObject: 334. *obj + + A new reference to the exporting object. The reference is + owned by the consumer and automatically released (i.e. + reference count decremented) and set to ‘NULL’ by *note + PyBuffer_Release(): 396. The field is the equivalent of the + return value of any standard C-API function. + + As a special case, for 'temporary' buffers that are wrapped by + *note PyMemoryView_FromBuffer(): 75c. or *note + PyBuffer_FillInfo(): 75b. this field is ‘NULL’. In general, + exporting objects MUST NOT use this scheme. + + -- C Member: *note Py_ssize_t: a5f. len + + ‘product(shape) * itemsize’. For contiguous arrays, this is + the length of the underlying memory block. For non-contiguous + arrays, it is the length that the logical structure would have + if it were copied to a contiguous representation. + + Accessing ‘((char *)buf)[0] up to ((char *)buf)[len-1]’ is + only valid if the buffer has been obtained by a request that + guarantees contiguity. In most cases such a request will be + *note PyBUF_SIMPLE: 4bd2. or *note PyBUF_WRITABLE: 1386. + + -- C Member: int readonly + + An indicator of whether the buffer is read-only. This field + is controlled by the *note PyBUF_WRITABLE: 1386. flag. + + -- C Member: *note Py_ssize_t: a5f. itemsize + + Item size in bytes of a single element. Same as the value of + *note struct.calcsize(): 19c3. called on non-‘NULL’ *note + format: 4bd5. values. + + Important exception: If a consumer requests a buffer without + the *note PyBUF_FORMAT: 4bd6. flag, *note format: 4bd5. will + be set to ‘NULL’, but *note itemsize: 4bd4. still has the + value for the original format. + + If *note shape: 4bd7. is present, the equality ‘product(shape) + * itemsize == len’ still holds and the consumer can use *note + itemsize: 4bd4. to navigate the buffer. + + If *note shape: 4bd7. is ‘NULL’ as a result of a *note + PyBUF_SIMPLE: 4bd2. or a *note PyBUF_WRITABLE: 1386. request, + the consumer must disregard *note itemsize: 4bd4. and assume + ‘itemsize == 1’. + + -- C Member: char *format + + A 'NULL' terminated string in *note struct: d5. module style + syntax describing the contents of a single item. If this is + ‘NULL’, ‘"B"’ (unsigned bytes) is assumed. + + This field is controlled by the *note PyBUF_FORMAT: 4bd6. + flag. + + -- C Member: int ndim + + The number of dimensions the memory represents as an + n-dimensional array. If it is ‘0’, *note buf: 4bce. points to + a single item representing a scalar. In this case, *note + shape: 4bd7, *note strides: 4bcf. and *note suboffsets: 4bd9. + MUST be ‘NULL’. The maximum number of dimensions is given by + *note PyBUF_MAX_NDIM: 4bda. + + -- C Member: *note Py_ssize_t: a5f. *shape + + An array of *note Py_ssize_t: a5f. of length *note ndim: 4bd8. + indicating the shape of the memory as an n-dimensional array. + Note that ‘shape[0] * ... * shape[ndim-1] * itemsize’ MUST be + equal to *note len: 4bd1. + + Shape values are restricted to ‘shape[n] >= 0’. The case + ‘shape[n] == 0’ requires special attention. See *note complex + arrays: 4bdb. for further information. + + The shape array is read-only for the consumer. + + -- C Member: *note Py_ssize_t: a5f. *strides + + An array of *note Py_ssize_t: a5f. of length *note ndim: 4bd8. + giving the number of bytes to skip to get to a new element in + each dimension. + + Stride values can be any integer. For regular arrays, strides + are usually positive, but a consumer MUST be able to handle + the case ‘strides[n] <= 0’. See *note complex arrays: 4bdb. + for further information. + + The strides array is read-only for the consumer. + + -- C Member: *note Py_ssize_t: a5f. *suboffsets + + An array of *note Py_ssize_t: a5f. of length *note ndim: 4bd8. + If ‘suboffsets[n] >= 0’, the values stored along the nth + dimension are pointers and the suboffset value dictates how + many bytes to add to each pointer after de-referencing. A + suboffset value that is negative indicates that no + de-referencing should occur (striding in a contiguous memory + block). + + If all suboffsets are negative (i.e. no de-referencing is + needed), then this field must be ‘NULL’ (the default value). + + This type of array representation is used by the Python + Imaging Library (PIL). See *note complex arrays: 4bdb. for + further information how to access elements of such an array. + + The suboffsets array is read-only for the consumer. + + -- C Member: void *internal + + This is for use internally by the exporting object. For + example, this might be re-cast as an integer by the exporter + and used to store flags about whether or not the shape, + strides, and suboffsets arrays must be freed when the buffer + is released. The consumer MUST NOT alter this value. + +Constants: + + -- C Macro: PyBUF_MAX_NDIM + + 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: Buffer request types, Next: Complex arrays, Prev: Buffer structure, Up: Buffer Protocol + +7.7.7.2 Buffer request types +............................ + +Buffers are usually obtained by sending a buffer request to an exporting +object via *note PyObject_GetBuffer(): 395. Since the complexity of the +logical structure of the memory can vary drastically, the consumer uses +the 'flags' argument to specify the exact buffer type it can handle. + +All *note Py_buffer: 753. fields are unambiguously defined by the +request type. + +* Menu: + +* request-independent fields:: +* readonly, format: readonly format. +* shape, strides, suboffsets: shape strides suboffsets. +* contiguity requests:: +* compound requests:: + + +File: python.info, Node: request-independent fields, Next: readonly format, Up: Buffer request types + +7.7.7.3 request-independent fields +.................................. + +The following fields are not influenced by 'flags' and must always be +filled in with the correct values: *note obj: 4bd0, *note buf: 4bce, +*note len: 4bd1, *note itemsize: 4bd4, *note ndim: 4bd8. + + +File: python.info, Node: readonly format, Next: shape strides suboffsets, Prev: request-independent fields, Up: Buffer request types + +7.7.7.4 readonly, format +........................ + + -- C Macro: PyBUF_WRITABLE + + Controls the *note readonly: 4bd3. 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: 4bd2. | *note PyBUF_WRITABLE: 1386. can be used + to request a simple writable buffer. + + -- C Macro: PyBUF_FORMAT + + Controls the *note format: 4bd5. field. If set, this field + MUST be filled in correctly. Otherwise, this field MUST be + ‘NULL’. + +*note PyBUF_WRITABLE: 1386. can be |’d to any of the flags in the next +section. Since *note PyBUF_SIMPLE: 4bd2. is defined as 0, *note +PyBUF_WRITABLE: 1386. can be used as a stand-alone flag to request a +simple writable buffer. + +*note PyBUF_FORMAT: 4bd6. must be |’d to any of the flags except *note +PyBUF_SIMPLE: 4bd2, 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: contiguity requests, Prev: readonly format, Up: Buffer request types + +7.7.7.5 shape, strides, suboffsets +.................................. + +The flags that control the logical structure of the memory are listed in +decreasing order of complexity. Note that each flag contains all bits +of the flags below it. + +Request shape strides suboffsets + +----------------------------------------------------------------------------- + + -- C Macro: PyBUF_INDIRECT yes yes if needed + + + -- C Macro: PyBUF_STRIDES yes yes NULL + + + -- C Macro: PyBUF_ND yes NULL NULL + + + -- C Macro: PyBUF_SIMPLE NULL NULL NULL + + + +File: python.info, Node: contiguity requests, Next: compound requests, Prev: shape strides suboffsets, Up: Buffer request types + +7.7.7.6 contiguity requests +........................... + +C or Fortran *note contiguity: 2227. can be explicitly requested, with +and without stride information. Without stride information, the buffer +must be C-contiguous. + +Request shape strides suboffsets contig + +------------------------------------------------------------------------------------------------ + + -- C Macro: PyBUF_C_CONTIGUOUS yes yes NULL C + + + -- C Macro: PyBUF_F_CONTIGUOUS yes yes NULL F + + + -- C Macro: PyBUF_ANY_CONTIGUOUS yes yes NULL C or F + + +*note PyBUF_ND: 4be3. yes NULL NULL C + + + +File: python.info, Node: compound requests, Prev: contiguity requests, Up: Buffer request types + +7.7.7.7 compound requests +......................... + +All possible requests are fully defined by some combination of the flags +in the previous section. For convenience, the buffer protocol provides +frequently used combinations as single flags. + +In the following table 'U' stands for undefined contiguity. The +consumer would have to call *note PyBuffer_IsContiguous(): 759. to +determine contiguity. + +Request shape strides suboffsets contig readonly format + +------------------------------------------------------------------------------------------------------------------------ + + -- C Macro: PyBUF_FULL yes yes if needed U 0 yes + + + -- C Macro: PyBUF_FULL_RO yes yes if needed U 1 or 0 yes + + + -- C Macro: PyBUF_RECORDS yes yes NULL U 0 yes + + + -- C Macro: PyBUF_RECORDS_RO yes yes NULL U 1 or 0 yes + + + -- C Macro: PyBUF_STRIDED yes yes NULL U 0 NULL + + + -- C Macro: PyBUF_STRIDED_RO yes yes NULL U 1 or 0 NULL + + + -- C Macro: PyBUF_CONTIG yes NULL NULL C 0 NULL + + + -- C Macro: PyBUF_CONTIG_RO yes NULL NULL C 1 or 0 NULL + + + +File: python.info, Node: Complex arrays, Next: Buffer-related functions, Prev: Buffer request types, Up: Buffer Protocol + +7.7.7.8 Complex arrays +...................... + +* Menu: + +* NumPy-style; shape and strides: NumPy-style shape and strides. +* PIL-style; shape, strides and suboffsets: PIL-style shape strides and suboffsets. + + +File: python.info, Node: NumPy-style shape and strides, Next: PIL-style shape strides and suboffsets, Up: Complex arrays + +7.7.7.9 NumPy-style: shape and strides +...................................... + +The logical structure of NumPy-style arrays is defined by *note +itemsize: 4bd4, *note ndim: 4bd8, *note shape: 4bd7. and *note strides: +4bcf. + +If ‘ndim == 0’, the memory location pointed to by *note buf: 4bce. is +interpreted as a scalar of size *note itemsize: 4bd4. In that case, +both *note shape: 4bd7. and *note strides: 4bcf. are ‘NULL’. + +If *note strides: 4bcf. is ‘NULL’, the array is interpreted as a +standard n-dimensional C-array. Otherwise, the consumer must access an +n-dimensional array as follows: + + ptr = (char *)buf + indices[0] * strides[0] + ... + indices[n-1] * strides[n-1]; + item = *((typeof(item) *)ptr); + +As noted above, *note buf: 4bce. can point to any location within the +actual memory block. An exporter can check the validity of a buffer +with this function: + + 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-style shape strides and suboffsets, Prev: NumPy-style shape and strides, Up: Complex arrays + +7.7.7.10 PIL-style: shape, strides and suboffsets +................................................. + +In addition to the regular items, PIL-style arrays can contain pointers +that must be followed in order to get to the next element in a +dimension. For example, the regular three-dimensional C-array ‘char +v[2][2][3]’ can also be viewed as an array of 2 pointers to 2 +two-dimensional arrays: ‘char (*v[2])[2][3]’. In suboffsets +representation, those two pointers can be embedded at the start of *note +buf: 4bce, pointing to two ‘char x[2][3]’ arrays that can be located +anywhere in memory. + +Here is a function that returns a pointer to the element in an N-D array +pointed to by an N-dimensional index when there are both non-‘NULL’ +strides and suboffsets: + + 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: Buffer-related functions, Prev: Complex arrays, Up: Buffer Protocol + +7.7.7.11 Buffer-related functions +................................. + + -- C Function: int PyObject_CheckBuffer (PyObject *obj) + ' Part of the *note Stable ABI: 550. since version 3.11.' Return + ‘1’ if 'obj' supports the buffer interface otherwise ‘0’. When ‘1’ + is returned, it doesn’t guarantee that *note PyObject_GetBuffer(): + 395. will succeed. This function always succeeds. + + -- C Function: int PyObject_GetBuffer (PyObject *exporter, Py_buffer + *view, int flags) + ' Part of the *note Stable ABI: 550. since version 3.11.' Send a + request to 'exporter' to fill in 'view' as specified by 'flags'. + If the exporter cannot provide a buffer of the exact type, it MUST + raise *note BufferError: 1824, set ‘view->obj’ to ‘NULL’ and return + ‘-1’. + + On success, fill in 'view', set ‘view->obj’ to a new reference to + 'exporter' and return 0. In the case of chained buffer providers + that redirect requests to a single object, ‘view->obj’ MAY refer to + this object instead of 'exporter' (See *note Buffer Object + Structures: 4bca.). + + Successful calls to *note PyObject_GetBuffer(): 395. must be paired + with calls to *note PyBuffer_Release(): 396, similar to ‘malloc()’ + and ‘free()’. Thus, after the consumer is done with the buffer, + *note PyBuffer_Release(): 396. must be called exactly once. + + -- C Function: void PyBuffer_Release (Py_buffer *view) + ' Part of the *note Stable ABI: 550. since version 3.11.' Release + the buffer 'view' and release the *note strong reference: 338. + (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. + + It is an error to call this function on a buffer that was not + obtained via *note PyObject_GetBuffer(): 395. + + -- C Function: *note Py_ssize_t: a5f. PyBuffer_SizeFromFormat (const + char *format) + ' Part of the *note Stable ABI: 550. since version 3.11.' Return + the implied *note itemsize: 4bd4. from *note format: 4bd5. On + error, raise an exception and return -1. + + Added in version 3.9. + + -- C Function: int PyBuffer_IsContiguous (const Py_buffer *view, char + order) + ' Part of the *note Stable ABI: 550. since version 3.11.' Return + ‘1’ if the memory defined by the 'view' is C-style ('order' is + ‘'C'’) or Fortran-style ('order' is ‘'F'’) *note contiguous: 2227. + or either one ('order' is ‘'A'’). Return ‘0’ otherwise. This + function always succeeds. + + -- C Function: void *PyBuffer_GetPointer (const Py_buffer *view, const + Py_ssize_t *indices) + ' Part of the *note Stable ABI: 550. since version 3.11.' Get the + memory area pointed to by the 'indices' inside the given 'view'. + 'indices' must point to an array of ‘view->ndim’ indices. + + -- C Function: int PyBuffer_FromContiguous (const Py_buffer *view, + const void *buf, Py_ssize_t len, char fort) + ' Part of the *note Stable ABI: 550. since version 3.11.' Copy + contiguous 'len' bytes from 'buf' to 'view'. 'fort' can be ‘'C'’ + or ‘'F'’ (for C-style or Fortran-style ordering). ‘0’ is returned + on success, ‘-1’ on error. + + -- C Function: int PyBuffer_ToContiguous (void *buf, const Py_buffer + *src, Py_ssize_t len, char order) + ' Part of the *note Stable ABI: 550. since version 3.11.' Copy + 'len' bytes from 'src' to its contiguous representation in 'buf'. + '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. + + This function fails if 'len' != 'src->len'. + + -- C Function: int PyObject_CopyData (PyObject *dest, PyObject *src) + ' Part of the *note Stable ABI: 550. since version 3.11.' Copy + data from 'src' to 'dest' buffer. Can convert between C-style and + or Fortran-style buffers. + + ‘0’ is returned on success, ‘-1’ on error. + + -- C Function: void PyBuffer_FillContiguousStrides (int ndims, + Py_ssize_t *shape, Py_ssize_t *strides, int itemsize, char + order) + ' Part of the *note Stable ABI: 550. since version 3.11.' Fill the + 'strides' array with byte-strides of a *note contiguous: 2227. + (C-style if 'order' is ‘'C'’ or Fortran-style if 'order' is ‘'F'’) + array of the given shape with the given number of bytes per + element. + + -- C Function: int PyBuffer_FillInfo (Py_buffer *view, PyObject + *exporter, void *buf, Py_ssize_t len, int readonly, int flags) + ' Part of the *note Stable ABI: 550. since version 3.11.' Handle + buffer requests for an exporter that wants to expose 'buf' of size + 'len' with writability set according to 'readonly'. 'buf' is + interpreted as a sequence of unsigned bytes. + + The 'flags' argument indicates the request type. This function + always fills in 'view' as specified by flags, unless 'buf' has been + designated as read-only and *note PyBUF_WRITABLE: 1386. is set in + 'flags'. + + On success, set ‘view->obj’ to a new reference to 'exporter' and + return 0. Otherwise, raise *note BufferError: 1824, set + ‘view->obj’ to ‘NULL’ and return ‘-1’; + + If this function is used as part of a *note getbufferproc: 4bca, + 'exporter' MUST be set to the exporting object and 'flags' must be + passed unmodified. Otherwise, 'exporter' MUST be ‘NULL’. + + +File: python.info, Node: Concrete Objects Layer, Next: Initialization Finalization and Threads, Prev: Abstract Objects Layer, Up: Python/C API Reference Manual + +7.8 Concrete Objects Layer +========================== + +The functions in this chapter are specific to certain Python object +types. Passing them an object of the wrong type is not a good idea; if +you receive an object from a Python program and you are not sure that it +has the right type, you must perform a type check first; for example, to +check that an object is a dictionary, use *note PyDict_Check(): 4bf5. +The chapter is structured like the “family tree” of Python object types. + + Warning: While the functions described in this chapter carefully + check the type of the objects which are passed in, many of them do + not check for ‘NULL’ being passed instead of a valid object. + Allowing ‘NULL’ to be passed in can cause memory access violations + and immediate termination of the interpreter. + +* Menu: + +* Fundamental Objects:: +* Numeric Objects:: +* Sequence Objects:: +* Container Objects:: +* Function Objects: Function Objects<2>. +* Other Objects:: + + +File: python.info, Node: Fundamental Objects, Next: Numeric Objects, Up: Concrete Objects Layer + +7.8.1 Fundamental Objects +------------------------- + +This section describes Python type objects and the singleton object +‘None’. + +* Menu: + +* Type Objects: Type Objects<2>. +* The None Object:: + + +File: python.info, Node: Type Objects<2>, Next: The None Object, Up: Fundamental Objects + +7.8.1.1 Type Objects +.................... + + -- C Type: type PyTypeObject + ' Part of the *note Limited API: 550. (as an opaque struct).' The + C structure of the objects used to describe built-in types. + + -- C Variable: *note PyTypeObject: aa5. PyType_Type + ' Part of the *note Stable ABI: 550.' This is the type object for + type objects; it is the same object as *note type: d48. in the + Python layer. + + -- C Function: 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 Function: 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 Function: unsigned int PyType_ClearCache () + ' Part of the *note Stable ABI: 550.' Clear the internal lookup + cache. Return the current version tag. + + -- C Function: unsigned long PyType_GetFlags (PyTypeObject *type) + ' Part of the *note Stable ABI: 550.' Return the *note tp_flags: + 18bd. member of 'type'. This function is primarily meant for use + with ‘Py_LIMITED_API’; the individual flag bits are guaranteed to + be stable across Python releases, but access to *note tp_flags: + 18bd. itself is not part of the *note limited API: 391. + + Added in version 3.2. + + Changed in version 3.4: The return type is now ‘unsigned long’ + rather than ‘long’. + + -- C Function: *note PyObject: 334. *PyType_GetDict (PyTypeObject + *type) + + Return the type object’s internal namespace, which is otherwise + only exposed via a read-only proxy (*note cls.__dict__: c5d.). + This is a replacement for accessing *note tp_dict: 171e. 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(): 346.) + 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 Function: void PyType_Modified (PyTypeObject *type) + ' Part of the *note Stable ABI: 550.' Invalidate the internal + lookup cache for the type and all of its subtypes. This function + must be called after any manual modification of the attributes or + base classes of the type. + + -- C Function: 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(): 562. In case of error (e.g. no more watcher IDs + available), return ‘-1’ and set an exception. + + In free-threaded builds, *note PyType_AddWatcher(): 561. is not + thread-safe, so it must be called at start up (before spawning the + first thread). + + Added in version 3.12. + + -- C Function: int PyType_ClearWatcher (int watcher_id) + + Clear watcher identified by 'watcher_id' (previously returned from + *note PyType_AddWatcher(): 561.). 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(): 561. + + Added in version 3.12. + + -- C Function: int PyType_Watch (int watcher_id, PyObject *type) + + Mark 'type' as watched. The callback granted 'watcher_id' by *note + PyType_AddWatcher(): 561. will be called whenever *note + PyType_Modified(): 17f1. reports a change to 'type'. (The callback + may be called only once for a series of consecutive modifications + to 'type', if ‘_PyType_Lookup()’ is not called on 'type' between + the modifications; this is an implementation detail and subject to + change.) + + An extension should never call ‘PyType_Watch’ with a 'watcher_id' + that was not returned to it by a previous call to *note + PyType_AddWatcher(): 561. + + Added in version 3.12. + + -- C Type: typedef int (*PyType_WatchCallback)(*note PyObject: 334. + *type) + + Type of a type-watcher callback function. + + The callback must not modify 'type' or cause *note + PyType_Modified(): 17f1. to be called on 'type' or any type in its + MRO; violating this rule could cause infinite recursion. + + Added in version 3.12. + + -- C Function: 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 Function: 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: 778. + + -- C Function: int PyType_IsSubtype (PyTypeObject *a, PyTypeObject *b) + ' Part of the *note Stable ABI: 550.' Return true if 'a' is a + subtype of 'b'. + + This function only checks for actual subtypes, which means that + *note __subclasscheck__(): 1f7d. is not called on 'b'. Call *note + PyObject_IsSubclass(): ea0. to do the same check that *note + issubclass(): 7bc. would do. + + -- C Function: *note PyObject: 334. *PyType_GenericAlloc (PyTypeObject + *type, Py_ssize_t nitems) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Generic handler for the *note tp_alloc: 48ea. slot of a type + object. Use Python’s default memory allocation mechanism to + allocate a new instance and initialize all its contents to ‘NULL’. + + -- C Function: *note PyObject: 334. *PyType_GenericNew (PyTypeObject + *type, PyObject *args, PyObject *kwds) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Generic handler for the *note tp_new: 57c. slot of a type + object. Create a new instance using the type’s *note tp_alloc: + 48ea. slot. + + -- C Function: int PyType_Ready (PyTypeObject *type) + ' Part of the *note Stable ABI: 550.' Finalize a type object. + This should be called on all type objects to finish their + initialization. This function is responsible for adding inherited + slots from a type’s base class. Return ‘0’ on success, or return + ‘-1’ and sets an exception on error. + + Note: If some of the base classes implements the GC protocol + and the provided type does not include the *note + Py_TPFLAGS_HAVE_GC: 778. in its flags, then the GC protocol + will be automatically implemented from its parents. On the + contrary, if the type being created does include *note + Py_TPFLAGS_HAVE_GC: 778. in its flags then it 'must' implement + the GC protocol itself by at least implementing the *note + tp_traverse: 779. handle. + + -- C Function: *note PyObject: 334. *PyType_GetName (PyTypeObject + *type) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.11.' Return the type’s name. Equivalent to + getting the type’s *note __name__: 1474. attribute. + + Added in version 3.11. + + -- C Function: *note PyObject: 334. *PyType_GetQualName (PyTypeObject + *type) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.11.' Return the type’s qualified name. Equivalent + to getting the type’s *note __qualname__: 1f26. attribute. + + Added in version 3.11. + + -- C Function: *note PyObject: 334. *PyType_GetFullyQualifiedName + (PyTypeObject *type) + ' Part of the *note Stable ABI: 550. since version 3.13.' Return + the type’s fully qualified name. Equivalent to + ‘f"{type.__module__}.{type.__qualname__}"’, or *note + type.__qualname__: 1f26. if *note type.__module__: 36f. is not a + string or is equal to ‘"builtins"’. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyType_GetModuleName (PyTypeObject + *type) + ' Part of the *note Stable ABI: 550. since version 3.13.' Return + the type’s module name. Equivalent to getting the *note + type.__module__: 36f. attribute. + + Added in version 3.13. + + -- C Function: void *PyType_GetSlot (PyTypeObject *type, int slot) + ' Part of the *note Stable ABI: 550. since version 3.4.' Return + the function pointer stored in the given slot. If the result is + ‘NULL’, this indicates that either the slot is ‘NULL’, or that the + function was called with invalid parameters. Callers will + typically cast the result pointer into the appropriate function + type. + + See *note PyType_Slot.slot: 4bfe. for possible values of the 'slot' + argument. + + Added in version 3.4. + + Changed in version 3.10: *note PyType_GetSlot(): 89a. can now + accept all types. Previously, it was limited to *note heap types: + 965. + + -- C Function: *note PyObject: 334. *PyType_GetModule (PyTypeObject + *type) + ' Part of the *note Stable ABI: 550. since version 3.10.' Return + the module object associated with the given type when the type was + created using *note PyType_FromModuleAndSpec(): 54e. + + If no module is associated with the given type, sets *note + TypeError: 534. 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: 75f. to get the class that + defines the method. See *note PyType_GetModuleByDef(): 38f. for + cases when ‘PyCMethod’ cannot be used. + + Added in version 3.9. + + -- C Function: void *PyType_GetModuleState (PyTypeObject *type) + ' Part of the *note Stable ABI: 550. since version 3.10.' Return + the state of the module object associated with the given type. + This is a shortcut for calling *note PyModule_GetState(): 980. on + the result of *note PyType_GetModule(): 96e. + + If no module is associated with the given type, sets *note + TypeError: 534. 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 Function: *note PyObject: 334. *PyType_GetModuleByDef + (PyTypeObject *type, struct PyModuleDef *def) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550. since version 3.13.' Find the first superclass whose module + was created from the given *note PyModuleDef: 97d. 'def', and + return that module. + + If no module is found, raises a *note TypeError: 534. and returns + ‘NULL’. + + This function is intended to be used together with *note + PyModule_GetState(): 980. to get module state from slot methods + (such as *note tp_init: 57e. or *note nb_add: 4bff.) and other + places where a method’s defining class cannot be passed using the + *note PyCMethod: 75f. calling convention. + + The returned reference is *note borrowed: 339. from 'type', and + will be valid as long as you hold a reference to 'type'. Do not + release it with *note Py_DECREF(): 56c. or similar. + + Added in version 3.11. + + -- C Function: int PyUnstable_Type_AssignVersionTag (PyTypeObject + *type) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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. + +* Menu: + +* Creating Heap-Allocated Types:: + + +File: python.info, Node: Creating Heap-Allocated Types, Up: Type Objects<2> + +7.8.1.2 Creating Heap-Allocated Types +..................................... + +The following functions and structs are used to create *note heap types: +965. + + -- C Function: *note PyObject: 334. *PyType_FromMetaclass (PyTypeObject + *metaclass, PyObject *module, PyType_Spec *spec, PyObject + *bases) + ' Part of the *note Stable ABI: 550. since version 3.12.' Create + and return a *note heap type: 965. from the 'spec' (see *note + Py_TPFLAGS_HEAPTYPE: 8ae.). + + The metaclass 'metaclass' is used to construct the resulting type + object. When 'metaclass' is ‘NULL’, the metaclass is derived from + 'bases' (or 'Py_tp_base[s]' slots if 'bases' is ‘NULL’, see below). + + Metaclasses that override *note tp_new: 57c. are not supported, + except if ‘tp_new’ is ‘NULL’. (For backwards compatibility, other + ‘PyType_From*’ functions allow such metaclasses. They ignore + ‘tp_new’, which may result in incomplete initialization. This is + deprecated and in Python 3.14+ such metaclasses will not be + supported.) + + The 'bases' argument can be used to specify base classes; it can + either be only one class or a tuple of classes. If 'bases' is + ‘NULL’, the 'Py_tp_bases' slot is used instead. If that also is + ‘NULL’, the 'Py_tp_base' slot is used instead. If that also is + ‘NULL’, the new type derives from *note object: a8c. + + The 'module' argument can be used to record the module in which the + new class is defined. It must be a module object or ‘NULL’. If + not ‘NULL’, the module is associated with the new type and can + later be retrieved with *note PyType_GetModule(): 96e. The + associated module is not inherited by subclasses; it must be + specified for each class individually. + + This function calls *note PyType_Ready(): 777. on the new type. + + Note that this function does 'not' fully match the behavior of + calling *note type(): d48. or using the *note class: 12ca. + statement. With user-provided base types or metaclasses, prefer + *note calling: 4ba8. *note type: d48. (or the metaclass) over + ‘PyType_From*’ functions. Specifically: + + * *note __new__(): 57d. is not called on the new class (and it + must be set to ‘type.__new__’). + + * *note __init__(): 6ac. is not called on the new class. + + * *note __init_subclass__(): 62d. is not called on any bases. + + * *note __set_name__(): c4e. is not called on new descriptors. + + Added in version 3.12. + + -- C Function: *note PyObject: 334. *PyType_FromModuleAndSpec (PyObject + *module, PyType_Spec *spec, PyObject *bases) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.10.' Equivalent to ‘PyType_FromMetaclass(NULL, + module, spec, bases)’. + + Added in version 3.9. + + Changed in version 3.10: The function now accepts a single class as + the 'bases' argument and ‘NULL’ as the ‘tp_doc’ slot. + + Changed in version 3.12: The function now finds and uses a + metaclass corresponding to the provided base classes. Previously, + only *note type: d48. instances were returned. + + The *note tp_new: 57c. of the metaclass is 'ignored'. which may + result in incomplete initialization. Creating classes whose + metaclass overrides *note tp_new: 57c. is deprecated and in Python + 3.14+ it will be no longer allowed. + + -- C Function: *note PyObject: 334. *PyType_FromSpecWithBases + (PyType_Spec *spec, PyObject *bases) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.3.' Equivalent to ‘PyType_FromMetaclass(NULL, + NULL, spec, bases)’. + + Added in version 3.3. + + Changed in version 3.12: The function now finds and uses a + metaclass corresponding to the provided base classes. Previously, + only *note type: d48. instances were returned. + + The *note tp_new: 57c. of the metaclass is 'ignored'. which may + result in incomplete initialization. Creating classes whose + metaclass overrides *note tp_new: 57c. is deprecated and in Python + 3.14+ it will be no longer allowed. + + -- C Function: *note PyObject: 334. *PyType_FromSpec (PyType_Spec + *spec) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Equivalent to ‘PyType_FromMetaclass(NULL, NULL, spec, + NULL)’. + + Changed in version 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: d48. instances + were returned. + + The *note tp_new: 57c. of the metaclass is 'ignored'. which may + result in incomplete initialization. Creating classes whose + metaclass overrides *note tp_new: 57c. is deprecated and in Python + 3.14+ it will be no longer allowed. + + -- C Type: type PyType_Spec + ' Part of the *note Stable ABI: 550. (including all members).' + Structure defining a type’s behavior. + + -- C Member: const char *name + + Name of the type, used to set *note PyTypeObject.tp_name: + 18f2. + + -- C Member: int basicsize + + If positive, specifies the size of the instance in bytes. It + is used to set *note PyTypeObject.tp_basicsize: 987. + + If zero, specifies that *note tp_basicsize: 987. should be + inherited. + + If negative, the absolute value specifies how much space + instances of the class need 'in addition' to the superclass. + Use *note PyObject_GetTypeData(): 546. to get a pointer to + subclass-specific memory reserved this way. For negative + ‘basicsize’, Python will insert padding when needed to meet + *note tp_basicsize: 987.’s alignment requirements. + + Changed in version 3.12: Previously, this field could not be + negative. + + -- C Member: int itemsize + + Size of one element of a variable-size type, in bytes. Used + to set *note PyTypeObject.tp_itemsize: 1f70. See + ‘tp_itemsize’ documentation for caveats. + + If zero, *note tp_itemsize: 1f70. 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: + 1f70.). + + - The requested *note PyType_Spec.basicsize: 545. is + positive, suggesting that the memory layout of the base + class is known. + + - The requested *note PyType_Spec.basicsize: 545. is zero, + suggesting that the subclass does not access the + instance’s memory directly. + + - With the *note Py_TPFLAGS_ITEMS_AT_END: 548. flag. + + -- C Member: unsigned int flags + + Type flags, used to set *note PyTypeObject.tp_flags: 18bd. + + If the ‘Py_TPFLAGS_HEAPTYPE’ flag is not set, *note + PyType_FromSpecWithBases(): 57b. sets it automatically. + + -- C Member: *note PyType_Slot: 4a9b. *slots + + Array of *note PyType_Slot: 4a9b. structures. Terminated by + the special slot value ‘{0, NULL}’. + + Each slot ID should be specified at most once. + + -- C Type: type PyType_Slot + ' Part of the *note Stable ABI: 550. (including all members).' + Structure defining optional functionality of a type, containing a + slot ID and a value pointer. + + -- C Member: int slot + + A slot ID. + + Slot IDs are named like the field names of the structures + *note PyTypeObject: aa5, *note PyNumberMethods: 13e9, *note + PySequenceMethods: 490d, *note PyMappingMethods: 490e. and + *note PyAsyncMethods: 4c06. with an added ‘Py_’ prefix. For + example, use: + + * ‘Py_tp_dealloc’ to set *note PyTypeObject.tp_dealloc: + 48e8. + + * ‘Py_nb_add’ to set *note PyNumberMethods.nb_add: 4bff. + + * ‘Py_sq_length’ to set *note PySequenceMethods.sq_length: + 4c07. + + The following “offset” fields cannot be set using *note + PyType_Slot: 4a9b.: + + * *note tp_weaklistoffset: 988. (use *note + Py_TPFLAGS_MANAGED_WEAKREF: 557. instead if possible) + + * *note tp_dictoffset: 4c08. (use *note + Py_TPFLAGS_MANAGED_DICT: 366. instead if possible) + + * *note tp_vectorcall_offset: 4baa. (use + ‘"__vectorcalloffset__"’ in *note PyMemberDef: 4c09.) + + 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: 48eb. See *note + PyMemberDef documentation: 4c09. for details. + + The following fields cannot be set at all when creating a heap + type: + + * *note tp_vectorcall: 4c0a. (use *note tp_new: 57c. and/or + *note tp_init: 57e.) + + * Internal fields: *note tp_dict: 171e, *note tp_mro: 4c0b, + *note tp_cache: 4c0c, *note tp_subclasses: 56f, and *note + tp_weaklist: 4c0d. + + Setting ‘Py_tp_bases’ or ‘Py_tp_base’ may be problematic on + some platforms. To avoid issues, use the 'bases' argument of + *note PyType_FromSpecWithBases(): 57b. instead. + + Changed in version 3.9: Slots in *note PyBufferProcs: 4c0e. + may be set in the unlimited API. + + Changed in version 3.11: *note bf_getbuffer: 75d. and *note + bf_releasebuffer: 75e. are now available under the *note + limited API: 391. + + -- C Member: void *pfunc + + The desired value of the slot. In most cases, this is a + pointer to a function. + + Slots other than ‘Py_tp_doc’ may not be ‘NULL’. + + +File: python.info, Node: The None Object, Prev: Type Objects<2>, Up: Fundamental Objects + +7.8.1.3 The ‘None’ Object +......................... + +Note that the *note PyTypeObject: aa5. for ‘None’ is not directly +exposed in the Python/C API. Since ‘None’ is a singleton, testing for +object identity (using ‘==’ in C) is sufficient. There is no +‘PyNone_Check()’ function for the same reason. + + -- C Variable: *note PyObject: 334. *Py_None + + The Python ‘None’ object, denoting lack of value. This object has + no methods and is *note immortal: 4394. + + Changed in version 3.12: *note Py_None: 48b9. is *note immortal: + 4394. + + -- C Macro: Py_RETURN_NONE + + Return *note Py_None: 48b9. from a function. + + +File: python.info, Node: Numeric Objects, Next: Sequence Objects, Prev: Fundamental Objects, Up: Concrete Objects Layer + +7.8.2 Numeric Objects +--------------------- + +* Menu: + +* Integer Objects:: +* Boolean Objects:: +* Floating-Point Objects:: +* Complex Number Objects:: + + +File: python.info, Node: Integer Objects, Next: Boolean Objects, Up: Numeric Objects + +7.8.2.1 Integer Objects +....................... + +All integers are implemented as “long” integer objects of arbitrary +size. + +On error, most ‘PyLong_As*’ APIs return ‘(return type)-1’ which cannot +be distinguished from a number. Use *note PyErr_Occurred(): 18f1. to +disambiguate. + + -- C Type: type PyLongObject + ' Part of the *note Limited API: 550. (as an opaque struct).' This + subtype of *note PyObject: 334. represents a Python integer object. + + -- C Variable: *note PyTypeObject: aa5. PyLong_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python integer type. This is the + same object as *note int: 259. in the Python layer. + + -- C Function: int PyLong_Check (PyObject *p) + + Return true if its argument is a *note PyLongObject: 585. or a + subtype of *note PyLongObject: 585. This function always succeeds. + + -- C Function: int PyLong_CheckExact (PyObject *p) + + Return true if its argument is a *note PyLongObject: 585, but not a + subtype of *note PyLongObject: 585. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyLong_FromLong (long v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from 'v', or + ‘NULL’ on failure. + + The current implementation keeps an array of integer objects for + all integers between ‘-5’ and ‘256’. When you create an int in + that range you actually just get back a reference to the existing + object. + + -- C Function: *note PyObject: 334. *PyLong_FromUnsignedLong (unsigned + long v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from a C + unsigned long, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromSsize_t (Py_ssize_t v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from a C *note + Py_ssize_t: a5f, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromSize_t (size_t v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from a C + ‘size_t’, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromLongLong (long long v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from a C long + long, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromUnsignedLongLong + (unsigned long long v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from a C + unsigned long long, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromDouble (double v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. object from the + integer part of 'v', or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyLong_FromString (const char + *str, char **pend, int base) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyLongObject: 585. 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 Integer literals: 1ec8. definition; in + this case, leading zeros in a non-zero decimal number raises a + *note ValueError: 204. If 'base' is not ‘0’, it must be between + ‘2’ and ‘36’, inclusive. Leading and trailing whitespace and + single underscores after a base specifier and between digits are + ignored. If there are no digits or 'str' is not NULL-terminated + following the digits and trailing whitespace, *note ValueError: + 204. will be raised. + + See also + ........ + + Python methods *note int.to_bytes(): 188f. and *note + int.from_bytes(): 184f. to convert a *note PyLongObject: 585. + to/from an array of bytes in base ‘256’. You can call those from C + using *note PyObject_CallMethod(): 39b. + + -- C Function: *note PyObject: 334. *PyLong_FromUnicodeObject (PyObject + *u, int base) + 'Return value: New reference.' Convert a sequence of Unicode + digits in the string 'u' to a Python integer value. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyLong_FromVoidPtr (void *p) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Python integer from the pointer 'p'. The pointer + value can be retrieved from the resulting value using *note + PyLong_AsVoidPtr(): 4a20. + + -- C Function: *note PyObject: 334. *PyLong_FromNativeBytes (const void + *buffer, size_t n_bytes, int flags) + + 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(): 35c. 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(): 35e. Other flags + are ignored. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyLong_FromUnsignedNativeBytes + (const void *buffer, size_t n_bytes, int flags) + + 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(): 35c. 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 Function: long PyLong_AsLong (PyObject *obj) + ' Part of the *note Stable ABI: 550.' + + Return a C long representation of 'obj'. If 'obj' is not an + instance of *note PyLongObject: 585, first call its *note + __index__(): 718. method (if present) to convert it to a *note + PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'obj' is out of + range for a long. + + Returns ‘-1’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: long PyLong_AS_LONG (PyObject *obj) + + A *note soft deprecated: 20b. alias. Exactly equivalent to + the preferred ‘PyLong_AsLong’. In particular, it can fail + with *note OverflowError: 87f. or another exception. + + Deprecated since version 3.14: The function is soft + deprecated. + + -- C Function: int PyLong_AsInt (PyObject *obj) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note PyLong_AsLong(): 35b, but store the result in a C int + instead of a C long. + + Added in version 3.13. + + -- C Function: long PyLong_AsLongAndOverflow (PyObject *obj, int + *overflow) + ' Part of the *note Stable ABI: 550.' Return a C long + representation of 'obj'. If 'obj' is not an instance of *note + PyLongObject: 585, first call its *note __index__(): 718. method + (if present) to convert it to a *note PyLongObject: 585. + + 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. + + Returns ‘-1’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: long long PyLong_AsLongLong (PyObject *obj) + ' Part of the *note Stable ABI: 550.' + + Return a C long long representation of 'obj'. If 'obj' is not an + instance of *note PyLongObject: 585, first call its *note + __index__(): 718. method (if present) to convert it to a *note + PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'obj' is out of + range for a long long. + + Returns ‘-1’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: long long PyLong_AsLongLongAndOverflow (PyObject *obj, + int *overflow) + ' Part of the *note Stable ABI: 550.' Return a C long long + representation of 'obj'. If 'obj' is not an instance of *note + PyLongObject: 585, first call its *note __index__(): 718. method + (if present) to convert it to a *note PyLongObject: 585. + + 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. + + Returns ‘-1’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + Added in version 3.2. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: *note Py_ssize_t: a5f. PyLong_AsSsize_t (PyObject + *pylong) + ' Part of the *note Stable ABI: 550.' + + Return a C *note Py_ssize_t: a5f. representation of 'pylong'. + 'pylong' must be an instance of *note PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'pylong' is out of + range for a *note Py_ssize_t: a5f. + + Returns ‘-1’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: unsigned long PyLong_AsUnsignedLong (PyObject *pylong) + ' Part of the *note Stable ABI: 550.' + + Return a C unsigned long representation of 'pylong'. 'pylong' must + be an instance of *note PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'pylong' is out of + range for a unsigned long. + + Returns ‘(unsigned long)-1’ on error. Use *note PyErr_Occurred(): + 18f1. to disambiguate. + + -- C Function: size_t PyLong_AsSize_t (PyObject *pylong) + ' Part of the *note Stable ABI: 550.' + + Return a C ‘size_t’ representation of 'pylong'. 'pylong' must be + an instance of *note PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'pylong' is out of + range for a ‘size_t’. + + Returns ‘(size_t)-1’ on error. Use *note PyErr_Occurred(): 18f1. + to disambiguate. + + -- C Function: unsigned long long PyLong_AsUnsignedLongLong (PyObject + *pylong) + ' Part of the *note Stable ABI: 550.' + + Return a C unsigned long long representation of 'pylong'. 'pylong' + must be an instance of *note PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'pylong' is out of + range for an unsigned long long. + + Returns ‘(unsigned long long)-1’ on error. Use *note + PyErr_Occurred(): 18f1. to disambiguate. + + Changed in version 3.1: A negative 'pylong' now raises *note + OverflowError: 87f, not *note TypeError: 534. + + -- C Function: unsigned long PyLong_AsUnsignedLongMask (PyObject *obj) + ' Part of the *note Stable ABI: 550.' Return a C unsigned long + representation of 'obj'. If 'obj' is not an instance of *note + PyLongObject: 585, first call its *note __index__(): 718. method + (if present) to convert it to a *note PyLongObject: 585. + + If the value of 'obj' is out of range for an unsigned long, return + the reduction of that value modulo ‘ULONG_MAX + 1’. + + Returns ‘(unsigned long)-1’ on error. Use *note PyErr_Occurred(): + 18f1. to disambiguate. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: unsigned long long PyLong_AsUnsignedLongLongMask + (PyObject *obj) + ' Part of the *note Stable ABI: 550.' Return a C unsigned long + long representation of 'obj'. If 'obj' is not an instance of *note + PyLongObject: 585, first call its *note __index__(): 718. method + (if present) to convert it to a *note PyLongObject: 585. + + If the value of 'obj' is out of range for an unsigned long long, + return the reduction of that value modulo ‘ULLONG_MAX + 1’. + + Returns ‘(unsigned long long)-1’ on error. Use *note + PyErr_Occurred(): 18f1. to disambiguate. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + Changed in version 3.10: This function will no longer use *note + __int__(): 717. + + -- C Function: double PyLong_AsDouble (PyObject *pylong) + ' Part of the *note Stable ABI: 550.' Return a C double + representation of 'pylong'. 'pylong' must be an instance of *note + PyLongObject: 585. + + Raise *note OverflowError: 87f. if the value of 'pylong' is out of + range for a double. + + Returns ‘-1.0’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: void *PyLong_AsVoidPtr (PyObject *pylong) + ' Part of the *note Stable ABI: 550.' Convert a Python integer + 'pylong' to a C void pointer. If 'pylong' cannot be converted, an + *note OverflowError: 87f. will be raised. This is only assured to + produce a usable void pointer for values created with *note + PyLong_FromVoidPtr(): 4a23. + + Returns ‘NULL’ on error. Use *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: *note Py_ssize_t: a5f. PyLong_AsNativeBytes (PyObject + *pylong, void *buffer, Py_ssize_t n_bytes, int flags) + + 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: large buffers are + padded with zeroes. + + 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. + + Note: 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’. + + Note: 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 Value + + ------------------------------------------------------------- + + -- C Macro: Py_ASNATIVEBYTES_DEFAULTS ‘-1’ + + + -- C Macro: Py_ASNATIVEBYTES_BIG_ENDIAN ‘0’ + + + -- C Macro: Py_ASNATIVEBYTES_LITTLE_ENDIAN ‘1’ + + + -- C Macro: Py_ASNATIVEBYTES_NATIVE_ENDIAN ‘3’ + + + -- C Macro: Py_ASNATIVEBYTES_UNSIGNED_BUFFER ‘4’ + + + -- C Macro: Py_ASNATIVEBYTES_REJECT_NEGATIVE ‘8’ + + + -- C Macro: Py_ASNATIVEBYTES_ALLOW_INDEX ‘16’ + + + 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__(): 718. 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: 534. + + Note: 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 Function: *note PyObject: 334. *PyLong_GetInfo (void) + ' Part of the *note Stable ABI: 550.' On success, return a read + only *note named tuple: 64a, that holds information about Python’s + internal representation of integers. See *note sys.int_info: 1286. + for description of individual fields. + + On failure, return ‘NULL’ with an exception set. + + Added in version 3.1. + + -- C Function: int PyUnstable_Long_IsCompact (const PyLongObject *op) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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(): 587.; for others fall back to + a *note PyLong_As*: 4a1c. function or *note PyLong_AsNativeBytes(): + 35c. + + 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 Function: *note Py_ssize_t: a5f. PyUnstable_Long_CompactValue + (const PyLongObject *op) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + If 'op' is compact, as determined by *note + PyUnstable_Long_IsCompact(): 586, return its value. + + Otherwise, the return value is undefined. + + Added in version 3.12. + + +File: python.info, Node: Boolean Objects, Next: Floating-Point Objects, Prev: Integer Objects, Up: Numeric Objects + +7.8.2.2 Boolean Objects +....................... + +Booleans in Python are implemented as a subclass of integers. There are +only two booleans, *note Py_False: 4c25. and *note Py_True: 4c26. As +such, the normal creation and deletion functions don’t apply to +booleans. The following macros are available, however. + + -- C Variable: *note PyTypeObject: aa5. PyBool_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python boolean type; it is the + same object as *note bool: 463. in the Python layer. + + -- C Function: int PyBool_Check (PyObject *o) + + Return true if 'o' is of type *note PyBool_Type: 4966. This + function always succeeds. + + -- C Variable: *note PyObject: 334. *Py_False + + The Python ‘False’ object. This object has no methods and is *note + immortal: 4394. + + Changed in version 3.12: *note Py_False: 4c25. is *note immortal: + 4394. + + -- C Variable: *note PyObject: 334. *Py_True + + The Python ‘True’ object. This object has no methods and is *note + immortal: 4394. + + Changed in version 3.12: *note Py_True: 4c26. is *note immortal: + 4394. + + -- C Macro: Py_RETURN_FALSE + + Return *note Py_False: 4c25. from a function. + + -- C Macro: Py_RETURN_TRUE + + Return *note Py_True: 4c26. from a function. + + -- C Function: *note PyObject: 334. *PyBool_FromLong (long v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return *note Py_True: 4c26. or *note Py_False: 4c25, + depending on the truth value of 'v'. + + +File: python.info, Node: Floating-Point Objects, Next: Complex Number Objects, Prev: Boolean Objects, Up: Numeric Objects + +7.8.2.3 Floating-Point Objects +.............................. + + -- C Type: type PyFloatObject + + This subtype of *note PyObject: 334. represents a Python + floating-point object. + + -- C Variable: *note PyTypeObject: aa5. PyFloat_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python floating-point type. This + is the same object as *note float: 2f1. in the Python layer. + + -- C Function: int PyFloat_Check (PyObject *p) + + Return true if its argument is a *note PyFloatObject: 4c2b. or a + subtype of *note PyFloatObject: 4c2b. This function always + succeeds. + + -- C Function: int PyFloat_CheckExact (PyObject *p) + + Return true if its argument is a *note PyFloatObject: 4c2b, but not + a subtype of *note PyFloatObject: 4c2b. This function always + succeeds. + + -- C Function: *note PyObject: 334. *PyFloat_FromString (PyObject *str) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a *note PyFloatObject: 4c2b. object based on the + string value in 'str', or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyFloat_FromDouble (double v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a *note PyFloatObject: 4c2b. object from 'v', or + ‘NULL’ on failure. + + -- C Function: double PyFloat_AsDouble (PyObject *pyfloat) + ' Part of the *note Stable ABI: 550.' Return a C double + representation of the contents of 'pyfloat'. If 'pyfloat' is not a + Python floating-point object but has a *note __float__(): 9cc. + 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__(): 718. This method returns ‘-1.0’ upon failure, + so one should call *note PyErr_Occurred(): 18f1. to check for + errors. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + -- C Function: double PyFloat_AS_DOUBLE (PyObject *pyfloat) + + Return a C double representation of the contents of 'pyfloat', but + without error checking. + + -- C Function: *note PyObject: 334. *PyFloat_GetInfo (void) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a structseq instance which contains information about + the precision, minimum and maximum values of a float. It’s a thin + wrapper around the header file ‘float.h’. + + -- C Function: double PyFloat_GetMax () + ' Part of the *note Stable ABI: 550.' Return the maximum + representable finite float 'DBL_MAX' as C double. + + -- C Function: double PyFloat_GetMin () + ' Part of the *note Stable ABI: 550.' Return the minimum + normalized positive float 'DBL_MIN' as C double. + +* Menu: + +* Pack and Unpack functions:: + + +File: python.info, Node: Pack and Unpack functions, Up: Floating-Point Objects + +7.8.2.4 Pack and Unpack functions +................................. + +The pack and unpack functions provide an efficient platform-independent +way to store floating-point values as byte strings. The Pack routines +produce a bytes string from a C double, and the Unpack routines produce +a C double from such a bytes string. The suffix (2, 4 or 8) specifies +the number of bytes in the bytes string. + +On platforms that appear to use IEEE 754 formats these functions work by +copying bits. On other platforms, the 2-byte format is identical to the +IEEE 754 binary16 half-precision format, the 4-byte format (32-bit) is +identical to the IEEE 754 binary32 single precision format, and the +8-byte format to the IEEE 754 binary64 double precision format, although +the packing of INFs and NaNs (if such things exist on the platform) +isn’t handled correctly, and attempting to unpack a bytes string +containing an IEEE INF or NaN will raise an exception. + +On non-IEEE platforms with more precision, or larger dynamic range, than +IEEE 754 supports, not all values can be packed; on non-IEEE platforms +with less precision, or smaller dynamic range, not all values can be +unpacked. What happens in such cases is partly accidental (alas). + +Added in version 3.11. + +* Menu: + +* Pack functions:: +* Unpack functions:: + + +File: python.info, Node: Pack functions, Next: Unpack functions, Up: Pack and Unpack functions + +7.8.2.5 Pack functions +...................... + +The pack routines write 2, 4 or 8 bytes, starting at 'p'. 'le' is an +int argument, non-zero if you want the bytes string in little-endian +format (exponent last, at ‘p+1’, ‘p+3’, or ‘p+6’ ‘p+7’), zero if you +want big-endian format (exponent first, at 'p'). The ‘PY_BIG_ENDIAN’ +constant can be used to use the native endian: it is equal to ‘1’ on big +endian processor, or ‘0’ on little endian processor. + +Return value: ‘0’ if all is OK, ‘-1’ if error (and an exception is set, +most likely *note OverflowError: 87f.). + +There are two problems on non-IEEE platforms: + + * What this does is undefined if 'x' is a NaN or infinity. + + * ‘-0.0’ and ‘+0.0’ produce the same bytes string. + + -- C Function: int PyFloat_Pack2 (double x, char *p, int le) + + Pack a C double as the IEEE 754 binary16 half-precision format. + + -- C Function: int PyFloat_Pack4 (double x, char *p, int le) + + Pack a C double as the IEEE 754 binary32 single precision format. + + -- C Function: int PyFloat_Pack8 (double x, char *p, int le) + + Pack a C double as the IEEE 754 binary64 double precision format. + + +File: python.info, Node: Unpack functions, Prev: Pack functions, Up: Pack and Unpack functions + +7.8.2.6 Unpack functions +........................ + +The unpack routines read 2, 4 or 8 bytes, starting at 'p'. 'le' is an +int argument, non-zero if the bytes string is in little-endian format +(exponent last, at ‘p+1’, ‘p+3’ or ‘p+6’ and ‘p+7’), zero if big-endian +(exponent first, at 'p'). The ‘PY_BIG_ENDIAN’ constant can be used to +use the native endian: it is equal to ‘1’ on big endian processor, or +‘0’ on little endian processor. + +Return value: The unpacked double. On error, this is ‘-1.0’ and *note +PyErr_Occurred(): 18f1. is true (and an exception is set, most likely +*note OverflowError: 87f.). + +Note that on a non-IEEE platform this will refuse to unpack a bytes +string that represents a NaN or infinity. + + -- C Function: double PyFloat_Unpack2 (const char *p, int le) + + Unpack the IEEE 754 binary16 half-precision format as a C double. + + -- C Function: double PyFloat_Unpack4 (const char *p, int le) + + Unpack the IEEE 754 binary32 single precision format as a C double. + + -- C Function: double PyFloat_Unpack8 (const char *p, int le) + + Unpack the IEEE 754 binary64 double precision format as a C double. + + +File: python.info, Node: Complex Number Objects, Prev: Floating-Point Objects, Up: Numeric Objects + +7.8.2.7 Complex Number Objects +.............................. + +Python’s complex number objects are implemented as two distinct types +when viewed from the C API: one is the Python object exposed to Python +programs, and the other is a C structure which represents the actual +complex number value. The API provides functions for working with both. + +* Menu: + +* Complex Numbers as C Structures:: +* Complex Numbers as Python Objects:: + + +File: python.info, Node: Complex Numbers as C Structures, Next: Complex Numbers as Python Objects, Up: Complex Number Objects + +7.8.2.8 Complex Numbers as C Structures +....................................... + +Note that the functions which accept these structures as parameters and +return them as results do so 'by value' rather than dereferencing them +through pointers. This is consistent throughout the API. + + -- C Type: type Py_complex + + The C structure which corresponds to the value portion of a Python + complex number object. Most of the functions for dealing with + complex number objects use structures of this type as input or + output values, as appropriate. + + -- C Member: double real + -- C Member: double imag + + The structure is defined as: + + typedef struct { + double real; + double imag; + } Py_complex; + + -- C Function: *note Py_complex: 4b68. _Py_c_sum (Py_complex left, + Py_complex right) + + Return the sum of two complex numbers, using the C *note + Py_complex: 4b68. representation. + + -- C Function: *note Py_complex: 4b68. _Py_c_diff (Py_complex left, + Py_complex right) + + Return the difference between two complex numbers, using the C + *note Py_complex: 4b68. representation. + + -- C Function: *note Py_complex: 4b68. _Py_c_neg (Py_complex num) + + Return the negation of the complex number 'num', using the C *note + Py_complex: 4b68. representation. + + -- C Function: *note Py_complex: 4b68. _Py_c_prod (Py_complex left, + Py_complex right) + + Return the product of two complex numbers, using the C *note + Py_complex: 4b68. representation. + + -- C Function: *note Py_complex: 4b68. _Py_c_quot (Py_complex dividend, + Py_complex divisor) + + Return the quotient of two complex numbers, using the C *note + Py_complex: 4b68. representation. + + If 'divisor' is null, this method returns zero and sets ‘errno’ to + ‘EDOM’. + + -- C Function: *note Py_complex: 4b68. _Py_c_pow (Py_complex num, + Py_complex exp) + + Return the exponentiation of 'num' by 'exp', using the C *note + Py_complex: 4b68. representation. + + If 'num' is null and 'exp' is not a positive real number, this + method returns zero and sets ‘errno’ to ‘EDOM’. + + +File: python.info, Node: Complex Numbers as Python Objects, Prev: Complex Numbers as C Structures, Up: Complex Number Objects + +7.8.2.9 Complex Numbers as Python Objects +......................................... + + -- C Type: type PyComplexObject + + This subtype of *note PyObject: 334. represents a Python complex + number object. + + -- C Variable: *note PyTypeObject: aa5. PyComplex_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python complex number type. It + is the same object as *note complex: 2f2. in the Python layer. + + -- C Function: int PyComplex_Check (PyObject *p) + + Return true if its argument is a *note PyComplexObject: 4c3e. or a + subtype of *note PyComplexObject: 4c3e. This function always + succeeds. + + -- C Function: int PyComplex_CheckExact (PyObject *p) + + Return true if its argument is a *note PyComplexObject: 4c3e, but + not a subtype of *note PyComplexObject: 4c3e. This function always + succeeds. + + -- C Function: *note PyObject: 334. *PyComplex_FromCComplex (Py_complex + v) + 'Return value: New reference.' Create a new Python complex number + object from a C *note Py_complex: 4b68. value. Return ‘NULL’ with + an exception set on error. + + -- C Function: *note PyObject: 334. *PyComplex_FromDoubles (double + real, double imag) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note PyComplexObject: 4c3e. object from 'real' + and 'imag'. Return ‘NULL’ with an exception set on error. + + -- C Function: double PyComplex_RealAsDouble (PyObject *op) + ' Part of the *note Stable ABI: 550.' Return the real part of 'op' + as a C double. + + If 'op' is not a Python complex number object but has a *note + __complex__(): 5e3. 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(): + a69. and returns its result. + + Upon failure, this method returns ‘-1.0’ with an exception set, so + one should call *note PyErr_Occurred(): 18f1. to check for errors. + + Changed in version 3.13: Use *note __complex__(): 5e3. if + available. + + -- C Function: double PyComplex_ImagAsDouble (PyObject *op) + ' Part of the *note Stable ABI: 550.' Return the imaginary part of + 'op' as a C double. + + If 'op' is not a Python complex number object but has a *note + __complex__(): 5e3. 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(): + a69. and returns ‘0.0’ on success. + + Upon failure, this method returns ‘-1.0’ with an exception set, so + one should call *note PyErr_Occurred(): 18f1. to check for errors. + + Changed in version 3.13: Use *note __complex__(): 5e3. if + available. + + -- C Function: *note Py_complex: 4b68. PyComplex_AsCComplex (PyObject + *op) + + Return the *note Py_complex: 4b68. value of the complex number + 'op'. + + If 'op' is not a Python complex number object but has a *note + __complex__(): 5e3. 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__(): 9cc. If + ‘__float__()’ is not defined then it falls back to *note + __index__(): 718. + + Upon failure, this method returns *note Py_complex: 4b68. with + *note real: 4c36. set to ‘-1.0’ and with an exception set, so one + should call *note PyErr_Occurred(): 18f1. to check for errors. + + Changed in version 3.8: Use *note __index__(): 718. if available. + + +File: python.info, Node: Sequence Objects, Next: Container Objects, Prev: Numeric Objects, Up: Concrete Objects Layer + +7.8.3 Sequence Objects +---------------------- + +Generic operations on sequence objects were discussed in the previous +chapter; this section deals with the specific kinds of sequence objects +that are intrinsic to the Python language. + +* Menu: + +* Bytes Objects: Bytes Objects<2>. +* Byte Array Objects:: +* Unicode Objects and Codecs:: +* Tuple Objects:: +* Struct Sequence Objects:: +* List Objects:: + + +File: python.info, Node: Bytes Objects<2>, Next: Byte Array Objects, Up: Sequence Objects + +7.8.3.1 Bytes Objects +..................... + +These functions raise *note TypeError: 534. when expecting a bytes +parameter and called with a non-bytes parameter. + + -- C Type: type PyBytesObject + + This subtype of *note PyObject: 334. represents a Python bytes + object. + + -- C Variable: *note PyTypeObject: aa5. PyBytes_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python bytes type; it is the same + object as *note bytes: 1c2. in the Python layer. + + -- C Function: int PyBytes_Check (PyObject *o) + + Return true if the object 'o' is a bytes object or an instance of a + subtype of the bytes type. This function always succeeds. + + -- C Function: int PyBytes_CheckExact (PyObject *o) + + Return true if the object 'o' is a bytes object, but not an + instance of a subtype of the bytes type. This function always + succeeds. + + -- C Function: *note PyObject: 334. *PyBytes_FromString (const char *v) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new bytes object with a copy of the string 'v' as + value on success, and ‘NULL’ on failure. The parameter 'v' must + not be ‘NULL’; it will not be checked. + + -- C Function: *note PyObject: 334. *PyBytes_FromStringAndSize (const + char *v, Py_ssize_t len) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new bytes object with a copy of the string 'v' as + value and length 'len' on success, and ‘NULL’ on failure. If 'v' + is ‘NULL’, the contents of the bytes object are uninitialized. + + -- C Function: *note PyObject: 334. *PyBytes_FromFormat (const char + *format, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Take a C ‘printf()’-style 'format' string and a variable + number of arguments, calculate the size of the resulting Python + bytes object and return a bytes object with the values formatted + into it. The variable arguments must be C types and must + correspond exactly to the format characters in the 'format' string. + The following format characters are allowed: + + Format Characters Type Comment + + --------------------------------------------------------------------------------- + + ‘%%’ 'n/a' The literal % character. + + + ‘%c’ int A single byte, represented as a C + int. + + + ‘%d’ int Equivalent to ‘printf("%d")’. (1) + + + ‘%u’ unsigned int Equivalent to ‘printf("%u")’. (2) + + + ‘%ld’ long Equivalent to ‘printf("%ld")’. + (3) + + + ‘%lu’ unsigned long Equivalent to ‘printf("%lu")’. + (4) + + + ‘%zd’ *note Py_ssize_t: a5f.Equivalent to ‘printf("%zd")’. + (5) + + + ‘%zu’ size_t Equivalent to ‘printf("%zu")’. + (6) + + + ‘%i’ int Equivalent to ‘printf("%i")’. (7) + + + ‘%x’ int Equivalent to ‘printf("%x")’. (8) + + + ‘%s’ const char* A null-terminated C character + array. + + + ‘%p’ const void* The hex representation of a C + pointer. Mostly equivalent to + ‘printf("%p")’ except that it is + guaranteed to start with the + literal ‘0x’ regardless of what + the platform’s ‘printf’ yields. + + + An unrecognized format character causes all the rest of the format + string to be copied as-is to the result object, and any extra + arguments discarded. + + -- C Function: *note PyObject: 334. *PyBytes_FromFormatV (const char + *format, va_list vargs) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Identical to *note PyBytes_FromFormat(): 1a28. except that + it takes exactly two arguments. + + -- C Function: *note PyObject: 334. *PyBytes_FromObject (PyObject *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return the bytes representation of object 'o' that + implements the buffer protocol. + + -- C Function: *note Py_ssize_t: a5f. PyBytes_Size (PyObject *o) + ' Part of the *note Stable ABI: 550.' Return the length of the + bytes in bytes object 'o'. + + -- C Function: *note Py_ssize_t: a5f. PyBytes_GET_SIZE (PyObject *o) + + Similar to *note PyBytes_Size(): 4972, but without error checking. + + -- C Function: char *PyBytes_AsString (PyObject *o) + ' Part of the *note Stable ABI: 550.' Return a pointer to the + contents of 'o'. The pointer refers to the internal buffer of 'o', + which consists of ‘len(o) + 1’ bytes. The last byte in the buffer + is always null, regardless of whether there are any other null + bytes. The data must not be modified in any way, unless the object + was just created using ‘PyBytes_FromStringAndSize(NULL, size)’. It + must not be deallocated. If 'o' is not a bytes object at all, + *note PyBytes_AsString(): 885. returns ‘NULL’ and raises *note + TypeError: 534. + + -- C Function: char *PyBytes_AS_STRING (PyObject *string) + + Similar to *note PyBytes_AsString(): 885, but without error + checking. + + -- C Function: int PyBytes_AsStringAndSize (PyObject *obj, char + **buffer, Py_ssize_t *length) + ' Part of the *note Stable ABI: 550.' Return the null-terminated + contents of the object 'obj' through the output variables 'buffer' + and 'length'. Returns ‘0’ on success. + + If 'length' is ‘NULL’, the bytes object may not contain embedded + null bytes; if it does, the function returns ‘-1’ and a *note + ValueError: 204. is raised. + + The buffer refers to an internal buffer of 'obj', which includes an + additional null byte at the end (not counted in 'length'). The + data must not be modified in any way, unless the object was just + created using ‘PyBytes_FromStringAndSize(NULL, size)’. It must not + be deallocated. If 'obj' is not a bytes object at all, *note + PyBytes_AsStringAndSize(): 496c. returns ‘-1’ and raises *note + TypeError: 534. + + Changed in version 3.5: Previously, *note TypeError: 534. was + raised when embedded null bytes were encountered in the bytes + object. + + -- C Function: void PyBytes_Concat (PyObject **bytes, PyObject + *newpart) + ' Part of the *note Stable ABI: 550.' Create a new bytes object in + '*bytes' containing the contents of 'newpart' appended to 'bytes'; + the caller will own the new reference. The reference to the old + value of 'bytes' will be stolen. If the new object cannot be + created, the old reference to 'bytes' will still be discarded and + the value of '*bytes' will be set to ‘NULL’; the appropriate + exception will be set. + + -- C Function: void PyBytes_ConcatAndDel (PyObject **bytes, PyObject + *newpart) + ' Part of the *note Stable ABI: 550.' Create a new bytes object in + '*bytes' containing the contents of 'newpart' appended to 'bytes'. + This version releases the *note strong reference: 338. to 'newpart' + (i.e. decrements its reference count). + + -- C Function: int _PyBytes_Resize (PyObject **bytes, Py_ssize_t + newsize) + + Resize a bytes object. 'newsize' will be the new length of the + bytes object. You can think of it as creating a new bytes object + and destroying the old one, only more efficiently. Pass the + address of an existing bytes object as an lvalue (it may be written + into), and the new size desired. On success, '*bytes' holds the + resized bytes object and ‘0’ is returned; the address in '*bytes' + may differ from its input value. If the reallocation fails, the + original bytes object at '*bytes' is deallocated, '*bytes' is set + to ‘NULL’, *note MemoryError: 1576. is set, and ‘-1’ is returned. + + ---------- Footnotes ---------- + + (1) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (2) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (3) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (4) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (5) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (6) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (7) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + (8) For integer specifiers (d, u, ld, lu, zd, zu, i, x): the +0-conversion flag has effect even when a precision is given. + + +File: python.info, Node: Byte Array Objects, Next: Unicode Objects and Codecs, Prev: Bytes Objects<2>, Up: Sequence Objects + +7.8.3.2 Byte Array Objects +.......................... + + -- C Type: type PyByteArrayObject + + This subtype of *note PyObject: 334. represents a Python bytearray + object. + + -- C Variable: *note PyTypeObject: aa5. PyByteArray_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python bytearray type; it is the + same object as *note bytearray: 53a. in the Python layer. + +* Menu: + +* Type check macros:: +* Direct API functions:: +* Macros:: + + +File: python.info, Node: Type check macros, Next: Direct API functions, Up: Byte Array Objects + +7.8.3.3 Type check macros +......................... + + -- C Function: int PyByteArray_Check (PyObject *o) + + Return true if the object 'o' is a bytearray object or an instance + of a subtype of the bytearray type. This function always succeeds. + + -- C Function: int PyByteArray_CheckExact (PyObject *o) + + Return true if the object 'o' is a bytearray object, but not an + instance of a subtype of the bytearray type. This function always + succeeds. + + +File: python.info, Node: Direct API functions, Next: Macros, Prev: Type check macros, Up: Byte Array Objects + +7.8.3.4 Direct API functions +............................ + + -- C Function: *note PyObject: 334. *PyByteArray_FromObject (PyObject + *o) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new bytearray object from any object, 'o', that + implements the *note buffer protocol: 393. + + On failure, return ‘NULL’ with an exception set. + + -- C Function: *note PyObject: 334. *PyByteArray_FromStringAndSize + (const char *string, Py_ssize_t len) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a new bytearray object from 'string' and its length, + 'len'. + + On failure, return ‘NULL’ with an exception set. + + -- C Function: *note PyObject: 334. *PyByteArray_Concat (PyObject *a, + PyObject *b) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Concat bytearrays 'a' and 'b' and return a new bytearray + with the result. + + On failure, return ‘NULL’ with an exception set. + + -- C Function: *note Py_ssize_t: a5f. PyByteArray_Size (PyObject + *bytearray) + ' Part of the *note Stable ABI: 550.' Return the size of + 'bytearray' after checking for a ‘NULL’ pointer. + + -- C Function: char *PyByteArray_AsString (PyObject *bytearray) + ' Part of the *note Stable ABI: 550.' Return the contents of + 'bytearray' as a char array after checking for a ‘NULL’ pointer. + The returned array always has an extra null byte appended. + + -- C Function: int PyByteArray_Resize (PyObject *bytearray, Py_ssize_t + len) + ' Part of the *note Stable ABI: 550.' Resize the internal buffer + of 'bytearray' to 'len'. + + +File: python.info, Node: Macros, Prev: Direct API functions, Up: Byte Array Objects + +7.8.3.5 Macros +.............. + +These macros trade safety for speed and they don’t check pointers. + + -- C Function: char *PyByteArray_AS_STRING (PyObject *bytearray) + + Similar to *note PyByteArray_AsString(): 4967, but without error + checking. + + -- C Function: *note Py_ssize_t: a5f. PyByteArray_GET_SIZE (PyObject + *bytearray) + + Similar to *note PyByteArray_Size(): 496a, but without error + checking. + + +File: python.info, Node: Unicode Objects and Codecs, Next: Tuple Objects, Prev: Byte Array Objects, Up: Sequence Objects + +7.8.3.6 Unicode Objects and Codecs +.................................. + +* Menu: + +* Unicode Objects:: +* Built-in Codecs:: +* Methods and Slot Functions:: + + +File: python.info, Node: Unicode Objects, Next: Built-in Codecs, Up: Unicode Objects and Codecs + +7.8.3.7 Unicode Objects +....................... + +Since the implementation of PEP 393(1) in Python 3.3, Unicode objects +internally use a variety of representations, in order to allow handling +the complete range of Unicode characters while staying memory efficient. +There are special cases for strings where all code points are below 128, +256, or 65536; otherwise, code points must be below 1114112 (which is +the full Unicode range). + +UTF-8 representation is created on demand and cached in the Unicode +object. + + Note: The *note Py_UNICODE: 3e9. representation has been removed + since Python 3.12 with deprecated APIs. See PEP 623(2) for more + information. + +* Menu: + +* Unicode Type:: +* Unicode Character Properties:: +* Creating and accessing Unicode strings:: +* Locale Encoding:: +* File System Encoding:: +* wchar_t Support:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0393/ + + (2) https://peps.python.org/pep-0623/ + + +File: python.info, Node: Unicode Type, Next: Unicode Character Properties, Up: Unicode Objects + +7.8.3.8 Unicode Type +.................... + +These are the basic Unicode object types used for the Unicode +implementation in Python: + + -- C Type: type Py_UCS4 + -- C Type: type Py_UCS2 + -- C Type: type Py_UCS1 + ' Part of the *note Stable ABI: 550.' These types are typedefs for + unsigned integer types wide enough to contain characters of 32 + bits, 16 bits and 8 bits, respectively. When dealing with single + Unicode characters, use *note Py_UCS4: 29d. + + Added in version 3.3. + + -- C Type: type Py_UNICODE + + This is a typedef of ‘wchar_t’, which is a 16-bit type or 32-bit + type depending on the platform. + + Changed in version 3.3: In previous versions, this was a 16-bit + type or a 32-bit type depending on whether you selected a “narrow” + or “wide” Unicode version of Python at build time. + + Deprecated since version 3.13, will be removed in version 3.15. + + -- C Type: type PyASCIIObject + -- C Type: type PyCompactUnicodeObject + -- C Type: type PyUnicodeObject + + These subtypes of *note PyObject: 334. represent a Python Unicode + object. In almost all cases, they shouldn’t be used directly, + since all API functions that deal with Unicode objects take and + return *note PyObject: 334. pointers. + + Added in version 3.3. + + -- C Variable: *note PyTypeObject: aa5. PyUnicode_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python Unicode type. It is + exposed to Python code as ‘str’. + + -- C Variable: *note PyTypeObject: aa5. PyUnicodeIter_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python Unicode iterator type. It + is used to iterate over Unicode string objects. + +The following APIs are C macros and static inlined functions for fast +checks and access to internal read-only data of Unicode objects: + + -- C Function: int PyUnicode_Check (PyObject *obj) + + Return true if the object 'obj' is a Unicode object or an instance + of a Unicode subtype. This function always succeeds. + + -- C Function: int PyUnicode_CheckExact (PyObject *obj) + + Return true if the object 'obj' is a Unicode object, but not an + instance of a subtype. This function always succeeds. + + -- C Function: int PyUnicode_READY (PyObject *unicode) + + Returns ‘0’. This API is kept only for backward compatibility. + + Added in version 3.3. + + Deprecated since version 3.10: This API does nothing since Python + 3.12. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_GET_LENGTH (PyObject + *unicode) + + Return the length of the Unicode string, in code points. 'unicode' + has to be a Unicode object in the “canonical” representation (not + checked). + + Added in version 3.3. + + -- C Function: *note Py_UCS1: 1167. *PyUnicode_1BYTE_DATA (PyObject + *unicode) + -- C Function: *note Py_UCS2: 1168. *PyUnicode_2BYTE_DATA (PyObject + *unicode) + -- C Function: *note Py_UCS4: 29d. *PyUnicode_4BYTE_DATA (PyObject + *unicode) + + Return a pointer to the canonical representation cast to UCS1, UCS2 + or UCS4 integer types for direct character access. No checks are + performed if the canonical representation has the correct character + size; use *note PyUnicode_KIND(): 1171. to select the right + function. + + Added in version 3.3. + + -- C Macro: PyUnicode_1BYTE_KIND + -- C Macro: PyUnicode_2BYTE_KIND + -- C Macro: PyUnicode_4BYTE_KIND + + Return values of the *note PyUnicode_KIND(): 1171. macro. + + Added in version 3.3. + + Changed in version 3.12: ‘PyUnicode_WCHAR_KIND’ has been removed. + + -- C Function: int PyUnicode_KIND (PyObject *unicode) + + Return one of the PyUnicode kind constants (see above) that + indicate how many bytes per character this Unicode object uses to + store its data. 'unicode' has to be a Unicode object in the + “canonical” representation (not checked). + + Added in version 3.3. + + -- C Function: void *PyUnicode_DATA (PyObject *unicode) + + Return a void pointer to the raw Unicode buffer. 'unicode' has to + be a Unicode object in the “canonical” representation (not + checked). + + Added in version 3.3. + + -- C Function: void PyUnicode_WRITE (int kind, void *data, Py_ssize_t + index, Py_UCS4 value) + + Write into a canonical representation 'data' (as obtained with + *note PyUnicode_DATA(): 116d.). This function performs no sanity + checks, and is intended for usage in loops. The caller should + cache the 'kind' value and 'data' pointer as obtained from other + calls. 'index' is the index in the string (starts at 0) and + 'value' is the new code point value which should be written to that + location. + + Added in version 3.3. + + -- C Function: *note Py_UCS4: 29d. PyUnicode_READ (int kind, void + *data, Py_ssize_t index) + + Read a code point from a canonical representation 'data' (as + obtained with *note PyUnicode_DATA(): 116d.). No checks or ready + calls are performed. + + Added in version 3.3. + + -- C Function: *note Py_UCS4: 29d. PyUnicode_READ_CHAR (PyObject + *unicode, Py_ssize_t index) + + Read a character from a Unicode object 'unicode', which must be in + the “canonical” representation. This is less efficient than *note + PyUnicode_READ(): 1175. if you do multiple consecutive reads. + + Added in version 3.3. + + -- C Function: *note Py_UCS4: 29d. PyUnicode_MAX_CHAR_VALUE (PyObject + *unicode) + + Return the maximum code point that is suitable for creating another + string based on 'unicode', which must be in the “canonical” + representation. This is always an approximation but more efficient + than iterating over the string. + + Added in version 3.3. + + -- C Function: int PyUnicode_IsIdentifier (PyObject *unicode) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if the string is + a valid identifier according to the language definition, section + *note Identifiers and keywords: 1e94. Return ‘0’ otherwise. + + Changed in version 3.9: The function does not call *note + Py_FatalError(): 983. anymore if the string is not ready. + + +File: python.info, Node: Unicode Character Properties, Next: Creating and accessing Unicode strings, Prev: Unicode Type, Up: Unicode Objects + +7.8.3.9 Unicode Character Properties +.................................... + +Unicode provides many different character properties. The most often +needed ones are available through these macros which are mapped to C +functions depending on the Python configuration. + + -- C Function: int Py_UNICODE_ISSPACE (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a whitespace + character. + + -- C Function: int Py_UNICODE_ISLOWER (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a lowercase + character. + + -- C Function: int Py_UNICODE_ISUPPER (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is an uppercase + character. + + -- C Function: int Py_UNICODE_ISTITLE (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a titlecase + character. + + -- C Function: int Py_UNICODE_ISLINEBREAK (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a linebreak + character. + + -- C Function: int Py_UNICODE_ISDECIMAL (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a decimal character. + + -- C Function: int Py_UNICODE_ISDIGIT (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a digit character. + + -- C Function: int Py_UNICODE_ISNUMERIC (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is a numeric character. + + -- C Function: int Py_UNICODE_ISALPHA (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is an alphabetic + character. + + -- C Function: int Py_UNICODE_ISALNUM (Py_UCS4 ch) + + Return ‘1’ or ‘0’ depending on whether 'ch' is an alphanumeric + character. + + -- C Function: 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(): dd7. + +These APIs can be used for fast direct character conversions: + + -- C Function: *note Py_UCS4: 29d. Py_UNICODE_TOLOWER (Py_UCS4 ch) + + Return the character 'ch' converted to lower case. + + -- C Function: *note Py_UCS4: 29d. Py_UNICODE_TOUPPER (Py_UCS4 ch) + + Return the character 'ch' converted to upper case. + + -- C Function: *note Py_UCS4: 29d. Py_UNICODE_TOTITLE (Py_UCS4 ch) + + Return the character 'ch' converted to title case. + + -- C Function: 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 Function: 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 Function: double Py_UNICODE_TONUMERIC (Py_UCS4 ch) + + Return the character 'ch' converted to a double. Return ‘-1.0’ if + this is not possible. This function does not raise exceptions. + +These APIs can be used to work with surrogates: + + -- C Function: int Py_UNICODE_IS_SURROGATE (Py_UCS4 ch) + + Check if 'ch' is a surrogate (‘0xD800 <= ch <= 0xDFFF’). + + -- C Function: int Py_UNICODE_IS_HIGH_SURROGATE (Py_UCS4 ch) + + Check if 'ch' is a high surrogate (‘0xD800 <= ch <= 0xDBFF’). + + -- C Function: int Py_UNICODE_IS_LOW_SURROGATE (Py_UCS4 ch) + + Check if 'ch' is a low surrogate (‘0xDC00 <= ch <= 0xDFFF’). + + -- C Function: *note Py_UCS4: 29d. Py_UNICODE_JOIN_SURROGATES (Py_UCS4 + high, Py_UCS4 low) + + Join two surrogate code points and return a single *note Py_UCS4: + 29d. 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: Creating and accessing Unicode strings, Next: Locale Encoding, Prev: Unicode Character Properties, Up: Unicode Objects + +7.8.3.10 Creating and accessing Unicode strings +............................................... + +To create Unicode objects and access their basic sequence properties, +use these APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_New (Py_ssize_t size, + Py_UCS4 maxchar) + 'Return value: New reference.' Create a new Unicode object. + 'maxchar' should be the true maximum code point to be placed in the + string. As an approximation, it can be rounded up to the nearest + value in the sequence 127, 255, 65535, 1114111. + + This is the recommended way to allocate a new Unicode object. + Objects created using this function are not resizable. + + On error, set an exception and return ‘NULL’. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyUnicode_FromKindAndData (int + kind, const void *buffer, Py_ssize_t size) + 'Return value: New reference.' Create a new Unicode object with + the given 'kind' (possible values are *note PyUnicode_1BYTE_KIND: + 1172. etc., as returned by *note PyUnicode_KIND(): 1171.). The + 'buffer' must point to an array of 'size' units of 1, 2 or 4 bytes + per character, as given by the kind. + + 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: 1174.) and it consists only of + codepoints in the UCS1 range, it will be transformed into UCS1 + (*note PyUnicode_1BYTE_KIND: 1172.). + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyUnicode_FromStringAndSize (const + char *str, Py_ssize_t size) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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: 572. when: + + * 'size' < 0, + + * 'str' is ‘NULL’ and 'size' > 0 + + Changed in version 3.12: 'str' == ‘NULL’ with 'size' > 0 is not + allowed anymore. + + -- C Function: *note PyObject: 334. *PyUnicode_FromString (const char + *str) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Unicode object from a UTF-8 encoded null-terminated + char buffer 'str'. + + -- C Function: *note PyObject: 334. *PyUnicode_FromFormat (const char + *format, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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. + + A conversion specifier contains two or more characters and has the + following components, which must occur in this order: + + 1. The ‘'%'’ character, which marks the start of the specifier. + + 2. Conversion flags (optional), which affect the result of some + conversion types. + + 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. Length modifier (optional). + + 6. Conversion type. + + The conversion flag characters are: + + Flag Meaning + + ------------------------------------------------------------------------------ + + ‘0’ The conversion will be zero padded for numeric values. + + + ‘-’ 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): + + Modifier Types + + ------------------------------------------------------------------------- + + ‘l’ long or unsigned long + + + ‘ll’ long long or 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 Type Comment + + ------------------------------------------------------------------------------------------------------------------ + + ‘%’ '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* or const wchar_t* A null-terminated C character + array. + + + ‘p’ const void* The hex representation of a C + pointer. Mostly equivalent to + ‘printf("%p")’ except that it is + guaranteed to start with the + literal ‘0x’ regardless of what the + platform’s ‘printf’ yields. + + + ‘A’ *note PyObject: 334.* The result of calling + *note ascii(): 13b2. + + + ‘U’ *note PyObject: 334.* A Unicode object. + + + ‘V’ *note PyObject: 334.*, 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: 334.* The result of calling + *note PyObject_Str(): 1029. + + + ‘R’ *note PyObject: 334.* The result of calling + *note PyObject_Repr(): 1028. + + + ‘T’ *note PyObject: 334.* Get the fully qualified name of an + object type; call + *note PyType_GetFullyQualifiedName(): 36e. + + + ‘#T’ *note PyObject: 334.* Similar to ‘T’ format, but use a + colon (‘:’) as separator between + the module name and the qualified + name. + + + ‘N’ *note PyTypeObject: aa5.* Get the fully qualified name of a + type; call + *note PyType_GetFullyQualifiedName(): 36e. + + + ‘#N’ *note PyTypeObject: aa5.* Similar to ‘N’ format, but use a + colon (‘:’) as separator between + the module name and the qualified + name. + + + Note: 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’). + + Note: 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’). + + Changed in version 3.2: Support for ‘"%lld"’ and ‘"%llu"’ added. + + Changed in version 3.3: Support for ‘"%li"’, ‘"%lli"’ and ‘"%zi"’ + added. + + Changed in version 3.4: Support width and precision formatter for + ‘"%s"’, ‘"%A"’, ‘"%U"’, ‘"%V"’, ‘"%S"’, ‘"%R"’ added. + + Changed in version 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: 572. + 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. + + Changed in version 3.13: Support for ‘%T’, ‘%#T’, ‘%N’ and ‘%#N’ + formats added. + + -- C Function: *note PyObject: 334. *PyUnicode_FromFormatV (const char + *format, va_list vargs) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Identical to *note PyUnicode_FromFormat(): 385. except that + it takes exactly two arguments. + + -- C Function: *note PyObject: 334. *PyUnicode_FromObject (PyObject + *obj) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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: 338. to the + object. + + Objects other than Unicode or its subtypes will cause a *note + TypeError: 534. + + -- C Function: *note PyObject: 334. *PyUnicode_FromOrdinal (int + ordinal) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Unicode Object from the given Unicode code point + 'ordinal'. + + The ordinal must be in ‘range(0x110000)’. A *note ValueError: 204. + is raised in the case it is not. + + -- C Function: *note PyObject: 334. *PyUnicode_FromEncodedObject + (PyObject *obj, const char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Decode an encoded object 'obj' to a Unicode object. + + *note bytes: 1c2, *note bytearray: 53a. and other *note bytes-like + objects: d2d. are decoded according to the given 'encoding' and + using the error handling defined by 'errors'. Both can be ‘NULL’ + to have the interface use the default values (see *note Built-in + Codecs: 4c71. for details). + + All other objects, including Unicode objects, cause a *note + TypeError: 534. to be set. + + The API returns ‘NULL’ if there was an error. The caller is + responsible for decref’ing the returned objects. + + -- C Function: *note PyObject: 334. *PyUnicode_BuildEncodingMap + (PyObject *string) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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: 534. and return ‘NULL’ on + invalid input. .. versionadded:: 3.2 + + -- C Function: const char *PyUnicode_GetDefaultEncoding (void) + ' Part of the *note Stable ABI: 550.' Return the name of the + default string encoding, ‘"utf-8"’. See *note + sys.getdefaultencoding(): 4392. + + The returned string does not need to be freed, and is valid until + interpreter shutdown. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_GetLength (PyObject + *unicode) + ' Part of the *note Stable ABI: 550. since version 3.7.' Return + the length of the Unicode object, in code points. + + On error, set an exception and return ‘-1’. + + Added in version 3.3. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_CopyCharacters + (PyObject *to, Py_ssize_t to_start, PyObject *from, Py_ssize_t + from_start, Py_ssize_t how_many) + + Copy characters from one Unicode object into another. This + function performs character conversion when necessary and falls + back to ‘memcpy()’ if possible. Returns ‘-1’ and sets an exception + on error, otherwise returns the number of copied characters. + + Added in version 3.3. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_Fill (PyObject + *unicode, Py_ssize_t start, Py_ssize_t length, Py_UCS4 + fill_char) + + Fill a string with a character: write 'fill_char' into + ‘unicode[start:start+length]’. + + Fail if 'fill_char' is bigger than the string maximum character, or + if the string has more than 1 reference. + + Return the number of written character, or return ‘-1’ and raise an + exception on error. + + Added in version 3.3. + + -- C Function: int PyUnicode_WriteChar (PyObject *unicode, Py_ssize_t + index, Py_UCS4 character) + ' Part of the *note Stable ABI: 550. since version 3.7.' Write a + character to a string. The string must have been created through + *note PyUnicode_New(): 8aa. Since Unicode strings are supposed to + be immutable, the string must not be shared, or have been hashed + yet. + + This function checks that 'unicode' is a Unicode object, that the + index is not out of bounds, and that the object can be modified + safely (i.e. that it its reference count is one). + + Return ‘0’ on success, ‘-1’ on error with an exception set. + + Added in version 3.3. + + -- C Function: *note Py_UCS4: 29d. PyUnicode_ReadChar (PyObject + *unicode, Py_ssize_t index) + ' Part of the *note Stable ABI: 550. since version 3.7.' Read a + character from a string. This function checks that 'unicode' is a + Unicode object and the index is not out of bounds, in contrast to + *note PyUnicode_READ_CHAR(): 1176, which performs no error + checking. + + Return character on success, ‘-1’ on error with an exception set. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyUnicode_Substring (PyObject + *unicode, Py_ssize_t start, Py_ssize_t end) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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 Function: *note Py_UCS4: 29d. *PyUnicode_AsUCS4 (PyObject + *unicode, Py_UCS4 *buffer, Py_ssize_t buflen, int copy_null) + ' Part of the *note Stable ABI: 550. since version 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: 572. if 'buflen' is smaller + than the length of 'unicode'). 'buffer' is returned on success. + + Added in version 3.3. + + -- C Function: *note Py_UCS4: 29d. *PyUnicode_AsUCS4Copy (PyObject + *unicode) + ' Part of the *note Stable ABI: 550. since version 3.7.' Copy the + string 'unicode' into a new UCS4 buffer that is allocated using + *note PyMem_Malloc(): c66. If this fails, ‘NULL’ is returned with + a *note MemoryError: 1576. set. The returned buffer always has an + extra null code point appended. + + Added in version 3.3. + + +File: python.info, Node: Locale Encoding, Next: File System Encoding, Prev: Creating and accessing Unicode strings, Up: Unicode Objects + +7.8.3.11 Locale Encoding +........................ + +The current locale encoding can be used to decode text from the +operating system. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeLocaleAndSize + (const char *str, Py_ssize_t length, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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(): 4abe. to decode a + string from the *note filesystem encoding and error handler: 537. + + This function ignores the *note Python UTF-8 Mode: 652. + + See also + ........ + + The *note Py_DecodeLocale(): bc7. function. + + Added in version 3.3. + + Changed in version 3.7: The function now also uses the current + locale encoding for the ‘surrogateescape’ error handler, except on + Android. Previously, *note Py_DecodeLocale(): bc7. was used for + the ‘surrogateescape’, and the current locale encoding was used for + ‘strict’. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeLocale (const char + *str, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Similar to *note + PyUnicode_DecodeLocaleAndSize(): bc9, but compute the string length + using ‘strlen()’. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyUnicode_EncodeLocale (PyObject + *unicode, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 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: 1c2. object. 'unicode' + cannot contain embedded null characters. + + Use *note PyUnicode_EncodeFSDefault(): 1a50. to encode a string to + the *note filesystem encoding and error handler: 537. + + This function ignores the *note Python UTF-8 Mode: 652. + + See also + ........ + + The *note Py_EncodeLocale(): bc8. function. + + Added in version 3.3. + + Changed in version 3.7: The function now also uses the current + locale encoding for the ‘surrogateescape’ error handler, except on + Android. Previously, *note Py_EncodeLocale(): bc8. was used for + the ‘surrogateescape’, and the current locale encoding was used for + ‘strict’. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0383/ + + (2) https://peps.python.org/pep-0383/ + + +File: python.info, Node: File System Encoding, Next: wchar_t Support, Prev: Locale Encoding, Up: Unicode Objects + +7.8.3.12 File System Encoding +............................. + +Functions encoding to and decoding from the *note filesystem encoding +and error handler: 537. ( PEP 383(1) and PEP 529(2)). + +To encode file names to *note bytes: 1c2. during argument parsing, the +‘"O&"’ converter should be used, passing ‘PyUnicode_FSConverter()’ as +the conversion function: + + -- C Function: int PyUnicode_FSConverter (PyObject *obj, void *result) + ' Part of the *note Stable ABI: 550.' *note PyArg_Parse* + converter: 8a7.: encode *note str: 447. objects – obtained directly + or through the *note os.PathLike: c51. interface – to *note bytes: + 1c2. using *note PyUnicode_EncodeFSDefault(): 1a50.; *note bytes: + 1c2. objects are output as-is. 'result' must be an address of a C + variable of type *note PyObject: 334.* (or *note PyBytesObject: + 78d.*). On success, set the variable to a new *note strong + reference: 338. to a *note bytes object: 4c46. which must be + released when it is no longer used and return a non-zero value + (*note Py_CLEANUP_SUPPORTED: 4b6b.). 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. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + +To decode file names to *note str: 447. during argument parsing, the +‘"O&"’ converter should be used, passing ‘PyUnicode_FSDecoder()’ as the +conversion function: + + -- C Function: int PyUnicode_FSDecoder (PyObject *obj, void *result) + ' Part of the *note Stable ABI: 550.' *note PyArg_Parse* + converter: 8a7.: decode *note bytes: 1c2. objects – obtained either + directly or indirectly through the *note os.PathLike: c51. + interface – to *note str: 447. using *note + PyUnicode_DecodeFSDefaultAndSize(): 4abe.; *note str: 447. objects + are output as-is. 'result' must be an address of a C variable of + type *note PyObject: 334.* (or *note PyUnicodeObject: 78f.*). On + success, set the variable to a new *note strong reference: 338. to + a *note Unicode object: 4c56. which must be released when it is no + longer used and return a non-zero value (*note + Py_CLEANUP_SUPPORTED: 4b6b.). 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. + + Changed in version 3.6: Accepts a *note path-like object: 2a2. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeFSDefaultAndSize + (const char *str, Py_ssize_t size) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Decode a string from the *note filesystem encoding and error + handler: 537. + + If you need to decode a string from the current locale encoding, + use *note PyUnicode_DecodeLocaleAndSize(): bc9. + + See also + ........ + + The *note Py_DecodeLocale(): bc7. function. + + Changed in version 3.6: The *note filesystem error handler: 537. is + now used. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeFSDefault (const + char *str) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Decode a null-terminated string from the *note filesystem + encoding and error handler: 537. + + If the string length is known, use *note + PyUnicode_DecodeFSDefaultAndSize(): 4abe. + + Changed in version 3.6: The *note filesystem error handler: 537. is + now used. + + -- C Function: *note PyObject: 334. *PyUnicode_EncodeFSDefault + (PyObject *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object to the *note filesystem encoding and + error handler: 537, and return *note bytes: 1c2. Note that the + resulting *note bytes: 1c2. object can contain null bytes. + + If you need to encode a string to the current locale encoding, use + *note PyUnicode_EncodeLocale(): bca. + + See also + ........ + + The *note Py_EncodeLocale(): bc8. function. + + Added in version 3.2. + + Changed in version 3.6: The *note filesystem error handler: 537. is + now used. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0383/ + + (2) https://peps.python.org/pep-0529/ + + +File: python.info, Node: wchar_t Support, Prev: File System Encoding, Up: Unicode Objects + +7.8.3.13 wchar_t Support +........................ + +‘wchar_t’ support for platforms which support it: + + -- C Function: *note PyObject: 334. *PyUnicode_FromWideChar (const + wchar_t *wstr, Py_ssize_t size) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note Py_ssize_t: a5f. PyUnicode_AsWideChar (PyObject + *unicode, wchar_t *wstr, Py_ssize_t size) + ' Part of the *note Stable ABI: 550.' 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 Function: wchar_t *PyUnicode_AsWideCharString (PyObject *unicode, + Py_ssize_t *size) + ' Part of the *note Stable ABI: 550. since version 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: 204. is raised. + + Returns a buffer allocated by *note PyMem_New: 14ef. (use *note + PyMem_Free(): 140e. to free it) on success. On error, returns + ‘NULL’ and '*size' is undefined. Raises a *note MemoryError: 1576. + if memory allocation is failed. + + Added in version 3.2. + + Changed in version 3.7: Raises a *note ValueError: 204. if 'size' + is ‘NULL’ and the wchar_t* string contains null characters. + + +File: python.info, Node: Built-in Codecs, Next: Methods and Slot Functions, Prev: Unicode Objects, Up: Unicode Objects and Codecs + +7.8.3.14 Built-in Codecs +........................ + +Python provides a set of built-in codecs which are written in C for +speed. All of these codecs are directly usable via the following +functions. + +Many of the following APIs take two arguments encoding and errors, and +they have the same semantics as the ones of the built-in *note str(): +447. string object constructor. + +Setting encoding to ‘NULL’ causes the default encoding to be used which +is UTF-8. The file system calls should use *note +PyUnicode_FSConverter(): d19. for encoding file names. This uses the +*note filesystem encoding and error handler: 537. internally. + +Error handling is set by errors which may also be set to ‘NULL’ meaning +to use the default handling defined for the codec. Default error +handling for all built-in codecs is “strict” (*note ValueError: 204. is +raised). + +The codecs all use a similar interface. Only deviations from the +following generic ones are documented for simplicity. + +* Menu: + +* Generic Codecs:: +* 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:: +* MBCS codecs for Windows:: + + +File: python.info, Node: Generic Codecs, Next: UTF-8 Codecs, Up: Built-in Codecs + +7.8.3.15 Generic Codecs +....................... + +These are the generic codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_Decode (const char *str, + Py_ssize_t size, const char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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(): 447. + 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 Function: *note PyObject: 334. *PyUnicode_AsEncodedString + (PyObject *unicode, const char *encoding, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object and return the result as Python + bytes object. 'encoding' and 'errors' have the same meaning as the + parameters of the same name in the Unicode *note encode(): 8d4. + method. The codec to be used is looked up using the Python codec + registry. Return ‘NULL’ if an exception was raised by the codec. + + +File: python.info, Node: UTF-8 Codecs, Next: UTF-32 Codecs, Prev: Generic Codecs, Up: Built-in Codecs + +7.8.3.16 UTF-8 Codecs +..................... + +These are the UTF-8 codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF8 (const char + *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Unicode object by decoding 'size' bytes of the + UTF-8 encoded string 'str'. Return ‘NULL’ if an exception was + raised by the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF8Stateful + (const char *str, Py_ssize_t size, const char *errors, + Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' If 'consumed' is ‘NULL’, behave like *note + PyUnicode_DecodeUTF8(): 4aca. If 'consumed' is not ‘NULL’, + trailing incomplete UTF-8 byte sequences will not be treated as an + error. Those bytes will not be decoded and the number of bytes + that have been decoded will be stored in 'consumed'. + + -- C Function: *note PyObject: 334. *PyUnicode_AsUTF8String (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using UTF-8 and return the result as + Python bytes object. Error handling is “strict”. Return ‘NULL’ if + an exception was raised by the codec. + + The function fails if the string contains surrogate code points + (‘U+D800’ - ‘U+DFFF’). + + -- C Function: const char *PyUnicode_AsUTF8AndSize (PyObject *unicode, + Py_ssize_t *size) + ' Part of the *note Stable ABI: 550. since version 3.10.' Return a + pointer to the UTF-8 encoding of the Unicode object, and store the + size of the encoded representation (in bytes) in 'size'. The + 'size' argument can be ‘NULL’; in this case no size will be stored. + The returned buffer always has an extra null byte appended (not + included in 'size'), regardless of whether there are any other null + code points. + + 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. + + Changed in version 3.7: The return type is now ‘const char *’ + rather of ‘char *’. + + Changed in version 3.10: This function is a part of the *note + limited API: 391. + + -- C Function: const char *PyUnicode_AsUTF8 (PyObject *unicode) + + As *note PyUnicode_AsUTF8AndSize(): 897, but does not store the + size. + + Warning: 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(): 897. + instead. + + Added in version 3.3. + + Changed in version 3.7: The return type is now ‘const char *’ + rather of ‘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: Built-in Codecs + +7.8.3.17 UTF-32 Codecs +...................... + +These are the UTF-32 codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF32 (const char + *str, Py_ssize_t size, const char *errors, int *byteorder) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Decode 'size' bytes from a UTF-32 encoded buffer string and + return the corresponding Unicode object. 'errors' (if non-‘NULL’) + defines the error handling. It defaults to “strict”. + + If 'byteorder' is non-‘NULL’, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + If ‘*byteorder’ is zero, and the first four bytes of the input data + are a byte order mark (BOM), the decoder switches to this byte + order and the BOM is not copied into the resulting Unicode string. + If ‘*byteorder’ is ‘-1’ or ‘1’, any byte order mark is copied to + the output. + + After completion, '*byteorder' is set to the current byte order at + the end of input data. + + If 'byteorder' is ‘NULL’, the codec starts in native order mode. + + Return ‘NULL’ if an exception was raised by the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF32Stateful + (const char *str, Py_ssize_t size, const char *errors, int + *byteorder, Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' If 'consumed' is ‘NULL’, behave like *note + PyUnicode_DecodeUTF32(): 4ac6. If 'consumed' is not ‘NULL’, *note + PyUnicode_DecodeUTF32Stateful(): 4ac7. will not treat trailing + incomplete UTF-32 byte sequences (such as a number of bytes not + divisible by four) as an error. Those bytes will not be decoded + and the number of bytes that have been decoded will be stored in + 'consumed'. + + -- C Function: *note PyObject: 334. *PyUnicode_AsUTF32String (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a Python byte string using the UTF-32 encoding in + native byte order. The string always starts with a BOM mark. + Error handling is “strict”. Return ‘NULL’ if an exception was + raised by the codec. + + +File: python.info, Node: UTF-16 Codecs, Next: UTF-7 Codecs, Prev: UTF-32 Codecs, Up: Built-in Codecs + +7.8.3.18 UTF-16 Codecs +...................... + +These are the UTF-16 codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF16 (const char + *str, Py_ssize_t size, const char *errors, int *byteorder) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Decode 'size' bytes from a UTF-16 encoded buffer string and + return the corresponding Unicode object. 'errors' (if non-‘NULL’) + defines the error handling. It defaults to “strict”. + + If 'byteorder' is non-‘NULL’, the decoder starts decoding using the + given byte order: + + *byteorder == -1: little endian + *byteorder == 0: native order + *byteorder == 1: big endian + + If ‘*byteorder’ is zero, and the first two bytes of the input data + are a byte order mark (BOM), the decoder switches to this byte + order and the BOM is not copied into the resulting Unicode string. + If ‘*byteorder’ is ‘-1’ or ‘1’, any byte order mark is copied to + the output (where it will result in either a ‘\ufeff’ or a ‘\ufffe’ + character). + + After completion, ‘*byteorder’ is set to the current byte order at + the end of input data. + + If 'byteorder' is ‘NULL’, the codec starts in native order mode. + + Return ‘NULL’ if an exception was raised by the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF16Stateful + (const char *str, Py_ssize_t size, const char *errors, int + *byteorder, Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' If 'consumed' is ‘NULL’, behave like *note + PyUnicode_DecodeUTF16(): 4ac4. If 'consumed' is not ‘NULL’, *note + PyUnicode_DecodeUTF16Stateful(): 4ac5. will not treat trailing + incomplete UTF-16 byte sequences (such as an odd number of bytes or + a split surrogate pair) as an error. Those bytes will not be + decoded and the number of bytes that have been decoded will be + stored in 'consumed'. + + -- C Function: *note PyObject: 334. *PyUnicode_AsUTF16String (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a Python byte string using the UTF-16 encoding in + native byte order. The string always starts with a BOM mark. + Error handling is “strict”. Return ‘NULL’ if an exception was + raised by the codec. + + +File: python.info, Node: UTF-7 Codecs, Next: Unicode-Escape Codecs, Prev: UTF-16 Codecs, Up: Built-in Codecs + +7.8.3.19 UTF-7 Codecs +..................... + +These are the UTF-7 codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUTF7 (const char + *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyUnicode_DecodeUTF7Stateful + (const char *str, Py_ssize_t size, const char *errors, + Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' If 'consumed' is ‘NULL’, behave like *note + PyUnicode_DecodeUTF7(): 4ac8. If 'consumed' is not ‘NULL’, + trailing incomplete UTF-7 base-64 sections will not be treated as + an error. Those bytes will not be decoded and the number of bytes + that have been decoded will be stored in 'consumed'. + + +File: python.info, Node: Unicode-Escape Codecs, Next: Raw-Unicode-Escape Codecs, Prev: UTF-7 Codecs, Up: Built-in Codecs + +7.8.3.20 Unicode-Escape Codecs +.............................. + +These are the “Unicode Escape” codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeUnicodeEscape + (const char *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyUnicode_AsUnicodeEscapeString + (PyObject *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using Unicode-Escape and return the + result as a bytes object. Error handling is “strict”. Return + ‘NULL’ if an exception was raised by the codec. + + +File: python.info, Node: Raw-Unicode-Escape Codecs, Next: Latin-1 Codecs, Prev: Unicode-Escape Codecs, Up: Built-in Codecs + +7.8.3.21 Raw-Unicode-Escape Codecs +.................................. + +These are the “Raw Unicode Escape” codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeRawUnicodeEscape + (const char *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyUnicode_AsRawUnicodeEscapeString + (PyObject *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using Raw-Unicode-Escape and return + the result as a bytes object. Error handling is “strict”. Return + ‘NULL’ if an exception was raised by the codec. + + +File: python.info, Node: Latin-1 Codecs, Next: ASCII Codecs, Prev: Raw-Unicode-Escape Codecs, Up: Built-in Codecs + +7.8.3.22 Latin-1 Codecs +....................... + +These are the Latin-1 codec APIs: Latin-1 corresponds to the first 256 +Unicode ordinals and only these are accepted by the codecs during +encoding. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeLatin1 (const char + *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Unicode object by decoding 'size' bytes of the + Latin-1 encoded string 'str'. Return ‘NULL’ if an exception was + raised by the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_AsLatin1String (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using Latin-1 and return the result + as Python bytes object. Error handling is “strict”. Return ‘NULL’ + if an exception was raised by the codec. + + +File: python.info, Node: ASCII Codecs, Next: Character Map Codecs, Prev: Latin-1 Codecs, Up: Built-in Codecs + +7.8.3.23 ASCII Codecs +..................... + +These are the ASCII codec APIs. Only 7-bit ASCII data is accepted. All +other codes generate errors. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeASCII (const char + *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyUnicode_AsASCIIString (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using ASCII and return the result as + Python bytes object. Error handling is “strict”. Return ‘NULL’ if + an exception was raised by the codec. + + +File: python.info, Node: Character Map Codecs, Next: MBCS codecs for Windows, Prev: ASCII Codecs, Up: Built-in Codecs + +7.8.3.24 Character Map Codecs +............................. + +This codec is special in that it can be used to implement many different +codecs (and this is in fact what was done to obtain most of the standard +codecs included in the ‘encodings’ package). The codec uses mappings to +encode and decode characters. The mapping objects provided must support +the *note __getitem__(): 285. mapping interface; dictionaries and +sequences work well. + +These are the mapping codec APIs: + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeCharmap (const + char *str, Py_ssize_t length, PyObject *mapping, const char + *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Unicode object by decoding 'size' bytes of the + encoded string 'str' using the given 'mapping' object. Return + ‘NULL’ if an exception was raised by the codec. + + 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: 21cc, as well as ones which get mapped + to ‘None’, ‘0xFFFE’ or ‘'\ufffe'’, are treated as undefined + mappings and cause an error. + + -- C Function: *note PyObject: 334. *PyUnicode_AsCharmapString + (PyObject *unicode, PyObject *mapping) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Encode a Unicode object using the given 'mapping' object and + return the result as a bytes object. Error handling is “strict”. + Return ‘NULL’ if an exception was raised by the codec. + + 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: 21cc.) as + well as mapped to ‘None’ are treated as “undefined mapping” and + cause an error. + +The following codec API is special in that maps Unicode to Unicode. + + -- C Function: *note PyObject: 334. *PyUnicode_Translate (PyObject + *unicode, PyObject *table, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Translate a string by applying a character mapping table to + it and return the resulting Unicode object. Return ‘NULL’ if an + exception was raised by the codec. + + The mapping table must map Unicode ordinal integers to Unicode + ordinal integers or ‘None’ (causing deletion of the character). + + Mapping tables need only provide the *note __getitem__(): 285. + interface; dictionaries and sequences work well. Unmapped + character ordinals (ones which cause a *note LookupError: 21cc.) + are left untouched and are copied as-is. + + 'errors' has the usual meaning for codecs. It may be ‘NULL’ which + indicates to use the default error handling. + + +File: python.info, Node: MBCS codecs for Windows, Prev: Character Map Codecs, Up: Built-in Codecs + +7.8.3.25 MBCS codecs for Windows +................................ + +These are the MBCS codec APIs. They are currently only available on +Windows and use the Win32 MBCS converters to implement the conversions. +Note that MBCS (or DBCS) is a class of encodings, not just one. The +target encoding is defined by the user settings on the machine running +the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeMBCS (const char + *str, Py_ssize_t size, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + on Windows since version 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 Function: *note PyObject: 334. *PyUnicode_DecodeMBCSStateful + (const char *str, Py_ssize_t size, const char *errors, + Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + on Windows since version 3.7.' If 'consumed' is ‘NULL’, behave + like *note PyUnicode_DecodeMBCS(): 4ac1. If 'consumed' is not + ‘NULL’, *note PyUnicode_DecodeMBCSStateful(): 4ac2. will not decode + trailing lead byte and the number of bytes that have been decoded + will be stored in 'consumed'. + + -- C Function: *note PyObject: 334. *PyUnicode_DecodeCodePageStateful + (int code_page, const char *str, Py_ssize_t size, const char + *errors, Py_ssize_t *consumed) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + on Windows since version 3.7.' Similar to *note + PyUnicode_DecodeMBCSStateful(): 4ac2, except uses the code page + specified by 'code_page'. + + -- C Function: *note PyObject: 334. *PyUnicode_AsMBCSString (PyObject + *unicode) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + on Windows since version 3.7.' Encode a Unicode object using MBCS + and return the result as Python bytes object. Error handling is + “strict”. Return ‘NULL’ if an exception was raised by the codec. + + -- C Function: *note PyObject: 334. *PyUnicode_EncodeCodePage (int + code_page, PyObject *unicode, const char *errors) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + on Windows since version 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: Methods and Slot Functions, Prev: Built-in Codecs, Up: Unicode Objects and Codecs + +7.8.3.26 Methods and Slot Functions +................................... + +The following APIs are capable of handling Unicode objects and strings +on input (we refer to them as strings in the descriptions) and return +Unicode objects or integers as appropriate. + +They all return ‘NULL’ or ‘-1’ if an exception occurs. + + -- C Function: *note PyObject: 334. *PyUnicode_Concat (PyObject *left, + PyObject *right) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Concat two strings giving a new Unicode string. + + -- C Function: *note PyObject: 334. *PyUnicode_Split (PyObject + *unicode, PyObject *sep, Py_ssize_t maxsplit) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Split a string giving a list of Unicode strings. If 'sep' + is ‘NULL’, splitting will be done at all whitespace substrings. + Otherwise, splits occur at the given separator. At most 'maxsplit' + splits will be done. If negative, no limit is set. Separators are + not included in the resulting list. + + On error, return ‘NULL’ with an exception set. + + Equivalent to *note str.split(): ea3. + + -- C Function: *note PyObject: 334. *PyUnicode_RSplit (PyObject + *unicode, PyObject *sep, Py_ssize_t maxsplit) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Similar to *note PyUnicode_Split(): 4ad6, 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(): 1249. + + -- C Function: *note PyObject: 334. *PyUnicode_Splitlines (PyObject + *unicode, int keepends) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note PyObject: 334. *PyUnicode_Partition (PyObject + *unicode, PyObject *sep) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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(): ea4. + + -- C Function: *note PyObject: 334. *PyUnicode_RPartition (PyObject + *unicode, PyObject *sep) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Similar to *note PyUnicode_Partition(): 156f, 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(): 124c. + + -- C Function: *note PyObject: 334. *PyUnicode_Join (PyObject + *separator, PyObject *seq) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Join a sequence of strings using the given 'separator' and + return the resulting Unicode string. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_Tailmatch (PyObject + *unicode, PyObject *substr, Py_ssize_t start, Py_ssize_t end, + int direction) + ' Part of the *note Stable ABI: 550.' 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 Function: *note Py_ssize_t: a5f. PyUnicode_Find (PyObject + *unicode, PyObject *substr, Py_ssize_t start, Py_ssize_t end, + int direction) + ' Part of the *note Stable ABI: 550.' Return the first position of + 'substr' in ‘unicode[start:end]’ using the given 'direction' + ('direction' == ‘1’ means to do a forward search, 'direction' == + ‘-1’ a backward search). The return value is the index of the + first match; a value of ‘-1’ indicates that no match was found, and + ‘-2’ indicates that an error occurred and an exception has been + set. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_FindChar (PyObject + *unicode, Py_UCS4 ch, Py_ssize_t start, Py_ssize_t end, int + direction) + ' Part of the *note Stable ABI: 550. since version 3.7.' Return + the first position of the character 'ch' in ‘unicode[start:end]’ + using the given 'direction' ('direction' == ‘1’ means to do a + forward search, 'direction' == ‘-1’ a backward search). The return + value is the index of the first match; a value of ‘-1’ indicates + that no match was found, and ‘-2’ indicates that an error occurred + and an exception has been set. + + Added in version 3.3. + + Changed in version 3.7: 'start' and 'end' are now adjusted to + behave like ‘unicode[start:end]’. + + -- C Function: *note Py_ssize_t: a5f. PyUnicode_Count (PyObject + *unicode, PyObject *substr, Py_ssize_t start, Py_ssize_t end) + ' Part of the *note Stable ABI: 550.' Return the number of + non-overlapping occurrences of 'substr' in ‘unicode[start:end]’. + Return ‘-1’ if an error occurred. + + -- C Function: *note PyObject: 334. *PyUnicode_Replace (PyObject + *unicode, PyObject *substr, PyObject *replstr, Py_ssize_t + maxcount) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Replace at most 'maxcount' occurrences of 'substr' in + 'unicode' with 'replstr' and return the resulting Unicode object. + 'maxcount' == ‘-1’ means replace all occurrences. + + -- C Function: int PyUnicode_Compare (PyObject *left, PyObject *right) + ' Part of the *note Stable ABI: 550.' Compare two strings and + return ‘-1’, ‘0’, ‘1’ for less than, equal, and greater than, + respectively. + + This function returns ‘-1’ upon failure, so one should call *note + PyErr_Occurred(): 18f1. to check for errors. + + -- C Function: int PyUnicode_EqualToUTF8AndSize (PyObject *unicode, + const char *string, Py_ssize_t size) + ' Part of the *note Stable ABI: 550. since version 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. + + This function does not raise exceptions. + + Added in version 3.13. + + -- C Function: int PyUnicode_EqualToUTF8 (PyObject *unicode, const char + *string) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note PyUnicode_EqualToUTF8AndSize(): 371, but compute 'string' + length using ‘strlen()’. If the Unicode object contains null + characters, false (‘0’) is returned. + + Added in version 3.13. + + -- C Function: int PyUnicode_CompareWithASCIIString (PyObject *unicode, + const char *string) + ' Part of the *note Stable ABI: 550.' Compare a Unicode object, + 'unicode', with 'string' and return ‘-1’, ‘0’, ‘1’ for less than, + equal, and greater than, respectively. It is best to pass only + ASCII-encoded strings, but the function interprets the input string + as ISO-8859-1 if it contains non-ASCII characters. + + This function does not raise exceptions. + + -- C Function: *note PyObject: 334. *PyUnicode_RichCompare (PyObject + *left, PyObject *right, int op) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Rich compare two Unicode strings and return one of the + following: + + * ‘NULL’ in case an exception was raised + + * *note Py_True: 4c26. or *note Py_False: 4c25. for successful + comparisons + + * *note Py_NotImplemented: 4b9b. in case the type combination is + unknown + + Possible values for 'op' are *note Py_GT: 4ba3, *note Py_GE: 4ba4, + *note Py_EQ: 4ba1, *note Py_NE: 4ba2, *note Py_LT: 4b9f, and *note + Py_LE: 4ba0. + + -- C Function: *note PyObject: 334. *PyUnicode_Format (PyObject + *format, PyObject *args) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new string object from 'format' and 'args'; this is + analogous to ‘format % args’. + + -- C Function: int PyUnicode_Contains (PyObject *unicode, PyObject + *substr) + ' Part of the *note Stable ABI: 550.' Check whether 'substr' is + contained in 'unicode' and return true or false accordingly. + + 'substr' has to coerce to a one element Unicode string. ‘-1’ is + returned if there was an error. + + -- C Function: void PyUnicode_InternInPlace (PyObject **p_unicode) + ' Part of the *note Stable ABI: 550.' Intern the argument **note + p_unicode: 8b0. in place. The argument must be the address of a + pointer variable pointing to a Python Unicode string object. If + there is an existing interned string that is the same as **note + p_unicode: 8b0, it sets **note p_unicode: 8b0. to it (releasing the + reference to the old string object and creating a new *note strong + reference: 338. to the interned string object), otherwise it leaves + **note p_unicode: 8b0. 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: 447. may not be interned, + that is, *note PyUnicode_CheckExact: 4c5a.(**note p_unicode: 8b0.) + 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 Function: *note PyObject: 334. *PyUnicode_InternFromString (const + char *str) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' A combination of *note PyUnicode_FromString(): 4ad1. and + *note PyUnicode_InternInPlace(): 8b0, 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: 4394, 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(): 4ad1. and *note PyUnicode_InternInPlace(): + 8b0. directly. + + +File: python.info, Node: Tuple Objects, Next: Struct Sequence Objects, Prev: Unicode Objects and Codecs, Up: Sequence Objects + +7.8.3.27 Tuple Objects +...................... + + -- C Type: type PyTupleObject + + This subtype of *note PyObject: 334. represents a Python tuple + object. + + -- C Variable: *note PyTypeObject: aa5. PyTuple_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python tuple type; it is the same + object as *note tuple: 36b. in the Python layer. + + -- C Function: int PyTuple_Check (PyObject *p) + + Return true if 'p' is a tuple object or an instance of a subtype of + the tuple type. This function always succeeds. + + -- C Function: int PyTuple_CheckExact (PyObject *p) + + Return true if 'p' is a tuple object, but not an instance of a + subtype of the tuple type. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyTuple_New (Py_ssize_t len) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new tuple object of size 'len', or ‘NULL’ with an + exception set on failure. + + -- C Function: *note PyObject: 334. *PyTuple_Pack (Py_ssize_t n, ...) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: *note Py_ssize_t: a5f. PyTuple_Size (PyObject *p) + ' Part of the *note Stable ABI: 550.' Take a pointer to a tuple + object, and return the size of that tuple. On error, return ‘-1’ + and with an exception set. + + -- C Function: *note Py_ssize_t: a5f. PyTuple_GET_SIZE (PyObject *p) + + Like *note PyTuple_Size(): 4a97, but without error checking. + + -- C Function: *note PyObject: 334. *PyTuple_GetItem (PyObject *p, + Py_ssize_t pos) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return the object at position 'pos' in the tuple pointed to + by 'p'. If 'pos' is negative or out of bounds, return ‘NULL’ and + set an *note IndexError: 14ff. exception. + + 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: 338, use *note + Py_NewRef(PyTuple_GetItem(...)): 898. or *note + PySequence_GetItem(): 1a52. + + -- C Function: *note PyObject: 334. *PyTuple_GET_ITEM (PyObject *p, + Py_ssize_t pos) + 'Return value: Borrowed reference.' Like *note PyTuple_GetItem(): + 48d2, but does no checking of its arguments. + + -- C Function: *note PyObject: 334. *PyTuple_GetSlice (PyObject *p, + Py_ssize_t low, Py_ssize_t high) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: int PyTuple_SetItem (PyObject *p, Py_ssize_t pos, + PyObject *o) + ' Part of the *note Stable ABI: 550.' 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: 14ff. exception. + + Note: This function “steals” a reference to 'o' and discards a + reference to an item already in the tuple at the affected + position. + + -- C Function: void PyTuple_SET_ITEM (PyObject *p, Py_ssize_t pos, + PyObject *o) + + Like *note PyTuple_SetItem(): 48d3, but does no error checking, and + should 'only' be used to fill in brand new tuples. + + Bounds checking is performed as an assertion if Python is built in + *note debug mode: 1fb. or *note with assertions: 387. + + Note: This function “steals” a reference to 'o', and, unlike + *note PyTuple_SetItem(): 48d3, does 'not' discard a reference + to any item that is being replaced; any reference in the tuple + at position 'pos' will be leaked. + + -- C Function: int _PyTuple_Resize (PyObject **p, Py_ssize_t newsize) + + Can be used to resize a tuple. 'newsize' will be the new length of + the tuple. Because tuples are 'supposed' to be immutable, this + should only be used if there is only one reference to the object. + Do 'not' use this if the tuple may already be known to some other + part of the code. The tuple will always grow or shrink at the end. + Think of this as destroying the old tuple and creating a new one, + only more efficiently. Returns ‘0’ on success. Client code should + never assume that the resulting value of ‘*p’ will be the same as + before calling this function. If the object referenced by ‘*p’ is + replaced, the original ‘*p’ is destroyed. On failure, returns ‘-1’ + and sets ‘*p’ to ‘NULL’, and raises *note MemoryError: 1576. or + *note SystemError: 572. + + +File: python.info, Node: Struct Sequence Objects, Next: List Objects, Prev: Tuple Objects, Up: Sequence Objects + +7.8.3.28 Struct Sequence Objects +................................ + +Struct sequence objects are the C equivalent of *note namedtuple(): 1ca. +objects, i.e. a sequence whose items can also be accessed through +attributes. To create a struct sequence, you first have to create a +specific struct sequence type. + + -- C Function: *note PyTypeObject: aa5. *PyStructSequence_NewType + (PyStructSequence_Desc *desc) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a new struct sequence type from the data in 'desc', + described below. Instances of the resulting type can be created + with *note PyStructSequence_New(): 4a87. + + Return ‘NULL’ with an exception set on failure. + + -- C Function: void PyStructSequence_InitType (PyTypeObject *type, + PyStructSequence_Desc *desc) + + Initializes a struct sequence type 'type' from 'desc' in place. + + -- C Function: int PyStructSequence_InitType2 (PyTypeObject *type, + PyStructSequence_Desc *desc) + + Like *note PyStructSequence_InitType(): ffc, but returns ‘0’ on + success and ‘-1’ with an exception set on failure. + + Added in version 3.4. + + -- C Type: type PyStructSequence_Desc + ' Part of the *note Stable ABI: 550. (including all members).' + Contains the meta information of a struct sequence type to create. + + -- C Member: const char *name + + Fully qualified name of the type; null-terminated UTF-8 + encoded. The name must contain the module name. + + -- C Member: const char *doc + + Pointer to docstring for the type or ‘NULL’ to omit. + + -- C Member: *note PyStructSequence_Field: bb9. *fields + + Pointer to ‘NULL’-terminated array with field names of the new + type. + + -- C Member: int n_in_sequence + + Number of fields visible to the Python side (if used as + tuple). + + -- C Type: type PyStructSequence_Field + ' Part of the *note Stable ABI: 550. (including all members).' + Describes a field of a struct sequence. As a struct sequence is + modeled as a tuple, all fields are typed as *note PyObject: 334.*. + The index in the *note fields: 4c8d. array of the *note + PyStructSequence_Desc: bba. determines which field of the struct + sequence is described. + + -- C Member: const char *name + + Name for the field or ‘NULL’ to end the list of named fields, + set to *note PyStructSequence_UnnamedField: 982. to leave + unnamed. + + -- C Member: const char *doc + + Field docstring or ‘NULL’ to omit. + + -- C Variable: const char *const PyStructSequence_UnnamedField + ' Part of the *note Stable ABI: 550. since version 3.11.' Special + value for a field name to leave it unnamed. + + Changed in version 3.9: The type was changed from ‘char *’. + + -- C Function: *note PyObject: 334. *PyStructSequence_New (PyTypeObject + *type) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Creates an instance of 'type', which must have been created + with *note PyStructSequence_NewType(): 4a88. + + Return ‘NULL’ with an exception set on failure. + + -- C Function: *note PyObject: 334. *PyStructSequence_GetItem (PyObject + *p, Py_ssize_t pos) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return the object at position 'pos' in the struct sequence + pointed to by 'p'. + + Bounds checking is performed as an assertion if Python is built in + *note debug mode: 1fb. or *note with assertions: 387. + + -- C Function: *note PyObject: 334. *PyStructSequence_GET_ITEM + (PyObject *p, Py_ssize_t pos) + 'Return value: Borrowed reference.' Alias to *note + PyStructSequence_GetItem(): 4a86. + + Changed in version 3.13: Now implemented as an alias to *note + PyStructSequence_GetItem(): 4a86. + + -- C Function: void PyStructSequence_SetItem (PyObject *p, Py_ssize_t + pos, PyObject *o) + ' Part of the *note Stable ABI: 550.' Sets the field at index + 'pos' of the struct sequence 'p' to value 'o'. Like *note + PyTuple_SET_ITEM(): 388, this should only be used to fill in brand + new instances. + + Bounds checking is performed as an assertion if Python is built in + *note debug mode: 1fb. or *note with assertions: 387. + + Note: This function “steals” a reference to 'o'. + + -- C Function: void PyStructSequence_SET_ITEM (PyObject *p, Py_ssize_t + *pos, PyObject *o) + + Alias to *note PyStructSequence_SetItem(): 4a89. + + Changed in version 3.13: Now implemented as an alias to *note + PyStructSequence_SetItem(): 4a89. + + +File: python.info, Node: List Objects, Prev: Struct Sequence Objects, Up: Sequence Objects + +7.8.3.29 List Objects +..................... + + -- C Type: type PyListObject + + This subtype of *note PyObject: 334. represents a Python list + object. + + -- C Variable: *note PyTypeObject: aa5. PyList_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python list type. This is the + same object as *note list: 60d. in the Python layer. + + -- C Function: int PyList_Check (PyObject *p) + + Return true if 'p' is a list object or an instance of a subtype of + the list type. This function always succeeds. + + -- C Function: int PyList_CheckExact (PyObject *p) + + Return true if 'p' is a list object, but not an instance of a + subtype of the list type. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyList_New (Py_ssize_t len) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new list of length 'len' on success, or ‘NULL’ on + failure. + + Note: 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(): + 1a53. or expose the object to Python code before setting all + items to a real object with *note PyList_SetItem(): 1577. or + *note PyList_SET_ITEM(): 389. The following APIs are safe + APIs before the list is fully initialized: *note + PyList_SetItem(): 1577. and *note PyList_SET_ITEM(): 389. + + -- C Function: *note Py_ssize_t: a5f. PyList_Size (PyObject *list) + ' Part of the *note Stable ABI: 550.' + + Return the length of the list object in 'list'; this is equivalent + to ‘len(list)’ on a list object. + + -- C Function: *note Py_ssize_t: a5f. PyList_GET_SIZE (PyObject *list) + + Similar to *note PyList_Size(): 13e5, but without error checking. + + -- C Function: *note PyObject: 334. *PyList_GetItemRef (PyObject *list, + Py_ssize_t index) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.13.' Return the object at position 'index' in the + list pointed to by 'list'. The position must be non-negative; + indexing from the end of the list is not supported. If 'index' is + out of bounds (‘<0 or >=len(list)’), return ‘NULL’ and set an *note + IndexError: 14ff. exception. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyList_GetItem (PyObject *list, + Py_ssize_t index) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Like *note PyList_GetItemRef(): 356, but returns a *note + borrowed reference: 339. instead of a *note strong reference: 338. + + -- C Function: *note PyObject: 334. *PyList_GET_ITEM (PyObject *list, + Py_ssize_t i) + 'Return value: Borrowed reference.' Similar to *note + PyList_GetItem(): 357, but without error checking. + + -- C Function: int PyList_SetItem (PyObject *list, Py_ssize_t index, + PyObject *item) + ' Part of the *note Stable ABI: 550.' Set the item at index + 'index' in list to 'item'. Return ‘0’ on success. If 'index' is + out of bounds, return ‘-1’ and set an *note IndexError: 14ff. + exception. + + Note: This function “steals” a reference to 'item' and + discards a reference to an item already in the list at the + affected position. + + -- C Function: void PyList_SET_ITEM (PyObject *list, Py_ssize_t i, + PyObject *o) + + Macro form of *note PyList_SetItem(): 1577. without error checking. + This is normally only used to fill in new lists where there is no + previous content. + + Bounds checking is performed as an assertion if Python is built in + *note debug mode: 1fb. or *note with assertions: 387. + + Note: This macro “steals” a reference to 'item', and, unlike + *note PyList_SetItem(): 1577, does 'not' discard a reference + to any item that is being replaced; any reference in 'list' at + position 'i' will be leaked. + + -- C Function: int PyList_Insert (PyObject *list, Py_ssize_t index, + PyObject *item) + ' Part of the *note Stable ABI: 550.' Insert the item 'item' into + list 'list' in front of index 'index'. Return ‘0’ if successful; + return ‘-1’ and set an exception if unsuccessful. Analogous to + ‘list.insert(index, item)’. + + -- C Function: int PyList_Append (PyObject *list, PyObject *item) + ' Part of the *note Stable ABI: 550.' Append the object 'item' at + the end of list 'list'. Return ‘0’ if successful; return ‘-1’ and + set an exception if unsuccessful. Analogous to + ‘list.append(item)’. + + -- C Function: *note PyObject: 334. *PyList_GetSlice (PyObject *list, + Py_ssize_t low, Py_ssize_t high) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a list of the objects in 'list' containing the + objects 'between' 'low' and 'high'. Return ‘NULL’ and set an + exception if unsuccessful. Analogous to ‘list[low:high]’. + Indexing from the end of the list is not supported. + + -- C Function: int PyList_SetSlice (PyObject *list, Py_ssize_t low, + Py_ssize_t high, PyObject *itemlist) + ' Part of the *note Stable ABI: 550.' Set the slice of 'list' + between 'low' and 'high' to the contents of 'itemlist'. Analogous + to ‘list[low:high] = itemlist’. The 'itemlist' may be ‘NULL’, + indicating the assignment of an empty list (slice deletion). + Return ‘0’ on success, ‘-1’ on failure. Indexing from the end of + the list is not supported. + + -- C Function: int PyList_Extend (PyObject *list, PyObject *iterable) + + Extend 'list' with the contents of 'iterable'. This is the same as + ‘PyList_SetSlice(list, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, iterable)’ + and analogous to ‘list.extend(iterable)’ or ‘list += iterable’. + + Raise an exception and return ‘-1’ if 'list' is not a *note list: + 60d. object. Return 0 on success. + + Added in version 3.13. + + -- C Function: int PyList_Clear (PyObject *list) + + Remove all items from 'list'. This is the same as + ‘PyList_SetSlice(list, 0, PY_SSIZE_T_MAX, NULL)’ and analogous to + ‘list.clear()’ or ‘del list[:]’. + + Raise an exception and return ‘-1’ if 'list' is not a *note list: + 60d. object. Return 0 on success. + + Added in version 3.13. + + -- C Function: int PyList_Sort (PyObject *list) + ' Part of the *note Stable ABI: 550.' Sort the items of 'list' in + place. Return ‘0’ on success, ‘-1’ on failure. This is equivalent + to ‘list.sort()’. + + -- C Function: int PyList_Reverse (PyObject *list) + ' Part of the *note Stable ABI: 550.' Reverse the items of 'list' + in place. Return ‘0’ on success, ‘-1’ on failure. This is the + equivalent of ‘list.reverse()’. + + -- C Function: *note PyObject: 334. *PyList_AsTuple (PyObject *list) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Return a new tuple object containing the contents of 'list'; + equivalent to ‘tuple(list)’. + + +File: python.info, Node: Container Objects, Next: Function Objects<2>, Prev: Sequence Objects, Up: Concrete Objects Layer + +7.8.4 Container Objects +----------------------- + +* Menu: + +* Dictionary Objects:: +* Set Objects:: + + +File: python.info, Node: Dictionary Objects, Next: Set Objects, Up: Container Objects + +7.8.4.1 Dictionary Objects +.......................... + + -- C Type: type PyDictObject + + This subtype of *note PyObject: 334. represents a Python dictionary + object. + + -- C Variable: *note PyTypeObject: aa5. PyDict_Type + ' Part of the *note Stable ABI: 550.' This instance of *note + PyTypeObject: aa5. represents the Python dictionary type. This is + the same object as *note dict: 258. in the Python layer. + + -- C Function: int PyDict_Check (PyObject *p) + + Return true if 'p' is a dict object or an instance of a subtype of + the dict type. This function always succeeds. + + -- C Function: int PyDict_CheckExact (PyObject *p) + + Return true if 'p' is a dict object, but not an instance of a + subtype of the dict type. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyDict_New () + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new empty dictionary, or ‘NULL’ on failure. + + -- C Function: *note PyObject: 334. *PyDictProxy_New (PyObject + *mapping) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a *note types.MappingProxyType: 469. object for a + mapping which enforces read-only behavior. This is normally used + to create a view to prevent modification of the dictionary for + non-dynamic class types. + + -- C Function: void PyDict_Clear (PyObject *p) + ' Part of the *note Stable ABI: 550.' Empty an existing dictionary + of all key-value pairs. + + -- C Function: int PyDict_Contains (PyObject *p, PyObject *key) + ' Part of the *note Stable ABI: 550.' Determine if dictionary 'p' + contains 'key'. If an item in 'p' is matches 'key', return ‘1’, + otherwise return ‘0’. On error, return ‘-1’. This is equivalent + to the Python expression ‘key in p’. + + -- C Function: int PyDict_ContainsString (PyObject *p, const char *key) + + This is the same as *note PyDict_Contains(): 333, but 'key' is + specified as a const char* UTF-8 encoded bytes string, rather than + a *note PyObject: 334.*. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyDict_Copy (PyObject *p) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new dictionary that contains the same key-value + pairs as 'p'. + + -- C Function: int PyDict_SetItem (PyObject *p, PyObject *key, PyObject + *val) + ' Part of the *note Stable ABI: 550.' Insert 'val' into the + dictionary 'p' with a key of 'key'. 'key' must be *note hashable: + 60c.; if it isn’t, *note TypeError: 534. will be raised. Return + ‘0’ on success or ‘-1’ on failure. This function 'does not' steal + a reference to 'val'. + + -- C Function: int PyDict_SetItemString (PyObject *p, const char *key, + PyObject *val) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyDict_SetItem(): 48d4, but 'key' is specified as a const char* + UTF-8 encoded bytes string, rather than a *note PyObject: 334.*. + + -- C Function: int PyDict_DelItem (PyObject *p, PyObject *key) + ' Part of the *note Stable ABI: 550.' Remove the entry in + dictionary 'p' with key 'key'. 'key' must be *note hashable: 60c.; + if it isn’t, *note TypeError: 534. is raised. If 'key' is not in + the dictionary, *note KeyError: 33f. is raised. Return ‘0’ on + success or ‘-1’ on failure. + + -- C Function: int PyDict_DelItemString (PyObject *p, const char *key) + ' Part of the *note Stable ABI: 550.' This is the same as *note + PyDict_DelItem(): 4999, but 'key' is specified as a const char* + UTF-8 encoded bytes string, rather than a *note PyObject: 334.*. + + -- C Function: int PyDict_GetItemRef (PyObject *p, PyObject *key, + PyObject **result) + ' Part of the *note Stable ABI: 550. since version 3.13.' Return a + new *note strong reference: 338. to the object from dictionary 'p' + which has a key 'key': + + * If the key is present, set '*result' to a new *note strong + reference: 338. to the value and return ‘1’. + + * If the key is missing, set '*result' to ‘NULL’ and return ‘0’. + + * On error, raise an exception and return ‘-1’. + + Added in version 3.13. + + See also the *note PyObject_GetItem(): 342. function. + + -- C Function: *note PyObject: 334. *PyDict_GetItem (PyObject *p, + PyObject *key) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return a *note borrowed reference: 339. to the object from + dictionary 'p' which has a key 'key'. Return ‘NULL’ if the key + 'key' is missing 'without' setting an exception. + + Note: Exceptions that occur while this calls *note __hash__(): + afb. and *note __eq__(): afa. methods are silently ignored. + Prefer the *note PyDict_GetItemWithError(): 337. function + instead. + + Changed in version 3.10: Calling this API without *note GIL: 159. + held had been allowed for historical reason. It is no longer + allowed. + + -- C Function: *note PyObject: 334. *PyDict_GetItemWithError (PyObject + *p, PyObject *key) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Variant of *note PyDict_GetItem(): 382. that does not + suppress exceptions. Return ‘NULL’ 'with' an exception set if an + exception occurred. Return ‘NULL’ 'without' an exception set if + the key wasn’t present. + + -- C Function: *note PyObject: 334. *PyDict_GetItemString (PyObject *p, + const char *key) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' This is the same as *note PyDict_GetItem(): 382, but 'key' + is specified as a const char* UTF-8 encoded bytes string, rather + than a *note PyObject: 334.*. + + Note: Exceptions that occur while this calls *note __hash__(): + afb. and *note __eq__(): afa. methods or while creating the + temporary *note str: 447. object are silently ignored. Prefer + using the *note PyDict_GetItemWithError(): 337. function with + your own *note PyUnicode_FromString(): 4ad1. 'key' instead. + + -- C Function: int PyDict_GetItemStringRef (PyObject *p, const char + *key, PyObject **result) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note PyDict_GetItemRef(): 335, but 'key' is specified as a + const char* UTF-8 encoded bytes string, rather than a *note + PyObject: 334.*. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyDict_SetDefault (PyObject *p, + PyObject *key, PyObject *defaultobj) + 'Return value: Borrowed reference.' This is the same as the + Python-level *note dict.setdefault(): 1072. If present, it returns + the value corresponding to 'key' from the dictionary 'p'. If the + key is not in the dict, it is inserted with value 'defaultobj' and + 'defaultobj' is returned. This function evaluates the hash + function of 'key' only once, instead of evaluating it independently + for the lookup and the insertion. + + Added in version 3.4. + + -- C Function: int PyDict_SetDefaultRef (PyObject *p, PyObject *key, + PyObject *default_value, PyObject **result) + + Inserts 'default_value' into the dictionary 'p' with a key of 'key' + if the key is not already present in the dictionary. If 'result' + is not ‘NULL’, then '*result' is set to a *note strong reference: + 338. to either 'default_value', if the key was not present, or the + existing value, if 'key' was already present in the dictionary. + Returns ‘1’ if the key was present and 'default_value' was not + inserted, or ‘0’ if the key was not present and 'default_value' was + inserted. On failure, returns ‘-1’, sets an exception, and sets + ‘*result’ to ‘NULL’. + + For clarity: if you have a strong reference to 'default_value' + before calling this function, then after it returns, you hold a + strong reference to both 'default_value' and '*result' (if it’s not + ‘NULL’). These may refer to the same object: in that case you hold + two separate references to it. + + Added in version 3.13. + + -- C Function: int PyDict_Pop (PyObject *p, PyObject *key, PyObject + **result) + + Remove 'key' from dictionary 'p' and optionally return the removed + value. Do not raise *note KeyError: 33f. if the key 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’. + + - On error, raise an exception and return ‘-1’. + + Similar to *note dict.pop(): 33e, but without the default value and + not raising *note KeyError: 33f. if the key missing. + + Added in version 3.13. + + -- C Function: int PyDict_PopString (PyObject *p, const char *key, + PyObject **result) + + Similar to *note PyDict_Pop(): 33c, but 'key' is specified as a + const char* UTF-8 encoded bytes string, rather than a *note + PyObject: 334.*. + + Added in version 3.13. + + -- C Function: *note PyObject: 334. *PyDict_Items (PyObject *p) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a *note PyListObject: 4bba. containing all the items + from the dictionary. + + -- C Function: *note PyObject: 334. *PyDict_Keys (PyObject *p) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a *note PyListObject: 4bba. containing all the keys + from the dictionary. + + -- C Function: *note PyObject: 334. *PyDict_Values (PyObject *p) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a *note PyListObject: 4bba. containing all the values + from the dictionary 'p'. + + -- C Function: *note Py_ssize_t: a5f. PyDict_Size (PyObject *p) + ' Part of the *note Stable ABI: 550.' + + Return the number of items in the dictionary. This is equivalent + to ‘len(p)’ on a dictionary. + + -- C Function: int PyDict_Next (PyObject *p, Py_ssize_t *ppos, PyObject + **pkey, PyObject **pvalue) + ' Part of the *note Stable ABI: 550.' Iterate over all key-value + pairs in the dictionary 'p'. The *note Py_ssize_t: a5f. referred + to by 'ppos' must be initialized to ‘0’ prior to the first call to + this function to start the iteration; the function returns true for + each pair in the dictionary, and false once all pairs have been + reported. The parameters 'pkey' and 'pvalue' should either point + to *note PyObject: 334.* variables that will be filled in with each + key and value, respectively, or may be ‘NULL’. Any references + returned through them are borrowed. 'ppos' should not be altered + during iteration. Its value represents offsets within the internal + dictionary structure, and since the structure is sparse, the + offsets are not consecutive. + + For example: + + PyObject *key, *value; + Py_ssize_t pos = 0; + + while (PyDict_Next(self->dict, &pos, &key, &value)) { + /* do something interesting with the values... */ + ... + } + + The dictionary 'p' should not be mutated during iteration. It is + safe to modify the values of the keys as you iterate over the + dictionary, but only so long as the set of keys does not change. + For example: + + 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: 1522. + build without external synchronization. You can use *note + Py_BEGIN_CRITICAL_SECTION: 4c9f. 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(); + + -- C Function: int PyDict_Merge (PyObject *a, PyObject *b, int + override) + ' Part of the *note Stable ABI: 550.' Iterate over mapping object + 'b' adding key-value pairs to dictionary 'a'. 'b' may be a + dictionary, or any object supporting *note PyMapping_Keys(): bbc. + and *note PyObject_GetItem(): 342. If 'override' is true, existing + pairs in 'a' will be replaced if a matching key is found in 'b', + otherwise pairs will only be added if there is not a matching key + in 'a'. Return ‘0’ on success or ‘-1’ if an exception was raised. + + -- C Function: int PyDict_Update (PyObject *a, PyObject *b) + ' Part of the *note Stable ABI: 550.' This is the same as + ‘PyDict_Merge(a, b, 1)’ in C, and is similar to ‘a.update(b)’ in + Python except that *note PyDict_Update(): 49a2. doesn’t fall back + to the iterating over a sequence of key value pairs if the second + argument has no “keys” attribute. Return ‘0’ on success or ‘-1’ if + an exception was raised. + + -- C Function: int PyDict_MergeFromSeq2 (PyObject *a, PyObject *seq2, + int override) + ' Part of the *note Stable ABI: 550.' Update or merge into + dictionary 'a', from the key-value pairs in 'seq2'. 'seq2' must be + an iterable object producing iterable objects of length 2, viewed + as key-value pairs. In case of duplicate keys, the last wins if + 'override' is true, else the first wins. Return ‘0’ on success or + ‘-1’ if an exception was raised. Equivalent Python (except for the + return value): + + def PyDict_MergeFromSeq2(a, seq2, override): + for key, value in seq2: + if override or key not in a: + a[key] = value + + -- C Function: int PyDict_AddWatcher (PyDict_WatchCallback callback) + + Register 'callback' as a dictionary watcher. Return a non-negative + integer id which must be passed to future calls to *note + PyDict_Watch(): 560. In case of error (e.g. no more watcher IDs + available), return ‘-1’ and set an exception. + + Added in version 3.12. + + -- C Function: int PyDict_ClearWatcher (int watcher_id) + + Clear watcher identified by 'watcher_id' previously returned from + *note PyDict_AddWatcher(): 55f. Return ‘0’ on success, ‘-1’ on + error (e.g. if the given 'watcher_id' was never registered.) + + Added in version 3.12. + + -- C Function: int PyDict_Watch (int watcher_id, PyObject *dict) + + Mark dictionary 'dict' as watched. The callback granted + 'watcher_id' by *note PyDict_AddWatcher(): 55f. will be called when + 'dict' is modified or deallocated. Return ‘0’ on success or ‘-1’ + on error. + + Added in version 3.12. + + -- C Function: int PyDict_Unwatch (int watcher_id, PyObject *dict) + + Mark dictionary 'dict' as no longer watched. The callback granted + 'watcher_id' by *note PyDict_AddWatcher(): 55f. 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: 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 Type: typedef int (*PyDict_WatchCallback)(*note PyDict_WatchEvent: + 4ca2. event, *note PyObject: 334. *dict, *note PyObject: 334. + *key, *note PyObject: 334. *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(): 34a. 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: Set Objects, Prev: Dictionary Objects, Up: Container Objects + +7.8.4.2 Set Objects +................... + +This section details the public API for *note set: 5d5. and *note +frozenset: 5d6. objects. Any functionality not listed below is best +accessed using either the abstract object protocol (including *note +PyObject_CallMethod(): 39b, *note PyObject_RichCompareBool(): 19a2, +*note PyObject_Hash(): 3ff, *note PyObject_Repr(): 1028, *note +PyObject_IsTrue(): 4a64, *note PyObject_Print(): 15f2, and *note +PyObject_GetIter(): 4a63.) or the abstract number protocol (including +*note PyNumber_And(): 4a37, *note PyNumber_Subtract(): 4a50, *note +PyNumber_Or(): 4a4b, *note PyNumber_Xor(): 4a52, *note +PyNumber_InPlaceAnd(): 4a3c, *note PyNumber_InPlaceSubtract(): 4a44, +*note PyNumber_InPlaceOr(): 4a40, and *note PyNumber_InPlaceXor(): +4a46.). + + -- C Type: type PySetObject + + This subtype of *note PyObject: 334. is used to hold the internal + data for both *note set: 5d5. and *note frozenset: 5d6. objects. + It is like a *note PyDictObject: 3bd. in that it is a fixed size + for small sets (much like tuple storage) and will point to a + separate, variable sized block of memory for medium and large sized + sets (much like list storage). None of the fields of this + structure should be considered public and all are subject to + change. All access should be done through the documented API + rather than by manipulating the values in the structure. + + -- C Variable: *note PyTypeObject: aa5. PySet_Type + ' Part of the *note Stable ABI: 550.' This is an instance of *note + PyTypeObject: aa5. representing the Python *note set: 5d5. type. + + -- C Variable: *note PyTypeObject: aa5. PyFrozenSet_Type + ' Part of the *note Stable ABI: 550.' This is an instance of *note + PyTypeObject: aa5. representing the Python *note frozenset: 5d6. + type. + +The following type check macros work on pointers to any Python object. +Likewise, the constructor functions work with any iterable Python +object. + + -- C Function: int PySet_Check (PyObject *p) + + Return true if 'p' is a *note set: 5d5. object or an instance of a + subtype. This function always succeeds. + + -- C Function: int PyFrozenSet_Check (PyObject *p) + + Return true if 'p' is a *note frozenset: 5d6. object or an instance + of a subtype. This function always succeeds. + + -- C Function: int PyAnySet_Check (PyObject *p) + + Return true if 'p' is a *note set: 5d5. object, a *note frozenset: + 5d6. object, or an instance of a subtype. This function always + succeeds. + + -- C Function: int PySet_CheckExact (PyObject *p) + + Return true if 'p' is a *note set: 5d5. object but not an instance + of a subtype. This function always succeeds. + + Added in version 3.10. + + -- C Function: int PyAnySet_CheckExact (PyObject *p) + + Return true if 'p' is a *note set: 5d5. object or a *note + frozenset: 5d6. object but not an instance of a subtype. This + function always succeeds. + + -- C Function: int PyFrozenSet_CheckExact (PyObject *p) + + Return true if 'p' is a *note frozenset: 5d6. object but not an + instance of a subtype. This function always succeeds. + + -- C Function: *note PyObject: 334. *PySet_New (PyObject *iterable) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note set: 5d5. containing objects returned by + the 'iterable'. The 'iterable' may be ‘NULL’ to create a new empty + set. Return the new set on success or ‘NULL’ on failure. Raise + *note TypeError: 534. if 'iterable' is not actually iterable. The + constructor is also useful for copying a set (‘c=set(s)’). + + -- C Function: *note PyObject: 334. *PyFrozenSet_New (PyObject + *iterable) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new *note frozenset: 5d6. containing objects + returned by the 'iterable'. The 'iterable' may be ‘NULL’ to create + a new empty frozenset. Return the new set on success or ‘NULL’ on + failure. Raise *note TypeError: 534. if 'iterable' is not actually + iterable. + +The following functions and macros are available for instances of *note +set: 5d5. or *note frozenset: 5d6. or instances of their subtypes. + + -- C Function: *note Py_ssize_t: a5f. PySet_Size (PyObject *anyset) + ' Part of the *note Stable ABI: 550.' + + Return the length of a *note set: 5d5. or *note frozenset: 5d6. + object. Equivalent to ‘len(anyset)’. Raises a *note SystemError: + 572. if 'anyset' is not a *note set: 5d5, *note frozenset: 5d6, or + an instance of a subtype. + + -- C Function: *note Py_ssize_t: a5f. PySet_GET_SIZE (PyObject *anyset) + + Macro form of *note PySet_Size(): 1415. without error checking. + + -- C Function: int PySet_Contains (PyObject *anyset, PyObject *key) + ' Part of the *note Stable ABI: 550.' Return ‘1’ if found, ‘0’ if + not found, and ‘-1’ if an error is encountered. Unlike the Python + *note __contains__(): 1f5e. method, this function does not + automatically convert unhashable sets into temporary frozensets. + Raise a *note TypeError: 534. if the 'key' is unhashable. Raise + *note SystemError: 572. if 'anyset' is not a *note set: 5d5, *note + frozenset: 5d6, or an instance of a subtype. + + -- C Function: int PySet_Add (PyObject *set, PyObject *key) + ' Part of the *note Stable ABI: 550.' Add 'key' to a *note set: + 5d5. instance. Also works with *note frozenset: 5d6. instances + (like *note PyTuple_SetItem(): 48d3. it can be used to fill in the + values of brand new frozensets before they are exposed to other + code). Return ‘0’ on success or ‘-1’ on failure. Raise a *note + TypeError: 534. if the 'key' is unhashable. Raise a *note + MemoryError: 1576. if there is no room to grow. Raise a *note + SystemError: 572. if 'set' is not an instance of *note set: 5d5. or + its subtype. + +The following functions are available for instances of *note set: 5d5. +or its subtypes but not for instances of *note frozenset: 5d6. or its +subtypes. + + -- C Function: int PySet_Discard (PyObject *set, PyObject *key) + ' Part of the *note Stable ABI: 550.' 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: 33f. for missing + keys. Raise a *note TypeError: 534. if the 'key' is unhashable. + Unlike the Python *note discard(): 223d. method, this function does + not automatically convert unhashable sets into temporary + frozensets. Raise *note SystemError: 572. if 'set' is not an + instance of *note set: 5d5. or its subtype. + + -- C Function: *note PyObject: 334. *PySet_Pop (PyObject *set) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new reference to an arbitrary object in the 'set', + and removes the object from the 'set'. Return ‘NULL’ on failure. + Raise *note KeyError: 33f. if the set is empty. Raise a *note + SystemError: 572. if 'set' is not an instance of *note set: 5d5. or + its subtype. + + -- C Function: int PySet_Clear (PyObject *set) + ' Part of the *note Stable ABI: 550.' Empty an existing set of all + elements. Return ‘0’ on success. Return ‘-1’ and raise *note + SystemError: 572. if 'set' is not an instance of *note set: 5d5. or + its subtype. + + +File: python.info, Node: Function Objects<2>, Next: Other Objects, Prev: Container Objects, Up: Concrete Objects Layer + +7.8.5 Function Objects +---------------------- + +* Menu: + +* Function Objects: Function Objects<3>. +* Instance Method Objects:: +* Method Objects: Method Objects<2>. +* Cell Objects:: +* Code Objects: Code Objects<2>. +* Code Object Flags:: +* Extra information:: + + +File: python.info, Node: Function Objects<3>, Next: Instance Method Objects, Up: Function Objects<2> + +7.8.5.1 Function Objects +........................ + +There are a few functions specific to Python functions. + + -- C Type: type PyFunctionObject + + The C structure used for functions. + + -- C Variable: *note PyTypeObject: aa5. PyFunction_Type + + This is an instance of *note PyTypeObject: aa5. and represents the + Python function type. It is exposed to Python programmers as + ‘types.FunctionType’. + + -- C Function: int PyFunction_Check (PyObject *o) + + Return true if 'o' is a function object (has type *note + PyFunction_Type: 4cb3.). The parameter must not be ‘NULL’. This + function always succeeds. + + -- C Function: *note PyObject: 334. *PyFunction_New (PyObject *code, + PyObject *globals) + 'Return value: New reference.' Return a new function object + associated with the code object 'code'. 'globals' must be a + dictionary with the global variables accessible to the function. + + The function’s docstring and name are retrieved from the code + object. *note __module__: 1efe. is retrieved from 'globals'. The + argument defaults, annotations and closure are set to ‘NULL’. + *note __qualname__: 1efd. is set to the same value as the code + object’s *note co_qualname: 1f37. field. + + -- C Function: *note PyObject: 334. *PyFunction_NewWithQualName + (PyObject *code, PyObject *globals, PyObject *qualname) + 'Return value: New reference.' As *note PyFunction_New(): 4cb5, + but also allows setting the function object’s *note __qualname__: + 1efd. attribute. 'qualname' should be a unicode object or ‘NULL’; + if ‘NULL’, the ‘__qualname__’ attribute is set to the same value as + the code object’s *note co_qualname: 1f37. field. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyFunction_GetCode (PyObject *op) + 'Return value: Borrowed reference.' Return the code object + associated with the function object 'op'. + + -- C Function: *note PyObject: 334. *PyFunction_GetGlobals (PyObject + *op) + 'Return value: Borrowed reference.' Return the globals dictionary + associated with the function object 'op'. + + -- C Function: *note PyObject: 334. *PyFunction_GetModule (PyObject + *op) + 'Return value: Borrowed reference.' Return a *note borrowed + reference: 339. to the *note __module__: 1efe. attribute of the + *note function object: 29b. 'op'. It can be 'NULL'. + + This is normally a *note string: 447. containing the module name, + but can be set to any other object by Python code. + + -- C Function: *note PyObject: 334. *PyFunction_GetDefaults (PyObject + *op) + 'Return value: Borrowed reference.' Return the argument default + values of the function object 'op'. This can be a tuple of + arguments or ‘NULL’. + + -- C Function: int PyFunction_SetDefaults (PyObject *op, PyObject + *defaults) + + Set the argument default values for the function object 'op'. + 'defaults' must be ‘Py_None’ or a tuple. + + Raises *note SystemError: 572. and returns ‘-1’ on failure. + + -- C Function: 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 Function: *note PyObject: 334. *PyFunction_GetKwDefaults (PyObject + *op) + 'Return value: Borrowed reference.' Return the keyword-only + argument default values of the function object 'op'. This can be a + dictionary of arguments or ‘NULL’. + + -- C Function: *note PyObject: 334. *PyFunction_GetClosure (PyObject + *op) + 'Return value: Borrowed reference.' Return the closure associated + with the function object 'op'. This can be ‘NULL’ or a tuple of + cell objects. + + -- C Function: int PyFunction_SetClosure (PyObject *op, PyObject + *closure) + + Set the closure associated with the function object 'op'. + 'closure' must be ‘Py_None’ or a tuple of cell objects. + + Raises *note SystemError: 572. and returns ‘-1’ on failure. + + -- C Function: *note PyObject: 334. *PyFunction_GetAnnotations + (PyObject *op) + 'Return value: Borrowed reference.' Return the annotations of the + function object 'op'. This can be a mutable dictionary or ‘NULL’. + + -- C Function: int PyFunction_SetAnnotations (PyObject *op, PyObject + *annotations) + + Set the annotations for the function object 'op'. 'annotations' + must be a dictionary or ‘Py_None’. + + Raises *note SystemError: 572. and returns ‘-1’ on failure. + + -- C Function: *note PyObject: 334. *PyFunction_GET_CODE (PyObject *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_GLOBALS (PyObject + *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_MODULE (PyObject + *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_DEFAULTS (PyObject + *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_KW_DEFAULTS + (PyObject *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_CLOSURE (PyObject + *op) + -- C Function: *note PyObject: 334. *PyFunction_GET_ANNOTATIONS + (PyObject *op) + 'Return value: Borrowed reference.' 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: + 4cb3. is undefined behavior. + + -- C Function: 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(): 4cc8. In case of error (e.g. no more + watcher IDs available), return ‘-1’ and set an exception. + + Added in version 3.12. + + -- C Function: int PyFunction_ClearWatcher (int watcher_id) + + Clear watcher identified by 'watcher_id' previously returned from + *note PyFunction_AddWatcher(): 4cc7. 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: type PyFunction_WatchEvent + + Enumeration of possible function watcher events: + + - ‘PyFunction_EVENT_CREATE’ + + - ‘PyFunction_EVENT_DESTROY’ + + - ‘PyFunction_EVENT_MODIFY_CODE’ + + - ‘PyFunction_EVENT_MODIFY_DEFAULTS’ + + - ‘PyFunction_EVENT_MODIFY_KWDEFAULTS’ + + Added in version 3.12. + + -- C Type: typedef int (*PyFunction_WatchCallback)(*note + PyFunction_WatchEvent: 4cc9. event, *note PyFunctionObject: + 55e. *func, *note PyObject: 334. *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: 339. + 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(): 34a. 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: Method Objects<2>, Prev: Function Objects<3>, Up: Function Objects<2> + +7.8.5.2 Instance Method Objects +............................... + +An instance method is a wrapper for a *note PyCFunction: 1440. and the +new way to bind a *note PyCFunction: 1440. to a class object. It +replaces the former call ‘PyMethod_New(func, NULL, class)’. + + -- C Variable: *note PyTypeObject: aa5. PyInstanceMethod_Type + + This instance of *note PyTypeObject: aa5. represents the Python + instance method type. It is not exposed to Python programs. + + -- C Function: int PyInstanceMethod_Check (PyObject *o) + + Return true if 'o' is an instance method object (has type *note + PyInstanceMethod_Type: 4cce.). The parameter must not be ‘NULL’. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PyInstanceMethod_New (PyObject + *func) + 'Return value: New reference.' Return a new instance method + object, with 'func' being any callable object. 'func' is the + function that will be called when the instance method is called. + + -- C Function: *note PyObject: 334. *PyInstanceMethod_Function + (PyObject *im) + 'Return value: Borrowed reference.' Return the function object + associated with the instance method 'im'. + + -- C Function: *note PyObject: 334. *PyInstanceMethod_GET_FUNCTION + (PyObject *im) + 'Return value: Borrowed reference.' Macro version of *note + PyInstanceMethod_Function(): 4cd1. which avoids error checking. + + +File: python.info, Node: Method Objects<2>, Next: Cell Objects, Prev: Instance Method Objects, Up: Function Objects<2> + +7.8.5.3 Method Objects +...................... + +Methods are bound function objects. Methods are always bound to an +instance of a user-defined class. Unbound methods (methods bound to a +class object) are no longer available. + + -- C Variable: *note PyTypeObject: aa5. PyMethod_Type + + This instance of *note PyTypeObject: aa5. represents the Python + method type. This is exposed to Python programs as + ‘types.MethodType’. + + -- C Function: int PyMethod_Check (PyObject *o) + + Return true if 'o' is a method object (has type *note + PyMethod_Type: 4cd5.). The parameter must not be ‘NULL’. This + function always succeeds. + + -- C Function: *note PyObject: 334. *PyMethod_New (PyObject *func, + PyObject *self) + 'Return value: New reference.' Return a new method object, with + 'func' being any callable object and 'self' the instance the method + should be bound. 'func' is the function that will be called when + the method is called. 'self' must not be ‘NULL’. + + -- C Function: *note PyObject: 334. *PyMethod_Function (PyObject *meth) + 'Return value: Borrowed reference.' Return the function object + associated with the method 'meth'. + + -- C Function: *note PyObject: 334. *PyMethod_GET_FUNCTION (PyObject + *meth) + 'Return value: Borrowed reference.' Macro version of *note + PyMethod_Function(): 4cd8. which avoids error checking. + + -- C Function: *note PyObject: 334. *PyMethod_Self (PyObject *meth) + 'Return value: Borrowed reference.' Return the instance associated + with the method 'meth'. + + -- C Function: *note PyObject: 334. *PyMethod_GET_SELF (PyObject *meth) + 'Return value: Borrowed reference.' Macro version of *note + PyMethod_Self(): 4cda. which avoids error checking. + + +File: python.info, Node: Cell Objects, Next: Code Objects<2>, Prev: Method Objects<2>, Up: Function Objects<2> + +7.8.5.4 Cell Objects +.................... + +“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 +contains 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: type PyCellObject + + The C structure used for cell objects. + + -- C Variable: *note PyTypeObject: aa5. PyCell_Type + + The type object corresponding to cell objects. + + -- C Function: int PyCell_Check (PyObject *ob) + + Return true if 'ob' is a cell object; 'ob' must not be ‘NULL’. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PyCell_New (PyObject *ob) + 'Return value: New reference.' Create and return a new cell object + containing the value 'ob'. The parameter may be ‘NULL’. + + -- C Function: *note PyObject: 334. *PyCell_Get (PyObject *cell) + 'Return value: New reference.' 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 Function: *note PyObject: 334. *PyCell_GET (PyObject *cell) + 'Return value: Borrowed reference.' Return the contents of the + cell 'cell', but without checking that 'cell' is non-‘NULL’ and a + cell object. + + -- C Function: 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 Function: void PyCell_SET (PyObject *cell, PyObject *value) + + Sets the value of the cell object 'cell' to 'value'. No reference + counts are adjusted, and no checks are made for safety; 'cell' must + be non-‘NULL’ and must be a cell object. + + +File: python.info, Node: Code Objects<2>, Next: Code Object Flags, Prev: Cell Objects, Up: Function Objects<2> + +7.8.5.5 Code Objects +.................... + +Code objects are a low-level detail of the CPython implementation. Each +one represents a chunk of executable code that hasn’t yet been bound +into a function. + + -- C Type: type PyCodeObject + + The C structure of the objects used to describe code objects. The + fields of this type are subject to change at any time. + + -- C Variable: *note PyTypeObject: aa5. PyCode_Type + + This is an instance of *note PyTypeObject: aa5. representing the + Python *note code object: 1d2. + + -- C Function: int PyCode_Check (PyObject *co) + + Return true if 'co' is a *note code object: 1d2. This function + always succeeds. + + -- C Function: *note Py_ssize_t: a5f. PyCode_GetNumFree (PyCodeObject + *co) + + Return the number of *note free (closure) variables: 1f3f. in a + code object. + + -- C Function: int PyUnstable_Code_GetFirstFree (PyCodeObject *co) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return the position of the first *note free (closure) variable: + 1f3f. in a code object. + + Changed in version 3.13: Renamed from ‘PyCode_GetFirstFree’ as part + of *note Unstable C API: 544. The old name is deprecated, but will + remain available until the signature changes again. + + -- C Function: *note PyCodeObject: 772. *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) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return a new code object. If you need a dummy code object to + create a frame, use *note PyCode_NewEmpty(): 1344. instead. + + Since the definition of the bytecode changes often, calling *note + PyUnstable_Code_New(): 4cea. 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. + + Changed in version 3.11: Added ‘qualname’ and ‘exceptiontable’ + parameters. + + Changed in version 3.12: Renamed from ‘PyCode_New’ as part of *note + Unstable C API: 544. The old name is deprecated, but will remain + available until the signature changes again. + + -- C Function: *note PyCodeObject: 772. + *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) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Similar to *note PyUnstable_Code_New(): 4cea, 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’ + + Changed in version 3.11: Added ‘qualname’ and ‘exceptiontable’ + parameters. + + Changed in version 3.12: Renamed to + ‘PyUnstable_Code_NewWithPosOnlyArgs’. The old name is deprecated, + but will remain available until the signature changes again. + + -- C Function: *note PyCodeObject: 772. *PyCode_NewEmpty (const char + *filename, const char *funcname, int firstlineno) + 'Return value: New reference.' 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 Function: 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(): 786. instead. + + For efficiently iterating over the line numbers in a code object, + use the API described in PEP 626(1). + + -- C Function: 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 Function: *note PyObject: 334. *PyCode_GetCode (PyCodeObject *co) + + Equivalent to the Python code ‘getattr(co, 'co_code')’. Returns a + strong reference to a *note PyBytesObject: 78d. 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 Function: *note PyObject: 334. *PyCode_GetVarnames (PyCodeObject + *co) + + Equivalent to the Python code ‘getattr(co, 'co_varnames')’. + Returns a new reference to a *note PyTupleObject: 4b52. containing + the names of the local variables. On error, ‘NULL’ is returned and + an exception is raised. + + Added in version 3.11. + + -- C Function: *note PyObject: 334. *PyCode_GetCellvars (PyCodeObject + *co) + + Equivalent to the Python code ‘getattr(co, 'co_cellvars')’. + Returns a new reference to a *note PyTupleObject: 4b52. 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 Function: *note PyObject: 334. *PyCode_GetFreevars (PyCodeObject + *co) + + Equivalent to the Python code ‘getattr(co, 'co_freevars')’. + Returns a new reference to a *note PyTupleObject: 4b52. containing + the names of the *note free (closure) variables: 1f3f. On error, + ‘NULL’ is returned and an exception is raised. + + Added in version 3.11. + + -- C Function: 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(): 564. In case of error (e.g. no more + watcher IDs available), return ‘-1’ and set an exception. + + Added in version 3.12. + + -- C Function: int PyCode_ClearWatcher (int watcher_id) + + Clear watcher identified by 'watcher_id' previously returned from + *note PyCode_AddWatcher(): 563. 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: type PyCodeEvent + + Enumeration of possible code object watcher events: - + ‘PY_CODE_EVENT_CREATE’ - ‘PY_CODE_EVENT_DESTROY’ + + Added in version 3.12. + + -- C Type: typedef int (*PyCode_WatchCallback)(*note PyCodeEvent: 4cec. + event, *note PyCodeObject: 772. *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(): 34a. 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. + + ---------- 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: Code Objects<2>, Up: Function Objects<2> + +7.8.5.6 Code Object Flags +......................... + +Code objects contain a bit-field of flags, which can be retrieved as the +*note co_flags: 1f44. Python attribute (for example using *note +PyObject_GetAttrString(): 347.), and set using a 'flags' argument to +*note PyUnstable_Code_New(): 4cea. and similar functions. + +Flags whose names start with ‘CO_FUTURE_’ correspond to features +normally selectable by *note future statements: 189. These flags can be +used in *note PyCompilerFlags.cf_flags: 4b23. 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 Meaning + +-------------------------------------------------------------------------------------------------------------- + + -- C Macro: CO_OPTIMIZED *note inspect.CO_OPTIMIZED: 44c7. + + + -- C Macro: CO_NEWLOCALS *note inspect.CO_NEWLOCALS: 44c8. + + + -- C Macro: CO_VARARGS *note inspect.CO_VARARGS: 44c9. + + + -- C Macro: CO_VARKEYWORDS *note inspect.CO_VARKEYWORDS: 44ca. + + + -- C Macro: CO_NESTED *note inspect.CO_NESTED: 44cb. + + + -- C Macro: CO_GENERATOR *note inspect.CO_GENERATOR: 44cc. + + + -- C Macro: CO_COROUTINE *note inspect.CO_COROUTINE: 44cd. + + + -- C Macro: CO_ITERABLE_COROUTINE *note inspect.CO_ITERABLE_COROUTINE: 44ce. + + + -- C Macro: CO_ASYNC_GENERATOR *note inspect.CO_ASYNC_GENERATOR: 44cf. + + + -- C Macro: CO_FUTURE_DIVISION no effect (*note __future__.division: 4471.) + + + -- C Macro: CO_FUTURE_ABSOLUTE_IMPORT no effect (*note __future__.absolute_import: 4472.) + + + -- C Macro: CO_FUTURE_WITH_STATEMENT no effect (*note __future__.with_statement: 4473.) + + + -- C Macro: CO_FUTURE_PRINT_FUNCTION no effect (*note __future__.print_function: 4474.) + + + -- C Macro: CO_FUTURE_UNICODE_LITERALS no effect (*note __future__.unicode_literals: 4475.) + + + -- C Macro: CO_FUTURE_GENERATOR_STOP no effect (*note __future__.generator_stop: 4476.) + + + -- C Macro: CO_FUTURE_ANNOTATIONS *note __future__.annotations: 4477. + + + +File: python.info, Node: Extra information, Prev: Code Object Flags, Up: Function Objects<2> + +7.8.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 Function: *note Py_ssize_t: a5f. + PyUnstable_Eval_RequestCodeExtraIndex (freefunc free) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return a new an 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(): 4adf. when storing *note PyObject: 334. + + Added in version 3.6: as ‘_PyEval_RequestCodeExtraIndex’ + + Changed in version 3.12: Renamed to + ‘PyUnstable_Eval_RequestCodeExtraIndex’. The old private name is + deprecated, but will be available until the API changes. + + -- C Function: int PyUnstable_Code_GetExtra (PyObject *code, Py_ssize_t + index, void **extra) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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’ + + Changed in version 3.12: Renamed to ‘PyUnstable_Code_GetExtra’. + The old private name is deprecated, but will be available until the + API changes. + + -- C Function: int PyUnstable_Code_SetExtra (PyObject *code, Py_ssize_t + index, void *extra) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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’ + + Changed in version 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: Other Objects, Prev: Function Objects<2>, Up: Concrete Objects Layer + +7.8.6 Other Objects +------------------- + +* Menu: + +* File Objects:: +* Module Objects:: +* Iterator Objects:: +* Descriptor Objects:: +* Slice Objects:: +* MemoryView objects:: +* Weak Reference Objects: Weak Reference Objects<2>. +* Capsules: Capsules<2>. +* Frame Objects:: +* Generator Objects:: +* Coroutine Objects: Coroutine Objects<2>. +* Context Variables Objects:: +* DateTime Objects: DateTime Objects<2>. +* Objects for Type Hinting:: + + +File: python.info, Node: File Objects, Next: Module Objects, Up: Other Objects + +7.8.6.1 File Objects +.................... + +These APIs are a minimal emulation of the Python 2 C API for built-in +file objects, which used to rely on the buffered I/O (FILE*) support +from the C standard library. In Python 3, files and streams use the new +*note io: 7f. module, which defines several layers over the low-level +unbuffered I/O of the operating system. The functions described below +are convenience C wrappers over these new APIs, and meant mostly for +internal error reporting in the interpreter; third-party code is advised +to access the *note io: 7f. APIs instead. + + -- C Function: *note PyObject: 334. *PyFile_FromFd (int fd, const char + *name, const char *mode, int buffering, const char *encoding, + const char *errors, const char *newline, int closefd) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a Python file object from the file descriptor of an + already opened file 'fd'. The arguments 'name', 'encoding', + 'errors' and 'newline' can be ‘NULL’ to use the defaults; + 'buffering' can be '-1' to use the default. 'name' is ignored and + kept for backward compatibility. Return ‘NULL’ on failure. For a + more comprehensive description of the arguments, please refer to + the *note io.open(): 518. function documentation. + + Warning: Since Python streams have their own buffering layer, + mixing them with OS-level file descriptors can produce various + issues (such as unexpected ordering of data). + + Changed in version 3.2: Ignore 'name' attribute. + + -- C Function: int PyObject_AsFileDescriptor (PyObject *p) + ' Part of the *note Stable ABI: 550.' Return the file descriptor + associated with 'p' as an int. If the object is an integer, its + value is returned. If not, the object’s *note fileno(): 2856. + method is called if it exists; the method must return an integer, + which is returned as the file descriptor value. Sets an exception + and returns ‘-1’ on failure. + + -- C Function: *note PyObject: 334. *PyFile_GetLine (PyObject *p, int + n) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Equivalent to ‘p.readline([n])’, this function reads one line from + the object 'p'. 'p' may be a file object or any object with a + *note readline(): 131c. method. If 'n' is ‘0’, exactly one line is + read, regardless of the length of the line. If 'n' is greater than + ‘0’, no more than 'n' bytes will be read from the file; a partial + line can be returned. In both cases, an empty string is returned + if the end of the file is reached immediately. If 'n' is less than + ‘0’, however, one line is read regardless of length, but *note + EOFError: 12cc. is raised if the end of the file is reached + immediately. + + -- C Function: int PyFile_SetOpenCodeHook (Py_OpenCodeHookFunction + handler) + + Overrides the normal behavior of *note io.open_code(): 1727. to + pass its parameter through the provided handler. + + The 'handler' is a function of type: + + -- C Type: typedef *note PyObject: 334. + *(*Py_OpenCodeHookFunction)(*note PyObject: 334.*, void*) + + Equivalent of *note PyObject: 334. *(*)(*note PyObject: 334. + *path, void *userData), where 'path' is guaranteed to be *note + PyUnicodeObject: 78f. + + The 'userData' pointer is passed into the hook function. Since + hook functions may be called from different runtimes, this pointer + should not refer directly to Python state. + + As this hook is intentionally used during import, avoid importing + new modules during its execution unless they are known to be frozen + or available in ‘sys.modules’. + + Once a hook has been set, it cannot be removed or replaced, and + later calls to *note PyFile_SetOpenCodeHook(): 1729. will fail. On + failure, the function returns -1 and sets an exception if the + interpreter has been initialized. + + This function is safe to call before *note Py_Initialize(): 8ab. + + Raises an *note auditing event: 18ba. ‘setopencodehook’ with no + arguments. + + Added in version 3.8. + + -- C Function: int PyFile_WriteObject (PyObject *obj, PyObject *p, int + flags) + ' Part of the *note Stable ABI: 550.' + + Write object 'obj' to file object 'p'. The only supported flag for + 'flags' is *note Py_PRINT_RAW: 4b9d.; if given, the *note str(): + 447. of the object is written instead of the *note repr(): 7f9. + Return ‘0’ on success or ‘-1’ on failure; the appropriate exception + will be set. + + -- C Function: int PyFile_WriteString (const char *s, PyObject *p) + ' Part of the *note Stable ABI: 550.' Write string 's' to file + object 'p'. Return ‘0’ on success or ‘-1’ on failure; the + appropriate exception will be set. + + +File: python.info, Node: Module Objects, Next: Iterator Objects, Prev: File Objects, Up: Other Objects + +7.8.6.2 Module Objects +...................... + + -- C Variable: *note PyTypeObject: aa5. PyModule_Type + ' Part of the *note Stable ABI: 550.' + + This instance of *note PyTypeObject: aa5. represents the Python + module type. This is exposed to Python programs as + ‘types.ModuleType’. + + -- C Function: int PyModule_Check (PyObject *p) + + Return true if 'p' is a module object, or a subtype of a module + object. This function always succeeds. + + -- C Function: int PyModule_CheckExact (PyObject *p) + + Return true if 'p' is a module object, but not a subtype of *note + PyModule_Type: 4a34. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyModule_NewObject (PyObject + *name) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' + + Return a new module object with *note module.__name__: 1374. set to + 'name'. The module’s ‘__name__’, *note __doc__: 1852, *note + __package__: 2db. and *note __loader__: 2e6. attributes are filled + in (all but ‘__name__’ are set to ‘None’). The caller is + responsible for setting a *note __file__: 1f1d. attribute. + + Return ‘NULL’ with an exception set on error. + + Added in version 3.3. + + Changed in version 3.4: *note __package__: 2db. and *note + __loader__: 2e6. are now set to ‘None’. + + -- C Function: *note PyObject: 334. *PyModule_New (const char *name) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Similar to *note PyModule_NewObject(): 4a32, but the name is + a UTF-8 encoded string instead of a Unicode object. + + -- C Function: *note PyObject: 334. *PyModule_GetDict (PyObject + *module) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' + + Return the dictionary object that implements 'module'’s namespace; + this object is the same as the *note __dict__: 558. attribute of + the module object. If 'module' is not a module object (or a + subtype of a module object), *note SystemError: 572. is raised and + ‘NULL’ is returned. + + It is recommended extensions use other ‘PyModule_*’ and + ‘PyObject_*’ functions rather than directly manipulate a module’s + *note __dict__: 558. + + -- C Function: *note PyObject: 334. *PyModule_GetNameObject (PyObject + *module) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' + + Return 'module'’s *note __name__: 1374. value. If the module does + not provide one, or if it is not a string, *note SystemError: 572. + is raised and ‘NULL’ is returned. + + Added in version 3.3. + + -- C Function: const char *PyModule_GetName (PyObject *module) + ' Part of the *note Stable ABI: 550.' Similar to *note + PyModule_GetNameObject(): 4a30. but return the name encoded to + ‘'utf-8'’. + + -- C Function: void *PyModule_GetState (PyObject *module) + ' Part of the *note Stable ABI: 550.' Return the “state” of the + module, that is, a pointer to the block of memory allocated at + module creation time, or ‘NULL’. See *note PyModuleDef.m_size: + 97f. + + -- C Function: *note PyModuleDef: 97d. *PyModule_GetDef (PyObject + *module) + ' Part of the *note Stable ABI: 550.' Return a pointer to the + *note PyModuleDef: 97d. struct from which the module was created, + or ‘NULL’ if the module wasn’t created from a definition. + + -- C Function: *note PyObject: 334. *PyModule_GetFilenameObject + (PyObject *module) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + Return the name of the file from which 'module' was loaded using + 'module'’s *note __file__: 1f1d. attribute. If this is not + defined, or if it is not a string, raise *note SystemError: 572. + and return ‘NULL’; otherwise return a reference to a Unicode + object. + + Added in version 3.2. + + -- C Function: const char *PyModule_GetFilename (PyObject *module) + ' Part of the *note Stable ABI: 550.' Similar to *note + PyModule_GetFilenameObject(): 3f5. but return the filename encoded + to ‘utf-8’. + + Deprecated since version 3.2: *note PyModule_GetFilename(): 3f4. + raises *note UnicodeEncodeError: 673. on unencodable filenames, use + *note PyModule_GetFilenameObject(): 3f5. instead. + +* Menu: + +* Initializing C modules:: +* Module lookup:: + + +File: python.info, Node: Initializing C modules, Next: Module lookup, Up: Module Objects + +7.8.6.3 Initializing C modules +.............................. + +Modules objects are usually created from extension modules (shared +libraries which export an initialization function), or compiled-in +modules (where the initialization function is added using *note +PyImport_AppendInittab(): 17a3.). See *note Building C and C++ +Extensions: 48c2. or *note Extending Embedded Python: 492d. for details. + +The initialization function can either pass a module definition instance +to *note PyModule_Create(): 4d0d, and return the resulting module +object, or request “multi-phase initialization” by returning the +definition struct itself. + + -- C Type: type PyModuleDef + ' Part of the *note Stable ABI: 550. (including all members).' The + module definition struct, which holds all information needed to + create a module object. There is usually only one statically + initialized variable of this type for each module. + + -- C Member: PyModuleDef_Base m_base + + Always initialize this member to ‘PyModuleDef_HEAD_INIT’. + + -- C Member: const char *m_name + + Name for the new module. + + -- C Member: const char *m_doc + + Docstring for the module; usually a docstring variable created + with *note PyDoc_STRVAR: 1971. is used. + + -- C Member: *note Py_ssize_t: a5f. m_size + + Module state may be kept in a per-module memory area that can + be retrieved with *note PyModule_GetState(): 980, rather than + in static globals. This makes modules safe for use in + multiple sub-interpreters. + + This memory area is allocated based on 'm_size' on module + creation, and freed when the module object is deallocated, + after the *note m_free: 97c. function has been called, if + present. + + Setting ‘m_size’ to ‘-1’ means that the module does not + support sub-interpreters, because it has global state. + + Setting it to a non-negative value means that the module can + be re-initialized and specifies the additional amount of + memory it requires for its state. Non-negative ‘m_size’ is + required for multi-phase initialization. + + See PEP 3121(1) for more details. + + -- C Member: *note PyMethodDef: 14a2. *m_methods + + A pointer to a table of module-level functions, described by + *note PyMethodDef: 14a2. values. Can be ‘NULL’ if no + functions are present. + + -- C Member: *note PyModuleDef_Slot: 4d13. *m_slots + + An array of slot definitions for multi-phase initialization, + terminated by a ‘{0, NULL}’ entry. When using single-phase + initialization, 'm_slots' must be ‘NULL’. + + Changed in version 3.5: Prior to version 3.5, this member was + always set to ‘NULL’, and was defined as: + + -- C Member: *note inquiry: 4af8. m_reload + + -- C Member: *note traverseproc: 4b07. m_traverse + + A traversal function to call during GC traversal of the module + object, or ‘NULL’ if not needed. + + This function is not called if the module state was requested + but is not allocated yet. This is the case immediately after + the module is created and before the module is executed (*note + Py_mod_exec: 97e. function). More precisely, this function is + not called if *note m_size: 97f. is greater than 0 and the + module state (as returned by *note PyModule_GetState(): 980.) + is ‘NULL’. + + Changed in version 3.9: No longer called before the module + state is allocated. + + -- C Member: *note inquiry: 4af8. m_clear + + A clear function to call during GC clearing of the module + object, or ‘NULL’ if not needed. + + This function is not called if the module state was requested + but is not allocated yet. This is the case immediately after + the module is created and before the module is executed (*note + Py_mod_exec: 97e. function). More precisely, this function is + not called if *note m_size: 97f. is greater than 0 and the + module state (as returned by *note PyModule_GetState(): 980.) + is ‘NULL’. + + Like *note PyTypeObject.tp_clear: 48fb, this function is not + 'always' called before a module is deallocated. For example, + when reference counting is enough to determine that an object + is no longer used, the cyclic garbage collector is not + involved and *note m_free: 97c. is called directly. + + Changed in version 3.9: No longer called before the module + state is allocated. + + -- C Member: *note freefunc: 4d15. m_free + + A function to call during deallocation of the module object, + or ‘NULL’ if not needed. + + This function is not called if the module state was requested + but is not allocated yet. This is the case immediately after + the module is created and before the module is executed (*note + Py_mod_exec: 97e. function). More precisely, this function is + not called if *note m_size: 97f. is greater than 0 and the + module state (as returned by *note PyModule_GetState(): 980.) + is ‘NULL’. + + Changed in version 3.9: No longer called before the module + state is allocated. + +* Menu: + +* Single-phase initialization:: +* Multi-phase initialization:: +* Low-level module creation functions:: +* Support functions:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3121/ + + +File: python.info, Node: Single-phase initialization, Next: Multi-phase initialization, Up: Initializing C modules + +7.8.6.4 Single-phase initialization +................................... + +The module initialization function may create and return the module +object directly. This is referred to as “single-phase initialization”, +and uses one of the following two module creation functions: + + -- C Function: *note PyObject: 334. *PyModule_Create (PyModuleDef *def) + 'Return value: New reference.' Create a new module object, given + the definition in 'def'. This behaves like *note + PyModule_Create2(): 4a2c. with 'module_api_version' set to + ‘PYTHON_API_VERSION’. + + -- C Function: *note PyObject: 334. *PyModule_Create2 (PyModuleDef + *def, int module_api_version) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a new module object, given the definition in 'def', + assuming the API version 'module_api_version'. If that version + does not match the version of the running interpreter, a *note + RuntimeWarning: 1bd. is emitted. + + Return ‘NULL’ with an exception set on error. + + Note: Most uses of this function should be using *note + PyModule_Create(): 4d0d. instead; only use this if you are + sure you need it. + +Before it is returned from in the initialization function, the resulting +module object is typically populated using functions like *note +PyModule_AddObjectRef(): 360. + + +File: python.info, Node: Multi-phase initialization, Next: Low-level module creation functions, Prev: Single-phase initialization, Up: Initializing C modules + +7.8.6.5 Multi-phase initialization +.................................. + +An alternate way to specify extensions is to request “multi-phase +initialization”. Extension modules created this way behave more like +Python modules: the initialization is split between the 'creation +phase', when the module object is created, and the 'execution phase', +when it is populated. The distinction is similar to the *note +__new__(): 57d. and *note __init__(): 6ac. methods of classes. + +Unlike modules created using single-phase initialization, these modules +are not singletons. For example, if the *note sys.modules: 1550. 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: +584. or after after Python runtime reinitialization (*note +Py_Finalize(): 1345. and *note Py_Initialize(): 8ab.). 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, including references to Python objects, should be +specific to a particular module instance. See *note Isolating Extension +Modules: 48be. for more details and a practical guide. + +A simpler way to avoid these issues is *note raising an error on +repeated initialization: 4d18. + +All modules created using multi-phase initialization are expected to +support *note sub-interpreters: 584, 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: 4d19. +slot. + +To request multi-phase initialization, the initialization function +(PyInit_modulename) returns a *note PyModuleDef: 97d. instance with +non-empty *note m_slots: 4d12. Before it is returned, the ‘PyModuleDef’ +instance must be initialized with the following function: + + -- C Function: *note PyObject: 334. *PyModuleDef_Init (PyModuleDef + *def) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550. since version 3.5.' Ensures a module definition is a properly + initialized Python object that correctly reports its type and + reference count. + + Returns 'def' cast to ‘PyObject*’, or ‘NULL’ if an error occurred. + + Added in version 3.5. + +The 'm_slots' member of the module definition must point to an array of +‘PyModuleDef_Slot’ structures: + + -- C Type: type PyModuleDef_Slot + + -- C Member: int slot + + A slot ID, chosen from the available values explained below. + + -- C Member: void *value + + Value of the slot, whose meaning depends on the slot ID. + + Added in version 3.5. + +The 'm_slots' array must be terminated by a slot with id 0. + +The available slot types are: + + -- C Macro: Py_mod_create + + Specifies a function that is called to create the module object + itself. The 'value' pointer of this slot must point to a function + of the signature: + + -- C Function: *note PyObject: 334. *create_module (PyObject + *spec, PyModuleDef *def) + + The function receives a *note ModuleSpec: 1e64. instance, as + defined in PEP 451(1), and the module definition. It should return + a new module object, or set an error and return ‘NULL’. + + This function should be kept minimal. In particular, it should not + call arbitrary Python code, as trying to import the same module + again may result in an infinite loop. + + Multiple ‘Py_mod_create’ slots may not be specified in one module + definition. + + If ‘Py_mod_create’ is not specified, the import machinery will + create a normal module object using *note PyModule_New(): 4a31. + The name is taken from 'spec', not the definition, to allow + extension modules to dynamically adjust to their place in the + module hierarchy and be imported under different names through + symlinks, all while sharing a single module definition. + + There is no requirement for the returned object to be an instance + of *note PyModule_Type: 4a34. Any type can be used, as long as it + supports setting and getting import-related attributes. However, + only ‘PyModule_Type’ instances may be returned if the ‘PyModuleDef’ + has non-‘NULL’ ‘m_traverse’, ‘m_clear’, ‘m_free’; non-zero + ‘m_size’; or slots other than ‘Py_mod_create’. + + -- C Macro: Py_mod_exec + + Specifies a function that is called to 'execute' the module. This + is equivalent to executing the code of a Python module: typically, + this function adds classes and constants to the module. The + signature of the function is: + + -- C Function: int exec_module (PyObject *module) + + If multiple ‘Py_mod_exec’ slots are specified, they are processed + in the order they appear in the 'm_slots' array. + + -- C Macro: Py_mod_multiple_interpreters + + Specifies one of the following values: + + -- C Macro: Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED + + The module does not support being imported in subinterpreters. + + -- C Macro: Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED + + The module supports being imported in subinterpreters, but + only when they share the main interpreter’s GIL. (See *note + Isolating Extension Modules: 48be.) + + -- C Macro: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED + + The module supports being imported in subinterpreters, even + when they have their own GIL. (See *note Isolating Extension + Modules: 48be.) + + This slot determines whether or not importing this module in a + subinterpreter will fail. + + Multiple ‘Py_mod_multiple_interpreters’ slots may not be specified + in one module definition. + + If ‘Py_mod_multiple_interpreters’ is not specified, the import + machinery defaults to ‘Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED’. + + Added in version 3.12. + + -- C Macro: Py_mod_gil + + Specifies one of the following values: + + -- C Macro: Py_MOD_GIL_USED + + The module depends on the presence of the global interpreter + lock (GIL), and may access global state without + synchronization. + + -- C Macro: 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: 174. Otherwise, it determines whether or not + importing this module will cause the GIL to be automatically + enabled. See *note Free-threaded CPython: 13f. for more detail. + + Multiple ‘Py_mod_gil’ slots may not be specified in one module + definition. + + If ‘Py_mod_gil’ is not specified, the import machinery defaults to + ‘Py_MOD_GIL_USED’. + + Added in version 3.13. + +See PEP 489(2) for more details on multi-phase initialization. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0451/ + + (2) https://peps.python.org/pep-0489/ + + +File: python.info, Node: Low-level module creation functions, Next: Support functions, Prev: Multi-phase initialization, Up: Initializing C modules + +7.8.6.6 Low-level module creation functions +........................................... + +The following functions are called under the hood when using multi-phase +initialization. They can be used directly, for example when creating +module objects dynamically. Note that both ‘PyModule_FromDefAndSpec’ +and ‘PyModule_ExecDef’ must be called to fully initialize a module. + + -- C Function: *note PyObject: 334. *PyModule_FromDefAndSpec + (PyModuleDef *def, PyObject *spec) + 'Return value: New reference.' Create a new module object, given + the definition in 'def' and the ModuleSpec 'spec'. This behaves + like *note PyModule_FromDefAndSpec2(): ead. with + 'module_api_version' set to ‘PYTHON_API_VERSION’. + + Added in version 3.5. + + -- C Function: *note PyObject: 334. *PyModule_FromDefAndSpec2 + (PyModuleDef *def, PyObject *spec, int module_api_version) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Create a new module object, given the + definition in 'def' and the ModuleSpec 'spec', assuming the API + version 'module_api_version'. If that version does not match the + version of the running interpreter, a *note RuntimeWarning: 1bd. is + emitted. + + Return ‘NULL’ with an exception set on error. + + Note: Most uses of this function should be using *note + PyModule_FromDefAndSpec(): eac. instead; only use this if you + are sure you need it. + + Added in version 3.5. + + -- C Function: int PyModule_ExecDef (PyObject *module, PyModuleDef + *def) + ' Part of the *note Stable ABI: 550. since version 3.7.' Process + any execution slots (*note Py_mod_exec: 97e.) given in 'def'. + + Added in version 3.5. + + -- C Function: int PyModule_SetDocString (PyObject *module, const char + *docstring) + ' Part of the *note Stable ABI: 550. since version 3.7.' Set the + docstring for 'module' to 'docstring'. This function is called + automatically when creating a module from ‘PyModuleDef’, using + either ‘PyModule_Create’ or ‘PyModule_FromDefAndSpec’. + + Added in version 3.5. + + -- C Function: int PyModule_AddFunctions (PyObject *module, PyMethodDef + *functions) + ' Part of the *note Stable ABI: 550. since version 3.7.' Add the + functions from the ‘NULL’ terminated 'functions' array to 'module'. + Refer to the *note PyMethodDef: 14a2. 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’, using either + ‘PyModule_Create’ or ‘PyModule_FromDefAndSpec’. + + Added in version 3.5. + + +File: python.info, Node: Support functions, Prev: Low-level module creation functions, Up: Initializing C modules + +7.8.6.7 Support functions +......................... + +The module initialization function (if using single phase +initialization) or a function called from a module execution slot (if +using multi-phase initialization), can use the following functions to +help initialize the module state: + + -- C Function: int PyModule_AddObjectRef (PyObject *module, const char + *name, PyObject *value) + ' Part of the *note Stable ABI: 550. since version 3.10.' Add an + object to 'module' as 'name'. This is a convenience function which + can be used from the module’s initialization function. + + On success, return ‘0’. On error, raise an exception and return + ‘-1’. + + Example usage: + + 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. + + The example can also be written without checking explicitly if + 'obj' is ‘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; + } + + Note that ‘Py_XDECREF()’ should be used instead of ‘Py_DECREF()’ in + this case, since 'obj' can be ‘NULL’. + + 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(): 4ad1. and *note + PyObject_SetAttr(): 4a68. directly. For more details, see *note + PyUnicode_InternFromString(): 1600, which may be used internally to + create a key object. + + Added in version 3.10. + + -- C Function: int PyModule_Add (PyObject *module, const char *name, + PyObject *value) + ' Part of the *note Stable ABI: 550. since version 3.13.' Similar + to *note PyModule_AddObjectRef(): 360, 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. + + Example usage: + + if (PyModule_Add(module, "spam", PyBytes_FromString(value)) < 0) { + goto error; + } + + Added in version 3.13. + + -- C Function: int PyModule_AddObject (PyObject *module, const char + *name, PyObject *value) + ' Part of the *note Stable ABI: 550.' Similar to *note + PyModule_AddObjectRef(): 360, but steals a reference to 'value' on + success (if it returns ‘0’). + + The new *note PyModule_Add(): 35f. or *note + PyModule_AddObjectRef(): 360. functions are recommended, since it + is easy to introduce reference leaks by misusing the *note + PyModule_AddObject(): 361. function. + + Note: 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(): 78a. 'value' manually on error. + + Example usage: + + 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. + + Deprecated since version 3.13: *note PyModule_AddObject(): 361. is + *note soft deprecated: 20b. + + -- C Function: int PyModule_AddIntConstant (PyObject *module, const + char *name, long value) + ' Part of the *note Stable ABI: 550.' 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(): + 1839. and *note PyModule_AddObjectRef(): 360.; see their + documentation for details. + + -- C Function: int PyModule_AddStringConstant (PyObject *module, const + char *name, const char *value) + ' Part of the *note Stable ABI: 550.' 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(): 1600. and *note + PyModule_AddObjectRef(): 360.; see their documentation for details. + + -- C Macro: 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 Macro: PyModule_AddStringMacro (module, macro) + + Add a string constant to 'module'. + + -- C Function: int PyModule_AddType (PyObject *module, PyTypeObject + *type) + ' Part of the *note Stable ABI: 550. since version 3.10.' Add a + type object to 'module'. The type object is finalized by calling + internally *note PyType_Ready(): 777. The name of the type object + is taken from the last component of *note tp_name: 18f2. after dot. + Return ‘-1’ with an exception set on error, ‘0’ on success. + + Added in version 3.9. + + -- C Function: int PyUnstable_Module_SetGIL (PyObject *module, void + *gil) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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: 158. It must be called during 'module'’s + initialization function. 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: 174. + Return ‘-1’ with an exception set on error, ‘0’ on success. + + Added in version 3.13. + + +File: python.info, Node: Module lookup, Prev: Initializing C modules, Up: Module Objects + +7.8.6.8 Module lookup +..................... + +Single-phase initialization 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. + +These functions will not work on modules created using multi-phase +initialization, since multiple such modules can be created from a single +definition. + + -- C Function: *note PyObject: 334. *PyState_FindModule (PyModuleDef + *def) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Returns the module object that was created from 'def' for + the current interpreter. This method requires that the module + object has been attached to the interpreter state with *note + PyState_AddModule(): 4a83. beforehand. In case the corresponding + module object is not found or has not been attached to the + interpreter state yet, it returns ‘NULL’. + + -- C Function: int PyState_AddModule (PyObject *module, PyModuleDef + *def) + ' Part of the *note Stable ABI: 550. since version 3.3.' Attaches + the module object passed to the function to the interpreter state. + This allows the module object to be accessible via *note + PyState_FindModule(): 4a84. + + Only effective on modules created using single-phase + initialization. + + Python calls ‘PyState_AddModule’ automatically after importing a + module, 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). + + The caller must hold the GIL. + + Return ‘-1’ with an exception set on error, ‘0’ on success. + + Added in version 3.3. + + -- C Function: int PyState_RemoveModule (PyModuleDef *def) + ' Part of the *note Stable ABI: 550. since version 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 hold the GIL. + + Added in version 3.3. + + +File: python.info, Node: Iterator Objects, Next: Descriptor Objects, Prev: Module Objects, Up: Other Objects + +7.8.6.9 Iterator Objects +........................ + +Python provides two general-purpose iterator objects. The first, a +sequence iterator, works with an arbitrary sequence supporting the *note +__getitem__(): 285. method. The second works with a callable object and +a sentinel value, calling the callable for each item in the sequence, +and ending the iteration when the sentinel value is returned. + + -- C Variable: *note PyTypeObject: aa5. PySeqIter_Type + ' Part of the *note Stable ABI: 550.' Type object for iterator + objects returned by *note PySeqIter_New(): 4a6c. and the + one-argument form of the *note iter(): 7d2. built-in function for + built-in sequence types. + + -- C Function: int PySeqIter_Check (PyObject *op) + + Return true if the type of 'op' is *note PySeqIter_Type: 4a6d. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PySeqIter_New (PyObject *seq) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return an iterator that works with a general sequence + object, 'seq'. The iteration ends when the sequence raises *note + IndexError: 14ff. for the subscripting operation. + + -- C Variable: *note PyTypeObject: aa5. PyCallIter_Type + ' Part of the *note Stable ABI: 550.' Type object for iterator + objects returned by *note PyCallIter_New(): 4977. and the + two-argument form of the *note iter(): 7d2. built-in function. + + -- C Function: int PyCallIter_Check (PyObject *op) + + Return true if the type of 'op' is *note PyCallIter_Type: 4978. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PyCallIter_New (PyObject + *callable, PyObject *sentinel) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Return a new iterator. The first parameter, 'callable', can + be any Python callable object that can be called with no + parameters; each call to it should return the next item in the + iteration. When 'callable' returns a value equal to 'sentinel', + the iteration will be terminated. + + +File: python.info, Node: Descriptor Objects, Next: Slice Objects, Prev: Iterator Objects, Up: Other Objects + +7.8.6.10 Descriptor Objects +........................... + +“Descriptors” are objects that describe some attribute of an object. +They are found in the dictionary of type objects. + + -- C Variable: *note PyTypeObject: aa5. PyProperty_Type + ' Part of the *note Stable ABI: 550.' The type object for the + built-in descriptor types. + + -- C Function: *note PyObject: 334. *PyDescr_NewGetSet (PyTypeObject + *type, struct PyGetSetDef *getset) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + -- C Function: *note PyObject: 334. *PyDescr_NewMember (PyTypeObject + *type, struct PyMemberDef *meth) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + -- C Function: *note PyObject: 334. *PyDescr_NewMethod (PyTypeObject + *type, struct PyMethodDef *meth) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + -- C Function: *note PyObject: 334. *PyDescr_NewWrapper (PyTypeObject + *type, struct wrapperbase *wrapper, void *wrapped) + 'Return value: New reference.' + + -- C Function: *note PyObject: 334. *PyDescr_NewClassMethod + (PyTypeObject *type, PyMethodDef *method) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + -- C Function: int PyDescr_IsData (PyObject *descr) + + Return non-zero if the descriptor objects 'descr' describes a data + attribute, or ‘0’ if it describes a method. 'descr' must be a + descriptor object; there is no error checking. + + -- C Function: *note PyObject: 334. *PyWrapper_New (PyObject*, + PyObject*) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' + + +File: python.info, Node: Slice Objects, Next: MemoryView objects, Prev: Descriptor Objects, Up: Other Objects + +7.8.6.11 Slice Objects +...................... + + -- C Variable: *note PyTypeObject: aa5. PySlice_Type + ' Part of the *note Stable ABI: 550.' The type object for slice + objects. This is the same as *note slice: 465. in the Python + layer. + + -- C Function: int PySlice_Check (PyObject *ob) + + Return true if 'ob' is a slice object; 'ob' must not be ‘NULL’. + This function always succeeds. + + -- C Function: *note PyObject: 334. *PySlice_New (PyObject *start, + PyObject *stop, PyObject *step) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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 Function: int PySlice_GetIndices (PyObject *slice, Py_ssize_t + length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) + ' Part of the *note Stable ABI: 550.' Retrieve the start, stop and + step indices from the slice object 'slice', assuming a sequence of + length 'length'. Treats indices greater than 'length' as errors. + + 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). + + You probably do not want to use this function. + + Changed in version 3.2: The parameter type for the 'slice' + parameter was ‘PySliceObject*’ before. + + -- C Function: 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) + ' Part of the *note Stable ABI: 550.' Usable replacement for *note + PySlice_GetIndices(): 4a80. Retrieve the start, stop, and step + indices from the slice object 'slice' assuming a sequence of length + 'length', and store the length of the slice in 'slicelength'. Out + of bounds indices are clipped in a manner consistent with the + handling of normal slices. + + Return ‘0’ on success and ‘-1’ on error with an exception set. + + Note: This function is considered not safe for resizable + sequences. Its invocation should be replaced by a combination + of *note PySlice_Unpack(): 3f9. and *note + PySlice_AdjustIndices(): 3fa. 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); + + Changed in version 3.2: The parameter type for the 'slice' + parameter was ‘PySliceObject*’ before. + + Changed in version 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. + + Deprecated since version 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 Function: int PySlice_Unpack (PyObject *slice, Py_ssize_t *start, + Py_ssize_t *stop, Py_ssize_t *step) + ' Part of the *note Stable ABI: 550. since version 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 Function: *note Py_ssize_t: a5f. PySlice_AdjustIndices (Py_ssize_t + length, Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t step) + ' Part of the *note Stable ABI: 550. since version 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 Object:: + + +File: python.info, Node: Ellipsis Object, Up: Slice Objects + +7.8.6.12 Ellipsis Object +........................ + + -- C Variable: *note PyTypeObject: aa5. PyEllipsis_Type + ' Part of the *note Stable ABI: 550.' The type of Python *note + Ellipsis: 2185. object. Same as *note types.EllipsisType: 84d. in + the Python layer. + + -- C Variable: *note PyObject: 334. *Py_Ellipsis + + The Python ‘Ellipsis’ object. This object has no methods. Like + *note Py_None: 48b9, it is an *note immortal: 4394. singleton + object. + + Changed in version 3.12: *note Py_Ellipsis: 4d34. is immortal. + + +File: python.info, Node: MemoryView objects, Next: Weak Reference Objects<2>, Prev: Slice Objects, Up: Other Objects + +7.8.6.13 MemoryView objects +........................... + +A *note memoryview: 464. object exposes the C level *note buffer +interface: 393. as a Python object which can then be passed around like +any other object. + + -- C Function: *note PyObject: 334. *PyMemoryView_FromObject (PyObject + *obj) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a memoryview object from an object that provides the + buffer interface. If 'obj' supports writable buffer exports, the + memoryview object will be read/write, otherwise it may be either + read-only or read/write at the discretion of the exporter. + + -- C Macro: PyBUF_READ + + Flag to request a readonly buffer. + + -- C Macro: PyBUF_WRITE + + Flag to request a writable buffer. + + -- C Function: *note PyObject: 334. *PyMemoryView_FromMemory (char + *mem, Py_ssize_t size, int flags) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.7.' Create a memoryview object using 'mem' as the + underlying buffer. 'flags' can be one of *note PyBUF_READ: 1690. + or *note PyBUF_WRITE: 1691. + + Added in version 3.3. + + -- C Function: *note PyObject: 334. *PyMemoryView_FromBuffer (const + Py_buffer *view) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.11.' Create a memoryview object wrapping the given + buffer structure 'view'. For simple byte buffers, *note + PyMemoryView_FromMemory(): 1164. is the preferred function. + + -- C Function: *note PyObject: 334. *PyMemoryView_GetContiguous + (PyObject *obj, int buffertype, char order) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a memoryview object to a *note contiguous: 2227. + chunk of memory (in either ‘C’ or ‘F’ortran 'order') from an object + that defines the buffer interface. If memory is contiguous, the + memoryview object points to the original memory. Otherwise, a copy + is made and the memoryview points to a new bytes object. + + 'buffertype' can be one of *note PyBUF_READ: 1690. or *note + PyBUF_WRITE: 1691. + + -- C Function: int PyMemoryView_Check (PyObject *obj) + + Return true if the object 'obj' is a memoryview object. It is not + currently allowed to create subclasses of *note memoryview: 464. + This function always succeeds. + + -- C Function: *note Py_buffer: 753. *PyMemoryView_GET_BUFFER (PyObject + *mview) + + Return a pointer to the memoryview’s private copy of the exporter’s + buffer. 'mview' 'must' be a memoryview instance; this macro + doesn’t check its type, you must do it yourself or you will risk + crashes. + + -- C Function: *note PyObject: 334. *PyMemoryView_GET_BASE (PyObject + *mview) + + Return either a pointer to the exporting object that the memoryview + is based on or ‘NULL’ if the memoryview has been created by one of + the functions *note PyMemoryView_FromMemory(): 1164. or *note + PyMemoryView_FromBuffer(): 75c. 'mview' 'must' be a memoryview + instance. + + +File: python.info, Node: Weak Reference Objects<2>, Next: Capsules<2>, Prev: MemoryView objects, Up: Other Objects + +7.8.6.14 Weak Reference Objects +............................... + +Python supports 'weak references' as first-class objects. There are two +specific object types which directly implement weak references. The +first is a simple reference object, and the second acts as a proxy for +the original object as much as it can. + + -- C Function: int PyWeakref_Check (PyObject *ob) + + Return non-zero if 'ob' is either a reference or proxy object. + This function always succeeds. + + -- C Function: int PyWeakref_CheckRef (PyObject *ob) + + Return non-zero if 'ob' is a reference object. This function + always succeeds. + + -- C Function: int PyWeakref_CheckProxy (PyObject *ob) + + Return non-zero if 'ob' is a proxy object. This function always + succeeds. + + -- C Function: *note PyObject: 334. *PyWeakref_NewRef (PyObject *ob, + PyObject *callback) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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: 534. + + -- C Function: *note PyObject: 334. *PyWeakref_NewProxy (PyObject *ob, + PyObject *callback) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' 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: 534. + + -- C Function: int PyWeakref_GetRef (PyObject *ref, PyObject **pobj) + ' Part of the *note Stable ABI: 550. since version 3.13.' Get a + *note strong reference: 338. to the referenced object from a weak + reference, 'ref', into '*pobj'. + + * On success, set '*pobj' to a new *note strong reference: 338. + 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 Function: *note PyObject: 334. *PyWeakref_GetObject (PyObject + *ref) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Return a *note borrowed reference: 339. to the referenced + object from a weak reference, 'ref'. If the referent is no longer + live, returns ‘Py_None’. + + Note: This function returns a *note borrowed reference: 339. + to the referenced object. This means that you should always + call *note Py_INCREF(): 56b. on the object except when it + cannot be destroyed before the last usage of the borrowed + reference. + + Deprecated since version 3.13, will be removed in version 3.15: Use + *note PyWeakref_GetRef(): 373. instead. + + -- C Function: *note PyObject: 334. *PyWeakref_GET_OBJECT (PyObject + *ref) + 'Return value: Borrowed reference.' Similar to *note + PyWeakref_GetObject(): 374, but does no error checking. + + Deprecated since version 3.13, will be removed in version 3.15: Use + *note PyWeakref_GetRef(): 373. instead. + + -- C Function: void PyObject_ClearWeakRefs (PyObject *object) + ' Part of the *note Stable ABI: 550.' This function is called by + the *note tp_dealloc: 48e8. 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 Function: void PyUnstable_Object_ClearWeakRefsNoCallbacks + (PyObject *object) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Clears the weakrefs for 'object' without calling the callbacks. + + This function is called by the *note tp_dealloc: 48e8. handler for + types with finalizers (i.e., *note __del__(): 1f61.). The handler + for those objects first calls *note PyObject_ClearWeakRefs(): 573. + 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(): 573. to clear weakrefs instead of this + function. + + Added in version 3.13. + + +File: python.info, Node: Capsules<2>, Next: Frame Objects, Prev: Weak Reference Objects<2>, Up: Other Objects + +7.8.6.15 Capsules +................. + +Refer to *note Providing a C API for an Extension Module: 1349. for more +information on using these objects. + +Added in version 3.1. + + -- C Type: type PyCapsule + + This subtype of *note PyObject: 334. represents an opaque value, + useful for C extension modules who 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 Type: type PyCapsule_Destructor + ' Part of the *note Stable ABI: 550.' The type of a destructor + callback for a capsule. Defined as: + + typedef void (*PyCapsule_Destructor)(PyObject *); + + See *note PyCapsule_New(): 48dd. for the semantics of + PyCapsule_Destructor callbacks. + + -- C Function: int PyCapsule_CheckExact (PyObject *p) + + Return true if its argument is a *note PyCapsule: 1266. This + function always succeeds. + + -- C Function: *note PyObject: 334. *PyCapsule_New (void *pointer, + const char *name, PyCapsule_Destructor destructor) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Create a *note PyCapsule: 1266. encapsulating the 'pointer'. + The 'pointer' argument may not be ‘NULL’. + + On failure, set an exception and return ‘NULL’. + + The 'name' string may either be ‘NULL’ or a pointer to a valid C + string. If non-‘NULL’, this string must outlive the capsule. + (Though it is permitted to free it inside the 'destructor'.) + + If the 'destructor' argument is not ‘NULL’, it will be called with + the capsule as its argument when it is destroyed. + + If this capsule will be stored as an attribute of a module, the + 'name' should be specified as ‘modulename.attributename’. This + will enable other modules to import the capsule using *note + PyCapsule_Import(): 186d. + + -- C Function: void *PyCapsule_GetPointer (PyObject *capsule, const + char *name) + ' Part of the *note Stable ABI: 550.' Retrieve the 'pointer' + stored in the capsule. On failure, set an exception and return + ‘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 Function: *note PyCapsule_Destructor: 497a. + PyCapsule_GetDestructor (PyObject *capsule) + ' Part of the *note Stable ABI: 550.' Return the current + destructor stored in the capsule. On failure, set an exception and + return ‘NULL’. + + It is legal for a capsule to have a ‘NULL’ destructor. This makes + a ‘NULL’ return code somewhat ambiguous; use *note + PyCapsule_IsValid(): 1348. or *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: void *PyCapsule_GetContext (PyObject *capsule) + ' Part of the *note Stable ABI: 550.' Return the current context + stored in the capsule. On failure, set an exception and return + ‘NULL’. + + It is legal for a capsule to have a ‘NULL’ context. This makes a + ‘NULL’ return code somewhat ambiguous; use *note + PyCapsule_IsValid(): 1348. or *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: const char *PyCapsule_GetName (PyObject *capsule) + ' Part of the *note Stable ABI: 550.' Return the current name + stored in the capsule. On failure, set an exception and return + ‘NULL’. + + It is legal for a capsule to have a ‘NULL’ name. This makes a + ‘NULL’ return code somewhat ambiguous; use *note + PyCapsule_IsValid(): 1348. or *note PyErr_Occurred(): 18f1. to + disambiguate. + + -- C Function: void *PyCapsule_Import (const char *name, int no_block) + ' Part of the *note Stable ABI: 550.' 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. + + Return the capsule’s internal 'pointer' on success. On failure, + set an exception and return ‘NULL’. + + Note: 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(): 3ba.) for the attribute lookups to + succeed. + + Changed in version 3.3: 'no_block' has no effect anymore. + + -- C Function: int PyCapsule_IsValid (PyObject *capsule, const char + *name) + ' Part of the *note Stable ABI: 550.' Determines whether or not + 'capsule' is a valid capsule. A valid capsule is non-‘NULL’, + passes *note PyCapsule_CheckExact(): 4d42, has a non-‘NULL’ pointer + stored in it, and its internal name matches the 'name' parameter. + (See *note PyCapsule_GetPointer(): 497e. for information on how + capsule names are compared.) + + In other words, if *note PyCapsule_IsValid(): 1348. returns a true + value, calls to any of the accessors (any function starting with + ‘PyCapsule_Get’) are guaranteed to succeed. + + Return a nonzero value if the object is valid and matches the name + passed in. Return ‘0’ otherwise. This function will not fail. + + -- C Function: int PyCapsule_SetContext (PyObject *capsule, void + *context) + ' Part of the *note Stable ABI: 550.' Set the context pointer + inside 'capsule' to 'context'. + + Return ‘0’ on success. Return nonzero and set an exception on + failure. + + -- C Function: int PyCapsule_SetDestructor (PyObject *capsule, + PyCapsule_Destructor destructor) + ' Part of the *note Stable ABI: 550.' Set the destructor inside + 'capsule' to 'destructor'. + + Return ‘0’ on success. Return nonzero and set an exception on + failure. + + -- C Function: int PyCapsule_SetName (PyObject *capsule, const char + *name) + ' Part of the *note Stable ABI: 550.' Set the name inside + 'capsule' to 'name'. If non-‘NULL’, the name must outlive the + capsule. If the previous 'name' stored in the capsule was not + ‘NULL’, no attempt is made to free it. + + Return ‘0’ on success. Return nonzero and set an exception on + failure. + + -- C Function: int PyCapsule_SetPointer (PyObject *capsule, void + *pointer) + ' Part of the *note Stable ABI: 550.' Set the void pointer inside + 'capsule' to 'pointer'. The pointer may not be ‘NULL’. + + Return ‘0’ on success. Return nonzero and set an exception on + failure. + + +File: python.info, Node: Frame Objects, Next: Generator Objects, Prev: Capsules<2>, Up: Other Objects + +7.8.6.16 Frame Objects +...................... + + -- C Type: type PyFrameObject + ' Part of the *note Limited API: 550. (as an opaque struct).' The + C structure of the objects used to describe frame objects. + + There are no public members in this structure. + + Changed in version 3.11: The members of this structure were removed + from the public C API. Refer to the *note What’s New entry: 783. + for details. + +The *note PyEval_GetFrame(): 17bc. and *note PyThreadState_GetFrame(): +789. functions can be used to get a frame object. + +See also *note Reflection: 4b7e. + + -- C Variable: *note PyTypeObject: aa5. PyFrame_Type + + The type of frame objects. It is the same object as *note + types.FrameType: 1851. in the Python layer. + + Changed in version 3.11: Previously, this type was only available + after including ‘<frameobject.h>’. + + -- C Function: int PyFrame_Check (PyObject *obj) + + Return non-zero if 'obj' is a frame object. + + Changed in version 3.11: Previously, this function was only + available after including ‘<frameobject.h>’. + + -- C Function: *note PyFrameObject: 784. *PyFrame_GetBack + (PyFrameObject *frame) + 'Return value: New reference.' Get the 'frame' next outer frame. + + Return a *note strong reference: 338, or ‘NULL’ if 'frame' has no + outer frame. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyFrame_GetBuiltins (PyFrameObject + *frame) + 'Return value: New reference.' Get the 'frame'’s *note f_builtins: + 1f4d. attribute. + + Return a *note strong reference: 338. The result cannot be ‘NULL’. + + Added in version 3.11. + + -- C Function: *note PyCodeObject: 772. *PyFrame_GetCode (PyFrameObject + *frame) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.10.' Get the 'frame' code. + + Return a *note strong reference: 338. + + The result (frame code) cannot be ‘NULL’. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyFrame_GetGenerator + (PyFrameObject *frame) + 'Return value: New reference.' 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: 338, or ‘NULL’. + + Added in version 3.11. + + -- C Function: *note PyObject: 334. *PyFrame_GetGlobals (PyFrameObject + *frame) + 'Return value: New reference.' Get the 'frame'’s *note f_globals: + 1f4c. attribute. + + Return a *note strong reference: 338. The result cannot be ‘NULL’. + + Added in version 3.11. + + -- C Function: int PyFrame_GetLasti (PyFrameObject *frame) + + Get the 'frame'’s *note f_lasti: 886. attribute. + + Returns -1 if ‘frame.f_lasti’ is ‘None’. + + Added in version 3.11. + + -- C Function: *note PyObject: 334. *PyFrame_GetVar (PyFrameObject + *frame, PyObject *name) + 'Return value: New reference.' Get the variable 'name' of 'frame'. + + * Return a *note strong reference: 338. to the variable value on + success. + + * Raise *note NameError: 43a. and return ‘NULL’ if the variable + does not exist. + + * Raise an exception and return ‘NULL’ on error. + + 'name' type must be a *note str: 447. + + Added in version 3.12. + + -- C Function: *note PyObject: 334. *PyFrame_GetVarString + (PyFrameObject *frame, const char *name) + 'Return value: New reference.' Similar to *note PyFrame_GetVar(): + 565, but the variable name is a C string encoded in UTF-8. + + Added in version 3.12. + + -- C Function: *note PyObject: 334. *PyFrame_GetLocals (PyFrameObject + *frame) + 'Return value: New reference.' Get the 'frame'’s *note f_locals: + 182. attribute. If the frame refers to an *note optimized scope: + 17e, this returns a write-through proxy object that allows + modifying the locals. In all other cases (classes, modules, *note + exec(): 17f, *note eval(): 180.) it returns the mapping + representing the frame locals directly (as described for *note + locals(): 141.). + + Return a *note strong reference: 338. + + Added in version 3.11. + + Changed in version 3.13: As part of PEP 667(1), return an instance + of *note PyFrameLocalsProxy_Type: 4d45. + + -- C Function: int PyFrame_GetLineNumber (PyFrameObject *frame) + ' Part of the *note Stable ABI: 550. since version 3.10.' Return + the line number that 'frame' is currently executing. + +* Menu: + +* Frame Locals Proxies:: +* Internal Frames:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0667/ + + +File: python.info, Node: Frame Locals Proxies, Next: Internal Frames, Up: Frame Objects + +7.8.6.17 Frame Locals Proxies +............................. + +Added in version 3.13. + +The *note f_locals: 182. attribute on a *note frame object: 6db. 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 Variable: *note PyTypeObject: aa5. PyFrameLocalsProxy_Type + + The type of frame *note locals(): 141. proxy objects. + + -- C Function: int PyFrameLocalsProxy_Check (PyObject *obj) + + Return non-zero if 'obj' is a frame *note locals(): 141. proxy. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0667/ + + +File: python.info, Node: Internal Frames, Prev: Frame Locals Proxies, Up: Frame Objects + +7.8.6.18 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 Function: *note PyObject: 334. + *PyUnstable_InterpreterFrame_GetCode (struct + _PyInterpreterFrame *frame); + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return a *note strong reference: 338. to the code object for + the frame. + + Added in version 3.12. + + -- C Function: int PyUnstable_InterpreterFrame_GetLasti (struct + _PyInterpreterFrame *frame); + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return the byte offset into the last executed instruction. + + Added in version 3.12. + + -- C Function: int PyUnstable_InterpreterFrame_GetLine (struct + _PyInterpreterFrame *frame); + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + 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: Generator Objects, Next: Coroutine Objects<2>, Prev: Frame Objects, Up: Other Objects + +7.8.6.19 Generator Objects +.......................... + +Generator objects are what Python uses to implement generator iterators. +They are normally created by iterating over a function that yields +values, rather than explicitly calling *note PyGen_New(): 4d50. or *note +PyGen_NewWithQualName(): 4d51. + + -- C Type: type PyGenObject + + The C structure used for generator objects. + + -- C Variable: *note PyTypeObject: aa5. PyGen_Type + + The type object corresponding to generator objects. + + -- C Function: int PyGen_Check (PyObject *ob) + + Return true if 'ob' is a generator object; 'ob' must not be ‘NULL’. + This function always succeeds. + + -- C Function: int PyGen_CheckExact (PyObject *ob) + + Return true if 'ob'’s type is *note PyGen_Type: 4d53.; 'ob' must + not be ‘NULL’. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyGen_New (PyFrameObject *frame) + 'Return value: New reference.' Create and return a new generator + object based on the 'frame' object. A reference to 'frame' is + stolen by this function. The argument must not be ‘NULL’. + + -- C Function: *note PyObject: 334. *PyGen_NewWithQualName + (PyFrameObject *frame, PyObject *name, PyObject *qualname) + 'Return value: New reference.' Create and return a new generator + object based on the 'frame' object, with ‘__name__’ and + ‘__qualname__’ set to 'name' and 'qualname'. A reference to + 'frame' is stolen by this function. The 'frame' argument must not + be ‘NULL’. + + +File: python.info, Node: Coroutine Objects<2>, Next: Context Variables Objects, Prev: Generator Objects, Up: Other Objects + +7.8.6.20 Coroutine Objects +.......................... + +Added in version 3.5. + +Coroutine objects are what functions declared with an ‘async’ keyword +return. + + -- C Type: type PyCoroObject + + The C structure used for coroutine objects. + + -- C Variable: *note PyTypeObject: aa5. PyCoro_Type + + The type object corresponding to coroutine objects. + + -- C Function: int PyCoro_CheckExact (PyObject *ob) + + Return true if 'ob'’s type is *note PyCoro_Type: 4d59.; 'ob' must + not be ‘NULL’. This function always succeeds. + + -- C Function: *note PyObject: 334. *PyCoro_New (PyFrameObject *frame, + PyObject *name, PyObject *qualname) + 'Return value: New reference.' Create and return a new coroutine + object based on the 'frame' object, with ‘__name__’ and + ‘__qualname__’ set to 'name' and 'qualname'. A reference to + 'frame' is stolen by this function. The 'frame' argument must not + be ‘NULL’. + + +File: python.info, Node: Context Variables Objects, Next: DateTime Objects<2>, Prev: Coroutine Objects<2>, Up: Other Objects + +7.8.6.21 Context Variables Objects +.................................. + +Added in version 3.7. + +Changed in version 3.7.1: + + Note: In Python 3.7.1 the signatures of all context variables C + APIs were 'changed' to use *note PyObject: 334. pointers instead of + *note PyContext: 4d5e, *note PyContextVar: 4d5f, and *note + PyContextToken: 4d60, e.g.: + + // in 3.7.0: + PyContext *PyContext_New(void); + + // in 3.7.1+: + PyObject *PyContext_New(void); + + See bpo-34762(1) for more details. + +This section details the public C API for the *note contextvars: 24. +module. + + -- C Type: type PyContext + + The C structure used to represent a *note contextvars.Context: + 15a9. object. + + -- C Type: type PyContextVar + + The C structure used to represent a *note contextvars.ContextVar: + 155d. object. + + -- C Type: type PyContextToken + + The C structure used to represent a *note contextvars.Token: 325b. + object. + + -- C Variable: *note PyTypeObject: aa5. PyContext_Type + + The type object representing the 'context' type. + + -- C Variable: *note PyTypeObject: aa5. PyContextVar_Type + + The type object representing the 'context variable' type. + + -- C Variable: *note PyTypeObject: aa5. PyContextToken_Type + + The type object representing the 'context variable token' type. + +Type-check macros: + + -- C Function: int PyContext_CheckExact (PyObject *o) + + Return true if 'o' is of type *note PyContext_Type: 4d61. 'o' must + not be ‘NULL’. This function always succeeds. + + -- C Function: int PyContextVar_CheckExact (PyObject *o) + + Return true if 'o' is of type *note PyContextVar_Type: 4d62. 'o' + must not be ‘NULL’. This function always succeeds. + + -- C Function: int PyContextToken_CheckExact (PyObject *o) + + Return true if 'o' is of type *note PyContextToken_Type: 4d63. 'o' + must not be ‘NULL’. This function always succeeds. + +Context object management functions: + + -- C Function: *note PyObject: 334. *PyContext_New (void) + 'Return value: New reference.' Create a new empty context object. + Returns ‘NULL’ if an error has occurred. + + -- C Function: *note PyObject: 334. *PyContext_Copy (PyObject *ctx) + 'Return value: New reference.' Create a shallow copy of the passed + 'ctx' context object. Returns ‘NULL’ if an error has occurred. + + -- C Function: *note PyObject: 334. *PyContext_CopyCurrent (void) + 'Return value: New reference.' Create a shallow copy of the + current thread context. Returns ‘NULL’ if an error has occurred. + + -- C Function: int PyContext_Enter (PyObject *ctx) + + Set 'ctx' as the current context for the current thread. Returns + ‘0’ on success, and ‘-1’ on error. + + -- C Function: int PyContext_Exit (PyObject *ctx) + + Deactivate the 'ctx' context and restore the previous context as + the current context for the current thread. Returns ‘0’ on + success, and ‘-1’ on error. + +Context variable functions: + + -- C Function: *note PyObject: 334. *PyContextVar_New (const char + *name, PyObject *def) + 'Return value: New reference.' Create a new ‘ContextVar’ object. + The 'name' parameter is used for introspection and debug purposes. + The 'def' parameter specifies a default value for the context + variable, or ‘NULL’ for no default. If an error has occurred, this + function returns ‘NULL’. + + -- C Function: int PyContextVar_Get (PyObject *var, PyObject + *default_value, PyObject **value) + + Get the value of a context variable. Returns ‘-1’ if an error has + occurred during lookup, and ‘0’ if no error occurred, whether or + not a value was found. + + If the context variable was found, 'value' will be a pointer to it. + If the context variable was 'not' found, 'value' will point to: + + - 'default_value', if not ‘NULL’; + + - the default value of 'var', if not ‘NULL’; + + - ‘NULL’ + + Except for ‘NULL’, the function returns a new reference. + + -- C Function: *note PyObject: 334. *PyContextVar_Set (PyObject *var, + PyObject *value) + 'Return value: New reference.' Set the value of 'var' to 'value' + in the current context. Returns a new token object for this + change, or ‘NULL’ if an error has occurred. + + -- C Function: int PyContextVar_Reset (PyObject *var, PyObject *token) + + Reset the state of the 'var' context variable to that it was in + before *note PyContextVar_Set(): 4d6e. that returned the 'token' + was called. This function returns ‘0’ on success and ‘-1’ on + error. + + ---------- Footnotes ---------- + + (1) https://bugs.python.org/issue?@action=redirect&bpo=34762 + + +File: python.info, Node: DateTime Objects<2>, Next: Objects for Type Hinting, Prev: Context Variables Objects, Up: Other Objects + +7.8.6.22 DateTime Objects +......................... + +Various date and time objects are supplied by the *note datetime: 30. +module. Before using any of these functions, the header file +‘datetime.h’ must be included in your source (note that this is not +included by ‘Python.h’), and the macro ‘PyDateTime_IMPORT’ must be +invoked, usually as part of the module initialisation function. The +macro puts a pointer to a C structure into a static variable, +‘PyDateTimeAPI’, that is used by the following macros. + + -- C Type: type PyDateTime_Date + + This subtype of *note PyObject: 334. represents a Python date + object. + + -- C Type: type PyDateTime_DateTime + + This subtype of *note PyObject: 334. represents a Python datetime + object. + + -- C Type: type PyDateTime_Time + + This subtype of *note PyObject: 334. represents a Python time + object. + + -- C Type: type PyDateTime_Delta + + This subtype of *note PyObject: 334. represents the difference + between two datetime values. + + -- C Variable: *note PyTypeObject: aa5. PyDateTime_DateType + + This instance of *note PyTypeObject: aa5. represents the Python + date type; it is the same object as *note datetime.date: 1cd. in + the Python layer. + + -- C Variable: *note PyTypeObject: aa5. PyDateTime_DateTimeType + + This instance of *note PyTypeObject: aa5. represents the Python + datetime type; it is the same object as *note datetime.datetime: + 1cc. in the Python layer. + + -- C Variable: *note PyTypeObject: aa5. PyDateTime_TimeType + + This instance of *note PyTypeObject: aa5. represents the Python + time type; it is the same object as *note datetime.time: 1ce. in + the Python layer. + + -- C Variable: *note PyTypeObject: aa5. PyDateTime_DeltaType + + This instance of *note PyTypeObject: aa5. represents Python type + for the difference between two datetime values; it is the same + object as *note datetime.timedelta: 9cf. in the Python layer. + + -- C Variable: *note PyTypeObject: aa5. PyDateTime_TZInfoType + + This instance of *note PyTypeObject: aa5. represents the Python + time zone info type; it is the same object as *note + datetime.tzinfo: 5da. in the Python layer. + +Macro for access to the UTC singleton: + + -- C Variable: *note PyObject: 334. *PyDateTime_TimeZone_UTC + + Returns the time zone singleton representing UTC, the same object + as *note datetime.timezone.utc: 610. + + Added in version 3.7. + +Type-check macros: + + -- C Function: int PyDate_Check (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DateType: 4d76. or + a subtype of ‘PyDateTime_DateType’. 'ob' must not be ‘NULL’. This + function always succeeds. + + -- C Function: int PyDate_CheckExact (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DateType: 4d76. + 'ob' must not be ‘NULL’. This function always succeeds. + + -- C Function: int PyDateTime_Check (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DateTimeType: 4d77. + or a subtype of ‘PyDateTime_DateTimeType’. 'ob' must not be + ‘NULL’. This function always succeeds. + + -- C Function: int PyDateTime_CheckExact (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DateTimeType: 4d77. + 'ob' must not be ‘NULL’. This function always succeeds. + + -- C Function: int PyTime_Check (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_TimeType: 4d78. or + a subtype of ‘PyDateTime_TimeType’. 'ob' must not be ‘NULL’. This + function always succeeds. + + -- C Function: int PyTime_CheckExact (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_TimeType: 4d78. + 'ob' must not be ‘NULL’. This function always succeeds. + + -- C Function: int PyDelta_Check (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DeltaType: 4d79. or + a subtype of ‘PyDateTime_DeltaType’. 'ob' must not be ‘NULL’. + This function always succeeds. + + -- C Function: int PyDelta_CheckExact (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_DeltaType: 4d79. + 'ob' must not be ‘NULL’. This function always succeeds. + + -- C Function: int PyTZInfo_Check (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_TZInfoType: 4d7a. + or a subtype of ‘PyDateTime_TZInfoType’. 'ob' must not be ‘NULL’. + This function always succeeds. + + -- C Function: int PyTZInfo_CheckExact (PyObject *ob) + + Return true if 'ob' is of type *note PyDateTime_TZInfoType: 4d7a. + 'ob' must not be ‘NULL’. This function always succeeds. + +Macros to create objects: + + -- C Function: *note PyObject: 334. *PyDate_FromDate (int year, int + month, int day) + 'Return value: New reference.' Return a *note datetime.date: 1cd. + object with the specified year, month and day. + + -- C Function: *note PyObject: 334. *PyDateTime_FromDateAndTime (int + year, int month, int day, int hour, int minute, int second, + int usecond) + 'Return value: New reference.' Return a *note datetime.datetime: + 1cc. object with the specified year, month, day, hour, minute, + second and microsecond. + + -- C Function: *note PyObject: 334. *PyDateTime_FromDateAndTimeAndFold + (int year, int month, int day, int hour, int minute, int + second, int usecond, int fold) + 'Return value: New reference.' Return a *note datetime.datetime: + 1cc. object with the specified year, month, day, hour, minute, + second, microsecond and fold. + + Added in version 3.6. + + -- C Function: *note PyObject: 334. *PyTime_FromTime (int hour, int + minute, int second, int usecond) + 'Return value: New reference.' Return a *note datetime.time: 1ce. + object with the specified hour, minute, second and microsecond. + + -- C Function: *note PyObject: 334. *PyTime_FromTimeAndFold (int hour, + int minute, int second, int usecond, int fold) + 'Return value: New reference.' Return a *note datetime.time: 1ce. + object with the specified hour, minute, second, microsecond and + fold. + + Added in version 3.6. + + -- C Function: *note PyObject: 334. *PyDelta_FromDSU (int days, int + seconds, int useconds) + 'Return value: New reference.' Return a *note datetime.timedelta: + 9cf. object representing the given number of days, seconds and + microseconds. Normalization is performed so that the resulting + number of microseconds and seconds lie in the ranges documented for + *note datetime.timedelta: 9cf. objects. + + -- C Function: *note PyObject: 334. *PyTimeZone_FromOffset (PyObject + *offset) + 'Return value: New reference.' Return a *note datetime.timezone: + 10b5. object with an unnamed fixed offset represented by the + 'offset' argument. + + Added in version 3.7. + + -- C Function: *note PyObject: 334. *PyTimeZone_FromOffsetAndName + (PyObject *offset, PyObject *name) + 'Return value: New reference.' Return a *note datetime.timezone: + 10b5. object with a fixed offset represented by the 'offset' + argument and with tzname 'name'. + + Added in version 3.7. + +Macros to extract fields from date objects. The argument must be an +instance of *note PyDateTime_Date: 4d72, including subclasses (such as +*note PyDateTime_DateTime: 4d73.). The argument must not be ‘NULL’, and +the type is not checked: + + -- C Function: int PyDateTime_GET_YEAR (PyDateTime_Date *o) + + Return the year, as a positive int. + + -- C Function: int PyDateTime_GET_MONTH (PyDateTime_Date *o) + + Return the month, as an int from 1 through 12. + + -- C Function: int PyDateTime_GET_DAY (PyDateTime_Date *o) + + Return the day, as an int from 1 through 31. + +Macros to extract fields from datetime objects. The argument must be an +instance of *note PyDateTime_DateTime: 4d73, including subclasses. The +argument must not be ‘NULL’, and the type is not checked: + + -- C Function: int PyDateTime_DATE_GET_HOUR (PyDateTime_DateTime *o) + + Return the hour, as an int from 0 through 23. + + -- C Function: int PyDateTime_DATE_GET_MINUTE (PyDateTime_DateTime *o) + + Return the minute, as an int from 0 through 59. + + -- C Function: int PyDateTime_DATE_GET_SECOND (PyDateTime_DateTime *o) + + Return the second, as an int from 0 through 59. + + -- C Function: int PyDateTime_DATE_GET_MICROSECOND (PyDateTime_DateTime + *o) + + Return the microsecond, as an int from 0 through 999999. + + -- C Function: int PyDateTime_DATE_GET_FOLD (PyDateTime_DateTime *o) + + Return the fold, as an int from 0 through 1. + + Added in version 3.6. + + -- C Function: *note PyObject: 334. *PyDateTime_DATE_GET_TZINFO + (PyDateTime_DateTime *o) + + Return the tzinfo (which may be ‘None’). + + Added in version 3.10. + +Macros to extract fields from time objects. The argument must be an +instance of *note PyDateTime_Time: 4d74, including subclasses. The +argument must not be ‘NULL’, and the type is not checked: + + -- C Function: int PyDateTime_TIME_GET_HOUR (PyDateTime_Time *o) + + Return the hour, as an int from 0 through 23. + + -- C Function: int PyDateTime_TIME_GET_MINUTE (PyDateTime_Time *o) + + Return the minute, as an int from 0 through 59. + + -- C Function: int PyDateTime_TIME_GET_SECOND (PyDateTime_Time *o) + + Return the second, as an int from 0 through 59. + + -- C Function: int PyDateTime_TIME_GET_MICROSECOND (PyDateTime_Time *o) + + Return the microsecond, as an int from 0 through 999999. + + -- C Function: int PyDateTime_TIME_GET_FOLD (PyDateTime_Time *o) + + Return the fold, as an int from 0 through 1. + + Added in version 3.6. + + -- C Function: *note PyObject: 334. *PyDateTime_TIME_GET_TZINFO + (PyDateTime_Time *o) + + Return the tzinfo (which may be ‘None’). + + Added in version 3.10. + +Macros to extract fields from time delta objects. The argument must be +an instance of *note PyDateTime_Delta: 4d75, including subclasses. The +argument must not be ‘NULL’, and the type is not checked: + + -- C Function: int PyDateTime_DELTA_GET_DAYS (PyDateTime_Delta *o) + + Return the number of days, as an int from -999999999 to 999999999. + + Added in version 3.3. + + -- C Function: int PyDateTime_DELTA_GET_SECONDS (PyDateTime_Delta *o) + + Return the number of seconds, as an int from 0 through 86399. + + Added in version 3.3. + + -- C Function: int PyDateTime_DELTA_GET_MICROSECONDS (PyDateTime_Delta + *o) + + Return the number of microseconds, as an int from 0 through 999999. + + Added in version 3.3. + +Macros for the convenience of modules implementing the DB API: + + -- C Function: *note PyObject: 334. *PyDateTime_FromTimestamp (PyObject + *args) + 'Return value: New reference.' Create and return a new *note + datetime.datetime: 1cc. object given an argument tuple suitable for + passing to *note datetime.datetime.fromtimestamp(): 4e9. + + -- C Function: *note PyObject: 334. *PyDate_FromTimestamp (PyObject + *args) + 'Return value: New reference.' Create and return a new *note + datetime.date: 1cd. object given an argument tuple suitable for + passing to *note datetime.date.fromtimestamp(): 160a. + + +File: python.info, Node: Objects for Type Hinting, Prev: DateTime Objects<2>, Up: Other Objects + +7.8.6.23 Objects for Type Hinting +................................. + +Various built-in types for type hinting are provided. Currently, two +types exist – *note GenericAlias: 6ae. and *note Union: 7bd. Only +‘GenericAlias’ is exposed to C. + + -- C Function: *note PyObject: 334. *Py_GenericAlias (PyObject *origin, + PyObject *args) + ' Part of the *note Stable ABI: 550. since version 3.9.' Create a + *note GenericAlias: 6ae. object. Equivalent to calling the Python + class *note types.GenericAlias: 7e6. The 'origin' and 'args' + arguments set the ‘GenericAlias’‘s ‘__origin__’ and ‘__args__’ + attributes respectively. 'origin' should be a *note PyTypeObject: + aa5.*, and 'args' can be a *note PyTupleObject: 4b52.* or any + ‘PyObject*’. If 'args' passed is not a tuple, a 1-tuple is + automatically constructed and ‘__args__’ is set to ‘(args,)’. + Minimal checking is done for the arguments, so the function will + succeed even if 'origin' is not a type. The ‘GenericAlias’‘s + ‘__parameters__’ attribute is constructed lazily from ‘__args__’. + On failure, an exception is raised and ‘NULL’ is returned. + + Here’s an example of how to make an extension type generic: + + ... + static PyMethodDef my_obj_methods[] = { + // Other methods. + ... + {"__class_getitem__", Py_GenericAlias, METH_O|METH_CLASS, "See PEP 585"} + ... + } + + See also + ........ + + The data model method *note __class_getitem__(): 736. + + Added in version 3.9. + + -- C Variable: *note PyTypeObject: aa5. Py_GenericAliasType + ' Part of the *note Stable ABI: 550. since version 3.9.' The C + type of the object returned by *note Py_GenericAlias(): 4ae0. + Equivalent to *note types.GenericAlias: 7e6. in Python. + + Added in version 3.9. + + +File: python.info, Node: Initialization Finalization and Threads, Next: Python Initialization Configuration, Prev: Concrete Objects Layer, Up: Python/C API Reference Manual + +7.9 Initialization, Finalization, and Threads +============================================= + +See *note Python Initialization Configuration: 3a3. for details on how +to configure the interpreter prior to initialization. + +* Menu: + +* Before Python Initialization:: +* Global configuration variables:: +* Initializing and finalizing the interpreter:: +* Process-wide parameters:: +* Thread State and the Global Interpreter Lock:: +* Sub-interpreter support:: +* Asynchronous Notifications:: +* Profiling and Tracing:: +* Reference tracing:: +* Advanced Debugger Support:: +* Thread Local Storage Support:: +* Synchronization Primitives: Synchronization Primitives<2>. + + +File: python.info, Node: Before Python Initialization, Next: Global configuration variables, Up: Initialization Finalization and Threads + +7.9.1 Before Python Initialization +---------------------------------- + +In an application embedding Python, the *note Py_Initialize(): 8ab. +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: 4da3. + +The following functions can be safely called before Python is +initialized: + + * Functions that initialize the interpreter: + + * *note Py_Initialize(): 8ab. + + * *note Py_InitializeEx(): 4ae7. + + * *note Py_InitializeFromConfig(): 3c1. + + * *note Py_BytesMain(): 9c1. + + * *note Py_Main(): c25. + + * the runtime pre-initialization functions covered in *note + Python Initialization Configuration: 3a3. + + * Configuration functions: + + * *note PyImport_AppendInittab(): 17a3. + + * *note PyImport_ExtendInittab(): 17a4. + + * ‘PyInitFrozenExtensions()’ + + * *note PyMem_SetAllocator(): 588. + + * *note PyMem_SetupDebugHooks(): c6a. + + * *note PyObject_SetArenaAllocator(): 4da4. + + * *note Py_SetProgramName(): 163e. + + * *note Py_SetPythonHome(): 163d. + + * *note PySys_ResetWarnOptions(): 3ab. + + * the configuration functions covered in *note Python + Initialization Configuration: 3a3. + + * Informative functions: + + * *note Py_IsInitialized(): 4950. + + * *note PyMem_GetAllocator(): 4da5. + + * *note PyObject_GetArenaAllocator(): 4da6. + + * *note Py_GetBuildInfo(): 13fd. + + * *note Py_GetCompiler(): 4ae2. + + * *note Py_GetCopyright(): 4ae3. + + * *note Py_GetPlatform(): 4ae4. + + * *note Py_GetVersion(): 4ae5. + + * *note Py_IsInitialized(): 4950. + + * Utilities: + + * *note Py_DecodeLocale(): bc7. + + * the status reporting and utility functions covered in *note + Python Initialization Configuration: 3a3. + + * Memory allocators: + + * *note PyMem_RawMalloc(): 38b. + + * *note PyMem_RawRealloc(): 38d. + + * *note PyMem_RawCalloc(): 38c. + + * *note PyMem_RawFree(): 38e. + + * Synchronization: + + * *note PyMutex_Lock(): 325. + + * *note PyMutex_Unlock(): 326. + + Note: 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(): bc8, + *note Py_GetPath(): 3af, *note Py_GetPrefix(): 3b1, *note + Py_GetExecPrefix(): 3ad, *note Py_GetProgramFullPath(): 3b3, *note + Py_GetPythonHome(): 3b6, *note Py_GetProgramName(): 3b5, *note + PyEval_InitThreads(): 1641, and *note Py_RunMain(): 9c5. + + +File: python.info, Node: Global configuration variables, Next: Initializing and finalizing the interpreter, Prev: Before Python Initialization, Up: Initialization Finalization and Threads + +7.9.2 Global configuration variables +------------------------------------ + +Python has variables for the global configuration to control different +features and options. By default, these flags are controlled by *note +command line options: 1d29. + +When a flag is set by an option, the value of the flag is the number of +times that the option was set. For example, ‘-b’ sets *note +Py_BytesWarningFlag: 3d0. to 1 and ‘-bb’ sets *note Py_BytesWarningFlag: +3d0. to 2. + + -- C Variable: int Py_BytesWarningFlag + + This API is kept for backward compatibility: setting *note + PyConfig.bytes_warning: 3d1. should be used instead, see *note + Python Initialization Configuration: 3a3. + + Issue a warning when comparing *note bytes: 1c2. or *note + bytearray: 53a. with *note str: 447. or *note bytes: 1c2. with + *note int: 259. Issue an error if greater or equal to ‘2’. + + Set by the *note -b: 5df. option. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_DebugFlag + + This API is kept for backward compatibility: setting *note + PyConfig.parser_debug: 3c3. should be used instead, see *note + Python Initialization Configuration: 3a3. + + Turn on parser debugging output (for expert only, depending on + compilation options). + + Set by the *note -d: 1d31. option and the *note PYTHONDEBUG: 1d32. + environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_DontWriteBytecodeFlag + + This API is kept for backward compatibility: setting *note + PyConfig.write_bytecode: 3d7. should be used instead, see *note + Python Initialization Configuration: 3a3. + + If set to non-zero, Python won’t try to write ‘.pyc’ files on the + import of source modules. + + Set by the *note -B: 1399. option and the *note + PYTHONDONTWRITEBYTECODE: 139a. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_FrozenFlag + + This API is kept for backward compatibility: setting *note + PyConfig.pathconfig_warnings: 3d3. should be used instead, see + *note Python Initialization Configuration: 3a3. + + Suppress error messages when calculating the module search path in + *note Py_GetPath(): 3af. + + Private flag used by ‘_freeze_module’ and ‘frozenmain’ programs. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_HashRandomizationFlag + + This API is kept for backward compatibility: setting *note + PyConfig.hash_seed: 3de. and *note PyConfig.use_hash_seed: 3dd. + should be used instead, see *note Python Initialization + Configuration: 3a3. + + Set to ‘1’ if the *note PYTHONHASHSEED: 1076. environment variable + is set to a non-empty string. + + If the flag is non-zero, read the *note PYTHONHASHSEED: 1076. + environment variable to initialize the secret hash seed. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_IgnoreEnvironmentFlag + + This API is kept for backward compatibility: setting *note + PyConfig.use_environment: 3d5. should be used instead, see *note + Python Initialization Configuration: 3a3. + + Ignore all ‘PYTHON*’ environment variables, e.g. *note PYTHONPATH: + 1016. and *note PYTHONHOME: 3b8, that might be set. + + Set by the *note -E: 95d. and *note -I: 95e. options. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_InspectFlag + + This API is kept for backward compatibility: setting *note + PyConfig.inspect: 3cb. should be used instead, see *note Python + Initialization Configuration: 3a3. + + When a script is passed as first argument or the *note -c: 5dc. + option is used, enter interactive mode after executing the script + or the command, even when *note sys.stdin: 539. does not appear to + be a terminal. + + Set by the *note -i: 14a6. option and the *note PYTHONINSPECT: + 14a5. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_InteractiveFlag + + This API is kept for backward compatibility: setting *note + PyConfig.interactive: 3c9. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Set by the *note -i: 14a6. option. + + Deprecated since version 3.12, will be removed in version 3.15. + + -- C Variable: int Py_IsolatedFlag + + This API is kept for backward compatibility: setting *note + PyConfig.isolated: 3e0. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Run Python in isolated mode. In isolated mode *note sys.path: 3b0. + contains neither the script’s directory nor the user’s + site-packages directory. + + Set by the *note -I: 95e. option. + + Added in version 3.4. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_LegacyWindowsFSEncodingFlag + + This API is kept for backward compatibility: setting *note + PyPreConfig.legacy_windows_fs_encoding: 3e2. should be used + instead, see *note Python Initialization Configuration: 3a3. + + 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: + 537. + + Set to ‘1’ if the *note PYTHONLEGACYWINDOWSFSENCODING: 2b1. + environment variable is set to a non-empty string. + + See PEP 529(1) for more details. + + *note Availability: 1d54.: Windows. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_LegacyWindowsStdioFlag + + This API is kept for backward compatibility: setting *note + PyConfig.legacy_windows_stdio: 3a0. should be used instead, see + *note Python Initialization Configuration: 3a3. + + If the flag is non-zero, use *note io.FileIO: 1303. instead of + ‘io._WindowsConsoleIO’ for *note sys: d9. standard streams. + + Set to ‘1’ if the *note PYTHONLEGACYWINDOWSSTDIO: c5b. environment + variable is set to a non-empty string. + + See PEP 528(2) for more details. + + *note Availability: 1d54.: Windows. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_NoSiteFlag + + This API is kept for backward compatibility: setting *note + PyConfig.site_import: 3cf. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Disable the import of the module *note site: c7. and the + site-dependent manipulations of *note sys.path: 3b0. that it + entails. Also disable these manipulations if *note site: c7. is + explicitly imported later (call *note site.main(): 1d36. if you + want them to be triggered). + + Set by the *note -S: 119b. option. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_NoUserSiteDirectory + + This API is kept for backward compatibility: setting *note + PyConfig.user_site_directory: 3d9. should be used instead, see + *note Python Initialization Configuration: 3a3. + + Don’t add the *note user site-packages directory: 1d35. to *note + sys.path: 3b0. + + Set by the *note -s: 1377. and *note -I: 95e. options, and the + *note PYTHONNOUSERSITE: 1378. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_OptimizeFlag + + This API is kept for backward compatibility: setting *note + PyConfig.optimization_level: 3cd. should be used instead, see *note + Python Initialization Configuration: 3a3. + + Set by the *note -O: db4. option and the *note PYTHONOPTIMIZE: + 1d33. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_QuietFlag + + This API is kept for backward compatibility: setting *note + PyConfig.quiet: 3c7. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Don’t display the copyright and version messages even in + interactive mode. + + Set by the *note -q: 1d34. option. + + Added in version 3.2. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_UnbufferedStdioFlag + + This API is kept for backward compatibility: setting *note + PyConfig.buffered_stdio: 3db. should be used instead, see *note + Python Initialization Configuration: 3a3. + + Force the stdout and stderr streams to be unbuffered. + + Set by the *note -u: 19a3. option and the *note PYTHONUNBUFFERED: + 19a4. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + -- C Variable: int Py_VerboseFlag + + This API is kept for backward compatibility: setting *note + PyConfig.verbose: 3c5. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Print a message each time a module is initialized, showing the + place (filename or built-in module) from which it is loaded. If + greater 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. + + Set by the *note -v: 13f0. option and the *note PYTHONVERBOSE: + 1d37. environment variable. + + Deprecated since version 3.12, will be removed in version 3.14. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0529/ + + (2) https://peps.python.org/pep-0528/ + + +File: python.info, Node: Initializing and finalizing the interpreter, Next: Process-wide parameters, Prev: Global configuration variables, Up: Initialization Finalization and Threads + +7.9.3 Initializing and finalizing the interpreter +------------------------------------------------- + + -- C Function: void Py_Initialize () + ' Part of the *note Stable ABI: 550.' + + 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: bc5. for the few + exceptions. + + This initializes the table of loaded modules (‘sys.modules’), and + creates the fundamental modules *note builtins: 12, *note __main__: + 1. and *note sys: d9. It also initializes the module search path + (‘sys.path’). It does not set ‘sys.argv’; use the *note Python + Initialization Configuration: 3a3. API for that. This is a no-op + when called for a second time (without calling *note + Py_FinalizeEx(): d15. first). There is no return value; it is a + fatal error if the initialization fails. + + Use *note Py_InitializeFromConfig(): 3c1. to customize the *note + Python Initialization Configuration: 3a3. + + Note: On Windows, changes the console mode from ‘O_TEXT’ to + ‘O_BINARY’, which will also affect non-Python uses of the + console using the C Runtime. + + -- C Function: void Py_InitializeEx (int initsigs) + ' Part of the *note Stable ABI: 550.' This function works like + *note Py_Initialize(): 8ab. 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(): 3c1. to customize the *note + Python Initialization Configuration: 3a3. + + -- C Function: *note PyStatus: 9ad. Py_InitializeFromConfig (const + PyConfig *config) + + Initialize Python from 'config' configuration, as described in + *note Initialization with PyConfig: 4da9. + + See the *note Python Initialization Configuration: 3a3. section for + details on pre-initializing the interpreter, populating the runtime + configuration structure, and querying the returned status + structure. + + -- C Function: int Py_IsInitialized () + ' Part of the *note Stable ABI: 550.' Return true (nonzero) when + the Python interpreter has been initialized, false (zero) if not. + After *note Py_FinalizeEx(): d15. is called, this returns false + until *note Py_Initialize(): 8ab. is called again. + + -- C Function: int Py_IsFinalizing () + ' Part of the *note Stable ABI: 550. since version 3.13.' Return + true (non-zero) if the main Python interpreter is *note shutting + down: 14e. Return false (zero) otherwise. + + Added in version 3.13. + + -- C Function: int Py_FinalizeEx () + ' Part of the *note Stable ABI: 550. since version 3.6.' Undo all + initializations made by *note Py_Initialize(): 8ab. and subsequent + use of Python/C API functions, and destroy all sub-interpreters + (see *note Py_NewInterpreter(): 17b6. below) that were created and + not yet destroyed since the last call to *note Py_Initialize(): + 8ab. Ideally, this frees all memory allocated by the Python + interpreter. This is a no-op when called for a second time + (without calling *note Py_Initialize(): 8ab. again first). + + Since this is the reverse of *note Py_Initialize(): 8ab, 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(): 9c5. is running. + + Normally the return value is ‘0’. If there were errors during + finalization (flushing buffered data), ‘-1’ is returned. + + This function is provided for a number of reasons. An embedding + application might want to restart Python without having to restart + the application itself. An application that has loaded the Python + interpreter from a dynamically loadable library (or DLL) might want + to free all memory allocated by Python before unloading the DLL. + During a hunt for memory leaks in an application a developer might + want to free all memory allocated by Python before exiting from the + application. + + 'Bugs and caveats:' The destruction of modules and objects in + modules is done in random order; this may cause destructors (*note + __del__(): 1f61. 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. 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(): 8ab. and + *note Py_FinalizeEx(): d15. more than once. + + Raises an *note auditing event: 18ba. + ‘cpython._PySys_ClearAuditHooks’ with no arguments. + + Added in version 3.6. + + -- C Function: void Py_Finalize () + ' Part of the *note Stable ABI: 550.' This is a + backwards-compatible version of *note Py_FinalizeEx(): d15. that + disregards the return value. + + -- C Function: int Py_BytesMain (int argc, char **argv) + ' Part of the *note Stable ABI: 550. since version 3.8.' Similar + to *note Py_Main(): c25. 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 Function: int Py_Main (int argc, wchar_t **argv) + ' Part of the *note Stable ABI: 550.' 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 Command line: 1000. + + 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(): bc7. 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(): 9c5. + + In terms of the CPython runtime configuration APIs documented in + the *note runtime configuration: 3a3. 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(): 8ab, *note + Py_InitializeEx(): 4ae7. or *note Py_InitializeFromConfig(): 3c1. + 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 Function: int Py_RunMain (void) + + Executes the main module in a fully configured CPython runtime. + + Executes the command (*note PyConfig.run_command: 4daa.), the + script (*note PyConfig.run_filename: 4dab.) or the module (*note + PyConfig.run_module: 4dac.) 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: 3cb. 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: d40, or ‘1’ for any other unhandled exception. + + If *note PyConfig.inspect: 3cb. is set (such as when the *note -i: + 14a6. 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: d40, as specified above. + + This function always finalizes the Python interpreter before it + returns. + + See *note Python Configuration: 4dad. for an example of a + customized Python that always runs in isolated mode using *note + Py_RunMain(): 9c5. + + -- C Function: int PyUnstable_AtExit (PyInterpreterState *interp, void + (*func)(void*), void *data) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Register an *note atexit: c. callback for the target interpreter + 'interp'. This is similar to *note Py_AtExit(): 4add, but takes an + explicit interpreter and data pointer for the callback. + + The *note GIL: 159. must be held for 'interp'. + + Added in version 3.13. + + +File: python.info, Node: Process-wide parameters, Next: Thread State and the Global Interpreter Lock, Prev: Initializing and finalizing the interpreter, Up: Initialization Finalization and Threads + +7.9.4 Process-wide parameters +----------------------------- + + -- C Function: void Py_SetProgramName (const wchar_t *name) + ' Part of the *note Stable ABI: 550.' + + This API is kept for backward compatibility: setting *note + PyConfig.program_name: 3c0. should be used instead, see *note + Python Initialization Configuration: 3a3. + + This function should be called before *note Py_Initialize(): 8ab. + is called for the first time, if it is called at all. It tells the + interpreter the value of the ‘argv[0]’ argument to the ‘main()’ + function of the program (converted to wide characters). This is + used by *note Py_GetPath(): 3af. and some other functions below to + find the Python run-time libraries relative to the interpreter + executable. The default value is ‘'python'’. The argument should + point to a zero-terminated wide character string in static storage + whose contents will not change for the duration of the program’s + execution. No code in the Python interpreter will change the + contents of this storage. + + Use *note Py_DecodeLocale(): bc7. to decode a bytes string to get a + wchar_t* string. + + Deprecated since version 3.11. + + -- C Function: wchar_t *Py_GetProgramName () + ' Part of the *note Stable ABI: 550.' Return the program name set + with *note PyConfig.program_name: 3c0, or the default. The + returned string points into static storage; the caller should not + modify its value. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note sys.executable: 3b4. instead. + + -- C Function: wchar_t *Py_GetPrefix () + ' Part of the *note Stable ABI: 550.' Return the 'prefix' for + installed platform-independent files. This is derived through a + number of complicated rules from the program name set with *note + PyConfig.program_name: 3c0. and some environment variables; for + example, if the program name is ‘'/usr/local/bin/python'’, the + prefix is ‘'/usr/local'’. The returned string points into static + storage; the caller should not modify its value. This corresponds + to the ‘prefix’ variable in the top-level ‘Makefile’ and the *note + -prefix: 1d62. argument to the ‘configure’ script at build time. + The value is available to Python code as ‘sys.base_prefix’. It is + only useful on Unix. See also the next function. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note sys.base_prefix: 3eb. instead, or *note sys.prefix: 3b2. if + *note virtual environments: 4331. need to be handled. + + -- C Function: wchar_t *Py_GetExecPrefix () + ' Part of the *note Stable ABI: 550.' Return the 'exec-prefix' for + installed platform-'dependent' files. This is derived through a + number of complicated rules from the program name set with *note + PyConfig.program_name: 3c0. and some environment variables; for + example, if the program name is ‘'/usr/local/bin/python'’, the + exec-prefix is ‘'/usr/local'’. The returned string points into + static storage; the caller should not modify its value. This + corresponds to the ‘exec_prefix’ variable in the top-level + ‘Makefile’ and the ‘--exec-prefix’ argument to the ‘configure’ + script at build time. The value is available to Python code as + ‘sys.base_exec_prefix’. It is only useful on Unix. + + Background: The exec-prefix differs from the prefix when platform + dependent files (such as executables and shared libraries) are + installed in a different directory tree. In a typical + installation, platform dependent files may be installed in the + ‘/usr/local/plat’ subtree while platform independent may be + installed in ‘/usr/local’. + + Generally speaking, a platform is a combination of hardware and + software families, e.g. Sparc machines running the Solaris 2.x + operating system are considered the same platform, but Intel + machines running Solaris 2.x are another platform, and Intel + machines running Linux are yet another platform. Different major + revisions of the same operating system generally also form + different platforms. Non-Unix operating systems are a different + story; the installation strategies on those systems are so + different that the prefix and exec-prefix are meaningless, and set + to the empty string. Note that compiled Python bytecode files are + platform independent (but not independent from the Python version + by which they were compiled!). + + System administrators will know how to configure the ‘mount’ or + ‘automount’ programs to share ‘/usr/local’ between platforms while + having ‘/usr/local/plat’ be a different filesystem for each + platform. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note sys.base_exec_prefix: 3ea. instead, or *note sys.exec_prefix: + 3ae. if *note virtual environments: 4331. need to be handled. + + -- C Function: wchar_t *Py_GetProgramFullPath () + ' Part of the *note Stable ABI: 550.' + + Return the full program name of the Python executable; this is + computed as a side-effect of deriving the default module search + path from the program name (set by *note PyConfig.program_name: + 3c0.). The returned string points into static storage; the caller + should not modify its value. The value is available to Python code + as ‘sys.executable’. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note sys.executable: 3b4. instead. + + -- C Function: wchar_t *Py_GetPath () + ' Part of the *note Stable ABI: 550.' + + Return the default module search path; this is computed from the + program name (set by *note PyConfig.program_name: 3c0.) and some + environment variables. The returned string consists of a series of + directory names separated by a platform dependent delimiter + character. The delimiter character is ‘':'’ on Unix and macOS, + ‘';'’ on Windows. The returned string points into static storage; + the caller should not modify its value. The list *note sys.path: + 3b0. is initialized with this value on interpreter startup; it can + be (and usually is) modified later to change the search path for + loading modules. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note sys.path: 3b0. instead. + + -- C Function: const char *Py_GetVersion () + ' Part of the *note Stable ABI: 550.' Return the version of this + Python interpreter. This is a string that looks something like + + "3.0a5+ (py3k:63103M, May 12 2008, 00:53:55) \n[GCC 4.2.3]" + + The first word (up to the first space character) is the current + Python version; the first characters are the major and minor + version separated by a period. The returned string points into + static storage; the caller should not modify its value. The value + is available to Python code as *note sys.version: 178. + + See also the *note Py_Version: 751. constant. + + -- C Function: const char *Py_GetPlatform () + ' Part of the *note Stable ABI: 550.' + + Return the platform identifier for the current platform. On Unix, + this is formed from the “official” name of the operating system, + converted to lower case, followed by the major revision number; + e.g., for Solaris 2.x, which is also known as SunOS 5.x, the value + is ‘'sunos5'’. On macOS, it is ‘'darwin'’. On Windows, it is + ‘'win'’. The returned string points into static storage; the + caller should not modify its value. The value is available to + Python code as ‘sys.platform’. + + -- C Function: const char *Py_GetCopyright () + ' Part of the *note Stable ABI: 550.' Return the official + copyright string for the current Python version, for example + + ‘'Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam'’ + + The returned string points into static storage; the caller should + not modify its value. The value is available to Python code as + ‘sys.copyright’. + + -- C Function: const char *Py_GetCompiler () + ' Part of the *note Stable ABI: 550.' Return an indication of the + compiler used to build the current Python version, in square + brackets, for example: + + "[GCC 2.7.2.2]" + + The returned string points into static storage; the caller should + not modify its value. The value is available to Python code as + part of the variable ‘sys.version’. + + -- C Function: const char *Py_GetBuildInfo () + ' Part of the *note Stable ABI: 550.' 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" + + The returned string points into static storage; the caller should + not modify its value. The value is available to Python code as + part of the variable ‘sys.version’. + + -- C Function: void PySys_SetArgvEx (int argc, wchar_t **argv, int + updatepath) + ' Part of the *note Stable ABI: 550.' + + This API is kept for backward compatibility: setting *note + PyConfig.argv: 3bf, *note PyConfig.parse_argv: 1928. and *note + PyConfig.safe_path: 76e. should be used instead, see *note Python + Initialization Configuration: 3a3. + + Set *note sys.argv: 1258. based on 'argc' and 'argv'. 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. If this function + fails to initialize *note sys.argv: 1258, a fatal condition is + signalled using *note Py_FatalError(): 983. + + If 'updatepath' is zero, this is all the function does. If + 'updatepath' is non-zero, the function also modifies *note + sys.path: 3b0. according to the following algorithm: + + - If the name of an existing script is passed in ‘argv[0]’, the + absolute path of the directory where the script is located is + prepended to *note sys.path: 3b0. + + - Otherwise (that is, if 'argc' is ‘0’ or ‘argv[0]’ doesn’t + point to an existing file name), an empty string is prepended + to *note sys.path: 3b0, which is the same as prepending the + current working directory (‘"."’). + + Use *note Py_DecodeLocale(): bc7. to decode a bytes string to get a + wchar_t* string. + + See also *note PyConfig.orig_argv: 892. and *note PyConfig.argv: + 3bf. members of the *note Python Initialization Configuration: 3a3. + + Note: 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: 3b0. + themselves if desired. See CVE 2008-5983(1). + + On versions before 3.1.3, you can achieve the same effect by + manually popping the first *note sys.path: 3b0. element after + having called *note PySys_SetArgv(): 1640, for example using: + + PyRun_SimpleString("import sys; sys.path.pop(0)\n"); + + Added in version 3.1.3. + + Deprecated since version 3.11. + + -- C Function: void PySys_SetArgv (int argc, wchar_t **argv) + ' Part of the *note Stable ABI: 550.' This API is kept for + backward compatibility: setting *note PyConfig.argv: 3bf. and *note + PyConfig.parse_argv: 1928. should be used instead, see *note Python + Initialization Configuration: 3a3. + + This function works like *note PySys_SetArgvEx(): 163f. with + 'updatepath' set to ‘1’ unless the ‘python’ interpreter was started + with the *note -I: 95e. + + Use *note Py_DecodeLocale(): bc7. to decode a bytes string to get a + wchar_t* string. + + See also *note PyConfig.orig_argv: 892. and *note PyConfig.argv: + 3bf. members of the *note Python Initialization Configuration: 3a3. + + Changed in version 3.4: The 'updatepath' value depends on *note -I: + 95e. + + Deprecated since version 3.11. + + -- C Function: void Py_SetPythonHome (const wchar_t *home) + ' Part of the *note Stable ABI: 550.' This API is kept for + backward compatibility: setting *note PyConfig.home: 3b7. should be + used instead, see *note Python Initialization Configuration: 3a3. + + Set the default “home” directory, that is, the location of the + standard Python libraries. See *note PYTHONHOME: 3b8. for the + meaning of the argument string. + + The argument should point to a zero-terminated 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(): bc7. to decode a bytes string to get a + wchar_t* string. + + Deprecated since version 3.11. + + -- C Function: wchar_t *Py_GetPythonHome () + ' Part of the *note Stable ABI: 550.' Return the default “home”, + that is, the value set by *note PyConfig.home: 3b7, or the value of + the *note PYTHONHOME: 3b8. environment variable if it is set. + + This function should not be called before *note Py_Initialize(): + 8ab, otherwise it returns ‘NULL’. + + Changed in version 3.10: It now returns ‘NULL’ if called before + *note Py_Initialize(): 8ab. + + Deprecated since version 3.13, will be removed in version 3.15: Get + *note PyConfig.home: 3b7. or *note PYTHONHOME: 3b8. environment + variable instead. + + ---------- Footnotes ---------- + + (1) https://www.cve.org/CVERecord?id=CVE-2008-5983 + + +File: python.info, Node: Thread State and the Global Interpreter Lock, Next: Sub-interpreter support, Prev: Process-wide parameters, Up: Initialization Finalization and Threads + +7.9.5 Thread State and the Global Interpreter Lock +-------------------------------------------------- + +The Python interpreter is not fully thread-safe. In order to support +multi-threaded Python programs, there’s a global lock, called the *note +global interpreter lock: 148. or *note GIL: 159, that must be held by +the current thread before it can safely access Python objects. Without +the lock, even the simplest operations could cause problems in a +multi-threaded program: for example, when two threads simultaneously +increment the reference count of the same object, the reference count +could end up being incremented only once instead of twice. + +Therefore, the rule exists that only the thread that has acquired the +*note GIL: 159. may operate on Python objects or call Python/C API +functions. In order to emulate concurrency of execution, the +interpreter regularly tries to switch threads (see *note +sys.setswitchinterval(): 94a.). The lock is also released around +potentially blocking I/O operations like reading or writing a file, so +that other Python threads can run in the meantime. + +The Python interpreter keeps some thread-specific bookkeeping +information inside a data structure called *note PyThreadState: 788. +There’s also one global variable pointing to the current *note +PyThreadState: 788.: it can be retrieved using *note +PyThreadState_Get(): 36d. + +* Menu: + +* Releasing the GIL from extension code:: +* Non-Python created threads:: +* Cautions about fork(): Cautions about fork. +* High-level API:: +* Low-level API:: + + +File: python.info, Node: Releasing the GIL from extension code, Next: Non-Python created threads, Up: Thread State and the Global Interpreter Lock + +7.9.5.1 Releasing the GIL from extension code +............................................. + +Most extension code manipulating the *note GIL: 159. has the following +simple structure: + + Save the thread state in a local variable. + Release the global interpreter lock. + ... Do some blocking I/O operation ... + Reacquire the global interpreter lock. + Restore the thread state from the local variable. + +This is so common that a pair of macros exists to simplify it: + + Py_BEGIN_ALLOW_THREADS + ... Do some blocking I/O operation ... + Py_END_ALLOW_THREADS + +The *note Py_BEGIN_ALLOW_THREADS: 48d7. macro opens a new block and +declares a hidden local variable; the *note Py_END_ALLOW_THREADS: a8e. +macro closes the block. + +The block above expands to the following code: + + PyThreadState *_save; + + _save = PyEval_SaveThread(); + ... Do some blocking I/O operation ... + PyEval_RestoreThread(_save); + +Here is how these functions work: the global interpreter lock is used to +protect the pointer to the current thread state. When releasing the +lock and saving the thread state, the current thread state pointer must +be retrieved before the lock is released (since another thread could +immediately acquire the lock and store its own thread state in the +global variable). Conversely, when acquiring the lock and restoring the +thread state, the lock must be acquired before storing the thread state +pointer. + + Note: Calling system I/O functions is the most common use case for + releasing the GIL, but it can also be useful before calling + long-running computations which don’t need access to Python + objects, such as compression or cryptographic functions operating + over memory buffers. For example, the standard *note zlib: 133. + and *note hashlib: 68. modules release the GIL when compressing or + hashing data. + + +File: python.info, Node: Non-Python created threads, Next: Cautions about fork, Prev: Releasing the GIL from extension code, Up: Thread State and the Global Interpreter Lock + +7.9.5.2 Non-Python created threads +.................................. + +When threads are created using the dedicated Python APIs (such as the +*note threading: ed. module), a thread state is automatically associated +to them and the code showed above is therefore correct. However, when +threads are created from C (for example by a third-party library with +its own thread management), they don’t hold the GIL, nor is there a +thread state structure for them. + +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 thread state data structure, then acquiring the GIL, and +finally storing their thread state pointer, before you can start using +the Python/C API. When you are done, you should reset the thread state +pointer, release the GIL, and finally free the thread state data +structure. + +The *note PyGILState_Ensure(): 3a7. and *note PyGILState_Release(): 3a8. +functions do all of the above automatically. The typical idiom for +calling into Python from a C thread is: + + PyGILState_STATE gstate; + gstate = PyGILState_Ensure(); + + /* Perform Python actions here. */ + result = CallSomeFunction(); + /* evaluate result or handle exception */ + + /* Release the thread. No Python API allowed beyond this point. */ + PyGILState_Release(gstate); + +Note that the ‘PyGILState_*’ functions assume there is only one global +interpreter (created automatically by *note Py_Initialize(): 8ab.). +Python supports the creation of additional interpreters (using *note +Py_NewInterpreter(): 17b6.), but mixing multiple interpreters and the +‘PyGILState_*’ API is unsupported. + + +File: python.info, Node: Cautions about fork, Next: High-level API, Prev: Non-Python created threads, Up: Thread State and the Global Interpreter Lock + +7.9.5.3 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(): 197. by acquiring the locks it uses internally before the +fork, and releasing them afterwards. In addition, it resets any *note +Lock objects: 310b. in the child. When extending or embedding Python, +there is no way to inform Python of additional (non-Python) locks that +need to be acquired before or reset after a fork. OS facilities such as +‘pthread_atfork()’ would need to be used to accomplish the same thing. +Additionally, when extending or embedding Python, calling ‘fork()’ +directly rather than through *note os.fork(): 197. (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(): 3f7. 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(): +197. does. This means finalizing all other *note PyThreadState: 788. +objects belonging to the current interpreter and all other *note +PyInterpreterState: 8bc. objects. Due to this and the special nature of +the *note “main” interpreter: 584, ‘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: High-level API, Next: Low-level API, Prev: Cautions about fork, Up: Thread State and the Global Interpreter Lock + +7.9.5.4 High-level API +...................... + +These are the most commonly used types and functions when writing C +extension code, or when embedding the Python interpreter: + + -- C Type: type PyInterpreterState + ' Part of the *note Limited API: 550. (as an opaque struct).' This + data structure represents the state shared by a number of + cooperating threads. Threads belonging to the same interpreter + share their module administration and a few other internal items. + There are no public members in this structure. + + Threads belonging to different interpreters initially share + nothing, except process state like available memory, open file + descriptors and such. The global interpreter lock is also shared + by all threads, regardless of to which interpreter they belong. + + -- C Type: type PyThreadState + ' Part of the *note Limited API: 550. (as an opaque struct).' This + data structure represents the state of a single thread. The only + public data member is: + + -- C Member: *note PyInterpreterState: 8bc. *interp + + This thread’s interpreter state. + + -- C Function: void PyEval_InitThreads () + ' Part of the *note Stable ABI: 550.' + + Deprecated function which does nothing. + + In Python 3.6 and older, this function created the GIL if it didn’t + exist. + + Changed in version 3.9: The function now does nothing. + + Changed in version 3.7: This function is now called by *note + Py_Initialize(): 8ab, so you don’t have to call it yourself + anymore. + + Changed in version 3.2: This function cannot be called before *note + Py_Initialize(): 8ab. anymore. + + Deprecated since version 3.9. + + -- C Function: *note PyThreadState: 788. *PyEval_SaveThread () + ' Part of the *note Stable ABI: 550.' Release the global + interpreter lock (if it has been created) and reset the thread + state to ‘NULL’, returning the previous thread state (which is not + ‘NULL’). If the lock has been created, the current thread must + have acquired it. + + -- C Function: void PyEval_RestoreThread (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Acquire the global + interpreter lock (if it has been created) and set the thread state + to 'tstate', which must not be ‘NULL’. If the lock has been + created, the current thread must not have acquired it, otherwise + deadlock ensues. + + Note: Calling this function from a thread when the runtime is + finalizing will terminate the thread, even if the thread was + not created by Python. You can use *note Py_IsFinalizing(): + 355. or *note sys.is_finalizing(): a8f. to check if the + interpreter is in process of being finalized before calling + this function to avoid unwanted termination. + + -- C Function: *note PyThreadState: 788. *PyThreadState_Get () + ' Part of the *note Stable ABI: 550.' Return the current thread + state. The global interpreter lock must be held. When the current + thread state is ‘NULL’, this issues a fatal error (so that the + caller needn’t check for ‘NULL’). + + See also *note PyThreadState_GetUnchecked(): 36c. + + -- C Function: *note PyThreadState: 788. *PyThreadState_GetUnchecked () + + Similar to *note PyThreadState_Get(): 36d, 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 Function: *note PyThreadState: 788. *PyThreadState_Swap + (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Swap the current thread + state with the thread state given by the argument 'tstate', which + may be ‘NULL’. + + The *note GIL: 159. does not need to be held, but will be held upon + returning if 'tstate' is non-‘NULL’. + +The following functions use thread-local storage, and are not compatible +with sub-interpreters: + + -- C Function: PyGILState_STATE PyGILState_Ensure () + ' Part of the *note Stable ABI: 550.' Ensure that the current + thread is ready to call the Python C API regardless of the current + state of Python, or of the global interpreter lock. 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(): 3a8. In + general, other thread-related APIs may be used between *note + PyGILState_Ensure(): 3a7. and *note PyGILState_Release(): 3a8. + 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: 48d7. and *note Py_END_ALLOW_THREADS: a8e. + macros is acceptable. + + The return value is an opaque “handle” to the thread state when + *note PyGILState_Ensure(): 3a7. was called, and must be passed to + *note PyGILState_Release(): 3a8. to ensure Python is left in the + same state. Even though recursive calls are allowed, these handles + 'cannot' be shared - each unique call to *note PyGILState_Ensure(): + 3a7. must save the handle for its call to *note + PyGILState_Release(): 3a8. + + When the function returns, the current thread will hold the GIL and + be able to call arbitrary Python code. Failure is a fatal error. + + Note: Calling this function from a thread when the runtime is + finalizing will terminate the thread, even if the thread was + not created by Python. You can use *note Py_IsFinalizing(): + 355. or *note sys.is_finalizing(): a8f. to check if the + interpreter is in process of being finalized before calling + this function to avoid unwanted termination. + + -- C Function: void PyGILState_Release (PyGILState_STATE) + ' Part of the *note Stable ABI: 550.' 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(): 3a7. call (but generally this state will be + unknown to the caller, hence the use of the GILState API). + + Every call to *note PyGILState_Ensure(): 3a7. must be matched by a + call to *note PyGILState_Release(): 3a8. on the same thread. + + -- C Function: *note PyThreadState: 788. *PyGILState_GetThisThreadState + () + ' Part of the *note Stable ABI: 550.' Get the current thread state + for this thread. May return ‘NULL’ if no GILState API has been + used on the current thread. Note that the main thread always has + such a thread-state, even if no auto-thread-state call has been + made on the main thread. This is mainly a helper/diagnostic + function. + + -- C Function: int PyGILState_Check () + + Return ‘1’ if the current thread is holding the GIL and ‘0’ + otherwise. This function can be called from any thread at any + time. Only if it has had its Python thread state initialized and + currently is holding the GIL will it return ‘1’. This is mainly a + helper/diagnostic function. It can be useful for example in + callback contexts or memory allocation functions when knowing that + the GIL is locked can allow the caller to perform sensitive actions + or otherwise behave differently. + + Added in version 3.4. + +The following macros are normally used without a trailing semicolon; +look for example usage in the Python source distribution. + + -- C Macro: Py_BEGIN_ALLOW_THREADS + ' Part of the *note Stable ABI: 550.' This macro expands to ‘{ + PyThreadState *_save; _save = PyEval_SaveThread();’. Note that it + contains an opening brace; it must be matched with a following + *note Py_END_ALLOW_THREADS: a8e. macro. See above for further + discussion of this macro. + + -- C Macro: Py_END_ALLOW_THREADS + ' Part of the *note Stable ABI: 550.' This macro expands to + ‘PyEval_RestoreThread(_save); }’. Note that it contains a closing + brace; it must be matched with an earlier *note + Py_BEGIN_ALLOW_THREADS: 48d7. macro. See above for further + discussion of this macro. + + -- C Macro: Py_BLOCK_THREADS + ' Part of the *note Stable ABI: 550.' This macro expands to + ‘PyEval_RestoreThread(_save);’: it is equivalent to *note + Py_END_ALLOW_THREADS: a8e. without the closing brace. + + -- C Macro: Py_UNBLOCK_THREADS + ' Part of the *note Stable ABI: 550.' This macro expands to ‘_save + = PyEval_SaveThread();’: it is equivalent to *note + Py_BEGIN_ALLOW_THREADS: 48d7. without the opening brace and + variable declaration. + + +File: python.info, Node: Low-level API, Prev: High-level API, Up: Thread State and the Global Interpreter Lock + +7.9.5.5 Low-level API +..................... + +All of the following functions must be called after *note +Py_Initialize(): 8ab. + +Changed in version 3.7: *note Py_Initialize(): 8ab. now initializes the +*note GIL: 159. + + -- C Function: *note PyInterpreterState: 8bc. *PyInterpreterState_New + () + ' Part of the *note Stable ABI: 550.' Create a new interpreter + state object. The global interpreter lock need not be held, but + may be held if it is necessary to serialize calls to this function. + + Raises an *note auditing event: 18ba. + ‘cpython.PyInterpreterState_New’ with no arguments. + + -- C Function: void PyInterpreterState_Clear (PyInterpreterState + *interp) + ' Part of the *note Stable ABI: 550.' Reset all information in an + interpreter state object. The global interpreter lock must be + held. + + Raises an *note auditing event: 18ba. + ‘cpython.PyInterpreterState_Clear’ with no arguments. + + -- C Function: void PyInterpreterState_Delete (PyInterpreterState + *interp) + ' Part of the *note Stable ABI: 550.' Destroy an interpreter state + object. The global interpreter lock need not be held. The + interpreter state must have been reset with a previous call to + *note PyInterpreterState_Clear(): 41e4. + + -- C Function: *note PyThreadState: 788. *PyThreadState_New + (PyInterpreterState *interp) + ' Part of the *note Stable ABI: 550.' Create a new thread state + object belonging to the given interpreter object. The global + interpreter lock need not be held, but may be held if it is + necessary to serialize calls to this function. + + -- C Function: void PyThreadState_Clear (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Reset all information in a + thread state object. The global interpreter lock must be held. + + Changed in version 3.9: This function now calls the + ‘PyThreadState.on_delete’ callback. Previously, that happened in + *note PyThreadState_Delete(): 199f. + + Changed in version 3.13: The ‘PyThreadState.on_delete’ callback was + removed. + + -- C Function: void PyThreadState_Delete (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Destroy a thread state + object. The global interpreter lock need not be held. The thread + state must have been reset with a previous call to *note + PyThreadState_Clear(): 1621. + + -- C Function: void PyThreadState_DeleteCurrent (void) + + Destroy the current thread state and release the global interpreter + lock. Like *note PyThreadState_Delete(): 199f, the global + interpreter lock must be held. The thread state must have been + reset with a previous call to *note PyThreadState_Clear(): 1621. + + -- C Function: *note PyFrameObject: 784. *PyThreadState_GetFrame + (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550. since version 3.10.' Get the + current frame of the Python thread state 'tstate'. + + Return a *note strong reference: 338. Return ‘NULL’ if no frame is + currently executing. + + See also *note PyEval_GetFrame(): 17bc. + + 'tstate' must not be ‘NULL’. + + Added in version 3.9. + + -- C Function: uint64_t PyThreadState_GetID (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550. since version 3.10.' Get the + unique thread state identifier of the Python thread state 'tstate'. + + 'tstate' must not be ‘NULL’. + + Added in version 3.9. + + -- C Function: *note PyInterpreterState: 8bc. + *PyThreadState_GetInterpreter (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550. since version 3.10.' Get the + interpreter of the Python thread state 'tstate'. + + 'tstate' must not be ‘NULL’. + + Added in version 3.9. + + -- C Function: void PyThreadState_EnterTracing (PyThreadState *tstate) + + Suspend tracing and profiling in the Python thread state 'tstate'. + + Resume them using the *note PyThreadState_LeaveTracing(): 750. + function. + + Added in version 3.11. + + -- C Function: void PyThreadState_LeaveTracing (PyThreadState *tstate) + + Resume tracing and profiling in the Python thread state 'tstate' + suspended by the *note PyThreadState_EnterTracing(): 74f. function. + + See also *note PyEval_SetTrace(): 41d. and *note + PyEval_SetProfile(): 14c8. functions. + + Added in version 3.11. + + -- C Function: *note PyInterpreterState: 8bc. *PyInterpreterState_Get + (void) + ' Part of the *note Stable ABI: 550. since version 3.9.' Get the + current interpreter. + + Issue a fatal error if there no current Python thread state or no + current interpreter. It cannot return NULL. + + The caller must hold the GIL. + + Added in version 3.9. + + -- C Function: int64_t PyInterpreterState_GetID (PyInterpreterState + *interp) + ' Part of the *note Stable ABI: 550. since version 3.7.' Return + the interpreter’s unique ID. If there was any error in doing so + then ‘-1’ is returned and an error is set. + + The caller must hold the GIL. + + Added in version 3.7. + + -- C Function: *note PyObject: 334. *PyInterpreterState_GetDict + (PyInterpreterState *interp) + ' Part of the *note Stable ABI: 550. since version 3.8.' Return a + dictionary in which interpreter-specific data may be stored. If + this function returns ‘NULL’ then no exception has been raised and + the caller should assume no interpreter-specific dict is available. + + This is not a replacement for *note PyModule_GetState(): 980, which + extensions should use to store interpreter-specific state + information. + + Added in version 3.8. + + -- C Function: *note PyObject: 334. + *PyUnstable_InterpreterState_GetMainModule (PyInterpreterState + *interp) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Return a *note strong reference: 338. to the ‘__main__’ *note + module object: 4d09. for the given interpreter. + + The caller must hold the GIL. + + Added in version 3.13. + + -- C Type: typedef *note PyObject: 334. *(*_PyFrameEvalFunction)(*note + PyThreadState: 788. *tstate, *note _PyInterpreterFrame: 4d49. + *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. + + Changed in version 3.9: The function now takes a 'tstate' + parameter. + + Changed in version 3.11: The 'frame' parameter changed from + ‘PyFrameObject*’ to ‘_PyInterpreterFrame*’. + + -- C Function: *note _PyFrameEvalFunction: 771. + _PyInterpreterState_GetEvalFrameFunc (PyInterpreterState + *interp) + + Get the frame evaluation function. + + See the PEP 523(1) “Adding a frame evaluation API to CPython”. + + Added in version 3.9. + + -- C Function: void _PyInterpreterState_SetEvalFrameFunc + (PyInterpreterState *interp, _PyFrameEvalFunction eval_frame) + + Set the frame evaluation function. + + See the PEP 523(2) “Adding a frame evaluation API to CPython”. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyThreadState_GetDict () + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' 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 current thread state is available. If + this function returns ‘NULL’, no exception has been raised and the + caller should assume no current thread state is available. + + -- C Function: int PyThreadState_SetAsyncExc (unsigned long id, + PyObject *exc) + ' Part of the *note Stable ABI: 550.' Asynchronously raise an + exception in a thread. The 'id' argument is the thread id of the + target thread; 'exc' is the exception object to be raised. This + function does not steal any references to 'exc'. To prevent naive + misuse, you must write your own C extension to call this. Must be + called with the GIL held. Returns the number of thread states + modified; this is normally one, but will be zero if the thread id + isn’t found. If 'exc' is ‘NULL’, the pending exception (if any) + for the thread is cleared. This raises no exceptions. + + Changed in version 3.7: The type of the 'id' parameter changed from + long to unsigned long. + + -- C Function: void PyEval_AcquireThread (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Acquire the global + interpreter lock and set the current thread state to 'tstate', + which must not be ‘NULL’. The lock must have been created earlier. + If this thread already has the lock, deadlock ensues. + + Note: Calling this function from a thread when the runtime is + finalizing will terminate the thread, even if the thread was + not created by Python. You can use *note Py_IsFinalizing(): + 355. or *note sys.is_finalizing(): a8f. to check if the + interpreter is in process of being finalized before calling + this function to avoid unwanted termination. + + Changed in version 3.8: Updated to be consistent with *note + PyEval_RestoreThread(): 3a5, *note Py_END_ALLOW_THREADS(): a8e, and + *note PyGILState_Ensure(): 3a7, and terminate the current thread if + called while the interpreter is finalizing. + + *note PyEval_RestoreThread(): 3a5. is a higher-level function which + is always available (even when threads have not been initialized). + + -- C Function: void PyEval_ReleaseThread (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' Reset the current thread + state to ‘NULL’ and release the global interpreter lock. The lock + must have been created earlier and must be held by the current + thread. The 'tstate' argument, which must not be ‘NULL’, is only + used to check that it represents the current thread state — if it + isn’t, a fatal error is reported. + + *note PyEval_SaveThread(): 3a4. is a higher-level function which is + always available (even when threads have not been initialized). + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0523/ + + (2) https://peps.python.org/pep-0523/ + + +File: python.info, Node: Sub-interpreter support, Next: Asynchronous Notifications, Prev: Thread State and the Global Interpreter Lock, Up: Initialization Finalization and Threads + +7.9.6 Sub-interpreter support +----------------------------- + +While in most uses, you will only embed a single Python interpreter, +there are cases where you need to create several independent +interpreters in the same process and perhaps even in the same thread. +Sub-interpreters allow you to do that. + +The “main” interpreter is the first one created when the runtime +initializes. It is usually the only Python interpreter in a process. +Unlike sub-interpreters, the main interpreter has unique process-global +responsibilities like signal handling. It is also responsible for +execution during runtime initialization and is usually the active +interpreter during runtime finalization. The *note +PyInterpreterState_Main(): 4dbb. function returns a pointer to its +state. + +You can switch between sub-interpreters using the *note +PyThreadState_Swap(): 4a92. function. You can create and destroy them +using the following functions: + + -- C Type: type PyInterpreterConfig + + Structure containing most parameters to configure a + sub-interpreter. Its values are used only in *note + Py_NewInterpreterFromConfig(): 457. and never modified by the + runtime. + + Added in version 3.12. + + Structure fields: + + -- C Member: 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: 4dbc. + must be ‘1’ (non-zero). If this is ‘1’ then *note gil: 4dbd. + must not be *note PyInterpreterConfig_OWN_GIL: 4dbe. + + -- C Member: 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: d6. module still works when + fork is disallowed. + + -- C Member: int allow_exec + + If this is ‘0’ then the runtime will not support replacing the + current process via exec (e.g. *note os.execv(): 2b24.) in + any thread where the sub-interpreter is currently active. + Otherwise exec is unrestricted. + + Note that the *note subprocess: d6. module still works when + exec is disallowed. + + -- C Member: int allow_threads + + If this is ‘0’ then the sub-interpreter’s *note threading: ed. + module won’t create threads. Otherwise threads are allowed. + + -- C Member: int allow_daemon_threads + + If this is ‘0’ then the sub-interpreter’s *note threading: ed. + module won’t create daemon threads. Otherwise daemon threads + are allowed (as long as *note allow_threads: 4dc1. is + non-zero). + + -- C Member: 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: + 4d19.) + + This must be ‘1’ (non-zero) if *note use_main_obmalloc: 4395. + is ‘0’. + + -- C Member: int gil + + This determines the operation of the GIL for the + sub-interpreter. It may be one of the following: + + -- C Macro: PyInterpreterConfig_DEFAULT_GIL + + Use the default selection (*note + PyInterpreterConfig_SHARED_GIL: 4dc4.). + + -- C Macro: PyInterpreterConfig_SHARED_GIL + + Use (share) the main interpreter’s GIL. + + -- C Macro: PyInterpreterConfig_OWN_GIL + + Use the sub-interpreter’s own GIL. + + If this is *note PyInterpreterConfig_OWN_GIL: 4dbe. then *note + PyInterpreterConfig.use_main_obmalloc: 4395. must be ‘0’. + + -- C Function: *note PyStatus: 9ad. Py_NewInterpreterFromConfig + (PyThreadState **tstate_p, const PyInterpreterConfig *config) + + Create a new sub-interpreter. This is an (almost) totally separate + environment for the execution of Python code. In particular, the + new interpreter has separate, independent versions of all imported + modules, including the fundamental modules *note builtins: 12, + *note __main__: 1. and *note sys: d9. The table of loaded modules + (‘sys.modules’) and the module search path (‘sys.path’) are also + separate. The new environment has no ‘sys.argv’ variable. It has + new standard I/O stream file objects ‘sys.stdin’, ‘sys.stdout’ and + ‘sys.stderr’ (however these refer to the same underlying file + descriptors). + + The given 'config' controls the options with which the interpreter + is initialized. + + Upon success, 'tstate_p' will be set to the first thread state + created in the new sub-interpreter. This thread state is made in + the current thread state. 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 current + thread state and there may not be a current thread state. + + Like all other Python/C API functions, the global interpreter lock + must be held before calling this function and is still held when it + returns. Likewise a current thread state must be set on entry. On + success, the returned thread state will be set as current. If the + sub-interpreter is created with its own GIL then the GIL of the + calling interpreter will be released. When the function returns, + the new interpreter’s GIL will be held by the current thread and + the previously interpreter’s GIL will remain released here. + + 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: 8bc. values. A read-only + copy of the config may be stored internally on the *note + PyInterpreterState: 8bc. + + Extension modules are shared between (sub-)interpreters as follows: + + * For modules using multi-phase initialization, e.g. *note + PyModule_FromDefAndSpec(): eac, a separate module object is + created and initialized for each interpreter. Only C-level + static and global variables are shared between these module + objects. + + * For modules using single-phase initialization, e.g. *note + PyModule_Create(): 4d0d, 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: 4dc5. 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(): + d15. and *note Py_Initialize(): 8ab.; 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 Function: *note PyThreadState: 788. *Py_NewInterpreter (void) + ' Part of the *note Stable ABI: 550.' + + Create a new sub-interpreter. This is essentially just a wrapper + around *note Py_NewInterpreterFromConfig(): 457. 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 Function: void Py_EndInterpreter (PyThreadState *tstate) + ' Part of the *note Stable ABI: 550.' + + Destroy the (sub-)interpreter represented by the given thread + state. The given thread state must be the current thread state. + See the discussion of thread states below. When the call returns, + the current thread state is ‘NULL’. All thread states associated + with this interpreter are destroyed. The global interpreter lock + used by the target interpreter must be held before calling this + function. No GIL is held when it returns. + + *note Py_FinalizeEx(): d15. will destroy all sub-interpreters that + haven’t been explicitly destroyed at that point. + +* Menu: + +* A Per-Interpreter GIL:: +* Bugs and caveats:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0489/ + + +File: python.info, Node: A Per-Interpreter GIL, Next: Bugs and caveats, Up: Sub-interpreter support + +7.9.6.1 A Per-Interpreter GIL +............................. + +Using *note Py_NewInterpreterFromConfig(): 457. 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).) + +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: 4394. In fact, this has been done for the builtin singletons, +small integers, and a number of other builtin objects. + +If you preserve isolation then you will have access to proper multi-core +computing without the complications that come with free-threading. +Failure to preserve isolation will expose you to the full consequences +of free-threading, including races and hard-to-debug crashes. + +Aside from that, one of the main challenges of using multiple isolated +interpreters is how to communicate between them safely (not break +isolation) and efficiently. The runtime and stdlib do not provide any +standard approach to this yet. A future stdlib module would help +mitigate the effort of preserving isolation and expose effective tools +for communicating (and sharing) data between interpreters. + +Added in version 3.12. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0554/ + + +File: python.info, Node: Bugs and caveats, Prev: A Per-Interpreter GIL, Up: Sub-interpreter support + +7.9.6.2 Bugs and caveats +........................ + +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(): b74. 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. + +Also note that combining this functionality with ‘PyGILState_*’ APIs is +delicate, because these APIs assume a bijection between Python thread +states and OS-level threads, an assumption broken by the presence of +sub-interpreters. It is highly recommended that you don’t switch +sub-interpreters between a pair of matching *note PyGILState_Ensure(): +3a7. and *note PyGILState_Release(): 3a8. calls. Furthermore, +extensions (such as *note ctypes: 2a.) using these APIs to allow calling +of Python code from non-Python created threads will probably be broken +when using sub-interpreters. + + +File: python.info, Node: Asynchronous Notifications, Next: Profiling and Tracing, Prev: Sub-interpreter support, Up: Initialization Finalization and Threads + +7.9.7 Asynchronous Notifications +-------------------------------- + +A mechanism is provided to make asynchronous notifications to the main +interpreter thread. These notifications take the form of a function +pointer and a void pointer argument. + + -- C Function: int Py_AddPendingCall (int (*func)(void*), void *arg) + ' Part of the *note Stable ABI: 550.' Schedule a function to be + called from the main interpreter thread. On success, ‘0’ is + returned and 'func' is queued for being called in the main thread. + On failure, ‘-1’ is returned without setting any exception. + + When successfully queued, 'func' will be 'eventually' called from + the main interpreter thread with the argument 'arg'. It will be + called asynchronously with respect to normally running Python code, + but with both these conditions met: + + * on a *note bytecode: 187. boundary; + + * with the main thread holding the *note global interpreter + lock: 148. ('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 global interpreter lock is + released. + + This function doesn’t need a current thread state to run, and it + doesn’t need the global interpreter lock. + + To call this function in a subinterpreter, the caller must hold the + GIL. Otherwise, the function 'func' can be scheduled to be called + from the wrong interpreter. + + Warning: This is a low-level function, only useful for very + special cases. There is no guarantee that 'func' will be + called as quick as possible. If the main thread is busy + executing a system call, 'func' won’t be called before the + system call returns. This function is generally 'not' + suitable for calling Python code from arbitrary C threads. + Instead, use the *note PyGILState API: 4db2. + + Added in version 3.1. + + Changed in version 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. + + +File: python.info, Node: Profiling and Tracing, Next: Reference tracing, Prev: Asynchronous Notifications, Up: Initialization Finalization and Threads + +7.9.8 Profiling and Tracing +--------------------------- + +The Python interpreter provides some low-level support for attaching +profiling and execution tracing facilities. These are used for +profiling, debugging, and coverage analysis tools. + +This C interface allows the profiling or tracing code to avoid the +overhead of calling through Python-level callable objects, making a +direct C function call instead. The essential attributes of the +facility have not changed; the interface allows trace functions to be +installed per-thread, and the basic events reported to the trace +function are the same as had been reported to the Python-level trace +functions in previous versions. + + -- C Type: typedef int (*Py_tracefunc)(*note PyObject: 334. *obj, *note + PyFrameObject: 784. *frame, int what, *note PyObject: 334. + *arg) + + The type of the trace function registered using *note + PyEval_SetProfile(): 14c8. and *note PyEval_SetTrace(): 41d. 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: 4dcb, *note + PyTrace_EXCEPTION: 4dcc, *note PyTrace_LINE: 4dcd, *note + PyTrace_RETURN: 4dce, *note PyTrace_C_CALL: 4dcf, *note + PyTrace_C_EXCEPTION: 4dd0, *note PyTrace_C_RETURN: 4dd1, or *note + PyTrace_OPCODE: 4dd2, and 'arg' depends on the value of 'what': + + Value of 'what' Meaning of 'arg' + + --------------------------------------------------------------------------------- + + *note PyTrace_CALL: 4dcb. Always *note Py_None: 48b9. + + + *note PyTrace_EXCEPTION: 4dcc. Exception information as returned by + *note sys.exc_info(): 686. + + + *note PyTrace_LINE: 4dcd. Always *note Py_None: 48b9. + + + *note PyTrace_RETURN: 4dce. Value being returned to the caller, or + ‘NULL’ if caused by an exception. + + + *note PyTrace_C_CALL: 4dcf. Function object being called. + + + *note PyTrace_C_EXCEPTION: 4dd0. Function object being called. + + + *note PyTrace_C_RETURN: 4dd1. Function object being called. + + + *note PyTrace_OPCODE: 4dd2. Always *note Py_None: 48b9. + + + -- C Variable: int PyTrace_CALL + + The value of the 'what' parameter to a *note Py_tracefunc: 4dca. + function when a new call to a function or method is being reported, + or a new entry into a generator. Note that the creation of the + iterator for a generator function is not reported as there is no + control transfer to the Python bytecode in the corresponding frame. + + -- C Variable: int PyTrace_EXCEPTION + + The value of the 'what' parameter to a *note Py_tracefunc: 4dca. + 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 receives these events; they are not needed by the + profiler. + + -- C Variable: int PyTrace_LINE + + The value passed as the 'what' parameter to a *note Py_tracefunc: + 4dca. 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: bdb. to '0' on that frame. + + -- C Variable: int PyTrace_RETURN + + The value for the 'what' parameter to *note Py_tracefunc: 4dca. + functions when a call is about to return. + + -- C Variable: int PyTrace_C_CALL + + The value for the 'what' parameter to *note Py_tracefunc: 4dca. + functions when a C function is about to be called. + + -- C Variable: int PyTrace_C_EXCEPTION + + The value for the 'what' parameter to *note Py_tracefunc: 4dca. + functions when a C function has raised an exception. + + -- C Variable: int PyTrace_C_RETURN + + The value for the 'what' parameter to *note Py_tracefunc: 4dca. + functions when a C function has returned. + + -- C Variable: int PyTrace_OPCODE + + The value for the 'what' parameter to *note Py_tracefunc: 4dca. + 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: bdc. to '1' + on the frame. + + -- C Function: 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: 4dcd. + *note PyTrace_OPCODE: 4dd2. and *note PyTrace_EXCEPTION: 4dcc. + + See also the *note sys.setprofile(): 14c9. function. + + The caller must hold the *note GIL: 159. + + -- C Function: void PyEval_SetProfileAllThreads (Py_tracefunc func, + PyObject *obj) + + Like *note PyEval_SetProfile(): 14c8. 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 hold the *note GIL: 159. + + As *note PyEval_SetProfile(): 14c8, this function ignores any + exceptions raised while setting the profile functions in all + threads. + +Added in version 3.12. + + -- C Function: void PyEval_SetTrace (Py_tracefunc func, PyObject *obj) + + Set the tracing function to 'func'. This is similar to *note + PyEval_SetProfile(): 14c8, 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(): 41d. will not + receive *note PyTrace_C_CALL: 4dcf, *note PyTrace_C_EXCEPTION: + 4dd0. or *note PyTrace_C_RETURN: 4dd1. as a value for the 'what' + parameter. + + See also the *note sys.settrace(): 14ca. function. + + The caller must hold the *note GIL: 159. + + -- C Function: void PyEval_SetTraceAllThreads (Py_tracefunc func, + PyObject *obj) + + Like *note PyEval_SetTrace(): 41d. 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 hold the *note GIL: 159. + + As *note PyEval_SetTrace(): 41d, this function ignores any + exceptions raised while setting the trace functions in all threads. + +Added in version 3.12. + + +File: python.info, Node: Reference tracing, Next: Advanced Debugger Support, Prev: Profiling and Tracing, Up: Initialization Finalization and Threads + +7.9.9 Reference tracing +----------------------- + +Added in version 3.13. + + -- C Type: typedef int (*PyRefTracer)(*note PyObject: 334.*, int event, + void *data) + + The type of the trace function registered using *note + PyRefTracer_SetTracer(): 367. The first parameter is a Python + object that has been just created (when 'event' is set to *note + PyRefTracer_CREATE: 4dd5.) or about to be destroyed (when 'event' + is set to *note PyRefTracer_DESTROY: 4dd6.). The 'data' argument + is the opaque pointer that was provided when *note + PyRefTracer_SetTracer(): 367. was called. + +Added in version 3.13. + + -- C Variable: int PyRefTracer_CREATE + + The value for the 'event' parameter to *note PyRefTracer: 4dd4. + functions when a Python object has been created. + + -- C Variable: int PyRefTracer_DESTROY + + The value for the 'event' parameter to *note PyRefTracer: 4dd4. + functions when a Python object has been destroyed. + + -- C Function: int PyRefTracer_SetTracer (PyRefTracer tracer, void + *data) + + Register a reference tracer function. The function will be called + when a new Python has been created or when an object is going to be + destroyed. If 'data' is provided it must be an opaque pointer that + will be provided when the tracer function is called. Return ‘0’ on + success. Set an exception and return ‘-1’ on error. + + Not 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. The GIL + will be held every time the tracer function is called. + + The GIL must be held when calling this function. + +Added in version 3.13. + + -- C Function: *note PyRefTracer: 4dd4. 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(): 367. was called. If no tracer was + registered this function will return NULL and will set the 'data' + pointer to NULL. + + The GIL must be held when calling this function. + +Added in version 3.13. + + +File: python.info, Node: Advanced Debugger Support, Next: Thread Local Storage Support, Prev: Reference tracing, Up: Initialization Finalization and Threads + +7.9.10 Advanced Debugger Support +-------------------------------- + +These functions are only intended to be used by advanced debugging +tools. + + -- C Function: *note PyInterpreterState: 8bc. *PyInterpreterState_Head + () + + Return the interpreter state object at the head of the list of all + such objects. + + -- C Function: *note PyInterpreterState: 8bc. *PyInterpreterState_Main + () + + Return the main interpreter state object. + + -- C Function: *note PyInterpreterState: 8bc. *PyInterpreterState_Next + (PyInterpreterState *interp) + + Return the next interpreter state object after 'interp' from the + list of all such objects. + + -- C Function: *note PyThreadState: 788. *PyInterpreterState_ThreadHead + (PyInterpreterState *interp) + + Return the pointer to the first *note PyThreadState: 788. object in + the list of threads associated with the interpreter 'interp'. + + -- C Function: *note PyThreadState: 788. *PyThreadState_Next + (PyThreadState *tstate) + + Return the next thread state object after 'tstate' from the list of + all such objects belonging to the same *note PyInterpreterState: + 8bc. object. + + +File: python.info, Node: Thread Local Storage Support, Next: Synchronization Primitives<2>, Prev: Advanced Debugger Support, Up: Initialization Finalization and Threads + +7.9.11 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: 154e.). 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. + +The GIL does 'not' need to be held when calling these functions; they +supply their own locking. + +Note that ‘Python.h’ does not include the declaration of the TLS APIs, +you need to include ‘pythread.h’ to use thread-local storage. + + Note: None of these API functions handle memory management on + behalf of the void* values. You need to allocate and deallocate + them yourself. If the void* values happen to be *note PyObject: + 334.*, these functions don’t do refcount operations on them either. + +* Menu: + +* Thread Specific Storage (TSS) API: Thread Specific Storage TSS API. +* Thread Local Storage (TLS) API: Thread Local Storage TLS API. + + +File: python.info, Node: Thread Specific Storage TSS API, Next: Thread Local Storage TLS API, Up: Thread Local Storage Support + +7.9.11.1 Thread Specific Storage (TSS) API +.......................................... + +TSS API is introduced to supersede the use of the existing TLS API +within the CPython interpreter. This API uses a new type *note +Py_tss_t: adf. instead of int to represent thread keys. + +Added in version 3.7. + +See also +........ + +“A New C-API for Thread-Local Storage in CPython” ( PEP 539(1)) + + -- C Type: type Py_tss_t + + This data structure represents the state of a thread key, the + definition of which may depend on the underlying TLS + implementation, and it has an internal field representing the key’s + initialization state. There are no public members in this + structure. + + When *note Py_LIMITED_API: 550. is not defined, static allocation + of this type by *note Py_tss_NEEDS_INIT: 4ddc. is allowed. + + -- C Macro: Py_tss_NEEDS_INIT + + This macro expands to the initializer for *note Py_tss_t: adf. + variables. Note that this macro won’t be defined with *note + Py_LIMITED_API: 550. + +* Menu: + +* Dynamic Allocation:: +* Methods: Methods<2>. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0539/ + + +File: python.info, Node: Dynamic Allocation, Next: Methods<2>, Up: Thread Specific Storage TSS API + +7.9.11.2 Dynamic Allocation +........................... + +Dynamic allocation of the *note Py_tss_t: adf, required in extension +modules built with *note Py_LIMITED_API: 550, where static allocation of +this type is not possible due to its implementation being opaque at +build time. + + -- C Function: *note Py_tss_t: adf. *PyThread_tss_alloc () + ' Part of the *note Stable ABI: 550. since version 3.7.' Return a + value which is the same state as a value initialized with *note + Py_tss_NEEDS_INIT: 4ddc, or ‘NULL’ in the case of dynamic + allocation failure. + + -- C Function: void PyThread_tss_free (Py_tss_t *key) + ' Part of the *note Stable ABI: 550. since version 3.7.' Free the + given 'key' allocated by *note PyThread_tss_alloc(): 401, after + first calling *note PyThread_tss_delete(): 409. to ensure any + associated thread locals have been unassigned. This is a no-op if + the 'key' argument is ‘NULL’. + + Note: A freed key becomes a dangling pointer. You should + reset the key to ‘NULL’. + + +File: python.info, Node: Methods<2>, Prev: Dynamic Allocation, Up: Thread Specific Storage TSS API + +7.9.11.3 Methods +................ + +The parameter 'key' of these functions must not be ‘NULL’. Moreover, +the behaviors of *note PyThread_tss_set(): 405. and *note +PyThread_tss_get(): 407. are undefined if the given *note Py_tss_t: adf. +has not been initialized by *note PyThread_tss_create(): 4a93. + + -- C Function: int PyThread_tss_is_created (Py_tss_t *key) + ' Part of the *note Stable ABI: 550. since version 3.7.' Return a + non-zero value if the given *note Py_tss_t: adf. has been + initialized by *note PyThread_tss_create(): 4a93. + + -- C Function: int PyThread_tss_create (Py_tss_t *key) + ' Part of the *note Stable ABI: 550. since version 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: 4ddc. 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 Function: void PyThread_tss_delete (Py_tss_t *key) + ' Part of the *note Stable ABI: 550. since version 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(): 4a93. This function can be called + repeatedly on the same key – calling it on an already destroyed key + is a no-op. + + -- C Function: int PyThread_tss_set (Py_tss_t *key, void *value) + ' Part of the *note Stable ABI: 550. since version 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 Function: void *PyThread_tss_get (Py_tss_t *key) + ' Part of the *note Stable ABI: 550. since version 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: Thread Local Storage TLS API, Prev: Thread Specific Storage TSS API, Up: Thread Local Storage Support + +7.9.11.4 Thread Local Storage (TLS) API +....................................... + +Deprecated since version 3.7: This API is superseded by *note Thread +Specific Storage (TSS) API: ade. + + Note: 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(): 400. will + return immediately with a failure status, and the other TLS + functions will all be no-ops on such platforms. + +Due to the compatibility problem noted above, this version of the API +should not be used in new code. + + -- C Function: int PyThread_create_key () + ' Part of the *note Stable ABI: 550.' + + -- C Function: void PyThread_delete_key (int key) + ' Part of the *note Stable ABI: 550.' + + -- C Function: int PyThread_set_key_value (int key, void *value) + ' Part of the *note Stable ABI: 550.' + + -- C Function: void *PyThread_get_key_value (int key) + ' Part of the *note Stable ABI: 550.' + + -- C Function: void PyThread_delete_key_value (int key) + ' Part of the *note Stable ABI: 550.' + + -- C Function: void PyThread_ReInitTLS () + ' Part of the *note Stable ABI: 550.' + + +File: python.info, Node: Synchronization Primitives<2>, Prev: Thread Local Storage Support, Up: Initialization Finalization and Threads + +7.9.12 Synchronization Primitives +--------------------------------- + +The C-API provides a basic mutual exclusion lock. + + -- C Type: 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. + + Note: 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 Function: void PyMutex_Lock (PyMutex *m) + + Lock mutex 'm'. If another thread has already locked it, the + calling thread will block until the mutex is unlocked. While + blocked, the thread will temporarily release the *note GIL: 159. if + it is held. + + Added in version 3.13. + + -- C Function: void PyMutex_Unlock (PyMutex *m) + + Unlock mutex 'm'. The mutex must be locked — otherwise, the + function will issue a fatal error. + + Added in version 3.13. + +* Menu: + +* Python Critical Section API:: + + +File: python.info, Node: Python Critical Section API, Up: Synchronization Primitives<2> + +7.9.12.1 Python Critical Section API +.................................... + +The critical section API provides a deadlock avoidance layer on top of +per-object locks for *note free-threaded: 1522. CPython. They are +intended to replace reliance on the *note global interpreter lock: 148, +and are no-ops in versions of Python with the global interpreter lock. + +Critical sections avoid deadlocks by implicitly suspending active +critical sections and releasing the locks during calls to *note +PyEval_SaveThread(): 3a4. When *note PyEval_RestoreThread(): 3a5. is +called, the most recent critical section is resumed, and its locks +reacquired. This means the critical section API provides weaker +guarantees than traditional locks – they are useful because their +behavior is similar to the *note GIL: 159. + +The functions and structs used by the macros are exposed for cases where +C macros are not available. They should only be used as in the given +macro expansions. Note that the sizes and contents of the structures +may change in future Python versions. + + Note: Operations that need to lock two objects at once must use + *note Py_BEGIN_CRITICAL_SECTION2: 4de3. 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. + +Example usage: + + 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: 576. calls *note Py_DECREF: 56c, +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(): 3a4. + + -- C Macro: Py_BEGIN_CRITICAL_SECTION (op) + + Acquires the per-object lock for the object 'op' and begins a + critical section. + + In the free-threaded build, this macro expands to: + + { + PyCriticalSection _py_cs; + PyCriticalSection_Begin(&_py_cs, (PyObject*)(op)) + + In the default build, this macro expands to ‘{’. + + Added in version 3.13. + + -- C Macro: Py_END_CRITICAL_SECTION () + + Ends the critical section and releases the per-object lock. + + In the free-threaded build, this macro expands to: + + PyCriticalSection_End(&_py_cs); + } + + In the default build, this macro expands to ‘}’. + + Added in version 3.13. + + -- C Macro: Py_BEGIN_CRITICAL_SECTION2 (a, b) + + Acquires the per-objects locks for the objects 'a' and 'b' and + begins a critical section. The locks are acquired in a consistent + order (lowest address first) to avoid lock ordering deadlocks. + + In the free-threaded build, this macro expands to: + + { + PyCriticalSection2 _py_cs2; + PyCriticalSection2_Begin(&_py_cs2, (PyObject*)(a), (PyObject*)(b)) + + In the default build, this macro expands to ‘{’. + + Added in version 3.13. + + -- C Macro: Py_END_CRITICAL_SECTION2 () + + Ends the critical section and releases the per-object locks. + + In the free-threaded build, this macro expands to: + + PyCriticalSection2_End(&_py_cs2); + } + + In the default build, this macro expands to ‘}’. + + Added in version 3.13. + + +File: python.info, Node: Python Initialization Configuration, Next: Memory Management, Prev: Initialization Finalization and Threads, Up: Python/C API Reference Manual + +7.10 Python Initialization Configuration +======================================== + +Added in version 3.8. + +Python can be initialized with *note Py_InitializeFromConfig(): 3c1. and +the *note PyConfig: 3a2. structure. It can be preinitialized with *note +Py_PreInitialize(): 3e7. and the *note PyPreConfig: 9ac. structure. + +There are two kinds of configuration: + + * The *note Python Configuration: 4dad. can be used to build a + customized Python which behaves as the regular Python. For + example, environment variables and command line arguments are used + to configure Python. + + * The *note Isolated Configuration: 4de8. 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. + +The *note Py_RunMain(): 9c5. function can be used to write a customized +Python program. + +See also *note Initialization, Finalization, and Threads: 4da0. + +See also +........ + +PEP 587(1) “Python Initialization Configuration”. + +* Menu: + +* Example: Example<17>. +* PyWideStringList:: +* PyStatus:: +* PyPreConfig:: +* Preinitialize Python with PyPreConfig:: +* PyConfig:: +* Initialization with PyConfig:: +* Isolated Configuration:: +* Python Configuration:: +* Python Path Configuration:: +* Py_GetArgcArgv(): Py_GetArgcArgv. +* Multi-Phase Initialization Private Provisional API:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0587/ + + +File: python.info, Node: Example<17>, Next: PyWideStringList, Up: Python Initialization Configuration + +7.10.1 Example +-------------- + +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: Example<17>, Up: Python Initialization Configuration + +7.10.2 PyWideStringList +----------------------- + + -- C Type: type PyWideStringList + + List of ‘wchar_t*’ strings. + + If 'length' is non-zero, 'items' must be non-‘NULL’ and all strings + must be non-‘NULL’. + + Methods: + + -- C Function: *note PyStatus: 9ad. PyWideStringList_Append + (PyWideStringList *list, const wchar_t *item) + + Append 'item' to 'list'. + + Python must be preinitialized to call this function. + + -- C Function: *note PyStatus: 9ad. PyWideStringList_Insert + (PyWideStringList *list, Py_ssize_t index, const wchar_t + *item) + + Insert 'item' into 'list' at 'index'. + + If 'index' is greater than or equal to 'list' length, append + 'item' to 'list'. + + 'index' must be greater than or equal to ‘0’. + + Python must be preinitialized to call this function. + + Structure fields: + + -- C Member: *note Py_ssize_t: a5f. length + + List length. + + -- C Member: wchar_t **items + + List items. + + +File: python.info, Node: PyStatus, Next: PyPreConfig, Prev: PyWideStringList, Up: Python Initialization Configuration + +7.10.3 PyStatus +--------------- + + -- C Type: type PyStatus + + Structure to store an initialization function status: success, + error or exit. + + For an error, it can store the C function name which created the + error. + + Structure fields: + + -- C Member: int exitcode + + Exit code. Argument passed to ‘exit()’. + + -- C Member: const char *err_msg + + Error message. + + -- C Member: const char *func + + Name of the function which created an error, can be ‘NULL’. + + Functions to create a status: + + -- C Function: *note PyStatus: 9ad. PyStatus_Ok (void) + + Success. + + -- C Function: *note PyStatus: 9ad. PyStatus_Error (const char + *err_msg) + + Initialization error with a message. + + 'err_msg' must not be ‘NULL’. + + -- C Function: *note PyStatus: 9ad. PyStatus_NoMemory (void) + + Memory allocation failure (out of memory). + + -- C Function: *note PyStatus: 9ad. PyStatus_Exit (int exitcode) + + Exit Python with the specified exit code. + + Functions to handle a status: + + -- C Function: 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(): + 9c2. for example. + + -- C Function: int PyStatus_IsError (PyStatus status) + + Is the result an error? + + -- C Function: int PyStatus_IsExit (PyStatus status) + + Is the result an exit? + + -- C Function: 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. + + Note: Internally, Python uses macros which set ‘PyStatus.func’, + whereas functions to create a status set ‘func’ to ‘NULL’. + +Example: + + 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: Python Initialization Configuration + +7.10.4 PyPreConfig +------------------ + + -- C Type: type PyPreConfig + + Structure used to preinitialize Python. + + Function to initialize a preconfiguration: + + -- C Function: void PyPreConfig_InitPythonConfig (PyPreConfig + *preconfig) + + Initialize the preconfiguration with *note Python + Configuration: 4dad. + + -- C Function: void PyPreConfig_InitIsolatedConfig (PyPreConfig + *preconfig) + + Initialize the preconfiguration with *note Isolated + Configuration: 4de8. + + Structure fields: + + -- C Member: 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: 1d50. + + * ‘PYMEM_ALLOCATOR_DEBUG’ (‘2’): *note default memory + allocators: 1d50. with *note debug hooks: 1d53. + + * ‘PYMEM_ALLOCATOR_MALLOC’ (‘3’): use ‘malloc()’ of the C + library. + + * ‘PYMEM_ALLOCATOR_MALLOC_DEBUG’ (‘4’): force usage of + ‘malloc()’ with *note debug hooks: 1d53. + + * ‘PYMEM_ALLOCATOR_PYMALLOC’ (‘5’): *note Python pymalloc + memory allocator: d0f. + + * ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ (‘6’): *note Python + pymalloc memory allocator: d0f. with *note debug hooks: + 1d53. + + * ‘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: 1d53. + + ‘PYMEM_ALLOCATOR_PYMALLOC’ and + ‘PYMEM_ALLOCATOR_PYMALLOC_DEBUG’ are not supported if Python + is *note configured using -without-pymalloc: 1db0. + + ‘PYMEM_ALLOCATOR_MIMALLOC’ and + ‘PYMEM_ALLOCATOR_MIMALLOC_DEBUG’ are not supported if Python + is *note configured using -without-mimalloc: 1daf. or if the + underlying atomic support isn’t available. + + See *note Memory Management: 4df3. + + Default: ‘PYMEM_ALLOCATOR_NOT_SET’. + + -- C Member: int configure_locale + + Set the LC_CTYPE locale to the user preferred locale. + + If equals to ‘0’, set *note coerce_c_locale: 4df5. and *note + coerce_c_locale_warn: 4df6. members to ‘0’. + + See the *note locale encoding: 244. + + Default: ‘1’ in Python config, ‘0’ in isolated config. + + -- C Member: 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: 244. + + Default: ‘-1’ in Python config, ‘0’ in isolated config. + + -- C Member: 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 Member: int dev_mode + + *note Python Development Mode: 1fa.: see *note + PyConfig.dev_mode: 4df8. + + Default: ‘-1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: int isolated + + Isolated mode: see *note PyConfig.isolated: 3e0. + + Default: ‘0’ in Python mode, ‘1’ in isolated mode. + + -- C Member: int legacy_windows_fs_encoding + + If non-zero: + + * Set *note PyPreConfig.utf8_mode: 3e6. to ‘0’, + + * Set *note PyConfig.filesystem_encoding: 3e4. to ‘"mbcs"’, + + * Set *note PyConfig.filesystem_errors: 3e5. to + ‘"replace"’. + + Initialized from the *note PYTHONLEGACYWINDOWSFSENCODING: 2b1. + environment variable value. + + Only available on Windows. ‘#ifdef MS_WINDOWS’ macro can be + used for Windows specific code. + + Default: ‘0’. + + -- C Member: int parse_argv + + If non-zero, *note Py_PreInitializeFromArgs(): 9c3. and *note + Py_PreInitializeFromBytesArgs(): 9c4. parse their ‘argv’ + argument the same way the regular Python parses command line + arguments: see *note Command Line Arguments: 1000. + + Default: ‘1’ in Python config, ‘0’ in isolated config. + + -- C Member: int use_environment + + Use *note environment variables: 5ed.? See *note + PyConfig.use_environment: 3d5. + + Default: ‘1’ in Python config and ‘0’ in isolated config. + + -- C Member: int utf8_mode + + If non-zero, enable the *note Python UTF-8 Mode: 652. + + Set to ‘0’ or ‘1’ by the *note -X utf8: 176. command line + option and the *note PYTHONUTF8: ad8. environment variable. + + Also set to ‘1’ if the ‘LC_CTYPE’ locale is ‘C’ or ‘POSIX’. + + Default: ‘-1’ in Python config and ‘0’ in isolated config. + + +File: python.info, Node: Preinitialize Python with PyPreConfig, Next: PyConfig, Prev: PyPreConfig, Up: Python Initialization Configuration + +7.10.5 Preinitialize Python with PyPreConfig +-------------------------------------------- + +The preinitialization of Python: + + * Set the Python memory allocators (*note PyPreConfig.allocator: + 4df2.) + + * Configure the LC_CTYPE locale (*note locale encoding: 244.) + + * Set the *note Python UTF-8 Mode: 652. (*note PyPreConfig.utf8_mode: + 3e6.) + +The current preconfiguration (‘PyPreConfig’ type) is stored in +‘_PyRuntime.preconfig’. + +Functions to preinitialize Python: + + -- C Function: *note PyStatus: 9ad. Py_PreInitialize (const PyPreConfig + *preconfig) + + Preinitialize Python from 'preconfig' preconfiguration. + + 'preconfig' must not be ‘NULL’. + + -- C Function: *note PyStatus: 9ad. 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: 4dfa. of 'preconfig' is non-zero. + + 'preconfig' must not be ‘NULL’. + + -- C Function: *note PyStatus: 9ad. 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: 4dfa. of 'preconfig' is non-zero. + + 'preconfig' must not be ‘NULL’. + +The caller is responsible to handle exceptions (error or exit) using +*note PyStatus_Exception(): 9b9. and *note Py_ExitStatusException(): +9c2. + +For *note Python Configuration: 4dad. (*note +PyPreConfig_InitPythonConfig(): 9b7.), 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: 176. +command line option enables the *note Python UTF-8 Mode: 652. + +‘PyMem_SetAllocator()’ can be called after *note Py_PreInitialize(): +3e7. and before *note Py_InitializeFromConfig(): 3c1. to install a +custom memory allocator. It can be called before *note +Py_PreInitialize(): 3e7. if *note PyPreConfig.allocator: 4df2. is set to +‘PYMEM_ALLOCATOR_NOT_SET’. + +Python memory allocation functions like *note PyMem_RawMalloc(): 38b. +must not be used before the Python preinitialization, whereas calling +directly ‘malloc()’ and ‘free()’ is always safe. *note +Py_DecodeLocale(): bc7. must not be called before the Python +preinitialization. + +Example using the preinitialization to enable the *note Python UTF-8 +Mode: 652.: + + 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: Python Initialization Configuration + +7.10.6 PyConfig +--------------- + + -- C Type: type PyConfig + + Structure containing most parameters to configure Python. + + When done, the *note PyConfig_Clear(): 9af. function must be used + to release the configuration memory. + + Structure methods: + + -- C Function: void PyConfig_InitPythonConfig (PyConfig *config) + + Initialize configuration with the *note Python Configuration: + 4dad. + + -- C Function: void PyConfig_InitIsolatedConfig (PyConfig *config) + + Initialize configuration with the *note Isolated + Configuration: 4de8. + + -- C Function: *note PyStatus: 9ad. 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: 3d40. if needed. + + -- C Function: *note PyStatus: 9ad. PyConfig_SetBytesString + (PyConfig *config, wchar_t *const *config_str, const char + *str) + + Decode 'str' using *note Py_DecodeLocale(): bc7. and set the + result into ‘*config_str’. + + *note Preinitialize Python: 3d40. if needed. + + -- C Function: *note PyStatus: 9ad. PyConfig_SetArgv (PyConfig + *config, int argc, wchar_t *const *argv) + + Set command line arguments (*note argv: 3bf. member of + 'config') from the 'argv' list of wide character strings. + + *note Preinitialize Python: 3d40. if needed. + + -- C Function: *note PyStatus: 9ad. PyConfig_SetBytesArgv + (PyConfig *config, int argc, char *const *argv) + + Set command line arguments (*note argv: 3bf. member of + 'config') from the 'argv' list of bytes strings. Decode bytes + using *note Py_DecodeLocale(): bc7. + + *note Preinitialize Python: 3d40. if needed. + + -- C Function: *note PyStatus: 9ad. 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: 3d40. if needed. + + -- C Function: *note PyStatus: 9ad. PyConfig_Read (PyConfig + *config) + + Read all Python configuration. + + Fields which are already initialized are left unchanged. + + Fields for *note path configuration: 8ac. are no longer + calculated or modified when calling this function, as of + Python 3.11. + + The *note PyConfig_Read(): 78b. function only parses *note + PyConfig.argv: 3bf. arguments once: *note PyConfig.parse_argv: + 1928. is set to ‘2’ after arguments are parsed. Since Python + arguments are stripped from *note PyConfig.argv: 3bf, parsing + arguments twice would parse the application options as Python + options. + + *note Preinitialize Python: 3d40. if needed. + + Changed in version 3.10: The *note PyConfig.argv: 3bf. + arguments are now only parsed once, *note PyConfig.parse_argv: + 1928. is set to ‘2’ after arguments are parsed, and arguments + are only parsed if *note PyConfig.parse_argv: 1928. equals + ‘1’. + + Changed in version 3.11: *note PyConfig_Read(): 78b. no longer + calculates all paths, and so fields listed under *note Python + Path Configuration: 8ac. may no longer be updated until *note + Py_InitializeFromConfig(): 3c1. is called. + + -- C Function: void PyConfig_Clear (PyConfig *config) + + Release configuration memory. + + Most ‘PyConfig’ methods *note preinitialize Python: 3d40. if + needed. In that case, the Python preinitialization configuration + (*note PyPreConfig: 9ac.) in based on the *note PyConfig: 3a2. If + configuration fields which are in common with *note PyPreConfig: + 9ac. are tuned, they must be set before calling a *note PyConfig: + 3a2. method: + + * *note PyConfig.dev_mode: 4df8. + + * *note PyConfig.isolated: 3e0. + + * *note PyConfig.parse_argv: 1928. + + * *note PyConfig.use_environment: 3d5. + + Moreover, if *note PyConfig_SetArgv(): 9b2. or *note + PyConfig_SetBytesArgv(): 9b3. is used, this method must be called + before other methods, since the preinitialization configuration + depends on command line arguments (if *note parse_argv: 1928. is + non-zero). + + The caller of these methods is responsible to handle exceptions + (error or exit) using ‘PyStatus_Exception()’ and + ‘Py_ExitStatusException()’. + + Structure fields: + + -- C Member: *note PyWideStringList: 9ae. argv + + Set *note sys.argv: 1258. command line arguments based on + *note argv: 3bf. These parameters are similar to those passed + to the program’s ‘main()’ function with the difference that + the first entry should refer to the script file to be executed + rather than the executable hosting the Python interpreter. If + there isn’t a script that will be run, the first entry in + *note argv: 3bf. can be an empty string. + + Set *note parse_argv: 1928. to ‘1’ to parse *note argv: 3bf. + the same way the regular Python parses Python command line + arguments and then to strip Python arguments from *note argv: + 3bf. + + If *note argv: 3bf. is empty, an empty string is added to + ensure that *note sys.argv: 1258. always exists and is never + empty. + + Default: ‘NULL’. + + See also the *note orig_argv: 892. member. + + -- C Member: int safe_path + + If equals to zero, ‘Py_RunMain()’ prepends a potentially + unsafe path to *note sys.path: 3b0. at startup: + + * If *note argv[0]: 3bf. 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: 5a0. command line option and the + *note PYTHONSAFEPATH: 5a1. environment variable. + + Default: ‘0’ in Python config, ‘1’ in isolated config. + + Added in version 3.11. + + -- C Member: wchar_t *base_exec_prefix + + *note sys.base_exec_prefix: 3ea. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. output. + + See also *note PyConfig.exec_prefix: 4dff. + + -- C Member: wchar_t *base_executable + + Python base executable: ‘sys._base_executable’. + + Set by the ‘__PYVENV_LAUNCHER__’ environment variable. + + Set from *note PyConfig.executable: 3a1. if ‘NULL’. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. output. + + See also *note PyConfig.executable: 3a1. + + -- C Member: wchar_t *base_prefix + + *note sys.base_prefix: 3eb. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. output. + + See also *note PyConfig.prefix: 4e02. + + -- C Member: int buffered_stdio + + If equals to ‘0’ and *note configure_c_stdio: 4e03. is + non-zero, disable buffering on the C streams stdout and + stderr. + + Set to ‘0’ by the *note -u: 19a3. command line option and the + *note PYTHONUNBUFFERED: 19a4. environment variable. + + stdin is always opened in buffered mode. + + Default: ‘1’. + + -- C Member: int bytes_warning + + If equals to ‘1’, issue a warning when comparing *note bytes: + 1c2. or *note bytearray: 53a. with *note str: 447, or + comparing *note bytes: 1c2. with *note int: 259. + + If equal or greater to ‘2’, raise a *note BytesWarning: c23. + exception in these cases. + + Incremented by the *note -b: 5df. command line option. + + Default: ‘0’. + + -- C Member: int warn_default_encoding + + If non-zero, emit a *note EncodingWarning: 1d3d. warning when + *note io.TextIOWrapper: 7b6. uses its default encoding. See + *note Opt-in EncodingWarning: 1d55. for details. + + Default: ‘0’. + + Added in version 3.10. + + -- C Member: 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: 5b2. environment + variable and by the *note -X no_debug_ranges: 176. command + line option. + + Default: ‘1’. + + Added in version 3.11. + + -- C Member: wchar_t *check_hash_pycs_mode + + Control the validation behavior of hash-based ‘.pyc’ files: + value of the *note -check-hash-based-pycs: 1d30. 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 Member: 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: 3db. equals zero, disable + buffering of stdin, stdout and stderr streams. + + * If *note interactive: 3c9. is non-zero, enable stream + buffering on stdin and stdout (only stdout on Windows). + + Default: ‘1’ in Python config, ‘0’ in isolated config. + + -- C Member: int dev_mode + + If non-zero, enable the *note Python Development Mode: 1fa. + + Set to ‘1’ by the *note -X dev: 176. option and the *note + PYTHONDEVMODE: aed. environment variable. + + Default: ‘-1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: 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: 9a6. environment + variable. + + Needs a special build of Python with the ‘Py_TRACE_REFS’ macro + defined: see the *note configure -with-trace-refs option: 390. + + Default: ‘0’. + + -- C Member: wchar_t *exec_prefix + + The site-specific directory prefix where the + platform-dependent Python files are installed: *note + sys.exec_prefix: 3ae. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. output. + + See also *note PyConfig.base_exec_prefix: 4dfe. + + -- C Member: 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: 8ac. output. + + See also *note PyConfig.base_executable: 4e00. + + -- C Member: int faulthandler + + Enable faulthandler? + + If non-zero, call *note faulthandler.enable(): c9e. at + startup. + + Set to ‘1’ by *note -X faulthandler: 176. and the *note + PYTHONFAULTHANDLER: 1079. environment variable. + + Default: ‘-1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: wchar_t *filesystem_encoding + + *note Filesystem encoding: 537.: *note + sys.getfilesystemencoding(): c59. + + 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: 3e2. of *note PyPreConfig: 9ac. is + non-zero. + + Default encoding on other platforms: + + * ‘"utf-8"’ if *note PyPreConfig.utf8_mode: 3e6. 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: 244.: + ‘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: 3e5. member. + + -- C Member: wchar_t *filesystem_errors + + *note Filesystem error handler: 537.: *note + sys.getfilesystemencodeerrors(): ce6. + + On Windows: use ‘"surrogatepass"’ by default, or ‘"replace"’ + if *note legacy_windows_fs_encoding: 3e2. of *note + PyPreConfig: 9ac. 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: 3e4. member. + + -- C Member: unsigned long hash_seed + + -- C Member: int use_hash_seed + + Randomized hash function seed. + + If *note use_hash_seed: 3dd. is zero, a seed is chosen + randomly at Python startup, and *note hash_seed: 3de. is + ignored. + + Set by the *note PYTHONHASHSEED: 1076. environment variable. + + Default 'use_hash_seed' value: ‘-1’ in Python mode, ‘0’ in + isolated mode. + + -- C Member: wchar_t *home + + Set the default Python “home” directory, that is, the location + of the standard Python libraries (see *note PYTHONHOME: 3b8.). + + Set by the *note PYTHONHOME: 3b8. environment variable. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. input. + + -- C Member: int import_time + + If non-zero, profile import time. + + Set the ‘1’ by the *note -X importtime: 176. option and the + *note PYTHONPROFILEIMPORTTIME: af5. environment variable. + + Default: ‘0’. + + -- C Member: 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: 539. does not appear to be a terminal. + + Incremented by the *note -i: 14a6. command line option. Set + to ‘1’ if the *note PYTHONINSPECT: 14a5. environment variable + is non-empty. + + Default: ‘0’. + + -- C Member: int install_signal_handlers + + Install Python signal handlers? + + Default: ‘1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: int interactive + + If greater than ‘0’, enable the interactive mode (REPL). + + Incremented by the *note -i: 14a6. command line option. + + Default: ‘0’. + + -- C Member: int int_max_str_digits + + Configures the *note integer string conversion length + limitation: 5f1. 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: 227b.). A value of ‘0’ + disables the limitation. Values greater than zero but less + than 640 (*note sys.int_info.str_digits_check_threshold: + 43a2.) are unsupported and will produce an error. + + Configured by the *note -X int_max_str_digits: 176. command + line flag or the *note PYTHONINTMAXSTRDIGITS: 17bd. + environment variable. + + Default: ‘-1’ in Python mode. 4300 (*note + sys.int_info.default_max_str_digits: 227b.) in isolated mode. + + Added in version 3.12. + + -- C Member: int cpu_count + + If the value of *note cpu_count: 4e0b. is not ‘-1’ then it + will override the return values of *note os.cpu_count(): 1c5, + *note os.process_cpu_count(): 1c4, and *note + multiprocessing.cpu_count(): f6a. + + Configured by the ‘-X cpu_count=N|DEFAULT’ command line flag + or the *note PYTHON_CPU_COUNT: 212. environment variable. + + Default: ‘-1’. + + Added in version 3.13. + + -- C Member: int isolated + + If greater than ‘0’, enable isolated mode: + + * Set *note safe_path: 76e. to ‘1’: don’t prepend a + potentially unsafe path to *note sys.path: 3b0. at Python + startup, such as the current directory, the script’s + directory or an empty string. + + * Set *note use_environment: 3d5. to ‘0’: ignore ‘PYTHON’ + environment variables. + + * Set *note user_site_directory: 3d9. to ‘0’: don’t add the + user site directory to *note sys.path: 3b0. + + * Python REPL doesn’t import *note readline: ba. nor enable + default readline configuration on interactive prompts. + + Set to ‘1’ by the *note -I: 95e. command line option. + + Default: ‘0’ in Python mode, ‘1’ in isolated mode. + + See also the *note Isolated Configuration: 4de8. and *note + PyPreConfig.isolated: 4df9. + + -- C Member: int legacy_windows_stdio + + If non-zero, use *note io.FileIO: 1303. instead of + ‘io._WindowsConsoleIO’ for *note sys.stdin: 539, *note + sys.stdout: ad6. and *note sys.stderr: 939. + + Set to ‘1’ if the *note PYTHONLEGACYWINDOWSSTDIO: c5b. + environment variable is set to a non-empty string. + + 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 Member: int malloc_stats + + If non-zero, dump statistics on *note Python pymalloc memory + allocator: d0f. at exit. + + Set to ‘1’ by the *note PYTHONMALLOCSTATS: 1b55. environment + variable. + + The option is ignored if Python is *note configured using the + -without-pymalloc option: 1db0. + + Default: ‘0’. + + -- C Member: wchar_t *platlibdir + + Platform library directory name: *note sys.platlibdir: 938. + + Set by the *note PYTHONPLATLIBDIR: 1940. environment variable. + + Default: value of the ‘PLATLIBDIR’ macro which is set by the + *note configure -with-platlibdir option: 1d78. (default: + ‘"lib"’, or ‘"DLLs"’ on Windows). + + Part of the *note Python Path Configuration: 8ac. input. + + Added in version 3.9. + + Changed in version 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 Member: wchar_t *pythonpath_env + + Module search paths (*note sys.path: 3b0.) as a string + separated by ‘DELIM’ (*note os.pathsep: 1d44.). + + Set by the *note PYTHONPATH: 1016. environment variable. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. input. + + -- C Member: *note PyWideStringList: 9ae. module_search_paths + + -- C Member: int module_search_paths_set + + Module search paths: *note sys.path: 3b0. + + If *note module_search_paths_set: 5eb. is equal to ‘0’, *note + Py_InitializeFromConfig(): 3c1. will replace *note + module_search_paths: 39e. and sets *note + module_search_paths_set: 5eb. to ‘1’. + + Default: empty list (‘module_search_paths’) and ‘0’ + (‘module_search_paths_set’). + + Part of the *note Python Path Configuration: 8ac. output. + + -- C Member: 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: db4. command line option. Set to + the *note PYTHONOPTIMIZE: 1d33. environment variable value. + + Default: ‘0’. + + -- C Member: *note PyWideStringList: 9ae. orig_argv + + The list of the original command line arguments passed to the + Python executable: *note sys.orig_argv: 83c. + + If *note orig_argv: 892. list is empty and *note argv: 3bf. is + not a list only containing an empty string, *note + PyConfig_Read(): 78b. copies *note argv: 3bf. into *note + orig_argv: 892. before modifying *note argv: 3bf. (if *note + parse_argv: 1928. is non-zero). + + See also the *note argv: 3bf. member and the *note + Py_GetArgcArgv(): 1956. function. + + Default: empty list. + + Added in version 3.10. + + -- C Member: int parse_argv + + Parse command line arguments? + + If equals to ‘1’, parse *note argv: 3bf. the same way the + regular Python parses *note command line arguments: 1000, and + strip Python arguments from *note argv: 3bf. + + The *note PyConfig_Read(): 78b. function only parses *note + PyConfig.argv: 3bf. arguments once: *note PyConfig.parse_argv: + 1928. is set to ‘2’ after arguments are parsed. Since Python + arguments are stripped from *note PyConfig.argv: 3bf, parsing + arguments twice would parse the application options as Python + options. + + Default: ‘1’ in Python mode, ‘0’ in isolated mode. + + Changed in version 3.10: The *note PyConfig.argv: 3bf. + arguments are now only parsed if *note PyConfig.parse_argv: + 1928. equals to ‘1’. + + -- C Member: 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: 1d31. command line option. Set + to the *note PYTHONDEBUG: 1d32. environment variable value. + + Needs a *note debug build of Python: 1fb. (the ‘Py_DEBUG’ + macro must be defined). + + Default: ‘0’. + + -- C Member: 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: 8ac. input. + + Changed in version 3.11: Now also applies on Windows. + + -- C Member: wchar_t *prefix + + The site-specific directory prefix where the platform + independent Python files are installed: *note sys.prefix: 3b2. + + Default: ‘NULL’. + + Part of the *note Python Path Configuration: 8ac. output. + + See also *note PyConfig.base_prefix: 4e01. + + -- C Member: wchar_t *program_name + + Program name used to initialize *note executable: 3a1. and in + early error messages during Python initialization. + + * On macOS, use *note PYTHONEXECUTABLE: 1d48. 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: 3bf. 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: 8ac. input. + + -- C Member: wchar_t *pycache_prefix + + Directory where cached ‘.pyc’ files are written: *note + sys.pycache_prefix: 9a4. + + Set by the *note -X pycache_prefix=PATH: 176. command line + option and the *note PYTHONPYCACHEPREFIX: 9a3. environment + variable. The command-line option takes precedence. + + If ‘NULL’, *note sys.pycache_prefix: 9a4. is set to ‘None’. + + Default: ‘NULL’. + + -- C Member: 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: 1d34. command line option. + + Default: ‘0’. + + -- C Member: wchar_t *run_command + + Value of the *note -c: 5dc. command line option. + + Used by *note Py_RunMain(): 9c5. + + Default: ‘NULL’. + + -- C Member: wchar_t *run_filename + + Filename passed on the command line: trailing command line + argument without *note -c: 5dc. or *note -m: 5dd. It is used + by the *note Py_RunMain(): 9c5. 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: 4e0f. + option. + + Default: ‘NULL’. + + -- C Member: wchar_t *run_module + + Value of the *note -m: 5dd. command line option. + + Used by *note Py_RunMain(): 9c5. + + Default: ‘NULL’. + + -- C Member: wchar_t *run_presite + + ‘package.module’ path to module that should be imported before + ‘site.py’ is run. + + Set by the *note -X presite=package.module: 176. command-line + option and the *note PYTHON_PRESITE: 1d3e. environment + variable. The command-line option takes precedence. + + Needs a *note debug build of Python: 1fb. (the ‘Py_DEBUG’ + macro must be defined). + + Default: ‘NULL’. + + -- C Member: int show_ref_count + + Show total reference count at exit (excluding *note immortal: + 4394. objects)? + + Set to ‘1’ by *note -X showrefcount: 176. command line option. + + Needs a *note debug build of Python: 1fb. (the ‘Py_REF_DEBUG’ + macro must be defined). + + Default: ‘0’. + + -- C Member: int site_import + + Import the *note site: c7. module at startup? + + If equal to zero, disable the import of the module site and + the site-dependent manipulations of *note sys.path: 3b0. that + it entails. + + Also disable these manipulations if the *note site: c7. module + is explicitly imported later (call *note site.main(): 1d36. if + you want them to be triggered). + + Set to ‘0’ by the *note -S: 119b. command line option. + + *note sys.flags.no_site: 688. is set to the inverted value of + *note site_import: 3cf. + + Default: ‘1’. + + -- C Member: int skip_source_first_line + + If non-zero, skip the first line of the *note + PyConfig.run_filename: 4dab. 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: 1d3a. command line option. + + Default: ‘0’. + + -- C Member: wchar_t *stdio_encoding + + -- C Member: wchar_t *stdio_errors + + Encoding and encoding errors of *note sys.stdin: 539, *note + sys.stdout: ad6. and *note sys.stderr: 939. (but *note + sys.stderr: 939. always uses ‘"backslashreplace"’ error + handler). + + Use the *note PYTHONIOENCODING: 1003. environment variable if + it is non-empty. + + Default encoding: + + * ‘"UTF-8"’ if *note PyPreConfig.utf8_mode: 3e6. is + non-zero. + + * Otherwise, use the *note locale encoding: 244. + + Default error handler: + + * On Windows: use ‘"surrogateescape"’. + + * ‘"surrogateescape"’ if *note PyPreConfig.utf8_mode: 3e6. + is non-zero, or if the LC_CTYPE locale is “C” or “POSIX”. + + * ‘"strict"’ otherwise. + + See also *note PyConfig.legacy_windows_stdio: 3a0. + + -- C Member: int tracemalloc + + Enable tracemalloc? + + If non-zero, call *note tracemalloc.start(): 1d3b. at startup. + + Set by *note -X tracemalloc=N: 176. command line option and by + the *note PYTHONTRACEMALLOC: 1d3c. environment variable. + + Default: ‘-1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: int perf_profiling + + Enable compatibility mode with the perf profiler? + + If non-zero, initialize the perf trampoline. See *note Python + support for the Linux perf profiler: 18f. for more + information. + + Set by *note -X perf: 176. command-line option and by the + *note PYTHON_PERF_JIT_SUPPORT: 190. environment variable for + perf support with stack pointers and *note -X perf_jit: 176. + command-line option and by the *note PYTHON_PERF_JIT_SUPPORT: + 190. environment variable for perf support with DWARF JIT + information. + + Default: ‘-1’. + + Added in version 3.12. + + -- C Member: int use_environment + + Use *note environment variables: 5ed.? + + If equals to zero, ignore the *note environment variables: + 5ed. + + Set to ‘0’ by the *note -E: 95d. environment variable. + + Default: ‘1’ in Python config and ‘0’ in isolated config. + + -- C Member: int user_site_directory + + If non-zero, add the user site directory to *note sys.path: + 3b0. + + Set to ‘0’ by the *note -s: 1377. and *note -I: 95e. command + line options. + + Set to ‘0’ by the *note PYTHONNOUSERSITE: 1378. environment + variable. + + Default: ‘1’ in Python mode, ‘0’ in isolated mode. + + -- C Member: 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: 13f0. command line option. + + Set by the *note PYTHONVERBOSE: 1d37. environment variable + value. + + Default: ‘0’. + + -- C Member: *note PyWideStringList: 9ae. warnoptions + + Options of the *note warnings: 112. module to build warnings + filters, lowest to highest priority: *note sys.warnoptions: + 3ac. + + The *note warnings: 112. module adds *note sys.warnoptions: + 3ac. in the reverse order: the last *note + PyConfig.warnoptions: 39c. item becomes the first item of + ‘warnings.filters’ which is checked first (highest priority). + + The *note -W: 8c6. command line options adds its value to + *note warnoptions: 39c, it can be used multiple times. + + The *note PYTHONWARNINGS: baa. environment variable can also + be used to add warning options. Multiple options can be + specified, separated by commas (‘,’). + + Default: empty list. + + -- C Member: 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: 1399. command line option and the + *note PYTHONDONTWRITEBYTECODE: 139a. environment variable. + + *note sys.dont_write_bytecode: 436d. is initialized to the + inverted value of *note write_bytecode: 3d7. + + Default: ‘1’. + + -- C Member: *note PyWideStringList: 9ae. xoptions + + Values of the *note -X: 176. command line options: *note + sys._xoptions: 1d3f. + + Default: empty list. + +If *note parse_argv: 1928. is non-zero, *note argv: 3bf. arguments are +parsed the same way the regular Python parses *note command line +arguments: 1000, and Python arguments are stripped from *note argv: 3bf. + +The *note xoptions: 39d. options are parsed to set other options: see +the *note -X: 176. command line option. + +Changed in version 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: Python Initialization Configuration + +7.10.7 Initialization with PyConfig +----------------------------------- + +Initializing the interpreter from a populated configuration struct is +handled by calling *note Py_InitializeFromConfig(): 3c1. + +The caller is responsible to handle exceptions (error or exit) using +*note PyStatus_Exception(): 9b9. and *note Py_ExitStatusException(): +9c2. + +If *note PyImport_FrozenModules(): 2e2a, *note PyImport_AppendInittab(): +17a3. or *note PyImport_ExtendInittab(): 17a4. are used, they must be +set or called after Python preinitialization and before the Python +initialization. If Python is initialized multiple times, *note +PyImport_AppendInittab(): 17a3. or *note PyImport_ExtendInittab(): 17a4. +must be called before each Python initialization. + +The current configuration (‘PyConfig’ type) is stored in +‘PyInterpreterState.config’. + +Example setting the program name: + + void init_python(void) + { + PyStatus status; + + PyConfig config; + PyConfig_InitPythonConfig(&config); + + /* Set the program name. Implicitly preinitialize Python. */ + status = PyConfig_SetString(&config, &config.program_name, + L"/path/to/my_program"); + if (PyStatus_Exception(status)) { + goto exception; + } + + status = Py_InitializeFromConfig(&config); + if (PyStatus_Exception(status)) { + goto exception; + } + PyConfig_Clear(&config); + return; + + exception: + PyConfig_Clear(&config); + Py_ExitStatusException(status); + } + +More complete example modifying the default configuration, read the +configuration, and then override some parameters. Note that since 3.11, +many parameters are not calculated until initialization, and so values +cannot be read from the configuration structure. Any values set before +initialize is called will be left unchanged by initialization: + + PyStatus init_python(const char *program_name) + { + PyStatus status; + + PyConfig config; + PyConfig_InitPythonConfig(&config); + + /* Set the program name before reading the configuration + (decode byte string from the locale encoding). + + Implicitly preinitialize Python. */ + status = PyConfig_SetBytesString(&config, &config.program_name, + program_name); + if (PyStatus_Exception(status)) { + goto done; + } + + /* Read all configuration at once */ + status = PyConfig_Read(&config); + if (PyStatus_Exception(status)) { + goto done; + } + + /* Specify sys.path explicitly */ + /* If you want to modify the default set of paths, finish + initialization first and then use PySys_GetObject("path") */ + config.module_search_paths_set = 1; + status = PyWideStringList_Append(&config.module_search_paths, + L"/path/to/stdlib"); + if (PyStatus_Exception(status)) { + goto done; + } + status = PyWideStringList_Append(&config.module_search_paths, + L"/path/to/more/modules"); + if (PyStatus_Exception(status)) { + goto done; + } + + /* Override executable computed by PyConfig_Read() */ + status = PyConfig_SetString(&config, &config.executable, + L"/path/to/my_executable"); + if (PyStatus_Exception(status)) { + goto done; + } + + status = Py_InitializeFromConfig(&config); + + done: + PyConfig_Clear(&config); + return status; + } + + +File: python.info, Node: Isolated Configuration, Next: Python Configuration, Prev: Initialization with PyConfig, Up: Python Initialization Configuration + +7.10.8 Isolated Configuration +----------------------------- + +*note PyPreConfig_InitIsolatedConfig(): 9b6. and *note +PyConfig_InitIsolatedConfig(): 9b0. 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: 3bf. 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: 3b7. is +specified to avoid computing the default path configuration. + + +File: python.info, Node: Python Configuration, Next: Python Path Configuration, Prev: Isolated Configuration, Up: Python Initialization Configuration + +7.10.9 Python Configuration +--------------------------- + +*note PyPreConfig_InitPythonConfig(): 9b7. and *note +PyConfig_InitPythonConfig(): 9b1. 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: 652. ( PEP 540(2)) depending on the LC_CTYPE locale, *note +PYTHONUTF8: ad8. and *note PYTHONCOERCECLOCALE: ad5. environment +variables. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0538/ + + (2) https://peps.python.org/pep-0540/ + + +File: python.info, Node: Python Path Configuration, Next: Py_GetArgcArgv, Prev: Python Configuration, Up: Python Initialization Configuration + +7.10.10 Python Path Configuration +--------------------------------- + +*note PyConfig: 3a2. contains multiple fields for the path +configuration: + + * Path configuration inputs: + + * *note PyConfig.home: 3b7. + + * *note PyConfig.platlibdir: 193e. + + * *note PyConfig.pathconfig_warnings: 3d3. + + * *note PyConfig.program_name: 3c0. + + * *note PyConfig.pythonpath_env: 4e0d. + + * current working directory: to get absolute paths + + * ‘PATH’ environment variable to get the program full path (from + *note PyConfig.program_name: 3c0.) + + * ‘__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: 4dfe. + + * *note PyConfig.base_executable: 4e00. + + * *note PyConfig.base_prefix: 4e01. + + * *note PyConfig.exec_prefix: 4dff. + + * *note PyConfig.executable: 3a1. + + * *note PyConfig.module_search_paths_set: 5eb, *note + PyConfig.module_search_paths: 39e. + + * *note PyConfig.prefix: 4e02. + +If at least one “output field” is not set, Python calculates the path +configuration to fill unset fields. If *note module_search_paths_set: +5eb. is equal to ‘0’, *note module_search_paths: 39e. is overridden and +*note module_search_paths_set: 5eb. 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: 3d3. to ‘0’ to suppress warnings when +calculating the path configuration (Unix only, Windows does not log any +warning). + +If *note base_prefix: 4e01. or *note base_exec_prefix: 4dfe. fields are +not set, they inherit their value from *note prefix: 4e02. and *note +exec_prefix: 4dff. respectively. + +*note Py_RunMain(): 9c5. and *note Py_Main(): c25. modify *note +sys.path: 3b0.: + + * If *note run_filename: 4dab. is set and is a directory which + contains a ‘__main__.py’ script, prepend *note run_filename: 4dab. + to *note sys.path: 3b0. + + * If *note isolated: 3e0. is zero: + + * If *note run_module: 4dac. is set, prepend the current + directory to *note sys.path: 3b0. Do nothing if the current + directory cannot be read. + + * If *note run_filename: 4dab. is set, prepend the directory of + the filename to *note sys.path: 3b0. + + * Otherwise, prepend an empty string to *note sys.path: 3b0. + +If *note site_import: 3cf. is non-zero, *note sys.path: 3b0. can be +modified by the *note site: c7. module. If *note user_site_directory: +3d9. is non-zero and the user’s site-package directory exists, the *note +site: c7. module appends the user’s site-package directory to *note +sys.path: 3b0. + +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: 3e0. to ‘1’. + + * Set *note use_environment: 3d5. to ‘0’. + + * Set *note site_import: 3cf. to ‘0’. + + * Set *note safe_path: 76e. to ‘1’. + +The ‘__PYVENV_LAUNCHER__’ environment variable is used to set *note +PyConfig.base_executable: 4e00. + + +File: python.info, Node: Py_GetArgcArgv, Next: Multi-Phase Initialization Private Provisional API, Prev: Python Path Configuration, Up: Python Initialization Configuration + +7.10.11 Py_GetArgcArgv() +------------------------ + + -- C Function: void Py_GetArgcArgv (int *argc, wchar_t ***argv) + + Get the original command line arguments, before Python modified + them. + + See also *note PyConfig.orig_argv: 892. member. + + +File: python.info, Node: Multi-Phase Initialization Private Provisional API, Prev: Py_GetArgcArgv, Up: Python Initialization Configuration + +7.10.12 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: d9. module is only partially initialized (ex: + *note sys.path: 3b0. doesn’t exist yet). + + * “Main” initialization phase, Python is fully initialized: + + * Install and configure *note importlib: 77.; + + * Apply the *note Path Configuration: 8ac.; + + * Install signal handlers; + + * Finish *note sys: d9. module initialization (ex: create *note + sys.stdout: ad6. and *note sys.path: 3b0.); + + * Enable optional features like *note faulthandler: 58. and + *note tracemalloc: ff.; + + * Import the *note site: c7. module; + + * etc. + +Private provisional API: + + * ‘PyConfig._init_main’: if set to ‘0’, *note + Py_InitializeFromConfig(): 3c1. stops at the “Core” initialization + phase. + + -- C Function: *note PyStatus: 9ad. _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: 8ac. is only applied +during the “Main” phase. It may allow to customize Python in Python to +override or tune the *note Path Configuration: 8ac, maybe install a +custom *note sys.meta_path: d2b. importer or an import hook, etc. + +It may become possible to calculate the *note Path Configuration: 8ac. +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: Memory Management, Next: Object Implementation Support, Prev: Python Initialization Configuration, Up: Python/C API Reference Manual + +7.11 Memory Management +====================== + +* Menu: + +* Overview: Overview<4>. +* Allocator Domains:: +* Raw Memory Interface:: +* Memory Interface:: +* Object allocators:: +* Default Memory Allocators:: +* Customize Memory Allocators:: +* Debug hooks on the Python memory allocators:: +* The pymalloc allocator:: +* The mimalloc allocator:: +* tracemalloc C API:: +* Examples: Examples<37>. + + +File: python.info, Node: Overview<4>, Next: Allocator Domains, Up: Memory Management + +7.11.1 Overview +--------------- + +Memory management in Python involves a private heap containing all +Python objects and data structures. The management of this private heap +is ensured internally by the 'Python memory manager'. The Python memory +manager has different components which deal with various dynamic storage +management aspects, like sharing, segmentation, preallocation or +caching. + +At the lowest level, a raw memory allocator ensures that there is enough +room in the private heap for storing all Python-related data by +interacting with the memory manager of the operating system. On top of +the raw memory allocator, several object-specific allocators operate on +the same heap and implement distinct memory management policies adapted +to the peculiarities of every object type. For example, integer objects +are managed differently within the heap than strings, tuples or +dictionaries because integers imply different storage requirements and +speed/space tradeoffs. The Python memory manager thus delegates some of +the work to the object-specific allocators, but ensures that the latter +operate within the bounds of the private heap. + +It is important to understand that the management of the Python heap is +performed by the interpreter itself and that the user has no control +over it, even if they regularly manipulate object pointers to memory +blocks inside that heap. The allocation of heap space for Python +objects and other internal buffers is performed on demand by the Python +memory manager through the Python/C API functions listed in this +document. + +To avoid memory corruption, extension writers should never try to +operate on Python objects with the functions exported by the C library: +‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’. This will result in +mixed calls between the C allocator and the Python memory manager with +fatal consequences, because they implement different algorithms and +operate on different heaps. However, one may safely allocate and +release memory blocks with the C library allocator for individual +purposes, as shown in the following example: + + 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; + +In this example, the memory request for the I/O buffer is handled by the +C library allocator. The Python memory manager is involved only in the +allocation of the bytes object returned as a result. + +In most situations, however, it is recommended to allocate memory from +the Python heap specifically because the latter is under control of the +Python memory manager. For example, this is required when the +interpreter is extended with new object types written in C. Another +reason for using the Python heap is the desire to 'inform' the Python +memory manager about the memory needs of the extension module. Even +when the requested memory is used exclusively for internal, highly +specific purposes, delegating all memory requests to the Python memory +manager causes the interpreter to have a more accurate image of its +memory footprint as a whole. Consequently, under certain circumstances, +the Python memory manager may or may not trigger appropriate actions, +like garbage collection, memory compaction or other preventive +procedures. Note that by using the C library allocator as shown in the +previous example, the allocated memory for the I/O buffer escapes +completely the Python memory manager. + +See also +........ + +The *note PYTHONMALLOC: c64. environment variable can be used to +configure the memory allocators used by Python. + +The *note PYTHONMALLOCSTATS: 1b55. environment variable can be used to +print statistics of the *note pymalloc memory allocator: d0f. every time +a new pymalloc object arena is created, and on shutdown. + + +File: python.info, Node: Allocator Domains, Next: Raw Memory Interface, Prev: Overview<4>, Up: Memory Management + +7.11.2 Allocator Domains +------------------------ + +All allocating functions belong to one of three different “domains” (see +also *note PyMemAllocatorDomain: 4e21.). 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 here: 1d50. The APIs used to allocate and free a +block of memory must be from the same domain. For example, *note +PyMem_Free(): 140e. must be used to free memory allocated using *note +PyMem_Malloc(): c66. + +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 the *note GIL: + 159. The memory is requested directly from the system. See *note + Raw Memory Interface: 4e22. + + * “Mem” domain: intended for allocating memory for Python buffers and + general-purpose memory buffers where the allocation must be + performed with the *note GIL: 159. held. The memory is taken from + the Python private heap. See *note Memory Interface: 4e23. + + * Object domain: intended for allocating memory for Python objects. + The memory is taken from the Python private heap. See *note Object + allocators: 4e24. + + Note: The *note free-threaded: 1522. 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(): c66, *note PyMem_RawMalloc(): 38b, or + ‘malloc()’, but not *note PyObject_Malloc(): c68. + + See *note Memory Allocation APIs: 4e25. + + +File: python.info, Node: Raw Memory Interface, Next: Memory Interface, Prev: Allocator Domains, Up: Memory Management + +7.11.3 Raw Memory Interface +--------------------------- + +The following function sets are wrappers to the system allocator. These +functions are thread-safe, the *note GIL: 148. does not need to be held. + +The *note default raw memory allocator: 1d50. 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 Function: void *PyMem_RawMalloc (size_t n) + ' Part of the *note Stable ABI: 550. since version 3.13.' + Allocates 'n' bytes and returns a pointer of type void* to the + allocated memory, or ‘NULL’ if the request fails. + + Requesting zero bytes returns a distinct non-‘NULL’ pointer if + possible, as if ‘PyMem_RawMalloc(1)’ had been called instead. The + memory will not have been initialized in any way. + + -- C Function: void *PyMem_RawCalloc (size_t nelem, size_t elsize) + ' Part of the *note Stable ABI: 550. since version 3.13.' + Allocates 'nelem' elements each whose size in bytes is 'elsize' and + returns a pointer of type void* to the allocated memory, or ‘NULL’ + if the request fails. The memory is initialized to zeros. + + Requesting zero elements or elements of size zero bytes returns a + distinct non-‘NULL’ pointer if possible, as if ‘PyMem_RawCalloc(1, + 1)’ had been called instead. + + Added in version 3.5. + + -- C Function: void *PyMem_RawRealloc (void *p, size_t n) + ' Part of the *note Stable ABI: 550. since version 3.13.' Resizes + the memory block pointed to by 'p' to 'n' bytes. The contents will + be unchanged to the minimum of the old and the new sizes. + + If 'p' is ‘NULL’, the call is equivalent to ‘PyMem_RawMalloc(n)’; + else if 'n' is equal to zero, the memory block is resized but is + not freed, and the returned pointer is non-‘NULL’. + + Unless 'p' is ‘NULL’, it must have been returned by a previous call + to *note PyMem_RawMalloc(): 38b, *note PyMem_RawRealloc(): 38d. or + *note PyMem_RawCalloc(): 38c. + + If the request fails, *note PyMem_RawRealloc(): 38d. returns ‘NULL’ + and 'p' remains a valid pointer to the previous memory area. + + -- C Function: void PyMem_RawFree (void *p) + ' Part of the *note Stable ABI: 550. since version 3.13.' Frees + the memory block pointed to by 'p', which must have been returned + by a previous call to *note PyMem_RawMalloc(): 38b, *note + PyMem_RawRealloc(): 38d. or *note PyMem_RawCalloc(): 38c. + Otherwise, or if ‘PyMem_RawFree(p)’ has been called before, + undefined behavior occurs. + + If 'p' is ‘NULL’, no operation is performed. + + +File: python.info, Node: Memory Interface, Next: Object allocators, Prev: Raw Memory Interface, Up: Memory Management + +7.11.4 Memory Interface +----------------------- + +The following function sets, modeled after the ANSI C standard, but +specifying behavior when requesting zero bytes, are available for +allocating and releasing memory from the Python heap. + +The *note default memory allocator: 1d50. uses the *note pymalloc memory +allocator: d0f. + + Warning: The *note GIL: 148. must be held when using these + functions. + +Changed in version 3.6: The default allocator is now pymalloc instead of +system ‘malloc()’. + + -- C Function: void *PyMem_Malloc (size_t n) + ' Part of the *note Stable ABI: 550.' Allocates 'n' bytes and + returns a pointer of type void* to the allocated memory, or ‘NULL’ + if the request fails. + + Requesting zero bytes returns a distinct non-‘NULL’ pointer if + possible, as if ‘PyMem_Malloc(1)’ had been called instead. The + memory will not have been initialized in any way. + + -- C Function: void *PyMem_Calloc (size_t nelem, size_t elsize) + ' Part of the *note Stable ABI: 550. since version 3.7.' Allocates + 'nelem' elements each whose size in bytes is 'elsize' and returns a + pointer of type void* to the allocated memory, or ‘NULL’ if the + request fails. The memory is initialized to zeros. + + Requesting zero elements or elements of size zero bytes returns a + distinct non-‘NULL’ pointer if possible, as if ‘PyMem_Calloc(1, 1)’ + had been called instead. + + Added in version 3.5. + + -- C Function: void *PyMem_Realloc (void *p, size_t n) + ' Part of the *note Stable ABI: 550.' Resizes the memory block + pointed to by 'p' to 'n' bytes. The contents will be unchanged to + the minimum of the old and the new sizes. + + If 'p' is ‘NULL’, the call is equivalent to ‘PyMem_Malloc(n)’; else + if 'n' is equal to zero, the memory block is resized but is not + freed, and the returned pointer is non-‘NULL’. + + Unless 'p' is ‘NULL’, it must have been returned by a previous call + to *note PyMem_Malloc(): c66, *note PyMem_Realloc(): 102b. or *note + PyMem_Calloc(): ea6. + + If the request fails, *note PyMem_Realloc(): 102b. returns ‘NULL’ + and 'p' remains a valid pointer to the previous memory area. + + -- C Function: void PyMem_Free (void *p) + ' Part of the *note Stable ABI: 550.' Frees the memory block + pointed to by 'p', which must have been returned by a previous call + to *note PyMem_Malloc(): c66, *note PyMem_Realloc(): 102b. or *note + PyMem_Calloc(): ea6. Otherwise, or if ‘PyMem_Free(p)’ has been + called before, undefined behavior occurs. + + If 'p' is ‘NULL’, no operation is performed. + +The following type-oriented macros are provided for convenience. Note +that 'TYPE' refers to any C type. + + -- C Macro: PyMem_New (TYPE, n) + + Same as *note PyMem_Malloc(): c66, 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 Macro: PyMem_Resize (p, TYPE, n) + + Same as *note PyMem_Realloc(): 102b, 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. + + This is a C preprocessor macro; 'p' is always reassigned. Save the + original value of 'p' to avoid losing memory when handling errors. + + -- C Function: void PyMem_Del (void *p) + + Same as *note PyMem_Free(): 140e. + +In addition, the following macro sets are provided for calling the +Python memory allocator directly, without involving the C API functions +listed above. However, note that their use does not preserve binary +compatibility across Python versions and is therefore deprecated in +extension modules. + + * ‘PyMem_MALLOC(size)’ + + * ‘PyMem_NEW(type, size)’ + + * ‘PyMem_REALLOC(ptr, size)’ + + * ‘PyMem_RESIZE(ptr, type, size)’ + + * ‘PyMem_FREE(ptr)’ + + * ‘PyMem_DEL(ptr)’ + + +File: python.info, Node: Object allocators, Next: Default Memory Allocators, Prev: Memory Interface, Up: Memory Management + +7.11.5 Object allocators +------------------------ + +The following function sets, modeled after the ANSI C standard, but +specifying behavior when requesting zero bytes, are available for +allocating and releasing memory from the Python heap. + + Note: 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: 4e2a. section. + +The *note default object allocator: 1d50. uses the *note pymalloc memory +allocator: d0f. + + Warning: The *note GIL: 148. must be held when using these + functions. + + -- C Function: void *PyObject_Malloc (size_t n) + ' Part of the *note Stable ABI: 550.' Allocates 'n' bytes and + returns a pointer of type void* to the allocated memory, or ‘NULL’ + if the request fails. + + Requesting zero bytes returns a distinct non-‘NULL’ pointer if + possible, as if ‘PyObject_Malloc(1)’ had been called instead. The + memory will not have been initialized in any way. + + -- C Function: void *PyObject_Calloc (size_t nelem, size_t elsize) + ' Part of the *note Stable ABI: 550. since version 3.7.' Allocates + 'nelem' elements each whose size in bytes is 'elsize' and returns a + pointer of type void* to the allocated memory, or ‘NULL’ if the + request fails. The memory is initialized to zeros. + + Requesting zero elements or elements of size zero bytes returns a + distinct non-‘NULL’ pointer if possible, as if ‘PyObject_Calloc(1, + 1)’ had been called instead. + + Added in version 3.5. + + -- C Function: void *PyObject_Realloc (void *p, size_t n) + ' Part of the *note Stable ABI: 550.' Resizes the memory block + pointed to by 'p' to 'n' bytes. The contents will be unchanged to + the minimum of the old and the new sizes. + + If 'p' is ‘NULL’, the call is equivalent to ‘PyObject_Malloc(n)’; + else if 'n' is equal to zero, the memory block is resized but is + not freed, and the returned pointer is non-‘NULL’. + + Unless 'p' is ‘NULL’, it must have been returned by a previous call + to *note PyObject_Malloc(): c68, *note PyObject_Realloc(): 140f. or + *note PyObject_Calloc(): ea7. + + If the request fails, *note PyObject_Realloc(): 140f. returns + ‘NULL’ and 'p' remains a valid pointer to the previous memory area. + + -- C Function: void PyObject_Free (void *p) + ' Part of the *note Stable ABI: 550.' Frees the memory block + pointed to by 'p', which must have been returned by a previous call + to *note PyObject_Malloc(): c68, *note PyObject_Realloc(): 140f. or + *note PyObject_Calloc(): ea7. Otherwise, or if ‘PyObject_Free(p)’ + has been called before, undefined behavior occurs. + + If 'p' is ‘NULL’, no operation is performed. + + +File: python.info, Node: Default Memory Allocators, Next: Customize Memory Allocators, Prev: Object allocators, Up: Memory Management + +7.11.6 Default Memory Allocators +-------------------------------- + +Default memory allocators: + +Configuration Name PyMem_RawMalloc PyMem_Malloc PyObject_Malloc + +--------------------------------------------------------------------------------------------------------------------------------------- + +Release build ‘"pymalloc"’ ‘malloc’ ‘pymalloc’ ‘pymalloc’ + + +Debug build ‘"pymalloc_debug"’ ‘malloc’ + debug ‘pymalloc’ + debug ‘pymalloc’ + debug + + +Release build, without pymalloc ‘"malloc"’ ‘malloc’ ‘malloc’ ‘malloc’ + + +Debug build, without pymalloc ‘"malloc_debug"’ ‘malloc’ + debug ‘malloc’ + debug ‘malloc’ + debug + + +Legend: + + * Name: value for *note PYTHONMALLOC: c64. environment variable. + + * ‘malloc’: system allocators from the standard C library, C + functions: ‘malloc()’, ‘calloc()’, ‘realloc()’ and ‘free()’. + + * ‘pymalloc’: *note pymalloc memory allocator: d0f. + + * ‘mimalloc’: *note mimalloc memory allocator: 1d52. The pymalloc + allocator will be used if mimalloc support isn’t available. + + * “+ debug”: with *note debug hooks on the Python memory allocators: + 1d53. + + * “Debug build”: *note Python build in debug mode: 1fb. + + +File: python.info, Node: Customize Memory Allocators, Next: Debug hooks on the Python memory allocators, Prev: Default Memory Allocators, Up: Memory Management + +7.11.7 Customize Memory Allocators +---------------------------------- + +Added in version 3.4. + + -- C Type: type PyMemAllocatorEx + + Structure used to describe a memory block allocator. The structure + has the following fields: + + Field Meaning + + ----------------------------------------------------------------------------------------------------------- + + ‘void *ctx’ user context passed as first argument + + + ‘void* malloc(void *ctx, size_t size)’ allocate a memory block + + + ‘void* calloc(void *ctx, size_t nelem, size_t elsize)’ allocate a memory block initialized with + zeros + + + ‘void* realloc(void *ctx, void *ptr, size_t new_size)’ allocate or resize a memory block + + + ‘void free(void *ctx, void *ptr)’ free a memory block + + + Changed in version 3.5: The ‘PyMemAllocator’ structure was renamed + to *note PyMemAllocatorEx: ec7. and a new ‘calloc’ field was added. + + -- C Type: type PyMemAllocatorDomain + + Enum used to identify an allocator domain. Domains: + + -- C Macro: PYMEM_DOMAIN_RAW + + Functions: + + * *note PyMem_RawMalloc(): 38b. + + * *note PyMem_RawRealloc(): 38d. + + * *note PyMem_RawCalloc(): 38c. + + * *note PyMem_RawFree(): 38e. + + -- C Macro: PYMEM_DOMAIN_MEM + + Functions: + + * *note PyMem_Malloc(): c66, + + * *note PyMem_Realloc(): 102b. + + * *note PyMem_Calloc(): ea6. + + * *note PyMem_Free(): 140e. + + -- C Macro: PYMEM_DOMAIN_OBJ + + Functions: + + * *note PyObject_Malloc(): c68. + + * *note PyObject_Realloc(): 140f. + + * *note PyObject_Calloc(): ea7. + + * *note PyObject_Free(): c65. + + -- C Function: void PyMem_GetAllocator (PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator) + + Get the memory block allocator of the specified domain. + + -- C Function: void PyMem_SetAllocator (PyMemAllocatorDomain domain, + PyMemAllocatorEx *allocator) + + Set the memory block allocator of the specified domain. + + The new allocator must return a distinct non-‘NULL’ pointer when + requesting zero bytes. + + For the *note PYMEM_DOMAIN_RAW: 1d51. domain, the allocator must be + thread-safe: the *note GIL: 148. is not held 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 ‘GIL’. + + If the new allocator is not a hook (does not call the previous + allocator), the *note PyMem_SetupDebugHooks(): c6a. function must + be called to reinstall the debug hooks on top on the new allocator. + + See also *note PyPreConfig.allocator: 4df2. and *note Preinitialize + Python with PyPreConfig: 3d40. + + Warning: *note PyMem_SetAllocator(): 588. does have the + following contract: + + * It can be called after *note Py_PreInitialize(): 3e7. and + before *note Py_InitializeFromConfig(): 3c1. 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 the GIL held). See *note + the section on allocator domains: 4e20. for more + information. + + * If called after Python has finish initializing (after + *note Py_InitializeFromConfig(): 3c1. has been called) + the allocator 'must' wrap the existing allocator. + Substituting the current allocator for some other + arbitrary one is 'not supported'. + + Changed in version 3.12: All allocators must be thread-safe. + + -- C Function: void PyMem_SetupDebugHooks (void) + + Setup *note debug hooks in the Python memory allocators: 1d53. to + detect memory errors. + + +File: python.info, Node: Debug hooks on the Python memory allocators, Next: The pymalloc allocator, Prev: Customize Memory Allocators, Up: Memory Management + +7.11.8 Debug hooks on the Python memory allocators +-------------------------------------------------- + +When *note Python is built in debug mode: 1fb, the *note +PyMem_SetupDebugHooks(): c6a. function is called at the *note Python +preinitialization: 3d40. to setup debug hooks on Python memory +allocators to detect memory errors. + +The *note PYTHONMALLOC: c64. environment variable can be used to install +debug hooks on a Python compiled in release mode (ex: +‘PYTHONMALLOC=debug’). + +The *note PyMem_SetupDebugHooks(): c6a. function can be used to set +debug hooks after calling *note PyMem_SetAllocator(): 588. + +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. + +Runtime checks: + + - Detect API violations. For example, detect if *note + PyObject_Free(): c65. is called on a memory block allocated by + *note PyMem_Malloc(): c66. + + - Detect write before the start of the buffer (buffer underflow). + + - Detect write after the end of the buffer (buffer overflow). + + - Check that the *note GIL: 148. is held when allocator functions of + *note PYMEM_DOMAIN_OBJ: c67. (ex: *note PyObject_Malloc(): c68.) + and *note PYMEM_DOMAIN_MEM: c69. (ex: *note PyMem_Malloc(): c66.) + domains are called. + +On error, the debug hooks use the *note tracemalloc: ff. module to get +the traceback where a memory block was allocated. The traceback is only +displayed if *note tracemalloc: ff. 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: 1d51. + + * ‘'m'’ for *note PYMEM_DOMAIN_MEM: c69. + + * ‘'o'’ for *note PYMEM_DOMAIN_OBJ: c67. + +‘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). + +Changed in version 3.6: The *note PyMem_SetupDebugHooks(): c6a. function +now also works on Python compiled in release mode. On error, the debug +hooks now use *note tracemalloc: ff. to get the traceback where a memory +block was allocated. The debug hooks now also check if the GIL is held +when functions of *note PYMEM_DOMAIN_OBJ: c67. and *note +PYMEM_DOMAIN_MEM: c69. domains are called. + +Changed in version 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: The pymalloc allocator, Next: The mimalloc allocator, Prev: Debug hooks on the Python memory allocators, Up: Memory Management + +7.11.9 The pymalloc allocator +----------------------------- + +Python has a 'pymalloc' allocator optimized for small objects (smaller +or equal to 512 bytes) with a short lifetime. It uses memory mappings +called “arenas” with a fixed size of either 256 KiB on 32-bit platforms +or 1 MiB on 64-bit platforms. It falls back to *note PyMem_RawMalloc(): +38b. and *note PyMem_RawRealloc(): 38d. for allocations larger than 512 +bytes. + +'pymalloc' is the *note default allocator: 1d50. of the *note +PYMEM_DOMAIN_MEM: c69. (ex: *note PyMem_Malloc(): c66.) and *note +PYMEM_DOMAIN_OBJ: c67. (ex: *note PyObject_Malloc(): c68.) domains. + +The arena allocator uses the following functions: + + * ‘VirtualAlloc()’ and ‘VirtualFree()’ on Windows, + + * ‘mmap()’ and ‘munmap()’ if available, + + * ‘malloc()’ and ‘free()’ otherwise. + +This allocator is disabled if Python is configured with the *note +-without-pymalloc: 1db0. option. It can also be disabled at runtime +using the *note PYTHONMALLOC: c64. environment variable (ex: +‘PYTHONMALLOC=malloc’). + +Typically, it makes sense to disable the pymalloc allocator when +building Python with AddressSanitizer (*note -with-address-sanitizer: +1db8.) which helps uncover low level bugs within the C code. + +* Menu: + +* Customize pymalloc Arena Allocator:: + + +File: python.info, Node: Customize pymalloc Arena Allocator, Up: The pymalloc allocator + +7.11.9.1 Customize pymalloc Arena Allocator +........................................... + +Added in version 3.4. + + -- C Type: type PyObjectArenaAllocator + + Structure used to describe an arena allocator. The structure has + three fields: + + Field Meaning + + --------------------------------------------------------------------------------------------------- + + ‘void *ctx’ user context passed as first argument + + + ‘void* alloc(void *ctx, size_t size)’ allocate an arena of size bytes + + + ‘void free(void *ctx, void *ptr, size_t size)’ free an arena + + + -- C Function: void PyObject_GetArenaAllocator (PyObjectArenaAllocator + *allocator) + + Get the arena allocator. + + -- C Function: void PyObject_SetArenaAllocator (PyObjectArenaAllocator + *allocator) + + Set the arena allocator. + + +File: python.info, Node: The mimalloc allocator, Next: tracemalloc C API, Prev: The pymalloc allocator, Up: Memory Management + +7.11.10 The mimalloc allocator +------------------------------ + +Added in version 3.13. + +Python supports the mimalloc allocator when the underlying platform +support is available. mimalloc “is a general purpose allocator with +excellent performance characteristics. Initially developed by Daan +Leijen for the runtime systems of the Koka and Lean languages.” + + +File: python.info, Node: tracemalloc C API, Next: Examples<37>, Prev: The mimalloc allocator, Up: Memory Management + +7.11.11 tracemalloc C API +------------------------- + +Added in version 3.7. + + -- C Function: int PyTraceMalloc_Track (unsigned int domain, uintptr_t + ptr, size_t size) + + Track an allocated memory block in the *note tracemalloc: ff. + 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 Function: int PyTraceMalloc_Untrack (unsigned int domain, + uintptr_t ptr) + + Untrack an allocated memory block in the *note tracemalloc: ff. + module. Do nothing if the block was not tracked. + + Return ‘-2’ if tracemalloc is disabled, otherwise return ‘0’. + + +File: python.info, Node: Examples<37>, Prev: tracemalloc C API, Up: Memory Management + +7.11.12 Examples +---------------- + +Here is the example from section *note Overview: 4e1d, rewritten so that +the I/O buffer is allocated from the Python heap by using the first +function set: + + 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; + +The same code using the type-oriented function set: + + 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_Del(buf); /* allocated with PyMem_New */ + return res; + +Note that in the two examples above, the buffer is always manipulated +via functions belonging to the same set. Indeed, it is required to use +the same memory API family for a given memory block, so that the risk of +mixing different allocators is reduced to a minimum. The following code +sequence contains two errors, one of which is labeled as 'fatal' because +it mixes two different allocators operating on different heaps. + + 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_Del() */ + +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: 985, *note PyObject_NewVar: 986. and *note PyObject_Del(): +149c. + +These will be explained in the next chapter on defining and implementing +new object types in C. + + +File: python.info, Node: Object Implementation Support, Next: API and ABI Versioning, Prev: Memory Management, Up: Python/C API Reference Manual + +7.12 Object Implementation Support +================================== + +This chapter describes the functions, types, and macros used when +defining new object types. + +* Menu: + +* Allocating Objects on the Heap:: +* Common Object Structures:: +* Type Object Structures:: +* Supporting Cyclic Garbage Collection:: + + +File: python.info, Node: Allocating Objects on the Heap, Next: Common Object Structures, Up: Object Implementation Support + +7.12.1 Allocating Objects on the Heap +------------------------------------- + + -- C Function: *note PyObject: 334. *_PyObject_New (PyTypeObject *type) + 'Return value: New reference.' + + -- C Function: *note PyVarObject: 416a. *_PyObject_NewVar (PyTypeObject + *type, Py_ssize_t size) + 'Return value: New reference.' + + -- C Function: *note PyObject: 334. *PyObject_Init (PyObject *op, + PyTypeObject *type) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' Initialize a newly allocated object 'op' with its type and + initial reference. Returns the initialized object. Other fields + of the object are not affected. + + -- C Function: *note PyVarObject: 416a. *PyObject_InitVar (PyVarObject + *op, PyTypeObject *type, Py_ssize_t size) + 'Return value: Borrowed reference.'' Part of the *note Stable ABI: + 550.' This does everything *note PyObject_Init(): a6a. does, and + also initializes the length information for a variable-size object. + + -- C Macro: PyObject_New (TYPE, typeobj) + + Allocate a new Python object using the C structure type 'TYPE' and + the Python type object 'typeobj' (‘PyTypeObject*’). Fields not + defined by the Python object header are not initialized. The + caller will own the only reference to the object (i.e. its + reference count will be one). The size of the memory allocation is + determined from the *note tp_basicsize: 987. field of the type + object. + + Note that this function is unsuitable if 'typeobj' has *note + Py_TPFLAGS_HAVE_GC: 778. set. For such objects, use *note + PyObject_GC_New(): aa2. instead. + + -- C Macro: PyObject_NewVar (TYPE, typeobj, size) + + Allocate a new Python object using the C structure type 'TYPE' and + the Python type object 'typeobj' (‘PyTypeObject*’). Fields not + defined by the Python object header are not initialized. The + allocated memory allows for the 'TYPE' structure plus 'size' + (‘Py_ssize_t’) fields of the size given by the *note tp_itemsize: + 1f70. field of 'typeobj'. 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. + + Note that this function is unsuitable if 'typeobj' has *note + Py_TPFLAGS_HAVE_GC: 778. set. For such objects, use *note + PyObject_GC_NewVar(): aa3. instead. + + -- C Function: void PyObject_Del (void *op) + + Releases memory allocated to an object using *note PyObject_New: + 985. or *note PyObject_NewVar: 986. This is normally called from + the *note tp_dealloc: 48e8. handler specified in the object’s type. + The fields of the object should not be accessed after this call as + the memory is no longer a valid Python object. + + -- C Variable: *note PyObject: 334. _Py_NoneStruct + + Object which is visible in Python as ‘None’. This should only be + accessed using the *note Py_None: 48b9. macro, which evaluates to a + pointer to this object. + +See also +........ + +*note Module Objects: 4d09. + + To allocate and create extension modules. + + +File: python.info, Node: Common Object Structures, Next: Type Object Structures, Prev: Allocating Objects on the Heap, Up: Object Implementation Support + +7.12.2 Common Object Structures +------------------------------- + +There are a large number of structures which are used in the definition +of object types for Python. This section describes these structures and +how they are used. + +* 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 Structures + +7.12.2.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: 334. and *note PyVarObject: 416a. +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: 4b2c. + + -- C Type: type PyObject + ' Part of the *note Limited API: 550. (Only some members are part + of the stable ABI.)' All object types are extensions of this type. + This is a type which contains the information Python needs to treat + a pointer to an object as an object. In a normal “release” build, + it contains only the object’s reference count and a pointer to the + corresponding type object. Nothing is actually declared to be a + *note PyObject: 334, but every pointer to a Python object can be + cast to a *note PyObject: 334.*. Access to the members must be + done by using the macros *note Py_REFCNT: 8a8. and *note Py_TYPE: + 77b. + + -- C Type: type PyVarObject + ' Part of the *note Limited API: 550. (Only some members are part + of the stable ABI.)' This is an extension of *note PyObject: 334. + that adds the *note ob_size: 4ada. field. This is only used for + objects that have some notion of 'length'. This type does not + often appear in the Python/C API. Access to the members must be + done by using the macros *note Py_REFCNT: 8a8, *note Py_TYPE: 77b, + and *note Py_SIZE: 77d. + + -- C Macro: PyObject_HEAD + + This is a macro used when declaring new types which represent + objects without a varying length. The PyObject_HEAD macro expands + to: + + PyObject ob_base; + + See documentation of *note PyObject: 334. above. + + -- C Macro: PyObject_VAR_HEAD + + This is a macro used when declaring new types which represent + objects with a length that varies from instance to instance. The + PyObject_VAR_HEAD macro expands to: + + PyVarObject ob_base; + + See documentation of *note PyVarObject: 416a. above. + + -- C Variable: *note PyTypeObject: aa5. PyBaseObject_Type + ' Part of the *note Stable ABI: 550.' The base class of all other + objects, the same as *note object: a8c. in Python. + + -- C Function: int Py_Is (PyObject *x, PyObject *y) + ' Part of the *note Stable ABI: 550. since version 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 Function: int Py_IsNone (PyObject *x) + ' Part of the *note Stable ABI: 550. since version 3.10.' Test if + an object is the ‘None’ singleton, the same as ‘x is None’ in + Python. + + Added in version 3.10. + + -- C Function: int Py_IsTrue (PyObject *x) + ' Part of the *note Stable ABI: 550. since version 3.10.' Test if + an object is the ‘True’ singleton, the same as ‘x is True’ in + Python. + + Added in version 3.10. + + -- C Function: int Py_IsFalse (PyObject *x) + ' Part of the *note Stable ABI: 550. since version 3.10.' Test if + an object is the ‘False’ singleton, the same as ‘x is False’ in + Python. + + Added in version 3.10. + + -- C Function: *note PyTypeObject: aa5. *Py_TYPE (PyObject *o) + 'Return value: Borrowed reference.' Get the type of the Python + object 'o'. + + Return a *note borrowed reference: 339. + + Use the *note Py_SET_TYPE(): 77c. function to set an object type. + + Changed in version 3.11: *note Py_TYPE(): 77b. is changed to an + inline static function. The parameter type is no longer const + *note PyObject: 334.*. + + -- C Function: int Py_IS_TYPE (PyObject *o, PyTypeObject *type) + + Return non-zero if the object 'o' type is 'type'. Return zero + otherwise. Equivalent to: ‘Py_TYPE(o) == type’. + + Added in version 3.9. + + -- C Function: void Py_SET_TYPE (PyObject *o, PyTypeObject *type) + + Set the object 'o' type to 'type'. + + Added in version 3.9. + + -- C Function: *note Py_ssize_t: a5f. Py_SIZE (PyVarObject *o) + + Get the size of the Python object 'o'. + + Use the *note Py_SET_SIZE(): 77e. function to set an object size. + + Changed in version 3.11: *note Py_SIZE(): 77d. is changed to an + inline static function. The parameter type is no longer const + *note PyVarObject: 416a.*. + + -- C Function: void Py_SET_SIZE (PyVarObject *o, Py_ssize_t size) + + Set the object 'o' size to 'size'. + + Added in version 3.9. + + -- C Macro: PyObject_HEAD_INIT (type) + + This is a macro which expands to initialization values for a new + *note PyObject: 334. type. This macro expands to: + + _PyObject_EXTRA_INIT + 1, type, + + -- C Macro: PyVarObject_HEAD_INIT (type, size) + + This is a macro which expands to initialization values for a new + *note PyVarObject: 416a. type, including the *note ob_size: 4ada. + 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 Structures + +7.12.2.2 Implementing functions and methods +........................................... + + -- C Type: type PyCFunction + ' Part of the *note Stable ABI: 550.' Type of the functions used + to implement most Python callables in C. Functions of this type + take two *note PyObject: 334.* 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. + + The function signature is: + + PyObject *PyCFunction(PyObject *self, + PyObject *args); + + -- C Type: type PyCFunctionWithKeywords + ' Part of the *note Stable ABI: 550.' Type of the functions used + to implement Python callables in C with signature *note + METH_VARARGS | METH_KEYWORDS: 4e46. The function signature is: + + PyObject *PyCFunctionWithKeywords(PyObject *self, + PyObject *args, + PyObject *kwargs); + + -- C Type: type PyCFunctionFast + ' Part of the *note Stable ABI: 550. since version 3.13.' Type of + the functions used to implement Python callables in C with + signature *note METH_FASTCALL: 1627. The function signature is: + + PyObject *PyCFunctionFast(PyObject *self, + PyObject *const *args, + Py_ssize_t nargs); + + -- C Type: type PyCFunctionFastWithKeywords + ' Part of the *note Stable ABI: 550. since version 3.13.' Type of + the functions used to implement Python callables in C with + signature *note METH_FASTCALL | METH_KEYWORDS: 4e47. The function + signature is: + + PyObject *PyCFunctionFastWithKeywords(PyObject *self, + PyObject *const *args, + Py_ssize_t nargs, + PyObject *kwnames); + + -- C Type: type PyCMethod + + Type of the functions used to implement Python callables in C with + signature *note METH_METHOD | METH_FASTCALL | METH_KEYWORDS: 168e. + 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: type PyMethodDef + ' Part of the *note Stable ABI: 550. (including all members).' + Structure used to describe a method of an extension type. This + structure has four fields: + + -- C Member: const char *ml_name + + Name of the method. + + -- C Member: *note PyCFunction: 1440. ml_meth + + Pointer to the C implementation. + + -- C Member: int ml_flags + + Flags bits indicating how the call should be constructed. + + -- C Member: const char *ml_doc + + Points to the contents of the docstring. + +The *note ml_meth: 4e48. is a C function pointer. The functions may be +of different types, but they always return *note PyObject: 334.*. If +the function is not of the *note PyCFunction: 1440, the compiler will +require a cast in the method table. Even though *note PyCFunction: +1440. defines the first parameter as *note PyObject: 334.*, it is common +that the method implementation uses the specific C type of the 'self' +object. + +The *note ml_flags: 4e49. 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 Macro: METH_VARARGS + + This is the typical calling convention, where the methods have the + type *note PyCFunction: 1440. The function expects two *note + PyObject: 334.* values. The first one is the 'self' object for + methods; for module functions, it is the module object. The second + parameter (often called 'args') is a tuple object representing all + arguments. This parameter is typically processed using *note + PyArg_ParseTuple(): 56e. or *note PyArg_UnpackTuple(): 14d2. + + -- C Macro: METH_KEYWORDS + + Can only be used in certain combinations with other flags: *note + METH_VARARGS | METH_KEYWORDS: 4e46, *note METH_FASTCALL | + METH_KEYWORDS: 4e47. and *note METH_METHOD | METH_FASTCALL | + METH_KEYWORDS: 168e. + +*note METH_VARARGS: 14d4. | *note METH_KEYWORDS: 48bc. + + Methods with these flags must be of type *note + PyCFunctionWithKeywords: 4976. 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(): 37e. + + -- C Macro: METH_FASTCALL + + Fast calling convention supporting only positional arguments. The + methods have the type *note PyCFunctionFast: 4974. The first + parameter is 'self', the second parameter is a C array of *note + PyObject: 334.* values indicating the arguments and the third + parameter is the number of arguments (the length of the array). + + Added in version 3.7. + + Changed in version 3.10: ‘METH_FASTCALL’ is now part of the *note + stable ABI: 495b. + +*note METH_FASTCALL: 1627. | *note METH_KEYWORDS: 48bc. + + Extension of *note METH_FASTCALL: 1627. supporting also keyword + arguments, with methods of type *note PyCFunctionFastWithKeywords: + 4975. Keyword arguments are passed the same way as in the *note + vectorcall protocol: 54f.: there is an additional fourth *note + PyObject: 334.* 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 Macro: METH_METHOD + + Can only be used in the combination with other flags: *note + METH_METHOD | METH_FASTCALL | METH_KEYWORDS: 168e. + +*note METH_METHOD: 970. | *note METH_FASTCALL: 1627. | *note METH_KEYWORDS: 48bc. + + Extension of *note METH_FASTCALL | METH_KEYWORDS: 4e47. 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: 75f, the same as + for ‘METH_FASTCALL | METH_KEYWORDS’ with ‘defining_class’ argument + added after ‘self’. + + Added in version 3.9. + + -- C Macro: METH_NOARGS + + Methods without parameters don’t need to check whether arguments + are given if they are listed with the *note METH_NOARGS: 149f. + flag. They need to be of type *note PyCFunction: 1440. 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: 171c. can be used to prevent a compiler + warning. + + -- C Macro: METH_O + + Methods with a single object argument can be listed with the *note + METH_O: 14d3. flag, instead of invoking *note PyArg_ParseTuple(): + 56e. with a ‘"O"’ argument. They have the type *note PyCFunction: + 1440, with the 'self' parameter, and a *note PyObject: 334.* + parameter representing the single argument. + +These two constants are not used to indicate the calling convention but +the binding when use 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 Macro: METH_CLASS + + The method will be passed the type object as the first parameter + rather than an instance of the type. This is used to create 'class + methods', similar to what is created when using the *note + classmethod(): 166. built-in function. + + -- C Macro: METH_STATIC + + The method will be passed ‘NULL’ as the first parameter rather than + an instance of the type. This is used to create 'static methods', + similar to what is created when using the *note staticmethod(): + 412. built-in function. + +One other constant controls whether a method is loaded in place of +another definition with the same method name. + + -- C Macro: METH_COEXIST + + 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__(): 1f5e. 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 Function: *note PyObject: 334. *PyCMethod_New (PyMethodDef *ml, + PyObject *self, PyObject *module, PyTypeObject *cls) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.9.' Turn 'ml' into a Python *note callable: 28f7. + object. The caller must ensure that 'ml' outlives the *note + callable: 28f7. 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: 28f7. 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: 671. or + ‘NULL’. + + See also + ........ + + *note function.__module__: 1efe. + + The 'cls' parameter will be passed as the 'defining_class' argument + to the C function. Must be set if *note METH_METHOD: 970. is set + on ‘ml->ml_flags’. + + Added in version 3.9. + + -- C Function: *note PyObject: 334. *PyCFunction_NewEx (PyMethodDef + *ml, PyObject *self, PyObject *module) + 'Return value: New reference.'' Part of the *note Stable ABI: + 550.' Equivalent to ‘PyCMethod_New(ml, self, module, NULL)’. + + -- C Function: *note PyObject: 334. *PyCFunction_New (PyMethodDef *ml, + PyObject *self) + 'Return value: New reference.'' Part of the *note Stable ABI: 550. + since version 3.4.' Equivalent to ‘PyCMethod_New(ml, self, NULL, + NULL)’. + + +File: python.info, Node: Accessing attributes of extension types, Prev: Implementing functions and methods, Up: Common Object Structures + +7.12.2.3 Accessing attributes of extension types +................................................ + + -- C Type: type PyMemberDef + ' Part of the *note Stable ABI: 550. (including all members).' + 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: 48eb. slot. + + Its fields are, in order: + + -- C Member: 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 Member: int type + + The type of the member in the C struct. See *note Member + types: 1673. for the possible values. + + -- C Member: *note Py_ssize_t: a5f. offset + + The offset in bytes that the member is located on the type’s + object struct. + + -- C Member: int flags + + Zero or more of the *note Member flags: 4e4e, combined using + bitwise OR. + + -- C Member: 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: 180a. + + By default (when *note flags: 4904. is ‘0’), members allow both + read and write access. Use the *note Py_READONLY: 58e. flag for + read-only access. Certain types, like *note Py_T_STRING: 4e50, + imply *note Py_READONLY: 58e. Only *note Py_T_OBJECT_EX: 591. (and + legacy *note T_OBJECT: 590.) members can be deleted. For + heap-allocated types (created using *note PyType_FromSpec(): 57a. + or similar), ‘PyMemberDef’ may contain a definition for the special + member ‘"__vectorcalloffset__"’, corresponding to *note + tp_vectorcall_offset: 4baa. in type objects. These must be defined + with ‘Py_T_PYSSIZET’ and ‘Py_READONLY’, 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: 4c08. and *note + tp_weaklistoffset: 988. can be defined similarly using + ‘"__dictoffset__"’ and ‘"__weaklistoffset__"’ members, but + extensions are strongly encouraged to use *note + Py_TPFLAGS_MANAGED_DICT: 366. and *note Py_TPFLAGS_MANAGED_WEAKREF: + 557. instead. + + Changed in version 3.12: ‘PyMemberDef’ is always available. + Previously, it required including ‘"structmember.h"’. + + -- C Function: *note PyObject: 334. *PyMember_GetOne (const char + *obj_addr, struct PyMemberDef *m) + ' Part of the *note Stable ABI: 550.' Get an attribute belonging + to the object at address 'obj_addr'. The attribute is described by + ‘PyMemberDef’ 'm'. Returns ‘NULL’ on error. + + Changed in version 3.12: ‘PyMember_GetOne’ is always available. + Previously, it required including ‘"structmember.h"’. + + -- C Function: int PyMember_SetOne (char *obj_addr, struct PyMemberDef + *m, PyObject *o) + ' Part of the *note Stable ABI: 550.' 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. + + Changed in version 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.12.2.4 Member flags +..................... + +The following flags can be used with *note PyMemberDef.flags: 4904.: + + -- C Macro: Py_READONLY + + Not writable. + + -- C Macro: Py_AUDIT_READ + + Emit an ‘object.__getattr__’ *note audit event: 1870. before + reading. + + -- C Macro: Py_RELATIVE_OFFSET + + Indicates that the *note offset: 4e4d. of this ‘PyMemberDef’ entry + indicates an offset from the subclass-specific data, rather than + from ‘PyObject’. + + Can only be used as part of *note Py_tp_members: 48eb. *note slot: + 4a9b. when creating a class using negative *note basicsize: 545. + It is mandatory in that case. + + This flag is only used in *note PyType_Slot: 4a9b. When setting + *note tp_members: 48eb. during class creation, Python clears it and + sets *note PyMemberDef.offset: 4e4d. to the offset from the + ‘PyObject’ struct. + +Changed in version 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: 58f.; ‘WRITE_RESTRICTED’ does nothing. + +Changed in version 3.12: The ‘READONLY’ macro was renamed to *note +Py_READONLY: 58e. 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.12.2.5 Member types +..................... + +*note PyMemberDef.type: 4903. 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: 534. or *note +ValueError: 204. is raised. + +Unless marked (D), attributes defined this way cannot be deleted using +e.g. *note del: 17a6. or *note delattr(): 2154. + +Macro name C type Python type + +-------------------------------------------------------------------------------------------------- + + -- C Macro: Py_T_BYTE char *note int: 259. + + + -- C Macro: Py_T_SHORT short *note int: 259. + + + -- C Macro: Py_T_INT int *note int: 259. + + + -- C Macro: Py_T_LONG long *note int: 259. + + + -- C Macro: Py_T_LONGLONG long long *note int: 259. + + + -- C Macro: Py_T_UBYTE unsigned char *note int: 259. + + + -- C Macro: Py_T_UINT unsigned int *note int: 259. + + + -- C Macro: Py_T_USHORT unsigned short *note int: 259. + + + -- C Macro: Py_T_ULONG unsigned long *note int: 259. + + + -- C Macro: Py_T_ULONGLONG unsigned long long *note int: 259. + + + -- C Macro: Py_T_PYSSIZET *note Py_ssize_t: a5f. *note int: 259. + + + -- C Macro: Py_T_FLOAT float *note float: 2f1. + + + -- C Macro: Py_T_DOUBLE double *note float: 2f1. + + + -- C Macro: Py_T_BOOL char (written as 0 or 1) *note bool: 463. + + + -- C Macro: Py_T_STRING const char* (*) *note str: 447. (RO) + + + -- C Macro: Py_T_STRING_INPLACE const char[] (*) *note str: 447. (RO) + + + -- C Macro: Py_T_CHAR char (0-127) *note str: 447. (**) + + + -- C Macro: Py_T_OBJECT_EX *note PyObject: 334.* *note object: a8c. (D) + + + (*): 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: 58e. + + (D): Can be deleted, in which case the pointer is set to ‘NULL’. + Reading a ‘NULL’ pointer raises *note AttributeError: 348. + +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 Macro: 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 Macro: T_NONE + + Always ‘None’. Must be used with *note Py_READONLY: 58e. + + +File: python.info, Node: Defining Getters and Setters, Prev: Member types, Up: Accessing attributes of extension types + +7.12.2.6 Defining Getters and Setters +..................................... + + -- C Type: type PyGetSetDef + ' Part of the *note Stable ABI: 550. (including all members).' + Structure to define property-like access for a type. See also + description of the *note PyTypeObject.tp_getset: 48f0. slot. + + -- C Member: const char *name + + attribute name + + -- C Member: *note getter: 4af5. get + + C function to get the attribute. + + -- C Member: *note setter: 4b03. set + + Optional C function to set or delete the attribute. If + ‘NULL’, the attribute is read-only. + + -- C Member: const char *doc + + optional docstring + + -- C Member: void *closure + + Optional user data pointer, providing additional data for + getter and setter. + + -- C Type: typedef *note PyObject: 334. *(*getter)(*note PyObject: + 334.*, void*) + ' Part of the *note Stable ABI: 550.' The ‘get’ function takes one + *note PyObject: 334.* parameter (the instance) and a user data + pointer (the associated ‘closure’): + + It should return a new reference on success or ‘NULL’ with a set + exception on failure. + + -- C Type: typedef int (*setter)(*note PyObject: 334.*, *note PyObject: + 334.*, void*) + ' Part of the *note Stable ABI: 550.' ‘set’ functions take two + *note PyObject: 334.* parameters (the instance and the value to be + set) and a user data pointer (the associated ‘closure’): + + In case the attribute should be deleted the second parameter is + ‘NULL’. Should return ‘0’ on success or ‘-1’ with a set exception + on failure. + + +File: python.info, Node: Type Object Structures, Next: Supporting Cyclic Garbage Collection, Prev: Common Object Structures, Up: Object Implementation Support + +7.12.3 Type Object Structures +----------------------------- + +Perhaps one of the most important structures of the Python object system +is the structure that defines a new type: the *note PyTypeObject: aa5. +structure. Type objects can be handled using any of the ‘PyObject_*’ or +‘PyType_*’ functions, but do not offer much that’s interesting to most +Python applications. These objects are fundamental to how objects +behave, so they are very important to the interpreter itself and to any +extension module that implements new types. + +Type objects are fairly large compared to most of the standard types. +The reason for the size is that each type object stores a large number +of values, mostly C function pointers, each of which implements a small +part of the type’s functionality. The fields of the type object are +examined in detail in this section. The fields will be described in the +order in which they occur in the structure. + +In addition to the following quick reference, the *note Examples: 4e69. +section provides at-a-glance insight into the meaning and use of *note +PyTypeObject: aa5. + +* Menu: + +* Quick Reference:: +* PyTypeObject Definition:: +* PyObject Slots:: +* PyVarObject Slots:: +* PyTypeObject Slots:: +* Static Types:: +* Heap Types:: +* Number Object Structures:: +* Mapping Object Structures:: +* Sequence Object Structures:: +* Buffer Object Structures:: +* Async Object Structures:: +* Slot Type typedefs:: +* Examples: Examples<38>. + + +File: python.info, Node: Quick Reference, Next: PyTypeObject Definition, Up: Type Object Structures + +7.12.3.1 Quick Reference +........................ + +* Menu: + +* “tp slots”:: +* sub-slots:: +* slot typedefs:: + + +File: python.info, Node: “tp slots”, Next: sub-slots, Up: Quick Reference + +7.12.3.2 “tp slots” +................... + +PyTypeObject Slot *note Type: 4e6d. special Info +(1) methods/attrs (2) + +--------------------------------------------------------------------------------------------- + +O T D I + + +<R> const char * __name__ X X +*note tp_name: 18f2. + +*note tp_basicsize: 987.*note Py_ssize_t: a5f. X X X + + +*note tp_itemsize: 1f70.*note Py_ssize_t: a5f. X X + + +*note tp_dealloc: 48e8.*note destructor: 4af0. X X X + + +*note tp_vectorcall_offset: 4baa.*note Py_ssize_t: a5f. X X + + +(*note tp_getattr: 4906.)*note getattrfunc: 4af1.__getattribute__, G + __getattr__ + + +(*note tp_setattr: 4907.)*note setattrfunc: 4b01.__setattr__, G + __delattr__ + + +*note tp_as_async: ec8.*note PyAsyncMethods: 4c06.*note sub-slots: 4e6e. % + * + + +*note tp_repr: 48fd. *note reprfunc: 4aff. __repr__ X X X + + +*note tp_as_number: 98b.*note PyNumberMethods: 13e9.*note sub-slots: 4e6e. % + * + + +*note tp_as_sequence: 4e6f.*note PySequenceMethods: 490d.*note sub-slots: 4e6e. % + * + + +*note tp_as_mapping: 4e70.*note PyMappingMethods: 490e.*note sub-slots: 4e6e. % + * + + +*note tp_hash: 490f. *note hashfunc: 4af6. __hash__ X G + + +*note tp_call: 556. *note ternaryfunc: 4b06.__call__ X X + + +*note tp_str: 48fe. *note reprfunc: 4aff. __str__ X X + + +*note tp_getattro: 16f2.*note getattrofunc: 4af2.__getattribute__, X X G + __getattr__ + + +*note tp_setattro: 4901.*note setattrofunc: 4b02.__setattr__, X X G + __delattr__ + + +*note tp_as_buffer: 989.*note PyBufferProcs: 4c0e.*note sub-slots: 4e6e. % + * + + +*note tp_flags: 18bd. unsigned long X X ? + + +*note tp_doc: 48e4. const char * __doc__ X X + + +*note tp_traverse: 779.*note traverseproc: 4b07. X G + + +*note tp_clear: 48fb. *note inquiry: 4af8. X G + + +*note tp_richcompare: 4909.*note richcmpfunc: 4b00.__lt__, __le__, X G + __eq__, __ne__, + __gt__, __ge__ + + +(*note tp_weaklistoffset: 988.)*note Py_ssize_t: a5f. X ? + + +*note tp_iter: 14b9. *note getiterfunc: 4af4.__iter__ X + + +*note tp_iternext: 14ba.*note iternextfunc: 4af9.__next__ X + + +*note tp_methods: 48ed.*note PyMethodDef: 14a2. X X + [] + + +*note tp_members: 48eb.*note PyMemberDef: 54c. X + [] + + +*note tp_getset: 48f0. *note PyGetSetDef: bb8. X X + [] + + +*note tp_base: 48f4. *note PyTypeObject: aa5.__base__ X + * + + +*note tp_dict: 171e. *note PyObject: 334. __dict__ ? + * + + +*note tp_descr_get: 4e71.*note descrgetfunc: 4aee.__get__ X + + +*note tp_descr_set: 18f6.*note descrsetfunc: 4aef.__set__, __delete__ X + + +(*note tp_dictoffset: 4c08.)*note Py_ssize_t: a5f. X ? + + +*note tp_init: 57e. *note initproc: 4af7. __init__ X X X + + +*note tp_alloc: 48ea. *note allocfunc: 4aec. X ? ? + + +*note tp_new: 57c. *note newfunc: 4afb. __new__ X X ? ? + + +*note tp_free: 48e9. *note freefunc: 4d15. X X ? ? + + +*note tp_is_gc: 4e72. *note inquiry: 4af8. X X + + +<*note tp_bases: 4e73.>*note PyObject: 334. __bases__ ~ + * + + +<*note tp_mro: 4c0b.> *note PyObject: 334. __mro__ ~ + * + + +[*note tp_cache: 4c0c.]*note PyObject: 334. + * + + +[*note tp_subclasses: 56f.]void * __subclasses__ + + +[*note tp_weaklist: 4c0d.]*note PyObject: 334. + * + + +(*note tp_del: 4e74.) *note destructor: 4af0. + + +[*note tp_version_tag: 4e75.]unsigned int + + +*note tp_finalize: aa6.*note destructor: 4af0.__del__ X + + +*note tp_vectorcall: 4c0a.*note vectorcallfunc: 554. + + +[*note tp_watched: 4e76.]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) Columns: + +'“O”': set on *note PyBaseObject_Type: 4964. + +'“T”': set on *note PyType_Type: 54a. + +'“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: slot typedefs, Prev: “tp slots”, Up: Quick Reference + +7.12.3.3 sub-slots +.................. + +Slot *note Type: 4e6d. special + methods + +---------------------------------------------------------------------- + +*note am_await: 4e78. *note unaryfunc: 4b08.__await__ + + +*note am_aiter: 4e79. *note unaryfunc: 4b08.__aiter__ + + +*note am_anext: 4e7a. *note unaryfunc: 4b08.__anext__ + + +*note am_send: 4e7b. *note sendfunc: 4e7c. + + + +*note nb_add: 4bff. *note binaryfunc: 4aed.__add__ + __radd__ + + +*note nb_inplace_add: 4e7d. *note binaryfunc: 4aed.__iadd__ + + +*note nb_subtract: 4e7e. *note binaryfunc: 4aed.__sub__ + __rsub__ + + +*note nb_inplace_subtract: 4e7f.*note binaryfunc: 4aed.__isub__ + + +*note nb_multiply: 4e80. *note binaryfunc: 4aed.__mul__ + __rmul__ + + +*note nb_inplace_multiply: 4e81.*note binaryfunc: 4aed.__imul__ + + +*note nb_remainder: 4e82. *note binaryfunc: 4aed.__mod__ + __rmod__ + + +*note nb_inplace_remainder: 4e83.*note binaryfunc: 4aed.__imod__ + + +*note nb_divmod: 4e84. *note binaryfunc: 4aed.__divmod__ + __rdivmod__ + + +*note nb_power: 4e85. *note ternaryfunc: 4b06.__pow__ + __rpow__ + + +*note nb_inplace_power: 4e86. *note ternaryfunc: 4b06.__ipow__ + + +*note nb_negative: 4e87. *note unaryfunc: 4b08.__neg__ + + +*note nb_positive: 4e88. *note unaryfunc: 4b08.__pos__ + + +*note nb_absolute: 4e89. *note unaryfunc: 4b08.__abs__ + + +*note nb_bool: 4e8a. *note inquiry: 4af8. __bool__ + + +*note nb_invert: 4e8b. *note unaryfunc: 4b08.__invert__ + + +*note nb_lshift: 4e8c. *note binaryfunc: 4aed.__lshift__ + __rlshift__ + + +*note nb_inplace_lshift: 4e8d. *note binaryfunc: 4aed.__ilshift__ + + +*note nb_rshift: 4e8e. *note binaryfunc: 4aed.__rshift__ + __rrshift__ + + +*note nb_inplace_rshift: 4e8f. *note binaryfunc: 4aed.__irshift__ + + +*note nb_and: 4e90. *note binaryfunc: 4aed.__and__ + __rand__ + + +*note nb_inplace_and: 4e91. *note binaryfunc: 4aed.__iand__ + + +*note nb_xor: 4e92. *note binaryfunc: 4aed.__xor__ + __rxor__ + + +*note nb_inplace_xor: 4e93. *note binaryfunc: 4aed.__ixor__ + + +*note nb_or: 4e94. *note binaryfunc: 4aed.__or__ __ror__ + + +*note nb_inplace_or: 4e95. *note binaryfunc: 4aed.__ior__ + + +*note nb_int: 4e96. *note unaryfunc: 4b08.__int__ + + +*note nb_reserved: 4e97. void * + + +*note nb_float: 4e98. *note unaryfunc: 4b08.__float__ + + +*note nb_floor_divide: 4e99. *note binaryfunc: 4aed.__floordiv__ + + +*note nb_inplace_floor_divide: 4e9a.*note binaryfunc: 4aed.__ifloordiv__ + + +*note nb_true_divide: 4e9b. *note binaryfunc: 4aed.__truediv__ + + +*note nb_inplace_true_divide: 4e9c.*note binaryfunc: 4aed.__itruediv__ + + +*note nb_index: 13e8. *note unaryfunc: 4b08.__index__ + + +*note nb_matrix_multiply: 4e9d.*note binaryfunc: 4aed.__matmul__ + __rmatmul__ + + +*note nb_inplace_matrix_multiply: 4e9e.*note binaryfunc: 4aed.__imatmul__ + + + +*note mp_length: 4e9f. *note lenfunc: 4afa. __len__ + + +*note mp_subscript: 192d. *note binaryfunc: 4aed.__getitem__ + + +*note mp_ass_subscript: 4ea0. *note objobjargproc: 4afc.__setitem__, + __delitem__ + + + +*note sq_length: 4c07. *note lenfunc: 4afa. __len__ + + +*note sq_concat: 4ea1. *note binaryfunc: 4aed.__add__ + + +*note sq_repeat: 4ea2. *note ssizeargfunc: 4b04.__mul__ + + +*note sq_item: 192c. *note ssizeargfunc: 4b04.__getitem__ + + +*note sq_ass_item: 4ea3. *note ssizeobjargproc: 4b05.__setitem__ + __delitem__ + + +*note sq_contains: 4ea4. *note objobjproc: 4afd.__contains__ + + +*note sq_inplace_concat: 4ea5. *note binaryfunc: 4aed.__iadd__ + + +*note sq_inplace_repeat: 4ea6. *note ssizeargfunc: 4b04.__imul__ + + + +*note bf_getbuffer: 75d. *note getbufferproc(): 4af3.__buffer__ + + +*note bf_releasebuffer: 75e. *note releasebufferproc(): 4afe.__release_buffer__ + + + +File: python.info, Node: slot typedefs, Prev: sub-slots, Up: Quick Reference + +7.12.3.4 slot typedefs +...................... + +typedef Parameter Types Return Type + +----------------------------------------------------------------------------------------------- + +*note allocfunc: 4aec. *note PyTypeObject: aa5. * *note PyObject: 334. * + *note Py_ssize_t: a5f. + + +*note destructor: 4af0. *note PyObject: 334. * void + + +*note freefunc: 4d15. void * void + + +*note traverseproc: 4b07. *note PyObject: 334. * int + *note visitproc: 4b09. + void * + + +*note newfunc: 4afb. *note PyTypeObject: aa5. * *note PyObject: 334. * + *note PyObject: 334. * + *note PyObject: 334. * + + +*note initproc: 4af7. *note PyObject: 334. * int + *note PyObject: 334. * + *note PyObject: 334. * + + +*note reprfunc: 4aff. *note PyObject: 334. * *note PyObject: 334. * + + +*note getattrfunc: 4af1. *note PyObject: 334. * *note PyObject: 334. * + const char * + + +*note setattrfunc: 4b01. *note PyObject: 334. * int + const char * + *note PyObject: 334. * + + +*note getattrofunc: 4af2. *note PyObject: 334. * *note PyObject: 334. * + *note PyObject: 334. * + + +*note setattrofunc: 4b02. *note PyObject: 334. * int + *note PyObject: 334. * + *note PyObject: 334. * + + +*note descrgetfunc: 4aee. *note PyObject: 334. * *note PyObject: 334. * + *note PyObject: 334. * + *note PyObject: 334. * + + +*note descrsetfunc: 4aef. *note PyObject: 334. * int + *note PyObject: 334. * + *note PyObject: 334. * + + +*note hashfunc: 4af6. *note PyObject: 334. * Py_hash_t + + +*note richcmpfunc: 4b00. *note PyObject: 334. * *note PyObject: 334. * + *note PyObject: 334. * + int + + +*note getiterfunc: 4af4. *note PyObject: 334. * *note PyObject: 334. * + + +*note iternextfunc: 4af9. *note PyObject: 334. * *note PyObject: 334. * + + +*note lenfunc: 4afa. *note PyObject: 334. * *note Py_ssize_t: a5f. + + +*note getbufferproc: 4af3. *note PyObject: 334. * int + *note Py_buffer: 753. * + int + + +*note releasebufferproc: 4afe. *note PyObject: 334. * void + *note Py_buffer: 753. * + + +*note inquiry: 4af8. *note PyObject: 334. * int + + +*note unaryfunc: 4b08. *note PyObject: 334. * *note PyObject: 334. * + + +*note binaryfunc: 4aed. *note PyObject: 334. * *note PyObject: 334. * + *note PyObject: 334. * + + +*note ternaryfunc: 4b06. *note PyObject: 334. * *note PyObject: 334. * + *note PyObject: 334. * + *note PyObject: 334. * + + +*note ssizeargfunc: 4b04. *note PyObject: 334. * *note PyObject: 334. * + *note Py_ssize_t: a5f. + + +*note ssizeobjargproc: 4b05. *note PyObject: 334. * int + *note Py_ssize_t: a5f. + *note PyObject: 334. * + + +*note objobjproc: 4afd. *note PyObject: 334. * int + *note PyObject: 334. * + + +*note objobjargproc: 4afc. *note PyObject: 334. * int + *note PyObject: 334. * + *note PyObject: 334. * + + +See *note Slot Type typedefs: 4ea8. below for more detail. + + +File: python.info, Node: PyTypeObject Definition, Next: PyObject Slots, Prev: Quick Reference, Up: Type Object Structures + +7.12.3.5 PyTypeObject Definition +................................ + +The structure definition for *note PyTypeObject: aa5. 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 */ + struct PyMethodDef *tp_methods; + struct PyMemberDef *tp_members; + struct PyGetSetDef *tp_getset; + // Strong reference on a heap type, borrowed reference on a static type + struct _typeobject *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; + PyObject *tp_subclasses; + PyObject *tp_weaklist; + destructor tp_del; + + /* Type attribute cache version tag. Added in version 2.6 */ + unsigned int tp_version_tag; + + destructor tp_finalize; + vectorcallfunc tp_vectorcall; + + /* bitset of which type-watchers care about this type */ + unsigned char tp_watched; + } PyTypeObject; + + +File: python.info, Node: PyObject Slots, Next: PyVarObject Slots, Prev: PyTypeObject Definition, Up: Type Object Structures + +7.12.3.6 PyObject Slots +....................... + +The type object structure extends the *note PyVarObject: 416a. +structure. The *note ob_size: 4ada. field is used for dynamic types +(created by ‘type_new()’, usually called from a class statement). Note +that *note PyType_Type: 54a. (the metatype) initializes *note +tp_itemsize: 1f70, which means that its instances (i.e. type objects) +'must' have the *note ob_size: 4ada. field. + + -- C Member: *note Py_ssize_t: a5f. *note PyObject: 334.ob_refcnt + ' Part of the *note Stable ABI: 550.' This is the type object’s + reference count, initialized to ‘1’ by the ‘PyObject_HEAD_INIT’ + macro. Note that for *note statically allocated type objects: 77a, + the type’s instances (objects whose *note ob_type: 48e6. points + back to the type) do 'not' count as references. But for *note + dynamically allocated type objects: 965, the instances 'do' count + as references. + + 'Inheritance:' + + This field is not inherited by subtypes. + + -- C Member: *note PyTypeObject: aa5. **note PyObject: 334.ob_type + ' Part of the *note Stable ABI: 550.' This is the type’s type, in + other words its metatype. It is initialized by the argument to the + ‘PyObject_HEAD_INIT’ macro, and its value should normally be + ‘&PyType_Type’. However, for dynamically loadable extension + modules that must be usable on Windows (at least), the compiler + complains that this is not a valid initializer. Therefore, the + convention is to pass ‘NULL’ to the ‘PyObject_HEAD_INIT’ macro and + to initialize this field explicitly at the start of the module’s + initialization function, before doing anything else. This is + typically done like this: + + Foo_Type.ob_type = &PyType_Type; + + This should be done before any instances of the type are created. + *note PyType_Ready(): 777. checks if *note ob_type: 48e6. is + ‘NULL’, and if so, initializes it to the *note ob_type: 48e6. field + of the base class. *note PyType_Ready(): 777. will not change this + field if it is non-zero. + + 'Inheritance:' + + This field is inherited by subtypes. + + +File: python.info, Node: PyVarObject Slots, Next: PyTypeObject Slots, Prev: PyObject Slots, Up: Type Object Structures + +7.12.3.7 PyVarObject Slots +.......................... + + -- C Member: *note Py_ssize_t: a5f. *note PyVarObject: 416a.ob_size + ' Part of the *note Stable ABI: 550.' For *note statically + allocated type objects: 77a, this should be initialized to zero. + For *note dynamically allocated type objects: 965, this field has a + special internal meaning. + + This field should be accessed using the *note Py_SIZE(): 77d. and + *note Py_SET_SIZE(): 77e. macros. + + 'Inheritance:' + + This field is not inherited by subtypes. + + +File: python.info, Node: PyTypeObject Slots, Next: Static Types, Prev: PyVarObject Slots, Up: Type Object Structures + +7.12.3.8 PyTypeObject Slots +........................... + +Each slot has a section describing inheritance. If *note +PyType_Ready(): 777. 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: 4964. and *note PyType_Type: 54a. +effectively act as defaults.) + + -- C Member: const char **note PyTypeObject: aa5.tp_name + + Pointer to a NUL-terminated string containing the name of the type. + For types that are accessible as module globals, the string should + be the full module name, followed by a dot, followed by the type + name; for built-in types, it should be just the type name. If the + module is a submodule of a package, the full package name is part + of the full module name. For example, a type named ‘T’ defined in + module ‘M’ in subpackage ‘Q’ in package ‘P’ should have the *note + tp_name: 18f2. initializer ‘"P.Q.M.T"’. + + For *note dynamically allocated type objects: 965, this should just + be the type name, and the module name explicitly stored in the type + dict as the value for key ‘'__module__'’. + + For *note statically allocated type objects: 77a, the 'tp_name' + field should contain a dot. Everything before the last dot is made + accessible as the *note __module__: 36f. attribute, and everything + after the last dot is made accessible as the *note __name__: 1474. + attribute. + + If no dot is present, the entire *note tp_name: 18f2. field is made + accessible as the *note __name__: 1474. attribute, and the *note + __module__: 36f. 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(): aa5. (other than potentially *note + tp_itemsize: 1f70.). + + 'Inheritance:' + + This field is not inherited by subtypes. + + -- C Member: *note Py_ssize_t: a5f. *note PyTypeObject: + aa5.tp_basicsize + -- C Member: *note Py_ssize_t: a5f. *note PyTypeObject: aa5.tp_itemsize + + These fields allow calculating the size in bytes of instances of + the type. + + 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(): 1738.) + + For a type with variable-length instances, the instances must have + an *note ob_size: 4ada. 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(): 986. will take the value of + N as an argument, and store in the instance’s *note ob_size: 4ada. + field. Note that the *note ob_size: 4ada. field may later be used + for other purposes. For example, *note int: 259. instances use the + bits of *note ob_size: 4ada. in an implementation-defined way; the + underlying storage and its size should be accessed using + ‘PyLong_Export()’. + + Note: The *note ob_size: 4ada. field should be accessed using + the *note Py_SIZE(): 77d. and *note Py_SET_SIZE(): 77e. + macros. + + Also, the presence of an *note ob_size: 4ada. field in the instance + layout doesn’t mean that the instance structure is variable-length. + For example, the *note list: 60d. type has fixed-length instances, + yet those instances have a *note ob_size: 4ada. field. (As with + *note int: 259, avoid reading lists’ ‘ob_size’ directly. Call + *note PyList_Size(): 13e5. instead.) + + The ‘tp_basicsize’ includes size needed for data of the type’s + *note tp_base: 48f4, 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: a8c, this struct + must include *note PyObject: 334. or *note PyVarObject: 416a. + (depending on whether *note ob_size: 4ada. should be included). + These are usually defined by the macro *note PyObject_HEAD: 12d1. + or *note PyObject_VAR_HEAD: 4e42, respectively. + + The basic size does not include the GC header size, as that header + is not part of *note PyObject_HEAD: 12d1. + + For cases where struct used to declare the base type is unknown, + see *note PyType_Spec.basicsize: 545. and *note + PyType_FromMetaclass(): 54d. + + Notes about alignment: + + - ‘tp_basicsize’ must be a multiple of ‘_Alignof(PyObject)’. + When using ‘sizeof’ on a ‘struct’ that includes *note + PyObject_HEAD: 12d1, 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)’. + + 'Inheritance:' + + These fields are inherited separately by subtypes. (That is, if + the field is set to zero, *note PyType_Ready(): 777. 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: 1f70, it is + generally not safe to set *note tp_itemsize: 1f70. to a different + non-zero value in a subtype (though this depends on the + implementation of the base type). + + -- C Member: *note destructor: 4af0. *note PyTypeObject: aa5.tp_dealloc + + A pointer to the instance destructor function. This function must + be defined unless the type guarantees that its instances will never + be deallocated (as is the case for the singletons ‘None’ and + ‘Ellipsis’). The function signature is: + + void tp_dealloc(PyObject *self); + + The destructor function is called by the *note Py_DECREF(): 56c. + and *note Py_XDECREF(): 78a. macros when the new reference count is + zero. At this point, the instance is still in existence, but there + are no references to it. The destructor function should free all + references which the instance owns, free all memory buffers owned + by the instance (using the freeing function corresponding to the + allocation function used to allocate the buffer), and call the + type’s *note tp_free: 48e9. function. If the type is not + subtypable (doesn’t have the *note Py_TPFLAGS_BASETYPE: 48ee. flag + bit set), it is permissible to call the object deallocator directly + instead of via *note tp_free: 48e9. The object deallocator should + be the one used to allocate the instance; this is normally *note + PyObject_Del(): 149c. if the instance was allocated using *note + PyObject_New: 985. or *note PyObject_NewVar: 986, or *note + PyObject_GC_Del(): 14cf. if the instance was allocated using *note + PyObject_GC_New: aa2. or *note PyObject_GC_NewVar: aa3. + + If the type supports garbage collection (has the *note + Py_TPFLAGS_HAVE_GC: 778. flag bit set), the destructor should call + *note PyObject_GC_UnTrack(): 14d1. before clearing any member + fields. + + static void foo_dealloc(foo_object *self) { + PyObject_GC_UnTrack(self); + Py_CLEAR(self->ref); + Py_TYPE(self)->tp_free((PyObject *)self); + } + + Finally, if the type is heap allocated (*note Py_TPFLAGS_HEAPTYPE: + 8ae.), the deallocator should release the owned reference to its + type object (via *note Py_DECREF(): 56c.) after calling the type + deallocator. In order to avoid dangling pointers, the recommended + way to achieve this is: + + static void foo_dealloc(foo_object *self) { + PyTypeObject *tp = Py_TYPE(self); + // free references and buffers here + tp->tp_free(self); + Py_DECREF(tp); + } + + Warning: In a garbage collected Python, ‘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 will own the + Global Interpreter Lock (GIL). However, if the object being + destroyed in turn destroys objects from some other C or 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. + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: *note Py_ssize_t: a5f. *note PyTypeObject: + aa5.tp_vectorcall_offset + + An optional offset to a per-instance function that implements + calling the object using the *note vectorcall protocol: 54f, a more + efficient alternative of the simpler *note tp_call: 556. + + This field is only used if the flag *note + Py_TPFLAGS_HAVE_VECTORCALL: 551. is set. If so, this must be a + positive integer containing the offset in the instance of a *note + vectorcallfunc: 554. pointer. + + The 'vectorcallfunc' pointer may be ‘NULL’, in which case the + instance behaves as if *note Py_TPFLAGS_HAVE_VECTORCALL: 551. was + not set: calling the instance falls back to *note tp_call: 556. + + Any class that sets ‘Py_TPFLAGS_HAVE_VECTORCALL’ must also set + *note tp_call: 556. and make sure its behaviour is consistent with + the 'vectorcallfunc' function. This can be done by setting + 'tp_call' to *note PyVectorcall_Call(): 553. + + Changed in version 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. + + Changed in version 3.12: Before version 3.12, it was not + recommended for *note mutable heap types: 965. to implement the + vectorcall protocol. When a user sets *note __call__: 555. 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: 551. flag. + + 'Inheritance:' + + This field is always inherited. However, the *note + Py_TPFLAGS_HAVE_VECTORCALL: 551. flag is not always inherited. If + it’s not set, then the subclass won’t use *note vectorcall: 54f, + except when *note PyVectorcall_Call(): 553. is explicitly called. + + -- C Member: *note getattrfunc: 4af1. *note PyTypeObject: + aa5.tp_getattr + + An optional pointer to the get-attribute-string function. + + This field is deprecated. When it is defined, it should point to a + function that acts the same as the *note tp_getattro: 16f2. + function, but taking a C string instead of a Python string object + to give the attribute name. + + 'Inheritance:' + + Group: *note tp_getattr: 4906, *note tp_getattro: 16f2. + + This field is inherited by subtypes together with *note + tp_getattro: 16f2.: a subtype inherits both *note tp_getattr: 4906. + and *note tp_getattro: 16f2. from its base type when the subtype’s + *note tp_getattr: 4906. and *note tp_getattro: 16f2. are both + ‘NULL’. + + -- C Member: *note setattrfunc: 4b01. *note PyTypeObject: + aa5.tp_setattr + + An optional pointer to the function for setting and deleting + attributes. + + This field is deprecated. When it is defined, it should point to a + function that acts the same as the *note tp_setattro: 4901. + function, but taking a C string instead of a Python string object + to give the attribute name. + + 'Inheritance:' + + Group: *note tp_setattr: 4907, *note tp_setattro: 4901. + + This field is inherited by subtypes together with *note + tp_setattro: 4901.: a subtype inherits both *note tp_setattr: 4907. + and *note tp_setattro: 4901. from its base type when the subtype’s + *note tp_setattr: 4907. and *note tp_setattro: 4901. are both + ‘NULL’. + + -- C Member: *note PyAsyncMethods: 4c06. **note PyTypeObject: + aa5.tp_as_async + + Pointer to an additional structure that contains fields relevant + only to objects which implement *note awaitable: 1ad. and *note + asynchronous iterator: 1ab. protocols at the C-level. See *note + Async Object Structures: 4ead. for details. + + Added in version 3.5: Formerly known as ‘tp_compare’ and + ‘tp_reserved’. + + 'Inheritance:' + + The *note tp_as_async: ec8. field is not inherited, but the + contained fields are inherited individually. + + -- C Member: *note reprfunc: 4aff. *note PyTypeObject: aa5.tp_repr + + An optional pointer to a function that implements the built-in + function *note repr(): 7f9. + + The signature is the same as for *note PyObject_Repr(): 1028.: + + PyObject *tp_repr(PyObject *self); + + The function must return a string or a Unicode object. Ideally, + this function should return a string that, when passed to *note + eval(): 180, given a suitable environment, returns an object with + the same value. If this is not feasible, it should return a string + starting with ‘'<'’ and ending with ‘'>'’ from which both the type + and the value of the object can be deduced. + + 'Inheritance:' + + This field is inherited by subtypes. + + 'Default:' + + When this field is not set, a string of the form ‘<%s object at + %p>’ is returned, where ‘%s’ is replaced by the type name, and ‘%p’ + by the object’s memory address. + + -- C Member: *note PyNumberMethods: 13e9. **note PyTypeObject: + aa5.tp_as_number + + Pointer to an additional structure that contains fields relevant + only to objects which implement the number protocol. These fields + are documented in *note Number Object Structures: 4eae. + + 'Inheritance:' + + The *note tp_as_number: 98b. field is not inherited, but the + contained fields are inherited individually. + + -- C Member: *note PySequenceMethods: 490d. **note PyTypeObject: + aa5.tp_as_sequence + + Pointer to an additional structure that contains fields relevant + only to objects which implement the sequence protocol. These + fields are documented in *note Sequence Object Structures: 4eaf. + + 'Inheritance:' + + The *note tp_as_sequence: 4e6f. field is not inherited, but the + contained fields are inherited individually. + + -- C Member: *note PyMappingMethods: 490e. **note PyTypeObject: + aa5.tp_as_mapping + + Pointer to an additional structure that contains fields relevant + only to objects which implement the mapping protocol. These fields + are documented in *note Mapping Object Structures: 4eb0. + + 'Inheritance:' + + The *note tp_as_mapping: 4e70. field is not inherited, but the + contained fields are inherited individually. + + -- C Member: *note hashfunc: 4af6. *note PyTypeObject: aa5.tp_hash + + An optional pointer to a function that implements the built-in + function *note hash(): 5e7. + + The signature is the same as for *note PyObject_Hash(): 3ff.: + + Py_hash_t tp_hash(PyObject *); + + The value ‘-1’ should not be returned as a normal return value; + when an error occurs during the computation of the hash value, the + function should set an exception and return ‘-1’. + + When this field is not set ('and' *note tp_richcompare: 4909. is + not set), an attempt to take the hash of the object raises *note + TypeError: 534. This is the same as setting it to *note + PyObject_HashNotImplemented(): 1392. + + This field can be set explicitly to *note + PyObject_HashNotImplemented(): 1392. to block inheritance of the + hash method from a parent type. This is interpreted as the + equivalent of ‘__hash__ = None’ at the Python level, causing + ‘isinstance(o, collections.Hashable)’ to correctly return ‘False’. + Note that the converse is also true - setting ‘__hash__ = None’ on + a class at the Python level will result in the ‘tp_hash’ slot being + set to *note PyObject_HashNotImplemented(): 1392. + + 'Inheritance:' + + Group: *note tp_hash: 490f, *note tp_richcompare: 4909. + + This field is inherited by subtypes together with *note + tp_richcompare: 4909.: a subtype inherits both of *note + tp_richcompare: 4909. and *note tp_hash: 490f, when the subtype’s + *note tp_richcompare: 4909. and *note tp_hash: 490f. are both + ‘NULL’. + + 'Default:' + + *note PyBaseObject_Type: 4964. uses *note PyObject_GenericHash(): + 362. + + -- C Member: *note ternaryfunc: 4b06. *note PyTypeObject: aa5.tp_call + + An optional pointer to a function that implements calling the + object. This should be ‘NULL’ if the object is not callable. The + signature is the same as for *note PyObject_Call(): 398.: + + PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwargs); + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: *note reprfunc: 4aff. *note PyTypeObject: aa5.tp_str + + An optional pointer to a function that implements the built-in + operation *note str(): 447. (Note that *note str: 447. is a type + now, and *note str(): 447. calls the constructor for that type. + This constructor calls *note PyObject_Str(): 1029. to do the actual + work, and *note PyObject_Str(): 1029. will call this handler.) + + The signature is the same as for *note PyObject_Str(): 1029.: + + PyObject *tp_str(PyObject *self); + + The function must return a string or a Unicode object. It should + be a “friendly” string representation of the object, as this is the + representation that will be used, among other things, by the *note + print(): f70. function. + + 'Inheritance:' + + This field is inherited by subtypes. + + 'Default:' + + When this field is not set, *note PyObject_Repr(): 1028. is called + to return a string representation. + + -- C Member: *note getattrofunc: 4af2. *note PyTypeObject: + aa5.tp_getattro + + An optional pointer to the get-attribute function. + + The signature is the same as for *note PyObject_GetAttr(): 346.: + + PyObject *tp_getattro(PyObject *self, PyObject *attr); + + It is usually convenient to set this field to *note + PyObject_GenericGetAttr(): 4a5f, which implements the normal way of + looking for object attributes. + + 'Inheritance:' + + Group: *note tp_getattr: 4906, *note tp_getattro: 16f2. + + This field is inherited by subtypes together with *note tp_getattr: + 4906.: a subtype inherits both *note tp_getattr: 4906. and *note + tp_getattro: 16f2. from its base type when the subtype’s *note + tp_getattr: 4906. and *note tp_getattro: 16f2. are both ‘NULL’. + + 'Default:' + + *note PyBaseObject_Type: 4964. uses *note + PyObject_GenericGetAttr(): 4a5f. + + -- C Member: *note setattrofunc: 4b02. *note PyTypeObject: + aa5.tp_setattro + + An optional pointer to the function for setting and deleting + attributes. + + The signature is the same as for *note PyObject_SetAttr(): 4a68.: + + int tp_setattro(PyObject *self, PyObject *attr, PyObject *value); + + In addition, setting 'value' to ‘NULL’ to delete an attribute must + be supported. It is usually convenient to set this field to *note + PyObject_GenericSetAttr(): 4a60, which implements the normal way of + setting object attributes. + + 'Inheritance:' + + Group: *note tp_setattr: 4907, *note tp_setattro: 4901. + + This field is inherited by subtypes together with *note tp_setattr: + 4907.: a subtype inherits both *note tp_setattr: 4907. and *note + tp_setattro: 4901. from its base type when the subtype’s *note + tp_setattr: 4907. and *note tp_setattro: 4901. are both ‘NULL’. + + 'Default:' + + *note PyBaseObject_Type: 4964. uses *note + PyObject_GenericSetAttr(): 4a60. + + -- C Member: *note PyBufferProcs: 4c0e. **note PyTypeObject: + aa5.tp_as_buffer + + Pointer to an additional structure that contains fields relevant + only to objects which implement the buffer interface. These fields + are documented in *note Buffer Object Structures: 4bca. + + 'Inheritance:' + + The *note tp_as_buffer: 989. field is not inherited, but the + contained fields are inherited individually. + + -- C Member: unsigned long *note PyTypeObject: aa5.tp_flags + + This field is a bit mask of various flags. Some flags indicate + variant semantics for certain situations; others are used to + indicate that certain fields in the type object (or in the + extension structures referenced via *note tp_as_number: 98b, *note + tp_as_sequence: 4e6f, *note tp_as_mapping: 4e70, and *note + tp_as_buffer: 989.) that were historically not always present are + valid; if such a flag bit is clear, the type fields it guards must + not be accessed and must be considered to have a zero or ‘NULL’ + value instead. + + 'Inheritance:' + + 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: 778. flag bit is + inherited together with the *note tp_traverse: 779. and *note + tp_clear: 48fb. fields, i.e. if the *note Py_TPFLAGS_HAVE_GC: 778. + flag bit is clear in the subtype and the *note tp_traverse: 779. + and *note tp_clear: 48fb. fields in the subtype exist and have + ‘NULL’ values. .. XXX are most flag bits 'really' inherited + individually? + + 'Default:' + + *note PyBaseObject_Type: 4964. uses ‘Py_TPFLAGS_DEFAULT | + Py_TPFLAGS_BASETYPE’. + + 'Bit Masks:' + + The following bit masks are currently defined; these can be ORed + together using the ‘|’ operator to form the value of the *note + tp_flags: 18bd. field. The macro *note PyType_HasFeature(): 1953. + takes a type and a flags value, 'tp' and 'f', and checks whether + ‘tp->tp_flags & f’ is non-zero. + + -- C Macro: 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(): 57a. In this case, the *note ob_type: + 48e6. 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: 4eb1. as they can form a reference cycle with + their own module object. + + 'Inheritance:' + + ??? + + -- C Macro: Py_TPFLAGS_BASETYPE + + This bit is set when the type can be used as the base type of + another type. If this bit is clear, the type cannot be + subtyped (similar to a “final” class in Java). + + 'Inheritance:' + + ??? + + -- C Macro: Py_TPFLAGS_READY + + This bit is set when the type object has been fully + initialized by *note PyType_Ready(): 777. + + 'Inheritance:' + + ??? + + -- C Macro: Py_TPFLAGS_READYING + + This bit is set while *note PyType_Ready(): 777. is in the + process of initializing the type object. + + 'Inheritance:' + + ??? + + -- C Macro: Py_TPFLAGS_HAVE_GC + + This bit is set when the object supports garbage collection. + If this bit is set, instances must be created using *note + PyObject_GC_New: aa2. and destroyed using *note + PyObject_GC_Del(): 14cf. More information in section *note + Supporting Cyclic Garbage Collection: 4eb1. This bit also + implies that the GC-related fields *note tp_traverse: 779. and + *note tp_clear: 48fb. are present in the type object. + + 'Inheritance:' + + Group: *note Py_TPFLAGS_HAVE_GC: 778, *note tp_traverse: 779, + *note tp_clear: 48fb. + + The *note Py_TPFLAGS_HAVE_GC: 778. flag bit is inherited + together with the *note tp_traverse: 779. and *note tp_clear: + 48fb. fields, i.e. if the *note Py_TPFLAGS_HAVE_GC: 778. flag + bit is clear in the subtype and the *note tp_traverse: 779. + and *note tp_clear: 48fb. fields in the subtype exist and have + ‘NULL’ values. + + -- C Macro: Py_TPFLAGS_DEFAULT + + This is a bitmask of all the bits that pertain to the + existence of certain fields in the type object and its + extension structures. Currently, it includes the following + bits: ‘Py_TPFLAGS_HAVE_STACKLESS_EXTENSION’. + + 'Inheritance:' + + ??? + + -- C Macro: Py_TPFLAGS_METHOD_DESCRIPTOR + + 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. + + 'Inheritance:' + + This flag is never inherited by types without the *note + Py_TPFLAGS_IMMUTABLETYPE: 3be. flag set. For extension types, + it is inherited whenever *note tp_descr_get: 4e71. is + inherited. + + -- C Macro: Py_TPFLAGS_MANAGED_DICT + + This bit indicates that instances of the class have a *note + __dict__: 558. attribute, and that the space for the + dictionary is managed by the VM. + + If this flag is set, *note Py_TPFLAGS_HAVE_GC: 778. should + also be set. + + The type traverse function must call *note + PyObject_VisitManagedDict(): 364. and its clear function must + call *note PyObject_ClearManagedDict(): 365. + + Added in version 3.12. + + 'Inheritance:' + + This flag is inherited unless the *note tp_dictoffset: 4c08. + field is set in a superclass. + + -- C Macro: Py_TPFLAGS_MANAGED_WEAKREF + + This bit indicates that instances of the class should be + weakly referenceable. + + Added in version 3.12. + + 'Inheritance:' + + This flag is inherited unless the *note tp_weaklistoffset: + 988. field is set in a superclass. + + -- C Macro: Py_TPFLAGS_ITEMS_AT_END + + Only usable with variable-size types, i.e. ones with non-zero + *note tp_itemsize: 1f70. + + 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. + + 'Inheritance:' + + This flag is inherited. + + -- C Macro: Py_TPFLAGS_LONG_SUBCLASS + + -- C Macro: Py_TPFLAGS_LIST_SUBCLASS + + -- C Macro: Py_TPFLAGS_TUPLE_SUBCLASS + + -- C Macro: Py_TPFLAGS_BYTES_SUBCLASS + + -- C Macro: Py_TPFLAGS_UNICODE_SUBCLASS + + -- C Macro: Py_TPFLAGS_DICT_SUBCLASS + + -- C Macro: Py_TPFLAGS_BASE_EXC_SUBCLASS + + -- C Macro: Py_TPFLAGS_TYPE_SUBCLASS + + These flags are used by functions such as *note + PyLong_Check(): 4c18. 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(): e9f. + Custom types that inherit from built-ins should have their + *note tp_flags: 18bd. set appropriately, or the code that + interacts with such types will behave differently depending on + what kind of check is used. + + -- C Macro: Py_TPFLAGS_HAVE_FINALIZE + + This bit is set when the *note tp_finalize: aa6. slot is + present in the type structure. + + Added in version 3.4. + + Deprecated since version 3.8: This flag isn’t necessary + anymore, as the interpreter assumes the *note tp_finalize: + aa6. slot is always present in the type structure. + + -- C Macro: Py_TPFLAGS_HAVE_VECTORCALL + + This bit is set when the class implements the *note vectorcall + protocol: 54f. See *note tp_vectorcall_offset: 4baa. for + details. + + 'Inheritance:' + + This bit is inherited if *note tp_call: 556. is also + inherited. + + Added in version 3.9. + + Changed in version 3.12: This flag is now removed from a class + when the class’s *note __call__(): 555. method is reassigned. + + This flag can now be inherited by mutable classes. + + -- C Macro: Py_TPFLAGS_IMMUTABLETYPE + + This bit is set for type objects that are immutable: type + attributes cannot be set nor deleted. + + *note PyType_Ready(): 777. automatically applies this flag to + *note static types: 77a. + + 'Inheritance:' + + This flag is not inherited. + + Added in version 3.10. + + -- C Macro: Py_TPFLAGS_DISALLOW_INSTANTIATION + + Disallow creating instances of the type: set *note tp_new: + 57c. 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(): 777. is + called on the type. + + The flag is set automatically on *note static types: 77a. if + *note tp_base: 48f4. is NULL or ‘&PyBaseObject_Type’ and *note + tp_new: 57c. is NULL. + + 'Inheritance:' + + This flag is not inherited. However, subclasses will not be + instantiable unless they provide a non-NULL *note tp_new: 57c. + (which is only possible via the C API). + + Note: To disallow instantiating a class directly but + allow instantiating its subclasses (e.g. for an *note + abstract base class: 11a8.), do not use this flag. + Instead, make *note tp_new: 57c. only succeed for + subclasses. + + Added in version 3.10. + + -- C Macro: Py_TPFLAGS_MAPPING + + This bit indicates that instances of the class may match + mapping patterns when used as the subject of a *note match: + 809. block. It is automatically set when registering or + subclassing *note collections.abc.Mapping: 8c9, and unset when + registering *note collections.abc.Sequence: 11b6. + + Note: *note Py_TPFLAGS_MAPPING: 18a3. and *note + Py_TPFLAGS_SEQUENCE: 18a4. are mutually exclusive; it is + an error to enable both flags simultaneously. + + 'Inheritance:' + + This flag is inherited by types that do not already set *note + Py_TPFLAGS_SEQUENCE: 18a4. + + See also + ........ + + PEP 634(1) – Structural Pattern Matching: Specification + + Added in version 3.10. + + -- C Macro: Py_TPFLAGS_SEQUENCE + + This bit indicates that instances of the class may match + sequence patterns when used as the subject of a *note match: + 809. block. It is automatically set when registering or + subclassing *note collections.abc.Sequence: 11b6, and unset + when registering *note collections.abc.Mapping: 8c9. + + Note: *note Py_TPFLAGS_MAPPING: 18a3. and *note + Py_TPFLAGS_SEQUENCE: 18a4. are mutually exclusive; it is + an error to enable both flags simultaneously. + + 'Inheritance:' + + This flag is inherited by types that do not already set *note + Py_TPFLAGS_MAPPING: 18a3. + + See also + ........ + + PEP 634(2) – Structural Pattern Matching: Specification + + Added in version 3.10. + + -- C Macro: Py_TPFLAGS_VALID_VERSION_TAG + + Internal. Do not set or unset this flag. To indicate that a + class has changed call *note PyType_Modified(): 17f1. + + Warning: This flag is present in header files, but is not + be used. It will be removed in a future version of + CPython + + -- C Member: const char **note PyTypeObject: aa5.tp_doc + + An optional pointer to a NUL-terminated C string giving the + docstring for this type object. This is exposed as the *note + __doc__: 1cac. attribute on the type and instances of the type. + + 'Inheritance:' + + This field is 'not' inherited by subtypes. + + -- C Member: *note traverseproc: 4b07. *note PyTypeObject: + aa5.tp_traverse + + An optional pointer to a traversal function for the garbage + collector. This is only used if the *note Py_TPFLAGS_HAVE_GC: 778. + flag bit is set. The signature is: + + int tp_traverse(PyObject *self, visitproc visit, void *arg); + + More information about Python’s garbage collection scheme can be + found in section *note Supporting Cyclic Garbage Collection: 4eb1. + + The *note tp_traverse: 779. pointer is used by the garbage + collector to detect reference cycles. A typical implementation of + a *note tp_traverse: 779. function simply calls *note Py_VISIT(): + 48f2. on each of the instance’s members that are Python objects + that the instance owns. For example, this is function + ‘local_traverse()’ from the ‘_thread’ extension module: + + static int + local_traverse(localobject *self, visitproc visit, void *arg) + { + Py_VISIT(self->args); + Py_VISIT(self->kw); + Py_VISIT(self->dict); + return 0; + } + + Note that *note Py_VISIT(): 48f2. is called only on those members + that can participate in reference cycles. Although there is also a + ‘self->key’ member, it can only be ‘NULL’ or a Python string and + therefore cannot be part of a reference cycle. + + On the other hand, even if you know a member can never be part of a + cycle, as a debugging aid you may want to visit it anyway just so + the *note gc: 60. module’s *note get_referents(): 801. function + will include it. + + Heap types (*note Py_TPFLAGS_HEAPTYPE: 8ae.) must visit their type + with: + + Py_VISIT(Py_TYPE(self)); + + It is only needed since Python 3.9. To support Python 3.8 and + older, this line must be conditional: + + #if PY_VERSION_HEX >= 0x03090000 + Py_VISIT(Py_TYPE(self)); + #endif + + If the *note Py_TPFLAGS_MANAGED_DICT: 366. bit is set in the *note + tp_flags: 18bd. field, the traverse function must call *note + PyObject_VisitManagedDict(): 364. like this: + + PyObject_VisitManagedDict((PyObject*)self, visit, arg); + + Warning: When implementing *note tp_traverse: 779, only the + members that the instance 'owns' (by having *note strong + references: 338. to them) must be visited. For instance, if + an object supports weak references via the *note tp_weaklist: + 4c0d. slot, the pointer supporting the linked list (what + 'tp_weaklist' points to) must 'not' be visited as the instance + does not directly own the weak references to itself (the + weakreference list is there to support the weak reference + machinery, but the instance has no strong reference to the + elements inside it, as they are allowed to be removed even if + the instance is still alive). + + Note that *note Py_VISIT(): 48f2. 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: 965. hold a reference to + their type. Their traversal function must therefore either visit + *note Py_TYPE(self): 77b, or delegate this responsibility by + calling ‘tp_traverse’ of another heap-allocated type (such as a + heap-allocated superclass). If they do not, the type object may + not be garbage-collected. + + Changed in version 3.9: Heap-allocated types are expected to visit + ‘Py_TYPE(self)’ in ‘tp_traverse’. In earlier versions of Python, + due to bug 40217(3), doing this may lead to crashes in subclasses. + + 'Inheritance:' + + Group: *note Py_TPFLAGS_HAVE_GC: 778, *note tp_traverse: 779, *note + tp_clear: 48fb. + + This field is inherited by subtypes together with *note tp_clear: + 48fb. and the *note Py_TPFLAGS_HAVE_GC: 778. flag bit: the flag + bit, *note tp_traverse: 779, and *note tp_clear: 48fb. are all + inherited from the base type if they are all zero in the subtype. + + -- C Member: *note inquiry: 4af8. *note PyTypeObject: aa5.tp_clear + + An optional pointer to a clear function for the garbage collector. + This is only used if the *note Py_TPFLAGS_HAVE_GC: 778. flag bit is + set. The signature is: + + int tp_clear(PyObject *); + + The *note tp_clear: 48fb. member function is used to break + reference cycles in cyclic garbage detected by the garbage + collector. Taken together, all *note tp_clear: 48fb. functions in + the system must combine to break all reference cycles. This is + subtle, and if in any doubt supply a *note tp_clear: 48fb. + function. For example, the tuple type does not implement a *note + tp_clear: 48fb. function, because it’s possible to prove that no + reference cycle can be composed entirely of tuples. Therefore the + *note tp_clear: 48fb. functions of other types must be sufficient + to break any cycle containing a tuple. This isn’t immediately + obvious, and there’s rarely a good reason to avoid implementing + *note tp_clear: 48fb. + + Implementations of *note tp_clear: 48fb. should drop the instance’s + references to those of its members that may be Python objects, and + set its pointers to those members to ‘NULL’, as in the following + example: + + static int + local_clear(localobject *self) + { + Py_CLEAR(self->key); + Py_CLEAR(self->args); + Py_CLEAR(self->kw); + Py_CLEAR(self->dict); + return 0; + } + + The *note Py_CLEAR(): 575. macro should be used, because clearing + references is delicate: the reference to the contained object must + not be released (via *note Py_DECREF(): 56c.) until after the + pointer to the contained object is set to ‘NULL’. This is because + releasing the reference may cause the contained object to become + trash, triggering a chain of reclamation activity that may include + invoking arbitrary Python code (due to finalizers, or weakref + callbacks, associated with the contained object). If it’s possible + for such code to reference 'self' again, it’s important that the + pointer to the contained object be ‘NULL’ at that time, so that + 'self' knows the contained object can no longer be used. The *note + Py_CLEAR(): 575. macro performs the operations in a safe order. + + If the *note Py_TPFLAGS_MANAGED_DICT: 366. bit is set in the *note + tp_flags: 18bd. field, the traverse function must call *note + PyObject_ClearManagedDict(): 365. like this: + + PyObject_ClearManagedDict((PyObject*)self); + + Note that *note tp_clear: 48fb. is not 'always' called before an + instance is deallocated. For example, when reference counting is + enough to determine that an object is no longer used, the cyclic + garbage collector is not involved and *note tp_dealloc: 48e8. is + called directly. + + Because the goal of *note tp_clear: 48fb. functions is to break + reference cycles, it’s not necessary to clear contained objects + like Python strings or Python integers, which can’t participate in + reference cycles. On the other hand, it may be convenient to clear + all contained Python objects, and write the type’s *note + tp_dealloc: 48e8. function to invoke *note tp_clear: 48fb. + + More information about Python’s garbage collection scheme can be + found in section *note Supporting Cyclic Garbage Collection: 4eb1. + + 'Inheritance:' + + Group: *note Py_TPFLAGS_HAVE_GC: 778, *note tp_traverse: 779, *note + tp_clear: 48fb. + + This field is inherited by subtypes together with *note + tp_traverse: 779. and the *note Py_TPFLAGS_HAVE_GC: 778. flag bit: + the flag bit, *note tp_traverse: 779, and *note tp_clear: 48fb. are + all inherited from the base type if they are all zero in the + subtype. + + -- C Member: *note richcmpfunc: 4b00. *note PyTypeObject: + aa5.tp_richcompare + + An optional pointer to the rich comparison function, whose + signature is: + + 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: aa5. + + The function should return the result of the comparison (usually + ‘Py_True’ or ‘Py_False’). If the comparison is undefined, it must + return ‘Py_NotImplemented’, if another error occurred it must + return ‘NULL’ and set an exception condition. + + The following constants are defined to be used as the third + argument for *note tp_richcompare: 4909. and for *note + PyObject_RichCompare(): 490a.: + + Constant Comparison + + ------------------------------------------ + + -- C Macro: Py_LT ‘<’ + + + -- C Macro: Py_LE ‘<=’ + + + -- C Macro: Py_EQ ‘==’ + + + -- C Macro: Py_NE ‘!=’ + + + -- C Macro: Py_GT ‘>’ + + + -- C Macro: Py_GE ‘>=’ + + + The following macro is defined to ease writing rich comparison + functions: + + -- C Macro: Py_RETURN_RICHCOMPARE (VAL_A, VAL_B, op) + + Return ‘Py_True’ or ‘Py_False’ from the function, depending on + the result of a comparison. VAL_A and VAL_B must be orderable + by C comparison operators (for example, they may be C ints or + floats). The third argument specifies the requested + operation, as for *note PyObject_RichCompare(): 490a. + + The returned value is a new *note strong reference: 338. + + On error, sets an exception and returns ‘NULL’ from the + function. + + Added in version 3.7. + + 'Inheritance:' + + Group: *note tp_hash: 490f, *note tp_richcompare: 4909. + + This field is inherited by subtypes together with *note tp_hash: + 490f.: a subtype inherits *note tp_richcompare: 4909. and *note + tp_hash: 490f. when the subtype’s *note tp_richcompare: 4909. and + *note tp_hash: 490f. are both ‘NULL’. + + 'Default:' + + *note PyBaseObject_Type: 4964. provides a *note tp_richcompare: + 4909. implementation, which may be inherited. However, if only + *note tp_hash: 490f. is defined, not even the inherited function is + used and instances of the type will not be able to participate in + any comparisons. + + -- C Member: *note Py_ssize_t: a5f. *note PyTypeObject: + aa5.tp_weaklistoffset + + While this field is still supported, *note + Py_TPFLAGS_MANAGED_WEAKREF: 557. should be used instead, if at all + possible. + + If the instances of this type are weakly referenceable, this field + is greater than zero and contains the offset in the instance + structure of the weak reference list head (ignoring the GC header, + if present); this offset is used by *note PyObject_ClearWeakRefs(): + 573. and the ‘PyWeakref_*’ functions. The instance structure needs + to include a field of type *note PyObject: 334.* which is + initialized to ‘NULL’. + + Do not confuse this field with *note tp_weaklist: 4c0d.; that is + the list head for weak references to the type object itself. + + It is an error to set both the *note Py_TPFLAGS_MANAGED_WEAKREF: + 557. bit and *note tp_weaklistoffset: 988. + + 'Inheritance:' + + This field is inherited by subtypes, but see the rules listed + below. A subtype may override this offset; this means that the + subtype uses a different weak reference list head than the base + type. Since the list head is always found via *note + tp_weaklistoffset: 988, this should not be a problem. + + 'Default:' + + If the *note Py_TPFLAGS_MANAGED_WEAKREF: 557. bit is set in the + *note tp_flags: 18bd. field, then *note tp_weaklistoffset: 988. + will be set to a negative value, to indicate that it is unsafe to + use this field. + + -- C Member: *note getiterfunc: 4af4. *note PyTypeObject: aa5.tp_iter + + An optional pointer to a function that returns an *note iterator: + 1ac. for the object. Its presence normally signals that the + instances of this type are *note iterable: 121a. (although + sequences may be iterable without this function). + + This function has the same signature as *note PyObject_GetIter(): + 4a63.: + + PyObject *tp_iter(PyObject *self); + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: *note iternextfunc: 4af9. *note PyTypeObject: + aa5.tp_iternext + + An optional pointer to a function that returns the next item in an + *note iterator: 1ac. The signature is: + + PyObject *tp_iternext(PyObject *self); + + When the iterator is exhausted, it must return ‘NULL’; a *note + StopIteration: bfa. exception may or may not be set. When another + error occurs, it must return ‘NULL’ too. Its presence signals that + the instances of this type are iterators. + + Iterator types should also define the *note tp_iter: 14b9. + function, and that function should return the iterator instance + itself (not a new iterator instance). + + This function has the same signature as *note PyIter_Next(): 4a13. + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: struct *note PyMethodDef: 14a2. **note PyTypeObject: + aa5.tp_methods + + An optional pointer to a static ‘NULL’-terminated array of *note + PyMethodDef: 14a2. structures, declaring regular methods of this + type. + + For each entry in the array, an entry is added to the type’s + dictionary (see *note tp_dict: 171e. below) containing a method + descriptor. + + 'Inheritance:' + + This field is not inherited by subtypes (methods are inherited + through a different mechanism). + + -- C Member: struct *note PyMemberDef: 54c. **note PyTypeObject: + aa5.tp_members + + An optional pointer to a static ‘NULL’-terminated array of *note + PyMemberDef: 54c. structures, declaring regular data members + (fields or slots) of instances of this type. + + For each entry in the array, an entry is added to the type’s + dictionary (see *note tp_dict: 171e. below) containing a member + descriptor. + + 'Inheritance:' + + This field is not inherited by subtypes (members are inherited + through a different mechanism). + + -- C Member: struct *note PyGetSetDef: bb8. **note PyTypeObject: + aa5.tp_getset + + An optional pointer to a static ‘NULL’-terminated array of *note + PyGetSetDef: bb8. structures, declaring computed attributes of + instances of this type. + + For each entry in the array, an entry is added to the type’s + dictionary (see *note tp_dict: 171e. below) containing a getset + descriptor. + + 'Inheritance:' + + This field is not inherited by subtypes (computed attributes are + inherited through a different mechanism). + + -- C Member: *note PyTypeObject: aa5. **note PyTypeObject: aa5.tp_base + + An optional pointer to a base type from which type properties are + inherited. At this level, only single inheritance is supported; + multiple inheritance require dynamically creating a type object by + calling the metatype. + + Note: + Slot initialization is subject to the rules of initializing + globals. C99 requires the initializers to be “address + constants”. Function designators like *note + PyType_GenericNew(): 48e5, 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: 4964. 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: 48f4. should be set in the + extension module’s init function. + + 'Inheritance:' + + This field is not inherited by subtypes (obviously). + + 'Default:' + + This field defaults to ‘&PyBaseObject_Type’ (which to Python + programmers is known as the type *note object: a8c.). + + -- C Member: *note PyObject: 334. **note PyTypeObject: aa5.tp_dict + + The type’s dictionary is stored here by *note PyType_Ready(): 777. + + 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(): 777. 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__(): 1f8c.). + 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(): 171d. to retrieve the dictionary for an arbitrary + type. + + Changed in version 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(): 171d. + to get the dict for an arbitrary type. + + 'Inheritance:' + + This field is not inherited by subtypes (though the attributes + defined in here are inherited through a different mechanism). + + 'Default:' + + If this field is ‘NULL’, *note PyType_Ready(): 777. will assign a + new dictionary to it. + + Warning: It is not safe to use *note PyDict_SetItem(): 48d4. + on or otherwise modify *note tp_dict: 171e. with the + dictionary C-API. + + -- C Member: *note descrgetfunc: 4aee. *note PyTypeObject: + aa5.tp_descr_get + + An optional pointer to a “descriptor get” function. + + The function signature is: + + PyObject * tp_descr_get(PyObject *self, PyObject *obj, PyObject *type); + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: *note descrsetfunc: 4aef. *note PyTypeObject: + aa5.tp_descr_set + + An optional pointer to a function for setting and deleting a + descriptor’s value. + + The function signature is: + + int tp_descr_set(PyObject *self, PyObject *obj, PyObject *value); + + The 'value' argument is set to ‘NULL’ to delete the value. + + 'Inheritance:' + + This field is inherited by subtypes. + + -- C Member: *note Py_ssize_t: a5f. *note PyTypeObject: + aa5.tp_dictoffset + + While this field is still supported, *note Py_TPFLAGS_MANAGED_DICT: + 366. should be used instead, if at all possible. + + If the instances of this type have a dictionary containing instance + variables, this field is non-zero and contains the offset in the + instances of the type of the instance variable dictionary; this + offset is used by *note PyObject_GenericGetAttr(): 4a5f. + + Do not confuse this field with *note tp_dict: 171e.; that is the + dictionary for attributes of the type object itself. + + The value specifies the offset of the dictionary from the start of + the instance structure. + + The *note tp_dictoffset: 4c08. should be regarded as write-only. + To get the pointer to the dictionary call *note + PyObject_GenericGetDict(): 193a. Calling *note + PyObject_GenericGetDict(): 193a. may need to allocate memory for + the dictionary, so it is may be more efficient to call *note + PyObject_GetAttr(): 346. when accessing an attribute on the object. + + It is an error to set both the *note Py_TPFLAGS_MANAGED_DICT: 366. + bit and *note tp_dictoffset: 4c08. + + 'Inheritance:' + + 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: 366. + + 'Default:' + + This slot has no default. For *note static types: 77a, if the + field is ‘NULL’ then no *note __dict__: 558. gets created for + instances. + + If the *note Py_TPFLAGS_MANAGED_DICT: 366. bit is set in the *note + tp_flags: 18bd. field, then *note tp_dictoffset: 4c08. will be set + to ‘-1’, to indicate that it is unsafe to use this field. + + -- C Member: *note initproc: 4af7. *note PyTypeObject: aa5.tp_init + + An optional pointer to an instance initialization function. + + This function corresponds to the *note __init__(): 6ac. 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. + + The function signature is: + + 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__(): 6ac. + + The *note tp_init: 57e. function, if not ‘NULL’, is called when an + instance is created normally by calling its type, after the type’s + *note tp_new: 57c. function has returned an instance of the type. + If the *note tp_new: 57c. function returns an instance of some + other type that is not a subtype of the original type, no *note + tp_init: 57e. function is called; if *note tp_new: 57c. returns an + instance of a subtype of the original type, the subtype’s *note + tp_init: 57e. is called. + + Returns ‘0’ on success, ‘-1’ and sets an exception on error. + + 'Inheritance:' + + This field is inherited by subtypes. + + 'Default:' + + For *note static types: 77a. this field does not have a default. + + -- C Member: *note allocfunc: 4aec. *note PyTypeObject: aa5.tp_alloc + + An optional pointer to an instance allocation function. + + The function signature is: + + PyObject *tp_alloc(PyTypeObject *self, Py_ssize_t nitems); + + 'Inheritance:' + + This field is inherited by static subtypes, but not by dynamic + subtypes (subtypes created by a class statement). + + 'Default:' + + For dynamic subtypes, this field is always set to *note + PyType_GenericAlloc(): a6b, to force a standard heap allocation + strategy. + + For static subtypes, *note PyBaseObject_Type: 4964. uses *note + PyType_GenericAlloc(): a6b. That is the recommended value for all + statically defined types. + + -- C Member: *note newfunc: 4afb. *note PyTypeObject: aa5.tp_new + + An optional pointer to an instance creation function. + + The function signature is: + + PyObject *tp_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds); + + The 'subtype' argument is the type of the object being created; the + 'args' and 'kwds' arguments represent positional and keyword + arguments of the call to the type. Note that 'subtype' doesn’t + have to equal the type whose *note tp_new: 57c. function is called; + it may be a subtype of that type (but not an unrelated type). + + The *note tp_new: 57c. function should call + ‘subtype->tp_alloc(subtype, nitems)’ to allocate space for the + object, and then do only as much further initialization as is + absolutely necessary. Initialization that can safely be ignored or + repeated should be placed in the *note tp_init: 57e. handler. A + good rule of thumb is that for immutable types, all initialization + should take place in *note tp_new: 57c, while for mutable types, + most initialization should be deferred to *note tp_init: 57e. + + Set the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 57f. flag to + disallow creating instances of the type in Python. + + 'Inheritance:' + + This field is inherited by subtypes, except it is not inherited by + *note static types: 77a. whose *note tp_base: 48f4. is ‘NULL’ or + ‘&PyBaseObject_Type’. + + 'Default:' + + For *note static types: 77a. 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 Member: *note freefunc: 4d15. *note PyTypeObject: aa5.tp_free + + An optional pointer to an instance deallocation function. Its + signature is: + + void tp_free(void *self); + + An initializer that is compatible with this signature is *note + PyObject_Free(): c65. + + 'Inheritance:' + + This field is inherited by static subtypes, but not by dynamic + subtypes (subtypes created by a class statement) + + 'Default:' + + In dynamic subtypes, this field is set to a deallocator suitable to + match *note PyType_GenericAlloc(): a6b. and the value of the *note + Py_TPFLAGS_HAVE_GC: 778. flag bit. + + For static subtypes, *note PyBaseObject_Type: 4964. uses *note + PyObject_Del(): 149c. + + -- C Member: *note inquiry: 4af8. *note PyTypeObject: aa5.tp_is_gc + + An optional pointer to a function called by the garbage collector. + + 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: 18bd. field, and check the *note + Py_TPFLAGS_HAVE_GC: 778. 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); + + (The only example of this are types themselves. The metatype, + *note PyType_Type: 54a, defines this function to distinguish + between statically and *note dynamically allocated types: 965.) + + 'Inheritance:' + + This field is inherited by subtypes. + + 'Default:' + + This slot has no default. If this field is ‘NULL’, *note + Py_TPFLAGS_HAVE_GC: 778. is used as the functional equivalent. + + -- C Member: *note PyObject: 334. **note PyTypeObject: aa5.tp_bases + + Tuple of base types. + + This field should be set to ‘NULL’ and treated as read-only. + Python will fill it in when the type is *note initialized: 777. + + For dynamically created classes, the ‘Py_tp_bases’ *note slot: + 4a9b. can be used instead of the 'bases' argument of *note + PyType_FromSpecWithBases(): 57b. The argument form is preferred. + + Warning: 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. + + 'Inheritance:' + + This field is not inherited. + + -- C Member: *note PyObject: 334. **note PyTypeObject: aa5.tp_mro + + Tuple containing the expanded set of base types, starting with the + type itself and ending with *note object: a8c, in 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: 777. + + 'Inheritance:' + + This field is not inherited; it is calculated fresh by *note + PyType_Ready(): 777. + + -- C Member: *note PyObject: 334. **note PyTypeObject: aa5.tp_cache + + Unused. Internal use only. + + 'Inheritance:' + + This field is not inherited. + + -- C Member: void **note PyTypeObject: aa5.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__(): 570. + + Changed in version 3.12: For some types, this field does not hold a + valid *note PyObject: 334.*. The type was changed to void* to + indicate this. + + 'Inheritance:' + + This field is not inherited. + + -- C Member: *note PyObject: 334. **note PyTypeObject: aa5.tp_weaklist + + Weak reference list head, for weak references to this type object. + Not inherited. Internal use only. + + Changed in version 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. + + 'Inheritance:' + + This field is not inherited. + + -- C Member: *note destructor: 4af0. *note PyTypeObject: aa5.tp_del + + This field is deprecated. Use *note tp_finalize: aa6. instead. + + -- C Member: unsigned int *note PyTypeObject: aa5.tp_version_tag + + Used to index into the method cache. Internal use only. + + 'Inheritance:' + + This field is not inherited. + + -- C Member: *note destructor: 4af0. *note PyTypeObject: + aa5.tp_finalize + + An optional pointer to an instance finalization function. Its + signature is: + + void tp_finalize(PyObject *self); + + If *note tp_finalize: aa6. is set, the interpreter calls it once + when finalizing an instance. It is called either from the garbage + collector (if the instance is part of an isolated reference cycle) + or just before the object is deallocated. Either way, it is + guaranteed to be called before attempting to break reference + cycles, ensuring that it finds the object in a sane state. + + *note tp_finalize: aa6. should not mutate the current exception + status; therefore, a recommended way to write a non-trivial + finalizer is: + + static void + local_finalize(PyObject *self) + { + /* Save the current exception, if any. */ + PyObject *exc = PyErr_GetRaisedException(); + + /* ... */ + + /* Restore the saved exception. */ + PyErr_SetRaisedException(exc); + } + + 'Inheritance:' + + This field is inherited by subtypes. + + Added in version 3.4. + + Changed in version 3.8: Before version 3.8 it was necessary to set + the *note Py_TPFLAGS_HAVE_FINALIZE: 3ee. flags bit in order for + this field to be used. This is no longer required. + + See also + ........ + + “Safe object finalization” ( PEP 442(4)) + + -- C Member: *note vectorcallfunc: 554. *note PyTypeObject: + aa5.tp_vectorcall + + Vectorcall function to use for calls of this type object. In other + words, it is used to implement *note vectorcall: 54f. for + ‘type.__call__’. If ‘tp_vectorcall’ is ‘NULL’, the default call + implementation using *note __new__(): 57d. and *note __init__(): + 6ac. is used. + + 'Inheritance:' + + This field is never inherited. + + Added in version 3.9: (the field exists since 3.8 but it’s only + used since 3.9) + + -- C Member: unsigned char *note PyTypeObject: aa5.tp_watched + + Internal. Do not use. + + Added in version 3.12. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0634/ + + (2) https://peps.python.org/pep-0634/ + + (3) https://bugs.python.org/issue40217 + + (4) https://peps.python.org/pep-0442/ + + +File: python.info, Node: Static Types, Next: Heap Types, Prev: PyTypeObject Slots, Up: Type Object Structures + +7.12.3.9 Static Types +..................... + +Traditionally, types defined in C code are 'static', that is, a static +*note PyTypeObject: aa5. structure is defined directly in code and +initialized using *note PyType_Ready(): 777. + +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: 584, + so they should not include any subinterpreter-specific state. + +Also, since *note PyTypeObject: aa5. is only part of the *note Limited +API: 391. 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: Number Object Structures, Prev: Static Types, Up: Type Object Structures + +7.12.3.10 Heap Types +.................... + +An alternative to *note static types: 77a. 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: 8ae. flag set. + +This is done by filling a *note PyType_Spec: 171b. structure and calling +*note PyType_FromSpec(): 57a, *note PyType_FromSpecWithBases(): 57b, +*note PyType_FromModuleAndSpec(): 54e, or *note PyType_FromMetaclass(): +54d. + + +File: python.info, Node: Number Object Structures, Next: Mapping Object Structures, Prev: Heap Types, Up: Type Object Structures + +7.12.3.11 Number Object Structures +.................................. + + -- C Type: type PyNumberMethods + + This structure holds pointers to the functions which an object uses + to implement the number protocol. Each function is used by the + function of similar name documented in the *note Number Protocol: + 4bb5. section. + + Here is the structure definition: + + 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; + + Note: Binary and ternary functions must check the type of all + their operands, and implement the necessary conversions (at + least one of the operands is an instance of the defined type). + If the operation is not defined for the given operands, binary + and ternary functions must return ‘Py_NotImplemented’, if + another error occurred they must return ‘NULL’ and set an + exception. + + Note: The *note nb_reserved: 4e97. field should always be + ‘NULL’. It was previously called ‘nb_long’, and was renamed + in Python 3.0.1. + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: 13e9.nb_add + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_subtract + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_multiply + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_remainder + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_divmod + + -- C Member: *note ternaryfunc: 4b06. *note PyNumberMethods: + 13e9.nb_power + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_negative + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_positive + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_absolute + + -- C Member: *note inquiry: 4af8. *note PyNumberMethods: 13e9.nb_bool + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_invert + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_lshift + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_rshift + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: 13e9.nb_and + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: 13e9.nb_xor + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: 13e9.nb_or + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: 13e9.nb_int + + -- C Member: void **note PyNumberMethods: 13e9.nb_reserved + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_float + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_add + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_subtract + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_multiply + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_remainder + + -- C Member: *note ternaryfunc: 4b06. *note PyNumberMethods: + 13e9.nb_inplace_power + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_lshift + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_rshift + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_and + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_xor + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_or + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_floor_divide + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_true_divide + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_floor_divide + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_true_divide + + -- C Member: *note unaryfunc: 4b08. *note PyNumberMethods: + 13e9.nb_index + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_matrix_multiply + + -- C Member: *note binaryfunc: 4aed. *note PyNumberMethods: + 13e9.nb_inplace_matrix_multiply + + +File: python.info, Node: Mapping Object Structures, Next: Sequence Object Structures, Prev: Number Object Structures, Up: Type Object Structures + +7.12.3.12 Mapping Object Structures +................................... + + -- C Type: type PyMappingMethods + + This structure holds pointers to the functions which an object uses + to implement the mapping protocol. It has three members: + + -- C Member: *note lenfunc: 4afa. *note PyMappingMethods: + 490e.mp_length + + This function is used by *note PyMapping_Size(): 1a55. and *note + PyObject_Size(): 4a69, and has the same signature. This slot may + be set to ‘NULL’ if the object has no defined length. + + -- C Member: *note binaryfunc: 4aed. *note PyMappingMethods: + 490e.mp_subscript + + This function is used by *note PyObject_GetItem(): 342. and *note + PySequence_GetSlice(): 4a74, and has the same signature as + ‘PyObject_GetItem()’. This slot must be filled for the *note + PyMapping_Check(): 4a26. function to return ‘1’, it can be ‘NULL’ + otherwise. + + -- C Member: *note objobjargproc: 4afc. *note PyMappingMethods: + 490e.mp_ass_subscript + + This function is used by *note PyObject_SetItem(): 4947, *note + PyObject_DelItem(): 4a5b, *note PySequence_SetSlice(): 4a7b. and + *note PySequence_DelSlice(): 4a72. 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: Sequence Object Structures, Next: Buffer Object Structures, Prev: Mapping Object Structures, Up: Type Object Structures + +7.12.3.13 Sequence Object Structures +.................................... + + -- C Type: type PySequenceMethods + + This structure holds pointers to the functions which an object uses + to implement the sequence protocol. + + -- C Member: *note lenfunc: 4afa. *note PySequenceMethods: + 490d.sq_length + + This function is used by *note PySequence_Size(): 1a51. and *note + PyObject_Size(): 4a69, and has the same signature. It is also used + for handling negative indices via the *note sq_item: 192c. and the + *note sq_ass_item: 4ea3. slots. + + -- C Member: *note binaryfunc: 4aed. *note PySequenceMethods: + 490d.sq_concat + + This function is used by *note PySequence_Concat(): 4a6f. and has + the same signature. It is also used by the ‘+’ operator, after + trying the numeric addition via the *note nb_add: 4bff. slot. + + -- C Member: *note ssizeargfunc: 4b04. *note PySequenceMethods: + 490d.sq_repeat + + This function is used by *note PySequence_Repeat(): 4a7a. and has + the same signature. It is also used by the ‘*’ operator, after + trying numeric multiplication via the *note nb_multiply: 4e80. + slot. + + -- C Member: *note ssizeargfunc: 4b04. *note PySequenceMethods: + 490d.sq_item + + This function is used by *note PySequence_GetItem(): 1a52. and has + the same signature. It is also used by *note PyObject_GetItem(): + 342, after trying the subscription via the *note mp_subscript: + 192d. slot. This slot must be filled for the *note + PySequence_Check(): 4a6e. function to return ‘1’, it can be ‘NULL’ + otherwise. + + Negative indexes are handled as follows: if the *note sq_length: + 4c07. slot is filled, it is called and the sequence length is used + to compute a positive index which is passed to *note sq_item: 192c. + If ‘sq_length’ is ‘NULL’, the index is passed as is to the + function. + + -- C Member: *note ssizeobjargproc: 4b05. *note PySequenceMethods: + 490d.sq_ass_item + + This function is used by *note PySequence_SetItem(): 1a53. and has + the same signature. It is also used by *note PyObject_SetItem(): + 4947. and *note PyObject_DelItem(): 4a5b, after trying the item + assignment and deletion via the *note mp_ass_subscript: 4ea0. slot. + This slot may be left to ‘NULL’ if the object does not support item + assignment and deletion. + + -- C Member: *note objobjproc: 4afd. *note PySequenceMethods: + 490d.sq_contains + + This function may be used by *note PySequence_Contains(): 4a70. and + has the same signature. This slot may be left to ‘NULL’, in this + case ‘PySequence_Contains()’ simply traverses the sequence until it + finds a match. + + -- C Member: *note binaryfunc: 4aed. *note PySequenceMethods: + 490d.sq_inplace_concat + + This function is used by *note PySequence_InPlaceConcat(): 4a75. + 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(): 4a6f. It is also used by the augmented + assignment ‘+=’, after trying numeric in-place addition via the + *note nb_inplace_add: 4e7d. slot. + + -- C Member: *note ssizeargfunc: 4b04. *note PySequenceMethods: + 490d.sq_inplace_repeat + + This function is used by *note PySequence_InPlaceRepeat(): 4a76. + 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(): 4a7a. It is also used by the augmented + assignment ‘*=’, after trying numeric in-place multiplication via + the *note nb_inplace_multiply: 4e81. slot. + + +File: python.info, Node: Buffer Object Structures, Next: Async Object Structures, Prev: Sequence Object Structures, Up: Type Object Structures + +7.12.3.14 Buffer Object Structures +.................................. + + -- C Type: type PyBufferProcs + + This structure holds pointers to the functions required by the + *note Buffer protocol: 393. The protocol defines how an exporter + object can expose its internal data to consumer objects. + + -- C Member: *note getbufferproc: 4af3. *note PyBufferProcs: + 4c0e.bf_getbuffer + + The signature of this function is: + + int (PyObject *exporter, Py_buffer *view, int flags); + + Handle a request to 'exporter' to fill in 'view' as specified by + 'flags'. Except for point (3), an implementation of this function + MUST take these steps: + + 1. Check if the request can be met. If not, raise *note + BufferError: 1824, set view->obj to ‘NULL’ and return ‘-1’. + + 2. Fill in the requested fields. + + 3. Increment an internal counter for the number of exports. + + 4. Set view->obj to 'exporter' and increment view->obj. + + 5. Return ‘0’. + + If 'exporter' is part of a chain or tree of buffer providers, two + main schemes can be used: + + * Re-export: Each member of the tree acts as the exporting + object and sets view->obj to a new reference to itself. + + * Redirect: The buffer request is redirected to the root object + of the tree. Here, view->obj will be a new reference to the + root object. + + The individual fields of 'view' are described in section *note + Buffer structure: 4bcb, the rules how an exporter must react to + specific requests are in section *note Buffer request types: 44d1. + + All memory pointed to in the *note Py_buffer: 753. structure + belongs to the exporter and must remain valid until there are no + consumers left. *note format: 4bd5, *note shape: 4bd7, *note + strides: 4bcf, *note suboffsets: 4bd9. and *note internal: 4bdc. + are read-only for the consumer. + + *note PyBuffer_FillInfo(): 75b. provides an easy way of exposing a + simple bytes buffer while dealing correctly with all request types. + + *note PyObject_GetBuffer(): 395. is the interface for the consumer + that wraps this function. + + -- C Member: *note releasebufferproc: 4afe. *note PyBufferProcs: + 4c0e.bf_releasebuffer + + The signature of this function is: + + void (PyObject *exporter, Py_buffer *view); + + Handle a request to release the resources of the buffer. If no + resources need to be released, *note + PyBufferProcs.bf_releasebuffer: 75e. may be ‘NULL’. Otherwise, a + standard implementation of this function will take these optional + steps: + + 1. Decrement an internal counter for the number of exports. + + 2. If the counter is ‘0’, free all memory associated with 'view'. + + The exporter MUST use the *note internal: 4bdc. field to keep track + of buffer-specific resources. This field is guaranteed to remain + constant, while a consumer MAY pass a copy of the original buffer + as the 'view' argument. + + This function MUST NOT decrement view->obj, since that is done + automatically in *note PyBuffer_Release(): 396. (this scheme is + useful for breaking reference cycles). + + *note PyBuffer_Release(): 396. is the interface for the consumer + that wraps this function. + + +File: python.info, Node: Async Object Structures, Next: Slot Type typedefs, Prev: Buffer Object Structures, Up: Type Object Structures + +7.12.3.15 Async Object Structures +................................. + +Added in version 3.5. + + -- C Type: type PyAsyncMethods + + This structure holds pointers to the functions required to + implement *note awaitable: 1ad. and *note asynchronous iterator: + 1ab. objects. + + Here is the structure definition: + + typedef struct { + unaryfunc am_await; + unaryfunc am_aiter; + unaryfunc am_anext; + sendfunc am_send; + } PyAsyncMethods; + + -- C Member: *note unaryfunc: 4b08. *note PyAsyncMethods: 4c06.am_await + + The signature of this function is: + + PyObject *am_await(PyObject *self); + + The returned object must be an *note iterator: 1ac, i.e. *note + PyIter_Check(): 18f4. must return ‘1’ for it. + + This slot may be set to ‘NULL’ if an object is not an *note + awaitable: 1ad. + + -- C Member: *note unaryfunc: 4b08. *note PyAsyncMethods: 4c06.am_aiter + + The signature of this function is: + + PyObject *am_aiter(PyObject *self); + + Must return an *note asynchronous iterator: 1ab. object. See *note + __anext__(): 1573. for details. + + This slot may be set to ‘NULL’ if an object does not implement + asynchronous iteration protocol. + + -- C Member: *note unaryfunc: 4b08. *note PyAsyncMethods: 4c06.am_anext + + The signature of this function is: + + PyObject *am_anext(PyObject *self); + + Must return an *note awaitable: 1ad. object. See *note + __anext__(): 1573. for details. This slot may be set to ‘NULL’. + + -- C Member: *note sendfunc: 4e7c. *note PyAsyncMethods: 4c06.am_send + + The signature of this function is: + + PySendResult am_send(PyObject *self, PyObject *arg, PyObject **result); + + See *note PyIter_Send(): 896. for details. This slot may be set to + ‘NULL’. + + Added in version 3.10. + + +File: python.info, Node: Slot Type typedefs, Next: Examples<38>, Prev: Async Object Structures, Up: Type Object Structures + +7.12.3.16 Slot Type typedefs +............................ + + -- C Type: typedef *note PyObject: 334. *(*allocfunc)(*note + PyTypeObject: aa5. *cls, *note Py_ssize_t: a5f. nitems) + ' Part of the *note Stable ABI: 550.' 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: 89d. set to ‘1’ and *note ob_type: 48e6. set to + the type argument. If the type’s *note tp_itemsize: 1f70. is + non-zero, the object’s *note ob_size: 4ada. 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: 987. + + This function should not do any other instance initialization, not + even to allocate additional memory; that should be done by *note + tp_new: 57c. + + -- C Type: typedef void (*destructor)(*note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef void (*freefunc)(void*) + + See *note tp_free: 48e9. + + -- C Type: typedef *note PyObject: 334. *(*newfunc)(*note PyTypeObject: + aa5.*, *note PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_new: 57c. + + -- C Type: typedef int (*initproc)(*note PyObject: 334.*, *note + PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_init: 57e. + + -- C Type: typedef *note PyObject: 334. *(*reprfunc)(*note PyObject: + 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_repr: 48fd. + + -- C Type: typedef *note PyObject: 334. *(*getattrfunc)(*note PyObject: + 334. *self, char *attr) + ' Part of the *note Stable ABI: 550.' Return the value of the + named attribute for the object. + + -- C Type: typedef int (*setattrfunc)(*note PyObject: 334. *self, char + *attr, *note PyObject: 334. *value) + ' Part of the *note Stable ABI: 550.' Set the value of the named + attribute for the object. The value argument is set to ‘NULL’ to + delete the attribute. + + -- C Type: typedef *note PyObject: 334. *(*getattrofunc)(*note + PyObject: 334. *self, *note PyObject: 334. *attr) + ' Part of the *note Stable ABI: 550.' Return the value of the + named attribute for the object. + + See *note tp_getattro: 16f2. + + -- C Type: typedef int (*setattrofunc)(*note PyObject: 334. *self, + *note PyObject: 334. *attr, *note PyObject: 334. *value) + ' Part of the *note Stable ABI: 550.' Set the value of the named + attribute for the object. The value argument is set to ‘NULL’ to + delete the attribute. + + See *note tp_setattro: 4901. + + -- C Type: typedef *note PyObject: 334. *(*descrgetfunc)(*note + PyObject: 334.*, *note PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_descr_get: + 4e71. + + -- C Type: typedef int (*descrsetfunc)(*note PyObject: 334.*, *note + PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_descr_set: + 18f6. + + -- C Type: typedef *note Py_hash_t: 1257. (*hashfunc)(*note PyObject: + 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_hash: 490f. + + -- C Type: typedef *note PyObject: 334. *(*richcmpfunc)(*note PyObject: + 334.*, *note PyObject: 334.*, int) + ' Part of the *note Stable ABI: 550.' See *note tp_richcompare: + 4909. + + -- C Type: typedef *note PyObject: 334. *(*getiterfunc)(*note PyObject: + 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_iter: 14b9. + + -- C Type: typedef *note PyObject: 334. *(*iternextfunc)(*note + PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' See *note tp_iternext: 14ba. + + -- C Type: typedef *note Py_ssize_t: a5f. (*lenfunc)(*note PyObject: + 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef int (*getbufferproc)(*note PyObject: 334.*, *note + Py_buffer: 753.*, int) + ' Part of the *note Stable ABI: 550. since version 3.12.' + + -- C Type: typedef void (*releasebufferproc)(*note PyObject: 334.*, + *note Py_buffer: 753.*) + ' Part of the *note Stable ABI: 550. since version 3.12.' + + -- C Type: typedef *note PyObject: 334. *(*unaryfunc)(*note PyObject: + 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef *note PyObject: 334. *(*binaryfunc)(*note PyObject: + 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef *note PySendResult: 4bc7. (*sendfunc)(*note + PyObject: 334.*, *note PyObject: 334.*, *note PyObject: + 334.**) + + See *note am_send: 4e7b. + + -- C Type: typedef *note PyObject: 334. *(*ternaryfunc)(*note PyObject: + 334.*, *note PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef *note PyObject: 334. *(*ssizeargfunc)(*note + PyObject: 334.*, *note Py_ssize_t: a5f.) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef int (*ssizeobjargproc)(*note PyObject: 334.*, *note + Py_ssize_t: a5f, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef int (*objobjproc)(*note PyObject: 334.*, *note + PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + -- C Type: typedef int (*objobjargproc)(*note PyObject: 334.*, *note + PyObject: 334.*, *note PyObject: 334.*) + ' Part of the *note Stable ABI: 550.' + + +File: python.info, Node: Examples<38>, Prev: Slot Type typedefs, Up: Type Object Structures + +7.12.3.17 Examples +.................. + +The following are simple examples of Python type definitions. They +include common usage you may encounter. Some demonstrate tricky corner +cases. For more examples, practical info, and a tutorial, see *note +Defining Extension Types; Tutorial: 48df. and *note Defining Extension +Types; Assorted Topics: 48f8. + +A basic *note static type: 77a.: + + 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, + }; + +You may also find older code (especially in the CPython code base) with +a more verbose initializer: + + 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 */ + }; + +A type that supports weakrefs, instance dicts, and hashing: + + 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: 57f. 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: 77a. 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: 77a. 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: Supporting Cyclic Garbage Collection, Prev: Type Object Structures, Up: Object Implementation Support + +7.12.4 Supporting Cyclic Garbage Collection +------------------------------------------- + +Python’s support for detecting and collecting garbage which involves +circular references requires support from object types which are +“containers” for other objects which may also be containers. Types +which do not store references to other objects, or which only store +references to atomic types (such as numbers or strings), do not need to +provide any explicit support for garbage collection. + +To create a container type, the *note tp_flags: 18bd. field of the type +object must include the *note Py_TPFLAGS_HAVE_GC: 778. and provide an +implementation of the *note tp_traverse: 779. handler. If instances of +the type are mutable, a *note tp_clear: 48fb. implementation must also +be provided. + +*note Py_TPFLAGS_HAVE_GC: 778. + + Objects with a type with this flag set must conform with the rules + documented here. For convenience these objects will be referred to + as container objects. + +Constructors for container types must conform to two rules: + + 1. The memory for the object must be allocated using *note + PyObject_GC_New: aa2. or *note PyObject_GC_NewVar: aa3. + + 2. Once all the fields which may contain references to other + containers are initialized, it must call *note PyObject_GC_Track(): + 14d0. + +Similarly, the deallocator for the object must conform to a similar pair +of rules: + + 1. Before fields which refer to other containers are invalidated, + *note PyObject_GC_UnTrack(): 14d1. must be called. + + 2. The object’s memory must be deallocated using *note + PyObject_GC_Del(): 14cf. + + Warning: If a type adds the Py_TPFLAGS_HAVE_GC, then it 'must' + implement at least a *note tp_traverse: 779. handler or + explicitly use one from its subclass or subclasses. + + When calling *note PyType_Ready(): 777. or some of the APIs + that indirectly call it like *note PyType_FromSpecWithBases(): + 57b. or *note PyType_FromSpec(): 57a. the interpreter will + automatically populate the *note tp_flags: 18bd, *note + tp_traverse: 779. and *note tp_clear: 48fb. 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: 778. flag. + + -- C Macro: PyObject_GC_New (TYPE, typeobj) + + Analogous to *note PyObject_New: 985. but for container objects + with the *note Py_TPFLAGS_HAVE_GC: 778. flag set. + + -- C Macro: PyObject_GC_NewVar (TYPE, typeobj, size) + + Analogous to *note PyObject_NewVar: 986. but for container objects + with the *note Py_TPFLAGS_HAVE_GC: 778. flag set. + + -- C Function: *note PyObject: 334. + *PyUnstable_Object_GC_NewWithExtraData (PyTypeObject *type, + size_t extra_size) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Analogous to *note PyObject_GC_New: aa2. but allocates 'extra_size' + bytes at the end of the object (at offset *note tp_basicsize: + 987.). The allocated memory is initialized to zeros, except for + the *note Python object header: 334. + + The extra data will be deallocated with the object, but otherwise + it is not managed by Python. + + Warning: 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: 416a. and *note tp_itemsize: + 1f70. instead. + + Added in version 3.12. + + -- C Macro: PyObject_GC_Resize (TYPE, op, newsize) + + Resize an object allocated by *note PyObject_NewVar: 986. Returns + the resized object of type ‘TYPE*’ (refers to any C type) or ‘NULL’ + on failure. + + 'op' must be of type *note PyVarObject: 416a.* and must not be + tracked by the collector yet. 'newsize' must be of type *note + Py_ssize_t: a5f. + + -- C Function: void PyObject_GC_Track (PyObject *op) + ' Part of the *note Stable ABI: 550.' Adds the object 'op' to the + set of container objects tracked by the collector. The collector + can run at unexpected times so objects must be valid while being + tracked. This should be called once all the fields followed by the + *note tp_traverse: 779. handler become valid, usually near the end + of the constructor. + + -- C Function: 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 Function: int PyObject_GC_IsTracked (PyObject *op) + ' Part of the *note Stable ABI: 550. since version 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(): + 1301. + + Added in version 3.9. + + -- C Function: int PyObject_GC_IsFinalized (PyObject *op) + ' Part of the *note Stable ABI: 550. since version 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(): + 8fc. + + Added in version 3.9. + + -- C Function: void PyObject_GC_Del (void *op) + ' Part of the *note Stable ABI: 550.' Releases memory allocated to + an object using *note PyObject_GC_New: aa2. or *note + PyObject_GC_NewVar: aa3. + + -- C Function: void PyObject_GC_UnTrack (void *op) + ' Part of the *note Stable ABI: 550.' Remove the object 'op' from + the set of container objects tracked by the collector. Note that + *note PyObject_GC_Track(): 14d0. can be called again on this object + to add it back to the set of tracked objects. The deallocator + (*note tp_dealloc: 48e8. handler) should call this for the object + before any of the fields used by the *note tp_traverse: 779. + handler become invalid. + +Changed in version 3.8: The ‘_PyObject_GC_TRACK()’ and +‘_PyObject_GC_UNTRACK()’ macros have been removed from the public C API. + +The *note tp_traverse: 779. handler accepts a function parameter of this +type: + + -- C Type: typedef int (*visitproc)(*note PyObject: 334. *object, void + *arg) + ' Part of the *note Stable ABI: 550.' Type of the visitor function + passed to the *note tp_traverse: 779. handler. The function should + be called with an object to traverse as 'object' and the third + parameter to the *note tp_traverse: 779. handler as 'arg'. The + Python core uses several visitor functions to implement cyclic + garbage detection; it’s not expected that users will need to write + their own visitor functions. + +The *note tp_traverse: 779. handler must have the following type: + + -- C Type: typedef int (*traverseproc)(*note PyObject: 334. *self, + *note visitproc: 4b09. visit, void *arg) + ' Part of the *note Stable ABI: 550.' Traversal function for a + container object. Implementations must call the 'visit' function + for each object directly contained by 'self', with the parameters + to 'visit' being the contained object and the 'arg' value passed to + the handler. The 'visit' function must not be called with a ‘NULL’ + object argument. If 'visit' returns a non-zero value that value + should be returned immediately. + +To simplify writing *note tp_traverse: 779. handlers, a *note +Py_VISIT(): 48f2. macro is provided. In order to use this macro, the +*note tp_traverse: 779. implementation must name its arguments exactly +'visit' and 'arg': + + -- C Macro: Py_VISIT (o) + + If the *note PyObject: 334.* 'o' is not ‘NULL’, call the 'visit' + callback, with arguments 'o' and 'arg'. If 'visit' returns a + non-zero value, then return it. Using this macro, *note + tp_traverse: 779. handlers look like: + + static int + my_traverse(Noddy *self, visitproc visit, void *arg) + { + Py_VISIT(self->foo); + Py_VISIT(self->bar); + return 0; + } + +The *note tp_clear: 48fb. handler must be of the *note inquiry: 4af8. +type, or ‘NULL’ if the object is immutable. + + -- C Type: typedef int (*inquiry)(*note PyObject: 334. *self) + ' Part of the *note Stable ABI: 550.' Drop references that may + have created reference cycles. Immutable objects do not have to + define this method since they can never directly create reference + cycles. Note that the object must still be valid after calling + this method (don’t just call *note Py_DECREF(): 56c. on a + reference). The collector will call this method if it detects that + this object is involved in a reference cycle. + +* Menu: + +* Controlling the Garbage Collector State:: +* Querying Garbage Collector State:: + + +File: python.info, Node: Controlling the Garbage Collector State, Next: Querying Garbage Collector State, Up: Supporting Cyclic Garbage Collection + +7.12.4.1 Controlling the Garbage Collector State +................................................ + +The C-API provides the following functions for controlling garbage +collection runs. + + -- C Function: *note Py_ssize_t: a5f. PyGC_Collect (void) + ' Part of the *note Stable ABI: 550.' Perform a full garbage + collection, if the garbage collector is enabled. (Note that *note + gc.collect(): a39. 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: 1f9. This + function does not raise exceptions. + + -- C Function: int PyGC_Enable (void) + ' Part of the *note Stable ABI: 550. since version 3.10.' Enable + the garbage collector: similar to *note gc.enable(): 447d. Returns + the previous state, 0 for disabled and 1 for enabled. + + Added in version 3.10. + + -- C Function: int PyGC_Disable (void) + ' Part of the *note Stable ABI: 550. since version 3.10.' Disable + the garbage collector: similar to *note gc.disable(): 447e. + Returns the previous state, 0 for disabled and 1 for enabled. + + Added in version 3.10. + + -- C Function: int PyGC_IsEnabled (void) + ' Part of the *note Stable ABI: 550. since version 3.10.' Query + the state of the garbage collector: similar to *note + gc.isenabled(): 447f. 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: Supporting Cyclic Garbage Collection + +7.12.4.2 Querying Garbage Collector State +......................................... + +The C-API provides the following interface for querying information +about the garbage collector. + + -- C Function: void PyUnstable_GC_VisitObjects (gcvisitobjects_t + callback, void *arg) + + This is Unstable API. It may change without warning in minor releases. 'This is *note Unstable API: 544. It may change without warning in minor releases.': + Run supplied 'callback' on all live GC-capable objects. 'arg' is + passed through to all invocations of 'callback'. + + Warning: 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 Type: typedef int (*gcvisitobjects_t)(*note PyObject: 334. + *object, void *arg) + + Type of the visitor function to be passed to *note + PyUnstable_GC_VisitObjects(): 4eca. '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 and ABI Versioning, Next: Monitoring C API, Prev: Object Implementation Support, Up: Python/C API Reference Manual + +7.13 API and ABI Versioning +=========================== + +CPython exposes its version number in the following macros. Note that +these correspond to the version code is 'built' with, not necessarily +the version used at 'run time'. + +See *note C API Stability: 550. for a discussion of API and ABI +stability across versions. + + -- C Macro: PY_MAJOR_VERSION + + The ‘3’ in ‘3.4.1a2’. + + -- C Macro: PY_MINOR_VERSION + + The ‘4’ in ‘3.4.1a2’. + + -- C Macro: PY_MICRO_VERSION + + The ‘1’ in ‘3.4.1a2’. + + -- C Macro: PY_RELEASE_LEVEL + + The ‘a’ in ‘3.4.1a2’. This can be ‘0xA’ for alpha, ‘0xB’ for beta, + ‘0xC’ for release candidate or ‘0xF’ for final. + + -- C Macro: PY_RELEASE_SERIAL + + The ‘2’ in ‘3.4.1a2’. Zero for final releases. + + -- C Macro: PY_VERSION_HEX + + The Python version number encoded in a single integer. + + The underlying version information can be found by treating it as a + 32 bit number in the following manner: + + Bytes Bits (big endian order) Meaning Value for ‘3.4.1a2’ + + ------------------------------------------------------------------------------------------------------- + + 1 1-8 ‘PY_MAJOR_VERSION’ ‘0x03’ + + + 2 9-16 ‘PY_MINOR_VERSION’ ‘0x04’ + + + 3 17-24 ‘PY_MICRO_VERSION’ ‘0x01’ + + + 4 25-28 ‘PY_RELEASE_LEVEL’ ‘0xA’ + + + 29-32 ‘PY_RELEASE_SERIAL’ ‘0x2’ + + + Thus ‘3.4.1a2’ is hexversion ‘0x030401a2’ and ‘3.10.0’ is + hexversion ‘0x030a00f0’. + + Use this for numeric comparisons, e.g. ‘#if PY_VERSION_HEX >= + ...’. + + This version is also available via the symbol *note Py_Version: + 751. + + -- C Variable: const unsigned long Py_Version + ' Part of the *note Stable ABI: 550. since version 3.11.' The + Python runtime version number encoded in a single constant integer, + with the same format as the *note PY_VERSION_HEX: 752. macro. This + contains the Python version used at run time. + + Added in version 3.11. + +All the given macros are defined in Include/patchlevel.h(1). + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Include/patchlevel.h + + +File: python.info, Node: Monitoring C API, Next: Generating Execution Events, Prev: API and ABI Versioning, Up: Python/C API Reference Manual + +7.14 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: da. + + +File: python.info, Node: Generating Execution Events, Prev: Monitoring C API, Up: Python/C API Reference Manual + +7.15 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: da. for details about the signatures of the +different event callbacks). The ‘codelike’ argument should be an +instance of *note types.CodeType: 2e3. 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: 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: da. for descriptions of the events. + + -- C Function: int PyMonitoring_FirePyStartEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset) + + Fire a ‘PY_START’ event. + + -- C Function: int PyMonitoring_FirePyResumeEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset) + + Fire a ‘PY_RESUME’ event. + + -- C Function: int PyMonitoring_FirePyReturnEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject *retval) + + Fire a ‘PY_RETURN’ event. + + -- C Function: int PyMonitoring_FirePyYieldEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject *retval) + + Fire a ‘PY_YIELD’ event. + + -- C Function: int PyMonitoring_FireCallEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject + *callable, PyObject *arg0) + + Fire a ‘CALL’ event. + + -- C Function: int PyMonitoring_FireLineEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, int lineno) + + Fire a ‘LINE’ event. + + -- C Function: int PyMonitoring_FireJumpEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject + *target_offset) + + Fire a ‘JUMP’ event. + + -- C Function: int PyMonitoring_FireBranchEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject + *target_offset) + + Fire a ‘BRANCH’ event. + + -- C Function: int PyMonitoring_FireCReturnEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset, PyObject *retval) + + Fire a ‘C_RETURN’ event. + + -- C Function: 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(): 3f0.). + + -- C Function: int PyMonitoring_FireRaiseEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset) + + Fire a ‘RAISE’ event with the current exception (as returned by + *note PyErr_GetRaisedException(): 3f0.). + + -- C Function: 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(): 3f0.). + + -- C Function: int PyMonitoring_FireReraiseEvent (PyMonitoringState + *state, PyObject *codelike, int32_t offset) + + Fire a ‘RERAISE’ event with the current exception (as returned by + *note PyErr_GetRaisedException(): 3f0.). + + -- C Function: 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(): 3f0.). + + -- C Function: 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(): 3f0.). + + -- C Function: 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: bfa, it is used. Otherwise, a new *note + StopIteration: bfa. 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.15.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 Function: 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 Macro: PY_MONITORING_EVENT_BRANCH *note BRANCH: 43b4. + + + -- C Macro: PY_MONITORING_EVENT_CALL *note CALL: 1646. + + + -- C Macro: PY_MONITORING_EVENT_C_RAISE *note C_RAISE: 43b5. + + + -- C Macro: PY_MONITORING_EVENT_C_RETURN *note C_RETURN: 43b6. + + + -- C Macro: PY_MONITORING_EVENT_EXCEPTION_HANDLED *note EXCEPTION_HANDLED: 43b7. + + + -- C Macro: PY_MONITORING_EVENT_INSTRUCTION *note INSTRUCTION: 43b8. + + + -- C Macro: PY_MONITORING_EVENT_JUMP *note JUMP: 43b9. + + + -- C Macro: PY_MONITORING_EVENT_LINE *note LINE: 43ba. + + + -- C Macro: PY_MONITORING_EVENT_PY_RESUME *note PY_RESUME: 43bb. + + + -- C Macro: PY_MONITORING_EVENT_PY_RETURN *note PY_RETURN: 43bc. + + + -- C Macro: PY_MONITORING_EVENT_PY_START *note PY_START: 43bd. + + + -- C Macro: PY_MONITORING_EVENT_PY_THROW *note PY_THROW: 43be. + + + -- C Macro: PY_MONITORING_EVENT_PY_UNWIND *note PY_UNWIND: 43bf. + + + -- C Macro: PY_MONITORING_EVENT_PY_YIELD *note PY_YIELD: 43c0. + + + -- C Macro: PY_MONITORING_EVENT_RAISE *note RAISE: 15f0. + + + -- C Macro: PY_MONITORING_EVENT_RERAISE *note RERAISE: 43c2. + + + -- C Macro: PY_MONITORING_EVENT_STOP_ITERATION *note STOP_ITERATION: 43c1. + + + -- C Function: int PyMonitoring_ExitScope (void) + + Exit the last scope that was entered with + ‘PyMonitoring_EnterScope()’. + + -- C Function: 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: 43c6. + + Added in version 3.13. + + Deprecated since version 3.13.3: This function is *note soft + deprecated: 20b. + + +File: python.info, Node: Installing Python Modules, Next: Python HOWTOs, Prev: Python/C API Reference Manual, Up: Top + +8 Installing Python Modules +*************************** + + +Email: <distutils-sig@python.org> + +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. + +This allows Python users to share and collaborate effectively, +benefiting from the solutions others have already created to common (and +sometimes even rare!) problems, as well as potentially contributing +their own solutions to the common pool. + +This guide covers the installation part of the process. For a guide to +creating and sharing your own Python projects, refer to the Python +packaging user guide(1). + + Note: For corporate and other institutional users, be aware that + many organisations have their own policies around using and + contributing to open source software. Please take such policies + into account when making use of the distribution and installation + tools provided with Python. + +* Menu: + +* Key terms:: +* Basic usage:: +* How do I …?:: +* Common installation issues:: + + ---------- Footnotes ---------- + + (1) +https://packaging.python.org/en/latest/tutorials/packaging-projects/ + + +File: python.info, Node: Key terms, Next: Basic usage, Up: Installing Python Modules + +8.1 Key terms +============= + + * ‘pip’ is the preferred installer program. Starting with Python + 3.4, it is included by default with the Python binary installers. + + * A 'virtual environment' is a semi-isolated Python environment that + allows packages to be installed for use by a particular + application, rather than being installed system wide. + + * ‘venv’ is the standard tool for creating virtual environments, and + has been part of Python since Python 3.3. Starting with Python + 3.4, it defaults to installing ‘pip’ into all created virtual + environments. + + * ‘virtualenv’ is a third party alternative (and predecessor) to + ‘venv’. It allows virtual environments to be used on versions of + Python prior to 3.4, which either don’t provide ‘venv’ at all, or + aren’t able to automatically install ‘pip’ into created + environments. + + * The Python Package Index(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). + + * ‘distutils’ is the original build and distribution system first + added to the Python standard library in 1998. While direct use of + ‘distutils’ is being phased out, it still laid the foundation for + the current packaging and distribution infrastructure, and it not + only remains part of the standard library, but its name lives on in + other ways (such as the name of the mailing list used to coordinate + Python packaging standards development). + +Changed in version 3.5: The use of ‘venv’ is now recommended for +creating virtual environments. + +See also +........ + +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: Basic usage, Next: How do I …?, Prev: Key terms, Up: Installing Python Modules + +8.2 Basic usage +=============== + +The standard packaging tools are all designed to be used from the +command line. + +The following command will install the latest version of a module and +its dependencies from the Python Package Index: + + python -m pip install SomePackage + + Note: For POSIX users (including macOS and Linux users), the + examples in this guide assume the use of a *note virtual + environment: 1d01. + + For Windows users, the examples in this guide assume that the + option to adjust the system PATH environment variable was selected + when installing Python. + +It’s also possible to specify an exact or minimum version directly on +the command line. When using comparator operators such as ‘>’, ‘<’ or +some other special character which get interpreted by shell, the package +name and the version should be enclosed within double quotes: + + python -m pip install SomePackage==1.0.4 # specific version + python -m pip install "SomePackage>=1.0.4" # minimum version + +Normally, if a suitable module is already installed, attempting to +install it again will have no effect. Upgrading existing modules must +be requested explicitly: + + 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). + +Creation of virtual environments is done through the *note venv: 111. +module. Installing packages into an active virtual environment uses the +commands shown above. + +See also +........ + +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: How do I …?, Next: Common installation issues, Prev: Basic usage, Up: Installing Python Modules + +8.3 How do I …? +=============== + +These are quick answers or links for some common tasks. + +* Menu: + +* … install pip in versions of Python prior to Python 3.4?: … install pip in versions of Python prior to Python 3 4?. +* … install packages just for the current user?:: +* … install scientific Python packages?:: +* … work with multiple versions of Python installed in parallel?:: + + +File: python.info, Node: … install pip in versions of Python prior to Python 3 4?, Next: … install packages just for the current user?, Up: How do I …? + +8.3.1 … install ‘pip’ in versions of Python prior to Python 3.4? +---------------------------------------------------------------- + +Python only started bundling ‘pip’ with Python 3.4. For earlier +versions, ‘pip’ needs to be “bootstrapped” as described in the Python +Packaging User Guide. + +See also +........ + +Python Packaging User Guide: Requirements for Installing Packages(1) + + ---------- Footnotes ---------- + + (1) +https://packaging.python.org/installing/#requirements-for-installing-packages + + +File: python.info, Node: … install packages just for the current user?, Next: … install scientific Python packages?, Prev: … install pip in versions of Python prior to Python 3 4?, Up: How do I …? + +8.3.2 … install packages just for the current user? +--------------------------------------------------- + +Passing the ‘--user’ option to ‘python -m pip install’ will install a +package just for the current user, rather than for all users of the +system. + + +File: python.info, Node: … install scientific Python packages?, Next: … work with multiple versions of Python installed in parallel?, Prev: … install packages just for the current user?, Up: How do I …? + +8.3.3 … install scientific Python packages? +------------------------------------------- + +A number of scientific Python packages have complex binary dependencies, +and aren’t currently easy to install using ‘pip’ directly. At this +point in time, it will often be easier for users to install these +packages by other means(1) rather than attempting to install them with +‘pip’. + +See also +........ + +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: … work with multiple versions of Python installed in parallel?, Prev: … install scientific Python packages?, Up: How do I …? + +8.3.4 … work with multiple versions of Python installed in parallel? +-------------------------------------------------------------------- + +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’: + + python2 -m pip install SomePackage # default Python 2 + python2.7 -m pip install SomePackage # specifically Python 2.7 + python3 -m pip install SomePackage # default Python 3 + python3.4 -m pip install SomePackage # specifically Python 3.4 + +Appropriately versioned ‘pip’ commands may also be available. + +On Windows, use the ‘py’ Python launcher in combination with the ‘-m’ +switch: + + py -2 -m pip install SomePackage # default Python 2 + py -2.7 -m pip install SomePackage # specifically Python 2.7 + py -3 -m pip install SomePackage # default Python 3 + py -3.4 -m pip install SomePackage # specifically Python 3.4 + + +File: python.info, Node: Common installation issues, Prev: How do I …?, Up: Installing Python Modules + +8.4 Common installation issues +============================== + +* Menu: + +* Installing into the system Python on Linux:: +* Pip not installed:: +* Installing binary extensions:: + + +File: python.info, Node: Installing into the system Python on Linux, Next: Pip not installed, Up: Common installation issues + +8.4.1 Installing into the system Python on Linux +------------------------------------------------ + +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 not installed, Next: Installing binary extensions, Prev: Installing into the system Python on Linux, Up: Common installation issues + +8.4.2 Pip not installed +----------------------- + +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: Installing binary extensions, Prev: Pip not installed, Up: Common installation issues + +8.4.3 Installing binary extensions +---------------------------------- + +Python has typically 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 support for the binary ‘wheel’ format, and the +ability to publish wheels for at least Windows and macOS through the +Python Package Index, this problem is expected to diminish over time, 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. + +See also +........ + +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 HOWTOs, Next: Python Frequently Asked Questions, Prev: Installing Python Modules, Up: Top + +9 Python HOWTOs +*************** + +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:: +* Porting Extension Modules to Python 3:: +* Curses Programming with Python:: +* Descriptor Guide:: +* Debugging C API extensions and CPython Internals with GDB:: +* Enum HOWTO:: +* Functional Programming HOWTO:: +* Logging HOWTO:: +* Logging Cookbook:: +* Regular Expression HOWTO:: +* Socket Programming HOWTO:: +* Sorting Techniques:: +* Unicode HOWTO:: +* HOWTO Fetch Internet Resources Using The urllib Package:: +* An introduction to the ipaddress module:: +* Instrumenting CPython with DTrace and SystemTap:: +* Python support for the Linux perf profiler:: +* Annotations Best Practices:: +* Isolating Extension Modules:: +* timer file descriptor HOWTO:: +* The Python 2.3 Method Resolution Order: The Python 2 3 Method Resolution Order. +* Python experimental support for free threading:: +* C API Extension Support for Free Threading:: + + +File: python.info, Node: A Conceptual Overview of asyncio, Next: Porting Extension Modules to Python 3, Up: Python HOWTOs + +9.1 A Conceptual Overview of ‘asyncio’ +====================================== + +This *note HOWTO: 4ef7. article seeks to help you build a sturdy mental +model of how *note asyncio: a. fundamentally works, helping you +understand the how and why behind the recommended patterns. + +You might be curious about some key ‘asyncio’ concepts. You’ll be +comfortably able to answer these questions by the end of this article: + + - 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. + +See also +........ + + * 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:: +* Tasks: Tasks<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. It’s like an orchestra conductor. It’s behind the +scenes managing resources. Some power is explicitly granted to it, but +a lot of its ability to get things done comes from the respect and +cooperation of its worker bees. + +In more technical terms, the event loop contains a collection of jobs to +be run. Some jobs are added directly by you, and some indirectly by +‘asyncio’. The event loop takes a job from its backlog of work and +invokes it (or “gives it control”), similar to calling a function, and +then that job runs. Once it pauses or completes, it returns control to +the event loop. The event loop will then select another job from its +pool and invoke it. You can 'roughly' think of the collection of jobs +as a queue: jobs are added and then processed one at a time, generally +(but not always) in order. This process repeats indefinitely with the +event loop cycling endlessly onwards. If there are no more jobs pending +execution, the event loop is smart enough to rest and avoid needlessly +wasting CPU cycles, and will come back when there’s more work to be +done. + +Effective execution relies on jobs sharing well and cooperating; a +greedy job could hog control and leave the other jobs to starve, +rendering the overall event loop approach rather useless. + + import asyncio + + # This creates an event loop and indefinitely cycles through + # its collection of jobs. + event_loop = asyncio.new_event_loop() + event_loop.run_forever() + + +File: python.info, Node: Asynchronous functions and coroutines, Next: Tasks<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: 5cd, as opposed to just a plain ‘def’, makes this +an asynchronous function (or “coroutine function”). Calling it creates +and returns a *note coroutine: 327a. 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: e84. (native coroutine). Note +that coroutines can also exist as instances of *note +collections.abc.Coroutine: ddc. – 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: bde. and *note generator functions: +105a. Recall, a generator function is a function that *note yield: +9cd.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(): 7d3. 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: Tasks<2>, Next: await, Prev: Asynchronous functions and coroutines, Up: A conceptual overview part 1 the high-level + +9.1.1.3 Tasks +............. + +Roughly speaking, *note tasks: 32ab. 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: 1b9. The recommended way to create tasks is via +*note asyncio.create_task(): 1bf. + +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). + +Since there’s only one event loop (in each thread), ‘asyncio’ takes care +of associating the task with the event loop for you. As such, there’s +no need to specify the event loop. + + 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(): 478, 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: Tasks<2>, Up: A conceptual overview part 1 the high-level + +9.1.1.4 await +............. + +*note await: 1b9. is a Python keyword that’s commonly used in one of two +different ways: + + await task + await coroutine + +In a crucial way, the behavior of ‘await’ depends on the type of object +being awaited. + +Awaiting a task will cede control from the current task or coroutine to +the event loop. In the process of relinquishing control, a few +important things happen. We’ll use the following code example to +illustrate: + + async def plant_a_tree(): + dig_the_hole_task = asyncio.create_task(dig_the_hole()) + await dig_the_hole_task + + # Other instructions associated with planting a tree. + ... + +In this example, imagine the event loop has passed control to the start +of the coroutine ‘plant_a_tree()’. As seen above, the coroutine creates +a task and then awaits it. The ‘await dig_the_hole_task’ instruction +adds a callback (which will resume ‘plant_a_tree()’) to the +‘dig_the_hole_task’ object’s list of callbacks. And then, the +instruction cedes control to the event loop. Some time later, the event +loop will pass control to ‘dig_the_hole_task’ and the task will finish +whatever it needs to do. Once the task finishes, it will add its +various callbacks to the event loop, in this case, a call to resume +‘plant_a_tree()’. + +Generally speaking, when the awaited task finishes +(‘dig_the_hole_task’), the original task or coroutine (‘plant_a_tree()’) +is added back to the event loops to-do list to be resumed. + +This is a basic, yet reliable mental model. In practice, the control +handoffs are slightly more complex, but not by much. In part 2, we’ll +walk through the details that make this possible. + +'Unlike tasks, awaiting a coroutine does not hand control back to the +event loop!' Wrapping a coroutine in a task first, then awaiting that +would cede control. The behavior of ‘await coroutine’ is effectively +the same as invoking a regular, synchronous Python function. Consider +this program: + + import asyncio + + async def coro_a(): + print("I am coro_a(). Hi!") + + async def coro_b(): + print("I am coro_b(). I sure hope no one hogs the event loop...") + + async def main(): + task_b = asyncio.create_task(coro_b()) + num_repeats = 3 + for _ in range(num_repeats): + await coro_a() + await task_b + + asyncio.run(main()) + +The first statement in the coroutine ‘main()’ creates ‘task_b’ and +schedules it for execution via the event loop. Then, ‘coro_a()’ is +repeatedly awaited. Control never cedes to the event loop which is why +we see the output of all three ‘coro_a()’ invocations before +‘coro_b()’’s output: + + I am coro_a(). Hi! + I am coro_a(). Hi! + I am coro_a(). Hi! + I am coro_b(). I sure hope no one hogs the event loop... + +If we change ‘await coro_a()’ to ‘await asyncio.create_task(coro_a())’, +the behavior changes. The coroutine ‘main()’ cedes control to the event +loop with that statement. The event loop then proceeds through its +backlog of work, calling ‘task_b’ and then the task which wraps +‘coro_a()’ before resuming the coroutine ‘main()’. + + I am coro_b(). I sure hope no one hogs the event loop... + I am coro_a(). Hi! + I am coro_a(). Hi! + I am coro_a(). Hi! + +This behavior of ‘await coroutine’ can trip a lot of people up! That +example highlights how using only ‘await coroutine’ could +unintentionally hog control from other tasks and effectively stall the +event loop. *note asyncio.run(): 478. can help you detect such +occurences via the ‘debug=True’ flag which accordingly enables *note +debug mode: 1d4f. Among other things, it will log any coroutines that +monopolize execution for 100ms or longer. + +The design intentionally trades off some conceptual clarity around usage +of ‘await’ for improved performance. Each time a task is awaited, +control needs to be passed all the way up the call stack to the event +loop. That might sound minor, but in a large program with many +‘await’’s and a deep callstack that overhead can add up to a meaningful +performance drag. + + +File: python.info, Node: A conceptual overview part 2 the nuts and bolts, Prev: A conceptual overview part 1 the high-level, Up: A Conceptual Overview of asyncio + +9.1.2 A conceptual overview part 2: the nuts and bolts +------------------------------------------------------ + +Part 2 goes into detail on the mechanisms ‘asyncio’ uses to manage +control flow. This is where the magic happens. You’ll come away from +this section knowing what ‘await’ does behind the scenes and how to make +your own asynchronous operators. + +* Menu: + +* The inner workings of coroutines:: +* Futures: Futures<2>. +* A homemade asyncio.sleep: A homemade asyncio sleep. + + +File: python.info, Node: The inner workings of coroutines, Next: Futures<2>, Up: A conceptual overview part 2 the nuts and bolts + +9.1.2.1 The inner workings of coroutines +........................................ + +‘asyncio’ leverages four components to pass around control. + +*note coroutine.send(arg): 1fcc. 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: 203b, like 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__(): 1fc7. 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: bfa. exception with the +return value attached in the *note value: 1fc9. 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: + 203f, a different beast entirely. + + 2. What about a *note yield from: 203b. within the coroutine + function to a (plain) generator? That causes the error: + ‘SyntaxError: yield from not allowed in a coroutine.’ This was + intentionally designed for the sake of simplicity – mandating only + one way of using coroutines. Initially ‘yield’ was barred as well, + but was re-accepted to allow for async generators. Despite that, + ‘yield from’ and ‘await’ effectively do the same thing. + + +File: python.info, Node: Futures<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 Futures +............... + +A *note future: 337c. 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: 1be. subclasses *note asyncio.Future: bcd. 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: Futures<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(): a6f. + +This snippet registers a few tasks with the event loop and then awaits a +coroutine wrapped in a task: ‘async_sleep(3)’. 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(): 32ae. (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’ll use a rather bare object, ‘YieldToEventLoop()’, to ‘yield’ +from ‘__await__’ in order to cede 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. Eventually, enough +time will have elapsed, and ‘_sleep_watcher(...)’ will mark the future +as done, and then itself finish too by breaking out of the 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 of 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: a. + + +File: python.info, Node: Porting Extension Modules to Python 3, Next: Curses Programming with Python, Prev: A Conceptual Overview of asyncio, Up: Python HOWTOs + +9.2 Porting Extension Modules to Python 3 +========================================= + +We recommend the following resources for porting extension modules to +Python 3: + + * The Migrating C extensions(1) chapter from 'Supporting Python 3: An + in-depth guide', a book on moving from Python 2 to Python 3 in + general, guides the reader through porting an extension module. + + * The Porting guide(2) from the 'py3c' project provides opinionated + suggestions with supporting code. + + * *note Recommended third party tools: 48a8. 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: Curses Programming with Python, Next: Descriptor Guide, Prev: Porting Extension Modules to Python 3, Up: Python HOWTOs + +9.3 Curses Programming with Python +================================== + + +Author: A.M. Kuchling, Eric S. Raymond + + +Release: 2.04 + +Abstract +........ + +This document describes how to use the *note curses: 2b. extension +module to control text-mode displays. + +* Menu: + +* What is curses?:: +* Starting and ending a curses application:: +* Windows and Pads:: +* Displaying Text:: +* User Input:: +* For More Information:: + + +File: python.info, Node: What is curses?, Next: Starting and ending a curses application, Up: Curses Programming with Python + +9.3.1 What is curses? +--------------------- + +The curses library supplies a terminal-independent screen-painting and +keyboard-handling facility for text-based terminals; such terminals +include VT100s, the Linux console, and the simulated terminal provided +by various programs. Display terminals support various control codes to +perform common operations such as moving the cursor, scrolling the +screen, and erasing areas. Different terminals use widely differing +codes, and often have their own minor quirks. + +In a world of graphical displays, one might ask “why bother”? It’s true +that character-cell display terminals are an obsolete technology, but +there are niches in which being able to do fancy things with them are +still valuable. One niche is on small-footprint or embedded Unixes that +don’t run an X server. Another is tools such as OS installers and +kernel configurators that may have to run before any graphical support +is available. + +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). + +The curses library was originally written for BSD Unix; the later System +V versions of Unix from AT&T added many enhancements and new functions. +BSD curses is no longer maintained, having been replaced by ncurses, +which is an open-source implementation of the AT&T interface. If you’re +using an open-source Unix such as Linux or FreeBSD, your system almost +certainly uses ncurses. Since most current commercial Unix versions are +based on System V code, all the functions described here will probably +be available. The older versions of curses carried by some proprietary +Unixes may not support everything, though. + +The Windows version of Python doesn’t include the *note curses: 2b. +module. A ported version called UniCurses(2) is available. + +* Menu: + +* The Python curses module:: + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/Urwid/ + + (2) https://pypi.org/project/UniCurses/ + + +File: python.info, Node: The Python curses module, Up: What is curses? + +9.3.1.1 The 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(): 2f77. method. You’ll see +this covered in more detail later. + +This HOWTO is an introduction to writing text-mode programs with curses +and Python. It doesn’t attempt to be a complete guide to the curses +API; for that, see the Python library guide’s section on ncurses, and +the C manual pages for ncurses. It will, however, give you the basic +ideas. + + +File: python.info, Node: Starting and ending a curses application, Next: Windows and Pads, Prev: What is curses?, Up: Curses Programming with Python + +9.3.2 Starting and ending a curses application +---------------------------------------------- + +Before doing anything, curses must be initialized. This is done by +calling the *note initscr(): 15a2. 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(): 2fa0. +function. + + curses.noecho() + +Applications will also commonly need to react to keys instantly, without +requiring the Enter key to be pressed; this is called cbreak mode, as +opposed to the usual buffered input mode. + + curses.cbreak() + +Terminals usually return special keys, such as the cursor keys or +navigation keys such as Page Up and Home, as a multibyte escape +sequence. While you could write your application to expect such +sequences and process them accordingly, curses can do it for you, +returning a special value such as *note curses.KEY_LEFT: 301a. To get +curses to do the job, you’ll have to enable keypad mode. + + stdscr.keypad(True) + +Terminating a curses application is much easier than starting one. +You’ll need to call: + + curses.nocbreak() + stdscr.keypad(False) + curses.echo() + +to reverse the curses-friendly terminal settings. Then call the *note +endwin(): 2f7a. function to restore the terminal to its original +operating mode. + + curses.endwin() + +A common problem when debugging a curses application is to get your +terminal messed up when the application dies without restoring the +terminal to its previous state. In Python this commonly happens when +your code is buggy and raises an uncaught exception. Keys are no longer +echoed to the screen when you type them, for example, which makes using +the shell difficult. + +In Python you can avoid these complications and make debugging much +easier by importing the *note curses.wrapper(): a80. function and using +it like this: + + 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(): a80. 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: 6e4.…*note except: +18b. 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: Windows and Pads, Next: Displaying Text, Prev: Starting and ending a curses application, Up: Curses Programming with Python + +9.3.3 Windows and Pads +---------------------- + +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(): 15a2. 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(): 2f9e. 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: 170b. and *note curses.COLS: 170c. 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(): 2f78. 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. Calls the *note noutrefresh(): 2f76. method of each window to + update an underlying data structure representing the desired state + of the screen. + + 2. Calls the function *note doupdate(): 2f75. function to change the + physical screen to match the desired state recorded in the data + structure. + +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: Displaying Text, Next: User Input, Prev: Windows and Pads, Up: Curses Programming with Python + +9.3.4 Displaying Text +--------------------- + +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. + +Fortunately the Python interface hides all these details. ‘stdscr’ is a +window object like any other, and methods such as *note addstr(): 2f77. +accept multiple argument forms. Usually there are four different forms. + +Form Description + +------------------------------------------------------------------------------------------ + +'str' or 'ch' Display the string 'str' or character 'ch' at the + current position + + +'str' or 'ch', 'attr' Display the string 'str' or character 'ch', using + attribute 'attr' at the current position + + +'y', 'x', 'str' or 'ch' Move to position 'y,x' within the window, and + display 'str' or 'ch' + + +'y', 'x', 'str' or 'ch', 'attr' Move to position 'y,x' within the window, and + display 'str' or 'ch', using attribute 'attr' + + +Attributes allow displaying text in highlighted forms such as boldface, +underline, reverse code, or in color. They’ll be explained in more +detail in the next subsection. + +The *note addstr(): 2f77. 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: 108f. attribute; this defaults to the default +system encoding as returned by *note locale.getencoding(): 2e0. + +The *note addch(): 2fb9. 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: 3087. is a ++/- symbol, and *note ACS_ULCORNER: 2fc3. is the upper left corner of a +box (handy for drawing borders). You can also use the appropriate +Unicode character. + +Windows remember where the cursor was left after the last operation, so +if you leave out the 'y,x' coordinates, the string or character will be +displayed wherever the last operation left off. You can also move the +cursor with the ‘move(y,x)’ method. Because some terminals always +display a flashing cursor, you may want to ensure that the cursor is +positioned in some location where it won’t be distracting; it can be +confusing to have the cursor blinking at some apparently random +location. + +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(): 2f6f. 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: + +* Attributes and Color:: + + +File: python.info, Node: Attributes and Color, Up: Displaying Text + +9.3.4.1 Attributes and Color +............................ + +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. + +An attribute is an integer, each bit representing a different attribute. +You can try to display text with multiple attribute bits set, but curses +doesn’t guarantee that all the possible combinations are available, or +that they’re all visually distinct. That depends on the ability of the +terminal being used, so it’s safest to stick to the most commonly +available attributes, listed here. + +Attribute Description + +---------------------------------------------------------------------- + +*note A_BLINK: 3006. Blinking text + + +*note A_BOLD: 3007. Extra bright or bold text + + +*note A_DIM: 3008. Half bright text + + +*note A_REVERSE: 2f6d. Reverse-video text + + +*note A_STANDOUT: 2f6c. The best highlighting mode available + + +*note A_UNDERLINE: 300c. Underlined text + + +So, to display a reverse-video status line on the top line of the +screen, you could code: + + stdscr.addstr(0, 0, "Current mode: Typing mode", + curses.A_REVERSE) + stdscr.refresh() + +The curses library also supports color on those terminals that provide +it. The most common such terminal is probably the Linux console, +followed by color xterms. + +To use color, you must call the *note start_color(): 2faa. function soon +after calling *note initscr(): 15a2, to initialize the default color set +(the *note curses.wrapper(): a80. function does this automatically). +Once that’s done, the *note has_colors(): 2f8d. 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(): 2f6b. function; this can be bitwise-OR’ed with other +attributes such as *note A_REVERSE: 2f6d, but again, such combinations +are not guaranteed to work on all terminals. + +An example, which displays a line of text using color pair 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(): 2faa. 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: 2b. +module defines named constants for each of these colors: *note +curses.COLOR_BLACK: 3099, *note curses.COLOR_RED: 309e, and so forth. + +Let’s put all this together. To change color 1 to red text on a white +background, you would call: + + curses.init_pair(1, curses.COLOR_RED, curses.COLOR_WHITE) + +When you change a color pair, any text already displayed using that +color pair will change to the new colors. You can also display new text +in this color with: + + 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(): 2f68, 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: User Input, Next: For More Information, Prev: Displaying Text, Up: Curses Programming with Python + +9.3.5 User Input +---------------- + +The C curses library offers only very simple input mechanisms. Python’s +*note curses: 2b. module adds a basic text-input widget. (Other +libraries such as Urwid(1) have more extensive collections of widgets.) + +There are two methods for getting input from a window: + + * *note getch(): 1540. refreshes the screen and then waits for the + user to hit a key, displaying the key if *note echo(): 2f79. has + been called earlier. You can optionally specify a coordinate to + which the cursor should be moved before pausing. + + * *note getkey(): 2fd7. 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(): 2fed. +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(): 2f91. 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: +302b, *note curses.KEY_HOME: 301c, or *note curses.KEY_LEFT: 301a. 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: 2c. 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(): 30e0. returns the control character +corresponding to its argument. + +There’s also a method to retrieve an entire string, *note getstr(): +2fda. 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: 2e. module supplies a text box that supports +an Emacs-like set of keybindings. Various methods of the *note Textbox: +30a2. 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() + +See the library documentation on *note curses.textpad: 2e. for more +details. + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/Urwid/ + + +File: python.info, Node: For More Information, Prev: User Input, Up: Curses Programming with Python + +9.3.6 For More Information +-------------------------- + +This HOWTO doesn’t cover some advanced topics, such as reading the +contents of the screen or capturing mouse events from an xterm instance, +but the Python library page for the *note curses: 2b. module is now +reasonably complete. You should browse it next. + +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_*: 3073. 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): video of a PyCon 2013 talk on + controlling terminals using curses or Urwid. + + * "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: Descriptor Guide, Next: Debugging C API extensions and CPython Internals with GDB, Prev: Curses Programming with Python, Up: Python HOWTOs + +9.4 Descriptor Guide +==================== + + +Author: Raymond Hettinger + + +Contact: <python at rcn dot com> + +*note Descriptors: 1572. let objects customize attribute lookup, +storage, and deletion. + +This guide has four major sections: + + 1. The “primer” gives a basic overview, moving gently from simple + examples, adding one feature at a time. Start here if you’re new + to descriptors. + + 2. The second section shows a complete, practical descriptor example. + If you already know the basics, start there. + + 3. The third section provides a more technical tutorial that goes into + the detailed mechanics of how descriptors work. Most people don’t + need this level of detail. + + 4. The last section has pure Python equivalents for built-in + descriptors that are written in C. Read this if you’re curious + about how functions turn into bound methods or about the + implementation of common tools like *note classmethod(): 166, *note + staticmethod(): 412, *note property(): 194, and *note __slots__: + 5db. + +* Menu: + +* Primer:: +* Complete Practical Example:: +* Technical Tutorial:: +* Pure Python Equivalents:: + + +File: python.info, Node: Primer, Next: Complete Practical Example, Up: Descriptor Guide + +9.4.1 Primer +------------ + +In this primer, we start with the most basic possible example and then +we’ll add new capabilities one by one. + +* Menu: + +* Simple example; A descriptor that returns a constant: Simple example A descriptor that returns a constant. +* Dynamic lookups:: +* Managed attributes:: +* Customized names:: +* Closing thoughts:: + + +File: python.info, Node: Simple example A descriptor that returns a constant, Next: Dynamic lookups, Up: Primer + +9.4.1.1 Simple example: A descriptor that returns a constant +............................................................ + +The ‘Ten’ class is a descriptor whose *note __get__(): 14b2. method +always returns the constant ‘10’: + + class Ten: + def __get__(self, obj, objtype=None): + return 10 + +To use the descriptor, it must be stored as a class variable in another +class: + + class A: + x = 5 # Regular class attribute + y = Ten() # Descriptor instance + +An interactive session shows the difference between normal attribute +lookup and descriptor lookup: + + >>> a = A() # Make an instance of class A + >>> a.x # Normal attribute lookup + 5 + >>> a.y # Descriptor lookup + 10 + +In the ‘a.x’ attribute lookup, the dot operator finds ‘'x': 5’ in the +class dictionary. In the ‘a.y’ lookup, the dot operator finds a +descriptor instance, recognized by its ‘__get__’ method. Calling that +method returns ‘10’. + +Note that the value ‘10’ is not stored in either the class dictionary or +the instance dictionary. Instead, the value ‘10’ is computed on demand. + +This example shows how a simple descriptor works, but it isn’t very +useful. For retrieving constants, normal attribute lookup would be +better. + +In the next section, we’ll create something more useful, a dynamic +lookup. + + +File: python.info, Node: Dynamic lookups, Next: Managed attributes, Prev: Simple example A descriptor that returns a constant, Up: Primer + +9.4.1.2 Dynamic lookups +....................... + +Interesting descriptors typically run computations instead of returning +constants: + + 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 + +An interactive session shows that the lookup is dynamic — it computes +different, updated answers each time: + + >>> 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__(): 14b2. The +'self' parameter is 'size', an instance of 'DirectorySize'. The 'obj' +parameter is either 'g' or 's', an instance of 'Directory'. It is the +'obj' parameter that lets the *note __get__(): 14b2. method learn the +target directory. The 'objtype' parameter is the class 'Directory'. + + +File: python.info, Node: Managed attributes, Next: Customized names, Prev: Dynamic lookups, Up: Primer + +9.4.1.3 Managed attributes +.......................... + +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__(): 14b2. and *note +__set__(): 1f6a. methods are triggered when the public attribute is +accessed. + +In the following example, 'age' is the public attribute and '_age' is +the private attribute. When the public attribute is accessed, the +descriptor logs the lookup or update: + + 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__() + +An interactive session shows that all access to the managed attribute +'age' is logged, but that the regular attribute 'name' is not logged: + + >>> 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 + +One major issue with this example is that the private name '_age' is +hardwired in the 'LoggedAgeAccess' class. That means that each instance +can only have one logged attribute and that its name is unchangeable. +In the next example, we’ll fix that problem. + + +File: python.info, Node: Customized names, Next: Closing thoughts, Prev: Managed attributes, Up: Primer + +9.4.1.4 Customized names +........................ + +When a class uses descriptors, it can inform each descriptor about which +variable name was used. + +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__(): c4e. 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__(): c4e. so that the field names would be recorded. Here we +call *note vars(): 1a41. 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'} + +The new class now logs access to both 'name' and '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 + +The two 'Person' instances contain only the private names: + + >>> vars(pete) + {'_name': 'Peter P', '_age': 10} + >>> vars(kate) + {'_name': 'Catherine C', '_age': 20} + + +File: python.info, Node: Closing thoughts, Prev: Customized names, Up: Primer + +9.4.1.5 Closing thoughts +........................ + +A *note descriptor: 1572. is what we call any object that defines *note +__get__(): 14b2, *note __set__(): 1f6a, or *note __delete__(): 1609. + +Optionally, descriptors can have a *note __set_name__(): c4e. 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.) + +Descriptors get invoked by the dot operator during attribute lookup. If +a descriptor is accessed indirectly with +‘vars(some_class)[descriptor_name]’, the descriptor instance is returned +without invoking it. + +Descriptors only work when used as class variables. When put in +instances, they have no effect. + +The main motivation for descriptors is to provide a hook allowing +objects stored in class variables to control what happens during +attribute lookup. + +Traditionally, the calling class controls what happens during lookup. +Descriptors invert that relationship and allow the data being looked-up +to have a say in the matter. + +Descriptors are used throughout the language. It is how functions turn +into bound methods. Common tools like *note classmethod(): 166, *note +staticmethod(): 412, *note property(): 194, and *note +functools.cached_property(): 53e. are all implemented as descriptors. + + +File: python.info, Node: Complete Practical Example, Next: Technical Tutorial, Prev: Primer, Up: Descriptor Guide + +9.4.2 Complete Practical Example +-------------------------------- + +In this example, we create a practical and powerful tool for locating +notoriously hard to find data corruption bugs. + +* Menu: + +* Validator class:: +* Custom validators:: +* Practical application:: + + +File: python.info, Node: Validator class, Next: Custom validators, Up: Complete Practical Example + +9.4.2.1 Validator class +....................... + +A validator is a descriptor for managed attribute access. Prior to +storing any data, it verifies that the new value meets various type and +range restrictions. If those restrictions aren’t met, it raises an +exception to prevent data corruption at its source. + +This ‘Validator’ class is both an *note abstract base class: 11a8. 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: Custom validators, Next: Practical application, Prev: Validator class, Up: Complete Practical Example + +9.4.2.2 Custom validators +......................... + +Here are three practical data validation utilities: + + 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: 259. or + *note float: 2f1. Optionally, it verifies that a value is between + a given minimum or maximum. + + 3. ‘String’ verifies that a value is a *note str: 447. 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 an 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: Practical application, Prev: Custom validators, Up: Complete Practical Example + +9.4.2.3 Practical application +............................. + +Here’s how the data validators can be used in a real class: + + 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 + +The descriptors prevent invalid instances from being created: + + >>> 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: Technical Tutorial, Next: Pure Python Equivalents, Prev: Complete Practical Example, Up: Descriptor Guide + +9.4.3 Technical Tutorial +------------------------ + +What follows is a more technical tutorial for the mechanics and details +of how descriptors work. + +* Menu: + +* Abstract:: +* Definition and introduction:: +* Descriptor protocol:: +* Overview of descriptor invocation:: +* Invocation from an instance:: +* Invocation from a class:: +* Invocation from super:: +* Summary of invocation logic:: +* Automatic name notification:: +* ORM example:: + + +File: python.info, Node: Abstract, Next: Definition and introduction, Up: Technical Tutorial + +9.4.3.1 Abstract +................ + +Defines descriptors, summarizes the protocol, and shows how descriptors +are called. Provides an example showing how object relational mappings +work. + +Learning about descriptors not only provides access to a larger toolset, +it creates a deeper understanding of how Python works. + + +File: python.info, Node: Definition and introduction, Next: Descriptor protocol, Prev: Abstract, Up: Technical Tutorial + +9.4.3.2 Definition and introduction +................................... + +In general, a descriptor is an attribute value that has one of the +methods in the descriptor protocol. Those methods are *note __get__(): +14b2, *note __set__(): 1f6a, and *note __delete__(): 1609. If any of +those methods are defined for an attribute, it is said to be a *note +descriptor: 1572. + +The default behavior for attribute access is to get, set, or delete the +attribute from an object’s dictionary. For instance, ‘a.x’ has a lookup +chain starting with ‘a.__dict__['x']’, then ‘type(a).__dict__['x']’, and +continuing through the method resolution order of ‘type(a)’. If the +looked-up value is an object defining one of the descriptor methods, +then Python may override the default behavior and invoke the descriptor +method instead. Where this occurs in the precedence chain depends on +which descriptor methods were defined. + +Descriptors are a powerful, general purpose protocol. They are the +mechanism behind properties, methods, static methods, class methods, and +*note super(): 4d7. 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: Descriptor protocol, Next: Overview of descriptor invocation, Prev: Definition and introduction, Up: Technical Tutorial + +9.4.3.3 Descriptor protocol +........................... + +‘descr.__get__(self, obj, type=None)’ + +‘descr.__set__(self, obj, value)’ + +‘descr.__delete__(self, obj)’ + +That is all there is to it. Define any of these methods and an object +is considered a descriptor and can override default behavior upon being +looked up as an attribute. + +If an object defines *note __set__(): 1f6a. or *note __delete__(): 1609, +it is considered a data descriptor. Descriptors that only define *note +__get__(): 14b2. are called non-data descriptors (they are often used +for methods but other uses are possible). + +Data and non-data descriptors differ in how overrides are calculated +with respect to entries in an instance’s dictionary. If an instance’s +dictionary has an entry with the same name as a data descriptor, the +data descriptor takes precedence. If an instance’s dictionary has an +entry with the same name as a non-data descriptor, the dictionary entry +takes precedence. + +To make a read-only data descriptor, define both *note __get__(): 14b2. +and *note __set__(): 1f6a. with the *note __set__(): 1f6a. raising an +*note AttributeError: 348. when called. Defining the *note __set__(): +1f6a. method with an exception raising placeholder is enough to make it +a data descriptor. + + +File: python.info, Node: Overview of descriptor invocation, Next: Invocation from an instance, Prev: Descriptor protocol, Up: Technical Tutorial + +9.4.3.4 Overview of descriptor invocation +......................................... + +A descriptor can be called directly with ‘desc.__get__(obj)’ or +‘desc.__get__(None, cls)’. + +But it is more common for a descriptor to be invoked automatically from +attribute access. + +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__: 558, its *note __get__(): 14b2. method is +invoked according to the precedence rules listed below. + +The details of invocation depend on whether ‘obj’ is an object, class, +or instance of super. + + +File: python.info, Node: Invocation from an instance, Next: Invocation from a class, Prev: Overview of descriptor invocation, Up: Technical Tutorial + +9.4.3.5 Invocation from an instance +................................... + +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__(): 4cf. if it is provided. + +If a descriptor is found for ‘a.x’, then it is invoked with: +‘desc.__get__(a, type(a))’. + +The logic for a dotted lookup is in *note object.__getattribute__(): +bd2. Here is a pure Python equivalent: + + def find_name_in_mro(cls, name, default): + "Emulate _PyType_Lookup() in Objects/typeobject.c" + for base in cls.__mro__: + if name in vars(base): + return vars(base)[name] + return default + + def object_getattribute(obj, name): + "Emulate PyObject_GenericGetAttr() in Objects/object.c" + null = object() + objtype = type(obj) + cls_var = find_name_in_mro(objtype, name, null) + descr_get = getattr(type(cls_var), '__get__', null) + if descr_get is not null: + if (hasattr(type(cls_var), '__set__') + or hasattr(type(cls_var), '__delete__')): + return descr_get(cls_var, obj, objtype) # data descriptor + if hasattr(obj, '__dict__') and name in vars(obj): + return vars(obj)[name] # instance variable + if descr_get is not null: + return descr_get(cls_var, obj, objtype) # non-data descriptor + if cls_var is not null: + return cls_var # class variable + raise AttributeError(name) + +Note, there is no *note __getattr__(): 4cf. hook in the *note +__getattribute__(): bd2. code. That is why calling *note +__getattribute__(): bd2. directly or with ‘super().__getattribute__’ +will bypass *note __getattr__(): 4cf. entirely. + +Instead, it is the dot operator and the *note getattr(): bd1. function +that are responsible for invoking *note __getattr__(): 4cf. whenever +*note __getattribute__(): bd2. raises an *note AttributeError: 348. +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: Invocation from a class, Next: Invocation from super, Prev: Invocation from an instance, Up: Technical Tutorial + +9.4.3.6 Invocation from a class +............................... + +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: +2180. + +If a descriptor is found, it is invoked with ‘desc.__get__(None, A)’. + +The full C implementation can be found in ‘type_getattro()’ and +‘_PyType_Lookup()’ in Objects/typeobject.c(1). + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Objects/typeobject.c + + +File: python.info, Node: Invocation from super, Next: Summary of invocation logic, Prev: Invocation from a class, Up: Technical Tutorial + +9.4.3.7 Invocation from super +............................. + +The logic for super’s dotted lookup is in the *note __getattribute__(): +bd2. method for object returned by *note super(): 4d7. + +A dotted lookup such as ‘super(A, obj).m’ searches +‘obj.__class__.__mro__’ for the base class ‘B’ immediately following ‘A’ +and then returns ‘B.__dict__['m'].__get__(obj, A)’. If not a +descriptor, ‘m’ is returned unchanged. + +The full C implementation can be found in ‘super_getattro()’ in +Objects/typeobject.c(1). A pure Python equivalent can be found in +Guido's Tutorial(2). + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Objects/typeobject.c + + (2) +https://www.python.org/download/releases/2.2.3/descrintro/#cooperation + + +File: python.info, Node: Summary of invocation logic, Next: Automatic name notification, Prev: Invocation from super, Up: Technical Tutorial + +9.4.3.8 Summary of invocation logic +................................... + +The mechanism for descriptors is embedded in the *note +__getattribute__(): bd2. methods for *note object: a8c, *note type: d48, +and *note super(): 4d7. + +The important points to remember are: + + * Descriptors are invoked by the *note __getattribute__(): bd2. + method. + + * Classes inherit this machinery from *note object: a8c, *note type: + d48, or *note super(): 4d7. + + * Overriding *note __getattribute__(): bd2. prevents automatic + descriptor calls because all the descriptor logic is in that + method. + + * ‘object.__getattribute__()’ and ‘type.__getattribute__()’ make + different calls to *note __get__(): 14b2. The first includes the + instance and may include the class. The second puts in ‘None’ for + the instance and always includes the class. + + * Data descriptors always override instance dictionaries. + + * Non-data descriptors may be overridden by instance dictionaries. + + +File: python.info, Node: Automatic name notification, Next: ORM example, Prev: Summary of invocation logic, Up: Technical Tutorial + +9.4.3.9 Automatic name notification +................................... + +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: +d48. metaclass scans the dictionary of the new class. If any of the +entries are descriptors and if they define *note __set_name__(): c4e, +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. + +The implementation details are in ‘type_new()’ and ‘set_names()’ in +Objects/typeobject.c(1). + +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__(): c4e. will need to be called +manually. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Objects/typeobject.c + + +File: python.info, Node: ORM example, Prev: Automatic name notification, Up: Technical Tutorial + +9.4.3.10 ORM example +.................... + +The following code is a simplified skeleton showing how data descriptors +could be used to implement an object relational mapping(1). + +The essential idea is that the data is stored in an external database. +The Python instances only hold keys to the database’s tables. +Descriptors take care of lookups or updates: + + 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 + +To use the models, first connect to the database: + + >>> import sqlite3 + >>> conn = sqlite3.connect('entertainment.db') + +An interactive session shows how data is retrieved from the database and +how it can be updated: + + >>> 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: Pure Python Equivalents, Prev: Technical Tutorial, Up: Descriptor Guide + +9.4.4 Pure Python Equivalents +----------------------------- + +The descriptor protocol is simple and offers exciting possibilities. +Several use cases are so common that they have been prepackaged into +built-in tools. Properties, bound methods, static methods, class +methods, and __slots__ are all based on the descriptor protocol. + +* Menu: + +* Properties:: +* Functions and methods:: +* Kinds of methods:: +* Static methods:: +* Class methods:: +* Member objects and __slots__:: + + +File: python.info, Node: Properties, Next: Functions and methods, Up: Pure Python Equivalents + +9.4.4.1 Properties +.................. + +Calling *note property(): 194. is a succinct way of building a data +descriptor that triggers a function call upon access to an attribute. +Its signature is: + + property(fget=None, fset=None, fdel=None, doc=None) -> property + +The documentation shows a typical use to define a managed attribute ‘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(): 194. 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__) + +The *note property(): 194. builtin helps whenever a user interface has +granted attribute access and then subsequent changes require the +intervention of a method. + +For instance, a spreadsheet class may grant access to a cell value +through ‘Cell('b10').value’. Subsequent improvements to the program +require the cell to be recalculated on every access; however, the +programmer does not want to affect existing client code accessing the +attribute directly. The solution is to wrap access to the value +attribute in a property data descriptor: + + class Cell: + ... + + @property + def value(self): + "Recalculate the cell before returning value" + self.recalc() + return self._value + +Either the built-in *note property(): 194. or our ‘Property()’ +equivalent would work in this example. + + +File: python.info, Node: Functions and methods, Next: Kinds of methods, Prev: Properties, Up: Pure Python Equivalents + +9.4.4.2 Functions and methods +............................. + +Python’s object oriented features are built upon a function based +environment. Using non-data descriptors, the two are merged seamlessly. + +Functions stored in class dictionaries get turned into methods when +invoked. Methods only differ from regular functions in that the object +instance is prepended to the other arguments. By convention, the +instance is called 'self' but could be called 'this' or any other +variable name. + +Methods can be created manually with *note types.MethodType: 17f8. which +is roughly equivalent to: + + 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__(): 14b2. 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) + +Running the following class in the interpreter shows how the function +descriptor works in practice: + + class D: + def f(self): + return self + + class D2: + pass + +The function has a *note qualified name: 1941. attribute to support +introspection: + + >>> D.f.__qualname__ + 'D.f' + +Accessing the function through the class dictionary does not invoke +*note __get__(): 14b2. Instead, it just returns the underlying function +object: + + >>> D.__dict__['f'] + <function D.f at 0x00C45070> + +Dotted access from a class calls *note __get__(): 14b2. 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__(): 14b2. which returns a bound +method object: + + >>> d = D() + >>> d.f + <bound method D.f of <__main__.D object at 0x00B18C90>> + +Internally, the bound method stores the underlying function and the +bound instance: + + >>> d.f.__func__ + <function D.f at 0x00C45070> + + >>> d.f.__self__ + <__main__.D object at 0x00B18C90> + +If you have ever wondered where 'self' comes from in regular methods or +where 'cls' comes from in class methods, this is it! + + +File: python.info, Node: Kinds of methods, Next: Static methods, Prev: Functions and methods, Up: Pure Python Equivalents + +9.4.4.3 Kinds of methods +........................ + +Non-data descriptors provide a simple mechanism for variations on the +usual patterns of binding functions into methods. + +To recap, functions have a *note __get__(): 14b2. 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)’. + +This chart summarizes the binding and its two most useful variants: + + Transformation Called from an object Called from a class + + ------------------------------------------------------------------------ + + function f(obj, *args) f(*args) + + + staticmethod f(*args) f(*args) + + + classmethod f(type(obj), *args) f(cls, *args) + + + +File: python.info, Node: Static methods, Next: Class methods, Prev: Kinds of methods, Up: Pure Python Equivalents + +9.4.4.4 Static methods +...................... + +Static methods return the underlying function without changes. Calling +either ‘c.f’ or ‘C.f’ is the equivalent of a direct lookup into +‘object.__getattribute__(c, "f")’ or ‘object.__getattribute__(C, "f")’. +As a result, the function becomes identically accessible from either an +object or a class. + +Good candidates for static methods are methods that do not reference the +‘self’ variable. + +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’. + +Since static methods return the underlying function with no changes, the +example calls are unexciting: + + class E: + @staticmethod + def f(x): + return x * 10 + + >>> E.f(3) + 30 + >>> E().f(3) + 30 + +Using the non-data descriptor protocol, a pure Python version of *note +staticmethod(): 412. would look like this: + + 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) + +The *note functools.update_wrapper(): 101b. 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: *note __name__: 12c7, *note __qualname__: 1efd, *note +__doc__: 11cb, and *note __annotations__: 11ca. + + +File: python.info, Node: Class methods, Next: Member objects and __slots__, Prev: Static methods, Up: Pure Python Equivalents + +9.4.4.5 Class methods +..................... + +Unlike static methods, class methods prepend the class reference to the +argument list before calling the function. This format is the same for +whether the caller is an object or a class: + + class F: + @classmethod + def f(cls, x): + return cls.__name__, x + + >>> F.f(3) + ('F', 3) + >>> F().f(3) + ('F', 3) + +This behavior is useful whenever the method only needs to have a class +reference and does not rely on data stored in a specific instance. One +use for class methods is to create alternate class constructors. For +example, the classmethod *note dict.fromkeys(): 1551. creates a new +dictionary from a list of keys. The pure Python equivalent is: + + 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 + +Now a new dictionary of unique keys can be constructed like this: + + >>> d = Dict.fromkeys('abracadabra') + >>> type(d) is Dict + True + >>> d + {'a': None, 'b': None, 'r': None, 'c': None, 'd': None} + +Using the non-data descriptor protocol, a pure Python version of *note +classmethod(): 166. would look like this: + + 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) + +The *note functools.update_wrapper(): 101b. call in ‘ClassMethod’ 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: *note __name__: 12c7, *note __qualname__: 1efd, +*note __doc__: 11cb, and *note __annotations__: 11ca. + + +File: python.info, Node: Member objects and __slots__, Prev: Class methods, Up: Pure Python Equivalents + +9.4.4.6 Member objects and __slots__ +.................................... + +When a class defines ‘__slots__’, it replaces instance dictionaries with +a fixed-length array of slot values. From a user point of view that has +several effects: + +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(): 53e. 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. + +It is not possible to create an exact drop-in pure Python version of +‘__slots__’ because it requires direct access to C structures and +control over object memory allocation. However, we can build a mostly +faithful simulation where the actual C structure for slots is emulated +by a private ‘_slotvalues’ list. Reads and writes to that private +structure are managed by member descriptors: + + null = object() + + class Member: + + def __init__(self, name, clsname, offset): + 'Emulate PyMemberDef in Include/structmember.h' + # Also see descr_new() in Objects/descrobject.c + self.name = name + self.clsname = clsname + self.offset = offset + + def __get__(self, obj, objtype=None): + 'Emulate member_get() in Objects/descrobject.c' + # Also see PyMember_GetOne() in Python/structmember.c + if obj is None: + return self + value = obj._slotvalues[self.offset] + if value is null: + raise AttributeError(self.name) + return value + + def __set__(self, obj, value): + 'Emulate member_set() in Objects/descrobject.c' + obj._slotvalues[self.offset] = value + + def __delete__(self, obj): + 'Emulate member_delete() in Objects/descrobject.c' + value = obj._slotvalues[self.offset] + if value is null: + raise AttributeError(self.name) + obj._slotvalues[self.offset] = null + + def __repr__(self): + 'Emulate member_repr() in Objects/descrobject.c' + return f'<Member {self.name!r} of {self.clsname!r}>' + +The ‘type.__new__()’ method takes care of adding member objects to class +variables: + + class Type(type): + 'Simulate how the type metaclass adds member objects for slots' + + def __new__(mcls, clsname, bases, mapping, **kwargs): + 'Emulate type_new() in Objects/typeobject.c' + # type_new() calls PyTypeReady() which calls add_methods() + slot_names = mapping.get('slot_names', []) + for offset, name in enumerate(slot_names): + mapping[name] = Member(name, clsname, offset) + return type.__new__(mcls, clsname, bases, mapping, **kwargs) + +The *note object.__new__(): 57d. method takes care of creating instances +that have slots instead of an instance dictionary. Here is a rough +simulation in pure 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: 1f86. 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 + +At this point, the metaclass has loaded member objects for 'x' and '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'>} + +When instances are created, they have a ‘slot_values’ list where the +attributes are stored: + + >>> h = H(10, 20) + >>> vars(h) + {'_slotvalues': [10, 20]} + >>> h.x = 55 + >>> vars(h) + {'_slotvalues': [55, 20]} + +Misspelled or unassigned attributes will raise an exception: + + >>> 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: Enum HOWTO, Prev: Descriptor Guide, Up: Python HOWTOs + +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: 334.* 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. + + Note: 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. + + Note: 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: 1fb. 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: 1fa. (‘-X dev’). + +Both enable extra assertions and disable some optimizations. Sometimes +this hides the bug you are trying to find, but in most cases they make +the process easier. + + +File: python.info, Node: Using the python-gdb extension, Next: Use with GDB commands, Prev: Using the Debug build and Development mode, Up: Debugging C API extensions and CPython Internals with GDB + +9.5.3 Using the ‘python-gdb’ extension +-------------------------------------- + +When the extension is loaded, it provides two main features: pretty +printers for Python values, and additional commands. + +* Menu: + +* Pretty-printers:: +* py-list:: +* py-up and py-down:: +* py-bt:: +* py-print:: +* py-locals:: + + +File: python.info, Node: Pretty-printers, Next: py-list, Up: Using the python-gdb extension + +9.5.3.1 Pretty-printers +....................... + +This is what a GDB backtrace looks like (truncated) when this extension +is enabled: + + #0 0x000000000041a6b1 in PyObject_Malloc (nbytes=Cannot access memory at address 0x7fffff7fefe8 + ) at Objects/obmalloc.c:748 + #1 0x000000000041b7c0 in _PyObject_DebugMallocApi (id=111 'o', nbytes=24) at Objects/obmalloc.c:1445 + #2 0x000000000041b717 in _PyObject_DebugMalloc (nbytes=24) at Objects/obmalloc.c:1412 + #3 0x000000000044060a in _PyUnicode_New (length=11) at Objects/unicodeobject.c:346 + #4 0x00000000004466aa in PyUnicodeUCS2_DecodeUTF8Stateful (s=0x5c2b8d "__lltrace__", size=11, errors=0x0, consumed= + 0x0) at Objects/unicodeobject.c:2531 + #5 0x0000000000446647 in PyUnicodeUCS2_DecodeUTF8 (s=0x5c2b8d "__lltrace__", size=11, errors=0x0) + at Objects/unicodeobject.c:2495 + #6 0x0000000000440d1b in PyUnicodeUCS2_FromStringAndSize (u=0x5c2b8d "__lltrace__", size=11) + at Objects/unicodeobject.c:551 + #7 0x0000000000440d94 in PyUnicodeUCS2_FromString (u=0x5c2b8d "__lltrace__") at Objects/unicodeobject.c:569 + #8 0x0000000000584abd in PyDict_GetItemString (v= + {'Yuck': <type at remote 0xad4730>, '__builtins__': <module at remote 0x7ffff7fd5ee8>, '__file__': 'Lib/test/crashers/nasty_eq_vs_dict.py', '__package__': None, 'y': <Yuck(i=0) at remote 0xaacd80>, 'dict': {0: 0, 1: 1, 2: 2, 3: 3}, '__cached__': None, '__name__': '__main__', 'z': <Yuck(i=0) at remote 0xaace60>, '__doc__': None}, key= + 0x5c2b8d "__lltrace__") at Objects/dictobject.c:2171 + +Notice how the dictionary argument to ‘PyDict_GetItemString’ is +displayed as its ‘repr()’, rather than an opaque ‘PyObject *’ pointer. + +The extension works by supplying a custom printing routine for values of +type ‘PyObject *’. If you need to access lower-level details of an +object, then cast the value to a pointer of the appropriate type. For +example: + + (gdb) p globals + $1 = {'__builtins__': <module at remote 0x7ffff7fb1868>, '__name__': + '__main__', 'ctypes': <module at remote 0x7ffff7f14360>, '__doc__': None, + '__package__': None} + + (gdb) p *(PyDictObject*)globals + $2 = {ob_refcnt = 3, ob_type = 0x3dbdf85820, ma_fill = 5, ma_used = 5, + ma_mask = 7, ma_table = 0x63d0f8, ma_lookup = 0x3dbdc7ea70 + <lookdict_string>, ma_smalltable = {{me_hash = 7065186196740147912, + me_key = '__builtins__', me_value = <module at remote 0x7ffff7fb1868>}, + {me_hash = -368181376027291943, me_key = '__name__', + me_value ='__main__'}, {me_hash = 0, me_key = 0x0, me_value = 0x0}, + {me_hash = 0, me_key = 0x0, me_value = 0x0}, + {me_hash = -9177857982131165996, me_key = 'ctypes', + me_value = <module at remote 0x7ffff7f14360>}, + {me_hash = -8518757509529533123, me_key = '__doc__', me_value = None}, + {me_hash = 0, me_key = 0x0, me_value = 0x0}, { + me_hash = 6614918939584953775, me_key = '__package__', me_value = None}}} + +Note that the pretty-printers do not actually call ‘repr()’. For basic +types, they try to match its result closely. + +An area that can be confusing is that the custom printer for some types +look a lot like GDB’s built-in printer for standard types. For example, +the pretty-printer for a Python ‘int’ (*note PyLongObject: 585.*) 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: 585.*: + + (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: 78f.*: + + (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. + + For example: + + (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. + + For example: + + (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: Enum HOWTO, Next: Functional Programming HOWTO, Prev: Debugging C API extensions and CPython Internals with GDB, Up: Python HOWTOs + +9.6 Enum HOWTO +============== + +An *note Enum: 62c. is a set of symbolic names bound to unique values. +They are similar to global variables, but they offer a more useful *note +repr(): 7f9, grouping, type-safety, and a few other features. + +They are most useful when you have a variable that can take one of a +limited selection of values. For example, the days of the week: + + >>> from enum import Enum + >>> class Weekday(Enum): + ... MONDAY = 1 + ... TUESDAY = 2 + ... WEDNESDAY = 3 + ... THURSDAY = 4 + ... FRIDAY = 5 + ... SATURDAY = 6 + ... SUNDAY = 7 + +Or perhaps the RGB primary colors: + + >>> from enum import Enum + >>> class Color(Enum): + ... RED = 1 + ... GREEN = 2 + ... BLUE = 3 + +As you can see, creating an *note Enum: 62c. is as simple as writing a +class that inherits from *note Enum: 62c. itself. + + Note: Case of Enum Members + + Because Enums are used to represent constants, and to help avoid + issues with name clashes between mixin-class methods/attributes and + enum names, we strongly recommend using UPPER_CASE names for + members, and will be using that style in our examples. + +Depending on the nature of the enum a member’s value may or may not be +important, but either way that value can be used to get the +corresponding member: + + >>> Weekday(3) + <Weekday.WEDNESDAY: 3> + +As you can see, the ‘repr()’ of a member shows the enum name, the member +name, and the value. The ‘str()’ of a member shows only the enum name +and member name: + + >>> print(Weekday.THURSDAY) + Weekday.THURSDAY + +The 'type' of an enumeration member is the enum it belongs to: + + >>> 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: 1cd. has two methods for returning the weekday: *note +weekday(): 2455. and *note isoweekday(): 2456. The difference is that +one of them counts from 0-6 and the other from 1-7. Rather than keep +track of that ourselves we can add a method to the ‘Weekday’ enum to +extract the day from the *note date: 1cd. 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()) + +Now we can find out what today is! Observe: + + >>> from datetime import date + >>> Weekday.from_date(date.today()) + <Weekday.TUESDAY: 2> + +Of course, if you’re reading this on some other day, you’ll see that day +instead. + +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: 60d. – we could use a +different type of *note Enum: 62c.: + + >>> from enum import Flag + >>> class Weekday(Flag): + ... MONDAY = 1 + ... TUESDAY = 2 + ... WEDNESDAY = 4 + ... THURSDAY = 8 + ... FRIDAY = 16 + ... SATURDAY = 32 + ... SUNDAY = 64 + +We’ve changed two things: we’re inherited from *note Flag: 61f, and the +values are all powers of 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> + +But *note Flag: 61f. also allows us to combine several members into a +single variable: + + >>> weekend = Weekday.SATURDAY | Weekday.SUNDAY + >>> weekend + <Weekday.SATURDAY|SUNDAY: 96> + +You can even iterate over a *note Flag: 61f. variable: + + >>> for day in weekend: + ... print(day) + Weekday.SATURDAY + Weekday.SUNDAY + +Okay, let’s get some chores set up: + + >>> chores_for_ethan = { + ... 'feed the cat': Weekday.MONDAY | Weekday.WEDNESDAY | Weekday.FRIDAY, + ... 'do the dishes': Weekday.TUESDAY | Weekday.THURSDAY, + ... 'answer SO questions': Weekday.SATURDAY, + ... } + +And a function to display the chores for a given day: + + >>> 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 + +In cases where the actual values of the members do not matter, you can +save yourself some work and use *note auto(): c9c. for the values: + + >>> 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: + +* Programmatic access to enumeration members and their attributes:: +* Duplicating enum members and values:: +* Ensuring unique enumeration values:: +* Using automatic values:: +* Iteration: Iteration<2>. +* Comparisons: Comparisons<3>. +* Allowed members and attributes of enumerations:: +* Restricted Enum subclassing:: +* Dataclass support:: +* Pickling:: +* Functional API: Functional API<3>. +* Derived Enumerations:: +* When to use __new__() vs. __init__(): When to use __new__ vs __init__. +* How are Enums and Flags different?:: +* Enum Cookbook:: +* Subclassing EnumType:: + + +File: python.info, Node: Programmatic access to enumeration members and their attributes, Next: Duplicating enum members and values, Up: Enum HOWTO + +9.6.1 Programmatic access to enumeration members and their attributes +--------------------------------------------------------------------- + +Sometimes it’s useful to access members in enumerations programmatically +(i.e. situations where ‘Color.RED’ won’t do because the exact color is +not known at program-writing time). ‘Enum’ allows such access: + + >>> Color(1) + <Color.RED: 1> + >>> Color(3) + <Color.BLUE: 3> + +If you want to access enum members by 'name', use item access: + + >>> 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: Duplicating enum members and values, Next: Ensuring unique enumeration values, Prev: Programmatic access to enumeration members and their attributes, Up: Enum HOWTO + +9.6.2 Duplicating enum members and values +----------------------------------------- + +Having two enum members with the same name is invalid: + + >>> class Shape(Enum): + ... SQUARE = 2 + ... SQUARE = 3 + ... + Traceback (most recent call last): + ... + TypeError: 'SQUARE' already defined as 2 + +However, an enum member can have other names associated with it. Given +two entries ‘A’ and ‘B’ with the same value (and ‘A’ defined first), ‘B’ +is an alias for the member ‘A’. By-value lookup of the value of ‘A’ +will return the member ‘A’. By-name lookup of ‘A’ will return the +member ‘A’. By-name lookup of ‘B’ will also return the member ‘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> + + Note: Attempting to create a member with the same name as an + already defined attribute (another member, a method, etc.) or + attempting to create an attribute with the same name as a member is + not allowed. + + +File: python.info, Node: Ensuring unique enumeration values, Next: Using automatic values, Prev: Duplicating enum members and values, Up: Enum HOWTO + +9.6.3 Ensuring unique enumeration values +---------------------------------------- + +By default, enumerations allow multiple names as aliases for the same +value. When this behavior isn’t desired, you can use the *note +unique(): 25bb. decorator: + + >>> 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: Using automatic values, Next: Iteration<2>, Prev: Ensuring unique enumeration values, Up: Enum HOWTO + +9.6.4 Using automatic values +---------------------------- + +If the exact value is unimportant you can use *note auto: c9c.: + + >>> 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_(): 25cf, 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'] + + Note: The *note _generate_next_value_(): 25cf. method must be + defined before any members. + + +File: python.info, Node: Iteration<2>, Next: Comparisons<3>, Prev: Using automatic values, Up: Enum HOWTO + +9.6.5 Iteration +--------------- + +Iterating over the members of an enum does not provide the aliases: + + >>> 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>] + +Note that the aliases ‘Shape.ALIAS_FOR_SQUARE’ and ‘Weekday.WEEKEND’ +aren’t shown. + +The special attribute ‘__members__’ is a read-only ordered mapping of +names to members. It includes all names defined in the enumeration, +including the aliases: + + >>> 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>) + +The ‘__members__’ attribute can be used for detailed programmatic access +to the enumeration members. For example, finding all the aliases: + + >>> [name for name, member in Shape.__members__.items() if member.name != name] + ['ALIAS_FOR_SQUARE'] + + Note: Aliases for flags include values with multiple flags set, + such as ‘3’, and no flags set, i.e. ‘0’. + + +File: python.info, Node: Comparisons<3>, Next: Allowed members and attributes of enumerations, Prev: Iteration<2>, Up: Enum HOWTO + +9.6.6 Comparisons +----------------- + +Enumeration members are compared by identity: + + >>> Color.RED is Color.RED + True + >>> Color.RED is Color.BLUE + False + >>> Color.RED is not Color.BLUE + True + +Ordered comparisons between enumeration values are 'not' supported. +Enum members are not integers (but see *note IntEnum: 4f46. below): + + >>> Color.RED < Color.BLUE + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + TypeError: '<' not supported between instances of 'Color' and 'Color' + +Equality comparisons are defined though: + + >>> Color.BLUE == Color.RED + False + >>> Color.BLUE != Color.RED + True + >>> Color.BLUE == Color.BLUE + True + +Comparisons against non-enumeration values will always compare not equal +(again, *note IntEnum: cdf. was explicitly designed to behave +differently, see below): + + >>> Color.BLUE == 2 + False + + Warning: It is possible to reload modules – if a reloaded module + contains enums, they will be recreated, and the new members may not + compare identical/equal to the original members. + + +File: python.info, Node: Allowed members and attributes of enumerations, Next: Restricted Enum subclassing, Prev: Comparisons<3>, Up: Enum HOWTO + +9.6.7 Allowed members and attributes of enumerations +---------------------------------------------------- + +Most of the examples above use integers for enumeration values. Using +integers is short and handy (and provided by default by the *note +Functional API: 4f48.), but not strictly enforced. In the vast majority +of use-cases, one doesn’t care what the actual value of an enumeration +is. But if the value 'is' important, enumerations can have arbitrary +values. + +Enumerations are Python classes, and can have methods and special +methods as usual. If we have this enumeration: + + >>> 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 + ... + +Then: + + >>> 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__(): 619, *note __add__(): 1f8c, etc.), descriptors (methods are +also descriptors), and variable names listed in *note _ignore_: 25cd. + +Note: if your enumeration defines *note __new__(): 57d. and/or *note +__init__(): 6ac, any value(s) given to the enum member will be passed +into those methods. See *note Planet: 4f49. for an example. + + Note: The *note __new__(): 57d. method, if defined, is used during + creation of the Enum members; it is then replaced by Enum’s *note + __new__(): 57d. which is used after class creation for lookup of + existing members. See *note When to use __new__() vs. __init__(): + 4f4a. for more details. + + +File: python.info, Node: Restricted Enum subclassing, Next: Dataclass support, Prev: Allowed members and attributes of enumerations, Up: Enum HOWTO + +9.6.8 Restricted Enum subclassing +--------------------------------- + +A new *note Enum: 62c. class must have one base enum class, up to one +concrete data type, and as many *note object: a8c.-based mixin classes +as needed. The order of these base classes is: + + class EnumName([mix-in, ...,] [data-type,] base-enum): + pass + +Also, subclassing an enumeration is allowed only if the enumeration does +not define any members. So this is forbidden: + + >>> class MoreColor(Color): + ... PINK = 17 + ... + Traceback (most recent call last): + ... + TypeError: <enum 'MoreColor'> cannot extend <enum 'Color'> + +But this is allowed: + + >>> class Foo(Enum): + ... def some_behavior(self): + ... pass + ... + >>> class Bar(Foo): + ... HAPPY = 1 + ... SAD = 2 + ... + +Allowing subclassing of enums that define members would lead to a +violation of some important invariants of types and instances. On the +other hand, it makes sense to allow sharing some common behavior between +a group of enumerations. (See *note OrderedEnum: 4f4c. for an example.) + + +File: python.info, Node: Dataclass support, Next: Pickling, Prev: Restricted Enum subclassing, Up: Enum HOWTO + +9.6.9 Dataclass support +----------------------- + +When inheriting from a *note dataclass: 1cb, the *note __repr__(): 1784. +omits the inherited class’ name. For example: + + >>> 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> + +Use the *note dataclass(): 1cb. argument ‘repr=False’ to use the +standard *note repr(): 7f9. + +Changed in version 3.12: Only the dataclass fields are shown in the +value area, not the dataclass’ name. + + Note: Adding *note dataclass(): 1cb. decorator to *note Enum: 62c. + and its subclasses is not supported. It will not raise any errors, + but it will produce very strange results at runtime, such as + members being equal to each other: + + >>> @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: Pickling, Next: Functional API<3>, Prev: Dataclass support, Up: Enum HOWTO + +9.6.10 Pickling +--------------- + +Enumerations can be pickled and unpickled: + + >>> from test.test_enum import Fruit + >>> from pickle import dumps, loads + >>> Fruit.TOMATO is loads(dumps(Fruit.TOMATO)) + True + +The usual restrictions for pickling apply: picklable enums must be +defined in the top level of a module, since unpickling requires them to +be importable from that module. + + Note: With pickle protocol version 4 it is possible to easily + pickle enums nested in other classes. + +It is possible to modify how enum members are pickled/unpickled by +defining *note __reduce_ex__(): 15ba. 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 + + Note: Using by-name for flags is not recommended, as unnamed + aliases will not unpickle. + + +File: python.info, Node: Functional API<3>, Next: Derived Enumerations, Prev: Pickling, Up: Enum HOWTO + +9.6.11 Functional API +--------------------- + +The *note Enum: 62c. class is callable, providing the following +functional 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>] + +The semantics of this API resemble *note namedtuple: 1ca. The first +argument of the call to *note Enum: 62c. is the name of the enumeration. + +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: 62c. is +returned. In other words, the above assignment to ‘Animal’ is +equivalent to: + + >>> class Animal(Enum): + ... ANT = 1 + ... BEE = 2 + ... CAT = 3 + ... DOG = 4 + ... + +The reason for defaulting to ‘1’ as the starting number and not ‘0’ is +that ‘0’ is ‘False’ in a boolean sense, but by default enum members all +evaluate to ‘True’. + +Pickling enums created with the functional API can be tricky as frame +stack implementation details are used to try and figure out which module +the enumeration is being created in (e.g. it will fail if you use a +utility function in a separate module, and also may not work on +IronPython or Jython). The solution is to specify the module name +explicitly as follows: + + >>> Animal = Enum('Animal', 'ANT BEE CAT DOG', module=__name__) + + Warning: If ‘module’ is not supplied, and Enum cannot determine + what it is, the new Enum members will not be unpicklable; to keep + errors closer to the source, pickling will be disabled. + +The new pickle protocol 4 also, in some circumstances, relies on *note +__qualname__: 1f26. 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') + +The complete signature is: + + Enum( + value='NewEnumName', + names=<...>, + *, + module='...', + qualname='...', + type=<mixed-in class>, + start=1, + ) + + * 'value': What the new enum class will record as its name. + + * 'names': The enum members. This can be a whitespace- or + comma-separated string (values will start at 1 unless otherwise + specified): + + 'RED GREEN BLUE' | 'RED,GREEN,BLUE' | 'RED, GREEN, BLUE' + + or an iterator of names: + + ['RED', 'GREEN', 'BLUE'] + + or an iterator of (name, value) pairs: + + [('CYAN', 4), ('MAGENTA', 5), ('YELLOW', 6)] + + or a mapping: + + {'CHARTREUSE': 7, 'SEA_GREEN': 11, 'ROSEMARY': 42} + + * 'module': name of module where new enum class can be found. + + * 'qualname': where in module new enum class can be found. + + * 'type': type to mix in to new enum class. + + * 'start': number to start counting at if only names are passed in. + +Changed in version 3.5: The 'start' parameter was added. + + +File: python.info, Node: Derived Enumerations, Next: When to use __new__ vs __init__, Prev: Functional API<3>, Up: Enum HOWTO + +9.6.12 Derived Enumerations +--------------------------- + +* Menu: + +* IntEnum:: +* StrEnum:: +* IntFlag:: +* Flag:: +* Others: Others<2>. + + +File: python.info, Node: IntEnum, Next: StrEnum, Up: Derived Enumerations + +9.6.12.1 IntEnum +................ + +The first variation of *note Enum: 62c. that is provided is also a +subclass of *note int: 259. Members of an *note IntEnum: cdf. can be +compared to integers; by extension, integer enumerations of different +types can also be compared to each other: + + >>> 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 + +However, they still can’t be compared to standard *note Enum: 62c. +enumerations: + + >>> class Shape(IntEnum): + ... CIRCLE = 1 + ... SQUARE = 2 + ... + >>> class Color(Enum): + ... RED = 1 + ... GREEN = 2 + ... + >>> Shape.CIRCLE == Color.RED + False + +*note IntEnum: cdf. values behave like integers in other ways you’d +expect: + + >>> 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: Derived Enumerations + +9.6.12.2 StrEnum +................ + +The second variation of *note Enum: 62c. that is provided is also a +subclass of *note str: 447. Members of a *note StrEnum: 616. can be +compared to strings; by extension, string enumerations of different +types can also be compared to each other. + +Added in version 3.11. + + +File: python.info, Node: IntFlag, Next: Flag, Prev: StrEnum, Up: Derived Enumerations + +9.6.12.3 IntFlag +................ + +The next variation of *note Enum: 62c. provided, *note IntFlag: 22fa, is +also based on *note int: 259. The difference being *note IntFlag: 22fa. +members can be combined using the bitwise operators (&, |, ^, ~) and the +result is still an *note IntFlag: 22fa. member, if possible. Like *note +IntEnum: cdf, *note IntFlag: 22fa. members are also integers and can be +used wherever an *note int: 259. is used. + + Note: Any operation on an *note IntFlag: 22fa. member besides the + bit-wise operations will lose the *note IntFlag: 22fa. membership. + + Bit-wise operations that result in invalid *note IntFlag: 22fa. + values will lose the *note IntFlag: 22fa. membership. See *note + FlagBoundary: 620. for details. + +Added in version 3.6. + +Changed in version 3.11. + +Sample *note IntFlag: 22fa. class: + + >>> 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 + +It is also possible to name the combinations: + + >>> 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> + + Note: Named combinations are considered aliases. Aliases do not + show up during iteration, but can be returned from by-value + lookups. + +Changed in version 3.11. + +Another important difference between *note IntFlag: 22fa. and *note +Enum: 62c. is that if no flags are set (the value is 0), its boolean +evaluation is *note False: b37.: + + >>> Perm.R & Perm.X + <Perm: 0> + >>> bool(Perm.R & Perm.X) + False + +Because *note IntFlag: 22fa. members are also subclasses of *note int: +259. they can be combined with them (but may lose *note IntFlag: 22fa. +membership: + + >>> Perm.X | 4 + <Perm.R|X: 5> + + >>> Perm.X + 8 + 9 + + Note: The negation operator, ‘~’, always returns an *note IntFlag: + 22fa. member with a positive value: + + >>> (~Perm.X).value == (Perm.R|Perm.W).value == 6 + True + +*note IntFlag: 22fa. members can also be iterated over: + + >>> list(RW) + [<Perm.R: 4>, <Perm.W: 2>] + +Added in version 3.11. + + +File: python.info, Node: Flag, Next: Others<2>, Prev: IntFlag, Up: Derived Enumerations + +9.6.12.4 Flag +............. + +The last variation is *note Flag: 61f. Like *note IntFlag: 22fa, *note +Flag: 61f. members can be combined using the bitwise operators (&, |, ^, +~). Unlike *note IntFlag: 22fa, they cannot be combined with, nor +compared against, any other *note Flag: 61f. enumeration, nor *note int: +259. While it is possible to specify the values directly it is +recommended to use *note auto: c9c. as the value and let *note Flag: +61f. select an appropriate value. + +Added in version 3.6. + +Like *note IntFlag: 22fa, if a combination of *note Flag: 61f. members +results in no flags being set, the boolean evaluation is *note False: +b37.: + + >>> 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 + +Individual flags should have values that are powers of two (1, 2, 4, 8, +…), while combinations of flags will not: + + >>> class Color(Flag): + ... RED = auto() + ... BLUE = auto() + ... GREEN = auto() + ... WHITE = RED | BLUE | GREEN + ... + >>> Color.WHITE + <Color.WHITE: 7> + +Giving a name to the “no flags set” condition does not change its +boolean value: + + >>> class Color(Flag): + ... BLACK = 0 + ... RED = auto() + ... BLUE = auto() + ... GREEN = auto() + ... + >>> Color.BLACK + <Color.BLACK: 0> + >>> bool(Color.BLACK) + False + +*note Flag: 61f. members can also be iterated over: + + >>> purple = Color.RED | Color.BLUE + >>> list(purple) + [<Color.RED: 1>, <Color.BLUE: 2>] + +Added in version 3.11. + + Note: For the majority of new code, *note Enum: 62c. and *note + Flag: 61f. are strongly recommended, since *note IntEnum: cdf. and + *note IntFlag: 22fa. break some semantic promises of an enumeration + (by being comparable to integers, and thus by transitivity to other + unrelated enumerations). *note IntEnum: cdf. and *note IntFlag: + 22fa. should be used only in cases where *note Enum: 62c. and *note + Flag: 61f. will not do; for example, when integer constants are + replaced with enumerations, or for interoperability with other + systems. + + +File: python.info, Node: Others<2>, Prev: Flag, Up: Derived Enumerations + +9.6.12.5 Others +............... + +While *note IntEnum: cdf. is part of the *note enum: 56. module, it +would be very simple to implement independently: + + 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: 2f1. instead of *note +int: 259. + +Some rules: + + 1. When subclassing *note Enum: 62c, mix-in types must appear before + the *note Enum: 62c. class itself in the sequence of bases, as in + the *note IntEnum: cdf. example above. + + 2. Mix-in types must be subclassable. For example, *note bool: 463. + and *note range: 943. are not subclassable and will throw an error + during Enum creation if used as the mix-in type. + + 3. While *note Enum: 62c. can have members of any type, once you mix + in an additional type, all the members must have values of that + type, e.g. *note int: 259. above. This restriction does not apply + to mix-ins which only add methods and don’t specify another type. + + 4. When another data type is mixed in, the *note value: 25c8. + 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__(): 57d, or a + *note dataclass: 1cb. + + 6. %-style formatting: ‘%s’ and ‘%r’ call the *note Enum: 62c. class’s + *note __str__(): 619. and *note __repr__(): 618. respectively; + other codes (such as ‘%i’ or ‘%h’ for IntEnum) treat the enum + member as its mixed-in type. + + 7. *note Formatted string literals: 9a9, *note str.format(): 61d, and + *note format(): 61b. will use the enum’s *note __str__(): 619. + method. + + Note: Because *note IntEnum: cdf, *note IntFlag: 22fa, and *note + StrEnum: 616. are designed to be drop-in replacements for existing + constants, their *note __str__(): 619. method has been reset to + their data types’ *note __str__(): 619. method. + + +File: python.info, Node: When to use __new__ vs __init__, Next: How are Enums and Flags different?, Prev: Derived Enumerations, Up: Enum HOWTO + +9.6.13 When to use ‘__new__()’ vs. ‘__init__()’ +----------------------------------------------- + +*note __new__(): 57d. must be used whenever you want to customize the +actual value of the *note Enum: 62c. member. Any other modifications +may go in either *note __new__(): 57d. or *note __init__(): 6ac, with +*note __init__(): 6ac. being preferred. + +For example, if you want to pass several items to the constructor, but +only want one of them to be the value: + + >>> 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 + + Warning: 'Do not' call ‘super().__new__()’, as the lookup-only + ‘__new__’ is the one that is found; instead, use the data type + directly. + +* Menu: + +* Finer Points:: + + +File: python.info, Node: Finer Points, Up: When to use __new__ vs __init__ + +9.6.13.1 Finer Points +..................... + +* Menu: + +* Supported __dunder__ names: Supported __dunder__ names<2>. +* Supported _sunder_ names: Supported _sunder_ names<2>. +* _Private__names:: +* Enum member type:: +* Creating members that are mixed with other data types:: +* Boolean value of Enum classes and members:: +* Enum classes with methods:: +* Combining members of Flag:: +* Flag and IntFlag minutia:: + + +File: python.info, Node: Supported __dunder__ names<2>, Next: Supported _sunder_ names<2>, Up: Finer Points + +9.6.13.2 Supported ‘__dunder__’ names +..................................... + +*note __members__: 25c5. is a read-only ordered mapping of +‘member_name’:‘member’ items. It is only available on the class. + +*note __new__(): 57d, if specified, must create and return the enum +members; it is also a very good idea to set the member’s *note _value_: +25cb. appropriately. Once all the members are created it is no longer +used. + + +File: python.info, Node: Supported _sunder_ names<2>, Next: _Private__names, Prev: Supported __dunder__ names<2>, Up: Finer Points + +9.6.13.3 Supported ‘_sunder_’ names +................................... + + - *note _name_: 25ca. – name of the member + + - *note _value_: 25cb. – value of the member; can be set in ‘__new__’ + + - *note _missing_(): 25d2. – a lookup function used when a value is + not found; may be overridden + + - *note _ignore_: 25cd. – a list of names, either as a *note list: + 60d. or a *note str: 447, that will not be transformed into + members, and will be removed from the final class + + - *note _generate_next_value_(): 25cf. – used to get an appropriate + value for an enum member; may be overridden + + - *note _add_alias_(): 25d3. – adds a new name as an alias to an + existing member. + + - *note _add_value_alias_(): 25d4. – adds a new value as an alias to + an existing member. See *note MultiValueEnum: 4f58. for an + example. + + Note: For standard *note Enum: 62c. classes the next value + chosen is the highest value seen incremented by one. + + For *note Flag: 61f. classes the next value chosen will be the + next highest power-of-two. + + Changed in version 3.13: Prior versions would use the last seen + value instead of the highest value. + +Added in version 3.6: ‘_missing_’, ‘_order_’, ‘_generate_next_value_’ + +Added in version 3.7: ‘_ignore_’ + +Added in version 3.13: ‘_add_alias_’, ‘_add_value_alias_’ + +To help keep Python 2 / Python 3 code in sync an *note _order_: 25cc. +attribute can be provided. It will be checked against the actual order +of the enumeration and raise an error if the two do not match: + + >>> class Color(Enum): + ... _order_ = 'RED GREEN BLUE' + ... RED = 1 + ... BLUE = 3 + ... GREEN = 2 + ... + Traceback (most recent call last): + ... + TypeError: member order does not match _order_: + ['RED', 'BLUE', 'GREEN'] + ['RED', 'GREEN', 'BLUE'] + + Note: In Python 2 code the *note _order_: 25cc. attribute is + necessary as definition order is lost before it can be recorded. + + +File: python.info, Node: _Private__names, Next: Enum member type, Prev: Supported _sunder_ names<2>, Up: Finer Points + +9.6.13.4 _Private__names +........................ + +*note Private names: 1cba. are not converted to enum members, but remain +normal attributes. + +Changed in version 3.11. + + +File: python.info, Node: Enum member type, Next: Creating members that are mixed with other data types, Prev: _Private__names, Up: Finer Points + +9.6.13.5 ‘Enum’ member type +........................... + +Enum members are instances of their enum class, and are normally +accessed as ‘EnumClass.member’. In certain situations, such as writing +custom enum behavior, being able to access one member directly from +another is useful, and is supported; however, in order to avoid name +clashes between member names and attributes/methods from mixed-in +classes, upper-case names are strongly recommended. + +Changed in version 3.5. + + +File: python.info, Node: Creating members that are mixed with other data types, Next: Boolean value of Enum classes and members, Prev: Enum member type, Up: Finer Points + +9.6.13.6 Creating members that are mixed with other data types +.............................................................. + +When subclassing other data types, such as *note int: 259. or *note str: +447, with an *note Enum: 62c, 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: Boolean value of Enum classes and members, Next: Enum classes with methods, Prev: Creating members that are mixed with other data types, Up: Finer Points + +9.6.13.7 Boolean value of ‘Enum’ classes and members +.................................................... + +Enum classes that are mixed with non-*note Enum: 62c. types (such as +*note int: 259, *note str: 447, etc.) are evaluated according to the +mixed-in type’s rules; otherwise, all members evaluate as *note True: +c0d. To make your own enum’s boolean evaluation depend on the member’s +value add the following to your class: + + def __bool__(self): + return bool(self.value) + +Plain *note Enum: 62c. classes always evaluate as *note True: c0d. + + +File: python.info, Node: Enum classes with methods, Next: Combining members of Flag, Prev: Boolean value of Enum classes and members, Up: Finer Points + +9.6.13.8 ‘Enum’ classes with methods +.................................... + +If you give your enum subclass extra methods, like the *note Planet: +4f49. class below, those methods will show up in a *note dir(): 62e. of +the member, but not of the class: + + >>> 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: Combining members of Flag, Next: Flag and IntFlag minutia, Prev: Enum classes with methods, Up: Finer Points + +9.6.13.9 Combining members of ‘Flag’ +.................................... + +Iterating over a combination of *note Flag: 61f. 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: Combining members of Flag, Up: Finer Points + +9.6.13.10 ‘Flag’ and ‘IntFlag’ minutia +...................................... + +Using the following snippet for our examples: + + >>> class Color(IntFlag): + ... BLACK = 0 + ... RED = 1 + ... GREEN = 2 + ... BLUE = 4 + ... PURPLE = RED | BLUE + ... WHITE = RED | GREEN | BLUE + ... + +the following are true: + + - single-bit flags are canonical + + - multi-bit and zero-bit flags are aliases + + - only canonical flags are returned during iteration: + + >>> 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> + + - names of pseudo-flags are constructed from their members’ names: + + >>> (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> + + - membership / containment checking: zero-valued flags are always + considered to be contained: + + >>> Color.BLACK in Color.WHITE + True + + otherwise, only if all bits of one flag are in the other flag will + True be returned: + + >>> 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 –> raises an exception when presented with invalid values + + * CONFORM –> discards any invalid bits + + * EJECT –> lose Flag status and become a normal int with the given + value + + * 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: How are Enums and Flags different?, Next: Enum Cookbook, Prev: When to use __new__ vs __init__, Up: Enum HOWTO + +9.6.14 How are Enums and Flags different? +----------------------------------------- + +Enums have a custom metaclass that affects many aspects of both derived +*note Enum: 62c. classes and their instances (members). + +* Menu: + +* Enum Classes:: +* Flag Classes:: +* Enum Members (aka instances): Enum Members aka instances. +* Flag Members:: + + +File: python.info, Node: Enum Classes, Next: Flag Classes, Up: How are Enums and Flags different? + +9.6.14.1 Enum Classes +..................... + +The *note EnumType: 1e7. metaclass is responsible for providing the +*note __contains__(): 1f5e, *note __dir__(): 1f67, *note __iter__(): +1f5c. and other methods that allow one to do things with an *note Enum: +62c. class that fail on a typical class, such as ‘list(Color)’ or +‘some_enum_var in Color’. *note EnumType: 1e7. is responsible for +ensuring that various other methods on the final *note Enum: 62c. class +are correct (such as *note __new__(): 57d, *note __getnewargs__(): 146e, +*note __str__(): 619. and *note __repr__(): 618.). + + +File: python.info, Node: Flag Classes, Next: Enum Members aka instances, Prev: Enum Classes, Up: How are Enums and Flags different? + +9.6.14.2 Flag Classes +..................... + +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: 62c. 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 Members aka instances, Next: Flag Members, Prev: Flag Classes, Up: How are Enums and Flags different? + +9.6.14.3 Enum Members (aka instances) +..................................... + +The most interesting thing about enum members is that they are +singletons. *note EnumType: 1e7. creates them all while it is creating +the enum class itself, and then puts a custom *note __new__(): 57d. in +place to ensure that no new ones are ever instantiated by returning only +the existing member instances. + + +File: python.info, Node: Flag Members, Prev: Enum Members aka instances, Up: How are Enums and Flags different? + +9.6.14.4 Flag Members +..................... + +Flag members can be iterated over just like the *note Flag: 61f. class, +and only the canonical members will be returned. For example: + + >>> list(Color) + [<Color.RED: 1>, <Color.GREEN: 2>, <Color.BLUE: 4>] + +(Note that ‘BLACK’, ‘PURPLE’, and ‘WHITE’ do not show up.) + +Inverting a flag member returns the corresponding positive value, rather +than a negative value — for example: + + >>> ~Color.RED + <Color.GREEN|BLUE: 6> + +Flag members have a length corresponding to the number of power-of-two +values they contain. For example: + + >>> len(Color.PURPLE) + 2 + + +File: python.info, Node: Enum Cookbook, Next: Subclassing EnumType, Prev: How are Enums and Flags different?, Up: Enum HOWTO + +9.6.15 Enum Cookbook +-------------------- + +While *note Enum: 62c, *note IntEnum: cdf, *note StrEnum: 616, *note +Flag: 61f, and *note IntFlag: 22fa. are expected to cover the majority +of use-cases, they cannot cover them all. Here are recipes for some +different types of enumerations that can be used directly, or as +examples for creating one’s own. + +* Menu: + +* Omitting values:: +* OrderedEnum:: +* DuplicateFreeEnum:: +* MultiValueEnum:: +* Planet:: +* TimePeriod:: + + +File: python.info, Node: Omitting values, Next: OrderedEnum, Up: Enum Cookbook + +9.6.15.1 Omitting values +........................ + +In many use-cases, one doesn’t care what the actual value of an +enumeration is. There are several ways to define this type of simple +enumeration: + + - use instances of *note auto: c9c. for the value + + - use instances of *note object: a8c. as the value + + - use a descriptive string as the value + + - use a tuple as the value and a custom *note __new__(): 57d. to + replace the tuple with an *note int: 259. value + +Using any of these methods signifies to the user that these values are +not important, and also enables one to add, remove, or reorder members +without having to renumber the remaining members. + +* Menu: + +* Using auto:: +* Using object:: +* Using a descriptive string:: +* Using a custom __new__(): Using a custom __new__. + + +File: python.info, Node: Using auto, Next: Using object, Up: Omitting values + +9.6.15.2 Using ‘auto’ +..................... + +Using *note auto: c9c. would look like: + + >>> class Color(Enum): + ... RED = auto() + ... BLUE = auto() + ... GREEN = auto() + ... + >>> Color.GREEN + <Color.GREEN: 3> + + +File: python.info, Node: Using object, Next: Using a descriptive string, Prev: Using auto, Up: Omitting values + +9.6.15.3 Using ‘object’ +....................... + +Using *note object: a8c. would look like: + + >>> 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__(): 618.: + + >>> 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: Using a descriptive string, Next: Using a custom __new__, Prev: Using object, Up: Omitting values + +9.6.15.4 Using a descriptive string +................................... + +Using a string as the value would look like: + + >>> class Color(Enum): + ... RED = 'stop' + ... GREEN = 'go' + ... BLUE = 'too fast!' + ... + >>> Color.GREEN + <Color.GREEN: 'go'> + + +File: python.info, Node: Using a custom __new__, Prev: Using a descriptive string, Up: Omitting values + +9.6.15.5 Using a custom ‘__new__()’ +................................... + +Using an auto-numbering *note __new__(): 57d. 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> + +To make a more general purpose ‘AutoNumber’, add ‘*args’ to the +signature: + + >>> 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 + ... + +Then when you inherit from ‘AutoNumber’ you can write your own +‘__init__’ to handle any extra arguments: + + >>> 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' + + Note: The *note __new__(): 57d. method, if defined, is used during + creation of the Enum members; it is then replaced by Enum’s *note + __new__(): 57d. which is used after class creation for lookup of + existing members. + + Warning: '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: Omitting values, Up: Enum Cookbook + +9.6.15.6 OrderedEnum +.................... + +An ordered enumeration that is not based on *note IntEnum: cdf. and so +maintains the normal *note Enum: 62c. invariants (such as not being +comparable to other enumerations): + + >>> 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 Cookbook + +9.6.15.7 DuplicateFreeEnum +.......................... + +Raises an error if a duplicate member value is found instead of creating +an alias: + + >>> 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' + + Note: This is a useful example for subclassing Enum to add or + change other behaviors as well as disallowing aliases. If the only + desired change is disallowing aliases, the *note unique(): 25bb. + decorator can be used instead. + + +File: python.info, Node: MultiValueEnum, Next: Planet, Prev: DuplicateFreeEnum, Up: Enum Cookbook + +9.6.15.8 MultiValueEnum +....................... + +Supports having more than one value per member: + + >>> class MultiValueEnum(Enum): + ... def __new__(cls, value, *values): + ... self = object.__new__(cls) + ... self._value_ = value + ... for v in values: + ... self._add_value_alias_(v) + ... return self + ... + >>> class DType(MultiValueEnum): + ... float32 = 'f', 8 + ... double64 = 'd', 9 + ... + >>> DType('f') + <DType.float32: 'f'> + >>> DType(9) + <DType.double64: 'd'> + + +File: python.info, Node: Planet, Next: TimePeriod, Prev: MultiValueEnum, Up: Enum Cookbook + +9.6.15.9 Planet +............... + +If *note __new__(): 57d. or *note __init__(): 6ac. 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 Cookbook + +9.6.15.10 TimePeriod +.................... + +An example to show the *note _ignore_: 25cd. attribute in use: + + >>> from datetime import timedelta + >>> class Period(timedelta, Enum): + ... "different lengths of time" + ... _ignore_ = 'Period i' + ... Period = vars() + ... for i in range(367): + ... Period['day_%d' % i] = i + ... + >>> list(Period)[:2] + [<Period.day_0: datetime.timedelta(0)>, <Period.day_1: datetime.timedelta(days=1)>] + >>> list(Period)[-2:] + [<Period.day_365: datetime.timedelta(days=365)>, <Period.day_366: datetime.timedelta(days=366)>] + + +File: python.info, Node: Subclassing EnumType, Prev: Enum Cookbook, Up: Enum HOWTO + +9.6.16 Subclassing EnumType +--------------------------- + +While most enum needs can be met by customizing *note Enum: 62c. +subclasses, either with class decorators or custom functions, *note +EnumType: 1e7. can be subclassed to provide a different Enum experience. + + +File: python.info, Node: Functional Programming HOWTO, Next: Logging HOWTO, Prev: Enum HOWTO, Up: Python HOWTOs + +9.7 Functional Programming HOWTO +================================ + + +Author: A. M. Kuchling + + +Release: 0.32 + +In this document, we’ll take a tour of Python’s features suitable for +implementing programs in a functional style. After an introduction to +the concepts of functional programming, we’ll look at language features +such as *note iterator: 1ac.s and *note generator: 105a.s and relevant +library modules such as *note itertools: 81. and *note functools: 5f. + +* Menu: + +* Introduction: Introduction<14>. +* Iterators: Iterators<2>. +* Generator expressions and list comprehensions:: +* Generators: Generators<2>. +* Built-in functions: Built-in functions<2>. +* The itertools module:: +* The functools module:: +* Small functions and the lambda expression:: +* Revision History and Acknowledgements:: +* References: References<2>. + + +File: python.info, Node: Introduction<14>, Next: Iterators<2>, Up: Functional Programming HOWTO + +9.7.1 Introduction +------------------ + +This section explains the basic concept of functional programming; if +you’re just interested in learning about Python language features, skip +to the next section on *note Iterators: 4f72. + +Programming languages support decomposing problems in several different +ways: + + * Most programming languages are 'procedural': programs are lists of + instructions that tell the computer what to do with the program’s + input. C, Pascal, and even Unix shells are procedural languages. + + * In 'declarative' languages, you write a specification that + describes the problem to be solved, and the language implementation + figures out how to perform the computation efficiently. SQL is the + declarative language you’re most likely to be familiar with; a SQL + query describes the data set you want to retrieve, and the SQL + engine decides whether to scan tables or use indexes, which + subclauses should be performed first, etc. + + * 'Object-oriented' programs manipulate collections of objects. + Objects have internal state and support methods that query or + modify this internal state in some way. Smalltalk and Java are + object-oriented languages. C++ and Python are languages that + support object-oriented programming, but don’t force the use of + object-oriented features. + + * 'Functional' programming decomposes a problem into a set of + functions. Ideally, functions only take inputs and produce + outputs, and don’t have any internal state that affects the output + produced for a given input. Well-known functional languages + include the ML family (Standard ML, OCaml, and other variants) and + Haskell. + +The designers of some computer languages choose to emphasize one +particular approach to programming. This often makes it difficult to +write programs that use a different approach. Other languages are +multi-paradigm languages that support several different approaches. +Lisp, C++, and Python are multi-paradigm; you can write programs or +libraries that are largely procedural, object-oriented, or functional in +all of these languages. In a large program, different sections might be +written using different approaches; the GUI might be object-oriented +while the processing logic is procedural or functional, for example. + +In a functional program, input flows through a set of functions. Each +function operates on its input and produces some output. Functional +style discourages functions with side effects that modify internal state +or make other changes that aren’t visible in the function’s return +value. Functions that have no side effects at all are called 'purely +functional'. Avoiding side effects means not using data structures that +get updated as a program runs; every function’s output must only depend +on its input. + +Some languages are very strict about purity and don’t even have +assignment statements such as ‘a=3’ or ‘c = a + b’, but it’s difficult +to avoid all side effects, such as printing to the screen or writing to +a disk file. Another example is a call to the *note print(): f70. or +*note time.sleep(): 699. function, neither of which returns a useful +value. Both are called only for their side effects of sending some text +to the screen or pausing execution for a second. + +Python programs written in functional style usually won’t go to the +extreme of avoiding all I/O or all assignments; instead, they’ll provide +a functional-appearing interface but will use non-functional features +internally. For example, the implementation of a function will still +use assignments to local variables, but won’t modify global variables or +have other side effects. + +Functional programming can be considered the opposite of object-oriented +programming. Objects are little capsules containing some internal state +along with a collection of method calls that let you modify this state, +and programs consist of making the right set of state changes. +Functional programming wants to avoid state changes as much as possible +and works with data flowing between functions. In Python you might +combine the two approaches by writing functions that take and return +instances representing objects in your application (e-mail messages, +transactions, etc.). + +Functional design may seem like an odd constraint to work under. Why +should you avoid objects and side effects? There are theoretical and +practical advantages to the functional style: + + * Formal provability. + + * Modularity. + + * Composability. + + * Ease of debugging and testing. + +* Menu: + +* Formal provability:: +* Modularity:: +* Ease of debugging and testing:: +* Composability:: + + +File: python.info, Node: Formal provability, Next: Modularity, Up: Introduction<14> + +9.7.1.1 Formal provability +.......................... + +A theoretical benefit is that it’s easier to construct a mathematical +proof that a functional program is correct. + +For a long time researchers have been interested in finding ways to +mathematically prove programs correct. This is different from testing a +program on numerous inputs and concluding that its output is usually +correct, or reading a program’s source code and concluding that the code +looks right; the goal is instead a rigorous proof that a program +produces the right result for all possible inputs. + +The technique used to prove programs correct is to write down +'invariants', properties of the input data and of the program’s +variables that are always true. For each line of code, you then show +that if invariants X and Y are true 'before' the line is executed, the +slightly different invariants X’ and Y’ are true 'after' the line is +executed. This continues until you reach the end of the program, at +which point the invariants should match the desired conditions on the +program’s output. + +Functional programming’s avoidance of assignments arose because +assignments are difficult to handle with this technique; assignments can +break invariants that were true before the assignment without producing +any new invariants that can be propagated onward. + +Unfortunately, proving programs correct is largely impractical and not +relevant to Python software. Even trivial programs require proofs that +are several pages long; the proof of correctness for a moderately +complicated program would be enormous, and few or none of the programs +you use daily (the Python interpreter, your XML parser, your web +browser) could be proven correct. Even if you wrote down or generated a +proof, there would then be the question of verifying the proof; maybe +there’s an error in it, and you wrongly believe you’ve proved the +program correct. + + +File: python.info, Node: Modularity, Next: Ease of debugging and testing, Prev: Formal provability, Up: Introduction<14> + +9.7.1.2 Modularity +.................. + +A more practical benefit of functional programming is that it forces you +to break apart your problem into small pieces. Programs are more +modular as a result. It’s easier to specify and write a small function +that does one thing than a large function that performs a complicated +transformation. Small functions are also easier to read and to check +for errors. + + +File: python.info, Node: Ease of debugging and testing, Next: Composability, Prev: Modularity, Up: Introduction<14> + +9.7.1.3 Ease of debugging and testing +..................................... + +Testing and debugging a functional-style program is easier. + +Debugging is simplified because functions are generally small and +clearly specified. When a program doesn’t work, each function is an +interface point where you can check that the data are correct. You can +look at the intermediate inputs and outputs to quickly isolate the +function that’s responsible for a bug. + +Testing is easier because each function is a potential subject for a +unit test. Functions don’t depend on system state that needs to be +replicated before running a test; instead you only have to synthesize +the right input and then check that the output matches expectations. + + +File: python.info, Node: Composability, Prev: Ease of debugging and testing, Up: Introduction<14> + +9.7.1.4 Composability +..................... + +As you work on a functional-style program, you’ll write a number of +functions with varying inputs and outputs. Some of these functions will +be unavoidably specialized to a particular application, but others will +be useful in a wide variety of programs. For example, a function that +takes a directory path and returns all the XML files in the directory, +or a function that takes a filename and returns its contents, can be +applied to many different situations. + +Over time you’ll form a personal library of utilities. Often you’ll +assemble new programs by arranging existing functions in a new +configuration and writing a few functions specialized for the current +task. + + +File: python.info, Node: Iterators<2>, Next: Generator expressions and list comprehensions, Prev: Introduction<14>, Up: Functional Programming HOWTO + +9.7.2 Iterators +--------------- + +I’ll start by looking at a Python language feature that’s an important +foundation for writing functional-style programs: iterators. + +An iterator is an object representing a stream of data; this object +returns the data one element at a time. A Python iterator must support +a method called *note __next__(): 12c0. that takes no arguments and +always returns the next element of the stream. If there are no more +elements in the stream, *note __next__(): 12c0. must raise the *note +StopIteration: bfa. exception. Iterators don’t have to be finite, +though; it’s perfectly reasonable to write an iterator that produces an +infinite stream of data. + +The built-in *note iter(): 7d2. function takes an arbitrary object and +tries to return an iterator that will return the object’s contents or +elements, raising *note TypeError: 534. if the object doesn’t support +iteration. Several of Python’s built-in data types support iteration, +the most common being lists and dictionaries. An object is called *note +iterable: 121a. if you can get an iterator for it. + +You can experiment with the iteration interface manually: + + >>> 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 expects iterable objects in several different contexts, the most +important being the *note for: 2ec. statement. In the statement ‘for X +in Y’, Y must be an iterator or some object for which *note iter(): 7d2. +can create an iterator. These two statements are equivalent: + + for i in iter(obj): + print(i) + + for i in obj: + print(i) + +Iterators can be materialized as lists or tuples by using the *note +list(): 60d. or *note tuple(): 36b. constructor functions: + + >>> L = [1, 2, 3] + >>> iterator = iter(L) + >>> t = tuple(iterator) + >>> t + (1, 2, 3) + +Sequence unpacking also supports iterators: if you know an iterator will +return N elements, you can unpack them into an N-tuple: + + >>> L = [1, 2, 3] + >>> iterator = iter(L) + >>> a, b, c = iterator + >>> a, b, c + (1, 2, 3) + +Built-in functions such as *note max(): f04. and *note min(): f03. can +take a single iterator argument and will return the largest or smallest +element. The ‘"in"’ and ‘"not in"’ operators also support iterators: ‘X +in iterator’ is true if X is found in the stream returned by the +iterator. You’ll run into obvious problems if the iterator is infinite; +*note max(): f04, *note min(): f03. will never return, and if the +element X never appears in the stream, the ‘"in"’ and ‘"not in"’ +operators won’t return either. + +Note that you can only go forward in an iterator; there’s no way to get +the previous element, reset the iterator, or make a copy of it. +Iterator objects can optionally provide these additional capabilities, +but the iterator protocol only specifies the *note __next__(): 12c0. +method. Functions may therefore consume all of the iterator’s output, +and if you need to do something different with the same stream, you’ll +have to create a new iterator. + +* Menu: + +* Data Types That Support Iterators:: + + +File: python.info, Node: Data Types That Support Iterators, Up: Iterators<2> + +9.7.2.1 Data Types That Support Iterators +......................................... + +We’ve already seen how lists and tuples support iterators. In fact, any +Python sequence type, such as strings, will automatically support +creation of an iterator. + +Calling *note iter(): 7d2. on a dictionary returns an iterator that will +loop over the dictionary’s keys: + + >>> 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 + +Note that starting with Python 3.7, dictionary iteration order is +guaranteed to be the same as the insertion order. In earlier versions, +the behaviour was unspecified and could vary between implementations. + +Applying *note iter(): 7d2. to a dictionary always loops over the keys, +but dictionaries have methods that return other iterators. If you want +to iterate over values or key/value pairs, you can explicitly call the +*note values(): 7c9. or *note items(): 7ca. methods to get an +appropriate iterator. + +The *note dict(): 258. constructor can accept an iterator that returns a +finite stream of ‘(key, value)’ tuples: + + >>> L = [('Italy', 'Rome'), ('France', 'Paris'), ('US', 'Washington DC')] + >>> dict(iter(L)) + {'Italy': 'Rome', 'France': 'Paris', 'US': 'Washington DC'} + +Files also support iteration by calling the *note readline(): 1cbd. +method until there are no more lines in the file. This means you can +read each line of a file like this: + + for line in file: + # do something for each line + ... + +Sets can take their contents from an iterable and let you iterate over +the set’s elements: + + >>> S = {2, 3, 5, 7, 11, 13} + >>> for i in S: + ... print(i) + 2 + 3 + 5 + 7 + 11 + 13 + + +File: python.info, Node: Generator expressions and list comprehensions, Next: Generators<2>, Prev: Iterators<2>, Up: Functional Programming HOWTO + +9.7.3 Generator expressions and list comprehensions +--------------------------------------------------- + +Two common operations on an iterator’s output are 1) performing some +operation for every element, 2) selecting a subset of elements that meet +some condition. For example, given a list of strings, you might want to +strip off trailing whitespace from each line or extract all the strings +containing a given substring. + +List comprehensions and generator expressions (short form: “listcomps” +and “genexps”) are a concise notation for such operations, borrowed from +the functional programming language Haskell +(‘https://www.haskell.org/’). You can strip all the whitespace from a +stream of strings with the following code: + + >>> 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] + +You can select only certain elements by adding an ‘"if"’ condition: + + >>> stripped_list = [line.strip() for line in line_list + ... if line != ""] + +With a list comprehension, you get back a Python list; ‘stripped_list’ +is a list containing the resulting lines, not an iterator. Generator +expressions return an iterator that computes the values as necessary, +not needing to materialize all the values at once. This means that list +comprehensions aren’t useful if you’re working with iterators that +return an infinite stream or a very large amount of data. Generator +expressions are preferable in these situations. + +Generator expressions are surrounded by parentheses (“()”) and list +comprehensions are surrounded by square brackets (“[]”). Generator +expressions have the form: + + ( 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 ) + +Again, for a list comprehension only the outside brackets are different +(square brackets instead of parentheses). + +The elements of the generated output will be the successive values of +‘expression’. The ‘if’ clauses are all optional; if present, +‘expression’ is only evaluated and added to the result when ‘condition’ +is true. + +Generator expressions always have to be written inside parentheses, but +the parentheses signalling a function call also count. If you want to +create an iterator that will be immediately passed to a function you can +write: + + obj_total = sum(obj.count for obj in list_all_objects()) + +The ‘for...in’ clauses contain the sequences to be iterated over. The +sequences do not have to be the same length, because they are iterated +over from left to right, 'not' in parallel. For each element in +‘sequence1’, ‘sequence2’ is looped over from the beginning. ‘sequence3’ +is then looped over for each resulting pair of elements from ‘sequence1’ +and ‘sequence2’. + +To put it another way, a list comprehension or generator expression is +equivalent to the following Python code: + + 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. + +This means that when there are multiple ‘for...in’ clauses but no ‘if’ +clauses, the length of the resulting output will be equal to the product +of the lengths of all the sequences. If you have two lists of length 3, +the output list is 9 elements long: + + >>> 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)] + +To avoid introducing an ambiguity into Python’s grammar, if ‘expression’ +is creating a tuple, it must be surrounded with parentheses. The first +list comprehension below is a syntax error, while the second one is +correct: + + # 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: Generators<2>, Next: Built-in functions<2>, Prev: Generator expressions and list comprehensions, Up: Functional Programming HOWTO + +9.7.4 Generators +---------------- + +Generators are a special class of functions that simplify the task of +writing iterators. Regular functions compute a value and return it, but +generators return an iterator that returns a stream of values. + +You’re doubtless familiar with how regular function calls work in Python +or C. When you call a function, it gets a private namespace where its +local variables are created. When the function reaches a ‘return’ +statement, the local variables are destroyed and the value is returned +to the caller. A later call to the same function creates a new private +namespace and a fresh set of local variables. But, what if the local +variables weren’t thrown away on exiting a function? What if you could +later resume the function where it left off? This is what generators +provide; they can be thought of as resumable functions. + +Here’s the simplest example of a generator function: + + >>> def generate_ints(N): + ... for i in range(N): + ... yield i + +Any function containing a *note yield: 9cd. keyword is a generator +function; this is detected by Python’s *note bytecode: 187. compiler +which compiles the function specially as a result. + +When you call a generator function, it doesn’t return a single value; +instead it returns a generator object that supports the iterator +protocol. On executing the ‘yield’ expression, the generator outputs +the value of ‘i’, similar to a ‘return’ statement. The big difference +between ‘yield’ and a ‘return’ statement is that on reaching a ‘yield’ +the generator’s state of execution is suspended and local variables are +preserved. On the next call to the generator’s *note __next__(): 1cc5. +method, the function will resume executing. + +Here’s a sample usage of the ‘generate_ints()’ generator: + + >>> 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 + +You could equally write ‘for i in generate_ints(5)’, or ‘a, b, c = +generate_ints(3)’. + +Inside a generator function, ‘return value’ causes +‘StopIteration(value)’ to be raised from the *note __next__(): 1cc5. +method. Once this happens, or the bottom of the function is reached, +the procession of values ends and the generator cannot yield any further +values. + +You could achieve the effect of generators manually by writing your own +class and storing all the local variables of the generator as instance +variables. For example, returning a list of integers could be done by +setting ‘self.count’ to 0, and having the *note __next__(): 12c0. method +increment ‘self.count’ and return it. However, for a moderately +complicated generator, writing a corresponding class can be much +messier. + +The test suite included with Python’s library, +Lib/test/test_generators.py(1), contains a number of more interesting +examples. Here’s one generator that implements an in-order traversal of +a tree using generators recursively. + + # 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 + +Two other examples in ‘test_generators.py’ produce solutions for the +N-Queens problem (placing N queens on an NxN chess board so that no +queen threatens another) and the Knight’s Tour (finding a route that +takes a knight to every square of an NxN chessboard without visiting any +square twice). + +* Menu: + +* Passing values into a generator:: + + ---------- Footnotes ---------- + + (1) +https://github.com/python/cpython/tree/3.13/Lib/test/test_generators.py + + +File: python.info, Node: Passing values into a generator, Up: Generators<2> + +9.7.4.1 Passing values into a generator +....................................... + +In Python 2.4 and earlier, generators only produced output. Once a +generator’s code was invoked to create an iterator, there was no way to +pass any new information into the function when its execution is +resumed. You could hack together this ability by making the generator +look at a global variable or by passing in some mutable object that +callers then modify, but these approaches are messy. + +In Python 2.5 there’s a simple way to pass values into a generator. +*note yield: 9cd. became an expression, returning a value that can be +assigned to a variable or otherwise operated on: + + val = (yield i) + +I recommend that you 'always' put parentheses around a ‘yield’ +expression when you’re doing something with the returned value, as in +the above example. The parentheses aren’t always necessary, but it’s +easier to always add them instead of having to remember when they’re +needed. + +( PEP 342(1) explains the exact rules, which are that a +‘yield’-expression must always be parenthesized except when it occurs at +the top-level expression on the right-hand side of an assignment. This +means you can write ‘val = yield i’ but have to use parentheses when +there’s an operation, as in ‘val = (yield i) + 12’.) + +Values are sent into a generator by calling its *note send(value): 1fcc. +method. This method resumes the generator’s code and the ‘yield’ +expression returns the specified value. If the regular *note +__next__(): 1cc5. method is called, the ‘yield’ returns ‘None’. + +Here’s a simple counter that increments by 1 and allows changing the +value of the internal counter. + + 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 + +And here’s an example of changing the counter: + + >>> 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 + +Because ‘yield’ will often be returning ‘None’, you should always check +for this case. Don’t just use its value in expressions unless you’re +sure that the *note send(): 1fcc. method will be the only method used to +resume your generator function. + +In addition to *note send(): 1fcc, there are two other methods on +generators: + + * *note throw(value): 4f4. is used to raise an exception inside the + generator; the exception is raised by the ‘yield’ expression where + the generator’s execution is paused. + + * *note close(): 16f4. sends a *note GeneratorExit: 1393. exception + to the generator to terminate the iteration. On receiving this + exception, the generator’s code must either raise *note + GeneratorExit: 1393. or *note StopIteration: bfa.; catching the + exception and doing anything else is illegal and will trigger a + *note RuntimeError: 195. *note close(): 16f4. will also be called + by Python’s garbage collector when the generator is + garbage-collected. + + If you need to run cleanup code when a *note GeneratorExit: 1393. + occurs, I suggest using a ‘try: ... finally:’ suite instead of + catching *note GeneratorExit: 1393. + +The cumulative effect of these changes is to turn generators from +one-way producers of information into both producers and consumers. + +Generators also become 'coroutines', a more generalized form of +subroutines. Subroutines are entered at one point and exited at another +point (the top of the function, and a ‘return’ statement), but +coroutines can be entered, exited, and resumed at many different points +(the ‘yield’ statements). + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0342/ + + +File: python.info, Node: Built-in functions<2>, Next: The itertools module, Prev: Generators<2>, Up: Functional Programming HOWTO + +9.7.5 Built-in functions +------------------------ + +Let’s look in more detail at built-in functions often used with +iterators. + +Two of Python’s built-in functions, *note map(): 860. and *note +filter(): 861. duplicate the features of generator expressions: + +*note map(f, iterA, iterB, ...): 860. returns an iterator over the sequence + + ‘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'] + +You can of course achieve the same effect with a list comprehension. + +*note filter(predicate, iter): 861. returns an iterator over all the +sequence elements that meet a certain condition, and is similarly +duplicated by list comprehensions. A 'predicate' is a function that +returns the truth value of some condition; for use with *note filter(): +861, the predicate must take a single value. + + >>> def is_even(x): + ... return (x % 2) == 0 + + >>> list(filter(is_even, range(10))) + [0, 2, 4, 6, 8] + +This can also be written as a list comprehension: + + >>> list(x for x in range(10) if is_even(x)) + [0, 2, 4, 6, 8] + +*note enumerate(iter, start=0): 1448. counts off the elements in the +iterable returning 2-tuples containing the count (from 'start') and each +element. + + >>> for item in enumerate(['subject', 'verb', 'object']): + ... print(item) + (0, 'subject') + (1, 'verb') + (2, 'object') + +*note enumerate(): 1448. is often used when looping through a list and +recording the indexes at which certain conditions are met: + + 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): bce. collects all the +elements of the iterable into a list, sorts the list, and returns the +sorted result. The 'key' and 'reverse' arguments are passed through to +the constructed list’s *note sort(): bcf. method. + + >>> 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] + +(For a more detailed discussion of sorting, see the *note Sorting +Techniques: 217e.) + +The *note any(iter): 13ec. and *note all(iter): 13ed. built-ins look at +the truth values of an iterable’s contents. *note any(): 13ec. returns +‘True’ if any element in the iterable is a true value, and *note all(): +13ed. returns ‘True’ if all of the elements are true values: + + >>> 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, ...): 7cb. takes one element from each iterable +and returns them in a tuple: + + zip(['a', 'b', 'c'], (1, 2, 3)) => + ('a', 1), ('b', 2), ('c', 3) + +It doesn’t construct an in-memory list and exhaust all the input +iterators before returning; instead tuples are constructed and returned +only if they’re requested. (The technical term for this behaviour is +lazy evaluation(1).) + +This iterator is intended to be used with iterables that are all of the +same length. If the iterables are of different lengths, the resulting +stream will be the same length as the shortest iterable. + + zip(['a', 'b'], (1, 2, 3)) => + ('a', 1), ('b', 2) + +You should avoid doing this, though, because an element may be taken +from the longer iterators and discarded. This means you can’t go on to +use the iterators further because you risk skipping a discarded element. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Lazy_evaluation + + +File: python.info, Node: The itertools module, Next: The functools module, Prev: Built-in functions<2>, Up: Functional Programming HOWTO + +9.7.6 The itertools module +-------------------------- + +The *note itertools: 81. module contains a number of commonly used +iterators as well as functions for combining several iterators. This +section will introduce the module’s contents by showing small examples. + +The module’s functions fall into a few broad classes: + + * Functions that create a new iterator based on an existing iterator. + + * Functions for treating an iterator’s elements as function + arguments. + + * Functions for selecting portions of an iterator’s output. + + * A function for grouping an iterator’s output. + +* Menu: + +* Creating new iterators:: +* Calling functions on elements:: +* Selecting elements:: +* Combinatoric functions:: +* Grouping elements:: + + +File: python.info, Node: Creating new iterators, Next: Calling functions on elements, Up: The itertools module + +9.7.6.1 Creating new iterators +.............................. + +*note itertools.count(start, step): 1276. returns an infinite stream of +evenly spaced values. You can optionally supply the starting number, +which defaults to 0, and the interval between numbers, which defaults to +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): 2731. saves a copy of the contents of a +provided iterable and returns a new iterator that returns its elements +from first to last. The new iterator will repeat these elements +infinitely. + + itertools.cycle([1, 2, 3, 4, 5]) => + 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, ... + +*note itertools.repeat(elem, [n]): 2732. returns the provided element +'n' times, or returns the element endlessly if 'n' is not provided. + + 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, ...): 217f. takes an arbitrary +number of iterables as input, and returns all the elements of the first +iterator, then all the elements of the second, and so on, until all of +the iterables have been exhausted. + + itertools.chain(['a', 'b', 'c'], (1, 2, 3)) => + a, b, c, 1, 2, 3 + +*note itertools.islice(iter, [start], stop, [step]): b4c. returns a +stream that’s a slice of the iterator. With a single 'stop' argument, +it will return the first 'stop' elements. If you supply a starting +index, you’ll get 'stop-start' elements, and if you supply a value for +'step', elements will be skipped accordingly. Unlike Python’s string +and list slicing, you can’t use negative values for 'start', 'stop', or +'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]): 2737. replicates an iterator; it returns +'n' independent iterators that will all return the contents of the +source iterator. If you don’t supply a value for 'n', the default is 2. +Replicating iterators requires saving some of the contents of the source +iterator, so this can consume significant memory if the iterator is +large and one of the new iterators is consumed more than the others. + + 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: Calling functions on elements, Next: Selecting elements, Prev: Creating new iterators, Up: The itertools module + +9.7.6.2 Calling functions on elements +..................................... + +The *note operator: 9f. module contains a set of functions corresponding +to Python’s operators. Some examples are *note operator.add(a, b): +275d. (adds two values), *note operator.ne(a, b): 274d. (same as ‘a != +b’), and *note operator.attrgetter('id'): e32. (returns a callable that +fetches the ‘.id’ attribute). + +*note itertools.starmap(func, iter): 10d9. assumes that the iterable +will return a stream of tuples, and calls 'func' using these tuples as +the arguments: + + 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: Selecting elements, Next: Combinatoric functions, Prev: Calling functions on elements, Up: The itertools module + +9.7.6.3 Selecting elements +.......................... + +Another group of functions chooses a subset of an iterator’s elements +based on a predicate. + +*note itertools.filterfalse(predicate, iter): 216b. is the opposite of +*note filter(): 861, returning all elements for which the predicate +returns false: + + itertools.filterfalse(is_even, itertools.count()) => + 1, 3, 5, 7, 9, 11, 13, 15, ... + +*note itertools.takewhile(predicate, iter): 2736. returns elements for +as long as the predicate returns true. Once the predicate returns +false, the iterator will signal the end of its results. + + 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): 2734. discards elements +while the predicate returns true, and then returns the rest of the +iterable’s results. + + 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): 1275. takes two iterators and +returns only those elements of 'data' for which the corresponding +element of 'selectors' is true, stopping whenever either one is +exhausted: + + itertools.compress([1, 2, 3, 4, 5], [True, True, False, False, True]) => + 1, 2, 5 + + +File: python.info, Node: Combinatoric functions, Next: Grouping elements, Prev: Selecting elements, Up: The itertools module + +9.7.6.4 Combinatoric functions +.............................. + +The *note itertools.combinations(iterable, r): 1305. returns an iterator +giving all possible 'r'-tuple combinations of the elements contained in +'iterable'. + + 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) + +The elements within each tuple remain in the same order as 'iterable' +returned them. For example, the number 1 is always before 2, 3, 4, or 5 +in the examples above. A similar function, *note +itertools.permutations(iterable, r=None): 191a, removes this constraint +on the order, returning all possible arrangements of length '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) + +If you don’t supply a value for 'r' the length of the iterable is used, +meaning that all the elements are permuted. + +Note that these functions produce all of the possible combinations by +position and don’t require that the contents of 'iterable' are unique: + + itertools.permutations('aba', 3) => + ('a', 'b', 'a'), ('a', 'a', 'b'), ('b', 'a', 'a'), + ('b', 'a', 'a'), ('a', 'a', 'b'), ('a', 'b', 'a') + +The identical tuple ‘('a', 'a', 'b')’ occurs twice, but the two ‘a’ +strings came from different positions. + +The *note itertools.combinations_with_replacement(iterable, r): 1274. +function relaxes a different constraint: elements can be repeated within +a single tuple. Conceptually an element is selected for the first +position of each tuple and then is replaced before the second element is +selected. + + 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: Grouping elements, Prev: Combinatoric functions, Up: The itertools module + +9.7.6.5 Grouping elements +......................... + +The last function I’ll discuss, *note itertools.groupby(iter, +key_func=None): 2735, is the most complicated. ‘key_func(elem)’ is a +function that can compute a key value for each element returned by the +iterable. If you don’t supply a key function, the key is simply each +element itself. + +*note groupby(): 2735. collects all the consecutive elements from the +underlying iterable that have the same key value, and returns a stream +of 2-tuples containing a key value and an iterator for the elements with +that key. + + 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(): 2735. assumes that the underlying iterable’s contents +will already be sorted based on the key. Note that the returned +iterators also use the underlying iterable, so you have to consume the +results of iterator-1 before requesting iterator-2 and its corresponding +key. + + +File: python.info, Node: The functools module, Next: Small functions and the lambda expression, Prev: The itertools module, Up: Functional Programming HOWTO + +9.7.7 The functools module +-------------------------- + +The *note functools: 5f. module contains some higher-order functions. A +'higher-order function' takes one or more functions as input and returns +a new function. The most useful tool in this module is the *note +functools.partial(): 410. function. + +For programs written in a functional style, you’ll sometimes want to +construct variants of existing functions that have some of the +parameters filled in. Consider a Python function ‘f(a, b, c)’; you may +wish to create a new function ‘g(b, c)’ that’s equivalent to ‘f(1, b, +c)’; you’re filling in a value for one of ‘f()’’s parameters. This is +called “partial function application”. + +The constructor for *note partial(): 410. takes the arguments +‘(function, arg1, arg2, ..., kwarg1=value1, kwarg2=value2)’. The +resulting object is callable, so you can just call it to invoke +‘function’ with the filled-in arguments. + +Here’s a small but realistic example: + + 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]): 12cf. cumulatively +performs an operation on all the iterable’s elements and, therefore, +can’t be applied to infinite iterables. 'func' must be a function that +takes two elements and returns a single value. *note +functools.reduce(): 12cf. takes the first two elements A and B returned +by the iterator and calculates ‘func(A, B)’. It then requests the third +element, C, calculates ‘func(func(A, B), C)’, combines this result with +the fourth element returned, and continues until the iterable is +exhausted. If the iterable returns no values at all, a *note TypeError: +534. exception is raised. If the initial value is supplied, it’s used +as a starting point and ‘func(initial_value, A)’ is the first +calculation. + + >>> 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 + +If you use *note operator.add(): 275d. with *note functools.reduce(): +12cf, you’ll add up all the elements of the iterable. This case is so +common that there’s a special built-in called *note sum(): 466. to +compute it: + + >>> import functools, operator + >>> functools.reduce(operator.add, [1, 2, 3, 4], 0) + 10 + >>> sum([1, 2, 3, 4]) + 10 + >>> sum([]) + 0 + +For many uses of *note functools.reduce(): 12cf, though, it can be +clearer to just write the obvious *note for: 2ec. loop: + + 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 + +A related function is *note itertools.accumulate(iterable, +func=operator.add): 9fc. It performs the same calculation, but instead +of returning only the final result, *note accumulate(): 9fc. returns an +iterator that also yields each partial result: + + 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: + +* The operator module:: + + +File: python.info, Node: The operator module, Up: The functools module + +9.7.7.1 The operator module +........................... + +The *note operator: 9f. module was mentioned earlier. It contains a set +of functions corresponding to Python’s operators. These functions are +often useful in functional-style code because they save you from writing +trivial functions that perform a single operation. + +Some of the functions in this module are: + + * Math operations: ‘add()’, ‘sub()’, ‘mul()’, ‘floordiv()’, ‘abs()’, + … + + * Logical operations: ‘not_()’, ‘truth()’. + + * Bitwise operations: ‘and_()’, ‘or_()’, ‘invert()’. + + * Comparisons: ‘eq()’, ‘ne()’, ‘lt()’, ‘le()’, ‘gt()’, and ‘ge()’. + + * Object identity: ‘is_()’, ‘is_not()’. + +Consult the operator module’s documentation for a complete list. + + +File: python.info, Node: Small functions and the lambda expression, Next: Revision History and Acknowledgements, Prev: The functools module, Up: Functional Programming HOWTO + +9.7.8 Small functions and the lambda expression +----------------------------------------------- + +When writing functional-style programs, you’ll often need little +functions that act as predicates or that combine elements in some way. + +If there’s a Python built-in or a module function that’s suitable, you +don’t need to define a new function at all: + + stripped_lines = [line.strip() for line in lines] + existing_files = filter(os.path.exists, file_list) + +If the function you need doesn’t exist, you need to write it. One way +to write small functions is to use the *note lambda: 128f. expression. +‘lambda’ takes a number of parameters and an expression combining these +parameters, and creates an anonymous function that returns the value of +the expression: + + adder = lambda x, y: x+y + + print_assign = lambda name, value: name + '=' + str(value) + +An alternative is to just use the ‘def’ statement and define a function +in the usual way: + + def adder(x, y): + return x + y + + def print_assign(name, value): + return name + '=' + str(value) + +Which alternative is preferable? That’s a style question; my usual +course is to avoid using ‘lambda’. + +One reason for my preference is that ‘lambda’ is quite limited in the +functions it can define. The result has to be computable as a single +expression, which means you can’t have multiway ‘if... elif... else’ +comparisons or ‘try... except’ statements. If you try to do too much in +a ‘lambda’ statement, you’ll end up with an overly complicated +expression that’s hard to read. Quick, what’s the following code doing? + + import functools + total = functools.reduce(lambda a, b: (0, a[1] + b[1]), items)[1] + +You can figure it out, but it takes time to disentangle the expression +to figure out what’s going on. Using a short nested ‘def’ statements +makes things a little bit better: + + import functools + def combine(a, b): + return 0, a[1] + b[1] + + total = functools.reduce(combine, items)[1] + +But it would be best of all if I had simply used a ‘for’ loop: + + total = 0 + for a, b in items: + total += b + +Or the *note sum(): 466. built-in and a generator expression: + + total = sum(b for a, b in items) + +Many uses of *note functools.reduce(): 12cf. are clearer when written as +‘for’ loops. + +Fredrik Lundh once suggested the following set of rules for refactoring +uses of ‘lambda’: + + 1. Write a lambda function. + + 2. Write a comment explaining what the heck that lambda does. + + 3. Study the comment for a while, and think of a name that captures + the essence of the comment. + + 4. Convert the lambda to a def statement, using that name. + + 5. Remove the comment. + +I really like these rules, but you’re free to disagree about whether +this lambda-free style is better. + + +File: python.info, Node: Revision History and Acknowledgements, Next: References<2>, Prev: Small functions and the lambda expression, Up: Functional Programming HOWTO + +9.7.9 Revision History and Acknowledgements +------------------------------------------- + +The author would like to thank the following people for offering +suggestions, corrections and assistance with various drafts of this +article: Ian Bicking, Nick Coghlan, Nick Efford, Raymond Hettinger, Jim +Jewett, Mike Krell, Leandro Lameiro, Jussi Salmela, Collin Winter, Blake +Winton. + +Version 0.1: posted June 30 2006. + +Version 0.11: posted July 1 2006. Typo fixes. + +Version 0.2: posted July 10 2006. Merged genexp and listcomp sections +into one. Typo fixes. + +Version 0.21: Added more references suggested on the tutor mailing list. + +Version 0.30: Adds a section on the ‘functional’ module written by +Collin Winter; adds short section on the operator module; a few other +edits. + + +File: python.info, Node: References<2>, Prev: Revision History and Acknowledgements, Up: Functional Programming HOWTO + +9.7.10 References +----------------- + +* Menu: + +* General:: +* Python-specific:: +* Python documentation:: + + +File: python.info, Node: General, Next: Python-specific, Up: References<2> + +9.7.10.1 General +................ + +'Structure and Interpretation of Computer Programs', by Harold Abelson +and Gerald Jay Sussman with Julie Sussman. The book can be found at +‘https://mitpress.mit.edu/sicp’. In this classic textbook of computer +science, chapters 2 and 3 discuss the use of sequences and streams to +organize the data flow inside a program. The book uses Scheme for its +examples, but many of the design approaches described in these chapters +are applicable to functional-style Python code. + +‘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’: General +Wikipedia entry describing functional programming. + +‘https://en.wikipedia.org/wiki/Coroutine’: Entry for coroutines. + +‘https://en.wikipedia.org/wiki/Partial_application’: Entry for the +concept of partial function application. + +‘https://en.wikipedia.org/wiki/Currying’: Entry for the concept of +currying. + + +File: python.info, Node: Python-specific, Next: Python documentation, Prev: General, Up: References<2> + +9.7.10.2 Python-specific +........................ + +‘https://gnosis.cx/TPiP/’: The first chapter of David Mertz’s book ‘Text +Processing in Python’ discusses functional programming for text +processing, in the section titled “Utilizing Higher-Order Functions in +Text Processing”. + +Mertz also wrote a 3-part series of articles on functional programming +for IBM’s DeveloperWorks site; see part 1(1), part 2(2), and part 3(3), + + ---------- Footnotes ---------- + + (1) https://developer.ibm.com/articles/l-prog/ + + (2) https://developer.ibm.com/tutorials/l-prog2/ + + (3) https://developer.ibm.com/tutorials/l-prog3/ + + +File: python.info, Node: Python documentation, Prev: Python-specific, Up: References<2> + +9.7.10.3 Python documentation +............................. + +Documentation for the *note itertools: 81. module. + +Documentation for the *note functools: 5f. module. + +Documentation for the *note operator: 9f. module. + +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 Cookbook, Prev: Functional Programming HOWTO, Up: Python HOWTOs + +9.8 Logging HOWTO +================= + + +Author: Vinay Sajip <vinay_sajip at red-dove dot com> + +This page contains tutorial information. For links to reference +information and a logging cookbook, please see *note Other resources: +4f8e. + +* Menu: + +* Basic Logging Tutorial:: +* Advanced Logging Tutorial:: +* Logging Levels: Logging Levels<2>. +* Useful Handlers:: +* Exceptions raised during logging:: +* Using arbitrary objects as messages:: +* Optimization:: +* Other resources:: + + +File: python.info, Node: Basic Logging Tutorial, Next: Advanced Logging Tutorial, Up: Logging HOWTO + +9.8.1 Basic Logging Tutorial +---------------------------- + +Logging is a means of tracking events that happen when some software +runs. The software’s developer adds logging calls to their code to +indicate that certain events have occurred. An event is described by a +descriptive message which can optionally contain variable data (i.e. +data that is potentially different for each occurrence of the event). +Events also have an importance which the developer ascribes to the +event; the importance can also be called the 'level' or 'severity'. + +* Menu: + +* When to use logging:: +* A simple example:: +* Logging to a file:: +* Logging variable data:: +* Changing the format of displayed messages:: +* Displaying the date/time in messages:: +* Next Steps:: + + +File: python.info, Node: When to use logging, Next: A simple example, Up: Basic Logging Tutorial + +9.8.1.1 When to use logging +........................... + +You can access logging functionality by creating a logger via ‘logger = +getLogger(__name__)’, and then calling the logger’s *note debug(): e29, +*note info(): 2c6e, *note warning(): 1703, *note error(): 2c70. and +*note critical(): e28. 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. + +Task you want to perform The best tool for the task + +------------------------------------------------------------------------------------- + +Display console output for ordinary *note print(): f70. +usage of a command line script or +program + +Report events that occur during normal A logger’s *note info(): 2c6e. (or +operation of a program (e.g. for *note debug(): e29. method for very +status monitoring or fault detailed output for diagnostic purposes) +investigation) + +Issue a warning regarding a particular *note warnings.warn(): 14e4. in library +runtime event code if the issue is avoidable and the + client application should be modified to + eliminate the warning + + A logger’s *note warning(): 1703. method + if there is nothing the client + application can do about the situation, + but the event should still be noted + + +Report an error regarding a particular Raise an exception +runtime event + +Report suppression of an error without A logger’s *note error(): 2c70, +raising an exception (e.g. error *note exception(): e27. or +handler in a long-running server *note critical(): e28. method as +process) 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): + +Level When it’s used + +--------------------------------------------------------------------- + +‘DEBUG’ Detailed information, typically of interest + only when diagnosing problems. + + +‘INFO’ Confirmation that things are working as + expected. + + +‘WARNING’ An indication that something unexpected + happened, or indicative of some problem in the + near future (e.g. ‘disk space low’). The + software is still working as expected. + + +‘ERROR’ Due to a more serious problem, the software has + not been able to perform some function. + + +‘CRITICAL’ A serious error, indicating that the program + itself may be unable to continue running. + + +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. + +Events that are tracked can be handled in different ways. The simplest +way of handling tracked events is to print them to the console. Another +common way is to write them to a disk file. + + +File: python.info, Node: A simple example, Next: Logging to a file, Prev: When to use logging, Up: Basic Logging Tutorial + +9.8.1.2 A simple example +........................ + +A very simple example is: + + import logging + logging.warning('Watch out!') # will print a message to the console + logging.info('I told you so') # will not print anything + +If you type these lines into a script and run it, you’ll see: + + 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 operation on the root logger, but can +be useful as they will call *note basicConfig(): 9ff. 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 to a file, Next: Logging variable data, Prev: A simple example, Up: Basic Logging Tutorial + +9.8.1.3 Logging to a file +......................... + +A very common situation is that of recording logging events in a file, +so let’s look at that next. Be sure to try the following in a newly +started Python interpreter, and don’t just continue from the session +described above: + + 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ö') + +Changed in version 3.9: The 'encoding' argument was added. In earlier +Python versions, or if not specified, the encoding used is the default +value used by *note open(): 517. While not shown in the above example, +an 'errors' argument can also now be passed, which determines how +encoding errors are handled. For available values and the default, see +the documentation for *note open(): 517. + +And now if we open the file and look at what we have, we should find the +log messages: + + 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ö + +This example also shows how you can set the logging level which acts as +the threshold for tracking. In this case, because we set the threshold +to ‘DEBUG’, all of the messages were printed. + +If you want to set the logging level from a command-line option such as: + + --log=INFO + +and you have the value of the parameter passed for ‘--log’ in some +variable 'loglevel', you can use: + + getattr(logging, loglevel.upper()) + +to get the value which you’ll pass to *note basicConfig(): 9ff. via the +'level' argument. You may want to error check any user input value, +perhaps as in the following example: + + # 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(): 9ff. should come 'before' any calls to +a logger’s methods such as *note debug(): e29, *note info(): 2c6e, etc. +Otherwise, that logging event may not be handled in the desired manner. + +If you run the above script several times, the messages from successive +runs are appended to the file 'example.log'. If you want each run to +start afresh, not remembering the messages from earlier runs, you can +specify the 'filemode' argument, by changing the call in the above +example to: + + logging.basicConfig(filename='example.log', filemode='w', level=logging.DEBUG) + +The output will be the same as before, but the log file is no longer +appended to, so the messages from earlier runs are lost. + + +File: python.info, Node: Logging variable data, Next: Changing the format of displayed messages, Prev: Logging to a file, Up: Basic Logging Tutorial + +9.8.1.4 Logging variable data +............................. + +To log variable data, use a format string for the event description +message and append the variable data as arguments. For example: + + import logging + logging.warning('%s before you %s', 'Look', 'leap!') + +will display: + + WARNING:root:Look before you leap! + +As you can see, merging of variable data into the event description +message uses the old, %-style of string formatting. This is for +backwards compatibility: the logging package pre-dates newer formatting +options such as *note str.format(): 61d. and *note string.Template: 683. +These newer formatting options 'are' supported, but exploring them is +outside the scope of this tutorial: see *note Using particular +formatting styles throughout your application: 2c8d. for more +information. + + +File: python.info, Node: Changing the format of displayed messages, Next: Displaying the date/time in messages, Prev: Logging variable data, Up: Basic Logging Tutorial + +9.8.1.5 Changing the format of displayed messages +................................................. + +To change the format which is used to display messages, you need to +specify the format you want to use: + + 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') + +which would print: + + DEBUG:This message should appear on the console + INFO:So should this + WARNING:And this, too + +Notice that the ‘root’ which appeared in earlier examples has +disappeared. For a full set of things that can appear in format +strings, you can refer to the documentation for *note LogRecord +attributes: 2c6d, but for simple usage, you just need the 'levelname' +(severity), 'message' (event description, including variable data) and +perhaps to display when the event occurred. This is described in the +next section. + + +File: python.info, Node: Displaying the date/time in messages, Next: Next Steps, Prev: Changing the format of displayed messages, Up: Basic Logging Tutorial + +9.8.1.6 Displaying the date/time in messages +............................................ + +To display the date and time of an event, you would place ‘%(asctime)s’ +in your format string: + + import logging + logging.basicConfig(format='%(asctime)s %(message)s') + logging.warning('is when this event was logged.') + +which should print something like this: + + 2010-12-12 11:41:42,612 is when this event was logged. + +The default format for date/time display (shown above) is like ISO8601 +or RFC 3339(1). If you need more control over the formatting of the +date/time, provide a 'datefmt' argument to ‘basicConfig’, as in this +example: + + 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.') + +which would display something like this: + + 12/12/2010 11:46:36 AM is when this event was logged. + +The format of the 'datefmt' argument is the same as supported by *note +time.strftime(): 11db. + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc3339.html + + +File: python.info, Node: Next Steps, Prev: Displaying the date/time in messages, Up: Basic Logging Tutorial + +9.8.1.7 Next Steps +.................. + +That concludes the basic tutorial. It should be enough to get you up +and running with logging. There’s a lot more that the logging package +offers, but to get the best out of it, you’ll need to invest a little +more of your time in reading the following sections. If you’re ready +for that, grab some of your favourite beverage and carry on. + +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. + +Still here? You can carry on reading the next few sections, which +provide a slightly more advanced/in-depth tutorial than the basic one +above. After that, you can take a look at the *note Logging Cookbook: +11e9. + + ---------- Footnotes ---------- + + (1) https://discuss.python.org/c/help/7 + + +File: python.info, Node: Advanced Logging Tutorial, Next: Logging Levels<2>, Prev: Basic Logging Tutorial, Up: Logging HOWTO + +9.8.2 Advanced Logging Tutorial +------------------------------- + +The logging library takes a modular approach and offers several +categories of components: loggers, handlers, filters, and formatters. + + * Loggers expose the interface that application code directly uses. + + * Handlers send the log records (created by loggers) to the + appropriate destination. + + * Filters provide a finer grained facility for determining which log + records to output. + + * Formatters specify the layout of log records in the final output. + +Log event information is passed between loggers, handlers, filters and +formatters in a *note LogRecord: fe1. instance. + +Logging is performed by calling methods on instances of the *note +Logger: b4f. class (hereafter called 'loggers'). Each instance has a +name, and they are conceptually arranged in a namespace hierarchy using +dots (periods) as separators. For example, a logger named ‘scan’ is the +parent of loggers ‘scan.text’, ‘scan.html’ and ‘scan.pdf’. Logger names +can be anything you want, and indicate the area of an application in +which a logged message originates. + +A good convention to use when naming loggers is to use a module-level +logger, in each module which uses logging, named as follows: + + logger = logging.getLogger(__name__) + +This means that logger names track the package/module hierarchy, and +it’s intuitively obvious where events are logged just from the logger +name. + +The root of the hierarchy of loggers is called the root logger. That’s +the logger used by the functions *note debug(): 2c6f, *note info(): +2c98, *note warning(): 2f9, *note error(): 2cac. and *note critical(): +2cad, which just call the same-named method of the root logger. The +functions and the methods have the same signatures. The root logger’s +name is printed as ‘root’ in the logged output. + +It is, of course, possible to log messages to different destinations. +Support is included in the package for writing log messages to files, +HTTP GET/POST locations, email via SMTP, generic sockets, queues, or +OS-specific logging mechanisms such as syslog or the Windows NT event +log. Destinations are served by 'handler' classes. You can create your +own log destination class if you have special requirements not met by +any of the built-in handler classes. + +By default, no destination is set for any logging messages. You can +specify a destination (such as console or file) by using *note +basicConfig(): 9ff. as in the tutorial examples. If you call the +functions *note debug(): 2c6f, *note info(): 2c98, *note warning(): 2f9, +*note error(): 2cac. and *note critical(): 2cad, they will check to see +if no destination is set; and if one is not set, they will set a +destination of the console (‘sys.stderr’) and a default format for the +displayed message before delegating to the root logger to do the actual +message output. + +The default format set by *note basicConfig(): 9ff. for messages is: + + severity:logger name:message + +You can change this by passing a format string to *note basicConfig(): +9ff. with the 'format' keyword argument. For all options regarding how +a format string is constructed, see *note Formatter Objects: 2c8a. + +* Menu: + +* Logging Flow:: +* Loggers:: +* Handlers:: +* Formatters:: +* Configuring Logging:: +* What happens if no configuration is provided:: +* Configuring Logging for a Library:: + + +File: python.info, Node: Logging Flow, Next: Loggers, Up: Advanced Logging Tutorial + +9.8.2.1 Logging Flow +.................... + +The flow of log event information in loggers and handlers is illustrated +in the following diagram. + +�[image src="python-figures/logging_flow.png"�] + + + +File: python.info, Node: Loggers, Next: Handlers, Prev: Logging Flow, Up: Advanced Logging Tutorial + +9.8.2.2 Loggers +............... + +*note Logger: b4f. objects have a threefold job. First, they expose +several methods to application code so that applications can log +messages at runtime. Second, logger objects determine which log +messages to act upon based upon severity (the default filtering +facility) or filter objects. Third, logger objects pass along relevant +log messages to all interested log handlers. + +The most widely used methods on logger objects fall into two categories: +configuration and message sending. + +These are the most common configuration methods: + + * *note Logger.setLevel(): 145a. specifies the lowest-severity log + message a logger will handle, where debug is the lowest built-in + severity level and critical is the highest built-in severity. For + example, if the severity level is INFO, the logger will handle only + INFO, WARNING, ERROR, and CRITICAL messages and will ignore DEBUG + messages. + + * *note Logger.addHandler(): 2c68. and *note Logger.removeHandler(): + 2c69. add and remove handler objects from the logger object. + Handlers are covered in more detail in *note Handlers: 4f9b. + + * *note Logger.addFilter(): 2c71. and *note Logger.removeFilter(): + 2c72. add and remove filter objects from the logger object. + Filters are covered in more detail in *note Filter Objects: 2c95. + +You don’t need to always call these methods on every logger you create. +See the last two paragraphs in this section. + +With the logger object configured, the following methods create log +messages: + + * *note Logger.debug(): e29, *note Logger.info(): 2c6e, *note + Logger.warning(): 1703, *note Logger.error(): 2c70, and *note + Logger.critical(): e28. all create log records with a message and a + level that corresponds to their respective method names. The + message is actually a format string, which may contain the standard + string substitution syntax of ‘%s’, ‘%d’, ‘%f’, and so on. The + rest of their arguments is a list of objects that correspond with + the substitution fields in the message. With regard to ‘**kwargs’, + the logging methods care only about a keyword of ‘exc_info’ and use + it to determine whether to log exception information. + + * *note Logger.exception(): e27. creates a log message similar to + *note Logger.error(): 2c70. The difference is that *note + Logger.exception(): e27. dumps a stack trace along with it. Call + this method only from an exception handler. + + * *note Logger.log(): e26. takes a log level as an explicit argument. + This is a little more verbose for logging messages than using the + log level convenience methods listed above, but this is how to log + at custom log levels. + +*note getLogger(): 960. returns a reference to a logger instance with +the specified name if it is provided, or ‘root’ if not. The names are +period-separated hierarchical structures. Multiple calls to *note +getLogger(): 960. with the same name will return a reference to the same +logger object. Loggers that are further down in the hierarchical list +are children of loggers higher up in the list. For example, given a +logger with a name of ‘foo’, loggers with names of ‘foo.bar’, +‘foo.bar.baz’, and ‘foo.bam’ are all descendants of ‘foo’. + +Loggers have a concept of 'effective level'. If a level is not +explicitly set on a logger, the level of its parent is used instead as +its effective level. If the parent has no explicit level set, 'its' +parent is examined, and so on - all ancestors are searched until an +explicitly set level is found. The root logger always has an explicit +level set (‘WARNING’ by default). When deciding whether to process an +event, the effective level of the logger is used to determine whether +the event is passed to the logger’s handlers. + +Child loggers propagate messages up to the handlers associated with +their ancestor loggers. Because of this, it is unnecessary to define +and configure handlers for all the loggers an application uses. It is +sufficient to configure handlers for a top-level logger and create child +loggers as needed. (You can, however, turn off propagation by setting +the 'propagate' attribute of a logger to ‘False’.) + + +File: python.info, Node: Handlers, Next: Formatters, Prev: Loggers, Up: Advanced Logging Tutorial + +9.8.2.3 Handlers +................ + +*note Handler: 145d. objects are responsible for dispatching the +appropriate log messages (based on the log messages’ severity) to the +handler’s specified destination. *note Logger: b4f. objects can add +zero or more handler objects to themselves with an *note addHandler(): +2c68. method. As an example scenario, an application may want to send +all log messages to a log file, all log messages of error or higher to +stdout, and all messages of critical to an email address. This scenario +requires three individual handlers where each handler is responsible for +sending messages of a specific severity to a specific location. + +The standard library includes quite a few handler types (see *note +Useful Handlers: 4f9d.); the tutorials use mainly *note StreamHandler: +11ea. and *note FileHandler: 189e. in its examples. + +There are very few methods in a handler for application developers to +concern themselves with. The only handler methods that seem relevant +for application developers who are using the built-in handler objects +(that is, not creating custom handlers) are the following configuration +methods: + + * The *note setLevel(): 2c7f. method, just as in logger objects, + specifies the lowest severity that will be dispatched to the + appropriate destination. Why are there two *note setLevel(): 2c7f. + methods? The level set in the logger determines which severity of + messages it will pass to its handlers. The level set in each + handler determines which messages that handler will send on. + + * *note setFormatter(): 2c80. selects a Formatter object for this + handler to use. + + * *note addFilter(): 2c81. and *note removeFilter(): 2c82. + respectively configure and deconfigure filter objects on handlers. + +Application code should not directly instantiate and use instances of +*note Handler: 145d. Instead, the *note Handler: 145d. class is a base +class that defines the interface that all handlers should have and +establishes some default behavior that child classes can use (or +override). + + +File: python.info, Node: Formatters, Next: Configuring Logging, Prev: Handlers, Up: Advanced Logging Tutorial + +9.8.2.4 Formatters +.................. + +Formatter objects configure the final order, structure, and contents of +the log message. Unlike the base *note logging.Handler: 145d. class, +application code may instantiate formatter classes, although you could +likely subclass the formatter if your application needs special +behavior. The constructor takes three optional arguments – a message +format string, a date format string and a style indicator. + + -- Method: logging.Formatter.__init__ (fmt=None, datefmt=None, + style='%') + +If there is no message format string, the default is to use the raw +message. If there is no date format string, the default date format is: + + %Y-%m-%d %H:%M:%S + +with the milliseconds tacked on at the end. The ‘style’ is one of +‘'%'’, ‘'{'’, or ‘'$'’. If one of these is not specified, then ‘'%'’ +will be used. + +If the ‘style’ is ‘'%'’, the message format string uses ‘%(<dictionary +key>)s’ styled string substitution; the possible keys are documented in +*note LogRecord attributes: 2c6d. If the style is ‘'{'’, the message +format string is assumed to be compatible with *note str.format(): 61d. +(using keyword arguments), while if the style is ‘'$'’ then the message +format string should conform to what is expected by *note +string.Template.substitute(): 1cea. + +Changed in version 3.2: Added the ‘style’ parameter. + +The following message format string will log the time in a +human-readable format, the severity of the message, and the contents of +the message, in that order: + + '%(asctime)s - %(levelname)s - %(message)s' + +Formatters use a user-configurable function to convert the creation time +of a record to a tuple. By default, *note time.localtime(): 14c4. is +used; to change this for a particular formatter instance, set the +‘converter’ attribute of the instance to a function with the same +signature as *note time.localtime(): 14c4. or *note time.gmtime(): 11b2. +To change it for all formatters, for example if you want all logging +times to be shown in GMT, set the ‘converter’ attribute in the Formatter +class (to ‘time.gmtime’ for GMT display). + + +File: python.info, Node: Configuring Logging, Next: What happens if no configuration is provided, Prev: Formatters, Up: Advanced Logging Tutorial + +9.8.2.5 Configuring Logging +........................... + +Programmers can configure logging in three ways: + + 1. Creating loggers, handlers, and formatters explicitly using Python + code that calls the configuration methods listed above. + + 2. Creating a logging config file and reading it using the *note + fileConfig(): b51. function. + + 3. Creating a dictionary of configuration information and passing it + to the *note dictConfig(): 11a2. function. + +For the reference documentation on the last two options, see *note +Configuration functions: 12e4. The following example configures a very +simple logger, a console handler, and a simple formatter using Python +code: + + 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') + +Running this module from the command line produces the following output: + + $ 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 + +The following Python module creates a logger, handler, and formatter +nearly identical to those in the example listed above, with the only +difference being the names of the objects: + + 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') + +Here is the logging.conf file: + + [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 + +The output is nearly identical to that of the non-config-file-based +example: + + $ 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 + +You can see that the config file approach has a few advantages over the +Python code approach, mainly separation of configuration and code and +the ability of noncoders to easily modify the logging properties. + + Warning: The *note fileConfig(): b51. function takes a default + parameter, ‘disable_existing_loggers’, which defaults to ‘True’ for + reasons of backward compatibility. This may or may not be what you + want, since it will cause any non-root loggers existing before the + *note fileConfig(): b51. call to be disabled unless they (or an + ancestor) are explicitly named in the configuration. Please refer + to the reference documentation for more information, and specify + ‘False’ for this parameter if you wish. + + The dictionary passed to *note dictConfig(): 11a2. can also specify + a Boolean value with key ‘disable_existing_loggers’, which if not + specified explicitly in the dictionary also defaults to being + interpreted as ‘True’. This leads to the logger-disabling + behaviour described above, which may not be what you want - in + which case, provide the key explicitly with a value of ‘False’. + +Note that the class names referenced in config files need to be either +relative to the logging module, or absolute values which can be resolved +using normal import mechanisms. Thus, you could use either *note +WatchedFileHandler: 2ceb. (relative to the logging module) or +‘mypackage.mymodule.MyHandler’ (for a class defined in package +‘mypackage’ and module ‘mymodule’, where ‘mypackage’ is available on the +Python import path). + +In Python 3.2, a new means of configuring logging has been introduced, +using dictionaries to hold configuration information. This provides a +superset of the functionality of the config-file-based approach outlined +above, and is the recommended configuration method for new applications +and deployments. Because a Python dictionary is used to hold +configuration information, and since you can populate that dictionary +using different means, you have more options for configuration. For +example, you can use a configuration file in JSON format, or, if you +have access to YAML processing functionality, a file in YAML format, to +populate the configuration dictionary. Or, of course, you can construct +the dictionary in Python code, receive it in pickled form over a socket, +or use whatever approach makes sense for your application. + +Here’s an example of the same configuration as above, in YAML format for +the new dictionary-based approach: + + 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] + +For more information about logging using a dictionary, see *note +Configuration functions: 12e4. + + +File: python.info, Node: What happens if no configuration is provided, Next: Configuring Logging for a Library, Prev: Configuring Logging, Up: Advanced Logging Tutorial + +9.8.2.6 What happens if no configuration is provided +.................................................... + +If no logging configuration is provided, it is possible to have a +situation where a logging event needs to be output, but no handlers can +be found to output the event. + +The event is output using a ‘handler of last resort’, stored in *note +lastResort: 11ec. This internal handler is not associated with any +logger, and acts like a *note StreamHandler: 11ea. which writes the +event description message to the current value of ‘sys.stderr’ +(therefore respecting any redirections which may be in effect). No +formatting is done on the message - just the bare event description +message is printed. The handler’s level is set to ‘WARNING’, so all +events at this and greater severities will be output. + +Changed in version 3.2: For versions of Python prior to 3.2, the +behaviour is as follows: + + * If *note raiseExceptions: 11eb. is ‘False’ (production mode), the + event is silently dropped. + + * If *note raiseExceptions: 11eb. is ‘True’ (development mode), a + message ‘No handlers could be found for logger X.Y.Z’ is printed + once. + +To obtain the pre-3.2 behaviour, *note lastResort: 11ec. can be set to +‘None’. + + +File: python.info, Node: Configuring Logging for a Library, Prev: What happens if no configuration is provided, Up: Advanced Logging Tutorial + +9.8.2.7 Configuring Logging for a Library +......................................... + +When developing a library which uses logging, you should take care to +document how the library uses logging - for example, the names of +loggers used. Some consideration also needs to be given to its logging +configuration. If the using application does not use logging, and +library code makes logging calls, then (as described in the previous +section) events of severity ‘WARNING’ and greater will be printed to +‘sys.stderr’. This is regarded as the best default behaviour. + +If for some reason you 'don’t' want these messages printed in the +absence of any logging configuration, you can attach a do-nothing +handler to the top-level logger for your library. This avoids the +message being printed, since a handler will always be found for the +library’s events: it just doesn’t produce any output. If the library +user configures logging for application use, presumably that +configuration will add some handlers, and if levels are suitably +configured then logging calls made in library code will send output to +those handlers, as normal. + +A do-nothing handler is included in the logging package: *note +NullHandler: 1277. (since Python 3.1). An instance of this handler +could be added to the top-level logger of the logging namespace used by +the library ('if' you want to prevent your library’s logged events being +output to ‘sys.stderr’ in the absence of logging configuration). If all +logging by a library 'foo' is done using loggers with names matching +‘foo.x’, ‘foo.x.y’, etc. then the code: + + import logging + logging.getLogger('foo').addHandler(logging.NullHandler()) + +should have the desired effect. If an organisation produces a number of +libraries, then the logger name specified can be ‘orgname.foo’ rather +than just ‘foo’. + + Note: It is strongly advised that you 'do not log to the root + logger' in your library. Instead, use a logger with a unique and + easily identifiable name, such as the ‘__name__’ for your library’s + top-level package or module. Logging to the root logger will make + it difficult or impossible for the application developer to + configure the logging verbosity or handlers of your library as they + wish. + + Note: It is strongly advised that you 'do not add any handlers + other than' *note NullHandler: 1277. 'to your library’s loggers'. + This is because the configuration of handlers is the prerogative of + the application developer who uses your library. The application + developer knows their target audience and what handlers are most + appropriate for their application: if you add handlers ‘under the + hood’, you might well interfere with their ability to carry out + unit tests and deliver logs which suit their requirements. + + +File: python.info, Node: Logging Levels<2>, Next: Useful Handlers, Prev: Advanced Logging Tutorial, Up: Logging HOWTO + +9.8.3 Logging Levels +-------------------- + +The numeric values of logging levels are given in the following table. +These are primarily of interest if you want to define your own levels, +and need them to have specific values relative to the predefined levels. +If you define a level with the same numeric value, it overwrites the +predefined value; the predefined name is lost. + +Level Numeric value + +--------------------------------------- + +‘CRITICAL’ 50 + + +‘ERROR’ 40 + + +‘WARNING’ 30 + + +‘INFO’ 20 + + +‘DEBUG’ 10 + + +‘NOTSET’ 0 + + +Levels can also be associated with loggers, being set either by the +developer or through loading a saved logging configuration. When a +logging method is called on a logger, the logger compares its own level +with the level associated with the method call. If the logger’s level +is higher than the method call’s, no logging message is actually +generated. This is the basic mechanism controlling the verbosity of +logging output. + +Logging messages are encoded as instances of the *note LogRecord: fe1. +class. When a logger decides to actually log an event, a *note +LogRecord: fe1. instance is created from the logging message. + +Logging messages are subjected to a dispatch mechanism through the use +of 'handlers', which are instances of subclasses of the *note Handler: +145d. class. Handlers are responsible for ensuring that a logged +message (in the form of a *note LogRecord: fe1.) ends up in a particular +location (or set of locations) which is useful for the target audience +for that message (such as end users, support desk staff, system +administrators, developers). Handlers are passed *note LogRecord: fe1. +instances intended for particular destinations. Each logger can have +zero, one or more handlers associated with it (via the *note +addHandler(): 2c68. method of *note Logger: b4f.). In addition to any +handlers directly associated with a logger, 'all handlers associated +with all ancestors of the logger' are called to dispatch the message +(unless the 'propagate' flag for a logger is set to a false value, at +which point the passing to ancestor handlers stops). + +Just as for loggers, handlers can have levels associated with them. A +handler’s level acts as a filter in the same way as a logger’s level +does. If a handler decides to actually dispatch an event, the *note +emit(): 2c88. method is used to send the message to its destination. +Most user-defined subclasses of *note Handler: 145d. will need to +override this *note emit(): 2c88. + +* Menu: + +* Custom Levels:: + + +File: python.info, Node: Custom Levels, Up: Logging Levels<2> + +9.8.3.1 Custom Levels +..................... + +Defining your own levels is possible, but should not be necessary, as +the existing levels have been chosen on the basis of practical +experience. However, if you are convinced that you need custom levels, +great care should be exercised when doing this, and it is possibly 'a +very bad idea to define custom levels if you are developing a library'. +That’s because if multiple library authors all define their own custom +levels, there is a chance that the logging output from such multiple +libraries used together will be difficult for the using developer to +control and/or interpret, because a given numeric value might mean +different things for different libraries. + + +File: python.info, Node: Useful Handlers, Next: Exceptions raised during logging, Prev: Logging Levels<2>, Up: Logging HOWTO + +9.8.4 Useful Handlers +--------------------- + +In addition to the base *note Handler: 145d. class, many useful +subclasses are provided: + + 1. *note StreamHandler: 11ea. instances send messages to streams + (file-like objects). + + 2. *note FileHandler: 189e. instances send messages to disk files. + + 3. *note BaseRotatingHandler: 2cef. is the base class for handlers + that rotate log files at a certain point. It is not meant to be + instantiated directly. Instead, use *note RotatingFileHandler: + 15d9. or *note TimedRotatingFileHandler: f5c. + + 4. *note RotatingFileHandler: 15d9. instances send messages to disk + files, with support for maximum log file sizes and log file + rotation. + + 5. *note TimedRotatingFileHandler: f5c. instances send messages to + disk files, rotating the log file at certain timed intervals. + + 6. *note SocketHandler: f5d. instances send messages to TCP/IP + sockets. Since 3.4, Unix domain sockets are also supported. + + 7. *note DatagramHandler: f5e. instances send messages to UDP sockets. + Since 3.4, Unix domain sockets are also supported. + + 8. *note SMTPHandler: 1568. instances send messages to a designated + email address. + + 9. *note SysLogHandler: 658. instances send messages to a Unix syslog + daemon, possibly on a remote machine. + + 10. *note NTEventLogHandler: 2d15. instances send messages to a + Windows NT/2000/XP event log. + + 11. *note MemoryHandler: 2ccf. instances send messages to a buffer in + memory, which is flushed whenever specific criteria are met. + + 12. *note HTTPHandler: e2a. instances send messages to an HTTP server + using either ‘GET’ or ‘POST’ semantics. + + 13. *note WatchedFileHandler: 2ceb. instances watch the file they are + logging to. If the file changes, it is closed and reopened using + the file name. This handler is only useful on Unix-like systems; + Windows does not support the underlying mechanism used. + + 14. *note QueueHandler: 17d7. instances send messages to a queue, such + as those implemented in the *note queue: b6. or *note + multiprocessing: 94. modules. + + 15. *note NullHandler: 1277. instances do nothing with error messages. + They are used by library developers who want to use logging, but + want to avoid the ‘No handlers could be found for logger 'XXX'’ + message which can be displayed if the library user has not + configured logging. See *note Configuring Logging for a Library: + 2ce8. for more information. + +Added in version 3.1: The *note NullHandler: 1277. class. + +Added in version 3.2: The *note QueueHandler: 17d7. class. + +The *note NullHandler: 1277, *note StreamHandler: 11ea. and *note +FileHandler: 189e. classes are defined in the core logging package. The +other handlers are defined in a sub-module, *note logging.handlers: 89. +(There is also another sub-module, *note logging.config: 88, for +configuration functionality.) + +Logged messages are formatted for presentation through instances of the +*note Formatter: 145e. class. They are initialized with a format string +suitable for use with the % operator and a dictionary. + +For formatting multiple messages in a batch, instances of *note +BufferingFormatter: 2c91. can be used. In addition to the format string +(which is applied to each message in the batch), there is provision for +header and trailer format strings. + +When filtering based on logger level and/or handler level is not enough, +instances of *note Filter: 11ed. can be added to both *note Logger: b4f. +and *note Handler: 145d. instances (through their *note addFilter(): +2c81. method). Before deciding to process a message further, both +loggers and handlers consult all their filters for permission. If any +filter returns a false value, the message is not processed further. + +The basic *note Filter: 11ed. functionality allows filtering by specific +logger name. If this feature is used, messages sent to the named logger +and its children are allowed through the filter, and all others dropped. + + +File: python.info, Node: Exceptions raised during logging, Next: Using arbitrary objects as messages, Prev: Useful Handlers, Up: Logging HOWTO + +9.8.5 Exceptions raised during logging +-------------------------------------- + +The logging package is designed to swallow exceptions which occur while +logging in production. This is so that errors which occur while +handling logging events - such as logging misconfiguration, network or +other similar errors - do not cause the application using logging to +terminate prematurely. + +*note SystemExit: d40. and *note KeyboardInterrupt: 9d1. exceptions are +never swallowed. Other exceptions which occur during the *note emit(): +2c88. method of a *note Handler: 145d. subclass are passed to its *note +handleError(): 2c87. method. + +The default implementation of *note handleError(): 2c87. in *note +Handler: 145d. checks to see if a module-level variable, *note +raiseExceptions: 11eb, is set. If set, a traceback is printed to *note +sys.stderr: 939. If not set, the exception is swallowed. + + Note: The default value of *note raiseExceptions: 11eb. is ‘True’. + This is because during development, you typically want to be + notified of any exceptions that occur. It’s advised that you set + *note raiseExceptions: 11eb. to ‘False’ for production usage. + + +File: python.info, Node: Using arbitrary objects as messages, Next: Optimization, Prev: Exceptions raised during logging, Up: Logging HOWTO + +9.8.6 Using arbitrary objects as messages +----------------------------------------- + +In the preceding sections and examples, it has been assumed that the +message passed when logging the event is a string. However, this is not +the only possibility. You can pass an arbitrary object as a message, +and its *note __str__(): 619. method will be called when the logging +system needs to convert it to a string representation. In fact, if you +want to, you can avoid computing a string representation altogether - +for example, the *note SocketHandler: f5d. emits an event by pickling it +and sending it over the wire. + + +File: python.info, Node: Optimization, Next: Other resources, Prev: Using arbitrary objects as messages, Up: Logging HOWTO + +9.8.7 Optimization +------------------ + +Formatting of message arguments is deferred until it cannot be avoided. +However, computing the arguments passed to the logging method can also +be expensive, and you may want to avoid doing it if the logger will just +throw away your event. To decide what to do, you can call the *note +isEnabledFor(): 12e9. method which takes a level argument and returns +true if the event would be created by the Logger for that level of call. +You can write code like this: + + if logger.isEnabledFor(logging.DEBUG): + logger.debug('Message with %s, %s', expensive_func1(), + expensive_func2()) + +so that if the logger’s threshold is set above ‘DEBUG’, the calls to +‘expensive_func1’ and ‘expensive_func2’ are never made. + + Note: In some cases, *note isEnabledFor(): 12e9. can itself be more + expensive than you’d like (e.g. for deeply nested loggers where an + explicit level is only set high up in the logger hierarchy). In + such cases (or if you want to avoid calling a method in tight + loops), you can cache the result of a call to *note isEnabledFor(): + 12e9. in a local or instance variable, and use that instead of + calling the method each time. Such a cached value would only need + to be recomputed when the logging configuration changes dynamically + while the application is running (which is not all that common). + +There are other optimizations which can be made for specific +applications which need more precise control over what logging +information is collected. Here’s a list of things you can do to avoid +processing during logging which you don’t need: + +What you don’t want to collect How to avoid collecting it + +------------------------------------------------------------------------------------------------------------------ + +Information about where calls were made from. Set ‘logging._srcfile’ to ‘None’. This avoids + calling *note sys._getframe(): 6dc, which may help to + speed up your code in environments like PyPy (which + can’t speed up code that uses + *note sys._getframe(): 6dc.). + + +Threading information. Set ‘logging.logThreads’ to ‘False’. + + +Current process ID (*note os.getpid(): 2b0c.) Set ‘logging.logProcesses’ to ‘False’. + + +Current process name when using ‘multiprocessing’ to Set ‘logging.logMultiprocessing’ to ‘False’. +manage multiple processes. + +Current *note asyncio.Task: 1be. name when using Set ‘logging.logAsyncioTasks’ to ‘False’. +‘asyncio’. + +Also note that the core logging module only includes the basic handlers. +If you don’t import *note logging.handlers: 89. and *note +logging.config: 88, they won’t take up any memory. + + +File: python.info, Node: Other resources, Prev: Optimization, Up: Logging HOWTO + +9.8.8 Other resources +--------------------- + +See also +........ + +Module *note logging: 87. + + API reference for the logging module. + +Module *note logging.config: 88. + + Configuration API for the logging module. + +Module *note logging.handlers: 89. + + Useful handlers included with the logging module. + +*note A logging cookbook: 11e9. + + +File: python.info, Node: Logging Cookbook, Next: Regular Expression HOWTO, Prev: Logging HOWTO, Up: Python HOWTOs + +9.9 Logging Cookbook +==================== + + +Author: Vinay Sajip <vinay_sajip at red-dove dot com> + +This page contains a number of recipes related to logging, which have +been found useful in the past. For links to tutorial and reference +information, please see *note Other resources: 4fad. + +* Menu: + +* Using logging in multiple modules:: +* Logging from multiple threads:: +* Multiple handlers and formatters:: +* Logging to multiple destinations:: +* Custom handling of levels:: +* Configuration server example:: +* Dealing with handlers that block:: +* Sending and receiving logging events across a network:: +* Adding contextual information to your logging output:: +* Use of contextvars:: +* Imparting contextual information in handlers:: +* Logging to a single file from multiple processes:: +* Using file rotation:: +* Use of alternative formatting styles:: +* Customizing LogRecord:: +* Subclassing QueueHandler and QueueListener- a ZeroMQ example:: +* Subclassing QueueHandler and QueueListener- a pynng example:: +* An example dictionary-based configuration:: +* Using a rotator and namer to customize log rotation processing:: +* A more elaborate multiprocessing example:: +* Inserting a BOM into messages sent to a SysLogHandler:: +* Implementing structured logging:: +* Customizing handlers with dictConfig(): Customizing handlers with dictConfig. +* Using particular formatting styles throughout your application:: +* Configuring filters with dictConfig(): Configuring filters with dictConfig. +* Customized exception formatting:: +* Speaking logging messages:: +* Buffering logging messages and outputting them conditionally:: +* Sending logging messages to email, with buffering: Sending logging messages to email with buffering. +* Formatting times using UTC (GMT) via configuration: Formatting times using UTC GMT via configuration. +* Using a context manager for selective logging:: +* A CLI application starter template:: +* A Qt GUI for logging:: +* Logging to syslog with RFC5424 support:: +* How to treat a logger like an output stream:: +* How to uniformly handle newlines in logging output:: +* Patterns to avoid:: +* Other resources: Other resources<2>. + + +File: python.info, Node: Using logging in multiple modules, Next: Logging from multiple threads, Up: Logging Cookbook + +9.9.1 Using logging in multiple modules +--------------------------------------- + +Multiple calls to ‘logging.getLogger('someLogger')’ return a reference +to the same logger object. This is true not only within the same +module, but also across modules as long as it is in the same Python +interpreter process. It is true for references to the same object; +additionally, application code can define and configure a parent logger +in one module and create (but not configure) a child logger in a +separate module, and all logger calls to the child will pass up to the +parent. Here is a main module: + + 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()') + +Here is the 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"') + +The output looks like this: + + 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: Logging from multiple threads, Next: Multiple handlers and formatters, Prev: Using logging in multiple modules, Up: Logging Cookbook + +9.9.2 Logging from multiple threads +----------------------------------- + +Logging from multiple threads requires no special effort. The following +example shows logging from the main (initial) thread and another thread: + + 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() + +When run, the script should print something like the following: + + 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 + +This shows the logging output interspersed as one might expect. This +approach works for more threads than shown here, of course. + + +File: python.info, Node: Multiple handlers and formatters, Next: Logging to multiple destinations, Prev: Logging from multiple threads, Up: Logging Cookbook + +9.9.3 Multiple handlers and formatters +-------------------------------------- + +Loggers are plain Python objects. The *note addHandler(): 2c68. method +has no minimum or maximum quota for the number of handlers you may add. +Sometimes it will be beneficial for an application to log all messages +of all severities to a text file while simultaneously logging errors or +above to the console. To set this up, simply configure the appropriate +handlers. The logging calls in the application code will remain +unchanged. Here is a slight modification to the previous simple +module-based configuration example: + + 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') + +Notice that the ‘application’ code does not care about multiple +handlers. All that changed was the addition and configuration of a new +handler named 'fh'. + +The ability to create new handlers with higher- or lower-severity +filters can be very helpful when writing and testing an application. +Instead of using many ‘print’ statements for debugging, use +‘logger.debug’: Unlike the print statements, which you will have to +delete or comment out later, the logger.debug statements can remain +intact in the source code and remain dormant until you need them again. +At that time, the only change that needs to happen is to modify the +severity level of the logger and/or handler to debug. + + +File: python.info, Node: Logging to multiple destinations, Next: Custom handling of levels, Prev: Multiple handlers and formatters, Up: Logging Cookbook + +9.9.4 Logging to multiple destinations +-------------------------------------- + +Let’s say you want to log to console and file with different message +formats and in differing circumstances. Say you want to log messages +with levels of DEBUG and higher to file, and those messages at level +INFO and higher to the console. Let’s also assume that the file should +contain timestamps, but the console messages should not. Here’s how you +can achieve this: + + 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.') + +When you run this, on the console you will see + + 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. + +and in the file you will see something like + + 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. + +As you can see, the DEBUG message only shows up in the file. The other +messages are sent to both destinations. + +This example uses console and file handlers, but you can use any number +and combination of handlers you choose. + +Note that the above choice of log filename ‘/tmp/myapp.log’ implies use +of a standard location for temporary files on POSIX systems. On +Windows, you may need to choose a different directory name for the log - +just ensure that the directory exists and that you have the permissions +to create and update files in it. + + +File: python.info, Node: Custom handling of levels, Next: Configuration server example, Prev: Logging to multiple destinations, Up: Logging Cookbook + +9.9.5 Custom handling of levels +------------------------------- + +Sometimes, you might want to do something slightly different from the +standard handling of levels in handlers, where all levels above a +threshold get processed by a handler. To do this, you need to use +filters. Let’s look at a scenario where you want to arrange things as +follows: + + * Send messages of severity ‘INFO’ and ‘WARNING’ to ‘sys.stdout’ + + * Send messages of severity ‘ERROR’ and above to ‘sys.stderr’ + + * Send messages of severity ‘DEBUG’ and above to file ‘app.log’ + +Suppose you configure logging with the following 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" + } + } + } + +and changing the section on the ‘stdout’ handler to add it: + + { + "stdout": { + "class": "logging.StreamHandler", + "level": "INFO", + "formatter": "simple", + "stream": "ext://sys.stdout", + "filters": ["warnings_and_below"] + } + } + +A filter is just a function, so we can define the ‘filter_maker’ (a +factory function) as follows: + + def filter_maker(level): + level = getattr(logging, level) + + def filter(record): + return record.levelno <= level + + return filter + +This converts the string argument passed in to a numeric level, and +returns a function which only returns ‘True’ if the level of the passed +in record is at or below the specified level. Note that in this example +I have defined the ‘filter_maker’ in a test script ‘main.py’ that I run +from the command line, so its module will be ‘__main__’ - hence the +‘__main__.filter_maker’ in the filter configuration. You will need to +change that if you define it in a different module. + +With the filter added, we can run ‘main.py’, which in full is: + + 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') + +And after running it like this: + + python main.py 2>stderr.log >stdout.log + +We can see the results are as expected: + + $ 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: Configuration server example, Next: Dealing with handlers that block, Prev: Custom handling of levels, Up: Logging Cookbook + +9.9.6 Configuration server example +---------------------------------- + +Here is an example of a module using the logging configuration server: + + 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() + +And here is a script that takes a filename and sends that file to the +server, properly preceded with the binary-encoded length, as the new +logging configuration: + + #!/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: Dealing with handlers that block, Next: Sending and receiving logging events across a network, Prev: Configuration server example, Up: Logging Cookbook + +9.9.7 Dealing with handlers that block +-------------------------------------- + +Sometimes you have to get your logging handlers to do their work without +blocking the thread you’re logging from. This is common in web +applications, though of course it also occurs in other scenarios. + +A common culprit which demonstrates sluggish behaviour is the *note +SMTPHandler: 1568.: sending emails can take a long time, for a number of +reasons outside the developer’s control (for example, a poorly +performing mail or network infrastructure). But almost any +network-based handler can block: Even a *note SocketHandler: f5d. +operation may do a DNS query under the hood which is too slow (and this +query can be deep in the socket library code, below the Python layer, +and outside your control). + +One solution is to use a two-part approach. For the first part, attach +only a *note QueueHandler: 17d7. to those loggers which are accessed +from performance-critical threads. They simply write to their queue, +which can be sized to a large enough capacity or initialized with no +upper bound to their size. The write to the queue will typically be +accepted quickly, though you will probably need to catch the *note +queue.Full: 3158. exception as a precaution in your code. If you are a +library developer who has performance-critical threads in their code, be +sure to document this (together with a suggestion to attach only +‘QueueHandlers’ to your loggers) for the benefit of other developers who +will use your code. + +The second part of the solution is *note QueueListener: e2b, which has +been designed as the counterpart to *note QueueHandler: 17d7. A *note +QueueListener: e2b. is very simple: it’s passed a queue and some +handlers, and it fires up an internal thread which listens to its queue +for LogRecords sent from ‘QueueHandlers’ (or any other source of +‘LogRecords’, for that matter). The ‘LogRecords’ are removed from the +queue and passed to the handlers for processing. + +The advantage of having a separate *note QueueListener: e2b. class is +that you can use the same instance to service multiple ‘QueueHandlers’. +This is more resource-friendly than, say, having threaded versions of +the existing handler classes, which would eat up one thread per handler +for no particular benefit. + +An example of using these two classes follows (imports omitted): + + 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() + +which, when run, will produce: + + MainThread: Look out! + + Note: Although the earlier discussion wasn’t specifically talking + about async code, but rather about slow logging handlers, it should + be noted that when logging from async code, network and even file + handlers could lead to problems (blocking the event loop) because + some logging is done from *note asyncio: a. internals. It might be + best, if any async code is used in an application, to use the above + approach for logging, so that any blocking code runs only in the + ‘QueueListener’ thread. + +Changed in version 3.5: Prior to Python 3.5, the *note QueueListener: +e2b. always passed every message received from the queue to every +handler it was initialized with. (This was because it was assumed that +level filtering was all done on the other side, where the queue is +filled.) From 3.5 onwards, this behaviour can be changed by passing a +keyword argument ‘respect_handler_level=True’ to the listener’s +constructor. When this is done, the listener compares the level of each +message with the handler’s level, and only passes a message to a handler +if it’s appropriate to do so. + + +File: python.info, Node: Sending and receiving logging events across a network, Next: Adding contextual information to your logging output, Prev: Dealing with handlers that block, Up: Logging Cookbook + +9.9.8 Sending and receiving logging events across a network +----------------------------------------------------------- + +Let’s say you want to send logging events across a network, and handle +them at the receiving end. A simple way of doing this is attaching a +*note SocketHandler: f5d. instance to the root logger at the sending +end: + + 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.') + +At the receiving end, you can set up a receiver using the *note +socketserver: cd. module. Here is a basic working example: + + 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() + +First run the server, and then the client. On the client side, nothing +is printed on the console; on the server side, you should see something +like: + + 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. + +Note that there are some security issues with pickle in some scenarios. +If these affect you, you can use an alternative serialization scheme by +overriding the *note makePickle(): 2d06. method and implementing your +alternative there, as well as adapting the above script to use your +alternative serialization. + +* Menu: + +* Running a logging socket listener in production:: + + +File: python.info, Node: Running a logging socket listener in production, Up: Sending and receiving logging events across a network + +9.9.8.1 Running a logging socket listener in production +....................................................... + +To run a logging listener in production, you may need to use a +process-management tool such as Supervisor(1). Here is a Gist(2) which +provides the bare-bones files to run the above functionality using +Supervisor. It consists of the following files: + +File Purpose + +--------------------------------------------------------------------------------------- + +‘prepare.sh’ A Bash script to prepare the environment for testing + + +‘supervisor.conf’ The Supervisor configuration file, which has entries + for the listener and a multi-process web application + + +‘ensure_app.sh’ A Bash script to ensure that Supervisor is running + with the above configuration + + +‘log_listener.py’ The socket listener program which receives log events + and records them to a file + + +‘main.py’ A simple web application which performs logging via a + socket connected to the listener + + +‘webapp.json’ A JSON configuration file for the web application + + +‘client.py’ A Python script to exercise the web application + + +The web application uses Gunicorn(3), which is a popular web application +server that starts multiple worker processes to handle requests. This +example setup shows how the workers can write to the same log file +without conflicting with one another — they all go through the socket +listener. + +To test these files, do the following in a POSIX environment: + + 1. Download the Gist(4) as a ZIP archive using the Download ZIP + button. + + 2. Unzip the above files from the archive into a scratch directory. + + 3. In the scratch directory, run ‘bash prepare.sh’ to get things + ready. This creates a ‘run’ subdirectory to contain + Supervisor-related and log files, and a ‘venv’ subdirectory to + contain a virtual environment into which ‘bottle’, ‘gunicorn’ and + ‘supervisor’ are installed. + + 4. Run ‘bash ensure_app.sh’ to ensure that Supervisor is running with + the above configuration. + + 5. Run ‘venv/bin/python client.py’ to exercise the web application, + which will lead to records being written to the log. + + 6. Inspect the log files in the ‘run’ subdirectory. You should see + the most recent log lines in files matching the pattern ‘app.log*’. + They won’t be in any particular order, since they have been handled + concurrently by different worker processes in a non-deterministic + way. + + 7. You can shut down the listener and the web application by running + ‘venv/bin/supervisorctl -c supervisor.conf shutdown’. + +You may need to tweak the configuration files in the unlikely event that +the configured ports clash with something else in your test environment. + +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: Adding contextual information to your logging output, Next: Use of contextvars, Prev: Sending and receiving logging events across a network, Up: Logging Cookbook + +9.9.9 Adding contextual information to your logging output +---------------------------------------------------------- + +Sometimes you want logging output to contain contextual information in +addition to the parameters passed to the logging call. For example, in +a networked application, it may be desirable to log client-specific +information in the log (e.g. remote client’s username, or IP address). +Although you could use the 'extra' parameter to achieve this, it’s not +always convenient to pass the information in this way. While it might +be tempting to create *note Logger: b4f. instances on a per-connection +basis, this is not a good idea because these instances are not garbage +collected. While this is not a problem in practice, when the number of +*note Logger: b4f. instances is dependent on the level of granularity +you want to use in logging an application, it could be hard to manage if +the number of *note Logger: b4f. instances becomes effectively +unbounded. + +* Menu: + +* Using LoggerAdapters to impart contextual information:: +* Using Filters to impart contextual information:: + + +File: python.info, Node: Using LoggerAdapters to impart contextual information, Next: Using Filters to impart contextual information, Up: Adding contextual information to your logging output + +9.9.9.1 Using LoggerAdapters to impart contextual information +............................................................. + +An easy way in which you can pass contextual information to be output +along with logging event information is to use the *note LoggerAdapter: +12e8. class. This class is designed to look like a *note Logger: b4f, +so that you can call *note debug(): 2c6f, *note info(): 2c98, *note +warning(): 2f9, *note error(): 2cac, *note exception(): 145b, *note +critical(): 2cad. and *note log(): 2cae. These methods have the same +signatures as their counterparts in *note Logger: b4f, so you can use +the two types of instances interchangeably. + +When you create an instance of *note LoggerAdapter: 12e8, you pass it a +*note Logger: b4f. instance and a dict-like object which contains your +contextual information. When you call one of the logging methods on an +instance of *note LoggerAdapter: 12e8, it delegates the call to the +underlying instance of *note Logger: b4f. passed to its constructor, and +arranges to pass the contextual information in the delegated call. +Here’s a snippet from the code of *note LoggerAdapter: 12e8.: + + 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) + +The *note process(): 2ca5. method of *note LoggerAdapter: 12e8. is where +the contextual information is added to the logging output. It’s passed +the message and keyword arguments of the logging call, and it passes +back (potentially) modified versions of these to use in the call to the +underlying logger. The default implementation of this method leaves the +message alone, but inserts an ‘extra’ key in the keyword argument whose +value is the dict-like object passed to the constructor. Of course, if +you had passed an ‘extra’ keyword argument in the call to the adapter, +it will be silently overwritten. + +The advantage of using ‘extra’ is that the values in the dict-like +object are merged into the *note LogRecord: fe1. instance’s __dict__, +allowing you to use customized strings with your *note Formatter: 145e. +instances which know about the keys of the dict-like object. If you +need a different method, e.g. if you want to prepend or append the +contextual information to the message string, you just need to subclass +*note LoggerAdapter: 12e8. and override *note process(): 2ca5. to do +what you need. Here is a simple example: + + 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 + +which you can use like this: + + logger = logging.getLogger(__name__) + adapter = CustomAdapter(logger, {'connid': some_conn_id}) + +Then any events that you log to the adapter will have the value of +‘some_conn_id’ prepended to the log messages. + +* Menu: + +* Using objects other than dicts to pass contextual information:: + + +File: python.info, Node: Using objects other than dicts to pass contextual information, Up: Using LoggerAdapters to impart contextual information + +9.9.9.2 Using objects other than dicts to pass contextual information +..................................................................... + +You don’t need to pass an actual dict to a *note LoggerAdapter: 12e8. - +you could pass an instance of a class which implements ‘__getitem__’ and +‘__iter__’ so that it looks like a dict to logging. This would be +useful if you want to generate values dynamically (whereas the values in +a dict would be constant). + + +File: python.info, Node: Using Filters to impart contextual information, Prev: Using LoggerAdapters to impart contextual information, Up: Adding contextual information to your logging output + +9.9.9.3 Using Filters to impart contextual information +...................................................... + +You can also add contextual information to log output using a +user-defined *note Filter: 11ed. ‘Filter’ instances are allowed to +modify the ‘LogRecords’ passed to them, including adding additional +attributes which can then be output using a suitable format string, or +if needed a custom *note Formatter: 145e. + +For example in a web application, the request being processed (or at +least, the interesting parts of it) can be stored in a threadlocal +(*note threading.local: 154e.) variable, and then accessed from a +‘Filter’ to add, say, information from the request - say, the remote IP +address and remote user’s username - to the ‘LogRecord’, using the +attribute names ‘ip’ and ‘user’ as in the ‘LoggerAdapter’ example above. +In that case, the same format string can be used to get similar output +to that shown above. Here’s an example script: + + 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') + +which, when run, produces something like: + + 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: Use of contextvars, Next: Imparting contextual information in handlers, Prev: Adding contextual information to your logging output, Up: Logging Cookbook + +9.9.10 Use of ‘contextvars’ +--------------------------- + +Since Python 3.7, the *note contextvars: 24. module has provided +context-local storage which works for both *note threading: ed. and +*note asyncio: a. processing needs. This type of storage may thus be +generally preferable to thread-locals. The following example shows how, +in a multi-threaded environment, logs can populated with contextual +information such as, for example, request attributes handled by web +applications. + +For the purposes of illustration, say that you have different web +applications, each independent of the other but running in the same +Python process and using a library common to them. How can each of +these applications have their own log, where all logging messages from +the library (and other request processing code) are directed to the +appropriate application’s log file, while including in the log +additional contextual information such as client IP, HTTP request method +and client username? + +Let’s assume that the library can be simulated by the following code: + + # 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) + +We can simulate the multiple web applications by means of two simple +classes, ‘Request’ and ‘WebApp’. These simulate how real threaded web +applications work - each request is handled by a thread: + + # 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() + +If you run the above, you should find that roughly half the requests go +into ‘app1.log’ and the rest into ‘app2.log’, and the all the requests +are logged to ‘app.log’. Each webapp-specific log will contain only log +entries for only that webapp, and the request information will be +displayed consistently in the log (i.e. the information in each dummy +request will always appear together in a log line). This is illustrated +by the following shell output: + + ~/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: Imparting contextual information in handlers, Next: Logging to a single file from multiple processes, Prev: Use of contextvars, Up: Logging Cookbook + +9.9.11 Imparting contextual information in handlers +--------------------------------------------------- + +Each *note Handler: 145d. has its own chain of filters. If you want to +add contextual information to a *note LogRecord: fe1. without leaking it +to other handlers, you can use a filter that returns a new *note +LogRecord: fe1. instead of modifying it in-place, as shown in the +following script: + + 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: Logging to a single file from multiple processes, Next: Using file rotation, Prev: Imparting contextual information in handlers, Up: Logging Cookbook + +9.9.12 Logging to a single file from multiple processes +------------------------------------------------------- + +Although logging is thread-safe, and logging to a single file from +multiple threads in a single process 'is' supported, logging to a single +file from 'multiple processes' is 'not' supported, because there is no +standard way to serialize access to a single file across multiple +processes in Python. If you need to log to a single file from multiple +processes, one way of doing this is to have all the processes log to a +*note SocketHandler: f5d, and have a separate process which implements a +socket server which reads from the socket and logs to file. (If you +prefer, you can dedicate one thread in one of the existing processes to +perform this function.) *note This section: 4fb7. documents this +approach in more detail and includes a working socket receiver which can +be used as a starting point for you to adapt in your own applications. + +You could also write your own handler which uses the *note Lock: 159c. +class from the *note multiprocessing: 94. module to serialize access to +the file from your processes. The stdlib *note FileHandler: 189e. and +subclasses do not make use of *note multiprocessing: 94. + +Alternatively, you can use a ‘Queue’ and a *note QueueHandler: 17d7. to +send all logging events to one of the processes in your multi-process +application. The following example script demonstrates how you can do +this; in the example a separate listener process listens for events sent +by other processes and logs them according to its own logging +configuration. Although the example only demonstrates one way of doing +it (for example, you may want to use a listener thread rather than a +separate listener process – the implementation would be analogous) it +does allow for completely different logging configurations for the +listener and the other processes in your application, and can be used as +the basis for code meeting your own specific requirements: + + # 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() + +A variant of the above script keeps the logging in the main process, in +a separate thread: + + 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() + +This variant shows how you can e.g. apply configuration for particular +loggers - e.g. the ‘foo’ logger has a special handler which stores all +events in the ‘foo’ subsystem in a file ‘mplog-foo.log’. This will be +used by the logging machinery in the main process (even though the +logging events are generated in the worker processes) to direct the +messages to the appropriate destinations. + +* Menu: + +* Using concurrent.futures.ProcessPoolExecutor: Using concurrent futures ProcessPoolExecutor. +* Deploying Web applications using Gunicorn and uWSGI:: + + +File: python.info, Node: Using concurrent futures ProcessPoolExecutor, Next: Deploying Web applications using Gunicorn and uWSGI, Up: Logging to a single file from multiple processes + +9.9.12.1 Using concurrent.futures.ProcessPoolExecutor +..................................................... + +If you want to use *note concurrent.futures.ProcessPoolExecutor: 8ed. to +start your worker processes, you need to create the queue slightly +differently. Instead of + + queue = multiprocessing.Queue(-1) + +you should use + + queue = multiprocessing.Manager().Queue(-1) # also works with the examples above + +and you can then replace the worker creation from this: + + 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() + +to this (remembering to first import *note concurrent.futures: 21.): + + 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: Using concurrent futures ProcessPoolExecutor, Up: Logging to a single file from multiple processes + +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: +f5d. 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: +4fb9. for more details. + + ---------- Footnotes ---------- + + (1) https://gunicorn.org/ + + (2) https://uwsgi-docs.readthedocs.io/en/latest/ + + +File: python.info, Node: Using file rotation, Next: Use of alternative formatting styles, Prev: Logging to a single file from multiple processes, Up: Logging Cookbook + +9.9.13 Using file rotation +-------------------------- + +Sometimes you want to let a log file grow to a certain size, then open a +new file and log to that. You may want to keep a certain number of +these files, and when that many files have been created, rotate the +files so that the number of files and the size of the files both remain +bounded. For this usage pattern, the logging package provides a *note +RotatingFileHandler: 15d9.: + + 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) + +The result should be 6 separate files, each with part of the log history +for the application: + + 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 + +The most current file is always ‘logging_rotatingfile_example.out’, and +each time it reaches the size limit it is renamed with the suffix ‘.1’. +Each of the existing backup files is renamed to increment the suffix +(‘.1’ becomes ‘.2’, etc.) and the ‘.6’ file is erased. + +Obviously this example sets the log length much too small as an extreme +example. You would want to set 'maxBytes' to an appropriate value. + + +File: python.info, Node: Use of alternative formatting styles, Next: Customizing LogRecord, Prev: Using file rotation, Up: Logging Cookbook + +9.9.14 Use of alternative formatting styles +------------------------------------------- + +When logging was added to the Python standard library, the only way of +formatting messages with variable content was to use the %-formatting +method. Since then, Python has gained two new formatting approaches: +*note string.Template: 683. (added in Python 2.4) and *note +str.format(): 61d. (added in Python 2.6). + +Logging (as of 3.2) provides improved support for these two additional +formatting styles. The *note Formatter: 145e. class been enhanced to +take an additional, optional keyword parameter named ‘style’. This +defaults to ‘'%'’, but other possible values are ‘'{'’ and ‘'$'’, which +correspond to the other two formatting styles. Backwards compatibility +is maintained by default (as you would expect), but by explicitly +specifying a style parameter, you get the ability to specify format +strings which work with *note str.format(): 61d. or *note +string.Template: 683. Here’s an example console session to show the +possibilities: + + >>> 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 + >>> + +Note that the formatting of logging messages for final output to logs is +completely independent of how an individual logging message is +constructed. That can still use %-formatting, as shown here: + + >>> 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 calls (‘logger.debug()’, ‘logger.info()’ etc.) only take +positional parameters for the actual logging message itself, with +keyword parameters used only for determining options for how to handle +the actual logging call (e.g. the ‘exc_info’ keyword parameter to +indicate that traceback information should be logged, or the ‘extra’ +keyword parameter to indicate additional contextual information to be +added to the log). So you cannot directly make logging calls using +*note str.format(): 61d. or *note string.Template: 683. syntax, because +internally the logging package uses %-formatting to merge the format +string and the variable arguments. There would be no changing this +while preserving backward compatibility, since all logging calls which +are out there in existing code will be using %-format strings. + +There is, however, a way that you can use {}- and $- formatting to +construct your individual log messages. Recall that for a message you +can use an arbitrary object as a message format string, and that the +logging package will call ‘str()’ on that object to get the actual +format string. Consider the following two classes: + + 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) + +Either of these can be used in place of a format string, to allow {}- or +$-formatting to be used to build the actual “message” part which appears +in the formatted log output in place of “%(message)s” or “{message}” or +“$message”. It’s a little unwieldy to use the class names whenever you +want to log something, but it’s quite palatable if you use an alias such +as __ (double underscore — not to be confused with _, the single +underscore used as a synonym/alias for *note gettext.gettext(): 1432. or +its brethren). + +The above classes are not included in Python, though they’re easy enough +to copy and paste into your own code. They can be used as follows +(assuming that they’re declared in a module called ‘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 + >>> + +While the above examples use ‘print()’ to show how the formatting works, +you would of course use ‘logger.debug()’ or similar to actually log +using this approach. + +One thing to note is that you pay no significant performance penalty +with this approach: the actual formatting happens not when you make the +logging call, but when (and if) the logged message is actually about to +be output to a log by a handler. So the only slightly unusual thing +which might trip you up is that the parentheses go around the format +string and the arguments, not just the format string. That’s because +the __ notation is just syntax sugar for a constructor call to one of +the ‘XXXMessage’ classes. + +If you prefer, you can use a *note LoggerAdapter: 12e8. to achieve a +similar effect to the above, as in the following example: + + 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() + +The above script should log the message ‘Hello, world!’ when run with +Python 3.8 or later. + + +File: python.info, Node: Customizing LogRecord, Next: Subclassing QueueHandler and QueueListener- a ZeroMQ example, Prev: Use of alternative formatting styles, Up: Logging Cookbook + +9.9.15 Customizing ‘LogRecord’ +------------------------------ + +Every logging event is represented by a *note LogRecord: fe1. instance. +When an event is logged and not filtered out by a logger’s level, a +*note LogRecord: fe1. is created, populated with information about the +event and then passed to the handlers for that logger (and its +ancestors, up to and including the logger where further propagation up +the hierarchy is disabled). Before Python 3.2, there were only two +places where this creation was done: + + * *note Logger.makeRecord(): 2c76, which is called in the normal + process of logging an event. This invoked *note LogRecord: fe1. + directly to create an instance. + + * *note makeLogRecord(): 2c9c, which is called with a dictionary + containing attributes to be added to the LogRecord. This is + typically invoked when a suitable dictionary has been received over + the network (e.g. in pickle form via a *note SocketHandler: f5d, + or in JSON form via an *note HTTPHandler: e2a.). + +This has usually meant that if you need to do anything special with a +*note LogRecord: fe1, you’ve had to do one of the following. + + * Create your own *note Logger: b4f. subclass, which overrides *note + Logger.makeRecord(): 2c76, and set it using *note setLoggerClass(): + 2cab. before any loggers that you care about are instantiated. + + * Add a *note Filter: 11ed. to a logger or handler, which does the + necessary special manipulation you need when its *note filter(): + 2c97. method is called. + +The first approach would be a little unwieldy in the scenario where +(say) several different libraries wanted to do different things. Each +would attempt to set its own *note Logger: b4f. subclass, and the one +which did this last would win. + +The second approach works reasonably well for many cases, but does not +allow you to e.g. use a specialized subclass of *note LogRecord: fe1. +Library developers can set a suitable filter on their loggers, but they +would have to remember to do this every time they introduced a new +logger (which they would do simply by adding new packages or modules and +doing + + logger = logging.getLogger(__name__) + +at module level). It’s probably one too many things to think about. +Developers could also add the filter to a *note NullHandler: 1277. +attached to their top-level logger, but this would not be invoked if an +application developer attached a handler to a lower-level library logger +— so output from that handler would not reflect the intentions of the +library developer. + +In Python 3.2 and later, *note LogRecord: fe1. creation is done through +a factory, which you can specify. The factory is just a callable you +can set with *note setLogRecordFactory(): 2ca0, and interrogate with +*note getLogRecordFactory(): 2c9f. The factory is invoked with the same +signature as the *note LogRecord: fe1. constructor, as *note LogRecord: +fe1. is the default setting for the factory. + +This approach allows a custom factory to control all aspects of +LogRecord creation. For example, you could return a subclass, or just +add some additional attributes to the record once created, using a +pattern similar to this: + + old_factory = logging.getLogRecordFactory() + + def record_factory(*args, **kwargs): + record = old_factory(*args, **kwargs) + record.custom_attribute = 0xdecafbad + return record + + logging.setLogRecordFactory(record_factory) + +This pattern allows different libraries to chain factories together, and +as long as they don’t overwrite each other’s attributes or +unintentionally overwrite the attributes provided as standard, there +should be no surprises. However, it should be borne in mind that each +link in the chain adds run-time overhead to all logging operations, and +the technique should only be used when the use of a *note Filter: 11ed. +does not provide the desired result. + + +File: python.info, Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example, Next: Subclassing QueueHandler and QueueListener- a pynng example, Prev: Customizing LogRecord, Up: Logging Cookbook + +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’ +................................ + +You can use a *note QueueHandler: 17d7. subclass to send messages to +other kinds of queues, for example a ZeroMQ ‘publish’ socket. In the +example below,the socket is created separately and passed to the handler +(as its ‘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) + +Of course there are other ways of organizing this, for example passing +in the data needed by the handler to create the socket: + + 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’ +................................. + +You can also subclass *note QueueListener: e2b. to get messages from +other kinds of queues, for example a ZeroMQ ‘subscribe’ socket. Here’s +an example: + + 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: An example dictionary-based configuration, Prev: Subclassing QueueHandler and QueueListener- a ZeroMQ example, Up: Logging Cookbook + +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: An example dictionary-based configuration, Next: Using a rotator and namer to customize log rotation processing, Prev: Subclassing QueueHandler and QueueListener- a pynng example, Up: Logging Cookbook + +9.9.18 An example dictionary-based configuration +------------------------------------------------ + +Below is an example of a logging configuration dictionary - it’s taken +from the documentation on the Django project(1). This dictionary is +passed to *note dictConfig(): 11a2. to put the configuration into +effect: + + 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'] + } + } + } + +For more information about this configuration, you can see the relevant +section(2) of the Django documentation. + + ---------- 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: Using a rotator and namer to customize log rotation processing, Next: A more elaborate multiprocessing example, Prev: An example dictionary-based configuration, Up: Logging Cookbook + +9.9.19 Using a rotator and namer to customize log rotation processing +--------------------------------------------------------------------- + +An example of how you can define a namer and rotator is given in the +following runnable script, which shows gzip compression of the log file: + + 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}') + +After running this, you will see six new files, five of which are +compressed: + + $ 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: A more elaborate multiprocessing example, Next: Inserting a BOM into messages sent to a SysLogHandler, Prev: Using a rotator and namer to customize log rotation processing, Up: Logging Cookbook + +9.9.20 A more elaborate multiprocessing example +----------------------------------------------- + +The following working example shows how logging can be used with +multiprocessing using configuration files. The configurations are +fairly simple, but serve to illustrate how more complex ones could be +implemented in a real multiprocessing scenario. + +In the example, the main process spawns a listener process and some +worker processes. Each of the main process, the listener and the +workers have three separate configurations (the workers all share the +same configuration). We can see logging in the main process, how the +workers log to a QueueHandler and how the listener implements a +QueueListener and a more complex logging configuration, and arranges to +dispatch events received via the queue to the handlers specified in the +configuration. Note that these configurations are purely illustrative, +but you should be able to adapt this example to your own scenario. + +Here’s the script - the docstrings and the comments hopefully explain +how it works: + + 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: Inserting a BOM into messages sent to a SysLogHandler, Next: Implementing structured logging, Prev: A more elaborate multiprocessing example, Up: Logging Cookbook + +9.9.21 Inserting a BOM into messages sent to a SysLogHandler +------------------------------------------------------------ + +RFC 5424(1) requires that a Unicode message be sent to a syslog daemon +as a set of bytes which have the following structure: an optional +pure-ASCII component, followed by a UTF-8 Byte Order Mark (BOM), +followed by Unicode encoded using UTF-8. (See the relevant section of +the specification(2).) + +In Python 3.1, code was added to *note SysLogHandler: 658. to insert a +BOM into the message, but unfortunately, it was implemented incorrectly, +with the BOM appearing at the beginning of the message and hence not +allowing any pure-ASCII component to appear before it. + +As this behaviour is broken, the incorrect BOM insertion code is being +removed from Python 3.2.4 and later. However, it is not being replaced, +and if you want to produce RFC 5424(3)-compliant messages which include +a BOM, an optional pure-ASCII sequence before it and arbitrary Unicode +after it, encoded using UTF-8, then you need to do the following: + + 1. Attach a *note Formatter: 145e. instance to your *note + SysLogHandler: 658. instance, with a format string such as: + + 'ASCII section\ufeffUnicode section' + + The Unicode code point U+FEFF, when encoded using UTF-8, will be + encoded as a UTF-8 BOM – the byte-string ‘b'\xef\xbb\xbf'’. + + 2. Replace the ASCII section with whatever placeholders you like, but + make sure that the data that appears in there after substitution is + always ASCII (that way, it will remain unchanged after UTF-8 + encoding). + + 3. Replace the Unicode section with whatever placeholders you like; if + the data which appears there after substitution contains characters + outside the ASCII range, that’s fine – it will be encoded using + UTF-8. + +The formatted message 'will' be encoded using UTF-8 encoding by +‘SysLogHandler’. If you follow the above rules, you should be able to +produce RFC 5424(4)-compliant messages. If you don’t, logging may not +complain, but your messages will not be RFC 5424-compliant, and your +syslog daemon may complain. + + ---------- 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: Implementing structured logging, Next: Customizing handlers with dictConfig, Prev: Inserting a BOM into messages sent to a SysLogHandler, Up: Logging Cookbook + +9.9.22 Implementing structured logging +-------------------------------------- + +Although most logging messages are intended for reading by humans, and +thus not readily machine-parseable, there might be circumstances where +you want to output messages in a structured format which 'is' capable of +being parsed by a program (without needing complex regular expressions +to parse the log message). This is straightforward to achieve using the +logging package. There are a number of ways in which this could be +achieved, but the following is a simple approach which uses JSON to +serialise the event in a machine-parseable manner: + + 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)) + +If the above script is run, it prints: + + message 1 >>> {"fnum": 123.456, "num": 123, "bar": "baz", "foo": "bar"} + +Note that the order of items might be different according to the version +of Python used. + +If you need more specialised processing, you can use a custom JSON +encoder, as in the following complete example: + + 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() + +When the above script is run, it prints: + + message 1 >>> {"snowman": "\u2603", "set_value": [1, 2, 3]} + +Note that the order of items might be different according to the version +of Python used. + + +File: python.info, Node: Customizing handlers with dictConfig, Next: Using particular formatting styles throughout your application, Prev: Implementing structured logging, Up: Logging Cookbook + +9.9.23 Customizing handlers with ‘dictConfig()’ +----------------------------------------------- + +There are times when you want to customize logging handlers in +particular ways, and if you use *note dictConfig(): 11a2. you may be +able to do this without subclassing. As an example, consider that you +may want to set the ownership of a log file. On POSIX, this is easily +done using *note shutil.chown(): 242, but the file handlers in the +stdlib don’t offer built-in support. You can customize handler creation +using a plain function such as: + + 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) + +You can then specify, in a logging configuration passed to *note +dictConfig(): 11a2, that a logging handler be created by calling this +function: + + 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', + }, + } + +In this example I am setting the ownership using the ‘pulse’ user and +group, just for the purposes of illustration. Putting it together into +a working script, ‘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') + +To run this, you will probably need to run as ‘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 that this example uses Python 3.3 because that’s where *note +shutil.chown(): 242. makes an appearance. This approach should work +with any Python version that supports *note dictConfig(): 11a2. - +namely, Python 2.7, 3.2 or later. With pre-3.3 versions, you would need +to implement the actual ownership change using e.g. *note os.chown(): +10e3. + +In practice, the handler-creating function may be in a utility module +somewhere in your project. Instead of the line in the configuration: + + '()': owned_file_handler, + +you could use e.g.: + + '()': 'ext://project.util.owned_file_handler', + +where ‘project.util’ can be replaced with the actual name of the package +where the function resides. In the above working script, using +‘'ext://__main__.owned_file_handler'’ should work. Here, the actual +callable is resolved by *note dictConfig(): 11a2. from the ‘ext://’ +specification. + +This example hopefully also points the way to how you could implement +other types of file change - e.g. setting specific POSIX permission +bits - in the same way, using *note os.chmod(): 21d. + +Of course, the approach could also be extended to types of handler other +than a *note FileHandler: 189e. - for example, one of the rotating file +handlers, or a different type of handler altogether. + + +File: python.info, Node: Using particular formatting styles throughout your application, Next: Configuring filters with dictConfig, Prev: Customizing handlers with dictConfig, Up: Logging Cookbook + +9.9.24 Using particular formatting styles throughout your application +--------------------------------------------------------------------- + +In Python 3.2, the *note Formatter: 145e. gained a ‘style’ keyword +parameter which, while defaulting to ‘%’ for backward compatibility, +allowed the specification of ‘{’ or ‘$’ to support the formatting +approaches supported by *note str.format(): 61d. and *note +string.Template: 683. Note that this governs the formatting of logging +messages for final output to logs, and is completely orthogonal to how +an individual logging message is constructed. + +Logging calls (*note debug(): e29, *note info(): 2c6e. etc.) only take +positional parameters for the actual logging message itself, with +keyword parameters used only for determining options for how to handle +the logging call (e.g. the ‘exc_info’ keyword parameter to indicate +that traceback information should be logged, or the ‘extra’ keyword +parameter to indicate additional contextual information to be added to +the log). So you cannot directly make logging calls using *note +str.format(): 61d. or *note string.Template: 683. syntax, because +internally the logging package uses %-formatting to merge the format +string and the variable arguments. There would be no changing this +while preserving backward compatibility, since all logging calls which +are out there in existing code will be using %-format strings. + +There have been suggestions to associate format styles with specific +loggers, but that approach also runs into backward compatibility +problems because any existing code could be using a given logger name +and using %-formatting. + +For logging to work interoperably between any third-party libraries and +your code, decisions about formatting need to be made at the level of +the individual logging call. This opens up a couple of ways in which +alternative formatting styles can be accommodated. + +* Menu: + +* Using LogRecord factories:: +* Using custom message objects:: + + +File: python.info, Node: Using LogRecord factories, Next: Using custom message objects, Up: Using particular formatting styles throughout your application + +9.9.24.1 Using LogRecord factories +.................................. + +In Python 3.2, along with the *note Formatter: 145e. changes mentioned +above, the logging package gained the ability to allow users to set +their own *note LogRecord: fe1. subclasses, using the *note +setLogRecordFactory(): 2ca0. function. You can use this to set your own +subclass of *note LogRecord: fe1, which does the Right Thing by +overriding the *note getMessage(): 2c9e. method. The base class +implementation of this method is where the ‘msg % args’ formatting +happens, and where you can substitute your alternate formatting; +however, you should be careful to support all formatting styles and +allow %-formatting as the default, to ensure interoperability with other +code. Care should also be taken to call ‘str(self.msg)’, just as the +base implementation does. + +Refer to the reference documentation on *note setLogRecordFactory(): +2ca0. and *note LogRecord: fe1. for more information. + + +File: python.info, Node: Using custom message objects, Prev: Using LogRecord factories, Up: Using particular formatting styles throughout your application + +9.9.24.2 Using custom message objects +..................................... + +There is another, perhaps simpler way that you can use {}- and $- +formatting to construct your individual log messages. You may recall +(from *note Using arbitrary objects as messages: 2c9d.) that when +logging you can use an arbitrary object as a message format string, and +that the logging package will call *note str(): 447. on that object to +get the actual format string. Consider the following two classes: + + 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) + +Either of these can be used in place of a format string, to allow {}- or +$-formatting to be used to build the actual “message” part which appears +in the formatted log output in place of “%(message)s” or “{message}” or +“$message”. If you find it a little unwieldy to use the class names +whenever you want to log something, you can make it more palatable if +you use an alias such as ‘M’ or ‘_’ for the message (or perhaps ‘__’, if +you are using ‘_’ for localization). + +Examples of this approach are given below. Firstly, formatting with +*note str.format(): 61d.: + + >>> __ = 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) + +Secondly, formatting with *note string.Template: 683.: + + >>> __ = DollarMessage + >>> print(__('Message with $num $what', num=2, what='placeholders')) + Message with 2 placeholders + >>> + +One thing to note is that you pay no significant performance penalty +with this approach: the actual formatting happens not when you make the +logging call, but when (and if) the logged message is actually about to +be output to a log by a handler. So the only slightly unusual thing +which might trip you up is that the parentheses go around the format +string and the arguments, not just the format string. That’s because +the __ notation is just syntax sugar for a constructor call to one of +the ‘XXXMessage’ classes shown above. + + +File: python.info, Node: Configuring filters with dictConfig, Next: Customized exception formatting, Prev: Using particular formatting styles throughout your application, Up: Logging Cookbook + +9.9.25 Configuring filters with ‘dictConfig()’ +---------------------------------------------- + +You 'can' configure filters using *note dictConfig(): 11a2, though it +might not be obvious at first glance how to do it (hence this recipe). +Since *note Filter: 11ed. is the only filter class included in the +standard library, and it is unlikely to cater to many requirements (it’s +only there as a base class), you will typically need to define your own +*note Filter: 11ed. subclass with an overridden *note filter(): 2c97. +method. To do this, specify the ‘()’ key in the configuration +dictionary for the filter, specifying a callable which will be used to +create the filter (a class is the most obvious, but you can provide any +callable which returns a *note Filter: 11ed. instance). Here is a +complete example: + + 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') + +This example shows how you can pass configuration data to the callable +which constructs the instance, in the form of keyword parameters. When +run, the above script will print: + + changed: hello + +which shows that the filter is working as configured. + +A couple of extra points to note: + + * If you can’t refer to the callable directly in the configuration + (e.g. if it lives in a different module, and you can’t import it + directly where the configuration dictionary is), you can use the + form ‘ext://...’ as described in *note Access to external objects: + 2ccc. For example, you could have used the text + ‘'ext://__main__.MyFilter'’ instead of ‘MyFilter’ in the above + example. + + * As well as for filters, this technique can also be used to + configure custom handlers and formatters. See *note User-defined + objects: 2cc0. for more information on how logging supports using + user-defined objects in its configuration, and see the other + cookbook recipe *note Customizing handlers with dictConfig(): 4fd6. + above. + + +File: python.info, Node: Customized exception formatting, Next: Speaking logging messages, Prev: Configuring filters with dictConfig, Up: Logging Cookbook + +9.9.26 Customized exception formatting +-------------------------------------- + +There might be times when you want to do customized exception formatting +- for argument’s sake, let’s say you want exactly one line per logged +event, even when exception information is present. You can do this with +a custom formatter class, as shown in the following example: + + 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() + +When run, this produces a file with exactly two lines: + + 28/01/2015 07:21:23|INFO|Sample message| + 28/01/2015 07:21:23|ERROR|ZeroDivisionError: integer division or modulo by zero|'Traceback (most recent call last):\n File "logtest7.py", line 30, in main\n x = 1 / 0\nZeroDivisionError: integer division or modulo by zero'| + +While the above treatment is simplistic, it points the way to how +exception information can be formatted to your liking. The *note +traceback: fe. module may be helpful for more specialized needs. + + +File: python.info, Node: Speaking logging messages, Next: Buffering logging messages and outputting them conditionally, Prev: Customized exception formatting, Up: Logging Cookbook + +9.9.27 Speaking logging messages +-------------------------------- + +There might be situations when it is desirable to have logging messages +rendered in an audible rather than a visible format. This is easy to do +if you have text-to-speech (TTS) functionality available in your system, +even if it doesn’t have a Python binding. Most TTS systems have a +command line program you can run, and this can be invoked from a handler +using *note subprocess: d6. It’s assumed here that TTS command line +programs won’t expect to interact with users or take a long time to +complete, and that the frequency of logged messages will be not so high +as to swamp the user with messages, and that it’s acceptable to have the +messages spoken one at a time rather than concurrently, The example +implementation below waits for one message to be spoken before the next +is processed, and this might cause other handlers to be kept waiting. +Here is a short example showing the approach, which assumes that the +‘espeak’ TTS package is available: + + 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()) + +When run, this script should say “Hello” and then “Goodbye” in a female +voice. + +The above approach can, of course, be adapted to other TTS systems and +even other systems altogether which can process messages via external +programs run from a command line. + + +File: python.info, Node: Buffering logging messages and outputting them conditionally, Next: Sending logging messages to email with buffering, Prev: Speaking logging messages, Up: Logging Cookbook + +9.9.28 Buffering logging messages and outputting them conditionally +------------------------------------------------------------------- + +There might be situations where you want to log messages in a temporary +area and only output them if a certain condition occurs. For example, +you may want to start logging debug events in a function, and if the +function completes without errors, you don’t want to clutter the log +with the collected debug information, but if there is an error, you want +all the debug information to be output as well as the error. + +Here is an example which shows how you could do this using a decorator +for your functions where you want logging to behave this way. It makes +use of the *note logging.handlers.MemoryHandler: 2ccf, which allows +buffering of logged events until some condition occurs, at which point +the buffered events are ‘flushed’ - passed to another handler (the +‘target’ handler) for processing. By default, the ‘MemoryHandler’ +flushed when its buffer gets filled up or an event whose level is +greater than or equal to a specified threshold is seen. You can use +this recipe with a more specialised subclass of ‘MemoryHandler’ if you +want custom flushing behavior. + +The example script has a simple function, ‘foo’, which just cycles +through all the logging levels, writing to ‘sys.stderr’ to say what +level it’s about to log at, and then actually logging a message at that +level. You can pass a parameter to ‘foo’ which, if true, will log at +ERROR and CRITICAL levels - otherwise, it only logs at DEBUG, INFO and +WARNING levels. + +The script just arranges to decorate ‘foo’ with a decorator which will +do the conditional logging that’s required. The decorator takes a +logger as a parameter and attaches a memory handler for the duration of +the call to the decorated function. The decorator can be additionally +parameterised using a target handler, a level at which flushing should +occur, and a capacity for the buffer (number of records buffered). +These default to a *note StreamHandler: 11ea. which writes to +‘sys.stderr’, ‘logging.ERROR’ and ‘100’ respectively. + +Here’s the script: + + 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) + +When this script is run, the following output should be observed: + + 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 + +As you can see, actual logging output only occurs when an event is +logged whose severity is ERROR or greater, but in that case, any +previous events at lower severities are also logged. + +You can of course use the conventional means of decoration: + + @log_if_errors(logger) + def foo(fail=False): + ... + + +File: python.info, Node: Sending logging messages to email with buffering, Next: Formatting times using UTC GMT via configuration, Prev: Buffering logging messages and outputting them conditionally, Up: Logging Cookbook + +9.9.29 Sending logging messages to email, with buffering +-------------------------------------------------------- + +To illustrate how you can send log messages via email, so that a set +number of messages are sent per email, you can subclass *note +BufferingHandler: 2d21. In the following example, which you can adapt +to suit your specific needs, a simple test harness is provided which +allows you to run the script with command line arguments specifying what +you typically need to send things via SMTP. (Run the downloaded script +with the ‘-h’ argument to see the required and optional arguments.) + + 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() + +If you run this script and your SMTP server is correctly set up, you +should find that it sends eleven emails to the addressee you specify. +The first ten emails will each have ten log messages, and the eleventh +will have two messages. That makes up 102 messages as specified in the +script. + + +File: python.info, Node: Formatting times using UTC GMT via configuration, Next: Using a context manager for selective logging, Prev: Sending logging messages to email with buffering, Up: Logging Cookbook + +9.9.30 Formatting times using UTC (GMT) via configuration +--------------------------------------------------------- + +Sometimes you want to format times using UTC, which can be done using a +class such as ‘UTCFormatter’, shown below: + + import logging + import time + + class UTCFormatter(logging.Formatter): + converter = time.gmtime + +and you can then use the ‘UTCFormatter’ in your code instead of *note +Formatter: 145e. If you want to do that via configuration, you can use +the *note dictConfig(): 11a2. API with an approach illustrated by the +following complete example: + + 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()) + +When this script is run, it should print something like: + + 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 + +showing how the time is formatted both as local time and UTC, one for +each handler. + + +File: python.info, Node: Using a context manager for selective logging, Next: A CLI application starter template, Prev: Formatting times using UTC GMT via configuration, Up: Logging Cookbook + +9.9.31 Using a context manager for selective logging +---------------------------------------------------- + +There are times when it would be useful to temporarily change the +logging configuration and revert it back after doing something. For +this, a context manager is the most obvious way of saving and restoring +the logging context. Here is a simple example of such a context +manager, which allows you to optionally change the logging level and add +a logging handler purely in the scope of the context manager: + + 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 + +If you specify a level value, the logger’s level is set to that value in +the scope of the with block covered by the context manager. If you +specify a handler, it is added to the logger on entry to the block and +removed on exit from the block. You can also ask the manager to close +the handler for you on block exit - you could do this if you don’t need +the handler any more. + +To illustrate how it works, we can add the following block of code to +the above: + + 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.') + +We initially set the logger’s level to ‘INFO’, so message #1 appears and +message #2 doesn’t. We then change the level to ‘DEBUG’ temporarily in +the following ‘with’ block, and so message #3 appears. After the block +exits, the logger’s level is restored to ‘INFO’ and so message #4 +doesn’t appear. In the next ‘with’ block, we set the level to ‘DEBUG’ +again but also add a handler writing to ‘sys.stdout’. Thus, message #5 +appears twice on the console (once via ‘stderr’ and once via ‘stdout’). +After the ‘with’ statement’s completion, the status is as it was before +so message #6 appears (like message #1) whereas message #7 doesn’t (just +like message #2). + +If we run the resulting script, the result is as follows: + + $ 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. + +If we run it again, but pipe ‘stderr’ to ‘/dev/null’, we see the +following, which is the only message written to ‘stdout’: + + $ python logctx.py 2>/dev/null + 5. This should appear twice - once on stderr and once on stdout. + +Once again, but piping ‘stdout’ to ‘/dev/null’, we get: + + $ 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. + +In this case, the message #5 printed to ‘stdout’ doesn’t appear, as +expected. + +Of course, the approach described here can be generalised, for example +to attach logging filters temporarily. Note that the above code works +in Python 2 as well as Python 3. + + +File: python.info, Node: A CLI application starter template, Next: A Qt GUI for logging, Prev: Using a context manager for selective logging, Up: Logging Cookbook + +9.9.32 A CLI application starter template +----------------------------------------- + +Here’s an example which shows how you can: + + * Use a logging level based on command-line arguments + + * Dispatch to multiple subcommands in separate files, all logging at + the same level in a consistent way + + * Make use of simple, minimal configuration + +Suppose we have a command-line application whose job is to stop, start +or restart some services. This could be organised for the purposes of +illustration as a file ‘app.py’ that is the main script for the +application, with individual commands implemented in ‘start.py’, +‘stop.py’ and ‘restart.py’. Suppose further that we want to control the +verbosity of the application via a command-line argument, defaulting to +‘logging.INFO’. Here’s one way that ‘app.py’ could be written: + + 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()) + +And the ‘start’, ‘stop’ and ‘restart’ commands can be implemented in +separate modules, like so for starting: + + # 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) + +and thus for stopping: + + # 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) + +and similarly for restarting: + + # 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) + +If we run this application with the default log level, we get output +like this: + + $ 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. + +The first word is the logging level, and the second word is the module +or package name of the place where the event was logged. + +If we change the logging level, then we can change the information sent +to the log. For example, if we want more information: + + $ 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. + +And if we want less: + + $ 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 + +In this case, the commands don’t print anything to the console, since +nothing at ‘WARNING’ level or above is logged by them. + + +File: python.info, Node: A Qt GUI for logging, Next: Logging to syslog with RFC5424 support, Prev: A CLI application starter template, Up: Logging Cookbook + +9.9.33 A Qt GUI for logging +--------------------------- + +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. + +The following example shows how to log to a Qt GUI. This introduces a +simple ‘QtHandler’ class which takes a callable, which should be a slot +in the main thread that does GUI updates. A worker thread is also +created to show how you can log to the GUI from both the UI itself (via +a button for manual logging) as well as a worker thread doing work in +the background (here, just logging messages at random levels with random +short delays in between). + +The worker thread is implemented using Qt’s ‘QThread’ class rather than +the *note threading: ed. module, as there are circumstances where one +has to use ‘QThread’, which offers better integration with other ‘Qt’ +components. + +The code should work with recent releases of any of ‘PySide6’, ‘PyQt6’, +‘PySide2’ or ‘PyQt5’. You should be able to adapt the approach to +earlier versions of Qt. Please refer to the comments in the code +snippet for more detailed information. + + import datetime + import logging + import random + import sys + import time + + # Deal with minor differences between different Qt packages + try: + from PySide6 import QtCore, QtGui, QtWidgets + Signal = QtCore.Signal + Slot = QtCore.Slot + except ImportError: + try: + from PyQt6 import QtCore, QtGui, QtWidgets + Signal = QtCore.pyqtSignal + Slot = QtCore.pyqtSlot + except ImportError: + try: + from PySide2 import QtCore, QtGui, QtWidgets + Signal = QtCore.Signal + Slot = QtCore.Slot + except ImportError: + from PyQt5 import QtCore, QtGui, QtWidgets + Signal = QtCore.pyqtSignal + Slot = QtCore.pyqtSlot + + logger = logging.getLogger(__name__) + + + # + # Signals need to be contained in a QObject or subclass in order to be correctly + # initialized. + # + class Signaller(QtCore.QObject): + signal = Signal(str, logging.LogRecord) + + # + # Output to a Qt GUI is only supposed to happen on the main thread. So, this + # handler is designed to take a slot function which is set up to run in the main + # thread. In this example, the function takes a string argument which is a + # formatted log message, and the log record which generated it. The formatted + # string is just a convenience - you could format a string for output any way + # you like in the slot function itself. + # + # You specify the slot function to do whatever GUI updates you want. The handler + # doesn't know or care about specific UI elements. + # + class QtHandler(logging.Handler): + def __init__(self, slotfunc, *args, **kwargs): + super().__init__(*args, **kwargs) + self.signaller = Signaller() + self.signaller.signal.connect(slotfunc) + + def emit(self, record): + s = self.format(record) + self.signaller.signal.emit(s, record) + + # + # This example uses QThreads, which means that the threads at the Python level + # are named something like "Dummy-1". The function below gets the Qt name of the + # current thread. + # + def ctname(): + return QtCore.QThread.currentThread().objectName() + + + # + # Used to generate random levels for logging. + # + LEVELS = (logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, + logging.CRITICAL) + + # + # This worker class represents work that is done in a thread separate to the + # main thread. The way the thread is kicked off to do work is via a button press + # that connects to a slot in the worker. + # + # Because the default threadName value in the LogRecord isn't much use, we add + # a qThreadName which contains the QThread name as computed above, and pass that + # value in an "extra" dictionary which is used to update the LogRecord with the + # QThread name. + # + # This example worker just outputs messages sequentially, interspersed with + # random delays of the order of a few seconds. + # + class Worker(QtCore.QObject): + @Slot() + def start(self): + extra = {'qThreadName': ctname() } + logger.debug('Started work', extra=extra) + i = 1 + # Let the thread run until interrupted. This allows reasonably clean + # thread termination. + while not QtCore.QThread.currentThread().isInterruptionRequested(): + delay = 0.5 + random.random() * 2 + time.sleep(delay) + try: + if random.random() < 0.1: + raise ValueError('Exception raised: %d' % i) + else: + level = random.choice(LEVELS) + logger.log(level, 'Message after delay of %3.1f: %d', delay, i, extra=extra) + except ValueError as e: + logger.exception('Failed: %s', e, extra=extra) + i += 1 + + # + # Implement a simple UI for this cookbook example. This contains: + # + # * A read-only text edit window which holds formatted log messages + # * A button to start work and log stuff in a separate thread + # * A button to log something from the main thread + # * A button to clear the log window + # + class Window(QtWidgets.QWidget): + + COLORS = { + logging.DEBUG: 'black', + logging.INFO: 'blue', + logging.WARNING: 'orange', + logging.ERROR: 'red', + logging.CRITICAL: 'purple', + } + + def __init__(self, app): + super().__init__() + self.app = app + self.textedit = te = QtWidgets.QPlainTextEdit(self) + # Set whatever the default monospace font is for the platform + f = QtGui.QFont('nosuchfont') + if hasattr(f, 'Monospace'): + f.setStyleHint(f.Monospace) + else: + f.setStyleHint(f.StyleHint.Monospace) # for Qt6 + te.setFont(f) + te.setReadOnly(True) + PB = QtWidgets.QPushButton + self.work_button = PB('Start background work', self) + self.log_button = PB('Log a message at a random level', self) + self.clear_button = PB('Clear log window', self) + self.handler = h = QtHandler(self.update_status) + # Remember to use qThreadName rather than threadName in the format string. + fs = '%(asctime)s %(qThreadName)-12s %(levelname)-8s %(message)s' + formatter = logging.Formatter(fs) + h.setFormatter(formatter) + logger.addHandler(h) + # Set up to terminate the QThread when we exit + app.aboutToQuit.connect(self.force_quit) + + # Lay out all the widgets + layout = QtWidgets.QVBoxLayout(self) + layout.addWidget(te) + layout.addWidget(self.work_button) + layout.addWidget(self.log_button) + layout.addWidget(self.clear_button) + self.setFixedSize(900, 400) + + # Connect the non-worker slots and signals + self.log_button.clicked.connect(self.manual_update) + self.clear_button.clicked.connect(self.clear_display) + + # Start a new worker thread and connect the slots for the worker + self.start_thread() + self.work_button.clicked.connect(self.worker.start) + # Once started, the button should be disabled + self.work_button.clicked.connect(lambda : self.work_button.setEnabled(False)) + + def start_thread(self): + self.worker = Worker() + self.worker_thread = QtCore.QThread() + self.worker.setObjectName('Worker') + self.worker_thread.setObjectName('WorkerThread') # for qThreadName + self.worker.moveToThread(self.worker_thread) + # This will start an event loop in the worker thread + self.worker_thread.start() + + def kill_thread(self): + # Just tell the worker to stop, then tell it to quit and wait for that + # to happen + self.worker_thread.requestInterruption() + if self.worker_thread.isRunning(): + self.worker_thread.quit() + self.worker_thread.wait() + else: + print('worker has already exited.') + + def force_quit(self): + # For use when the window is closed + if self.worker_thread.isRunning(): + self.kill_thread() + + # The functions below update the UI and run in the main thread because + # that's where the slots are set up + + @Slot(str, logging.LogRecord) + def update_status(self, status, record): + color = self.COLORS.get(record.levelno, 'black') + s = '<pre><font color="%s">%s</font></pre>' % (color, status) + self.textedit.appendHtml(s) + + @Slot() + def manual_update(self): + # This function uses the formatted message passed in, but also uses + # information from the record to format the message in an appropriate + # color according to its severity (level). + level = random.choice(LEVELS) + extra = {'qThreadName': ctname() } + logger.log(level, 'Manually logged!', extra=extra) + + @Slot() + def clear_display(self): + self.textedit.clear() + + + def main(): + QtCore.QThread.currentThread().setObjectName('MainThread') + logging.getLogger().setLevel(logging.DEBUG) + app = QtWidgets.QApplication(sys.argv) + example = Window(app) + example.show() + if hasattr(app, 'exec'): + rc = app.exec() + else: + rc = app.exec_() + sys.exit(rc) + + if __name__=='__main__': + main() + + ---------- Footnotes ---------- + + (1) https://www.qt.io/ + + (2) https://pypi.org/project/PySide2/ + + (3) https://pypi.org/project/PyQt5/ + + +File: python.info, Node: Logging to syslog with RFC5424 support, Next: How to treat a logger like an output stream, Prev: A Qt GUI for logging, Up: Logging Cookbook + +9.9.34 Logging to syslog with RFC5424 support +--------------------------------------------- + +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 RFC5424 came out, as there +has not been widespread deployment of it in syslog servers, the *note +SysLogHandler: 658. functionality has not been updated. + +RFC 5424 contains some useful features such as support for structured +data, and if you need to be able to log to a syslog server with support +for it, you can do so with a subclassed handler which looks something +like this: + + import datetime + import logging.handlers + import re + import socket + import time + + class SysLogHandler5424(logging.handlers.SysLogHandler): + + tz_offset = re.compile(r'([+-]\d{2})(\d{2})$') + escaped = re.compile(r'([\]"\\])') + + def __init__(self, *args, **kwargs): + self.msgid = kwargs.pop('msgid', None) + self.appname = kwargs.pop('appname', None) + super().__init__(*args, **kwargs) + + def format(self, record): + version = 1 + asctime = datetime.datetime.fromtimestamp(record.created).isoformat() + m = self.tz_offset.match(time.strftime('%z')) + has_offset = False + if m and time.timezone: + hrs, mins = m.groups() + if int(hrs) or int(mins): + has_offset = True + if not has_offset: + asctime += 'Z' + else: + asctime += f'{hrs}:{mins}' + try: + hostname = socket.gethostname() + except Exception: + hostname = '-' + appname = self.appname or '-' + procid = record.process + msgid = '-' + msg = super().format(record) + sdata = '-' + if hasattr(record, 'structured_data'): + sd = record.structured_data + # This should be a dict where the keys are SD-ID and the value is a + # dict mapping PARAM-NAME to PARAM-VALUE (refer to the RFC for what these + # mean) + # There's no error checking here - it's purely for illustration, and you + # can adapt this code for use in production environments + parts = [] + + def replacer(m): + g = m.groups() + return '\\' + g[0] + + for sdid, dv in sd.items(): + part = f'[{sdid}' + for k, v in dv.items(): + s = str(v) + s = self.escaped.sub(replacer, s) + part += f' {k}="{s}"' + part += ']' + parts.append(part) + sdata = ''.join(parts) + return f'{version} {asctime} {hostname} {appname} {procid} {msgid} {sdata} {msg}' + +You’ll need to be familiar with RFC 5424 to fully understand the above +code, and it may be that you have slightly different needs (e.g. for +how you pass structural data to the log). Nevertheless, the above +should be adaptable to your speciric needs. With the above handler, +you’d pass structured data using something like this: + + 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: How to treat a logger like an output stream, Next: How to uniformly handle newlines in logging output, Prev: Logging to syslog with RFC5424 support, Up: Logging Cookbook + +9.9.35 How to treat a logger like an output stream +-------------------------------------------------- + +Sometimes, you need to interface to a third-party API which expects a +file-like object to write to, but you want to direct the API’s output to +a logger. You can do this using a class which wraps a logger with a +file-like API. Here’s a short script illustrating such a class: + + 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() + +When this script is run, it prints + + INFO:demo:An INFO message + DEBUG:demo:A DEBUG message + +You could also use ‘LoggerWriter’ to redirect ‘sys.stdout’ and +‘sys.stderr’ by doing something like this: + + import sys + + sys.stdout = LoggerWriter(logger, logging.INFO) + sys.stderr = LoggerWriter(logger, logging.WARNING) + +You should do this 'after' configuring logging for your needs. In the +above example, the *note basicConfig(): 9ff. call does this (using the +‘sys.stderr’ value 'before' it is overwritten by a ‘LoggerWriter’ +instance). Then, you’d get this kind of result: + + >>> print('Foo') + INFO:demo:Foo + >>> print('Bar', file=sys.stderr) + WARNING:demo:Bar + >>> + +Of course, the examples above show output according to the format used +by *note basicConfig(): 9ff, but you can use a different formatter when +you configure logging. + +Note that with the above scheme, you are somewhat at the mercy of +buffering and the sequence of write calls which you are intercepting. +For example, with the definition of ‘LoggerWriter’ above, if you have +the snippet + + sys.stderr = LoggerWriter(logger, logging.WARNING) + 1 / 0 + +then running the script results in + + 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) + +This just buffers up stuff until a newline is seen, and then logs +complete lines. With this approach, you get better output: + + 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: Patterns to avoid, Prev: How to treat a logger like an output stream, Up: Logging Cookbook + +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: Patterns to avoid, Next: Other resources<2>, Prev: How to uniformly handle newlines in logging output, Up: Logging Cookbook + +9.9.37 Patterns to avoid +------------------------ + +Although the preceding sections have described ways of doing things you +might need to do or deal with, it is worth mentioning some usage +patterns which are 'unhelpful', and which should therefore be avoided in +most cases. The following sections are in no particular order. + +* Menu: + +* Opening the same log file multiple times:: +* Using loggers as attributes in a class or passing them as parameters:: +* Adding handlers other than NullHandler to a logger in a library:: +* Creating a lot of loggers:: + + +File: python.info, Node: Opening the same log file multiple times, Next: Using loggers as attributes in a class or passing them as parameters, Up: Patterns to avoid + +9.9.37.1 Opening the same log file multiple times +................................................. + +On Windows, you will generally not be able to open the same file +multiple times as this will lead to a “file is in use by another +process” error. However, on POSIX platforms you’ll not get any errors +if you open the same file multiple times. This could be done +accidentally, for example by: + + * Adding a file handler more than once which references the same file + (e.g. by a copy/paste/forget-to-change error). + + * Opening two files that look different, as they have different + names, but are the same because one is a symbolic link to the + other. + + * Forking a process, following which both parent and child have a + reference to the same file. This might be through use of the *note + multiprocessing: 94. module, for example. + +Opening a file multiple times might 'appear' to work most of the time, +but can lead to a number of problems in practice: + + * Logging output can be garbled because multiple threads or processes + try to write to the same file. Although logging guards against + concurrent use of the same handler instance by multiple threads, + there is no such protection if concurrent writes are attempted by + two different threads using two different handler instances which + happen to point to the same file. + + * An attempt to delete a file (e.g. during file rotation) silently + fails, because there is another reference pointing to it. This can + lead to confusion and wasted debugging time - log entries end up in + unexpected places, or are lost altogether. Or a file that was + supposed to be moved remains in place, and grows in size + unexpectedly despite size-based rotation being supposedly in place. + +Use the techniques outlined in *note Logging to a single file from +multiple processes: 4fc1. to circumvent such issues. + + +File: python.info, Node: Using loggers as attributes in a class or passing them as parameters, Next: Adding handlers other than NullHandler to a logger in a library, Prev: Opening the same log file multiple times, Up: Patterns to avoid + +9.9.37.2 Using loggers as attributes in a class or passing them as parameters +............................................................................. + +While there might be unusual cases where you’ll need to do this, in +general there is no point because loggers are singletons. Code can +always access a given logger instance by name using +‘logging.getLogger(name)’, so passing instances around and holding them +as instance attributes is pointless. Note that in other languages such +as Java and C#, loggers are often static class attributes. However, +this pattern doesn’t make sense in Python, where the module (and not the +class) is the unit of software decomposition. + + +File: python.info, Node: Adding handlers other than NullHandler to a logger in a library, Next: Creating a lot of loggers, Prev: Using loggers as attributes in a class or passing them as parameters, Up: Patterns to avoid + +9.9.37.3 Adding handlers other than ‘NullHandler’ to a logger in a library +.......................................................................... + +Configuring logging by adding handlers, formatters and filters is the +responsibility of the application developer, not the library developer. +If you are maintaining a library, ensure that you don’t add handlers to +any of your loggers other than a *note NullHandler: 1277. instance. + + +File: python.info, Node: Creating a lot of loggers, Prev: Adding handlers other than NullHandler to a logger in a library, Up: Patterns to avoid + +9.9.37.4 Creating a lot of loggers +.................................. + +Loggers are singletons that are never freed during a script execution, +and so creating lots of loggers will use up memory which can’t then be +freed. Rather than create a logger per e.g. file processed or network +connection made, use the *note existing mechanisms: 2ca4. for passing +contextual information into your logs and restrict the loggers created +to those describing areas within your application (generally modules, +but occasionally slightly more fine-grained than that). + + +File: python.info, Node: Other resources<2>, Prev: Patterns to avoid, Up: Logging Cookbook + +9.9.38 Other resources +---------------------- + +See also +........ + +Module *note logging: 87. + + API reference for the logging module. + +Module *note logging.config: 88. + + Configuration API for the logging module. + +Module *note logging.handlers: 89. + + Useful handlers included with the logging module. + +*note Basic Tutorial: 11e7. + +*note Advanced Tutorial: 11e8. + + +File: python.info, Node: Regular Expression HOWTO, Next: Socket Programming HOWTO, Prev: Logging Cookbook, Up: Python HOWTOs + +9.10 Regular Expression HOWTO +============================= + + +Author: A.M. Kuchling <<amk@amk.ca>> + +Abstract +........ + +This document is an introductory tutorial to using regular expressions +in Python with the *note re: b9. module. It provides a gentler +introduction than the corresponding section in the Library Reference. + +* Menu: + +* Introduction: Introduction<15>. +* Simple Patterns:: +* Using Regular Expressions:: +* More Pattern Power:: +* Modifying Strings:: +* Common Problems:: +* Feedback:: + + +File: python.info, Node: Introduction<15>, Next: Simple Patterns, Up: Regular Expression HOWTO + +9.10.1 Introduction +------------------- + +Regular expressions (called REs, or regexes, or regex patterns) are +essentially a tiny, highly specialized programming language embedded +inside Python and made available through the *note re: b9. module. +Using this little language, you specify the rules for the set of +possible strings that you want to match; this set might contain English +sentences, or e-mail addresses, or TeX commands, or anything you like. +You can then ask questions such as “Does this string match the +pattern?”, or “Is there a match for the pattern anywhere in this +string?”. You can also use REs to modify a string or to split it apart +in various ways. + +Regular expression patterns are compiled into a series of bytecodes +which are then executed by a matching engine written in C. For advanced +use, it may be necessary to pay careful attention to how the engine will +execute a given RE, and write the RE in a certain way in order to +produce bytecode that runs faster. Optimization isn’t covered in this +document, because it requires that you have a good understanding of the +matching engine’s internals. + +The regular expression language is relatively small and restricted, so +not all possible string processing tasks can be done using regular +expressions. There are also tasks that 'can' be done with regular +expressions, but the expressions turn out to be very complicated. In +these cases, you may be better off writing Python code to do the +processing; while Python code will be slower than an elaborate regular +expression, it will also probably be more understandable. + + +File: python.info, Node: Simple Patterns, Next: Using Regular Expressions, Prev: Introduction<15>, Up: Regular Expression HOWTO + +9.10.2 Simple Patterns +---------------------- + +We’ll start by learning about the simplest possible regular expressions. +Since regular expressions are used to operate on strings, we’ll begin +with the most common task: matching characters. + +For a detailed explanation of the computer science underlying regular +expressions (deterministic and non-deterministic finite automata), you +can refer to almost any textbook on writing compilers. + +* Menu: + +* Matching Characters:: +* Repeating Things:: + + +File: python.info, Node: Matching Characters, Next: Repeating Things, Up: Simple Patterns + +9.10.2.1 Matching Characters +............................ + +Most letters and characters will simply match themselves. For example, +the regular expression ‘test’ will match the string ‘test’ exactly. +(You can enable a case-insensitive mode that would let this RE match +‘Test’ or ‘TEST’ as well; more about this later.) + +There are exceptions to this rule; some characters are special +'metacharacters', and don’t match themselves. Instead, they signal that +some out-of-the-ordinary thing should be matched, or they affect other +portions of the RE by repeating them or changing their meaning. Much of +this document is devoted to discussing various metacharacters and what +they do. + +Here’s a complete list of the metacharacters; their meanings will be +discussed in the rest of this HOWTO. + + . ^ $ * + ? { } [ ] \ | ( ) + +The first metacharacters we’ll look at are ‘[’ and ‘]’. They’re used +for specifying a character class, which is a set of characters that you +wish to match. Characters can be listed individually, or a range of +characters can be indicated by giving two characters and separating them +by a ‘'-'’. For example, ‘[abc]’ will match any of the characters ‘a’, +‘b’, or ‘c’; this is the same as ‘[a-c]’, which uses a range to express +the same set of characters. If you wanted to match only lowercase +letters, your RE would be ‘[a-z]’. + +Metacharacters (except ‘\’) are not active inside classes. For example, +‘[akm$]’ will match any of the characters ‘'a'’, ‘'k'’, ‘'m'’, or ‘'$'’; +‘'$'’ is usually a metacharacter, but inside a character class it’s +stripped of its special nature. + +You can match the characters not listed within the class by +'complementing' the set. This is indicated by including a ‘'^'’ as the +first character of the class. For example, ‘[^5]’ will match any +character except ‘'5'’. If the caret appears elsewhere in a character +class, it does not have special meaning. For example: ‘[5^]’ will match +either a ‘'5'’ or a ‘'^'’. + +Perhaps the most important metacharacter is the backslash, ‘\’. As in +Python string literals, the backslash can be followed by various +characters to signal various special sequences. It’s also used to +escape all the metacharacters so you can still match them in patterns; +for example, if you need to match a ‘[’ or ‘\’, you can precede them +with a backslash to remove their special meaning: ‘\[’ or ‘\\’. + +Some of the special sequences beginning with ‘'\'’ represent predefined +sets of characters that are often useful, such as the set of digits, the +set of letters, or the set of anything that isn’t whitespace. + +Let’s take an example: ‘\w’ matches any alphanumeric character. If the +regex pattern is expressed in bytes, this is equivalent to the class +‘[a-zA-Z0-9_]’. If the regex pattern is a string, ‘\w’ will match all +the characters marked as letters in the Unicode database provided by the +*note unicodedata: 105. module. You can use the more restricted +definition of ‘\w’ in a string pattern by supplying the *note re.ASCII: +628. flag when compiling the regular expression. + +The following list of special sequences isn’t complete. For a complete +list of sequences and expanded class definitions for Unicode string +patterns, see the last part of *note Regular Expression Syntax: 71f. in +the Standard Library reference. In general, the Unicode versions match +any character that’s in the appropriate category in the Unicode +database. + +‘\d’ + + Matches any decimal digit; this is equivalent to the class ‘[0-9]’. + +‘\D’ + + Matches any non-digit character; this is equivalent to the class + ‘[^0-9]’. + +‘\s’ + + Matches any whitespace character; this is equivalent to the class + ‘[ \t\n\r\f\v]’. + +‘\S’ + + Matches any non-whitespace character; this is equivalent to the + class ‘[^ \t\n\r\f\v]’. + +‘\w’ + + Matches any alphanumeric character; this is equivalent to the class + ‘[a-zA-Z0-9_]’. + +‘\W’ + + Matches any non-alphanumeric character; this is equivalent to the + class ‘[^a-zA-Z0-9_]’. + +These sequences can be included inside a character class. For example, +‘[\s,.]’ is a character class that will match any whitespace character, +or ‘','’ or ‘'.'’. + +The final metacharacter in this section is ‘.’. It matches anything +except a newline character, and there’s an alternate mode (*note +re.DOTALL: 22ed.) where it will match even a newline. ‘.’ is often used +where you want to match “any character”. + + +File: python.info, Node: Repeating Things, Prev: Matching Characters, Up: Simple Patterns + +9.10.2.2 Repeating Things +......................... + +Being able to match varying sets of characters is the first thing +regular expressions can do that isn’t already possible with the methods +available on strings. However, if that was the only additional +capability of regexes, they wouldn’t be much of an advance. Another +capability is that you can specify that portions of the RE must be +repeated a certain number of times. + +The first metacharacter for repeating things that we’ll look at is ‘*’. +‘*’ doesn’t match the literal character ‘'*'’; instead, it specifies +that the previous character can be matched zero or more times, instead +of exactly once. + +For example, ‘ca*t’ will match ‘'ct'’ (0 ‘'a'’ characters), ‘'cat'’ (1 +‘'a'’), ‘'caaat'’ (3 ‘'a'’ characters), and so forth. + +Repetitions such as ‘*’ are 'greedy'; when repeating a RE, the matching +engine will try to repeat it as many times as possible. If later +portions of the pattern don’t match, the matching engine will then back +up and try again with fewer repetitions. + +A step-by-step example will make this more obvious. Let’s consider the +expression ‘a[bcd]*b’. This matches the letter ‘'a'’, zero or more +letters from the class ‘[bcd]’, and finally ends with a ‘'b'’. Now +imagine matching this RE against the string ‘'abcbd'’. + +Step Matched Explanation + +----------------------------------------------------------------- + +1 ‘a’ The ‘a’ in the RE matches. + + +2 ‘abcbd’ The engine matches ‘[bcd]*’, going + as far as it can, which is to the + end of the string. + + +3 'Failure' The engine tries to match ‘b’, but + the current position is at the end + of the string, so it fails. + + +4 ‘abcb’ Back up, so that ‘[bcd]*’ matches + one less character. + + +5 'Failure' Try ‘b’ again, but the current + position is at the last character, + which is a ‘'d'’. + + +6 ‘abc’ Back up again, so that ‘[bcd]*’ is + only matching ‘bc’. + + +6 ‘abcb’ Try ‘b’ again. This time the + character at the current position + is ‘'b'’, so it succeeds. + + +The end of the RE has now been reached, and it has matched ‘'abcb'’. +This demonstrates how the matching engine goes as far as it can at +first, and if no match is found it will then progressively back up and +retry the rest of the RE again and again. It will back up until it has +tried zero matches for ‘[bcd]*’, and if that subsequently fails, the +engine will conclude that the string doesn’t match the RE at all. + +Another repeating metacharacter is ‘+’, which matches one or more times. +Pay careful attention to the difference between ‘*’ and ‘+’; ‘*’ matches +'zero' or more times, so whatever’s being repeated may not be present at +all, while ‘+’ requires at least 'one' occurrence. To use a similar +example, ‘ca+t’ will match ‘'cat'’ (1 ‘'a'’), ‘'caaat'’ (3 ‘'a'’s), but +won’t match ‘'ct'’. + +There are two more repeating operators or quantifiers. The question +mark character, ‘?’, matches either once or zero times; you can think of +it as marking something as being optional. For example, ‘home-?brew’ +matches either ‘'homebrew'’ or ‘'home-brew'’. + +The most complicated quantifier is ‘{m,n}’, where 'm' and 'n' are +decimal integers. This quantifier means there must be at least 'm' +repetitions, and at most 'n'. For example, ‘a/{1,3}b’ will match +‘'a/b'’, ‘'a//b'’, and ‘'a///b'’. It won’t match ‘'ab'’, which has no +slashes, or ‘'a////b'’, which has four. + +You can omit either 'm' or 'n'; in that case, a reasonable value is +assumed for the missing value. Omitting 'm' is interpreted as a lower +limit of 0, while omitting 'n' results in an upper bound of infinity. + +The simplest case ‘{m}’ matches the preceding item exactly 'm' times. +For example, ‘a/{2}b’ will only match ‘'a//b'’. + +Readers of a reductionist bent may notice that the three other +quantifiers can all be expressed using this notation. ‘{0,}’ is the +same as ‘*’, ‘{1,}’ is equivalent to ‘+’, and ‘{0,1}’ is the same as +‘?’. It’s better to use ‘*’, ‘+’, or ‘?’ when you can, simply because +they’re shorter and easier to read. + + +File: python.info, Node: Using Regular Expressions, Next: More Pattern Power, Prev: Simple Patterns, Up: Regular Expression HOWTO + +9.10.3 Using Regular Expressions +-------------------------------- + +Now that we’ve looked at some simple regular expressions, how do we +actually use them in Python? The *note re: b9. module provides an +interface to the regular expression engine, allowing you to compile REs +into objects and then perform matches with them. + +* Menu: + +* Compiling Regular Expressions:: +* The Backslash Plague:: +* Performing Matches:: +* Module-Level Functions: Module-Level Functions<3>. +* Compilation Flags:: + + +File: python.info, Node: Compiling Regular Expressions, Next: The Backslash Plague, Up: Using Regular Expressions + +9.10.3.1 Compiling Regular Expressions +...................................... + +Regular expressions are compiled into pattern objects, which have +methods for various operations such as searching for pattern matches or +performing string substitutions. + + >>> import re + >>> p = re.compile('ab*') + >>> p + re.compile('ab*') + +*note re.compile(): bd3. also accepts an optional 'flags' argument, used +to enable various special features and syntax variations. We’ll go over +the available settings later, but for now a single example will do: + + >>> p = re.compile('ab*', re.IGNORECASE) + +The RE is passed to *note re.compile(): bd3. as a string. REs are +handled as strings because regular expressions aren’t part of the core +Python language, and no special syntax was created for expressing them. +(There are applications that don’t need REs at all, so there’s no need +to bloat the language specification by including them.) Instead, the +*note re: b9. module is simply a C extension module included with +Python, just like the *note socket: cc. or *note zlib: 133. modules. + +Putting REs in strings keeps the Python language simpler, but has one +disadvantage which is the topic of the next section. + + +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 +............................. + +As stated earlier, regular expressions use the backslash character +(‘'\'’) to indicate special forms or to allow special characters to be +used without invoking their special meaning. This conflicts with +Python’s usage of the same character for the same purpose in string +literals. + +Let’s say you want to write a RE that matches the string ‘\section’, +which might be found in a LaTeX file. To figure out what to write in +the program code, start with the desired string to be matched. Next, +you must escape any backslashes and other metacharacters by preceding +them with a backslash, resulting in the string ‘\\section’. The +resulting string that must be passed to *note re.compile(): bd3. must be +‘\\section’. However, to express this as a Python string literal, both +backslashes must be escaped 'again'. + +Characters Stage + +----------------------------------------------------------------------- + +‘\section’ Text string to be matched + + +‘\\section’ Escaped backslash for + *note re.compile(): bd3. + + +‘"\\\\section"’ Escaped backslashes for a string literal + + +In short, to match a literal backslash, one has to write ‘'\\\\'’ as the +RE string, because the regular expression must be ‘\\’, and each +backslash must be expressed as ‘\\’ inside a regular Python string +literal. In REs that feature backslashes repeatedly, this leads to lots +of repeated backslashes and makes the resulting strings difficult to +understand. + +The solution is to use Python’s raw string notation for regular +expressions; backslashes are not handled in any special way in a string +literal prefixed with ‘'r'’, so ‘r"\n"’ is a two-character string +containing ‘'\'’ and ‘'n'’, while ‘"\n"’ is a one-character string +containing a newline. Regular expressions will often be written in +Python code using this raw string notation. + +In addition, special escape sequences that are valid in regular +expressions, but not valid as Python string literals, now result in a +*note DeprecationWarning: 1a5. and will eventually become a *note +SyntaxError: 18d, which means the sequences will be invalid if raw +string notation or escaping the backslashes isn’t used. + +Regular String 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<3>, Prev: The Backslash Plague, Up: Using Regular Expressions + +9.10.3.3 Performing Matches +........................... + +Once you have an object representing a compiled regular expression, what +do you do with it? Pattern objects have several methods and attributes. +Only the most significant ones will be covered here; consult the *note +re: b9. docs for a complete listing. + +Method/Attribute Purpose + +--------------------------------------------------------------------------- + +‘match()’ Determine if the RE matches at the beginning of + the string. + + +‘search()’ Scan through a string, looking for any location + where this RE matches. + + +‘findall()’ Find all substrings where the RE matches, and + returns them as a list. + + +‘finditer()’ Find all substrings where the RE matches, and + returns them as an *note iterator: 1ac. + + +*note match(): 22ff. and *note search(): 2300. return ‘None’ if no match +can be found. If they’re successful, a *note match object: f82. +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: b9. module. + +This HOWTO uses the standard Python interpreter for its examples. +First, run the Python interpreter, import the *note re: b9. module, and +compile a RE: + + >>> import re + >>> p = re.compile('[a-z]+') + >>> p + re.compile('[a-z]+') + +Now, you can try matching various strings against the RE ‘[a-z]+’. An +empty string shouldn’t match at all, since ‘+’ means ‘one or more +repetitions’. *note match(): 22ff. should return ‘None’ in this case, +which will cause the interpreter to print no output. You can explicitly +print the result of ‘match()’ to make this clear. + + >>> p.match("") + >>> print(p.match("")) + None + +Now, let’s try it on a string that it should match, such as ‘tempo’. In +this case, *note match(): 22ff. will return a *note match object: f82, +so you should store the result in a variable for later use. + + >>> m = p.match('tempo') + >>> m + <re.Match object; span=(0, 5), match='tempo'> + +Now you can query the *note match object: f82. for information about the +matching string. Match object instances also have several methods and +attributes; the most important ones are: + +Method/Attribute Purpose + +------------------------------------------------------------------------ + +‘group()’ Return the string matched by the RE + + +‘start()’ Return the starting position of the match + + +‘end()’ Return the ending position of the match + + +‘span()’ Return a tuple containing the (start, end) + positions of the match + + +Trying these methods will soon clarify their meaning: + + >>> m.group() + 'tempo' + >>> m.start(), m.end() + (0, 5) + >>> m.span() + (0, 5) + +*note group(): 2315. returns the substring that was matched by the RE. +*note start(): 2319. and *note end(): 231a. return the starting and +ending index of the match. *note span(): 231b. returns both start and +end indexes in a single tuple. Since the *note match(): 22ff. method +only checks if the RE matches at the start of a string, ‘start()’ will +always be zero. However, the *note search(): 2300. method of patterns +scans through the string, so the match may not start at zero in that +case. + + >>> print(p.match('::: message')) + None + >>> m = p.search('::: message'); print(m) + <re.Match object; span=(4, 11), match='message'> + >>> m.group() + 'message' + >>> m.span() + (4, 11) + +In actual programs, the most common style is to store the *note match +object: f82. in a variable, and then check if it was ‘None’. This +usually looks like: + + p = re.compile( ... ) + m = p.match( 'string goes here' ) + if m: + print('Match found: ', m.group()) + else: + print('No match') + +Two pattern methods return all of the matches for a pattern. *note +findall(): 230b. returns a list of matching strings: + + >>> 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 DeprecationWarning: 1a5. and will +eventually become a *note SyntaxError: 18d. See *note The Backslash +Plague: 4fff. + +*note findall(): 230b. has to create the entire list before it can be +returned as the result. The *note finditer(): 230c. method returns a +sequence of *note match object: f82. instances as an *note iterator: +1ac.: + + >>> 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<3>, 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: b9. module also provides top-level functions called *note +match(): 1220, *note search(): 121f, *note findall(): 1023, *note sub(): +2a5, 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: f82. +instance. + + >>> print(re.match(r'From\s+', 'Fromage amk')) + None + >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998') + <re.Match object; span=(0, 5), match='From '> + +Under the hood, these functions simply create a pattern object for you +and call the appropriate method on it. They also store the compiled +object in a cache, so future calls using the same RE won’t need to parse +the pattern again and again. + +Should you use these module-level functions, or should you get the +pattern and call its methods yourself? If you’re accessing a regex +within a loop, pre-compiling it will save a few function calls. Outside +of loops, there’s not much difference thanks to the internal cache. + + +File: python.info, Node: Compilation Flags, Prev: Module-Level Functions<3>, Up: Using Regular Expressions + +9.10.3.5 Compilation Flags +.......................... + +Compilation flags let you modify some aspects of how regular expressions +work. Flags are available in the *note re: b9. module under two names, +a long name such as *note IGNORECASE: 1725. and a short, one-letter form +such as *note I: 22f0. (If you’re familiar with Perl’s pattern +modifiers, the one-letter forms use the same letters; the short form of +*note re.VERBOSE: 22fd. is *note re.X: 22f5, for example.) Multiple +flags can be specified by bitwise OR-ing them; ‘re.I | re.M’ sets both +the *note I: 22f0. and *note M: 22f2. flags, for example. + +Here’s a table of the available flags, followed by a more detailed +explanation of each one. + +Flag Meaning + +--------------------------------------------------------------------------------------- + +*note ASCII: 628, *note A: 22ef. Makes several escapes like ‘\w’, ‘\b’, ‘\s’ + and ‘\d’ match only on ASCII characters with + the respective property. + + +*note DOTALL: 22ed, *note S: 22f3. Make ‘.’ match any character, including + newlines. + + +*note IGNORECASE: 1725, Do case-insensitive matches. +*note I: 22f0. + +*note LOCALE: b6c, *note L: 22f1. Do a locale-aware match. + + +*note MULTILINE: 22ee, Multi-line matching, affecting ‘^’ and ‘$’. +*note M: 22f2. + +*note VERBOSE: 22fd, *note X: 22f5. Enable verbose REs, which can be organized +(for ‘extended’) more cleanly and understandably. + + + -- Data: re.I + + -- Data: re.IGNORECASE + + Perform case-insensitive matching; character class and literal + strings will match letters by ignoring case. For example, ‘[A-Z]’ + will match lowercase letters, too. Full Unicode matching also + works unless the *note ASCII: 628. flag is used to disable + non-ASCII matches. When the Unicode patterns ‘[a-z]’ or ‘[A-Z]’ + are used in combination with the *note IGNORECASE: 1725. flag, they + will match the 52 ASCII letters and 4 additional non-ASCII letters: + ‘İ’ (U+0130, Latin capital letter I with dot above), ‘ı’ (U+0131, + Latin small letter dotless i), ‘ſ’ (U+017F, Latin small letter long + s) and ‘K’ (U+212A, Kelvin sign). ‘Spam’ will match ‘'Spam'’, + ‘'spam'’, ‘'spAM'’, or ‘'ſpam'’ (the latter is matched only in + Unicode mode). This lowercasing doesn’t take the current locale + into account; it will if you also set the *note LOCALE: b6c. flag. + + -- Data: re.L + + -- Data: re.LOCALE + + Make ‘\w’, ‘\W’, ‘\b’, ‘\B’ and case-insensitive matching dependent + on the current locale instead of the Unicode database. + + Locales are a feature of the C library intended to help in writing + programs that take account of language differences. For example, + if you’re processing encoded French text, you’d want to be able to + write ‘\w+’ to match words, but ‘\w’ only matches the character + class ‘[A-Za-z]’ in bytes patterns; it won’t match bytes + corresponding to ‘é’ or ‘ç’. If your system is configured properly + and a French locale is selected, certain C functions will tell the + program that the byte corresponding to ‘é’ should also be + considered a letter. Setting the *note LOCALE: b6c. flag when + compiling a regular expression will cause the resulting compiled + object to use these C functions for ‘\w’; this is slower, but also + enables ‘\w+’ to match French words as you’d expect. The use of + this flag is discouraged in Python 3 as the locale mechanism is + very unreliable, it only handles one “culture” at a time, and it + only works with 8-bit locales. Unicode matching is already enabled + by default in Python 3 for Unicode (str) patterns, and it is able + to handle different locales/languages. + + -- Data: re.M + + -- Data: re.MULTILINE + + (‘^’ and ‘$’ haven’t been explained yet; they’ll be introduced in + section *note More Metacharacters: 5003.) + + Usually ‘^’ matches only at the beginning of the string, and ‘$’ + matches only at the end of the string and immediately before the + newline (if any) at the end of the string. When this flag is + specified, ‘^’ matches at the beginning of the string and at the + beginning of each line within the string, immediately following + each newline. Similarly, the ‘$’ metacharacter matches either at + the end of the string and at the end of each line (immediately + preceding each newline). + + -- Data: re.S + + -- Data: re.DOTALL + + Makes the ‘'.'’ special character match any character at all, + including a newline; without this flag, ‘'.'’ will match anything + 'except' a newline. + + -- Data: re.A + + -- Data: re.ASCII + + Make ‘\w’, ‘\W’, ‘\b’, ‘\B’, ‘\s’ and ‘\S’ perform ASCII-only + matching instead of full Unicode matching. This is only meaningful + for Unicode patterns, and is ignored for byte patterns. + + -- Data: re.X + + -- Data: 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 or + preceded by an unescaped backslash. + + For example, here’s a RE that uses *note re.VERBOSE: 22fd.; see how + much easier it is to read? + + 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) + + Without the verbose setting, the RE would look like this: + + charref = re.compile("&#(0[0-7]+" + "|[0-9]+" + "|x[0-9a-fA-F]+);") + + In the above example, Python’s automatic concatenation of string + literals has been used to break up the RE into smaller pieces, but + it’s still more difficult to understand than the version using + *note re.VERBOSE: 22fd. + + +File: python.info, Node: More Pattern Power, Next: Modifying Strings, Prev: Using Regular Expressions, Up: Regular Expression HOWTO + +9.10.4 More Pattern Power +------------------------- + +So far we’ve only covered a part of the features of regular expressions. +In this section, we’ll cover some new metacharacters, and how to use +groups to retrieve portions of the text that was matched. + +* Menu: + +* More Metacharacters:: +* Grouping:: +* Non-capturing and Named Groups:: +* Lookahead Assertions:: + + +File: python.info, Node: More Metacharacters, Next: Grouping, Up: More Pattern Power + +9.10.4.1 More Metacharacters +............................ + +There are some metacharacters that we haven’t covered yet. Most of them +will be covered in this section. + +Some of the remaining metacharacters to be discussed are 'zero-width +assertions'. They don’t cause the engine to advance through the string; +instead, they consume no characters at all, and simply succeed or fail. +For example, ‘\b’ is an assertion that the current position is located +at a word boundary; the position isn’t changed by the ‘\b’ at all. This +means that zero-width assertions should never be repeated, because if +they match once at a given location, they can obviously be matched an +infinite number of times. + +‘|’ + + Alternation, or the “or” operator. If 'A' and 'B' are regular + expressions, ‘A|B’ will match any string that matches either 'A' or + 'B'. ‘|’ has very low precedence in order to make it work + reasonably when you’re alternating multi-character strings. + ‘Crow|Servo’ will match either ‘'Crow'’ or ‘'Servo'’, not ‘'Cro'’, + a ‘'w'’ or an ‘'S'’, and ‘'ervo'’. + + To match a literal ‘'|'’, use ‘\|’, or enclose it inside a + character class, as in ‘[|]’. + +‘^’ + + Matches at the beginning of lines. Unless the *note MULTILINE: + 22ee. flag has been set, this will only match at the beginning of + the string. In *note MULTILINE: 22ee. mode, this also matches + immediately after each newline within the string. + + For example, if you wish to match the word ‘From’ only at the + beginning of a line, the RE to use is ‘^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 + + To match a literal ‘'^'’, use ‘\^’. + +‘$’ + + Matches at the end of a line, which is defined as either the end of + the string, or any location followed by a newline character. + + >>> 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='}'> + + To match a literal ‘'$'’, use ‘\$’ or enclose it inside a character + class, as in ‘[$]’. + +‘\A’ + + Matches only at the start of the string. When not in *note + MULTILINE: 22ee. mode, ‘\A’ and ‘^’ are effectively the same. In + *note MULTILINE: 22ee. mode, they’re different: ‘\A’ still matches + only at the beginning of the string, but ‘^’ may match at any + location inside the string that follows a newline character. + +‘\Z’ + + Matches only at the end of the string. + +‘\b’ + + Word boundary. This is a zero-width assertion that matches only at + the beginning or end of a word. A word is defined as a sequence of + alphanumeric characters, so the end of a word is indicated by + whitespace or a non-alphanumeric character. + + The following example matches ‘class’ only when it’s a complete + word; it won’t match when it’s contained inside another word. + + >>> 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 + + There are two subtleties you should remember when using this + special sequence. First, this is the worst collision between + Python’s string literals and regular expression sequences. In + Python’s string literals, ‘\b’ is the backspace character, ASCII + value 8. If you’re not using raw strings, then Python will convert + the ‘\b’ to a backspace, and your RE won’t match as you expect it + to. The following example looks the same as our previous RE, but + omits the ‘'r'’ in front of the RE string. + + >>> 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'> + + Second, inside a character class, where there’s no use for this + assertion, ‘\b’ represents the backspace character, for + compatibility with Python’s string literals. + +‘\B’ + + Another zero-width assertion, this is the opposite of ‘\b’, only + matching when the current position is not at a word boundary. + + +File: python.info, Node: Grouping, Next: Non-capturing and Named Groups, Prev: More Metacharacters, Up: More Pattern Power + +9.10.4.2 Grouping +................. + +Frequently you need to obtain more information than just whether the RE +matched or not. Regular expressions are often used to dissect strings +by writing a RE divided into several subgroups which match different +components of interest. For example, an RFC-822 header line is divided +into a header name and a value, separated by a ‘':'’, like this: + + From: author@example.com + User-Agent: Thunderbird 1.5.0.9 (X11/20061227) + MIME-Version: 1.0 + To: editor@example.com + +This can be handled by writing a regular expression which matches an +entire header line, and has one group which matches the header name, and +another group which matches the header’s value. + +Groups are marked by the ‘'('’, ‘')'’ metacharacters. ‘'('’ and ‘')'’ +have much the same meaning as they do in mathematical expressions; they +group together the expressions contained inside them, and you can repeat +the contents of a group with a quantifier, such as ‘*’, ‘+’, ‘?’, or +‘{m,n}’. For example, ‘(ab)*’ will match zero or more repetitions of +‘ab’. + + >>> p = re.compile('(ab)*') + >>> print(p.match('ababababab').span()) + (0, 10) + +Groups indicated with ‘'('’, ‘')'’ also capture the starting and ending +index of the text that they match; this can be retrieved by passing an +argument to *note group(): 2315, *note start(): 2319, *note end(): 231a, +and *note span(): 231b. Groups are numbered starting with 0. Group 0 +is always present; it’s the whole RE, so *note match object: f82. +methods all have group 0 as their default argument. Later we’ll see how +to express groups that don’t capture the span of text that they match. + + >>> p = re.compile('(a)b') + >>> m = p.match('ab') + >>> m.group() + 'ab' + >>> m.group(0) + 'ab' + +Subgroups are numbered from left to right, from 1 upward. Groups can be +nested; to determine the number, just count the opening parenthesis +characters, going from left to right. + + >>> p = re.compile('(a(b)c)d') + >>> m = p.match('abcd') + >>> m.group(0) + 'abcd' + >>> m.group(1) + 'abc' + >>> m.group(2) + 'b' + +*note group(): 2315. can be passed multiple group numbers at a time, in +which case it will return a tuple containing the corresponding values +for those groups. + + >>> m.group(2,1,2) + ('b', 'abc', 'b') + +The *note groups(): 2317. method returns a tuple containing the strings +for all the subgroups, from 1 up to however many there are. + + >>> m.groups() + ('abc', 'b') + +Backreferences in a pattern allow you to specify that the contents of an +earlier capturing group must also be found at the current location in +the string. For example, ‘\1’ will succeed if the exact contents of +group 1 can be found at the current position, and fails otherwise. +Remember that Python’s string literals also use a backslash followed by +numbers to allow including arbitrary characters in a string, so be sure +to use a raw string when incorporating backreferences in a RE. + +For example, the following RE detects doubled words in a string. + + >>> p = re.compile(r'\b(\w+)\s+\1\b') + >>> p.search('Paris in the the spring').group() + 'the the' + +Backreferences like this aren’t often useful for just searching through +a string — there are few text formats which repeat data in this way — +but you’ll soon find out that they’re 'very' useful when performing +string substitutions. + + +File: python.info, Node: Non-capturing and Named Groups, Next: Lookahead Assertions, Prev: Grouping, Up: More Pattern Power + +9.10.4.3 Non-capturing and Named Groups +....................................... + +Elaborate REs may use many groups, both to capture substrings of +interest, and to group and structure the RE itself. In complex REs, it +becomes difficult to keep track of the group numbers. There are two +features which help with this problem. Both of them use a common syntax +for regular expression extensions, so we’ll look at that first. + +Perl 5 is well known for its powerful additions to standard regular +expressions. For these new features the Perl developers couldn’t choose +new single-keystroke metacharacters or new special sequences beginning +with ‘\’ without making Perl’s regular expressions confusingly different +from standard REs. If they chose ‘&’ as a new metacharacter, for +example, old expressions would be assuming that ‘&’ was a regular +character and wouldn’t have escaped it by writing ‘\&’ or ‘[&]’. + +The solution chosen by the Perl developers was to use ‘(?...)’ as the +extension syntax. ‘?’ immediately after a parenthesis was a syntax +error because the ‘?’ would have nothing to repeat, so this didn’t +introduce any compatibility problems. The characters immediately after +the ‘?’ indicate what extension is being used, so ‘(?=foo)’ is one thing +(a positive lookahead assertion) and ‘(?:foo)’ is something else (a +non-capturing group containing the subexpression ‘foo’). + +Python supports several of Perl’s extensions and adds an extension +syntax to Perl’s extension syntax. If the first character after the +question mark is a ‘P’, you know that it’s an extension that’s specific +to Python. + +Now that we’ve looked at the general extension syntax, we can return to +the features that simplify working with groups in complex REs. + +Sometimes you’ll want to use a group to denote a part of a regular +expression, but aren’t interested in retrieving the group’s contents. +You can make this fact explicit by using a non-capturing group: +‘(?:...)’, where you can replace the ‘...’ with any other regular +expression. + + >>> m = re.match("([abc])+", "abc") + >>> m.groups() + ('c',) + >>> m = re.match("(?:[abc])+", "abc") + >>> m.groups() + () + +Except for the fact that you can’t retrieve the contents of what the +group matched, a non-capturing group behaves exactly the same as a +capturing group; you can put anything inside it, repeat it with a +repetition metacharacter such as ‘*’, and nest it within other groups +(capturing or non-capturing). ‘(?:...)’ is particularly useful when +modifying an existing pattern, since you can add new groups without +changing how all the other groups are numbered. It should be mentioned +that there’s no performance difference in searching between capturing +and non-capturing groups; neither form is any faster than the other. + +A more significant feature is named groups: instead of referring to them +by numbers, groups can be referenced by a name. + +The syntax for a named group is one of the Python-specific extensions: +‘(?P<name>...)’. 'name' is, obviously, the name of the group. Named +groups behave exactly like capturing groups, and additionally associate +a name with a group. The *note match object: f82. methods that deal +with capturing groups all accept either integers that refer to the group +by number or strings that contain the desired group’s name. Named +groups are still given numbers, so you can retrieve information about a +group in two ways: + + >>> p = re.compile(r'(?P<word>\b\w+\b)') + >>> m = p.search( '(((( Lots of punctuation )))' ) + >>> m.group('word') + 'Lots' + >>> m.group(1) + 'Lots' + +Additionally, you can retrieve named groups as a dictionary with *note +groupdict(): 2318.: + + >>> m = re.match(r'(?P<first>\w+) (?P<last>\w+)', 'Jane Doe') + >>> m.groupdict() + {'first': 'Jane', 'last': 'Doe'} + +Named groups are handy because they let you use easily remembered names, +instead of having to remember numbers. Here’s an example RE from the +*note imaplib: 74. module: + + 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'"') + +It’s obviously much easier to retrieve ‘m.group('zonem')’, instead of +having to remember to retrieve group 9. + +The syntax for backreferences in an expression such as ‘(...)\1’ refers +to the number of the group. There’s naturally a variant that uses the +group name instead of the number. This is another Python extension: +‘(?P=name)’ indicates that the contents of the group called 'name' +should again be matched at the current point. The regular expression +for finding doubled words, ‘\b(\w+)\s+\1\b’ can also be written as +‘\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 +............................. + +Another zero-width assertion is the lookahead assertion. Lookahead +assertions are available in both positive and negative form, and look +like this: + +‘(?=...)’ + + Positive lookahead assertion. This succeeds if the contained + regular expression, represented here by ‘...’, successfully matches + at the current location, and fails otherwise. But, once the + contained expression has been tried, the matching engine doesn’t + advance at all; the rest of the pattern is tried right where the + assertion started. + +‘(?!...)’ + + Negative lookahead assertion. This is the opposite of the positive + assertion; it succeeds if the contained expression 'doesn’t' match + at the current position in the string. + +To make this concrete, let’s look at a case where a lookahead is useful. +Consider a simple pattern to match a filename and split it apart into a +base name and an extension, separated by a ‘.’. For example, in +‘news.rc’, ‘news’ is the base name, and ‘rc’ is the filename’s +extension. + +The pattern to match this is quite simple: + +‘.*[.].*$’ + +Notice that the ‘.’ needs to be treated specially because it’s a +metacharacter, so it’s inside a character class to only match that +specific character. Also notice the trailing ‘$’; this is added to +ensure that all the rest of the string must be included in the +extension. This regular expression matches ‘foo.bar’ and ‘autoexec.bat’ +and ‘sendmail.cf’ and ‘printers.conf’. + +Now, consider complicating the problem a bit; what if you want to match +filenames where the extension is not ‘bat’? Some incorrect attempts: + +‘.*[.][^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])$’ + +The expression gets messier when you try to patch up the first solution +by requiring one of the following cases to match: the first character of +the extension isn’t ‘b’; the second character isn’t ‘a’; or the third +character isn’t ‘t’. This accepts ‘foo.bar’ and rejects ‘autoexec.bat’, +but it requires a three-letter extension and won’t accept a filename +with a two-letter extension such as ‘sendmail.cf’. We’ll complicate the +pattern again in an effort to fix it. + +‘.*[.]([^b].?.?|.[^a]?.?|..?[^t]?)$’ + +In the third attempt, the second and third letters are all made optional +in order to allow matching extensions shorter than three characters, +such as ‘sendmail.cf’. + +The pattern’s getting really complicated now, which makes it hard to +read and understand. Worse, if the problem changes and you want to +exclude both ‘bat’ and ‘exe’ as extensions, the pattern would get even +more complicated and confusing. + +A negative lookahead cuts through all this confusion: + +‘.*[.](?!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. + +Excluding another filename extension is now easy; simply add it as an +alternative inside the assertion. The following pattern excludes +filenames that end in either ‘bat’ or ‘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 +------------------------ + +Up to this point, we’ve simply performed searches against a static +string. Regular expressions are also commonly used to modify strings in +various ways, using the following pattern methods: + +Method/Attribute Purpose + +--------------------------------------------------------------------------- + +‘split()’ Split the string into a list, splitting it + wherever the RE matches + + +‘sub()’ Find all substrings where the RE matches, and + replace them with a different string + + +‘subn()’ Does the same thing as ‘sub()’, but returns the + new string and the number of replacements + + +* Menu: + +* Splitting Strings:: +* Search and Replace: Search and Replace<2>. + + +File: python.info, Node: Splitting Strings, Next: Search and Replace<2>, Up: Modifying Strings + +9.10.5.1 Splitting Strings +.......................... + +The *note split(): 230a. method of a pattern splits a string apart +wherever the RE matches, returning a list of the pieces. It’s similar +to the *note split(): ea3. method of strings but provides much more +generality in the delimiters that you can split by; string ‘split()’ +only supports splitting by whitespace or by a fixed string. As you’d +expect, there’s a module-level *note re.split(): 2a4. function, too. + + -- Method: .split (string[, maxsplit=0]) + + Split 'string' by the matches of the regular expression. If + capturing parentheses are used in the RE, then their contents will + also be returned as part of the resulting list. If 'maxsplit' is + nonzero, at most 'maxsplit' splits are performed. + +You can limit the number of splits made, by passing a value for +'maxsplit'. When 'maxsplit' is nonzero, at most 'maxsplit' splits will +be made, and the remainder of the string is returned as the final +element of the list. In the following example, the delimiter is any +sequence of non-alphanumeric characters. + + >>> 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().'] + +Sometimes you’re not only interested in what the text between delimiters +is, but also need to know what the delimiter was. If capturing +parentheses are used in the RE, then their values are also returned as +part of the list. Compare the following calls: + + >>> 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', '.', ''] + +The module-level function *note re.split(): 2a4. adds the RE to be used +as the first argument, but is otherwise the same. + + >>> 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<2>, Prev: Splitting Strings, Up: Modifying Strings + +9.10.5.2 Search and Replace +........................... + +Another common task is to find all the matches for a pattern, and +replace them with a different string. The *note sub(): 230d. method +takes a replacement value, which can be either a string or a function, +and the string to be processed. + + -- Method: .sub (replacement, string[, count=0]) + + Returns the string obtained by replacing the leftmost + non-overlapping occurrences of the RE in 'string' by the + replacement 'replacement'. If the pattern isn’t found, 'string' is + returned unchanged. + + The optional argument 'count' is the maximum number of pattern + occurrences to be replaced; 'count' must be a non-negative integer. + The default value of 0 means to replace all occurrences. + +Here’s a simple example of using the *note sub(): 230d. method. It +replaces colour names with the word ‘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' + +The *note subn(): 230e. method does the same work, but returns a 2-tuple +containing the new string value and the number of replacements that were +performed: + + >>> 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) + +Empty matches are replaced only when they’re not adjacent to a previous +empty match. + + >>> p = re.compile('x*') + >>> p.sub('-', 'abxd') + '-a-b--d-' + +If 'replacement' is a string, any backslash escapes in it are processed. +That is, ‘\n’ is converted to a single newline character, ‘\r’ is +converted to a carriage return, and so forth. Unknown escapes such as +‘\&’ are left alone. Backreferences, such as ‘\6’, are replaced with +the substring matched by the corresponding group in the RE. This lets +you incorporate portions of the original text in the resulting +replacement string. + +This example matches the word ‘section’ followed by a string enclosed in +‘{’, ‘}’, and changes ‘section’ to ‘subsection’: + + >>> p = re.compile('section{ ( [^}]* ) }', re.VERBOSE) + >>> p.sub(r'subsection{\1}','section{First} section{second}') + 'subsection{First} subsection{second}' + +There’s also a syntax for referring to named groups as defined by the +‘(?P<name>...)’ syntax. ‘\g<name>’ will use the substring matched by +the group named ‘name’, and ‘\g<number>’ uses the corresponding group +number. ‘\g<2>’ is therefore equivalent to ‘\2’, but isn’t ambiguous in +a replacement string such as ‘\g<2>0’. (‘\20’ would be interpreted as a +reference to group 20, not a reference to group 2 followed by the +literal character ‘'0'’.) The following substitutions are all +equivalent, but use all three variations of the replacement string. + + >>> 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' can also be a function, which gives you even more control. +If 'replacement' is a function, the function is called for every +non-overlapping occurrence of 'pattern'. On each call, the function is +passed a *note match object: f82. argument for the match and can use +this information to compute the desired replacement string and return +it. + +In the following example, the replacement function translates decimals +into hexadecimal: + + >>> 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.' + +When using the module-level *note re.sub(): 2a5. function, the pattern +is passed as the first argument. The pattern may be provided as an +object or as a string; if you need to specify regular expression flags, +you must either use a pattern object as the first parameter, or use +embedded modifiers in the pattern string, e.g. ‘sub("(?i)b+", "x", +"bbbb BBBB")’ returns ‘'x x'’. + + +File: python.info, Node: Common Problems, Next: Feedback, Prev: Modifying Strings, Up: Regular Expression HOWTO + +9.10.6 Common Problems +---------------------- + +Regular expressions are a powerful tool for some applications, but in +some ways their behaviour isn’t intuitive and at times they don’t behave +the way you may expect them to. This section will point out some of the +most common pitfalls. + +* Menu: + +* Use String Methods:: +* match() versus search(): match versus search. +* Greedy versus Non-Greedy:: +* Using re.VERBOSE: Using re VERBOSE. + + +File: python.info, Node: Use String Methods, Next: match versus search, Up: Common Problems + +9.10.6.1 Use String Methods +........................... + +Sometimes using the *note re: b9. module is a mistake. If you’re +matching a fixed string, or a single character class, and you’re not +using any *note re: b9. features such as the *note IGNORECASE: 1725. +flag, then the full power of regular expressions may not be required. +Strings have several methods for performing operations with fixed +strings and they’re usually much faster, because the implementation is a +single small C loop that’s been optimized for the purpose, instead of +the large, more generalized regular expression engine. + +One example might be replacing a single fixed string with another one; +for example, you might replace ‘word’ with ‘deed’. *note re.sub(): 2a5. +seems like the function to use for this, but consider the *note +replace(): 19a. method. Note that ‘replace()’ will also replace ‘word’ +inside words, turning ‘swordfish’ into ‘sdeedfish’, but the naive RE +‘word’ would have done that, too. (To avoid performing the substitution +on parts of words, the pattern would have to be ‘\bword\b’, in order to +require that ‘word’ have a word boundary on either side. This takes the +job beyond ‘replace()’’s abilities.) + +Another common task is deleting every occurrence of a single character +from a string or replacing it with another single character. You might +do this with something like ‘re.sub('\n', ' ', S)’, but *note +translate(): 21c8. is capable of doing both tasks and will be faster +than any regular expression operation can be. + +In short, before turning to the *note re: b9. module, consider whether +your problem can be solved with a faster and simpler string method. + + +File: python.info, Node: match versus search, Next: Greedy versus Non-Greedy, Prev: Use String Methods, Up: Common Problems + +9.10.6.2 match() versus search() +................................ + +The *note match(): 1220. function only checks if the RE matches at the +beginning of the string while *note search(): 121f. will scan forward +through the string for a match. It’s important to keep this distinction +in mind. Remember, ‘match()’ will only report a successful match which +will start at 0; if the match wouldn’t start at zero, ‘match()’ will +'not' report it. + + >>> print(re.match('super', 'superstition').span()) + (0, 5) + >>> print(re.match('super', 'insuperable')) + None + +On the other hand, *note search(): 121f. will scan forward through the +string, reporting the first match it finds. + + >>> print(re.search('super', 'superstition').span()) + (0, 5) + >>> print(re.search('super', 'insuperable').span()) + (2, 7) + +Sometimes you’ll be tempted to keep using *note re.match(): 1220, and +just add ‘.*’ to the front of your RE. Resist this temptation and use +*note re.search(): 121f. instead. The regular expression compiler does +some analysis of REs in order to speed up the process of looking for a +match. One such analysis figures out what the first character of a +match must be; for example, a pattern starting with ‘Crow’ must match +starting with a ‘'C'’. The analysis lets the engine quickly scan +through the string looking for the starting character, only trying the +full match if a ‘'C'’ is found. + +Adding ‘.*’ defeats this optimization, requiring scanning to the end of +the string and then backtracking to find a match for the rest of the RE. +Use *note re.search(): 121f. instead. + + +File: python.info, Node: Greedy versus Non-Greedy, Next: Using re VERBOSE, Prev: match versus search, Up: Common Problems + +9.10.6.3 Greedy versus Non-Greedy +................................. + +When repeating a regular expression, as in ‘a*’, the resulting action is +to consume as much of the pattern as possible. This fact often bites +you when you’re trying to match a pair of balanced delimiters, such as +the angle brackets surrounding an HTML tag. The naive pattern for +matching a single HTML tag doesn’t work because of the greedy nature of +‘.*’. + + >>> s = '<html><head><title>Title' + >>> len(s) + 32 + >>> print(re.match('<.*>', s).span()) + (0, 32) + >>> print(re.match('<.*>', s).group()) + Title + +The RE matches the ‘'<'’ in ‘''’, and the ‘.*’ consumes the rest +of the string. There’s still more left in the RE, though, and the ‘>’ +can’t match at the end of the string, so the regular expression engine +has to backtrack character by character until it finds a match for the +‘>’. The final match extends from the ‘'<'’ in ‘''’ to the ‘'>'’ +in ‘''’, which isn’t what you want. + +In this case, the solution is to use the non-greedy quantifiers ‘*?’, +‘+?’, ‘??’, or ‘{m,n}?’, which match as 'little' text as possible. In +the above example, the ‘'>'’ is tried immediately after the first ‘'<'’ +matches, and when it fails, the engine advances a character at a time, +retrying the ‘'>'’ at every step. This produces just the right result: + + >>> print(re.match('<.*?>', s).group()) + + +(Note that parsing HTML or XML with regular expressions is painful. +Quick-and-dirty patterns will handle common cases, but HTML and XML have +special cases that will break the obvious regular expression; by the +time you’ve written a regular expression that handles all of the +possible cases, the patterns will be 'very' complicated. Use an HTML or +XML parser module for such tasks.) + + +File: python.info, Node: Using re VERBOSE, Prev: Greedy versus Non-Greedy, Up: Common Problems + +9.10.6.4 Using re.VERBOSE +......................... + +By now you’ve probably noticed that regular expressions are a very +compact notation, but they’re not terribly readable. REs of moderate +complexity can become lengthy collections of backslashes, parentheses, +and metacharacters, making them difficult to read and understand. + +For such REs, specifying the *note re.VERBOSE: 22fd. flag when compiling +the regular expression can be helpful, because it allows you to format +the regular expression more clearly. + +The ‘re.VERBOSE’ flag has several effects. Whitespace in the regular +expression that 'isn’t' inside a character class is ignored. This means +that an expression such as ‘dog | cat’ is equivalent to the less +readable ‘dog|cat’, but ‘[a b]’ will still match the characters ‘'a'’, +‘'b'’, or a space. In addition, you can also put comments inside a RE; +comments extend from a ‘#’ character to the next newline. When used +with triple-quoted strings, this enables REs to be formatted more +neatly: + + pat = re.compile(r""" + \s* # Skip leading whitespace + (?P
    [^:]+) # Header name + \s* : # Whitespace, and a colon + (?P.*?) # The header's value -- *? used to + # lose the following trailing whitespace + \s*$ # Trailing whitespace to end-of-line + """, re.VERBOSE) + +This is far more readable than: + + pat = re.compile(r"\s*(?P
    [^:]+)\s*:(?P.*?)\s*$") + + +File: python.info, Node: Feedback, Prev: Common Problems, Up: Regular Expression HOWTO + +9.10.7 Feedback +--------------- + +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 author. + +The most complete book on regular expressions is almost certainly +Jeffrey Friedl’s Mastering Regular Expressions, published by O’Reilly. +Unfortunately, it exclusively concentrates on Perl and Java’s flavours +of regular expressions, and doesn’t contain any Python material at all, +so it won’t be useful as a reference for programming in Python. (The +first edition covered Python’s now-removed ‘regex’ module, which won’t +help you much.) Consider checking it out from your library. + + +File: python.info, Node: Socket Programming HOWTO, Next: Sorting Techniques, Prev: Regular Expression HOWTO, Up: Python HOWTOs + +9.11 Socket Programming HOWTO +============================= + + +Author: Gordon McMillan + +Abstract +........ + +Sockets are used nearly everywhere, but are one of the most severely +misunderstood technologies around. This is a 10,000 foot overview of +sockets. It’s not really a tutorial - you’ll still have work to do in +getting things operational. It doesn’t cover the fine points (and there +are a lot of them), but I hope it will give you enough background to +begin using them decently. + +* Menu: + +* Sockets:: +* Creating a Socket:: +* Using a Socket:: +* Disconnecting:: +* Non-blocking Sockets:: + + +File: python.info, Node: Sockets, Next: Creating a Socket, Up: Socket Programming HOWTO + +9.11.1 Sockets +-------------- + +I’m only going to talk about INET (i.e. IPv4) sockets, but they account +for at least 99% of the sockets in use. And I’ll only talk about STREAM +(i.e. TCP) sockets - unless you really know what you’re doing (in which +case this HOWTO isn’t for you!), you’ll get better behavior and +performance from a STREAM socket than anything else. I will try to +clear up the mystery of what a socket is, as well as some hints on how +to work with blocking and non-blocking sockets. But I’ll start by +talking about blocking sockets. You’ll need to know how they work +before dealing with non-blocking sockets. + +Part of the trouble with understanding these things is that “socket” can +mean a number of subtly different things, depending on context. So +first, let’s make a distinction between a “client” socket - an endpoint +of a conversation, and a “server” socket, which is more like a +switchboard operator. The client application (your browser, for +example) uses “client” sockets exclusively; the web server it’s talking +to uses both “server” sockets and “client” sockets. + +* Menu: + +* History:: + + +File: python.info, Node: History, Up: Sockets + +9.11.1.1 History +................ + +Of the various forms of IPC (Inter Process Communication), sockets are +by far the most popular. On any given platform, there are likely to be +other forms of IPC that are faster, but for cross-platform +communication, sockets are about the only game in town. + +They were invented in Berkeley as part of the BSD flavor of Unix. They +spread like wildfire with the internet. With good reason — the +combination of sockets with INET makes talking to arbitrary machines +around the world unbelievably easy (at least compared to other schemes). + + +File: python.info, Node: Creating a Socket, Next: Using a Socket, Prev: Sockets, Up: Socket Programming HOWTO + +9.11.2 Creating a Socket +------------------------ + +Roughly speaking, when you clicked on the link that brought you to this +page, your browser did something like the following: + + # 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)) + +When the ‘connect’ completes, the socket ‘s’ can be used to send in a +request for the text of the page. The same socket will read the reply, +and then be destroyed. That’s right, destroyed. Client sockets are +normally only used for one exchange (or a small set of sequential +exchanges). + +What happens in the web server is a bit more complex. First, the web +server creates a “server socket”: + + # 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) + +A couple things to notice: we used ‘socket.gethostname()’ so that the +socket would be visible to the outside world. If we had used +‘s.bind(('localhost', 80))’ or ‘s.bind(('127.0.0.1', 80))’ we would +still have a “server” socket, but one that was only visible within the +same machine. ‘s.bind(('', 80))’ specifies that the socket is reachable +by any address the machine happens to have. + +A second thing to note: low number ports are usually reserved for “well +known” services (HTTP, SNMP etc). If you’re playing around, use a nice +high number (4 digits). + +Finally, the argument to ‘listen’ tells the socket library that we want +it to queue up as many as 5 connect requests (the normal max) before +refusing outside connections. If the rest of the code is written +properly, that should be plenty. + +Now that we have a “server” socket, listening on port 80, we can enter +the mainloop of the web server: + + 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 = client_thread(clientsocket) + ct.run() + +There’s actually 3 general ways in which this loop could work - +dispatching a thread to handle ‘clientsocket’, create a new process to +handle ‘clientsocket’, or restructure this app to use non-blocking +sockets, and multiplex between our “server” socket and any active +‘clientsocket’s using ‘select’. More about that later. The important +thing to understand now is this: this is 'all' a “server” socket does. +It doesn’t send any data. It doesn’t receive any data. It just +produces “client” sockets. Each ‘clientsocket’ is created in response +to some 'other' “client” socket doing a ‘connect()’ to the host and port +we’re bound to. As soon as we’ve created that ‘clientsocket’, we go +back to listening for more connections. The two “clients” are free to +chat it up - they are using some dynamically allocated port which will +be recycled when the conversation ends. + +* Menu: + +* IPC:: + + +File: python.info, Node: IPC, Up: Creating a Socket + +9.11.2.1 IPC +............ + +If you need fast IPC between two processes on one machine, you should +look into pipes or shared memory. If you do decide to use AF_INET +sockets, bind the “server” socket to ‘'localhost'’. On most platforms, +this will take a shortcut around a couple of layers of network code and +be quite a bit faster. + +See also +........ + +The *note multiprocessing: 94. integrates cross-platform IPC into a +higher-level API. + + +File: python.info, Node: Using a Socket, Next: Disconnecting, Prev: Creating a Socket, Up: Socket Programming HOWTO + +9.11.3 Using a Socket +--------------------- + +The first thing to note, is that the web browser’s “client” socket and +the web server’s “client” socket are identical beasts. That is, this is +a “peer to peer” conversation. Or to put it another way, 'as the +designer, you will have to decide what the rules of etiquette are for a +conversation'. Normally, the ‘connect’ing socket starts the +conversation, by sending in a request, or perhaps a signon. But that’s +a design decision - it’s not a rule of sockets. + +Now there are two sets of verbs to use for communication. You can use +‘send’ and ‘recv’, or you can transform your client socket into a +file-like beast and use ‘read’ and ‘write’. The latter is the way Java +presents its sockets. I’m not going to talk about it here, except to +warn you that you need to use ‘flush’ on sockets. These are buffered +“files”, and a common mistake is to ‘write’ something, and then ‘read’ +for a reply. Without a ‘flush’ in there, you may wait forever for the +reply, because the request may still be in your output buffer. + +Now we come to the major stumbling block of sockets - ‘send’ and ‘recv’ +operate on the network buffers. They do not necessarily handle all the +bytes you hand them (or expect from them), because their major focus is +handling the network buffers. In general, they return when the +associated network buffers have been filled (‘send’) or emptied +(‘recv’). They then tell you how many bytes they handled. It is 'your' +responsibility to call them again until your message has been completely +dealt with. + +When a ‘recv’ returns 0 bytes, it means the other side has closed (or is +in the process of closing) the connection. You will not receive any +more data on this connection. Ever. You may be able to send data +successfully; I’ll talk more about this later. + +A protocol like HTTP uses a socket for only one transfer. The client +sends a request, then reads a reply. That’s it. The socket is +discarded. This means that a client can detect the end of the reply by +receiving 0 bytes. + +But if you plan to reuse your socket for further transfers, you need to +realize that 'there is no' EOT (End of Transfer) 'on a socket.' I +repeat: if a socket ‘send’ or ‘recv’ returns after handling 0 bytes, the +connection has been broken. If the connection has 'not' been broken, +you may wait on a ‘recv’ forever, because the socket will 'not' tell you +that there’s nothing more to read (for now). Now if you think about +that a bit, you’ll come to realize a fundamental truth of sockets: +'messages must either be fixed length' (yuck), 'or be delimited' +(shrug), 'or indicate how long they are' (much better), 'or end by +shutting down the connection'. The choice is entirely yours, (but some +ways are righter than others). + +Assuming you don’t want to end the connection, the simplest solution is +a fixed length message: + + 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) + +The sending code here is usable for almost any messaging scheme - in +Python you send strings, and you can use ‘len()’ to determine its length +(even if it has embedded ‘\0’ characters). It’s mostly the receiving +code that gets more complex. (And in C, it’s not much worse, except you +can’t use ‘strlen’ if the message has embedded ‘\0’s.) + +The easiest enhancement is to make the first character of the message an +indicator of message type, and have the type determine the length. Now +you have two ‘recv’s - the first to get (at least) that first character +so you can look up the length, and the second in a loop to get the rest. +If you decide to go the delimited route, you’ll be receiving in some +arbitrary chunk size, (4096 or 8192 is frequently a good match for +network buffer sizes), and scanning what you’ve received for a +delimiter. + +One complication to be aware of: if your conversational protocol allows +multiple messages to be sent back to back (without some kind of reply), +and you pass ‘recv’ an arbitrary chunk size, you may end up reading the +start of a following message. You’ll need to put that aside and hold +onto it, until it’s needed. + +Prefixing the message with its length (say, as 5 numeric characters) +gets more complex, because (believe it or not), you may not get all 5 +characters in one ‘recv’. In playing around, you’ll get away with it; +but in high network loads, your code will very quickly break unless you +use two ‘recv’ loops - the first to determine the length, the second to +get the data part of the message. Nasty. This is also when you’ll +discover that ‘send’ does not always manage to get rid of everything in +one pass. And despite having read this, you will eventually get bit by +it! + +In the interests of space, building your character, (and preserving my +competitive position), these enhancements are left as an exercise for +the reader. Lets move on to cleaning up. + +* Menu: + +* Binary Data:: + + +File: python.info, Node: Binary Data, Up: Using a Socket + +9.11.3.1 Binary Data +.................... + +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: Disconnecting, Next: Non-blocking Sockets, Prev: Using a Socket, Up: Socket Programming HOWTO + +9.11.4 Disconnecting +-------------------- + +Strictly speaking, you’re supposed to use ‘shutdown’ on a socket before +you ‘close’ it. The ‘shutdown’ is an advisory to the socket at the +other end. Depending on the argument you pass it, it can mean “I’m not +going to send anymore, but I’ll still listen”, or “I’m not listening, +good riddance!”. Most socket libraries, however, are so used to +programmers neglecting to use this piece of etiquette that normally a +‘close’ is the same as ‘shutdown(); close()’. So in most situations, an +explicit ‘shutdown’ is not needed. + +One way to use ‘shutdown’ effectively is in an HTTP-like exchange. The +client sends a request and then does a ‘shutdown(1)’. This tells the +server “This client is done sending, but can still receive.” The server +can detect “EOF” by a receive of 0 bytes. It can assume it has the +complete request. The server sends a reply. If the ‘send’ completes +successfully then, indeed, the client was still receiving. + +Python takes the automatic shutdown a step further, and says that when a +socket is garbage collected, it will automatically do a ‘close’ if it’s +needed. But relying on this is a very bad habit. If your socket just +disappears without doing a ‘close’, the socket at the other end may hang +indefinitely, thinking you’re just being slow. 'Please' ‘close’ your +sockets when you’re done. + +* Menu: + +* When Sockets Die:: + + +File: python.info, Node: When Sockets Die, Up: Disconnecting + +9.11.4.1 When Sockets Die +......................... + +Probably the worst thing about using blocking sockets is what happens +when the other side comes down hard (without doing a ‘close’). Your +socket is likely to hang. TCP is a reliable protocol, and it will wait +a long, long time before giving up on a connection. If you’re using +threads, the entire thread is essentially dead. There’s not much you +can do about it. As long as you aren’t doing something dumb, like +holding a lock while doing a blocking read, the thread isn’t really +consuming much in the way of resources. Do 'not' try to kill the thread +- part of the reason that threads are more efficient than processes is +that they avoid the overhead associated with the automatic recycling of +resources. In other words, if you do manage to kill the thread, your +whole process is likely to be screwed up. + + +File: python.info, Node: Non-blocking Sockets, Prev: Disconnecting, Up: Socket Programming HOWTO + +9.11.5 Non-blocking Sockets +--------------------------- + +If you’ve understood the preceding, you already know most of what you +need to know about the mechanics of using sockets. You’ll still use the +same calls, in much the same ways. It’s just that, if you do it right, +your app will be almost inside-out. + +In Python, you use ‘socket.setblocking(False)’ to make it non-blocking. +In C, it’s more complex, (for one thing, you’ll need to choose between +the BSD flavor ‘O_NONBLOCK’ and the almost indistinguishable POSIX +flavor ‘O_NDELAY’, which is completely different from ‘TCP_NODELAY’), +but it’s the exact same idea. You do this after creating the socket, +but before using it. (Actually, if you’re nuts, you can switch back and +forth.) + +The major mechanical difference is that ‘send’, ‘recv’, ‘connect’ and +‘accept’ can return without having done anything. You have (of course) +a number of choices. You can check return code and error codes and +generally drive yourself crazy. If you don’t believe me, try it +sometime. Your app will grow large, buggy and suck CPU. So let’s skip +the brain-dead solutions and do it right. + +Use ‘select’. + +In C, coding ‘select’ is fairly complex. In Python, it’s a piece of +cake, but it’s close enough to the C version that if you understand +‘select’ in Python, you’ll have little trouble with it in C: + + ready_to_read, ready_to_write, in_error = \ + select.select( + potential_readers, + potential_writers, + potential_errs, + timeout) + +You pass ‘select’ three lists: the first contains all sockets that you +might want to try reading; the second all the sockets you might want to +try writing to, and the last (normally left empty) those that you want +to check for errors. You should note that a socket can go into more +than one list. The ‘select’ call is blocking, but you can give it a +timeout. This is generally a sensible thing to do - give it a nice long +timeout (say a minute) unless you have good reason to do otherwise. + +In return, you will get three lists. They contain the sockets that are +actually readable, writable and in error. Each of these lists is a +subset (possibly empty) of the corresponding list you passed in. + +If a socket is in the output readable list, you can be +as-close-to-certain-as-we-ever-get-in-this-business that a ‘recv’ on +that socket will return 'something'. Same idea for the writable list. +You’ll be able to send 'something'. Maybe not all you want to, but +'something' is better than nothing. (Actually, any reasonably healthy +socket will return as writable - it just means outbound network buffer +space is available.) + +If you have a “server” socket, put it in the potential_readers list. If +it comes out in the readable list, your ‘accept’ will (almost certainly) +work. If you have created a new socket to ‘connect’ to someone else, +put it in the potential_writers list. If it shows up in the writable +list, you have a decent chance that it has connected. + +Actually, ‘select’ can be handy even with blocking sockets. It’s one +way of determining whether you will block - the socket returns as +readable when there’s something in the buffers. However, this still +doesn’t help with the problem of determining whether the other end is +done, or just busy with something else. + +'Portability alert': On Unix, ‘select’ works both with the sockets and +files. Don’t try this on Windows. On Windows, ‘select’ works with +sockets only. Also note that in C, many of the more advanced socket +options are done differently on Windows. In fact, on Windows I usually +use threads (which work very, very well) with my sockets. + + +File: python.info, Node: Sorting Techniques, Next: Unicode HOWTO, Prev: Socket Programming HOWTO, Up: Python HOWTOs + +9.12 Sorting Techniques +======================= + + +Author: Andrew Dalke and Raymond Hettinger + +Python lists have a built-in *note list.sort(): bcf. method that +modifies the list in-place. There is also a *note sorted(): bce. +built-in function that builds a new sorted list from an iterable. + +In this document, we explore the various techniques for sorting data +using Python. + +* Menu: + +* Sorting Basics:: +* Key Functions:: +* Operator Module Functions and Partial Function Evaluation:: +* Ascending and Descending:: +* Sort Stability and Complex Sorts:: +* Decorate-Sort-Undecorate:: +* Comparison Functions:: +* Odds and Ends: Odds and Ends<2>. +* Partial Sorts:: + + +File: python.info, Node: Sorting Basics, Next: Key Functions, Up: Sorting Techniques + +9.12.1 Sorting Basics +--------------------- + +A simple ascending sort is very easy: just call the *note sorted(): bce. +function. It returns a new sorted list: + + >>> sorted([5, 2, 3, 1, 4]) + [1, 2, 3, 4, 5] + +You can also use the *note list.sort(): bcf. method. It modifies the +list in-place (and returns ‘None’ to avoid confusion). Usually it’s +less convenient than *note sorted(): bce. - but if you don’t need the +original list, it’s slightly more efficient. + + >>> a = [5, 2, 3, 1, 4] + >>> a.sort() + >>> a + [1, 2, 3, 4, 5] + +Another difference is that the *note list.sort(): bcf. method is only +defined for lists. In contrast, the *note sorted(): bce. function +accepts any iterable. + + >>> sorted({1: 'D', 2: 'B', 3: 'B', 4: 'E', 5: 'A'}) + [1, 2, 3, 4, 5] + + +File: python.info, Node: Key Functions, Next: Operator Module Functions and Partial Function Evaluation, Prev: Sorting Basics, Up: Sorting Techniques + +9.12.2 Key Functions +-------------------- + +Both *note list.sort(): bcf. and *note sorted(): bce. 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: + + >>> sorted("This is a test string from Andrew".split(), key=str.casefold) + ['a', 'Andrew', 'from', 'is', 'string', 'test', 'This'] + +The value of the 'key' parameter should be a function (or other +callable) that takes a single argument and returns a key to use for +sorting purposes. This technique is fast because the key function is +called exactly once for each input record. + +A common pattern is to sort complex objects using some of the object’s +indices as keys. For example: + + >>> 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)] + +The same technique works for objects with named attributes. For +example: + + >>> 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)] + +Objects with named attributes can be made by a regular class as shown +above, or they can be instances of *note dataclass: 1cb. or a *note +named tuple: 64a. + + +File: python.info, Node: Operator Module Functions and Partial Function Evaluation, Next: Ascending and Descending, Prev: Key Functions, Up: Sorting Techniques + +9.12.3 Operator Module Functions and Partial Function Evaluation +---------------------------------------------------------------- + +The *note key function: e04. patterns shown above are very common, so +Python provides convenience functions to make accessor functions easier +and faster. The *note operator: 9f. module has *note itemgetter(): a61, +*note attrgetter(): e32, and a *note methodcaller(): e33. function. + +Using those functions, the above examples become simpler and faster: + + >>> 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)] + +The operator module functions allow multiple levels of sorting. For +example, to sort by 'grade' then by '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)] + +The *note functools: 5f. module provides another helpful tool for making +key-functions. The *note partial(): 410. function can reduce the +arity(1) of a multi-argument function making it suitable for use as a +key-function. + + >>> 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: Ascending and Descending, Next: Sort Stability and Complex Sorts, Prev: Operator Module Functions and Partial Function Evaluation, Up: Sorting Techniques + +9.12.4 Ascending and Descending +------------------------------- + +Both *note list.sort(): bcf. and *note sorted(): bce. accept a 'reverse' +parameter with a boolean value. This is used to flag descending sorts. +For example, to get the student data in reverse 'age' order: + + >>> 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: Sort Stability and Complex Sorts, Next: Decorate-Sort-Undecorate, Prev: Ascending and Descending, Up: Sorting Techniques + +9.12.5 Sort Stability and Complex Sorts +--------------------------------------- + +Sorts are guaranteed to be stable(1). That means that when multiple +records have the same key, their original order is preserved. + + >>> data = [('red', 1), ('blue', 1), ('red', 2), ('blue', 2)] + >>> sorted(data, key=itemgetter(0)) + [('blue', 1), ('blue', 2), ('red', 1), ('red', 2)] + +Notice how the two records for 'blue' retain their original order so +that ‘('blue', 1)’ is guaranteed to precede ‘('blue', 2)’. + +This wonderful property lets you build complex sorts in a series of +sorting steps. For example, to sort the student data by descending +'grade' and then ascending 'age', do the 'age' sort first and then sort +again using '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)] + +This can be abstracted out into a wrapper function that can take a list +and tuples of field and order to sort them on multiple passes. + + >>> 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)] + +The Timsort(2) algorithm used in Python does multiple sorts efficiently +because it can take advantage of any ordering already present in a +dataset. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Sorting_algorithm#Stability + + (2) https://en.wikipedia.org/wiki/Timsort + + +File: python.info, Node: Decorate-Sort-Undecorate, Next: Comparison Functions, Prev: Sort Stability and Complex Sorts, Up: Sorting Techniques + +9.12.6 Decorate-Sort-Undecorate +------------------------------- + +This idiom is called Decorate-Sort-Undecorate after its three steps: + + * First, the initial list is decorated with new values that control + the sort order. + + * Second, the decorated list is sorted. + + * Finally, the decorations are removed, creating a list that contains + only the initial values in the new order. + +For example, to sort the student data by 'grade' using the DSU approach: + + >>> 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)] + +This idiom works because tuples are compared lexicographically; the +first items are compared; if they are the same then the second items are +compared, and so on. + +It is not strictly necessary in all cases to include the index 'i' in +the decorated list, but including it gives two benefits: + + * The sort is stable – if two items have the same key, their order + will be preserved in the sorted list. + + * The original items do not have to be comparable because the + ordering of the decorated tuples will be determined by at most the + first two items. So for example the original list could contain + complex numbers which cannot be sorted directly. + +Another name for this idiom is Schwartzian transform(1), after Randal L. +Schwartz, who popularized it among Perl programmers. + +Now that Python sorting provides key-functions, this technique is not +often needed. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Schwartzian_transform + + +File: python.info, Node: Comparison Functions, Next: Odds and Ends<2>, Prev: Decorate-Sort-Undecorate, Up: Sorting Techniques + +9.12.7 Comparison Functions +--------------------------- + +Unlike key functions that return an absolute value for sorting, a +comparison function computes the relative ordering for two inputs. + +For example, a balance scale(1) compares two samples giving a relative +ordering: lighter, equal, or heavier. Likewise, a comparison function +such as ‘cmp(a, b)’ will return a negative value for less-than, zero if +the inputs are equal, or a positive value for greater-than. + +It is common to encounter comparison functions when translating +algorithms from other languages. Also, some libraries provide +comparison functions as part of their API. For example, *note +locale.strcoll(): 3d42. is a comparison function. + +To accommodate those situations, Python provides *note +functools.cmp_to_key: 11cc. to wrap the comparison function to make it +usable as a key function: + + 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: Odds and Ends<2>, Next: Partial Sorts, Prev: Comparison Functions, Up: Sorting Techniques + +9.12.8 Odds and Ends +-------------------- + + * For locale aware sorting, use *note locale.strxfrm(): 3d44. for a + key function or *note locale.strcoll(): 3d42. for a comparison + function. This is necessary because “alphabetical” sort orderings + can vary across cultures even if the underlying alphabet is the + same. + + * The 'reverse' parameter still maintains sort stability (so that + records with equal keys retain the original order). Interestingly, + that effect can be simulated without the parameter by using the + builtin *note reversed(): 862. function twice: + + >>> 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)] + + * The sort routines use ‘<’ when making comparisons between two + objects. So, it is easy to add a standard sort order to a class by + defining an *note __lt__(): 1292. method: + + >>> Student.__lt__ = lambda self, other: self.age < other.age + >>> sorted(student_objects) + [('dave', 'B', 10), ('jane', 'B', 12), ('john', 'A', 15)] + + However, note that ‘<’ can fall back to using *note __gt__(): 12ff. + if *note __lt__(): 1292. is not implemented (see *note + object.__lt__(): 1292. for details on the mechanics). To avoid + surprises, PEP 8(1) recommends that all six comparison methods be + implemented. The *note total_ordering(): f3d. decorator is + provided to make that task easier. + + * Key functions need not depend directly on the objects being sorted. + A key function can also access external resources. For instance, + if the student grades are stored in a dictionary, they can be used + to sort a separate list of student names: + + >>> 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: Partial Sorts, Prev: Odds and Ends<2>, Up: Sorting Techniques + +9.12.9 Partial Sorts +-------------------- + +Some applications require only some of the data to be ordered. The +standard library provides several tools that do less work than a full +sort: + + * *note min(): f03. and *note max(): f04. return the smallest and + largest values, respectively. These functions make a single pass + over the input data and require almost no auxiliary memory. + + * *note heapq.nsmallest(): 253c. and *note heapq.nlargest(): 253b. + return the 'n' smallest and largest values, respectively. These + functions make a single pass over the data keeping only 'n' + elements in memory at a time. For values of 'n' that are small + relative to the number of inputs, these functions make far fewer + comparisons than a full sort. + + * *note heapq.heappush(): 1485. and *note heapq.heappop(): 1486. + create and maintain a partially sorted arrangement of data that + keeps the smallest element at position ‘0’. These functions are + suitable for implementing priority queues which are commonly used + for task scheduling. + + +File: python.info, Node: Unicode HOWTO, Next: HOWTO Fetch Internet Resources Using The urllib Package, Prev: Sorting Techniques, Up: Python HOWTOs + +9.13 Unicode HOWTO +================== + + +Release: 1.12 + +This HOWTO discusses Python’s support for the Unicode specification for +representing textual data, and explains various problems that people +commonly encounter when trying to work with Unicode. + +* Menu: + +* Introduction to Unicode:: +* Python’s Unicode Support:: +* Reading and Writing Unicode Data:: +* Acknowledgements: Acknowledgements<10>. + + +File: python.info, Node: Introduction to Unicode, Next: Python’s Unicode Support, Up: Unicode HOWTO + +9.13.1 Introduction to Unicode +------------------------------ + +* Menu: + +* Definitions:: +* Encodings:: +* References: References<3>. + + +File: python.info, Node: Definitions, Next: Encodings, Up: Introduction to Unicode + +9.13.1.1 Definitions +.................... + +Today’s programs need to be able to handle a wide variety of characters. +Applications are often internationalized to display messages and output +in a variety of user-selectable languages; the same program might need +to output an error message in English, French, Japanese, Hebrew, or +Russian. Web content can be written in any of these languages and can +also include a variety of emoji symbols. Python’s string type uses the +Unicode Standard for representing characters, which lets Python programs +work with all these different possible characters. + +Unicode (‘https://www.unicode.org/’) is a specification that aims to +list every character used by human languages and give each character its +own unique code. The Unicode specifications are continually revised and +updated to add new languages and symbols. + +A 'character' is the smallest possible component of a text. ‘A’, ‘B’, +‘C’, etc., are all different characters. So are ‘È’ and ‘Í’. +Characters vary depending on the language or context you’re talking +about. For example, there’s a character for “Roman Numeral One”, ‘Ⅰ’, +that’s separate from the uppercase letter ‘I’. They’ll usually look the +same, but these are two different characters that have different +meanings. + +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). + +The Unicode standard contains a lot of tables listing characters and +their corresponding code points: + + 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 + ... + +Strictly, these definitions imply that it’s meaningless to say ‘this is +character ‘U+265E’’. ‘U+265E’ is a code point, which represents some +particular character; in this case, it represents the character ‘BLACK +CHESS KNIGHT’, ‘♞’. In informal contexts, this distinction between code +points and characters will sometimes be forgotten. + +A character is represented on a screen or on paper by a set of graphical +elements that’s called a 'glyph'. The glyph for an uppercase A, for +example, is two diagonal strokes and a horizontal stroke, though the +exact details will depend on the font being used. Most Python code +doesn’t need to worry about glyphs; figuring out the correct glyph to +display is generally the job of a GUI toolkit or a terminal’s font +renderer. + + ---------- Footnotes ---------- + + (1) https://www.unicode.org/versions/latest/#Summary + + +File: python.info, Node: Encodings, Next: References<3>, Prev: Definitions, Up: Introduction to Unicode + +9.13.1.2 Encodings +.................. + +To summarize the previous section: a Unicode string is a sequence of +code points, which are numbers from 0 through ‘0x10FFFF’ (1,114,111 +decimal). This sequence of code points needs to be represented in +memory as a set of 'code units', and 'code units' are then mapped to +8-bit bytes. The rules for translating a Unicode string into a sequence +of bytes are called a 'character encoding', or just an 'encoding'. + +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 + +This representation is straightforward but using it presents a number of +problems. + + 1. It’s not portable; different processors order the bytes + differently. + + 2. It’s very wasteful of space. In most texts, the majority of the + code points are less than 127, or less than 255, so a lot of space + is occupied by ‘0x00’ bytes. The above string takes 24 bytes + compared to the 6 bytes needed for an ASCII representation. + Increased RAM usage doesn’t matter too much (desktop computers have + gigabytes of RAM, and strings aren’t usually that large), but + expanding our usage of disk and network bandwidth by a factor of 4 + is intolerable. + + 3. It’s not compatible with existing C functions such as ‘strlen()’, + so a new family of wide string functions would need to be used. + +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. If the code point is < 128, it’s represented by the corresponding + byte value. + + 2. If the code point is >= 128, it’s turned into a sequence of two, + three, or four bytes, where each byte of the sequence is between + 128 and 255. + +UTF-8 has several convenient properties: + + 1. It can handle any Unicode code point. + + 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. A string of ASCII text is also valid UTF-8 text. + + 4. UTF-8 is fairly compact; the majority of commonly used characters + can be represented with one or two bytes. + + 5. If bytes are corrupted or lost, it’s possible to determine the + start of the next UTF-8-encoded code point and resynchronize. It’s + also unlikely that random 8-bit data will look like valid 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: References<3>, Prev: Encodings, Up: Introduction to Unicode + +9.13.1.3 References +................... + +The Unicode Consortium site(1) has character charts, a glossary, and PDF +versions of the Unicode specification. Be prepared for some difficult +reading. A chronology(2) of the origin and development of Unicode is +also available on the site. + +On the Computerphile Youtube channel, Tom Scott briefly discusses the +history of Unicode and UTF-8(3) (9 minutes 36 seconds). + +To help understand the standard, Jukka Korpela has written an +introductory guide(4) to reading the Unicode character tables. + +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 entries are often helpful; see the entries for “character +encoding(6)” and UTF-8(7), for example. + + ---------- 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’s Unicode Support, Next: Reading and Writing Unicode Data, Prev: Introduction to Unicode, Up: Unicode HOWTO + +9.13.2 Python’s Unicode Support +------------------------------- + +Now that you’ve learned the rudiments of Unicode, we can look at +Python’s Unicode features. + +* Menu: + +* The String Type:: +* Converting to Bytes:: +* Unicode Literals in Python Source Code:: +* Unicode Properties:: +* Comparing Strings:: +* Unicode Regular Expressions:: +* References: References<4>. + + +File: python.info, Node: The String Type, Next: Converting to Bytes, Up: Python’s Unicode Support + +9.13.2.1 The String Type +........................ + +Since Python 3.0, the language’s *note str: 447. type contains Unicode +characters, meaning any string created using ‘"unicode rocks!"’, +‘'unicode rocks!'’, or the triple-quoted string syntax is stored as +Unicode. + +The default encoding for Python source code is UTF-8, so you can simply +include a Unicode character in a string literal: + + try: + with open('/tmp/input.txt', 'r') as f: + ... + except OSError: + # 'File not found' error message. + print("Fichier non trouvé") + +Side note: Python 3 also supports using Unicode characters in +identifiers: + + répertoire = "/tmp/records.log" + with open(répertoire, "w") as f: + f.write("test\n") + +If you can’t enter a particular character in your editor or want to keep +the source code ASCII-only for some reason, you can also use escape +sequences in string literals. (Depending on your system, you may see +the actual capital-delta glyph instead of a u escape.) + + >>> "\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' + +In addition, one can create a string using the *note decode(): 8d5. +method of *note bytes: 1c2. This method takes an 'encoding' argument, +such as ‘UTF-8’, and optionally an 'errors' argument. + +The 'errors' argument specifies the response when the input string can’t +be converted according to the encoding’s rules. Legal values for this +argument are ‘'strict'’ (raise a *note UnicodeDecodeError: a12. +exception), ‘'replace'’ (use ‘U+FFFD’, ‘REPLACEMENT CHARACTER’), +‘'ignore'’ (just leave the character out of the Unicode result), or +‘'backslashreplace'’ (inserts a ‘\xNN’ escape sequence). The following +examples show the differences: + + >>> 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' + +Encodings are specified as strings containing the encoding’s name. +Python comes with roughly 100 different encodings; see the Python +Library Reference at *note Standard Encodings: db8. for a list. Some +encodings have multiple names; for example, ‘'latin-1'’, ‘'iso_8859_1'’ +and ‘'8859’’ are all synonyms for the same encoding. + +One-character Unicode strings can also be created with the *note chr(): +1672. built-in function, which takes integers and returns a Unicode +string of length 1 that contains the corresponding code point. The +reverse operation is the built-in *note ord(): 1ef2. function that takes +a one-character Unicode string and returns the code point value: + + >>> chr(57344) + '\ue000' + >>> ord('\ue000') + 57344 + + +File: python.info, Node: Converting to Bytes, Next: Unicode Literals in Python Source Code, Prev: The String Type, Up: Python’s Unicode Support + +9.13.2.2 Converting to Bytes +............................ + +The opposite method of *note bytes.decode(): 8d5. is *note str.encode(): +8d4, which returns a *note bytes: 1c2. representation of the Unicode +string, encoded in the requested 'encoding'. + +The 'errors' parameter is the same as the parameter of the *note +decode(): 8d5. method but supports a few more possible handlers. As +well as ‘'strict'’, ‘'ignore'’, and ‘'replace'’ (which in this case +inserts a question mark instead of the unencodable character), there is +also ‘'xmlcharrefreplace'’ (inserts an XML character reference), +‘backslashreplace’ (inserts a ‘\uNNNN’ escape sequence) and +‘namereplace’ (inserts a ‘\N{...}’ escape sequence). + +The following example shows the different results: + + >>> 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'ꀀabcd޴' + >>> u.encode('ascii', 'backslashreplace') + b'\\ua000abcd\\u07b4' + >>> u.encode('ascii', 'namereplace') + b'\\N{YI SYLLABLE IT}abcd\\u07b4' + +The low-level routines for registering and accessing the available +encodings are found in the *note codecs: 1b. module. Implementing new +encodings also requires understanding the *note codecs: 1b. module. +However, the encoding and decoding functions returned by this module are +usually more low-level than is comfortable, and writing new encodings is +a specialized task, so the module won’t be covered in this HOWTO. + + +File: python.info, Node: Unicode Literals in Python Source Code, Next: Unicode Properties, Prev: Converting to Bytes, Up: Python’s Unicode Support + +9.13.2.3 Unicode Literals in Python Source Code +............................................... + +In Python source code, specific Unicode code points can be written using +the ‘\u’ escape sequence, which is followed by four hex digits giving +the code point. The ‘\U’ escape sequence is similar, but expects eight +hex digits, not four: + + >>> 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] + +Using escape sequences for code points greater than 127 is fine in small +doses, but becomes an annoyance if you’re using many accented +characters, as you would in a program with messages in French or some +other accent-using language. You can also assemble strings using the +*note chr(): 1672. built-in function, but this is even more tedious. + +Ideally, you’d want to be able to write literals in your language’s +natural encoding. You could then edit Python source code with your +favorite editor which would display the accented characters naturally, +and have the right characters used at runtime. + +Python supports writing source code in UTF-8 by default, but you can use +almost any encoding if you declare the encoding being used. This is +done by including a special comment as either the first or second line +of the source file: + + #!/usr/bin/env python + # -*- coding: latin-1 -*- + + u = 'abcdé' + print(ord(u[-1])) + +The syntax is inspired by Emacs’s notation for specifying variables +local to a file. Emacs supports many different variables, but Python +only supports ‘coding’. The ‘-*-’ symbols indicate to Emacs that the +comment is special; they have no significance to Python but are a +convention. Python looks for ‘coding: name’ or ‘coding=name’ in the +comment. + +If you don’t include such a comment, the default encoding used will be +UTF-8 as already mentioned. See also PEP 263(1) for more information. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0263/ + + +File: python.info, Node: Unicode Properties, Next: Comparing Strings, Prev: Unicode Literals in Python Source Code, Up: Python’s Unicode Support + +9.13.2.4 Unicode Properties +........................... + +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. + +The following program displays some information about several +characters, and prints the numeric value of one particular character: + + 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])) + +When run, this prints: + + 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 + +The category codes are abbreviations describing the nature of the +character. These are grouped into categories such as “Letter”, +“Number”, “Punctuation”, or “Symbol”, which in turn are broken up into +subcategories. To take the codes from the above output, ‘'Ll'’ means +‘Letter, lowercase’, ‘'No'’ means “Number, other”, ‘'Mn'’ is “Mark, +nonspacing”, and ‘'So'’ is “Symbol, other”. See the General Category +Values section of the Unicode Character Database documentation(1) for a +list of category codes. + + ---------- Footnotes ---------- + + (1) https://www.unicode.org/reports/tr44/#General_Category_Values + + +File: python.info, Node: Comparing Strings, Next: Unicode Regular Expressions, Prev: Unicode Properties, Up: Python’s Unicode Support + +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(): dd5. +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: 105. module’s *note normalize(): +6d0. function that converts strings to one of several normal forms, +where letters followed by a combining character are replaced with single +characters. *note normalize(): 6d0. 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)) + +When run, this outputs: + + $ python compare-strs.py + length of first string= 1 + length of second string= 2 + True + +The first argument to the *note normalize(): 6d0. 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(): dd5. 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 Regular Expressions, Next: References<4>, Prev: Comparing Strings, Up: Python’s Unicode Support + +9.13.2.6 Unicode Regular Expressions +.................................... + +The regular expressions supported by the *note re: b9. module can be +provided either as bytes or strings. Some of the special character +sequences such as ‘\d’ and ‘\w’ have different meanings depending on +whether the pattern is supplied as bytes or a string. For example, ‘\d’ +will match the characters ‘[0-9]’ in bytes but in strings will match any +character that’s in the ‘'Nd'’ category. + +The string in this example has the number 57 written in both Thai and +Arabic numerals: + + import re + p = re.compile(r'\d+') + + s = "Over \u0e55\u0e57 57 flavours" + m = p.search(s) + print(repr(m.group())) + +When executed, ‘\d+’ will match the Thai numerals and print them out. +If you supply the *note re.ASCII: 628. flag to *note compile(): bd3, +‘\d+’ will match the substring “57” instead. + +Similarly, ‘\w’ matches a wide variety of Unicode characters but only +‘[a-zA-Z0-9_]’ in bytes or if *note re.ASCII: 628. is supplied, and ‘\s’ +will match either Unicode whitespace characters or ‘[ \t\n\r\f\v]’. + + +File: python.info, Node: References<4>, Prev: Unicode Regular Expressions, Up: Python’s Unicode Support + +9.13.2.7 References +................... + +Some good alternative discussions of Python’s Unicode support are: + + * Processing Text Files in Python 3(1), by Nick Coghlan. + + * Pragmatic Unicode(2), a PyCon 2012 presentation by Ned Batchelder. + +The *note str: 447. type is described in the Python library reference at +*note Text Sequence Type — str: 1bfc. + +The documentation for the *note unicodedata: 105. module. + +The documentation for the *note codecs: 1b. module. + +Marc-André Lemburg gave a presentation titled "Python and Unicode" (PDF +slides)(3) at EuroPython 2002. The slides are an excellent overview of +the design of Python 2’s Unicode features (where the Unicode string type +is called ‘unicode’ and literals start with ‘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: Reading and Writing Unicode Data, Next: Acknowledgements<10>, Prev: Python’s Unicode Support, Up: Unicode HOWTO + +9.13.3 Reading and Writing Unicode Data +--------------------------------------- + +Once you’ve written some code that works with Unicode data, the next +problem is input/output. How do you get Unicode strings into your +program, and how do you convert Unicode into a form suitable for storage +or transmission? + +It’s possible that you may not need to do anything depending on your +input sources and output destinations; you should check whether the +libraries used in your application support Unicode natively. XML +parsers often return Unicode data, for example. Many relational +databases also support Unicode-valued columns and can return Unicode +values from an SQL query. + +Unicode data is usually converted to a particular encoding before it +gets written to disk or sent over a socket. It’s possible to do all the +work yourself: open a file, read an 8-bit bytes object from it, and +convert the bytes with ‘bytes.decode(encoding)’. However, the manual +approach is not recommended. + +One problem is the multi-byte nature of encodings; one Unicode character +can be represented by several bytes. If you want to read the file in +arbitrary-sized chunks (say, 1024 or 4096 bytes), you need to write +error-handling code to catch the case where only part of the bytes +encoding a single Unicode character are read at the end of a chunk. One +solution would be to read the entire file into memory and then perform +the decoding, but that prevents you from working with files that are +extremely large; if you need to read a 2 GiB file, you need 2 GiB of +RAM. (More, really, since for at least a moment you’d need to have both +the encoded string and its Unicode version in memory.) + +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(): 517. 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(): 1c85. and *note write(): 1c74. This works through *note +open(): 517.'s 'encoding' and 'errors' parameters which are interpreted +just like those in *note str.encode(): 8d4. and *note bytes.decode(): +8d5. + +Reading Unicode from a file is therefore simple: + + with open('unicode.txt', encoding='utf-8') as f: + for line in f: + print(repr(line)) + +It’s also possible to open files in update mode, allowing both reading +and writing: + + 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])) + +The Unicode character ‘U+FEFF’ is used as a byte-order mark (BOM), and +is often written as the first character of a file in order to assist +with autodetection of the file’s byte ordering. Some encodings, such as +UTF-16, expect a BOM to be present at the start of a file; when such an +encoding is used, the BOM will be automatically written as the first +character and will be silently dropped when the file is read. There are +variants of these encodings, such as ‘utf-16-le’ and ‘utf-16-be’ for +little-endian and big-endian encodings, that specify one particular byte +ordering and don’t skip the 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 filenames:: +* Tips for Writing Unicode-aware Programs:: +* References: References<5>. + + +File: python.info, Node: Unicode filenames, Next: Tips for Writing Unicode-aware Programs, Up: Reading and Writing Unicode Data + +9.13.3.1 Unicode filenames +.......................... + +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: 537. if you’ve set the ‘LANG’ or ‘LC_CTYPE’ +environment variables; if you haven’t, the default encoding is again +UTF-8. + +The *note sys.getfilesystemencoding(): c59. function returns the +encoding to use on your current system, in case you want to do the +encoding manually, but there’s not much reason to bother. When opening +a file for reading or writing, you can usually just provide the Unicode +string as the filename, and it will be automatically converted to the +right encoding for you: + + filename = 'filename\u4500abc' + with open(filename, 'w') as f: + f.write('blah\n') + +Functions in the *note os: a1. module such as *note os.stat(): 49c. will +also accept Unicode filenames. + +The *note os.listdir(): 10ee. function returns filenames, which raises +an issue: should it return the Unicode version of filenames, or should +it return bytes containing the encoded versions? *note os.listdir(): +10ee. 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: 537. 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('.')) + +will produce the following output: + + $ python listdir-test.py + [b'filename\xe4\x94\x80abc', ...] + ['filename\u4500abc', ...] + +The first list contains UTF-8-encoded filenames, and the second list +contains the Unicode versions. + +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: Tips for Writing Unicode-aware Programs, Next: References<5>, Prev: Unicode filenames, Up: Reading and Writing Unicode Data + +9.13.3.2 Tips for Writing Unicode-aware Programs +................................................ + +This section provides some suggestions on writing software that deals +with Unicode. + +The most important tip is: + + Software should only work with Unicode strings internally, decoding + the input data as soon as possible and encoding the output only at + the end. + +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: +534. will be raised. + +When using data coming from a web browser or some other untrusted +source, a common technique is to check for illegal characters in a +string before using the string in a generated command line or storing it +in a database. If you’re doing this, be careful to check the decoded +string, not the encoded bytes data; some encodings may have interesting +properties, such as not being bijective or not being fully +ASCII-compatible. This is especially true if the input data also +specifies the encoding, since the attacker can then choose a clever way +to hide malicious text in the encoded bytestream. + +* Menu: + +* Converting Between File Encodings:: +* Files in an Unknown Encoding:: + + +File: python.info, Node: Converting Between File Encodings, Next: Files in an Unknown Encoding, Up: Tips for Writing Unicode-aware Programs + +9.13.3.3 Converting Between File Encodings +.......................................... + +The *note StreamRecoder: 19f0. 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: 19f0. 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: Files in an Unknown Encoding, Prev: Converting Between File Encodings, Up: Tips for Writing Unicode-aware Programs + +9.13.3.4 Files in an Unknown Encoding +..................................... + +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: References<5>, Prev: Tips for Writing Unicode-aware Programs, Up: Reading and Writing Unicode Data + +9.13.3.5 References +................... + +One section of Mastering Python 3 Input/Output(1), a PyCon 2010 talk by +David Beazley, discusses text processing and binary data handling. + +The PDF slides for Marc-André Lemburg's presentation "Writing +Unicode-aware Applications in Python"(2) discuss questions of character +encodings as well as how to internationalize and localize an +application. These slides cover Python 2.x only. + +The Guts of Unicode in Python(3) 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://downloads.egenix.com/python/LSM2005-Developing-Unicode-aware-applications-in-Python.pdf + + (3) https://pyvideo.org/video/1768/the-guts-of-unicode-in-python + + +File: python.info, Node: Acknowledgements<10>, Prev: Reading and Writing Unicode Data, Up: Unicode HOWTO + +9.13.4 Acknowledgements +----------------------- + +The initial draft of this document was written by Andrew Kuchling. It +has since been revised further by Alexander Belopolsky, Georg Brandl, +Andrew Kuchling, and Ezio Melotti. + +Thanks to the following people who have noted errors or offered +suggestions on this article: É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: HOWTO Fetch Internet Resources Using The urllib Package, Next: An introduction to the ipaddress module, Prev: Unicode HOWTO, Up: Python HOWTOs + +9.14 HOWTO Fetch Internet Resources Using The urllib Package +============================================================ + + +Author: Michael Foord(1) + +* Menu: + +* Introduction: Introduction<16>. +* Fetching URLs:: +* Handling Exceptions: Handling Exceptions<2>. +* info and geturl:: +* Openers and Handlers:: +* Basic Authentication:: +* Proxies:: +* Sockets and Layers:: +* Footnotes:: + + ---------- Footnotes ---------- + + (1) https://agileabstractions.com/ + + +File: python.info, Node: Introduction<16>, Next: Fetching URLs, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.1 Introduction +------------------- + +Related Articles +................ + +You may also find useful the following article on fetching web resources +with Python: + + * Basic Authentication(1) + + A tutorial on 'Basic Authentication', with examples in Python. + +'urllib.request' is a Python module for fetching URLs (Uniform Resource +Locators). It offers a very simple interface, in the form of the +'urlopen' function. This is capable of fetching URLs using a variety of +different protocols. It also offers a slightly more complex interface +for handling common situations - like basic authentication, cookies, +proxies and so on. These are provided by objects called handlers and +openers. + +urllib.request supports fetching URLs for many “URL schemes” (identified +by the string before the ‘":"’ in URL - for example ‘"ftp"’ is the URL +scheme of ‘"ftp://python.org/"’) using their associated network +protocols (e.g. FTP, HTTP). This tutorial focuses on the most common +case, HTTP. + +For straightforward situations 'urlopen' is very easy to use. But as +soon as you encounter errors or non-trivial cases when opening HTTP +URLs, you will need some understanding of the HyperText Transfer +Protocol. The most comprehensive and authoritative reference to HTTP is +RFC 2616(2). This is a technical document and not intended to be easy +to read. This HOWTO aims to illustrate using 'urllib', with enough +detail about HTTP to help you through. It is not intended to replace +the *note urllib.request: 10b. docs, but is supplementary to them. + + ---------- 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: Fetching URLs, Next: Handling Exceptions<2>, Prev: Introduction<16>, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.2 Fetching URLs +-------------------- + +The simplest way to use urllib.request is as follows: + + import urllib.request + with urllib.request.urlopen('http://python.org/') as response: + html = response.read() + +If you wish to retrieve a resource via URL and store it in a temporary +location, you can do so via the *note shutil.copyfileobj(): a5c. and +*note tempfile.NamedTemporaryFile(): 4c2. functions: + + 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 + +Many uses of urllib will be that simple (note that instead of an ‘http:’ +URL we could have used a URL starting with ‘ftp:’, ‘file:’, etc.). +However, it’s the purpose of this tutorial to explain the more +complicated cases, concentrating on HTTP. + +HTTP is based on requests and responses - the client makes requests and +servers send responses. urllib.request mirrors this with a ‘Request’ +object which represents the HTTP request you are making. In its +simplest form you create a Request object that specifies the URL you +want to fetch. Calling ‘urlopen’ with this Request object returns a +response object for the URL requested. This response is a file-like +object, which means you can for example call ‘.read()’ on the response: + + import urllib.request + + req = urllib.request.Request('http://python.org/') + with urllib.request.urlopen(req) as response: + the_page = response.read() + +Note that urllib.request makes use of the same Request interface to +handle all URL schemes. For example, you can make an FTP request like +so: + + req = urllib.request.Request('ftp://example.com/') + +In the case of HTTP, there are two extra things that Request objects +allow you to do: First, you can pass data to be sent to the server. +Second, you can pass extra information (“metadata”) 'about' the data or +about the request itself, to the server - this information is sent as +HTTP “headers”. Let’s look at each of these in turn. + +* Menu: + +* Data:: +* Headers:: + + +File: python.info, Node: Data, Next: Headers, Up: Fetching URLs + +9.14.2.1 Data +............. + +Sometimes you want to send data to a URL (often the URL will refer to a +CGI (Common Gateway Interface) script or other web application). With +HTTP, this is often done using what’s known as a 'POST' request. This +is often what your browser does when you submit a HTML form that you +filled in on the web. Not all POSTs have to come from forms: you can +use a POST to transmit arbitrary data to your own application. In the +common case of HTML forms, the data needs to be encoded in a standard +way, and then passed to the Request object as the ‘data’ argument. The +encoding is done using a function from the *note urllib.parse: 10a. +library. + + 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() + +Note that other encodings are sometimes required (e.g. for file upload +from HTML forms - see HTML Specification, Form Submission(1) for more +details). + +If you do not pass the ‘data’ argument, urllib uses a 'GET' request. +One way in which GET and POST requests differ is that POST requests +often have “side-effects”: they change the state of the system in some +way (for example by placing an order with the website for a +hundredweight of tinned spam to be delivered to your door). Though the +HTTP standard makes it clear that POSTs are intended to 'always' cause +side-effects, and GET requests 'never' to cause side-effects, nothing +prevents a GET request from having side-effects, nor a POST requests +from having no side-effects. Data can also be passed in an HTTP GET +request by encoding it in the URL itself. + +This is done as follows: + + >>> 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) + +Notice that the full URL is created by adding a ‘?’ to the URL, followed +by the encoded values. + + ---------- Footnotes ---------- + + (1) https://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13 + + +File: python.info, Node: Headers, Prev: Data, Up: Fetching URLs + +9.14.2.2 Headers +................ + +We’ll discuss here one particular HTTP header, to illustrate how to add +headers to your HTTP request. + +Some websites (1) dislike being browsed by programs, or send different +versions to different browsers (2). By default urllib identifies itself +as ‘Python-urllib/x.y’ (where ‘x’ and ‘y’ are the major and minor +version numbers of the Python release, e.g. ‘Python-urllib/2.5’), which +may confuse the site, or just plain not work. The way a browser +identifies itself is through the ‘User-Agent’ header (3). When you +create a Request object you can pass a dictionary of headers in. The +following example makes the same request as above, but identifies itself +as a version of 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() + +The response also has two useful methods. See the section on *note info +and geturl: 5043. which comes after we have a look at what happens when +things go wrong. + + ---------- Footnotes ---------- + + (1) Google for example. + + (2) Browser sniffing is a very bad practice for website design - +building sites using web standards is much more sensible. Unfortunately +a lot of sites still send different versions to different browsers. + + (3) The user agent for MSIE 6 is '‘Mozilla/4.0 (compatible; MSIE 6.0; +Windows NT 5.1; SV1; .NET CLR 1.1.4322)’' + + (4) For details of more HTTP request headers, see Quick Reference to +HTTP Headers (https://jkorpela.fi/http.html). + + +File: python.info, Node: Handling Exceptions<2>, Next: info and geturl, Prev: Fetching URLs, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.3 Handling Exceptions +-------------------------- + +'urlopen' raises *note URLError: 399c. when it cannot handle a response +(though as usual with Python APIs, built-in exceptions such as *note +ValueError: 204, *note TypeError: 534. etc. may also be raised). + +*note HTTPError: fd9. is the subclass of *note URLError: 399c. raised in +the specific case of HTTP URLs. + +The exception classes are exported from the *note urllib.error: 109. +module. + +* Menu: + +* URLError:: +* HTTPError:: +* Wrapping it Up:: + + +File: python.info, Node: URLError, Next: HTTPError, Up: Handling Exceptions<2> + +9.14.3.1 URLError +................. + +Often, URLError is raised because there is no network connection (no +route to the specified server), or the specified server doesn’t exist. +In this case, the exception raised will have a ‘reason’ attribute, which +is a tuple containing an error code and a text error message. + +e.g. + + >>> 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: Wrapping it Up, Prev: URLError, Up: Handling Exceptions<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: fd9. Typical errors include ‘404’ (page not found), ‘403’ +(request forbidden), and ‘401’ (authentication required). + +See section 10 of RFC 2616(1) for a reference on all the HTTP error +codes. + +The *note HTTPError: fd9. instance raised will have an integer ‘code’ +attribute, which corresponds to the error sent by the server. + +* Menu: + +* Error Codes:: + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2616.html + + +File: python.info, Node: Error Codes, Up: HTTPError + +9.14.3.3 Error Codes +.................... + +Because the default handlers handle redirects (codes in the 300 range), +and codes in the 100–299 range indicate success, you will usually only +see error codes in the 400–599 range. + +*note http.server.BaseHTTPRequestHandler.responses: 3a3a. 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 = { + ... + : ('OK', 'Request fulfilled, document follows'), + ... + : ('Forbidden', + 'Request forbidden -- authorization will ' + 'not help'), + : ('Not Found', + 'Nothing matches the given URI'), + ... + : ("I'm a Teapot", + 'Server refuses to brew coffee because ' + 'it is a teapot'), + ... + : ('Service Unavailable', + 'The server cannot process the ' + 'request due to a high load'), + ... + } + +When an error is raised the server responds by returning an HTTP error +code 'and' an error page. You can use the *note HTTPError: fd9. +instance as a response on the page returned. This means that as well as +the code attribute, it also has read, geturl, and info, methods as +returned by the ‘urllib.response’ module: + + >>> 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'\n\n\nPage Not Found\n + ... + + ---------- Footnotes ---------- + + (1) https://datatracker.ietf.org/doc/html/rfc2616.html + + +File: python.info, Node: Wrapping it Up, Prev: HTTPError, Up: Handling Exceptions<2> + +9.14.3.4 Wrapping it Up +....................... + +So if you want to be prepared for *note HTTPError: fd9. 'or' *note +URLError: 399c. there are two basic approaches. I prefer the second +approach. + +* Menu: + +* Number 1:: +* Number 2:: + + +File: python.info, Node: Number 1, Next: Number 2, Up: Wrapping it Up + +9.14.3.5 Number 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 + + Note: The ‘except HTTPError’ 'must' come first, otherwise ‘except + URLError’ will 'also' catch an *note HTTPError: fd9. + + +File: python.info, Node: Number 2, Prev: Number 1, Up: Wrapping it Up + +9.14.3.6 Number 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 and geturl, Next: Openers and Handlers, Prev: Handling Exceptions<2>, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.4 info and geturl +---------------------- + +The response returned by urlopen (or the *note HTTPError: fd9. instance) +has two useful methods ‘info()’ and ‘geturl()’ and is defined in the +module *note urllib.response: 10c. + + * 'geturl' - this returns the real URL of the page fetched. This is + useful because ‘urlopen’ (or the opener object used) may have + followed a redirect. The URL of the page fetched may not be the + same as the URL requested. + + * 'info' - this returns a dictionary-like object that describes the + page fetched, particularly the headers sent by the server. It is + currently an *note http.client.HTTPMessage: 3a51. instance. + +Typical headers include ‘Content-length’, ‘Content-type’, and so on. +See the Quick Reference to HTTP Headers(1) for a useful listing of HTTP +headers with brief explanations of their meaning and use. + + ---------- Footnotes ---------- + + (1) https://jkorpela.fi/http.html + + +File: python.info, Node: Openers and Handlers, Next: Basic Authentication, Prev: info and geturl, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.5 Openers and Handlers +--------------------------- + +When you fetch a URL you use an opener (an instance of the perhaps +confusingly named *note urllib.request.OpenerDirector: 399d.). Normally +we have been using the default opener - via ‘urlopen’ - but you can +create custom openers. Openers use handlers. All the “heavy lifting” +is done by the handlers. Each handler knows how to open URLs for a +particular URL scheme (http, ftp, etc.), or how to handle an aspect of +URL opening, for example HTTP redirections or HTTP cookies. + +You will want to create openers if you want to fetch URLs with specific +handlers installed, for example to get an opener that handles cookies, +or to get an opener that does not handle redirections. + +To create an opener, instantiate an ‘OpenerDirector’, and then call +‘.add_handler(some_handler_instance)’ repeatedly. + +Alternatively, you can use ‘build_opener’, which is a convenience +function for creating opener objects with a single function call. +‘build_opener’ adds several handlers by default, but provides a quick +way to add more and/or override the default handlers. + +Other sorts of handlers you might want to can handle proxies, +authentication, and other common but slightly specialised situations. + +‘install_opener’ can be used to make an ‘opener’ object the (global) +default opener. This means that calls to ‘urlopen’ will use the opener +you have installed. + +Opener objects have an ‘open’ method, which can be called directly to +fetch urls in the same way as the ‘urlopen’ function: there’s no need to +call ‘install_opener’, except as a convenience. + + +File: python.info, Node: Basic Authentication, Next: Proxies, Prev: Openers and Handlers, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.6 Basic Authentication +--------------------------- + +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). + +When authentication is required, the server sends a header (as well as +the 401 error code) requesting authentication. This specifies the +authentication scheme and a ‘realm’. The header looks like: +‘WWW-Authenticate: SCHEME realm="REALM"’. + +e.g. + + WWW-Authenticate: Basic realm="cPanel Users" + +The client should then retry the request with the appropriate name and +password for the realm included as a header in the request. This is +‘basic authentication’. In order to simplify this process we can create +an instance of ‘HTTPBasicAuthHandler’ and an opener to use this handler. + +The ‘HTTPBasicAuthHandler’ uses an object called a password manager to +handle the mapping of URLs and realms to passwords and usernames. If +you know what the realm is (from the authentication header sent by the +server), then you can use a ‘HTTPPasswordMgr’. Frequently one doesn’t +care what the realm is. In that case, it is convenient to use +‘HTTPPasswordMgrWithDefaultRealm’. This allows you to specify a default +username and password for a URL. This will be supplied in the absence of +you providing an alternative combination for a specific realm. We +indicate this by providing ‘None’ as the realm argument to the +‘add_password’ method. + +The top-level URL is the first URL that requires authentication. URLs +“deeper” than the URL you pass to .add_password() will also match. + + # 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) + + Note: 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’ is in fact 'either' a full URL (including the ‘http:’ +scheme component and the hostname and optionally the port number) e.g. +‘"http://example.com/"’ 'or' an “authority” (i.e. the hostname, +optionally including the port number) e.g. ‘"example.com"’ or +‘"example.com:8080"’ (the latter example includes a port number). The +authority, if present, must NOT contain the “userinfo” component - for +example ‘"joe:password@example.com"’ is not correct. + + ---------- Footnotes ---------- + + (1) +https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml + + +File: python.info, Node: Proxies, Next: Sockets and Layers, Prev: Basic Authentication, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.7 Proxies +-------------- + +'urllib' will auto-detect your proxy settings and use those. This is +through the ‘ProxyHandler’, which is part of the normal handler chain +when a proxy setting is detected. Normally that’s a good thing, but +there are occasions when it may not be helpful (1). One way to do this +is to setup our own ‘ProxyHandler’, with no proxies defined. This is +done using similar steps to setting up a Basic Authentication(2) +handler: + + >>> proxy_support = urllib.request.ProxyHandler({}) + >>> opener = urllib.request.build_opener(proxy_support) + >>> urllib.request.install_opener(opener) + + Note: Currently ‘urllib.request’ 'does not' support fetching of + ‘https’ locations through a proxy. However, this can be enabled by + extending urllib.request as shown in the recipe (3). + + Note: ‘HTTP_PROXY’ will be ignored if a variable ‘REQUEST_METHOD’ + is set; see the documentation on *note getproxies(): 3999. + + ---------- Footnotes ---------- + + (1) In my case I have to use a proxy to access the internet at work. +If you attempt to fetch 'localhost' URLs through this proxy it blocks +them. IE is set to use the proxy, which urllib picks up on. In order +to test scripts with a localhost server, I have to prevent urllib from +using the proxy. + + (2) +https://web.archive.org/web/20201215133350/http://www.voidspace.org.uk/python/articles/authentication.shtml + + (3) 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: Sockets and Layers, Next: Footnotes, Prev: Proxies, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.8 Sockets and Layers +------------------------- + +The Python support for fetching resources from the web is layered. +urllib uses the *note http.client: 6f. library, which in turn uses the +socket library. + +As of Python 2.3 you can specify how long a socket should wait for a +response before timing out. This can be useful in applications which +have to fetch web pages. By default the socket module has 'no timeout' +and can hang. Currently, the socket timeout is not exposed at the +http.client or urllib.request levels. However, you can set the default +timeout globally for all sockets using + + 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: Footnotes, Prev: Sockets and Layers, Up: HOWTO Fetch Internet Resources Using The urllib Package + +9.14.9 Footnotes +---------------- + +This document was reviewed and revised by John Lee. + + +File: python.info, Node: An introduction to the ipaddress module, Next: Instrumenting CPython with DTrace and SystemTap, Prev: HOWTO Fetch Internet Resources Using The urllib Package, Up: Python HOWTOs + +9.15 An introduction to the ipaddress module +============================================ + + +author: Peter Moody + + +author: Nick Coghlan + +Overview +........ + +This document aims to provide a gentle introduction to the *note +ipaddress: 80. module. It is aimed primarily at users that aren’t +already familiar with IP networking terminology, but may also be useful +to network engineers wanting an overview of how *note ipaddress: 80. +represents IP network addressing concepts. + +* Menu: + +* Creating Address/Network/Interface objects:: +* Inspecting Address/Network/Interface Objects:: +* Networks as lists of Addresses:: +* Comparisons: Comparisons<4>. +* Using IP Addresses with other modules:: +* Getting more detail when instance creation fails:: + + +File: python.info, Node: Creating Address/Network/Interface objects, Next: Inspecting Address/Network/Interface Objects, Up: An introduction to the ipaddress module + +9.15.1 Creating Address/Network/Interface objects +------------------------------------------------- + +Since *note ipaddress: 80. is a module for inspecting and manipulating +IP addresses, the first thing you’ll want to do is create some objects. +You can use *note ipaddress: 80. to create objects from strings and +integers. + +* Menu: + +* A Note on IP Versions:: +* IP Host Addresses:: +* Defining Networks:: +* Host Interfaces:: + + +File: python.info, Node: A Note on IP Versions, Next: IP Host Addresses, Up: Creating Address/Network/Interface objects + +9.15.1.1 A Note on IP Versions +.............................. + +For readers that aren’t particularly familiar with IP addressing, it’s +important to know that the Internet Protocol (IP) is currently in the +process of moving from version 4 of the protocol to version 6. This +transition is occurring largely because version 4 of the protocol +doesn’t provide enough addresses to handle the needs of the whole world, +especially given the increasing number of devices with direct +connections to the internet. + +Explaining the details of the differences between the two versions of +the protocol is beyond the scope of this introduction, but readers need +to at least be aware that these two versions exist, and it will +sometimes be necessary to force the use of one version or the other. + + +File: python.info, Node: IP Host Addresses, Next: Defining Networks, Prev: A Note on IP Versions, Up: Creating Address/Network/Interface objects + +9.15.1.2 IP Host Addresses +.......................... + +Addresses, often referred to as “host addresses” are the most basic unit +when working with IP addressing. The simplest way to create addresses +is to use the *note ipaddress.ip_address(): 3c41. factory function, +which automatically determines whether to create an IPv4 or IPv6 address +based on the passed in value: + + >>> ipaddress.ip_address('192.0.2.1') + IPv4Address('192.0.2.1') + >>> ipaddress.ip_address('2001:DB8::1') + IPv6Address('2001:db8::1') + +Addresses can also be created directly from integers. Values that will +fit within 32 bits are assumed to be IPv4 addresses: + + >>> ipaddress.ip_address(3221225985) + IPv4Address('192.0.2.1') + >>> ipaddress.ip_address(42540766411282592856903984951653826561) + IPv6Address('2001:db8::1') + +To force the use of IPv4 or IPv6 addresses, the relevant classes can be +invoked directly. This is particularly useful to force creation of IPv6 +addresses for small integers: + + >>> 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: Defining Networks, Next: Host Interfaces, Prev: IP Host Addresses, Up: Creating Address/Network/Interface objects + +9.15.1.3 Defining Networks +.......................... + +Host addresses are usually grouped together into IP networks, so *note +ipaddress: 80. provides a way to create, inspect and manipulate network +definitions. IP network objects are constructed from strings that +define the range of host addresses that are part of that network. The +simplest form for that information is a “network address/network prefix” +pair, where the prefix defines the number of leading bits that are +compared to determine whether or not an address is part of the network +and the network address defines the expected value of those bits. + +As for addresses, a factory function is provided that determines the +correct IP version automatically: + + >>> 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') + +Network objects cannot have any host bits set. The practical effect of +this is that ‘192.0.2.1/24’ does not describe a network. Such +definitions are referred to as interface objects since the +ip-on-a-network notation is commonly used to describe network interfaces +of a computer on a given network and are described further in the next +section. + +By default, attempting to create a network object with host bits set +will result in *note ValueError: 204. being raised. To request that the +additional bits instead be coerced to zero, the flag ‘strict=False’ can +be passed to the constructor: + + >>> 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') + +While the string form offers significantly more flexibility, networks +can also be defined with integers, just like host addresses. In this +case, the network is considered to contain only the single address +identified by the integer, so the network prefix includes the entire +network address: + + >>> ipaddress.ip_network(3221225984) + IPv4Network('192.0.2.0/32') + >>> ipaddress.ip_network(42540766411282592856903984951653826560) + IPv6Network('2001:db8::/128') + +As with addresses, creation of a particular kind of network can be +forced by calling the class constructor directly instead of using the +factory function. + + +File: python.info, Node: Host Interfaces, Prev: Defining Networks, Up: Creating Address/Network/Interface objects + +9.15.1.4 Host Interfaces +........................ + +As mentioned just above, if you need to describe an address on a +particular network, neither the address nor the network classes are +sufficient. Notation like ‘192.0.2.1/24’ is commonly used by network +engineers and the people who write tools for firewalls and routers as +shorthand for “the host ‘192.0.2.1’ on the network ‘192.0.2.0/24’”, +Accordingly, *note ipaddress: 80. provides a set of hybrid classes that +associate an address with a particular network. The interface for +creation is identical to that for defining network objects, except that +the address portion isn’t constrained to being a network address. + + >>> 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') + +Integer inputs are accepted (as with networks), and use of a particular +IP version can be forced by calling the relevant constructor directly. + + +File: python.info, Node: Inspecting Address/Network/Interface Objects, Next: Networks as lists of Addresses, Prev: Creating Address/Network/Interface objects, Up: An introduction to the ipaddress module + +9.15.2 Inspecting Address/Network/Interface Objects +--------------------------------------------------- + +You’ve gone to the trouble of creating an +IPv(4|6)(Address|Network|Interface) object, so you probably want to get +information about it. *note ipaddress: 80. tries to make doing this +easy and intuitive. + +Extracting the IP version: + + >>> addr4 = ipaddress.ip_address('192.0.2.1') + >>> addr6 = ipaddress.ip_address('2001:db8::1') + >>> addr6.version + 6 + >>> addr4.version + 4 + +Obtaining the network from an interface: + + >>> 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') + +Finding out how many individual addresses are in a network: + + >>> 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 + +Iterating through the “usable” addresses on a network: + + >>> 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 + +Obtaining the netmask (i.e. set bits corresponding to the network +prefix) or the hostmask (any bits that are not part of the netmask): + + >>> 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') + +Exploding or compressing the address: + + >>> 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' + +While IPv4 doesn’t support explosion or compression, the associated +objects still provide the relevant properties so that version neutral +code can easily ensure the most concise or most verbose form is used for +IPv6 addresses while still correctly handling IPv4 addresses. + + +File: python.info, Node: Networks as lists of Addresses, Next: Comparisons<4>, Prev: Inspecting Address/Network/Interface Objects, Up: An introduction to the ipaddress module + +9.15.3 Networks as lists of Addresses +------------------------------------- + +It’s sometimes useful to treat networks as lists. This means it is +possible to index them like this: + + >>> 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') + +It also means that network objects lend themselves to using the list +membership test syntax like this: + + if address in network: + # do something + +Containment testing is done efficiently based on the network prefix: + + >>> 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: Comparisons<4>, Next: Using IP Addresses with other modules, Prev: Networks as lists of Addresses, Up: An introduction to the ipaddress module + +9.15.4 Comparisons +------------------ + +*note ipaddress: 80. provides some simple, hopefully intuitive ways to +compare objects, where it makes sense: + + >>> ipaddress.ip_address('192.0.2.1') < ipaddress.ip_address('192.0.2.2') + True + +A *note TypeError: 534. exception is raised if you try to compare +objects of different versions or different types. + + +File: python.info, Node: Using IP Addresses with other modules, Next: Getting more detail when instance creation fails, Prev: Comparisons<4>, Up: An introduction to the ipaddress module + +9.15.5 Using IP Addresses with other modules +-------------------------------------------- + +Other modules that use IP addresses (such as *note socket: cc.) usually +won’t accept objects from this module directly. Instead, they must be +coerced to an integer or string that the other module will accept: + + >>> addr4 = ipaddress.ip_address('192.0.2.1') + >>> str(addr4) + '192.0.2.1' + >>> int(addr4) + 3221225985 + + +File: python.info, Node: Getting more detail when instance creation fails, Prev: Using IP Addresses with other modules, Up: An introduction to the ipaddress module + +9.15.6 Getting more detail when instance creation fails +------------------------------------------------------- + +When creating address/network/interface objects using the +version-agnostic factory functions, any errors will be reported as *note +ValueError: 204. with a generic error message that simply says the +passed in value was not recognized as an object of that type. The lack +of a specific error is because it’s necessary to know whether the value +is 'supposed' to be IPv4 or IPv6 in order to provide more detail on why +it has been rejected. + +To support use cases where it is useful to have access to this +additional detail, the individual class constructors actually raise the +*note ValueError: 204. subclasses *note ipaddress.AddressValueError: +3c46. and *note ipaddress.NetmaskValueError: 3c68. to indicate exactly +which part of the definition failed to parse correctly. + +The error messages are significantly more detailed when using the class +constructors directly. For example: + + >>> 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 + +However, both of the module specific exceptions have *note ValueError: +204. as their parent class, so if you’re not concerned with the +particular type of error, you can still write code like the following: + + try: + network = ipaddress.IPv4Network(address) + except ValueError: + print('address/netmask is invalid for IPv4:', address) + + +File: python.info, Node: Instrumenting CPython with DTrace and SystemTap, Next: Python support for the Linux perf profiler, Prev: An introduction to the ipaddress module, Up: Python HOWTOs + +9.16 Instrumenting CPython with DTrace and SystemTap +==================================================== + + +author: David Malcolm + + +author: Łukasz Langa + +DTrace and SystemTap are monitoring tools, each providing a way to +inspect what the processes on a computer system are doing. They both +use domain-specific languages allowing a user to write scripts which: + + - filter which processes are to be observed + + - gather data from the processes of interest + + - generate reports on the data + +As of Python 3.6, CPython can be built with embedded “markers”, also +known as “probes”, that can be observed by a DTrace or SystemTap script, +making it easier to monitor what the CPython processes on a system are +doing. + +'CPython implementation detail:' DTrace markers are implementation +details of the CPython interpreter. No guarantees are made about probe +compatibility between versions of CPython. DTrace scripts can stop +working or work incorrectly without warning when changing CPython +versions. + +* Menu: + +* Enabling the static markers:: +* Static DTrace probes:: +* Static SystemTap markers:: +* Available static markers:: +* SystemTap Tapsets:: +* Examples: Examples<39>. + + +File: python.info, Node: Enabling the static markers, Next: Static DTrace probes, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.1 Enabling the static markers +---------------------------------- + +macOS comes with built-in support for DTrace. On Linux, in order to +build CPython with the embedded markers for SystemTap, the SystemTap +development tools must be installed. + +On a Linux machine, this can be done via: + + $ yum install systemtap-sdt-devel + +or: + + $ sudo apt-get install systemtap-sdt-dev + +CPython must then be *note configured with the -with-dtrace option: +1db7.: + + 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: 85f. 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 + +Sufficiently modern readelf can print the metadata: + + $ 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: Static DTrace probes, Next: Static SystemTap markers, Prev: Enabling the static markers, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.2 Static DTrace probes +--------------------------- + +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; + } + +It can be invoked like this: + + $ sudo dtrace -q -s call_stack.d -c "python3.6 script.py" + +The output looks like this: + + 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: Static SystemTap markers, Next: Available static markers, Prev: Static DTrace probes, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.3 Static SystemTap markers +------------------------------- + +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. + +For example, this SystemTap script can be used to show the call/return +hierarchy of a Python script: + + 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); + } + +It can be invoked like this: + + $ stap \ + show-call-hierarchy.stp \ + -c "./python test.py" + +The output looks like this: + + 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 + +where the columns are: + + - time in microseconds since start of script + + - name of executable + + - PID of process + +and the remainder indicates the call/return hierarchy as the script +executes. + +For a *note -enable-shared: 85f. 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: 1fb. of CPython 3.6) + + +File: python.info, Node: Available static markers, Next: SystemTap Tapsets, Prev: Static SystemTap markers, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.4 Available static markers +------------------------------- + + -- Object: function__entry(str filename, str funcname, int lineno) + + This marker indicates that execution of a Python function has + begun. It is only triggered for pure-Python (bytecode) functions. + + The filename, function name, and line number are provided back to + the tracing script as positional arguments, which must be accessed + using ‘$arg1’, ‘$arg2’, ‘$arg3’: + + * ‘$arg1’ : ‘(const char *)’ filename, accessible using + ‘user_string($arg1)’ + + * ‘$arg2’ : ‘(const char *)’ function name, accessible + using ‘user_string($arg2)’ + + * ‘$arg3’ : ‘int’ line number + + -- 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) + + This marker indicates a Python line is about to be executed. It is + the equivalent of line-by-line tracing with a Python profiler. It + is not triggered within C functions. + + 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(): + a39. + + -- Object: gc__done(long collected) + + Fires when the Python interpreter finishes a garbage collection + cycle. ‘arg0’ is the number of collected objects. + + -- Object: import__find__load__start(str modulename) + + Fires before *note importlib: 77. 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: 77.’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(): 15b9. or *note PySys_Audit(): 36a. is + called. ‘arg0’ is the event name as C string, ‘arg1’ is a *note + PyObject: 334. pointer to a tuple object. + + Added in version 3.8. + + +File: python.info, Node: SystemTap Tapsets, Next: Examples<39>, Prev: Available static markers, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.5 SystemTap Tapsets +------------------------ + +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: Examples<39>, Prev: SystemTap Tapsets, Up: Instrumenting CPython with DTrace and SystemTap + +9.16.6 Examples +--------------- + +This SystemTap script uses the tapset above to more cleanly implement +the example given above of tracing the Python function-call hierarchy, +without needing to directly name the static markers: + + probe python.function.entry + { + printf("%s => %s in %s:%d\n", + thread_indent(1), funcname, filename, lineno); + } + + probe python.function.return + { + printf("%s <= %s in %s:%d\n", + thread_indent(-1), funcname, filename, lineno); + } + +The following script uses the tapset above to provide a top-like view of +all running CPython code, showing the top 20 most frequently entered +bytecode frames, each second, across the whole system: + + global fn_calls; + + probe python.function.entry + { + fn_calls[pid(), filename, funcname, lineno] += 1; + } + + probe timer.ms(1000) { + printf("\033[2J\033[1;1H") /* clear screen \*/ + printf("%6s %80s %6s %30s %6s\n", + "PID", "FILENAME", "LINE", "FUNCTION", "CALLS") + foreach ([pid, filename, funcname, lineno] in fn_calls- limit 20) { + printf("%6d %80s %6d %30s %6d\n", + pid, filename, lineno, funcname, + fn_calls[pid, filename, funcname, lineno]); + } + delete fn_calls; + } + + +File: python.info, Node: Python support for the Linux perf profiler, Next: Annotations Best Practices, Prev: Instrumenting CPython with DTrace and SystemTap, Up: Python HOWTOs + +9.17 Python support for the Linux ‘perf’ profiler +================================================= + + +author: Pablo Galindo + +The Linux perf profiler(1) is a very powerful tool that allows you to +profile and obtain information about the performance of your +application. ‘perf’ also has a very vibrant ecosystem of tools that aid +with the analysis of the data that it produces. + +The main problem with using the ‘perf’ profiler with Python applications +is that ‘perf’ only gets information about native symbols, that is, the +names of functions and procedures written in C. This means that the +names and file names of Python functions in your code will not appear in +the output of ‘perf’. + +Since Python 3.12, the interpreter can run in a special mode that allows +Python functions to appear in the output of the ‘perf’ profiler. When +this mode is enabled, the interpreter will interpose a small piece of +code compiled on the fly before the execution of every Python function +and it will teach ‘perf’ the relationship between this piece of code and +the associated Python function using *note perf map files: 4b89. + + Note: Support for the ‘perf’ profiler is currently only available + for Linux on select architectures. Check the output of the + ‘configure’ build step or check the output of ‘python -m sysconfig + | grep HAVE_PERF_TRAMPOLINE’ to see if your system is supported. + +For example, consider the following script: + + def foo(n): + result = 0 + for _ in range(n): + result += 1 + return result + + def bar(n): + foo(n) + + def baz(n): + bar(n) + + if __name__ == "__main__": + baz(1000000) + +We can run ‘perf’ to sample CPU stack traces at 9999 hertz: + + $ perf record -F 9999 -g -o perf.data python my_script.py + +Then we can use ‘perf report’ to analyze the data: + + $ perf report --stdio -n -g + + # Children Self Samples Command Shared Object Symbol + # ........ ........ ............ .......... .................. .......................................... + # + 91.08% 0.00% 0 python.exe python.exe [.] _start + | + ---_start + | + --90.71%--__libc_start_main + Py_BytesMain + | + |--56.88%--pymain_run_python.constprop.0 + | | + | |--56.13%--_PyRun_AnyFileObject + | | _PyRun_SimpleFileObject + | | | + | | |--55.02%--run_mod + | | | | + | | | --54.65%--PyEval_EvalCode + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | | + | | | |--51.67%--_PyEval_EvalFrameDefault + | | | | | + | | | | |--11.52%--_PyLong_Add + | | | | | | + | | | | | |--2.97%--_PyObject_Malloc + ... + +As you can see, the Python functions are not shown in the output, only +‘_PyEval_EvalFrameDefault’ (the function that evaluates the Python +bytecode) shows up. Unfortunately that’s not very useful because all +Python functions use the same C function to evaluate bytecode so we +cannot know which Python function corresponds to which +bytecode-evaluating function. + +Instead, if we run the same experiment with ‘perf’ support enabled we +get: + + $ perf report --stdio -n -g + + # Children Self Samples Command Shared Object Symbol + # ........ ........ ............ .......... .................. ..................................................................... + # + 90.58% 0.36% 1 python.exe python.exe [.] _start + | + ---_start + | + --89.86%--__libc_start_main + Py_BytesMain + | + |--55.43%--pymain_run_python.constprop.0 + | | + | |--54.71%--_PyRun_AnyFileObject + | | _PyRun_SimpleFileObject + | | | + | | |--53.62%--run_mod + | | | | + | | | --53.26%--PyEval_EvalCode + | | | py:::/src/script.py + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | py::baz:/src/script.py + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | py::bar:/src/script.py + | | | _PyEval_EvalFrameDefault + | | | PyObject_Vectorcall + | | | _PyEval_Vector + | | | py::foo:/src/script.py + | | | | + | | | |--51.81%--_PyEval_EvalFrameDefault + | | | | | + | | | | |--13.77%--_PyLong_Add + | | | | | | + | | | | | |--3.26%--_PyObject_Malloc + +* Menu: + +* How to enable perf profiling support:: +* How to obtain the best results:: +* How to work without frame pointers:: + + ---------- Footnotes ---------- + + (1) https://perf.wiki.kernel.org + + +File: python.info, Node: How to enable perf profiling support, Next: How to obtain the best results, Up: Python support for the Linux perf profiler + +9.17.1 How to enable ‘perf’ profiling support +--------------------------------------------- + +‘perf’ profiling support can be enabled either from the start using the +environment variable *note PYTHONPERFSUPPORT: 46a. or the *note -X perf: +176. option, or dynamically using *note sys.activate_stack_trampoline(): +46b. and *note sys.deactivate_stack_trampoline(): 46c. + +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: d9. APIs in file ‘example.py’: + + import sys + + sys.activate_stack_trampoline("perf") + do_profiled_stuff() + sys.deactivate_stack_trampoline() + + non_profiled_stuff() + +…then: + + $ perf record -F 9999 -g -o perf.data python ./example.py + $ perf report -g -i perf.data + + +File: python.info, Node: How to obtain the best results, Next: How to work without frame pointers, Prev: How to enable perf profiling support, Up: Python support for the Linux perf profiler + +9.17.2 How to obtain the best results +------------------------------------- + +For best results, Python should be compiled with +‘CFLAGS="-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer"’ as this +allows profilers to unwind using only the frame pointer and not on DWARF +debug information. This is because as the code that is interposed to +allow ‘perf’ support is dynamically generated it doesn’t have any DWARF +debugging information available. + +You can check if your system has been compiled with this flag by +running: + + $ python -m sysconfig | grep 'no-omit-frame-pointer' + +If you don’t see any output it means that your interpreter has not been +compiled with frame pointers and therefore it may not be able to show +Python functions in the output of ‘perf’. + + +File: python.info, Node: How to work without frame pointers, Prev: How to obtain the best results, Up: Python support for the Linux perf profiler + +9.17.3 How to work without frame pointers +----------------------------------------- + +If you are working with a Python interpreter that has been compiled +without frame pointers, you can still use the ‘perf’ profiler, but the +overhead will be a bit higher because Python needs to generate unwinding +information for every Python function call on the fly. Additionally, +‘perf’ will take more time to process the data because it will need to +use the DWARF debugging information to unwind the stack and this is a +slow process. + +To enable this mode, you can use the environment variable *note +PYTHON_PERF_JIT_SUPPORT: 190. or the *note -X perf_jit: 176. option, +which will enable the JIT mode for the ‘perf’ profiler. + + Note: 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. + + Warning: When using ‘--call-graph dwarf’, the ‘perf’ tool will take + snapshots of the stack of the process being profiled and save the + information in the ‘perf.data’ file. By default, the size of the + stack dump is 8192 bytes, but you can change the size by passing it + after a comma like ‘--call-graph dwarf,16384’. + + The size of the stack dump is important because if the size is too + small ‘perf’ will not be able to unwind the stack and the output + will be incomplete. On the other hand, if the size is too big, + then ‘perf’ won’t be able to sample the process as frequently as it + would like as the overhead will be higher. + + The stack size is particularly important when profiling Python code + compiled with low optimization levels (like ‘-O0’), as these builds + tend to have larger stack frames. If you are compiling Python with + ‘-O0’ and not seeing Python functions in your profiling output, try + increasing the stack dump size to 65528 bytes (the maximum): + + $ perf record -F 9999 -g -k 1 --call-graph dwarf,65528 -o perf.data python -Xperf_jit my_script.py + + Different compilation flags can significantly impact stack sizes: + + - Builds with ‘-O0’ typically have much larger stack frames than + those with ‘-O1’ or higher + + - Adding optimizations (‘-O1’, ‘-O2’, etc.) typically reduces + stack size + + - Frame pointers (‘-fno-omit-frame-pointer’) generally provide + more reliable stack unwinding + + +File: python.info, Node: Annotations Best Practices, Next: Isolating Extension Modules, Prev: Python support for the Linux perf profiler, Up: Python HOWTOs + +9.18 Annotations Best Practices +=============================== + + +author: Larry Hastings + +Abstract +........ + +This document is designed to encapsulate the best practices for working +with annotations dicts. If you write Python code that examines +‘__annotations__’ on Python objects, we encourage you to follow the +guidelines described below. + +The document is organized into four sections: best practices for +accessing the annotations of an object in Python versions 3.10 and +newer, best practices for accessing the annotations of an object in +Python versions 3.9 and older, other best practices for +‘__annotations__’ that apply to any Python version, and quirks of +‘__annotations__’. + +Note that this document is specifically about working with +‘__annotations__’, not uses 'for' annotations. If you’re looking for +information on how to use “type hints” in your code, please see the +*note typing: 104. module. + +* Menu: + +* Accessing The Annotations Dict Of An Object In Python 3.10 And Newer: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer. +* Accessing The Annotations Dict Of An Object In Python 3.9 And Older: Accessing The Annotations Dict Of An Object In Python 3 9 And Older. +* Manually Un-Stringizing Stringized Annotations:: +* Best Practices For __annotations__ In Any Python Version:: +* __annotations__ Quirks:: + + +File: python.info, Node: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer, Next: Accessing The Annotations Dict Of An Object In Python 3 9 And Older, Up: Annotations Best Practices + +9.18.1 Accessing The Annotations Dict Of An Object In Python 3.10 And Newer +--------------------------------------------------------------------------- + +Python 3.10 adds a new function to the standard library: *note +inspect.get_annotations(): 80f. In Python versions 3.10 and newer, +calling this function is the best practice for accessing the annotations +dict of any object that supports annotations. This function can also +“un-stringize” stringized annotations for you. + +If for some reason *note inspect.get_annotations(): 80f. isn’t viable +for your use case, you may access the ‘__annotations__’ data member +manually. Best practice for this changed in Python 3.10 as well: as of +Python 3.10, ‘o.__annotations__’ is guaranteed to 'always' work on +Python functions, classes, and modules. If you’re certain the object +you’re examining is one of these three 'specific' objects, you may +simply use ‘o.__annotations__’ to get at the object’s annotations dict. + +However, other types of callables–for example, callables created by +*note functools.partial(): 410.–may not have an ‘__annotations__’ +attribute defined. When accessing the ‘__annotations__’ of a possibly +unknown object, best practice in Python versions 3.10 and newer is to +call *note getattr(): bd1. with three arguments, for example ‘getattr(o, +'__annotations__', None)’. + +Before Python 3.10, accessing ‘__annotations__’ on a class that defines +no annotations but that has a parent class with annotations would return +the parent’s ‘__annotations__’. In Python 3.10 and newer, the child +class’s annotations will be an empty dict instead. + + +File: python.info, Node: Accessing The Annotations Dict Of An Object In Python 3 9 And Older, Next: Manually Un-Stringizing Stringized Annotations, Prev: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer, Up: Annotations Best Practices + +9.18.2 Accessing The Annotations Dict Of An Object In Python 3.9 And Older +-------------------------------------------------------------------------- + +In Python 3.9 and older, accessing the annotations dict of an object is +much more complicated than in newer versions. The problem is a design +flaw in these older versions of Python, specifically to do with class +annotations. + +Best practice for accessing the annotations dict of other +objects–functions, other callables, and modules–is the same as best +practice for 3.10, assuming you aren’t calling *note +inspect.get_annotations(): 80f.: you should use three-argument *note +getattr(): bd1. to access the object’s ‘__annotations__’ attribute. + +Unfortunately, this isn’t best practice for classes. The problem is +that, since ‘__annotations__’ is optional on classes, and because +classes can inherit attributes from their base classes, accessing the +‘__annotations__’ attribute of a class may inadvertently return the +annotations dict of a 'base class.' As an example: + + class Base: + a: int = 3 + b: str = 'abc' + + class Derived(Base): + pass + + print(Derived.__annotations__) + +This will print the annotations dict from ‘Base’, not ‘Derived’. + +Your code will have to have a separate code path if the object you’re +examining is a class (‘isinstance(o, type)’). In that case, best +practice relies on an implementation detail of Python 3.9 and before: if +a class has annotations defined, they are stored in the class’s *note +__dict__: c5d. dictionary. Since the class may or may not have +annotations defined, best practice is to call the *note get(): 2242. +method on the class dict. + +To put it all together, here is some sample code that safely accesses +the ‘__annotations__’ attribute on an arbitrary object in Python 3.9 and +before: + + if isinstance(o, type): + ann = o.__dict__.get('__annotations__', None) + else: + ann = getattr(o, '__annotations__', None) + +After running this code, ‘ann’ should be either a dictionary or ‘None’. +You’re encouraged to double-check the type of ‘ann’ using *note +isinstance(): 43d. before further examination. + +Note that some exotic or malformed type objects may not have a *note +__dict__: c5d. attribute, so for extra safety you may also wish to use +*note getattr(): bd1. to access ‘__dict__’. + + +File: python.info, Node: Manually Un-Stringizing Stringized Annotations, Next: Best Practices For __annotations__ In Any Python Version, Prev: Accessing The Annotations Dict Of An Object In Python 3 9 And Older, Up: Annotations Best Practices + +9.18.3 Manually Un-Stringizing Stringized Annotations +----------------------------------------------------- + +In situations where some annotations may be “stringized”, and you wish +to evaluate those strings to produce the Python values they represent, +it really is best to call *note inspect.get_annotations(): 80f. to do +this work for you. + +If you’re using Python 3.9 or older, or if for some reason you can’t use +*note inspect.get_annotations(): 80f, you’ll need to duplicate its +logic. You’re encouraged to examine the implementation of *note +inspect.get_annotations(): 80f. in the current Python version and follow +a similar approach. + +In a nutshell, if you wish to evaluate a stringized annotation on an +arbitrary object ‘o’: + + * If ‘o’ is a module, use ‘o.__dict__’ as the ‘globals’ when calling + *note eval(): 180. + + * If ‘o’ is a class, use ‘sys.modules[o.__module__].__dict__’ as the + ‘globals’, and ‘dict(vars(o))’ as the ‘locals’, when calling *note + eval(): 180. + + * If ‘o’ is a wrapped callable using *note + functools.update_wrapper(): 101b, *note functools.wraps(): f58, or + *note functools.partial(): 410, iteratively unwrap it by accessing + either ‘o.__wrapped__’ or ‘o.func’ as appropriate, until you have + found the root unwrapped function. + + * If ‘o’ is a callable (but not a class), use *note o.__globals__: + 12c6. as the globals when calling *note eval(): 180. + +However, not all string values used as annotations can be successfully +turned into Python values by *note eval(): 180. String values could +theoretically contain any valid string, and in practice there are valid +use cases for type hints that require annotating with string values that +specifically 'can’t' be evaluated. For example: + + * PEP 604(1) union types using ‘|’, before support for this was added + to Python 3.10. + + * Definitions that aren’t needed at runtime, only imported when *note + typing.TYPE_CHECKING: cf4. is true. + +If *note eval(): 180. attempts to evaluate such values, it will fail and +raise an exception. So, when designing a library API that works with +annotations, it’s recommended to only attempt to evaluate string values +when explicitly requested to by the caller. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0604/ + + +File: python.info, Node: Best Practices For __annotations__ In Any Python Version, Next: __annotations__ Quirks, Prev: Manually Un-Stringizing Stringized Annotations, Up: Annotations Best Practices + +9.18.4 Best Practices For ‘__annotations__’ In Any Python Version +----------------------------------------------------------------- + + * You should avoid assigning to the ‘__annotations__’ member of + objects directly. Let Python manage setting ‘__annotations__’. + + * If you do assign directly to the ‘__annotations__’ member of an + object, you should always set it to a ‘dict’ object. + + * If you directly access the ‘__annotations__’ member of an object, + you should ensure that it’s a dictionary before attempting to + examine its contents. + + * You should avoid modifying ‘__annotations__’ dicts. + + * You should avoid deleting the ‘__annotations__’ attribute of an + object. + + +File: python.info, Node: __annotations__ Quirks, Prev: Best Practices For __annotations__ In Any Python Version, Up: Annotations Best Practices + +9.18.5 ‘__annotations__’ Quirks +------------------------------- + +In all versions of Python 3, function objects lazy-create an annotations +dict if no annotations are defined on that object. You can delete the +‘__annotations__’ attribute using ‘del fn.__annotations__’, but if you +then access ‘fn.__annotations__’ the object will create a new empty dict +that it will store and return as its annotations. Deleting the +annotations on a function before it has lazily created its annotations +dict will throw an ‘AttributeError’; using ‘del fn.__annotations__’ +twice in a row is guaranteed to always throw an ‘AttributeError’. + +Everything in the above paragraph also applies to class and module +objects in Python 3.10 and newer. + +In all versions of Python 3, you can set ‘__annotations__’ on a function +object to ‘None’. However, subsequently accessing the annotations on +that object using ‘fn.__annotations__’ will lazy-create an empty +dictionary as per the first paragraph of this section. This is 'not' +true of modules and classes, in any Python version; those objects permit +setting ‘__annotations__’ to any Python value, and will retain whatever +value is set. + +If Python stringizes your annotations for you (using ‘from __future__ +import annotations’), and you specify a string as an annotation, the +string will itself be quoted. In effect the annotation is quoted +'twice.' For example: + + from __future__ import annotations + def foo(a: "str"): pass + + print(foo.__annotations__) + +This prints ‘{'a': "'str'"}’. This shouldn’t really be considered a +“quirk”; it’s mentioned here simply because it might be surprising. + + +File: python.info, Node: Isolating Extension Modules, Next: timer file descriptor HOWTO, Prev: Annotations Best Practices, Up: Python HOWTOs + +9.19 Isolating Extension Modules +================================ + +Abstract +........ + +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:: +* Background: Background<2>. +* Making Modules Safe with Multiple Interpreters:: +* Heap Types: Heap Types<2>. +* Open Issues:: + + +File: python.info, Node: Who should read this, Next: Background<2>, Up: Isolating Extension Modules + +9.19.1 Who should read this +--------------------------- + +This guide is written for maintainers of *note C-API: 1bdb. 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: Background<2>, Next: Making Modules Safe with Multiple Interpreters, Prev: Who should read this, Up: Isolating Extension Modules + +9.19.2 Background +----------------- + +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(): 4ae7./*note + Py_FinalizeEx(): d15. cycles, and + + - in parallel, managing “sub-interpreters” using *note + Py_NewInterpreter(): 17b6./*note Py_EndInterpreter(): 185f. + +Both cases (and combinations of them) would be most useful when +embedding Python within a library. Libraries generally shouldn’t make +assumptions about the application that uses them, which include assuming +a process-wide “main Python interpreter”. + +Historically, Python extension modules don’t handle this use case well. +Many extension modules (and even some stdlib modules) use 'per-process' +global state, because C ‘static’ variables are extremely easy to use. +Thus, data that should be specific to an interpreter ends up being +shared between interpreters. Unless the extension developer is careful, +it is very easy to introduce edge cases that lead to crashes when a +module is loaded in more than one interpreter in the same process. + +Unfortunately, 'per-interpreter' state is not easy to achieve. +Extension authors tend to not keep multiple interpreters in mind when +developing, and it is currently cumbersome to test the behavior. + +* Menu: + +* Enter Per-Module State:: +* Isolated Module Objects:: +* Surprising Edge Cases:: + + +File: python.info, Node: Enter Per-Module State, Next: Isolated Module Objects, Up: Background<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: 334.*; there are no “on +interpreter shutdown” hooks to think—or forget—about. + +Note that there are use cases for different kinds of “globals”: +per-process, per-interpreter, per-thread or per-task state. With +per-module state as the default, these are still possible, but you +should treat them as exceptional cases: if you need them, you should +give them additional care and testing. (Note that this guide does not +cover them.) + + +File: python.info, Node: Isolated Module Objects, Next: Surprising Edge Cases, Prev: Enter Per-Module State, Up: Background<2> + +9.19.2.2 Isolated Module Objects +................................ + +The key point to keep in mind when developing an extension module is +that several module objects can be created from a single shared library. +For example: + + >>> import sys + >>> import binascii + >>> old_binascii = binascii + >>> del sys.modules['binascii'] + >>> import binascii # create a new module object + >>> old_binascii == binascii + False + +As a rule of thumb, the two modules should be completely independent. +All objects and state specific to the module should be encapsulated +within the module object, not shared with other module objects, and +cleaned up when the module object is deallocated. Since this just is a +rule of thumb, exceptions are possible (see *note Managing Global State: +5075.), but they will need more thought and attention to edge cases. + +While some modules could do with less stringent restrictions, isolated +modules make it easier to set clear expectations and guidelines that +work across a variety of use cases. + + +File: python.info, Node: Surprising Edge Cases, Prev: Isolated Module Objects, Up: Background<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: 5074, 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 "", line 2, in + 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: Background<2>, Up: Isolating Extension Modules + +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: 4d18. + + +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: 4916. 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: 1805.) which the C code needs to +function. + + Note: 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: 97b. 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(): d15.) and +re-initialization (*note Py_Initialize(): 8ab.). + + +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 + } + + Note: ‘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: Open Issues, Prev: Making Modules Safe with Multiple Interpreters, Up: Isolating Extension Modules + +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 implementation detail:' 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: 3be. flag to prevent + mutability. + + * Heap types inherit *note tp_new: 57c. by default, so it may become + possible to instantiate them from Python code. You can prevent + this with the *note Py_TPFLAGS_DISALLOW_INSTANTIATION: 57f. 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: 171b. +structure, a description or “blueprint” of a class, and calling *note +PyType_FromModuleAndSpec(): 54e. to construct a new class object. + + Note: Other functions, like *note PyType_FromSpec(): 57a, can also + create heap types, but *note PyType_FromModuleAndSpec(): 54e. + 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: 778. flag. + + - Define a traverse function using ‘Py_tp_traverse’, which visits the + type (e.g. using ‘Py_VISIT(Py_TYPE(self))’). + +Please refer to the documentation of *note Py_TPFLAGS_HAVE_GC: 778. and +*note tp_traverse: 779. 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: 751. was only added in Python 3.11. As +a replacement, use: + + * *note PY_VERSION_HEX: 752, if not using the stable ABI, or + + * *note sys.version_info: 69c. (via *note PySys_GetObject(): 384. and + *note PyArg_ParseTuple(): 56e.). + + +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: 779. 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: 57c. and *note tp_clear: 48fb. + + +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: 48e8. function, it needs to: + + - call *note PyObject_GC_UnTrack(): 14d1. 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: 48e9. slot of a heap type must be set to *note +PyObject_GC_Del(): 14cf. 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(): 985. or *note PyObject_NewVar(): 986.: + + - Get and call type’s *note tp_alloc: 48ea. 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(): aa2. or *note PyObject_GC_NewVar(): + aa3.: + + 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(): +54e, you can call *note PyType_GetModule(): 96e. to get the associated +module, and then *note PyModule_GetState(): 980. 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(): 96f, 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. + + Note: 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: 168e. *note calling +convention: 14a2. and the corresponding *note PyCMethod: 75f. 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(): +96f. to get the state of its associated module. + +For example: + + 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 +.................................................................... + + Note: This is new in Python 3.11. + +Slot methods—the fast C equivalents for special methods, such as *note +nb_add: 4bff. for *note __add__: 1f8c. or *note tp_new: 57c. for +initialization—have a very simple API that doesn’t allow passing in the +defining class, unlike with *note PyCMethod: 75f. The same goes for +getters and setters defined with *note PyGetSetDef: bb8. + +To access the module state in these cases, use the *note +PyType_GetModuleByDef(): 38f. function, and pass in the module +definition. Once you have the module, call *note PyModule_GetState(): +980. 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: 2180. (i.e. all superclasses) for the first superclass that has +a corresponding module. + + Note: 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(): 54e, 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: Open Issues, Prev: Heap Types<2>, Up: Isolating Extension Modules + +9.19.5 Open Issues +------------------ + +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: + +* Per-Class Scope:: +* Lossless Conversion to Heap Types:: + + ---------- Footnotes ---------- + + (1) https://discuss.python.org/c/core-dev/c-api/30 + + +File: python.info, Node: Per-Class Scope, Next: Lossless Conversion to Heap Types, Up: Open Issues + +9.19.5.1 Per-Class Scope +........................ + +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: Per-Class Scope, Up: Open Issues + +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: Isolating Extension Modules, Up: Python HOWTOs + +9.20 timer file descriptor HOWTO +================================ + + +Release: 1.13 + +This HOWTO discusses Python’s support for the linux timer file +descriptor. + +* Menu: + +* Examples: Examples<40>. + + +File: python.info, Node: Examples<40>, Up: timer file descriptor HOWTO + +9.20.1 Examples +--------------- + +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: 2f1. 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(): f8e. 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(): d9f. 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 experimental support for free threading, Prev: timer file descriptor HOWTO, Up: Python HOWTOs + +9.21 The Python 2.3 Method Resolution Order +=========================================== + + Note: 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). + + +Abstract: '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:: +* Examples: Examples<41>. +* 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: Examples<41>, 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: Examples<41>, Next: Bad Method Resolution Orders, Prev: The C3 Method Resolution Order, Up: The Python 2 3 Method Resolution Order + +9.21.3 Examples +--------------- + +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(): 1f2b. method of class A: + + >>> A.mro() + [, , , + , , , + ] + +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: Examples<41>, 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 "", 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.: + + # + + """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) + + # + +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 experimental support for free threading, Next: C API Extension Support for Free Threading, Prev: The Python 2 3 Method Resolution Order, Up: Python HOWTOs + +9.22 Python experimental support for free threading +=================================================== + +Starting with the 3.13 release, CPython has experimental support for a +build of Python called *note free threading: 1522. where the *note +global interpreter lock: 148. (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. + +'The free-threaded mode is experimental' and work is ongoing to improve +it: expect some bugs and a substantial single-threaded performance hit. + +This document describes the implications of free threading for Python +code. See *note C API Extension Support for Free Threading: 509a. for +information on how to write C extensions that support the free-threaded +build. + +See also +........ + +PEP 703(1) – Making the Global Interpreter Lock Optional in CPython for +an overall description of free-threaded Python. + +* Menu: + +* Installation:: +* Identifying free-threaded Python:: +* The global interpreter lock in free-threaded Python:: +* Thread safety:: +* Known limitations:: + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0703/ + + +File: python.info, Node: Installation, Next: Identifying free-threaded Python, Up: Python experimental 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: 174. +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, Up: Python experimental support for free threading + +9.22.2 Identifying free-threaded Python +--------------------------------------- + +To check if the current interpreter supports free-threading, *note +python -VV: 177. and *note sys.version: 178. contain “experimental +free-threading build”. The new *note sys._is_gil_enabled(): 43a3. +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 experimental 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: 175. +or the command-line option *note -X gil: 176. + +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 experimental 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: 258, *note list: 60d, and *note set: 5d5. 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. + + Note: It’s recommended to use the *note threading.Lock: 1677. or + other synchronization primitives instead of relying on the internal + locks of built-in types, when possible. + + +File: python.info, Node: Known limitations, Prev: Thread safety, Up: Python experimental support for free threading + +9.22.5 Known limitations +------------------------ + +This section describes known limitations of the free-threaded CPython +build. + +* Menu: + +* Immortalization:: +* Frame objects: Frame objects<2>. +* Iterators: Iterators<3>. +* Single-threaded performance:: + + +File: python.info, Node: Immortalization, Next: Frame objects<2>, Up: Known limitations + +9.22.5.1 Immortalization +........................ + +The free-threaded build of the 3.13 release makes some objects *note +immortal: 4394. 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. + +An object will be made immortal when a new thread is started for the +first time after the main thread is running. The following objects are +immortalized: + + * *note function: 29b. objects declared at the module level + + * *note method: 1cbe. descriptors + + * *note code: 1d2. objects + + * *note module: 165f. objects and their dictionaries + + * *note classes: 1f0e. (type objects) + +Because immortal objects are never deallocated, applications that create +many objects of these types may see increased memory usage. This is +expected to be addressed in the 3.14 release. + +Additionally, numeric and string literals in the code as well as strings +returned by *note sys.intern(): 12ce. are also immortalized. This +behavior is expected to remain in the 3.14 free-threaded build. + + +File: python.info, Node: Frame objects<2>, Next: Iterators<3>, Prev: Immortalization, Up: Known limitations + +9.22.5.2 Frame objects +...................... + +It is not safe to access *note frame: 6db. objects from other threads +and doing so may cause your program to crash . This means that *note +sys._current_frames(): 13fe. is generally not safe to use in a +free-threaded build. Functions like *note inspect.currentframe(): 6dd. +and *note sys._getframe(): 6dc. are generally safe as long as the +resulting frame object is not passed to another thread. + + +File: python.info, Node: Iterators<3>, Next: Single-threaded performance, Prev: Frame objects<2>, Up: Known limitations + +9.22.5.3 Iterators +.................. + +Sharing the same iterator object between multiple threads is generally +not safe and threads may see duplicate or missing elements when +iterating or crash the interpreter. + + +File: python.info, Node: Single-threaded performance, Prev: Iterators<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. In 3.13, this overhead +is about 40% on the pyperformance(1) suite. Programs that spend most of +their time in C extensions or I/O will see less of an impact. The +largest impact is because the specializing adaptive interpreter ( PEP +659(2)) is disabled in the free-threaded build. We expect to re-enable +it in a thread-safe way in the 3.14 release. This overhead is expected +to be reduced in upcoming Python release. We are aiming for an overhead +of 10% or less on the pyperformance suite compared to the default +GIL-enabled build. + + ---------- Footnotes ---------- + + (1) https://pyperformance.readthedocs.io/ + + (2) https://peps.python.org/pep-0659/ + + +File: python.info, Node: C API Extension Support for Free Threading, Prev: Python experimental support for free threading, Up: Python HOWTOs + +9.23 C API Extension Support for Free Threading +=============================================== + +Starting with the 3.13 release, CPython has experimental support for +running with the *note global interpreter lock: 148. (GIL) disabled in a +configuration called *note free threading: 1522. 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:: +* 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 + + Note: On Windows, this macro is not defined automatically, but must + be specified to the compiler when building. The *note + sysconfig.get_config_var(): 1024. function can be used to determine + whether the current running interpreter had the macro defined. + + +File: python.info, Node: Module Initialization, Next: General API Guidelines, Prev: Identifying the Free-Threaded Build in C, Up: C API Extension Support for Free Threading + +9.23.2 Module Initialization +---------------------------- + +Extension modules need to explicitly indicate that they support running +with the GIL disabled; otherwise importing the extension will raise a +warning and enable the GIL at runtime. + +There are two ways to indicate that an extension module supports running +with the GIL disabled depending on whether the extension uses +multi-phase or single-phase initialization. + +* Menu: + +* Multi-Phase Initialization:: +* Single-Phase Initialization:: + + +File: python.info, Node: Multi-Phase Initialization, Next: Single-Phase Initialization, Up: Module Initialization + +9.23.2.1 Multi-Phase Initialization +................................... + +Extensions that use multi-phase initialization (i.e., *note +PyModuleDef_Init(): 48bd.) should add a *note Py_mod_gil: 158. slot in +the module definition. If your extension supports older versions of +CPython, you should guard the slot with a *note PY_VERSION_HEX: 752. +check. + + static struct PyModuleDef_Slot module_slots[] = { + ... + #if PY_VERSION_HEX >= 0x030D0000 + {Py_mod_gil, Py_MOD_GIL_NOT_USED}, + #endif + {0, NULL} + }; + + static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + .m_slots = module_slots, + ... + }; + + +File: python.info, Node: Single-Phase Initialization, Prev: Multi-Phase Initialization, Up: Module Initialization + +9.23.2.2 Single-Phase Initialization +.................................... + +Extensions that use single-phase initialization (i.e., *note +PyModule_Create(): 4d0d.) should call *note PyUnstable_Module_SetGIL(): +179. 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: 495d. and + *note PyList_SET_ITEM: 389. 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: 339. may not be thread-safe if the containing object is + modified concurrently. See the section on *note borrowed + references: 50ab. 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: 4bba, *note PyDictObject: 3bd, and +*note PySetObject: 4ca7. perform internal locking in the free-threaded +build. For example, the *note PyList_Append(): 4a14. 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(): 1612, which does not lock +the dictionary. You should use *note Py_BEGIN_CRITICAL_SECTION: 4c9f. +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: 339. These APIs +are not thread-safe if the containing object is modified concurrently. +For example, it’s not safe to use *note PyList_GetItem(): 357. if the +list may be modified concurrently. + +The following table lists some borrowed reference APIs and their +replacements that return *note strong references: 338. + +Borrowed reference API Strong reference API + +-------------------------------------------------------------------------------- + +*note PyList_GetItem(): 357. *note PyList_GetItemRef(): 356. + + +*note PyList_GET_ITEM(): 495d. *note PyList_GetItemRef(): 356. + + +*note PyDict_GetItem(): 382. *note PyDict_GetItemRef(): 335. + + +*note PyDict_GetItemWithError(): 337. *note PyDict_GetItemRef(): 335. + + +*note PyDict_GetItemString(): 383. *note PyDict_GetItemStringRef(): 336. + + +*note PyDict_SetDefault(): 33b. *note PyDict_SetDefaultRef(): 33a. + + +*note PyDict_Next(): 1612. none (see *note PyDict_Next: 50ae.) + + +*note PyWeakref_GetObject(): 374. *note PyWeakref_GetRef(): 373. + + +*note PyWeakref_GET_OBJECT(): 3bb. *note PyWeakref_GetRef(): 373. + + +*note PyImport_AddModule(): 354. *note PyImport_AddModuleRef(): 353. + + +Not all APIs that return borrowed references are problematic. For +example, *note PyTuple_GetItem(): 48d2. is safe because tuples are +immutable. Similarly, not all uses of the above APIs are problematic. +For example, *note PyDict_GetItem(): 382. 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: 4e20.: “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 object are +allocated using that domain. This differs from the prior Python +versions, where this was only a best practice and not a hard +requirement. + + Note: Search for uses of *note PyObject_Malloc(): c68. in your + extension and check that the allocated memory is used for Python + objects. Use *note PyMem_Malloc(): c66. to allocate buffers + instead of *note PyObject_Malloc(): c68. + + +File: python.info, Node: Thread State and GIL APIs, Next: Protecting Internal Extension State, Prev: Memory Allocation APIs, Up: C API Extension Support for Free Threading + +9.23.6 Thread State and GIL APIs +-------------------------------- + +Python provides a set of functions and macros to manage thread state and +the GIL, such as: + + * *note PyGILState_Ensure(): 3a7. and *note PyGILState_Release(): + 3a8. + + * *note PyEval_SaveThread(): 3a4. and *note PyEval_RestoreThread(): + 3a5. + + * *note Py_BEGIN_ALLOW_THREADS: 48d7. and *note Py_END_ALLOW_THREADS: + a8e. + +These functions should still be used in the free-threaded build to +manage thread state even when the *note GIL: 159. is disabled. For +example, if you create a thread outside of Python, you must call *note +PyGILState_Ensure(): 3a7. 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(): 3a4. or *note +Py_BEGIN_ALLOW_THREADS: 48d7. around blocking operations, such as I/O or +lock acquisitions, to allow other threads to run the *note cyclic +garbage collector: 1919. + + +File: python.info, Node: Protecting Internal Extension State, Next: Building Extensions for the Free-Threaded Build, 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: Building Extensions for the Free-Threaded Build, Prev: Protecting Internal Extension State, Up: C API Extension Support for Free Threading + +9.23.8 Building Extensions for the Free-Threaded Build +------------------------------------------------------ + +C API extensions need to be built specifically for the free-threaded +build. The wheels, shared libraries, and binaries are indicated by a +‘t’ suffix. + + * pypa/manylinux(1) supports the free-threaded build, with the ‘t’ + suffix, such as ‘python3.13t’. + + * pypa/cibuildwheel(2) supports the free-threaded build if you set + CIBW_ENABLE to cpython-freethreading(3). + +* Menu: + +* Limited C API and Stable ABI:: +* Windows: Windows<80>. + + ---------- Footnotes ---------- + + (1) https://github.com/pypa/manylinux + + (2) https://github.com/pypa/cibuildwheel + + (3) https://cibuildwheel.pypa.io/en/stable/options/#enable + + +File: python.info, Node: Limited C API and Stable ABI, Next: Windows<80>, Up: Building Extensions for the Free-Threaded Build + +9.23.8.1 Limited C API and Stable ABI +..................................... + +The free-threaded build does not currently support the *note Limited C +API: 391. 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. + + Note: 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<80>, Prev: Limited C API and Stable ABI, Up: Building Extensions for the Free-Threaded Build + +9.23.8.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. + +See also +........ + +Porting Extension Modules to Support Free-Threading(1): A +community-maintained porting guide for extension authors. + +General: + + * *note A Conceptual Overview of asyncio: 3279. + + * *note Annotations Best Practices: 7d4. + + * *note Argparse Tutorial: 2e6e. + + * *note Descriptor Guide: 14b7. + + * *note Enum HOWTO: 4f3e. + + * *note Functional Programming HOWTO: 4f6f. + + * *note An introduction to the ipaddress module: 3c3f. + + * *note Logging HOWTO: 4f8d. + + * *note Logging Cookbook: 11e9. + + * *note Regular Expression HOWTO: 22ec. + + * *note Sorting Techniques: 217e. + + * *note Unicode HOWTO: 1297. + + * *note HOWTO Fetch Internet Resources Using The urllib Package: + 3a11. + +Advanced development: + + * *note Curses Programming with Python: 2f61. + + * *note Python experimental support for free threading: 5098. + + * *note C API Extension Support for Free Threading: 509a. + + * *note Isolating Extension Modules: 48be. + + * *note The Python 2.3 Method Resolution Order: 1473. + + * *note Socket Programming HOWTO: 344c. + + * *note timer file descriptor HOWTO: 508d. + + * *note Porting Extension Modules to Python 3: 12d4. + +Debugging and profiling: + + * *note Debugging C API extensions and CPython Internals with GDB: + 4f30. + + * *note Instrumenting CPython with DTrace and SystemTap: c6c. + + * *note Python support for the Linux perf profiler: 18f. + + ---------- Footnotes ---------- + + (1) https://py-free-threading.github.io/porting/ + + +File: python.info, Node: Python Frequently Asked Questions, Next: Deprecations, Prev: Python HOWTOs, Up: Top + +10 Python Frequently Asked Questions +************************************ + +* Menu: + +* General Python FAQ:: +* Programming FAQ:: +* Design and History FAQ:: +* Library and Extension FAQ:: +* Extending/Embedding FAQ:: +* Python on Windows FAQ:: +* Graphic User Interface FAQ:: +* “Why is Python Installed on my Computer?” FAQ:: + + +File: python.info, Node: General Python FAQ, Next: Programming FAQ, Up: Python Frequently Asked Questions + +10.1 General Python FAQ +======================= + +* Menu: + +* General Information:: +* Python in the real world:: + + +File: python.info, Node: General Information, Next: Python in the real world, Up: General Python FAQ + +10.1.1 General Information +-------------------------- + +* Menu: + +* What is Python?:: +* What is the Python Software Foundation?:: +* Are there copyright restrictions on the use of Python?:: +* Why was Python created in the first place?:: +* What is Python good for?:: +* How does the Python version numbering scheme work?:: +* How do I obtain a copy of the Python source?:: +* How do I get documentation on Python?:: +* I’ve never programmed before. Is there a Python tutorial?: I’ve never programmed before Is there a Python tutorial?. +* Is there a newsgroup or mailing list devoted to Python?:: +* How do I get a beta test version of Python?:: +* How do I submit bug reports and patches for Python?:: +* Are there any published articles about Python that I can reference?:: +* Are there any books on Python?:: +* Where in the world is www.python.org located?: Where in the world is www python org located?. +* Why is it called Python?:: +* Do I have to like “Monty Python’s Flying Circus”?:: + + +File: python.info, Node: What is Python?, Next: What is the Python Software Foundation?, Up: General Information + +10.1.1.1 What is Python? +........................ + +Python is an interpreted, interactive, object-oriented programming +language. It incorporates modules, exceptions, dynamic typing, very +high level dynamic data types, and classes. It supports multiple +programming paradigms beyond object-oriented programming, such as +procedural and functional programming. Python combines remarkable power +with very clear syntax. It has interfaces to many system calls and +libraries, as well as to various window systems, and is extensible in C +or C++. It is also usable as an extension language for applications +that need a programmable interface. Finally, Python is portable: it +runs on many Unix variants including Linux and macOS, and on Windows. + +To find out more, start with *note The Python Tutorial: 1bd9. The +Beginner's Guide to Python(1) links to other introductory tutorials and +resources for learning Python. + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/BeginnersGuide + + +File: python.info, Node: What is the Python Software Foundation?, Next: Are there copyright restrictions on the use of Python?, Prev: What is Python?, Up: General Information + +10.1.1.2 What is the Python Software Foundation? +................................................ + +The Python Software Foundation is an independent non-profit organization +that holds the copyright on Python versions 2.1 and newer. The PSF’s +mission is to advance open source technology related to the Python +programming language and to publicize the use of Python. The PSF’s home +page is at ‘https://www.python.org/psf/’. + +Donations to the PSF are tax-exempt in the US. If you use Python and +find it helpful, please contribute via the PSF donation page(1). + + ---------- Footnotes ---------- + + (1) https://www.python.org/psf/donations/ + + +File: python.info, Node: Are there copyright restrictions on the use of Python?, Next: Why was Python created in the first place?, Prev: What is the Python Software Foundation?, Up: General Information + +10.1.1.3 Are there copyright restrictions on the use of Python? +............................................................... + +You can do anything you want with the source, as long as you leave the +copyrights in and display those copyrights in any documentation about +Python that you produce. If you honor the copyright rules, it’s OK to +use Python for commercial use, to sell copies of Python in source or +binary form (modified or unmodified), or to sell products that +incorporate Python in some form. We would still like to know about all +commercial use of Python, of course. + +See the license page(1) to find further explanations and the full text +of the PSF License. + +The Python logo is trademarked, and in certain cases permission is +required to use it. Consult the Trademark Usage Policy(2) for more +information. + + ---------- Footnotes ---------- + + (1) https://docs.python.org/3/license.html + + (2) https://www.python.org/psf/trademarks/ + + +File: python.info, Node: Why was Python created in the first place?, Next: What is Python good for?, Prev: Are there copyright restrictions on the use of Python?, Up: General Information + +10.1.1.4 Why was Python created in the first place? +................................................... + +Here’s a 'very' brief summary of what started it all, written by Guido +van Rossum: + + I had extensive experience with implementing an interpreted + language in the ABC group at CWI, and from working with this group + I had learned a lot about language design. This is the origin of + many Python features, including the use of indentation for + statement grouping and the inclusion of very-high-level data types + (although the details are all different in Python). + + I had a number of gripes about the ABC language, but also liked + many of its features. It was impossible to extend the ABC language + (or its implementation) to remedy my complaints – in fact its lack + of extensibility was one of its biggest problems. I had some + experience with using Modula-2+ and talked with the designers of + Modula-3 and read the Modula-3 report. Modula-3 is the origin of + the syntax and semantics used for exceptions, and some other Python + features. + + I was working in the Amoeba distributed operating system group at + CWI. We needed a better way to do system administration than by + writing either C programs or Bourne shell scripts, since Amoeba had + its own system call interface which wasn’t easily accessible from + the Bourne shell. My experience with error handling in Amoeba made + me acutely aware of the importance of exceptions as a programming + language feature. + + It occurred to me that a scripting language with a syntax like ABC + but with access to the Amoeba system calls would fill the need. I + realized that it would be foolish to write an Amoeba-specific + language, so I decided that I needed a language that was generally + extensible. + + During the 1989 Christmas holidays, I had a lot of time on my hand, + so I decided to give it a try. During the next year, while still + mostly working on it in my own time, Python was used in the Amoeba + project with increasing success, and the feedback from colleagues + made me add many early improvements. + + In February 1991, after just over a year of development, I decided + to post to USENET. The rest is in the ‘Misc/HISTORY’ file. + + +File: python.info, Node: What is Python good for?, Next: How does the Python version numbering scheme work?, Prev: Why was Python created in the first place?, Up: General Information + +10.1.1.5 What is Python good for? +................................. + +Python is a high-level general-purpose programming language that can be +applied to many different classes of problems. + +The language comes with a large standard library that covers areas such +as string processing (regular expressions, Unicode, calculating +differences between files), internet protocols (HTTP, FTP, SMTP, +XML-RPC, POP, IMAP), software engineering (unit testing, logging, +profiling, parsing Python code), and operating system interfaces (system +calls, filesystems, TCP/IP sockets). Look at the table of contents for +*note The Python Standard Library: 144. to get an idea of what’s +available. A wide variety of third-party extensions are also available. +Consult the Python Package Index(1) to find packages of interest to you. + + ---------- Footnotes ---------- + + (1) https://pypi.org + + +File: python.info, Node: How does the Python version numbering scheme work?, Next: How do I obtain a copy of the Python source?, Prev: What is Python good for?, Up: General Information + +10.1.1.6 How does the Python version numbering scheme work? +........................................................... + +Python versions are numbered “A.B.C” or “A.B”: + + * 'A' is the major version number – it is only incremented for really + major changes in the language. + + * 'B' is the minor version number – it is incremented for less + earth-shattering changes. + + * 'C' is the micro version number – it is incremented for each bugfix + release. + +Not all releases are bugfix releases. In the run-up to a new feature +release, a series of development releases are made, denoted as alpha, +beta, or release candidate. Alphas are early releases in which +interfaces aren’t yet finalized; it’s not unexpected to see an interface +change between two alpha releases. Betas are more stable, preserving +existing interfaces but possibly adding new modules, and release +candidates are frozen, making no changes except as needed to fix +critical bugs. + +Alpha, beta and release candidate versions have an additional suffix: + + * The suffix for an alpha version is “aN” for some small number 'N'. + + * The suffix for a beta version is “bN” for some small number 'N'. + + * The suffix for a release candidate version is “rcN” for some small + number 'N'. + +In other words, all versions labeled '2.0aN' precede the versions +labeled '2.0bN', which precede versions labeled '2.0rcN', and 'those' +precede 2.0. + +You may also find version numbers with a “+” suffix, e.g. “2.2+”. +These are unreleased versions, built directly from the CPython +development repository. In practice, after a final minor release is +made, the version is incremented to the next minor version, which +becomes the “a0” version, e.g. “2.4a0”. + +See the Developer's Guide(1) for more information about the development +cycle, and PEP 387(2) to learn more about Python’s backward +compatibility policy. See also the documentation for *note sys.version: +178, *note sys.hexversion: 439e, and *note sys.version_info: 69c. + + ---------- Footnotes ---------- + + (1) https://devguide.python.org/developer-workflow/development-cycle/ + + (2) https://peps.python.org/pep-0387/ + + +File: python.info, Node: How do I obtain a copy of the Python source?, Next: How do I get documentation on Python?, Prev: How does the Python version numbering scheme work?, Up: General Information + +10.1.1.7 How do I obtain a copy of the Python source? +..................................................... + +The latest Python source distribution is always available from +python.org, at ‘https://www.python.org/downloads/’. The latest +development sources can be obtained at +‘https://github.com/python/cpython/’. + +The source distribution is a gzipped tar file containing the complete C +source, Sphinx-formatted documentation, Python library modules, example +programs, and several useful pieces of freely distributable software. +The source will compile and run out of the box on most UNIX platforms. + +Consult the Getting Started section of the Python Developer's Guide(1) +for more information on getting the source code and compiling it. + + ---------- Footnotes ---------- + + (1) https://devguide.python.org/setup/ + + +File: python.info, Node: How do I get documentation on Python?, Next: I’ve never programmed before Is there a Python tutorial?, Prev: How do I obtain a copy of the Python source?, Up: General Information + +10.1.1.8 How do I get documentation on Python? +.............................................. + +The standard documentation for the current stable version of Python is +available at ‘https://docs.python.org/3/’. PDF, plain text, and +downloadable HTML versions are also available at +‘https://docs.python.org/3/download.html’. + +The documentation is written in reStructuredText and processed by the +Sphinx documentation tool(1). The reStructuredText source for the +documentation is part of the Python source distribution. + + ---------- Footnotes ---------- + + (1) https://www.sphinx-doc.org/ + + +File: python.info, Node: I’ve never programmed before Is there a Python tutorial?, Next: Is there a newsgroup or mailing list devoted to Python?, Prev: How do I get documentation on Python?, Up: General Information + +10.1.1.9 I’ve never programmed before. Is there a Python tutorial? +.................................................................. + +There are numerous tutorials and books available. The standard +documentation includes *note The Python Tutorial: 1bd9. + +Consult the Beginner's Guide(1) to find information for beginning Python +programmers, including lists of tutorials. + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/BeginnersGuide + + +File: python.info, Node: Is there a newsgroup or mailing list devoted to Python?, Next: How do I get a beta test version of Python?, Prev: I’ve never programmed before Is there a Python tutorial?, Up: General Information + +10.1.1.10 Is there a newsgroup or mailing list devoted to Python? +................................................................. + +There is a newsgroup, ‘comp.lang.python’, and a mailing list, +python-list(1). The newsgroup and mailing list are gatewayed into each +other – if you can read news it’s unnecessary to subscribe to the +mailing list. ‘comp.lang.python’ is high-traffic, receiving hundreds of +postings every day, and Usenet readers are often more able to cope with +this volume. + +Announcements of new software releases and events can be found in +comp.lang.python.announce, a low-traffic moderated list that receives +about five postings per day. It’s available as the python-announce +mailing list(2). + +More info about other mailing lists and newsgroups can be found at +‘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: How do I get a beta test version of Python?, Next: How do I submit bug reports and patches for Python?, Prev: Is there a newsgroup or mailing list devoted to Python?, Up: General Information + +10.1.1.11 How do I get a beta test version of Python? +..................................................... + +Alpha and beta releases are available from +‘https://www.python.org/downloads/’. All releases are announced on the +comp.lang.python and comp.lang.python.announce newsgroups and on the +Python home page at ‘https://www.python.org/’; an RSS feed of news is +available. + +You can also access the development version of Python through Git. See +The Python Developer's Guide(1) for details. + + ---------- Footnotes ---------- + + (1) https://devguide.python.org/ + + +File: python.info, Node: How do I submit bug reports and patches for Python?, Next: Are there any published articles about Python that I can reference?, Prev: How do I get a beta test version of Python?, Up: General Information + +10.1.1.12 How do I submit bug reports and patches for Python? +............................................................. + +To report a bug or submit a patch, use the issue tracker at +‘https://github.com/python/cpython/issues’. + +For more information on how Python is developed, consult the Python +Developer's Guide(1). + + ---------- Footnotes ---------- + + (1) https://devguide.python.org/ + + +File: python.info, Node: Are there any published articles about Python that I can reference?, Next: Are there any books on Python?, Prev: How do I submit bug reports and patches for Python?, Up: General Information + +10.1.1.13 Are there any published articles about Python that I can reference? +............................................................................. + +It’s probably best to cite your favorite book about Python. + +The very first article(1) about Python was written in 1991 and is now +quite outdated. + + 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: Are there any books on Python?, Next: Where in the world is www python org located?, Prev: Are there any published articles about Python that I can reference?, Up: General Information + +10.1.1.14 Are there any books on Python? +........................................ + +Yes, there are many, and more are being published. See the python.org +wiki at ‘https://wiki.python.org/moin/PythonBooks’ for a list. + +You can also search online bookstores for “Python” and filter out the +Monty Python references; or perhaps search for “Python” and “language”. + + +File: python.info, Node: Where in the world is www python org located?, Next: Why is it called Python?, Prev: Are there any books on Python?, Up: General Information + +10.1.1.15 Where in the world is www.python.org located? +....................................................... + +The Python project’s infrastructure is located all over the world and is +managed by the Python Infrastructure Team. Details here(1). + + ---------- Footnotes ---------- + + (1) https://infra.psf.io + + +File: python.info, Node: Why is it called Python?, Next: Do I have to like “Monty Python’s Flying Circus”?, Prev: Where in the world is www python org located?, Up: General Information + +10.1.1.16 Why is it called Python? +.................................. + +When he began implementing Python, Guido van Rossum was also reading the +published scripts from "Monty Python's Flying Circus"(1), a BBC comedy +series from the 1970s. Van Rossum thought he needed a name that was +short, unique, and slightly mysterious, so he decided to call the +language Python. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/Monty_Python + + +File: python.info, Node: Do I have to like “Monty Python’s Flying Circus”?, Prev: Why is it called Python?, Up: General Information + +10.1.1.17 Do I have to like “Monty Python’s Flying Circus”? +........................................................... + +No, but it helps. :) + + +File: python.info, Node: Python in the real world, Prev: General Information, Up: General Python FAQ + +10.1.2 Python in the real world +------------------------------- + +* Menu: + +* How stable is Python?:: +* How many people are using Python?:: +* Have any significant projects been done in Python?:: +* What new developments are expected for Python in the future?:: +* Is it reasonable to propose incompatible changes to Python?:: +* Is Python a good language for beginning programmers?:: + + +File: python.info, Node: How stable is Python?, Next: How many people are using Python?, Up: Python in the real world + +10.1.2.1 How stable is Python? +.............................. + +Very stable. New, stable releases have been coming out roughly every 6 +to 18 months since 1991, and this seems likely to continue. As of +version 3.9, Python will have a new feature release every 12 months ( +PEP 602(1)). + +The developers issue bugfix releases of older versions, so the stability +of existing releases gradually improves. Bugfix releases, indicated by +a third component of the version number (e.g. 3.5.3, 3.6.2), are +managed for stability; only fixes for known problems are included in a +bugfix release, and it’s guaranteed that interfaces will remain the same +throughout a series of bugfix releases. + +The latest stable releases can always be found on the Python download +page(2). Python 3.x is the recommended version and supported by most +widely used libraries. Python 2.x is not maintained anymore(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: How many people are using Python?, Next: Have any significant projects been done in Python?, Prev: How stable is Python?, Up: Python in the real world + +10.1.2.2 How many people are using Python? +.......................................... + +There are probably millions of users, though it’s difficult to obtain an +exact count. + +Python is available for free download, so there are no sales figures, +and it’s available from many different sites and packaged with many +Linux distributions, so download statistics don’t tell the whole story +either. + +The comp.lang.python newsgroup is very active, but not all Python users +post to the group or even read it. + + +File: python.info, Node: Have any significant projects been done in Python?, Next: What new developments are expected for Python in the future?, Prev: How many people are using Python?, Up: Python in the real world + +10.1.2.3 Have any significant projects been done in Python? +........................................................... + +See ‘https://www.python.org/about/success’ for a list of projects that +use Python. Consulting the proceedings for past Python conferences(1) +will reveal contributions from many different companies and +organizations. + +High-profile Python projects include the Mailman mailing list manager(2) +and the Zope application server(3). Several Linux distributions, most +notably Red Hat(4), have written part or all of their installer and +system administration software in Python. Companies that use Python +internally include Google, Yahoo, and 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: What new developments are expected for Python in the future?, Next: Is it reasonable to propose incompatible changes to Python?, Prev: Have any significant projects been done in Python?, Up: Python in the real world + +10.1.2.4 What new developments are expected for Python in the future? +..................................................................... + +See ‘https://peps.python.org/’ for the Python Enhancement Proposals +(PEPs). PEPs are design documents describing a suggested new feature +for Python, providing a concise technical specification and a rationale. +Look for a PEP titled “Python X.Y Release Schedule”, where X.Y is a +version that hasn’t been publicly released yet. + +New development is discussed on the python-dev mailing list(1). + + ---------- Footnotes ---------- + + (1) https://mail.python.org/mailman3/lists/python-dev.python.org/ + + +File: python.info, Node: Is it reasonable to propose incompatible changes to Python?, Next: Is Python a good language for beginning programmers?, Prev: What new developments are expected for Python in the future?, Up: Python in the real world + +10.1.2.5 Is it reasonable to propose incompatible changes to Python? +.................................................................... + +In general, no. There are already millions of lines of Python code +around the world, so any change in the language that invalidates more +than a very small fraction of existing programs has to be frowned upon. +Even if you can provide a conversion program, there’s still the problem +of updating all documentation; many books have been written about +Python, and we don’t want to invalidate them all at a single stroke. + +Providing a gradual upgrade path is necessary if a feature has to be +changed. PEP 5(1) describes the procedure followed for introducing +backward-incompatible changes while minimizing disruption for users. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0005/ + + +File: python.info, Node: Is Python a good language for beginning programmers?, Prev: Is it reasonable to propose incompatible changes to Python?, Up: Python in the real world + +10.1.2.6 Is Python a good language for beginning programmers? +............................................................. + +Yes. + +It is still common to start students with a procedural and statically +typed language such as Pascal, C, or a subset of C++ or Java. Students +may be better served by learning Python as their first language. Python +has a very simple and consistent syntax and a large standard library +and, most importantly, using Python in a beginning programming course +lets students concentrate on important programming skills such as +problem decomposition and data type design. With Python, students can +be quickly introduced to basic concepts such as loops and procedures. +They can probably even work with user-defined objects in their very +first course. + +For a student who has never programmed before, using a statically typed +language seems unnatural. It presents additional complexity that the +student must master and slows the pace of the course. The students are +trying to learn to think like a computer, decompose problems, design +consistent interfaces, and encapsulate data. While learning to use a +statically typed language is important in the long term, it is not +necessarily the best topic to address in the students’ first programming +course. + +Many other aspects of Python make it a good first language. Like Java, +Python has a large standard library so that students can be assigned +programming projects very early in the course that 'do' something. +Assignments aren’t restricted to the standard four-function calculator +and check balancing programs. By using the standard library, students +can gain the satisfaction of working on realistic applications as they +learn the fundamentals of programming. Using the standard library also +teaches students about code reuse. Third-party modules such as PyGame +are also helpful in extending the students’ reach. + +Python’s interactive interpreter enables students to test language +features while they’re programming. They can keep a window with the +interpreter running while they enter their program’s source in another +window. If they can’t remember the methods for a list, they can do +something like this: + + >>> 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] + +With the interpreter, documentation is never far from the student as +they are programming. + +There are also good IDEs for Python. IDLE is a cross-platform IDE for +Python that is written in Python using Tkinter. Emacs users will be +happy to know that there is a very good Python mode for Emacs. All of +these programming environments provide syntax highlighting, +auto-indenting, and access to the interactive interpreter while coding. +Consult the Python wiki(1) for a full list of Python editing +environments. + +If you want to discuss Python’s use in education, you may be interested +in joining 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: Programming FAQ, Next: Design and History FAQ, Prev: General Python FAQ, Up: Python Frequently Asked Questions + +10.2 Programming FAQ +==================== + +* Menu: + +* General Questions:: +* Core Language:: +* Numbers and strings:: +* Performance: Performance<4>. +* Sequences (Tuples/Lists): Sequences Tuples/Lists. +* Objects:: +* Modules: Modules<5>. + + +File: python.info, Node: General Questions, Next: Core Language, Up: Programming FAQ + +10.2.1 General Questions +------------------------ + +* Menu: + +* Is there a source code level debugger with breakpoints, single-stepping, etc.?: Is there a source code level debugger with breakpoints single-stepping etc ?. +* Are there tools to help find bugs or perform static analysis?:: +* How can I create a stand-alone binary from a Python script?:: +* Are there coding standards or a style guide for Python programs?:: + + +File: python.info, Node: Is there a source code level debugger with breakpoints single-stepping etc ?, Next: Are there tools to help find bugs or perform static analysis?, Up: General Questions + +10.2.1.1 Is there a source code level debugger with breakpoints, single-stepping, etc.? +....................................................................................... + +Yes. + +Several debuggers for Python are described below, and the built-in +function *note breakpoint(): 236. allows you to drop into any of them. + +The pdb module is a simple but adequate console-mode debugger for +Python. It is part of the standard Python library, and is *note +documented in the Library Reference Manual: a5. You can also write your +own debugger by using the code for pdb as an example. + +The IDLE interactive development environment, which is part of the +standard Python distribution (normally available as +Tools/scripts/idle3(1)), includes a graphical debugger. + +PythonWin is a Python IDE that includes a GUI debugger based on pdb. +The PythonWin debugger colors breakpoints and has quite a few cool +features such as debugging non-PythonWin programs. PythonWin is +available as part of pywin32(2) project and as a part of the +ActivePython(3) distribution. + +Eric(4) is an IDE built on PyQt and the Scintilla editing component. + +trepan3k(5) is a gdb-like debugger. + +Visual Studio Code(6) is an IDE with debugging tools that integrates +with version-control software. + +There are a number of commercial Python IDEs that include graphical +debuggers. They include: + + * Wing IDE(7) + + * Komodo IDE(8) + + * PyCharm(9) + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/blob/main/Tools/scripts/idle3 + + (2) https://github.com/mhammond/pywin32 + + (3) https://www.activestate.com/products/python/ + + (4) https://eric-ide.python-projects.org/ + + (5) https://github.com/rocky/python3-trepan/ + + (6) https://code.visualstudio.com/ + + (7) https://wingware.com/ + + (8) https://www.activestate.com/products/komodo-ide/ + + (9) https://www.jetbrains.com/pycharm/ + + +File: python.info, Node: Are there tools to help find bugs or perform static analysis?, Next: How can I create a stand-alone binary from a Python script?, Prev: Is there a source code level debugger with breakpoints single-stepping etc ?, Up: General Questions + +10.2.1.2 Are there tools to help find bugs or perform static analysis? +...................................................................... + +Yes. + +Pylint(1) and Pyflakes(2) do basic checking that will help you catch +bugs sooner. + +Static type checkers such as Mypy(3), Pyre(4), and Pytype(5) can check +type hints in Python source code. + + ---------- Footnotes ---------- + + (1) https://pylint.pycqa.org/en/latest/index.html + + (2) https://github.com/PyCQA/pyflakes + + (3) https://mypy-lang.org/ + + (4) https://pyre-check.org/ + + (5) https://github.com/google/pytype + + +File: python.info, Node: How can I create a stand-alone binary from a Python script?, Next: Are there coding standards or a style guide for Python programs?, Prev: Are there tools to help find bugs or perform static analysis?, Up: General Questions + +10.2.1.3 How can I create a stand-alone binary from a Python script? +.................................................................... + +You don’t need the ability to compile Python to C code if all you want +is a stand-alone program that users can download and run without having +to install the Python distribution first. There are a number of tools +that determine the set of modules required by a program and bind these +modules together with a Python binary to produce a single executable. + +One is to use the freeze tool, which is included in the Python source +tree as Tools/freeze(1). It converts Python byte code to C arrays; with +a C compiler you can embed all your modules into a new program, which is +then linked with the standard Python modules. + +It works by scanning your source recursively for import statements (in +both forms) and looking for the modules in the standard Python path as +well as in the source directory (for built-in modules). It then turns +the bytecode for modules written in Python into C code (array +initializers that can be turned into code objects using the marshal +module) and creates a custom-made config file that only contains those +built-in modules which are actually used in the program. It then +compiles the generated C code and links it with the rest of the Python +interpreter to form a self-contained binary which acts exactly like your +script. + +The following packages can help with the creation of console and GUI +executables: + + * 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: Are there coding standards or a style guide for Python programs?, Prev: How can I create a stand-alone binary from a Python script?, Up: General Questions + +10.2.1.4 Are there coding standards or a style guide for Python programs? +......................................................................... + +Yes. The coding style required for standard library modules is +documented as PEP 8(1). + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0008/ + + +File: python.info, Node: Core Language, Next: Numbers and strings, Prev: General Questions, Up: Programming FAQ + +10.2.2 Core Language +-------------------- + +* Menu: + +* Why am I getting an UnboundLocalError when the variable has a value?:: +* What are the rules for local and global variables in Python?:: +* Why do lambdas defined in a loop with different values all return the same result?:: +* How do I share global variables across modules?:: +* What are the “best practices” for using import in a module?:: +* Why are default values shared between objects?:: +* How can I pass optional or keyword parameters from one function to another?:: +* What is the difference between arguments and parameters?:: +* Why did changing list ‘y’ also change list ‘x’?:: +* How do I write a function with output parameters (call by reference)?: How do I write a function with output parameters call by reference ?. +* How do you make a higher order function in Python?:: +* How do I copy an object in Python?:: +* How can I find the methods or attributes of an object?:: +* How can my code discover the name of an object?:: +* What’s up with the comma operator’s precedence?:: +* Is there an equivalent of C’s “?;” ternary operator?: Is there an equivalent of C’s “? ” ternary operator?. +* Is it possible to write obfuscated one-liners in Python?:: +* What does the slash(/) in the parameter list of a function mean?: What does the slash / in the parameter list of a function mean?. + + +File: python.info, Node: Why am I getting an UnboundLocalError when the variable has a value?, Next: What are the rules for local and global variables in Python?, Up: Core Language + +10.2.2.1 Why am I getting an UnboundLocalError when the variable has a value? +............................................................................. + +It can be a surprise to get the *note UnboundLocalError: 1500. in +previously working code when it is modified by adding an assignment +statement somewhere in the body of a function. + +This code: + + >>> x = 10 + >>> def bar(): + ... print(x) + ... + >>> bar() + 10 + +works, but this code: + + >>> x = 10 + >>> def foo(): + ... print(x) + ... x += 1 + +results in an ‘UnboundLocalError’: + + >>> foo() + Traceback (most recent call last): + ... + UnboundLocalError: local variable 'x' referenced before assignment + +This is because when you make an assignment to a variable in a scope, +that variable becomes local to that scope and shadows any similarly +named variable in the outer scope. Since the last statement in foo +assigns a new value to ‘x’, the compiler recognizes it as a local +variable. Consequently when the earlier ‘print(x)’ attempts to print +the uninitialized local variable and an error results. + +In the example above you can access the outer scope variable by +declaring it global: + + >>> x = 10 + >>> def foobar(): + ... global x + ... print(x) + ... x += 1 + ... + >>> foobar() + 10 + +This explicit declaration is required in order to remind you that +(unlike the superficially analogous situation with class and instance +variables) you are actually modifying the value of the variable in the +outer scope: + + >>> print(x) + 11 + +You can do a similar thing in a nested scope using the *note nonlocal: +129a. keyword: + + >>> def foo(): + ... x = 10 + ... def bar(): + ... nonlocal x + ... print(x) + ... x += 1 + ... bar() + ... print(x) + ... + >>> foo() + 10 + 11 + + +File: python.info, Node: What are the rules for local and global variables in Python?, Next: Why do lambdas defined in a loop with different values all return the same result?, Prev: Why am I getting an UnboundLocalError when the variable has a value?, Up: Core Language + +10.2.2.2 What are the rules for local and global variables in Python? +..................................................................... + +In Python, variables that are only referenced inside a function are +implicitly global. If a variable is assigned a value anywhere within +the function’s body, it’s assumed to be a local unless explicitly +declared as global. + +Though a bit surprising at first, a moment’s consideration explains +this. On one hand, requiring *note global: 18a. for assigned variables +provides a bar against unintended side-effects. On the other hand, if +‘global’ was required for all global references, you’d be using ‘global’ +all the time. You’d have to declare as global every reference to a +built-in function or to a component of an imported module. This clutter +would defeat the usefulness of the ‘global’ declaration for identifying +side-effects. + + +File: python.info, Node: Why do lambdas defined in a loop with different values all return the same result?, Next: How do I share global variables across modules?, Prev: What are the rules for local and global variables in Python?, Up: Core Language + +10.2.2.3 Why do lambdas defined in a loop with different values all return the same result? +........................................................................................... + +Assume you use a for loop to define a few different lambdas (or even +plain functions), e.g.: + + >>> squares = [] + >>> for x in range(5): + ... squares.append(lambda: x**2) + +This gives you a list that contains 5 lambdas that calculate ‘x**2’. +You might expect that, when called, they would return, respectively, +‘0’, ‘1’, ‘4’, ‘9’, and ‘16’. However, when you actually try you will +see that they all return ‘16’: + + >>> squares[2]() + 16 + >>> squares[4]() + 16 + +This happens because ‘x’ is not local to the lambdas, but is defined in +the outer scope, and it is accessed when the lambda is called — not when +it is defined. At the end of the loop, the value of ‘x’ is ‘4’, so all +the functions now return ‘4**2’, i.e. ‘16’. You can also verify this +by changing the value of ‘x’ and see how the results of the lambdas +change: + + >>> x = 8 + >>> squares[2]() + 64 + +In order to avoid this, you need to save the values in variables local +to the lambdas, so that they don’t rely on the value of the global ‘x’: + + >>> squares = [] + >>> for x in range(5): + ... squares.append(lambda n=x: n**2) + +Here, ‘n=x’ creates a new variable ‘n’ local to the lambda and computed +when the lambda is defined so that it has the same value that ‘x’ had at +that point in the loop. This means that the value of ‘n’ will be ‘0’ in +the first lambda, ‘1’ in the second, ‘2’ in the third, and so on. +Therefore each lambda will now return the correct result: + + >>> squares[2]() + 4 + >>> squares[4]() + 16 + +Note that this behaviour is not peculiar to lambdas, but applies to +regular functions too. + + +File: python.info, Node: How do I share global variables across modules?, Next: What are the “best practices” for using import in a module?, Prev: Why do lambdas defined in a loop with different values all return the same result?, Up: Core Language + +10.2.2.4 How do I share global variables across modules? +........................................................ + +The canonical way to share information across modules within a single +program is to create a special module (often called config or cfg). +Just import the config module in all modules of your application; the +module then becomes available as a global name. Because there is only +one instance of each module, any changes made to the module object get +reflected everywhere. For example: + +config.py: + + x = 0 # Default value of the 'x' configuration setting + +mod.py: + + import config + config.x = 1 + +main.py: + + import config + import mod + print(config.x) + +Note that using a module is also the basis for implementing the +singleton design pattern, for the same reason. + + +File: python.info, Node: What are the “best practices” for using import in a module?, Next: Why are default values shared between objects?, Prev: How do I share global variables across modules?, Up: Core Language + +10.2.2.5 What are the “best practices” for using import in a module? +.................................................................... + +In general, don’t use ‘from modulename import *’. Doing so clutters the +importer’s namespace, and makes it much harder for linters to detect +undefined names. + +Import modules at the top of a file. Doing so makes it clear what other +modules your code requires and avoids questions of whether the module +name is in scope. Using one import per line makes it easy to add and +delete module imports, but using multiple imports per line uses less +screen space. + +It’s good practice if you import modules in the following order: + + 1. standard library modules – e.g. *note sys: d9, *note os: a1, *note + argparse: 6, *note re: b9. + + 2. third-party library modules (anything installed in Python’s + site-packages directory) – e.g. ‘dateutil’, ‘requests’, + ‘PIL.Image’ + + 3. locally developed modules + +It is sometimes necessary to move imports to a function or class to +avoid problems with circular imports. Gordon McMillan says: + + Circular imports are fine where both modules use the “import + ” form of import. They fail when the 2nd module wants to + grab a name out of the first (“from module import name”) and the + import is at the top level. That’s because names in the 1st are + not yet available, because the first module is busy importing the + 2nd. + +In this case, if the second module is only used in one function, then +the import can easily be moved into that function. By the time the +import is called, the first module will have finished initializing, and +the second module can do its import. + +It may also be necessary to move imports out of the top level of code if +some of the modules are platform-specific. In that case, it may not +even be possible to import all of the modules at the top of the file. +In this case, importing the correct modules in the corresponding +platform-specific code is a good option. + +Only move imports into a local scope, such as inside a function +definition, if it’s necessary to solve a problem such as avoiding a +circular import or are trying to reduce the initialization time of a +module. This technique is especially helpful if many of the imports are +unnecessary depending on how the program executes. You may also want to +move imports into a function if the modules are only ever used in that +function. Note that loading a module the first time may be expensive +because of the one time initialization of the module, but loading a +module multiple times is virtually free, costing only a couple of +dictionary lookups. Even if the module name has gone out of scope, the +module is probably available in *note sys.modules: 1550. + + +File: python.info, Node: Why are default values shared between objects?, Next: How can I pass optional or keyword parameters from one function to another?, Prev: What are the “best practices” for using import in a module?, Up: Core Language + +10.2.2.6 Why are default values shared between objects? +....................................................... + +This type of bug commonly bites neophyte programmers. Consider this +function: + + def foo(mydict={}): # Danger: shared reference to one dict for all calls + ... compute something ... + mydict[key] = value + return mydict + +The first time you call this function, ‘mydict’ contains a single item. +The second time, ‘mydict’ contains two items because when ‘foo()’ begins +executing, ‘mydict’ starts out with an item already in it. + +It is often expected that a function call creates new objects for +default values. This is not what happens. Default values are created +exactly once, when the function is defined. If that object is changed, +like the dictionary in this example, subsequent calls to the function +will refer to this changed object. + +By definition, immutable objects such as numbers, strings, tuples, and +‘None’, are safe from change. Changes to mutable objects such as +dictionaries, lists, and class instances can lead to confusion. + +Because of this feature, it is good programming practice to not use +mutable objects as default values. Instead, use ‘None’ as the default +value and inside the function, check if the parameter is ‘None’ and +create a new list/dictionary/whatever if it is. For example, don’t +write: + + def foo(mydict={}): + ... + +but: + + def foo(mydict=None): + if mydict is None: + mydict = {} # create a new dict for local namespace + +This feature can be useful. When you have a function that’s +time-consuming to compute, a common technique is to cache the parameters +and the resulting value of each call to the function, and return the +cached value if the same value is requested again. This is called +“memoizing”, and can be implemented like this: + + # Callers can only provide two parameters and optionally pass _cache by keyword + def expensive(arg1, arg2, *, _cache={}): + if (arg1, arg2) in _cache: + return _cache[(arg1, arg2)] + + # Calculate the value + result = ... expensive computation ... + _cache[(arg1, arg2)] = result # Store result in the cache + return result + +You could use a global variable containing a dictionary instead of the +default value; it’s a matter of taste. + + +File: python.info, Node: How can I pass optional or keyword parameters from one function to another?, Next: What is the difference between arguments and parameters?, Prev: Why are default values shared between objects?, Up: Core Language + +10.2.2.7 How can I pass optional or keyword parameters from one function to another? +.................................................................................... + +Collect the arguments using the ‘*’ and ‘**’ specifiers in the +function’s parameter list; this gives you the positional arguments as a +tuple and the keyword arguments as a dictionary. You can then pass +these arguments when calling another function by using ‘*’ and ‘**’: + + def f(x, *args, **kwargs): + ... + kwargs['width'] = '14.3c' + ... + g(x, *args, **kwargs) + + +File: python.info, Node: What is the difference between arguments and parameters?, Next: Why did changing list ‘y’ also change list ‘x’?, Prev: How can I pass optional or keyword parameters from one function to another?, Up: Core Language + +10.2.2.8 What is the difference between arguments and parameters? +................................................................. + +*note Parameters: 1eff. are defined by the names that appear in a +function definition, whereas *note arguments: 444. are the values +actually passed to a function when calling it. Parameters define what +*note kind of arguments: 1eff. a function can accept. For example, +given the function definition: + + def func(foo, bar=None, **kwargs): + pass + +'foo', 'bar' and 'kwargs' are parameters of ‘func’. However, when +calling ‘func’, for example: + + func(42, bar=314, extra=somevar) + +the values ‘42’, ‘314’, and ‘somevar’ are arguments. + + +File: python.info, Node: Why did changing list ‘y’ also change list ‘x’?, Next: How do I write a function with output parameters call by reference ?, Prev: What is the difference between arguments and parameters?, Up: Core Language + +10.2.2.9 Why did changing list ‘y’ also change list ‘x’? +........................................................ + +If you wrote code like: + + >>> x = [] + >>> y = x + >>> y.append(10) + >>> y + [10] + >>> x + [10] + +you might be wondering why appending an element to ‘y’ changed ‘x’ too. + +There are two factors that produce this result: + + 1. Variables are simply names that refer to objects. Doing ‘y = x’ + doesn’t create a copy of the list – it creates a new variable ‘y’ + that refers to the same object ‘x’ refers to. This means that + there is only one object (the list), and both ‘x’ and ‘y’ refer to + it. + + 2. Lists are *note mutable: 1c00, which means that you can change + their content. + +After the call to ‘append()’, 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]’. + +If we instead assign an immutable object to ‘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 + +we can see that in this case ‘x’ and ‘y’ are not equal anymore. This is +because integers are *note immutable: 1bfb, and when we do ‘x = x + 1’ +we are not mutating the int ‘5’ by incrementing its value; instead, we +are creating a new object (the int ‘6’) and assigning it to ‘x’ (that +is, changing which object ‘x’ refers to). After this assignment we have +two objects (the ints ‘6’ and ‘5’) and two variables that refer to them +(‘x’ now refers to ‘6’ but ‘y’ still refers to ‘5’). + +Some operations (for example ‘y.append(10)’ and ‘y.sort()’) mutate the +object, whereas superficially similar operations (for example ‘y = y + +[10]’ and *note sorted(y): bce.) create a new object. In general in +Python (and in all cases in the standard library) a method that mutates +an object will return ‘None’ to help avoid getting the two types of +operations confused. So if you mistakenly write ‘y.sort()’ thinking it +will give you a sorted copy of ‘y’, you’ll instead end up with ‘None’, +which will likely cause your program to generate an easily diagnosed +error. + +However, there is one class of operations where the same operation +sometimes has different behaviors with different types: the augmented +assignment operators. For example, ‘+=’ mutates lists but not tuples or +ints (‘a_list += [1, 2, 3]’ is equivalent to ‘a_list.extend([1, 2, 3])’ +and mutates ‘a_list’, whereas ‘some_tuple += (1, 2, 3)’ and ‘some_int += +1’ create new objects). + +In other words: + + * If we have a mutable object (*note list: 60d, *note dict: 258, + *note set: 5d5, etc.), 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 (*note str: 447, *note int: 259, + *note tuple: 36b, etc.), 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. + +If you want to know if two variables refer to the same object or not, +you can use the *note is: 2ef. operator, or the built-in function *note +id(): 13ee. + + +File: python.info, Node: How do I write a function with output parameters call by reference ?, Next: How do you make a higher order function in Python?, Prev: Why did changing list ‘y’ also change list ‘x’?, Up: Core Language + +10.2.2.10 How do I write a function with output parameters (call by reference)? +............................................................................... + +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 so no call-by-reference +per se. You can achieve the desired effect in a number of ways. + + 1. By returning a tuple of the results: + + >>> 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) + + This is almost always the clearest solution. + + 2. By using global variables. This isn’t thread-safe, and is not + recommended. + + 3. By passing a mutable (changeable in-place) object: + + >>> 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. By passing in a dictionary that gets mutated: + + >>> 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. Or bundle up values in a class instance: + + >>> 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} + + There’s almost never a good reason to get this complicated. + +Your best choice is to return a tuple containing the multiple results. + + +File: python.info, Node: How do you make a higher order function in Python?, Next: How do I copy an object in Python?, Prev: How do I write a function with output parameters call by reference ?, Up: Core Language + +10.2.2.11 How do you make a higher order function in Python? +............................................................ + +You have two choices: you can use nested scopes or you can use callable +objects. For example, suppose you wanted to define ‘linear(a,b)’ which +returns a function ‘f(x)’ that computes the value ‘a*x+b’. Using nested +scopes: + + def linear(a, b): + def result(x): + return a * x + b + return result + +Or using a callable object: + + class linear: + + def __init__(self, a, b): + self.a, self.b = a, b + + def __call__(self, x): + return self.a * x + self.b + +In both cases, + + taxes = linear(0.3, 2) + +gives a callable object where ‘taxes(10e6) == 0.3 * 10e6 + 2’. + +The callable object approach has the disadvantage that it is a bit +slower and results in slightly longer code. However, note that a +collection of callables can share their signature via inheritance: + + class exponential(linear): + # __init__ inherited + def __call__(self, x): + return self.a * (x ** self.b) + +Object can encapsulate state for several methods: + + 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 + +Here ‘inc()’, ‘dec()’ and ‘reset()’ act like functions which share the +same counting variable. + + +File: python.info, Node: How do I copy an object in Python?, Next: How can I find the methods or attributes of an object?, Prev: How do you make a higher order function in Python?, Up: Core Language + +10.2.2.12 How do I copy an object in Python? +............................................ + +In general, try *note copy.copy(): 52f. or *note copy.deepcopy(): b6e. +for the general case. Not all objects can be copied, but most can. + +Some objects can be copied more easily. Dictionaries have a *note +copy(): bd0. method: + + newdict = olddict.copy() + +Sequences can be copied by slicing: + + new_l = l[:] + + +File: python.info, Node: How can I find the methods or attributes of an object?, Next: How can my code discover the name of an object?, Prev: How do I copy an object in Python?, Up: Core Language + +10.2.2.13 How can I find the methods or attributes of an object? +................................................................ + +For an instance ‘x’ of a user-defined class, *note dir(x): 62e. returns +an alphabetized list of the names containing the instance attributes and +methods and attributes defined by its class. + + +File: python.info, Node: How can my code discover the name of an object?, Next: What’s up with the comma operator’s precedence?, Prev: How can I find the methods or attributes of an object?, Up: Core Language + +10.2.2.14 How can my code discover the name of an object? +......................................................... + +Generally speaking, it can’t, because objects don’t really have names. +Essentially, assignment always binds a name to a value; the same is true +of ‘def’ and ‘class’ statements, but in that case the value is a +callable. Consider the following code: + + >>> class A: + ... pass + ... + >>> B = A + >>> a = B() + >>> b = a + >>> print(b) + <__main__.A object at 0x16D07CC> + >>> print(a) + <__main__.A object at 0x16D07CC> + +Arguably the class has a name: even though it is bound to two names and +invoked through the name ‘B’ the created instance is still reported as +an instance of class ‘A’. However, it is impossible to say whether the +instance’s name is ‘a’ or ‘b’, since both names are bound to the same +value. + +Generally speaking it should not be necessary for your code to “know the +names” of particular values. Unless you are deliberately writing +introspective programs, this is usually an indication that a change of +approach might be beneficial. + +In comp.lang.python, Fredrik Lundh once gave an excellent analogy in +answer to this question: + + The same way as you get the name of that cat you found on your + porch: the cat (object) itself cannot tell you its name, and it + doesn’t really care – so the only way to find out what it’s called + is to ask all your neighbours (namespaces) if it’s their cat + (object)… + + ….and don’t be surprised if you’ll find that it’s known by many + names, or no name at all! + + +File: python.info, Node: What’s up with the comma operator’s precedence?, Next: Is there an equivalent of C’s “? ” ternary operator?, Prev: How can my code discover the name of an object?, Up: Core Language + +10.2.2.15 What’s up with the comma operator’s precedence? +......................................................... + +Comma is not an operator in Python. Consider this session: + + >>> "a" in "b", "a" + (False, 'a') + +Since the comma is not an operator, but a separator between expressions +the above is evaluated as if you had entered: + + ("a" in "b"), "a" + +not: + + "a" in ("b", "a") + +The same is true of the various assignment operators (‘=’, ‘+=’ etc). +They are not truly operators but syntactic delimiters in assignment +statements. + + +File: python.info, Node: Is there an equivalent of C’s “? ” ternary operator?, Next: Is it possible to write obfuscated one-liners in Python?, Prev: What’s up with the comma operator’s precedence?, Up: Core Language + +10.2.2.16 Is there an equivalent of C’s “?:” ternary operator? +.............................................................. + +Yes, there is. The syntax is as follows: + + [on_true] if [expression] else [on_false] + + x, y = 50, 25 + small = x if x < y else y + +Before this syntax was introduced in Python 2.5, a common idiom was to +use logical operators: + + [expression] and [on_true] or [on_false] + +However, this idiom is unsafe, as it can give wrong results when +'on_true' has a false boolean value. Therefore, it is always better to +use the ‘... if ... else ...’ form. + + +File: python.info, Node: Is it possible to write obfuscated one-liners in Python?, Next: What does the slash / in the parameter list of a function mean?, Prev: Is there an equivalent of C’s “? ” ternary operator?, Up: Core Language + +10.2.2.17 Is it possible to write obfuscated one-liners in Python? +.................................................................. + +Yes. Usually this is done by nesting *note lambda: 128f. within +‘lambda’. See the following three examples, slightly adapted from 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 + +Don’t try this at home, kids! + + +File: python.info, Node: What does the slash / in the parameter list of a function mean?, Prev: Is it possible to write obfuscated one-liners in Python?, Up: Core Language + +10.2.2.18 What does the slash(/) in the parameter list of a function mean? +.......................................................................... + +A slash in the argument list of a function denotes that the parameters +prior to it are positional-only. Positional-only parameters are the +ones without an externally usable name. Upon calling a function that +accepts positional-only parameters, arguments are mapped to parameters +based solely on their position. For example, *note divmod(): 9a1. is a +function that accepts positional-only parameters. Its documentation +looks like this: + + >>> 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. + +The slash at the end of the parameter list means that both parameters +are positional-only. Thus, calling *note divmod(): 9a1. with keyword +arguments would lead to an error: + + >>> divmod(x=3, y=4) + Traceback (most recent call last): + File "", line 1, in + TypeError: divmod() takes no keyword arguments + + +File: python.info, Node: Numbers and strings, Next: Performance<4>, Prev: Core Language, Up: Programming FAQ + +10.2.3 Numbers and strings +-------------------------- + +* Menu: + +* How do I specify hexadecimal and octal integers?:: +* Why does -22 // 10 return -3?:: +* How do I get int literal attribute instead of SyntaxError?:: +* How do I convert a string to a number?:: +* How do I convert a number to a string?:: +* How do I modify a string in place?:: +* How do I use strings to call functions/methods?:: +* 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?:: +* Can I end a raw string with an odd number of backslashes?:: + + +File: python.info, Node: How do I specify hexadecimal and octal integers?, Next: Why does -22 // 10 return -3?, Up: Numbers and strings + +10.2.3.1 How do I specify hexadecimal and octal integers? +......................................................... + +To specify an octal digit, precede the octal value with a zero, and then +a lower or uppercase “o”. For example, to set the variable “a” to the +octal value “10” (8 in decimal), type: + + >>> a = 0o10 + >>> a + 8 + +Hexadecimal is just as easy. Simply precede the hexadecimal number with +a zero, and then a lower or uppercase “x”. Hexadecimal digits can be +specified in lower or uppercase. For example, in the Python +interpreter: + + >>> a = 0xa5 + >>> a + 165 + >>> b = 0XB2 + >>> b + 178 + + +File: python.info, Node: Why does -22 // 10 return -3?, Next: How do I get int literal attribute instead of SyntaxError?, Prev: How do I specify hexadecimal and octal integers?, Up: Numbers and strings + +10.2.3.2 Why does -22 // 10 return -3? +...................................... + +It’s primarily driven by the desire that ‘i % j’ have the same sign as +‘j’. If you want that, and also want: + + i == (i // j) * j + (i % j) + +then integer division has to return the floor. C also requires that +identity to hold, and then compilers that truncate ‘i // j’ need to make +‘i % j’ have the same sign as ‘i’. + +There are few real use cases for ‘i % j’ when ‘j’ is negative. When ‘j’ +is positive, there are many, and in virtually all of them it’s more +useful for ‘i % j’ to be ‘>= 0’. If the clock says 10 now, what did it +say 200 hours ago? ‘-190 % 12 == 2’ is useful; ‘-190 % 12 == -10’ is a +bug waiting to bite. + + +File: python.info, Node: How do I get int literal attribute instead of SyntaxError?, Next: How do I convert a string to a number?, Prev: Why does -22 // 10 return -3?, Up: Numbers and strings + +10.2.3.3 How do I get int literal attribute instead of SyntaxError? +................................................................... + +Trying to lookup an ‘int’ literal attribute in the normal manner gives a +*note SyntaxError: 18d. because the period is seen as a decimal point: + + >>> 1.__class__ + File "", line 1 + 1.__class__ + ^ + SyntaxError: invalid decimal literal + +The solution is to separate the literal from the period with either a +space or parentheses. + + >>> 1 .__class__ + + >>> (1).__class__ + + + +File: python.info, Node: How do I convert a string to a number?, Next: How do I convert a number to a string?, Prev: How do I get int literal attribute instead of SyntaxError?, Up: Numbers and strings + +10.2.3.4 How do I convert a string to a number? +............................................... + +For integers, use the built-in *note int(): 259. type constructor, e.g. +‘int('144') == 144’. Similarly, *note float(): 2f1. converts to a +floating-point number, e.g. ‘float('144') == 144.0’. + +By default, these interpret the number as decimal, so that ‘int('0144') +== 144’ holds true, and ‘int('0x144')’ raises *note ValueError: 204. +‘int(string, base)’ takes the base to convert from as a second optional +argument, so ‘int( '0x144', 16) == 324’. If the base is specified as 0, +the number is interpreted using Python’s rules: a leading ‘0o’ indicates +octal, and ‘0x’ indicates a hex number. + +Do not use the built-in function *note eval(): 180. if all you need is +to convert strings to numbers. *note eval(): 180. will be significantly +slower and it presents a security risk: someone could pass you a Python +expression that might have unwanted side effects. For example, someone +could pass ‘__import__('os').system("rm -rf $HOME")’ which would erase +your home directory. + +*note eval(): 180. also has the effect of interpreting numbers as Python +expressions, so that e.g. ‘eval('09')’ gives a syntax error because +Python does not allow leading ‘0’ in a decimal number (except ‘0’). + + +File: python.info, Node: How do I convert a number to a string?, Next: How do I modify a string in place?, Prev: How do I convert a string to a number?, Up: Numbers and strings + +10.2.3.5 How do I convert a number to a string? +............................................... + +To convert, e.g., the number ‘144’ to the string ‘'144'’, use the +built-in type constructor *note str(): 447. If you want a hexadecimal +or octal representation, use the built-in functions *note hex(): 12c2. +or *note oct(): 12c1. For fancy formatting, see the *note f-strings: +9a9. and *note Format String Syntax: 137c. sections, e.g. +‘"{:04d}".format(144)’ yields ‘'0144'’ and ‘"{:.3f}".format(1.0/3.0)’ +yields ‘'0.333'’. + + +File: python.info, Node: How do I modify a string in place?, Next: How do I use strings to call functions/methods?, Prev: How do I convert a number to a string?, Up: Numbers and strings + +10.2.3.6 How do I modify a string in place? +........................................... + +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: f22. +object or the *note array: 7. 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: How do I use strings to call functions/methods?, Next: Is there an equivalent to Perl’s chomp for removing trailing newlines from strings?, Prev: How do I modify a string in place?, Up: Numbers and strings + +10.2.3.7 How do I use strings to call functions/methods? +........................................................ + +There are various techniques. + + * The best is to use a dictionary that maps strings to functions. + The primary advantage of this technique is that the strings do not + need to match the names of the functions. This is also the primary + technique used to emulate a case construct: + + 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 + + * Use the built-in function *note getattr(): bd1.: + + import foo + getattr(foo, 'bar')() + + Note that *note getattr(): bd1. works on any object, including + classes, class instances, modules, and so on. + + This is used in several places in the standard library, like this: + + class Foo: + def do_foo(self): + ... + + def do_bar(self): + ... + + f = getattr(foo_instance, 'do_' + opname) + f() + + * Use *note locals(): 141. to resolve the function name: + + 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: How do I use strings to call functions/methods?, Up: Numbers and strings + +10.2.3.8 Is there an equivalent to Perl’s ‘chomp()’ for removing trailing newlines from strings? +................................................................................................ + +You can use ‘S.rstrip("\r\n")’ to remove all occurrences of any line +terminator from the end of the string ‘S’ without removing other +trailing whitespace. If the string ‘S’ represents more than one line, +with several empty lines at the end, the line terminators for all the +blank lines will be removed: + + >>> lines = ("line 1 \r\n" + ... "\r\n" + ... "\r\n") + >>> lines.rstrip("\n\r") + 'line 1 ' + +Since this is typically only desired when reading text one line at a +time, using ‘S.rstrip()’ this way works well. + + +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: Numbers and strings + +10.2.3.9 Is there a ‘scanf()’ or ‘sscanf()’ equivalent? +....................................................... + +Not as such. + +For simple input parsing, the easiest approach is usually to split the +line into whitespace-delimited words using the *note split(): ea3. +method of string objects and then convert decimal strings to numeric +values using *note int(): 259. or *note float(): 2f1. ‘split()’ +supports an optional “sep” parameter which is useful if the line uses +something other than whitespace as a separator. + +For more complicated input parsing, regular expressions are more +powerful than C’s ‘sscanf’ and better suited for the task. + + +File: python.info, Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?, Next: Can I end a raw string with an odd number of backslashes?, Prev: Is there a scanf or sscanf equivalent?, Up: Numbers and strings + +10.2.3.10 What does ‘UnicodeDecodeError’ or ‘UnicodeEncodeError’ error mean? +............................................................................ + +See the *note Unicode HOWTO: 1297. + + +File: python.info, Node: Can I end a raw string with an odd number of backslashes?, Prev: What does UnicodeDecodeError or UnicodeEncodeError error mean?, Up: Numbers and strings + +10.2.3.11 Can I end a raw string with an odd number of backslashes? +................................................................... + +A raw string ending with an odd number of backslashes will escape the +string’s quote: + + >>> r'C:\this\will\not\work\' + File "", line 1 + r'C:\this\will\not\work\' + ^ + SyntaxError: unterminated string literal (detected at line 1) + +There are several workarounds for this. One is to use regular strings +and double the backslashes: + + >>> 'C:\\this\\will\\work\\' + 'C:\\this\\will\\work\\' + +Another is to concatenate a regular string containing an escaped +backslash to the raw string: + + >>> r'C:\this\will\work' '\\' + 'C:\\this\\will\\work\\' + +It is also possible to use *note os.path.join(): 1633. to append a +backslash on Windows: + + >>> os.path.join(r'C:\this\will\work', '') + 'C:\\this\\will\\work\\' + +Note that while a backslash will “escape” a quote for the purposes of +determining where the raw string ends, no escaping occurs when +interpreting the value of the raw string. That is, the backslash +remains present in the value of the raw string: + + >>> r'backslash\'preserved' + "backslash\\'preserved" + +Also see the specification in the *note language reference: 1ea4. + + +File: python.info, Node: Performance<4>, Next: Sequences Tuples/Lists, Prev: Numbers and strings, Up: Programming FAQ + +10.2.4 Performance +------------------ + +* Menu: + +* My program is too slow. How do I speed it up?: My program is too slow How do I speed it up?. +* What is the most efficient way to concatenate many strings together?:: + + +File: python.info, Node: My program is too slow How do I speed it up?, Next: What is the most efficient way to concatenate many strings together?, Up: Performance<4> + +10.2.4.1 My program is too slow. How do I speed it up? +...................................................... + +That’s a tough one, in general. First, here are a list of things to +remember before diving further: + + * Performance characteristics vary across Python implementations. + This FAQ focuses on *note CPython: 6f1. + + * Behaviour can vary across operating systems, especially when + talking about I/O or multi-threading. + + * You should always find the hot spots in your program 'before' + attempting to optimize any code (see the *note profile: af. + module). + + * Writing benchmark scripts will allow you to iterate quickly when + searching for improvements (see the *note timeit: ef. module). + + * It is highly recommended to have good code coverage (through unit + testing or any other technique) before potentially introducing + regressions hidden in sophisticated optimizations. + +That being said, there are many tricks to speed up Python code. Here +are some general principles which go a long way towards reaching +acceptable performance levels: + + * Making your algorithms faster (or changing to faster ones) can + yield much larger benefits than trying to sprinkle + micro-optimization tricks all over your code. + + * Use the right data structures. Study documentation for the *note + Built-in Types: 218e. and the *note collections: 1d. module. + + * When the standard library provides a primitive for doing something, + it is likely (although not guaranteed) to be faster than any + alternative you may come up with. This is doubly true for + primitives written in C, such as builtins and some extension types. + For example, be sure to use either the *note list.sort(): bcf. + built-in method or the related *note sorted(): bce. function to do + sorting (and see the *note Sorting Techniques: 217e. for examples + of moderately advanced usage). + + * Abstractions tend to create indirections and force the interpreter + to work more. If the levels of indirection outweigh the amount of + useful work done, your program will be slower. You should avoid + excessive abstraction, especially under the form of tiny functions + or methods (which are also often detrimental to readability). + +If you have reached the limit of what pure Python can allow, there are +tools to take you further away. For example, Cython(1) can compile a +slightly modified version of Python code into a C extension, and can be +used on many different platforms. Cython can take advantage of +compilation (and optional type annotations) to make your code +significantly faster than when interpreted. If you are confident in +your C programming skills, you can also *note write a C extension +module: 1bda. yourself. + +See also +........ + +The wiki page devoted to performance tips(2). + + ---------- Footnotes ---------- + + (1) https://cython.org + + (2) https://wiki.python.org/moin/PythonSpeed/PerformanceTips + + +File: python.info, Node: What is the most efficient way to concatenate many strings together?, Prev: My program is too slow How do I speed it up?, Up: Performance<4> + +10.2.4.2 What is the most efficient way to concatenate many strings together? +............................................................................. + +*note str: 447. and *note bytes: 1c2. objects are immutable, therefore +concatenating many strings together is inefficient as each concatenation +creates a new object. In the general case, the total runtime cost is +quadratic in the total string length. + +To accumulate many *note str: 447. objects, the recommended idiom is to +place them into a list and call *note str.join(): 21ab. at the end: + + chunks = [] + for s in my_strings: + chunks.append(s) + result = ''.join(chunks) + +(another reasonably efficient idiom is to use *note io.StringIO: f22.) + +To accumulate many *note bytes: 1c2. objects, the recommended idiom is +to extend a *note bytearray: 53a. object using in-place concatenation +(the ‘+=’ operator): + + result = bytearray() + for b in my_bytes_objects: + result += b + + +File: python.info, Node: Sequences Tuples/Lists, Next: Objects, Prev: Performance<4>, Up: Programming FAQ + +10.2.5 Sequences (Tuples/Lists) +------------------------------- + +* Menu: + +* How do I convert between tuples and lists?:: +* What’s a negative index?:: +* How do I iterate over a sequence in reverse order?:: +* How do you remove duplicates from a list?:: +* How do you remove multiple items from a list:: +* How do you make an array in Python?:: +* How do I create a multidimensional list?:: +* How do I apply a method or function to a sequence of objects?:: +* Why does a_tuple[i] += [‘item’] raise an exception when the addition works?:: +* I want to do a complicated sort; can you do a Schwartzian Transform in Python?: I want to do a complicated sort can you do a Schwartzian Transform in Python?. +* How can I sort one list by values from another list?:: + + +File: python.info, Node: How do I convert between tuples and lists?, Next: What’s a negative index?, Up: Sequences Tuples/Lists + +10.2.5.1 How do I convert between tuples and lists? +................................................... + +The type constructor ‘tuple(seq)’ converts any sequence (actually, any +iterable) into a tuple with the same items in the same order. + +For example, ‘tuple([1, 2, 3])’ yields ‘(1, 2, 3)’ and ‘tuple('abc')’ +yields ‘('a', 'b', 'c')’. If the argument is a tuple, it does not make +a copy but returns the same object, so it is cheap to call *note +tuple(): 36b. when you aren’t sure that an object is already a tuple. + +The type constructor ‘list(seq)’ converts any sequence or iterable into +a list with the same items in the same order. For example, ‘list((1, 2, +3))’ yields ‘[1, 2, 3]’ and ‘list('abc')’ yields ‘['a', 'b', 'c']’. If +the argument is a list, it makes a copy just like ‘seq[:]’ would. + + +File: python.info, Node: What’s a negative index?, Next: How do I iterate over a sequence in reverse order?, Prev: How do I convert between tuples and lists?, Up: Sequences Tuples/Lists + +10.2.5.2 What’s a negative index? +................................. + +Python sequences are indexed with positive numbers and negative numbers. +For positive numbers 0 is the first index 1 is the second index and so +forth. For negative indices -1 is the last index and -2 is the +penultimate (next to last) index and so forth. Think of ‘seq[-n]’ as +the same as ‘seq[len(seq)-n]’. + +Using negative indices can be very convenient. For example ‘S[:-1]’ is +all of the string except for its last character, which is useful for +removing the trailing newline from a string. + + +File: python.info, Node: How do I iterate over a sequence in reverse order?, Next: How do you remove duplicates from a list?, Prev: What’s a negative index?, Up: Sequences Tuples/Lists + +10.2.5.3 How do I iterate over a sequence in reverse order? +........................................................... + +Use the *note reversed(): 862. built-in function: + + for x in reversed(sequence): + ... # do something with x ... + +This won’t touch your original sequence, but build a new copy with +reversed order to iterate over. + + +File: python.info, Node: How do you remove duplicates from a list?, Next: How do you remove multiple items from a list, Prev: How do I iterate over a sequence in reverse order?, Up: Sequences Tuples/Lists + +10.2.5.4 How do you remove duplicates from a list? +.................................................. + +See the Python Cookbook for a long discussion of many ways to do this: + + ‘https://code.activestate.com/recipes/52560/’ + +If you don’t mind reordering the list, sort it and then scan from the +end of the list, deleting duplicates as you go: + + 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 (i.e. they are all +*note hashable: 60c.) this is often faster + + mylist = list(set(mylist)) + +This converts the list into a set, thereby removing duplicates, and then +back into a list. + + +File: python.info, Node: How do you remove multiple items from a list, Next: How do you make an array in Python?, Prev: How do you remove duplicates from a list?, 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] + +The list comprehension may be fastest. + + +File: python.info, Node: How do you make an array in Python?, Next: How do I create a multidimensional list?, Prev: How do you remove multiple items from a list, Up: Sequences Tuples/Lists + +10.2.5.6 How do you make an array in Python? +............................................ + +Use a list: + + ["this", 1, "is", "an", "array"] + +Lists are equivalent to C or Pascal arrays in their time complexity; the +primary difference is that a Python list can contain objects of many +different types. + +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. + +To get Lisp-style linked lists, you can emulate 'cons cells' using +tuples: + + lisp_list = ("like", ("this", ("example", None) ) ) + +If mutability is desired, you could use lists instead of tuples. Here +the analogue of a Lisp 'car' is ‘lisp_list[0]’ and the analogue of 'cdr' +is ‘lisp_list[1]’. Only do this if you’re sure you really need to, +because it’s usually a lot slower than using Python lists. + + ---------- Footnotes ---------- + + (1) https://numpy.org/ + + +File: python.info, Node: How do I create a multidimensional list?, Next: How do I apply a method or function to a sequence of objects?, Prev: How do you make an array in Python?, Up: Sequences Tuples/Lists + +10.2.5.7 How do I create a multidimensional list? +................................................. + +You probably tried to make a multidimensional array like this: + + >>> A = [[None] * 2] * 3 + +This looks correct if you print it: + + >>> A + [[None, None], [None, None], [None, None]] + +But when you assign a value, it shows up in multiple places: + + >>> A[0][0] = 5 + >>> A + [[5, None], [5, None], [5, None]] + +The reason is that replicating a list with ‘*’ doesn’t create copies, it +only creates references to the existing objects. The ‘*3’ creates a +list containing 3 references to the same list of length two. Changes to +one row will show in all rows, which is almost certainly not what you +want. + +The suggested approach is to create a list of the desired length first +and then fill in each element with a newly created list: + + A = [None] * 3 + for i in range(3): + A[i] = [None] * 2 + +This generates a list containing 3 different lists of length two. You +can also use a list comprehension: + + w, h = 2, 3 + A = [[None] * w for i in range(h)] + +Or, you can use an extension that provides a matrix datatype; NumPy(1) +is the best known. + + ---------- Footnotes ---------- + + (1) https://numpy.org/ + + +File: python.info, Node: How do I apply a method or function to a sequence of objects?, Next: Why does a_tuple[i] += [‘item’] raise an exception when the addition works?, Prev: How do I create a multidimensional list?, Up: Sequences Tuples/Lists + +10.2.5.8 How do I apply a method or function to a sequence of objects? +...................................................................... + +To call a method or function and accumulate the return values is a list, +a *note list comprehension: 6c9. is an elegant solution: + + result = [obj.method() for obj in mylist] + + result = [function(obj) for obj in mylist] + +To just run the method or function without saving the return values, a +plain *note for: 2ec. loop will suffice: + + for obj in mylist: + obj.method() + + for obj in mylist: + function(obj) + + +File: python.info, Node: Why does a_tuple[i] += [‘item’] raise an exception when the addition works?, Next: I want to do a complicated sort can you do a Schwartzian Transform in Python?, Prev: How do I apply a method or function to a sequence of objects?, Up: Sequences Tuples/Lists + +10.2.5.9 Why does a_tuple[i] += [‘item’] raise an exception when the addition works? +.................................................................................... + +This is because of a combination of the fact that augmented assignment +operators are 'assignment' operators, and the difference between mutable +and immutable objects in Python. + +This discussion applies in general when augmented assignment operators +are applied to elements of a tuple that point to mutable objects, but +we’ll use a ‘list’ and ‘+=’ as our exemplar. + +If you wrote: + + >>> a_tuple = (1, 2) + >>> a_tuple[0] += 1 + Traceback (most recent call last): + ... + TypeError: 'tuple' object does not support item assignment + +The reason for the exception should be immediately clear: ‘1’ is added +to the object ‘a_tuple[0]’ points to (‘1’), producing the result object, +‘2’, but when we attempt to assign the result of the computation, ‘2’, +to element ‘0’ of the tuple, we get an error because we can’t change +what an element of a tuple points to. + +Under the covers, what this augmented assignment statement is doing is +approximately this: + + >>> result = a_tuple[0] + 1 + >>> a_tuple[0] = result + Traceback (most recent call last): + ... + TypeError: 'tuple' object does not support item assignment + +It is the assignment part of the operation that produces the error, +since a tuple is immutable. + +When you write something like: + + >>> a_tuple = (['foo'], 'bar') + >>> a_tuple[0] += ['item'] + Traceback (most recent call last): + ... + TypeError: 'tuple' object does not support item assignment + +The exception is a bit more surprising, and even more surprising is the +fact that even though there was an error, the append worked: + + >>> a_tuple[0] + ['foo', 'item'] + +To see why this happens, you need to know that (a) if an object +implements an *note __iadd__(): 1f8e. 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 ‘extend()’ on the list and returning the list. +That’s why we say that for lists, ‘+=’ is a “shorthand” for +‘list.extend()’: + + >>> a_list = [] + >>> a_list += [1] + >>> a_list + [1] + +This is equivalent to: + + >>> result = a_list.__iadd__([1]) + >>> a_list = result + +The object pointed to by a_list has been mutated, and the pointer to the +mutated object is assigned back to ‘a_list’. The end result of the +assignment is a no-op, since it is a pointer to the same object that +‘a_list’ was previously pointing to, but the assignment still happens. + +Thus, in our tuple example what is happening is equivalent to: + + >>> result = a_tuple[0].__iadd__(['item']) + >>> a_tuple[0] = result + Traceback (most recent call last): + ... + TypeError: 'tuple' object does not support item assignment + +The ‘__iadd__()’ succeeds, and thus the list is extended, but even +though ‘result’ points to the same object that ‘a_tuple[0]’ already +points to, that final assignment still results in an error, because +tuples are immutable. + + +File: python.info, Node: I want to do a complicated sort can you do a Schwartzian Transform in Python?, Next: How can I sort one list by values from another list?, Prev: Why does a_tuple[i] += [‘item’] raise an exception when the addition works?, Up: Sequences Tuples/Lists + +10.2.5.10 I want to do a complicated sort: can you do a Schwartzian Transform in Python? +........................................................................................ + +The technique, attributed to Randal Schwartz of the Perl community, +sorts the elements of a list by a metric which maps each element to its +“sort value”. In Python, use the ‘key’ argument for the *note +list.sort(): bcf. method: + + Isorted = L[:] + Isorted.sort(key=lambda s: int(s[10:15])) + + +File: python.info, Node: How can I sort one list by values from another list?, Prev: I want to do a complicated sort can you do a Schwartzian Transform in Python?, Up: Sequences Tuples/Lists + +10.2.5.11 How can I sort one list by values from another list? +.............................................................. + +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: Objects, Next: Modules<5>, Prev: Sequences Tuples/Lists, Up: Programming FAQ + +10.2.6 Objects +-------------- + +* Menu: + +* What is a class?:: +* What is a method?:: +* What is self?:: +* How do I check if an object is an instance of a given class or of a subclass of it?:: +* What is delegation?:: +* How do I call a method defined in a base class from a derived class that extends it?:: +* How can I organize my code to make it easier to change the base class?:: +* How do I create static class data and static class methods?:: +* How can I overload constructors (or methods) in Python?: How can I overload constructors or methods in Python?. +* I try to use __spam and I get an error about _SomeClassName__spam.: I try to use __spam and I get an error about _SomeClassName__spam. +* My class defines __del__ but it is not called when I delete the object.: My class defines __del__ but it is not called when I delete the object. +* How do I get a list of all instances of a given class?:: +* Why does the result of id() appear to be not unique?: Why does the result of id appear to be not unique?. +* When can I rely on identity tests with the is operator?:: +* How can a subclass control what data is stored in an immutable instance?:: +* How do I cache method calls?:: + + +File: python.info, Node: What is a class?, Next: What is a method?, Up: Objects + +10.2.6.1 What is a class? +......................... + +A class is the particular object type created by executing a class +statement. Class objects are used as templates to create instance +objects, which embody both the data (attributes) and code (methods) +specific to a datatype. + +A class can be based on one or more other classes, called its base +class(es). It then inherits the attributes and methods of its base +classes. This allows an object model to be successively refined by +inheritance. You might have a generic ‘Mailbox’ class that provides +basic accessor methods for a mailbox, and subclasses such as +‘MboxMailbox’, ‘MaildirMailbox’, ‘OutlookMailbox’ that handle various +specific mailbox formats. + + +File: python.info, Node: What is a method?, Next: What is self?, Prev: What is a class?, Up: Objects + +10.2.6.2 What is a method? +.......................... + +A method is a function on some object ‘x’ that you normally call as +‘x.name(arguments...)’. Methods are defined as functions inside the +class definition: + + class C: + def meth(self, arg): + return arg * 2 + self.attribute + + +File: python.info, Node: What is self?, Next: How do I check if an object is an instance of a given class or of a subclass of it?, Prev: What is a method?, Up: Objects + +10.2.6.3 What is self? +...................... + +Self is merely a conventional name for the first argument of a method. +A method defined as ‘meth(self, a, b, c)’ should be called as ‘x.meth(a, +b, c)’ for some instance ‘x’ of the class in which the definition +occurs; the called method will think it is called as ‘meth(x, a, b, c)’. + +See also *note Why must ‘self’ be used explicitly in method definitions +and calls?: 5110. + + +File: python.info, Node: How do I check if an object is an instance of a given class or of a subclass of it?, Next: What is delegation?, Prev: What is self?, Up: Objects + +10.2.6.4 How do I check if an object is an instance of a given class or of a subclass of it? +............................................................................................ + +Use the built-in function *note isinstance(obj, cls): 43d. 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, e.g. ‘isinstance(obj, +(class1, class2, ...))’, and can also check whether an object is one of +Python’s built-in types, e.g. ‘isinstance(obj, str)’ or +‘isinstance(obj, (int, float, complex))’. + +Note that *note isinstance(): 43d. also checks for virtual inheritance +from an *note abstract base class: 11a8. 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 MRO: +360b. 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__ + (, , ) + + # Test for "true inheritance" + >>> Mapping in type(c).__mro__ + False + +Note that most programs do not use *note isinstance(): 43d. on +user-defined classes very often. If you are developing the classes +yourself, a more proper object-oriented style is to define methods on +the classes that encapsulate a particular behaviour, instead of checking +the object’s class and doing a different thing based on what class it +is. For example, if you have a function that does something: + + def search(obj): + if isinstance(obj, Mailbox): + ... # code to search a mailbox + elif isinstance(obj, Document): + ... # code to search a document + elif ... + +A better approach is to define a ‘search()’ method on all the classes +and just call it: + + 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: What is delegation?, Next: How do I call a method defined in a base class from a derived class that extends it?, Prev: How do I check if an object is an instance of a given class or of a subclass of it?, Up: Objects + +10.2.6.5 What is delegation? +............................ + +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 programmers can easily implement delegation. For example, the +following class implements a class that behaves like a file but converts +all written data to uppercase: + + 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) + +Here the ‘UpperOut’ class redefines the ‘write()’ method to convert the +argument string to uppercase before calling the underlying +‘self._outfile.write()’ method. All other methods are delegated to the +underlying ‘self._outfile’ object. The delegation is accomplished via +the *note __getattr__(): 4cf. method; consult *note the language +reference: 1f64. for more information about controlling attribute +access. + +Note that for more general cases delegation can get trickier. When +attributes must be set as well as retrieved, the class must define a +*note __setattr__(): 1f2d. method too, and it must do so carefully. The +basic implementation of ‘__setattr__()’ is roughly equivalent to the +following: + + class X: + ... + def __setattr__(self, name, value): + self.__dict__[name] = value + ... + +Many *note __setattr__(): 1f2d. 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__: 558. directly. + + +File: python.info, Node: How do I call a method defined in a base class from a derived class that extends it?, Next: How can I organize my code to make it easier to change the base class?, Prev: What is delegation?, Up: Objects + +10.2.6.6 How do I call a method defined in a base class from a derived class that extends it? +............................................................................................. + +Use the built-in *note super(): 4d7. function: + + class Derived(Base): + def meth(self): + super().meth() # calls Base.meth + +In the example, *note super(): 4d7. will automatically determine the +instance from which it was called (the ‘self’ value), look up the *note +method resolution order: 2180. (MRO) with ‘type(self).__mro__’, and +return the next in line after ‘Derived’ in the MRO: ‘Base’. + + +File: python.info, Node: How can I organize my code to make it easier to change the base class?, Next: How do I create static class data and static class methods?, Prev: How do I call a method defined in a base class from a derived class that extends it?, Up: Objects + +10.2.6.7 How can I organize my code to make it easier to change the base class? +............................................................................... + +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 +(e.g. depending on availability of resources) which base class to use. +Example: + + class Base: + ... + + BaseAlias = Base + + class Derived(BaseAlias): + ... + + +File: python.info, Node: How do I create static class data and static class methods?, Next: How can I overload constructors or methods in Python?, Prev: How can I organize my code to make it easier to change the base class?, Up: Objects + +10.2.6.8 How do I create static class data and static class methods? +.................................................................... + +Both static data and static methods (in the sense of C++ or Java) are +supported in Python. + +For static data, simply define a class attribute. To assign a new value +to the attribute, you have to explicitly use the class name in the +assignment: + + 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.count’ also refers to ‘C.count’ for any ‘c’ such that ‘isinstance(c, +C)’ holds, unless overridden by ‘c’ itself or by some class on the +base-class search path from ‘c.__class__’ back to ‘C’. + +Caution: within a method of C, an assignment like ‘self.count = 42’ +creates a new and unrelated instance named “count” in ‘self’’s own dict. +Rebinding of a class-static data name must always specify the class +whether inside a method or not: + + C.count = 314 + +Static methods are possible: + + class C: + @staticmethod + def static(arg1, arg2, arg3): + # No 'self' parameter! + ... + +However, a far more straightforward way to get the effect of a static +method is via a simple module-level function: + + def getcount(): + return C.count + +If your code is structured so as to define one class (or tightly related +class hierarchy) per module, this supplies the desired encapsulation. + + +File: python.info, Node: How can I overload constructors or methods in Python?, Next: I try to use __spam and I get an error about _SomeClassName__spam, Prev: How do I create static class data and static class methods?, Up: Objects + +10.2.6.9 How can I overload constructors (or methods) in Python? +................................................................ + +This answer actually applies to all methods, but the question usually +comes up first in the context of constructors. + +In C++ you’d write + + class C { + C() { cout << "No arguments\n"; } + C(int i) { cout << "Argument is " << i << "\n"; } + } + +In Python you have to write a single constructor that catches all cases +using default arguments. For example: + + class C: + def __init__(self, i=None): + if i is None: + print("No arguments") + else: + print("Argument is", i) + +This is not entirely equivalent, but close enough in practice. + +You could also try a variable-length argument list, e.g. + + def __init__(self, *args): + ... + +The same approach works for all method definitions. + + +File: python.info, Node: I try to use __spam and I get an error about _SomeClassName__spam, Next: My class defines __del__ but it is not called when I delete the object, Prev: How can I overload constructors or methods in Python?, Up: Objects + +10.2.6.10 I try to use __spam and I get an error about _SomeClassName__spam. +............................................................................ + +Variable names with double leading underscores are “mangled” to provide +a simple but effective way to define class private variables. Any +identifier of the form ‘__spam’ (at least two leading underscores, at +most one trailing underscore) is textually replaced with +‘_classname__spam’, where ‘classname’ is the current class name with any +leading underscores stripped. + +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. + +See also +........ + +The *note private name mangling specifications: 1cba. for details and +special cases. + + +File: python.info, Node: My class defines __del__ but it is not called when I delete the object, Next: How do I get a list of all instances of a given class?, Prev: I try to use __spam and I get an error about _SomeClassName__spam, Up: Objects + +10.2.6.11 My class defines __del__ but it is not called when I delete the object. +................................................................................. + +There are several possible reasons for this. + +The *note del: 17a6. statement does not necessarily call *note +__del__(): 1f61. – it simply decrements the object’s reference count, +and if this reaches zero ‘__del__()’ is called. + +If your data structures contain circular links (e.g. 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(): a39. to force a collection, +but there 'are' pathological cases where objects will never be +collected. + +Despite the cycle collector, it’s still a good idea to define an +explicit ‘close()’ method on objects to be called whenever you’re done +with them. The ‘close()’ method can then remove attributes that refer +to subobjects. Don’t call ‘__del__()’ directly – ‘__del__()’ should +call ‘close()’ and ‘close()’ should make sure that it can be called more +than once for the same object. + +Another way to avoid cyclical references is to use the *note weakref: +114. module, which allows you to point to objects without incrementing +their reference count. Tree data structures, for instance, should use +weak references for their parent and sibling references (if they need +them!). + +Finally, if your ‘__del__()’ method raises an exception, a warning +message is printed to *note sys.stderr: 939. + + +File: python.info, Node: How do I get a list of all instances of a given class?, Next: Why does the result of id appear to be not unique?, Prev: My class defines __del__ but it is not called when I delete the object, Up: Objects + +10.2.6.12 How do I get a list of all instances of a given class? +................................................................ + +Python does not keep track of all instances of a class (or of a built-in +type). You can program the class’s constructor to keep track of all +instances by keeping a list of weak references to each instance. + + +File: python.info, Node: Why does the result of id appear to be not unique?, Next: When can I rely on identity tests with the is operator?, Prev: How do I get a list of all instances of a given class?, Up: Objects + +10.2.6.13 Why does the result of ‘id()’ appear to be not unique? +................................................................ + +The *note id(): 13ee. builtin returns an integer that is guaranteed to +be unique during the lifetime of the object. Since in CPython, this is +the object’s memory address, it happens frequently that after an object +is deleted from memory, the next freshly created object is allocated at +the same position in memory. This is illustrated by this example: + + >>> id(1000) + 13901272 + >>> id(2000) + 13901272 + +The two ids belong to different integer objects that are created before, +and deleted immediately after execution of the ‘id()’ call. To be sure +that objects whose id you want to examine are still alive, create +another reference to the object: + + >>> a = 1000; b = 2000 + >>> id(a) + 13901272 + >>> id(b) + 13891296 + + +File: python.info, Node: When can I rely on identity tests with the is operator?, Next: How can a subclass control what data is stored in an immutable instance?, Prev: Why does the result of id appear to be not unique?, Up: Objects + +10.2.6.14 When can I rely on identity tests with the 'is' operator? +................................................................... + +The ‘is’ operator tests for object identity. The test ‘a is b’ is +equivalent to ‘id(a) == id(b)’. + +The most important property of an identity test is that an object is +always identical to itself, ‘a is a’ always returns ‘True’. Identity +tests are usually faster than equality tests. And unlike equality +tests, identity tests are guaranteed to return a boolean ‘True’ or +‘False’. + +However, identity tests can 'only' be substituted for equality tests +when object identity is assured. Generally, there are three +circumstances where identity is guaranteed: + + 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. + +In most other circumstances, identity tests are inadvisable and equality +tests are preferred. In particular, identity tests should not be used +to check constants such as *note int: 259. and *note str: 447. which +aren’t guaranteed to be singletons: + + >>> a = 1000 + >>> b = 500 + >>> c = b + 500 + >>> a is c + False + + >>> a = 'Python' + >>> b = 'Py' + >>> c = b + 'thon' + >>> a is c + False + +Likewise, new instances of mutable containers are never identical: + + >>> a = [] + >>> b = [] + >>> a is b + False + +In the standard library code, you will see several common patterns for +correctly using identity tests: + + 1. As recommended by PEP 8(1), an identity test is the preferred way + to check for ‘None’. This reads like plain English in code and + avoids confusion with other objects that may have boolean values + that evaluate to false. + + 2. Detecting optional arguments can be tricky when ‘None’ is a valid + input value. In those situations, you can create a singleton + sentinel object guaranteed to be distinct from other objects. For + example, here is how to implement a method that behaves like *note + dict.pop(): 33e.: + + _sentinel = object() + + def pop(self, key, default=_sentinel): + if key in self: + value = self[key] + del self[key] + return value + if default is _sentinel: + raise KeyError(key) + return default + + 3. Container implementations sometimes need to augment equality tests + with identity tests. This prevents the code from being confused by + objects such as ‘float('NaN')’ that are not equal to themselves. + +For example, here is the implementation of +‘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: How can a subclass control what data is stored in an immutable instance?, Next: How do I cache method calls?, Prev: When can I rely on identity tests with the is operator?, Up: Objects + +10.2.6.15 How can a subclass control what data is stored in an immutable instance? +.................................................................................. + +When subclassing an immutable type, override the *note __new__(): 57d. +method instead of the *note __init__(): 6ac. method. The latter only +runs 'after' an instance is created, which is too late to alter data in +an immutable instance. + +All of these immutable classes have a different signature than their +parent class: + + from datetime import date + + class FirstOfMonthDate(date): + "Always choose the first day of the month" + def __new__(cls, year, month, day): + return super().__new__(cls, year, month, 1) + + class NamedInt(int): + "Allow text names for some numbers" + xlat = {'zero': 0, 'one': 1, 'ten': 10} + def __new__(cls, value): + value = cls.xlat.get(value, value) + return super().__new__(cls, value) + + class TitleStr(str): + "Convert str to name suitable for a URL path" + def __new__(cls, s): + s = s.lower().replace(' ', '-') + s = ''.join([c for c in s if c.isalnum() or c == '-']) + return super().__new__(cls, s) + +The classes can be used like this: + + >>> 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: How do I cache method calls?, Prev: How can a subclass control what data is stored in an immutable instance?, Up: Objects + +10.2.6.16 How do I cache method calls? +...................................... + +The two principal tools for caching methods are *note +functools.cached_property(): 53e. and *note functools.lru_cache(): 9ee. +The former stores results at the instance level and the latter at the +class level. + +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 advantage is that when an instance is no longer used, the cached +method result will be released right away. The disadvantage is that if +instances accumulate, so too will the accumulated method results. They +can grow without bound. + +The 'lru_cache' approach works with methods that have *note hashable: +60c. arguments. It creates a reference to the instance unless special +efforts are made to pass in weak references. + +The advantage of the least recently used algorithm is that the cache is +bounded by the specified 'maxsize'. The disadvantage is that instances +are kept alive until they age out of the cache or until the cache is +cleared. + +This example shows the various techniques: + + 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__(): afa. and *note __hash__(): +afb. 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: Modules<5>, Prev: Objects, Up: Programming FAQ + +10.2.7 Modules +-------------- + +* Menu: + +* How do I create a .pyc file?: How do I create a pyc file?. +* How do I find the current module name?:: +* How can I have modules that mutually import each other?:: +* __import__(‘x.y.z’) returns ; how do I get z?: __import__ ‘x y z’ returns ; how do I get z?. +* When I edit an imported module and reimport it, the changes don’t show up. Why does this happen?: When I edit an imported module and reimport it the changes don’t show up Why does this happen?. + + +File: python.info, Node: How do I create a pyc file?, Next: How do I find the current module name?, Up: Modules<5> + +10.2.7.1 How do I create a .pyc file? +..................................... + +When a module is imported for the first time (or when the source file +has changed since the current compiled file was created) a ‘.pyc’ file +containing the compiled code should be created in a ‘__pycache__’ +subdirectory of the directory containing the ‘.py’ file. The ‘.pyc’ +file will have a filename that starts with the same name as the ‘.py’ +file, and ends with ‘.pyc’, with a middle component that depends on the +particular ‘python’ binary that created it. (See PEP 3147(1) for +details.) + +One reason that a ‘.pyc’ file may not be created is a permissions +problem with the directory containing the source file, meaning that the +‘__pycache__’ subdirectory cannot be created. This can happen, for +example, if you develop as one user but run as another, such as if you +are testing with a web server. + +Unless the *note PYTHONDONTWRITEBYTECODE: 139a. 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, etc…) 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. + +If you need to create a ‘.pyc’ file for ‘foo’ – that is, to create a +‘.pyc’ file for a module that is not imported – you can, using the *note +py_compile: b3. and *note compileall: 20. modules. + +The *note py_compile: b3. module can manually compile any module. One +way is to use the ‘compile()’ function in that module interactively: + + >>> 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’). + +You can also automatically compile all files in a directory or +directories using the *note compileall: 20. module. You can do it from +the shell prompt by running ‘compileall.py’ and providing the path of a +directory containing Python files to compile: + + python -m compileall . + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-3147/ + + +File: python.info, Node: How do I find the current module name?, Next: How can I have modules that mutually import each other?, Prev: How do I create a pyc file?, Up: Modules<5> + +10.2.7.2 How do I find the current module name? +............................................... + +A module can find out its own module name by looking at the predefined +global variable ‘__name__’. If this has the value ‘'__main__'’, the +program is running as a script. Many modules that are usually used by +importing them also provide a command-line interface or a self-test, and +only execute this code after checking ‘__name__’: + + def main(): + print('Running test...') + ... + + if __name__ == '__main__': + main() + + +File: python.info, Node: How can I have modules that mutually import each other?, Next: __import__ ‘x y z’ returns ; how do I get z?, Prev: How do I find the current module name?, Up: Modules<5> + +10.2.7.3 How can I have modules that mutually import each other? +................................................................ + +Suppose you have the following modules: + +‘foo.py’: + + from bar import bar_var + foo_var = 1 + +‘bar.py’: + + from foo import foo_var + bar_var = 2 + +The problem is that the interpreter will perform the following steps: + + * main imports ‘foo’ + + * Empty globals for ‘foo’ are created + + * ‘foo’ is compiled and starts executing + + * ‘foo’ imports ‘bar’ + + * Empty globals for ‘bar’ are created + + * ‘bar’ is compiled and starts executing + + * ‘bar’ imports ‘foo’ (which is a no-op since there already is a + module named ‘foo’) + + * The import mechanism tries to read ‘foo_var’ from ‘foo’ globals, to + set ‘bar.foo_var = foo.foo_var’ + +The last step fails, because Python isn’t done with interpreting ‘foo’ +yet and the global symbol dictionary for ‘foo’ is still empty. + +The same thing happens when you use ‘import foo’, and then try to access +‘foo.foo_var’ in global code. + +There are (at least) three possible workarounds for this problem. + +Guido van Rossum recommends avoiding all uses of ‘from import +...’, and placing all code inside functions. Initializations of global +variables and class variables should use constants or built-in functions +only. This means everything from an imported module is referenced as +‘.’. + +Jim Roskind suggests performing steps in the following order in each +module: + + * exports (globals, functions, and classes that don’t need imported + base classes) + + * ‘import’ statements + + * active code (including globals that are initialized from imported + values). + +Van Rossum doesn’t like this approach much because the imports appear in +a strange place, but it does work. + +Matthias Urlichs recommends restructuring your code so that the +recursive import is not necessary in the first place. + +These solutions are not mutually exclusive. + + +File: python.info, Node: __import__ ‘x y z’ returns ; how do I get z?, Next: When I edit an imported module and reimport it the changes don’t show up Why does this happen?, Prev: How can I have modules that mutually import each other?, Up: Modules<5> + +10.2.7.4 __import__(‘x.y.z’) returns ; how do I get z? +.................................................................. + +Consider using the convenience function *note import_module(): 513. from +*note importlib: 77. instead: + + z = importlib.import_module('x.y.z') + + +File: python.info, Node: When I edit an imported module and reimport it the changes don’t show up Why does this happen?, Prev: __import__ ‘x y z’ returns ; how do I get z?, Up: Modules<5> + +10.2.7.5 When I edit an imported module and reimport it, the changes don’t show up. Why does this happen? +......................................................................................................... + +For reasons of efficiency as well as consistency, Python only reads the +module file on the first time a module is imported. If it didn’t, in a +program consisting of many modules where each one imports the same basic +module, the basic module would be parsed and re-parsed many times. To +force re-reading of a changed module, do this: + + 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 + +will continue to work with the old version of the imported objects. If +the module contains class definitions, existing class instances will +'not' be updated to use the new class definition. This can result in +the following paradoxical behaviour: + + >>> import importlib + >>> import cls + >>> c = cls.C() # Create an instance of C + >>> importlib.reload(cls) + + >>> isinstance(c, cls.C) # isinstance is false?!? + False + +The nature of the problem is made clear if you print out the “identity” +of the class objects: + + >>> hex(id(c.__class__)) + '0x7352a0' + >>> hex(id(cls.C)) + '0x4198d0' + + +File: python.info, Node: Design and History FAQ, Next: Library and Extension FAQ, Prev: Programming FAQ, Up: Python Frequently Asked Questions + +10.3 Design and History FAQ +=========================== + +* Menu: + +* Why does Python use indentation for grouping of statements?:: +* Why am I getting strange results with simple arithmetic operations?:: +* Why are floating-point calculations so inaccurate?:: +* Why are Python strings immutable?:: +* Why must ‘self’ be used explicitly in method definitions and calls?:: +* Why can’t I use an assignment in an expression?:: +* Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))?: Why does Python use methods for some functionality e g list index but functions for other e g len list ?. +* Why is join() a string method instead of a list or tuple method?: Why is join a string method instead of a list or tuple method?. +* How fast are exceptions?:: +* Why isn’t there a switch or case statement in Python?:: +* Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?:: +* Why can’t lambda expressions contain statements?:: +* Can Python be compiled to machine code, C or some other language?: Can Python be compiled to machine code C or some other language?. +* How does Python manage memory?:: +* Why doesn’t CPython use a more traditional garbage collection scheme?:: +* Why isn’t all memory freed when CPython exits?:: +* Why are there separate tuple and list data types?:: +* How are lists implemented in CPython?:: +* How are dictionaries implemented in CPython?:: +* Why must dictionary keys be immutable?:: +* Why doesn’t list.sort() return the sorted list?: Why doesn’t list sort return the sorted list?. +* How do you specify and enforce an interface spec in Python?:: +* Why is there no goto?:: +* Why can’t raw strings (r-strings) end with a backslash?: Why can’t raw strings r-strings end with a backslash?. +* Why doesn’t Python have a “with” statement for attribute assignments?:: +* Why don’t generators support the with statement?:: +* Why are colons required for the if/while/def/class statements?:: +* Why does Python allow commas at the end of lists and tuples?:: + + +File: python.info, Node: Why does Python use indentation for grouping of statements?, Next: Why am I getting strange results with simple arithmetic operations?, Up: Design and History FAQ + +10.3.1 Why does Python use indentation for grouping of statements? +------------------------------------------------------------------ + +Guido van Rossum believes that using indentation for grouping is +extremely elegant and contributes a lot to the clarity of the average +Python program. Most people learn to love this feature after a while. + +Since there are no begin/end brackets there cannot be a disagreement +between grouping perceived by the parser and the human reader. +Occasionally C programmers will encounter a fragment of code like this: + + if (x <= y) + x++; + y--; + z++; + +Only the ‘x++’ statement is executed if the condition is true, but the +indentation leads many to believe otherwise. Even experienced C +programmers will sometimes stare at it a long time wondering as to why +‘y’ is being decremented even for ‘x > y’. + +Because there are no begin/end brackets, Python is much less prone to +coding-style conflicts. In C there are many different ways to place the +braces. After becoming used to reading and writing code using a +particular style, it is normal to feel somewhat uneasy when reading (or +being required to write) in a different one. + +Many coding styles place begin/end brackets on a line by themselves. +This makes programs considerably longer and wastes valuable screen +space, making it harder to get a good overview of a program. Ideally, a +function should fit on one screen (say, 20–30 lines). 20 lines of +Python can do a lot more work than 20 lines of C. This is not solely due +to the lack of begin/end brackets – the lack of declarations and the +high-level data types are also responsible – but the indentation-based +syntax certainly helps. + + +File: python.info, Node: Why am I getting strange results with simple arithmetic operations?, Next: Why are floating-point calculations so inaccurate?, Prev: Why does Python use indentation for grouping of statements?, Up: Design and History FAQ + +10.3.2 Why am I getting strange results with simple arithmetic operations? +-------------------------------------------------------------------------- + +See the next question. + + +File: python.info, Node: Why are floating-point calculations so inaccurate?, Next: Why are Python strings immutable?, Prev: Why am I getting strange results with simple arithmetic operations?, Up: Design and History FAQ + +10.3.3 Why are floating-point calculations so inaccurate? +--------------------------------------------------------- + +Users are often surprised by results like this: + + >>> 1.2 - 1.0 + 0.19999999999999996 + +and think it is a bug in Python. It’s not. This has little to do with +Python, and much more to do with how the underlying platform handles +floating-point numbers. + +The *note float: 2f1. type in CPython uses a C ‘double’ for storage. A +*note float: 2f1. object’s value is stored in binary floating-point with +a fixed precision (typically 53 bits) and Python uses C operations, +which in turn rely on the hardware implementation in the processor, to +perform floating-point operations. This means that as far as +floating-point operations are concerned, Python behaves like many +popular languages including C and Java. + +Many numbers that can be written easily in decimal notation cannot be +expressed exactly in binary floating point. For example, after: + + >>> x = 1.2 + +the value stored for ‘x’ is a (very good) approximation to the decimal +value ‘1.2’, but is not exactly equal to it. On a typical machine, the +actual stored value is: + + 1.0011001100110011001100110011001100110011001100110011 (binary) + +which is exactly: + + 1.1999999999999999555910790149937383830547332763671875 (decimal) + +The typical precision of 53 bits provides Python floats with 15–16 +decimal digits of accuracy. + +For a fuller explanation, please see the *note floating-point +arithmetic: 1d11. chapter in the Python tutorial. + + +File: python.info, Node: Why are Python strings immutable?, Next: Why must ‘self’ be used explicitly in method definitions and calls?, Prev: Why are floating-point calculations so inaccurate?, Up: Design and History FAQ + +10.3.4 Why are Python strings immutable? +---------------------------------------- + +There are several advantages. + +One is performance: knowing that a string is immutable means we can +allocate space for it at creation time, and the storage requirements are +fixed and unchanging. This is also one of the reasons for the +distinction between tuples and lists. + +Another advantage is that strings in Python are considered as +“elemental” as numbers. No amount of activity will change the value 8 +to anything else, and in Python, no amount of activity will change the +string “eight” to anything else. + + +File: python.info, Node: Why must ‘self’ be used explicitly in method definitions and calls?, Next: Why can’t I use an assignment in an expression?, Prev: Why are Python strings immutable?, Up: Design and History FAQ + +10.3.5 Why must ‘self’ be used explicitly in method definitions and calls? +-------------------------------------------------------------------------- + +The idea was borrowed from Modula-3. It turns out to be very useful, +for a variety of reasons. + +First, it’s more obvious that you are using a method or instance +attribute instead of a local variable. Reading ‘self.x’ or +‘self.meth()’ makes it absolutely clear that an instance variable or +method is used even if you don’t know the class definition by heart. In +C++, you can sort of tell by the lack of a local variable declaration +(assuming globals are rare or easily recognizable) – but in Python, +there are no local variable declarations, so you’d have to look up the +class definition to be sure. Some C++ and Java coding standards call +for instance attributes to have an ‘m_’ prefix, so this explicitness is +still useful in those languages, too. + +Second, it means that no special syntax is necessary if you want to +explicitly reference or call the method from a particular class. In +C++, if you want to use a method from a base class which is overridden +in a derived class, you have to use the ‘::’ operator – in Python you +can write ‘baseclass.methodname(self, )’. This is +particularly useful for *note __init__(): 6ac. methods, and in general +in cases where a derived class method wants to extend the base class +method of the same name and thus has to call the base class method +somehow. + +Finally, for instance variables it solves a syntactic problem with +assignment: since local variables in Python are (by definition!) those +variables to which a value is assigned in a function body (and that +aren’t explicitly declared global), there has to be some way to tell the +interpreter that an assignment was meant to assign to an instance +variable instead of to a local variable, and it should preferably be +syntactic (for efficiency reasons). C++ does this through declarations, +but Python doesn’t have declarations and it would be a pity having to +introduce them just for this purpose. Using the explicit ‘self.var’ +solves this nicely. Similarly, for using instance variables, having to +write ‘self.var’ means that references to unqualified names inside a +method don’t have to search the instance’s directories. To put it +another way, local variables and instance variables live in two +different namespaces, and you need to tell Python which namespace to +use. + + +File: python.info, Node: Why can’t I use an assignment in an expression?, Next: Why does Python use methods for some functionality e g list index but functions for other e g len list ?, Prev: Why must ‘self’ be used explicitly in method definitions and calls?, Up: Design and History FAQ + +10.3.6 Why can’t I use an assignment in an expression? +------------------------------------------------------ + +Starting in Python 3.8, you can! + +Assignment expressions using the walrus operator ‘:=’ assign a variable +in an expression: + + while chunk := fp.read(200): + print(chunk) + +See PEP 572(1) for more information. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0572/ + + +File: python.info, Node: Why does Python use methods for some functionality e g list index but functions for other e g len list ?, Next: Why is join a string method instead of a list or tuple method?, Prev: Why can’t I use an assignment in an expression?, Up: Design and History FAQ + +10.3.7 Why does Python use methods for some functionality (e.g. list.index()) but functions for other (e.g. len(list))? +----------------------------------------------------------------------------------------------------------------------- + +As Guido said: + + (a) For some operations, prefix notation just reads better than + postfix – prefix (and infix!) operations have a long tradition in + mathematics which likes notations where the visuals help the + mathematician thinking about a problem. Compare the easy with + which we rewrite a formula like x*(a+b) into x*a + x*b to the + clumsiness of doing the same thing using a raw OO notation. + + (b) When I read code that says len(x) I 'know' that it is asking + for the length of something. This tells me two things: the result + is an integer, and the argument is some kind of container. To the + contrary, when I read x.len(), I have to already know that x is + some kind of container implementing an interface or inheriting from + a class that has a standard len(). Witness the confusion we + occasionally have when a class that is not implementing a mapping + has a get() or keys() method, or something that isn’t a file has a + write() method. + +-- ‘https://mail.python.org/pipermail/python-3000/2006-November/004643.html’ + + +File: python.info, Node: Why is join a string method instead of a list or tuple method?, Next: How fast are exceptions?, Prev: Why does Python use methods for some functionality e g list index but functions for other e g len list ?, Up: Design and History FAQ + +10.3.8 Why is join() a string method instead of a list or tuple method? +----------------------------------------------------------------------- + +Strings became much more like other standard types starting in Python +1.6, when methods were added which give the same functionality that has +always been available using the functions of the string module. Most of +these new methods have been widely accepted, but the one which appears +to make some programmers feel uncomfortable is: + + ", ".join(['1', '2', '4', '8', '16']) + +which gives the result: + + "1, 2, 4, 8, 16" + +There are two common arguments against this usage. + +The first runs along the lines of: “It looks really ugly using a method +of a string literal (string constant)”, to which the answer is that it +might, but a string literal is just a fixed value. If the methods are +to be allowed on names bound to strings there is no logical reason to +make them unavailable on literals. + +The second objection is typically cast as: “I am really telling a +sequence to join its members together with a string constant”. Sadly, +you aren’t. For some reason there seems to be much less difficulty with +having *note split(): ea3. as a string method, since in that case it is +easy to see that + + "1, 2, 4, 8, 16".split(", ") + +is an instruction to a string literal to return the substrings delimited +by the given separator (or, by default, arbitrary runs of white space). + +*note join(): 21ab. is a string method because in using it you are +telling the separator string to iterate over a sequence of strings and +insert itself between adjacent elements. This method can be used with +any argument which obeys the rules for sequence objects, including any +new classes you might define yourself. Similar methods exist for bytes +and bytearray objects. + + +File: python.info, Node: How fast are exceptions?, Next: Why isn’t there a switch or case statement in Python?, Prev: Why is join a string method instead of a list or tuple method?, Up: Design and History FAQ + +10.3.9 How fast are exceptions? +------------------------------- + +A *note try: 6e4./*note except: 18b. block is extremely efficient if no +exceptions are raised. Actually catching an exception is expensive. In +versions of Python prior to 2.0 it was common to use this idiom: + + try: + value = mydict[key] + except KeyError: + mydict[key] = getvalue(key) + value = mydict[key] + +This only made sense when you expected the dict to have the key almost +all the time. If that wasn’t the case, you coded it like this: + + if key in mydict: + value = mydict[key] + else: + value = mydict[key] = getvalue(key) + +For this specific case, you could also use ‘value = dict.setdefault(key, +getvalue(key))’, but only if the ‘getvalue()’ call is cheap enough +because it is evaluated in all cases. + + +File: python.info, Node: Why isn’t there a switch or case statement in Python?, Next: Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?, Prev: How fast are exceptions?, Up: Design and History FAQ + +10.3.10 Why isn’t there a switch or case statement in Python? +------------------------------------------------------------- + +In general, structured switch statements execute one block of code when +an expression has a particular value or set of values. Since Python +3.10 one can easily match literal values, or constants within a +namespace, with a ‘match ... case’ statement. An older alternative is a +sequence of ‘if... elif... elif... else’. + +For cases where you need to choose from a very large number of +possibilities, you can create a dictionary mapping case values to +functions to call. For example: + + functions = {'a': function_1, + 'b': function_2, + 'c': self.method_1} + + func = functions[value] + func() + +For calling methods on objects, you can simplify yet further by using +the *note getattr(): bd1. built-in to retrieve methods with a particular +name: + + class MyVisitor: + def visit_a(self): + ... + + def dispatch(self, value): + method_name = 'visit_' + str(value) + method = getattr(self, method_name) + method() + +It’s suggested that you use a prefix for the method names, such as +‘visit_’ in this example. Without such a prefix, if values are coming +from an untrusted source, an attacker would be able to call any method +on your object. + +Imitating switch with fallthrough, as with C’s switch-case-default, is +possible, much harder, and less needed. + + +File: python.info, Node: Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?, Next: Why can’t lambda expressions contain statements?, Prev: Why isn’t there a switch or case statement in Python?, Up: Design and History FAQ + +10.3.11 Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation? +---------------------------------------------------------------------------------------------------------------- + +Answer 1: Unfortunately, the interpreter pushes at least one C stack +frame for each Python stack frame. Also, extensions can call back into +Python at almost random moments. Therefore, a complete threads +implementation requires thread support for C. + +Answer 2: Fortunately, there is Stackless Python(1), which has a +completely redesigned interpreter loop that avoids the C stack. + + ---------- Footnotes ---------- + + (1) https://github.com/stackless-dev/stackless/wiki + + +File: python.info, Node: Why can’t lambda expressions contain statements?, Next: Can Python be compiled to machine code C or some other language?, Prev: Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?, Up: Design and History FAQ + +10.3.12 Why can’t lambda expressions contain statements? +-------------------------------------------------------- + +Python lambda expressions cannot contain statements because Python’s +syntactic framework can’t handle statements nested inside expressions. +However, in Python, this is not a serious problem. Unlike lambda forms +in other languages, where they add functionality, Python lambdas are +only a shorthand notation if you’re too lazy to define a function. + +Functions are already first class objects in Python, and can be declared +in a local scope. Therefore the only advantage of using a lambda +instead of a locally defined function is that you don’t need to invent a +name for the function – but that’s just a local variable to which the +function object (which is exactly the same type of object that a lambda +expression yields) is assigned! + + +File: python.info, Node: Can Python be compiled to machine code C or some other language?, Next: How does Python manage memory?, Prev: Why can’t lambda expressions contain statements?, Up: Design and History FAQ + +10.3.13 Can Python be compiled to machine code, C or some other language? +------------------------------------------------------------------------- + +Cython(1) compiles a modified version of Python with optional +annotations into C extensions. Nuitka(2) is an up-and-coming compiler +of Python into C++ code, aiming to support the full Python language. + + ---------- Footnotes ---------- + + (1) https://cython.org/ + + (2) https://nuitka.net/ + + +File: python.info, Node: How does Python manage memory?, Next: Why doesn’t CPython use a more traditional garbage collection scheme?, Prev: Can Python be compiled to machine code C or some other language?, Up: Design and History FAQ + +10.3.14 How does Python manage memory? +-------------------------------------- + +The details of Python memory management depend on the implementation. +The standard implementation of Python, *note CPython: 6f1, uses +reference counting to detect inaccessible objects, and another mechanism +to collect reference cycles, periodically executing a cycle detection +algorithm which looks for inaccessible cycles and deletes the objects +involved. The *note gc: 60. module provides functions to perform a +garbage collection, obtain debugging statistics, and tune the +collector’s parameters. + +Other implementations (such as Jython(1) or PyPy(2)), however, can rely +on a different mechanism such as a full-blown garbage collector. This +difference can cause some subtle porting problems if your Python code +depends on the behavior of the reference counting implementation. + +In some Python implementations, the following code (which is fine in +CPython) will probably run out of file descriptors: + + for file in very_long_list_of_files: + f = open(file) + c = f.read(1) + +Indeed, using CPython’s reference counting and destructor scheme, each +new assignment to ‘f’ closes the previous file. With a traditional GC, +however, those file objects will only get collected (and closed) at +varying and possibly long intervals. + +If you want to write code that will work with any Python implementation, +you should explicitly close the file or use the *note with: 5ce. +statement; this will work regardless of memory management scheme: + + 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: Why doesn’t CPython use a more traditional garbage collection scheme?, Next: Why isn’t all memory freed when CPython exits?, Prev: How does Python manage memory?, Up: Design and History FAQ + +10.3.15 Why doesn’t CPython use a more traditional garbage collection scheme? +----------------------------------------------------------------------------- + +For one thing, this is not a C standard feature and hence it’s not +portable. (Yes, we know about the Boehm GC library. It has bits of +assembler code for 'most' common platforms, not for all of them, and +although it is mostly transparent, it isn’t completely transparent; +patches are required to get Python to work with it.) + +Traditional GC also becomes a problem when Python is embedded into other +applications. While in a standalone Python it’s fine to replace the +standard ‘malloc()’ and ‘free()’ with versions provided by the GC +library, an application embedding Python may want to have its 'own' +substitute for ‘malloc()’ and ‘free()’, and may not want Python’s. +Right now, CPython works with anything that implements ‘malloc()’ and +‘free()’ properly. + + +File: python.info, Node: Why isn’t all memory freed when CPython exits?, Next: Why are there separate tuple and list data types?, Prev: Why doesn’t CPython use a more traditional garbage collection scheme?, Up: Design and History FAQ + +10.3.16 Why isn’t all memory freed when CPython exits? +------------------------------------------------------ + +Objects referenced from the global namespaces of Python modules are not +always deallocated when Python exits. This may happen if there are +circular references. There are also certain bits of memory that are +allocated by the C library that are impossible to free (e.g. a tool +like Purify will complain about these). Python is, however, aggressive +about cleaning up memory on exit and does try to destroy every single +object. + +If you want to force Python to delete certain things on deallocation use +the *note atexit: c. module to run a function that will force those +deletions. + + +File: python.info, Node: Why are there separate tuple and list data types?, Next: How are lists implemented in CPython?, Prev: Why isn’t all memory freed when CPython exits?, Up: Design and History FAQ + +10.3.17 Why are there separate tuple and list data types? +--------------------------------------------------------- + +Lists and tuples, while similar in many respects, are generally used in +fundamentally different ways. Tuples can be thought of as being similar +to Pascal ‘records’ or C ‘structs’; they’re small collections of related +data which may be of different types which are operated on as a group. +For example, a Cartesian coordinate is appropriately represented as a +tuple of two or three numbers. + +Lists, on the other hand, are more like arrays in other languages. They +tend to hold a varying number of objects all of which have the same type +and which are operated on one-by-one. For example, *note +os.listdir('.'): 10ee. returns a list of strings representing the files +in the current directory. Functions which operate on this output would +generally not break if you added another file or two to the directory. + +Tuples are immutable, meaning that once a tuple has been created, you +can’t replace any of its elements with a new value. Lists are mutable, +meaning that you can always change a list’s elements. Only immutable +elements can be used as dictionary keys, and hence only tuples and not +lists can be used as keys. + + +File: python.info, Node: How are lists implemented in CPython?, Next: How are dictionaries implemented in CPython?, Prev: Why are there separate tuple and list data types?, Up: Design and History FAQ + +10.3.18 How are lists implemented in CPython? +--------------------------------------------- + +CPython’s lists are really variable-length arrays, not Lisp-style linked +lists. The implementation uses a contiguous array of references to +other objects, and keeps a pointer to this array and the array’s length +in a list head structure. + +This makes indexing a list ‘a[i]’ an operation whose cost is independent +of the size of the list or the value of the index. + +When items are appended or inserted, the array of references is resized. +Some cleverness is applied to improve the performance of appending items +repeatedly; when the array must be grown, some extra space is allocated +so the next few times don’t require an actual resize. + + +File: python.info, Node: How are dictionaries implemented in CPython?, Next: Why must dictionary keys be immutable?, Prev: How are lists implemented in CPython?, Up: Design and History FAQ + +10.3.19 How are dictionaries implemented in CPython? +---------------------------------------------------- + +CPython’s dictionaries are implemented as resizable hash tables. +Compared to B-trees, this gives better performance for lookup (the most +common operation by far) under most circumstances, and the +implementation is simpler. + +Dictionaries work by computing a hash code for each key stored in the +dictionary using the *note hash(): 5e7. built-in function. The hash +code varies widely depending on the key and a per-process seed; for +example, ‘'Python'’ could hash to ‘-539294296’ while ‘'python'’, a +string that differs by a single bit, could hash to ‘1142331976’. The +hash code is then used to calculate a location in an internal array +where the value will be stored. Assuming that you’re storing keys that +all have different hash values, this means that dictionaries take +constant time – 'O'(1), in Big-O notation – to retrieve a key. + + +File: python.info, Node: Why must dictionary keys be immutable?, Next: Why doesn’t list sort return the sorted list?, Prev: How are dictionaries implemented in CPython?, Up: Design and History FAQ + +10.3.20 Why must dictionary keys be immutable? +---------------------------------------------- + +The hash table implementation of dictionaries uses a hash value +calculated from the key value to find the key. If the key were a +mutable object, its value could change, and thus its hash could also +change. But since whoever changes the key object can’t tell that it was +being used as a dictionary key, it can’t move the entry around in the +dictionary. Then, when you try to look up the same object in the +dictionary it won’t be found because its hash value is different. If +you tried to look up the old value it wouldn’t be found either, because +the value of the object found in that hash bin would be different. + +If you want a dictionary indexed with a list, simply convert the list to +a tuple first; the function ‘tuple(L)’ creates a tuple with the same +entries as the list ‘L’. Tuples are immutable and can therefore be used +as dictionary keys. + +Some unacceptable solutions that have been proposed: + + - Hash lists by their address (object ID). This doesn’t work because + if you construct a new list with the same value it won’t be found; + e.g.: + + mydict = {[1, 2]: '12'} + print(mydict[[1, 2]]) + + would raise a *note KeyError: 33f. exception because the id of the + ‘[1, 2]’ used in the second line differs from that in the first + line. In other words, dictionary keys should be compared using + ‘==’, not using *note is: 2ef. + + - Make a copy when using a list as a key. This doesn’t work because + the list, being a mutable object, could contain a reference to + itself, and then the copying code would run into an infinite loop. + + - Allow lists as keys but tell the user not to modify them. This + would allow a class of hard-to-track bugs in programs when you + forgot or modified a list by accident. It also invalidates an + important invariant of dictionaries: every value in ‘d.keys()’ is + usable as a key of the dictionary. + + - Mark lists as read-only once they are used as a dictionary key. + The problem is that it’s not just the top-level object that could + change its value; you could use a tuple containing a list as a key. + Entering anything as a key into a dictionary would require marking + all objects reachable from there as read-only – and again, + self-referential objects could cause an infinite loop. + +There is a trick to get around this if you need to, but use it at your +own risk: You can wrap a mutable structure inside a class instance which +has both a *note __eq__(): afa. and a *note __hash__(): afb. method. +You must then make sure that the hash value for all such wrapper objects +that reside in a dictionary (or other hash based structure), remain +fixed while the object is in the dictionary (or other structure). + + 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 + +Note that the hash computation is complicated by the possibility that +some members of the list may be unhashable and also by the possibility +of arithmetic overflow. + +Furthermore it must always be the case that if ‘o1 == o2’ (ie +‘o1.__eq__(o2) is True’) then ‘hash(o1) == hash(o2)’ (ie, ‘o1.__hash__() +== o2.__hash__()’), regardless of whether the object is in a dictionary +or not. If you fail to meet these restrictions dictionaries and other +hash based structures will misbehave. + +In the case of ‘ListWrapper’, whenever the wrapper object is in a +dictionary the wrapped list must not change to avoid anomalies. Don’t +do this unless you are prepared to think hard about the requirements and +the consequences of not meeting them correctly. Consider yourself +warned. + + +File: python.info, Node: Why doesn’t list sort return the sorted list?, Next: How do you specify and enforce an interface spec in Python?, Prev: Why must dictionary keys be immutable?, Up: Design and History FAQ + +10.3.21 Why doesn’t list.sort() return the sorted list? +------------------------------------------------------- + +In situations where performance matters, making a copy of the list just +to sort it would be wasteful. Therefore, *note list.sort(): bcf. sorts +the list in place. In order to remind you of that fact, it does not +return the sorted list. This way, you won’t be fooled into accidentally +overwriting a list when you need a sorted copy but also need to keep the +unsorted version around. + +If you want to return a new list, use the built-in *note sorted(): bce. +function instead. This function creates a new list from a provided +iterable, sorts it and returns it. For example, here’s how to iterate +over the keys of a dictionary in sorted order: + + for key in sorted(mydict): + ... # do whatever with mydict[key]... + + +File: python.info, Node: How do you specify and enforce an interface spec in Python?, Next: Why is there no goto?, Prev: Why doesn’t list sort return the sorted list?, Up: Design and History FAQ + +10.3.22 How do you specify and enforce an interface spec in Python? +------------------------------------------------------------------- + +An interface specification for a module as provided by languages such as +C++ and Java describes the prototypes for the methods and functions of +the module. Many feel that compile-time enforcement of interface +specifications helps in the construction of large programs. + +Python 2.6 adds an *note abc: 4. module that lets you define Abstract +Base Classes (ABCs). You can then use *note isinstance(): 43d. and +*note issubclass(): 7bc. to check whether an instance or a class +implements a particular ABC. The *note collections.abc: 1e. module +defines a set of useful ABCs such as *note Iterable: 224d, *note +Container: 224f, and *note MutableMapping: 10a2. + +For Python, many of the advantages of interface specifications can be +obtained by an appropriate test discipline for components. + +A good test suite for a module can both provide a regression test and +serve as a module interface specification and a set of examples. Many +Python modules can be run as a script to provide a simple “self test.” +Even modules which use complex external interfaces can often be tested +in isolation using trivial “stub” emulations of the external interface. +The *note doctest: 3a. and *note unittest: 106. modules or third-party +test frameworks can be used to construct exhaustive test suites that +exercise every line of code in a module. + +An appropriate testing discipline can help build large complex +applications in Python as well as having interface specifications would. +In fact, it can be better because an interface specification cannot test +certain properties of a program. For example, the ‘list.append()’ +method is expected to add new elements to the end of some internal list; +an interface specification cannot test that your ‘list.append()’ +implementation will actually do this correctly, but it’s trivial to +check this property in a test suite. + +Writing test suites is very helpful, and you might want to design your +code to make it easily tested. One increasingly popular technique, +test-driven development, calls for writing parts of the test suite +first, before you write any of the actual code. Of course Python allows +you to be sloppy and not write test cases at all. + + +File: python.info, Node: Why is there no goto?, Next: Why can’t raw strings r-strings end with a backslash?, Prev: How do you specify and enforce an interface spec in Python?, Up: Design and History FAQ + +10.3.23 Why is there no goto? +----------------------------- + +In the 1970s people realized that unrestricted goto could lead to messy +“spaghetti” code that was hard to understand and revise. In a +high-level language, it is also unneeded as long as there are ways to +branch (in Python, with *note if: 2ed. statements and *note or: 2f0, +*note and: 2eb, and *note if: 2ed./*note else: 18c. expressions) and +loop (with *note while: 1c04. and *note for: 2ec. statements, possibly +containing *note continue: 9c9. and *note break: aa9.). + +One can also use exceptions to provide a “structured goto” that works +even across function calls. Many feel that exceptions can conveniently +emulate all reasonable uses of the ‘go’ or ‘goto’ constructs of C, +Fortran, and other languages. For example: + + class label(Exception): pass # declare a label + + try: + ... + if condition: raise label() # goto label + ... + except label: # where to goto + pass + ... + +This doesn’t allow you to jump into the middle of a loop, but that’s +usually considered an abuse of ‘goto’ anyway. Use sparingly. + + +File: python.info, Node: Why can’t raw strings r-strings end with a backslash?, Next: Why doesn’t Python have a “with” statement for attribute assignments?, Prev: Why is there no goto?, Up: Design and History FAQ + +10.3.24 Why can’t raw strings (r-strings) end with a backslash? +--------------------------------------------------------------- + +More precisely, they can’t end with an odd number of backslashes: the +unpaired backslash at the end escapes the closing quote character, +leaving an unterminated string. + +Raw strings were designed to ease creating input for processors (chiefly +regular expression engines) that want to do their own backslash escape +processing. Such processors consider an unmatched trailing backslash to +be an error anyway, so raw strings disallow that. In return, they allow +you to pass on the string quote character by escaping it with a +backslash. These rules work well when r-strings are used for their +intended purpose. + +If you’re trying to build Windows pathnames, note that all Windows +system calls accept forward slashes too: + + f = open("/mydir/file.txt") # works fine! + +If you’re trying to build a pathname for a DOS command, try e.g. one of + + 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: Why doesn’t Python have a “with” statement for attribute assignments?, Next: Why don’t generators support the with statement?, Prev: Why can’t raw strings r-strings end with a backslash?, Up: Design and History FAQ + +10.3.25 Why doesn’t Python have a “with” statement for attribute assignments? +----------------------------------------------------------------------------- + +Python has a *note with: 5ce. statement that wraps the execution of a +block, calling code on the entrance and exit from the block. Some +languages have a construct that looks like this: + + with obj: + a = 1 # equivalent to obj.a = 1 + total = total + 1 # obj.total = obj.total + 1 + +In Python, such a construct would be ambiguous. + +Other languages, such as Object Pascal, Delphi, and C++, use static +types, so it’s possible to know, in an unambiguous way, what member is +being assigned to. This is the main point of static typing – the +compiler 'always' knows the scope of every variable at compile time. + +Python uses dynamic types. It is impossible to know in advance which +attribute will be referenced at runtime. Member attributes may be added +or removed from objects on the fly. This makes it impossible to know, +from a simple reading, what attribute is being referenced: a local one, +a global one, or a member attribute? + +For instance, take the following incomplete snippet: + + def foo(a): + with a: + print(x) + +The snippet assumes that ‘a’ must have a member attribute called ‘x’. +However, there is nothing in Python that tells the interpreter this. +What should happen if ‘a’ is, let us say, an integer? If there is a +global variable named ‘x’, will it be used inside the *note with: 5ce. +block? As you see, the dynamic nature of Python makes such choices much +harder. + +The primary benefit of *note with: 5ce. and similar language features +(reduction of code volume) can, however, easily be achieved in Python by +assignment. Instead of: + + function(args).mydict[index][index].a = 21 + function(args).mydict[index][index].b = 42 + function(args).mydict[index][index].c = 63 + +write this: + + ref = function(args).mydict[index][index] + ref.a = 21 + ref.b = 42 + ref.c = 63 + +This also has the side-effect of increasing execution speed because name +bindings are resolved at run-time in Python, and the second version only +needs to perform the resolution once. + +Similar proposals that would introduce syntax to further reduce code +volume, such as using a ‘leading dot’, have been rejected in favour of +explicitness (see +‘https://mail.python.org/pipermail/python-ideas/2016-May/040070.html’). + + +File: python.info, Node: Why don’t generators support the with statement?, Next: Why are colons required for the if/while/def/class statements?, Prev: Why doesn’t Python have a “with” statement for attribute assignments?, Up: Design and History FAQ + +10.3.26 Why don’t generators support the with statement? +-------------------------------------------------------- + +For technical reasons, a generator used directly as a context manager +would not work correctly. When, as is most common, a generator is used +as an iterator run to completion, no closing is needed. When it is, +wrap it as *note contextlib.closing(generator): 294c. in the *note with: +5ce. statement. + + +File: python.info, Node: Why are colons required for the if/while/def/class statements?, Next: Why does Python allow commas at the end of lists and tuples?, Prev: Why don’t generators support the with statement?, Up: Design and History FAQ + +10.3.27 Why are colons required for the if/while/def/class statements? +---------------------------------------------------------------------- + +The colon is required primarily to enhance readability (one of the +results of the experimental ABC language). Consider this: + + if a == b + print(a) + +versus + + if a == b: + print(a) + +Notice how the second one is slightly easier to read. Notice further +how a colon sets off the example in this FAQ answer; it’s a standard +usage in English. + +Another minor reason is that the colon makes it easier for editors with +syntax highlighting; they can look for colons to decide when indentation +needs to be increased instead of having to do a more elaborate parsing +of the program text. + + +File: python.info, Node: Why does Python allow commas at the end of lists and tuples?, Prev: Why are colons required for the if/while/def/class statements?, Up: Design and History FAQ + +10.3.28 Why does Python allow commas at the end of lists and tuples? +-------------------------------------------------------------------- + +Python lets you add a trailing comma at the end of lists, tuples, and +dictionaries: + + [1, 2, 3,] + ('a', 'b', 'c',) + d = { + "A": [1, 5], + "B": [6, 7], # last trailing comma is optional but good style + } + +There are several reasons to allow this. + +When you have a literal value for a list, tuple, or dictionary spread +across multiple lines, it’s easier to add more elements because you +don’t have to remember to add a comma to the previous line. The lines +can also be reordered without creating a syntax error. + +Accidentally omitting the comma can lead to errors that are hard to +diagnose. For example: + + x = [ + "fee", + "fie" + "foo", + "fum" + ] + +This list looks like it has four elements, but it actually contains +three: “fee”, “fiefoo” and “fum”. Always adding the comma avoids this +source of error. + +Allowing the trailing comma may also make programmatic code generation +easier. + + +File: python.info, Node: Library and Extension FAQ, Next: Extending/Embedding FAQ, Prev: Design and History FAQ, Up: Python Frequently Asked Questions + +10.4 Library and Extension FAQ +============================== + +* Menu: + +* General Library Questions:: +* Common tasks:: +* Threads:: +* Input and Output: Input and Output<2>. +* Network/Internet Programming:: +* Databases:: +* Mathematics and Numerics:: + + +File: python.info, Node: General Library Questions, Next: Common tasks, Up: Library and Extension FAQ + +10.4.1 General Library Questions +-------------------------------- + +* Menu: + +* How do I find a module or application to perform task X?:: +* Where is the math.py (socket.py, regex.py, etc.) source file?: Where is the math py socket py regex py etc source file?. +* How do I make a Python script executable on Unix?:: +* Is there a curses/termcap package for Python?:: +* Is there an equivalent to C’s onexit() in Python?: Is there an equivalent to C’s onexit in Python?. +* Why don’t my signal handlers work?:: + + +File: python.info, Node: How do I find a module or application to perform task X?, Next: Where is the math py socket py regex py etc source file?, Up: General Library Questions + +10.4.1.1 How do I find a module or application to perform task X? +................................................................. + +Check *note the Library Reference: 144. to see if there’s a relevant +standard library module. (Eventually you’ll learn what’s in the +standard library and will be able to skip this step.) + +For third-party packages, search the Python Package Index(1) or try +Google(2) or another web search engine. Searching for “Python” plus a +keyword or two for your topic of interest will usually find something +helpful. + + ---------- Footnotes ---------- + + (1) https://pypi.org + + (2) https://www.google.com + + +File: python.info, Node: Where is the math py socket py regex py etc source file?, Next: How do I make a Python script executable on Unix?, Prev: How do I find a module or application to perform task X?, Up: General Library Questions + +10.4.1.2 Where is the math.py (socket.py, regex.py, etc.) source file? +...................................................................... + +If you can’t find a source file for a module it may be a built-in or +dynamically loaded module implemented in C, C++ or other compiled +language. In this case you may not have the source file or it may be +something like ‘mathmodule.c’, somewhere in a C source directory (not on +the Python Path). + +There are (at least) three kinds of modules in Python: + + 1. modules written in Python (.py); + + 2. modules written in C and dynamically loaded (.dll, .pyd, .so, .sl, + etc); + + 3. modules written in C and linked with the interpreter; to get a list + of these, type: + + import sys + print(sys.builtin_module_names) + + +File: python.info, Node: How do I make a Python script executable on Unix?, Next: Is there a curses/termcap package for Python?, Prev: Where is the math py socket py regex py etc source file?, Up: General Library Questions + +10.4.1.3 How do I make a Python script executable on Unix? +.......................................................... + +You need to do two things: the script file’s mode must be executable and +the first line must begin with ‘#!’ followed by the path of the Python +interpreter. + +The first is done by executing ‘chmod +x scriptfile’ or perhaps ‘chmod +755 scriptfile’. + +The second can be done in a number of ways. The most straightforward +way is to write + + #!/usr/local/bin/python + +as the very first line of your file, using the pathname for where the +Python interpreter is installed on your platform. + +If you would like the script to be independent of where the Python +interpreter lives, you can use the ‘env’ program. Almost all Unix +variants support the following, assuming the Python interpreter is in a +directory on the user’s ‘PATH’: + + #!/usr/bin/env python + +'Don’t' do this for CGI scripts. The ‘PATH’ variable for CGI scripts is +often very minimal, so you need to use the actual absolute pathname of +the interpreter. + +Occasionally, a user’s environment is so full that the ‘/usr/bin/env’ +program fails; or there’s no env program at all. In that case, you can +try the following hack (due to Alex Rezinsky): + + #! /bin/sh + """:" + exec python $0 ${1+"$@"} + """ + +The minor disadvantage is that this defines the script’s __doc__ string. +However, you can fix that by adding + + __doc__ = """...Whatever...""" + + +File: python.info, Node: Is there a curses/termcap package for Python?, Next: Is there an equivalent to C’s onexit in Python?, Prev: How do I make a Python script executable on Unix?, Up: General Library Questions + +10.4.1.4 Is there a curses/termcap package for Python? +...................................................... + +For Unix variants: The standard Python source distribution comes with a +curses module in the Modules(1) subdirectory, though it’s not compiled +by default. (Note that this is not available in the Windows +distribution – there is no curses module for Windows.) + +The *note curses: 2b. module supports basic curses features as well as +many additional functions from ncurses and SYSV curses such as colour, +alternative character set support, pads, and mouse support. This means +the module isn’t compatible with operating systems that only have BSD +curses, but there don’t seem to be any currently maintained OSes that +fall into this category. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Modules + + +File: python.info, Node: Is there an equivalent to C’s onexit in Python?, Next: Why don’t my signal handlers work?, Prev: Is there a curses/termcap package for Python?, Up: General Library Questions + +10.4.1.5 Is there an equivalent to C’s onexit() in Python? +.......................................................... + +The *note atexit: c. module provides a register function that is similar +to C’s ‘onexit()’. + + +File: python.info, Node: Why don’t my signal handlers work?, Prev: Is there an equivalent to C’s onexit in Python?, Up: General Library Questions + +10.4.1.6 Why don’t my signal handlers work? +........................................... + +The most common problem is that the signal handler is declared with the +wrong argument list. It is called as + + handler(signum, frame) + +so it should be declared with two parameters: + + def handler(signum, frame): + ... + + +File: python.info, Node: Common tasks, Next: Threads, Prev: General Library Questions, Up: Library and Extension FAQ + +10.4.2 Common tasks +------------------- + +* Menu: + +* How do I test a Python program or component?:: +* How do I create documentation from doc strings?:: +* How do I get a single keypress at a time?:: + + +File: python.info, Node: How do I test a Python program or component?, Next: How do I create documentation from doc strings?, Up: Common tasks + +10.4.2.1 How do I test a Python program or component? +..................................................... + +Python comes with two testing frameworks. The *note doctest: 3a. module +finds examples in the docstrings for a module and runs them, comparing +the output with the expected output given in the docstring. + +The *note unittest: 106. module is a fancier testing framework modelled +on Java and Smalltalk testing frameworks. + +To make testing easier, you should use good modular design in your +program. Your program should have almost all functionality encapsulated +in either functions or class methods – and this sometimes has the +surprising and delightful effect of making the program run faster +(because local variable accesses are faster than global accesses). +Furthermore the program should avoid depending on mutating global +variables, since this makes testing much more difficult to do. + +The “global main logic” of your program may be as simple as + + if __name__ == "__main__": + main_logic() + +at the bottom of the main module of your program. + +Once your program is organized as a tractable collection of function and +class behaviours, you should write test functions that exercise the +behaviours. A test suite that automates a sequence of tests can be +associated with each module. This sounds like a lot of work, but since +Python is so terse and flexible it’s surprisingly easy. You can make +coding much more pleasant and fun by writing your test functions in +parallel with the “production code”, since this makes it easy to find +bugs and even design flaws earlier. + +“Support modules” that are not intended to be the main module of a +program may include a self-test of the module. + + if __name__ == "__main__": + self_test() + +Even programs that interact with complex external interfaces may be +tested when the external interfaces are unavailable by using “fake” +interfaces implemented in Python. + + +File: python.info, Node: How do I create documentation from doc strings?, Next: How do I get a single keypress at a time?, Prev: How do I test a Python program or component?, Up: Common tasks + +10.4.2.2 How do I create documentation from doc strings? +........................................................ + +The *note pydoc: b5. module can create HTML from the doc strings in your +Python source code. An alternative for creating API documentation +purely from docstrings is epydoc(1). Sphinx(2) can also include +docstring content. + + ---------- Footnotes ---------- + + (1) https://epydoc.sourceforge.net/ + + (2) https://www.sphinx-doc.org + + +File: python.info, Node: How do I get a single keypress at a time?, Prev: How do I create documentation from doc strings?, Up: Common tasks + +10.4.2.3 How do I get a single keypress at a time? +.................................................. + +For Unix variants there are several solutions. It’s straightforward to +do this using curses, but curses is a fairly large module to learn. + + +File: python.info, Node: Threads, Next: Input and Output<2>, Prev: Common tasks, Up: Library and Extension FAQ + +10.4.3 Threads +-------------- + +* Menu: + +* How do I program using threads?:: +* None of my threads seem to run; why?: None of my threads seem to run why?. +* How do I parcel out work among a bunch of worker threads?:: +* What kinds of global value mutation are thread-safe?:: +* Can’t we get rid of the Global Interpreter Lock?:: + + +File: python.info, Node: How do I program using threads?, Next: None of my threads seem to run why?, Up: Threads + +10.4.3.1 How do I program using threads? +........................................ + +Be sure to use the *note threading: ed. module and not the *note +_thread: 2. module. The *note threading: ed. module builds convenient +abstractions on top of the low-level primitives provided by the *note +_thread: 2. module. + + +File: python.info, Node: None of my threads seem to run why?, Next: How do I parcel out work among a bunch of worker threads?, Prev: How do I program using threads?, Up: Threads + +10.4.3.2 None of my threads seem to run: why? +............................................. + +As soon as the main thread exits, all threads are killed. Your main +thread is running too quickly, giving the threads no time to do any +work. + +A simple fix is to add a sleep to the end of the program that’s long +enough for all the threads to finish: + + 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) # <---------------------------! + +But now (on many platforms) the threads don’t run in parallel, but +appear to run sequentially, one at a time! The reason is that the OS +thread scheduler doesn’t start a new thread until the previous thread is +blocked. + +A simple fix is to add a tiny sleep to the start of the run function: + + 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) + +Instead of trying to guess a good delay value for *note time.sleep(): +699, it’s better to use some kind of semaphore mechanism. One idea is +to use the *note queue: b6. module to create a queue object, let each +thread append a token to the queue when it finishes, and let the main +thread read as many tokens from the queue as there are threads. + + +File: python.info, Node: How do I parcel out work among a bunch of worker threads?, Next: What kinds of global value mutation are thread-safe?, Prev: None of my threads seem to run why?, Up: Threads + +10.4.3.3 How do I parcel out work among a bunch of worker threads? +.................................................................. + +The easiest way is to use the *note concurrent.futures: 21. module, +especially the *note ThreadPoolExecutor: 73d. class. + +Or, if you want fine control over the dispatching algorithm, you can +write your own logic manually. Use the *note queue: b6. module to +create a queue containing a list of jobs. The *note Queue: 137a. class +maintains a list of objects and has a ‘.put(obj)’ method that adds items +to the queue and a ‘.get()’ method to return them. The class will take +care of the locking necessary to ensure that each job is handed out +exactly once. + +Here’s a trivial example: + + import threading, queue, time + + # The worker thread gets jobs off the queue. When the queue is empty, it + # assumes there will be no more work and exits. + # (Realistically workers will run until terminated.) + def worker(): + print('Running worker') + time.sleep(0.1) + while True: + try: + arg = q.get(block=False) + except queue.Empty: + print('Worker', threading.current_thread(), end=' ') + print('queue empty') + break + else: + print('Worker', threading.current_thread(), end=' ') + print('running with argument', arg) + time.sleep(0.5) + + # Create queue + q = queue.Queue() + + # Start a pool of 5 workers + for i in range(5): + t = threading.Thread(target=worker, name='worker %i' % (i+1)) + t.start() + + # Begin adding work to the queue + for i in range(50): + q.put(i) + + # Give threads time to run + print('Main thread sleeping') + time.sleep(5) + +When run, this will produce the following output: + + Running worker + Running worker + Running worker + Running worker + Running worker + Main thread sleeping + Worker running with argument 0 + Worker running with argument 1 + Worker running with argument 2 + Worker running with argument 3 + Worker running with argument 4 + Worker running with argument 5 + ... + +Consult the module’s documentation for more details; the *note Queue: +137a. class provides a featureful interface. + + +File: python.info, Node: What kinds of global value mutation are thread-safe?, Next: Can’t we get rid of the Global Interpreter Lock?, Prev: How do I parcel out work among a bunch of worker threads?, Up: Threads + +10.4.3.4 What kinds of global value mutation are thread-safe? +............................................................. + +A *note global interpreter lock: 148. (GIL) is used internally to ensure +that only one thread runs in the Python VM at a time. In general, +Python offers to switch among threads only between bytecode +instructions; how frequently it switches can be set via *note +sys.setswitchinterval(): 94a. Each bytecode instruction and therefore +all the C implementation code reached from each instruction is therefore +atomic from the point of view of a Python program. + +In theory, this means an exact accounting requires an exact +understanding of the PVM bytecode implementation. In practice, it means +that operations on shared variables of built-in data types (ints, lists, +dicts, etc) that “look atomic” really are. + +For example, the following operations are all atomic (L, L1, L2 are +lists, D, D1, D2 are dicts, x, y are objects, i, j are ints): + + 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() + +These aren’t: + + i = i+1 + L.append(L[-1]) + L[i] = L[j] + D[x] = D[x] + 1 + +Operations that replace other objects may invoke those other objects’ +*note __del__(): 1f61. method when their reference count reaches zero, +and that can affect things. This is especially true for the mass +updates to dictionaries and lists. When in doubt, use a mutex! + + +File: python.info, Node: Can’t we get rid of the Global Interpreter Lock?, Prev: What kinds of global value mutation are thread-safe?, Up: Threads + +10.4.3.5 Can’t we get rid of the Global Interpreter Lock? +......................................................... + +The *note global interpreter lock: 148. (GIL) is often seen as a +hindrance to Python’s deployment on high-end multiprocessor server +machines, because a multi-threaded Python program effectively only uses +one CPU, due to the insistence that (almost) all Python code can only +run while the GIL is held. + +With the approval of PEP 703(1) work is now underway to remove the GIL +from the CPython implementation of Python. Initially it will be +implemented as an optional compiler flag when building the interpreter, +and so separate builds will be available with and without the GIL. +Long-term, the hope is to settle on a single build, once the performance +implications of removing the GIL are fully understood. Python 3.13 is +likely to be the first release containing this work, although it may not +be completely functional in this release. + +The current work to remove the GIL is based on a fork of Python 3.9 with +the GIL removed(2) by Sam Gross. Prior to that, in the days of Python +1.5, Greg Stein actually implemented a comprehensive patch set (the +“free threading” patches) that removed the GIL and replaced it with +fine-grained locking. Adam Olsen did a similar experiment in his +python-safethread(3) project. Unfortunately, both of these earlier +experiments exhibited a sharp drop in single-thread performance (at +least 30% slower), due to the amount of fine-grained locking necessary +to compensate for the removal of the GIL. The Python 3.9 fork is the +first attempt at removing the GIL with an acceptable performance impact. + +The presence of the GIL in current Python releases doesn’t mean that you +can’t make good use of Python on multi-CPU machines! You just have to +be creative with dividing the work up between multiple 'processes' +rather than multiple 'threads'. The *note ProcessPoolExecutor: 8ed. +class in the new *note concurrent.futures: 21. module provides an easy +way of doing so; the *note multiprocessing: 94. module provides a +lower-level API in case you want more control over dispatching of tasks. + +Judicious use of C extensions will also help; if you use a C extension +to perform a time-consuming task, the extension can release the GIL +while the thread of execution is in the C code and allow other threads +to get some work done. Some standard library modules such as *note +zlib: 133. and *note hashlib: 68. already do this. + +An alternative approach to reducing the impact of the GIL is to make the +GIL a per-interpreter-state lock rather than truly global. This was +*note first implemented in Python 3.12: 437. and is available in the C +API. A Python interface to it is expected in Python 3.13. The main +limitation to it at the moment is likely to be 3rd party extension +modules, since these must be written with multiple interpreters in mind +in order to be usable, so many older extension modules will not be +usable. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0703/ + + (2) https://github.com/colesbury/nogil + + (3) https://code.google.com/archive/p/python-safethread + + +File: python.info, Node: Input and Output<2>, Next: Network/Internet Programming, Prev: Threads, Up: Library and Extension FAQ + +10.4.4 Input and Output +----------------------- + +* Menu: + +* How do I delete a file? (And other file questions…): How do I delete a file? And other file questions…. +* How do I copy a file?:: +* How do I read (or write) binary data?: How do I read or write binary data?. +* I can’t seem to use os.read() on a pipe created with os.popen(); why?: I can’t seem to use os read on a pipe created with os popen ; why?. +* How do I access the serial (RS232) port?: How do I access the serial RS232 port?. +* Why doesn’t closing sys.stdout (stdin, stderr) really close it?: Why doesn’t closing sys stdout stdin stderr really close it?. + + +File: python.info, Node: How do I delete a file? And other file questions…, Next: How do I copy a file?, Up: Input and Output<2> + +10.4.4.1 How do I delete a file? (And other file questions…) +............................................................ + +Use ‘os.remove(filename)’ or ‘os.unlink(filename)’; for documentation, +see the *note os: a1. module. The two functions are identical; *note +unlink(): 10ea. is simply the name of the Unix system call for this +function. + +To remove a directory, use *note os.rmdir(): 10e8.; use *note +os.mkdir(): 21f. to create one. ‘os.makedirs(path)’ will create any +intermediate directories in ‘path’ that don’t exist. +‘os.removedirs(path)’ will remove intermediate directories as long as +they’re empty; if you want to delete an entire directory tree and its +contents, use *note shutil.rmtree(): 2fb. + +To rename a file, use ‘os.rename(old_path, new_path)’. + +To truncate a file, open it using ‘f = open(filename, "rb+")’, and use +‘f.truncate(offset)’; offset defaults to the current seek position. +There’s also ‘os.ftruncate(fd, offset)’ for files opened with *note +os.open(): d91, where 'fd' is the file descriptor (a small integer). + +The *note shutil: c5. module also contains a number of functions to work +on files including *note copyfile(): a58, *note copytree(): a28, and +*note rmtree(): 2fb. + + +File: python.info, Node: How do I copy a file?, Next: How do I read or write binary data?, Prev: How do I delete a file? And other file questions…, Up: Input and Output<2> + +10.4.4.2 How do I copy a file? +.............................. + +The *note shutil: c5. module contains a *note copyfile(): a58. function. +Note that on Windows NTFS volumes, it does not copy alternate data +streams(1) nor resource forks(2) on macOS HFS+ volumes, though both are +now rarely used. It also doesn’t copy file permissions and metadata, +though using *note shutil.copy2(): a5a. instead will preserve most +(though not all) of it. + + ---------- Footnotes ---------- + + (1) https://en.wikipedia.org/wiki/NTFS#Alternate_data_stream_(ADS) + + (2) https://en.wikipedia.org/wiki/Resource_fork + + +File: python.info, Node: How do I read or write binary data?, Next: I can’t seem to use os read on a pipe created with os popen ; why?, Prev: How do I copy a file?, Up: Input and Output<2> + +10.4.4.3 How do I read (or write) binary data? +.............................................. + +To read or write complex binary data formats, it’s best to use the *note +struct: d5. module. It allows you to take a string containing binary +data (usually numbers) and convert it to Python objects; and vice versa. + +For example, the following code reads two 2-byte integers and one 4-byte +integer in big-endian format from a file: + + import struct + + with open(filename, "rb") as f: + s = f.read(8) + x, y, z = struct.unpack(">hhl", s) + +The ‘>’ in the format string forces big-endian data; the letter ‘h’ +reads one “short integer” (2 bytes), and ‘l’ reads one “long integer” (4 +bytes) from the string. + +For data that is more regular (e.g. a homogeneous list of ints or +floats), you can also use the *note array: 7. module. + + Note: To read and write binary data, it is mandatory to open the + file in binary mode (here, passing ‘"rb"’ to *note open(): 517.). + If you use ‘"r"’ instead (the default), the file will be open in + text mode and ‘f.read()’ will return *note str: 447. objects rather + than *note bytes: 1c2. objects. + + +File: python.info, Node: I can’t seem to use os read on a pipe created with os popen ; why?, Next: How do I access the serial RS232 port?, Prev: How do I read or write binary data?, Up: Input and Output<2> + +10.4.4.4 I can’t seem to use os.read() on a pipe created with os.popen(); why? +.............................................................................. + +*note os.read(): d94. is a low-level function which takes a file +descriptor, a small integer representing the opened file. *note +os.popen(): a87. creates a high-level file object, the same type +returned by the built-in *note open(): 517. function. Thus, to read 'n' +bytes from a pipe 'p' created with *note os.popen(): a87, you need to +use ‘p.read(n)’. + + +File: python.info, Node: How do I access the serial RS232 port?, Next: Why doesn’t closing sys stdout stdin stderr really close it?, Prev: I can’t seem to use os read on a pipe created with os popen ; why?, Up: Input and Output<2> + +10.4.4.5 How do I access the serial (RS232) port? +................................................. + +For Win32, OSX, Linux, BSD, Jython, IronPython: + + pyserial(1) + +For Unix, see a Usenet post by Mitch Chapman: + + ‘https://groups.google.com/groups?selm=34A04430.CF9@ohioee.com’ + + ---------- Footnotes ---------- + + (1) https://pypi.org/project/pyserial/ + + +File: python.info, Node: Why doesn’t closing sys stdout stdin stderr really close it?, Prev: How do I access the serial RS232 port?, Up: Input and Output<2> + +10.4.4.6 Why doesn’t closing sys.stdout (stdin, stderr) really close it? +........................................................................ + +Python *note file objects: 11b5. are a high-level layer of abstraction +on low-level C file descriptors. + +For most file objects you create in Python via the built-in *note +open(): 517. function, ‘f.close()’ marks the Python file object as being +closed from Python’s point of view, and also arranges to close the +underlying C file descriptor. This also happens automatically in ‘f’’s +destructor, when ‘f’ becomes garbage. + +But stdin, stdout and stderr are treated specially by Python, because of +the special status also given to them by C. Running ‘sys.stdout.close()’ +marks the Python-level file object as being closed, but does 'not' close +the associated C file descriptor. + +To close the underlying C file descriptor for one of these three, you +should first be sure that’s what you really want to do (e.g., you may +confuse extension modules trying to do I/O). If it is, use *note +os.close(): b74.: + + os.close(stdin.fileno()) + os.close(stdout.fileno()) + os.close(stderr.fileno()) + +Or you can use the numeric constants 0, 1 and 2, respectively. + + +File: python.info, Node: Network/Internet Programming, Next: Databases, Prev: Input and Output<2>, Up: Library and Extension FAQ + +10.4.5 Network/Internet Programming +----------------------------------- + +* Menu: + +* What WWW tools are there for Python?:: +* What module should I use to help with generating HTML?:: +* How do I send mail from a Python script?:: +* How do I avoid blocking in the connect() method of a socket?: How do I avoid blocking in the connect method of a socket?. + + +File: python.info, Node: What WWW tools are there for Python?, Next: What module should I use to help with generating HTML?, Up: Network/Internet Programming + +10.4.5.1 What WWW tools are there for Python? +............................................. + +See the chapters titled *note Internet Protocols and Support: 3946. and +*note Internet Data Handling: 3553. in the Library Reference Manual. +Python has many modules that will help you build server-side and +client-side web systems. + +A summary of available frameworks is maintained by Paul Boddie at +‘https://wiki.python.org/moin/WebProgramming’. + + +File: python.info, Node: What module should I use to help with generating HTML?, Next: How do I send mail from a Python script?, Prev: What WWW tools are there for Python?, Up: Network/Internet Programming + +10.4.5.2 What module should I use to help with generating HTML? +............................................................... + +You can find a collection of useful links on the Web Programming wiki +page(1). + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/WebProgramming + + +File: python.info, Node: How do I send mail from a Python script?, Next: How do I avoid blocking in the connect method of a socket?, Prev: What module should I use to help with generating HTML?, Up: Network/Internet Programming + +10.4.5.3 How do I send mail from a Python script? +................................................. + +Use the standard library module *note smtplib: ca. + +Here’s a very simple interactive mail sender that uses it. This method +will work on any host that supports an SMTP listener. + + 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() + +A Unix-only alternative uses sendmail. The location of the sendmail +program varies between systems; sometimes it is ‘/usr/lib/sendmail’, +sometimes ‘/usr/sbin/sendmail’. The sendmail manual page will help you +out. Here’s some sample code: + + import os + + SENDMAIL = "/usr/sbin/sendmail" # sendmail location + p = os.popen("%s -t -i" % SENDMAIL, "w") + p.write("To: receiver@example.com\n") + p.write("Subject: test\n") + p.write("\n") # blank line separating headers from body + p.write("Some text\n") + p.write("some more text\n") + sts = p.close() + if sts != 0: + print("Sendmail exit status", sts) + + +File: python.info, Node: How do I avoid blocking in the connect method of a socket?, Prev: How do I send mail from a Python script?, Up: Network/Internet Programming + +10.4.5.4 How do I avoid blocking in the connect() method of a socket? +..................................................................... + +The *note select: c1. module is commonly used to help with asynchronous +I/O on sockets. + +To prevent the TCP connect from blocking, you can set the socket to +non-blocking mode. Then when you do the *note connect(): da2, you will +either connect immediately (unlikely) or get an exception that contains +the error number as ‘.errno’. ‘errno.EINPROGRESS’ indicates that the +connection is in progress, but hasn’t finished yet. Different OSes will +return different values, so you’re going to have to check what’s +returned on your system. + +You can use the *note connect_ex(): 1503. method to avoid creating an +exception. It will just return the errno value. To poll, you can call +*note connect_ex(): 1503. again later – ‘0’ or ‘errno.EISCONN’ indicate +that you’re connected – or you can pass this socket to *note +select.select(): d9f. to check if it’s writable. + + Note: The *note asyncio: a. module provides a general purpose + single-threaded and concurrent asynchronous library, which can be + used for writing non-blocking network code. The third-party + Twisted(1) library is a popular and feature-rich alternative. + + ---------- Footnotes ---------- + + (1) https://twisted.org/ + + +File: python.info, Node: Databases, Next: Mathematics and Numerics, Prev: Network/Internet Programming, Up: Library and Extension FAQ + +10.4.6 Databases +---------------- + +* Menu: + +* Are there any interfaces to database packages in Python?:: +* How do you implement persistent objects in Python?:: + + +File: python.info, Node: Are there any interfaces to database packages in Python?, Next: How do you implement persistent objects in Python?, Up: Databases + +10.4.6.1 Are there any interfaces to database packages in Python? +................................................................. + +Yes. + +Interfaces to disk-based hashes such as *note DBM: 34. and *note GDBM: +33. are also included with standard Python. There is also the *note +sqlite3: cf. module, which provides a lightweight disk-based relational +database. + +Support for most relational databases is available. See the +DatabaseProgramming wiki page(1) for details. + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/DatabaseProgramming + + +File: python.info, Node: How do you implement persistent objects in Python?, Prev: Are there any interfaces to database packages in Python?, Up: Databases + +10.4.6.2 How do you implement persistent objects in Python? +........................................................... + +The *note pickle: a6. library module solves this in a very general way +(though you still can’t store things like open files, sockets or +windows), and the *note shelve: c3. library module uses pickle and +(g)dbm to create persistent mappings containing arbitrary Python +objects. + + +File: python.info, Node: Mathematics and Numerics, Prev: Databases, Up: Library and Extension FAQ + +10.4.7 Mathematics and Numerics +------------------------------- + +* Menu: + +* How do I generate random numbers in Python?:: + + +File: python.info, Node: How do I generate random numbers in Python?, Up: Mathematics and Numerics + +10.4.7.1 How do I generate random numbers in Python? +.................................................... + +The standard module *note random: b8. implements a random number +generator. Usage is simple: + + import random + random.random() + +This returns a random floating-point number in the range [0, 1). + +There are also many other specialized generators in this module, such +as: + + * ‘randrange(a, b)’ chooses an integer in the range [a, b). + + * ‘uniform(a, b)’ chooses a floating-point number in the range [a, + b). + + * ‘normalvariate(mean, sdev)’ samples the normal (Gaussian) + distribution. + +Some higher-level functions operate on sequences directly, such as: + + * ‘choice(S)’ chooses a random element from a given sequence. + + * ‘shuffle(L)’ shuffles a list in-place, i.e. permutes it randomly. + +There’s also a ‘Random’ class you can instantiate to create independent +multiple random number generators. + + +File: python.info, Node: Extending/Embedding FAQ, Next: Python on Windows FAQ, Prev: Library and Extension FAQ, Up: Python Frequently Asked Questions + +10.5 Extending/Embedding FAQ +============================ + +* Menu: + +* Can I create my own functions in C?:: +* Can I create my own functions in C++?:: +* Writing C is hard; are there any alternatives?:: +* How can I execute arbitrary Python statements from C?:: +* How can I evaluate an arbitrary Python expression from C?:: +* How do I extract C values from a Python object?:: +* How do I use Py_BuildValue() to create a tuple of arbitrary length?: How do I use Py_BuildValue to create a tuple of arbitrary length?. +* How do I call an object’s method from C?:: +* How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)?: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?. +* How do I access a module written in Python from C?:: +* How do I interface to C++ objects from Python?:: +* I added a module using the Setup file and the make fails; why?:: +* How do I debug an extension?:: +* I want to compile a Python module on my Linux system, but some files are missing. Why?: I want to compile a Python module on my Linux system but some files are missing Why?. +* How do I tell “incomplete input” from “invalid input”?:: +* How do I find undefined g++ symbols __builtin_new or __pure_virtual?:: +* Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)?: Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?. + + +File: python.info, Node: Can I create my own functions in C?, Next: Can I create my own functions in C++?, Up: Extending/Embedding FAQ + +10.5.1 Can I create my own functions in C? +------------------------------------------ + +Yes, you can create built-in modules containing functions, variables, +exceptions and even new types in C. This is explained in the document +*note Extending and Embedding the Python Interpreter: 1bda. + +Most intermediate or advanced Python books will also cover this topic. + + +File: python.info, Node: Can I create my own functions in C++?, Next: Writing C is hard; are there any alternatives?, Prev: Can I create my own functions in C?, Up: Extending/Embedding FAQ + +10.5.2 Can I create my own functions in C++? +-------------------------------------------- + +Yes, using the C compatibility features found in C++. Place ‘extern "C" +{ ... }’ around the Python include files and put ‘extern "C"’ before +each function that is going to be called by the Python interpreter. +Global or static C++ objects with constructors are probably not a good +idea. + + +File: python.info, Node: Writing C is hard; are there any alternatives?, Next: How can I execute arbitrary Python statements from C?, Prev: Can I create my own functions in C++?, Up: Extending/Embedding FAQ + +10.5.3 Writing C is hard; are there any alternatives? +----------------------------------------------------- + +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: 48a8. offer both simpler and more sophisticated approaches to +creating C and C++ extensions for Python. + + +File: python.info, Node: How can I execute arbitrary Python statements from C?, Next: How can I evaluate an arbitrary Python expression from C?, Prev: Writing C is hard; are there any alternatives?, Up: Extending/Embedding FAQ + +10.5.4 How can I execute arbitrary Python statements from C? +------------------------------------------------------------ + +The highest-level function to do this is *note PyRun_SimpleString(): +4923. which takes a single string argument to be executed in the context +of the module ‘__main__’ and returns ‘0’ for success and ‘-1’ when an +exception occurred (including *note SyntaxError: 18d.). If you want +more control, use *note PyRun_String(): 19da.; see the source for *note +PyRun_SimpleString(): 4923. in ‘Python/pythonrun.c’. + + +File: python.info, Node: How can I evaluate an arbitrary Python expression from C?, Next: How do I extract C values from a Python object?, Prev: How can I execute arbitrary Python statements from C?, Up: Extending/Embedding FAQ + +10.5.5 How can I evaluate an arbitrary Python expression from C? +---------------------------------------------------------------- + +Call the function *note PyRun_String(): 19da. from the previous question +with the start symbol *note Py_eval_input: 4b0d.; it parses an +expression, evaluates it and returns its value. + + +File: python.info, Node: How do I extract C values from a Python object?, Next: How do I use Py_BuildValue to create a tuple of arbitrary length?, Prev: How can I evaluate an arbitrary Python expression from C?, Up: Extending/Embedding FAQ + +10.5.6 How do I extract C values from a Python object? +------------------------------------------------------ + +That depends on the object’s type. If it’s a tuple, *note +PyTuple_Size(): 4a97. returns its length and *note PyTuple_GetItem(): +48d2. returns the item at a specified index. Lists have similar +functions, *note PyList_Size(): 13e5. and *note PyList_GetItem(): 357. + +For bytes, *note PyBytes_Size(): 4972. returns its length and *note +PyBytes_AsStringAndSize(): 496c. provides a pointer to its value and its +length. Note that Python bytes objects may contain null bytes so C’s +‘strlen()’ should not be used. + +To test the type of an object, first make sure it isn’t ‘NULL’, and then +use *note PyBytes_Check(): 1380, *note PyTuple_Check(): 4c86, *note +PyList_Check(): 4c96, etc. + +There is also a high-level API to Python objects which is provided by +the so-called ‘abstract’ interface – read ‘Include/abstract.h’ for +further details. It allows interfacing with any kind of Python sequence +using calls like *note PySequence_Length(): 4a78, *note +PySequence_GetItem(): 1a52, etc. as well as many other useful protocols +such as numbers (*note PyNumber_Index(): 891. et al.) and mappings in +the PyMapping APIs. + + +File: python.info, Node: How do I use Py_BuildValue to create a tuple of arbitrary length?, Next: How do I call an object’s method from C?, Prev: How do I extract C values from a Python object?, Up: Extending/Embedding FAQ + +10.5.7 How do I use Py_BuildValue() to create a tuple of arbitrary length? +-------------------------------------------------------------------------- + +You can’t. Use *note PyTuple_Pack(): 4a96. instead. + + +File: python.info, Node: How do I call an object’s method from C?, Next: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?, Prev: How do I use Py_BuildValue to create a tuple of arbitrary length?, Up: Extending/Embedding FAQ + +10.5.8 How do I call an object’s method from C? +----------------------------------------------- + +The *note PyObject_CallMethod(): 39b. function can be used to call an +arbitrary method of an object. The parameters are the object, the name +of the method to call, a format string like that used with *note +Py_BuildValue(): 8a6, and the argument values: + + PyObject * + PyObject_CallMethod(PyObject *object, const char *method_name, + const char *arg_format, ...); + +This works for any object that has methods – whether built-in or +user-defined. You are responsible for eventually *note Py_DECREF(): +56c.‘ing the return value. + +To call, e.g., a file object’s “seek” method with arguments 10, 0 +(assuming the file object pointer is “f”): + + res = PyObject_CallMethod(f, "seek", "(ii)", 10, 0); + if (res == NULL) { + ... an exception occurred ... + } + else { + Py_DECREF(res); + } + +Note that since *note PyObject_CallObject(): 48c7. 'always' wants a +tuple for the argument list, to call a function without arguments, pass +“()” for the format, and to call a function with one argument, surround +the argument in parentheses, e.g. “(i)”. + + +File: python.info, Node: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?, Next: How do I access a module written in Python from C?, Prev: How do I call an object’s method from C?, Up: Extending/Embedding FAQ + +10.5.9 How do I catch the output from PyErr_Print() (or anything that prints to stdout/stderr)? +----------------------------------------------------------------------------------------------- + +In Python code, define an object that supports the ‘write()’ method. +Assign this object to *note sys.stdout: ad6. and *note sys.stderr: 939. +Call print_error, or just allow the standard traceback mechanism to +work. Then, the output will go wherever your ‘write()’ method sends it. + +The easiest way to do this is to use the *note io.StringIO: f22. class: + + >>> import io, sys + >>> sys.stdout = io.StringIO() + >>> print('foo') + >>> print('hello world!') + >>> sys.stderr.write(sys.stdout.getvalue()) + foo + hello world! + +A custom object to do the same would look like this: + + >>> 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: How do I access a module written in Python from C?, Next: How do I interface to C++ objects from Python?, Prev: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?, Up: Extending/Embedding FAQ + +10.5.10 How do I access a module written in Python from C? +---------------------------------------------------------- + +You can get a pointer to the module object as follows: + + module = PyImport_ImportModule(""); + +If the module hasn’t been imported yet (i.e. it is not yet present in +*note sys.modules: 1550.), this initializes the module; otherwise it +simply returns the value of ‘sys.modules[""]’. Note that it +doesn’t enter the module into any namespace – it only ensures it has +been initialized and is stored in *note sys.modules: 1550. + +You can then access the module’s attributes (i.e. any name defined in +the module) as follows: + + attr = PyObject_GetAttrString(module, ""); + +Calling *note PyObject_SetAttrString(): 1602. to assign to variables in +the module also works. + + +File: python.info, Node: How do I interface to C++ objects from Python?, Next: I added a module using the Setup file and the make fails; why?, Prev: How do I access a module written in Python from C?, Up: Extending/Embedding FAQ + +10.5.11 How do I interface to C++ objects from Python? +------------------------------------------------------ + +Depending on your requirements, there are many approaches. To do this +manually, begin by reading *note the “Extending and Embedding” document: +1bda. Realize that for the Python run-time system, there isn’t a whole +lot of difference between C and C++ – so the strategy of building a new +Python type around a C structure (pointer) type will also work for C++ +objects. + +For C++ libraries, see *note Writing C is hard; are there any +alternatives?: 516a. + + +File: python.info, Node: I added a module using the Setup file and the make fails; why?, Next: How do I debug an extension?, Prev: How do I interface to C++ objects from Python?, Up: Extending/Embedding FAQ + +10.5.12 I added a module using the Setup file and the make fails; why? +---------------------------------------------------------------------- + +Setup must end in a newline, if there is no newline there, the build +process fails. (Fixing this requires some ugly shell script hackery, +and this bug is so minor that it doesn’t seem worth the effort.) + + +File: python.info, Node: How do I debug an extension?, Next: I want to compile a Python module on my Linux system but some files are missing Why?, Prev: I added a module using the Setup file and the make fails; why?, Up: Extending/Embedding FAQ + +10.5.13 How do I debug an extension? +------------------------------------ + +When using GDB with dynamically loaded extensions, you can’t set a +breakpoint in your extension until your extension is loaded. + +In your ‘.gdbinit’ file (or interactively), add the command: + + br _PyImport_LoadDynamicModule + +Then, when you run 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: I want to compile a Python module on my Linux system but some files are missing Why?, Next: How do I tell “incomplete input” from “invalid input”?, Prev: How do I debug an extension?, Up: Extending/Embedding FAQ + +10.5.14 I want to compile a Python module on my Linux system, but some files are missing. Why? +---------------------------------------------------------------------------------------------- + +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: How do I tell “incomplete input” from “invalid input”?, Next: How do I find undefined g++ symbols __builtin_new or __pure_virtual?, Prev: I want to compile a Python module on my Linux system but some files are missing Why?, Up: Extending/Embedding FAQ + +10.5.15 How do I tell “incomplete input” from “invalid input”? +-------------------------------------------------------------- + +Sometimes you want to emulate the Python interactive interpreter’s +behavior, where it gives you a continuation prompt when the input is +incomplete (e.g. you typed the start of an “if” statement or you didn’t +close your parentheses or triple string quotes), but it gives you a +syntax error message immediately when the input is invalid. + +In Python you can use the *note codeop: 1c. module, which approximates +the parser’s behavior sufficiently. IDLE uses this, for example. + +The easiest way to do it in C is to call *note PyRun_InteractiveLoop(): +4b14. (perhaps in a separate thread) and let the Python interpreter +handle the input for you. You can also set the *note +PyOS_ReadlineFunctionPointer(): 583. to point at your custom input +function. See ‘Modules/readline.c’ and ‘Parser/myreadline.c’ for more +hints. + + +File: python.info, Node: How do I find undefined g++ symbols __builtin_new or __pure_virtual?, Next: Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?, Prev: How do I tell “incomplete input” from “invalid input”?, Up: Extending/Embedding FAQ + +10.5.16 How do I find undefined g++ symbols __builtin_new or __pure_virtual? +---------------------------------------------------------------------------- + +To dynamically load g++ extension modules, you must recompile Python, +relink it using g++ (change LINKCC in the Python Modules Makefile), and +link your extension module using g++ (e.g., ‘g++ -shared -o mymodule.so +mymodule.o’). + + +File: python.info, Node: Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?, Prev: How do I find undefined g++ symbols __builtin_new or __pure_virtual?, Up: Extending/Embedding FAQ + +10.5.17 Can I create an object class with some methods implemented in C and others in Python (e.g. through inheritance)? +------------------------------------------------------------------------------------------------------------------------ + +Yes, you can inherit from built-in classes such as *note int: 259, *note +list: 60d, *note dict: 258, etc. + +The Boost Python Library (BPL, +‘https://www.boost.org/libs/python/doc/index.html’) provides a way of +doing this from C++ (i.e. you can inherit from an extension class +written in C++ using the BPL). + + +File: python.info, Node: Python on Windows FAQ, Next: Graphic User Interface FAQ, Prev: Extending/Embedding FAQ, Up: Python Frequently Asked Questions + +10.6 Python on Windows FAQ +========================== + +* Menu: + +* How do I run a Python program under Windows?:: +* How do I make Python scripts executable?:: +* Why does Python sometimes take so long to start?:: +* How do I make an executable from a Python script?:: +* Is a *.pyd file the same as a DLL?: Is a * pyd file the same as a DLL?. +* How can I embed Python into a Windows application?:: +* How do I keep editors from inserting tabs into my Python source?:: +* How do I check for a keypress without blocking?:: +* How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error?: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?. + + +File: python.info, Node: How do I run a Python program under Windows?, Next: How do I make Python scripts executable?, Up: Python on Windows FAQ + +10.6.1 How do I run a Python program under Windows? +--------------------------------------------------- + +This is not necessarily a straightforward question. If you are already +familiar with running programs from the Windows command line then +everything will seem obvious; otherwise, you might need a little more +guidance. + +Unless you use some sort of integrated development environment, you will +end up 'typing' Windows commands into what is referred to as a “Command +prompt window”. Usually you can create such a window from your search +bar by searching for ‘cmd’. You should be able to recognize when you +have started such a window because you will see a Windows “command +prompt”, which usually looks like this: + + C:\> + +The letter may be different, and there might be other things after it, +so you might just as easily see something like: + + D:\YourName\Projects\Python> + +depending on how your computer has been set up and what else you have +recently done with it. Once you have started such a window, you are +well on the way to running Python programs. + +You need to realize that your Python scripts have to be processed by +another program called the Python 'interpreter'. The interpreter reads +your script, compiles it into bytecodes, and then executes the bytecodes +to run your program. So, how do you arrange for the interpreter to +handle your Python? + +First, you need to make sure that your command window recognises the +word “py” as an instruction to start the interpreter. If you have +opened a command window, you should try entering the command ‘py’ and +hitting return: + + C:\Users\YourName> py + +You should then see something like: + + 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. + >>> + +You have started the interpreter in “interactive mode”. That means you +can enter Python statements or expressions interactively and have them +executed or evaluated while you wait. This is one of Python’s strongest +features. Check it by entering a few expressions of your choice and +seeing the results: + + >>> print("Hello") + Hello + >>> "Hello" * 3 + 'HelloHelloHello' + +Many people use the interactive mode as a convenient yet highly +programmable calculator. When you want to end your interactive Python +session, call the *note exit(): 2189. function or hold the ‘Ctrl’ key +down while you enter a ‘Z’, then hit the “‘Enter’” key to get back to +your Windows command prompt. + +You may also find that you have a Start-menu entry such as Start ‣ +Programs ‣ Python 3.x ‣ Python (command line) that results in you seeing +the ‘>>>’ prompt in a new window. If so, the window will disappear +after you call the *note exit(): 2189. function or enter the ‘Ctrl’-‘Z’ +character; Windows is running a single “python” command in the window, +and closes it when you terminate the interpreter. + +Now that we know the ‘py’ command is recognized, you can give your +Python script to it. You’ll have to give either an absolute or a +relative path to the Python script. Let’s say your Python script is +located in your desktop and is named ‘hello.py’, and your command prompt +is nicely opened in your home directory so you’re seeing something +similar to: + + C:\Users\YourName> + +So now you’ll ask the ‘py’ command to give your script to Python by +typing ‘py’ followed by your script path: + + C:\Users\YourName> py Desktop\hello.py + hello + + +File: python.info, Node: How do I make Python scripts executable?, Next: Why does Python sometimes take so long to start?, Prev: How do I run a Python program under Windows?, Up: Python on Windows FAQ + +10.6.2 How do I make Python scripts executable? +----------------------------------------------- + +On Windows, the standard Python installer already associates the .py +extension with a file type (Python.File) and gives that file type an +open command that runs the interpreter (‘D:\Program +Files\Python\python.exe "%1" %*’). This is enough to make scripts +executable from the command prompt as ‘foo.py’. If you’d rather be able +to execute the script by simple typing ‘foo’ with no extension you need +to add .py to the PATHEXT environment variable. + + +File: python.info, Node: Why does Python sometimes take so long to start?, Next: How do I make an executable from a Python script?, Prev: How do I make Python scripts executable?, Up: Python on Windows FAQ + +10.6.3 Why does Python sometimes take so long to start? +------------------------------------------------------- + +Usually Python starts very quickly on Windows, but occasionally there +are bug reports that Python suddenly begins to take a long time to start +up. This is made even more puzzling because Python will work fine on +other Windows systems which appear to be configured identically. + +The problem may be caused by a misconfiguration of virus checking +software on the problem machine. Some virus scanners have been known to +introduce startup overhead of two orders of magnitude when the scanner +is configured to monitor all reads from the filesystem. Try checking +the configuration of virus scanning software on your systems to ensure +that they are indeed configured identically. McAfee, when configured to +scan all file system read activity, is a particular offender. + + +File: python.info, Node: How do I make an executable from a Python script?, Next: Is a * pyd file the same as a DLL?, Prev: Why does Python sometimes take so long to start?, Up: Python on Windows FAQ + +10.6.4 How do I make an executable from a Python script? +-------------------------------------------------------- + +See *note How can I create a stand-alone binary from a Python script?: +50d9. for a list of tools that can be used to make executables. + + +File: python.info, Node: Is a * pyd file the same as a DLL?, Next: How can I embed Python into a Windows application?, Prev: How do I make an executable from a Python script?, Up: Python on Windows FAQ + +10.6.5 Is a ‘*.pyd’ file the same as a DLL? +------------------------------------------- + +Yes, .pyd files are dll’s, but there are a few differences. If you have +a DLL named ‘foo.pyd’, then it must have a function ‘PyInit_foo()’. You +can then write Python “import foo”, and Python will search for foo.pyd +(as well as foo.py, foo.pyc) and if it finds it, will attempt to call +‘PyInit_foo()’ to initialize it. You do not link your .exe with +foo.lib, as that would cause Windows to require the DLL to be present. + +Note that the search path for foo.pyd is PYTHONPATH, not the same as the +path that Windows uses to search for foo.dll. Also, foo.pyd need not be +present to run your program, whereas if you linked your program with a +dll, the dll is required. Of course, foo.pyd is required if you want to +say ‘import foo’. In a DLL, linkage is declared in the source code with +‘__declspec(dllexport)’. In a .pyd, linkage is defined in a list of +available functions. + + +File: python.info, Node: How can I embed Python into a Windows application?, Next: How do I keep editors from inserting tabs into my Python source?, Prev: Is a * pyd file the same as a DLL?, Up: Python on Windows FAQ + +10.6.6 How can I embed Python into a Windows application? +--------------------------------------------------------- + +Embedding the Python interpreter in a Windows app can be summarized as +follows: + + 1. Do 'not' build Python into your .exe file directly. On Windows, + Python must be a DLL to handle importing modules that are + themselves DLL’s. (This is the first key undocumented fact.) + Instead, link to ‘python`NN'.dll’; it is typically installed in + ‘C:\Windows\System’. 'NN' is the Python version, a number such as + “33” for Python 3.3. + + You can link to Python in two different ways. Load-time linking + means linking against ‘python`NN'.lib’, while run-time linking + means linking against ‘python`NN'.dll’. (General note: + ‘python`NN'.lib’ is the so-called “import lib” corresponding to + ‘python`NN'.dll’. It merely defines symbols for the linker.) + + Run-time linking greatly simplifies link options; everything + happens at run time. Your code must load ‘python`NN'.dll’ using + the Windows ‘LoadLibraryEx()’ routine. The code must also use + access routines and data in ‘python`NN'.dll’ (that is, Python’s C + API’s) using pointers obtained by the Windows ‘GetProcAddress()’ + routine. Macros can make using these pointers transparent to any C + code that calls routines in Python’s C API. + + 2. If you use SWIG, it is easy to create a Python “extension module” + that will make the app’s data and methods available to Python. + SWIG will handle just about all the grungy details for you. The + result is C code that you link 'into' your .exe file (!) You do + 'not' have to create a DLL file, and this also simplifies linking. + + 3. SWIG will create an init function (a C function) whose name depends + on the name of the extension module. For example, if the name of + the module is leo, the init function will be called initleo(). If + you use SWIG shadow classes, as you should, the init function will + be called initleoc(). This initializes a mostly hidden helper + class used by the shadow class. + + The reason you can link the C code in step 2 into your .exe file is + that calling the initialization function is equivalent to importing + the module into Python! (This is the second key undocumented + fact.) + + 4. In short, you can use the following code to initialize the Python + interpreter with your extension module. + + #include + ... + Py_Initialize(); // Initialize Python. + initmyAppc(); // Initialize (import) the helper class. + PyRun_SimpleString("import myApp"); // Import the shadow class. + + 5. There are two problems with Python’s C API which will become + apparent if you use a compiler other than MSVC, the compiler used + to build pythonNN.dll. + + Problem 1: The so-called “Very High Level” functions that take + ‘FILE *’ arguments will not work in a multi-compiler environment + because each compiler’s notion of a ‘struct FILE’ will be + different. From an implementation standpoint these are very low + level functions. + + Problem 2: SWIG generates the following code when generating + wrappers to void functions: + + Py_INCREF(Py_None); + _resultobj = Py_None; + return _resultobj; + + Alas, Py_None is a macro that expands to a reference to a complex + data structure called _Py_NoneStruct inside pythonNN.dll. Again, + this code will fail in a mult-compiler environment. Replace such + code by: + + return Py_BuildValue(""); + + It may be possible to use SWIG’s ‘%typemap’ command to make the + change automatically, though I have not been able to get this to + work (I’m a complete SWIG newbie). + + 6. Using a Python shell script to put up a Python interpreter window + from inside your Windows app is not a good idea; the resulting + window will be independent of your app’s windowing system. Rather, + you (or the wxPythonWindow class) should create a “native” + interpreter window. It is easy to connect that window to the + Python interpreter. You can redirect Python’s i/o to _any_ object + that supports read and write, so all you need is a Python object + (defined in your extension module) that contains read() and write() + methods. + + +File: python.info, Node: How do I keep editors from inserting tabs into my Python source?, Next: How do I check for a keypress without blocking?, Prev: How can I embed Python into a Windows application?, Up: Python on Windows FAQ + +10.6.7 How do I keep editors from inserting tabs into my Python source? +----------------------------------------------------------------------- + +The FAQ does not recommend using tabs, and the Python style guide, PEP +8(1), recommends 4 spaces for distributed Python code; this is also the +Emacs python-mode default. + +Under any editor, mixing tabs and spaces is a bad idea. MSVC is no +different in this respect, and is easily configured to use spaces: Take +Tools ‣ Options ‣ Tabs, and for file type “Default” set “Tab size” and +“Indent size” to 4, and select the “Insert spaces” radio button. + +Python raises *note IndentationError: 7a3. or *note TabError: 540. if +mixed tabs and spaces are causing problems in leading whitespace. You +may also run the *note tabnanny: dd. module to check a directory tree in +batch mode. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0008/ + + +File: python.info, Node: How do I check for a keypress without blocking?, Next: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?, Prev: How do I keep editors from inserting tabs into my Python source?, Up: Python on Windows FAQ + +10.6.8 How do I check for a keypress without blocking? +------------------------------------------------------ + +Use the *note msvcrt: 93. module. This is a standard Windows-specific +extension module. It defines a function ‘kbhit()’ which checks whether +a keyboard hit is present, and ‘getch()’ which gets one character +without echoing it. + + +File: python.info, Node: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?, Prev: How do I check for a keypress without blocking?, Up: Python on Windows FAQ + +10.6.9 How do I solve the missing api-ms-win-crt-runtime-l1-1-0.dll error? +-------------------------------------------------------------------------- + +This can occur on Python 3.5 and later when using Windows 8.1 or earlier +without all updates having been installed. First ensure your operating +system is supported and is up to date, and if that does not resolve the +issue, visit the Microsoft support page(1) for guidance on manually +installing the C Runtime update. + + ---------- Footnotes ---------- + + (1) https://support.microsoft.com/en-us/help/3118401/ + + +File: python.info, Node: Graphic User Interface FAQ, Next: “Why is Python Installed on my Computer?” FAQ, Prev: Python on Windows FAQ, Up: Python Frequently Asked Questions + +10.7 Graphic User Interface FAQ +=============================== + +* Menu: + +* General GUI Questions:: +* What GUI toolkits exist for Python?:: +* Tkinter questions:: + + +File: python.info, Node: General GUI Questions, Next: What GUI toolkits exist for Python?, Up: Graphic User Interface FAQ + +10.7.1 General GUI Questions +---------------------------- + + +File: python.info, Node: What GUI toolkits exist for Python?, Next: Tkinter questions, Prev: General GUI Questions, Up: Graphic User Interface FAQ + +10.7.2 What GUI toolkits exist for Python? +------------------------------------------ + +Standard builds of Python include an object-oriented interface to the +Tcl/Tk widget set, called *note tkinter: 3e3e. This is probably the +easiest to install (since it comes included with most binary +distributions(1) of Python) and use. For more info about Tk, including +pointers to the source, see the Tcl/Tk home page(2). Tcl/Tk is fully +portable to the macOS, Windows, and Unix platforms. + +Depending on what platform(s) you are aiming at, there are also several +alternatives. A list of cross-platform(3) and platform-specific(4) GUI +frameworks can be found on the 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 questions, Prev: What GUI toolkits exist for Python?, Up: Graphic User Interface FAQ + +10.7.3 Tkinter questions +------------------------ + +* Menu: + +* How do I freeze Tkinter applications?:: +* Can I have Tk events handled while waiting for I/O?:: +* I can’t get key bindings to work in Tkinter; why?: I can’t get key bindings to work in Tkinter why?. + + +File: python.info, Node: How do I freeze Tkinter applications?, Next: Can I have Tk events handled while waiting for I/O?, Up: Tkinter questions + +10.7.3.1 How do I freeze Tkinter applications? +.............................................. + +Freeze is a tool to create stand-alone applications. When freezing +Tkinter applications, the applications will not be truly stand-alone, as +the application will still need the Tcl and Tk libraries. + +One solution is to ship the application with the Tcl and Tk libraries, +and point to them at run-time using the ‘TCL_LIBRARY’ and ‘TK_LIBRARY’ +environment variables. + +Various third-party freeze libraries such as py2exe and cx_Freeze have +handling for Tkinter applications built-in. + + +File: python.info, Node: Can I have Tk events handled while waiting for I/O?, Next: I can’t get key bindings to work in Tkinter why?, Prev: How do I freeze Tkinter applications?, Up: Tkinter questions + +10.7.3.2 Can I have Tk events handled while waiting for I/O? +............................................................ + +On platforms other than Windows, yes, and you don’t even need threads! +But you’ll have to restructure your I/O code a bit. Tk has the +equivalent of Xt’s ‘XtAddInput()’ call, which allows you to register a +callback function which will be called from the Tk mainloop when I/O is +possible on a file descriptor. See *note File Handlers: 3e5b. + + +File: python.info, Node: I can’t get key bindings to work in Tkinter why?, Prev: Can I have Tk events handled while waiting for I/O?, Up: Tkinter questions + +10.7.3.3 I can’t get key bindings to work in Tkinter: why? +.......................................................... + +An often-heard complaint is that event handlers *note bound: 3e56. to +events with the ‘bind()’ method don’t get handled even when the +appropriate key is pressed. + +The most common cause is that the widget to which the binding applies +doesn’t have “keyboard focus”. Check out the Tk documentation for the +focus command. Usually a widget is given the keyboard focus by clicking +in it (but not for labels; see the takefocus option). + + +File: python.info, Node: “Why is Python Installed on my Computer?” FAQ, Prev: Graphic User Interface FAQ, Up: Python Frequently Asked Questions + +10.8 “Why is Python Installed on my Computer?” FAQ +================================================== + +* Menu: + +* What is Python?: What is Python?<2>. +* Why is Python installed on my machine?:: +* Can I delete Python?:: + + +File: python.info, Node: What is Python?<2>, Next: Why is Python installed on my machine?, Up: “Why is Python Installed on my Computer?” FAQ + +10.8.1 What is Python? +---------------------- + +Python is a programming language. It’s used for many different +applications. It’s used in some high schools and colleges as an +introductory programming language because Python is easy to learn, but +it’s also used by professional software developers at places such as +Google, NASA, and Lucasfilm Ltd. + +If you wish to learn more about Python, start with the Beginner's Guide +to Python(1). + + ---------- Footnotes ---------- + + (1) https://wiki.python.org/moin/BeginnersGuide + + +File: python.info, Node: Why is Python installed on my machine?, Next: Can I delete Python?, Prev: What is Python?<2>, Up: “Why is Python Installed on my Computer?” FAQ + +10.8.2 Why is Python installed on my machine? +--------------------------------------------- + +If you find Python installed on your system but don’t remember +installing it, there are several possible ways it could have gotten +there. + + * Perhaps another user on the computer wanted to learn programming + and installed it; you’ll have to figure out who’s been using the + machine and might have installed it. + + * A third-party application installed on the machine might have been + written in Python and included a Python installation. There are + many such applications, from GUI programs to network servers and + administrative scripts. + + * Some Windows machines also have Python installed. At this writing + we’re aware of computers from Hewlett-Packard and Compaq that + include Python. Apparently some of HP/Compaq’s administrative + tools are written in Python. + + * Many Unix-compatible operating systems, such as macOS and some + Linux distributions, have Python installed by default; it’s + included in the base installation. + + +File: python.info, Node: Can I delete Python?, Prev: Why is Python installed on my machine?, Up: “Why is Python Installed on my Computer?” FAQ + +10.8.3 Can I delete Python? +--------------------------- + +That depends on where Python came from. + +If someone installed it deliberately, you can remove it without hurting +anything. On Windows, use the Add/Remove Programs icon in the Control +Panel. + +If Python was installed by a third-party application, you can also +remove it, but that application will no longer work. You should use +that application’s uninstaller rather than removing Python directly. + +If Python came with your operating system, removing it is not +recommended. If you remove it, whatever tools were written in Python +will no longer run, and some of them might be important to you. +Reinstalling the whole system would then be required to fix things +again. + + +File: python.info, Node: Deprecations, Next: Glossary, Prev: Python Frequently Asked Questions, Up: Top + +11 Deprecations +*************** + +* Menu: + +* Pending Removal in Python 3.14: Pending Removal in Python 3 14<5>. +* Pending Removal in Python 3.15: Pending Removal in Python 3 15<5>. +* Pending removal in Python 3.16: Pending removal in Python 3 16<5>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<5>. +* C API Deprecations:: + + +File: python.info, Node: Pending Removal in Python 3 14<5>, Next: Pending Removal in Python 3 15<5>, Up: Deprecations + +11.1 Pending Removal in Python 3.14 +=================================== + + * *note argparse: 6.: 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: 8.: The following features have been deprecated in + documentation since Python 3.8, now cause a *note + DeprecationWarning: 1a5. 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: 2bb. instead. (Contributed by Serhiy + Storchaka in gh-90953(2).) + + * *note asyncio: a.: + + * The child watcher classes *note MultiLoopChildWatcher: 2bc, + *note FastChildWatcher: 2bd, *note AbstractChildWatcher: 2be. + and *note SafeChildWatcher: 2bf. are deprecated and will be + removed in Python 3.14. (Contributed by Kumar Aditya in + gh-94597(3).) + + * *note asyncio.set_child_watcher(): 2c0, *note + asyncio.get_child_watcher(): 2c1, *note + asyncio.AbstractEventLoopPolicy.set_child_watcher(): 2c2. and + *note asyncio.AbstractEventLoopPolicy.get_child_watcher(): + 2c3. are deprecated and will be removed in Python 3.14. + (Contributed by Kumar Aditya in gh-94597(4).) + + * The *note get_event_loop(): 2c4. method of the default event + loop policy now emits a *note DeprecationWarning: 1a5. 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 collections.abc: 1e.: Deprecated *note ByteString: 2c5. + Prefer ‘Sequence’ or *note Buffer: 2c6. For use in typing, prefer + a union, like ‘bytes | bytearray’, or *note collections.abc.Buffer: + 2c6. (Contributed by Shantanu Jain in gh-91896(6).) + + * *note email: 3b.: Deprecated the 'isdst' parameter in *note + email.utils.localtime(): 2c7. (Contributed by Alan Williams in + gh-72346(7).) + + * *note importlib.abc: 78. deprecated classes: + + * ‘importlib.abc.ResourceReader’ + + * ‘importlib.abc.Traversable’ + + * ‘importlib.abc.TraversableResources’ + + Use *note importlib.resources.abc: 7c. classes instead: + + * *note importlib.resources.abc.Traversable: 1f5. + + * *note importlib.resources.abc.TraversableResources: 2c8. + + (Contributed by Jason R. Coombs and Hugo van Kemenade in + gh-93963(8).) + + * *note itertools: 81. 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(9).) + + * *note multiprocessing: 94.: 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(10)). 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(): 2c9. or *note set_start_method(): 2ca. APIs to + explicitly specify when your code 'requires' ‘'fork'’. See *note + Contexts and start methods: 2cb. + + * *note pathlib: a4.: *note is_relative_to(): 2cc. and *note + relative_to(): 2cd.: passing additional arguments is deprecated. + + * *note pkgutil: a9.: *note find_loader(): 2ce. and *note + get_loader(): 2cf. now raise *note DeprecationWarning: 1a5.; use + *note importlib.util.find_spec(): 2d0. instead. (Contributed by + Nikita Sobolev in gh-97850(11).) + + * *note pty: b1.: + + * ‘master_open()’: use *note pty.openpty(): 2d1. + + * ‘slave_open()’: use *note pty.openpty(): 2d1. + + * *note sqlite3: cf.: + + * *note version: 2d2. and *note version_info: 2d3. + + * *note execute(): 2d4. and *note executemany(): 2d5. if *note + named placeholders: 2d6. are used and 'parameters' is a + sequence instead of a *note dict: 258. + + * *note typing: 104.: *note ByteString: 2d7, deprecated since Python + 3.9, now causes a *note DeprecationWarning: 1a5. to be emitted when + it is used. + + * *note urllib: 108.: ‘urllib.parse.Quoter’ is deprecated: it was not + intended to be a public API. (Contributed by Gregory P. Smith in + gh-88168(12).) + + ---------- 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/91896 + + (7) https://github.com/python/cpython/issues/72346 + + (8) https://github.com/python/cpython/issues/93963 + + (9) https://github.com/python/cpython/issues/101588 + + (10) https://github.com/python/cpython/issues/84559 + + (11) https://github.com/python/cpython/issues/97850 + + (12) https://github.com/python/cpython/issues/88168 + + +File: python.info, Node: Pending Removal in Python 3 15<5>, Next: Pending removal in Python 3 16<5>, Prev: Pending Removal in Python 3 14<5>, Up: Deprecations + +11.2 Pending Removal in Python 3.15 +=================================== + + * The import system: + + * Setting *note __cached__: 2d9. on a module while failing to + set *note __spec__.cached: 2da. 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__: 2db. on a module while failing to + set *note __spec__.parent: 2dc. 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: 2a.: + + * The undocumented ‘ctypes.SetPointerType()’ function has been + deprecated since Python 3.13. + + * *note http.server: 72.: + + * The obsolete and rarely used *note CGIHTTPRequestHandler: 2a3. + 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: 77.: + + * ‘load_module()’ method: use ‘exec_module()’ instead. + + * *note locale: 86.: + + * The *note getdefaultlocale(): 2dd. function has been + deprecated since Python 3.11. Its removal was originally + planned for Python 3.13 (gh-90817(3)), but has been postponed + to Python 3.15. Use *note getlocale(): 2de, *note + setlocale(): 2df, and *note getencoding(): 2e0. instead. + (Contributed by Hugo van Kemenade in gh-111187(4).) + + * *note pathlib: a4.: + + * *note PurePath.is_reserved(): 2a8. has been deprecated since + Python 3.13. Use *note os.path.isreserved(): 225. to detect + reserved paths on Windows. + + * *note platform: aa.: + + * *note java_ver(): 2a9. 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: db.: + + * The 'check_home' argument of *note + sysconfig.is_python_build(): 2e1. has been deprecated since + Python 3.12. + + * *note threading: ed.: + + * *note RLock(): 2e2. 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: 103.: + + * *note types.CodeType: 2e3.: Accessing *note co_lnotab: 2e4. + was deprecated in PEP 626(5) since 3.10 and was planned to be + removed in 3.12, but it only got a proper *note + DeprecationWarning: 1a5. in 3.12. May be removed in 3.15. + (Contributed by Nikita Sobolev in gh-101866(6).) + + * *note typing: 104.: + + * The undocumented keyword argument syntax for creating *note + NamedTuple: 2b2. classes (e.g. ‘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: 162.s, + failing to pass a value to the 'fields' parameter (‘TD = + TypedDict("TD")’) or passing ‘None’ (‘TD = TypedDict("TD", + None)’) has been deprecated since Python 3.13. Use ‘class + TD(TypedDict): pass’ or ‘TD = TypedDict("TD", {})’ to create a + TypedDict with zero field. + + * The *note typing.no_type_check_decorator(): 2b3. decorator + function has been deprecated since Python 3.13. After eight + years in the *note typing: 104. module, it has yet to be + supported by any major type checker. + + * *note wave: 113.: + + * The *note getmark(): 2b6, ‘setmark()’, and *note getmarkers(): + 2b7. methods of the *note Wave_read: 2b8. and *note + Wave_write: 2b9. classes have been deprecated since Python + 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/97879 + + (2) https://github.com/python/cpython/issues/97879 + + (3) https://github.com/python/cpython/issues/90817 + + (4) https://github.com/python/cpython/issues/111187 + + (5) https://peps.python.org/pep-0626/ + + (6) https://github.com/python/cpython/issues/101866 + + +File: python.info, Node: Pending removal in Python 3 16<5>, Next: Pending Removal in Future Versions<5>, Prev: Pending Removal in Python 3 15<5>, Up: Deprecations + +11.3 Pending removal in Python 3.16 +=================================== + + * The import system: + + * Setting *note __loader__: 2e6. on a module while failing to + set *note __spec__.loader: 2e7. 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: 7.: + + * 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: 29d.) for + Unicode characters instead. + + * *note asyncio: a.: + + * ‘asyncio.iscoroutinefunction()’ is deprecated and will be + removed in Python 3.16, use *note + inspect.iscoroutinefunction(): 2e8. instead. (Contributed by + Jiahao Li and Kumar Aditya in gh-122875(1).) + + * *note builtins: 12.: + + * 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 shutil: c5.: + + * 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: 195. + + * *note symtable: d8.: + + * The *note Class.get_methods: 2e9. method has been deprecated + since Python 3.14. + + * *note sys: d9.: + + * The *note _enablelegacywindowsfsencoding(): 2b0. function has + been deprecated since Python 3.13. Use the *note + PYTHONLEGACYWINDOWSFSENCODING: 2b1. environment variable + instead. + + * *note tarfile: de.: + + * The undocumented and unused ‘TarFile.tarfile’ attribute has + been deprecated since Python 3.13. + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/issues/122875 + + +File: python.info, Node: Pending Removal in Future Versions<5>, Next: C API Deprecations, Prev: Pending removal in Python 3 16<5>, Up: Deprecations + +11.4 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: 6.: Nesting argument groups and nesting mutually + exclusive groups are deprecated. + + * *note builtins: 12.: + + * ‘bool(NotImplemented)’. + + * 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: + 2eb, *note else: 18c, *note for: 2ec, *note if: 2ed, *note in: + 2ee, *note is: 2ef. and *note or: 2f0. 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: 259. + + * Support for ‘__float__()’ method returning a strict subclass + of *note float: 2f1.: these methods will be required to return + an instance of *note float: 2f1. + + * Support for ‘__complex__()’ method returning a strict subclass + of *note complex: 2f2.: these methods will be required to + return an instance of *note complex: 2f2. + + * Delegation of ‘int()’ to ‘__trunc__()’ method. + + * Passing a complex number as the 'real' or 'imag' argument in + the *note complex(): 2f2. constructor is now deprecated; it + should only be passed as a single positional argument. + (Contributed by Serhiy Storchaka in gh-109218(2).) + + * *note calendar: 14.: ‘calendar.January’ and ‘calendar.February’ + constants are deprecated and replaced by *note calendar.JANUARY: + 2f3. and *note calendar.FEBRUARY: 2f4. (Contributed by Prince + Roshan in gh-103636(3).) + + * *note codeobject.co_lnotab: 2e4.: use the *note + codeobject.co_lines(): 2f5. method instead. + + * *note datetime: 30.: + + * *note utcnow(): 2f6.: use + ‘datetime.datetime.now(tz=datetime.UTC)’. + + * *note utcfromtimestamp(): 2f7.: use + ‘datetime.datetime.fromtimestamp(timestamp, tz=datetime.UTC)’. + + * *note gettext: 63.: Plural value must be an integer. + + * *note importlib: 77.: + + * *note cache_from_source(): 2f8. 'debug_override' parameter is + deprecated: use the 'optimization' parameter instead. + + * *note importlib.metadata: 7a.: + + * ‘EntryPoints’ tuple interface. + + * Implicit ‘None’ on return values. + + * *note logging: 87.: the ‘warn()’ method has been deprecated since + Python 3.3, use *note warning(): 2f9. instead. + + * *note mailbox: 8b.: Use of StringIO input and text mode is + deprecated, use BytesIO and binary mode instead. + + * *note os: a1.: Calling *note os.register_at_fork(): 2fa. in + multi-threaded process. + + * ‘pydoc.ErrorDuringImport’: A tuple value for 'exc_info' parameter + is deprecated, use an exception instance. + + * *note re: b9.: 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(4).) + + * ‘sre_compile’, ‘sre_constants’ and ‘sre_parse’ modules. + + * *note shutil: c5.: *note rmtree(): 2fb.’s 'onerror' parameter is + deprecated in Python 3.12; use the 'onexc' parameter instead. + + * *note ssl: d0. options and protocols: + + * *note ssl.SSLContext: 296. without protocol argument is + deprecated. + + * *note ssl.SSLContext: 296.: *note set_npn_protocols(): 2fc. + 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: ed. methods: + + * ‘threading.Condition.notifyAll()’: use *note notify_all(): + 2fd. + + * ‘threading.Event.isSet()’: use *note is_set(): 2fe. + + * ‘threading.Thread.isDaemon()’, *note + threading.Thread.setDaemon(): 2ff.: use *note + threading.Thread.daemon: 300. attribute. + + * ‘threading.Thread.getName()’, *note + threading.Thread.setName(): 301.: use *note + threading.Thread.name: 302. attribute. + + * ‘threading.currentThread()’: use *note + threading.current_thread(): 303. + + * ‘threading.activeCount()’: use *note threading.active_count(): + 304. + + * *note typing.Text: 305. (gh-92332(5)). + + * *note unittest.IsolatedAsyncioTestCase: 306.: it is deprecated to + return a value that is not ‘None’ from a test case. + + * *note urllib.parse: 10a. deprecated functions: *note urlparse(): + 307. instead + + * ‘splitattr()’ + + * ‘splithost()’ + + * ‘splitnport()’ + + * ‘splitpasswd()’ + + * ‘splitport()’ + + * ‘splitquery()’ + + * ‘splittag()’ + + * ‘splittype()’ + + * ‘splituser()’ + + * ‘splitvalue()’ + + * ‘to_bytes()’ + + * *note urllib.request: 10b.: *note URLopener: 308. and *note + FancyURLopener: 309. style of invoking requests is deprecated. Use + newer *note urlopen(): 295. functions and methods. + + * *note wsgiref: 118.: ‘SimpleHandler.stdout.write()’ should not do + partial writes. + + * *note xml.etree.ElementTree: 125.: Testing the truth value of an + *note Element: 30a. is deprecated. In a future release it will + always return ‘True’. Prefer explicit ‘len(elem)’ or ‘elem is not + None’ tests instead. + + * *note zipimport.zipimporter.load_module(): 30b. is deprecated: use + *note exec_module(): 30c. 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/91760 + + (5) https://github.com/python/cpython/issues/92332 + + +File: python.info, Node: C API Deprecations, Prev: Pending Removal in Future Versions<5>, Up: Deprecations + +11.5 C API Deprecations +======================= + +* Menu: + +* Pending Removal in Python 3.14: Pending Removal in Python 3 14<6>. +* Pending Removal in Python 3.15: Pending Removal in Python 3 15<6>. +* Pending Removal in Future Versions: Pending Removal in Future Versions<6>. + + +File: python.info, Node: Pending Removal in Python 3 14<6>, Next: Pending Removal in Python 3 15<6>, Up: C API Deprecations + +11.5.1 Pending Removal in Python 3.14 +------------------------------------- + + * The ‘ma_version_tag’ field in *note PyDictObject: 3bd. for + extension modules ( PEP 699(1); gh-101193(2)). + + * Creating *note immutable types: 3be. with mutable bases + (gh-95388(3)). + + * Functions to configure Python’s initialization, deprecated in + Python 3.11: + + * ‘PySys_SetArgvEx()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘PySys_SetArgv()’: Set *note PyConfig.argv: 3bf. instead. + + * ‘Py_SetProgramName()’: Set *note PyConfig.program_name: 3c0. + instead. + + * ‘Py_SetPythonHome()’: Set *note PyConfig.home: 3b7. instead. + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + * Global configuration variables: + + * *note Py_DebugFlag: 3c2.: Use *note PyConfig.parser_debug: + 3c3. instead. + + * *note Py_VerboseFlag: 3c4.: Use *note PyConfig.verbose: 3c5. + instead. + + * *note Py_QuietFlag: 3c6.: Use *note PyConfig.quiet: 3c7. + instead. + + * *note Py_InteractiveFlag: 3c8.: Use *note + PyConfig.interactive: 3c9. instead. + + * *note Py_InspectFlag: 3ca.: Use *note PyConfig.inspect: 3cb. + instead. + + * *note Py_OptimizeFlag: 3cc.: Use *note + PyConfig.optimization_level: 3cd. instead. + + * *note Py_NoSiteFlag: 3ce.: Use *note PyConfig.site_import: + 3cf. instead. + + * *note Py_BytesWarningFlag: 3d0.: Use *note + PyConfig.bytes_warning: 3d1. instead. + + * *note Py_FrozenFlag: 3d2.: Use *note + PyConfig.pathconfig_warnings: 3d3. instead. + + * *note Py_IgnoreEnvironmentFlag: 3d4.: Use *note + PyConfig.use_environment: 3d5. instead. + + * *note Py_DontWriteBytecodeFlag: 3d6.: Use *note + PyConfig.write_bytecode: 3d7. instead. + + * *note Py_NoUserSiteDirectory: 3d8.: Use *note + PyConfig.user_site_directory: 3d9. instead. + + * *note Py_UnbufferedStdioFlag: 3da.: Use *note + PyConfig.buffered_stdio: 3db. instead. + + * *note Py_HashRandomizationFlag: 3dc.: Use *note + PyConfig.use_hash_seed: 3dd. and *note PyConfig.hash_seed: + 3de. instead. + + * *note Py_IsolatedFlag: 3df.: Use *note PyConfig.isolated: 3e0. + instead. + + * *note Py_LegacyWindowsFSEncodingFlag: 3e1.: Use *note + PyPreConfig.legacy_windows_fs_encoding: 3e2. instead. + + * *note Py_LegacyWindowsStdioFlag: 3e3.: Use *note + PyConfig.legacy_windows_stdio: 3a0. instead. + + * ‘Py_FileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_HasFileSystemDefaultEncoding’: Use *note + PyConfig.filesystem_encoding: 3e4. instead. + + * ‘Py_FileSystemDefaultEncodeErrors’: Use *note + PyConfig.filesystem_errors: 3e5. instead. + + * ‘Py_UTF8Mode’: Use *note PyPreConfig.utf8_mode: 3e6. instead. + (see *note Py_PreInitialize(): 3e7.) + + The *note Py_InitializeFromConfig(): 3c1. API should be used with + *note PyConfig: 3a2. instead. + + ---------- 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 Future Versions<6>, Prev: Pending Removal in Python 3 14<6>, Up: C API Deprecations + +11.5.2 Pending Removal in Python 3.15 +------------------------------------- + + * The *note PyImport_ImportModuleNoBlock(): 3b9.: Use *note + PyImport_ImportModule(): 3ba. instead. + + * *note PyWeakref_GetObject(): 374. and *note PyWeakref_GET_OBJECT(): + 3bb.: Use *note PyWeakref_GetRef(): 373. instead. + + * *note Py_UNICODE: 3e9. type and the ‘Py_UNICODE_WIDE’ macro: Use + ‘wchar_t’ instead. + + * Python initialization functions: + + * *note PySys_ResetWarnOptions(): 3ab.: Clear *note + sys.warnoptions: 3ac. and ‘warnings.filters’ instead. + + * *note Py_GetExecPrefix(): 3ad.: Get *note + sys.base_exec_prefix: 3ea. and *note sys.exec_prefix: 3ae. + instead. + + * *note Py_GetPath(): 3af.: Get *note sys.path: 3b0. instead. + + * *note Py_GetPrefix(): 3b1.: Get *note sys.base_prefix: 3eb. + and *note sys.prefix: 3b2. instead. + + * *note Py_GetProgramFullPath(): 3b3.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetProgramName(): 3b5.: Get *note sys.executable: + 3b4. instead. + + * *note Py_GetPythonHome(): 3b6.: Get *note PyConfig.home: 3b7. + or the *note PYTHONHOME: 3b8. environment variable instead. + + +File: python.info, Node: Pending Removal in Future Versions<6>, Prev: Pending Removal in Python 3 15<6>, Up: C API Deprecations + +11.5.3 Pending Removal in Future Versions +----------------------------------------- + +The following APIs are deprecated and will be removed, although there is +currently no date scheduled for their removal. + + * *note Py_TPFLAGS_HAVE_FINALIZE: 3ee.: Unneeded since Python 3.8. + + * *note PyErr_Fetch(): 3ef.: Use *note PyErr_GetRaisedException(): + 3f0. instead. + + * *note PyErr_NormalizeException(): 3f1.: Use *note + PyErr_GetRaisedException(): 3f0. instead. + + * *note PyErr_Restore(): 3f2.: Use *note PyErr_SetRaisedException(): + 3f3. instead. + + * *note PyModule_GetFilename(): 3f4.: Use *note + PyModule_GetFilenameObject(): 3f5. instead. + + * *note PyOS_AfterFork(): 3f6.: Use *note PyOS_AfterFork_Child(): + 3f7. instead. + + * *note PySlice_GetIndicesEx(): 3f8.: Use *note PySlice_Unpack(): + 3f9. and *note PySlice_AdjustIndices(): 3fa. instead. + + * ‘PyUnicode_AsDecodedObject()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsDecodedUnicode()’: Use *note PyCodec_Decode(): 3fb. + instead. + + * ‘PyUnicode_AsEncodedObject()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * ‘PyUnicode_AsEncodedUnicode()’: Use *note PyCodec_Encode(): 3fc. + instead. + + * *note PyUnicode_READY(): 3fd.: Unneeded since Python 3.12 + + * ‘PyErr_Display()’: Use *note PyErr_DisplayException(): 3fe. + instead. + + * ‘_PyErr_ChainExceptions()’: Use ‘_PyErr_ChainExceptions1()’ + instead. + + * ‘PyBytesObject.ob_shash’ member: call *note PyObject_Hash(): 3ff. + instead. + + * ‘PyDictObject.ma_version_tag’ member. + + * Thread Local Storage (TLS) API: + + * *note PyThread_create_key(): 400.: Use *note + PyThread_tss_alloc(): 401. instead. + + * *note PyThread_delete_key(): 402.: Use *note + PyThread_tss_free(): 403. instead. + + * *note PyThread_set_key_value(): 404.: Use *note + PyThread_tss_set(): 405. instead. + + * *note PyThread_get_key_value(): 406.: Use *note + PyThread_tss_get(): 407. instead. + + * *note PyThread_delete_key_value(): 408.: Use *note + PyThread_tss_delete(): 409. instead. + + * *note PyThread_ReInitTLS(): 40a.: Unneeded since Python 3.7. + + +File: python.info, Node: Glossary, Next: About this documentation, Prev: Deprecations, Up: Top + +12 Glossary +*********** + +‘>>>’ + + The default Python prompt of the *note interactive: 169. shell. + Often seen for code examples which can be executed interactively in + the interpreter. + +‘...’ + + Can refer to: + + * The default Python prompt of the *note interactive: 169. shell + when entering the code for an indented code block, when within + a pair of matching left and right delimiters (parentheses, + square brackets, curly braces or triple quotes), or after + specifying a decorator. + + * The *note Ellipsis: 2185. built-in constant. + +abstract base class + + Abstract base classes complement *note duck-typing: 51a0. by + providing a way to define interfaces when other techniques like + *note hasattr(): 4ce. would be clumsy or subtly wrong (for example + with *note magic methods: 1f66.). ABCs introduce virtual + subclasses, which are classes that don’t inherit from a class but + are still recognized by *note isinstance(): 43d. and *note + issubclass(): 7bc.; see the *note abc: 4. module documentation. + Python comes with many built-in ABCs for data structures (in the + *note collections.abc: 1e. module), numbers (in the *note numbers: + 9e. module), streams (in the *note io: 7f. module), import finders + and loaders (in the *note importlib.abc: 78. module). You can + create your own ABCs with the *note abc: 4. module. + +annotation + + A label associated with a variable, a class attribute or a function + parameter or return value, used by convention as a *note type hint: + 1f81. + + Annotations of local variables cannot be accessed at runtime, but + annotations of global variables, class attributes, and functions + are stored in the ‘__annotations__’ special attribute of modules, + classes, and functions, respectively. + + See *note variable annotation: d55, *note function annotation: + 1c37, PEP 484(1) and PEP 526(2), which describe this functionality. + Also see *note Annotations Best Practices: 7d4. for best practices + on working with annotations. + +argument + + A value passed to a *note function: 2059. (or *note method: 1552.) + when calling the function. There are two kinds of argument: + + * 'keyword argument': an argument preceded by an identifier + (e.g. ‘name=’) in a function call or passed as a value in a + dictionary preceded by ‘**’. For example, ‘3’ and ‘5’ are + both keyword arguments in the following calls to *note + complex(): 2f2.: + + complex(real=3, imag=5) + complex(**{'real': 3, 'imag': 5}) + + * 'positional argument': an argument that is not a keyword + argument. Positional arguments can appear at the beginning of + an argument list and/or be passed as elements of an *note + iterable: 121a. preceded by ‘*’. For example, ‘3’ and ‘5’ are + both positional arguments in the following calls: + + complex(3, 5) + complex(*(3, 5)) + + Arguments are assigned to the named local variables in a function + body. See the *note Calls: d7c. section for the rules governing + this assignment. Syntactically, any expression can be used to + represent an argument; the evaluated value is assigned to the local + variable. + + See also the *note parameter: 1eff. glossary entry, the FAQ + question on *note the difference between arguments and parameters: + 50e4, and PEP 362(3). + +asynchronous context manager + + An object which controls the environment seen in an *note async + with: 5d1. statement by defining *note __aenter__(): 1fd0. and + *note __aexit__(): 162a. methods. Introduced by PEP 492(4). + +asynchronous generator + + A function which returns an *note asynchronous generator iterator: + 4396. It looks like a coroutine function defined with *note async + def: 5cd. except that it contains *note yield: 9cd. expressions for + producing a series of values usable in an *note async for: aab. + loop. + + Usually refers to an asynchronous generator function, but may refer + to an 'asynchronous generator iterator' in some contexts. In cases + where the intended meaning isn’t clear, using the full terms avoids + ambiguity. + + An asynchronous generator function may contain *note await: 1b9. + expressions as well as *note async for: aab, and *note async with: + 5d1. statements. + +asynchronous generator iterator + + An object created by a *note asynchronous generator: 203e. + function. + + This is an *note asynchronous iterator: 1ab. which when called + using the *note __anext__(): 1573. method returns an awaitable + object which will execute the body of the asynchronous generator + function until the next *note yield: 9cd. expression. + + Each *note yield: 9cd. temporarily suspends processing, remembering + the execution state (including local variables and pending + try-statements). When the 'asynchronous generator iterator' + effectively resumes with another awaitable returned by *note + __anext__(): 1573, it picks up where it left off. See PEP 492(5) + and PEP 525(6). + +asynchronous iterable + + An object, that can be used in an *note async for: aab. statement. + Must return an *note asynchronous iterator: 1ab. from its *note + __aiter__(): bfb. method. Introduced by PEP 492(7). + +asynchronous iterator + + An object that implements the *note __aiter__(): bfb. and *note + __anext__(): 1573. methods. *note __anext__(): 1573. must return + an *note awaitable: 1ad. object. *note async for: aab. resolves + the awaitables returned by an asynchronous iterator’s *note + __anext__(): 1573. method until it raises a *note + StopAsyncIteration: 1a2c. exception. Introduced by PEP 492(8). + +attribute + + A value associated with an object which is usually referenced by + name using dotted expressions. For example, if an object 'o' has + an attribute 'a' it would be referenced as 'o.a'. + + It is possible to give an object an attribute whose name is not an + identifier as defined by *note Identifiers and keywords: 1e94, for + example using *note setattr(): 215b, if the object allows it. Such + an attribute will not be accessible using a dotted expression, and + would instead need to be retrieved with *note getattr(): bd1. + +awaitable + + An object that can be used in an *note await: 1b9. expression. Can + be a *note coroutine: 48d. or an object with an *note __await__(): + 1fc7. method. See also PEP 492(9). + +BDFL + + Benevolent Dictator For Life, a.k.a. Guido van Rossum(10), + Python’s creator. + +binary file + + A *note file object: 11b5. able to read and write *note bytes-like + objects: d2d. Examples of binary files are files opened in binary + mode (‘'rb'’, ‘'wb'’ or ‘'rb+'’), *note sys.stdin.buffer: 539, + *note sys.stdout.buffer: ad6, and instances of *note io.BytesIO: + e9d. and *note gzip.GzipFile: 416. + + See also *note text file: 1c86. for a file object able to read and + write *note str: 447. objects. + +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: 338. to the object and so destroy it. + + Calling *note Py_INCREF(): 56b. on the *note borrowed reference: + 339. is recommended to convert it to a *note strong reference: 338. + in-place, except when the object cannot be destroyed before the + last usage of the borrowed reference. The *note Py_NewRef(): 898. + function can be used to create a new *note strong reference: 338. + +bytes-like object + + An object that supports the *note Buffer Protocol: 393. and can + export a C-*note contiguous: 2227. buffer. This includes all *note + bytes: 1c2, *note bytearray: 53a, and *note array.array: 1a0. + objects, as well as many common *note memoryview: 464. objects. + Bytes-like objects can be used for various operations that work + with binary data; these include compression, saving to a binary + file, and sending over a socket. + + Some operations need the binary data to be mutable. The + documentation often refers to these as “read-write bytes-like + objects”. Example mutable buffer objects include *note bytearray: + 53a. and a *note memoryview: 464. of a *note bytearray: 53a. Other + operations require the binary data to be stored in immutable + objects (“read-only bytes-like objects”); examples of these include + *note bytes: 1c2. and a *note memoryview: 464. of a *note bytes: + 1c2. object. + +bytecode + + Python source code is compiled into bytecode, the internal + representation of a Python program in the CPython interpreter. The + bytecode is also cached in ‘.pyc’ files so that executing the same + file is faster the second time (recompilation from source to + bytecode can be avoided). This “intermediate language” is said to + run on a *note virtual machine: 3502. that executes the machine + code corresponding to each bytecode. Do note that bytecodes are + not expected to work between different Python virtual machines, nor + to be stable between Python releases. + + A list of bytecode instructions can be found in the documentation + for *note the dis module: 5ae. + +callable + + A callable is an object that can be called, possibly with a set of + arguments (see *note argument: 444.), with the following syntax: + + callable(argument1, argument2, argumentN) + + A *note function: 2059, and by extension a *note method: 1552, is a + callable. An instance of a class that implements the *note + __call__(): 555. method is also a callable. + +callback + + A subroutine function which is passed as an argument to be executed + at some point in the future. + +class + + A template for creating user-defined objects. Class definitions + normally contain method definitions which operate on instances of + the class. + +class variable + + A variable defined in a class and intended to be modified only at + class level (i.e., not in an instance of the class). + +closure variable + + A *note free variable: 1fda. referenced from a *note nested scope: + 1f3e. 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: 129a. 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: 1fda, 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: 1efb. 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: 1fda. term is sometimes used even when + the intended meaning is to refer specifically to closure variables. + +complex number + + An extension of the familiar real number system in which all + numbers are expressed as a sum of a real part and an imaginary + part. Imaginary numbers are real multiples of the imaginary unit + (the square root of ‘-1’), often written ‘i’ in mathematics or ‘j’ + in engineering. Python has built-in support for complex numbers, + which are written with this latter notation; the imaginary part is + written with a ‘j’ suffix, e.g., ‘3+1j’. To get access to complex + equivalents of the *note math: 8e. module, use *note cmath: 18. + Use of complex numbers is a fairly advanced mathematical feature. + If you’re not aware of a need for them, it’s almost certain you can + safely ignore them. + +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: 5d0. via a *note with: 5ce. statement. + + * The collection of key­value bindings associated with a + particular *note contextvars.Context: 15a9. object and + accessed via *note ContextVar: 155d. objects. Also see *note + context variable: 51a4. + + * A *note contextvars.Context: 15a9. object. Also see *note + current context: 15b2. + +context management protocol + + The *note __enter__(): 5c4. and *note __exit__(): 12f3. methods + called by the *note with: 5ce. statement. See PEP 343(11). + +context manager + + An object which implements the *note context management protocol: + 15b3. and controls the environment seen in a *note with: 5ce. + statement. See PEP 343(12). + +context variable + + A variable whose value depends on which context is the *note + current context: 15b2. Values are accessed via *note + contextvars.ContextVar: 155d. objects. Context variables are + primarily used to isolate state between concurrent asynchronous + tasks. + +contiguous + + A buffer is considered contiguous exactly if it is either + 'C-contiguous' or 'Fortran contiguous'. Zero-dimensional buffers + are C and Fortran contiguous. In one-dimensional arrays, the items + must be laid out in memory next to each other, in order of + increasing indexes starting from zero. In multidimensional + C-contiguous arrays, the last index varies the fastest when + visiting items in order of memory address. However, in Fortran + contiguous arrays, the first index varies the fastest. + +coroutine + + Coroutines are a more generalized form of subroutines. Subroutines + are entered at one point and exited at another point. Coroutines + can be entered, exited, and resumed at many different points. They + can be implemented with the *note async def: 5cd. statement. See + also PEP 492(13). + +coroutine function + + A function which returns a *note coroutine: 48d. object. A + coroutine function may be defined with the *note async def: 5cd. + statement, and may contain *note await: 1b9, *note async for: aab, + and *note async with: 5d1. keywords. These were introduced by PEP + 492(14). + +CPython + + The canonical implementation of the Python programming language, as + distributed on python.org(15). The term “CPython” is used when + necessary to distinguish this implementation from others such as + Jython or IronPython. + +current context + + The *note context: 15b1. (*note contextvars.Context: 15a9. object) + that is currently used by *note ContextVar: 155d. objects to access + (get or set) the values of *note context variables: 51a4. Each + thread has its own current context. Frameworks for executing + asynchronous tasks (see *note asyncio: a.) associate each task with + a context which becomes the current context whenever the task + starts or resumes execution. + +decorator + + A function returning another function, usually applied as a + function transformation using the ‘@wrapper’ syntax. Common + examples for decorators are *note classmethod(): 166. and *note + staticmethod(): 412. + + The decorator syntax is merely syntactic sugar, the following two + function definitions are semantically equivalent: + + def f(arg): + ... + f = staticmethod(f) + + @staticmethod + def f(arg): + ... + + The same concept exists for classes, but is less commonly used + there. See the documentation for *note function definitions: 1c36. + and *note class definitions: 12ca. for more about decorators. + +descriptor + + Any object which defines the methods *note __get__(): 14b2, *note + __set__(): 1f6a, or *note __delete__(): 1609. 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. + + For more information about descriptors’ methods, see *note + Implementing Descriptors: c4f. or the *note Descriptor How To + Guide: 14b7. + +dictionary + + An associative array, where arbitrary keys are mapped to values. + The keys can be any object with *note __hash__(): afb. and *note + __eq__(): afa. methods. Called a hash in Perl. + +dictionary comprehension + + A compact way to process all or part of the elements in an iterable + and return a dictionary with the results. ‘results = {n: n ** 2 + for n in range(10)}’ generates a dictionary containing key ‘n’ + mapped to value ‘n ** 2’. See *note Displays for lists, sets and + dictionaries: 5cc. + +dictionary view + + The objects returned from *note dict.keys(): 7c8, *note + dict.values(): 7c9, and *note dict.items(): 7ca. are called + dictionary views. They provide a dynamic view on the dictionary’s + entries, which means that when the dictionary changes, the view + reflects these changes. To force the dictionary view to become a + full list use ‘list(dictview)’. See *note Dictionary view objects: + 2243. + +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__: 927. + 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 + + A programming style which does not look at an object’s type to + determine if it has the right interface; instead, the method or + attribute is simply called or used (“If it looks like a duck and + quacks like a duck, it must be a duck.”) By emphasizing interfaces + rather than specific types, well-designed code improves its + flexibility by allowing polymorphic substitution. Duck-typing + avoids tests using *note type(): d48. or *note isinstance(): 43d. + (Note, however, that duck-typing can be complemented with *note + abstract base classes: 11a8.) Instead, it typically employs *note + hasattr(): 4ce. tests or *note EAFP: 2b85. programming. + +dunder + + An informal short-hand for “double underscore”, used when talking + about a *note special method: 18ab. For example, ‘__init__’ is + often pronounced “dunder init”. + +EAFP + + Easier to ask for forgiveness than permission. This common Python + coding style assumes the existence of valid keys or attributes and + catches exceptions if the assumption proves false. This clean and + fast style is characterized by the presence of many *note try: 6e4. + and *note except: 18b. statements. The technique contrasts with + the *note LBYL: 51a7. style common to many other languages such as + C. + +expression + + A piece of syntax which can be evaluated to some value. In other + words, an expression is an accumulation of expression elements like + literals, names, attribute access, operators or function calls + which all return a value. In contrast to many other languages, not + all language constructs are expressions. There are also *note + statement: 278b.s which cannot be used as expressions, such as + *note while: 1c04. Assignments are also statements, not + expressions. + +extension module + + A module written in C or C++, using Python’s C API to interact with + the core and with user code. + +f-string + + String literals prefixed with ‘'f'’ or ‘'F'’ are commonly called + “f-strings” which is short for *note formatted string literals: + 9a9. See also PEP 498(16). + +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'. + + There are actually three categories of file objects: raw *note + binary files: 1c87, buffered *note binary files: 1c87. and *note + text files: 1c86. Their interfaces are defined in the *note io: + 7f. module. The canonical way to create a file object is by using + the *note open(): 517. function. + +file-like object + + A synonym for *note file object: 11b5. + +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. + + The filesystem encoding must guarantee to successfully decode all + bytes below 128. If the file system encoding fails to provide this + guarantee, API functions can raise *note UnicodeError: 1296. + + The *note sys.getfilesystemencoding(): c59. and *note + sys.getfilesystemencodeerrors(): ce6. functions can be used to get + the filesystem encoding and error handler. + + The *note filesystem encoding and error handler: 537. are + configured at Python startup by the *note PyConfig_Read(): 78b. + function: see *note filesystem_encoding: 3e4. and *note + filesystem_errors: 3e5. members of *note PyConfig: 3a2. + + See also the *note locale encoding: 244. + +finder + + An object that tries to find the *note loader: 16b0. for a module + that is being imported. + + There are two types of finder: *note meta path finders: 1069. for + use with *note sys.meta_path: d2b, and *note path entry finders: + 106a. for use with *note sys.path_hooks: 101d. + + See *note Finders and loaders: 1ff3. and *note importlib: 77. for + much more detail. + +floor division + + Mathematical division that rounds down to nearest integer. The + floor division operator is ‘//’. For example, the expression ‘11 + // 4’ evaluates to ‘2’ in contrast to the ‘2.75’ returned by float + true division. Note that ‘(-11) // 4’ is ‘-3’ because that is + ‘-2.75’ rounded 'downward'. See PEP 238(17). + +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: 148. which allows only one + thread to execute Python bytecode at a time. See PEP 703(18). + +free variable + + Formally, as defined in the *note language execution model: 1fd7, a + free variable is any variable used in a namespace which is not a + local variable in that namespace. See *note closure variable: + 1f3f. for an example. Pragmatically, due to the name of the *note + codeobject.co_freevars: 1efb. attribute, the term is also sometimes + used as a synonym for *note closure variable: 1f3f. + +function + + A series of statements which returns some value to a caller. It + can also be passed zero or more *note arguments: 444. which may be + used in the execution of the body. See also *note parameter: 1eff, + *note method: 1552, and the *note Function definitions: 1c36. + section. + +function annotation + + An *note annotation: 453. of a function parameter or return value. + + Function annotations are usually used for *note type hints: 1f81.: + for example, this function is expected to take two *note int: 259. + arguments and is also expected to have an *note int: 259. return + value: + + def sum_two_numbers(a: int, b: int) -> int: + return a + b + + Function annotation syntax is explained in section *note Function + definitions: 1c36. + + See *note variable annotation: d55. and PEP 484(19), which describe + this functionality. Also see *note Annotations Best Practices: + 7d4. for best practices on working with annotations. + +__future__ + + A *note future statement: 189, ‘from __future__ import ’, + directs the compiler to compile the current module using syntax or + semantics that will become standard in a future release of Python. + The *note __future__: 0. module documents the possible values of + 'feature'. By importing this module and evaluating its variables, + you can see when a new feature was first added to the language and + when it will (or did) become the default: + + >>> import __future__ + >>> __future__.division + _Feature((2, 2, 0, 'alpha', 2), (3, 0, 0, 'alpha', 0), 8192) + +garbage collection + + The process of freeing memory when it is not used anymore. Python + performs garbage collection via reference counting and a cyclic + garbage collector that is able to detect and break reference + cycles. The garbage collector can be controlled using the *note + gc: 60. module. + +generator + + A function which returns a *note generator iterator: bde. It looks + like a normal function except that it contains *note yield: 9cd. + expressions for producing a series of values usable in a for-loop + or that can be retrieved one at a time with the *note next(): 7d3. + function. + + Usually refers to a generator function, but may refer to a + 'generator iterator' in some contexts. In cases where the intended + meaning isn’t clear, using the full terms avoids ambiguity. + +generator iterator + + An object created by a *note generator: 105a. function. + + Each *note yield: 9cd. 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 + + An *note expression: 1f85. that returns an *note iterator: 1ac. It + looks like a normal expression followed by a ‘for’ clause defining + a loop variable, range, and an optional ‘if’ clause. The combined + expression generates values for an enclosing function: + + >>> sum(i*i for i in range(10)) # sum of squares 0, 1, 4, ... 81 + 285 + +generic function + + A function composed of multiple functions implementing the same + operation for different types. Which implementation should be used + during a call is determined by the dispatch algorithm. + + See also the *note single dispatch: 9f1. glossary entry, the *note + functools.singledispatch(): 635. decorator, and PEP 443(20). + +generic type + + A *note type: 1933. that can be parameterized; typically a *note + container class: 1f8a. such as *note list: 60d. or *note dict: 258. + Used for *note type hints: 1f81. and *note annotations: 453. + + For more details, see *note generic alias types: 6ae, PEP 483(21), + PEP 484(22), PEP 585(23), and the *note typing: 104. module. + +GIL + + See *note global interpreter lock: 148. + +global interpreter lock + + The mechanism used by the *note CPython: 6f1. interpreter to assure + that only one thread executes Python *note bytecode: 187. at a + time. This simplifies the CPython implementation by making the + object model (including critical built-in types such as *note dict: + 258.) implicitly safe against concurrent access. Locking the + entire interpreter makes it easier for the interpreter to be + multi-threaded, at the expense of much of the parallelism afforded + by multi-processor machines. + + However, some extension modules, either standard or third-party, + are designed so as to release the GIL when doing computationally + intensive tasks such as compression or hashing. Also, the GIL is + always released when doing I/O. + + As of Python 3.13, the GIL can be disabled using the *note + -disable-gil: 174. build configuration. After building Python with + this option, code must be run with *note -X gil=0: 176. or after + setting the *note PYTHON_GIL=0: 175. 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(24). + +hash-based pyc + + A bytecode cache file that uses the hash rather than the + last-modified time of the corresponding source file to determine + its validity. See *note Cached bytecode invalidation: 5e8. + +hashable + + An object is 'hashable' if it has a hash value which never changes + during its lifetime (it needs a *note __hash__(): afb. method), and + can be compared to other objects (it needs an *note __eq__(): afa. + method). Hashable objects which compare equal must have the same + hash value. + + Hashability makes an object usable as a dictionary key and a set + member, because these data structures use the hash value + internally. + + Most of Python’s immutable built-in objects are hashable; mutable + containers (such as lists or dictionaries) are not; immutable + containers (such as tuples and frozensets) are only hashable if + their elements are hashable. Objects which are instances of + user-defined classes are hashable by default. They all compare + unequal (except with themselves), and their hash value is derived + from their *note id(): 13ee. + +IDLE + + An Integrated Development and Learning Environment for Python. + *note IDLE — Python editor and shell: 100e. is a basic editor and + interpreter environment which ships with the standard distribution + of Python. + +immortal + + 'Immortal objects' are a CPython implementation detail introduced + in PEP 683(25). + + If an object is immortal, its *note reference count: 48e2. is never + modified, and therefore it is never deallocated while the + interpreter is running. For example, *note True: c0d. and *note + None: 671. are immortal in CPython. + +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. + +import path + + A list of locations (or *note path entries: 2004.) that are + searched by the *note path based finder: 1ff9. for modules to + import. During import, this list of locations usually comes from + *note sys.path: 3b0, but for subpackages it may also come from the + parent package’s ‘__path__’ attribute. + +importing + + The process by which Python code in one module is made available to + Python code in another module. + +importer + + An object that both finds and loads a module; both a *note finder: + 1f1e. and *note loader: 16b0. object. + +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 Interactive Mode: 16f. + +interpreted + + Python is an interpreted language, as opposed to a compiled one, + though the distinction can be blurry because of the presence of the + bytecode compiler. This means that source files can be run + directly without explicitly creating an executable which is then + run. Interpreted languages typically have a shorter + development/debug cycle than compiled ones, though their programs + generally also run more slowly. See also *note interactive: 169. + +interpreter shutdown + + When asked to shut down, the Python interpreter enters a special + phase where it gradually releases all allocated resources, such as + modules and various critical internal structures. It also makes + several calls to the *note garbage collector: 1919. This can + trigger the execution of code in user-defined destructors or + weakref callbacks. Code executed during the shutdown phase can + encounter various exceptions as the resources it relies on may not + function anymore (common examples are library modules or the + warnings machinery). + + The main reason for interpreter shutdown is that the ‘__main__’ + module or the script being run has finished executing. + +iterable + + An object capable of returning its members one at a time. Examples + of iterables include all sequence types (such as *note list: 60d, + *note str: 447, and *note tuple: 36b.) and some non-sequence types + like *note dict: 258, *note file objects: 11b5, and objects of any + classes you define with an *note __iter__(): 1f5c. method or with a + *note __getitem__(): 285. method that implements *note sequence: + 4ed. semantics. + + Iterables can be used in a *note for: 2ec. loop and in many other + places where a sequence is needed (*note zip(): 7cb, *note map(): + 860, …). When an iterable object is passed as an argument to the + built-in function *note iter(): 7d2, it returns an iterator for the + object. This iterator is good for one pass over the set of values. + When using iterables, it is usually not necessary to call *note + iter(): 7d2. or deal with iterator objects yourself. The *note + for: 2ec. statement does that automatically for you, creating a + temporary unnamed variable to hold the iterator for the duration of + the loop. See also *note iterator: 1ac, *note sequence: 4ed, and + *note generator: 105a. + +iterator + + An object representing a stream of data. Repeated calls to the + iterator’s *note __next__(): 12c0. method (or passing it to the + built-in function *note next(): 7d3.) return successive items in + the stream. When no more data are available a *note StopIteration: + bfa. exception is raised instead. At this point, the iterator + object is exhausted and any further calls to its ‘__next__()’ + method just raise *note StopIteration: bfa. again. Iterators are + required to have an *note __iter__(): 1cc4. method that returns the + iterator object itself so every iterator is also iterable and may + be used in most places where other iterables are accepted. One + notable exception is code which attempts multiple iteration passes. + A container object (such as a *note list: 60d.) produces a fresh + new iterator each time you pass it to the *note iter(): 7d2. + function or use it in a *note for: 2ec. loop. Attempting this with + an iterator will just return the same exhausted iterator object + used in the previous iteration pass, making it appear like an empty + container. + + More information can be found in *note Iterator Types: 2175. + + 'CPython implementation detail:' CPython does not consistently + apply the requirement that an iterator define *note __iter__(): + 1cc4. And also please note that the free-threading CPython does + not guarantee the thread-safety of iterator operations. + +key function + + A key function or collation function is a callable that returns a + value used for sorting or ordering. For example, *note + locale.strxfrm(): 3d44. is used to produce a sort key that is aware + of locale specific sort conventions. + + A number of tools in Python accept key functions to control how + elements are ordered or grouped. They include *note min(): f03, + *note max(): f04, *note sorted(): bce, *note list.sort(): bcf, + *note heapq.merge(): e03, *note heapq.nsmallest(): 253c, *note + heapq.nlargest(): 253b, and *note itertools.groupby(): 2735. + + There are several ways to create a key function. For example. the + *note str.lower(): 17ec. method can serve as a key function for + case insensitive sorts. Alternatively, a key function can be built + from a *note lambda: 128f. expression such as ‘lambda r: (r[0], + r[2])’. Also, *note operator.attrgetter(): e32, *note + operator.itemgetter(): a61, and *note operator.methodcaller(): e33. + are three key function constructors. See the *note Sorting HOW TO: + 217e. for examples of how to create and use key functions. + +keyword argument + + See *note argument: 444. + +lambda + + An anonymous inline function consisting of a single *note + expression: 1f85. which is evaluated when the function is called. + The syntax to create a lambda function is ‘lambda [parameters]: + expression’ + +LBYL + + Look before you leap. This coding style explicitly tests for + pre-conditions before making calls or lookups. This style + contrasts with the *note EAFP: 2b85. approach and is characterized + by the presence of many *note if: 2ed. statements. + + In a multi-threaded environment, the LBYL approach can risk + introducing a race condition 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 locks or by using the EAFP approach. + +lexical analyzer + + Formal name for the 'tokenizer'; see *note token: 1e7d. + +list + + A built-in Python *note sequence: 4ed. 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 + + A compact way to process all or part of the elements in a sequence + and return a list with the results. ‘result = ['{:#04x}'.format(x) + for x in range(256) if x % 2 == 0]’ generates a list of strings + containing even hex numbers (0x..) in the range from 0 to 255. + The *note if: 2ed. clause is optional. If omitted, all elements in + ‘range(256)’ are processed. + +loader + + An object that loads a module. It must define the ‘exec_module()’ + and ‘create_module()’ methods to implement the *note Loader: ec0. + interface. A loader is typically returned by a *note finder: 1f1e. + See also: + + * *note Finders and loaders: 1ff3. + + * *note importlib.abc.Loader: ec0. + + * PEP 302(26) + +locale encoding + + On Unix, it is the encoding of the LC_CTYPE locale. It can be set + with *note locale.setlocale(locale.LC_CTYPE, new_locale): 2df. + + 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(): 2e0. can be used to get the locale + encoding. + + See also the *note filesystem encoding and error handler: 537. + +magic method + + An informal synonym for *note special method: 18ab. + +mapping + + A container object that supports arbitrary key lookups and + implements the methods specified in the *note + collections.abc.Mapping: 8c9. or *note + collections.abc.MutableMapping: 10a2. *note abstract base classes: + 875. Examples include *note dict: 258, *note + collections.defaultdict: 11af, *note collections.OrderedDict: 5d7. + and *note collections.Counter: 108b. + +meta path finder + + A *note finder: 1f1e. returned by a search of *note sys.meta_path: + d2b. Meta path finders are related to, but different from *note + path entry finders: 106a. + + See *note importlib.abc.MetaPathFinder: 86b. for the methods that + meta path finders implement. + +metaclass + + The class of a class. Class definitions create a class name, a + class dictionary, and a list of base classes. The metaclass is + responsible for taking those three arguments and creating the + class. Most object oriented programming languages provide a + default implementation. What makes Python special is that it is + possible to create custom metaclasses. Most users never need this + tool, but when the need arises, metaclasses can provide powerful, + elegant solutions. They have been used for logging attribute + access, adding thread-safety, tracking object creation, + implementing singletons, and many other tasks. + + More information can be found in *note Metaclasses: 1f73. + +method + + A function which is defined inside a class body. If called as an + attribute of an instance of that class, the method will get the + instance object as its first *note argument: 444. (which is usually + called ‘self’). See *note function: 2059. and *note nested scope: + 1f3e. + +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: 1473. for details of the algorithm used by + the Python interpreter since the 2.3 release. + +module + + An object that serves as an organizational unit of Python code. + Modules have a namespace containing arbitrary Python objects. + Modules are loaded into Python by the process of *note importing: + 1fe9. + + See also *note package: 1f1a. + +module spec + + A namespace containing the import-related information used to load + a module. An instance of *note importlib.machinery.ModuleSpec: + 1e64. + + See also *note Module specs: 1f19. + +MRO + + See *note method resolution order: 2180. + +mutable + + Mutable objects can change their value but keep their *note id(): + 13ee. See also *note immutable: 1bfb. + +named tuple + + The term “named tuple” applies to any type or class that inherits + from tuple and whose indexable elements are also accessible using + named attributes. The type or class may have other features as + well. + + Several built-in types are named tuples, including the values + returned by *note time.localtime(): 14c4. and *note os.stat(): 49c. + Another example is *note sys.float_info: 19ea.: + + >>> 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: 36b. and that defines + named fields. Such a class can be written by hand, or it can be + created by inheriting *note typing.NamedTuple: 2b2, or with the + factory function *note collections.namedtuple(): 1ca. The latter + techniques also add some extra methods that may not be found in + hand-written or built-in named tuples. + +namespace + + The place where a variable is stored. Namespaces are implemented + as dictionaries. There are the local, global and built-in + namespaces as well as nested namespaces in objects (in methods). + Namespaces support modularity by preventing naming conflicts. For + instance, the functions *note builtins.open: 517. and *note + os.open(): d91. are distinguished by their namespaces. Namespaces + also aid readability and maintainability by making it clear which + module implements a function. For instance, writing *note + random.seed(): 1267. or *note itertools.islice(): b4c. makes it + clear that those functions are implemented by the *note random: b8. + and *note itertools: 81. modules, respectively. + +namespace package + + A *note package: 1f1a. which serves only as a container for + subpackages. Namespace packages may have no physical + representation, and specifically are not like a *note regular + package: 1fed. 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: 1fed. + + For more information, see PEP 420(27) and *note Namespace packages: + 1fef. + + See also *note module: 165f. + +nested scope + + The ability to refer to a variable in an enclosing definition. For + instance, a function defined inside another function can refer to + variables in the outer function. Note that nested scopes by + default work only for reference and not for assignment. Local + variables both read and write in the innermost scope. Likewise, + global variables read and write to the global namespace. The *note + nonlocal: 129a. allows writing to outer scopes. + +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__: 14b5, + descriptors, properties, *note __getattribute__(): bd2, class + methods, and static methods. + +object + + Any data with state (attributes or value) and defined behavior + (methods). Also the ultimate base class of any *note new-style + class: 2890. + +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. + +package + + A Python *note module: 165f. which can contain submodules or + recursively, subpackages. Technically, a package is a Python + module with a ‘__path__’ attribute. + + See also *note regular package: 1fed. and *note namespace package: + 1c68. + +parameter + + A named entity in a *note function: 2059. (or method) definition + that specifies an *note argument: 444. (or in some cases, + arguments) that the function can accept. There are five kinds of + parameter: + + * 'positional-or-keyword': specifies an argument that can be + passed either *note positionally: 444. or as a *note keyword + argument: 444. This is the default kind of parameter, for + example 'foo' and 'bar' in the following: + + def func(foo, bar=None): ... + + * 'positional-only': specifies an argument that can be supplied + only by position. Positional-only parameters can be defined + by including a ‘/’ character in the parameter list of the + function definition after them, for example 'posonly1' and + 'posonly2' in the following: + + def func(posonly1, posonly2, /, positional_or_keyword): ... + + * 'keyword-only': specifies an argument that can be supplied + only by keyword. Keyword-only parameters can be defined by + including a single var-positional parameter or bare ‘*’ in the + parameter list of the function definition before them, for + example 'kw_only1' and 'kw_only2' in the following: + + def func(arg, *, kw_only1, kw_only2): ... + + * 'var-positional': specifies that an arbitrary sequence of + positional arguments can be provided (in addition to any + positional arguments already accepted by other parameters). + Such a parameter can be defined by prepending the parameter + name with ‘*’, for example 'args' in the following: + + def func(*args, **kwargs): ... + + * 'var-keyword': specifies that arbitrarily many keyword + arguments can be provided (in addition to any keyword + arguments already accepted by other parameters). Such a + parameter can be defined by prepending the parameter name with + ‘**’, for example 'kwargs' in the example above. + + Parameters can specify both optional and required arguments, as + well as default values for some optional arguments. + + See also the *note argument: 444. glossary entry, the FAQ question + on *note the difference between arguments and parameters: 50e4, the + *note inspect.Parameter: 1d0. class, the *note Function + definitions: 1c36. section, and PEP 362(28). + +path entry + + A single location on the *note import path: 1ff6. which the *note + path based finder: 1ff9. consults to find modules for importing. + +path entry finder + + A *note finder: 1f1e. returned by a callable on *note + sys.path_hooks: 101d. (i.e. a *note path entry hook: 2006.) which + knows how to locate modules given a *note path entry: 2004. + + See *note importlib.abc.PathEntryFinder: 86c. for the methods that + path entry finders implement. + +path entry hook + + A callable on the *note sys.path_hooks: 101d. list which returns a + *note path entry finder: 106a. if it knows how to find modules on a + specific *note path entry: 2004. + +path based finder + + One of the default *note meta path finders: 1069. which searches an + *note import path: 1ff6. for modules. + +path-like object + + An object representing a file system path. A path-like object is + either a *note str: 447. or *note bytes: 1c2. object representing a + path, or an object implementing the *note os.PathLike: c51. + protocol. An object that supports the *note os.PathLike: c51. + protocol can be converted to a *note str: 447. or *note bytes: 1c2. + file system path by calling the *note os.fspath(): c53. function; + *note os.fsdecode(): c54. and *note os.fsencode(): c55. can be used + to guarantee a *note str: 447. or *note bytes: 1c2. result instead, + respectively. Introduced by PEP 519(29). + +PEP + + Python Enhancement Proposal. A PEP is a design document providing + information to the Python community, or describing a new feature + for Python or its processes or environment. PEPs should provide a + concise technical specification and a rationale for proposed + features. + + PEPs are intended to be the primary mechanisms for proposing major + new features, for collecting community input on an issue, and for + documenting the design decisions that have gone into Python. The + PEP author is responsible for building consensus within the + community and documenting dissenting opinions. + + See PEP 1(30). + +portion + + A set of files in a single directory (possibly stored in a zip + file) that contribute to a namespace package, as defined in PEP + 420(31). + +positional argument + + See *note argument: 444. + +provisional API + + A provisional API is one which has been deliberately excluded from + the standard library’s backwards compatibility guarantees. While + major changes to such interfaces are not expected, as long as they + are marked provisional, backwards incompatible changes (up to and + including removal of the interface) may occur if deemed necessary + by core developers. Such changes will not be made gratuitously – + they will occur only if serious fundamental flaws are uncovered + that were missed prior to the inclusion of the API. + + Even for provisional APIs, backwards incompatible changes are seen + as a “solution of last resort” - every attempt will still be made + to find a backwards compatible resolution to any identified + problems. + + This process allows the standard library to continue to evolve over + time, without locking in problematic design errors for extended + periods of time. See PEP 411(32) for more details. + +provisional package + + See *note provisional API: b03. + +Python 3000 + + Nickname for the Python 3.x release line (coined long ago when the + release of version 3 was something in the distant future.) This is + also abbreviated “Py3k”. + +Pythonic + + An idea or piece of code which closely follows the most common + idioms of the Python language, rather than implementing code using + concepts common to other languages. For example, a common idiom in + Python is to loop over all elements of an iterable using a *note + for: 2ec. statement. Many other languages don’t have this type of + construct, so people unfamiliar with Python sometimes use a + numerical counter instead: + + for i in range(len(food)): + print(food[i]) + + As opposed to the cleaner, Pythonic method: + + for piece in food: + print(piece) + +qualified name + + A dotted name showing the “path” from a module’s global scope to a + class, function or method defined in that module, as defined in PEP + 3155(33). For top-level functions and classes, the qualified name + is the same as the object’s name: + + >>> class C: + ... class D: + ... def meth(self): + ... pass + ... + >>> C.__qualname__ + 'C' + >>> C.D.__qualname__ + 'C.D' + >>> C.D.meth.__qualname__ + 'C.D.meth' + + When used to refer to modules, the 'fully qualified name' means the + entire dotted path to the module, including any parent packages, + e.g. ‘email.mime.text’: + + >>> import email.mime.text + >>> email.mime.text.__name__ + 'email.mime.text' + +reference count + + The number of references to an object. When the reference count of + an object drops to zero, it is deallocated. Some objects are *note + immortal: 4394. and have reference counts that are never modified, + and therefore the objects are never deallocated. Reference + counting is generally not visible to Python code, but it is a key + element of the *note CPython: 6f1. implementation. Programmers can + call the *note sys.getrefcount(): 4393. function to return the + reference count for a particular object. + + In *note CPython: 6f1, 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 + + A traditional *note package: 1f1a, such as a directory containing + an ‘__init__.py’ file. + + See also *note namespace package: 1c68. + +REPL + + An acronym for the “read–eval–print loop”, another name for the + *note interactive: 169. interpreter shell. + +__slots__ + + A declaration inside a class that saves memory by pre-declaring + space for instance attributes and eliminating instance + dictionaries. Though popular, the technique is somewhat tricky to + get right and is best reserved for rare cases where there are large + numbers of instances in a memory-critical application. + +sequence + + An *note iterable: 121a. which supports efficient element access + using integer indices via the *note __getitem__(): 285. special + method and defines a *note __len__(): 1f63. method that returns the + length of the sequence. Some built-in sequence types are *note + list: 60d, *note str: 447, *note tuple: 36b, and *note bytes: 1c2. + Note that *note dict: 258. also supports *note __getitem__(): 285. + and ‘__len__()’, but is considered a mapping rather than a sequence + because the lookups use arbitrary *note hashable: 60c. keys rather + than integers. + + The *note collections.abc.Sequence: 11b6. abstract base class + defines a much richer interface that goes beyond just *note + __getitem__(): 285. and *note __len__(): 1f63, adding ‘count()’, + ‘index()’, *note __contains__(): 1f5e, and *note __reversed__(): + 1f5d. Types that implement this expanded interface can be + registered explicitly using *note register(): 1082. For more + documentation on sequence methods generally, see *note Common + Sequence Operations: 21a9. + +set comprehension + + A compact way to process all or part of the elements in an iterable + and return a set with the results. ‘results = {c for c in + 'abracadabra' if c not in 'abc'}’ generates the set of strings + ‘{'r', 'd'}’. See *note Displays for lists, sets and dictionaries: + 5cc. + +single dispatch + + A form of *note generic function: 9f0. dispatch where the + implementation is chosen based on the type of a single argument. + +slice + + An object usually containing a portion of a *note sequence: 4ed. A + slice is created using the subscript notation, ‘[]’ with colons + between numbers when several are given, such as in + ‘variable_name[1:3:5]’. The bracket (subscript) notation uses + *note slice: 465. objects internally. + +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(34). + +special method + + A method that is called implicitly by Python to execute a certain + operation on a type, such as addition. Such methods have names + starting and ending with double underscores. Special methods are + documented in *note Special method names: c6e. + +standard library + + The collection of *note packages: 1f1a, *note modules: 165f. and + *note extension modules: 45ac. 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 The Python + Standard Library: 144. + + See also *note sys.stdlib_module_names: 83d. for a list of all + possible standard library module names. + +statement + + A statement is part of a suite (a “block” of code). A statement is + either an *note expression: 1f85. or one of several constructs with + a keyword, such as *note if: 2ed, *note while: 1c04. or *note for: + 2ec. + +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: + 1f81. and the *note typing: 104. module. + +stdlib + + An abbreviation of *note standard library: 51b3. + +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(): 56b. when the + reference is created and released with *note Py_DECREF(): 56c. when + the reference is deleted. + + The *note Py_NewRef(): 898. function can be used to create a strong + reference to an object. Usually, the *note Py_DECREF(): 56c. + 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: 339. + +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: + db8, which are collectively referred to as “text encodings”. + +text file + + A *note file object: 11b5. able to read and write *note str: 447. + objects. Often, a text file actually accesses a byte-oriented + datastream and handles the *note text encoding: 217a. + automatically. Examples of text files are files opened in text + mode (‘'r'’ or ‘'w'’), *note sys.stdin: 539, *note sys.stdout: ad6, + and instances of *note io.StringIO: f22. + + See also *note binary file: 1c87. for a file object able to read + and write *note bytes-like objects: d2d. + +token + + A small unit of source code, generated by the *note lexical + analyzer: 1e7b. (also called the 'tokenizer'). Names, numbers, + strings, operators, newlines and similar are represented by tokens. + + The *note tokenize: fb. module exposes Python’s lexical analyzer. + The *note token: fa. module contains information on the various + types of tokens. + +triple-quoted string + + A string which is bound by three instances of either a quotation + mark (”) or an apostrophe (‘). While they don’t provide any + functionality not available with single-quoted strings, they are + useful for a number of reasons. They allow you to include + unescaped single and double quotes within a string and they can + span multiple lines without the use of the continuation character, + making them especially useful when writing docstrings. + +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__: 1476. attribute or can be retrieved with + ‘type(obj)’. + +type alias + + A synonym for a type, created by assigning the type to an + identifier. + + Type aliases are useful for simplifying *note type hints: 1f81. + For example: + + def remove_gray_shades( + colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]: + pass + + could be made more readable like this: + + Color = tuple[int, int, int] + + def remove_gray_shades(colors: list[Color]) -> list[Color]: + pass + + See *note typing: 104. and PEP 484(35), which describe this + functionality. + +type hint + + An *note annotation: 453. that specifies the expected type for a + variable, a class attribute, or a function parameter or return + value. + + Type hints are optional and are not enforced by Python but they are + useful to *note static type checkers: 26f. They can also aid IDEs + with code completion and refactoring. + + Type hints of global variables, class attributes, and functions, + but not local variables, can be accessed using *note + typing.get_type_hints(): 6ad. + + See *note typing: 104. and PEP 484(36), which describe this + functionality. + +universal newlines + + A manner of interpreting text streams in which all of the following + are recognized as ending a line: the Unix end-of-line convention + ‘'\n'’, the Windows convention ‘'\r\n'’, and the old Macintosh + convention ‘'\r'’. See PEP 278(37) and PEP 3116(38), as well as + *note bytes.splitlines(): 2215. for an additional use. + +variable annotation + + An *note annotation: 453. of a variable or a class attribute. + + When annotating a variable or a class attribute, assignment is + optional: + + class C: + field: 'annotation' + + Variable annotations are usually used for *note type hints: 1f81.: + for example this variable is expected to take *note int: 259. + values: + + count: int = 0 + + Variable annotation syntax is explained in section *note Annotated + assignment statements: 20af. + + See *note function annotation: 1c37, PEP 484(39) and PEP 526(40), + which describe this functionality. Also see *note Annotations Best + Practices: 7d4. for best practices on working with annotations. + +virtual environment + + A cooperatively isolated runtime environment that allows Python + users and applications to install and upgrade Python distribution + packages without interfering with the behaviour of other Python + applications running on the same system. + + See also *note venv: 111. + +virtual machine + + A computer defined entirely in software. Python’s virtual machine + executes the *note bytecode: 187. emitted by the bytecode compiler. + +walrus operator + + A light-hearted way to refer to the *note assignment expression: + 2081. operator ‘:=’ because it looks a bit like a walrus if you + turn your head. + +Zen of Python + + Listing of Python design principles and philosophies that are + helpful in understanding and using the language. The listing can + be found by typing “‘import this’” at the interactive prompt. + + ---------- Footnotes ---------- + + (1) https://peps.python.org/pep-0484/ + + (2) https://peps.python.org/pep-0526/ + + (3) https://peps.python.org/pep-0362/ + + (4) https://peps.python.org/pep-0492/ + + (5) https://peps.python.org/pep-0492/ + + (6) https://peps.python.org/pep-0525/ + + (7) https://peps.python.org/pep-0492/ + + (8) https://peps.python.org/pep-0492/ + + (9) https://peps.python.org/pep-0492/ + + (10) https://gvanrossum.github.io/ + + (11) https://peps.python.org/pep-0343/ + + (12) https://peps.python.org/pep-0343/ + + (13) https://peps.python.org/pep-0492/ + + (14) https://peps.python.org/pep-0492/ + + (15) https://www.python.org + + (16) https://peps.python.org/pep-0498/ + + (17) https://peps.python.org/pep-0238/ + + (18) https://peps.python.org/pep-0703/ + + (19) https://peps.python.org/pep-0484/ + + (20) https://peps.python.org/pep-0443/ + + (21) https://peps.python.org/pep-0483/ + + (22) https://peps.python.org/pep-0484/ + + (23) https://peps.python.org/pep-0585/ + + (24) https://peps.python.org/pep-0703/ + + (25) https://peps.python.org/pep-0683/ + + (26) https://peps.python.org/pep-0302/ + + (27) https://peps.python.org/pep-0420/ + + (28) https://peps.python.org/pep-0362/ + + (29) https://peps.python.org/pep-0519/ + + (30) https://peps.python.org/pep-0001/ + + (31) https://peps.python.org/pep-0420/ + + (32) https://peps.python.org/pep-0411/ + + (33) https://peps.python.org/pep-3155/ + + (34) https://peps.python.org/pep-0387/#soft-deprecation + + (35) https://peps.python.org/pep-0484/ + + (36) https://peps.python.org/pep-0484/ + + (37) https://peps.python.org/pep-0278/ + + (38) https://peps.python.org/pep-3116/ + + (39) https://peps.python.org/pep-0484/ + + (40) https://peps.python.org/pep-0526/ + + +File: python.info, Node: About this documentation, Next: Dealing with Bugs, Prev: Glossary, Up: Top + +13 About this documentation +*************************** + +Python’s documentation is generated from reStructuredText(1) sources +using Sphinx(2), a documentation generator originally created for Python +and now maintained as an independent project. + +Development of the documentation and its toolchain is an entirely +volunteer effort, just like Python itself. If you want to contribute, +please take a look at the *note Dealing with Bugs: 4931. page for +information on how to do so. New volunteers are always welcome! + +Many thanks go to: + + * Fred L. Drake, Jr., the creator of the original Python + documentation toolset and author of much of the content; + + * the Docutils(3) project for creating reStructuredText and the + Docutils suite; + + * Fredrik Lundh for his Alternative Python Reference project from + which Sphinx got many good ideas. + +* Menu: + +* Contributors to the Python documentation:: + + ---------- Footnotes ---------- + + (1) https://docutils.sourceforge.io/rst.html + + (2) https://www.sphinx-doc.org/ + + (3) https://docutils.sourceforge.io/ + + +File: python.info, Node: Contributors to the Python documentation, Up: About this documentation + +13.1 Contributors to the Python documentation +============================================= + +Many people have contributed to the Python language, the Python standard +library, and the Python documentation. See Misc/ACKS(1) in the Python +source distribution for a partial list of contributors. + +It is only with the input and contributions of the Python community that +Python has such wonderful documentation – Thank You! + + ---------- Footnotes ---------- + + (1) https://github.com/python/cpython/tree/3.13/Misc/ACKS + + +File: python.info, Node: Dealing with Bugs, Next: Copyright, Prev: About this documentation, Up: Top + +14 Dealing with Bugs +******************** + +Python is a mature programming language which has established a +reputation for stability. In order to maintain this reputation, the +developers would like to know of any deficiencies you find in Python. + +It can be sometimes faster to fix bugs yourself and contribute patches +to Python as it streamlines the process and involves less people. Learn +how to *note contribute: 51bd. + +* Menu: + +* Documentation bugs:: +* Using the Python issue tracker:: +* Getting started contributing to Python yourself:: + + +File: python.info, Node: Documentation bugs, Next: Using the Python issue tracker, Up: Dealing with Bugs + +14.1 Documentation bugs +======================= + +If you find a bug in this documentation or would like to propose an +improvement, please submit a bug report on the *note tracker: 250. If +you have a suggestion on how to fix it, include that as well. + +You can also open a discussion item on our Documentation Discourse +forum(1). + +If you find a bug in the theme (HTML / CSS / JavaScript) of the +documentation, please submit a bug report on the python-doc-theme bug +tracker(2). + +If you’re short on time, you can also email documentation bug reports to + (behavioral bugs can be sent to +). ‘docs@’ is a mailing list run by volunteers; +your request will be noticed, though it may take a while to be +processed. + +See also +........ + +Documentation bugs(3) + + A list of documentation bugs that have been submitted to the Python + issue tracker. + +Issue Tracking(4) + + Overview of the process involved in reporting an improvement on the + tracker. + +Helping with Documentation(5) + + Comprehensive guide for individuals that are interested in + contributing to Python documentation. + +Documentation Translations(6) + + A list of GitHub pages for documentation translation and their + primary contacts. + + ---------- Footnotes ---------- + + (1) https://discuss.python.org/c/documentation/26 + + (2) https://github.com/python/python-docs-theme + + (3) +https://github.com/python/cpython/issues?q=is%3Aissue+is%3Aopen+label%3Adocs + + (4) https://devguide.python.org/tracker/ + + (5) +https://devguide.python.org/docquality/#helping-with-documentation + + (6) https://devguide.python.org/documentation/translating/ + + +File: python.info, Node: Using the Python issue tracker, Next: Getting started contributing to Python yourself, Prev: Documentation bugs, Up: Dealing with Bugs + +14.2 Using the Python issue tracker +=================================== + +Issue reports for Python itself should be submitted via the GitHub +issues tracker (‘https://github.com/python/cpython/issues’). The GitHub +issues tracker offers a web form which allows pertinent information to +be entered and submitted to the developers. + +The first step in filing a report is to determine whether the problem +has already been reported. The advantage in doing so, aside from saving +the developers’ time, is that you learn what has been done to fix it; it +may be that the problem has already been fixed for the next release, or +additional information is needed (in which case you are welcome to +provide it if you can!). To do this, search the tracker using the +search box at the top of the page. + +If the problem you’re reporting is not already in the list, log in to +GitHub. If you don’t already have a GitHub account, create a new +account using the “Sign up” link. It is not possible to submit a bug +report anonymously. + +Being now logged in, you can submit an issue. Click on the “New issue” +button in the top bar to report a new issue. + +The submission form has two fields, “Title” and “Comment”. + +For the “Title” field, enter a 'very' short description of the problem; +fewer than ten words is good. + +In the “Comment” field, describe the problem in detail, including what +you expected to happen and what did happen. Be sure to include whether +any extension modules were involved, and what hardware and software +platform you were using (including version information as appropriate). + +Each issue report will be reviewed by a developer who will determine +what needs to be done to correct the problem. You will receive an +update each time an action is taken on the issue. + +See also +........ + +How to Report Bugs Effectively(1) + + Article which goes into some detail about how to create a useful + bug report. This describes what kind of information is useful and + why it is useful. + +Bug Writing Guidelines(2) + + Information about writing a good bug report. Some of this is + specific to the Mozilla project, but describes general good + practices. + + ---------- Footnotes ---------- + + (1) https://www.chiark.greenend.org.uk/~sgtatham/bugs.html + + (2) https://bugzilla.mozilla.org/page.cgi?id=bug-writing.html + + +File: python.info, Node: Getting started contributing to Python yourself, Prev: Using the Python issue tracker, Up: Dealing with Bugs + +14.3 Getting started contributing to Python yourself +==================================================== + +Beyond just reporting bugs that you find, you are also welcome to submit +patches to fix them. You can find more information on how to get +started patching Python in the Python Developer's Guide(1). If you have +questions, the core-mentorship mailing list(2) is a friendly place to +get answers to any and all questions pertaining to the process of fixing +issues in Python. + + ---------- Footnotes ---------- + + (1) https://devguide.python.org/ + + (2) +https://mail.python.org/mailman3/lists/core-mentorship.python.org/ + + +File: python.info, Node: Copyright, Next: History and License, Prev: Dealing with Bugs, Up: Top + +15 Copyright +************ + +Python and this documentation is: + +Copyright © 2001-2024 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. + +__________________________________________________________________ + +See *note History and License: 51c3. for complete license and +permissions information. + + +File: python.info, Node: History and License, Next: Python Module Index, Prev: Copyright, Up: Top + +16 History and License +********************** + +* Menu: + +* History of the software:: +* Terms and conditions for accessing or otherwise using Python:: +* Licenses and Acknowledgements for Incorporated Software:: + + +File: python.info, Node: History of the software, Next: Terms and conditions for accessing or otherwise using Python, Up: History and License + +16.1 History of the software +============================ + +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. + +Release Derived from Year Owner GPL-compatible? (1) + +---------------------------------------------------------------------------------------------------- + +0.9.0 thru 1.2 n/a 1991-1995 CWI yes + + +1.3 thru 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 and above 2.1.1 2001-now PSF yes + + + Note: + 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. + +Thanks to the many outside volunteers who have worked under Guido’s +direction to make these releases possible. + + +File: python.info, Node: Terms and conditions for accessing or otherwise using Python, Next: Licenses and Acknowledgements for Incorporated Software, Prev: History of the software, Up: History and License + +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: 51c8. + +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: 51c9. 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-2024 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: History and License + +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:: +* Sockets: Sockets<2>. +* Asynchronous socket services:: +* Cookie management:: +* Execution tracing:: +* UUencode and UUdecode functions:: +* XML Remote Procedure Calls:: +* test_epoll:: +* Select kqueue:: +* SipHash24:: +* strtod and dtoa:: +* OpenSSL: OpenSSL<2>. +* expat:: +* libffi:: +* zlib: zlib<3>. +* cfuhash:: +* libmpdec:: +* W3C C14N test suite:: +* mimalloc:: +* asyncio: asyncio<12>. +* Global Unbounded Sequences (GUS): Global Unbounded Sequences GUS. + + +File: python.info, Node: Mersenne Twister, Next: Sockets<2>, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.1 Mersenne Twister +----------------------- + +The ‘_random’ C extension underlying the *note random: b8. 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: Sockets<2>, Next: Asynchronous socket services, Prev: Mersenne Twister, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.2 Sockets +-------------- + +The *note socket: cc. 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: Sockets<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: 71. module contains the following notice: + + Copyright 2000 by Timothy O'Malley + + 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: fd. 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: 12e. 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 +-------------------- + +The *note select: c1. module contains the following notice for the +kqueue interface: + + 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 and 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: + + + Copyright (c) 2013 Marek Majkowski + + 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. + + + 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 and dtoa, Next: OpenSSL<2>, Prev: SipHash24, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.11 strtod and 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 and dtoa, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.12 OpenSSL +--------------- + +The modules *note hashlib: 68, *note posix: ad. and *note ssl: d0. 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: 126. extension is built using an included copy of the +expat sources unless the build is configured ‘--with-system-expat’: + + Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + and Clark Cooper + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + +File: python.info, Node: libffi, Next: zlib<3>, Prev: expat, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.14 libffi +-------------- + +The ‘_ctypes’ C extension underlying the *note ctypes: 2a. 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<3>, Next: cfuhash, Prev: libffi, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.15 zlib +------------ + +The *note zlib: 133. 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<3>, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.16 cfuhash +--------------- + +The implementation of the hash table used by the *note tracemalloc: ff. +is based on the cfuhash project: + + 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: 36. 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: e2. 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<12>, 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<12>, Next: Global Unbounded Sequences GUS, Prev: mimalloc, Up: Licenses and Acknowledgements for Incorporated Software + +16.3.20 asyncio +--------------- + +Parts of the *note asyncio: a. 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, Prev: asyncio<12>, 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 + + 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: Python Module Index, Next: Index, Prev: History and License, Up: Top + +Python Module Index +******************* + +* 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. +* argparse: 6. Command-line option and argument parsing library. +* array: 7. Space efficient arrays of uniformly typed numeric + values. +* ast: 8. Abstract Syntax Tree classes and manipulation. +* asynchat: 9. Removed in 3.12. +* asyncio: a. Asynchronous I/O. +* asyncore: b. Removed in 3.12. +* atexit: c. Register and execute cleanup functions. +* audioop: d. Removed in 3.13. +* base64: e. RFC 4648: Base16, Base32, Base64 Data + Encodings; Base85 and Ascii85 +* bdb: f. Debugger framework. +* binascii: 10. Tools for converting between binary and various ASCII- + encoded binary representations. +* bisect: 11. Array bisection algorithms for binary searching. +* builtins: 12. The module that provides the built-in namespace. +* bz2: 13. Interfaces for bzip2 compression and decompression. +* calendar: 14. Functions for working with calendars, including + some emulation of the Unix cal program. +* cgi: 15. Removed in 3.13. +* cgitb: 16. Removed in 3.13. +* chunk: 17. Removed in 3.13. +* cmath: 18. Mathematical functions for complex numbers. +* cmd: 19. Build line-oriented command interpreters. +* code: 1a. Facilities to implement read-eval-print loops. +* codecs: 1b. Encode and decode data and streams. +* codeop: 1c. Compile (possibly incomplete) Python code. +* collections: 1d. Container datatypes +* collections.abc: 1e. Abstract base classes for containers +* colorsys: 1f. Conversion functions between RGB and other color + systems. +* compileall: 20. Tools for byte-compiling all Python source files in a + directory tree. +* concurrent.futures: 21. Execute computations concurrently using threads or + processes. +* configparser: 22. Configuration file parser. +* contextlib: 23. Utilities for with-statement contexts. +* contextvars: 24. Context Variables +* copy: 25. Shallow and deep copy operations. +* copyreg: 26. Register pickle support functions. +* cProfile: 27. +* crypt: 28. Removed in 3.13. +* csv: 29. Write and read tabular data to and from delimited + files. +* ctypes: 2a. A foreign function library for Python. +* curses: 2b. An interface to the curses library, providing + portable terminal handling. +* curses.ascii: 2c. Constants and set-membership functions for ASCII + characters. +* curses.panel: 2d. A panel stack extension that adds depth to curses + windows. +* curses.textpad: 2e. Emacs-like input editing in a curses window. +* dataclasses: 2f. Generate special methods on user-defined classes. +* datetime: 30. Basic date and time types. +* dbm: 31. Interfaces to various Unix "database" formats. +* dbm.dumb: 32. Portable implementation of the simple DBM interface. +* dbm.gnu: 33. GNU database manager +* dbm.ndbm: 34. The New Database Manager +* dbm.sqlite3: 35. SQLite backend for dbm +* decimal: 36. Implementation of the General Decimal Arithmetic + Specification. +* difflib: 37. Helpers for computing differences between objects. +* dis: 38. Disassembler for Python bytecode. +* distutils: 39. Removed in 3.12. +* doctest: 3a. Test pieces of code within docstrings. +* email: 3b. Package supporting the parsing, + manipulating, and generating email messages. +* email.charset: 3c. Character Sets +* email.contentmanager: 3d. Storing and Retrieving Content from MIME Parts +* email.encoders: 3e. Encoders for email message payloads. +* email.errors: 3f. The exception classes used by the email package. +* email.generator: 40. Generate flat text email messages from a message + structure. +* email.header: 41. Representing non-ASCII headers +* email.headerregistry: 42. Automatic Parsing of headers based on the field name +* email.iterators: 43. Iterate over a message object tree. +* email.message: 44. The base class representing email messages. +* email.mime: 45. Build MIME messages. +* email.mime.application: 46. +* email.mime.audio: 47. +* email.mime.base: 48. +* email.mime.image: 49. +* email.mime.message: 4a. +* email.mime.multipart: 4b. +* email.mime.nonmultipart: 4c. +* email.mime.text: 4d. +* email.parser: 4e. Parse flat text email messages to produce a message + object structure. +* email.policy: 4f. Controlling the parsing and generating of messages +* email.utils: 50. Miscellaneous email package utilities. +* encodings: 51. Encodings package +* encodings.idna: 52. Internationalized Domain Names implementation +* encodings.mbcs: 53. Windows ANSI codepage +* encodings.utf_8_sig: 54. UTF-8 codec with BOM signature +* ensurepip: 55. Bootstrapping the "pip" installer into an existing + Python installation or virtual environment. +* enum: 56. Implementation of an enumeration class. +* errno: 57. Standard errno system symbols. +* faulthandler: 58. Dump the Python traceback. +* fcntl: 59. The fcntl() and ioctl() system calls. +* filecmp: 5a. Compare files efficiently. +* fileinput: 5b. Loop over standard input or a list of files. +* fnmatch: 5c. Unix shell style filename pattern matching. +* fractions: 5d. Rational numbers. +* ftplib: 5e. FTP protocol client (requires sockets). +* functools: 5f. Higher-order functions and operations on callable + objects. +* gc: 60. Interface to the cycle-detecting garbage collector. +* getopt: 61. Portable parser for command line options; support both + short and long option names. +* getpass: 62. Portable reading of passwords and retrieval of the + userid. +* gettext: 63. Multilingual internationalization services. +* glob: 64. Unix shell style pathname pattern expansion. +* graphlib: 65. Functionality to operate with graph-like structures +* grp: 66. The group database (getgrnam() and friends). +* gzip: 67. Interfaces for gzip compression and decompression + using file objects. +* hashlib: 68. Secure hash and message digest algorithms. +* heapq: 69. Heap queue algorithm (a.k.a. priority queue). +* hmac: 6a. Keyed-Hashing for Message Authentication (HMAC) + implementation +* html: 6b. Helpers for manipulating HTML. +* html.entities: 6c. Definitions of HTML general entities. +* html.parser: 6d. A simple parser that can handle HTML and XHTML. +* http: 6e. HTTP status codes and messages +* http.client: 6f. HTTP and HTTPS protocol client (requires sockets). +* http.cookiejar: 70. Classes for automatic handling of HTTP cookies. +* http.cookies: 71. Support for HTTP state management (cookies). +* http.server: 72. HTTP server and request handlers. +* idlelib: 73. Implementation package for the IDLE shell/editor. +* imaplib: 74. IMAP4 protocol client (requires sockets). +* imghdr: 75. Removed in 3.13. +* imp: 76. Removed in 3.12. +* importlib: 77. The implementation of the import machinery. +* importlib.abc: 78. Abstract base classes related to import +* importlib.machinery: 79. Importers and path hooks +* importlib.metadata: 7a. Accessing package metadata +* importlib.resources: 7b. Package resource reading, opening, and + access +* importlib.resources.abc: 7c. Abstract base classes for resources +* importlib.util: 7d. Utility code for importers +* inspect: 7e. Extract information and source code from live objects. +* io: 7f. Core tools for working with streams. +* ipaddress: 80. IPv4/IPv6 manipulation library. +* itertools: 81. Functions creating iterators for efficient looping. +* json: 82. Encode and decode the JSON format. +* json.tool: 83. A command line to validate and pretty-print JSON. +* keyword: 84. Test whether a string is a keyword in Python. +* linecache: 85. Provides random access to individual lines from text + files. +* locale: 86. Internationalization services. +* logging: 87. Flexible event logging system for applications. +* logging.config: 88. Configuration of the logging module. +* logging.handlers: 89. Handlers for the logging module. +* lzma: 8a. A Python wrapper for the liblzma compression library. +* mailbox: 8b. Manipulate mailboxes in various formats +* mailcap: 8c. Removed in 3.13. +* marshal: 8d. Convert Python objects to streams of bytes and back + (with different constraints). +* math: 8e. Mathematical functions (sin() etc.). +* mimetypes: 8f. Mapping of filename extensions to MIME types. +* mmap: 90. Interface to memory-mapped files for Unix and Windows. +* modulefinder: 91. Find modules used by a script. +* msilib: 92. Removed in 3.13. +* msvcrt: 93. Miscellaneous useful routines from the MS VC++ + runtime. +* multiprocessing: 94. Process-based parallelism. +* multiprocessing.connection: 95. API for dealing with sockets. +* multiprocessing.dummy: 96. Dumb wrapper around threading. +* multiprocessing.managers: 97. Share data between process with shared objects. +* multiprocessing.pool: 98. Create pools of processes. +* multiprocessing.shared_memory: 99. Provides shared memory for direct access + across processes. +* multiprocessing.sharedctypes: 9a. Allocate ctypes objects from shared memory. +* netrc: 9b. Loading of .netrc files. +* nis: 9c. Removed in 3.13. +* nntplib: 9d. Removed in 3.13. +* numbers: 9e. Numeric abstract base classes (Complex, + Real, Integral, etc.). +* operator: 9f. Functions corresponding to the standard operators. +* optparse: a0. Command-line option parsing library. +* os: a1. Miscellaneous operating system interfaces. +* os.path: a2. Operations on pathnames. +* ossaudiodev: a3. Removed in 3.13. +* pathlib: a4. Object-oriented filesystem paths +* pdb: a5. The Python debugger for interactive interpreters. +* pickle: a6. Convert Python objects to streams of bytes and back. +* pickletools: a7. Contains extensive comments about the pickle protocols + and pickle-machine opcodes, as well as some + useful functions. +* pipes: a8. Removed in 3.13. +* pkgutil: a9. Utilities for the import system. +* platform: aa. Retrieves as much platform identifying data as + possible. +* plistlib: ab. Generate and parse Apple plist files. +* poplib: ac. POP3 protocol client (requires sockets). +* posix: ad. The most common POSIX system calls (normally used via + module os). +* pprint: ae. Data pretty printer. +* profile: af. Python source profiler. +* pstats: b0. Statistics object for use with the profiler. +* pty: b1. Pseudo-Terminal Handling for Unix. +* pwd: b2. The password database (getpwnam() and friends). +* py_compile: b3. Generate byte-code files from Python source files. +* pyclbr: b4. Supports information extraction for a Python module + browser. +* pydoc: b5. Documentation generator and online help system. +* queue: b6. A synchronized queue class. +* quopri: b7. Encode and decode files using the MIME quoted- + printable encoding. +* random: b8. Generate pseudo-random numbers with various common + distributions. +* re: b9. Regular expression operations. +* readline: ba. GNU readline support for Python. +* reprlib: bb. Alternate repr() implementation with size limits. +* resource: bc. An interface to provide resource usage information on + the current process. +* rlcompleter: bd. Python identifier completion, suitable for the + GNU readline library. +* runpy: be. Locate and run Python modules without importing them + first. +* sched: bf. General purpose event scheduler. +* secrets: c0. Generate secure random numbers for managing secrets. +* select: c1. Wait for I/O completion on multiple streams. +* selectors: c2. High-level I/O multiplexing. +* shelve: c3. Python object persistence. +* shlex: c4. Simple lexical analysis for Unix shell-like languages. +* shutil: c5. High-level file operations, including copying. +* signal: c6. Set handlers for asynchronous events. +* site: c7. Module responsible for site-specific configuration. +* sitecustomize: c8. +* smtpd: c9. Removed in 3.12. +* smtplib: ca. SMTP protocol client (requires sockets). +* sndhdr: cb. Removed in 3.13. +* socket: cc. Low-level networking interface. +* socketserver: cd. A framework for network servers. +* spwd: ce. Removed in 3.13. +* sqlite3: cf. A DB-API 2.0 implementation using SQLite 3.x. +* ssl: d0. TLS/SSL wrapper for socket objects +* stat: d1. Utilities for interpreting the results of + os.stat(), os.lstat() and os.fstat(). +* statistics: d2. Mathematical statistics functions +* string: d3. Common string operations. +* stringprep: d4. String preparation, as per RFC 3453 +* struct: d5. Interpret bytes as packed binary data. +* subprocess: d6. Subprocess management. +* sunau: d7. Removed in 3.13. +* symtable: d8. Interface to the compiler's internal symbol tables. +* sys: d9. Access system-specific parameters and functions. +* sys.monitoring: da. Access and control event monitoring +* sysconfig: db. Python's configuration information +* syslog: dc. An interface to the Unix syslog library routines. +* tabnanny: dd. Tool for detecting white space related problems in + Python source files in a directory tree. +* tarfile: de. Read and write tar-format archive files. +* telnetlib: df. Removed in 3.13. +* tempfile: e0. Generate temporary files and directories. +* termios: e1. POSIX style tty control. +* test: e2. Regression tests package containing the testing suite + for Python. +* test.regrtest: e3. Drives the regression test suite. +* test.support: e4. Support for Python's regression test suite. +* test.support.bytecode_helper: e5. Support tools for testing correct bytecode + generation. +* test.support.import_helper: e6. Support for import tests. +* test.support.os_helper: e7. Support for os tests. +* test.support.script_helper: e8. Support for Python's script execution tests. +* test.support.socket_helper: e9. Support for socket tests. +* test.support.threading_helper: ea. Support for threading tests. +* test.support.warnings_helper: eb. Support for warnings tests. +* textwrap: ec. Text wrapping and filling +* threading: ed. Thread-based parallelism. +* time: ee. Time access and conversions. +* timeit: ef. Measure the execution time of small code snippets. +* tkinter: f0. Interface to Tcl/Tk for graphical user interfaces +* tkinter.colorchooser: f1. Color choosing dialog +* tkinter.commondialog: f2. Tkinter base class for dialogs +* tkinter.dnd: f3. Tkinter drag-and-drop interface +* tkinter.filedialog: f4. Dialog classes for file selection +* tkinter.font: f5. Tkinter font-wrapping class +* tkinter.messagebox: f6. Various types of alert dialogs +* tkinter.scrolledtext: f7. Text widget with a vertical scroll bar. +* tkinter.simpledialog: f8. Simple dialog windows +* tkinter.ttk: f9. Tk themed widget set +* token: fa. Constants representing terminal nodes of the parse + tree. +* tokenize: fb. Lexical scanner for Python source code. +* tomllib: fc. Parse TOML files. +* trace: fd. Trace or track Python statement execution. +* traceback: fe. Print or retrieve a stack traceback. +* tracemalloc: ff. Trace memory allocations. +* tty: 100. Utility functions that perform common terminal control + operations. +* turtle: 101. An educational framework for simple graphics + applications +* turtledemo: 102. A viewer for example turtle scripts +* types: 103. Names for built-in types. +* typing: 104. Support for type hints (see :pep:'484'). +* unicodedata: 105. Access the Unicode Database. +* unittest: 106. Unit testing framework for Python. +* unittest.mock: 107. Mock object library. +* urllib: 108. +* urllib.error: 109. Exception classes raised by urllib.request. +* urllib.parse: 10a. Parse URLs into or assemble them from components. +* urllib.request: 10b. Extensible library for opening URLs. +* urllib.response: 10c. Response classes used by urllib. +* urllib.robotparser: 10d. Load a robots.txt file and answer questions about + fetchability of other URLs. +* usercustomize: 10e. +* uu: 10f. Removed in 3.13. +* uuid: 110. UUID objects (universally unique identifiers) + according to RFC 4122 +* venv: 111. Creation of virtual environments. +* warnings: 112. Issue warning messages and control their disposition. +* wave: 113. Provide an interface to the WAV sound format. +* weakref: 114. Support for weak references and weak dictionaries. +* webbrowser: 115. Easy-to-use controller for web browsers. +* winreg: 116. Routines and objects for manipulating the Windows + registry. +* winsound: 117. Access to the sound-playing machinery for Windows. +* wsgiref: 118. WSGI Utilities and Reference Implementation. +* wsgiref.handlers: 119. WSGI server/gateway base classes. +* wsgiref.headers: 11a. WSGI response header tools. +* wsgiref.simple_server: 11b. A simple WSGI HTTP server. +* wsgiref.types: 11c. WSGI types for static type checking +* wsgiref.util: 11d. WSGI environment utilities. +* wsgiref.validate: 11e. WSGI conformance checker. +* xdrlib: 11f. Removed in 3.13. +* xml: 120. Package containing XML processing modules +* xml.dom: 121. Document Object Model API for Python. +* xml.dom.minidom: 122. Minimal Document Object Model (DOM) implementation. +* xml.dom.pulldom: 123. Support for building partial DOM trees from SAX + events. +* xml.etree.ElementInclude: 124. +* xml.etree.ElementTree: 125. Implementation of the ElementTree API. +* xml.parsers.expat: 126. An interface to the Expat non-validating XML parser. +* xml.parsers.expat.errors: 127. +* xml.parsers.expat.model: 128. +* xml.sax: 129. Package containing SAX2 base classes and convenience + functions. +* xml.sax.handler: 12a. Base classes for SAX event handlers. +* xml.sax.saxutils: 12b. Convenience functions and classes for use with SAX. +* xml.sax.xmlreader: 12c. Interface which SAX-compliant XML parsers must + implement. +* xmlrpc: 12d. Server and client modules implementing XML-RPC. +* xmlrpc.client: 12e. XML-RPC client access. +* xmlrpc.server: 12f. Basic XML-RPC server implementations. +* zipapp: 130. Manage executable Python zip archives +* zipfile: 131. Read and write ZIP-format archive files. +* zipimport: 132. Support for importing Python modules from ZIP + archives. +* zlib: 133. Low-level interface to compression and decompression + routines compatible with gzip. +* zoneinfo: 134. IANA time zone support + + +File: python.info, Node: Index, Prev: Python Module Index, Up: Top + +Index +***** + +[index] +* Menu: + +* _ (underscore); gettext: GNU gettext API. (line 32) +* _ (underscore); in numeric literal: Numeric literals. (line 13) +* _ (underscore); in numeric literal <1>: Integer literals. (line 39) +* _ (underscore); in string formatting: Format Specification Mini-Language. + (line 124) +* __, identifiers: Soft Keywords. (line 21) +* __abs__() (in module operator): operator — Standard operators as functions. + (line 73) +* __abs__() (object method): Emulating numeric types. + (line 108) +* __add__() (in module operator): operator — Standard operators as functions. + (line 78) +* __add__() (object method): Emulating numeric types. + (line 11) +* __aenter__() (object method): Asynchronous Context Managers. + (line 14) +* __aexit__() (object method): Asynchronous Context Managers. + (line 19) +* __aiter__() (object method): Asynchronous Iterators. + (line 14) +* __all__: Importing * From a Package. + (line 6) +* __all__ (optional module attribute): The import statement. + (line 84) +* __all__ (package variable): Importing Modules<2>. + (line 9) +* __and__() (enum.Flag method): Data Types<2>. (line 499) +* __and__() (in module operator): operator — Standard operators as functions. + (line 83) +* __and__() (object method): Emulating numeric types. + (line 11) +* __anext__() (agen method): Asynchronous generator-iterator methods. + (line 10) +* __anext__() (object method): Asynchronous Iterators. + (line 18) +* __annotations__ (class attribute): Special attributes. (line 6) +* __annotations__ (function attribute): Special writable attributes. + (line 6) +* __annotations__ (function attribute) <1>: Special writable attributes. + (line 45) +* __annotations__ (module attribute): Modules<3>. (line 21) +* __annotations__ (module attribute) <1>: Other writable attributes on module objects. + (line 14) +* __annotations__ (type attribute): Special attributes. (line 37) +* __args__ (genericalias attribute): Special Attributes of GenericAlias objects. + (line 15) +* __await__() (object method): Awaitable Objects. (line 14) +* __bases__ (class attribute): Special attributes. (line 6) +* __bases__ (type attribute): Special attributes. (line 27) +* __bool__() (object method): Basic customization. + (line 320) +* __bool__() (object method) <1>: Emulating container types. + (line 41) +* __bound__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 175) +* __breakpointhook__ (in module sys): sys — System-specific parameters and functions. + (line 421) +* __buffer__() (object method): Emulating buffer types. + (line 15) +* __bytes__() (email.message.EmailMessage method): email message Representing an email message. + (line 129) +* __bytes__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 138) +* __bytes__() (object method): Basic customization. + (line 146) +* __cached__ (module attribute): Modules<3>. (line 21) +* __cached__ (module attribute) <1>: Import-related attributes on module objects. + (line 138) +* __call__() (argparse.Action method): Action classes. (line 28) +* __call__() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects. + (line 390) +* __call__() (enum.EnumType method): Data Types<2>. (line 20) +* __call__() (in module operator): operator — Standard operators as functions. + (line 221) +* __call__() (object method): Emulating callable objects. + (line 6) +* __call__() (object method) <1>: Calls. (line 158) +* __call__() (weakref.finalize method): weakref — Weak references. + (line 295) +* __callback__ (weakref.ref attribute): weakref — Weak references. + (line 126) +* __cause__ (BaseException attribute): Exception context. (line 9) +* __cause__ (exception attribute): The raise statement. + (line 30) +* __cause__ (exception attribute) <1>: Exception context. (line 6) +* __cause__ (traceback.TracebackException attribute): TracebackException Objects. + (line 44) +* __ceil__() (fractions.Fraction method): fractions — Rational numbers. + (line 190) +* __ceil__() (object method): Emulating numeric types. + (line 138) +* __class__ (instance attribute): Special attributes<2>. + (line 6) +* __class__ (method cell): Creating the class object. + (line 6) +* __class__ (module attribute): Customizing module attribute access. + (line 6) +* __class__ (object attribute): Special attributes<2>. + (line 6) +* __class__ (unittest.mock.Mock attribute): The Mock Class. (line 560) +* __class_getitem__() (object class method): Emulating generic types. + (line 32) +* __classcell__ (class namespace entry): Creating the class object. + (line 6) +* __closure__ (function attribute): Special read-only attributes. + (line 6) +* __closure__ (function attribute) <1>: Special read-only attributes. + (line 16) +* __code__ (function attribute): Special writable attributes. + (line 6) +* __code__ (function attribute) <1>: Special writable attributes. + (line 36) +* __code__ (function object attribute): Code Objects. (line 6) +* __complex__() (object method): Emulating numeric types. + (line 116) +* __concat__() (in module operator): operator — Standard operators as functions. + (line 176) +* __constraints__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 184) +* __contains__() (email.message.EmailMessage method): email message Representing an email message. + (line 179) +* __contains__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 303) +* __contains__() (enum.EnumType method): Data Types<2>. (line 65) +* __contains__() (enum.Flag method): Data Types<2>. (line 437) +* __contains__() (in module operator): operator — Standard operators as functions. + (line 181) +* __contains__() (mailbox.Mailbox method): Mailbox objects. (line 203) +* __contains__() (object method): Emulating container types. + (line 150) +* __context__ (BaseException attribute): Exception context. (line 9) +* __context__ (exception attribute): The raise statement. + (line 30) +* __context__ (exception attribute) <1>: Exception context. (line 6) +* __context__ (traceback.TracebackException attribute): TracebackException Objects. + (line 48) +* __contravariant__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 163) +* __copy__() (copy protocol): copy — Shallow and deep copy operations. + (line 80) +* __covariant__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 159) +* __debug__: The assert statement. + (line 21) +* __debug__ (built-in variable): Built-in Constants. (line 66) +* __deepcopy__() (copy protocol): copy — Shallow and deep copy operations. + (line 80) +* __default__ (typing.ParamSpec attribute): Building generic types and type aliases. + (line 427) +* __default__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 194) +* __default__ (typing.TypeVarTuple attribute): Building generic types and type aliases. + (line 326) +* __defaults__ (function attribute): Special writable attributes. + (line 6) +* __defaults__ (function attribute) <1>: Special writable attributes. + (line 30) +* __del__() (io.IOBase method): I/O Base Classes. (line 164) +* __del__() (object method): Basic customization. + (line 53) +* __delattr__() (object method): Customizing attribute access. + (line 69) +* __delete__() (object method): Implementing Descriptors. + (line 42) +* __delitem__() (email.message.EmailMessage method): email message Representing an email message. + (line 226) +* __delitem__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 337) +* __delitem__() (in module operator): operator — Standard operators as functions. + (line 191) +* __delitem__() (mailbox.Mailbox method): Mailbox objects. (line 76) +* __delitem__() (mailbox.MH method): MH objects. (line 79) +* __delitem__() (object method): Emulating container types. + (line 108) +* __dict__ (class attribute): Special attributes. (line 6) +* __dict__ (function attribute): Special writable attributes. + (line 6) +* __dict__ (function attribute) <1>: Special writable attributes. + (line 40) +* __dict__ (instance attribute): Special attributes<2>. + (line 6) +* __dict__ (module attribute): Module dictionaries. + (line 8) +* __dict__ (module attribute) <1>: Module dictionaries. + (line 8) +* __dict__ (module attribute) <2>: Module Objects. (line 49) +* __dict__ (object attribute): Special attributes<2>. + (line 10) +* __dict__ (type attribute): Special attributes. (line 22) +* __dir__ (module attribute): Customizing module attribute access. + (line 6) +* __dir__() (enum.Enum method): Data Types<2>. (line 175) +* __dir__() (enum.EnumType method): Data Types<2>. (line 78) +* __dir__() (object method): Customizing attribute access. + (line 78) +* __dir__() (unittest.mock.Mock method): The Mock Class. (line 300) +* __displayhook__ (in module sys): sys — System-specific parameters and functions. + (line 421) +* __divmod__() (object method): Emulating numeric types. + (line 11) +* __doc__ (class attribute): Special attributes. (line 6) +* __doc__ (definition attribute): Special Attributes. (line 26) +* __doc__ (function attribute): Special writable attributes. + (line 6) +* __doc__ (function attribute) <1>: Special writable attributes. + (line 12) +* __doc__ (method attribute): Instance methods. (line 9) +* __doc__ (method attribute) <1>: Instance methods. (line 18) +* __doc__ (module attribute): Modules<3>. (line 21) +* __doc__ (module attribute) <1>: Other writable attributes on module objects. + (line 9) +* __doc__ (module attribute) <2>: Module Objects. (line 26) +* __doc__ (type attribute): Special attributes. (line 33) +* __enter__() (contextmanager method): Context Manager Types. + (line 12) +* __enter__() (object method): With Statement Context Managers. + (line 22) +* __enter__() (winreg.PyHKEY method): Registry Handle Objects. + (line 56) +* __eq__() (email.charset.Charset method): email charset Representing character sets. + (line 150) +* __eq__() (email.header.Header method): email header Internationalized headers. + (line 170) +* __eq__() (in module operator): operator — Standard operators as functions. + (line 24) +* __eq__() (instance method): Comparisons<2>. (line 50) +* __eq__() (memoryview method): Memory Views. (line 112) +* __eq__() (object method): Basic customization. + (line 180) +* __excepthook__ (in module sys): sys — System-specific parameters and functions. + (line 421) +* __excepthook__ (in module threading): Reference<2>. (line 65) +* __exit__() (contextmanager method): Context Manager Types. + (line 32) +* __exit__() (object method): With Statement Context Managers. + (line 28) +* __exit__() (winreg.PyHKEY method): Registry Handle Objects. + (line 56) +* __file__ (module attribute): Modules<3>. (line 21) +* __file__ (module attribute) <1>: Import-related attributes on module objects. + (line 136) +* __file__ (module attribute) <2>: Module Objects. (line 26) +* __file__ (module attribute) <3>: Module Objects. (line 92) +* __firstlineno__ (class attribute): Special attributes. (line 6) +* __firstlineno__ (type attribute): Special attributes. (line 66) +* __float__() (object method): Emulating numeric types. + (line 116) +* __floor__() (fractions.Fraction method): fractions — Rational numbers. + (line 180) +* __floor__() (object method): Emulating numeric types. + (line 138) +* __floordiv__() (in module operator): operator — Standard operators as functions. + (line 88) +* __floordiv__() (object method): Emulating numeric types. + (line 11) +* __format__: Built-in Functions. (line 788) +* __format__() (datetime.date method): date Objects. (line 307) +* __format__() (datetime.datetime method): datetime Objects. (line 761) +* __format__() (datetime.time method): time Objects. (line 227) +* __format__() (enum.Enum method): Data Types<2>. (line 316) +* __format__() (fractions.Fraction method): fractions — Rational numbers. + (line 207) +* __format__() (ipaddress.IPv4Address method): Address objects. + (line 195) +* __format__() (ipaddress.IPv6Address method): Address objects. + (line 327) +* __format__() (object method): Basic customization. + (line 153) +* __fspath__() (os.PathLike method): Process Parameters. (line 127) +* __func__ (method attribute): Instance methods. (line 9) +* __func__ (method attribute) <1>: Instance methods. (line 15) +* __future__: Glossary. (line 596) +* __future__; future statement: Future statements. (line 6) +* __ge__() (in module operator): operator — Standard operators as functions. + (line 24) +* __ge__() (instance method): Comparisons<2>. (line 50) +* __ge__() (object method): Basic customization. + (line 180) +* __get__() (object method): Implementing Descriptors. + (line 15) +* __getattr__ (module attribute): Customizing module attribute access. + (line 6) +* __getattr__() (object method): Customizing attribute access. + (line 10) +* __getattribute__() (object method): Customizing attribute access. + (line 33) +* __getitem__() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects. + (line 385) +* __getitem__() (email.message.EmailMessage method): email message Representing an email message. + (line 189) +* __getitem__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 312) +* __getitem__() (enum.EnumType method): Data Types<2>. (line 86) +* __getitem__() (in module operator): operator — Standard operators as functions. + (line 196) +* __getitem__() (mailbox.Mailbox method): Mailbox objects. (line 148) +* __getitem__() (mapping object method): Special method names. + (line 6) +* __getitem__() (object method): Emulating container types. + (line 78) +* __getitem__() (re.Match method): Match Objects. (line 90) +* __getnewargs__() (object method): Pickling Class Instances. + (line 47) +* __getnewargs_ex__() (object method): Pickling Class Instances. + (line 29) +* __getstate__() (copy protocol): Handling Stateful Objects. + (line 6) +* __getstate__() (object method): Pickling Class Instances. + (line 61) +* __globals__ (function attribute): Special read-only attributes. + (line 6) +* __globals__ (function attribute) <1>: Special read-only attributes. + (line 10) +* __gt__() (in module operator): operator — Standard operators as functions. + (line 24) +* __gt__() (instance method): Comparisons<2>. (line 50) +* __gt__() (object method): Basic customization. + (line 180) +* __hash__() (object method): Basic customization. + (line 239) +* __iadd__() (in module operator): In-place Operators. (line 36) +* __iadd__() (object method): Emulating numeric types. + (line 77) +* __iand__() (in module operator): In-place Operators. (line 41) +* __iand__() (object method): Emulating numeric types. + (line 77) +* __iconcat__() (in module operator): In-place Operators. (line 46) +* __ifloordiv__() (in module operator): In-place Operators. (line 52) +* __ifloordiv__() (object method): Emulating numeric types. + (line 77) +* __ilshift__() (in module operator): In-place Operators. (line 57) +* __ilshift__() (object method): Emulating numeric types. + (line 77) +* __imatmul__() (in module operator): In-place Operators. (line 72) +* __imatmul__() (object method): Emulating numeric types. + (line 77) +* __imod__() (in module operator): In-place Operators. (line 62) +* __imod__() (object method): Emulating numeric types. + (line 77) +* __import__() (in module importlib): Functions<12>. (line 6) +* __imul__() (in module operator): In-place Operators. (line 67) +* __imul__() (object method): Emulating numeric types. + (line 77) +* __index__() (in module operator): operator — Standard operators as functions. + (line 93) +* __index__() (object method): Emulating numeric types. + (line 124) +* __infer_variance__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 168) +* __init__() (asyncio.Future method): Future and Task private constructors. + (line 17) +* __init__() (asyncio.Task method): Future and Task private constructors. + (line 23) +* __init__() (difflib.HtmlDiff method): difflib — Helpers for computing deltas. + (line 92) +* __init__() (enum.Enum method): Data Types<2>. (line 225) +* __init__() (logging.Handler method): Handler Objects. (line 13) +* __init__() (logging.logging.Formatter method): Formatters. (line 13) +* __init__() (object method): Basic customization. + (line 37) +* __init_subclass__() (enum.Enum method): Data Types<2>. (line 238) +* __init_subclass__() (object class method): Customizing class creation. + (line 13) +* __instancecheck__() (type method): Customizing instance and subclass checks. + (line 15) +* __int__() (object method): Emulating numeric types. + (line 116) +* __interactivehook__ (in module sys): sys — System-specific parameters and functions. + (line 1172) +* __inv__() (in module operator): operator — Standard operators as functions. + (line 102) +* __invert__() (in module operator): operator — Standard operators as functions. + (line 102) +* __invert__() (object method): Emulating numeric types. + (line 108) +* __ior__() (in module operator): In-place Operators. (line 79) +* __ior__() (object method): Emulating numeric types. + (line 77) +* __ipow__() (in module operator): In-place Operators. (line 84) +* __ipow__() (object method): Emulating numeric types. + (line 77) +* __irshift__() (in module operator): In-place Operators. (line 89) +* __irshift__() (object method): Emulating numeric types. + (line 77) +* __isub__() (in module operator): In-place Operators. (line 94) +* __isub__() (object method): Emulating numeric types. + (line 77) +* __iter__() (container method): Iterator Types. (line 14) +* __iter__() (enum.EnumType method): Data Types<2>. (line 94) +* __iter__() (iterator method): Iterator Types. (line 29) +* __iter__() (mailbox.Mailbox method): Mailbox objects. (line 116) +* __iter__() (object method): Emulating container types. + (line 122) +* __iter__() (unittest.TestSuite method): Grouping tests. (line 60) +* __itruediv__() (in module operator): In-place Operators. (line 99) +* __itruediv__() (object method): Emulating numeric types. + (line 77) +* __ixor__() (in module operator): In-place Operators. (line 104) +* __ixor__() (object method): Emulating numeric types. + (line 77) +* __kwdefaults__ (function attribute): Special writable attributes. + (line 6) +* __kwdefaults__ (function attribute) <1>: Special writable attributes. + (line 52) +* __le__() (in module operator): operator — Standard operators as functions. + (line 24) +* __le__() (instance method): Comparisons<2>. (line 50) +* __le__() (object method): Basic customization. + (line 180) +* __len__() (email.message.EmailMessage method): email message Representing an email message. + (line 175) +* __len__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 299) +* __len__() (enum.EnumType method): Data Types<2>. (line 101) +* __len__() (mailbox.Mailbox method): Mailbox objects. (line 208) +* __len__() (mapping object method): Basic customization. + (line 322) +* __len__() (object method): Emulating container types. + (line 39) +* __length_hint__() (object method): Emulating container types. + (line 54) +* __loader__ (module attribute): Modules<3>. (line 21) +* __loader__ (module attribute) <1>: Import-related attributes on module objects. + (line 98) +* __loader__ (module attribute) <2>: Module Objects. (line 26) +* __lshift__() (in module operator): operator — Standard operators as functions. + (line 110) +* __lshift__() (object method): Emulating numeric types. + (line 11) +* __lt__() (in module operator): operator — Standard operators as functions. + (line 24) +* __lt__() (instance method): Comparisons<2>. (line 50) +* __lt__() (object method): Basic customization. + (line 180) +* __matmul__() (in module operator): operator — Standard operators as functions. + (line 125) +* __matmul__() (object method): Emulating numeric types. + (line 11) +* __members__ (enum.EnumType attribute): Data Types<2>. (line 108) +* __missing__(): Mapping Types — dict. + (line 119) +* __missing__() (collections.defaultdict method): defaultdict objects. + (line 22) +* __missing__() (object method): Emulating container types. + (line 117) +* __mod__() (in module operator): operator — Standard operators as functions. + (line 115) +* __mod__() (object method): Emulating numeric types. + (line 11) +* __module__ (class attribute): Special attributes. (line 6) +* __module__ (definition attribute): Special Attributes. (line 22) +* __module__ (function attribute): Special writable attributes. + (line 6) +* __module__ (function attribute) <1>: Special writable attributes. + (line 26) +* __module__ (method attribute): Instance methods. (line 9) +* __module__ (method attribute) <1>: Instance methods. (line 28) +* __module__ (type attribute): Special attributes. (line 18) +* __module__ (typing.NewType attribute): Other special directives. + (line 115) +* __module__ (typing.TypeAliasType attribute): Building generic types and type aliases. + (line 513) +* __mro__ (type attribute): Special attributes. (line 74) +* __mro_entries__() (object method): Resolving MRO entries. + (line 6) +* __mul__() (in module operator): operator — Standard operators as functions. + (line 120) +* __mul__() (object method): Emulating numeric types. + (line 11) +* __mutable_keys__ (typing.TypedDict attribute): Other special directives. + (line 455) +* __name__ (class attribute): Special attributes. (line 6) +* __name__ (definition attribute): Special Attributes. (line 10) +* __name__ (function attribute): Special writable attributes. + (line 6) +* __name__ (function attribute) <1>: Special writable attributes. + (line 16) +* __name__ (method attribute): Instance methods. (line 9) +* __name__ (method attribute) <1>: Instance methods. (line 24) +* __name__ (module attribute): Modules<3>. (line 21) +* __name__ (module attribute) <1>: Import-related attributes on module objects. + (line 37) +* __name__ (module attribute) <2>: Module Objects. (line 26) +* __name__ (module attribute) <3>: Module Objects. (line 64) +* __name__ (property attribute): Built-in Functions. (line 1677) +* __name__ (type attribute): Special attributes. (line 10) +* __name__ (typing.NewType attribute): Other special directives. + (line 119) +* __name__ (typing.ParamSpec attribute): Building generic types and type aliases. + (line 423) +* __name__ (typing.TypeAliasType attribute): Building generic types and type aliases. + (line 505) +* __name__ (typing.TypeVar attribute): Building generic types and type aliases. + (line 155) +* __name__ (typing.TypeVarTuple attribute): Building generic types and type aliases. + (line 322) +* __ne__() (email.charset.Charset method): email charset Representing character sets. + (line 155) +* __ne__() (email.header.Header method): email header Internationalized headers. + (line 175) +* __ne__() (in module operator): operator — Standard operators as functions. + (line 24) +* __ne__() (instance method): Comparisons<2>. (line 50) +* __ne__() (object method): Basic customization. + (line 180) +* __neg__() (in module operator): operator — Standard operators as functions. + (line 132) +* __neg__() (object method): Emulating numeric types. + (line 108) +* __new__() (enum.Enum method): Data Types<2>. (line 266) +* __new__() (object method): Basic customization. + (line 6) +* __next__() (csv.csvreader method): Reader Objects. (line 9) +* __next__() (generator method): Generator-iterator methods. + (line 12) +* __next__() (iterator method): Iterator Types. (line 37) +* __not__() (in module operator): operator — Standard operators as functions. + (line 49) +* __notes__ (BaseException attribute): Base classes. (line 58) +* __notes__ (traceback.TracebackException attribute): TracebackException Objects. + (line 66) +* __objclass__ (object attribute): Implementing Descriptors. + (line 50) +* __optional_keys__ (typing.TypedDict attribute): Other special directives. + (line 406) +* __or__() (enum.Flag method): Data Types<2>. (line 492) +* __or__() (in module operator): operator — Standard operators as functions. + (line 137) +* __or__() (object method): Emulating numeric types. + (line 11) +* __origin__ (genericalias attribute): Special Attributes of GenericAlias objects. + (line 8) +* __package__ (module attribute): Modules<3>. (line 21) +* __package__ (module attribute) <1>: Import-related attributes on module objects. + (line 55) +* __package__ (module attribute) <2>: Module Objects. (line 26) +* __parameters__ (genericalias attribute): Special Attributes of GenericAlias objects. + (line 24) +* __path__ (module attribute): Modules<3>. (line 21) +* __path__ (module attribute) <1>: Import-related attributes on module objects. + (line 125) +* __pos__() (in module operator): operator — Standard operators as functions. + (line 142) +* __pos__() (object method): Emulating numeric types. + (line 108) +* __post_init__() (in module dataclasses): Post-init processing. + (line 6) +* __pow__() (in module operator): operator — Standard operators as functions. + (line 147) +* __pow__() (object method): Emulating numeric types. + (line 11) +* __prepare__ (metaclass method): Preparing the class namespace. + (line 6) +* __PYVENV_LAUNCHER__: PyConfig. (line 187) +* __PYVENV_LAUNCHER__ <1>: PyConfig. (line 705) +* __qualname__ (definition attribute): Special Attributes. (line 15) +* __qualname__ (function attribute): Special writable attributes. + (line 20) +* __qualname__ (type attribute): Special attributes. (line 14) +* __radd__() (object method): Emulating numeric types. + (line 41) +* __rand__() (object method): Emulating numeric types. + (line 41) +* __rdivmod__() (object method): Emulating numeric types. + (line 41) +* __readonly_keys__ (typing.TypedDict attribute): Other special directives. + (line 447) +* __reduce__() (object method): Pickling Class Instances. + (line 124) +* __reduce_ex__() (object method): Pickling Class Instances. + (line 179) +* __release_buffer__() (object method): Emulating buffer types. + (line 25) +* __replace__() (replace protocol): copy — Shallow and deep copy operations. + (line 98) +* __repr__() (enum.Enum method): Data Types<2>. (line 283) +* __repr__() (multiprocessing.managers.BaseProxy method): Proxy Objects. + (line 145) +* __repr__() (netrc.netrc method): netrc Objects. (line 16) +* __repr__() (object method): Basic customization. + (line 114) +* __required_keys__ (typing.TypedDict attribute): Other special directives. + (line 402) +* __reversed__() (enum.EnumType method): Data Types<2>. (line 113) +* __reversed__() (object method): Emulating container types. + (line 129) +* __rfloordiv__() (object method): Emulating numeric types. + (line 41) +* __rlshift__() (object method): Emulating numeric types. + (line 41) +* __rmatmul__() (object method): Emulating numeric types. + (line 41) +* __rmod__() (object method): Emulating numeric types. + (line 41) +* __rmul__() (object method): Emulating numeric types. + (line 41) +* __ror__() (object method): Emulating numeric types. + (line 41) +* __round__() (fractions.Fraction method): fractions — Rational numbers. + (line 196) +* __round__() (object method): Emulating numeric types. + (line 138) +* __rpow__() (object method): Emulating numeric types. + (line 41) +* __rrshift__() (object method): Emulating numeric types. + (line 41) +* __rshift__() (in module operator): operator — Standard operators as functions. + (line 152) +* __rshift__() (object method): Emulating numeric types. + (line 11) +* __rsub__() (object method): Emulating numeric types. + (line 41) +* __rtruediv__() (object method): Emulating numeric types. + (line 41) +* __rxor__() (object method): Emulating numeric types. + (line 41) +* __self__ (method attribute): Instance methods. (line 9) +* __self__ (method attribute) <1>: Instance methods. (line 11) +* __set__() (object method): Implementing Descriptors. + (line 33) +* __set_name__() (object method): Customizing class creation. + (line 47) +* __setattr__() (object method): Customizing attribute access. + (line 54) +* __setitem__() (email.message.EmailMessage method): email message Representing an email message. + (line 204) +* __setitem__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 323) +* __setitem__() (in module operator): operator — Standard operators as functions. + (line 205) +* __setitem__() (mailbox.Mailbox method): Mailbox objects. (line 90) +* __setitem__() (mailbox.Maildir method): Maildir objects. (line 193) +* __setitem__() (object method): Emulating container types. + (line 99) +* __setstate__() (copy protocol): Handling Stateful Objects. + (line 6) +* __setstate__() (object method): Pickling Class Instances. + (line 88) +* __slots__: Glossary. (line 1341) +* __spec__ (module attribute): Modules<3>. (line 21) +* __spec__ (module attribute) <1>: Import-related attributes on module objects. + (line 46) +* __static_attributes__ (class attribute): Special attributes. + (line 6) +* __static_attributes__ (type attribute): Special attributes. + (line 59) +* __stderr__ (in module sys): sys — System-specific parameters and functions. + (line 1876) +* __stdin__ (in module sys): sys — System-specific parameters and functions. + (line 1876) +* __stdout__ (in module sys): sys — System-specific parameters and functions. + (line 1876) +* __str__() (datetime.date method): date Objects. (line 280) +* __str__() (datetime.datetime method): datetime Objects. (line 731) +* __str__() (datetime.time method): time Objects. (line 217) +* __str__() (email.charset.Charset method): email charset Representing character sets. + (line 145) +* __str__() (email.header.Header method): email header Internationalized headers. + (line 158) +* __str__() (email.headerregistry.Address method): email headerregistry Custom Header Objects. + (line 447) +* __str__() (email.headerregistry.Group method): email headerregistry Custom Header Objects. + (line 482) +* __str__() (email.message.EmailMessage method): email message Representing an email message. + (line 95) +* __str__() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 101) +* __str__() (enum.Enum method): Data Types<2>. (line 300) +* __str__() (multiprocessing.managers.BaseProxy method): Proxy Objects. + (line 149) +* __str__() (object method): Basic customization. + (line 131) +* __sub__() (in module operator): operator — Standard operators as functions. + (line 157) +* __sub__() (object method): Emulating numeric types. + (line 11) +* __subclasscheck__() (type method): Customizing instance and subclass checks. + (line 21) +* __subclasses__() (type method): Special methods. (line 15) +* __subclasshook__() (abc.ABCMeta method): abc — Abstract Base Classes. + (line 92) +* __supertype__ (typing.NewType attribute): Other special directives. + (line 123) +* __suppress_context__ (BaseException attribute): Exception context. + (line 9) +* __suppress_context__ (exception attribute): Exception context. + (line 6) +* __suppress_context__ (traceback.TracebackException attribute): TracebackException Objects. + (line 61) +* __test__ (module attribute): Which Docstrings Are Examined?. + (line 9) +* __total__ (typing.TypedDict attribute): Other special directives. + (line 377) +* __traceback__ (BaseException attribute): Base classes. (line 44) +* __traceback__ (exception attribute): The raise statement. + (line 6) +* __truediv__() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 543) +* __truediv__() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 136) +* __truediv__() (in module operator): operator — Standard operators as functions. + (line 162) +* __truediv__() (object method): Emulating numeric types. + (line 11) +* __trunc__() (object method): Emulating numeric types. + (line 138) +* __type_params__ (class attribute): Special attributes. (line 6) +* __type_params__ (definition attribute): Special Attributes. + (line 31) +* __type_params__ (function attribute): Special writable attributes. + (line 6) +* __type_params__ (function attribute) <1>: Special writable attributes. + (line 56) +* __type_params__ (type attribute): Special attributes. (line 52) +* __type_params__ (typing.TypeAliasType attribute): Building generic types and type aliases. + (line 521) +* __unpacked__ (genericalias attribute): Special Attributes of GenericAlias objects. + (line 40) +* __unraisablehook__ (in module sys): sys — System-specific parameters and functions. + (line 421) +* __value__ (typing.TypeAliasType attribute): Building generic types and type aliases. + (line 533) +* __version__ (in module curses): Constants<6>. (line 20) +* __xor__() (enum.Flag method): Data Types<2>. (line 508) +* __xor__() (in module operator): operator — Standard operators as functions. + (line 168) +* __xor__() (object method): Emulating numeric types. + (line 11) +* _, identifiers: Soft Keywords. (line 22) +* _add_alias_() (enum.Enum method): Data Types<2>. (line 337) +* _add_value_alias_() (enum.Enum method): Data Types<2>. (line 350) +* _align_ (ctypes.Structure attribute): Structured data types. + (line 87) +* _anonymous_ (ctypes.Structure attribute): Structured data types. + (line 96) +* _asdict() (collections.somenamedtuple method): namedtuple Factory Function for Tuples with Named Fields. + (line 110) +* _b_base_ (ctypes._CData attribute): Data types. (line 71) +* _b_needsfree_ (ctypes._CData attribute): Data types. (line 78) +* _callmethod() (multiprocessing.managers.BaseProxy method): Proxy Objects. + (line 96) +* _CData (class in ctypes): Data types. (line 6) +* _CFuncPtr (class in ctypes): Foreign functions. (line 22) +* _clear_internal_caches() (in module sys): sys — System-specific parameters and functions. + (line 195) +* _clear_type_cache() (in module sys): sys — System-specific parameters and functions. + (line 183) +* _current_exceptions() (in module sys): sys — System-specific parameters and functions. + (line 223) +* _current_frames() (in module sys): sys — System-specific parameters and functions. + (line 203) +* _debugmallocstats() (in module sys): sys — System-specific parameters and functions. + (line 279) +* _emscripten_info (in module sys): sys — System-specific parameters and functions. + (line 344) +* _enablelegacywindowsfsencoding() (in module sys): sys — System-specific parameters and functions. + (line 1782) +* _enter_task() (in module asyncio): Task lifetime support. + (line 22) +* _exit() (in module os): Process Management. (line 123) +* _Feature (class in __future__): Module Contents<5>. (line 51) +* _field_defaults (collections.somenamedtuple attribute): namedtuple Factory Function for Tuples with Named Fields. + (line 159) +* _field_types (ast.AST attribute): Node classes. (line 39) +* _fields (ast.AST attribute): Node classes. (line 22) +* _fields (collections.somenamedtuple attribute): namedtuple Factory Function for Tuples with Named Fields. + (line 146) +* _fields_ (ctypes.Structure attribute): Structured data types. + (line 43) +* _flush() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 117) +* _frozen (C struct): Importing Modules<2>. + (line 271) +* _generate_next_value_() (enum.Enum method): Data Types<2>. (line 196) +* _get_child_mock() (unittest.mock.Mock method): The Mock Class. + (line 309) +* _get_preferred_schemes() (in module sysconfig): Installation path functions. + (line 41) +* _getframe() (in module sys): sys — System-specific parameters and functions. + (line 882) +* _getframemodulename() (in module sys): sys — System-specific parameters and functions. + (line 897) +* _getvalue() (multiprocessing.managers.BaseProxy method): Proxy Objects. + (line 138) +* _handle (ctypes.PyDLL attribute): Loading shared libraries. + (line 157) +* _ignore_ (enum.Enum attribute): Data Types<2>. (line 166) +* _incompatible_extension_module_restrictions() (in module importlib.util): importlib util – Utility code for importers. + (line 168) +* _inittab (C struct): Importing Modules<2>. + (line 307) +* _inittab.initfunc (C member): Importing Modules<2>. + (line 319) +* _inittab.name (C member): Importing Modules<2>. + (line 315) +* _is_gil_enabled() (in module sys): sys — System-specific parameters and functions. + (line 1202) +* _is_interned() (in module sys): sys — System-specific parameters and functions. + (line 1234) +* _leave_task() (in module asyncio): Task lifetime support. + (line 30) +* _length_ (ctypes.Array attribute): Arrays and pointers. + (line 18) +* _log (logging.LoggerAdapter attribute): LoggerAdapter Objects. + (line 34) +* _make() (collections.somenamedtuple class method): namedtuple Factory Function for Tuples with Named Fields. + (line 101) +* _makeResult() (unittest.TextTestRunner method): Loading and running tests. + (line 491) +* _missing_() (enum.Enum method): Data Types<2>. (line 243) +* _name (ctypes.PyDLL attribute): Loading shared libraries. + (line 161) +* _name_ (enum.Enum attribute): Data Types<2>. (line 153) +* _numeric_repr_() (enum.Flag method): Data Types<2>. (line 528) +* _objects (ctypes._CData attribute): Data types. (line 83) +* _order_ (enum.Enum attribute): Data Types<2>. (line 161) +* _pack_ (ctypes.Structure attribute): Structured data types. + (line 79) +* _parse() (gettext.NullTranslations method): The NullTranslations class. + (line 21) +* _Pointer (class in ctypes): Arrays and pointers. + (line 39) +* _Py_c_diff (C function): Complex Numbers as C Structures. + (line 33) +* _Py_c_neg (C function): Complex Numbers as C Structures. + (line 39) +* _Py_c_pow (C function): Complex Numbers as C Structures. + (line 59) +* _Py_c_prod (C function): Complex Numbers as C Structures. + (line 44) +* _Py_c_quot (C function): Complex Numbers as C Structures. + (line 50) +* _Py_c_sum (C function): Complex Numbers as C Structures. + (line 27) +* _Py_InitializeMain (C function): Multi-Phase Initialization Private Provisional API. + (line 44) +* _Py_NoneStruct (C var): Allocating Objects on the Heap. + (line 65) +* _PyBytes_Resize (C function): Bytes Objects<2>. (line 182) +* _PyCode_GetExtra (C function): Extra information. (line 45) +* _PyCode_SetExtra (C function): Extra information. (line 58) +* _PyEval_RequestCodeExtraIndex (C function): Extra information. + (line 29) +* _PyFrameEvalFunction (C type): Low-level API. (line 165) +* _PyInterpreterFrame (C struct): Internal Frames. (line 8) +* _PyInterpreterState_GetEvalFrameFunc (C function): Low-level API. + (line 180) +* _PyInterpreterState_SetEvalFrameFunc (C function): Low-level API. + (line 190) +* _PyObject_GetDictPtr (C function): Object Protocol. (line 286) +* _PyObject_New (C function): Allocating Objects on the Heap. + (line 6) +* _PyObject_NewVar (C function): Allocating Objects on the Heap. + (line 9) +* _PyTuple_Resize (C function): Tuple Objects. (line 100) +* _register_task() (in module asyncio): Task lifetime support. + (line 10) +* _replace() (collections.somenamedtuple method): namedtuple Factory Function for Tuples with Named Fields. + (line 128) +* _setroot() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 15) +* _SimpleCData (class in ctypes): Fundamental data types<2>. + (line 6) +* _structure() (in module email.iterators): email iterators Iterators. + (line 44) +* _type_ (ctypes._Pointer attribute): Arrays and pointers. + (line 54) +* _type_ (ctypes.Array attribute): Arrays and pointers. + (line 24) +* _unregister_task() (in module asyncio): Task lifetime support. + (line 16) +* _value_ (enum.Enum attribute): Data Types<2>. (line 157) +* _write() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 109) +* _xoptions (in module sys): sys — System-specific parameters and functions. + (line 2059) +* - (minus); binary operator: Binary arithmetic operations. + (line 83) +* - (minus); binary operator <1>: Numeric Types — int float complex. + (line 27) +* - (minus); in doctests: Option Flags. (line 164) +* - (minus); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* - (minus); in glob-style wildcards <1>: fnmatch — Unix filename pattern matching. + (line 15) +* - (minus); in printf-style formatting: printf-style String Formatting. + (line 69) +* - (minus); in printf-style formatting <1>: printf-style Bytes Formatting. + (line 63) +* - (minus); in regular expressions: Regular Expression Syntax. + (line 178) +* - (minus); in string formatting: Format Specification Mini-Language. + (line 74) +* - (minus); unary operator: Unary arithmetic and bitwise operations. + (line 10) +* - (minus); unary operator <1>: Numeric Types — int float complex. + (line 27) +* -=; augmented assignment: Augmented assignment statements. + (line 6) +* ->; function annotations: Function Annotations. + (line 6) +* ->; function annotations <1>: Function definitions. + (line 109) +* , (comma): Parenthesized forms. + (line 20) +* , (comma); argument list: Slicings. (line 39) +* , (comma); expression list: List displays. (line 6) +* , (comma); expression list <1>: Set displays. (line 6) +* , (comma); expression list <2>: Expression lists. (line 6) +* , (comma); expression list <3>: The assert statement. + (line 6) +* , (comma); expression list <4>: Class definitions. (line 6) +* , (comma); identifier list: The global statement. + (line 6) +* , (comma); identifier list <1>: The nonlocal statement. + (line 6) +* , (comma); import statement: The import statement. + (line 6) +* , (comma); in dictionary displays: Dictionary displays. + (line 6) +* , (comma); in string formatting: Format Specification Mini-Language. + (line 124) +* , (comma); in target list: Assignment statements. + (line 35) +* , (comma); parameter list: Function definitions. + (line 6) +* , (comma); slicing: Slicings. (line 6) +* , (comma); with statement: The with statement. (line 6) +* ; (colon); annotated variable: Annotated assignment statements. + (line 6) +* ; (colon); compound statement: The if statement. (line 6) +* ; (colon); compound statement <1>: The while statement. + (line 6) +* ; (colon); compound statement <2>: The for statement. (line 6) +* ; (colon); compound statement <3>: The try statement. (line 6) +* ; (colon); compound statement <4>: The with statement. (line 6) +* ; (colon); compound statement <5>: The match statement. + (line 6) +* ; (colon); compound statement <6>: Function definitions. + (line 6) +* ; (colon); compound statement <7>: Class definitions. (line 6) +* ; (colon); function annotations: Function Annotations. + (line 6) +* ; (colon); function annotations <1>: Function definitions. + (line 109) +* ; (colon); in dictionary expressions: Dictionary displays. + (line 6) +* ; (colon); in formatted string literal: String literal concatenation. + (line 24) +* ; (colon); in formatted string literal <1>: String Methods<2>. + (line 753) +* ; (colon); in SQL statements: Cursor objects. (line 24) +* ; (colon); in string formatting: Format String Syntax. + (line 13) +* ; (colon); lambda expression: Lambdas. (line 6) +* ; (colon); path separator (POSIX): Miscellaneous System Information. + (line 138) +* ; (colon); slicing: Slicings. (line 6) +* ; (semicolon): Compound statements. + (line 18) +* ; (semicolon) <1>: Miscellaneous System Information. + (line 138) +* ;= (colon equals): Boolean operations. (line 38) +* ! (exclamation mark); in formatted string literal: String Methods<2>. + (line 753) +* ! (exclamation); in a command interpreter: Cmd Objects. (line 27) +* ! (exclamation); in curses module: curses ascii — Utilities for ASCII characters. + (line 229) +* ! (exclamation); in formatted string literal: String literal concatenation. + (line 24) +* ! (exclamation); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* ! (exclamation); in glob-style wildcards <1>: fnmatch — Unix filename pattern matching. + (line 15) +* ! (exclamation); in string formatting: Format String Syntax. + (line 13) +* ! (exclamation); in struct format strings: Byte Order Size and Alignment. + (line 13) +* ! (pdb command): Debugger Commands. (line 401) +* ! f-string: String Methods<2>. (line 753) +* ! formatted string literal: String Methods<2>. (line 753) +* ! patterns: Patterns. (line 6) +* ? (question mark); in a command interpreter: Cmd Objects. (line 27) +* ? (question mark); in argparse module: nargs. (line 24) +* ? (question mark); in AST grammar: Node classes. (line 22) +* ? (question mark); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* ? (question mark); in glob-style wildcards <1>: fnmatch — Unix filename pattern matching. + (line 15) +* ? (question mark); in regular expressions: Regular Expression Syntax. + (line 81) +* ? (question mark); in SQL statements: Cursor objects. (line 24) +* ? (question mark); in struct format strings: Format Characters. + (line 86) +* ? (question mark); in struct format strings <1>: Format Characters. + (line 168) +* ? (question mark); replacement character: Error Handlers. (line 15) +* ??; in regular expressions: Regular Expression Syntax. + (line 86) +* ?+; in regular expressions: Regular Expression Syntax. + (line 96) +* . (dot); attribute reference: Attribute references. + (line 6) +* . (dot); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* . (dot); in numeric literal: Integer literals. (line 40) +* . (dot); in pathnames: Miscellaneous System Information. + (line 104) +* . (dot); in pathnames <1>: Miscellaneous System Information. + (line 132) +* . (dot); in printf-style formatting: printf-style String Formatting. + (line 29) +* . (dot); in printf-style formatting <1>: printf-style Bytes Formatting. + (line 23) +* . (dot); in regular expressions: Regular Expression Syntax. + (line 46) +* . (dot); in string formatting: Format String Syntax. + (line 13) +* ..; in pathnames: Miscellaneous System Information. + (line 110) +* ...: Glossary. (line 10) +* ...; ellipsis literal: Ellipsis. (line 6) +* ...; ellipsis literal <1>: Built-in Constants. (line 59) +* ...; ellipsis literal <2>: The Null Object. (line 12) +* ...; in doctests: Option Flags. (line 47) +* ...; interpreter prompt: How are Docstring Examples Recognized?. + (line 26) +* ...; interpreter prompt <1>: sys — System-specific parameters and functions. + (line 1484) +* ...; placeholder: textwrap — Text wrapping and filling. + (line 276) +* ...; placeholder <1>: PrettyPrinter Objects. + (line 6) +* ...; placeholder <2>: reprlib — Alternate repr implementation. + (line 61) +* .ini; file: configparser — Configuration file parser. + (line 8) +* .pdbrc; file: Debugger Commands. (line 59) +* ' (single quote); string literal: Literals. (line 8) +* '''; string literal: String and Bytes literals. + (line 36) +* " (double quote); string literal: Literals. (line 8) +* """; string literal: String and Bytes literals. + (line 36) +* (?; in regular expressions: Regular Expression Syntax. + (line 248) +* (?;; in regular expressions: Regular Expression Syntax. + (line 287) +* (?!; in regular expressions: Regular Expression Syntax. + (line 405) +* (?(; in regular expressions: Regular Expression Syntax. + (line 448) +* (?#; in regular expressions: Regular Expression Syntax. + (line 394) +* (?: printf-style Bytes Formatting. + (line 23) +* () (parentheses); in regular expressions: Regular Expression Syntax. + (line 239) +* () (parentheses); tuple display: Parenthesized forms. + (line 6) +* [] (square brackets); in assignment target list: Assignment statements. + (line 35) +* [] (square brackets); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* [] (square brackets); in glob-style wildcards <1>: fnmatch — Unix filename pattern matching. + (line 15) +* [] (square brackets); in regular expressions: Regular Expression Syntax. + (line 171) +* [] (square brackets); in string formatting: Format String Syntax. + (line 13) +* [] (square brackets); list expression: List displays. (line 6) +* [] (square brackets); subscription: Subscriptions. (line 6) +* {} (curly brackets); dictionary expression: Dictionary displays. + (line 6) +* {} (curly brackets); in formatted string literal: String literal concatenation. + (line 24) +* {} (curly brackets); in formatted string literal <1>: String Methods<2>. + (line 753) +* {} (curly brackets); in regular expressions: Regular Expression Syntax. + (line 115) +* {} (curly brackets); in string formatting: Format String Syntax. + (line 13) +* {} (curly brackets); set expression: Set displays. (line 6) +* @ (at); class definition: Class definitions. (line 44) +* @ (at); function definition: Function definitions. + (line 35) +* @ (at); in struct format strings: Byte Order Size and Alignment. + (line 13) +* * (asterisk); function definition: Function definitions. + (line 93) +* * (asterisk); import statement: The import statement. + (line 80) +* * (asterisk); in argparse module: nargs. (line 57) +* * (asterisk); in assignment target list: Assignment statements. + (line 35) +* * (asterisk); in AST grammar: Node classes. (line 22) +* * (asterisk); in expression lists: Expression lists. (line 18) +* * (asterisk); in function calls: Arbitrary Argument Lists. + (line 6) +* * (asterisk); in function calls <1>: Calls. (line 73) +* * (asterisk); in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 10) +* * (asterisk); in glob-style wildcards <1>: fnmatch — Unix filename pattern matching. + (line 15) +* * (asterisk); in printf-style formatting: printf-style String Formatting. + (line 29) +* * (asterisk); in printf-style formatting <1>: printf-style Bytes Formatting. + (line 23) +* * (asterisk); in regular expressions: Regular Expression Syntax. + (line 69) +* *?; in regular expressions: Regular Expression Syntax. + (line 86) +* **; function definition: Function definitions. + (line 93) +* **; in dictionary displays: Dictionary displays. + (line 23) +* **; in function calls: Unpacking Argument Lists. + (line 19) +* **; in function calls <1>: Calls. (line 100) +* **; in glob-style wildcards: glob — Unix style pathname pattern expansion. + (line 51) +* **=; augmented assignment: Augmented assignment statements. + (line 6) +* *+; in regular expressions: Regular Expression Syntax. + (line 96) +* *=; augmented assignment: Augmented assignment statements. + (line 6) +* / (slash); function definition: Function definitions. + (line 93) +* / (slash); in pathnames: Miscellaneous System Information. + (line 116) +* / (slash); in pathnames <1>: Miscellaneous System Information. + (line 125) +* //=; augmented assignment: Augmented assignment statements. + (line 6) +* /=; augmented assignment: Augmented assignment statements. + (line 6) +* \ (backslash); escape sequence: String and Bytes literals. + (line 74) +* \ (backslash); escape sequence <1>: Error Handlers. (line 15) +* \ (backslash); in pathnames (Windows): Miscellaneous System Information. + (line 116) +* \ (backslash); in regular expressions: Regular Expression Syntax. + (line 156) +* \ (backslash); in regular expressions <1>: Regular Expression Syntax. + (line 190) +* \ (backslash); in regular expressions <2>: Regular Expression Syntax. + (line 467) +* \\; escape sequence: String and Bytes literals. + (line 74) +* \\; in regular expressions: Regular Expression Syntax. + (line 594) +* \a; escape sequence: String and Bytes literals. + (line 74) +* \A; in regular expressions: Regular Expression Syntax. + (line 479) +* \a; in regular expressions: Regular Expression Syntax. + (line 594) +* \b; escape sequence: String and Bytes literals. + (line 74) +* \b; in regular expressions: Regular Expression Syntax. + (line 483) +* \B; in regular expressions: Regular Expression Syntax. + (line 501) +* \b; in regular expressions <1>: Regular Expression Syntax. + (line 594) +* \d; in regular expressions: Regular Expression Syntax. + (line 517) +* \D; in regular expressions: Regular Expression Syntax. + (line 532) +* \f; escape sequence: String and Bytes literals. + (line 74) +* \f; in regular expressions: Regular Expression Syntax. + (line 594) +* \g; in regular expressions: Functions<2>. (line 213) +* \n; escape sequence: String and Bytes literals. + (line 74) +* \N; escape sequence: String and Bytes literals. + (line 74) +* \N; escape sequence <1>: Error Handlers. (line 54) +* \n; in regular expressions: Regular Expression Syntax. + (line 594) +* \N; in regular expressions: Regular Expression Syntax. + (line 594) +* \r; escape sequence: String and Bytes literals. + (line 74) +* \r; in regular expressions: Regular Expression Syntax. + (line 594) +* \s; in regular expressions: Regular Expression Syntax. + (line 539) +* \S; in regular expressions: Regular Expression Syntax. + (line 555) +* \t; escape sequence: String and Bytes literals. + (line 74) +* \t; in regular expressions: Regular Expression Syntax. + (line 594) +* \u; escape sequence: String and Bytes literals. + (line 74) +* \U; escape sequence: String and Bytes literals. + (line 74) +* \u; escape sequence <1>: Error Handlers. (line 15) +* \U; escape sequence <1>: Error Handlers. (line 15) +* \u; in regular expressions: Regular Expression Syntax. + (line 594) +* \U; in regular expressions: Regular Expression Syntax. + (line 594) +* \v; escape sequence: String and Bytes literals. + (line 74) +* \v; in regular expressions: Regular Expression Syntax. + (line 594) +* \w; in regular expressions: Regular Expression Syntax. + (line 562) +* \W; in regular expressions: Regular Expression Syntax. + (line 579) +* \x; escape sequence: String and Bytes literals. + (line 74) +* \x; escape sequence <1>: Error Handlers. (line 15) +* \x; in regular expressions: Regular Expression Syntax. + (line 594) +* \Z; in regular expressions: Regular Expression Syntax. + (line 590) +* &=; augmented assignment: Augmented assignment statements. + (line 6) +* # (hash); comment: An Informal Introduction to Python. + (line 14) +* # (hash); comment <1>: Comments. (line 6) +* # (hash); comment <2>: site — Site-specific configuration hook. + (line 52) +* # (hash); in doctests: Option Flags. (line 165) +* # (hash); in printf-style formatting: printf-style String Formatting. + (line 69) +* # (hash); in printf-style formatting <1>: printf-style Bytes Formatting. + (line 63) +* # (hash); in regular expressions: Flags. (line 130) +* # (hash); in string formatting: Format Specification Mini-Language. + (line 96) +* # (hash); source encoding declaration: Encoding declarations. + (line 6) +* % (percent); datetime format: timezone Objects. (line 71) +* % (percent); datetime format <1>: Functions<5>. (line 319) +* % (percent); datetime format <2>: Functions<5>. (line 478) +* % (percent); environment variables expansion (Windows): os path — Common pathname manipulations. + (line 155) +* % (percent); environment variables expansion (Windows) <1>: Functions<13>. + (line 228) +* % (percent); interpolation in configuration files: Interpolation of values. + (line 10) +* % (percent); printf-style formatting: printf-style String Formatting. + (line 6) +* % (percent); printf-style formatting <1>: printf-style Bytes Formatting. + (line 6) +* %=; augmented assignment: Augmented assignment statements. + (line 6) +* %APPDATA%: Redirection of local data registry and temporary paths. + (line 13) +* ^ (caret); in curses module: curses ascii — Utilities for ASCII characters. + (line 229) +* ^ (caret); in regular expressions: Regular Expression Syntax. + (line 53) +* ^ (caret); in regular expressions <1>: Regular Expression Syntax. + (line 200) +* ^ (caret); in string formatting: Format Specification Mini-Language. + (line 44) +* ^ (caret); marker: What About Exceptions?. + (line 93) +* ^ (caret); marker <1>: Module-Level Functions<2>. + (line 36) +* ^=; augmented assignment: Augmented assignment statements. + (line 6) +* + (plus); binary operator: Binary arithmetic operations. + (line 74) +* + (plus); binary operator <1>: Numeric Types — int float complex. + (line 27) +* + (plus); in argparse module: nargs. (line 69) +* + (plus); in doctests: Option Flags. (line 165) +* + (plus); in printf-style formatting: printf-style String Formatting. + (line 69) +* + (plus); in printf-style formatting <1>: printf-style Bytes Formatting. + (line 63) +* + (plus); in regular expressions: Regular Expression Syntax. + (line 75) +* + (plus); in string formatting: Format Specification Mini-Language. + (line 74) +* + (plus); unary operator: Unary arithmetic and bitwise operations. + (line 14) +* + (plus); unary operator <1>: Numeric Types — int float complex. + (line 27) +* +?; in regular expressions: Regular Expression Syntax. + (line 86) +* ++; in regular expressions: Regular Expression Syntax. + (line 96) +* +=; augmented assignment: Augmented assignment statements. + (line 6) +* < (less); in string formatting: Format Specification Mini-Language. + (line 44) +* < (less); in struct format strings: Byte Order Size and Alignment. + (line 13) +* <<=; augmented assignment: Augmented assignment statements. + (line 6) +* : Option Flags. (line 28) +* = (equals); assignment statement: Assignment statements. + (line 6) +* = (equals); class definition: Metaclasses. (line 6) +* = (equals); for help in debugging using string literals: String literal concatenation. + (line 24) +* = (equals); for help in debugging using string literals <1>: String Methods<2>. + (line 752) +* = (equals); function definition: Function definitions. + (line 68) +* = (equals); in function calls: Slicings. (line 38) +* = (equals); in string formatting: Format Specification Mini-Language. + (line 44) +* = (equals); in struct format strings: Byte Order Size and Alignment. + (line 13) +* > (greater); in string formatting: Format Specification Mini-Language. + (line 44) +* > (greater); in struct format strings: Byte Order Size and Alignment. + (line 13) +* >>=; augmented assignment: Augmented assignment statements. + (line 6) +* >>>: Glossary. (line 6) +* >>>; interpreter prompt: How are Docstring Examples Recognized?. + (line 26) +* >>>; interpreter prompt <1>: sys — System-specific parameters and functions. + (line 1484) +* | (vertical bar); in regular expressions: Regular Expression Syntax. + (line 226) +* |=; augmented assignment: Augmented assignment statements. + (line 6) +* ~ (tilde); home directory expansion: os path — Common pathname manipulations. + (line 131) +* $ (dollar); environment variables expansion: os path — Common pathname manipulations. + (line 155) +* $ (dollar); in regular expressions: Regular Expression Syntax. + (line 58) +* $ (dollar); in template strings: Template strings. (line 13) +* $ (dollar); interpolation in configuration files: Interpolation of values. + (line 41) +* 0b; integer literal: Numeric literals. (line 14) +* 0o; integer literal: Numeric literals. (line 14) +* 0x; integer literal: Numeric literals. (line 14) +* 2-digit years: time — Time access and conversions. + (line 34) +* A (in module re): Flags. (line 16) +* A_ALTCHARSET (in module curses): Constants<6>. (line 67) +* A_ATTRIBUTES (in module curses): Constants<6>. (line 128) +* A_BLINK (in module curses): Constants<6>. (line 70) +* A_BOLD (in module curses): Constants<6>. (line 73) +* A_CHARTEXT (in module curses): Constants<6>. (line 131) +* A_COLOR (in module curses): Constants<6>. (line 134) +* A_DIM (in module curses): Constants<6>. (line 76) +* A_HORIZONTAL (in module curses): Constants<6>. (line 101) +* A_INVIS (in module curses): Constants<6>. (line 79) +* A_ITALIC (in module curses): Constants<6>. (line 82) +* A_LEFT (in module curses): Constants<6>. (line 104) +* A_LOW (in module curses): Constants<6>. (line 107) +* A_NORMAL (in module curses): Constants<6>. (line 85) +* A_PROTECT (in module curses): Constants<6>. (line 88) +* A_REVERSE (in module curses): Constants<6>. (line 91) +* A_RIGHT (in module curses): Constants<6>. (line 110) +* A_STANDOUT (in module curses): Constants<6>. (line 95) +* A_TOP (in module curses): Constants<6>. (line 113) +* A_UNDERLINE (in module curses): Constants<6>. (line 98) +* A_VERTICAL (in module curses): Constants<6>. (line 116) +* a2b_base64() (in module binascii): binascii — Convert between binary and ASCII. + (line 40) +* a2b_hex() (in module binascii): binascii — Convert between binary and ASCII. + (line 144) +* a2b_qp() (in module binascii): binascii — Convert between binary and ASCII. + (line 70) +* a2b_uu() (in module binascii): binascii — Convert between binary and ASCII. + (line 25) +* a85decode() (in module base64): Base85 Encodings. (line 52) +* a85encode() (in module base64): Base85 Encodings. (line 28) +* ABC (class in abc): abc — Abstract Base Classes. + (line 27) +* ABCMeta (class in abc): abc — Abstract Base Classes. + (line 52) +* ABDAY_1 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_2 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_3 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_4 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_5 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_6 (in module locale): locale — Internationalization services. + (line 229) +* ABDAY_7 (in module locale): locale — Internationalization services. + (line 229) +* abiflags (in module sys): sys — System-specific parameters and functions. + (line 13) +* ABMON_1 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_10 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_11 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_12 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_2 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_3 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_4 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_5 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_6 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_7 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_8 (in module locale): locale — Internationalization services. + (line 254) +* ABMON_9 (in module locale): locale — Internationalization services. + (line 254) +* abort (C function): Process Control. (line 7) +* ABORT (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 147) +* abort_clients() (asyncio.Server method): Server Objects. (line 56) +* abort() (asyncio.Barrier method): Barrier. (line 87) +* abort() (asyncio.DatagramTransport method): Datagram Transports. + (line 20) +* abort() (asyncio.WriteTransport method): Write-only Transports. + (line 6) +* abort() (ftplib.FTP method): FTP objects. (line 152) +* abort() (in module os): Process Management. (line 16) +* abort() (threading.Barrier method): Barrier objects. (line 82) +* ABORTRETRYIGNORE (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 162) +* ABOVE_NORMAL_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 68) +* above() (curses.panel.Panel method): Panel Objects. (line 13) +* abs() (decimal.Context method): Context objects. (line 261) +* abs() (in module operator): operator — Standard operators as functions. + (line 73) +* absolute_import (in module __future__): Module Contents<5>. + (line 26) +* absolute() (pathlib.Path method): Expanding and resolving paths. + (line 38) +* AbsoluteLinkError: tarfile — Read and write tar archive files. + (line 253) +* AbsolutePathError: tarfile — Read and write tar archive files. + (line 239) +* abspath() (in module os.path): os path — Common pathname manipulations. + (line 49) +* abstract base class: Glossary. (line 23) +* AbstractAsyncContextManager (class in contextlib): Utilities. + (line 19) +* AbstractBasicAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 340) +* AbstractChildWatcher (class in asyncio): Process Watchers. (line 43) +* abstractclassmethod() (in module abc): abc — Abstract Base Classes. + (line 238) +* AbstractContextManager (class in contextlib): Utilities. (line 8) +* AbstractDigestAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 379) +* AbstractEventLoop (class in asyncio): Event Loop Implementations. + (line 54) +* AbstractEventLoopPolicy (class in asyncio): Policy Objects. + (line 8) +* abstractmethod() (in module abc): abc — Abstract Base Classes. + (line 161) +* abstractproperty() (in module abc): abc — Abstract Base Classes. + (line 282) +* AbstractSet (class in typing): Aliases to container ABCs in collections abc. + (line 6) +* abstractstaticmethod() (in module abc): abc — Abstract Base Classes. + (line 260) +* accept() (multiprocessing.connection.Listener method): Listeners and Clients. + (line 84) +* accept() (socket.socket method): Socket Objects. (line 13) +* access() (in module os): Files and Directories. + (line 51) +* accumulate() (in module itertools): Itertool Functions. (line 10) +* ACK (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 37) +* aclose() (agen method): Asynchronous generator-iterator methods. + (line 61) +* aclose() (contextlib.AsyncExitStack method): Utilities. (line 650) +* aclosing() (in module contextlib): Utilities. (line 187) +* acos() (in module cmath): Trigonometric functions<2>. + (line 6) +* acos() (in module math): Trigonometric functions. + (line 6) +* acosh() (in module cmath): Hyperbolic functions<2>. + (line 6) +* acosh() (in module math): Hyperbolic functions. + (line 9) +* acquire() (_thread.lock method): _thread — Low-level threading API. + (line 145) +* acquire() (asyncio.Condition method): Condition. (line 47) +* acquire() (asyncio.Lock method): Lock. (line 35) +* acquire() (asyncio.Semaphore method): Semaphore. (line 42) +* acquire() (logging.Handler method): Handler Objects. (line 26) +* acquire() (multiprocessing.Lock method): Synchronization primitives. + (line 64) +* acquire() (multiprocessing.RLock method): Synchronization primitives. + (line 118) +* acquire() (threading.Condition method): Condition objects. (line 85) +* acquire() (threading.Lock method): Lock objects. (line 43) +* acquire() (threading.RLock method): RLock objects. (line 44) +* acquire() (threading.Semaphore method): Semaphore objects. (line 34) +* ACS_BBSS (in module curses): Constants<6>. (line 472) +* ACS_BLOCK (in module curses): Constants<6>. (line 475) +* ACS_BOARD (in module curses): Constants<6>. (line 478) +* ACS_BSBS (in module curses): Constants<6>. (line 481) +* ACS_BSSB (in module curses): Constants<6>. (line 484) +* ACS_BSSS (in module curses): Constants<6>. (line 487) +* ACS_BTEE (in module curses): Constants<6>. (line 490) +* ACS_BULLET (in module curses): Constants<6>. (line 493) +* ACS_CKBOARD (in module curses): Constants<6>. (line 496) +* ACS_DARROW (in module curses): Constants<6>. (line 499) +* ACS_DEGREE (in module curses): Constants<6>. (line 502) +* ACS_DIAMOND (in module curses): Constants<6>. (line 505) +* ACS_GEQUAL (in module curses): Constants<6>. (line 508) +* ACS_HLINE (in module curses): Constants<6>. (line 511) +* ACS_LANTERN (in module curses): Constants<6>. (line 514) +* ACS_LARROW (in module curses): Constants<6>. (line 517) +* ACS_LEQUAL (in module curses): Constants<6>. (line 520) +* ACS_LLCORNER (in module curses): Constants<6>. (line 523) +* ACS_LRCORNER (in module curses): Constants<6>. (line 526) +* ACS_LTEE (in module curses): Constants<6>. (line 529) +* ACS_NEQUAL (in module curses): Constants<6>. (line 532) +* ACS_PI (in module curses): Constants<6>. (line 535) +* ACS_PLMINUS (in module curses): Constants<6>. (line 538) +* ACS_PLUS (in module curses): Constants<6>. (line 541) +* ACS_RARROW (in module curses): Constants<6>. (line 544) +* ACS_RTEE (in module curses): Constants<6>. (line 547) +* ACS_S1 (in module curses): Constants<6>. (line 550) +* ACS_S3 (in module curses): Constants<6>. (line 553) +* ACS_S7 (in module curses): Constants<6>. (line 556) +* ACS_S9 (in module curses): Constants<6>. (line 559) +* ACS_SBBS (in module curses): Constants<6>. (line 562) +* ACS_SBSB (in module curses): Constants<6>. (line 565) +* ACS_SBSS (in module curses): Constants<6>. (line 568) +* ACS_SSBB (in module curses): Constants<6>. (line 571) +* ACS_SSBS (in module curses): Constants<6>. (line 574) +* ACS_SSSB (in module curses): Constants<6>. (line 577) +* ACS_SSSS (in module curses): Constants<6>. (line 580) +* ACS_STERLING (in module curses): Constants<6>. (line 583) +* ACS_TTEE (in module curses): Constants<6>. (line 586) +* ACS_UARROW (in module curses): Constants<6>. (line 589) +* ACS_ULCORNER (in module curses): Constants<6>. (line 592) +* ACS_URCORNER (in module curses): Constants<6>. (line 595) +* ACS_VLINE (in module curses): Constants<6>. (line 598) +* Action (class in argparse): Action classes. (line 11) +* action (optparse.Option attribute): Option attributes. (line 19) +* ACTIONS (optparse.Option attribute): Adding new actions. (line 31) +* activate_stack_trampoline() (in module sys): sys — System-specific parameters and functions. + (line 1748) +* active_children() (in module multiprocessing): Miscellaneous<3>. + (line 6) +* active_count() (in module threading): Reference<2>. (line 8) +* actual() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 47) +* Add (class in ast): Expressions<2>. (line 53) +* add_alias() (in module email.charset): email charset Representing character sets. + (line 193) +* add_alternative() (email.message.EmailMessage method): email message Representing an email message. + (line 640) +* add_argument_group() (argparse.ArgumentParser method): Argument groups. + (line 6) +* add_argument() (argparse.ArgumentParser method): The add_argument method. + (line 6) +* add_attachment() (email.message.EmailMessage method): email message Representing an email message. + (line 652) +* add_cgi_vars() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 135) +* add_charset() (in module email.charset): email charset Representing character sets. + (line 164) +* add_child_handler() (asyncio.AbstractChildWatcher method): Process Watchers. + (line 45) +* add_codec() (in module email.charset): email charset Representing character sets. + (line 202) +* add_cookie_header() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 11) +* add_dll_directory() (in module os): Process Management. (line 24) +* add_done_callback() (asyncio.Future method): Future Object. + (line 81) +* add_done_callback() (asyncio.Task method): Task Object. (line 101) +* add_done_callback() (concurrent.futures.Future method): Future Objects. + (line 66) +* add_fallback() (gettext.NullTranslations method): The NullTranslations class. + (line 28) +* add_flag() (mailbox.Maildir method): Maildir objects. (line 129) +* add_flag() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 76) +* add_flag() (mailbox.mboxMessage method): mboxMessage objects. + (line 79) +* add_flag() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 78) +* add_folder() (mailbox.Maildir method): Maildir objects. (line 75) +* add_folder() (mailbox.MH method): MH objects. (line 45) +* add_get_handler() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content. + (line 75) +* add_handler() (urllib.request.OpenerDirector method): OpenerDirector Objects. + (line 8) +* add_header() (email.message.EmailMessage method): email message Representing an email message. + (line 260) +* add_header() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 370) +* add_header() (urllib.request.Request method): Request Objects. + (line 79) +* add_header() (wsgiref.headers.Headers method): wsgiref headers – WSGI response header tools. + (line 61) +* add_history() (in module readline): History list. (line 38) +* add_label() (mailbox.BabylMessage method): BabylMessage objects. + (line 55) +* add_mutually_exclusive_group() (argparse.ArgumentParser method): Mutual exclusion. + (line 6) +* add_note() (BaseException method): Base classes. (line 50) +* add_option() (optparse.OptionParser method): Defining options. + (line 14) +* add_parent() (urllib.request.BaseHandler method): BaseHandler Objects. + (line 10) +* add_password() (urllib.request.HTTPPasswordMgr method): HTTPPasswordMgr Objects. + (line 9) +* add_password() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects. + (line 10) +* add_reader() (asyncio.loop method): Watching file descriptors. + (line 6) +* add_related() (email.message.EmailMessage method): email message Representing an email message. + (line 627) +* add_section() (configparser.ConfigParser method): ConfigParser Objects. + (line 121) +* add_section() (configparser.RawConfigParser method): RawConfigParser Objects. + (line 37) +* add_sequence() (mailbox.MHMessage method): MHMessage objects. + (line 41) +* add_set_handler() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content. + (line 80) +* add_signal_handler() (asyncio.loop method): Unix signals. (line 6) +* add_subparsers() (argparse.ArgumentParser method): Sub-commands. + (line 6) +* add_type() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 121) +* add_type() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 104) +* add_unredirected_header() (urllib.request.Request method): Request Objects. + (line 91) +* add_writer() (asyncio.loop method): Watching file descriptors. + (line 20) +* add() (decimal.Context method): Context objects. (line 265) +* add() (frozenset method): Set Types — set frozenset. + (line 195) +* add() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 81) +* add() (in module operator): operator — Standard operators as functions. + (line 78) +* add() (mailbox.Mailbox method): Mailbox objects. (line 59) +* add() (mailbox.Maildir method): Maildir objects. (line 193) +* add() (pstats.Stats method): The Stats Class. (line 49) +* add() (tarfile.TarFile method): TarFile Objects. (line 273) +* add() (tkinter.ttk.Notebook method): ttk Notebook. (line 8) +* addAsyncCleanup() (unittest.IsolatedAsyncioTestCase method): Test cases. + (line 892) +* addaudithook() (in module sys): sys — System-specific parameters and functions. + (line 26) +* addch() (curses.window method): Window Objects. (line 9) +* addClassCleanup() (unittest.TestCase class method): Test cases. + (line 811) +* addCleanup() (unittest.TestCase method): Test cases. (line 771) +* addcomponent() (turtle.Shape method): Public classes. (line 66) +* addDuration() (unittest.TestResult method): Loading and running tests. + (line 438) +* addError() (unittest.TestResult method): Loading and running tests. + (line 368) +* addExpectedFailure() (unittest.TestResult method): Loading and running tests. + (line 404) +* addFailure() (unittest.TestResult method): Loading and running tests. + (line 379) +* addfile() (tarfile.TarFile method): TarFile Objects. (line 291) +* addFilter() (logging.Handler method): Handler Objects. (line 53) +* addFilter() (logging.Logger method): Logger Objects. (line 325) +* addHandler() (logging.Logger method): Logger Objects. (line 342) +* addinfourl (class in urllib.response): urllib response — Response classes used by urllib. + (line 12) +* addition: Binary arithmetic operations. + (line 74) +* addLevelName() (in module logging): Module-Level Functions. + (line 128) +* addModuleCleanup() (in module unittest): setUpModule and tearDownModule. + (line 22) +* addnstr() (curses.window method): Window Objects. (line 23) +* AddPackagePath() (in module modulefinder): modulefinder — Find modules used by a script. + (line 16) +* addr_spec (email.headerregistry.Address attribute): email headerregistry Custom Header Objects. + (line 441) +* Address (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 403) +* address (email.headerregistry.SingleAddressHeader attribute): email headerregistry Custom Header Objects. + (line 222) +* address (multiprocessing.connection.Listener attribute): Listeners and Clients. + (line 99) +* address (multiprocessing.managers.BaseManager attribute): Managers. + (line 137) +* address_exclude() (ipaddress.IPv4Network method): Network objects. + (line 160) +* address_exclude() (ipaddress.IPv6Network method): Network objects. + (line 342) +* address_family (socketserver.BaseServer attribute): Server Objects<2>. + (line 65) +* address_string() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 333) +* addresses (email.headerregistry.AddressHeader attribute): email headerregistry Custom Header Objects. + (line 195) +* addresses (email.headerregistry.Group attribute): email headerregistry Custom Header Objects. + (line 477) +* AddressHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 180) +* addressof() (in module ctypes): Utility functions. (line 6) +* AddressValueError: Custom Exceptions. (line 9) +* addshape() (in module turtle): Settings and special methods. + (line 71) +* addsitedir() (in module site): Module contents<5>. (line 52) +* addSkip() (unittest.TestResult method): Loading and running tests. + (line 396) +* addstr() (curses.window method): Window Objects. (line 31) +* addSubTest() (unittest.TestResult method): Loading and running tests. + (line 422) +* addSuccess() (unittest.TestResult method): Loading and running tests. + (line 390) +* addTest() (unittest.TestSuite method): Grouping tests. (line 25) +* addTests() (unittest.TestSuite method): Grouping tests. (line 30) +* addTypeEqualityFunc() (unittest.TestCase method): Test cases. + (line 588) +* addUnexpectedSuccess() (unittest.TestResult method): Loading and running tests. + (line 414) +* adjust_int_max_str_digits() (in module test.support): test support — Utilities for the Python test suite. + (line 738) +* adjusted() (decimal.Decimal method): Decimal objects. (line 116) +* adler32() (in module zlib): zlib — Compression compatible with gzip. + (line 28) +* AF_ALG (in module socket): Constants<8>. (line 263) +* AF_CAN (in module socket): Constants<8>. (line 126) +* AF_DIVERT (in module socket): Constants<8>. (line 202) +* AF_HYPERV (in module socket): Constants<8>. (line 344) +* AF_INET (in module socket): Constants<8>. (line 11) +* AF_INET6 (in module socket): Constants<8>. (line 11) +* AF_LINK (in module socket): Constants<8>. (line 287) +* AF_PACKET (in module socket): Constants<8>. (line 212) +* AF_QIPCRTR (in module socket): Constants<8>. (line 314) +* AF_RDS (in module socket): Constants<8>. (line 234) +* AF_UNIX (in module socket): Constants<8>. (line 11) +* AF_UNSPEC (in module socket): Constants<8>. (line 21) +* AF_VSOCK (in module socket): Constants<8>. (line 274) +* alarm() (in module signal): Module contents<2>. (line 269) +* ALERT_DESCRIPTION_HANDSHAKE_FAILURE (in module ssl): Constants<9>. + (line 510) +* ALERT_DESCRIPTION_INTERNAL_ERROR (in module ssl): Constants<9>. + (line 510) +* AlertDescription (class in ssl): Constants<9>. (line 524) +* algorithm (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1057) +* algorithms_available (in module hashlib): Attributes. (line 17) +* algorithms_guaranteed (in module hashlib): Attributes. (line 8) +* alias (class in ast): Imports. (line 38) +* alias (pdb command): Debugger Commands. (line 373) +* alignment() (in module ctypes): Utility functions. (line 14) +* alive (weakref.finalize attribute): weakref — Weak references. + (line 312) +* ALL_COMPLETED (in module asyncio): Waiting Primitives. (line 45) +* ALL_COMPLETED (in module concurrent.futures): Module Functions. + (line 40) +* all_errors (in module ftplib): Module variables. (line 27) +* all_features (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 95) +* all_frames (tracemalloc.Filter attribute): Filter. (line 58) +* all_properties (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 127) +* all_suffixes() (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 57) +* all_tasks() (in module asyncio): Introspection. (line 16) +* allocate_lock() (in module _thread): _thread — Low-level threading API. + (line 83) +* allocfunc (C type): Slot Type typedefs. (line 6) +* ALLOW_MISSING (in module os.path): os path — Common pathname manipulations. + (line 403) +* allow_reuse_address (socketserver.BaseServer attribute): Server Objects<2>. + (line 95) +* allowed_domains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 65) +* ALT_DIGITS (in module locale): locale — Internationalization services. + (line 334) +* alt() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 221) +* altsep (in module os): Miscellaneous System Information. + (line 125) +* altzone (in module time): Timezone Constants. (line 6) +* ALWAYS_EQ (in module test.support): test support — Utilities for the Python test suite. + (line 175) +* ALWAYS_TYPED_ACTIONS (optparse.Option attribute): Adding new actions. + (line 43) +* AmbiguousOptionError: Exceptions<10>. (line 25) +* AMPER (in module token): token — Constants used with Python parse trees. + (line 212) +* AMPEREQUAL (in module token): token — Constants used with Python parse trees. + (line 278) +* Anchor (class in importlib.resources): importlib resources – Package resource reading opening and access. + (line 46) +* anchor (pathlib.PurePath attribute): Methods and properties. + (line 65) +* And (class in ast): Expressions<2>. (line 86) +* and_() (in module operator): operator — Standard operators as functions. + (line 83) +* android_ver() (in module platform): Android platform. (line 6) +* AnnAssign (class in ast): Statements. (line 41) +* Annotated (in module typing): Special forms. (line 290) +* annotated; assignment: Annotated assignment statements. + (line 6) +* annotation: Glossary. (line 37) +* annotation (inspect.Parameter attribute): Introspecting callables with the Signature object. + (line 223) +* ANNOTATION (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 26) +* annotation; type annotation; type hint: Type Annotation Types — Generic Alias Union. + (line 6) +* annotations (in module __future__): Module Contents<5>. (line 47) +* anonymous; function: Lambdas. (line 6) +* answer_challenge() (in module multiprocessing.connection): Listeners and Clients. + (line 25) +* anticipate_failure() (in module test.support): test support — Utilities for the Python test suite. + (line 451) +* Any (in module typing): Special types. (line 9) +* ANY (in module unittest.mock): ANY. (line 6) +* ANY_CONTIGUOUS (inspect.BufferFlags attribute): Buffer flags. + (line 29) +* AnyStr (in module typing): Special types. (line 21) +* api_version (in module sys): sys — System-specific parameters and functions. + (line 2017) +* apilevel (in module sqlite3): Module constants. (line 65) +* apop() (poplib.POP3 method): POP3 Objects. (line 42) +* APPDATA: PEP 370 Per-user site-packages Directory. + (line 26) +* append_history_file() (in module readline): History file. (line 20) +* append() (array.array method): array — Efficient arrays of numeric values. + (line 121) +* append() (collections.deque method): deque objects. (line 35) +* append() (email.header.Header method): email header Internationalized headers. + (line 96) +* append() (imaplib.IMAP4 method): IMAP4 Objects. (line 33) +* append() (sequence method): Mutable Sequence Types. + (line 16) +* append() (xml.etree.ElementTree.Element method): Element Objects. + (line 87) +* appendChild() (xml.dom.Node method): Node Objects. (line 115) +* appendleft() (collections.deque method): deque objects. (line 39) +* AppleFrameworkLoader (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 442) +* application_uri() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 34) +* apply_async() (multiprocessing.pool.Pool method): Process Pools. + (line 75) +* apply_defaults() (inspect.BoundArguments method): Introspecting callables with the Signature object. + (line 368) +* apply() (multiprocessing.pool.Pool method): Process Pools. (line 67) +* APRIL (in module calendar): calendar — General calendar-related functions. + (line 490) +* architecture() (in module platform): Cross platform. (line 6) +* archive (zipimport.zipimporter attribute): zipimporter Objects. + (line 96) +* AREGTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 278) +* aRepr (in module reprlib): reprlib — Alternate repr implementation. + (line 44) +* arg (class in ast): Function and class definitions. + (line 68) +* args (BaseException attribute): Base classes. (line 17) +* args (functools.partial attribute): partial Objects. (line 15) +* args (inspect.BoundArguments attribute): Introspecting callables with the Signature object. + (line 353) +* args (pdb command): Debugger Commands. (line 263) +* args (subprocess.CompletedProcess attribute): Using the subprocess Module. + (line 105) +* args (subprocess.Popen attribute): Popen Objects. (line 101) +* args (typing.ParamSpec attribute): Building generic types and type aliases. + (line 408) +* args_from_interpreter_flags() (in module test.support): test support — Utilities for the Python test suite. + (line 318) +* argtypes (ctypes._CFuncPtr attribute): Foreign functions. (line 46) +* argument: Glossary. (line 53) +* argument; call semantics: Slicings. (line 39) +* argument; difference from parameter: How can I pass optional or keyword parameters from one function to another?. + (line 17) +* argument; function definition: Function definitions. + (line 68) +* ArgumentDefaultsHelpFormatter (class in argparse): formatter_class. + (line 10) +* ArgumentError: Foreign functions. (line 94) +* ArgumentError <1>: Exceptions<9>. (line 6) +* ArgumentParser (class in argparse): ArgumentParser objects. + (line 6) +* arguments (class in ast): Function and class definitions. + (line 49) +* arguments (inspect.BoundArguments attribute): Introspecting callables with the Signature object. + (line 334) +* ArgumentTypeError: Exceptions<9>. (line 14) +* argv (in module sys): sys — System-specific parameters and functions. + (line 70) +* argv (in module sys) <1>: Process-wide parameters. + (line 218) +* argv (in module sys) <2>: PyConfig. (line 130) +* arithmetic: Numeric Types — int float complex. + (line 27) +* arithmetic; conversion: Arithmetic conversions. + (line 6) +* ArithmeticError: Base classes. (line 72) +* array (class in array): array — Efficient arrays of numeric values. + (line 88) +* Array (class in ctypes): Arrays and pointers. + (line 6) +* ARRAY() (in module ctypes): Arrays and pointers. + (line 31) +* Array() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 51) +* Array() (in module multiprocessing): Shared ctypes Objects. + (line 42) +* Array() (multiprocessing.managers.SyncManager method): Managers. + (line 213) +* arrays: array — Efficient arrays of numeric values. + (line 6) +* arraysize (sqlite3.Cursor attribute): Cursor objects. (line 170) +* AS pattern, OR pattern, capture pattern, wildcard pattern: Patterns. + (line 6) +* as_bytes() (email.message.EmailMessage method): email message Representing an email message. + (line 107) +* as_bytes() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 106) +* as_completed() (in module asyncio): Waiting Primitives. (line 60) +* as_completed() (in module concurrent.futures): Module Functions. + (line 44) +* as_file() (in module importlib.resources): importlib resources – Package resource reading opening and access. + (line 74) +* as_integer_ratio() (decimal.Decimal method): Decimal objects. + (line 124) +* as_integer_ratio() (float method): Additional Methods on Float. + (line 9) +* as_integer_ratio() (fractions.Fraction method): fractions — Rational numbers. + (line 124) +* as_integer_ratio() (int method): Additional Methods on Integer Types. + (line 162) +* as_posix() (pathlib.PurePath method): Methods and properties. + (line 172) +* as_string() (email.message.EmailMessage method): email message Representing an email message. + (line 61) +* as_string() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 60) +* as_tuple() (decimal.Decimal method): Decimal objects. (line 138) +* as_uri() (pathlib.Path method): Parsing and generating URIs. + (line 42) +* as; except clause: except clause. (line 30) +* as; import statement: The import statement. + (line 39) +* as; match statement: The match statement. + (line 6) +* as; with statement: The with statement. (line 6) +* ASCII: Notation. (line 32) +* ASCII <1>: Literals. (line 8) +* ASCII (in module re): Flags. (line 16) +* ascii_letters (in module string): String constants. (line 8) +* ascii_lowercase (in module string): String constants. (line 14) +* ascii_uppercase (in module string): String constants. (line 19) +* ascii() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 212) +* asctime() (in module time): Functions<5>. (line 6) +* asdict() (in module dataclasses): Module contents<4>. (line 345) +* asend() (agen method): Asynchronous generator-iterator methods. + (line 28) +* asin() (in module cmath): Trigonometric functions<2>. + (line 12) +* asin() (in module math): Trigonometric functions. + (line 11) +* asinh() (in module cmath): Hyperbolic functions<2>. + (line 11) +* asinh() (in module math): Hyperbolic functions. + (line 13) +* askcolor() (in module tkinter.colorchooser): tkinter colorchooser — Color choosing dialog. + (line 17) +* askdirectory() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 54) +* askfloat() (in module tkinter.simpledialog): tkinter simpledialog — Standard Tkinter input dialogs. + (line 14) +* askinteger() (in module tkinter.simpledialog): tkinter simpledialog — Standard Tkinter input dialogs. + (line 14) +* askokcancel() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 119) +* askopenfile() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 31) +* askopenfilename() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 42) +* askopenfilenames() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 42) +* askopenfiles() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 31) +* askquestion() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 113) +* askretrycancel() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 126) +* asksaveasfile() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 37) +* asksaveasfilename() (in module tkinter.filedialog): Native Load/Save Dialogs. + (line 49) +* askstring() (in module tkinter.simpledialog): tkinter simpledialog — Standard Tkinter input dialogs. + (line 14) +* askyesno() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 133) +* askyesnocancel() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 139) +* Assert (class in ast): Statements. (line 127) +* assert_any_await() (unittest.mock.AsyncMock method): The Mock Class. + (line 844) +* assert_any_call() (unittest.mock.Mock method): The Mock Class. + (line 150) +* assert_awaited_once_with() (unittest.mock.AsyncMock method): The Mock Class. + (line 827) +* assert_awaited_once() (unittest.mock.AsyncMock method): The Mock Class. + (line 794) +* assert_awaited_with() (unittest.mock.AsyncMock method): The Mock Class. + (line 810) +* assert_awaited() (unittest.mock.AsyncMock method): The Mock Class. + (line 774) +* assert_called_once_with() (unittest.mock.Mock method): The Mock Class. + (line 135) +* assert_called_once() (unittest.mock.Mock method): The Mock Class. + (line 107) +* assert_called_with() (unittest.mock.Mock method): The Mock Class. + (line 125) +* assert_called() (unittest.mock.Mock method): The Mock Class. + (line 96) +* assert_has_awaits() (unittest.mock.AsyncMock method): The Mock Class. + (line 861) +* assert_has_calls() (unittest.mock.Mock method): The Mock Class. + (line 166) +* assert_never() (in module typing): Functions and decorators. + (line 44) +* assert_not_awaited() (unittest.mock.AsyncMock method): The Mock Class. + (line 888) +* assert_not_called() (unittest.mock.Mock method): The Mock Class. + (line 187) +* assert_python_failure() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 57) +* assert_python_ok() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 40) +* assert_type() (in module typing): Functions and decorators. + (line 15) +* assertAlmostEqual() (unittest.TestCase method): Test cases. + (line 511) +* assertCountEqual() (unittest.TestCase method): Test cases. (line 567) +* assertDictEqual() (unittest.TestCase method): Test cases. (line 676) +* assertEqual() (unittest.TestCase method): Test cases. (line 177) +* assertFalse() (unittest.TestCase method): Test cases. (line 202) +* assertGreater() (unittest.TestCase method): Test cases. (line 536) +* assertGreaterEqual() (unittest.TestCase method): Test cases. + (line 536) +* assertIn() (unittest.TestCase method): Test cases. (line 229) +* assertInBytecode() (test.support.bytecode_helper.BytecodeTestCase method): test support bytecode_helper — Support tools for testing correct bytecode generation. + (line 22) +* AssertionError: Concrete exceptions. + (line 8) +* assertIs() (unittest.TestCase method): Test cases. (line 214) +* assertIsInstance() (unittest.TestCase method): Test cases. (line 236) +* assertIsNone() (unittest.TestCase method): Test cases. (line 222) +* assertIsNot() (unittest.TestCase method): Test cases. (line 214) +* assertIsNotNone() (unittest.TestCase method): Test cases. (line 222) +* assertLess() (unittest.TestCase method): Test cases. (line 536) +* assertLessEqual() (unittest.TestCase method): Test cases. (line 536) +* assertListEqual() (unittest.TestCase method): Test cases. (line 653) +* assertLogs() (unittest.TestCase method): Test cases. (line 411) +* assertMultiLineEqual() (unittest.TestCase method): Test cases. + (line 628) +* assertNoLogs() (unittest.TestCase method): Test cases. (line 455) +* assertNotAlmostEqual() (unittest.TestCase method): Test cases. + (line 511) +* assertNotEqual() (unittest.TestCase method): Test cases. (line 197) +* assertNotIn() (unittest.TestCase method): Test cases. (line 229) +* assertNotInBytecode() (test.support.bytecode_helper.BytecodeTestCase method): test support bytecode_helper — Support tools for testing correct bytecode generation. + (line 28) +* assertNotIsInstance() (unittest.TestCase method): Test cases. + (line 236) +* assertNotRegex() (unittest.TestCase method): Test cases. (line 549) +* assertRaises() (unittest.TestCase method): Test cases. (line 276) +* assertRaisesRegex() (unittest.TestCase method): Test cases. + (line 317) +* assertRegex() (unittest.TestCase method): Test cases. (line 549) +* assertSequenceEqual() (unittest.TestCase method): Test cases. + (line 638) +* assertSetEqual() (unittest.TestCase method): Test cases. (line 664) +* assertTrue() (unittest.TestCase method): Test cases. (line 202) +* assertTupleEqual() (unittest.TestCase method): Test cases. (line 653) +* assertWarns() (unittest.TestCase method): Test cases. (line 345) +* assertWarnsRegex() (unittest.TestCase method): Test cases. (line 386) +* Assign (class in ast): Statements. (line 6) +* assignment expression: Boolean operations. (line 38) +* assignment; expression: Boolean operations. (line 37) +* assignment; statement: Mutable sequences. (line 6) +* assignment; statement <1>: Assignment statements. + (line 6) +* AST (class in ast): Node classes. (line 6) +* ast command line option; -a: Command-Line Usage<4>. + (line 29) +* ast command line option; -h: Command-Line Usage<4>. + (line 15) +* ast command line option; -help: Command-Line Usage<4>. + (line 15) +* ast command line option; -i: Command-Line Usage<4>. + (line 33) +* ast command line option; -include-attributes: Command-Line Usage<4>. + (line 29) +* ast command line option; -indent: Command-Line Usage<4>. + (line 33) +* ast command line option; -m: Command-Line Usage<4>. + (line 19) +* ast command line option; -mode: Command-Line Usage<4>. + (line 19) +* ast command line option; -no-type-comments: Command-Line Usage<4>. + (line 25) +* astimezone() (datetime.datetime method): datetime Objects. (line 479) +* astuple() (in module dataclasses): Module contents<4>. (line 377) +* async for; in comprehensions: Displays for lists sets and dictionaries. + (line 14) +* AsyncContextDecorator (class in contextlib): Utilities. (line 462) +* AsyncContextManager (class in typing): Aliases to contextlib ABCs. + (line 24) +* asynccontextmanager() (in module contextlib): Utilities. (line 94) +* AsyncExitStack (class in contextlib): Utilities. (line 621) +* AsyncFor (class in ast): Async and await. (line 34) +* AsyncFunctionDef (class in ast): Async and await. (line 6) +* AsyncGenerator (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 163) +* AsyncGenerator (class in typing): Aliases to asynchronous ABCs in collections abc. + (line 21) +* AsyncGeneratorType (in module types): Standard Interpreter Types. + (line 49) +* asynchronous context manager: Glossary. (line 86) +* asynchronous generator: Glossary. (line 92) +* asynchronous generator iterator: Glossary. (line 109) +* asynchronous generator; asynchronous iterator: Asynchronous generator functions. + (line 6) +* asynchronous generator; function: Asynchronous generator functions. + (line 6) +* asynchronous iterable: Glossary. (line 126) +* asynchronous iterator: Glossary. (line 132) +* asyncio.subprocess.DEVNULL (built-in variable): Constants<7>. + (line 23) +* asyncio.subprocess.PIPE (built-in variable): Constants<7>. (line 6) +* asyncio.subprocess.Process (built-in class): Interacting with Subprocesses. + (line 11) +* asyncio.subprocess.STDOUT (built-in variable): Constants<7>. + (line 17) +* AsyncIterable (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 149) +* AsyncIterable (class in typing): Aliases to asynchronous ABCs in collections abc. + (line 39) +* AsyncIterator (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 156) +* AsyncIterator (class in typing): Aliases to asynchronous ABCs in collections abc. + (line 49) +* AsyncMock (class in unittest.mock): The Mock Class. (line 702) +* AsyncResult (class in multiprocessing.pool): Process Pools. + (line 195) +* asyncSetUp() (unittest.IsolatedAsyncioTestCase method): Test cases. + (line 868) +* asyncTearDown() (unittest.IsolatedAsyncioTestCase method): Test cases. + (line 877) +* AsyncWith (class in ast): Async and await. (line 34) +* AT (in module token): token — Constants used with Python parse trees. + (line 302) +* at_eof() (asyncio.StreamReader method): StreamReader. (line 85) +* atan() (in module cmath): Trigonometric functions<2>. + (line 17) +* atan() (in module math): Trigonometric functions. + (line 16) +* atan2() (in module math): Trigonometric functions. + (line 21) +* atanh() (in module cmath): Hyperbolic functions<2>. + (line 17) +* atanh() (in module math): Hyperbolic functions. + (line 17) +* ATEQUAL (in module token): token — Constants used with Python parse trees. + (line 305) +* atexit (weakref.finalize attribute): weakref — Weak references. + (line 317) +* athrow() (agen method): Asynchronous generator-iterator methods. + (line 43) +* atof() (in module locale): locale — Internationalization services. + (line 503) +* atoi() (in module locale): locale — Internationalization services. + (line 509) +* atom: Atoms. (line 6) +* attach_loop() (asyncio.AbstractChildWatcher method): Process Watchers. + (line 63) +* attach_mock() (unittest.mock.Mock method): The Mock Class. (line 258) +* attach() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 167) +* attempted (doctest.TestResults attribute): TestResults objects. + (line 12) +* AttlistDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 246) +* attrgetter() (in module operator): operator — Standard operators as functions. + (line 234) +* attrib (xml.etree.ElementTree.Element attribute): Element Objects. + (line 45) +* attribute: The standard type hierarchy. + (line 13) +* attribute <1>: Glossary. (line 141) +* Attribute (class in ast): Expressions<2>. (line 170) +* attribute; assignment: Assignment statements. + (line 6) +* attribute; assignment <1>: Assignment statements. + (line 76) +* attribute; deletion: The del statement<2>. + (line 20) +* attribute; reference: Attribute references. + (line 6) +* AttributeError: Concrete exceptions. + (line 12) +* attributes (xml.dom.Node attribute): Node Objects. (line 26) +* AttributesImpl (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 69) +* AttributesNSImpl (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 80) +* attroff() (curses.window method): Window Objects. (line 53) +* attron() (curses.window method): Window Objects. (line 58) +* attrset() (curses.window method): Window Objects. (line 63) +* audit events: Debugging and Profiling. + (line 13) +* audit() (in module sys): sys — System-specific parameters and functions. + (line 91) +* auditing: sys — System-specific parameters and functions. + (line 93) +* AugAssign (class in ast): Statements. (line 95) +* augmented; assignment: Augmented assignment statements. + (line 6) +* AUGUST (in module calendar): calendar — General calendar-related functions. + (line 490) +* auth() (ftplib.FTP_TLS method): FTP_TLS objects. (line 88) +* auth() (smtplib.SMTP method): SMTP Objects. (line 141) +* authenticate() (imaplib.IMAP4 method): IMAP4 Objects. (line 37) +* AuthenticationError: Process and exceptions. + (line 273) +* authenticators() (netrc.netrc method): netrc Objects. (line 8) +* authkey (multiprocessing.Process attribute): Process and exceptions. + (line 174) +* auto (class in enum): Utilities and Decorators. + (line 6) +* autocommit (sqlite3.Connection attribute): Connection objects. + (line 731) +* autorange() (timeit.Timer method): Python Interface. (line 92) +* available_timezones() (in module zoneinfo): Functions<3>. (line 6) +* avoids_symlink_attacks (shutil.rmtree attribute): Directory and files operations. + (line 325) +* Await (class in ast): Async and await. (line 14) +* await_args (unittest.mock.AsyncMock attribute): The Mock Class. + (line 917) +* await_args_list (unittest.mock.AsyncMock attribute): The Mock Class. + (line 935) +* await_count (unittest.mock.AsyncMock attribute): The Mock Class. + (line 901) +* await; in comprehensions: Displays for lists sets and dictionaries. + (line 45) +* awaitable: Glossary. (line 153) +* Awaitable (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 109) +* Awaitable (class in typing): Aliases to asynchronous ABCs in collections abc. + (line 59) +* b'; bytes literal: String and Bytes literals. + (line 46) +* b"; bytes literal: String and Bytes literals. + (line 46) +* b16decode() (in module base64): RFC 4648 Encodings. (line 123) +* b16encode() (in module base64): RFC 4648 Encodings. (line 118) +* b2a_base64() (in module binascii): binascii — Convert between binary and ASCII. + (line 61) +* b2a_hex() (in module binascii): binascii — Convert between binary and ASCII. + (line 114) +* b2a_qp() (in module binascii): binascii — Convert between binary and ASCII. + (line 77) +* b2a_uu() (in module binascii): binascii — Convert between binary and ASCII. + (line 31) +* b32decode() (in module base64): RFC 4648 Encodings. (line 78) +* b32encode() (in module base64): RFC 4648 Encodings. (line 73) +* b32hexdecode() (in module base64): RFC 4648 Encodings. (line 106) +* b32hexencode() (in module base64): RFC 4648 Encodings. (line 99) +* b64decode() (in module base64): RFC 4648 Encodings. (line 25) +* b64encode() (in module base64): RFC 4648 Encodings. (line 10) +* b85decode() (in module base64): Base85 Encodings. (line 84) +* b85encode() (in module base64): Base85 Encodings. (line 73) +* Babyl (class in mailbox): Babyl objects. (line 6) +* BabylMessage (class in mailbox): BabylMessage objects. + (line 6) +* back() (in module turtle): Turtle motion. (line 24) +* backend (in module readline): readline — GNU readline interface. + (line 49) +* backslash character: Explicit line joining. + (line 6) +* backslashreplace_errors() (in module codecs): Error Handlers. + (line 161) +* backslashreplace; error handler's name: Error Handlers. (line 15) +* backup() (sqlite3.Connection method): Connection objects. (line 529) +* backward() (in module turtle): Turtle motion. (line 24) +* BadGzipFile: gzip — Support for gzip files. + (line 63) +* BadOptionError: Exceptions<10>. (line 21) +* BadStatusLine: http client — HTTP protocol client. + (line 177) +* BadZipFile: zipfile — Work with ZIP archives. + (line 24) +* BadZipfile: zipfile — Work with ZIP archives. + (line 30) +* Barrier (class in asyncio): Barrier. (line 6) +* Barrier (class in multiprocessing): Synchronization primitives. + (line 13) +* Barrier (class in threading): Barrier objects. (line 36) +* Barrier() (multiprocessing.managers.SyncManager method): Managers. + (line 160) +* base_exec_prefix (in module sys): sys — System-specific parameters and functions. + (line 122) +* base_prefix (in module sys): sys — System-specific parameters and functions. + (line 136) +* base64; encoding: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 8) +* BaseCGIHandler (class in wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 53) +* BaseCookie (class in http.cookies): http cookies — HTTP state management. + (line 39) +* BaseException: Base classes. (line 9) +* BaseExceptionGroup: Exception groups. (line 14) +* BaseHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 280) +* BaseHandler (class in wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 89) +* BaseHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 37) +* BaseHTTPRequestHandler (class in http.server): http server — HTTP servers. + (line 51) +* BaseManager (class in multiprocessing.managers): Managers. (line 23) +* basename() (in module os.path): os path — Common pathname manipulations. + (line 57) +* BaseProtocol (class in asyncio): Base Protocols. (line 6) +* BaseProxy (class in multiprocessing.managers): Proxy Objects. + (line 92) +* BaseRequestHandler (class in socketserver): Request Handler Objects. + (line 6) +* BaseRotatingHandler (class in logging.handlers): BaseRotatingHandler. + (line 12) +* BaseSelector (class in selectors): Classes<4>. (line 53) +* BaseServer (class in socketserver): Server Objects<2>. (line 6) +* BaseTransport (class in asyncio): Transports Hierarchy. + (line 6) +* basicConfig() (in module logging): Module-Level Functions. + (line 204) +* BasicContext (in module decimal): Context objects. (line 65) +* BasicInterpolation (class in configparser): Interpolation of values. + (line 10) +* batched() (in module itertools): Itertool Functions. (line 71) +* baudrate() (in module curses): Functions<6>. (line 18) +* bbox() (tkinter.ttk.Treeview method): ttk Treeview. (line 8) +* BDADDR_ANY (in module socket): Constants<8>. (line 298) +* BDADDR_LOCAL (in module socket): Constants<8>. (line 298) +* Bdb (class in bdb): bdb — Debugger framework. + (line 129) +* BdbQuit: bdb — Debugger framework. + (line 15) +* BDFL: Glossary. (line 159) +* beep() (in module curses): Functions<6>. (line 26) +* Beep() (in module winsound): winsound — Sound-playing interface for Windows. + (line 12) +* BEFORE_ASYNC_WITH (opcode): Python Bytecode Instructions. + (line 361) +* BEFORE_WITH (opcode): Python Bytecode Instructions. + (line 513) +* begin_fill() (in module turtle): Filling. (line 16) +* begin_poly() (in module turtle): Special Turtle methods. + (line 6) +* BEL (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 40) +* BELOW_NORMAL_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 75) +* below() (curses.panel.Panel method): Panel Objects. (line 17) +* benchmarking: Functions<5>. (line 216) +* benchmarking <1>: Functions<5>. (line 247) +* benchmarking <2>: Functions<5>. (line 615) +* Benchmarking: timeit — Measure execution time of small code snippets. + (line 8) +* betavariate() (in module random): Real-valued distributions. + (line 33) +* bgcolor() (in module turtle): Window control. (line 6) +* bgpic() (in module turtle): Window control. (line 21) +* bidirectional() (in module unicodedata): unicodedata — Unicode Database. + (line 54) +* bigaddrspacetest() (in module test.support): test support — Utilities for the Python test suite. + (line 566) +* BigEndianStructure (class in ctypes): Structured data types. + (line 22) +* BigEndianUnion (class in ctypes): Structured data types. + (line 10) +* bigmemtest() (in module test.support): test support — Utilities for the Python test suite. + (line 550) +* Binary (class in xmlrpc.client): Binary Objects. (line 6) +* binary file: Glossary. (line 164) +* binary literal: Numeric literals. (line 6) +* binary mode: Built-in Functions. (line 1470) +* binary semaphores: _thread — Low-level threading API. + (line 6) +* BINARY_OP (opcode): Python Bytecode Instructions. + (line 242) +* BINARY_SLICE (opcode): Python Bytecode Instructions. + (line 278) +* BINARY_SUBSCR (opcode): Python Bytecode Instructions. + (line 253) +* binary; arithmetic; operation: Binary arithmetic operations. + (line 6) +* binary; bitwise; operation: Binary bitwise operations. + (line 6) +* binary; literals: Numeric Types — int float complex. + (line 19) +* binaryfunc (C type): Slot Type typedefs. (line 112) +* BinaryIO (class in typing): ABCs for working with IO. + (line 6) +* bind (widgets): Bindings and Events. + (line 6) +* bind_partial() (inspect.Signature method): Introspecting callables with the Signature object. + (line 129) +* bind_port() (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 37) +* bind_textdomain_codeset() (in module locale): Access to message catalogs. + (line 16) +* bind_unix_socket() (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 54) +* bind() (inspect.Signature method): Introspecting callables with the Signature object. + (line 122) +* bind() (socket.socket method): Socket Objects. (line 30) +* binding; name: Binding of names. (line 6) +* binding; name <1>: Assignment statements. + (line 6) +* bindtextdomain() (in module gettext): GNU gettext API. (line 14) +* bindtextdomain() (in module locale): Access to message catalogs. + (line 14) +* binomialvariate() (in module random): Discrete distributions. + (line 8) +* BinOp (class in ast): Expressions<2>. (line 41) +* bisect_left() (in module bisect): bisect — Array bisection algorithm. + (line 33) +* bisect_right() (in module bisect): bisect — Array bisection algorithm. + (line 58) +* bisect() (in module bisect): bisect — Array bisection algorithm. + (line 58) +* bit_count() (int method): Additional Methods on Integer Types. + (line 35) +* bit_length() (int method): Additional Methods on Integer Types. + (line 9) +* BitAnd (class in ast): Expressions<2>. (line 53) +* BitOr (class in ast): Expressions<2>. (line 53) +* bits_per_digit (sys.int_info attribute): sys — System-specific parameters and functions. + (line 1146) +* bitwise; and: Binary bitwise operations. + (line 12) +* bitwise; operations: Bitwise Operations on Integer Types. + (line 6) +* bitwise; or: Binary bitwise operations. + (line 20) +* bitwise; xor: Binary bitwise operations. + (line 16) +* BitXor (class in ast): Expressions<2>. (line 53) +* bk() (in module turtle): Turtle motion. (line 24) +* bkgd() (curses.window method): Window Objects. (line 68) +* bkgdset() (curses.window method): Window Objects. (line 80) +* blake2b, blake2s: BLAKE2. (line 6) +* blake2b.MAX_DIGEST_SIZE (in module hashlib): Constants<5>. (line 24) +* blake2b.MAX_KEY_SIZE (in module hashlib): Constants<5>. (line 18) +* blake2b.PERSON_SIZE (in module hashlib): Constants<5>. (line 12) +* blake2b.SALT_SIZE (in module hashlib): Constants<5>. (line 6) +* blake2b() (in module hashlib): Creating hash objects. + (line 8) +* blake2s.MAX_DIGEST_SIZE (in module hashlib): Constants<5>. (line 26) +* blake2s.MAX_KEY_SIZE (in module hashlib): Constants<5>. (line 20) +* blake2s.PERSON_SIZE (in module hashlib): Constants<5>. (line 14) +* blake2s.SALT_SIZE (in module hashlib): Constants<5>. (line 8) +* blake2s() (in module hashlib): Creating hash objects. + (line 13) +* blank line: Blank lines. (line 6) +* BLKTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 295) +* Blob (class in sqlite3): Blob objects. (line 6) +* blobopen() (sqlite3.Connection method): Connection objects. + (line 34) +* block: Structure of a program. + (line 6) +* block_on_close (socketserver.ThreadingMixIn attribute): Server Creation Notes. + (line 45) +* block_size (hmac.HMAC attribute): hmac — Keyed-Hashing for Message Authentication. + (line 96) +* blocked_domains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 52) +* BlockingIOError: OS exceptions. (line 9) +* BlockingIOError <1>: High-level Module Interface. + (line 67) +* blocksize (http.client.HTTPConnection attribute): HTTPConnection Objects. + (line 156) +* BNF: Notation. (line 6) +* BNF <1>: Expressions. (line 6) +* body_encode() (email.charset.Charset method): email charset Representing character sets. + (line 135) +* body_encoding (email.charset.Charset attribute): email charset Representing character sets. + (line 67) +* body_line_iterator() (in module email.iterators): email iterators Iterators. + (line 14) +* body() (tkinter.simpledialog.Dialog method): tkinter simpledialog — Standard Tkinter input dialogs. + (line 25) +* BOLD (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 15) +* BOM (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_BE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_LE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF16 (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF16_BE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF16_LE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF32 (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF32_BE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF32_LE (in module codecs): codecs — Codec registry and base classes. + (line 272) +* BOM_UTF8 (in module codecs): codecs — Codec registry and base classes. + (line 272) +* bool (built-in class): Built-in Functions. (line 131) +* BOOLEAN_STATES (configparser.ConfigParser attribute): Customizing Parser Behaviour. + (line 246) +* Boolean; operation: Boolean operations. (line 6) +* Boolean; operations: Truth Value Testing. + (line 6) +* Boolean; operations <1>: Boolean Operations — and or not. + (line 6) +* Boolean; type: Built-in Functions. (line 142) +* Boolean; values: Boolean Type - bool. + (line 9) +* BooleanOptionalAction (class in argparse): Action classes. (line 64) +* BoolOp (class in ast): Expressions<2>. (line 69) +* bootstrap() (in module ensurepip): Module API. (line 13) +* border() (curses.window method): Window Objects. (line 91) +* borrowed reference: Glossary. (line 175) +* bottom_panel() (in module curses.panel): Functions<7>. (line 8) +* bottom() (curses.panel.Panel method): Panel Objects. (line 21) +* BoundArguments (class in inspect): Introspecting callables with the Signature object. + (line 328) +* BoundaryError: email errors Exception and Defect classes. + (line 38) +* BoundedSemaphore (class in asyncio): BoundedSemaphore. (line 6) +* BoundedSemaphore (class in multiprocessing): Synchronization primitives. + (line 19) +* BoundedSemaphore (class in threading): Semaphore objects. (line 73) +* BoundedSemaphore() (multiprocessing.managers.SyncManager method): Managers. + (line 167) +* box() (curses.window method): Window Objects. (line 130) +* bpbynumber (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 110) +* bpformat() (bdb.Breakpoint method): bdb — Debugger framework. + (line 56) +* bplist (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 115) +* bpprint() (bdb.Breakpoint method): bdb — Debugger framework. + (line 75) +* BRANCH (monitoring event): Events. (line 8) +* Break (class in ast): Control flow. (line 99) +* break (pdb command): Debugger Commands. (line 97) +* break_anywhere() (bdb.Bdb method): bdb — Debugger framework. + (line 263) +* break_here() (bdb.Bdb method): bdb — Debugger framework. + (line 254) +* break_long_words (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 248) +* break_on_hyphens (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 258) +* Breakpoint (class in bdb): bdb — Debugger framework. + (line 22) +* breakpointhook() (in module sys): sys — System-specific parameters and functions. + (line 242) +* breakpoints: Help menu Shell and Editor. + (line 29) +* broadcast_address (ipaddress.IPv4Network attribute): Network objects. + (line 91) +* broadcast_address (ipaddress.IPv6Network attribute): Network objects. + (line 311) +* broken (asyncio.Barrier attribute): Barrier. (line 103) +* broken (threading.Barrier attribute): Barrier objects. (line 101) +* BrokenBarrierError: Barrier objects. (line 106) +* BrokenBarrierError <1>: Barrier. (line 108) +* BrokenExecutor: Exception classes. (line 18) +* BrokenPipeError: OS exceptions. (line 38) +* BrokenProcessPool: Exception classes. (line 41) +* BrokenThreadPool: Exception classes. (line 33) +* BROWSER: webbrowser — Convenient web-browser controller. + (line 20) +* BROWSER <1>: webbrowser — Convenient web-browser controller. + (line 34) +* BROWSER <2>: webbrowser — Convenient web-browser controller. + (line 122) +* BS (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 43) +* BsdDbShelf (class in shelve): Restrictions. (line 60) +* buf (multiprocessing.shared_memory.SharedMemory attribute): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 116) +* Buffer (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 173) +* buffer (io.TextIOBase attribute): Text I/O<2>. (line 30) +* buffer (unittest.TestResult attribute): Loading and running tests. + (line 293) +* buffer interface; (see buffer protocol): Iterator Protocol. + (line 78) +* buffer object; (see buffer protocol): Iterator Protocol. (line 77) +* buffer protocol: Iterator Protocol. (line 78) +* buffer protocol; binary sequence types: printf-style String Formatting. + (line 192) +* buffer protocol; str (built-in class): Text Sequence Type — str. + (line 61) +* buffer size, I/O: Built-in Functions. (line 1470) +* buffer_info() (array.array method): array — Efficient arrays of numeric values. + (line 125) +* buffer_size (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 120) +* buffer_text (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 127) +* buffer_updated() (asyncio.BufferedProtocol method): Buffered Streaming Protocols. + (line 33) +* buffer_used (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 138) +* BufferedIOBase (class in io): I/O Base Classes. (line 224) +* BufferedProtocol (class in asyncio): Base Protocols. (line 15) +* BufferedRandom (class in io): Buffered Streams. (line 136) +* BufferedReader (class in io): Buffered Streams. (line 56) +* BufferedRWPair (class in io): Buffered Streams. (line 151) +* BufferedWriter (class in io): Buffered Streams. (line 94) +* BufferError: Base classes. (line 78) +* BufferFlags (class in inspect): Buffer flags. (line 6) +* BufferingFormatter (class in logging): Formatter Objects. (line 132) +* BufferingHandler (class in logging.handlers): MemoryHandler. + (line 19) +* BufferTooShort: Process and exceptions. + (line 265) +* BUILD_CONST_KEY_MAP (opcode): Python Bytecode Instructions. + (line 693) +* BUILD_LIST (opcode): Python Bytecode Instructions. + (line 675) +* BUILD_MAP (opcode): Python Bytecode Instructions. + (line 683) +* build_opener() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 122) +* BUILD_SET (opcode): Python Bytecode Instructions. + (line 679) +* BUILD_SLICE (opcode): Python Bytecode Instructions. + (line 1142) +* BUILD_STRING (opcode): Python Bytecode Instructions. + (line 702) +* BUILD_TUPLE (opcode): Python Bytecode Instructions. + (line 662) +* built-in function; __import__: Importing Modules<2>. + (line 31) +* built-in function; __import__(): Built-in Functions. (line 2181) +* built-in function; abs: Emulating numeric types. + (line 113) +* built-in function; abs <1>: Number Protocol. (line 100) +* built-in function; abs(): Built-in Functions. (line 43) +* built-in function; aiter(): Built-in Functions. (line 50) +* built-in function; all(): Built-in Functions. (line 60) +* built-in function; anext(): Built-in Functions. (line 71) +* built-in function; any(): Built-in Functions. (line 90) +* built-in function; ascii: Object Protocol. (line 344) +* built-in function; ascii(): Built-in Functions. (line 101) +* built-in function; bin(): Built-in Functions. (line 109) +* built-in function; breakpoint(): Built-in Functions. (line 144) +* built-in function; bytes: Basic customization. + (line 148) +* built-in function; bytes <1>: Object Protocol. (line 367) +* built-in function; call: Calls. (line 143) +* built-in function; callable(): Built-in Functions. (line 227) +* built-in function; chr: Immutable sequences. + (line 15) +* built-in function; chr(): Built-in Functions. (line 239) +* built-in function; classmethod: Implementing functions and methods. + (line 197) +* built-in function; classmethod(): Built-in Functions. (line 250) +* built-in function; compile: The global statement. + (line 18) +* built-in function; compile <1>: Code Objects. (line 6) +* built-in function; compile <2>: Standard Interpreter Types. + (line 58) +* built-in function; compile <3>: Importing Modules<2>. + (line 131) +* built-in function; compile(): Built-in Functions. (line 288) +* built-in function; complex: Emulating numeric types. + (line 120) +* built-in function; complex <1>: Numeric Types — int float complex. + (line 27) +* built-in function; delattr(): Built-in Functions. (line 442) +* built-in function; dir(): Built-in Functions. (line 465) +* built-in function; divmod: Emulating numeric types. + (line 26) +* built-in function; divmod <1>: Emulating numeric types. + (line 56) +* built-in function; divmod <2>: Number Protocol. (line 71) +* built-in function; divmod(): Built-in Functions. (line 526) +* built-in function; enumerate(): Built-in Functions. (line 538) +* built-in function; eval: The global statement. + (line 18) +* built-in function; eval <1>: Expression input. (line 6) +* built-in function; eval <2>: Code Objects. (line 17) +* built-in function; eval <3>: Functions<4>. (line 87) +* built-in function; eval <4>: PrettyPrinter Objects. + (line 68) +* built-in function; eval(): Built-in Functions. (line 561) +* built-in function; exec: The global statement. + (line 18) +* built-in function; exec <1>: Built-in Functions. (line 636) +* built-in function; exec <2>: Code Objects. (line 17) +* built-in function; exec(): Built-in Functions. (line 636) +* built-in function; filter(): Built-in Functions. (line 705) +* built-in function; float: Emulating numeric types. + (line 120) +* built-in function; float <1>: Numeric Types — int float complex. + (line 27) +* built-in function; float <2>: Number Protocol. (line 266) +* built-in function; format(): Built-in Functions. (line 788) +* built-in function; getattr(): Built-in Functions. (line 821) +* built-in function; globals(): Built-in Functions. (line 838) +* built-in function; hasattr(): Built-in Functions. (line 844) +* built-in function; hash: Basic customization. + (line 241) +* built-in function; hash <1>: Immutable Sequence Types. + (line 6) +* built-in function; hash <2>: Object Protocol. (line 418) +* built-in function; hash <3>: PyTypeObject Slots. (line 361) +* built-in function; hash(): Built-in Functions. (line 851) +* built-in function; help: Operating System Interface. + (line 20) +* built-in function; help(): Built-in Functions. (line 863) +* built-in function; hex(): Built-in Functions. (line 887) +* built-in function; id: Objects values and types. + (line 11) +* built-in function; id(): Built-in Functions. (line 918) +* built-in function; input(): Built-in Functions. (line 931) +* built-in function; int: Emulating numeric types. + (line 120) +* built-in function; int <1>: Numeric Types — int float complex. + (line 27) +* built-in function; int <2>: Number Protocol. (line 258) +* built-in function; isinstance(): Built-in Functions. (line 1031) +* built-in function; issubclass(): Built-in Functions. (line 1047) +* built-in function; iter(): Built-in Functions. (line 1060) +* built-in function; len: Sequences. (line 6) +* built-in function; len <1>: Set types. (line 6) +* built-in function; len <2>: Mappings. (line 6) +* built-in function; len <3>: Emulating container types. + (line 41) +* built-in function; len <4>: Common Sequence Operations. + (line 21) +* built-in function; len <5>: Mapping Types — dict. + (line 6) +* built-in function; len <6>: Object Protocol. (line 467) +* built-in function; len <7>: Sequence Protocol. (line 16) +* built-in function; len <8>: Mapping Protocol. (line 19) +* built-in function; len <9>: List Objects. (line 41) +* built-in function; len <10>: Dictionary Objects. (line 227) +* built-in function; len <11>: Set Objects. (line 99) +* built-in function; len(): Built-in Functions. (line 1089) +* built-in function; locals(): Built-in Functions. (line 1107) +* built-in function; map(): Built-in Functions. (line 1159) +* built-in function; max: Common Sequence Operations. + (line 21) +* built-in function; max(): Built-in Functions. (line 1169) +* built-in function; min: Common Sequence Operations. + (line 21) +* built-in function; min(): Built-in Functions. (line 1203) +* built-in function; multiprocessing.Manager(): Managers. (line 12) +* built-in function; next(): Built-in Functions. (line 1232) +* built-in function; oct(): Built-in Functions. (line 1252) +* built-in function; open: Reading and Writing Files. + (line 6) +* built-in function; open <1>: I/O objects also known as file objects. + (line 6) +* built-in function; open(): Built-in Functions. (line 1277) +* built-in function; ord: Immutable sequences. + (line 15) +* built-in function; ord(): Built-in Functions. (line 1515) +* built-in function; pow: Emulating numeric types. + (line 26) +* built-in function; pow <1>: Emulating numeric types. + (line 26) +* built-in function; pow <2>: Emulating numeric types. + (line 56) +* built-in function; pow <3>: Emulating numeric types. + (line 67) +* built-in function; pow <4>: Number Protocol. (line 80) +* built-in function; pow <5>: Number Protocol. (line 206) +* built-in function; pow(): Built-in Functions. (line 1528) +* built-in function; print: Basic customization. + (line 153) +* built-in function; print(): Built-in Functions. (line 1568) +* built-in function; property.deleter(): Built-in Functions. (line 1643) +* built-in function; property.getter(): Built-in Functions. (line 1639) +* built-in function; property.setter(): Built-in Functions. (line 1641) +* built-in function; range: The for statement. (line 37) +* built-in function; repr: Expression statements. + (line 17) +* built-in function; repr <1>: Finalization and De-allocation. + (line 90) +* built-in function; repr <2>: Object Protocol. (line 331) +* built-in function; repr <3>: PyTypeObject Slots. (line 299) +* built-in function; repr(): Built-in Functions. (line 1692) +* built-in function; reversed(): Built-in Functions. (line 1715) +* built-in function; round: Emulating numeric types. + (line 143) +* built-in function; round(): Built-in Functions. (line 1722) +* built-in function; setattr(): Built-in Functions. (line 1761) +* built-in function; slice: Slice objects. (line 6) +* built-in function; slice <1>: Python Bytecode Instructions. + (line 1144) +* built-in function; sorted(): Built-in Functions. (line 1810) +* built-in function; staticmethod: Implementing functions and methods. + (line 204) +* built-in function; staticmethod(): Built-in Functions. (line 1846) +* built-in function; sum(): Built-in Functions. (line 1901) +* built-in function; tuple: Sequence Protocol. (line 120) +* built-in function; tuple <1>: List Objects. (line 162) +* built-in function; type: Objects values and types. + (line 11) +* built-in function; type <1>: Metaclasses. (line 6) +* built-in function; type <2>: Type Objects. (line 6) +* built-in function; type <3>: Object Protocol. (line 449) +* built-in function; vars(): Built-in Functions. (line 2059) +* built-in function; zip(): Built-in Functions. (line 2084) +* built-in method; call: Calls. (line 143) +* built-in; method: Built-in methods. (line 6) +* built-in; types: Built-in Types. (line 9) +* builtin_module_names (in module sys): sys — System-specific parameters and functions. + (line 157) +* BuiltinFunctionType (in module types): Standard Interpreter Types. + (line 81) +* BuiltinImporter (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 67) +* BuiltinMethodType (in module types): Standard Interpreter Types. + (line 81) +* busy_retry() (in module test.support): test support — Utilities for the Python test suite. + (line 197) +* BUTTON_ALT (in module curses): Constants<6>. (line 629) +* BUTTON_CTRL (in module curses): Constants<6>. (line 626) +* BUTTON_SHIFT (in module curses): Constants<6>. (line 623) +* buttonbox() (tkinter.simpledialog.Dialog method): tkinter simpledialog — Standard Tkinter input dialogs. + (line 30) +* BUTTONn_CLICKED (in module curses): Constants<6>. (line 614) +* BUTTONn_DOUBLE_CLICKED (in module curses): Constants<6>. (line 617) +* BUTTONn_PRESSED (in module curses): Constants<6>. (line 608) +* BUTTONn_RELEASED (in module curses): Constants<6>. (line 611) +* BUTTONn_TRIPLE_CLICKED (in module curses): Constants<6>. (line 620) +* bye() (in module turtle): Methods specific to Screen not inherited from TurtleScreen. + (line 6) +* byref() (in module ctypes): Utility functions. (line 19) +* byte: Immutable sequences. + (line 39) +* bytearray: Mutable sequences. (line 25) +* bytearray (built-in class): Bytearray Objects. (line 9) +* bytearray; formatting: printf-style Bytes Formatting. + (line 6) +* bytearray; interpolation: printf-style Bytes Formatting. + (line 6) +* bytearray; methods: Bytes and Bytearray Operations. + (line 6) +* bytecode: Code objects. (line 6) +* bytecode <1>: Glossary. (line 208) +* Bytecode (class in dis): Bytecode analysis. (line 12) +* BYTECODE_SUFFIXES (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 40) +* Bytecode.codeobj (in module dis): Bytecode analysis. (line 49) +* Bytecode.first_line (in module dis): Bytecode analysis. (line 53) +* BytecodeTestCase (class in test.support.bytecode_helper): test support bytecode_helper — Support tools for testing correct bytecode generation. + (line 13) +* byteorder (in module sys): sys — System-specific parameters and functions. + (line 150) +* bytes: Immutable sequences. + (line 39) +* bytes (built-in class): Bytes Objects. (line 12) +* bytes (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 86) +* bytes literal: Literals. (line 8) +* bytes_le (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 91) +* bytes_warning (sys.flags attribute): sys — System-specific parameters and functions. + (line 559) +* bytes-like object: Glossary. (line 189) +* bytes; formatting: printf-style Bytes Formatting. + (line 6) +* bytes; interpolation: printf-style Bytes Formatting. + (line 6) +* bytes; methods: Bytes and Bytearray Operations. + (line 6) +* bytes; str (built-in class): Text Sequence Type — str. + (line 61) +* BytesFeedParser (class in email.parser): FeedParser API. (line 28) +* BytesGenerator (class in email.generator): email generator Generating MIME documents. + (line 42) +* BytesHeaderParser (class in email.parser): Parser API. (line 68) +* BytesIO (class in io): Buffered Streams. (line 9) +* BytesParser (class in email.parser): Parser API. (line 18) +* ByteString (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 68) +* ByteString (class in typing): Aliases to container ABCs in collections abc. + (line 14) +* byteswap() (array.array method): array — Efficient arrays of numeric values. + (line 145) +* BytesWarning: Warnings. (line 76) +* BZ2Compressor (class in bz2): Incremental de compression. + (line 6) +* BZ2Decompressor (class in bz2): Incremental de compression. + (line 33) +* BZ2File (class in bz2): De compression of files. + (line 40) +* C: String and Bytes literals. + (line 74) +* c_bool (class in ctypes): Fundamental data types<2>. + (line 207) +* c_byte (class in ctypes): Fundamental data types<2>. + (line 45) +* c_char (class in ctypes): Fundamental data types<2>. + (line 51) +* c_char_p (class in ctypes): Fundamental data types<2>. + (line 58) +* C_CONTIGUOUS (inspect.BufferFlags attribute): Buffer flags. + (line 25) +* c_contiguous (memoryview attribute): Memory Views. (line 473) +* c_double (class in ctypes): Fundamental data types<2>. + (line 65) +* c_float (class in ctypes): Fundamental data types<2>. + (line 76) +* c_int (class in ctypes): Fundamental data types<2>. + (line 81) +* c_int16 (class in ctypes): Fundamental data types<2>. + (line 93) +* c_int32 (class in ctypes): Fundamental data types<2>. + (line 98) +* c_int64 (class in ctypes): Fundamental data types<2>. + (line 103) +* c_int8 (class in ctypes): Fundamental data types<2>. + (line 88) +* c_long (class in ctypes): Fundamental data types<2>. + (line 108) +* c_longdouble (class in ctypes): Fundamental data types<2>. + (line 70) +* c_longlong (class in ctypes): Fundamental data types<2>. + (line 113) +* C_RAISE (monitoring event): Events. (line 16) +* C_RETURN (monitoring event): Events. (line 21) +* c_short (class in ctypes): Fundamental data types<2>. + (line 119) +* c_size_t (class in ctypes): Fundamental data types<2>. + (line 124) +* c_ssize_t (class in ctypes): Fundamental data types<2>. + (line 128) +* c_time_t (class in ctypes): Fundamental data types<2>. + (line 134) +* c_ubyte (class in ctypes): Fundamental data types<2>. + (line 140) +* c_uint (class in ctypes): Fundamental data types<2>. + (line 146) +* c_uint16 (class in ctypes): Fundamental data types<2>. + (line 158) +* c_uint32 (class in ctypes): Fundamental data types<2>. + (line 163) +* c_uint64 (class in ctypes): Fundamental data types<2>. + (line 168) +* c_uint8 (class in ctypes): Fundamental data types<2>. + (line 153) +* c_ulong (class in ctypes): Fundamental data types<2>. + (line 173) +* c_ulonglong (class in ctypes): Fundamental data types<2>. + (line 178) +* c_ushort (class in ctypes): Fundamental data types<2>. + (line 184) +* c_void_p (class in ctypes): Fundamental data types<2>. + (line 189) +* c_wchar (class in ctypes): Fundamental data types<2>. + (line 194) +* c_wchar_p (class in ctypes): Fundamental data types<2>. + (line 201) +* C-contiguous: shape strides suboffsets. + (line 26) +* C-contiguous <1>: Glossary. (line 330) +* C; language: The standard type hierarchy. + (line 6) +* C; language <1>: numbers Real float. (line 6) +* C; language <2>: Built-in functions. (line 6) +* C; language <3>: Comparisons. (line 6) +* C; language <4>: Numeric Types — int float complex. + (line 6) +* C; structures: struct — Interpret bytes as packed binary data. + (line 8) +* C14NWriterTarget (class in xml.etree.ElementTree): TreeBuilder Objects. + (line 94) +* CACHE (opcode): Python Bytecode Instructions. + (line 177) +* cache_clear() (functools.lru_cache method): functools — Higher-order functions and operations on callable objects. + (line 202) +* cache_from_source() (in module importlib.util): importlib util – Utility code for importers. + (line 21) +* cache_info() (functools.lru_cache method): functools — Higher-order functions and operations on callable objects. + (line 197) +* cache() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 16) +* cached (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 421) +* cached_property() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 49) +* CacheFTPHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 438) +* calcobjsize() (in module test.support): test support — Utilities for the Python test suite. + (line 434) +* calcsize() (in module struct): Functions and Exceptions. + (line 55) +* calcvobjsize() (in module test.support): test support — Utilities for the Python test suite. + (line 440) +* Calendar (class in calendar): calendar — General calendar-related functions. + (line 27) +* calendar command line option; -c: Command-Line Usage. (line 117) +* calendar command line option; -css: Command-Line Usage. (line 117) +* calendar command line option; -e: Command-Line Usage. (line 66) +* calendar command line option; -encoding: Command-Line Usage. + (line 66) +* calendar command line option; -f: Command-Line Usage. (line 75) +* calendar command line option; -first-weekday: Command-Line Usage. + (line 75) +* calendar command line option; -h: Command-Line Usage. (line 57) +* calendar command line option; -help: Command-Line Usage. (line 57) +* calendar command line option; -L: Command-Line Usage. (line 61) +* calendar command line option; -l: Command-Line Usage. (line 100) +* calendar command line option; -lines: Command-Line Usage. (line 100) +* calendar command line option; -locale: Command-Line Usage. (line 61) +* calendar command line option; -m: Command-Line Usage. (line 111) +* calendar command line option; -months: Command-Line Usage. (line 111) +* calendar command line option; -s: Command-Line Usage. (line 106) +* calendar command line option; -spacing: Command-Line Usage. + (line 106) +* calendar command line option; -t: Command-Line Usage. (line 71) +* calendar command line option; -type: Command-Line Usage. (line 71) +* calendar command line option; -w: Command-Line Usage. (line 94) +* calendar command line option; -width: Command-Line Usage. (line 94) +* calendar command line option; month: Command-Line Usage. (line 86) +* calendar command line option; year: Command-Line Usage. (line 82) +* calendar() (in module calendar): calendar — General calendar-related functions. + (line 412) +* call: Slicings. (line 39) +* Call (class in ast): Expressions<2>. (line 121) +* CALL (monitoring event): Events. (line 12) +* CALL (opcode): Python Bytecode Instructions. + (line 1036) +* call_args (unittest.mock.Mock attribute): The Mock Class. (line 438) +* call_args_list (unittest.mock.Mock attribute): The Mock Class. + (line 482) +* call_at() (asyncio.loop method): Scheduling delayed callbacks. + (line 37) +* call_count (unittest.mock.Mock attribute): The Mock Class. (line 331) +* call_exception_handler() (asyncio.loop method): Error Handling API. + (line 45) +* CALL_FUNCTION_EX (opcode): Python Bytecode Instructions. + (line 1088) +* CALL_INTRINSIC_1 (opcode): Python Bytecode Instructions. + (line 1292) +* CALL_INTRINSIC_2 (opcode): Python Bytecode Instructions. + (line 1353) +* CALL_KW (opcode): Python Bytecode Instructions. + (line 1061) +* call_later() (asyncio.loop method): Scheduling delayed callbacks. + (line 10) +* call_list() (unittest.mock.call method): call. (line 20) +* call_soon_threadsafe() (asyncio.loop method): Scheduling callbacks. + (line 24) +* call_soon() (asyncio.loop method): Scheduling callbacks. + (line 6) +* call_tracing() (in module sys): sys — System-specific parameters and functions. + (line 166) +* call; instance: Emulating callable objects. + (line 8) +* call() (in module operator): operator — Standard operators as functions. + (line 221) +* call() (in module subprocess): Older high-level API. + (line 10) +* call() (in module unittest.mock): call. (line 6) +* callable: Glossary. (line 223) +* Callable (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 19) +* Callable (in module typing): Aliases to other ABCs in collections abc. + (line 22) +* CallableProxyType (in module weakref): weakref — Weak references. + (line 340) +* callback: Glossary. (line 234) +* callback (optparse.Option attribute): Option attributes. (line 68) +* callback_args (optparse.Option attribute): Option attributes. + (line 74) +* callback_kwargs (optparse.Option attribute): Option attributes. + (line 74) +* callback() (contextlib.ExitStack method): Utilities. (line 582) +* callbacks (in module gc): gc — Garbage Collector interface. + (line 258) +* called (unittest.mock.Mock attribute): The Mock Class. (line 319) +* CalledProcessError: Using the subprocess Module. + (line 205) +* calloc (C function): Overview<4>. (line 33) +* CAN (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 97) +* CAN_BCM (in module socket): Constants<8>. (line 145) +* can_change_color() (in module curses): Functions<6>. (line 30) +* can_fetch() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 33) +* CAN_ISOTP (in module socket): Constants<8>. (line 184) +* CAN_J1939 (in module socket): Constants<8>. (line 193) +* CAN_RAW_FD_FRAMES (in module socket): Constants<8>. (line 160) +* CAN_RAW_JOIN_FILTERS (in module socket): Constants<8>. (line 173) +* can_symlink() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 75) +* can_write_eof() (asyncio.StreamWriter method): StreamWriter. + (line 47) +* can_write_eof() (asyncio.WriteTransport method): Write-only Transports. + (line 14) +* can_xattr() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 79) +* CANCEL (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 155) +* cancel_command() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 82) +* cancel_dump_traceback_later() (in module faulthandler): Dumping the tracebacks after a timeout. + (line 29) +* cancel_join_thread() (multiprocessing.Queue method): Pipes and Queues. + (line 198) +* cancel() (asyncio.Future method): Future Object. (line 113) +* cancel() (asyncio.Handle method): Callback Handles. (line 18) +* cancel() (asyncio.Task method): Task Object. (line 199) +* cancel() (concurrent.futures.Future method): Future Objects. + (line 16) +* cancel() (sched.scheduler method): Scheduler Objects. (line 41) +* cancel() (threading.Timer method): Timer objects. (line 35) +* cancel() (tkinter.dnd.DndHandler method): tkinter dnd — Drag and drop support. + (line 48) +* cancelled() (asyncio.Future method): Future Object. (line 71) +* cancelled() (asyncio.Handle method): Callback Handles. (line 23) +* cancelled() (asyncio.Task method): Task Object. (line 263) +* cancelled() (concurrent.futures.Future method): Future Objects. + (line 23) +* CancelledError: Exception classes. (line 6) +* CancelledError <1>: Exceptions<13>. (line 18) +* cancelling() (asyncio.Task method): Task Object. (line 320) +* CannotSendHeader: http client — HTTP protocol client. + (line 169) +* CannotSendRequest: http client — HTTP protocol client. + (line 165) +* canonic() (bdb.Bdb method): bdb — Debugger framework. + (line 149) +* canonical() (decimal.Context method): Context objects. (line 269) +* canonical() (decimal.Decimal method): Decimal objects. (line 143) +* canonicalize() (in module xml.etree.ElementTree): Functions<9>. + (line 6) +* capa() (poplib.POP3 method): POP3 Objects. (line 24) +* capitalize() (bytearray method): Bytes and Bytearray Operations. + (line 472) +* capitalize() (bytes method): Bytes and Bytearray Operations. + (line 472) +* capitalize() (str method): String Methods<2>. (line 22) +* capitals (decimal.Context attribute): Context objects. (line 146) +* CapsuleType (class in types): Standard Interpreter Types. + (line 293) +* captured_stderr() (in module test.support): test support — Utilities for the Python test suite. + (line 328) +* captured_stdin() (in module test.support): test support — Utilities for the Python test suite. + (line 328) +* captured_stdout() (in module test.support): test support — Utilities for the Python test suite. + (line 328) +* captureWarnings() (in module logging): Integration with the warnings module. + (line 9) +* capwords() (in module string): Helper functions. (line 6) +* case block: Irrefutable Case Blocks. + (line 6) +* casefold() (str method): String Methods<2>. (line 32) +* cast() (in module ctypes): Utility functions. (line 33) +* cast() (in module typing): Functions and decorators. + (line 6) +* cast() (memoryview method): Memory Views. (line 273) +* catch_threading_exception() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 47) +* catch_unraisable_exception() (in module test.support): test support — Utilities for the Python test suite. + (line 596) +* catch_warnings (class in warnings): Available Context Managers. + (line 6) +* category() (in module unicodedata): unicodedata — Unicode Database. + (line 49) +* cbreak() (in module curses): Functions<6>. (line 35) +* cbrt() (in module math): Power exponential and logarithmic functions. + (line 6) +* CC: New Improved and Deprecated Modules<4>. + (line 58) +* ccc() (ftplib.FTP_TLS method): FTP_TLS objects. (line 98) +* cdf() (statistics.NormalDist method): NormalDist objects. (line 86) +* CDLL (class in ctypes): Loading shared libraries. + (line 9) +* ceil() (in module math): Numeric Types — int float complex. + (line 107) +* ceil() (in module math) <1>: Floating point arithmetic. + (line 6) +* CellType (in module types): Standard Interpreter Types. + (line 70) +* center() (bytearray method): Bytes and Bytearray Operations. + (line 291) +* center() (bytes method): Bytes and Bytearray Operations. + (line 291) +* center() (str method): String Methods<2>. (line 48) +* CERT_NONE (in module ssl): Constants<9>. (line 11) +* CERT_OPTIONAL (in module ssl): Constants<9>. (line 24) +* CERT_REQUIRED (in module ssl): Constants<9>. (line 40) +* cert_store_stats() (ssl.SSLContext method): SSL Contexts. (line 88) +* cert_time_to_seconds() (in module ssl): Certificate handling. + (line 6) +* CertificateError: Exceptions<16>. (line 94) +* certificates: SSL Contexts. (line 762) +* CFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* CFLAGS <1>: Performance options. + (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() (in module tty): tty — Terminal control functions. + (line 28) +* cfmakeraw() (in module tty): tty — Terminal control functions. + (line 20) +* CFUNCTYPE() (in module ctypes): Function prototypes. + (line 15) +* cget() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 51) +* cgi_directories (http.server.CGIHTTPRequestHandler attribute): http server — HTTP servers. + (line 466) +* CGIHandler (class in wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 11) +* CGIHTTPRequestHandler (class in http.server): http server — HTTP servers. + (line 440) +* CGIXMLRPCRequestHandler (class in xmlrpc.server): xmlrpc server — Basic XML-RPC servers. + (line 50) +* chain() (in module itertools): Itertool Functions. (line 105) +* chaining; comparisons: Comparisons. (line 19) +* chaining; comparisons <1>: Comparisons<2>. (line 6) +* ChainMap (class in collections): ChainMap objects. (line 16) +* ChainMap (class in typing): Aliases to types in collections. + (line 28) +* change_cwd() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 83) +* CHANNEL_BINDING_TYPES (in module ssl): Constants<9>. (line 471) +* CHAR_MAX (in module locale): locale — Internationalization services. + (line 571) +* character: Immutable sequences. + (line 15) +* character <1>: Subscriptions. (line 58) +* character <2>: unicodedata — Unicode Database. + (line 6) +* CharacterDataHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 278) +* characters_written (BlockingIOError attribute): OS exceptions. + (line 19) +* characters() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 129) +* charmap_build() (in module codecs): codecs — Codec registry and base classes. + (line 45) +* Charset (class in email.charset): email charset Representing character sets. + (line 24) +* charset() (gettext.NullTranslations method): The NullTranslations class. + (line 68) +* chdir() (in module contextlib): Utilities. (line 364) +* chdir() (in module os): Files and Directories. + (line 116) +* check (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory. + (line 159) +* check__all__() (in module test.support): test support — Utilities for the Python test suite. + (line 676) +* check_call() (in module subprocess): Older high-level API. + (line 43) +* check_disallow_instantiation() (in module test.support): test support — Utilities for the Python test suite. + (line 730) +* CHECK_EG_MATCH (opcode): Python Bytecode Instructions. + (line 476) +* CHECK_EXC_MATCH (opcode): Python Bytecode Instructions. + (line 468) +* check_free_after_iterating() (in module test.support): test support — Utilities for the Python test suite. + (line 664) +* check_hostname (ssl.SSLContext attribute): SSL Contexts. (line 493) +* check_impl_detail() (in module test.support): test support — Utilities for the Python test suite. + (line 292) +* check_no_resource_warning() (in module test.support.warnings_helper): test support warnings_helper — Utilities for warnings tests. + (line 25) +* check_output() (doctest.OutputChecker method): OutputChecker objects. + (line 17) +* check_output() (in module subprocess): Older high-level API. + (line 80) +* check_returncode() (subprocess.CompletedProcess method): Using the subprocess Module. + (line 134) +* check_syntax_error() (in module test.support): test support — Utilities for the Python test suite. + (line 570) +* check_syntax_warning() (in module test.support.warnings_helper): test support warnings_helper — Utilities for warnings tests. + (line 32) +* check_unused_args() (string.Formatter method): Custom String Formatting. + (line 91) +* check_warnings() (in module test.support.warnings_helper): test support warnings_helper — Utilities for warnings tests. + (line 48) +* check() (imaplib.IMAP4 method): IMAP4 Objects. (line 58) +* check() (in module tabnanny): tabnanny — Detection of ambiguous indentation. + (line 17) +* checkcache() (in module linecache): linecache — Random access to text lines. + (line 43) +* CHECKED_HASH (py_compile.PycInvalidationMode attribute): py_compile — Compile Python source files. + (line 109) +* checkfuncname() (in module bdb): bdb — Debugger framework. + (line 455) +* checksizeof() (in module test.support): test support — Utilities for the Python test suite. + (line 446) +* checksum; Cyclic Redundancy Check: zlib — Compression compatible with gzip. + (line 123) +* chflags() (in module os): Files and Directories. + (line 135) +* chgat() (curses.window method): Window Objects. (line 136) +* childNodes (xml.dom.Node attribute): Node Objects. (line 49) +* ChildProcessError: OS exceptions. (line 25) +* children (pyclbr.Class attribute): Class Objects<2>. (line 35) +* children (pyclbr.Function attribute): Function Objects. (line 34) +* children (tkinter.Tk attribute): Tkinter Modules. (line 88) +* chksum (tarfile.TarInfo attribute): TarInfo Objects. (line 137) +* chmod() (in module os): Files and Directories. + (line 176) +* chmod() (pathlib.Path method): Permissions and ownership. + (line 36) +* choice() (in module random): Functions for sequences. + (line 6) +* choice() (in module secrets): Random numbers. (line 15) +* choices (optparse.Option attribute): Option attributes. (line 63) +* choices() (in module random): Functions for sequences. + (line 11) +* Chooser (class in tkinter.colorchooser): tkinter colorchooser — Color choosing dialog. + (line 15) +* chown() (in module os): Files and Directories. + (line 246) +* chown() (in module shutil): Directory and files operations. + (line 397) +* chroot() (in module os): Files and Directories. + (line 273) +* CHRTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 291) +* cipher() (ssl.SSLSocket method): SSL Sockets. (line 229) +* circle() (in module turtle): Turtle motion. (line 211) +* CIRCUMFLEX (in module token): token — Constants used with Python parse trees. + (line 251) +* CIRCUMFLEXEQUAL (in module token): token — Constants used with Python parse trees. + (line 284) +* clamp (decimal.Context attribute): Context objects. (line 152) +* Clamped (class in decimal): Signals. (line 20) +* class: Glossary. (line 239) +* Class (class in pyclbr): Class Objects<2>. (line 6) +* Class (class in symtable): Examining Symbol Tables. + (line 150) +* CLASS (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 19) +* class instance; attribute: Class instances. (line 6) +* class instance; attribute; assignment: Class instances. (line 21) +* class instance; call: Calls. (line 152) +* class object; call: Custom classes. (line 19) +* class object; call <1>: Custom classes. (line 31) +* class object; call <2>: Calls. (line 148) +* class variable: Glossary. (line 245) +* class; attribute: Custom classes. (line 19) +* class; attribute; assignment: Custom classes. (line 28) +* class; body: Executing the class body. + (line 6) +* class; constructor: Basic customization. + (line 39) +* class; definition: The return statement. + (line 6) +* class; definition <1>: Class definitions. (line 6) +* class; instance: Class instances. (line 6) +* class; name: Class definitions. (line 6) +* ClassDef (class in ast): Function and class definitions. + (line 169) +* ClassMethodDescriptorType (in module types): Standard Interpreter Types. + (line 116) +* ClassVar (in module typing): Special forms. (line 193) +* clause: Compound statements. + (line 18) +* CLD_CONTINUED (in module os): Process Management. (line 1051) +* CLD_DUMPED (in module os): Process Management. (line 1051) +* CLD_EXITED (in module os): Process Management. (line 1051) +* CLD_KILLED (in module os): Process Management. (line 1051) +* CLD_STOPPED (in module os): Process Management. (line 1051) +* CLD_TRAPPED (in module os): Process Management. (line 1051) +* clean() (mailbox.Maildir method): Maildir objects. (line 86) +* cleandoc() (in module inspect): Retrieving source code. + (line 71) +* CleanImport (class in test.support.import_helper): test support import_helper — Utilities for import tests. + (line 87) +* cleanup functions: Process Control. (line 33) +* CLEANUP_THROW (opcode): Python Bytecode Instructions. + (line 351) +* cleanup() (tempfile.TemporaryDirectory method): tempfile — Generate temporary files and directories. + (line 202) +* clear (pdb command): Debugger Commands. (line 126) +* Clear Breakpoint: Help menu Shell and Editor. + (line 30) +* clear_all_breaks() (bdb.Bdb method): bdb — Debugger framework. + (line 369) +* clear_all_file_breaks() (bdb.Bdb method): bdb — Debugger framework. + (line 364) +* clear_bpbynumber() (bdb.Bdb method): bdb — Debugger framework. + (line 358) +* clear_break() (bdb.Bdb method): bdb — Debugger framework. + (line 353) +* clear_cache() (in module filecmp): filecmp — File and Directory Comparisons. + (line 56) +* clear_cache() (zoneinfo.ZoneInfo class method): The ZoneInfo class. + (line 58) +* clear_content() (email.message.EmailMessage method): email message Representing an email message. + (line 672) +* clear_flags() (decimal.Context method): Context objects. (line 183) +* clear_frames() (in module traceback): Module-Level Functions<2>. + (line 177) +* clear_history() (in module readline): History list. (line 8) +* clear_overloads() (in module typing): Functions and decorators. + (line 303) +* clear_session_cookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 90) +* clear_traces() (in module tracemalloc): Functions<11>. (line 6) +* clear_traps() (decimal.Context method): Context objects. (line 187) +* clear() (array.array method): array — Efficient arrays of numeric values. + (line 224) +* clear() (asyncio.Event method): Event. (line 58) +* clear() (collections.deque method): deque objects. (line 43) +* clear() (curses.window method): Window Objects. (line 152) +* clear() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 122) +* clear() (dbm.ndbm.ndbm method): dbm ndbm — New Database Manager. + (line 75) +* clear() (dict method): Mapping Types — dict. + (line 165) +* clear() (email.message.EmailMessage method): email message Representing an email message. + (line 668) +* clear() (frame method): Frame object methods. + (line 8) +* clear() (frozenset method): Set Types — set frozenset. + (line 213) +* clear() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 78) +* clear() (in module turtle): More drawing control. + (line 23) +* clear() (mailbox.Mailbox method): Mailbox objects. (line 212) +* clear() (sequence method): Mutable Sequence Types. + (line 16) +* clear() (threading.Event method): Event objects. (line 36) +* clear() (xml.etree.ElementTree.Element method): Element Objects. + (line 58) +* clearcache() (in module linecache): linecache — Random access to text lines. + (line 38) +* clearok() (curses.window method): Window Objects. (line 157) +* clearscreen() (in module turtle): Window control. (line 46) +* clearstamp() (in module turtle): Turtle motion. (line 282) +* clearstamps() (in module turtle): Turtle motion. (line 301) +* client_address (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 71) +* client_address (socketserver.BaseRequestHandler attribute): Request Handler Objects. + (line 47) +* Client() (in module multiprocessing.connection): Listeners and Clients. + (line 34) +* CLOCK_BOOTTIME (in module time): Clock ID Constants. (line 9) +* clock_getres() (in module time): Functions<5>. (line 40) +* clock_gettime_ns() (in module time): Functions<5>. (line 63) +* clock_gettime() (in module time): Functions<5>. (line 50) +* CLOCK_HIGHRES (in module time): Clock ID Constants. (line 23) +* CLOCK_MONOTONIC (in module time): Clock ID Constants. (line 34) +* CLOCK_MONOTONIC_RAW (in module time): Clock ID Constants. (line 43) +* CLOCK_MONOTONIC_RAW_APPROX (in module time): Clock ID Constants. + (line 52) +* CLOCK_PROCESS_CPUTIME_ID (in module time): Clock ID Constants. + (line 61) +* CLOCK_PROF (in module time): Clock ID Constants. (line 69) +* CLOCK_REALTIME (in module time): Clock ID Constants. (line 129) +* clock_seq (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 125) +* clock_seq_hi_variant (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 113) +* clock_seq_low (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 116) +* clock_settime_ns() (in module time): Functions<5>. (line 84) +* clock_settime() (in module time): Functions<5>. (line 72) +* CLOCK_TAI (in module time): Clock ID Constants. (line 77) +* CLOCK_THREAD_CPUTIME_ID (in module time): Clock ID Constants. + (line 89) +* CLOCK_UPTIME (in module time): Clock ID Constants. (line 97) +* CLOCK_UPTIME_RAW (in module time): Clock ID Constants. (line 107) +* CLOCK_UPTIME_RAW_APPROX (in module time): Clock ID Constants. + (line 117) +* CLONE_FILES (in module os): Process Parameters. (line 628) +* CLONE_FS (in module os): Process Parameters. (line 628) +* CLONE_NEWCGROUP (in module os): Process Parameters. (line 628) +* CLONE_NEWIPC (in module os): Process Parameters. (line 628) +* CLONE_NEWNET (in module os): Process Parameters. (line 628) +* CLONE_NEWNS (in module os): Process Parameters. (line 628) +* CLONE_NEWPID (in module os): Process Parameters. (line 628) +* CLONE_NEWTIME (in module os): Process Parameters. (line 628) +* CLONE_NEWUSER (in module os): Process Parameters. (line 628) +* CLONE_NEWUTS (in module os): Process Parameters. (line 628) +* CLONE_SIGHAND (in module os): Process Parameters. (line 628) +* CLONE_SYSVSEM (in module os): Process Parameters. (line 628) +* CLONE_THREAD (in module os): Process Parameters. (line 628) +* CLONE_VM (in module os): Process Parameters. (line 628) +* clone() (email.generator.BytesGenerator method): email generator Generating MIME documents. + (line 111) +* clone() (email.generator.Generator method): email generator Generating MIME documents. + (line 207) +* clone() (email.policy.Policy method): email policy Policy Objects. + (line 223) +* clone() (in module turtle): Special Turtle methods. + (line 32) +* cloneNode() (xml.dom.Node method): Node Objects. (line 147) +* close (in module os): Sub-interpreter support. + (line 196) +* close_clients() (asyncio.Server method): Server Objects. (line 44) +* close_connection (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 80) +* close() (asyncio.AbstractChildWatcher method): Process Watchers. + (line 81) +* close() (asyncio.BaseTransport method): Base Transport. (line 6) +* close() (asyncio.loop method): Running and stopping the loop. + (line 43) +* close() (asyncio.Runner method): Runner context manager. + (line 49) +* close() (asyncio.Server method): Server Objects. (line 32) +* close() (asyncio.StreamWriter method): StreamWriter. (line 37) +* close() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 59) +* close() (contextlib.ExitStack method): Utilities. (line 614) +* close() (coroutine method): Coroutine Objects. (line 50) +* close() (dbm.dumb.dumbdbm method): dbm dumb — Portable DBM implementation. + (line 84) +* close() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 118) +* close() (dbm.ndbm.ndbm method): dbm ndbm — New Database Manager. + (line 71) +* close() (email.parser.BytesFeedParser method): FeedParser API. + (line 65) +* close() (ftplib.FTP method): FTP objects. (line 369) +* close() (generator method): Generator-iterator methods. + (line 65) +* close() (html.parser.HTMLParser method): HTMLParser Methods. + (line 15) +* close() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 152) +* close() (imaplib.IMAP4 method): IMAP4 Objects. (line 62) +* close() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 132) +* close() (in module os): File Descriptor Operations. + (line 21) +* close() (in module socket): Other functions<2>. (line 9) +* close() (io.IOBase method): I/O Base Classes. (line 48) +* close() (logging.FileHandler method): FileHandler. (line 27) +* close() (logging.Handler method): Handler Objects. (line 74) +* close() (logging.handlers.MemoryHandler method): MemoryHandler. + (line 56) +* close() (logging.handlers.NTEventLogHandler method): NTEventLogHandler. + (line 29) +* close() (logging.handlers.SocketHandler method): SocketHandler. + (line 20) +* close() (logging.handlers.SysLogHandler method): SysLogHandler. + (line 46) +* close() (mailbox.Mailbox method): Mailbox objects. (line 269) +* close() (mailbox.Maildir method): Maildir objects. (line 215) +* close() (mailbox.MH method): MH objects. (line 107) +* close() (mmap.mmap method): mmap — Memory-mapped file support. + (line 183) +* close() (multiprocessing.connection.Connection method): Connection Objects. + (line 35) +* close() (multiprocessing.connection.Listener method): Listeners and Clients. + (line 91) +* close() (multiprocessing.pool.Pool method): Process Pools. (line 172) +* close() (multiprocessing.Process method): Process and exceptions. + (line 229) +* close() (multiprocessing.Queue method): Pipes and Queues. (line 174) +* close() (multiprocessing.shared_memory.SharedMemory method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 93) +* close() (multiprocessing.SimpleQueue method): Pipes and Queues. + (line 225) +* close() (os.scandir method): Files and Directories. + (line 876) +* close() (select.devpoll method): /dev/poll Polling Objects. + (line 12) +* close() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 65) +* close() (select.kqueue method): Kqueue Objects. (line 6) +* close() (selectors.BaseSelector method): Classes<4>. (line 137) +* close() (shelve.Shelf method): shelve — Python object persistence. + (line 77) +* close() (socket.socket method): Socket Objects. (line 41) +* close() (sqlite3.Blob method): Blob objects. (line 37) +* close() (sqlite3.Connection method): Connection objects. (line 88) +* close() (sqlite3.Cursor method): Cursor objects. (line 153) +* close() (tarfile.TarFile method): TarFile Objects. (line 325) +* close() (urllib.request.BaseHandler method): BaseHandler Objects. + (line 14) +* close() (wave.Wave_read method): Wave_read Objects. (line 13) +* close() (wave.Wave_write method): Wave_write Objects. (line 29) +* Close() (winreg.PyHKEY method): Registry Handle Objects. + (line 34) +* close() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 28) +* close() (xml.etree.ElementTree.XMLParser method): XMLParser Objects. + (line 20) +* close() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects. + (line 41) +* close() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects. + (line 13) +* close() (zipfile.ZipFile method): ZipFile Objects. (line 107) +* CloseBoundaryNotFoundDefect: email errors Exception and Defect classes. + (line 85) +* closed (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 75) +* closed (io.IOBase attribute): I/O Base Classes. (line 58) +* closed (mmap.mmap attribute): mmap — Memory-mapped file support. + (line 189) +* closed (select.devpoll attribute): /dev/poll Polling Objects. + (line 18) +* closed (select.epoll attribute): Edge and Level Trigger Polling epoll Objects. + (line 69) +* closed (select.kqueue attribute): Kqueue Objects. (line 10) +* CloseKey() (in module winreg): Functions<13>. (line 8) +* closelog() (in module syslog): syslog — Unix syslog library routines. + (line 78) +* closerange() (in module os): File Descriptor Operations. + (line 32) +* closing() (in module contextlib): Utilities. (line 152) +* closure variable: Glossary. (line 250) +* clrtobot() (curses.window method): Window Objects. (line 162) +* clrtoeol() (curses.window method): Window Objects. (line 168) +* Cmd (class in cmd): cmd — Support for line-oriented command interpreters. + (line 15) +* cmd (subprocess.CalledProcessError attribute): Using the subprocess Module. + (line 216) +* cmd (subprocess.TimeoutExpired attribute): Using the subprocess Module. + (line 173) +* cmdloop() (cmd.Cmd method): Cmd Objects. (line 8) +* cmdqueue (cmd.Cmd attribute): Cmd Objects. (line 143) +* cmp_op (in module dis): Opcode collections. (line 21) +* cmp_to_key() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 118) +* cmp() (in module filecmp): filecmp — File and Directory Comparisons. + (line 16) +* cmpfiles() (in module filecmp): filecmp — File and Directory Comparisons. + (line 36) +* CMSG_LEN() (in module socket): Other functions<2>. (line 336) +* CMSG_SPACE() (in module socket): Other functions<2>. (line 353) +* co_argcount (code object attribute): Code objects. (line 16) +* co_argcount (codeobject attribute): Special read-only attributes<2>. + (line 14) +* CO_ASYNC_GENERATOR (C macro): Code Object Flags. (line 48) +* CO_ASYNC_GENERATOR (in module inspect): Code Objects Bit Flags. + (line 52) +* co_cellvars (code object attribute): Code objects. (line 16) +* co_cellvars (codeobject attribute): Special read-only attributes<2>. + (line 39) +* co_code (code object attribute): Code objects. (line 16) +* co_code (codeobject attribute): Special read-only attributes<2>. + (line 54) +* co_consts (code object attribute): Code objects. (line 16) +* co_consts (codeobject attribute): Special read-only attributes<2>. + (line 58) +* CO_COROUTINE (C macro): Code Object Flags. (line 42) +* CO_COROUTINE (in module inspect): Code Objects Bit Flags. + (line 35) +* co_filename (code object attribute): Code objects. (line 16) +* co_filename (codeobject attribute): Special read-only attributes<2>. + (line 66) +* co_firstlineno (code object attribute): Code objects. (line 16) +* co_firstlineno (codeobject attribute): Special read-only attributes<2>. + (line 70) +* co_flags (code object attribute): Code objects. (line 16) +* co_flags (codeobject attribute): Special read-only attributes<2>. + (line 85) +* co_freevars (code object attribute): Code objects. (line 16) +* co_freevars (codeobject attribute): Special read-only attributes<2>. + (line 45) +* CO_FUTURE_ABSOLUTE_IMPORT (C macro): Code Object Flags. (line 54) +* CO_FUTURE_ANNOTATIONS (C macro): Code Object Flags. (line 69) +* CO_FUTURE_DIVISION (C macro): Code Object Flags. (line 51) +* CO_FUTURE_GENERATOR_STOP (C macro): Code Object Flags. (line 66) +* CO_FUTURE_PRINT_FUNCTION (C macro): Code Object Flags. (line 60) +* CO_FUTURE_UNICODE_LITERALS (C macro): Code Object Flags. (line 63) +* CO_FUTURE_WITH_STATEMENT (C macro): Code Object Flags. (line 57) +* CO_GENERATOR (C macro): Code Object Flags. (line 39) +* CO_GENERATOR (in module inspect): Code Objects Bit Flags. + (line 30) +* CO_ITERABLE_COROUTINE (C macro): Code Object Flags. (line 45) +* CO_ITERABLE_COROUTINE (in module inspect): Code Objects Bit Flags. + (line 43) +* co_kwonlyargcount (code object attribute): Code objects. (line 16) +* co_kwonlyargcount (codeobject attribute): Special read-only attributes<2>. + (line 25) +* co_lines() (codeobject method): Methods on code objects. + (line 43) +* co_lnotab (code object attribute): Code objects. (line 16) +* co_lnotab (codeobject attribute): Special read-only attributes<2>. + (line 73) +* co_name (code object attribute): Code objects. (line 16) +* co_name (codeobject attribute): Special read-only attributes<2>. + (line 6) +* co_names (code object attribute): Code objects. (line 16) +* co_names (codeobject attribute): Special read-only attributes<2>. + (line 62) +* CO_NESTED (C macro): Code Object Flags. (line 36) +* CO_NESTED (in module inspect): Code Objects Bit Flags. + (line 26) +* CO_NEWLOCALS (C macro): Code Object Flags. (line 27) +* CO_NEWLOCALS (in module inspect): Code Objects Bit Flags. + (line 13) +* co_nlocals (code object attribute): Code objects. (line 16) +* co_nlocals (codeobject attribute): Special read-only attributes<2>. + (line 30) +* CO_OPTIMIZED (C macro): Code Object Flags. (line 24) +* CO_OPTIMIZED (in module inspect): Code Objects Bit Flags. + (line 9) +* co_positions() (codeobject method): Methods on code objects. + (line 6) +* co_posonlyargcount (code object attribute): Code objects. (line 16) +* co_posonlyargcount (codeobject attribute): Special read-only attributes<2>. + (line 20) +* co_qualname (code object attribute): Code objects. (line 16) +* co_qualname (codeobject attribute): Special read-only attributes<2>. + (line 9) +* co_stacksize (code object attribute): Code objects. (line 16) +* co_stacksize (codeobject attribute): Special read-only attributes<2>. + (line 82) +* CO_VARARGS (C macro): Code Object Flags. (line 30) +* CO_VARARGS (in module inspect): Code Objects Bit Flags. + (line 18) +* CO_VARKEYWORDS (C macro): Code Object Flags. (line 33) +* CO_VARKEYWORDS (in module inspect): Code Objects Bit Flags. + (line 22) +* co_varnames (code object attribute): Code objects. (line 16) +* co_varnames (codeobject attribute): Special read-only attributes<2>. + (line 34) +* code (SystemExit attribute): Concrete exceptions. + (line 407) +* code (urllib.error.HTTPError attribute): urllib error — Exception classes raised by urllib request. + (line 43) +* code (urllib.response.addinfourl attribute): urllib response — Response classes used by urllib. + (line 40) +* code (xml.etree.ElementTree.ParseError attribute): Exceptions<19>. + (line 14) +* code (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions. + (line 9) +* code object: Code objects. (line 6) +* code object <1>: Methods. (line 43) +* code object <2>: marshal — Internal Python object serialization. + (line 33) +* code object <3>: Cell Objects. (line 57) +* code_context (inspect.FrameInfo attribute): The interpreter stack. + (line 32) +* code_context (inspect.Traceback attribute): The interpreter stack. + (line 72) +* code_info() (in module dis): Analysis functions. (line 11) +* code; block: Execution model. (line 6) +* Codec (class in codecs): Stateless Encoding and Decoding. + (line 9) +* CodecInfo (class in codecs): codecs — Codec registry and base classes. + (line 67) +* CodecRegistryError: encodings — Encodings package. + (line 41) +* Codecs: codecs — Codec registry and base classes. + (line 8) +* Codecs; decode: codecs — Codec registry and base classes. + (line 8) +* Codecs; encode: codecs — Codec registry and base classes. + (line 8) +* codecs.escape_decode() (in module codecs): Standalone Codec Functions. + (line 22) +* codecs.escape_encode() (in module codecs): Standalone Codec Functions. + (line 12) +* coded_value (http.cookies.Morsel attribute): Morsel Objects. + (line 53) +* codepoint2name (in module html.entities): html entities — Definitions of HTML general entities. + (line 35) +* codes (in module xml.parsers.expat.errors): Expat error constants. + (line 16) +* CODESET (in module locale): locale — Internationalization services. + (line 187) +* CodeType (class in types): Standard Interpreter Types. + (line 56) +* coding; style: Intermezzo Coding Style. + (line 6) +* col_offset (ast.AST attribute): Node classes. (line 50) +* collapse_addresses() (in module ipaddress): Other Module Level Functions. + (line 43) +* collapse_rfc2231_value() (in module email.utils): email utils Miscellaneous utilities. + (line 200) +* collect() (in module gc): gc — Garbage Collector interface. + (line 34) +* collectedDurations (unittest.TestResult attribute): Loading and running tests. + (line 277) +* Collection (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 37) +* Collection (class in typing): Aliases to container ABCs in collections abc. + (line 23) +* colno (json.JSONDecodeError attribute): Exceptions<17>. (line 27) +* colno (re.PatternError attribute): Exceptions<3>. (line 32) +* colno (traceback.FrameSummary attribute): FrameSummary Objects. + (line 57) +* COLON (in module token): token — Constants used with Python parse trees. + (line 188) +* colon (mailbox.Maildir attribute): Maildir objects. (line 45) +* COLONEQUAL (in module token): token — Constants used with Python parse trees. + (line 314) +* COLOR_BLACK (in module curses): Constants<6>. (line 641) +* COLOR_BLUE (in module curses): Constants<6>. (line 644) +* color_content() (in module curses): Functions<6>. (line 45) +* COLOR_CYAN (in module curses): Constants<6>. (line 647) +* COLOR_GREEN (in module curses): Constants<6>. (line 650) +* COLOR_MAGENTA (in module curses): Constants<6>. (line 653) +* color_pair() (in module curses): Functions<6>. (line 53) +* COLOR_PAIRS (in module curses): Constants<6>. (line 41) +* COLOR_RED (in module curses): Constants<6>. (line 656) +* COLOR_WHITE (in module curses): Constants<6>. (line 659) +* COLOR_YELLOW (in module curses): Constants<6>. (line 662) +* color() (in module turtle): Color control. (line 104) +* colormode() (in module turtle): Settings and special methods. + (line 34) +* COLORS (in module curses): Constants<6>. (line 36) +* COLS (in module curses): Constants<6>. (line 46) +* column() (tkinter.ttk.Treeview method): ttk Treeview. (line 35) +* columnize() (cmd.Cmd method): Cmd Objects. (line 88) +* COLUMNS: Functions<6>. (line 595) +* COLUMNS <1>: Functions<6>. (line 598) +* columns (os.terminal_size attribute): Querying the size of a terminal. + (line 30) +* comb() (in module math): Number-theoretic functions. + (line 6) +* combinations_with_replacement() (in module itertools): Itertool Functions. + (line 170) +* combinations() (in module itertools): Itertool Functions. (line 128) +* combine() (datetime.datetime class method): datetime Objects. + (line 180) +* combining() (in module unicodedata): unicodedata — Unicode Database. + (line 59) +* Combobox (class in tkinter.ttk): ttk Combobox. (line 6) +* comma: Parenthesized forms. + (line 20) +* COMMA (in module token): token — Constants used with Python parse trees. + (line 191) +* command (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 93) +* command line: Complete Python programs. + (line 25) +* command line option; -?: Generic options. (line 6) +* command line option; -b: Miscellaneous options. + (line 6) +* command line option; -B: Miscellaneous options. + (line 16) +* command line option; -build: Cross Compiling Options. + (line 12) +* command line option; -c: Interface options. (line 37) +* command line option; -check-hash-based-pycs: Miscellaneous options. + (line 21) +* command line option; -d: Miscellaneous options. + (line 35) +* command line option; -disable-gil: General Options. (line 224) +* command line option; -disable-ipv6: General Options. (line 16) +* command line option; -disable-test-modules: Install Options. + (line 24) +* command line option; -E: Miscellaneous options. + (line 43) +* command line option; -enable-big-digits: General Options. (line 21) +* command line option; -enable-bolt: Performance options. + (line 62) +* command line option; -enable-experimental-jit: General Options. + (line 236) +* command line option; -enable-framework: macOS Options. (line 15) +* command line option; -enable-framework <1>: macOS Options. (line 17) +* command line option; -enable-framework <2>: iOS Options. (line 8) +* command line option; -enable-loadable-sqlite-extensions: General Options. + (line 6) +* command line option; -enable-optimizations: Performance options. + (line 10) +* command line option; -enable-profiling: Performance options. + (line 128) +* command line option; -enable-pystats: General Options. (line 131) +* command line option; -enable-shared: Linker options<2>. (line 6) +* command line option; -enable-universalsdk: macOS Options. (line 8) +* command line option; -enable-universalsdk <1>: macOS Options. + (line 10) +* command line option; -enable-wasm-dynamic-linking: WebAssembly Options. + (line 16) +* command line option; -enable-wasm-pthreads: WebAssembly Options. + (line 26) +* command line option; -exec-prefix: Install Options. (line 16) +* command line option; -h: Generic options. (line 6) +* command line option; -help: Generic options. (line 6) +* command line option; -help-all: Generic options. (line 27) +* command line option; -help-env: Generic options. (line 13) +* command line option; -help-xoptions: Generic options. (line 20) +* command line option; -host: Cross Compiling Options. + (line 16) +* command line option; -i: Miscellaneous options. + (line 50) +* command line option; -I: Miscellaneous options. + (line 71) +* command line option; -J: Options you shouldn’t use. + (line 6) +* command line option; -m: Interface options. (line 51) +* command line option; -O: Miscellaneous options. + (line 83) +* command line option; -OO: Miscellaneous options. + (line 93) +* command line option; -P: Miscellaneous options. + (line 102) +* command line option; -prefix: Install Options. (line 6) +* command line option; -q: Miscellaneous options. + (line 121) +* command line option; -R: Miscellaneous options. + (line 128) +* command line option; -s: Miscellaneous options. + (line 153) +* command line option; -S: Miscellaneous options. + (line 165) +* command line option; -u: Miscellaneous options. + (line 173) +* command line option; -V: Generic options. (line 33) +* command line option; -v: Miscellaneous options. + (line 183) +* command line option; -version: Generic options. (line 33) +* command line option; -W: Miscellaneous options. + (line 196) +* command line option; -with-address-sanitizer: Debug options. + (line 59) +* command line option; -with-app-store-compliance: macOS Options. + (line 56) +* command line option; -with-app-store-compliance <1>: macOS Options. + (line 58) +* command line option; -with-assertions: Debug options. (line 34) +* command line option; -with-build-python: Cross Compiling Options. + (line 20) +* command line option; -with-builtin-hashlib-hashes: Security Options. + (line 21) +* command line option; -with-computed-gotos: Performance options. + (line 99) +* command line option; -with-dbmliborder: General Options. (line 68) +* command line option; -with-dtrace: Debug options. (line 51) +* command line option; -with-emscripten-target: WebAssembly Options. + (line 6) +* command line option; -with-ensurepip: Install Options. (line 32) +* command line option; -with-framework-name: macOS Options. (line 51) +* command line option; -with-framework-name <1>: iOS Options. + (line 13) +* command line option; -with-hash-algorithm: Security Options. + (line 6) +* command line option; -with-libc: Libraries options. (line 58) +* command line option; -with-libm: Libraries options. (line 53) +* command line option; -with-libs: Libraries options. (line 6) +* command line option; -with-lto: Performance options. + (line 46) +* command line option; -with-memory-sanitizer: Debug options. + (line 69) +* command line option; -with-openssl: Libraries options. (line 63) +* command line option; -with-openssl-rpath: Libraries options. + (line 69) +* command line option; -with-pkg-config: General Options. (line 118) +* command line option; -with-platlibdir: General Options. (line 96) +* command line option; -with-pydebug: Debug options. (line 6) +* command line option; -with-readline: Libraries options. (line 35) +* command line option; -with-ssl-default-suites: Security Options. + (line 40) +* command line option; -with-strict-overflow: Performance options. + (line 132) +* command line option; -with-suffix: General Options. (line 32) +* command line option; -with-system-expat: Libraries options. + (line 10) +* command line option; -with-system-libmpdec: Libraries options. + (line 15) +* command line option; -with-thread-sanitizer: Debug options. + (line 83) +* command line option; -with-trace-refs: Debug options. (line 11) +* command line option; -with-tzpath: General Options. (line 44) +* command line option; -with-undefined-behavior-sanitizer: Debug options. + (line 76) +* command line option; -with-universal-archs: macOS Options. (line 23) +* command line option; -with-valgrind: Debug options. (line 47) +* command line option; -with-wheel-pkg-dir: General Options. (line 106) +* command line option; -without-c-locale-coercion: General Options. + (line 81) +* command line option; -without-decimal-contextvar: General Options. + (line 57) +* command line option; -without-doc-strings: Performance options. + (line 118) +* command line option; -without-freelists: General Options. (line 90) +* command line option; -without-mimalloc: Performance options. + (line 104) +* command line option; -without-pymalloc: Performance options. + (line 111) +* command line option; -without-readline: Libraries options. (line 45) +* command line option; -without-static-libpython: Linker options<2>. + (line 11) +* command line option; -x: Miscellaneous options. + (line 257) +* command line option; -X: Miscellaneous options. + (line 262) +* command line option; BOLT_APPLY_FLAGS: Performance options. + (line 87) +* command line option; BOLT_INSTRUMENT_FLAGS: Performance options. + (line 93) +* command line option; BZIP2_CFLAGS: Options for third-party dependencies. + (line 8) +* command line option; BZIP2_LIBS: Options for third-party dependencies. + (line 10) +* command line option; CC: C compiler options. (line 6) +* command line option; CFLAGS: C compiler options. (line 10) +* command line option; CONFIG_SITE: Cross Compiling Options. + (line 26) +* command line option; CPP: C compiler options. (line 14) +* command line option; CPPFLAGS: C compiler options. (line 18) +* command line option; CURSES_CFLAGS: Options for third-party dependencies. + (line 15) +* command line option; CURSES_LIBS: Options for third-party dependencies. + (line 17) +* command line option; GDBM_CFLAGS: Options for third-party dependencies. + (line 22) +* command line option; GDBM_LIBS: Options for third-party dependencies. + (line 24) +* command line option; HOSTRUNNER: Cross Compiling Options. + (line 38) +* command line option; LDFLAGS: Linker options. (line 6) +* command line option; LIBB2_CFLAGS: Options for third-party dependencies. + (line 28) +* command line option; LIBB2_LIBS: Options for third-party dependencies. + (line 30) +* command line option; LIBEDIT_CFLAGS: Options for third-party dependencies. + (line 35) +* command line option; LIBEDIT_LIBS: Options for third-party dependencies. + (line 37) +* command line option; LIBFFI_CFLAGS: Options for third-party dependencies. + (line 42) +* command line option; LIBFFI_LIBS: Options for third-party dependencies. + (line 44) +* command line option; LIBLZMA_CFLAGS: Options for third-party dependencies. + (line 59) +* command line option; LIBLZMA_LIBS: Options for third-party dependencies. + (line 61) +* command line option; LIBMPDEC_CFLAGS: Options for third-party dependencies. + (line 49) +* command line option; LIBMPDEC_LIBS: Options for third-party dependencies. + (line 51) +* command line option; LIBREADLINE_CFLAGS: Options for third-party dependencies. + (line 66) +* command line option; LIBREADLINE_LIBS: Options for third-party dependencies. + (line 68) +* command line option; LIBS: Linker options. (line 10) +* command line option; LIBSQLITE3_CFLAGS: Options for third-party dependencies. + (line 73) +* command line option; LIBSQLITE3_LIBS: Options for third-party dependencies. + (line 75) +* command line option; LIBUUID_CFLAGS: Options for third-party dependencies. + (line 80) +* command line option; LIBUUID_LIBS: Options for third-party dependencies. + (line 82) +* command line option; MACHDEP: Linker options. (line 14) +* command line option; PANEL_CFLAGS: Options for third-party dependencies. + (line 87) +* command line option; PANEL_LIBS: Options for third-party dependencies. + (line 89) +* command line option; PKG_CONFIG: General Options. (line 258) +* command line option; PKG_CONFIG_LIBDIR: General Options. (line 262) +* command line option; PKG_CONFIG_PATH: General Options. (line 264) +* command line option; TCLTK_CFLAGS: Options for third-party dependencies. + (line 96) +* command line option; TCLTK_LIBS: Options for third-party dependencies. + (line 98) +* command line option; ZLIB_CFLAGS: Options for third-party dependencies. + (line 102) +* command line option; ZLIB_LIBS: Options for third-party dependencies. + (line 104) +* CommandCompiler (class in codeop): codeop — Compile Python code. + (line 65) +* commands (pdb command): Debugger Commands. (line 160) +* comment: Comments. (line 6) +* comment (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 62) +* comment (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* COMMENT (in module token): token — Constants used with Python parse trees. + (line 71) +* comment (zipfile.ZipFile attribute): ZipFile Objects. (line 362) +* comment (zipfile.ZipInfo attribute): ZipInfo Objects. (line 89) +* comment_url (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 67) +* Comment() (in module xml.etree.ElementTree): Functions<9>. (line 72) +* comment() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 49) +* comment() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects. + (line 18) +* commenters (shlex.shlex attribute): shlex Objects. (line 85) +* CommentHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 336) +* commit() (sqlite3.Connection method): Connection objects. (line 72) +* common (filecmp.dircmp attribute): The dircmp class. (line 63) +* Common Vulnerabilities and Exposures; CVE 2008-5983: Build and C API Changes<8>. + (line 77) +* Common Vulnerabilities and Exposures; CVE 2008-5983 <1>: Build and C API Changes<9>. + (line 47) +* Common Vulnerabilities and Exposures; CVE 2008-5983 <2>: Process-wide parameters. + (line 256) +* Common Vulnerabilities and Exposures; CVE 2012-0876: Security<41>. + (line 23) +* Common Vulnerabilities and Exposures; CVE 2012-0876 <1>: Security<44>. + (line 14) +* Common Vulnerabilities and Exposures; CVE 2012-0876 <2>: Security<50>. + (line 14) +* Common Vulnerabilities and Exposures; CVE 2013-0340: Security<21>. + (line 22) +* Common Vulnerabilities and Exposures; CVE 2013-1753: Library<101>. + (line 193) +* Common Vulnerabilities and Exposures; CVE 2014-0224: PEP 466 Network Security Enhancements for Python 2 7. + (line 30) +* Common Vulnerabilities and Exposures; CVE 2014-4616: Library<101>. + (line 1122) +* Common Vulnerabilities and Exposures; CVE 2015-1283: Security<47>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2015-1283 <1>: Security<52>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2016-0718: Security<41>. + (line 22) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <1>: Security<41>. + (line 23) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <2>: Security<41>. + (line 35) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <3>: Security<44>. + (line 13) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <4>: Security<44>. + (line 14) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <5>: Security<45>. + (line 7) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <6>: Security<50>. + (line 13) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <7>: Security<50>. + (line 14) +* Common Vulnerabilities and Exposures; CVE 2016-0718 <8>: Security<50>. + (line 26) +* Common Vulnerabilities and Exposures; CVE 2016-0772: Security<47>. + (line 8) +* Common Vulnerabilities and Exposures; CVE 2016-0772 <1>: Security<52>. + (line 8) +* Common Vulnerabilities and Exposures; CVE 2016-1000110: Library<80>. + (line 82) +* Common Vulnerabilities and Exposures; CVE 2016-1000110 <1>: Library<87>. + (line 267) +* Common Vulnerabilities and Exposures; CVE 2016-2183: Library<79>. + (line 178) +* Common Vulnerabilities and Exposures; CVE 2016-2183 <1>: Library<87>. + (line 205) +* Common Vulnerabilities and Exposures; CVE 2016-3189: Windows<26>. + (line 25) +* Common Vulnerabilities and Exposures; CVE 2016-4472: Security<41>. + (line 35) +* Common Vulnerabilities and Exposures; CVE 2016-4472 <1>: Security<45>. + (line 7) +* Common Vulnerabilities and Exposures; CVE 2016-4472 <2>: Security<50>. + (line 26) +* Common Vulnerabilities and Exposures; CVE 2016-5300: Security<41>. + (line 24) +* Common Vulnerabilities and Exposures; CVE 2016-5300 <1>: Security<44>. + (line 15) +* Common Vulnerabilities and Exposures; CVE 2016-5300 <2>: Security<50>. + (line 15) +* Common Vulnerabilities and Exposures; CVE 2016-9063: Security<41>. + (line 21) +* Common Vulnerabilities and Exposures; CVE 2016-9063 <1>: Security<44>. + (line 12) +* Common Vulnerabilities and Exposures; CVE 2016-9063 <2>: Security<50>. + (line 12) +* Common Vulnerabilities and Exposures; CVE 2017-1000158: Security<49>. + (line 21) +* Common Vulnerabilities and Exposures; CVE 2017-9233: Security<41>. + (line 20) +* Common Vulnerabilities and Exposures; CVE 2017-9233 <1>: Security<44>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2017-9233 <2>: Security<50>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2018-1060: Security<38>. + (line 48) +* Common Vulnerabilities and Exposures; CVE 2018-1060 <1>: Security<39>. + (line 15) +* Common Vulnerabilities and Exposures; CVE 2018-1060 <2>: Security<42>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2018-1061: Security<38>. + (line 49) +* Common Vulnerabilities and Exposures; CVE 2018-1061 <1>: Security<39>. + (line 16) +* Common Vulnerabilities and Exposures; CVE 2018-1061 <2>: Security<42>. + (line 12) +* Common Vulnerabilities and Exposures; CVE 2018-14647: Security<38>. + (line 26) +* Common Vulnerabilities and Exposures; CVE 2018-25032: Windows<26>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2018-8970: Security<38>. + (line 38) +* Common Vulnerabilities and Exposures; CVE 2018-8970 <1>: Security<39>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2019-12900: Windows<26>. + (line 26) +* Common Vulnerabilities and Exposures; CVE 2019-15903: Security<34>. + (line 20) +* Common Vulnerabilities and Exposures; CVE 2019-18348: Security<31>. + (line 7) +* Common Vulnerabilities and Exposures; CVE 2019-20907: Library<44>. + (line 186) +* Common Vulnerabilities and Exposures; CVE 2019-5010: Security<38>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2019-9740: Security<36>. + (line 9) +* Common Vulnerabilities and Exposures; CVE 2019-9948: Security<35>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2020-10735: Other CPython Implementation Changes. + (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>: Integer string conversion length limitation. + (line 20) +* Common Vulnerabilities and Exposures; CVE 2020-15523: Security<28>. + (line 13) +* Common Vulnerabilities and Exposures; CVE 2020-15801: Security<28>. + (line 7) +* Common Vulnerabilities and Exposures; CVE 2020-8492: Security<30>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2021-3426: Security<23>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2022-26488: Windows<26>. + (line 28) +* Common Vulnerabilities and Exposures; CVE 2022-37434: Windows<23>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2022-42919: Security<19>. + (line 24) +* Common Vulnerabilities and Exposures; CVE 2022-4303: Security<15>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2022-4303 <1>: Security<15>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2023-0286: Security<15>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2023-24329: Security<14>. + (line 19) +* Common Vulnerabilities and Exposures; CVE 2023-27043: email. + (line 22) +* Common Vulnerabilities and Exposures; CVE 2023-27043 <1>: Library<18>. + (line 429) +* Common Vulnerabilities and Exposures; CVE 2023-40217: Security<13>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2023-52425: xml. (line 6) +* Common Vulnerabilities and Exposures; CVE 2023-52425 <1>: Security<10>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2023-52425 <2>: Documentation<12>. + (line 6) +* Common Vulnerabilities and Exposures; CVE 2023-52425 <3>: XML security. + (line 47) +* Common Vulnerabilities and Exposures; CVE 2024-12718: tarfile. + (line 13) +* Common Vulnerabilities and Exposures; CVE 2024-12718 <1>: tarfile. + (line 21) +* Common Vulnerabilities and Exposures; CVE 2024-12718 <2>: Security<2>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2024-4030: os. (line 38) +* Common Vulnerabilities and Exposures; CVE 2024-4030 <1>: tempfile. + (line 8) +* Common Vulnerabilities and Exposures; CVE 2024-4030 <2>: Security<8>. + (line 11) +* Common Vulnerabilities and Exposures; CVE 2025-4138: tarfile. + (line 8) +* Common Vulnerabilities and Exposures; CVE 2025-4138 <1>: Security<2>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2025-4330: tarfile. + (line 20) +* Common Vulnerabilities and Exposures; CVE 2025-4330 <1>: Security<2>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2025-4435: tarfile. + (line 25) +* Common Vulnerabilities and Exposures; CVE 2025-4517: os path<2>. + (line 10) +* Common Vulnerabilities and Exposures; CVE 2025-4517 <1>: Security<2>. + (line 11) +* Common Weakness Enumeration; CWE 257: Recipes and best practices. + (line 16) +* Common Weakness Enumeration; CWE 295: ssl<2>. (line 21) +* Common Weakness Enumeration; CWE 295 <1>: Library<28>. (line 516) +* common_dirs (filecmp.dircmp attribute): The dircmp class. (line 75) +* common_files (filecmp.dircmp attribute): The dircmp class. (line 79) +* common_funny (filecmp.dircmp attribute): The dircmp class. (line 83) +* common_types (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 158) +* commonpath() (in module os.path): os path — Common pathname manipulations. + (line 68) +* commonprefix() (in module os.path): os path — Common pathname manipulations. + (line 84) +* communicate() (asyncio.subprocess.Process method): Interacting with Subprocesses. + (line 50) +* communicate() (subprocess.Popen method): Popen Objects. (line 36) +* Compare (class in ast): Expressions<2>. (line 91) +* compare_digest() (in module hmac): hmac — Keyed-Hashing for Message Authentication. + (line 114) +* compare_digest() (in module secrets): Other functions. (line 6) +* compare_networks() (ipaddress.IPv4Network method): Network objects. + (line 237) +* compare_networks() (ipaddress.IPv6Network method): Network objects. + (line 352) +* COMPARE_OP (opcode): Python Bytecode Instructions. + (line 797) +* compare_signal() (decimal.Context method): Context objects. + (line 277) +* compare_signal() (decimal.Decimal method): Decimal objects. + (line 160) +* compare_to() (tracemalloc.Snapshot method): Snapshot. (line 13) +* compare_total_mag() (decimal.Context method): Context objects. + (line 285) +* compare_total_mag() (decimal.Decimal method): Decimal objects. + (line 192) +* compare_total() (decimal.Context method): Context objects. (line 281) +* compare_total() (decimal.Decimal method): Decimal objects. (line 167) +* compare() (decimal.Context method): Context objects. (line 273) +* compare() (decimal.Decimal method): Decimal objects. (line 149) +* compare() (difflib.Differ method): Differ Objects. (line 38) +* comparison: Comparisons. (line 6) +* COMPARISON_FLAGS (in module doctest): Option Flags. (line 102) +* comparisons: Basic customization. + (line 187) +* Compat32 (class in email.policy): email policy Policy Objects. + (line 563) +* compat32 (in module email.policy): email policy Policy Objects. + (line 618) +* Compile (class in codeop): codeop — Compile Python code. + (line 56) +* compile_command() (in module code): code — Interpreter base classes. + (line 60) +* compile_command() (in module codeop): codeop — Compile Python code. + (line 29) +* compile_dir() (in module compileall): Public functions. (line 6) +* compile_file() (in module compileall): Public functions. (line 96) +* compile_path() (in module compileall): Public functions. (line 161) +* compile() (in module py_compile): py_compile — Compile Python source files. + (line 24) +* compile() (in module re): Functions<2>. (line 6) +* compileall command line option; -b: Command-line use. (line 66) +* compileall command line option; -d: Command-line use. (line 32) +* compileall command line option; -e: Command-line use. (line 107) +* compileall command line option; -f: Command-line use. (line 22) +* compileall command line option; -hardlink-dupes: Command-line use. + (line 111) +* compileall command line option; -i: Command-line use. (line 60) +* compileall command line option; -invalidation-mode: Command-line use. + (line 87) +* compileall command line option; -j: Command-line use. (line 81) +* compileall command line option; -l: Command-line use. (line 17) +* compileall command line option; -o: Command-line use. (line 101) +* compileall command line option; -p: Command-line use. (line 47) +* compileall command line option; -q: Command-line use. (line 26) +* compileall command line option; -r: Command-line use. (line 74) +* compileall command line option; -s: Command-line use. (line 40) +* compileall command line option; -x: Command-line use. (line 54) +* compileall command line option; directory: Command-line use. + (line 9) +* compileall command line option; file: Command-line use. (line 9) +* compiler_flag (__future__._Feature attribute): Module Contents<5>. + (line 88) +* complete_statement() (in module sqlite3): Module functions. + (line 104) +* complete() (rlcompleter.Completer method): rlcompleter — Completion function for GNU readline. + (line 43) +* completedefault() (cmd.Cmd method): Cmd Objects. (line 82) +* CompletedProcess (class in subprocess): Using the subprocess Module. + (line 100) +* Completer (class in rlcompleter): rlcompleter — Completion function for GNU readline. + (line 39) +* complex (built-in class): Built-in Functions. (line 368) +* Complex (class in numbers): The numeric tower. (line 6) +* complex literal: Numeric literals. (line 6) +* complex number: Glossary. (line 278) +* complex number; literals: Numeric Types — int float complex. + (line 19) +* complex; number: numbers Complex complex. + (line 6) +* compound; statement: Compound statements. + (line 6) +* comprehension (class in ast): Comprehensions. (line 58) +* comprehensions: Displays for lists sets and dictionaries. + (line 6) +* compress_size (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 140) +* compress_type (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 85) +* compress() (bz2.BZ2Compressor method): Incremental de compression. + (line 15) +* compress() (in module bz2): One-shot de compression. + (line 6) +* compress() (in module gzip): gzip — Support for gzip files. + (line 191) +* compress() (in module itertools): Itertool Functions. (line 212) +* compress() (in module lzma): Compressing and decompressing data in memory. + (line 183) +* compress() (in module zlib): zlib — Compression compatible with gzip. + (line 43) +* compress() (lzma.LZMACompressor method): Compressing and decompressing data in memory. + (line 81) +* compress() (zlib.Compress method): zlib — Compression compatible with gzip. + (line 203) +* compressed (ipaddress.IPv4Address attribute): Address objects. + (line 58) +* compressed (ipaddress.IPv4Network attribute): Network objects. + (line 107) +* compressed (ipaddress.IPv6Address attribute): Address objects. + (line 251) +* compressed (ipaddress.IPv6Network attribute): Network objects. + (line 319) +* compression() (ssl.SSLSocket method): SSL Sockets. (line 247) +* CompressionError: tarfile — Read and write tar archive files. + (line 209) +* compressobj() (in module zlib): zlib — Compression compatible with gzip. + (line 80) +* COMSPEC: Process Management. (line 777) +* COMSPEC <1>: Popen Constructor. (line 112) +* concat() (in module operator): operator — Standard operators as functions. + (line 176) +* Concatenate (in module typing): Special forms. (line 74) +* concatenation; operation: Common Sequence Operations. + (line 21) +* cond (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 96) +* Condition (class in asyncio): Condition. (line 6) +* Condition (class in multiprocessing): Synchronization primitives. + (line 32) +* Condition (class in threading): Condition objects. (line 72) +* condition (pdb command): Debugger Commands. (line 153) +* Condition() (multiprocessing.managers.SyncManager method): Managers. + (line 172) +* Conditional; expression: Boolean operations. (line 6) +* conditional; expression: Conditional expressions. + (line 6) +* config() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 55) +* ConfigParser (class in configparser): ConfigParser Objects. + (line 6) +* configuration information: sysconfig — Provide access to Python’s configuration information. + (line 10) +* configuration; file: configparser — Configuration file parser. + (line 8) +* configure_mock() (unittest.mock.Mock method): The Mock Class. + (line 265) +* configure() (tkinter.ttk.Style method): Ttk Styling. (line 24) +* CONFORM (enum.FlagBoundary attribute): Data Types<2>. (line 689) +* confstr_names (in module os): Miscellaneous System Information. + (line 28) +* confstr() (in module os): Miscellaneous System Information. + (line 6) +* conjugate() (complex number method): Numeric Types — int float complex. + (line 94) +* conjugate() (decimal.Decimal method): Decimal objects. (line 204) +* conjugate() (numbers.Complex method): The numeric tower. (line 23) +* connect_accepted_socket() (asyncio.loop method): Creating network servers. + (line 146) +* connect_ex() (socket.socket method): Socket Objects. (line 86) +* connect_read_pipe() (asyncio.loop method): Working with pipes. + (line 6) +* connect_write_pipe() (asyncio.loop method): Working with pipes. + (line 22) +* connect() (ftplib.FTP method): FTP objects. (line 89) +* connect() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 143) +* connect() (in module sqlite3): Module functions. (line 6) +* connect() (multiprocessing.managers.BaseManager method): Managers. + (line 76) +* connect() (smtplib.SMTP method): SMTP Objects. (line 33) +* connect() (socket.socket method): Socket Objects. (line 62) +* Connection (class in multiprocessing.connection): Connection Objects. + (line 13) +* Connection (class in sqlite3): Connection objects. (line 6) +* connection (sqlite3.Cursor attribute): Cursor objects. (line 176) +* connection_lost() (asyncio.BaseProtocol method): Base Protocol. + (line 23) +* connection_made() (asyncio.BaseProtocol method): Base Protocol. + (line 15) +* ConnectionAbortedError: OS exceptions. (line 45) +* ConnectionError: OS exceptions. (line 30) +* ConnectionRefusedError: OS exceptions. (line 51) +* ConnectionResetError: OS exceptions. (line 57) +* ConnectRegistry() (in module winreg): Functions<13>. (line 17) +* const (optparse.Option attribute): Option attributes. (line 58) +* constant: Literals. (line 6) +* Constant (class in ast): Literals<3>. (line 6) +* constructor() (in module copyreg): copyreg — Register pickle support functions. + (line 17) +* consumed (asyncio.LimitOverrunError attribute): Exceptions<13>. + (line 67) +* container: Objects values and types. + (line 67) +* container <1>: Custom classes. (line 19) +* Container (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 6) +* Container (class in typing): Aliases to container ABCs in collections abc. + (line 33) +* container; iteration over: Iterator Types. (line 6) +* CONTAINS_OP (opcode): Python Bytecode Instructions. + (line 812) +* contains() (in module operator): operator — Standard operators as functions. + (line 181) +* content (urllib.error.ContentTooShortError attribute): urllib error — Exception classes raised by urllib request. + (line 72) +* content_disposition (email.headerregistry.ContentDispositionHeader attribute): email headerregistry Custom Header Objects. + (line 285) +* content_manager (email.policy.EmailPolicy attribute): email policy Policy Objects. + (line 419) +* content_type (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects. + (line 272) +* ContentDispositionHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 280) +* ContentHandler (class in xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 18) +* ContentManager (class in email.contentmanager): email contentmanager Managing MIME Content. + (line 12) +* contents (ctypes._Pointer attribute): Arrays and pointers. + (line 58) +* contents() (importlib.abc.ResourceReader method): importlib abc – Abstract base classes related to import. + (line 491) +* contents() (importlib.resources.abc.ResourceReader method): importlib resources abc – Abstract base classes for resources. + (line 68) +* contents() (in module importlib.resources): Functional API. + (line 150) +* ContentTooShortError: urllib error — Exception classes raised by urllib request. + (line 66) +* ContentTransferEncoding (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 290) +* ContentTypeHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 267) +* context: Glossary. (line 291) +* Context (class in contextvars): Manual Context Management. + (line 20) +* Context (class in decimal): Context objects. (line 115) +* context (ssl.SSLSocket attribute): SSL Sockets. (line 340) +* context management protocol: Context Manager Types. + (line 6) +* context management protocol <1>: Glossary. (line 308) +* context manager: With Statement Context Managers. + (line 14) +* context manager <1>: Context Manager Types. + (line 6) +* context manager <2>: Glossary. (line 312) +* context variable: Glossary. (line 318) +* context_diff() (in module difflib): difflib — Helpers for computing deltas. + (line 155) +* ContextDecorator (class in contextlib): Utilities. (line 382) +* ContextManager (class in typing): Aliases to contextlib ABCs. + (line 6) +* contextmanager() (in module contextlib): Utilities. (line 31) +* ContextVar (class in contextvars): Context Variables. (line 6) +* CONTIG (inspect.BufferFlags attribute): Buffer flags. (line 33) +* CONTIG_RO (inspect.BufferFlags attribute): Buffer flags. (line 35) +* contiguous: shape strides suboffsets. + (line 26) +* contiguous <1>: Glossary. (line 326) +* contiguous (memoryview attribute): Memory Views. (line 487) +* Continue (class in ast): Control flow. (line 99) +* continue (pdb command): Debugger Commands. (line 226) +* CONTINUOUS (enum.EnumCheck attribute): Data Types<2>. (line 628) +* control() (select.kqueue method): Kqueue Objects. (line 22) +* controlnames (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 240) +* CONTTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 307) +* convert_arg_line_to_args() (argparse.ArgumentParser method): Customizing file parsing. + (line 6) +* convert_field() (string.Formatter method): Custom String Formatting. + (line 108) +* CONVERT_VALUE (opcode): Python Bytecode Instructions. + (line 1168) +* Cookie (class in http.cookiejar): http cookiejar — Cookie handling for HTTP clients. + (line 113) +* CookieError: http cookies — HTTP state management. + (line 34) +* CookieJar (class in http.cookiejar): http cookiejar — Cookie handling for HTTP clients. + (line 46) +* cookiejar (urllib.request.HTTPCookieProcessor attribute): HTTPCookieProcessor Objects. + (line 8) +* CookiePolicy (class in http.cookiejar): http cookiejar — Cookie handling for HTTP clients. + (line 77) +* Coordinated Universal Time: time — Time access and conversions. + (line 39) +* Copy: Help menu Shell and Editor. + (line 30) +* COPY (opcode): Python Bytecode Instructions. + (line 159) +* copy_abs() (decimal.Context method): Context objects. (line 290) +* copy_abs() (decimal.Decimal method): Decimal objects. (line 209) +* copy_context() (in module contextvars): Manual Context Management. + (line 6) +* copy_decimal() (decimal.Context method): Context objects. (line 197) +* copy_file_range() (in module os): File Descriptor Operations. + (line 44) +* COPY_FREE_VARS (opcode): Python Bytecode Instructions. + (line 1015) +* copy_location() (in module ast): ast Helpers. (line 161) +* copy_negate() (decimal.Context method): Context objects. (line 294) +* copy_negate() (decimal.Decimal method): Decimal objects. (line 215) +* copy_sign() (decimal.Context method): Context objects. (line 298) +* copy_sign() (decimal.Decimal method): Decimal objects. (line 221) +* copy; protocol: Pickling Class Instances. + (line 111) +* copy() (collections.deque method): deque objects. (line 47) +* copy() (contextvars.Context method): Manual Context Management. + (line 103) +* copy() (decimal.Context method): Context objects. (line 193) +* copy() (dict method): Mapping Types — dict. + (line 169) +* copy() (frozenset method): Set Types — set frozenset. + (line 123) +* copy() (hashlib.hash method): Hash Objects. (line 51) +* copy() (hmac.HMAC method): hmac — Keyed-Hashing for Message Authentication. + (line 84) +* copy() (http.cookies.Morsel method): Morsel Objects. (line 99) +* copy() (imaplib.IMAP4 method): IMAP4 Objects. (line 68) +* copy() (in module copy): copy — Shallow and deep copy operations. + (line 18) +* copy() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 83) +* copy() (in module shutil): Directory and files operations. + (line 122) +* copy() (sequence method): Mutable Sequence Types. + (line 16) +* copy() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 59) +* copy() (types.MappingProxyType method): Standard Interpreter Types. + (line 256) +* copy() (zlib.Compress method): zlib — Compression compatible with gzip. + (line 224) +* copy() (zlib.Decompress method): zlib — Compression compatible with gzip. + (line 293) +* copy2() (in module shutil): Directory and files operations. + (line 154) +* copyfile() (in module shutil): Directory and files operations. + (line 17) +* copyfileobj() (in module shutil): Directory and files operations. + (line 6) +* copying files: shutil — High-level file operations. + (line 8) +* copymode() (in module shutil): Directory and files operations. + (line 59) +* copyright (built-in variable): Constants added by the site module. + (line 24) +* copyright (in module sys): sys — System-specific parameters and functions. + (line 178) +* copyright (in module sys) <1>: Process-wide parameters. + (line 190) +* copysign() (in module math): Floating point manipulation functions. + (line 6) +* copystat() (in module shutil): Directory and files operations. + (line 77) +* copytree() (in module shutil): Directory and files operations. + (line 193) +* coroutine: Special method lookup. + (line 74) +* coroutine <1>: Yield expressions. (line 54) +* coroutine <2>: Glossary. (line 337) +* Coroutine (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 127) +* Coroutine (class in typing): Aliases to asynchronous ABCs in collections abc. + (line 6) +* coroutine function: Glossary. (line 345) +* coroutine; function: Coroutine functions. + (line 6) +* coroutine() (in module types): Coroutine Utility Functions. + (line 6) +* CoroutineType (in module types): Standard Interpreter Types. + (line 42) +* correlation() (in module statistics): Function details. (line 580) +* cos() (in module cmath): Trigonometric functions<2>. + (line 23) +* cos() (in module math): Trigonometric functions. + (line 31) +* cosh() (in module cmath): Hyperbolic functions<2>. + (line 23) +* cosh() (in module math): Hyperbolic functions. + (line 21) +* count (tracemalloc.Statistic attribute): Statistic. (line 15) +* count (tracemalloc.StatisticDiff attribute): StatisticDiff. + (line 15) +* count_diff (tracemalloc.StatisticDiff attribute): StatisticDiff. + (line 20) +* count() (array.array method): array — Efficient arrays of numeric values. + (line 153) +* count() (bytearray method): Bytes and Bytearray Operations. + (line 36) +* count() (bytes method): Bytes and Bytearray Operations. + (line 36) +* count() (collections.deque method): deque objects. (line 53) +* count() (in module itertools): Itertool Functions. (line 225) +* count() (multiprocessing.shared_memory.ShareableList method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 332) +* count() (sequence method): Common Sequence Operations. + (line 21) +* count() (str method): String Methods<2>. (line 62) +* Counter (class in collections): Counter objects. (line 24) +* Counter (class in typing): Aliases to types in collections. + (line 39) +* countOf() (in module operator): operator — Standard operators as functions. + (line 187) +* countTestCases() (unittest.TestCase method): Test cases. (line 737) +* countTestCases() (unittest.TestSuite method): Grouping tests. + (line 55) +* covariance() (in module statistics): Function details. (line 558) +* CoverageResults (class in trace): Programmatic Interface. + (line 47) +* CPPFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* CPPFLAGS <1>: Preprocessor flags. (line 8) +* CPPFLAGS <2>: Preprocessor flags. (line 18) +* CPPFLAGS <3>: Linker flags. (line 50) +* cProfile command line option; -m: Instant User’s Manual. + (line 99) +* cProfile command line option; -o: Instant User’s Manual. + (line 89) +* cProfile command line option; -s: Instant User’s Manual. + (line 93) +* CPU time: Functions<5>. (line 247) +* CPU time <1>: Functions<5>. (line 615) +* cpu_count() (in module multiprocessing): Miscellaneous<3>. (line 13) +* cpu_count() (in module os): Miscellaneous System Information. + (line 37) +* CPython: Glossary. (line 353) +* cpython_only() (in module test.support): test support — Utilities for the Python test suite. + (line 528) +* CR (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 64) +* crawl_delay() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 50) +* CRC (zipfile.ZipInfo attribute): ZipInfo Objects. (line 136) +* crc_hqx() (in module binascii): binascii — Convert between binary and ASCII. + (line 91) +* crc32() (in module binascii): binascii — Convert between binary and ASCII. + (line 98) +* crc32() (in module zlib): zlib — Compression compatible with gzip. + (line 121) +* create_aggregate() (sqlite3.Connection method): Connection objects. + (line 157) +* create_archive() (in module zipapp): Python API. (line 8) +* create_autospec() (in module unittest.mock): create_autospec. + (line 6) +* CREATE_BREAKAWAY_FROM_JOB (in module subprocess): Windows Constants. + (line 140) +* create_collation() (sqlite3.Connection method): Connection objects. + (line 301) +* create_configuration() (venv.EnvBuilder method): API<2>. (line 148) +* create_connection() (asyncio.loop method): Opening network connections. + (line 6) +* create_connection() (in module socket): Creating sockets. (line 83) +* create_datagram_endpoint() (asyncio.loop method): Opening network connections. + (line 157) +* create_decimal_from_float() (decimal.Context method): Context objects. + (line 225) +* create_decimal() (decimal.Context method): Context objects. + (line 201) +* create_default_context() (in module ssl): Context creation. + (line 9) +* CREATE_DEFAULT_ERROR_MODE (in module subprocess): Windows Constants. + (line 130) +* create_eager_task_factory() (in module asyncio): Eager Task Factory. + (line 32) +* create_empty_file() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 92) +* create_function() (sqlite3.Connection method): Connection objects. + (line 115) +* create_future() (asyncio.loop method): Creating Futures and Tasks. + (line 6) +* create_git_ignore_file() (venv.EnvBuilder method): API<2>. (line 215) +* create_module() (importlib.abc.Loader method): importlib abc – Abstract base classes related to import. + (line 103) +* create_module() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 314) +* create_module() (zipimport.zipimporter method): zipimporter Objects. + (line 23) +* CREATE_NEW_CONSOLE (in module subprocess): Windows Constants. + (line 54) +* CREATE_NEW_PROCESS_GROUP (in module subprocess): Windows Constants. + (line 59) +* CREATE_NO_WINDOW (in module subprocess): Windows Constants. + (line 115) +* create_server() (asyncio.loop method): Creating network servers. + (line 6) +* create_server() (in module socket): Creating sockets. (line 114) +* create_stats() (profile.Profile method): profile and cProfile Module Reference. + (line 86) +* create_string_buffer() (in module ctypes): Utility functions. + (line 40) +* create_subprocess_exec() (in module asyncio): Creating Subprocesses. + (line 6) +* create_subprocess_shell() (in module asyncio): Creating Subprocesses. + (line 23) +* create_system (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 100) +* create_task() (asyncio.loop method): Creating Futures and Tasks. + (line 17) +* create_task() (asyncio.TaskGroup method): Task Groups. (line 17) +* create_task() (in module asyncio): Creating Tasks. (line 10) +* create_unicode_buffer() (in module ctypes): Utility functions. + (line 81) +* create_unix_connection() (asyncio.loop method): Opening network connections. + (line 242) +* create_unix_server() (asyncio.loop method): Creating network servers. + (line 116) +* create_version (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 104) +* create_window_function() (sqlite3.Connection method): Connection objects. + (line 212) +* create() (imaplib.IMAP4 method): IMAP4 Objects. (line 72) +* create() (in module venv): API<2>. (line 235) +* create() (venv.EnvBuilder method): API<2>. (line 62) +* createAttribute() (xml.dom.Document method): Document Objects. + (line 46) +* createAttributeNS() (xml.dom.Document method): Document Objects. + (line 53) +* createComment() (xml.dom.Document method): Document Objects. + (line 34) +* createDocument() (xml.dom.DOMImplementation method): DOMImplementation Objects. + (line 16) +* createDocumentType() (xml.dom.DOMImplementation method): DOMImplementation Objects. + (line 26) +* createElement() (xml.dom.Document method): Document Objects. + (line 14) +* createElementNS() (xml.dom.Document method): Document Objects. + (line 21) +* createfilehandler() (_tkinter.Widget.tk method): File Handlers. + (line 27) +* CreateKey() (in module winreg): Functions<13>. (line 35) +* CreateKeyEx() (in module winreg): Functions<13>. (line 63) +* createLock() (logging.Handler method): Handler Objects. (line 20) +* createLock() (logging.NullHandler method): NullHandler. (line 24) +* createProcessingInstruction() (xml.dom.Document method): Document Objects. + (line 40) +* createSocket() (logging.handlers.SocketHandler method): SocketHandler. + (line 72) +* createSocket() (logging.handlers.SysLogHandler method): SysLogHandler. + (line 50) +* createTextNode() (xml.dom.Document method): Document Objects. + (line 28) +* credits (built-in variable): Constants added by the site module. + (line 24) +* CRITICAL (in module logging): Logging Levels. (line 45) +* critical() (in module logging): Module-Level Functions. + (line 86) +* critical() (logging.Logger method): Logger Objects. (line 307) +* CRNCYSTR (in module locale): locale — Internationalization services. + (line 295) +* CRT_ASSEMBLY_VERSION (in module msvcrt): Other Functions. (line 89) +* CRT_ASSERT (in module msvcrt): Other Functions. (line 66) +* CRT_ERROR (in module msvcrt): Other Functions. (line 61) +* CRT_WARN (in module msvcrt): Other Functions. (line 56) +* CRTDBG_MODE_DEBUG (in module msvcrt): Other Functions. (line 70) +* CRTDBG_MODE_FILE (in module msvcrt): Other Functions. (line 74) +* CRTDBG_MODE_WNDW (in module msvcrt): Other Functions. (line 80) +* CRTDBG_REPORT_MODE (in module msvcrt): Other Functions. (line 85) +* CrtSetReportFile() (in module msvcrt): Other Functions. (line 48) +* CrtSetReportMode() (in module msvcrt): Other Functions. (line 40) +* cryptography: Cryptographic Services. + (line 6) +* cssclass_month (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 293) +* cssclass_month_head (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 286) +* cssclass_noday (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 272) +* cssclass_year (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 300) +* cssclass_year_head (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 307) +* cssclasses (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 259) +* cssclasses_weekday_head (calendar.HTMLCalendar attribute): calendar — General calendar-related functions. + (line 279) +* csv: csv — CSV File Reading and Writing. + (line 8) +* cte (email.headerregistry.ContentTransferEncoding attribute): email headerregistry Custom Header Objects. + (line 294) +* cte_type (email.policy.Policy attribute): email policy Policy Objects. + (line 160) +* ctermid() (in module os): Process Parameters. (line 9) +* ctime() (datetime.date method): date Objects. (line 284) +* ctime() (datetime.datetime method): datetime Objects. (line 736) +* ctime() (in module time): Functions<5>. (line 93) +* CTRL_BREAK_EVENT (in module signal): Module contents<2>. (line 199) +* CTRL_C_EVENT (in module signal): Module contents<2>. (line 190) +* ctrl() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 216) +* curdir (in module os): Miscellaneous System Information. + (line 104) +* currency() (in module locale): locale — Internationalization services. + (line 468) +* current context: Glossary. (line 360) +* current_process() (in module multiprocessing): Miscellaneous<3>. + (line 35) +* current_task() (in module asyncio): Introspection. (line 6) +* current_thread() (in module threading): Reference<2>. (line 16) +* current() (tkinter.ttk.Combobox method): ttk Combobox. (line 8) +* CurrentByteIndex (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 195) +* CurrentColumnNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 199) +* currentframe() (in module inspect): The interpreter stack. + (line 161) +* CurrentLineNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 203) +* curs_set() (in module curses): Functions<6>. (line 61) +* Cursor (class in sqlite3): Cursor objects. (line 19) +* cursor() (sqlite3.Connection method): Connection objects. (line 27) +* cursyncup() (curses.window method): Window Objects. (line 172) +* Cut: Help menu Shell and Editor. + (line 30) +* cwd() (ftplib.FTP method): FTP objects. (line 336) +* cwd() (pathlib.Path class method): Expanding and resolving paths. + (line 30) +* cycle() (in module itertools): Itertool Functions. (line 247) +* CycleError: Exceptions<4>. (line 8) +* Cyclic Redundancy Check: zlib — Compression compatible with gzip. + (line 123) +* D_FMT (in module locale): locale — Internationalization services. + (line 198) +* D_T_FMT (in module locale): locale — Internationalization services. + (line 192) +* daemon (multiprocessing.Process attribute): Process and exceptions. + (line 134) +* daemon (threading.Thread attribute): Thread objects. (line 202) +* daemon_threads (socketserver.ThreadingMixIn attribute): Server Creation Notes. + (line 55) +* dangling; else: Compound statements. + (line 55) +* data: Objects values and types. + (line 6) +* data (collections.UserDict attribute): UserDict objects. (line 24) +* data (collections.UserList attribute): UserList objects. (line 29) +* data (collections.UserString attribute): UserString objects. + (line 24) +* data (plistlib.UID attribute): plistlib — Generate and parse Apple plist files. + (line 147) +* data (select.kevent attribute): Kevent Objects. (line 175) +* data (selectors.SelectorKey attribute): Classes<4>. (line 48) +* data (urllib.request.Request attribute): Request Objects. (line 39) +* data (xml.dom.Comment attribute): Comment Objects. (line 9) +* data (xml.dom.ProcessingInstruction attribute): ProcessingInstruction Objects. + (line 14) +* data (xml.dom.Text attribute): Text and CDATASection Objects. + (line 15) +* data (xmlrpc.client.Binary attribute): Binary Objects. (line 12) +* data_filter() (in module tarfile): Default named filters. + (line 36) +* data_open() (urllib.request.DataHandler method): DataHandler Objects. + (line 6) +* data_received() (asyncio.Protocol method): Streaming Protocols. + (line 13) +* data; tabular: csv — CSV File Reading and Writing. + (line 8) +* data; type: The standard type hierarchy. + (line 6) +* data() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 33) +* DatabaseError: Exceptions<7>. (line 44) +* databases: dbm dumb — Portable DBM implementation. + (line 8) +* dataclass_transform() (in module typing): Functions and decorators. + (line 114) +* dataclass() (in module dataclasses): Module contents<4>. (line 6) +* DataError: Exceptions<7>. (line 51) +* datagram_received() (asyncio.DatagramProtocol method): Datagram Protocols. + (line 9) +* DatagramHandler (class in logging.handlers): DatagramHandler. + (line 10) +* DatagramProtocol (class in asyncio): Base Protocols. (line 20) +* DatagramRequestHandler (class in socketserver): Request Handler Objects. + (line 56) +* DatagramTransport (class in asyncio): Transports Hierarchy. + (line 43) +* DataHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 428) +* date (class in datetime): date Objects. (line 13) +* date_time (zipfile.ZipInfo attribute): ZipInfo Objects. (line 55) +* date_time_string() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 320) +* date() (datetime.datetime method): datetime Objects. (line 442) +* DateHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 136) +* datetime (class in datetime): datetime Objects. (line 17) +* DateTime (class in xmlrpc.client): DateTime Objects. (line 6) +* datetime (email.headerregistry.DateHeader attribute): email headerregistry Custom Header Objects. + (line 145) +* Day (class in calendar): calendar — General calendar-related functions. + (line 460) +* day (datetime.date attribute): date Objects. (line 124) +* day (datetime.datetime attribute): datetime Objects. (line 313) +* DAY_1 (in module locale): locale — Internationalization services. + (line 215) +* DAY_2 (in module locale): locale — Internationalization services. + (line 215) +* DAY_3 (in module locale): locale — Internationalization services. + (line 215) +* DAY_4 (in module locale): locale — Internationalization services. + (line 215) +* DAY_5 (in module locale): locale — Internationalization services. + (line 215) +* DAY_6 (in module locale): locale — Internationalization services. + (line 215) +* DAY_7 (in module locale): locale — Internationalization services. + (line 215) +* day_abbr (in module calendar): calendar — General calendar-related functions. + (line 438) +* day_name (in module calendar): calendar — General calendar-related functions. + (line 429) +* daylight (in module time): Timezone Constants. (line 13) +* Daylight Saving Time: time — Time access and conversions. + (line 45) +* days (datetime.timedelta attribute): timedelta Objects. (line 110) +* DbfilenameShelf (class in shelve): Restrictions. (line 73) +* DC1 (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 76) +* DC2 (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 79) +* DC3 (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 82) +* DC4 (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 85) +* dcgettext() (in module locale): Access to message catalogs. + (line 10) +* deactivate_stack_trampoline() (in module sys): sys — System-specific parameters and functions. + (line 1764) +* deallocation, object: Finalization and De-allocation. + (line 6) +* debug (imaplib.IMAP4 attribute): IMAP4 Objects. (line 398) +* DEBUG (in module logging): Logging Levels. (line 24) +* DEBUG (in module re): Flags. (line 32) +* debug (pdb command): Debugger Commands. (line 429) +* debug (shlex.shlex attribute): shlex Objects. (line 162) +* debug (sys.flags attribute): sys — System-specific parameters and functions. + (line 529) +* debug (zipfile.ZipFile attribute): ZipFile Objects. (line 356) +* DEBUG_BYTECODE_SUFFIXES (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 20) +* DEBUG_COLLECTABLE (in module gc): gc — Garbage Collector interface. + (line 302) +* DEBUG_LEAK (in module gc): gc — Garbage Collector interface. + (line 322) +* DEBUG_SAVEALL (in module gc): gc — Garbage Collector interface. + (line 316) +* debug_src() (in module doctest): Debugging. (line 147) +* DEBUG_STATS (in module gc): gc — Garbage Collector interface. + (line 297) +* DEBUG_UNCOLLECTABLE (in module gc): gc — Garbage Collector interface. + (line 306) +* debug() (in module doctest): Debugging. (line 124) +* debug() (in module logging): Module-Level Functions. + (line 46) +* debug() (logging.Logger method): Logger Objects. (line 186) +* debug() (unittest.TestCase method): Test cases. (line 120) +* debug() (unittest.TestSuite method): Grouping tests. (line 48) +* debugger: Reference<2>. (line 132) +* debugger <1>: Debug menu Shell window only. + (line 15) +* debugger <2>: sys — System-specific parameters and functions. + (line 945) +* debugger <3>: sys — System-specific parameters and functions. + (line 1603) +* debugger; configuration; file: Debugger Commands. (line 59) +* debugging: pdb — The Python Debugger. + (line 8) +* debugging; assertions: The assert statement. + (line 6) +* debuglevel (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 69) +* DebugRunner (class in doctest): Debugging. (line 168) +* DECEMBER (in module calendar): calendar — General calendar-related functions. + (line 490) +* Decimal (class in decimal): Decimal objects. (line 6) +* decimal literal: Numeric literals. (line 6) +* decimal() (in module unicodedata): unicodedata — Unicode Database. + (line 31) +* DecimalException (class in decimal): Signals. (line 29) +* decode (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 78) +* decode_header() (in module email.header): email header Internationalized headers. + (line 183) +* decode_params() (in module email.utils): email utils Miscellaneous utilities. + (line 217) +* decode_rfc2231() (in module email.utils): email utils Miscellaneous utilities. + (line 187) +* decode_source() (in module importlib.util): importlib util – Utility code for importers. + (line 72) +* decode() (bytearray method): Bytes and Bytearray Operations. + (line 92) +* decode() (bytes method): Bytes and Bytearray Operations. + (line 92) +* decode() (codecs.Codec method): Stateless Encoding and Decoding. + (line 29) +* decode() (codecs.IncrementalDecoder method): IncrementalDecoder Objects. + (line 28) +* decode() (in module base64): Legacy Interface. (line 6) +* decode() (in module codecs): codecs — Codec registry and base classes. + (line 34) +* decode() (in module quopri): quopri — Encode and decode MIME quoted-printable data. + (line 19) +* decode() (json.JSONDecoder method): Encoders and Decoders. + (line 87) +* decode() (xmlrpc.client.Binary method): Binary Objects. (line 20) +* decode() (xmlrpc.client.DateTime method): DateTime Objects. + (line 13) +* decodebytes() (in module base64): Legacy Interface. (line 13) +* DecodedGenerator (class in email.generator): email generator Generating MIME documents. + (line 231) +* decodestring() (in module quopri): quopri — Encode and decode MIME quoted-printable data. + (line 41) +* decomposition() (in module unicodedata): unicodedata — Unicode Database. + (line 75) +* decompress() (bz2.BZ2Decompressor method): Incremental de compression. + (line 45) +* decompress() (in module bz2): One-shot de compression. + (line 16) +* decompress() (in module gzip): gzip — Support for gzip files. + (line 213) +* decompress() (in module lzma): Compressing and decompressing data in memory. + (line 192) +* decompress() (in module zlib): zlib — Compression compatible with gzip. + (line 135) +* decompress() (lzma.LZMADecompressor method): Compressing and decompressing data in memory. + (line 132) +* decompress() (zlib.Decompress method): zlib — Compression compatible with gzip. + (line 262) +* decompressobj() (in module zlib): zlib — Compression compatible with gzip. + (line 180) +* decorator: Glossary. (line 370) +* DEDENT (in module token): token — Constants used with Python parse trees. + (line 91) +* DEDENT token: Indentation. (line 33) +* DEDENT token <1>: Compound statements. + (line 55) +* dedent() (in module textwrap): textwrap — Text wrapping and filling. + (line 76) +* deepcopy() (in module copy): copy — Shallow and deep copy operations. + (line 22) +* def_prog_mode() (in module curses): Functions<6>. (line 70) +* def_shell_mode() (in module curses): Functions<6>. (line 77) +* default (in module email.policy): email policy Policy Objects. + (line 504) +* DEFAULT (in module unittest.mock): DEFAULT. (line 6) +* default (inspect.Parameter attribute): Introspecting callables with the Signature object. + (line 217) +* default (optparse.Option attribute): Option attributes. (line 44) +* DEFAULT_BUFFER_SIZE (in module io): High-level Module Interface. + (line 6) +* default_bufsize (in module xml.dom.pulldom): xml dom pulldom — Support for building partial DOM trees. + (line 102) +* default_exception_handler() (asyncio.loop method): Error Handling API. + (line 34) +* default_factory (collections.defaultdict attribute): defaultdict objects. + (line 50) +* DEFAULT_FORMAT (in module tarfile): tarfile — Read and write tar archive files. + (line 339) +* DEFAULT_IGNORES (in module filecmp): The dircmp class. (line 115) +* default_loader() (in module xml.etree.ElementInclude): Functions<10>. + (line 6) +* default_max_str_digits (sys.int_info attribute): sys — System-specific parameters and functions. + (line 1155) +* default_open() (urllib.request.BaseHandler method): BaseHandler Objects. + (line 30) +* DEFAULT_PROTOCOL (in module pickle): Module Interface. (line 21) +* DEFAULT_TIMEOUT (unittest.mock.ThreadingMock attribute): The Mock Class. + (line 999) +* default_timer() (in module timeit): Python Interface. (line 32) +* default; parameter; value: Function definitions. + (line 68) +* default() (cmd.Cmd method): Cmd Objects. (line 76) +* default() (json.JSONEncoder method): Encoders and Decoders. + (line 199) +* DefaultContext (in module decimal): Context objects. (line 90) +* DefaultCookiePolicy (class in http.cookiejar): http cookiejar — Cookie handling for HTTP clients. + (line 82) +* defaultdict (class in collections): defaultdict objects. + (line 6) +* DefaultDict (class in typing): Aliases to types in collections. + (line 6) +* DefaultEventLoopPolicy (class in asyncio): Policy Objects. (line 54) +* DefaultHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 351) +* DefaultHandlerExpand() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 358) +* defaults() (configparser.ConfigParser method): ConfigParser Objects. + (line 112) +* DefaultSelector (class in selectors): Classes<4>. (line 161) +* defaultTestLoader (in module unittest): Loading and running tests. + (line 457) +* defaultTestResult() (unittest.TestCase method): Test cases. + (line 742) +* defects (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects. + (line 52) +* defects (email.message.EmailMessage attribute): email message Representing an email message. + (line 712) +* defects (email.message.Message attribute): email message Message Representing an email message using the compat32 API. + (line 727) +* defpath (in module os): Miscellaneous System Information. + (line 144) +* DefragResult (class in urllib.parse): Structured Parse Results. + (line 40) +* DefragResultBytes (class in urllib.parse): Structured Parse Results. + (line 65) +* degrees() (in module math): Angular conversion. (line 6) +* degrees() (in module turtle): Settings for measurement. + (line 6) +* Del (class in ast): Variables. (line 11) +* DEL (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 124) +* del_param() (email.message.EmailMessage method): email message Representing an email message. + (line 383) +* del_param() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 545) +* delay_output() (in module curses): Functions<6>. (line 85) +* delay() (in module turtle): Animation control. (line 6) +* delayload (http.cookiejar.FileCookieJar attribute): CookieJar and FileCookieJar Objects. + (line 159) +* delch() (curses.window method): Window Objects. (line 177) +* dele() (poplib.POP3 method): POP3 Objects. (line 68) +* Delete (class in ast): Statements. (line 139) +* DELETE_ATTR (opcode): Python Bytecode Instructions. + (line 615) +* DELETE_DEREF (opcode): Python Bytecode Instructions. + (line 1005) +* DELETE_FAST (opcode): Python Bytecode Instructions. + (line 966) +* DELETE_GLOBAL (opcode): Python Bytecode Instructions. + (line 629) +* DELETE_NAME (opcode): Python Bytecode Instructions. + (line 569) +* DELETE_SUBSCR (opcode): Python Bytecode Instructions. + (line 270) +* delete() (ftplib.FTP method): FTP objects. (line 329) +* delete() (imaplib.IMAP4 method): IMAP4 Objects. (line 76) +* delete() (tkinter.ttk.Treeview method): ttk Treeview. (line 73) +* deleteacl() (imaplib.IMAP4 method): IMAP4 Objects. (line 80) +* deletefilehandler() (_tkinter.Widget.tk method): File Handlers. + (line 37) +* DeleteKey() (in module winreg): Functions<13>. (line 102) +* DeleteKeyEx() (in module winreg): Functions<13>. (line 124) +* deleteln() (curses.window method): Window Objects. (line 181) +* deleteMe() (bdb.Breakpoint method): bdb — Debugger framework. + (line 42) +* DeleteValue() (in module winreg): Functions<13>. (line 160) +* deletion; target: The del statement<2>. + (line 6) +* deletion; target; list: The del statement<2>. + (line 6) +* delimiter (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 19) +* delimiters: Delimiters. (line 6) +* delitem() (in module operator): operator — Standard operators as functions. + (line 191) +* deliver_challenge() (in module multiprocessing.connection): Listeners and Clients. + (line 15) +* delocalize() (in module locale): locale — Internationalization services. + (line 489) +* demo_app() (in module wsgiref.simple_server): wsgiref simple_server – a simple WSGI HTTP server. + (line 36) +* denominator (fractions.Fraction attribute): fractions — Rational numbers. + (line 119) +* denominator (numbers.Rational attribute): The numeric tower. + (line 55) +* deprecated() (in module warnings): Available Functions. + (line 136) +* DeprecationWarning: Warnings. (line 17) +* deque (class in collections): deque objects. (line 6) +* Deque (class in typing): Aliases to types in collections. + (line 49) +* dequeue() (logging.handlers.QueueListener method): QueueListener. + (line 50) +* DER_cert_to_PEM_cert() (in module ssl): Certificate handling. + (line 52) +* derive() (BaseExceptionGroup method): Exception groups. (line 76) +* derwin() (curses.window method): Window Objects. (line 186) +* descrgetfunc (C type): Slot Type typedefs. (line 69) +* description (inspect.Parameter.kind attribute): Introspecting callables with the Signature object. + (line 283) +* description (sqlite3.Cursor attribute): Cursor objects. (line 189) +* descriptor: Glossary. (line 392) +* descrsetfunc (C type): Slot Type typedefs. (line 74) +* deserialize() (sqlite3.Connection method): Connection objects. + (line 697) +* dest (optparse.Option attribute): Option attributes. (line 35) +* destructor: Basic customization. + (line 55) +* destructor <1>: Assignment statements. + (line 71) +* destructor (C type): Slot Type typedefs. (line 24) +* detach() (io.BufferedIOBase method): I/O Base Classes. (line 259) +* detach() (io.TextIOBase method): Text I/O<2>. (line 37) +* detach() (socket.socket method): Socket Objects. (line 100) +* detach() (tkinter.ttk.Treeview method): ttk Treeview. (line 79) +* detach() (weakref.finalize method): weakref — Weak references. + (line 301) +* Detach() (winreg.PyHKEY method): Registry Handle Objects. + (line 40) +* DETACHED_PROCESS (in module subprocess): Windows Constants. + (line 122) +* detect_api_mismatch() (in module test.support): test support — Utilities for the Python test suite. + (line 638) +* detect_encoding() (in module tokenize): Tokenizing Input. (line 76) +* deterministic profiling: Introduction to the profilers. + (line 6) +* dev_mode (sys.flags attribute): sys — System-specific parameters and functions. + (line 568) +* device_encoding() (in module os): File Descriptor Operations. + (line 81) +* devmajor (tarfile.TarInfo attribute): TarInfo Objects. (line 141) +* devminor (tarfile.TarInfo attribute): TarInfo Objects. (line 145) +* devnull (in module os): Miscellaneous System Information. + (line 159) +* DEVNULL (in module subprocess): Using the subprocess Module. + (line 141) +* devpoll() (in module select): select — Waiting for I/O completion. + (line 36) +* DevpollSelector (class in selectors): Classes<4>. (line 184) +* dgettext() (in module gettext): GNU gettext API. (line 39) +* dgettext() (in module locale): Access to message catalogs. + (line 8) +* Dialect (class in csv): Module Contents<3>. (line 185) +* dialect (csv.csvreader attribute): Reader Objects. (line 19) +* dialect (csv.csvwriter attribute): Writer Objects. (line 33) +* Dialog (class in tkinter.commondialog): tkinter commondialog — Dialog window templates. + (line 14) +* Dialog (class in tkinter.simpledialog): tkinter simpledialog — Standard Tkinter input dialogs. + (line 21) +* dict (built-in class): Mapping Types — dict. + (line 19) +* Dict (class in ast): Literals<3>. (line 104) +* Dict (class in typing): Aliases to built-in types. + (line 6) +* DICT_MERGE (opcode): Python Bytecode Instructions. + (line 742) +* DICT_UPDATE (opcode): Python Bytecode Instructions. + (line 731) +* dict() (multiprocessing.managers.SyncManager method): Managers. + (line 222) +* DictComp (class in ast): Comprehensions. (line 6) +* dictConfig() (in module logging.config): Configuration functions. + (line 13) +* dictionary: Glossary. (line 409) +* dictionary comprehension: Glossary. (line 415) +* dictionary view: Glossary. (line 423) +* dictionary; comprehensions: Dictionary displays. + (line 6) +* dictionary; display: Dictionary displays. + (line 6) +* DictReader (class in csv): Module Contents<3>. (line 102) +* DictWriter (class in csv): Module Contents<3>. (line 149) +* diff_bytes() (in module difflib): difflib — Helpers for computing deltas. + (line 337) +* diff_files (filecmp.dircmp attribute): The dircmp class. (line 94) +* Differ (class in difflib): difflib — Helpers for computing deltas. + (line 50) +* difference_update() (frozenset method): Set Types — set frozenset. + (line 182) +* difference() (frozenset method): Set Types — set frozenset. + (line 109) +* dig (sys.float_info attribute): sys — System-specific parameters and functions. + (line 630) +* digest_size (hmac.HMAC attribute): hmac — Keyed-Hashing for Message Authentication. + (line 92) +* digest() (hashlib.hash method): Hash Objects. (line 38) +* digest() (hashlib.shake method): SHAKE variable length digests. + (line 15) +* digest() (hmac.HMAC method): hmac — Keyed-Hashing for Message Authentication. + (line 58) +* digest() (in module hmac): hmac — Keyed-Hashing for Message Authentication. + (line 33) +* digit() (in module unicodedata): unicodedata — Unicode Database. + (line 37) +* digits (in module string): String constants. (line 24) +* dir() (ftplib.FTP method): FTP objects. (line 311) +* dircmp (class in filecmp): The dircmp class. (line 6) +* Directory (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 71) +* directory; changing: Files and Directories. + (line 118) +* directory; creating: Files and Directories. + (line 544) +* directory; deleting: Directory and files operations. + (line 267) +* directory; deleting <1>: Files and Directories. + (line 734) +* directory; traversal: Files and Directories. + (line 1644) +* directory; traversal <1>: Files and Directories. + (line 1745) +* directory; walking: Files and Directories. + (line 1644) +* directory; walking <1>: Files and Directories. + (line 1745) +* DirEntry (class in os): Files and Directories. + (line 915) +* dirname() (in module os.path): os path — Common pathname manipulations. + (line 102) +* dirs_double_event() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 86) +* dirs_select_event() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 90) +* DirsOnSysPath (class in test.support.import_helper): test support import_helper — Utilities for import tests. + (line 97) +* DIRTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 299) +* dis command line option; -C: Command-line interface<3>. + (line 17) +* dis command line option; -h: Command-line interface<3>. + (line 13) +* dis command line option; -help: Command-line interface<3>. + (line 13) +* dis command line option; -O: Command-line interface<3>. + (line 23) +* dis command line option; -show-caches: Command-line interface<3>. + (line 17) +* dis command line option; -show-offsets: Command-line interface<3>. + (line 23) +* dis() (dis.Bytecode method): Bytecode analysis. (line 57) +* dis() (in module dis): Analysis functions. (line 40) +* dis() (in module pickletools): Programmatic Interface<2>. + (line 6) +* DISABLE (in module sys.monitoring): Disabling events. (line 6) +* disable (pdb command): Debugger Commands. (line 133) +* disable_faulthandler() (in module test.support): test support — Utilities for the Python test suite. + (line 352) +* disable_gc() (in module test.support): test support — Utilities for the Python test suite. + (line 364) +* disable_interspersed_args() (optparse.OptionParser method): Querying and manipulating your option parser. + (line 10) +* disable() (bdb.Breakpoint method): bdb — Debugger framework. + (line 52) +* disable() (in module faulthandler): Fault handler state. + (line 26) +* disable() (in module gc): gc — Garbage Collector interface. + (line 26) +* disable() (in module logging): Module-Level Functions. + (line 105) +* disable() (profile.Profile method): profile and cProfile Module Reference. + (line 82) +* disabled (logging.Logger attribute): Logger Objects. (line 97) +* DisableReflectionKey() (in module winreg): Functions<13>. (line 482) +* disassemble() (in module dis): Analysis functions. (line 99) +* discard (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 58) +* discard() (frozenset method): Set Types — set frozenset. + (line 204) +* discard() (mailbox.Mailbox method): Mailbox objects. (line 76) +* discard() (mailbox.MH method): MH objects. (line 79) +* discover() (unittest.TestLoader method): Loading and running tests. + (line 117) +* disk_usage() (in module shutil): Directory and files operations. + (line 378) +* dispatch_call() (bdb.Bdb method): bdb — Debugger framework. + (line 211) +* dispatch_exception() (bdb.Bdb method): bdb — Debugger framework. + (line 231) +* dispatch_line() (bdb.Bdb method): bdb — Debugger framework. + (line 201) +* dispatch_return() (bdb.Bdb method): bdb — Debugger framework. + (line 221) +* dispatch_table (pickle.Pickler attribute): Module Interface. + (line 179) +* DISPLAY: Tkinter Modules. (line 27) +* display (pdb command): Debugger Commands. (line 291) +* display_name (email.headerregistry.Address attribute): email headerregistry Custom Header Objects. + (line 426) +* display_name (email.headerregistry.Group attribute): email headerregistry Custom Header Objects. + (line 471) +* displayhook() (in module sys): sys — System-specific parameters and functions. + (line 300) +* dist() (in module math): Summation and product functions. + (line 6) +* distance() (in module turtle): Tell Turtle’s state. + (line 68) +* Distribution (class in importlib.metadata): Distributions. (line 14) +* distribution() (in module importlib.metadata): Distributions. + (line 6) +* Div (class in ast): Expressions<2>. (line 53) +* divide_int() (decimal.Context method): Context objects. (line 306) +* divide() (decimal.Context method): Context objects. (line 302) +* division: Binary arithmetic operations. + (line 34) +* division (in module __future__): Module Contents<5>. (line 22) +* DivisionByZero (class in decimal): Signals. (line 34) +* divmod() (decimal.Context method): Context objects. (line 310) +* DLE (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 73) +* DllCanUnloadNow() (in module ctypes): Utility functions. (line 95) +* DllGetClassObject() (in module ctypes): Utility functions. (line 103) +* dllhandle (in module sys): sys — System-specific parameters and functions. + (line 294) +* dnd_start() (in module tkinter.dnd): tkinter dnd — Drag and drop support. + (line 65) +* DndHandler (class in tkinter.dnd): tkinter dnd — Drag and drop support. + (line 43) +* dngettext() (in module gettext): GNU gettext API. (line 58) +* dnpgettext() (in module gettext): GNU gettext API. (line 69) +* do_clear() (bdb.Bdb method): bdb — Debugger framework. + (line 294) +* do_command() (curses.textpad.Textbox method): Textbox objects. + (line 30) +* do_GET() (http.server.SimpleHTTPRequestHandler method): http server — HTTP servers. + (line 385) +* do_handshake() (ssl.SSLSocket method): SSL Sockets. (line 126) +* do_HEAD() (http.server.SimpleHTTPRequestHandler method): http server — HTTP servers. + (line 378) +* do_help() (cmd.Cmd method): Cmd Objects. (line 49) +* do_POST() (http.server.CGIHTTPRequestHandler method): http server — HTTP servers. + (line 473) +* doc (json.JSONDecodeError attribute): Exceptions<17>. (line 15) +* doc_header (cmd.Cmd attribute): Cmd Objects. (line 155) +* DocCGIXMLRPCRequestHandler (class in xmlrpc.server): Documenting XMLRPC server. + (line 22) +* DocFileSuite() (in module doctest): Unittest API. (line 24) +* doClassCleanups() (unittest.TestCase class method): Test cases. + (line 836) +* doCleanups() (unittest.TestCase method): Test cases. (line 794) +* docmd() (smtplib.SMTP method): SMTP Objects. (line 17) +* docstring: Class definitions. (line 6) +* docstring <1>: Glossary. (line 433) +* docstring (doctest.DocTest attribute): DocTest Objects. (line 49) +* docstrings: Defining Functions. (line 21) +* docstrings <1>: Documentation Strings. + (line 6) +* DocTest (class in doctest): DocTest Objects. (line 6) +* doctest command line option; -f: Command-line Usage. (line 35) +* doctest command line option; -fail-fast: Command-line Usage. + (line 35) +* doctest command line option; -o: Command-line Usage. (line 28) +* doctest command line option; -option: Command-line Usage. (line 28) +* doctest command line option; -v: Command-line Usage. (line 11) +* doctest command line option; -verbose: Command-line Usage. (line 11) +* DocTestFailure: Debugging. (line 186) +* DocTestFinder (class in doctest): DocTestFinder objects. + (line 6) +* DocTestParser (class in doctest): DocTestParser objects. + (line 6) +* DocTestRunner (class in doctest): DocTestRunner objects. + (line 6) +* DocTestSuite() (in module doctest): Unittest API. (line 100) +* doctype() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 67) +* documentation string: Special read-only attributes<2>. + (line 104) +* documentation strings: Defining Functions. (line 21) +* documentation strings <1>: Documentation Strings. + (line 6) +* documentation; generation: pydoc — Documentation generator and online help system. + (line 8) +* documentation; online: pydoc — Documentation generator and online help system. + (line 8) +* documentElement (xml.dom.Document attribute): Document Objects. + (line 10) +* DocXMLRPCRequestHandler (class in xmlrpc.server): Documenting XMLRPC server. + (line 27) +* DocXMLRPCServer (class in xmlrpc.server): Documenting XMLRPC server. + (line 11) +* domain (email.headerregistry.Address attribute): email headerregistry Custom Header Objects. + (line 437) +* domain (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 41) +* domain (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* domain (tracemalloc.DomainFilter attribute): DomainFilter. (line 20) +* domain (tracemalloc.Filter attribute): Filter. (line 31) +* domain (tracemalloc.Trace attribute): Trace. (line 15) +* domain_initial_dot (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 90) +* domain_return_ok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects. + (line 27) +* domain_specified (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 86) +* DomainFilter (class in tracemalloc): DomainFilter. (line 6) +* DomainLiberal (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 156) +* DomainRFC2965Match (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 149) +* DomainStrict (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 161) +* DomainStrictNoDots (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 136) +* DomainStrictNonDomain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 142) +* DOMEventStream (class in xml.dom.pulldom): DOMEventStream Objects. + (line 6) +* DOMException: Exceptions<20>. (line 18) +* doModuleCleanups() (in module unittest): setUpModule and tearDownModule. + (line 44) +* DomstringSizeErr: Exceptions<20>. (line 23) +* done() (asyncio.Future method): Future Object. (line 63) +* done() (asyncio.Task method): Task Object. (line 66) +* done() (concurrent.futures.Future method): Future Objects. (line 32) +* done() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 135) +* done() (in module turtle): Using screen events. + (line 106) +* DONT_ACCEPT_BLANKLINE (in module doctest): Option Flags. (line 28) +* DONT_ACCEPT_TRUE_FOR_1 (in module doctest): Option Flags. (line 16) +* dont_write_bytecode (in module sys): sys — System-specific parameters and functions. + (line 336) +* dont_write_bytecode (sys.flags attribute): sys — System-specific parameters and functions. + (line 544) +* doRollover() (logging.handlers.RotatingFileHandler method): RotatingFileHandler. + (line 43) +* doRollover() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler. + (line 106) +* DOT (in module token): token — Constants used with Python parse trees. + (line 224) +* dot() (in module turtle): Turtle motion. (line 252) +* DOTALL (in module re): Flags. (line 108) +* doublequote (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 24) +* DOUBLESLASH (in module token): token — Constants used with Python parse trees. + (line 296) +* DOUBLESLASHEQUAL (in module token): token — Constants used with Python parse trees. + (line 299) +* DOUBLESTAR (in module token): token — Constants used with Python parse trees. + (line 260) +* DOUBLESTAREQUAL (in module token): token — Constants used with Python parse trees. + (line 293) +* doupdate() (in module curses): Functions<6>. (line 89) +* down (pdb command): Debugger Commands. (line 87) +* down() (in module turtle): Drawing state. (line 6) +* dpgettext() (in module gettext): GNU gettext API. (line 65) +* drain() (asyncio.StreamWriter method): StreamWriter. (line 66) +* drive (pathlib.PurePath attribute): Methods and properties. + (line 15) +* drop_whitespace (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 201) +* dropwhile() (in module itertools): Itertool Functions. (line 268) +* dst() (datetime.datetime method): datetime Objects. (line 538) +* dst() (datetime.time method): time Objects. (line 245) +* dst() (datetime.timezone method): timezone Objects. (line 57) +* dst() (datetime.tzinfo method): tzinfo Objects. (line 65) +* DTDHandler (class in xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 24) +* duck-typing: Glossary. (line 442) +* dump_stats() (profile.Profile method): profile and cProfile Module Reference. + (line 104) +* dump_stats() (pstats.Stats method): The Stats Class. (line 59) +* dump_traceback_later() (in module faulthandler): Dumping the tracebacks after a timeout. + (line 6) +* dump_traceback() (in module faulthandler): Dumping the traceback. + (line 6) +* dump() (in module ast): ast Helpers. (line 269) +* dump() (in module json): Basic Usage. (line 6) +* dump() (in module marshal): marshal — Internal Python object serialization. + (line 51) +* dump() (in module pickle): Module Interface. (line 35) +* dump() (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 93) +* dump() (in module xml.etree.ElementTree): Functions<9>. (line 86) +* dump() (pickle.Pickler method): Module Interface. (line 155) +* dump() (tracemalloc.Snapshot method): Snapshot. (line 29) +* dumps() (in module json): Basic Usage. (line 91) +* dumps() (in module marshal): marshal — Internal Python object serialization. + (line 93) +* dumps() (in module pickle): Module Interface. (line 47) +* dumps() (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 130) +* dumps() (in module xmlrpc.client): Convenience Functions. + (line 6) +* dunder: Glossary. (line 455) +* dup() (in module os): File Descriptor Operations. + (line 93) +* dup() (socket.socket method): Socket Objects. (line 108) +* dup2() (in module os): File Descriptor Operations. + (line 107) +* DuplicateOptionError: Exceptions<8>. (line 24) +* DuplicateSectionError: Exceptions<8>. (line 14) +* dwFlags (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 19) +* DynamicClassAttribute() (in module types): Additional Utility Classes and Functions. + (line 55) +* e (in module cmath): Constants<3>. (line 10) +* e (in module math): Constants<2>. (line 10) +* e; in numeric literal: Integer literals. (line 40) +* E2BIG (in module errno): errno — Standard errno system symbols. + (line 54) +* EACCES (in module errno): errno — Standard errno system symbols. + (line 80) +* EADDRINUSE (in module errno): errno — Standard errno system symbols. + (line 432) +* EADDRNOTAVAIL (in module errno): errno — Standard errno system symbols. + (line 436) +* EADV (in module errno): errno — Standard errno system symbols. + (line 306) +* EAFNOSUPPORT (in module errno): errno — Standard errno system symbols. + (line 428) +* EAFP: Glossary. (line 461) +* EAGAIN (in module errno): errno — Standard errno system symbols. + (line 71) +* eager_task_factory() (in module asyncio): Eager Task Factory. + (line 6) +* EALREADY (in module errno): errno — Standard errno system symbols. + (line 501) +* east_asian_width() (in module unicodedata): unicodedata — Unicode Database. + (line 64) +* EAUTH (in module errno): errno — Standard errno system symbols. + (line 581) +* EBADARCH (in module errno): errno — Standard errno system symbols. + (line 587) +* EBADE (in module errno): errno — Standard errno system symbols. + (line 242) +* EBADEXEC (in module errno): errno — Standard errno system symbols. + (line 593) +* EBADF (in module errno): errno — Standard errno system symbols. + (line 62) +* EBADFD (in module errno): errno — Standard errno system symbols. + (line 342) +* EBADMACHO (in module errno): errno — Standard errno system symbols. + (line 599) +* EBADMSG (in module errno): errno — Standard errno system symbols. + (line 330) +* EBADR (in module errno): errno — Standard errno system symbols. + (line 246) +* EBADRPC (in module errno): errno — Standard errno system symbols. + (line 665) +* EBADRQC (in module errno): errno — Standard errno system symbols. + (line 258) +* EBADSLT (in module errno): errno — Standard errno system symbols. + (line 262) +* EBFONT (in module errno): errno — Standard errno system symbols. + (line 270) +* EBUSY (in module errno): errno — Standard errno system symbols. + (line 93) +* ECANCELED (in module errno): errno — Standard errno system symbols. + (line 692) +* ECHILD (in module errno): errno — Standard errno system symbols. + (line 66) +* echo() (in module curses): Functions<6>. (line 105) +* echochar() (curses.window method): Window Objects. (line 196) +* ECHRNG (in module errno): errno — Standard errno system symbols. + (line 210) +* ECOMM (in module errno): errno — Standard errno system symbols. + (line 314) +* ECONNABORTED (in module errno): errno — Standard errno system symbols. + (line 452) +* ECONNREFUSED (in module errno): errno — Standard errno system symbols. + (line 488) +* ECONNRESET (in module errno): errno — Standard errno system symbols. + (line 457) +* EDEADLK (in module errno): errno — Standard errno system symbols. + (line 173) +* EDEADLOCK (in module errno): errno — Standard errno system symbols. + (line 266) +* EDESTADDRREQ (in module errno): errno — Standard errno system symbols. + (line 390) +* EDEVERR (in module errno): errno — Standard errno system symbols. + (line 605) +* edit() (curses.textpad.Textbox method): Textbox objects. (line 19) +* EDOM (in module errno): errno — Standard errno system symbols. + (line 165) +* EDOTDOT (in module errno): errno — Standard errno system symbols. + (line 326) +* EDQUOT (in module errno): errno — Standard errno system symbols. + (line 535) +* EEXIST (in module errno): errno — Standard errno system symbols. + (line 97) +* EFAULT (in module errno): errno — Standard errno system symbols. + (line 85) +* EFBIG (in module errno): errno — Standard errno system symbols. + (line 140) +* EFD_CLOEXEC (in module os): Files and Directories. + (line 1919) +* EFD_NONBLOCK (in module os): Files and Directories. + (line 1928) +* EFD_SEMAPHORE (in module os): Files and Directories. + (line 1937) +* effective() (in module bdb): bdb — Debugger framework. + (line 466) +* EFTYPE (in module errno): errno — Standard errno system symbols. + (line 611) +* ehlo_or_helo_if_needed() (smtplib.SMTP method): SMTP Objects. + (line 75) +* ehlo() (smtplib.SMTP method): SMTP Objects. (line 58) +* EHOSTDOWN (in module errno): errno — Standard errno system symbols. + (line 493) +* EHOSTUNREACH (in module errno): errno — Standard errno system symbols. + (line 497) +* EIDRM (in module errno): errno — Standard errno system symbols. + (line 206) +* EILSEQ (in module errno): errno — Standard errno system symbols. + (line 370) +* EINPROGRESS (in module errno): errno — Standard errno system symbols. + (line 506) +* EINTR (in module errno): errno — Standard errno system symbols. + (line 41) +* EINVAL (in module errno): errno — Standard errno system symbols. + (line 120) +* EIO (in module errno): errno — Standard errno system symbols. + (line 46) +* EISCONN (in module errno): errno — Standard errno system symbols. + (line 466) +* EISDIR (in module errno): errno — Standard errno system symbols. + (line 115) +* EISNAM (in module errno): errno — Standard errno system symbols. + (line 527) +* EJECT (enum.FlagBoundary attribute): Data Types<2>. (line 703) +* EKEYEXPIRED (in module errno): errno — Standard errno system symbols. + (line 557) +* EKEYREJECTED (in module errno): errno — Standard errno system symbols. + (line 565) +* EKEYREVOKED (in module errno): errno — Standard errno system symbols. + (line 561) +* EL2HLT (in module errno): errno — Standard errno system symbols. + (line 238) +* EL2NSYNC (in module errno): errno — Standard errno system symbols. + (line 214) +* EL3HLT (in module errno): errno — Standard errno system symbols. + (line 218) +* EL3RST (in module errno): errno — Standard errno system symbols. + (line 222) +* Element (class in xml.etree.ElementTree): Element Objects. (line 6) +* element_create() (tkinter.ttk.Style method): Ttk Styling. (line 131) +* element_names() (tkinter.ttk.Style method): Ttk Styling. (line 252) +* element_options() (tkinter.ttk.Style method): Ttk Styling. (line 256) +* ElementDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 240) +* elements() (collections.Counter method): Counter objects. (line 67) +* ElementTree (class in xml.etree.ElementTree): ElementTree Objects. + (line 6) +* ELIBACC (in module errno): errno — Standard errno system symbols. + (line 350) +* ELIBBAD (in module errno): errno — Standard errno system symbols. + (line 354) +* ELIBEXEC (in module errno): errno — Standard errno system symbols. + (line 366) +* ELIBMAX (in module errno): errno — Standard errno system symbols. + (line 362) +* ELIBSCN (in module errno): errno — Standard errno system symbols. + (line 358) +* Ellipsis (built-in variable): Built-in Constants. (line 59) +* ELLIPSIS (in module doctest): Option Flags. (line 47) +* ELLIPSIS (in module token): token — Constants used with Python parse trees. + (line 311) +* EllipsisType (in module types): Standard Interpreter Types. + (line 144) +* ELNRNG (in module errno): errno — Standard errno system symbols. + (line 226) +* ELOCKUNMAPPED (in module errno): errno — Standard errno system symbols. + (line 573) +* ELOOP (in module errno): errno — Standard errno system symbols. + (line 193) +* else; conditional expression: Conditional expressions. + (line 6) +* EM (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 100) +* EmailMessage (class in email.message): email message Representing an email message. + (line 52) +* EmailPolicy (class in email.policy): email policy Policy Objects. + (line 360) +* Emax (decimal.Context attribute): Context objects. (line 139) +* EMEDIUMTYPE (in module errno): errno — Standard errno system symbols. + (line 549) +* EMFILE (in module errno): errno — Standard errno system symbols. + (line 128) +* Emin (decimal.Context attribute): Context objects. (line 139) +* emit() (logging.FileHandler method): FileHandler. (line 31) +* emit() (logging.Handler method): Handler Objects. (line 109) +* emit() (logging.handlers.BufferingHandler method): MemoryHandler. + (line 24) +* emit() (logging.handlers.DatagramHandler method): DatagramHandler. + (line 29) +* emit() (logging.handlers.HTTPHandler method): HTTPHandler. (line 36) +* emit() (logging.handlers.NTEventLogHandler method): NTEventLogHandler. + (line 38) +* emit() (logging.handlers.QueueHandler method): QueueHandler. + (line 43) +* emit() (logging.handlers.RotatingFileHandler method): RotatingFileHandler. + (line 47) +* emit() (logging.handlers.SMTPHandler method): SMTPHandler. (line 35) +* emit() (logging.handlers.SocketHandler method): SocketHandler. + (line 24) +* emit() (logging.handlers.SysLogHandler method): SysLogHandler. + (line 61) +* emit() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler. + (line 110) +* emit() (logging.handlers.WatchedFileHandler method): WatchedFileHandler. + (line 50) +* emit() (logging.NullHandler method): NullHandler. (line 16) +* emit() (logging.StreamHandler method): StreamHandler. (line 17) +* EMLINK (in module errno): errno — Standard errno system symbols. + (line 156) +* Empty: queue — A synchronized queue class. + (line 82) +* empty (inspect.Parameter attribute): Introspecting callables with the Signature object. + (line 200) +* empty (inspect.Signature attribute): Introspecting callables with the Signature object. + (line 100) +* EMPTY_NAMESPACE (in module xml.dom): Module Contents<4>. (line 35) +* empty; list: List displays. (line 6) +* empty; tuple: Immutable sequences. + (line 29) +* empty; tuple <1>: Parenthesized forms. + (line 16) +* empty() (asyncio.Queue method): Queue. (line 27) +* empty() (multiprocessing.Queue method): Pipes and Queues. (line 116) +* empty() (multiprocessing.SimpleQueue method): Pipes and Queues. + (line 235) +* empty() (queue.Queue method): Queue Objects. (line 15) +* empty() (queue.SimpleQueue method): SimpleQueue Objects. + (line 14) +* empty() (sched.scheduler method): Scheduler Objects. (line 47) +* emptyline() (cmd.Cmd method): Cmd Objects. (line 70) +* emscripten_version (sys._emscripten_info attribute): sys — System-specific parameters and functions. + (line 350) +* EMSGSIZE (in module errno): errno — Standard errno system symbols. + (line 394) +* EMULTIHOP (in module errno): errno — Standard errno system symbols. + (line 322) +* enable (pdb command): Debugger Commands. (line 140) +* enable_callback_tracebacks() (in module sqlite3): Module functions. + (line 125) +* enable_interspersed_args() (optparse.OptionParser method): Querying and manipulating your option parser. + (line 31) +* enable_load_extension() (sqlite3.Connection method): Connection objects. + (line 425) +* enable_traversal() (tkinter.ttk.Notebook method): ttk Notebook. + (line 75) +* ENABLE_USER_SITE (in module site): Module contents<5>. (line 10) +* enable() (bdb.Breakpoint method): bdb — Debugger framework. + (line 48) +* enable() (imaplib.IMAP4 method): IMAP4 Objects. (line 84) +* enable() (in module faulthandler): Fault handler state. + (line 6) +* enable() (in module gc): gc — Garbage Collector interface. + (line 22) +* enable() (profile.Profile method): profile and cProfile Module Reference. + (line 78) +* EnableControlFlowGuard: Build<34>. (line 47) +* enabled (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 106) +* EnableReflectionKey() (in module winreg): Functions<13>. (line 500) +* ENAMETOOLONG (in module errno): errno — Standard errno system symbols. + (line 177) +* ENAVAIL (in module errno): errno — Standard errno system symbols. + (line 523) +* enclose() (curses.window method): Window Objects. (line 201) +* encode (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 78) +* encode_7or8bit() (in module email.encoders): email encoders Encoders. + (line 57) +* encode_base64() (in module email.encoders): email encoders Encoders. + (line 49) +* encode_noop() (in module email.encoders): email encoders Encoders. + (line 63) +* encode_quopri() (in module email.encoders): email encoders Encoders. + (line 42) +* encode_rfc2231() (in module email.utils): email utils Miscellaneous utilities. + (line 191) +* encode() (codecs.Codec method): Stateless Encoding and Decoding. + (line 11) +* encode() (codecs.IncrementalEncoder method): IncrementalEncoder Objects. + (line 28) +* encode() (email.header.Header method): email header Internationalized headers. + (line 125) +* encode() (in module base64): Legacy Interface. (line 21) +* encode() (in module codecs): codecs — Codec registry and base classes. + (line 23) +* encode() (in module quopri): quopri — Encode and decode MIME quoted-printable data. + (line 29) +* encode() (json.JSONEncoder method): Encoders and Decoders. + (line 218) +* encode() (str method): String Methods<2>. (line 83) +* encode() (xmlrpc.client.Binary method): Binary Objects. (line 25) +* encode() (xmlrpc.client.DateTime method): DateTime Objects. + (line 17) +* encodebytes() (in module base64): Legacy Interface. (line 31) +* EncodedFile() (in module codecs): codecs — Codec registry and base classes. + (line 212) +* encodePriority() (logging.handlers.SysLogHandler method): SysLogHandler. + (line 95) +* encodestring() (in module quopri): quopri — Encode and decode MIME quoted-printable data. + (line 46) +* encoding (curses.window attribute): Window Objects. (line 211) +* ENCODING (in module tarfile): tarfile — Read and write tar archive files. + (line 273) +* ENCODING (in module token): token — Constants used with Python parse trees. + (line 126) +* encoding (io.TextIOBase attribute): Text I/O<2>. (line 15) +* encoding (UnicodeError attribute): Concrete exceptions. + (line 445) +* encoding declarations (source file): Encoding declarations. + (line 6) +* encodings_map (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 150) +* encodings_map (mimetypes.MimeTypes attribute): MimeTypes Objects. + (line 33) +* EncodingWarning: Warnings. (line 68) +* end (UnicodeError attribute): Concrete exceptions. + (line 461) +* END_ASYNC_FOR (opcode): Python Bytecode Instructions. + (line 338) +* end_col_offset (ast.AST attribute): Node classes. (line 50) +* end_colno (traceback.FrameSummary attribute): FrameSummary Objects. + (line 62) +* end_fill() (in module turtle): Filling. (line 20) +* END_FOR (opcode): Python Bytecode Instructions. + (line 145) +* end_headers() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 275) +* end_lineno (ast.AST attribute): Node classes. (line 50) +* end_lineno (SyntaxError attribute): Concrete exceptions. + (line 336) +* end_lineno (traceback.FrameSummary attribute): FrameSummary Objects. + (line 49) +* end_lineno (traceback.TracebackException attribute): TracebackException Objects. + (line 99) +* end_ns() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 86) +* end_offset (SyntaxError attribute): Concrete exceptions. + (line 342) +* end_offset (traceback.TracebackException attribute): TracebackException Objects. + (line 115) +* end_poly() (in module turtle): Special Turtle methods. + (line 11) +* END_SEND (opcode): Python Bytecode Instructions. + (line 152) +* end() (re.Match method): Match Objects. (line 147) +* end() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 38) +* endCDATA() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects. + (line 39) +* EndCdataSectionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 347) +* EndDoctypeDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 235) +* endDocument() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 40) +* endDTD() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects. + (line 28) +* endElement() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 95) +* EndElementHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 270) +* endElementNS() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 121) +* endheaders() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 184) +* ENDMARKER (in module token): token — Constants used with Python parse trees. + (line 122) +* EndNamespaceDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 326) +* endpos (re.Match attribute): Match Objects. (line 186) +* endPrefixMapping() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 73) +* endswith() (bytearray method): Bytes and Bytearray Operations. + (line 122) +* endswith() (bytes method): Bytes and Bytearray Operations. + (line 122) +* endswith() (str method): String Methods<2>. (line 114) +* endwin() (in module curses): Functions<6>. (line 110) +* ENEEDAUTH (in module errno): errno — Standard errno system symbols. + (line 617) +* ENETDOWN (in module errno): errno — Standard errno system symbols. + (line 440) +* ENETRESET (in module errno): errno — Standard errno system symbols. + (line 448) +* ENETUNREACH (in module errno): errno — Standard errno system symbols. + (line 444) +* ENFILE (in module errno): errno — Standard errno system symbols. + (line 124) +* ENOANO (in module errno): errno — Standard errno system symbols. + (line 254) +* ENOATTR (in module errno): errno — Standard errno system symbols. + (line 623) +* ENOBUFS (in module errno): errno — Standard errno system symbols. + (line 462) +* ENOCSI (in module errno): errno — Standard errno system symbols. + (line 234) +* ENODATA (in module errno): errno — Standard errno system symbols. + (line 278) +* ENODEV (in module errno): errno — Standard errno system symbols. + (line 106) +* ENOENT (in module errno): errno — Standard errno system symbols. + (line 31) +* ENOEXEC (in module errno): errno — Standard errno system symbols. + (line 58) +* ENOKEY (in module errno): errno — Standard errno system symbols. + (line 553) +* ENOLCK (in module errno): errno — Standard errno system symbols. + (line 181) +* ENOLINK (in module errno): errno — Standard errno system symbols. + (line 302) +* ENOMEDIUM (in module errno): errno — Standard errno system symbols. + (line 545) +* ENOMEM (in module errno): errno — Standard errno system symbols. + (line 76) +* ENOMSG (in module errno): errno — Standard errno system symbols. + (line 202) +* ENONET (in module errno): errno — Standard errno system symbols. + (line 290) +* ENOPKG (in module errno): errno — Standard errno system symbols. + (line 294) +* ENOPOLICY (in module errno): errno — Standard errno system symbols. + (line 629) +* ENOPROTOOPT (in module errno): errno — Standard errno system symbols. + (line 402) +* ENOSPC (in module errno): errno — Standard errno system symbols. + (line 144) +* ENOSR (in module errno): errno — Standard errno system symbols. + (line 286) +* ENOSTR (in module errno): errno — Standard errno system symbols. + (line 274) +* ENOSYS (in module errno): errno — Standard errno system symbols. + (line 185) +* ENOTACTIVE (in module errno): errno — Standard errno system symbols. + (line 577) +* ENOTBLK (in module errno): errno — Standard errno system symbols. + (line 89) +* ENOTCAPABLE (in module errno): errno — Standard errno system symbols. + (line 683) +* ENOTCONN (in module errno): errno — Standard errno system symbols. + (line 470) +* ENOTDIR (in module errno): errno — Standard errno system symbols. + (line 110) +* ENOTEMPTY (in module errno): errno — Standard errno system symbols. + (line 189) +* ENOTNAM (in module errno): errno — Standard errno system symbols. + (line 519) +* ENOTRECOVERABLE (in module errno): errno — Standard errno system symbols. + (line 704) +* ENOTSOCK (in module errno): errno — Standard errno system symbols. + (line 386) +* ENOTSUP (in module errno): errno — Standard errno system symbols. + (line 418) +* ENOTTY (in module errno): errno — Standard errno system symbols. + (line 132) +* ENOTUNIQ (in module errno): errno — Standard errno system symbols. + (line 338) +* ENQ (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 34) +* enqueue_sentinel() (logging.handlers.QueueListener method): QueueListener. + (line 94) +* enqueue() (logging.handlers.QueueHandler method): QueueHandler. + (line 86) +* ensure_directories() (venv.EnvBuilder method): API<2>. (line 90) +* ensure_future() (in module asyncio): Future Functions. (line 19) +* ensurepip command line option; -altinstall: Command line interface. + (line 42) +* ensurepip command line option; -default-pip: Command line interface. + (line 47) +* ensurepip command line option; -root: Command line interface. + (line 25) +* ensurepip command line option; -user: Command line interface. + (line 31) +* enter_async_context() (contextlib.AsyncExitStack method): Utilities. + (line 631) +* enter_context() (contextlib.ExitStack method): Utilities. (line 546) +* enter() (sched.scheduler method): Scheduler Objects. (line 30) +* enterabs() (sched.scheduler method): Scheduler Objects. (line 9) +* enterAsyncContext() (unittest.IsolatedAsyncioTestCase method): Test cases. + (line 897) +* enterClassContext() (unittest.TestCase class method): Test cases. + (line 827) +* enterContext() (unittest.TestCase method): Test cases. (line 785) +* enterModuleContext() (in module unittest): setUpModule and tearDownModule. + (line 35) +* entities (xml.dom.DocumentType attribute): DocumentType Objects. + (line 38) +* EntityDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 299) +* entitydefs (in module html.entities): html entities — Definitions of HTML general entities. + (line 25) +* EntityResolver (class in xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 31) +* entry_points() (in module importlib.metadata): Entry points. + (line 6) +* EntryPoint (class in importlib.metadata): Entry points. (line 26) +* EntryPoints (class in importlib.metadata): Entry points. (line 18) +* Enum (class in enum): Data Types<2>. (line 120) +* enum_certificates() (in module ssl): Certificate handling. + (line 87) +* enum_crls() (in module ssl): Certificate handling. + (line 110) +* EnumCheck (class in enum): Data Types<2>. (line 607) +* EnumDict (class in enum): Data Types<2>. (line 734) +* enumerate() (in module threading): Reference<2>. (line 98) +* EnumKey() (in module winreg): Functions<13>. (line 172) +* EnumType (class in enum): Data Types<2>. (line 6) +* EnumValue() (in module winreg): Functions<13>. (line 191) +* EnvBuilder (class in venv): API<2>. (line 11) +* environ (in module os): Process Parameters. (line 16) +* environ (in module posix): Notable Module Contents. + (line 9) +* environb (in module os): Process Parameters. (line 58) +* environment: Resolution of names. + (line 12) +* environment variable; __PYVENV_LAUNCHER__: PyConfig. (line 187) +* environment variable; __PYVENV_LAUNCHER__ <1>: PyConfig. (line 705) +* environment variable; %APPDATA%: Redirection of local data registry and temporary paths. + (line 13) +* environment variable; APPDATA: PEP 370 Per-user site-packages Directory. + (line 26) +* environment variable; BASECFLAGS: Compiler flags. (line 66) +* environment variable; BASECPPFLAGS: Preprocessor flags. (line 22) +* environment variable; BLDSHARED: Linker flags. (line 67) +* environment variable; BROWSER: webbrowser — Convenient web-browser controller. + (line 20) +* environment variable; BROWSER <1>: webbrowser — Convenient web-browser controller. + (line 34) +* environment variable; BROWSER <2>: webbrowser — Convenient web-browser controller. + (line 122) +* environment variable; CC: New Improved and Deprecated Modules<4>. + (line 58) +* environment variable; CC <1>: Compiler flags. (line 6) +* environment variable; CCSHARED: Compiler flags. (line 81) +* environment variable; CFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* environment variable; CFLAGS <1>: Performance options. + (line 28) +* environment variable; CFLAGS <2>: Compiler flags. (line 18) +* environment variable; CFLAGS <3>: Compiler flags. (line 26) +* environment variable; CFLAGS <4>: Compiler flags. (line 28) +* environment variable; CFLAGS <5>: Compiler flags. (line 32) +* environment variable; CFLAGS <6>: Compiler flags. (line 54) +* environment variable; CFLAGS <7>: Linker flags. (line 18) +* environment variable; CFLAGS_ALIASING: Compiler flags. (line 74) +* environment variable; CFLAGS_NODIST: Compiler flags. (line 22) +* environment variable; CFLAGS_NODIST <1>: Compiler flags. (line 24) +* environment variable; CFLAGS_NODIST <2>: Compiler flags. (line 61) +* environment variable; CFLAGS_NODIST <3>: Linker flags. (line 26) +* environment variable; CFLAGSFORSHARED: Compiler flags. (line 87) +* environment variable; COLUMNS: Functions<6>. (line 595) +* environment variable; COLUMNS <1>: Functions<6>. (line 598) +* environment variable; COMPILEALL_OPTS: Compiler flags. (line 41) +* environment variable; COMSPEC: Process Management. (line 777) +* environment variable; COMSPEC <1>: Popen Constructor. (line 112) +* environment variable; CONFIGURE_CFLAGS: Compiler flags. (line 52) +* environment variable; CONFIGURE_CFLAGS_NODIST: Compiler flags. + (line 59) +* environment variable; CONFIGURE_CPPFLAGS: Preprocessor flags. + (line 6) +* environment variable; CONFIGURE_LDFLAGS: Linker flags. (line 13) +* environment variable; CONFIGURE_LDFLAGS_NODIST: Linker flags. + (line 38) +* environment variable; CPPFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* environment variable; CPPFLAGS <1>: Preprocessor flags. (line 8) +* environment variable; CPPFLAGS <2>: Preprocessor flags. (line 13) +* environment variable; CPPFLAGS <3>: Preprocessor flags. (line 18) +* environment variable; CPPFLAGS <4>: Linker flags. (line 50) +* environment variable; CXX: Compiler flags. (line 12) +* environment variable; DISPLAY: Tkinter Modules. (line 27) +* environment variable; EnableControlFlowGuard: Build<34>. (line 47) +* environment variable; EXTRA_CFLAGS: Compiler flags. (line 48) +* environment variable; HOME: os path<5>. (line 15) +* environment variable; HOME <1>: Changes in the Python API<5>. + (line 117) +* environment variable; HOME <2>: Windows<43>. (line 15) +* environment variable; HOME <3>: Windows<43>. (line 18) +* environment variable; HOME <4>: os path — Common pathname manipulations. + (line 136) +* environment variable; HOME <5>: os path — Common pathname manipulations. + (line 153) +* environment variable; HOME <6>: Tkinter Modules. (line 66) +* environment variable; HOMEDRIVE: os path — Common pathname manipulations. + (line 143) +* environment variable; HOMEPATH: os path — Common pathname manipulations. + (line 143) +* environment variable; IDLESTARTUP: IDLE<39>. (line 176) +* environment variable; IDLESTARTUP <1>: IDLE<43>. (line 9) +* environment variable; IDLESTARTUP <2>: IDLE<49>. (line 9) +* environment variable; IDLESTARTUP <3>: Startup and Code Execution. + (line 7) +* environment variable; IDLESTARTUP <4>: Command line usage. (line 41) +* environment variable; LANG: GNU gettext API. (line 21) +* environment variable; LANG <1>: Class-based API. (line 26) +* environment variable; LANG <2>: locale — Internationalization services. + (line 52) +* environment variable; LANG <3>: locale — Internationalization services. + (line 348) +* environment variable; LANG <4>: locale — Internationalization services. + (line 352) +* environment variable; LANGUAGE: GNU gettext API. (line 20) +* environment variable; LANGUAGE <1>: Class-based API. (line 25) +* environment variable; LC_ALL: GNU gettext API. (line 20) +* environment variable; LC_ALL <1>: Class-based API. (line 25) +* environment variable; LC_MESSAGES: GNU gettext API. (line 20) +* environment variable; LC_MESSAGES <1>: Class-based API. (line 26) +* environment variable; LDCXXSHARED: Build and C API Changes<8>. + (line 153) +* environment variable; LDFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* environment variable; LDFLAGS <1>: Preprocessor flags. (line 18) +* environment variable; LDFLAGS <2>: Linker flags. (line 15) +* environment variable; LDFLAGS <3>: Linker flags. (line 18) +* environment variable; LDFLAGS <4>: Linker flags. (line 28) +* environment variable; LDFLAGS <5>: Linker flags. (line 31) +* environment variable; LDFLAGS <6>: Linker flags. (line 35) +* environment variable; LDFLAGS <7>: Linker flags. (line 45) +* environment variable; LDFLAGS <8>: Linker flags. (line 50) +* environment variable; LDFLAGS_NODIST: Linker flags. (line 24) +* environment variable; LDFLAGS_NODIST <1>: Linker flags. (line 26) +* environment variable; LDFLAGS_NODIST <2>: Linker flags. (line 40) +* environment variable; LDSHARED: Linker flags. (line 61) +* environment variable; LIBS: Linker flags. (line 54) +* environment variable; LINES: Functions<6>. (line 125) +* environment variable; LINES <1>: Functions<6>. (line 595) +* environment variable; LINES <2>: Functions<6>. (line 597) +* environment variable; LINKCC: Linker flags. (line 6) +* environment variable; LOGNAME: Process Parameters. (line 239) +* environment variable; LOGNAME <1>: getpass — Portable password input. + (line 43) +* environment variable; MANPAGER: pydoc — Documentation generator and online help system. + (line 46) +* environment variable; MANPAGER <1>: pydoc — Documentation generator and online help system. + (line 48) +* environment variable; no_proxy: urllib request — Extensible library for opening URLs. + (line 311) +* environment variable; OPT: Debug options. (line 39) +* environment variable; OPT <1>: Compiler flags. (line 70) +* environment variable; PAGER: pydoc — Documentation generator and online help system. + (line 46) +* environment variable; PATH: Changes in the Python API<5>. + (line 144) +* environment variable; PATH <1>: Changes in ‘python’ Command Behavior<2>. + (line 6) +* environment variable; PATH <2>: Changes in ‘python’ Command Behavior<2>. + (line 11) +* environment variable; PATH <3>: Changes in ‘python’ Command Behavior<2>. + (line 12) +* environment variable; PATH <4>: macOS<7>. (line 14) +* environment variable; PATH <5>: Windows<24>. (line 56) +* environment variable; PATH <6>: Windows<28>. (line 14) +* environment variable; PATH <7>: Security<36>. (line 16) +* environment variable; PATH <8>: Security<36>. (line 20) +* environment variable; PATH <9>: The Module Search Path. + (line 17) +* environment variable; PATH <10>: Executable Python Scripts. + (line 11) +* environment variable; PATH <11>: Environment variables. + (line 27) +* environment variable; PATH <12>: Miscellaneous. (line 16) +* environment variable; PATH <13>: Installation steps. (line 34) +* environment variable; PATH <14>: Installation steps. (line 58) +* environment variable; PATH <15>: Installing Without UI. + (line 77) +* environment variable; PATH <16>: Installing Without UI. + (line 81) +* environment variable; PATH <17>: Excursus Setting environment variables. + (line 23) +* environment variable; PATH <18>: Excursus Setting environment variables. + (line 35) +* environment variable; PATH <19>: Finding the Python executable. + (line 14) +* environment variable; PATH <20>: Finding the Python executable. + (line 21) +* environment variable; PATH <21>: Finding the Python executable. + (line 22) +* environment variable; PATH <22>: Python Launcher for Windows. + (line 13) +* environment variable; PATH <23>: From the command-line. + (line 9) +* environment variable; PATH <24>: Shebang Lines. (line 54) +* environment variable; PATH <25>: Shebang Lines. (line 60) +* environment variable; PATH <26>: Shebang Lines. (line 62) +* environment variable; PATH <27>: Shebang Lines. (line 67) +* environment variable; PATH <28>: Comparison to the os and os path modules. + (line 41) +* environment variable; PATH <29>: Directory and files operations. + (line 427) +* environment variable; PATH <30>: Directory and files operations. + (line 432) +* environment variable; PATH <31>: Process Management. (line 45) +* environment variable; PATH <32>: Process Management. (line 86) +* environment variable; PATH <33>: Process Management. (line 89) +* environment variable; PATH <34>: Process Management. (line 92) +* environment variable; PATH <35>: Process Management. (line 544) +* environment variable; PATH <36>: Process Management. (line 631) +* environment variable; PATH <37>: Process Management. (line 635) +* environment variable; PATH <38>: Process Management. (line 637) +* environment variable; PATH <39>: Miscellaneous System Information. + (line 141) +* environment variable; PATH <40>: Popen Constructor. (line 34) +* environment variable; PATH <41>: webbrowser — Convenient web-browser controller. + (line 241) +* environment variable; PATH <42>: How venvs work. (line 16) +* environment variable; PATH <43>: How venvs work. (line 61) +* environment variable; PATH <44>: How venvs work. (line 66) +* environment variable; PATH <45>: site — Site-specific configuration hook. + (line 66) +* environment variable; PATH <46>: Embedding Python<2>. + (line 31) +* environment variable; PATH <47>: Embedding Python<2>. + (line 37) +* environment variable; PATH <48>: How do I make a Python script executable on Unix?. + (line 24) +* environment variable; PATH <49>: How do I make a Python script executable on Unix?. + (line 28) +* environment variable; PATHEXT: Other Improvements<2>. + (line 30) +* environment variable; PATHEXT <1>: Library<43>. (line 138) +* environment variable; PATHEXT <2>: Installing Without UI. + (line 77) +* environment variable; PATHEXT <3>: Installing Without UI. + (line 81) +* environment variable; PATHEXT <4>: Directory and files operations. + (line 442) +* environment variable; PIP_USER: Windows<45>. (line 102) +* environment variable; PROFILE_TASK: Build<18>. (line 13) +* environment variable; PROFILE_TASK <1>: Performance options. + (line 12) +* environment variable; PROFILE_TASK <2>: Performance options. + (line 34) +* environment variable; PURIFY: Compiler flags. (line 130) +* environment variable; PY_BUILTIN_MODULE_CFLAGS: Compiler flags. + (line 121) +* environment variable; PY_CFLAGS: Compiler flags. (line 94) +* environment variable; PY_CFLAGS_NODIST: Compiler flags. (line 99) +* environment variable; PY_CORE_CFLAGS: Compiler flags. (line 115) +* environment variable; PY_CORE_LDFLAGS: Linker flags. (line 83) +* environment variable; PY_CPPFLAGS: Preprocessor flags. (line 26) +* environment variable; PY_LDFLAGS: Linker flags. (line 73) +* environment variable; PY_LDFLAGS_NODIST: Linker flags. (line 77) +* environment variable; PY_PYTHON: Customizing default Python versions. + (line 18) +* environment variable; PY_STDMODULE_CFLAGS: Compiler flags. (line 106) +* environment variable; PYLAUNCHER_ALLOW_INSTALL: Windows<12>. + (line 24) +* environment variable; PYLAUNCHER_ALLOW_INSTALL <1>: Windows<26>. + (line 15) +* environment variable; PYLAUNCHER_ALLOW_INSTALL <2>: Install on demand. + (line 6) +* environment variable; PYLAUNCHER_ALWAYS_INSTALL: Install on demand. + (line 12) +* environment variable; PYLAUNCHER_DEBUG: Diagnostics. (line 6) +* environment variable; PYLAUNCHER_DRYRUN: Dry Run. (line 6) +* environment variable; PYLAUNCHER_DRYRUN <1>: Install on demand. + (line 14) +* environment variable; PYLAUNCHER_NO_SEARCH_PATH: Shebang Lines. + (line 65) +* environment variable; PYTHON_BASIC_REPL: A better interactive interpreter. + (line 27) +* environment variable; PYTHON_BASIC_REPL <1>: Library<7>. (line 322) +* environment variable; PYTHON_BASIC_REPL <2>: Library<7>. (line 326) +* environment variable; PYTHON_BASIC_REPL <3>: Core and Builtins<13>. + (line 55) +* environment variable; PYTHON_BASIC_REPL <4>: Interactive Mode<2>. + (line 23) +* environment variable; PYTHON_BASIC_REPL <5>: Environment variables. + (line 519) +* environment variable; PYTHON_COLORS: Summary – Release Highlights. + (line 57) +* environment variable; PYTHON_COLORS <1>: Improved error messages. + (line 8) +* environment variable; PYTHON_COLORS <2>: doctest. (line 7) +* environment variable; PYTHON_COLORS <3>: Controlling color. + (line 22) +* environment variable; PYTHON_COLORS <4>: Environment variables. + (line 511) +* environment variable; PYTHON_CPU_COUNT: os. (line 11) +* environment variable; PYTHON_CPU_COUNT <1>: Miscellaneous options. + (line 375) +* environment variable; PYTHON_CPU_COUNT <2>: Environment variables. + (line 487) +* environment variable; PYTHON_CPU_COUNT <3>: Miscellaneous System Information. + (line 48) +* environment variable; PYTHON_CPU_COUNT <4>: Miscellaneous System Information. + (line 69) +* environment variable; PYTHON_CPU_COUNT <5>: Miscellaneous<3>. + (line 31) +* environment variable; PYTHON_CPU_COUNT <6>: PyConfig. (line 497) +* environment variable; PYTHON_DOM: Module Contents<4>. (line 23) +* environment variable; PYTHON_FROZEN_MODULES: Other Language Changes. + (line 46) +* environment variable; PYTHON_FROZEN_MODULES <1>: Core and Builtins<20>. + (line 105) +* environment variable; PYTHON_FROZEN_MODULES <2>: Miscellaneous options. + (line 346) +* environment variable; PYTHON_FROZEN_MODULES <3>: Environment variables. + (line 497) +* environment variable; PYTHON_GIL: Free-threaded CPython. + (line 22) +* environment variable; PYTHON_GIL <1>: Free-threaded CPython. + (line 38) +* environment variable; PYTHON_GIL <2>: Core and Builtins<10>. + (line 40) +* environment variable; PYTHON_GIL <3>: Miscellaneous options. + (line 393) +* environment variable; PYTHON_GIL <4>: Environment variables. + (line 536) +* environment variable; PYTHON_GIL <5>: The global interpreter lock in free-threaded Python. + (line 7) +* environment variable; PYTHON_GIL <6>: Glossary. (line 693) +* environment variable; PYTHON_HISTORY: Other Language Changes. + (line 57) +* environment variable; PYTHON_HISTORY <1>: Library<18>. (line 544) +* environment variable; PYTHON_HISTORY <2>: Environment variables. + (line 528) +* environment variable; PYTHON_JIT: An experimental just-in-time JIT compiler. + (line 21) +* environment variable; PYTHON_JIT <1>: An experimental just-in-time JIT compiler. + (line 24) +* environment variable; PYTHON_JIT <2>: An experimental just-in-time JIT compiler. + (line 28) +* environment variable; PYTHON_JIT <3>: Environment variables. + (line 548) +* environment variable; PYTHON_PERF_JIT_SUPPORT: Other Language Changes. + (line 52) +* environment variable; PYTHON_PERF_JIT_SUPPORT <1>: Miscellaneous options. + (line 365) +* environment variable; PYTHON_PERF_JIT_SUPPORT <2>: Environment variables. + (line 474) +* environment variable; PYTHON_PERF_JIT_SUPPORT <3>: PyConfig. + (line 876) +* environment variable; PYTHON_PERF_JIT_SUPPORT <4>: PyConfig. + (line 879) +* environment variable; PYTHON_PERF_JIT_SUPPORT <5>: How to work without frame pointers. + (line 14) +* environment variable; PYTHON_PRESITE: Miscellaneous options. + (line 387) +* environment variable; PYTHON_PRESITE <1>: Debug-mode variables. + (line 25) +* environment variable; PYTHON_PRESITE <2>: PyConfig. (line 776) +* environment variable; PYTHON_PRESITE=package.module: Core and Builtins<20>. + (line 154) +* environment variable; PYTHONASYNCIODEBUG: Environment variables. + (line 277) +* environment variable; PYTHONASYNCIODEBUG <1>: Enabling debug mode. + (line 10) +* environment variable; PYTHONASYNCIODEBUG <2>: Debug Mode. (line 11) +* environment variable; PYTHONASYNCIODEBUG <3>: Effects of the Python Development Mode. + (line 65) +* environment variable; PYTHONBREAKPOINT: PEP 553 Built-in breakpoint. + (line 13) +* environment variable; PYTHONBREAKPOINT <1>: Environment variables. + (line 81) +* environment variable; PYTHONBREAKPOINT <2>: Built-in Functions. + (line 159) +* environment variable; PYTHONBREAKPOINT <3>: sys — System-specific parameters and functions. + (line 257) +* environment variable; PYTHONBREAKPOINT <4>: sys — System-specific parameters and functions. + (line 271) +* environment variable; PYTHONBREAKPOINT <5>: sys — System-specific parameters and functions. + (line 275) +* environment variable; PYTHONCASEOK: Changes in the Python API<4>. + (line 29) +* environment variable; PYTHONCASEOK <1>: PEP 235 Importing Modules on Case-Insensitive Platforms. + (line 17) +* environment variable; PYTHONCASEOK <2>: Library<47>. (line 144) +* environment variable; PYTHONCASEOK <3>: Environment variables. + (line 131) +* environment variable; PYTHONCASEOK <4>: Built-in Functions. + (line 2249) +* environment variable; PYTHONCOERCECLOCALE: PEP 538 Legacy C Locale Coercion. + (line 13) +* environment variable; PYTHONCOERCECLOCALE <1>: Environment variables. + (line 365) +* environment variable; PYTHONCOERCECLOCALE <2>: General Options. + (line 88) +* environment variable; PYTHONCOERCECLOCALE <3>: Python UTF-8 Mode. + (line 57) +* environment variable; PYTHONCOERCECLOCALE <4>: Python Configuration. + (line 15) +* environment variable; PYTHONDEBUG: Miscellaneous options. + (line 37) +* environment variable; PYTHONDEBUG <1>: Environment variables. + (line 94) +* environment variable; PYTHONDEBUG <2>: Python Debug Build. (line 20) +* environment variable; PYTHONDEBUG <3>: Global configuration variables. + (line 38) +* environment variable; PYTHONDEBUG <4>: PyConfig. (line 667) +* environment variable; PYTHONDEVMODE: Python Development Mode -X dev. + (line 6) +* environment variable; PYTHONDEVMODE <1>: Miscellaneous options. + (line 305) +* environment variable; PYTHONDEVMODE <2>: Environment variables. + (line 421) +* environment variable; PYTHONDEVMODE <3>: Python Development Mode. + (line 14) +* environment variable; PYTHONDEVMODE <4>: PyConfig. (line 296) +* environment variable; PYTHONDONTWRITEBYTECODE: Interpreter Changes<2>. + (line 16) +* environment variable; PYTHONDONTWRITEBYTECODE <1>: New and Improved Modules<2>. + (line 626) +* environment variable; PYTHONDONTWRITEBYTECODE <2>: Miscellaneous options. + (line 19) +* environment variable; PYTHONDONTWRITEBYTECODE <3>: Environment variables. + (line 136) +* environment variable; PYTHONDONTWRITEBYTECODE <4>: sys — System-specific parameters and functions. + (line 341) +* environment variable; PYTHONDONTWRITEBYTECODE <5>: Global configuration variables. + (line 52) +* environment variable; PYTHONDONTWRITEBYTECODE <6>: PyConfig. + (line 953) +* environment variable; PYTHONDONTWRITEBYTECODE <7>: How do I create a pyc file?. + (line 21) +* environment variable; PYTHONDUMPREFS: Debug build uses the same ABI as release build. + (line 15) +* environment variable; PYTHONDUMPREFS <1>: Build<51>. (line 54) +* environment variable; PYTHONDUMPREFS <2>: Debug-mode variables. + (line 6) +* environment variable; PYTHONDUMPREFS <3>: Debug options. (line 22) +* environment variable; PYTHONDUMPREFS <4>: Debug options. (line 24) +* environment variable; PYTHONDUMPREFS <5>: PyConfig. (line 307) +* environment variable; PYTHONDUMPREFSFILE: Core and Builtins<37>. + (line 154) +* environment variable; PYTHONDUMPREFSFILE <1>: Debug-mode variables. + (line 14) +* environment variable; PYTHONEXECUTABLE: Environment variables. + (line 217) +* environment variable; PYTHONEXECUTABLE <1>: PyConfig. (line 702) +* environment variable; PYTHONFAULTHANDLER: faulthandler<4>. (line 11) +* environment variable; PYTHONFAULTHANDLER <1>: Miscellaneous options. + (line 267) +* environment variable; PYTHONFAULTHANDLER <2>: Environment variables. + (line 245) +* environment variable; PYTHONFAULTHANDLER <3>: Effects of the Python Development Mode. + (line 59) +* environment variable; PYTHONFAULTHANDLER <4>: faulthandler — Dump the Python traceback. + (line 15) +* environment variable; PYTHONFAULTHANDLER <5>: PyConfig. (line 345) +* environment variable; PYTHONHASHSEED: Builtin functions and types. + (line 17) +* environment variable; PYTHONHASHSEED <1>: Porting Python code. + (line 6) +* environment variable; PYTHONHASHSEED <2>: Core and Builtins<64>. + (line 30) +* environment variable; PYTHONHASHSEED <3>: Miscellaneous options. + (line 130) +* environment variable; PYTHONHASHSEED <4>: Miscellaneous options. + (line 146) +* environment variable; PYTHONHASHSEED <5>: Environment variables. + (line 151) +* environment variable; PYTHONHASHSEED <6>: Environment variables. + (line 156) +* environment variable; PYTHONHASHSEED <7>: Basic customization. + (line 316) +* environment variable; PYTHONHASHSEED <8>: Global configuration variables. + (line 77) +* environment variable; PYTHONHASHSEED <9>: Global configuration variables. + (line 80) +* environment variable; PYTHONHASHSEED <10>: PyConfig. (line 415) +* environment variable; PYTHONHOME: Deprecated C APIs. (line 26) +* environment variable; PYTHONHOME <1>: Pending Removal in Python 3 15<2>. + (line 36) +* environment variable; PYTHONHOME <2>: Pending Removal in Python 3 15<4>. + (line 36) +* environment variable; PYTHONHOME <3>: Summary – Release highlights<6>. + (line 107) +* environment variable; PYTHONHOME <4>: Miscellaneous options. + (line 46) +* environment variable; PYTHONHOME <5>: Environment variables. + (line 11) +* environment variable; PYTHONHOME <6>: Environment variables. + (line 19) +* environment variable; PYTHONHOME <7>: Environment variables. + (line 21) +* environment variable; PYTHONHOME <8>: Environment variables. + (line 38) +* environment variable; PYTHONHOME <9>: Finding modules. (line 29) +* environment variable; PYTHONHOME <10>: Finding modules. (line 47) +* environment variable; PYTHONHOME <11>: Finding modules. (line 81) +* environment variable; PYTHONHOME <12>: Adding Python to an iOS project. + (line 149) +* environment variable; PYTHONHOME <13>: test support script_helper — Utilities for the Python execution tests. + (line 25) +* environment variable; PYTHONHOME <14>: The initialization of the sys path module search path. + (line 30) +* environment variable; PYTHONHOME <15>: Virtual environments<2>. + (line 14) +* environment variable; PYTHONHOME <16>: Embedding Python<2>. + (line 38) +* environment variable; PYTHONHOME <17>: Embedding Python<2>. + (line 44) +* environment variable; PYTHONHOME <18>: Global configuration variables. + (line 92) +* environment variable; PYTHONHOME <19>: Process-wide parameters. + (line 295) +* environment variable; PYTHONHOME <20>: Process-wide parameters. + (line 311) +* environment variable; PYTHONHOME <21>: Process-wide parameters. + (line 320) +* environment variable; PYTHONHOME <22>: PyConfig. (line 423) +* environment variable; PYTHONHOME <23>: PyConfig. (line 425) +* environment variable; PYTHONHOME <24>: Pending Removal in Python 3 15<6>. + (line 36) +* environment variable; PYTHONINSPECT: Other Changes and Fixes<2>. + (line 13) +* environment variable; PYTHONINSPECT <1>: Miscellaneous options. + (line 68) +* environment variable; PYTHONINSPECT <2>: Environment variables. + (line 103) +* environment variable; PYTHONINSPECT <3>: Global configuration variables. + (line 109) +* environment variable; PYTHONINSPECT <4>: PyConfig. (line 450) +* environment variable; PYTHONINTMAXSTRDIGITS: Core and Builtins<29>. + (line 106) +* environment variable; PYTHONINTMAXSTRDIGITS <1>: Miscellaneous options. + (line 289) +* environment variable; PYTHONINTMAXSTRDIGITS <2>: Environment variables. + (line 169) +* environment variable; PYTHONINTMAXSTRDIGITS <3>: Configuring the limit. + (line 9) +* environment variable; PYTHONINTMAXSTRDIGITS <4>: Configuring the limit. + (line 16) +* environment variable; PYTHONINTMAXSTRDIGITS <5>: sys — System-specific parameters and functions. + (line 1163) +* environment variable; PYTHONINTMAXSTRDIGITS <6>: PyConfig. (line 481) +* environment variable; PYTHONIOENCODING: Other Improvements<2>. + (line 75) +* environment variable; PYTHONIOENCODING <1>: Interpreter Changes<2>. + (line 23) +* environment variable; PYTHONIOENCODING <2>: Environment variables. + (line 177) +* environment variable; PYTHONIOENCODING <3>: Environment variables. + (line 402) +* environment variable; PYTHONIOENCODING <4>: Python UTF-8 Mode. + (line 29) +* environment variable; PYTHONIOENCODING <5>: sys — System-specific parameters and functions. + (line 1848) +* environment variable; PYTHONIOENCODING <6>: PyConfig. (line 836) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING: New Deprecations. + (line 130) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <1>: Pending removal in Python 3 16. + (line 50) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <2>: Pending removal in Python 3 16<3>. + (line 50) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <3>: PEP 529 Change Windows filesystem encoding to UTF-8. + (line 18) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <4>: Windows<14>. + (line 37) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <5>: Environment variables. + (line 338) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <6>: sys — System-specific parameters and functions. + (line 1788) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <7>: sys — System-specific parameters and functions. + (line 1799) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <8>: sys — System-specific parameters and functions. + (line 1805) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <9>: Global configuration variables. + (line 151) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <10>: PyPreConfig. + (line 123) +* environment variable; PYTHONLEGACYWINDOWSFSENCODING <11>: Pending removal in Python 3 16<5>. + (line 50) +* environment variable; PYTHONLEGACYWINDOWSSTDIO: PEP 528 Change Windows console encoding to UTF-8. + (line 12) +* environment variable; PYTHONLEGACYWINDOWSSTDIO <1>: Environment variables. + (line 191) +* environment variable; PYTHONLEGACYWINDOWSSTDIO <2>: Environment variables. + (line 352) +* environment variable; PYTHONLEGACYWINDOWSSTDIO <3>: sys — System-specific parameters and functions. + (line 1852) +* environment variable; PYTHONLEGACYWINDOWSSTDIO <4>: Global configuration variables. + (line 169) +* environment variable; PYTHONLEGACYWINDOWSSTDIO <5>: PyConfig. + (line 534) +* environment variable; PYTHONMALLOC: PYTHONMALLOC environment variable. + (line 6) +* environment variable; PYTHONMALLOC <1>: Changes in the C API<6>. + (line 9) +* environment variable; PYTHONMALLOC <2>: Core and Builtins<84>. + (line 90) +* environment variable; PYTHONMALLOC <3>: Environment variables. + (line 284) +* environment variable; PYTHONMALLOC <4>: Environment variables. + (line 329) +* environment variable; PYTHONMALLOC <5>: Performance options. + (line 109) +* environment variable; PYTHONMALLOC <6>: Performance options. + (line 116) +* environment variable; PYTHONMALLOC <7>: Effects of the Python Development Mode. + (line 46) +* environment variable; PYTHONMALLOC <8>: Effects of the Python Development Mode. + (line 50) +* environment variable; PYTHONMALLOC <9>: Overview<4>. (line 75) +* environment variable; PYTHONMALLOC <10>: Default Memory Allocators. + (line 26) +* environment variable; PYTHONMALLOC <11>: Debug hooks on the Python memory allocators. + (line 11) +* environment variable; PYTHONMALLOC <12>: The pymalloc allocator. + (line 27) +* environment variable; PYTHONMALLOCSTATS: Core and Builtins<84>. + (line 96) +* environment variable; PYTHONMALLOCSTATS <1>: Environment variables. + (line 323) +* environment variable; PYTHONMALLOCSTATS <2>: PyConfig. (line 550) +* environment variable; PYTHONMALLOCSTATS <3>: Overview<4>. (line 78) +* environment variable; PYTHONNODEBUGRANGES: PEP 657 Fine-grained error locations in tracebacks. + (line 63) +* environment variable; PYTHONNODEBUGRANGES <1>: Miscellaneous options. + (line 334) +* environment variable; PYTHONNODEBUGRANGES <2>: Environment variables. + (line 451) +* environment variable; PYTHONNODEBUGRANGES <3>: Methods on code objects. + (line 40) +* environment variable; PYTHONNODEBUGRANGES <4>: PyConfig. (line 249) +* environment variable; PYTHONNOUSERSITE: PEP 370 Per-user site-packages Directory. + (line 30) +* environment variable; PYTHONNOUSERSITE <1>: Miscellaneous options. + (line 158) +* environment variable; PYTHONNOUSERSITE <2>: Environment variables. + (line 195) +* environment variable; PYTHONNOUSERSITE <3>: Module contents<5>. + (line 15) +* environment variable; PYTHONNOUSERSITE <4>: Global configuration variables. + (line 203) +* environment variable; PYTHONNOUSERSITE <5>: PyConfig. (line 906) +* environment variable; PYTHONOPTIMIZE: Miscellaneous options. + (line 88) +* environment variable; PYTHONOPTIMIZE <1>: Environment variables. + (line 75) +* environment variable; PYTHONOPTIMIZE <2>: Global configuration variables. + (line 214) +* environment variable; PYTHONOPTIMIZE <3>: PyConfig. (line 617) +* environment variable; PYTHONPATH: Changes in ‘python’ Command Behavior<2>. + (line 8) +* environment variable; PYTHONPATH <1>: Changes in ‘python’ Command Behavior<2>. + (line 9) +* environment variable; PYTHONPATH <2>: The Module Search Path. + (line 16) +* environment variable; PYTHONPATH <3>: Standard Modules. (line 34) +* environment variable; PYTHONPATH <4>: Standard Modules. (line 35) +* environment variable; PYTHONPATH <5>: Miscellaneous options. + (line 45) +* environment variable; PYTHONPATH <6>: Environment variables. + (line 24) +* environment variable; PYTHONPATH <7>: Environment variables. + (line 32) +* environment variable; PYTHONPATH <8>: Environment variables. + (line 39) +* environment variable; PYTHONPATH <9>: Environment variables. + (line 42) +* environment variable; PYTHONPATH <10>: Excursus Setting environment variables. + (line 38) +* environment variable; PYTHONPATH <11>: Finding modules. (line 15) +* environment variable; PYTHONPATH <12>: Finding modules. (line 38) +* environment variable; PYTHONPATH <13>: Finding modules. (line 81) +* environment variable; PYTHONPATH <14>: Adding Python to an iOS project. + (line 152) +* environment variable; PYTHONPATH <15>: Adding Python to an iOS project. + (line 183) +* environment variable; PYTHONPATH <16>: Adding Python to an iOS project. + (line 189) +* environment variable; PYTHONPATH <17>: Path entry finders. (line 23) +* environment variable; PYTHONPATH <18>: test support script_helper — Utilities for the Python execution tests. + (line 26) +* environment variable; PYTHONPATH <19>: sys — System-specific parameters and functions. + (line 1329) +* environment variable; PYTHONPATH <20>: sys — System-specific parameters and functions. + (line 1334) +* environment variable; PYTHONPATH <21>: The initialization of the sys path module search path. + (line 14) +* environment variable; PYTHONPATH <22>: The initialization of the sys path module search path. + (line 18) +* environment variable; PYTHONPATH <23>: Building C and C++ Extensions. + (line 9) +* environment variable; PYTHONPATH <24>: Embedding Python<2>. + (line 39) +* environment variable; PYTHONPATH <25>: Embedding Python<2>. + (line 45) +* environment variable; PYTHONPATH <26>: Global configuration variables. + (line 91) +* environment variable; PYTHONPATH <27>: PyConfig. (line 583) +* environment variable; PYTHONPERFSUPPORT: Other Language Changes<2>. + (line 85) +* environment variable; PYTHONPERFSUPPORT <1>: Miscellaneous options. + (line 354) +* environment variable; PYTHONPERFSUPPORT <2>: Environment variables. + (line 462) +* environment variable; PYTHONPERFSUPPORT <3>: How to enable perf profiling support. + (line 7) +* environment variable; PYTHONPLATLIBDIR: Core and Builtins<45>. + (line 274) +* environment variable; PYTHONPLATLIBDIR <1>: Environment variables. + (line 54) +* environment variable; PYTHONPLATLIBDIR <2>: The initialization of the sys path module search path. + (line 51) +* environment variable; PYTHONPLATLIBDIR <3>: PyConfig. (line 562) +* environment variable; PYTHONPROFILEIMPORTTIME: Other Language Changes<7>. + (line 47) +* environment variable; PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<66>. + (line 66) +* environment variable; PYTHONPROFILEIMPORTTIME <2>: Miscellaneous options. + (line 298) +* environment variable; PYTHONPROFILEIMPORTTIME <3>: Environment variables. + (line 269) +* environment variable; PYTHONPROFILEIMPORTTIME <4>: PyConfig. + (line 435) +* environment variable; PYTHONPYCACHEPREFIX: Parallel filesystem cache for compiled bytecode files. + (line 6) +* environment variable; PYTHONPYCACHEPREFIX <1>: Core and Builtins<57>. + (line 402) +* environment variable; PYTHONPYCACHEPREFIX <2>: Miscellaneous options. + (line 318) +* environment variable; PYTHONPYCACHEPREFIX <3>: Environment variables. + (line 142) +* environment variable; PYTHONPYCACHEPREFIX <4>: sys — System-specific parameters and functions. + (line 387) +* environment variable; PYTHONPYCACHEPREFIX <5>: PyConfig. (line 724) +* environment variable; PYTHONREGRTEST_UNICODE_GUARD: Tests<26>. + (line 13) +* environment variable; PYTHONSAFEPATH: Summary – Release highlights<2>. + (line 27) +* environment variable; PYTHONSAFEPATH <1>: Other Language Changes<3>. + (line 37) +* environment variable; PYTHONSAFEPATH <2>: Security<20>. (line 6) +* environment variable; PYTHONSAFEPATH <3>: Miscellaneous options. + (line 116) +* environment variable; PYTHONSAFEPATH <4>: Environment variables. + (line 46) +* environment variable; PYTHONSAFEPATH <5>: sys — System-specific parameters and functions. + (line 1346) +* environment variable; PYTHONSAFEPATH <6>: Security Considerations<3>. + (line 47) +* environment variable; PYTHONSAFEPATH <7>: PyConfig. (line 166) +* environment variable; PYTHONSTARTUP: sys<12>. (line 17) +* environment variable; PYTHONSTARTUP <1>: sys<12>. (line 21) +* environment variable; PYTHONSTARTUP <2>: IDLE<39>. (line 176) +* environment variable; PYTHONSTARTUP <3>: IDLE<43>. (line 9) +* environment variable; PYTHONSTARTUP <4>: IDLE<49>. (line 9) +* environment variable; PYTHONSTARTUP <5>: The Interactive Startup File. + (line 8) +* environment variable; PYTHONSTARTUP <6>: Miscellaneous options. + (line 64) +* environment variable; PYTHONSTARTUP <7>: Environment variables. + (line 61) +* environment variable; PYTHONSTARTUP <8>: Environment variables. + (line 117) +* environment variable; PYTHONSTARTUP <9>: Example. (line 10) +* environment variable; PYTHONSTARTUP <10>: asyncio — Asynchronous I/O. + (line 87) +* environment variable; PYTHONSTARTUP <11>: Startup and Code Execution. + (line 7) +* environment variable; PYTHONSTARTUP <12>: Command line usage. + (line 42) +* environment variable; PYTHONSTARTUP <13>: sys — System-specific parameters and functions. + (line 1176) +* environment variable; PYTHONSTARTUP <14>: Readline configuration. + (line 12) +* environment variable; PYTHONTRACEMALLOC: Miscellaneous options. + (line 284) +* environment variable; PYTHONTRACEMALLOC <1>: Environment variables. + (line 256) +* environment variable; PYTHONTRACEMALLOC <2>: tracemalloc — Trace memory allocations. + (line 25) +* environment variable; PYTHONTRACEMALLOC <3>: tracemalloc — Trace memory allocations. + (line 32) +* environment variable; PYTHONTRACEMALLOC <4>: Functions<11>. + (line 90) +* environment variable; PYTHONTRACEMALLOC <5>: PyConfig. (line 864) +* environment variable; PYTHONTZPATH: Environment configuration. + (line 11) +* environment variable; PYTHONTZPATH <1>: Exceptions and warnings. + (line 14) +* environment variable; PYTHONUNBUFFERED: Core and Builtins<50>. + (line 107) +* environment variable; PYTHONUNBUFFERED <1>: Miscellaneous options. + (line 178) +* environment variable; PYTHONUNBUFFERED <2>: Environment variables. + (line 120) +* environment variable; PYTHONUNBUFFERED <3>: sys — System-specific parameters and functions. + (line 1859) +* environment variable; PYTHONUNBUFFERED <4>: Global configuration variables. + (line 242) +* environment variable; PYTHONUNBUFFERED <5>: PyConfig. (line 213) +* environment variable; PYTHONUOPS: Core and Builtins<21>. + (line 27) +* environment variable; PYTHONUOPS <1>: Core and Builtins<21>. + (line 179) +* environment variable; PYTHONUOPS <2>: Core and Builtins<21>. + (line 258) +* environment variable; PYTHONUOPS <3>: Core and Builtins<21>. + (line 317) +* environment variable; PYTHONUOPS <4>: Core and Builtins<21>. + (line 382) +* environment variable; PYTHONUSERBASE: PEP 370 Per-user site-packages Directory. + (line 23) +* environment variable; PYTHONUSERBASE <1>: Environment variables. + (line 205) +* environment variable; PYTHONUSERBASE <2>: Module contents<5>. + (line 40) +* environment variable; PYTHONUSERBASE <3>: Module contents<5>. + (line 68) +* environment variable; PYTHONUSERSITE: test support script_helper — Utilities for the Python execution tests. + (line 26) +* environment variable; PYTHONUTF8: PEP 540 Forced UTF-8 Runtime Mode. + (line 6) +* environment variable; PYTHONUTF8 <1>: Miscellaneous options. + (line 312) +* environment variable; PYTHONUTF8 <2>: Environment variables. + (line 412) +* environment variable; PYTHONUTF8 <3>: Environment variables. + (line 430) +* environment variable; PYTHONUTF8 <4>: UTF-8 mode. (line 18) +* environment variable; PYTHONUTF8 <5>: Python UTF-8 Mode. (line 52) +* environment variable; PYTHONUTF8 <6>: Python UTF-8 Mode. (line 54) +* environment variable; PYTHONUTF8 <7>: sys — System-specific parameters and functions. + (line 1850) +* environment variable; PYTHONUTF8 <8>: PyPreConfig. (line 152) +* environment variable; PYTHONUTF8 <9>: Python Configuration. + (line 14) +* environment variable; PYTHONVERBOSE: Miscellaneous options. + (line 194) +* environment variable; PYTHONVERBOSE <1>: Environment variables. + (line 125) +* environment variable; PYTHONVERBOSE <2>: Global configuration variables. + (line 259) +* environment variable; PYTHONVERBOSE <3>: PyConfig. (line 923) +* environment variable; PYTHONWARNDEFAULTENCODING: Optional EncodingWarning and encoding="locale" option. + (line 19) +* environment variable; PYTHONWARNDEFAULTENCODING <1>: Library<38>. + (line 45) +* environment variable; PYTHONWARNDEFAULTENCODING <2>: Miscellaneous options. + (line 324) +* environment variable; PYTHONWARNDEFAULTENCODING <3>: Environment variables. + (line 441) +* environment variable; PYTHONWARNDEFAULTENCODING <4>: Opt-in EncodingWarning. + (line 9) +* environment variable; PYTHONWARNINGS: warnings<3>. (line 21) +* environment variable; PYTHONWARNINGS <1>: Other Language Changes<12>. + (line 160) +* environment variable; PYTHONWARNINGS <2>: Changes to the Handling of Deprecation Warnings. + (line 25) +* environment variable; PYTHONWARNINGS <3>: Interpreter Changes. + (line 6) +* environment variable; PYTHONWARNINGS <4>: Documentation<23>. + (line 67) +* environment variable; PYTHONWARNINGS <5>: Miscellaneous options. + (line 248) +* environment variable; PYTHONWARNINGS <6>: Environment variables. + (line 223) +* environment variable; PYTHONWARNINGS <7>: Effects of the Python Development Mode. + (line 30) +* environment variable; PYTHONWARNINGS <8>: The Warnings Filter. + (line 46) +* environment variable; PYTHONWARNINGS <9>: The Warnings Filter. + (line 56) +* environment variable; PYTHONWARNINGS <10>: Describing Warning Filters. + (line 7) +* environment variable; PYTHONWARNINGS <11>: Describing Warning Filters. + (line 21) +* environment variable; PYTHONWARNINGS <12>: Default Warning Filter. + (line 7) +* environment variable; PYTHONWARNINGS <13>: PyConfig. (line 942) +* environment variable; SOURCE_DATE_EPOCH: py_compile<3>. (line 7) +* environment variable; SOURCE_DATE_EPOCH <1>: Library<56>. (line 452) +* environment variable; SOURCE_DATE_EPOCH <2>: Build<59>. (line 15) +* environment variable; SOURCE_DATE_EPOCH <3>: py_compile — Compile Python source files. + (line 66) +* environment variable; SOURCE_DATE_EPOCH <4>: py_compile — Compile Python source files. + (line 82) +* environment variable; SOURCE_DATE_EPOCH <5>: py_compile — Compile Python source files. + (line 86) +* environment variable; SOURCE_DATE_EPOCH <6>: Command-line use. + (line 97) +* environment variable; SSLKEYLOGFILE: Context creation. (line 34) +* environment variable; SSLKEYLOGFILE <1>: Context creation. (line 83) +* environment variable; SystemRoot: Popen Constructor. (line 308) +* environment variable; TEMP: Redirection of local data registry and temporary paths. + (line 7) +* environment variable; TEMP <1>: tempfile — Generate temporary files and directories. + (line 329) +* environment variable; TERM: Functions<6>. (line 485) +* environment variable; TERM <1>: Functions<6>. (line 512) +* environment variable; TMP: tempfile — Generate temporary files and directories. + (line 331) +* environment variable; TMPDIR: Library<2>. (line 116) +* environment variable; TMPDIR <1>: Tests<25>. (line 68) +* environment variable; TMPDIR <2>: tempfile — Generate temporary files and directories. + (line 327) +* environment variable; TZ: Functions<5>. (line 641) +* environment variable; TZ <1>: Functions<5>. (line 642) +* environment variable; TZ <2>: Functions<5>. (line 650) +* environment variable; TZ <3>: Functions<5>. (line 655) +* environment variable; TZ <4>: Functions<5>. (line 657) +* environment variable; TZ <5>: Functions<5>. (line 718) +* environment variable; USER: getpass — Portable password input. + (line 43) +* environment variable; USERNAME: os path — Common pathname manipulations. + (line 145) +* environment variable; USERNAME <1>: Process Parameters. (line 239) +* environment variable; USERNAME <2>: getpass — Portable password input. + (line 44) +* environment variable; USERPROFILE: os path<5>. (line 14) +* environment variable; USERPROFILE <1>: Changes in the Python API<5>. + (line 116) +* environment variable; USERPROFILE <2>: Windows<43>. (line 15) +* environment variable; USERPROFILE <3>: os path — Common pathname manipulations. + (line 142) +* environment variables; deleting: Process Parameters. (line 587) +* environment variables; setting: Process Parameters. (line 354) +* EnvironmentError: Concrete exceptions. + (line 497) +* Environments; virtual: venv — Creation of virtual environments. + (line 10) +* EnvironmentVarGuard (class in test.support.os_helper): test support os_helper — Utilities for os tests. + (line 49) +* ENXIO (in module errno): errno — Standard errno system symbols. + (line 50) +* eof (bz2.BZ2Decompressor attribute): Incremental de compression. + (line 72) +* eof (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory. + (line 165) +* eof (shlex.shlex attribute): shlex Objects. (line 178) +* eof (ssl.MemoryBIO attribute): Memory BIO Support<2>. + (line 143) +* eof (zlib.Decompress attribute): zlib — Compression compatible with gzip. + (line 252) +* eof_received() (asyncio.BufferedProtocol method): Buffered Streaming Protocols. + (line 40) +* eof_received() (asyncio.Protocol method): Streaming Protocols. + (line 30) +* EOFError: Concrete exceptions. + (line 33) +* EOFError (built-in exception): File Objects. (line 44) +* EOPNOTSUPP (in module errno): errno — Standard errno system symbols. + (line 414) +* EOT (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 31) +* EOVERFLOW (in module errno): errno — Standard errno system symbols. + (line 334) +* EOWNERDEAD (in module errno): errno — Standard errno system symbols. + (line 698) +* EPERM (in module errno): errno — Standard errno system symbols. + (line 26) +* EPFNOSUPPORT (in module errno): errno — Standard errno system symbols. + (line 424) +* epilogue (email.message.EmailMessage attribute): email message Representing an email message. + (line 704) +* epilogue (email.message.Message attribute): email message Message Representing an email message using the compat32 API. + (line 717) +* EPIPE (in module errno): errno — Standard errno system symbols. + (line 160) +* epoch: time — Time access and conversions. + (line 20) +* epoll() (in module select): select — Waiting for I/O completion. + (line 55) +* EpollSelector (class in selectors): Classes<4>. (line 175) +* EPROCLIM (in module errno): errno — Standard errno system symbols. + (line 635) +* EPROCUNAVAIL (in module errno): errno — Standard errno system symbols. + (line 641) +* EPROGMISMATCH (in module errno): errno — Standard errno system symbols. + (line 647) +* EPROGUNAVAIL (in module errno): errno — Standard errno system symbols. + (line 653) +* EPROTO (in module errno): errno — Standard errno system symbols. + (line 318) +* EPROTONOSUPPORT (in module errno): errno — Standard errno system symbols. + (line 406) +* EPROTOTYPE (in module errno): errno — Standard errno system symbols. + (line 398) +* epsilon (sys.float_info attribute): sys — System-specific parameters and functions. + (line 623) +* EPWROFF (in module errno): errno — Standard errno system symbols. + (line 659) +* Eq (class in ast): Expressions<2>. (line 108) +* eq() (in module operator): operator — Standard operators as functions. + (line 24) +* EQEQUAL (in module token): token — Constants used with Python parse trees. + (line 236) +* EQFULL (in module errno): errno — Standard errno system symbols. + (line 539) +* EQUAL (in module token): token — Constants used with Python parse trees. + (line 221) +* ERA (in module locale): locale — Internationalization services. + (line 302) +* ERA_D_FMT (in module locale): locale — Internationalization services. + (line 324) +* ERA_D_T_FMT (in module locale): locale — Internationalization services. + (line 319) +* ERA_T_FMT (in module locale): locale — Internationalization services. + (line 329) +* ERANGE (in module errno): errno — Standard errno system symbols. + (line 169) +* erase() (curses.window method): Window Objects. (line 221) +* erasechar() (in module curses): Functions<6>. (line 114) +* EREMCHG (in module errno): errno — Standard errno system symbols. + (line 346) +* EREMOTE (in module errno): errno — Standard errno system symbols. + (line 298) +* EREMOTEIO (in module errno): errno — Standard errno system symbols. + (line 531) +* ERESTART (in module errno): errno — Standard errno system symbols. + (line 374) +* erf() (in module math): Special functions. (line 6) +* erfc() (in module math): Special functions. (line 20) +* ERFKILL (in module errno): errno — Standard errno system symbols. + (line 569) +* EROFS (in module errno): errno — Standard errno system symbols. + (line 152) +* ERPCMISMATCH (in module errno): errno — Standard errno system symbols. + (line 671) +* ERR (in module curses): Constants<6>. (line 8) +* errcheck (ctypes._CFuncPtr attribute): Foreign functions. (line 70) +* errcode (xmlrpc.client.ProtocolError attribute): ProtocolError Objects. + (line 17) +* errmsg (xmlrpc.client.ProtocolError attribute): ProtocolError Objects. + (line 21) +* errno (OSError attribute): Concrete exceptions. + (line 172) +* error: Functions and Exceptions. + (line 8) +* Error: copy — Shallow and deep copy operations. + (line 33) +* Error <1>: Directory and files operations. + (line 471) +* error <1>: dbm — Interfaces to Unix “databases”. + (line 22) +* error <2>: dbm gnu — GNU database manager. + (line 22) +* error <3>: dbm ndbm — New Database Manager. + (line 28) +* error <4>: dbm dumb — Portable DBM implementation. + (line 23) +* Error <2>: Exceptions<7>. (line 15) +* error <5>: zlib — Compression compatible with gzip. + (line 24) +* Error <3>: Module Contents<3>. (line 333) +* Error <4>: Exceptions<8>. (line 6) +* error <6>: os — Miscellaneous operating system interfaces. + (line 51) +* error <7>: Functions<6>. (line 8) +* error <8>: _thread — Low-level threading API. + (line 21) +* error <9>: Exceptions<15>. (line 6) +* error <10>: select — Waiting for I/O completion. + (line 29) +* Error <5>: Exceptions<18>. (line 8) +* Error <6>: binascii — Convert between binary and ASCII. + (line 157) +* error <11>: xml parsers expat — Fast XML parsing using Expat. + (line 30) +* Error <7>: webbrowser — Convenient web-browser controller. + (line 62) +* Error <8>: wave — Read and write WAV files. + (line 52) +* Error <9>: locale — Internationalization services. + (line 22) +* error <12>: resource — Resource usage information. + (line 19) +* error <13>: getopt — C-style parser for command line options. + (line 93) +* ERROR (in module logging): Logging Levels. (line 40) +* ERROR (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 192) +* error handling: Exceptions<2>. (line 6) +* error_body (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 265) +* error_content_type (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 157) +* error_headers (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 258) +* error_leader() (shlex.shlex method): shlex Objects. (line 69) +* error_message_format (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 149) +* error_output() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 228) +* error_perm: Module variables. (line 16) +* error_proto: Module variables. (line 21) +* error_proto <1>: poplib — POP3 protocol client. + (line 89) +* error_received() (asyncio.DatagramProtocol method): Datagram Protocols. + (line 15) +* error_reply: Module variables. (line 6) +* error_status (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 252) +* error_temp: Module variables. (line 11) +* error() (argparse.ArgumentParser method): Exiting methods. (line 19) +* error() (in module logging): Module-Level Functions. + (line 80) +* error() (logging.Logger method): Logger Objects. (line 302) +* error() (urllib.request.OpenerDirector method): OpenerDirector Objects. + (line 58) +* error() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects. + (line 16) +* ErrorByteIndex (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 170) +* errorcode (in module errno): errno — Standard errno system symbols. + (line 13) +* ErrorCode (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 174) +* ErrorColumnNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 180) +* ErrorHandler (class in xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 38) +* errorlevel (tarfile.TarFile attribute): TarFile Objects. (line 224) +* ErrorLineNumber (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 184) +* errors: Exceptions<2>. (line 6) +* errors (io.TextIOBase attribute): Text I/O<2>. (line 20) +* errors (unittest.TestLoader attribute): Loading and running tests. + (line 17) +* errors (unittest.TestResult attribute): Loading and running tests. + (line 246) +* Errors; logging: logging — Logging facility for Python. + (line 8) +* ErrorStream (class in wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 28) +* ErrorString() (in module xml.parsers.expat): xml parsers expat — Fast XML parsing using Expat. + (line 41) +* ERRORTOKEN (in module token): token — Constants used with Python parse trees. + (line 159) +* ESC (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 106) +* escape (shlex.shlex attribute): shlex Objects. (line 110) +* escape sequence: String and Bytes literals. + (line 74) +* escape() (in module glob): glob — Unix style pathname pattern expansion. + (line 102) +* escape() (in module html): html — HyperText Markup Language support. + (line 12) +* escape() (in module re): Functions<2>. (line 256) +* escape() (in module xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 14) +* escapechar (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 35) +* escapedquotes (shlex.shlex attribute): shlex Objects. (line 122) +* ESHLIBVERS (in module errno): errno — Standard errno system symbols. + (line 677) +* ESHUTDOWN (in module errno): errno — Standard errno system symbols. + (line 474) +* ESOCKTNOSUPPORT (in module errno): errno — Standard errno system symbols. + (line 410) +* ESPIPE (in module errno): errno — Standard errno system symbols. + (line 148) +* ESRCH (in module errno): errno — Standard errno system symbols. + (line 36) +* ESRMNT (in module errno): errno — Standard errno system symbols. + (line 310) +* ESTALE (in module errno): errno — Standard errno system symbols. + (line 511) +* ESTRPIPE (in module errno): errno — Standard errno system symbols. + (line 378) +* ETB (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 94) +* ETH_P_ALL (in module socket): Constants<8>. (line 222) +* ETHERTYPE_ARP (in module socket): Constants<8>. (line 364) +* ETHERTYPE_IP (in module socket): Constants<8>. (line 364) +* ETHERTYPE_IPV6 (in module socket): Constants<8>. (line 364) +* ETHERTYPE_VLAN (in module socket): Constants<8>. (line 364) +* ETIME (in module errno): errno — Standard errno system symbols. + (line 282) +* ETIMEDOUT (in module errno): errno — Standard errno system symbols. + (line 483) +* Etiny() (decimal.Context method): Context objects. (line 244) +* ETOOMANYREFS (in module errno): errno — Standard errno system symbols. + (line 479) +* Etop() (decimal.Context method): Context objects. (line 250) +* ETX (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 28) +* ETXTBSY (in module errno): errno — Standard errno system symbols. + (line 136) +* EUCLEAN (in module errno): errno — Standard errno system symbols. + (line 515) +* EUNATCH (in module errno): errno — Standard errno system symbols. + (line 230) +* EUSERS (in module errno): errno — Standard errno system symbols. + (line 382) +* evaluation; order: Evaluation order. (line 6) +* Event (class in asyncio): Event. (line 6) +* Event (class in multiprocessing): Synchronization primitives. + (line 42) +* Event (class in threading): Event objects. (line 14) +* event scheduling: sched — Event scheduler. + (line 8) +* EVENT_READ (in module selectors): Classes<4>. (line 23) +* EVENT_WRITE (in module selectors): Classes<4>. (line 26) +* Event() (multiprocessing.managers.SyncManager method): Managers. + (line 183) +* eventfd_read() (in module os): Files and Directories. + (line 1899) +* eventfd_write() (in module os): Files and Directories. + (line 1909) +* eventfd() (in module os): Files and Directories. + (line 1846) +* EventLoop (class in asyncio): Event Loop Implementations. + (line 44) +* events (selectors.SelectorKey attribute): Classes<4>. (line 44) +* events (widgets): Bindings and Events. + (line 6) +* EWOULDBLOCK (in module errno): errno — Standard errno system symbols. + (line 197) +* EX_CANTCREAT (in module os): Process Management. (line 207) +* EX_CONFIG (in module os): Process Management. (line 243) +* EX_DATAERR (in module os): Process Management. (line 156) +* EX_IOERR (in module os): Process Management. (line 214) +* EX_NOHOST (in module os): Process Management. (line 175) +* EX_NOINPUT (in module os): Process Management. (line 162) +* EX_NOPERM (in module os): Process Management. (line 236) +* EX_NOTFOUND (in module os): Process Management. (line 250) +* EX_NOUSER (in module os): Process Management. (line 169) +* EX_OK (in module os): Process Management. (line 141) +* EX_OSERR (in module os): Process Management. (line 193) +* EX_OSFILE (in module os): Process Management. (line 200) +* EX_PROTOCOL (in module os): Process Management. (line 229) +* EX_SOFTWARE (in module os): Process Management. (line 187) +* EX_TEMPFAIL (in module os): Process Management. (line 221) +* EX_UNAVAILABLE (in module os): Process Management. (line 181) +* EX_USAGE (in module os): Process Management. (line 149) +* EXACT_TOKEN_TYPES (in module token): token — Constants used with Python parse trees. + (line 326) +* Example (class in doctest): Example Objects. (line 6) +* example (doctest.DocTestFailure attribute): Debugging. (line 200) +* example (doctest.UnexpectedException attribute): Debugging. + (line 221) +* examples (doctest.DocTest attribute): DocTest Objects. (line 17) +* exc_info (doctest.UnexpectedException attribute): Debugging. + (line 225) +* exc_info (in module sys): Traceback objects. (line 6) +* exc_info (in module sys) <1>: Exceptions<21>. (line 45) +* exc_info() (in module sys): sys — System-specific parameters and functions. + (line 449) +* exc_msg (doctest.Example attribute): Example Objects. (line 31) +* exc_type (traceback.TracebackException attribute): TracebackException Objects. + (line 79) +* exc_type_str (traceback.TracebackException attribute): TracebackException Objects. + (line 85) +* excel (class in csv): Module Contents<3>. (line 204) +* excel_tab (class in csv): Module Contents<3>. (line 210) +* ExceptHandler (class in ast): Control flow. (line 201) +* excepthook() (in module sys): sys — System-specific parameters and functions. + (line 393) +* excepthook() (in module threading): Reference<2>. (line 26) +* exception: Exceptions<2>. (line 6) +* exception <1>: The raise statement. + (line 6) +* Exception: Base classes. (line 66) +* EXCEPTION (in module _tkinter): File Handlers. (line 41) +* exception handler: Exceptions<2>. (line 6) +* EXCEPTION_HANDLED (monitoring event): Events. (line 26) +* exception; AssertionError: The assert statement. + (line 21) +* exception; AttributeError: Attribute references. + (line 10) +* exception; chaining: The raise statement. + (line 30) +* exception; chaining <1>: Exception context. (line 6) +* exception; GeneratorExit: Generator-iterator methods. + (line 65) +* exception; GeneratorExit <1>: Asynchronous generator-iterator methods. + (line 61) +* exception; handler: Traceback objects. (line 6) +* exception; ImportError: The import statement. + (line 6) +* exception; NameError: Identifiers Names. (line 10) +* exception; StopAsyncIteration: Asynchronous generator-iterator methods. + (line 10) +* exception; StopIteration: Generator-iterator methods. + (line 12) +* exception; StopIteration <1>: The yield statement. + (line 6) +* exception; TypeError: Unary arithmetic and bitwise operations. + (line 23) +* exception; ValueError: Shifting operations. + (line 20) +* exception; ZeroDivisionError: Binary arithmetic operations. + (line 34) +* exception() (asyncio.Future method): Future Object. (line 123) +* exception() (asyncio.Task method): Task Object. (line 87) +* exception() (concurrent.futures.Future method): Future Objects. + (line 52) +* exception() (in module logging): Module-Level Functions. + (line 92) +* exception() (in module sys): sys — System-specific parameters and functions. + (line 437) +* exception() (logging.Logger method): Logger Objects. (line 318) +* ExceptionGroup: Exception groups. (line 12) +* exceptions (BaseExceptionGroup attribute): Exception groups. + (line 38) +* exceptions (pdb command): Debugger Commands. (line 439) +* exceptions (traceback.TracebackException attribute): TracebackException Objects. + (line 53) +* EXCLAMATION (in module token): token — Constants used with Python parse trees. + (line 317) +* exclusive; or: Binary bitwise operations. + (line 16) +* EXDEV (in module errno): errno — Standard errno system symbols. + (line 102) +* exec_module() (importlib.abc.InspectLoader method): importlib abc – Abstract base classes related to import. + (line 260) +* exec_module() (importlib.abc.Loader method): importlib abc – Abstract base classes related to import. + (line 114) +* exec_module() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 407) +* exec_module() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 321) +* exec_module() (zipimport.zipimporter method): zipimporter Objects. + (line 31) +* exec_prefix (in module sys): sys — System-specific parameters and functions. + (line 469) +* execl() (in module os): Process Management. (line 53) +* execle() (in module os): Process Management. (line 53) +* execlp() (in module os): Process Management. (line 53) +* execlpe() (in module os): Process Management. (line 53) +* executable (in module sys): sys — System-specific parameters and functions. + (line 486) +* executable (in module sys) <1>: Process-wide parameters. + (line 117) +* Executable Zip Files: zipapp — Manage executable Python zip archives. + (line 10) +* execute() (sqlite3.Connection method): Connection objects. (line 97) +* execute() (sqlite3.Cursor method): Cursor objects. (line 24) +* executemany() (sqlite3.Connection method): Connection objects. + (line 103) +* executemany() (sqlite3.Cursor method): Cursor objects. (line 59) +* executescript() (sqlite3.Connection method): Connection objects. + (line 109) +* executescript() (sqlite3.Cursor method): Cursor objects. (line 100) +* execution model: Execution model. (line 6) +* execution; frame: Structure of a program. + (line 18) +* execution; frame <1>: Class definitions. (line 6) +* execution; stack: Traceback objects. (line 6) +* ExecutionLoader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 273) +* Executor (class in concurrent.futures): Executor Objects. (line 6) +* execv() (in module os): Process Management. (line 53) +* execve() (in module os): Process Management. (line 53) +* execvp() (in module os): Process Management. (line 53) +* execvpe() (in module os): Process Management. (line 53) +* EXFULL (in module errno): errno — Standard errno system symbols. + (line 250) +* exists() (in module os.path): os path — Common pathname manipulations. + (line 110) +* exists() (pathlib.Path method): Querying file type and status. + (line 36) +* exists() (tkinter.ttk.Treeview method): ttk Treeview. (line 89) +* exists() (zipfile.Path method): Path Objects. (line 74) +* exit (built-in variable): Constants added by the site module. + (line 11) +* exit (C function): Process Control. (line 23) +* exit() (argparse.ArgumentParser method): Exiting methods. (line 6) +* exit() (in module _thread): _thread — Low-level threading API. + (line 78) +* exit() (in module sys): sys — System-specific parameters and functions. + (line 493) +* exitcode (multiprocessing.Process attribute): Process and exceptions. + (line 159) +* exitonclick() (in module turtle): Methods specific to Screen not inherited from TurtleScreen. + (line 10) +* ExitStack (class in contextlib): Utilities. (line 503) +* exp() (decimal.Context method): Context objects. (line 315) +* exp() (decimal.Decimal method): Decimal objects. (line 234) +* exp() (in module cmath): Power and logarithmic functions. + (line 6) +* exp() (in module math): Power exponential and logarithmic functions. + (line 12) +* exp2() (in module math): Power exponential and logarithmic functions. + (line 18) +* expand_tabs (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 167) +* expand() (re.Match method): Match Objects. (line 23) +* ExpandEnvironmentStrings() (in module winreg): Functions<13>. + (line 228) +* expandNode() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects. + (line 21) +* expandtabs() (bytearray method): Bytes and Bytearray Operations. + (line 483) +* expandtabs() (bytes method): Bytes and Bytearray Operations. + (line 483) +* expandtabs() (str method): String Methods<2>. (line 134) +* expanduser() (in module os.path): os path — Common pathname manipulations. + (line 131) +* expanduser() (pathlib.Path method): Expanding and resolving paths. + (line 18) +* expandvars() (in module os.path): os path — Common pathname manipulations. + (line 155) +* Expat: xml parsers expat — Fast XML parsing using Expat. + (line 11) +* ExpatError: xml parsers expat — Fast XML parsing using Expat. + (line 24) +* expected (asyncio.IncompleteReadError attribute): Exceptions<13>. + (line 52) +* expectedFailure() (in module unittest): Skipping tests and expected failures. + (line 98) +* expectedFailures (unittest.TestResult attribute): Loading and running tests. + (line 266) +* expired() (asyncio.Timeout method): Timeouts. (line 72) +* expires (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 53) +* expires (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* exploded (ipaddress.IPv4Address attribute): Address objects. + (line 60) +* exploded (ipaddress.IPv4Network attribute): Network objects. + (line 109) +* exploded (ipaddress.IPv6Address attribute): Address objects. + (line 259) +* exploded (ipaddress.IPv6Network attribute): Network objects. + (line 321) +* expm1() (in module math): Power exponential and logarithmic functions. + (line 24) +* expovariate() (in module random): Real-valued distributions. + (line 38) +* Expr (class in ast): Expressions<2>. (line 6) +* expression: Expressions. (line 6) +* expression <1>: Glossary. (line 471) +* Expression (class in ast): Root nodes. (line 26) +* expression; list: Expression lists. (line 6) +* expression; list <1>: Expression statements. + (line 6) +* expression; list <2>: Expression statements. + (line 6) +* expression; statement: Expression statements. + (line 6) +* expunge() (imaplib.IMAP4 method): IMAP4 Objects. (line 93) +* extend_path() (in module pkgutil): pkgutil — Package extension utility. + (line 19) +* extend() (array.array method): array — Efficient arrays of numeric values. + (line 157) +* extend() (collections.deque method): deque objects. (line 59) +* extend() (sequence method): Mutable Sequence Types. + (line 16) +* extend() (xml.etree.ElementTree.Element method): Element Objects. + (line 93) +* EXTENDED_ARG (opcode): Python Bytecode Instructions. + (line 1160) +* ExtendedContext (in module decimal): Context objects. (line 76) +* ExtendedInterpolation (class in configparser): Interpolation of values. + (line 41) +* extendleft() (collections.deque method): deque objects. (line 64) +* extension module: Glossary. (line 482) +* EXTENSION_SUFFIXES (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 50) +* extension; module: The standard type hierarchy. + (line 6) +* ExtensionFileLoader (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 288) +* extensions_map (http.server.SimpleHTTPRequestHandler attribute): http server — HTTP servers. + (line 365) +* External Data Representation: Data stream format. (line 6) +* external_attr (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 128) +* ExternalClashError: Exceptions<18>. (line 24) +* ExternalEntityParserCreate() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 44) +* ExternalEntityRefHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 374) +* extra (zipfile.ZipInfo attribute): ZipInfo Objects. (line 94) +* extract_cookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 31) +* extract_stack() (in module traceback): Module-Level Functions<2>. + (line 94) +* extract_tb() (in module traceback): Module-Level Functions<2>. + (line 82) +* extract_version (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 108) +* extract() (tarfile.TarFile method): TarFile Objects. (line 175) +* extract() (traceback.StackSummary class method): StackSummary Objects. + (line 12) +* extract() (zipfile.ZipFile method): ZipFile Objects. (line 187) +* extractall() (tarfile.TarFile method): TarFile Objects. (line 138) +* extractall() (zipfile.ZipFile method): ZipFile Objects. (line 214) +* ExtractError: tarfile — Read and write tar archive files. + (line 219) +* extractfile() (tarfile.TarFile method): TarFile Objects. (line 208) +* extraction_filter (tarfile.TarFile attribute): TarFile Objects. + (line 244) +* extsep (in module os): Miscellaneous System Information. + (line 132) +* f_back (frame attribute): Frame objects. (line 10) +* f_back (frame attribute) <1>: Special read-only attributes<3>. + (line 6) +* f_builtins (frame attribute): Frame objects. (line 10) +* f_builtins (frame attribute) <1>: Special read-only attributes<3>. + (line 29) +* f_code (frame attribute): Frame objects. (line 10) +* f_code (frame attribute) <1>: Special read-only attributes<3>. + (line 10) +* F_CONTIGUOUS (inspect.BufferFlags attribute): Buffer flags. + (line 27) +* f_contiguous (memoryview attribute): Memory Views. (line 480) +* f_globals (frame attribute): Frame objects. (line 10) +* f_globals (frame attribute) <1>: Special read-only attributes<3>. + (line 25) +* f_lasti (frame attribute): Frame objects. (line 10) +* f_lasti (frame attribute) <1>: Special read-only attributes<3>. + (line 33) +* f_lineno (frame attribute): Special read-only attributes<3>. + (line 37) +* f_lineno (frame attribute) <1>: Special writable attributes<2>. + (line 23) +* f_locals (frame attribute): Frame objects. (line 10) +* f_locals (frame attribute) <1>: Special read-only attributes<3>. + (line 16) +* F_LOCK (in module os): File Descriptor Operations. + (line 280) +* F_OK (in module os): Files and Directories. + (line 107) +* F_TEST (in module os): File Descriptor Operations. + (line 280) +* F_TLOCK (in module os): File Descriptor Operations. + (line 280) +* f_trace (frame attribute): Special read-only attributes<3>. + (line 38) +* f_trace (frame attribute) <1>: Special writable attributes<2>. + (line 6) +* f_trace_lines (frame attribute): Special read-only attributes<3>. + (line 38) +* f_trace_lines (frame attribute) <1>: Special writable attributes<2>. + (line 12) +* f_trace_opcodes (frame attribute): Special read-only attributes<3>. + (line 38) +* f_trace_opcodes (frame attribute) <1>: Special writable attributes<2>. + (line 16) +* F_ULOCK (in module os): File Descriptor Operations. + (line 280) +* f-string: Fancier Output Formatting. + (line 93) +* f-string <1>: String literal concatenation. + (line 24) +* f-string <2>: Glossary. (line 487) +* f-strings: String Methods<2>. (line 753) +* f'; formatted string literal: String and Bytes literals. + (line 64) +* f"; formatted string literal: String and Bytes literals. + (line 64) +* fabs() (in module math): Floating point arithmetic. + (line 13) +* factorial() (in module math): Number-theoretic functions. + (line 23) +* factory() (importlib.util.LazyLoader class method): importlib util – Utility code for importers. + (line 222) +* FAIL_FAST (in module doctest): Option Flags. (line 138) +* fail() (unittest.TestCase method): Test cases. (line 688) +* failed (doctest.TestResults attribute): TestResults objects. + (line 8) +* failfast (unittest.TestResult attribute): Loading and running tests. + (line 304) +* failureException (unittest.TestCase attribute): Test cases. + (line 693) +* failures (doctest.DocTestRunner attribute): DocTestRunner objects. + (line 139) +* failures (unittest.TestResult attribute): Loading and running tests. + (line 252) +* FakePath (class in test.support.os_helper): test support os_helper — Utilities for os tests. + (line 60) +* False: numbers Integral. (line 27) +* false: Truth Value Testing. + (line 6) +* False <1>: Truth Value Testing. + (line 23) +* False <2>: Boolean Type - bool. + (line 9) +* False (Built-in object): Truth Value Testing. + (line 15) +* False (built-in variable): Built-in Constants. (line 8) +* families() (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 88) +* family (socket.socket attribute): Socket Objects. (line 615) +* FancyURLopener (class in urllib.request): Legacy interface. + (line 146) +* fast (pickle.Pickler attribute): Module Interface. (line 218) +* FastChildWatcher (class in asyncio): Process Watchers. (line 142) +* fatalError() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects. + (line 24) +* Fault (class in xmlrpc.client): Fault Objects. (line 6) +* faultCode (xmlrpc.client.Fault attribute): Fault Objects. (line 11) +* faultString (xmlrpc.client.Fault attribute): Fault Objects. + (line 15) +* fchdir() (in module os): Files and Directories. + (line 281) +* fchmod() (in module os): File Descriptor Operations. + (line 121) +* fchown() (in module os): File Descriptor Operations. + (line 137) +* fcntl() (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 67) +* fd (selectors.SelectorKey attribute): Classes<4>. (line 40) +* fd_count() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 97) +* fd() (in module turtle): Turtle motion. (line 6) +* fdatasync() (in module os): File Descriptor Operations. + (line 152) +* fdopen() (in module os): File Object Creation. + (line 9) +* feature_external_ges (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 81) +* feature_external_pes (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 88) +* feature_namespace_prefixes (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 60) +* feature_namespaces (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 53) +* feature_string_interning (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 67) +* feature_validation (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 74) +* FEBRUARY (in module calendar): calendar — General calendar-related functions. + (line 490) +* feed_eof() (asyncio.StreamReader method): StreamReader. (line 16) +* feed() (email.parser.BytesFeedParser method): FeedParser API. + (line 56) +* feed() (html.parser.HTMLParser method): HTMLParser Methods. + (line 8) +* feed() (xml.etree.ElementTree.XMLParser method): XMLParser Objects. + (line 27) +* feed() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects. + (line 18) +* feed() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects. + (line 9) +* FeedParser (class in email.parser): FeedParser API. (line 71) +* fetch() (imaplib.IMAP4 method): IMAP4 Objects. (line 99) +* fetchall() (sqlite3.Cursor method): Cursor objects. (line 146) +* fetchmany() (sqlite3.Cursor method): Cursor objects. (line 129) +* fetchone() (sqlite3.Cursor method): Cursor objects. (line 122) +* FF (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 61) +* fflags (select.kevent attribute): Kevent Objects. (line 90) +* Field (class in dataclasses): Module contents<4>. (line 309) +* field_size_limit() (in module csv): Module Contents<3>. (line 95) +* field() (in module dataclasses): Module contents<4>. (line 211) +* fieldnames (csv.DictReader attribute): Reader Objects. (line 31) +* fields (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 96) +* fields() (in module dataclasses): Module contents<4>. (line 337) +* FIFOTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 303) +* file (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 82) +* file (pyclbr.Class attribute): Class Objects<2>. (line 12) +* file (pyclbr.Function attribute): Function Objects. (line 11) +* file object: Glossary. (line 493) +* file object; io module: Overview<2>. (line 6) +* file object; open() built-in function: Built-in Functions. (line 1277) +* FILE_ATTRIBUTE_ARCHIVE (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_COMPRESSED (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_DEVICE (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_DIRECTORY (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_ENCRYPTED (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_HIDDEN (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_INTEGRITY_STREAM (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_NO_SCRUB_DATA (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_NORMAL (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_NOT_CONTENT_INDEXED (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_OFFLINE (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_READONLY (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_REPARSE_POINT (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_SPARSE_FILE (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_SYSTEM (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_TEMPORARY (in module stat): stat — Interpreting stat results. + (line 452) +* FILE_ATTRIBUTE_VIRTUAL (in module stat): stat — Interpreting stat results. + (line 452) +* file_digest() (in module hashlib): File hashing. (line 9) +* file_open() (urllib.request.FileHandler method): FileHandler Objects. + (line 6) +* file_size (zipfile.ZipInfo attribute): ZipInfo Objects. (line 144) +* file-like object: Glossary. (line 509) +* file; byte-code: py_compile — Compile Python source files. + (line 8) +* file; copying: shutil — High-level file operations. + (line 8) +* file; large files: Large File Support. (line 6) +* file; mime.types: mimetypes — Map filenames to MIME types. + (line 138) +* file; modes: Built-in Functions. (line 1303) +* fileConfig() (in module logging.config): Configuration functions. + (line 61) +* FileCookieJar (class in http.cookiejar): http cookiejar — Cookie handling for HTTP clients. + (line 57) +* FileDialog (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 78) +* FileExistsError: OS exceptions. (line 63) +* FileFinder (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 153) +* FileHandler (class in logging): FileHandler. (line 10) +* FileHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 424) +* FileInput (class in fileinput): fileinput — Iterate over lines from multiple input streams. + (line 139) +* FileIO (class in io): Raw File I/O. (line 6) +* filelineno() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 104) +* FileLoader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 292) +* filemode() (in module stat): stat — Interpreting stat results. + (line 121) +* filename (doctest.DocTest attribute): DocTest Objects. (line 36) +* filename (http.cookiejar.FileCookieJar attribute): CookieJar and FileCookieJar Objects. + (line 154) +* filename (inspect.FrameInfo attribute): The interpreter stack. + (line 17) +* filename (inspect.Traceback attribute): The interpreter stack. + (line 57) +* filename (netrc.NetrcParseError attribute): netrc — netrc file processing. + (line 57) +* filename (OSError attribute): Concrete exceptions. + (line 194) +* filename (SyntaxError attribute): Concrete exceptions. + (line 317) +* filename (traceback.FrameSummary attribute): FrameSummary Objects. + (line 28) +* filename (traceback.TracebackException attribute): TracebackException Objects. + (line 91) +* filename (tracemalloc.Frame attribute): Frame. (line 13) +* filename (zipfile.ZipFile attribute): ZipFile Objects. (line 352) +* filename (zipfile.ZipInfo attribute): ZipInfo Objects. (line 51) +* filename_only (in module tabnanny): tabnanny — Detection of ambiguous indentation. + (line 31) +* filename_pattern (tracemalloc.Filter attribute): Filter. (line 54) +* filename() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 86) +* filename2 (OSError attribute): Concrete exceptions. + (line 194) +* filenames; pathname expansion: glob — Unix style pathname pattern expansion. + (line 8) +* filenames; wildcard expansion: fnmatch — Unix filename pattern matching. + (line 8) +* fileno() (bz2.BZ2File method): De compression of files. + (line 88) +* fileno() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 36) +* fileno() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 91) +* fileno() (io.IOBase method): I/O Base Classes. (line 62) +* fileno() (multiprocessing.connection.Connection method): Connection Objects. + (line 31) +* fileno() (select.devpoll method): /dev/poll Polling Objects. + (line 24) +* fileno() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 73) +* fileno() (select.kqueue method): Kqueue Objects. (line 14) +* fileno() (selectors.DevpollSelector method): Classes<4>. (line 188) +* fileno() (selectors.EpollSelector method): Classes<4>. (line 179) +* fileno() (selectors.KqueueSelector method): Classes<4>. (line 199) +* fileno() (socket.socket method): Socket Objects. (line 118) +* fileno() (socketserver.BaseServer method): Server Objects<2>. + (line 14) +* FileNotFoundError: OS exceptions. (line 68) +* fileobj (selectors.SelectorKey attribute): Classes<4>. (line 36) +* files_double_event() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 94) +* files_select_event() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 98) +* files() (importlib.abc.TraversableResources method): importlib abc – Abstract base classes related to import. + (line 583) +* files() (importlib.resources.abc.TraversableResources method): importlib resources abc – Abstract base classes for resources. + (line 169) +* files() (in module importlib.metadata): Distribution files. + (line 6) +* files() (in module importlib.resources): importlib resources – Package resource reading opening and access. + (line 52) +* filesystem encoding and error handler: Glossary. (line 513) +* FileType (class in argparse): FileType objects. (line 6) +* FileWrapper (class in wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 32) +* FileWrapper (class in wsgiref.util): wsgiref util – WSGI environment utilities. + (line 117) +* fill() (in module textwrap): textwrap — Text wrapping and filling. + (line 33) +* fill() (textwrap.TextWrapper method): textwrap — Text wrapping and filling. + (line 295) +* fillcolor() (in module turtle): Color control. (line 58) +* filling() (in module turtle): Filling. (line 6) +* fillvalue (reprlib.Repr attribute): Repr Objects. (line 10) +* Filter (class in logging): Filter Objects. (line 13) +* Filter (class in tracemalloc): Filter. (line 6) +* filter (select.kevent attribute): Kevent Objects. (line 15) +* filter_command() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 102) +* FILTER_DIR (in module unittest.mock): FILTER_DIR. (line 6) +* filter_traces() (tracemalloc.Snapshot method): Snapshot. (line 35) +* filter() (in module curses): Functions<6>. (line 121) +* filter() (in module fnmatch): fnmatch — Unix filename pattern matching. + (line 75) +* filter() (logging.Filter method): Filter Objects. (line 20) +* filter() (logging.Handler method): Handler Objects. (line 61) +* filter() (logging.Logger method): Logger Objects. (line 333) +* FilterError: tarfile — Read and write tar archive files. + (line 230) +* filterfalse() (in module itertools): Itertool Functions. (line 289) +* filterwarnings() (in module warnings): Available Functions. + (line 107) +* Final (in module typing): Special forms. (line 224) +* final() (in module typing): Functions and decorators. + (line 311) +* finalization, of objects: Finalization and De-allocation. + (line 6) +* finalize (class in weakref): weakref — Weak references. + (line 268) +* finalizer: Basic customization. + (line 55) +* find_class() (pickle protocol): Restricting Globals. + (line 6) +* find_class() (pickle.Unpickler method): Module Interface. (line 293) +* find_library() (in module ctypes.util): Utility functions. (line 111) +* find_loader() (in module pkgutil): pkgutil — Package extension utility. + (line 55) +* find_longest_match() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 64) +* find_msvcrt() (in module ctypes.util): Utility functions. (line 120) +* find_spec() (importlib.abc.MetaPathFinder method): importlib abc – Abstract base classes related to import. + (line 35) +* find_spec() (importlib.abc.PathEntryFinder method): importlib abc – Abstract base classes related to import. + (line 71) +* find_spec() (importlib.machinery.FileFinder method): importlib machinery – Importers and path hooks. + (line 183) +* find_spec() (importlib.machinery.PathFinder class method): importlib machinery – Importers and path hooks. + (line 116) +* find_spec() (in module importlib.util): importlib util – Utility code for importers. + (line 101) +* find_spec() (zipimport.zipimporter method): zipimporter Objects. + (line 38) +* find_unused_port() (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 15) +* find_user_password() (urllib.request.HTTPPasswordMgr method): HTTPPasswordMgr Objects. + (line 16) +* find_user_password() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects. + (line 19) +* find() (bytearray method): Bytes and Bytearray Operations. + (line 133) +* find() (bytes method): Bytes and Bytearray Operations. + (line 133) +* find() (doctest.DocTestFinder method): DocTestFinder objects. + (line 32) +* find() (in module gettext): Class-based API. (line 14) +* find() (mmap.mmap method): mmap — Memory-mapped file support. + (line 195) +* find() (str method): String Methods<2>. (line 158) +* find() (xml.etree.ElementTree.Element method): Element Objects. + (line 101) +* find() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 21) +* findall() (in module re): Functions<2>. (line 131) +* findall() (re.Pattern method): Regular Expression Objects. + (line 85) +* findall() (xml.etree.ElementTree.Element method): Element Objects. + (line 110) +* findall() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 26) +* findCaller() (logging.Logger method): Logger Objects. (line 350) +* finder: Finders and loaders. + (line 6) +* finder <1>: Glossary. (line 533) +* finder; find_spec: The meta path. (line 6) +* findfile() (in module test.support): test support — Utilities for the Python test suite. + (line 271) +* finditer() (in module re): Functions<2>. (line 157) +* finditer() (re.Pattern method): Regular Expression Objects. + (line 91) +* findlabels() (in module dis): Analysis functions. (line 182) +* findlinestarts() (in module dis): Analysis functions. (line 165) +* findtext() (xml.etree.ElementTree.Element method): Element Objects. + (line 119) +* findtext() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 31) +* finish_request() (socketserver.BaseServer method): Server Objects<2>. + (line 128) +* finish() (socketserver.BaseRequestHandler method): Request Handler Objects. + (line 35) +* finish() (tkinter.dnd.DndHandler method): tkinter dnd — Drag and drop support. + (line 52) +* FIRST_COMPLETED (in module asyncio): Waiting Primitives. (line 35) +* FIRST_COMPLETED (in module concurrent.futures): Module Functions. + (line 30) +* FIRST_EXCEPTION (in module asyncio): Waiting Primitives. (line 39) +* FIRST_EXCEPTION (in module concurrent.futures): Module Functions. + (line 34) +* firstChild (xml.dom.Node attribute): Node Objects. (line 54) +* FirstHeaderLineIsContinuationDefect: email errors Exception and Defect classes. + (line 92) +* firstkey() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 85) +* firstweekday (calendar.Calendar attribute): calendar — General calendar-related functions. + (line 40) +* firstweekday() (in module calendar): calendar — General calendar-related functions. + (line 360) +* fix_missing_locations() (in module ast): ast Helpers. (line 145) +* fix_sentence_endings (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 222) +* Flag (class in enum): Data Types<2>. (line 430) +* flag_bits (zipfile.ZipInfo attribute): ZipInfo Objects. (line 116) +* FlagBoundary (class in enum): Data Types<2>. (line 666) +* flags (decimal.Context attribute): Context objects. (line 133) +* flags (in module sys): sys — System-specific parameters and functions. + (line 524) +* flags (re.Pattern attribute): Regular Expression Objects. + (line 107) +* flags (select.kevent attribute): Kevent Objects. (line 52) +* flash() (in module curses): Functions<6>. (line 132) +* flatten() (email.generator.BytesGenerator method): email generator Generating MIME documents. + (line 79) +* flatten() (email.generator.Generator method): email generator Generating MIME documents. + (line 174) +* flattening; objects: pickle — Python object serialization. + (line 8) +* float (built-in class): Built-in Functions. (line 722) +* float_info (in module sys): sys — System-specific parameters and functions. + (line 608) +* float_repr_style (in module sys): sys — System-specific parameters and functions. + (line 716) +* floating-point literal: Numeric literals. (line 6) +* floating-point; literals: Numeric Types — int float complex. + (line 19) +* floating-point; number: numbers Real float. (line 6) +* FloatingPointError: Concrete exceptions. + (line 40) +* FloatOperation (class in decimal): Signals. (line 102) +* flock() (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 160) +* floor division: Glossary. (line 545) +* floor() (in module math): Numeric Types — int float complex. + (line 107) +* floor() (in module math) <1>: Floating point arithmetic. + (line 17) +* FloorDiv (class in ast): Expressions<2>. (line 53) +* floordiv() (in module operator): operator — Standard operators as functions. + (line 88) +* flush_headers() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 284) +* flush_std_streams() (in module test.support): test support — Utilities for the Python test suite. + (line 403) +* flush() (bz2.BZ2Compressor method): Incremental de compression. + (line 25) +* flush() (io.BufferedWriter method): Buffered Streams. (line 122) +* flush() (io.IOBase method): I/O Base Classes. (line 68) +* flush() (logging.Handler method): Handler Objects. (line 69) +* flush() (logging.handlers.BufferingHandler method): MemoryHandler. + (line 30) +* flush() (logging.handlers.MemoryHandler method): MemoryHandler. + (line 61) +* flush() (logging.StreamHandler method): StreamHandler. (line 25) +* flush() (lzma.LZMACompressor method): Compressing and decompressing data in memory. + (line 91) +* flush() (mailbox.Mailbox method): Mailbox objects. (line 249) +* flush() (mailbox.Maildir method): Maildir objects. (line 204) +* flush() (mailbox.MH method): MH objects. (line 102) +* flush() (mmap.mmap method): mmap — Memory-mapped file support. + (line 205) +* flush() (xml.etree.ElementTree.XMLParser method): XMLParser Objects. + (line 31) +* flush() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects. + (line 22) +* flush() (zlib.Compress method): zlib — Compression compatible with gzip. + (line 211) +* flush() (zlib.Decompress method): zlib — Compression compatible with gzip. + (line 283) +* flushinp() (in module curses): Functions<6>. (line 139) +* FlushKey() (in module winreg): Functions<13>. (line 239) +* fma() (decimal.Context method): Context objects. (line 319) +* fma() (decimal.Decimal method): Decimal objects. (line 272) +* fma() (in module math): Floating point arithmetic. + (line 23) +* fmean() (in module statistics): Function details. (line 49) +* fmod() (in module math): Floating point arithmetic. + (line 38) +* FMT_BINARY (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 162) +* FMT_XML (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 156) +* fnmatch() (in module fnmatch): fnmatch — Unix filename pattern matching. + (line 50) +* fnmatchcase() (in module fnmatch): fnmatch — Unix filename pattern matching. + (line 69) +* focus() (tkinter.ttk.Treeview method): ttk Treeview. (line 93) +* fold (datetime.datetime attribute): datetime Objects. (line 339) +* fold (datetime.time attribute): time Objects. (line 71) +* fold_binary() (email.policy.Compat32 method): email policy Policy Objects. + (line 608) +* fold_binary() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 487) +* fold_binary() (email.policy.Policy method): email policy Policy Objects. + (line 351) +* fold() (email.headerregistry.BaseHeader method): email headerregistry Custom Header Objects. + (line 72) +* fold() (email.policy.Compat32 method): email policy Policy Objects. + (line 600) +* fold() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 467) +* fold() (email.policy.Policy method): email policy Policy Objects. + (line 336) +* Font (class in tkinter.font): tkinter font — Tkinter font wrapper. + (line 20) +* For (class in ast): Control flow. (line 44) +* FOR_ITER (opcode): Python Bytecode Instructions. + (line 898) +* for; in comprehensions: Displays for lists sets and dictionaries. + (line 14) +* forget() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 11) +* forget() (tkinter.ttk.Notebook method): ttk Notebook. (line 18) +* fork() (in module os): Process Management. (line 256) +* fork() (in module pty): pty — Pseudo-terminal utilities. + (line 22) +* ForkingMixIn (class in socketserver): Server Creation Notes. + (line 27) +* ForkingTCPServer (class in socketserver): Server Creation Notes. + (line 67) +* ForkingUDPServer (class in socketserver): Server Creation Notes. + (line 67) +* ForkingUnixDatagramServer (class in socketserver): Server Creation Notes. + (line 67) +* ForkingUnixStreamServer (class in socketserver): Server Creation Notes. + (line 67) +* forkpty() (in module os): Process Management. (line 300) +* FORMAT (inspect.BufferFlags attribute): Buffer flags. (line 19) +* format (memoryview attribute): Memory Views. (line 421) +* format (multiprocessing.shared_memory.ShareableList attribute): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 341) +* format (struct.Struct attribute): Classes<3>. (line 54) +* format_datetime() (in module email.utils): email utils Miscellaneous utilities. + (line 173) +* format_exc() (in module traceback): Module-Level Functions<2>. + (line 164) +* format_exception_only() (in module traceback): Module-Level Functions<2>. + (line 118) +* format_exception_only() (traceback.TracebackException method): TracebackException Objects. + (line 155) +* format_exception() (in module traceback): Module-Level Functions<2>. + (line 148) +* format_field() (string.Formatter method): Custom String Formatting. + (line 102) +* format_frame_summary() (traceback.StackSummary method): StackSummary Objects. + (line 53) +* format_help() (argparse.ArgumentParser method): Printing help. + (line 30) +* format_list() (in module traceback): Module-Level Functions<2>. + (line 108) +* format_map() (str method): String Methods<2>. (line 202) +* FORMAT_SIMPLE (opcode): Python Bytecode Instructions. + (line 1186) +* format_stack_entry() (bdb.Bdb method): bdb — Debugger framework. + (line 414) +* format_stack() (in module traceback): Module-Level Functions<2>. + (line 173) +* format_string() (in module locale): locale — Internationalization services. + (line 451) +* format_tb() (in module traceback): Module-Level Functions<2>. + (line 169) +* format_usage() (argparse.Action method): Action classes. (line 57) +* format_usage() (argparse.ArgumentParser method): Printing help. + (line 25) +* FORMAT_WITH_SPEC (opcode): Python Bytecode Instructions. + (line 1198) +* format() (built-in function); __str__() (object method): Basic customization. + (line 131) +* format() (inspect.Signature method): Introspecting callables with the Signature object. + (line 157) +* format() (logging.BufferingFormatter method): Formatter Objects. + (line 155) +* format() (logging.Formatter method): Formatter Objects. (line 52) +* format() (logging.Handler method): Handler Objects. (line 104) +* format() (pprint.PrettyPrinter method): PrettyPrinter Objects. + (line 82) +* format() (str method): String Methods<2>. (line 172) +* format() (string.Formatter method): Custom String Formatting. + (line 17) +* format() (traceback.StackSummary method): StackSummary Objects. + (line 38) +* format() (traceback.TracebackException method): TracebackException Objects. + (line 143) +* format() (tracemalloc.Traceback method): Traceback. (line 37) +* formataddr() (in module email.utils): email utils Miscellaneous utilities. + (line 71) +* formatargvalues() (in module inspect): Classes and functions<2>. + (line 73) +* formatdate() (in module email.utils): email utils Miscellaneous utilities. + (line 152) +* formatday() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 156) +* FormatError: Exceptions<18>. (line 31) +* FormatError() (in module ctypes): Utility functions. (line 132) +* formatException() (logging.Formatter method): Formatter Objects. + (line 117) +* formatFooter() (logging.BufferingFormatter method): Formatter Objects. + (line 148) +* formatHeader() (logging.BufferingFormatter method): Formatter Objects. + (line 141) +* formatmonth() (calendar.HTMLCalendar method): calendar — General calendar-related functions. + (line 229) +* formatmonth() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 185) +* formatmonthname() (calendar.HTMLCalendar method): calendar — General calendar-related functions. + (line 250) +* formatmonthname() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 194) +* formatStack() (logging.Formatter method): Formatter Objects. + (line 125) +* formatted string literal: Fancier Output Formatting. + (line 93) +* formatted string literal <1>: String literal concatenation. + (line 24) +* formatted string literals: String Methods<2>. (line 753) +* FormattedValue (class in ast): Literals<3>. (line 18) +* Formatter (class in logging): Formatter Objects. (line 6) +* Formatter (class in string): Custom String Formatting. + (line 13) +* formatTime() (logging.Formatter method): Formatter Objects. + (line 77) +* formatting, string (%): printf-style String Formatting. + (line 6) +* formatting; bytearray (%): printf-style Bytes Formatting. + (line 6) +* formatting; bytes (%): printf-style Bytes Formatting. + (line 6) +* formatwarning() (in module warnings): Available Functions. + (line 98) +* formatweek() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 163) +* formatweekday() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 171) +* formatweekheader() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 178) +* formatyear() (calendar.HTMLCalendar method): calendar — General calendar-related functions. + (line 235) +* formatyear() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 208) +* formatyearpage() (calendar.HTMLCalendar method): calendar — General calendar-related functions. + (line 240) +* Fortran contiguous: shape strides suboffsets. + (line 25) +* Fortran contiguous <1>: Glossary. (line 330) +* forward() (in module turtle): Turtle motion. (line 6) +* ForwardRef (class in typing): Introspection helpers. + (line 148) +* fp (urllib.error.HTTPError attribute): urllib error — Exception classes raised by urllib request. + (line 62) +* fpathconf() (in module os): File Descriptor Operations. + (line 161) +* Fraction (class in fractions): fractions — Rational numbers. + (line 16) +* Frame (class in tracemalloc): Frame. (line 6) +* frame (inspect.FrameInfo attribute): The interpreter stack. + (line 13) +* frame (tkinter.scrolledtext.ScrolledText attribute): tkinter scrolledtext — Scrolled Text Widget. + (line 26) +* FrameInfo (class in inspect): The interpreter stack. + (line 11) +* FrameSummary (class in traceback): FrameSummary Objects. + (line 11) +* FrameType (in module types): Standard Interpreter Types. + (line 195) +* free (C function): Overview<4>. (line 33) +* free threading: Glossary. (line 553) +* free variable: Glossary. (line 560) +* free_tool_id() (in module sys.monitoring): Registering and using tools. + (line 13) +* free; variable: Binding of names. (line 48) +* freedesktop_os_release() (in module platform): Linux platforms. + (line 6) +* freefunc (C type): Slot Type typedefs. (line 27) +* freeze utility: Importing Modules<2>. + (line 273) +* freeze_support() (in module multiprocessing): Miscellaneous<3>. + (line 50) +* freeze() (in module gc): gc — Garbage Collector interface. + (line 205) +* frexp() (in module math): Floating point manipulation functions. + (line 12) +* FRIDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* from_address() (ctypes._CData method): Data types. (line 42) +* from_buffer_copy() (ctypes._CData method): Data types. (line 31) +* from_buffer() (ctypes._CData method): Data types. (line 19) +* from_bytes() (int class method): Additional Methods on Integer Types. + (line 111) +* from_callable() (inspect.Signature class method): Introspecting callables with the Signature object. + (line 169) +* from_decimal() (fractions.Fraction class method): fractions — Rational numbers. + (line 149) +* from_exception() (traceback.TracebackException class method): TracebackException Objects. + (line 126) +* from_file() (zipfile.ZipInfo class method): ZipInfo Objects. + (line 14) +* from_file() (zoneinfo.ZoneInfo class method): The ZoneInfo class. + (line 28) +* from_float() (decimal.Decimal class method): Decimal objects. + (line 245) +* from_float() (fractions.Fraction class method): fractions — Rational numbers. + (line 138) +* from_iterable() (itertools.chain class method): Itertool Functions. + (line 117) +* from_list() (traceback.StackSummary class method): StackSummary Objects. + (line 31) +* from_param() (ctypes._CData method): Data types. (line 51) +* from_samples() (statistics.NormalDist class method): NormalDist objects. + (line 45) +* from_traceback() (dis.Bytecode class method): Bytecode analysis. + (line 43) +* from_uri() (pathlib.Path class method): Parsing and generating URIs. + (line 12) +* from; import statement: Binding of names. (line 9) +* from; import statement <1>: The import statement. + (line 52) +* from; yield from expression: Yield expressions. (line 66) +* frombuf() (tarfile.TarInfo class method): TarInfo Objects. (line 37) +* frombytes() (array.array method): array — Efficient arrays of numeric values. + (line 165) +* fromfd() (in module socket): Creating sockets. (line 159) +* fromfd() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 77) +* fromfd() (select.kqueue method): Kqueue Objects. (line 18) +* fromfile() (array.array method): array — Efficient arrays of numeric values. + (line 175) +* fromhex() (bytearray class method): Bytearray Objects. (line 36) +* fromhex() (bytes class method): Bytes Objects. (line 62) +* fromhex() (float class method): Additional Methods on Float. + (line 39) +* fromisocalendar() (datetime.date class method): date Objects. + (line 91) +* fromisocalendar() (datetime.datetime class method): datetime Objects. + (line 246) +* fromisoformat() (datetime.date class method): date Objects. + (line 63) +* fromisoformat() (datetime.datetime class method): datetime Objects. + (line 197) +* fromisoformat() (datetime.time class method): time Objects. + (line 107) +* fromkeys() (collections.Counter method): Counter objects. (line 117) +* fromkeys() (dict class method): Mapping Types — dict. + (line 173) +* fromlist() (array.array method): array — Efficient arrays of numeric values. + (line 183) +* fromordinal() (datetime.date class method): date Objects. (line 54) +* fromordinal() (datetime.datetime class method): datetime Objects. + (line 171) +* fromshare() (in module socket): Creating sockets. (line 176) +* fromstring() (in module xml.etree.ElementTree): Functions<9>. + (line 99) +* fromstringlist() (in module xml.etree.ElementTree): Functions<9>. + (line 107) +* fromtarfile() (tarfile.TarInfo class method): TarInfo Objects. + (line 44) +* fromtimestamp() (datetime.date class method): date Objects. + (line 35) +* fromtimestamp() (datetime.datetime class method): datetime Objects. + (line 100) +* fromunicode() (array.array method): array — Efficient arrays of numeric values. + (line 189) +* fromutc() (datetime.timezone method): timezone Objects. (line 61) +* fromutc() (datetime.tzinfo method): tzinfo Objects. (line 163) +* FrozenImporter (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 80) +* FrozenInstanceError: Module contents<4>. (line 513) +* frozenset (built-in class): Set Types — set frozenset. + (line 33) +* FrozenSet (class in typing): Aliases to built-in types. + (line 42) +* FS (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 109) +* fs_is_case_insensitive() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 101) +* FS_NONASCII (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 11) +* fsdecode() (in module os): Process Parameters. (line 95) +* fsencode() (in module os): Process Parameters. (line 82) +* fspath() (in module os): Process Parameters. (line 108) +* fstat() (in module os): File Descriptor Operations. + (line 183) +* fstatvfs() (in module os): File Descriptor Operations. + (line 195) +* fstring: Fancier Output Formatting. + (line 93) +* fstring <1>: String literal concatenation. + (line 24) +* fstring <2>: String Methods<2>. (line 753) +* FSTRING_END (in module token): token — Constants used with Python parse trees. + (line 115) +* FSTRING_MIDDLE (in module token): token — Constants used with Python parse trees. + (line 105) +* FSTRING_START (in module token): token — Constants used with Python parse trees. + (line 96) +* fsum() (in module math): Summation and product functions. + (line 18) +* fsync() (in module os): File Descriptor Operations. + (line 203) +* FTP: urllib request Restrictions. + (line 37) +* FTP (class in ftplib): FTP objects. (line 6) +* ftp_open() (urllib.request.FTPHandler method): FTPHandler Objects. + (line 6) +* FTP_TLS (class in ftplib): FTP_TLS objects. (line 6) +* FTP; ftplib (standard module): ftplib — FTP protocol client. + (line 8) +* FTP; protocol: urllib request Restrictions. + (line 6) +* FTP; protocol <1>: ftplib — FTP protocol client. + (line 8) +* FTPHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 434) +* ftruncate() (in module os): File Descriptor Operations. + (line 216) +* Full: queue — A synchronized queue class. + (line 88) +* FULL (inspect.BufferFlags attribute): Buffer flags. (line 45) +* full_match() (pathlib.PurePath method): Methods and properties. + (line 254) +* FULL_RO (inspect.BufferFlags attribute): Buffer flags. (line 47) +* full_url (urllib.request.Request attribute): Request Objects. + (line 11) +* full() (asyncio.Queue method): Queue. (line 31) +* full() (multiprocessing.Queue method): Pipes and Queues. (line 125) +* full() (queue.Queue method): Queue Objects. (line 22) +* fullmatch() (in module re): Functions<2>. (line 67) +* fullmatch() (re.Pattern method): Regular Expression Objects. + (line 62) +* fully_trusted_filter() (in module tarfile): Default named filters. + (line 9) +* func (functools.partial attribute): partial Objects. (line 9) +* funcname (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 101) +* function: Glossary. (line 569) +* Function (class in pyclbr): Function Objects. (line 6) +* Function (class in symtable): Examining Symbol Tables. + (line 122) +* function (inspect.FrameInfo attribute): The interpreter stack. + (line 27) +* function (inspect.Traceback attribute): The interpreter stack. + (line 67) +* FUNCTION (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 15) +* function annotation: Glossary. (line 577) +* function; annotations: Function Annotations. + (line 6) +* function; annotations <1>: Function definitions. + (line 109) +* function; argument: Callable types. (line 6) +* function; call: Callable types. (line 6) +* function; call <1>: Calls. (line 132) +* function; call <2>: Calls. (line 143) +* function; definition: The return statement. + (line 6) +* function; definition <1>: Function definitions. + (line 6) +* function; generator: The yield statement. + (line 6) +* function; name: Function definitions. + (line 6) +* function; name <1>: Function definitions. + (line 6) +* FunctionDef (class in ast): Function and class definitions. + (line 6) +* FunctionTestCase (class in unittest): Test cases. (line 956) +* FunctionType (class in ast): Root nodes. (line 57) +* FunctionType (in module types): Standard Interpreter Types. + (line 25) +* funny_files (filecmp.dircmp attribute): The dircmp class. (line 99) +* Future (class in asyncio): Future Object. (line 6) +* Future (class in concurrent.futures): Future Objects. (line 10) +* future; statement: Future statements. (line 6) +* FutureWarning: Warnings. (line 51) +* fwalk() (in module os): Files and Directories. + (line 1742) +* gaierror: Exceptions<15>. (line 27) +* gamma() (in module math): Special functions. (line 29) +* gammavariate() (in module random): Real-valued distributions. + (line 48) +* garbage (in module gc): gc — Garbage Collector interface. + (line 239) +* garbage collection: Objects values and types. + (line 37) +* garbage collection <1>: Glossary. (line 611) +* gather() (curses.textpad.Textbox method): Textbox objects. (line 109) +* gather() (in module asyncio): Running Tasks Concurrently. + (line 6) +* gauss() (in module random): Real-valued distributions. + (line 61) +* gc_collect() (in module test.support): test support — Utilities for the Python test suite. + (line 356) +* gcd() (in module math): Number-theoretic functions. + (line 30) +* gcvisitobjects_t (C type): Querying Garbage Collector State. + (line 26) +* ge() (in module operator): operator — Standard operators as functions. + (line 24) +* generate_tokens() (in module tokenize): Tokenizing Input. (line 38) +* generator: Glossary. (line 620) +* generator <1>: Glossary. (line 620) +* Generator (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 56) +* Generator (class in email.generator): email generator Generating MIME documents. + (line 139) +* Generator (class in typing): Aliases to other ABCs in collections abc. + (line 37) +* generator expression: Glossary. (line 642) +* generator expression <1>: Glossary. (line 642) +* generator iterator: Glossary. (line 630) +* generator_stop (in module __future__): Module Contents<5>. (line 43) +* generator; expression: Generator expressions. + (line 6) +* generator; function: Generator functions. + (line 6) +* generator; function <1>: Yield expressions. (line 6) +* generator; function <2>: The yield statement. + (line 6) +* generator; iterator: Generator functions. + (line 6) +* generator; iterator <1>: The yield statement. + (line 6) +* GeneratorExit: Concrete exceptions. + (line 44) +* GeneratorExp (class in ast): Comprehensions. (line 6) +* generators (in module __future__): Module Contents<5>. (line 18) +* GeneratorType (in module types): Standard Interpreter Types. + (line 37) +* Generic (class in typing): Building generic types and type aliases. + (line 15) +* generic function: Glossary. (line 651) +* generic type: Glossary. (line 659) +* generic_visit() (ast.NodeVisitor method): ast Helpers. (line 201) +* Generic; Alias: Generic Alias Type. (line 6) +* generic; special; attribute: The standard type hierarchy. + (line 13) +* GenericAlias (class in types): Standard Interpreter Types. + (line 150) +* genops() (in module pickletools): Programmatic Interface<2>. + (line 22) +* geometric_mean() (in module statistics): Function details. (line 77) +* GET_AITER (opcode): Python Bytecode Instructions. + (line 322) +* get_all_breaks() (bdb.Bdb method): bdb — Debugger framework. + (line 398) +* get_all_start_methods() (in module multiprocessing): Miscellaneous<3>. + (line 76) +* get_all() (email.message.EmailMessage method): email message Representing an email message. + (line 254) +* get_all() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 364) +* get_all() (wsgiref.headers.Headers method): wsgiref headers – WSGI response header tools. + (line 51) +* GET_ANEXT (opcode): Python Bytecode Instructions. + (line 331) +* get_annotations() (in module inspect): Classes and functions<2>. + (line 156) +* get_app() (wsgiref.simple_server.WSGIServer method): wsgiref simple_server – a simple WSGI HTTP server. + (line 69) +* get_archive_formats() (in module shutil): Archiving operations. + (line 68) +* get_args() (in module typing): Introspection helpers. + (line 81) +* get_asyncgen_hooks() (in module sys): sys — System-specific parameters and functions. + (line 1007) +* get_attribute() (in module test.support): test support — Utilities for the Python test suite. + (line 591) +* GET_AWAITABLE (opcode): Python Bytecode Instructions. + (line 303) +* get_begidx() (in module readline): Completion. (line 40) +* get_blocking() (in module os): File Descriptor Operations. + (line 229) +* get_body_encoding() (email.charset.Charset method): email charset Representing character sets. + (line 96) +* get_body() (email.message.EmailMessage method): email message Representing an email message. + (line 518) +* get_boundary() (email.message.EmailMessage method): email message Representing an email message. + (line 403) +* get_boundary() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 582) +* get_bpbynumber() (bdb.Bdb method): bdb — Debugger framework. + (line 374) +* get_break() (bdb.Bdb method): bdb — Debugger framework. + (line 383) +* get_breaks() (bdb.Bdb method): bdb — Debugger framework. + (line 388) +* get_buffer() (asyncio.BufferedProtocol method): Buffered Streaming Protocols. + (line 21) +* get_bytes() (mailbox.Mailbox method): Mailbox objects. (line 167) +* get_bytes() (mailbox.mbox method): mbox objects. (line 32) +* get_bytes() (mailbox.MMDF method): MMDF objects. (line 29) +* get_ca_certs() (ssl.SSLContext method): SSL Contexts. (line 178) +* get_cache_token() (in module abc): abc — Abstract Base Classes. + (line 326) +* get_channel_binding() (ssl.SSLSocket method): SSL Sockets. (line 258) +* get_charset() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 268) +* get_charsets() (email.message.EmailMessage method): email message Representing an email message. + (line 431) +* get_charsets() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 616) +* get_child_watcher() (asyncio.AbstractEventLoopPolicy method): Policy Objects. + (line 33) +* get_child_watcher() (in module asyncio): Process Watchers. (line 25) +* get_children() (symtable.SymbolTable method): Examining Symbol Tables. + (line 118) +* get_children() (tkinter.ttk.Treeview method): ttk Treeview. + (line 19) +* get_ciphers() (ssl.SSLContext method): SSL Contexts. (line 192) +* get_clock_info() (in module time): Functions<5>. (line 105) +* get_close_matches() (in module difflib): difflib — Helpers for computing deltas. + (line 205) +* get_code() (importlib.abc.InspectLoader method): importlib abc – Abstract base classes related to import. + (line 207) +* get_code() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 402) +* get_code() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 333) +* get_code() (importlib.machinery.SourcelessFileLoader method): importlib machinery – Importers and path hooks. + (line 269) +* get_code() (zipimport.zipimporter method): zipimporter Objects. + (line 45) +* get_completer_delims() (in module readline): Completion. (line 50) +* get_completer() (in module readline): Completion. (line 29) +* get_completion_type() (in module readline): Completion. (line 34) +* get_config_h_filename() (in module sysconfig): Other functions<3>. + (line 70) +* get_config_var() (in module sysconfig): Configuration variables. + (line 26) +* get_config_vars() (in module sysconfig): Configuration variables. + (line 16) +* get_content_charset() (email.message.EmailMessage method): email message Representing an email message. + (line 424) +* get_content_charset() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 605) +* get_content_disposition() (email.message.EmailMessage method): email message Representing an email message. + (line 455) +* get_content_disposition() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 630) +* get_content_maintype() (email.message.EmailMessage method): email message Representing an email message. + (line 324) +* get_content_maintype() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 434) +* get_content_subtype() (email.message.EmailMessage method): email message Representing an email message. + (line 330) +* get_content_subtype() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 440) +* get_content_type() (email.message.EmailMessage method): email message Representing an email message. + (line 308) +* get_content_type() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 418) +* get_content() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content. + (line 19) +* get_content() (email.message.EmailMessage method): email message Representing an email message. + (line 582) +* get_content() (in module email.contentmanager): Content Manager Instances. + (line 24) +* get_context() (asyncio.Handle method): Callback Handles. (line 11) +* get_context() (asyncio.Task method): Task Object. (line 170) +* get_context() (in module multiprocessing): Miscellaneous<3>. + (line 85) +* get_coro() (asyncio.Task method): Task Object. (line 157) +* get_coroutine_origin_tracking_depth() (in module sys): sys — System-specific parameters and functions. + (line 1021) +* get_count() (in module gc): gc — Garbage Collector interface. + (line 113) +* get_current_history_length() (in module readline): History list. + (line 14) +* get_data() (importlib.abc.FileLoader method): importlib abc – Abstract base classes related to import. + (line 324) +* get_data() (importlib.abc.ResourceLoader method): importlib abc – Abstract base classes related to import. + (line 187) +* get_data() (in module pkgutil): pkgutil — Package extension utility. + (line 185) +* get_data() (zipimport.zipimporter method): zipimporter Objects. + (line 50) +* get_date() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 92) +* get_debug() (asyncio.loop method): Enabling debug mode. + (line 6) +* get_debug() (in module gc): gc — Garbage Collector interface. + (line 58) +* get_default_scheme() (in module sysconfig): Installation path functions. + (line 14) +* get_default_type() (email.message.EmailMessage method): email message Representing an email message. + (line 335) +* get_default_type() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 445) +* get_default_verify_paths() (in module ssl): Certificate handling. + (line 62) +* get_default() (argparse.ArgumentParser method): Parser defaults. + (line 33) +* get_dialect() (in module csv): Module Contents<3>. (line 85) +* get_disassembly_as_string() (test.support.bytecode_helper.BytecodeTestCase method): test support bytecode_helper — Support tools for testing correct bytecode generation. + (line 18) +* get_docstring() (in module ast): ast Helpers. (line 122) +* get_doctest() (doctest.DocTestParser method): DocTestParser objects. + (line 13) +* get_endidx() (in module readline): Completion. (line 40) +* get_environ() (wsgiref.simple_server.WSGIRequestHandler method): wsgiref simple_server – a simple WSGI HTTP server. + (line 91) +* get_errno() (in module ctypes): Utility functions. (line 148) +* get_escdelay() (in module curses): Functions<6>. (line 448) +* get_event_loop_policy() (in module asyncio): Getting and Setting the Policy. + (line 9) +* get_event_loop() (asyncio.AbstractEventLoopPolicy method): Policy Objects. + (line 12) +* get_event_loop() (in module asyncio): Event Loop. (line 39) +* get_events() (in module sys.monitoring): Setting events globally. + (line 9) +* get_examples() (doctest.DocTestParser method): DocTestParser objects. + (line 22) +* get_exception_handler() (asyncio.loop method): Error Handling API. + (line 27) +* get_exec_path() (in module os): Process Parameters. (line 167) +* get_extra_info() (asyncio.BaseTransport method): Base Transport. + (line 21) +* get_extra_info() (asyncio.StreamWriter method): StreamWriter. + (line 61) +* get_field() (string.Formatter method): Custom String Formatting. + (line 55) +* get_file_breaks() (bdb.Bdb method): bdb — Debugger framework. + (line 393) +* get_file() (mailbox.Babyl method): Babyl objects. (line 49) +* get_file() (mailbox.Mailbox method): Mailbox objects. (line 183) +* get_file() (mailbox.Maildir method): Maildir objects. (line 221) +* get_file() (mailbox.mbox method): mbox objects. (line 39) +* get_file() (mailbox.MH method): MH objects. (line 96) +* get_file() (mailbox.MMDF method): MMDF objects. (line 36) +* get_filename() (email.message.EmailMessage method): email message Representing an email message. + (line 393) +* get_filename() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 572) +* get_filename() (importlib.abc.ExecutionLoader method): importlib abc – Abstract base classes related to import. + (line 279) +* get_filename() (importlib.abc.FileLoader method): importlib abc – Abstract base classes related to import. + (line 320) +* get_filename() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 341) +* get_filename() (zipimport.zipimporter method): zipimporter Objects. + (line 58) +* get_filter() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 106) +* get_flags() (mailbox.Maildir method): Maildir objects. (line 92) +* get_flags() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 63) +* get_flags() (mailbox.mboxMessage method): mboxMessage objects. + (line 64) +* get_flags() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 63) +* get_folder() (mailbox.Maildir method): Maildir objects. (line 69) +* get_folder() (mailbox.MH method): MH objects. (line 39) +* get_frees() (symtable.Function method): Examining Symbol Tables. + (line 145) +* get_freeze_count() (in module gc): gc — Garbage Collector interface. + (line 230) +* get_from() (mailbox.mboxMessage method): mboxMessage objects. + (line 47) +* get_from() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 46) +* get_full_url() (urllib.request.Request method): Request Objects. + (line 107) +* get_globals() (symtable.Function method): Examining Symbol Tables. + (line 136) +* get_grouped_opcodes() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 168) +* get_handle_inheritable() (in module os): Inheritance of File Descriptors. + (line 34) +* get_header() (urllib.request.Request method): Request Objects. + (line 121) +* get_history_item() (in module readline): History list. (line 20) +* get_history_length() (in module readline): History file. (line 30) +* get_id() (symtable.SymbolTable method): Examining Symbol Tables. + (line 69) +* get_ident() (in module _thread): _thread — Low-level threading API. + (line 88) +* get_ident() (in module threading): Reference<2>. (line 73) +* get_identifiers() (string.Template method): Template strings. + (line 75) +* get_identifiers() (symtable.SymbolTable method): Examining Symbol Tables. + (line 103) +* get_importer() (in module pkgutil): pkgutil — Package extension utility. + (line 73) +* get_info() (mailbox.Maildir method): Maildir objects. (line 155) +* get_info() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 102) +* get_inheritable() (in module os): Inheritance of File Descriptors. + (line 25) +* get_inheritable() (socket.socket method): Socket Objects. (line 127) +* get_instructions() (in module dis): Analysis functions. (line 138) +* get_int_max_str_digits() (in module sys): sys — System-specific parameters and functions. + (line 822) +* get_interpreter() (in module zipapp): Python API. (line 83) +* GET_ITER (opcode): Python Bytecode Instructions. + (line 214) +* get_key() (selectors.BaseSelector method): Classes<4>. (line 145) +* get_labels() (mailbox.Babyl method): Babyl objects. (line 35) +* get_labels() (mailbox.BabylMessage method): BabylMessage objects. + (line 47) +* get_last_error() (in module ctypes): Utility functions. (line 156) +* GET_LEN (opcode): Python Bytecode Instructions. + (line 524) +* get_line_buffer() (in module readline): Line buffer. (line 8) +* get_lineno() (symtable.SymbolTable method): Examining Symbol Tables. + (line 85) +* get_loader() (in module pkgutil): pkgutil — Package extension utility. + (line 87) +* get_local_events() (in module sys.monitoring): Per code object events. + (line 11) +* get_locals() (symtable.Function method): Examining Symbol Tables. + (line 132) +* get_logger() (in module multiprocessing): Logging<2>. (line 11) +* get_loop() (asyncio.Future method): Future Object. (line 136) +* get_loop() (asyncio.Runner method): Runner context manager. + (line 57) +* get_loop() (asyncio.Server method): Server Objects. (line 69) +* get_makefile_filename() (in module sysconfig): Other functions<3>. + (line 74) +* get_map() (selectors.BaseSelector method): Classes<4>. (line 153) +* get_matching_blocks() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 107) +* get_message() (mailbox.Mailbox method): Mailbox objects. (line 160) +* get_method() (urllib.request.Request method): Request Objects. + (line 69) +* get_methods() (symtable.Class method): Examining Symbol Tables. + (line 155) +* get_mixed_type_key() (in module ipaddress): Other Module Level Functions. + (line 56) +* get_name() (asyncio.Task method): Task Object. (line 177) +* get_name() (symtable.Symbol method): Examining Symbol Tables. + (line 196) +* get_name() (symtable.SymbolTable method): Examining Symbol Tables. + (line 73) +* get_namespace() (symtable.Symbol method): Examining Symbol Tables. + (line 267) +* get_namespaces() (symtable.Symbol method): Examining Symbol Tables. + (line 263) +* get_native_id() (in module _thread): _thread — Low-level threading API. + (line 96) +* get_native_id() (in module threading): Reference<2>. (line 83) +* get_nonlocals() (symtable.Function method): Examining Symbol Tables. + (line 140) +* get_nonstandard_attr() (http.cookiejar.Cookie method): Cookie Objects<2>. + (line 102) +* get_nowait() (asyncio.Queue method): Queue. (line 48) +* get_nowait() (multiprocessing.Queue method): Pipes and Queues. + (line 166) +* get_nowait() (queue.Queue method): Queue Objects. (line 66) +* get_nowait() (queue.SimpleQueue method): SimpleQueue Objects. + (line 51) +* get_object_traceback() (in module tracemalloc): Functions<11>. + (line 12) +* get_objects() (in module gc): gc — Garbage Collector interface. + (line 62) +* get_opcodes() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 125) +* get_option_group() (optparse.OptionParser method): Grouping Options. + (line 103) +* get_option() (optparse.OptionParser method): Querying and manipulating your option parser. + (line 37) +* get_origin() (in module typing): Introspection helpers. + (line 58) +* get_original_bases() (in module types): Dynamic Type Creation. + (line 72) +* get_original_stdout() (in module test.support): test support — Utilities for the Python test suite. + (line 313) +* get_osfhandle() (in module msvcrt): File Operations. (line 58) +* get_output_charset() (email.charset.Charset method): email charset Representing character sets. + (line 111) +* get_overloads() (in module typing): Functions and decorators. + (line 286) +* get_pagesize() (in module test.support): test support — Utilities for the Python test suite. + (line 280) +* get_param() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 480) +* get_parameters() (symtable.Function method): Examining Symbol Tables. + (line 127) +* get_params() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 459) +* get_path_names() (in module sysconfig): Installation path functions. + (line 57) +* get_path() (in module sysconfig): Installation path functions. + (line 62) +* get_paths() (in module sysconfig): Installation path functions. + (line 93) +* get_payload() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 180) +* get_pid() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 6) +* get_pipe_transport() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 10) +* get_platform() (in module sysconfig): Other functions<3>. (line 11) +* get_poly() (in module turtle): Special Turtle methods. + (line 17) +* get_preferred_scheme() (in module sysconfig): Installation path functions. + (line 24) +* get_protocol_members() (in module typing): Introspection helpers. + (line 99) +* get_protocol() (asyncio.BaseTransport method): Base Transport. + (line 88) +* get_proxy_response_headers() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 134) +* get_python_version() (in module sysconfig): Other functions<3>. + (line 6) +* get_ready() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 150) +* get_referents() (in module gc): gc — Garbage Collector interface. + (line 145) +* get_referrers() (in module gc): gc — Garbage Collector interface. + (line 123) +* get_request() (socketserver.BaseServer method): Server Objects<2>. + (line 134) +* get_returncode() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 29) +* get_running_loop() (in module asyncio): Event Loop. (line 29) +* get_scheme_names() (in module sysconfig): Installation path functions. + (line 9) +* get_scheme() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 191) +* get_selection() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 110) +* get_sequences() (mailbox.MH method): MH objects. (line 56) +* get_sequences() (mailbox.MHMessage method): MHMessage objects. + (line 32) +* get_server_certificate() (in module ssl): Certificate handling. + (line 29) +* get_server() (multiprocessing.managers.BaseManager method): Managers. + (line 63) +* get_shapepoly() (in module turtle): Appearance. (line 169) +* get_source_segment() (in module ast): ast Helpers. (line 133) +* get_source() (importlib.abc.InspectLoader method): importlib abc – Abstract base classes related to import. + (line 221) +* get_source() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 420) +* get_source() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 337) +* get_source() (importlib.machinery.SourcelessFileLoader method): importlib machinery – Importers and path hooks. + (line 274) +* get_source() (zipimport.zipimporter method): zipimporter Objects. + (line 66) +* get_stack() (asyncio.Task method): Task Object. (line 121) +* get_stack() (bdb.Bdb method): bdb — Debugger framework. + (line 405) +* get_start_method() (in module multiprocessing): Miscellaneous<3>. + (line 99) +* get_starttag_text() (html.parser.HTMLParser method): HTMLParser Methods. + (line 32) +* get_stats_profile() (pstats.Stats method): The Stats Class. + (line 225) +* get_stats() (in module gc): gc — Garbage Collector interface. + (line 73) +* get_stderr() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 129) +* get_stderr() (wsgiref.simple_server.WSGIRequestHandler method): wsgiref simple_server – a simple WSGI HTTP server. + (line 101) +* get_stdin() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 123) +* get_string() (mailbox.Mailbox method): Mailbox objects. (line 175) +* get_string() (mailbox.mbox method): mbox objects. (line 50) +* get_subdir() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 47) +* get_symbols() (symtable.SymbolTable method): Examining Symbol Tables. + (line 113) +* get_tabsize() (in module curses): Functions<6>. (line 463) +* get_task_factory() (asyncio.loop method): Creating Futures and Tasks. + (line 70) +* get_terminal_size() (in module os): Querying the size of a terminal. + (line 8) +* get_terminal_size() (in module shutil): Querying the size of the output terminal. + (line 6) +* get_threshold() (in module gc): gc — Garbage Collector interface. + (line 118) +* get_token() (shlex.shlex method): shlex Objects. (line 8) +* get_tool() (in module sys.monitoring): Registering and using tools. + (line 22) +* get_traceback_limit() (in module tracemalloc): Functions<11>. + (line 22) +* get_traced_memory() (in module tracemalloc): Functions<11>. + (line 32) +* get_tracemalloc_memory() (in module tracemalloc): Functions<11>. + (line 56) +* get_type_hints() (in module typing): Introspection helpers. + (line 6) +* get_type() (symtable.SymbolTable method): Examining Symbol Tables. + (line 53) +* get_unixfrom() (email.message.EmailMessage method): email message Representing an email message. + (line 152) +* get_unixfrom() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 162) +* get_unpack_formats() (in module shutil): Archiving operations. + (line 190) +* get_unverified_chain() (ssl.SSLSocket method): SSL Sockets. + (line 222) +* get_usage() (optparse.OptionParser method): Other methods. (line 22) +* get_value() (string.Formatter method): Custom String Formatting. + (line 65) +* get_verified_chain() (ssl.SSLSocket method): SSL Sockets. (line 213) +* get_version() (optparse.OptionParser method): Printing a version string. + (line 34) +* get_visible() (mailbox.BabylMessage method): BabylMessage objects. + (line 63) +* get_wch() (curses.window method): Window Objects. (line 241) +* get_write_buffer_limits() (asyncio.WriteTransport method): Write-only Transports. + (line 23) +* get_write_buffer_size() (asyncio.WriteTransport method): Write-only Transports. + (line 19) +* GET_YIELD_FROM_ITER (opcode): Python Bytecode Instructions. + (line 218) +* get() (asyncio.Queue method): Queue. (line 39) +* get() (configparser.ConfigParser method): ConfigParser Objects. + (line 223) +* get() (contextvars.Context method): Manual Context Management. + (line 118) +* get() (contextvars.ContextVar method): Context Variables. (line 30) +* get() (dict method): Mapping Types — dict. + (line 185) +* get() (email.message.EmailMessage method): email message Representing an email message. + (line 245) +* get() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 356) +* get() (in module webbrowser): webbrowser — Convenient web-browser controller. + (line 104) +* get() (mailbox.Mailbox method): Mailbox objects. (line 148) +* get() (multiprocessing.pool.AsyncResult method): Process Pools. + (line 200) +* get() (multiprocessing.Queue method): Pipes and Queues. (line 151) +* get() (multiprocessing.SimpleQueue method): Pipes and Queues. + (line 242) +* get() (queue.Queue method): Queue Objects. (line 46) +* get() (queue.SimpleQueue method): SimpleQueue Objects. + (line 40) +* get() (tkinter.ttk.Combobox method): ttk Combobox. (line 15) +* get() (tkinter.ttk.Spinbox method): ttk Spinbox. (line 8) +* get() (types.MappingProxyType method): Standard Interpreter Types. + (line 260) +* get() (xml.etree.ElementTree.Element method): Element Objects. + (line 64) +* getacl() (imaplib.IMAP4 method): IMAP4 Objects. (line 106) +* getaddresses() (in module email.utils): email utils Miscellaneous utilities. + (line 85) +* getaddrinfo() (asyncio.loop method): DNS. (line 6) +* getaddrinfo() (in module socket): Other functions<2>. (line 17) +* getallocatedblocks() (in module sys): sys — System-specific parameters and functions. + (line 728) +* getandroidapilevel() (in module sys): sys — System-specific parameters and functions. + (line 749) +* getannotation() (imaplib.IMAP4 method): IMAP4 Objects. (line 111) +* getargvalues() (in module inspect): Classes and functions<2>. + (line 62) +* getasyncgenlocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 100) +* getasyncgenstate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 47) +* getatime() (in module os.path): os path — Common pathname manipulations. + (line 167) +* getattr_static() (in module inspect): Fetching attributes statically. + (line 16) +* getattrfunc (C type): Slot Type typedefs. (line 43) +* getAttribute() (xml.dom.Element method): Element Objects<2>. + (line 31) +* getAttributeNode() (xml.dom.Element method): Element Objects<2>. + (line 37) +* getAttributeNodeNS() (xml.dom.Element method): Element Objects<2>. + (line 47) +* getAttributeNS() (xml.dom.Element method): Element Objects<2>. + (line 41) +* getattrofunc (C type): Slot Type typedefs. (line 54) +* GetBase() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 31) +* getbegyx() (curses.window method): Window Objects. (line 225) +* getbkgd() (curses.window method): Window Objects. (line 229) +* getblocking() (socket.socket method): Socket Objects. (line 164) +* getboolean() (configparser.ConfigParser method): ConfigParser Objects. + (line 257) +* getbuffer() (io.BytesIO method): Buffered Streams. (line 21) +* getbufferproc (C type): Slot Type typedefs. (line 100) +* getByteStream() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 48) +* getcallargs() (in module inspect): Classes and functions<2>. + (line 92) +* getcanvas() (in module turtle): Settings and special methods. + (line 55) +* getch() (curses.window method): Window Objects. (line 234) +* getch() (in module msvcrt): Console I/O. (line 11) +* getCharacterStream() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 64) +* getche() (in module msvcrt): Console I/O. (line 26) +* getChild() (logging.Logger method): Logger Objects. (line 162) +* getChildren() (logging.Logger method): Logger Objects. (line 174) +* getclasstree() (in module inspect): Classes and functions<2>. + (line 6) +* getclosurevars() (in module inspect): Classes and functions<2>. + (line 123) +* getcode() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 89) +* getcode() (urllib.response.addinfourl method): urllib response — Response classes used by urllib. + (line 45) +* getColumnNumber() (xml.sax.xmlreader.Locator method): Locator Objects. + (line 8) +* getcomments() (in module inspect): Retrieving source code. + (line 18) +* getcompname() (wave.Wave_read method): Wave_read Objects. (line 41) +* getcomptype() (wave.Wave_read method): Wave_read Objects. (line 36) +* getconfig() (sqlite3.Connection method): Connection objects. + (line 647) +* getContentHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 21) +* getcontext() (in module decimal): Context objects. (line 14) +* getcoroutinelocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 92) +* getcoroutinestate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 28) +* getctime() (in module os.path): os path — Common pathname manipulations. + (line 183) +* getcwd() (in module os): Files and Directories. + (line 293) +* getcwdb() (in module os): Files and Directories. + (line 297) +* getdecoder() (in module codecs): codecs — Codec registry and base classes. + (line 116) +* getdefaultencoding() (in module sys): sys — System-specific parameters and functions. + (line 760) +* getdefaultlocale() (in module locale): locale — Internationalization services. + (line 340) +* getdefaulttimeout() (in module socket): Other functions<2>. + (line 375) +* getdlopenflags() (in module sys): sys — System-specific parameters and functions. + (line 765) +* getdoc() (in module inspect): Retrieving source code. + (line 6) +* getDOMImplementation() (in module xml.dom): Module Contents<4>. + (line 17) +* getDTDHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 30) +* getEffectiveLevel() (logging.Logger method): Logger Objects. + (line 152) +* getegid() (in module os): Process Parameters. (line 177) +* getElementsByTagName() (xml.dom.Document method): Document Objects. + (line 61) +* getElementsByTagName() (xml.dom.Element method): Element Objects<2>. + (line 14) +* getElementsByTagNameNS() (xml.dom.Document method): Document Objects. + (line 66) +* getElementsByTagNameNS() (xml.dom.Element method): Element Objects<2>. + (line 18) +* getencoder() (in module codecs): codecs — Codec registry and base classes. + (line 108) +* getencoding() (in module locale): locale — Internationalization services. + (line 403) +* getEncoding() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 32) +* getEntityResolver() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 39) +* getenv() (in module os): Process Parameters. (line 135) +* getenvb() (in module os): Process Parameters. (line 151) +* getErrorHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 50) +* geteuid() (in module os): Process Parameters. (line 185) +* getEvent() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects. + (line 11) +* getEventCategory() (logging.handlers.NTEventLogHandler method): NTEventLogHandler. + (line 43) +* getEventType() (logging.handlers.NTEventLogHandler method): NTEventLogHandler. + (line 49) +* getException() (xml.sax.SAXException method): SAXException Objects. + (line 13) +* getFeature() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 69) +* getfile() (in module inspect): Retrieving source code. + (line 27) +* getFilesToDelete() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler. + (line 115) +* getfilesystemencodeerrors() (in module sys): sys — System-specific parameters and functions. + (line 805) +* getfilesystemencoding() (in module sys): sys — System-specific parameters and functions. + (line 774) +* getfirstweekday() (calendar.Calendar method): calendar — General calendar-related functions. + (line 48) +* getfloat() (configparser.ConfigParser method): ConfigParser Objects. + (line 250) +* getfqdn() (in module socket): Other functions<2>. (line 99) +* getframeinfo() (in module inspect): The interpreter stack. + (line 123) +* getframerate() (wave.Wave_read method): Wave_read Objects. (line 28) +* getfullargspec() (in module inspect): Classes and functions<2>. + (line 17) +* getgeneratorlocals() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 72) +* getgeneratorstate() (in module inspect): Current State of Generators Coroutines and Asynchronous Generators. + (line 12) +* getgid() (in module os): Process Parameters. (line 191) +* getgrall() (in module grp): grp — The group database. + (line 58) +* getgrgid() (in module grp): grp — The group database. + (line 44) +* getgrnam() (in module grp): grp — The group database. + (line 53) +* getgrouplist() (in module os): Process Parameters. (line 200) +* getgroups() (in module os): Process Parameters. (line 211) +* getHandlerByName() (in module logging): Module-Level Functions. + (line 183) +* getHandlerNames() (in module logging): Module-Level Functions. + (line 190) +* getheader() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 24) +* getheaders() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 32) +* gethostbyaddr() (in module socket): Process Parameters. (line 552) +* gethostbyaddr() (in module socket) <1>: Other functions<2>. + (line 156) +* gethostbyname_ex() (in module socket): Other functions<2>. (line 126) +* gethostbyname() (in module socket): Other functions<2>. (line 111) +* gethostname() (in module socket): Process Parameters. (line 552) +* gethostname() (in module socket) <1>: Other functions<2>. (line 143) +* getincrementaldecoder() (in module codecs): codecs — Codec registry and base classes. + (line 132) +* getincrementalencoder() (in module codecs): codecs — Codec registry and base classes. + (line 124) +* getinfo() (zipfile.ZipFile method): ZipFile Objects. (line 112) +* getinnerframes() (in module inspect): The interpreter stack. + (line 146) +* GetInputContext() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 37) +* getint() (configparser.ConfigParser method): ConfigParser Objects. + (line 243) +* getitem() (in module operator): operator — Standard operators as functions. + (line 196) +* getiterfunc (C type): Slot Type typedefs. (line 88) +* getitimer() (in module signal): Module contents<2>. (line 436) +* getkey() (curses.window method): Window Objects. (line 249) +* GetLastError() (in module ctypes): Utility functions. (line 140) +* getLength() (xml.sax.xmlreader.Attributes method): The Attributes Interface. + (line 11) +* getLevelName() (in module logging): Module-Level Functions. + (line 150) +* getLevelNamesMapping() (in module logging): Module-Level Functions. + (line 141) +* getlimit() (sqlite3.Connection method): Connection objects. + (line 591) +* getline() (in module linecache): linecache — Random access to text lines. + (line 23) +* getLineNumber() (xml.sax.xmlreader.Locator method): Locator Objects. + (line 12) +* getloadavg() (in module os): Miscellaneous System Information. + (line 52) +* getlocale() (in module locale): locale — Internationalization services. + (line 367) +* getLogger() (in module logging): Module-Level Functions. + (line 9) +* getLoggerClass() (in module logging): Module-Level Functions. + (line 23) +* getlogin() (in module os): Process Parameters. (line 234) +* getLogRecordFactory() (in module logging): Module-Level Functions. + (line 34) +* getMandatoryRelease() (__future__._Feature method): Module Contents<5>. + (line 74) +* getmark() (wave.Wave_read method): Wave_read Objects. (line 72) +* getmarkers() (wave.Wave_read method): Wave_read Objects. (line 64) +* getmaxyx() (curses.window method): Window Objects. (line 256) +* getmember() (tarfile.TarFile method): TarFile Objects. (line 103) +* getmembers_static() (in module inspect): Types and members. + (line 323) +* getmembers() (in module inspect): Types and members. (line 310) +* getmembers() (tarfile.TarFile method): TarFile Objects. (line 111) +* getMessage() (logging.LogRecord method): LogRecord Objects. + (line 64) +* getMessage() (xml.sax.SAXException method): SAXException Objects. + (line 9) +* getMessageID() (logging.handlers.NTEventLogHandler method): NTEventLogHandler. + (line 60) +* getmodule() (in module inspect): Retrieving source code. + (line 33) +* getmodulename() (in module inspect): Types and members. (line 339) +* getmouse() (in module curses): Functions<6>. (line 145) +* getmro() (in module inspect): Classes and functions<2>. + (line 84) +* getmtime() (in module os.path): os path — Common pathname manipulations. + (line 174) +* getName() (threading.Thread method): Thread objects. (line 159) +* getNameByQName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface. + (line 16) +* getnameinfo() (asyncio.loop method): DNS. (line 11) +* getnameinfo() (in module socket): Other functions<2>. (line 172) +* getnames() (tarfile.TarFile method): TarFile Objects. (line 117) +* getNames() (xml.sax.xmlreader.Attributes method): The Attributes Interface. + (line 15) +* getnchannels() (wave.Wave_read method): Wave_read Objects. (line 19) +* getnframes() (wave.Wave_read method): Wave_read Objects. (line 32) +* getnode() (in module uuid): uuid — UUID objects according to RFC 4122. + (line 161) +* getobjects() (in module sys): sys — System-specific parameters and functions. + (line 914) +* getopt() (in module getopt): getopt — C-style parser for command line options. + (line 33) +* GetoptError: getopt — C-style parser for command line options. + (line 82) +* getOptionalRelease() (__future__._Feature method): Module Contents<5>. + (line 69) +* getouterframes() (in module inspect): The interpreter stack. + (line 131) +* getoutput() (in module subprocess): Legacy Shell Invocation Functions. + (line 45) +* getpagesize() (in module resource): Resource Usage. (line 101) +* getparams() (wave.Wave_read method): Wave_read Objects. (line 46) +* getparyx() (curses.window method): Window Objects. (line 260) +* getpass() (in module getpass): getpass — Portable password input. + (line 17) +* GetPassWarning: getpass — Portable password input. + (line 34) +* getpeercert() (ssl.SSLSocket method): SSL Sockets. (line 144) +* getpeername() (socket.socket method): Socket Objects. (line 135) +* getpen() (in module turtle): Special Turtle methods. + (line 40) +* getpgid() (in module os): Process Parameters. (line 245) +* getpgrp() (in module os): Process Parameters. (line 253) +* getpid() (in module os): Process Parameters. (line 259) +* getpos() (html.parser.HTMLParser method): HTMLParser Methods. + (line 28) +* getppid() (in module os): Process Parameters. (line 266) +* getpreferredencoding() (in module locale): locale — Internationalization services. + (line 379) +* getpriority() (in module os): Process Parameters. (line 277) +* getprofile() (in module sys): sys — System-specific parameters and functions. + (line 939) +* getprofile() (in module threading): Reference<2>. (line 152) +* getProperty() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 83) +* getprotobyname() (in module socket): Other functions<2>. (line 192) +* getproxies() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 168) +* getPublicId() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 10) +* getPublicId() (xml.sax.xmlreader.Locator method): Locator Objects. + (line 16) +* getpwall() (in module pwd): pwd — The password database. + (line 63) +* getpwnam() (in module pwd): pwd — The password database. + (line 59) +* getpwuid() (in module pwd): pwd — The password database. + (line 55) +* getQNameByName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface. + (line 20) +* getQNames() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface. + (line 24) +* getquota() (imaplib.IMAP4 method): IMAP4 Objects. (line 116) +* getquotaroot() (imaplib.IMAP4 method): IMAP4 Objects. (line 121) +* getrandbits() (in module random): Functions for integers. + (line 37) +* getrandbits() (random.Random method): Alternative Generator. + (line 41) +* getrandom() (in module os): Random numbers<2>. (line 6) +* getreader() (in module codecs): codecs — Codec registry and base classes. + (line 140) +* getrecursionlimit() (in module sys): sys — System-specific parameters and functions. + (line 846) +* getrefcount() (in module sys): sys — System-specific parameters and functions. + (line 830) +* GetReparseDeferralEnabled() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 111) +* getresgid() (in module os): Process Parameters. (line 324) +* getresponse() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 75) +* getresuid() (in module os): Process Parameters. (line 315) +* getrlimit() (in module resource): Resource Limits. (line 24) +* getroot() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 36) +* getrusage() (in module resource): Resource Usage. (line 8) +* getsampwidth() (wave.Wave_read method): Wave_read Objects. (line 24) +* getscreen() (in module turtle): Special Turtle methods. + (line 51) +* getservbyname() (in module socket): Other functions<2>. (line 203) +* getservbyport() (in module socket): Other functions<2>. (line 214) +* GetSetDescriptorType (in module types): Standard Interpreter Types. + (line 200) +* getshapes() (in module turtle): Settings and special methods. + (line 64) +* getsid() (in module os): Process Parameters. (line 510) +* getsignal() (in module signal): Module contents<2>. (line 284) +* getsitepackages() (in module site): Module contents<5>. (line 58) +* getsize() (in module os.path): os path — Common pathname manipulations. + (line 194) +* getsizeof() (in module sys): sys — System-specific parameters and functions. + (line 853) +* getsockname() (socket.socket method): Socket Objects. (line 143) +* getsockopt() (socket.socket method): Socket Objects. (line 149) +* getsource() (in module inspect): Retrieving source code. + (line 59) +* getsourcefile() (in module inspect): Retrieving source code. + (line 38) +* getsourcelines() (in module inspect): Retrieving source code. + (line 45) +* getstate() (codecs.IncrementalDecoder method): IncrementalDecoder Objects. + (line 44) +* getstate() (codecs.IncrementalEncoder method): IncrementalEncoder Objects. + (line 42) +* getstate() (in module random): Bookkeeping functions. + (line 32) +* getstate() (random.Random method): Alternative Generator. + (line 23) +* getstatusoutput() (in module subprocess): Legacy Shell Invocation Functions. + (line 11) +* getstr() (curses.window method): Window Objects. (line 266) +* getSubject() (logging.handlers.SMTPHandler method): SMTPHandler. + (line 39) +* getswitchinterval() (in module sys): sys — System-specific parameters and functions. + (line 875) +* getSystemId() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 18) +* getSystemId() (xml.sax.xmlreader.Locator method): Locator Objects. + (line 20) +* getsyx() (in module curses): Functions<6>. (line 163) +* gettarinfo() (tarfile.TarFile method): TarFile Objects. (line 303) +* gettempdir() (in module tempfile): tempfile — Generate temporary files and directories. + (line 318) +* gettempdirb() (in module tempfile): tempfile — Generate temporary files and directories. + (line 350) +* gettempprefix() (in module tempfile): tempfile — Generate temporary files and directories. + (line 356) +* gettempprefixb() (in module tempfile): tempfile — Generate temporary files and directories. + (line 361) +* getter (C type): Defining Getters and Setters. + (line 33) +* getTestCaseNames() (unittest.TestLoader method): Loading and running tests. + (line 111) +* gettext() (gettext.GNUTranslations method): The GNUTranslations class. + (line 38) +* gettext() (gettext.NullTranslations method): The NullTranslations class. + (line 35) +* gettext() (in module gettext): GNU gettext API. (line 32) +* gettext() (in module locale): Access to message catalogs. + (line 6) +* gettimeout() (socket.socket method): Socket Objects. (line 173) +* gettrace() (in module sys): sys — System-specific parameters and functions. + (line 943) +* gettrace() (in module threading): Reference<2>. (line 130) +* getturtle() (in module turtle): Special Turtle methods. + (line 40) +* getType() (xml.sax.xmlreader.Attributes method): The Attributes Interface. + (line 19) +* getuid() (in module os): Process Parameters. (line 333) +* getunicodeinternedsize() (in module sys): sys — System-specific parameters and functions. + (line 743) +* geturl() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 79) +* geturl() (urllib.parse.urllib.parse.SplitResult method): Structured Parse Results. + (line 12) +* geturl() (urllib.response.addinfourl method): urllib response — Response classes used by urllib. + (line 30) +* getuser() (in module getpass): getpass — Portable password input. + (line 39) +* getuserbase() (in module site): Module contents<5>. (line 64) +* getusersitepackages() (in module site): Module contents<5>. + (line 72) +* getvalue() (io.BytesIO method): Buffered Streams. (line 38) +* getvalue() (io.StringIO method): Text I/O<2>. (line 265) +* getValue() (xml.sax.xmlreader.Attributes method): The Attributes Interface. + (line 24) +* getValueByQName() (xml.sax.xmlreader.AttributesNS method): The AttributesNS Interface. + (line 12) +* getwch() (in module msvcrt): Console I/O. (line 21) +* getwche() (in module msvcrt): Console I/O. (line 31) +* getweakrefcount() (in module weakref): weakref — Weak references. + (line 156) +* getweakrefs() (in module weakref): weakref — Weak references. + (line 161) +* getwelcome() (ftplib.FTP method): FTP objects. (line 121) +* getwelcome() (poplib.POP3 method): POP3 Objects. (line 20) +* getwin() (in module curses): Functions<6>. (line 169) +* getwindowsversion() (in module sys): sys — System-specific parameters and functions. + (line 954) +* getwriter() (in module codecs): codecs — Codec registry and base classes. + (line 148) +* getxattr() (in module os): Linux extended attributes. + (line 10) +* getyx() (curses.window method): Window Objects. (line 277) +* gid (tarfile.TarInfo attribute): TarInfo Objects. (line 113) +* GIL: Glossary. (line 668) +* glob() (in module glob): glob — Unix style pathname pattern expansion. + (line 29) +* glob() (pathlib.Path method): Reading directories. + (line 30) +* Global (class in ast): Function and class definitions. + (line 145) +* global interpreter lock: Thread State and the Global Interpreter Lock. + (line 6) +* global interpreter lock <1>: Glossary. (line 672) +* global_enum() (in module enum): Utilities and Decorators. + (line 92) +* global; name; binding: The global statement. + (line 6) +* global; namespace: Special read-only attributes. + (line 6) +* globs (doctest.DocTest attribute): DocTest Objects. (line 22) +* gmtime() (in module time): Functions<5>. (line 139) +* gname (tarfile.TarInfo attribute): TarInfo Objects. (line 129) +* GNOME: The Catalog constructor. + (line 6) +* GNU_FORMAT (in module tarfile): tarfile — Read and write tar archive files. + (line 331) +* gnu_getopt() (in module getopt): getopt — C-style parser for command line options. + (line 70) +* GNUTranslations (class in gettext): The GNUTranslations class. + (line 33) +* GNUTYPE_LONGLINK (in module tarfile): tarfile — Read and write tar archive files. + (line 315) +* GNUTYPE_LONGNAME (in module tarfile): tarfile — Read and write tar archive files. + (line 311) +* GNUTYPE_SPARSE (in module tarfile): tarfile — Read and write tar archive files. + (line 319) +* go() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 114) +* got (doctest.DocTestFailure attribute): Debugging. (line 204) +* goto() (in module turtle): Turtle motion. (line 74) +* grammar: Notation. (line 6) +* grantpt() (in module os): File Descriptor Operations. + (line 248) +* Graphical User Interface: Graphical User Interfaces with Tk. + (line 6) +* GREATER (in module token): token — Constants used with Python parse trees. + (line 218) +* GREATEREQUAL (in module token): token — Constants used with Python parse trees. + (line 245) +* Greenwich Mean Time: time — Time access and conversions. + (line 39) +* GRND_NONBLOCK (in module os): Random numbers<2>. (line 76) +* GRND_RANDOM (in module os): Random numbers<2>. (line 89) +* Group (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 457) +* group() (pathlib.Path method): Permissions and ownership. + (line 21) +* group() (re.Match method): Match Objects. (line 36) +* groupby() (in module itertools): Itertool Functions. (line 306) +* groupdict() (re.Match method): Match Objects. (line 136) +* groupindex (re.Pattern attribute): Regular Expression Objects. + (line 118) +* grouping: Indentation. (line 6) +* groups (email.headerregistry.AddressHeader attribute): email headerregistry Custom Header Objects. + (line 188) +* groups (re.Pattern attribute): Regular Expression Objects. + (line 114) +* groups() (re.Match method): Match Objects. (line 113) +* GS (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 112) +* Gt (class in ast): Expressions<2>. (line 108) +* gt() (in module operator): operator — Standard operators as functions. + (line 24) +* GtE (class in ast): Expressions<2>. (line 108) +* guard: Guards. (line 6) +* guess_all_extensions() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 64) +* guess_all_extensions() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 72) +* guess_extension() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 76) +* guess_extension() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 55) +* guess_file_type() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 55) +* guess_file_type() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 65) +* guess_scheme() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 14) +* guess_type() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 24) +* guess_type() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 60) +* GUI: Graphical User Interfaces with Tk. + (line 6) +* gzip command line option; -best: Command line options. + (line 14) +* gzip command line option; -d: Command line options. + (line 18) +* gzip command line option; -decompress: Command line options. + (line 18) +* gzip command line option; -fast: Command line options. + (line 10) +* gzip command line option; -h: Command line options. + (line 22) +* gzip command line option; -help: Command line options. + (line 22) +* gzip command line option; file: Command line options. + (line 6) +* GzipFile (class in gzip): gzip — Support for gzip files. + (line 71) +* halfdelay() (in module curses): Functions<6>. (line 211) +* Handle (class in asyncio): Callback Handles. (line 6) +* handle an exception: Exceptions<2>. (line 6) +* handle_charref() (html.parser.HTMLParser method): HTMLParser Methods. + (line 93) +* handle_comment() (html.parser.HTMLParser method): HTMLParser Methods. + (line 102) +* handle_data() (html.parser.HTMLParser method): HTMLParser Methods. + (line 80) +* handle_decl() (html.parser.HTMLParser method): HTMLParser Methods. + (line 115) +* handle_defect() (email.policy.Policy method): email policy Policy Objects. + (line 235) +* handle_endtag() (html.parser.HTMLParser method): HTMLParser Methods. + (line 64) +* handle_entityref() (html.parser.HTMLParser method): HTMLParser Methods. + (line 86) +* handle_error() (socketserver.BaseServer method): Server Objects<2>. + (line 140) +* handle_expect_100() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 205) +* handle_one_request() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 199) +* handle_pi() (html.parser.HTMLParser method): HTMLParser Methods. + (line 123) +* handle_request() (socketserver.BaseServer method): Server Objects<2>. + (line 21) +* handle_request() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler. + (line 50) +* handle_startendtag() (html.parser.HTMLParser method): HTMLParser Methods. + (line 71) +* handle_starttag() (html.parser.HTMLParser method): HTMLParser Methods. + (line 45) +* handle_timeout() (socketserver.BaseServer method): Server Objects<2>. + (line 150) +* handle() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 192) +* handle() (logging.Handler method): Handler Objects. (line 83) +* handle() (logging.handlers.QueueListener method): QueueListener. + (line 67) +* handle() (logging.Logger method): Logger Objects. (line 365) +* handle() (logging.NullHandler method): NullHandler. (line 20) +* handle() (socketserver.BaseRequestHandler method): Request Handler Objects. + (line 20) +* handle() (wsgiref.simple_server.WSGIRequestHandler method): wsgiref simple_server – a simple WSGI HTTP server. + (line 106) +* handleError() (logging.Handler method): Handler Objects. (line 90) +* handleError() (logging.handlers.SocketHandler method): SocketHandler. + (line 33) +* Handler (class in logging): Handler Objects. (line 11) +* Handlers (class in signal): Module contents<2>. (line 24) +* handlers (logging.Logger attribute): Logger Objects. (line 87) +* hardlink_to() (pathlib.Path method): Creating files and directories. + (line 73) +* harmonic_mean() (in module statistics): Function details. (line 97) +* HAS_ALPN (in module ssl): Constants<9>. (line 382) +* has_children() (symtable.SymbolTable method): Examining Symbol Tables. + (line 98) +* has_colors() (in module curses): Functions<6>. (line 176) +* has_default() (typing.ParamSpec method): Building generic types and type aliases. + (line 434) +* has_default() (typing.TypeVar method): Building generic types and type aliases. + (line 201) +* has_default() (typing.TypeVarTuple method): Building generic types and type aliases. + (line 333) +* has_dualstack_ipv6() (in module socket): Creating sockets. (line 152) +* HAS_ECDH (in module ssl): Constants<9>. (line 398) +* has_extended_color_support() (in module curses): Functions<6>. + (line 181) +* has_extn() (smtplib.SMTP method): SMTP Objects. (line 85) +* has_header() (csv.Sniffer method): Module Contents<3>. (line 239) +* has_header() (urllib.request.Request method): Request Objects. + (line 95) +* has_ic() (in module curses): Functions<6>. (line 192) +* has_il() (in module curses): Functions<6>. (line 199) +* has_ipv6 (in module socket): Constants<8>. (line 293) +* has_key() (in module curses): Functions<6>. (line 206) +* has_location (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 435) +* HAS_NEVER_CHECK_COMMON_NAME (in module ssl): Constants<9>. (line 390) +* has_nonstandard_attr() (http.cookiejar.Cookie method): Cookie Objects<2>. + (line 98) +* HAS_NPN (in module ssl): Constants<9>. (line 413) +* has_option() (configparser.ConfigParser method): ConfigParser Objects. + (line 141) +* has_option() (optparse.OptionParser method): Querying and manipulating your option parser. + (line 42) +* HAS_PSK (in module ssl): Constants<9>. (line 465) +* has_section() (configparser.ConfigParser method): ConfigParser Objects. + (line 132) +* HAS_SNI (in module ssl): Constants<9>. (line 406) +* HAS_SSLv2 (in module ssl): Constants<9>. (line 423) +* HAS_SSLv3 (in module ssl): Constants<9>. (line 430) +* has_ticket (ssl.SSLSession attribute): SSL session. (line 20) +* HAS_TLSv1 (in module ssl): Constants<9>. (line 437) +* HAS_TLSv1_1 (in module ssl): Constants<9>. (line 444) +* HAS_TLSv1_2 (in module ssl): Constants<9>. (line 451) +* HAS_TLSv1_3 (in module ssl): Constants<9>. (line 458) +* hasarg (in module dis): Opcode collections. (line 25) +* hasAttribute() (xml.dom.Element method): Element Objects<2>. + (line 22) +* hasAttributeNS() (xml.dom.Element method): Element Objects<2>. + (line 26) +* hasAttributes() (xml.dom.Node method): Node Objects. (line 94) +* hasChildNodes() (xml.dom.Node method): Node Objects. (line 98) +* hascompare (in module dis): Opcode collections. (line 58) +* hasconst (in module dis): Opcode collections. (line 31) +* hasexc (in module dis): Opcode collections. (line 62) +* hasFeature() (xml.dom.DOMImplementation method): DOMImplementation Objects. + (line 11) +* hasfree (in module dis): Opcode collections. (line 35) +* hash character: Comments. (line 6) +* hash_bits (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1062) +* hash_info (in module sys): sys — System-specific parameters and functions. + (line 1031) +* hash_randomization (sys.flags attribute): sys — System-specific parameters and functions. + (line 565) +* hash-based pyc: Glossary. (line 696) +* hash.block_size (in module hashlib): Hash Objects. (line 13) +* hash.digest_size (in module hashlib): Hash Objects. (line 9) +* hashable: Dictionary displays. + (line 37) +* hashable <1>: Glossary. (line 702) +* Hashable (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 11) +* Hashable (class in typing): Aliases to other ABCs in collections abc. + (line 53) +* hasHandlers() (logging.Logger method): Logger Objects. (line 380) +* hashfunc (C type): Slot Type typedefs. (line 79) +* hasjabs (in module dis): Opcode collections. (line 75) +* hasjrel (in module dis): Opcode collections. (line 68) +* hasjump (in module dis): Opcode collections. (line 47) +* haslocal (in module dis): Opcode collections. (line 54) +* hasname (in module dis): Opcode collections. (line 43) +* HAVE_ARGUMENT (opcode): Python Bytecode Instructions. + (line 1272) +* HAVE_CONTEXTVAR (in module decimal): Constants<4>. (line 32) +* HAVE_DOCSTRINGS (in module test.support): test support — Utilities for the Python test suite. + (line 163) +* HAVE_THREADS (in module decimal): Constants<4>. (line 25) +* HCI_DATA_DIR (in module socket): Constants<8>. (line 306) +* HCI_FILTER (in module socket): Constants<8>. (line 306) +* HCI_TIME_STAMP (in module socket): Constants<8>. (line 306) +* Header (class in email.header): email header Internationalized headers. + (line 60) +* header_encode_lines() (email.charset.Charset method): email charset Representing character sets. + (line 125) +* header_encode() (email.charset.Charset method): email charset Representing character sets. + (line 118) +* header_encoding (email.charset.Charset attribute): email charset Representing character sets. + (line 59) +* header_factory (email.policy.EmailPolicy attribute): email policy Policy Objects. + (line 408) +* header_fetch_parse() (email.policy.Compat32 method): email policy Policy Objects. + (line 594) +* header_fetch_parse() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 458) +* header_fetch_parse() (email.policy.Policy method): email policy Policy Objects. + (line 319) +* header_items() (urllib.request.Request method): Request Objects. + (line 126) +* header_max_count() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 435) +* header_max_count() (email.policy.Policy method): email policy Policy Objects. + (line 260) +* header_offset (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 132) +* header_source_parse() (email.policy.Compat32 method): email policy Policy Objects. + (line 582) +* header_source_parse() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 441) +* header_source_parse() (email.policy.Policy method): email policy Policy Objects. + (line 282) +* header_store_parse() (email.policy.Compat32 method): email policy Policy Objects. + (line 590) +* header_store_parse() (email.policy.EmailPolicy method): email policy Policy Objects. + (line 449) +* header_store_parse() (email.policy.Policy method): email policy Policy Objects. + (line 303) +* HeaderDefect: email errors Exception and Defect classes. + (line 60) +* HeaderError: tarfile — Read and write tar archive files. + (line 225) +* HeaderParseError: email errors Exception and Defect classes. + (line 26) +* HeaderParser (class in email.parser): Parser API. (line 107) +* HeaderRegistry (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 299) +* Headers (class in wsgiref.headers): wsgiref headers – WSGI response header tools. + (line 9) +* headers (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 56) +* headers (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 109) +* headers (urllib.error.HTTPError attribute): urllib error — Exception classes raised by urllib request. + (line 55) +* headers (urllib.response.addinfourl attribute): urllib response — Response classes used by urllib. + (line 19) +* headers (xmlrpc.client.ProtocolError attribute): ProtocolError Objects. + (line 25) +* HeaderWriteError: email errors Exception and Defect classes. + (line 50) +* heading() (in module turtle): Tell Turtle’s state. + (line 58) +* heading() (tkinter.ttk.Treeview method): ttk Treeview. (line 99) +* heapify() (in module heapq): heapq — Heap queue algorithm. + (line 59) +* heapmin() (in module msvcrt): Other Functions. (line 6) +* heappop() (in module heapq): heapq — Heap queue algorithm. + (line 45) +* heappush() (in module heapq): heapq — Heap queue algorithm. + (line 40) +* heappushpop() (in module heapq): heapq — Heap queue algorithm. + (line 52) +* heapreplace() (in module heapq): heapq — Heap queue algorithm. + (line 63) +* helo() (smtplib.SMTP method): SMTP Objects. (line 47) +* help (optparse.Option attribute): Option attributes. (line 80) +* help (pdb command): Debugger Commands. (line 73) +* help; online: pydoc — Documentation generator and online help system. + (line 8) +* herror: Exceptions<15>. (line 13) +* hex (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 128) +* hex() (bytearray method): Bytearray Objects. (line 52) +* hex() (bytes method): Bytes Objects. (line 78) +* hex() (float method): Additional Methods on Float. + (line 33) +* hex() (memoryview method): Memory Views. (line 188) +* hexadecimal literal: Numeric literals. (line 6) +* hexadecimal; literals: Numeric Types — int float complex. + (line 19) +* hexdigest() (hashlib.hash method): Hash Objects. (line 44) +* hexdigest() (hashlib.shake method): SHAKE variable length digests. + (line 21) +* hexdigest() (hmac.HMAC method): hmac — Keyed-Hashing for Message Authentication. + (line 71) +* hexdigits (in module string): String constants. (line 28) +* hexlify() (in module binascii): binascii — Convert between binary and ASCII. + (line 114) +* hexversion (in module sys): sys — System-specific parameters and functions. + (line 1075) +* hidden() (curses.panel.Panel method): Panel Objects. (line 25) +* hide_cookie2 (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects. + (line 76) +* hide() (curses.panel.Panel method): Panel Objects. (line 30) +* hide() (tkinter.ttk.Notebook method): ttk Notebook. (line 23) +* hideturtle() (in module turtle): Visibility. (line 6) +* HierarchyRequestErr: Exceptions<20>. (line 29) +* HIGH_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 82) +* HIGHEST_PROTOCOL (in module pickle): Module Interface. (line 14) +* hits (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 124) +* HKEY_CLASSES_ROOT (in module winreg): HKEY_* Constants. (line 6) +* HKEY_CURRENT_CONFIG (in module winreg): HKEY_* Constants. (line 38) +* HKEY_CURRENT_USER (in module winreg): HKEY_* Constants. (line 12) +* HKEY_DYN_DATA (in module winreg): HKEY_* Constants. (line 43) +* HKEY_LOCAL_MACHINE (in module winreg): HKEY_* Constants. (line 19) +* HKEY_PERFORMANCE_DATA (in module winreg): HKEY_* Constants. + (line 31) +* HKEY_USERS (in module winreg): HKEY_* Constants. (line 25) +* hline() (curses.window method): Window Objects. (line 282) +* hls_to_rgb() (in module colorsys): colorsys — Conversions between color systems. + (line 40) +* HOME: os path<5>. (line 15) +* HOME <1>: Changes in the Python API<5>. + (line 117) +* HOME <2>: Windows<43>. (line 15) +* HOME <3>: Windows<43>. (line 18) +* HOME <4>: os path — Common pathname manipulations. + (line 136) +* HOME <5>: os path — Common pathname manipulations. + (line 153) +* HOME <6>: Tkinter Modules. (line 66) +* home() (in module turtle): Turtle motion. (line 195) +* home() (pathlib.Path class method): Expanding and resolving paths. + (line 6) +* HOMEDRIVE: os path — Common pathname manipulations. + (line 143) +* HOMEPATH: os path — Common pathname manipulations. + (line 143) +* hook_compressed() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 196) +* hook_encoded() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 216) +* hooks; import: Import hooks. (line 6) +* hooks; meta: Import hooks. (line 6) +* hooks; path: Import hooks. (line 6) +* host (urllib.request.Request attribute): Request Objects. (line 25) +* hostmask (ipaddress.IPv4Network attribute): Network objects. + (line 97) +* hostmask (ipaddress.IPv6Network attribute): Network objects. + (line 313) +* hostname_checks_common_name (ssl.SSLContext attribute): SSL Contexts. + (line 614) +* hosts (netrc.netrc attribute): netrc Objects. (line 23) +* hosts() (ipaddress.IPv4Network method): Network objects. (line 136) +* hosts() (ipaddress.IPv6Network method): Network objects. (line 331) +* hour (datetime.datetime attribute): datetime Objects. (line 318) +* hour (datetime.time attribute): time Objects. (line 50) +* HRESULT (class in ctypes): Fundamental data types<2>. + (line 213) +* hStdError (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 42) +* hStdInput (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 27) +* hStdOutput (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 35) +* hsv_to_rgb() (in module colorsys): colorsys — Conversions between color systems. + (line 48) +* HT (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 49) +* ht() (in module turtle): Visibility. (line 6) +* HTML: html parser — Simple HTML and XHTML parser. + (line 8) +* HTML <1>: urllib request Restrictions. + (line 29) +* html5 (in module html.entities): html entities — Definitions of HTML general entities. + (line 14) +* HTMLCalendar (class in calendar): calendar — General calendar-related functions. + (line 223) +* HtmlDiff (class in difflib): difflib — Helpers for computing deltas. + (line 82) +* HTMLParser (class in html.parser): html parser — Simple HTML and XHTML parser. + (line 14) +* htonl() (in module socket): Other functions<2>. (line 242) +* htons() (in module socket): Other functions<2>. (line 249) +* HTTP (in module email.policy): email policy Policy Objects. + (line 525) +* http_error_301() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 35) +* http_error_302() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 42) +* http_error_303() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 48) +* http_error_307() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 54) +* http_error_308() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 61) +* http_error_401() (urllib.request.HTTPBasicAuthHandler method): HTTPBasicAuthHandler Objects. + (line 6) +* http_error_401() (urllib.request.HTTPDigestAuthHandler method): HTTPDigestAuthHandler Objects. + (line 6) +* http_error_407() (urllib.request.ProxyBasicAuthHandler method): ProxyBasicAuthHandler Objects. + (line 6) +* http_error_407() (urllib.request.ProxyDigestAuthHandler method): ProxyDigestAuthHandler Objects. + (line 6) +* http_error_auth_reqed() (urllib.request.AbstractBasicAuthHandler method): AbstractBasicAuthHandler Objects. + (line 6) +* http_error_auth_reqed() (urllib.request.AbstractDigestAuthHandler method): AbstractDigestAuthHandler Objects. + (line 6) +* http_error_default() (urllib.request.BaseHandler method): BaseHandler Objects. + (line 66) +* http_open() (urllib.request.HTTPHandler method): HTTPHandler Objects. + (line 6) +* HTTP_PORT (in module http.client): http client — HTTP protocol client. + (line 200) +* http_response() (urllib.request.HTTPErrorProcessor method): HTTPErrorProcessor Objects. + (line 6) +* http_version (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 306) +* HTTP; http (standard module): http — HTTP modules. + (line 8) +* HTTP; http.client (standard module): http client — HTTP protocol client. + (line 8) +* HTTP; protocol: urllib request Restrictions. + (line 6) +* HTTP; protocol <1>: urllib request Restrictions. + (line 29) +* HTTP; protocol <2>: http — HTTP modules. + (line 8) +* HTTP; protocol <3>: http client — HTTP protocol client. + (line 8) +* HTTP; protocol <4>: http server — HTTP servers. + (line 8) +* http.server command line option; -b: Command-line interface<2>. + (line 21) +* http.server command line option; -bind: Command-line interface<2>. + (line 21) +* http.server command line option; -cgi: Command-line interface<2>. + (line 54) +* http.server command line option; -d: Command-line interface<2>. + (line 34) +* http.server command line option; -directory: Command-line interface<2>. + (line 34) +* http.server command line option; -p: Command-line interface<2>. + (line 44) +* http.server command line option; -protocol: Command-line interface<2>. + (line 44) +* http.server command line option; port: Command-line interface<2>. + (line 14) +* http.server; security: Security considerations<3>. + (line 6) +* HTTPBasicAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 363) +* HTTPConnection (class in http.client): http client — HTTP protocol client. + (line 31) +* HTTPCookieProcessor (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 294) +* httpd: http server — HTTP servers. + (line 8) +* HTTPDefaultErrorHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 285) +* HTTPDigestAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 387) +* HTTPError: urllib error — Exception classes raised by urllib request. + (line 31) +* HTTPErrorProcessor (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 447) +* HTTPException: http client — HTTP protocol client. + (line 131) +* HTTPHandler (class in logging.handlers): HTTPHandler. (line 10) +* HTTPHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 411) +* HTTPMessage (class in http.client): HTTPMessage Objects. + (line 6) +* HTTPMethod (class in http): HTTP status category. + (line 38) +* httponly (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* HTTPPasswordMgr (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 320) +* HTTPPasswordMgrWithDefaultRealm (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 324) +* HTTPPasswordMgrWithPriorAuth (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 330) +* HTTPRedirectHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 290) +* HTTPResponse (class in http.client): http client — HTTP protocol client. + (line 99) +* https_open() (urllib.request.HTTPSHandler method): HTTPSHandler Objects. + (line 6) +* HTTPS_PORT (in module http.client): http client — HTTP protocol client. + (line 204) +* https_response() (urllib.request.HTTPErrorProcessor method): HTTPErrorProcessor Objects. + (line 18) +* HTTPSConnection (class in http.client): http client — HTTP protocol client. + (line 62) +* HTTPServer (class in http.server): http server — HTTP servers. + (line 30) +* HTTPSHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 415) +* HTTPStatus (class in http): http — HTTP modules. + (line 27) +* HV_GUID_BROADCAST (in module socket): Constants<8>. (line 344) +* HV_GUID_CHILDREN (in module socket): Constants<8>. (line 344) +* HV_GUID_LOOPBACK (in module socket): Constants<8>. (line 344) +* HV_GUID_PARENT (in module socket): Constants<8>. (line 344) +* HV_GUID_WILDCARD (in module socket): Constants<8>. (line 344) +* HV_GUID_ZERO (in module socket): Constants<8>. (line 344) +* HV_PROTOCOL_RAW (in module socket): Constants<8>. (line 344) +* HVSOCKET_ADDRESS_FLAG_PASSTHRU (in module socket): Constants<8>. + (line 344) +* HVSOCKET_CONNECT_TIMEOUT (in module socket): Constants<8>. (line 344) +* HVSOCKET_CONNECT_TIMEOUT_MAX (in module socket): Constants<8>. + (line 344) +* HVSOCKET_CONNECTED_SUSPEND (in module socket): Constants<8>. + (line 344) +* hypot() (in module math): Summation and product functions. + (line 33) +* I (in module re): Flags. (line 38) +* I/O control; buffering: Built-in Functions. (line 1470) +* I/O control; buffering <1>: Socket Objects. (line 212) +* iadd() (in module operator): In-place Operators. (line 36) +* iand() (in module operator): In-place Operators. (line 41) +* iconcat() (in module operator): In-place Operators. (line 46) +* id (ssl.SSLSession attribute): SSL session. (line 12) +* id() (unittest.TestCase method): Test cases. (line 752) +* idcok() (curses.window method): Window Objects. (line 289) +* ident (select.kevent attribute): Kevent Objects. (line 8) +* ident (threading.Thread attribute): Thread objects. (line 167) +* identchars (cmd.Cmd attribute): Cmd Objects. (line 135) +* identifier: Identifiers and keywords. + (line 6) +* identifier <1>: Identifiers Names. (line 6) +* identify_column() (tkinter.ttk.Treeview method): ttk Treeview. + (line 143) +* identify_element() (tkinter.ttk.Treeview method): ttk Treeview. + (line 172) +* identify_region() (tkinter.ttk.Treeview method): ttk Treeview. + (line 150) +* identify_row() (tkinter.ttk.Treeview method): ttk Treeview. + (line 139) +* identify() (tkinter.ttk.Notebook method): ttk Notebook. (line 32) +* identify() (tkinter.ttk.Treeview method): ttk Treeview. (line 133) +* identify() (tkinter.ttk.Widget method): ttk Widget. (line 11) +* identity of an object: Objects values and types. + (line 11) +* identity; test: Membership test operations. + (line 39) +* IDLE: IDLE — Python editor and shell<2>. + (line 8) +* IDLE <1>: Glossary. (line 722) +* idle command line option; -: Command line usage. (line 49) +* idle command line option; -c: Command line usage. (line 13) +* idle command line option; -d: Command line usage. (line 19) +* idle command line option; -e: Command line usage. (line 23) +* idle command line option; -h: Command line usage. (line 27) +* idle command line option; -i: Command line usage. (line 31) +* idle command line option; -r: Command line usage. (line 35) +* idle command line option; -s: Command line usage. (line 39) +* idle command line option; -t: Command line usage. (line 45) +* IDLE_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 89) +* IDLESTARTUP: IDLE<39>. (line 176) +* IDLESTARTUP <1>: IDLE<43>. (line 9) +* IDLESTARTUP <2>: IDLE<49>. (line 9) +* IDLESTARTUP <3>: Startup and Code Execution. + (line 7) +* IDLESTARTUP <4>: Command line usage. (line 41) +* idlok() (curses.window method): Window Objects. (line 297) +* If (class in ast): Control flow. (line 9) +* if_indextoname() (in module socket): Other functions<2>. (line 444) +* if_nameindex() (in module socket): Other functions<2>. (line 401) +* if_nametoindex() (in module socket): Other functions<2>. (line 426) +* if; conditional expression: Conditional expressions. + (line 6) +* if; in comprehensions: Displays for lists sets and dictionaries. + (line 14) +* IfExp (class in ast): Expressions<2>. (line 157) +* ifloordiv() (in module operator): In-place Operators. (line 52) +* iglob() (in module glob): glob — Unix style pathname pattern expansion. + (line 79) +* ignorableWhitespace() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 150) +* ignore (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 120) +* IGNORE (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 151) +* ignore (pdb command): Debugger Commands. (line 144) +* ignore_environment (sys.flags attribute): sys — System-specific parameters and functions. + (line 553) +* ignore_errors() (in module codecs): Error Handlers. (line 147) +* IGNORE_EXCEPTION_DETAIL (in module doctest): Option Flags. (line 56) +* ignore_patterns() (in module shutil): Directory and files operations. + (line 186) +* ignore_warnings() (in module test.support.warnings_helper): test support warnings_helper — Utilities for warnings tests. + (line 11) +* ignore; error handler's name: Error Handlers. (line 15) +* IGNORECASE (in module re): Flags. (line 38) +* IISCGIHandler (class in wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 24) +* IllegalMonthError: calendar — General calendar-related functions. + (line 518) +* IllegalWeekdayError: calendar — General calendar-related functions. + (line 527) +* ilshift() (in module operator): In-place Operators. (line 57) +* imag (numbers.Complex attribute): The numeric tower. (line 19) +* imag (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1053) +* imaginary literal: Numeric literals. (line 6) +* imap_unordered() (multiprocessing.pool.Pool method): Process Pools. + (line 145) +* imap() (multiprocessing.pool.Pool method): Process Pools. (line 130) +* IMAP4 (class in imaplib): imaplib — IMAP4 protocol client. + (line 25) +* IMAP4_SSL (class in imaplib): imaplib — IMAP4 protocol client. + (line 74) +* IMAP4_SSL; protocol: imaplib — IMAP4 protocol client. + (line 8) +* IMAP4_stream (class in imaplib): imaplib — IMAP4 protocol client. + (line 104) +* IMAP4_stream; protocol: imaplib — IMAP4 protocol client. + (line 8) +* IMAP4; protocol: imaplib — IMAP4 protocol client. + (line 8) +* IMAP4.abort: imaplib — IMAP4 protocol client. + (line 58) +* IMAP4.error: imaplib — IMAP4 protocol client. + (line 53) +* IMAP4.readonly: imaplib — IMAP4 protocol client. + (line 65) +* imatmul() (in module operator): In-place Operators. (line 72) +* immedok() (curses.window method): Window Objects. (line 303) +* immortal: Glossary. (line 729) +* immutable: Glossary. (line 739) +* immutable object: Objects values and types. + (line 11) +* immutable; data; type: Literals<2>. (line 17) +* immutable; object: Literals<2>. (line 17) +* immutable; object <1>: Dictionary displays. + (line 37) +* immutable; sequence; types: Immutable Sequence Types. + (line 6) +* imod() (in module operator): In-place Operators. (line 62) +* impl_detail() (in module test.support): test support — Utilities for the Python test suite. + (line 532) +* implementation (in module sys): sys — System-specific parameters and functions. + (line 1098) +* Import (class in ast): Imports. (line 6) +* import hooks: Import hooks. (line 6) +* import machinery: The import system. (line 6) +* import path: Glossary. (line 747) +* import_fresh_module() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 16) +* IMPORT_FROM (opcode): Python Bytecode Instructions. + (line 827) +* import_module() (in module importlib): Functions<12>. (line 15) +* import_module() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 52) +* IMPORT_NAME (opcode): Python Bytecode Instructions. + (line 818) +* importer: Glossary. (line 760) +* ImportError: Concrete exceptions. + (line 52) +* ImportFrom (class in ast): Imports. (line 20) +* importing: Glossary. (line 755) +* ImportWarning: Warnings. (line 57) +* ImproperConnectionState: http client — HTTP protocol client. + (line 161) +* imul() (in module operator): In-place Operators. (line 67) +* In (class in ast): Expressions<2>. (line 108) +* in_dll() (ctypes._CData method): Data types. (line 63) +* in_table_a1() (in module stringprep): stringprep — Internet String Preparation. + (line 40) +* in_table_b1() (in module stringprep): stringprep — Internet String Preparation. + (line 45) +* in_table_c11_c12() (in module stringprep): stringprep — Internet String Preparation. + (line 69) +* in_table_c11() (in module stringprep): stringprep — Internet String Preparation. + (line 60) +* in_table_c12() (in module stringprep): stringprep — Internet String Preparation. + (line 64) +* in_table_c21_c22() (in module stringprep): stringprep — Internet String Preparation. + (line 84) +* in_table_c21() (in module stringprep): stringprep — Internet String Preparation. + (line 74) +* in_table_c22() (in module stringprep): stringprep — Internet String Preparation. + (line 79) +* in_table_c3() (in module stringprep): stringprep — Internet String Preparation. + (line 89) +* in_table_c4() (in module stringprep): stringprep — Internet String Preparation. + (line 93) +* in_table_c5() (in module stringprep): stringprep — Internet String Preparation. + (line 98) +* in_table_c6() (in module stringprep): stringprep — Internet String Preparation. + (line 102) +* in_table_c7() (in module stringprep): stringprep — Internet String Preparation. + (line 107) +* in_table_c8() (in module stringprep): stringprep — Internet String Preparation. + (line 112) +* in_table_c9() (in module stringprep): stringprep — Internet String Preparation. + (line 117) +* in_table_d1() (in module stringprep): stringprep — Internet String Preparation. + (line 121) +* in_table_d2() (in module stringprep): stringprep — Internet String Preparation. + (line 126) +* in_transaction (sqlite3.Connection attribute): Connection objects. + (line 765) +* inch() (curses.window method): Window Objects. (line 311) +* include() (in module xml.etree.ElementInclude): Functions<10>. + (line 17) +* inclusive (tracemalloc.DomainFilter attribute): DomainFilter. + (line 12) +* inclusive (tracemalloc.Filter attribute): Filter. (line 39) +* inclusive; or: Binary bitwise operations. + (line 20) +* Incomplete: binascii — Convert between binary and ASCII. + (line 161) +* IncompleteRead: http client — HTTP protocol client. + (line 157) +* IncompleteReadError: Exceptions<13>. (line 44) +* incr_item(): Exceptions<21>. (line 78) +* incr_item() <1>: Exceptions<21>. (line 123) +* increment_lineno() (in module ast): ast Helpers. (line 155) +* IncrementalDecoder (class in codecs): IncrementalDecoder Objects. + (line 11) +* incrementaldecoder (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 87) +* IncrementalEncoder (class in codecs): IncrementalEncoder Objects. + (line 11) +* incrementalencoder (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 87) +* IncrementalNewlineDecoder (class in io): Text I/O<2>. (line 287) +* IncrementalParser (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 20) +* indent (doctest.Example attribute): Example Objects. (line 47) +* INDENT (in module token): token — Constants used with Python parse trees. + (line 86) +* indent (reprlib.Repr attribute): Repr Objects. (line 54) +* INDENT token: Indentation. (line 33) +* indent() (in module textwrap): textwrap — Text wrapping and filling. + (line 102) +* indent() (in module xml.etree.ElementTree): Functions<9>. (line 118) +* indentation: Indentation. (line 6) +* IndentationError: Concrete exceptions. + (line 357) +* index (inspect.FrameInfo attribute): The interpreter stack. + (line 37) +* index (inspect.Traceback attribute): The interpreter stack. + (line 77) +* index operation: Sequences. (line 6) +* index() (array.array method): array — Efficient arrays of numeric values. + (line 197) +* index() (bytearray method): Bytes and Bytearray Operations. + (line 154) +* index() (bytes method): Bytes and Bytearray Operations. + (line 154) +* index() (collections.deque method): deque objects. (line 70) +* index() (in module operator): operator — Standard operators as functions. + (line 93) +* index() (multiprocessing.shared_memory.ShareableList method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 336) +* index() (sequence method): Common Sequence Operations. + (line 21) +* index() (str method): String Methods<2>. (line 217) +* index() (tkinter.ttk.Notebook method): ttk Notebook. (line 37) +* index() (tkinter.ttk.Treeview method): ttk Treeview. (line 178) +* IndexError: Concrete exceptions. + (line 80) +* indexOf() (in module operator): operator — Standard operators as functions. + (line 201) +* IndexSizeErr: Exceptions<20>. (line 34) +* indices() (slice method): Slice objects. (line 16) +* INDIRECT (inspect.BufferFlags attribute): Buffer flags. (line 31) +* inet_aton() (in module socket): Other functions<2>. (line 259) +* inet_ntoa() (in module socket): Other functions<2>. (line 279) +* inet_ntop() (in module socket): Other functions<2>. (line 314) +* inet_pton() (in module socket): Other functions<2>. (line 296) +* Inexact (class in decimal): Signals. (line 43) +* inf (in module cmath): Constants<3>. (line 20) +* inf (in module math): Constants<2>. (line 24) +* inf (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1045) +* infile (shlex.shlex attribute): shlex Objects. (line 140) +* Infinity: Built-in Functions. (line 726) +* infj (in module cmath): Constants<3>. (line 26) +* INFO (in module logging): Logging Levels. (line 29) +* INFO (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 194) +* info() (dis.Bytecode method): Bytecode analysis. (line 63) +* info() (gettext.NullTranslations method): The NullTranslations class. + (line 63) +* info() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 84) +* info() (in module logging): Module-Level Functions. + (line 64) +* info() (logging.Logger method): Logger Objects. (line 288) +* info() (urllib.response.addinfourl method): urllib response — Response classes used by urllib. + (line 35) +* infolist() (zipfile.ZipFile method): ZipFile Objects. (line 119) +* inheritance: Class definitions. (line 6) +* ini file: configparser — Configuration file parser. + (line 8) +* init_color() (in module curses): Functions<6>. (line 220) +* init_pair() (in module curses): Functions<6>. (line 232) +* init() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 92) +* inited (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 131) +* initgroups() (in module os): Process Parameters. (line 342) +* initial_indent (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 210) +* initproc (C type): Slot Type typedefs. (line 35) +* initscr() (in module curses): Functions<6>. (line 245) +* InitVar (class in dataclasses): Module contents<4>. (line 328) +* inode() (os.DirEntry method): Files and Directories. + (line 966) +* input: Expression input. (line 6) +* input_charset (email.charset.Charset attribute): email charset Representing character sets. + (line 53) +* input_codec (email.charset.Charset attribute): email charset Representing character sets. + (line 82) +* input() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 56) +* InputSource (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 51) +* InputStream (class in wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 24) +* inquiry (C type): Supporting Cyclic Garbage Collection. + (line 198) +* insch() (curses.window method): Window Objects. (line 317) +* insdelln() (curses.window method): Window Objects. (line 324) +* insert_text() (in module readline): Line buffer. (line 13) +* insert() (array.array method): array — Efficient arrays of numeric values. + (line 208) +* insert() (collections.deque method): deque objects. (line 78) +* insert() (sequence method): Mutable Sequence Types. + (line 16) +* insert() (tkinter.ttk.Notebook method): ttk Notebook. (line 42) +* insert() (tkinter.ttk.Treeview method): ttk Treeview. (line 183) +* insert() (xml.etree.ElementTree.Element method): Element Objects. + (line 130) +* insertBefore() (xml.dom.Node method): Node Objects. (line 121) +* insertln() (curses.window method): Window Objects. (line 332) +* insnstr() (curses.window method): Window Objects. (line 337) +* insort_left() (in module bisect): bisect — Array bisection algorithm. + (line 72) +* insort_right() (in module bisect): bisect — Array bisection algorithm. + (line 89) +* insort() (in module bisect): bisect — Array bisection algorithm. + (line 89) +* inspect (sys.flags attribute): sys — System-specific parameters and functions. + (line 532) +* inspect command line option; -details: Command Line Interface<3>. + (line 13) +* InspectLoader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 202) +* insstr() (curses.window method): Window Objects. (line 348) +* install_opener() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 113) +* install_scripts() (venv.EnvBuilder method): API<2>. (line 183) +* install() (gettext.NullTranslations method): The NullTranslations class. + (line 72) +* install() (in module gettext): Class-based API. (line 69) +* installHandler() (in module unittest): Signal Handling. (line 29) +* instance; call: Calls. (line 158) +* instate() (tkinter.ttk.Widget method): ttk Widget. (line 18) +* instr() (curses.window method): Window Objects. (line 358) +* instream (shlex.shlex attribute): shlex Objects. (line 146) +* Instruction (class in dis): Python Bytecode Instructions. + (line 10) +* INSTRUCTION (monitoring event): Events. (line 30) +* Instruction.arg (in module dis): Python Bytecode Instructions. + (line 34) +* Instruction.argrepr (in module dis): Python Bytecode Instructions. + (line 46) +* Instruction.argval (in module dis): Python Bytecode Instructions. + (line 42) +* Instruction.baseopcode (in module dis): Python Bytecode Instructions. + (line 24) +* Instruction.baseopname (in module dis): Python Bytecode Instructions. + (line 29) +* Instruction.cache_info (in module dis): Python Bytecode Instructions. + (line 92) +* Instruction.cache_offset (in module dis): Python Bytecode Instructions. + (line 61) +* Instruction.end_offset (in module dis): Python Bytecode Instructions. + (line 65) +* Instruction.is_jump_target (in module dis): Python Bytecode Instructions. + (line 78) +* Instruction.jump_target (in module dis): Python Bytecode Instructions. + (line 82) +* Instruction.line_number (in module dis): Python Bytecode Instructions. + (line 73) +* Instruction.offset (in module dis): Python Bytecode Instructions. + (line 51) +* Instruction.oparg (in module dis): Python Bytecode Instructions. + (line 38) +* Instruction.opcode (in module dis): Python Bytecode Instructions. + (line 14) +* Instruction.opname (in module dis): Python Bytecode Instructions. + (line 20) +* Instruction.positions (in module dis): Python Bytecode Instructions. + (line 87) +* Instruction.start_offset (in module dis): Python Bytecode Instructions. + (line 55) +* Instruction.starts_line (in module dis): Python Bytecode Instructions. + (line 69) +* int (built-in class): Built-in Functions. (line 956) +* int (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 132) +* int_info (in module sys): sys — System-specific parameters and functions. + (line 1141) +* int_max_str_digits (sys.flags attribute): sys — System-specific parameters and functions. + (line 578) +* Int2AP() (in module imaplib): imaplib — IMAP4 protocol client. + (line 118) +* integer: Immutable sequences. + (line 15) +* integer literal: Numeric literals. (line 6) +* integer; literals: Numeric Types — int float complex. + (line 19) +* integer; representation: numbers Integral. (line 9) +* Integral (class in numbers): The numeric tower. (line 59) +* Integrated Development Environment: IDLE — Python editor and shell<2>. + (line 8) +* IntegrityError: Exceptions<7>. (line 65) +* IntEnum (class in enum): Data Types<2>. (line 363) +* interact (pdb command): Debugger Commands. (line 352) +* interact() (code.InteractiveConsole method): Interactive Console Objects. + (line 10) +* interact() (in module code): code — Interpreter base classes. + (line 42) +* interactive: Glossary. (line 765) +* Interactive (class in ast): Root nodes. (line 37) +* interactive (sys.flags attribute): sys — System-specific parameters and functions. + (line 535) +* interactive mode: Complete Python programs. + (line 19) +* InteractiveConsole (class in code): code — Interpreter base classes. + (line 30) +* InteractiveInterpreter (class in code): code — Interpreter base classes. + (line 15) +* InterfaceError: Exceptions<7>. (line 37) +* intern() (in module sys): sys — System-specific parameters and functions. + (line 1186) +* internal type: Internal types. (line 6) +* internal_attr (zipfile.ZipInfo attribute): ZipInfo Objects. + (line 124) +* Internaldate2tuple() (in module imaplib): imaplib — IMAP4 protocol client. + (line 112) +* InternalError: Exceptions<7>. (line 71) +* internalSubset (xml.dom.DocumentType attribute): DocumentType Objects. + (line 27) +* Internet: Internet Protocols and Support. + (line 6) +* INTERNET_TIMEOUT (in module test.support): test support — Utilities for the Python test suite. + (line 65) +* interpolated string literal: Fancier Output Formatting. + (line 93) +* interpolated string literal <1>: String literal concatenation. + (line 24) +* interpolated string literal <2>: String Methods<2>. (line 753) +* interpolation, string (%): printf-style String Formatting. + (line 6) +* interpolation; bytearray (%): printf-style Bytes Formatting. + (line 6) +* interpolation; bytes (%): printf-style Bytes Formatting. + (line 6) +* InterpolationDepthError: Exceptions<8>. (line 42) +* InterpolationError: Exceptions<8>. (line 37) +* InterpolationMissingOptionError: Exceptions<8>. (line 49) +* InterpolationSyntaxError: Exceptions<8>. (line 54) +* interpreted: Glossary. (line 775) +* interpreter: Top-level components. + (line 6) +* interpreter lock: Thread State and the Global Interpreter Lock. + (line 6) +* interpreter prompts: sys — System-specific parameters and functions. + (line 1484) +* interpreter shutdown: Glossary. (line 785) +* interpreter_requires_environment() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 9) +* interrupt_main() (in module _thread): _thread — Low-level threading API. + (line 56) +* interrupt() (sqlite3.Connection method): Connection objects. + (line 339) +* InterruptedError: OS exceptions. (line 73) +* intersection_update() (frozenset method): Set Types — set frozenset. + (line 175) +* intersection() (frozenset method): Set Types — set frozenset. + (line 102) +* IntFlag (class in enum): Data Types<2>. (line 543) +* intro (cmd.Cmd attribute): Cmd Objects. (line 150) +* InuseAttributeErr: Exceptions<20>. (line 39) +* inv_cdf() (statistics.NormalDist method): NormalDist objects. + (line 92) +* inv() (in module operator): operator — Standard operators as functions. + (line 102) +* InvalidAccessErr: Exceptions<20>. (line 44) +* invalidate_caches() (importlib.abc.MetaPathFinder method): importlib abc – Abstract base classes related to import. + (line 49) +* invalidate_caches() (importlib.abc.PathEntryFinder method): importlib abc – Abstract base classes related to import. + (line 84) +* invalidate_caches() (importlib.machinery.FileFinder method): importlib machinery – Importers and path hooks. + (line 190) +* invalidate_caches() (importlib.machinery.PathFinder class method): importlib machinery – Importers and path hooks. + (line 139) +* invalidate_caches() (in module importlib): Functions<12>. (line 40) +* invalidate_caches() (zipimport.zipimporter method): zipimporter Objects. + (line 89) +* InvalidBase64CharactersDefect: email errors Exception and Defect classes. + (line 129) +* InvalidBase64LengthDefect: email errors Exception and Defect classes. + (line 135) +* InvalidBase64PaddingDefect: email errors Exception and Defect classes. + (line 123) +* InvalidCharacterErr: Exceptions<20>. (line 49) +* InvalidDateDefect: email errors Exception and Defect classes. + (line 141) +* InvalidFileException: plistlib — Generate and parse Apple plist files. + (line 170) +* InvalidModificationErr: Exceptions<20>. (line 57) +* InvalidOperation (class in decimal): Signals. (line 51) +* InvalidStateErr: Exceptions<20>. (line 61) +* InvalidStateError: Exception classes. (line 26) +* InvalidStateError <1>: Exceptions<13>. (line 30) +* InvalidTZPathWarning: Exceptions and warnings. + (line 12) +* InvalidURL: http client — HTTP protocol client. + (line 140) +* inversion: Unary arithmetic and bitwise operations. + (line 18) +* Invert (class in ast): Expressions<2>. (line 27) +* invert() (in module operator): operator — Standard operators as functions. + (line 102) +* invocation: Callable types. (line 6) +* IO (class in typing): ABCs for working with IO. + (line 6) +* IO_REPARSE_TAG_APPEXECLINK (in module stat): stat — Interpreting stat results. + (line 476) +* IO_REPARSE_TAG_MOUNT_POINT (in module stat): stat — Interpreting stat results. + (line 476) +* IO_REPARSE_TAG_SYMLINK (in module stat): stat — Interpreting stat results. + (line 476) +* IOBase (class in io): I/O Base Classes. (line 6) +* IOCTL_VM_SOCKETS_GET_LOCAL_CID (in module socket): Constants<8>. + (line 274) +* ioctl() (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 103) +* ioctl() (socket.socket method): Socket Objects. (line 179) +* IOError: Concrete exceptions. + (line 499) +* ior() (in module operator): In-place Operators. (line 79) +* ios_ver() (in module platform): iOS platform. (line 6) +* ip (ipaddress.IPv4Interface attribute): Interface objects. (line 19) +* ip (ipaddress.IPv6Interface attribute): Interface objects. (line 74) +* ip_address() (in module ipaddress): Convenience factory functions. + (line 9) +* ip_interface() (in module ipaddress): Convenience factory functions. + (line 37) +* ip_network() (in module ipaddress): Convenience factory functions. + (line 23) +* ipow() (in module operator): In-place Operators. (line 84) +* ipv4_mapped (ipaddress.IPv6Address attribute): Address objects. + (line 299) +* IPv4Address (class in ipaddress): Address objects. (line 13) +* IPv4Interface (class in ipaddress): Interface objects. (line 9) +* IPv4Network (class in ipaddress): Network objects. (line 13) +* IPV6_ENABLED (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 11) +* ipv6_mapped (ipaddress.IPv4Address attribute): Address objects. + (line 188) +* IPv6Address (class in ipaddress): Address objects. (line 220) +* IPv6Interface (class in ipaddress): Interface objects. (line 64) +* IPv6Network (class in ipaddress): Network objects. (line 253) +* irrefutable case block: Irrefutable Case Blocks. + (line 6) +* irshift() (in module operator): In-place Operators. (line 89) +* Is (class in ast): Expressions<2>. (line 108) +* is_() (in module operator): operator — Standard operators as functions. + (line 63) +* is_absolute() (pathlib.PurePath method): Methods and properties. + (line 183) +* is_active() (asyncio.AbstractChildWatcher method): Process Watchers. + (line 72) +* is_active() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 110) +* is_alive() (multiprocessing.Process method): Process and exceptions. + (line 126) +* is_alive() (threading.Thread method): Thread objects. (line 193) +* is_android (in module test.support): test support — Utilities for the Python test suite. + (line 40) +* is_annotated() (symtable.Symbol method): Examining Symbol Tables. + (line 230) +* is_assigned() (symtable.Symbol method): Examining Symbol Tables. + (line 241) +* is_async (pyclbr.Function attribute): Function Objects. (line 41) +* is_attachment() (email.message.EmailMessage method): email message Representing an email message. + (line 445) +* is_authenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects. + (line 30) +* is_block_device() (pathlib.Path method): Querying file type and status. + (line 127) +* is_blocked() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 60) +* is_canonical() (decimal.Context method): Context objects. (line 323) +* is_canonical() (decimal.Decimal method): Decimal objects. (line 280) +* is_char_device() (pathlib.Path method): Querying file type and status. + (line 136) +* IS_CHARACTER_JUNK() (in module difflib): difflib — Helpers for computing deltas. + (line 362) +* is_check_supported() (in module lzma): Miscellaneous<2>. (line 6) +* is_closed() (asyncio.loop method): Running and stopping the loop. + (line 39) +* is_closing() (asyncio.BaseTransport method): Base Transport. + (line 17) +* is_closing() (asyncio.StreamWriter method): StreamWriter. (line 107) +* is_dataclass() (in module dataclasses): Module contents<4>. + (line 470) +* is_declared_global() (symtable.Symbol method): Examining Symbol Tables. + (line 221) +* is_dir() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 531) +* is_dir() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 103) +* is_dir() (os.DirEntry method): Files and Directories. + (line 977) +* is_dir() (pathlib.Path method): Querying file type and status. + (line 67) +* is_dir() (zipfile.Path method): Path Objects. (line 57) +* is_dir() (zipfile.ZipInfo method): ZipInfo Objects. (line 43) +* is_enabled() (in module faulthandler): Fault handler state. + (line 31) +* is_expired() (http.cookiejar.Cookie method): Cookie Objects<2>. + (line 113) +* is_fifo() (pathlib.Path method): Querying file type and status. + (line 119) +* is_file() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 535) +* is_file() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 107) +* is_file() (os.DirEntry method): Files and Directories. + (line 1006) +* is_file() (pathlib.Path method): Querying file type and status. + (line 54) +* is_file() (zipfile.Path method): Path Objects. (line 61) +* is_finalized() (in module gc): gc — Garbage Collector interface. + (line 185) +* is_finalizing() (in module sys): sys — System-specific parameters and functions. + (line 1212) +* is_finite() (decimal.Context method): Context objects. (line 327) +* is_finite() (decimal.Decimal method): Decimal objects. (line 287) +* is_free() (symtable.Symbol method): Examining Symbol Tables. + (line 236) +* is_global (ipaddress.IPv4Address attribute): Address objects. + (line 135) +* is_global (ipaddress.IPv6Address attribute): Address objects. + (line 279) +* is_global() (symtable.Symbol method): Examining Symbol Tables. + (line 213) +* is_hop_by_hop() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 112) +* is_imported() (symtable.Symbol method): Examining Symbol Tables. + (line 204) +* is_infinite() (decimal.Context method): Context objects. (line 331) +* is_infinite() (decimal.Decimal method): Decimal objects. (line 292) +* is_integer() (float method): Additional Methods on Float. + (line 16) +* is_integer() (fractions.Fraction method): fractions — Rational numbers. + (line 132) +* is_integer() (int method): Additional Methods on Integer Types. + (line 171) +* is_junction() (os.DirEntry method): Files and Directories. + (line 1041) +* is_junction() (pathlib.Path method): Querying file type and status. + (line 88) +* is_jython (in module test.support): test support — Utilities for the Python test suite. + (line 36) +* IS_LINE_JUNK() (in module difflib): difflib — Helpers for computing deltas. + (line 355) +* is_linetouched() (curses.window method): Window Objects. (line 368) +* is_link_local (ipaddress.IPv4Address attribute): Address objects. + (line 183) +* is_link_local (ipaddress.IPv4Network attribute): Network objects. + (line 80) +* is_link_local (ipaddress.IPv6Address attribute): Address objects. + (line 289) +* is_link_local (ipaddress.IPv6Network attribute): Network objects. + (line 307) +* is_local() (symtable.Symbol method): Examining Symbol Tables. + (line 226) +* is_loopback (ipaddress.IPv4Address attribute): Address objects. + (line 178) +* is_loopback (ipaddress.IPv4Network attribute): Network objects. + (line 78) +* is_loopback (ipaddress.IPv6Address attribute): Address objects. + (line 287) +* is_loopback (ipaddress.IPv6Network attribute): Network objects. + (line 305) +* is_mount() (pathlib.Path method): Querying file type and status. + (line 95) +* is_multicast (ipaddress.IPv4Address attribute): Address objects. + (line 92) +* is_multicast (ipaddress.IPv4Network attribute): Network objects. + (line 70) +* is_multicast (ipaddress.IPv6Address attribute): Address objects. + (line 275) +* is_multicast (ipaddress.IPv6Network attribute): Network objects. + (line 297) +* is_multipart() (email.message.EmailMessage method): email message Representing an email message. + (line 134) +* is_multipart() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 145) +* is_namespace() (symtable.Symbol method): Examining Symbol Tables. + (line 245) +* is_nan() (decimal.Context method): Context objects. (line 335) +* is_nan() (decimal.Decimal method): Decimal objects. (line 297) +* is_nested() (symtable.SymbolTable method): Examining Symbol Tables. + (line 94) +* is_nonlocal() (symtable.Symbol method): Examining Symbol Tables. + (line 217) +* is_normal() (decimal.Context method): Context objects. (line 340) +* is_normal() (decimal.Decimal method): Decimal objects. (line 302) +* is_normalized() (in module unicodedata): unicodedata — Unicode Database. + (line 117) +* is_not_allowed() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 74) +* is_not() (in module operator): operator — Standard operators as functions. + (line 67) +* IS_OP (opcode): Python Bytecode Instructions. + (line 806) +* is_optimized() (symtable.SymbolTable method): Examining Symbol Tables. + (line 90) +* is_package() (importlib.abc.InspectLoader method): importlib abc – Abstract base classes related to import. + (line 234) +* is_package() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 425) +* is_package() (importlib.machinery.ExtensionFileLoader method): importlib machinery – Importers and path hooks. + (line 328) +* is_package() (importlib.machinery.SourceFileLoader method): importlib machinery – Importers and path hooks. + (line 220) +* is_package() (importlib.machinery.SourcelessFileLoader method): importlib machinery – Importers and path hooks. + (line 264) +* is_package() (zipimport.zipimporter method): zipimporter Objects. + (line 73) +* is_parameter() (symtable.Symbol method): Examining Symbol Tables. + (line 209) +* is_private (ipaddress.IPv4Address attribute): Address objects. + (line 97) +* is_private (ipaddress.IPv4Network attribute): Network objects. + (line 72) +* is_private (ipaddress.IPv6Address attribute): Address objects. + (line 277) +* is_private (ipaddress.IPv6Network attribute): Network objects. + (line 299) +* is_protocol() (in module typing): Introspection helpers. + (line 114) +* is_python_build() (in module sysconfig): Other functions<3>. + (line 52) +* is_qnan() (decimal.Context method): Context objects. (line 345) +* is_qnan() (decimal.Decimal method): Decimal objects. (line 308) +* is_reading() (asyncio.ReadTransport method): Read-only Transports. + (line 6) +* is_referenced() (symtable.Symbol method): Examining Symbol Tables. + (line 200) +* is_relative_to() (pathlib.PurePath method): Methods and properties. + (line 202) +* is_reserved (ipaddress.IPv4Address attribute): Address objects. + (line 163) +* is_reserved (ipaddress.IPv4Network attribute): Network objects. + (line 76) +* is_reserved (ipaddress.IPv6Address attribute): Address objects. + (line 285) +* is_reserved (ipaddress.IPv6Network attribute): Network objects. + (line 303) +* is_reserved() (pathlib.PurePath method): Methods and properties. + (line 226) +* is_resource_enabled() (in module test.support): test support — Utilities for the Python test suite. + (line 245) +* is_resource() (importlib.abc.ResourceReader method): importlib abc – Abstract base classes related to import. + (line 485) +* is_resource() (importlib.resources.abc.ResourceReader method): importlib resources abc – Abstract base classes for resources. + (line 62) +* is_resource() (in module importlib.resources): Functional API. + (line 136) +* is_running() (asyncio.loop method): Running and stopping the loop. + (line 35) +* is_safe (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 152) +* is_serving() (asyncio.Server method): Server Objects. (line 117) +* is_set() (asyncio.Event method): Event. (line 65) +* is_set() (threading.Event method): Event objects. (line 24) +* is_signed() (decimal.Context method): Context objects. (line 350) +* is_signed() (decimal.Decimal method): Decimal objects. (line 313) +* is_site_local (ipaddress.IPv6Address attribute): Address objects. + (line 291) +* is_site_local (ipaddress.IPv6Network attribute): Network objects. + (line 357) +* is_skipped_line() (bdb.Bdb method): bdb — Debugger framework. + (line 245) +* is_snan() (decimal.Context method): Context objects. (line 354) +* is_snan() (decimal.Decimal method): Decimal objects. (line 319) +* is_socket() (pathlib.Path method): Querying file type and status. + (line 110) +* is_stack_trampoline_active() (in module sys): sys — System-specific parameters and functions. + (line 1774) +* is_subnormal() (decimal.Context method): Context objects. (line 359) +* is_subnormal() (decimal.Decimal method): Decimal objects. (line 324) +* is_symlink() (os.DirEntry method): Files and Directories. + (line 1022) +* is_symlink() (pathlib.Path method): Querying file type and status. + (line 80) +* is_symlink() (zipfile.Path method): Path Objects. (line 65) +* is_tarfile() (in module tarfile): tarfile — Read and write tar archive files. + (line 190) +* is_term_resized() (in module curses): Functions<6>. (line 253) +* is_tracing() (in module tracemalloc): Functions<11>. (line 61) +* is_tracked() (in module gc): gc — Garbage Collector interface. + (line 160) +* is_typeddict() (in module typing): Introspection helpers. + (line 129) +* is_unspecified (ipaddress.IPv4Address attribute): Address objects. + (line 158) +* is_unspecified (ipaddress.IPv4Network attribute): Network objects. + (line 74) +* is_unspecified (ipaddress.IPv6Address attribute): Address objects. + (line 283) +* is_unspecified (ipaddress.IPv6Network attribute): Network objects. + (line 301) +* is_valid() (string.Template method): Template strings. (line 67) +* is_wintouched() (curses.window method): Window Objects. (line 375) +* is_zero() (decimal.Context method): Context objects. (line 363) +* is_zero() (decimal.Decimal method): Decimal objects. (line 329) +* is_zipfile() (in module zipfile): zipfile — Work with ZIP archives. + (line 77) +* isabs() (in module os.path): os path — Common pathname manipulations. + (line 201) +* isabstract() (in module inspect): Types and members. (line 514) +* IsADirectoryError: OS exceptions. (line 83) +* isalnum() (bytearray method): Bytes and Bytearray Operations. + (line 510) +* isalnum() (bytes method): Bytes and Bytearray Operations. + (line 510) +* isalnum() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 134) +* isalnum() (str method): String Methods<2>. (line 222) +* isalpha() (bytearray method): Bytes and Bytearray Operations. + (line 528) +* isalpha() (bytes method): Bytes and Bytearray Operations. + (line 528) +* isalpha() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 139) +* isalpha() (str method): String Methods<2>. (line 229) +* isascii() (bytearray method): Bytes and Bytearray Operations. + (line 543) +* isascii() (bytes method): Bytes and Bytearray Operations. + (line 543) +* isascii() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 144) +* isascii() (str method): String Methods<2>. (line 239) +* isasyncgen() (in module inspect): Types and members. (line 474) +* isasyncgenfunction() (in module inspect): Types and members. + (line 453) +* isatty() (in module os): File Descriptor Operations. + (line 260) +* isatty() (io.IOBase method): I/O Base Classes. (line 73) +* isawaitable() (in module inspect): Types and members. (line 432) +* isblank() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 148) +* isblk() (tarfile.TarInfo method): TarInfo Objects. (line 210) +* isbuiltin() (in module inspect): Types and members. (line 494) +* ischr() (tarfile.TarInfo method): TarInfo Objects. (line 206) +* isclass() (in module inspect): Types and members. (line 359) +* isclose() (in module cmath): Classification functions. + (line 23) +* isclose() (in module math): Floating point manipulation functions. + (line 25) +* iscntrl() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 152) +* iscode() (in module inspect): Types and members. (line 490) +* iscoroutine() (in module asyncio): Introspection. (line 26) +* iscoroutine() (in module inspect): Types and members. (line 425) +* iscoroutinefunction() (in module inspect): Types and members. + (line 389) +* isctrl() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 193) +* isDaemon() (threading.Thread method): Thread objects. (line 215) +* isdatadescriptor() (in module inspect): Types and members. (line 541) +* isdecimal() (str method): String Methods<2>. (line 247) +* isdev() (tarfile.TarInfo method): TarInfo Objects. (line 218) +* isdevdrive() (in module os.path): os path — Common pathname manipulations. + (line 264) +* isdigit() (bytearray method): Bytes and Bytearray Operations. + (line 551) +* isdigit() (bytes method): Bytes and Bytearray Operations. + (line 551) +* isdigit() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 157) +* isdigit() (str method): String Methods<2>. (line 255) +* isdir() (in module os.path): os path — Common pathname manipulations. + (line 220) +* isdir() (tarfile.TarInfo method): TarInfo Objects. (line 194) +* isdisjoint() (frozenset method): Set Types — set frozenset. + (line 68) +* isdown() (in module turtle): Drawing state. (line 86) +* iselement() (in module xml.etree.ElementTree): Functions<9>. + (line 130) +* isenabled() (in module gc): gc — Garbage Collector interface. + (line 30) +* isEnabledFor() (logging.Logger method): Logger Objects. (line 144) +* isendwin() (in module curses): Functions<6>. (line 258) +* ISEOF() (in module token): token — Constants used with Python parse trees. + (line 39) +* isfifo() (tarfile.TarInfo method): TarInfo Objects. (line 214) +* isfile() (in module os.path): os path — Common pathname manipulations. + (line 212) +* isfile() (tarfile.TarInfo method): TarInfo Objects. (line 185) +* isfinite() (in module cmath): Classification functions. + (line 6) +* isfinite() (in module math): Floating point manipulation functions. + (line 60) +* isfirstline() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 111) +* isframe() (in module inspect): Types and members. (line 486) +* isfunction() (in module inspect): Types and members. (line 368) +* isfuture() (in module asyncio): Future Functions. (line 6) +* isgenerator() (in module inspect): Types and members. (line 385) +* isgeneratorfunction() (in module inspect): Types and members. + (line 373) +* isgetsetdescriptor() (in module inspect): Types and members. + (line 554) +* isgraph() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 162) +* isidentifier() (str method): String Methods<2>. (line 265) +* isinf() (in module cmath): Classification functions. + (line 13) +* isinf() (in module math): Floating point manipulation functions. + (line 67) +* isjunction() (in module os.path): os path — Common pathname manipulations. + (line 228) +* iskeyword() (in module keyword): keyword — Testing for Python keywords. + (line 13) +* isleap() (in module calendar): calendar — General calendar-related functions. + (line 364) +* islice() (in module itertools): Itertool Functions. (line 368) +* islink() (in module os.path): os path — Common pathname manipulations. + (line 236) +* islnk() (tarfile.TarInfo method): TarInfo Objects. (line 202) +* islower() (bytearray method): Bytes and Bytearray Operations. + (line 565) +* islower() (bytes method): Bytes and Bytearray Operations. + (line 565) +* islower() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 166) +* islower() (str method): String Methods<2>. (line 283) +* ismemberdescriptor() (in module inspect): Types and members. + (line 563) +* ismeta() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 197) +* ismethod() (in module inspect): Types and members. (line 364) +* ismethoddescriptor() (in module inspect): Types and members. + (line 518) +* ismethodwrapper() (in module inspect): Types and members. (line 499) +* ismodule() (in module inspect): Types and members. (line 355) +* ismount() (in module os.path): os path — Common pathname manipulations. + (line 244) +* isnan() (in module cmath): Classification functions. + (line 18) +* isnan() (in module math): Floating point manipulation functions. + (line 72) +* ISNONTERMINAL() (in module token): token — Constants used with Python parse trees. + (line 35) +* IsNot (class in ast): Expressions<2>. (line 108) +* isnumeric() (str method): String Methods<2>. (line 289) +* isocalendar() (datetime.date method): date Objects. (line 244) +* isocalendar() (datetime.datetime method): datetime Objects. + (line 649) +* isoformat() (datetime.date method): date Objects. (line 271) +* isoformat() (datetime.datetime method): datetime Objects. (line 654) +* isoformat() (datetime.time method): time Objects. (line 163) +* isolated (sys.flags attribute): sys — System-specific parameters and functions. + (line 538) +* IsolatedAsyncioTestCase (class in unittest): Test cases. (line 853) +* isolation_level (sqlite3.Connection attribute): Connection objects. + (line 775) +* isoweekday() (datetime.date method): date Objects. (line 237) +* isoweekday() (datetime.datetime method): datetime Objects. (line 643) +* isprint() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 170) +* isprintable() (str method): String Methods<2>. (line 299) +* ispunct() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 174) +* isqrt() (in module math): Number-theoretic functions. + (line 43) +* isreadable() (in module pprint): Functions<4>. (line 85) +* isreadable() (pprint.PrettyPrinter method): PrettyPrinter Objects. + (line 66) +* isrecursive() (in module pprint): Functions<4>. (line 94) +* isrecursive() (pprint.PrettyPrinter method): PrettyPrinter Objects. + (line 74) +* isreg() (tarfile.TarInfo method): TarInfo Objects. (line 190) +* isreserved() (in module os.path): os path — Common pathname manipulations. + (line 283) +* isReservedKey() (http.cookies.Morsel method): Morsel Objects. + (line 65) +* isroutine() (in module inspect): Types and members. (line 509) +* isSameNode() (xml.dom.Node method): Node Objects. (line 102) +* issoftkeyword() (in module keyword): keyword — Testing for Python keywords. + (line 24) +* isspace() (bytearray method): Bytes and Bytearray Operations. + (line 582) +* isspace() (bytes method): Bytes and Bytearray Operations. + (line 582) +* isspace() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 179) +* isspace() (str method): String Methods<2>. (line 316) +* isstdin() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 116) +* issubset() (frozenset method): Set Types — set frozenset. + (line 74) +* issuperset() (frozenset method): Set Types — set frozenset. + (line 85) +* issym() (tarfile.TarInfo method): TarInfo Objects. (line 198) +* ISTERMINAL() (in module token): token — Constants used with Python parse trees. + (line 31) +* istitle() (bytearray method): Bytes and Bytearray Operations. + (line 590) +* istitle() (bytes method): Bytes and Bytearray Operations. + (line 590) +* istitle() (str method): String Methods<2>. (line 326) +* istraceback() (in module inspect): Types and members. (line 482) +* isub() (in module operator): In-place Operators. (line 94) +* isupper() (bytearray method): Bytes and Bytearray Operations. + (line 604) +* isupper() (bytes method): Bytes and Bytearray Operations. + (line 604) +* isupper() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 184) +* isupper() (str method): String Methods<2>. (line 333) +* isvisible() (in module turtle): Visibility. (line 22) +* isxdigit() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 188) +* ITALIC (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 15) +* item selection: Sequences. (line 6) +* item() (tkinter.ttk.Treeview method): ttk Treeview. (line 202) +* item() (xml.dom.NamedNodeMap method): NamedNodeMap Objects. + (line 12) +* item() (xml.dom.NodeList method): NodeList Objects. (line 15) +* itemgetter() (in module operator): operator — Standard operators as functions. + (line 271) +* items() (configparser.ConfigParser method): ConfigParser Objects. + (line 270) +* items() (contextvars.Context method): Manual Context Management. + (line 141) +* items() (dict method): Mapping Types — dict. + (line 191) +* items() (email.message.EmailMessage method): email message Representing an email message. + (line 240) +* items() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 351) +* items() (mailbox.Mailbox method): Mailbox objects. (line 142) +* items() (types.MappingProxyType method): Standard Interpreter Types. + (line 267) +* items() (xml.etree.ElementTree.Element method): Element Objects. + (line 71) +* itemsize (array.array attribute): array — Efficient arrays of numeric values. + (line 116) +* itemsize (memoryview attribute): Memory Views. (line 433) +* ItemsView (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 102) +* ItemsView (class in typing): Aliases to container ABCs in collections abc. + (line 41) +* iter_attachments() (email.message.EmailMessage method): email message Representing an email message. + (line 560) +* iter_child_nodes() (in module ast): ast Helpers. (line 172) +* iter_fields() (in module ast): ast Helpers. (line 167) +* iter_importers() (in module pkgutil): pkgutil — Package extension utility. + (line 107) +* iter_modules() (in module pkgutil): pkgutil — Package extension utility. + (line 125) +* iter_parts() (email.message.EmailMessage method): email message Representing an email message. + (line 576) +* iter_unpack() (in module struct): Functions and Exceptions. + (line 42) +* iter_unpack() (struct.Struct method): Classes<3>. (line 46) +* iter() (xml.etree.ElementTree.Element method): Element Objects. + (line 136) +* iter() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 40) +* iterable: Glossary. (line 800) +* Iterable (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 26) +* Iterable (class in typing): Aliases to other ABCs in collections abc. + (line 6) +* iterable; unpacking: Expression lists. (line 18) +* iterator: Glossary. (line 822) +* Iterator (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 43) +* Iterator (class in typing): Aliases to other ABCs in collections abc. + (line 14) +* iterator protocol: Iterator Types. (line 6) +* iterdecode() (in module codecs): codecs — Codec registry and base classes. + (line 244) +* iterdir() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 527) +* iterdir() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 99) +* iterdir() (pathlib.Path method): Reading directories. + (line 6) +* iterdir() (zipfile.Path method): Path Objects. (line 53) +* iterdump() (sqlite3.Connection method): Connection objects. + (line 500) +* iterencode() (in module codecs): codecs — Codec registry and base classes. + (line 231) +* iterencode() (json.JSONEncoder method): Encoders and Decoders. + (line 226) +* iterfind() (xml.etree.ElementTree.Element method): Element Objects. + (line 147) +* iterfind() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 47) +* iteritems() (mailbox.Mailbox method): Mailbox objects. (line 133) +* iterkeys() (mailbox.Mailbox method): Mailbox objects. (line 107) +* itermonthdates() (calendar.Calendar method): calendar — General calendar-related functions. + (line 67) +* itermonthdays() (calendar.Calendar method): calendar — General calendar-related functions. + (line 75) +* itermonthdays2() (calendar.Calendar method): calendar — General calendar-related functions. + (line 83) +* itermonthdays3() (calendar.Calendar method): calendar — General calendar-related functions. + (line 91) +* itermonthdays4() (calendar.Calendar method): calendar — General calendar-related functions. + (line 101) +* iternextfunc (C type): Slot Type typedefs. (line 92) +* iterparse() (in module xml.etree.ElementTree): Functions<9>. + (line 136) +* itertext() (xml.etree.ElementTree.Element method): Element Objects. + (line 156) +* itervalues() (mailbox.Mailbox method): Mailbox objects. (line 116) +* iterweekdays() (calendar.Calendar method): calendar — General calendar-related functions. + (line 61) +* ITIMER_PROF (in module signal): Module contents<2>. (line 223) +* ITIMER_REAL (in module signal): Module contents<2>. (line 213) +* ITIMER_VIRTUAL (in module signal): Module contents<2>. (line 218) +* ItimerError: Module contents<2>. (line 256) +* itruediv() (in module operator): In-place Operators. (line 99) +* ixor() (in module operator): In-place Operators. (line 104) +* j; in numeric literal: Floating-point literals. + (line 28) +* JANUARY (in module calendar): calendar — General calendar-related functions. + (line 490) +* java_ver() (in module platform): Java platform. (line 6) +* Java; language: numbers Real float. (line 6) +* join_thread() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 11) +* join_thread() (multiprocessing.Queue method): Pipes and Queues. + (line 186) +* join() (asyncio.Queue method): Queue. (line 53) +* join() (bytearray method): Bytes and Bytearray Operations. + (line 166) +* join() (bytes method): Bytes and Bytearray Operations. + (line 166) +* join() (in module os.path): os path — Common pathname manipulations. + (line 305) +* join() (in module shlex): shlex — Simple lexical analysis. + (line 29) +* join() (multiprocessing.JoinableQueue method): Pipes and Queues. + (line 271) +* join() (multiprocessing.pool.Pool method): Process Pools. (line 184) +* join() (multiprocessing.Process method): Process and exceptions. + (line 99) +* join() (queue.Queue method): Queue Objects. (line 88) +* join() (str method): String Methods<2>. (line 348) +* join() (threading.Thread method): Thread objects. (line 127) +* JoinableQueue (class in multiprocessing): Pipes and Queues. + (line 250) +* JoinedStr (class in ast): Literals<3>. (line 42) +* joinpath() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 539) +* joinpath() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 111) +* joinpath() (pathlib.PurePath method): Methods and properties. + (line 240) +* joinpath() (zipfile.Path method): Path Objects. (line 114) +* js_output() (http.cookies.BaseCookie method): Cookie Objects. + (line 32) +* js_output() (http.cookies.Morsel method): Morsel Objects. (line 76) +* json.tool command line option; -compact: Command line options<2>. + (line 48) +* json.tool command line option; -h: Command line options<2>. + (line 54) +* json.tool command line option; -help: Command line options<2>. + (line 54) +* json.tool command line option; -indent: Command line options<2>. + (line 48) +* json.tool command line option; -json-lines: Command line options<2>. + (line 42) +* json.tool command line option; -no-ensure-ascii: Command line options<2>. + (line 35) +* json.tool command line option; -no-indent: Command line options<2>. + (line 48) +* json.tool command line option; -sort-keys: Command line options<2>. + (line 29) +* json.tool command line option; -tab: Command line options<2>. + (line 48) +* json.tool command line option; infile: Command line options<2>. + (line 6) +* json.tool command line option; outfile: Command line options<2>. + (line 24) +* JSONDecodeError: Exceptions<17>. (line 6) +* JSONDecoder (class in json): Encoders and Decoders. + (line 6) +* JSONEncoder (class in json): Encoders and Decoders. + (line 104) +* JULY (in module calendar): calendar — General calendar-related functions. + (line 490) +* JUMP (monitoring event): Events. (line 34) +* JUMP (opcode): Python Bytecode Instructions. + (line 1427) +* jump (pdb command): Debugger Commands. (line 230) +* JUMP_BACKWARD (opcode): Python Bytecode Instructions. + (line 837) +* JUMP_BACKWARD_NO_INTERRUPT (opcode): Python Bytecode Instructions. + (line 843) +* JUMP_FORWARD (opcode): Python Bytecode Instructions. + (line 833) +* JUMP_NO_INTERRUPT (opcode): Python Bytecode Instructions. + (line 1429) +* JUNE (in module calendar): calendar — General calendar-related functions. + (line 490) +* kbhit() (in module msvcrt): Console I/O. (line 6) +* kde_random() (in module statistics): Function details. (line 185) +* kde() (in module statistics): Function details. (line 137) +* KEEP (enum.FlagBoundary attribute): Data Types<2>. (line 717) +* kevent() (in module select): select — Waiting for I/O completion. + (line 108) +* key: Dictionary displays. + (line 6) +* key (http.cookies.Morsel attribute): Morsel Objects. (line 57) +* key (zoneinfo.ZoneInfo attribute): The ZoneInfo class. (line 75) +* key function: Glossary. (line 849) +* KEY_A1 (in module curses): Constants<6>. (line 236) +* KEY_A3 (in module curses): Constants<6>. (line 239) +* KEY_ALL_ACCESS (in module winreg): Access Rights. (line 8) +* KEY_B2 (in module curses): Constants<6>. (line 242) +* KEY_BACKSPACE (in module curses): Constants<6>. (line 166) +* KEY_BEG (in module curses): Constants<6>. (line 254) +* KEY_BREAK (in module curses): Constants<6>. (line 148) +* KEY_BTAB (in module curses): Constants<6>. (line 251) +* KEY_C1 (in module curses): Constants<6>. (line 245) +* KEY_C3 (in module curses): Constants<6>. (line 248) +* KEY_CANCEL (in module curses): Constants<6>. (line 257) +* KEY_CATAB (in module curses): Constants<6>. (line 218) +* KEY_CLEAR (in module curses): Constants<6>. (line 191) +* KEY_CLOSE (in module curses): Constants<6>. (line 260) +* KEY_COMMAND (in module curses): Constants<6>. (line 263) +* KEY_COPY (in module curses): Constants<6>. (line 266) +* KEY_CREATE (in module curses): Constants<6>. (line 269) +* KEY_CREATE_LINK (in module winreg): Access Rights. (line 51) +* KEY_CREATE_SUB_KEY (in module winreg): Access Rights. (line 38) +* KEY_CTAB (in module curses): Constants<6>. (line 215) +* KEY_DC (in module curses): Constants<6>. (line 182) +* KEY_DL (in module curses): Constants<6>. (line 176) +* KEY_DOWN (in module curses): Constants<6>. (line 151) +* KEY_EIC (in module curses): Constants<6>. (line 188) +* KEY_END (in module curses): Constants<6>. (line 272) +* KEY_ENTER (in module curses): Constants<6>. (line 221) +* KEY_ENUMERATE_SUB_KEYS (in module winreg): Access Rights. (line 42) +* KEY_EOL (in module curses): Constants<6>. (line 197) +* KEY_EOS (in module curses): Constants<6>. (line 194) +* KEY_EXECUTE (in module winreg): Access Rights. (line 26) +* KEY_EXIT (in module curses): Constants<6>. (line 275) +* KEY_F0 (in module curses): Constants<6>. (line 169) +* KEY_FIND (in module curses): Constants<6>. (line 278) +* KEY_Fn (in module curses): Constants<6>. (line 173) +* KEY_HELP (in module curses): Constants<6>. (line 281) +* KEY_HOME (in module curses): Constants<6>. (line 163) +* KEY_IC (in module curses): Constants<6>. (line 185) +* KEY_IL (in module curses): Constants<6>. (line 179) +* KEY_LEFT (in module curses): Constants<6>. (line 157) +* KEY_LL (in module curses): Constants<6>. (line 233) +* KEY_MARK (in module curses): Constants<6>. (line 284) +* KEY_MAX (in module curses): Constants<6>. (line 425) +* KEY_MESSAGE (in module curses): Constants<6>. (line 287) +* KEY_MIN (in module curses): Constants<6>. (line 145) +* KEY_MOUSE (in module curses): Constants<6>. (line 419) +* KEY_MOVE (in module curses): Constants<6>. (line 290) +* KEY_NEXT (in module curses): Constants<6>. (line 293) +* KEY_NOTIFY (in module winreg): Access Rights. (line 46) +* KEY_NPAGE (in module curses): Constants<6>. (line 206) +* KEY_OPEN (in module curses): Constants<6>. (line 296) +* KEY_OPTIONS (in module curses): Constants<6>. (line 299) +* KEY_PPAGE (in module curses): Constants<6>. (line 209) +* KEY_PREVIOUS (in module curses): Constants<6>. (line 302) +* KEY_PRINT (in module curses): Constants<6>. (line 230) +* KEY_QUERY_VALUE (in module winreg): Access Rights. (line 30) +* KEY_READ (in module winreg): Access Rights. (line 20) +* KEY_REDO (in module curses): Constants<6>. (line 305) +* KEY_REFERENCE (in module curses): Constants<6>. (line 308) +* KEY_REFRESH (in module curses): Constants<6>. (line 311) +* KEY_REPLACE (in module curses): Constants<6>. (line 314) +* KEY_RESET (in module curses): Constants<6>. (line 227) +* KEY_RESIZE (in module curses): Constants<6>. (line 422) +* KEY_RESTART (in module curses): Constants<6>. (line 317) +* KEY_RESUME (in module curses): Constants<6>. (line 320) +* KEY_RIGHT (in module curses): Constants<6>. (line 160) +* KEY_SAVE (in module curses): Constants<6>. (line 323) +* KEY_SBEG (in module curses): Constants<6>. (line 326) +* KEY_SCANCEL (in module curses): Constants<6>. (line 329) +* KEY_SCOMMAND (in module curses): Constants<6>. (line 332) +* KEY_SCOPY (in module curses): Constants<6>. (line 335) +* KEY_SCREATE (in module curses): Constants<6>. (line 338) +* KEY_SDC (in module curses): Constants<6>. (line 341) +* KEY_SDL (in module curses): Constants<6>. (line 344) +* KEY_SELECT (in module curses): Constants<6>. (line 347) +* KEY_SEND (in module curses): Constants<6>. (line 350) +* KEY_SEOL (in module curses): Constants<6>. (line 353) +* KEY_SET_VALUE (in module winreg): Access Rights. (line 34) +* KEY_SEXIT (in module curses): Constants<6>. (line 356) +* KEY_SF (in module curses): Constants<6>. (line 200) +* KEY_SFIND (in module curses): Constants<6>. (line 359) +* KEY_SHELP (in module curses): Constants<6>. (line 362) +* KEY_SHOME (in module curses): Constants<6>. (line 365) +* KEY_SIC (in module curses): Constants<6>. (line 368) +* KEY_SLEFT (in module curses): Constants<6>. (line 371) +* KEY_SMESSAGE (in module curses): Constants<6>. (line 374) +* KEY_SMOVE (in module curses): Constants<6>. (line 377) +* KEY_SNEXT (in module curses): Constants<6>. (line 380) +* KEY_SOPTIONS (in module curses): Constants<6>. (line 383) +* KEY_SPREVIOUS (in module curses): Constants<6>. (line 386) +* KEY_SPRINT (in module curses): Constants<6>. (line 389) +* KEY_SR (in module curses): Constants<6>. (line 203) +* KEY_SREDO (in module curses): Constants<6>. (line 392) +* KEY_SREPLACE (in module curses): Constants<6>. (line 395) +* KEY_SRESET (in module curses): Constants<6>. (line 224) +* KEY_SRIGHT (in module curses): Constants<6>. (line 398) +* KEY_SRSUME (in module curses): Constants<6>. (line 401) +* KEY_SSAVE (in module curses): Constants<6>. (line 404) +* KEY_SSUSPEND (in module curses): Constants<6>. (line 407) +* KEY_STAB (in module curses): Constants<6>. (line 212) +* KEY_SUNDO (in module curses): Constants<6>. (line 410) +* KEY_SUSPEND (in module curses): Constants<6>. (line 413) +* KEY_UNDO (in module curses): Constants<6>. (line 416) +* KEY_UP (in module curses): Constants<6>. (line 154) +* KEY_WOW64_32KEY (in module winreg): 64-bit Specific. (line 14) +* KEY_WOW64_64KEY (in module winreg): 64-bit Specific. (line 8) +* KEY_WRITE (in module winreg): Access Rights. (line 15) +* key/value pair: Dictionary displays. + (line 6) +* KeyboardInterrupt: Concrete exceptions. + (line 91) +* KeyboardInterrupt (built-in exception): Signal Handling<2>. + (line 7) +* KeyboardInterrupt (built-in exception) <1>: Signal Handling<2>. + (line 34) +* KeyboardInterrupt (built-in exception) <2>: Signal Handling<2>. + (line 43) +* KeyError: Concrete exceptions. + (line 86) +* keylog_filename (ssl.SSLContext attribute): SSL Contexts. (line 528) +* keyname() (in module curses): Functions<6>. (line 263) +* keypad() (curses.window method): Window Objects. (line 380) +* keyrefs() (weakref.WeakKeyDictionary method): weakref — Weak references. + (line 210) +* keys() (contextvars.Context method): Manual Context Management. + (line 133) +* keys() (dict method): Mapping Types — dict. + (line 196) +* keys() (email.message.EmailMessage method): email message Representing an email message. + (line 232) +* keys() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 343) +* keys() (mailbox.Mailbox method): Mailbox objects. (line 111) +* keys() (sqlite3.Row method): Row objects. (line 19) +* keys() (types.MappingProxyType method): Standard Interpreter Types. + (line 272) +* keys() (xml.etree.ElementTree.Element method): Element Objects. + (line 76) +* KeysView (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 102) +* KeysView (class in typing): Aliases to container ABCs in collections abc. + (line 50) +* keyword: Keywords. (line 6) +* keyword <1>: Soft Keywords. (line 6) +* keyword (class in ast): Expressions<2>. (line 151) +* keyword argument: Glossary. (line 871) +* keyword; as: The import statement. + (line 6) +* keyword; as <1>: The try statement. (line 6) +* keyword; as <2>: The with statement. (line 6) +* keyword; as <3>: The match statement. + (line 6) +* keyword; async: Coroutine function definition. + (line 9) +* keyword; await: Calls. (line 160) +* keyword; await <1>: Coroutine function definition. + (line 9) +* keyword; case: The match statement. + (line 6) +* keyword; elif: The if statement. (line 6) +* keyword; else: The break statement. + (line 12) +* keyword; else <1>: The if statement. (line 6) +* keyword; else <2>: The while statement. + (line 6) +* keyword; else <3>: The for statement. (line 6) +* keyword; else <4>: The try statement. (line 6) +* keyword; else <5>: except* clause. (line 57) +* keyword; except: The try statement. (line 6) +* keyword; except_star: except clause. (line 82) +* keyword; finally: The return statement. + (line 17) +* keyword; finally <1>: The break statement. + (line 18) +* keyword; finally <2>: The continue statement. + (line 6) +* keyword; finally <3>: The try statement. (line 6) +* keyword; finally <4>: else clause. (line 11) +* keyword; from: Yield expressions. (line 6) +* keyword; from <1>: The import statement. + (line 6) +* keyword; if: The match statement. + (line 6) +* keyword; in: The for statement. (line 6) +* keyword; yield: Yield expressions. (line 6) +* keywords (functools.partial attribute): partial Objects. (line 20) +* kill_python() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 77) +* kill() (asyncio.subprocess.Process method): Interacting with Subprocesses. + (line 106) +* kill() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 35) +* kill() (in module os): Process Management. (line 326) +* kill() (multiprocessing.Process method): Process and exceptions. + (line 222) +* kill() (subprocess.Popen method): Popen Objects. (line 92) +* killchar() (in module curses): Functions<6>. (line 273) +* killpg() (in module os): Process Management. (line 348) +* kind (inspect.Parameter attribute): Introspecting callables with the Signature object. + (line 229) +* knownfiles (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 136) +* kqueue() (in module select): select — Waiting for I/O completion. + (line 97) +* KqueueSelector (class in selectors): Classes<4>. (line 195) +* KW_ONLY (in module dataclasses): Module contents<4>. (line 486) +* kwargs (inspect.BoundArguments attribute): Introspecting callables with the Signature object. + (line 358) +* kwargs (typing.ParamSpec attribute): Building generic types and type aliases. + (line 410) +* kwlist (in module keyword): keyword — Testing for Python keywords. + (line 17) +* L (in module re): Flags. (line 58) +* lambda: Glossary. (line 875) +* Lambda (class in ast): Function and class definitions. + (line 32) +* lambda; expression: Lambdas. (line 6) +* lambda; expression <1>: Function definitions. + (line 128) +* lambda; form: Lambdas. (line 6) +* LambdaType (in module types): Standard Interpreter Types. + (line 25) +* LANG: GNU gettext API. (line 21) +* LANG <1>: Class-based API. (line 26) +* LANG <2>: locale — Internationalization services. + (line 52) +* LANG <3>: locale — Internationalization services. + (line 348) +* LANG <4>: locale — Internationalization services. + (line 352) +* LANGUAGE: GNU gettext API. (line 20) +* LANGUAGE <1>: Class-based API. (line 25) +* large files: Large File Support. (line 6) +* LARGEST (in module test.support): test support — Utilities for the Python test suite. + (line 185) +* LargeZipFile: zipfile — Work with ZIP archives. + (line 37) +* last_accepted (multiprocessing.connection.Listener attribute): Listeners and Clients. + (line 103) +* last_exc (in module sys): sys — System-specific parameters and functions. + (line 1221) +* last_traceback (in module sys): Traceback objects. (line 6) +* last_traceback (in module sys) <1>: sys — System-specific parameters and functions. + (line 1244) +* last_type (in module sys): sys — System-specific parameters and functions. + (line 1244) +* last_value (in module sys): sys — System-specific parameters and functions. + (line 1244) +* lastChild (xml.dom.Node attribute): Node Objects. (line 59) +* lastcmd (cmd.Cmd attribute): Cmd Objects. (line 139) +* lastgroup (re.Match attribute): Match Objects. (line 201) +* lastindex (re.Match attribute): Match Objects. (line 193) +* lastResort (in module logging): Module-Level Attributes. + (line 6) +* lastrowid (sqlite3.Cursor attribute): Cursor objects. (line 199) +* layout() (tkinter.ttk.Style method): Ttk Styling. (line 96) +* lazycache() (in module linecache): linecache — Random access to text lines. + (line 50) +* LazyLoader (class in importlib.util): importlib util – Utility code for importers. + (line 192) +* LBRACE (in module token): token — Constants used with Python parse trees. + (line 230) +* LBYL: Glossary. (line 882) +* LC_ALL: GNU gettext API. (line 20) +* LC_ALL <1>: Class-based API. (line 25) +* LC_ALL (in module locale): locale — Internationalization services. + (line 562) +* LC_COLLATE (in module locale): locale — Internationalization services. + (line 528) +* LC_CTYPE (in module locale): locale — Internationalization services. + (line 514) +* LC_MESSAGES: GNU gettext API. (line 20) +* LC_MESSAGES <1>: Class-based API. (line 26) +* LC_MESSAGES (in module locale): locale — Internationalization services. + (line 544) +* LC_MONETARY (in module locale): locale — Internationalization services. + (line 539) +* LC_NUMERIC (in module locale): locale — Internationalization services. + (line 554) +* LC_TIME (in module locale): locale — Internationalization services. + (line 534) +* lchflags() (in module os): Files and Directories. + (line 305) +* lchmod() (in module os): Files and Directories. + (line 319) +* lchmod() (pathlib.Path method): Permissions and ownership. + (line 54) +* lchown() (in module os): Files and Directories. + (line 340) +* lcm() (in module math): Number-theoretic functions. + (line 56) +* LDCXXSHARED: Build and C API Changes<8>. + (line 153) +* ldexp() (in module math): Floating point manipulation functions. + (line 77) +* LDFLAGS: New Improved and Deprecated Modules<4>. + (line 59) +* 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) +* le() (in module operator): operator — Standard operators as functions. + (line 24) +* leading whitespace: Indentation. (line 6) +* leapdays() (in module calendar): calendar — General calendar-related functions. + (line 369) +* leaveok() (curses.window method): Window Objects. (line 387) +* left (filecmp.dircmp attribute): The dircmp class. (line 45) +* left_list (filecmp.dircmp attribute): The dircmp class. (line 53) +* left_only (filecmp.dircmp attribute): The dircmp class. (line 67) +* left() (in module turtle): Turtle motion. (line 57) +* LEFTSHIFT (in module token): token — Constants used with Python parse trees. + (line 254) +* LEFTSHIFTEQUAL (in module token): token — Constants used with Python parse trees. + (line 287) +* LEGACY_TRANSACTION_CONTROL (in module sqlite3): Module constants. + (line 6) +* lenfunc (C type): Slot Type typedefs. (line 96) +* length (xml.dom.NamedNodeMap attribute): NamedNodeMap Objects. + (line 8) +* length (xml.dom.NodeList attribute): NodeList Objects. (line 21) +* length_hint() (in module operator): operator — Standard operators as functions. + (line 210) +* LESS (in module token): token — Constants used with Python parse trees. + (line 215) +* LESSEQUAL (in module token): token — Constants used with Python parse trees. + (line 242) +* level (logging.Logger attribute): Logger Objects. (line 33) +* lexical analysis: Lexical analysis. (line 6) +* lexical analyzer: Glossary. (line 896) +* lexical definitions: Notation. (line 32) +* LexicalHandler (class in xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 45) +* lexists() (in module os.path): os path — Common pathname manipulations. + (line 123) +* LF (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 52) +* lgamma() (in module math): Special functions. (line 35) +* libc_ver() (in module platform): Unix platforms. (line 6) +* LIBRARIES_ASSEMBLY_NAME_PREFIX (in module msvcrt): Other Functions. + (line 98) +* library (in module dbm.ndbm): dbm ndbm — New Database Manager. + (line 34) +* library (ssl.SSLError attribute): Exceptions<16>. (line 19) +* LibraryLoader (class in ctypes): Loading shared libraries. + (line 170) +* license (built-in variable): Constants added by the site module. + (line 30) +* LifoQueue (class in asyncio): LIFO Queue. (line 6) +* LifoQueue (class in queue): queue — A synchronized queue class. + (line 42) +* light-weight processes: _thread — Low-level threading API. + (line 6) +* limit_denominator() (fractions.Fraction method): fractions — Rational numbers. + (line 158) +* LimitOverrunError: Exceptions<13>. (line 61) +* line (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 86) +* LINE (monitoring event): Events. (line 38) +* line (traceback.FrameSummary attribute): FrameSummary Objects. + (line 43) +* line continuation: Explicit line joining. + (line 6) +* line joining: Logical lines. (line 6) +* line joining <1>: Explicit line joining. + (line 6) +* line structure: Line structure. (line 6) +* line_buffering (io.TextIOWrapper attribute): Text I/O<2>. (line 171) +* line_num (csv.csvreader attribute): Reader Objects. (line 23) +* line-buffered I/O: Built-in Functions. (line 1470) +* linear_regression() (in module statistics): Function details. + (line 628) +* lineno (ast.AST attribute): Node classes. (line 50) +* lineno (doctest.DocTest attribute): DocTest Objects. (line 42) +* lineno (doctest.Example attribute): Example Objects. (line 41) +* lineno (inspect.FrameInfo attribute): The interpreter stack. + (line 22) +* lineno (inspect.Traceback attribute): The interpreter stack. + (line 62) +* lineno (json.JSONDecodeError attribute): Exceptions<17>. (line 23) +* lineno (netrc.NetrcParseError attribute): netrc — netrc file processing. + (line 61) +* lineno (pyclbr.Class attribute): Class Objects<2>. (line 24) +* lineno (pyclbr.Function attribute): Function Objects. (line 23) +* lineno (re.PatternError attribute): Exceptions<3>. (line 28) +* lineno (shlex.shlex attribute): shlex Objects. (line 169) +* lineno (SyntaxError attribute): Concrete exceptions. + (line 321) +* lineno (traceback.FrameSummary attribute): FrameSummary Objects. + (line 34) +* lineno (traceback.TracebackException attribute): TracebackException Objects. + (line 95) +* lineno (tracemalloc.Filter attribute): Filter. (line 49) +* lineno (tracemalloc.Frame attribute): Frame. (line 17) +* lineno (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions. + (line 27) +* lineno() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 97) +* LINES: Functions<6>. (line 125) +* LINES <1>: Functions<6>. (line 595) +* LINES <2>: Functions<6>. (line 597) +* LINES (in module curses): Constants<6>. (line 53) +* lines (os.terminal_size attribute): Querying the size of a terminal. + (line 34) +* linesep (email.policy.Policy attribute): email policy Policy Objects. + (line 153) +* linesep (in module os): Miscellaneous System Information. + (line 150) +* lineterminator (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 55) +* LineTooLong: http client — HTTP protocol client. + (line 182) +* link() (in module os): Files and Directories. + (line 354) +* LinkFallbackError: tarfile — Read and write tar archive files. + (line 262) +* linkname (tarfile.TarInfo attribute): TarInfo Objects. (line 95) +* LinkOutsideDestinationError: tarfile — Read and write tar archive files. + (line 257) +* list: Glossary. (line 900) +* list (built-in class): Lists<2>. (line 10) +* List (class in ast): Literals<3>. (line 66) +* List (class in typing): Aliases to built-in types. + (line 18) +* list (pdb command): Debugger Commands. (line 240) +* list comprehension: Glossary. (line 906) +* LIST_APPEND (opcode): Python Bytecode Instructions. + (line 381) +* list_dialects() (in module csv): Module Contents<3>. (line 91) +* LIST_EXTEND (opcode): Python Bytecode Instructions. + (line 709) +* list_folders() (mailbox.Maildir method): Maildir objects. (line 65) +* list_folders() (mailbox.MH method): MH objects. (line 35) +* list; comprehensions: List displays. (line 6) +* list; display: List displays. (line 6) +* list() (imaplib.IMAP4 method): IMAP4 Objects. (line 126) +* list() (multiprocessing.managers.SyncManager method): Managers. + (line 231) +* list() (poplib.POP3 method): POP3 Objects. (line 57) +* list() (tarfile.TarFile method): TarFile Objects. (line 122) +* ListComp (class in ast): Comprehensions. (line 6) +* listdir() (in module os): Files and Directories. + (line 376) +* listdrives() (in module os): Files and Directories. + (line 413) +* listen() (in module logging.config): Configuration functions. + (line 118) +* listen() (in module turtle): Using screen events. + (line 6) +* listen() (socket.socket method): Socket Objects. (line 197) +* Listener (class in multiprocessing.connection): Listeners and Clients. + (line 50) +* listener (logging.handlers.QueueHandler attribute): QueueHandler. + (line 92) +* listMethods() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects. + (line 17) +* listmounts() (in module os): Files and Directories. + (line 432) +* listvolumes() (in module os): Files and Directories. + (line 456) +* listxattr() (in module os): Linux extended attributes. + (line 26) +* literal: Literals. (line 6) +* literal <1>: Literals<2>. (line 6) +* Literal (in module typing): Special forms. (line 132) +* literal_eval() (in module ast): ast Helpers. (line 84) +* LiteralString (in module typing): Special types. (line 67) +* LittleEndianStructure (class in ctypes): Structured data types. + (line 26) +* LittleEndianUnion (class in ctypes): Structured data types. + (line 16) +* ljust() (bytearray method): Bytes and Bytearray Operations. + (line 303) +* ljust() (bytes method): Bytes and Bytearray Operations. + (line 303) +* ljust() (str method): String Methods<2>. (line 356) +* LK_LOCK (in module msvcrt): File Operations. (line 19) +* LK_NBLCK (in module msvcrt): File Operations. (line 27) +* LK_NBRLCK (in module msvcrt): File Operations. (line 27) +* LK_RLCK (in module msvcrt): File Operations. (line 19) +* LK_UNLCK (in module msvcrt): File Operations. (line 33) +* ll (pdb command): Debugger Commands. (line 256) +* LMTP (class in smtplib): smtplib — SMTP protocol client. + (line 105) +* ln() (decimal.Context method): Context objects. (line 367) +* ln() (decimal.Decimal method): Decimal objects. (line 334) +* LNKTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 283) +* Load (class in ast): Variables. (line 11) +* LOAD_ASSERTION_ERROR (opcode): Python Bytecode Instructions. + (line 501) +* LOAD_ATTR (opcode): Python Bytecode Instructions. + (line 749) +* LOAD_BUILD_CLASS (opcode): Python Bytecode Instructions. + (line 508) +* load_cert_chain() (ssl.SSLContext method): SSL Contexts. (line 101) +* LOAD_CLOSURE (opcode): Python Bytecode Instructions. + (line 1434) +* LOAD_CONST (opcode): Python Bytecode Instructions. + (line 633) +* load_default_certs() (ssl.SSLContext method): SSL Contexts. + (line 132) +* LOAD_DEREF (opcode): Python Bytecode Instructions. + (line 977) +* load_dh_params() (ssl.SSLContext method): SSL Contexts. (line 353) +* load_extension() (sqlite3.Connection method): Connection objects. + (line 473) +* LOAD_FAST (opcode): Python Bytecode Instructions. + (line 915) +* LOAD_FAST_AND_CLEAR (opcode): Python Bytecode Instructions. + (line 939) +* LOAD_FAST_CHECK (opcode): Python Bytecode Instructions. + (line 931) +* LOAD_FAST_LOAD_FAST (opcode): Python Bytecode Instructions. + (line 924) +* LOAD_FROM_DICT_OR_DEREF (opcode): Python Bytecode Instructions. + (line 985) +* LOAD_FROM_DICT_OR_GLOBALS (opcode): Python Bytecode Instructions. + (line 652) +* LOAD_GLOBAL (opcode): Python Bytecode Instructions. + (line 908) +* LOAD_LOCALS (opcode): Python Bytecode Instructions. + (line 643) +* LOAD_METHOD (opcode): Python Bytecode Instructions. + (line 1444) +* load_module() (importlib.abc.FileLoader method): importlib abc – Abstract base classes related to import. + (line 313) +* load_module() (importlib.abc.InspectLoader method): importlib abc – Abstract base classes related to import. + (line 266) +* load_module() (importlib.abc.Loader method): importlib abc – Abstract base classes related to import. + (line 127) +* load_module() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 413) +* load_module() (importlib.machinery.SourceFileLoader method): importlib machinery – Importers and path hooks. + (line 235) +* load_module() (importlib.machinery.SourcelessFileLoader method): importlib machinery – Importers and path hooks. + (line 279) +* load_module() (zipimport.zipimporter method): zipimporter Objects. + (line 79) +* LOAD_NAME (opcode): Python Bytecode Instructions. + (line 637) +* load_package_tests() (in module test.support): test support — Utilities for the Python test suite. + (line 623) +* LOAD_SUPER_ATTR (opcode): Python Bytecode Instructions. + (line 767) +* load_verify_locations() (ssl.SSLContext method): SSL Contexts. + (line 149) +* load() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects. + (line 126) +* load() (http.cookies.BaseCookie method): Cookie Objects. (line 40) +* load() (in module json): Basic Usage. (line 107) +* load() (in module marshal): marshal — Internal Python object serialization. + (line 71) +* load() (in module pickle): Module Interface. (line 58) +* load() (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 46) +* load() (in module tomllib): tomllib — Parse TOML files. + (line 32) +* load() (pickle.Unpickler method): Module Interface. (line 271) +* load() (tracemalloc.Snapshot class method): Snapshot. (line 50) +* loader: Finders and loaders. + (line 6) +* loader <1>: Glossary. (line 915) +* Loader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 91) +* loader (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 386) +* loader_state (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 415) +* LoadError: http cookiejar — Cookie handling for HTTP clients. + (line 34) +* LoadFileDialog (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 135) +* LoadKey() (in module winreg): Functions<13>. (line 258) +* LoadLibrary() (ctypes.LibraryLoader method): Loading shared libraries. + (line 181) +* loads() (in module json): Basic Usage. (line 188) +* loads() (in module marshal): marshal — Internal Python object serialization. + (line 110) +* loads() (in module pickle): Module Interface. (line 76) +* loads() (in module plistlib): plistlib — Generate and parse Apple plist files. + (line 82) +* loads() (in module tomllib): tomllib — Parse TOML files. + (line 48) +* loads() (in module xmlrpc.client): Convenience Functions. + (line 19) +* loadTestsFromModule() (unittest.TestLoader method): Loading and running tests. + (line 41) +* loadTestsFromName() (unittest.TestLoader method): Loading and running tests. + (line 70) +* loadTestsFromNames() (unittest.TestLoader method): Loading and running tests. + (line 104) +* loadTestsFromTestCase() (unittest.TestLoader method): Loading and running tests. + (line 29) +* local (class in threading): Thread-local data. (line 127) +* LOCAL_CREDS (in module socket): Constants<8>. (line 321) +* LOCAL_CREDS_PERSISTENT (in module socket): Constants<8>. (line 321) +* localcontext() (in module decimal): Context objects. (line 25) +* LOCALE (in module re): Flags. (line 58) +* locale encoding: Glossary. (line 929) +* localeconv() (in module locale): locale — Internationalization services. + (line 56) +* LocaleHTMLCalendar (class in calendar): calendar — General calendar-related functions. + (line 336) +* LocaleTextCalendar (class in calendar): calendar — General calendar-related functions. + (line 330) +* localize() (in module locale): locale — Internationalization services. + (line 496) +* localName (xml.dom.Attr attribute): Attr Objects. (line 13) +* localName (xml.dom.Node attribute): Node Objects. (line 64) +* localtime() (in module email.utils): email utils Miscellaneous utilities. + (line 13) +* localtime() (in module time): Functions<5>. (line 149) +* Locator (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 43) +* Lock (class in asyncio): Lock. (line 6) +* Lock (class in multiprocessing): Synchronization primitives. + (line 46) +* Lock (class in threading): Lock objects. (line 33) +* lock (sys.thread_info attribute): sys — System-specific parameters and functions. + (line 1934) +* LOCK_EX (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 188) +* LOCK_NB (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 192) +* LOCK_SH (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 184) +* LOCK_UN (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 180) +* lock, interpreter: Thread State and the Global Interpreter Lock. + (line 6) +* lock() (mailbox.Babyl method): Babyl objects. (line 59) +* lock() (mailbox.Mailbox method): Mailbox objects. (line 256) +* lock() (mailbox.Maildir method): Maildir objects. (line 209) +* lock() (mailbox.mbox method): mbox objects. (line 57) +* lock() (mailbox.MH method): MH objects. (line 87) +* lock() (mailbox.MMDF method): MMDF objects. (line 47) +* Lock() (multiprocessing.managers.SyncManager method): Managers. + (line 188) +* locked() (_thread.lock method): _thread — Low-level threading API. + (line 175) +* locked() (asyncio.Condition method): Condition. (line 63) +* locked() (asyncio.Lock method): Lock. (line 58) +* locked() (asyncio.Semaphore method): Semaphore. (line 50) +* locked() (threading.Lock method): Lock objects. (line 87) +* lockf() (in module fcntl): fcntl — The fcntl and ioctl system calls. + (line 173) +* lockf() (in module os): File Descriptor Operations. + (line 265) +* locking() (in module msvcrt): File Operations. (line 6) +* LockType (in module _thread): _thread — Low-level threading API. + (line 28) +* LOG_ALERT (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_AUTH (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_AUTHPRIV (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_CONS (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_CRIT (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_CRON (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_DAEMON (in module syslog): syslog — Unix syslog library routines. + (line 123) +* log_date_time_string() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 329) +* LOG_DEBUG (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_EMERG (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_ERR (in module syslog): syslog — Unix syslog library routines. + (line 112) +* log_error() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 298) +* log_exception() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 212) +* LOG_FTP (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_INFO (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_INSTALL (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_KERN (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LAUNCHD (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL0 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL1 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL2 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL3 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL4 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL5 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL6 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LOCAL7 (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_LPR (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_MAIL (in module syslog): syslog — Unix syslog library routines. + (line 123) +* log_message() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 304) +* LOG_NDELAY (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_NETINFO (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_NEWS (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_NOTICE (in module syslog): syslog — Unix syslog library routines. + (line 112) +* LOG_NOWAIT (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_ODELAY (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_PERROR (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_PID (in module syslog): syslog — Unix syslog library routines. + (line 158) +* LOG_RAS (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_REMOTEAUTH (in module syslog): syslog — Unix syslog library routines. + (line 123) +* log_request() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 291) +* LOG_SYSLOG (in module syslog): syslog — Unix syslog library routines. + (line 123) +* log_to_stderr() (in module multiprocessing): Logging<2>. (line 24) +* LOG_USER (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_UUCP (in module syslog): syslog — Unix syslog library routines. + (line 123) +* LOG_WARNING (in module syslog): syslog — Unix syslog library routines. + (line 112) +* log() (in module cmath): Power and logarithmic functions. + (line 11) +* log() (in module logging): Module-Level Functions. + (line 99) +* log() (in module math): Power exponential and logarithmic functions. + (line 40) +* log() (logging.Logger method): Logger Objects. (line 313) +* log10() (decimal.Context method): Context objects. (line 371) +* log10() (decimal.Decimal method): Decimal objects. (line 340) +* log10() (in module cmath): Power and logarithmic functions. + (line 17) +* log10() (in module math): Power exponential and logarithmic functions. + (line 67) +* log1p() (in module math): Power exponential and logarithmic functions. + (line 48) +* log2() (in module math): Power exponential and logarithmic functions. + (line 53) +* logb() (decimal.Context method): Context objects. (line 375) +* logb() (decimal.Decimal method): Decimal objects. (line 346) +* Logger (class in logging): Logger Objects. (line 24) +* LoggerAdapter (class in logging): LoggerAdapter Objects. + (line 11) +* logical line: Logical lines. (line 6) +* logical_and() (decimal.Context method): Context objects. (line 379) +* logical_and() (decimal.Decimal method): Decimal objects. (line 354) +* logical_invert() (decimal.Context method): Context objects. + (line 384) +* logical_invert() (decimal.Decimal method): Decimal objects. + (line 360) +* logical_or() (decimal.Context method): Context objects. (line 388) +* logical_or() (decimal.Decimal method): Decimal objects. (line 365) +* logical_xor() (decimal.Context method): Context objects. (line 393) +* logical_xor() (decimal.Decimal method): Decimal objects. (line 371) +* login_cram_md5() (imaplib.IMAP4 method): IMAP4 Objects. (line 137) +* login_tty() (in module os): File Descriptor Operations. + (line 291) +* login() (ftplib.FTP method): FTP objects. (line 128) +* login() (imaplib.IMAP4 method): IMAP4 Objects. (line 132) +* login() (smtplib.SMTP method): SMTP Objects. (line 102) +* LOGNAME: Process Parameters. (line 239) +* LOGNAME <1>: getpass — Portable password input. + (line 43) +* lognormvariate() (in module random): Real-valued distributions. + (line 78) +* logout() (imaplib.IMAP4 method): IMAP4 Objects. (line 143) +* LogRecord (class in logging): LogRecord Objects. (line 11) +* LONG_MAX (C macro): Integer Objects. (line 142) +* LONG_TIMEOUT (in module test.support): test support — Utilities for the Python test suite. + (line 93) +* longMessage (unittest.TestCase attribute): Test cases. (line 702) +* longname() (in module curses): Functions<6>. (line 280) +* lookup_error() (in module codecs): Error Handlers. (line 130) +* lookup() (in module codecs): codecs — Codec registry and base classes. + (line 56) +* lookup() (in module unicodedata): unicodedata — Unicode Database. + (line 16) +* lookup() (symtable.SymbolTable method): Examining Symbol Tables. + (line 108) +* lookup() (tkinter.ttk.Style method): Ttk Styling. (line 81) +* LookupError: Base classes. (line 83) +* loop control; target: The break statement. + (line 12) +* loop_factory (unittest.IsolatedAsyncioTestCase attribute): Test cases. + (line 860) +* loop; over mutable sequence: Common Sequence Operations. + (line 75) +* loop; statement: The break statement. + (line 6) +* loop; statement <1>: The continue statement. + (line 6) +* loop; statement <2>: The while statement. + (line 6) +* loop; statement <3>: The for statement. (line 6) +* LOOPBACK_TIMEOUT (in module test.support): test support — Utilities for the Python test suite. + (line 48) +* lower() (bytearray method): Bytes and Bytearray Operations. + (line 622) +* lower() (bytes method): Bytes and Bytearray Operations. + (line 622) +* lower() (str method): String Methods<2>. (line 363) +* LPAR (in module token): token — Constants used with Python parse trees. + (line 176) +* lpAttributeList (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 60) +* lru_cache() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 143) +* lseek() (in module os): File Descriptor Operations. + (line 302) +* LShift (class in ast): Expressions<2>. (line 53) +* lshift() (in module operator): operator — Standard operators as functions. + (line 110) +* LSQB (in module token): token — Constants used with Python parse trees. + (line 182) +* lstat() (in module os): Files and Directories. + (line 477) +* lstat() (pathlib.Path method): Querying file type and status. + (line 30) +* lstrip() (bytearray method): Bytes and Bytearray Operations. + (line 315) +* lstrip() (bytes method): Bytes and Bytearray Operations. + (line 315) +* lstrip() (str method): String Methods<2>. (line 371) +* lsub() (imaplib.IMAP4 method): IMAP4 Objects. (line 150) +* Lt (class in ast): Expressions<2>. (line 108) +* lt() (in module operator): operator — Standard operators as functions. + (line 24) +* lt() (in module turtle): Turtle motion. (line 57) +* LtE (class in ast): Expressions<2>. (line 108) +* LWPCookieJar (class in http.cookiejar): FileCookieJar subclasses and co-operation with web browsers. + (line 28) +* LZMACompressor (class in lzma): Compressing and decompressing data in memory. + (line 6) +* LZMADecompressor (class in lzma): Compressing and decompressing data in memory. + (line 100) +* LZMAError: lzma — Compression using the LZMA algorithm. + (line 24) +* LZMAFile (class in lzma): Reading and writing compressed files. + (line 45) +* M (in module re): Flags. (line 82) +* mac_ver() (in module platform): macOS platform. (line 6) +* machine() (in module platform): Cross platform. (line 35) +* macros (netrc.netrc attribute): netrc Objects. (line 29) +* MADV_AUTOSYNC (in module mmap): MADV_* Constants. (line 6) +* MADV_CORE (in module mmap): MADV_* Constants. (line 6) +* MADV_DODUMP (in module mmap): MADV_* Constants. (line 6) +* MADV_DOFORK (in module mmap): MADV_* Constants. (line 6) +* MADV_DONTDUMP (in module mmap): MADV_* Constants. (line 6) +* MADV_DONTFORK (in module mmap): MADV_* Constants. (line 6) +* MADV_DONTNEED (in module mmap): MADV_* Constants. (line 6) +* MADV_FREE (in module mmap): MADV_* Constants. (line 6) +* MADV_FREE_REUSABLE (in module mmap): MADV_* Constants. (line 6) +* MADV_FREE_REUSE (in module mmap): MADV_* Constants. (line 6) +* MADV_HUGEPAGE (in module mmap): MADV_* Constants. (line 6) +* MADV_HWPOISON (in module mmap): MADV_* Constants. (line 6) +* MADV_MERGEABLE (in module mmap): MADV_* Constants. (line 6) +* MADV_NOCORE (in module mmap): MADV_* Constants. (line 6) +* MADV_NOHUGEPAGE (in module mmap): MADV_* Constants. (line 6) +* MADV_NORMAL (in module mmap): MADV_* Constants. (line 6) +* MADV_NOSYNC (in module mmap): MADV_* Constants. (line 6) +* MADV_PROTECT (in module mmap): MADV_* Constants. (line 6) +* MADV_RANDOM (in module mmap): MADV_* Constants. (line 6) +* MADV_REMOVE (in module mmap): MADV_* Constants. (line 6) +* MADV_SEQUENTIAL (in module mmap): MADV_* Constants. (line 6) +* MADV_SOFT_OFFLINE (in module mmap): MADV_* Constants. (line 6) +* MADV_UNMERGEABLE (in module mmap): MADV_* Constants. (line 6) +* MADV_WILLNEED (in module mmap): MADV_* Constants. (line 6) +* madvise() (mmap.mmap method): mmap — Memory-mapped file support. + (line 223) +* magic method: Glossary. (line 943) +* MAGIC_NUMBER (in module importlib.util): importlib util – Utility code for importers. + (line 13) +* magic; method: Glossary. (line 947) +* MagicMock (class in unittest.mock): Magic Mock. (line 9) +* Mailbox (class in mailbox): Mailbox objects. (line 6) +* Maildir (class in mailbox): Maildir objects. (line 6) +* MaildirMessage (class in mailbox): MaildirMessage objects. + (line 6) +* main_thread() (in module threading): Reference<2>. (line 106) +* main(): Process-wide parameters. + (line 7) +* main() <1>: Process-wide parameters. + (line 218) +* main() <2>: PyConfig. (line 130) +* main() (in module site): Module contents<5>. (line 42) +* main() (in module unittest): Loading and running tests. + (line 514) +* mainloop() (in module turtle): Using screen events. + (line 106) +* maintype (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects. + (line 276) +* major (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects. + (line 247) +* major() (in module os): Files and Directories. + (line 623) +* make_alternative() (email.message.EmailMessage method): email message Representing an email message. + (line 607) +* make_archive() (in module shutil): Archiving operations. + (line 14) +* make_bad_fd() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 106) +* MAKE_CELL (opcode): Python Bytecode Instructions. + (line 970) +* make_cookies() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 61) +* make_dataclass() (in module dataclasses): Module contents<4>. + (line 397) +* make_file() (difflib.HtmlDiff method): difflib — Helpers for computing deltas. + (line 112) +* MAKE_FUNCTION (opcode): Python Bytecode Instructions. + (line 1109) +* make_header() (in module email.header): email header Internationalized headers. + (line 220) +* make_legacy_pyc() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 80) +* make_mixed() (email.message.EmailMessage method): email message Representing an email message. + (line 617) +* make_msgid() (in module email.utils): email utils Miscellaneous utilities. + (line 27) +* make_parser() (in module xml.sax): xml sax — Support for SAX2 parsers. + (line 27) +* make_pkg() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 97) +* make_related() (email.message.EmailMessage method): email message Representing an email message. + (line 598) +* make_script() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 82) +* make_server() (in module wsgiref.simple_server): wsgiref simple_server – a simple WSGI HTTP server. + (line 14) +* make_table() (difflib.HtmlDiff method): difflib — Helpers for computing deltas. + (line 144) +* make_zip_pkg() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 103) +* make_zip_script() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 89) +* makedev() (in module os): Files and Directories. + (line 633) +* makedirs() (in module os): Files and Directories. + (line 542) +* makeelement() (xml.etree.ElementTree.Element method): Element Objects. + (line 164) +* makefile() (socket method): I/O objects also known as file objects. + (line 6) +* makefile() (socket.socket method): Socket Objects. (line 209) +* makeLogRecord() (in module logging): Module-Level Functions. + (line 196) +* makePickle() (logging.handlers.SocketHandler method): SocketHandler. + (line 45) +* makeRecord() (logging.Logger method): Logger Objects. (line 374) +* makeSocket() (logging.handlers.DatagramHandler method): DatagramHandler. + (line 37) +* makeSocket() (logging.handlers.SocketHandler method): SocketHandler. + (line 39) +* maketrans() (bytearray static method): Bytes and Bytearray Operations. + (line 176) +* maketrans() (bytes static method): Bytes and Bytearray Operations. + (line 176) +* maketrans() (str static method): String Methods<2>. (line 393) +* MalformedHeaderDefect: email errors Exception and Defect classes. + (line 108) +* malloc (C function): Overview<4>. (line 33) +* manager (logging.LoggerAdapter attribute): LoggerAdapter Objects. + (line 30) +* mangle_from_ (email.policy.Compat32 attribute): email policy Policy Objects. + (line 575) +* mangle_from_ (email.policy.Policy attribute): email policy Policy Objects. + (line 187) +* MANPAGER: pydoc — Documentation generator and online help system. + (line 46) +* MANPAGER <1>: pydoc — Documentation generator and online help system. + (line 48) +* mant_dig (sys.float_info attribute): sys — System-specific parameters and functions. + (line 635) +* MAP_32BIT (in module mmap): MAP_* Constants. (line 6) +* MAP_ADD (opcode): Python Bytecode Instructions. + (line 390) +* MAP_ALIGNED_SUPER (in module mmap): MAP_* Constants. (line 6) +* MAP_ANON (in module mmap): MAP_* Constants. (line 6) +* MAP_ANONYMOUS (in module mmap): MAP_* Constants. (line 6) +* map_async() (multiprocessing.pool.Pool method): Process Pools. + (line 111) +* MAP_CONCEAL (in module mmap): MAP_* Constants. (line 6) +* MAP_DENYWRITE (in module mmap): MAP_* Constants. (line 6) +* MAP_EXECUTABLE (in module mmap): MAP_* Constants. (line 6) +* MAP_HASSEMAPHORE (in module mmap): MAP_* Constants. (line 6) +* MAP_JIT (in module mmap): MAP_* Constants. (line 6) +* MAP_NOCACHE (in module mmap): MAP_* Constants. (line 6) +* MAP_NOEXTEND (in module mmap): MAP_* Constants. (line 6) +* MAP_NORESERVE (in module mmap): MAP_* Constants. (line 6) +* MAP_POPULATE (in module mmap): MAP_* Constants. (line 6) +* MAP_PRIVATE (in module mmap): MAP_* Constants. (line 6) +* MAP_RESILIENT_CODESIGN (in module mmap): MAP_* Constants. (line 6) +* MAP_RESILIENT_MEDIA (in module mmap): MAP_* Constants. (line 6) +* MAP_SHARED (in module mmap): MAP_* Constants. (line 6) +* MAP_STACK (in module mmap): MAP_* Constants. (line 6) +* map_table_b2() (in module stringprep): stringprep — Internet String Preparation. + (line 50) +* map_table_b3() (in module stringprep): stringprep — Internet String Preparation. + (line 55) +* map_to_type() (email.headerregistry.HeaderRegistry method): email headerregistry Custom Header Objects. + (line 377) +* MAP_TPRO (in module mmap): MAP_* Constants. (line 6) +* MAP_TRANSLATED_ALLOW_EXECUTE (in module mmap): MAP_* Constants. + (line 6) +* MAP_UNIX03 (in module mmap): MAP_* Constants. (line 6) +* map() (concurrent.futures.Executor method): Executor Objects. + (line 22) +* map() (multiprocessing.pool.Pool method): Process Pools. (line 94) +* map() (tkinter.ttk.Style method): Ttk Styling. (line 48) +* mapLogRecord() (logging.handlers.HTTPHandler method): HTTPHandler. + (line 27) +* mapping: Glossary. (line 947) +* Mapping (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 97) +* Mapping (class in typing): Aliases to container ABCs in collections abc. + (line 58) +* MappingProxyType (class in types): Standard Interpreter Types. + (line 224) +* MappingView (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 102) +* MappingView (class in typing): Aliases to container ABCs in collections abc. + (line 66) +* mapPriority() (logging.handlers.SysLogHandler method): SysLogHandler. + (line 201) +* maps (collections.ChainMap attribute): ChainMap objects. (line 39) +* MARCH (in module calendar): calendar — General calendar-related functions. + (line 490) +* markcoroutinefunction() (in module inspect): Types and members. + (line 409) +* marshalling; objects: pickle — Python object serialization. + (line 8) +* masking; operations: Bitwise Operations on Integer Types. + (line 6) +* master (tkinter.Tk attribute): Tkinter Modules. (line 77) +* Match (class in ast): Pattern matching. (line 6) +* Match (class in re): Match Objects. (line 15) +* Match (class in typing): Aliases to other concrete types. + (line 6) +* match_case (class in ast): Pattern matching. (line 15) +* MATCH_CLASS (opcode): Python Bytecode Instructions. + (line 1211) +* MATCH_KEYS (opcode): Python Bytecode Instructions. + (line 550) +* MATCH_MAPPING (opcode): Python Bytecode Instructions. + (line 531) +* MATCH_SEQUENCE (opcode): Python Bytecode Instructions. + (line 540) +* match_value() (test.support.Matcher method): test support — Utilities for the Python test suite. + (line 786) +* match; case: The match statement. + (line 6) +* match() (in module re): Functions<2>. (line 48) +* match() (pathlib.PurePath method): Methods and properties. + (line 285) +* match() (re.Pattern method): Regular Expression Objects. + (line 43) +* MatchAs (class in ast): Pattern matching. (line 293) +* MatchClass (class in ast): Pattern matching. (line 230) +* Matcher (class in test.support): test support — Utilities for the Python test suite. + (line 780) +* matches() (test.support.Matcher method): test support — Utilities for the Python test suite. + (line 782) +* MatchMapping (class in ast): Pattern matching. (line 184) +* MatchOr (class in ast): Pattern matching. (line 333) +* MatchSequence (class in ast): Pattern matching. (line 114) +* MatchSingleton (class in ast): Pattern matching. (line 90) +* MatchStar (class in ast): Pattern matching. (line 144) +* MatchValue (class in ast): Pattern matching. (line 63) +* matmul() (in module operator): operator — Standard operators as functions. + (line 125) +* MatMult (class in ast): Expressions<2>. (line 53) +* matrix multiplication: Binary arithmetic operations. + (line 26) +* max (datetime.date attribute): date Objects. (line 105) +* max (datetime.datetime attribute): datetime Objects. (line 293) +* max (datetime.time attribute): time Objects. (line 37) +* max (datetime.timedelta attribute): timedelta Objects. (line 93) +* max (sys.float_info attribute): sys — System-specific parameters and functions. + (line 640) +* max_10_exp (sys.float_info attribute): sys — System-specific parameters and functions. + (line 649) +* max_count (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects. + (line 60) +* MAX_EMAX (in module decimal): Constants<4>. (line 16) +* max_exp (sys.float_info attribute): sys — System-specific parameters and functions. + (line 644) +* MAX_INTERPOLATION_DEPTH (in module configparser): ConfigParser Objects. + (line 345) +* max_line_length (email.policy.Policy attribute): email policy Policy Objects. + (line 146) +* max_lines (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 268) +* max_mag() (decimal.Context method): Context objects. (line 402) +* max_mag() (decimal.Decimal method): Decimal objects. (line 384) +* max_memuse (in module test.support): test support — Utilities for the Python test suite. + (line 145) +* MAX_PREC (in module decimal): Constants<4>. (line 13) +* max_prefixlen (ipaddress.IPv4Address attribute): Address objects. + (line 49) +* max_prefixlen (ipaddress.IPv4Network attribute): Network objects. + (line 65) +* max_prefixlen (ipaddress.IPv6Address attribute): Address objects. + (line 273) +* max_prefixlen (ipaddress.IPv6Network attribute): Network objects. + (line 295) +* MAX_Py_ssize_t (in module test.support): test support — Utilities for the Python test suite. + (line 141) +* max() (decimal.Context method): Context objects. (line 398) +* max() (decimal.Decimal method): Decimal objects. (line 377) +* maxarray (reprlib.Repr attribute): Repr Objects. (line 22) +* maxdeque (reprlib.Repr attribute): Repr Objects. (line 22) +* maxdict (reprlib.Repr attribute): Repr Objects. (line 22) +* maxDiff (unittest.TestCase attribute): Test cases. (line 719) +* maxfrozenset (reprlib.Repr attribute): Repr Objects. (line 22) +* MAXIMUM_SUPPORTED (ssl.TLSVersion attribute): Constants<9>. + (line 565) +* maximum_version (ssl.SSLContext attribute): SSL Contexts. (line 539) +* maxlen (collections.deque attribute): deque objects. (line 120) +* maxlevel (reprlib.Repr attribute): Repr Objects. (line 17) +* maxlist (reprlib.Repr attribute): Repr Objects. (line 22) +* maxlong (reprlib.Repr attribute): Repr Objects. (line 34) +* maxother (reprlib.Repr attribute): Repr Objects. (line 47) +* maxset (reprlib.Repr attribute): Repr Objects. (line 22) +* maxsize (asyncio.Queue attribute): Queue. (line 23) +* maxsize (in module sys): sys — System-specific parameters and functions. + (line 1252) +* maxstring (reprlib.Repr attribute): Repr Objects. (line 39) +* maxtuple (reprlib.Repr attribute): Repr Objects. (line 22) +* maxunicode (in module sys): sys — System-specific parameters and functions. + (line 1258) +* MAXYEAR (in module datetime): Constants. (line 13) +* MAY (in module calendar): calendar — General calendar-related functions. + (line 490) +* MB_ICONASTERISK (in module winsound): winsound — Sound-playing interface for Windows. + (line 134) +* MB_ICONEXCLAMATION (in module winsound): winsound — Sound-playing interface for Windows. + (line 138) +* MB_ICONHAND (in module winsound): winsound — Sound-playing interface for Windows. + (line 142) +* MB_ICONQUESTION (in module winsound): winsound — Sound-playing interface for Windows. + (line 146) +* MB_OK (in module winsound): winsound — Sound-playing interface for Windows. + (line 150) +* mbox (class in mailbox): mbox objects. (line 6) +* mboxMessage (class in mailbox): mboxMessage objects. + (line 6) +* md5() (in module hashlib): Constructors. (line 20) +* mean (statistics.NormalDist attribute): NormalDist objects. + (line 21) +* mean() (in module statistics): Function details. (line 10) +* measure() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 63) +* median (statistics.NormalDist attribute): NormalDist objects. + (line 26) +* median_grouped() (in module statistics): Function details. (line 274) +* median_high() (in module statistics): Function details. (line 256) +* median_low() (in module statistics): Function details. (line 238) +* median() (in module statistics): Function details. (line 211) +* member_names (enum.EnumDict attribute): Data Types<2>. (line 749) +* member() (in module enum): Utilities and Decorators. + (line 80) +* MemberDescriptorType (in module types): Standard Interpreter Types. + (line 208) +* membership; test: Membership test operations. + (line 36) +* memfd_create() (in module os): Files and Directories. + (line 1802) +* memmove() (in module ctypes): Utility functions. (line 166) +* MemoryBIO (class in ssl): Memory BIO Support<2>. + (line 134) +* MemoryError: Concrete exceptions. + (line 107) +* MemoryHandler (class in logging.handlers): MemoryHandler. (line 41) +* memoryview (built-in class): Memory Views. (line 10) +* memset() (in module ctypes): Utility functions. (line 172) +* merge() (in module heapq): heapq — Heap queue algorithm. + (line 82) +* message (BaseExceptionGroup attribute): Exception groups. (line 33) +* Message (class in email.message): email message Message Representing an email message using the compat32 API. + (line 49) +* Message (class in mailbox): Message objects. (line 6) +* Message (class in tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 21) +* message digest, MD5: hashlib — Secure hashes and message digests. + (line 8) +* message_factory (email.policy.Policy attribute): email policy Policy Objects. + (line 196) +* message_from_binary_file() (in module email): Parser API. (line 130) +* message_from_bytes() (in module email): Parser API. (line 117) +* message_from_file() (in module email): Parser API. (line 153) +* message_from_string() (in module email): Parser API. (line 143) +* MessageBeep() (in module winsound): winsound — Sound-playing interface for Windows. + (line 31) +* MessageClass (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 173) +* 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 (in module xml.parsers.expat.errors): Expat error constants. + (line 22) +* meta hooks: Import hooks. (line 6) +* meta path finder: Glossary. (line 957) +* meta_path (in module sys): sys — System-specific parameters and functions. + (line 1268) +* meta() (in module curses): Functions<6>. (line 287) +* metaclass: Metaclasses. (line 6) +* metaclass <1>: Glossary. (line 966) +* metaclass hint: Determining the appropriate metaclass. + (line 6) +* metadata() (in module importlib.metadata): Distribution metadata. + (line 6) +* MetaPathFinder (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 27) +* metavar (optparse.Option attribute): Option attributes. (line 88) +* MetavarTypeHelpFormatter (class in argparse): formatter_class. + (line 10) +* METH_CLASS (C macro): Implementing functions and methods. + (line 195) +* METH_COEXIST (C macro): Implementing functions and methods. + (line 212) +* METH_FASTCALL (C macro): Implementing functions and methods. + (line 124) +* METH_KEYWORDS (C macro): Implementing functions and methods. + (line 108) +* METH_METHOD (C macro): Implementing functions and methods. + (line 151) +* METH_NOARGS (C macro): Implementing functions and methods. + (line 169) +* METH_O (C macro): Implementing functions and methods. + (line 182) +* METH_STATIC (C macro): Implementing functions and methods. + (line 202) +* METH_VARARGS (C macro): Implementing functions and methods. + (line 98) +* method: Glossary. (line 981) +* method (urllib.request.Request attribute): Request Objects. + (line 52) +* method resolution order: Glossary. (line 989) +* method_calls (unittest.mock.Mock attribute): The Mock Class. + (line 505) +* method; call: Calls. (line 143) +* methodcaller() (in module operator): operator — Standard operators as functions. + (line 321) +* MethodDescriptorType (in module types): Standard Interpreter Types. + (line 109) +* methodHelp() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects. + (line 43) +* methods (pyclbr.Class attribute): Class Objects<2>. (line 50) +* methodSignature() (xmlrpc.client.ServerProxy.system method): ServerProxy Objects. + (line 22) +* MethodType (in module types): Standard Interpreter Types. + (line 77) +* MethodType (in module types) <1>: Function Objects<3>. + (line 14) +* MethodType (in module types) <2>: Method Objects<2>. (line 12) +* MethodWrapperType (in module types): Standard Interpreter Types. + (line 96) +* metrics() (tkinter.font.Font method): tkinter font — Tkinter font wrapper. + (line 69) +* MFD_ALLOW_SEALING (in module os): Files and Directories. + (line 1820) +* MFD_CLOEXEC (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_16GB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_16MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_1GB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_1MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_256MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_2GB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_2MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_32MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_512KB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_512MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_64KB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_8MB (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_MASK (in module os): Files and Directories. + (line 1820) +* MFD_HUGE_SHIFT (in module os): Files and Directories. + (line 1820) +* MFD_HUGETLB (in module os): Files and Directories. + (line 1820) +* MH (class in mailbox): MH objects. (line 6) +* MHMessage (class in mailbox): MHMessage objects. (line 6) +* microsecond (datetime.datetime attribute): datetime Objects. + (line 330) +* microsecond (datetime.time attribute): time Objects. (line 62) +* microseconds (datetime.timedelta attribute): timedelta Objects. + (line 129) +* MIME; base64 encoding: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 8) +* MIME; content type: mimetypes — Map filenames to MIME types. + (line 8) +* MIME; headers: mimetypes — Map filenames to MIME types. + (line 26) +* MIME; headers <1>: mimetypes — Map filenames to MIME types. + (line 57) +* MIME; quoted-printable encoding: quopri — Encode and decode MIME quoted-printable data. + (line 8) +* MIMEApplication (class in email.mime.application): email mime Creating email and MIME objects from scratch. + (line 95) +* MIMEAudio (class in email.mime.audio): email mime Creating email and MIME objects from scratch. + (line 125) +* MIMEBase (class in email.mime.base): email mime Creating email and MIME objects from scratch. + (line 30) +* MIMEImage (class in email.mime.image): email mime Creating email and MIME objects from scratch. + (line 157) +* MIMEMessage (class in email.mime.message): email mime Creating email and MIME objects from scratch. + (line 190) +* MIMEMultipart (class in email.mime.multipart): email mime Creating email and MIME objects from scratch. + (line 66) +* MIMENonMultipart (class in email.mime.nonmultipart): email mime Creating email and MIME objects from scratch. + (line 55) +* MIMEPart (class in email.message): email message Representing an email message. + (line 718) +* MIMEText (class in email.mime.text): email mime Creating email and MIME objects from scratch. + (line 208) +* MimeTypes (class in mimetypes): MimeTypes Objects. (line 10) +* MIMEVersionHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 234) +* min (datetime.date attribute): date Objects. (line 101) +* min (datetime.datetime attribute): datetime Objects. (line 288) +* min (datetime.time attribute): time Objects. (line 33) +* min (datetime.timedelta attribute): timedelta Objects. (line 88) +* min (sys.float_info attribute): sys — System-specific parameters and functions. + (line 654) +* min_10_exp (sys.float_info attribute): sys — System-specific parameters and functions. + (line 667) +* MIN_EMIN (in module decimal): Constants<4>. (line 19) +* MIN_ETINY (in module decimal): Constants<4>. (line 22) +* min_exp (sys.float_info attribute): sys — System-specific parameters and functions. + (line 662) +* min_mag() (decimal.Context method): Context objects. (line 410) +* min_mag() (decimal.Decimal method): Decimal objects. (line 396) +* min() (decimal.Context method): Context objects. (line 406) +* min() (decimal.Decimal method): Decimal objects. (line 389) +* MINEQUAL (in module token): token — Constants used with Python parse trees. + (line 266) +* MINIMUM_SUPPORTED (ssl.TLSVersion attribute): Constants<9>. + (line 563) +* minimum_version (ssl.SSLContext attribute): SSL Contexts. (line 557) +* minor (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects. + (line 251) +* minor() (in module os): Files and Directories. + (line 628) +* minus: Unary arithmetic and bitwise operations. + (line 10) +* MINUS (in module token): token — Constants used with Python parse trees. + (line 200) +* minus() (decimal.Context method): Context objects. (line 414) +* minute (datetime.datetime attribute): datetime Objects. (line 322) +* minute (datetime.time attribute): time Objects. (line 54) +* MINYEAR (in module datetime): Constants. (line 8) +* mirrored() (in module unicodedata): unicodedata — Unicode Database. + (line 69) +* misc_header (cmd.Cmd attribute): Cmd Objects. (line 160) +* MisplacedEnvelopeHeaderDefect: email errors Exception and Defect classes. + (line 96) +* MISSING (contextvars.Token attribute): Context Variables. (line 94) +* MISSING (in module dataclasses): Module contents<4>. (line 482) +* MISSING (in module sys.monitoring): Callback function arguments. + (line 6) +* MISSING_C_DOCSTRINGS (in module test.support): test support — Utilities for the Python test suite. + (line 155) +* missing_compiler_executable() (in module test.support): test support — Utilities for the Python test suite. + (line 669) +* MissingHeaderBodySeparatorDefect: email errors Exception and Defect classes. + (line 100) +* MissingSectionHeaderError: Exceptions<8>. (line 60) +* mkd() (ftplib.FTP method): FTP objects. (line 340) +* mkdir() (in module os): Files and Directories. + (line 509) +* mkdir() (pathlib.Path method): Creating files and directories. + (line 21) +* mkdir() (zipfile.ZipFile method): ZipFile Objects. (line 338) +* mkdtemp() (in module tempfile): tempfile — Generate temporary files and directories. + (line 287) +* mkfifo() (in module os): Files and Directories. + (line 582) +* mknod() (in module os): Files and Directories. + (line 603) +* mkstemp() (in module tempfile): tempfile — Generate temporary files and directories. + (line 229) +* mktemp() (in module tempfile): Deprecated functions and variables. + (line 15) +* mktime_tz() (in module email.utils): email utils Miscellaneous utilities. + (line 146) +* mktime() (in module time): Functions<5>. (line 162) +* mlsd() (ftplib.FTP method): FTP objects. (line 286) +* mmap (class in mmap): mmap — Memory-mapped file support. + (line 54) +* MMDF (class in mailbox): MMDF objects. (line 6) +* MMDFMessage (class in mailbox): MMDFMessage objects. + (line 6) +* Mock (class in unittest.mock): The Mock Class. (line 24) +* mock_add_spec() (unittest.mock.Mock method): The Mock Class. + (line 249) +* mock_calls (unittest.mock.Mock attribute): The Mock Class. (line 523) +* mock_open() (in module unittest.mock): mock_open. (line 6) +* Mod (class in ast): Expressions<2>. (line 53) +* mod() (in module operator): operator — Standard operators as functions. + (line 115) +* mode (bz2.BZ2File attribute): De compression of files. + (line 130) +* mode (gzip.GzipFile attribute): gzip — Support for gzip files. + (line 144) +* mode (io.FileIO attribute): Raw File I/O. (line 56) +* mode (lzma.LZMAFile attribute): Reading and writing compressed files. + (line 100) +* mode (statistics.NormalDist attribute): NormalDist objects. + (line 31) +* mode (tarfile.TarInfo attribute): TarInfo Objects. (line 78) +* mode() (in module statistics): Function details. (line 323) +* mode() (in module turtle): Settings and special methods. + (line 6) +* modf() (in module math): Floating point arithmetic. + (line 55) +* modified() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 45) +* modify() (select.devpoll method): /dev/poll Polling Objects. + (line 49) +* modify() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 85) +* modify() (select.poll method): Polling Objects. (line 60) +* modify() (selectors.BaseSelector method): Classes<4>. (line 94) +* module: Glossary. (line 996) +* Module (class in ast): Root nodes. (line 6) +* module (pyclbr.Class attribute): Class Objects<2>. (line 16) +* module (pyclbr.Function attribute): Function Objects. (line 15) +* MODULE (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 11) +* Module browser: File menu Shell and Editor. + (line 22) +* module spec: Finders and loaders. + (line 6) +* module spec <1>: Glossary. (line 1005) +* module_from_spec() (in module importlib.util): importlib util – Utility code for importers. + (line 121) +* module; __future__: __future__ — Future statement definitions. + (line 6) +* module; __main__: Resolution of names. + (line 54) +* module; __main__ <1>: Complete Python programs. + (line 6) +* module; __main__ <2>: Complete Python programs. + (line 19) +* module; __main__ <3>: __main__ — Top-level code environment. + (line 6) +* module; __main__ <4>: runpy — Locating and executing Python modules. + (line 30) +* module; __main__ <5>: runpy — Locating and executing Python modules. + (line 101) +* module; __main__ <6>: Embedding Python<2>. + (line 12) +* module; __main__ <7>: Initializing and finalizing the interpreter. + (line 7) +* module; __main__ <8>: Sub-interpreter support. + (line 112) +* module; __main__ <9>: Sub-interpreter support. + (line 197) +* module; _locale: locale — Internationalization services. + (line 16) +* module; _thread: _thread — Low-level threading API. + (line 6) +* module; _thread <1>: High-level API. (line 49) +* module; _tkinter: Tkinter Modules. (line 150) +* module; abc: abc — Abstract Base Classes. + (line 6) +* module; aifc: aifc — Read and write AIFF and AIFC files. + (line 6) +* module; argparse: argparse — Parser for command-line options arguments and subcommands. + (line 6) +* module; array: Mutable sequences. (line 10) +* module; array <1>: Binary Sequence Types — bytes bytearray memoryview. + (line 6) +* module; array <2>: array — Efficient arrays of numeric values. + (line 6) +* module; ast: ast — Abstract Syntax Trees. + (line 6) +* module; asynchat: asynchat — Asynchronous socket command/response handler. + (line 6) +* module; asyncio: asyncio — Asynchronous I/O. + (line 6) +* module; asyncore: asyncore — Asynchronous socket handler. + (line 6) +* module; atexit: atexit — Exit handlers. + (line 6) +* module; audioop: audioop — Manipulate raw audio data. + (line 6) +* module; base64: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 6) +* module; base64 <1>: binascii — Convert between binary and ASCII. + (line 6) +* module; bdb: bdb — Debugger framework. + (line 6) +* module; bdb <1>: pdb — The Python Debugger. + (line 17) +* module; binascii: binascii — Convert between binary and ASCII. + (line 6) +* module; bisect: bisect — Array bisection algorithm. + (line 6) +* module; builtins: The dir Function. (line 47) +* module; builtins <1>: Complete Python programs. + (line 6) +* module; builtins <2>: Built-in Functions. (line 2184) +* module; builtins <3>: builtins — Built-in objects. + (line 6) +* module; builtins <4>: Embedding Python<2>. + (line 12) +* module; builtins <5>: Initializing and finalizing the interpreter. + (line 7) +* module; builtins <6>: Sub-interpreter support. + (line 112) +* module; builtins <7>: Sub-interpreter support. + (line 197) +* module; bz2: bz2 — Support for bzip2 compression. + (line 6) +* module; calendar: calendar — General calendar-related functions. + (line 6) +* module; cgi: cgi — Common Gateway Interface support. + (line 6) +* module; cgitb: cgitb — Traceback manager for CGI scripts. + (line 6) +* module; chunk: chunk — Read IFF chunked data. + (line 6) +* module; cmath: cmath — Mathematical functions for complex numbers. + (line 6) +* module; cmd: cmd — Support for line-oriented command interpreters. + (line 6) +* module; cmd <1>: pdb — The Python Debugger. + (line 17) +* module; code: code — Interpreter base classes. + (line 6) +* module; codecs: codecs — Codec registry and base classes. + (line 6) +* module; codeop: codeop — Compile Python code. + (line 6) +* module; collections: Mutable sequences. (line 11) +* module; collections <1>: collections — Container datatypes. + (line 6) +* module; collections.abc: collections abc — Abstract Base Classes for Containers. + (line 6) +* module; colorsys: colorsys — Conversions between color systems. + (line 6) +* module; compileall: compileall — Byte-compile Python libraries. + (line 6) +* module; concurrent.futures: concurrent futures — Launching parallel tasks. + (line 6) +* module; configparser: configparser — Configuration file parser. + (line 6) +* module; contextlib: contextlib — Utilities for with-statement contexts. + (line 6) +* module; contextvars: contextvars — Context Variables. + (line 6) +* module; copy: copy — Shallow and deep copy operations. + (line 6) +* module; copy <1>: copyreg — Register pickle support functions. + (line 8) +* module; copyreg: copyreg — Register pickle support functions. + (line 6) +* module; cProfile: profile and cProfile Module Reference. + (line 6) +* module; crypt: crypt — Function to check Unix passwords. + (line 6) +* module; csv: csv — CSV File Reading and Writing. + (line 6) +* module; ctypes: ctypes — A foreign function library for Python. + (line 6) +* module; curses: curses — Terminal handling for character-cell displays. + (line 6) +* module; curses.ascii: curses ascii — Utilities for ASCII characters. + (line 6) +* module; curses.panel: curses panel — A panel stack extension for curses. + (line 6) +* module; curses.textpad: curses textpad — Text input widget for curses programs. + (line 6) +* module; dataclasses: dataclasses — Data Classes. + (line 6) +* module; datetime: datetime — Basic date and time types. + (line 6) +* module; dbm: dbm — Interfaces to Unix “databases”. + (line 6) +* module; dbm.dumb: dbm dumb — Portable DBM implementation. + (line 6) +* module; dbm.gnu: Dictionaries<2>. (line 25) +* module; dbm.gnu <1>: Restrictions. (line 6) +* module; dbm.gnu <2>: dbm gnu — GNU database manager. + (line 6) +* module; dbm.ndbm: Dictionaries<2>. (line 25) +* module; dbm.ndbm <1>: Restrictions. (line 6) +* module; dbm.ndbm <2>: dbm ndbm — New Database Manager. + (line 6) +* module; dbm.sqlite3: dbm sqlite3 — SQLite backend for dbm. + (line 6) +* module; decimal: decimal — Decimal fixed-point and floating-point arithmetic. + (line 6) +* module; difflib: difflib — Helpers for computing deltas. + (line 6) +* module; dis: dis — Disassembler for Python bytecode. + (line 6) +* module; distutils: distutils — Building and installing Python modules. + (line 6) +* module; doctest: doctest — Test interactive Python examples. + (line 6) +* module; email: email — An email and MIME handling package. + (line 6) +* module; email.charset: email charset Representing character sets. + (line 6) +* module; email.contentmanager: email contentmanager Managing MIME Content. + (line 6) +* module; email.encoders: email encoders 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 Internationalized headers. + (line 6) +* module; email.headerregistry: email headerregistry Custom Header Objects. + (line 6) +* module; email.iterators: email iterators 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 95) +* module; email.mime.audio: email mime Creating email and MIME objects from scratch. + (line 125) +* module; email.mime.base: email mime Creating email and MIME objects from scratch. + (line 30) +* module; email.mime.image: email mime Creating email and MIME objects from scratch. + (line 157) +* module; email.mime.message: email mime Creating email and MIME objects from scratch. + (line 190) +* module; email.mime.multipart: email mime Creating email and MIME objects from scratch. + (line 66) +* module; email.mime.nonmultipart: email mime Creating email and MIME objects from scratch. + (line 55) +* module; email.mime.text: email mime Creating email and MIME objects from scratch. + (line 208) +* 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 — Bootstrapping the pip installer. + (line 6) +* module; enum: enum — Support for enumerations. + (line 6) +* module; errno: Concrete exceptions. + (line 155) +* module; errno <1>: errno — Standard errno system symbols. + (line 6) +* module; faulthandler: faulthandler — Dump the Python traceback. + (line 6) +* module; fcntl: fcntl — The fcntl and ioctl system calls. + (line 6) +* module; filecmp: filecmp — File and Directory Comparisons. + (line 6) +* module; fileinput: fileinput — Iterate over lines from multiple input streams. + (line 6) +* module; fnmatch: fnmatch — Unix filename pattern matching. + (line 6) +* module; fractions: fractions — Rational numbers. + (line 6) +* module; ftplib: ftplib — FTP protocol client. + (line 6) +* module; functools: functools — Higher-order functions and operations on callable objects. + (line 6) +* module; gc: gc — Garbage Collector interface. + (line 6) +* module; getopt: getopt — C-style parser for command line options. + (line 6) +* module; getpass: getpass — Portable password input. + (line 6) +* module; gettext: gettext — Multilingual internationalization services. + (line 6) +* module; glob: glob — Unix style pathname pattern expansion. + (line 6) +* module; glob <1>: fnmatch — Unix filename pattern matching. + (line 34) +* module; graphlib: graphlib — Functionality to operate with graph-like structures. + (line 6) +* module; grp: grp — The group database. + (line 6) +* module; gzip: gzip — Support for gzip files. + (line 6) +* module; hashlib: hashlib — Secure hashes and message digests. + (line 6) +* module; heapq: heapq — Heap queue algorithm. + (line 6) +* module; hmac: hmac — Keyed-Hashing for Message Authentication. + (line 6) +* module; html: html — HyperText Markup Language support. + (line 6) +* module; html.entities: html entities — Definitions of HTML general entities. + (line 6) +* module; html.parser: html parser — Simple HTML and XHTML parser. + (line 6) +* module; http: http — HTTP modules. + (line 6) +* module; http.client: http client — HTTP protocol client. + (line 6) +* module; http.cookiejar: http cookiejar — Cookie handling for HTTP clients. + (line 6) +* module; http.cookies: http cookies — HTTP state management. + (line 6) +* module; http.server: http server — HTTP servers. + (line 6) +* module; idlelib: idlelib — implementation of IDLE application. + (line 6) +* module; imaplib: imaplib — IMAP4 protocol client. + (line 6) +* module; imghdr: imghdr — Determine the type of an image. + (line 6) +* module; imp: imp — Access the import internals. + (line 6) +* module; importing: The import statement. + (line 6) +* module; importlib: importlib — The implementation of 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 – Accessing package metadata. + (line 6) +* module; importlib.resources: importlib resources – Package resource reading opening and access. + (line 6) +* module; importlib.resources.abc: importlib resources abc – Abstract base classes for resources. + (line 6) +* module; importlib.util: importlib util – Utility code for importers. + (line 6) +* module; inspect: inspect — Inspect live objects. + (line 6) +* module; io: I/O objects also known as file objects. + (line 6) +* module; io <1>: io — Core tools for working with streams. + (line 6) +* module; ipaddress: ipaddress — IPv4/IPv6 manipulation library. + (line 6) +* module; itertools: itertools — Functions creating iterators for efficient looping. + (line 6) +* module; json: Saving structured data with json. + (line 6) +* module; json <1>: json — JSON encoder and decoder. + (line 6) +* module; json.tool: Command Line Interface<2>. + (line 6) +* module; keyword: keyword — Testing for Python keywords. + (line 6) +* module; linecache: linecache — Random access to text lines. + (line 6) +* module; locale: locale — Internationalization services. + (line 6) +* module; logging: logging — Logging facility for Python. + (line 6) +* module; logging.config: logging config — Logging configuration. + (line 6) +* module; logging.handlers: logging handlers — Logging handlers. + (line 6) +* module; lzma: lzma — Compression using the LZMA algorithm. + (line 6) +* module; mailbox: mailbox — Manipulate mailboxes in various formats. + (line 6) +* module; mailcap: mailcap — Mailcap file handling. + (line 6) +* module; marshal: marshal — Internal Python object serialization. + (line 6) +* module; math: Numeric Types — int float complex. + (line 107) +* module; math <1>: math — Mathematical functions. + (line 6) +* module; math <2>: Constants<3>. (line 47) +* module; mimetypes: mimetypes — Map filenames to MIME types. + (line 6) +* module; mmap: mmap — Memory-mapped file support. + (line 6) +* module; modulefinder: modulefinder — Find modules used by a script. + (line 6) +* module; msilib: msilib — Read and write Microsoft Installer files. + (line 6) +* module; msvcrt: msvcrt — Useful routines from the MS VC++ runtime. + (line 6) +* module; multiprocessing: multiprocessing — Process-based parallelism. + (line 6) +* module; multiprocessing.connection: Listeners and Clients. + (line 6) +* module; multiprocessing.dummy: The multiprocessing dummy module. + (line 6) +* module; multiprocessing.managers: Managers. (line 19) +* module; multiprocessing.pool: Process Pools. (line 6) +* module; multiprocessing.shared_memory: multiprocessing shared_memory — Shared memory for direct access across processes. + (line 6) +* module; multiprocessing.sharedctypes: The multiprocessing sharedctypes module. + (line 6) +* module; namespace: Modules<3>. (line 21) +* module; netrc: netrc — netrc file processing. + (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 — Numeric abstract base classes. + (line 6) +* module; operator: operator — Standard operators as functions. + (line 6) +* module; optparse: optparse — Parser for command line options. + (line 6) +* module; os: os — Miscellaneous operating system interfaces. + (line 6) +* module; os <1>: posix — The most common POSIX system calls. + (line 14) +* module; os.path: os path — Common pathname manipulations. + (line 6) +* module; ossaudiodev: ossaudiodev — Access to OSS-compatible audio devices. + (line 6) +* module; pathlib: pathlib — Object-oriented filesystem paths. + (line 6) +* module; pdb: pdb — The Python Debugger. + (line 6) +* module; pickle: copy — Shallow and deep copy operations. + (line 75) +* module; pickle <1>: pickle — Python object serialization. + (line 6) +* module; pickle <2>: copyreg — Register pickle support functions. + (line 8) +* module; pickle <3>: shelve — Python object persistence. + (line 8) +* module; pickle <4>: marshal — Internal Python object serialization. + (line 15) +* module; pickletools: pickletools — Tools for pickle developers. + (line 6) +* module; pipes: pipes — Interface to shell pipelines. + (line 6) +* module; pkgutil: pkgutil — Package extension utility. + (line 6) +* module; platform: platform — Access to underlying platform’s identifying data. + (line 6) +* module; plistlib: plistlib — Generate and parse Apple plist files. + (line 6) +* module; poplib: poplib — POP3 protocol client. + (line 6) +* module; posix: posix — The most common POSIX system calls. + (line 6) +* module; pprint: pprint — Data pretty printer. + (line 6) +* module; profile: profile and cProfile Module Reference. + (line 6) +* module; pstats: The Stats Class. (line 9) +* module; pty: File Descriptor Operations. + (line 482) +* module; pty <1>: pty — Pseudo-terminal utilities. + (line 6) +* module; pwd: os path — Common pathname manipulations. + (line 136) +* module; pwd <1>: pwd — The password database. + (line 6) +* module; py_compile: py_compile — Compile Python source files. + (line 6) +* module; pyclbr: pyclbr — Python module browser support. + (line 6) +* module; pydoc: pydoc — Documentation generator and online help system. + (line 6) +* module; pyexpat: xml parsers expat — Fast XML parsing using Expat. + (line 19) +* module; queue: queue — A synchronized queue class. + (line 6) +* module; quopri: quopri — Encode and decode MIME quoted-printable data. + (line 6) +* module; random: random — Generate pseudo-random numbers. + (line 6) +* module; re: String Methods<2>. (line 6) +* module; re <1>: re — Regular expression operations. + (line 6) +* module; re <2>: fnmatch — Unix filename pattern matching. + (line 8) +* module; readline: readline — GNU readline interface. + (line 6) +* module; reprlib: reprlib — Alternate repr implementation. + (line 6) +* module; resource: resource — Resource usage information. + (line 6) +* module; rlcompleter: rlcompleter — Completion function for GNU readline. + (line 6) +* module; runpy: runpy — Locating and executing Python modules. + (line 6) +* module; sched: sched — Event scheduler. + (line 6) +* module; search; path: The Module Search Path. + (line 6) +* module; search; path <1>: linecache — Random access to text lines. + (line 30) +* module; search; path <2>: sys — System-specific parameters and functions. + (line 1328) +* module; search; path <3>: site — Site-specific configuration hook. + (line 14) +* module; search; path <4>: Embedding Python<2>. + (line 12) +* module; search; path <5>: Initializing and finalizing the interpreter. + (line 7) +* module; search; path <6>: Process-wide parameters. + (line 136) +* module; secrets: secrets — Generate secure random numbers for managing secrets. + (line 6) +* module; select: select — Waiting for I/O completion. + (line 6) +* module; selectors: selectors — High-level I/O multiplexing. + (line 6) +* module; shelve: shelve — Python object persistence. + (line 6) +* module; shelve <1>: marshal — Internal Python object serialization. + (line 15) +* module; shlex: shlex — Simple lexical analysis. + (line 6) +* module; shutil: shutil — High-level file operations. + (line 6) +* module; signal: _thread — Low-level threading API. + (line 192) +* module; signal <1>: signal — Set handlers for asynchronous events. + (line 6) +* module; signal <2>: Signal Handling<2>. (line 7) +* module; signal <3>: Signal Handling<2>. (line 34) +* module; signal <4>: Signal Handling<2>. (line 43) +* module; site: site — Site-specific configuration hook. + (line 6) +* module; sitecustomize: sitecustomize. (line 6) +* module; smtpd: smtpd — SMTP Server. + (line 6) +* module; smtplib: smtplib — SMTP protocol client. + (line 6) +* module; sndhdr: sndhdr — Determine type of sound file. + (line 6) +* module; socket: socket — Low-level networking interface. + (line 6) +* module; socket <1>: Internet Protocols and Support. + (line 6) +* module; socketserver: socketserver — A framework for network servers. + (line 6) +* module; spwd: spwd — The shadow password database. + (line 6) +* module; sqlite3: sqlite3 — DB-API 2 0 interface for SQLite databases. + (line 6) +* module; ssl: ssl — TLS/SSL wrapper for socket objects. + (line 6) +* module; stat: stat — Interpreting stat results. + (line 6) +* module; stat <1>: Files and Directories. + (line 1113) +* module; statistics: statistics — Mathematical statistics functions. + (line 6) +* module; string: string — Common string operations. + (line 6) +* module; stringprep: stringprep — Internet String Preparation. + (line 6) +* module; struct: struct — Interpret bytes as packed binary data. + (line 6) +* module; struct <1>: Socket Objects. (line 567) +* module; subprocess: subprocess — Subprocess management. + (line 6) +* module; sunau: sunau — Read and write Sun AU files. + (line 6) +* module; symtable: symtable — Access to the compiler’s symbol tables. + (line 6) +* module; sys: Standard Modules. (line 6) +* module; sys <1>: except clause. (line 59) +* module; sys <2>: Complete Python programs. + (line 6) +* module; sys <3>: Built-in Functions. (line 1470) +* module; sys <4>: sys — System-specific parameters and functions. + (line 6) +* module; sys <5>: Embedding Python<2>. + (line 12) +* module; sys <6>: Initializing and finalizing the interpreter. + (line 7) +* module; sys <7>: Sub-interpreter support. + (line 112) +* module; sys <8>: Sub-interpreter support. + (line 197) +* module; sys.monitoring: sys monitoring — Execution event monitoring. + (line 6) +* module; sysconfig: sysconfig — Provide access to Python’s configuration information. + (line 6) +* module; syslog: syslog — Unix syslog library routines. + (line 6) +* module; tabnanny: tabnanny — Detection of ambiguous indentation. + (line 6) +* module; tarfile: tarfile — Read and write tar archive files. + (line 6) +* module; telnetlib: telnetlib — Telnet client. + (line 6) +* module; tempfile: tempfile — Generate temporary files and directories. + (line 6) +* module; termios: termios — POSIX style tty control. + (line 6) +* module; test: test — Regression tests package for Python. + (line 6) +* module; test.regrtest: Running tests using the command-line interface. + (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 — Text wrapping and filling. + (line 6) +* module; threading: threading — Thread-based parallelism. + (line 6) +* module; time: time — Time access and conversions. + (line 6) +* module; timeit: timeit — Measure execution time of small code snippets. + (line 6) +* module; tkinter: tkinter — Python interface to Tcl/Tk. + (line 6) +* module; tkinter.colorchooser: tkinter colorchooser — Color choosing dialog. + (line 6) +* module; tkinter.commondialog: tkinter commondialog — Dialog window templates. + (line 6) +* module; tkinter.dnd: tkinter dnd — Drag and drop support. + (line 6) +* module; tkinter.filedialog: tkinter filedialog — File selection dialogs. + (line 6) +* module; tkinter.font: tkinter font — Tkinter font wrapper. + (line 6) +* module; tkinter.messagebox: tkinter messagebox — Tkinter message prompts. + (line 6) +* module; tkinter.scrolledtext: tkinter scrolledtext — Scrolled Text Widget. + (line 6) +* module; tkinter.simpledialog: tkinter simpledialog — Standard Tkinter input dialogs. + (line 6) +* module; tkinter.ttk: tkinter ttk — Tk themed widgets. + (line 6) +* module; token: token — Constants used with Python parse trees. + (line 6) +* module; tokenize: tokenize — Tokenizer for Python source. + (line 6) +* module; tomllib: tomllib — Parse TOML files. + (line 6) +* module; trace: trace — Trace or track Python statement execution. + (line 6) +* module; traceback: traceback — Print or retrieve a stack traceback. + (line 6) +* module; tracemalloc: tracemalloc — Trace memory allocations. + (line 6) +* module; tty: tty — Terminal control functions. + (line 6) +* module; turtle: turtle — Turtle graphics. + (line 6) +* module; turtledemo: turtledemo — Demo scripts. + (line 6) +* module; types: Type Objects. (line 6) +* module; types <1>: types — Dynamic type creation and names for built-in types. + (line 6) +* module; typing: typing — Support for type hints. + (line 6) +* module; unicodedata: unicodedata — Unicode Database. + (line 6) +* module; unittest: unittest — Unit testing framework. + (line 6) +* module; unittest.mock: unittest mock — mock object library. + (line 6) +* module; urllib: urllib — URL handling modules. + (line 6) +* module; urllib.error: urllib error — Exception classes raised by urllib request. + (line 6) +* module; urllib.parse: urllib parse — Parse URLs into components. + (line 6) +* module; urllib.request: urllib request — Extensible library for opening URLs. + (line 6) +* module; urllib.request <1>: http client — HTTP protocol client. + (line 8) +* module; urllib.response: urllib response — Response classes used by urllib. + (line 6) +* module; urllib.robotparser: urllib robotparser — Parser for robots txt. + (line 6) +* module; usercustomize: usercustomize. (line 6) +* module; uu: uu — Encode and decode uuencode files. + (line 6) +* module; uuid: uuid — UUID objects according to RFC 4122. + (line 8) +* module; venv: venv — Creation of virtual environments. + (line 6) +* module; warnings: warnings — Warning control. + (line 6) +* module; wave: wave — Read and write WAV files. + (line 6) +* module; weakref: weakref — Weak references. + (line 6) +* module; webbrowser: webbrowser — Convenient web-browser controller. + (line 6) +* module; winreg: winreg — Windows registry access. + (line 6) +* module; winsound: winsound — Sound-playing interface for Windows. + (line 6) +* module; wsgiref: wsgiref — WSGI Utilities and Reference Implementation. + (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 Processing Modules. + (line 6) +* module; xml.dom: xml dom — The Document Object Model API. + (line 6) +* module; xml.dom.minidom: xml dom minidom — Minimal DOM implementation. + (line 6) +* module; xml.dom.pulldom: xml dom pulldom — Support for building partial DOM trees. + (line 6) +* module; xml.etree.ElementInclude: Functions<10>. (line 6) +* module; xml.etree.ElementTree: xml etree ElementTree — The ElementTree XML API. + (line 6) +* module; xml.parsers.expat: xml parsers expat — Fast XML parsing using Expat. + (line 6) +* module; xml.parsers.expat.errors: Expat error constants. + (line 6) +* module; xml.parsers.expat.model: Content Model Descriptions. + (line 6) +* module; xml.sax: xml sax — Support for SAX2 parsers. + (line 6) +* module; xml.sax.handler: xml sax handler — Base classes for SAX handlers. + (line 6) +* module; xml.sax.saxutils: xml sax saxutils — SAX Utilities. + (line 6) +* module; xml.sax.xmlreader: xml sax xmlreader — Interface for XML parsers. + (line 6) +* module; xmlrpc: xmlrpc — XMLRPC server and client modules. + (line 6) +* module; xmlrpc.client: xmlrpc client — XML-RPC client access. + (line 6) +* module; xmlrpc.server: xmlrpc server — Basic XML-RPC servers. + (line 6) +* module; zipapp: zipapp — Manage executable Python zip archives. + (line 6) +* module; zipfile: zipfile — Work with ZIP archives. + (line 6) +* module; zipimport: zipimport — Import modules from Zip archives. + (line 6) +* module; zlib: zlib — Compression compatible with gzip. + (line 6) +* module; zoneinfo: zoneinfo — IANA time zone support. + (line 6) +* ModuleFinder (class in modulefinder): modulefinder — Find modules used by a script. + (line 26) +* ModuleInfo (class in pkgutil): pkgutil — Package extension utility. + (line 13) +* ModuleNotFoundError: Concrete exceptions. + (line 72) +* modules (in module sys): sys — System-specific parameters and functions. + (line 1301) +* modules (in module sys) <1>: Importing Modules<2>. + (line 9) +* modules (in module sys) <2>: Initializing and finalizing the interpreter. + (line 7) +* modules (modulefinder.ModuleFinder attribute): modulefinder — Find modules used by a script. + (line 49) +* modules_cleanup() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 71) +* modules_setup() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 67) +* ModuleSpec (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 364) +* ModuleType (class in types): Standard Interpreter Types. + (line 123) +* ModuleType (in module types): Module Objects. (line 7) +* modulo: Binary arithmetic operations. + (line 46) +* modulus (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1041) +* MON_1 (in module locale): locale — Internationalization services. + (line 239) +* MON_10 (in module locale): locale — Internationalization services. + (line 239) +* MON_11 (in module locale): locale — Internationalization services. + (line 239) +* MON_12 (in module locale): locale — Internationalization services. + (line 239) +* MON_2 (in module locale): locale — Internationalization services. + (line 239) +* MON_3 (in module locale): locale — Internationalization services. + (line 239) +* MON_4 (in module locale): locale — Internationalization services. + (line 239) +* MON_5 (in module locale): locale — Internationalization services. + (line 239) +* MON_6 (in module locale): locale — Internationalization services. + (line 239) +* MON_7 (in module locale): locale — Internationalization services. + (line 239) +* MON_8 (in module locale): locale — Internationalization services. + (line 239) +* MON_9 (in module locale): locale — Internationalization services. + (line 239) +* MONDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* monotonic_ns() (in module time): Functions<5>. (line 208) +* monotonic() (in module time): Functions<5>. (line 175) +* month (calendar.IllegalMonthError attribute): calendar — General calendar-related functions. + (line 523) +* Month (class in calendar): calendar — General calendar-related functions. + (line 508) +* month (datetime.date attribute): date Objects. (line 120) +* month (datetime.datetime attribute): datetime Objects. (line 309) +* month_abbr (in module calendar): calendar — General calendar-related functions. + (line 479) +* month_name (in module calendar): calendar — General calendar-related functions. + (line 468) +* month() (in module calendar): calendar — General calendar-related functions. + (line 402) +* monthcalendar() (in module calendar): calendar — General calendar-related functions. + (line 391) +* monthdatescalendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 111) +* monthdays2calendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 117) +* monthdayscalendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 123) +* monthrange() (in module calendar): calendar — General calendar-related functions. + (line 386) +* Morsel (class in http.cookies): Morsel Objects. (line 6) +* most_common() (collections.Counter method): Counter objects. + (line 78) +* mouseinterval() (in module curses): Functions<6>. (line 292) +* mousemask() (in module curses): Functions<6>. (line 299) +* move_to_end() (collections.OrderedDict method): OrderedDict objects. + (line 74) +* move() (curses.panel.Panel method): Panel Objects. (line 35) +* move() (curses.window method): Window Objects. (line 396) +* move() (in module shutil): Directory and files operations. + (line 334) +* move() (mmap.mmap method): mmap — Memory-mapped file support. + (line 236) +* move() (tkinter.ttk.Treeview method): ttk Treeview. (line 211) +* MozillaCookieJar (class in http.cookiejar): FileCookieJar subclasses and co-operation with web browsers. + (line 9) +* MRO: Glossary. (line 1013) +* mro() (type method): Special methods. (line 9) +* msg (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 40) +* msg (json.JSONDecodeError attribute): Exceptions<17>. (line 11) +* msg (netrc.NetrcParseError attribute): netrc — netrc file processing. + (line 53) +* msg (re.PatternError attribute): Exceptions<3>. (line 15) +* msg (traceback.TracebackException attribute): TracebackException Objects. + (line 122) +* mtime (gzip.GzipFile attribute): gzip — Support for gzip files. + (line 151) +* mtime (tarfile.TarInfo attribute): TarInfo Objects. (line 69) +* mtime() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 39) +* mul() (in module operator): operator — Standard operators as functions. + (line 120) +* Mult (class in ast): Expressions<2>. (line 53) +* MultiCall (class in xmlrpc.client): MultiCall Objects. (line 9) +* MULTILINE (in module re): Flags. (line 82) +* MultilineContinuationError: Exceptions<8>. (line 73) +* MultiLoopChildWatcher (class in asyncio): Process Watchers. + (line 106) +* multimode() (in module statistics): Function details. (line 357) +* MultipartConversionError: email errors Exception and Defect classes. + (line 42) +* MultipartInvariantViolationDefect: email errors Exception and Defect classes. + (line 116) +* multiplication: Binary arithmetic operations. + (line 16) +* multiply() (decimal.Context method): Context objects. (line 419) +* mutable: Glossary. (line 1017) +* mutable object: Objects values and types. + (line 11) +* mutable sequence; loop over: Common Sequence Operations. + (line 75) +* mutable; sequence; types: Mutable Sequence Types. + (line 6) +* MutableMapping (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 97) +* MutableMapping (class in typing): Aliases to container ABCs in collections abc. + (line 74) +* MutableSequence (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 68) +* MutableSequence (class in typing): Aliases to container ABCs in collections abc. + (line 82) +* MutableSet (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 92) +* MutableSet (class in typing): Aliases to container ABCs in collections abc. + (line 90) +* mvderwin() (curses.window method): Window Objects. (line 400) +* mvwin() (curses.window method): Window Objects. (line 407) +* myrights() (imaplib.IMAP4 method): IMAP4 Objects. (line 157) +* N_TOKENS (in module token): token — Constants used with Python parse trees. + (line 322) +* n_waiting (asyncio.Barrier attribute): Barrier. (line 98) +* n_waiting (threading.Barrier attribute): Barrier objects. (line 97) +* NAK (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 88) +* name: Identifiers and keywords. + (line 6) +* name <1>: Binding of names. (line 6) +* name <2>: Identifiers Names. (line 6) +* name (AttributeError attribute): Concrete exceptions. + (line 22) +* name (bz2.BZ2File attribute): De compression of files. + (line 136) +* Name (class in ast): Variables. (line 6) +* name (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 74) +* name (contextvars.ContextVar attribute): Context Variables. + (line 24) +* name (doctest.DocTest attribute): DocTest Objects. (line 30) +* name (email.headerregistry.BaseHeader attribute): email headerregistry Custom Header Objects. + (line 45) +* name (enum.Enum attribute): Data Types<2>. (line 124) +* name (gzip.GzipFile attribute): gzip — Support for gzip files. + (line 159) +* name (hashlib.hash attribute): Hash Objects. (line 19) +* name (hmac.HMAC attribute): hmac — Keyed-Hashing for Message Authentication. + (line 102) +* name (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line 28) +* name (ImportError attribute): Concrete exceptions. + (line 61) +* name (importlib.abc.FileLoader attribute): importlib abc – Abstract base classes related to import. + (line 305) +* name (importlib.abc.Traversable attribute): importlib abc – Abstract base classes related to import. + (line 522) +* name (importlib.machinery.AppleFrameworkLoader attribute): importlib machinery – Importers and path hooks. + (line 500) +* name (importlib.machinery.ExtensionFileLoader attribute): importlib machinery – Importers and path hooks. + (line 306) +* name (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 380) +* name (importlib.machinery.SourceFileLoader attribute): importlib machinery – Importers and path hooks. + (line 212) +* name (importlib.machinery.SourcelessFileLoader attribute): importlib machinery – Importers and path hooks. + (line 256) +* name (importlib.resources.abc.Traversable attribute): importlib resources abc – Abstract base classes for resources. + (line 94) +* name (in module os): os — Miscellaneous operating system interfaces. + (line 55) +* NAME (in module token): token — Constants used with Python parse trees. + (line 45) +* name (inspect.Parameter attribute): Introspecting callables with the Signature object. + (line 205) +* name (io.FileIO attribute): Raw File I/O. (line 60) +* name (logging.Logger attribute): Logger Objects. (line 26) +* name (lzma.LZMAFile attribute): Reading and writing compressed files. + (line 106) +* name (multiprocessing.Process attribute): Process and exceptions. + (line 115) +* name (multiprocessing.shared_memory.SharedMemory attribute): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 120) +* name (NameError attribute): Concrete exceptions. + (line 126) +* name (os.DirEntry attribute): Files and Directories. + (line 941) +* name (pathlib.PurePath attribute): Methods and properties. + (line 122) +* name (pyclbr.Class attribute): Class Objects<2>. (line 20) +* name (pyclbr.Function attribute): Function Objects. (line 19) +* name (sys.thread_info attribute): sys — System-specific parameters and functions. + (line 1921) +* name (tarfile.TarInfo attribute): TarInfo Objects. (line 61) +* name (tempfile.TemporaryDirectory attribute): tempfile — Generate temporary files and directories. + (line 194) +* name (threading.Thread attribute): Thread objects. (line 153) +* name (traceback.FrameSummary attribute): FrameSummary Objects. + (line 38) +* name (webbrowser.controller attribute): Browser Controller Objects. + (line 10) +* name (xml.dom.Attr attribute): Attr Objects. (line 8) +* name (xml.dom.DocumentType attribute): DocumentType Objects. + (line 33) +* name (zipfile.Path attribute): Path Objects. (line 31) +* name; binding: The import statement. + (line 6) +* name; binding <1>: The import statement. + (line 52) +* name; binding <2>: Function definitions. + (line 6) +* name; binding <3>: Function definitions. + (line 6) +* name; binding <4>: Class definitions. (line 6) +* name; mangling: Private Variables. (line 13) +* name; mangling <1>: Identifiers Names. (line 14) +* name() (in module unicodedata): unicodedata — Unicode Database. + (line 25) +* name2codepoint (in module html.entities): html entities — Definitions of HTML general entities. + (line 30) +* named expression: Boolean operations. (line 38) +* Named Shared Memory: multiprocessing shared_memory — Shared memory for direct access across processes. + (line 10) +* named tuple: Glossary. (line 1022) +* NAMED_FLAGS (enum.EnumCheck attribute): Data Types<2>. (line 643) +* NamedExpr (class in ast): Expressions<2>. (line 184) +* NamedTemporaryFile() (in module tempfile): tempfile — Generate temporary files and directories. + (line 74) +* NamedTuple (class in typing): Other special directives. + (line 10) +* namedtuple() (in module collections): namedtuple Factory Function for Tuples with Named Fields. + (line 11) +* NameError: Concrete exceptions. + (line 118) +* NameError (built-in exception): Resolution of names. + (line 16) +* namelist() (zipfile.ZipFile method): ZipFile Objects. (line 126) +* nameprep() (in module encodings.idna): encodings idna — Internationalized Domain Names in Applications. + (line 50) +* namer (logging.handlers.BaseRotatingHandler attribute): BaseRotatingHandler. + (line 17) +* namereplace_errors() (in module codecs): Error Handlers. (line 181) +* namereplace; error handler's name: Error Handlers. (line 54) +* names() (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 92) +* namespace: Naming and binding. (line 6) +* namespace <1>: Glossary. (line 1049) +* Namespace (class in argparse): The Namespace object. + (line 6) +* Namespace (class in multiprocessing.managers): Managers. (line 243) +* namespace package: Glossary. (line 1063) +* NAMESPACE_DNS (in module uuid): uuid — UUID objects according to RFC 4122. + (line 206) +* NAMESPACE_OID (in module uuid): uuid — UUID objects according to RFC 4122. + (line 215) +* NAMESPACE_URL (in module uuid): uuid — UUID objects according to RFC 4122. + (line 211) +* NAMESPACE_X500 (in module uuid): uuid — UUID objects according to RFC 4122. + (line 219) +* namespace() (imaplib.IMAP4 method): IMAP4 Objects. (line 162) +* Namespace() (multiprocessing.managers.SyncManager method): Managers. + (line 193) +* NamespaceErr: Exceptions<20>. (line 66) +* NamespaceLoader (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 347) +* namespaceURI (xml.dom.Node attribute): Node Objects. (line 74) +* nametofont() (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 96) +* NaN: Built-in Functions. (line 726) +* nan (in module cmath): Constants<3>. (line 33) +* nan (in module math): Constants<2>. (line 31) +* nan (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1049) +* nanj (in module cmath): Constants<3>. (line 40) +* NannyNag: tabnanny — Detection of ambiguous indentation. + (line 37) +* napms() (in module curses): Functions<6>. (line 308) +* nargs (optparse.Option attribute): Option attributes. (line 50) +* native_id (threading.Thread attribute): Thread objects. (line 175) +* nbytes (memoryview attribute): Memory Views. (line 380) +* ncurses_version (in module curses): Constants<6>. (line 24) +* ND (inspect.BufferFlags attribute): Buffer flags. (line 21) +* ndiff() (in module difflib): difflib — Helpers for computing deltas. + (line 233) +* ndim (memoryview attribute): Memory Views. (line 446) +* ne() (in module operator): operator — Standard operators as functions. + (line 24) +* needs_input (bz2.BZ2Decompressor attribute): Incremental de compression. + (line 85) +* needs_input (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory. + (line 175) +* neg() (in module operator): operator — Standard operators as functions. + (line 132) +* negation: Unary arithmetic and bitwise operations. + (line 10) +* nested scope: Glossary. (line 1079) +* nested_scopes (in module __future__): Module Contents<5>. (line 14) +* netmask (ipaddress.IPv4Network attribute): Network objects. + (line 101) +* netmask (ipaddress.IPv6Network attribute): Network objects. + (line 315) +* NetmaskValueError: Custom Exceptions. (line 13) +* netrc (class in netrc): netrc — netrc file processing. + (line 13) +* NetrcParseError: netrc — netrc file processing. + (line 47) +* netscape (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects. + (line 68) +* network (ipaddress.IPv4Interface attribute): Interface objects. + (line 28) +* network (ipaddress.IPv6Interface attribute): Interface objects. + (line 76) +* network_address (ipaddress.IPv4Network attribute): Network objects. + (line 86) +* network_address (ipaddress.IPv6Network attribute): Network objects. + (line 309) +* Never (in module typing): Special types. (line 99) +* NEVER_EQ (in module test.support): test support — Utilities for the Python test suite. + (line 180) +* new_child() (collections.ChainMap method): ChainMap objects. + (line 46) +* new_class() (in module types): Dynamic Type Creation. + (line 6) +* new_event_loop() (asyncio.AbstractEventLoopPolicy method): Policy Objects. + (line 27) +* new_event_loop() (in module asyncio): Event Loop. (line 67) +* new_panel() (in module curses.panel): Functions<7>. (line 12) +* new-style class: Glossary. (line 1089) +* new() (in module hashlib): Constructors. (line 6) +* new() (in module hmac): hmac — Keyed-Hashing for Message Authentication. + (line 15) +* newfunc (C type): Slot Type typedefs. (line 31) +* NEWLINE (in module token): token — Constants used with Python parse trees. + (line 76) +* NEWLINE token: Logical lines. (line 6) +* NEWLINE token <1>: Compound statements. + (line 55) +* newlines (io.TextIOBase attribute): Text I/O<2>. (line 24) +* newpad() (in module curses): Functions<6>. (line 312) +* NewType (class in typing): Other special directives. + (line 102) +* newwin() (in module curses): Functions<6>. (line 332) +* next (pdb command): Debugger Commands. (line 202) +* next_minus() (decimal.Context method): Context objects. (line 423) +* next_minus() (decimal.Decimal method): Decimal objects. (line 401) +* next_plus() (decimal.Context method): Context objects. (line 427) +* next_plus() (decimal.Decimal method): Decimal objects. (line 407) +* next_toward() (decimal.Context method): Context objects. (line 431) +* next_toward() (decimal.Decimal method): Decimal objects. (line 413) +* next() (tarfile.TarFile method): TarFile Objects. (line 132) +* next() (tkinter.ttk.Treeview method): ttk Treeview. (line 222) +* nextafter() (in module math): Floating point manipulation functions. + (line 82) +* nextfile() (in module fileinput): fileinput — Iterate over lines from multiple input streams. + (line 121) +* nextkey() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 93) +* nextSibling (xml.dom.Node attribute): Node Objects. (line 42) +* ngettext() (gettext.GNUTranslations method): The GNUTranslations class. + (line 47) +* ngettext() (gettext.NullTranslations method): The NullTranslations class. + (line 41) +* ngettext() (in module gettext): GNU gettext API. (line 44) +* nice() (in module os): Process Management. (line 357) +* NL (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 55) +* NL (in module token): token — Constants used with Python parse trees. + (line 80) +* nl_langinfo() (in module locale): locale — Internationalization services. + (line 175) +* nl() (in module curses): Functions<6>. (line 342) +* nlargest() (in module heapq): heapq — Heap queue algorithm. + (line 109) +* nlst() (ftplib.FTP method): FTP objects. (line 301) +* NO (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 159) +* no_cache() (zoneinfo.ZoneInfo class method): The ZoneInfo class. + (line 41) +* NO_EVENTS (monitoring event): Events. (line 94) +* no_proxy: urllib request — Extensible library for opening URLs. + (line 311) +* no_site (sys.flags attribute): sys — System-specific parameters and functions. + (line 550) +* no_tracing() (in module test.support): test support — Utilities for the Python test suite. + (line 538) +* no_type_check_decorator() (in module typing): Functions and decorators. + (line 360) +* no_type_check() (in module typing): Functions and decorators. + (line 348) +* no_user_site (sys.flags attribute): sys — System-specific parameters and functions. + (line 547) +* NoBoundaryInMultipartDefect: email errors Exception and Defect classes. + (line 75) +* nocbreak() (in module curses): Functions<6>. (line 348) +* NoDataAllowedErr: Exceptions<20>. (line 83) +* node (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 119) +* node() (in module platform): Cross platform. (line 40) +* NoDefault (in module typing): Introspection helpers. + (line 164) +* nodelay() (curses.window method): Window Objects. (line 411) +* nodeName (xml.dom.Node attribute): Node Objects. (line 79) +* NodeTransformer (class in ast): ast Helpers. (line 224) +* nodeType (xml.dom.Node attribute): Node Objects. (line 8) +* nodeValue (xml.dom.Node attribute): Node Objects. (line 88) +* NodeVisitor (class in ast): ast Helpers. (line 184) +* noecho() (in module curses): Functions<6>. (line 353) +* NOEXPR (in module locale): locale — Internationalization services. + (line 284) +* NOFLAG (in module re): Flags. (line 96) +* NoModificationAllowedErr: Exceptions<20>. (line 88) +* NonCallableMagicMock (class in unittest.mock): Magic Mock. (line 22) +* NonCallableMock (class in unittest.mock): The Mock Class. (line 581) +* None (Built-in object): Truth Value Testing. + (line 15) +* None (built-in variable): Built-in Constants. (line 18) +* NoneType (in module types): Standard Interpreter Types. + (line 19) +* nonl() (in module curses): Functions<6>. (line 357) +* Nonlocal (class in ast): Function and class definitions. + (line 145) +* nonmember() (in module enum): Utilities and Decorators. + (line 86) +* noop() (imaplib.IMAP4 method): IMAP4 Objects. (line 166) +* noop() (poplib.POP3 method): POP3 Objects. (line 79) +* NoOptionError: Exceptions<8>. (line 32) +* NOP (opcode): Python Bytecode Instructions. + (line 134) +* noqiflush() (in module curses): Functions<6>. (line 367) +* noraw() (in module curses): Functions<6>. (line 375) +* NoReturn (in module typing): Special types. (line 99) +* NORMAL (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 15) +* NORMAL_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 96) +* NormalDist (class in statistics): NormalDist objects. (line 13) +* normalize_encoding() (in module encodings): encodings — Encodings package. + (line 8) +* NORMALIZE_WHITESPACE (in module doctest): Option Flags. (line 37) +* normalize() (decimal.Context method): Context objects. (line 435) +* normalize() (decimal.Decimal method): Decimal objects. (line 421) +* normalize() (in module locale): locale — Internationalization services. + (line 425) +* normalize() (in module unicodedata): unicodedata — Unicode Database. + (line 81) +* normalize() (xml.dom.Node method): Node Objects. (line 141) +* normalvariate() (in module random): Real-valued distributions. + (line 85) +* normcase() (in module os.path): os path — Common pathname manipulations. + (line 327) +* normpath() (in module os.path): os path — Common pathname manipulations. + (line 336) +* NoSectionError: Exceptions<8>. (line 10) +* NoSuchMailboxError: Exceptions<18>. (line 12) +* Not (class in ast): Expressions<2>. (line 27) +* not_() (in module operator): operator — Standard operators as functions. + (line 49) +* NotADirectoryError: OS exceptions. (line 89) +* notation: Notation. (line 6) +* notationDecl() (xml.sax.handler.DTDHandler method): DTDHandler Objects. + (line 8) +* NotationDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 313) +* notations (xml.dom.DocumentType attribute): DocumentType Objects. + (line 46) +* NotConnected: http client — HTTP protocol client. + (line 136) +* Notebook (class in tkinter.ttk): ttk Notebook. (line 6) +* NotEmptyError: Exceptions<18>. (line 19) +* NotEq (class in ast): Expressions<2>. (line 108) +* NOTEQUAL (in module token): token — Constants used with Python parse trees. + (line 239) +* NotFoundErr: Exceptions<20>. (line 72) +* notify_all() (asyncio.Condition method): Condition. (line 67) +* notify_all() (threading.Condition method): Condition objects. + (line 172) +* notify() (asyncio.Condition method): Condition. (line 54) +* notify() (threading.Condition method): Condition objects. (line 152) +* notimeout() (curses.window method): Window Objects. (line 415) +* NotImplemented (built-in variable): Built-in Constants. (line 25) +* NotImplementedError: Concrete exceptions. + (line 132) +* NotImplementedType (in module types): Standard Interpreter Types. + (line 103) +* NotIn (class in ast): Expressions<2>. (line 108) +* NotRequired (in module typing): Special forms. (line 260) +* NOTSET (in module logging): Logging Levels. (line 16) +* NotStandaloneHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 364) +* NotSupportedErr: Exceptions<20>. (line 78) +* NotSupportedError: Exceptions<7>. (line 85) +* noutrefresh() (curses.window method): Window Objects. (line 423) +* NOVEMBER (in module calendar): calendar — General calendar-related functions. + (line 490) +* now() (datetime.datetime class method): datetime Objects. (line 61) +* npgettext() (gettext.GNUTranslations method): The GNUTranslations class. + (line 79) +* npgettext() (gettext.NullTranslations method): The NullTranslations class. + (line 55) +* npgettext() (in module gettext): GNU gettext API. (line 67) +* NSIG (in module signal): Module contents<2>. (line 208) +* nsmallest() (in module heapq): heapq — Heap queue algorithm. + (line 117) +* NTEventLogHandler (class in logging.handlers): NTEventLogHandler. + (line 11) +* ntohl() (in module socket): Other functions<2>. (line 225) +* ntohs() (in module socket): Other functions<2>. (line 232) +* ntransfercmd() (ftplib.FTP method): FTP objects. (line 278) +* NUL (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 19) +* null; operation: The pass statement. (line 6) +* null; operation <1>: The pass statement. (line 6) +* nullcontext() (in module contextlib): Utilities. (line 220) +* NullHandler (class in logging): NullHandler. (line 12) +* NullTranslations (class in gettext): The NullTranslations class. + (line 13) +* num_addresses (ipaddress.IPv4Network attribute): Network objects. + (line 128) +* num_addresses (ipaddress.IPv6Network attribute): Network objects. + (line 327) +* num_tickets (ssl.SSLContext attribute): SSL Contexts. (line 564) +* number: Numeric literals. (line 6) +* Number (class in numbers): numbers — Numeric abstract base classes. + (line 15) +* NUMBER (in module token): token — Constants used with Python parse trees. + (line 50) +* number_class() (decimal.Context method): Context objects. (line 439) +* number_class() (decimal.Decimal method): Decimal objects. (line 444) +* numerator (fractions.Fraction attribute): fractions — Rational numbers. + (line 115) +* numerator (numbers.Rational attribute): The numeric tower. (line 51) +* numeric literal: Numeric literals. (line 6) +* numeric; conversions: Numeric Types — int float complex. + (line 107) +* numeric; literals: Numeric Types — int float complex. + (line 19) +* numeric() (in module unicodedata): unicodedata — Unicode Database. + (line 43) +* numinput() (in module turtle): Input methods. (line 22) +* O_APPEND (in module os): File Descriptor Operations. + (line 420) +* O_ASYNC (in module os): File Descriptor Operations. + (line 463) +* O_BINARY (in module os): File Descriptor Operations. + (line 442) +* O_CLOEXEC (in module os): File Descriptor Operations. + (line 430) +* O_CREAT (in module os): File Descriptor Operations. + (line 420) +* O_DIRECT (in module os): File Descriptor Operations. + (line 463) +* O_DIRECTORY (in module os): File Descriptor Operations. + (line 463) +* O_DSYNC (in module os): File Descriptor Operations. + (line 430) +* O_EVTONLY (in module os): File Descriptor Operations. + (line 452) +* O_EXCL (in module os): File Descriptor Operations. + (line 420) +* O_EXLOCK (in module os): File Descriptor Operations. + (line 463) +* O_FSYNC (in module os): File Descriptor Operations. + (line 452) +* O_NDELAY (in module os): File Descriptor Operations. + (line 430) +* O_NOATIME (in module os): File Descriptor Operations. + (line 463) +* O_NOCTTY (in module os): File Descriptor Operations. + (line 430) +* O_NOFOLLOW (in module os): File Descriptor Operations. + (line 463) +* O_NOFOLLOW_ANY (in module os): File Descriptor Operations. + (line 452) +* O_NOINHERIT (in module os): File Descriptor Operations. + (line 442) +* O_NONBLOCK (in module os): File Descriptor Operations. + (line 430) +* O_PATH (in module os): File Descriptor Operations. + (line 463) +* O_RANDOM (in module os): File Descriptor Operations. + (line 442) +* O_RDONLY (in module os): File Descriptor Operations. + (line 420) +* O_RDWR (in module os): File Descriptor Operations. + (line 420) +* O_RSYNC (in module os): File Descriptor Operations. + (line 430) +* O_SEQUENTIAL (in module os): File Descriptor Operations. + (line 442) +* O_SHLOCK (in module os): File Descriptor Operations. + (line 463) +* O_SHORT_LIVED (in module os): File Descriptor Operations. + (line 442) +* O_SYMLINK (in module os): File Descriptor Operations. + (line 452) +* O_SYNC (in module os): File Descriptor Operations. + (line 430) +* O_TEMPORARY (in module os): File Descriptor Operations. + (line 442) +* O_TEXT (in module os): File Descriptor Operations. + (line 442) +* O_TMPFILE (in module os): File Descriptor Operations. + (line 463) +* O_TRUNC (in module os): File Descriptor Operations. + (line 420) +* O_WRONLY (in module os): File Descriptor Operations. + (line 420) +* obj (AttributeError attribute): Concrete exceptions. + (line 26) +* obj (memoryview attribute): Memory Views. (line 369) +* object: Objects values and types. + (line 6) +* object <1>: Glossary. (line 1097) +* object (built-in class): Built-in Functions. (line 1241) +* object (UnicodeError attribute): Concrete exceptions. + (line 453) +* object; asynchronous-generator: Asynchronous generator functions<2>. + (line 66) +* object; Boolean: numbers Integral. (line 27) +* object; Boolean <1>: Numeric Types — int float complex. + (line 6) +* object; built-in function: Built-in functions. (line 6) +* object; built-in function <1>: Calls. (line 143) +* object; built-in method: Built-in methods. (line 6) +* object; built-in method <1>: Calls. (line 143) +* object; bytearray: Mutable Sequence Types. + (line 6) +* object; bytearray <1>: Binary Sequence Types — bytes bytearray memoryview. + (line 6) +* object; bytearray <2>: Bytearray Objects. (line 6) +* object; bytearray <3>: Byte Array Objects. (line 6) +* object; bytes: Binary Sequence Types — bytes bytearray memoryview. + (line 6) +* object; bytes <1>: Bytes Objects. (line 6) +* object; bytes <2>: Bytes Objects<2>. (line 9) +* object; callable: Callable types. (line 6) +* object; callable <1>: Slicings. (line 39) +* object; Capsule: Capsules<2>. (line 6) +* object; class: Custom classes. (line 19) +* object; class <1>: Calls. (line 148) +* object; class <2>: Class definitions. (line 6) +* object; class instance: Custom classes. (line 19) +* object; class instance <1>: Class instances. (line 6) +* object; class instance <2>: Calls. (line 152) +* object; code: Code objects. (line 6) +* object; code <1>: Methods. (line 44) +* object; code <2>: marshal — Internal Python object serialization. + (line 33) +* object; code <3>: Cell Objects. (line 58) +* object; complex: numbers Complex complex. + (line 6) +* object; complex number: Numeric Types — int float complex. + (line 6) +* object; complex number <1>: Complex Number Objects. + (line 6) +* object; deallocation: Finalization and De-allocation. + (line 6) +* object; dictionary: Dictionaries<2>. (line 6) +* object; dictionary <1>: Custom classes. (line 19) +* object; dictionary <2>: Basic customization. + (line 241) +* object; dictionary <3>: Dictionary displays. + (line 6) +* object; dictionary <4>: Subscriptions. (line 6) +* object; dictionary <5>: Assignment statements. + (line 115) +* object; dictionary <6>: Mapping Types — dict. + (line 6) +* object; dictionary <7>: Dictionary Objects. (line 6) +* object; Ellipsis: Ellipsis. (line 6) +* object; file: Reading and Writing Files. + (line 6) +* object; file <1>: File Objects. (line 6) +* object; finalization: Finalization and De-allocation. + (line 6) +* object; floating-point: numbers Real float. (line 6) +* object; floating-point <1>: Numeric Types — int float complex. + (line 6) +* object; floating-point <2>: Floating-Point Objects. + (line 6) +* object; frame: Frame objects. (line 6) +* object; frozenset: Set types. (line 29) +* object; frozenset <1>: Set Objects. (line 6) +* object; function: User-defined functions. + (line 6) +* object; function <1>: Built-in functions. (line 6) +* object; function <2>: Calls. (line 132) +* object; function <3>: Calls. (line 143) +* object; function <4>: Function definitions. + (line 6) +* object; function <5>: Function Objects<3>. + (line 6) +* object; generator: Special read-only attributes<2>. + (line 89) +* object; generator <1>: Generator expressions. + (line 6) +* object; generator <2>: Yield expressions. (line 110) +* object; GenericAlias: Generic Alias Type. (line 6) +* object; immutable: Immutable sequences. + (line 6) +* object; immutable sequence: Immutable sequences. + (line 6) +* object; instance: Custom classes. (line 19) +* object; instance <1>: Class instances. (line 6) +* object; instance <2>: Calls. (line 152) +* object; instancemethod: Instance Method Objects. + (line 6) +* object; integer: numbers Integral. (line 6) +* object; integer <1>: Numeric Types — int float complex. + (line 6) +* object; integer <2>: Integer Objects. (line 6) +* object; io.StringIO: Text Sequence Type — str. + (line 36) +* object; list: Mutable sequences. (line 18) +* object; list <1>: List displays. (line 6) +* object; list <2>: Attribute references. + (line 10) +* object; list <3>: Subscriptions. (line 6) +* object; list <4>: Slicings. (line 6) +* object; list <5>: Assignment statements. + (line 106) +* object; list <6>: Mutable Sequence Types. + (line 6) +* object; list <7>: Lists<2>. (line 6) +* object; list <8>: List Objects. (line 6) +* object; long integer: Integer Objects. (line 6) +* object; mapping: Mappings. (line 6) +* object; mapping <1>: Class instances. (line 26) +* object; mapping <2>: Subscriptions. (line 6) +* object; mapping <3>: Assignment statements. + (line 115) +* object; mapping <4>: Mapping Types — dict. + (line 6) +* object; mapping <5>: Container Objects. (line 6) +* object; memoryview: Binary Sequence Types — bytes bytearray memoryview. + (line 6) +* object; memoryview <1>: Ellipsis Object. (line 19) +* object; method: Instance Objects. (line 26) +* object; method <1>: Instance methods. (line 6) +* object; method <2>: Built-in methods. (line 6) +* object; method <3>: Calls. (line 143) +* object; method <4>: Methods. (line 6) +* object; method <5>: Method Objects<2>. (line 6) +* object; module: Modules<3>. (line 6) +* object; module <1>: Attribute references. + (line 10) +* object; module <2>: Module Objects. (line 6) +* object; mutable: Mutable sequences. (line 6) +* object; mutable <1>: Assignment statements. + (line 6) +* object; mutable <2>: Assignment statements. + (line 101) +* object; mutable sequence: Mutable sequences. (line 6) +* object; None: None. (line 6) +* object; None <1>: Expression statements. + (line 17) +* object; None <2>: The None Object. (line 6) +* object; NotImplemented: NotImplemented. (line 6) +* object; numeric: numbers Number. (line 6) +* object; numeric <1>: Class instances. (line 26) +* object; numeric <2>: Comparisons<2>. (line 43) +* object; numeric <3>: Numeric Types — int float complex. + (line 6) +* object; numeric <4>: Numeric Objects. (line 6) +* object; range: Ranges. (line 6) +* object; sequence: Sequences. (line 6) +* object; sequence <1>: Class instances. (line 26) +* object; sequence <2>: Subscriptions. (line 6) +* object; sequence <3>: Slicings. (line 6) +* object; sequence <4>: Membership test operations. + (line 36) +* object; sequence <5>: Assignment statements. + (line 106) +* object; sequence <6>: The for statement. (line 6) +* object; sequence <7>: Common Sequence Operations. + (line 6) +* object; sequence <8>: Sequence Objects. (line 6) +* object; set: Set types. (line 23) +* object; set <1>: Set displays. (line 6) +* object; set <2>: Set Types — set frozenset. + (line 6) +* object; set <3>: Set Objects. (line 6) +* object; set type: Set types. (line 6) +* object; slice: Emulating container types. + (line 66) +* object; socket: socket — Low-level networking interface. + (line 22) +* object; string: Subscriptions. (line 6) +* object; string <1>: Slicings. (line 6) +* object; string <2>: Ranges. (line 125) +* object; traceback: Traceback objects. (line 6) +* object; traceback <1>: The raise statement. + (line 21) +* object; traceback <2>: except clause. (line 59) +* object; traceback <3>: sys — System-specific parameters and functions. + (line 460) +* object; traceback <4>: traceback — Print or retrieve a stack traceback. + (line 19) +* object; tuple: Immutable sequences. + (line 29) +* object; tuple <1>: Subscriptions. (line 6) +* object; tuple <2>: Slicings. (line 6) +* object; tuple <3>: Expression lists. (line 13) +* object; tuple <4>: Immutable Sequence Types. + (line 6) +* object; tuple <5>: Tuples. (line 6) +* object; tuple <6>: Tuple Objects. (line 6) +* object; type: Built-in Functions. (line 2017) +* object; type <1>: Objects Types and Reference Counts. + (line 6) +* object; type <2>: Type Objects<2>. (line 6) +* object; Union: Union Type. (line 6) +* object; user-defined function: User-defined functions. + (line 6) +* object; user-defined function <1>: Calls. (line 132) +* object; user-defined function <2>: Function definitions. + (line 6) +* object; user-defined method: Instance methods. (line 6) +* object.__match_args__ (built-in variable): Customizing positional arguments in class pattern matching. + (line 12) +* object.__slots__ (built-in variable): __slots__<2>. (line 14) +* objects; comparing: Comparisons<2>. (line 43) +* objobjargproc (C type): Slot Type typedefs. (line 138) +* objobjproc (C type): Slot Type typedefs. (line 134) +* octal literal: Numeric literals. (line 6) +* octal; literals: Numeric Types — int float complex. + (line 19) +* octdigits (in module string): String constants. (line 32) +* OCTOBER (in module calendar): calendar — General calendar-related functions. + (line 490) +* offset (SyntaxError attribute): Concrete exceptions. + (line 326) +* offset (tarfile.TarInfo attribute): TarInfo Objects. (line 149) +* offset (traceback.TracebackException attribute): TracebackException Objects. + (line 110) +* offset (xml.parsers.expat.ExpatError attribute): ExpatError Exceptions. + (line 32) +* offset_data (tarfile.TarInfo attribute): TarInfo Objects. (line 153) +* OK (in module curses): Constants<6>. (line 13) +* OK (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 153) +* ok_command() (tkinter.filedialog.LoadFileDialog method): Native Load/Save Dialogs. + (line 140) +* ok_command() (tkinter.filedialog.SaveFileDialog method): Native Load/Save Dialogs. + (line 150) +* ok_event() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 119) +* OKCANCEL (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 171) +* old_value (contextvars.Token attribute): Context Variables. + (line 87) +* OleDLL (class in ctypes): Loading shared libraries. + (line 35) +* on_motion() (tkinter.dnd.DndHandler method): tkinter dnd — Drag and drop support. + (line 56) +* on_release() (tkinter.dnd.DndHandler method): tkinter dnd — Drag and drop support. + (line 61) +* onclick() (in module turtle): Using screen events. + (line 56) +* ondrag() (in module turtle): Using events. (line 57) +* onecmd() (cmd.Cmd method): Cmd Objects. (line 59) +* onkey() (in module turtle): Using screen events. + (line 12) +* onkeypress() (in module turtle): Using screen events. + (line 35) +* onkeyrelease() (in module turtle): Using screen events. + (line 12) +* onrelease() (in module turtle): Using events. (line 30) +* onscreenclick() (in module turtle): Using screen events. + (line 56) +* ontimer() (in module turtle): Using screen events. + (line 86) +* OP (in module token): token — Constants used with Python parse trees. + (line 62) +* OP_ALL (in module ssl): Constants<9>. (line 211) +* OP_CIPHER_SERVER_PREFERENCE (in module ssl): Constants<9>. (line 300) +* OP_ENABLE_KTLS (in module ssl): Constants<9>. (line 358) +* OP_ENABLE_MIDDLEBOX_COMPAT (in module ssl): Constants<9>. (line 324) +* OP_IGNORE_UNEXPECTED_EOF (in module ssl): Constants<9>. (line 350) +* OP_LEGACY_SERVER_CONNECT (in module ssl): Constants<9>. (line 375) +* OP_NO_COMPRESSION (in module ssl): Constants<9>. (line 333) +* OP_NO_RENEGOTIATION (in module ssl): Constants<9>. (line 290) +* OP_NO_SSLv2 (in module ssl): Constants<9>. (line 219) +* OP_NO_SSLv3 (in module ssl): Constants<9>. (line 229) +* OP_NO_TICKET (in module ssl): Constants<9>. (line 344) +* OP_NO_TLSv1 (in module ssl): Constants<9>. (line 239) +* OP_NO_TLSv1_1 (in module ssl): Constants<9>. (line 251) +* OP_NO_TLSv1_2 (in module ssl): Constants<9>. (line 263) +* OP_NO_TLSv1_3 (in module ssl): Constants<9>. (line 275) +* OP_SINGLE_DH_USE (in module ssl): Constants<9>. (line 308) +* OP_SINGLE_ECDH_USE (in module ssl): Constants<9>. (line 316) +* Open (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 60) +* open_binary() (in module importlib.resources): Functional API. + (line 35) +* open_code() (in module io): High-level Module Interface. + (line 22) +* open_connection() (in module asyncio): Streams. (line 42) +* open_flags (in module dbm.gnu): dbm gnu — GNU database manager. + (line 76) +* open_new_tab() (in module webbrowser): webbrowser — Convenient web-browser controller. + (line 96) +* open_new_tab() (webbrowser.controller method): Browser Controller Objects. + (line 26) +* open_new() (in module webbrowser): webbrowser — Convenient web-browser controller. + (line 88) +* open_new() (webbrowser.controller method): Browser Controller Objects. + (line 20) +* open_osfhandle() (in module msvcrt): File Operations. (line 44) +* open_resource() (importlib.abc.ResourceReader method): importlib abc – Abstract base classes related to import. + (line 470) +* open_resource() (importlib.resources.abc.ResourceReader method): importlib resources abc – Abstract base classes for resources. + (line 47) +* open_text() (in module importlib.resources): Functional API. + (line 51) +* open_unix_connection() (in module asyncio): Streams. (line 118) +* open_unknown() (urllib.request.URLopener method): Legacy interface. + (line 108) +* open_urlresource() (in module test.support): test support — Utilities for the Python test suite. + (line 580) +* open() (imaplib.IMAP4 method): IMAP4 Objects. (line 170) +* open() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 547) +* open() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 141) +* open() (in module bz2): De compression of files. + (line 6) +* open() (in module codecs): codecs — Codec registry and base classes. + (line 182) +* open() (in module dbm.dumb): dbm dumb — Portable DBM implementation. + (line 29) +* open() (in module dbm.gnu): dbm gnu — GNU database manager. + (line 28) +* open() (in module dbm.ndbm): dbm ndbm — New Database Manager. + (line 38) +* open() (in module dbm.sqlite3): dbm sqlite3 — SQLite backend for dbm. + (line 22) +* open() (in module dbm): dbm — Interfaces to Unix “databases”. + (line 49) +* open() (in module gzip): gzip — Support for gzip files. + (line 28) +* open() (in module io): High-level Module Interface. + (line 12) +* open() (in module lzma): Reading and writing compressed files. + (line 6) +* open() (in module os): File Descriptor Operations. + (line 375) +* open() (in module shelve): shelve — Python object persistence. + (line 17) +* open() (in module tarfile): tarfile — Read and write tar archive files. + (line 41) +* open() (in module tokenize): Tokenizing Input. (line 99) +* open() (in module wave): wave — Read and write WAV files. + (line 21) +* open() (in module webbrowser): webbrowser — Convenient web-browser controller. + (line 68) +* open() (pathlib.Path method): Reading and writing files. + (line 6) +* open() (tarfile.TarFile class method): TarFile Objects. (line 98) +* open() (urllib.request.OpenerDirector method): OpenerDirector Objects. + (line 46) +* open() (urllib.request.URLopener method): Legacy interface. + (line 97) +* open() (webbrowser.controller method): Browser Controller Objects. + (line 14) +* open() (zipfile.Path method): Path Objects. (line 35) +* open() (zipfile.ZipFile method): ZipFile Objects. (line 130) +* OpenerDirector (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 274) +* OpenKey() (in module winreg): Functions<13>. (line 286) +* OpenKeyEx() (in module winreg): Functions<13>. (line 286) +* openlog() (in module syslog): syslog — Unix syslog library routines. + (line 51) +* openpty() (in module os): File Descriptor Operations. + (line 480) +* openpty() (in module pty): pty — Pseudo-terminal utilities. + (line 35) +* OPENSSL_VERSION (in module ssl): Constants<9>. (line 479) +* OPENSSL_VERSION_INFO (in module ssl): Constants<9>. (line 489) +* OPENSSL_VERSION_NUMBER (in module ssl): Constants<9>. (line 499) +* OpenSSL; (use in module hashlib): Hash algorithms. (line 18) +* OpenSSL; (use in module ssl): ssl — TLS/SSL wrapper for socket objects. + (line 8) +* OperationalError: Exceptions<7>. (line 57) +* operations on; dictionary; type: Mapping Types — dict. + (line 6) +* operations on; integer; types: Bitwise Operations on Integer Types. + (line 6) +* operations on; list; type: Mutable Sequence Types. + (line 16) +* operations on; mapping; types: Mapping Types — dict. + (line 6) +* operations on; numeric; types: Numeric Types — int float complex. + (line 94) +* operations on; sequence; types: Common Sequence Operations. + (line 21) +* operations on; sequence; types <1>: Mutable Sequence Types. + (line 16) +* operator; - (minus): Unary arithmetic and bitwise operations. + (line 10) +* operator; - (minus) <1>: Binary arithmetic operations. + (line 83) +* operator; - (minus) <2>: Numeric Types — int float complex. + (line 27) +* operator; !=: Comparisons. (line 6) +* operator; != <1>: Comparisons<2>. (line 6) +* operator; @ (at): Binary arithmetic operations. + (line 26) +* operator; * (asterisk): Binary arithmetic operations. + (line 16) +* operator; * (asterisk) <1>: Numeric Types — int float complex. + (line 27) +* operator; **: The power operator. (line 6) +* operator; ** <1>: Numeric Types — int float complex. + (line 27) +* operator; / (slash): Binary arithmetic operations. + (line 34) +* operator; / (slash) <1>: Numeric Types — int float complex. + (line 27) +* operator; //: Binary arithmetic operations. + (line 34) +* operator; // <1>: Numeric Types — int float complex. + (line 27) +* operator; & (ampersand): Binary bitwise operations. + (line 12) +* operator; & (ampersand) <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; % (percent): Binary arithmetic operations. + (line 46) +* operator; % (percent) <1>: Numeric Types — int float complex. + (line 27) +* operator; ^ (caret): Binary bitwise operations. + (line 16) +* operator; ^ (caret) <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; + (plus): Unary arithmetic and bitwise operations. + (line 14) +* operator; + (plus) <1>: Binary arithmetic operations. + (line 74) +* operator; + (plus) <2>: Numeric Types — int float complex. + (line 27) +* operator; < (less): Comparisons. (line 6) +* operator; < (less) <1>: Comparisons<2>. (line 6) +* operator; <<: Shifting operations. + (line 6) +* operator; << <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; <=: Comparisons. (line 6) +* operator; <= <1>: Comparisons<2>. (line 6) +* operator; ==: Comparisons. (line 6) +* operator; == <1>: Comparisons<2>. (line 6) +* operator; > (greater): Comparisons. (line 6) +* operator; > (greater) <1>: Comparisons<2>. (line 6) +* operator; >=: Comparisons. (line 6) +* operator; >= <1>: Comparisons<2>. (line 6) +* operator; >>: Shifting operations. + (line 6) +* operator; >> <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; | (vertical bar): Binary bitwise operations. + (line 20) +* operator; | (vertical bar) <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; ~ (tilde): Unary arithmetic and bitwise operations. + (line 18) +* operator; ~ (tilde) <1>: Bitwise Operations on Integer Types. + (line 6) +* operator; and: Boolean operations. (line 21) +* operator; and <1>: Truth Value Testing. + (line 23) +* operator; and <2>: Boolean Operations — and or not. + (line 22) +* operator; comparison: Comparisons<2>. (line 6) +* operator; in: Membership test operations. + (line 36) +* operator; in <1>: Comparisons<2>. (line 64) +* operator; in <2>: Common Sequence Operations. + (line 21) +* operator; is: Membership test operations. + (line 39) +* operator; is <1>: Comparisons<2>. (line 6) +* operator; is not: Membership test operations. + (line 39) +* operator; is not <1>: Comparisons<2>. (line 6) +* operator; not: Boolean operations. (line 18) +* operator; not <1>: Boolean Operations — and or not. + (line 22) +* operator; not in: Membership test operations. + (line 36) +* operator; not in <1>: Comparisons<2>. (line 64) +* operator; not in <2>: Common Sequence Operations. + (line 21) +* operator; or: Boolean operations. (line 25) +* operator; or <1>: Truth Value Testing. + (line 23) +* operator; or <2>: Boolean Operations — and or not. + (line 22) +* operator; overloading: Special method names. + (line 6) +* operator; precedence: Operator precedence. + (line 6) +* operators: Operators. (line 6) +* opmap (in module dis): Opcode collections. (line 17) +* opname (in module dis): Opcode collections. (line 13) +* OPT: Debug options. (line 39) +* optim_args_from_interpreter_flags() (in module test.support): test support — Utilities for the Python test suite. + (line 323) +* optimize (sys.flags attribute): sys — System-specific parameters and functions. + (line 541) +* optimize() (in module pickletools): Programmatic Interface<2>. + (line 31) +* optimized scope: Glossary. (line 1103) +* OPTIMIZED_BYTECODE_SUFFIXES (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 30) +* Option (class in optparse): Option attributes. (line 6) +* Optional (in module typing): Special forms. (line 52) +* OptionConflictError: Exceptions<10>. (line 11) +* OptionError: Exceptions<10>. (line 6) +* OptionGroup (class in optparse): Grouping Options. (line 12) +* OptionParser (class in optparse): Creating the parser. + (line 9) +* Options (class in ssl): Constants<9>. (line 340) +* options (doctest.Example attribute): Example Objects. (line 53) +* options (ssl.SSLContext attribute): SSL Contexts. (line 572) +* options() (configparser.ConfigParser method): ConfigParser Objects. + (line 137) +* OptionValueError: Exceptions<10>. (line 16) +* optionxform() (configparser.ConfigParser method): ConfigParser Objects. + (line 319) +* Or (class in ast): Expressions<2>. (line 86) +* or_() (in module operator): operator — Standard operators as functions. + (line 137) +* ordered_attributes (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 145) +* OrderedDict (class in collections): OrderedDict objects. + (line 60) +* OrderedDict (class in typing): Aliases to types in collections. + (line 17) +* orig_argv (in module sys): sys — System-specific parameters and functions. + (line 1313) +* origin (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 392) +* origin_req_host (urllib.request.Request attribute): Request Objects. + (line 30) +* origin_server (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 294) +* os_environ (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 169) +* OSError: Concrete exceptions. + (line 150) +* OUT_TO_DEFAULT (in module msvcrt): Other Functions. (line 20) +* OUT_TO_MSGBOX (in module msvcrt): Other Functions. (line 30) +* OUT_TO_STDERR (in module msvcrt): Other Functions. (line 25) +* output: Expression statements. + (line 17) +* output (subprocess.CalledProcessError attribute): Using the subprocess Module. + (line 220) +* output (subprocess.TimeoutExpired attribute): Using the subprocess Module. + (line 181) +* output (unittest.TestCase attribute): Test cases. (line 440) +* output_charset (email.charset.Charset attribute): email charset Representing character sets. + (line 74) +* output_codec (email.charset.Charset attribute): email charset Representing character sets. + (line 88) +* output_difference() (doctest.OutputChecker method): OutputChecker objects. + (line 27) +* output() (http.cookies.BaseCookie method): Cookie Objects. (line 24) +* output() (http.cookies.Morsel method): Morsel Objects. (line 69) +* OutputChecker (class in doctest): OutputChecker objects. + (line 6) +* OutputString() (http.cookies.Morsel method): Morsel Objects. + (line 84) +* OutsideDestinationError: tarfile — Read and write tar archive files. + (line 243) +* Overflow (class in decimal): Signals. (line 68) +* OverflowError: Concrete exceptions. + (line 215) +* OverflowError (built-in exception): Integer Objects. (line 142) +* OverflowError (built-in exception) <1>: Integer Objects. (line 197) +* OverflowError (built-in exception) <2>: Integer Objects. (line 239) +* OverflowError (built-in exception) <3>: Integer Objects. (line 251) +* OverflowError (built-in exception) <4>: Integer Objects. (line 263) +* OverflowError (built-in exception) <5>: Integer Objects. (line 276) +* overlap() (statistics.NormalDist method): NormalDist objects. + (line 102) +* overlaps() (ipaddress.IPv4Network method): Network objects. + (line 155) +* overlaps() (ipaddress.IPv6Network method): Network objects. + (line 340) +* overlay() (curses.window method): Window Objects. (line 430) +* overload() (in module typing): Functions and decorators. + (line 247) +* override() (in module typing): Functions and decorators. + (line 372) +* overwrite() (curses.window method): Window Objects. (line 443) +* owner() (pathlib.Path method): Permissions and ownership. + (line 6) +* p (pdb command): Debugger Commands. (line 268) +* P_ALL (in module os): Process Management. (line 964) +* P_DETACH (in module os): Process Management. (line 694) +* P_NOWAIT (in module os): Process Management. (line 674) +* P_NOWAITO (in module os): Process Management. (line 674) +* P_OVERLAY (in module os): Process Management. (line 694) +* P_PGID (in module os): Process Management. (line 964) +* P_PID (in module os): Process Management. (line 964) +* P_PIDFD (in module os): Process Management. (line 964) +* P_WAIT (in module os): Process Management. (line 684) +* pack_into() (in module struct): Functions and Exceptions. + (line 19) +* pack_into() (struct.Struct method): Classes<3>. (line 29) +* pack() (in module struct): Functions and Exceptions. + (line 13) +* pack() (mailbox.MH method): MH objects. (line 67) +* pack() (struct.Struct method): Classes<3>. (line 24) +* package: Packages<2>. (line 6) +* package <1>: site — Site-specific configuration hook. + (line 74) +* package <2>: Glossary. (line 1114) +* package variable; __all__: Importing Modules<2>. + (line 9) +* package; namespace: Namespace packages. (line 6) +* package; portion: Namespace packages. (line 6) +* package; regular: Regular packages. (line 6) +* PackageMetadata (class in importlib.metadata): Distribution metadata. + (line 14) +* PackageNotFoundError: Overview<3>. (line 35) +* PackagePath (class in importlib.metadata): Distribution files. + (line 18) +* packages_distributions() (in module importlib.metadata): Mapping import to distribution packages. + (line 6) +* packed (ipaddress.IPv4Address attribute): Address objects. (line 71) +* packed (ipaddress.IPv6Address attribute): Address objects. (line 267) +* packing (widgets): The Packer. (line 6) +* packing; binary; data: struct — Interpret bytes as packed binary data. + (line 8) +* PAGER: pydoc — Documentation generator and online help system. + (line 46) +* pair_content() (in module curses): Functions<6>. (line 380) +* pair_number() (in module curses): Functions<6>. (line 386) +* pairwise() (in module itertools): Itertool Functions. (line 413) +* parameter: Glossary. (line 1123) +* Parameter (class in inspect): Introspecting callables with the Signature object. + (line 190) +* parameter; call semantics: Calls. (line 25) +* parameter; difference from argument: How can I pass optional or keyword parameters from one function to another?. + (line 16) +* parameter; function definition: Class Patterns. (line 140) +* ParameterizedMIMEHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 255) +* parameters (inspect.Signature attribute): Introspecting callables with the Signature object. + (line 105) +* params (email.headerregistry.ParameterizedMIMEHeader attribute): email headerregistry Custom Header Objects. + (line 263) +* ParamSpec (class in ast): Type parameters. (line 36) +* ParamSpec (class in typing): Building generic types and type aliases. + (line 351) +* ParamSpecArgs (in module typing): Building generic types and type aliases. + (line 471) +* ParamSpecKwargs (in module typing): Building generic types and type aliases. + (line 471) +* paramstyle (in module sqlite3): Module constants. (line 70) +* pardir (in module os): Miscellaneous System Information. + (line 110) +* parent (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 428) +* parent (logging.Logger attribute): Logger Objects. (line 42) +* parent (pathlib.PurePath attribute): Methods and properties. + (line 94) +* parent (pyclbr.Class attribute): Class Objects<2>. (line 28) +* parent (pyclbr.Function attribute): Function Objects. (line 27) +* parent (urllib.request.BaseHandler attribute): BaseHandler Objects. + (line 25) +* parent_process() (in module multiprocessing): Miscellaneous<3>. + (line 42) +* parent() (tkinter.ttk.Treeview method): ttk Treeview. (line 227) +* parenthesized form: Parenthesized forms. + (line 6) +* parentNode (xml.dom.Node attribute): Node Objects. (line 17) +* parents (collections.ChainMap attribute): ChainMap objects. + (line 62) +* parents (pathlib.PurePath attribute): Methods and properties. + (line 78) +* paretovariate() (in module random): Real-valued distributions. + (line 101) +* parse_and_bind() (in module readline): Init file. (line 8) +* parse_args() (argparse.ArgumentParser method): The parse_args method. + (line 6) +* parse_args() (optparse.OptionParser method): Parsing arguments. + (line 9) +* PARSE_COLNAMES (in module sqlite3): Module constants. (line 35) +* parse_config_h() (in module sysconfig): Other functions<3>. + (line 59) +* PARSE_DECLTYPES (in module sqlite3): Module constants. (line 13) +* parse_headers() (in module http.client): http client — HTTP protocol client. + (line 110) +* parse_intermixed_args() (argparse.ArgumentParser method): Intermixed parsing. + (line 6) +* parse_known_args() (argparse.ArgumentParser method): Partial parsing. + (line 6) +* parse_known_intermixed_args() (argparse.ArgumentParser method): Intermixed parsing. + (line 9) +* parse_qs() (in module urllib.parse): URL Parsing. (line 152) +* parse_qsl() (in module urllib.parse): URL Parsing. (line 198) +* parse() (doctest.DocTestParser method): DocTestParser objects. + (line 29) +* parse() (email.parser.BytesParser method): Parser API. (line 35) +* parse() (email.parser.Parser method): Parser API. (line 87) +* parse() (in module ast): ast Helpers. (line 9) +* parse() (in module xml.dom.minidom): xml dom minidom — Minimal DOM implementation. + (line 35) +* parse() (in module xml.dom.pulldom): xml dom pulldom — Support for building partial DOM trees. + (line 84) +* parse() (in module xml.etree.ElementTree): Functions<9>. (line 177) +* parse() (in module xml.sax): xml sax — Support for SAX2 parsers. + (line 38) +* parse() (string.Formatter method): Custom String Formatting. + (line 40) +* parse() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 29) +* parse() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 54) +* Parse() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 8) +* parse() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 8) +* parseaddr() (in module email.utils): email utils Miscellaneous utilities. + (line 57) +* parsebytes() (email.parser.BytesParser method): Parser API. + (line 55) +* parsedate_to_datetime() (in module email.utils): email utils Miscellaneous utilities. + (line 130) +* parsedate_tz() (in module email.utils): email utils Miscellaneous utilities. + (line 119) +* parsedate() (in module email.utils): email utils Miscellaneous utilities. + (line 107) +* ParseError (class in xml.etree.ElementTree): Exceptions<19>. + (line 6) +* ParseFile() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 16) +* ParseFlags() (in module imaplib): imaplib — IMAP4 protocol client. + (line 123) +* parser: Lexical analysis. (line 6) +* Parser (class in email.parser): Parser API. (line 76) +* parser (pathlib.PurePath attribute): Methods and properties. + (line 8) +* ParserCreate() (in module xml.parsers.expat): xml parsers expat — Fast XML parsing using Expat. + (line 45) +* ParseResult (class in urllib.parse): Structured Parse Results. + (line 48) +* ParseResultBytes (class in urllib.parse): Structured Parse Results. + (line 73) +* parsestr() (email.parser.Parser method): Parser API. (line 97) +* parseString() (in module xml.dom.minidom): xml dom minidom — Minimal DOM implementation. + (line 48) +* parseString() (in module xml.dom.pulldom): xml dom pulldom — Support for building partial DOM trees. + (line 97) +* parseString() (in module xml.sax): xml sax — Support for SAX2 parsers. + (line 49) +* ParsingError: Exceptions<8>. (line 65) +* partial (asyncio.IncompleteReadError attribute): Exceptions<13>. + (line 56) +* partial() (imaplib.IMAP4 method): IMAP4 Objects. (line 189) +* partial() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 320) +* partialmethod (class in functools): functools — Higher-order functions and operations on callable objects. + (line 351) +* parties (asyncio.Barrier attribute): Barrier. (line 94) +* parties (threading.Barrier attribute): Barrier objects. (line 93) +* partition() (bytearray method): Bytes and Bytearray Operations. + (line 187) +* partition() (bytes method): Bytes and Bytearray Operations. + (line 187) +* partition() (str method): String Methods<2>. (line 409) +* parts (pathlib.PurePath attribute): Accessing individual parts. + (line 9) +* Pass (class in ast): Statements. (line 154) +* pass_() (poplib.POP3 method): POP3 Objects. (line 36) +* Paste: Help menu Shell and Editor. + (line 30) +* patch.dict() (in module unittest.mock): patch dict. (line 6) +* patch.multiple() (in module unittest.mock): patch multiple. + (line 6) +* patch.object() (in module unittest.mock): patch object. (line 6) +* patch.stopall() (in module unittest.mock): patch methods start and stop. + (line 70) +* patch() (in module test.support): test support — Utilities for the Python test suite. + (line 651) +* patch() (in module unittest.mock): patch. (line 9) +* PATH: Changes in the Python API<5>. + (line 144) +* PATH <1>: Changes in ‘python’ Command Behavior<2>. + (line 6) +* PATH <2>: Changes in ‘python’ Command Behavior<2>. + (line 11) +* PATH <3>: Changes in ‘python’ Command Behavior<2>. + (line 12) +* PATH <4>: macOS<7>. (line 14) +* PATH <5>: Windows<24>. (line 56) +* PATH <6>: Windows<28>. (line 14) +* PATH <7>: Security<36>. (line 16) +* PATH <8>: Security<36>. (line 20) +* PATH <9>: The Module Search Path. + (line 17) +* PATH <10>: Executable Python Scripts. + (line 11) +* PATH <11>: Environment variables. + (line 27) +* PATH <12>: Miscellaneous. (line 16) +* PATH <13>: Installation steps. (line 34) +* PATH <14>: Installation steps. (line 58) +* PATH <15>: Installing Without UI. + (line 77) +* PATH <16>: Installing Without UI. + (line 81) +* PATH <17>: Excursus Setting environment variables. + (line 23) +* PATH <18>: Excursus Setting environment variables. + (line 35) +* PATH <19>: Finding the Python executable. + (line 14) +* PATH <20>: Finding the Python executable. + (line 21) +* PATH <21>: Finding the Python executable. + (line 22) +* PATH <22>: Python Launcher for Windows. + (line 13) +* PATH <23>: From the command-line. + (line 9) +* PATH <24>: Shebang Lines. (line 54) +* PATH <25>: Shebang Lines. (line 60) +* PATH <26>: Shebang Lines. (line 62) +* PATH <27>: Shebang Lines. (line 67) +* PATH <28>: Comparison to the os and os path modules. + (line 41) +* PATH <29>: Directory and files operations. + (line 427) +* PATH <30>: Directory and files operations. + (line 432) +* PATH <31>: Process Management. (line 45) +* PATH <32>: Process Management. (line 86) +* PATH <33>: Process Management. (line 89) +* PATH <34>: Process Management. (line 92) +* PATH <35>: Process Management. (line 544) +* PATH <36>: Process Management. (line 631) +* PATH <37>: Process Management. (line 635) +* PATH <38>: Process Management. (line 637) +* PATH <39>: Miscellaneous System Information. + (line 141) +* PATH <40>: Popen Constructor. (line 34) +* PATH <41>: webbrowser — Convenient web-browser controller. + (line 241) +* PATH <42>: How venvs work. (line 16) +* PATH <43>: How venvs work. (line 61) +* PATH <44>: How venvs work. (line 66) +* PATH <45>: site — Site-specific configuration hook. + (line 66) +* PATH <46>: Embedding Python<2>. + (line 31) +* PATH <47>: Embedding Python<2>. + (line 37) +* PATH <48>: How do I make a Python script executable on Unix?. + (line 24) +* PATH <49>: How do I make a Python script executable on Unix?. + (line 28) +* Path (class in pathlib): Concrete paths. (line 11) +* Path (class in zipfile): Path Objects. (line 6) +* path (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line 45) +* path (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* path (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 97) +* path (ImportError attribute): Concrete exceptions. + (line 65) +* path (importlib.abc.FileLoader attribute): importlib abc – Abstract base classes related to import. + (line 309) +* path (importlib.machinery.AppleFrameworkLoader attribute): importlib machinery – Importers and path hooks. + (line 504) +* path (importlib.machinery.ExtensionFileLoader attribute): importlib machinery – Importers and path hooks. + (line 310) +* path (importlib.machinery.FileFinder attribute): importlib machinery – Importers and path hooks. + (line 179) +* path (importlib.machinery.SourceFileLoader attribute): importlib machinery – Importers and path hooks. + (line 216) +* path (importlib.machinery.SourcelessFileLoader attribute): importlib machinery – Importers and path hooks. + (line 260) +* path (in module sys): sys — System-specific parameters and functions. + (line 1326) +* path (in module sys) <1>: Embedding Python<2>. + (line 12) +* path (in module sys) <2>: Initializing and finalizing the interpreter. + (line 7) +* path (in module sys) <3>: Process-wide parameters. + (line 136) +* path (os.DirEntry attribute): Files and Directories. + (line 951) +* path based finder: The Path Based Finder. + (line 6) +* path based finder <1>: Glossary. (line 1195) +* Path browser: File menu Shell and Editor. + (line 22) +* path entry: Glossary. (line 1175) +* path entry finder: Glossary. (line 1180) +* path entry hook: Glossary. (line 1189) +* path hooks: Import hooks. (line 6) +* path_hook() (importlib.machinery.FileFinder class method): importlib machinery – Importers and path hooks. + (line 194) +* path_hooks (in module sys): sys — System-specific parameters and functions. + (line 1359) +* path_importer_cache (in module sys): sys — System-specific parameters and functions. + (line 1368) +* path_mtime() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 375) +* path_return_ok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects. + (line 56) +* path_stats() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 353) +* path_stats() (importlib.machinery.SourceFileLoader method): importlib machinery – Importers and path hooks. + (line 225) +* path-like object: Glossary. (line 1200) +* path; configuration; file: site — Site-specific configuration hook. + (line 74) +* path; operations: pathlib — Object-oriented filesystem paths. + (line 10) +* path; operations <1>: os path — Common pathname manipulations. + (line 9) +* Path.stem (in module zipfile): Path Objects. (line 86) +* Path.suffix (in module zipfile): Path Objects. (line 79) +* Path.suffixes (in module zipfile): Path Objects. (line 92) +* path() (in module importlib.resources): Functional API. (line 110) +* pathconf_names (in module os): Files and Directories. + (line 662) +* pathconf() (in module os): Files and Directories. + (line 638) +* PathEntryFinder (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 59) +* PATHEXT: Other Improvements<2>. + (line 30) +* PATHEXT <1>: Library<43>. (line 138) +* PATHEXT <2>: Installing Without UI. + (line 77) +* PATHEXT <3>: Installing Without UI. + (line 81) +* PATHEXT <4>: Directory and files operations. + (line 442) +* PathFinder (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 107) +* PathLike (class in os): Process Parameters. (line 120) +* pathname2url() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 144) +* pathsep (in module os): Miscellaneous System Information. + (line 138) +* Pattern (class in re): Regular Expression Objects. + (line 6) +* Pattern (class in typing): Aliases to other concrete types. + (line 6) +* pattern (re.Pattern attribute): Regular Expression Objects. + (line 124) +* pattern (re.PatternError attribute): Exceptions<3>. (line 19) +* pattern matching: The match statement. + (line 6) +* PatternError: Exceptions<3>. (line 6) +* pause_reading() (asyncio.ReadTransport method): Read-only Transports. + (line 12) +* pause_writing() (asyncio.BaseProtocol method): Base Protocol. + (line 40) +* pause() (in module signal): Module contents<2>. (line 312) +* PAX_FORMAT (in module tarfile): tarfile — Read and write tar archive files. + (line 335) +* pax_headers (tarfile.TarFile attribute): TarFile Objects. (line 330) +* pax_headers (tarfile.TarInfo attribute): TarInfo Objects. (line 161) +* pbkdf2_hmac() (in module hashlib): Key derivation. (line 11) +* pd() (in module turtle): Drawing state. (line 6) +* Pdb (class in pdb): pdb — The Python Debugger. + (line 17) +* Pdb (class in pdb) <1>: pdb — The Python Debugger. + (line 194) +* pdb command line option; -c: pdb — The Python Debugger. + (line 85) +* pdb command line option; -command: pdb — The Python Debugger. + (line 85) +* pdb command line option; -m: pdb — The Python Debugger. + (line 92) +* pdf() (statistics.NormalDist method): NormalDist objects. (line 74) +* peek() (bz2.BZ2File method): De compression of files. + (line 74) +* peek() (gzip.GzipFile method): gzip — Support for gzip files. + (line 130) +* peek() (io.BufferedReader method): Buffered Streams. (line 75) +* peek() (lzma.LZMAFile method): Reading and writing compressed files. + (line 87) +* peek() (weakref.finalize method): weakref — Weak references. + (line 307) +* PEM_cert_to_DER_cert() (in module ssl): Certificate handling. + (line 57) +* pen() (in module turtle): Drawing state. (line 33) +* pencolor() (in module turtle): Color control. (line 6) +* pending (ssl.MemoryBIO attribute): Memory BIO Support<2>. + (line 139) +* pending() (ssl.SSLSocket method): SSL Sockets. (line 335) +* PendingDeprecationWarning: Warnings. (line 28) +* pendown() (in module turtle): Drawing state. (line 6) +* pensize() (in module turtle): Drawing state. (line 18) +* penup() (in module turtle): Drawing state. (line 12) +* PEP: Glossary. (line 1212) +* PERCENT (in module token): token — Constants used with Python parse trees. + (line 227) +* PERCENTEQUAL (in module token): token — Constants used with Python parse trees. + (line 275) +* perf_counter_ns() (in module time): Functions<5>. (line 238) +* perf_counter() (in module time): Functions<5>. (line 214) +* Performance: timeit — Measure execution time of small code snippets. + (line 8) +* perm() (in module math): Number-theoretic functions. + (line 66) +* PermissionError: OS exceptions. (line 97) +* permutations() (in module itertools): Itertool Functions. (line 436) +* persistence: pickle — Python object serialization. + (line 8) +* persistent_id (pickle protocol): Persistence of External Objects. + (line 6) +* persistent_id() (pickle.Pickler method): Module Interface. (line 160) +* persistent_load (pickle protocol): Persistence of External Objects. + (line 6) +* persistent_load() (pickle.Unpickler method): Module Interface. + (line 278) +* persistent; objects: pickle — Python object serialization. + (line 8) +* PF_CAN (in module socket): Constants<8>. (line 126) +* PF_DIVERT (in module socket): Constants<8>. (line 202) +* PF_PACKET (in module socket): Constants<8>. (line 212) +* PF_RDS (in module socket): Constants<8>. (line 234) +* pformat() (in module pprint): Functions<4>. (line 76) +* pformat() (pprint.PrettyPrinter method): PrettyPrinter Objects. + (line 50) +* pgettext() (gettext.GNUTranslations method): The GNUTranslations class. + (line 68) +* pgettext() (gettext.NullTranslations method): The NullTranslations class. + (line 47) +* pgettext() (in module gettext): GNU gettext API. (line 63) +* PGO (in module test.support): test support — Utilities for the Python test suite. + (line 107) +* phase() (in module cmath): Conversions to and from polar coordinates. + (line 20) +* Philbrick, Geoff: Keyword Parameters for Extension Functions. + (line 25) +* physical line: Logical lines. (line 6) +* physical line <1>: Explicit line joining. + (line 6) +* physical line <2>: String and Bytes literals. + (line 74) +* pi (in module cmath): Constants<3>. (line 6) +* pi (in module math): Constants<2>. (line 6) +* pi() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 56) +* pickle() (in module copyreg): copyreg — Register pickle support functions. + (line 23) +* PickleBuffer (class in pickle): Module Interface. (line 308) +* PickleError: Module Interface. (line 95) +* Pickler (class in pickle): Module Interface. (line 121) +* pickletools command line option; -a: Command line options<3>. + (line 6) +* pickletools command line option; -annotate: Command line options<3>. + (line 6) +* pickletools command line option; -indentlevel: Command line options<3>. + (line 14) +* pickletools command line option; -l: Command line options<3>. + (line 14) +* pickletools command line option; -m: Command line options<3>. + (line 18) +* pickletools command line option; -memo: Command line options<3>. + (line 18) +* pickletools command line option; -o: Command line options<3>. + (line 10) +* pickletools command line option; -output: Command line options<3>. + (line 10) +* pickletools command line option; -p: Command line options<3>. + (line 23) +* pickletools command line option; -preamble: Command line options<3>. + (line 23) +* pickling; objects: pickle — Python object serialization. + (line 8) +* PicklingError: Module Interface. (line 100) +* pid (asyncio.subprocess.Process attribute): Interacting with Subprocesses. + (line 138) +* pid (multiprocessing.Process attribute): Process and exceptions. + (line 154) +* pid (subprocess.Popen attribute): Popen Objects. (line 142) +* PIDFD_NONBLOCK (in module os): Process Management. (line 377) +* pidfd_open() (in module os): Process Management. (line 364) +* pidfd_send_signal() (in module signal): Module contents<2>. + (line 330) +* PidfdChildWatcher (class in asyncio): Process Watchers. (line 156) +* PIP_USER: Windows<45>. (line 102) +* PIPE (in module subprocess): Using the subprocess Module. + (line 149) +* PIPE_BUF (in module select): select — Waiting for I/O completion. + (line 162) +* pipe_connection_lost() (asyncio.SubprocessProtocol method): Subprocess Protocols. + (line 19) +* pipe_data_received() (asyncio.SubprocessProtocol method): Subprocess Protocols. + (line 10) +* PIPE_MAX_SIZE (in module test.support): test support — Utilities for the Python test suite. + (line 111) +* Pipe() (in module multiprocessing): Pipes and Queues. (line 79) +* pipe() (in module os): File Descriptor Operations. + (line 492) +* pipe2() (in module os): File Descriptor Operations. + (line 503) +* placeholder (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 276) +* platform (in module sys): sys — System-specific parameters and functions. + (line 1378) +* platform (in module sys) <1>: Process-wide parameters. + (line 173) +* platform command line option; -nonaliased: Command-line usage<2>. + (line 19) +* platform command line option; -terse: Command-line usage<2>. + (line 13) +* platform() (in module platform): Cross platform. (line 45) +* platlibdir (in module sys): sys — System-specific parameters and functions. + (line 1443) +* PlaySound() (in module winsound): winsound — Sound-playing interface for Windows. + (line 20) +* plist; file: plistlib — Generate and parse Apple plist files. + (line 8) +* plock() (in module os): Process Management. (line 389) +* plus: Unary arithmetic and bitwise operations. + (line 14) +* PLUS (in module token): token — Constants used with Python parse trees. + (line 197) +* plus() (decimal.Context method): Context objects. (line 443) +* PLUSEQUAL (in module token): token — Constants used with Python parse trees. + (line 263) +* pm() (in module pdb): pdb — The Python Debugger. + (line 184) +* POINTER() (in module ctypes): Utility functions. (line 178) +* pointer() (in module ctypes): Utility functions. (line 184) +* polar() (in module cmath): Conversions to and from polar coordinates. + (line 38) +* Policy (class in email.policy): email policy Policy Objects. + (line 129) +* poll() (in module select): select — Waiting for I/O completion. + (line 89) +* poll() (multiprocessing.connection.Connection method): Connection Objects. + (line 42) +* poll() (select.devpoll method): /dev/poll Polling Objects. + (line 65) +* poll() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 96) +* poll() (select.poll method): Polling Objects. (line 77) +* poll() (subprocess.Popen method): Popen Objects. (line 8) +* PollSelector (class in selectors): Classes<4>. (line 171) +* Pool (class in multiprocessing.pool): Process Pools. (line 9) +* pop_all() (contextlib.ExitStack method): Utilities. (line 594) +* POP_BLOCK (opcode): Python Bytecode Instructions. + (line 1422) +* POP_EXCEPT (opcode): Python Bytecode Instructions. + (line 441) +* POP_JUMP_IF_FALSE (opcode): Python Bytecode Instructions. + (line 865) +* POP_JUMP_IF_NONE (opcode): Python Bytecode Instructions. + (line 889) +* POP_JUMP_IF_NOT_NONE (opcode): Python Bytecode Instructions. + (line 880) +* POP_JUMP_IF_TRUE (opcode): Python Bytecode Instructions. + (line 850) +* pop_source() (shlex.shlex method): shlex Objects. (line 63) +* POP_TOP (opcode): Python Bytecode Instructions. + (line 139) +* pop() (array.array method): array — Efficient arrays of numeric values. + (line 214) +* pop() (collections.deque method): deque objects. (line 87) +* pop() (dict method): Mapping Types — dict. + (line 201) +* pop() (frozenset method): Set Types — set frozenset. + (line 208) +* pop() (mailbox.Mailbox method): Mailbox objects. (line 216) +* pop() (sequence method): Mutable Sequence Types. + (line 16) +* POP3 (class in poplib): poplib — POP3 protocol client. + (line 34) +* POP3_SSL (class in poplib): poplib — POP3 protocol client. + (line 54) +* POP3; protocol: poplib — POP3 protocol client. + (line 8) +* Popen (class in subprocess): Popen Constructor. (line 11) +* popen() (in module os): I/O objects also known as file objects. + (line 6) +* popen() (in module os) <1>: Process Management. (line 396) +* popen() (in module os) <2>: select — Waiting for I/O completion. + (line 143) +* popitem() (collections.OrderedDict method): OrderedDict objects. + (line 67) +* popitem() (dict method): Mapping Types — dict. + (line 207) +* popitem() (mailbox.Mailbox method): Mailbox objects. (line 225) +* popleft() (collections.deque method): deque objects. (line 92) +* port (http.cookiejar.Cookie attribute): Cookie Objects<2>. (line 36) +* port_specified (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 81) +* portion: Glossary. (line 1228) +* pos (json.JSONDecodeError attribute): Exceptions<17>. (line 19) +* pos (re.Match attribute): Match Objects. (line 179) +* pos (re.PatternError attribute): Exceptions<3>. (line 23) +* pos() (in module operator): operator — Standard operators as functions. + (line 142) +* pos() (in module turtle): Tell Turtle’s state. + (line 6) +* position (xml.etree.ElementTree.ParseError attribute): Exceptions<19>. + (line 20) +* position() (in module turtle): Tell Turtle’s state. + (line 6) +* positional argument: Glossary. (line 1234) +* Positions (class in dis): Python Bytecode Instructions. + (line 110) +* positions (inspect.FrameInfo attribute): The interpreter stack. + (line 42) +* positions (inspect.Traceback attribute): The interpreter stack. + (line 82) +* Positions.col_offset (in module dis): Python Bytecode Instructions. + (line 119) +* Positions.end_col_offset (in module dis): Python Bytecode Instructions. + (line 121) +* Positions.end_lineno (in module dis): Python Bytecode Instructions. + (line 117) +* Positions.lineno (in module dis): Python Bytecode Instructions. + (line 115) +* POSIX Shared Memory: multiprocessing shared_memory — Shared memory for direct access across processes. + (line 10) +* POSIX_FADV_DONTNEED (in module os): File Descriptor Operations. + (line 537) +* POSIX_FADV_NOREUSE (in module os): File Descriptor Operations. + (line 537) +* POSIX_FADV_NORMAL (in module os): File Descriptor Operations. + (line 537) +* POSIX_FADV_RANDOM (in module os): File Descriptor Operations. + (line 537) +* POSIX_FADV_SEQUENTIAL (in module os): File Descriptor Operations. + (line 537) +* POSIX_FADV_WILLNEED (in module os): File Descriptor Operations. + (line 537) +* posix_fadvise() (in module os): File Descriptor Operations. + (line 523) +* posix_fallocate() (in module os): File Descriptor Operations. + (line 514) +* posix_openpt() (in module os): File Descriptor Operations. + (line 564) +* POSIX_SPAWN_CLOSE (in module os): Process Management. (line 463) +* POSIX_SPAWN_CLOSEFROM (in module os): Process Management. (line 475) +* POSIX_SPAWN_DUP2 (in module os): Process Management. (line 469) +* POSIX_SPAWN_OPEN (in module os): Process Management. (line 457) +* posix_spawn() (in module os): Process Management. (line 434) +* posix_spawnp() (in module os): Process Management. (line 536) +* POSIX; I/O control: termios — POSIX style tty control. + (line 6) +* PosixPath (class in pathlib): Concrete paths. (line 22) +* post_handshake_auth (ssl.SSLContext attribute): SSL Contexts. + (line 590) +* post_mortem() (in module pdb): pdb — The Python Debugger. + (line 175) +* post_setup() (venv.EnvBuilder method): API<2>. (line 177) +* postcmd() (cmd.Cmd method): Cmd Objects. (line 104) +* postloop() (cmd.Cmd method): Cmd Objects. (line 122) +* Pow (class in ast): Expressions<2>. (line 53) +* pow() (in module math): Power exponential and logarithmic functions. + (line 72) +* pow() (in module operator): operator — Standard operators as functions. + (line 147) +* power; operation: The power operator. (line 6) +* power() (decimal.Context method): Context objects. (line 449) +* pp (pdb command): Debugger Commands. (line 276) +* pp() (in module pprint): Functions<4>. (line 6) +* pprint() (in module pprint): Functions<4>. (line 67) +* pprint() (pprint.PrettyPrinter method): PrettyPrinter Objects. + (line 56) +* prcal() (in module calendar): calendar — General calendar-related functions. + (line 407) +* pread() (in module os): File Descriptor Operations. + (line 551) +* preadv() (in module os): File Descriptor Operations. + (line 582) +* preamble (email.message.EmailMessage attribute): email message Representing an email message. + (line 680) +* preamble (email.message.Message attribute): email message Message Representing an email message using the compat32 API. + (line 693) +* prec (decimal.Context attribute): Context objects. (line 123) +* precmd() (cmd.Cmd method): Cmd Objects. (line 94) +* prefix (in module sys): sys — System-specific parameters and functions. + (line 1468) +* prefix (xml.dom.Attr attribute): Attr Objects. (line 18) +* prefix (xml.dom.Node attribute): Node Objects. (line 69) +* prefix (zipimport.zipimporter attribute): zipimporter Objects. + (line 101) +* PREFIXES (in module site): Module contents<5>. (line 6) +* prefixlen (ipaddress.IPv4Network attribute): Network objects. + (line 132) +* prefixlen (ipaddress.IPv6Network attribute): Network objects. + (line 329) +* preloop() (cmd.Cmd method): Cmd Objects. (line 116) +* prepare_class() (in module types): Dynamic Type Creation. + (line 23) +* prepare_input_source() (in module xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 81) +* prepare() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 100) +* prepare() (logging.handlers.QueueHandler method): QueueHandler. + (line 53) +* prepare() (logging.handlers.QueueListener method): QueueListener. + (line 58) +* PrepareProtocol (class in sqlite3): PrepareProtocol objects. + (line 6) +* PrettyPrinter (class in pprint): PrettyPrinter Objects. + (line 6) +* prev() (tkinter.ttk.Treeview method): ttk Treeview. (line 232) +* previousSibling (xml.dom.Node attribute): Node Objects. (line 32) +* primary: Primaries. (line 6) +* print_callees() (pstats.Stats method): The Stats Class. (line 217) +* print_callers() (pstats.Stats method): The Stats Class. (line 196) +* print_exc() (in module traceback): Module-Level Functions<2>. + (line 58) +* print_exc() (timeit.Timer method): Python Interface. (line 135) +* print_exception() (in module traceback): Module-Level Functions<2>. + (line 24) +* print_function (in module __future__): Module Contents<5>. (line 35) +* print_help() (argparse.ArgumentParser method): Printing help. + (line 16) +* print_last() (in module traceback): Module-Level Functions<2>. + (line 63) +* print_list() (in module traceback): Module-Level Functions<2>. + (line 101) +* print_stack() (asyncio.Task method): Task Object. (line 143) +* print_stack() (in module traceback): Module-Level Functions<2>. + (line 70) +* print_stats() (profile.Profile method): profile and cProfile Module Reference. + (line 91) +* print_stats() (pstats.Stats method): The Stats Class. (line 164) +* print_tb() (in module traceback): Module-Level Functions<2>. + (line 6) +* print_usage() (argparse.ArgumentParser method): Printing help. + (line 10) +* print_usage() (optparse.OptionParser method): Other methods. + (line 15) +* print_version() (optparse.OptionParser method): Printing a version string. + (line 26) +* print_warning() (in module test.support): test support — Utilities for the Python test suite. + (line 411) +* print() (built-in function); __str__() (object method): Basic customization. + (line 131) +* print() (traceback.TracebackException method): TracebackException Objects. + (line 136) +* printable (in module string): String constants. (line 41) +* printdir() (zipfile.ZipFile method): ZipFile Objects. (line 236) +* printf-style formatting: printf-style String Formatting. + (line 6) +* printf-style formatting <1>: printf-style Bytes Formatting. + (line 6) +* PRIO_DARWIN_BG (in module os): Process Parameters. (line 303) +* PRIO_DARWIN_NONUI (in module os): Process Parameters. (line 303) +* PRIO_DARWIN_PROCESS (in module os): Process Parameters. (line 303) +* PRIO_DARWIN_THREAD (in module os): Process Parameters. (line 303) +* PRIO_PGRP (in module os): Process Parameters. (line 292) +* PRIO_PROCESS (in module os): Process Parameters. (line 292) +* PRIO_USER (in module os): Process Parameters. (line 292) +* PriorityQueue (class in asyncio): Priority Queue. (line 6) +* PriorityQueue (class in queue): queue — A synchronized queue class. + (line 50) +* private; names: Identifiers Names. (line 14) +* prlimit() (in module resource): Resource Limits. (line 56) +* prmonth() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 203) +* prmonth() (in module calendar): calendar — General calendar-related functions. + (line 398) +* ProactorEventLoop (class in asyncio): Event Loop Implementations. + (line 32) +* procedure; call: Expression statements. + (line 17) +* Process (class in multiprocessing): Process and exceptions. + (line 6) +* process_cpu_count() (in module os): Miscellaneous System Information. + (line 60) +* process_exited() (asyncio.SubprocessProtocol method): Subprocess Protocols. + (line 26) +* process_request() (socketserver.BaseServer method): Server Objects<2>. + (line 159) +* process_time_ns() (in module time): Functions<5>. (line 258) +* process_time() (in module time): Functions<5>. (line 245) +* process_tokens() (in module tabnanny): tabnanny — Detection of ambiguous indentation. + (line 42) +* process; group: Process Parameters. (line 193) +* process; group <1>: Process Parameters. (line 255) +* process; id: Process Parameters. (line 261) +* process; id of parent: Process Parameters. (line 268) +* process; killing: Process Management. (line 328) +* process; killing <1>: Process Management. (line 350) +* process; scheduling priority: Process Parameters. (line 279) +* process; scheduling priority <1>: Process Parameters. (line 467) +* process; signalling: Process Management. (line 328) +* process; signalling <1>: Process Management. (line 350) +* process() (logging.LoggerAdapter method): LoggerAdapter Objects. + (line 21) +* ProcessError: Process and exceptions. + (line 261) +* processes, light-weight: _thread — Low-level threading API. + (line 6) +* ProcessingInstruction() (in module xml.etree.ElementTree): Functions<9>. + (line 184) +* processingInstruction() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 164) +* ProcessingInstructionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 274) +* ProcessLookupError: OS exceptions. (line 107) +* processor time: Functions<5>. (line 247) +* processor time <1>: Functions<5>. (line 615) +* processor() (in module platform): Cross platform. (line 66) +* ProcessPoolExecutor (class in concurrent.futures): ProcessPoolExecutor. + (line 27) +* prod() (in module math): Summation and product functions. + (line 51) +* product() (in module itertools): Itertool Functions. (line 488) +* Profile (class in profile): profile and cProfile Module Reference. + (line 35) +* profile function: Reference<2>. (line 138) +* profile function <1>: Reference<2>. (line 154) +* profile function <2>: sys — System-specific parameters and functions. + (line 941) +* profile function <3>: sys — System-specific parameters and functions. + (line 1515) +* PROFILE_TASK: Build<18>. (line 13) +* PROFILE_TASK <1>: Performance options. + (line 12) +* profiler: sys — System-specific parameters and functions. + (line 941) +* profiler <1>: sys — System-specific parameters and functions. + (line 1515) +* profiling, deterministic: Introduction to the profilers. + (line 6) +* program: Complete Python programs. + (line 6) +* ProgrammingError: Exceptions<7>. (line 78) +* Progressbar (class in tkinter.ttk): ttk Progressbar. (line 6) +* prompt (cmd.Cmd attribute): Cmd Objects. (line 131) +* prompt_user_passwd() (urllib.request.FancyURLopener method): Legacy interface. + (line 183) +* prompts, interpreter: sys — System-specific parameters and functions. + (line 1484) +* propagate (logging.Logger attribute): Logger Objects. (line 50) +* property (built-in class): Built-in Functions. (line 1592) +* property list: plistlib — Generate and parse Apple plist files. + (line 8) +* property_declaration_handler (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 106) +* property_dom_node (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 113) +* property_lexical_handler (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 99) +* property_xml_string (in module xml.sax.handler): xml sax handler — Base classes for SAX handlers. + (line 120) +* property() (in module enum): Utilities and Decorators. + (line 39) +* PropertyMock (class in unittest.mock): The Mock Class. (line 650) +* prot_c() (ftplib.FTP_TLS method): FTP_TLS objects. (line 110) +* prot_p() (ftplib.FTP_TLS method): FTP_TLS objects. (line 106) +* proto (socket.socket attribute): Socket Objects. (line 623) +* Protocol (class in asyncio): Base Protocols. (line 10) +* Protocol (class in typing): Other special directives. + (line 132) +* protocol (ssl.SSLContext attribute): SSL Contexts. (line 609) +* PROTOCOL_SSLv23 (in module ssl): Constants<9>. (line 161) +* PROTOCOL_SSLv3 (in module ssl): Constants<9>. (line 168) +* PROTOCOL_TLS (in module ssl): Constants<9>. (line 131) +* PROTOCOL_TLS_CLIENT (in module ssl): Constants<9>. (line 144) +* PROTOCOL_TLS_SERVER (in module ssl): Constants<9>. (line 153) +* PROTOCOL_TLSv1 (in module ssl): Constants<9>. (line 184) +* PROTOCOL_TLSv1_1 (in module ssl): Constants<9>. (line 191) +* PROTOCOL_TLSv1_2 (in module ssl): Constants<9>. (line 201) +* protocol_version (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 162) +* PROTOCOL_VERSION (imaplib.IMAP4 attribute): IMAP4 Objects. (line 393) +* protocol; context management: Context Manager Types. + (line 6) +* protocol; iterator: Iterator Types. (line 6) +* ProtocolError (class in xmlrpc.client): ProtocolError Objects. + (line 6) +* provisional API: Glossary. (line 1238) +* provisional package: Glossary. (line 1258) +* proxy() (in module weakref): weakref — Weak references. + (line 136) +* proxyauth() (imaplib.IMAP4 method): IMAP4 Objects. (line 194) +* ProxyBasicAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 372) +* ProxyDigestAuthHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 404) +* ProxyHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 298) +* ProxyType (in module weakref): weakref — Weak references. + (line 336) +* ProxyTypes (in module weakref): weakref — Weak references. + (line 344) +* pryear() (calendar.TextCalendar method): calendar — General calendar-related functions. + (line 218) +* ps1 (in module sys): sys — System-specific parameters and functions. + (line 1481) +* ps2 (in module sys): sys — System-specific parameters and functions. + (line 1481) +* pstdev() (in module statistics): Function details. (line 371) +* pthread_getcpuclockid() (in module time): Functions<5>. (line 21) +* pthread_kill() (in module signal): Module contents<2>. (line 345) +* pthread_sigmask() (in module signal): Module contents<2>. (line 375) +* pthreads: _thread — Low-level threading API. + (line 16) +* pthreads (sys._emscripten_info attribute): sys — System-specific parameters and functions. + (line 360) +* ptsname() (in module os): File Descriptor Operations. + (line 641) +* pu() (in module turtle): Drawing state. (line 12) +* publicId (xml.dom.DocumentType attribute): DocumentType Objects. + (line 17) +* PullDom (class in xml.dom.pulldom): xml dom pulldom — Support for building partial DOM trees. + (line 76) +* punctuation (in module string): String constants. (line 36) +* punctuation_chars (shlex.shlex attribute): shlex Objects. (line 183) +* PurePath (class in pathlib): Pure paths. (line 10) +* PurePosixPath (class in pathlib): Pure paths. (line 72) +* PureWindowsPath (class in pathlib): Pure paths. (line 82) +* purge() (in module re): Functions<2>. (line 289) +* Purpose.CLIENT_AUTH (in module ssl): Constants<9>. (line 540) +* Purpose.SERVER_AUTH (in module ssl): Constants<9>. (line 531) +* push_async_callback() (contextlib.AsyncExitStack method): Utilities. + (line 645) +* push_async_exit() (contextlib.AsyncExitStack method): Utilities. + (line 640) +* PUSH_EXC_INFO (opcode): Python Bytecode Instructions. + (line 460) +* PUSH_NULL (opcode): Python Bytecode Instructions. + (line 1102) +* push_source() (shlex.shlex method): shlex Objects. (line 56) +* push_token() (shlex.shlex method): shlex Objects. (line 16) +* push() (code.InteractiveConsole method): Interactive Console Objects. + (line 28) +* push() (contextlib.ExitStack method): Utilities. (line 561) +* put_nowait() (asyncio.Queue method): Queue. (line 73) +* put_nowait() (multiprocessing.Queue method): Pipes and Queues. + (line 147) +* put_nowait() (queue.Queue method): Queue Objects. (line 42) +* put_nowait() (queue.SimpleQueue method): SimpleQueue Objects. + (line 35) +* put() (asyncio.Queue method): Queue. (line 65) +* put() (multiprocessing.Queue method): Pipes and Queues. (line 131) +* put() (multiprocessing.SimpleQueue method): Pipes and Queues. + (line 246) +* put() (queue.Queue method): Queue Objects. (line 29) +* put() (queue.SimpleQueue method): SimpleQueue Objects. + (line 20) +* putch() (in module msvcrt): Console I/O. (line 36) +* putenv() (in module os): Process Parameters. (line 352) +* putheader() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 177) +* putp() (in module curses): Functions<6>. (line 392) +* putrequest() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 166) +* putwch() (in module msvcrt): Console I/O. (line 40) +* putwin() (curses.window method): Window Objects. (line 456) +* pvariance() (in module statistics): Function details. (line 380) +* pwd() (ftplib.FTP method): FTP objects. (line 344) +* pwrite() (in module os): File Descriptor Operations. + (line 655) +* pwritev() (in module os): File Descriptor Operations. + (line 666) +* Py_ABS (C macro): Useful macros. (line 34) +* Py_AddPendingCall (C function): Asynchronous Notifications. + (line 10) +* Py_ALWAYS_INLINE (C macro): Useful macros. (line 40) +* Py_ASNATIVEBYTES_ALLOW_INDEX (C macro): Integer Objects. (line 461) +* Py_ASNATIVEBYTES_BIG_ENDIAN (C macro): Integer Objects. (line 446) +* Py_ASNATIVEBYTES_DEFAULTS (C macro): Integer Objects. (line 443) +* Py_ASNATIVEBYTES_LITTLE_ENDIAN (C macro): Integer Objects. (line 449) +* Py_ASNATIVEBYTES_NATIVE_ENDIAN (C macro): Integer Objects. (line 452) +* Py_ASNATIVEBYTES_REJECT_NEGATIVE (C macro): Integer Objects. + (line 458) +* Py_ASNATIVEBYTES_UNSIGNED_BUFFER (C macro): Integer Objects. + (line 455) +* Py_AtExit (C function): Process Control. (line 32) +* Py_AUDIT_READ (C macro): Member flags. (line 12) +* Py_AuditHookFunction (C type): System Functions. (line 150) +* Py_BEGIN_ALLOW_THREADS (C macro): Releasing the GIL from extension code. + (line 21) +* Py_BEGIN_ALLOW_THREADS (C macro) <1>: High-level API. (line 165) +* Py_BEGIN_CRITICAL_SECTION (C macro): Python Critical Section API. + (line 49) +* Py_BEGIN_CRITICAL_SECTION2 (C macro): Python Critical Section API. + (line 77) +* Py_BLOCK_THREADS (C macro): High-level API. (line 179) +* Py_buffer (C type): Buffer structure. (line 25) +* Py_buffer.buf (C member): Buffer structure. (line 27) +* Py_buffer.format (C member): Buffer structure. (line 89) +* Py_buffer.internal (C member): Buffer structure. (line 152) +* Py_buffer.itemsize (C member): Buffer structure. (line 69) +* Py_buffer.len (C member): Buffer structure. (line 52) +* Py_buffer.ndim (C member): Buffer structure. (line 98) +* Py_buffer.obj (C member): Buffer structure. (line 39) +* Py_buffer.readonly (C member): Buffer structure. (line 64) +* Py_buffer.shape (C member): Buffer structure. (line 107) +* Py_buffer.strides (C member): Buffer structure. (line 120) +* Py_buffer.suboffsets (C member): Buffer structure. (line 133) +* Py_BuildValue (C function): Building values. (line 6) +* Py_BytesMain (C function): Initializing and finalizing the interpreter. + (line 114) +* Py_BytesWarningFlag (C var): Global configuration variables. + (line 15) +* Py_CHARMASK (C macro): Useful macros. (line 65) +* Py_CLEANUP_SUPPORTED (C macro): Other objects. (line 40) +* Py_CLEAR (C function): Reference Counting. (line 144) +* Py_CompileString (C function): The Very High Level Layer. + (line 221) +* Py_CompileString (C function) <1>: The Very High Level Layer. + (line 312) +* Py_CompileString (C function) <2>: The Very High Level Layer. + (line 317) +* Py_CompileString (C function) <3>: The Very High Level Layer. + (line 324) +* Py_CompileStringExFlags (C function): The Very High Level Layer. + (line 255) +* Py_CompileStringFlags (C function): The Very High Level Layer. + (line 228) +* Py_CompileStringObject (C function): The Very High Level Layer. + (line 234) +* Py_complex (C type): Complex Numbers as C Structures. + (line 10) +* Py_complex.imag (C member): Complex Numbers as C Structures. + (line 17) +* Py_complex.real (C member): Complex Numbers as C Structures. + (line 17) +* Py_CONSTANT_ELLIPSIS (C macro): Object Protocol. (line 28) +* Py_CONSTANT_EMPTY_BYTES (C macro): Object Protocol. (line 43) +* Py_CONSTANT_EMPTY_STR (C macro): Object Protocol. (line 40) +* Py_CONSTANT_EMPTY_TUPLE (C macro): Object Protocol. (line 46) +* Py_CONSTANT_FALSE (C macro): Object Protocol. (line 22) +* Py_CONSTANT_NONE (C macro): Object Protocol. (line 19) +* Py_CONSTANT_NOT_IMPLEMENTED (C macro): Object Protocol. (line 31) +* Py_CONSTANT_ONE (C macro): Object Protocol. (line 37) +* Py_CONSTANT_TRUE (C macro): Object Protocol. (line 25) +* Py_CONSTANT_ZERO (C macro): Object Protocol. (line 34) +* PY_CXX_CONST (C macro): API Functions. (line 115) +* Py_DEBUG (C macro): Debugging Builds. (line 17) +* Py_DEBUG (in module test.support): test support — Utilities for the Python test suite. + (line 116) +* Py_DebugFlag (C var): Global configuration variables. + (line 29) +* Py_DecodeLocale (C function): Operating System Utilities. + (line 115) +* Py_DECREF (C function): Reference Counts<2>. + (line 18) +* Py_DECREF (C function) <1>: Reference Counting. (line 104) +* Py_DecRef (C function): Reference Counting. (line 167) +* Py_DEPRECATED (C macro): Useful macros. (line 70) +* Py_DontWriteBytecodeFlag (C var): Global configuration variables. + (line 43) +* Py_Ellipsis (C var): Ellipsis Object. (line 11) +* Py_EncodeLocale (C function): Operating System Utilities. + (line 168) +* Py_END_ALLOW_THREADS (C macro): Releasing the GIL from extension code. + (line 21) +* Py_END_ALLOW_THREADS (C macro) <1>: High-level API. (line 172) +* Py_END_CRITICAL_SECTION (C macro): Python Critical Section API. + (line 64) +* Py_END_CRITICAL_SECTION2 (C macro): Python Critical Section API. + (line 93) +* Py_EndInterpreter (C function): Sub-interpreter support. + (line 206) +* Py_EnterRecursiveCall (C function): Recursion Control. (line 13) +* Py_EQ (C macro): PyTypeObject Slots. (line 1072) +* Py_eval_input (C var): The Very High Level Layer. + (line 310) +* Py_Exit (C function): Process Control. (line 22) +* Py_ExitStatusException (C function): PyStatus. (line 65) +* Py_False (C var): Boolean Objects. (line 21) +* Py_FatalError (C function): Process Control. (line 6) +* Py_FatalError(): Process-wide parameters. + (line 218) +* Py_FdIsInteractive (C function): Operating System Utilities. + (line 18) +* Py_file_input (C var): The Very High Level Layer. + (line 315) +* Py_Finalize (C function): Initializing and finalizing the interpreter. + (line 109) +* Py_FinalizeEx (C function): Process Control. (line 23) +* Py_FinalizeEx (C function) <1>: Process Control. (line 33) +* Py_FinalizeEx (C function) <2>: Initializing and finalizing the interpreter. + (line 7) +* Py_FinalizeEx (C function) <3>: Initializing and finalizing the interpreter. + (line 64) +* Py_FinalizeEx (C function) <4>: Sub-interpreter support. + (line 169) +* Py_FinalizeEx (C function) <5>: Sub-interpreter support. + (line 207) +* Py_FrozenFlag (C var): Global configuration variables. + (line 57) +* Py_GE (C macro): PyTypeObject Slots. (line 1081) +* Py_GenericAlias (C function): Objects for Type Hinting. + (line 10) +* Py_GenericAliasType (C var): Objects for Type Hinting. + (line 42) +* Py_GetArgcArgv (C function): Py_GetArgcArgv. (line 6) +* Py_GetBuildInfo (C function): Process-wide parameters. + (line 205) +* Py_GetCompiler (C function): Process-wide parameters. + (line 194) +* Py_GetConstant (C function): Object Protocol. (line 6) +* Py_GetConstantBorrowed (C function): Object Protocol. (line 57) +* Py_GetCopyright (C function): Process-wide parameters. + (line 184) +* Py_GETENV (C macro): Useful macros. (line 81) +* Py_GetExecPrefix (C function): Embedding Python<2>. + (line 42) +* Py_GetExecPrefix (C function) <1>: Process-wide parameters. + (line 68) +* Py_GetPath (C function): Embedding Python<2>. + (line 42) +* Py_GetPath (C function) <1>: Process-wide parameters. + (line 135) +* Py_GetPath(): Process-wide parameters. + (line 7) +* Py_GetPlatform (C function): Process-wide parameters. + (line 172) +* Py_GetPrefix (C function): Embedding Python<2>. + (line 42) +* Py_GetPrefix (C function) <1>: Process-wide parameters. + (line 45) +* Py_GetProgramFullPath (C function): Embedding Python<2>. + (line 42) +* Py_GetProgramFullPath (C function) <1>: Process-wide parameters. + (line 116) +* Py_GetProgramName (C function): Process-wide parameters. + (line 30) +* Py_GetPythonHome (C function): Process-wide parameters. + (line 308) +* Py_GetVersion (C function): Process-wide parameters. + (line 158) +* Py_GT (C macro): PyTypeObject Slots. (line 1078) +* Py_hash_t (C type): PyHash API. (line 9) +* Py_HashPointer (C function): PyHash API. (line 85) +* Py_HashRandomizationFlag (C var): Global configuration variables. + (line 70) +* Py_IgnoreEnvironmentFlag (C var): Global configuration variables. + (line 85) +* Py_INCREF (C function): Reference Counts<2>. + (line 18) +* Py_INCREF (C function) <1>: Reference Counting. (line 42) +* Py_IncRef (C function): Reference Counting. (line 161) +* Py_Initialize (C function): Embedding Python<2>. + (line 12) +* Py_Initialize (C function) <1>: Initializing and finalizing the interpreter. + (line 6) +* Py_Initialize (C function) <2>: Sub-interpreter support. + (line 169) +* Py_Initialize(): Process-wide parameters. + (line 7) +* Py_InitializeEx (C function): Initializing and finalizing the interpreter. + (line 30) +* Py_InitializeFromConfig (C function): Initializing and finalizing the interpreter. + (line 40) +* Py_InspectFlag (C var): Global configuration variables. + (line 98) +* Py_InteractiveFlag (C var): Global configuration variables. + (line 114) +* Py_Is (C function): Base object types and macros. + (line 59) +* Py_IS_TYPE (C function): Base object types and macros. + (line 98) +* Py_IsFalse (C function): Base object types and macros. + (line 79) +* Py_IsFinalizing (C function): Initializing and finalizing the interpreter. + (line 57) +* Py_IsInitialized (C function): Embedding Python<2>. + (line 51) +* Py_IsInitialized (C function) <1>: Initializing and finalizing the interpreter. + (line 51) +* Py_IsNone (C function): Base object types and macros. + (line 65) +* Py_IsolatedFlag (C var): Global configuration variables. + (line 124) +* Py_IsTrue (C function): Base object types and macros. + (line 72) +* Py_LE (C macro): PyTypeObject Slots. (line 1069) +* Py_LeaveRecursiveCall (C function): Recursion Control. (line 33) +* Py_LegacyWindowsFSEncodingFlag (C var): Global configuration variables. + (line 140) +* Py_LegacyWindowsStdioFlag (C var): Global configuration variables. + (line 160) +* Py_LIMITED_API (C macro): Limited C API. (line 11) +* Py_LT (C macro): PyTypeObject Slots. (line 1066) +* Py_Main (C function): Initializing and finalizing the interpreter. + (line 122) +* PY_MAJOR_VERSION (C macro): API and ABI Versioning. + (line 13) +* Py_MAX (C macro): Useful macros. (line 86) +* Py_MEMBER_SIZE (C macro): Useful macros. (line 92) +* PY_MICRO_VERSION (C macro): API and ABI Versioning. + (line 21) +* Py_MIN (C macro): Useful macros. (line 98) +* PY_MINOR_VERSION (C macro): API and ABI Versioning. + (line 17) +* Py_mod_create (C macro): Multi-phase initialization. + (line 77) +* Py_mod_exec (C macro): Multi-phase initialization. + (line 111) +* Py_mod_gil (C macro): Multi-phase initialization. + (line 154) +* Py_MOD_GIL_NOT_USED (C macro): Multi-phase initialization. + (line 164) +* Py_MOD_GIL_USED (C macro): Multi-phase initialization. + (line 158) +* Py_mod_multiple_interpreters (C macro): Multi-phase initialization. + (line 123) +* Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED (C macro): Multi-phase initialization. + (line 127) +* Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED (C macro): Multi-phase initialization. + (line 131) +* Py_MOD_PER_INTERPRETER_GIL_SUPPORTED (C macro): Multi-phase initialization. + (line 137) +* PY_MONITORING_EVENT_BRANCH (C macro): Managing the Monitoring State. + (line 44) +* PY_MONITORING_EVENT_C_RAISE (C macro): Managing the Monitoring State. + (line 50) +* PY_MONITORING_EVENT_C_RETURN (C macro): Managing the Monitoring State. + (line 53) +* PY_MONITORING_EVENT_CALL (C macro): Managing the Monitoring State. + (line 47) +* PY_MONITORING_EVENT_EXCEPTION_HANDLED (C macro): Managing the Monitoring State. + (line 56) +* PY_MONITORING_EVENT_INSTRUCTION (C macro): Managing the Monitoring State. + (line 59) +* PY_MONITORING_EVENT_JUMP (C macro): Managing the Monitoring State. + (line 62) +* PY_MONITORING_EVENT_LINE (C macro): Managing the Monitoring State. + (line 65) +* PY_MONITORING_EVENT_PY_RESUME (C macro): Managing the Monitoring State. + (line 68) +* PY_MONITORING_EVENT_PY_RETURN (C macro): Managing the Monitoring State. + (line 71) +* PY_MONITORING_EVENT_PY_START (C macro): Managing the Monitoring State. + (line 74) +* PY_MONITORING_EVENT_PY_THROW (C macro): Managing the Monitoring State. + (line 77) +* PY_MONITORING_EVENT_PY_UNWIND (C macro): Managing the Monitoring State. + (line 80) +* PY_MONITORING_EVENT_PY_YIELD (C macro): Managing the Monitoring State. + (line 83) +* PY_MONITORING_EVENT_RAISE (C macro): Managing the Monitoring State. + (line 86) +* PY_MONITORING_EVENT_RERAISE (C macro): Managing the Monitoring State. + (line 89) +* PY_MONITORING_EVENT_STOP_ITERATION (C macro): Managing the Monitoring State. + (line 92) +* PY_MONITORING_IS_INSTRUMENTED_EVENT (C function): Managing the Monitoring State. + (line 100) +* Py_NE (C macro): PyTypeObject Slots. (line 1075) +* Py_NewInterpreter (C function): Sub-interpreter support. + (line 196) +* Py_NewInterpreterFromConfig (C function): Sub-interpreter support. + (line 109) +* Py_NewRef (C function): Reference Counting. (line 72) +* Py_NO_INLINE (C macro): Useful macros. (line 104) +* Py_None (C var): The None Object. (line 11) +* Py_NoSiteFlag (C var): Global configuration variables. + (line 178) +* Py_NotImplemented (C var): Object Protocol. (line 71) +* Py_NoUserSiteDirectory (C var): Global configuration variables. + (line 194) +* py_object (class in ctypes): Fundamental data types<2>. + (line 220) +* Py_OpenCodeHookFunction (C type): File Objects. (line 65) +* Py_OptimizeFlag (C var): Global configuration variables. + (line 208) +* 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 macro) <1>: File Objects. (line 94) +* PY_PYTHON: Customizing default Python versions. + (line 18) +* Py_QuietFlag (C var): Global configuration variables. + (line 219) +* Py_READONLY (C macro): Member flags. (line 8) +* Py_REFCNT (C function): Reference Counting. (line 9) +* Py_RELATIVE_OFFSET (C macro): Member flags. (line 17) +* PY_RELEASE_LEVEL (C macro): API and ABI Versioning. + (line 25) +* PY_RELEASE_SERIAL (C macro): API and ABI Versioning. + (line 30) +* Py_ReprEnter (C function): Recursion Control. (line 47) +* Py_ReprLeave (C function): Recursion Control. (line 64) +* PY_RESUME (monitoring event): Events. (line 43) +* PY_RETURN (monitoring event): Events. (line 48) +* Py_RETURN_FALSE (C macro): Boolean Objects. (line 37) +* Py_RETURN_NONE (C macro): The None Object. (line 19) +* Py_RETURN_NOTIMPLEMENTED (C macro): Object Protocol. (line 76) +* Py_RETURN_RICHCOMPARE (C macro): PyTypeObject Slots. (line 1087) +* Py_RETURN_TRUE (C macro): Boolean Objects. (line 41) +* Py_RunMain (C function): Initializing and finalizing the interpreter. + (line 170) +* Py_SET_REFCNT (C function): Reference Counting. (line 29) +* Py_SET_SIZE (C function): Base object types and macros. + (line 121) +* Py_SET_TYPE (C function): Base object types and macros. + (line 105) +* Py_SetProgramName (C function): Process-wide parameters. + (line 6) +* Py_SetPythonHome (C function): Process-wide parameters. + (line 289) +* Py_SETREF (C macro): Reference Counting. (line 173) +* Py_single_input (C var): The Very High Level Layer. + (line 322) +* Py_SIZE (C function): Base object types and macros. + (line 111) +* Py_ssize_t (C type): Types. (line 14) +* PY_SSIZE_T_MAX (C macro): Integer Objects. (line 239) +* PY_START (monitoring event): Events. (line 53) +* Py_STRINGIFY (C macro): Useful macros. (line 116) +* Py_T_BOOL (C macro): Member types. (line 59) +* Py_T_BYTE (C macro): Member types. (line 20) +* Py_T_CHAR (C macro): Member types. (line 68) +* Py_T_DOUBLE (C macro): Member types. (line 56) +* Py_T_FLOAT (C macro): Member types. (line 53) +* Py_T_INT (C macro): Member types. (line 26) +* Py_T_LONG (C macro): Member types. (line 29) +* Py_T_LONGLONG (C macro): Member types. (line 32) +* Py_T_OBJECT_EX (C macro): Member types. (line 71) +* Py_T_PYSSIZET (C macro): Member types. (line 50) +* Py_T_SHORT (C macro): Member types. (line 23) +* Py_T_STRING (C macro): Member types. (line 62) +* Py_T_STRING_INPLACE (C macro): Member types. (line 65) +* Py_T_UBYTE (C macro): Member types. (line 35) +* Py_T_UINT (C macro): Member types. (line 38) +* Py_T_ULONG (C macro): Member types. (line 44) +* Py_T_ULONGLONG (C macro): Member types. (line 47) +* Py_T_USHORT (C macro): Member types. (line 41) +* PY_THROW (monitoring event): Events. (line 58) +* Py_TPFLAGS_BASE_EXC_SUBCLASS (C macro): PyTypeObject Slots. + (line 716) +* Py_TPFLAGS_BASETYPE (C macro): PyTypeObject Slots. (line 566) +* Py_TPFLAGS_BYTES_SUBCLASS (C macro): PyTypeObject Slots. (line 710) +* Py_TPFLAGS_DEFAULT (C macro): PyTypeObject Slots. (line 616) +* Py_TPFLAGS_DICT_SUBCLASS (C macro): PyTypeObject Slots. (line 714) +* Py_TPFLAGS_DISALLOW_INSTANTIATION (C macro): PyTypeObject Slots. + (line 772) +* Py_TPFLAGS_HAVE_FINALIZE (C macro): PyTypeObject Slots. (line 729) +* Py_TPFLAGS_HAVE_GC (C macro): PyTypeObject Slots. (line 594) +* Py_TPFLAGS_HAVE_VECTORCALL (C macro): PyTypeObject Slots. (line 740) +* Py_TPFLAGS_HEAPTYPE (C macro): PyTypeObject Slots. (line 548) +* Py_TPFLAGS_IMMUTABLETYPE (C macro): PyTypeObject Slots. (line 758) +* Py_TPFLAGS_ITEMS_AT_END (C macro): PyTypeObject Slots. (line 684) +* Py_TPFLAGS_LIST_SUBCLASS (C macro): PyTypeObject Slots. (line 706) +* Py_TPFLAGS_LONG_SUBCLASS (C macro): PyTypeObject Slots. (line 704) +* Py_TPFLAGS_MANAGED_DICT (C macro): PyTypeObject Slots. (line 652) +* Py_TPFLAGS_MANAGED_WEAKREF (C macro): PyTypeObject Slots. (line 672) +* Py_TPFLAGS_MAPPING (C macro): PyTypeObject Slots. (line 800) +* Py_TPFLAGS_METHOD_DESCRIPTOR (C macro): PyTypeObject Slots. + (line 627) +* Py_TPFLAGS_READY (C macro): PyTypeObject Slots. (line 576) +* Py_TPFLAGS_READYING (C macro): PyTypeObject Slots. (line 585) +* Py_TPFLAGS_SEQUENCE (C macro): PyTypeObject Slots. (line 824) +* Py_TPFLAGS_TUPLE_SUBCLASS (C macro): PyTypeObject Slots. (line 708) +* Py_TPFLAGS_TYPE_SUBCLASS (C macro): PyTypeObject Slots. (line 718) +* Py_TPFLAGS_UNICODE_SUBCLASS (C macro): PyTypeObject Slots. (line 712) +* Py_TPFLAGS_VALID_VERSION_TAG (C macro): PyTypeObject Slots. + (line 848) +* Py_tracefunc (C type): Profiling and Tracing. + (line 18) +* Py_True (C var): Boolean Objects. (line 29) +* Py_tss_NEEDS_INIT (C macro): Thread Specific Storage TSS API. + (line 28) +* Py_tss_t (C type): Thread Specific Storage TSS API. + (line 17) +* Py_TYPE (C function): Base object types and macros. + (line 86) +* Py_UCS1 (C type): Unicode Type. (line 9) +* Py_UCS2 (C type): Unicode Type. (line 9) +* Py_UCS4 (C type): Unicode Type. (line 9) +* Py_uhash_t (C type): PyHash API. (line 15) +* Py_UNBLOCK_THREADS (C macro): High-level API. (line 184) +* Py_UnbufferedStdioFlag (C var): Global configuration variables. + (line 234) +* Py_UNICODE (C type): Unicode Type. (line 19) +* Py_UNICODE_IS_HIGH_SURROGATE (C function): Unicode Character Properties. + (line 99) +* Py_UNICODE_IS_LOW_SURROGATE (C function): Unicode Character Properties. + (line 103) +* Py_UNICODE_IS_SURROGATE (C function): Unicode Character Properties. + (line 95) +* Py_UNICODE_ISALNUM (C function): Unicode Character Properties. + (line 52) +* Py_UNICODE_ISALPHA (C function): Unicode Character Properties. + (line 47) +* Py_UNICODE_ISDECIMAL (C function): Unicode Character Properties. + (line 35) +* Py_UNICODE_ISDIGIT (C function): Unicode Character Properties. + (line 39) +* Py_UNICODE_ISLINEBREAK (C function): Unicode Character Properties. + (line 30) +* Py_UNICODE_ISLOWER (C function): Unicode Character Properties. + (line 15) +* Py_UNICODE_ISNUMERIC (C function): Unicode Character Properties. + (line 43) +* Py_UNICODE_ISPRINTABLE (C function): Unicode Character Properties. + (line 57) +* Py_UNICODE_ISSPACE (C function): Unicode Character Properties. + (line 10) +* Py_UNICODE_ISTITLE (C function): Unicode Character Properties. + (line 25) +* Py_UNICODE_ISUPPER (C function): Unicode Character Properties. + (line 20) +* Py_UNICODE_JOIN_SURROGATES (C function): Unicode Character Properties. + (line 107) +* Py_UNICODE_TODECIMAL (C function): Unicode Character Properties. + (line 76) +* Py_UNICODE_TODIGIT (C function): Unicode Character Properties. + (line 82) +* Py_UNICODE_TOLOWER (C function): Unicode Character Properties. + (line 64) +* Py_UNICODE_TONUMERIC (C function): Unicode Character Properties. + (line 88) +* Py_UNICODE_TOTITLE (C function): Unicode Character Properties. + (line 72) +* Py_UNICODE_TOUPPER (C function): Unicode Character Properties. + (line 68) +* Py_UNREACHABLE (C macro): Useful macros. (line 123) +* Py_UNUSED (C macro): Useful macros. (line 148) +* PY_UNWIND (monitoring event): Events. (line 62) +* Py_VaBuildValue (C function): Building values. (line 202) +* PY_VECTORCALL_ARGUMENTS_OFFSET (C macro): The Vectorcall Protocol. + (line 69) +* Py_VerboseFlag (C var): Global configuration variables. + (line 247) +* Py_Version (C var): API and ABI Versioning. + (line 69) +* PY_VERSION_HEX (C macro): API and ABI Versioning. + (line 34) +* Py_VISIT (C macro): Supporting Cyclic Garbage Collection. + (line 180) +* Py_XDECREF (C function): Exceptions<21>. (line 123) +* Py_XDECREF (C function) <1>: Reference Counting. (line 138) +* Py_XINCREF (C function): Reference Counting. (line 65) +* Py_XNewRef (C function): Reference Counting. (line 96) +* Py_XSETREF (C macro): Reference Counting. (line 199) +* PY_YIELD (monitoring event): Events. (line 66) +* PyAIter_Check (C function): Iterator Protocol. (line 14) +* PyAnySet_Check (C function): Set Objects. (line 54) +* PyAnySet_CheckExact (C function): Set Objects. (line 67) +* PyArg_Parse (C function): API Functions. (line 55) +* PyArg_ParseTuple (C function): Extracting Parameters in Extension Functions. + (line 6) +* PyArg_ParseTuple (C function) <1>: API Functions. (line 6) +* PyArg_ParseTupleAndKeywords (C function): Keyword Parameters for Extension Functions. + (line 6) +* PyArg_ParseTupleAndKeywords (C function) <1>: API Functions. + (line 19) +* PyArg_UnpackTuple (C function): API Functions. (line 75) +* PyArg_ValidateKeywordArguments (C function): API Functions. + (line 47) +* PyArg_VaParse (C function): API Functions. (line 13) +* PyArg_VaParseTupleAndKeywords (C function): API Functions. (line 40) +* PyASCIIObject (C type): Unicode Type. (line 30) +* PyAsyncMethods (C type): Async Object Structures. + (line 8) +* PyAsyncMethods.am_aiter (C member): Async Object Structures. + (line 35) +* PyAsyncMethods.am_anext (C member): Async Object Structures. + (line 47) +* PyAsyncMethods.am_await (C member): Async Object Structures. + (line 23) +* PyAsyncMethods.am_send (C member): Async Object Structures. + (line 56) +* PyBaseObject_Type (C var): Base object types and macros. + (line 55) +* PyBool_Check (C function): Boolean Objects. (line 16) +* PyBool_FromLong (C function): Boolean Objects. (line 45) +* PyBool_Type (C var): Boolean Objects. (line 11) +* PyBUF_ANY_CONTIGUOUS (C macro): contiguity requests. + (line 20) +* PyBUF_C_CONTIGUOUS (C macro): contiguity requests. + (line 14) +* PyBUF_CONTIG (C macro): compound requests. (line 36) +* PyBUF_CONTIG_RO (C macro): compound requests. (line 39) +* PyBUF_F_CONTIGUOUS (C macro): contiguity requests. + (line 17) +* PyBUF_FORMAT (C macro): readonly format. (line 16) +* PyBUF_FULL (C macro): compound requests. (line 18) +* PyBUF_FULL_RO (C macro): compound requests. (line 21) +* PyBUF_INDIRECT (C macro): shape strides suboffsets. + (line 14) +* PyBUF_MAX_NDIM (C macro): Buffer structure. (line 162) +* PyBUF_ND (C macro): shape strides suboffsets. + (line 20) +* PyBUF_READ (C macro): MemoryView objects. (line 18) +* PyBUF_RECORDS (C macro): compound requests. (line 24) +* PyBUF_RECORDS_RO (C macro): compound requests. (line 27) +* PyBUF_SIMPLE (C macro): shape strides suboffsets. + (line 23) +* PyBUF_STRIDED (C macro): compound requests. (line 30) +* PyBUF_STRIDED_RO (C macro): compound requests. (line 33) +* PyBUF_STRIDES (C macro): shape strides suboffsets. + (line 17) +* PyBUF_WRITABLE (C macro): readonly format. (line 6) +* PyBUF_WRITE (C macro): MemoryView objects. (line 22) +* PyBuffer_FillContiguousStrides (C function): Buffer-related functions. + (line 87) +* PyBuffer_FillInfo (C function): Buffer-related functions. + (line 96) +* PyBuffer_FromContiguous (C function): Buffer-related functions. + (line 63) +* PyBuffer_GetPointer (C function): Buffer-related functions. + (line 57) +* PyBuffer_IsContiguous (C function): Buffer-related functions. + (line 49) +* PyBuffer_Release (C function): Buffer-related functions. + (line 31) +* PyBuffer_SizeFromFormat (C function): Buffer-related functions. + (line 41) +* PyBuffer_ToContiguous (C function): Buffer-related functions. + (line 70) +* PyBufferProcs (C type): Buffer Protocol. (line 20) +* PyBufferProcs (C type) <1>: Buffer Object Structures. + (line 6) +* PyBufferProcs.bf_getbuffer (C member): Buffer Object Structures. + (line 12) +* PyBufferProcs.bf_releasebuffer (C member): Buffer Object Structures. + (line 60) +* PyByteArray_AS_STRING (C function): Macros. (line 8) +* PyByteArray_AsString (C function): Direct API functions. + (line 35) +* PyByteArray_Check (C function): Type check macros. (line 6) +* PyByteArray_CheckExact (C function): Type check macros. (line 11) +* PyByteArray_Concat (C function): Direct API functions. + (line 22) +* PyByteArray_FromObject (C function): Direct API functions. + (line 6) +* PyByteArray_FromStringAndSize (C function): Direct API functions. + (line 14) +* PyByteArray_GET_SIZE (C function): Macros. (line 13) +* PyByteArray_Resize (C function): Direct API functions. + (line 40) +* PyByteArray_Size (C function): Direct API functions. + (line 30) +* PyByteArray_Type (C var): Byte Array Objects. (line 11) +* PyByteArrayObject (C type): Byte Array Objects. (line 6) +* PyBytes_AS_STRING (C function): Bytes Objects<2>. (line 138) +* PyBytes_AsString (C function): Bytes Objects<2>. (line 127) +* PyBytes_AsStringAndSize (C function): Bytes Objects<2>. (line 143) +* PyBytes_Check (C function): Bytes Objects<2>. (line 19) +* PyBytes_CheckExact (C function): Bytes Objects<2>. (line 24) +* PyBytes_Concat (C function): Bytes Objects<2>. (line 165) +* PyBytes_ConcatAndDel (C function): Bytes Objects<2>. (line 175) +* PyBytes_FromFormat (C function): Bytes Objects<2>. (line 43) +* PyBytes_FromFormatV (C function): Bytes Objects<2>. (line 108) +* PyBytes_FromObject (C function): Bytes Objects<2>. (line 114) +* PyBytes_FromString (C function): Bytes Objects<2>. (line 30) +* PyBytes_FromStringAndSize (C function): Bytes Objects<2>. (line 36) +* PyBytes_GET_SIZE (C function): Bytes Objects<2>. (line 123) +* PyBytes_Size (C function): Bytes Objects<2>. (line 119) +* PyBytes_Type (C var): Bytes Objects<2>. (line 14) +* PyBytesObject (C type): Bytes Objects<2>. (line 9) +* pycache_prefix (in module sys): sys — System-specific parameters and functions. + (line 372) +* PyCallable_Check (C function): Call Support API. (line 6) +* PyCallIter_Check (C function): Iterator Objects. (line 34) +* PyCallIter_New (C function): Iterator Objects. (line 39) +* PyCallIter_Type (C var): Iterator Objects. (line 29) +* PyCapsule (C type): Capsules<2>. (line 11) +* PyCapsule_CheckExact (C function): Capsules<2>. (line 29) +* PyCapsule_Destructor (C type): Capsules<2>. (line 20) +* PyCapsule_GetContext (C function): Capsules<2>. (line 76) +* PyCapsule_GetDestructor (C function): Capsules<2>. (line 65) +* PyCapsule_GetName (C function): Capsules<2>. (line 86) +* PyCapsule_GetPointer (C function): Capsules<2>. (line 54) +* PyCapsule_Import (C function): Capsules<2>. (line 96) +* PyCapsule_IsValid (C function): Capsules<2>. (line 118) +* PyCapsule_New (C function): Capsules<2>. (line 34) +* PyCapsule_SetContext (C function): Capsules<2>. (line 134) +* PyCapsule_SetDestructor (C function): Capsules<2>. (line 142) +* PyCapsule_SetName (C function): Capsules<2>. (line 150) +* PyCapsule_SetPointer (C function): Capsules<2>. (line 160) +* PyCell_Check (C function): Cell Objects. (line 24) +* PyCell_Get (C function): Cell Objects. (line 33) +* PyCell_GET (C function): Cell Objects. (line 38) +* PyCell_New (C function): Cell Objects. (line 29) +* PyCell_Set (C function): Cell Objects. (line 43) +* PyCell_SET (C function): Cell Objects. (line 52) +* PyCell_Type (C var): Cell Objects. (line 20) +* PyCellObject (C type): Cell Objects. (line 16) +* PyCF_ALLOW_TOP_LEVEL_AWAIT (C macro): The Very High Level Layer. + (line 356) +* PyCF_ALLOW_TOP_LEVEL_AWAIT (in module ast): Compiler Flags. + (line 9) +* PyCF_ONLY_AST (C macro): The Very High Level Layer. + (line 356) +* PyCF_ONLY_AST (in module ast): Compiler Flags. (line 16) +* PyCF_OPTIMIZED_AST (C macro): The Very High Level Layer. + (line 356) +* PyCF_OPTIMIZED_AST (in module ast): Compiler Flags. (line 21) +* PyCF_TYPE_COMMENTS (C macro): The Very High Level Layer. + (line 356) +* PyCF_TYPE_COMMENTS (in module ast): Compiler Flags. (line 28) +* PyCFunction (C type): Implementing functions and methods. + (line 6) +* PyCFunction_New (C function): Implementing functions and methods. + (line 257) +* PyCFunction_NewEx (C function): Implementing functions and methods. + (line 252) +* 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 (class in py_compile): py_compile — Compile Python source files. + (line 92) +* PyCMethod (C type): Implementing functions and methods. + (line 49) +* PyCMethod_New (C function): Implementing functions and methods. + (line 225) +* PyCode_Addr2Line (C function): Code Objects<2>. (line 97) +* PyCode_Addr2Location (C function): Code Objects<2>. (line 106) +* PyCode_AddWatcher (C function): Code Objects<2>. (line 163) +* PyCode_Check (C function): Code Objects<2>. (line 20) +* PyCode_ClearWatcher (C function): Code Objects<2>. (line 172) +* PyCode_GetCellvars (C function): Code Objects<2>. (line 142) +* PyCode_GetCode (C function): Code Objects<2>. (line 118) +* PyCode_GetFreevars (C function): Code Objects<2>. (line 153) +* PyCode_GetNumFree (C function): Code Objects<2>. (line 25) +* PyCode_GetVarnames (C function): Code Objects<2>. (line 132) +* PyCode_New (C function): Code Objects<2>. (line 64) +* PyCode_NewEmpty (C function): Code Objects<2>. (line 91) +* PyCode_NewWithPosOnlyArgs (C function): Code Objects<2>. (line 82) +* PyCode_Type (C var): Code Objects<2>. (line 15) +* PyCode_WatchCallback (C type): Code Objects<2>. (line 188) +* PyCodec_BackslashReplaceErrors (C function): Registry API for Unicode encoding error handlers. + (line 55) +* PyCodec_Decode (C function): Codec registry and support functions. + (line 38) +* PyCodec_Decoder (C function): Codec lookup API. (line 16) +* PyCodec_Encode (C function): Codec registry and support functions. + (line 27) +* PyCodec_Encoder (C function): Codec lookup API. (line 11) +* PyCodec_IgnoreErrors (C function): Registry API for Unicode encoding error handlers. + (line 39) +* PyCodec_IncrementalDecoder (C function): Codec lookup API. (line 27) +* PyCodec_IncrementalEncoder (C function): Codec lookup API. (line 21) +* PyCodec_KnownEncoding (C function): Codec registry and support functions. + (line 22) +* PyCodec_LookupError (C function): Registry API for Unicode encoding error handlers. + (line 27) +* PyCodec_NameReplaceErrors (C function): Registry API for Unicode encoding error handlers. + (line 61) +* PyCodec_Register (C function): Codec registry and support functions. + (line 6) +* PyCodec_RegisterError (C function): Registry API for Unicode encoding error handlers. + (line 6) +* PyCodec_ReplaceErrors (C function): Registry API for Unicode encoding error handlers. + (line 44) +* PyCodec_StreamReader (C function): Codec lookup API. (line 33) +* PyCodec_StreamWriter (C function): Codec lookup API. (line 39) +* PyCodec_StrictErrors (C function): Registry API for Unicode encoding error handlers. + (line 34) +* PyCodec_Unregister (C function): Codec registry and support functions. + (line 14) +* PyCodec_XMLCharRefReplaceErrors (C function): Registry API for Unicode encoding error handlers. + (line 49) +* PyCodeEvent (C type): Code Objects<2>. (line 181) +* PyCodeObject (C type): Code Objects<2>. (line 10) +* PyCompactUnicodeObject (C type): Unicode Type. (line 30) +* PyCompileError: py_compile — Compile Python source files. + (line 19) +* PyCompilerFlags (C struct): The Very High Level Layer. + (line 328) +* PyCompilerFlags.cf_feature_version (C member): The Very High Level Layer. + (line 344) +* PyCompilerFlags.cf_flags (C member): The Very High Level Layer. + (line 340) +* PyComplex_AsCComplex (C function): Complex Numbers as Python Objects. + (line 72) +* PyComplex_Check (C function): Complex Numbers as Python Objects. + (line 16) +* PyComplex_CheckExact (C function): Complex Numbers as Python Objects. + (line 22) +* PyComplex_FromCComplex (C function): Complex Numbers as Python Objects. + (line 28) +* PyComplex_FromDoubles (C function): Complex Numbers as Python Objects. + (line 34) +* PyComplex_ImagAsDouble (C function): Complex Numbers as Python Objects. + (line 56) +* PyComplex_RealAsDouble (C function): Complex Numbers as Python Objects. + (line 40) +* PyComplex_Type (C var): Complex Numbers as Python Objects. + (line 11) +* PyComplexObject (C type): Complex Numbers as Python Objects. + (line 6) +* PyConfig (C type): PyConfig. (line 6) +* PyConfig_Clear (C function): PyConfig. (line 97) +* PyConfig_InitIsolatedConfig (C function): PyConfig. (line 20) +* PyConfig_InitPythonConfig (C function): PyConfig. (line 15) +* PyConfig_Read (C function): PyConfig. (line 66) +* 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.argv (C member): PyConfig. (line 128) +* PyConfig.base_exec_prefix (C member): PyConfig. (line 173) +* PyConfig.base_executable (C member): PyConfig. (line 183) +* PyConfig.base_prefix (C member): PyConfig. (line 197) +* PyConfig.buffered_stdio (C member): PyConfig. (line 207) +* PyConfig.bytes_warning (C member): PyConfig. (line 220) +* PyConfig.check_hash_pycs_mode (C member): PyConfig. (line 257) +* PyConfig.code_debug_ranges (C member): PyConfig. (line 243) +* PyConfig.configure_c_stdio (C member): PyConfig. (line 277) +* PyConfig.cpu_count (C member): PyConfig. (line 489) +* PyConfig.dev_mode (C member): PyConfig. (line 292) +* PyConfig.dump_refs (C member): PyConfig. (line 301) +* PyConfig.exec_prefix (C member): PyConfig. (line 315) +* PyConfig.executable (C member): PyConfig. (line 327) +* PyConfig.faulthandler (C member): PyConfig. (line 338) +* PyConfig.filesystem_encoding (C member): PyConfig. (line 350) +* PyConfig.filesystem_errors (C member): PyConfig. (line 383) +* PyConfig.hash_seed (C member): PyConfig. (line 405) +* PyConfig.home (C member): PyConfig. (line 420) +* PyConfig.import_time (C member): PyConfig. (line 431) +* PyConfig.inspect (C member): PyConfig. (line 440) +* PyConfig.install_signal_handlers (C member): PyConfig. (line 455) +* PyConfig.int_max_str_digits (C member): PyConfig. (line 469) +* PyConfig.interactive (C member): PyConfig. (line 461) +* PyConfig.isolated (C member): PyConfig. (line 503) +* PyConfig.legacy_windows_stdio (C member): PyConfig. (line 528) +* PyConfig.malloc_stats (C member): PyConfig. (line 545) +* PyConfig.module_search_paths (C member): PyConfig. (line 589) +* PyConfig.module_search_paths_set (C member): PyConfig. (line 591) +* PyConfig.optimization_level (C member): PyConfig. (line 605) +* PyConfig.orig_argv (C member): PyConfig. (line 621) +* PyConfig.parse_argv (C member): PyConfig. (line 639) +* PyConfig.parser_debug (C member): PyConfig. (line 660) +* PyConfig.pathconfig_warnings (C member): PyConfig. (line 674) +* PyConfig.perf_profiling (C member): PyConfig. (line 868) +* PyConfig.platlibdir (C member): PyConfig. (line 558) +* PyConfig.prefix (C member): PyConfig. (line 686) +* PyConfig.program_name (C member): PyConfig. (line 697) +* PyConfig.pycache_prefix (C member): PyConfig. (line 718) +* PyConfig.pythonpath_env (C member): PyConfig. (line 578) +* PyConfig.quiet (C member): PyConfig. (line 731) +* PyConfig.run_command (C member): PyConfig. (line 740) +* PyConfig.run_filename (C member): PyConfig. (line 748) +* PyConfig.run_module (C member): PyConfig. (line 762) +* PyConfig.run_presite (C member): PyConfig. (line 770) +* PyConfig.safe_path (C member): PyConfig. (line 151) +* PyConfig.show_ref_count (C member): PyConfig. (line 784) +* PyConfig.site_import (C member): PyConfig. (line 796) +* PyConfig.skip_source_first_line (C member): PyConfig. (line 815) +* PyConfig.stdio_encoding (C member): PyConfig. (line 827) +* PyConfig.stdio_errors (C member): PyConfig. (line 829) +* PyConfig.tracemalloc (C member): PyConfig. (line 857) +* PyConfig.use_environment (C member): PyConfig. (line 887) +* PyConfig.use_hash_seed (C member): PyConfig. (line 407) +* PyConfig.user_site_directory (C member): PyConfig. (line 898) +* PyConfig.verbose (C member): PyConfig. (line 911) +* PyConfig.warn_default_encoding (C member): PyConfig. (line 233) +* PyConfig.warnoptions (C member): PyConfig. (line 928) +* PyConfig.write_bytecode (C member): PyConfig. (line 948) +* PyConfig.xoptions (C member): PyConfig. (line 961) +* PyContext (C type): Context Variables Objects. + (line 26) +* PyContext_CheckExact (C function): Context Variables Objects. + (line 55) +* PyContext_Copy (C function): Context Variables Objects. + (line 76) +* PyContext_CopyCurrent (C function): Context Variables Objects. + (line 80) +* PyContext_Enter (C function): Context Variables Objects. + (line 84) +* PyContext_Exit (C function): Context Variables Objects. + (line 89) +* PyContext_New (C function): Context Variables Objects. + (line 72) +* PyContext_Type (C var): Context Variables Objects. + (line 41) +* PyContextToken (C type): Context Variables Objects. + (line 36) +* PyContextToken_CheckExact (C function): Context Variables Objects. + (line 65) +* PyContextToken_Type (C var): Context Variables Objects. + (line 49) +* PyContextVar (C type): Context Variables Objects. + (line 31) +* PyContextVar_CheckExact (C function): Context Variables Objects. + (line 60) +* PyContextVar_Get (C function): Context Variables Objects. + (line 105) +* PyContextVar_New (C function): Context Variables Objects. + (line 97) +* PyContextVar_Reset (C function): Context Variables Objects. + (line 129) +* PyContextVar_Set (C function): Context Variables Objects. + (line 123) +* PyContextVar_Type (C var): Context Variables Objects. + (line 45) +* PyCoro_CheckExact (C function): Coroutine Objects<2>. + (line 19) +* PyCoro_New (C function): Coroutine Objects<2>. + (line 24) +* PyCoro_Type (C var): Coroutine Objects<2>. + (line 15) +* PyCoroObject (C type): Coroutine Objects<2>. + (line 11) +* PyDate_Check (C function): DateTime Objects<2>. + (line 75) +* PyDate_CheckExact (C function): DateTime Objects<2>. + (line 81) +* PyDate_FromDate (C function): DateTime Objects<2>. + (line 132) +* PyDate_FromTimestamp (C function): DateTime Objects<2>. + (line 305) +* PyDateTime_Check (C function): DateTime Objects<2>. + (line 86) +* PyDateTime_CheckExact (C function): DateTime Objects<2>. + (line 92) +* PyDateTime_Date (C type): DateTime Objects<2>. + (line 14) +* PyDateTime_DATE_GET_FOLD (C function): DateTime Objects<2>. + (line 228) +* PyDateTime_DATE_GET_HOUR (C function): DateTime Objects<2>. + (line 211) +* PyDateTime_DATE_GET_MICROSECOND (C function): DateTime Objects<2>. + (line 223) +* PyDateTime_DATE_GET_MINUTE (C function): DateTime Objects<2>. + (line 215) +* PyDateTime_DATE_GET_SECOND (C function): DateTime Objects<2>. + (line 219) +* PyDateTime_DATE_GET_TZINFO (C function): DateTime Objects<2>. + (line 234) +* PyDateTime_DateTime (C type): DateTime Objects<2>. + (line 19) +* PyDateTime_DateTimeType (C var): DateTime Objects<2>. + (line 40) +* PyDateTime_DateType (C var): DateTime Objects<2>. + (line 34) +* PyDateTime_Delta (C type): DateTime Objects<2>. + (line 29) +* PyDateTime_DELTA_GET_DAYS (C function): DateTime Objects<2>. + (line 278) +* PyDateTime_DELTA_GET_MICROSECONDS (C function): DateTime Objects<2>. + (line 290) +* PyDateTime_DELTA_GET_SECONDS (C function): DateTime Objects<2>. + (line 284) +* PyDateTime_DeltaType (C var): DateTime Objects<2>. + (line 52) +* PyDateTime_FromDateAndTime (C function): DateTime Objects<2>. + (line 137) +* PyDateTime_FromDateAndTimeAndFold (C function): DateTime Objects<2>. + (line 144) +* PyDateTime_FromTimestamp (C function): DateTime Objects<2>. + (line 299) +* PyDateTime_GET_DAY (C function): DateTime Objects<2>. + (line 203) +* PyDateTime_GET_MONTH (C function): DateTime Objects<2>. + (line 199) +* PyDateTime_GET_YEAR (C function): DateTime Objects<2>. + (line 195) +* PyDateTime_Time (C type): DateTime Objects<2>. + (line 24) +* PyDateTime_TIME_GET_FOLD (C function): DateTime Objects<2>. + (line 261) +* PyDateTime_TIME_GET_HOUR (C function): DateTime Objects<2>. + (line 245) +* PyDateTime_TIME_GET_MICROSECOND (C function): DateTime Objects<2>. + (line 257) +* PyDateTime_TIME_GET_MINUTE (C function): DateTime Objects<2>. + (line 249) +* PyDateTime_TIME_GET_SECOND (C function): DateTime Objects<2>. + (line 253) +* PyDateTime_TIME_GET_TZINFO (C function): DateTime Objects<2>. + (line 267) +* PyDateTime_TimeType (C var): DateTime Objects<2>. + (line 46) +* PyDateTime_TimeZone_UTC (C var): DateTime Objects<2>. + (line 66) +* PyDateTime_TZInfoType (C var): DateTime Objects<2>. + (line 58) +* PyDelta_Check (C function): DateTime Objects<2>. + (line 108) +* PyDelta_CheckExact (C function): DateTime Objects<2>. + (line 114) +* PyDelta_FromDSU (C function): DateTime Objects<2>. + (line 166) +* PyDescr_IsData (C function): Descriptor Objects. (line 37) +* PyDescr_NewClassMethod (C function): Descriptor Objects. (line 32) +* PyDescr_NewGetSet (C function): Descriptor Objects. (line 13) +* PyDescr_NewMember (C function): Descriptor Objects. (line 18) +* PyDescr_NewMethod (C function): Descriptor Objects. (line 23) +* PyDescr_NewWrapper (C function): Descriptor Objects. (line 28) +* PyDict_AddWatcher (C function): Dictionary Objects. (line 324) +* PyDict_Check (C function): Dictionary Objects. (line 16) +* PyDict_CheckExact (C function): Dictionary Objects. (line 21) +* PyDict_Clear (C function): Dictionary Objects. (line 38) +* PyDict_ClearWatcher (C function): Dictionary Objects. (line 333) +* PyDict_Contains (C function): Dictionary Objects. (line 42) +* PyDict_ContainsString (C function): Dictionary Objects. (line 48) +* PyDict_Copy (C function): Dictionary Objects. (line 56) +* PyDict_DelItem (C function): Dictionary Objects. (line 75) +* PyDict_DelItemString (C function): Dictionary Objects. (line 82) +* PyDict_GetItem (C function): Dictionary Objects. (line 104) +* PyDict_GetItemRef (C function): Dictionary Objects. (line 87) +* PyDict_GetItemString (C function): Dictionary Objects. (line 128) +* PyDict_GetItemStringRef (C function): Dictionary Objects. (line 141) +* PyDict_GetItemWithError (C function): Dictionary Objects. (line 120) +* PyDict_Items (C function): Dictionary Objects. (line 211) +* PyDict_Keys (C function): Dictionary Objects. (line 216) +* PyDict_Merge (C function): Dictionary Objects. (line 291) +* PyDict_MergeFromSeq2 (C function): Dictionary Objects. (line 309) +* PyDict_New (C function): Dictionary Objects. (line 26) +* PyDict_Next (C function): Dictionary Objects. (line 232) +* PyDict_Pop (C function): Dictionary Objects. (line 183) +* PyDict_PopString (C function): Dictionary Objects. (line 202) +* PyDict_SetDefault (C function): Dictionary Objects. (line 150) +* PyDict_SetDefaultRef (C function): Dictionary Objects. (line 162) +* PyDict_SetItem (C function): Dictionary Objects. (line 61) +* PyDict_SetItemString (C function): Dictionary Objects. (line 69) +* PyDict_Size (C function): Dictionary Objects. (line 226) +* PyDict_Type (C var): Dictionary Objects. (line 11) +* PyDict_Unwatch (C function): Dictionary Objects. (line 350) +* PyDict_Update (C function): Dictionary Objects. (line 301) +* PyDict_Values (C function): Dictionary Objects. (line 221) +* PyDict_Watch (C function): Dictionary Objects. (line 341) +* PyDict_WatchCallback (C type): Dictionary Objects. (line 369) +* PyDict_WatchEvent (C type): Dictionary Objects. (line 360) +* PyDictObject (C type): Dictionary Objects. (line 6) +* PyDictProxy_New (C function): Dictionary Objects. (line 30) +* PyDLL (class in ctypes): Loading shared libraries. + (line 70) +* PyDoc_STR (C macro): Useful macros. (line 174) +* PyDoc_STRVAR (C macro): Useful macros. (line 156) +* PyEllipsis_Type (C var): Ellipsis Object. (line 6) +* PyErr_BadArgument (C function): Raising exceptions. (line 46) +* PyErr_BadInternalCall (C function): Raising exceptions. (line 219) +* PyErr_CheckSignals (C function): Signal Handling<2>. (line 6) +* PyErr_Clear (C function): Exceptions<21>. (line 25) +* PyErr_Clear (C function) <1>: Exceptions<21>. (line 123) +* PyErr_Clear (C function) <2>: Printing and clearing. + (line 6) +* PyErr_DisplayException (C function): Printing and clearing. + (line 67) +* PyErr_ExceptionMatches (C function): Exceptions<21>. (line 123) +* PyErr_ExceptionMatches (C function) <1>: Querying the error indicator. + (line 22) +* PyErr_Fetch (C function): Finalization and De-allocation. + (line 33) +* PyErr_Fetch (C function) <1>: Querying the error indicator. + (line 74) +* PyErr_Format (C function): Raising exceptions. (line 25) +* PyErr_FormatUnraisable (C function): Printing and clearing. + (line 56) +* PyErr_FormatV (C function): Raising exceptions. (line 34) +* PyErr_GetExcInfo (C function): Querying the error indicator. + (line 178) +* PyErr_GetHandledException (C function): Querying the error indicator. + (line 149) +* PyErr_GetRaisedException (C function): Querying the error indicator. + (line 36) +* PyErr_GivenExceptionMatches (C function): Querying the error indicator. + (line 28) +* PyErr_NewException (C function): Exception Classes. (line 6) +* PyErr_NewExceptionWithDoc (C function): Exception Classes. (line 24) +* PyErr_NoMemory (C function): Raising exceptions. (line 52) +* PyErr_NormalizeException (C function): Querying the error indicator. + (line 125) +* PyErr_Occurred (C function): Exceptions<21>. (line 12) +* PyErr_Occurred (C function) <1>: Querying the error indicator. + (line 6) +* PyErr_Print (C function): Printing and clearing. + (line 30) +* PyErr_PrintEx (C function): Printing and clearing. + (line 10) +* PyErr_ResourceWarning (C function): Issuing warnings. (line 70) +* PyErr_Restore (C function): Finalization and De-allocation. + (line 33) +* PyErr_Restore (C function) <1>: Querying the error indicator. + (line 102) +* PyErr_SetExcFromWindowsErr (C function): Raising exceptions. + (line 117) +* PyErr_SetExcFromWindowsErrWithFilename (C function): Raising exceptions. + (line 163) +* PyErr_SetExcFromWindowsErrWithFilenameObject (C function): Raising exceptions. + (line 139) +* PyErr_SetExcFromWindowsErrWithFilenameObjects (C function): Raising exceptions. + (line 151) +* PyErr_SetExcInfo (C function): Querying the error indicator. + (line 197) +* PyErr_SetFromErrno (C function): Raising exceptions. (line 58) +* PyErr_SetFromErrnoWithFilename (C function): Raising exceptions. + (line 95) +* PyErr_SetFromErrnoWithFilenameObject (C function): Raising exceptions. + (line 74) +* PyErr_SetFromErrnoWithFilenameObjects (C function): Raising exceptions. + (line 84) +* PyErr_SetFromWindowsErr (C function): Raising exceptions. (line 102) +* PyErr_SetFromWindowsErrWithFilename (C function): Raising exceptions. + (line 126) +* PyErr_SetHandledException (C function): Querying the error indicator. + (line 165) +* PyErr_SetImportError (C function): Raising exceptions. (line 173) +* PyErr_SetImportErrorSubclass (C function): Raising exceptions. + (line 184) +* PyErr_SetInterrupt (C function): Signal Handling<2>. (line 33) +* PyErr_SetInterruptEx (C function): Signal Handling<2>. (line 42) +* PyErr_SetNone (C function): Raising exceptions. (line 42) +* PyErr_SetObject (C function): Raising exceptions. (line 20) +* PyErr_SetRaisedException (C function): Querying the error indicator. + (line 64) +* PyErr_SetString (C function): Exceptions<21>. (line 25) +* PyErr_SetString (C function) <1>: Raising exceptions. (line 10) +* PyErr_SyntaxLocation (C function): Raising exceptions. (line 213) +* PyErr_SyntaxLocationEx (C function): Raising exceptions. (line 204) +* PyErr_SyntaxLocationObject (C function): Raising exceptions. + (line 194) +* PyErr_WarnEx (C function): Issuing warnings. (line 19) +* PyErr_WarnExplicit (C function): Issuing warnings. (line 54) +* PyErr_WarnExplicitObject (C function): Issuing warnings. (line 42) +* PyErr_WarnFormat (C function): Issuing warnings. (line 62) +* PyErr_WriteUnraisable (C function): Printing and clearing. + (line 34) +* PyEval_AcquireThread (C function): Low-level API. (line 223) +* PyEval_AcquireThread(): High-level API. (line 31) +* PyEval_EvalCode (C function): The Very High Level Layer. + (line 264) +* PyEval_EvalCodeEx (C function): The Very High Level Layer. + (line 271) +* PyEval_EvalFrame (C function): The Very High Level Layer. + (line 284) +* PyEval_EvalFrameEx (C function): The Very High Level Layer. + (line 290) +* PyEval_GetBuiltins (C function): Reflection. (line 6) +* PyEval_GetFrame (C function): Reflection. (line 60) +* PyEval_GetFrameBuiltins (C function): Reflection. (line 67) +* PyEval_GetFrameGlobals (C function): Reflection. (line 89) +* PyEval_GetFrameLocals (C function): Reflection. (line 75) +* PyEval_GetFuncDesc (C function): Reflection. (line 103) +* PyEval_GetFuncName (C function): Reflection. (line 98) +* PyEval_GetGlobals (C function): Reflection. (line 50) +* PyEval_GetLocals (C function): Reflection. (line 17) +* PyEval_InitThreads (C function): High-level API. (line 30) +* PyEval_InitThreads(): Initializing and finalizing the interpreter. + (line 7) +* PyEval_MergeCompilerFlags (C function): The Very High Level Layer. + (line 305) +* PyEval_ReleaseThread (C function): Low-level API. (line 244) +* PyEval_ReleaseThread(): High-level API. (line 31) +* PyEval_RestoreThread (C function): Releasing the GIL from extension code. + (line 33) +* PyEval_RestoreThread (C function) <1>: High-level API. (line 56) +* PyEval_RestoreThread(): High-level API. (line 31) +* PyEval_SaveThread (C function): Releasing the GIL from extension code. + (line 33) +* PyEval_SaveThread (C function) <1>: High-level API. (line 49) +* PyEval_SaveThread(): High-level API. (line 31) +* PyEval_SetProfile (C function): Profiling and Tracing. + (line 117) +* 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 23) +* PyExc_AssertionError (C var): Exception types. (line 27) +* PyExc_AttributeError (C var): Exception types. (line 31) +* PyExc_BaseException (C var): Exception types. (line 10) +* PyExc_BaseExceptionGroup (C var): Exception types. (line 14) +* PyExc_BlockingIOError (C var): Exception types. (line 35) +* PyExc_BrokenPipeError (C var): Exception types. (line 40) +* PyExc_BufferError (C var): Exception types. (line 45) +* PyExc_BytesWarning (C var): Warning types. (line 13) +* PyExc_ChildProcessError (C var): Exception types. (line 49) +* PyExc_ConnectionAbortedError (C var): Exception types. (line 54) +* PyExc_ConnectionError (C var): Exception types. (line 59) +* PyExc_ConnectionRefusedError (C var): Exception types. (line 64) +* PyExc_ConnectionResetError (C var): Exception types. (line 69) +* PyExc_DeprecationWarning (C var): Warning types. (line 17) +* PyExc_EncodingWarning (C var): Warning types. (line 21) +* PyExc_EnvironmentError (C var): OSError aliases. (line 15) +* PyExc_EOFError (C var): Exception types. (line 74) +* PyExc_Exception (C var): Exception types. (line 19) +* PyExc_FileExistsError (C var): Exception types. (line 77) +* PyExc_FileNotFoundError (C var): Exception types. (line 82) +* PyExc_FloatingPointError (C var): Exception types. (line 87) +* PyExc_FutureWarning (C var): Warning types. (line 26) +* PyExc_GeneratorExit (C var): Exception types. (line 91) +* PyExc_ImportError (C var): Exception types. (line 95) +* PyExc_ImportWarning (C var): Warning types. (line 30) +* PyExc_IndentationError (C var): Exception types. (line 99) +* PyExc_IndexError (C var): Exception types. (line 103) +* PyExc_InterruptedError (C var): Exception types. (line 107) +* PyExc_IOError (C var): OSError aliases. (line 21) +* PyExc_IsADirectoryError (C var): Exception types. (line 112) +* PyExc_KeyboardInterrupt (C var): Exception types. (line 120) +* PyExc_KeyError (C var): Exception types. (line 117) +* PyExc_LookupError (C var): Exception types. (line 124) +* PyExc_MemoryError (C var): Exception types. (line 128) +* PyExc_ModuleNotFoundError (C var): Exception types. (line 132) +* PyExc_NameError (C var): Exception types. (line 137) +* PyExc_NotADirectoryError (C var): Exception types. (line 141) +* PyExc_NotImplementedError (C var): Exception types. (line 146) +* PyExc_OSError (C var): Exception types. (line 150) +* PyExc_OverflowError (C var): Exception types. (line 153) +* PyExc_PendingDeprecationWarning (C var): Warning types. (line 34) +* PyExc_PermissionError (C var): Exception types. (line 157) +* PyExc_ProcessLookupError (C var): Exception types. (line 162) +* PyExc_PythonFinalizationError (C var): Exception types. (line 167) +* PyExc_RecursionError (C var): Exception types. (line 170) +* PyExc_ReferenceError (C var): Exception types. (line 175) +* PyExc_ResourceWarning (C var): Warning types. (line 38) +* PyExc_RuntimeError (C var): Exception types. (line 179) +* PyExc_RuntimeWarning (C var): Warning types. (line 43) +* PyExc_StopAsyncIteration (C var): Exception types. (line 183) +* PyExc_StopIteration (C var): Exception types. (line 188) +* PyExc_SyntaxError (C var): Exception types. (line 192) +* PyExc_SyntaxWarning (C var): Warning types. (line 47) +* PyExc_SystemError (C var): Exception types. (line 196) +* PyExc_SystemExit (C var): Exception types. (line 200) +* PyExc_TabError (C var): Exception types. (line 204) +* PyExc_TimeoutError (C var): Exception types. (line 207) +* PyExc_TypeError (C var): Exception types. (line 212) +* PyExc_UnboundLocalError (C var): Exception types. (line 216) +* PyExc_UnicodeDecodeError (C var): Exception types. (line 220) +* PyExc_UnicodeEncodeError (C var): Exception types. (line 224) +* PyExc_UnicodeError (C var): Exception types. (line 228) +* PyExc_UnicodeTranslateError (C var): Exception types. (line 232) +* PyExc_UnicodeWarning (C var): Warning types. (line 51) +* PyExc_UserWarning (C var): Warning types. (line 55) +* PyExc_ValueError (C var): Exception types. (line 236) +* PyExc_Warning (C var): Warning types. (line 10) +* PyExc_WindowsError (C var): OSError aliases. (line 27) +* PyExc_ZeroDivisionError (C var): Exception types. (line 240) +* PyException_GetArgs (C function): Exception Objects. (line 53) +* PyException_GetCause (C function): Exception Objects. (line 35) +* PyException_GetContext (C function): Exception Objects. (line 19) +* PyException_GetTraceback (C function): Exception Objects. (line 6) +* PyException_SetArgs (C function): Exception Objects. (line 57) +* PyException_SetCause (C function): Exception Objects. (line 43) +* PyException_SetContext (C function): Exception Objects. (line 28) +* PyException_SetTraceback (C function): Exception Objects. (line 14) +* PyExceptionClass_Check (C function): Exception Classes. (line 34) +* PyExceptionClass_Name (C function): Exception Classes. (line 39) +* PyFile_FromFd (C function): File Objects. (line 15) +* PyFile_GetLine (C function): File Objects. (line 41) +* PyFile_SetOpenCodeHook (C function): File Objects. (line 57) +* PyFile_WriteObject (C function): File Objects. (line 92) +* PyFile_WriteString (C function): File Objects. (line 102) +* PyFloat_AS_DOUBLE (C function): Floating-Point Objects. + (line 50) +* PyFloat_AsDouble (C function): Floating-Point Objects. + (line 38) +* PyFloat_Check (C function): Floating-Point Objects. + (line 16) +* PyFloat_CheckExact (C function): Floating-Point Objects. + (line 22) +* PyFloat_FromDouble (C function): Floating-Point Objects. + (line 33) +* PyFloat_FromString (C function): Floating-Point Objects. + (line 28) +* PyFloat_GetInfo (C function): Floating-Point Objects. + (line 55) +* PyFloat_GetMax (C function): Floating-Point Objects. + (line 61) +* PyFloat_GetMin (C function): Floating-Point Objects. + (line 65) +* PyFloat_Pack2 (C function): Pack functions. (line 22) +* PyFloat_Pack4 (C function): Pack functions. (line 26) +* PyFloat_Pack8 (C function): Pack functions. (line 30) +* PyFloat_Type (C var): Floating-Point Objects. + (line 11) +* PyFloat_Unpack2 (C function): Unpack functions. (line 20) +* PyFloat_Unpack4 (C function): Unpack functions. (line 24) +* PyFloat_Unpack8 (C function): Unpack functions. (line 28) +* PyFloatObject (C type): Floating-Point Objects. + (line 6) +* PyFrame_Check (C function): Frame Objects. (line 29) +* PyFrame_GetBack (C function): Frame Objects. (line 36) +* PyFrame_GetBuiltins (C function): Frame Objects. (line 45) +* PyFrame_GetCode (C function): Frame Objects. (line 54) +* PyFrame_GetGenerator (C function): Frame Objects. (line 65) +* PyFrame_GetGlobals (C function): Frame Objects. (line 76) +* PyFrame_GetLasti (C function): Frame Objects. (line 85) +* PyFrame_GetLineNumber (C function): Frame Objects. (line 133) +* PyFrame_GetLocals (C function): Frame Objects. (line 116) +* PyFrame_GetVar (C function): Frame Objects. (line 93) +* PyFrame_GetVarString (C function): Frame Objects. (line 109) +* PyFrame_Type (C var): Frame Objects. (line 21) +* PyFrameLocalsProxy_Check (C function): Frame Locals Proxies. + (line 20) +* PyFrameLocalsProxy_Type (C var): Frame Locals Proxies. + (line 16) +* PyFrameObject (C type): Frame Objects. (line 6) +* PyFrozenSet_Check (C function): Set Objects. (line 49) +* PyFrozenSet_CheckExact (C function): Set Objects. (line 73) +* PyFrozenSet_New (C function): Set Objects. (line 86) +* PyFrozenSet_Type (C var): Set Objects. (line 35) +* PyFunction_AddWatcher (C function): Function Objects<3>. + (line 139) +* PyFunction_Check (C function): Function Objects<3>. + (line 18) +* PyFunction_ClearWatcher (C function): Function Objects<3>. + (line 149) +* PyFunction_GET_ANNOTATIONS (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_CLOSURE (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_CODE (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_DEFAULTS (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_GLOBALS (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_KW_DEFAULTS (C function): Function Objects<3>. + (line 121) +* PyFunction_GET_MODULE (C function): Function Objects<3>. + (line 121) +* PyFunction_GetAnnotations (C function): Function Objects<3>. + (line 108) +* PyFunction_GetClosure (C function): Function Objects<3>. + (line 94) +* PyFunction_GetCode (C function): Function Objects<3>. + (line 46) +* PyFunction_GetDefaults (C function): Function Objects<3>. + (line 64) +* PyFunction_GetGlobals (C function): Function Objects<3>. + (line 50) +* PyFunction_GetKwDefaults (C function): Function Objects<3>. + (line 88) +* PyFunction_GetModule (C function): Function Objects<3>. + (line 55) +* PyFunction_New (C function): Function Objects<3>. + (line 24) +* PyFunction_NewWithQualName (C function): Function Objects<3>. + (line 36) +* PyFunction_SetAnnotations (C function): Function Objects<3>. + (line 113) +* PyFunction_SetClosure (C function): Function Objects<3>. + (line 100) +* PyFunction_SetDefaults (C function): Function Objects<3>. + (line 70) +* PyFunction_SetVectorcall (C function): Function Objects<3>. + (line 78) +* PyFunction_Type (C var): Function Objects<3>. + (line 12) +* PyFunction_WatchCallback (C type): Function Objects<3>. + (line 174) +* PyFunction_WatchEvent (C type): Function Objects<3>. + (line 158) +* PyFunctionObject (C type): Function Objects<3>. + (line 8) +* PYFUNCTYPE() (in module ctypes): Function prototypes. + (line 35) +* 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): Generator Objects. (line 19) +* PyGen_CheckExact (C function): Generator Objects. (line 24) +* PyGen_New (C function): Generator Objects. (line 29) +* PyGen_NewWithQualName (C function): Generator Objects. (line 34) +* PyGen_Type (C var): Generator Objects. (line 15) +* PyGenObject (C type): Generator Objects. (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) +* PyGILState_Check (C function): High-level API. (line 149) +* PyGILState_Ensure (C function): High-level API. (line 99) +* PyGILState_GetThisThreadState (C function): High-level API. + (line 140) +* PyGILState_Release (C function): High-level API. (line 130) +* PyHASH_BITS (C macro): PyHash API. (line 27) +* PyHash_FuncDef (C type): PyHash API. (line 51) +* PyHash_FuncDef.hash (C member): PyHash API. (line 55) +* PyHash_FuncDef.hash_bits (C member): PyHash API. (line 64) +* PyHash_FuncDef.name (C member): PyHash API. (line 60) +* PyHash_FuncDef.seed_bits (C member): PyHash API. (line 68) +* PyHash_GetFuncDef (C function): PyHash API. (line 74) +* PyHASH_IMAG (C macro): PyHash API. (line 45) +* PyHASH_INF (C macro): PyHash API. (line 39) +* PyHASH_MODULUS (C macro): PyHash API. (line 21) +* PyHASH_MULTIPLIER (C macro): PyHash API. (line 33) +* PyImport_AddModule (C function): Importing Modules<2>. + (line 122) +* PyImport_AddModuleObject (C function): Importing Modules<2>. + (line 113) +* PyImport_AddModuleRef (C function): Importing Modules<2>. + (line 90) +* PyImport_AppendInittab (C function): Importing Modules<2>. + (line 297) +* PyImport_ExecCodeModule (C function): Importing Modules<2>. + (line 128) +* PyImport_ExecCodeModuleEx (C function): Importing Modules<2>. + (line 168) +* PyImport_ExecCodeModuleObject (C function): Importing Modules<2>. + (line 177) +* PyImport_ExecCodeModuleWithPathnames (C function): Importing Modules<2>. + (line 191) +* PyImport_ExtendInittab (C function): Importing Modules<2>. + (line 324) +* PyImport_FrozenModules (C var): Importing Modules<2>. + (line 289) +* PyImport_GetImporter (C function): Importing Modules<2>. + (line 239) +* PyImport_GetMagicNumber (C function): Importing Modules<2>. + (line 207) +* PyImport_GetMagicTag (C function): Importing Modules<2>. + (line 215) +* PyImport_GetModule (C function): Importing Modules<2>. + (line 229) +* PyImport_GetModuleDict (C function): Importing Modules<2>. + (line 223) +* PyImport_Import (C function): Importing Modules<2>. + (line 72) +* PyImport_ImportFrozenModule (C function): Importing Modules<2>. + (line 266) +* PyImport_ImportFrozenModuleObject (C function): Importing Modules<2>. + (line 252) +* PyImport_ImportModule (C function): Importing Modules<2>. + (line 6) +* PyImport_ImportModuleEx (C function): Importing Modules<2>. + (line 28) +* PyImport_ImportModuleLevel (C function): Importing Modules<2>. + (line 62) +* PyImport_ImportModuleLevelObject (C function): Importing Modules<2>. + (line 45) +* PyImport_ImportModuleNoBlock (C function): Importing Modules<2>. + (line 14) +* PyImport_ReloadModule (C function): Importing Modules<2>. + (line 83) +* PyIndex_Check (C function): Number Protocol. (line 306) +* PyInit_modulename (C function): Building C and C++ Extensions. + (line 16) +* PyInstanceMethod_Check (C function): Instance Method Objects. + (line 15) +* PyInstanceMethod_Function (C function): Instance Method Objects. + (line 27) +* PyInstanceMethod_GET_FUNCTION (C function): Instance Method Objects. + (line 32) +* PyInstanceMethod_New (C function): Instance Method Objects. + (line 21) +* PyInstanceMethod_Type (C var): Instance Method Objects. + (line 10) +* PyInterpreterConfig (C type): Sub-interpreter support. + (line 24) +* PyInterpreterConfig_DEFAULT_GIL (C macro): Sub-interpreter support. + (line 93) +* PyInterpreterConfig_OWN_GIL (C macro): Sub-interpreter support. + (line 102) +* PyInterpreterConfig_SHARED_GIL (C macro): Sub-interpreter support. + (line 98) +* PyInterpreterConfig.allow_daemon_threads (C member): Sub-interpreter support. + (line 69) +* PyInterpreterConfig.allow_exec (C member): Sub-interpreter support. + (line 54) +* PyInterpreterConfig.allow_fork (C member): Sub-interpreter support. + (line 45) +* PyInterpreterConfig.allow_threads (C member): Sub-interpreter support. + (line 64) +* PyInterpreterConfig.check_multi_interp_extensions (C member): Sub-interpreter support. + (line 76) +* PyInterpreterConfig.gil (C member): Sub-interpreter support. + (line 88) +* PyInterpreterConfig.use_main_obmalloc (C member): Sub-interpreter support. + (line 35) +* PyInterpreterState (C type): High-level API. (line 9) +* PyInterpreterState_Clear (C function): Low-level API. (line 21) +* PyInterpreterState_Delete (C function): Low-level API. (line 30) +* PyInterpreterState_Get (C function): Low-level API. (line 118) +* PyInterpreterState_GetDict (C function): Low-level API. (line 140) +* PyInterpreterState_GetID (C function): Low-level API. (line 130) +* PyInterpreterState_Head (C function): Advanced Debugger Support. + (line 9) +* PyInterpreterState_Main (C function): Advanced Debugger Support. + (line 15) +* PyInterpreterState_New (C function): Low-level API. (line 12) +* PyInterpreterState_Next (C function): Advanced Debugger Support. + (line 20) +* PyInterpreterState_ThreadHead (C function): Advanced Debugger Support. + (line 26) +* PyIter_Check (C function): Iterator Protocol. (line 8) +* PyIter_Next (C function): Iterator Protocol. (line 21) +* PyIter_Send (C function): Iterator Protocol. (line 62) +* PYLAUNCHER_ALLOW_INSTALL: Windows<12>. (line 24) +* PYLAUNCHER_ALLOW_INSTALL <1>: Windows<26>. (line 15) +* PYLAUNCHER_ALLOW_INSTALL <2>: Install on demand. (line 6) +* PYLAUNCHER_ALWAYS_INSTALL: Install on demand. (line 12) +* PYLAUNCHER_DEBUG: Diagnostics. (line 6) +* PYLAUNCHER_DRYRUN: Dry Run. (line 6) +* PYLAUNCHER_DRYRUN <1>: Install on demand. (line 14) +* PYLAUNCHER_NO_SEARCH_PATH: Shebang Lines. (line 65) +* PyList_Append (C function): List Objects. (line 105) +* PyList_AsTuple (C function): List Objects. (line 160) +* PyList_Check (C function): List Objects. (line 16) +* PyList_CheckExact (C function): List Objects. (line 21) +* PyList_Clear (C function): List Objects. (line 139) +* PyList_Extend (C function): List Objects. (line 128) +* PyList_GET_ITEM (C function): List Objects. (line 67) +* PyList_GET_SIZE (C function): List Objects. (line 46) +* PyList_GetItem (C function): Reference Count Details. + (line 117) +* PyList_GetItem (C function) <1>: List Objects. (line 61) +* PyList_GetItemRef (C function): List Objects. (line 50) +* PyList_GetSlice (C function): List Objects. (line 111) +* PyList_Insert (C function): List Objects. (line 98) +* PyList_New (C function): List Objects. (line 26) +* PyList_Reverse (C function): List Objects. (line 155) +* PyList_SET_ITEM (C function): List Objects. (line 83) +* PyList_SetItem (C function): Reference Count Details. + (line 26) +* PyList_SetItem (C function) <1>: List Objects. (line 72) +* PyList_SetSlice (C function): List Objects. (line 119) +* PyList_Size (C function): List Objects. (line 40) +* PyList_Sort (C function): List Objects. (line 150) +* PyList_Type (C var): List Objects. (line 11) +* PyListObject (C type): List Objects. (line 6) +* PyLong_AS_LONG (C function): Integer Objects. (line 160) +* PyLong_AsDouble (C function): Integer Objects. (line 325) +* PyLong_AsInt (C function): Integer Objects. (line 169) +* PyLong_AsLong (C function): Integer Objects. (line 141) +* PyLong_AsLongAndOverflow (C function): Integer Objects. (line 176) +* PyLong_AsLongLong (C function): Integer Objects. (line 196) +* PyLong_AsLongLongAndOverflow (C function): Integer Objects. + (line 215) +* PyLong_AsNativeBytes (C function): Integer Objects. (line 346) +* PyLong_AsSize_t (C function): Integer Objects. (line 262) +* PyLong_AsSsize_t (C function): Integer Objects. (line 237) +* PyLong_AsUnsignedLong (C function): Integer Objects. (line 250) +* PyLong_AsUnsignedLongLong (C function): Integer Objects. (line 274) +* PyLong_AsUnsignedLongLongMask (C function): Integer Objects. + (line 307) +* PyLong_AsUnsignedLongMask (C function): Integer Objects. (line 290) +* PyLong_AsVoidPtr (C function): Integer Objects. (line 336) +* PyLong_Check (C function): Integer Objects. (line 22) +* PyLong_CheckExact (C function): Integer Objects. (line 27) +* PyLong_FromDouble (C function): Integer Objects. (line 69) +* PyLong_FromLong (C function): Integer Objects. (line 32) +* PyLong_FromLongLong (C function): Integer Objects. (line 58) +* PyLong_FromNativeBytes (C function): Integer Objects. (line 112) +* PyLong_FromSize_t (C function): Integer Objects. (line 53) +* PyLong_FromSsize_t (C function): Integer Objects. (line 48) +* PyLong_FromString (C function): Integer Objects. (line 74) +* PyLong_FromUnicodeObject (C function): Integer Objects. (line 99) +* PyLong_FromUnsignedLong (C function): Integer Objects. (line 42) +* PyLong_FromUnsignedLongLong (C function): Integer Objects. (line 63) +* PyLong_FromUnsignedNativeBytes (C function): Integer Objects. + (line 128) +* PyLong_FromVoidPtr (C function): Integer Objects. (line 106) +* PyLong_GetInfo (C function): Integer Objects. (line 499) +* PyLong_Type (C var): Integer Objects. (line 17) +* PyLongObject (C type): Integer Objects. (line 13) +* 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 89) +* PyMapping_HasKeyString (C function): Mapping Protocol. (line 100) +* PyMapping_HasKeyStringWithError (C function): Mapping Protocol. + (line 80) +* PyMapping_HasKeyWithError (C function): Mapping Protocol. (line 71) +* PyMapping_Items (C function): Mapping Protocol. (line 129) +* PyMapping_Keys (C function): Mapping Protocol. (line 113) +* 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 121) +* PyMappingMethods (C type): Mapping Object Structures. + (line 6) +* PyMappingMethods.mp_ass_subscript (C member): Mapping Object Structures. + (line 27) +* PyMappingMethods.mp_length (C member): Mapping Object Structures. + (line 11) +* PyMappingMethods.mp_subscript (C member): Mapping Object Structures. + (line 18) +* PyMarshal_ReadLastObjectFromFile (C function): Data marshalling support. + (line 74) +* PyMarshal_ReadLongFromFile (C function): Data marshalling support. + (line 47) +* PyMarshal_ReadObjectFromFile (C function): Data marshalling support. + (line 65) +* PyMarshal_ReadObjectFromString (C function): Data marshalling support. + (line 90) +* PyMarshal_ReadShortFromFile (C function): Data marshalling support. + (line 56) +* PyMarshal_WriteLongToFile (C function): Data marshalling support. + (line 20) +* PyMarshal_WriteObjectToFile (C function): Data marshalling support. + (line 30) +* PyMarshal_WriteObjectToString (C function): Data marshalling support. + (line 39) +* PyMem_Calloc (C function): Memory Interface. (line 28) +* PyMem_Del (C function): Memory Interface. (line 84) +* PYMEM_DOMAIN_MEM (C macro): Customize Memory Allocators. + (line 52) +* PYMEM_DOMAIN_OBJ (C macro): Customize Memory Allocators. + (line 64) +* PYMEM_DOMAIN_RAW (C macro): Customize Memory Allocators. + (line 40) +* PyMem_Free (C function): Memory Interface. (line 56) +* PyMem_GetAllocator (C function): Customize Memory Allocators. + (line 76) +* PyMem_Malloc (C function): Memory Interface. (line 19) +* PyMem_New (C macro): Memory Interface. (line 68) +* PyMem_RawCalloc (C function): Raw Memory Interface. + (line 24) +* PyMem_RawFree (C function): Raw Memory Interface. + (line 52) +* PyMem_RawMalloc (C function): Raw Memory Interface. + (line 15) +* PyMem_RawRealloc (C function): Raw Memory Interface. + (line 36) +* PyMem_Realloc (C function): Memory Interface. (line 40) +* PyMem_Resize (C macro): Memory Interface. (line 74) +* PyMem_SetAllocator (C function): Customize Memory Allocators. + (line 81) +* PyMem_SetupDebugHooks (C function): Customize Memory Allocators. + (line 124) +* PyMemAllocatorDomain (C type): Customize Memory Allocators. + (line 36) +* PyMemAllocatorEx (C type): Customize Memory Allocators. + (line 8) +* PyMember_GetOne (C function): Accessing attributes of extension types. + (line 71) +* PyMember_SetOne (C function): Accessing attributes of extension types. + (line 80) +* 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) +* PyMemoryView_Check (C function): MemoryView objects. (line 54) +* PyMemoryView_FromBuffer (C function): MemoryView objects. (line 35) +* PyMemoryView_FromMemory (C function): MemoryView objects. (line 26) +* PyMemoryView_FromObject (C function): MemoryView objects. (line 10) +* PyMemoryView_GET_BASE (C function): MemoryView objects. (line 68) +* PyMemoryView_GET_BUFFER (C function): MemoryView objects. (line 60) +* PyMemoryView_GetContiguous (C function): MemoryView objects. + (line 42) +* PyMethod_Check (C function): Method Objects<2>. (line 16) +* PyMethod_Function (C function): Method Objects<2>. (line 29) +* PyMethod_GET_FUNCTION (C function): Method Objects<2>. (line 33) +* PyMethod_GET_SELF (C function): Method Objects<2>. (line 42) +* PyMethod_New (C function): Method Objects<2>. (line 22) +* PyMethod_Self (C function): Method Objects<2>. (line 38) +* PyMethod_Type (C var): Method Objects<2>. (line 10) +* PyMethodDef (C type): Implementing functions and methods. + (line 63) +* PyMethodDef.ml_doc (C member): Implementing functions and methods. + (line 80) +* PyMethodDef.ml_flags (C member): Implementing functions and methods. + (line 76) +* PyMethodDef.ml_meth (C member): Implementing functions and methods. + (line 72) +* PyMethodDef.ml_name (C member): Implementing functions and methods. + (line 68) +* PyMODINIT_FUNC (C macro): Useful macros. (line 11) +* PyModule_Add (C function): Support functions. (line 63) +* PyModule_AddFunctions (C function): Low-level module creation functions. + (line 53) +* PyModule_AddIntConstant (C function): Support functions. (line 113) +* PyModule_AddIntMacro (C macro): Support functions. (line 136) +* PyModule_AddObject (C function): Support functions. (line 79) +* PyModule_AddObjectRef (C function): Support functions. (line 11) +* PyModule_AddStringConstant (C function): Support functions. + (line 124) +* PyModule_AddStringMacro (C macro): Support functions. (line 144) +* PyModule_AddType (C function): Support functions. (line 148) +* PyModule_Check (C function): Module Objects. (line 13) +* PyModule_CheckExact (C function): Module Objects. (line 18) +* PyModule_Create (C function): Single-phase initialization. + (line 10) +* PyModule_Create2 (C function): Single-phase initialization. + (line 16) +* PyModule_ExecDef (C function): Low-level module creation functions. + (line 37) +* PyModule_FromDefAndSpec (C function): Low-level module creation functions. + (line 11) +* PyModule_FromDefAndSpec2 (C function): Low-level module creation functions. + (line 20) +* PyModule_GetDef (C function): Module Objects. (line 83) +* PyModule_GetDict (C function): Module Objects. (line 46) +* PyModule_GetFilename (C function): Module Objects. (line 102) +* PyModule_GetFilenameObject (C function): Module Objects. (line 89) +* PyModule_GetName (C function): Module Objects. (line 72) +* PyModule_GetNameObject (C function): Module Objects. (line 61) +* PyModule_GetState (C function): Module Objects. (line 77) +* PyModule_New (C function): Module Objects. (line 41) +* PyModule_NewObject (C function): Module Objects. (line 23) +* PyModule_SetDocString (C function): Low-level module creation functions. + (line 44) +* PyModule_Type (C var): Module Objects. (line 6) +* PyModuleDef (C type): Initializing C modules. + (line 17) +* PyModuleDef_Init (C function): Multi-phase initialization. + (line 47) +* PyModuleDef_Slot (C type): Multi-phase initialization. + (line 61) +* PyModuleDef_Slot.slot (C member): Multi-phase initialization. + (line 63) +* PyModuleDef_Slot.value (C member): Multi-phase initialization. + (line 67) +* PyModuleDef.m_base (C member): Initializing C modules. + (line 23) +* PyModuleDef.m_clear (C member): Initializing C modules. + (line 91) +* PyModuleDef.m_doc (C member): Initializing C modules. + (line 31) +* PyModuleDef.m_free (C member): Initializing C modules. + (line 113) +* PyModuleDef.m_methods (C member): Initializing C modules. + (line 58) +* PyModuleDef.m_name (C member): Initializing C modules. + (line 27) +* PyModuleDef.m_size (C member): Initializing C modules. + (line 36) +* PyModuleDef.m_slots (C member): Initializing C modules. + (line 64) +* PyModuleDef.m_slots.m_reload (C member): Initializing C modules. + (line 73) +* PyModuleDef.m_traverse (C member): Initializing C modules. + (line 75) +* PyMonitoring_EnterScope (C function): Managing the Monitoring State. + (line 9) +* PyMonitoring_ExitScope (C function): Managing the Monitoring State. + (line 95) +* PyMonitoring_FireBranchEvent (C function): Generating Execution Events. + (line 70) +* PyMonitoring_FireCallEvent (C function): Generating Execution Events. + (line 53) +* PyMonitoring_FireCRaiseEvent (C function): Generating Execution Events. + (line 93) +* PyMonitoring_FireCReturnEvent (C function): Generating Execution Events. + (line 76) +* PyMonitoring_FireExceptionHandledEvent (C function): Generating Execution Events. + (line 105) +* 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 81) +* PyMonitoring_FirePyUnwindEvent (C function): Generating Execution Events. + (line 111) +* PyMonitoring_FirePyYieldEvent (C function): Generating Execution Events. + (line 48) +* PyMonitoring_FireRaiseEvent (C function): Generating Execution Events. + (line 87) +* PyMonitoring_FireReraiseEvent (C function): Generating Execution Events. + (line 99) +* PyMonitoring_FireStopIterationEvent (C function): Generating Execution Events. + (line 117) +* PyMonitoringState (C type): Generating Execution Events. + (line 22) +* PyMutex (C type): Synchronization Primitives<2>. + (line 8) +* PyMutex_Lock (C function): Synchronization Primitives<2>. + (line 25) +* PyMutex_Unlock (C function): Synchronization Primitives<2>. + (line 34) +* PyNumber_Absolute (C function): Number Protocol. (line 98) +* PyNumber_Add (C function): Number Protocol. (line 13) +* PyNumber_And (C function): Number Protocol. (line 124) +* PyNumber_AsSsize_t (C function): Number Protocol. (line 291) +* PyNumber_Check (C function): Number Protocol. (line 6) +* PyNumber_Divmod (C function): Number Protocol. (line 68) +* PyNumber_Float (C function): Number Protocol. (line 264) +* PyNumber_FloorDivide (C function): Number Protocol. (line 43) +* PyNumber_Index (C function): Number Protocol. (line 272) +* PyNumber_InPlaceAdd (C function): Number Protocol. (line 145) +* PyNumber_InPlaceAnd (C function): Number Protocol. (line 232) +* PyNumber_InPlaceFloorDivide (C function): Number Protocol. (line 176) +* PyNumber_InPlaceLshift (C function): Number Protocol. (line 216) +* PyNumber_InPlaceMatrixMultiply (C function): Number Protocol. + (line 166) +* PyNumber_InPlaceMultiply (C function): Number Protocol. (line 159) +* PyNumber_InPlaceOr (C function): Number Protocol. (line 248) +* PyNumber_InPlacePower (C function): Number Protocol. (line 203) +* PyNumber_InPlaceRemainder (C function): Number Protocol. (line 196) +* PyNumber_InPlaceRshift (C function): Number Protocol. (line 224) +* PyNumber_InPlaceSubtract (C function): Number Protocol. (line 152) +* PyNumber_InPlaceTrueDivide (C function): Number Protocol. (line 184) +* PyNumber_InPlaceXor (C function): Number Protocol. (line 240) +* PyNumber_Invert (C function): Number Protocol. (line 105) +* PyNumber_Long (C function): Number Protocol. (line 256) +* PyNumber_Lshift (C function): Number Protocol. (line 110) +* PyNumber_MatrixMultiply (C function): Number Protocol. (line 34) +* PyNumber_Multiply (C function): Number Protocol. (line 27) +* PyNumber_Negative (C function): Number Protocol. (line 88) +* PyNumber_Or (C function): Number Protocol. (line 138) +* PyNumber_Positive (C function): Number Protocol. (line 93) +* PyNumber_Power (C function): Number Protocol. (line 77) +* PyNumber_Remainder (C function): Number Protocol. (line 61) +* PyNumber_Rshift (C function): Number Protocol. (line 117) +* PyNumber_Subtract (C function): Number Protocol. (line 20) +* PyNumber_ToBase (C function): Number Protocol. (line 281) +* PyNumber_TrueDivide (C function): Number Protocol. (line 50) +* PyNumber_Xor (C function): Number Protocol. (line 131) +* PyNumberMethods (C type): Number Object Structures. + (line 6) +* PyNumberMethods.nb_absolute (C member): Number Object Structures. + (line 93) +* PyNumberMethods.nb_add (C member): Number Object Structures. + (line 70) +* PyNumberMethods.nb_and (C member): Number Object Structures. + (line 107) +* PyNumberMethods.nb_bool (C member): Number Object Structures. + (line 96) +* PyNumberMethods.nb_divmod (C member): Number Object Structures. + (line 81) +* PyNumberMethods.nb_float (C member): Number Object Structures. + (line 117) +* PyNumberMethods.nb_floor_divide (C member): Number Object Structures. + (line 150) +* PyNumberMethods.nb_index (C member): Number Object Structures. + (line 162) +* PyNumberMethods.nb_inplace_add (C member): Number Object Structures. + (line 120) +* PyNumberMethods.nb_inplace_and (C member): Number Object Structures. + (line 141) +* PyNumberMethods.nb_inplace_floor_divide (C member): Number Object Structures. + (line 156) +* PyNumberMethods.nb_inplace_lshift (C member): Number Object Structures. + (line 135) +* PyNumberMethods.nb_inplace_matrix_multiply (C member): Number Object Structures. + (line 168) +* PyNumberMethods.nb_inplace_multiply (C member): Number Object Structures. + (line 126) +* PyNumberMethods.nb_inplace_or (C member): Number Object Structures. + (line 147) +* PyNumberMethods.nb_inplace_power (C member): Number Object Structures. + (line 132) +* PyNumberMethods.nb_inplace_remainder (C member): Number Object Structures. + (line 129) +* PyNumberMethods.nb_inplace_rshift (C member): Number Object Structures. + (line 138) +* PyNumberMethods.nb_inplace_subtract (C member): Number Object Structures. + (line 123) +* PyNumberMethods.nb_inplace_true_divide (C member): Number Object Structures. + (line 159) +* PyNumberMethods.nb_inplace_xor (C member): Number Object Structures. + (line 144) +* PyNumberMethods.nb_int (C member): Number Object Structures. + (line 113) +* PyNumberMethods.nb_invert (C member): Number Object Structures. + (line 98) +* PyNumberMethods.nb_lshift (C member): Number Object Structures. + (line 101) +* PyNumberMethods.nb_matrix_multiply (C member): Number Object Structures. + (line 165) +* PyNumberMethods.nb_multiply (C member): Number Object Structures. + (line 75) +* PyNumberMethods.nb_negative (C member): Number Object Structures. + (line 87) +* PyNumberMethods.nb_or (C member): Number Object Structures. + (line 111) +* PyNumberMethods.nb_positive (C member): Number Object Structures. + (line 90) +* PyNumberMethods.nb_power (C member): Number Object Structures. + (line 84) +* PyNumberMethods.nb_remainder (C member): Number Object Structures. + (line 78) +* PyNumberMethods.nb_reserved (C member): Number Object Structures. + (line 115) +* PyNumberMethods.nb_rshift (C member): Number Object Structures. + (line 104) +* PyNumberMethods.nb_subtract (C member): Number Object Structures. + (line 72) +* PyNumberMethods.nb_true_divide (C member): Number Object Structures. + (line 153) +* PyNumberMethods.nb_xor (C member): Number Object Structures. + (line 109) +* PyObject (C type): Base object types and macros. + (line 14) +* PyObject_ASCII (C function): Object Protocol. (line 342) +* PyObject_AsFileDescriptor (C function): File Objects. (line 33) +* PyObject_Bytes (C function): Object Protocol. (line 365) +* PyObject_Call (C function): Object Calling API. (line 57) +* PyObject_CallFunction (C function): Object Calling API. (line 108) +* PyObject_CallFunctionObjArgs (C function): Object Calling API. + (line 149) +* PyObject_CallMethod (C function): Object Calling API. (line 127) +* PyObject_CallMethodNoArgs (C function): Object Calling API. + (line 174) +* PyObject_CallMethodObjArgs (C function): Object Calling API. + (line 162) +* PyObject_CallMethodOneArg (C function): Object Calling API. + (line 186) +* PyObject_CallNoArgs (C function): Object Calling API. (line 73) +* PyObject_CallObject (C function): Calling Python Functions from C. + (line 64) +* PyObject_CallObject (C function) <1>: Object Calling API. (line 96) +* PyObject_Calloc (C function): Object allocators. (line 30) +* PyObject_CallOneArg (C function): Object Calling API. (line 85) +* PyObject_CheckBuffer (C function): Buffer-related functions. + (line 6) +* PyObject_ClearManagedDict (C function): Object Protocol. (line 596) +* PyObject_ClearWeakRefs (C function): Weak Reference Objects<2>. + (line 92) +* PyObject_CopyData (C function): Buffer-related functions. + (line 80) +* PyObject_Del (C function): Allocating Objects on the Heap. + (line 57) +* PyObject_DelAttr (C function): Object Protocol. (line 241) +* PyObject_DelAttrString (C function): Object Protocol. (line 247) +* PyObject_DelItem (C function): Object Protocol. (line 499) +* PyObject_DelItemString (C function): Object Protocol. (line 504) +* PyObject_Dir (C function): Object Protocol. (line 510) +* PyObject_Format (C function): Object Protocol. (line 319) +* PyObject_Free (C function): Object allocators. (line 58) +* PyObject_GC_Del (C function): Supporting Cyclic Garbage Collection. + (line 133) +* PyObject_GC_IsFinalized (C function): Supporting Cyclic Garbage Collection. + (line 123) +* PyObject_GC_IsTracked (C function): Supporting Cyclic Garbage Collection. + (line 113) +* PyObject_GC_New (C macro): Supporting Cyclic Garbage Collection. + (line 56) +* PyObject_GC_NewVar (C macro): Supporting Cyclic Garbage Collection. + (line 61) +* PyObject_GC_Resize (C macro): Supporting Cyclic Garbage Collection. + (line 87) +* PyObject_GC_Track (C function): Supporting Cyclic Garbage Collection. + (line 97) +* PyObject_GC_UnTrack (C function): Supporting Cyclic Garbage Collection. + (line 138) +* PyObject_GenericGetAttr (C function): Object Protocol. (line 187) +* PyObject_GenericGetDict (C function): Object Protocol. (line 262) +* PyObject_GenericHash (C function): PyHash API. (line 94) +* PyObject_GenericSetAttr (C function): Object Protocol. (line 229) +* PyObject_GenericSetDict (C function): Object Protocol. (line 278) +* PyObject_GetAIter (C function): Object Protocol. (line 534) +* PyObject_GetArenaAllocator (C function): Customize pymalloc Arena Allocator. + (line 26) +* PyObject_GetAttr (C function): Object Protocol. (line 143) +* PyObject_GetAttrString (C function): Object Protocol. (line 153) +* PyObject_GetBuffer (C function): Buffer-related functions. + (line 12) +* PyObject_GetItem (C function): Object Protocol. (line 485) +* PyObject_GetItemData (C function): Object Protocol. (line 575) +* PyObject_GetIter (C function): Object Protocol. (line 520) +* PyObject_GetOptionalAttr (C function): Object Protocol. (line 163) +* PyObject_GetOptionalAttrString (C function): Object Protocol. + (line 178) +* PyObject_GetTypeData (C function): Object Protocol. (line 545) +* PyObject_HasAttr (C function): Object Protocol. (line 115) +* PyObject_HasAttrString (C function): Object Protocol. (line 128) +* PyObject_HasAttrStringWithError (C function): Object Protocol. + (line 106) +* PyObject_HasAttrWithError (C function): Object Protocol. (line 97) +* PyObject_Hash (C function): Object Protocol. (line 417) +* PyObject_HashNotImplemented (C function): Object Protocol. (line 427) +* PyObject_HEAD (C macro): Base object types and macros. + (line 35) +* PyObject_HEAD_INIT (C macro): Base object types and macros. + (line 127) +* PyObject_Init (C function): Allocating Objects on the Heap. + (line 13) +* PyObject_InitVar (C function): Allocating Objects on the Heap. + (line 20) +* PyObject_IS_GC (C function): Supporting Cyclic Garbage Collection. + (line 105) +* PyObject_IsInstance (C function): Object Protocol. (line 396) +* PyObject_IsSubclass (C function): Object Protocol. (line 375) +* PyObject_IsTrue (C function): Object Protocol. (line 435) +* PyObject_Length (C function): Object Protocol. (line 465) +* PyObject_LengthHint (C function): Object Protocol. (line 474) +* PyObject_Malloc (C function): Object allocators. (line 21) +* PyObject_New (C macro): Allocating Objects on the Heap. + (line 26) +* PyObject_NewVar (C macro): Allocating Objects on the Heap. + (line 40) +* PyObject_Not (C function): Object Protocol. (line 441) +* PyObject_Print (C function): Object Protocol. (line 89) +* PyObject_Realloc (C function): Object allocators. (line 42) +* PyObject_Repr (C function): Object Protocol. (line 329) +* PyObject_RichCompare (C function): Object Protocol. (line 296) +* PyObject_RichCompareBool (C function): Object Protocol. (line 308) +* PyObject_SelfIter (C function): Object Protocol. (line 528) +* PyObject_SetArenaAllocator (C function): Customize pymalloc Arena Allocator. + (line 31) +* PyObject_SetAttr (C function): Object Protocol. (line 199) +* PyObject_SetAttrString (C function): Object Protocol. (line 211) +* PyObject_SetItem (C function): Object Protocol. (line 492) +* PyObject_Size (C function): Object Protocol. (line 465) +* PyObject_Str (C function): Object Protocol. (line 353) +* PyObject_Type (C function): Object Protocol. (line 447) +* PyObject_TypeCheck (C function): Object Protocol. (line 460) +* PyObject_VAR_HEAD (C macro): Base object types and macros. + (line 45) +* PyObject_Vectorcall (C function): Object Calling API. (line 198) +* 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 586) +* PyObject.ob_refcnt (C member): PyObject Slots. (line 13) +* PyObject.ob_type (C member): PyObject Slots. (line 26) +* PyObjectArenaAllocator (C type): Customize pymalloc Arena Allocator. + (line 8) +* PyOS_AfterFork (C function): Operating System Utilities. + (line 79) +* PyOS_AfterFork_Child (C function): Operating System Utilities. + (line 56) +* PyOS_AfterFork_Parent (C function): Operating System Utilities. + (line 42) +* PyOS_BeforeFork (C function): Operating System Utilities. + (line 29) +* PyOS_CheckStack (C function): Operating System Utilities. + (line 89) +* PyOS_double_to_string (C function): String conversion and formatting. + (line 118) +* PyOS_FSPath (C function): Operating System Utilities. + (line 6) +* PyOS_getsig (C function): Operating System Utilities. + (line 103) +* PyOS_InputHook (C var): The Very High Level Layer. + (line 136) +* PyOS_ReadlineFunctionPointer (C var): The Very High Level Layer. + (line 148) +* PyOS_setsig (C function): Operating System Utilities. + (line 108) +* PyOS_sighandler_t (C type): Operating System Utilities. + (line 100) +* PyOS_snprintf (C function): String conversion and formatting. + (line 8) +* PyOS_stricmp (C function): String conversion and formatting. + (line 152) +* PyOS_string_to_double (C function): String conversion and formatting. + (line 85) +* PyOS_strnicmp (C function): String conversion and formatting. + (line 157) +* PyOS_strtol (C function): String conversion and formatting. + (line 72) +* PyOS_strtoul (C function): String conversion and formatting. + (line 50) +* PyOS_vsnprintf (C function): String conversion and formatting. + (line 14) +* PyPreConfig (C type): PyPreConfig. (line 6) +* PyPreConfig_InitIsolatedConfig (C function): PyPreConfig. (line 18) +* PyPreConfig_InitPythonConfig (C function): PyPreConfig. (line 12) +* PyPreConfig.allocator (C member): PyPreConfig. (line 26) +* PyPreConfig.coerce_c_locale (C member): PyPreConfig. (line 82) +* PyPreConfig.coerce_c_locale_warn (C member): PyPreConfig. (line 93) +* PyPreConfig.configure_locale (C member): PyPreConfig. (line 71) +* PyPreConfig.dev_mode (C member): PyPreConfig. (line 99) +* PyPreConfig.isolated (C member): PyPreConfig. (line 106) +* PyPreConfig.legacy_windows_fs_encoding (C member): PyPreConfig. + (line 112) +* PyPreConfig.parse_argv (C member): PyPreConfig. (line 131) +* PyPreConfig.use_environment (C member): PyPreConfig. (line 140) +* PyPreConfig.utf8_mode (C member): PyPreConfig. (line 147) +* PyProperty_Type (C var): Descriptor Objects. (line 9) +* PyRefTracer (C type): Reference tracing. (line 8) +* PyRefTracer_CREATE (C var): Reference tracing. (line 21) +* PyRefTracer_DESTROY (C var): Reference tracing. (line 26) +* PyRefTracer_GetTracer (C function): Reference tracing. (line 49) +* PyRefTracer_SetTracer (C function): Reference tracing. (line 31) +* PyRun_AnyFile (C function): The Very High Level Layer. + (line 24) +* PyRun_AnyFileEx (C function): The Very High Level Layer. + (line 36) +* PyRun_AnyFileExFlags (C function): The Very High Level Layer. + (line 42) +* PyRun_AnyFileFlags (C function): The Very High Level Layer. + (line 30) +* PyRun_File (C function): The Very High Level Layer. + (line 191) +* PyRun_FileEx (C function): The Very High Level Layer. + (line 197) +* PyRun_FileExFlags (C function): The Very High Level Layer. + (line 211) +* PyRun_FileFlags (C function): The Very High Level Layer. + (line 204) +* PyRun_InteractiveLoop (C function): The Very High Level Layer. + (line 120) +* PyRun_InteractiveLoopFlags (C function): The Very High Level Layer. + (line 127) +* PyRun_InteractiveOne (C function): The Very High Level Layer. + (line 99) +* PyRun_InteractiveOneFlags (C function): The Very High Level Layer. + (line 106) +* PyRun_SimpleFile (C function): The Very High Level Layer. + (line 74) +* PyRun_SimpleFileEx (C function): The Very High Level Layer. + (line 80) +* PyRun_SimpleFileExFlags (C function): The Very High Level Layer. + (line 86) +* PyRun_SimpleString (C function): The Very High Level Layer. + (line 54) +* PyRun_SimpleStringFlags (C function): The Very High Level Layer. + (line 60) +* PyRun_String (C function): The Very High Level Layer. + (line 172) +* PyRun_StringFlags (C function): The Very High Level Layer. + (line 178) +* PySendResult (C type): Iterator Protocol. (line 55) +* PySeqIter_Check (C function): Iterator Objects. (line 18) +* PySeqIter_New (C function): Iterator Objects. (line 23) +* PySeqIter_Type (C var): Iterator Objects. (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 99) +* PySequence_Count (C function): Sequence Protocol. (line 92) +* PySequence_DelItem (C function): Sequence Protocol. (line 75) +* PySequence_DelSlice (C function): Sequence Protocol. (line 86) +* PySequence_Fast (C function): Sequence Protocol. (line 128) +* PySequence_Fast_GET_ITEM (C function): Sequence Protocol. (line 152) +* PySequence_Fast_GET_SIZE (C function): Sequence Protocol. (line 143) +* PySequence_Fast_ITEMS (C function): Sequence Protocol. (line 158) +* PySequence_GetItem (C function): Reference Count Details. + (line 117) +* PySequence_GetItem (C function) <1>: Sequence Protocol. (line 51) +* PySequence_GetSlice (C function): Sequence Protocol. (line 57) +* PySequence_Index (C function): Sequence Protocol. (line 105) +* PySequence_InPlaceConcat (C function): Sequence Protocol. (line 35) +* PySequence_InPlaceRepeat (C function): Sequence Protocol. (line 43) +* PySequence_ITEM (C function): Sequence Protocol. (line 169) +* PySequence_Length (C function): Sequence Protocol. (line 14) +* PySequence_List (C function): Sequence Protocol. (line 111) +* PySequence_Repeat (C function): Sequence Protocol. (line 28) +* PySequence_SetItem (C function): Sequence Protocol. (line 64) +* PySequence_SetSlice (C function): Sequence Protocol. (line 80) +* PySequence_Size (C function): Sequence Protocol. (line 14) +* PySequence_Tuple (C function): Sequence Protocol. (line 118) +* PySequenceMethods (C type): Sequence Object Structures. + (line 6) +* PySequenceMethods.sq_ass_item (C member): Sequence Object Structures. + (line 50) +* PySequenceMethods.sq_concat (C member): Sequence Object Structures. + (line 19) +* PySequenceMethods.sq_contains (C member): Sequence Object Structures. + (line 60) +* PySequenceMethods.sq_inplace_concat (C member): Sequence Object Structures. + (line 68) +* PySequenceMethods.sq_inplace_repeat (C member): Sequence Object Structures. + (line 79) +* PySequenceMethods.sq_item (C member): Sequence Object Structures. + (line 34) +* PySequenceMethods.sq_length (C member): Sequence Object Structures. + (line 11) +* PySequenceMethods.sq_repeat (C member): Sequence Object Structures. + (line 26) +* PySet_Add (C function): Set Objects. (line 119) +* PySet_Check (C function): Set Objects. (line 44) +* PySet_CheckExact (C function): Set Objects. (line 60) +* PySet_Clear (C function): Set Objects. (line 152) +* PySet_Contains (C function): Set Objects. (line 110) +* PySet_Discard (C function): Set Objects. (line 134) +* PySet_GET_SIZE (C function): Set Objects. (line 106) +* PySet_New (C function): Set Objects. (line 78) +* PySet_Pop (C function): Set Objects. (line 144) +* PySet_Size (C function): Set Objects. (line 98) +* PySet_Type (C var): Set Objects. (line 31) +* PySetObject (C type): Set Objects. (line 19) +* PySignal_SetWakeupFd (C function): Signal Handling<2>. (line 67) +* PySlice_AdjustIndices (C function): Slice Objects. (line 99) +* PySlice_Check (C function): Slice Objects. (line 11) +* PySlice_GetIndices (C function): Slice Objects. (line 28) +* PySlice_GetIndicesEx (C function): Slice Objects. (line 44) +* PySlice_New (C function): Slice Objects. (line 16) +* PySlice_Type (C var): Slice Objects. (line 6) +* PySlice_Unpack (C function): Slice Objects. (line 86) +* PyState_AddModule (C function): Module lookup. (line 25) +* PyState_FindModule (C function): Module lookup. (line 15) +* PyState_RemoveModule (C function): Module lookup. (line 49) +* PyStatus (C type): PyStatus. (line 6) +* PyStatus_Error (C function): PyStatus. (line 34) +* PyStatus_Exception (C function): PyStatus. (line 51) +* PyStatus_Exit (C function): PyStatus. (line 45) +* PyStatus_IsError (C function): PyStatus. (line 57) +* PyStatus_IsExit (C function): PyStatus. (line 61) +* PyStatus_NoMemory (C function): PyStatus. (line 41) +* PyStatus_Ok (C function): PyStatus. (line 30) +* PyStatus.err_msg (C member): PyStatus. (line 20) +* PyStatus.exitcode (C member): PyStatus. (line 16) +* PyStatus.func (C member): PyStatus. (line 24) +* PyStructSequence_Desc (C type): Struct Sequence Objects. + (line 33) +* PyStructSequence_Desc.doc (C member): Struct Sequence Objects. + (line 42) +* PyStructSequence_Desc.fields (C member): Struct Sequence Objects. + (line 46) +* PyStructSequence_Desc.n_in_sequence (C member): Struct Sequence Objects. + (line 51) +* PyStructSequence_Desc.name (C member): Struct Sequence Objects. + (line 37) +* PyStructSequence_Field (C type): Struct Sequence Objects. + (line 56) +* PyStructSequence_Field.doc (C member): Struct Sequence Objects. + (line 70) +* PyStructSequence_Field.name (C member): Struct Sequence Objects. + (line 64) +* PyStructSequence_GET_ITEM (C function): Struct Sequence Objects. + (line 97) +* PyStructSequence_GetItem (C function): Struct Sequence Objects. + (line 88) +* PyStructSequence_InitType (C function): Struct Sequence Objects. + (line 20) +* PyStructSequence_InitType2 (C function): Struct Sequence Objects. + (line 25) +* PyStructSequence_New (C function): Struct Sequence Objects. + (line 80) +* PyStructSequence_NewType (C function): Struct Sequence Objects. + (line 11) +* PyStructSequence_SET_ITEM (C function): Struct Sequence Objects. + (line 117) +* PyStructSequence_SetItem (C function): Struct Sequence Objects. + (line 105) +* PyStructSequence_UnnamedField (C var): Struct Sequence Objects. + (line 74) +* PySys_AddAuditHook (C function): System Functions. (line 116) +* PySys_Audit (C function): System Functions. (line 75) +* PySys_AuditTuple (C function): System Functions. (line 108) +* PySys_FormatStderr (C function): System Functions. (line 60) +* PySys_FormatStdout (C function): System Functions. (line 52) +* PySys_GetObject (C function): System Functions. (line 11) +* PySys_GetXOptions (C function): System Functions. (line 67) +* PySys_ResetWarnOptions (C function): System Functions. (line 22) +* PySys_SetArgv (C function): Process-wide parameters. + (line 268) +* PySys_SetArgvEx (C function): Process-wide parameters. + (line 216) +* PySys_SetObject (C function): System Functions. (line 16) +* PySys_WriteStderr (C function): System Functions. (line 47) +* PySys_WriteStdout (C function): System Functions. (line 30) +* Python 3000: Glossary. (line 1262) +* Python Editor: IDLE — Python editor and shell<2>. + (line 8) +* Python Enhancement Proposals; PEP 0007#documentation-strings: Documentation<24>. + (line 35) +* Python Enhancement Proposals; PEP 0249#threadsafety: Module constants. + (line 108) +* Python Enhancement Proposals; PEP 0453#recommendations-for-downstream-distributors: Bootstrapping pip By Default. + (line 39) +* Python Enhancement Proposals; PEP 0477#disabling-ensurepip-by-downstream-distributors: Bootstrapping pip By Default<2>. + (line 29) +* Python Enhancement Proposals; PEP 0564#annex-clocks-resolution-in-python: PEP 564 New Time Functions With Nanosecond Resolution. + (line 26) +* Python Enhancement Proposals; PEP 0626#out-of-process-debuggers-and-profilers: Code Objects<2>. + (line 104) +* Python Enhancement Proposals; PEP 0632#migration-advice: Summary – Release highlights. + (line 111) +* Python Enhancement Proposals; PEP 0683: Reference Counting. + (line 61) +* Python Enhancement Proposals; PEP 1: New Development Process. + (line 67) +* Python Enhancement Proposals; PEP 1 <1>: New Development Process. + (line 82) +* Python Enhancement Proposals; PEP 1 <2>: Glossary. (line 1228) +* Python Enhancement Proposals; PEP 100: Unicode<2>. (line 15) +* Python Enhancement Proposals; PEP 11: Support for mobile platforms. + (line 6) +* Python Enhancement Proposals; PEP 11 <1>: Support for mobile platforms. + (line 15) +* Python Enhancement Proposals; PEP 11 <2>: Build Changes. (line 6) +* Python Enhancement Proposals; PEP 11 <3>: Build Changes. (line 10) +* Python Enhancement Proposals; PEP 11 <4>: Build Changes. (line 14) +* Python Enhancement Proposals; PEP 11 <5>: Build Changes. (line 17) +* Python Enhancement Proposals; PEP 11 <6>: Build Changes<3>. + (line 6) +* Python Enhancement Proposals; PEP 11 <7>: PEP 538 Legacy C Locale Coercion. + (line 19) +* Python Enhancement Proposals; PEP 11 <8>: Unsupported Operating Systems. + (line 6) +* Python Enhancement Proposals; PEP 11 <9>: Library Changes. (line 15) +* Python Enhancement Proposals; PEP 11 <10>: Build<26>. (line 56) +* Python Enhancement Proposals; PEP 11 <11>: Build<26>. (line 107) +* Python Enhancement Proposals; PEP 11 <12>: Build<62>. (line 14) +* Python Enhancement Proposals; PEP 11 <13>: Build Requirements. + (line 51) +* Python Enhancement Proposals; PEP 11 <14>: Using Python on Windows. + (line 18) +* Python Enhancement Proposals; PEP 11 <15>: Other Platforms. + (line 8) +* Python Enhancement Proposals; PEP 11#tier-2: Summary – Release Highlights. + (line 139) +* Python Enhancement Proposals; PEP 11#tier-3: Summary – Release Highlights. + (line 134) +* Python Enhancement Proposals; PEP 11#tier-3 <1>: Summary – Release Highlights. + (line 137) +* Python Enhancement Proposals; PEP 11#tier-3 <2>: Build Changes<3>. + (line 6) +* Python Enhancement Proposals; PEP 201: New Development Process. + (line 86) +* Python Enhancement Proposals; PEP 205: PEP 205 Weak References. + (line 82) +* Python Enhancement Proposals; PEP 205 <1>: weakref — Weak references. + (line 353) +* Python Enhancement Proposals; PEP 207: PEP 207 Rich Comparisons. + (line 71) +* Python Enhancement Proposals; PEP 207 <1>: PEP 207 Rich Comparisons. + (line 77) +* Python Enhancement Proposals; PEP 208: PEP 208 New Coercion Model. + (line 30) +* Python Enhancement Proposals; PEP 217: PEP 217 Interactive Display Hook. + (line 27) +* Python Enhancement Proposals; PEP 218: PEP 218 Built-In Set Objects. + (line 50) +* Python Enhancement Proposals; PEP 218 <1>: Other Language Changes<17>. + (line 12) +* Python Enhancement Proposals; PEP 218 <2>: PEP 218 A Standard Set Datatype. + (line 81) +* Python Enhancement Proposals; PEP 227: PEP 227 Nested Scopes. + (line 96) +* Python Enhancement Proposals; PEP 227 <1>: PEP 227 Nested Scopes<2>. + (line 96) +* Python Enhancement Proposals; PEP 227 <2>: Module Contents<5>. + (line 14) +* Python Enhancement Proposals; PEP 229: PEP 229 New Build System. + (line 39) +* Python Enhancement Proposals; PEP 230: PEP 230 Warning Framework. + (line 73) +* Python Enhancement Proposals; PEP 232: PEP 232 Function Attributes. + (line 36) +* Python Enhancement Proposals; PEP 234: PEP 234 Iterators. (line 124) +* Python Enhancement Proposals; PEP 235: Introduction<12>. (line 51) +* Python Enhancement Proposals; PEP 236: PEP 227 Nested Scopes<2>. + (line 87) +* Python Enhancement Proposals; PEP 236 <1>: PEP 227 Nested Scopes<2>. + (line 88) +* Python Enhancement Proposals; PEP 236 <2>: PEP 236 __future__ Directives. + (line 29) +* Python Enhancement Proposals; PEP 236 <3>: Future statements. + (line 85) +* Python Enhancement Proposals; PEP 236 <4>: Module Contents<5>. + (line 103) +* Python Enhancement Proposals; PEP 237: Integers. (line 6) +* Python Enhancement Proposals; PEP 237 <1>: PEP 237 Unifying Long Integers and Integers. + (line 22) +* Python Enhancement Proposals; PEP 237 <2>: Other Language Changes<17>. + (line 18) +* Python Enhancement Proposals; PEP 237 <3>: PEP 237 Unifying Long Integers and Integers<2>. + (line 37) +* Python Enhancement Proposals; PEP 237 <4>: printf-style String Formatting. + (line 185) +* Python Enhancement Proposals; PEP 237 <5>: printf-style Bytes Formatting. + (line 189) +* Python Enhancement Proposals; PEP 238: Integers. (line 10) +* Python Enhancement Proposals; PEP 238 <1>: PEP 238 Changing the Division Operator. + (line 21) +* Python Enhancement Proposals; PEP 238 <2>: PEP 238 Changing the Division Operator. + (line 27) +* Python Enhancement Proposals; PEP 238 <3>: PEP 238 Changing the Division Operator. + (line 68) +* Python Enhancement Proposals; PEP 238 <4>: Module Contents<5>. + (line 22) +* Python Enhancement Proposals; PEP 238 <5>: Glossary. (line 553) +* Python Enhancement Proposals; PEP 241: PEP 241 Metadata in Python Packages. + (line 16) +* Python Enhancement Proposals; PEP 241 <1>: PEP 241 Metadata in Python Packages. + (line 29) +* Python Enhancement Proposals; PEP 241 <2>: PEP 241 Metadata in Python Packages. + (line 36) +* Python Enhancement Proposals; PEP 243: PEP 241 Metadata in Python Packages. + (line 40) +* Python Enhancement Proposals; PEP 246: Documentation<23>. (line 48) +* Python Enhancement Proposals; PEP 246 <1>: PrepareProtocol objects. + (line 8) +* Python Enhancement Proposals; PEP 247: hmac<3>. (line 20) +* Python Enhancement Proposals; PEP 249: sqlite3<2>. (line 11) +* Python Enhancement Proposals; PEP 249 <1>: The sqlite3 package. + (line 18) +* Python Enhancement Proposals; PEP 249 <2>: The sqlite3 package. + (line 110) +* Python Enhancement Proposals; PEP 249 <3>: Library<27>. (line 121) +* Python Enhancement Proposals; PEP 249 <4>: Library<30>. (line 296) +* Python Enhancement Proposals; PEP 249 <5>: sqlite3 — DB-API 2 0 interface for SQLite databases. + (line 16) +* Python Enhancement Proposals; PEP 249 <6>: sqlite3 — DB-API 2 0 interface for SQLite databases. + (line 43) +* Python Enhancement Proposals; PEP 249 <7>: Module functions. + (line 72) +* Python Enhancement Proposals; PEP 249 <8>: Connection objects. + (line 733) +* Python Enhancement Proposals; PEP 249 <9>: Connection objects. + (line 736) +* Python Enhancement Proposals; PEP 249 <10>: Connection objects. + (line 748) +* Python Enhancement Proposals; PEP 249 <11>: Exceptions<7>. (line 6) +* Python Enhancement Proposals; PEP 249 <12>: How to use placeholders to bind values in SQL queries. + (line 53) +* Python Enhancement Proposals; PEP 249 <13>: Transaction control via the autocommit attribute. + (line 10) +* Python Enhancement Proposals; PEP 249 <14>: Transaction control via the autocommit attribute. + (line 30) +* Python Enhancement Proposals; PEP 252: Related Links. (line 17) +* Python Enhancement Proposals; PEP 252 <1>: Related Links. (line 17) +* Python Enhancement Proposals; PEP 252 <2>: Implementing Descriptors. + (line 26) +* Python Enhancement Proposals; PEP 253: Old and New Classes. + (line 28) +* Python Enhancement Proposals; PEP 253 <1>: Multiple Inheritance The Diamond Rule. + (line 8) +* Python Enhancement Proposals; PEP 253 <2>: Related Links. (line 17) +* Python Enhancement Proposals; PEP 253 <3>: Related Links. (line 19) +* Python Enhancement Proposals; PEP 253 <4>: Related Links. (line 21) +* Python Enhancement Proposals; PEP 255: PEP 255 Simple Generators. + (line 45) +* Python Enhancement Proposals; PEP 255 <1>: PEP 255 Simple Generators. + (line 131) +* Python Enhancement Proposals; PEP 255 <2>: PEP 255 Simple Generators<2>. + (line 43) +* Python Enhancement Proposals; PEP 255 <3>: PEP 255 Simple Generators<2>. + (line 129) +* Python Enhancement Proposals; PEP 255 <4>: Yield expressions. + (line 90) +* Python Enhancement Proposals; PEP 255 <5>: Module Contents<5>. + (line 18) +* Python Enhancement Proposals; PEP 261: Unicode Changes. (line 18) +* Python Enhancement Proposals; PEP 261 <1>: Unicode Changes. + (line 61) +* Python Enhancement Proposals; PEP 263: Other Language Changes<16>. + (line 99) +* Python Enhancement Proposals; PEP 263 <1>: PEP 263 Source Code Encodings. + (line 29) +* Python Enhancement Proposals; PEP 263 <2>: Core and Builtins<35>. + (line 84) +* Python Enhancement Proposals; PEP 263 <3>: Introduction<12>. + (line 55) +* Python Enhancement Proposals; PEP 263 <4>: Tokenizing Input. + (line 35) +* Python Enhancement Proposals; PEP 263 <5>: Tokenizing Input. + (line 88) +* Python Enhancement Proposals; PEP 263 <6>: Unicode Literals in Python Source Code. + (line 48) +* Python Enhancement Proposals; PEP 264: Other Changes and Fixes<3>. + (line 55) +* Python Enhancement Proposals; PEP 273: PEP 273 Importing Modules from ZIP Archives. + (line 41) +* Python Enhancement Proposals; PEP 273 <1>: PEP 273 Importing Modules from ZIP Archives. + (line 44) +* Python Enhancement Proposals; PEP 273 <2>: zipimport — Import modules from Zip archives. + (line 44) +* Python Enhancement Proposals; PEP 273 <3>: zipimport — Import modules from Zip archives. + (line 47) +* Python Enhancement Proposals; PEP 274: New Syntax. (line 38) +* Python Enhancement Proposals; PEP 277: PEP 277 Unicode file name support for Windows NT. + (line 32) +* Python Enhancement Proposals; PEP 278: PEP 278 Universal Newline Support. + (line 33) +* Python Enhancement Proposals; PEP 278 <1>: Glossary. (line 1551) +* Python Enhancement Proposals; PEP 279: PEP 279 enumerate. (line 27) +* Python Enhancement Proposals; PEP 282: PEP 282 The logging Package. + (line 105) +* Python Enhancement Proposals; PEP 282 <1>: PEP 282 The logging Package. + (line 111) +* Python Enhancement Proposals; PEP 282 <2>: Archiving operations. + (line 47) +* Python Enhancement Proposals; PEP 282 <3>: Integration with the warnings module. + (line 36) +* Python Enhancement Proposals; PEP 285: PEP 285 A Boolean Type. + (line 47) +* Python Enhancement Proposals; PEP 285 <1>: PEP 285 A Boolean Type. + (line 70) +* Python Enhancement Proposals; PEP 288: PEP 342 New Generator Features. + (line 146) +* Python Enhancement Proposals; PEP 289: PEP 289 Generator Expressions. + (line 55) +* Python Enhancement Proposals; PEP 289 <1>: Other Language Changes<17>. + (line 15) +* Python Enhancement Proposals; PEP 289 <2>: Python documentation. + (line 12) +* Python Enhancement Proposals; PEP 292: PEP 292 Simpler String Substitutions. + (line 45) +* Python Enhancement Proposals; PEP 292 <1>: Template strings. + (line 6) +* Python Enhancement Proposals; PEP 293: PEP 293 Codec Error Handling Callbacks. + (line 33) +* Python Enhancement Proposals; PEP 3000: Python 3 0. (line 43) +* Python Enhancement Proposals; PEP 301: PEP 301 Package Index and Metadata for Distutils. + (line 45) +* Python Enhancement Proposals; PEP 302: Using importlib as the Implementation of Import. + (line 13) +* Python Enhancement Proposals; PEP 302 <1>: Visible Changes. + (line 18) +* Python Enhancement Proposals; PEP 302 <2>: Porting Python code. + (line 71) +* Python Enhancement Proposals; PEP 302 <3>: New Improved and Deprecated Modules<2>. + (line 106) +* Python Enhancement Proposals; PEP 302 <4>: New Improved and Removed Modules. + (line 289) +* Python Enhancement Proposals; PEP 302 <5>: PEP 273 Importing Modules from ZIP Archives. + (line 46) +* Python Enhancement Proposals; PEP 302 <6>: PEP 302 New Import Hooks. + (line 13) +* Python Enhancement Proposals; PEP 302 <7>: PEP 302 New Import Hooks. + (line 38) +* Python Enhancement Proposals; PEP 302 <8>: PEP 302 New Import Hooks. + (line 62) +* Python Enhancement Proposals; PEP 302 <9>: The import system. + (line 42) +* Python Enhancement Proposals; PEP 302 <10>: References. (line 10) +* Python Enhancement Proposals; PEP 302 <11>: Built-in Functions. + (line 2192) +* Python Enhancement Proposals; PEP 302 <12>: linecache — Random access to text lines. + (line 31) +* Python Enhancement Proposals; PEP 302 <13>: sys — System-specific parameters and functions. + (line 1366) +* Python Enhancement Proposals; PEP 302 <14>: sys — System-specific parameters and functions. + (line 1376) +* Python Enhancement Proposals; PEP 302 <15>: zipimport — Import modules from Zip archives. + (line 49) +* Python Enhancement Proposals; PEP 302 <16>: pkgutil — Package extension utility. + (line 65) +* Python Enhancement Proposals; PEP 302 <17>: pkgutil — Package extension utility. + (line 84) +* Python Enhancement Proposals; PEP 302 <18>: pkgutil — Package extension utility. + (line 99) +* Python Enhancement Proposals; PEP 302 <19>: pkgutil — Package extension utility. + (line 122) +* Python Enhancement Proposals; PEP 302 <20>: pkgutil — Package extension utility. + (line 143) +* Python Enhancement Proposals; PEP 302 <21>: pkgutil — Package extension utility. + (line 182) +* Python Enhancement Proposals; PEP 302 <22>: runpy — Locating and executing Python modules. + (line 32) +* Python Enhancement Proposals; PEP 302 <23>: Introduction<12>. + (line 59) +* Python Enhancement Proposals; PEP 302 <24>: importlib abc – Abstract base classes related to import. + (line 93) +* Python Enhancement Proposals; PEP 302 <25>: importlib abc – Abstract base classes related to import. + (line 180) +* Python Enhancement Proposals; PEP 302 <26>: importlib abc – Abstract base classes related to import. + (line 205) +* Python Enhancement Proposals; PEP 302 <27>: importlib abc – Abstract base classes related to import. + (line 277) +* Python Enhancement Proposals; PEP 302 <28>: Glossary. (line 928) +* Python Enhancement Proposals; PEP 305: PEP 305 Comma-separated Files. + (line 42) +* Python Enhancement Proposals; PEP 305 <1>: csv — CSV File Reading and Writing. + (line 38) +* Python Enhancement Proposals; PEP 307: PEP 307 Pickle Enhancements. + (line 8) +* Python Enhancement Proposals; PEP 307 <1>: PEP 307 Pickle Enhancements. + (line 30) +* Python Enhancement Proposals; PEP 307 <2>: PEP 307 Pickle Enhancements. + (line 42) +* Python Enhancement Proposals; PEP 307 <3>: Data stream format. + (line 32) +* Python Enhancement Proposals; PEP 308: PEP 308 Conditional Expressions. + (line 72) +* Python Enhancement Proposals; PEP 308 <1>: PEP 308 Conditional Expressions. + (line 78) +* Python Enhancement Proposals; PEP 308 <2>: Conditional expressions. + (line 16) +* Python Enhancement Proposals; PEP 309: PEP 309 Partial Function Application. + (line 73) +* Python Enhancement Proposals; PEP 3100: Python 3 0. (line 44) +* Python Enhancement Proposals; PEP 3101: PEP 3101 A New Approach To String Formatting. + (line 3) +* Python Enhancement Proposals; PEP 3101 <1>: PEP 3101 A New Approach To String Formatting. + (line 8) +* Python Enhancement Proposals; PEP 3101 <2>: PEP 3101 Advanced String Formatting. + (line 161) +* Python Enhancement Proposals; PEP 3101 <3>: Custom String Formatting. + (line 8) +* Python Enhancement Proposals; PEP 3101 <4>: Custom String Formatting. + (line 60) +* Python Enhancement Proposals; PEP 3102: New Syntax. (line 13) +* Python Enhancement Proposals; PEP 3104: New Syntax. (line 24) +* Python Enhancement Proposals; PEP 3104 <1>: The nonlocal statement. + (line 25) +* Python Enhancement Proposals; PEP 3105: Print Is A Function. + (line 8) +* Python Enhancement Proposals; PEP 3105 <1>: PEP 3105 print As a Function. + (line 35) +* Python Enhancement Proposals; PEP 3105 <2>: Module Contents<5>. + (line 35) +* Python Enhancement Proposals; PEP 3106: PEP 3106 Dictionary Views. + (line 58) +* Python Enhancement Proposals; PEP 3107: PEP 563 Postponed Evaluation of Annotations. + (line 7) +* Python Enhancement Proposals; PEP 3107 <1>: PEP 484 - Type Hints. + (line 7) +* Python Enhancement Proposals; PEP 3107 <2>: New Syntax. (line 6) +* Python Enhancement Proposals; PEP 3107 <3>: Function Annotations. + (line 7) +* Python Enhancement Proposals; PEP 3107 <4>: Function definitions. + (line 147) +* Python Enhancement Proposals; PEP 3108: Library Changes. (line 7) +* Python Enhancement Proposals; PEP 3108 <1>: Library Changes. + (line 17) +* Python Enhancement Proposals; PEP 3108 <2>: Library Changes. + (line 95) +* Python Enhancement Proposals; PEP 3109: Changed Syntax. (line 6) +* Python Enhancement Proposals; PEP 3109 <1>: Changes To Exceptions. + (line 29) +* Python Enhancement Proposals; PEP 3110: Changed Syntax. (line 16) +* Python Enhancement Proposals; PEP 3110 <1>: Changes To Exceptions. + (line 35) +* Python Enhancement Proposals; PEP 3110 <2>: PEP 3110 Exception-Handling Changes. + (line 48) +* Python Enhancement Proposals; PEP 3111: Builtins. (line 12) +* Python Enhancement Proposals; PEP 3112: PEP 3112 Byte Literals. + (line 75) +* Python Enhancement Proposals; PEP 3112 <1>: Module Contents<5>. + (line 39) +* Python Enhancement Proposals; PEP 3113: Removed Syntax. (line 6) +* Python Enhancement Proposals; PEP 3114: Operators And Special Methods. + (line 19) +* Python Enhancement Proposals; PEP 3115: types<7>. (line 10) +* Python Enhancement Proposals; PEP 3115 <1>: Changed Syntax. + (line 18) +* Python Enhancement Proposals; PEP 3115 <2>: Preparing the class namespace. + (line 21) +* Python Enhancement Proposals; PEP 3115 <3>: Class definitions. + (line 83) +* Python Enhancement Proposals; PEP 3115 <4>: Dynamic Type Creation. + (line 54) +* Python Enhancement Proposals; PEP 3115 <5>: Function and class definitions. + (line 181) +* Python Enhancement Proposals; PEP 3116: Optimizations<12>. (line 8) +* Python Enhancement Proposals; PEP 3116 <1>: PEP 3116 New I/O Library. + (line 69) +* Python Enhancement Proposals; PEP 3116 <2>: Glossary. (line 1551) +* Python Enhancement Proposals; PEP 3118: Pickle protocol 5 with out-of-band data buffers. + (line 13) +* Python Enhancement Proposals; PEP 3118 <1>: PEP 3118 New memoryview implementation and buffer protocol documentation. + (line 6) +* Python Enhancement Proposals; PEP 3118 <2>: API changes. (line 29) +* Python Enhancement Proposals; PEP 3118 <3>: Build and C API Changes<4>. + (line 8) +* Python Enhancement Proposals; PEP 3118 <4>: Build and C API Changes<7>. + (line 12) +* Python Enhancement Proposals; PEP 3118 <5>: PEP 3118 Revised Buffer Protocol. + (line 46) +* Python Enhancement Proposals; PEP 3118 <6>: Library<67>. (line 99) +* Python Enhancement Proposals; PEP 3118 <7>: Library<72>. (line 61) +* Python Enhancement Proposals; PEP 3118 <8>: Library<101>. (line 958) +* Python Enhancement Proposals; PEP 3118 <9>: Memory Views. (line 114) +* Python Enhancement Proposals; PEP 3119: PEP 3119 Abstract Base Classes. + (line 139) +* Python Enhancement Proposals; PEP 3119 <1>: Customizing instance and subclass checks. + (line 35) +* Python Enhancement Proposals; PEP 3119 <2>: Examples and Recipes. + (line 73) +* Python Enhancement Proposals; PEP 3119 <3>: abc — Abstract Base Classes. + (line 11) +* Python Enhancement Proposals; PEP 3119 <4>: Object Protocol. + (line 386) +* Python Enhancement Proposals; PEP 3119 <5>: Object Protocol. + (line 406) +* Python Enhancement Proposals; PEP 3120: Text Vs Data Instead Of Unicode Vs 8-bit. + (line 107) +* Python Enhancement Proposals; PEP 3120 <1>: Lexical analysis. + (line 13) +* Python Enhancement Proposals; PEP 3120 <2>: Introduction<12>. + (line 91) +* Python Enhancement Proposals; PEP 3121: Build and C API Changes<7>. + (line 14) +* Python Enhancement Proposals; PEP 3121 <1>: Core and Builtins<45>. + (line 230) +* Python Enhancement Proposals; PEP 3121 <2>: Initializing C modules. + (line 56) +* Python Enhancement Proposals; PEP 3123: Build and C API Changes<7>. + (line 16) +* Python Enhancement Proposals; PEP 3127: PEP 3127 Integer Literal Support and Syntax. + (line 47) +* Python Enhancement Proposals; PEP 3129: PEP 3129 Class Decorators. + (line 24) +* Python Enhancement Proposals; PEP 3129 <1>: Function definitions. + (line 169) +* Python Enhancement Proposals; PEP 3129 <2>: Class definitions. + (line 89) +* Python Enhancement Proposals; PEP 3131: Text Vs Data Instead Of Unicode Vs 8-bit. + (line 109) +* Python Enhancement Proposals; PEP 3131 <1>: Library<56>. (line 599) +* Python Enhancement Proposals; PEP 3131 <2>: Identifiers and keywords. + (line 10) +* Python Enhancement Proposals; PEP 3131 <3>: Identifiers and keywords. + (line 17) +* Python Enhancement Proposals; PEP 3132: New Syntax. (line 28) +* Python Enhancement Proposals; PEP 3132 <1>: Assignment statements. + (line 158) +* Python Enhancement Proposals; PEP 3134: Changed Syntax. (line 6) +* Python Enhancement Proposals; PEP 3134 <1>: Changes To Exceptions. + (line 40) +* Python Enhancement Proposals; PEP 3134 <2>: Changes To Exceptions. + (line 61) +* Python Enhancement Proposals; PEP 3134 <3>: Library<30>. (line 48) +* Python Enhancement Proposals; PEP 3134 <4>: Base classes. (line 29) +* Python Enhancement Proposals; PEP 3135: Builtins. (line 6) +* Python Enhancement Proposals; PEP 3135 <1>: Creating the class object. + (line 53) +* Python Enhancement Proposals; PEP 3137: PEP 3137 The memoryview Object. + (line 49) +* Python Enhancement Proposals; PEP 3138: Text Vs Data Instead Of Unicode Vs 8-bit. + (line 103) +* Python Enhancement Proposals; PEP 314: PEP 314 Metadata for Python Software Packages v1 1. + (line 42) +* Python Enhancement Proposals; PEP 3141: PEP 3141 A Type Hierarchy for Numbers. + (line 43) +* Python Enhancement Proposals; PEP 3141 <1>: numbers — Numeric abstract base classes. + (line 10) +* Python Enhancement Proposals; PEP 3141 <2>: abc — Abstract Base Classes. + (line 12) +* Python Enhancement Proposals; PEP 3144: ipaddress<6>. (line 10) +* Python Enhancement Proposals; PEP 3147: PEP 421 Adding sys implementation. + (line 21) +* Python Enhancement Proposals; PEP 3147 <1>: PEP 3147 PYC Repository Directories. + (line 69) +* Python Enhancement Proposals; PEP 3147 <2>: “Compiled” Python files. + (line 47) +* Python Enhancement Proposals; PEP 3147 <3>: Import-related attributes on module objects. + (line 156) +* Python Enhancement Proposals; PEP 3147 <4>: test support import_helper — Utilities for import tests. + (line 82) +* Python Enhancement Proposals; PEP 3147 <5>: runpy — Locating and executing Python modules. + (line 86) +* Python Enhancement Proposals; PEP 3147 <6>: Introduction<12>. + (line 95) +* Python Enhancement Proposals; PEP 3147 <7>: importlib util – Utility code for importers. + (line 24) +* Python Enhancement Proposals; PEP 3147 <8>: importlib util – Utility code for importers. + (line 60) +* Python Enhancement Proposals; PEP 3147 <9>: importlib util – Utility code for importers. + (line 64) +* Python Enhancement Proposals; PEP 3147 <10>: py_compile — Compile Python source files. + (line 30) +* Python Enhancement Proposals; PEP 3147 <11>: py_compile — Compile Python source files. + (line 70) +* Python Enhancement Proposals; PEP 3147 <12>: Command-line use. + (line 70) +* Python Enhancement Proposals; PEP 3147 <13>: Public functions. + (line 40) +* Python Enhancement Proposals; PEP 3147 <14>: Public functions. + (line 122) +* Python Enhancement Proposals; PEP 3147 <15>: Importing Modules<2>. + (line 217) +* Python Enhancement Proposals; PEP 3147 <16>: How do I create a pyc file?. + (line 12) +* Python Enhancement Proposals; PEP 3148: PEP 3148 The concurrent futures module. + (line 51) +* Python Enhancement Proposals; PEP 3148 <1>: Module Functions. + (line 61) +* Python Enhancement Proposals; PEP 3149: PEP 3149 ABI Version Tagged so Files. + (line 33) +* Python Enhancement Proposals; PEP 3149 <1>: Core and Builtins<99>. + (line 9) +* Python Enhancement Proposals; PEP 3149 <2>: sys — System-specific parameters and functions. + (line 16) +* Python Enhancement Proposals; PEP 3151: PEP 3151 Reworking the OS and IO exception hierarchy. + (line 84) +* Python Enhancement Proposals; PEP 3151 <1>: OS exceptions. (line 123) +* Python Enhancement Proposals; PEP 3151 <2>: Exceptions<15>. + (line 10) +* Python Enhancement Proposals; PEP 3151 <3>: select — Waiting for I/O completion. + (line 33) +* Python Enhancement Proposals; PEP 3151 <4>: resource — Resource usage information. + (line 23) +* Python Enhancement Proposals; PEP 3151 <5>: Exception types. + (line 252) +* Python Enhancement Proposals; PEP 3154: Summary – Release Highlights<3>. + (line 57) +* Python Enhancement Proposals; PEP 3154 <1>: pickle<4>. (line 16) +* Python Enhancement Proposals; PEP 3154 <2>: Library<56>. (line 1279) +* Python Enhancement Proposals; PEP 3154 <3>: Data stream format. + (line 42) +* Python Enhancement Proposals; PEP 3155: PEP 3155 Qualified name for classes and functions. + (line 63) +* Python Enhancement Proposals; PEP 3155 <1>: Glossary. (line 1291) +* Python Enhancement Proposals; PEP 3156: Summary – Release Highlights<3>. + (line 31) +* Python Enhancement Proposals; PEP 3156 <1>: Summary – Release Highlights<3>. + (line 44) +* Python Enhancement Proposals; PEP 3156 <2>: asyncio<11>. (line 6) +* Python Enhancement Proposals; PEP 3156 <3>: asyncio<11>. (line 17) +* Python Enhancement Proposals; PEP 3156 <4>: selectors<2>. (line 6) +* Python Enhancement Proposals; PEP 318: PEP 318 Decorators for Functions and Methods. + (line 101) +* Python Enhancement Proposals; PEP 318 <1>: PEP 318 Decorators for Functions and Methods. + (line 125) +* Python Enhancement Proposals; PEP 318 <2>: Other Language Changes<17>. + (line 9) +* Python Enhancement Proposals; PEP 318 <3>: Function definitions. + (line 166) +* Python Enhancement Proposals; PEP 318 <4>: Class definitions. + (line 92) +* Python Enhancement Proposals; PEP 322: PEP 322 Reverse Iteration. + (line 35) +* Python Enhancement Proposals; PEP 322 <1>: Other Language Changes<17>. + (line 13) +* Python Enhancement Proposals; PEP 324: PEP 324 New subprocess Module. + (line 86) +* Python Enhancement Proposals; PEP 324 <1>: subprocess — Subprocess management. + (line 25) +* Python Enhancement Proposals; PEP 325: PEP 342 New Generator Features. + (line 147) +* Python Enhancement Proposals; PEP 327: The Context type. (line 56) +* Python Enhancement Proposals; PEP 328: Porting Python code. + (line 36) +* Python Enhancement Proposals; PEP 328 <1>: Removed Syntax. (line 29) +* Python Enhancement Proposals; PEP 328 <2>: PEP 328 Absolute and Relative Imports. + (line 6) +* Python Enhancement Proposals; PEP 328 <3>: PEP 328 Absolute and Relative Imports. + (line 82) +* Python Enhancement Proposals; PEP 328 <4>: PEP 328 Multi-line Imports. + (line 35) +* Python Enhancement Proposals; PEP 328 <5>: Other Language Changes<17>. + (line 21) +* Python Enhancement Proposals; PEP 328 <6>: References. (line 20) +* Python Enhancement Proposals; PEP 328 <7>: Built-in Functions. + (line 2210) +* Python Enhancement Proposals; PEP 328 <8>: Module Contents<5>. + (line 26) +* Python Enhancement Proposals; PEP 328 <9>: Introduction<12>. + (line 63) +* Python Enhancement Proposals; PEP 331: PEP 331 Locale-Independent Float/String Conversions. + (line 38) +* Python Enhancement Proposals; PEP 333: The wsgiref package. + (line 8) +* Python Enhancement Proposals; PEP 333 <1>: The wsgiref package. + (line 31) +* Python Enhancement Proposals; PEP 3333: New Modules<3>. (line 9) +* Python Enhancement Proposals; PEP 3333 <1>: PEP 3333 Python Web Server Gateway Interface v1 0 1. + (line 50) +* Python Enhancement Proposals; PEP 3333 <2>: wsgiref — WSGI Utilities and Reference Implementation. + (line 26) +* Python Enhancement Proposals; PEP 3333 <3>: wsgiref util – WSGI environment utilities. + (line 8) +* Python Enhancement Proposals; PEP 3333 <4>: wsgiref util – WSGI environment utilities. + (line 10) +* Python Enhancement Proposals; PEP 3333 <5>: wsgiref util – WSGI environment utilities. + (line 30) +* Python Enhancement Proposals; PEP 3333 <6>: wsgiref util – WSGI environment utilities. + (line 76) +* Python Enhancement Proposals; PEP 3333 <7>: wsgiref headers – WSGI response header tools. + (line 12) +* Python Enhancement Proposals; PEP 3333 <8>: wsgiref simple_server – a simple WSGI HTTP server. + (line 21) +* Python Enhancement Proposals; PEP 3333 <9>: wsgiref simple_server – a simple WSGI HTTP server. + (line 99) +* 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 40) +* Python Enhancement Proposals; PEP 3333 <12>: wsgiref handlers – server/gateway base classes. + (line 237) +* Python Enhancement Proposals; PEP 3333 <13>: wsgiref handlers – server/gateway base classes. + (line 255) +* Python Enhancement Proposals; PEP 3333 <14>: wsgiref handlers – server/gateway base classes. + (line 262) +* Python Enhancement Proposals; PEP 3333 <15>: wsgiref handlers – server/gateway base classes. + (line 271) +* Python Enhancement Proposals; PEP 3333 <16>: wsgiref handlers – server/gateway base classes. + (line 314) +* 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 Executing Modules as Scripts. + (line 21) +* Python Enhancement Proposals; PEP 338 <1>: Interface options. + (line 100) +* Python Enhancement Proposals; PEP 338 <2>: References. (line 24) +* Python Enhancement Proposals; PEP 338 <3>: runpy — Locating and executing Python modules. + (line 177) +* Python Enhancement Proposals; PEP 339: Build and C API Changes<10>. + (line 46) +* Python Enhancement Proposals; PEP 341: PEP 341 Unified try/except/finally. + (line 44) +* Python Enhancement Proposals; PEP 342: PEP 342 New Generator Features. + (line 42) +* Python Enhancement Proposals; PEP 342 <1>: PEP 342 New Generator Features. + (line 140) +* Python Enhancement Proposals; PEP 342 <2>: Porting to Python 2 5. + (line 15) +* Python Enhancement Proposals; PEP 342 <3>: Yield expressions. + (line 95) +* Python Enhancement Proposals; PEP 342 <4>: Collections Abstract Base Classes – Detailed Descriptions. + (line 59) +* Python Enhancement Proposals; PEP 342 <5>: Passing values into a generator. + (line 25) +* Python Enhancement Proposals; PEP 342 <6>: Python documentation. + (line 14) +* Python Enhancement Proposals; PEP 343: The contextlib module. + (line 64) +* Python Enhancement Proposals; PEP 343 <1>: PEP 342 New Generator Features. + (line 129) +* Python Enhancement Proposals; PEP 343 <2>: The contextlib module<2>. + (line 64) +* Python Enhancement Proposals; PEP 343 <3>: With Statement Context Managers. + (line 46) +* Python Enhancement Proposals; PEP 343 <4>: The with statement. + (line 111) +* Python Enhancement Proposals; PEP 343 <5>: Using a context manager as a function decorator. + (line 51) +* Python Enhancement Proposals; PEP 343 <6>: Module Contents<5>. + (line 31) +* Python Enhancement Proposals; PEP 343 <7>: Glossary. (line 312) +* Python Enhancement Proposals; PEP 343 <8>: Glossary. (line 318) +* Python Enhancement Proposals; PEP 347: Build and C API Changes<10>. + (line 10) +* Python Enhancement Proposals; PEP 352: Changes To Exceptions. + (line 9) +* Python Enhancement Proposals; PEP 352 <1>: Deprecations and Removals. + (line 9) +* Python Enhancement Proposals; PEP 352 <2>: PEP 352 Exceptions as New-Style Classes. + (line 58) +* Python Enhancement Proposals; PEP 353: Porting to Python 3 10<2>. + (line 9) +* Python Enhancement Proposals; PEP 353 <1>: PEP 353 Using ssize_t as the index type. + (line 49) +* Python Enhancement Proposals; PEP 353 <2>: PEP 353 Using ssize_t as the index type. + (line 55) +* Python Enhancement Proposals; PEP 353 <3>: Build and C API Changes<10>. + (line 20) +* Python Enhancement Proposals; PEP 353 <4>: C API<41>. (line 78) +* Python Enhancement Proposals; PEP 353 <5>: Types. (line 17) +* Python Enhancement Proposals; PEP 356: What’s New in Python 2 5. + (line 10) +* Python Enhancement Proposals; PEP 357: PEP 357 The ‘__index__’ method. + (line 39) +* Python Enhancement Proposals; PEP 361: What’s New in Python 2 6. + (line 10) +* Python Enhancement Proposals; PEP 362: PEP 362 Function Signature Object. + (line 19) +* Python Enhancement Proposals; PEP 362 <1>: Introspecting callables with the Signature object. + (line 399) +* Python Enhancement Proposals; PEP 362 <2>: Glossary. (line 86) +* Python Enhancement Proposals; PEP 362 <3>: Glossary. (line 1175) +* Python Enhancement Proposals; PEP 366: Visible Changes. (line 24) +* Python Enhancement Proposals; PEP 366 <1>: Import-related attributes on module objects. + (line 63) +* Python Enhancement Proposals; PEP 366 <2>: References. (line 17) +* Python Enhancement Proposals; PEP 366 <3>: References. (line 21) +* Python Enhancement Proposals; PEP 366 <4>: runpy — Locating and executing Python modules. + (line 181) +* Python Enhancement Proposals; PEP 366 <5>: Introduction<12>. + (line 67) +* Python Enhancement Proposals; PEP 370: PEP 370 Per-user site-packages Directory. + (line 36) +* Python Enhancement Proposals; PEP 370 <1>: Library<28>. (line 605) +* Python Enhancement Proposals; PEP 370 <2>: Miscellaneous options. + (line 163) +* Python Enhancement Proposals; PEP 370 <3>: Environment variables. + (line 203) +* Python Enhancement Proposals; PEP 370 <4>: Environment variables. + (line 215) +* Python Enhancement Proposals; PEP 370 <5>: Command Line Interface<4>. + (line 37) +* Python Enhancement Proposals; PEP 371: PEP 371 The multiprocessing Package. + (line 145) +* Python Enhancement Proposals; PEP 372: PEP 372 Ordered Dictionaries. + (line 31) +* Python Enhancement Proposals; PEP 372 <1>: PEP 372 Adding an Ordered Dictionary to collections. + (line 97) +* Python Enhancement Proposals; PEP 373: The Future for Python 2 x. + (line 23) +* Python Enhancement Proposals; PEP 373 <1>: How stable is Python?. + (line 20) +* Python Enhancement Proposals; PEP 378: PEP 378 Format Specifier for Thousands Separator. + (line 32) +* Python Enhancement Proposals; PEP 378 <1>: PEP 378 Format Specifier for Thousands Separator<2>. + (line 37) +* Python Enhancement Proposals; PEP 378 <2>: Format Specification Mini-Language. + (line 144) +* Python Enhancement Proposals; PEP 380: PEP 380 Syntax for Delegating to a Subgenerator. + (line 66) +* Python Enhancement Proposals; PEP 380 <1>: Yield expressions. + (line 100) +* Python Enhancement Proposals; PEP 380#use-of-stopiteration-to-return-values: The STOP_ITERATION event. + (line 6) +* Python Enhancement Proposals; PEP 383: Documentation<24>. (line 29) +* Python Enhancement Proposals; PEP 383 <1>: Error Handlers. (line 50) +* Python Enhancement Proposals; PEP 383 <2>: Socket families. + (line 15) +* Python Enhancement Proposals; PEP 383 <3>: Locale Encoding. + (line 15) +* Python Enhancement Proposals; PEP 383 <4>: Locale Encoding. + (line 52) +* Python Enhancement Proposals; PEP 383 <5>: File System Encoding. + (line 7) +* Python Enhancement Proposals; PEP 384: Removed<6>. (line 53) +* Python Enhancement Proposals; PEP 384 <1>: PEP 384 Defining a Stable ABI. + (line 24) +* Python Enhancement Proposals; PEP 384 <2>: C API<35>. (line 100) +* Python Enhancement Proposals; PEP 385: Code Repository. (line 13) +* Python Enhancement Proposals; PEP 387: Warnings. (line 26) +* Python Enhancement Proposals; PEP 387 <1>: Warnings. (line 41) +* Python Enhancement Proposals; PEP 387 <2>: C API Stability. + (line 7) +* Python Enhancement Proposals; PEP 387 <3>: Stable ABI. (line 13) +* Python Enhancement Proposals; PEP 387 <4>: How does the Python version numbering scheme work?. + (line 46) +* Python Enhancement Proposals; PEP 389: PEP 389 Argparse Command Line Parsing Module. + (line 92) +* Python Enhancement Proposals; PEP 389 <1>: PEP 389 The argparse Module for Parsing Command Lines. + (line 100) +* Python Enhancement Proposals; PEP 391: PEP 391 Dictionary Based Configuration for Logging. + (line 52) +* Python Enhancement Proposals; PEP 391 <1>: PEP 391 Dictionary-Based Configuration For Logging. + (line 95) +* Python Enhancement Proposals; PEP 392: What’s New In Python 3 2. + (line 17) +* Python Enhancement Proposals; PEP 393: Removed<6>. (line 26) +* Python Enhancement Proposals; PEP 393 <1>: Porting to Python 3 9<2>. + (line 45) +* Python Enhancement Proposals; PEP 393 <2>: Removed<8>. (line 101) +* Python Enhancement Proposals; PEP 393 <3>: PEP 393 Flexible String Representation. + (line 16) +* Python Enhancement Proposals; PEP 393 <4>: Functionality. (line 6) +* Python Enhancement Proposals; PEP 393 <5>: Performance and resource usage. + (line 29) +* Python Enhancement Proposals; PEP 393 <6>: Optimizations<10>. + (line 8) +* Python Enhancement Proposals; PEP 393 <7>: Build and C API Changes<4>. + (line 12) +* Python Enhancement Proposals; PEP 393 <8>: Deprecated Python modules functions and methods<4>. + (line 10) +* Python Enhancement Proposals; PEP 393 <9>: Deprecated functions and types of the C API<3>. + (line 6) +* Python Enhancement Proposals; PEP 393 <10>: Porting C code. + (line 17) +* Python Enhancement Proposals; PEP 393 <11>: C API<33>. (line 143) +* Python Enhancement Proposals; PEP 393 <12>: Encodings and Unicode. + (line 7) +* Python Enhancement Proposals; PEP 393 <13>: sys — System-specific parameters and functions. + (line 1263) +* Python Enhancement Proposals; PEP 393 <14>: Unicode Objects. + (line 6) +* Python Enhancement Proposals; PEP 397: PEP 486 Make the Python Launcher aware of virtual environments. + (line 6) +* Python Enhancement Proposals; PEP 397 <1>: PEP 397 Python Launcher for Windows. + (line 31) +* Python Enhancement Proposals; PEP 397 <2>: Python Launcher for Windows. + (line 18) +* Python Enhancement Proposals; PEP 398: What’s New In Python 3 3. + (line 13) +* Python Enhancement Proposals; PEP 4: Library Changes. (line 13) +* Python Enhancement Proposals; PEP 405: PEP 405 Virtual Environments. + (line 22) +* Python Enhancement Proposals; PEP 405 <1>: venv — Creation of virtual environments. + (line 45) +* Python Enhancement Proposals; PEP 409: PEP 409 Suppressing exception context. + (line 63) +* Python Enhancement Proposals; PEP 411: sys — System-specific parameters and functions. + (line 1019) +* Python Enhancement Proposals; PEP 411 <1>: sys — System-specific parameters and functions. + (line 1029) +* Python Enhancement Proposals; PEP 411 <2>: sys — System-specific parameters and functions. + (line 1726) +* Python Enhancement Proposals; PEP 411 <3>: sys — System-specific parameters and functions. + (line 1746) +* Python Enhancement Proposals; PEP 411 <4>: Glossary. (line 1258) +* Python Enhancement Proposals; PEP 412: PEP 412 Key-Sharing Dictionary. + (line 15) +* Python Enhancement Proposals; PEP 412 <1>: functools — Higher-order functions and operations on callable objects. + (line 90) +* Python Enhancement Proposals; PEP 414: PEP 414 Explicit Unicode literals. + (line 17) +* Python Enhancement Proposals; PEP 414 <1>: String and Bytes literals. + (line 61) +* Python Enhancement Proposals; PEP 418: time<8>. (line 6) +* Python Enhancement Proposals; PEP 420: PEP 420 Implicit Namespace Packages. + (line 9) +* Python Enhancement Proposals; PEP 420 <1>: PEP 420 Implicit Namespace Packages. + (line 14) +* Python Enhancement Proposals; PEP 420 <2>: Core and Builtins<84>. + (line 56) +* Python Enhancement Proposals; PEP 420 <3>: Core and Builtins<89>. + (line 114) +* Python Enhancement Proposals; PEP 420 <4>: The import system. + (line 45) +* Python Enhancement Proposals; PEP 420 <5>: Namespace packages. + (line 27) +* Python Enhancement Proposals; PEP 420 <6>: __path__ attributes on modules. + (line 23) +* Python Enhancement Proposals; PEP 420 <7>: __path__ attributes on modules. + (line 23) +* Python Enhancement Proposals; PEP 420 <8>: References. (line 11) +* Python Enhancement Proposals; PEP 420 <9>: References. (line 13) +* Python Enhancement Proposals; PEP 420 <10>: References. (line 13) +* Python Enhancement Proposals; PEP 420 <11>: Introduction<12>. + (line 71) +* Python Enhancement Proposals; PEP 420 <12>: Glossary. (line 1076) +* Python Enhancement Proposals; PEP 420 <13>: Glossary. (line 1233) +* Python Enhancement Proposals; PEP 421: SimpleNamespace. (line 16) +* Python Enhancement Proposals; PEP 421 <1>: sys — System-specific parameters and functions. + (line 1134) +* Python Enhancement Proposals; PEP 421 <2>: sys — System-specific parameters and functions. + (line 1139) +* Python Enhancement Proposals; PEP 424: Other Language Changes<10>. + (line 57) +* Python Enhancement Proposals; PEP 424 <1>: operator<3>. (line 8) +* Python Enhancement Proposals; PEP 428: Summary – Release Highlights<3>. + (line 39) +* Python Enhancement Proposals; PEP 428 <1>: pathlib<11>. (line 17) +* Python Enhancement Proposals; PEP 428 <2>: pathlib — Object-oriented filesystem paths. + (line 41) +* Python Enhancement Proposals; PEP 429: What’s New In Python 3 4. + (line 16) +* Python Enhancement Proposals; PEP 432: Other CPython implementation changes. + (line 7) +* Python Enhancement Proposals; PEP 432 <1>: Core and Builtins<67>. + (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 57) +* Python Enhancement Proposals; PEP 434: PEP 434 IDLE Enhancement Exception for All Branches. + (line 6) +* Python Enhancement Proposals; PEP 434 <1>: idlelib — implementation of IDLE application. + (line 17) +* Python Enhancement Proposals; PEP 435: Summary – Release Highlights<3>. + (line 36) +* 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: Summary – Release Highlights<3>. + (line 120) +* 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: Removed<7>. (line 68) +* Python Enhancement Proposals; PEP 442 <1>: Summary – Release Highlights<3>. + (line 113) +* Python Enhancement Proposals; PEP 442 <2>: Summary – Release Highlights<3>. + (line 115) +* Python Enhancement Proposals; PEP 442 <3>: PEP 442 Safe Object Finalization. + (line 6) +* Python Enhancement Proposals; PEP 442 <4>: PEP 442 Safe Object Finalization. + (line 21) +* Python Enhancement Proposals; PEP 442 <5>: C API<48>. (line 55) +* Python Enhancement Proposals; PEP 442 <6>: gc — Garbage Collector interface. + (line 254) +* Python Enhancement Proposals; PEP 442 <7>: Finalization and De-allocation. + (line 89) +* Python Enhancement Proposals; PEP 442 <8>: PyTypeObject Slots. + (line 1663) +* Python Enhancement Proposals; PEP 443: Summary – Release Highlights<3>. + (line 55) +* Python Enhancement Proposals; PEP 443 <1>: functools<5>. (line 22) +* Python Enhancement Proposals; PEP 443 <2>: Glossary. (line 659) +* Python Enhancement Proposals; PEP 445: Summary – Release Highlights<3>. + (line 118) +* Python Enhancement Proposals; PEP 445 <1>: PEP 445 Customization of CPython Memory Allocators. + (line 6) +* Python Enhancement Proposals; PEP 445 <2>: PEP 445 Customization of CPython Memory Allocators. + (line 12) +* Python Enhancement Proposals; PEP 445 <3>: Other Improvements<2>. + (line 63) +* Python Enhancement Proposals; PEP 446: Summary – Release Highlights<3>. + (line 14) +* Python Enhancement Proposals; PEP 446 <1>: Summary – Release Highlights<3>. + (line 78) +* Python Enhancement Proposals; PEP 446 <2>: PEP 446 Newly Created File Descriptors Are Non-Inheritable. + (line 6) +* Python Enhancement Proposals; PEP 446 <3>: PEP 446 Newly Created File Descriptors Are Non-Inheritable. + (line 26) +* Python Enhancement Proposals; PEP 446 <4>: Core and Builtins<19>. + (line 20) +* Python Enhancement Proposals; PEP 448: PEP 448 - Additional Unpacking Generalizations. + (line 6) +* Python Enhancement Proposals; PEP 448 <1>: PEP 448 - Additional Unpacking Generalizations. + (line 39) +* Python Enhancement Proposals; PEP 448 <2>: Documentation<71>. + (line 10) +* Python Enhancement Proposals; PEP 448 <3>: Documentation<75>. + (line 9) +* Python Enhancement Proposals; PEP 448 <4>: Core and Builtins<92>. + (line 12) +* Python Enhancement Proposals; PEP 448 <5>: Core and Builtins<95>. + (line 9) +* Python Enhancement Proposals; PEP 448 <6>: Dictionary displays. + (line 29) +* Python Enhancement Proposals; PEP 448 <7>: Calls. (line 122) +* Python Enhancement Proposals; PEP 448 <8>: Expression lists. + (line 24) +* Python Enhancement Proposals; PEP 450: Summary – Release Highlights<3>. + (line 47) +* Python Enhancement Proposals; PEP 450 <1>: statistics<6>. (line 6) +* Python Enhancement Proposals; PEP 450 <2>: statistics<6>. (line 14) +* Python Enhancement Proposals; PEP 451: zipimport<2>. (line 8) +* Python Enhancement Proposals; PEP 451 <1>: zipimport<3>. (line 6) +* Python Enhancement Proposals; PEP 451 <2>: PEP 489 Multi-phase extension module initialization. + (line 7) +* Python Enhancement Proposals; PEP 451 <3>: Summary – Release Highlights<3>. + (line 22) +* Python Enhancement Proposals; PEP 451 <4>: PEP 451 A ModuleSpec Type for the Import System. + (line 6) +* Python Enhancement Proposals; PEP 451 <5>: Library<28>. (line 457) +* Python Enhancement Proposals; PEP 451 <6>: Core and Builtins<84>. + (line 75) +* Python Enhancement Proposals; PEP 451 <7>: References. (line 26) +* Python Enhancement Proposals; PEP 451 <8>: sys — System-specific parameters and functions. + (line 1295) +* Python Enhancement Proposals; PEP 451 <9>: pkgutil — Package extension utility. + (line 68) +* Python Enhancement Proposals; PEP 451 <10>: pkgutil — Package extension utility. + (line 102) +* Python Enhancement Proposals; PEP 451 <11>: runpy — Locating and executing Python modules. + (line 90) +* Python Enhancement Proposals; PEP 451 <12>: runpy — Locating and executing Python modules. + (line 167) +* Python Enhancement Proposals; PEP 451 <13>: runpy — Locating and executing Python modules. + (line 185) +* Python Enhancement Proposals; PEP 451 <14>: Introduction<12>. + (line 75) +* Python Enhancement Proposals; PEP 451 <15>: Multi-phase initialization. + (line 87) +* Python Enhancement Proposals; PEP 453: Summary – Release Highlights<3>. + (line 12) +* Python Enhancement Proposals; PEP 453 <1>: Summary – Release Highlights<3>. + (line 34) +* Python Enhancement Proposals; PEP 453 <2>: Bootstrapping pip By Default. + (line 6) +* Python Enhancement Proposals; PEP 453 <3>: Documentation Changes. + (line 21) +* Python Enhancement Proposals; PEP 453 <4>: ensurepip<2>. (line 7) +* Python Enhancement Proposals; PEP 453 <5>: venv<7>. (line 13) +* Python Enhancement Proposals; PEP 453 <6>: Other Improvements<2>. + (line 73) +* Python Enhancement Proposals; PEP 453 <7>: PEP 477 Backport ensurepip PEP 453 to Python 2 7. + (line 6) +* Python Enhancement Proposals; PEP 453 <8>: Bootstrapping pip By Default<2>. + (line 6) +* Python Enhancement Proposals; PEP 453 <9>: Documentation Changes<2>. + (line 21) +* Python Enhancement Proposals; PEP 453 <10>: ensurepip — Bootstrapping the pip installer. + (line 35) +* Python Enhancement Proposals; PEP 454: Summary – Release Highlights<3>. + (line 50) +* Python Enhancement Proposals; PEP 454 <1>: tracemalloc<4>. (line 6) +* Python Enhancement Proposals; PEP 454 <2>: tracemalloc<4>. (line 22) +* Python Enhancement Proposals; PEP 456: Summary – Release Highlights<3>. + (line 75) +* Python Enhancement Proposals; PEP 456 <1>: PEP 456 Secure and Interchangeable Hash Algorithm. + (line 6) +* Python Enhancement Proposals; PEP 456 <2>: PyHash API. (line 81) +* Python Enhancement Proposals; PEP 461: PEP 461 - percent formatting support for bytes and bytearray. + (line 6) +* Python Enhancement Proposals; PEP 461 <1>: PEP 461 - percent formatting support for bytes and bytearray. + (line 41) +* Python Enhancement Proposals; PEP 461 <2>: printf-style Bytes Formatting. + (line 198) +* Python Enhancement Proposals; PEP 465: PEP 465 - A dedicated infix operator for matrix multiplication. + (line 6) +* Python Enhancement Proposals; PEP 465 <1>: PEP 465 - A dedicated infix operator for matrix multiplication. + (line 44) +* Python Enhancement Proposals; PEP 465 <2>: Build and C API Changes<3>. + (line 43) +* Python Enhancement Proposals; PEP 465 <3>: Tools/Demos<51>. + (line 39) +* Python Enhancement Proposals; PEP 466: PEP 466 Network Security Enhancements for Python 2 7. + (line 6) +* Python Enhancement Proposals; PEP 466 <1>: PEP 466 Network Security Enhancements for Python 2 7. + (line 11) +* Python Enhancement Proposals; PEP 466 <2>: PEP 466 Network Security Enhancements for Python 2 7. + (line 21) +* Python Enhancement Proposals; PEP 466 <3>: PEP 466 Network Security Enhancements for Python 2 7. + (line 32) +* Python Enhancement Proposals; PEP 468: PEP 468 Preserving Keyword Argument Order. + (line 12) +* Python Enhancement Proposals; PEP 468 <1>: Library<74>. (line 87) +* Python Enhancement Proposals; PEP 468 <2>: OrderedDict objects. + (line 105) +* Python Enhancement Proposals; PEP 471: PEP 471 - os scandir function – a better and faster directory iterator. + (line 6) +* Python Enhancement Proposals; PEP 471 <1>: PEP 471 - os scandir function – a better and faster directory iterator. + (line 29) +* Python Enhancement Proposals; PEP 471 <2>: Library<100>. (line 6) +* Python Enhancement Proposals; PEP 475: PEP 475 Retry system calls failing with EINTR. + (line 32) +* Python Enhancement Proposals; PEP 475 <1>: PEP 475 Retry system calls failing with EINTR. + (line 77) +* Python Enhancement Proposals; PEP 475 <2>: Changes in the Python API<9>. + (line 6) +* Python Enhancement Proposals; PEP 475 <3>: Library<65>. (line 228) +* Python Enhancement Proposals; PEP 475 <4>: Library<98>. (line 143) +* Python Enhancement Proposals; PEP 475 <5>: Built-in Functions. + (line 1501) +* Python Enhancement Proposals; PEP 475 <6>: OS exceptions. (line 80) +* Python Enhancement Proposals; PEP 475 <7>: File Descriptor Operations. + (line 409) +* Python Enhancement Proposals; PEP 475 <8>: File Descriptor Operations. + (line 750) +* Python Enhancement Proposals; PEP 475 <9>: File Descriptor Operations. + (line 936) +* Python Enhancement Proposals; PEP 475 <10>: Process Management. + (line 933) +* Python Enhancement Proposals; PEP 475 <11>: I/O Base Classes. + (line 282) +* Python Enhancement Proposals; PEP 475 <12>: I/O Base Classes. + (line 300) +* Python Enhancement Proposals; PEP 475 <13>: Functions<5>. (line 311) +* Python Enhancement Proposals; PEP 475 <14>: Socket Objects. + (line 28) +* Python Enhancement Proposals; PEP 475 <15>: Socket Objects. + (line 82) +* Python Enhancement Proposals; PEP 475 <16>: Socket Objects. + (line 245) +* Python Enhancement Proposals; PEP 475 <17>: Socket Objects. + (line 259) +* Python Enhancement Proposals; PEP 475 <18>: Socket Objects. + (line 335) +* Python Enhancement Proposals; PEP 475 <19>: Socket Objects. + (line 409) +* Python Enhancement Proposals; PEP 475 <20>: Socket Objects. + (line 428) +* Python Enhancement Proposals; PEP 475 <21>: Socket Objects. + (line 447) +* Python Enhancement Proposals; PEP 475 <22>: Socket Objects. + (line 491) +* Python Enhancement Proposals; PEP 475 <23>: select — Waiting for I/O completion. + (line 159) +* Python Enhancement Proposals; PEP 475 <24>: /dev/poll Polling Objects. + (line 82) +* Python Enhancement Proposals; PEP 475 <25>: Edge and Level Trigger Polling epoll Objects. + (line 102) +* Python Enhancement Proposals; PEP 475 <26>: Polling Objects. + (line 94) +* Python Enhancement Proposals; PEP 475 <27>: Kqueue Objects. + (line 36) +* Python Enhancement Proposals; PEP 475 <28>: Classes<4>. (line 133) +* Python Enhancement Proposals; PEP 475 <29>: Module contents<2>. + (line 591) +* Python Enhancement Proposals; PEP 475 <30>: Module contents<2>. + (line 610) +* Python Enhancement Proposals; PEP 476: PEP 476 Enabling certificate verification by default for stdlib http clients<2>. + (line 6) +* Python Enhancement Proposals; PEP 477: PEP 477 Backport ensurepip PEP 453 to Python 2 7. + (line 6) +* Python Enhancement Proposals; PEP 478: What’s New In Python 3 5. + (line 17) +* Python Enhancement Proposals; PEP 479: Changes in Python Behavior. + (line 11) +* Python Enhancement Proposals; PEP 479 <1>: PEP 479 Change StopIteration handling inside generators. + (line 12) +* Python Enhancement Proposals; PEP 479 <2>: PEP 479 Change StopIteration handling inside generators. + (line 47) +* Python Enhancement Proposals; PEP 479 <3>: Library<56>. (line 1267) +* Python Enhancement Proposals; PEP 479 <4>: Library<60>. (line 52) +* Python Enhancement Proposals; PEP 479 <5>: Core and Builtins<63>. + (line 34) +* Python Enhancement Proposals; PEP 479 <6>: Library<68>. (line 95) +* Python Enhancement Proposals; PEP 479 <7>: Library<81>. (line 80) +* Python Enhancement Proposals; PEP 479 <8>: Library<87>. (line 326) +* Python Enhancement Proposals; PEP 479 <9>: Concrete exceptions. + (line 292) +* Python Enhancement Proposals; PEP 479 <10>: Concrete exceptions. + (line 294) +* Python Enhancement Proposals; PEP 479 <11>: Module Contents<5>. + (line 43) +* Python Enhancement Proposals; PEP 483: PEP 484 - Type Hints. + (line 47) +* Python Enhancement Proposals; PEP 483 <1>: Glossary. (line 667) +* Python Enhancement Proposals; PEP 484: PEP 695 Type Parameter Syntax. + (line 6) +* Python Enhancement Proposals; PEP 484 <1>: New Features Related to Type Hints. + (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>: New Features Related to Type Hints<2>. + (line 6) +* Python Enhancement Proposals; PEP 484 <4>: PEP 646 Variadic generics. + (line 6) +* Python Enhancement Proposals; PEP 484 <5>: New Features Related to Type Hints<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<3>. (line 17) +* Python Enhancement Proposals; PEP 484 <9>: ast<3>. (line 20) +* Python Enhancement Proposals; PEP 484 <10>: PEP 560 Core Support for typing module and Generic Types. + (line 6) +* Python Enhancement Proposals; PEP 484 <11>: PEP 526 Syntax for variable annotations. + (line 6) +* Python Enhancement Proposals; PEP 484 <12>: PEP 484 - Type Hints. + (line 16) +* Python Enhancement Proposals; PEP 484 <13>: PEP 484 - Type Hints. + (line 41) +* Python Enhancement Proposals; PEP 484 <14>: Function Annotations. + (line 8) +* Python Enhancement Proposals; PEP 484 <15>: Emulating generic types. + (line 15) +* Python Enhancement Proposals; PEP 484 <16>: Annotated assignment statements. + (line 48) +* Python Enhancement Proposals; PEP 484 <17>: Function definitions. + (line 151) +* Python Enhancement Proposals; PEP 484 <18>: Special Attributes of GenericAlias objects. + (line 50) +* Python Enhancement Proposals; PEP 484 <19>: NewType. (line 63) +* Python Enhancement Proposals; PEP 484 <20>: Nominal vs structural subtyping. + (line 6) +* Python Enhancement Proposals; PEP 484 <21>: Nominal vs structural subtyping. + (line 14) +* Python Enhancement Proposals; PEP 484 <22>: Building generic types and type aliases. + (line 113) +* Python Enhancement Proposals; PEP 484 <23>: Functions and decorators. + (line 280) +* Python Enhancement Proposals; PEP 484 <24>: Root nodes. (line 60) +* Python Enhancement Proposals; PEP 484 <25>: ast Helpers. (line 18) +* Python Enhancement Proposals; PEP 484 <26>: ast Helpers. (line 29) +* Python Enhancement Proposals; PEP 484 <27>: Compiler Flags. + (line 30) +* Python Enhancement Proposals; PEP 484 <28>: Glossary. (line 51) +* Python Enhancement Proposals; PEP 484 <29>: Glossary. (line 594) +* Python Enhancement Proposals; PEP 484 <30>: Glossary. (line 667) +* Python Enhancement Proposals; PEP 484 <31>: Glossary. (line 1526) +* Python Enhancement Proposals; PEP 484 <32>: Glossary. (line 1543) +* Python Enhancement Proposals; PEP 484 <33>: Glossary. (line 1573) +* Python Enhancement Proposals; PEP 484#annotating-instance-and-class-methods: PEP 673 Self type. + (line 8) +* Python Enhancement Proposals; PEP 485: PEP 485 A function for testing approximate equality. + (line 6) +* Python Enhancement Proposals; PEP 485 <1>: PEP 485 A function for testing approximate equality. + (line 36) +* Python Enhancement Proposals; PEP 485 <2>: Library<96>. (line 10) +* Python Enhancement Proposals; PEP 485 <3>: Floating point manipulation functions. + (line 58) +* Python Enhancement Proposals; PEP 485 <4>: Classification functions. + (line 56) +* Python Enhancement Proposals; PEP 486: PEP 486 Make the Python Launcher aware of virtual environments. + (line 6) +* Python Enhancement Proposals; PEP 486 <1>: PEP 486 Make the Python Launcher aware of virtual environments. + (line 14) +* Python Enhancement Proposals; PEP 486 <2>: Windows<77>. (line 6) +* Python Enhancement Proposals; PEP 487: PEP 487 Simpler customization of class creation. + (line 32) +* Python Enhancement Proposals; PEP 487 <1>: PEP 487 Descriptor Protocol Enhancements. + (line 6) +* Python Enhancement Proposals; PEP 487 <2>: PEP 487 Descriptor Protocol Enhancements. + (line 33) +* Python Enhancement Proposals; PEP 487 <3>: Changes in the Python API<8>. + (line 103) +* Python Enhancement Proposals; PEP 487 <4>: Documentation<61>. + (line 52) +* Python Enhancement Proposals; PEP 487 <5>: Documentation<68>. + (line 8) +* Python Enhancement Proposals; PEP 487 <6>: Core and Builtins<81>. + (line 46) +* Python Enhancement Proposals; PEP 488: PEP 488 Elimination of PYO files. + (line 6) +* Python Enhancement Proposals; PEP 488 <1>: PEP 488 Elimination of PYO files. + (line 20) +* Python Enhancement Proposals; PEP 488 <2>: Changes in the Python API<9>. + (line 79) +* Python Enhancement Proposals; PEP 488 <3>: Core and Builtins<99>. + (line 15) +* Python Enhancement Proposals; PEP 488 <4>: Miscellaneous options. + (line 88) +* Python Enhancement Proposals; PEP 488 <5>: Miscellaneous options. + (line 90) +* Python Enhancement Proposals; PEP 488 <6>: Miscellaneous options. + (line 97) +* Python Enhancement Proposals; PEP 488 <7>: Miscellaneous options. + (line 99) +* Python Enhancement Proposals; PEP 488 <8>: test support import_helper — Utilities for import tests. + (line 82) +* Python Enhancement Proposals; PEP 488 <9>: Introduction<12>. + (line 79) +* Python Enhancement Proposals; PEP 488 <10>: importlib util – Utility code for importers. + (line 24) +* Python Enhancement Proposals; PEP 488 <11>: importlib util – Utility code for importers. + (line 64) +* Python Enhancement Proposals; PEP 488 <12>: py_compile — Compile Python source files. + (line 31) +* Python Enhancement Proposals; PEP 489: PEP 489 Multi-phase extension module initialization. + (line 6) +* Python Enhancement Proposals; PEP 489 <1>: PEP 489 Multi-phase extension module initialization. + (line 18) +* Python Enhancement Proposals; PEP 489 <2>: Build and C API Changes<3>. + (line 37) +* Python Enhancement Proposals; PEP 489 <3>: Library<14>. (line 254) +* Python Enhancement Proposals; PEP 489 <4>: Library<24>. (line 20) +* Python Enhancement Proposals; PEP 489 <5>: Library<40>. (line 64) +* Python Enhancement Proposals; PEP 489 <6>: Library<40>. (line 79) +* Python Enhancement Proposals; PEP 489 <7>: Core and Builtins<42>. + (line 70) +* Python Enhancement Proposals; PEP 489 <8>: Library<41>. (line 68) +* Python Enhancement Proposals; PEP 489 <9>: Library<41>. (line 177) +* Python Enhancement Proposals; PEP 489 <10>: Core and Builtins<43>. + (line 50) +* Python Enhancement Proposals; PEP 489 <11>: Library<42>. (line 103) +* Python Enhancement Proposals; PEP 489 <12>: C API<39>. (line 11) +* Python Enhancement Proposals; PEP 489 <13>: C API<39>. (line 14) +* Python Enhancement Proposals; PEP 489 <14>: C API<39>. (line 17) +* Python Enhancement Proposals; PEP 489 <15>: C API<39>. (line 20) +* Python Enhancement Proposals; PEP 489 <16>: C API<39>. (line 23) +* Python Enhancement Proposals; PEP 489 <17>: C API<39>. (line 26) +* Python Enhancement Proposals; PEP 489 <18>: C API<39>. (line 29) +* Python Enhancement Proposals; PEP 489 <19>: C API<39>. (line 38) +* Python Enhancement Proposals; PEP 489 <20>: C API<39>. (line 41) +* Python Enhancement Proposals; PEP 489 <21>: C API<39>. (line 44) +* Python Enhancement Proposals; PEP 489 <22>: C API<39>. (line 47) +* Python Enhancement Proposals; PEP 489 <23>: Library<43>. (line 31) +* Python Enhancement Proposals; PEP 489 <24>: Core and Builtins<45>. + (line 20) +* Python Enhancement Proposals; PEP 489 <25>: Core and Builtins<45>. + (line 30) +* Python Enhancement Proposals; PEP 489 <26>: Core and Builtins<45>. + (line 33) +* Python Enhancement Proposals; PEP 489 <27>: Core and Builtins<45>. + (line 36) +* Python Enhancement Proposals; PEP 489 <28>: Core and Builtins<45>. + (line 39) +* Python Enhancement Proposals; PEP 489 <29>: Core and Builtins<45>. + (line 49) +* Python Enhancement Proposals; PEP 489 <30>: Core and Builtins<45>. + (line 52) +* Python Enhancement Proposals; PEP 489 <31>: Core and Builtins<45>. + (line 55) +* Python Enhancement Proposals; PEP 489 <32>: Core and Builtins<45>. + (line 74) +* Python Enhancement Proposals; PEP 489 <33>: Core and Builtins<45>. + (line 90) +* Python Enhancement Proposals; PEP 489 <34>: Core and Builtins<45>. + (line 102) +* Python Enhancement Proposals; PEP 489 <35>: Library<44>. (line 75) +* Python Enhancement Proposals; PEP 489 <36>: Library<44>. (line 78) +* Python Enhancement Proposals; PEP 489 <37>: Library<44>. (line 423) +* Python Enhancement Proposals; PEP 489 <38>: Core and Builtins<46>. + (line 28) +* Python Enhancement Proposals; PEP 489 <39>: Core and Builtins<46>. + (line 35) +* Python Enhancement Proposals; PEP 489 <40>: Core and Builtins<46>. + (line 50) +* Python Enhancement Proposals; PEP 489 <41>: Core and Builtins<47>. + (line 46) +* Python Enhancement Proposals; PEP 489 <42>: Core and Builtins<47>. + (line 49) +* Python Enhancement Proposals; PEP 489 <43>: Core and Builtins<47>. + (line 51) +* Python Enhancement Proposals; PEP 489 <44>: Core and Builtins<47>. + (line 71) +* Python Enhancement Proposals; PEP 489 <45>: Core and Builtins<47>. + (line 75) +* Python Enhancement Proposals; PEP 489 <46>: Core and Builtins<48>. + (line 17) +* Python Enhancement Proposals; PEP 489 <47>: Core and Builtins<48>. + (line 20) +* Python Enhancement Proposals; PEP 489 <48>: Core and Builtins<48>. + (line 40) +* Python Enhancement Proposals; PEP 489 <49>: Core and Builtins<48>. + (line 54) +* Python Enhancement Proposals; PEP 489 <50>: Core and Builtins<48>. + (line 109) +* Python Enhancement Proposals; PEP 489 <51>: Core and Builtins<48>. + (line 118) +* Python Enhancement Proposals; PEP 489 <52>: Core and Builtins<49>. + (line 29) +* Python Enhancement Proposals; PEP 489 <53>: Core and Builtins<49>. + (line 32) +* Python Enhancement Proposals; PEP 489 <54>: Core and Builtins<49>. + (line 52) +* Python Enhancement Proposals; PEP 489 <55>: Core and Builtins<49>. + (line 55) +* Python Enhancement Proposals; PEP 489 <56>: Core and Builtins<49>. + (line 58) +* Python Enhancement Proposals; PEP 489 <57>: Core and Builtins<50>. + (line 62) +* Python Enhancement Proposals; PEP 489 <58>: Introduction<12>. + (line 83) +* Python Enhancement Proposals; PEP 489 <59>: importlib machinery – Importers and path hooks. + (line 77) +* Python Enhancement Proposals; PEP 489 <60>: importlib machinery – Importers and path hooks. + (line 298) +* Python Enhancement Proposals; PEP 489 <61>: importlib machinery – Importers and path hooks. + (line 317) +* Python Enhancement Proposals; PEP 489 <62>: importlib machinery – Importers and path hooks. + (line 323) +* Python Enhancement Proposals; PEP 489 <63>: importlib util – Utility code for importers. + (line 183) +* Python Enhancement Proposals; PEP 489 <64>: Creating extensions without third party tools. + (line 14) +* Python Enhancement Proposals; PEP 489 <65>: Building C and C++ Extensions. + (line 39) +* Python Enhancement Proposals; PEP 489 <66>: Multi-phase initialization. + (line 181) +* Python Enhancement Proposals; PEP 489 <67>: Sub-interpreter support. + (line 81) +* Python Enhancement Proposals; PEP 492: PEP 525 Asynchronous Generators. + (line 6) +* Python Enhancement Proposals; PEP 492 <1>: New Keywords. (line 7) +* Python Enhancement Proposals; PEP 492 <2>: PEP 492 - Coroutines with async and await syntax. + (line 6) +* Python Enhancement Proposals; PEP 492 <3>: PEP 492 - Coroutines with async and await syntax. + (line 97) +* Python Enhancement Proposals; PEP 492 <4>: New Keywords<2>. + (line 7) +* Python Enhancement Proposals; PEP 492 <5>: Changes in the C API<7>. + (line 25) +* Python Enhancement Proposals; PEP 492 <6>: Core and Builtins<66>. + (line 98) +* Python Enhancement Proposals; PEP 492 <7>: Library<82>. (line 51) +* Python Enhancement Proposals; PEP 492 <8>: Library<88>. (line 16) +* Python Enhancement Proposals; PEP 492 <9>: Core and Builtins<96>. + (line 14) +* Python Enhancement Proposals; PEP 492 <10>: Awaitable Objects. + (line 33) +* Python Enhancement Proposals; PEP 492 <11>: Yield expressions. + (line 107) +* Python Enhancement Proposals; PEP 492 <12>: The async with statement. + (line 45) +* Python Enhancement Proposals; PEP 492 <13>: Collections Abstract Base Classes – Detailed Descriptions. + (line 166) +* 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>: Glossary. (line 92) +* Python Enhancement Proposals; PEP 492 <17>: Glossary. (line 125) +* Python Enhancement Proposals; PEP 492 <18>: Glossary. (line 132) +* Python Enhancement Proposals; PEP 492 <19>: Glossary. (line 141) +* Python Enhancement Proposals; PEP 492 <20>: Glossary. (line 159) +* Python Enhancement Proposals; PEP 492 <21>: Glossary. (line 345) +* Python Enhancement Proposals; PEP 492 <22>: Glossary. (line 352) +* 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 Local Time Disambiguation. + (line 13) +* Python Enhancement Proposals; PEP 495 <1>: PEP 495 Local Time Disambiguation. + (line 36) +* Python Enhancement Proposals; PEP 495 <2>: Library<80>. (line 96) +* Python Enhancement Proposals; PEP 495 <3>: Using ZoneInfo. (line 34) +* Python Enhancement Proposals; PEP 498: PEP 498 Formatted string literals. + (line 6) +* Python Enhancement Proposals; PEP 498 <1>: PEP 498 Formatted string literals. + (line 27) +* Python Enhancement Proposals; PEP 498 <2>: Core and Builtins<84>. + (line 283) +* Python Enhancement Proposals; PEP 498 <3>: f-strings. (line 154) +* Python Enhancement Proposals; PEP 498 <4>: Glossary. (line 493) +* Python Enhancement Proposals; PEP 5: PEP 230 Warning Framework. + (line 66) +* Python Enhancement Proposals; PEP 5 <1>: Is it reasonable to propose incompatible changes to Python?. + (line 14) +* Python Enhancement Proposals; PEP 506: secrets. (line 19) +* Python Enhancement Proposals; PEP 506 <1>: Library<83>. (line 60) +* Python Enhancement Proposals; PEP 506 <2>: secrets — Generate secure random numbers for managing secrets. + (line 24) +* Python Enhancement Proposals; PEP 511: Changes in the Python API<8>. + (line 33) +* Python Enhancement Proposals; PEP 514: Windows py exe launcher improvements. + (line 8) +* Python Enhancement Proposals; PEP 514 <1>: Windows<26>. (line 13) +* Python Enhancement Proposals; PEP 514 <2>: Windows<69>. (line 8) +* Python Enhancement Proposals; PEP 514 <3>: From the command-line. + (line 45) +* Python Enhancement Proposals; PEP 515: fractions<3>. (line 6) +* Python Enhancement Proposals; PEP 515 <1>: PEP 515 Underscores in Numeric Literals. + (line 6) +* Python Enhancement Proposals; PEP 515 <2>: PEP 515 Underscores in Numeric Literals. + (line 32) +* Python Enhancement Proposals; PEP 515 <3>: Core and Builtins<80>. + (line 15) +* Python Enhancement Proposals; PEP 515 <4>: Core and Builtins<80>. + (line 43) +* Python Enhancement Proposals; PEP 515 <5>: Format Specification Mini-Language. + (line 146) +* Python Enhancement Proposals; PEP 515 <6>: fractions — Rational numbers. + (line 98) +* Python Enhancement Proposals; PEP 519: PEP 519 Adding a file system path protocol. + (line 62) +* Python Enhancement Proposals; PEP 519 <1>: Library<80>. (line 6) +* Python Enhancement Proposals; PEP 519 <2>: Core and Builtins<83>. + (line 19) +* Python Enhancement Proposals; PEP 519 <3>: Library<82>. (line 31) +* Python Enhancement Proposals; PEP 519 <4>: Library<82>. (line 42) +* Python Enhancement Proposals; PEP 519 <5>: Library<82>. (line 44) +* Python Enhancement Proposals; PEP 519 <6>: C API<69>. (line 6) +* Python Enhancement Proposals; PEP 519 <7>: Glossary. (line 1212) +* Python Enhancement Proposals; PEP 520: PEP 520 Preserving Class Attribute Definition Order. + (line 17) +* Python Enhancement Proposals; PEP 523: New Features<4>. (line 19) +* Python Enhancement Proposals; PEP 523 <1>: Porting to Python 3 11<2>. + (line 33) +* Python Enhancement Proposals; PEP 523 <2>: Porting to Python 3 9<2>. + (line 6) +* Python Enhancement Proposals; PEP 523 <3>: PEP 523 Adding a frame evaluation API to CPython. + (line 12) +* Python Enhancement Proposals; PEP 523 <4>: PEP 523 Adding a frame evaluation API to CPython. + (line 26) +* Python Enhancement Proposals; PEP 523 <5>: Core and Builtins<22>. + (line 26) +* Python Enhancement Proposals; PEP 523 <6>: Tools/Demos<33>. + (line 7) +* Python Enhancement Proposals; PEP 523 <7>: Tools/Demos<37>. + (line 7) +* Python Enhancement Proposals; PEP 523 <8>: Core and Builtins<80>. + (line 83) +* Python Enhancement Proposals; PEP 523 <9>: Internal Frames. + (line 6) +* Python Enhancement Proposals; PEP 523 <10>: Low-level API. (line 186) +* Python Enhancement Proposals; PEP 523 <11>: Low-level API. (line 195) +* Python Enhancement Proposals; PEP 524: Summary – Release highlights<6>. + (line 77) +* Python Enhancement Proposals; PEP 524 <1>: os<8>. (line 20) +* Python Enhancement Proposals; PEP 524 <2>: os<8>. (line 25) +* Python Enhancement Proposals; PEP 524 <3>: Library<79>. (line 150) +* Python Enhancement Proposals; PEP 524 <4>: Library<79>. (line 154) +* Python Enhancement Proposals; PEP 524 <5>: Random numbers<2>. + (line 42) +* Python Enhancement Proposals; PEP 525: PEP 525 Asynchronous Generators. + (line 23) +* Python Enhancement Proposals; PEP 525 <1>: Core and Builtins<80>. + (line 49) +* Python Enhancement Proposals; PEP 525 <2>: Yield expressions. + (line 105) +* Python Enhancement Proposals; PEP 525 <3>: Collections Abstract Base Classes – Detailed Descriptions. + (line 166) +* Python Enhancement Proposals; PEP 525 <4>: sys — System-specific parameters and functions. + (line 1016) +* Python Enhancement Proposals; PEP 525 <5>: sys — System-specific parameters and functions. + (line 1721) +* Python Enhancement Proposals; PEP 525 <6>: Code Objects Bit Flags. + (line 56) +* Python Enhancement Proposals; PEP 525 <7>: Glossary. (line 126) +* Python Enhancement Proposals; PEP 526: Other Language Changes<4>. + (line 56) +* Python Enhancement Proposals; PEP 526 <1>: ast<3>. (line 18) +* Python Enhancement Proposals; PEP 526 <2>: PEP 563 Postponed Evaluation of Annotations. + (line 8) +* Python Enhancement Proposals; PEP 526 <3>: PEP 526 Syntax for variable annotations. + (line 30) +* Python Enhancement Proposals; PEP 526 <4>: typing<9>. (line 23) +* Python Enhancement Proposals; PEP 526 <5>: Core and Builtins<80>. + (line 51) +* Python Enhancement Proposals; PEP 526 <6>: Annotated assignment statements. + (line 42) +* Python Enhancement Proposals; PEP 526 <7>: Function definitions. + (line 155) +* Python Enhancement Proposals; PEP 526 <8>: Special forms. (line 197) +* Python Enhancement Proposals; PEP 526 <9>: Other special directives. + (line 71) +* Python Enhancement Proposals; PEP 526 <10>: dataclasses — Data Classes. + (line 16) +* Python Enhancement Proposals; PEP 526 <11>: Class variables. + (line 8) +* Python Enhancement Proposals; PEP 526 <12>: ast Helpers. (line 18) +* Python Enhancement Proposals; PEP 526 <13>: Compiler Flags. + (line 30) +* Python Enhancement Proposals; PEP 526 <14>: Glossary. (line 51) +* Python Enhancement Proposals; PEP 526 <15>: Glossary. (line 1573) +* Python Enhancement Proposals; PEP 528: PEP 528 Change Windows console encoding to UTF-8. + (line 17) +* Python Enhancement Proposals; PEP 528 <1>: UTF-8 mode. (line 34) +* Python Enhancement Proposals; PEP 528 <2>: Global configuration variables. + (line 172) +* Python Enhancement Proposals; PEP 528 <3>: PyConfig. (line 542) +* Python Enhancement Proposals; PEP 529: Changes in the Python API<5>. + (line 7) +* Python Enhancement Proposals; PEP 529 <1>: PEP 529 Change Windows filesystem encoding to UTF-8. + (line 22) +* Python Enhancement Proposals; PEP 529 <2>: Documentation<24>. + (line 29) +* Python Enhancement Proposals; PEP 529 <3>: Library<51>. (line 619) +* Python Enhancement Proposals; PEP 529 <4>: Windows<64>. (line 14) +* Python Enhancement Proposals; PEP 529 <5>: Environment variables. + (line 350) +* Python Enhancement Proposals; PEP 529 <6>: UTF-8 mode. (line 37) +* Python Enhancement Proposals; PEP 529 <7>: Files and Directories. + (line 302) +* Python Enhancement Proposals; PEP 529 <8>: sys — System-specific parameters and functions. + (line 799) +* Python Enhancement Proposals; PEP 529 <9>: sys — System-specific parameters and functions. + (line 1802) +* Python Enhancement Proposals; PEP 529 <10>: File System Encoding. + (line 7) +* Python Enhancement Proposals; PEP 529 <11>: Global configuration variables. + (line 154) +* Python Enhancement Proposals; PEP 530: PEP 530 Asynchronous Comprehensions. + (line 6) +* Python Enhancement Proposals; PEP 530 <1>: PEP 530 Asynchronous Comprehensions. + (line 19) +* Python Enhancement Proposals; PEP 530 <2>: Core and Builtins<80>. + (line 145) +* Python Enhancement Proposals; PEP 530 <3>: Displays for lists sets and dictionaries. + (line 56) +* Python Enhancement Proposals; PEP 538: PEP 538 Legacy C Locale Coercion. + (line 11) +* Python Enhancement Proposals; PEP 538 <1>: PEP 538 Legacy C Locale Coercion. + (line 36) +* Python Enhancement Proposals; PEP 538 <2>: PEP 538 Legacy C Locale Coercion. + (line 48) +* Python Enhancement Proposals; PEP 538 <3>: PEP 540 Forced UTF-8 Runtime Mode. + (line 27) +* Python Enhancement Proposals; PEP 538 <4>: Documentation<51>. + (line 68) +* Python Enhancement Proposals; PEP 538 <5>: Documentation<52>. + (line 6) +* Python Enhancement Proposals; PEP 538 <6>: Core and Builtins<67>. + (line 134) +* Python Enhancement Proposals; PEP 538 <7>: Environment variables. + (line 419) +* Python Enhancement Proposals; PEP 538 <8>: General Options. + (line 88) +* Python Enhancement Proposals; PEP 538 <9>: locale — Internationalization services. + (line 518) +* Python Enhancement Proposals; PEP 538 <10>: Python Configuration. + (line 13) +* Python Enhancement Proposals; PEP 539: PEP 539 New C API for Thread-Local Storage. + (line 12) +* Python Enhancement Proposals; PEP 539 <1>: PEP 539 New C API for Thread-Local Storage. + (line 30) +* Python Enhancement Proposals; PEP 539 <2>: C API<58>. (line 13) +* Python Enhancement Proposals; PEP 539 <3>: Thread Specific Storage TSS API. + (line 15) +* Python Enhancement Proposals; PEP 540: PEP 540 Forced UTF-8 Runtime Mode. + (line 18) +* Python Enhancement Proposals; PEP 540 <1>: PEP 540 Forced UTF-8 Runtime Mode. + (line 35) +* Python Enhancement Proposals; PEP 540 <2>: Core and Builtins<64>. + (line 63) +* Python Enhancement Proposals; PEP 540 <3>: Python UTF-8 Mode. + (line 6) +* Python Enhancement Proposals; PEP 540 <4>: locale — Internationalization services. + (line 518) +* Python Enhancement Proposals; PEP 540 <5>: Python Configuration. + (line 14) +* Python Enhancement Proposals; PEP 544: typing<8>. (line 32) +* Python Enhancement Proposals; PEP 544 <1>: Nominal vs structural subtyping. + (line 23) +* Python Enhancement Proposals; PEP 544 <2>: Other special directives. + (line 154) +* 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: Other CPython Implementation Changes. + (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 35) +* Python Enhancement Proposals; PEP 552 <3>: Library<56>. (line 794) +* Python Enhancement Proposals; PEP 552 <4>: Core and Builtins<64>. + (line 75) +* Python Enhancement Proposals; PEP 552 <5>: Introduction<12>. + (line 87) +* Python Enhancement Proposals; PEP 552 <6>: py_compile — Compile Python source files. + (line 82) +* Python Enhancement Proposals; PEP 552 <7>: PyConfig. (line 275) +* Python Enhancement Proposals; PEP 553: PEP 553 Built-in breakpoint. + (line 20) +* Python Enhancement Proposals; PEP 553 <1>: Core and Builtins<66>. + (line 72) +* Python Enhancement Proposals; PEP 554: PEP 684 A Per-Interpreter GIL. + (line 10) +* Python Enhancement Proposals; PEP 554 <1>: A Per-Interpreter GIL. + (line 13) +* Python Enhancement Proposals; PEP 557: dataclasses<3>. (line 26) +* Python Enhancement Proposals; PEP 557 <1>: dataclasses — Data Classes. + (line 13) +* Python Enhancement Proposals; PEP 560: PEP 560 Core Support for typing module and Generic Types. + (line 19) +* Python Enhancement Proposals; PEP 560 <1>: types<4>. (line 12) +* Python Enhancement Proposals; PEP 560 <2>: Core and Builtins<64>. + (line 66) +* Python Enhancement Proposals; PEP 560 <3>: Resolving MRO entries. + (line 30) +* Python Enhancement Proposals; PEP 560 <4>: __class_getitem__ versus __getitem__. + (line 85) +* Python Enhancement Proposals; PEP 560 <5>: Dynamic Type Creation. + (line 60) +* Python Enhancement Proposals; PEP 560 <6>: Dynamic Type Creation. + (line 76) +* Python Enhancement Proposals; PEP 560 <7>: Dynamic Type Creation. + (line 114) +* Python Enhancement Proposals; PEP 562: PEP 562 Customization of Access to Module Attributes. + (line 16) +* Python Enhancement Proposals; PEP 562 <1>: Library<63>. (line 63) +* Python Enhancement Proposals; PEP 562 <2>: Core and Builtins<64>. + (line 69) +* Python Enhancement Proposals; PEP 562 <3>: Customizing module attribute access. + (line 52) +* Python Enhancement Proposals; PEP 563: PEP 563 may not be the future. + (line 6) +* Python Enhancement Proposals; PEP 563 <1>: PEP 563 Postponed Evaluation of Annotations. + (line 51) +* Python Enhancement Proposals; PEP 563 <2>: Library<37>. (line 300) +* Python Enhancement Proposals; PEP 563 <3>: Core and Builtins<44>. + (line 83) +* Python Enhancement Proposals; PEP 563 <4>: Future statements. + (line 34) +* Python Enhancement Proposals; PEP 563 <5>: Function definitions. + (line 160) +* Python Enhancement Proposals; PEP 563 <6>: Constant. (line 29) +* Python Enhancement Proposals; PEP 563 <7>: Module Contents<5>. + (line 131) +* Python Enhancement Proposals; PEP 563 <8>: Module Contents<5>. + (line 47) +* Python Enhancement Proposals; PEP 564: PEP 564 New Time Functions With Nanosecond Resolution. + (line 8) +* Python Enhancement Proposals; PEP 564 <1>: PEP 564 New Time Functions With Nanosecond Resolution. + (line 33) +* Python Enhancement Proposals; PEP 564 <2>: time<5>. (line 6) +* Python Enhancement Proposals; PEP 564 <3>: Library<65>. (line 299) +* Python Enhancement Proposals; PEP 565: PEP 565 Show DeprecationWarning in __main__. + (line 41) +* Python Enhancement Proposals; PEP 565 <1>: Warnings. (line 23) +* Python Enhancement Proposals; PEP 566: Distribution metadata. + (line 34) +* Python Enhancement Proposals; PEP 567: contextvars. (line 20) +* Python Enhancement Proposals; PEP 567 <1>: asyncio<7>. (line 19) +* Python Enhancement Proposals; PEP 567 <2>: Documentation<51>. + (line 86) +* Python Enhancement Proposals; PEP 567 <3>: Documentation<53>. + (line 9) +* Python Enhancement Proposals; PEP 567 <4>: Core and Builtins<63>. + (line 63) +* Python Enhancement Proposals; PEP 567 <5>: contextvars — Context Variables. + (line 18) +* Python Enhancement Proposals; PEP 567 <6>: Scheduling callbacks. + (line 42) +* Python Enhancement Proposals; PEP 567 <7>: Scheduling delayed callbacks. + (line 31) +* Python Enhancement Proposals; PEP 567 <8>: Scheduling delayed callbacks. + (line 49) +* Python Enhancement Proposals; PEP 567 <9>: Future Object. (line 104) +* Python Enhancement Proposals; PEP 570: Positional-only parameters. + (line 70) +* Python Enhancement Proposals; PEP 570 <1>: Changes in the Python API<5>. + (line 160) +* Python Enhancement Proposals; PEP 570 <2>: Core and Builtins<54>. + (line 36) +* Python Enhancement Proposals; PEP 570 <3>: Function definitions. + (line 107) +* Python Enhancement Proposals; PEP 572: Other Language Changes<2>. + (line 31) +* Python Enhancement Proposals; PEP 572 <1>: Assignment expressions. + (line 41) +* Python Enhancement Proposals; PEP 572 <2>: CPython bytecode changes<5>. + (line 27) +* Python Enhancement Proposals; PEP 572 <3>: Core and Builtins<26>. + (line 40) +* Python Enhancement Proposals; PEP 572 <4>: Documentation<42>. + (line 6) +* Python Enhancement Proposals; PEP 572 <5>: Core and Builtins<52>. + (line 184) +* Python Enhancement Proposals; PEP 572 <6>: Core and Builtins<57>. + (line 92) +* Python Enhancement Proposals; PEP 572 <7>: Dictionary displays. + (line 47) +* Python Enhancement Proposals; PEP 572 <8>: Assignment expressions<2>. + (line 29) +* Python Enhancement Proposals; PEP 572 <9>: Capture Patterns. + (line 17) +* Python Enhancement Proposals; PEP 572 <10>: Why can’t I use an assignment in an expression?. + (line 14) +* Python Enhancement Proposals; PEP 573: Summary – Release highlights<4>. + (line 27) +* Python Enhancement Proposals; PEP 573 <1>: New Features<10>. + (line 6) +* Python Enhancement Proposals; PEP 573 <2>: Core and Builtins<46>. + (line 19) +* Python Enhancement Proposals; PEP 573 <3>: C API<42>. (line 57) +* Python Enhancement Proposals; PEP 574: Pickle protocol 5 with out-of-band data buffers. + (line 17) +* Python Enhancement Proposals; PEP 574 <1>: Data stream format. + (line 46) +* Python Enhancement Proposals; PEP 574 <2>: Example<4>. (line 63) +* Python Enhancement Proposals; PEP 578: PEP 578 Python Runtime Audit Hooks. + (line 12) +* Python Enhancement Proposals; PEP 578 <1>: Audit events table. + (line 8) +* Python Enhancement Proposals; PEP 578 <2>: sys — System-specific parameters and functions. + (line 58) +* Python Enhancement Proposals; PEP 578 <3>: System Functions. + (line 138) +* Python Enhancement Proposals; PEP 584: Summary – Release highlights<4>. + (line 8) +* Python Enhancement Proposals; PEP 584 <1>: Dictionary Merge & Update Operators. + (line 19) +* Python Enhancement Proposals; PEP 584 <2>: Library<46>. (line 193) +* Python Enhancement Proposals; PEP 584 <3>: Library<46>. (line 196) +* Python Enhancement Proposals; PEP 584 <4>: Library<46>. (line 210) +* Python Enhancement Proposals; PEP 584 <5>: Library<47>. (line 49) +* Python Enhancement Proposals; PEP 584 <6>: Library<47>. (line 62) +* Python Enhancement Proposals; PEP 584 <7>: Library<47>. (line 120) +* Python Enhancement Proposals; PEP 584 <8>: Library<47>. (line 142) +* Python Enhancement Proposals; PEP 584 <9>: ChainMap objects. + (line 90) +* Python Enhancement Proposals; PEP 584 <10>: defaultdict objects. + (line 57) +* Python Enhancement Proposals; PEP 584 <11>: OrderedDict objects. + (line 110) +* Python Enhancement Proposals; PEP 584 <12>: weakref — Weak references. + (line 201) +* Python Enhancement Proposals; PEP 584 <13>: weakref — Weak references. + (line 221) +* Python Enhancement Proposals; PEP 584 <14>: Standard Interpreter Types. + (line 233) +* Python Enhancement Proposals; PEP 584 <15>: Process Parameters. + (line 55) +* Python Enhancement Proposals; PEP 584 <16>: Process Parameters. + (line 71) +* Python Enhancement Proposals; PEP 585: Summary – Release highlights<4>. + (line 10) +* Python Enhancement Proposals; PEP 585 <1>: Type Hinting Generics in Standard Collections. + (line 18) +* Python Enhancement Proposals; PEP 585 <2>: Library<25>. (line 158) +* Python Enhancement Proposals; PEP 585 <3>: Library<34>. (line 124) +* Python Enhancement Proposals; PEP 585 <4>: Documentation<30>. + (line 31) +* Python Enhancement Proposals; PEP 585 <5>: Special Attributes of GenericAlias objects. + (line 54) +* Python Enhancement Proposals; PEP 585 <6>: collections abc — Abstract Base Classes for Containers. + (line 87) +* Python Enhancement Proposals; PEP 585 <7>: Standard Interpreter Types. + (line 176) +* Python Enhancement Proposals; PEP 585 <8>: Introspection helpers. + (line 157) +* Python Enhancement Proposals; PEP 585 <9>: Deprecated aliases. + (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 30) +* Python Enhancement Proposals; PEP 585 <24>: Aliases to container ABCs in collections abc. + (line 38) +* Python Enhancement Proposals; PEP 585 <25>: Aliases to container ABCs in collections abc. + (line 47) +* Python Enhancement Proposals; PEP 585 <26>: Aliases to container ABCs in collections abc. + (line 55) +* Python Enhancement Proposals; PEP 585 <27>: Aliases to container ABCs in collections abc. + (line 63) +* Python Enhancement Proposals; PEP 585 <28>: Aliases to container ABCs in collections abc. + (line 71) +* Python Enhancement Proposals; PEP 585 <29>: Aliases to container ABCs in collections abc. + (line 79) +* Python Enhancement Proposals; PEP 585 <30>: Aliases to container ABCs in collections abc. + (line 88) +* Python Enhancement Proposals; PEP 585 <31>: Aliases to container ABCs in collections abc. + (line 95) +* Python Enhancement Proposals; PEP 585 <32>: Aliases to container ABCs in collections abc. + (line 103) +* Python Enhancement Proposals; PEP 585 <33>: Aliases to container ABCs in collections abc. + (line 111) +* 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 46) +* Python Enhancement Proposals; PEP 585 <37>: Aliases to asynchronous ABCs in collections abc. + (line 56) +* Python Enhancement Proposals; PEP 585 <38>: Aliases to asynchronous ABCs in collections abc. + (line 66) +* 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 47) +* Python Enhancement Proposals; PEP 585 <43>: Aliases to other ABCs in collections abc. + (line 65) +* Python Enhancement Proposals; PEP 585 <44>: Aliases to contextlib ABCs. + (line 19) +* Python Enhancement Proposals; PEP 585 <45>: Aliases to contextlib ABCs. + (line 38) +* Python Enhancement Proposals; PEP 585 <46>: Deprecation Timeline of Major Features. + (line 15) +* Python Enhancement Proposals; PEP 585 <47>: Glossary. (line 668) +* Python Enhancement Proposals; PEP 586: typing<5>. (line 8) +* Python Enhancement Proposals; PEP 586 <1>: typing<7>. (line 6) +* Python Enhancement Proposals; PEP 586 <2>: typing<8>. (line 18) +* Python Enhancement Proposals; PEP 586 <3>: Special forms. (line 154) +* Python Enhancement Proposals; PEP 587: Removed C APIs. (line 104) +* Python Enhancement Proposals; PEP 587 <1>: Deprecated<4>. (line 34) +* Python Enhancement Proposals; PEP 587 <2>: PEP 587 Python Initialization Configuration. + (line 6) +* Python Enhancement Proposals; PEP 587 <3>: PEP 587 Python Initialization Configuration. + (line 83) +* Python Enhancement Proposals; PEP 587 <4>: C API<33>. (line 125) +* Python Enhancement Proposals; PEP 587 <5>: Core and Builtins<52>. + (line 76) +* Python Enhancement Proposals; PEP 587 <6>: C API<49>. (line 6) +* Python Enhancement Proposals; PEP 587 <7>: Python Initialization Configuration. + (line 32) +* Python Enhancement Proposals; PEP 589: typing<8>. (line 8) +* Python Enhancement Proposals; PEP 589 <1>: Other special directives. + (line 463) +* Python Enhancement Proposals; PEP 590: Removed C APIs. (line 135) +* Python Enhancement Proposals; PEP 590 <1>: Porting to Python 3 11<2>. + (line 98) +* Python Enhancement Proposals; PEP 590 <2>: Optimizations<4>. + (line 55) +* Python Enhancement Proposals; PEP 590 <3>: Summary – Release highlights<4>. + (line 33) +* Python Enhancement Proposals; PEP 590 <4>: Optimizations<5>. + (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<15>. + (line 170) +* Python Enhancement Proposals; PEP 590 <7>: Library<20>. (line 1079) +* Python Enhancement Proposals; PEP 590 <8>: C API<18>. (line 146) +* Python Enhancement Proposals; PEP 590 <9>: Core and Builtins<28>. + (line 113) +* Python Enhancement Proposals; PEP 590 <10>: Library<30>. (line 69) +* Python Enhancement Proposals; PEP 590 <11>: Core and Builtins<33>. + (line 57) +* Python Enhancement Proposals; PEP 590 <12>: Core and Builtins<36>. + (line 118) +* Python Enhancement Proposals; PEP 590 <13>: Core and Builtins<37>. + (line 348) +* Python Enhancement Proposals; PEP 590 <14>: Core and Builtins<39>. + (line 27) +* Python Enhancement Proposals; PEP 590 <15>: Core and Builtins<39>. + (line 74) +* Python Enhancement Proposals; PEP 590 <16>: Core and Builtins<45>. + (line 10) +* Python Enhancement Proposals; PEP 590 <17>: Core and Builtins<45>. + (line 16) +* Python Enhancement Proposals; PEP 590 <18>: Core and Builtins<47>. + (line 39) +* Python Enhancement Proposals; PEP 590 <19>: Core and Builtins<47>. + (line 91) +* Python Enhancement Proposals; PEP 590 <20>: Core and Builtins<48>. + (line 42) +* Python Enhancement Proposals; PEP 590 <21>: Core and Builtins<48>. + (line 50) +* Python Enhancement Proposals; PEP 590 <22>: Core and Builtins<48>. + (line 67) +* Python Enhancement Proposals; PEP 590 <23>: C API<49>. (line 17) +* Python Enhancement Proposals; PEP 590 <24>: The Vectorcall Protocol. + (line 8) +* Python Enhancement Proposals; PEP 591: typing<8>. (line 25) +* Python Enhancement Proposals; PEP 591 <1>: Special forms. (line 242) +* Python Enhancement Proposals; PEP 591 <2>: Functions and decorators. + (line 335) +* Python Enhancement Proposals; PEP 593: Summary – Release highlights<4>. + (line 20) +* Python Enhancement Proposals; PEP 593 <1>: typing<6>. (line 6) +* Python Enhancement Proposals; PEP 593 <2>: Library<48>. (line 91) +* Python Enhancement Proposals; PEP 593 <3>: Special forms. (line 431) +* Python Enhancement Proposals; PEP 593 <4>: Introspection helpers. + (line 51) +* Python Enhancement Proposals; PEP 594: Summary – Release Highlights. + (line 21) +* 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>: Summary – Release highlights<2>. + (line 46) +* Python Enhancement Proposals; PEP 594 <6>: Modules. (line 6) +* Python Enhancement Proposals; PEP 594 <7>: Library<20>. (line 845) +* Python Enhancement Proposals; PEP 594 <8>: Library<20>. (line 848) +* Python Enhancement Proposals; PEP 594 <9>: Library<20>. (line 851) +* Python Enhancement Proposals; PEP 594 <10>: Library<20>. (line 859) +* Python Enhancement Proposals; PEP 594 <11>: Library<20>. (line 863) +* Python Enhancement Proposals; PEP 594 <12>: Library<20>. (line 869) +* Python Enhancement Proposals; PEP 594 <13>: Library<20>. (line 872) +* Python Enhancement Proposals; PEP 594 <14>: Library<20>. (line 887) +* Python Enhancement Proposals; PEP 594 <15>: Library<20>. (line 890) +* Python Enhancement Proposals; PEP 594 <16>: Library<20>. (line 897) +* Python Enhancement Proposals; PEP 594 <17>: Library<20>. (line 900) +* Python Enhancement Proposals; PEP 594 <18>: Library<20>. (line 903) +* Python Enhancement Proposals; PEP 594 <19>: Library<20>. (line 906) +* Python Enhancement Proposals; PEP 594 <20>: Library<20>. (line 909) +* Python Enhancement Proposals; PEP 594 <21>: Library<20>. (line 964) +* Python Enhancement Proposals; PEP 594 <22>: Library<20>. (line 967) +* Python Enhancement Proposals; PEP 594 <23>: Library<20>. (line 970) +* Python Enhancement Proposals; PEP 594 <24>: Library<20>. (line 973) +* Python Enhancement Proposals; PEP 594 <25>: Library<27>. (line 102) +* Python Enhancement Proposals; PEP 594 <26>: Library<28>. (line 684) +* Python Enhancement Proposals; PEP 594 <27>: Library<29>. (line 94) +* Python Enhancement Proposals; PEP 594 <28>: Library<30>. (line 124) +* Python Enhancement Proposals; PEP 594 <29>: Library<30>. (line 150) +* Python Enhancement Proposals; PEP 594 <30>: Tests<27>. (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 support. + (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: Summary – Release highlights<3>. + (line 46) +* Python Enhancement Proposals; PEP 597 <1>: Library<38>. (line 44) +* Python Enhancement Proposals; PEP 597 <2>: Opt-in EncodingWarning. + (line 6) +* Python Enhancement Proposals; PEP 602: Summary – Release Highlights. + (line 164) +* Python Enhancement Proposals; PEP 602 <1>: Summary – Release highlights<4>. + (line 58) +* Python Enhancement Proposals; PEP 602 <2>: How stable is Python?. + (line 8) +* Python Enhancement Proposals; PEP 604: Summary – Release highlights<3>. + (line 27) +* Python Enhancement Proposals; PEP 604 <1>: PEP 604 New Type Union Operator. + (line 28) +* Python Enhancement Proposals; PEP 604 <2>: Library<41>. (line 25) +* Python Enhancement Proposals; PEP 604 <3>: Documentation<39>. + (line 6) +* Python Enhancement Proposals; PEP 604 <4>: Union Type. (line 104) +* Python Enhancement Proposals; PEP 604 <5>: Manually Un-Stringizing Stringized Annotations. + (line 42) +* Python Enhancement Proposals; PEP 610: Distributions. (line 49) +* Python Enhancement Proposals; PEP 612: Summary – Release highlights<3>. + (line 29) +* Python Enhancement Proposals; PEP 612 <1>: PEP 612 Parameter Specification Variables. + (line 25) +* Python Enhancement Proposals; PEP 612 <2>: Library<36>. (line 691) +* Python Enhancement Proposals; PEP 612 <3>: Library<37>. (line 95) +* Python Enhancement Proposals; PEP 612 <4>: Core and Builtins<42>. + (line 59) +* Python Enhancement Proposals; PEP 612 <5>: Library<41>. (line 25) +* Python Enhancement Proposals; PEP 612 <6>: Library<41>. (line 119) +* Python Enhancement Proposals; PEP 612 <7>: Annotating callable objects. + (line 77) +* Python Enhancement Proposals; PEP 612 <8>: User-defined generic types. + (line 179) +* Python Enhancement Proposals; PEP 612 <9>: Special forms. (line 125) +* Python Enhancement Proposals; PEP 612 <10>: Building generic types and type aliases. + (line 464) +* Python Enhancement Proposals; PEP 612 <11>: Aliases to other ABCs in collections abc. + (line 35) +* Python Enhancement Proposals; PEP 613: Summary – Release highlights<3>. + (line 31) +* Python Enhancement Proposals; PEP 613 <1>: PEP 613 TypeAlias. + (line 21) +* Python Enhancement Proposals; PEP 613 <2>: Library<43>. (line 98) +* Python Enhancement Proposals; PEP 613 <3>: Special types. (line 228) +* Python Enhancement Proposals; PEP 614: Summary – Release highlights<4>. + (line 12) +* Python Enhancement Proposals; PEP 614 <1>: Other Language Changes<5>. + (line 38) +* Python Enhancement Proposals; PEP 614 <2>: Core and Builtins<48>. + (line 112) +* Python Enhancement Proposals; PEP 614 <3>: Function definitions. + (line 57) +* Python Enhancement Proposals; PEP 614 <4>: Class definitions. + (line 60) +* Python Enhancement Proposals; PEP 615: Summary – Release highlights<4>. + (line 50) +* Python Enhancement Proposals; PEP 615 <1>: zoneinfo. (line 37) +* Python Enhancement Proposals; PEP 615 <2>: Library<45>. (line 54) +* Python Enhancement Proposals; PEP 615 <3>: zoneinfo — IANA time zone support. + (line 14) +* Python Enhancement Proposals; PEP 616: Summary – Release highlights<4>. + (line 16) +* Python Enhancement Proposals; PEP 616 <1>: New String Methods to Remove Prefixes and Suffixes. + (line 9) +* Python Enhancement Proposals; PEP 616 <2>: Core and Builtins<47>. + (line 82) +* Python Enhancement Proposals; PEP 617: PEP 701 Syntactic formalization of f-strings. + (line 69) +* Python Enhancement Proposals; PEP 617 <1>: Modules. (line 30) +* Python Enhancement Proposals; PEP 617 <2>: Parenthesized context managers. + (line 45) +* Python Enhancement Proposals; PEP 617 <3>: Summary – Release highlights<4>. + (line 30) +* Python Enhancement Proposals; PEP 617 <4>: New Parser. (line 21) +* Python Enhancement Proposals; PEP 617 <5>: Deprecated<7>. (line 95) +* Python Enhancement Proposals; PEP 617 <6>: Library<36>. (line 178) +* Python Enhancement Proposals; PEP 617 <7>: Library<46>. (line 34) +* Python Enhancement Proposals; PEP 617 <8>: Full Grammar specification. + (line 16) +* Python Enhancement Proposals; PEP 618: Summary – Release highlights<3>. + (line 19) +* Python Enhancement Proposals; PEP 618 <1>: Other Language Changes<4>. + (line 17) +* Python Enhancement Proposals; PEP 618 <2>: Core and Builtins<45>. + (line 209) +* Python Enhancement Proposals; PEP 623: Summary – Release highlights. + (line 107) +* Python Enhancement Proposals; PEP 623 <1>: Optimizations<2>. + (line 7) +* Python Enhancement Proposals; PEP 623 <2>: Removed<2>. (line 11) +* Python Enhancement Proposals; PEP 623 <3>: Summary – Release highlights<3>. + (line 41) +* Python Enhancement Proposals; PEP 623 <4>: C API<26>. (line 21) +* Python Enhancement Proposals; PEP 623 <5>: Core and Builtins<40>. + (line 10) +* Python Enhancement Proposals; PEP 623 <6>: Documentation<34>. + (line 10) +* Python Enhancement Proposals; PEP 623 <7>: Unicode Objects. + (line 17) +* Python Enhancement Proposals; PEP 624: Summary – Release highlights<2>. + (line 49) +* Python Enhancement Proposals; PEP 624 <1>: Removed<4>. (line 97) +* Python Enhancement Proposals; PEP 624 <2>: Summary – Release highlights<3>. + (line 44) +* Python Enhancement Proposals; PEP 624 <3>: C API<33>. (line 143) +* Python Enhancement Proposals; PEP 624#alternative-apis: Removed<4>. + (line 97) +* Python Enhancement Proposals; PEP 626: Pending Removal in Python 3 15. + (line 77) +* Python Enhancement Proposals; PEP 626 <1>: Deprecated. (line 215) +* Python Enhancement Proposals; PEP 626 <2>: Pending Removal in Python 3 15<3>. + (line 77) +* Python Enhancement Proposals; PEP 626 <3>: Summary – Release highlights<3>. + (line 23) +* Python Enhancement Proposals; PEP 626 <4>: Core and Builtins<29>. + (line 422) +* Python Enhancement Proposals; PEP 626 <5>: Methods on code objects. + (line 81) +* Python Enhancement Proposals; PEP 626 <6>: Analysis functions. + (line 175) +* Python Enhancement Proposals; PEP 626 <7>: Pending Removal in Python 3 15<5>. + (line 77) +* Python Enhancement Proposals; PEP 628: cmath. (line 7) +* Python Enhancement Proposals; PEP 628 <1>: math<7>. (line 7) +* Python Enhancement Proposals; PEP 628 <2>: Library<80>. (line 32) +* Python Enhancement Proposals; PEP 632: Summary – Release highlights. + (line 111) +* Python Enhancement Proposals; PEP 632 <1>: distutils. (line 7) +* Python Enhancement Proposals; PEP 632 <2>: Summary – Release highlights<3>. + (line 39) +* Python Enhancement Proposals; PEP 632 <3>: distutils<2>. (line 14) +* Python Enhancement Proposals; PEP 632 <4>: Library<27>. (line 38) +* Python Enhancement Proposals; PEP 632 <5>: distutils — Building and installing Python modules. + (line 10) +* Python Enhancement Proposals; PEP 634: Summary – Release highlights<3>. + (line 8) +* Python Enhancement Proposals; PEP 634 <1>: Other Key Features. + (line 53) +* Python Enhancement Proposals; PEP 634 <2>: Core and Builtins<30>. + (line 55) +* Python Enhancement Proposals; PEP 634 <3>: Core and Builtins<38>. + (line 54) +* Python Enhancement Proposals; PEP 634 <4>: Core and Builtins<40>. + (line 57) +* Python Enhancement Proposals; PEP 634 <5>: Customizing positional arguments in class pattern matching. + (line 32) +* Python Enhancement Proposals; PEP 634 <6>: The match statement. + (line 33) +* Python Enhancement Proposals; PEP 634 <7>: Class Patterns. (line 136) +* Python Enhancement Proposals; PEP 634 <8>: PyTypeObject Slots. + (line 820) +* Python Enhancement Proposals; PEP 634 <9>: PyTypeObject Slots. + (line 844) +* Python Enhancement Proposals; PEP 635: Summary – Release highlights<3>. + (line 10) +* Python Enhancement Proposals; PEP 635 <1>: Other Key Features. + (line 54) +* Python Enhancement Proposals; PEP 636: Summary – Release highlights<3>. + (line 12) +* Python Enhancement Proposals; PEP 636 <1>: Other Key Features. + (line 54) +* Python Enhancement Proposals; PEP 636 <2>: match Statements. + (line 180) +* Python Enhancement Proposals; PEP 636 <3>: The match statement. + (line 35) +* Python Enhancement Proposals; PEP 636 <4>: Class Patterns. (line 138) +* Python Enhancement Proposals; PEP 644: hashlib. (line 8) +* Python Enhancement Proposals; PEP 644 <1>: Summary – Release highlights<3>. + (line 37) +* Python Enhancement Proposals; PEP 644 <2>: hashlib<3>. (line 7) +* Python Enhancement Proposals; PEP 644 <3>: ssl<3>. (line 7) +* Python Enhancement Proposals; PEP 644 <4>: Build Changes<4>. + (line 6) +* Python Enhancement Proposals; PEP 644 <5>: Core and Builtins<19>. + (line 167) +* Python Enhancement Proposals; PEP 644 <6>: Library<28>. (line 525) +* Python Enhancement Proposals; PEP 644 <7>: Build<35>. (line 9) +* Python Enhancement Proposals; PEP 644 <8>: ssl — TLS/SSL wrapper for socket objects. + (line 57) +* 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>: Subscriptions. (line 30) +* Python Enhancement Proposals; PEP 646 <3>: Expression lists. + (line 27) +* Python Enhancement Proposals; PEP 646 <4>: Function definitions. + (line 126) +* Python Enhancement Proposals; PEP 646 <5>: Building generic types and type aliases. + (line 320) +* Python Enhancement Proposals; PEP 647: Summary – Release highlights<3>. + (line 33) +* Python Enhancement Proposals; PEP 647 <1>: PEP 647 User-Defined Type Guards. + (line 9) +* Python Enhancement Proposals; PEP 647 <2>: Library<37>. (line 182) +* Python Enhancement Proposals; PEP 647 <3>: Special forms. (line 545) +* Python Enhancement Proposals; PEP 649: Annotation scopes. (line 10) +* Python Enhancement Proposals; PEP 649 <1>: Module Contents<5>. + (line 132) +* Python Enhancement Proposals; PEP 652: PEP 652 Maintaining the Stable ABI. + (line 11) +* Python Enhancement Proposals; PEP 652 <1>: C API<34>. (line 41) +* Python Enhancement Proposals; PEP 654: PEP 654 Exception Groups and except*. + (line 6) +* Python Enhancement Proposals; PEP 654 <1>: PEP 654 Exception Groups and except*. + (line 13) +* Python Enhancement Proposals; PEP 654 <2>: New opcodes. (line 18) +* Python Enhancement Proposals; PEP 654 <3>: Core and Builtins<29>. + (line 174) +* Python Enhancement Proposals; PEP 654 <4>: Core and Builtins<34>. + (line 146) +* Python Enhancement Proposals; PEP 654 <5>: Core and Builtins<36>. + (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>: Library<29>. (line 266) +* Python Enhancement Proposals; PEP 655 <2>: Special forms. (line 256) +* Python Enhancement Proposals; PEP 655 <3>: Special forms. (line 265) +* Python Enhancement Proposals; PEP 655 <4>: Other special directives. + (line 469) +* Python Enhancement Proposals; PEP 657: PEP 657 Fine-grained error locations in tracebacks. + (line 55) +* Python Enhancement Proposals; PEP 657 <1>: inspect<2>. (line 17) +* Python Enhancement Proposals; PEP 657 <2>: Library<29>. (line 223) +* Python Enhancement Proposals; PEP 657 <3>: Core and Builtins<37>. + (line 337) +* Python Enhancement Proposals; PEP 659: PEP 659 Specializing Adaptive Interpreter. + (line 6) +* Python Enhancement Proposals; PEP 659 <1>: PEP 659 Specializing Adaptive Interpreter. + (line 30) +* Python Enhancement Proposals; PEP 659 <2>: Single-threaded performance. + (line 10) +* Python Enhancement Proposals; PEP 667: Summary – Release Highlights. + (line 40) +* Python Enhancement Proposals; PEP 667 <1>: Defined mutation semantics for locals. + (line 8) +* Python Enhancement Proposals; PEP 667 <2>: Defined mutation semantics for locals. + (line 41) +* Python Enhancement Proposals; PEP 667 <3>: Deprecated C APIs. + (line 33) +* Python Enhancement Proposals; PEP 667 <4>: Changes in the Python API. + (line 17) +* Python Enhancement Proposals; PEP 667 <5>: Changes in the Python API. + (line 26) +* Python Enhancement Proposals; PEP 667 <6>: Changes in the Python API. + (line 32) +* Python Enhancement Proposals; PEP 667 <7>: Built-in Functions. + (line 1153) +* Python Enhancement Proposals; PEP 667 <8>: pdb — The Python Debugger. + (line 128) +* Python Enhancement Proposals; PEP 667 <9>: Reflection. (line 44) +* Python Enhancement Proposals; PEP 667 <10>: Frame Objects. (line 130) +* Python Enhancement Proposals; PEP 667 <11>: Frame Locals Proxies. + (line 14) +* Python Enhancement Proposals; PEP 669: Summary – Release Highlights. + (line 110) +* Python Enhancement Proposals; PEP 669 <1>: New Features<2>. + (line 6) +* Python Enhancement Proposals; PEP 669 <2>: PEP 669 Low impact monitoring for CPython. + (line 6) +* Python Enhancement Proposals; PEP 669 <3>: Core and Builtins<22>. + (line 203) +* Python Enhancement Proposals; PEP 670: Summary – Release highlights<2>. + (line 51) +* Python Enhancement Proposals; PEP 670 <1>: Porting to Python 3 11<2>. + (line 12) +* Python Enhancement Proposals; PEP 673: PEP 673 Self type. (line 32) +* Python Enhancement Proposals; PEP 673 <1>: Library<31>. (line 134) +* Python Enhancement Proposals; PEP 673 <2>: Special types. (line 194) +* Python Enhancement Proposals; PEP 675: PEP 675 Arbitrary literal string type. + (line 32) +* Python Enhancement Proposals; PEP 675 <1>: Library<30>. (line 59) +* Python Enhancement Proposals; PEP 675 <2>: Special types. (line 95) +* Python Enhancement Proposals; PEP 676: Documentation<25>. (line 8) +* Python Enhancement Proposals; PEP 678: Other Language Changes<2>. + (line 36) +* Python Enhancement Proposals; PEP 678 <1>: PEP 678 Exceptions can be enriched with notes. + (line 11) +* Python Enhancement Proposals; PEP 678 <2>: Core and Builtins<22>. + (line 183) +* Python Enhancement Proposals; PEP 678 <3>: Core and Builtins<23>. + (line 57) +* Python Enhancement Proposals; PEP 678 <4>: Core and Builtins<30>. + (line 118) +* Python Enhancement Proposals; PEP 680: Summary – Release highlights<2>. + (line 20) +* Python Enhancement Proposals; PEP 680 <1>: New Modules<3>. (line 6) +* Python Enhancement Proposals; PEP 680 <2>: Library<30>. (line 205) +* Python Enhancement Proposals; PEP 681: PEP 681 Data class transforms. + (line 30) +* Python Enhancement Proposals; PEP 681 <1>: Library<29>. (line 110) +* Python Enhancement Proposals; PEP 681 <2>: Functions and decorators. + (line 243) +* Python Enhancement Proposals; PEP 682: Other Language Changes<3>. + (line 49) +* Python Enhancement Proposals; PEP 682 <1>: Format Specification Mini-Language. + (line 94) +* Python Enhancement Proposals; PEP 683: New Features<4>. (line 147) +* Python Enhancement Proposals; PEP 683 <1>: Core and Builtins<22>. + (line 73) +* Python Enhancement Proposals; PEP 683 <2>: Reference Counting. + (line 122) +* Python Enhancement Proposals; PEP 683 <3>: Glossary. (line 734) +* Python Enhancement Proposals; PEP 684: PEP 684 A Per-Interpreter GIL. + (line 6) +* Python Enhancement Proposals; PEP 684 <1>: New Features<4>. + (line 182) +* Python Enhancement Proposals; PEP 686: Python UTF-8 Mode. (line 71) +* Python Enhancement Proposals; PEP 686 <1>: Text Encoding. (line 32) +* Python Enhancement Proposals; PEP 687: Library<16>. (line 137) +* Python Enhancement Proposals; PEP 687 <1>: Core and Builtins<21>. + (line 326) +* Python Enhancement Proposals; PEP 687 <2>: Library<21>. (line 290) +* Python Enhancement Proposals; PEP 687 <3>: Library<21>. (line 297) +* Python Enhancement Proposals; PEP 687 <4>: Library<21>. (line 330) +* Python Enhancement Proposals; PEP 687 <5>: Library<21>. (line 333) +* Python Enhancement Proposals; PEP 687 <6>: Library<21>. (line 343) +* Python Enhancement Proposals; PEP 687 <7>: Library<21>. (line 400) +* Python Enhancement Proposals; PEP 687 <8>: Core and Builtins<23>. + (line 78) +* Python Enhancement Proposals; PEP 687 <9>: Library<23>. (line 111) +* Python Enhancement Proposals; PEP 687 <10>: Library<23>. (line 118) +* Python Enhancement Proposals; PEP 688: PEP 688 Making the buffer protocol accessible in Python. + (line 6) +* Python Enhancement Proposals; PEP 688 <1>: Core and Builtins<22>. + (line 211) +* Python Enhancement Proposals; PEP 688 <2>: Emulating buffer types. + (line 39) +* Python Enhancement Proposals; PEP 688 <3>: Collections Abstract Base Classes – Detailed Descriptions. + (line 176) +* Python Enhancement Proposals; PEP 689: C API<21>. (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>: Library<21>. (line 117) +* Python Enhancement Proposals; PEP 692 <3>: Documentation<16>. + (line 11) +* Python Enhancement Proposals; PEP 692 <4>: Special forms. (line 625) +* Python Enhancement Proposals; PEP 693: What’s New In Python 3 12. + (line 16) +* Python Enhancement Proposals; PEP 695: PEP 695 Type Parameter Syntax. + (line 10) +* Python Enhancement Proposals; PEP 695 <1>: PEP 695 Type Parameter Syntax. + (line 61) +* Python Enhancement Proposals; PEP 695 <2>: CPython bytecode changes. + (line 41) +* Python Enhancement Proposals; PEP 695 <3>: Library<12>. (line 76) +* Python Enhancement Proposals; PEP 695 <4>: Library<14>. (line 123) +* Python Enhancement Proposals; PEP 695 <5>: Library<20>. (line 95) +* Python Enhancement Proposals; PEP 695 <6>: Library<20>. (line 661) +* Python Enhancement Proposals; PEP 695 <7>: Library<20>. (line 856) +* Python Enhancement Proposals; PEP 695 <8>: Library<20>. (line 949) +* Python Enhancement Proposals; PEP 695 <9>: Core and Builtins<22>. + (line 13) +* Python Enhancement Proposals; PEP 695 <10>: Core and Builtins<22>. + (line 108) +* Python Enhancement Proposals; PEP 695 <11>: Library<21>. (line 7) +* Python Enhancement Proposals; PEP 695 <12>: Annotation scopes. + (line 55) +* Python Enhancement Proposals; PEP 695 <13>: The type statement. + (line 40) +* Python Enhancement Proposals; PEP 695 <14>: Special types. (line 60) +* Python Enhancement Proposals; PEP 695 <15>: Building generic types and type aliases. + (line 113) +* Python Enhancement Proposals; PEP 695 <16>: Building generic types and type aliases. + (line 212) +* Python Enhancement Proposals; PEP 695 <17>: Building generic types and type aliases. + (line 346) +* Python Enhancement Proposals; PEP 695 <18>: Building generic types and type aliases. + (line 453) +* Python Enhancement Proposals; PEP 695 <19>: Deprecation Timeline of Major Features. + (line 30) +* Python Enhancement Proposals; PEP 696: Summary – Release Highlights. + (line 115) +* Python Enhancement Proposals; PEP 696 <1>: Core and Builtins<15>. + (line 190) +* Python Enhancement Proposals; PEP 696 <2>: Annotation scopes. + (line 58) +* Python Enhancement Proposals; PEP 696 <3>: Type parameter lists. + (line 8) +* Python Enhancement Proposals; PEP 697: New Features<4>. (line 6) +* Python Enhancement Proposals; PEP 697 <1>: New Features<4>. + (line 33) +* Python Enhancement Proposals; PEP 697 <2>: C API<19>. (line 38) +* Python Enhancement Proposals; PEP 698: PEP 698 Override Decorator for Static Typing. + (line 30) +* Python Enhancement Proposals; PEP 698 <1>: Library<23>. (line 100) +* Python Enhancement Proposals; PEP 698 <2>: Functions and decorators. + (line 407) +* Python Enhancement Proposals; PEP 699: Pending Removal in Python 3 14<2>. + (line 7) +* Python Enhancement Proposals; PEP 699 <1>: Deprecated<2>. (line 6) +* Python Enhancement Proposals; PEP 699 <2>: Pending Removal in Python 3 14<4>. + (line 7) +* Python Enhancement Proposals; PEP 699 <3>: Build<22>. (line 15) +* Python Enhancement Proposals; PEP 699 <4>: Pending Removal in Python 3 14<6>. + (line 7) +* Python Enhancement Proposals; PEP 7: Build and C API Changes<2>. + (line 9) +* Python Enhancement Proposals; PEP 7 <1>: Build Requirements. + (line 51) +* Python Enhancement Proposals; PEP 7 <2>: Coding standards. (line 7) +* Python Enhancement Proposals; PEP 7 <3>: Useful macros. (line 162) +* Python Enhancement Proposals; PEP 7 <4>: Useful macros. (line 180) +* Python Enhancement Proposals; PEP 701: PEP 701 Syntactic formalization of f-strings. + (line 6) +* Python Enhancement Proposals; PEP 701 <1>: PEP 701 Syntactic formalization of f-strings. + (line 66) +* Python Enhancement Proposals; PEP 701 <2>: tokenize. (line 6) +* Python Enhancement Proposals; PEP 701 <3>: Optimizations<2>. + (line 26) +* Python Enhancement Proposals; PEP 701 <4>: Changes in the Python API<2>. + (line 76) +* Python Enhancement Proposals; PEP 701 <5>: Changes in the Python API<2>. + (line 78) +* Python Enhancement Proposals; PEP 701 <6>: Changes in the Python API<2>. + (line 100) +* Python Enhancement Proposals; PEP 702: Summary – Release Highlights. + (line 119) +* Python Enhancement Proposals; PEP 702 <1>: warnings. (line 6) +* Python Enhancement Proposals; PEP 702 <2>: Library<18>. (line 469) +* Python Enhancement Proposals; PEP 702 <3>: Available Functions. + (line 182) +* Python Enhancement Proposals; PEP 703: Summary – Release Highlights. + (line 10) +* Python Enhancement Proposals; PEP 703 <1>: Summary – Release Highlights. + (line 46) +* Python Enhancement Proposals; PEP 703 <2>: Free-threaded CPython. + (line 54) +* Python Enhancement Proposals; PEP 703 <3>: Core and Builtins<17>. + (line 11) +* Python Enhancement Proposals; PEP 703 <4>: C API<17>. (line 137) +* Python Enhancement Proposals; PEP 703 <5>: Installing Free-threaded Binaries. + (line 11) +* Python Enhancement Proposals; PEP 703 <6>: Installing Free-threaded Binaries<2>. + (line 12) +* Python Enhancement Proposals; PEP 703 <7>: GIL and performance considerations. + (line 16) +* Python Enhancement Proposals; PEP 703 <8>: Python experimental support for free threading. + (line 25) +* Python Enhancement Proposals; PEP 703 <9>: Can’t we get rid of the Global Interpreter Lock?. + (line 12) +* Python Enhancement Proposals; PEP 703 <10>: Glossary. (line 560) +* Python Enhancement Proposals; PEP 703 <11>: Glossary. (line 696) +* Python Enhancement Proposals; PEP 705: Summary – Release Highlights. + (line 123) +* Python Enhancement Proposals; PEP 705 <1>: typing. (line 6) +* Python Enhancement Proposals; PEP 705 <2>: Library<16>. (line 17) +* Python Enhancement Proposals; PEP 705 <3>: Special forms. (line 286) +* Python Enhancement Proposals; PEP 706: Other Language Changes<2>. + (line 78) +* Python Enhancement Proposals; PEP 706 <1>: tarfile<2>. (line 13) +* Python Enhancement Proposals; PEP 706 <2>: tarfile<3>. (line 13) +* Python Enhancement Proposals; PEP 706 <3>: tarfile<4>. (line 13) +* Python Enhancement Proposals; PEP 706 <4>: tarfile<6>. (line 13) +* Python Enhancement Proposals; PEP 706 <5>: Extraction filters. + (line 22) +* Python Enhancement Proposals; PEP 709: Changes in the Python API. + (line 26) +* Python Enhancement Proposals; PEP 709 <1>: PEP 709 Comprehension inlining. + (line 9) +* Python Enhancement Proposals; PEP 709 <2>: PEP 709 Comprehension inlining. + (line 35) +* Python Enhancement Proposals; PEP 709 <3>: CPython bytecode changes. + (line 33) +* Python Enhancement Proposals; PEP 709 <4>: Core and Builtins<22>. + (line 213) +* Python Enhancement Proposals; PEP 709 <5>: Built-in Functions. + (line 1151) +* Python Enhancement Proposals; PEP 719: What’s New In Python 3 13. + (line 16) +* Python Enhancement Proposals; PEP 730: Summary – Release Highlights. + (line 133) +* 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: Library<14>. (line 161) +* Python Enhancement Proposals; PEP 737: Changed C APIs. (line 44) +* Python Enhancement Proposals; PEP 737 <1>: C API<13>. (line 6) +* Python Enhancement Proposals; PEP 737 <2>: C API<13>. (line 49) +* Python Enhancement Proposals; PEP 738: Summary – Release Highlights. + (line 136) +* 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>: Library<14>. (line 54) +* Python Enhancement Proposals; PEP 742: Summary – Release Highlights. + (line 127) +* Python Enhancement Proposals; PEP 742 <1>: typing. (line 9) +* Python Enhancement Proposals; PEP 742 <2>: Library<14>. (line 239) +* Python Enhancement Proposals; PEP 742 <3>: Special forms. (line 523) +* Python Enhancement Proposals; PEP 744: Summary – Release Highlights. + (line 11) +* Python Enhancement Proposals; PEP 744 <1>: Summary – Release Highlights. + (line 50) +* Python Enhancement Proposals; PEP 744 <2>: An experimental just-in-time JIT compiler. + (line 62) +* Python Enhancement Proposals; PEP 8: Library Changes. (line 26) +* Python Enhancement Proposals; PEP 8 <1>: Library<65>. (line 124) +* Python Enhancement Proposals; PEP 8 <2>: IDLE<65>. (line 81) +* Python Enhancement Proposals; PEP 8 <3>: Intermezzo Coding Style. + (line 13) +* Python Enhancement Proposals; PEP 8 <4>: Editors and IDEs. (line 7) +* Python Enhancement Proposals; PEP 8 <5>: Value comparisons. + (line 61) +* Python Enhancement Proposals; PEP 8 <6>: Built-in Functions. + (line 1835) +* Python Enhancement Proposals; PEP 8 <7>: Odds and Ends<2>. (line 35) +* Python Enhancement Proposals; PEP 8 <8>: Are there coding standards or a style guide for Python programs?. + (line 7) +* Python Enhancement Proposals; PEP 8 <9>: When can I rely on identity tests with the is operator?. + (line 59) +* Python Enhancement Proposals; PEP 8 <10>: How do I keep editors from inserting tabs into my Python source?. + (line 6) +* PYTHON_BASIC_REPL: A better interactive interpreter. + (line 27) +* PYTHON_BASIC_REPL <1>: Library<7>. (line 322) +* PYTHON_BASIC_REPL <2>: Library<7>. (line 326) +* PYTHON_BASIC_REPL <3>: Core and Builtins<13>. + (line 55) +* PYTHON_BASIC_REPL <4>: Interactive Mode<2>. + (line 23) +* python_branch() (in module platform): Cross platform. (line 85) +* python_build() (in module platform): Cross platform. (line 75) +* PYTHON_COLORS: Summary – Release Highlights. + (line 57) +* PYTHON_COLORS <1>: Improved error messages. + (line 8) +* PYTHON_COLORS <2>: doctest. (line 7) +* PYTHON_COLORS <3>: Controlling color. (line 22) +* python_compiler() (in module platform): Cross platform. (line 80) +* PYTHON_CPU_COUNT: os. (line 11) +* PYTHON_CPU_COUNT <1>: Miscellaneous options. + (line 375) +* PYTHON_CPU_COUNT <2>: Miscellaneous System Information. + (line 48) +* PYTHON_CPU_COUNT <3>: Miscellaneous System Information. + (line 69) +* PYTHON_CPU_COUNT <4>: Miscellaneous<3>. (line 31) +* PYTHON_CPU_COUNT <5>: PyConfig. (line 497) +* PYTHON_DOM: Module Contents<4>. (line 23) +* PYTHON_FROZEN_MODULES: Other Language Changes. + (line 46) +* PYTHON_FROZEN_MODULES <1>: Core and Builtins<20>. + (line 105) +* PYTHON_FROZEN_MODULES <2>: Miscellaneous options. + (line 346) +* PYTHON_GIL: Free-threaded CPython. + (line 22) +* PYTHON_GIL <1>: Free-threaded CPython. + (line 38) +* PYTHON_GIL <2>: Core and Builtins<10>. + (line 40) +* PYTHON_GIL <3>: Miscellaneous options. + (line 393) +* PYTHON_GIL <4>: The global interpreter lock in free-threaded Python. + (line 7) +* PYTHON_GIL <5>: Glossary. (line 693) +* PYTHON_HISTORY: Other Language Changes. + (line 57) +* PYTHON_HISTORY <1>: Library<18>. (line 544) +* python_implementation() (in module platform): Cross platform. + (line 89) +* python_is_optimized() (in module test.support): test support — Utilities for the Python test suite. + (line 251) +* PYTHON_JIT: An experimental just-in-time JIT compiler. + (line 21) +* PYTHON_JIT <1>: An experimental just-in-time JIT compiler. + (line 24) +* PYTHON_JIT <2>: An experimental just-in-time JIT compiler. + (line 28) +* PYTHON_PERF_JIT_SUPPORT: Other Language Changes. + (line 52) +* PYTHON_PERF_JIT_SUPPORT <1>: Miscellaneous options. + (line 365) +* PYTHON_PERF_JIT_SUPPORT <2>: PyConfig. (line 876) +* PYTHON_PERF_JIT_SUPPORT <3>: PyConfig. (line 879) +* PYTHON_PERF_JIT_SUPPORT <4>: How to work without frame pointers. + (line 14) +* PYTHON_PRESITE: Miscellaneous options. + (line 387) +* PYTHON_PRESITE <1>: PyConfig. (line 776) +* PYTHON_PRESITE=package.module: Core and Builtins<20>. + (line 154) +* python_revision() (in module platform): Cross platform. (line 94) +* python_version_tuple() (in module platform): Cross platform. + (line 106) +* python_version() (in module platform): Cross platform. (line 99) +* python-m-py_compile command line option; -: Command-Line Interface<6>. + (line 13) +* python-m-py_compile command line option; -q: Command-Line Interface<6>. + (line 19) +* python-m-py_compile command line option; -quiet: Command-Line Interface<6>. + (line 19) +* python-m-py_compile command line option; : Command-Line Interface<6>. + (line 13) +* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -h: Command-line interface. + (line 14) +* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -help: Command-line interface. + (line 14) +* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -v: Command-line interface. + (line 18) +* python-m-sqlite3-[-h]-[-v]-[filename]-[sql] command line option; -version: Command-line interface. + (line 18) +* PYTHONASYNCIODEBUG: Enabling debug mode. + (line 10) +* PYTHONASYNCIODEBUG <1>: Debug Mode. (line 11) +* PYTHONASYNCIODEBUG <2>: Effects of the Python Development Mode. + (line 65) +* PYTHONBREAKPOINT: PEP 553 Built-in breakpoint. + (line 13) +* PYTHONBREAKPOINT <1>: Built-in Functions. (line 159) +* PYTHONBREAKPOINT <2>: sys — System-specific parameters and functions. + (line 257) +* PYTHONBREAKPOINT <3>: sys — System-specific parameters and functions. + (line 271) +* PYTHONBREAKPOINT <4>: sys — System-specific parameters and functions. + (line 275) +* PYTHONCASEOK: Changes in the Python API<4>. + (line 29) +* PYTHONCASEOK <1>: PEP 235 Importing Modules on Case-Insensitive Platforms. + (line 17) +* PYTHONCASEOK <2>: Library<47>. (line 144) +* PYTHONCASEOK <3>: Built-in Functions. (line 2249) +* PYTHONCOERCECLOCALE: PEP 538 Legacy C Locale Coercion. + (line 13) +* PYTHONCOERCECLOCALE <1>: General Options. (line 88) +* PYTHONCOERCECLOCALE <2>: Python UTF-8 Mode. (line 57) +* PYTHONCOERCECLOCALE <3>: Python Configuration. + (line 15) +* PYTHONDEBUG: Miscellaneous options. + (line 37) +* PYTHONDEBUG <1>: Python Debug Build. (line 20) +* PYTHONDEBUG <2>: Global configuration variables. + (line 38) +* PYTHONDEBUG <3>: PyConfig. (line 667) +* PYTHONDEVMODE: Python Development Mode -X dev. + (line 6) +* PYTHONDEVMODE <1>: Miscellaneous options. + (line 305) +* PYTHONDEVMODE <2>: Python Development Mode. + (line 14) +* PYTHONDEVMODE <3>: PyConfig. (line 296) +* PYTHONDONTWRITEBYTECODE: Interpreter Changes<2>. + (line 16) +* PYTHONDONTWRITEBYTECODE <1>: New and Improved Modules<2>. + (line 626) +* PYTHONDONTWRITEBYTECODE <2>: Miscellaneous options. + (line 19) +* PYTHONDONTWRITEBYTECODE <3>: sys — System-specific parameters and functions. + (line 341) +* PYTHONDONTWRITEBYTECODE <4>: Global configuration variables. + (line 52) +* PYTHONDONTWRITEBYTECODE <5>: PyConfig. (line 953) +* PYTHONDONTWRITEBYTECODE <6>: How do I create a pyc file?. + (line 21) +* PYTHONDUMPREFS: Debug build uses the same ABI as release build. + (line 15) +* PYTHONDUMPREFS <1>: Build<51>. (line 54) +* PYTHONDUMPREFS <2>: Debug options. (line 22) +* PYTHONDUMPREFS <3>: Debug options. (line 24) +* PYTHONDUMPREFS <4>: PyConfig. (line 307) +* PYTHONDUMPREFSFILE: Core and Builtins<37>. + (line 154) +* PYTHONEXECUTABLE: PyConfig. (line 702) +* PYTHONFAULTHANDLER: faulthandler<4>. (line 11) +* PYTHONFAULTHANDLER <1>: Miscellaneous options. + (line 267) +* PYTHONFAULTHANDLER <2>: Effects of the Python Development Mode. + (line 59) +* PYTHONFAULTHANDLER <3>: faulthandler — Dump the Python traceback. + (line 15) +* PYTHONFAULTHANDLER <4>: PyConfig. (line 345) +* PythonFinalizationError: Concrete exceptions. + (line 225) +* PYTHONHASHSEED: Builtin functions and types. + (line 17) +* PYTHONHASHSEED <1>: Porting Python code. + (line 6) +* PYTHONHASHSEED <2>: Core and Builtins<64>. + (line 30) +* PYTHONHASHSEED <3>: Miscellaneous options. + (line 130) +* PYTHONHASHSEED <4>: Miscellaneous options. + (line 146) +* PYTHONHASHSEED <5>: Environment variables. + (line 156) +* PYTHONHASHSEED <6>: Basic customization. + (line 316) +* PYTHONHASHSEED <7>: Global configuration variables. + (line 77) +* PYTHONHASHSEED <8>: Global configuration variables. + (line 80) +* PYTHONHASHSEED <9>: PyConfig. (line 415) +* PYTHONHOME: Deprecated C APIs. (line 26) +* PYTHONHOME <1>: Pending Removal in Python 3 15<2>. + (line 36) +* PYTHONHOME <2>: Pending Removal in Python 3 15<4>. + (line 36) +* PYTHONHOME <3>: Summary – Release highlights<6>. + (line 107) +* PYTHONHOME <4>: Miscellaneous options. + (line 46) +* PYTHONHOME <5>: Environment variables. + (line 19) +* PYTHONHOME <6>: Environment variables. + (line 21) +* PYTHONHOME <7>: Environment variables. + (line 38) +* PYTHONHOME <8>: Finding modules. (line 29) +* PYTHONHOME <9>: Finding modules. (line 47) +* PYTHONHOME <10>: Finding modules. (line 81) +* PYTHONHOME <11>: Adding Python to an iOS project. + (line 149) +* PYTHONHOME <12>: test support script_helper — Utilities for the Python execution tests. + (line 25) +* PYTHONHOME <13>: The initialization of the sys path module search path. + (line 30) +* PYTHONHOME <14>: Virtual environments<2>. + (line 14) +* PYTHONHOME <15>: Embedding Python<2>. + (line 38) +* PYTHONHOME <16>: Embedding Python<2>. + (line 44) +* PYTHONHOME <17>: Global configuration variables. + (line 92) +* PYTHONHOME <18>: Process-wide parameters. + (line 295) +* PYTHONHOME <19>: Process-wide parameters. + (line 311) +* PYTHONHOME <20>: Process-wide parameters. + (line 320) +* PYTHONHOME <21>: PyConfig. (line 423) +* PYTHONHOME <22>: PyConfig. (line 425) +* PYTHONHOME <23>: Pending Removal in Python 3 15<6>. + (line 36) +* Pythonic: Glossary. (line 1268) +* PYTHONINSPECT: Other Changes and Fixes<2>. + (line 13) +* PYTHONINSPECT <1>: Miscellaneous options. + (line 68) +* PYTHONINSPECT <2>: Global configuration variables. + (line 109) +* PYTHONINSPECT <3>: PyConfig. (line 450) +* PYTHONINTMAXSTRDIGITS: Core and Builtins<29>. + (line 106) +* PYTHONINTMAXSTRDIGITS <1>: Miscellaneous options. + (line 289) +* PYTHONINTMAXSTRDIGITS <2>: Configuring the limit. + (line 9) +* PYTHONINTMAXSTRDIGITS <3>: Configuring the limit. + (line 16) +* PYTHONINTMAXSTRDIGITS <4>: sys — System-specific parameters and functions. + (line 1163) +* PYTHONINTMAXSTRDIGITS <5>: PyConfig. (line 481) +* PYTHONIOENCODING: Other Improvements<2>. + (line 75) +* PYTHONIOENCODING <1>: Interpreter Changes<2>. + (line 23) +* PYTHONIOENCODING <2>: Environment variables. + (line 402) +* PYTHONIOENCODING <3>: Python UTF-8 Mode. (line 29) +* PYTHONIOENCODING <4>: sys — System-specific parameters and functions. + (line 1848) +* PYTHONIOENCODING <5>: PyConfig. (line 836) +* PYTHONLEGACYWINDOWSFSENCODING: New Deprecations. (line 130) +* PYTHONLEGACYWINDOWSFSENCODING <1>: Pending removal in Python 3 16. + (line 50) +* PYTHONLEGACYWINDOWSFSENCODING <2>: Pending removal in Python 3 16<3>. + (line 50) +* PYTHONLEGACYWINDOWSFSENCODING <3>: PEP 529 Change Windows filesystem encoding to UTF-8. + (line 18) +* PYTHONLEGACYWINDOWSFSENCODING <4>: Windows<14>. (line 37) +* PYTHONLEGACYWINDOWSFSENCODING <5>: sys — System-specific parameters and functions. + (line 1788) +* PYTHONLEGACYWINDOWSFSENCODING <6>: sys — System-specific parameters and functions. + (line 1799) +* PYTHONLEGACYWINDOWSFSENCODING <7>: sys — System-specific parameters and functions. + (line 1805) +* PYTHONLEGACYWINDOWSFSENCODING <8>: Global configuration variables. + (line 151) +* PYTHONLEGACYWINDOWSFSENCODING <9>: PyPreConfig. (line 123) +* PYTHONLEGACYWINDOWSFSENCODING <10>: Pending removal in Python 3 16<5>. + (line 50) +* PYTHONLEGACYWINDOWSSTDIO: PEP 528 Change Windows console encoding to UTF-8. + (line 12) +* PYTHONLEGACYWINDOWSSTDIO <1>: Environment variables. + (line 191) +* PYTHONLEGACYWINDOWSSTDIO <2>: sys — System-specific parameters and functions. + (line 1852) +* PYTHONLEGACYWINDOWSSTDIO <3>: Global configuration variables. + (line 169) +* PYTHONLEGACYWINDOWSSTDIO <4>: PyConfig. (line 534) +* PYTHONMALLOC: PYTHONMALLOC environment variable. + (line 6) +* PYTHONMALLOC <1>: Changes in the C API<6>. + (line 9) +* PYTHONMALLOC <2>: Core and Builtins<84>. + (line 90) +* PYTHONMALLOC <3>: Environment variables. + (line 329) +* PYTHONMALLOC <4>: Performance options. + (line 109) +* PYTHONMALLOC <5>: Performance options. + (line 116) +* PYTHONMALLOC <6>: Effects of the Python Development Mode. + (line 46) +* PYTHONMALLOC <7>: Effects of the Python Development Mode. + (line 50) +* PYTHONMALLOC <8>: Overview<4>. (line 75) +* PYTHONMALLOC <9>: Default Memory Allocators. + (line 26) +* PYTHONMALLOC <10>: Debug hooks on the Python memory allocators. + (line 11) +* PYTHONMALLOC <11>: The pymalloc allocator. + (line 27) +* PYTHONMALLOCSTATS: Core and Builtins<84>. + (line 96) +* PYTHONMALLOCSTATS <1>: PyConfig. (line 550) +* PYTHONMALLOCSTATS <2>: Overview<4>. (line 78) +* PYTHONNODEBUGRANGES: PEP 657 Fine-grained error locations in tracebacks. + (line 63) +* PYTHONNODEBUGRANGES <1>: Miscellaneous options. + (line 334) +* PYTHONNODEBUGRANGES <2>: Methods on code objects. + (line 40) +* PYTHONNODEBUGRANGES <3>: PyConfig. (line 249) +* PYTHONNOUSERSITE: PEP 370 Per-user site-packages Directory. + (line 30) +* PYTHONNOUSERSITE <1>: Miscellaneous options. + (line 158) +* PYTHONNOUSERSITE <2>: Module contents<5>. (line 15) +* PYTHONNOUSERSITE <3>: Global configuration variables. + (line 203) +* PYTHONNOUSERSITE <4>: PyConfig. (line 906) +* PYTHONOPTIMIZE: Miscellaneous options. + (line 88) +* PYTHONOPTIMIZE <1>: Global configuration variables. + (line 214) +* PYTHONOPTIMIZE <2>: PyConfig. (line 617) +* PYTHONPATH: Changes in ‘python’ Command Behavior<2>. + (line 8) +* PYTHONPATH <1>: Changes in ‘python’ Command Behavior<2>. + (line 9) +* PYTHONPATH <2>: The Module Search Path. + (line 16) +* PYTHONPATH <3>: Standard Modules. (line 34) +* PYTHONPATH <4>: Standard Modules. (line 35) +* PYTHONPATH <5>: Miscellaneous options. + (line 45) +* PYTHONPATH <6>: Environment variables. + (line 32) +* PYTHONPATH <7>: Environment variables. + (line 39) +* PYTHONPATH <8>: Environment variables. + (line 42) +* PYTHONPATH <9>: Excursus Setting environment variables. + (line 38) +* PYTHONPATH <10>: Finding modules. (line 15) +* PYTHONPATH <11>: Finding modules. (line 38) +* PYTHONPATH <12>: Finding modules. (line 81) +* PYTHONPATH <13>: Adding Python to an iOS project. + (line 152) +* PYTHONPATH <14>: Adding Python to an iOS project. + (line 183) +* PYTHONPATH <15>: Adding Python to an iOS project. + (line 189) +* PYTHONPATH <16>: Path entry finders. (line 6) +* PYTHONPATH <17>: Path entry finders. (line 23) +* PYTHONPATH <18>: test support script_helper — Utilities for the Python execution tests. + (line 26) +* PYTHONPATH <19>: sys — System-specific parameters and functions. + (line 1329) +* PYTHONPATH <20>: sys — System-specific parameters and functions. + (line 1334) +* PYTHONPATH <21>: The initialization of the sys path module search path. + (line 14) +* PYTHONPATH <22>: The initialization of the sys path module search path. + (line 18) +* PYTHONPATH <23>: Building C and C++ Extensions. + (line 9) +* PYTHONPATH <24>: Embedding Python<2>. + (line 39) +* PYTHONPATH <25>: Embedding Python<2>. + (line 45) +* PYTHONPATH <26>: Global configuration variables. + (line 91) +* PYTHONPATH <27>: PyConfig. (line 583) +* PYTHONPERFSUPPORT: Other Language Changes<2>. + (line 85) +* PYTHONPERFSUPPORT <1>: Miscellaneous options. + (line 354) +* PYTHONPERFSUPPORT <2>: How to enable perf profiling support. + (line 7) +* PYTHONPLATLIBDIR: Core and Builtins<45>. + (line 274) +* PYTHONPLATLIBDIR <1>: The initialization of the sys path module search path. + (line 51) +* PYTHONPLATLIBDIR <2>: PyConfig. (line 562) +* PYTHONPROFILEIMPORTTIME: Other Language Changes<7>. + (line 47) +* PYTHONPROFILEIMPORTTIME <1>: Core and Builtins<66>. + (line 66) +* PYTHONPROFILEIMPORTTIME <2>: Miscellaneous options. + (line 298) +* PYTHONPROFILEIMPORTTIME <3>: PyConfig. (line 435) +* PYTHONPYCACHEPREFIX: Parallel filesystem cache for compiled bytecode files. + (line 6) +* PYTHONPYCACHEPREFIX <1>: Core and Builtins<57>. + (line 402) +* PYTHONPYCACHEPREFIX <2>: Miscellaneous options. + (line 318) +* PYTHONPYCACHEPREFIX <3>: sys — System-specific parameters and functions. + (line 387) +* PYTHONPYCACHEPREFIX <4>: PyConfig. (line 724) +* PYTHONREGRTEST_UNICODE_GUARD: Tests<26>. (line 13) +* PYTHONSAFEPATH: Summary – Release highlights<2>. + (line 27) +* PYTHONSAFEPATH <1>: Other Language Changes<3>. + (line 37) +* PYTHONSAFEPATH <2>: Security<20>. (line 6) +* PYTHONSAFEPATH <3>: Miscellaneous options. + (line 116) +* PYTHONSAFEPATH <4>: sys — System-specific parameters and functions. + (line 1346) +* PYTHONSAFEPATH <5>: Security Considerations<3>. + (line 47) +* PYTHONSAFEPATH <6>: PyConfig. (line 166) +* PYTHONSTARTUP: sys<12>. (line 17) +* PYTHONSTARTUP <1>: sys<12>. (line 21) +* PYTHONSTARTUP <2>: IDLE<39>. (line 176) +* PYTHONSTARTUP <3>: IDLE<43>. (line 9) +* PYTHONSTARTUP <4>: IDLE<49>. (line 9) +* PYTHONSTARTUP <5>: The Interactive Startup File. + (line 8) +* PYTHONSTARTUP <6>: Miscellaneous options. + (line 64) +* PYTHONSTARTUP <7>: Environment variables. + (line 117) +* PYTHONSTARTUP <8>: Example. (line 10) +* PYTHONSTARTUP <9>: asyncio — Asynchronous I/O. + (line 87) +* PYTHONSTARTUP <10>: Startup and Code Execution. + (line 7) +* PYTHONSTARTUP <11>: Command line usage. (line 42) +* PYTHONSTARTUP <12>: sys — System-specific parameters and functions. + (line 1176) +* PYTHONSTARTUP <13>: Readline configuration. + (line 12) +* PYTHONTRACEMALLOC: Miscellaneous options. + (line 284) +* PYTHONTRACEMALLOC <1>: tracemalloc — Trace memory allocations. + (line 25) +* PYTHONTRACEMALLOC <2>: tracemalloc — Trace memory allocations. + (line 32) +* PYTHONTRACEMALLOC <3>: Functions<11>. (line 90) +* PYTHONTRACEMALLOC <4>: PyConfig. (line 864) +* PYTHONTZPATH: Exceptions and warnings. + (line 14) +* PYTHONUNBUFFERED: Core and Builtins<50>. + (line 107) +* PYTHONUNBUFFERED <1>: Miscellaneous options. + (line 178) +* PYTHONUNBUFFERED <2>: sys — System-specific parameters and functions. + (line 1859) +* PYTHONUNBUFFERED <3>: Global configuration variables. + (line 242) +* PYTHONUNBUFFERED <4>: PyConfig. (line 213) +* PYTHONUOPS: Core and Builtins<21>. + (line 27) +* PYTHONUOPS <1>: Core and Builtins<21>. + (line 179) +* PYTHONUOPS <2>: Core and Builtins<21>. + (line 258) +* PYTHONUOPS <3>: Core and Builtins<21>. + (line 317) +* PYTHONUOPS <4>: Core and Builtins<21>. + (line 382) +* PYTHONUSERBASE: PEP 370 Per-user site-packages Directory. + (line 23) +* PYTHONUSERBASE <1>: Module contents<5>. (line 40) +* PYTHONUSERBASE <2>: Module contents<5>. (line 68) +* PYTHONUSERSITE: test support script_helper — Utilities for the Python execution tests. + (line 26) +* PYTHONUTF8: PEP 540 Forced UTF-8 Runtime Mode. + (line 6) +* PYTHONUTF8 <1>: Miscellaneous options. + (line 312) +* PYTHONUTF8 <2>: Environment variables. + (line 412) +* PYTHONUTF8 <3>: UTF-8 mode. (line 18) +* PYTHONUTF8 <4>: Python UTF-8 Mode. (line 52) +* PYTHONUTF8 <5>: Python UTF-8 Mode. (line 54) +* PYTHONUTF8 <6>: sys — System-specific parameters and functions. + (line 1850) +* PYTHONUTF8 <7>: PyPreConfig. (line 152) +* PYTHONUTF8 <8>: Python Configuration. + (line 14) +* PYTHONVERBOSE: Miscellaneous options. + (line 194) +* PYTHONVERBOSE <1>: Global configuration variables. + (line 259) +* PYTHONVERBOSE <2>: PyConfig. (line 923) +* PYTHONWARNDEFAULTENCODING: Optional EncodingWarning and encoding="locale" option. + (line 19) +* PYTHONWARNDEFAULTENCODING <1>: Library<38>. (line 45) +* PYTHONWARNDEFAULTENCODING <2>: Miscellaneous options. + (line 324) +* PYTHONWARNDEFAULTENCODING <3>: Opt-in EncodingWarning. + (line 9) +* PYTHONWARNINGS: warnings<3>. (line 21) +* PYTHONWARNINGS <1>: Other Language Changes<12>. + (line 160) +* PYTHONWARNINGS <2>: Changes to the Handling of Deprecation Warnings. + (line 25) +* PYTHONWARNINGS <3>: Interpreter Changes. + (line 6) +* PYTHONWARNINGS <4>: Documentation<23>. (line 67) +* PYTHONWARNINGS <5>: Miscellaneous options. + (line 248) +* PYTHONWARNINGS <6>: Effects of the Python Development Mode. + (line 30) +* PYTHONWARNINGS <7>: The Warnings Filter. + (line 46) +* PYTHONWARNINGS <8>: The Warnings Filter. + (line 56) +* PYTHONWARNINGS <9>: Describing Warning Filters. + (line 7) +* PYTHONWARNINGS <10>: Describing Warning Filters. + (line 21) +* PYTHONWARNINGS <11>: Default Warning Filter. + (line 7) +* PYTHONWARNINGS <12>: PyConfig. (line 942) +* PyThread_create_key (C function): Thread Local Storage TLS API. + (line 18) +* PyThread_delete_key (C function): Thread Local Storage TLS API. + (line 21) +* PyThread_delete_key_value (C function): Thread Local Storage TLS API. + (line 30) +* PyThread_get_key_value (C function): Thread Local Storage TLS API. + (line 27) +* PyThread_ReInitTLS (C function): Thread Local Storage TLS API. + (line 33) +* PyThread_set_key_value (C function): Thread Local Storage TLS API. + (line 24) +* PyThread_tss_alloc (C function): Dynamic Allocation. (line 11) +* PyThread_tss_create (C function): Methods<2>. (line 16) +* PyThread_tss_delete (C function): Methods<2>. (line 24) +* PyThread_tss_free (C function): Dynamic Allocation. (line 17) +* PyThread_tss_get (C function): Methods<2>. (line 39) +* PyThread_tss_is_created (C function): Methods<2>. (line 11) +* PyThread_tss_set (C function): Methods<2>. (line 33) +* PyThreadState (C type): Thread State and the Global Interpreter Lock. + (line 23) +* PyThreadState (C type) <1>: High-level API. (line 21) +* PyThreadState_Clear (C function): Low-level API. (line 44) +* PyThreadState_Delete (C function): Low-level API. (line 55) +* PyThreadState_DeleteCurrent (C function): Low-level API. (line 61) +* PyThreadState_EnterTracing (C function): Low-level API. (line 99) +* PyThreadState_Get (C function): High-level API. (line 70) +* PyThreadState_GetDict (C function): Low-level API. (line 199) +* PyThreadState_GetFrame (C function): Low-level API. (line 68) +* PyThreadState_GetID (C function): Low-level API. (line 82) +* PyThreadState_GetInterpreter (C function): Low-level API. (line 90) +* PyThreadState_GetUnchecked (C function): High-level API. (line 78) +* PyThreadState_LeaveTracing (C function): Low-level API. (line 108) +* PyThreadState_New (C function): Low-level API. (line 37) +* PyThreadState_Next (C function): Advanced Debugger Support. + (line 32) +* PyThreadState_SetAsyncExc (C function): Low-level API. (line 208) +* PyThreadState_Swap (C function): High-level API. (line 87) +* PyThreadState.interp (C member): High-level API. (line 26) +* PyTime_AsSecondsDouble (C function): Conversion functions. + (line 6) +* PyTime_Check (C function): DateTime Objects<2>. + (line 97) +* PyTime_CheckExact (C function): DateTime Objects<2>. + (line 103) +* PyTime_FromTime (C function): DateTime Objects<2>. + (line 153) +* PyTime_FromTimeAndFold (C function): DateTime Objects<2>. + (line 158) +* PyTime_MAX (C var): Types<2>. (line 24) +* PyTime_MIN (C var): Types<2>. (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 21) +* PyTime_t (C type): Types<2>. (line 6) +* PyTime_Time (C function): Clock Functions. (line 31) +* PyTime_TimeRaw (C function): Raw Clock Functions. + (line 26) +* PyTimeZone_FromOffset (C function): DateTime Objects<2>. + (line 174) +* PyTimeZone_FromOffsetAndName (C function): DateTime Objects<2>. + (line 182) +* PyTrace_C_CALL (C var): Profiling and Tracing. + (line 94) +* PyTrace_C_EXCEPTION (C var): Profiling and Tracing. + (line 99) +* PyTrace_C_RETURN (C var): Profiling and Tracing. + (line 104) +* PyTrace_CALL (C var): Profiling and Tracing. + (line 62) +* PyTrace_EXCEPTION (C var): Profiling and Tracing. + (line 70) +* PyTrace_LINE (C var): Profiling and Tracing. + (line 82) +* PyTrace_OPCODE (C var): Profiling and Tracing. + (line 109) +* PyTrace_RETURN (C var): Profiling and Tracing. + (line 89) +* PyTraceMalloc_Track (C function): tracemalloc C API. (line 8) +* PyTraceMalloc_Untrack (C function): tracemalloc C API. (line 20) +* PyTuple_Check (C function): Tuple Objects. (line 16) +* PyTuple_CheckExact (C function): Tuple Objects. (line 21) +* PyTuple_GET_ITEM (C function): Tuple Objects. (line 61) +* PyTuple_GET_SIZE (C function): Tuple Objects. (line 44) +* PyTuple_GetItem (C function): Tuple Objects. (line 48) +* PyTuple_GetSlice (C function): Tuple Objects. (line 66) +* PyTuple_New (C function): Tuple Objects. (line 26) +* PyTuple_Pack (C function): Tuple Objects. (line 31) +* PyTuple_SET_ITEM (C function): Tuple Objects. (line 86) +* PyTuple_SetItem (C function): Reference Count Details. + (line 26) +* PyTuple_SetItem (C function) <1>: Tuple Objects. (line 75) +* PyTuple_Size (C function): Tuple Objects. (line 39) +* PyTuple_Type (C var): Tuple Objects. (line 11) +* PyTupleObject (C type): Tuple Objects. (line 6) +* PyType_AddWatcher (C function): Type Objects<2>. (line 67) +* PyType_Check (C function): Type Objects<2>. (line 15) +* PyType_CheckExact (C function): Type Objects<2>. (line 21) +* PyType_ClearCache (C function): Type Objects<2>. (line 27) +* PyType_ClearWatcher (C function): Type Objects<2>. (line 80) +* PyType_FromMetaclass (C function): Creating Heap-Allocated Types. + (line 9) +* PyType_FromModuleAndSpec (C function): Creating Heap-Allocated Types. + (line 59) +* PyType_FromSpec (C function): Creating Heap-Allocated Types. + (line 96) +* PyType_FromSpecWithBases (C function): Creating Heap-Allocated Types. + (line 79) +* PyType_GenericAlloc (C function): Type Objects<2>. (line 138) +* PyType_GenericNew (C function): Type Objects<2>. (line 145) +* PyType_GetDict (C function): Type Objects<2>. (line 43) +* PyType_GetFlags (C function): Type Objects<2>. (line 31) +* PyType_GetFullyQualifiedName (C function): Type Objects<2>. + (line 184) +* PyType_GetModule (C function): Type Objects<2>. (line 219) +* PyType_GetModuleByDef (C function): Type Objects<2>. (line 253) +* PyType_GetModuleName (C function): Type Objects<2>. (line 194) +* PyType_GetModuleState (C function): Type Objects<2>. (line 239) +* PyType_GetName (C function): Type Objects<2>. (line 168) +* PyType_GetQualName (C function): Type Objects<2>. (line 176) +* PyType_GetSlot (C function): Type Objects<2>. (line 202) +* PyType_GetTypeDataSize (C function): Object Protocol. (line 558) +* PyType_HasFeature (C function): Type Objects<2>. (line 119) +* PyType_IS_GC (C function): Type Objects<2>. (line 124) +* PyType_IsSubtype (C function): Type Objects<2>. (line 129) +* PyType_Modified (C function): Type Objects<2>. (line 61) +* PyType_Ready (C function): Type Objects<2>. (line 152) +* PyType_Slot (C type): Creating Heap-Allocated Types. + (line 179) +* PyType_Slot.pfunc (C member): Creating Heap-Allocated Types. + (line 240) +* PyType_Slot.slot (C member): Creating Heap-Allocated Types. + (line 184) +* PyType_Spec (C type): Creating Heap-Allocated Types. + (line 112) +* PyType_Spec.basicsize (C member): Creating Heap-Allocated Types. + (line 121) +* PyType_Spec.flags (C member): Creating Heap-Allocated Types. + (line 165) +* PyType_Spec.itemsize (C member): Creating Heap-Allocated Types. + (line 139) +* PyType_Spec.name (C member): Creating Heap-Allocated Types. + (line 116) +* PyType_Spec.slots (C member): Creating Heap-Allocated Types. + (line 172) +* PyType_Type (C var): Type Objects<2>. (line 10) +* PyType_Watch (C function): Type Objects<2>. (line 92) +* PyType_WatchCallback (C type): Type Objects<2>. (line 108) +* PyTypeObject (C type): Type Objects<2>. (line 6) +* PyTypeObject.tp_alloc (C member): PyTypeObject Slots. (line 1419) +* PyTypeObject.tp_as_async (C member): PyTypeObject Slots. (line 281) +* PyTypeObject.tp_as_buffer (C member): PyTypeObject Slots. (line 495) +* PyTypeObject.tp_as_mapping (C member): PyTypeObject Slots. (line 347) +* PyTypeObject.tp_as_number (C member): PyTypeObject Slots. (line 323) +* PyTypeObject.tp_as_sequence (C member): PyTypeObject Slots. + (line 335) +* PyTypeObject.tp_base (C member): PyTypeObject Slots. (line 1242) +* PyTypeObject.tp_bases (C member): PyTypeObject Slots. (line 1534) +* PyTypeObject.tp_basicsize (C member): PyTypeObject Slots. (line 48) +* PyTypeObject.tp_cache (C member): PyTypeObject Slots. (line 1568) +* PyTypeObject.tp_call (C member): PyTypeObject Slots. (line 401) +* PyTypeObject.tp_clear (C member): PyTypeObject Slots. (line 960) +* PyTypeObject.tp_dealloc (C member): PyTypeObject Slots. (line 134) +* PyTypeObject.tp_del (C member): PyTypeObject Slots. (line 1607) +* PyTypeObject.tp_descr_get (C member): PyTypeObject Slots. (line 1310) +* PyTypeObject.tp_descr_set (C member): PyTypeObject Slots. (line 1323) +* PyTypeObject.tp_dict (C member): PyTypeObject Slots. (line 1274) +* PyTypeObject.tp_dictoffset (C member): PyTypeObject Slots. (line 1339) +* PyTypeObject.tp_doc (C member): PyTypeObject Slots. (line 857) +* PyTypeObject.tp_finalize (C member): PyTypeObject Slots. (line 1619) +* PyTypeObject.tp_flags (C member): PyTypeObject Slots. (line 507) +* PyTypeObject.tp_free (C member): PyTypeObject Slots. (line 1481) +* PyTypeObject.tp_getattr (C member): PyTypeObject Slots. (line 240) +* PyTypeObject.tp_getattro (C member): PyTypeObject Slots. (line 439) +* PyTypeObject.tp_getset (C member): PyTypeObject Slots. (line 1226) +* PyTypeObject.tp_hash (C member): PyTypeObject Slots. (line 359) +* PyTypeObject.tp_init (C member): PyTypeObject Slots. (line 1383) +* PyTypeObject.tp_is_gc (C member): PyTypeObject Slots. (line 1505) +* PyTypeObject.tp_itemsize (C member): PyTypeObject Slots. (line 48) +* PyTypeObject.tp_iter (C member): PyTypeObject Slots. (line 1155) +* PyTypeObject.tp_iternext (C member): PyTypeObject Slots. (line 1171) +* PyTypeObject.tp_members (C member): PyTypeObject Slots. (line 1210) +* PyTypeObject.tp_methods (C member): PyTypeObject Slots. (line 1194) +* PyTypeObject.tp_mro (C member): PyTypeObject Slots. (line 1554) +* PyTypeObject.tp_name (C member): PyTypeObject Slots. (line 12) +* PyTypeObject.tp_new (C member): PyTypeObject Slots. (line 1442) +* PyTypeObject.tp_repr (C member): PyTypeObject Slots. (line 297) +* PyTypeObject.tp_richcompare (C member): PyTypeObject Slots. + (line 1042) +* PyTypeObject.tp_setattr (C member): PyTypeObject Slots. (line 260) +* PyTypeObject.tp_setattro (C member): PyTypeObject Slots. (line 466) +* PyTypeObject.tp_str (C member): PyTypeObject Slots. (line 413) +* PyTypeObject.tp_subclasses (C member): PyTypeObject Slots. (line 1576) +* PyTypeObject.tp_traverse (C member): PyTypeObject Slots. (line 867) +* PyTypeObject.tp_vectorcall (C member): PyTypeObject Slots. (line 1665) +* PyTypeObject.tp_vectorcall_offset (C member): PyTypeObject Slots. + (line 200) +* PyTypeObject.tp_version_tag (C member): PyTypeObject Slots. + (line 1611) +* PyTypeObject.tp_watched (C member): PyTypeObject Slots. (line 1681) +* PyTypeObject.tp_weaklist (C member): PyTypeObject Slots. (line 1592) +* PyTypeObject.tp_weaklistoffset (C member): PyTypeObject Slots. + (line 1119) +* PyTZInfo_Check (C function): DateTime Objects<2>. + (line 119) +* PyTZInfo_CheckExact (C function): DateTime Objects<2>. + (line 125) +* PyUnicode_1BYTE_DATA (C function): Unicode Type. (line 82) +* PyUnicode_1BYTE_KIND (C macro): Unicode Type. (line 97) +* PyUnicode_2BYTE_DATA (C function): Unicode Type. (line 82) +* PyUnicode_2BYTE_KIND (C macro): Unicode Type. (line 97) +* PyUnicode_4BYTE_DATA (C function): Unicode Type. (line 82) +* PyUnicode_4BYTE_KIND (C macro): Unicode Type. (line 97) +* PyUnicode_AsASCIIString (C function): ASCII Codecs. (line 16) +* PyUnicode_AsCharmapString (C function): Character Map Codecs. + (line 31) +* PyUnicode_AsEncodedString (C function): Generic Codecs. (line 18) +* PyUnicode_AsLatin1String (C function): Latin-1 Codecs. (line 17) +* PyUnicode_AsMBCSString (C function): MBCS codecs for Windows. + (line 37) +* PyUnicode_AsRawUnicodeEscapeString (C function): Raw-Unicode-Escape Codecs. + (line 15) +* PyUnicode_AsUCS4 (C function): Creating and accessing Unicode strings. + (line 388) +* PyUnicode_AsUCS4Copy (C function): Creating and accessing Unicode strings. + (line 398) +* 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 47) +* PyUnicode_AsUTF8 (C function): UTF-8 Codecs. (line 65) +* PyUnicode_AsUTF8AndSize (C function): UTF-8 Codecs. (line 35) +* PyUnicode_AsUTF8String (C function): UTF-8 Codecs. (line 25) +* PyUnicode_AsWideChar (C function): wchar_t Support. (line 16) +* PyUnicode_AsWideCharString (C function): wchar_t Support. (line 34) +* PyUnicode_BuildEncodingMap (C function): Creating and accessing Unicode strings. + (line 297) +* PyUnicode_Check (C function): Unicode Type. (line 54) +* PyUnicode_CheckExact (C function): Unicode Type. (line 59) +* PyUnicode_Compare (C function): Methods and Slot Functions. + (line 132) +* PyUnicode_CompareWithASCIIString (C function): Methods and Slot Functions. + (line 162) +* PyUnicode_Concat (C function): Methods and Slot Functions. + (line 12) +* PyUnicode_Contains (C function): Methods and Slot Functions. + (line 196) +* PyUnicode_CopyCharacters (C function): Creating and accessing Unicode strings. + (line 324) +* PyUnicode_Count (C function): Methods and Slot Functions. + (line 118) +* PyUnicode_DATA (C function): Unicode Type. (line 116) +* PyUnicode_Decode (C function): Generic Codecs. (line 8) +* PyUnicode_DecodeASCII (C function): ASCII Codecs. (line 9) +* PyUnicode_DecodeCharmap (C function): Character Map Codecs. + (line 15) +* PyUnicode_DecodeCodePageStateful (C function): MBCS codecs for Windows. + (line 29) +* PyUnicode_DecodeFSDefault (C function): File System Encoding. + (line 77) +* PyUnicode_DecodeFSDefaultAndSize (C function): File System Encoding. + (line 60) +* PyUnicode_DecodeLatin1 (C function): Latin-1 Codecs. (line 10) +* PyUnicode_DecodeLocale (C function): Locale Encoding. (line 37) +* PyUnicode_DecodeLocaleAndSize (C function): Locale Encoding. + (line 9) +* PyUnicode_DecodeMBCS (C function): MBCS codecs for Windows. + (line 12) +* PyUnicode_DecodeMBCSStateful (C function): MBCS codecs for Windows. + (line 19) +* 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 36) +* 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): MBCS codecs for Windows. + (line 44) +* PyUnicode_EncodeFSDefault (C function): File System Encoding. + (line 89) +* PyUnicode_EncodeLocale (C function): Locale Encoding. (line 46) +* PyUnicode_EqualToUTF8 (C function): Methods and Slot Functions. + (line 153) +* PyUnicode_EqualToUTF8AndSize (C function): Methods and Slot Functions. + (line 140) +* PyUnicode_Fill (C function): Creating and accessing Unicode strings. + (line 335) +* PyUnicode_Find (C function): Methods and Slot Functions. + (line 91) +* PyUnicode_FindChar (C function): Methods and Slot Functions. + (line 102) +* PyUnicode_Format (C function): Methods and Slot Functions. + (line 190) +* PyUnicode_FromEncodedObject (C function): Creating and accessing Unicode strings. + (line 280) +* PyUnicode_FromFormat (C function): Creating and accessing Unicode strings. + (line 62) +* PyUnicode_FromFormatV (C function): Creating and accessing Unicode strings. + (line 254) +* PyUnicode_FromKindAndData (C function): Creating and accessing Unicode strings. + (line 23) +* PyUnicode_FromObject (C function): Creating and accessing Unicode strings. + (line 260) +* PyUnicode_FromOrdinal (C function): Creating and accessing Unicode strings. + (line 271) +* PyUnicode_FromString (C function): Creating and accessing Unicode strings. + (line 56) +* PyUnicode_FromStringAndSize (C function): Creating and accessing Unicode strings. + (line 39) +* PyUnicode_FromWideChar (C function): wchar_t Support. (line 8) +* PyUnicode_FSConverter (C function): File System Encoding. + (line 13) +* PyUnicode_FSDecoder (C function): File System Encoding. + (line 38) +* PyUnicode_GET_LENGTH (C function): Unicode Type. (line 73) +* PyUnicode_GetDefaultEncoding (C function): Creating and accessing Unicode strings. + (line 307) +* PyUnicode_GetLength (C function): Creating and accessing Unicode strings. + (line 315) +* PyUnicode_InternFromString (C function): Methods and Slot Functions. + (line 230) +* PyUnicode_InternInPlace (C function): Methods and Slot Functions. + (line 204) +* PyUnicode_IsIdentifier (C function): Unicode Type. (line 165) +* PyUnicode_Join (C function): Methods and Slot Functions. + (line 77) +* PyUnicode_KIND (C function): Unicode Type. (line 107) +* PyUnicode_MAX_CHAR_VALUE (C function): Unicode Type. (line 155) +* PyUnicode_New (C function): Creating and accessing Unicode strings. + (line 9) +* PyUnicode_Partition (C function): Methods and Slot Functions. + (line 48) +* PyUnicode_READ (C function): Unicode Type. (line 137) +* PyUnicode_READ_CHAR (C function): Unicode Type. (line 146) +* PyUnicode_ReadChar (C function): Creating and accessing Unicode strings. + (line 366) +* PyUnicode_READY (C function): Unicode Type. (line 64) +* PyUnicode_Replace (C function): Methods and Slot Functions. + (line 124) +* PyUnicode_RichCompare (C function): Methods and Slot Functions. + (line 172) +* PyUnicode_RPartition (C function): Methods and Slot Functions. + (line 63) +* PyUnicode_RSplit (C function): Methods and Slot Functions. + (line 30) +* PyUnicode_Split (C function): Methods and Slot Functions. + (line 17) +* PyUnicode_Splitlines (C function): Methods and Slot Functions. + (line 40) +* PyUnicode_Substring (C function): Creating and accessing Unicode strings. + (line 378) +* PyUnicode_Tailmatch (C function): Methods and Slot Functions. + (line 83) +* PyUnicode_Translate (C function): Character Map Codecs. + (line 46) +* PyUnicode_Type (C var): Unicode Type. (line 41) +* PyUnicode_WRITE (C function): Unicode Type. (line 124) +* PyUnicode_WriteChar (C function): Creating and accessing Unicode strings. + (line 350) +* PyUnicodeDecodeError_Create (C function): Unicode Exception Objects. + (line 9) +* PyUnicodeDecodeError_GetEncoding (C function): Unicode Exception Objects. + (line 17) +* PyUnicodeDecodeError_GetEnd (C function): Unicode Exception Objects. + (line 54) +* PyUnicodeDecodeError_GetObject (C function): Unicode Exception Objects. + (line 25) +* PyUnicodeDecodeError_GetReason (C function): Unicode Exception Objects. + (line 74) +* PyUnicodeDecodeError_GetStart (C function): Unicode Exception Objects. + (line 34) +* PyUnicodeDecodeError_SetEnd (C function): Unicode Exception Objects. + (line 64) +* PyUnicodeDecodeError_SetReason (C function): Unicode Exception Objects. + (line 83) +* PyUnicodeDecodeError_SetStart (C function): Unicode Exception Objects. + (line 44) +* PyUnicodeEncodeError_GetEncoding (C function): Unicode Exception Objects. + (line 17) +* PyUnicodeEncodeError_GetEnd (C function): Unicode Exception Objects. + (line 54) +* PyUnicodeEncodeError_GetObject (C function): Unicode Exception Objects. + (line 25) +* PyUnicodeEncodeError_GetReason (C function): Unicode Exception Objects. + (line 74) +* PyUnicodeEncodeError_GetStart (C function): Unicode Exception Objects. + (line 34) +* PyUnicodeEncodeError_SetEnd (C function): Unicode Exception Objects. + (line 64) +* PyUnicodeEncodeError_SetReason (C function): Unicode Exception Objects. + (line 83) +* PyUnicodeEncodeError_SetStart (C function): Unicode Exception Objects. + (line 44) +* PyUnicodeIter_Type (C var): Unicode Type. (line 46) +* PyUnicodeObject (C type): Unicode Type. (line 30) +* PyUnicodeTranslateError_GetEnd (C function): Unicode Exception Objects. + (line 54) +* PyUnicodeTranslateError_GetObject (C function): Unicode Exception Objects. + (line 25) +* PyUnicodeTranslateError_GetReason (C function): Unicode Exception Objects. + (line 74) +* PyUnicodeTranslateError_GetStart (C function): Unicode Exception Objects. + (line 34) +* PyUnicodeTranslateError_SetEnd (C function): Unicode Exception Objects. + (line 64) +* PyUnicodeTranslateError_SetReason (C function): Unicode Exception Objects. + (line 83) +* PyUnicodeTranslateError_SetStart (C function): Unicode Exception Objects. + (line 44) +* PyUnstable: Unstable C API. (line 6) +* PyUnstable_AtExit (C function): Initializing and finalizing the interpreter. + (line 202) +* PyUnstable_Code_GetExtra (C function): Extra information. (line 35) +* PyUnstable_Code_GetFirstFree (C function): Code Objects<2>. + (line 31) +* PyUnstable_Code_New (C function): Code Objects<2>. (line 41) +* PyUnstable_Code_NewWithPosOnlyArgs (C function): Code Objects<2>. + (line 68) +* PyUnstable_Code_SetExtra (C function): Extra information. (line 51) +* PyUnstable_Eval_RequestCodeExtraIndex (C function): Extra information. + (line 14) +* PyUnstable_Exc_PrepReraiseStar (C function): Exception Objects. + (line 61) +* 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 24) +* PyUnstable_InterpreterFrame_GetLine (C function): Internal Frames. + (line 32) +* PyUnstable_InterpreterState_GetMainModule (C function): Low-level API. + (line 153) +* PyUnstable_Long_CompactValue (C function): Integer Objects. + (line 527) +* PyUnstable_Long_IsCompact (C function): Integer Objects. (line 509) +* PyUnstable_Module_SetGIL (C function): Support functions. (line 158) +* PyUnstable_Object_ClearWeakRefsNoCallbacks (C function): Weak Reference Objects<2>. + (line 100) +* PyUnstable_Object_GC_NewWithExtraData (C function): Supporting Cyclic Garbage Collection. + (line 66) +* PyUnstable_PerfMapState_Fini (C function): Support for Perf Maps. + (line 48) +* PyUnstable_PerfMapState_Init (C function): Support for Perf Maps. + (line 19) +* PyUnstable_Type_AssignVersionTag (C function): Type Objects<2>. + (line 275) +* PyUnstable_WritePerfMapEntry (C function): Support for Perf Maps. + (line 33) +* PyVarObject (C type): Base object types and macros. + (line 26) +* PyVarObject_HEAD_INIT (C macro): Base object types and macros. + (line 135) +* PyVarObject.ob_size (C member): PyVarObject Slots. (line 6) +* PyVectorcall_Call (C function): Vectorcall Support API. + (line 33) +* PyVectorcall_Function (C function): Vectorcall Support API. + (line 19) +* PyVectorcall_NARGS (C function): Vectorcall Support API. + (line 6) +* PyWeakref_Check (C function): Weak Reference Objects<2>. + (line 11) +* PyWeakref_CheckProxy (C function): Weak Reference Objects<2>. + (line 21) +* PyWeakref_CheckRef (C function): Weak Reference Objects<2>. + (line 16) +* PyWeakref_GET_OBJECT (C function): Weak Reference Objects<2>. + (line 84) +* PyWeakref_GetObject (C function): Weak Reference Objects<2>. + (line 68) +* PyWeakref_GetRef (C function): Weak Reference Objects<2>. + (line 54) +* PyWeakref_NewProxy (C function): Weak Reference Objects<2>. + (line 40) +* PyWeakref_NewRef (C function): Weak Reference Objects<2>. + (line 26) +* 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 Objects. (line 43) +* PyZipFile (class in zipfile): PyZipFile Objects. (line 10) +* qiflush() (in module curses): Functions<6>. (line 398) +* QName (class in xml.etree.ElementTree): QName Objects. (line 6) +* qsize() (asyncio.Queue method): Queue. (line 80) +* qsize() (multiprocessing.Queue method): Pipes and Queues. (line 106) +* qsize() (queue.Queue method): Queue Objects. (line 9) +* qsize() (queue.SimpleQueue method): SimpleQueue Objects. + (line 9) +* qualified name: Glossary. (line 1287) +* quantiles() (in module statistics): Function details. (line 501) +* quantiles() (statistics.NormalDist method): NormalDist objects. + (line 109) +* quantize() (decimal.Context method): Context objects. (line 490) +* quantize() (decimal.Decimal method): Decimal objects. (line 478) +* QueryInfoKey() (in module winreg): Functions<13>. (line 319) +* QueryReflectionKey() (in module winreg): Functions<13>. (line 516) +* QueryValue() (in module winreg): Functions<13>. (line 348) +* QueryValueEx() (in module winreg): Functions<13>. (line 368) +* QUESTION (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 196) +* Queue (class in asyncio): Queue. (line 6) +* Queue (class in multiprocessing): Pipes and Queues. (line 92) +* Queue (class in queue): queue — A synchronized queue class. + (line 34) +* queue (sched.scheduler attribute): Scheduler Objects. (line 73) +* Queue() (multiprocessing.managers.SyncManager method): Managers. + (line 198) +* QueueEmpty: Exceptions<12>. (line 6) +* QueueFull: Exceptions<12>. (line 11) +* QueueHandler (class in logging.handlers): QueueHandler. (line 21) +* QueueListener (class in logging.handlers): QueueListener. (line 25) +* QueueShutDown: Exceptions<12>. (line 16) +* quick_ratio() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 204) +* quiet (sys.flags attribute): sys — System-specific parameters and functions. + (line 562) +* quit (built-in variable): Constants added by the site module. + (line 11) +* quit (pdb command): Debugger Commands. (line 425) +* quit() (ftplib.FTP method): FTP objects. (line 360) +* quit() (poplib.POP3 method): POP3 Objects. (line 83) +* quit() (smtplib.SMTP method): SMTP Objects. (line 341) +* quit() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 123) +* quitting (bdb.Bdb attribute): bdb — Debugger framework. + (line 337) +* QUOTE_ALL (in module csv): Module Contents<3>. (line 269) +* quote_from_bytes() (in module urllib.parse): URL Quoting. (line 53) +* QUOTE_MINIMAL (in module csv): Module Contents<3>. (line 273) +* QUOTE_NONE (in module csv): Module Contents<3>. (line 293) +* QUOTE_NONNUMERIC (in module csv): Module Contents<3>. (line 279) +* QUOTE_NOTNULL (in module csv): Module Contents<3>. (line 306) +* quote_plus() (in module urllib.parse): URL Quoting. (line 42) +* QUOTE_STRINGS (in module csv): Module Contents<3>. (line 318) +* quote() (in module email.utils): email utils Miscellaneous utilities. + (line 45) +* quote() (in module shlex): shlex — Simple lexical analysis. + (line 43) +* quote() (in module urllib.parse): URL Quoting. (line 13) +* quoteattr() (in module xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 38) +* quotechar (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 64) +* quoted-printable; encoding: quopri — Encode and decode MIME quoted-printable data. + (line 8) +* quotes (shlex.shlex attribute): shlex Objects. (line 115) +* quoting (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 75) +* R_OK (in module os): Files and Directories. + (line 107) +* r'; raw string literal: String and Bytes literals. + (line 51) +* r"; raw string literal: String and Bytes literals. + (line 51) +* radians() (in module math): Angular conversion. (line 10) +* radians() (in module turtle): Settings for measurement. + (line 28) +* radix (sys.float_info attribute): sys — System-specific parameters and functions. + (line 671) +* radix() (decimal.Context method): Context objects. (line 495) +* radix() (decimal.Decimal method): Decimal objects. (line 507) +* RADIXCHAR (in module locale): locale — Internationalization services. + (line 269) +* Raise (class in ast): Statements. (line 113) +* RAISE (monitoring event): Events. (line 71) +* raise an exception: Exceptions<2>. (line 6) +* raise_on_defect (email.policy.Policy attribute): email policy Policy Objects. + (line 181) +* raise_signal() (in module signal): Module contents<2>. (line 324) +* RAISE_VARARGS (opcode): Python Bytecode Instructions. + (line 1023) +* raiseExceptions (in module logging): Module-Level Attributes. + (line 19) +* raising; exception: The raise statement. + (line 6) +* RAND_add() (in module ssl): Random generation. (line 30) +* RAND_bytes() (in module ssl): Random generation. (line 6) +* RAND_status() (in module ssl): Random generation. (line 23) +* randbelow() (in module secrets): Random numbers. (line 19) +* randbits() (in module secrets): Random numbers. (line 23) +* randbytes() (in module random): Functions for bytes. + (line 6) +* randbytes() (random.Random method): Alternative Generator. + (line 46) +* randint() (in module random): Functions for integers. + (line 32) +* Random (class in random): Alternative Generator. + (line 6) +* random command line option; -c: Command-line usage. (line 18) +* random command line option; -choice: Command-line usage. (line 18) +* random command line option; -f: Command-line usage. (line 29) +* random command line option; -float: Command-line usage. (line 29) +* random command line option; -h: Command-line usage. (line 14) +* random command line option; -help: Command-line usage. (line 14) +* random command line option; -i: Command-line usage. (line 23) +* random command line option; -integer: Command-line usage. (line 23) +* random() (in module random): Real-valued distributions. + (line 11) +* random() (random.Random method): Alternative Generator. + (line 33) +* randrange() (in module random): Functions for integers. + (line 6) +* range (built-in class): Ranges. (line 10) +* RARROW (in module token): token — Constants used with Python parse trees. + (line 308) +* ratio() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 180) +* Rational (class in numbers): The numeric tower. (line 41) +* raw (io.BufferedIOBase attribute): I/O Base Classes. (line 252) +* raw string: String and Bytes literals. + (line 36) +* raw_data_manager (in module email.contentmanager): Content Manager Instances. + (line 11) +* raw_decode() (json.JSONDecoder method): Encoders and Decoders. + (line 95) +* raw_input() (code.InteractiveConsole method): Interactive Console Objects. + (line 45) +* raw() (in module curses): Functions<6>. (line 405) +* raw() (pickle.PickleBuffer method): Module Interface. (line 324) +* RawArray() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 16) +* RawConfigParser (class in configparser): RawConfigParser Objects. + (line 6) +* RawDescriptionHelpFormatter (class in argparse): formatter_class. + (line 10) +* RawIOBase (class in io): I/O Base Classes. (line 170) +* RawPen (class in turtle): Public classes. (line 6) +* RawTextHelpFormatter (class in argparse): formatter_class. (line 10) +* RawTurtle (class in turtle): Public classes. (line 6) +* RawValue() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 33) +* RBRACE (in module token): token — Constants used with Python parse trees. + (line 233) +* re (re.Match attribute): Match Objects. (line 206) +* READ (inspect.BufferFlags attribute): Buffer flags. (line 49) +* read_binary() (in module importlib.resources): Functional API. + (line 75) +* read_byte() (mmap.mmap method): mmap — Memory-mapped file support. + (line 253) +* read_bytes() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 556) +* read_bytes() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 150) +* read_bytes() (pathlib.Path method): Reading and writing files. + (line 35) +* read_bytes() (zipfile.Path method): Path Objects. (line 110) +* read_dict() (configparser.ConfigParser method): ConfigParser Objects. + (line 207) +* read_environ() (in module wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 312) +* read_events() (xml.etree.ElementTree.XMLPullParser method): XMLPullParser Objects. + (line 48) +* read_file() (configparser.ConfigParser method): ConfigParser Objects. + (line 185) +* read_history_file() (in module readline): History file. (line 8) +* read_init_file() (in module readline): Init file. (line 13) +* read_mime_types() (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 113) +* READ_RESTRICTED (C macro): Member flags. (line 32) +* read_string() (configparser.ConfigParser method): ConfigParser Objects. + (line 197) +* read_text() (importlib.abc.Traversable method): importlib abc – Abstract base classes related to import. + (line 560) +* read_text() (importlib.resources.abc.Traversable method): importlib resources abc – Abstract base classes for resources. + (line 154) +* read_text() (in module importlib.resources): Functional API. + (line 89) +* read_text() (pathlib.Path method): Reading and writing files. + (line 18) +* read_text() (zipfile.Path method): Path Objects. (line 98) +* read_token() (shlex.shlex method): shlex Objects. (line 20) +* read_windows_registry() (mimetypes.MimeTypes method): MimeTypes Objects. + (line 93) +* read() (asyncio.StreamReader method): StreamReader. (line 20) +* read() (codecs.StreamReader method): StreamReader Objects. + (line 34) +* read() (configparser.ConfigParser method): ConfigParser Objects. + (line 148) +* read() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 13) +* read() (imaplib.IMAP4 method): IMAP4 Objects. (line 199) +* read() (in module os): File Descriptor Operations. + (line 732) +* read() (io.BufferedIOBase method): I/O Base Classes. (line 273) +* read() (io.BufferedReader method): Buffered Streams. (line 82) +* read() (io.RawIOBase method): I/O Base Classes. (line 184) +* read() (io.TextIOBase method): Text I/O<2>. (line 52) +* read() (mimetypes.MimeTypes method): MimeTypes Objects. (line 77) +* read() (mmap.mmap method): mmap — Memory-mapped file support. + (line 243) +* read() (sqlite3.Blob method): Blob objects. (line 45) +* read() (ssl.MemoryBIO method): Memory BIO Support<2>. + (line 148) +* read() (ssl.SSLSocket method): SSL Sockets. (line 76) +* read() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 25) +* read() (zipfile.ZipFile method): ZipFile Objects. (line 245) +* read1() (bz2.BZ2File method): De compression of files. + (line 112) +* read1() (io.BufferedIOBase method): I/O Base Classes. (line 297) +* read1() (io.BufferedReader method): Buffered Streams. (line 87) +* read1() (io.BytesIO method): Buffered Streams. (line 43) +* READABLE (in module _tkinter): File Handlers. (line 41) +* readable() (bz2.BZ2File method): De compression of files. + (line 94) +* readable() (io.IOBase method): I/O Base Classes. (line 78) +* readall() (io.RawIOBase method): I/O Base Classes. (line 199) +* readbuffer_encode() (in module codecs): codecs — Codec registry and base classes. + (line 258) +* reader() (in module csv): Module Contents<3>. (line 8) +* ReadError: tarfile — Read and write tar archive files. + (line 204) +* readexactly() (asyncio.StreamReader method): StreamReader. (line 46) +* readfp() (mimetypes.MimeTypes method): MimeTypes Objects. (line 85) +* readframes() (wave.Wave_read method): Wave_read Objects. (line 52) +* readinto() (bz2.BZ2File method): De compression of files. + (line 122) +* readinto() (http.client.HTTPResponse method): HTTPResponse Objects. + (line 17) +* readinto() (io.BufferedIOBase method): I/O Base Classes. (line 309) +* readinto() (io.RawIOBase method): I/O Base Classes. (line 204) +* readinto1() (io.BufferedIOBase method): I/O Base Classes. (line 322) +* readinto1() (io.BytesIO method): Buffered Streams. (line 49) +* readline() (asyncio.StreamReader method): StreamReader. (line 35) +* readline() (codecs.StreamReader method): StreamReader Objects. + (line 60) +* readline() (imaplib.IMAP4 method): IMAP4 Objects. (line 204) +* readline() (io.IOBase method): I/O Base Classes. (line 83) +* readline() (io.TextIOBase method): Text I/O<2>. (line 58) +* readline() (mmap.mmap method): mmap — Memory-mapped file support. + (line 258) +* readlines() (codecs.StreamReader method): StreamReader Objects. + (line 71) +* readlines() (io.IOBase method): I/O Base Classes. (line 92) +* readlink() (in module os): Files and Directories. + (line 671) +* readlink() (pathlib.Path method): Expanding and resolving paths. + (line 80) +* readmodule_ex() (in module pyclbr): pyclbr — Python module browser support. + (line 31) +* readmodule() (in module pyclbr): pyclbr — Python module browser support. + (line 19) +* READONLY (C macro): Member flags. (line 37) +* ReadOnly (in module typing): Special forms. (line 269) +* readonly (memoryview attribute): Memory Views. (line 417) +* ReadTransport (class in asyncio): Transports Hierarchy. + (line 20) +* readuntil() (asyncio.StreamReader method): StreamReader. (line 55) +* readv() (in module os): File Descriptor Operations. + (line 868) +* ready() (multiprocessing.pool.AsyncResult method): Process Pools. + (line 213) +* Real (class in numbers): The numeric tower. (line 28) +* real (numbers.Complex attribute): The numeric tower. (line 15) +* real_max_memuse (in module test.support): test support — Utilities for the Python test suite. + (line 150) +* real_quick_ratio() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 209) +* realloc (C function): Overview<4>. (line 33) +* realpath() (in module os.path): os path — Common pathname manipulations. + (line 354) +* REALTIME_PRIORITY_CLASS (in module subprocess): Windows Constants. + (line 103) +* reap_children() (in module test.support): test support — Utilities for the Python test suite. + (line 584) +* reap_threads() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 17) +* reason (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 65) +* reason (ssl.SSLError attribute): Exceptions<16>. (line 27) +* reason (UnicodeError attribute): Concrete exceptions. + (line 449) +* reason (urllib.error.HTTPError attribute): urllib error — Exception classes raised by urllib request. + (line 50) +* reason (urllib.error.URLError attribute): urllib error — Exception classes raised by urllib request. + (line 22) +* reattach() (tkinter.ttk.Treeview method): ttk Treeview. (line 237) +* rebinding; name: Assignment statements. + (line 6) +* recent() (imaplib.IMAP4 method): IMAP4 Objects. (line 209) +* reconfigure() (io.TextIOWrapper method): Text I/O<2>. (line 182) +* record_original_stdout() (in module test.support): test support — Utilities for the Python test suite. + (line 308) +* RECORDS (inspect.BufferFlags attribute): Buffer flags. (line 41) +* records (unittest.TestCase attribute): Test cases. (line 435) +* RECORDS_RO (inspect.BufferFlags attribute): Buffer flags. (line 43) +* rect() (in module cmath): Conversions to and from polar coordinates. + (line 44) +* rectangle() (in module curses.textpad): curses textpad — Text input widget for curses programs. + (line 15) +* RecursionError: Concrete exceptions. + (line 243) +* recursive_repr() (in module reprlib): reprlib — Alternate repr implementation. + (line 61) +* recv_bytes_into() (multiprocessing.connection.Connection method): Connection Objects. + (line 79) +* recv_bytes() (multiprocessing.connection.Connection method): Connection Objects. + (line 65) +* recv_fds() (in module socket): Other functions<2>. (line 476) +* recv_into() (socket.socket method): Socket Objects. (line 386) +* recv() (multiprocessing.connection.Connection method): Connection Objects. + (line 24) +* recv() (socket.socket method): Socket Objects. (line 233) +* recvfrom_into() (socket.socket method): Socket Objects. (line 376) +* recvfrom() (socket.socket method): Socket Objects. (line 247) +* recvmsg_into() (socket.socket method): Socket Objects. (line 337) +* recvmsg() (socket.socket method): Socket Objects. (line 265) +* redirect_request() (urllib.request.HTTPRedirectHandler method): HTTPRedirectHandler Objects. + (line 15) +* redirect_stderr() (in module contextlib): Utilities. (line 355) +* redirect_stdout() (in module contextlib): Utilities. (line 315) +* redisplay() (in module readline): Line buffer. (line 19) +* redrawln() (curses.window method): Window Objects. (line 462) +* redrawwin() (curses.window method): Window Objects. (line 468) +* reduce() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 396) +* reducer_override() (pickle.Pickler method): Module Interface. + (line 203) +* ref (class in weakref): weakref — Weak references. + (line 90) +* refcount_test() (in module test.support): test support — Utilities for the Python test suite. + (line 543) +* reference count: Glossary. (line 1314) +* reference counting: Objects values and types. + (line 37) +* ReferenceError: Concrete exceptions. + (line 252) +* ReferenceType (in module weakref): weakref — Weak references. + (line 332) +* refold_source (email.policy.EmailPolicy attribute): email policy Policy Objects. + (line 388) +* refresh() (curses.window method): Window Objects. (line 473) +* REG_BINARY (in module winreg): Value Types. (line 8) +* REG_DWORD (in module winreg): Value Types. (line 12) +* REG_DWORD_BIG_ENDIAN (in module winreg): Value Types. (line 21) +* REG_DWORD_LITTLE_ENDIAN (in module winreg): Value Types. (line 16) +* REG_EXPAND_SZ (in module winreg): Value Types. (line 25) +* REG_FULL_RESOURCE_DESCRIPTOR (in module winreg): Value Types. + (line 60) +* REG_LINK (in module winreg): Value Types. (line 30) +* REG_MULTI_SZ (in module winreg): Value Types. (line 34) +* REG_NONE (in module winreg): Value Types. (line 39) +* REG_QWORD (in module winreg): Value Types. (line 43) +* REG_QWORD_LITTLE_ENDIAN (in module winreg): Value Types. (line 49) +* REG_RESOURCE_LIST (in module winreg): Value Types. (line 56) +* REG_RESOURCE_REQUIREMENTS_LIST (in module winreg): Value Types. + (line 64) +* REG_SZ (in module winreg): Value Types. (line 68) +* RegexFlag (class in re): Flags. (line 9) +* register_adapter() (in module sqlite3): Module functions. (line 138) +* register_archive_format() (in module shutil): Archiving operations. + (line 92) +* register_at_fork() (in module os): Process Management. (line 556) +* register_callback() (in module sys.monitoring): Registering callback functions. + (line 8) +* register_converter() (in module sqlite3): Module functions. + (line 145) +* register_defect() (email.policy.Policy method): email policy Policy Objects. + (line 246) +* register_dialect() (in module csv): Module Contents<3>. (line 70) +* register_error() (in module codecs): Error Handlers. (line 101) +* register_function() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler. + (line 9) +* register_function() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects. + (line 10) +* register_instance() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler. + (line 26) +* register_instance() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects. + (line 27) +* register_introspection_functions() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler. + (line 41) +* register_introspection_functions() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects. + (line 55) +* register_multicall_functions() (xmlrpc.server.CGIXMLRPCRequestHandler method): CGIXMLRPCRequestHandler. + (line 46) +* register_multicall_functions() (xmlrpc.server.SimpleXMLRPCServer method): SimpleXMLRPCServer Objects. + (line 60) +* register_namespace() (in module xml.etree.ElementTree): Functions<9>. + (line 199) +* register_optionflag() (in module doctest): Option Flags. (line 154) +* register_shape() (in module turtle): Settings and special methods. + (line 71) +* register_unpack_format() (in module shutil): Archiving operations. + (line 162) +* register() (abc.ABCMeta method): abc — Abstract Base Classes. + (line 69) +* register() (argparse.ArgumentParser method): Registering custom types or actions. + (line 6) +* register() (functools.singledispatch method): functools — Higher-order functions and operations on callable objects. + (line 443) +* register() (in module atexit): atexit — Exit handlers. + (line 25) +* register() (in module codecs): codecs — Codec registry and base classes. + (line 159) +* register() (in module faulthandler): Dumping the traceback on a user signal. + (line 6) +* register() (in module webbrowser): webbrowser — Convenient web-browser controller. + (line 110) +* register() (multiprocessing.managers.BaseManager method): Managers. + (line 92) +* register() (select.devpoll method): /dev/poll Polling Objects. + (line 30) +* register() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 81) +* register() (select.poll method): Polling Objects. (line 15) +* register() (selectors.BaseSelector method): Classes<4>. (line 65) +* registerDOMImplementation() (in module xml.dom): Module Contents<4>. + (line 8) +* registerResult() (in module unittest): Signal Handling. (line 35) +* REGTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 278) +* regular package: Glossary. (line 1329) +* relative_to() (pathlib.PurePath method): Methods and properties. + (line 309) +* relative; import: The import statement. + (line 99) +* relative; URL: urllib parse — Parse URLs into components. + (line 8) +* release() (_thread.lock method): _thread — Low-level threading API. + (line 170) +* release() (asyncio.Condition method): Condition. (line 78) +* release() (asyncio.Lock method): Lock. (line 49) +* release() (asyncio.Semaphore method): Semaphore. (line 54) +* release() (in module platform): Cross platform. (line 114) +* release() (logging.Handler method): Handler Objects. (line 31) +* release() (memoryview method): Memory Views. (line 239) +* release() (multiprocessing.Lock method): Synchronization primitives. + (line 92) +* release() (multiprocessing.RLock method): Synchronization primitives. + (line 148) +* release() (pickle.PickleBuffer method): Module Interface. (line 332) +* release() (threading.Condition method): Condition objects. (line 91) +* release() (threading.Lock method): Lock objects. (line 73) +* release() (threading.RLock method): RLock objects. (line 94) +* release() (threading.Semaphore method): Semaphore objects. (line 63) +* releasebufferproc (C type): Slot Type typedefs. (line 104) +* reload() (in module importlib): Functions<12>. (line 55) +* relpath() (in module os.path): os path — Common pathname manipulations. + (line 410) +* remainder_near() (decimal.Context method): Context objects. + (line 506) +* remainder_near() (decimal.Decimal method): Decimal objects. + (line 513) +* remainder() (decimal.Context method): Context objects. (line 499) +* remainder() (in module math): Floating point arithmetic. + (line 65) +* RemoteDisconnected: http client — HTTP protocol client. + (line 187) +* remove_child_handler() (asyncio.AbstractChildWatcher method): Process Watchers. + (line 56) +* remove_done_callback() (asyncio.Future method): Future Object. + (line 106) +* remove_done_callback() (asyncio.Task method): Task Object. (line 111) +* remove_flag() (mailbox.Maildir method): Maildir objects. (line 142) +* remove_flag() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 84) +* remove_flag() (mailbox.mboxMessage method): mboxMessage objects. + (line 85) +* remove_flag() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 84) +* remove_folder() (mailbox.Maildir method): Maildir objects. (line 80) +* remove_folder() (mailbox.MH method): MH objects. (line 50) +* remove_header() (urllib.request.Request method): Request Objects. + (line 100) +* remove_history_item() (in module readline): History list. (line 26) +* remove_label() (mailbox.BabylMessage method): BabylMessage objects. + (line 59) +* remove_option() (configparser.ConfigParser method): ConfigParser Objects. + (line 306) +* remove_option() (optparse.OptionParser method): Querying and manipulating your option parser. + (line 47) +* remove_reader() (asyncio.loop method): Watching file descriptors. + (line 15) +* remove_section() (configparser.ConfigParser method): ConfigParser Objects. + (line 313) +* remove_sequence() (mailbox.MHMessage method): MHMessage objects. + (line 46) +* remove_signal_handler() (asyncio.loop method): Unix signals. + (line 26) +* remove_writer() (asyncio.loop method): Watching file descriptors. + (line 32) +* remove() (array.array method): array — Efficient arrays of numeric values. + (line 220) +* remove() (collections.deque method): deque objects. (line 97) +* remove() (frozenset method): Set Types — set frozenset. + (line 199) +* remove() (in module os): Files and Directories. + (line 708) +* remove() (mailbox.Mailbox method): Mailbox objects. (line 76) +* remove() (mailbox.MH method): MH objects. (line 79) +* remove() (sequence method): Mutable Sequence Types. + (line 16) +* remove() (xml.etree.ElementTree.Element method): Element Objects. + (line 170) +* removeAttribute() (xml.dom.Element method): Element Objects<2>. + (line 52) +* removeAttributeNode() (xml.dom.Element method): Element Objects<2>. + (line 57) +* removeAttributeNS() (xml.dom.Element method): Element Objects<2>. + (line 62) +* removeChild() (xml.dom.Node method): Node Objects. (line 128) +* removedirs() (in module os): Files and Directories. + (line 732) +* removeFilter() (logging.Handler method): Handler Objects. (line 57) +* removeFilter() (logging.Logger method): Logger Objects. (line 329) +* removeHandler() (in module unittest): Signal Handling. (line 52) +* removeHandler() (logging.Logger method): Logger Objects. (line 346) +* removeprefix() (bytearray method): Bytes and Bytearray Operations. + (line 52) +* removeprefix() (bytes method): Bytes and Bytearray Operations. + (line 52) +* removeprefix() (str method): String Methods<2>. (line 417) +* removeResult() (in module unittest): Signal Handling. (line 46) +* removesuffix() (bytearray method): Bytes and Bytearray Operations. + (line 72) +* removesuffix() (bytes method): Bytes and Bytearray Operations. + (line 72) +* removesuffix() (str method): String Methods<2>. (line 430) +* removexattr() (in module os): Linux extended attributes. + (line 41) +* rename() (ftplib.FTP method): FTP objects. (line 325) +* rename() (imaplib.IMAP4 method): IMAP4 Objects. (line 214) +* rename() (in module os): Files and Directories. + (line 749) +* rename() (pathlib.Path method): Renaming and deleting. + (line 6) +* renames() (in module os): Files and Directories. + (line 786) +* reopenIfNeeded() (logging.handlers.WatchedFileHandler method): WatchedFileHandler. + (line 41) +* reorganize() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 104) +* repeat() (in module itertools): Itertool Functions. (line 529) +* repeat() (in module timeit): Python Interface. (line 18) +* repeat() (timeit.Timer method): Python Interface. (line 110) +* repetition; operation: Common Sequence Operations. + (line 21) +* REPL: Glossary. (line 1336) +* replace_errors() (in module codecs): Error Handlers. (line 154) +* replace_header() (email.message.EmailMessage method): email message Representing an email message. + (line 301) +* replace_header() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 411) +* replace_history_item() (in module readline): History list. (line 32) +* replace_whitespace (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 182) +* replace; error handler's name: Error Handlers. (line 15) +* replace() (bytearray method): Bytes and Bytearray Operations. + (line 200) +* replace() (bytes method): Bytes and Bytearray Operations. + (line 200) +* replace() (codeobject method): Methods on code objects. + (line 85) +* replace() (curses.panel.Panel method): Panel Objects. (line 39) +* replace() (datetime.date method): date Objects. (line 194) +* replace() (datetime.datetime method): datetime Objects. (line 464) +* replace() (datetime.time method): time Objects. (line 149) +* replace() (in module copy): copy — Shallow and deep copy operations. + (line 26) +* replace() (in module dataclasses): Module contents<4>. (line 439) +* replace() (in module os): Files and Directories. + (line 804) +* replace() (inspect.Parameter method): Introspecting callables with the Signature object. + (line 302) +* replace() (inspect.Signature method): Introspecting callables with the Signature object. + (line 137) +* replace() (pathlib.Path method): Renaming and deleting. + (line 34) +* replace() (str method): String Methods<2>. (line 443) +* replace() (tarfile.TarInfo method): TarInfo Objects. (line 166) +* replaceChild() (xml.dom.Node method): Node Objects. (line 135) +* ReplacePackage() (in module modulefinder): modulefinder — Find modules used by a script. + (line 21) +* REPORT_CDIFF (in module doctest): Option Flags. (line 113) +* REPORT_ERRMODE (in module msvcrt): Other Functions. (line 35) +* report_failure() (doctest.DocTestRunner method): DocTestRunner objects. + (line 76) +* report_full_closure() (filecmp.dircmp method): The dircmp class. + (line 32) +* REPORT_NDIFF (in module doctest): Option Flags. (line 118) +* REPORT_ONLY_FIRST_FAILURE (in module doctest): Option Flags. + (line 127) +* report_partial_closure() (filecmp.dircmp method): The dircmp class. + (line 27) +* report_start() (doctest.DocTestRunner method): DocTestRunner objects. + (line 54) +* report_success() (doctest.DocTestRunner method): DocTestRunner objects. + (line 65) +* REPORT_UDIFF (in module doctest): Option Flags. (line 108) +* report_unexpected_exception() (doctest.DocTestRunner method): DocTestRunner objects. + (line 87) +* report() (filecmp.dircmp method): The dircmp class. (line 22) +* report() (modulefinder.ModuleFinder method): modulefinder — Find modules used by a script. + (line 38) +* REPORTING_FLAGS (in module doctest): Option Flags. (line 146) +* Repr (class in reprlib): reprlib — Alternate repr implementation. + (line 17) +* repr() (built-in function); __repr__() (object method): Basic customization. + (line 114) +* repr() (in module reprlib): reprlib — Alternate repr implementation. + (line 51) +* repr() (reprlib.Repr method): Repr Objects. (line 107) +* repr1() (reprlib.Repr method): Repr Objects. (line 112) +* ReprEnum (class in enum): Data Types<2>. (line 591) +* reprfunc (C type): Slot Type typedefs. (line 39) +* Request (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 189) +* request (socketserver.BaseRequestHandler attribute): Request Handler Objects. + (line 42) +* request_queue_size (socketserver.BaseServer attribute): Server Objects<2>. + (line 101) +* request_rate() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 60) +* request_uri() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 27) +* request_version (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 104) +* request() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 8) +* RequestHandlerClass (socketserver.BaseServer attribute): Server Objects<2>. + (line 74) +* requestline (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 86) +* Required (in module typing): Special forms. (line 250) +* requires_bz2() (in module test.support): test support — Utilities for the Python test suite. + (line 507) +* requires_docstrings() (in module test.support): test support — Utilities for the Python test suite. + (line 519) +* requires_freebsd_version() (in module test.support): test support — Utilities for the Python test suite. + (line 475) +* requires_gil_enabled() (in module test.support): test support — Utilities for the Python test suite. + (line 490) +* requires_gzip() (in module test.support): test support — Utilities for the Python test suite. + (line 503) +* requires_IEEE_754() (in module test.support): test support — Utilities for the Python test suite. + (line 495) +* requires_limited_api() (in module test.support): test support — Utilities for the Python test suite. + (line 523) +* requires_linux_version() (in module test.support): test support — Utilities for the Python test suite. + (line 480) +* requires_lzma() (in module test.support): test support — Utilities for the Python test suite. + (line 511) +* requires_mac_version() (in module test.support): test support — Utilities for the Python test suite. + (line 485) +* requires_resource() (in module test.support): test support — Utilities for the Python test suite. + (line 515) +* requires_zlib() (in module test.support): test support — Utilities for the Python test suite. + (line 499) +* requires() (in module importlib.metadata): Distribution requirements. + (line 6) +* requires() (in module test.support): test support — Utilities for the Python test suite. + (line 259) +* RERAISE (monitoring event): Events. (line 76) +* RERAISE (opcode): Python Bytecode Instructions. + (line 449) +* reschedule() (asyncio.Timeout method): Timeouts. (line 68) +* reserved (zipfile.ZipInfo attribute): ZipInfo Objects. (line 112) +* reserved word: Keywords. (line 6) +* RESERVED_FUTURE (in module uuid): uuid — UUID objects according to RFC 4122. + (line 239) +* RESERVED_MICROSOFT (in module uuid): uuid — UUID objects according to RFC 4122. + (line 235) +* RESERVED_NCS (in module uuid): uuid — UUID objects according to RFC 4122. + (line 227) +* reset_mock() (unittest.mock.AsyncMock method): The Mock Class. + (line 895) +* reset_mock() (unittest.mock.Mock method): The Mock Class. (line 202) +* reset_peak() (in module tracemalloc): Functions<11>. (line 38) +* reset_prog_mode() (in module curses): Functions<6>. (line 411) +* reset_shell_mode() (in module curses): Functions<6>. (line 416) +* reset_tzpath() (in module zoneinfo): Functions<3>. (line 27) +* reset() (asyncio.Barrier method): Barrier. (line 78) +* reset() (bdb.Bdb method): bdb — Debugger framework. + (line 159) +* reset() (codecs.IncrementalDecoder method): IncrementalDecoder Objects. + (line 40) +* reset() (codecs.IncrementalEncoder method): IncrementalEncoder Objects. + (line 35) +* reset() (codecs.StreamReader method): StreamReader Objects. + (line 83) +* reset() (codecs.StreamWriter method): StreamWriter Objects. + (line 42) +* reset() (contextvars.ContextVar method): Context Variables. + (line 58) +* reset() (html.parser.HTMLParser method): HTMLParser Methods. + (line 23) +* reset() (in module turtle): More drawing control. + (line 6) +* reset() (threading.Barrier method): Barrier objects. (line 71) +* reset() (xml.dom.pulldom.DOMEventStream method): DOMEventStream Objects. + (line 37) +* reset() (xml.sax.xmlreader.IncrementalParser method): IncrementalParser Objects. + (line 19) +* resetbuffer() (code.InteractiveConsole method): Interactive Console Objects. + (line 41) +* resetscreen() (in module turtle): Window control. (line 59) +* resetty() (in module curses): Functions<6>. (line 421) +* resetwarnings() (in module warnings): Available Functions. + (line 129) +* resize_term() (in module curses): Functions<6>. (line 426) +* resize() (curses.window method): Window Objects. (line 492) +* resize() (in module ctypes): Utility functions. (line 192) +* resize() (mmap.mmap method): mmap — Memory-mapped file support. + (line 264) +* resizemode() (in module turtle): Appearance. (line 24) +* resizeterm() (in module curses): Functions<6>. (line 436) +* resolution (datetime.date attribute): date Objects. (line 109) +* resolution (datetime.datetime attribute): datetime Objects. + (line 298) +* resolution (datetime.time attribute): time Objects. (line 42) +* resolution (datetime.timedelta attribute): timedelta Objects. + (line 99) +* resolve_bases() (in module types): Dynamic Type Creation. + (line 58) +* resolve_name() (in module importlib.util): importlib util – Utility code for importers. + (line 80) +* resolve_name() (in module pkgutil): pkgutil — Package extension utility. + (line 211) +* resolve() (pathlib.Path method): Expanding and resolving paths. + (line 49) +* resolveEntity() (xml.sax.handler.EntityResolver method): EntityResolver Objects. + (line 6) +* resource_path() (importlib.abc.ResourceReader method): importlib abc – Abstract base classes related to import. + (line 478) +* resource_path() (importlib.resources.abc.ResourceReader method): importlib resources abc – Abstract base classes for resources. + (line 55) +* ResourceDenied: test support — Utilities for the Python test suite. + (line 22) +* ResourceLoader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 175) +* ResourceReader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 433) +* ResourceReader (class in importlib.resources.abc): importlib resources abc – Abstract base classes for resources. + (line 12) +* ResourceWarning: Warnings. (line 81) +* response() (imaplib.IMAP4 method): IMAP4 Objects. (line 218) +* ResponseNotReady: http client — HTTP protocol client. + (line 173) +* responses (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 179) +* responses (in module http.client): http client — HTTP protocol client. + (line 208) +* restart (pdb command): Debugger Commands. (line 416) +* restart_events() (in module sys.monitoring): Disabling events. + (line 21) +* restore() (in module difflib): difflib — Helpers for computing deltas. + (line 271) +* restore() (test.support.SaveSignals method): test support — Utilities for the Python test suite. + (line 775) +* RESTRICTED (C macro): Member flags. (line 32) +* restricted; execution: Builtins and restricted execution. + (line 6) +* restype (ctypes._CFuncPtr attribute): Foreign functions. (line 32) +* result() (asyncio.Future method): Future Object. (line 32) +* result() (asyncio.Task method): Task Object. (line 73) +* result() (concurrent.futures.Future method): Future Objects. + (line 37) +* results() (trace.Trace method): Programmatic Interface. + (line 40) +* RESUME (opcode): Python Bytecode Instructions. + (line 1227) +* resume_reading() (asyncio.ReadTransport method): Read-only Transports. + (line 21) +* resume_writing() (asyncio.BaseProtocol method): Base Protocol. + (line 44) +* retr() (poplib.POP3 method): POP3 Objects. (line 63) +* retrbinary() (ftplib.FTP method): FTP objects. (line 175) +* retrieve() (urllib.request.URLopener method): Legacy interface. + (line 112) +* retrlines() (ftplib.FTP method): FTP objects. (line 200) +* RETRY (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 149) +* RETRYCANCEL (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 176) +* Return (class in ast): Function and class definitions. + (line 114) +* return (pdb command): Debugger Commands. (line 222) +* return_annotation (inspect.Signature attribute): Introspecting callables with the Signature object. + (line 116) +* RETURN_CONST (opcode): Python Bytecode Instructions. + (line 414) +* RETURN_GENERATOR (opcode): Python Bytecode Instructions. + (line 1252) +* return_ok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects. + (line 18) +* RETURN_VALUE (opcode): Python Bytecode Instructions. + (line 410) +* return_value (unittest.mock.Mock attribute): The Mock Class. + (line 344) +* returncode (asyncio.subprocess.Process attribute): Interacting with Subprocesses. + (line 146) +* returncode (subprocess.CalledProcessError attribute): Using the subprocess Module. + (line 211) +* returncode (subprocess.CompletedProcess attribute): Using the subprocess Module. + (line 110) +* returncode (subprocess.Popen attribute): Popen Objects. (line 149) +* retval (pdb command): Debugger Commands. (line 435) +* reveal_type() (in module typing): Functions and decorators. + (line 82) +* reverse_order() (pstats.Stats method): The Stats Class. (line 157) +* reverse_pointer (ipaddress.IPv4Address attribute): Address objects. + (line 77) +* reverse_pointer (ipaddress.IPv6Address attribute): Address objects. + (line 269) +* reverse() (array.array method): array — Efficient arrays of numeric values. + (line 230) +* reverse() (collections.deque method): deque objects. (line 102) +* reverse() (sequence method): Mutable Sequence Types. + (line 16) +* Reversible (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 49) +* Reversible (class in typing): Aliases to other ABCs in collections abc. + (line 60) +* revert() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects. + (line 142) +* rewind() (wave.Wave_read method): Wave_read Objects. (line 57) +* RFC_4122 (in module uuid): uuid — UUID objects according to RFC 4122. + (line 231) +* RFC; RFC 1123: Functions<5>. (line 749) +* RFC; RFC 1123 <1>: Functions<5>. (line 760) +* RFC; RFC 1123 <2>: Functions<5>. (line 775) +* RFC; RFC 1321: hashlib — Secure hashes and message digests. + (line 15) +* RFC; RFC 1422: Certificates. (line 38) +* RFC; RFC 1422 <1>: TLS 1 3. (line 41) +* RFC; RFC 1521: Security Considerations<2>. + (line 18) +* RFC; RFC 1521 <1>: quopri — Encode and decode MIME quoted-printable data. + (line 11) +* RFC; RFC 1521 <2>: quopri — Encode and decode MIME quoted-printable data. + (line 37) +* RFC; RFC 1522: binascii — Convert between binary and ASCII. + (line 86) +* RFC; RFC 1522 <1>: quopri — Encode and decode MIME quoted-printable data. + (line 25) +* RFC; RFC 1522 <2>: quopri — Encode and decode MIME quoted-printable data. + (line 39) +* RFC; RFC 1730: imaplib — IMAP4 protocol client. + (line 14) +* RFC; RFC 1738: URL Quoting. (line 187) +* RFC; RFC 1750: Random generation. (line 34) +* RFC; RFC 1808: urllib<2>. (line 23) +* RFC; RFC 1808 <1>: urllib parse — Parse URLs into components. + (line 34) +* RFC; RFC 1808 <2>: URL Parsing. (line 42) +* RFC; RFC 1808 <3>: URL Quoting. (line 181) +* RFC; RFC 1869: smtplib — SMTP protocol client. + (line 13) +* RFC; RFC 1869 <1>: smtplib — SMTP protocol client. + (line 191) +* RFC; RFC 1870: smtpd<4>. (line 6) +* RFC; RFC 1939: poplib — POP3 protocol client. + (line 11) +* RFC; RFC 1939 <1>: poplib — POP3 protocol client. + (line 13) +* RFC; RFC 2033: New and Improved Modules<2>. + (line 568) +* RFC; RFC 2045: email — An email and MIME handling package. + (line 15) +* RFC; RFC 2045 <1>: email message Representing an email message. + (line 316) +* RFC; RFC 2045 <2>: email message Representing an email message. + (line 318) +* RFC; RFC 2045 <3>: email message Representing an email message. + (line 321) +* RFC; RFC 2045 <4>: email headerregistry Custom Header Objects. + (line 239) +* RFC; RFC 2045 <5>: email headerregistry Custom Header Objects. + (line 297) +* RFC; RFC 2045 <6>: email message Message Representing an email message using the compat32 API. + (line 424) +* RFC; RFC 2045 <7>: email message Message Representing an email message using the compat32 API. + (line 428) +* RFC; RFC 2045 <8>: email message Message Representing an email message using the compat32 API. + (line 431) +* RFC; RFC 2045 <9>: email message Message Representing an email message using the compat32 API. + (line 528) +* RFC; RFC 2045 <10>: email header Internationalized headers. + (line 31) +* RFC; RFC 2045 <11>: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 24) +* RFC; RFC 2045 <12>: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 25) +* RFC; RFC 2045 <13>: Legacy Interface. (line 29) +* RFC; RFC 2045 <14>: Legacy Interface. (line 37) +* RFC; RFC 2045 Section 6.8: Binary Objects. (line 31) +* RFC; RFC 2046: email — An email and MIME handling package. + (line 15) +* RFC; RFC 2046 <1>: Content Manager Instances. + (line 93) +* RFC; RFC 2046 <2>: email header Internationalized headers. + (line 32) +* RFC; RFC 2047: PEP 3333 Python Web Server Gateway Interface v1 0 1. + (line 21) +* RFC; RFC 2047 <1>: email<6>. (line 27) +* RFC; RFC 2047 <2>: email — An email and MIME handling package. + (line 16) +* RFC; RFC 2047 <3>: email policy Policy Objects. + (line 364) +* RFC; RFC 2047 <4>: email policy Policy Objects. + (line 370) +* RFC; RFC 2047 <5>: email headerregistry Custom Header Objects. + (line 78) +* RFC; RFC 2047 <6>: email headerregistry Custom Header Objects. + (line 123) +* RFC; RFC 2047 <7>: email headerregistry Custom Header Objects. + (line 128) +* RFC; RFC 2047 <8>: email header Internationalized headers. + (line 32) +* RFC; RFC 2047 <9>: email header Internationalized headers. + (line 55) +* RFC; RFC 2047 <10>: email header Internationalized headers. + (line 117) +* RFC; RFC 2047 <11>: email header Internationalized headers. + (line 141) +* RFC; RFC 2047 <12>: email utils Miscellaneous utilities. + (line 78) +* RFC; RFC 2060: imaplib — IMAP4 protocol client. + (line 13) +* RFC; RFC 2060 <1>: IMAP4 Objects. (line 317) +* RFC; RFC 2068: http cookies — HTTP state management. + (line 16) +* RFC; RFC 2104: New and Improved Modules<3>. + (line 35) +* RFC; RFC 2104 <1>: hmac — Keyed-Hashing for Message Authentication. + (line 10) +* RFC; RFC 2109: http cookies — HTTP state management. + (line 15) +* RFC; RFC 2109 <1>: http cookies — HTTP state management. + (line 36) +* RFC; RFC 2109 <2>: http cookies — HTTP state management. + (line 67) +* RFC; RFC 2109 <3>: Morsel Objects. (line 8) +* RFC; RFC 2109 <4>: Morsel Objects. (line 11) +* RFC; RFC 2109 <5>: Morsel Objects. (line 95) +* RFC; RFC 2109 <6>: Morsel Objects. (line 107) +* RFC; RFC 2109 <7>: http cookiejar — Cookie handling for HTTP clients. + (line 18) +* RFC; RFC 2109 <8>: http cookiejar — Cookie handling for HTTP clients. + (line 103) +* RFC; RFC 2109 <9>: http cookiejar — Cookie handling for HTTP clients. + (line 115) +* RFC; RFC 2109 <10>: http cookiejar — Cookie handling for HTTP clients. + (line 142) +* RFC; RFC 2109 <11>: DefaultCookiePolicy Objects. + (line 86) +* RFC; RFC 2109 <12>: Cookie Objects<2>. (line 11) +* RFC; RFC 2109 <13>: Cookie Objects<2>. (line 23) +* RFC; RFC 2109 <14>: Cookie Objects<2>. (line 74) +* RFC; RFC 2183: email — An email and MIME handling package. + (line 16) +* RFC; RFC 2183 <1>: email message Representing an email message. + (line 460) +* RFC; RFC 2183 <2>: email message Message Representing an email message using the compat32 API. + (line 635) +* RFC; RFC 2231: Library<3>. (line 21) +* RFC; RFC 2231 <1>: Library<14>. (line 135) +* RFC; RFC 2231 <2>: email — An email and MIME handling package. + (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 365) +* RFC; RFC 2231 <6>: email message Message Representing an email message using the compat32 API. + (line 387) +* RFC; RFC 2231 <7>: email message Message Representing an email message using the compat32 API. + (line 391) +* RFC; RFC 2231 <8>: email message Message Representing an email message using the compat32 API. + (line 493) +* RFC; RFC 2231 <9>: email message Message Representing an email message using the compat32 API. + (line 501) +* RFC; RFC 2231 <10>: email message Message Representing an email message using the compat32 API. + (line 535) +* RFC; RFC 2231 <11>: email header Internationalized headers. + (line 32) +* RFC; RFC 2231 <12>: email utils Miscellaneous utilities. + (line 189) +* RFC; RFC 2231 <13>: email utils Miscellaneous utilities. + (line 194) +* 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 219) +* RFC; RFC 2295: HTTP status codes. (line 184) +* RFC; RFC 2324: HTTP status codes. (line 133) +* RFC; RFC 2342: New and Improved Modules<3>. + (line 94) +* RFC; RFC 2342 <1>: IMAP4 Objects. (line 164) +* RFC; RFC 2368: URL Quoting. (line 177) +* RFC; RFC 2373: Address objects. (line 95) +* RFC; RFC 2373 <1>: Address objects. (line 161) +* RFC; RFC 2373 <2>: Address objects. (line 181) +* RFC; RFC 2396: urllib parse<5>. (line 6) +* RFC; RFC 2396 <1>: urllib<2>. (line 24) +* RFC; RFC 2396 <2>: URL Parsing. (line 257) +* RFC; RFC 2396 <3>: URL Quoting. (line 25) +* RFC; RFC 2396 <4>: URL Quoting. (line 172) +* RFC; RFC 2397: DataHandler Objects. + (line 9) +* RFC; RFC 2449: POP3 Objects. (line 26) +* RFC; RFC 2487: New and Improved Modules<3>. + (line 86) +* RFC; RFC 2518: HTTP status codes. (line 19) +* RFC; RFC 2595: poplib — POP3 protocol client. + (line 14) +* RFC; RFC 2595 <1>: POP3 Objects. (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 115) +* RFC; RFC 2616 <2>: wsgiref validate — WSGI conformance checker. + (line 27) +* RFC; RFC 2616 <3>: HTTPRedirectHandler Objects. + (line 8) +* RFC; RFC 2616 <4>: HTTPRedirectHandler Objects. + (line 28) +* RFC; RFC 2616 <5>: Legacy interface. (line 163) +* RFC; RFC 2616 <6>: urllib error — Exception classes raised by urllib request. + (line 45) +* RFC; RFC 2616 <7>: Introduction<16>. (line 34) +* RFC; RFC 2616 <8>: HTTPError. (line 15) +* RFC; RFC 2616 <9>: Error Codes. (line 11) +* RFC; RFC 2616 Section 14.23: HTTPConnection Objects. + (line 31) +* RFC; RFC 2616 Section 5.1.2: HTTPConnection Objects. + (line 13) +* RFC; RFC 2616 Section 5.1.2 <1>: HTTPConnection Objects. + (line 32) +* RFC; RFC 2640: Changes in the Python API<4>. + (line 36) +* RFC; RFC 2640 <1>: Tests<43>. (line 22) +* RFC; RFC 2640 <2>: ftplib — FTP protocol client. + (line 18) +* RFC; RFC 2640 <3>: FTP objects. (line 64) +* RFC; RFC 2640 <4>: FTP_TLS objects. (line 64) +* RFC; RFC 2732: urllib parse<6>. (line 10) +* RFC; RFC 2732 <1>: New and Improved Modules. + (line 643) +* RFC; RFC 2732 <2>: URL Quoting. (line 168) +* RFC; RFC 2774: HTTP status codes. (line 193) +* RFC; RFC 2818: ssl<12>. (line 16) +* RFC; RFC 2821: email — An email and MIME handling package. + (line 12) +* RFC; RFC 2822: New and Improved Modules<3>. + (line 98) +* RFC; RFC 2822 <1>: Batteries Included. (line 16) +* RFC; RFC 2822 <2>: Functions<5>. (line 751) +* RFC; RFC 2822 <3>: Functions<5>. (line 762) +* RFC; RFC 2822 <4>: Functions<5>. (line 462) +* RFC; RFC 2822 <5>: Functions<5>. (line 777) +* RFC; RFC 2822 <6>: email message Message Representing an email message using the compat32 API. + (line 277) +* RFC; RFC 2822 <7>: email header Internationalized headers. + (line 20) +* RFC; RFC 2822 <8>: email header Internationalized headers. + (line 23) +* RFC; RFC 2822 <9>: email header Internationalized headers. + (line 31) +* RFC; RFC 2822 <10>: email header Internationalized headers. + (line 88) +* RFC; RFC 2822 <11>: email header Internationalized headers. + (line 116) +* RFC; RFC 2822 <12>: email header Internationalized headers. + (line 134) +* RFC; RFC 2822 <13>: email utils Miscellaneous utilities. + (line 29) +* RFC; RFC 2822 <14>: email utils Miscellaneous utilities. + (line 109) +* RFC; RFC 2822 <15>: email utils Miscellaneous utilities. + (line 112) +* RFC; RFC 2822 <16>: email utils Miscellaneous utilities. + (line 237) +* RFC; RFC 2822 <17>: email utils Miscellaneous utilities. + (line 155) +* RFC; RFC 2822 <18>: Message objects. (line 17) +* RFC; RFC 2822 <19>: http client — HTTP protocol client. + (line 114) +* RFC; RFC 2822 <20>: http server — HTTP servers. + (line 116) +* RFC; RFC 2964: http cookiejar — Cookie handling for HTTP clients. + (line 155) +* RFC; RFC 2965: urllib request — Extensible library for opening URLs. + (line 233) +* RFC; RFC 2965 <1>: urllib request — Extensible library for opening URLs. + (line 241) +* RFC; RFC 2965 <2>: Request Objects. (line 50) +* RFC; RFC 2965 <3>: http cookiejar — Cookie handling for HTTP clients. + (line 16) +* RFC; RFC 2965 <4>: http cookiejar — Cookie handling for HTTP clients. + (line 103) +* RFC; RFC 2965 <5>: http cookiejar — Cookie handling for HTTP clients. + (line 115) +* RFC; RFC 2965 <6>: http cookiejar — Cookie handling for HTTP clients. + (line 144) +* RFC; RFC 2965 <7>: http cookiejar — Cookie handling for HTTP clients. + (line 146) +* RFC; RFC 2965 <8>: http cookiejar — Cookie handling for HTTP clients. + (line 153) +* RFC; RFC 2965 <9>: FileCookieJar subclasses and co-operation with web browsers. + (line 16) +* RFC; RFC 2965 <10>: CookiePolicy Objects. + (line 74) +* RFC; RFC 2965 <11>: CookiePolicy Objects. + (line 79) +* RFC; RFC 2965 <12>: DefaultCookiePolicy Objects. + (line 8) +* RFC; RFC 2965 <13>: DefaultCookiePolicy Objects. + (line 90) +* RFC; RFC 2965 <14>: DefaultCookiePolicy Objects. + (line 101) +* RFC; RFC 2965 <15>: DefaultCookiePolicy Objects. + (line 105) +* RFC; RFC 2965 <16>: DefaultCookiePolicy Objects. + (line 114) +* RFC; RFC 2965 <17>: DefaultCookiePolicy Objects. + (line 151) +* RFC; RFC 2965 <18>: Cookie Objects<2>. (line 23) +* RFC; RFC 2965 <19>: Examples<29>. (line 25) +* RFC; RFC 3056: Address objects. (line 316) +* RFC; RFC 3164: Logging to syslog with RFC5424 support. + (line 7) +* RFC; RFC 3171: Address objects. (line 94) +* RFC; RFC 3207: New and Improved Modules<2>. + (line 573) +* RFC; RFC 3229: HTTP status codes. (line 52) +* RFC; RFC 3280: SSL Sockets. (line 157) +* RFC; RFC 3330: Address objects. (line 180) +* RFC; RFC 3339: Displaying the date/time in messages. + (line 18) +* RFC; RFC 3454: Security<18>. (line 19) +* RFC; RFC 3454 <1>: stringprep — Internet String Preparation. + (line 17) +* RFC; RFC 3454 <2>: stringprep — Internet String Preparation. + (line 26) +* RFC; RFC 3490: Text Encodings. (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 57) +* RFC; RFC 3490 <3>: encodings idna — Internationalized Domain Names in Applications. + (line 62) +* RFC; RFC 3490 Section 3.1: encodings idna — Internationalized Domain Names in Applications. + (line 27) +* RFC; RFC 3491: Security<18>. (line 21) +* RFC; RFC 3492: Text Encodings. (line 36) +* RFC; RFC 3492 <1>: encodings idna — Internationalized Domain Names in Applications. + (line 7) +* RFC; RFC 3493: Example<7>. (line 227) +* RFC; RFC 3501: IMAP4 Objects. (line 328) +* RFC; RFC 3542: Library<56>. (line 351) +* RFC; RFC 3542 <1>: Other functions<2>. (line 341) +* RFC; RFC 3548: New Improved and Deprecated Modules<3>. + (line 16) +* RFC; RFC 3548 <1>: binascii — Convert between binary and ASCII. + (line 50) +* RFC; RFC 3548 <2>: binascii — Convert between binary and ASCII. + (line 65) +* RFC; RFC 3596 Section 2.5: Library<9>. (line 14) +* RFC; RFC 3659: FTP objects. (line 289) +* RFC; RFC 3879: Address objects. (line 176) +* RFC; RFC 3879 <1>: Address objects. (line 294) +* RFC; RFC 3927: Address objects. (line 185) +* RFC; RFC 3986: urllib parse. (line 17) +* RFC; RFC 3986 <1>: urllib parse<3>. (line 7) +* RFC; RFC 3986 <2>: urllib parse<4>. (line 7) +* RFC; RFC 3986 <3>: urllib parse<5>. (line 6) +* RFC; RFC 3986 <4>: urllib<2>. (line 22) +* RFC; RFC 3986 <5>: New and Improved Modules. + (line 622) +* RFC; RFC 3986 <6>: Porting to Python 2 7. + (line 80) +* RFC; RFC 3986 <7>: urllib parse — Parse URLs into components. + (line 35) +* RFC; RFC 3986 <8>: URL Parsing. (line 142) +* RFC; RFC 3986 <9>: URL Parsing. (line 375) +* RFC; RFC 3986 <10>: URL parsing security. + (line 25) +* RFC; RFC 3986 <11>: URL Quoting. (line 25) +* RFC; RFC 3986 <12>: URL Quoting. (line 160) +* RFC; RFC 3986 <13>: http server — HTTP servers. + (line 101) +* RFC; RFC 4007: Address objects. (line 237) +* RFC; RFC 4007 <1>: Address objects. (line 308) +* RFC; RFC 4086: TLS 1 3. (line 45) +* RFC; RFC 4122: New Improved and Removed Modules. + (line 416) +* RFC; RFC 4122 <1>: New Improved and Removed Modules. + (line 421) +* RFC; RFC 4122 <2>: uuid — UUID objects according to RFC 4122. + (line 6) +* RFC; RFC 4122 <3>: uuid — UUID objects according to RFC 4122. + (line 15) +* RFC; RFC 4122 <4>: uuid — UUID objects according to RFC 4122. + (line 73) +* RFC; RFC 4122 <5>: uuid — UUID objects according to RFC 4122. + (line 138) +* RFC; RFC 4122 <6>: uuid — UUID objects according to RFC 4122. + (line 167) +* RFC; RFC 4122 <7>: uuid — UUID objects according to RFC 4122. + (line 233) +* RFC; RFC 4122 <8>: uuid — UUID objects according to RFC 4122. + (line 246) +* RFC; RFC 4180: csv — CSV File Reading and Writing. + (line 13) +* RFC; RFC 4193: Address objects. (line 296) +* RFC; RFC 4217: FTP_TLS objects. (line 11) +* RFC; RFC 4291: Library<20>. (line 1075) +* RFC; RFC 4291 <1>: Library<36>. (line 653) +* RFC; RFC 4291 <2>: Address objects. (line 191) +* RFC; RFC 4291 <3>: Address objects. (line 231) +* RFC; RFC 4380: Address objects. (line 323) +* RFC; RFC 4627: json — JSON encoder and decoder. + (line 11) +* RFC; RFC 4627 <1>: Top-level Non-Object Non-Array Values. + (line 6) +* RFC; RFC 4648: Documentation<31>. (line 32) +* RFC; RFC 4648 <1>: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 12) +* RFC; RFC 4648 <2>: base64 — Base16 Base32 Base64 Base85 Data Encodings. + (line 18) +* RFC; RFC 4648 <3>: RFC 4648 Encodings. (line 6) +* RFC; RFC 4648 <4>: RFC 4648 Encodings. (line 87) +* RFC; RFC 4648 <5>: RFC 4648 Encodings. (line 102) +* RFC; RFC 4648 <6>: RFC 4648 Encodings. (line 109) +* RFC; RFC 4648 <7>: Security Considerations<2>. + (line 6) +* RFC; RFC 4648 <8>: Security Considerations<3>. + (line 8) +* RFC; RFC 4918: HTTP status codes. (line 46) +* RFC; RFC 4918 <1>: HTTP status codes. (line 142) +* RFC; RFC 4918 <2>: HTTP status codes. (line 145) +* RFC; RFC 4918 <3>: HTTP status codes. (line 187) +* RFC; RFC 4954: SMTP Objects. (line 135) +* RFC; RFC 4954 <1>: SMTP Objects. (line 158) +* RFC; RFC 5161: imaplib<2>. (line 11) +* RFC; RFC 5161 <1>: IMAP4 Objects. (line 86) +* RFC; RFC 5246: Constants<9>. (line 515) +* RFC; RFC 5246 <1>: TLS 1 3. (line 53) +* RFC; RFC 5280: ssl. (line 10) +* RFC; RFC 5280 <1>: Other Changes. (line 20) +* RFC; RFC 5280 <2>: Changes in the Python API<9>. + (line 95) +* RFC; RFC 5280 <3>: Context creation. (line 40) +* RFC; RFC 5280 <4>: Context creation. (line 65) +* RFC; RFC 5280 <5>: Certificate handling. + (line 22) +* RFC; RFC 5280 <6>: TLS 1 3. (line 49) +* RFC; RFC 5321: smtpd<4>. (line 6) +* RFC; RFC 5321 <1>: email headerregistry Custom Header Objects. + (line 453) +* RFC; RFC 5322: email — An email and MIME handling package. + (line 14) +* RFC; RFC 5322 <1>: email message Representing an email message. + (line 20) +* RFC; RFC 5322 <2>: email message Representing an email message. + (line 31) +* RFC; RFC 5322 <3>: Parser API. (line 42) +* RFC; RFC 5322 <4>: email generator Generating MIME documents. + (line 101) +* RFC; RFC 5322 <5>: email generator Generating MIME documents. + (line 194) +* RFC; RFC 5322 <6>: email policy Policy Objects. + (line 149) +* RFC; RFC 5322 <7>: email policy Policy Objects. + (line 343) +* RFC; RFC 5322 <8>: email policy Policy Objects. + (line 364) +* RFC; RFC 5322 <9>: email policy Policy Objects. + (line 370) +* RFC; RFC 5322 <10>: email policy Policy Objects. + (line 382) +* RFC; RFC 5322 <11>: email policy Policy Objects. + (line 415) +* RFC; RFC 5322 <12>: email errors Exception and Defect classes. + (line 28) +* RFC; RFC 5322 <13>: email headerregistry Custom Header Objects. + (line 16) +* RFC; RFC 5322 <14>: email headerregistry Custom Header Objects. + (line 117) +* RFC; RFC 5322 <15>: email headerregistry Custom Header Objects. + (line 122) +* RFC; RFC 5322 <16>: email headerregistry Custom Header Objects. + (line 123) +* RFC; RFC 5322 <17>: email headerregistry Custom Header Objects. + (line 138) +* RFC; RFC 5322 <18>: email headerregistry Custom Header Objects. + (line 159) +* RFC; RFC 5322 <19>: email headerregistry Custom Header Objects. + (line 416) +* RFC; RFC 5322 <20>: email headerregistry Custom Header Objects. + (line 450) +* RFC; RFC 5322 <21>: email headerregistry Custom Header Objects. + (line 484) +* RFC; RFC 5322 <22>: email message Message Representing an email message using the compat32 API. + (line 21) +* RFC; RFC 5322 <23>: SMTP Objects. (line 314) +* RFC; RFC 5424: SysLogHandler. (line 71) +* RFC; RFC 5424 <1>: Inserting a BOM into messages sent to a SysLogHandler. + (line 6) +* RFC; RFC 5424 <2>: Inserting a BOM into messages sent to a SysLogHandler. + (line 19) +* RFC; RFC 5424 <3>: Inserting a BOM into messages sent to a SysLogHandler. + (line 43) +* RFC; RFC 5424 <4>: Logging to syslog with RFC5424 support. + (line 6) +* RFC; RFC 5424 Section 6: Inserting a BOM into messages sent to a SysLogHandler. + (line 9) +* RFC; RFC 5735: Address objects. (line 160) +* RFC; RFC 5789: HTTP methods. (line 37) +* RFC; RFC 5842: HTTP status codes. (line 49) +* RFC; RFC 5842 <1>: HTTP status codes. (line 190) +* RFC; RFC 5891: encodings idna — Internationalized Domain Names in Applications. + (line 11) +* RFC; RFC 5894: Security<18>. (line 20) +* RFC; RFC 5895: encodings idna — Internationalized Domain Names in Applications. + (line 11) +* RFC; RFC 5929: SSL Sockets. (line 267) +* RFC; RFC 6066: Constants<9>. (line 409) +* RFC; RFC 6066 <1>: SSL Contexts. (line 290) +* RFC; RFC 6066 <2>: TLS 1 3. (line 57) +* RFC; RFC 6152: smtpd<2>. (line 15) +* RFC; RFC 6531: email<3>. (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 386) +* RFC; RFC 6531 <5>: smtplib — SMTP protocol client. + (line 68) +* RFC; RFC 6532: email<3>. (line 18) +* RFC; RFC 6532 <1>: email — An email and MIME handling package. + (line 14) +* RFC; RFC 6532 <2>: email message Representing an email message. + (line 20) +* RFC; RFC 6532 <3>: Parser API. (line 43) +* RFC; RFC 6532 <4>: email policy Policy Objects. + (line 384) +* RFC; RFC 6585: HTTP status codes. (line 154) +* RFC; RFC 6585 <1>: HTTP status codes. (line 157) +* RFC; RFC 6585 <2>: HTTP status codes. (line 160) +* RFC; RFC 6585 <3>: HTTP status codes. (line 196) +* RFC; RFC 6855: imaplib<2>. (line 12) +* RFC; RFC 6855 <1>: imaplib<2>. (line 14) +* RFC; RFC 6855 <2>: IMAP4 Objects. (line 88) +* RFC; RFC 6855 <3>: IMAP4 Objects. (line 90) +* RFC; RFC 6856: poplib<2>. (line 6) +* RFC; RFC 6856 <1>: POP3 Objects. (line 109) +* RFC; RFC 7159: json — JSON encoder and decoder. + (line 10) +* RFC; RFC 7159 <1>: Standard Compliance and Interoperability. + (line 6) +* RFC; RFC 7159 <2>: Top-level Non-Object Non-Array Values. + (line 9) +* RFC; RFC 7230: urllib request — Extensible library for opening URLs. + (line 204) +* RFC; RFC 7230 <1>: HTTPConnection Objects. + (line 192) +* RFC; RFC 7301: Application-Layer Protocol Negotiation Support. + (line 10) +* RFC; RFC 7301 <1>: Constants<9>. (line 386) +* RFC; RFC 7301 <2>: SSL Contexts. (line 258) +* RFC; RFC 7525: TLS 1 3. (line 65) +* RFC; RFC 7538: Library<35>. (line 171) +* RFC; RFC 7693: BLAKE2. (line 6) +* RFC; RFC 7725: HTTP status codes. (line 163) +* RFC; RFC 7914: Key derivation. (line 53) +* RFC; RFC 8089: Parsing and generating URIs. + (line 7) +* RFC; RFC 821: smtplib — SMTP protocol client. + (line 12) +* RFC; RFC 821 <1>: smtplib — SMTP protocol client. + (line 186) +* RFC; RFC 822: New and Improved Modules<3>. + (line 98) +* RFC; RFC 822 <1>: Functions<5>. (line 744) +* RFC; RFC 822 <2>: Functions<5>. (line 747) +* RFC; RFC 822 <3>: Functions<5>. (line 755) +* RFC; RFC 822 <4>: Functions<5>. (line 758) +* RFC; RFC 822 <5>: Functions<5>. (line 770) +* RFC; RFC 822 <6>: Functions<5>. (line 773) +* RFC; RFC 822 <7>: email Examples. (line 36) +* RFC; RFC 822 <8>: email header Internationalized headers. + (line 21) +* RFC; RFC 822 <9>: HTTPConnection Objects. + (line 179) +* RFC; RFC 822 <10>: SMTP Objects. (line 94) +* RFC; RFC 822 <11>: SMTP Objects. (line 229) +* RFC; RFC 822 <12>: SMTP Objects. (line 230) +* RFC; RFC 822 <13>: SMTP Example. (line 10) +* RFC; RFC 822 <14>: The GNUTranslations class. + (line 13) +* RFC; RFC 8297: HTTP status codes. (line 22) +* RFC; RFC 8305: Opening network connections. + (line 77) +* RFC; RFC 8305 <1>: Opening network connections. + (line 86) +* RFC; RFC 8470: HTTP status codes. (line 148) +* RFC; RFC 850: Library<6>. (line 191) +* RFC; RFC 9110: Library<6>. (line 191) +* RFC; RFC 9110 <1>: HTTP status codes. (line 13) +* RFC; RFC 9110 <2>: HTTP status codes. (line 16) +* RFC; RFC 9110 <3>: HTTP status codes. (line 25) +* RFC; RFC 9110 <4>: HTTP status codes. (line 28) +* RFC; RFC 9110 <5>: HTTP status codes. (line 31) +* RFC; RFC 9110 <6>: HTTP status codes. (line 34) +* RFC; RFC 9110 <7>: HTTP status codes. (line 37) +* RFC; RFC 9110 <8>: HTTP status codes. (line 40) +* RFC; RFC 9110 <9>: HTTP status codes. (line 43) +* RFC; RFC 9110 <10>: HTTP status codes. (line 55) +* RFC; RFC 9110 <11>: HTTP status codes. (line 58) +* RFC; RFC 9110 <12>: HTTP status codes. (line 61) +* RFC; RFC 9110 <13>: HTTP status codes. (line 64) +* RFC; RFC 9110 <14>: HTTP status codes. (line 67) +* RFC; RFC 9110 <15>: HTTP status codes. (line 70) +* RFC; RFC 9110 <16>: HTTP status codes. (line 73) +* RFC; RFC 9110 <17>: HTTP status codes. (line 76) +* RFC; RFC 9110 <18>: HTTP status codes. (line 79) +* RFC; RFC 9110 <19>: HTTP status codes. (line 82) +* RFC; RFC 9110 <20>: HTTP status codes. (line 85) +* RFC; RFC 9110 <21>: HTTP status codes. (line 88) +* RFC; RFC 9110 <22>: HTTP status codes. (line 91) +* RFC; RFC 9110 <23>: HTTP status codes. (line 94) +* RFC; RFC 9110 <24>: HTTP status codes. (line 97) +* RFC; RFC 9110 <25>: HTTP status codes. (line 100) +* RFC; RFC 9110 <26>: HTTP status codes. (line 103) +* RFC; RFC 9110 <27>: HTTP status codes. (line 106) +* RFC; RFC 9110 <28>: HTTP status codes. (line 109) +* RFC; RFC 9110 <29>: HTTP status codes. (line 112) +* RFC; RFC 9110 <30>: HTTP status codes. (line 115) +* RFC; RFC 9110 <31>: HTTP status codes. (line 118) +* RFC; RFC 9110 <32>: HTTP status codes. (line 121) +* RFC; RFC 9110 <33>: HTTP status codes. (line 124) +* RFC; RFC 9110 <34>: HTTP status codes. (line 127) +* RFC; RFC 9110 <35>: HTTP status codes. (line 130) +* RFC; RFC 9110 <36>: HTTP status codes. (line 136) +* RFC; RFC 9110 <37>: HTTP status codes. (line 139) +* RFC; RFC 9110 <38>: HTTP status codes. (line 151) +* RFC; RFC 9110 <39>: HTTP status codes. (line 166) +* RFC; RFC 9110 <40>: HTTP status codes. (line 169) +* RFC; RFC 9110 <41>: HTTP status codes. (line 172) +* RFC; RFC 9110 <42>: HTTP status codes. (line 175) +* RFC; RFC 9110 <43>: HTTP status codes. (line 178) +* RFC; RFC 9110 <44>: HTTP status codes. (line 181) +* RFC; RFC 9110 <45>: HTTP status category. + (line 15) +* RFC; RFC 9110 <46>: HTTP status category. + (line 18) +* RFC; RFC 9110 <47>: HTTP status category. + (line 21) +* RFC; RFC 9110 <48>: HTTP status category. + (line 24) +* RFC; RFC 9110 <49>: HTTP status category. + (line 27) +* RFC; RFC 9110 <50>: HTTP methods. (line 13) +* RFC; RFC 9110 <51>: HTTP methods. (line 16) +* RFC; RFC 9110 <52>: HTTP methods. (line 19) +* RFC; RFC 9110 <53>: HTTP methods. (line 22) +* RFC; RFC 9110 <54>: HTTP methods. (line 25) +* RFC; RFC 9110 <55>: HTTP methods. (line 28) +* RFC; RFC 9110 <56>: HTTP methods. (line 31) +* RFC; RFC 9110 <57>: HTTP methods. (line 34) +* RFC; RFC 9239: Library<28>. (line 76) +* RFC; RFC 9562 Section 6.10-3: Library<2>. (line 105) +* RFC; RFC 959: ftplib — FTP protocol client. + (line 16) +* rfc2109 (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 72) +* rfc2109_as_netscape (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 83) +* rfc2965 (http.cookiejar.CookiePolicy attribute): CookiePolicy Objects. + (line 72) +* rfile (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 118) +* rfile (socketserver.DatagramRequestHandler attribute): Request Handler Objects. + (line 63) +* rfind() (bytearray method): Bytes and Bytearray Operations. + (line 214) +* rfind() (bytes method): Bytes and Bytearray Operations. + (line 214) +* rfind() (mmap.mmap method): mmap — Memory-mapped file support. + (line 283) +* rfind() (str method): String Methods<2>. (line 453) +* rgb_to_hls() (in module colorsys): colorsys — Conversions between color systems. + (line 36) +* rgb_to_hsv() (in module colorsys): colorsys — Conversions between color systems. + (line 44) +* rgb_to_yiq() (in module colorsys): colorsys — Conversions between color systems. + (line 28) +* rglob() (pathlib.Path method): Reading directories. + (line 78) +* richcmpfunc (C type): Slot Type typedefs. (line 83) +* right (filecmp.dircmp attribute): The dircmp class. (line 49) +* right_list (filecmp.dircmp attribute): The dircmp class. (line 58) +* right_only (filecmp.dircmp attribute): The dircmp class. (line 71) +* right() (in module turtle): Turtle motion. (line 40) +* RIGHTSHIFT (in module token): token — Constants used with Python parse trees. + (line 257) +* RIGHTSHIFTEQUAL (in module token): token — Constants used with Python parse trees. + (line 290) +* rindex() (bytearray method): Bytes and Bytearray Operations. + (line 228) +* rindex() (bytes method): Bytes and Bytearray Operations. + (line 228) +* rindex() (str method): String Methods<2>. (line 460) +* rjust() (bytearray method): Bytes and Bytearray Operations. + (line 345) +* rjust() (bytes method): Bytes and Bytearray Operations. + (line 345) +* rjust() (str method): String Methods<2>. (line 465) +* RLIM_INFINITY (in module resource): Resource Limits. (line 20) +* RLIMIT_AS (in module resource): Resource Limits. (line 148) +* RLIMIT_CORE (in module resource): Resource Limits. (line 91) +* RLIMIT_CPU (in module resource): Resource Limits. (line 98) +* RLIMIT_DATA (in module resource): Resource Limits. (line 110) +* RLIMIT_FSIZE (in module resource): Resource Limits. (line 106) +* RLIMIT_KQUEUES (in module resource): Resource Limits. (line 224) +* RLIMIT_MEMLOCK (in module resource): Resource Limits. (line 138) +* RLIMIT_MSGQUEUE (in module resource): Resource Limits. (line 153) +* RLIMIT_NICE (in module resource): Resource Limits. (line 161) +* RLIMIT_NOFILE (in module resource): Resource Limits. (line 129) +* RLIMIT_NPROC (in module resource): Resource Limits. (line 125) +* RLIMIT_NPTS (in module resource): Resource Limits. (line 216) +* RLIMIT_OFILE (in module resource): Resource Limits. (line 134) +* RLIMIT_RSS (in module resource): Resource Limits. (line 120) +* RLIMIT_RTPRIO (in module resource): Resource Limits. (line 170) +* RLIMIT_RTTIME (in module resource): Resource Limits. (line 178) +* RLIMIT_SBSIZE (in module resource): Resource Limits. (line 195) +* RLIMIT_SIGPENDING (in module resource): Resource Limits. (line 187) +* RLIMIT_STACK (in module resource): Resource Limits. (line 114) +* RLIMIT_SWAP (in module resource): Resource Limits. (line 205) +* RLIMIT_VMEM (in module resource): Resource Limits. (line 142) +* RLock (class in multiprocessing): Synchronization primitives. + (line 102) +* RLock (class in threading): RLock objects. (line 32) +* RLock() (multiprocessing.managers.SyncManager method): Managers. + (line 203) +* rmd() (ftplib.FTP method): FTP objects. (line 348) +* rmdir() (in module os): Files and Directories. + (line 825) +* rmdir() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 111) +* rmdir() (pathlib.Path method): Renaming and deleting. + (line 61) +* rmtree() (in module shutil): Directory and files operations. + (line 264) +* rmtree() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 118) +* RobotFileParser (class in urllib.robotparser): urllib robotparser — Parser for robots txt. + (line 16) +* robots.txt: urllib robotparser — Parser for robots txt. + (line 8) +* rollback() (sqlite3.Connection method): Connection objects. + (line 80) +* rollover() (tempfile.SpooledTemporaryFile method): tempfile — Generate temporary files and directories. + (line 162) +* ROMAN (in module tkinter.font): tkinter font — Tkinter font wrapper. + (line 15) +* root (pathlib.PurePath attribute): Methods and properties. + (line 31) +* rotate() (collections.deque method): deque objects. (line 109) +* rotate() (decimal.Context method): Context objects. (line 512) +* rotate() (decimal.Decimal method): Decimal objects. (line 532) +* rotate() (logging.handlers.BaseRotatingHandler method): BaseRotatingHandler. + (line 75) +* RotatingFileHandler (class in logging.handlers): RotatingFileHandler. + (line 9) +* rotation_filename() (logging.handlers.BaseRotatingHandler method): BaseRotatingHandler. + (line 58) +* rotator (logging.handlers.BaseRotatingHandler attribute): BaseRotatingHandler. + (line 49) +* ROUND_05UP (in module decimal): Rounding modes. (line 34) +* ROUND_CEILING (in module decimal): Rounding modes. (line 6) +* ROUND_DOWN (in module decimal): Rounding modes. (line 10) +* ROUND_FLOOR (in module decimal): Rounding modes. (line 14) +* ROUND_HALF_DOWN (in module decimal): Rounding modes. (line 18) +* ROUND_HALF_EVEN (in module decimal): Rounding modes. (line 22) +* ROUND_HALF_UP (in module decimal): Rounding modes. (line 26) +* ROUND_UP (in module decimal): Rounding modes. (line 30) +* Rounded (class in decimal): Signals. (line 79) +* rounding (decimal.Context attribute): Context objects. (line 128) +* rounds (sys.float_info attribute): sys — System-specific parameters and functions. + (line 675) +* Row (class in sqlite3): Row objects. (line 6) +* row_factory (sqlite3.Connection attribute): Connection objects. + (line 794) +* row_factory (sqlite3.Cursor attribute): Cursor objects. (line 226) +* rowcount (sqlite3.Cursor attribute): Cursor objects. (line 215) +* RPAR (in module token): token — Constants used with Python parse trees. + (line 179) +* rpartition() (bytearray method): Bytes and Bytearray Operations. + (line 240) +* rpartition() (bytes method): Bytes and Bytearray Operations. + (line 240) +* rpartition() (str method): String Methods<2>. (line 472) +* rpc_paths (xmlrpc.server.SimpleXMLRPCRequestHandler attribute): SimpleXMLRPCServer Objects. + (line 64) +* rpop() (poplib.POP3 method): POP3 Objects. (line 47) +* RS (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 115) +* rset() (poplib.POP3 method): POP3 Objects. (line 75) +* RShift (class in ast): Expressions<2>. (line 53) +* rshift() (in module operator): operator — Standard operators as functions. + (line 152) +* rsplit() (bytearray method): Bytes and Bytearray Operations. + (line 357) +* rsplit() (bytes method): Bytes and Bytearray Operations. + (line 357) +* rsplit() (str method): String Methods<2>. (line 480) +* RSQB (in module token): token — Constants used with Python parse trees. + (line 185) +* rstrip() (bytearray method): Bytes and Bytearray Operations. + (line 368) +* rstrip() (bytes method): Bytes and Bytearray Operations. + (line 368) +* rstrip() (str method): String Methods<2>. (line 489) +* rt() (in module turtle): Turtle motion. (line 40) +* RTLD_DEEPBIND (in module os): Miscellaneous System Information. + (line 164) +* RTLD_GLOBAL (in module os): Miscellaneous System Information. + (line 164) +* RTLD_LAZY (in module os): Miscellaneous System Information. + (line 164) +* RTLD_LOCAL (in module os): Miscellaneous System Information. + (line 164) +* RTLD_NODELETE (in module os): Miscellaneous System Information. + (line 164) +* RTLD_NOLOAD (in module os): Miscellaneous System Information. + (line 164) +* RTLD_NOW (in module os): Miscellaneous System Information. + (line 164) +* ruler (cmd.Cmd attribute): Cmd Objects. (line 172) +* run (pdb command): Debugger Commands. (line 416) +* Run script: Format menu Editor window only. + (line 53) +* run_coroutine_threadsafe() (in module asyncio): Scheduling From Other Threads. + (line 6) +* run_docstring_examples() (in module doctest): Basic API. (line 127) +* run_forever() (asyncio.loop method): Running and stopping the loop. + (line 16) +* run_in_executor() (asyncio.loop method): Executing code in thread or process pools. + (line 6) +* run_in_subinterp() (in module test.support): test support — Utilities for the Python test suite. + (line 659) +* run_module() (in module runpy): runpy — Locating and executing Python modules. + (line 27) +* run_path() (in module runpy): runpy — Locating and executing Python modules. + (line 98) +* run_python_until_end() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 30) +* run_script() (modulefinder.ModuleFinder method): modulefinder — Find modules used by a script. + (line 44) +* run_until_complete() (asyncio.loop method): Running and stopping the loop. + (line 6) +* run_with_locale() (in module test.support): test support — Utilities for the Python test suite. + (line 462) +* run_with_tz() (in module test.support): test support — Utilities for the Python test suite. + (line 470) +* run() (asyncio.Runner method): Runner context manager. + (line 36) +* run() (bdb.Bdb method): bdb — Debugger framework. + (line 432) +* run() (contextvars.Context method): Manual Context Management. + (line 64) +* run() (doctest.DocTestRunner method): DocTestRunner objects. + (line 101) +* run() (in module asyncio): Running an asyncio Program. + (line 6) +* run() (in module pdb): pdb — The Python Debugger. + (line 135) +* run() (in module profile): profile and cProfile Module Reference. + (line 9) +* run() (in module subprocess): Using the subprocess Module. + (line 11) +* run() (multiprocessing.Process method): Process and exceptions. + (line 68) +* run() (pdb.Pdb method): pdb — The Python Debugger. + (line 228) +* run() (profile.Profile method): profile and cProfile Module Reference. + (line 108) +* run() (sched.scheduler method): Scheduler Objects. (line 51) +* run() (threading.Thread method): Thread objects. (line 104) +* run() (trace.Trace method): Programmatic Interface. + (line 22) +* run() (unittest.IsolatedAsyncioTestCase method): Test cases. + (line 906) +* run() (unittest.TestCase method): Test cases. (line 83) +* run() (unittest.TestSuite method): Grouping tests. (line 41) +* run() (unittest.TextTestRunner method): Loading and running tests. + (line 506) +* run() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 99) +* runcall() (bdb.Bdb method): bdb — Debugger framework. + (line 449) +* runcall() (in module pdb): pdb — The Python Debugger. + (line 154) +* runcall() (pdb.Pdb method): pdb — The Python Debugger. + (line 228) +* runcall() (profile.Profile method): profile and cProfile Module Reference. + (line 117) +* runcode() (code.InteractiveInterpreter method): Interactive Interpreter Objects. + (line 33) +* runctx() (bdb.Bdb method): bdb — Debugger framework. + (line 444) +* runctx() (in module profile): profile and cProfile Module Reference. + (line 23) +* runctx() (profile.Profile method): profile and cProfile Module Reference. + (line 112) +* runctx() (trace.Trace method): Programmatic Interface. + (line 28) +* runeval() (bdb.Bdb method): bdb — Debugger framework. + (line 438) +* runeval() (in module pdb): pdb — The Python Debugger. + (line 147) +* runeval() (pdb.Pdb method): pdb — The Python Debugger. + (line 228) +* runfunc() (trace.Trace method): Programmatic Interface. + (line 35) +* Runner (class in asyncio): Runner context manager. + (line 6) +* running() (concurrent.futures.Future method): Future Objects. + (line 27) +* runsource() (code.InteractiveInterpreter method): Interactive Interpreter Objects. + (line 6) +* runtime (sys._emscripten_info attribute): sys — System-specific parameters and functions. + (line 355) +* runtime_checkable() (in module typing): Other special directives. + (line 178) +* RuntimeError: Concrete exceptions. + (line 260) +* RuntimeWarning: Warnings. (line 47) +* RUSAGE_BOTH (in module resource): Resource Usage. (line 122) +* RUSAGE_CHILDREN (in module resource): Resource Usage. (line 116) +* RUSAGE_SELF (in module resource): Resource Usage. (line 110) +* RUSAGE_THREAD (in module resource): Resource Usage. (line 128) +* RWF_APPEND (in module os): File Descriptor Operations. + (line 718) +* RWF_DSYNC (in module os): File Descriptor Operations. + (line 698) +* RWF_HIPRI (in module os): File Descriptor Operations. + (line 628) +* RWF_NOWAIT (in module os): File Descriptor Operations. + (line 613) +* RWF_SYNC (in module os): File Descriptor Operations. + (line 708) +* S (in module re): Flags. (line 108) +* S_ENFMT (in module stat): stat — Interpreting stat results. + (line 317) +* S_IEXEC (in module stat): stat — Interpreting stat results. + (line 331) +* S_IFBLK (in module stat): stat — Interpreting stat results. + (line 206) +* S_IFCHR (in module stat): stat — Interpreting stat results. + (line 214) +* S_IFDIR (in module stat): stat — Interpreting stat results. + (line 210) +* S_IFDOOR (in module stat): stat — Interpreting stat results. + (line 222) +* S_IFIFO (in module stat): stat — Interpreting stat results. + (line 218) +* S_IFLNK (in module stat): stat — Interpreting stat results. + (line 198) +* S_IFMT() (in module stat): stat — Interpreting stat results. + (line 78) +* S_IFPORT (in module stat): stat — Interpreting stat results. + (line 228) +* S_IFREG (in module stat): stat — Interpreting stat results. + (line 202) +* S_IFSOCK (in module stat): stat — Interpreting stat results. + (line 194) +* S_IFWHT (in module stat): stat — Interpreting stat results. + (line 234) +* S_IMODE() (in module stat): stat — Interpreting stat results. + (line 71) +* S_IREAD (in module stat): stat — Interpreting stat results. + (line 323) +* S_IRGRP (in module stat): stat — Interpreting stat results. + (line 289) +* S_IROTH (in module stat): stat — Interpreting stat results. + (line 305) +* S_IRUSR (in module stat): stat — Interpreting stat results. + (line 273) +* S_IRWXG (in module stat): stat — Interpreting stat results. + (line 285) +* S_IRWXO (in module stat): stat — Interpreting stat results. + (line 301) +* S_IRWXU (in module stat): stat — Interpreting stat results. + (line 269) +* S_ISBLK() (in module stat): stat — Interpreting stat results. + (line 30) +* S_ISCHR() (in module stat): stat — Interpreting stat results. + (line 25) +* S_ISDIR() (in module stat): stat — Interpreting stat results. + (line 21) +* S_ISDOOR() (in module stat): stat — Interpreting stat results. + (line 50) +* S_ISFIFO() (in module stat): stat — Interpreting stat results. + (line 38) +* S_ISGID (in module stat): stat — Interpreting stat results. + (line 251) +* S_ISLNK() (in module stat): stat — Interpreting stat results. + (line 42) +* S_ISPORT() (in module stat): stat — Interpreting stat results. + (line 56) +* S_ISREG() (in module stat): stat — Interpreting stat results. + (line 34) +* S_ISSOCK() (in module stat): stat — Interpreting stat results. + (line 46) +* S_ISUID (in module stat): stat — Interpreting stat results. + (line 247) +* S_ISVTX (in module stat): stat — Interpreting stat results. + (line 262) +* S_ISWHT() (in module stat): stat — Interpreting stat results. + (line 62) +* S_IWGRP (in module stat): stat — Interpreting stat results. + (line 293) +* S_IWOTH (in module stat): stat — Interpreting stat results. + (line 309) +* S_IWRITE (in module stat): stat — Interpreting stat results. + (line 327) +* S_IWUSR (in module stat): stat — Interpreting stat results. + (line 277) +* S_IXGRP (in module stat): stat — Interpreting stat results. + (line 297) +* S_IXOTH (in module stat): stat — Interpreting stat results. + (line 313) +* S_IXUSR (in module stat): stat — Interpreting stat results. + (line 281) +* safe (uuid.SafeUUID attribute): uuid — UUID objects according to RFC 4122. + (line 33) +* safe_path (sys.flags attribute): sys — System-specific parameters and functions. + (line 575) +* safe_substitute() (string.Template method): Template strings. + (line 50) +* SafeChildWatcher (class in asyncio): Process Watchers. (line 126) +* saferepr() (in module pprint): Functions<4>. (line 101) +* SafeUUID (class in uuid): uuid — UUID objects according to RFC 4122. + (line 29) +* same_files (filecmp.dircmp attribute): The dircmp class. (line 89) +* same_quantum() (decimal.Context method): Context objects. (line 516) +* same_quantum() (decimal.Decimal method): Decimal objects. (line 544) +* samefile() (in module os.path): os path — Common pathname manipulations. + (line 423) +* samefile() (pathlib.Path method): Querying file type and status. + (line 145) +* SameFileError: Directory and files operations. + (line 52) +* sameopenfile() (in module os.path): os path — Common pathname manipulations. + (line 437) +* samesite (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* samestat() (in module os.path): os path — Common pathname manipulations. + (line 446) +* sample() (in module random): Functions for sequences. + (line 70) +* samples() (statistics.NormalDist method): NormalDist objects. + (line 58) +* SATURDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* save() (http.cookiejar.FileCookieJar method): CookieJar and FileCookieJar Objects. + (line 106) +* save() (test.support.SaveSignals method): test support — Utilities for the Python test suite. + (line 770) +* SaveAs (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 60) +* SAVEDCWD (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 15) +* SaveFileDialog (class in tkinter.filedialog): Native Load/Save Dialogs. + (line 145) +* SaveKey() (in module winreg): Functions<13>. (line 395) +* SaveSignals (class in test.support): test support — Utilities for the Python test suite. + (line 765) +* savetty() (in module curses): Functions<6>. (line 443) +* SAX2DOM (class in xml.dom.pulldom): xml dom pulldom — Support for building partial DOM trees. + (line 80) +* SAXException: xml sax — Support for SAX2 parsers. + (line 85) +* SAXNotRecognizedException: xml sax — Support for SAX2 parsers. + (line 110) +* SAXNotSupportedException: xml sax — Support for SAX2 parsers. + (line 117) +* SAXParseException: xml sax — Support for SAX2 parsers. + (line 102) +* scaleb() (decimal.Context method): Context objects. (line 520) +* scaleb() (decimal.Decimal method): Decimal objects. (line 554) +* scandir() (in module os): Files and Directories. + (line 842) +* scanf (C function): Simulating scanf. (line 6) +* SCHED_BATCH (in module os): Interface to the scheduler. + (line 19) +* SCHED_FIFO (in module os): Interface to the scheduler. + (line 32) +* sched_get_priority_max() (in module os): Interface to the scheduler. + (line 63) +* sched_get_priority_min() (in module os): Interface to the scheduler. + (line 58) +* sched_getaffinity() (in module os): Interface to the scheduler. + (line 110) +* sched_getparam() (in module os): Interface to the scheduler. + (line 87) +* sched_getscheduler() (in module os): Interface to the scheduler. + (line 75) +* SCHED_IDLE (in module os): Interface to the scheduler. + (line 24) +* SCHED_OTHER (in module os): Interface to the scheduler. + (line 15) +* sched_param (class in os): Interface to the scheduler. + (line 46) +* sched_priority (os.sched_param attribute): Interface to the scheduler. + (line 54) +* SCHED_RESET_ON_FORK (in module os): Interface to the scheduler. + (line 40) +* SCHED_RR (in module os): Interface to the scheduler. + (line 36) +* sched_rr_get_interval() (in module os): Interface to the scheduler. + (line 93) +* sched_setaffinity() (in module os): Interface to the scheduler. + (line 103) +* sched_setparam() (in module os): Interface to the scheduler. + (line 81) +* sched_setscheduler() (in module os): Interface to the scheduler. + (line 68) +* SCHED_SPORADIC (in module os): Interface to the scheduler. + (line 28) +* sched_yield() (in module os): Interface to the scheduler. + (line 98) +* scheduler (class in sched): sched — Event scheduler. + (line 13) +* SCM_CREDS2 (in module socket): Constants<8>. (line 321) +* scope: Naming and binding. (line 6) +* scope <1>: Resolution of names. + (line 6) +* scope_id (ipaddress.IPv6Address attribute): Address objects. + (line 306) +* Screen (class in turtle): Public classes. (line 30) +* screensize() (in module turtle): Window control. (line 63) +* script_from_examples() (in module doctest): Debugging. (line 72) +* scroll() (curses.window method): Window Objects. (line 500) +* ScrolledCanvas (class in turtle): Public classes. (line 34) +* ScrolledText (class in tkinter.scrolledtext): tkinter scrolledtext — Scrolled Text Widget. + (line 24) +* scrollok() (curses.window method): Window Objects. (line 504) +* scrypt() (in module hashlib): Key derivation. (line 49) +* seal() (in module unittest.mock): Sealing mocks. (line 6) +* search_function() (in module encodings): encodings — Encodings package. + (line 23) +* search() (imaplib.IMAP4 method): IMAP4 Objects. (line 223) +* search() (in module re): Functions<2>. (line 36) +* search() (re.Pattern method): Regular Expression Objects. + (line 15) +* second (datetime.datetime attribute): datetime Objects. (line 326) +* second (datetime.time attribute): time Objects. (line 58) +* seconds (datetime.timedelta attribute): timedelta Objects. (line 114) +* seconds since the epoch: time — Time access and conversions. + (line 24) +* SECTCRE (configparser.ConfigParser attribute): Customizing Parser Behaviour. + (line 301) +* sections() (configparser.ConfigParser method): ConfigParser Objects. + (line 116) +* secure (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 49) +* secure (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* secure hash algorithm, SHA1, SHA2, SHA224, SHA256, SHA384, SHA512, SHA3, Shake, Blake2: hashlib — Secure hashes and message digests. + (line 8) +* Secure Sockets Layer: ssl — TLS/SSL wrapper for socket objects. + (line 8) +* security considerations: xdrlib — Encode and decode XDR data. + (line 15) +* security_level (ssl.SSLContext attribute): SSL Contexts. (line 626) +* see() (tkinter.ttk.Treeview method): ttk Treeview. (line 241) +* seed_bits (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1066) +* seed() (in module random): Bookkeeping functions. + (line 6) +* seed() (random.Random method): Alternative Generator. + (line 18) +* SEEK_CUR (in module os): File Descriptor Operations. + (line 326) +* SEEK_DATA (in module os): File Descriptor Operations. + (line 350) +* SEEK_END (in module os): File Descriptor Operations. + (line 326) +* SEEK_HOLE (in module os): File Descriptor Operations. + (line 350) +* SEEK_SET (in module os): File Descriptor Operations. + (line 326) +* seek() (io.IOBase method): I/O Base Classes. (line 106) +* seek() (io.TextIOBase method): Text I/O<2>. (line 66) +* seek() (io.TextIOWrapper method): Text I/O<2>. (line 205) +* seek() (mmap.mmap method): mmap — Memory-mapped file support. + (line 293) +* seek() (sqlite3.Blob method): Blob objects. (line 63) +* seekable() (bz2.BZ2File method): De compression of files. + (line 100) +* seekable() (io.IOBase method): I/O Base Classes. (line 129) +* seekable() (mmap.mmap method): mmap — Memory-mapped file support. + (line 304) +* select() (imaplib.IMAP4 method): IMAP4 Objects. (line 240) +* select() (in module select): select — Waiting for I/O completion. + (line 115) +* select() (selectors.BaseSelector method): Classes<4>. (line 108) +* select() (tkinter.ttk.Notebook method): ttk Notebook. (line 53) +* selected_alpn_protocol() (ssl.SSLSocket method): SSL Sockets. + (line 273) +* selected_npn_protocol() (ssl.SSLSocket method): SSL Sockets. + (line 283) +* selection_add() (tkinter.ttk.Treeview method): ttk Treeview. + (line 264) +* selection_remove() (tkinter.ttk.Treeview method): ttk Treeview. + (line 271) +* selection_set() (tkinter.ttk.Treeview method): ttk Treeview. + (line 257) +* selection_toggle() (tkinter.ttk.Treeview method): ttk Treeview. + (line 278) +* selection() (tkinter.ttk.Treeview method): ttk Treeview. (line 249) +* selector (urllib.request.Request attribute): Request Objects. + (line 34) +* SelectorEventLoop (class in asyncio): Event Loop Implementations. + (line 11) +* SelectorKey (class in selectors): Classes<4>. (line 29) +* SelectSelector (class in selectors): Classes<4>. (line 167) +* Self (in module typing): Special types. (line 138) +* Semaphore (class in asyncio): Semaphore. (line 6) +* Semaphore (class in multiprocessing): Synchronization primitives. + (line 167) +* Semaphore (class in threading): Semaphore objects. (line 19) +* Semaphore() (multiprocessing.managers.SyncManager method): Managers. + (line 208) +* semaphores, binary: _thread — Low-level threading API. + (line 6) +* SEMI (in module token): token — Constants used with Python parse trees. + (line 194) +* SEND (opcode): Python Bytecode Instructions. + (line 1261) +* send_bytes() (multiprocessing.connection.Connection method): Connection Objects. + (line 54) +* send_error() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 216) +* send_fds() (in module socket): Other functions<2>. (line 462) +* send_header() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 252) +* send_message() (smtplib.SMTP method): SMTP Objects. (line 304) +* send_response_only() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 265) +* send_response() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 236) +* send_signal() (asyncio.subprocess.Process method): Interacting with Subprocesses. + (line 86) +* send_signal() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 44) +* send_signal() (subprocess.Popen method): Popen Objects. (line 75) +* send() (coroutine method): Coroutine Objects. (line 23) +* send() (generator method): Generator-iterator methods. + (line 27) +* send() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 211) +* send() (imaplib.IMAP4 method): IMAP4 Objects. (line 247) +* send() (logging.handlers.DatagramHandler method): DatagramHandler. + (line 43) +* send() (logging.handlers.SocketHandler method): SocketHandler. + (line 63) +* send() (multiprocessing.connection.Connection method): Connection Objects. + (line 15) +* send() (socket.socket method): Socket Objects. (line 395) +* sendall() (socket.socket method): Socket Objects. (line 411) +* sendcmd() (ftplib.FTP method): FTP objects. (line 157) +* sendfile() (asyncio.loop method): Transferring files. (line 6) +* sendfile() (in module os): File Descriptor Operations. + (line 753) +* sendfile() (socket.socket method): Socket Objects. (line 504) +* sendfile() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 281) +* SendfileNotAvailableError: Exceptions<13>. (line 37) +* sendfunc (C type): Slot Type typedefs. (line 116) +* sendmail() (smtplib.SMTP method): SMTP Objects. (line 226) +* sendmsg_afalg() (socket.socket method): Socket Objects. (line 493) +* sendmsg() (socket.socket method): Socket Objects. (line 449) +* sendto() (asyncio.DatagramTransport method): Datagram Transports. + (line 6) +* sendto() (socket.socket method): Socket Objects. (line 430) +* sentinel (in module unittest.mock): sentinel. (line 6) +* sentinel (multiprocessing.Process attribute): Process and exceptions. + (line 189) +* sep (in module os): Miscellaneous System Information. + (line 116) +* SEPTEMBER (in module calendar): calendar — General calendar-related functions. + (line 490) +* sequence: Glossary. (line 1349) +* Sequence (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 68) +* Sequence (class in typing): Aliases to container ABCs in collections abc. + (line 98) +* sequence; item: Subscriptions. (line 6) +* sequence; iteration: Iterator Types. (line 6) +* SequenceMatcher (class in difflib): SequenceMatcher Objects. + (line 8) +* serialize() (sqlite3.Connection method): Connection objects. + (line 676) +* serializing; objects: pickle — Python object serialization. + (line 8) +* serve_forever() (asyncio.Server method): Server Objects. (line 91) +* serve_forever() (socketserver.BaseServer method): Server Objects<2>. + (line 32) +* Server (class in asyncio): Server Objects. (line 12) +* server (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 76) +* server (socketserver.BaseRequestHandler attribute): Request Handler Objects. + (line 52) +* server_activate() (socketserver.BaseServer method): Server Objects<2>. + (line 167) +* server_address (socketserver.BaseServer attribute): Server Objects<2>. + (line 79) +* server_bind() (socketserver.BaseServer method): Server Objects<2>. + (line 173) +* server_close() (socketserver.BaseServer method): Server Objects<2>. + (line 61) +* server_hostname (ssl.SSLSocket attribute): SSL Sockets. (line 353) +* server_side (ssl.SSLSocket attribute): SSL Sockets. (line 346) +* server_software (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 179) +* server_version (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 135) +* server_version (http.server.SimpleHTTPRequestHandler attribute): http server — HTTP servers. + (line 360) +* ServerProxy (class in xmlrpc.client): xmlrpc client — XML-RPC client access. + (line 29) +* service_actions() (socketserver.BaseServer method): Server Objects<2>. + (line 45) +* session (ssl.SSLSocket attribute): SSL Sockets. (line 366) +* session_reused (ssl.SSLSocket attribute): SSL Sockets. (line 376) +* session_stats() (ssl.SSLContext method): SSL Contexts. (line 481) +* set (built-in class): Set Types — set frozenset. + (line 33) +* Set (class in ast): Literals<3>. (line 91) +* Set (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 92) +* Set (class in typing): Aliases to built-in types. + (line 30) +* Set Breakpoint: Help menu Shell and Editor. + (line 30) +* set comprehension: Glossary. (line 1370) +* SET_ADD (opcode): Python Bytecode Instructions. + (line 372) +* set_all(): Reference Count Details. + (line 98) +* set_allowed_domains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 70) +* set_alpn_protocols() (ssl.SSLContext method): SSL Contexts. + (line 252) +* set_app() (wsgiref.simple_server.WSGIServer method): wsgiref simple_server – a simple WSGI HTTP server. + (line 64) +* set_asyncgen_hooks() (in module sys): sys — System-specific parameters and functions. + (line 1703) +* set_authorizer() (sqlite3.Connection method): Connection objects. + (line 345) +* set_auto_history() (in module readline): History list. (line 43) +* set_blocked_domains() (http.cookiejar.DefaultCookiePolicy method): DefaultCookiePolicy Objects. + (line 56) +* set_blocking() (in module os): File Descriptor Operations. + (line 814) +* set_boundary() (email.message.EmailMessage method): email message Representing an email message. + (line 411) +* set_boundary() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 590) +* set_break() (bdb.Bdb method): bdb — Debugger framework. + (line 345) +* set_charset() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 237) +* set_child_watcher() (asyncio.AbstractEventLoopPolicy method): Policy Objects. + (line 44) +* set_child_watcher() (in module asyncio): Process Watchers. (line 31) +* set_children() (tkinter.ttk.Treeview method): ttk Treeview. + (line 25) +* set_ciphers() (ssl.SSLContext method): SSL Contexts. (line 238) +* set_completer_delims() (in module readline): Completion. (line 50) +* set_completer() (in module readline): Completion. (line 14) +* set_completion_display_matches_hook() (in module readline): Completion. + (line 59) +* set_content() (email.contentmanager.ContentManager method): email contentmanager Managing MIME Content. + (line 40) +* set_content() (email.message.EmailMessage method): email message Representing an email message. + (line 590) +* set_content() (in module email.contentmanager): Content Manager Instances. + (line 35) +* set_continue() (bdb.Bdb method): bdb — Debugger framework. + (line 330) +* set_cookie_if_ok() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 69) +* set_cookie() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 73) +* set_coroutine_origin_tracking_depth() (in module sys): sys — System-specific parameters and functions. + (line 1728) +* set_data() (importlib.abc.SourceLoader method): importlib abc – Abstract base classes related to import. + (line 389) +* set_data() (importlib.machinery.SourceFileLoader method): importlib machinery – Importers and path hooks. + (line 230) +* set_date() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 97) +* set_debug() (asyncio.loop method): Enabling debug mode. + (line 14) +* set_debug() (in module gc): gc — Garbage Collector interface. + (line 51) +* set_debuglevel() (ftplib.FTP method): FTP objects. (line 74) +* set_debuglevel() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 87) +* set_debuglevel() (poplib.POP3 method): POP3 Objects. (line 11) +* set_debuglevel() (smtplib.SMTP method): SMTP Objects. (line 8) +* set_default_executor() (asyncio.loop method): Executing code in thread or process pools. + (line 75) +* set_default_type() (email.message.EmailMessage method): email message Representing an email message. + (line 342) +* set_default_type() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 452) +* set_default_verify_paths() (ssl.SSLContext method): SSL Contexts. + (line 229) +* set_defaults() (argparse.ArgumentParser method): Parser defaults. + (line 6) +* set_defaults() (optparse.OptionParser method): Other methods. + (line 27) +* set_ecdh_curve() (ssl.SSLContext method): SSL Contexts. (line 366) +* set_errno() (in module ctypes): Utility functions. (line 200) +* set_error_mode() (in module msvcrt): Other Functions. (line 12) +* set_escdelay() (in module curses): Functions<6>. (line 454) +* set_event_loop_policy() (in module asyncio): Getting and Setting the Policy. + (line 13) +* set_event_loop() (asyncio.AbstractEventLoopPolicy method): Policy Objects. + (line 23) +* set_event_loop() (in module asyncio): Event Loop. (line 63) +* set_events() (in module sys.monitoring): Setting events globally. + (line 13) +* set_exception_handler() (asyncio.loop method): Error Handling API. + (line 8) +* set_exception() (asyncio.Future method): Future Object. (line 56) +* set_exception() (concurrent.futures.Future method): Future Objects. + (line 117) +* set_executable() (in module multiprocessing): Miscellaneous<3>. + (line 117) +* set_filter() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 127) +* set_flags() (mailbox.Maildir method): Maildir objects. (line 110) +* set_flags() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 72) +* set_flags() (mailbox.mboxMessage method): mboxMessage objects. + (line 72) +* set_flags() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 71) +* set_forkserver_preload() (in module multiprocessing): Miscellaneous<3>. + (line 132) +* set_from() (mailbox.mboxMessage method): mboxMessage objects. + (line 53) +* set_from() (mailbox.MMDFMessage method): MMDFMessage objects. + (line 52) +* SET_FUNCTION_ATTRIBUTE (opcode): Python Bytecode Instructions. + (line 1123) +* set_handle_inheritable() (in module os): Inheritance of File Descriptors. + (line 40) +* set_history_length() (in module readline): History file. (line 30) +* set_info() (mailbox.Maildir method): Maildir objects. (line 172) +* set_info() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 108) +* set_inheritable() (in module os): Inheritance of File Descriptors. + (line 30) +* set_inheritable() (socket.socket method): Socket Objects. (line 521) +* set_int_max_str_digits() (in module sys): sys — System-specific parameters and functions. + (line 1505) +* set_labels() (mailbox.BabylMessage method): BabylMessage objects. + (line 51) +* set_last_error() (in module ctypes): Utility functions. (line 209) +* set_local_events() (in module sys.monitoring): Per code object events. + (line 16) +* set_memlimit() (in module test.support): test support — Utilities for the Python test suite. + (line 303) +* set_name() (asyncio.Task method): Task Object. (line 187) +* set_next() (bdb.Bdb method): bdb — Debugger framework. + (line 308) +* set_nonstandard_attr() (http.cookiejar.Cookie method): Cookie Objects<2>. + (line 107) +* set_npn_protocols() (ssl.SSLContext method): SSL Contexts. (line 267) +* set_ok() (http.cookiejar.CookiePolicy method): CookiePolicy Objects. + (line 9) +* set_param() (email.message.EmailMessage method): email message Representing an email message. + (line 351) +* set_param() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 520) +* set_pasv() (ftplib.FTP method): FTP objects. (line 213) +* set_payload() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 226) +* set_policy() (http.cookiejar.CookieJar method): CookieJar and FileCookieJar Objects. + (line 57) +* set_pre_input_hook() (in module readline): Startup hooks. (line 14) +* set_progress_handler() (sqlite3.Connection method): Connection objects. + (line 378) +* set_protocol() (asyncio.BaseTransport method): Base Transport. + (line 81) +* set_proxy() (urllib.request.Request method): Request Objects. + (line 115) +* set_psk_client_callback() (ssl.SSLContext method): SSL Contexts. + (line 661) +* set_psk_server_callback() (ssl.SSLContext method): SSL Contexts. + (line 713) +* set_quit() (bdb.Bdb method): bdb — Debugger framework. + (line 335) +* set_result() (asyncio.Future method): Future Object. (line 49) +* set_result() (concurrent.futures.Future method): Future Objects. + (line 105) +* set_return() (bdb.Bdb method): bdb — Debugger framework. + (line 312) +* set_running_or_notify_cancel() (concurrent.futures.Future method): Future Objects. + (line 85) +* set_selection() (tkinter.filedialog.FileDialog method): Native Load/Save Dialogs. + (line 131) +* set_seq1() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 54) +* set_seq2() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 59) +* set_seqs() (difflib.SequenceMatcher method): SequenceMatcher Objects. + (line 44) +* set_sequences() (mailbox.MH method): MH objects. (line 61) +* set_sequences() (mailbox.MHMessage method): MHMessage objects. + (line 37) +* set_server_documentation() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler. + (line 24) +* set_server_documentation() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects. + (line 24) +* set_server_name() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler. + (line 18) +* set_server_name() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects. + (line 18) +* set_server_title() (xmlrpc.server.DocCGIXMLRPCRequestHandler method): DocCGIXMLRPCRequestHandler. + (line 13) +* set_server_title() (xmlrpc.server.DocXMLRPCServer method): DocXMLRPCServer Objects. + (line 13) +* set_servername_callback (ssl.SSLContext attribute): SSL Contexts. + (line 338) +* set_start_method() (in module multiprocessing): Miscellaneous<3>. + (line 149) +* set_startup_hook() (in module readline): Startup hooks. (line 6) +* set_step() (bdb.Bdb method): bdb — Debugger framework. + (line 304) +* set_subdir() (mailbox.MaildirMessage method): MaildirMessage objects. + (line 58) +* set_tabsize() (in module curses): Functions<6>. (line 469) +* set_task_factory() (asyncio.loop method): Creating Futures and Tasks. + (line 51) +* set_threshold() (in module gc): gc — Garbage Collector interface. + (line 92) +* set_trace_callback() (sqlite3.Connection method): Connection objects. + (line 396) +* set_trace() (bdb.Bdb method): bdb — Debugger framework. + (line 321) +* set_trace() (in module bdb): bdb — Debugger framework. + (line 482) +* set_trace() (in module pdb): pdb — The Python Debugger. + (line 161) +* set_trace() (pdb.Pdb method): pdb — The Python Debugger. + (line 228) +* set_tunnel() (http.client.HTTPConnection method): HTTPConnection Objects. + (line 97) +* set_type() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 553) +* set_unittest_reportflags() (in module doctest): Unittest API. + (line 169) +* set_unixfrom() (email.message.EmailMessage method): email message Representing an email message. + (line 146) +* set_unixfrom() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 157) +* set_until() (bdb.Bdb method): bdb — Debugger framework. + (line 316) +* SET_UPDATE (opcode): Python Bytecode Instructions. + (line 720) +* set_url() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 21) +* set_usage() (optparse.OptionParser method): Other methods. (line 8) +* set_userptr() (curses.panel.Panel method): Panel Objects. (line 43) +* set_visible() (mailbox.BabylMessage method): BabylMessage objects. + (line 68) +* set_wakeup_fd() (in module signal): Module contents<2>. (line 443) +* set_write_buffer_limits() (asyncio.WriteTransport method): Write-only Transports. + (line 33) +* set; comprehensions: Set displays. (line 6) +* set; display: Set displays. (line 6) +* set() (asyncio.Event method): Event. (line 51) +* set() (configparser.ConfigParser method): ConfigParser Objects. + (line 285) +* set() (configparser.RawConfigParser method): RawConfigParser Objects. + (line 48) +* set() (contextvars.ContextVar method): Context Variables. (line 46) +* set() (http.cookies.Morsel method): Morsel Objects. (line 61) +* set() (test.support.os_helper.EnvironmentVarGuard method): test support os_helper — Utilities for os tests. + (line 66) +* set() (threading.Event method): Event objects. (line 30) +* set() (tkinter.ttk.Combobox method): ttk Combobox. (line 19) +* set() (tkinter.ttk.Spinbox method): ttk Spinbox. (line 12) +* set() (tkinter.ttk.Treeview method): ttk Treeview. (line 285) +* set() (xml.etree.ElementTree.Element method): Element Objects. + (line 81) +* setacl() (imaplib.IMAP4 method): IMAP4 Objects. (line 254) +* setannotation() (imaplib.IMAP4 method): IMAP4 Objects. (line 259) +* setattrfunc (C type): Slot Type typedefs. (line 48) +* setAttribute() (xml.dom.Element method): Element Objects<2>. + (line 67) +* setAttributeNode() (xml.dom.Element method): Element Objects<2>. + (line 71) +* setAttributeNodeNS() (xml.dom.Element method): Element Objects<2>. + (line 79) +* setAttributeNS() (xml.dom.Element method): Element Objects<2>. + (line 87) +* setattrofunc (C type): Slot Type typedefs. (line 61) +* SetBase() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 22) +* setblocking() (socket.socket method): Socket Objects. (line 528) +* setByteStream() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 36) +* setcbreak() (in module tty): tty — Terminal control functions. + (line 54) +* setCharacterStream() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 55) +* SetComp (class in ast): Comprehensions. (line 6) +* setcomptype() (wave.Wave_write method): Wave_write Objects. + (line 59) +* setconfig() (sqlite3.Connection method): Connection objects. + (line 660) +* setContentHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 25) +* setcontext() (in module decimal): Context objects. (line 18) +* setDaemon() (threading.Thread method): Thread objects. (line 215) +* setdefault() (dict method): Mapping Types — dict. + (line 228) +* setdefault() (http.cookies.Morsel method): Morsel Objects. (line 105) +* setdefaulttimeout() (in module socket): Other functions<2>. + (line 382) +* setdlopenflags() (in module sys): sys — System-specific parameters and functions. + (line 1492) +* setDocumentLocator() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 10) +* setDTDHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 34) +* setegid() (in module os): Process Parameters. (line 377) +* setEncoding() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 22) +* setEntityResolver() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 43) +* setErrorHandler() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 54) +* seteuid() (in module os): Process Parameters. (line 383) +* setFeature() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 76) +* setfirstweekday() (calendar.Calendar method): calendar — General calendar-related functions. + (line 54) +* setfirstweekday() (in module calendar): calendar — General calendar-related functions. + (line 349) +* setFormatter() (logging.Handler method): Handler Objects. (line 48) +* setframerate() (wave.Wave_write method): Wave_write Objects. + (line 45) +* setgid() (in module os): Process Parameters. (line 389) +* setgroups() (in module os): Process Parameters. (line 395) +* seth() (in module turtle): Turtle motion. (line 166) +* setheading() (in module turtle): Turtle motion. (line 166) +* sethostname() (in module socket): Other functions<2>. (line 389) +* setinputsizes() (sqlite3.Cursor method): Cursor objects. (line 162) +* setitem() (in module operator): operator — Standard operators as functions. + (line 205) +* setitimer() (in module signal): Module contents<2>. (line 414) +* setLevel() (logging.Handler method): Handler Objects. (line 35) +* setLevel() (logging.Logger method): Logger Objects. (line 105) +* setlimit() (sqlite3.Connection method): Connection objects. + (line 614) +* setlocale() (in module locale): locale — Internationalization services. + (line 27) +* setLocale() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 60) +* setLoggerClass() (in module logging): Module-Level Functions. + (line 323) +* setlogmask() (in module syslog): syslog — Unix syslog library routines. + (line 98) +* setLogRecordFactory() (in module logging): Module-Level Functions. + (line 334) +* setMaxConns() (urllib.request.CacheFTPHandler method): CacheFTPHandler Objects. + (line 13) +* setmode() (in module msvcrt): File Operations. (line 38) +* setName() (threading.Thread method): Thread objects. (line 159) +* setnchannels() (wave.Wave_write method): Wave_write Objects. + (line 37) +* setnframes() (wave.Wave_write method): Wave_write Objects. (line 52) +* setns() (in module os): Process Parameters. (line 410) +* setoutputsize() (sqlite3.Cursor method): Cursor objects. (line 166) +* SetParamEntityParsing() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 54) +* setparams() (wave.Wave_write method): Wave_write Objects. (line 64) +* setpassword() (zipfile.ZipFile method): ZipFile Objects. (line 240) +* setpgid() (in module os): Process Parameters. (line 457) +* setpgrp() (in module os): Process Parameters. (line 449) +* setpos() (in module turtle): Turtle motion. (line 74) +* setpos() (wave.Wave_read method): Wave_read Objects. (line 83) +* setposition() (in module turtle): Turtle motion. (line 74) +* setpriority() (in module os): Process Parameters. (line 465) +* setprofile_all_threads() (in module threading): Reference<2>. + (line 142) +* setprofile() (in module sys): sys — System-specific parameters and functions. + (line 1513) +* setprofile() (in module threading): Reference<2>. (line 136) +* setProperty() (xml.sax.xmlreader.XMLReader method): XMLReader Objects. + (line 90) +* setPublicId() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 6) +* setquota() (imaplib.IMAP4 method): IMAP4 Objects. (line 264) +* setraw() (in module tty): tty — Terminal control functions. + (line 43) +* setrecursionlimit() (in module sys): sys — System-specific parameters and functions. + (line 1570) +* setregid() (in module os): Process Parameters. (line 482) +* SetReparseDeferralEnabled() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 82) +* setresgid() (in module os): Process Parameters. (line 488) +* setresuid() (in module os): Process Parameters. (line 496) +* setreuid() (in module os): Process Parameters. (line 504) +* setrlimit() (in module resource): Resource Limits. (line 31) +* setsampwidth() (wave.Wave_write method): Wave_write Objects. + (line 41) +* setscrreg() (curses.window method): Window Objects. (line 514) +* setsid() (in module os): Process Parameters. (line 517) +* setsockopt() (socket.socket method): Socket Objects. (line 561) +* setstate() (codecs.IncrementalDecoder method): IncrementalDecoder Objects. + (line 60) +* setstate() (codecs.IncrementalEncoder method): IncrementalEncoder Objects. + (line 51) +* setstate() (in module random): Bookkeeping functions. + (line 38) +* setstate() (random.Random method): Alternative Generator. + (line 28) +* setStream() (logging.StreamHandler method): StreamHandler. (line 32) +* setswitchinterval (in module sys): Thread State and the Global Interpreter Lock. + (line 15) +* setswitchinterval() (in module sys): sys — System-specific parameters and functions. + (line 1588) +* setswitchinterval() (in module test.support): test support — Utilities for the Python test suite. + (line 286) +* setSystemId() (xml.sax.xmlreader.InputSource method): InputSource Objects. + (line 14) +* setsyx() (in module curses): Functions<6>. (line 477) +* setTarget() (logging.handlers.MemoryHandler method): MemoryHandler. + (line 68) +* setter (C type): Defining Getters and Setters. + (line 42) +* settimeout() (socket.socket method): Socket Objects. (line 545) +* setTimeout() (urllib.request.CacheFTPHandler method): CacheFTPHandler Objects. + (line 9) +* settrace_all_threads() (in module threading): Reference<2>. + (line 120) +* settrace() (in module sys): sys — System-specific parameters and functions. + (line 1601) +* settrace() (in module threading): Reference<2>. (line 114) +* setuid() (in module os): Process Parameters. (line 524) +* setundobuffer() (in module turtle): Special Turtle methods. + (line 61) +* SETUP_ANNOTATIONS (opcode): Python Bytecode Instructions. + (line 432) +* SETUP_CLEANUP (opcode): Python Bytecode Instructions. + (line 1404) +* setup_environ() (wsgiref.handlers.BaseHandler method): wsgiref handlers – server/gateway base classes. + (line 199) +* SETUP_FINALLY (opcode): Python Bytecode Instructions. + (line 1397) +* setup_python() (venv.EnvBuilder method): API<2>. (line 153) +* setup_scripts() (venv.EnvBuilder method): API<2>. (line 161) +* setup_testing_defaults() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 70) +* SETUP_WITH (opcode): Python Bytecode Instructions. + (line 1412) +* setup() (in module turtle): Methods specific to Screen not inherited from TurtleScreen. + (line 20) +* setup() (socketserver.BaseRequestHandler method): Request Handler Objects. + (line 14) +* setUp() (unittest.TestCase method): Test cases. (line 33) +* setUpClass() (unittest.TestCase method): Test cases. (line 55) +* setupterm() (in module curses): Functions<6>. (line 482) +* SetValue() (in module winreg): Functions<13>. (line 419) +* SetValueEx() (in module winreg): Functions<13>. (line 450) +* setworldcoordinates() (in module turtle): Window control. (line 90) +* setx() (in module turtle): Turtle motion. (line 138) +* setxattr() (in module os): Linux extended attributes. + (line 57) +* sety() (in module turtle): Turtle motion. (line 152) +* SF_APPEND (in module stat): stat — Interpreting stat results. + (line 414) +* SF_ARCHIVED (in module stat): stat — Interpreting stat results. + (line 406) +* SF_DATALESS (in module stat): stat — Interpreting stat results. + (line 438) +* SF_FIRMLINK (in module stat): stat — Interpreting stat results. + (line 432) +* SF_IMMUTABLE (in module stat): stat — Interpreting stat results. + (line 410) +* SF_MNOWAIT (in module os): File Descriptor Operations. + (line 793) +* SF_NOCACHE (in module os): File Descriptor Operations. + (line 804) +* SF_NODISKIO (in module os): File Descriptor Operations. + (line 793) +* SF_NOUNLINK (in module stat): stat — Interpreting stat results. + (line 424) +* SF_RESTRICTED (in module stat): stat — Interpreting stat results. + (line 418) +* SF_SETTABLE (in module stat): stat — Interpreting stat results. + (line 384) +* SF_SNAPSHOT (in module stat): stat — Interpreting stat results. + (line 428) +* SF_SUPPORTED (in module stat): stat — Interpreting stat results. + (line 390) +* SF_SYNC (in module os): File Descriptor Operations. + (line 793) +* SF_SYNTHETIC (in module stat): stat — Interpreting stat results. + (line 398) +* sha1() (in module hashlib): Constructors. (line 22) +* sha224() (in module hashlib): Constructors. (line 24) +* sha256() (in module hashlib): Constructors. (line 26) +* sha3_224() (in module hashlib): Constructors. (line 32) +* sha3_256() (in module hashlib): Constructors. (line 34) +* sha3_384() (in module hashlib): Constructors. (line 36) +* sha3_512() (in module hashlib): Constructors. (line 38) +* sha384() (in module hashlib): Constructors. (line 28) +* sha512() (in module hashlib): Constructors. (line 30) +* shake_128() (in module hashlib): SHAKE variable length digests. + (line 6) +* shake_256() (in module hashlib): SHAKE variable length digests. + (line 8) +* Shape (class in turtle): Public classes. (line 43) +* shape (memoryview attribute): Memory Views. (line 451) +* shape() (in module turtle): Appearance. (line 6) +* shapesize() (in module turtle): Appearance. (line 52) +* shapetransform() (in module turtle): Appearance. (line 137) +* share() (socket.socket method): Socket Objects. (line 595) +* ShareableList (class in multiprocessing.shared_memory): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 272) +* ShareableList() (multiprocessing.managers.SharedMemoryManager method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 232) +* Shared Memory: multiprocessing shared_memory — Shared memory for direct access across processes. + (line 10) +* shared_ciphers() (ssl.SSLSocket method): SSL Sockets. (line 236) +* shared_memory (sys._emscripten_info attribute): sys — System-specific parameters and functions. + (line 364) +* SharedMemory (class in multiprocessing.shared_memory): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 33) +* SharedMemory() (multiprocessing.managers.SharedMemoryManager method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 227) +* SharedMemoryManager (class in multiprocessing.managers): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 200) +* shearfactor() (in module turtle): Appearance. (line 83) +* Shelf (class in shelve): Restrictions. (line 27) +* shield() (in module asyncio): Shielding From Cancellation. + (line 6) +* shift_path_info() (in module wsgiref.util): wsgiref util – WSGI environment utilities. + (line 40) +* shift() (decimal.Context method): Context objects. (line 525) +* shift() (decimal.Decimal method): Decimal objects. (line 560) +* shifting; operation: Shifting operations. + (line 6) +* shifting; operations: Bitwise Operations on Integer Types. + (line 6) +* shlex (class in shlex): shlex — Simple lexical analysis. + (line 92) +* shm (multiprocessing.shared_memory.ShareableList attribute): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 346) +* SHORT_TIMEOUT (in module test.support): test support — Utilities for the Python test suite. + (line 80) +* shortDescription() (unittest.TestCase method): Test cases. (line 758) +* shorten() (in module textwrap): textwrap — Text wrapping and filling. + (line 49) +* shouldFlush() (logging.handlers.BufferingHandler method): MemoryHandler. + (line 36) +* shouldFlush() (logging.handlers.MemoryHandler method): MemoryHandler. + (line 72) +* shouldRollover() (logging.handlers.RotatingFileHandler method): RotatingFileHandler. + (line 52) +* shouldRollover() (logging.handlers.TimedRotatingFileHandler method): TimedRotatingFileHandler. + (line 120) +* shouldStop (unittest.TestResult attribute): Loading and running tests. + (line 284) +* show_code() (in module dis): Analysis functions. (line 26) +* show_flag_values() (in module enum): Utilities and Decorators. + (line 102) +* show() (curses.panel.Panel method): Panel Objects. (line 49) +* show() (tkinter.commondialog.Dialog method): tkinter commondialog — Dialog window templates. + (line 16) +* show() (tkinter.messagebox.Message method): tkinter messagebox — Tkinter message prompts. + (line 82) +* showerror() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 105) +* showinfo() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 91) +* showsyntaxerror() (code.InteractiveInterpreter method): Interactive Interpreter Objects. + (line 44) +* showtraceback() (code.InteractiveInterpreter method): Interactive Interpreter Objects. + (line 53) +* showturtle() (in module turtle): Visibility. (line 15) +* showwarning() (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 99) +* showwarning() (in module warnings): Available Functions. + (line 86) +* shuffle() (in module random): Functions for sequences. + (line 54) +* SHUT_RD (in module socket): Constants<8>. (line 375) +* SHUT_RDWR (in module socket): Constants<8>. (line 375) +* SHUT_WR (in module socket): Constants<8>. (line 375) +* ShutDown: queue — A synchronized queue class. + (line 94) +* shutdown_asyncgens() (asyncio.loop method): Running and stopping the loop. + (line 56) +* shutdown_default_executor() (asyncio.loop method): Running and stopping the loop. + (line 77) +* shutdown() (asyncio.Queue method): Queue. (line 84) +* shutdown() (concurrent.futures.Executor method): Executor Objects. + (line 53) +* shutdown() (imaplib.IMAP4 method): IMAP4 Objects. (line 269) +* shutdown() (in module logging): Module-Level Functions. + (line 312) +* shutdown() (multiprocessing.managers.BaseManager method): Managers. + (line 84) +* shutdown() (queue.Queue method): Terminating queues. (line 9) +* shutdown() (socket.socket method): Socket Objects. (line 586) +* shutdown() (socketserver.BaseServer method): Server Objects<2>. + (line 54) +* SI (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 70) +* side_effect (unittest.mock.Mock attribute): The Mock Class. + (line 370) +* SIG_BLOCK (in module signal): Module contents<2>. (line 231) +* SIG_DFL (in module signal): Module contents<2>. (line 45) +* SIG_IGN (in module signal): Module contents<2>. (line 53) +* SIG_SETMASK (in module signal): Module contents<2>. (line 246) +* SIG_UNBLOCK (in module signal): Module contents<2>. (line 238) +* SIGABRT (in module signal): Module contents<2>. (line 58) +* SIGALRM (in module signal): Module contents<2>. (line 62) +* SIGBREAK (in module signal): Module contents<2>. (line 68) +* SIGBUS (in module signal): Module contents<2>. (line 74) +* SIGCHLD (in module signal): Module contents<2>. (line 80) +* SIGCLD (in module signal): Module contents<2>. (line 86) +* SIGCONT (in module signal): Module contents<2>. (line 92) +* SIGFPE (in module signal): Module contents<2>. (line 98) +* SIGHUP (in module signal): Module contents<2>. (line 108) +* SIGILL (in module signal): Module contents<2>. (line 115) +* SIGINT (C macro): Signal Handling<2>. (line 7) +* SIGINT (C macro) <1>: Signal Handling<2>. (line 34) +* SIGINT (in module signal): Module contents<2>. (line 119) +* siginterrupt() (in module signal): Module contents<2>. (line 489) +* SIGKILL (in module signal): Module contents<2>. (line 125) +* Sigmasks (class in signal): Module contents<2>. (line 31) +* signal() (in module signal): Module contents<2>. (line 504) +* Signals (class in signal): Module contents<2>. (line 17) +* Signature (class in inspect): Introspecting callables with the Signature object. + (line 74) +* signature (inspect.BoundArguments attribute): Introspecting callables with the Signature object. + (line 364) +* signature() (in module inspect): Introspecting callables with the Signature object. + (line 12) +* sigpending() (in module signal): Module contents<2>. (line 532) +* SIGPIPE (in module signal): Module contents<2>. (line 133) +* SIGSEGV (in module signal): Module contents<2>. (line 141) +* SIGSTKFLT (in module signal): Module contents<2>. (line 145) +* SIGTERM (in module signal): Module contents<2>. (line 157) +* sigtimedwait() (in module signal): Module contents<2>. (line 593) +* SIGUSR1 (in module signal): Module contents<2>. (line 161) +* SIGUSR2 (in module signal): Module contents<2>. (line 167) +* sigwait() (in module signal): Module contents<2>. (line 547) +* sigwaitinfo() (in module signal): Module contents<2>. (line 564) +* SIGWINCH (in module signal): Module contents<2>. (line 173) +* SIMPLE (inspect.BufferFlags attribute): Buffer flags. (line 15) +* Simple Mail Transfer Protocol: smtplib — SMTP protocol client. + (line 8) +* simple; statement: Simple statements. (line 6) +* SimpleCookie (class in http.cookies): http cookies — HTTP state management. + (line 49) +* simplefilter() (in module warnings): Available Functions. + (line 120) +* SimpleHandler (class in wsgiref.handlers): wsgiref handlers – server/gateway base classes. + (line 70) +* SimpleHTTPRequestHandler (class in http.server): http server — HTTP servers. + (line 341) +* SimpleNamespace (class in types): Additional Utility Classes and Functions. + (line 6) +* SimpleQueue (class in multiprocessing): Pipes and Queues. (line 220) +* SimpleQueue (class in queue): queue — A synchronized queue class. + (line 75) +* SimpleXMLRPCRequestHandler (class in xmlrpc.server): xmlrpc server — Basic XML-RPC servers. + (line 63) +* SimpleXMLRPCServer (class in xmlrpc.server): xmlrpc server — Basic XML-RPC servers. + (line 24) +* sin() (in module cmath): Trigonometric functions<2>. + (line 27) +* sin() (in module math): Trigonometric functions. + (line 35) +* single dispatch: Glossary. (line 1378) +* SingleAddressHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 217) +* singledispatch() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 426) +* singledispatchmethod (class in functools): functools — Higher-order functions and operations on callable objects. + (line 600) +* singleton; tuple: Immutable sequences. + (line 29) +* sinh() (in module cmath): Hyperbolic functions<2>. + (line 27) +* sinh() (in module math): Hyperbolic functions. + (line 25) +* SIO_KEEPALIVE_VALS (in module socket): Constants<8>. (line 247) +* SIO_LOOPBACK_FAST_PATH (in module socket): Constants<8>. (line 247) +* SIO_RCVALL (in module socket): Constants<8>. (line 247) +* site command line option; -user-base: Command Line Interface<4>. + (line 18) +* site command line option; -user-site: Command Line Interface<4>. + (line 22) +* site_maps() (urllib.robotparser.RobotFileParser method): urllib robotparser — Parser for robots txt. + (line 71) +* site-packages; directory: site — Site-specific configuration hook. + (line 25) +* sitecustomize: The Customization Modules. + (line 6) +* sitecustomize <1>: The Customization Modules. + (line 19) +* sixtofour (ipaddress.IPv6Address attribute): Address objects. + (line 313) +* size (multiprocessing.shared_memory.SharedMemory attribute): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 125) +* size (struct.Struct attribute): Classes<3>. (line 61) +* size (tarfile.TarInfo attribute): TarInfo Objects. (line 65) +* size (tracemalloc.Statistic attribute): Statistic. (line 19) +* size (tracemalloc.StatisticDiff attribute): StatisticDiff. (line 26) +* size (tracemalloc.Trace attribute): Trace. (line 23) +* size_diff (tracemalloc.StatisticDiff attribute): StatisticDiff. + (line 32) +* SIZE_MAX (C macro): Integer Objects. (line 263) +* size() (ftplib.FTP method): FTP objects. (line 352) +* size() (mmap.mmap method): mmap — Memory-mapped file support. + (line 311) +* Sized (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 15) +* Sized (class in typing): Aliases to other ABCs in collections abc. + (line 68) +* sizeof_digit (sys.int_info attribute): sys — System-specific parameters and functions. + (line 1151) +* sizeof() (in module ctypes): Utility functions. (line 220) +* SKIP (in module doctest): Option Flags. (line 90) +* skip_if_broken_multiprocessing_synchronize() (in module test.support): test support — Utilities for the Python test suite. + (line 722) +* skip_unless_bind_unix_socket() (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 59) +* skip_unless_symlink() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 126) +* skip_unless_xattr() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 131) +* skip() (in module unittest): Skipping tests and expected failures. + (line 85) +* skipIf() (in module unittest): Skipping tests and expected failures. + (line 90) +* skipinitialspace (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 82) +* skipped (doctest.TestResults attribute): TestResults objects. + (line 16) +* skipped (unittest.TestResult attribute): Loading and running tests. + (line 259) +* skippedEntity() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 176) +* skips (doctest.DocTestRunner attribute): DocTestRunner objects. + (line 143) +* SkipTest: Skipping tests and expected failures. + (line 105) +* skipTest() (unittest.TestCase method): Test cases. (line 97) +* skipUnless() (in module unittest): Skipping tests and expected failures. + (line 94) +* SLASH (in module token): token — Constants used with Python parse trees. + (line 206) +* SLASHEQUAL (in module token): token — Constants used with Python parse trees. + (line 272) +* sleep() (in module asyncio): Sleeping. (line 6) +* sleep() (in module time): Functions<5>. (line 265) +* sleeping_retry() (in module test.support): test support — Utilities for the Python test suite. + (line 219) +* slice: Slicings. (line 6) +* slice <1>: Glossary. (line 1383) +* slice (built-in class): Built-in Functions. (line 1782) +* Slice (class in ast): Subscripting. (line 27) +* slice; assignment: Mutable Sequence Types. + (line 16) +* slice; operation: Common Sequence Operations. + (line 21) +* slicing: Sequences. (line 14) +* slicing <1>: Mutable sequences. (line 6) +* slicing <2>: Slicings. (line 6) +* slicing; assignment: Assignment statements. + (line 125) +* slow_callback_duration (asyncio.loop attribute): Enabling debug mode. + (line 21) +* SMALLEST (in module test.support): test support — Utilities for the Python test suite. + (line 190) +* SMTP (class in smtplib): smtplib — SMTP protocol client. + (line 21) +* SMTP (in module email.policy): email policy Policy Objects. + (line 510) +* SMTP_SSL (class in smtplib): smtplib — SMTP protocol client. + (line 75) +* SMTP; protocol: smtplib — SMTP protocol client. + (line 8) +* SMTPAuthenticationError: smtplib — SMTP protocol client. + (line 178) +* SMTPConnectError: smtplib — SMTP protocol client. + (line 163) +* SMTPDataError: smtplib — SMTP protocol client. + (line 159) +* SMTPException: smtplib — SMTP protocol client. + (line 124) +* SMTPHandler (class in logging.handlers): SMTPHandler. (line 10) +* SMTPHeloError: smtplib — SMTP protocol client. + (line 168) +* SMTPNotSupportedError: smtplib — SMTP protocol client. + (line 172) +* SMTPRecipientsRefused: smtplib — SMTP protocol client. + (line 152) +* SMTPResponseException: smtplib — SMTP protocol client. + (line 138) +* SMTPSenderRefused: smtplib — SMTP protocol client. + (line 146) +* SMTPServerDisconnected: smtplib — SMTP protocol client. + (line 132) +* SMTPUTF8 (in module email.policy): email policy Policy Objects. + (line 516) +* Snapshot (class in tracemalloc): Snapshot. (line 6) +* SND_ALIAS (in module winsound): winsound — Sound-playing interface for Windows. + (line 47) +* SND_APPLICATION (in module winsound): winsound — Sound-playing interface for Windows. + (line 128) +* SND_ASYNC (in module winsound): winsound — Sound-playing interface for Windows. + (line 109) +* SND_FILENAME (in module winsound): winsound — Sound-playing interface for Windows. + (line 42) +* SND_LOOP (in module winsound): winsound — Sound-playing interface for Windows. + (line 88) +* SND_MEMORY (in module winsound): winsound — Sound-playing interface for Windows. + (line 94) +* SND_NODEFAULT (in module winsound): winsound — Sound-playing interface for Windows. + (line 113) +* SND_NOSTOP (in module winsound): winsound — Sound-playing interface for Windows. + (line 118) +* SND_NOWAIT (in module winsound): winsound — Sound-playing interface for Windows. + (line 122) +* SND_PURGE (in module winsound): winsound — Sound-playing interface for Windows. + (line 103) +* sni_callback (ssl.SSLContext attribute): SSL Contexts. (line 285) +* sniff() (csv.Sniffer method): Module Contents<3>. (line 232) +* Sniffer (class in csv): Module Contents<3>. (line 225) +* SO (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 67) +* SO_INCOMING_CPU (in module socket): Constants<8>. (line 335) +* sock_accept() (asyncio.loop method): Working with socket objects directly. + (line 107) +* SOCK_CLOEXEC (in module socket): Constants<8>. (line 38) +* sock_connect() (asyncio.loop method): Working with socket objects directly. + (line 88) +* SOCK_DGRAM (in module socket): Constants<8>. (line 27) +* SOCK_MAX_SIZE (in module test.support): test support — Utilities for the Python test suite. + (line 123) +* SOCK_NONBLOCK (in module socket): Constants<8>. (line 38) +* SOCK_RAW (in module socket): Constants<8>. (line 27) +* SOCK_RDM (in module socket): Constants<8>. (line 27) +* sock_recv_into() (asyncio.loop method): Working with socket objects directly. + (line 26) +* sock_recv() (asyncio.loop method): Working with socket objects directly. + (line 12) +* sock_recvfrom_into() (asyncio.loop method): Working with socket objects directly. + (line 48) +* sock_recvfrom() (asyncio.loop method): Working with socket objects directly. + (line 37) +* sock_sendall() (asyncio.loop method): Working with socket objects directly. + (line 59) +* sock_sendfile() (asyncio.loop method): Working with socket objects directly. + (line 130) +* sock_sendto() (asyncio.loop method): Working with socket objects directly. + (line 77) +* SOCK_SEQPACKET (in module socket): Constants<8>. (line 27) +* SOCK_STREAM (in module socket): Constants<8>. (line 27) +* socket (class in socket): Creating sockets. (line 8) +* socket (socketserver.BaseServer attribute): Server Objects<2>. + (line 88) +* socket_type (socketserver.BaseServer attribute): Server Objects<2>. + (line 111) +* socket() (imaplib.IMAP4 method): IMAP4 Objects. (line 275) +* socket() (in module socket): select — Waiting for I/O completion. + (line 143) +* SocketHandler (class in logging.handlers): SocketHandler. (line 10) +* socketpair() (in module socket): Creating sockets. (line 64) +* sockets (asyncio.Server attribute): Server Objects. (line 128) +* SocketType (in module socket): Creating sockets. (line 186) +* soft deprecated: Glossary. (line 1391) +* soft keyword: Soft Keywords. (line 6) +* SOFT_KEYWORD (in module token): token — Constants used with Python parse trees. + (line 151) +* softkwlist (in module keyword): keyword — Testing for Python keywords. + (line 30) +* SOH (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 22) +* SOL_ALG (in module socket): Constants<8>. (line 263) +* SOL_RDS (in module socket): Constants<8>. (line 234) +* SOMAXCONN (in module socket): Constants<8>. (line 54) +* sort_stats() (pstats.Stats method): The Stats Class. (line 67) +* sort() (imaplib.IMAP4 method): IMAP4 Objects. (line 279) +* sort() (list method): Lists<2>. (line 39) +* sortdict() (in module test.support): test support — Utilities for the Python test suite. + (line 267) +* sortTestMethodsUsing (unittest.TestLoader attribute): Loading and running tests. + (line 195) +* source (doctest.Example attribute): Example Objects. (line 17) +* source (pdb command): Debugger Commands. (line 285) +* source (shlex.shlex attribute): shlex Objects. (line 151) +* source character set: Encoding declarations. + (line 6) +* SOURCE_DATE_EPOCH: py_compile<3>. (line 7) +* SOURCE_DATE_EPOCH <1>: Library<56>. (line 452) +* SOURCE_DATE_EPOCH <2>: Build<59>. (line 15) +* SOURCE_DATE_EPOCH <3>: py_compile — Compile Python source files. + (line 66) +* SOURCE_DATE_EPOCH <4>: py_compile — Compile Python source files. + (line 82) +* SOURCE_DATE_EPOCH <5>: py_compile — Compile Python source files. + (line 86) +* SOURCE_DATE_EPOCH <6>: Command-line use. (line 97) +* source_from_cache() (in module importlib.util): importlib util – Utility code for importers. + (line 58) +* source_hash() (in module importlib.util): importlib util – Utility code for importers. + (line 160) +* SOURCE_SUFFIXES (in module importlib.machinery): importlib machinery – Importers and path hooks. + (line 13) +* source_to_code() (importlib.abc.InspectLoader static method): importlib abc – Abstract base classes related to import. + (line 243) +* SourceFileLoader (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 204) +* sourcehook() (shlex.shlex method): shlex Objects. (line 26) +* SourcelessFileLoader (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 244) +* SourceLoader (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 328) +* SP (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 121) +* space: Indentation. (line 6) +* space; in printf-style formatting: printf-style String Formatting. + (line 69) +* space; in printf-style formatting <1>: printf-style Bytes Formatting. + (line 63) +* space; in string formatting: Format Specification Mini-Language. + (line 74) +* span() (re.Match method): Match Objects. (line 172) +* sparse (tarfile.TarInfo attribute): TarInfo Objects. (line 157) +* spawn_python() (in module test.support.script_helper): test support script_helper — Utilities for the Python execution tests. + (line 69) +* spawn() (in module pty): pty — Pseudo-terminal utilities. + (line 42) +* spawnl() (in module os): Process Management. (line 592) +* spawnle() (in module os): Process Management. (line 592) +* spawnlp() (in module os): Process Management. (line 592) +* spawnlpe() (in module os): Process Management. (line 592) +* spawnv() (in module os): Process Management. (line 592) +* spawnve() (in module os): Process Management. (line 592) +* spawnvp() (in module os): Process Management. (line 592) +* spawnvpe() (in module os): Process Management. (line 592) +* spec_from_file_location() (in module importlib.util): importlib util – Utility code for importers. + (line 148) +* spec_from_loader() (in module importlib.util): importlib util – Utility code for importers. + (line 137) +* special method: Glossary. (line 1402) +* special; attribute: The standard type hierarchy. + (line 13) +* special; method: Glossary. (line 1406) +* SpecialFileError: tarfile — Read and write tar archive files. + (line 248) +* specified_attributes (xml.parsers.expat.xmlparser attribute): XMLParser Objects<2>. + (line 155) +* speed() (in module turtle): Turtle motion. (line 328) +* Spinbox (class in tkinter.ttk): ttk Spinbox. (line 6) +* SPLICE_F_MORE (in module os): File Descriptor Operations. + (line 862) +* SPLICE_F_MOVE (in module os): File Descriptor Operations. + (line 862) +* SPLICE_F_NONBLOCK (in module os): File Descriptor Operations. + (line 862) +* splice() (in module os): File Descriptor Operations. + (line 834) +* split() (BaseExceptionGroup method): Exception groups. (line 70) +* split() (bytearray method): Bytes and Bytearray Operations. + (line 398) +* split() (bytes method): Bytes and Bytearray Operations. + (line 398) +* split() (in module os.path): os path — Common pathname manipulations. + (line 456) +* split() (in module re): Functions<2>. (line 80) +* split() (in module shlex): shlex — Simple lexical analysis. + (line 17) +* split() (re.Pattern method): Regular Expression Objects. + (line 80) +* split() (str method): String Methods<2>. (line 511) +* splitdrive() (in module os.path): os path — Common pathname manipulations. + (line 471) +* splitext() (in module os.path): os path — Common pathname manipulations. + (line 526) +* splitlines() (bytearray method): Bytes and Bytearray Operations. + (line 641) +* splitlines() (bytes method): Bytes and Bytearray Operations. + (line 641) +* splitlines() (str method): String Methods<2>. (line 565) +* SplitResult (class in urllib.parse): Structured Parse Results. + (line 55) +* SplitResultBytes (class in urllib.parse): Structured Parse Results. + (line 82) +* splitroot() (in module os.path): os path — Common pathname manipulations. + (line 495) +* SpooledTemporaryFile (class in tempfile): tempfile — Generate temporary files and directories. + (line 152) +* sprintf-style formatting: printf-style String Formatting. + (line 6) +* sprintf-style formatting <1>: printf-style Bytes Formatting. + (line 6) +* SQLITE_DBCONFIG_DEFENSIVE (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_DQS_DDL (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_DQS_DML (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_FKEY (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_QPSG (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_TRIGGER (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_ENABLE_VIEW (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_LEGACY_ALTER_TABLE (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_LEGACY_FILE_FORMAT (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_RESET_DATABASE (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_TRIGGER_EQP (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_TRUSTED_SCHEMA (in module sqlite3): Module constants. + (line 147) +* SQLITE_DBCONFIG_WRITABLE_SCHEMA (in module sqlite3): Module constants. + (line 147) +* SQLITE_DENY (in module sqlite3): Module constants. (line 49) +* sqlite_errorcode (sqlite3.Error attribute): Exceptions<7>. (line 24) +* sqlite_errorname (sqlite3.Error attribute): Exceptions<7>. (line 30) +* SQLITE_IGNORE (in module sqlite3): Module constants. (line 49) +* SQLITE_OK (in module sqlite3): Module constants. (line 49) +* sqlite_version (in module sqlite3): Module constants. (line 78) +* sqlite_version_info (in module sqlite3): Module constants. (line 83) +* sqrt() (decimal.Context method): Context objects. (line 529) +* sqrt() (decimal.Decimal method): Decimal objects. (line 571) +* sqrt() (in module cmath): Power and logarithmic functions. + (line 22) +* sqrt() (in module math): Power exponential and logarithmic functions. + (line 90) +* ssizeargfunc (C type): Slot Type typedefs. (line 126) +* ssizeobjargproc (C type): Slot Type typedefs. (line 130) +* SSL: ssl — TLS/SSL wrapper for socket objects. + (line 8) +* ssl_version (ftplib.FTP_TLS attribute): FTP_TLS objects. (line 83) +* SSLCertVerificationError: Exceptions<16>. (line 79) +* SSLContext (class in ssl): SSL Contexts. (line 14) +* SSLEOFError: Exceptions<16>. (line 71) +* SSLError: Exceptions<16>. (line 6) +* SSLErrorNumber (class in ssl): Constants<9>. (line 549) +* SSLKEYLOGFILE: Context creation. (line 34) +* SSLKEYLOGFILE <1>: Context creation. (line 83) +* SSLObject (class in ssl): Memory BIO Support<2>. + (line 30) +* sslobject_class (ssl.SSLContext attribute): SSL Contexts. (line 472) +* SSLSession (class in ssl): SSL session. (line 8) +* SSLSocket (class in ssl): SSL Sockets. (line 6) +* sslsocket_class (ssl.SSLContext attribute): SSL Contexts. (line 446) +* SSLSyscallError: Exceptions<16>. (line 62) +* SSLv3 (ssl.TLSVersion attribute): Constants<9>. (line 571) +* SSLWantReadError: Exceptions<16>. (line 44) +* SSLWantWriteError: Exceptions<16>. (line 53) +* SSLZeroReturnError: Exceptions<16>. (line 35) +* ST_ATIME (in module stat): stat — Interpreting stat results. + (line 163) +* st_atime (os.stat_result attribute): Files and Directories. + (line 1187) +* st_atime_ns (os.stat_result attribute): Files and Directories. + (line 1204) +* st_birthtime (os.stat_result attribute): Files and Directories. + (line 1230) +* st_birthtime_ns (os.stat_result attribute): Files and Directories. + (line 1238) +* st_blksize (os.stat_result attribute): Files and Directories. + (line 1275) +* st_blocks (os.stat_result attribute): Files and Directories. + (line 1270) +* st_creator (os.stat_result attribute): Files and Directories. + (line 1311) +* ST_CTIME (in module stat): stat — Interpreting stat results. + (line 171) +* st_ctime (os.stat_result attribute): Files and Directories. + (line 1195) +* st_ctime_ns (os.stat_result attribute): Files and Directories. + (line 1218) +* ST_DEV (in module stat): stat — Interpreting stat results. + (line 142) +* st_dev (os.stat_result attribute): Files and Directories. + (line 1163) +* st_file_attributes (os.stat_result attribute): Files and Directories. + (line 1321) +* st_flags (os.stat_result attribute): Files and Directories. + (line 1285) +* st_fstype (os.stat_result attribute): Files and Directories. + (line 1300) +* st_gen (os.stat_result attribute): Files and Directories. + (line 1293) +* ST_GID (in module stat): stat — Interpreting stat results. + (line 154) +* st_gid (os.stat_result attribute): Files and Directories. + (line 1175) +* ST_INO (in module stat): stat — Interpreting stat results. + (line 138) +* st_ino (os.stat_result attribute): Files and Directories. + (line 1154) +* ST_MODE (in module stat): stat — Interpreting stat results. + (line 134) +* st_mode (os.stat_result attribute): Files and Directories. + (line 1150) +* ST_MTIME (in module stat): stat — Interpreting stat results. + (line 167) +* st_mtime (os.stat_result attribute): Files and Directories. + (line 1191) +* st_mtime_ns (os.stat_result attribute): Files and Directories. + (line 1211) +* ST_NLINK (in module stat): stat — Interpreting stat results. + (line 146) +* st_nlink (os.stat_result attribute): Files and Directories. + (line 1167) +* st_rdev (os.stat_result attribute): Files and Directories. + (line 1281) +* st_reparse_tag (os.stat_result attribute): Files and Directories. + (line 1331) +* st_rsize (os.stat_result attribute): Files and Directories. + (line 1307) +* ST_SIZE (in module stat): stat — Interpreting stat results. + (line 158) +* st_size (os.stat_result attribute): Files and Directories. + (line 1179) +* st_type (os.stat_result attribute): Files and Directories. + (line 1315) +* ST_UID (in module stat): stat — Interpreting stat results. + (line 150) +* st_uid (os.stat_result attribute): Files and Directories. + (line 1171) +* st() (in module turtle): Visibility. (line 15) +* stack (traceback.TracebackException attribute): TracebackException Objects. + (line 75) +* stack viewer: Debug menu Shell window only. + (line 15) +* stack_effect() (in module dis): Analysis functions. (line 187) +* stack_size() (in module _thread): _thread — Low-level threading API. + (line 111) +* stack_size() (in module threading): Reference<2>. (line 158) +* stack; trace: Traceback objects. (line 6) +* stack() (in module inspect): The interpreter stack. + (line 171) +* stackable; streams: codecs — Codec registry and base classes. + (line 8) +* StackSummary (class in traceback): StackSummary Objects. + (line 10) +* stamp() (in module turtle): Turtle motion. (line 272) +* Standard C: String and Bytes literals. + (line 74) +* standard input: Complete Python programs. + (line 25) +* standard library: Glossary. (line 1409) +* standard_b64decode() (in module base64): RFC 4648 Encodings. + (line 54) +* standard_b64encode() (in module base64): RFC 4648 Encodings. + (line 49) +* standard; output: Expression statements. + (line 17) +* standend() (curses.window method): Window Objects. (line 519) +* standout() (curses.window method): Window Objects. (line 524) +* STAR (in module token): token — Constants used with Python parse trees. + (line 203) +* STAREQUAL (in module token): token — Constants used with Python parse trees. + (line 269) +* starmap_async() (multiprocessing.pool.Pool method): Process Pools. + (line 163) +* starmap() (in module itertools): Itertool Functions. (line 551) +* starmap() (multiprocessing.pool.Pool method): Process Pools. + (line 152) +* Starred (class in ast): Variables. (line 40) +* start (range attribute): Ranges. (line 61) +* start (slice attribute): Built-in Functions. (line 1795) +* start (slice object attribute): Slice objects. (line 10) +* start (slice object attribute) <1>: Slicings. (line 26) +* start (UnicodeError attribute): Concrete exceptions. + (line 457) +* start_color() (in module curses): Functions<6>. (line 490) +* start_new_thread() (in module _thread): _thread — Low-level threading API. + (line 32) +* start_ns() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 76) +* start_server() (in module asyncio): Streams. (line 76) +* start_serving() (asyncio.Server method): Server Objects. (line 75) +* start_threads() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 22) +* start_tls() (asyncio.loop method): TLS Upgrade. (line 6) +* start_tls() (asyncio.StreamWriter method): StreamWriter. (line 81) +* start_unix_server() (in module asyncio): Streams. (line 146) +* start() (in module tracemalloc): Functions<11>. (line 68) +* start() (logging.handlers.QueueListener method): QueueListener. + (line 75) +* start() (multiprocessing.managers.BaseManager method): Managers. + (line 57) +* start() (multiprocessing.Process method): Process and exceptions. + (line 91) +* start() (re.Match method): Match Objects. (line 147) +* start() (threading.Thread method): Thread objects. (line 93) +* start() (tkinter.ttk.Progressbar method): ttk Progressbar. (line 8) +* start() (xml.etree.ElementTree.TreeBuilder method): TreeBuilder Objects. + (line 43) +* StartBoundaryNotFoundDefect: email errors Exception and Defect classes. + (line 80) +* startCDATA() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects. + (line 32) +* StartCdataSectionHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 341) +* StartDoctypeDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 224) +* startDocument() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 32) +* startDTD() (xml.sax.handler.LexicalHandler method): LexicalHandler Objects. + (line 23) +* startElement() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 82) +* StartElementHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 262) +* startElementNS() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 102) +* STARTF_FORCEOFFFEEDBACK (in module subprocess): Windows Constants. + (line 47) +* STARTF_FORCEONFEEDBACK (in module subprocess): Windows Constants. + (line 38) +* STARTF_USESHOWWINDOW (in module subprocess): Windows Constants. + (line 33) +* STARTF_USESTDHANDLES (in module subprocess): Windows Constants. + (line 27) +* startfile() (in module os): Process Management. (line 706) +* StartNamespaceDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 320) +* startPrefixMapping() (xml.sax.handler.ContentHandler method): ContentHandler Objects. + (line 49) +* StartResponse (class in wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 11) +* startswith() (bytearray method): Bytes and Bytearray Operations. + (line 253) +* startswith() (bytes method): Bytes and Bytearray Operations. + (line 253) +* startswith() (str method): String Methods<2>. (line 638) +* startTest() (unittest.TestResult method): Loading and running tests. + (line 347) +* startTestRun() (unittest.TestResult method): Loading and running tests. + (line 356) +* starttls() (imaplib.IMAP4 method): IMAP4 Objects. (line 297) +* starttls() (smtplib.SMTP method): SMTP Objects. (line 185) +* STARTUPINFO (class in subprocess): Windows Popen Helpers. + (line 9) +* stat_result (class in os): Files and Directories. + (line 1142) +* stat() (in module os): Files and Directories. + (line 1087) +* stat() (os.DirEntry method): Files and Directories. + (line 1052) +* stat() (pathlib.Path method): Querying file type and status. + (line 13) +* stat() (poplib.POP3 method): POP3 Objects. (line 52) +* state() (tkinter.ttk.Widget method): ttk Widget. (line 25) +* statement: Glossary. (line 1421) +* statement grouping: Indentation. (line 6) +* statement; assert: The assert statement. + (line 6) +* statement; assert <1>: Concrete exceptions. + (line 10) +* statement; assignment, annotated: Annotated assignment statements. + (line 6) +* statement; assignment, augmented: Augmented assignment statements. + (line 6) +* statement; async def: Coroutines<2>. (line 8) +* statement; async for: Coroutine function definition. + (line 28) +* statement; async with: The async for statement. + (line 43) +* statement; break: The break statement. + (line 6) +* statement; break <1>: The while statement. + (line 17) +* statement; break <2>: The for statement. (line 21) +* statement; break <3>: except* clause. (line 57) +* statement; break <4>: finally clause. (line 29) +* statement; class: Class definitions. (line 6) +* statement; continue: The continue statement. + (line 6) +* statement; continue <1>: The while statement. + (line 17) +* statement; continue <2>: The for statement. (line 21) +* statement; continue <3>: except* clause. (line 56) +* statement; continue <4>: finally clause. (line 29) +* statement; def: Function definitions. + (line 6) +* statement; del: Basic customization. + (line 55) +* statement; del <1>: The del statement<2>. + (line 6) +* statement; del <2>: Mutable Sequence Types. + (line 16) +* statement; del <3>: Mapping Types — dict. + (line 6) +* statement; except: Built-in Exceptions. + (line 6) +* statement; for: for Statements. (line 6) +* statement; for <1>: The break statement. + (line 6) +* statement; for <2>: The continue statement. + (line 6) +* statement; for <3>: The for statement. (line 6) +* statement; global: The del statement<2>. + (line 15) +* statement; global <1>: The global statement. + (line 6) +* statement; if: The if statement. (line 6) +* statement; if <1>: Truth Value Testing. + (line 6) +* statement; import: Modules<3>. (line 6) +* statement; import <1>: The import statement. + (line 6) +* statement; import <2>: Built-in Functions. (line 2184) +* statement; import <3>: site — Site-specific configuration hook. + (line 52) +* statement; match: The match statement. + (line 6) +* statement; nonlocal: The nonlocal statement. + (line 6) +* statement; pass: The pass statement. (line 6) +* statement; raise: The raise statement. + (line 6) +* statement; raise <1>: Built-in Exceptions. + (line 14) +* statement; return: The return statement. + (line 6) +* statement; return <1>: except* clause. (line 57) +* statement; return <2>: finally clause. (line 29) +* statement; try: Traceback objects. (line 31) +* statement; try <1>: The try statement. (line 6) +* statement; try <2>: Built-in Exceptions. + (line 6) +* statement; type: The type statement. (line 6) +* statement; while: The break statement. + (line 6) +* statement; while <1>: The continue statement. + (line 6) +* statement; while <2>: The while statement. + (line 6) +* statement; while <3>: Truth Value Testing. + (line 6) +* statement; with: With Statement Context Managers. + (line 14) +* statement; with <1>: The with statement. (line 6) +* statement; yield: The yield statement. + (line 6) +* static type checker: Glossary. (line 1428) +* static_order() (graphlib.TopologicalSorter method): graphlib — Functionality to operate with graph-like structures. + (line 162) +* Statistic (class in tracemalloc): Statistic. (line 6) +* StatisticDiff (class in tracemalloc): StatisticDiff. (line 6) +* statistics() (tracemalloc.Snapshot method): Snapshot. (line 56) +* StatisticsError: Exceptions<5>. (line 8) +* Stats (class in pstats): The Stats Class. (line 9) +* status (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 61) +* status (urllib.response.addinfourl attribute): urllib response — Response classes used by urllib. + (line 24) +* status() (imaplib.IMAP4 method): IMAP4 Objects. (line 310) +* statvfs() (in module os): Files and Directories. + (line 1383) +* STD_ERROR_HANDLE (in module subprocess): Windows Constants. + (line 18) +* STD_INPUT_HANDLE (in module subprocess): Windows Constants. + (line 8) +* STD_OUTPUT_HANDLE (in module subprocess): Windows Constants. + (line 13) +* stderr (asyncio.subprocess.Process attribute): Interacting with Subprocesses. + (line 126) +* stderr (in module sys): I/O objects also known as file objects. + (line 6) +* stderr (in module sys) <1>: sys — System-specific parameters and functions. + (line 1807) +* stderr (in module sys) <2>: Sub-interpreter support. + (line 112) +* stderr (in module sys) <3>: Sub-interpreter support. + (line 197) +* stderr (subprocess.CalledProcessError attribute): Using the subprocess Module. + (line 229) +* stderr (subprocess.CompletedProcess attribute): Using the subprocess Module. + (line 128) +* stderr (subprocess.Popen attribute): Popen Objects. (line 127) +* stderr (subprocess.TimeoutExpired attribute): Using the subprocess Module. + (line 193) +* stdev (statistics.NormalDist attribute): NormalDist objects. + (line 35) +* stdev() (in module statistics): Function details. (line 435) +* stdin (asyncio.subprocess.Process attribute): Interacting with Subprocesses. + (line 116) +* stdin (in module sys): I/O objects also known as file objects. + (line 6) +* stdin (in module sys) <1>: sys — System-specific parameters and functions. + (line 1807) +* stdin (in module sys) <2>: Sub-interpreter support. + (line 112) +* stdin (in module sys) <3>: Sub-interpreter support. + (line 197) +* stdin (subprocess.Popen attribute): Popen Objects. (line 108) +* stdio: I/O objects also known as file objects. + (line 6) +* stdlib: Glossary. (line 1434) +* stdlib_module_names (in module sys): sys — System-specific parameters and functions. + (line 1897) +* stdout (asyncio.subprocess.Process attribute): Interacting with Subprocesses. + (line 121) +* STDOUT (in module subprocess): Using the subprocess Module. + (line 156) +* stdout (in module sys): I/O objects also known as file objects. + (line 6) +* stdout (in module sys) <1>: sys — System-specific parameters and functions. + (line 1807) +* stdout (in module sys) <2>: Sub-interpreter support. + (line 112) +* stdout (in module sys) <3>: Sub-interpreter support. + (line 197) +* stdout (subprocess.CalledProcessError attribute): Using the subprocess Module. + (line 225) +* stdout (subprocess.CompletedProcess attribute): Using the subprocess Module. + (line 118) +* stdout (subprocess.Popen attribute): Popen Objects. (line 117) +* stdout (subprocess.TimeoutExpired attribute): Using the subprocess Module. + (line 189) +* stem (pathlib.PurePath attribute): Methods and properties. + (line 161) +* step (pdb command): Debugger Commands. (line 196) +* step (range attribute): Ranges. (line 70) +* step (slice attribute): Built-in Functions. (line 1799) +* step (slice object attribute): Slice objects. (line 10) +* step (slice object attribute) <1>: Slicings. (line 26) +* step() (tkinter.ttk.Progressbar method): ttk Progressbar. (line 15) +* stls() (poplib.POP3 method): POP3 Objects. (line 114) +* stop (range attribute): Ranges. (line 66) +* stop (slice attribute): Built-in Functions. (line 1797) +* stop (slice object attribute): Slice objects. (line 10) +* stop (slice object attribute) <1>: Slicings. (line 26) +* stop_here() (bdb.Bdb method): bdb — Debugger framework. + (line 249) +* STOP_ITERATION (monitoring event): Events. (line 81) +* stop() (asyncio.loop method): Running and stopping the loop. + (line 31) +* stop() (in module tracemalloc): Functions<11>. (line 98) +* stop() (logging.handlers.QueueListener method): QueueListener. + (line 85) +* stop() (tkinter.ttk.Progressbar method): ttk Progressbar. (line 21) +* stop() (unittest.TestResult method): Loading and running tests. + (line 327) +* StopAsyncIteration: Concrete exceptions. + (line 298) +* StopIteration: Concrete exceptions. + (line 266) +* stopListening() (in module logging.config): Configuration functions. + (line 174) +* stopTest() (unittest.TestResult method): Loading and running tests. + (line 351) +* stopTestRun() (unittest.TestResult method): Loading and running tests. + (line 362) +* storbinary() (ftplib.FTP method): FTP objects. (line 218) +* Store (class in ast): Variables. (line 11) +* STORE_ACTIONS (optparse.Option attribute): Adding new actions. + (line 35) +* STORE_ATTR (opcode): Python Bytecode Instructions. + (line 604) +* STORE_DEREF (opcode): Python Bytecode Instructions. + (line 997) +* STORE_FAST (opcode): Python Bytecode Instructions. + (line 947) +* STORE_FAST_LOAD_FAST (opcode): Python Bytecode Instructions. + (line 958) +* STORE_FAST_STORE_FAST (opcode): Python Bytecode Instructions. + (line 951) +* STORE_GLOBAL (opcode): Python Bytecode Instructions. + (line 625) +* STORE_NAME (opcode): Python Bytecode Instructions. + (line 562) +* STORE_SLICE (opcode): Python Bytecode Instructions. + (line 289) +* STORE_SUBSCR (opcode): Python Bytecode Instructions. + (line 261) +* store() (imaplib.IMAP4 method): IMAP4 Objects. (line 314) +* storlines() (ftplib.FTP method): FTP objects. (line 247) +* str (built-in class): Text Sequence Type — str. + (line 45) +* str (built-in class); (see also string): Ranges. (line 126) +* str_digits_check_threshold (sys.int_info attribute): sys — System-specific parameters and functions. + (line 1160) +* str() (in module locale): locale — Internationalization services. + (line 483) +* strcoll() (in module locale): locale — Internationalization services. + (line 436) +* StreamError: tarfile — Read and write tar archive files. + (line 214) +* StreamHandler (class in logging): StreamHandler. (line 11) +* StreamReader (class in asyncio): StreamReader. (line 6) +* StreamReader (class in codecs): StreamReader Objects. + (line 10) +* streamreader (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 96) +* StreamReaderWriter (class in codecs): StreamReaderWriter Objects. + (line 12) +* StreamRecoder (class in codecs): StreamRecoder Objects. + (line 13) +* StreamRequestHandler (class in socketserver): Request Handler Objects. + (line 56) +* streams: codecs — Codec registry and base classes. + (line 8) +* StreamWriter (class in asyncio): StreamWriter. (line 6) +* StreamWriter (class in codecs): StreamWriter Objects. + (line 10) +* streamwriter (codecs.CodecInfo attribute): codecs — Codec registry and base classes. + (line 96) +* StrEnum (class in enum): Data Types<2>. (line 393) +* strerror (C function): Raising exceptions. (line 60) +* strerror (OSError attribute): Concrete exceptions. + (line 188) +* strerror() (in module os): Process Parameters. (line 530) +* strftime() (datetime.date method): date Objects. (line 300) +* strftime() (datetime.datetime method): datetime Objects. (line 755) +* strftime() (datetime.time method): time Objects. (line 221) +* strftime() (in module time): Functions<5>. (line 319) +* strict (csv.Dialect attribute): Dialects and Formatting Parameters. + (line 87) +* STRICT (enum.FlagBoundary attribute): Data Types<2>. (line 671) +* strict (in module email.policy): email policy Policy Objects. + (line 531) +* strict_domain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 95) +* strict_errors() (in module codecs): Error Handlers. (line 141) +* strict_ns_domain (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 117) +* strict_ns_set_initial_dollar (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 122) +* strict_ns_set_path (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 127) +* strict_ns_unverifiable (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 112) +* strict_rfc2965_unverifiable (http.cookiejar.DefaultCookiePolicy attribute): DefaultCookiePolicy Objects. + (line 103) +* strict; error handler's name: Error Handlers. (line 15) +* STRIDED (inspect.BufferFlags attribute): Buffer flags. (line 37) +* STRIDED_RO (inspect.BufferFlags attribute): Buffer flags. (line 39) +* STRIDES (inspect.BufferFlags attribute): Buffer flags. (line 23) +* strides (memoryview attribute): Memory Views. (line 459) +* STRING (in module token): token — Constants used with Python parse trees. + (line 54) +* string (re.Match attribute): Match Objects. (line 211) +* string literal: Literals. (line 8) +* string_at() (in module ctypes): Utility functions. (line 225) +* string; __format__() (object method): Basic customization. + (line 153) +* string; __str__() (object method): Basic customization. + (line 131) +* string; conversion: Basic customization. + (line 153) +* string; conversion <1>: Expression statements. + (line 17) +* string; format() (built-in function): Built-in Functions. (line 788) +* string; formatted literal: Fancier Output Formatting. + (line 93) +* string; formatted literal <1>: String literal concatenation. + (line 24) +* string; formatted literal <2>: String Methods<2>. (line 753) +* string; formatting, printf: printf-style String Formatting. + (line 6) +* string; immutable sequences: Immutable sequences. + (line 13) +* string; interpolated literal: Fancier Output Formatting. + (line 93) +* string; interpolated literal <1>: String literal concatenation. + (line 24) +* string; interpolated literal <2>: String Methods<2>. (line 753) +* string; interpolation, printf: printf-style String Formatting. + (line 6) +* string; item: Subscriptions. (line 58) +* string; methods: Text Sequence Type — str. + (line 85) +* string; object representation: Finalization and De-allocation. + (line 91) +* string; PyObject_Str (C function): Object Protocol. (line 353) +* string; str (built-in class): Text Sequence Type — str. + (line 45) +* string; str() (built-in function): Built-in Functions. (line 1890) +* string; text sequence type: Ranges. (line 126) +* StringIO (class in io): Text I/O<2>. (line 240) +* strings, documentation: Defining Functions. (line 21) +* strings, documentation <1>: Documentation Strings. + (line 6) +* strip_dirs() (pstats.Stats method): The Stats Class. (line 34) +* strip() (bytearray method): Bytes and Bytearray Operations. + (line 444) +* strip() (bytes method): Bytes and Bytearray Operations. + (line 444) +* strip() (str method): String Methods<2>. (line 645) +* stripspaces (curses.textpad.Textbox attribute): Textbox objects. + (line 115) +* strong reference: Glossary. (line 1438) +* strptime() (datetime.datetime class method): datetime Objects. + (line 255) +* strptime() (in module time): Functions<5>. (line 478) +* strsignal() (in module signal): Module contents<2>. (line 295) +* Struct (class in struct): Classes<3>. (line 8) +* struct_time (class in time): Functions<5>. (line 512) +* structmember.h: Member types. (line 85) +* Structure (class in ctypes): Structured data types. + (line 33) +* strxfrm() (in module locale): locale — Internationalization services. + (line 443) +* STX (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 25) +* Style (class in tkinter.ttk): Ttk Styling. (line 20) +* Sub (class in ast): Expressions<2>. (line 53) +* SUB (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 103) +* sub() (in module operator): operator — Standard operators as functions. + (line 157) +* sub() (in module re): Functions<2>. (line 171) +* sub() (re.Pattern method): Regular Expression Objects. + (line 97) +* subclassing; immutable types: Basic customization. + (line 8) +* subdirs (filecmp.dircmp attribute): The dircmp class. (line 104) +* SubElement() (in module xml.etree.ElementTree): Functions<9>. + (line 209) +* subgroup() (BaseExceptionGroup method): Exception groups. (line 43) +* submit() (concurrent.futures.Executor method): Executor Objects. + (line 12) +* submodule_search_locations (importlib.machinery.ModuleSpec attribute): importlib machinery – Importers and path hooks. + (line 402) +* subn() (in module re): Functions<2>. (line 247) +* subn() (re.Pattern method): Regular Expression Objects. + (line 102) +* subnet_of() (ipaddress.IPv4Network method): Network objects. + (line 215) +* subnet_of() (ipaddress.IPv6Network method): Network objects. + (line 348) +* subnets() (ipaddress.IPv4Network method): Network objects. (line 173) +* subnets() (ipaddress.IPv6Network method): Network objects. (line 344) +* Subnormal (class in decimal): Signals. (line 88) +* suboffsets (memoryview attribute): Memory Views. (line 468) +* subpad() (curses.window method): Window Objects. (line 528) +* subprocess_exec() (asyncio.loop method): Running Subprocesses. + (line 16) +* subprocess_shell() (asyncio.loop method): Running Subprocesses. + (line 115) +* SubprocessError: Using the subprocess Module. + (line 162) +* SubprocessProtocol (class in asyncio): Base Protocols. (line 24) +* SubprocessTransport (class in asyncio): Transports Hierarchy. + (line 50) +* subscribe() (imaplib.IMAP4 method): IMAP4 Objects. (line 338) +* Subscript (class in ast): Subscripting. (line 6) +* subscript; assignment: Mutable Sequence Types. + (line 16) +* subscript; operation: Common Sequence Operations. + (line 21) +* subscription: Sequences. (line 6) +* subscription <1>: Mutable sequences. (line 6) +* subscription <2>: Mappings. (line 6) +* subscription <3>: Subscriptions. (line 6) +* subscription; assignment: Assignment statements. + (line 101) +* subsequent_indent (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 216) +* substitute() (string.Template method): Template strings. (line 40) +* subTest() (unittest.TestCase method): Test cases. (line 105) +* subtract() (collections.Counter method): Counter objects. (line 89) +* subtract() (decimal.Context method): Context objects. (line 533) +* subtraction: Binary arithmetic operations. + (line 83) +* subtype (email.headerregistry.ContentTypeHeader attribute): email headerregistry Custom Header Objects. + (line 278) +* subwin() (curses.window method): Window Objects. (line 535) +* successful() (multiprocessing.pool.AsyncResult method): Process Pools. + (line 217) +* suffix (pathlib.PurePath attribute): Methods and properties. + (line 137) +* suffix_map (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 142) +* suffix_map (mimetypes.MimeTypes attribute): MimeTypes Objects. + (line 23) +* suffixes (pathlib.PurePath attribute): Methods and properties. + (line 150) +* suite: Compound statements. + (line 18) +* suiteClass (unittest.TestLoader attribute): Loading and running tests. + (line 201) +* sum_list(): Reference Count Details. + (line 143) +* sum_sequence(): Reference Count Details. + (line 170) +* sum_sequence() <1>: Exceptions<21>. (line 65) +* summarize_address_range() (in module ipaddress): Other Module Level Functions. + (line 27) +* summarize() (doctest.DocTestRunner method): DocTestRunner objects. + (line 123) +* sumprod() (in module math): Summation and product functions. + (line 62) +* SUNDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* super (built-in class): Built-in Functions. (line 1921) +* super (pyclbr.Class attribute): Class Objects<2>. (line 42) +* supernet_of() (ipaddress.IPv4Network method): Network objects. + (line 226) +* supernet_of() (ipaddress.IPv6Network method): Network objects. + (line 350) +* supernet() (ipaddress.IPv4Network method): Network objects. + (line 199) +* supernet() (ipaddress.IPv6Network method): Network objects. + (line 346) +* supports_bytes_environ (in module os): Process Parameters. (line 536) +* supports_dir_fd (in module os): Files and Directories. + (line 1426) +* supports_effective_ids (in module os): Files and Directories. + (line 1451) +* supports_fd (in module os): Files and Directories. + (line 1470) +* supports_follow_symlinks (in module os): Files and Directories. + (line 1489) +* supports_unicode_filenames (in module os.path): os path — Common pathname manipulations. + (line 556) +* SupportsAbs (class in typing): Protocols<3>. (line 9) +* SupportsBytes (class in typing): Protocols<3>. (line 14) +* SupportsComplex (class in typing): Protocols<3>. (line 18) +* SupportsFloat (class in typing): Protocols<3>. (line 22) +* SupportsIndex (class in typing): Protocols<3>. (line 26) +* SupportsInt (class in typing): Protocols<3>. (line 32) +* SupportsRound (class in typing): Protocols<3>. (line 36) +* suppress() (in module contextlib): Utilities. (line 268) +* SuppressCrashReport (class in test.support): test support — Utilities for the Python test suite. + (line 750) +* surrogateescape; error handler's name: Error Handlers. (line 15) +* surrogatepass; error handler's name: Error Handlers. (line 73) +* SW_HIDE (in module subprocess): Windows Constants. (line 23) +* SWAP (opcode): Python Bytecode Instructions. + (line 169) +* swap_attr() (in module test.support): test support — Utilities for the Python test suite. + (line 369) +* swap_item() (in module test.support): test support — Utilities for the Python test suite. + (line 386) +* swapcase() (bytearray method): Bytes and Bytearray Operations. + (line 665) +* swapcase() (bytes method): Bytes and Bytearray Operations. + (line 665) +* swapcase() (str method): String Methods<2>. (line 669) +* Symbol (class in symtable): Examining Symbol Tables. + (line 191) +* SymbolTable (class in symtable): Examining Symbol Tables. + (line 49) +* SymbolTableType (class in symtable): Examining Symbol Tables. + (line 6) +* symlink_to() (pathlib.Path method): Creating files and directories. + (line 45) +* symlink() (in module os): Files and Directories. + (line 1512) +* symmetric_difference_update() (frozenset method): Set Types — set frozenset. + (line 188) +* symmetric_difference() (frozenset method): Set Types — set frozenset. + (line 116) +* symtable() (in module symtable): Generating Symbol Tables. + (line 6) +* SYMTYPE (in module tarfile): tarfile — Read and write tar archive files. + (line 287) +* SYN (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 91) +* sync() (dbm.dumb.dumbdbm method): dbm dumb — Portable DBM implementation. + (line 79) +* sync() (dbm.gnu.gdbm method): dbm gnu — GNU database manager. + (line 113) +* sync() (in module os): Files and Directories. + (line 1557) +* sync() (shelve.Shelf method): shelve — Python object persistence. + (line 69) +* syncdown() (curses.window method): Window Objects. (line 545) +* synchronized() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 88) +* SyncManager (class in multiprocessing.managers): Managers. (line 150) +* syncok() (curses.window method): Window Objects. (line 551) +* syncup() (curses.window method): Window Objects. (line 556) +* syntax: Notation. (line 6) +* SyntaxErr: Exceptions<20>. (line 93) +* SyntaxError: Concrete exceptions. + (line 305) +* SyntaxWarning: Warnings. (line 43) +* sys_version (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 142) +* sys.exc_info: Traceback objects. (line 6) +* sys.exception: Traceback objects. (line 6) +* sys.last_traceback: Traceback objects. (line 6) +* sys.meta_path: The meta path. (line 6) +* sys.modules: The module cache. (line 6) +* sys.path: Path entry finders. (line 6) +* sys.path_hooks: Path entry finders. (line 6) +* sys.path_importer_cache: Path entry finders. (line 6) +* sys.stderr: I/O objects also known as file objects. + (line 6) +* sys.stdin: I/O objects also known as file objects. + (line 6) +* sys.stdout: I/O objects also known as file objects. + (line 6) +* sysconf_names (in module os): Miscellaneous System Information. + (line 87) +* sysconf() (in module os): Miscellaneous System Information. + (line 77) +* syslog() (in module syslog): syslog — Unix syslog library routines. + (line 20) +* SysLogHandler (class in logging.handlers): SysLogHandler. (line 10) +* system_alias() (in module platform): Cross platform. (line 129) +* system_must_validate_cert() (in module test.support): test support — Utilities for the Python test suite. + (line 457) +* system() (in module os): Process Management. (line 761) +* system() (in module platform): Cross platform. (line 119) +* SystemError: Concrete exceptions. + (line 367) +* SystemError (built-in exception): Module Objects. (line 64) +* SystemError (built-in exception) <1>: Module Objects. (line 92) +* SystemExit: Concrete exceptions. + (line 384) +* SystemExit (built-in exception): Exceptions<2>. (line 26) +* systemId (xml.dom.DocumentType attribute): DocumentType Objects. + (line 22) +* SystemRandom (class in random): Alternative Generator. + (line 51) +* SystemRandom (class in secrets): Random numbers. (line 9) +* SystemRoot: Popen Constructor. (line 308) +* T_BOOL (C macro): Member types. (line 85) +* T_BYTE (C macro): Member types. (line 85) +* T_CHAR (C macro): Member types. (line 85) +* T_DOUBLE (C macro): Member types. (line 85) +* T_FLOAT (C macro): Member types. (line 85) +* T_FMT (in module locale): locale — Internationalization services. + (line 204) +* T_FMT_AMPM (in module locale): locale — Internationalization services. + (line 210) +* T_INT (C macro): Member types. (line 85) +* T_LONG (C macro): Member types. (line 85) +* T_LONGLONG (C macro): Member types. (line 85) +* T_NONE (C macro): Member types. (line 96) +* T_OBJECT (C macro): Member types. (line 90) +* T_OBJECT_EX (C macro): Member types. (line 85) +* T_PYSSIZET (C macro): Member types. (line 85) +* T_SHORT (C macro): Member types. (line 85) +* T_STRING (C macro): Member types. (line 85) +* T_STRING_INPLACE (C macro): Member types. (line 85) +* T_UBYTE (C macro): Member types. (line 85) +* T_UINT (C macro): Member types. (line 85) +* T_ULONG (C macro): Member types. (line 85) +* T_ULONGULONG (C macro): Member types. (line 85) +* T_USHORT (C macro): Member types. (line 85) +* tab: Indentation. (line 6) +* TAB (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 46) +* tab() (tkinter.ttk.Notebook method): ttk Notebook. (line 62) +* TabError: Concrete exceptions. + (line 362) +* tabs() (tkinter.ttk.Notebook method): ttk Notebook. (line 71) +* tabsize (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 173) +* tag (xml.etree.ElementTree.Element attribute): Element Objects. + (line 16) +* tag_bind() (tkinter.ttk.Treeview method): ttk Treeview. (line 293) +* tag_configure() (tkinter.ttk.Treeview method): ttk Treeview. + (line 299) +* tag_has() (tkinter.ttk.Treeview method): ttk Treeview. (line 309) +* tagName (xml.dom.Element attribute): Element Objects<2>. (line 9) +* tail (xml.etree.ElementTree.Element attribute): Element Objects. + (line 21) +* take_snapshot() (in module tracemalloc): Functions<11>. (line 110) +* takewhile() (in module itertools): Itertool Functions. (line 567) +* tan() (in module cmath): Trigonometric functions<2>. + (line 31) +* tan() (in module math): Trigonometric functions. + (line 39) +* tanh() (in module cmath): Hyperbolic functions<2>. + (line 31) +* tanh() (in module math): Hyperbolic functions. + (line 29) +* tar_filter() (in module tarfile): Default named filters. + (line 15) +* TarError: tarfile — Read and write tar archive files. + (line 200) +* TarFile (class in tarfile): TarFile Objects. (line 22) +* tarfile command line option; -c: Command-line options<2>. + (line 11) +* tarfile command line option; -create: Command-line options<2>. + (line 11) +* tarfile command line option; -e: Command-line options<2>. + (line 16) +* tarfile command line option; -extract: Command-line options<2>. + (line 16) +* tarfile command line option; -filter: Command-line options<2>. + (line 31) +* tarfile command line option; -l: Command-line options<2>. + (line 6) +* tarfile command line option; -list: Command-line options<2>. + (line 6) +* tarfile command line option; -t: Command-line options<2>. + (line 22) +* tarfile command line option; -test: Command-line options<2>. + (line 22) +* tarfile command line option; -v: Command-line options<2>. + (line 27) +* tarfile command line option; -verbose: Command-line options<2>. + (line 27) +* target: Assignment statements. + (line 27) +* target (xml.dom.ProcessingInstruction attribute): ProcessingInstruction Objects. + (line 9) +* target; list: Assignment statements. + (line 27) +* target; list <1>: The for statement. (line 6) +* target; list; assignment: Assignment statements. + (line 35) +* TarInfo (class in tarfile): TarInfo Objects. (line 33) +* tarinfo (tarfile.FilterError attribute): tarfile — Read and write tar archive files. + (line 234) +* Task (class in asyncio): Task Object. (line 6) +* task_done() (asyncio.Queue method): Queue. (line 118) +* task_done() (multiprocessing.JoinableQueue method): Pipes and Queues. + (line 256) +* task_done() (queue.Queue method): Queue Objects. (line 73) +* TaskGroup (class in asyncio): Task Groups. (line 9) +* tau (in module cmath): Constants<3>. (line 14) +* tau (in module math): Constants<2>. (line 14) +* tb_frame (traceback attribute): Traceback objects. (line 31) +* tb_frame (traceback attribute) <1>: Traceback objects. (line 33) +* tb_lasti (traceback attribute): Traceback objects. (line 31) +* tb_lasti (traceback attribute) <1>: Traceback objects. (line 44) +* tb_lineno (traceback attribute): Traceback objects. (line 31) +* tb_lineno (traceback attribute) <1>: Traceback objects. (line 41) +* tb_locals (unittest.TestResult attribute): Loading and running tests. + (line 311) +* tb_next (traceback attribute): Traceback objects. (line 52) +* tb_next (traceback attribute) <1>: Traceback objects. (line 52) +* tbreak (pdb command): Debugger Commands. (line 121) +* tcdrain() (in module termios): termios — POSIX style tty control. + (line 65) +* tcflow() (in module termios): termios — POSIX style tty control. + (line 76) +* tcflush() (in module termios): termios — POSIX style tty control. + (line 70) +* tcgetattr() (in module termios): termios — POSIX style tty control. + (line 28) +* tcgetpgrp() (in module os): File Descriptor Operations. + (line 885) +* tcgetwinsize() (in module termios): termios — POSIX style tty control. + (line 83) +* Tcl() (in module tkinter): Tkinter Modules. (line 94) +* TCPServer (class in socketserver): socketserver — A framework for network servers. + (line 20) +* TCSADRAIN (in module termios): termios — POSIX style tty control. + (line 50) +* TCSAFLUSH (in module termios): termios — POSIX style tty control. + (line 54) +* TCSANOW (in module termios): termios — POSIX style tty control. + (line 46) +* tcsendbreak() (in module termios): termios — POSIX style tty control. + (line 59) +* tcsetattr() (in module termios): termios — POSIX style tty control. + (line 39) +* tcsetpgrp() (in module os): File Descriptor Operations. + (line 892) +* tcsetwinsize() (in module termios): termios — POSIX style tty control. + (line 91) +* tearDown() (unittest.TestCase method): Test cases. (line 41) +* tearDownClass() (unittest.TestCase method): Test cases. (line 69) +* tee() (in module itertools): Itertool Functions. (line 586) +* teleport() (in module turtle): Turtle motion. (line 104) +* tell() (io.IOBase method): I/O Base Classes. (line 135) +* tell() (io.TextIOBase method): Text I/O<2>. (line 88) +* tell() (io.TextIOWrapper method): Text I/O<2>. (line 234) +* tell() (mmap.mmap method): mmap — Memory-mapped file support. + (line 316) +* tell() (sqlite3.Blob method): Blob objects. (line 59) +* tell() (wave.Wave_read method): Wave_read Objects. (line 87) +* tell() (wave.Wave_write method): Wave_write Objects. (line 70) +* TEMP: Redirection of local data registry and temporary paths. + (line 7) +* TEMP <1>: tempfile — Generate temporary files and directories. + (line 329) +* temp_cwd() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 135) +* temp_dir() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 150) +* temp_umask() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 160) +* tempdir (in module tempfile): tempfile — Generate temporary files and directories. + (line 376) +* Template (class in string): Template strings. (line 35) +* template (string.Template attribute): Template strings. (line 85) +* temporary (bdb.Breakpoint attribute): bdb — Debugger framework. + (line 91) +* temporary; file: tempfile — Generate temporary files and directories. + (line 8) +* temporary; file name: tempfile — Generate temporary files and directories. + (line 8) +* TemporaryDirectory (class in tempfile): tempfile — Generate temporary files and directories. + (line 184) +* TemporaryFile() (in module tempfile): tempfile — Generate temporary files and directories. + (line 28) +* teredo (ipaddress.IPv6Address attribute): Address objects. (line 320) +* TERM: Functions<6>. (line 485) +* TERM <1>: Functions<6>. (line 512) +* termattrs() (in module curses): Functions<6>. (line 504) +* terminal_size (class in os): Querying the size of a terminal. + (line 25) +* terminate() (asyncio.subprocess.Process method): Interacting with Subprocesses. + (line 96) +* terminate() (asyncio.SubprocessTransport method): Subprocess Transports. + (line 49) +* terminate() (multiprocessing.pool.Pool method): Process Pools. + (line 178) +* terminate() (multiprocessing.Process method): Process and exceptions. + (line 205) +* terminate() (subprocess.Popen method): Popen Objects. (line 86) +* termination model: Exceptions<2>. (line 20) +* terminator (logging.StreamHandler attribute): StreamHandler. + (line 47) +* termname() (in module curses): Functions<6>. (line 510) +* ternary; operator: Conditional expressions. + (line 6) +* ternaryfunc (C type): Slot Type typedefs. (line 122) +* test (doctest.DocTestFailure attribute): Debugging. (line 195) +* test (doctest.UnexpectedException attribute): Debugging. (line 216) +* TEST_DATA_DIR (in module test.support): test support — Utilities for the Python test suite. + (line 137) +* TEST_HOME_DIR (in module test.support): test support — Utilities for the Python test suite. + (line 133) +* TEST_HTTP_URL (in module test.support): test support — Utilities for the Python test suite. + (line 171) +* TEST_SUPPORT_DIR (in module test.support): test support — Utilities for the Python test suite. + (line 128) +* TestCase (class in unittest): Test cases. (line 6) +* TestFailed: test support — Utilities for the Python test suite. + (line 16) +* testfile() (in module doctest): Basic API. (line 12) +* TESTFN (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 19) +* TESTFN_NONASCII (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 25) +* TESTFN_UNDECODABLE (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 39) +* TESTFN_UNENCODABLE (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 33) +* TESTFN_UNICODE (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 45) +* TestLoader (class in unittest): Loading and running tests. + (line 6) +* testMethodPrefix (unittest.TestLoader attribute): Loading and running tests. + (line 187) +* testmod() (in module doctest): Basic API. (line 90) +* testNamePatterns (unittest.TestLoader attribute): Loading and running tests. + (line 209) +* TestResult (class in unittest): Loading and running tests. + (line 226) +* TestResults (class in doctest): TestResults objects. + (line 6) +* testsource() (in module doctest): Debugging. (line 106) +* testsRun (unittest.TestResult attribute): Loading and running tests. + (line 289) +* TestSuite (class in unittest): Grouping tests. (line 6) +* testzip() (zipfile.ZipFile method): ZipFile Objects. (line 262) +* Text (class in typing): Aliases to other concrete types. + (line 21) +* text (SyntaxError attribute): Concrete exceptions. + (line 332) +* text (traceback.TracebackException attribute): TracebackException Objects. + (line 106) +* text (xml.etree.ElementTree.Element attribute): Element Objects. + (line 21) +* text encoding: Glossary. (line 1453) +* text file: Glossary. (line 1466) +* text mode: Built-in Functions. (line 1470) +* text_encoding() (in module io): High-level Module Interface. + (line 38) +* text_factory (sqlite3.Connection attribute): Connection objects. + (line 806) +* Textbox (class in curses.textpad): Textbox objects. (line 8) +* TextCalendar (class in calendar): calendar — General calendar-related functions. + (line 150) +* textdomain() (in module gettext): GNU gettext API. (line 26) +* textdomain() (in module locale): Access to message catalogs. + (line 12) +* textinput() (in module turtle): Input methods. (line 6) +* TextIO (class in typing): ABCs for working with IO. + (line 6) +* TextIOBase (class in io): Text I/O<2>. (line 6) +* TextIOWrapper (class in io): Text I/O<2>. (line 99) +* TextTestResult (class in unittest): Loading and running tests. + (line 446) +* TextTestRunner (class in unittest): Loading and running tests. + (line 463) +* TextWrapper (class in textwrap): textwrap — Text wrapping and filling. + (line 140) +* TFD_CLOEXEC (in module os): Timer File Descriptors. + (line 203) +* TFD_NONBLOCK (in module os): Timer File Descriptors. + (line 192) +* TFD_TIMER_ABSTIME (in module os): Timer File Descriptors. + (line 213) +* TFD_TIMER_CANCEL_ON_SET (in module os): Timer File Descriptors. + (line 224) +* theme_create() (tkinter.ttk.Style method): Ttk Styling. (line 260) +* theme_names() (tkinter.ttk.Style method): Ttk Styling. (line 308) +* theme_settings() (tkinter.ttk.Style method): Ttk Styling. (line 270) +* theme_use() (tkinter.ttk.Style method): Ttk Styling. (line 312) +* THOUSEP (in module locale): locale — Internationalization services. + (line 273) +* Thread (class in threading): Thread objects. (line 57) +* thread_info (in module sys): sys — System-specific parameters and functions. + (line 1916) +* thread_time_ns() (in module time): Functions<5>. (line 631) +* thread_time() (in module time): Functions<5>. (line 613) +* thread() (imaplib.IMAP4 method): IMAP4 Objects. (line 342) +* ThreadedChildWatcher (class in asyncio): Process Watchers. (line 90) +* threading_cleanup() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 31) +* threading_setup() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 37) +* ThreadingHTTPServer (class in http.server): http server — HTTP servers. + (line 37) +* ThreadingMixIn (class in socketserver): Server Creation Notes. + (line 27) +* ThreadingMock (class in unittest.mock): The Mock Class. (line 955) +* ThreadingTCPServer (class in socketserver): Server Creation Notes. + (line 67) +* ThreadingUDPServer (class in socketserver): Server Creation Notes. + (line 67) +* ThreadingUnixDatagramServer (class in socketserver): Server Creation Notes. + (line 67) +* ThreadingUnixStreamServer (class in socketserver): Server Creation Notes. + (line 67) +* ThreadPool (class in multiprocessing.pool): The multiprocessing dummy module. + (line 16) +* ThreadPoolExecutor (class in concurrent.futures): ThreadPoolExecutor. + (line 39) +* threads; POSIX: _thread — Low-level threading API. + (line 16) +* threadsafety (in module sqlite3): Module constants. (line 88) +* throw() (coroutine method): Coroutine Objects. (line 33) +* throw() (generator method): Generator-iterator methods. + (line 38) +* THURSDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* ticket_lifetime_hint (ssl.SSLSession attribute): SSL session. + (line 18) +* tigetflag() (in module curses): Functions<6>. (line 515) +* tigetnum() (in module curses): Functions<6>. (line 522) +* tigetstr() (in module curses): Functions<6>. (line 529) +* TILDE (in module token): token — Constants used with Python parse trees. + (line 248) +* tilt() (in module turtle): Appearance. (line 101) +* tiltangle() (in module turtle): Appearance. (line 117) +* time (class in datetime): time Objects. (line 10) +* time (ssl.SSLSession attribute): SSL session. (line 14) +* time (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 122) +* time_hi_version (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 110) +* time_low (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 104) +* time_mid (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 107) +* time_ns() (in module time): Functions<5>. (line 606) +* time() (asyncio.loop method): Scheduling delayed callbacks. + (line 56) +* time() (datetime.datetime method): datetime Objects. (line 446) +* time() (in module time): Functions<5>. (line 570) +* Time2Internaldate() (in module imaplib): imaplib — IMAP4 protocol client. + (line 127) +* timedelta (class in datetime): timedelta Objects. (line 9) +* TimedRotatingFileHandler (class in logging.handlers): TimedRotatingFileHandler. + (line 10) +* timegm() (in module calendar): calendar — General calendar-related functions. + (line 418) +* timeit command line option; -h: Command-Line Interface<4>. + (line 44) +* timeit command line option; -help: Command-Line Interface<4>. + (line 44) +* timeit command line option; -n: Command-Line Interface<4>. + (line 13) +* timeit command line option; -number: Command-Line Interface<4>. + (line 13) +* timeit command line option; -p: Command-Line Interface<4>. + (line 25) +* timeit command line option; -process: Command-Line Interface<4>. + (line 25) +* timeit command line option; -r: Command-Line Interface<4>. + (line 17) +* timeit command line option; -repeat: Command-Line Interface<4>. + (line 17) +* timeit command line option; -s: Command-Line Interface<4>. + (line 21) +* timeit command line option; -setup: Command-Line Interface<4>. + (line 21) +* timeit command line option; -u: Command-Line Interface<4>. + (line 33) +* timeit command line option; -unit: Command-Line Interface<4>. + (line 33) +* timeit command line option; -v: Command-Line Interface<4>. + (line 40) +* timeit command line option; -verbose: Command-Line Interface<4>. + (line 40) +* timeit() (in module timeit): Python Interface. (line 8) +* timeit() (timeit.Timer method): Python Interface. (line 71) +* timeout: Exceptions<15>. (line 40) +* Timeout (class in asyncio): Timeouts. (line 50) +* timeout (socketserver.BaseServer attribute): Server Objects<2>. + (line 117) +* timeout (ssl.SSLSession attribute): SSL session. (line 16) +* timeout (subprocess.TimeoutExpired attribute): Using the subprocess Module. + (line 177) +* timeout_at() (in module asyncio): Timeouts. (line 98) +* TIMEOUT_MAX (in module _thread): _thread — Low-level threading API. + (line 135) +* TIMEOUT_MAX (in module threading): Reference<2>. (line 184) +* timeout() (curses.window method): Window Objects. (line 561) +* timeout() (in module asyncio): Timeouts. (line 6) +* TimeoutError: OS exceptions. (line 112) +* TimeoutError <1>: Process and exceptions. + (line 277) +* TimeoutError <2>: Exception classes. (line 10) +* TimeoutError <3>: Exceptions<13>. (line 10) +* TimeoutExpired: Using the subprocess Module. + (line 168) +* Timer (class in threading): Timer objects. (line 25) +* Timer (class in timeit): Python Interface. (line 41) +* timerfd_create() (in module os): Timer File Descriptors. + (line 11) +* timerfd_gettime_ns() (in module os): Timer File Descriptors. + (line 183) +* timerfd_gettime() (in module os): Timer File Descriptors. + (line 163) +* timerfd_settime_ns() (in module os): Timer File Descriptors. + (line 152) +* timerfd_settime() (in module os): Timer File Descriptors. + (line 84) +* TimerHandle (class in asyncio): Callback Handles. (line 29) +* times() (in module os): Process Management. (line 798) +* TIMESTAMP (py_compile.PycInvalidationMode attribute): py_compile — Compile Python source files. + (line 102) +* timestamp() (datetime.datetime method): datetime Objects. (line 600) +* timetuple() (datetime.date method): date Objects. (line 210) +* timetuple() (datetime.datetime method): datetime Objects. (line 554) +* timetz() (datetime.datetime method): datetime Objects. (line 455) +* timezone (class in datetime): timezone Objects. (line 14) +* timezone (in module time): Timezone Constants. (line 17) +* title() (bytearray method): Bytes and Bytearray Operations. + (line 690) +* title() (bytes method): Bytes and Bytearray Operations. + (line 690) +* title() (in module turtle): Methods specific to Screen not inherited from TurtleScreen. + (line 49) +* title() (str method): String Methods<2>. (line 675) +* Tk: Graphical User Interfaces with Tk. + (line 6) +* Tk (class in tkinter): Tkinter Modules. (line 14) +* tk (tkinter.Tk attribute): Tkinter Modules. (line 70) +* Tk Option Data Types: Tk Option Data Types. + (line 6) +* Tkinter: Graphical User Interfaces with Tk. + (line 6) +* TLS: ssl — TLS/SSL wrapper for socket objects. + (line 8) +* TLSv1 (ssl.TLSVersion attribute): Constants<9>. (line 573) +* TLSv1_1 (ssl.TLSVersion attribute): Constants<9>. (line 575) +* TLSv1_2 (ssl.TLSVersion attribute): Constants<9>. (line 577) +* TLSv1_3 (ssl.TLSVersion attribute): Constants<9>. (line 579) +* TLSVersion (class in ssl): Constants<9>. (line 555) +* tm_gmtoff (time.struct_time attribute): Functions<5>. (line 555) +* tm_hour (time.struct_time attribute): Functions<5>. (line 532) +* tm_isdst (time.struct_time attribute): Functions<5>. (line 549) +* tm_mday (time.struct_time attribute): Functions<5>. (line 529) +* tm_min (time.struct_time attribute): Functions<5>. (line 535) +* tm_mon (time.struct_time attribute): Functions<5>. (line 526) +* tm_sec (time.struct_time attribute): Functions<5>. (line 538) +* tm_wday (time.struct_time attribute): Functions<5>. (line 543) +* tm_yday (time.struct_time attribute): Functions<5>. (line 546) +* tm_year (time.struct_time attribute): Functions<5>. (line 523) +* tm_zone (time.struct_time attribute): Functions<5>. (line 552) +* TMP: tempfile — Generate temporary files and directories. + (line 331) +* TMPDIR: Library<2>. (line 116) +* TMPDIR <1>: Tests<25>. (line 68) +* TMPDIR <2>: tempfile — Generate temporary files and directories. + (line 327) +* TO_BOOL (opcode): Python Bytecode Instructions. + (line 226) +* to_bytes() (int method): Additional Methods on Integer Types. + (line 56) +* to_eng_string() (decimal.Context method): Context objects. (line 537) +* to_eng_string() (decimal.Decimal method): Decimal objects. (line 575) +* to_integral_exact() (decimal.Context method): Context objects. + (line 547) +* to_integral_exact() (decimal.Decimal method): Decimal objects. + (line 594) +* to_integral_value() (decimal.Decimal method): Decimal objects. + (line 602) +* to_integral() (decimal.Decimal method): Decimal objects. (line 588) +* to_sci_string() (decimal.Context method): Context objects. (line 551) +* to_thread() (in module asyncio): Running in Threads. (line 6) +* ToASCII() (in module encodings.idna): encodings idna — Internationalized Domain Names in Applications. + (line 55) +* tobuf() (tarfile.TarInfo method): TarInfo Objects. (line 49) +* tobytes() (array.array method): array — Efficient arrays of numeric values. + (line 234) +* tobytes() (memoryview method): Memory Views. (line 163) +* today() (datetime.date class method): date Objects. (line 29) +* today() (datetime.datetime class method): datetime Objects. + (line 47) +* tofile() (array.array method): array — Efficient arrays of numeric values. + (line 243) +* tok_name (in module token): token — Constants used with Python parse trees. + (line 25) +* token: Lexical analysis. (line 6) +* token <1>: Glossary. (line 1478) +* Token (class in contextvars): Context Variables. (line 75) +* token (shlex.shlex attribute): shlex Objects. (line 173) +* token_bytes() (in module secrets): Generating tokens. (line 10) +* token_hex() (in module secrets): Generating tokens. (line 19) +* token_urlsafe() (in module secrets): Generating tokens. (line 28) +* TokenError: Tokenizing Input. (line 106) +* tokenize command line option; -e: Command-Line Usage<6>. + (line 19) +* tokenize command line option; -exact: Command-Line Usage<6>. + (line 19) +* tokenize command line option; -h: Command-Line Usage<6>. + (line 15) +* tokenize command line option; -help: Command-Line Usage<6>. + (line 15) +* tokenize() (in module tokenize): Tokenizing Input. (line 8) +* tolist() (array.array method): array — Efficient arrays of numeric values. + (line 248) +* tolist() (memoryview method): Memory Views. (line 204) +* TOMLDecodeError: tomllib — Parse TOML files. + (line 60) +* toordinal() (datetime.date method): date Objects. (line 225) +* toordinal() (datetime.datetime method): datetime Objects. (line 595) +* top_panel() (in module curses.panel): Functions<7>. (line 19) +* top() (curses.panel.Panel method): Panel Objects. (line 53) +* top() (poplib.POP3 method): POP3 Objects. (line 87) +* TopologicalSorter (class in graphlib): graphlib — Functionality to operate with graph-like structures. + (line 10) +* toprettyxml() (xml.dom.minidom.Node method): DOM Objects. (line 72) +* toreadonly() (memoryview method): Memory Views. (line 220) +* tostring() (in module xml.etree.ElementTree): Functions<9>. + (line 222) +* tostringlist() (in module xml.etree.ElementTree): Functions<9>. + (line 244) +* total_changes (sqlite3.Connection attribute): Connection objects. + (line 816) +* total_nframe (tracemalloc.Traceback attribute): Traceback. (line 28) +* total_ordering() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 271) +* total_seconds() (datetime.timedelta method): timedelta Objects. + (line 246) +* total() (collections.Counter method): Counter objects. (line 104) +* touch() (pathlib.Path method): Creating files and directories. + (line 6) +* touchline() (curses.window method): Window Objects. (line 571) +* touchwin() (curses.window method): Window Objects. (line 578) +* tounicode() (array.array method): array — Efficient arrays of numeric values. + (line 252) +* ToUnicode() (in module encodings.idna): encodings idna — Internationalized Domain Names in Applications. + (line 60) +* towards() (in module turtle): Tell Turtle’s state. + (line 15) +* toxml() (xml.dom.minidom.Node method): DOM Objects. (line 52) +* tparm() (in module curses): Functions<6>. (line 536) +* Trace (class in trace): Programmatic Interface. + (line 6) +* Trace (class in tracemalloc): Trace. (line 6) +* trace command line option; -c: Main options. (line 12) +* trace command line option; -C: Modifiers. (line 11) +* trace command line option; -count: Main options. (line 12) +* trace command line option; -coverdir: Modifiers. (line 11) +* trace command line option; -f: Modifiers. (line 6) +* trace command line option; -file: Modifiers. (line 6) +* trace command line option; -g: Modifiers. (line 33) +* trace command line option; -help: Command-Line Usage<3>. + (line 15) +* trace command line option; -ignore-dir: Filters. (line 14) +* trace command line option; -ignore-module: Filters. (line 8) +* trace command line option; -l: Main options. (line 23) +* trace command line option; -listfuncs: Main options. (line 23) +* trace command line option; -m: Modifiers. (line 17) +* trace command line option; -missing: Modifiers. (line 17) +* trace command line option; -no-report: Modifiers. (line 27) +* trace command line option; -r: Main options. (line 27) +* trace command line option; -R: Modifiers. (line 27) +* trace command line option; -report: Main options. (line 27) +* trace command line option; -s: Modifiers. (line 22) +* trace command line option; -summary: Modifiers. (line 22) +* trace command line option; -t: Main options. (line 19) +* trace command line option; -T: Main options. (line 33) +* trace command line option; -timing: Modifiers. (line 33) +* trace command line option; -trace: Main options. (line 19) +* trace command line option; -trackcalls: Main options. (line 33) +* trace command line option; -version: Command-Line Usage<3>. + (line 19) +* trace function: Reference<2>. (line 116) +* trace function <1>: Reference<2>. (line 132) +* trace function <2>: sys — System-specific parameters and functions. + (line 945) +* trace function <3>: sys — System-specific parameters and functions. + (line 1603) +* trace_dispatch() (bdb.Bdb method): bdb — Debugger framework. + (line 165) +* trace() (in module inspect): The interpreter stack. + (line 184) +* Traceback (class in inspect): The interpreter stack. + (line 55) +* Traceback (class in tracemalloc): Traceback. (line 6) +* traceback (tracemalloc.Statistic attribute): Statistic. (line 23) +* traceback (tracemalloc.StatisticDiff attribute): StatisticDiff. + (line 38) +* traceback (tracemalloc.Trace attribute): Trace. (line 27) +* traceback_limit (tracemalloc.Snapshot attribute): Snapshot. + (line 83) +* traceback_limit (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 222) +* TracebackException (class in traceback): TracebackException Objects. + (line 15) +* tracebacklimit (in module sys): sys — System-specific parameters and functions. + (line 1952) +* TracebackType (class in types): Standard Interpreter Types. + (line 186) +* tracer() (in module turtle): Animation control. (line 23) +* traces (tracemalloc.Snapshot attribute): Snapshot. (line 89) +* trailing; comma: Expression lists. (line 29) +* transfercmd() (ftplib.FTP method): FTP objects. (line 257) +* transient_internet() (in module test.support.socket_helper): test support socket_helper — Utilities for socket tests. + (line 64) +* translate() (bytearray method): Bytes and Bytearray Operations. + (line 265) +* translate() (bytes method): Bytes and Bytearray Operations. + (line 265) +* translate() (in module fnmatch): fnmatch — Unix filename pattern matching. + (line 82) +* translate() (in module glob): glob — Unix style pathname pattern expansion. + (line 112) +* translate() (str method): String Methods<2>. (line 709) +* translation() (in module gettext): Class-based API. (line 44) +* transport (asyncio.StreamWriter attribute): StreamWriter. (line 57) +* Transport (class in asyncio): Transports Hierarchy. + (line 29) +* Transport Layer Security: ssl — TLS/SSL wrapper for socket objects. + (line 8) +* traps (decimal.Context attribute): Context objects. (line 133) +* Traversable (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 509) +* Traversable (class in importlib.resources.abc): importlib resources abc – Abstract base classes for resources. + (line 86) +* TraversableResources (class in importlib.abc): importlib abc – Abstract base classes related to import. + (line 564) +* TraversableResources (class in importlib.resources.abc): importlib resources abc – Abstract base classes for resources. + (line 158) +* traverseproc (C type): Supporting Cyclic Garbage Collection. + (line 165) +* TreeBuilder (class in xml.etree.ElementTree): TreeBuilder Objects. + (line 6) +* Treeview (class in tkinter.ttk): ttk Treeview. (line 6) +* triangular() (in module random): Real-valued distributions. + (line 25) +* tries (doctest.DocTestRunner attribute): DocTestRunner objects. + (line 135) +* triple-quoted string: String and Bytes literals. + (line 36) +* triple-quoted string <1>: Glossary. (line 1488) +* True: numbers Integral. (line 27) +* true: Truth Value Testing. + (line 10) +* True <1>: Truth Value Testing. + (line 23) +* True <2>: Boolean Type - bool. + (line 9) +* True (built-in variable): Built-in Constants. (line 13) +* truediv() (in module operator): operator — Standard operators as functions. + (line 162) +* trunc() (in module math): Numeric Types — int float complex. + (line 107) +* trunc() (in module math) <1>: Floating point arithmetic. + (line 87) +* truncate() (in module os): Files and Directories. + (line 1565) +* truncate() (io.IOBase method): I/O Base Classes. (line 139) +* truth; value: Truth Value Testing. + (line 6) +* truth() (in module operator): operator — Standard operators as functions. + (line 57) +* Try (class in ast): Control flow. (line 130) +* TryStar (class in ast): Control flow. (line 173) +* ttk: tkinter ttk — Tk themed widgets. + (line 8) +* tty; I/O control: termios — POSIX style tty control. + (line 6) +* ttyname() (in module os): File Descriptor Operations. + (line 900) +* TUESDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* tuple (built-in class): Tuples. (line 12) +* Tuple (class in ast): Literals<3>. (line 66) +* Tuple (in module typing): Aliases to built-in types. + (line 50) +* Turtle (class in turtle): Public classes. (line 16) +* turtles() (in module turtle): Settings and special methods. + (line 97) +* TurtleScreen (class in turtle): Public classes. (line 22) +* turtlesize() (in module turtle): Appearance. (line 52) +* type: The standard type hierarchy. + (line 6) +* type <1>: Glossary. (line 1498) +* type (built-in class): Built-in Functions. (line 2013) +* Type (class in typing): Aliases to built-in types. + (line 61) +* type (optparse.Option attribute): Option attributes. (line 27) +* type (socket.socket attribute): Socket Objects. (line 619) +* type (tarfile.TarInfo attribute): TarInfo Objects. (line 86) +* type (urllib.request.Request attribute): Request Objects. (line 21) +* type alias: Glossary. (line 1505) +* type hint: Glossary. (line 1527) +* type of an object: Objects values and types. + (line 11) +* type parameters: Type parameter lists. + (line 11) +* TYPE_ALIAS (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 31) +* type_check_only() (in module typing): Functions and decorators. + (line 411) +* TYPE_CHECKER (optparse.Option attribute): Adding new types. + (line 16) +* TYPE_CHECKING (in module typing): Constant. (line 6) +* type_comment (ast.arg attribute): Function and class definitions. + (line 74) +* type_comment (ast.Assign attribute): Statements. (line 15) +* type_comment (ast.For attribute): Control flow. (line 54) +* type_comment (ast.FunctionDef attribute): Function and class definitions. + (line 25) +* type_comment (ast.With attribute): Control flow. (line 236) +* TYPE_COMMENT (in module token): token — Constants used with Python parse trees. + (line 145) +* TYPE_IGNORE (in module token): token — Constants used with Python parse trees. + (line 138) +* TYPE_PARAMETERS (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 35) +* TYPE_VARIABLE (symtable.SymbolTableType attribute): Examining Symbol Tables. + (line 40) +* type; hierarchy: The standard type hierarchy. + (line 6) +* typeahead() (in module curses): Functions<6>. (line 544) +* TypeAlias (class in ast): Statements. (line 163) +* TypeAlias (in module typing): Special types. (line 198) +* TypeAliasType (class in typing): Building generic types and type aliases. + (line 492) +* typecode (array.array attribute): array — Efficient arrays of numeric values. + (line 112) +* typecodes (in module array): array — Efficient arrays of numeric values. + (line 82) +* TYPED_ACTIONS (optparse.Option attribute): Adding new actions. + (line 39) +* typed_subpart_iterator() (in module email.iterators): email iterators Iterators. + (line 26) +* TypedDict (class in typing): Other special directives. + (line 238) +* TypeError: Concrete exceptions. + (line 412) +* TypeGuard (in module typing): Special forms. (line 527) +* TypeIgnore (class in ast): Type annotations. (line 6) +* TypeIs (in module typing): Special forms. (line 437) +* TYPES (optparse.Option attribute): Adding new types. (line 11) +* types_map (in module mimetypes): mimetypes — Map filenames to MIME types. + (line 154) +* types_map (mimetypes.MimeTypes attribute): MimeTypes Objects. + (line 39) +* types_map_inv (mimetypes.MimeTypes attribute): MimeTypes Objects. + (line 47) +* types, internal: Internal types. (line 6) +* TypeVar (class in ast): Type parameters. (line 9) +* TypeVar (class in typing): Building generic types and type aliases. + (line 54) +* TypeVarTuple (class in ast): Type parameters. (line 68) +* TypeVarTuple (class in typing): Building generic types and type aliases. + (line 217) +* TZ: Functions<5>. (line 641) +* TZ <1>: Functions<5>. (line 642) +* TZ <2>: Functions<5>. (line 650) +* TZ <3>: Functions<5>. (line 655) +* TZ <4>: Functions<5>. (line 657) +* TZ <5>: Functions<5>. (line 718) +* tzinfo (class in datetime): tzinfo Objects. (line 6) +* tzinfo (datetime.datetime attribute): datetime Objects. (line 334) +* tzinfo (datetime.time attribute): time Objects. (line 66) +* tzname (in module time): Timezone Constants. (line 23) +* tzname() (datetime.datetime method): datetime Objects. (line 548) +* tzname() (datetime.time method): time Objects. (line 255) +* tzname() (datetime.timezone method): timezone Objects. (line 42) +* tzname() (datetime.tzinfo method): tzinfo Objects. (line 123) +* TZPATH (in module zoneinfo): Globals. (line 6) +* tzset() (in module time): Functions<5>. (line 638) +* U (in module re): Flags. (line 117) +* u'; string literal: Literals. (line 8) +* u"; string literal: Literals. (line 8) +* UAdd (class in ast): Expressions<2>. (line 27) +* ucd_3_2_0 (in module unicodedata): unicodedata — Unicode Database. + (line 131) +* udata (select.kevent attribute): Kevent Objects. (line 179) +* UDPServer (class in socketserver): socketserver — A framework for network servers. + (line 30) +* UF_APPEND (in module stat): stat — Interpreting stat results. + (line 352) +* UF_COMPRESSED (in module stat): stat — Interpreting stat results. + (line 364) +* UF_DATAVAULT (in module stat): stat — Interpreting stat results. + (line 374) +* UF_HIDDEN (in module stat): stat — Interpreting stat results. + (line 380) +* UF_IMMUTABLE (in module stat): stat — Interpreting stat results. + (line 348) +* UF_NODUMP (in module stat): stat — Interpreting stat results. + (line 344) +* UF_NOUNLINK (in module stat): stat — Interpreting stat results. + (line 360) +* UF_OPAQUE (in module stat): stat — Interpreting stat results. + (line 356) +* UF_SETTABLE (in module stat): stat — Interpreting stat results. + (line 338) +* UF_TRACKED (in module stat): stat — Interpreting stat results. + (line 368) +* UID (class in plistlib): plistlib — Generate and parse Apple plist files. + (line 141) +* uid (tarfile.TarInfo attribute): TarInfo Objects. (line 105) +* uid() (imaplib.IMAP4 method): IMAP4 Objects. (line 365) +* uidl() (poplib.POP3 method): POP3 Objects. (line 99) +* ULONG_MAX (C macro): Integer Objects. (line 251) +* ulp() (in module math): Floating point manipulation functions. + (line 108) +* umask() (in module os): Process Parameters. (line 543) +* unalias (pdb command): Debugger Commands. (line 397) +* uname (tarfile.TarInfo attribute): TarInfo Objects. (line 121) +* uname() (in module os): Process Parameters. (line 550) +* uname() (in module platform): Cross platform. (line 143) +* UNARY_INVERT (opcode): Python Bytecode Instructions. + (line 210) +* UNARY_NEGATIVE (opcode): Python Bytecode Instructions. + (line 199) +* UNARY_NOT (opcode): Python Bytecode Instructions. + (line 203) +* unary; arithmetic; operation: Unary arithmetic and bitwise operations. + (line 6) +* unary; bitwise; operation: Unary arithmetic and bitwise operations. + (line 6) +* unaryfunc (C type): Slot Type typedefs. (line 108) +* UnaryOp (class in ast): Expressions<2>. (line 22) +* unbinding; name: The del statement<2>. + (line 15) +* UnboundLocalError: Resolution of names. + (line 16) +* UnboundLocalError <1>: Concrete exceptions. + (line 430) +* unbuffered I/O: Built-in Functions. (line 1470) +* UNC paths; and os.makedirs(): Files and Directories. + (line 544) +* uncancel() (asyncio.Task method): Task Object. (line 271) +* UNCHECKED_HASH (py_compile.PycInvalidationMode attribute): py_compile — Compile Python source files. + (line 115) +* unconsumed_tail (zlib.Decompress attribute): zlib — Compression compatible with gzip. + (line 243) +* unctrl() (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 229) +* unctrl() (in module curses): Functions<6>. (line 556) +* Underflow (class in decimal): Signals. (line 95) +* undisplay (pdb command): Debugger Commands. (line 345) +* undo() (in module turtle): Turtle motion. (line 317) +* undobufferentries() (in module turtle): Special Turtle methods. + (line 74) +* undoc_header (cmd.Cmd attribute): Cmd Objects. (line 166) +* unescape() (in module html): html — HyperText Markup Language support. + (line 23) +* unescape() (in module xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 28) +* UnexpectedException: Debugging. (line 208) +* unexpectedSuccesses (unittest.TestResult attribute): Loading and running tests. + (line 272) +* unfreeze() (in module gc): gc — Garbage Collector interface. + (line 223) +* unget_wch() (in module curses): Functions<6>. (line 576) +* ungetch() (in module curses): Functions<6>. (line 563) +* ungetch() (in module msvcrt): Console I/O. (line 45) +* ungetmouse() (in module curses): Functions<6>. (line 585) +* ungetwch() (in module msvcrt): Console I/O. (line 51) +* unhexlify() (in module binascii): binascii — Convert between binary and ASCII. + (line 144) +* Unicode: Immutable sequences. + (line 15) +* Unicode <1>: unicodedata — Unicode Database. + (line 6) +* Unicode <2>: codecs — Codec registry and base classes. + (line 8) +* UNICODE (in module re): Flags. (line 117) +* Unicode Consortium: String and Bytes literals. + (line 36) +* unicode_literals (in module __future__): Module Contents<5>. + (line 39) +* Unicode; database: unicodedata — Unicode Database. + (line 6) +* UnicodeDecodeError: Concrete exceptions. + (line 470) +* UnicodeEncodeError: Concrete exceptions. + (line 465) +* UnicodeError: Concrete exceptions. + (line 436) +* UnicodeTranslateError: Concrete exceptions. + (line 475) +* UnicodeWarning: Warnings. (line 64) +* unidata_version (in module unicodedata): unicodedata — Unicode Database. + (line 127) +* unified_diff() (in module difflib): difflib — Helpers for computing deltas. + (line 293) +* uniform() (in module random): Real-valued distributions. + (line 16) +* UnimplementedFileMode: http client — HTTP protocol client. + (line 153) +* Union (class in ctypes): Structured data types. + (line 6) +* Union (in module typing): Special forms. (line 9) +* union; type: Union Type. (line 6) +* union() (frozenset method): Set Types — set frozenset. + (line 96) +* UnionType (class in types): Standard Interpreter Types. + (line 180) +* UNIQUE (enum.EnumCheck attribute): Data Types<2>. (line 613) +* unique() (in module enum): Utilities and Decorators. + (line 53) +* unittest command line option; -b: Command-line options<3>. + (line 8) +* unittest command line option; -buffer: Command-line options<3>. + (line 8) +* unittest command line option; -c: Command-line options<3>. + (line 15) +* unittest command line option; -catch: Command-line options<3>. + (line 15) +* unittest command line option; -durations: Command-line options<3>. + (line 49) +* unittest command line option; -f: Command-line options<3>. + (line 24) +* unittest command line option; -failfast: Command-line options<3>. + (line 24) +* unittest command line option; -k: Command-line options<3>. + (line 28) +* unittest command line option; -locals: Command-line options<3>. + (line 45) +* unittest-discover command line option; -p: Test Discovery. (line 35) +* unittest-discover command line option; -pattern: Test Discovery. + (line 35) +* unittest-discover command line option; -s: Test Discovery. (line 31) +* unittest-discover command line option; -start-directory: Test Discovery. + (line 31) +* unittest-discover command line option; -t: Test Discovery. (line 39) +* unittest-discover command line option; -top-level-directory: Test Discovery. + (line 39) +* unittest-discover command line option; -v: Test Discovery. (line 27) +* unittest-discover command line option; -verbose: Test Discovery. + (line 27) +* universal newlines: Glossary. (line 1544) +* universal newlines; bytearray.splitlines method: Bytes and Bytearray Operations. + (line 641) +* universal newlines; bytes.splitlines method: Bytes and Bytearray Operations. + (line 641) +* universal newlines; csv.reader function: Module Contents<3>. + (line 8) +* universal newlines; importlib.abc.InspectLoader.get_source method: importlib abc – Abstract base classes related to import. + (line 218) +* universal newlines; io.IncrementalNewlineDecoder class: Text I/O<2>. + (line 287) +* universal newlines; io.TextIOWrapper class: Text I/O<2>. (line 127) +* universal newlines; open() built-in function: Built-in Functions. + (line 1408) +* universal newlines; str.splitlines method: String Methods<2>. + (line 565) +* universal newlines; subprocess module: Frequently Used Arguments. + (line 33) +* universal newlines; What's new: PEP 3116 New I/O Library. + (line 42) +* universal newlines; What's new <1>: New Improved and Removed Modules. + (line 138) +* universal newlines; What's new <2>: PEP 324 New subprocess Module. + (line 36) +* universal newlines; What's new <3>: PEP 277 Unicode file name support for Windows NT. + (line 36) +* UNIX: Complete Python programs. + (line 25) +* unix_dialect (class in csv): Module Contents<3>. (line 216) +* unix_shell (in module test.support): test support — Utilities for the Python test suite. + (line 44) +* UNIX; file control: fcntl — The fcntl and ioctl system calls. + (line 6) +* UNIX; I/O control: fcntl — The fcntl and ioctl system calls. + (line 6) +* UnixDatagramServer (class in socketserver): socketserver — A framework for network servers. + (line 37) +* UnixStreamServer (class in socketserver): socketserver — A framework for network servers. + (line 37) +* unknown (uuid.SafeUUID attribute): uuid — UUID objects according to RFC 4122. + (line 42) +* unknown_decl() (html.parser.HTMLParser method): HTMLParser Methods. + (line 137) +* unknown_open() (urllib.request.BaseHandler method): BaseHandler Objects. + (line 56) +* unknown_open() (urllib.request.UnknownHandler method): UnknownHandler Objects. + (line 6) +* UnknownHandler (class in urllib.request): urllib request — Extensible library for opening URLs. + (line 443) +* UnknownProtocol: http client — HTTP protocol client. + (line 145) +* UnknownTransferEncoding: http client — HTTP protocol client. + (line 149) +* unlink() (in module os): Files and Directories. + (line 1583) +* unlink() (in module test.support.os_helper): test support os_helper — Utilities for os tests. + (line 164) +* unlink() (multiprocessing.shared_memory.SharedMemory method): multiprocessing shared_memory — Shared memory for direct access across processes. + (line 103) +* unlink() (pathlib.Path method): Renaming and deleting. + (line 48) +* unlink() (xml.dom.minidom.Node method): DOM Objects. (line 10) +* unload() (in module test.support.import_helper): test support import_helper — Utilities for import tests. + (line 76) +* unlock() (mailbox.Babyl method): Babyl objects. (line 59) +* unlock() (mailbox.Mailbox method): Mailbox objects. (line 265) +* unlock() (mailbox.Maildir method): Maildir objects. (line 209) +* unlock() (mailbox.mbox method): mbox objects. (line 57) +* unlock() (mailbox.MH method): MH objects. (line 87) +* unlock() (mailbox.MMDF method): MMDF objects. (line 47) +* unlockpt() (in module os): File Descriptor Operations. + (line 908) +* UNNAMED_SECTION (in module configparser): ConfigParser Objects. + (line 340) +* Unpack (in module typing): Special forms. (line 584) +* unpack_archive() (in module shutil): Archiving operations. + (line 125) +* UNPACK_EX (opcode): Python Bytecode Instructions. + (line 583) +* unpack_from() (in module struct): Functions and Exceptions. + (line 34) +* unpack_from() (struct.Struct method): Classes<3>. (line 40) +* UNPACK_SEQUENCE (opcode): Python Bytecode Instructions. + (line 574) +* unpack() (in module struct): Functions and Exceptions. + (line 26) +* unpack() (struct.Struct method): Classes<3>. (line 34) +* unpacking; dictionary: Dictionary displays. + (line 23) +* unpacking; in function calls: Calls. (line 73) +* unparse() (in module ast): ast Helpers. (line 68) +* unparsedEntityDecl() (xml.sax.handler.DTDHandler method): DTDHandler Objects. + (line 12) +* UnparsedEntityDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 290) +* Unpickler (class in pickle): Module Interface. (line 230) +* UnpicklingError: Module Interface. (line 108) +* unquote_plus() (in module urllib.parse): URL Quoting. (line 81) +* unquote_to_bytes() (in module urllib.parse): URL Quoting. (line 91) +* unquote() (in module email.utils): email utils Miscellaneous utilities. + (line 50) +* unquote() (in module urllib.parse): URL Quoting. (line 61) +* unraisablehook() (in module sys): sys — System-specific parameters and functions. + (line 1960) +* unreachable object: Objects values and types. + (line 37) +* unrecognized escape sequence: Escape sequences. (line 107) +* unregister_archive_format() (in module shutil): Archiving operations. + (line 120) +* unregister_dialect() (in module csv): Module Contents<3>. (line 79) +* unregister_unpack_format() (in module shutil): Archiving operations. + (line 186) +* unregister() (in module atexit): atexit — Exit handlers. + (line 57) +* unregister() (in module codecs): codecs — Codec registry and base classes. + (line 170) +* unregister() (in module faulthandler): Dumping the traceback on a user signal. + (line 23) +* unregister() (select.devpoll method): /dev/poll Polling Objects. + (line 55) +* unregister() (select.epoll method): Edge and Level Trigger Polling epoll Objects. + (line 89) +* unregister() (select.poll method): Polling Objects. (line 67) +* unregister() (selectors.BaseSelector method): Classes<4>. (line 80) +* unsafe (uuid.SafeUUID attribute): uuid — UUID objects according to RFC 4122. + (line 38) +* unselect() (imaplib.IMAP4 method): IMAP4 Objects. (line 376) +* unset() (test.support.os_helper.EnvironmentVarGuard method): test support os_helper — Utilities for os tests. + (line 71) +* unsetenv() (in module os): Process Parameters. (line 585) +* unshare() (in module os): Process Parameters. (line 604) +* UnstructuredHeader (class in email.headerregistry): email headerregistry Custom Header Objects. + (line 115) +* unsubscribe() (imaplib.IMAP4 method): IMAP4 Objects. (line 372) +* UnsupportedOperation: Exceptions<6>. (line 6) +* UnsupportedOperation <1>: High-level Module Interface. + (line 72) +* until (pdb command): Debugger Commands. (line 211) +* untokenize() (in module tokenize): Tokenizing Input. (line 57) +* untouchwin() (curses.window method): Window Objects. (line 583) +* unused_data (bz2.BZ2Decompressor attribute): Incremental de compression. + (line 78) +* unused_data (lzma.LZMADecompressor attribute): Compressing and decompressing data in memory. + (line 169) +* unused_data (zlib.Decompress attribute): zlib — Compression compatible with gzip. + (line 235) +* unverifiable (urllib.request.Request attribute): Request Objects. + (line 47) +* unwrap() (in module inspect): Classes and functions<2>. + (line 139) +* unwrap() (in module urllib.parse): URL Parsing. (line 403) +* unwrap() (ssl.SSLSocket method): SSL Sockets. (line 294) +* up (pdb command): Debugger Commands. (line 92) +* up() (in module turtle): Drawing state. (line 12) +* update_abstractmethods() (in module abc): abc — Abstract Base Classes. + (line 337) +* update_authenticated() (urllib.request.HTTPPasswordMgrWithPriorAuth method): HTTPPasswordMgrWithPriorAuth Objects. + (line 24) +* update_lines_cols() (in module curses): Functions<6>. (line 569) +* update_panels() (in module curses.panel): Functions<7>. (line 23) +* update_visible() (mailbox.BabylMessage method): BabylMessage objects. + (line 76) +* update_wrapper() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 650) +* update() (collections.Counter method): Counter objects. (line 122) +* update() (dict method): Mapping Types — dict. + (line 234) +* update() (frozenset method): Set Types — set frozenset. + (line 169) +* update() (hashlib.hash method): Hash Objects. (line 31) +* update() (hmac.HMAC method): hmac — Keyed-Hashing for Message Authentication. + (line 49) +* update() (http.cookies.Morsel method): Morsel Objects. (line 91) +* update() (in module turtle): Animation control. (line 46) +* update() (mailbox.Mailbox method): Mailbox objects. (line 235) +* update() (mailbox.Maildir method): Maildir objects. (line 193) +* update() (trace.CoverageResults method): Programmatic Interface. + (line 52) +* upgrade_dependencies() (venv.EnvBuilder method): API<2>. (line 166) +* upper() (bytearray method): Bytes and Bytearray Operations. + (line 733) +* upper() (bytes method): Bytes and Bytearray Operations. + (line 733) +* upper() (str method): String Methods<2>. (line 727) +* urandom() (in module os): Random numbers<2>. (line 29) +* URL: urllib parse — Parse URLs into components. + (line 8) +* URL <1>: urllib robotparser — Parser for robots txt. + (line 8) +* URL <2>: http server — HTTP servers. + (line 8) +* url (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 51) +* url (urllib.error.HTTPError attribute): urllib error — Exception classes raised by urllib request. + (line 39) +* url (urllib.response.addinfourl attribute): urllib response — Response classes used by urllib. + (line 14) +* url (xmlrpc.client.ProtocolError attribute): ProtocolError Objects. + (line 13) +* URL; parsing: urllib parse — Parse URLs into components. + (line 8) +* url2pathname() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 156) +* urlcleanup() (in module urllib.request): Legacy interface. (line 62) +* urldefrag() (in module urllib.parse): URL Parsing. (line 377) +* urlencode() (in module urllib.parse): URL Quoting. (line 104) +* URLError: urllib error — Exception classes raised by urllib request. + (line 17) +* urljoin() (in module urllib.parse): URL Parsing. (line 340) +* urlopen() (in module urllib.request): urllib request — Extensible library for opening URLs. + (line 33) +* URLopener (class in urllib.request): Legacy interface. (line 67) +* urlparse() (in module urllib.parse): URL Parsing. (line 9) +* urlretrieve() (in module urllib.request): Legacy interface. + (line 10) +* urlsafe_b64decode() (in module base64): RFC 4648 Encodings. + (line 66) +* urlsafe_b64encode() (in module base64): RFC 4648 Encodings. + (line 59) +* urlsplit() (in module urllib.parse): URL Parsing. (line 250) +* urlunparse() (in module urllib.parse): URL Parsing. (line 242) +* urlunsplit() (in module urllib.parse): URL Parsing. (line 331) +* urn (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 136) +* US (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 118) +* use_default_colors() (in module curses): Functions<6>. (line 600) +* use_env() (in module curses): Functions<6>. (line 590) +* use_rawinput (cmd.Cmd attribute): Cmd Objects. (line 177) +* USE_STACKCHECK (C macro): Operating System Utilities. + (line 91) +* use_tool_id() (in module sys.monitoring): Registering and using tools. + (line 6) +* UseForeignDTD() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 63) +* USER: getpass — Portable password input. + (line 43) +* USER_BASE (in module site): Module contents<5>. (line 31) +* user_call() (bdb.Bdb method): bdb — Debugger framework. + (line 270) +* user_exception() (bdb.Bdb method): bdb — Debugger framework. + (line 289) +* user_line() (bdb.Bdb method): bdb — Debugger framework. + (line 278) +* user_return() (bdb.Bdb method): bdb — Debugger framework. + (line 284) +* USER_SITE (in module site): Module contents<5>. (line 19) +* user-defined; function: User-defined functions. + (line 6) +* user-defined; function; call: Calls. (line 132) +* user-defined; method: Instance methods. (line 6) +* user; effective id: Process Parameters. (line 187) +* user; id: Process Parameters. (line 335) +* user; id, setting: Process Parameters. (line 526) +* user() (poplib.POP3 method): POP3 Objects. (line 31) +* usercustomize: The Customization Modules. + (line 6) +* usercustomize <1>: The Customization Modules. + (line 21) +* UserDict (class in collections): UserDict objects. (line 12) +* UserList (class in collections): UserList objects. (line 16) +* USERNAME: os path — Common pathname manipulations. + (line 145) +* USERNAME <1>: Process Parameters. (line 239) +* USERNAME <2>: getpass — Portable password input. + (line 44) +* username (email.headerregistry.Address attribute): email headerregistry Custom Header Objects. + (line 432) +* USERPROFILE: os path<5>. (line 14) +* USERPROFILE <1>: Changes in the Python API<5>. + (line 116) +* USERPROFILE <2>: Windows<43>. (line 15) +* USERPROFILE <3>: os path — Common pathname manipulations. + (line 142) +* userptr() (curses.panel.Panel method): Panel Objects. (line 57) +* UserString (class in collections): UserString objects. (line 12) +* UserWarning: Warnings. (line 13) +* USTAR_FORMAT (in module tarfile): tarfile — Read and write tar archive files. + (line 327) +* USub (class in ast): Expressions<2>. (line 27) +* UTC: time — Time access and conversions. + (line 39) +* utc (datetime.timezone attribute): timezone Objects. (line 68) +* UTC (in module datetime): Constants. (line 18) +* utcfromtimestamp() (datetime.datetime class method): datetime Objects. + (line 131) +* utcnow() (datetime.datetime class method): datetime Objects. + (line 81) +* utcoffset() (datetime.datetime method): datetime Objects. (line 528) +* utcoffset() (datetime.time method): time Objects. (line 235) +* utcoffset() (datetime.timezone method): timezone Objects. (line 30) +* utcoffset() (datetime.tzinfo method): tzinfo Objects. (line 38) +* utctimetuple() (datetime.datetime method): datetime Objects. + (line 573) +* utf8 (email.policy.EmailPolicy attribute): email policy Policy Objects. + (line 380) +* utf8_enabled (imaplib.IMAP4 attribute): IMAP4 Objects. (line 404) +* utf8_mode (sys.flags attribute): sys — System-specific parameters and functions. + (line 572) +* utf8() (poplib.POP3 method): POP3 Objects. (line 106) +* utime() (in module os): Files and Directories. + (line 1597) +* UUID (class in uuid): uuid — UUID objects according to RFC 4122. + (line 47) +* uuid command line option; -h: Command-Line Usage<2>. + (line 15) +* uuid command line option; -help: Command-Line Usage<2>. + (line 15) +* uuid command line option; -n: Command-Line Usage<2>. + (line 25) +* uuid command line option; -N: Command-Line Usage<2>. + (line 33) +* uuid command line option; -name: Command-Line Usage<2>. + (line 33) +* uuid command line option; -namespace: Command-Line Usage<2>. + (line 25) +* uuid command line option; -u: Command-Line Usage<2>. + (line 19) +* uuid command line option; -uuid: Command-Line Usage<2>. + (line 19) +* uuid1() (in module uuid): uuid — UUID objects according to RFC 4122. + (line 179) +* uuid3() (in module uuid): uuid — UUID objects according to RFC 4122. + (line 187) +* uuid4() (in module uuid): uuid — UUID objects according to RFC 4122. + (line 193) +* uuid5() (in module uuid): uuid — UUID objects according to RFC 4122. + (line 197) +* v4_int_to_packed() (in module ipaddress): Other Module Level Functions. + (line 8) +* v6_int_to_packed() (in module ipaddress): Other Module Level Functions. + (line 20) +* valid_signals() (in module signal): Module contents<2>. (line 304) +* validator() (in module wsgiref.validate): wsgiref validate — WSGI conformance checker. + (line 22) +* value: Dictionary displays. + (line 6) +* value (ctypes._SimpleCData attribute): Fundamental data types<2>. + (line 17) +* value (enum.Enum attribute): Data Types<2>. (line 131) +* value (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 32) +* value (http.cookies.Morsel attribute): Morsel Objects. (line 49) +* value (StopIteration attribute): Concrete exceptions. + (line 272) +* value (xml.dom.Attr attribute): Attr Objects. (line 23) +* value of an object: Objects values and types. + (line 11) +* value_decode() (http.cookies.BaseCookie method): Cookie Objects. + (line 6) +* value_encode() (http.cookies.BaseCookie method): Cookie Objects. + (line 13) +* Value() (in module multiprocessing.sharedctypes): The multiprocessing sharedctypes module. + (line 67) +* Value() (in module multiprocessing): Shared ctypes Objects. + (line 9) +* Value() (multiprocessing.managers.SyncManager method): Managers. + (line 217) +* ValueError: Concrete exceptions. + (line 480) +* valuerefs() (weakref.WeakValueDictionary method): weakref — Weak references. + (line 227) +* Values (class in optparse): Defining options. (line 84) +* values() (contextvars.Context method): Manual Context Management. + (line 137) +* values() (dict method): Mapping Types — dict. + (line 247) +* values() (email.message.EmailMessage method): email message Representing an email message. + (line 236) +* values() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 347) +* values() (mailbox.Mailbox method): Mailbox objects. (line 128) +* values() (types.MappingProxyType method): Standard Interpreter Types. + (line 276) +* ValuesView (class in collections.abc): Collections Abstract Base Classes – Detailed Descriptions. + (line 102) +* ValuesView (class in typing): Aliases to container ABCs in collections abc. + (line 106) +* var (contextvars.Token attribute): Context Variables. (line 82) +* variable annotation: Glossary. (line 1552) +* variance (statistics.NormalDist attribute): NormalDist objects. + (line 40) +* variance() (in module statistics): Function details. (line 444) +* variant (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 140) +* VBAR (in module token): token — Constants used with Python parse trees. + (line 209) +* vbar (tkinter.scrolledtext.ScrolledText attribute): tkinter scrolledtext — Scrolled Text Widget. + (line 30) +* VBAREQUAL (in module token): token — Constants used with Python parse trees. + (line 281) +* VC_ASSEMBLY_PUBLICKEYTOKEN (in module msvcrt): Other Functions. + (line 93) +* Vec2D (class in turtle): Public classes. (line 86) +* vectorcallfunc (C type): The Vectorcall Protocol. + (line 41) +* venv command line option; -clear: Creating virtual environments. + (line 64) +* venv command line option; -copies: Creating virtual environments. + (line 59) +* venv command line option; -prompt: Creating virtual environments. + (line 79) +* venv command line option; -symlinks: Creating virtual environments. + (line 54) +* venv command line option; -system-site-packages: Creating virtual environments. + (line 49) +* venv command line option; -upgrade: Creating virtual environments. + (line 69) +* venv command line option; -upgrade-deps: Creating virtual environments. + (line 83) +* venv command line option; -without-pip: Creating virtual environments. + (line 74) +* venv command line option; -without-scm-ignore-files: Creating virtual environments. + (line 87) +* venv command line option; ENV_DIR: Creating virtual environments. + (line 44) +* VERBOSE (in module re): Flags. (line 127) +* verbose (in module tabnanny): tabnanny — Detection of ambiguous indentation. + (line 26) +* verbose (in module test.support): test support — Utilities for the Python test suite. + (line 30) +* verbose (sys.flags attribute): sys — System-specific parameters and functions. + (line 556) +* VERIFY_ALLOW_PROXY_CERTS (in module ssl): Constants<9>. (line 98) +* verify_client_post_handshake() (ssl.SSLSocket method): SSL Sockets. + (line 303) +* verify_code (ssl.SSLCertVerificationError attribute): Exceptions<16>. + (line 86) +* VERIFY_CRL_CHECK_CHAIN (in module ssl): Constants<9>. (line 84) +* VERIFY_CRL_CHECK_LEAF (in module ssl): Constants<9>. (line 73) +* VERIFY_DEFAULT (in module ssl): Constants<9>. (line 65) +* verify_flags (ssl.SSLContext attribute): SSL Contexts. (line 633) +* verify_generated_headers (email.policy.Policy attribute): email policy Policy Objects. + (line 204) +* verify_message (ssl.SSLCertVerificationError attribute): Exceptions<16>. + (line 90) +* verify_mode (ssl.SSLContext attribute): SSL Contexts. (line 648) +* verify_request() (socketserver.BaseServer method): Server Objects<2>. + (line 178) +* VERIFY_X509_PARTIAL_CHAIN (in module ssl): Constants<9>. (line 114) +* VERIFY_X509_STRICT (in module ssl): Constants<9>. (line 91) +* VERIFY_X509_TRUSTED_FIRST (in module ssl): Constants<9>. (line 105) +* verify() (in module enum): Utilities and Decorators. + (line 72) +* verify() (smtplib.SMTP method): SMTP Objects. (line 91) +* VerifyFlags (class in ssl): Constants<9>. (line 125) +* VerifyMode (class in ssl): Constants<9>. (line 59) +* version (email.headerregistry.MIMEVersionHeader attribute): email headerregistry Custom Header Objects. + (line 242) +* version (http.client.HTTPResponse attribute): HTTPResponse Objects. + (line 46) +* version (http.cookiejar.Cookie attribute): Cookie Objects<2>. + (line 20) +* version (http.cookies.Morsel attribute): Morsel Objects. (line 13) +* version (in module curses): Constants<6>. (line 18) +* version (in module marshal): marshal — Internal Python object serialization. + (line 129) +* version (in module sqlite3): Module constants. (line 127) +* version (in module sys): sys — System-specific parameters and functions. + (line 2008) +* version (in module sys) <1>: Process-wide parameters. + (line 164) +* version (in module sys) <2>: Process-wide parameters. + (line 201) +* version (in module sys) <3>: Process-wide parameters. + (line 212) +* version (ipaddress.IPv4Address attribute): Address objects. + (line 45) +* version (ipaddress.IPv4Network attribute): Network objects. + (line 63) +* version (ipaddress.IPv6Address attribute): Address objects. + (line 271) +* version (ipaddress.IPv6Network attribute): Network objects. + (line 293) +* version (sys.thread_info attribute): sys — System-specific parameters and functions. + (line 1945) +* version (urllib.request.URLopener attribute): Legacy interface. + (line 138) +* version (uuid.UUID attribute): uuid — UUID objects according to RFC 4122. + (line 147) +* version_info (in module sqlite3): Module constants. (line 137) +* version_info (in module sys): sys — System-specific parameters and functions. + (line 2023) +* version_string() (http.server.BaseHTTPRequestHandler method): http server — HTTP servers. + (line 314) +* version() (in module ensurepip): Module API. (line 8) +* version() (in module importlib.metadata): Distribution versions. + (line 6) +* version() (in module platform): Cross platform. (line 135) +* version() (ssl.SSLSocket method): SSL Sockets. (line 325) +* vformat() (string.Formatter method): Custom String Formatting. + (line 26) +* virtual environment: Glossary. (line 1575) +* virtual machine: Glossary. (line 1584) +* visit_Constant() (ast.NodeVisitor method): ast Helpers. (line 210) +* visit() (ast.NodeVisitor method): ast Helpers. (line 194) +* visitproc (C type): Supporting Cyclic Garbage Collection. + (line 153) +* vline() (curses.window method): Window Objects. (line 588) +* voidcmd() (ftplib.FTP method): FTP objects. (line 165) +* volume (zipfile.ZipInfo attribute): ZipInfo Objects. (line 120) +* vonmisesvariate() (in module random): Real-valued distributions. + (line 93) +* VT (in module curses.ascii): curses ascii — Utilities for ASCII characters. + (line 58) +* W_OK (in module os): Files and Directories. + (line 107) +* wait_closed() (asyncio.Server method): Server Objects. (line 123) +* wait_closed() (asyncio.StreamWriter method): StreamWriter. (line 114) +* wait_for() (asyncio.Condition method): Condition. (line 102) +* wait_for() (in module asyncio): Timeouts. (line 118) +* wait_for() (threading.Condition method): Condition objects. + (line 128) +* wait_process() (in module test.support): test support — Utilities for the Python test suite. + (line 419) +* wait_threads_exit() (in module test.support.threading_helper): test support threading_helper — Utilities for threading tests. + (line 41) +* wait_until_any_call_with() (unittest.mock.ThreadingMock method): The Mock Class. + (line 985) +* wait_until_called() (unittest.mock.ThreadingMock method): The Mock Class. + (line 970) +* wait() (asyncio.Barrier method): Barrier. (line 52) +* wait() (asyncio.Condition method): Condition. (line 85) +* wait() (asyncio.Event method): Event. (line 44) +* wait() (asyncio.subprocess.Process method): Interacting with Subprocesses. + (line 38) +* wait() (in module asyncio): Waiting Primitives. (line 6) +* wait() (in module concurrent.futures): Module Functions. (line 6) +* wait() (in module multiprocessing.connection): Listeners and Clients. + (line 113) +* wait() (in module os): Process Management. (line 826) +* wait() (multiprocessing.pool.AsyncResult method): Process Pools. + (line 208) +* wait() (subprocess.Popen method): Popen Objects. (line 13) +* wait() (threading.Barrier method): Barrier objects. (line 43) +* wait() (threading.Condition method): Condition objects. (line 97) +* wait() (threading.Event method): Event objects. (line 42) +* wait3() (in module os): Process Management. (line 936) +* wait4() (in module os): Process Management. (line 950) +* waitid() (in module os): Process Management. (line 850) +* waitpid() (in module os): Process Management. (line 889) +* waitstatus_to_exitcode() (in module os): Process Management. + (line 1068) +* walk_packages() (in module pkgutil): pkgutil — Package extension utility. + (line 146) +* walk_stack() (in module traceback): Module-Level Functions<2>. + (line 185) +* walk_tb() (in module traceback): Module-Level Functions<2>. + (line 194) +* walk() (email.message.EmailMessage method): email message Representing an email message. + (line 467) +* walk() (email.message.Message method): email message Message Representing an email message using the compat32 API. + (line 639) +* walk() (in module ast): ast Helpers. (line 177) +* walk() (in module os): Files and Directories. + (line 1641) +* walk() (pathlib.Path method): Reading directories. + (line 102) +* walrus operator: Boolean operations. (line 38) +* walrus operator <1>: Glossary. (line 1590) +* want (doctest.Example attribute): Example Objects. (line 23) +* warn_default_encoding (sys.flags attribute): sys — System-specific parameters and functions. + (line 582) +* warn_explicit() (in module warnings): Available Functions. + (line 62) +* warn() (in module warnings): Available Functions. + (line 6) +* Warning: Warnings. (line 9) +* Warning <1>: Exceptions<7>. (line 8) +* WARNING (in module logging): Logging Levels. (line 33) +* WARNING (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 198) +* warning() (in module logging): Module-Level Functions. + (line 70) +* warning() (logging.Logger method): Logger Objects. (line 293) +* warning() (xml.sax.handler.ErrorHandler method): ErrorHandler Objects. + (line 29) +* warnings: warnings — Warning control. + (line 8) +* WarningsRecorder (class in test.support.warnings_helper): test support warnings_helper — Utilities for warnings tests. + (line 118) +* warnoptions (in module sys): sys — System-specific parameters and functions. + (line 2036) +* wasSuccessful() (unittest.TestResult method): Loading and running tests. + (line 318) +* WatchedFileHandler (class in logging.handlers): WatchedFileHandler. + (line 24) +* Wave_read (class in wave): Wave_read Objects. (line 6) +* Wave_write (class in wave): Wave_write Objects. (line 6) +* WCONTINUED (in module os): Process Management. (line 990) +* WCOREDUMP() (in module os): Process Management. (line 1108) +* WeakKeyDictionary (class in weakref): weakref — Weak references. + (line 166) +* WeakMethod (class in weakref): weakref — Weak references. + (line 236) +* WeakSet (class in weakref): weakref — Weak references. + (line 231) +* WeakValueDictionary (class in weakref): weakref — Weak references. + (line 214) +* webbrowser command line option; -n: webbrowser — Convenient web-browser controller. + (line 46) +* webbrowser command line option; -new-tab: webbrowser — Convenient web-browser controller. + (line 50) +* webbrowser command line option; -new-window: webbrowser — Convenient web-browser controller. + (line 46) +* webbrowser command line option; -t: webbrowser — Convenient web-browser controller. + (line 50) +* WEDNESDAY (in module calendar): calendar — General calendar-related functions. + (line 447) +* weekday (calendar.IllegalWeekdayError attribute): calendar — General calendar-related functions. + (line 532) +* weekday() (datetime.date method): date Objects. (line 231) +* weekday() (datetime.datetime method): datetime Objects. (line 637) +* weekday() (in module calendar): calendar — General calendar-related functions. + (line 376) +* weekheader() (in module calendar): calendar — General calendar-related functions. + (line 381) +* weibullvariate() (in module random): Real-valued distributions. + (line 105) +* WEXITED (in module os): Process Management. (line 999) +* WEXITSTATUS() (in module os): Process Management. (line 1154) +* wfile (http.server.BaseHTTPRequestHandler attribute): http server — HTTP servers. + (line 123) +* wfile (socketserver.DatagramRequestHandler attribute): Request Handler Objects. + (line 68) +* whatis (pdb command): Debugger Commands. (line 281) +* when() (asyncio.Timeout method): Timeouts. (line 63) +* when() (asyncio.TimerHandle method): Callback Handles. (line 36) +* where (pdb command): Debugger Commands. (line 81) +* which() (in module shutil): Directory and files operations. + (line 417) +* whichdb() (in module dbm): dbm — Interfaces to Unix “databases”. + (line 29) +* While (class in ast): Control flow. (line 77) +* whitespace (in module string): String constants. (line 52) +* whitespace (shlex.shlex attribute): shlex Objects. (line 104) +* whitespace_split (shlex.shlex attribute): shlex Objects. (line 128) +* Widget (class in tkinter.ttk): ttk Widget. (line 9) +* width (sys.hash_info attribute): sys — System-specific parameters and functions. + (line 1037) +* width (textwrap.TextWrapper attribute): textwrap — Text wrapping and filling. + (line 160) +* width() (in module turtle): Drawing state. (line 18) +* WIFCONTINUED() (in module os): Process Management. (line 1118) +* WIFEXITED() (in module os): Process Management. (line 1146) +* WIFSIGNALED() (in module os): Process Management. (line 1139) +* WIFSTOPPED() (in module os): Process Management. (line 1128) +* win32_edition() (in module platform): Windows platform. (line 22) +* win32_is_iot() (in module platform): Windows platform. (line 31) +* win32_ver() (in module platform): Windows platform. (line 6) +* WinDLL (class in ctypes): Loading shared libraries. + (line 54) +* window manager (widgets): The Window Manager. (line 6) +* window_height() (in module turtle): Settings and special methods. + (line 104) +* window_width() (in module turtle): Settings and special methods. + (line 111) +* window() (curses.panel.Panel method): Panel Objects. (line 62) +* Windows: Complete Python programs. + (line 25) +* Windows ini file: configparser — Configuration file parser. + (line 8) +* WindowsError: Concrete exceptions. + (line 501) +* WindowsPath (class in pathlib): Concrete paths. (line 36) +* WindowsProactorEventLoopPolicy (class in asyncio): Policy Objects. + (line 78) +* WindowsRegistryFinder (class in importlib.machinery): importlib machinery – Importers and path hooks. + (line 92) +* WindowsSelectorEventLoopPolicy (class in asyncio): Policy Objects. + (line 71) +* winerror (OSError attribute): Concrete exceptions. + (line 176) +* WinError() (in module ctypes): Utility functions. (line 234) +* WINFUNCTYPE() (in module ctypes): Function prototypes. + (line 25) +* WinSock: select — Waiting for I/O completion. + (line 151) +* winver (in module sys): sys — System-specific parameters and functions. + (line 2042) +* With (class in ast): Control flow. (line 230) +* WITH_EXCEPT_START (opcode): Python Bytecode Instructions. + (line 488) +* with_hostmask (ipaddress.IPv4Interface attribute): Interface objects. + (line 55) +* with_hostmask (ipaddress.IPv4Network attribute): Network objects. + (line 123) +* with_hostmask (ipaddress.IPv6Interface attribute): Interface objects. + (line 82) +* with_hostmask (ipaddress.IPv6Network attribute): Network objects. + (line 325) +* with_name() (pathlib.PurePath method): Methods and properties. + (line 354) +* with_netmask (ipaddress.IPv4Interface attribute): Interface objects. + (line 46) +* with_netmask (ipaddress.IPv4Network attribute): Network objects. + (line 118) +* with_netmask (ipaddress.IPv6Interface attribute): Interface objects. + (line 80) +* with_netmask (ipaddress.IPv6Network attribute): Network objects. + (line 323) +* with_prefixlen (ipaddress.IPv4Interface attribute): Interface objects. + (line 37) +* with_prefixlen (ipaddress.IPv4Network attribute): Network objects. + (line 105) +* with_prefixlen (ipaddress.IPv6Interface attribute): Interface objects. + (line 78) +* with_prefixlen (ipaddress.IPv6Network attribute): Network objects. + (line 317) +* with_pymalloc() (in module test.support): test support — Utilities for the Python test suite. + (line 255) +* with_segments() (pathlib.PurePath method): Methods and properties. + (line 410) +* with_statement (in module __future__): Module Contents<5>. (line 31) +* with_stem() (pathlib.PurePath method): Methods and properties. + (line 370) +* with_suffix() (pathlib.PurePath method): Methods and properties. + (line 393) +* with_traceback() (BaseException method): Base classes. (line 25) +* withitem (class in ast): Control flow. (line 241) +* WNOHANG (in module os): Process Management. (line 1033) +* WNOWAIT (in module os): Process Management. (line 1041) +* wordchars (shlex.shlex attribute): shlex Objects. (line 91) +* World Wide Web: Internet Protocols and Support. + (line 6) +* World Wide Web <1>: urllib parse — Parse URLs into components. + (line 8) +* World Wide Web <2>: urllib robotparser — Parser for robots txt. + (line 8) +* wrap_bio() (ssl.SSLContext method): SSL Contexts. (line 455) +* wrap_future() (in module asyncio): Future Functions. (line 51) +* wrap_socket() (ssl.SSLContext method): SSL Contexts. (line 388) +* wrap() (in module textwrap): textwrap — Text wrapping and filling. + (line 16) +* wrap() (textwrap.TextWrapper method): textwrap — Text wrapping and filling. + (line 286) +* wrapper() (in module curses): Functions<6>. (line 609) +* WrapperDescriptorType (in module types): Standard Interpreter Types. + (line 88) +* wraps() (in module functools): functools — Higher-order functions and operations on callable objects. + (line 698) +* WRITABLE (in module _tkinter): File Handlers. (line 41) +* WRITABLE (inspect.BufferFlags attribute): Buffer flags. (line 17) +* writable() (bz2.BZ2File method): De compression of files. + (line 106) +* writable() (io.IOBase method): I/O Base Classes. (line 152) +* WRITE (inspect.BufferFlags attribute): Buffer flags. (line 51) +* write_byte() (mmap.mmap method): mmap — Memory-mapped file support. + (line 336) +* write_bytes() (pathlib.Path method): Reading and writing files. + (line 67) +* write_docstringdict() (in module turtle): Translation of docstrings into different languages. + (line 10) +* write_eof() (asyncio.StreamWriter method): StreamWriter. (line 52) +* write_eof() (asyncio.WriteTransport method): Write-only Transports. + (line 74) +* write_eof() (ssl.MemoryBIO method): Memory BIO Support<2>. + (line 161) +* write_history_file() (in module readline): History file. (line 14) +* WRITE_RESTRICTED (C macro): Member flags. (line 32) +* write_results() (trace.CoverageResults method): Programmatic Interface. + (line 57) +* write_text() (pathlib.Path method): Reading and writing files. + (line 48) +* write_through (io.TextIOWrapper attribute): Text I/O<2>. (line 175) +* write() (asyncio.StreamWriter method): StreamWriter. (line 15) +* write() (asyncio.WriteTransport method): Write-only Transports. + (line 60) +* write() (code.InteractiveInterpreter method): Interactive Interpreter Objects. + (line 63) +* write() (codecs.StreamWriter method): StreamWriter Objects. + (line 31) +* write() (configparser.ConfigParser method): ConfigParser Objects. + (line 292) +* write() (email.generator.BytesGenerator method): email generator Generating MIME documents. + (line 117) +* write() (email.generator.Generator method): email generator Generating MIME documents. + (line 213) +* write() (in module os): File Descriptor Operations. + (line 920) +* write() (in module turtle): More drawing control. + (line 29) +* write() (io.BufferedIOBase method): I/O Base Classes. (line 335) +* write() (io.BufferedWriter method): Buffered Streams. (line 128) +* write() (io.RawIOBase method): I/O Base Classes. (line 212) +* write() (io.TextIOBase method): Text I/O<2>. (line 94) +* write() (mmap.mmap method): mmap — Memory-mapped file support. + (line 320) +* write() (sqlite3.Blob method): Blob objects. (line 53) +* write() (ssl.MemoryBIO method): Memory BIO Support<2>. + (line 153) +* write() (ssl.SSLSocket method): SSL Sockets. (line 96) +* write() (xml.etree.ElementTree.ElementTree method): ElementTree Objects. + (line 62) +* write() (zipfile.ZipFile method): ZipFile Objects. (line 272) +* writeframes() (wave.Wave_write method): Wave_write Objects. + (line 83) +* writeframesraw() (wave.Wave_write method): Wave_write Objects. + (line 76) +* writeheader() (csv.DictWriter method): Writer Objects. (line 39) +* writelines() (asyncio.StreamWriter method): StreamWriter. (line 26) +* writelines() (asyncio.WriteTransport method): Write-only Transports. + (line 67) +* writelines() (codecs.StreamWriter method): StreamWriter Objects. + (line 35) +* writelines() (io.IOBase method): I/O Base Classes. (line 158) +* writepy() (zipfile.PyZipFile method): PyZipFile Objects. (line 20) +* writer() (in module csv): Module Contents<3>. (line 39) +* writerow() (csv.csvwriter method): Writer Objects. (line 16) +* writerows() (csv.csvwriter method): Writer Objects. (line 25) +* writestr() (zipfile.ZipFile method): ZipFile Objects. (line 308) +* WriteTransport (class in asyncio): Transports Hierarchy. + (line 11) +* writev() (in module os): File Descriptor Operations. + (line 939) +* writexml() (xml.dom.minidom.Node method): DOM Objects. (line 27) +* writing; values: Expression statements. + (line 17) +* WrongDocumentErr: Exceptions<20>. (line 97) +* wsgi_file_wrapper (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 274) +* wsgi_multiprocess (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 156) +* wsgi_multithread (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 149) +* wsgi_run_once (wsgiref.handlers.BaseHandler attribute): wsgiref handlers – server/gateway base classes. + (line 163) +* WSGIApplication (in module wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 20) +* WSGIEnvironment (in module wsgiref.types): wsgiref types – WSGI types for static type checking. + (line 16) +* WSGIRequestHandler (class in wsgiref.simple_server): wsgiref simple_server – a simple WSGI HTTP server. + (line 78) +* WSGIServer (class in wsgiref.simple_server): wsgiref simple_server – a simple WSGI HTTP server. + (line 48) +* wShowWindow (subprocess.STARTUPINFO attribute): Windows Popen Helpers. + (line 49) +* WSTOPPED (in module os): Process Management. (line 1011) +* WSTOPSIG() (in module os): Process Management. (line 1163) +* wstring_at() (in module ctypes): Utility functions. (line 247) +* WTERMSIG() (in module os): Process Management. (line 1172) +* WUNTRACED (in module os): Process Management. (line 1022) +* WWW: Internet Protocols and Support. + (line 6) +* WWW <1>: urllib parse — Parse URLs into components. + (line 8) +* WWW <2>: urllib robotparser — Parser for robots txt. + (line 8) +* WWW; server: http server — HTTP servers. + (line 8) +* X (in module re): Flags. (line 127) +* X_OK (in module os): Files and Directories. + (line 107) +* X509 certificate: SSL Contexts. (line 761) +* xatom() (imaplib.IMAP4 method): IMAP4 Objects. (line 386) +* XATTR_CREATE (in module os): Linux extended attributes. + (line 88) +* XATTR_REPLACE (in module os): Linux extended attributes. + (line 94) +* XATTR_SIZE_MAX (in module os): Linux extended attributes. + (line 83) +* xcor() (in module turtle): Tell Turtle’s state. + (line 34) +* XHTML: html parser — Simple HTML and XHTML parser. + (line 8) +* XHTML_NAMESPACE (in module xml.dom): Module Contents<4>. (line 53) +* XML_ERROR_ABORTED (in module xml.parsers.expat.errors): Expat error constants. + (line 180) +* XML_ERROR_AMPLIFICATION_LIMIT_BREACH (in module xml.parsers.expat.errors): Expat error constants. + (line 215) +* XML_ERROR_ASYNC_ENTITY (in module xml.parsers.expat.errors): Expat error constants. + (line 29) +* XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF (in module xml.parsers.expat.errors): Expat error constants. + (line 31) +* XML_ERROR_BAD_CHAR_REF (in module xml.parsers.expat.errors): Expat error constants. + (line 37) +* XML_ERROR_BINARY_ENTITY_REF (in module xml.parsers.expat.errors): Expat error constants. + (line 42) +* XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING (in module xml.parsers.expat.errors): Expat error constants. + (line 135) +* XML_ERROR_DUPLICATE_ATTRIBUTE (in module xml.parsers.expat.errors): Expat error constants. + (line 47) +* XML_ERROR_ENTITY_DECLARED_IN_PE (in module xml.parsers.expat.errors): Expat error constants. + (line 126) +* XML_ERROR_EXTERNAL_ENTITY_HANDLING (in module xml.parsers.expat.errors): Expat error constants. + (line 116) +* XML_ERROR_FEATURE_REQUIRES_XML_DTD (in module xml.parsers.expat.errors): Expat error constants. + (line 128) +* XML_ERROR_FINISHED (in module xml.parsers.expat.errors): Expat error constants. + (line 184) +* XML_ERROR_INCOMPLETE_PE (in module xml.parsers.expat.errors): Expat error constants. + (line 152) +* XML_ERROR_INCORRECT_ENCODING (in module xml.parsers.expat.errors): Expat error constants. + (line 51) +* XML_ERROR_INVALID_ARGUMENT (in module xml.parsers.expat.errors): Expat error constants. + (line 207) +* XML_ERROR_INVALID_TOKEN (in module xml.parsers.expat.errors): Expat error constants. + (line 53) +* XML_ERROR_JUNK_AFTER_DOC_ELEMENT (in module xml.parsers.expat.errors): Expat error constants. + (line 59) +* XML_ERROR_MISPLACED_XML_PI (in module xml.parsers.expat.errors): Expat error constants. + (line 64) +* XML_ERROR_NO_BUFFER (in module xml.parsers.expat.errors): Expat error constants. + (line 211) +* XML_ERROR_NO_ELEMENTS (in module xml.parsers.expat.errors): Expat error constants. + (line 69) +* XML_ERROR_NO_MEMORY (in module xml.parsers.expat.errors): Expat error constants. + (line 74) +* XML_ERROR_NOT_STANDALONE (in module xml.parsers.expat.errors): Expat error constants. + (line 118) +* XML_ERROR_NOT_SUSPENDED (in module xml.parsers.expat.errors): Expat error constants. + (line 175) +* XML_ERROR_PARAM_ENTITY_REF (in module xml.parsers.expat.errors): Expat error constants. + (line 78) +* XML_ERROR_PARTIAL_CHAR (in module xml.parsers.expat.errors): Expat error constants. + (line 82) +* XML_ERROR_PUBLICID (in module xml.parsers.expat.errors): Expat error constants. + (line 165) +* XML_ERROR_RECURSIVE_ENTITY_REF (in module xml.parsers.expat.errors): Expat error constants. + (line 86) +* XML_ERROR_RESERVED_NAMESPACE_URI (in module xml.parsers.expat.errors): Expat error constants. + (line 202) +* XML_ERROR_RESERVED_PREFIX_XML (in module xml.parsers.expat.errors): Expat error constants. + (line 192) +* XML_ERROR_RESERVED_PREFIX_XMLNS (in module xml.parsers.expat.errors): Expat error constants. + (line 197) +* XML_ERROR_SUSPEND_PE (in module xml.parsers.expat.errors): Expat error constants. + (line 190) +* XML_ERROR_SUSPENDED (in module xml.parsers.expat.errors): Expat error constants. + (line 169) +* XML_ERROR_SYNTAX (in module xml.parsers.expat.errors): Expat error constants. + (line 91) +* XML_ERROR_TAG_MISMATCH (in module xml.parsers.expat.errors): Expat error constants. + (line 95) +* XML_ERROR_TEXT_DECL (in module xml.parsers.expat.errors): Expat error constants. + (line 160) +* XML_ERROR_UNBOUND_PREFIX (in module xml.parsers.expat.errors): Expat error constants. + (line 142) +* XML_ERROR_UNCLOSED_CDATA_SECTION (in module xml.parsers.expat.errors): Expat error constants. + (line 112) +* XML_ERROR_UNCLOSED_TOKEN (in module xml.parsers.expat.errors): Expat error constants. + (line 99) +* XML_ERROR_UNDECLARING_PREFIX (in module xml.parsers.expat.errors): Expat error constants. + (line 147) +* XML_ERROR_UNDEFINED_ENTITY (in module xml.parsers.expat.errors): Expat error constants. + (line 104) +* XML_ERROR_UNEXPECTED_STATE (in module xml.parsers.expat.errors): Expat error constants. + (line 124) +* XML_ERROR_UNKNOWN_ENCODING (in module xml.parsers.expat.errors): Expat error constants. + (line 108) +* XML_ERROR_XML_DECL (in module xml.parsers.expat.errors): Expat error constants. + (line 156) +* XML_NAMESPACE (in module xml.dom): Module Contents<4>. (line 42) +* XML() (in module xml.etree.ElementTree): Functions<9>. (line 270) +* xmlcharrefreplace_errors() (in module codecs): Error Handlers. + (line 172) +* xmlcharrefreplace; error handler's name: Error Handlers. (line 54) +* XmlDeclHandler() (xml.parsers.expat.xmlparser method): XMLParser Objects<2>. + (line 213) +* XMLFilterBase (class in xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 72) +* XMLGenerator (class in xml.sax.saxutils): xml sax saxutils — SAX Utilities. + (line 56) +* XMLID() (in module xml.etree.ElementTree): Functions<9>. (line 278) +* XMLNS_NAMESPACE (in module xml.dom): Module Contents<4>. (line 47) +* XMLParser (class in xml.etree.ElementTree): XMLParser Objects. + (line 6) +* XMLParserType (in module xml.parsers.expat): xml parsers expat — Fast XML parsing using Expat. + (line 34) +* XMLPullParser (class in xml.etree.ElementTree): XMLPullParser Objects. + (line 6) +* XMLReader (class in xml.sax.xmlreader): xml sax xmlreader — Interface for XML parsers. + (line 16) +* xor() (in module operator): operator — Standard operators as functions. + (line 168) +* xview() (tkinter.ttk.Treeview method): ttk Treeview. (line 317) +* ycor() (in module turtle): Tell Turtle’s state. + (line 46) +* year (datetime.date attribute): date Objects. (line 116) +* year (datetime.datetime attribute): datetime Objects. (line 305) +* Year 2038: time — Time access and conversions. + (line 29) +* yeardatescalendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 128) +* yeardays2calendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 136) +* yeardayscalendar() (calendar.Calendar method): calendar — General calendar-related functions. + (line 143) +* YES (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 157) +* YESEXPR (in module locale): locale — Internationalization services. + (line 278) +* YESNO (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 181) +* YESNOCANCEL (in module tkinter.messagebox): tkinter messagebox — Tkinter message prompts. + (line 186) +* Yield (class in ast): Function and class definitions. + (line 124) +* YIELD_VALUE (opcode): Python Bytecode Instructions. + (line 420) +* yield; examples: Generator-iterator methods. + (line 83) +* yield; expression: Yield expressions. (line 6) +* yield; yield from (in What's New): PEP 3151 Reworking the OS and IO exception hierarchy. + (line 87) +* YieldFrom (class in ast): Function and class definitions. + (line 124) +* yiq_to_rgb() (in module colorsys): colorsys — Conversions between color systems. + (line 32) +* yview() (tkinter.ttk.Treeview method): ttk Treeview. (line 321) +* z; in string formatting: Format Specification Mini-Language. + (line 90) +* z85decode() (in module base64): Base85 Encodings. (line 100) +* z85encode() (in module base64): Base85 Encodings. (line 92) +* Zen of Python: Glossary. (line 1595) +* ZeroDivisionError: Concrete exceptions. + (line 487) +* zfill() (bytearray method): Bytes and Bytearray Operations. + (line 752) +* zfill() (bytes method): Bytes and Bytearray Operations. + (line 752) +* zfill() (str method): String Methods<2>. (line 738) +* ZIP_BZIP2 (in module zipfile): zipfile — Work with ZIP archives. + (line 94) +* ZIP_DEFLATED (in module zipfile): zipfile — Work with ZIP archives. + (line 89) +* zip_longest() (in module itertools): Itertool Functions. (line 659) +* ZIP_LZMA (in module zipfile): zipfile — Work with ZIP archives. + (line 101) +* ZIP_STORED (in module zipfile): zipfile — Work with ZIP archives. + (line 85) +* zipapp command line option; -c: Command-Line Interface<5>. + (line 45) +* zipapp command line option; -compress: Command-Line Interface<5>. + (line 45) +* zipapp command line option; -h: Command-Line Interface<5>. + (line 61) +* zipapp command line option; -help: Command-Line Interface<5>. + (line 61) +* zipapp command line option; -info: Command-Line Interface<5>. + (line 55) +* zipapp command line option; -m: Command-Line Interface<5>. + (line 35) +* zipapp command line option; -main: Command-Line Interface<5>. + (line 35) +* zipapp command line option; -o: Command-Line Interface<5>. + (line 18) +* zipapp command line option; -output: Command-Line Interface<5>. + (line 18) +* zipapp command line option; -p: Command-Line Interface<5>. + (line 29) +* zipapp command line option; -python: Command-Line Interface<5>. + (line 29) +* ZipFile (class in zipfile): ZipFile Objects. (line 6) +* zipfile command line option; -c: Command-line options. + (line 11) +* zipfile command line option; -create: Command-line options. + (line 11) +* zipfile command line option; -e: Command-line options. + (line 16) +* zipfile command line option; -extract: Command-line options. + (line 16) +* zipfile command line option; -l: Command-line options. + (line 6) +* zipfile command line option; -list: Command-line options. + (line 6) +* zipfile command line option; -metadata-encoding: Command-line options. + (line 26) +* zipfile command line option; -t: Command-line options. + (line 21) +* zipfile command line option; -test: Command-line options. + (line 21) +* zipimporter (class in zipimport): zipimporter Objects. + (line 8) +* ZipImportError: zipimport — Import modules from Zip archives. + (line 58) +* ZipInfo (class in zipfile): zipfile — Work with ZIP archives. + (line 59) +* ZLIB_RUNTIME_VERSION (in module zlib): zlib — Compression compatible with gzip. + (line 313) +* ZLIB_VERSION (in module zlib): zlib — Compression compatible with gzip. + (line 306) +* ZoneInfo (class in zoneinfo): The ZoneInfo class. (line 6) +* ZoneInfoNotFoundError: Exceptions and warnings. + (line 6) +* zscore() (statistics.NormalDist method): NormalDist objects. + (line 120) + + + + + +Tag Table: +Node: Top354 +Ref: contents doc565 +Ref: 135565 +Node: What’s New in Python226816 +Ref: whatsnew/index doc226918 +Ref: 136226918 +Ref: whatsnew/index python-documentation-contents226918 +Ref: 137226918 +Ref: whatsnew/index what-s-new-in-python226918 +Ref: 138226918 +Ref: whatsnew/index whatsnew-index226918 +Ref: 139226918 +Node: What’s New In Python 3 13228491 +Ref: whatsnew/3 13 doc228613 +Ref: 13a228613 +Ref: whatsnew/3 13 what-s-new-in-python-3-13228613 +Ref: 13b228613 +Ref: What’s New In Python 3 13-Footnote-1229435 +Node: Summary – Release Highlights229477 +Ref: whatsnew/3 13 summary-release-highlights229592 +Ref: 13d229592 +Ref: whatsnew/3 13 whatsnew313-better-interactive-interpreter229896 +Ref: 13e229896 +Ref: whatsnew/3 13 whatsnew313-free-threaded-cpython229966 +Ref: 13f229966 +Ref: whatsnew/3 13 whatsnew313-jit-compiler230020 +Ref: 140230020 +Ref: whatsnew/3 13 whatsnew313-pep594230494 +Ref: 143230494 +Ref: Summary – Release Highlights-Footnote-1236423 +Ref: Summary – Release Highlights-Footnote-2236465 +Ref: Summary – Release Highlights-Footnote-3236507 +Ref: Summary – Release Highlights-Footnote-4236549 +Ref: Summary – Release Highlights-Footnote-5236591 +Ref: Summary – Release Highlights-Footnote-6236633 +Ref: Summary – Release Highlights-Footnote-7236675 +Ref: Summary – Release Highlights-Footnote-8236705 +Ref: Summary – Release Highlights-Footnote-9236745 +Ref: Summary – Release Highlights-Footnote-10236787 +Ref: Summary – Release Highlights-Footnote-11236830 +Ref: Summary – Release Highlights-Footnote-12236873 +Ref: Summary – Release Highlights-Footnote-13236916 +Ref: Summary – Release Highlights-Footnote-14236959 +Ref: Summary – Release Highlights-Footnote-15237002 +Ref: Summary – Release Highlights-Footnote-16237052 +Ref: Summary – Release Highlights-Footnote-17237095 +Ref: Summary – Release Highlights-Footnote-18237145 +Ref: Summary – Release Highlights-Footnote-19237195 +Node: New Features237238 +Ref: whatsnew/3 13 new-features237384 +Ref: 167237384 +Node: A better interactive interpreter237729 +Ref: whatsnew/3 13 a-better-interactive-interpreter237842 +Ref: 168237842 +Ref: A better interactive interpreter-Footnote-1239160 +Ref: A better interactive interpreter-Footnote-2239186 +Node: Improved error messages239242 +Ref: whatsnew/3 13 improved-error-messages239385 +Ref: 170239385 +Ref: whatsnew/3 13 whatsnew313-improved-error-messages239385 +Ref: 147239385 +Ref: Improved error messages-Footnote-1241829 +Ref: Improved error messages-Footnote-2241859 +Ref: Improved error messages-Footnote-3241892 +Ref: Improved error messages-Footnote-4241948 +Ref: Improved error messages-Footnote-5242003 +Node: Free-threaded CPython242059 +Ref: whatsnew/3 13 free-threaded-cpython242211 +Ref: 171242211 +Ref: Free-threaded CPython-Footnote-1245215 +Ref: Free-threaded CPython-Footnote-2245257 +Node: An experimental just-in-time JIT compiler245310 +Ref: whatsnew/3 13 an-experimental-just-in-time-jit-compiler245476 +Ref: 17a245476 +Ref: An experimental just-in-time JIT compiler-Footnote-1248112 +Ref: An experimental just-in-time JIT compiler-Footnote-2248184 +Node: Defined mutation semantics for locals248226 +Ref: whatsnew/3 13 defined-mutation-semantics-for-locals248399 +Ref: 17d248399 +Ref: whatsnew/3 13 whatsnew313-locals-semantics248399 +Ref: 142248399 +Ref: Defined mutation semantics for locals-Footnote-1251012 +Ref: Defined mutation semantics for locals-Footnote-2251054 +Ref: Defined mutation semantics for locals-Footnote-3251096 +Node: Support for mobile platforms251151 +Ref: whatsnew/3 13 support-for-mobile-platforms251274 +Ref: 185251274 +Ref: whatsnew/3 13 whatsnew313-platform-support251274 +Ref: 165251274 +Ref: Support for mobile platforms-Footnote-1252321 +Ref: Support for mobile platforms-Footnote-2252363 +Ref: Support for mobile platforms-Footnote-3252405 +Ref: Support for mobile platforms-Footnote-4252461 +Ref: Support for mobile platforms-Footnote-5252503 +Ref: Support for mobile platforms-Footnote-6252545 +Ref: Support for mobile platforms-Footnote-7252601 +Ref: Support for mobile platforms-Footnote-8252643 +Node: Other Language Changes252685 +Ref: whatsnew/3 13 other-language-changes252812 +Ref: 186252812 +Ref: Other Language Changes-Footnote-1257645 +Ref: Other Language Changes-Footnote-2257700 +Ref: Other Language Changes-Footnote-3257756 +Ref: Other Language Changes-Footnote-4257812 +Ref: Other Language Changes-Footnote-5257868 +Ref: Other Language Changes-Footnote-6257924 +Ref: Other Language Changes-Footnote-7257980 +Ref: Other Language Changes-Footnote-8258029 +Ref: Other Language Changes-Footnote-9258085 +Ref: Other Language Changes-Footnote-10258140 +Ref: Other Language Changes-Footnote-11258197 +Ref: Other Language Changes-Footnote-12258254 +Ref: Other Language Changes-Footnote-13258311 +Ref: Other Language Changes-Footnote-14258368 +Ref: Other Language Changes-Footnote-15258425 +Ref: Other Language Changes-Footnote-16258482 +Ref: Other Language Changes-Footnote-17258539 +Ref: Other Language Changes-Footnote-18258595 +Node: New Modules258652 +Ref: whatsnew/3 13 new-modules258783 +Ref: 19b258783 +Ref: New Modules-Footnote-1259007 +Node: Improved Modules259063 +Ref: whatsnew/3 13 improved-modules259185 +Ref: 19c259185 +Node: argparse259855 +Ref: whatsnew/3 13 argparse259930 +Ref: 19d259930 +Ref: argparse-Footnote-1260253 +Node: array260308 +Ref: whatsnew/3 13 array260395 +Ref: 19f260395 +Ref: array-Footnote-1260831 +Ref: array-Footnote-2260886 +Node: ast260942 +Ref: whatsnew/3 13 ast261028 +Ref: 1a3261028 +Ref: ast-Footnote-1262588 +Ref: ast-Footnote-2262644 +Ref: ast-Footnote-3262700 +Ref: ast-Footnote-4262756 +Node: asyncio262812 +Ref: whatsnew/3 13 asyncio262899 +Ref: 1a9262899 +Ref: asyncio-Footnote-1266661 +Ref: asyncio-Footnote-2266716 +Ref: asyncio-Footnote-3266772 +Ref: asyncio-Footnote-4266828 +Ref: asyncio-Footnote-5266884 +Ref: asyncio-Footnote-6266940 +Ref: asyncio-Footnote-7266995 +Ref: asyncio-Footnote-8267051 +Ref: asyncio-Footnote-9267107 +Node: base64267163 +Ref: whatsnew/3 13 base64267257 +Ref: 1c1267257 +Ref: base64-Footnote-1267552 +Ref: base64-Footnote-2267592 +Node: compileall267647 +Ref: whatsnew/3 13 compileall267752 +Ref: 1c3267752 +Ref: compileall-Footnote-1268044 +Node: concurrent futures268100 +Ref: whatsnew/3 13 concurrent-futures268211 +Ref: 1c6268211 +Ref: concurrent futures-Footnote-1268519 +Node: configparser268575 +Ref: whatsnew/3 13 configparser268680 +Ref: 1c7268680 +Ref: configparser-Footnote-1269010 +Node: copy269065 +Ref: whatsnew/3 13 copy269158 +Ref: 1c9269158 +Ref: copy-Footnote-1270075 +Node: ctypes270131 +Ref: whatsnew/3 13 ctypes270215 +Ref: 1d3270215 +Ref: ctypes-Footnote-1271150 +Ref: ctypes-Footnote-2271206 +Node: dbm271262 +Ref: whatsnew/3 13 dbm271345 +Ref: 1d6271345 +Ref: dbm-Footnote-1271801 +Ref: dbm-Footnote-2271857 +Node: dis271913 +Ref: whatsnew/3 13 dis271997 +Ref: 1d9271997 +Ref: dis-Footnote-1272751 +Ref: dis-Footnote-2272807 +Node: doctest272863 +Ref: whatsnew/3 13 doctest272949 +Ref: 1dd272949 +Ref: whatsnew/3 13 whatsnew313-doctest272949 +Ref: 149272949 +Ref: doctest-Footnote-1273596 +Ref: doctest-Footnote-2273626 +Ref: doctest-Footnote-3273659 +Ref: doctest-Footnote-4273715 +Node: email273771 +Ref: whatsnew/3 13 email273858 +Ref: 1e1273858 +Ref: email-Footnote-1274990 +Ref: email-Footnote-2275046 +Ref: email-Footnote-3275102 +Node: enum275158 +Ref: whatsnew/3 13 enum275247 +Ref: 1e5275247 +Node: fractions275380 +Ref: whatsnew/3 13 fractions275468 +Ref: 1e8275468 +Ref: fractions-Footnote-1275786 +Node: glob275842 +Ref: whatsnew/3 13 glob275935 +Ref: 1eb275935 +Ref: glob-Footnote-1276184 +Node: importlib276239 +Ref: whatsnew/3 13 importlib276325 +Ref: 1ed276325 +Ref: importlib-Footnote-1277226 +Ref: importlib-Footnote-2277282 +Node: io277338 +Ref: whatsnew/3 13 io277429 +Ref: 1f6277429 +Ref: io-Footnote-1277855 +Node: ipaddress277910 +Ref: whatsnew/3 13 ipaddress278001 +Ref: 1fc278001 +Ref: ipaddress-Footnote-1278460 +Ref: ipaddress-Footnote-2278516 +Node: itertools278572 +Ref: whatsnew/3 13 itertools278668 +Ref: 202278668 +Ref: itertools-Footnote-1278968 +Node: marshal279024 +Ref: whatsnew/3 13 marshal279115 +Ref: 205279115 +Ref: marshal-Footnote-1279450 +Node: math279506 +Ref: whatsnew/3 13 math279597 +Ref: 206279597 +Ref: math-Footnote-1280092 +Node: mimetypes280147 +Ref: whatsnew/3 13 mimetypes280235 +Ref: 208280235 +Ref: mimetypes-Footnote-1280552 +Node: mmap280607 +Ref: whatsnew/3 13 mmap280706 +Ref: 20c280706 +Ref: mmap-Footnote-1281519 +Ref: mmap-Footnote-2281575 +Ref: mmap-Footnote-3281631 +Node: multiprocessing281686 +Ref: whatsnew/3 13 multiprocessing281778 +Ref: 210281778 +Ref: multiprocessing-Footnote-1282082 +Node: os282138 +Ref: whatsnew/3 13 os282233 +Ref: 211282233 +Ref: os-Footnote-1284701 +Ref: os-Footnote-2284757 +Ref: os-Footnote-3284813 +Ref: os-Footnote-4284867 +Ref: os-Footnote-5284923 +Ref: os-Footnote-6284978 +Ref: os-Footnote-7285034 +Ref: os-Footnote-8285089 +Ref: os-Footnote-9285145 +Ref: os-Footnote-10285201 +Node: os path285258 +Ref: whatsnew/3 13 os-path285345 +Ref: 224285345 +Ref: os path-Footnote-1285968 +Ref: os path-Footnote-2286023 +Ref: os path-Footnote-3286078 +Node: pathlib286133 +Ref: whatsnew/3 13 pathlib286221 +Ref: 228286221 +Ref: pathlib-Footnote-1287749 +Ref: pathlib-Footnote-2287804 +Ref: pathlib-Footnote-3287860 +Ref: pathlib-Footnote-4287915 +Ref: pathlib-Footnote-5287970 +Ref: pathlib-Footnote-6288025 +Ref: pathlib-Footnote-7288081 +Node: pdb288137 +Ref: whatsnew/3 13 pdb288223 +Ref: 235288223 +Ref: pdb-Footnote-1289358 +Ref: pdb-Footnote-2289414 +Ref: pdb-Footnote-3289470 +Ref: pdb-Footnote-4289526 +Ref: pdb-Footnote-5289582 +Node: queue289638 +Ref: whatsnew/3 13 queue289723 +Ref: 23b289723 +Ref: queue-Footnote-1289958 +Node: random290014 +Ref: whatsnew/3 13 random290098 +Ref: 23e290098 +Ref: random-Footnote-1290272 +Node: re290328 +Ref: whatsnew/3 13 re290413 +Ref: 23f290413 +Node: shutil290572 +Ref: whatsnew/3 13 shutil290655 +Ref: 241290655 +Ref: shutil-Footnote-1290883 +Node: site290938 +Ref: whatsnew/3 13 site291026 +Ref: 243291026 +Ref: site-Footnote-1291277 +Node: sqlite3291333 +Ref: whatsnew/3 13 sqlite3291418 +Ref: 245291418 +Ref: sqlite3-Footnote-1291859 +Ref: sqlite3-Footnote-2291915 +Node: ssl291970 +Ref: whatsnew/3 13 ssl292061 +Ref: 24a292061 +Ref: ssl-Footnote-1292750 +Ref: ssl-Footnote-2292809 +Node: statistics292865 +Ref: whatsnew/3 13 statistics292959 +Ref: 24b292959 +Ref: statistics-Footnote-1293468 +Ref: statistics-Footnote-2293524 +Node: subprocess293580 +Ref: whatsnew/3 13 subprocess293674 +Ref: 24e293674 +Ref: whatsnew/3 13 whatsnew313-subprocess293674 +Ref: 24f293674 +Ref: subprocess-Footnote-1294614 +Node: sys294670 +Ref: whatsnew/3 13 sys294762 +Ref: 251294762 +Ref: sys-Footnote-1295051 +Node: tempfile295106 +Ref: whatsnew/3 13 tempfile295192 +Ref: 253295192 +Ref: tempfile-Footnote-1295537 +Ref: tempfile-Footnote-2295592 +Node: time295648 +Ref: whatsnew/3 13 time295738 +Ref: 254295738 +Ref: time-Footnote-1296386 +Ref: time-Footnote-2296441 +Node: tkinter296496 +Ref: whatsnew/3 13 tkinter296587 +Ref: 257296587 +Ref: tkinter-Footnote-1298855 +Ref: tkinter-Footnote-2298910 +Ref: tkinter-Footnote-3298965 +Ref: tkinter-Footnote-4299020 +Ref: tkinter-Footnote-5299075 +Ref: tkinter-Footnote-6299130 +Ref: tkinter-Footnote-7299185 +Ref: tkinter-Footnote-8299241 +Ref: tkinter-Footnote-9299297 +Node: traceback299353 +Ref: whatsnew/3 13 traceback299445 +Ref: 25c299445 +Ref: traceback-Footnote-1300175 +Ref: traceback-Footnote-2300231 +Node: types300287 +Ref: whatsnew/3 13 types300378 +Ref: 262300378 +Ref: types-Footnote-1300705 +Node: typing300761 +Ref: whatsnew/3 13 typing300854 +Ref: 263300854 +Ref: typing-Footnote-1301840 +Ref: typing-Footnote-2301882 +Ref: typing-Footnote-3301924 +Ref: typing-Footnote-4301980 +Ref: typing-Footnote-5302036 +Ref: typing-Footnote-6302092 +Node: unicodedata302147 +Ref: whatsnew/3 13 unicodedata302239 +Ref: 26a302239 +Ref: unicodedata-Footnote-1302427 +Ref: unicodedata-Footnote-2302483 +Node: venv302539 +Ref: whatsnew/3 13 venv302633 +Ref: 26b302633 +Ref: venv-Footnote-1303127 +Node: warnings303183 +Ref: whatsnew/3 13 warnings303269 +Ref: 26e303269 +Ref: warnings-Footnote-1303733 +Ref: warnings-Footnote-2303775 +Node: xml303831 +Ref: whatsnew/3 13 xml303922 +Ref: 270303922 +Ref: xml-Footnote-1304688 +Ref: xml-Footnote-2304744 +Ref: xml-Footnote-3304800 +Node: zipimport304855 +Ref: whatsnew/3 13 zipimport304929 +Ref: 276304929 +Ref: zipimport-Footnote-1305133 +Ref: zipimport-Footnote-2305195 +Node: Optimizations305250 +Ref: whatsnew/3 13 optimizations305385 +Ref: 277305385 +Ref: Optimizations-Footnote-1306592 +Ref: Optimizations-Footnote-2306648 +Ref: Optimizations-Footnote-3306704 +Node: Removed Modules And APIs306760 +Ref: whatsnew/3 13 removed-modules-and-apis306895 +Ref: 279306895 +Node: PEP 594 Remove “dead batteries” from the standard library307364 +Ref: whatsnew/3 13 pep-594-remove-dead-batteries-from-the-standard-library307499 +Ref: 27a307499 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-1312868 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-2312910 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-3312958 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-4313004 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-5313053 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-6313097 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-7313141 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-8313188 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-9313237 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-10313278 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-11313321 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-12313368 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-13313415 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-14313458 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-15313506 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-16313556 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-17313620 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-18313664 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-19313709 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-20313757 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-21313808 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-22313860 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-23313902 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-24313954 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-25313996 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-26314046 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-27314090 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-28314135 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-29314183 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-30314234 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-31314280 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-32314330 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-33314376 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-34314420 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-35314474 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-36314521 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-37314572 +Ref: PEP 594 Remove “dead batteries” from the standard library-Footnote-38314629 +Node: 2to3314686 +Ref: whatsnew/3 13 to3314838 +Ref: 280314838 +Ref: 2to3-Footnote-1315065 +Node: builtins315121 +Ref: whatsnew/3 13 builtins315227 +Ref: 281315227 +Ref: builtins-Footnote-1315972 +Ref: builtins-Footnote-2316027 +Ref: builtins-Footnote-3316082 +Node: configparser<2>316137 +Ref: whatsnew/3 13 id3316257 +Ref: 283316257 +Ref: configparser<2>-Footnote-1316541 +Node: importlib metadata316597 +Ref: whatsnew/3 13 importlib-metadata316715 +Ref: 284316715 +Ref: importlib metadata-Footnote-1316972 +Node: locale317028 +Ref: whatsnew/3 13 locale317137 +Ref: 287317137 +Ref: locale-Footnote-1317400 +Node: opcode317456 +Ref: whatsnew/3 13 opcode317555 +Ref: 288317555 +Ref: opcode-Footnote-1318180 +Ref: opcode-Footnote-2318236 +Node: optparse318292 +Ref: whatsnew/3 13 optparse318395 +Ref: 289318395 +Ref: optparse-Footnote-1319185 +Node: pathlib<2>319241 +Ref: whatsnew/3 13 id4319343 +Ref: 28a319343 +Ref: pathlib<2>-Footnote-1319621 +Node: re<2>319676 +Ref: whatsnew/3 13 id5319781 +Ref: 28b319781 +Ref: re<2>-Footnote-1320047 +Node: tkinter tix320103 +Ref: whatsnew/3 13 tkinter-tix320204 +Ref: 28c320204 +Ref: tkinter tix-Footnote-1320479 +Node: turtle320534 +Ref: whatsnew/3 13 turtle320639 +Ref: 28d320639 +Ref: turtle-Footnote-1320909 +Node: typing<2>320965 +Ref: whatsnew/3 13 id6321067 +Ref: 28e321067 +Ref: typing<2>-Footnote-1321553 +Ref: typing<2>-Footnote-2321608 +Node: unittest321664 +Ref: whatsnew/3 13 unittest321766 +Ref: 28f321766 +Ref: unittest-Footnote-1322468 +Ref: unittest-Footnote-2322524 +Node: urllib322580 +Ref: whatsnew/3 13 urllib322683 +Ref: 294322683 +Ref: urllib-Footnote-1323290 +Node: webbrowser323346 +Ref: whatsnew/3 13 webbrowser323432 +Ref: 298323432 +Ref: webbrowser-Footnote-1323923 +Ref: webbrowser-Footnote-2323979 +Node: New Deprecations324035 +Ref: whatsnew/3 13 new-deprecations324181 +Ref: 29a324181 +Ref: New Deprecations-Footnote-1332482 +Ref: New Deprecations-Footnote-2332537 +Ref: New Deprecations-Footnote-3332592 +Ref: New Deprecations-Footnote-4332648 +Ref: New Deprecations-Footnote-5332704 +Ref: New Deprecations-Footnote-6332759 +Ref: New Deprecations-Footnote-7332815 +Ref: New Deprecations-Footnote-8332870 +Ref: New Deprecations-Footnote-9332926 +Ref: New Deprecations-Footnote-10332982 +Ref: New Deprecations-Footnote-11333039 +Ref: New Deprecations-Footnote-12333095 +Ref: New Deprecations-Footnote-13333151 +Ref: New Deprecations-Footnote-14333207 +Ref: New Deprecations-Footnote-15333264 +Ref: New Deprecations-Footnote-16333320 +Ref: New Deprecations-Footnote-17333377 +Ref: New Deprecations-Footnote-18333434 +Ref: New Deprecations-Footnote-19333491 +Ref: New Deprecations-Footnote-20333547 +Ref: New Deprecations-Footnote-21333604 +Ref: New Deprecations-Footnote-22333661 +Ref: New Deprecations-Footnote-23333718 +Ref: New Deprecations-Footnote-24333775 +Ref: New Deprecations-Footnote-25333832 +Ref: New Deprecations-Footnote-26333889 +Ref: New Deprecations-Footnote-27333946 +Node: Pending Removal in Python 3 14334003 +Ref: whatsnew/3 13 pending-removal-in-python-3-14334125 +Ref: 2ba334125 +Ref: Pending Removal in Python 3 14-Footnote-1338817 +Ref: Pending Removal in Python 3 14-Footnote-2338872 +Ref: Pending Removal in Python 3 14-Footnote-3338927 +Ref: Pending Removal in Python 3 14-Footnote-4338982 +Ref: Pending Removal in Python 3 14-Footnote-5339037 +Ref: Pending Removal in Python 3 14-Footnote-6339093 +Ref: Pending Removal in Python 3 14-Footnote-7339148 +Ref: Pending Removal in Python 3 14-Footnote-8339203 +Ref: Pending Removal in Python 3 14-Footnote-9339258 +Ref: Pending Removal in Python 3 14-Footnote-10339314 +Ref: Pending Removal in Python 3 14-Footnote-11339370 +Ref: Pending Removal in Python 3 14-Footnote-12339426 +Node: Pending Removal in Python 3 15339482 +Ref: whatsnew/3 13 pending-removal-in-python-3-15339643 +Ref: 2d8339643 +Ref: Pending Removal in Python 3 15-Footnote-1343971 +Ref: Pending Removal in Python 3 15-Footnote-2344026 +Ref: Pending Removal in Python 3 15-Footnote-3344081 +Ref: Pending Removal in Python 3 15-Footnote-4344136 +Ref: Pending Removal in Python 3 15-Footnote-5344192 +Ref: Pending Removal in Python 3 15-Footnote-6344234 +Node: Pending removal in Python 3 16344290 +Ref: whatsnew/3 13 pending-removal-in-python-3-16344455 +Ref: 2e5344455 +Ref: Pending removal in Python 3 16-Footnote-1346640 +Node: Pending Removal in Future Versions346696 +Ref: whatsnew/3 13 pending-removal-in-future-versions346822 +Ref: 2ea346822 +Ref: Pending Removal in Future Versions-Footnote-1353665 +Ref: Pending Removal in Future Versions-Footnote-2353720 +Ref: Pending Removal in Future Versions-Footnote-3353776 +Ref: Pending Removal in Future Versions-Footnote-4353832 +Ref: Pending Removal in Future Versions-Footnote-5353887 +Node: CPython Bytecode Changes353942 +Ref: whatsnew/3 13 cpython-bytecode-changes354077 +Ref: 30d354077 +Ref: CPython Bytecode Changes-Footnote-1354518 +Node: C API Changes354574 +Ref: whatsnew/3 13 c-api-changes354706 +Ref: 310354706 +Node: New Features<2>354878 +Ref: whatsnew/3 13 id7354966 +Ref: 311354966 +Ref: New Features<2>-Footnote-1365877 +Ref: New Features<2>-Footnote-2365919 +Ref: New Features<2>-Footnote-3365975 +Ref: New Features<2>-Footnote-4366031 +Ref: New Features<2>-Footnote-5366087 +Ref: New Features<2>-Footnote-6366143 +Ref: New Features<2>-Footnote-7366199 +Ref: New Features<2>-Footnote-8366255 +Ref: New Features<2>-Footnote-9366311 +Ref: New Features<2>-Footnote-10366367 +Ref: New Features<2>-Footnote-11366424 +Ref: New Features<2>-Footnote-12366481 +Ref: New Features<2>-Footnote-13366537 +Ref: New Features<2>-Footnote-14366594 +Ref: New Features<2>-Footnote-15366651 +Ref: New Features<2>-Footnote-16366708 +Ref: New Features<2>-Footnote-17366765 +Ref: New Features<2>-Footnote-18366822 +Ref: New Features<2>-Footnote-19366879 +Ref: New Features<2>-Footnote-20366936 +Ref: New Features<2>-Footnote-21366992 +Ref: New Features<2>-Footnote-22367049 +Ref: New Features<2>-Footnote-23367106 +Ref: New Features<2>-Footnote-24367160 +Ref: New Features<2>-Footnote-25367217 +Ref: New Features<2>-Footnote-26367273 +Ref: New Features<2>-Footnote-27367329 +Ref: New Features<2>-Footnote-28367386 +Ref: New Features<2>-Footnote-29367443 +Ref: New Features<2>-Footnote-30367500 +Ref: New Features<2>-Footnote-31367557 +Ref: New Features<2>-Footnote-32367614 +Node: Changed C APIs367671 +Ref: whatsnew/3 13 changed-c-apis367789 +Ref: 37d367789 +Ref: Changed C APIs-Footnote-1370384 +Ref: Changed C APIs-Footnote-2370439 +Ref: Changed C APIs-Footnote-3370495 +Ref: Changed C APIs-Footnote-4370551 +Ref: Changed C APIs-Footnote-5370607 +Ref: Changed C APIs-Footnote-6370649 +Ref: Changed C APIs-Footnote-7370705 +Ref: Changed C APIs-Footnote-8370761 +Node: Limited C API Changes370817 +Ref: whatsnew/3 13 limited-c-api-changes370934 +Ref: 38a370934 +Ref: Limited C API Changes-Footnote-1371656 +Ref: Limited C API Changes-Footnote-2371711 +Ref: Limited C API Changes-Footnote-3371766 +Ref: Limited C API Changes-Footnote-4371822 +Node: Removed C APIs371878 +Ref: whatsnew/3 13 removed-c-apis371998 +Ref: 392371998 +Ref: Removed C APIs-Footnote-1378336 +Ref: Removed C APIs-Footnote-2378392 +Ref: Removed C APIs-Footnote-3378447 +Ref: Removed C APIs-Footnote-4378503 +Ref: Removed C APIs-Footnote-5378545 +Ref: Removed C APIs-Footnote-6378601 +Ref: Removed C APIs-Footnote-7378657 +Ref: Removed C APIs-Footnote-8378713 +Ref: Removed C APIs-Footnote-9378766 +Ref: Removed C APIs-Footnote-10378822 +Ref: Removed C APIs-Footnote-11378865 +Ref: Removed C APIs-Footnote-12378922 +Ref: Removed C APIs-Footnote-13378979 +Ref: Removed C APIs-Footnote-14379036 +Node: Deprecated C APIs379093 +Ref: whatsnew/3 13 deprecated-c-apis379183 +Ref: 3aa379183 +Ref: Deprecated C APIs-Footnote-1381869 +Ref: Deprecated C APIs-Footnote-2381925 +Ref: Deprecated C APIs-Footnote-3381967 +Ref: Deprecated C APIs-Footnote-4382023 +Ref: Deprecated C APIs-Footnote-5382078 +Ref: Deprecated C APIs-Footnote-6382134 +Ref: Deprecated C APIs-Footnote-7382187 +Node: Pending Removal in Python 3 14<2>382243 +Ref: whatsnew/3 13 id8382372 +Ref: 3bc382372 +Ref: Pending Removal in Python 3 14<2>-Footnote-1385599 +Ref: Pending Removal in Python 3 14<2>-Footnote-2385641 +Ref: Pending Removal in Python 3 14<2>-Footnote-3385697 +Node: Pending Removal in Python 3 15<2>385752 +Ref: whatsnew/3 13 id9385923 +Ref: 3e8385923 +Node: Pending removal in Python 3 16<2>387176 +Ref: whatsnew/3 13 id10387351 +Ref: 3ec387351 +Node: Pending Removal in Future Versions<2>387474 +Ref: whatsnew/3 13 id11387607 +Ref: 3ed387607 +Node: Build Changes389848 +Ref: whatsnew/3 13 build-changes389978 +Ref: 40b389978 +Ref: whatsnew/3 13 pythoncapi-compat-project389978 +Ref: 40c389978 +Ref: Build Changes-Footnote-1392556 +Ref: Build Changes-Footnote-2392598 +Ref: Build Changes-Footnote-3392654 +Ref: Build Changes-Footnote-4392696 +Ref: Build Changes-Footnote-5392752 +Ref: Build Changes-Footnote-6392794 +Ref: Build Changes-Footnote-7392850 +Ref: Build Changes-Footnote-8392892 +Ref: Build Changes-Footnote-9392948 +Ref: Build Changes-Footnote-10393003 +Ref: Build Changes-Footnote-11393060 +Ref: Build Changes-Footnote-12393117 +Ref: Build Changes-Footnote-13393165 +Ref: Build Changes-Footnote-14393222 +Ref: Build Changes-Footnote-15393279 +Ref: Build Changes-Footnote-16393336 +Node: Porting to Python 3 13393392 +Ref: whatsnew/3 13 porting-to-python-3-13393532 +Ref: 146393532 +Node: Changes in the Python API393765 +Ref: whatsnew/3 13 changes-in-the-python-api393878 +Ref: 40f393878 +Ref: whatsnew/3 13 pep667-porting-notes-py393949 +Ref: 183393949 +Ref: Changes in the Python API-Footnote-1397496 +Ref: Changes in the Python API-Footnote-2397538 +Ref: Changes in the Python API-Footnote-3397580 +Ref: Changes in the Python API-Footnote-4397622 +Ref: Changes in the Python API-Footnote-5397664 +Ref: Changes in the Python API-Footnote-6397720 +Ref: Changes in the Python API-Footnote-7397776 +Ref: Changes in the Python API-Footnote-8397831 +Node: Changes in the C API397887 +Ref: whatsnew/3 13 changes-in-the-c-api398000 +Ref: 419398000 +Ref: whatsnew/3 13 pep667-porting-notes-c400655 +Ref: 184400655 +Ref: Changes in the C API-Footnote-1404431 +Ref: Changes in the C API-Footnote-2404487 +Ref: Changes in the C API-Footnote-3404543 +Ref: Changes in the C API-Footnote-4404599 +Ref: Changes in the C API-Footnote-5404654 +Ref: Changes in the C API-Footnote-6404710 +Node: Regression Test Changes404763 +Ref: whatsnew/3 13 regression-test-changes404915 +Ref: 41f404915 +Ref: Regression Test Changes-Footnote-1405356 +Node: Notable changes in 3 13 1405412 +Ref: whatsnew/3 13 notable-changes-in-3-13-1405567 +Ref: 421405567 +Node: sys<2>405659 +Ref: whatsnew/3 13 id12405727 +Ref: 422405727 +Node: Notable changes in 3 13 4405978 +Ref: whatsnew/3 13 notable-changes-in-3-13-4406101 +Ref: 424406101 +Node: os path<2>406213 +Ref: whatsnew/3 13 id13406301 +Ref: 425406301 +Ref: os path<2>-Footnote-1406708 +Node: tarfile406763 +Ref: whatsnew/3 13 tarfile406851 +Ref: 428406851 +Ref: tarfile-Footnote-1407980 +Ref: tarfile-Footnote-2408036 +Ref: tarfile-Footnote-3408091 +Ref: tarfile-Footnote-4408147 +Ref: tarfile-Footnote-5408203 +Ref: tarfile-Footnote-6408258 +Ref: tarfile-Footnote-7408314 +Ref: tarfile-Footnote-8408370 +Node: What’s New In Python 3 12408425 +Ref: whatsnew/3 12 doc408583 +Ref: 42e408583 +Ref: whatsnew/3 12 what-s-new-in-python-3-12408583 +Ref: 42f408583 +Ref: What’s New In Python 3 12-Footnote-1409409 +Node: Summary – Release highlights409451 +Ref: whatsnew/3 12 summary-release-highlights409569 +Ref: 430409569 +Ref: whatsnew/3 12 improved-error-messages411389 +Ref: 439411389 +Ref: whatsnew/3 12 unittest-testcase-removed-aliases414210 +Ref: 44a414210 +Ref: Summary – Release highlights-Footnote-1414249 +Ref: Summary – Release highlights-Footnote-2414297 +Ref: Summary – Release highlights-Footnote-3414339 +Ref: Summary – Release highlights-Footnote-4414381 +Ref: Summary – Release highlights-Footnote-5414440 +Ref: Summary – Release highlights-Footnote-6414519 +Node: New Features<3>414574 +Ref: whatsnew/3 12 new-features414735 +Ref: 44b414735 +Node: PEP 695 Type Parameter Syntax415310 +Ref: whatsnew/3 12 pep-695-type-parameter-syntax415444 +Ref: 44c415444 +Ref: whatsnew/3 12 whatsnew312-pep695415444 +Ref: 432415444 +Ref: PEP 695 Type Parameter Syntax-Footnote-1417977 +Ref: PEP 695 Type Parameter Syntax-Footnote-2418019 +Ref: PEP 695 Type Parameter Syntax-Footnote-3418061 +Ref: PEP 695 Type Parameter Syntax-Footnote-4418103 +Node: PEP 701 Syntactic formalization of f-strings418159 +Ref: whatsnew/3 12 pep-701-syntactic-formalization-of-f-strings418331 +Ref: 454418331 +Ref: whatsnew/3 12 whatsnew312-pep701418331 +Ref: 436418331 +Ref: PEP 701 Syntactic formalization of f-strings-Footnote-1422633 +Ref: PEP 701 Syntactic formalization of f-strings-Footnote-2422675 +Ref: PEP 701 Syntactic formalization of f-strings-Footnote-3422717 +Ref: PEP 701 Syntactic formalization of f-strings-Footnote-4422759 +Node: PEP 684 A Per-Interpreter GIL422815 +Ref: whatsnew/3 12 pep-684-a-per-interpreter-gil422999 +Ref: 456422999 +Ref: whatsnew/3 12 whatsnew312-pep684422999 +Ref: 437422999 +Ref: PEP 684 A Per-Interpreter GIL-Footnote-1424094 +Ref: PEP 684 A Per-Interpreter GIL-Footnote-2424136 +Ref: PEP 684 A Per-Interpreter GIL-Footnote-3424178 +Node: PEP 669 Low impact monitoring for CPython424234 +Ref: whatsnew/3 12 pep-669-low-impact-monitoring-for-cpython424429 +Ref: 458424429 +Ref: whatsnew/3 12 whatsnew312-pep669424429 +Ref: 438424429 +Ref: PEP 669 Low impact monitoring for CPython-Footnote-1424988 +Ref: PEP 669 Low impact monitoring for CPython-Footnote-2425030 +Node: PEP 688 Making the buffer protocol accessible in Python425086 +Ref: whatsnew/3 12 pep-688-making-the-buffer-protocol-accessible-in-python425282 +Ref: 459425282 +Ref: whatsnew/3 12 whatsnew312-pep688425282 +Ref: 43b425282 +Ref: PEP 688 Making the buffer protocol accessible in Python-Footnote-1425925 +Ref: PEP 688 Making the buffer protocol accessible in Python-Footnote-2425967 +Node: PEP 709 Comprehension inlining426023 +Ref: whatsnew/3 12 pep-709-comprehension-inlining426201 +Ref: 45c426201 +Ref: whatsnew/3 12 whatsnew312-pep709426201 +Ref: 442426201 +Ref: PEP 709 Comprehension inlining-Footnote-1427892 +Ref: PEP 709 Comprehension inlining-Footnote-2427934 +Node: Improved Error Messages427976 +Ref: Improved Error Messages-Footnote-1430448 +Ref: Improved Error Messages-Footnote-2430503 +Ref: Improved Error Messages-Footnote-3430558 +Ref: Improved Error Messages-Footnote-4430613 +Node: New Features Related to Type Hints430668 +Ref: whatsnew/3 12 new-features-related-to-type-hints430824 +Ref: 45d430824 +Ref: New Features Related to Type Hints-Footnote-1431261 +Node: PEP 692 Using TypedDict for more precise **kwargs typing431303 +Ref: whatsnew/3 12 pep-692-using-typeddict-for-more-precise-kwargs-typing431483 +Ref: 45e431483 +Ref: whatsnew/3 12 whatsnew312-pep692431483 +Ref: 443431483 +Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-1432177 +Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-2432219 +Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-3432261 +Ref: PEP 692 Using TypedDict for more precise **kwargs typing-Footnote-4432303 +Node: PEP 698 Override Decorator for Static Typing432359 +Ref: whatsnew/3 12 pep-698-override-decorator-for-static-typing432539 +Ref: 45f432539 +Ref: whatsnew/3 12 whatsnew312-pep698432539 +Ref: 445432539 +Ref: PEP 698 Override Decorator for Static Typing-Footnote-1433517 +Ref: PEP 698 Override Decorator for Static Typing-Footnote-2433559 +Node: Other Language Changes<2>433615 +Ref: whatsnew/3 12 other-language-changes433770 +Ref: 460433770 +Ref: Other Language Changes<2>-Footnote-1438462 +Ref: Other Language Changes<2>-Footnote-2438517 +Ref: Other Language Changes<2>-Footnote-3438572 +Ref: Other Language Changes<2>-Footnote-4438627 +Ref: Other Language Changes<2>-Footnote-5438669 +Ref: Other Language Changes<2>-Footnote-6438725 +Ref: Other Language Changes<2>-Footnote-7438767 +Ref: Other Language Changes<2>-Footnote-8438822 +Ref: Other Language Changes<2>-Footnote-9438878 +Ref: Other Language Changes<2>-Footnote-10438933 +Ref: Other Language Changes<2>-Footnote-11438989 +Ref: Other Language Changes<2>-Footnote-12439045 +Ref: Other Language Changes<2>-Footnote-13439102 +Ref: Other Language Changes<2>-Footnote-14439159 +Ref: Other Language Changes<2>-Footnote-15439215 +Ref: Other Language Changes<2>-Footnote-16439258 +Ref: Other Language Changes<2>-Footnote-17439314 +Node: New Modules<2>439370 +Ref: whatsnew/3 12 new-modules439510 +Ref: 46e439510 +Node: Improved Modules<2>439559 +Ref: whatsnew/3 12 improved-modules439690 +Ref: 46f439690 +Node: array<2>440328 +Ref: whatsnew/3 12 array440411 +Ref: 470440411 +Ref: array<2>-Footnote-1440639 +Node: asyncio<2>440694 +Ref: whatsnew/3 12 asyncio440794 +Ref: 471440794 +Ref: asyncio<2>-Footnote-1442779 +Ref: asyncio<2>-Footnote-2442834 +Ref: asyncio<2>-Footnote-3442890 +Ref: asyncio<2>-Footnote-4442946 +Ref: asyncio<2>-Footnote-5443002 +Ref: asyncio<2>-Footnote-6443057 +Ref: asyncio<2>-Footnote-7443112 +Ref: asyncio<2>-Footnote-8443167 +Ref: asyncio<2>-Footnote-9443223 +Ref: asyncio<2>-Footnote-10443279 +Node: calendar443335 +Ref: whatsnew/3 12 calendar443430 +Ref: 47c443430 +Ref: calendar-Footnote-1443682 +Node: csv443738 +Ref: whatsnew/3 12 csv443829 +Ref: 47f443829 +Node: dis<2>444063 +Ref: whatsnew/3 12 dis444158 +Ref: 484444158 +Ref: dis<2>-Footnote-1444768 +Ref: dis<2>-Footnote-2444823 +Node: fractions<2>444878 +Ref: whatsnew/3 12 fractions444989 +Ref: 487444989 +Ref: fractions<2>-Footnote-1445211 +Node: importlib resources445267 +Ref: whatsnew/3 12 importlib-resources445379 +Ref: 488445379 +Ref: importlib resources-Footnote-1445751 +Ref: importlib resources-Footnote-2445806 +Node: inspect445862 +Ref: whatsnew/3 12 inspect445974 +Ref: 48b445974 +Ref: inspect-Footnote-1446744 +Ref: inspect-Footnote-2446799 +Ref: inspect-Footnote-3446854 +Node: itertools<2>446910 +Ref: whatsnew/3 12 itertools447010 +Ref: 491447010 +Ref: itertools<2>-Footnote-1447275 +Node: math<2>447330 +Ref: whatsnew/3 12 math447428 +Ref: 492447428 +Ref: math<2>-Footnote-1447846 +Ref: math<2>-Footnote-2447902 +Node: os<2>447957 +Ref: whatsnew/3 12 os448053 +Ref: 495448053 +Ref: os<2>-Footnote-1449398 +Ref: os<2>-Footnote-2449453 +Ref: os<2>-Footnote-3449508 +Ref: os<2>-Footnote-4449564 +Node: os path<3>449619 +Ref: whatsnew/3 12 os-path449718 +Ref: 49e449718 +Ref: os path<3>-Footnote-1450083 +Ref: os path<3>-Footnote-2450138 +Node: pathlib<3>450194 +Ref: whatsnew/3 12 pathlib450296 +Ref: 4a1450296 +Ref: pathlib<3>-Footnote-1451593 +Ref: pathlib<3>-Footnote-2451648 +Ref: pathlib<3>-Footnote-3451703 +Node: platform451758 +Ref: whatsnew/3 12 platform451856 +Ref: 4a9451856 +Ref: platform-Footnote-1452201 +Node: pdb<2>452256 +Ref: whatsnew/3 12 pdb452353 +Ref: 4aa452353 +Ref: pdb<2>-Footnote-1452626 +Node: random<2>452682 +Ref: whatsnew/3 12 random452780 +Ref: 4ab452780 +Ref: random<2>-Footnote-1453085 +Ref: random<2>-Footnote-2453140 +Node: shutil<2>453196 +Ref: whatsnew/3 12 shutil453298 +Ref: 4ae453298 +Ref: shutil<2>-Footnote-1454728 +Ref: shutil<2>-Footnote-2454783 +Ref: shutil<2>-Footnote-3454839 +Ref: shutil<2>-Footnote-4454895 +Ref: shutil<2>-Footnote-5454951 +Node: sqlite3<2>455007 +Ref: whatsnew/3 12 sqlite3455113 +Ref: 4b1455113 +Ref: sqlite3<2>-Footnote-1456060 +Ref: sqlite3<2>-Footnote-2456115 +Ref: sqlite3<2>-Footnote-3456157 +Ref: sqlite3<2>-Footnote-4456212 +Ref: sqlite3<2>-Footnote-5456268 +Node: statistics<2>456324 +Ref: whatsnew/3 12 statistics456427 +Ref: 4b7456427 +Ref: statistics<2>-Footnote-1456707 +Node: sys<3>456762 +Ref: whatsnew/3 12 sys456866 +Ref: 4b9456866 +Ref: sys<3>-Footnote-1458416 +Ref: sys<3>-Footnote-2458472 +Ref: sys<3>-Footnote-3458527 +Ref: sys<3>-Footnote-4458583 +Node: tempfile<2>458639 +Ref: whatsnew/3 12 tempfile458739 +Ref: 4c1458739 +Ref: tempfile<2>-Footnote-1459131 +Node: threading459186 +Ref: whatsnew/3 12 threading459290 +Ref: 4c3459290 +Ref: threading-Footnote-1459639 +Node: tkinter<2>459694 +Ref: whatsnew/3 12 tkinter459795 +Ref: 4c6459795 +Ref: tkinter<2>-Footnote-1460291 +Node: tokenize460346 +Ref: whatsnew/3 12 tokenize460446 +Ref: 4c7460446 +Ref: tokenize-Footnote-1460803 +Ref: tokenize-Footnote-2460845 +Node: types<2>460901 +Ref: whatsnew/3 12 types461000 +Ref: 4c9461000 +Ref: types<2>-Footnote-1461296 +Node: typing<3>461352 +Ref: whatsnew/3 12 typing461457 +Ref: 4cc461457 +Ref: whatsnew/3 12 whatsnew-typing-py312461457 +Ref: 4cd461457 +Ref: typing<3>-Footnote-1464032 +Ref: typing<3>-Footnote-2464088 +Ref: typing<3>-Footnote-3464143 +Ref: typing<3>-Footnote-4464199 +Ref: typing<3>-Footnote-5464255 +Node: unicodedata<2>464310 +Ref: whatsnew/3 12 unicodedata464418 +Ref: 4d1464418 +Ref: unicodedata<2>-Footnote-1464616 +Node: unittest<2>464671 +Ref: whatsnew/3 12 unittest464774 +Ref: 4d2464774 +Ref: unittest<2>-Footnote-1465558 +Node: uuid465613 +Ref: whatsnew/3 12 uuid465693 +Ref: 4d3465693 +Ref: uuid-Footnote-1465856 +Node: Optimizations<2>465911 +Ref: whatsnew/3 12 optimizations466052 +Ref: 4d4466052 +Ref: Optimizations<2>-Footnote-1467505 +Ref: Optimizations<2>-Footnote-2467547 +Ref: Optimizations<2>-Footnote-3467602 +Ref: Optimizations<2>-Footnote-4467657 +Ref: Optimizations<2>-Footnote-5467713 +Ref: Optimizations<2>-Footnote-6467768 +Ref: Optimizations<2>-Footnote-7467824 +Ref: Optimizations<2>-Footnote-8467866 +Ref: Optimizations<2>-Footnote-9467922 +Node: CPython bytecode changes467978 +Ref: whatsnew/3 12 cpython-bytecode-changes468115 +Ref: 4d9468115 +Ref: CPython bytecode changes-Footnote-1470156 +Ref: CPython bytecode changes-Footnote-2470211 +Ref: CPython bytecode changes-Footnote-3470267 +Ref: CPython bytecode changes-Footnote-4470322 +Ref: CPython bytecode changes-Footnote-5470377 +Ref: CPython bytecode changes-Footnote-6470432 +Ref: CPython bytecode changes-Footnote-7470488 +Ref: CPython bytecode changes-Footnote-8470543 +Ref: CPython bytecode changes-Footnote-9470599 +Ref: CPython bytecode changes-Footnote-10470641 +Ref: CPython bytecode changes-Footnote-11470698 +Ref: CPython bytecode changes-Footnote-12470754 +Ref: CPython bytecode changes-Footnote-13470797 +Ref: CPython bytecode changes-Footnote-14470854 +Ref: CPython bytecode changes-Footnote-15470911 +Node: Demos and Tools470968 +Ref: whatsnew/3 12 demos-and-tools471099 +Ref: 4e6471099 +Ref: Demos and Tools-Footnote-1471552 +Ref: Demos and Tools-Footnote-2471600 +Ref: Demos and Tools-Footnote-3471655 +Ref: Demos and Tools-Footnote-4471703 +Node: Deprecated471758 +Ref: whatsnew/3 12 deprecated471872 +Ref: 4e7471872 +Ref: Deprecated-Footnote-1482349 +Ref: Deprecated-Footnote-2482404 +Ref: Deprecated-Footnote-3482459 +Ref: Deprecated-Footnote-4482514 +Ref: Deprecated-Footnote-5482569 +Ref: Deprecated-Footnote-6482625 +Ref: Deprecated-Footnote-7482681 +Ref: Deprecated-Footnote-8482736 +Ref: Deprecated-Footnote-9482792 +Ref: Deprecated-Footnote-10482847 +Ref: Deprecated-Footnote-11482903 +Ref: Deprecated-Footnote-12482960 +Ref: Deprecated-Footnote-13483016 +Ref: Deprecated-Footnote-14483072 +Ref: Deprecated-Footnote-15483128 +Ref: Deprecated-Footnote-16483184 +Ref: Deprecated-Footnote-17483287 +Ref: Deprecated-Footnote-18483344 +Ref: Deprecated-Footnote-19483400 +Ref: Deprecated-Footnote-20483457 +Ref: Deprecated-Footnote-21483514 +Ref: Deprecated-Footnote-22483570 +Ref: Deprecated-Footnote-23483626 +Ref: Deprecated-Footnote-24483682 +Ref: Deprecated-Footnote-25483738 +Ref: Deprecated-Footnote-26483794 +Ref: Deprecated-Footnote-27483850 +Ref: Deprecated-Footnote-28483907 +Ref: Deprecated-Footnote-29483950 +Node: Pending Removal in Python 3 13484007 +Ref: whatsnew/3 12 pending-removal-in-python-3-13484126 +Ref: 4f7484126 +Ref: Pending Removal in Python 3 13-Footnote-1485590 +Ref: Pending Removal in Python 3 13-Footnote-2485632 +Ref: Pending Removal in Python 3 13-Footnote-3485687 +Ref: Pending Removal in Python 3 13-Footnote-4485742 +Ref: Pending Removal in Python 3 13-Footnote-5485797 +Ref: Pending Removal in Python 3 13-Footnote-6485852 +Ref: Pending Removal in Python 3 13-Footnote-7485907 +Ref: Pending Removal in Python 3 13-Footnote-8485962 +Ref: Pending Removal in Python 3 13-Footnote-9486017 +Ref: Pending Removal in Python 3 13-Footnote-10486072 +Ref: Pending Removal in Python 3 13-Footnote-11486128 +Ref: Pending Removal in Python 3 13-Footnote-12486184 +Ref: Pending Removal in Python 3 13-Footnote-13486280 +Node: Pending Removal in Python 3 14<3>486337 +Ref: whatsnew/3 12 pending-removal-in-python-3-14486498 +Ref: 4f8486498 +Ref: Pending Removal in Python 3 14<3>-Footnote-1491192 +Ref: Pending Removal in Python 3 14<3>-Footnote-2491247 +Ref: Pending Removal in Python 3 14<3>-Footnote-3491302 +Ref: Pending Removal in Python 3 14<3>-Footnote-4491357 +Ref: Pending Removal in Python 3 14<3>-Footnote-5491412 +Ref: Pending Removal in Python 3 14<3>-Footnote-6491468 +Ref: Pending Removal in Python 3 14<3>-Footnote-7491523 +Ref: Pending Removal in Python 3 14<3>-Footnote-8491578 +Ref: Pending Removal in Python 3 14<3>-Footnote-9491633 +Ref: Pending Removal in Python 3 14<3>-Footnote-10491689 +Ref: Pending Removal in Python 3 14<3>-Footnote-11491745 +Ref: Pending Removal in Python 3 14<3>-Footnote-12491801 +Node: Pending Removal in Python 3 15<3>491857 +Ref: whatsnew/3 12 pending-removal-in-python-3-15492021 +Ref: 4f9492021 +Ref: Pending Removal in Python 3 15<3>-Footnote-1496351 +Ref: Pending Removal in Python 3 15<3>-Footnote-2496406 +Ref: Pending Removal in Python 3 15<3>-Footnote-3496461 +Ref: Pending Removal in Python 3 15<3>-Footnote-4496516 +Ref: Pending Removal in Python 3 15<3>-Footnote-5496572 +Ref: Pending Removal in Python 3 15<3>-Footnote-6496614 +Node: Pending removal in Python 3 16<3>496670 +Ref: whatsnew/3 12 pending-removal-in-python-3-16496838 +Ref: 4fa496838 +Ref: Pending removal in Python 3 16<3>-Footnote-1499025 +Node: Pending Removal in Future Versions<3>499081 +Ref: whatsnew/3 12 pending-removal-in-future-versions499207 +Ref: 4fb499207 +Ref: Pending Removal in Future Versions<3>-Footnote-1506052 +Ref: Pending Removal in Future Versions<3>-Footnote-2506107 +Ref: Pending Removal in Future Versions<3>-Footnote-3506163 +Ref: Pending Removal in Future Versions<3>-Footnote-4506219 +Ref: Pending Removal in Future Versions<3>-Footnote-5506274 +Node: Removed506329 +Ref: whatsnew/3 12 removed506450 +Ref: 4fc506450 +Ref: whatsnew/3 12 whatsnew312-removed506450 +Ref: 4fd506450 +Node: asynchat and asyncore506884 +Ref: whatsnew/3 12 asynchat-and-asyncore506973 +Ref: 4fe506973 +Ref: asynchat and asyncore-Footnote-1507289 +Ref: asynchat and asyncore-Footnote-2507331 +Node: configparser<3>507386 +Ref: whatsnew/3 12 configparser507493 +Ref: 4ff507493 +Ref: configparser<3>-Footnote-1508150 +Node: distutils508205 +Ref: whatsnew/3 12 distutils508300 +Ref: 502508300 +Ref: whatsnew/3 12 whatsnew312-removed-distutils508300 +Ref: 503508300 +Ref: distutils-Footnote-1508733 +Ref: distutils-Footnote-2508775 +Node: ensurepip508830 +Ref: whatsnew/3 12 ensurepip508917 +Ref: 504508917 +Ref: ensurepip-Footnote-1509938 +Node: enum<2>509993 +Ref: whatsnew/3 12 enum510077 +Ref: 505510077 +Ref: enum<2>-Footnote-1510313 +Node: ftplib510368 +Ref: whatsnew/3 12 ftplib510447 +Ref: 506510447 +Ref: ftplib-Footnote-1510690 +Node: gzip510745 +Ref: whatsnew/3 12 gzip510824 +Ref: 507510824 +Ref: gzip-Footnote-1511222 +Node: hashlib511277 +Ref: whatsnew/3 12 hashlib511362 +Ref: 509511362 +Ref: hashlib-Footnote-1511789 +Ref: hashlib-Footnote-2511831 +Node: importlib<2>511886 +Ref: whatsnew/3 12 importlib511970 +Ref: 50b511970 +Ref: importlib<2>-Footnote-1512860 +Ref: importlib<2>-Footnote-2512915 +Ref: importlib<2>-Footnote-3512970 +Ref: importlib<2>-Footnote-4513025 +Ref: importlib<2>-Footnote-5513080 +Node: imp513135 +Ref: whatsnew/3 12 imp513217 +Ref: 50c513217 +Ref: whatsnew/3 12 whatsnew312-removed-imp513217 +Ref: 50d513217 +Ref: imp-Footnote-1517333 +Node: io<2>517388 +Ref: whatsnew/3 12 io517467 +Ref: 516517467 +Ref: io<2>-Footnote-1517888 +Node: locale<2>517943 +Ref: whatsnew/3 12 locale518024 +Ref: 519518024 +Ref: locale<2>-Footnote-1518294 +Node: smtpd518349 +Ref: whatsnew/3 12 smtpd518435 +Ref: 51b518435 +Ref: smtpd-Footnote-1518789 +Ref: smtpd-Footnote-2518831 +Ref: smtpd-Footnote-3518874 +Node: sqlite3<3>518929 +Ref: whatsnew/3 12 id2519012 +Ref: 51c519012 +Ref: sqlite3<3>-Footnote-1519746 +Node: ssl<2>519801 +Ref: whatsnew/3 12 ssl519890 +Ref: 51d519890 +Ref: ssl<2>-Footnote-1520949 +Ref: ssl<2>-Footnote-2521004 +Ref: ssl<2>-Footnote-3521059 +Ref: ssl<2>-Footnote-4521115 +Node: unittest<3>521170 +Ref: whatsnew/3 12 id3521262 +Ref: 521521262 +Ref: unittest<3>-Footnote-1526027 +Node: webbrowser<2>526082 +Ref: whatsnew/3 12 webbrowser526189 +Ref: 52d526189 +Ref: webbrowser<2>-Footnote-1526496 +Node: xml etree ElementTree526552 +Ref: whatsnew/3 12 xml-etree-elementtree526660 +Ref: 52e526660 +Ref: xml etree ElementTree-Footnote-1527123 +Node: zipimport<2>527178 +Ref: whatsnew/3 12 zipimport527279 +Ref: 530527279 +Ref: zipimport<2>-Footnote-1527616 +Ref: zipimport<2>-Footnote-2527658 +Node: Others527713 +Ref: whatsnew/3 12 others527784 +Ref: 531527784 +Ref: Others-Footnote-1528792 +Ref: Others-Footnote-2528846 +Ref: Others-Footnote-3528901 +Ref: Others-Footnote-4528956 +Ref: Others-Footnote-5529011 +Node: Porting to Python 3 12529066 +Ref: whatsnew/3 12 porting-to-python-3-12529193 +Ref: 532529193 +Ref: whatsnew/3 12 whatsnew312-porting-to-python312529193 +Ref: 4c8529193 +Node: Changes in the Python API<2>529430 +Ref: whatsnew/3 12 changes-in-the-python-api529517 +Ref: 533529517 +Ref: Changes in the Python API<2>-Footnote-1535824 +Ref: Changes in the Python API<2>-Footnote-2535879 +Ref: Changes in the Python API<2>-Footnote-3535934 +Ref: Changes in the Python API<2>-Footnote-4535977 +Ref: Changes in the Python API<2>-Footnote-5536032 +Ref: Changes in the Python API<2>-Footnote-6536087 +Ref: Changes in the Python API<2>-Footnote-7536142 +Ref: Changes in the Python API<2>-Footnote-8536198 +Ref: Changes in the Python API<2>-Footnote-9536240 +Ref: Changes in the Python API<2>-Footnote-10536282 +Ref: Changes in the Python API<2>-Footnote-11536325 +Node: Build Changes<2>536382 +Ref: whatsnew/3 12 build-changes536518 +Ref: 541536518 +Ref: Build Changes<2>-Footnote-1538203 +Ref: Build Changes<2>-Footnote-2538258 +Ref: Build Changes<2>-Footnote-3538313 +Ref: Build Changes<2>-Footnote-4538368 +Ref: Build Changes<2>-Footnote-5538423 +Ref: Build Changes<2>-Footnote-6538478 +Node: C API Changes<2>538533 +Ref: whatsnew/3 12 c-api-changes538638 +Ref: 542538638 +Node: New Features<4>538829 +Ref: whatsnew/3 12 id4538931 +Ref: 543538931 +Ref: whatsnew/3 12 whatsnew312-pep697538976 +Ref: 440538976 +Ref: whatsnew/3 12 whatsnew312-pep683545122 +Ref: 441545122 +Ref: New Features<4>-Footnote-1546850 +Ref: New Features<4>-Footnote-2546892 +Ref: New Features<4>-Footnote-3546934 +Ref: New Features<4>-Footnote-4546990 +Ref: New Features<4>-Footnote-5547032 +Ref: New Features<4>-Footnote-6547088 +Ref: New Features<4>-Footnote-7547143 +Ref: New Features<4>-Footnote-8547198 +Ref: New Features<4>-Footnote-9547253 +Ref: New Features<4>-Footnote-10547308 +Ref: New Features<4>-Footnote-11547364 +Ref: New Features<4>-Footnote-12547420 +Ref: New Features<4>-Footnote-13547476 +Ref: New Features<4>-Footnote-14547532 +Ref: New Features<4>-Footnote-15547588 +Ref: New Features<4>-Footnote-16547645 +Ref: New Features<4>-Footnote-17547702 +Ref: New Features<4>-Footnote-18547759 +Ref: New Features<4>-Footnote-19547816 +Ref: New Features<4>-Footnote-20547859 +Ref: New Features<4>-Footnote-21547915 +Ref: New Features<4>-Footnote-22547958 +Ref: New Features<4>-Footnote-23548015 +Node: Porting to Python 3 12<2>548072 +Ref: whatsnew/3 12 id5548196 +Ref: 56d548196 +Ref: Porting to Python 3 12<2>-Footnote-1555695 +Ref: Porting to Python 3 12<2>-Footnote-2555750 +Ref: Porting to Python 3 12<2>-Footnote-3555805 +Ref: Porting to Python 3 12<2>-Footnote-4555860 +Ref: Porting to Python 3 12<2>-Footnote-5555915 +Ref: Porting to Python 3 12<2>-Footnote-6555970 +Ref: Porting to Python 3 12<2>-Footnote-7556025 +Ref: Porting to Python 3 12<2>-Footnote-8556081 +Node: Deprecated<2>556137 +Ref: whatsnew/3 12 id6556256 +Ref: 589556256 +Ref: Deprecated<2>-Footnote-1561664 +Ref: Deprecated<2>-Footnote-2561706 +Ref: Deprecated<2>-Footnote-3561762 +Ref: Deprecated<2>-Footnote-4561817 +Ref: Deprecated<2>-Footnote-5561872 +Ref: Deprecated<2>-Footnote-6561927 +Ref: Deprecated<2>-Footnote-7561983 +Ref: Deprecated<2>-Footnote-8562039 +Node: Pending Removal in Python 3 14<4>562095 +Ref: whatsnew/3 12 id7562220 +Ref: 593562220 +Ref: Pending Removal in Python 3 14<4>-Footnote-1565447 +Ref: Pending Removal in Python 3 14<4>-Footnote-2565489 +Ref: Pending Removal in Python 3 14<4>-Footnote-3565545 +Node: Pending Removal in Python 3 15<4>565600 +Ref: whatsnew/3 12 id8565767 +Ref: 594565767 +Node: Pending removal in Python 3 16<4>567020 +Ref: whatsnew/3 12 id9567191 +Ref: 595567191 +Node: Pending Removal in Future Versions<4>567314 +Ref: whatsnew/3 12 id10567443 +Ref: 596567443 +Node: Removed<2>569684 +Ref: whatsnew/3 12 id11569769 +Ref: 597569769 +Ref: Removed<2>-Footnote-1570624 +Ref: Removed<2>-Footnote-2570679 +Ref: Removed<2>-Footnote-3570721 +Node: What’s New In Python 3 11570776 +Ref: whatsnew/3 11 doc570934 +Ref: 598570934 +Ref: whatsnew/3 11 what-s-new-in-python-3-11570934 +Ref: 599570934 +Node: Summary – Release highlights<2>572014 +Ref: whatsnew/3 11 summary-release-highlights572135 +Ref: 59a572135 +Ref: whatsnew/3 11 whatsnew311-summary572135 +Ref: 59b572135 +Ref: Summary – Release highlights<2>-Footnote-1573662 +Ref: Summary – Release highlights<2>-Footnote-2573704 +Ref: Summary – Release highlights<2>-Footnote-3573729 +Ref: Summary – Release highlights<2>-Footnote-4573771 +Ref: Summary – Release highlights<2>-Footnote-5573813 +Node: New Features<5>573855 +Ref: whatsnew/3 11 new-features574022 +Ref: 5ab574022 +Ref: whatsnew/3 11 whatsnew311-features574022 +Ref: 5ac574022 +Node: PEP 657 Fine-grained error locations in tracebacks574432 +Ref: whatsnew/3 11 pep-657-fine-grained-error-locations-in-tracebacks574579 +Ref: 5ad574579 +Ref: whatsnew/3 11 whatsnew311-pep657574579 +Ref: 59f574579 +Ref: PEP 657 Fine-grained error locations in tracebacks-Footnote-1577350 +Ref: PEP 657 Fine-grained error locations in tracebacks-Footnote-2577392 +Node: PEP 654 Exception Groups and except*577457 +Ref: whatsnew/3 11 pep-654-exception-groups-and-except577658 +Ref: 5b3577658 +Ref: whatsnew/3 11 whatsnew311-pep654577658 +Ref: 59d577658 +Ref: PEP 654 Exception Groups and except*-Footnote-1578326 +Ref: PEP 654 Exception Groups and except*-Footnote-2578368 +Ref: PEP 654 Exception Groups and except*-Footnote-3578410 +Node: PEP 678 Exceptions can be enriched with notes578475 +Ref: whatsnew/3 11 pep-678-exceptions-can-be-enriched-with-notes578662 +Ref: 5b5578662 +Ref: whatsnew/3 11 whatsnew311-pep678578662 +Ref: 59e578662 +Ref: PEP 678 Exceptions can be enriched with notes-Footnote-1579175 +Ref: PEP 678 Exceptions can be enriched with notes-Footnote-2579217 +Node: Windows py exe launcher improvements579282 +Ref: whatsnew/3 11 whatsnew311-windows-launcher579424 +Ref: 5b8579424 +Ref: whatsnew/3 11 windows-py-exe-launcher-improvements579424 +Ref: 5b9579424 +Ref: whatsnew/3 11 new-feat-related-type-hints-311580748 +Ref: 5bb580748 +Ref: Windows py exe launcher improvements-Footnote-1580786 +Ref: Windows py exe launcher improvements-Footnote-2580828 +Node: New Features Related to Type Hints<2>580859 +Ref: whatsnew/3 11 new-features-related-to-type-hints581018 +Ref: 5bc581018 +Ref: whatsnew/3 11 whatsnew311-typing-features581018 +Ref: 5bd581018 +Ref: New Features Related to Type Hints<2>-Footnote-1581674 +Node: PEP 646 Variadic generics581716 +Ref: whatsnew/3 11 pep-646-variadic-generics581894 +Ref: 5be581894 +Ref: whatsnew/3 11 whatsnew311-pep646581894 +Ref: 5a3581894 +Ref: PEP 646 Variadic generics-Footnote-1582872 +Ref: PEP 646 Variadic generics-Footnote-2582914 +Ref: PEP 646 Variadic generics-Footnote-3582956 +Ref: PEP 646 Variadic generics-Footnote-4582998 +Node: PEP 655 Marking individual TypedDict items as required or not-required583063 +Ref: whatsnew/3 11 pep-655-marking-individual-typeddict-items-as-required-or-not-required583267 +Ref: 5bf583267 +Ref: whatsnew/3 11 whatsnew311-pep655583267 +Ref: 5a4583267 +Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-1584487 +Ref: PEP 655 Marking individual TypedDict items as required or not-required-Footnote-2584529 +Node: PEP 673 Self type584594 +Ref: whatsnew/3 11 pep-673-self-type584810 +Ref: 5c2584810 +Ref: whatsnew/3 11 whatsnew311-pep673584810 +Ref: 5a5584810 +Ref: PEP 673 Self type-Footnote-1585854 +Ref: PEP 673 Self type-Footnote-2585935 +Ref: PEP 673 Self type-Footnote-3585977 +Node: PEP 675 Arbitrary literal string type586042 +Ref: whatsnew/3 11 pep-675-arbitrary-literal-string-type586217 +Ref: 5c5586217 +Ref: whatsnew/3 11 whatsnew311-pep675586217 +Ref: 5a6586217 +Ref: PEP 675 Arbitrary literal string type-Footnote-1587611 +Ref: PEP 675 Arbitrary literal string type-Footnote-2587653 +Node: PEP 681 Data class transforms587718 +Ref: whatsnew/3 11 pep-681-data-class-transforms587905 +Ref: 5c7587905 +Ref: whatsnew/3 11 whatsnew311-pep681587905 +Ref: 5a7587905 +Ref: PEP 681 Data class transforms-Footnote-1588938 +Ref: PEP 681 Data class transforms-Footnote-2588980 +Node: PEP 563 may not be the future589035 +Ref: whatsnew/3 11 pep-563-may-not-be-the-future589176 +Ref: 5c8589176 +Ref: whatsnew/3 11 whatsnew311-pep563-deferred589176 +Ref: 5c9589176 +Ref: PEP 563 may not be the future-Footnote-1589571 +Ref: PEP 563 may not be the future-Footnote-2589613 +Node: Other Language Changes<3>589724 +Ref: whatsnew/3 11 other-language-changes589904 +Ref: 5ca589904 +Ref: whatsnew/3 11 whatsnew311-other-lang-changes589904 +Ref: 5cb589904 +Ref: whatsnew/3 11 whatsnew311-pythonsafepath591713 +Ref: 5a2591713 +Ref: Other Language Changes<3>-Footnote-1593061 +Ref: Other Language Changes<3>-Footnote-2593126 +Ref: Other Language Changes<3>-Footnote-3593191 +Ref: Other Language Changes<3>-Footnote-4593256 +Ref: Other Language Changes<3>-Footnote-5593321 +Ref: Other Language Changes<3>-Footnote-6593376 +Ref: Other Language Changes<3>-Footnote-7593441 +Ref: Other Language Changes<3>-Footnote-8593496 +Ref: Other Language Changes<3>-Footnote-9593538 +Ref: Other Language Changes<3>-Footnote-10593593 +Node: Other CPython Implementation Changes593649 +Ref: whatsnew/3 11 other-cpython-implementation-changes593806 +Ref: 5e1593806 +Ref: whatsnew/3 11 whatsnew311-other-implementation-changes593806 +Ref: 5e2593806 +Ref: Other CPython Implementation Changes-Footnote-1597060 +Ref: Other CPython Implementation Changes-Footnote-2597125 +Ref: Other CPython Implementation Changes-Footnote-3597167 +Ref: Other CPython Implementation Changes-Footnote-4597232 +Ref: Other CPython Implementation Changes-Footnote-5597297 +Ref: Other CPython Implementation Changes-Footnote-6597362 +Ref: Other CPython Implementation Changes-Footnote-7597427 +Ref: Other CPython Implementation Changes-Footnote-8597492 +Node: New Modules<3>597548 +Ref: whatsnew/3 11 new-modules597699 +Ref: 5f2597699 +Ref: whatsnew/3 11 whatsnew311-new-modules597699 +Ref: 5f3597699 +Ref: New Modules<3>-Footnote-1598047 +Ref: New Modules<3>-Footnote-2598072 +Ref: New Modules<3>-Footnote-3598114 +Ref: New Modules<3>-Footnote-4598179 +Ref: New Modules<3>-Footnote-5598221 +Node: Improved Modules<3>598286 +Ref: whatsnew/3 11 improved-modules598417 +Ref: 5f4598417 +Ref: whatsnew/3 11 whatsnew311-improved-modules598417 +Ref: 5f5598417 +Node: asyncio<3>599150 +Ref: whatsnew/3 11 asyncio599235 +Ref: 5f6599235 +Ref: whatsnew/3 11 whatsnew311-asyncio599235 +Ref: 5f7599235 +Ref: asyncio<3>-Footnote-1601153 +Ref: asyncio<3>-Footnote-2601208 +Ref: asyncio<3>-Footnote-3601263 +Ref: asyncio<3>-Footnote-4601318 +Ref: asyncio<3>-Footnote-5601373 +Ref: asyncio<3>-Footnote-6601438 +Node: contextlib601503 +Ref: whatsnew/3 11 contextlib601608 +Ref: 606601608 +Ref: whatsnew/3 11 whatsnew311-contextlib601608 +Ref: 607601608 +Ref: contextlib-Footnote-1601923 +Node: dataclasses601988 +Ref: whatsnew/3 11 dataclasses602091 +Ref: 60a602091 +Ref: whatsnew/3 11 whatsnew311-dataclasses602091 +Ref: 60b602091 +Ref: dataclasses-Footnote-1602433 +Node: datetime602498 +Ref: whatsnew/3 11 datetime602598 +Ref: 60e602598 +Ref: whatsnew/3 11 whatsnew311-datetime602598 +Ref: 60f602598 +Ref: datetime-Footnote-1603137 +Ref: datetime-Footnote-2603192 +Node: enum<3>603247 +Ref: whatsnew/3 11 enum603341 +Ref: 614603341 +Ref: whatsnew/3 11 whatsnew311-enum603341 +Ref: 615603341 +Node: fcntl605987 +Ref: whatsnew/3 11 fcntl606085 +Ref: 62f606085 +Ref: whatsnew/3 11 whatsnew311-fcntl606085 +Ref: 630606085 +Node: fractions<3>606320 +Ref: whatsnew/3 11 fractions606420 +Ref: 631606420 +Ref: whatsnew/3 11 whatsnew311-fractions606420 +Ref: 632606420 +Ref: fractions<3>-Footnote-1606838 +Ref: fractions<3>-Footnote-2606880 +Ref: fractions<3>-Footnote-3606945 +Node: functools607010 +Ref: whatsnew/3 11 functools607112 +Ref: 633607112 +Ref: whatsnew/3 11 whatsnew311-functools607112 +Ref: 634607112 +Ref: functools-Footnote-1608184 +Node: gzip<2>608249 +Ref: whatsnew/3 11 gzip608349 +Ref: 638608349 +Ref: whatsnew/3 11 whatsnew311-gzip608349 +Ref: 639608349 +Ref: gzip<2>-Footnote-1609065 +Node: hashlib<2>609121 +Ref: whatsnew/3 11 hashlib609228 +Ref: 63c609228 +Ref: whatsnew/3 11 whatsnew311-hashlib609228 +Ref: 63d609228 +Ref: hashlib<2>-Footnote-1610051 +Ref: hashlib<2>-Footnote-2610083 +Ref: hashlib<2>-Footnote-3610148 +Ref: hashlib<2>-Footnote-4610213 +Node: IDLE and idlelib610268 +Ref: whatsnew/3 11 idle-and-idlelib610378 +Ref: 641610378 +Ref: whatsnew/3 11 whatsnew311-idle610378 +Ref: 642610378 +Ref: IDLE and idlelib-Footnote-1610712 +Ref: IDLE and idlelib-Footnote-2610777 +Node: inspect<2>610832 +Ref: whatsnew/3 11 inspect610941 +Ref: 643610941 +Ref: whatsnew/3 11 whatsnew311-inspect610941 +Ref: 644610941 +Ref: inspect<2>-Footnote-1612028 +Ref: inspect<2>-Footnote-2612093 +Ref: inspect<2>-Footnote-3612158 +Ref: inspect<2>-Footnote-4612200 +Node: locale<3>612255 +Ref: whatsnew/3 11 locale612355 +Ref: 650612355 +Ref: whatsnew/3 11 whatsnew311-locale612355 +Ref: 651612355 +Node: logging612582 +Ref: whatsnew/3 11 logging612679 +Ref: 653612679 +Ref: whatsnew/3 11 whatsnew311-logging612679 +Ref: 654612679 +Ref: logging-Footnote-1613338 +Ref: logging-Footnote-2613393 +Node: math<3>613448 +Ref: whatsnew/3 11 math613544 +Ref: 65a613544 +Ref: whatsnew/3 11 whatsnew311-math613544 +Ref: 65b613544 +Ref: math<3>-Footnote-1614317 +Ref: math<3>-Footnote-2614382 +Ref: math<3>-Footnote-3614447 +Ref: math<3>-Footnote-4614512 +Node: operator614577 +Ref: whatsnew/3 11 operator614671 +Ref: 660614671 +Ref: whatsnew/3 11 whatsnew311-operator614671 +Ref: 661614671 +Ref: operator-Footnote-1614933 +Node: os<3>614998 +Ref: whatsnew/3 11 os615095 +Ref: 662615095 +Ref: whatsnew/3 11 whatsnew311-os615095 +Ref: 663615095 +Ref: os<3>-Footnote-1615344 +Node: pathlib<4>615409 +Ref: whatsnew/3 11 pathlib615503 +Ref: 664615503 +Ref: whatsnew/3 11 whatsnew311-pathlib615503 +Ref: 665615503 +Ref: pathlib<4>-Footnote-1615824 +Ref: pathlib<4>-Footnote-2615889 +Node: re<3>615954 +Ref: whatsnew/3 11 re616052 +Ref: 668616052 +Ref: whatsnew/3 11 whatsnew311-re616052 +Ref: 669616052 +Ref: re<3>-Footnote-1616354 +Node: shutil<3>616420 +Ref: whatsnew/3 11 shutil616514 +Ref: 66a616514 +Ref: whatsnew/3 11 whatsnew311-shutil616514 +Ref: 66b616514 +Ref: shutil<3>-Footnote-1616708 +Node: socket616773 +Ref: whatsnew/3 11 socket616872 +Ref: 66c616872 +Ref: whatsnew/3 11 whatsnew311-socket616872 +Ref: 66d616872 +Ref: socket-Footnote-1617285 +Ref: socket-Footnote-2617350 +Node: sqlite3<4>617415 +Ref: whatsnew/3 11 sqlite3617511 +Ref: 66f617511 +Ref: whatsnew/3 11 whatsnew311-sqlite3617511 +Ref: 670617511 +Ref: sqlite3<4>-Footnote-1619855 +Ref: sqlite3<4>-Footnote-2619920 +Ref: sqlite3<4>-Footnote-3619985 +Ref: sqlite3<4>-Footnote-4620050 +Ref: sqlite3<4>-Footnote-5620115 +Ref: sqlite3<4>-Footnote-6620180 +Ref: sqlite3<4>-Footnote-7620245 +Ref: sqlite3<4>-Footnote-8620310 +Ref: sqlite3<4>-Footnote-9620375 +Ref: sqlite3<4>-Footnote-10620440 +Ref: sqlite3<4>-Footnote-11620506 +Node: string620572 +Ref: whatsnew/3 11 string620668 +Ref: 67f620668 +Ref: whatsnew/3 11 whatsnew311-string620668 +Ref: 680620668 +Ref: string-Footnote-1620993 +Node: sys<4>621048 +Ref: whatsnew/3 11 sys621143 +Ref: 684621143 +Ref: whatsnew/3 11 whatsnew311-sys621143 +Ref: 685621143 +Ref: sys<4>-Footnote-1621836 +Ref: sys<4>-Footnote-2621901 +Ref: sys<4>-Footnote-3621966 +Node: sysconfig622021 +Ref: whatsnew/3 11 sysconfig622121 +Ref: 689622121 +Ref: whatsnew/3 11 whatsnew311-sysconfig622121 +Ref: 68a622121 +Ref: sysconfig-Footnote-1622934 +Node: tempfile<3>622999 +Ref: whatsnew/3 11 tempfile623105 +Ref: 68d623105 +Ref: whatsnew/3 11 whatsnew311-tempfile623105 +Ref: 68e623105 +Ref: tempfile<3>-Footnote-1623514 +Node: threading<2>623569 +Ref: whatsnew/3 11 threading623673 +Ref: 692623673 +Ref: whatsnew/3 11 whatsnew311-threading623673 +Ref: 693623673 +Ref: threading<2>-Footnote-1624178 +Node: time<2>624243 +Ref: whatsnew/3 11 time624346 +Ref: 697624346 +Ref: whatsnew/3 11 whatsnew311-time624346 +Ref: 698624346 +Ref: time<2>-Footnote-1625147 +Ref: time<2>-Footnote-2625212 +Ref: time<2>-Footnote-3625309 +Ref: time<2>-Footnote-4625374 +Node: tkinter<3>625439 +Ref: whatsnew/3 11 tkinter625542 +Ref: 69a625542 +Ref: whatsnew/3 11 whatsnew311-tkinter625542 +Ref: 69b625542 +Ref: tkinter<3>-Footnote-1625825 +Node: traceback<2>625880 +Ref: whatsnew/3 11 traceback625985 +Ref: 69d625985 +Ref: whatsnew/3 11 whatsnew311-traceback625985 +Ref: 69e625985 +Ref: traceback<2>-Footnote-1626477 +Ref: traceback<2>-Footnote-2626542 +Node: typing<4>626607 +Ref: whatsnew/3 11 typing626716 +Ref: 6a1626716 +Ref: whatsnew/3 11 whatsnew311-typing626716 +Ref: 6a2626716 +Ref: typing<4>-Footnote-1630008 +Ref: typing<4>-Footnote-2630063 +Ref: typing<4>-Footnote-3630118 +Ref: typing<4>-Footnote-4630173 +Ref: typing<4>-Footnote-5630228 +Ref: typing<4>-Footnote-6630293 +Ref: typing<4>-Footnote-7630348 +Ref: typing<4>-Footnote-8630403 +Ref: typing<4>-Footnote-9630458 +Ref: typing<4>-Footnote-10630513 +Ref: typing<4>-Footnote-11630569 +Ref: typing<4>-Footnote-12630625 +Ref: typing<4>-Footnote-13630681 +Ref: typing<4>-Footnote-14630737 +Ref: typing<4>-Footnote-15630793 +Node: unicodedata<3>630849 +Ref: whatsnew/3 11 unicodedata630957 +Ref: 6b1630957 +Ref: whatsnew/3 11 whatsnew311-unicodedata630957 +Ref: 6b2630957 +Ref: unicodedata<3>-Footnote-1631156 +Node: unittest<4>631221 +Ref: whatsnew/3 11 unittest631327 +Ref: 6b3631327 +Ref: whatsnew/3 11 whatsnew311-unittest631327 +Ref: 6b4631327 +Ref: unittest<4>-Footnote-1631729 +Node: venv<2>631794 +Ref: whatsnew/3 11 venv631897 +Ref: 6b9631897 +Ref: whatsnew/3 11 whatsnew311-venv631897 +Ref: 6ba631897 +Ref: venv<2>-Footnote-1632520 +Node: warnings<2>632585 +Ref: whatsnew/3 11 warnings632684 +Ref: 6bb632684 +Ref: whatsnew/3 11 whatsnew311-warnings632684 +Ref: 6bc632684 +Ref: warnings<2>-Footnote-1633015 +Node: zipfile633080 +Ref: whatsnew/3 11 whatsnew311-zipfile633163 +Ref: 6be633163 +Ref: whatsnew/3 11 zipfile633163 +Ref: 6bf633163 +Ref: zipfile-Footnote-1633754 +Ref: zipfile-Footnote-2633819 +Ref: zipfile-Footnote-3633874 +Node: Optimizations<3>633929 +Ref: whatsnew/3 11 optimizations634060 +Ref: 6c6634060 +Ref: whatsnew/3 11 whatsnew311-optimizations634060 +Ref: 6c7634060 +Ref: Optimizations<3>-Footnote-1636461 +Ref: Optimizations<3>-Footnote-2636526 +Ref: Optimizations<3>-Footnote-3636581 +Ref: Optimizations<3>-Footnote-4636636 +Ref: Optimizations<3>-Footnote-5636691 +Ref: Optimizations<3>-Footnote-6636756 +Ref: Optimizations<3>-Footnote-7636811 +Ref: Optimizations<3>-Footnote-8636876 +Ref: Optimizations<3>-Footnote-9636931 +Node: Faster CPython636996 +Ref: whatsnew/3 11 faster-cpython637135 +Ref: 6d1637135 +Ref: whatsnew/3 11 whatsnew311-faster-cpython637135 +Ref: 59c637135 +Ref: Faster CPython-Footnote-1637720 +Ref: Faster CPython-Footnote-2637786 +Node: Faster Startup637834 +Ref: whatsnew/3 11 faster-startup637922 +Ref: 6d4637922 +Ref: whatsnew/3 11 whatsnew311-faster-startup637922 +Ref: 6d2637922 +Node: Frozen imports / Static code objects638020 +Ref: whatsnew/3 11 frozen-imports-static-code-objects638107 +Ref: 6d5638107 +Ref: whatsnew/3 11 whatsnew311-faster-imports638107 +Ref: 6d6638107 +Node: Faster Runtime638941 +Ref: whatsnew/3 11 faster-runtime639042 +Ref: 6d8639042 +Ref: whatsnew/3 11 whatsnew311-faster-runtime639042 +Ref: 6d3639042 +Node: Cheaper lazy Python frames639281 +Ref: whatsnew/3 11 cheaper-lazy-python-frames639396 +Ref: 6d9639396 +Ref: whatsnew/3 11 whatsnew311-lazy-python-frames639396 +Ref: 6da639396 +Ref: whatsnew/3 11 inline-calls640339 +Ref: 6de640339 +Ref: Cheaper lazy Python frames-Footnote-1640377 +Node: Inlined Python function calls640442 +Ref: whatsnew/3 11 inlined-python-function-calls640607 +Ref: 6df640607 +Ref: whatsnew/3 11 whatsnew311-inline-calls640607 +Ref: 6e0640607 +Ref: Inlined Python function calls-Footnote-1641563 +Node: PEP 659 Specializing Adaptive Interpreter641628 +Ref: whatsnew/3 11 pep-659-specializing-adaptive-interpreter641758 +Ref: 6e1641758 +Ref: whatsnew/3 11 whatsnew311-pep659641758 +Ref: 17c641758 +Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-1649170 +Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-2649212 +Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-3649254 +Ref: PEP 659 Specializing Adaptive Interpreter-Footnote-4649379 +Node: Misc649604 +Ref: whatsnew/3 11 misc649694 +Ref: 6e2649694 +Ref: whatsnew/3 11 whatsnew311-faster-cpython-misc649694 +Ref: 6e3649694 +Ref: Misc-Footnote-1650711 +Ref: Misc-Footnote-2650776 +Ref: Misc-Footnote-3650841 +Ref: Misc-Footnote-4650906 +Ref: Misc-Footnote-5650971 +Ref: Misc-Footnote-6651042 +Node: FAQ651097 +Ref: whatsnew/3 11 faq651178 +Ref: 6e5651178 +Ref: whatsnew/3 11 whatsnew311-faster-cpython-faq651178 +Ref: 6e6651178 +Node: How should I write my code to utilize these speedups?651473 +Ref: whatsnew/3 11 faster-cpython-faq-my-code651609 +Ref: 6e7651609 +Ref: whatsnew/3 11 how-should-i-write-my-code-to-utilize-these-speedups651609 +Ref: 6e8651609 +Node: Will CPython 3 11 use more memory?651904 +Ref: whatsnew/3 11 faster-cpython-faq-memory652095 +Ref: 6e9652095 +Ref: whatsnew/3 11 will-cpython-3-11-use-more-memory652095 +Ref: 6ea652095 +Node: I don’t see any speedups in my workload Why?652358 +Ref: whatsnew/3 11 faster-cpython-ymmv652520 +Ref: 6eb652520 +Ref: whatsnew/3 11 i-don-t-see-any-speedups-in-my-workload-why652520 +Ref: 6ec652520 +Node: Is there a JIT compiler?653110 +Ref: whatsnew/3 11 faster-cpython-jit653229 +Ref: 6ed653229 +Ref: whatsnew/3 11 is-there-a-jit-compiler653229 +Ref: 6ee653229 +Node: About653349 +Ref: whatsnew/3 11 about653417 +Ref: 6ef653417 +Ref: whatsnew/3 11 whatsnew311-faster-cpython-about653417 +Ref: 6f0653417 +Node: CPython bytecode changes<2>653726 +Ref: whatsnew/3 11 cpython-bytecode-changes653862 +Ref: 6f2653862 +Ref: whatsnew/3 11 whatsnew311-bytecode-changes653862 +Ref: 6f3653862 +Node: New opcodes654409 +Ref: whatsnew/3 11 new-opcodes654509 +Ref: 6f5654509 +Ref: whatsnew/3 11 whatsnew311-added-opcodes654509 +Ref: 6f6654509 +Ref: New opcodes-Footnote-1655291 +Node: Replaced opcodes655333 +Ref: whatsnew/3 11 replaced-opcodes655465 +Ref: 6ff655465 +Ref: whatsnew/3 11 whatsnew311-replaced-opcodes655465 +Ref: 700655465 +Ref: whatsnew/3 11 whatsnew311-changed-opcodes658180 +Ref: 709658180 +Ref: whatsnew/3 11 whatsnew311-removed-opcodes658180 +Ref: 70a658180 +Ref: Replaced opcodes-Footnote-1658216 +Node: Changed/removed opcodes658434 +Ref: whatsnew/3 11 changed-removed-opcodes658546 +Ref: 70b658546 +Ref: whatsnew/3 11 whatsnew311-changed-removed-opcodes658546 +Ref: 70c658546 +Ref: whatsnew/3 11 whatsnew311-deprecated659134 +Ref: 70f659134 +Ref: Changed/removed opcodes-Footnote-1659171 +Node: Deprecated<3>659226 +Ref: whatsnew/3 11 deprecated659378 +Ref: 710659378 +Ref: whatsnew/3 11 whatsnew311-python-api-deprecated659378 +Ref: 711659378 +Ref: whatsnew/3 11 whatsnew311-deprecated-language659540 +Ref: 713659540 +Node: Language/Builtins659606 +Ref: whatsnew/3 11 language-builtins659689 +Ref: 714659689 +Ref: whatsnew/3 11 whatsnew311-deprecated-builtins659689 +Ref: 715659689 +Ref: Language/Builtins-Footnote-1660914 +Ref: Language/Builtins-Footnote-2660979 +Ref: Language/Builtins-Footnote-3661034 +Ref: Language/Builtins-Footnote-4661089 +Node: Modules661154 +Ref: whatsnew/3 11 modules661262 +Ref: 719661262 +Ref: whatsnew/3 11 whatsnew311-deprecated-modules661262 +Ref: 71a661262 +Ref: whatsnew/3 11 whatsnew311-pep594661297 +Ref: 5a8661297 +Ref: Modules-Footnote-1663507 +Ref: Modules-Footnote-2663549 +Ref: Modules-Footnote-3663614 +Ref: Modules-Footnote-4663669 +Ref: Modules-Footnote-5663734 +Ref: Modules-Footnote-6663776 +Ref: Modules-Footnote-7663841 +Node: Standard Library663906 +Ref: whatsnew/3 11 standard-library663988 +Ref: 71b663988 +Ref: whatsnew/3 11 whatsnew311-deprecated-stdlib663988 +Ref: 71c663988 +Ref: whatsnew/3 11 whatsnew311-pending-removal668845 +Ref: 721668845 +Ref: Standard Library-Footnote-1668882 +Ref: Standard Library-Footnote-2668947 +Ref: Standard Library-Footnote-3669012 +Ref: Standard Library-Footnote-4669067 +Ref: Standard Library-Footnote-5669122 +Ref: Standard Library-Footnote-6669177 +Ref: Standard Library-Footnote-7669232 +Ref: Standard Library-Footnote-8669297 +Ref: Standard Library-Footnote-9669352 +Ref: Standard Library-Footnote-10669407 +Ref: Standard Library-Footnote-11669473 +Ref: Standard Library-Footnote-12669538 +Node: Pending Removal in Python 3 12669594 +Ref: whatsnew/3 11 pending-removal-in-python-3-12669729 +Ref: 722669729 +Ref: whatsnew/3 11 whatsnew311-python-api-pending-removal669729 +Ref: 723669729 +Ref: whatsnew/3 11 whatsnew311-removed675367 +Ref: 728675367 +Node: Removed<3>675367 +Ref: whatsnew/3 11 removed675511 +Ref: 729675511 +Ref: whatsnew/3 11 whatsnew311-python-api-removed675511 +Ref: 72a675511 +Ref: whatsnew/3 11 whatsnew311-porting680178 +Ref: 737680178 +Ref: Removed<3>-Footnote-1680215 +Ref: Removed<3>-Footnote-2680280 +Ref: Removed<3>-Footnote-3680345 +Ref: Removed<3>-Footnote-4680410 +Ref: Removed<3>-Footnote-5680475 +Ref: Removed<3>-Footnote-6680540 +Ref: Removed<3>-Footnote-7680605 +Ref: Removed<3>-Footnote-8680670 +Ref: Removed<3>-Footnote-9680735 +Ref: Removed<3>-Footnote-10680800 +Ref: Removed<3>-Footnote-11680866 +Ref: Removed<3>-Footnote-12680932 +Ref: Removed<3>-Footnote-13680998 +Ref: Removed<3>-Footnote-14681064 +Ref: Removed<3>-Footnote-15681106 +Node: Porting to Python 3 11681160 +Ref: whatsnew/3 11 porting-to-python-3-11681290 +Ref: 738681290 +Ref: whatsnew/3 11 whatsnew311-python-api-porting681290 +Ref: 739681290 +Ref: Porting to Python 3 11-Footnote-1684339 +Ref: Porting to Python 3 11-Footnote-2684404 +Ref: Porting to Python 3 11-Footnote-3684459 +Ref: Porting to Python 3 11-Footnote-4684524 +Ref: Porting to Python 3 11-Footnote-5684589 +Ref: Porting to Python 3 11-Footnote-6684654 +Ref: Porting to Python 3 11-Footnote-7684719 +Ref: Porting to Python 3 11-Footnote-8684784 +Node: Build Changes<3>684849 +Ref: whatsnew/3 11 build-changes684985 +Ref: 744684985 +Ref: whatsnew/3 11 whatsnew311-build-changes684985 +Ref: 745684985 +Ref: Build Changes<3>-Footnote-1689224 +Ref: Build Changes<3>-Footnote-2689266 +Ref: Build Changes<3>-Footnote-3689315 +Ref: Build Changes<3>-Footnote-4689348 +Ref: Build Changes<3>-Footnote-5689380 +Ref: Build Changes<3>-Footnote-6689406 +Ref: Build Changes<3>-Footnote-7689435 +Ref: Build Changes<3>-Footnote-8689490 +Ref: Build Changes<3>-Footnote-9689545 +Ref: Build Changes<3>-Footnote-10689600 +Ref: Build Changes<3>-Footnote-11689644 +Ref: Build Changes<3>-Footnote-12689728 +Ref: Build Changes<3>-Footnote-13689794 +Ref: Build Changes<3>-Footnote-14689860 +Ref: Build Changes<3>-Footnote-15689926 +Ref: Build Changes<3>-Footnote-16689974 +Ref: Build Changes<3>-Footnote-17690040 +Ref: Build Changes<3>-Footnote-18690106 +Ref: Build Changes<3>-Footnote-19690134 +Ref: Build Changes<3>-Footnote-20690200 +Ref: Build Changes<3>-Footnote-21690263 +Ref: Build Changes<3>-Footnote-22690291 +Ref: Build Changes<3>-Footnote-23690357 +Ref: Build Changes<3>-Footnote-24690423 +Ref: Build Changes<3>-Footnote-25690489 +Ref: Build Changes<3>-Footnote-26690555 +Ref: Build Changes<3>-Footnote-27690605 +Ref: Build Changes<3>-Footnote-28690671 +Ref: Build Changes<3>-Footnote-29690737 +Ref: Build Changes<3>-Footnote-30690803 +Ref: Build Changes<3>-Footnote-31690869 +Ref: Build Changes<3>-Footnote-32690935 +Ref: Build Changes<3>-Footnote-33691001 +Node: C API Changes<3>691067 +Ref: whatsnew/3 11 c-api-changes691206 +Ref: 749691206 +Ref: whatsnew/3 11 whatsnew311-c-api691206 +Ref: 74a691206 +Node: New Features<6>691466 +Ref: whatsnew/3 11 id5691568 +Ref: 74b691568 +Ref: whatsnew/3 11 whatsnew311-c-api-new-features691568 +Ref: 74c691568 +Ref: New Features<6>-Footnote-1694422 +Ref: New Features<6>-Footnote-2694487 +Ref: New Features<6>-Footnote-3694552 +Ref: New Features<6>-Footnote-4694617 +Ref: New Features<6>-Footnote-5694682 +Ref: New Features<6>-Footnote-6694747 +Ref: New Features<6>-Footnote-7694812 +Ref: New Features<6>-Footnote-8694877 +Ref: New Features<6>-Footnote-9694942 +Node: Porting to Python 3 11<2>694997 +Ref: whatsnew/3 11 id6695121 +Ref: 76f695121 +Ref: whatsnew/3 11 whatsnew311-c-api-porting695121 +Ref: 73a695121 +Ref: whatsnew/3 11 whatsnew311-pep670695186 +Ref: 5aa695186 +Ref: whatsnew/3 11 pyframeobject-3-11-hiding702603 +Ref: 783702603 +Ref: Porting to Python 3 11<2>-Footnote-1708560 +Ref: Porting to Python 3 11<2>-Footnote-2708623 +Ref: Porting to Python 3 11<2>-Footnote-3708665 +Ref: Porting to Python 3 11<2>-Footnote-4708720 +Ref: Porting to Python 3 11<2>-Footnote-5708785 +Ref: Porting to Python 3 11<2>-Footnote-6708850 +Ref: Porting to Python 3 11<2>-Footnote-7708915 +Ref: Porting to Python 3 11<2>-Footnote-8708957 +Ref: Porting to Python 3 11<2>-Footnote-9709022 +Ref: Porting to Python 3 11<2>-Footnote-10709077 +Ref: Porting to Python 3 11<2>-Footnote-11709133 +Ref: Porting to Python 3 11<2>-Footnote-12709199 +Ref: Porting to Python 3 11<2>-Footnote-13709242 +Ref: Porting to Python 3 11<2>-Footnote-14709308 +Ref: Porting to Python 3 11<2>-Footnote-15709374 +Ref: Porting to Python 3 11<2>-Footnote-16709440 +Ref: Porting to Python 3 11<2>-Footnote-17709506 +Ref: Porting to Python 3 11<2>-Footnote-18709572 +Ref: Porting to Python 3 11<2>-Footnote-19709638 +Ref: Porting to Python 3 11<2>-Footnote-20709694 +Ref: Porting to Python 3 11<2>-Footnote-21709747 +Ref: Porting to Python 3 11<2>-Footnote-22709813 +Ref: Porting to Python 3 11<2>-Footnote-23709879 +Ref: Porting to Python 3 11<2>-Footnote-24709932 +Node: Deprecated<4>709965 +Ref: whatsnew/3 11 id7710107 +Ref: 78c710107 +Ref: whatsnew/3 11 whatsnew311-c-api-deprecated710107 +Ref: 712710107 +Ref: Deprecated<4>-Footnote-1711076 +Ref: Deprecated<4>-Footnote-2711118 +Ref: Deprecated<4>-Footnote-3711173 +Node: Pending Removal in Python 3 12<2>711238 +Ref: whatsnew/3 11 id8711365 +Ref: 78e711365 +Ref: whatsnew/3 11 whatsnew311-c-api-pending-removal711365 +Ref: 724711365 +Node: Removed<4>712115 +Ref: whatsnew/3 11 id9712220 +Ref: 790712220 +Ref: whatsnew/3 11 whatsnew311-c-api-removed712220 +Ref: 72b712220 +Ref: whatsnew/3 11 whatsnew311-pep624714480 +Ref: 5a9714480 +Ref: Removed<4>-Footnote-1715420 +Ref: Removed<4>-Footnote-2715485 +Ref: Removed<4>-Footnote-3715550 +Ref: Removed<4>-Footnote-4715615 +Ref: Removed<4>-Footnote-5715680 +Ref: Removed<4>-Footnote-6715745 +Ref: Removed<4>-Footnote-7715810 +Ref: Removed<4>-Footnote-8715875 +Ref: Removed<4>-Footnote-9715940 +Ref: Removed<4>-Footnote-10716005 +Ref: Removed<4>-Footnote-11716048 +Ref: Removed<4>-Footnote-12716108 +Node: Notable changes in 3 11 4716174 +Ref: whatsnew/3 11 notable-changes-in-3-11-4716322 +Ref: 796716322 +Node: tarfile<2>716422 +Ref: whatsnew/3 11 tarfile716494 +Ref: 797716494 +Ref: tarfile<2>-Footnote-1717098 +Node: Notable changes in 3 11 5717140 +Ref: whatsnew/3 11 notable-changes-in-3-11-5717263 +Ref: 798717263 +Node: OpenSSL717352 +Ref: whatsnew/3 11 openssl717421 +Ref: 799717421 +Node: What’s New In Python 3 10717540 +Ref: whatsnew/3 10 doc717697 +Ref: 79a717697 +Ref: whatsnew/3 10 what-s-new-in-python-3-10717697 +Ref: 79b717697 +Node: Summary – Release highlights<3>718743 +Ref: whatsnew/3 10 summary-release-highlights718864 +Ref: 79c718864 +Ref: Summary – Release highlights<3>-Footnote-1720017 +Ref: Summary – Release highlights<3>-Footnote-2720059 +Ref: Summary – Release highlights<3>-Footnote-3720101 +Ref: Summary – Release highlights<3>-Footnote-4720143 +Ref: Summary – Release highlights<3>-Footnote-5720208 +Ref: Summary – Release highlights<3>-Footnote-6720250 +Ref: Summary – Release highlights<3>-Footnote-7720292 +Ref: Summary – Release highlights<3>-Footnote-8720334 +Ref: Summary – Release highlights<3>-Footnote-9720376 +Ref: Summary – Release highlights<3>-Footnote-10720418 +Ref: Summary – Release highlights<3>-Footnote-11720461 +Ref: Summary – Release highlights<3>-Footnote-12720504 +Ref: Summary – Release highlights<3>-Footnote-13720547 +Ref: Summary – Release highlights<3>-Footnote-14720590 +Ref: Summary – Release highlights<3>-Footnote-15720633 +Node: New Features<7>720676 +Ref: whatsnew/3 10 new-features720843 +Ref: 79d720843 +Node: Parenthesized context managers721211 +Ref: whatsnew/3 10 parenthesized-context-managers721323 +Ref: 79e721323 +Ref: whatsnew/3 10 whatsnew310-pep563721323 +Ref: 79f721323 +Ref: Parenthesized context managers-Footnote-1722567 +Ref: Parenthesized context managers-Footnote-2722609 +Ref: Parenthesized context managers-Footnote-3722674 +Node: Better error messages722739 +Ref: whatsnew/3 10 better-error-messages722918 +Ref: 7a0722918 +Node: SyntaxErrors723063 +Ref: whatsnew/3 10 syntaxerrors723159 +Ref: 7a1723159 +Ref: SyntaxErrors-Footnote-1728496 +Ref: SyntaxErrors-Footnote-2728561 +Ref: SyntaxErrors-Footnote-3728626 +Ref: SyntaxErrors-Footnote-4728691 +Ref: SyntaxErrors-Footnote-5728756 +Ref: SyntaxErrors-Footnote-6728821 +Ref: SyntaxErrors-Footnote-7728886 +Ref: SyntaxErrors-Footnote-8728951 +Ref: SyntaxErrors-Footnote-9729016 +Ref: SyntaxErrors-Footnote-10729081 +Ref: SyntaxErrors-Footnote-11729147 +Node: IndentationErrors729213 +Ref: whatsnew/3 10 indentationerrors729333 +Ref: 7a2729333 +Node: AttributeErrors729750 +Ref: whatsnew/3 10 attributeerrors729868 +Ref: 7a4729868 +Ref: AttributeErrors-Footnote-1730621 +Node: NameErrors730686 +Ref: whatsnew/3 10 nameerrors730778 +Ref: 7a5730778 +Ref: NameErrors-Footnote-1731591 +Node: PEP 626 Precise line numbers for debugging and other tools731656 +Ref: whatsnew/3 10 pep-626-precise-line-numbers-for-debugging-and-other-tools731840 +Ref: 7a6731840 +Node: PEP 634 Structural Pattern Matching732535 +Ref: whatsnew/3 10 pep-634-structural-pattern-matching732751 +Ref: 7a8732751 +Node: Syntax and operations733538 +Ref: whatsnew/3 10 syntax-and-operations733660 +Ref: 7a9733660 +Node: Declarative approach734726 +Ref: whatsnew/3 10 declarative-approach734890 +Ref: 7aa734890 +Node: Simple pattern match to a literal736069 +Ref: whatsnew/3 10 simple-pattern-match-to-a-literal736248 +Ref: 7ab736248 +Node: Behavior without the wildcard737623 +Ref: whatsnew/3 10 behavior-without-the-wildcard737722 +Ref: 7ac737722 +Node: Patterns with a literal and variable738304 +Ref: whatsnew/3 10 patterns-with-a-literal-and-variable738483 +Ref: 7ad738483 +Node: Patterns and classes739451 +Ref: whatsnew/3 10 patterns-and-classes739612 +Ref: 7ae739612 +Node: Patterns with positional parameters740551 +Ref: whatsnew/3 10 patterns-with-positional-parameters740643 +Ref: 7af740643 +Node: Nested patterns741232 +Ref: whatsnew/3 10 nested-patterns741390 +Ref: 7b0741390 +Node: Complex patterns and the wildcard742029 +Ref: whatsnew/3 10 complex-patterns-and-the-wildcard742172 +Ref: 7b1742172 +Node: Guard742746 +Ref: whatsnew/3 10 guard742892 +Ref: 7b2742892 +Node: Other Key Features743336 +Ref: whatsnew/3 10 other-key-features743440 +Ref: 7b3743440 +Ref: Other Key Features-Footnote-1745612 +Ref: Other Key Features-Footnote-2745654 +Ref: Other Key Features-Footnote-3745696 +Node: Optional EncodingWarning and encoding="locale" option745738 +Ref: whatsnew/3 10 optional-encodingwarning-and-encoding-locale-option745887 +Ref: 7b4745887 +Ref: whatsnew/3 10 whatsnew310-pep597745887 +Ref: 7b5745887 +Node: New Features Related to Type Hints<3>746787 +Ref: whatsnew/3 10 new-feat-related-type-hints746946 +Ref: 7b9746946 +Ref: whatsnew/3 10 new-features-related-to-type-hints746946 +Ref: 7ba746946 +Ref: New Features Related to Type Hints<3>-Footnote-1747447 +Node: PEP 604 New Type Union Operator747489 +Ref: whatsnew/3 10 pep-604-new-type-union-operator747644 +Ref: 7bb747644 +Ref: PEP 604 New Type Union Operator-Footnote-1748718 +Ref: PEP 604 New Type Union Operator-Footnote-2748760 +Ref: PEP 604 New Type Union Operator-Footnote-3748825 +Node: PEP 612 Parameter Specification Variables748890 +Ref: whatsnew/3 10 pep-612-parameter-specification-variables749071 +Ref: 7be749071 +Ref: PEP 612 Parameter Specification Variables-Footnote-1750358 +Ref: PEP 612 Parameter Specification Variables-Footnote-2750400 +Ref: PEP 612 Parameter Specification Variables-Footnote-3750442 +Ref: PEP 612 Parameter Specification Variables-Footnote-4750507 +Node: PEP 613 TypeAlias750572 +Ref: whatsnew/3 10 pep-613-typealias750754 +Ref: 7c3750754 +Ref: PEP 613 TypeAlias-Footnote-1751582 +Ref: PEP 613 TypeAlias-Footnote-2751624 +Ref: PEP 613 TypeAlias-Footnote-3751666 +Node: PEP 647 User-Defined Type Guards751731 +Ref: whatsnew/3 10 pep-647-user-defined-type-guards751863 +Ref: 7c5751863 +Ref: PEP 647 User-Defined Type Guards-Footnote-1752351 +Ref: PEP 647 User-Defined Type Guards-Footnote-2752393 +Node: Other Language Changes<4>752458 +Ref: whatsnew/3 10 other-language-changes752616 +Ref: 7c6752616 +Ref: Other Language Changes<4>-Footnote-1757300 +Ref: Other Language Changes<4>-Footnote-2757365 +Ref: Other Language Changes<4>-Footnote-3757430 +Ref: Other Language Changes<4>-Footnote-4757472 +Ref: Other Language Changes<4>-Footnote-5757537 +Ref: Other Language Changes<4>-Footnote-6757602 +Ref: Other Language Changes<4>-Footnote-7757667 +Ref: Other Language Changes<4>-Footnote-8757732 +Ref: Other Language Changes<4>-Footnote-9757797 +Ref: Other Language Changes<4>-Footnote-10757839 +Ref: Other Language Changes<4>-Footnote-11757905 +Ref: Other Language Changes<4>-Footnote-12757971 +Ref: Other Language Changes<4>-Footnote-13758037 +Ref: Other Language Changes<4>-Footnote-14758103 +Ref: Other Language Changes<4>-Footnote-15758169 +Ref: Other Language Changes<4>-Footnote-16758235 +Node: New Modules<4>758301 +Ref: whatsnew/3 10 new-modules758441 +Ref: 7d6758441 +Node: Improved Modules<4>758490 +Ref: whatsnew/3 10 improved-modules758621 +Ref: 7d7758621 +Node: asyncio<4>759730 +Ref: whatsnew/3 10 asyncio759816 +Ref: 7d8759816 +Ref: asyncio<4>-Footnote-1759988 +Node: argparse<2>760053 +Ref: whatsnew/3 10 argparse760156 +Ref: 7d9760156 +Ref: argparse<2>-Footnote-1760446 +Node: array<3>760510 +Ref: whatsnew/3 10 array760626 +Ref: 7da760626 +Ref: array<3>-Footnote-1760868 +Node: asynchat asyncore smtpd760933 +Ref: whatsnew/3 10 asynchat-asyncore-smtpd761047 +Ref: 7dc761047 +Node: base64<2>761307 +Ref: whatsnew/3 10 base64761416 +Ref: 7dd761416 +Node: bdb761583 +Ref: whatsnew/3 10 bdb761675 +Ref: 7e0761675 +Ref: bdb-Footnote-1761844 +Node: bisect761909 +Ref: whatsnew/3 10 bisect761998 +Ref: 7e1761998 +Ref: bisect-Footnote-1762215 +Node: codecs762279 +Ref: whatsnew/3 10 codecs762380 +Ref: 7e2762380 +Ref: codecs-Footnote-1762577 +Node: collections abc762642 +Ref: whatsnew/3 10 collections-abc762750 +Ref: 7e4762750 +Ref: collections abc-Footnote-1763671 +Node: contextlib<2>763736 +Ref: whatsnew/3 10 contextlib763844 +Ref: 7e7763844 +Ref: contextlib<2>-Footnote-1764366 +Ref: contextlib<2>-Footnote-2764431 +Node: curses764496 +Ref: whatsnew/3 10 curses764603 +Ref: 7eb764603 +Ref: curses-Footnote-1765300 +Ref: curses-Footnote-2765365 +Node: dataclasses<2>765430 +Ref: whatsnew/3 10 dataclasses765536 +Ref: 7f1765536 +Node: __slots__765627 +Ref: whatsnew/3 10 slots765715 +Ref: 7f2765715 +Ref: __slots__-Footnote-1765917 +Node: Keyword-only fields765982 +Ref: whatsnew/3 10 keyword-only-fields766070 +Ref: 7f3766070 +Ref: Keyword-only fields-Footnote-1767543 +Node: distutils<2>767608 +Ref: whatsnew/3 10 distutils767718 +Ref: 7f4767718 +Ref: whatsnew/3 10 distutils-deprecated767718 +Ref: 725767718 +Ref: distutils<2>-Footnote-1768626 +Ref: distutils<2>-Footnote-2768668 +Node: doctest<2>768733 +Ref: whatsnew/3 10 doctest768838 +Ref: 7f5768838 +Ref: doctest<2>-Footnote-1769042 +Node: encodings769107 +Ref: whatsnew/3 10 encodings769207 +Ref: 7f6769207 +Ref: encodings-Footnote-1769403 +Node: enum<4>769468 +Ref: whatsnew/3 10 enum769567 +Ref: 7f8769567 +Ref: enum<4>-Footnote-1770040 +Ref: enum<4>-Footnote-2770105 +Node: fileinput770170 +Ref: whatsnew/3 10 fileinput770272 +Ref: 7fa770272 +Ref: fileinput-Footnote-1770707 +Ref: fileinput-Footnote-2770772 +Node: faulthandler770836 +Ref: whatsnew/3 10 faulthandler770933 +Ref: 7fd770933 +Ref: faulthandler-Footnote-1771175 +Node: gc771240 +Ref: whatsnew/3 10 gc771335 +Ref: 7fe771335 +Ref: gc-Footnote-1771560 +Node: glob<2>771625 +Ref: whatsnew/3 10 glob771718 +Ref: 802771718 +Ref: glob<2>-Footnote-1771982 +Node: hashlib<3>772047 +Ref: whatsnew/3 10 hashlib772142 +Ref: 804772142 +Ref: hashlib<3>-Footnote-1772685 +Ref: hashlib<3>-Footnote-2772727 +Ref: hashlib<3>-Footnote-3772792 +Ref: hashlib<3>-Footnote-4772857 +Node: hmac772922 +Ref: whatsnew/3 10 hmac773029 +Ref: 805773029 +Ref: hmac-Footnote-1773215 +Node: IDLE and idlelib<2>773280 +Ref: whatsnew/3 10 idle-and-idlelib773398 +Ref: 806773398 +Ref: IDLE and idlelib<2>-Footnote-1775488 +Ref: IDLE and idlelib<2>-Footnote-2775553 +Ref: IDLE and idlelib<2>-Footnote-3775618 +Ref: IDLE and idlelib<2>-Footnote-4775683 +Ref: IDLE and idlelib<2>-Footnote-5775748 +Ref: IDLE and idlelib<2>-Footnote-6775813 +Ref: IDLE and idlelib<2>-Footnote-7775878 +Ref: IDLE and idlelib<2>-Footnote-8775943 +Node: importlib metadata<2>775998 +Ref: whatsnew/3 10 importlib-metadata776122 +Ref: 80b776122 +Ref: importlib metadata<2>-Footnote-1776716 +Node: inspect<3>776789 +Ref: whatsnew/3 10 inspect776906 +Ref: 80e776906 +Ref: inspect<3>-Footnote-1778109 +Ref: inspect<3>-Footnote-2778174 +Node: itertools<3>778239 +Ref: whatsnew/3 10 itertools778344 +Ref: 810778344 +Ref: itertools<3>-Footnote-1778510 +Node: linecache778575 +Ref: whatsnew/3 10 linecache778675 +Ref: 812778675 +Ref: linecache-Footnote-1778883 +Node: os<4>778948 +Ref: whatsnew/3 10 os779046 +Ref: 813779046 +Ref: os<4>-Footnote-1779785 +Ref: os<4>-Footnote-2779850 +Ref: os<4>-Footnote-3779915 +Ref: os<4>-Footnote-4779980 +Node: os path<4>780045 +Ref: whatsnew/3 10 os-path780144 +Ref: 81a780144 +Ref: os path<4>-Footnote-1780455 +Node: pathlib<5>780520 +Ref: whatsnew/3 10 pathlib780625 +Ref: 81b780625 +Ref: pathlib<5>-Footnote-1781334 +Ref: pathlib<5>-Footnote-2781399 +Ref: pathlib<5>-Footnote-3781464 +Ref: pathlib<5>-Footnote-4781529 +Node: platform<2>781594 +Ref: whatsnew/3 10 platform781695 +Ref: 821781695 +Ref: platform<2>-Footnote-1781964 +Ref: platform<2>-Footnote-2782037 +Node: pprint782102 +Ref: whatsnew/3 10 pprint782203 +Ref: 823782203 +Ref: pprint-Footnote-1782537 +Ref: pprint-Footnote-2782602 +Node: py_compile782667 +Ref: whatsnew/3 10 py-compile782763 +Ref: 825782763 +Ref: py_compile-Footnote-1782971 +Node: pyclbr783036 +Ref: whatsnew/3 10 pyclbr783132 +Ref: 826783132 +Ref: pyclbr-Footnote-1783476 +Node: shelve783541 +Ref: whatsnew/3 10 shelve783640 +Ref: 829783640 +Ref: shelve-Footnote-1783913 +Node: statistics<3>783978 +Ref: whatsnew/3 10 statistics784078 +Ref: 82b784078 +Ref: statistics<3>-Footnote-1784333 +Node: site<2>784398 +Ref: whatsnew/3 10 site784501 +Ref: 82e784501 +Ref: site<2>-Footnote-1784699 +Node: socket<2>784764 +Ref: whatsnew/3 10 socket784860 +Ref: 82f784860 +Ref: socket<2>-Footnote-1785306 +Ref: socket<2>-Footnote-2785371 +Ref: socket<2>-Footnote-3785436 +Node: ssl<3>785501 +Ref: whatsnew/3 10 ssl785600 +Ref: 832785600 +Ref: ssl<3>-Footnote-1787441 +Ref: ssl<3>-Footnote-2787483 +Ref: ssl<3>-Footnote-3787548 +Ref: ssl<3>-Footnote-4787613 +Ref: ssl<3>-Footnote-5787678 +Ref: ssl<3>-Footnote-6787743 +Ref: ssl<3>-Footnote-7787808 +Ref: ssl<3>-Footnote-8787873 +Ref: ssl<3>-Footnote-9787938 +Ref: ssl<3>-Footnote-10788003 +Ref: ssl<3>-Footnote-11788069 +Ref: ssl<3>-Footnote-12788135 +Ref: ssl<3>-Footnote-13788201 +Ref: ssl<3>-Footnote-14788267 +Ref: ssl<3>-Footnote-15788333 +Node: sqlite3<5>788399 +Ref: whatsnew/3 10 sqlite3788495 +Ref: 839788495 +Ref: sqlite3<5>-Footnote-1788734 +Node: sys<5>788799 +Ref: whatsnew/3 10 sys788896 +Ref: 83b788896 +Ref: sys<5>-Footnote-1789281 +Ref: sys<5>-Footnote-2789346 +Node: _thread789411 +Ref: whatsnew/3 10 thread789510 +Ref: 83e789510 +Ref: _thread-Footnote-1789766 +Node: threading<3>789831 +Ref: whatsnew/3 10 threading789936 +Ref: 841789936 +Ref: threading<3>-Footnote-1790478 +Ref: threading<3>-Footnote-2790543 +Node: traceback<3>790608 +Ref: whatsnew/3 10 traceback790714 +Ref: 848790714 +Ref: traceback<3>-Footnote-1791042 +Node: types<3>791107 +Ref: whatsnew/3 10 types791210 +Ref: 84c791210 +Ref: types<3>-Footnote-1791519 +Node: typing<5>791584 +Ref: whatsnew/3 10 typing791686 +Ref: 850791686 +Ref: typing<5>-Footnote-1793906 +Ref: typing<5>-Footnote-2793948 +Ref: typing<5>-Footnote-3794013 +Ref: typing<5>-Footnote-4794078 +Ref: typing<5>-Footnote-5794143 +Node: unittest<5>794208 +Ref: whatsnew/3 10 unittest794314 +Ref: 853794314 +Ref: unittest<5>-Footnote-1794530 +Node: urllib parse794595 +Ref: whatsnew/3 10 urllib-parse794698 +Ref: 856794698 +Ref: urllib parse-Footnote-1795847 +Ref: urllib parse-Footnote-2795912 +Ref: urllib parse-Footnote-3795971 +Node: xml<2>796026 +Ref: whatsnew/3 10 xml796130 +Ref: 857796130 +Ref: xml<2>-Footnote-1796346 +Node: zipimport<3>796411 +Ref: whatsnew/3 10 zipimport796494 +Ref: 859796494 +Ref: zipimport<3>-Footnote-1796874 +Ref: zipimport<3>-Footnote-2796916 +Ref: zipimport<3>-Footnote-3796981 +Node: Optimizations<4>797046 +Ref: whatsnew/3 10 optimizations797176 +Ref: 85d797176 +Ref: Optimizations<4>-Footnote-1800668 +Ref: Optimizations<4>-Footnote-2800733 +Ref: Optimizations<4>-Footnote-3800798 +Ref: Optimizations<4>-Footnote-4800863 +Ref: Optimizations<4>-Footnote-5800928 +Ref: Optimizations<4>-Footnote-6800993 +Ref: Optimizations<4>-Footnote-7801114 +Ref: Optimizations<4>-Footnote-8801179 +Ref: Optimizations<4>-Footnote-9801244 +Ref: Optimizations<4>-Footnote-10801309 +Ref: Optimizations<4>-Footnote-11801375 +Ref: Optimizations<4>-Footnote-12801441 +Ref: Optimizations<4>-Footnote-13801484 +Ref: Optimizations<4>-Footnote-14801550 +Ref: Optimizations<4>-Footnote-15801616 +Ref: Optimizations<4>-Footnote-16801682 +Ref: Optimizations<4>-Footnote-17801748 +Ref: Optimizations<4>-Footnote-18801814 +Node: Deprecated<5>801880 +Ref: whatsnew/3 10 deprecated802001 +Ref: 864802001 +Ref: whatsnew/3 10 whatsnew310-deprecated802001 +Ref: 837802001 +Ref: Deprecated<5>-Footnote-1811416 +Ref: Deprecated<5>-Footnote-2811481 +Ref: Deprecated<5>-Footnote-3811546 +Ref: Deprecated<5>-Footnote-4811611 +Ref: Deprecated<5>-Footnote-5811676 +Ref: Deprecated<5>-Footnote-6811741 +Ref: Deprecated<5>-Footnote-7811806 +Ref: Deprecated<5>-Footnote-8811871 +Ref: Deprecated<5>-Footnote-9811936 +Ref: Deprecated<5>-Footnote-10812001 +Ref: Deprecated<5>-Footnote-11812067 +Ref: Deprecated<5>-Footnote-12812133 +Ref: Deprecated<5>-Footnote-13812199 +Ref: Deprecated<5>-Footnote-14812265 +Ref: Deprecated<5>-Footnote-15812324 +Ref: Deprecated<5>-Footnote-16812390 +Ref: Deprecated<5>-Footnote-17812446 +Ref: Deprecated<5>-Footnote-18812512 +Ref: Deprecated<5>-Footnote-19812578 +Ref: Deprecated<5>-Footnote-20812644 +Node: Removed<5>812710 +Ref: whatsnew/3 10 removed812837 +Ref: 872812837 +Ref: whatsnew/3 10 whatsnew310-removed812837 +Ref: 873812837 +Ref: Removed<5>-Footnote-1816077 +Ref: Removed<5>-Footnote-2816142 +Ref: Removed<5>-Footnote-3816207 +Ref: Removed<5>-Footnote-4816272 +Ref: Removed<5>-Footnote-5816337 +Ref: Removed<5>-Footnote-6816402 +Ref: Removed<5>-Footnote-7816467 +Node: Porting to Python 3 10816532 +Ref: whatsnew/3 10 porting-to-python-3-10816673 +Ref: 878816673 +Node: Changes in the Python syntax816992 +Ref: whatsnew/3 10 changes-in-the-python-syntax817116 +Ref: 879817116 +Ref: Changes in the Python syntax-Footnote-1817711 +Node: Changes in the Python API<3>817776 +Ref: whatsnew/3 10 changes-in-the-python-api817932 +Ref: 87a817932 +Ref: whatsnew/3 10 changes-python-api817932 +Ref: 877817932 +Ref: Changes in the Python API<3>-Footnote-1820860 +Ref: Changes in the Python API<3>-Footnote-2820925 +Ref: Changes in the Python API<3>-Footnote-3820990 +Ref: Changes in the Python API<3>-Footnote-4821055 +Ref: Changes in the Python API<3>-Footnote-5821120 +Ref: Changes in the Python API<3>-Footnote-6821185 +Node: Changes in the C API<2>821250 +Ref: whatsnew/3 10 changes-in-the-c-api821369 +Ref: 882821369 +Node: CPython bytecode changes<3>823841 +Ref: whatsnew/3 10 cpython-bytecode-changes823988 +Ref: 888823988 +Ref: CPython bytecode changes<3>-Footnote-1824287 +Node: Build Changes<4>824352 +Ref: whatsnew/3 10 build-changes824493 +Ref: 889824493 +Ref: Build Changes<4>-Footnote-1826957 +Ref: Build Changes<4>-Footnote-2826999 +Ref: Build Changes<4>-Footnote-3827064 +Ref: Build Changes<4>-Footnote-4827129 +Ref: Build Changes<4>-Footnote-5827194 +Ref: Build Changes<4>-Footnote-6827259 +Ref: Build Changes<4>-Footnote-7827324 +Ref: Build Changes<4>-Footnote-8827389 +Ref: Build Changes<4>-Footnote-9827454 +Ref: Build Changes<4>-Footnote-10827519 +Ref: Build Changes<4>-Footnote-11827585 +Node: C API Changes<4>827651 +Ref: whatsnew/3 10 c-api-changes827799 +Ref: 88e827799 +Node: PEP 652 Maintaining the Stable ABI828065 +Ref: whatsnew/3 10 pep-652-maintaining-the-stable-abi828176 +Ref: 88f828176 +Ref: PEP 652 Maintaining the Stable ABI-Footnote-1828609 +Ref: PEP 652 Maintaining the Stable ABI-Footnote-2828651 +Node: New Features<8>828716 +Ref: whatsnew/3 10 id1828861 +Ref: 890828861 +Ref: New Features<8>-Footnote-1833488 +Ref: New Features<8>-Footnote-2833553 +Ref: New Features<8>-Footnote-3833618 +Ref: New Features<8>-Footnote-4833683 +Ref: New Features<8>-Footnote-5833748 +Ref: New Features<8>-Footnote-6833813 +Ref: New Features<8>-Footnote-7833878 +Ref: New Features<8>-Footnote-8833945 +Ref: New Features<8>-Footnote-9834010 +Ref: New Features<8>-Footnote-10834075 +Ref: New Features<8>-Footnote-11834141 +Ref: New Features<8>-Footnote-12834207 +Ref: New Features<8>-Footnote-13834273 +Ref: New Features<8>-Footnote-14834339 +Ref: New Features<8>-Footnote-15834405 +Ref: New Features<8>-Footnote-16834471 +Ref: New Features<8>-Footnote-17834537 +Ref: New Features<8>-Footnote-18834603 +Node: Porting to Python 3 10<2>834669 +Ref: whatsnew/3 10 id2834793 +Ref: 8a5834793 +Ref: Porting to Python 3 10<2>-Footnote-1838479 +Ref: Porting to Python 3 10<2>-Footnote-2838521 +Ref: Porting to Python 3 10<2>-Footnote-3838586 +Ref: Porting to Python 3 10<2>-Footnote-4838651 +Ref: Porting to Python 3 10<2>-Footnote-5838716 +Ref: Porting to Python 3 10<2>-Footnote-6838781 +Ref: Porting to Python 3 10<2>-Footnote-7838846 +Ref: Porting to Python 3 10<2>-Footnote-8838911 +Ref: Porting to Python 3 10<2>-Footnote-9838976 +Ref: Porting to Python 3 10<2>-Footnote-10839041 +Ref: Porting to Python 3 10<2>-Footnote-11839107 +Node: Deprecated<6>839173 +Ref: whatsnew/3 10 id3839292 +Ref: 8af839292 +Ref: Deprecated<6>-Footnote-1839591 +Node: Removed<6>839656 +Ref: whatsnew/3 10 id4839741 +Ref: 8b1839741 +Ref: Removed<6>-Footnote-1844745 +Ref: Removed<6>-Footnote-2844810 +Ref: Removed<6>-Footnote-3844852 +Ref: Removed<6>-Footnote-4844917 +Ref: Removed<6>-Footnote-5844982 +Ref: Removed<6>-Footnote-6845047 +Ref: Removed<6>-Footnote-7845112 +Ref: Removed<6>-Footnote-8845177 +Ref: Removed<6>-Footnote-9845242 +Ref: Removed<6>-Footnote-10845284 +Ref: Removed<6>-Footnote-11845350 +Ref: Removed<6>-Footnote-12845416 +Ref: Removed<6>-Footnote-13845482 +Ref: Removed<6>-Footnote-14845548 +Ref: Removed<6>-Footnote-15845614 +Ref: Removed<6>-Footnote-16845680 +Node: Notable security feature in 3 10 7845746 +Ref: whatsnew/3 10 notable-security-feature-in-3-10-7845912 +Ref: 8be845912 +Ref: Notable security feature in 3 10 7-Footnote-1846642 +Node: Notable security feature in 3 10 8846698 +Ref: whatsnew/3 10 notable-security-feature-in-3-10-8846874 +Ref: 8bf846874 +Ref: Notable security feature in 3 10 8-Footnote-1847296 +Node: Notable changes in 3 10 12847351 +Ref: whatsnew/3 10 notable-changes-in-3-10-12847484 +Ref: 8c0847484 +Node: tarfile<3>847586 +Ref: whatsnew/3 10 tarfile847659 +Ref: 8c1847659 +Ref: tarfile<3>-Footnote-1848263 +Node: What’s New In Python 3 9848305 +Ref: whatsnew/3 9 doc848461 +Ref: 8c2848461 +Ref: whatsnew/3 9 what-s-new-in-python-3-9848461 +Ref: 8c3848461 +Ref: What’s New In Python 3 9-Footnote-1849709 +Node: Summary – Release highlights<4>849751 +Ref: whatsnew/3 9 summary-release-highlights849908 +Ref: 8c4849908 +Ref: Summary – Release highlights<4>-Footnote-1851862 +Ref: Summary – Release highlights<4>-Footnote-2851904 +Ref: Summary – Release highlights<4>-Footnote-3851946 +Ref: Summary – Release highlights<4>-Footnote-4851988 +Ref: Summary – Release highlights<4>-Footnote-5852030 +Ref: Summary – Release highlights<4>-Footnote-6852072 +Ref: Summary – Release highlights<4>-Footnote-7852114 +Ref: Summary – Release highlights<4>-Footnote-8852156 +Ref: Summary – Release highlights<4>-Footnote-9852198 +Ref: Summary – Release highlights<4>-Footnote-10852240 +Node: You should check for DeprecationWarning in your code852283 +Ref: whatsnew/3 9 you-should-check-for-deprecationwarning-in-your-code852464 +Ref: 8c5852464 +Node: New Features<9>854154 +Ref: whatsnew/3 9 new-features854327 +Ref: 8cb854327 +Node: Dictionary Merge & Update Operators854536 +Ref: whatsnew/3 9 dictionary-merge-update-operators854682 +Ref: 8cc854682 +Ref: Dictionary Merge & Update Operators-Footnote-1855437 +Ref: Dictionary Merge & Update Operators-Footnote-2855479 +Node: New String Methods to Remove Prefixes and Suffixes855544 +Ref: whatsnew/3 9 new-string-methods-to-remove-prefixes-and-suffixes855744 +Ref: 8cd855744 +Ref: New String Methods to Remove Prefixes and Suffixes-Footnote-1856255 +Ref: New String Methods to Remove Prefixes and Suffixes-Footnote-2856297 +Node: Type Hinting Generics in Standard Collections856362 +Ref: whatsnew/3 9 type-hinting-generics-in-standard-collections856537 +Ref: 8d0856537 +Ref: Type Hinting Generics in Standard Collections-Footnote-1857239 +Ref: Type Hinting Generics in Standard Collections-Footnote-2857281 +Node: New Parser857346 +Ref: whatsnew/3 9 new-parser857462 +Ref: 8d1857462 +Ref: New Parser-Footnote-1858397 +Ref: New Parser-Footnote-2858462 +Ref: New Parser-Footnote-3858510 +Ref: New Parser-Footnote-4858552 +Node: Other Language Changes<5>858617 +Ref: whatsnew/3 9 other-language-changes858752 +Ref: 8d2858752 +Ref: Other Language Changes<5>-Footnote-1861858 +Ref: Other Language Changes<5>-Footnote-2861923 +Ref: Other Language Changes<5>-Footnote-3861988 +Ref: Other Language Changes<5>-Footnote-4862053 +Ref: Other Language Changes<5>-Footnote-5862118 +Ref: Other Language Changes<5>-Footnote-6862160 +Ref: Other Language Changes<5>-Footnote-7862225 +Ref: Other Language Changes<5>-Footnote-8862290 +Ref: Other Language Changes<5>-Footnote-9862355 +Ref: Other Language Changes<5>-Footnote-10862420 +Ref: Other Language Changes<5>-Footnote-11862486 +Node: New Modules<5>862552 +Ref: whatsnew/3 9 new-modules862691 +Ref: 8dc862691 +Node: zoneinfo862764 +Ref: whatsnew/3 9 zoneinfo862840 +Ref: 8dd862840 +Ref: zoneinfo-Footnote-1863948 +Ref: zoneinfo-Footnote-2863989 +Node: graphlib864031 +Ref: whatsnew/3 9 graphlib864107 +Ref: 8df864107 +Ref: graphlib-Footnote-1864431 +Node: Improved Modules<5>864496 +Ref: whatsnew/3 9 improved-modules864626 +Ref: 8e1864626 +Node: ast<2>865441 +Ref: whatsnew/3 9 ast865522 +Ref: 8e2865522 +Ref: ast<2>-Footnote-1866190 +Ref: ast<2>-Footnote-2866255 +Ref: ast<2>-Footnote-3866320 +Node: asyncio<5>866385 +Ref: whatsnew/3 9 asyncio866488 +Ref: 8e5866488 +Ref: asyncio<5>-Footnote-1868215 +Ref: asyncio<5>-Footnote-2868280 +Ref: asyncio<5>-Footnote-3868345 +Ref: asyncio<5>-Footnote-4868410 +Ref: asyncio<5>-Footnote-5868475 +Ref: asyncio<5>-Footnote-6868540 +Node: compileall<2>868605 +Ref: whatsnew/3 9 compileall868723 +Ref: 8ea868723 +Ref: compileall<2>-Footnote-1869313 +Ref: compileall<2>-Footnote-2869378 +Node: concurrent futures<2>869443 +Ref: whatsnew/3 9 concurrent-futures869560 +Ref: 8eb869560 +Ref: concurrent futures<2>-Footnote-1870439 +Ref: concurrent futures<2>-Footnote-2870504 +Ref: concurrent futures<2>-Footnote-3870569 +Node: curses<2>870634 +Ref: whatsnew/3 9 curses870749 +Ref: 8ee870749 +Ref: curses<2>-Footnote-1871023 +Node: datetime<2>871088 +Ref: whatsnew/3 9 datetime871194 +Ref: 8f3871194 +Ref: datetime<2>-Footnote-1871512 +Node: distutils<3>871577 +Ref: whatsnew/3 9 distutils871682 +Ref: 8f6871682 +Ref: distutils<3>-Footnote-1871933 +Node: fcntl<2>871998 +Ref: whatsnew/3 9 fcntl872101 +Ref: 8f7872101 +Ref: fcntl<2>-Footnote-1872308 +Node: ftplib<2>872373 +Ref: whatsnew/3 9 ftplib872469 +Ref: 8f8872469 +Ref: ftplib<2>-Footnote-1872759 +Node: gc<2>872824 +Ref: whatsnew/3 9 gc872922 +Ref: 8fb872922 +Ref: gc<2>-Footnote-1873460 +Ref: gc<2>-Footnote-2873525 +Node: hashlib<4>873590 +Ref: whatsnew/3 9 hashlib873683 +Ref: 8fd873683 +Ref: hashlib<4>-Footnote-1874192 +Ref: hashlib<4>-Footnote-2874257 +Node: http874322 +Ref: whatsnew/3 9 http874429 +Ref: 8fe874429 +Ref: http-Footnote-1874701 +Ref: http-Footnote-2874766 +Node: IDLE and idlelib<3>874831 +Ref: whatsnew/3 9 idle-and-idlelib874935 +Ref: 900874935 +Ref: IDLE and idlelib<3>-Footnote-1876147 +Ref: IDLE and idlelib<3>-Footnote-2876211 +Ref: IDLE and idlelib<3>-Footnote-3876276 +Ref: IDLE and idlelib<3>-Footnote-4876341 +Ref: IDLE and idlelib<3>-Footnote-5876406 +Ref: IDLE and idlelib<3>-Footnote-6876471 +Ref: IDLE and idlelib<3>-Footnote-7876536 +Node: imaplib876601 +Ref: whatsnew/3 9 imaplib876713 +Ref: 901876713 +Ref: imaplib-Footnote-1877549 +Ref: imaplib-Footnote-2877614 +Node: importlib<3>877679 +Ref: whatsnew/3 9 importlib877782 +Ref: 908877782 +Ref: importlib<3>-Footnote-1878574 +Ref: importlib<3>-Footnote-2878639 +Ref: importlib<3>-Footnote-3878704 +Node: inspect<4>878769 +Ref: whatsnew/3 9 inspect878877 +Ref: 90a878877 +Ref: inspect<4>-Footnote-1879109 +Ref: inspect<4>-Footnote-2879174 +Node: ipaddress<2>879239 +Ref: whatsnew/3 9 ipaddress879342 +Ref: 90c879342 +Ref: ipaddress<2>-Footnote-1879907 +Ref: ipaddress<2>-Footnote-2879972 +Node: math<4>880037 +Ref: whatsnew/3 9 math880148 +Ref: 90e880148 +Ref: math<4>-Footnote-1880864 +Ref: math<4>-Footnote-2880929 +Ref: math<4>-Footnote-3880994 +Ref: math<4>-Footnote-4881059 +Ref: math<4>-Footnote-5881124 +Node: multiprocessing<2>881189 +Ref: whatsnew/3 9 multiprocessing881295 +Ref: 912881295 +Ref: multiprocessing<2>-Footnote-1881551 +Node: nntplib881616 +Ref: whatsnew/3 9 nntplib881720 +Ref: 915881720 +Ref: nntplib-Footnote-1882004 +Node: os<5>882069 +Ref: whatsnew/3 9 os882165 +Ref: 916882165 +Ref: os<5>-Footnote-1882921 +Ref: os<5>-Footnote-2882986 +Ref: os<5>-Footnote-3883051 +Ref: os<5>-Footnote-4883116 +Ref: os<5>-Footnote-5883181 +Ref: os<5>-Footnote-6883246 +Node: pathlib<6>883311 +Ref: whatsnew/3 9 pathlib883406 +Ref: 91d883406 +Ref: pathlib<6>-Footnote-1883620 +Node: pdb<3>883685 +Ref: whatsnew/3 9 pdb883781 +Ref: 920883781 +Ref: pdb<3>-Footnote-1883969 +Node: poplib884034 +Ref: whatsnew/3 9 poplib884129 +Ref: 922884129 +Ref: poplib-Footnote-1884423 +Node: pprint<2>884488 +Ref: whatsnew/3 9 pprint884582 +Ref: 925884582 +Ref: pprint<2>-Footnote-1884778 +Node: pydoc884843 +Ref: whatsnew/3 9 pydoc884940 +Ref: 926884940 +Ref: pydoc-Footnote-1885207 +Node: random<3>885272 +Ref: whatsnew/3 9 random885366 +Ref: 928885366 +Ref: random<3>-Footnote-1885567 +Node: signal885632 +Ref: whatsnew/3 9 signal885728 +Ref: 92a885728 +Ref: signal-Footnote-1885958 +Node: smtplib886023 +Ref: whatsnew/3 9 smtplib886119 +Ref: 92c886119 +Ref: smtplib-Footnote-1886531 +Ref: smtplib-Footnote-2886596 +Node: socket<3>886661 +Ref: whatsnew/3 9 socket886758 +Ref: 930886758 +Ref: socket<3>-Footnote-1887344 +Ref: socket<3>-Footnote-2887409 +Ref: socket<3>-Footnote-3887474 +Node: time<3>887539 +Ref: whatsnew/3 9 time887635 +Ref: 935887635 +Ref: time<3>-Footnote-1887965 +Node: sys<6>888030 +Ref: whatsnew/3 9 sys888128 +Ref: 937888128 +Ref: sys<6>-Footnote-1888793 +Ref: sys<6>-Footnote-2888860 +Node: tracemalloc888925 +Ref: whatsnew/3 9 tracemalloc889025 +Ref: 93a889025 +Ref: tracemalloc-Footnote-1889309 +Node: typing<6>889374 +Ref: whatsnew/3 9 typing889482 +Ref: 93c889482 +Ref: typing<6>-Footnote-1889838 +Node: unicodedata<4>889880 +Ref: whatsnew/3 9 unicodedata889984 +Ref: 93e889984 +Ref: unicodedata<4>-Footnote-1890137 +Node: venv<3>890202 +Ref: whatsnew/3 9 venv890303 +Ref: 93f890303 +Ref: venv<3>-Footnote-1890765 +Node: xml<3>890830 +Ref: whatsnew/3 9 xml890908 +Ref: 940890908 +Ref: xml<3>-Footnote-1891270 +Node: Optimizations<5>891335 +Ref: whatsnew/3 9 optimizations891464 +Ref: 941891464 +Ref: Optimizations<5>-Footnote-1897229 +Ref: Optimizations<5>-Footnote-2897294 +Ref: Optimizations<5>-Footnote-3897359 +Ref: Optimizations<5>-Footnote-4897424 +Ref: Optimizations<5>-Footnote-5897489 +Ref: Optimizations<5>-Footnote-6897531 +Ref: Optimizations<5>-Footnote-7897596 +Ref: Optimizations<5>-Footnote-8897660 +Ref: Optimizations<5>-Footnote-9897725 +Ref: Optimizations<5>-Footnote-10897790 +Ref: Optimizations<5>-Footnote-11897856 +Ref: Optimizations<5>-Footnote-12897985 +Node: Deprecated<7>898034 +Ref: whatsnew/3 9 deprecated898154 +Ref: 946898154 +Ref: Deprecated<7>-Footnote-1903186 +Ref: Deprecated<7>-Footnote-2903251 +Ref: Deprecated<7>-Footnote-3903316 +Ref: Deprecated<7>-Footnote-4903381 +Ref: Deprecated<7>-Footnote-5903446 +Ref: Deprecated<7>-Footnote-6903511 +Ref: Deprecated<7>-Footnote-7903576 +Ref: Deprecated<7>-Footnote-8903641 +Ref: Deprecated<7>-Footnote-9903706 +Ref: Deprecated<7>-Footnote-10903771 +Ref: Deprecated<7>-Footnote-11903837 +Ref: Deprecated<7>-Footnote-12903903 +Ref: Deprecated<7>-Footnote-13903969 +Ref: Deprecated<7>-Footnote-14904035 +Ref: Deprecated<7>-Footnote-15904101 +Ref: Deprecated<7>-Footnote-16904144 +Ref: Deprecated<7>-Footnote-17904184 +Ref: Deprecated<7>-Footnote-18904223 +Ref: Deprecated<7>-Footnote-19904289 +Node: Removed<7>904355 +Ref: whatsnew/3 9 removed904480 +Ref: 948904480 +Ref: whatsnew/3 9 removed-in-python-39904480 +Ref: 8ca904480 +Ref: Removed<7>-Footnote-1910630 +Ref: Removed<7>-Footnote-2910695 +Ref: Removed<7>-Footnote-3910760 +Ref: Removed<7>-Footnote-4910825 +Ref: Removed<7>-Footnote-5910890 +Ref: Removed<7>-Footnote-6910955 +Ref: Removed<7>-Footnote-7911020 +Ref: Removed<7>-Footnote-8911085 +Ref: Removed<7>-Footnote-9911150 +Ref: Removed<7>-Footnote-10911215 +Ref: Removed<7>-Footnote-11911281 +Ref: Removed<7>-Footnote-12911324 +Ref: Removed<7>-Footnote-13911390 +Ref: Removed<7>-Footnote-14911456 +Ref: Removed<7>-Footnote-15911522 +Ref: Removed<7>-Footnote-16911588 +Ref: Removed<7>-Footnote-17911654 +Ref: Removed<7>-Footnote-18911720 +Ref: Removed<7>-Footnote-19911786 +Ref: Removed<7>-Footnote-20911852 +Ref: Removed<7>-Footnote-21911918 +Ref: Removed<7>-Footnote-22911984 +Node: Porting to Python 3 9912050 +Ref: whatsnew/3 9 porting-to-python-3-9912178 +Ref: 958912178 +Node: Changes in the Python API<4>912519 +Ref: whatsnew/3 9 changes-in-the-python-api912637 +Ref: 959912637 +Ref: Changes in the Python API<4>-Footnote-1916833 +Ref: Changes in the Python API<4>-Footnote-2916898 +Ref: Changes in the Python API<4>-Footnote-3916963 +Ref: Changes in the Python API<4>-Footnote-4917028 +Ref: Changes in the Python API<4>-Footnote-5917087 +Ref: Changes in the Python API<4>-Footnote-6917152 +Ref: Changes in the Python API<4>-Footnote-7917217 +Ref: Changes in the Python API<4>-Footnote-8917282 +Ref: Changes in the Python API<4>-Footnote-9917347 +Ref: Changes in the Python API<4>-Footnote-10917412 +Ref: Changes in the Python API<4>-Footnote-11917478 +Node: Changes in the C API<3>917544 +Ref: whatsnew/3 9 changes-in-the-c-api917698 +Ref: 964917698 +Ref: Changes in the C API<3>-Footnote-1919822 +Ref: Changes in the C API<3>-Footnote-2919887 +Ref: Changes in the C API<3>-Footnote-3919952 +Node: CPython bytecode changes<4>920017 +Ref: whatsnew/3 9 cpython-bytecode-changes920134 +Ref: 966920134 +Ref: CPython bytecode changes<4>-Footnote-1920957 +Ref: CPython bytecode changes<4>-Footnote-2921022 +Node: Build Changes<5>921087 +Ref: whatsnew/3 9 build-changes921221 +Ref: 96a921221 +Ref: Build Changes<5>-Footnote-1923637 +Ref: Build Changes<5>-Footnote-2923704 +Ref: Build Changes<5>-Footnote-3923769 +Ref: Build Changes<5>-Footnote-4923834 +Ref: Build Changes<5>-Footnote-5923899 +Ref: Build Changes<5>-Footnote-6923964 +Ref: Build Changes<5>-Footnote-7924029 +Ref: Build Changes<5>-Footnote-8924094 +Node: C API Changes<5>924159 +Ref: whatsnew/3 9 c-api-changes924303 +Ref: 96c924303 +Node: New Features<10>924464 +Ref: whatsnew/3 9 id1924566 +Ref: 96d924566 +Ref: New Features<10>-Footnote-1927589 +Ref: New Features<10>-Footnote-2927631 +Ref: New Features<10>-Footnote-3927696 +Ref: New Features<10>-Footnote-4927761 +Ref: New Features<10>-Footnote-5927826 +Ref: New Features<10>-Footnote-6927891 +Ref: New Features<10>-Footnote-7927956 +Ref: New Features<10>-Footnote-8928021 +Ref: New Features<10>-Footnote-9928086 +Ref: New Features<10>-Footnote-10928151 +Ref: New Features<10>-Footnote-11928217 +Ref: New Features<10>-Footnote-12928283 +Node: Porting to Python 3 9<2>928349 +Ref: whatsnew/3 9 id2928470 +Ref: 979928470 +Ref: Porting to Python 3 9<2>-Footnote-1932293 +Ref: Porting to Python 3 9<2>-Footnote-2932335 +Ref: Porting to Python 3 9<2>-Footnote-3932400 +Ref: Porting to Python 3 9<2>-Footnote-4932465 +Ref: Porting to Python 3 9<2>-Footnote-5932529 +Ref: Porting to Python 3 9<2>-Footnote-6932594 +Ref: Porting to Python 3 9<2>-Footnote-7932659 +Ref: Porting to Python 3 9<2>-Footnote-8932701 +Ref: Porting to Python 3 9<2>-Footnote-9932766 +Ref: Porting to Python 3 9<2>-Footnote-10932831 +Ref: Porting to Python 3 9<2>-Footnote-11932897 +Node: Removed<8>932963 +Ref: whatsnew/3 9 id3933059 +Ref: 98c933059 +Ref: Removed<8>-Footnote-1937000 +Ref: Removed<8>-Footnote-2937065 +Ref: Removed<8>-Footnote-3937130 +Ref: Removed<8>-Footnote-4937195 +Ref: Removed<8>-Footnote-5937260 +Ref: Removed<8>-Footnote-6937325 +Ref: Removed<8>-Footnote-7937390 +Ref: Removed<8>-Footnote-8937455 +Ref: Removed<8>-Footnote-9937520 +Ref: Removed<8>-Footnote-10937585 +Ref: Removed<8>-Footnote-11937651 +Ref: Removed<8>-Footnote-12937694 +Ref: Removed<8>-Footnote-13937760 +Node: Notable changes in Python 3 9 1937826 +Ref: whatsnew/3 9 notable-changes-in-python-3-9-1937985 +Ref: 98f937985 +Node: typing<7>938199 +Ref: whatsnew/3 9 id4938333 +Ref: 990938333 +Ref: typing<7>-Footnote-1939525 +Ref: typing<7>-Footnote-2939567 +Node: macOS 11 0 Big Sur and Apple Silicon Mac support939632 +Ref: whatsnew/3 9 macos-11-0-big-sur-and-apple-silicon-mac-support939766 +Ref: 991939766 +Ref: macOS 11 0 Big Sur and Apple Silicon Mac support-Footnote-1940576 +Node: Notable changes in Python 3 9 2940641 +Ref: whatsnew/3 9 notable-changes-in-python-3-9-2940815 +Ref: 992940815 +Node: collections abc<2>940976 +Ref: whatsnew/3 9 collections-abc941086 +Ref: 993941086 +Ref: collections abc<2>-Footnote-1942065 +Node: urllib parse<2>942130 +Ref: whatsnew/3 9 urllib-parse942240 +Ref: 994942240 +Ref: urllib parse<2>-Footnote-1942924 +Node: Notable changes in Python 3 9 3942989 +Ref: whatsnew/3 9 notable-changes-in-python-3-9-3943163 +Ref: 995943163 +Ref: Notable changes in Python 3 9 3-Footnote-1943634 +Node: Notable changes in Python 3 9 5943689 +Ref: whatsnew/3 9 notable-changes-in-python-3-9-5943866 +Ref: 996943866 +Node: urllib parse<3>943988 +Ref: whatsnew/3 9 id5944071 +Ref: 997944071 +Ref: urllib parse<3>-Footnote-1944600 +Ref: urllib parse<3>-Footnote-2944659 +Node: Notable security feature in 3 9 14944714 +Ref: whatsnew/3 9 notable-security-feature-in-3-9-14944885 +Ref: 998944885 +Ref: Notable security feature in 3 9 14-Footnote-1945615 +Node: Notable changes in 3 9 17945671 +Ref: whatsnew/3 9 notable-changes-in-3-9-17945802 +Ref: 999945802 +Node: tarfile<4>945902 +Ref: whatsnew/3 9 tarfile945974 +Ref: 99a945974 +Ref: tarfile<4>-Footnote-1946578 +Node: What’s New In Python 3 8946620 +Ref: whatsnew/3 8 doc946775 +Ref: 99b946775 +Ref: whatsnew/3 8 what-s-new-in-python-3-8946775 +Ref: 99c946775 +Node: Summary – Release highlights<5>948120 +Ref: whatsnew/3 8 summary-release-highlights948241 +Ref: 99d948241 +Node: New Features<11>948314 +Ref: whatsnew/3 8 new-features948469 +Ref: 99e948469 +Node: Assignment expressions949092 +Ref: whatsnew/3 8 assignment-expressions949202 +Ref: 99f949202 +Ref: Assignment expressions-Footnote-1950708 +Ref: Assignment expressions-Footnote-2950805 +Ref: Assignment expressions-Footnote-3950847 +Node: Positional-only parameters950912 +Ref: whatsnew/3 8 positional-only-parameters951084 +Ref: 9a0951084 +Ref: Positional-only parameters-Footnote-1953766 +Ref: Positional-only parameters-Footnote-2953828 +Ref: Positional-only parameters-Footnote-3953870 +Node: Parallel filesystem cache for compiled bytecode files953935 +Ref: whatsnew/3 8 parallel-filesystem-cache-for-compiled-bytecode-files954131 +Ref: 9a2954131 +Ref: Parallel filesystem cache for compiled bytecode files-Footnote-1954773 +Node: Debug build uses the same ABI as release build954838 +Ref: whatsnew/3 8 debug-build-uses-the-same-abi-as-release-build955074 +Ref: 9a5955074 +Ref: Debug build uses the same ABI as release build-Footnote-1957431 +Ref: Debug build uses the same ABI as release build-Footnote-2957496 +Ref: Debug build uses the same ABI as release build-Footnote-3957561 +Ref: Debug build uses the same ABI as release build-Footnote-4957626 +Node: f-strings support = for self-documenting expressions and debugging957691 +Ref: whatsnew/3 8 bpo-36817-whatsnew957908 +Ref: 9a7957908 +Ref: whatsnew/3 8 f-strings-support-for-self-documenting-expressions-and-debugging957908 +Ref: 9a8957908 +Ref: f-strings support = for self-documenting expressions and debugging-Footnote-1958997 +Node: PEP 578 Python Runtime Audit Hooks959062 +Ref: whatsnew/3 8 pep-578-python-runtime-audit-hooks959276 +Ref: 9aa959276 +Ref: PEP 578 Python Runtime Audit Hooks-Footnote-1959759 +Node: PEP 587 Python Initialization Configuration959801 +Ref: whatsnew/3 8 pep-587-python-initialization-configuration960003 +Ref: 9ab960003 +Ref: PEP 587 Python Initialization Configuration-Footnote-1961990 +Ref: PEP 587 Python Initialization Configuration-Footnote-2962032 +Ref: PEP 587 Python Initialization Configuration-Footnote-3962074 +Node: PEP 590 Vectorcall a fast calling protocol for CPython962139 +Ref: whatsnew/3 8 pep-590-vectorcall-a-fast-calling-protocol-for-cpython962354 +Ref: 9c6962354 +Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-1962962 +Ref: PEP 590 Vectorcall a fast calling protocol for CPython-Footnote-2963004 +Node: Pickle protocol 5 with out-of-band data buffers963069 +Ref: whatsnew/3 8 pickle-protocol-5-with-out-of-band-data-buffers963232 +Ref: 9c7963232 +Ref: Pickle protocol 5 with out-of-band data buffers-Footnote-1963984 +Ref: Pickle protocol 5 with out-of-band data buffers-Footnote-2964026 +Ref: Pickle protocol 5 with out-of-band data buffers-Footnote-3964068 +Node: Other Language Changes<6>964133 +Ref: whatsnew/3 8 other-language-changes964269 +Ref: 9c8964269 +Ref: Other Language Changes<6>-Footnote-1971642 +Ref: Other Language Changes<6>-Footnote-2971707 +Ref: Other Language Changes<6>-Footnote-3971772 +Ref: Other Language Changes<6>-Footnote-4971837 +Ref: Other Language Changes<6>-Footnote-5971902 +Ref: Other Language Changes<6>-Footnote-6971967 +Ref: Other Language Changes<6>-Footnote-7972032 +Ref: Other Language Changes<6>-Footnote-8972097 +Ref: Other Language Changes<6>-Footnote-9972162 +Ref: Other Language Changes<6>-Footnote-10972227 +Ref: Other Language Changes<6>-Footnote-11972293 +Ref: Other Language Changes<6>-Footnote-12972361 +Ref: Other Language Changes<6>-Footnote-13972427 +Ref: Other Language Changes<6>-Footnote-14972497 +Ref: Other Language Changes<6>-Footnote-15972557 +Ref: Other Language Changes<6>-Footnote-16972623 +Ref: Other Language Changes<6>-Footnote-17972689 +Node: New Modules<6>972755 +Ref: whatsnew/3 8 new-modules972894 +Ref: 9d4972894 +Ref: New Modules<6>-Footnote-1973972 +Node: Improved Modules<6>974037 +Ref: whatsnew/3 8 improved-modules974167 +Ref: 9d5974167 +Node: ast<3>975182 +Ref: whatsnew/3 8 ast975263 +Ref: 9d6975263 +Ref: ast<3>-Footnote-1976295 +Ref: ast<3>-Footnote-2976360 +Ref: ast<3>-Footnote-3976402 +Ref: ast<3>-Footnote-4976444 +Ref: ast<3>-Footnote-5976486 +Node: asyncio<6>976551 +Ref: whatsnew/3 8 asyncio976652 +Ref: 9d8976652 +Ref: asyncio<6>-Footnote-1979808 +Ref: asyncio<6>-Footnote-2979873 +Ref: asyncio<6>-Footnote-3979938 +Ref: asyncio<6>-Footnote-4980003 +Ref: asyncio<6>-Footnote-5980068 +Ref: asyncio<6>-Footnote-6980133 +Ref: asyncio<6>-Footnote-7980198 +Ref: asyncio<6>-Footnote-8980263 +Ref: asyncio<6>-Footnote-9980328 +Ref: asyncio<6>-Footnote-10980381 +Node: builtins<2>980447 +Ref: whatsnew/3 8 builtins980553 +Ref: 9de980553 +Ref: builtins<2>-Footnote-1981052 +Node: collections981117 +Ref: whatsnew/3 8 collections981221 +Ref: 9df981221 +Ref: collections-Footnote-1981743 +Node: cProfile981808 +Ref: whatsnew/3 8 cprofile981907 +Ref: 9e1981907 +Ref: cProfile-Footnote-1982257 +Node: csv<2>982322 +Ref: whatsnew/3 8 csv982419 +Ref: 9e3982419 +Ref: csv<2>-Footnote-1982736 +Node: curses<3>982801 +Ref: whatsnew/3 8 curses982899 +Ref: 9e5982899 +Ref: curses<3>-Footnote-1983143 +Node: ctypes<2>983208 +Ref: whatsnew/3 8 ctypes983311 +Ref: 9e7983311 +Ref: ctypes<2>-Footnote-1983800 +Node: datetime<3>983865 +Ref: whatsnew/3 8 datetime983971 +Ref: 9ea983971 +Ref: datetime<3>-Footnote-1984406 +Node: functools<2>984471 +Ref: whatsnew/3 8 functools984573 +Ref: 9ed984573 +Ref: functools<2>-Footnote-1986115 +Ref: functools<2>-Footnote-2986180 +Ref: functools<2>-Footnote-3986245 +Node: gc<3>986310 +Ref: whatsnew/3 8 gc986408 +Ref: 9f2986408 +Ref: gc<3>-Footnote-1986641 +Node: gettext986706 +Ref: whatsnew/3 8 gettext986799 +Ref: 9f3986799 +Ref: gettext-Footnote-1987000 +Node: gzip<3>987064 +Ref: whatsnew/3 8 gzip987171 +Ref: 9f5987171 +Ref: gzip<3>-Footnote-1987588 +Ref: gzip<3>-Footnote-2987653 +Node: IDLE and idlelib<4>987717 +Ref: whatsnew/3 8 idle-and-idlelib987827 +Ref: 9f7987827 +Ref: IDLE and idlelib<4>-Footnote-1989796 +Ref: IDLE and idlelib<4>-Footnote-2989863 +Ref: IDLE and idlelib<4>-Footnote-3989927 +Ref: IDLE and idlelib<4>-Footnote-4989992 +Ref: IDLE and idlelib<4>-Footnote-5990057 +Ref: IDLE and idlelib<4>-Footnote-6990122 +Ref: IDLE and idlelib<4>-Footnote-7990186 +Ref: IDLE and idlelib<4>-Footnote-8990251 +Node: inspect<5>990316 +Ref: whatsnew/3 8 inspect990424 +Ref: 9f8990424 +Ref: inspect<5>-Footnote-1991190 +Node: io<3>991255 +Ref: whatsnew/3 8 io991356 +Ref: 9fa991356 +Ref: io<3>-Footnote-1991704 +Node: itertools<4>991769 +Ref: whatsnew/3 8 itertools991869 +Ref: 9fb991869 +Ref: itertools<4>-Footnote-1992247 +Node: json tool992312 +Ref: whatsnew/3 8 json-tool992417 +Ref: 9fd992417 +Ref: json tool-Footnote-1992624 +Node: logging<2>992689 +Ref: whatsnew/3 8 logging992789 +Ref: 9fe992789 +Ref: logging<2>-Footnote-1993504 +Node: math<5>993569 +Ref: whatsnew/3 8 math993667 +Ref: a00993667 +Ref: math<5>-Footnote-1995416 +Ref: math<5>-Footnote-2995481 +Ref: math<5>-Footnote-3995546 +Ref: math<5>-Footnote-4995611 +Ref: math<5>-Footnote-5995676 +Ref: math<5>-Footnote-6995741 +Ref: math<5>-Footnote-7995806 +Ref: math<5>-Footnote-8995871 +Node: mmap<2>995936 +Ref: whatsnew/3 8 mmap996042 +Ref: a06996042 +Ref: mmap<2>-Footnote-1996272 +Node: multiprocessing<3>996337 +Ref: whatsnew/3 8 multiprocessing996441 +Ref: a08996441 +Ref: multiprocessing<3>-Footnote-1996745 +Ref: multiprocessing<3>-Footnote-2996810 +Node: os<6>996875 +Ref: whatsnew/3 8 os996982 +Ref: a09996982 +Ref: os<6>-Footnote-1998490 +Ref: os<6>-Footnote-2998555 +Ref: os<6>-Footnote-3998620 +Node: os path<5>998685 +Ref: whatsnew/3 8 os-path998784 +Ref: a0c998784 +Ref: os path<5>-Footnote-1999807 +Ref: os path<5>-Footnote-2999872 +Ref: os path<5>-Footnote-3999937 +Node: pathlib<7>1000002 +Ref: whatsnew/3 8 pathlib1000102 +Ref: a141000102 +Ref: pathlib<7>-Footnote-11001011 +Ref: pathlib<7>-Footnote-21001076 +Node: pickle1001141 +Ref: whatsnew/3 8 pickle1001239 +Ref: a1c1001239 +Ref: pickle-Footnote-11001577 +Node: plistlib1001642 +Ref: whatsnew/3 8 plistlib1001739 +Ref: a1f1001739 +Ref: plistlib-Footnote-11001977 +Node: pprint<3>1002042 +Ref: whatsnew/3 8 pprint1002146 +Ref: a211002146 +Ref: pprint<3>-Footnote-11003211 +Node: py_compile<2>1003276 +Ref: whatsnew/3 8 py-compile1003377 +Ref: a231003377 +Ref: py_compile<2>-Footnote-11003566 +Node: shlex1003631 +Ref: whatsnew/3 8 shlex1003732 +Ref: a251003732 +Ref: shlex-Footnote-11003936 +Node: shutil<4>1004001 +Ref: whatsnew/3 8 shutil1004098 +Ref: a271004098 +Ref: shutil<4>-Footnote-11004751 +Ref: shutil<4>-Footnote-21004816 +Ref: shutil<4>-Footnote-31004881 +Node: socket<4>1004946 +Ref: whatsnew/3 8 socket1005044 +Ref: a291005044 +Ref: socket<4>-Footnote-11005619 +Ref: socket<4>-Footnote-21005684 +Node: ssl<4>1005749 +Ref: whatsnew/3 8 ssl1005851 +Ref: a2f1005851 +Ref: ssl<4>-Footnote-11006113 +Node: statistics<4>1006178 +Ref: whatsnew/3 8 statistics1006277 +Ref: a321006277 +Ref: statistics<4>-Footnote-11008008 +Ref: statistics<4>-Footnote-21008073 +Ref: statistics<4>-Footnote-31008138 +Ref: statistics<4>-Footnote-41008203 +Ref: statistics<4>-Footnote-51008268 +Node: sys<7>1008333 +Ref: whatsnew/3 8 sys1008436 +Ref: a381008436 +Ref: sys<7>-Footnote-11008879 +Node: tarfile<5>1008944 +Ref: whatsnew/3 8 tarfile1009046 +Ref: a3a1009046 +Ref: tarfile<5>-Footnote-11009464 +Node: threading<4>1009529 +Ref: whatsnew/3 8 threading1009636 +Ref: a3b1009636 +Ref: threading<4>-Footnote-11010372 +Ref: threading<4>-Footnote-21010439 +Node: tokenize<2>1010504 +Ref: whatsnew/3 8 tokenize1010611 +Ref: a3f1010611 +Ref: tokenize<2>-Footnote-11010936 +Node: tkinter<4>1011001 +Ref: whatsnew/3 8 tkinter1011103 +Ref: a401011103 +Ref: tkinter<4>-Footnote-11011646 +Ref: tkinter<4>-Footnote-21011711 +Ref: tkinter<4>-Footnote-31011776 +Node: time<4>1011841 +Ref: whatsnew/3 8 time1011941 +Ref: a411011941 +Ref: time<4>-Footnote-11012120 +Node: typing<8>1012185 +Ref: whatsnew/3 8 typing1012289 +Ref: a431012289 +Ref: typing<8>-Footnote-11013763 +Ref: typing<8>-Footnote-21013805 +Ref: typing<8>-Footnote-31013847 +Ref: typing<8>-Footnote-41013889 +Node: unicodedata<5>1013931 +Ref: whatsnew/3 8 unicodedata1014039 +Ref: a471014039 +Ref: unicodedata<5>-Footnote-11014468 +Ref: unicodedata<5>-Footnote-21014530 +Ref: unicodedata<5>-Footnote-31014595 +Node: unittest<6>1014660 +Ref: whatsnew/3 8 unittest1014766 +Ref: a491014766 +Ref: unittest<6>-Footnote-11016056 +Ref: unittest<6>-Footnote-21016121 +Ref: unittest<6>-Footnote-31016186 +Ref: unittest<6>-Footnote-41016251 +Node: venv<4>1016316 +Ref: whatsnew/3 8 venv1016415 +Ref: a4f1016415 +Ref: venv<4>-Footnote-11016667 +Node: weakref1016732 +Ref: whatsnew/3 8 weakref1016826 +Ref: a501016826 +Ref: weakref-Footnote-11017119 +Node: xml<4>1017184 +Ref: whatsnew/3 8 xml1017277 +Ref: a521017277 +Ref: xml<4>-Footnote-11018451 +Ref: xml<4>-Footnote-21018516 +Ref: xml<4>-Footnote-31018581 +Ref: xml<4>-Footnote-41018646 +Ref: xml<4>-Footnote-51018711 +Node: xmlrpc1018776 +Ref: whatsnew/3 8 xmlrpc1018853 +Ref: a551018853 +Ref: xmlrpc-Footnote-11019245 +Node: Optimizations<6>1019310 +Ref: whatsnew/3 8 optimizations1019449 +Ref: a571019449 +Ref: Optimizations<6>-Footnote-11023823 +Ref: Optimizations<6>-Footnote-21023888 +Ref: Optimizations<6>-Footnote-31023953 +Ref: Optimizations<6>-Footnote-41024018 +Ref: Optimizations<6>-Footnote-51024083 +Ref: Optimizations<6>-Footnote-61024148 +Ref: Optimizations<6>-Footnote-71024213 +Ref: Optimizations<6>-Footnote-81024278 +Ref: Optimizations<6>-Footnote-91024343 +Ref: Optimizations<6>-Footnote-101024408 +Ref: Optimizations<6>-Footnote-111024474 +Ref: Optimizations<6>-Footnote-121024540 +Ref: Optimizations<6>-Footnote-131024606 +Node: Build and C API Changes1024672 +Ref: whatsnew/3 8 build-and-c-api-changes1024805 +Ref: a621024805 +Ref: Build and C API Changes-Footnote-11030386 +Ref: Build and C API Changes-Footnote-21030451 +Ref: Build and C API Changes-Footnote-31030516 +Ref: Build and C API Changes-Footnote-41030581 +Ref: Build and C API Changes-Footnote-51030646 +Ref: Build and C API Changes-Footnote-61030711 +Ref: Build and C API Changes-Footnote-71030776 +Ref: Build and C API Changes-Footnote-81030841 +Ref: Build and C API Changes-Footnote-91030906 +Ref: Build and C API Changes-Footnote-101030971 +Ref: Build and C API Changes-Footnote-111031037 +Ref: Build and C API Changes-Footnote-121031103 +Node: Deprecated<8>1031169 +Ref: whatsnew/3 8 deprecated1031310 +Ref: a6c1031310 +Ref: Deprecated<8>-Footnote-11037133 +Ref: Deprecated<8>-Footnote-21037198 +Ref: Deprecated<8>-Footnote-31037263 +Ref: Deprecated<8>-Footnote-41037328 +Ref: Deprecated<8>-Footnote-51037392 +Ref: Deprecated<8>-Footnote-61037457 +Ref: Deprecated<8>-Footnote-71037522 +Ref: Deprecated<8>-Footnote-81037587 +Ref: Deprecated<8>-Footnote-91037652 +Ref: Deprecated<8>-Footnote-101037717 +Ref: Deprecated<8>-Footnote-111037783 +Ref: Deprecated<8>-Footnote-121037849 +Ref: Deprecated<8>-Footnote-131037915 +Node: API and Feature Removals1037981 +Ref: whatsnew/3 8 api-and-feature-removals1038120 +Ref: a861038120 +Ref: API and Feature Removals-Footnote-11040942 +Ref: API and Feature Removals-Footnote-21040997 +Ref: API and Feature Removals-Footnote-31041062 +Ref: API and Feature Removals-Footnote-41041127 +Ref: API and Feature Removals-Footnote-51041192 +Ref: API and Feature Removals-Footnote-61041257 +Ref: API and Feature Removals-Footnote-71041322 +Ref: API and Feature Removals-Footnote-81041387 +Ref: API and Feature Removals-Footnote-91041452 +Ref: API and Feature Removals-Footnote-101041517 +Ref: API and Feature Removals-Footnote-111041583 +Node: Porting to Python 3 81041649 +Ref: whatsnew/3 8 porting-to-python-3-81041806 +Ref: a8a1041806 +Node: Changes in Python behavior1042217 +Ref: whatsnew/3 8 changes-in-python-behavior1042338 +Ref: a8b1042338 +Ref: Changes in Python behavior-Footnote-11044705 +Ref: Changes in Python behavior-Footnote-21044770 +Ref: Changes in Python behavior-Footnote-31044835 +Ref: Changes in Python behavior-Footnote-41044900 +Ref: Changes in Python behavior-Footnote-51044965 +Ref: Changes in Python behavior-Footnote-61045030 +Node: Changes in the Python API<5>1045095 +Ref: whatsnew/3 8 changes-in-the-python-api1045248 +Ref: a901045248 +Ref: whatsnew/3 8 bpo-36085-whatsnew1052225 +Ref: a9e1052225 +Ref: Changes in the Python API<5>-Footnote-11053885 +Ref: Changes in the Python API<5>-Footnote-21053927 +Ref: Changes in the Python API<5>-Footnote-31053992 +Ref: Changes in the Python API<5>-Footnote-41054057 +Ref: Changes in the Python API<5>-Footnote-51054122 +Ref: Changes in the Python API<5>-Footnote-61054187 +Ref: Changes in the Python API<5>-Footnote-71054252 +Ref: Changes in the Python API<5>-Footnote-81054317 +Ref: Changes in the Python API<5>-Footnote-91054382 +Ref: Changes in the Python API<5>-Footnote-101054447 +Ref: Changes in the Python API<5>-Footnote-111054513 +Ref: Changes in the Python API<5>-Footnote-121054579 +Ref: Changes in the Python API<5>-Footnote-131054645 +Ref: Changes in the Python API<5>-Footnote-141054711 +Ref: Changes in the Python API<5>-Footnote-151054777 +Ref: Changes in the Python API<5>-Footnote-161054843 +Ref: Changes in the Python API<5>-Footnote-171054909 +Ref: Changes in the Python API<5>-Footnote-181054974 +Ref: Changes in the Python API<5>-Footnote-191055040 +Ref: Changes in the Python API<5>-Footnote-201055106 +Ref: Changes in the Python API<5>-Footnote-211055172 +Ref: Changes in the Python API<5>-Footnote-221055238 +Ref: Changes in the Python API<5>-Footnote-231055304 +Ref: Changes in the Python API<5>-Footnote-241055370 +Ref: Changes in the Python API<5>-Footnote-251055436 +Ref: Changes in the Python API<5>-Footnote-261055502 +Ref: Changes in the Python API<5>-Footnote-271055568 +Node: Changes in the C API<4>1055611 +Ref: whatsnew/3 8 changes-in-the-c-api1055765 +Ref: aa01055765 +Ref: Changes in the C API<4>-Footnote-11061607 +Ref: Changes in the C API<4>-Footnote-21061672 +Ref: Changes in the C API<4>-Footnote-31061737 +Ref: Changes in the C API<4>-Footnote-41061802 +Ref: Changes in the C API<4>-Footnote-51061867 +Ref: Changes in the C API<4>-Footnote-61061932 +Ref: Changes in the C API<4>-Footnote-71061997 +Ref: Changes in the C API<4>-Footnote-81062062 +Node: CPython bytecode changes<5>1062127 +Ref: whatsnew/3 8 cpython-bytecode-changes1062271 +Ref: aa81062271 +Ref: CPython bytecode changes<5>-Footnote-11063596 +Ref: CPython bytecode changes<5>-Footnote-21063661 +Ref: CPython bytecode changes<5>-Footnote-31063726 +Ref: CPython bytecode changes<5>-Footnote-41063768 +Node: Demos and Tools<2>1063833 +Ref: whatsnew/3 8 demos-and-tools1063945 +Ref: aad1063945 +Ref: Demos and Tools<2>-Footnote-11067242 +Ref: Demos and Tools<2>-Footnote-21067307 +Ref: Demos and Tools<2>-Footnote-31067435 +Node: Notable changes in Python 3 8 11067483 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-11067647 +Ref: aae1067647 +Ref: Notable changes in Python 3 8 1-Footnote-11068158 +Node: Notable changes in Python 3 8 21068223 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-21068397 +Ref: aaf1068397 +Ref: Notable changes in Python 3 8 2-Footnote-11068719 +Node: Notable changes in Python 3 8 31068774 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-31068948 +Ref: ab01068948 +Ref: Notable changes in Python 3 8 3-Footnote-11069335 +Node: Notable changes in Python 3 8 81069390 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-81069564 +Ref: ab11069564 +Ref: Notable changes in Python 3 8 8-Footnote-11070282 +Node: Notable changes in Python 3 8 91070347 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-91070522 +Ref: ab21070522 +Ref: Notable changes in Python 3 8 9-Footnote-11070993 +Node: Notable changes in Python 3 8 101071048 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-101071227 +Ref: ab31071227 +Node: macOS 11 0 Big Sur and Apple Silicon Mac support<2>1071425 +Ref: whatsnew/3 8 macos-11-0-big-sur-and-apple-silicon-mac-support1071545 +Ref: ab41071545 +Ref: macOS 11 0 Big Sur and Apple Silicon Mac support<2>-Footnote-11072522 +Node: Notable changes in Python 3 8 10<2>1072577 +Ref: whatsnew/3 8 id11072757 +Ref: ab51072757 +Node: urllib parse<4>1072881 +Ref: whatsnew/3 8 urllib-parse1072968 +Ref: ab61072968 +Ref: urllib parse<4>-Footnote-11073498 +Ref: urllib parse<4>-Footnote-21073557 +Node: Notable changes in Python 3 8 121073622 +Ref: whatsnew/3 8 notable-changes-in-python-3-8-121073804 +Ref: ab71073804 +Node: Changes in the Python API<6>1073954 +Ref: whatsnew/3 8 id21074051 +Ref: ab81074051 +Ref: Changes in the Python API<6>-Footnote-11074662 +Node: Notable security feature in 3 8 141074727 +Ref: whatsnew/3 8 notable-security-feature-in-3-8-141074899 +Ref: ab91074899 +Ref: Notable security feature in 3 8 14-Footnote-11075629 +Node: Notable changes in 3 8 171075685 +Ref: whatsnew/3 8 notable-changes-in-3-8-171075816 +Ref: aba1075816 +Node: tarfile<6>1075916 +Ref: whatsnew/3 8 id31075988 +Ref: abb1075988 +Ref: tarfile<6>-Footnote-11076592 +Node: What’s New In Python 3 71076634 +Ref: whatsnew/3 7 doc1076789 +Ref: whatsnew/3 7 what-s-new-in-python-3-71076789 +Ref: abd1076789 +Node: Summary – Release Highlights<2>1078264 +Ref: whatsnew/3 7 summary-release-highlights1078385 +Ref: abe1078385 +Ref: Summary – Release Highlights<2>-Footnote-11080532 +Ref: Summary – Release Highlights<2>-Footnote-21080612 +Ref: Summary – Release Highlights<2>-Footnote-31080648 +Ref: Summary – Release Highlights<2>-Footnote-41080684 +Node: New Features<12>1080720 +Ref: whatsnew/3 7 new-features1080875 +Ref: ad21080875 +Node: PEP 563 Postponed Evaluation of Annotations1081972 +Ref: whatsnew/3 7 pep-563-postponed-evaluation-of-annotations1082109 +Ref: ad31082109 +Ref: whatsnew/3 7 whatsnew37-pep5631082109 +Ref: abf1082109 +Ref: PEP 563 Postponed Evaluation of Annotations-Footnote-11083873 +Ref: PEP 563 Postponed Evaluation of Annotations-Footnote-21083915 +Ref: PEP 563 Postponed Evaluation of Annotations-Footnote-31083957 +Node: PEP 538 Legacy C Locale Coercion1083999 +Ref: whatsnew/3 7 pep-538-legacy-c-locale-coercion1084178 +Ref: ad41084178 +Ref: whatsnew/3 7 whatsnew37-pep5381084178 +Ref: ac91084178 +Ref: PEP 538 Legacy C Locale Coercion-Footnote-11086565 +Ref: PEP 538 Legacy C Locale Coercion-Footnote-21086607 +Ref: PEP 538 Legacy C Locale Coercion-Footnote-31086649 +Ref: PEP 538 Legacy C Locale Coercion-Footnote-41086691 +Node: PEP 540 Forced UTF-8 Runtime Mode1086733 +Ref: whatsnew/3 7 pep-540-forced-utf-8-runtime-mode1086896 +Ref: ad71086896 +Ref: whatsnew/3 7 whatsnew37-pep5401086896 +Ref: aca1086896 +Ref: PEP 540 Forced UTF-8 Runtime Mode-Footnote-11088460 +Ref: PEP 540 Forced UTF-8 Runtime Mode-Footnote-21088502 +Ref: PEP 540 Forced UTF-8 Runtime Mode-Footnote-31088544 +Node: PEP 553 Built-in breakpoint1088586 +Ref: whatsnew/3 7 pep-553-built-in-breakpoint1088759 +Ref: ad91088759 +Ref: whatsnew/3 7 whatsnew37-pep5531088759 +Ref: ac31088759 +Ref: PEP 553 Built-in breakpoint-Footnote-11089598 +Node: PEP 539 New C API for Thread-Local Storage1089640 +Ref: whatsnew/3 7 pep-539-new-c-api-for-thread-local-storage1089832 +Ref: adc1089832 +Ref: whatsnew/3 7 whatsnew37-pep5391089832 +Ref: ace1089832 +Ref: PEP 539 New C API for Thread-Local Storage-Footnote-11091327 +Ref: PEP 539 New C API for Thread-Local Storage-Footnote-21091369 +Node: PEP 562 Customization of Access to Module Attributes1091411 +Ref: whatsnew/3 7 pep-562-customization-of-access-to-module-attributes1091629 +Ref: ae01091629 +Ref: whatsnew/3 7 whatsnew37-pep5621091629 +Ref: ac41091629 +Ref: PEP 562 Customization of Access to Module Attributes-Footnote-11092204 +Node: PEP 564 New Time Functions With Nanosecond Resolution1092246 +Ref: whatsnew/3 7 pep-564-new-time-functions-with-nanosecond-resolution1092465 +Ref: ae11092465 +Ref: whatsnew/3 7 whatsnew37-pep5641092465 +Ref: ac81092465 +Ref: PEP 564 New Time Functions With Nanosecond Resolution-Footnote-11093550 +Ref: PEP 564 New Time Functions With Nanosecond Resolution-Footnote-21093592 +Ref: PEP 564 New Time Functions With Nanosecond Resolution-Footnote-31093669 +Node: PEP 565 Show DeprecationWarning in __main__1093711 +Ref: whatsnew/3 7 pep-565-show-deprecationwarning-in-main1093934 +Ref: ae81093934 +Ref: whatsnew/3 7 whatsnew37-pep5651093934 +Ref: acd1093934 +Ref: PEP 565 Show DeprecationWarning in __main__-Footnote-11095866 +Node: PEP 560 Core Support for typing module and Generic Types1095908 +Ref: whatsnew/3 7 pep-560-core-support-for-typing-module-and-generic-types1096106 +Ref: ae91096106 +Ref: whatsnew/3 7 whatsnew37-pep5601096106 +Ref: ac51096106 +Ref: PEP 560 Core Support for typing module and Generic Types-Footnote-11097056 +Ref: PEP 560 Core Support for typing module and Generic Types-Footnote-21097098 +Node: PEP 552 Hash-based pyc Files1097140 +Ref: whatsnew/3 7 pep-552-hash-based-pyc-files1097336 +Ref: aea1097336 +Ref: whatsnew/3 7 whatsnew37-pep5521097336 +Ref: acb1097336 +Ref: PEP 552 Hash-based pyc Files-Footnote-11099010 +Ref: PEP 552 Hash-based pyc Files-Footnote-21099051 +Ref: PEP 552 Hash-based pyc Files-Footnote-31099093 +Node: PEP 545 Python Documentation Translations1099135 +Ref: whatsnew/3 7 pep-545-python-documentation-translations1099305 +Ref: aeb1099305 +Ref: whatsnew/3 7 whatsnew37-pep5451099305 +Ref: acf1099305 +Ref: PEP 545 Python Documentation Translations-Footnote-11099889 +Ref: PEP 545 Python Documentation Translations-Footnote-21099931 +Node: Python Development Mode -X dev1099973 +Ref: whatsnew/3 7 python-development-mode-x-dev1100106 +Ref: aec1100106 +Ref: whatsnew/3 7 whatsnew37-devmode1100106 +Ref: acc1100106 +Node: Other Language Changes<7>1100560 +Ref: whatsnew/3 7 other-language-changes1100696 +Ref: aee1100696 +Ref: Other Language Changes<7>-Footnote-11103088 +Ref: Other Language Changes<7>-Footnote-21103153 +Ref: Other Language Changes<7>-Footnote-31103218 +Ref: Other Language Changes<7>-Footnote-41103283 +Ref: Other Language Changes<7>-Footnote-51103348 +Ref: Other Language Changes<7>-Footnote-61103413 +Ref: Other Language Changes<7>-Footnote-71103478 +Ref: Other Language Changes<7>-Footnote-81103543 +Ref: Other Language Changes<7>-Footnote-91103608 +Ref: Other Language Changes<7>-Footnote-101103673 +Node: New Modules<7>1103739 +Ref: whatsnew/3 7 new-modules1103878 +Ref: af61103878 +Node: contextvars1104019 +Ref: whatsnew/3 7 contextvars1104104 +Ref: af71104104 +Ref: whatsnew/3 7 whatsnew37-pep5671104104 +Ref: ac01104104 +Ref: contextvars-Footnote-11104833 +Node: dataclasses<3>1104875 +Ref: whatsnew/3 7 dataclasses1104991 +Ref: af91104991 +Ref: whatsnew/3 7 whatsnew37-pep5571104991 +Ref: ac11104991 +Ref: dataclasses<3>-Footnote-11105662 +Node: importlib resources<2>1105704 +Ref: whatsnew/3 7 importlib-resources1105800 +Ref: afc1105800 +Ref: whatsnew/3 7 whatsnew37-importlib-resources1105800 +Ref: ac21105800 +Ref: importlib resources<2>-Footnote-11106548 +Ref: importlib resources<2>-Footnote-21106613 +Node: Improved Modules<7>1106675 +Ref: whatsnew/3 7 improved-modules1106805 +Ref: afe1106805 +Node: argparse<3>1108252 +Ref: whatsnew/3 7 argparse1108338 +Ref: aff1108338 +Ref: argparse<3>-Footnote-11108572 +Node: asyncio<7>1108637 +Ref: whatsnew/3 7 asyncio1108740 +Ref: b011108740 +Ref: whatsnew/3 7 whatsnew37-asyncio1108740 +Ref: ac71108740 +Ref: asyncio<7>-Footnote-11115031 +Ref: asyncio<7>-Footnote-21115096 +Ref: asyncio<7>-Footnote-31115138 +Ref: asyncio<7>-Footnote-41115203 +Ref: asyncio<7>-Footnote-51115268 +Ref: asyncio<7>-Footnote-61115333 +Ref: asyncio<7>-Footnote-71115398 +Ref: asyncio<7>-Footnote-81115463 +Ref: asyncio<7>-Footnote-91115528 +Ref: asyncio<7>-Footnote-101115593 +Ref: asyncio<7>-Footnote-111115659 +Ref: asyncio<7>-Footnote-121115725 +Ref: asyncio<7>-Footnote-131115791 +Ref: asyncio<7>-Footnote-141115857 +Ref: asyncio<7>-Footnote-151115923 +Ref: asyncio<7>-Footnote-161115989 +Ref: asyncio<7>-Footnote-171116055 +Ref: asyncio<7>-Footnote-181116121 +Ref: asyncio<7>-Footnote-191116187 +Ref: asyncio<7>-Footnote-201116253 +Ref: asyncio<7>-Footnote-211116319 +Ref: asyncio<7>-Footnote-221116385 +Ref: asyncio<7>-Footnote-231116451 +Ref: asyncio<7>-Footnote-241116517 +Node: binascii1116583 +Ref: whatsnew/3 7 binascii1116686 +Ref: b201116686 +Ref: binascii-Footnote-11116965 +Node: calendar<2>1117030 +Ref: whatsnew/3 7 calendar1117137 +Ref: b221117137 +Ref: calendar<2>-Footnote-11117387 +Node: collections<2>1117452 +Ref: whatsnew/3 7 collections1117564 +Ref: b241117564 +Ref: collections<2>-Footnote-11117755 +Node: compileall<3>1117820 +Ref: whatsnew/3 7 compileall1117942 +Ref: b251117942 +Ref: compileall<3>-Footnote-11118339 +Node: concurrent futures<3>1118404 +Ref: whatsnew/3 7 concurrent-futures1118525 +Ref: b271118525 +Ref: concurrent futures<3>-Footnote-11118967 +Ref: concurrent futures<3>-Footnote-21119032 +Node: contextlib<3>1119097 +Ref: whatsnew/3 7 contextlib1119216 +Ref: b281119216 +Ref: contextlib<3>-Footnote-11119746 +Ref: contextlib<3>-Footnote-21119811 +Ref: contextlib<3>-Footnote-31119876 +Ref: contextlib<3>-Footnote-41119941 +Node: cProfile<2>1120006 +Ref: whatsnew/3 7 cprofile1120109 +Ref: b2d1120109 +Ref: cProfile<2>-Footnote-11120335 +Node: crypt1120400 +Ref: whatsnew/3 7 crypt1120501 +Ref: b2e1120501 +Ref: crypt-Footnote-11120822 +Ref: crypt-Footnote-21120887 +Node: datetime<4>1120952 +Ref: whatsnew/3 7 datetime1121048 +Ref: b2f1121048 +Ref: datetime<4>-Footnote-11121459 +Ref: datetime<4>-Footnote-21121524 +Node: dbm<2>1121588 +Ref: whatsnew/3 7 dbm1121686 +Ref: b311121686 +Node: decimal1121831 +Ref: whatsnew/3 7 decimal1121924 +Ref: b321121924 +Ref: decimal-Footnote-11122145 +Node: dis<3>1122210 +Ref: whatsnew/3 7 dis1122309 +Ref: b331122309 +Ref: dis<3>-Footnote-11122712 +Node: distutils<4>1122777 +Ref: whatsnew/3 7 distutils1122876 +Ref: b351122876 +Ref: distutils<4>-Footnote-11123124 +Node: enum<5>1123189 +Ref: whatsnew/3 7 enum1123294 +Ref: b361123294 +Ref: enum<5>-Footnote-11123962 +Ref: enum<5>-Footnote-21124027 +Node: functools<3>1124092 +Ref: whatsnew/3 7 functools1124190 +Ref: b381124190 +Ref: functools<3>-Footnote-11124419 +Node: gc<4>1124484 +Ref: whatsnew/3 7 gc1124582 +Ref: b391124582 +Ref: gc<4>-Footnote-11125121 +Node: hmac<2>1125186 +Ref: whatsnew/3 7 hmac1125283 +Ref: b3d1125283 +Ref: hmac<2>-Footnote-11125541 +Node: http client1125606 +Ref: whatsnew/3 7 http-client1125709 +Ref: b3f1125709 +Ref: http client-Footnote-11125966 +Node: http server1126031 +Ref: whatsnew/3 7 http-server1126143 +Ref: b421126143 +Ref: http server-Footnote-11127021 +Ref: http server-Footnote-21127086 +Ref: http server-Footnote-31127151 +Node: idlelib and IDLE1127216 +Ref: whatsnew/3 7 idlelib-and-idle1127329 +Ref: b451127329 +Ref: idlelib and IDLE-Footnote-11130338 +Ref: idlelib and IDLE-Footnote-21130403 +Ref: idlelib and IDLE-Footnote-31130470 +Ref: idlelib and IDLE-Footnote-41130535 +Ref: idlelib and IDLE-Footnote-51130600 +Ref: idlelib and IDLE-Footnote-61130665 +Ref: idlelib and IDLE-Footnote-71130730 +Ref: idlelib and IDLE-Footnote-81130795 +Ref: idlelib and IDLE-Footnote-91130860 +Ref: idlelib and IDLE-Footnote-101130925 +Ref: idlelib and IDLE-Footnote-111130993 +Ref: idlelib and IDLE-Footnote-121131058 +Ref: idlelib and IDLE-Footnote-131131124 +Node: importlib<4>1131190 +Ref: whatsnew/3 7 importlib1131297 +Ref: b461131297 +Ref: importlib<4>-Footnote-11132168 +Ref: importlib<4>-Footnote-21132233 +Ref: importlib<4>-Footnote-31132298 +Node: io<4>1132363 +Ref: whatsnew/3 7 io1132466 +Ref: b481132466 +Ref: io<4>-Footnote-11132731 +Ref: io<4>-Footnote-21132796 +Node: ipaddress<3>1132861 +Ref: whatsnew/3 7 ipaddress1132964 +Ref: b4a1132964 +Ref: ipaddress<3>-Footnote-11133284 +Node: itertools<5>1133349 +Ref: whatsnew/3 7 itertools1133456 +Ref: b4b1133456 +Ref: itertools<5>-Footnote-11133693 +Node: locale<4>1133758 +Ref: whatsnew/3 7 locale1133863 +Ref: b4d1133863 +Ref: locale<4>-Footnote-11134277 +Node: logging<3>1134342 +Ref: whatsnew/3 7 logging1134442 +Ref: b4e1134442 +Ref: logging<3>-Footnote-11134966 +Ref: logging<3>-Footnote-21135031 +Ref: logging<3>-Footnote-31135096 +Node: math<6>1135161 +Ref: whatsnew/3 7 math1135264 +Ref: b521135264 +Ref: math<6>-Footnote-11135477 +Node: mimetypes<2>1135542 +Ref: whatsnew/3 7 mimetypes1135641 +Ref: b541135641 +Ref: mimetypes<2>-Footnote-11135856 +Node: msilib1135921 +Ref: whatsnew/3 7 msilib1136031 +Ref: b551136031 +Ref: msilib-Footnote-11136226 +Node: multiprocessing<4>1136291 +Ref: whatsnew/3 7 multiprocessing1136394 +Ref: b561136394 +Ref: multiprocessing<4>-Footnote-11137041 +Ref: multiprocessing<4>-Footnote-21137106 +Ref: multiprocessing<4>-Footnote-31137171 +Node: os<7>1137236 +Ref: whatsnew/3 7 os1137343 +Ref: b5a1137343 +Ref: os<7>-Footnote-11138641 +Ref: os<7>-Footnote-21138706 +Ref: os<7>-Footnote-31138771 +Ref: os<7>-Footnote-41138836 +Ref: os<7>-Footnote-51138901 +Ref: os<7>-Footnote-61138966 +Ref: os<7>-Footnote-71139031 +Node: pathlib<8>1139096 +Ref: whatsnew/3 7 pathlib1139191 +Ref: b651139191 +Ref: pathlib<8>-Footnote-11139451 +Node: pdb<4>1139516 +Ref: whatsnew/3 7 pdb1139619 +Ref: b661139619 +Ref: pdb<4>-Footnote-11140029 +Ref: pdb<4>-Footnote-21140094 +Node: py_compile<3>1140159 +Ref: whatsnew/3 7 py-compile1140260 +Ref: b671140260 +Ref: py_compile<3>-Footnote-11140714 +Ref: py_compile<3>-Footnote-21140755 +Node: pydoc<2>1140820 +Ref: whatsnew/3 7 pydoc1140923 +Ref: b681140923 +Ref: pydoc<2>-Footnote-11141147 +Node: queue<2>1141212 +Ref: whatsnew/3 7 queue1141307 +Ref: b691141307 +Ref: queue<2>-Footnote-11141490 +Node: re<4>1141555 +Ref: whatsnew/3 7 re1141651 +Ref: b6b1141651 +Ref: re<4>-Footnote-11142733 +Ref: re<4>-Footnote-21142798 +Ref: re<4>-Footnote-31142863 +Ref: re<4>-Footnote-41142928 +Ref: re<4>-Footnote-51142993 +Node: signal<2>1143058 +Ref: whatsnew/3 7 signal1143155 +Ref: b6f1143155 +Ref: signal<2>-Footnote-11143474 +Node: socket<5>1143539 +Ref: whatsnew/3 7 socket1143643 +Ref: b711143643 +Ref: socket<5>-Footnote-11144731 +Ref: socket<5>-Footnote-21144796 +Ref: socket<5>-Footnote-31144861 +Ref: socket<5>-Footnote-41144926 +Ref: socket<5>-Footnote-51144991 +Ref: socket<5>-Footnote-61145056 +Node: socketserver1145121 +Ref: whatsnew/3 7 socketserver1145226 +Ref: b761145226 +Node: sqlite3<6>1145702 +Ref: whatsnew/3 7 sqlite31145804 +Ref: b791145804 +Ref: sqlite3<6>-Footnote-11146246 +Ref: sqlite3<6>-Footnote-21146311 +Node: ssl<5>1146376 +Ref: whatsnew/3 7 ssl1146475 +Ref: b7b1146475 +Ref: ssl<5>-Footnote-11149741 +Ref: ssl<5>-Footnote-21149806 +Ref: ssl<5>-Footnote-31149871 +Ref: ssl<5>-Footnote-41149936 +Ref: ssl<5>-Footnote-51150001 +Ref: ssl<5>-Footnote-61150066 +Ref: ssl<5>-Footnote-71150131 +Ref: ssl<5>-Footnote-81150196 +Ref: ssl<5>-Footnote-91150261 +Ref: ssl<5>-Footnote-101150326 +Ref: ssl<5>-Footnote-111150392 +Ref: ssl<5>-Footnote-121150458 +Ref: ssl<5>-Footnote-131150524 +Ref: ssl<5>-Footnote-141150590 +Node: string<2>1150646 +Ref: whatsnew/3 7 string1150748 +Ref: b841150748 +Ref: string<2>-Footnote-11151025 +Node: subprocess<2>1151092 +Ref: whatsnew/3 7 subprocess1151194 +Ref: b851151194 +Ref: subprocess<2>-Footnote-11152516 +Ref: subprocess<2>-Footnote-21152581 +Ref: subprocess<2>-Footnote-31152646 +Ref: subprocess<2>-Footnote-41152711 +Node: sys<8>1152776 +Ref: whatsnew/3 7 sys1152876 +Ref: b891152876 +Ref: sys<8>-Footnote-11153616 +Ref: sys<8>-Footnote-21153681 +Ref: sys<8>-Footnote-31153746 +Node: time<5>1153811 +Ref: whatsnew/3 7 time1153908 +Ref: b8d1153908 +Ref: time<5>-Footnote-11155117 +Ref: time<5>-Footnote-21155159 +Node: tkinter<5>1155224 +Ref: whatsnew/3 7 tkinter1155329 +Ref: b931155329 +Ref: tkinter<5>-Footnote-11155510 +Node: tracemalloc<2>1155575 +Ref: whatsnew/3 7 tracemalloc1155681 +Ref: b951155681 +Ref: tracemalloc<2>-Footnote-11156147 +Node: types<4>1156212 +Ref: whatsnew/3 7 types1156322 +Ref: b981156322 +Ref: types<4>-Footnote-11156837 +Ref: types<4>-Footnote-21156902 +Ref: types<4>-Footnote-31156967 +Ref: types<4>-Footnote-41157009 +Node: unicodedata<6>1157074 +Ref: whatsnew/3 7 unicodedata1157181 +Ref: b9d1157181 +Ref: unicodedata<6>-Footnote-11157384 +Node: unittest<7>1157440 +Ref: whatsnew/3 7 unittest1157552 +Ref: b9e1157552 +Ref: unittest<7>-Footnote-11157957 +Node: unittest mock1158022 +Ref: whatsnew/3 7 unittest-mock1158135 +Ref: b9f1158135 +Ref: unittest mock-Footnote-11158653 +Ref: unittest mock-Footnote-21158718 +Node: urllib parse<5>1158783 +Ref: whatsnew/3 7 urllib-parse1158887 +Ref: ba21158887 +Ref: urllib parse<5>-Footnote-11159200 +Ref: urllib parse<5>-Footnote-21159259 +Ref: urllib parse<5>-Footnote-31159318 +Node: uu1159383 +Ref: whatsnew/3 7 uu1159481 +Ref: ba41159481 +Ref: uu-Footnote-11159747 +Node: uuid<2>1159812 +Ref: whatsnew/3 7 uuid1159906 +Ref: ba51159906 +Ref: uuid<2>-Footnote-11160546 +Ref: uuid<2>-Footnote-21160611 +Node: warnings<3>1160676 +Ref: whatsnew/3 7 warnings1160774 +Ref: ba91160774 +Ref: warnings<3>-Footnote-11162199 +Ref: warnings<3>-Footnote-21162264 +Ref: warnings<3>-Footnote-31162329 +Ref: warnings<3>-Footnote-41162394 +Node: xml<5>1162459 +Ref: whatsnew/3 7 xml1162559 +Ref: bab1162559 +Ref: xml<5>-Footnote-11162843 +Node: xml etree1162898 +Ref: whatsnew/3 7 xml-etree1163000 +Ref: bac1163000 +Ref: xml etree-Footnote-11163341 +Node: xmlrpc server1163406 +Ref: whatsnew/3 7 xmlrpc-server1163508 +Ref: bae1163508 +Ref: xmlrpc server-Footnote-11163717 +Node: zipapp1163781 +Ref: whatsnew/3 7 zipapp1163884 +Ref: baf1163884 +Ref: zipapp-Footnote-11164408 +Ref: zipapp-Footnote-21164473 +Node: zipfile<2>1164538 +Ref: whatsnew/3 7 zipfile1164619 +Ref: bb11164619 +Ref: zipfile<2>-Footnote-11164984 +Ref: zipfile<2>-Footnote-21165049 +Node: C API Changes<6>1165114 +Ref: whatsnew/3 7 c-api-changes1165246 +Ref: bb21165246 +Ref: C API Changes<6>-Footnote-11169738 +Ref: C API Changes<6>-Footnote-21169803 +Ref: C API Changes<6>-Footnote-31169868 +Ref: C API Changes<6>-Footnote-41169933 +Ref: C API Changes<6>-Footnote-51169998 +Ref: C API Changes<6>-Footnote-61170063 +Ref: C API Changes<6>-Footnote-71170128 +Ref: C API Changes<6>-Footnote-81170193 +Ref: C API Changes<6>-Footnote-91170258 +Ref: C API Changes<6>-Footnote-101170323 +Ref: C API Changes<6>-Footnote-111170389 +Ref: C API Changes<6>-Footnote-121170455 +Ref: C API Changes<6>-Footnote-131170521 +Ref: C API Changes<6>-Footnote-141170587 +Ref: C API Changes<6>-Footnote-151170653 +Ref: C API Changes<6>-Footnote-161170718 +Ref: C API Changes<6>-Footnote-171170784 +Ref: C API Changes<6>-Footnote-181170850 +Ref: C API Changes<6>-Footnote-191170916 +Ref: C API Changes<6>-Footnote-201170982 +Node: Build Changes<6>1171048 +Ref: whatsnew/3 7 build-changes1171177 +Ref: bcb1171177 +Ref: Build Changes<6>-Footnote-11172310 +Ref: Build Changes<6>-Footnote-21172375 +Ref: Build Changes<6>-Footnote-31172440 +Node: Optimizations<7>1172505 +Ref: whatsnew/3 7 optimizations1172657 +Ref: bcc1172657 +Ref: whatsnew/3 7 whatsnew37-perf1172657 +Ref: ad01172657 +Ref: whatsnew/3 7 whatsnew37-asyncio-perf1173351 +Ref: b021173351 +Ref: Optimizations<7>-Footnote-11177905 +Ref: Optimizations<7>-Footnote-21177970 +Ref: Optimizations<7>-Footnote-31178035 +Ref: Optimizations<7>-Footnote-41178100 +Ref: Optimizations<7>-Footnote-51178165 +Ref: Optimizations<7>-Footnote-61178230 +Ref: Optimizations<7>-Footnote-71178295 +Ref: Optimizations<7>-Footnote-81178360 +Ref: Optimizations<7>-Footnote-91178425 +Ref: Optimizations<7>-Footnote-101178490 +Ref: Optimizations<7>-Footnote-111178556 +Ref: Optimizations<7>-Footnote-121178622 +Ref: Optimizations<7>-Footnote-131178688 +Ref: Optimizations<7>-Footnote-141178754 +Ref: Optimizations<7>-Footnote-151178820 +Ref: Optimizations<7>-Footnote-161178886 +Ref: Optimizations<7>-Footnote-171178952 +Ref: Optimizations<7>-Footnote-181179018 +Ref: Optimizations<7>-Footnote-191179084 +Ref: Optimizations<7>-Footnote-201179150 +Ref: Optimizations<7>-Footnote-211179216 +Ref: Optimizations<7>-Footnote-221179282 +Ref: Optimizations<7>-Footnote-231179348 +Ref: Optimizations<7>-Footnote-241179414 +Ref: Optimizations<7>-Footnote-251179480 +Ref: Optimizations<7>-Footnote-261179546 +Ref: Optimizations<7>-Footnote-271179612 +Ref: Optimizations<7>-Footnote-281179678 +Ref: Optimizations<7>-Footnote-291179744 +Ref: Optimizations<7>-Footnote-301179810 +Node: Other CPython Implementation Changes<2>1179876 +Ref: whatsnew/3 7 other-cpython-implementation-changes1180038 +Ref: bda1180038 +Ref: Other CPython Implementation Changes<2>-Footnote-11181445 +Ref: Other CPython Implementation Changes<2>-Footnote-21181510 +Ref: Other CPython Implementation Changes<2>-Footnote-31181575 +Ref: Other CPython Implementation Changes<2>-Footnote-41181640 +Ref: Other CPython Implementation Changes<2>-Footnote-51181705 +Node: Deprecated Python Behavior1181770 +Ref: whatsnew/3 7 deprecated-python-behavior1181963 +Ref: bdd1181963 +Ref: Deprecated Python Behavior-Footnote-11183072 +Ref: Deprecated Python Behavior-Footnote-21183137 +Node: Deprecated Python modules functions and methods1183202 +Ref: whatsnew/3 7 deprecated-python-modules-functions-and-methods1183399 +Ref: bdf1183399 +Node: aifc1183797 +Ref: whatsnew/3 7 aifc1183904 +Ref: be01183904 +Ref: aifc-Footnote-11184124 +Node: asyncio<8>1184189 +Ref: whatsnew/3 7 id21184319 +Ref: be11184319 +Ref: whatsnew/3 7 whatsnew37-asyncio-deprecated1184319 +Ref: b1f1184319 +Ref: asyncio<8>-Footnote-11184844 +Ref: asyncio<8>-Footnote-21184909 +Node: collections<3>1184974 +Ref: whatsnew/3 7 id31185106 +Ref: be21185106 +Ref: collections<3>-Footnote-11185485 +Node: dbm<3>1185550 +Ref: whatsnew/3 7 id41185679 +Ref: be31185679 +Ref: dbm<3>-Footnote-11186080 +Node: enum<6>1186145 +Ref: whatsnew/3 7 id51186270 +Ref: be41186270 +Ref: enum<6>-Footnote-11186720 +Node: gettext<2>1186785 +Ref: whatsnew/3 7 gettext1186916 +Ref: be51186916 +Ref: gettext<2>-Footnote-11187161 +Node: importlib<5>1187226 +Ref: whatsnew/3 7 id61187359 +Ref: be61187359 +Ref: importlib<5>-Footnote-11187874 +Node: locale<5>1187939 +Ref: whatsnew/3 7 id71188069 +Ref: be81188069 +Ref: locale<5>-Footnote-11188272 +Node: macpath1188337 +Ref: whatsnew/3 7 macpath1188467 +Ref: be91188467 +Ref: macpath-Footnote-11188657 +Node: threading<5>1188721 +Ref: whatsnew/3 7 threading1188851 +Ref: bea1188851 +Ref: threading<5>-Footnote-11189149 +Node: socket<6>1189214 +Ref: whatsnew/3 7 id81189343 +Ref: beb1189343 +Ref: socket<6>-Footnote-11189688 +Node: ssl<6>1189753 +Ref: whatsnew/3 7 id91189875 +Ref: bec1189875 +Ref: ssl<6>-Footnote-11190087 +Node: sunau1190152 +Ref: whatsnew/3 7 sunau1190271 +Ref: bed1190271 +Ref: sunau-Footnote-11190497 +Node: sys<9>1190562 +Ref: whatsnew/3 7 id101190679 +Ref: bee1190679 +Ref: sys<9>-Footnote-11190996 +Node: wave1191061 +Ref: whatsnew/3 7 wave1191164 +Ref: bef1191164 +Ref: wave-Footnote-11191392 +Node: Deprecated functions and types of the C API1191457 +Ref: whatsnew/3 7 deprecated-functions-and-types-of-the-c-api1191653 +Ref: bf01191653 +Ref: Deprecated functions and types of the C API-Footnote-11192311 +Ref: Deprecated functions and types of the C API-Footnote-21192376 +Node: Platform Support Removals1192441 +Ref: whatsnew/3 7 id111192617 +Ref: bf11192617 +Ref: whatsnew/3 7 platform-support-removals1192617 +Ref: b7e1192617 +Ref: Platform Support Removals-Footnote-11194029 +Ref: Platform Support Removals-Footnote-21194096 +Node: API and Feature Removals<2>1194176 +Ref: whatsnew/3 7 api-and-feature-removals1194324 +Ref: bf21194324 +Ref: API and Feature Removals<2>-Footnote-11197231 +Ref: API and Feature Removals<2>-Footnote-21197296 +Ref: API and Feature Removals<2>-Footnote-31197361 +Node: Module Removals1197426 +Ref: whatsnew/3 7 module-removals1197569 +Ref: bf61197569 +Ref: Module Removals-Footnote-11197904 +Node: Windows-only Changes1197969 +Ref: whatsnew/3 7 windows-only-changes1198106 +Ref: bf71198106 +Ref: Windows-only Changes-Footnote-11198983 +Ref: Windows-only Changes-Footnote-21199048 +Node: Porting to Python 3 71199113 +Ref: whatsnew/3 7 porting-to-python-3-71199266 +Ref: bf81199266 +Ref: whatsnew/3 7 porting-to-python-371199266 +Ref: ad11199266 +Node: Changes in Python Behavior1199728 +Ref: whatsnew/3 7 changes-in-python-behavior1199849 +Ref: bf91199849 +Ref: Changes in Python Behavior-Footnote-11201715 +Ref: Changes in Python Behavior-Footnote-21201780 +Ref: Changes in Python Behavior-Footnote-31201822 +Ref: Changes in Python Behavior-Footnote-41201887 +Ref: Changes in Python Behavior-Footnote-51201952 +Ref: Changes in Python Behavior-Footnote-61202017 +Node: Changes in the Python API<7>1202082 +Ref: whatsnew/3 7 changes-in-the-python-api1202235 +Ref: bfc1202235 +Ref: Changes in the Python API<7>-Footnote-11211789 +Ref: Changes in the Python API<7>-Footnote-21211854 +Ref: Changes in the Python API<7>-Footnote-31211919 +Ref: Changes in the Python API<7>-Footnote-41211984 +Ref: Changes in the Python API<7>-Footnote-51212049 +Ref: Changes in the Python API<7>-Footnote-61212114 +Ref: Changes in the Python API<7>-Footnote-71212179 +Ref: Changes in the Python API<7>-Footnote-81212244 +Ref: Changes in the Python API<7>-Footnote-91212309 +Ref: Changes in the Python API<7>-Footnote-101212374 +Ref: Changes in the Python API<7>-Footnote-111212440 +Ref: Changes in the Python API<7>-Footnote-121212506 +Ref: Changes in the Python API<7>-Footnote-131212572 +Ref: Changes in the Python API<7>-Footnote-141212638 +Ref: Changes in the Python API<7>-Footnote-151212681 +Ref: Changes in the Python API<7>-Footnote-161212747 +Ref: Changes in the Python API<7>-Footnote-171212813 +Ref: Changes in the Python API<7>-Footnote-181212879 +Ref: Changes in the Python API<7>-Footnote-191212945 +Ref: Changes in the Python API<7>-Footnote-201213011 +Ref: Changes in the Python API<7>-Footnote-211213077 +Ref: Changes in the Python API<7>-Footnote-221213143 +Ref: Changes in the Python API<7>-Footnote-231213209 +Ref: Changes in the Python API<7>-Footnote-241213275 +Ref: Changes in the Python API<7>-Footnote-251213341 +Ref: Changes in the Python API<7>-Footnote-261213407 +Ref: Changes in the Python API<7>-Footnote-271213473 +Ref: Changes in the Python API<7>-Footnote-281213539 +Ref: Changes in the Python API<7>-Footnote-291213605 +Ref: Changes in the Python API<7>-Footnote-301213671 +Node: Changes in the C API<5>1213737 +Ref: whatsnew/3 7 changes-in-the-c-api1213891 +Ref: c1d1213891 +Ref: Changes in the C API<5>-Footnote-11214527 +Node: CPython bytecode changes<6>1214592 +Ref: whatsnew/3 7 cpython-bytecode-changes1214741 +Ref: c1e1214741 +Ref: CPython bytecode changes<6>-Footnote-11215087 +Ref: CPython bytecode changes<6>-Footnote-21215152 +Node: Windows-only Changes<2>1215217 +Ref: whatsnew/3 7 id121215379 +Ref: c201215379 +Ref: Windows-only Changes<2>-Footnote-11215700 +Node: Other CPython implementation changes1215765 +Ref: whatsnew/3 7 id131215891 +Ref: c221215891 +Ref: Other CPython implementation changes-Footnote-11218221 +Ref: Other CPython implementation changes-Footnote-21218263 +Ref: Other CPython implementation changes-Footnote-31218328 +Node: Notable changes in Python 3 7 11218393 +Ref: whatsnew/3 7 notable-changes-in-python-3-7-11218557 +Ref: c241218557 +Ref: Notable changes in Python 3 7 1-Footnote-11219494 +Ref: Notable changes in Python 3 7 1-Footnote-21219559 +Ref: Notable changes in Python 3 7 1-Footnote-31219624 +Node: Notable changes in Python 3 7 21219689 +Ref: whatsnew/3 7 notable-changes-in-python-3-7-21219863 +Ref: c271219863 +Node: Notable changes in Python 3 7 61220358 +Ref: whatsnew/3 7 notable-changes-in-python-3-7-61220533 +Ref: c281220533 +Ref: Notable changes in Python 3 7 6-Footnote-11221044 +Node: Notable changes in Python 3 7 101221109 +Ref: whatsnew/3 7 notable-changes-in-python-3-7-101221285 +Ref: c291221285 +Ref: Notable changes in Python 3 7 10-Footnote-11222005 +Node: Notable changes in Python 3 7 111222070 +Ref: whatsnew/3 7 notable-changes-in-python-3-7-111222249 +Ref: c2a1222249 +Ref: Notable changes in Python 3 7 11-Footnote-11223166 +Ref: Notable changes in Python 3 7 11-Footnote-21223221 +Node: Notable security feature in 3 7 141223276 +Ref: whatsnew/3 7 notable-security-feature-in-3-7-141223414 +Ref: c2b1223414 +Ref: Notable security feature in 3 7 14-Footnote-11224144 +Node: What’s New In Python 3 61224200 +Ref: whatsnew/3 6 doc1224355 +Ref: c2c1224355 +Ref: whatsnew/3 6 what-s-new-in-python-3-61224355 +Ref: c2d1224355 +Ref: What’s New In Python 3 6-Footnote-11225700 +Ref: What’s New In Python 3 6-Footnote-21225760 +Node: Summary – Release highlights<6>1225802 +Ref: whatsnew/3 6 summary-release-highlights1225923 +Ref: c2e1225923 +Ref: Summary – Release highlights<6>-Footnote-11230163 +Ref: Summary – Release highlights<6>-Footnote-21230243 +Ref: Summary – Release highlights<6>-Footnote-31230333 +Node: New Features<13>1230375 +Ref: whatsnew/3 6 new-features1230530 +Ref: c421230530 +Ref: whatsnew/3 6 pypy-dict-implementation1230530 +Ref: c431230530 +Node: PEP 498 Formatted string literals1231940 +Ref: whatsnew/3 6 pep-498-formatted-string-literals1232074 +Ref: c441232074 +Ref: whatsnew/3 6 whatsnew36-pep4981232074 +Ref: c2f1232074 +Ref: PEP 498 Formatted string literals-Footnote-11233058 +Ref: PEP 498 Formatted string literals-Footnote-21233100 +Node: PEP 526 Syntax for variable annotations1233142 +Ref: whatsnew/3 6 pep-526-syntax-for-variable-annotations1233324 +Ref: c451233324 +Ref: whatsnew/3 6 whatsnew36-pep5261233324 +Ref: c311233324 +Ref: PEP 526 Syntax for variable annotations-Footnote-11234568 +Ref: PEP 526 Syntax for variable annotations-Footnote-21234610 +Ref: PEP 526 Syntax for variable annotations-Footnote-31234652 +Ref: PEP 526 Syntax for variable annotations-Footnote-41234687 +Node: PEP 515 Underscores in Numeric Literals1234728 +Ref: whatsnew/3 6 pep-515-underscores-in-numeric-literals1234908 +Ref: c461234908 +Ref: whatsnew/3 6 whatsnew36-pep5151234908 +Ref: c301234908 +Ref: PEP 515 Underscores in Numeric Literals-Footnote-11235977 +Ref: PEP 515 Underscores in Numeric Literals-Footnote-21236019 +Node: PEP 525 Asynchronous Generators1236061 +Ref: whatsnew/3 6 pep-525-asynchronous-generators1236237 +Ref: c471236237 +Ref: whatsnew/3 6 whatsnew36-pep5251236237 +Ref: c321236237 +Ref: PEP 525 Asynchronous Generators-Footnote-11237072 +Ref: PEP 525 Asynchronous Generators-Footnote-21237114 +Node: PEP 530 Asynchronous Comprehensions1237156 +Ref: whatsnew/3 6 pep-530-asynchronous-comprehensions1237340 +Ref: c481237340 +Ref: whatsnew/3 6 whatsnew36-pep5301237340 +Ref: c331237340 +Ref: PEP 530 Asynchronous Comprehensions-Footnote-11237898 +Ref: PEP 530 Asynchronous Comprehensions-Footnote-21237940 +Node: PEP 487 Simpler customization of class creation1237982 +Ref: whatsnew/3 6 pep-487-simpler-customization-of-class-creation1238175 +Ref: c491238175 +Ref: whatsnew/3 6 whatsnew36-pep4871238175 +Ref: c361238175 +Ref: PEP 487 Simpler customization of class creation-Footnote-11239267 +Node: PEP 487 Descriptor Protocol Enhancements1239309 +Ref: whatsnew/3 6 pep-487-descriptor-protocol-enhancements1239509 +Ref: c4c1239509 +Ref: whatsnew/3 6 whatsnew36-pep487-descriptors1239509 +Ref: c4d1239509 +Ref: PEP 487 Descriptor Protocol Enhancements-Footnote-11240760 +Ref: PEP 487 Descriptor Protocol Enhancements-Footnote-21240802 +Node: PEP 519 Adding a file system path protocol1240844 +Ref: whatsnew/3 6 pep-519-adding-a-file-system-path-protocol1241030 +Ref: c501241030 +Ref: whatsnew/3 6 whatsnew36-pep5191241030 +Ref: c3b1241030 +Ref: PEP 519 Adding a file system path protocol-Footnote-11243857 +Node: PEP 495 Local Time Disambiguation1243899 +Ref: whatsnew/3 6 pep-495-local-time-disambiguation1244096 +Ref: c561244096 +Ref: whatsnew/3 6 whatsnew36-pep4951244096 +Ref: c3c1244096 +Ref: PEP 495 Local Time Disambiguation-Footnote-11245509 +Ref: PEP 495 Local Time Disambiguation-Footnote-21245551 +Node: PEP 529 Change Windows filesystem encoding to UTF-81245593 +Ref: whatsnew/3 6 pep-529-change-windows-filesystem-encoding-to-utf-81245796 +Ref: c581245796 +Ref: whatsnew/3 6 whatsnew36-pep5291245796 +Ref: c401245796 +Ref: PEP 529 Change Windows filesystem encoding to UTF-8-Footnote-11246826 +Node: PEP 528 Change Windows console encoding to UTF-81246868 +Ref: whatsnew/3 6 pep-528-change-windows-console-encoding-to-utf-81247089 +Ref: c5a1247089 +Ref: whatsnew/3 6 whatsnew36-pep5281247089 +Ref: c3f1247089 +Ref: PEP 528 Change Windows console encoding to UTF-8-Footnote-11247792 +Node: PEP 520 Preserving Class Attribute Definition Order1247834 +Ref: whatsnew/3 6 pep-520-preserving-class-attribute-definition-order1248045 +Ref: c5c1248045 +Ref: whatsnew/3 6 whatsnew36-pep5201248045 +Ref: c371248045 +Ref: PEP 520 Preserving Class Attribute Definition Order-Footnote-11248685 +Node: PEP 468 Preserving Keyword Argument Order1248727 +Ref: whatsnew/3 6 pep-468-preserving-keyword-argument-order1248913 +Ref: c5f1248913 +Ref: whatsnew/3 6 whatsnew36-pep4681248913 +Ref: c381248913 +Ref: PEP 468 Preserving Keyword Argument Order-Footnote-11249274 +Node: New dict implementation1249316 +Ref: whatsnew/3 6 new-dict-implementation1249499 +Ref: c601249499 +Ref: whatsnew/3 6 whatsnew36-compactdict1249499 +Ref: c351249499 +Ref: New dict implementation-Footnote-11250477 +Ref: New dict implementation-Footnote-21250557 +Ref: New dict implementation-Footnote-31250647 +Ref: New dict implementation-Footnote-41250712 +Node: PEP 523 Adding a frame evaluation API to CPython1250792 +Ref: whatsnew/3 6 pep-523-adding-a-frame-evaluation-api-to-cpython1250967 +Ref: c611250967 +Ref: whatsnew/3 6 whatsnew36-pep5231250967 +Ref: c621250967 +Ref: PEP 523 Adding a frame evaluation API to CPython-Footnote-11252138 +Ref: PEP 523 Adding a frame evaluation API to CPython-Footnote-21252180 +Node: PYTHONMALLOC environment variable1252222 +Ref: whatsnew/3 6 pythonmalloc-environment-variable1252410 +Ref: c631252410 +Ref: whatsnew/3 6 whatsnew36-pythonmalloc1252410 +Ref: c3a1252410 +Ref: PYTHONMALLOC environment variable-Footnote-11255592 +Ref: PYTHONMALLOC environment variable-Footnote-21255657 +Node: DTrace and SystemTap probing support1255722 +Ref: whatsnew/3 6 dtrace-and-systemtap-probing-support1255853 +Ref: c6b1255853 +Ref: whatsnew/3 6 whatsnew36-tracing1255853 +Ref: c391255853 +Ref: DTrace and SystemTap probing support-Footnote-11256696 +Node: Other Language Changes<8>1256761 +Ref: whatsnew/3 6 other-language-changes1256897 +Ref: c6d1256897 +Ref: Other Language Changes<8>-Footnote-11258276 +Ref: Other Language Changes<8>-Footnote-21258341 +Ref: Other Language Changes<8>-Footnote-31258406 +Ref: Other Language Changes<8>-Footnote-41258471 +Node: New Modules<8>1258536 +Ref: whatsnew/3 6 new-modules1258675 +Ref: c701258675 +Node: secrets1258734 +Ref: whatsnew/3 6 secrets1258792 +Ref: c711258792 +Ref: whatsnew/3 6 whatsnew36-pep5061258792 +Ref: c341258792 +Ref: secrets-Footnote-11259475 +Node: Improved Modules<8>1259517 +Ref: whatsnew/3 6 improved-modules1259647 +Ref: c721259647 +Node: array<4>1261131 +Ref: whatsnew/3 6 array1261210 +Ref: c731261210 +Ref: array<4>-Footnote-11261503 +Node: ast<4>1261568 +Ref: whatsnew/3 6 ast1261666 +Ref: c741261666 +Ref: ast<4>-Footnote-11261915 +Node: asyncio<9>1261980 +Ref: whatsnew/3 6 asyncio1262081 +Ref: c751262081 +Ref: asyncio<9>-Footnote-11265421 +Ref: asyncio<9>-Footnote-21265486 +Ref: asyncio<9>-Footnote-31265531 +Ref: asyncio<9>-Footnote-41265596 +Ref: asyncio<9>-Footnote-51265661 +Ref: asyncio<9>-Footnote-61265726 +Ref: asyncio<9>-Footnote-71265791 +Ref: asyncio<9>-Footnote-81265856 +Ref: asyncio<9>-Footnote-91265921 +Ref: asyncio<9>-Footnote-101265986 +Ref: asyncio<9>-Footnote-111266052 +Ref: asyncio<9>-Footnote-121266118 +Node: binascii<2>1266184 +Ref: whatsnew/3 6 binascii1266284 +Ref: c7e1266284 +Ref: binascii<2>-Footnote-11266569 +Node: cmath1266634 +Ref: whatsnew/3 6 cmath1266738 +Ref: c801266738 +Ref: cmath-Footnote-11267209 +Ref: cmath-Footnote-21267274 +Ref: cmath-Footnote-31267316 +Node: collections<4>1267381 +Ref: whatsnew/3 6 collections1267495 +Ref: c871267495 +Ref: collections<4>-Footnote-11268596 +Ref: collections<4>-Footnote-21268661 +Ref: collections<4>-Footnote-31268726 +Ref: collections<4>-Footnote-41268791 +Ref: collections<4>-Footnote-51268856 +Ref: collections<4>-Footnote-61268921 +Node: concurrent futures<4>1268986 +Ref: whatsnew/3 6 concurrent-futures1269108 +Ref: c8b1269108 +Ref: concurrent futures<4>-Footnote-11269439 +Node: contextlib<4>1269504 +Ref: whatsnew/3 6 contextlib1269623 +Ref: c8c1269623 +Ref: contextlib<4>-Footnote-11270119 +Node: datetime<5>1270184 +Ref: whatsnew/3 6 datetime1270292 +Ref: c8f1270292 +Ref: datetime<5>-Footnote-11271309 +Ref: datetime<5>-Footnote-21271374 +Ref: datetime<5>-Footnote-31271439 +Ref: datetime<5>-Footnote-41271504 +Node: decimal<2>1271569 +Ref: whatsnew/3 6 decimal1271676 +Ref: c931271676 +Ref: decimal<2>-Footnote-11272089 +Node: distutils<5>1272154 +Ref: whatsnew/3 6 distutils1272258 +Ref: c951272258 +Ref: distutils<5>-Footnote-11272632 +Node: email<2>1272697 +Ref: whatsnew/3 6 email1272803 +Ref: c961272803 +Ref: email<2>-Footnote-11273719 +Ref: email<2>-Footnote-21273784 +Ref: email<2>-Footnote-31273849 +Node: encodings<2>1273914 +Ref: whatsnew/3 6 encodings1274015 +Ref: c9a1274015 +Ref: encodings<2>-Footnote-11274310 +Node: enum<7>1274375 +Ref: whatsnew/3 6 enum1274483 +Ref: c9b1274483 +Ref: enum<7>-Footnote-11275231 +Node: faulthandler<2>1275296 +Ref: whatsnew/3 6 faulthandler1275404 +Ref: c9d1275404 +Ref: faulthandler<2>-Footnote-11275667 +Node: fileinput<2>1275732 +Ref: whatsnew/3 6 fileinput1275843 +Ref: c9f1275843 +Ref: fileinput<2>-Footnote-11276031 +Node: hashlib<5>1276096 +Ref: whatsnew/3 6 hashlib1276206 +Ref: ca11276206 +Ref: hashlib<5>-Footnote-11277255 +Ref: hashlib<5>-Footnote-21277320 +Ref: hashlib<5>-Footnote-31277385 +Ref: hashlib<5>-Footnote-41277450 +Node: http client<2>1277515 +Ref: whatsnew/3 6 http-client1277632 +Ref: ca81277632 +Ref: http client<2>-Footnote-11277892 +Node: idlelib and IDLE<2>1277957 +Ref: whatsnew/3 6 idlelib-and-idle1278076 +Ref: cab1278076 +Ref: idlelib and IDLE<2>-Footnote-11281550 +Ref: idlelib and IDLE<2>-Footnote-21281615 +Ref: idlelib and IDLE<2>-Footnote-31281680 +Ref: idlelib and IDLE<2>-Footnote-41281747 +Ref: idlelib and IDLE<2>-Footnote-51281812 +Ref: idlelib and IDLE<2>-Footnote-61281877 +Ref: idlelib and IDLE<2>-Footnote-71281942 +Ref: idlelib and IDLE<2>-Footnote-81282007 +Ref: idlelib and IDLE<2>-Footnote-91282072 +Ref: idlelib and IDLE<2>-Footnote-101282137 +Ref: idlelib and IDLE<2>-Footnote-111282203 +Node: importlib<6>1282271 +Ref: whatsnew/3 6 importlib1282386 +Ref: cac1282386 +Ref: importlib<6>-Footnote-11283213 +Node: inspect<6>1283278 +Ref: whatsnew/3 6 inspect1283378 +Ref: cb21283378 +Ref: inspect<6>-Footnote-11284153 +Ref: inspect<6>-Footnote-21284218 +Node: json1284283 +Ref: whatsnew/3 6 json1284381 +Ref: cb31284381 +Ref: json-Footnote-11284653 +Node: logging<4>1284718 +Ref: whatsnew/3 6 logging1284813 +Ref: cb51284813 +Ref: logging<4>-Footnote-11285077 +Node: math<7>1285142 +Ref: whatsnew/3 6 math1285251 +Ref: cb71285251 +Ref: math<7>-Footnote-11285483 +Ref: math<7>-Footnote-21285548 +Node: multiprocessing<5>1285590 +Ref: whatsnew/3 6 multiprocessing1285694 +Ref: cb81285694 +Ref: multiprocessing<5>-Footnote-11285923 +Node: os<8>1285987 +Ref: whatsnew/3 6 os1286094 +Ref: cbb1286094 +Ref: os<8>-Footnote-11287094 +Ref: os<8>-Footnote-21287159 +Ref: os<8>-Footnote-31287201 +Node: pathlib<9>1287243 +Ref: whatsnew/3 6 pathlib1287338 +Ref: cbe1287338 +Ref: pathlib<9>-Footnote-11287572 +Node: pdb<5>1287637 +Ref: whatsnew/3 6 pdb1287736 +Ref: cbf1287736 +Node: pickle<2>1287893 +Ref: whatsnew/3 6 pickle1287993 +Ref: cc01287993 +Ref: pickle<2>-Footnote-11288310 +Node: pickletools1288375 +Ref: whatsnew/3 6 pickletools1288477 +Ref: cc21288477 +Ref: pickletools-Footnote-11288705 +Node: pydoc<3>1288770 +Ref: whatsnew/3 6 pydoc1288872 +Ref: cc41288872 +Ref: pydoc<3>-Footnote-11289266 +Ref: pydoc<3>-Footnote-21289330 +Node: random<4>1289395 +Ref: whatsnew/3 6 random1289491 +Ref: cc51289491 +Ref: random<4>-Footnote-11289746 +Node: re<5>1289811 +Ref: whatsnew/3 6 re1289907 +Ref: cc71289907 +Ref: re<5>-Footnote-11290618 +Ref: re<5>-Footnote-21290684 +Ref: re<5>-Footnote-31290749 +Node: readline1290814 +Ref: whatsnew/3 6 readline1290912 +Ref: cc91290912 +Ref: readline-Footnote-11291143 +Node: rlcompleter1291208 +Ref: whatsnew/3 6 rlcompleter1291309 +Ref: ccb1291309 +Ref: rlcompleter-Footnote-11291613 +Ref: rlcompleter-Footnote-21291678 +Node: shlex<2>1291743 +Ref: whatsnew/3 6 shlex1291843 +Ref: ccc1291843 +Ref: shlex<2>-Footnote-11292133 +Node: site<3>1292200 +Ref: whatsnew/3 6 site1292299 +Ref: ccf1292299 +Ref: site<3>-Footnote-11292563 +Node: sqlite3<7>1292628 +Ref: whatsnew/3 6 sqlite31292728 +Ref: cd01292728 +Ref: sqlite3<7>-Footnote-11292931 +Node: socket<7>1292996 +Ref: whatsnew/3 6 socket1293104 +Ref: cd21293104 +Ref: socket<7>-Footnote-11294061 +Ref: socket<7>-Footnote-21294126 +Ref: socket<7>-Footnote-31294191 +Ref: socket<7>-Footnote-41294256 +Ref: socket<7>-Footnote-51294321 +Node: socketserver<2>1294386 +Ref: whatsnew/3 6 socketserver1294490 +Ref: cd91294490 +Ref: socketserver<2>-Footnote-11295119 +Ref: socketserver<2>-Footnote-21295184 +Node: ssl<7>1295249 +Ref: whatsnew/3 6 ssl1295357 +Ref: cdc1295357 +Ref: ssl<7>-Footnote-11296780 +Ref: ssl<7>-Footnote-21296845 +Ref: ssl<7>-Footnote-31296910 +Ref: ssl<7>-Footnote-41296975 +Ref: ssl<7>-Footnote-51297040 +Ref: ssl<7>-Footnote-61297105 +Ref: ssl<7>-Footnote-71297170 +Ref: ssl<7>-Footnote-81297235 +Node: statistics<5>1297290 +Ref: whatsnew/3 6 statistics1297389 +Ref: ce01297389 +Ref: statistics<5>-Footnote-11297579 +Node: struct1297644 +Ref: whatsnew/3 6 struct1297750 +Ref: ce21297750 +Ref: struct-Footnote-11297981 +Node: subprocess<3>1298046 +Ref: whatsnew/3 6 subprocess1298146 +Ref: ce31298146 +Ref: subprocess<3>-Footnote-11298839 +Ref: subprocess<3>-Footnote-21298904 +Node: sys<10>1298968 +Ref: whatsnew/3 6 sys1299071 +Ref: ce51299071 +Ref: sys<10>-Footnote-11299672 +Ref: sys<10>-Footnote-21299737 +Node: telnetlib1299802 +Ref: whatsnew/3 6 telnetlib1299899 +Ref: ce81299899 +Ref: telnetlib-Footnote-11300074 +Node: time<6>1300139 +Ref: whatsnew/3 6 time1300235 +Ref: ce91300235 +Node: timeit1300374 +Ref: whatsnew/3 6 timeit1300471 +Ref: ceb1300471 +Ref: timeit-Footnote-11300930 +Ref: timeit-Footnote-21300994 +Node: tkinter<6>1301059 +Ref: whatsnew/3 6 tkinter1301161 +Ref: cee1301161 +Ref: tkinter<6>-Footnote-11301587 +Node: traceback<4>1301652 +Ref: whatsnew/3 6 traceback1301762 +Ref: cef1301762 +Ref: whatsnew/3 6 whatsnew36-traceback1301762 +Ref: c6f1301762 +Ref: traceback<4>-Footnote-11302397 +Node: tracemalloc<3>1302462 +Ref: whatsnew/3 6 tracemalloc1302571 +Ref: cf01302571 +Ref: tracemalloc<3>-Footnote-11302931 +Node: typing<9>1302996 +Ref: whatsnew/3 6 typing1303107 +Ref: cf21303107 +Ref: whatsnew/3 6 whatsnew36-typing1303107 +Ref: c3d1303107 +Ref: typing<9>-Footnote-11304759 +Ref: typing<9>-Footnote-21304809 +Ref: typing<9>-Footnote-31304874 +Ref: typing<9>-Footnote-41304939 +Ref: typing<9>-Footnote-51304981 +Ref: typing<9>-Footnote-61305031 +Ref: typing<9>-Footnote-71305083 +Node: unicodedata<7>1305135 +Ref: whatsnew/3 6 unicodedata1305248 +Ref: cf61305248 +Ref: unicodedata<7>-Footnote-11305436 +Node: unittest mock<2>1305487 +Ref: whatsnew/3 6 unittest-mock1305605 +Ref: cf71305605 +Ref: unittest mock<2>-Footnote-11306122 +Ref: unittest mock<2>-Footnote-21306187 +Node: urllib request1306252 +Ref: whatsnew/3 6 urllib-request1306374 +Ref: cfb1306374 +Ref: urllib request-Footnote-11306739 +Node: urllib robotparser1306804 +Ref: whatsnew/3 6 urllib-robotparser1306917 +Ref: cfc1306917 +Ref: urllib robotparser-Footnote-11307162 +Node: venv<5>1307227 +Ref: whatsnew/3 6 venv1307337 +Ref: cfe1307337 +Ref: venv<5>-Footnote-11307624 +Node: warnings<4>1307689 +Ref: whatsnew/3 6 warnings1307787 +Ref: cff1307787 +Ref: warnings<4>-Footnote-11309060 +Ref: warnings<4>-Footnote-21309125 +Node: winreg1309190 +Ref: whatsnew/3 6 winreg1309289 +Ref: d011309289 +Ref: winreg-Footnote-11309462 +Node: winsound1309527 +Ref: whatsnew/3 6 winsound1309628 +Ref: d031309628 +Ref: winsound-Footnote-11309827 +Node: xmlrpc client1309892 +Ref: whatsnew/3 6 xmlrpc-client1309997 +Ref: d071309997 +Ref: xmlrpc client-Footnote-11310290 +Node: zipfile<3>1310355 +Ref: whatsnew/3 6 zipfile1310456 +Ref: d081310456 +Ref: zipfile<3>-Footnote-11310990 +Ref: zipfile<3>-Footnote-21311055 +Node: zlib1311120 +Ref: whatsnew/3 6 zlib1311199 +Ref: d0c1311199 +Ref: zlib-Footnote-11311455 +Ref: zlib-Footnote-21311520 +Node: Optimizations<8>1311585 +Ref: whatsnew/3 6 optimizations1311727 +Ref: d0e1311727 +Ref: Optimizations<8>-Footnote-11315596 +Ref: Optimizations<8>-Footnote-21315661 +Ref: Optimizations<8>-Footnote-31315726 +Ref: Optimizations<8>-Footnote-41315791 +Ref: Optimizations<8>-Footnote-51315856 +Ref: Optimizations<8>-Footnote-61315921 +Ref: Optimizations<8>-Footnote-71315986 +Ref: Optimizations<8>-Footnote-81316051 +Ref: Optimizations<8>-Footnote-91316116 +Ref: Optimizations<8>-Footnote-101316181 +Ref: Optimizations<8>-Footnote-111316247 +Ref: Optimizations<8>-Footnote-121316313 +Ref: Optimizations<8>-Footnote-131316379 +Ref: Optimizations<8>-Footnote-141316445 +Ref: Optimizations<8>-Footnote-151316511 +Ref: Optimizations<8>-Footnote-161316577 +Ref: Optimizations<8>-Footnote-171316643 +Ref: Optimizations<8>-Footnote-181316709 +Ref: Optimizations<8>-Footnote-191316775 +Ref: Optimizations<8>-Footnote-201316841 +Ref: Optimizations<8>-Footnote-211316907 +Node: Build and C API Changes<2>1316973 +Ref: whatsnew/3 6 build-and-c-api-changes1317114 +Ref: d141317114 +Ref: Build and C API Changes<2>-Footnote-11319567 +Ref: Build and C API Changes<2>-Footnote-21319609 +Ref: Build and C API Changes<2>-Footnote-31319674 +Ref: Build and C API Changes<2>-Footnote-41319739 +Ref: Build and C API Changes<2>-Footnote-51319804 +Ref: Build and C API Changes<2>-Footnote-61319868 +Ref: Build and C API Changes<2>-Footnote-71319933 +Ref: Build and C API Changes<2>-Footnote-81319998 +Ref: Build and C API Changes<2>-Footnote-91320063 +Ref: Build and C API Changes<2>-Footnote-101320128 +Node: Other Improvements1320194 +Ref: whatsnew/3 6 other-improvements1320332 +Ref: d1a1320332 +Node: Deprecated<9>1320701 +Ref: whatsnew/3 6 deprecated1320823 +Ref: d1c1320823 +Node: New Keywords1321159 +Ref: whatsnew/3 6 new-keywords1321256 +Ref: d1d1321256 +Ref: New Keywords-Footnote-11321649 +Node: Deprecated Python behavior1321691 +Ref: whatsnew/3 6 deprecated-python-behavior1321847 +Ref: d1e1321847 +Ref: Deprecated Python behavior-Footnote-11323048 +Ref: Deprecated Python behavior-Footnote-21323113 +Ref: Deprecated Python behavior-Footnote-31323178 +Node: Deprecated Python modules functions and methods<2>1323243 +Ref: whatsnew/3 6 deprecated-python-modules-functions-and-methods1323393 +Ref: d201323393 +Node: asynchat1323702 +Ref: whatsnew/3 6 asynchat1323814 +Ref: d211323814 +Ref: asynchat-Footnote-11323998 +Node: asyncore1324063 +Ref: whatsnew/3 6 asyncore1324190 +Ref: d221324190 +Ref: asyncore-Footnote-11324374 +Node: dbm<4>1324439 +Ref: whatsnew/3 6 dbm1324570 +Ref: d231324570 +Ref: dbm<4>-Footnote-11324930 +Node: distutils<6>1324995 +Ref: whatsnew/3 6 id21325121 +Ref: d241325121 +Ref: distutils<6>-Footnote-11325451 +Node: grp1325516 +Ref: whatsnew/3 6 grp1325648 +Ref: d251325648 +Ref: grp-Footnote-11325846 +Node: importlib<7>1325911 +Ref: whatsnew/3 6 id31326036 +Ref: d271326036 +Node: os<9>1326690 +Ref: whatsnew/3 6 id41326817 +Ref: d2c1326817 +Ref: os<9>-Footnote-11327111 +Ref: os<9>-Footnote-21327176 +Node: re<6>1327241 +Ref: whatsnew/3 6 id51327362 +Ref: d2e1327362 +Ref: re<6>-Footnote-11327688 +Node: ssl<8>1327753 +Ref: whatsnew/3 6 id61327879 +Ref: d2f1327879 +Ref: ssl<8>-Footnote-11328674 +Ref: ssl<8>-Footnote-21328739 +Ref: ssl<8>-Footnote-31328804 +Node: tkinter<7>1328869 +Ref: whatsnew/3 6 id71328997 +Ref: d301328997 +Node: venv<6>1329150 +Ref: whatsnew/3 6 id81329263 +Ref: d311329263 +Ref: whatsnew/3 6 whatsnew36-venv1329263 +Ref: d321329263 +Ref: venv<6>-Footnote-11329614 +Node: xml<6>1329679 +Ref: whatsnew/3 6 xml1329849 +Ref: d331329849 +Ref: xml<6>-Footnote-11330153 +Node: Deprecated functions and types of the C API<2>1330208 +Ref: whatsnew/3 6 deprecated-functions-and-types-of-the-c-api1330352 +Ref: d341330352 +Node: Deprecated Build Options1330701 +Ref: whatsnew/3 6 deprecated-build-options1330830 +Ref: d361330830 +Node: Removed<9>1331271 +Ref: whatsnew/3 6 removed1331396 +Ref: d371331396 +Node: API and Feature Removals<3>1331494 +Ref: whatsnew/3 6 api-and-feature-removals1331568 +Ref: d381331568 +Ref: API and Feature Removals<3>-Footnote-11333658 +Ref: API and Feature Removals<3>-Footnote-21333723 +Node: Porting to Python 3 61333801 +Ref: whatsnew/3 6 porting-to-python-3-61333944 +Ref: d3b1333944 +Node: Changes in ‘python’ Command Behavior1334330 +Ref: whatsnew/3 6 changes-in-python-command-behavior1334465 +Ref: d3c1334465 +Ref: Changes in ‘python’ Command Behavior-Footnote-11334945 +Node: Changes in the Python API<8>1335010 +Ref: whatsnew/3 6 changes-in-the-python-api1335177 +Ref: d3d1335177 +Ref: Changes in the Python API<8>-Footnote-11345259 +Ref: Changes in the Python API<8>-Footnote-21345323 +Ref: Changes in the Python API<8>-Footnote-31345365 +Ref: Changes in the Python API<8>-Footnote-41345430 +Ref: Changes in the Python API<8>-Footnote-51345495 +Ref: Changes in the Python API<8>-Footnote-61345560 +Ref: Changes in the Python API<8>-Footnote-71345625 +Ref: Changes in the Python API<8>-Footnote-81345690 +Ref: Changes in the Python API<8>-Footnote-91345755 +Ref: Changes in the Python API<8>-Footnote-101345820 +Ref: Changes in the Python API<8>-Footnote-111345886 +Ref: Changes in the Python API<8>-Footnote-121345929 +Ref: Changes in the Python API<8>-Footnote-131345995 +Ref: Changes in the Python API<8>-Footnote-141346061 +Ref: Changes in the Python API<8>-Footnote-151346127 +Ref: Changes in the Python API<8>-Footnote-161346193 +Ref: Changes in the Python API<8>-Footnote-171346258 +Ref: Changes in the Python API<8>-Footnote-181346324 +Ref: Changes in the Python API<8>-Footnote-191346390 +Ref: Changes in the Python API<8>-Footnote-201346456 +Node: Changes in the C API<6>1346522 +Ref: whatsnew/3 6 changes-in-the-c-api1346676 +Ref: d4d1346676 +Ref: Changes in the C API<6>-Footnote-11347330 +Ref: Changes in the C API<6>-Footnote-21347395 +Node: CPython bytecode changes<7>1347459 +Ref: whatsnew/3 6 cpython-bytecode-changes1347576 +Ref: d4f1347576 +Ref: CPython bytecode changes<7>-Footnote-11349202 +Ref: CPython bytecode changes<7>-Footnote-21349267 +Ref: CPython bytecode changes<7>-Footnote-31349332 +Ref: CPython bytecode changes<7>-Footnote-41349397 +Ref: CPython bytecode changes<7>-Footnote-51349462 +Ref: CPython bytecode changes<7>-Footnote-61349527 +Ref: CPython bytecode changes<7>-Footnote-71349592 +Ref: CPython bytecode changes<7>-Footnote-81349657 +Ref: CPython bytecode changes<7>-Footnote-91349722 +Node: Notable changes in Python 3 6 21349787 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-21349951 +Ref: d561349951 +Node: New make regen-all build target1350115 +Ref: whatsnew/3 6 new-make-regen-all-build-target1350257 +Ref: d571350257 +Ref: New make regen-all build target-Footnote-11351046 +Ref: New make regen-all build target-Footnote-21351114 +Node: Removal of make touch build target1351179 +Ref: whatsnew/3 6 removal-of-make-touch-build-target1351321 +Ref: d581351321 +Ref: Removal of make touch build target-Footnote-11351751 +Node: Notable changes in Python 3 6 41351816 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-41351990 +Ref: d591351990 +Ref: Notable changes in Python 3 6 4-Footnote-11352363 +Ref: Notable changes in Python 3 6 4-Footnote-21352428 +Node: Notable changes in Python 3 6 51352493 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-51352667 +Ref: d5a1352667 +Ref: Notable changes in Python 3 6 5-Footnote-11352970 +Node: Notable changes in Python 3 6 71353035 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-71353210 +Ref: d5b1353210 +Ref: Notable changes in Python 3 6 7-Footnote-11353716 +Ref: Notable changes in Python 3 6 7-Footnote-21353771 +Node: Notable changes in Python 3 6 101353836 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-101354012 +Ref: d5c1354012 +Ref: Notable changes in Python 3 6 10-Footnote-11354525 +Node: Notable changes in Python 3 6 131354590 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-131354767 +Ref: d5d1354767 +Ref: Notable changes in Python 3 6 13-Footnote-11355487 +Node: Notable changes in Python 3 6 141355552 +Ref: whatsnew/3 6 notable-changes-in-python-3-6-141355688 +Ref: d5e1355688 +Ref: Notable changes in Python 3 6 14-Footnote-11356605 +Ref: Notable changes in Python 3 6 14-Footnote-21356660 +Node: What’s New In Python 3 51356715 +Ref: whatsnew/3 5 doc1356870 +Ref: d5f1356870 +Ref: whatsnew/3 5 what-s-new-in-python-3-51356870 +Ref: d601356870 +Ref: What’s New In Python 3 5-Footnote-11357812 +Ref: What’s New In Python 3 5-Footnote-21357872 +Node: Summary – Release highlights<7>1357914 +Ref: whatsnew/3 5 summary-release-highlights1358035 +Ref: d611358035 +Ref: Summary – Release highlights<7>-Footnote-11361763 +Ref: Summary – Release highlights<7>-Footnote-21361827 +Ref: Summary – Release highlights<7>-Footnote-31361892 +Ref: Summary – Release highlights<7>-Footnote-41361957 +Ref: Summary – Release highlights<7>-Footnote-51362022 +Ref: Summary – Release highlights<7>-Footnote-61362087 +Ref: Summary – Release highlights<7>-Footnote-71362152 +Node: New Features<14>1362217 +Ref: whatsnew/3 5 new-features1362372 +Ref: d741362372 +Node: PEP 492 - Coroutines with async and await syntax1363468 +Ref: whatsnew/3 5 pep-492-coroutines-with-async-and-await-syntax1363640 +Ref: d751363640 +Ref: whatsnew/3 5 whatsnew-pep-4921363640 +Ref: d621363640 +Ref: PEP 492 - Coroutines with async and await syntax-Footnote-11366713 +Ref: PEP 492 - Coroutines with async and await syntax-Footnote-21366755 +Node: PEP 465 - A dedicated infix operator for matrix multiplication1366797 +Ref: whatsnew/3 5 pep-465-a-dedicated-infix-operator-for-matrix-multiplication1367024 +Ref: d7a1367024 +Ref: whatsnew/3 5 whatsnew-pep-4651367024 +Ref: d631367024 +Ref: PEP 465 - A dedicated infix operator for matrix multiplication-Footnote-11368411 +Ref: PEP 465 - A dedicated infix operator for matrix multiplication-Footnote-21368453 +Node: PEP 448 - Additional Unpacking Generalizations1368495 +Ref: whatsnew/3 5 pep-448-additional-unpacking-generalizations1368734 +Ref: d7b1368734 +Ref: whatsnew/3 5 whatsnew-pep-4481368734 +Ref: d641368734 +Ref: PEP 448 - Additional Unpacking Generalizations-Footnote-11369827 +Ref: PEP 448 - Additional Unpacking Generalizations-Footnote-21369869 +Node: PEP 461 - percent formatting support for bytes and bytearray1369911 +Ref: whatsnew/3 5 pep-461-percent-formatting-support-for-bytes-and-bytearray1370108 +Ref: d7f1370108 +Ref: whatsnew/3 5 whatsnew-pep-4611370108 +Ref: d671370108 +Ref: PEP 461 - percent formatting support for bytes and bytearray-Footnote-11371644 +Ref: PEP 461 - percent formatting support for bytes and bytearray-Footnote-21371686 +Node: PEP 484 - Type Hints1371728 +Ref: whatsnew/3 5 pep-484-type-hints1371951 +Ref: d811371951 +Ref: whatsnew/3 5 whatsnew-pep-4841371951 +Ref: d651371951 +Ref: PEP 484 - Type Hints-Footnote-11373598 +Ref: PEP 484 - Type Hints-Footnote-21373640 +Ref: PEP 484 - Type Hints-Footnote-31373682 +Ref: PEP 484 - Type Hints-Footnote-41373712 +Ref: PEP 484 - Type Hints-Footnote-51373754 +Node: PEP 471 - os scandir function – a better and faster directory iterator1373796 +Ref: whatsnew/3 5 pep-471-os-scandir-function-a-better-and-faster-directory-iterator1374004 +Ref: d821374004 +Ref: whatsnew/3 5 whatsnew-pep-4711374004 +Ref: d701374004 +Ref: PEP 471 - os scandir function – a better and faster directory iterator-Footnote-11375360 +Ref: PEP 471 - os scandir function – a better and faster directory iterator-Footnote-21375402 +Node: PEP 475 Retry system calls failing with EINTR1375444 +Ref: whatsnew/3 5 pep-475-retry-system-calls-failing-with-eintr1375687 +Ref: d841375687 +Ref: whatsnew/3 5 whatsnew-pep-4751375687 +Ref: d851375687 +Ref: PEP 475 Retry system calls failing with EINTR-Footnote-11378751 +Ref: PEP 475 Retry system calls failing with EINTR-Footnote-21378793 +Node: PEP 479 Change StopIteration handling inside generators1378835 +Ref: whatsnew/3 5 pep-479-change-stopiteration-handling-inside-generators1379057 +Ref: dab1379057 +Ref: whatsnew/3 5 whatsnew-pep-4791379057 +Ref: d1f1379057 +Ref: PEP 479 Change StopIteration handling inside generators-Footnote-11380987 +Ref: PEP 479 Change StopIteration handling inside generators-Footnote-21381029 +Node: PEP 485 A function for testing approximate equality1381071 +Ref: whatsnew/3 5 pep-485-a-function-for-testing-approximate-equality1381310 +Ref: dad1381310 +Ref: whatsnew/3 5 whatsnew-pep-4851381310 +Ref: dae1381310 +Ref: PEP 485 A function for testing approximate equality-Footnote-11382493 +Ref: PEP 485 A function for testing approximate equality-Footnote-21382535 +Node: PEP 486 Make the Python Launcher aware of virtual environments1382577 +Ref: whatsnew/3 5 pep-486-make-the-python-launcher-aware-of-virtual-environments1382793 +Ref: db11382793 +Ref: whatsnew/3 5 whatsnew-pep-4861382793 +Ref: db21382793 +Ref: PEP 486 Make the Python Launcher aware of virtual environments-Footnote-11383367 +Ref: PEP 486 Make the Python Launcher aware of virtual environments-Footnote-21383409 +Ref: PEP 486 Make the Python Launcher aware of virtual environments-Footnote-31383451 +Node: PEP 488 Elimination of PYO files1383493 +Ref: whatsnew/3 5 pep-488-elimination-of-pyo-files1383709 +Ref: db31383709 +Ref: whatsnew/3 5 whatsnew-pep-4881383709 +Ref: d6c1383709 +Ref: PEP 488 Elimination of PYO files-Footnote-11384575 +Ref: PEP 488 Elimination of PYO files-Footnote-21384617 +Node: PEP 489 Multi-phase extension module initialization1384659 +Ref: whatsnew/3 5 pep-489-multi-phase-extension-module-initialization1384804 +Ref: db61384804 +Ref: whatsnew/3 5 whatsnew-pep-4891384804 +Ref: d6d1384804 +Ref: PEP 489 Multi-phase extension module initialization-Footnote-11385567 +Ref: PEP 489 Multi-phase extension module initialization-Footnote-21385609 +Ref: PEP 489 Multi-phase extension module initialization-Footnote-31385651 +Node: Other Language Changes<9>1385693 +Ref: whatsnew/3 5 other-language-changes1385829 +Ref: db71385829 +Ref: Other Language Changes<9>-Footnote-11386827 +Ref: Other Language Changes<9>-Footnote-21386892 +Ref: Other Language Changes<9>-Footnote-31386957 +Ref: Other Language Changes<9>-Footnote-41387022 +Ref: Other Language Changes<9>-Footnote-51387087 +Ref: Other Language Changes<9>-Footnote-61387152 +Ref: Other Language Changes<9>-Footnote-71387217 +Node: New Modules<9>1387282 +Ref: whatsnew/3 5 new-modules1387421 +Ref: db91387421 +Node: typing<10>1387511 +Ref: whatsnew/3 5 typing1387590 +Ref: dba1387590 +Node: zipapp<2>1387801 +Ref: whatsnew/3 5 whatsnew-zipapp1387880 +Ref: d661387880 +Ref: whatsnew/3 5 zipapp1387880 +Ref: dbb1387880 +Ref: zipapp<2>-Footnote-11388590 +Ref: zipapp<2>-Footnote-21388632 +Ref: zipapp<2>-Footnote-31388699 +Ref: zipapp<2>-Footnote-41388764 +Node: Improved Modules<9>1388806 +Ref: whatsnew/3 5 improved-modules1388946 +Ref: dbc1388946 +Node: argparse<4>1390649 +Ref: whatsnew/3 5 argparse1390736 +Ref: dbd1390736 +Ref: argparse<4>-Footnote-11391059 +Node: asyncio<10>1391124 +Ref: whatsnew/3 5 asyncio1391223 +Ref: dc01391223 +Ref: asyncio<10>-Footnote-11394701 +Ref: asyncio<10>-Footnote-21394766 +Ref: asyncio<10>-Footnote-31394831 +Node: bz21394876 +Ref: whatsnew/3 5 bz21394967 +Ref: dca1394967 +Ref: bz2-Footnote-11395222 +Node: cgi1395287 +Ref: whatsnew/3 5 cgi1395375 +Ref: dcc1395375 +Ref: cgi-Footnote-11395570 +Node: cmath<2>1395635 +Ref: whatsnew/3 5 cmath1395724 +Ref: dcd1395724 +Ref: cmath<2>-Footnote-11395938 +Node: code1396003 +Ref: whatsnew/3 5 code1396103 +Ref: dce1396103 +Ref: code-Footnote-11396354 +Node: collections<5>1396419 +Ref: whatsnew/3 5 collections1396529 +Ref: dd01396529 +Ref: whatsnew/3 5 whatsnew-ordereddict1396570 +Ref: d6e1396570 +Ref: collections<5>-Footnote-11397840 +Ref: collections<5>-Footnote-21397905 +Ref: collections<5>-Footnote-31397970 +Ref: collections<5>-Footnote-41398035 +Ref: collections<5>-Footnote-51398100 +Node: collections abc<3>1398165 +Ref: whatsnew/3 5 collections-abc1398284 +Ref: dd91398284 +Ref: collections abc<3>-Footnote-11398954 +Ref: collections abc<3>-Footnote-21399019 +Ref: collections abc<3>-Footnote-31399084 +Ref: collections abc<3>-Footnote-41399149 +Node: compileall<4>1399197 +Ref: whatsnew/3 5 compileall1399323 +Ref: ddf1399323 +Ref: compileall<4>-Footnote-11400198 +Ref: compileall<4>-Footnote-21400263 +Ref: compileall<4>-Footnote-31400328 +Node: concurrent futures<5>1400393 +Ref: whatsnew/3 5 concurrent-futures1400516 +Ref: de21400516 +Ref: concurrent futures<5>-Footnote-11401018 +Ref: concurrent futures<5>-Footnote-21401083 +Node: configparser<4>1401148 +Ref: whatsnew/3 5 configparser1401271 +Ref: de41401271 +Ref: configparser<4>-Footnote-11402222 +Node: contextlib<5>1402287 +Ref: whatsnew/3 5 contextlib1402395 +Ref: de51402395 +Ref: contextlib<5>-Footnote-11403005 +Node: csv<3>1403070 +Ref: whatsnew/3 5 csv1403172 +Ref: de81403172 +Ref: csv<3>-Footnote-11403376 +Node: curses<4>1403441 +Ref: whatsnew/3 5 curses1403536 +Ref: dea1403536 +Ref: curses<4>-Footnote-11403812 +Node: dbm<5>1403876 +Ref: whatsnew/3 5 dbm1403972 +Ref: dec1403972 +Ref: dbm<5>-Footnote-11404175 +Node: difflib1404240 +Ref: whatsnew/3 5 difflib1404339 +Ref: ded1404339 +Ref: difflib-Footnote-11404875 +Ref: difflib-Footnote-21404939 +Node: distutils<7>1405004 +Ref: whatsnew/3 5 distutils1405107 +Ref: df01405107 +Ref: distutils<7>-Footnote-11405558 +Ref: distutils<7>-Footnote-21405622 +Node: doctest<3>1405687 +Ref: whatsnew/3 5 doctest1405791 +Ref: df11405791 +Ref: doctest<3>-Footnote-11406076 +Node: email<3>1406141 +Ref: whatsnew/3 5 email1406240 +Ref: df41406240 +Ref: email<3>-Footnote-11407351 +Ref: email<3>-Footnote-21407416 +Ref: email<3>-Footnote-31407481 +Ref: email<3>-Footnote-41407540 +Ref: email<3>-Footnote-51407599 +Ref: email<3>-Footnote-61407664 +Node: enum<8>1407729 +Ref: whatsnew/3 5 enum1407833 +Ref: dfa1407833 +Ref: enum<8>-Footnote-11408224 +Node: faulthandler<3>1408289 +Ref: whatsnew/3 5 faulthandler1408397 +Ref: dfb1408397 +Ref: faulthandler<3>-Footnote-11408709 +Node: functools<4>1408774 +Ref: whatsnew/3 5 functools1408882 +Ref: dff1408882 +Ref: whatsnew/3 5 whatsnew-lrucache1408921 +Ref: d711408921 +Ref: functools<4>-Footnote-11409147 +Node: glob<3>1409212 +Ref: whatsnew/3 5 glob1409312 +Ref: e001409312 +Ref: glob<3>-Footnote-11409564 +Node: gzip<4>1409629 +Ref: whatsnew/3 5 gzip1409722 +Ref: e011409722 +Ref: gzip<4>-Footnote-11409947 +Node: heapq1410012 +Ref: whatsnew/3 5 heapq1410105 +Ref: e021410105 +Ref: heapq-Footnote-11410745 +Node: http<2>1410810 +Ref: whatsnew/3 5 http1410910 +Ref: e051410910 +Ref: http<2>-Footnote-11411156 +Node: http client<3>1411221 +Ref: whatsnew/3 5 http-client1411335 +Ref: e061411335 +Ref: http client<3>-Footnote-11412079 +Node: idlelib and IDLE<3>1412143 +Ref: whatsnew/3 5 idlelib-and-idle1412260 +Ref: e0a1412260 +Node: imaplib<2>1412654 +Ref: whatsnew/3 5 imaplib1412763 +Ref: e0b1412763 +Ref: imaplib<2>-Footnote-11413642 +Ref: imaplib<2>-Footnote-21413706 +Ref: imaplib<2>-Footnote-31413765 +Ref: imaplib<2>-Footnote-41413824 +Ref: imaplib<2>-Footnote-51413883 +Ref: imaplib<2>-Footnote-61413948 +Node: imghdr1414013 +Ref: whatsnew/3 5 imghdr1414115 +Ref: e0e1414115 +Ref: imghdr-Footnote-11414403 +Ref: imghdr-Footnote-21414435 +Ref: imghdr-Footnote-31414500 +Ref: imghdr-Footnote-41414543 +Node: importlib<8>1414608 +Ref: whatsnew/3 5 importlib1414710 +Ref: e0f1414710 +Ref: importlib<8>-Footnote-11415545 +Ref: importlib<8>-Footnote-21415610 +Ref: importlib<8>-Footnote-31415675 +Node: inspect<7>1415740 +Ref: whatsnew/3 5 inspect1415841 +Ref: e131415841 +Ref: inspect<7>-Footnote-11417398 +Ref: inspect<7>-Footnote-21417463 +Ref: inspect<7>-Footnote-31417528 +Ref: inspect<7>-Footnote-41417593 +Ref: inspect<7>-Footnote-51417658 +Ref: inspect<7>-Footnote-61417723 +Ref: inspect<7>-Footnote-71417788 +Ref: inspect<7>-Footnote-81417853 +Node: io<5>1417918 +Ref: whatsnew/3 5 io1418019 +Ref: e191418019 +Ref: io<5>-Footnote-11418317 +Node: ipaddress<4>1418382 +Ref: whatsnew/3 5 ipaddress1418480 +Ref: e1d1418480 +Ref: ipaddress<4>-Footnote-11419508 +Ref: ipaddress<4>-Footnote-21419573 +Node: json<2>1419638 +Ref: whatsnew/3 5 json1419743 +Ref: e1e1419743 +Ref: json<2>-Footnote-11420243 +Ref: json<2>-Footnote-21420308 +Node: linecache<2>1420373 +Ref: whatsnew/3 5 linecache1420475 +Ref: e201420475 +Ref: linecache<2>-Footnote-11420885 +Node: locale<6>1420950 +Ref: whatsnew/3 5 locale1421055 +Ref: e231421055 +Ref: locale<6>-Footnote-11421620 +Node: logging<5>1421685 +Ref: whatsnew/3 5 logging1421782 +Ref: e251421782 +Ref: logging<5>-Footnote-11422752 +Ref: logging<5>-Footnote-21422817 +Node: lzma1422882 +Ref: whatsnew/3 5 lzma1422977 +Ref: e2c1422977 +Ref: lzma-Footnote-11423239 +Node: math<8>1423304 +Ref: whatsnew/3 5 math1423407 +Ref: e2e1423407 +Ref: math<8>-Footnote-11423949 +Ref: math<8>-Footnote-21424014 +Ref: math<8>-Footnote-31424079 +Node: multiprocessing<6>1424144 +Ref: whatsnew/3 5 multiprocessing1424254 +Ref: e2f1424254 +Ref: multiprocessing<6>-Footnote-11424504 +Node: operator<2>1424569 +Ref: whatsnew/3 5 operator1424678 +Ref: e311424678 +Ref: operator<2>-Footnote-11425083 +Ref: operator<2>-Footnote-21425148 +Node: os<10>1425213 +Ref: whatsnew/3 5 os1425315 +Ref: e361425315 +Ref: os<10>-Footnote-11427163 +Ref: os<10>-Footnote-21427228 +Ref: os<10>-Footnote-31427293 +Ref: os<10>-Footnote-41427358 +Ref: os<10>-Footnote-51427423 +Ref: os<10>-Footnote-61427488 +Node: pathlib<10>1427553 +Ref: whatsnew/3 5 pathlib1427653 +Ref: e3e1427653 +Ref: pathlib<10>-Footnote-11429124 +Ref: pathlib<10>-Footnote-21429189 +Ref: pathlib<10>-Footnote-31429254 +Ref: pathlib<10>-Footnote-41429319 +Ref: pathlib<10>-Footnote-51429384 +Node: pickle<3>1429449 +Ref: whatsnew/3 5 pickle1429552 +Ref: e471429552 +Ref: pickle<3>-Footnote-11429868 +Node: poplib<2>1429933 +Ref: whatsnew/3 5 poplib1430030 +Ref: e481430030 +Ref: poplib<2>-Footnote-11430272 +Ref: poplib<2>-Footnote-21430331 +Node: re<7>1430396 +Ref: whatsnew/3 5 re1430495 +Ref: e4a1430495 +Ref: re<7>-Footnote-11431700 +Ref: re<7>-Footnote-21431764 +Ref: re<7>-Footnote-31431829 +Ref: re<7>-Footnote-41431896 +Node: readline<2>1431961 +Ref: whatsnew/3 5 readline1432060 +Ref: e4b1432060 +Ref: readline<2>-Footnote-11432323 +Node: selectors1432388 +Ref: whatsnew/3 5 selectors1432491 +Ref: e4d1432491 +Ref: selectors-Footnote-11432713 +Node: shutil<5>1432778 +Ref: whatsnew/3 5 shutil1432879 +Ref: e4e1432879 +Ref: shutil<5>-Footnote-11433358 +Ref: shutil<5>-Footnote-21433423 +Node: signal<3>1433487 +Ref: whatsnew/3 5 signal1433587 +Ref: e4f1433587 +Ref: signal<3>-Footnote-11434054 +Ref: signal<3>-Footnote-21434119 +Node: smtpd<2>1434184 +Ref: whatsnew/3 5 smtpd1434285 +Ref: e501434285 +Ref: smtpd<2>-Footnote-11435921 +Ref: smtpd<2>-Footnote-21435986 +Ref: smtpd<2>-Footnote-31436045 +Ref: smtpd<2>-Footnote-41436110 +Ref: smtpd<2>-Footnote-51436169 +Ref: smtpd<2>-Footnote-61436234 +Node: smtplib<2>1436299 +Ref: whatsnew/3 5 smtplib1436397 +Ref: e511436397 +Ref: smtplib<2>-Footnote-11437018 +Ref: smtplib<2>-Footnote-21437083 +Ref: smtplib<2>-Footnote-31437148 +Ref: smtplib<2>-Footnote-41437207 +Node: sndhdr1437272 +Ref: whatsnew/3 5 sndhdr1437371 +Ref: e561437371 +Ref: sndhdr-Footnote-11437574 +Node: socket<8>1437639 +Ref: whatsnew/3 5 socket1437734 +Ref: e571437734 +Ref: socket<8>-Footnote-11438705 +Ref: socket<8>-Footnote-21438770 +Ref: socket<8>-Footnote-31438835 +Ref: socket<8>-Footnote-41438900 +Node: ssl<9>1438965 +Ref: whatsnew/3 5 ssl1439064 +Ref: e5b1439064 +Node: Memory BIO Support1439193 +Ref: whatsnew/3 5 memory-bio-support1439309 +Ref: e5c1439309 +Ref: whatsnew/3 5 whatsnew-sslmemorybio1439309 +Ref: d6f1439309 +Ref: Memory BIO Support-Footnote-11440192 +Node: Application-Layer Protocol Negotiation Support1440257 +Ref: whatsnew/3 5 application-layer-protocol-negotiation-support1440395 +Ref: e5e1440395 +Ref: Application-Layer Protocol Negotiation Support-Footnote-11441100 +Ref: Application-Layer Protocol Negotiation Support-Footnote-21441165 +Node: Other Changes1441224 +Ref: whatsnew/3 5 other-changes1441335 +Ref: e621441335 +Ref: Other Changes-Footnote-11442921 +Ref: Other Changes-Footnote-21442986 +Ref: Other Changes-Footnote-31443051 +Ref: Other Changes-Footnote-41443116 +Ref: Other Changes-Footnote-51443175 +Ref: Other Changes-Footnote-61443240 +Ref: Other Changes-Footnote-71443305 +Ref: Other Changes-Footnote-81443370 +Node: sqlite3<8>1443435 +Ref: whatsnew/3 5 sqlite31443538 +Ref: e6b1443538 +Ref: sqlite3<8>-Footnote-11443867 +Ref: sqlite3<8>-Footnote-21443932 +Node: subprocess<4>1443997 +Ref: whatsnew/3 5 subprocess1444101 +Ref: e6d1444101 +Ref: whatsnew/3 5 whatsnew-subprocess1444101 +Ref: d721444101 +Ref: subprocess<4>-Footnote-11445115 +Node: sys<11>1445180 +Ref: whatsnew/3 5 sys1445286 +Ref: e6f1445286 +Ref: sys<11>-Footnote-11445936 +Ref: sys<11>-Footnote-21446001 +Node: sysconfig<2>1446066 +Ref: whatsnew/3 5 sysconfig1446169 +Ref: e701446169 +Ref: sysconfig<2>-Footnote-11446402 +Node: tarfile<7>1446467 +Ref: whatsnew/3 5 tarfile1446575 +Ref: e711446575 +Ref: tarfile<7>-Footnote-11447486 +Ref: tarfile<7>-Footnote-21447551 +Ref: tarfile<7>-Footnote-31447616 +Node: threading<6>1447681 +Ref: whatsnew/3 5 threading1447784 +Ref: e751447784 +Ref: threading<6>-Footnote-11448036 +Node: time<7>1448101 +Ref: whatsnew/3 5 time1448203 +Ref: e771448203 +Ref: time<7>-Footnote-11448380 +Node: timeit<2>1448445 +Ref: whatsnew/3 5 timeit1448545 +Ref: e781448545 +Ref: timeit<2>-Footnote-11449010 +Ref: timeit<2>-Footnote-21449075 +Node: tkinter<8>1449139 +Ref: whatsnew/3 5 tkinter1449244 +Ref: e7a1449244 +Ref: tkinter<8>-Footnote-11449576 +Node: traceback<5>1449641 +Ref: whatsnew/3 5 traceback1449745 +Ref: e7b1449745 +Ref: whatsnew/3 5 whatsnew-traceback1449745 +Ref: d731449745 +Ref: traceback<5>-Footnote-11450338 +Ref: traceback<5>-Footnote-21450403 +Ref: traceback<5>-Footnote-31450468 +Node: types<5>1450533 +Ref: whatsnew/3 5 types1450641 +Ref: e821450641 +Ref: types<5>-Footnote-11451085 +Ref: types<5>-Footnote-21451150 +Node: unicodedata<8>1451215 +Ref: whatsnew/3 5 unicodedata1451322 +Ref: e851451322 +Ref: unicodedata<8>-Footnote-11451474 +Node: unittest<8>1451525 +Ref: whatsnew/3 5 unittest1451640 +Ref: e861451640 +Ref: unittest<8>-Footnote-11452434 +Ref: unittest<8>-Footnote-21452499 +Ref: unittest<8>-Footnote-31452564 +Node: unittest mock<3>1452629 +Ref: whatsnew/3 5 unittest-mock1452739 +Ref: e881452739 +Ref: unittest mock<3>-Footnote-11453664 +Ref: unittest mock<3>-Footnote-21453729 +Ref: unittest mock<3>-Footnote-31453794 +Ref: unittest mock<3>-Footnote-41453859 +Ref: unittest mock<3>-Footnote-51453924 +Ref: unittest mock<3>-Footnote-61453989 +Node: urllib<2>1454054 +Ref: whatsnew/3 5 urllib1454160 +Ref: e8c1454160 +Ref: urllib<2>-Footnote-11455320 +Ref: urllib<2>-Footnote-21455385 +Ref: urllib<2>-Footnote-31455449 +Ref: urllib<2>-Footnote-41455514 +Ref: urllib<2>-Footnote-51455579 +Ref: urllib<2>-Footnote-61455638 +Ref: urllib<2>-Footnote-71455697 +Ref: urllib<2>-Footnote-81455756 +Node: wsgiref1455821 +Ref: whatsnew/3 5 wsgiref1455920 +Ref: e901455920 +Ref: wsgiref-Footnote-11456158 +Node: xmlrpc<2>1456222 +Ref: whatsnew/3 5 xmlrpc1456319 +Ref: e921456319 +Ref: xmlrpc<2>-Footnote-11456689 +Ref: xmlrpc<2>-Footnote-21456754 +Node: xml sax1456819 +Ref: whatsnew/3 5 xml-sax1456919 +Ref: e931456919 +Ref: xml sax-Footnote-11457252 +Ref: xml sax-Footnote-21457316 +Node: zipfile<4>1457381 +Ref: whatsnew/3 5 zipfile1457463 +Ref: e961457463 +Ref: zipfile<4>-Footnote-11457803 +Ref: zipfile<4>-Footnote-21457868 +Node: Other module-level changes1457933 +Ref: whatsnew/3 5 other-module-level-changes1458075 +Ref: e971458075 +Ref: Other module-level changes-Footnote-11458402 +Node: Optimizations<9>1458467 +Ref: whatsnew/3 5 optimizations1458616 +Ref: e981458616 +Ref: Optimizations<9>-Footnote-11461673 +Ref: Optimizations<9>-Footnote-21461738 +Ref: Optimizations<9>-Footnote-31461803 +Ref: Optimizations<9>-Footnote-41461868 +Ref: Optimizations<9>-Footnote-51461933 +Ref: Optimizations<9>-Footnote-61461998 +Ref: Optimizations<9>-Footnote-71462063 +Ref: Optimizations<9>-Footnote-81462128 +Ref: Optimizations<9>-Footnote-91462193 +Ref: Optimizations<9>-Footnote-101462258 +Ref: Optimizations<9>-Footnote-111462324 +Ref: Optimizations<9>-Footnote-121462390 +Ref: Optimizations<9>-Footnote-131462456 +Ref: Optimizations<9>-Footnote-141462522 +Ref: Optimizations<9>-Footnote-151462588 +Ref: Optimizations<9>-Footnote-161462654 +Ref: Optimizations<9>-Footnote-171462720 +Ref: Optimizations<9>-Footnote-181462786 +Ref: Optimizations<9>-Footnote-191462852 +Ref: Optimizations<9>-Footnote-201462918 +Node: Build and C API Changes<3>1462984 +Ref: whatsnew/3 5 build-and-c-api-changes1463121 +Ref: ea51463121 +Ref: Build and C API Changes<3>-Footnote-11466677 +Ref: Build and C API Changes<3>-Footnote-21466742 +Ref: Build and C API Changes<3>-Footnote-31466807 +Ref: Build and C API Changes<3>-Footnote-41466872 +Ref: Build and C API Changes<3>-Footnote-51466937 +Ref: Build and C API Changes<3>-Footnote-61467002 +Ref: Build and C API Changes<3>-Footnote-71467044 +Ref: Build and C API Changes<3>-Footnote-81467109 +Ref: Build and C API Changes<3>-Footnote-91467174 +Ref: Build and C API Changes<3>-Footnote-101467216 +Node: Deprecated<10>1467322 +Ref: whatsnew/3 5 deprecated1467454 +Ref: eb11467454 +Node: New Keywords<2>1467731 +Ref: whatsnew/3 5 new-keywords1467835 +Ref: eb21467835 +Ref: New Keywords<2>-Footnote-11468109 +Node: Deprecated Python Behavior<2>1468151 +Ref: whatsnew/3 5 deprecated-python-behavior1468293 +Ref: eb31468293 +Node: Unsupported Operating Systems1468708 +Ref: whatsnew/3 5 unsupported-operating-systems1468885 +Ref: eb41468885 +Ref: Unsupported Operating Systems-Footnote-11469126 +Node: Deprecated Python modules functions and methods<3>1469168 +Ref: whatsnew/3 5 deprecated-python-modules-functions-and-methods1469307 +Ref: eb51469307 +Ref: Deprecated Python modules functions and methods<3>-Footnote-11472219 +Ref: Deprecated Python modules functions and methods<3>-Footnote-21472284 +Ref: Deprecated Python modules functions and methods<3>-Footnote-31472348 +Ref: Deprecated Python modules functions and methods<3>-Footnote-41472413 +Ref: Deprecated Python modules functions and methods<3>-Footnote-51472478 +Ref: Deprecated Python modules functions and methods<3>-Footnote-61472543 +Ref: Deprecated Python modules functions and methods<3>-Footnote-71472608 +Ref: Deprecated Python modules functions and methods<3>-Footnote-81472673 +Node: Removed<10>1472738 +Ref: whatsnew/3 5 removed1472865 +Ref: eba1472865 +Node: API and Feature Removals<4>1472963 +Ref: whatsnew/3 5 api-and-feature-removals1473038 +Ref: ebb1473038 +Ref: API and Feature Removals<4>-Footnote-11473895 +Ref: API and Feature Removals<4>-Footnote-21473959 +Node: Porting to Python 3 51474024 +Ref: whatsnew/3 5 porting-to-python-3-51474168 +Ref: ebc1474168 +Node: Changes in Python behavior<2>1474513 +Ref: whatsnew/3 5 changes-in-python-behavior1474637 +Ref: ebd1474637 +Node: Changes in the Python API<9>1475047 +Ref: whatsnew/3 5 changes-in-the-python-api1475203 +Ref: ebe1475203 +Ref: Changes in the Python API<9>-Footnote-11482129 +Ref: Changes in the Python API<9>-Footnote-21482171 +Ref: Changes in the Python API<9>-Footnote-31482236 +Ref: Changes in the Python API<9>-Footnote-41482301 +Ref: Changes in the Python API<9>-Footnote-51482366 +Ref: Changes in the Python API<9>-Footnote-61482431 +Ref: Changes in the Python API<9>-Footnote-71482496 +Ref: Changes in the Python API<9>-Footnote-81482561 +Ref: Changes in the Python API<9>-Footnote-91482626 +Ref: Changes in the Python API<9>-Footnote-101482691 +Ref: Changes in the Python API<9>-Footnote-111482757 +Ref: Changes in the Python API<9>-Footnote-121482823 +Ref: Changes in the Python API<9>-Footnote-131482888 +Ref: Changes in the Python API<9>-Footnote-141482931 +Ref: Changes in the Python API<9>-Footnote-151482991 +Ref: Changes in the Python API<9>-Footnote-161483057 +Ref: Changes in the Python API<9>-Footnote-171483123 +Ref: Changes in the Python API<9>-Footnote-181483189 +Node: Changes in the C API<7>1483254 +Ref: whatsnew/3 5 changes-in-the-c-api1483372 +Ref: ec61483372 +Ref: Changes in the C API<7>-Footnote-11484676 +Ref: Changes in the C API<7>-Footnote-21484741 +Ref: Changes in the C API<7>-Footnote-31484806 +Node: Notable changes in Python 3 5 41484848 +Ref: whatsnew/3 5 notable-changes-in-python-3-5-41484972 +Ref: eca1484972 +Node: New make regen-all build target<2>1485209 +Ref: whatsnew/3 5 new-make-regen-all-build-target1485357 +Ref: ecb1485357 +Ref: New make regen-all build target<2>-Footnote-11486146 +Ref: New make regen-all build target<2>-Footnote-21486214 +Node: Removal of make touch build target<2>1486279 +Ref: whatsnew/3 5 removal-of-make-touch-build-target1486427 +Ref: ecc1486427 +Ref: Removal of make touch build target<2>-Footnote-11486857 +Node: What’s New In Python 3 41486922 +Ref: whatsnew/3 4 doc1487077 +Ref: ecd1487077 +Ref: whatsnew/3 4 what-s-new-in-python-3-41487077 +Ref: ece1487077 +Ref: What’s New In Python 3 4-Footnote-11487818 +Ref: What’s New In Python 3 4-Footnote-21487878 +Node: Summary – Release Highlights<3>1487920 +Ref: whatsnew/3 4 summary-release-highlights1488041 +Ref: ecf1488041 +Ref: Summary – Release Highlights<3>-Footnote-11492332 +Ref: Summary – Release Highlights<3>-Footnote-21492374 +Ref: Summary – Release Highlights<3>-Footnote-31492416 +Ref: Summary – Release Highlights<3>-Footnote-41492481 +Ref: Summary – Release Highlights<3>-Footnote-51492523 +Ref: Summary – Release Highlights<3>-Footnote-61492588 +Ref: Summary – Release Highlights<3>-Footnote-71492630 +Ref: Summary – Release Highlights<3>-Footnote-81492672 +Ref: Summary – Release Highlights<3>-Footnote-91492714 +Ref: Summary – Release Highlights<3>-Footnote-101492756 +Ref: Summary – Release Highlights<3>-Footnote-111492799 +Ref: Summary – Release Highlights<3>-Footnote-121492842 +Ref: Summary – Release Highlights<3>-Footnote-131492885 +Ref: Summary – Release Highlights<3>-Footnote-141492928 +Ref: Summary – Release Highlights<3>-Footnote-151492971 +Ref: Summary – Release Highlights<3>-Footnote-161493036 +Ref: Summary – Release Highlights<3>-Footnote-171493102 +Ref: Summary – Release Highlights<3>-Footnote-181493145 +Ref: Summary – Release Highlights<3>-Footnote-191493188 +Ref: Summary – Release Highlights<3>-Footnote-201493254 +Ref: Summary – Release Highlights<3>-Footnote-211493300 +Ref: Summary – Release Highlights<3>-Footnote-221493343 +Ref: Summary – Release Highlights<3>-Footnote-231493386 +Ref: Summary – Release Highlights<3>-Footnote-241493452 +Ref: Summary – Release Highlights<3>-Footnote-251493495 +Node: New Features<15>1493538 +Ref: whatsnew/3 4 new-features1493683 +Ref: eea1493683 +Node: PEP 453 Explicit Bootstrapping of PIP in Python Installations1494176 +Ref: whatsnew/3 4 pep-453-explicit-bootstrapping-of-pip-in-python-installations1494357 +Ref: eeb1494357 +Ref: whatsnew/3 4 whatsnew-pep-4531494357 +Ref: ed01494357 +Node: Bootstrapping pip By Default1494571 +Ref: whatsnew/3 4 bootstrapping-pip-by-default1494727 +Ref: eec1494727 +Ref: Bootstrapping pip By Default-Footnote-11497628 +Ref: Bootstrapping pip By Default-Footnote-21497670 +Node: Documentation Changes1497757 +Ref: whatsnew/3 4 documentation-changes1497913 +Ref: eef1497913 +Ref: Documentation Changes-Footnote-11498849 +Ref: Documentation Changes-Footnote-21498886 +Node: PEP 446 Newly Created File Descriptors Are Non-Inheritable1498928 +Ref: whatsnew/3 4 pep-446-newly-created-file-descriptors-are-non-inheritable1499148 +Ref: ef31499148 +Ref: whatsnew/3 4 whatsnew-pep-4461499148 +Ref: ed11499148 +Ref: PEP 446 Newly Created File Descriptors Are Non-Inheritable-Footnote-11500168 +Ref: PEP 446 Newly Created File Descriptors Are Non-Inheritable-Footnote-21500210 +Node: Improvements to Codec Handling1500252 +Ref: whatsnew/3 4 codec-handling-improvements1500458 +Ref: ed31500458 +Ref: whatsnew/3 4 improvements-to-codec-handling1500458 +Ref: efb1500458 +Ref: Improvements to Codec Handling-Footnote-11504666 +Ref: Improvements to Codec Handling-Footnote-21504730 +Ref: Improvements to Codec Handling-Footnote-31504795 +Ref: Improvements to Codec Handling-Footnote-41504860 +Node: PEP 451 A ModuleSpec Type for the Import System1504925 +Ref: whatsnew/3 4 pep-451-a-modulespec-type-for-the-import-system1505099 +Ref: f001505099 +Ref: whatsnew/3 4 whatsnew-pep-4511505099 +Ref: ed41505099 +Ref: PEP 451 A ModuleSpec Type for the Import System-Footnote-11506052 +Ref: PEP 451 A ModuleSpec Type for the Import System-Footnote-21506094 +Node: Other Language Changes<10>1506174 +Ref: whatsnew/3 4 other-language-changes1506309 +Ref: f021506309 +Ref: Other Language Changes<10>-Footnote-11508953 +Ref: Other Language Changes<10>-Footnote-21509018 +Ref: Other Language Changes<10>-Footnote-31509083 +Ref: Other Language Changes<10>-Footnote-41509148 +Ref: Other Language Changes<10>-Footnote-51509215 +Ref: Other Language Changes<10>-Footnote-61509280 +Ref: Other Language Changes<10>-Footnote-71509345 +Ref: Other Language Changes<10>-Footnote-81509410 +Ref: Other Language Changes<10>-Footnote-91509475 +Ref: Other Language Changes<10>-Footnote-101509540 +Ref: Other Language Changes<10>-Footnote-111509606 +Ref: Other Language Changes<10>-Footnote-121509649 +Node: New Modules<10>1509715 +Ref: whatsnew/3 4 new-modules1509847 +Ref: f071509847 +Node: asyncio<11>1510075 +Ref: whatsnew/3 4 asyncio1510159 +Ref: f081510159 +Ref: whatsnew/3 4 whatsnew-asyncio1510159 +Ref: ed61510159 +Ref: asyncio<11>-Footnote-11510759 +Ref: asyncio<11>-Footnote-21510801 +Node: ensurepip<2>1510843 +Ref: whatsnew/3 4 ensurepip1510943 +Ref: f091510943 +Ref: whatsnew/3 4 whatsnew-ensurepip1510943 +Ref: ed71510943 +Ref: ensurepip<2>-Footnote-11512217 +Node: enum<9>1512259 +Ref: whatsnew/3 4 enum1512359 +Ref: f0a1512359 +Ref: whatsnew/3 4 whatsnew-enum1512359 +Ref: ed81512359 +Ref: enum<9>-Footnote-11512931 +Ref: enum<9>-Footnote-21512973 +Node: pathlib<11>1513015 +Ref: whatsnew/3 4 pathlib1513115 +Ref: f0b1513115 +Ref: whatsnew/3 4 whatsnew-pathlib1513115 +Ref: ed91513115 +Ref: pathlib<11>-Footnote-11513735 +Node: selectors<2>1513777 +Ref: whatsnew/3 4 selectors1513883 +Ref: f0c1513883 +Ref: whatsnew/3 4 whatsnew-selectors1513883 +Ref: eda1513883 +Ref: selectors<2>-Footnote-11514143 +Node: statistics<6>1514185 +Ref: whatsnew/3 4 statistics1514294 +Ref: f0d1514294 +Ref: whatsnew/3 4 whatsnew-statistics1514294 +Ref: edb1514294 +Ref: statistics<6>-Footnote-11514761 +Ref: statistics<6>-Footnote-21514803 +Node: tracemalloc<4>1514845 +Ref: whatsnew/3 4 tracemalloc1514933 +Ref: f0e1514933 +Ref: whatsnew/3 4 whatsnew-tracemalloc1514933 +Ref: edc1514933 +Ref: tracemalloc<4>-Footnote-11515599 +Ref: tracemalloc<4>-Footnote-21515641 +Node: Improved Modules<10>1515683 +Ref: whatsnew/3 4 improved-modules1515829 +Ref: f0f1515829 +Node: abc1517177 +Ref: whatsnew/3 4 abc1517253 +Ref: f101517253 +Ref: abc-Footnote-11517776 +Ref: abc-Footnote-21517841 +Node: aifc<2>1517906 +Ref: whatsnew/3 4 aifc1518002 +Ref: f141518002 +Ref: aifc<2>-Footnote-11518612 +Ref: aifc<2>-Footnote-21518677 +Ref: aifc<2>-Footnote-31518742 +Node: argparse<5>1518806 +Ref: whatsnew/3 4 argparse1518906 +Ref: f151518906 +Ref: argparse<5>-Footnote-11519154 +Node: audioop1519219 +Ref: whatsnew/3 4 audioop1519321 +Ref: f171519321 +Ref: audioop-Footnote-11519847 +Ref: audioop-Footnote-21519912 +Ref: audioop-Footnote-31519977 +Node: base64<3>1520042 +Ref: whatsnew/3 4 base641520147 +Ref: f181520147 +Ref: base64<3>-Footnote-11520980 +Ref: base64<3>-Footnote-21521045 +Node: collections<6>1521110 +Ref: whatsnew/3 4 collections1521216 +Ref: f1d1521216 +Ref: collections<6>-Footnote-11521548 +Node: colorsys1521613 +Ref: whatsnew/3 4 colorsys1521723 +Ref: f1f1521723 +Ref: colorsys-Footnote-11522093 +Node: contextlib<6>1522158 +Ref: whatsnew/3 4 contextlib1522260 +Ref: f201522260 +Ref: contextlib<6>-Footnote-11523447 +Ref: contextlib<6>-Footnote-21523512 +Ref: contextlib<6>-Footnote-31523577 +Node: dbm<6>1523642 +Ref: whatsnew/3 4 dbm1523742 +Ref: f241523742 +Ref: dbm<6>-Footnote-11524091 +Node: dis<4>1524156 +Ref: whatsnew/3 4 dis1524253 +Ref: f261524253 +Ref: dis<4>-Footnote-11526849 +Ref: dis<4>-Footnote-21526914 +Ref: dis<4>-Footnote-31526979 +Node: doctest<4>1527044 +Ref: whatsnew/3 4 doctest1527143 +Ref: f2d1527143 +Ref: doctest<4>-Footnote-11527913 +Ref: doctest<4>-Footnote-21527978 +Ref: doctest<4>-Footnote-31528043 +Node: email<4>1528107 +Ref: whatsnew/3 4 email1528207 +Ref: f301528207 +Ref: whatsnew/3 4 whatsnew-email-contentmanager1529457 +Ref: ee01529457 +Ref: email<4>-Footnote-11530386 +Ref: email<4>-Footnote-21530451 +Ref: email<4>-Footnote-31530516 +Ref: email<4>-Footnote-41530581 +Node: filecmp1530646 +Ref: whatsnew/3 4 filecmp1530748 +Ref: f381530748 +Ref: filecmp-Footnote-11531496 +Ref: filecmp-Footnote-21531561 +Node: functools<5>1531626 +Ref: whatsnew/3 4 functools1531725 +Ref: f3c1531725 +Ref: whatsnew/3 4 whatsnew-singledispatch1532174 +Ref: edd1532174 +Ref: functools<5>-Footnote-11533133 +Ref: functools<5>-Footnote-21533197 +Ref: functools<5>-Footnote-31533239 +Ref: functools<5>-Footnote-41533304 +Node: gc<5>1533369 +Ref: whatsnew/3 4 gc1533468 +Ref: f3e1533468 +Ref: gc<5>-Footnote-11533736 +Node: glob<4>1533801 +Ref: whatsnew/3 4 glob1533898 +Ref: f401533898 +Ref: glob<4>-Footnote-11534204 +Node: hashlib<6>1534268 +Ref: whatsnew/3 4 hashlib1534367 +Ref: f421534367 +Ref: hashlib<6>-Footnote-11535002 +Ref: hashlib<6>-Footnote-21535047 +Ref: hashlib<6>-Footnote-31535112 +Node: hmac<3>1535177 +Ref: whatsnew/3 4 hmac1535273 +Ref: f441535273 +Ref: hmac<3>-Footnote-11536301 +Ref: hmac<3>-Footnote-21536366 +Ref: hmac<3>-Footnote-31536431 +Ref: hmac<3>-Footnote-41536473 +Node: html1536538 +Ref: whatsnew/3 4 html1536631 +Ref: f491536631 +Ref: html-Footnote-11537390 +Ref: html-Footnote-21537454 +Ref: html-Footnote-31537519 +Node: http<3>1537584 +Ref: whatsnew/3 4 http1537689 +Ref: f4a1537689 +Ref: http<3>-Footnote-11538332 +Ref: http<3>-Footnote-21538397 +Node: idlelib and IDLE<4>1538462 +Ref: whatsnew/3 4 idlelib-and-idle1538575 +Ref: f4d1538575 +Node: importlib<9>1538971 +Ref: whatsnew/3 4 importlib1539087 +Ref: f4e1539087 +Ref: importlib<9>-Footnote-11541071 +Ref: importlib<9>-Footnote-21541136 +Ref: importlib<9>-Footnote-31541201 +Ref: importlib<9>-Footnote-41541266 +Ref: importlib<9>-Footnote-51541331 +Ref: importlib<9>-Footnote-61541396 +Ref: importlib<9>-Footnote-71541461 +Node: inspect<8>1541526 +Ref: whatsnew/3 4 inspect1541635 +Ref: f551541635 +Ref: inspect<8>-Footnote-11543345 +Ref: inspect<8>-Footnote-21543410 +Ref: inspect<8>-Footnote-31543475 +Ref: inspect<8>-Footnote-41543540 +Ref: inspect<8>-Footnote-51543605 +Ref: inspect<8>-Footnote-61543670 +Node: ipaddress<5>1543735 +Ref: whatsnew/3 4 ipaddress1543842 +Ref: f591543842 +Ref: ipaddress<5>-Footnote-11544370 +Node: logging<6>1544435 +Ref: whatsnew/3 4 logging1544542 +Ref: f5b1544542 +Ref: logging<6>-Footnote-11545674 +Ref: logging<6>-Footnote-21545738 +Ref: logging<6>-Footnote-31545803 +Node: marshal<2>1545868 +Ref: whatsnew/3 4 marshal1545970 +Ref: f611545970 +Ref: whatsnew/3 4 whatsnew-marshal-31545970 +Ref: ed51545970 +Ref: marshal<2>-Footnote-11546651 +Ref: marshal<2>-Footnote-21546716 +Node: mmap<3>1546781 +Ref: whatsnew/3 4 mmap1546891 +Ref: f621546891 +Ref: mmap<3>-Footnote-11547063 +Node: multiprocessing<7>1547127 +Ref: whatsnew/3 4 multiprocessing1547238 +Ref: f631547238 +Ref: whatsnew/3 4 whatsnew-multiprocessing-no-fork1547291 +Ref: edf1547291 +Ref: multiprocessing<7>-Footnote-11549103 +Ref: multiprocessing<7>-Footnote-21549167 +Ref: multiprocessing<7>-Footnote-31549232 +Ref: multiprocessing<7>-Footnote-41549296 +Node: operator<3>1549361 +Ref: whatsnew/3 4 operator1549471 +Ref: f671549471 +Ref: operator<3>-Footnote-11550024 +Ref: operator<3>-Footnote-21550066 +Ref: operator<3>-Footnote-31550131 +Node: os<11>1550196 +Ref: whatsnew/3 4 os1550294 +Ref: f691550294 +Ref: os<11>-Footnote-11551741 +Ref: os<11>-Footnote-21551806 +Ref: os<11>-Footnote-31551871 +Ref: os<11>-Footnote-41551935 +Node: pdb<6>1552000 +Ref: whatsnew/3 4 pdb1552096 +Ref: f6f1552096 +Ref: pdb<6>-Footnote-11553092 +Ref: pdb<6>-Footnote-21553157 +Node: pickle<4>1553222 +Ref: whatsnew/3 4 pickle1553323 +Ref: f721553323 +Ref: whatsnew/3 4 whatsnew-protocol-41553323 +Ref: ede1553323 +Ref: pickle<4>-Footnote-11553915 +Node: plistlib<2>1553957 +Ref: whatsnew/3 4 plistlib1554061 +Ref: f731554061 +Ref: plistlib<2>-Footnote-11554597 +Node: poplib<3>1554662 +Ref: whatsnew/3 4 poplib1554766 +Ref: f761554766 +Ref: poplib<3>-Footnote-11555156 +Node: pprint<4>1555220 +Ref: whatsnew/3 4 pprint1555316 +Ref: f791555316 +Ref: pprint<4>-Footnote-11555936 +Ref: pprint<4>-Footnote-21556001 +Node: pty1556066 +Ref: whatsnew/3 4 pty1556161 +Ref: f7c1556161 +Node: pydoc<4>1556354 +Ref: whatsnew/3 4 pydoc1556445 +Ref: f7e1556445 +Ref: pydoc<4>-Footnote-11557502 +Ref: pydoc<4>-Footnote-21557567 +Node: re<8>1557632 +Ref: whatsnew/3 4 re1557728 +Ref: f7f1557728 +Ref: re<8>-Footnote-11558471 +Ref: re<8>-Footnote-21558536 +Ref: re<8>-Footnote-31558601 +Node: resource1558666 +Ref: whatsnew/3 4 resource1558760 +Ref: f831558760 +Ref: resource-Footnote-11559613 +Ref: resource-Footnote-21559678 +Ref: resource-Footnote-31559743 +Node: select1559808 +Ref: whatsnew/3 4 select1559906 +Ref: f8d1559906 +Ref: select-Footnote-11560415 +Ref: select-Footnote-21560480 +Node: shelve<2>1560545 +Ref: whatsnew/3 4 shelve1560644 +Ref: f941560644 +Ref: shelve<2>-Footnote-11560916 +Node: shutil<6>1560981 +Ref: whatsnew/3 4 shutil1561082 +Ref: f961561082 +Ref: shutil<6>-Footnote-11561455 +Node: smtpd<3>1561522 +Ref: whatsnew/3 4 smtpd1561624 +Ref: f991561624 +Ref: smtpd<3>-Footnote-11561984 +Node: smtplib<3>1562049 +Ref: whatsnew/3 4 smtplib1562151 +Ref: f9a1562151 +Ref: smtplib<3>-Footnote-11562513 +Node: socket<9>1562577 +Ref: whatsnew/3 4 socket1562681 +Ref: f9c1562681 +Ref: socket<9>-Footnote-11563464 +Ref: socket<9>-Footnote-21563529 +Node: sqlite3<9>1563593 +Ref: whatsnew/3 4 sqlite31563694 +Ref: fa01563694 +Ref: sqlite3<9>-Footnote-11563985 +Ref: sqlite3<9>-Footnote-21564025 +Node: ssl<10>1564090 +Ref: whatsnew/3 4 ssl1564186 +Ref: fa11564186 +Ref: whatsnew/3 4 whatsnew-tls-11-121564215 +Ref: ee21564215 +Ref: whatsnew/3 4 whatsnew34-sslcontext1564485 +Ref: ee51564485 +Ref: whatsnew/3 4 whatsnew34-win-cert-store1567159 +Ref: ee31567159 +Ref: whatsnew/3 4 whatsnew34-sni1567413 +Ref: ee41567413 +Ref: ssl<10>-Footnote-11567862 +Ref: ssl<10>-Footnote-21567927 +Ref: ssl<10>-Footnote-31567992 +Ref: ssl<10>-Footnote-41568057 +Ref: ssl<10>-Footnote-51568122 +Ref: ssl<10>-Footnote-61568187 +Ref: ssl<10>-Footnote-71568251 +Ref: ssl<10>-Footnote-81568316 +Ref: ssl<10>-Footnote-91568381 +Ref: ssl<10>-Footnote-101568445 +Node: stat1568511 +Ref: whatsnew/3 4 stat1568606 +Ref: fb31568606 +Ref: stat-Footnote-11569079 +Ref: stat-Footnote-21569144 +Node: struct<2>1569209 +Ref: whatsnew/3 4 struct1569310 +Ref: fb81569310 +Ref: struct<2>-Footnote-11569642 +Node: subprocess<5>1569707 +Ref: whatsnew/3 4 subprocess1569812 +Ref: fbb1569812 +Ref: subprocess<5>-Footnote-11570258 +Ref: subprocess<5>-Footnote-21570323 +Node: sunau<2>1570388 +Ref: whatsnew/3 4 sunau1570491 +Ref: fbe1570491 +Ref: sunau<2>-Footnote-11571275 +Ref: sunau<2>-Footnote-21571340 +Ref: sunau<2>-Footnote-31571405 +Ref: sunau<2>-Footnote-41571470 +Node: sys<12>1571534 +Ref: whatsnew/3 4 sys1571634 +Ref: fbf1571634 +Ref: sys<12>-Footnote-11572923 +Ref: sys<12>-Footnote-21572988 +Node: tarfile<8>1573052 +Ref: whatsnew/3 4 tarfile1573152 +Ref: fc51573152 +Ref: tarfile<8>-Footnote-11573470 +Node: textwrap1573535 +Ref: whatsnew/3 4 textwrap1573640 +Ref: fc71573640 +Ref: textwrap-Footnote-11574341 +Ref: textwrap-Footnote-21574406 +Node: threading<7>1574471 +Ref: whatsnew/3 4 threading1574578 +Ref: fcc1574578 +Ref: threading<7>-Footnote-11574923 +Node: traceback<6>1574988 +Ref: whatsnew/3 4 traceback1575095 +Ref: fce1575095 +Ref: traceback<6>-Footnote-11575410 +Node: types<6>1575477 +Ref: whatsnew/3 4 types1575581 +Ref: fd01575581 +Ref: types<6>-Footnote-11576087 +Node: urllib<3>1576152 +Ref: whatsnew/3 4 urllib1576255 +Ref: fd11576255 +Ref: urllib<3>-Footnote-11577571 +Ref: urllib<3>-Footnote-21577636 +Ref: urllib<3>-Footnote-31577701 +Ref: urllib<3>-Footnote-41577766 +Ref: urllib<3>-Footnote-51577831 +Ref: urllib<3>-Footnote-61577896 +Node: unittest<9>1577961 +Ref: whatsnew/3 4 unittest1578063 +Ref: fdb1578063 +Ref: unittest<9>-Footnote-11581219 +Ref: unittest<9>-Footnote-21581284 +Ref: unittest<9>-Footnote-31581349 +Ref: unittest<9>-Footnote-41581414 +Ref: unittest<9>-Footnote-51581479 +Ref: unittest<9>-Footnote-61581544 +Ref: unittest<9>-Footnote-71581609 +Ref: unittest<9>-Footnote-81581674 +Ref: unittest<9>-Footnote-91581739 +Node: venv<7>1581804 +Ref: whatsnew/3 4 venv1581904 +Ref: fe21581904 +Ref: venv<7>-Footnote-11582462 +Ref: venv<7>-Footnote-21582527 +Ref: venv<7>-Footnote-31582592 +Node: wave<2>1582634 +Ref: whatsnew/3 4 wave1582733 +Ref: fe31582733 +Ref: wave<2>-Footnote-11583370 +Ref: wave<2>-Footnote-21583435 +Ref: wave<2>-Footnote-31583500 +Ref: wave<2>-Footnote-41583564 +Node: weakref<2>1583628 +Ref: whatsnew/3 4 weakref1583732 +Ref: fe71583732 +Ref: weakref<2>-Footnote-11584353 +Ref: weakref<2>-Footnote-21584418 +Ref: weakref<2>-Footnote-31584483 +Node: xml etree<2>1584548 +Ref: whatsnew/3 4 xml-etree1584655 +Ref: feb1584655 +Ref: xml etree<2>-Footnote-11585394 +Ref: xml etree<2>-Footnote-21585459 +Node: zipfile<5>1585524 +Ref: whatsnew/3 4 zipfile1585612 +Ref: ff11585612 +Ref: zipfile<5>-Footnote-11586143 +Ref: zipfile<5>-Footnote-21586208 +Node: CPython Implementation Changes1586273 +Ref: whatsnew/3 4 cpython-implementation-changes1586418 +Ref: ff41586418 +Node: PEP 445 Customization of CPython Memory Allocators1586950 +Ref: whatsnew/3 4 pep-445-customization-of-cpython-memory-allocators1587108 +Ref: ff51587108 +Ref: whatsnew/3 4 whatsnew-pep-4451587108 +Ref: ee81587108 +Ref: PEP 445 Customization of CPython Memory Allocators-Footnote-11587505 +Ref: PEP 445 Customization of CPython Memory Allocators-Footnote-21587547 +Node: PEP 442 Safe Object Finalization1587589 +Ref: whatsnew/3 4 pep-442-safe-object-finalization1587805 +Ref: ff61587805 +Ref: whatsnew/3 4 whatsnew-pep-4421587805 +Ref: ee71587805 +Ref: PEP 442 Safe Object Finalization-Footnote-11588668 +Ref: PEP 442 Safe Object Finalization-Footnote-21588710 +Node: PEP 456 Secure and Interchangeable Hash Algorithm1588752 +Ref: whatsnew/3 4 pep-456-secure-and-interchangeable-hash-algorithm1588941 +Ref: ff71588941 +Ref: whatsnew/3 4 whatsnew-pep-4561588941 +Ref: ee11588941 +Ref: PEP 456 Secure and Interchangeable Hash Algorithm-Footnote-11589889 +Ref: PEP 456 Secure and Interchangeable Hash Algorithm-Footnote-21589931 +Node: PEP 436 Argument Clinic1589996 +Ref: whatsnew/3 4 pep-436-argument-clinic1590182 +Ref: ff91590182 +Ref: whatsnew/3 4 whatsnew-pep-4361590182 +Ref: ee91590182 +Ref: PEP 436 Argument Clinic-Footnote-11591290 +Ref: PEP 436 Argument Clinic-Footnote-21591332 +Node: Other Build and C API Changes1591374 +Ref: whatsnew/3 4 other-build-and-c-api-changes1591532 +Ref: ffa1591532 +Ref: Other Build and C API Changes-Footnote-11593612 +Ref: Other Build and C API Changes-Footnote-21593677 +Ref: Other Build and C API Changes-Footnote-31593742 +Ref: Other Build and C API Changes-Footnote-41593809 +Ref: Other Build and C API Changes-Footnote-51593873 +Ref: Other Build and C API Changes-Footnote-61593938 +Ref: Other Build and C API Changes-Footnote-71594011 +Ref: Other Build and C API Changes-Footnote-81594075 +Ref: Other Build and C API Changes-Footnote-91594140 +Node: Other Improvements<2>1594205 +Ref: whatsnew/3 4 other-improvements1594365 +Ref: ffe1594365 +Ref: whatsnew/3 4 other-improvements-3-41594365 +Ref: fff1594365 +Ref: whatsnew/3 4 whatsnew-isolated-mode1594422 +Ref: ed21594422 +Ref: Other Improvements<2>-Footnote-11598546 +Ref: Other Improvements<2>-Footnote-21598611 +Ref: Other Improvements<2>-Footnote-31598675 +Ref: Other Improvements<2>-Footnote-41598740 +Ref: Other Improvements<2>-Footnote-51598805 +Ref: Other Improvements<2>-Footnote-61598870 +Ref: Other Improvements<2>-Footnote-71598935 +Ref: Other Improvements<2>-Footnote-81599030 +Ref: Other Improvements<2>-Footnote-91599081 +Ref: Other Improvements<2>-Footnote-101599146 +Ref: Other Improvements<2>-Footnote-111599212 +Ref: Other Improvements<2>-Footnote-121599278 +Ref: Other Improvements<2>-Footnote-131599321 +Ref: Other Improvements<2>-Footnote-141599387 +Ref: Other Improvements<2>-Footnote-151599453 +Ref: Other Improvements<2>-Footnote-161599519 +Ref: Other Improvements<2>-Footnote-171599585 +Ref: Other Improvements<2>-Footnote-181599628 +Ref: Other Improvements<2>-Footnote-191599694 +Ref: Other Improvements<2>-Footnote-201599760 +Ref: Other Improvements<2>-Footnote-211599826 +Node: Significant Optimizations1599892 +Ref: whatsnew/3 4 significant-optimizations1600014 +Ref: 10041600014 +Ref: Significant Optimizations-Footnote-11602822 +Ref: Significant Optimizations-Footnote-21602887 +Ref: Significant Optimizations-Footnote-31602952 +Ref: Significant Optimizations-Footnote-41603017 +Ref: Significant Optimizations-Footnote-51603082 +Ref: Significant Optimizations-Footnote-61603147 +Ref: Significant Optimizations-Footnote-71603212 +Ref: Significant Optimizations-Footnote-81603276 +Ref: Significant Optimizations-Footnote-91603341 +Ref: Significant Optimizations-Footnote-101603406 +Ref: Significant Optimizations-Footnote-111603472 +Ref: Significant Optimizations-Footnote-121603538 +Ref: Significant Optimizations-Footnote-131603604 +Node: Deprecated<11>1603670 +Ref: whatsnew/3 4 deprecated1603806 +Ref: 10081603806 +Ref: whatsnew/3 4 deprecated-3-41603806 +Ref: f011603806 +Node: Deprecations in the Python API1604248 +Ref: whatsnew/3 4 deprecations-in-the-python-api1604357 +Ref: 10091604357 +Node: Deprecated Features1608005 +Ref: whatsnew/3 4 deprecated-features1608114 +Ref: 100d1608114 +Ref: Deprecated Features-Footnote-11608528 +Ref: Deprecated Features-Footnote-21608593 +Node: Removed<11>1608658 +Ref: whatsnew/3 4 removed1608785 +Ref: 100f1608785 +Node: Operating Systems No Longer Supported1608943 +Ref: whatsnew/3 4 operating-systems-no-longer-supported1609064 +Ref: 10101609064 +Ref: Operating Systems No Longer Supported-Footnote-11609479 +Ref: Operating Systems No Longer Supported-Footnote-21609544 +Ref: Operating Systems No Longer Supported-Footnote-31609609 +Node: API and Feature Removals<5>1609674 +Ref: whatsnew/3 4 api-and-feature-removals1609817 +Ref: 10111609817 +Ref: API and Feature Removals<5>-Footnote-11612274 +Ref: API and Feature Removals<5>-Footnote-21612310 +Ref: API and Feature Removals<5>-Footnote-31612375 +Ref: API and Feature Removals<5>-Footnote-41612440 +Ref: API and Feature Removals<5>-Footnote-51612505 +Ref: API and Feature Removals<5>-Footnote-61612570 +Ref: API and Feature Removals<5>-Footnote-71612634 +Node: Code Cleanups1612699 +Ref: whatsnew/3 4 code-cleanups1612796 +Ref: 10131612796 +Ref: Code Cleanups-Footnote-11613460 +Node: Porting to Python 3 41613525 +Ref: whatsnew/3 4 porting-to-python-3-41613654 +Ref: 10141613654 +Node: Changes in ‘python’ Command Behavior<2>1614028 +Ref: whatsnew/3 4 changes-in-python-command-behavior1614167 +Ref: 10151614167 +Ref: Changes in ‘python’ Command Behavior<2>-Footnote-11615281 +Node: Changes in the Python API<10>1615346 +Ref: whatsnew/3 4 changes-in-the-python-api1615517 +Ref: 10171615517 +Ref: Changes in the Python API<10>-Footnote-11628911 +Ref: Changes in the Python API<10>-Footnote-21628976 +Ref: Changes in the Python API<10>-Footnote-31629041 +Ref: Changes in the Python API<10>-Footnote-41629106 +Ref: Changes in the Python API<10>-Footnote-51629171 +Ref: Changes in the Python API<10>-Footnote-61629236 +Ref: Changes in the Python API<10>-Footnote-71629301 +Ref: Changes in the Python API<10>-Footnote-81629366 +Ref: Changes in the Python API<10>-Footnote-91629430 +Ref: Changes in the Python API<10>-Footnote-101629495 +Ref: Changes in the Python API<10>-Footnote-111629561 +Ref: Changes in the Python API<10>-Footnote-121629627 +Ref: Changes in the Python API<10>-Footnote-131629693 +Ref: Changes in the Python API<10>-Footnote-141629759 +Ref: Changes in the Python API<10>-Footnote-151629825 +Ref: Changes in the Python API<10>-Footnote-161629891 +Ref: Changes in the Python API<10>-Footnote-171629957 +Ref: Changes in the Python API<10>-Footnote-181630023 +Ref: Changes in the Python API<10>-Footnote-191630089 +Ref: Changes in the Python API<10>-Footnote-201630155 +Ref: Changes in the Python API<10>-Footnote-211630221 +Ref: Changes in the Python API<10>-Footnote-221630287 +Ref: Changes in the Python API<10>-Footnote-231630353 +Ref: Changes in the Python API<10>-Footnote-241630418 +Node: Changes in the C API<8>1630484 +Ref: whatsnew/3 4 changes-in-the-c-api1630603 +Ref: 10261630603 +Ref: Changes in the C API<8>-Footnote-11632370 +Ref: Changes in the C API<8>-Footnote-21632435 +Node: Changed in 3 4 31632500 +Ref: whatsnew/3 4 changed-in-3-4-31632609 +Ref: 102c1632609 +Node: PEP 476 Enabling certificate verification by default for stdlib http clients1632827 +Ref: whatsnew/3 4 pep-4761632956 +Ref: 102d1632956 +Ref: whatsnew/3 4 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients1632956 +Ref: 102e1632956 +Node: What’s New In Python 3 31633957 +Ref: whatsnew/3 3 doc1634112 +Ref: 102f1634112 +Ref: whatsnew/3 3 what-s-new-in-python-3-31634112 +Ref: 10301634112 +Ref: What’s New In Python 3 3-Footnote-11636059 +Ref: What’s New In Python 3 3-Footnote-21636119 +Node: Summary – Release highlights<8>1636161 +Ref: whatsnew/3 3 summary-release-highlights1636294 +Ref: 10311636294 +Node: PEP 405 Virtual Environments1637634 +Ref: whatsnew/3 3 pep-4051637811 +Ref: 10331637811 +Ref: whatsnew/3 3 pep-405-virtual-environments1637811 +Ref: 103b1637811 +Ref: PEP 405 Virtual Environments-Footnote-11638801 +Node: PEP 420 Implicit Namespace Packages1638843 +Ref: whatsnew/3 3 pep-420-implicit-namespace-packages1639059 +Ref: 103c1639059 +Ref: PEP 420 Implicit Namespace Packages-Footnote-11639572 +Ref: PEP 420 Implicit Namespace Packages-Footnote-21639614 +Node: PEP 3118 New memoryview implementation and buffer protocol documentation1639656 +Ref: whatsnew/3 3 pep-3118-new-memoryview-implementation-and-buffer-protocol-documentation1639882 +Ref: 103d1639882 +Ref: whatsnew/3 3 pep-3118-update1639882 +Ref: 103e1639882 +Ref: PEP 3118 New memoryview implementation and buffer protocol documentation-Footnote-11641014 +Node: Features1641056 +Ref: whatsnew/3 3 features1641193 +Ref: 103f1641193 +Ref: Features-Footnote-11641997 +Node: API changes1642062 +Ref: whatsnew/3 3 api-changes1642199 +Ref: 10401642199 +Ref: API changes-Footnote-11643218 +Ref: API changes-Footnote-21643283 +Node: PEP 393 Flexible String Representation1643325 +Ref: whatsnew/3 3 pep-3931643551 +Ref: 10361643551 +Ref: whatsnew/3 3 pep-393-flexible-string-representation1643551 +Ref: 10431643551 +Ref: PEP 393 Flexible String Representation-Footnote-11644612 +Node: Functionality1644654 +Ref: whatsnew/3 3 functionality1644781 +Ref: 10441644781 +Ref: Functionality-Footnote-11646231 +Ref: Functionality-Footnote-21646273 +Node: Performance and resource usage1646338 +Ref: whatsnew/3 3 performance-and-resource-usage1646465 +Ref: 10461646465 +Ref: Performance and resource usage-Footnote-11647698 +Node: PEP 397 Python Launcher for Windows1647740 +Ref: whatsnew/3 3 pep-3971647946 +Ref: 10471647946 +Ref: whatsnew/3 3 pep-397-python-launcher-for-windows1647946 +Ref: 10481647946 +Ref: PEP 397 Python Launcher for Windows-Footnote-11649491 +Ref: PEP 397 Python Launcher for Windows-Footnote-21649555 +Node: PEP 3151 Reworking the OS and IO exception hierarchy1649597 +Ref: whatsnew/3 3 pep-31511649812 +Ref: 10341649812 +Ref: whatsnew/3 3 pep-3151-reworking-the-os-and-io-exception-hierarchy1649812 +Ref: 104a1649812 +Ref: PEP 3151 Reworking the OS and IO exception hierarchy-Footnote-11652398 +Node: PEP 380 Syntax for Delegating to a Subgenerator1652440 +Ref: whatsnew/3 3 pep-3801652657 +Ref: 10321652657 +Ref: whatsnew/3 3 pep-380-syntax-for-delegating-to-a-subgenerator1652657 +Ref: 10591652657 +Ref: PEP 380 Syntax for Delegating to a Subgenerator-Footnote-11655103 +Node: PEP 409 Suppressing exception context1655145 +Ref: whatsnew/3 3 pep-409-suppressing-exception-context1655343 +Ref: 105b1655343 +Ref: PEP 409 Suppressing exception context-Footnote-11657433 +Node: PEP 414 Explicit Unicode literals1657475 +Ref: whatsnew/3 3 pep-414-explicit-unicode-literals1657675 +Ref: 105c1657675 +Ref: PEP 414 Explicit Unicode literals-Footnote-11658390 +Node: PEP 3155 Qualified name for classes and functions1658432 +Ref: whatsnew/3 3 pep-3155-qualified-name-for-classes-and-functions1658625 +Ref: 105d1658625 +Ref: PEP 3155 Qualified name for classes and functions-Footnote-11660242 +Node: PEP 412 Key-Sharing Dictionary1660284 +Ref: whatsnew/3 3 pep-4121660477 +Ref: 10371660477 +Ref: whatsnew/3 3 pep-412-key-sharing-dictionary1660477 +Ref: 10601660477 +Ref: PEP 412 Key-Sharing Dictionary-Footnote-11660998 +Node: PEP 362 Function Signature Object1661040 +Ref: whatsnew/3 3 pep-362-function-signature-object1661217 +Ref: 10611661217 +Ref: PEP 362 Function Signature Object-Footnote-11662114 +Node: PEP 421 Adding sys implementation1662156 +Ref: whatsnew/3 3 pep-421-adding-sys-implementation1662350 +Ref: 10631662350 +Ref: PEP 421 Adding sys implementation-Footnote-11663566 +Node: SimpleNamespace1663608 +Ref: whatsnew/3 3 simplenamespace1663693 +Ref: 10641663693 +Ref: SimpleNamespace-Footnote-11664313 +Node: Using importlib as the Implementation of Import1664355 +Ref: whatsnew/3 3 importlib1664542 +Ref: 10351664542 +Ref: whatsnew/3 3 using-importlib-as-the-implementation-of-import1664542 +Ref: 10651664542 +Ref: Using importlib as the Implementation of Import-Footnote-11665822 +Ref: Using importlib as the Implementation of Import-Footnote-21665886 +Ref: Using importlib as the Implementation of Import-Footnote-31665951 +Ref: Using importlib as the Implementation of Import-Footnote-41666016 +Ref: Using importlib as the Implementation of Import-Footnote-51666081 +Node: New APIs1666123 +Ref: whatsnew/3 3 new-apis1666239 +Ref: 10681666239 +Node: Visible Changes1668084 +Ref: whatsnew/3 3 visible-changes1668200 +Ref: 106f1668200 +Ref: Visible Changes-Footnote-11670055 +Ref: Visible Changes-Footnote-21670097 +Node: Other Language Changes<11>1670139 +Ref: whatsnew/3 3 other-language-changes1670320 +Ref: 10701670320 +Ref: Other Language Changes<11>-Footnote-11672285 +Ref: Other Language Changes<11>-Footnote-21672350 +Ref: Other Language Changes<11>-Footnote-31672415 +Ref: Other Language Changes<11>-Footnote-41672480 +Ref: Other Language Changes<11>-Footnote-51672545 +Ref: Other Language Changes<11>-Footnote-61672610 +Ref: Other Language Changes<11>-Footnote-71672675 +Ref: Other Language Changes<11>-Footnote-81672740 +Node: A Finer-Grained Import Lock1672805 +Ref: whatsnew/3 3 a-finer-grained-import-lock1672966 +Ref: 10731672966 +Ref: A Finer-Grained Import Lock-Footnote-11673711 +Node: Builtin functions and types1673775 +Ref: whatsnew/3 3 builtin-functions-and-types1673925 +Ref: 10741673925 +Ref: Builtin functions and types-Footnote-11675162 +Node: New Modules<11>1675226 +Ref: whatsnew/3 3 new-modules1675369 +Ref: 10771675369 +Node: faulthandler<4>1675497 +Ref: whatsnew/3 3 faulthandler1675585 +Ref: 10781675585 +Node: ipaddress<6>1676513 +Ref: whatsnew/3 3 ipaddress1676617 +Ref: 107a1676617 +Ref: ipaddress<6>-Footnote-11676963 +Node: lzma<2>1677005 +Ref: whatsnew/3 3 lzma1677085 +Ref: 107b1677085 +Ref: lzma<2>-Footnote-11677399 +Node: Improved Modules<11>1677463 +Ref: whatsnew/3 3 improved-modules1677596 +Ref: 107c1677596 +Node: abc<2>1678931 +Ref: whatsnew/3 3 abc1679011 +Ref: 107d1679011 +Ref: abc<2>-Footnote-11679997 +Ref: abc<2>-Footnote-21680062 +Node: array<5>1680127 +Ref: whatsnew/3 3 array1680225 +Ref: 10831680225 +Ref: array<5>-Footnote-11680459 +Node: base64<4>1680526 +Ref: whatsnew/3 3 base641680629 +Ref: 10841680629 +Ref: base64<4>-Footnote-11680929 +Node: binascii<3>1680994 +Ref: whatsnew/3 3 binascii1681095 +Ref: 10851681095 +Ref: binascii<3>-Footnote-11681351 +Node: bz2<2>1681416 +Ref: whatsnew/3 3 bz21681517 +Ref: 10861681517 +Ref: bz2<2>-Footnote-11682492 +Ref: bz2<2>-Footnote-21682556 +Node: codecs<2>1682620 +Ref: whatsnew/3 3 codecs1682724 +Ref: 10891682724 +Ref: codecs<2>-Footnote-11684046 +Ref: codecs<2>-Footnote-21684111 +Ref: codecs<2>-Footnote-31684176 +Node: collections<7>1684241 +Ref: whatsnew/3 3 collections1684352 +Ref: 108a1684352 +Ref: collections<7>-Footnote-11685120 +Ref: collections<7>-Footnote-21685185 +Ref: collections<7>-Footnote-31685250 +Ref: collections<7>-Footnote-41685315 +Node: contextlib<7>1685380 +Ref: whatsnew/3 3 contextlib1685490 +Ref: 108c1685490 +Ref: contextlib<7>-Footnote-11686085 +Node: crypt<2>1686150 +Ref: whatsnew/3 3 crypt1686255 +Ref: 108d1686255 +Ref: crypt<2>-Footnote-11686459 +Node: curses<5>1686524 +Ref: whatsnew/3 3 curses1686627 +Ref: 108e1686627 +Ref: curses<5>-Footnote-11687425 +Node: datetime<6>1687489 +Ref: whatsnew/3 3 datetime1687594 +Ref: 10921687594 +Ref: datetime<6>-Footnote-11688255 +Node: decimal<3>1688320 +Ref: whatsnew/3 3 decimal1688424 +Ref: 10941688424 +Ref: whatsnew/3 3 new-decimal1688424 +Ref: 10381688424 +Ref: decimal<3>-Footnote-11690130 +Node: Features<2>1690194 +Ref: whatsnew/3 3 id11690275 +Ref: 10951690275 +Node: API changes<2>1690651 +Ref: whatsnew/3 3 id21690732 +Ref: 10981690732 +Node: email<5>1693511 +Ref: whatsnew/3 3 email1693613 +Ref: 10a71693613 +Ref: whatsnew/3 3 new-email1693613 +Ref: 10391693613 +Node: Policy Framework1693744 +Ref: whatsnew/3 3 policy-framework1693852 +Ref: 10a81693852 +Node: Provisional Policy with New Header API1696770 +Ref: whatsnew/3 3 provisional-policy-with-new-header-api1696904 +Ref: 10ac1696904 +Node: Other API Changes1701486 +Ref: whatsnew/3 3 other-api-changes1701595 +Ref: 10b01701595 +Node: ftplib<3>1702444 +Ref: whatsnew/3 3 ftplib1702548 +Ref: 10b61702548 +Ref: ftplib<3>-Footnote-11703461 +Ref: ftplib<3>-Footnote-21703525 +Ref: ftplib<3>-Footnote-31703590 +Node: functools<6>1703655 +Ref: whatsnew/3 3 functools1703756 +Ref: 10bb1703756 +Ref: functools<6>-Footnote-11704104 +Node: gc<6>1704169 +Ref: whatsnew/3 3 gc1704268 +Ref: 10bc1704268 +Node: hmac<4>1704443 +Ref: whatsnew/3 3 hmac1704537 +Ref: 10be1704537 +Ref: hmac<4>-Footnote-11704804 +Node: http<4>1704869 +Ref: whatsnew/3 3 http1704965 +Ref: 10c01704965 +Ref: http<4>-Footnote-11705651 +Ref: http<4>-Footnote-21705715 +Ref: http<4>-Footnote-31705780 +Node: html<2>1705845 +Ref: whatsnew/3 3 html1705944 +Ref: 10c71705944 +Ref: html<2>-Footnote-11706945 +Ref: html<2>-Footnote-21707010 +Ref: html<2>-Footnote-31707075 +Ref: html<2>-Footnote-41707140 +Ref: html<2>-Footnote-51707205 +Ref: html<2>-Footnote-61707270 +Ref: html<2>-Footnote-71707337 +Ref: html<2>-Footnote-81707403 +Ref: html<2>-Footnote-91707468 +Ref: html<2>-Footnote-101707533 +Ref: html<2>-Footnote-111707601 +Ref: html<2>-Footnote-121707668 +Ref: html<2>-Footnote-131707734 +Ref: html<2>-Footnote-141707800 +Ref: html<2>-Footnote-151707865 +Ref: html<2>-Footnote-161707931 +Node: imaplib<3>1707997 +Ref: whatsnew/3 3 imaplib1708099 +Ref: 10c91708099 +Ref: imaplib<3>-Footnote-11708341 +Node: inspect<9>1708405 +Ref: whatsnew/3 3 inspect1708505 +Ref: 10ca1708505 +Ref: inspect<9>-Footnote-11709219 +Ref: inspect<9>-Footnote-21709284 +Node: io<6>1709349 +Ref: whatsnew/3 3 io1709451 +Ref: 10cd1709451 +Ref: io<6>-Footnote-11710101 +Node: itertools<6>1710166 +Ref: whatsnew/3 3 itertools1710268 +Ref: 10ce1710268 +Node: logging<7>1710426 +Ref: whatsnew/3 3 logging1710530 +Ref: 10cf1710530 +Node: math<9>1710983 +Ref: whatsnew/3 3 math1711082 +Ref: 10d01711082 +Ref: math<9>-Footnote-11711308 +Node: mmap<4>1711373 +Ref: whatsnew/3 3 mmap1711480 +Ref: 10d21711480 +Ref: mmap<4>-Footnote-11711818 +Node: multiprocessing<8>1711883 +Ref: whatsnew/3 3 multiprocessing1711993 +Ref: 10d41711993 +Ref: multiprocessing<8>-Footnote-11713152 +Ref: multiprocessing<8>-Footnote-21713217 +Ref: multiprocessing<8>-Footnote-31713281 +Ref: multiprocessing<8>-Footnote-41713345 +Node: nntplib<2>1713410 +Ref: whatsnew/3 3 nntplib1713519 +Ref: 10dc1713519 +Ref: nntplib<2>-Footnote-11714079 +Node: os<12>1714143 +Ref: whatsnew/3 3 os1714240 +Ref: 10dd1714240 +Ref: os<12>-Footnote-11721680 +Ref: os<12>-Footnote-21721745 +Ref: os<12>-Footnote-31721809 +Ref: os<12>-Footnote-41721874 +Ref: os<12>-Footnote-51721939 +Ref: os<12>-Footnote-61722004 +Ref: os<12>-Footnote-71722068 +Ref: os<12>-Footnote-81722133 +Ref: os<12>-Footnote-91722198 +Ref: os<12>-Footnote-101722263 +Ref: os<12>-Footnote-111722328 +Node: pdb<7>1722394 +Ref: whatsnew/3 3 pdb1722490 +Ref: 11141722490 +Ref: pdb<7>-Footnote-11722773 +Node: pickle<5>1722838 +Ref: whatsnew/3 3 pickle1722936 +Ref: 11151722936 +Ref: pickle<5>-Footnote-11723207 +Node: pydoc<5>1723272 +Ref: whatsnew/3 3 pydoc1723369 +Ref: 11171723369 +Node: re<9>1723568 +Ref: whatsnew/3 3 re1723661 +Ref: 11181723661 +Ref: re<9>-Footnote-11723857 +Node: sched1723921 +Ref: whatsnew/3 3 sched1724015 +Ref: 11191724015 +Ref: sched-Footnote-11725162 +Ref: sched-Footnote-21725227 +Ref: sched-Footnote-31725291 +Ref: sched-Footnote-41725356 +Ref: sched-Footnote-51725421 +Node: select<2>1725486 +Ref: whatsnew/3 3 select1725583 +Ref: 111e1725583 +Ref: select<2>-Footnote-11725848 +Node: shlex<3>1725912 +Ref: whatsnew/3 3 shlex1726013 +Ref: 111f1726013 +Node: shutil<7>1726320 +Ref: whatsnew/3 3 shutil1726421 +Ref: 11201726421 +Ref: shutil<7>-Footnote-11728297 +Ref: shutil<7>-Footnote-21728362 +Ref: shutil<7>-Footnote-31728427 +Ref: shutil<7>-Footnote-41728492 +Ref: shutil<7>-Footnote-51728557 +Ref: shutil<7>-Footnote-61728622 +Ref: shutil<7>-Footnote-71728687 +Ref: shutil<7>-Footnote-81728751 +Node: signal<4>1728815 +Ref: whatsnew/3 3 signal1728916 +Ref: 11231728916 +Ref: signal<4>-Footnote-11729989 +Node: smtpd<4>1730053 +Ref: whatsnew/3 3 smtpd1730155 +Ref: 112a1730155 +Ref: smtpd<4>-Footnote-11730638 +Ref: smtpd<4>-Footnote-21730697 +Ref: smtpd<4>-Footnote-31730756 +Node: smtplib<4>1730820 +Ref: whatsnew/3 3 smtplib1730923 +Ref: 112b1730923 +Ref: smtplib<4>-Footnote-11731677 +Ref: smtplib<4>-Footnote-21731742 +Ref: smtplib<4>-Footnote-31731807 +Node: socket<10>1731871 +Ref: whatsnew/3 3 socket1731981 +Ref: 112d1731981 +Ref: socket<10>-Footnote-11733223 +Ref: socket<10>-Footnote-21733287 +Ref: socket<10>-Footnote-31733352 +Ref: socket<10>-Footnote-41733441 +Ref: socket<10>-Footnote-51733506 +Node: socketserver<3>1733571 +Ref: whatsnew/3 3 socketserver1733682 +Ref: 11301733682 +Ref: socketserver<3>-Footnote-11734060 +Node: sqlite3<10>1734125 +Ref: whatsnew/3 3 sqlite31734233 +Ref: 11341734233 +Ref: sqlite3<10>-Footnote-11734510 +Node: ssl<11>1734575 +Ref: whatsnew/3 3 ssl1734675 +Ref: 11351734675 +Ref: ssl<11>-Footnote-11736896 +Ref: ssl<11>-Footnote-21736961 +Ref: ssl<11>-Footnote-31737026 +Ref: ssl<11>-Footnote-41737091 +Ref: ssl<11>-Footnote-51737156 +Ref: ssl<11>-Footnote-61737221 +Ref: ssl<11>-Footnote-71737286 +Ref: ssl<11>-Footnote-81737351 +Ref: ssl<11>-Footnote-91737416 +Ref: ssl<11>-Footnote-101737481 +Ref: ssl<11>-Footnote-111737547 +Node: stat<2>1737613 +Ref: whatsnew/3 3 stat1737711 +Ref: 113e1737711 +Ref: stat<2>-Footnote-11738009 +Node: struct<3>1738074 +Ref: whatsnew/3 3 struct1738178 +Ref: 11401738178 +Ref: struct<3>-Footnote-11738427 +Node: subprocess<6>1738491 +Ref: whatsnew/3 3 subprocess1738595 +Ref: 11411738595 +Ref: subprocess<6>-Footnote-11738933 +Ref: subprocess<6>-Footnote-21738997 +Node: sys<13>1739061 +Ref: whatsnew/3 3 sys1739166 +Ref: 11431739166 +Ref: sys<13>-Footnote-11739387 +Node: tarfile<9>1739452 +Ref: whatsnew/3 3 tarfile1739555 +Ref: 11451739555 +Ref: tarfile<9>-Footnote-11739764 +Node: tempfile<4>1739828 +Ref: whatsnew/3 3 tempfile1739935 +Ref: 11461739935 +Ref: tempfile<4>-Footnote-11740162 +Node: textwrap<2>1740226 +Ref: whatsnew/3 3 textwrap1740335 +Ref: 11471740335 +Ref: textwrap<2>-Footnote-11740581 +Node: threading<8>1740646 +Ref: whatsnew/3 3 threading1740751 +Ref: 11481740751 +Ref: threading<8>-Footnote-11741690 +Ref: threading<8>-Footnote-21741755 +Node: time<8>1741819 +Ref: whatsnew/3 3 time1741921 +Ref: 114f1741921 +Ref: time<8>-Footnote-11742893 +Ref: time<8>-Footnote-21742935 +Node: types<7>1743000 +Ref: whatsnew/3 3 types1743102 +Ref: 11541743102 +Ref: types<7>-Footnote-11743442 +Ref: types<7>-Footnote-21743507 +Ref: types<7>-Footnote-31743549 +Node: unittest<10>1743614 +Ref: whatsnew/3 3 unittest1743718 +Ref: 11571743718 +Ref: unittest<10>-Footnote-11744137 +Node: urllib<4>1744202 +Ref: whatsnew/3 3 urllib1744311 +Ref: 115c1744311 +Ref: urllib<4>-Footnote-11744666 +Node: webbrowser<3>1744733 +Ref: whatsnew/3 3 webbrowser1744854 +Ref: 115e1744854 +Ref: webbrowser<3>-Footnote-11745398 +Ref: webbrowser<3>-Footnote-21745463 +Node: xml etree ElementTree<2>1745528 +Ref: whatsnew/3 3 xml-etree-elementtree1745647 +Ref: 115f1745647 +Node: zlib<2>1746168 +Ref: whatsnew/3 3 zlib1746265 +Ref: 11601746265 +Ref: zlib<2>-Footnote-11746741 +Ref: zlib<2>-Footnote-21746806 +Node: Optimizations<10>1746871 +Ref: whatsnew/3 3 optimizations1747015 +Ref: 11631747015 +Ref: Optimizations<10>-Footnote-11747828 +Ref: Optimizations<10>-Footnote-21747870 +Ref: Optimizations<10>-Footnote-31747935 +Ref: Optimizations<10>-Footnote-41748000 +Node: Build and C API Changes<4>1748065 +Ref: whatsnew/3 3 build-and-c-api-changes1748203 +Ref: 10411748203 +Ref: Build and C API Changes<4>-Footnote-11750094 +Ref: Build and C API Changes<4>-Footnote-21750136 +Ref: Build and C API Changes<4>-Footnote-31750178 +Node: Deprecated<12>1750243 +Ref: whatsnew/3 3 deprecated1750385 +Ref: 11791750385 +Node: Unsupported Operating Systems<2>1750724 +Ref: whatsnew/3 3 unsupported-operating-systems1750866 +Ref: 117a1750866 +Node: Deprecated Python modules functions and methods<4>1751222 +Ref: whatsnew/3 3 deprecated-python-modules-functions-and-methods1751419 +Ref: 117b1751419 +Ref: Deprecated Python modules functions and methods<4>-Footnote-11753771 +Ref: Deprecated Python modules functions and methods<4>-Footnote-21753835 +Ref: Deprecated Python modules functions and methods<4>-Footnote-31753877 +Ref: Deprecated Python modules functions and methods<4>-Footnote-41753942 +Ref: Deprecated Python modules functions and methods<4>-Footnote-51754007 +Node: Deprecated functions and types of the C API<3>1754072 +Ref: whatsnew/3 3 deprecated-functions-and-types-of-the-c-api1754256 +Ref: 117f1754256 +Ref: Deprecated functions and types of the C API<3>-Footnote-11757282 +Node: Deprecated features1757324 +Ref: whatsnew/3 3 deprecated-features1757449 +Ref: 11891757449 +Node: Porting to Python 3 31757674 +Ref: whatsnew/3 3 porting-to-python-3-31757781 +Ref: 118a1757781 +Node: Porting Python code1758060 +Ref: whatsnew/3 3 porting-python-code1758160 +Ref: 10671758160 +Ref: whatsnew/3 3 portingpythoncode1758160 +Ref: 118b1758160 +Ref: Porting Python code-Footnote-11765192 +Ref: Porting Python code-Footnote-21765257 +Ref: Porting Python code-Footnote-31765322 +Ref: Porting Python code-Footnote-41765387 +Ref: Porting Python code-Footnote-51765429 +Ref: Porting Python code-Footnote-61765471 +Ref: Porting Python code-Footnote-71765535 +Ref: Porting Python code-Footnote-81765602 +Ref: Porting Python code-Footnote-91765667 +Ref: Porting Python code-Footnote-101765731 +Node: Porting C code1765797 +Ref: whatsnew/3 3 porting-c-code1765927 +Ref: 10421765927 +Ref: Porting C code-Footnote-11767428 +Node: Building C extensions1767470 +Ref: whatsnew/3 3 building-c-extensions1767608 +Ref: 11991767608 +Ref: Building C extensions-Footnote-11768208 +Node: Command Line Switch Changes1768273 +Ref: whatsnew/3 3 command-line-switch-changes1768388 +Ref: 119a1768388 +Ref: Command Line Switch Changes-Footnote-11768956 +Ref: Command Line Switch Changes-Footnote-21769021 +Node: What’s New In Python 3 21769086 +Ref: whatsnew/3 2 doc1769241 +Ref: 119c1769241 +Ref: whatsnew/3 2 what-s-new-in-python-3-21769241 +Ref: 119d1769241 +Ref: What’s New In Python 3 2-Footnote-11770640 +Ref: What’s New In Python 3 2-Footnote-21770739 +Node: PEP 384 Defining a Stable ABI1770781 +Ref: whatsnew/3 2 pep-384-defining-a-stable-abi1770926 +Ref: 119e1770926 +Ref: PEP 384 Defining a Stable ABI-Footnote-11772019 +Node: PEP 389 Argparse Command Line Parsing Module1772061 +Ref: whatsnew/3 2 pep-389-argparse-command-line-parsing-module1772265 +Ref: 119f1772265 +Ref: PEP 389 Argparse Command Line Parsing Module-Footnote-11776406 +Node: PEP 391 Dictionary Based Configuration for Logging1776448 +Ref: whatsnew/3 2 pep-391-dictionary-based-configuration-for-logging1776661 +Ref: 11a11776661 +Ref: PEP 391 Dictionary Based Configuration for Logging-Footnote-11778960 +Node: PEP 3148 The concurrent futures module1779002 +Ref: whatsnew/3 2 pep-3148-the-concurrent-futures-module1779206 +Ref: 11a31779206 +Ref: PEP 3148 The concurrent futures module-Footnote-11781910 +Node: PEP 3147 PYC Repository Directories1781952 +Ref: whatsnew/3 2 pep-3147-pyc-repository-directories1782142 +Ref: 11a71782142 +Ref: PEP 3147 PYC Repository Directories-Footnote-11785213 +Node: PEP 3149 ABI Version Tagged so Files1785255 +Ref: whatsnew/3 2 pep-3149-abi-version-tagged-so-files1785458 +Ref: 11a91785458 +Ref: PEP 3149 ABI Version Tagged so Files-Footnote-11786718 +Node: PEP 3333 Python Web Server Gateway Interface v1 0 11786760 +Ref: whatsnew/3 2 pep-3333-python-web-server-gateway-interface-v1-0-11786954 +Ref: 11aa1786954 +Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-11789320 +Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-21789379 +Ref: PEP 3333 Python Web Server Gateway Interface v1 0 1-Footnote-31789438 +Node: Other Language Changes<12>1789480 +Ref: whatsnew/3 2 other-language-changes1789673 +Ref: 11ad1789673 +Ref: Other Language Changes<12>-Footnote-11799205 +Ref: Other Language Changes<12>-Footnote-21799269 +Ref: Other Language Changes<12>-Footnote-31799333 +Ref: Other Language Changes<12>-Footnote-41799400 +Ref: Other Language Changes<12>-Footnote-51799464 +Ref: Other Language Changes<12>-Footnote-61799528 +Ref: Other Language Changes<12>-Footnote-71799592 +Ref: Other Language Changes<12>-Footnote-81799656 +Ref: Other Language Changes<12>-Footnote-91799720 +Ref: Other Language Changes<12>-Footnote-101799784 +Ref: Other Language Changes<12>-Footnote-111799850 +Ref: Other Language Changes<12>-Footnote-121799917 +Ref: Other Language Changes<12>-Footnote-131799982 +Ref: Other Language Changes<12>-Footnote-141800047 +Ref: Other Language Changes<12>-Footnote-151800113 +Ref: Other Language Changes<12>-Footnote-161800179 +Node: New Improved and Deprecated Modules1800244 +Ref: whatsnew/3 2 new-improved-and-deprecated-modules1800401 +Ref: 11b91800401 +Node: email<6>1802432 +Ref: whatsnew/3 2 email1802532 +Ref: 11ba1802532 +Ref: email<6>-Footnote-11804515 +Ref: email<6>-Footnote-21804574 +Ref: email<6>-Footnote-31804638 +Node: elementtree1804703 +Ref: whatsnew/3 2 elementtree1804824 +Ref: 11c21804824 +Ref: elementtree-Footnote-11806310 +Ref: elementtree-Footnote-21806410 +Node: functools<7>1806474 +Ref: whatsnew/3 2 functools1806599 +Ref: 11c91806599 +Ref: functools<7>-Footnote-11810071 +Ref: functools<7>-Footnote-21810154 +Ref: functools<7>-Footnote-31810233 +Ref: functools<7>-Footnote-41810298 +Ref: functools<7>-Footnote-51810363 +Ref: functools<7>-Footnote-61810427 +Ref: functools<7>-Footnote-71810491 +Ref: functools<7>-Footnote-81810555 +Node: itertools<7>1810607 +Ref: whatsnew/3 2 itertools1810735 +Ref: 11cd1810735 +Node: collections<8>1811428 +Ref: whatsnew/3 2 collections1811556 +Ref: 11cf1811556 +Ref: collections<8>-Footnote-11813805 +Ref: collections<8>-Footnote-21813865 +Node: threading<9>1813912 +Ref: whatsnew/3 2 threading1814045 +Ref: 11d41814045 +Ref: threading<9>-Footnote-11816811 +Ref: threading<9>-Footnote-21816872 +Ref: threading<9>-Footnote-31816971 +Ref: threading<9>-Footnote-41817043 +Node: datetime and time1817107 +Ref: whatsnew/3 2 datetime-and-time1817234 +Ref: 11d81817234 +Ref: datetime and time-Footnote-11820028 +Ref: datetime and time-Footnote-21820095 +Ref: datetime and time-Footnote-31820159 +Ref: datetime and time-Footnote-41820223 +Ref: datetime and time-Footnote-51820287 +Ref: datetime and time-Footnote-61820354 +Ref: datetime and time-Footnote-71820418 +Node: math<10>1820483 +Ref: whatsnew/3 2 math1820604 +Ref: 11dc1820604 +Ref: math<10>-Footnote-11822487 +Node: abc<3>1822540 +Ref: whatsnew/3 2 abc1822649 +Ref: 11e11822649 +Ref: abc<3>-Footnote-11823276 +Node: io<7>1823340 +Ref: whatsnew/3 2 io1823448 +Ref: 11e21823448 +Ref: io<7>-Footnote-11824616 +Node: reprlib1824680 +Ref: whatsnew/3 2 reprlib1824792 +Ref: 11e41824792 +Ref: reprlib-Footnote-11825777 +Ref: reprlib-Footnote-21825841 +Node: logging<8>1825905 +Ref: whatsnew/3 2 logging1826018 +Ref: 11e61826018 +Node: csv<4>1827883 +Ref: whatsnew/3 2 csv1828002 +Ref: 11ee1828002 +Ref: csv<4>-Footnote-11828868 +Ref: csv<4>-Footnote-21828932 +Node: contextlib<8>1828999 +Ref: whatsnew/3 2 contextlib1829129 +Ref: 11f21829129 +Ref: contextlib<8>-Footnote-11831347 +Node: decimal and fractions1831411 +Ref: whatsnew/3 2 decimal-and-fractions1831538 +Ref: 11f51831538 +Ref: decimal and fractions-Footnote-11833971 +Ref: decimal and fractions-Footnote-21834035 +Ref: decimal and fractions-Footnote-31834099 +Ref: decimal and fractions-Footnote-41834163 +Ref: decimal and fractions-Footnote-51834227 +Ref: decimal and fractions-Footnote-61834291 +Node: ftp1834355 +Ref: whatsnew/3 2 ftp1834474 +Ref: 11f91834474 +Ref: ftp-Footnote-11835819 +Ref: ftp-Footnote-21835883 +Ref: ftp-Footnote-31835947 +Ref: ftp-Footnote-41836011 +Node: popen1836075 +Ref: whatsnew/3 2 popen1836182 +Ref: 11fa1836182 +Ref: popen-Footnote-11836489 +Ref: popen-Footnote-21836553 +Node: select<3>1836618 +Ref: whatsnew/3 2 select1836738 +Ref: 11fb1836738 +Ref: select<3>-Footnote-11837172 +Node: gzip and zipfile1837236 +Ref: whatsnew/3 2 gzip-and-zipfile1837362 +Ref: 11fd1837362 +Ref: gzip and zipfile-Footnote-11838929 +Ref: gzip and zipfile-Footnote-21838993 +Ref: gzip and zipfile-Footnote-31839057 +Ref: gzip and zipfile-Footnote-41839124 +Ref: gzip and zipfile-Footnote-51839188 +Ref: gzip and zipfile-Footnote-61839252 +Node: tarfile<10>1839316 +Ref: whatsnew/3 2 tarfile1839443 +Ref: 12011839443 +Ref: tarfile<10>-Footnote-11841019 +Node: hashlib<7>1841083 +Ref: whatsnew/3 2 hashlib1841200 +Ref: 12041841200 +Ref: hashlib<7>-Footnote-11841957 +Node: ast<5>1842021 +Ref: whatsnew/3 2 ast1842133 +Ref: 12051842133 +Node: os<13>1843072 +Ref: whatsnew/3 2 os1843183 +Ref: 12061843183 +Node: shutil<8>1843958 +Ref: whatsnew/3 2 shutil1844074 +Ref: 120a1844074 +Node: sqlite3<11>1846244 +Ref: whatsnew/3 2 sqlite31846361 +Ref: 120c1846361 +Ref: sqlite3<11>-Footnote-11847012 +Node: html<3>1847076 +Ref: whatsnew/3 2 html1847194 +Ref: 120d1847194 +Node: socket<11>1847483 +Ref: whatsnew/3 2 socket1847597 +Ref: 120e1847597 +Ref: socket<11>-Footnote-11848243 +Ref: socket<11>-Footnote-21848307 +Node: ssl<12>1848371 +Ref: whatsnew/3 2 ssl1848482 +Ref: 12101848482 +Ref: ssl<12>-Footnote-11850584 +Ref: ssl<12>-Footnote-21850643 +Ref: ssl<12>-Footnote-31850715 +Ref: ssl<12>-Footnote-41850779 +Ref: ssl<12>-Footnote-51850843 +Ref: ssl<12>-Footnote-61850907 +Ref: ssl<12>-Footnote-71850971 +Ref: ssl<12>-Footnote-81851035 +Ref: ssl<12>-Footnote-91851099 +Node: nntp1851163 +Ref: whatsnew/3 2 nntp1851276 +Ref: 12141851276 +Ref: nntp-Footnote-11851831 +Ref: nntp-Footnote-21851895 +Node: certificates1851959 +Ref: whatsnew/3 2 certificates1852075 +Ref: 12151852075 +Ref: certificates-Footnote-11852473 +Node: imaplib<4>1852537 +Ref: whatsnew/3 2 imaplib1852663 +Ref: 12171852663 +Ref: imaplib<4>-Footnote-11852937 +Node: http client<4>1853001 +Ref: whatsnew/3 2 http-client1853127 +Ref: 12191853127 +Ref: http client<4>-Footnote-11854554 +Node: unittest<11>1854619 +Ref: whatsnew/3 2 unittest1854744 +Ref: 121c1854744 +Ref: unittest<11>-Footnote-11859428 +Ref: unittest<11>-Footnote-21859493 +Ref: unittest<11>-Footnote-31859557 +Node: random<5>1859621 +Ref: whatsnew/3 2 random1859741 +Ref: 12211859741 +Ref: random<5>-Footnote-11860407 +Node: poplib<4>1860471 +Ref: whatsnew/3 2 poplib1860590 +Ref: 12241860590 +Ref: poplib<4>-Footnote-11860944 +Node: asyncore<2>1861008 +Ref: whatsnew/3 2 asyncore1861129 +Ref: 12251861129 +Ref: asyncore<2>-Footnote-11861584 +Node: tempfile<5>1861648 +Ref: whatsnew/3 2 tempfile1861771 +Ref: 12261861771 +Ref: tempfile<5>-Footnote-11862180 +Node: inspect<10>1862244 +Ref: whatsnew/3 2 inspect1862364 +Ref: 12281862364 +Ref: inspect<10>-Footnote-11863739 +Node: pydoc<6>1863804 +Ref: whatsnew/3 2 pydoc1863919 +Ref: 122a1863919 +Ref: pydoc<6>-Footnote-11864238 +Node: dis<5>1864302 +Ref: whatsnew/3 2 dis1864412 +Ref: 122b1864412 +Ref: dis<5>-Footnote-11866563 +Node: dbm<7>1866627 +Ref: whatsnew/3 2 dbm1866738 +Ref: 122d1866738 +Ref: dbm<7>-Footnote-11866927 +Node: ctypes<3>1866991 +Ref: whatsnew/3 2 ctypes1867103 +Ref: 122e1867103 +Node: site<4>1867222 +Ref: whatsnew/3 2 site1867340 +Ref: 12301867340 +Ref: site<4>-Footnote-11868574 +Node: sysconfig<3>1868638 +Ref: whatsnew/3 2 sysconfig1868753 +Ref: 12341868753 +Node: pdb<8>1870984 +Ref: whatsnew/3 2 pdb1871107 +Ref: 12381871107 +Node: configparser<5>1872018 +Ref: whatsnew/3 2 configparser1872144 +Ref: 12391872144 +Node: urllib parse<6>1875010 +Ref: whatsnew/3 2 urllib-parse1875137 +Ref: 123a1875137 +Ref: urllib parse<6>-Footnote-11877150 +Ref: urllib parse<6>-Footnote-21877193 +Ref: urllib parse<6>-Footnote-31877252 +Ref: urllib parse<6>-Footnote-41877316 +Ref: urllib parse<6>-Footnote-51877380 +Node: mailbox1877444 +Ref: whatsnew/3 2 mailbox1877566 +Ref: 123e1877566 +Ref: mailbox-Footnote-11879146 +Node: turtledemo1879210 +Ref: whatsnew/3 2 turtledemo1879308 +Ref: 12451879308 +Ref: turtledemo-Footnote-11879745 +Node: Multi-threading1879810 +Ref: whatsnew/3 2 multi-threading1879958 +Ref: 12461879958 +Ref: Multi-threading-Footnote-11881604 +Ref: Multi-threading-Footnote-21881683 +Ref: Multi-threading-Footnote-31881747 +Ref: Multi-threading-Footnote-41881813 +Node: Optimizations<11>1881877 +Ref: whatsnew/3 2 optimizations1881997 +Ref: 12481881997 +Ref: Optimizations<11>-Footnote-11885504 +Ref: Optimizations<11>-Footnote-21885568 +Ref: Optimizations<11>-Footnote-31885632 +Ref: Optimizations<11>-Footnote-41885696 +Ref: Optimizations<11>-Footnote-51885742 +Ref: Optimizations<11>-Footnote-61885806 +Ref: Optimizations<11>-Footnote-71885870 +Ref: Optimizations<11>-Footnote-81885935 +Ref: Optimizations<11>-Footnote-91885999 +Ref: Optimizations<11>-Footnote-101886063 +Ref: Optimizations<11>-Footnote-111886128 +Ref: Optimizations<11>-Footnote-121886193 +Ref: Optimizations<11>-Footnote-131886258 +Ref: Optimizations<11>-Footnote-141886326 +Ref: Optimizations<11>-Footnote-151886391 +Ref: Optimizations<11>-Footnote-161886457 +Node: Unicode1886522 +Ref: whatsnew/3 2 unicode1886633 +Ref: 124d1886633 +Ref: Unicode-Footnote-11887185 +Ref: Unicode-Footnote-21887236 +Ref: Unicode-Footnote-31887280 +Node: Codecs1887352 +Ref: whatsnew/3 2 codecs1887459 +Ref: 124e1887459 +Ref: Codecs-Footnote-11888389 +Node: Documentation1888456 +Ref: whatsnew/3 2 documentation1888560 +Ref: 124f1888560 +Ref: Documentation-Footnote-11890209 +Ref: Documentation-Footnote-21890278 +Ref: Documentation-Footnote-31890354 +Ref: Documentation-Footnote-41890418 +Node: IDLE1890482 +Ref: whatsnew/3 2 idle1890595 +Ref: 12531890595 +Ref: IDLE-Footnote-11890981 +Ref: IDLE-Footnote-21891045 +Node: Code Repository1891109 +Ref: whatsnew/3 2 code-repository1891235 +Ref: 12541891235 +Ref: Code Repository-Footnote-11891844 +Ref: Code Repository-Footnote-21891883 +Ref: Code Repository-Footnote-31891925 +Ref: Code Repository-Footnote-41891979 +Node: Build and C API Changes<5>1892023 +Ref: whatsnew/3 2 build-and-c-api-changes1892166 +Ref: 12551892166 +Ref: Build and C API Changes<5>-Footnote-11896314 +Ref: Build and C API Changes<5>-Footnote-21896379 +Ref: Build and C API Changes<5>-Footnote-31896443 +Ref: Build and C API Changes<5>-Footnote-41896507 +Ref: Build and C API Changes<5>-Footnote-51896571 +Ref: Build and C API Changes<5>-Footnote-61896635 +Ref: Build and C API Changes<5>-Footnote-71896699 +Ref: Build and C API Changes<5>-Footnote-81896763 +Ref: Build and C API Changes<5>-Footnote-91896827 +Ref: Build and C API Changes<5>-Footnote-101896891 +Ref: Build and C API Changes<5>-Footnote-111896956 +Ref: Build and C API Changes<5>-Footnote-121897021 +Ref: Build and C API Changes<5>-Footnote-131897086 +Ref: Build and C API Changes<5>-Footnote-141897151 +Ref: Build and C API Changes<5>-Footnote-151897234 +Node: Porting to Python 3 21897335 +Ref: whatsnew/3 2 porting-to-python-3-21897454 +Ref: 125e1897454 +Ref: Porting to Python 3 2-Footnote-11904309 +Ref: Porting to Python 3 2-Footnote-21904373 +Ref: Porting to Python 3 2-Footnote-31904437 +Ref: Porting to Python 3 2-Footnote-41904482 +Ref: Porting to Python 3 2-Footnote-51904547 +Ref: Porting to Python 3 2-Footnote-61904612 +Ref: Porting to Python 3 2-Footnote-71904677 +Node: What’s New In Python 3 11904741 +Ref: whatsnew/3 1 doc1904896 +Ref: 126e1904896 +Ref: whatsnew/3 1 what-s-new-in-python-3-11904896 +Ref: 126f1904896 +Node: PEP 372 Ordered Dictionaries1905569 +Ref: whatsnew/3 1 pep-372-ordered-dictionaries1905717 +Ref: 12701905717 +Ref: PEP 372 Ordered Dictionaries-Footnote-11908225 +Ref: PEP 372 Ordered Dictionaries-Footnote-21908253 +Node: PEP 378 Format Specifier for Thousands Separator1908295 +Ref: whatsnew/3 1 pep-378-format-specifier-for-thousands-separator1908478 +Ref: 12711908478 +Ref: PEP 378 Format Specifier for Thousands Separator-Footnote-11909719 +Node: Other Language Changes<13>1909761 +Ref: whatsnew/3 1 other-language-changes1909954 +Ref: 12721909954 +Ref: Other Language Changes<13>-Footnote-11914755 +Ref: Other Language Changes<13>-Footnote-21914822 +Ref: Other Language Changes<13>-Footnote-31914886 +Ref: Other Language Changes<13>-Footnote-41914950 +Ref: Other Language Changes<13>-Footnote-51915014 +Ref: Other Language Changes<13>-Footnote-61915059 +Ref: Other Language Changes<13>-Footnote-71915123 +Node: New Improved and Deprecated Modules<2>1915187 +Ref: whatsnew/3 1 new-improved-and-deprecated-modules1915349 +Ref: 12731915349 +Ref: New Improved and Deprecated Modules<2>-Footnote-11923956 +Ref: New Improved and Deprecated Modules<2>-Footnote-21924023 +Ref: New Improved and Deprecated Modules<2>-Footnote-31924087 +Ref: New Improved and Deprecated Modules<2>-Footnote-41924151 +Ref: New Improved and Deprecated Modules<2>-Footnote-51924215 +Ref: New Improved and Deprecated Modules<2>-Footnote-61924279 +Ref: New Improved and Deprecated Modules<2>-Footnote-71924321 +Ref: New Improved and Deprecated Modules<2>-Footnote-81924385 +Ref: New Improved and Deprecated Modules<2>-Footnote-91924449 +Ref: New Improved and Deprecated Modules<2>-Footnote-101924513 +Ref: New Improved and Deprecated Modules<2>-Footnote-111924578 +Ref: New Improved and Deprecated Modules<2>-Footnote-121924643 +Ref: New Improved and Deprecated Modules<2>-Footnote-131924708 +Node: Optimizations<12>1924773 +Ref: whatsnew/3 1 optimizations1924916 +Ref: 12831924916 +Ref: Optimizations<12>-Footnote-11927095 +Ref: Optimizations<12>-Footnote-21927137 +Ref: Optimizations<12>-Footnote-31927201 +Ref: Optimizations<12>-Footnote-41927265 +Ref: Optimizations<12>-Footnote-51927329 +Ref: Optimizations<12>-Footnote-61927355 +Ref: Optimizations<12>-Footnote-71927419 +Node: IDLE<2>1927483 +Ref: whatsnew/3 1 idle1927614 +Ref: 12841927614 +Ref: IDLE<2>-Footnote-11927831 +Node: Build and C API Changes<6>1927895 +Ref: whatsnew/3 1 build-and-c-api-changes1928030 +Ref: 12851928030 +Ref: Build and C API Changes<6>-Footnote-11930297 +Ref: Build and C API Changes<6>-Footnote-21930361 +Ref: Build and C API Changes<6>-Footnote-31930425 +Ref: Build and C API Changes<6>-Footnote-41930489 +Ref: Build and C API Changes<6>-Footnote-51930553 +Node: Porting to Python 3 11930617 +Ref: whatsnew/3 1 porting-to-python-3-11930736 +Ref: 12891930736 +Node: What’s New In Python 3 01931868 +Ref: whatsnew/3 0 doc1932023 +Ref: 128a1932023 +Ref: whatsnew/3 0 what-s-new-in-python-3-01932023 +Ref: 128b1932023 +Node: Common Stumbling Blocks1933881 +Ref: whatsnew/3 0 common-stumbling-blocks1934002 +Ref: 128c1934002 +Node: Print Is A Function1934372 +Ref: whatsnew/3 0 print-is-a-function1934496 +Ref: 128d1934496 +Ref: Print Is A Function-Footnote-11936182 +Node: Views And Iterators Instead Of Lists1936224 +Ref: whatsnew/3 0 views-and-iterators-instead-of-lists1936377 +Ref: 128e1936377 +Node: Ordering Comparisons1938221 +Ref: whatsnew/3 0 ordering-comparisons1938363 +Ref: 12911938363 +Node: Integers1939815 +Ref: whatsnew/3 0 integers1939961 +Ref: 12931939961 +Ref: Integers-Footnote-11941186 +Ref: Integers-Footnote-21941228 +Node: Text Vs Data Instead Of Unicode Vs 8-bit1941270 +Ref: whatsnew/3 0 text-vs-data-instead-of-unicode-vs-8-bit1941387 +Ref: 12941941387 +Ref: Text Vs Data Instead Of Unicode Vs 8-bit-Footnote-11947984 +Ref: Text Vs Data Instead Of Unicode Vs 8-bit-Footnote-21948026 +Ref: Text Vs Data Instead Of Unicode Vs 8-bit-Footnote-31948068 +Node: Overview Of Syntax Changes1948110 +Ref: whatsnew/3 0 overview-of-syntax-changes1948277 +Ref: 12981948277 +Node: New Syntax1948489 +Ref: whatsnew/3 0 new-syntax1948585 +Ref: 12991948585 +Ref: New Syntax-Footnote-11951135 +Ref: New Syntax-Footnote-21951177 +Ref: New Syntax-Footnote-31951219 +Ref: New Syntax-Footnote-41951261 +Ref: New Syntax-Footnote-51951303 +Node: Changed Syntax1951345 +Ref: whatsnew/3 0 changed-syntax1951464 +Ref: 129c1951464 +Ref: Changed Syntax-Footnote-11953143 +Ref: Changed Syntax-Footnote-21953185 +Ref: Changed Syntax-Footnote-31953227 +Ref: Changed Syntax-Footnote-41953269 +Node: Removed Syntax1953311 +Ref: whatsnew/3 0 removed-syntax1953411 +Ref: 129d1953411 +Ref: Removed Syntax-Footnote-11954595 +Ref: Removed Syntax-Footnote-21954637 +Node: Changes Already Present In Python 2 61954679 +Ref: whatsnew/3 0 changes-already-present-in-python-2-61954838 +Ref: 129f1954838 +Node: Library Changes1958709 +Ref: whatsnew/3 0 library-changes1958886 +Ref: 12b21958886 +Ref: Library Changes-Footnote-11965141 +Ref: Library Changes-Footnote-21965183 +Ref: Library Changes-Footnote-31965225 +Ref: Library Changes-Footnote-41965267 +Ref: Library Changes-Footnote-51965309 +Ref: Library Changes-Footnote-61965351 +Node: PEP 3101 A New Approach To String Formatting1965393 +Ref: whatsnew/3 0 pep-3101-a-new-approach-to-string-formatting1965554 +Ref: 12b71965554 +Ref: PEP 3101 A New Approach To String Formatting-Footnote-11965946 +Node: Changes To Exceptions1965988 +Ref: whatsnew/3 0 changes-to-exceptions1966161 +Ref: 12b81966161 +Ref: Changes To Exceptions-Footnote-11969698 +Ref: Changes To Exceptions-Footnote-21969740 +Ref: Changes To Exceptions-Footnote-31969782 +Ref: Changes To Exceptions-Footnote-41969824 +Ref: Changes To Exceptions-Footnote-51969866 +Node: Miscellaneous Other Changes1969908 +Ref: whatsnew/3 0 miscellaneous-other-changes1970063 +Ref: 12bc1970063 +Node: Operators And Special Methods1970191 +Ref: whatsnew/3 0 operators-and-special-methods1970301 +Ref: 12bd1970301 +Ref: Operators And Special Methods-Footnote-11971985 +Node: Builtins1972027 +Ref: whatsnew/3 0 builtins1972137 +Ref: 12c91972137 +Ref: Builtins-Footnote-11974615 +Ref: Builtins-Footnote-21974657 +Node: Build and C API Changes<7>1974699 +Ref: whatsnew/3 0 build-and-c-api-changes1974844 +Ref: 12d01974844 +Ref: Build and C API Changes<7>-Footnote-11975880 +Ref: Build and C API Changes<7>-Footnote-21975922 +Ref: Build and C API Changes<7>-Footnote-31975964 +Node: Performance1976006 +Ref: whatsnew/3 0 performance1976145 +Ref: 12d21976145 +Node: Porting To Python 3 01976466 +Ref: whatsnew/3 0 porting-to-python-3-01976570 +Ref: 12d31976570 +Node: What’s New in Python 2 71978078 +Ref: whatsnew/2 7 doc1978233 +Ref: 12d51978233 +Ref: whatsnew/2 7 what-s-new-in-python-2-71978233 +Ref: 12d61978233 +Node: The Future for Python 2 x1980698 +Ref: whatsnew/2 7 the-future-for-python-2-x1980842 +Ref: 12d71980842 +Ref: whatsnew/2 7 whatsnew27-python311980842 +Ref: 12d81980842 +Ref: The Future for Python 2 x-Footnote-11984160 +Ref: The Future for Python 2 x-Footnote-21984202 +Node: Changes to the Handling of Deprecation Warnings1984239 +Ref: whatsnew/2 7 changes-to-the-handling-of-deprecation-warnings1984411 +Ref: 12da1984411 +Ref: Changes to the Handling of Deprecation Warnings-Footnote-11985986 +Node: Python 3 1 Features1986050 +Ref: whatsnew/2 7 python-3-1-features1986248 +Ref: 12db1986248 +Node: PEP 372 Adding an Ordered Dictionary to collections1988173 +Ref: whatsnew/2 7 pep-03721988375 +Ref: 12dc1988375 +Ref: whatsnew/2 7 pep-372-adding-an-ordered-dictionary-to-collections1988375 +Ref: 12df1988375 +Ref: PEP 372 Adding an Ordered Dictionary to collections-Footnote-11991987 +Ref: PEP 372 Adding an Ordered Dictionary to collections-Footnote-21992015 +Node: PEP 378 Format Specifier for Thousands Separator<2>1992057 +Ref: whatsnew/2 7 pep-03781992293 +Ref: 12dd1992293 +Ref: whatsnew/2 7 pep-378-format-specifier-for-thousands-separator1992293 +Ref: 12e11992293 +Ref: PEP 378 Format Specifier for Thousands Separator<2>-Footnote-11993810 +Node: PEP 389 The argparse Module for Parsing Command Lines1993852 +Ref: whatsnew/2 7 pep-389-the-argparse-module-for-parsing-command-lines1994087 +Ref: 12e21994087 +Ref: PEP 389 The argparse Module for Parsing Command Lines-Footnote-11998124 +Node: PEP 391 Dictionary-Based Configuration For Logging1998166 +Ref: whatsnew/2 7 pep-391-dictionary-based-configuration-for-logging1998375 +Ref: 12e31998375 +Ref: PEP 391 Dictionary-Based Configuration For Logging-Footnote-12002272 +Node: PEP 3106 Dictionary Views2002314 +Ref: whatsnew/2 7 pep-3106-dictionary-views2002500 +Ref: 12ea2002500 +Ref: PEP 3106 Dictionary Views-Footnote-12004617 +Ref: PEP 3106 Dictionary Views-Footnote-22004659 +Node: PEP 3137 The memoryview Object2004723 +Ref: whatsnew/2 7 pep-3137-the-memoryview-object2004885 +Ref: 12eb2004885 +Ref: PEP 3137 The memoryview Object-Footnote-12006550 +Ref: PEP 3137 The memoryview Object-Footnote-22006592 +Node: Other Language Changes<14>2006656 +Ref: whatsnew/2 7 other-language-changes2006817 +Ref: 12ec2006817 +Ref: Other Language Changes<14>-Footnote-12016796 +Ref: Other Language Changes<14>-Footnote-22016860 +Ref: Other Language Changes<14>-Footnote-32016924 +Ref: Other Language Changes<14>-Footnote-42016988 +Ref: Other Language Changes<14>-Footnote-52017052 +Ref: Other Language Changes<14>-Footnote-62017116 +Ref: Other Language Changes<14>-Footnote-72017180 +Ref: Other Language Changes<14>-Footnote-82017244 +Ref: Other Language Changes<14>-Footnote-92017308 +Ref: Other Language Changes<14>-Footnote-102017372 +Ref: Other Language Changes<14>-Footnote-112017437 +Ref: Other Language Changes<14>-Footnote-122017502 +Ref: Other Language Changes<14>-Footnote-132017567 +Ref: Other Language Changes<14>-Footnote-142017632 +Ref: Other Language Changes<14>-Footnote-152017700 +Ref: Other Language Changes<14>-Footnote-162017765 +Ref: Other Language Changes<14>-Footnote-172017830 +Ref: Other Language Changes<14>-Footnote-182017895 +Ref: Other Language Changes<14>-Footnote-192017963 +Ref: Other Language Changes<14>-Footnote-202018028 +Ref: Other Language Changes<14>-Footnote-212018093 +Ref: Other Language Changes<14>-Footnote-222018158 +Ref: Other Language Changes<14>-Footnote-232018223 +Ref: Other Language Changes<14>-Footnote-242018288 +Node: Interpreter Changes2018353 +Ref: whatsnew/2 7 interpreter-changes2018461 +Ref: 12f02018461 +Ref: whatsnew/2 7 new-27-interpreter2018461 +Ref: 12f12018461 +Ref: Interpreter Changes-Footnote-12019120 +Node: Optimizations<13>2019184 +Ref: whatsnew/2 7 optimizations2019292 +Ref: 12f22019292 +Ref: Optimizations<13>-Footnote-12024179 +Ref: Optimizations<13>-Footnote-22024243 +Ref: Optimizations<13>-Footnote-32024307 +Ref: Optimizations<13>-Footnote-42024371 +Ref: Optimizations<13>-Footnote-52024435 +Ref: Optimizations<13>-Footnote-62024499 +Ref: Optimizations<13>-Footnote-72024566 +Ref: Optimizations<13>-Footnote-82024630 +Ref: Optimizations<13>-Footnote-92024694 +Ref: Optimizations<13>-Footnote-102024758 +Ref: Optimizations<13>-Footnote-112024823 +Ref: Optimizations<13>-Footnote-122024888 +Ref: Optimizations<13>-Footnote-132024953 +Node: New and Improved Modules2025018 +Ref: whatsnew/2 7 new-and-improved-modules2025175 +Ref: 12f42025175 +Ref: New and Improved Modules-Footnote-12060596 +Ref: New and Improved Modules-Footnote-22060660 +Ref: New and Improved Modules-Footnote-32060724 +Ref: New and Improved Modules-Footnote-42060777 +Ref: New and Improved Modules-Footnote-52060841 +Ref: New and Improved Modules-Footnote-62060905 +Ref: New and Improved Modules-Footnote-72060972 +Ref: New and Improved Modules-Footnote-82061036 +Ref: New and Improved Modules-Footnote-92061100 +Ref: New and Improved Modules-Footnote-102061164 +Ref: New and Improved Modules-Footnote-112061229 +Ref: New and Improved Modules-Footnote-122061294 +Ref: New and Improved Modules-Footnote-132061359 +Ref: New and Improved Modules-Footnote-142061399 +Ref: New and Improved Modules-Footnote-152061464 +Ref: New and Improved Modules-Footnote-162061529 +Ref: New and Improved Modules-Footnote-172061594 +Ref: New and Improved Modules-Footnote-182061659 +Ref: New and Improved Modules-Footnote-192061724 +Ref: New and Improved Modules-Footnote-202061789 +Ref: New and Improved Modules-Footnote-212061854 +Ref: New and Improved Modules-Footnote-222061919 +Ref: New and Improved Modules-Footnote-232061984 +Ref: New and Improved Modules-Footnote-242062049 +Ref: New and Improved Modules-Footnote-252062114 +Ref: New and Improved Modules-Footnote-262062179 +Ref: New and Improved Modules-Footnote-272062247 +Ref: New and Improved Modules-Footnote-282062312 +Ref: New and Improved Modules-Footnote-292062377 +Ref: New and Improved Modules-Footnote-302062442 +Ref: New and Improved Modules-Footnote-312062507 +Ref: New and Improved Modules-Footnote-322062572 +Ref: New and Improved Modules-Footnote-332062637 +Ref: New and Improved Modules-Footnote-342062702 +Ref: New and Improved Modules-Footnote-352062767 +Ref: New and Improved Modules-Footnote-362062832 +Ref: New and Improved Modules-Footnote-372062897 +Ref: New and Improved Modules-Footnote-382062962 +Ref: New and Improved Modules-Footnote-392063027 +Ref: New and Improved Modules-Footnote-402063092 +Ref: New and Improved Modules-Footnote-412063157 +Ref: New and Improved Modules-Footnote-422063222 +Ref: New and Improved Modules-Footnote-432063287 +Ref: New and Improved Modules-Footnote-442063352 +Ref: New and Improved Modules-Footnote-452063417 +Ref: New and Improved Modules-Footnote-462063482 +Ref: New and Improved Modules-Footnote-472063547 +Ref: New and Improved Modules-Footnote-482063612 +Ref: New and Improved Modules-Footnote-492063680 +Ref: New and Improved Modules-Footnote-502063745 +Ref: New and Improved Modules-Footnote-512063810 +Ref: New and Improved Modules-Footnote-522063875 +Ref: New and Improved Modules-Footnote-532063940 +Ref: New and Improved Modules-Footnote-542064005 +Ref: New and Improved Modules-Footnote-552064070 +Ref: New and Improved Modules-Footnote-562064135 +Ref: New and Improved Modules-Footnote-572064200 +Ref: New and Improved Modules-Footnote-582064265 +Ref: New and Improved Modules-Footnote-592064330 +Ref: New and Improved Modules-Footnote-602064395 +Ref: New and Improved Modules-Footnote-612064460 +Ref: New and Improved Modules-Footnote-622064525 +Ref: New and Improved Modules-Footnote-632064590 +Ref: New and Improved Modules-Footnote-642064655 +Ref: New and Improved Modules-Footnote-652064720 +Ref: New and Improved Modules-Footnote-662064785 +Ref: New and Improved Modules-Footnote-672064850 +Ref: New and Improved Modules-Footnote-682064915 +Ref: New and Improved Modules-Footnote-692064980 +Ref: New and Improved Modules-Footnote-702065026 +Ref: New and Improved Modules-Footnote-712065091 +Ref: New and Improved Modules-Footnote-722065156 +Ref: New and Improved Modules-Footnote-732065210 +Ref: New and Improved Modules-Footnote-742065275 +Ref: New and Improved Modules-Footnote-752065340 +Ref: New and Improved Modules-Footnote-762065405 +Ref: New and Improved Modules-Footnote-772065470 +Ref: New and Improved Modules-Footnote-782065535 +Ref: New and Improved Modules-Footnote-792065603 +Ref: New and Improved Modules-Footnote-802065668 +Ref: New and Improved Modules-Footnote-812065733 +Ref: New and Improved Modules-Footnote-822065798 +Ref: New and Improved Modules-Footnote-832065863 +Ref: New and Improved Modules-Footnote-842065928 +Ref: New and Improved Modules-Footnote-852065993 +Ref: New and Improved Modules-Footnote-862066061 +Ref: New and Improved Modules-Footnote-872066129 +Ref: New and Improved Modules-Footnote-882066194 +Ref: New and Improved Modules-Footnote-892066254 +Ref: New and Improved Modules-Footnote-902066314 +Ref: New and Improved Modules-Footnote-912066379 +Ref: New and Improved Modules-Footnote-922066444 +Ref: New and Improved Modules-Footnote-932066509 +Ref: New and Improved Modules-Footnote-942066574 +Ref: New and Improved Modules-Footnote-952066639 +Ref: New and Improved Modules-Footnote-962066704 +Ref: New and Improved Modules-Footnote-972066769 +Node: New module importlib2066834 +Ref: whatsnew/2 7 importlib-section2066944 +Ref: 12de2066944 +Ref: whatsnew/2 7 new-module-importlib2066944 +Ref: 131f2066944 +Node: New module sysconfig2068484 +Ref: whatsnew/2 7 new-module-sysconfig2068628 +Ref: 13202068628 +Node: ttk Themed Widgets for Tk2069957 +Ref: whatsnew/2 7 ttk-themed-widgets-for-tk2070104 +Ref: 13222070104 +Ref: ttk Themed Widgets for Tk-Footnote-12071196 +Ref: ttk Themed Widgets for Tk-Footnote-22071260 +Node: Updated module unittest2071324 +Ref: whatsnew/2 7 unittest-section2071481 +Ref: 13232071481 +Ref: whatsnew/2 7 updated-module-unittest2071481 +Ref: 13242071481 +Ref: Updated module unittest-Footnote-12080422 +Ref: Updated module unittest-Footnote-22080466 +Ref: Updated module unittest-Footnote-32080493 +Ref: Updated module unittest-Footnote-42080530 +Ref: Updated module unittest-Footnote-52080594 +Ref: Updated module unittest-Footnote-62080658 +Ref: Updated module unittest-Footnote-72080725 +Ref: Updated module unittest-Footnote-82080789 +Ref: Updated module unittest-Footnote-92080853 +Ref: Updated module unittest-Footnote-102080917 +Ref: Updated module unittest-Footnote-112080982 +Ref: Updated module unittest-Footnote-122081047 +Ref: Updated module unittest-Footnote-132081112 +Ref: Updated module unittest-Footnote-142081177 +Ref: Updated module unittest-Footnote-152081242 +Node: Updated module ElementTree 1 32081307 +Ref: whatsnew/2 7 elementtree-section2081430 +Ref: 133f2081430 +Ref: whatsnew/2 7 updated-module-elementtree-1-32081430 +Ref: 13402081430 +Ref: Updated module ElementTree 1 3-Footnote-12085457 +Node: Build and C API Changes<8>2085521 +Ref: whatsnew/2 7 build-and-c-api-changes2085675 +Ref: 13432085675 +Ref: Build and C API Changes<8>-Footnote-12094314 +Ref: Build and C API Changes<8>-Footnote-22094427 +Ref: Build and C API Changes<8>-Footnote-32094491 +Ref: Build and C API Changes<8>-Footnote-42094555 +Ref: Build and C API Changes<8>-Footnote-52094619 +Ref: Build and C API Changes<8>-Footnote-62094683 +Ref: Build and C API Changes<8>-Footnote-72094747 +Ref: Build and C API Changes<8>-Footnote-82094811 +Ref: Build and C API Changes<8>-Footnote-92094866 +Ref: Build and C API Changes<8>-Footnote-102094930 +Ref: Build and C API Changes<8>-Footnote-112094995 +Ref: Build and C API Changes<8>-Footnote-122095060 +Ref: Build and C API Changes<8>-Footnote-132095125 +Ref: Build and C API Changes<8>-Footnote-142095193 +Ref: Build and C API Changes<8>-Footnote-152095261 +Ref: Build and C API Changes<8>-Footnote-162095326 +Ref: Build and C API Changes<8>-Footnote-172095391 +Ref: Build and C API Changes<8>-Footnote-182095456 +Ref: Build and C API Changes<8>-Footnote-192095521 +Ref: Build and C API Changes<8>-Footnote-202095586 +Ref: Build and C API Changes<8>-Footnote-212095654 +Ref: Build and C API Changes<8>-Footnote-222095719 +Node: Capsules2095784 +Ref: whatsnew/2 7 capsules2095893 +Ref: 13462095893 +Ref: whatsnew/2 7 whatsnew27-capsules2095893 +Ref: 13472095893 +Ref: Capsules-Footnote-12097897 +Node: Port-Specific Changes Windows2097961 +Ref: whatsnew/2 7 port-specific-changes-windows2098109 +Ref: 134a2098109 +Ref: Port-Specific Changes Windows-Footnote-12099905 +Ref: Port-Specific Changes Windows-Footnote-22099969 +Ref: Port-Specific Changes Windows-Footnote-32100033 +Ref: Port-Specific Changes Windows-Footnote-42100097 +Ref: Port-Specific Changes Windows-Footnote-52100164 +Ref: Port-Specific Changes Windows-Footnote-62100228 +Node: Port-Specific Changes Mac OS X2100292 +Ref: whatsnew/2 7 port-specific-changes-mac-os-x2100461 +Ref: 13562100461 +Ref: Port-Specific Changes Mac OS X-Footnote-12101451 +Ref: Port-Specific Changes Mac OS X-Footnote-22101515 +Node: Port-Specific Changes FreeBSD2101580 +Ref: whatsnew/2 7 port-specific-changes-freebsd2101711 +Ref: 13572101711 +Ref: Port-Specific Changes FreeBSD-Footnote-12102116 +Node: Other Changes and Fixes2102180 +Ref: whatsnew/2 7 other-changes-and-fixes2102331 +Ref: 13582102331 +Ref: Other Changes and Fixes-Footnote-12104526 +Ref: Other Changes and Fixes-Footnote-22104590 +Ref: Other Changes and Fixes-Footnote-32104657 +Ref: Other Changes and Fixes-Footnote-42104721 +Ref: Other Changes and Fixes-Footnote-52104785 +Node: Porting to Python 2 72104849 +Ref: whatsnew/2 7 porting-to-python-2-72105027 +Ref: 135a2105027 +Ref: Porting to Python 2 7-Footnote-12110585 +Ref: Porting to Python 2 7-Footnote-22110649 +Ref: Porting to Python 2 7-Footnote-32110713 +Ref: Porting to Python 2 7-Footnote-42110777 +Ref: Porting to Python 2 7-Footnote-52110841 +Ref: Porting to Python 2 7-Footnote-62110905 +Ref: Porting to Python 2 7-Footnote-72110969 +Ref: Porting to Python 2 7-Footnote-82111033 +Ref: Porting to Python 2 7-Footnote-92111097 +Ref: Porting to Python 2 7-Footnote-102111161 +Ref: Porting to Python 2 7-Footnote-112111226 +Ref: Porting to Python 2 7-Footnote-122111291 +Ref: Porting to Python 2 7-Footnote-132111356 +Ref: Porting to Python 2 7-Footnote-142111416 +Node: New Features Added to Python 2 7 Maintenance Releases2111481 +Ref: whatsnew/2 7 new-features-added-to-python-2-7-maintenance-releases2111652 +Ref: 135b2111652 +Ref: whatsnew/2 7 py27-maintenance-enhancements2111652 +Ref: 12d92111652 +Node: Two new environment variables for debug mode2113117 +Ref: whatsnew/2 7 two-new-environment-variables-for-debug-mode2113311 +Ref: 135c2113311 +Ref: Two new environment variables for debug mode-Footnote-12113992 +Ref: Two new environment variables for debug mode-Footnote-22114057 +Node: PEP 434 IDLE Enhancement Exception for All Branches2114122 +Ref: whatsnew/2 7 pep-434-idle-enhancement-exception-for-all-branches2114377 +Ref: 135d2114377 +Ref: PEP 434 IDLE Enhancement Exception for All Branches-Footnote-12114897 +Node: PEP 466 Network Security Enhancements for Python 2 72114939 +Ref: whatsnew/2 7 pep-466-network-security-enhancements-for-python-2-72115198 +Ref: 135e2115198 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-12117435 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-22117477 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-32117519 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-42117584 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-52117649 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-62117691 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-72117756 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-82117821 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-92117876 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-102117918 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-112117984 +Ref: PEP 466 Network Security Enhancements for Python 2 7-Footnote-122118050 +Node: PEP 477 Backport ensurepip PEP 453 to Python 2 72118116 +Ref: whatsnew/2 7 pep-477-backport-ensurepip-pep-453-to-python-2-72118403 +Ref: 13612118403 +Ref: PEP 477 Backport ensurepip PEP 453 to Python 2 7-Footnote-12118899 +Ref: PEP 477 Backport ensurepip PEP 453 to Python 2 7-Footnote-22118941 +Node: Bootstrapping pip By Default<2>2118983 +Ref: whatsnew/2 7 bootstrapping-pip-by-default2119132 +Ref: 13622119132 +Ref: Bootstrapping pip By Default<2>-Footnote-12120800 +Ref: Bootstrapping pip By Default<2>-Footnote-22120842 +Node: Documentation Changes<2>2120932 +Ref: whatsnew/2 7 documentation-changes2121081 +Ref: 13632121081 +Ref: Documentation Changes<2>-Footnote-12122019 +Ref: Documentation Changes<2>-Footnote-22122056 +Node: PEP 476 Enabling certificate verification by default for stdlib http clients<2>2122098 +Ref: whatsnew/2 7 pep-476-enabling-certificate-verification-by-default-for-stdlib-http-clients2122390 +Ref: 13642122390 +Ref: PEP 476 Enabling certificate verification by default for stdlib http clients<2>-Footnote-12123487 +Node: PEP 493 HTTPS verification migration tools for Python 2 72123529 +Ref: whatsnew/2 7 pep-493-https-verification-migration-tools-for-python-2-72123807 +Ref: 13652123807 +Ref: PEP 493 HTTPS verification migration tools for Python 2 7-Footnote-12124971 +Node: New make regen-all build target<3>2125013 +Ref: whatsnew/2 7 new-make-regen-all-build-target2125249 +Ref: 13662125249 +Ref: New make regen-all build target<3>-Footnote-12126041 +Ref: New make regen-all build target<3>-Footnote-22126109 +Node: Removal of make touch build target<3>2126174 +Ref: whatsnew/2 7 removal-of-make-touch-build-target2126344 +Ref: 13672126344 +Ref: Removal of make touch build target<3>-Footnote-12126779 +Node: Acknowledgements2126844 +Ref: whatsnew/2 7 acknowledgements2126985 +Ref: 13682126985 +Ref: whatsnew/2 7 acks272126985 +Ref: 13692126985 +Node: What’s New in Python 2 62127258 +Ref: whatsnew/2 6 doc2127413 +Ref: 136a2127413 +Ref: whatsnew/2 6 what-s-new-in-python-2-62127413 +Ref: 136b2127413 +Ref: whatsnew/2 6 whats-new-in-2-62127413 +Ref: 12a02127413 +Ref: What’s New in Python 2 6-Footnote-12130477 +Node: Python 3 02130519 +Ref: whatsnew/2 6 python-3-02130635 +Ref: 136c2130635 +Ref: Python 3 0-Footnote-12132747 +Ref: Python 3 0-Footnote-22132789 +Node: Changes to the Development Process2132831 +Ref: whatsnew/2 6 changes-to-the-development-process2132988 +Ref: 136d2132988 +Node: New Issue Tracker Roundup2133506 +Ref: whatsnew/2 6 new-issue-tracker-roundup2133665 +Ref: 136e2133665 +Ref: New Issue Tracker Roundup-Footnote-12135715 +Ref: New Issue Tracker Roundup-Footnote-22135764 +Ref: New Issue Tracker Roundup-Footnote-32135795 +Ref: New Issue Tracker Roundup-Footnote-42135835 +Ref: New Issue Tracker Roundup-Footnote-52135870 +Node: New Documentation Format reStructuredText Using Sphinx2135908 +Ref: whatsnew/2 6 new-documentation-format-restructuredtext-using-sphinx2136067 +Ref: 136f2136067 +Ref: New Documentation Format reStructuredText Using Sphinx-Footnote-12138183 +Ref: New Documentation Format reStructuredText Using Sphinx-Footnote-22138242 +Ref: New Documentation Format reStructuredText Using Sphinx-Footnote-32138291 +Ref: New Documentation Format reStructuredText Using Sphinx-Footnote-42138327 +Node: PEP 343 The ‘with’ statement2138367 +Ref: whatsnew/2 6 pep-03432138566 +Ref: 12a12138566 +Ref: whatsnew/2 6 pep-343-the-with-statement2138566 +Ref: 13702138566 +Node: Writing Context Managers2141844 +Ref: whatsnew/2 6 new-26-context-managers2141967 +Ref: 12a22141967 +Ref: whatsnew/2 6 writing-context-managers2141967 +Ref: 13712141967 +Node: The contextlib module2146484 +Ref: whatsnew/2 6 new-module-contextlib2146607 +Ref: 12a32146607 +Ref: whatsnew/2 6 the-contextlib-module2146607 +Ref: 13722146607 +Ref: The contextlib module-Footnote-12149110 +Node: PEP 366 Explicit Relative Imports From a Main Module2149152 +Ref: whatsnew/2 6 pep-03662149357 +Ref: 12a42149357 +Ref: whatsnew/2 6 pep-366-explicit-relative-imports-from-a-main-module2149357 +Ref: 13732149357 +Node: PEP 370 Per-user site-packages Directory2150116 +Ref: whatsnew/2 6 pep-03702150324 +Ref: 12a52150324 +Ref: whatsnew/2 6 pep-370-per-user-site-packages-directory2150324 +Ref: 13752150324 +Ref: PEP 370 Per-user site-packages Directory-Footnote-12151786 +Node: PEP 371 The multiprocessing Package2151828 +Ref: whatsnew/2 6 pep-03712152019 +Ref: 12a62152019 +Ref: whatsnew/2 6 pep-371-the-multiprocessing-package2152019 +Ref: 13792152019 +Ref: PEP 371 The multiprocessing Package-Footnote-12157160 +Node: PEP 3101 Advanced String Formatting2157202 +Ref: whatsnew/2 6 pep-31012157381 +Ref: 12a72157381 +Ref: whatsnew/2 6 pep-3101-advanced-string-formatting2157381 +Ref: 137b2157381 +Ref: PEP 3101 Advanced String Formatting-Footnote-12163084 +Node: PEP 3105 print As a Function2163126 +Ref: whatsnew/2 6 pep-31052163305 +Ref: 12a82163305 +Ref: whatsnew/2 6 pep-3105-print-as-a-function2163305 +Ref: 137d2163305 +Ref: PEP 3105 print As a Function-Footnote-12164434 +Node: PEP 3110 Exception-Handling Changes2164476 +Ref: whatsnew/2 6 pep-31102164642 +Ref: 12a92164642 +Ref: whatsnew/2 6 pep-3110-exception-handling-changes2164642 +Ref: 137e2164642 +Ref: PEP 3110 Exception-Handling Changes-Footnote-12166243 +Node: PEP 3112 Byte Literals2166285 +Ref: whatsnew/2 6 pep-31122166447 +Ref: 12aa2166447 +Ref: whatsnew/2 6 pep-3112-byte-literals2166447 +Ref: 137f2166447 +Ref: PEP 3112 Byte Literals-Footnote-12169465 +Node: PEP 3116 New I/O Library2169507 +Ref: whatsnew/2 6 pep-31162169666 +Ref: 12ab2169666 +Ref: whatsnew/2 6 pep-3116-new-i-o-library2169666 +Ref: 13842169666 +Ref: PEP 3116 New I/O Library-Footnote-12173292 +Node: PEP 3118 Revised Buffer Protocol2173334 +Ref: whatsnew/2 6 pep-31182173501 +Ref: 12ac2173501 +Ref: whatsnew/2 6 pep-3118-revised-buffer-protocol2173501 +Ref: 13852173501 +Ref: PEP 3118 Revised Buffer Protocol-Footnote-12175626 +Node: PEP 3119 Abstract Base Classes2175668 +Ref: whatsnew/2 6 pep-31192175854 +Ref: 12ad2175854 +Ref: whatsnew/2 6 pep-3119-abstract-base-classes2175854 +Ref: 13892175854 +Ref: PEP 3119 Abstract Base Classes-Footnote-12181212 +Node: PEP 3127 Integer Literal Support and Syntax2181254 +Ref: whatsnew/2 6 pep-31272181433 +Ref: 12ae2181433 +Ref: whatsnew/2 6 pep-3127-integer-literal-support-and-syntax2181433 +Ref: 138a2181433 +Ref: PEP 3127 Integer Literal Support and Syntax-Footnote-12182800 +Node: PEP 3129 Class Decorators2182842 +Ref: whatsnew/2 6 pep-31292183028 +Ref: 12af2183028 +Ref: whatsnew/2 6 pep-3129-class-decorators2183028 +Ref: 138b2183028 +Ref: PEP 3129 Class Decorators-Footnote-12183428 +Node: PEP 3141 A Type Hierarchy for Numbers2183470 +Ref: whatsnew/2 6 pep-31412183639 +Ref: 12b02183639 +Ref: whatsnew/2 6 pep-3141-a-type-hierarchy-for-numbers2183639 +Ref: 138c2183639 +Ref: PEP 3141 A Type Hierarchy for Numbers-Footnote-12185842 +Ref: PEP 3141 A Type Hierarchy for Numbers-Footnote-22185884 +Ref: PEP 3141 A Type Hierarchy for Numbers-Footnote-32185982 +Node: The fractions Module2186088 +Ref: whatsnew/2 6 the-fractions-module2186182 +Ref: 13902186182 +Node: Other Language Changes<15>2187789 +Ref: whatsnew/2 6 other-language-changes2187960 +Ref: 13912187960 +Ref: Other Language Changes<15>-Footnote-12196774 +Ref: Other Language Changes<15>-Footnote-22196841 +Ref: Other Language Changes<15>-Footnote-32196905 +Ref: Other Language Changes<15>-Footnote-42196972 +Ref: Other Language Changes<15>-Footnote-52197036 +Ref: Other Language Changes<15>-Footnote-62197100 +Ref: Other Language Changes<15>-Footnote-72197164 +Ref: Other Language Changes<15>-Footnote-82197228 +Ref: Other Language Changes<15>-Footnote-92197292 +Ref: Other Language Changes<15>-Footnote-102197356 +Ref: Other Language Changes<15>-Footnote-112197421 +Ref: Other Language Changes<15>-Footnote-122197486 +Ref: Other Language Changes<15>-Footnote-132197554 +Ref: Other Language Changes<15>-Footnote-142197622 +Ref: Other Language Changes<15>-Footnote-152197690 +Ref: Other Language Changes<15>-Footnote-162197758 +Node: Optimizations<14>2197826 +Ref: whatsnew/2 6 optimizations2197937 +Ref: 13952197937 +Ref: Optimizations<14>-Footnote-12200794 +Ref: Optimizations<14>-Footnote-22200861 +Ref: Optimizations<14>-Footnote-32200928 +Ref: Optimizations<14>-Footnote-42200992 +Node: Interpreter Changes<2>2201056 +Ref: whatsnew/2 6 interpreter-changes2201167 +Ref: 13962201167 +Ref: whatsnew/2 6 new-26-interpreter2201167 +Ref: 13972201167 +Node: New and Improved Modules<2>2202757 +Ref: whatsnew/2 6 new-and-improved-modules2202916 +Ref: 139b2202916 +Ref: New and Improved Modules<2>-Footnote-12245475 +Ref: New and Improved Modules<2>-Footnote-22245542 +Ref: New and Improved Modules<2>-Footnote-32245595 +Ref: New and Improved Modules<2>-Footnote-42245659 +Ref: New and Improved Modules<2>-Footnote-52245725 +Ref: New and Improved Modules<2>-Footnote-62245789 +Ref: New and Improved Modules<2>-Footnote-72245856 +Ref: New and Improved Modules<2>-Footnote-82245920 +Ref: New and Improved Modules<2>-Footnote-92245974 +Ref: New and Improved Modules<2>-Footnote-102246041 +Ref: New and Improved Modules<2>-Footnote-112246109 +Ref: New and Improved Modules<2>-Footnote-122246177 +Ref: New and Improved Modules<2>-Footnote-132246242 +Ref: New and Improved Modules<2>-Footnote-142246307 +Ref: New and Improved Modules<2>-Footnote-152246374 +Ref: New and Improved Modules<2>-Footnote-162246439 +Ref: New and Improved Modules<2>-Footnote-172246507 +Ref: New and Improved Modules<2>-Footnote-182246572 +Ref: New and Improved Modules<2>-Footnote-192246640 +Ref: New and Improved Modules<2>-Footnote-202246708 +Ref: New and Improved Modules<2>-Footnote-212246776 +Ref: New and Improved Modules<2>-Footnote-222246843 +Ref: New and Improved Modules<2>-Footnote-232246911 +Ref: New and Improved Modules<2>-Footnote-242246979 +Ref: New and Improved Modules<2>-Footnote-252247044 +Ref: New and Improved Modules<2>-Footnote-262247109 +Ref: New and Improved Modules<2>-Footnote-272247177 +Ref: New and Improved Modules<2>-Footnote-282247245 +Ref: New and Improved Modules<2>-Footnote-292247312 +Ref: New and Improved Modules<2>-Footnote-302247377 +Ref: New and Improved Modules<2>-Footnote-312247442 +Ref: New and Improved Modules<2>-Footnote-322247507 +Ref: New and Improved Modules<2>-Footnote-332247572 +Ref: New and Improved Modules<2>-Footnote-342247637 +Ref: New and Improved Modules<2>-Footnote-352247702 +Ref: New and Improved Modules<2>-Footnote-362247767 +Ref: New and Improved Modules<2>-Footnote-372247827 +Ref: New and Improved Modules<2>-Footnote-382247894 +Ref: New and Improved Modules<2>-Footnote-392247954 +Ref: New and Improved Modules<2>-Footnote-402248021 +Ref: New and Improved Modules<2>-Footnote-412248086 +Ref: New and Improved Modules<2>-Footnote-422248153 +Ref: New and Improved Modules<2>-Footnote-432248221 +Ref: New and Improved Modules<2>-Footnote-442248286 +Ref: New and Improved Modules<2>-Footnote-452248351 +Ref: New and Improved Modules<2>-Footnote-462248416 +Ref: New and Improved Modules<2>-Footnote-472248484 +Ref: New and Improved Modules<2>-Footnote-482248549 +Ref: New and Improved Modules<2>-Footnote-492248614 +Ref: New and Improved Modules<2>-Footnote-502248682 +Ref: New and Improved Modules<2>-Footnote-512248747 +Ref: New and Improved Modules<2>-Footnote-522248815 +Ref: New and Improved Modules<2>-Footnote-532248880 +Ref: New and Improved Modules<2>-Footnote-542248948 +Ref: New and Improved Modules<2>-Footnote-552249013 +Ref: New and Improved Modules<2>-Footnote-562249081 +Ref: New and Improved Modules<2>-Footnote-572249146 +Ref: New and Improved Modules<2>-Footnote-582249214 +Ref: New and Improved Modules<2>-Footnote-592249282 +Ref: New and Improved Modules<2>-Footnote-602249347 +Ref: New and Improved Modules<2>-Footnote-612249412 +Ref: New and Improved Modules<2>-Footnote-622249479 +Ref: New and Improved Modules<2>-Footnote-632249547 +Node: The ast module2249615 +Ref: whatsnew/2 6 the-ast-module2249728 +Ref: 13b02249728 +Node: The future_builtins module2252389 +Ref: whatsnew/2 6 the-future-builtins-module2252553 +Ref: 13b12252553 +Node: The json module JavaScript Object Notation2253659 +Ref: whatsnew/2 6 the-json-module-javascript-object-notation2253851 +Ref: 13b32253851 +Node: The plistlib module A Property-List Parser2254863 +Ref: whatsnew/2 6 the-plistlib-module-a-property-list-parser2255048 +Ref: 13b42255048 +Node: ctypes Enhancements2256419 +Ref: whatsnew/2 6 ctypes-enhancements2256582 +Ref: 13b52256582 +Ref: ctypes Enhancements-Footnote-12258349 +Ref: ctypes Enhancements-Footnote-22258416 +Node: Improved SSL Support2258480 +Ref: whatsnew/2 6 improved-ssl-support2258592 +Ref: 13b62258592 +Ref: Improved SSL Support-Footnote-12259539 +Node: Deprecations and Removals2259572 +Ref: whatsnew/2 6 deprecations-and-removals2259731 +Ref: 13b72259731 +Ref: Deprecations and Removals-Footnote-12261593 +Node: Build and C API Changes<9>2261635 +Ref: whatsnew/2 6 build-and-c-api-changes2261788 +Ref: 13b92261788 +Ref: Build and C API Changes<9>-Footnote-12269330 +Ref: Build and C API Changes<9>-Footnote-22269385 +Ref: Build and C API Changes<9>-Footnote-32269440 +Ref: Build and C API Changes<9>-Footnote-42269504 +Ref: Build and C API Changes<9>-Footnote-52269571 +Ref: Build and C API Changes<9>-Footnote-62269635 +Ref: Build and C API Changes<9>-Footnote-72269699 +Node: Port-Specific Changes Windows<2>2269766 +Ref: whatsnew/2 6 port-specific-changes-windows2269903 +Ref: 13c02269903 +Ref: Port-Specific Changes Windows<2>-Footnote-12272373 +Ref: Port-Specific Changes Windows<2>-Footnote-22272439 +Ref: Port-Specific Changes Windows<2>-Footnote-32272506 +Node: Port-Specific Changes Mac OS X<2>2272570 +Ref: whatsnew/2 6 port-specific-changes-mac-os-x2272742 +Ref: 13c52272742 +Ref: Port-Specific Changes Mac OS X<2>-Footnote-12274013 +Node: Port-Specific Changes IRIX2274080 +Ref: whatsnew/2 6 port-specific-changes-irix2274211 +Ref: 13c62274211 +Node: Porting to Python 2 62274730 +Ref: whatsnew/2 6 porting-to-python-2-62274877 +Ref: 13c72274877 +Ref: Porting to Python 2 6-Footnote-12278701 +Ref: Porting to Python 2 6-Footnote-22278768 +Ref: Porting to Python 2 6-Footnote-32278835 +Node: Acknowledgements<2>2278902 +Ref: whatsnew/2 6 acknowledgements2279014 +Ref: 13c92279014 +Ref: whatsnew/2 6 acks2279014 +Ref: 13ca2279014 +Node: What’s New in Python 2 52279356 +Ref: whatsnew/2 5 doc2279511 +Ref: 13cb2279511 +Ref: whatsnew/2 5 what-s-new-in-python-2-52279511 +Ref: 13cc2279511 +Ref: What’s New in Python 2 5-Footnote-12283167 +Node: PEP 308 Conditional Expressions2283209 +Ref: whatsnew/2 5 pep-3082283348 +Ref: 13cd2283348 +Ref: whatsnew/2 5 pep-308-conditional-expressions2283348 +Ref: 13d22283348 +Ref: PEP 308 Conditional Expressions-Footnote-12286832 +Ref: PEP 308 Conditional Expressions-Footnote-22286874 +Node: PEP 309 Partial Function Application2286916 +Ref: whatsnew/2 5 pep-3092287114 +Ref: 13d32287114 +Ref: whatsnew/2 5 pep-309-partial-function-application2287114 +Ref: 13d42287114 +Ref: PEP 309 Partial Function Application-Footnote-12289961 +Node: PEP 314 Metadata for Python Software Packages v1 12290003 +Ref: whatsnew/2 5 pep-3142290207 +Ref: 13d52290207 +Ref: whatsnew/2 5 pep-314-metadata-for-python-software-packages-v1-12290207 +Ref: 13d62290207 +Ref: PEP 314 Metadata for Python Software Packages v1 1-Footnote-12292041 +Node: PEP 328 Absolute and Relative Imports2292083 +Ref: whatsnew/2 5 pep-3282292287 +Ref: 13d02292287 +Ref: whatsnew/2 5 pep-328-absolute-and-relative-imports2292287 +Ref: 13d72292287 +Ref: PEP 328 Absolute and Relative Imports-Footnote-12296099 +Ref: PEP 328 Absolute and Relative Imports-Footnote-22296141 +Node: PEP 338 Executing Modules as Scripts2296183 +Ref: whatsnew/2 5 pep-3382296371 +Ref: 13d82296371 +Ref: whatsnew/2 5 pep-338-executing-modules-as-scripts2296371 +Ref: 13d92296371 +Ref: PEP 338 Executing Modules as Scripts-Footnote-12297266 +Node: PEP 341 Unified try/except/finally2297308 +Ref: whatsnew/2 5 pep-3412297489 +Ref: 13d12297489 +Ref: whatsnew/2 5 pep-341-unified-try-except-finally2297489 +Ref: 13da2297489 +Ref: PEP 341 Unified try/except/finally-Footnote-12299256 +Node: PEP 342 New Generator Features2299298 +Ref: whatsnew/2 5 pep-3422299478 +Ref: 13cf2299478 +Ref: whatsnew/2 5 pep-342-new-generator-features2299478 +Ref: 13db2299478 +Ref: PEP 342 New Generator Features-Footnote-12306143 +Ref: PEP 342 New Generator Features-Footnote-22306185 +Ref: PEP 342 New Generator Features-Footnote-32306227 +Ref: PEP 342 New Generator Features-Footnote-42306269 +Ref: PEP 342 New Generator Features-Footnote-52306311 +Node: PEP 343 The ‘with’ statement<2>2306353 +Ref: whatsnew/2 5 pep-3432306538 +Ref: 13ce2306538 +Ref: whatsnew/2 5 pep-343-the-with-statement2306538 +Ref: 13dc2306538 +Node: Writing Context Managers<2>2309560 +Ref: whatsnew/2 5 new-25-context-managers2309692 +Ref: 13dd2309692 +Ref: whatsnew/2 5 writing-context-managers2309692 +Ref: 13de2309692 +Node: The contextlib module<2>2314091 +Ref: whatsnew/2 5 contextlibmod2314223 +Ref: 13df2314223 +Ref: whatsnew/2 5 the-contextlib-module2314223 +Ref: 13e02314223 +Ref: The contextlib module<2>-Footnote-12316717 +Node: PEP 352 Exceptions as New-Style Classes2316759 +Ref: whatsnew/2 5 pep-3522316953 +Ref: 13e12316953 +Ref: whatsnew/2 5 pep-352-exceptions-as-new-style-classes2316953 +Ref: 13e22316953 +Ref: PEP 352 Exceptions as New-Style Classes-Footnote-12319442 +Node: PEP 353 Using ssize_t as the index type2319484 +Ref: whatsnew/2 5 pep-3532319677 +Ref: 13e32319677 +Ref: whatsnew/2 5 pep-353-using-ssize-t-as-the-index-type2319677 +Ref: 13e42319677 +Ref: PEP 353 Using ssize_t as the index type-Footnote-12322575 +Ref: PEP 353 Using ssize_t as the index type-Footnote-22322617 +Node: PEP 357 The ‘__index__’ method2322659 +Ref: whatsnew/2 5 pep-3572322839 +Ref: 13e62322839 +Ref: whatsnew/2 5 pep-357-the-index-method2322839 +Ref: 13e72322839 +Ref: PEP 357 The ‘__index__’ method-Footnote-12324548 +Node: Other Language Changes<16>2324590 +Ref: whatsnew/2 5 other-lang2324763 +Ref: 13ea2324763 +Ref: whatsnew/2 5 other-language-changes2324763 +Ref: 13eb2324763 +Ref: Other Language Changes<16>-Footnote-12331718 +Node: Interactive Interpreter Changes2331760 +Ref: whatsnew/2 5 interactive2331880 +Ref: 13f12331880 +Ref: whatsnew/2 5 interactive-interpreter-changes2331880 +Ref: 13f22331880 +Node: Optimizations<15>2332657 +Ref: whatsnew/2 5 optimizations2332777 +Ref: 13f42332777 +Ref: whatsnew/2 5 opts2332777 +Ref: 13f52332777 +Node: New Improved and Removed Modules2336595 +Ref: whatsnew/2 5 modules2336761 +Ref: 13f62336761 +Ref: whatsnew/2 5 new-improved-and-removed-modules2336761 +Ref: 13f72336761 +Ref: New Improved and Removed Modules-Footnote-12361268 +Ref: New Improved and Removed Modules-Footnote-22361310 +Ref: New Improved and Removed Modules-Footnote-32361369 +Node: The ctypes package2361428 +Ref: whatsnew/2 5 module-ctypes2361547 +Ref: 14012361547 +Ref: whatsnew/2 5 the-ctypes-package2361547 +Ref: 14022361547 +Node: The ElementTree package2364827 +Ref: whatsnew/2 5 module-etree2364974 +Ref: 14042364974 +Ref: whatsnew/2 5 the-elementtree-package2364974 +Ref: 14052364974 +Node: The hashlib package2370272 +Ref: whatsnew/2 5 module-hashlib2370420 +Ref: 14062370420 +Ref: whatsnew/2 5 the-hashlib-package2370420 +Ref: 14072370420 +Node: The sqlite3 package2372005 +Ref: whatsnew/2 5 module-sqlite2372149 +Ref: 14082372149 +Ref: whatsnew/2 5 the-sqlite3-package2372149 +Ref: 14092372149 +Ref: The sqlite3 package-Footnote-12376160 +Ref: The sqlite3 package-Footnote-22376202 +Node: The wsgiref package2376244 +Ref: whatsnew/2 5 module-wsgiref2376360 +Ref: 140a2376360 +Ref: whatsnew/2 5 the-wsgiref-package2376360 +Ref: 140b2376360 +Ref: The wsgiref package-Footnote-12377343 +Ref: The wsgiref package-Footnote-22377385 +Node: Build and C API Changes<10>2377427 +Ref: whatsnew/2 5 build-and-c-api-changes2377588 +Ref: 140c2377588 +Ref: whatsnew/2 5 build-api2377588 +Ref: 140d2377588 +Ref: Build and C API Changes<10>-Footnote-12384620 +Ref: Build and C API Changes<10>-Footnote-22384662 +Ref: Build and C API Changes<10>-Footnote-32384704 +Node: Port-Specific Changes2384746 +Ref: whatsnew/2 5 port-specific-changes2384831 +Ref: 14172384831 +Ref: whatsnew/2 5 ports2384831 +Ref: 14182384831 +Ref: Port-Specific Changes-Footnote-12385508 +Node: Porting to Python 2 52385572 +Ref: whatsnew/2 5 porting2385720 +Ref: 14192385720 +Ref: whatsnew/2 5 porting-to-python-2-52385720 +Ref: 141a2385720 +Ref: Porting to Python 2 5-Footnote-12388549 +Node: Acknowledgements<3>2388591 +Ref: whatsnew/2 5 acknowledgements2388703 +Ref: 141b2388703 +Node: What’s New in Python 2 42389197 +Ref: whatsnew/2 4 doc2389352 +Ref: 141c2389352 +Ref: whatsnew/2 4 what-s-new-in-python-2-42389352 +Ref: 141d2389352 +Node: PEP 218 Built-In Set Objects2391457 +Ref: whatsnew/2 4 pep-218-built-in-set-objects2391600 +Ref: 141e2391600 +Ref: PEP 218 Built-In Set Objects-Footnote-12393836 +Node: PEP 237 Unifying Long Integers and Integers2393878 +Ref: whatsnew/2 4 pep-237-unifying-long-integers-and-integers2394059 +Ref: 141f2394059 +Ref: PEP 237 Unifying Long Integers and Integers-Footnote-12395100 +Node: PEP 289 Generator Expressions2395142 +Ref: whatsnew/2 4 pep-289-generator-expressions2395331 +Ref: 14202395331 +Ref: PEP 289 Generator Expressions-Footnote-12397603 +Node: PEP 292 Simpler String Substitutions2397645 +Ref: whatsnew/2 4 pep-292-simpler-string-substitutions2397835 +Ref: 14212397835 +Ref: PEP 292 Simpler String Substitutions-Footnote-12399634 +Node: PEP 318 Decorators for Functions and Methods2399676 +Ref: whatsnew/2 4 pep-318-decorators-for-functions-and-methods2399862 +Ref: 14222399862 +Ref: PEP 318 Decorators for Functions and Methods-Footnote-12404391 +Ref: PEP 318 Decorators for Functions and Methods-Footnote-22404433 +Node: PEP 322 Reverse Iteration2404475 +Ref: whatsnew/2 4 pep-322-reverse-iteration2404654 +Ref: 14242404654 +Ref: PEP 322 Reverse Iteration-Footnote-12405616 +Node: PEP 324 New subprocess Module2405658 +Ref: whatsnew/2 4 pep-324-new-subprocess-module2405818 +Ref: 14252405818 +Ref: PEP 324 New subprocess Module-Footnote-12409601 +Node: PEP 327 Decimal Data Type2409643 +Ref: whatsnew/2 4 pep-327-decimal-data-type2409804 +Ref: 14272409804 +Node: Why is Decimal needed?2410376 +Ref: whatsnew/2 4 why-is-decimal-needed2410485 +Ref: 14282410485 +Node: The Decimal type2413069 +Ref: whatsnew/2 4 the-decimal-type2413203 +Ref: 14292413203 +Node: The Context type2416375 +Ref: whatsnew/2 4 the-context-type2416478 +Ref: 142a2416478 +Ref: The Context type-Footnote-12419085 +Ref: The Context type-Footnote-22419127 +Node: PEP 328 Multi-line Imports2419210 +Ref: whatsnew/2 4 pep-328-multi-line-imports2419393 +Ref: 142b2419393 +Ref: PEP 328 Multi-line Imports-Footnote-12420887 +Node: PEP 331 Locale-Independent Float/String Conversions2420929 +Ref: whatsnew/2 4 pep-331-locale-independent-float-string-conversions2421113 +Ref: 142c2421113 +Ref: PEP 331 Locale-Independent Float/String Conversions-Footnote-12422840 +Ref: PEP 331 Locale-Independent Float/String Conversions-Footnote-22422930 +Node: Other Language Changes<17>2422972 +Ref: whatsnew/2 4 other-language-changes2423168 +Ref: 142d2423168 +Ref: Other Language Changes<17>-Footnote-12430152 +Ref: Other Language Changes<17>-Footnote-22430194 +Ref: Other Language Changes<17>-Footnote-32430236 +Ref: Other Language Changes<17>-Footnote-42430278 +Ref: Other Language Changes<17>-Footnote-52430320 +Ref: Other Language Changes<17>-Footnote-62430362 +Node: Optimizations<16>2430404 +Ref: whatsnew/2 4 optimizations2430484 +Ref: 142f2430484 +Node: New Improved and Deprecated Modules<3>2433232 +Ref: whatsnew/2 4 new-improved-and-deprecated-modules2433404 +Ref: 14302433404 +Ref: New Improved and Deprecated Modules<3>-Footnote-12450715 +Node: cookielib2450774 +Ref: whatsnew/2 4 cookielib2450877 +Ref: 14342450877 +Node: doctest<5>2451817 +Ref: whatsnew/2 4 doctest2451920 +Ref: 14352451920 +Node: Build and C API Changes<11>2454660 +Ref: whatsnew/2 4 build-and-c-api-changes2454827 +Ref: 143b2454827 +Node: Port-Specific Changes<2>2457449 +Ref: whatsnew/2 4 port-specific-changes2457537 +Ref: 14412457537 +Node: Porting to Python 2 42457716 +Ref: whatsnew/2 4 porting-to-python-2-42457864 +Ref: 14422457864 +Node: Acknowledgements<4>2459832 +Ref: whatsnew/2 4 acknowledgements2459944 +Ref: 14442459944 +Ref: whatsnew/2 4 acks2459944 +Ref: 14452459944 +Node: What’s New in Python 2 32460277 +Ref: whatsnew/2 3 doc2460432 +Ref: 14462460432 +Ref: whatsnew/2 3 what-s-new-in-python-2-32460432 +Ref: 14472460432 +Node: PEP 218 A Standard Set Datatype2463451 +Ref: whatsnew/2 3 pep-218-a-standard-set-datatype2463579 +Ref: 14492463579 +Ref: PEP 218 A Standard Set Datatype-Footnote-12466096 +Node: PEP 255 Simple Generators2466138 +Ref: whatsnew/2 3 pep-255-simple-generators2466304 +Ref: 144e2466304 +Ref: whatsnew/2 3 section-generators2466304 +Ref: 144f2466304 +Ref: PEP 255 Simple Generators-Footnote-12472488 +Ref: PEP 255 Simple Generators-Footnote-22472530 +Node: PEP 263 Source Code Encodings2472572 +Ref: whatsnew/2 3 pep-263-source-code-encodings2472750 +Ref: 14502472750 +Ref: whatsnew/2 3 section-encodings2472750 +Ref: 14512472750 +Ref: PEP 263 Source Code Encodings-Footnote-12473962 +Node: PEP 273 Importing Modules from ZIP Archives2474004 +Ref: whatsnew/2 3 pep-273-importing-modules-from-zip-archives2474205 +Ref: 14522474205 +Ref: PEP 273 Importing Modules from ZIP Archives-Footnote-12476239 +Ref: PEP 273 Importing Modules from ZIP Archives-Footnote-22476281 +Ref: PEP 273 Importing Modules from ZIP Archives-Footnote-32476323 +Node: PEP 277 Unicode file name support for Windows NT2476365 +Ref: whatsnew/2 3 pep-277-unicode-file-name-support-for-windows-nt2476570 +Ref: 14542476570 +Ref: PEP 277 Unicode file name support for Windows NT-Footnote-12478052 +Node: PEP 278 Universal Newline Support2478094 +Ref: whatsnew/2 3 pep-278-universal-newline-support2478273 +Ref: 14562478273 +Ref: PEP 278 Universal Newline Support-Footnote-12479784 +Node: PEP 279 enumerate2479826 +Ref: whatsnew/2 3 pep-279-enumerate2479984 +Ref: 14572479984 +Ref: whatsnew/2 3 section-enumerate2479984 +Ref: 14582479984 +Ref: PEP 279 enumerate-Footnote-12480842 +Node: PEP 282 The logging Package2480884 +Ref: whatsnew/2 3 pep-282-the-logging-package2481031 +Ref: 14592481031 +Ref: PEP 282 The logging Package-Footnote-12485825 +Ref: PEP 282 The logging Package-Footnote-22485867 +Node: PEP 285 A Boolean Type2485909 +Ref: whatsnew/2 3 pep-285-a-boolean-type2486077 +Ref: 145f2486077 +Ref: whatsnew/2 3 section-bool2486077 +Ref: 14602486077 +Ref: PEP 285 A Boolean Type-Footnote-12488526 +Ref: PEP 285 A Boolean Type-Footnote-22488568 +Node: PEP 293 Codec Error Handling Callbacks2488610 +Ref: whatsnew/2 3 pep-293-codec-error-handling-callbacks2488799 +Ref: 14612488799 +Ref: PEP 293 Codec Error Handling Callbacks-Footnote-12490352 +Node: PEP 301 Package Index and Metadata for Distutils2490394 +Ref: whatsnew/2 3 pep-301-package-index-and-metadata-for-distutils2490585 +Ref: 14642490585 +Ref: whatsnew/2 3 section-pep3012490585 +Ref: 14652490585 +Ref: PEP 301 Package Index and Metadata for Distutils-Footnote-12492229 +Ref: PEP 301 Package Index and Metadata for Distutils-Footnote-22492265 +Node: PEP 302 New Import Hooks2492307 +Ref: whatsnew/2 3 pep-302-new-import-hooks2492489 +Ref: 14662492489 +Ref: whatsnew/2 3 section-pep3022492489 +Ref: 14532492489 +Ref: PEP 302 New Import Hooks-Footnote-12495096 +Ref: PEP 302 New Import Hooks-Footnote-22495138 +Ref: PEP 302 New Import Hooks-Footnote-32495180 +Node: PEP 305 Comma-separated Files2495222 +Ref: whatsnew/2 3 pep-305-comma-separated-files2495383 +Ref: 14672495383 +Ref: whatsnew/2 3 section-pep3052495383 +Ref: 14682495383 +Ref: PEP 305 Comma-separated Files-Footnote-12496864 +Node: PEP 307 Pickle Enhancements2496906 +Ref: whatsnew/2 3 pep-307-pickle-enhancements2497058 +Ref: 14692497058 +Ref: whatsnew/2 3 section-pep3072497058 +Ref: 146a2497058 +Ref: PEP 307 Pickle Enhancements-Footnote-12499033 +Ref: PEP 307 Pickle Enhancements-Footnote-22499075 +Ref: PEP 307 Pickle Enhancements-Footnote-32499117 +Node: Extended Slices2499159 +Ref: whatsnew/2 3 extended-slices2499308 +Ref: 146f2499308 +Ref: whatsnew/2 3 section-slices2499308 +Ref: 14702499308 +Node: Other Language Changes<18>2502700 +Ref: whatsnew/2 3 other-language-changes2502860 +Ref: 14712502860 +Ref: Other Language Changes<18>-Footnote-12510652 +Node: String Changes2510725 +Ref: whatsnew/2 3 string-changes2510828 +Ref: 14772510828 +Node: Optimizations<17>2513352 +Ref: whatsnew/2 3 optimizations2513455 +Ref: 147c2513455 +Node: New Improved and Deprecated Modules<4>2514918 +Ref: whatsnew/2 3 new-improved-and-deprecated-modules2515102 +Ref: 147e2515102 +Ref: New Improved and Deprecated Modules<4>-Footnote-12539895 +Node: Date/Time Type2539935 +Ref: whatsnew/2 3 date-time-type2540052 +Ref: 14942540052 +Node: The optparse Module2542384 +Ref: whatsnew/2 3 the-optparse-module2542501 +Ref: 14972542501 +Node: Pymalloc A Specialized Object Allocator2544575 +Ref: whatsnew/2 3 pymalloc-a-specialized-object-allocator2544760 +Ref: 149a2544760 +Ref: whatsnew/2 3 section-pymalloc2544760 +Ref: 149b2544760 +Node: Build and C API Changes<12>2548662 +Ref: whatsnew/2 3 build-and-c-api-changes2548835 +Ref: 149d2548835 +Node: Port-Specific Changes<3>2552261 +Ref: whatsnew/2 3 port-specific-changes2552349 +Ref: 14a32552349 +Node: Other Changes and Fixes<2>2553584 +Ref: whatsnew/2 3 other-changes-and-fixes2553739 +Ref: 14a42553739 +Ref: whatsnew/2 3 section-other2553739 +Ref: 147d2553739 +Node: Porting to Python 2 32556244 +Ref: whatsnew/2 3 porting-to-python-2-32556391 +Ref: 14a72556391 +Node: Acknowledgements<5>2559200 +Ref: whatsnew/2 3 acknowledgements2559312 +Ref: 14a82559312 +Ref: whatsnew/2 3 acks2559312 +Ref: 14a92559312 +Node: What’s New in Python 2 22559933 +Ref: whatsnew/2 2 doc2560088 +Ref: 14aa2560088 +Ref: whatsnew/2 2 what-s-new-in-python-2-22560088 +Ref: 14ab2560088 +Node: Introduction2560823 +Ref: whatsnew/2 2 introduction2560946 +Ref: 14ac2560946 +Ref: Introduction-Footnote-12561918 +Ref: Introduction-Footnote-22561967 +Node: PEPs 252 and 253 Type and Class Changes2562016 +Ref: whatsnew/2 2 peps-252-and-253-type-and-class-changes2562165 +Ref: 14ad2562165 +Node: Old and New Classes2565605 +Ref: whatsnew/2 2 old-and-new-classes2565720 +Ref: 14b02565720 +Ref: Old and New Classes-Footnote-12568126 +Node: Descriptors2568168 +Ref: whatsnew/2 2 descriptors2568329 +Ref: 14b12568329 +Node: Multiple Inheritance The Diamond Rule2572196 +Ref: whatsnew/2 2 multiple-inheritance-the-diamond-rule2572354 +Ref: 14b32572354 +Ref: Multiple Inheritance The Diamond Rule-Footnote-12575239 +Node: Attribute Access2575281 +Ref: whatsnew/2 2 attribute-access2575441 +Ref: 14b42575441 +Node: Related Links2579243 +Ref: whatsnew/2 2 related-links2579357 +Ref: 14b62579357 +Ref: whatsnew/2 2 sect-rellinks2579357 +Ref: 14af2579357 +Ref: Related Links-Footnote-12580836 +Ref: Related Links-Footnote-22580878 +Ref: Related Links-Footnote-32580920 +Ref: Related Links-Footnote-42580962 +Ref: Related Links-Footnote-52581004 +Node: PEP 234 Iterators2581046 +Ref: whatsnew/2 2 pep-234-iterators2581211 +Ref: 14b82581211 +Ref: PEP 234 Iterators-Footnote-12586090 +Node: PEP 255 Simple Generators<2>2586132 +Ref: whatsnew/2 2 pep-255-simple-generators2586304 +Ref: 14bb2586304 +Ref: PEP 255 Simple Generators<2>-Footnote-12592363 +Ref: PEP 255 Simple Generators<2>-Footnote-22592405 +Node: PEP 237 Unifying Long Integers and Integers<2>2592447 +Ref: whatsnew/2 2 pep-237-unifying-long-integers-and-integers2592640 +Ref: 14bc2592640 +Ref: PEP 237 Unifying Long Integers and Integers<2>-Footnote-12594365 +Node: PEP 238 Changing the Division Operator2594407 +Ref: whatsnew/2 2 pep-238-changing-the-division-operator2594587 +Ref: 14bd2594587 +Ref: PEP 238 Changing the Division Operator-Footnote-12598242 +Ref: PEP 238 Changing the Division Operator-Footnote-22598284 +Ref: PEP 238 Changing the Division Operator-Footnote-32598326 +Node: Unicode Changes2598368 +Ref: whatsnew/2 2 unicode-changes2598523 +Ref: 14c02598523 +Ref: Unicode Changes-Footnote-12601155 +Ref: Unicode Changes-Footnote-22601197 +Node: PEP 227 Nested Scopes2601239 +Ref: whatsnew/2 2 pep-227-nested-scopes2601383 +Ref: 14c12601383 +Ref: PEP 227 Nested Scopes-Footnote-12605729 +Node: New and Improved Modules<3>2605771 +Ref: whatsnew/2 2 new-and-improved-modules2605929 +Ref: 14c22605929 +Ref: New and Improved Modules<3>-Footnote-12612639 +Ref: New and Improved Modules<3>-Footnote-22612698 +Ref: New and Improved Modules<3>-Footnote-32612757 +Ref: New and Improved Modules<3>-Footnote-42612816 +Ref: New and Improved Modules<3>-Footnote-52612875 +Node: Interpreter Changes and Fixes2612933 +Ref: whatsnew/2 2 interpreter-changes-and-fixes2613096 +Ref: 14c72613096 +Node: Other Changes and Fixes<3>2617868 +Ref: whatsnew/2 2 other-changes-and-fixes2618023 +Ref: 14d82618023 +Ref: Other Changes and Fixes<3>-Footnote-12624697 +Node: Acknowledgements<6>2624739 +Ref: whatsnew/2 2 acknowledgements2624856 +Ref: 14db2624856 +Node: What’s New in Python 2 12625457 +Ref: whatsnew/2 1 doc2625612 +Ref: 14dc2625612 +Ref: whatsnew/2 1 what-s-new-in-python-2-12625612 +Ref: 14dd2625612 +Node: Introduction<2>2626617 +Ref: whatsnew/2 1 introduction2626728 +Ref: 14de2626728 +Node: PEP 227 Nested Scopes<2>2627824 +Ref: whatsnew/2 1 pep-227-nested-scopes2627973 +Ref: 14df2627973 +Ref: PEP 227 Nested Scopes<2>-Footnote-12632339 +Ref: PEP 227 Nested Scopes<2>-Footnote-22632381 +Ref: PEP 227 Nested Scopes<2>-Footnote-32632423 +Node: PEP 236 __future__ Directives2632465 +Ref: whatsnew/2 1 pep-236-future-directives2632623 +Ref: 14e02632623 +Ref: PEP 236 __future__ Directives-Footnote-12633860 +Node: PEP 207 Rich Comparisons2633902 +Ref: whatsnew/2 1 pep-207-rich-comparisons2634061 +Ref: 14e12634061 +Ref: PEP 207 Rich Comparisons-Footnote-12637469 +Ref: PEP 207 Rich Comparisons-Footnote-22637511 +Node: PEP 230 Warning Framework2637553 +Ref: whatsnew/2 1 pep-230-warning-framework2637707 +Ref: 14e32637707 +Ref: PEP 230 Warning Framework-Footnote-12640988 +Ref: PEP 230 Warning Framework-Footnote-22641030 +Node: PEP 229 New Build System2641072 +Ref: whatsnew/2 1 pep-229-new-build-system2641225 +Ref: 14e52641225 +Ref: PEP 229 New Build System-Footnote-12643145 +Node: PEP 205 Weak References2643187 +Ref: whatsnew/2 1 pep-205-weak-references2643342 +Ref: 14e62643342 +Ref: PEP 205 Weak References-Footnote-12646455 +Node: PEP 232 Function Attributes2646497 +Ref: whatsnew/2 1 pep-232-function-attributes2646683 +Ref: 14e72646683 +Ref: PEP 232 Function Attributes-Footnote-12648203 +Node: PEP 235 Importing Modules on Case-Insensitive Platforms2648245 +Ref: whatsnew/2 1 pep-235-importing-modules-on-case-insensitive-platforms2648440 +Ref: 14e82648440 +Node: PEP 217 Interactive Display Hook2649343 +Ref: whatsnew/2 1 pep-217-interactive-display-hook2649537 +Ref: 14e92649537 +Ref: PEP 217 Interactive Display Hook-Footnote-12650466 +Node: PEP 208 New Coercion Model2650508 +Ref: whatsnew/2 1 pep-208-new-coercion-model2650682 +Ref: 14eb2650682 +Ref: PEP 208 New Coercion Model-Footnote-12652304 +Node: PEP 241 Metadata in Python Packages2652346 +Ref: whatsnew/2 1 pep-241-metadata-in-python-packages2652515 +Ref: 14ec2652515 +Ref: PEP 241 Metadata in Python Packages-Footnote-12654632 +Ref: PEP 241 Metadata in Python Packages-Footnote-22654714 +Ref: PEP 241 Metadata in Python Packages-Footnote-32654756 +Ref: PEP 241 Metadata in Python Packages-Footnote-42654798 +Ref: PEP 241 Metadata in Python Packages-Footnote-52654840 +Node: New and Improved Modules<4>2654882 +Ref: whatsnew/2 1 new-and-improved-modules2655051 +Ref: 14ed2655051 +Node: Other Changes and Fixes<4>2660908 +Ref: whatsnew/2 1 other-changes-and-fixes2661061 +Ref: 14ee2661061 +Node: Acknowledgements<7>2667016 +Ref: whatsnew/2 1 acknowledgements2667133 +Ref: 14f22667133 +Node: What’s New in Python 2 02667424 +Ref: whatsnew/2 0 doc2667562 +Ref: 14f32667562 +Ref: whatsnew/2 0 what-s-new-in-python-2-02667562 +Ref: 14f42667562 +Node: Introduction<3>2668235 +Ref: whatsnew/2 0 introduction2668344 +Ref: 14f52668344 +Node: What About Python 1 6?2669228 +Ref: whatsnew/2 0 what-about-python-1-62669369 +Ref: 14f62669369 +Node: New Development Process2670610 +Ref: whatsnew/2 0 new-development-process2670746 +Ref: 14f72670746 +Ref: New Development Process-Footnote-12675886 +Ref: New Development Process-Footnote-22675928 +Ref: New Development Process-Footnote-32675970 +Node: Unicode<2>2676012 +Ref: whatsnew/2 0 unicode2676145 +Ref: 14f82676145 +Ref: Unicode<2>-Footnote-12682315 +Node: List Comprehensions2682357 +Ref: whatsnew/2 0 list-comprehensions2682487 +Ref: 14f92682487 +Node: Augmented Assignment2686219 +Ref: whatsnew/2 0 augmented-assignment2686353 +Ref: 14fa2686353 +Node: String Methods2687883 +Ref: whatsnew/2 0 string-methods2688026 +Ref: 14fb2688026 +Node: Garbage Collection of Cycles2689879 +Ref: whatsnew/2 0 garbage-collection-of-cycles2690020 +Ref: 14fc2690020 +Node: Other Core Changes2693367 +Ref: whatsnew/2 0 other-core-changes2693508 +Ref: 14fd2693508 +Node: Minor Language Changes2693793 +Ref: whatsnew/2 0 minor-language-changes2693908 +Ref: 14fe2693908 +Node: Changes to Built-in Functions2698993 +Ref: whatsnew/2 0 changes-to-built-in-functions2699108 +Ref: 15012699108 +Node: Porting to 2 02701398 +Ref: whatsnew/2 0 porting-to-2-02701538 +Ref: 15022701538 +Node: Extending/Embedding Changes2706868 +Ref: whatsnew/2 0 extending-embedding-changes2707030 +Ref: 15052707030 +Node: Distutils Making Modules Easy to Install2710882 +Ref: whatsnew/2 0 distutils-making-modules-easy-to-install2711041 +Ref: 150a2711041 +Node: XML Modules2714401 +Ref: whatsnew/2 0 xml-modules2714547 +Ref: 150b2714547 +Node: SAX2 Support2715446 +Ref: whatsnew/2 0 sax2-support2715526 +Ref: 150c2715526 +Node: DOM Support2717186 +Ref: whatsnew/2 0 dom-support2717296 +Ref: 15102717296 +Node: Relationship to PyXML2720124 +Ref: whatsnew/2 0 relationship-to-pyxml2720213 +Ref: 15112720213 +Node: Module changes2721503 +Ref: whatsnew/2 0 module-changes2721620 +Ref: 15122721620 +Node: New modules2724106 +Ref: whatsnew/2 0 new-modules2724229 +Ref: 15132724229 +Node: IDLE Improvements2728231 +Ref: whatsnew/2 0 idle-improvements2728370 +Ref: 15142728370 +Node: Deleted and Deprecated Modules2729505 +Ref: whatsnew/2 0 deleted-and-deprecated-modules2729652 +Ref: 15152729652 +Node: Acknowledgements<8>2730404 +Ref: whatsnew/2 0 acknowledgements2730525 +Ref: 15162730525 +Ref: Acknowledgements<8>-Footnote-12731124 +Ref: Acknowledgements<8>-Footnote-22731164 +Node: Changelog2731228 +Ref: whatsnew/changelog doc2731331 +Ref: 15172731331 +Ref: whatsnew/changelog changelog2731331 +Ref: 13c2731331 +Ref: whatsnew/changelog id12731331 +Ref: 15182731331 +Node: Python 3 13 7 final2737148 +Ref: whatsnew/changelog python-3-13-7-final2737241 +Ref: 15192737241 +Node: Library2737403 +Ref: whatsnew/changelog library2737491 +Ref: 151a2737491 +Ref: Library-Footnote-12738399 +Ref: Library-Footnote-22738455 +Ref: Library-Footnote-32738511 +Ref: Library-Footnote-42738567 +Node: Documentation<2>2738623 +Ref: whatsnew/changelog documentation2738737 +Ref: 15202738737 +Ref: Documentation<2>-Footnote-12738904 +Node: Core and Builtins2738960 +Ref: whatsnew/changelog core-and-builtins2739058 +Ref: 15212739058 +Ref: Core and Builtins-Footnote-12739516 +Node: Python 3 13 6 final2739572 +Ref: whatsnew/changelog python-3-13-6-final2739693 +Ref: 15232739693 +Node: macOS2739958 +Ref: whatsnew/changelog macos2740035 +Ref: 15242740035 +Ref: macOS-Footnote-12740425 +Ref: macOS-Footnote-22740481 +Node: Windows2740537 +Ref: whatsnew/changelog windows2740634 +Ref: 15252740634 +Ref: Windows-Footnote-12740778 +Node: Tools/Demos2740834 +Ref: whatsnew/changelog tools-demos2740931 +Ref: 15262740931 +Ref: Tools/Demos-Footnote-12741101 +Node: Tests2741157 +Ref: whatsnew/changelog tests2741255 +Ref: 15272741255 +Ref: Tests-Footnote-12741660 +Ref: Tests-Footnote-22741716 +Ref: Tests-Footnote-32741772 +Node: Security2741828 +Ref: whatsnew/changelog security2741925 +Ref: 15282741925 +Ref: Security-Footnote-12743773 +Ref: Security-Footnote-22743829 +Ref: Security-Footnote-32743885 +Ref: Security-Footnote-42743941 +Node: Library<2>2743997 +Ref: whatsnew/changelog id22744105 +Ref: 15292744105 +Ref: Library<2>-Footnote-12750815 +Ref: Library<2>-Footnote-22750871 +Ref: Library<2>-Footnote-32750927 +Ref: Library<2>-Footnote-42750983 +Ref: Library<2>-Footnote-52751038 +Ref: Library<2>-Footnote-62751093 +Ref: Library<2>-Footnote-72751149 +Ref: Library<2>-Footnote-82751205 +Ref: Library<2>-Footnote-92751261 +Ref: Library<2>-Footnote-102751317 +Ref: Library<2>-Footnote-112751374 +Ref: Library<2>-Footnote-122751430 +Ref: Library<2>-Footnote-132751486 +Ref: Library<2>-Footnote-142751543 +Ref: Library<2>-Footnote-152751600 +Ref: Library<2>-Footnote-162751657 +Ref: Library<2>-Footnote-172751713 +Ref: Library<2>-Footnote-182751769 +Ref: Library<2>-Footnote-192751826 +Ref: Library<2>-Footnote-202751883 +Ref: Library<2>-Footnote-212751940 +Ref: Library<2>-Footnote-222751997 +Ref: Library<2>-Footnote-232752054 +Ref: Library<2>-Footnote-242752111 +Ref: Library<2>-Footnote-252752168 +Ref: Library<2>-Footnote-262752225 +Ref: Library<2>-Footnote-272752282 +Ref: Library<2>-Footnote-282752339 +Ref: Library<2>-Footnote-292752396 +Ref: Library<2>-Footnote-302752472 +Ref: Library<2>-Footnote-312752529 +Ref: Library<2>-Footnote-322752586 +Ref: Library<2>-Footnote-332752643 +Ref: Library<2>-Footnote-342752700 +Ref: Library<2>-Footnote-352752757 +Ref: Library<2>-Footnote-362752814 +Ref: Library<2>-Footnote-372752870 +Node: Documentation<3>2752927 +Ref: whatsnew/changelog id32753047 +Ref: 152e2753047 +Ref: Documentation<3>-Footnote-12753285 +Node: Core and Builtins<2>2753341 +Ref: whatsnew/changelog id42753456 +Ref: 152f2753456 +Ref: Core and Builtins<2>-Footnote-12756284 +Ref: Core and Builtins<2>-Footnote-22756339 +Ref: Core and Builtins<2>-Footnote-32756395 +Ref: Core and Builtins<2>-Footnote-42756451 +Ref: Core and Builtins<2>-Footnote-52756507 +Ref: Core and Builtins<2>-Footnote-62756562 +Ref: Core and Builtins<2>-Footnote-72756618 +Ref: Core and Builtins<2>-Footnote-82756674 +Ref: Core and Builtins<2>-Footnote-92756730 +Ref: Core and Builtins<2>-Footnote-102756786 +Ref: Core and Builtins<2>-Footnote-112756843 +Ref: Core and Builtins<2>-Footnote-122756900 +Ref: Core and Builtins<2>-Footnote-132756957 +Ref: Core and Builtins<2>-Footnote-142757013 +Ref: Core and Builtins<2>-Footnote-152757070 +Node: Build2757127 +Ref: whatsnew/changelog build2757217 +Ref: 15302757217 +Ref: Build-Footnote-12757381 +Node: Python 3 13 5 final2757437 +Ref: whatsnew/changelog python-3-13-5-final2757558 +Ref: 15312757558 +Node: Windows<2>2757769 +Ref: whatsnew/changelog id52757852 +Ref: 15322757852 +Ref: Windows<2>-Footnote-12758137 +Node: Tests<2>2758193 +Ref: whatsnew/changelog id62758295 +Ref: 15332758295 +Ref: Tests<2>-Footnote-12758417 +Node: Library<3>2758473 +Ref: whatsnew/changelog id72758585 +Ref: 15342758585 +Ref: Library<3>-Footnote-12759797 +Ref: Library<3>-Footnote-22759853 +Ref: Library<3>-Footnote-32759909 +Ref: Library<3>-Footnote-42759965 +Ref: Library<3>-Footnote-52760021 +Ref: Library<3>-Footnote-62760077 +Ref: Library<3>-Footnote-72760136 +Ref: Library<3>-Footnote-82760192 +Ref: Library<3>-Footnote-92760248 +Node: Core and Builtins<3>2760304 +Ref: whatsnew/changelog id82760413 +Ref: 15362760413 +Ref: Core and Builtins<3>-Footnote-12760724 +Ref: Core and Builtins<3>-Footnote-22760780 +Node: C API2760836 +Ref: whatsnew/changelog c-api2760926 +Ref: 15372760926 +Ref: C API-Footnote-12761433 +Ref: C API-Footnote-22761489 +Node: Python 3 13 4 final2761545 +Ref: whatsnew/changelog python-3-13-4-final2761666 +Ref: 153a2761666 +Node: Windows<3>2761982 +Ref: whatsnew/changelog id92762065 +Ref: 153b2762065 +Ref: Windows<3>-Footnote-12762662 +Ref: Windows<3>-Footnote-22762718 +Ref: Windows<3>-Footnote-32762773 +Ref: Windows<3>-Footnote-42762829 +Node: Tests<3>2762885 +Ref: whatsnew/changelog id102762988 +Ref: 153c2762988 +Ref: Tests<3>-Footnote-12763784 +Ref: Tests<3>-Footnote-22763840 +Ref: Tests<3>-Footnote-32763896 +Ref: Tests<3>-Footnote-42763952 +Node: Security<2>2764008 +Ref: whatsnew/changelog id112764111 +Ref: 153d2764111 +Ref: Security<2>-Footnote-12764781 +Ref: Security<2>-Footnote-22764837 +Ref: Security<2>-Footnote-32764893 +Ref: Security<2>-Footnote-42764948 +Ref: Security<2>-Footnote-52765003 +Ref: Security<2>-Footnote-62765058 +Ref: Security<2>-Footnote-72765114 +Node: Library<4>2765170 +Ref: whatsnew/changelog id122765272 +Ref: 153e2765272 +Ref: Library<4>-Footnote-12774675 +Ref: Library<4>-Footnote-22774731 +Ref: Library<4>-Footnote-32774787 +Ref: Library<4>-Footnote-42774843 +Ref: Library<4>-Footnote-52774899 +Ref: Library<4>-Footnote-62774954 +Ref: Library<4>-Footnote-72775010 +Ref: Library<4>-Footnote-82775066 +Ref: Library<4>-Footnote-92775121 +Ref: Library<4>-Footnote-102775177 +Ref: Library<4>-Footnote-112775234 +Ref: Library<4>-Footnote-122775291 +Ref: Library<4>-Footnote-132775348 +Ref: Library<4>-Footnote-142775405 +Ref: Library<4>-Footnote-152775462 +Ref: Library<4>-Footnote-162775519 +Ref: Library<4>-Footnote-172775575 +Ref: Library<4>-Footnote-182775631 +Ref: Library<4>-Footnote-192775688 +Ref: Library<4>-Footnote-202775745 +Ref: Library<4>-Footnote-212775802 +Ref: Library<4>-Footnote-222775859 +Ref: Library<4>-Footnote-232775916 +Ref: Library<4>-Footnote-242775973 +Ref: Library<4>-Footnote-252776030 +Ref: Library<4>-Footnote-262776087 +Ref: Library<4>-Footnote-272776144 +Ref: Library<4>-Footnote-282776201 +Ref: Library<4>-Footnote-292776258 +Ref: Library<4>-Footnote-302776315 +Ref: Library<4>-Footnote-312776372 +Ref: Library<4>-Footnote-322776429 +Ref: Library<4>-Footnote-332776486 +Ref: Library<4>-Footnote-342776543 +Ref: Library<4>-Footnote-352776600 +Ref: Library<4>-Footnote-362776657 +Ref: Library<4>-Footnote-372776713 +Ref: Library<4>-Footnote-382776770 +Ref: Library<4>-Footnote-392776827 +Ref: Library<4>-Footnote-402776884 +Ref: Library<4>-Footnote-412776941 +Ref: Library<4>-Footnote-422776998 +Ref: Library<4>-Footnote-432777055 +Ref: Library<4>-Footnote-442777112 +Ref: Library<4>-Footnote-452777169 +Ref: Library<4>-Footnote-462777226 +Ref: Library<4>-Footnote-472777283 +Ref: Library<4>-Footnote-482777339 +Ref: Library<4>-Footnote-492777395 +Node: IDLE<3>2777461 +Ref: whatsnew/changelog idle2777568 +Ref: 154c2777568 +Ref: IDLE<3>-Footnote-12777706 +Node: Documentation<4>2777762 +Ref: whatsnew/changelog id132777879 +Ref: 154d2777879 +Ref: Documentation<4>-Footnote-12778097 +Node: Core and Builtins<4>2778153 +Ref: whatsnew/changelog id142778271 +Ref: 154f2778271 +Ref: Core and Builtins<4>-Footnote-12781934 +Ref: Core and Builtins<4>-Footnote-22781990 +Ref: Core and Builtins<4>-Footnote-32782046 +Ref: Core and Builtins<4>-Footnote-42782102 +Ref: Core and Builtins<4>-Footnote-52782158 +Ref: Core and Builtins<4>-Footnote-62782214 +Ref: Core and Builtins<4>-Footnote-72782270 +Ref: Core and Builtins<4>-Footnote-82782326 +Ref: Core and Builtins<4>-Footnote-92782382 +Ref: Core and Builtins<4>-Footnote-102782438 +Ref: Core and Builtins<4>-Footnote-112782495 +Ref: Core and Builtins<4>-Footnote-122782552 +Ref: Core and Builtins<4>-Footnote-132782609 +Ref: Core and Builtins<4>-Footnote-142782666 +Ref: Core and Builtins<4>-Footnote-152782723 +Ref: Core and Builtins<4>-Footnote-162782780 +Ref: Core and Builtins<4>-Footnote-172782825 +Ref: Core and Builtins<4>-Footnote-182782882 +Ref: Core and Builtins<4>-Footnote-192782939 +Ref: Core and Builtins<4>-Footnote-202782996 +Ref: Core and Builtins<4>-Footnote-212783053 +Ref: Core and Builtins<4>-Footnote-222783110 +Ref: Core and Builtins<4>-Footnote-232783167 +Ref: Core and Builtins<4>-Footnote-242783224 +Node: C API<2>2783281 +Ref: whatsnew/changelog id152783391 +Ref: 15532783391 +Ref: C API<2>-Footnote-12783597 +Node: Build<2>2783653 +Ref: whatsnew/changelog id162783734 +Ref: 15552783734 +Ref: Build<2>-Footnote-12784576 +Ref: Build<2>-Footnote-22784632 +Ref: Build<2>-Footnote-32784688 +Ref: Build<2>-Footnote-42784744 +Ref: Build<2>-Footnote-52784800 +Ref: Build<2>-Footnote-62784856 +Node: Python 3 13 3 final2784912 +Ref: whatsnew/changelog python-3-13-3-final2785033 +Ref: 15562785033 +Node: macOS<2>2785399 +Ref: whatsnew/changelog id172785482 +Ref: 15572785482 +Ref: macOS<2>-Footnote-12785845 +Ref: macOS<2>-Footnote-22785901 +Ref: macOS<2>-Footnote-32785957 +Ref: macOS<2>-Footnote-42786013 +Node: Windows<4>2786068 +Ref: whatsnew/changelog id182786174 +Ref: 15582786174 +Ref: Windows<4>-Footnote-12786621 +Ref: Windows<4>-Footnote-22786677 +Ref: Windows<4>-Footnote-32786733 +Ref: Windows<4>-Footnote-42786789 +Node: Tools/Demos<2>2786856 +Ref: whatsnew/changelog id192786962 +Ref: 15592786962 +Ref: Tools/Demos<2>-Footnote-12787394 +Ref: Tools/Demos<2>-Footnote-22787450 +Ref: Tools/Demos<2>-Footnote-32787505 +Node: Tests<4>2787561 +Ref: whatsnew/changelog id202787668 +Ref: 155a2787668 +Ref: Tests<4>-Footnote-12788404 +Ref: Tests<4>-Footnote-22788460 +Ref: Tests<4>-Footnote-32788516 +Ref: Tests<4>-Footnote-42788572 +Ref: Tests<4>-Footnote-52788628 +Node: Security<3>2788684 +Ref: whatsnew/changelog id212788787 +Ref: 155b2788787 +Ref: Security<3>-Footnote-12789750 +Ref: Security<3>-Footnote-22789806 +Ref: Security<3>-Footnote-32789862 +Ref: Security<3>-Footnote-42789918 +Node: Library<5>2789974 +Ref: whatsnew/changelog id222790076 +Ref: 155c2790076 +Ref: Library<5>-Footnote-12797488 +Ref: Library<5>-Footnote-22797544 +Ref: Library<5>-Footnote-32797600 +Ref: Library<5>-Footnote-42797656 +Ref: Library<5>-Footnote-52797712 +Ref: Library<5>-Footnote-62797768 +Ref: Library<5>-Footnote-72797824 +Ref: Library<5>-Footnote-82797880 +Ref: Library<5>-Footnote-92797936 +Ref: Library<5>-Footnote-102797992 +Ref: Library<5>-Footnote-112798049 +Ref: Library<5>-Footnote-122798106 +Ref: Library<5>-Footnote-132798163 +Ref: Library<5>-Footnote-142798220 +Ref: Library<5>-Footnote-152798277 +Ref: Library<5>-Footnote-162798334 +Ref: Library<5>-Footnote-172798391 +Ref: Library<5>-Footnote-182798448 +Ref: Library<5>-Footnote-192798505 +Ref: Library<5>-Footnote-202798562 +Ref: Library<5>-Footnote-212798619 +Ref: Library<5>-Footnote-222798676 +Ref: Library<5>-Footnote-232798733 +Ref: Library<5>-Footnote-242798790 +Ref: Library<5>-Footnote-252798847 +Ref: Library<5>-Footnote-262798904 +Ref: Library<5>-Footnote-272798961 +Ref: Library<5>-Footnote-282799017 +Ref: Library<5>-Footnote-292799074 +Ref: Library<5>-Footnote-302799130 +Ref: Library<5>-Footnote-312799187 +Ref: Library<5>-Footnote-322799244 +Ref: Library<5>-Footnote-332799301 +Ref: Library<5>-Footnote-342799358 +Ref: Library<5>-Footnote-352799415 +Ref: Library<5>-Footnote-362799471 +Ref: Library<5>-Footnote-372799528 +Ref: Library<5>-Footnote-382799585 +Ref: Library<5>-Footnote-392799642 +Ref: Library<5>-Footnote-402799699 +Ref: Library<5>-Footnote-412799756 +Ref: Library<5>-Footnote-422799813 +Ref: Library<5>-Footnote-432799870 +Ref: Library<5>-Footnote-442799927 +Node: IDLE<4>2799984 +Ref: whatsnew/changelog id232800091 +Ref: 156c2800091 +Ref: IDLE<4>-Footnote-12800311 +Node: Documentation<5>2800367 +Ref: whatsnew/changelog id242800484 +Ref: 156d2800484 +Ref: Documentation<5>-Footnote-12801051 +Ref: Documentation<5>-Footnote-22801107 +Ref: Documentation<5>-Footnote-32801163 +Ref: Documentation<5>-Footnote-42801219 +Node: Core and Builtins<5>2801274 +Ref: whatsnew/changelog id252801392 +Ref: 15712801392 +Ref: Core and Builtins<5>-Footnote-12805577 +Ref: Core and Builtins<5>-Footnote-22805633 +Ref: Core and Builtins<5>-Footnote-32805689 +Ref: Core and Builtins<5>-Footnote-42805745 +Ref: Core and Builtins<5>-Footnote-52805801 +Ref: Core and Builtins<5>-Footnote-62805857 +Ref: Core and Builtins<5>-Footnote-72805913 +Ref: Core and Builtins<5>-Footnote-82805969 +Ref: Core and Builtins<5>-Footnote-92806025 +Ref: Core and Builtins<5>-Footnote-102806081 +Ref: Core and Builtins<5>-Footnote-112806138 +Ref: Core and Builtins<5>-Footnote-122806195 +Ref: Core and Builtins<5>-Footnote-132806252 +Ref: Core and Builtins<5>-Footnote-142806309 +Ref: Core and Builtins<5>-Footnote-152806365 +Ref: Core and Builtins<5>-Footnote-162806422 +Ref: Core and Builtins<5>-Footnote-172806479 +Ref: Core and Builtins<5>-Footnote-182806536 +Ref: Core and Builtins<5>-Footnote-192806593 +Ref: Core and Builtins<5>-Footnote-202806650 +Ref: Core and Builtins<5>-Footnote-212806707 +Ref: Core and Builtins<5>-Footnote-222806764 +Ref: Core and Builtins<5>-Footnote-232806821 +Ref: Core and Builtins<5>-Footnote-242806878 +Ref: Core and Builtins<5>-Footnote-252806935 +Ref: Core and Builtins<5>-Footnote-262806992 +Ref: Core and Builtins<5>-Footnote-272807049 +Ref: Core and Builtins<5>-Footnote-282807106 +Node: C API<3>2807163 +Ref: whatsnew/changelog id262807273 +Ref: 15782807273 +Ref: C API<3>-Footnote-12807636 +Ref: C API<3>-Footnote-22807692 +Node: Build<3>2807748 +Ref: whatsnew/changelog id272807829 +Ref: 15792807829 +Ref: Build<3>-Footnote-12808715 +Ref: Build<3>-Footnote-22808771 +Ref: Build<3>-Footnote-32808827 +Ref: Build<3>-Footnote-42808883 +Ref: Build<3>-Footnote-52808939 +Ref: Build<3>-Footnote-62808995 +Node: Python 3 13 2 final2809051 +Ref: whatsnew/changelog python-3-13-2-final2809172 +Ref: 157a2809172 +Node: macOS<3>2809521 +Ref: whatsnew/changelog id282809604 +Ref: 157b2809604 +Ref: macOS<3>-Footnote-12809806 +Node: Windows<5>2809862 +Ref: whatsnew/changelog id292809968 +Ref: 157c2809968 +Ref: Windows<5>-Footnote-12810158 +Node: Tools/Demos<3>2810214 +Ref: whatsnew/changelog id302810320 +Ref: 157d2810320 +Ref: Tools/Demos<3>-Footnote-12810684 +Ref: Tools/Demos<3>-Footnote-22810740 +Node: Tests<5>2810796 +Ref: whatsnew/changelog id312810903 +Ref: 157e2810903 +Ref: Tests<5>-Footnote-12811302 +Ref: Tests<5>-Footnote-22811358 +Ref: Tests<5>-Footnote-32811414 +Node: Security<4>2811470 +Ref: whatsnew/changelog id322811573 +Ref: 157f2811573 +Ref: Security<4>-Footnote-12813383 +Ref: Security<4>-Footnote-22813439 +Ref: Security<4>-Footnote-32813500 +Ref: Security<4>-Footnote-42813556 +Ref: Security<4>-Footnote-52813612 +Ref: Security<4>-Footnote-62813667 +Node: Library<6>2813723 +Ref: whatsnew/changelog id332813834 +Ref: 15812813834 +Ref: Library<6>-Footnote-12822622 +Ref: Library<6>-Footnote-22822678 +Ref: Library<6>-Footnote-32822734 +Ref: Library<6>-Footnote-42822790 +Ref: Library<6>-Footnote-52822846 +Ref: Library<6>-Footnote-62822902 +Ref: Library<6>-Footnote-72822958 +Ref: Library<6>-Footnote-82823014 +Ref: Library<6>-Footnote-92823070 +Ref: Library<6>-Footnote-102823126 +Ref: Library<6>-Footnote-112823183 +Ref: Library<6>-Footnote-122823240 +Ref: Library<6>-Footnote-132823297 +Ref: Library<6>-Footnote-142823354 +Ref: Library<6>-Footnote-152823411 +Ref: Library<6>-Footnote-162823468 +Ref: Library<6>-Footnote-172823525 +Ref: Library<6>-Footnote-182823582 +Ref: Library<6>-Footnote-192823639 +Ref: Library<6>-Footnote-202823696 +Ref: Library<6>-Footnote-212823752 +Ref: Library<6>-Footnote-222823809 +Ref: Library<6>-Footnote-232823866 +Ref: Library<6>-Footnote-242823923 +Ref: Library<6>-Footnote-252823979 +Ref: Library<6>-Footnote-262824036 +Ref: Library<6>-Footnote-272824093 +Ref: Library<6>-Footnote-282824150 +Ref: Library<6>-Footnote-292824207 +Ref: Library<6>-Footnote-302824264 +Ref: Library<6>-Footnote-312824321 +Ref: Library<6>-Footnote-322824377 +Ref: Library<6>-Footnote-332824434 +Ref: Library<6>-Footnote-342824491 +Ref: Library<6>-Footnote-352824539 +Ref: Library<6>-Footnote-362824584 +Ref: Library<6>-Footnote-372824641 +Ref: Library<6>-Footnote-382824698 +Ref: Library<6>-Footnote-392824755 +Ref: Library<6>-Footnote-402824812 +Ref: Library<6>-Footnote-412824869 +Ref: Library<6>-Footnote-422824925 +Ref: Library<6>-Footnote-432824981 +Ref: Library<6>-Footnote-442825038 +Ref: Library<6>-Footnote-452825094 +Ref: Library<6>-Footnote-462825151 +Ref: Library<6>-Footnote-472825208 +Ref: Library<6>-Footnote-482825265 +Ref: Library<6>-Footnote-492825322 +Ref: Library<6>-Footnote-502825379 +Ref: Library<6>-Footnote-512825436 +Ref: Library<6>-Footnote-522825493 +Ref: Library<6>-Footnote-532825550 +Ref: Library<6>-Footnote-542825607 +Ref: Library<6>-Footnote-552825666 +Ref: Library<6>-Footnote-562825726 +Ref: Library<6>-Footnote-572825783 +Node: Documentation<6>2825840 +Ref: whatsnew/changelog id342825960 +Ref: 15862825960 +Ref: Documentation<6>-Footnote-12826382 +Ref: Documentation<6>-Footnote-22826438 +Node: Core and Builtins<6>2826493 +Ref: whatsnew/changelog id352826611 +Ref: 15882826611 +Ref: Core and Builtins<6>-Footnote-12829444 +Ref: Core and Builtins<6>-Footnote-22829500 +Ref: Core and Builtins<6>-Footnote-32829556 +Ref: Core and Builtins<6>-Footnote-42829612 +Ref: Core and Builtins<6>-Footnote-52829668 +Ref: Core and Builtins<6>-Footnote-62829724 +Ref: Core and Builtins<6>-Footnote-72829780 +Ref: Core and Builtins<6>-Footnote-82829836 +Ref: Core and Builtins<6>-Footnote-92829892 +Ref: Core and Builtins<6>-Footnote-102829948 +Ref: Core and Builtins<6>-Footnote-112830005 +Ref: Core and Builtins<6>-Footnote-122830062 +Ref: Core and Builtins<6>-Footnote-132830119 +Ref: Core and Builtins<6>-Footnote-142830176 +Ref: Core and Builtins<6>-Footnote-152830233 +Ref: Core and Builtins<6>-Footnote-162830290 +Ref: Core and Builtins<6>-Footnote-172830347 +Ref: Core and Builtins<6>-Footnote-182830404 +Node: C API<4>2830461 +Ref: whatsnew/changelog id362830571 +Ref: 158a2830571 +Ref: C API<4>-Footnote-12830746 +Node: Build<4>2830802 +Ref: whatsnew/changelog id372830883 +Ref: 158c2830883 +Ref: Build<4>-Footnote-12831654 +Ref: Build<4>-Footnote-22831710 +Ref: Build<4>-Footnote-32831766 +Ref: Build<4>-Footnote-42831822 +Ref: Build<4>-Footnote-52831878 +Node: Python 3 13 1 final2831934 +Ref: whatsnew/changelog python-3-13-1-final2832055 +Ref: 158d2832055 +Node: macOS<4>2832421 +Ref: whatsnew/changelog id382832504 +Ref: 158e2832504 +Ref: macOS<4>-Footnote-12832643 +Node: Windows<6>2832699 +Ref: whatsnew/changelog id392832805 +Ref: 158f2832805 +Ref: Windows<6>-Footnote-12833873 +Ref: Windows<6>-Footnote-22833929 +Ref: Windows<6>-Footnote-32833985 +Ref: Windows<6>-Footnote-42834041 +Ref: Windows<6>-Footnote-52834097 +Ref: Windows<6>-Footnote-62834153 +Ref: Windows<6>-Footnote-72834209 +Ref: Windows<6>-Footnote-82834265 +Ref: Windows<6>-Footnote-92834321 +Node: Tools/Demos<4>2834377 +Ref: whatsnew/changelog id402834483 +Ref: 15902834483 +Ref: Tools/Demos<4>-Footnote-12834817 +Ref: Tools/Demos<4>-Footnote-22834873 +Node: Tests<6>2834929 +Ref: whatsnew/changelog id412835036 +Ref: 15912835036 +Ref: Tests<6>-Footnote-12835556 +Ref: Tests<6>-Footnote-22835612 +Ref: Tests<6>-Footnote-32835668 +Node: Security<5>2835724 +Ref: whatsnew/changelog id422835827 +Ref: 15922835827 +Ref: Security<5>-Footnote-12836353 +Ref: Security<5>-Footnote-22836409 +Ref: Security<5>-Footnote-32836465 +Node: Library<7>2836521 +Ref: whatsnew/changelog id432836623 +Ref: 15932836623 +Ref: Library<7>-Footnote-12858219 +Ref: Library<7>-Footnote-22858275 +Ref: Library<7>-Footnote-32858331 +Ref: Library<7>-Footnote-42858387 +Ref: Library<7>-Footnote-52858443 +Ref: Library<7>-Footnote-62858499 +Ref: Library<7>-Footnote-72858555 +Ref: Library<7>-Footnote-82858611 +Ref: Library<7>-Footnote-92858667 +Ref: Library<7>-Footnote-102858723 +Ref: Library<7>-Footnote-112858780 +Ref: Library<7>-Footnote-122858837 +Ref: Library<7>-Footnote-132858894 +Ref: Library<7>-Footnote-142858951 +Ref: Library<7>-Footnote-152859007 +Ref: Library<7>-Footnote-162859063 +Ref: Library<7>-Footnote-172859120 +Ref: Library<7>-Footnote-182859177 +Ref: Library<7>-Footnote-192859234 +Ref: Library<7>-Footnote-202859291 +Ref: Library<7>-Footnote-212859348 +Ref: Library<7>-Footnote-222859405 +Ref: Library<7>-Footnote-232859462 +Ref: Library<7>-Footnote-242859519 +Ref: Library<7>-Footnote-252859576 +Ref: Library<7>-Footnote-262859633 +Ref: Library<7>-Footnote-272859690 +Ref: Library<7>-Footnote-282859747 +Ref: Library<7>-Footnote-292859804 +Ref: Library<7>-Footnote-302859861 +Ref: Library<7>-Footnote-312859918 +Ref: Library<7>-Footnote-322859975 +Ref: Library<7>-Footnote-332860032 +Ref: Library<7>-Footnote-342860089 +Ref: Library<7>-Footnote-352860146 +Ref: Library<7>-Footnote-362860203 +Ref: Library<7>-Footnote-372860260 +Ref: Library<7>-Footnote-382860317 +Ref: Library<7>-Footnote-392860374 +Ref: Library<7>-Footnote-402860431 +Ref: Library<7>-Footnote-412860488 +Ref: Library<7>-Footnote-422860545 +Ref: Library<7>-Footnote-432860602 +Ref: Library<7>-Footnote-442860659 +Ref: Library<7>-Footnote-452860716 +Ref: Library<7>-Footnote-462860773 +Ref: Library<7>-Footnote-472860830 +Ref: Library<7>-Footnote-482860887 +Ref: Library<7>-Footnote-492860944 +Ref: Library<7>-Footnote-502861001 +Ref: Library<7>-Footnote-512861058 +Ref: Library<7>-Footnote-522861115 +Ref: Library<7>-Footnote-532861172 +Ref: Library<7>-Footnote-542861229 +Ref: Library<7>-Footnote-552861286 +Ref: Library<7>-Footnote-562861343 +Ref: Library<7>-Footnote-572861400 +Ref: Library<7>-Footnote-582861457 +Ref: Library<7>-Footnote-592861514 +Ref: Library<7>-Footnote-602861571 +Ref: Library<7>-Footnote-612861628 +Ref: Library<7>-Footnote-622861685 +Ref: Library<7>-Footnote-632861742 +Ref: Library<7>-Footnote-642861798 +Ref: Library<7>-Footnote-652861855 +Ref: Library<7>-Footnote-662861912 +Ref: Library<7>-Footnote-672861969 +Ref: Library<7>-Footnote-682862026 +Ref: Library<7>-Footnote-692862083 +Ref: Library<7>-Footnote-702862140 +Ref: Library<7>-Footnote-712862196 +Ref: Library<7>-Footnote-722862252 +Ref: Library<7>-Footnote-732862309 +Ref: Library<7>-Footnote-742862366 +Ref: Library<7>-Footnote-752862423 +Ref: Library<7>-Footnote-762862480 +Ref: Library<7>-Footnote-772862537 +Ref: Library<7>-Footnote-782862594 +Ref: Library<7>-Footnote-792862651 +Ref: Library<7>-Footnote-802862707 +Ref: Library<7>-Footnote-812862764 +Ref: Library<7>-Footnote-822862821 +Ref: Library<7>-Footnote-832862878 +Ref: Library<7>-Footnote-842862935 +Ref: Library<7>-Footnote-852862992 +Ref: Library<7>-Footnote-862863049 +Ref: Library<7>-Footnote-872863105 +Ref: Library<7>-Footnote-882863162 +Ref: Library<7>-Footnote-892863218 +Ref: Library<7>-Footnote-902863274 +Ref: Library<7>-Footnote-912863331 +Ref: Library<7>-Footnote-922863388 +Ref: Library<7>-Footnote-932863444 +Ref: Library<7>-Footnote-942863501 +Ref: Library<7>-Footnote-952863558 +Ref: Library<7>-Footnote-962863614 +Ref: Library<7>-Footnote-972863670 +Ref: Library<7>-Footnote-982863726 +Ref: Library<7>-Footnote-992863782 +Ref: Library<7>-Footnote-1002863839 +Ref: Library<7>-Footnote-1012863896 +Ref: Library<7>-Footnote-1022863954 +Ref: Library<7>-Footnote-1032864012 +Ref: Library<7>-Footnote-1042864070 +Ref: Library<7>-Footnote-1052864128 +Ref: Library<7>-Footnote-1062864186 +Ref: Library<7>-Footnote-1072864244 +Ref: Library<7>-Footnote-1082864302 +Ref: Library<7>-Footnote-1092864359 +Ref: Library<7>-Footnote-1102864417 +Ref: Library<7>-Footnote-1112864475 +Ref: Library<7>-Footnote-1122864533 +Ref: Library<7>-Footnote-1132864591 +Ref: Library<7>-Footnote-1142864648 +Ref: Library<7>-Footnote-1152864705 +Ref: Library<7>-Footnote-1162864772 +Node: IDLE<5>2864839 +Ref: whatsnew/changelog id442864946 +Ref: 15af2864946 +Ref: IDLE<5>-Footnote-12865165 +Node: Documentation<7>2865221 +Ref: whatsnew/changelog id452865338 +Ref: 15b02865338 +Ref: Documentation<7>-Footnote-12867371 +Ref: Documentation<7>-Footnote-22867427 +Ref: Documentation<7>-Footnote-32867483 +Ref: Documentation<7>-Footnote-42867539 +Ref: Documentation<7>-Footnote-52867595 +Ref: Documentation<7>-Footnote-62867650 +Ref: Documentation<7>-Footnote-72867706 +Ref: Documentation<7>-Footnote-82867761 +Node: Core and Builtins<7>2867826 +Ref: whatsnew/changelog id462867944 +Ref: 15b52867944 +Ref: Core and Builtins<7>-Footnote-12872727 +Ref: Core and Builtins<7>-Footnote-22872783 +Ref: Core and Builtins<7>-Footnote-32872839 +Ref: Core and Builtins<7>-Footnote-42872895 +Ref: Core and Builtins<7>-Footnote-52872951 +Ref: Core and Builtins<7>-Footnote-62873007 +Ref: Core and Builtins<7>-Footnote-72873063 +Ref: Core and Builtins<7>-Footnote-82873119 +Ref: Core and Builtins<7>-Footnote-92873175 +Ref: Core and Builtins<7>-Footnote-102873231 +Ref: Core and Builtins<7>-Footnote-112873288 +Ref: Core and Builtins<7>-Footnote-122873345 +Ref: Core and Builtins<7>-Footnote-132873402 +Ref: Core and Builtins<7>-Footnote-142873459 +Ref: Core and Builtins<7>-Footnote-152873516 +Ref: Core and Builtins<7>-Footnote-162873573 +Ref: Core and Builtins<7>-Footnote-172873630 +Ref: Core and Builtins<7>-Footnote-182873687 +Ref: Core and Builtins<7>-Footnote-192873744 +Ref: Core and Builtins<7>-Footnote-202873801 +Ref: Core and Builtins<7>-Footnote-212873858 +Ref: Core and Builtins<7>-Footnote-222873915 +Ref: Core and Builtins<7>-Footnote-232873972 +Ref: Core and Builtins<7>-Footnote-242874029 +Ref: Core and Builtins<7>-Footnote-252874086 +Ref: Core and Builtins<7>-Footnote-262874143 +Ref: Core and Builtins<7>-Footnote-272874200 +Node: C API<5>2874257 +Ref: whatsnew/changelog id472874367 +Ref: 15bd2874367 +Ref: C API<5>-Footnote-12874982 +Ref: C API<5>-Footnote-22875038 +Ref: C API<5>-Footnote-32875094 +Node: Build<5>2875159 +Ref: whatsnew/changelog id482875240 +Ref: 15be2875240 +Ref: Build<5>-Footnote-12876097 +Ref: Build<5>-Footnote-22876153 +Ref: Build<5>-Footnote-32876208 +Ref: Build<5>-Footnote-42876264 +Ref: Build<5>-Footnote-52876329 +Ref: Build<5>-Footnote-62876384 +Ref: Build<5>-Footnote-72876440 +Ref: Build<5>-Footnote-82876496 +Ref: Build<5>-Footnote-92876552 +Node: Python 3 13 0 final2876608 +Ref: whatsnew/changelog python-3-13-0-final2876743 +Ref: 15bf2876743 +Node: Core and Builtins<8>2876879 +Ref: whatsnew/changelog id492876955 +Ref: 15c02876955 +Ref: Core and Builtins<8>-Footnote-12877321 +Ref: Core and Builtins<8>-Footnote-22877377 +Node: Python 3 13 0 release candidate 32877433 +Ref: whatsnew/changelog python-3-13-0-release-candidate-32877582 +Ref: 15c12877582 +Node: macOS<5>2877920 +Ref: whatsnew/changelog id502878017 +Ref: 15c22878017 +Ref: macOS<5>-Footnote-12878178 +Node: Windows<7>2878234 +Ref: whatsnew/changelog id512878348 +Ref: 15c32878348 +Ref: Windows<7>-Footnote-12878748 +Ref: Windows<7>-Footnote-22878804 +Ref: Windows<7>-Footnote-32878860 +Node: Tests<7>2878916 +Ref: whatsnew/changelog id522879032 +Ref: 15c42879032 +Ref: Tests<7>-Footnote-12879170 +Node: Library<8>2879226 +Ref: whatsnew/changelog id532879339 +Ref: 15c52879339 +Ref: Library<8>-Footnote-12881905 +Ref: Library<8>-Footnote-22881961 +Ref: Library<8>-Footnote-32882017 +Ref: Library<8>-Footnote-42882073 +Ref: Library<8>-Footnote-52882129 +Ref: Library<8>-Footnote-62882185 +Ref: Library<8>-Footnote-72882240 +Ref: Library<8>-Footnote-82882296 +Ref: Library<8>-Footnote-92882352 +Ref: Library<8>-Footnote-102882408 +Ref: Library<8>-Footnote-112882465 +Ref: Library<8>-Footnote-122882522 +Ref: Library<8>-Footnote-132882579 +Ref: Library<8>-Footnote-142882636 +Ref: Library<8>-Footnote-152882693 +Ref: Library<8>-Footnote-162882750 +Node: IDLE<6>2882816 +Ref: whatsnew/changelog id542882937 +Ref: 15c92882937 +Ref: IDLE<6>-Footnote-12883174 +Ref: IDLE<6>-Footnote-22883230 +Node: Documentation<8>2883286 +Ref: whatsnew/changelog id552883417 +Ref: 15ca2883417 +Ref: Documentation<8>-Footnote-12883779 +Ref: Documentation<8>-Footnote-22883835 +Node: Core and Builtins<9>2883891 +Ref: whatsnew/changelog id562884023 +Ref: 15cb2884023 +Ref: Core and Builtins<9>-Footnote-12885918 +Ref: Core and Builtins<9>-Footnote-22885974 +Ref: Core and Builtins<9>-Footnote-32886030 +Ref: Core and Builtins<9>-Footnote-42886086 +Ref: Core and Builtins<9>-Footnote-52886142 +Ref: Core and Builtins<9>-Footnote-62886198 +Ref: Core and Builtins<9>-Footnote-72886254 +Ref: Core and Builtins<9>-Footnote-82886310 +Ref: Core and Builtins<9>-Footnote-92886365 +Ref: Core and Builtins<9>-Footnote-102886421 +Ref: Core and Builtins<9>-Footnote-112886477 +Node: C API<6>2886534 +Ref: whatsnew/changelog id572886658 +Ref: 15cc2886658 +Ref: C API<6>-Footnote-12886981 +Ref: C API<6>-Footnote-22887037 +Node: Build<6>2887093 +Ref: whatsnew/changelog id582887188 +Ref: 15cd2887188 +Ref: Build<6>-Footnote-12887505 +Ref: Build<6>-Footnote-22887561 +Node: Python 3 13 0 release candidate 22887617 +Ref: whatsnew/changelog python-3-13-0-release-candidate-22887780 +Ref: 15ce2887780 +Node: macOS<6>2888142 +Ref: whatsnew/changelog id592888239 +Ref: 15cf2888239 +Ref: macOS<6>-Footnote-12888381 +Node: Windows<8>2888437 +Ref: whatsnew/changelog id602888557 +Ref: 15d02888557 +Ref: Windows<8>-Footnote-12889014 +Ref: Windows<8>-Footnote-22889070 +Ref: Windows<8>-Footnote-32889126 +Ref: Windows<8>-Footnote-42889182 +Node: Tools/Demos<5>2889237 +Ref: whatsnew/changelog id612889357 +Ref: 15d12889357 +Ref: Tools/Demos<5>-Footnote-12889563 +Node: Tests<8>2889619 +Ref: whatsnew/changelog id622889740 +Ref: 15d22889740 +Ref: Tests<8>-Footnote-12890043 +Ref: Tests<8>-Footnote-22890099 +Node: Security<6>2890155 +Ref: whatsnew/changelog id632890272 +Ref: 15d32890272 +Ref: Security<6>-Footnote-12890517 +Ref: Security<6>-Footnote-22890573 +Node: Library<9>2890629 +Ref: whatsnew/changelog id642890745 +Ref: 15d42890745 +Ref: Library<9>-Footnote-12895808 +Ref: Library<9>-Footnote-22895864 +Ref: Library<9>-Footnote-32895920 +Ref: Library<9>-Footnote-42895976 +Ref: Library<9>-Footnote-52896047 +Ref: Library<9>-Footnote-62896103 +Ref: Library<9>-Footnote-72896159 +Ref: Library<9>-Footnote-82896215 +Ref: Library<9>-Footnote-92896271 +Ref: Library<9>-Footnote-102896327 +Ref: Library<9>-Footnote-112896384 +Ref: Library<9>-Footnote-122896441 +Ref: Library<9>-Footnote-132896497 +Ref: Library<9>-Footnote-142896554 +Ref: Library<9>-Footnote-152896611 +Ref: Library<9>-Footnote-162896668 +Ref: Library<9>-Footnote-172896725 +Ref: Library<9>-Footnote-182896782 +Ref: Library<9>-Footnote-192896839 +Ref: Library<9>-Footnote-202896896 +Ref: Library<9>-Footnote-212896953 +Ref: Library<9>-Footnote-222897010 +Ref: Library<9>-Footnote-232897067 +Ref: Library<9>-Footnote-242897124 +Ref: Library<9>-Footnote-252897180 +Ref: Library<9>-Footnote-262897237 +Ref: Library<9>-Footnote-272897293 +Ref: Library<9>-Footnote-282897350 +Ref: Library<9>-Footnote-292897407 +Ref: Library<9>-Footnote-302897464 +Ref: Library<9>-Footnote-312897521 +Ref: Library<9>-Footnote-322897578 +Ref: Library<9>-Footnote-332897635 +Ref: Library<9>-Footnote-342897692 +Node: IDLE<7>2897749 +Ref: whatsnew/changelog id652897875 +Ref: 15df2897875 +Ref: IDLE<7>-Footnote-12898125 +Node: Core and Builtins<10>2898181 +Ref: whatsnew/changelog id662898305 +Ref: 15e02898305 +Ref: Core and Builtins<10>-Footnote-12901976 +Ref: Core and Builtins<10>-Footnote-22902032 +Ref: Core and Builtins<10>-Footnote-32902088 +Ref: Core and Builtins<10>-Footnote-42902144 +Ref: Core and Builtins<10>-Footnote-52902200 +Ref: Core and Builtins<10>-Footnote-62902256 +Ref: Core and Builtins<10>-Footnote-72902312 +Ref: Core and Builtins<10>-Footnote-82902368 +Ref: Core and Builtins<10>-Footnote-92902424 +Ref: Core and Builtins<10>-Footnote-102902480 +Ref: Core and Builtins<10>-Footnote-112902537 +Ref: Core and Builtins<10>-Footnote-122902594 +Ref: Core and Builtins<10>-Footnote-132902651 +Ref: Core and Builtins<10>-Footnote-142902708 +Ref: Core and Builtins<10>-Footnote-152902765 +Ref: Core and Builtins<10>-Footnote-162902822 +Ref: Core and Builtins<10>-Footnote-172902879 +Ref: Core and Builtins<10>-Footnote-182902936 +Ref: Core and Builtins<10>-Footnote-192902993 +Ref: Core and Builtins<10>-Footnote-202903050 +Ref: Core and Builtins<10>-Footnote-212903107 +Ref: Core and Builtins<10>-Footnote-222903164 +Ref: Core and Builtins<10>-Footnote-232903221 +Ref: Core and Builtins<10>-Footnote-242903278 +Ref: Core and Builtins<10>-Footnote-252903335 +Ref: Core and Builtins<10>-Footnote-262903391 +Ref: Core and Builtins<10>-Footnote-272903447 +Node: C API<7>2903504 +Ref: whatsnew/changelog id672903629 +Ref: 15e22903629 +Ref: C API<7>-Footnote-12903865 +Node: Build<7>2903921 +Ref: whatsnew/changelog id682904016 +Ref: 15e32904016 +Ref: Build<7>-Footnote-12904913 +Ref: Build<7>-Footnote-22904969 +Ref: Build<7>-Footnote-32905025 +Ref: Build<7>-Footnote-42905081 +Ref: Build<7>-Footnote-52905137 +Node: Python 3 13 0 release candidate 12905193 +Ref: whatsnew/changelog python-3-13-0-release-candidate-12905343 +Ref: 15e42905343 +Node: Tests<9>2905633 +Ref: whatsnew/changelog id692905731 +Ref: 15e52905731 +Ref: Tests<9>-Footnote-12906143 +Ref: Tests<9>-Footnote-22906198 +Node: Security<7>2906253 +Ref: whatsnew/changelog id702906371 +Ref: 15e82906371 +Ref: Security<7>-Footnote-12907015 +Ref: Security<7>-Footnote-22907071 +Node: Library<10>2907127 +Ref: whatsnew/changelog id712907244 +Ref: 15e92907244 +Ref: Library<10>-Footnote-12909251 +Ref: Library<10>-Footnote-22909307 +Ref: Library<10>-Footnote-32909363 +Ref: Library<10>-Footnote-42909419 +Ref: Library<10>-Footnote-52909475 +Ref: Library<10>-Footnote-62909531 +Ref: Library<10>-Footnote-72909587 +Ref: Library<10>-Footnote-82909642 +Ref: Library<10>-Footnote-92909698 +Ref: Library<10>-Footnote-102909754 +Ref: Library<10>-Footnote-112909811 +Ref: Library<10>-Footnote-122909867 +Ref: Library<10>-Footnote-132909924 +Node: IDLE<8>2909981 +Ref: whatsnew/changelog id722910108 +Ref: 15ee2910108 +Ref: IDLE<8>-Footnote-12910320 +Node: Core and Builtins<11>2910376 +Ref: whatsnew/changelog id732910500 +Ref: 15ef2910500 +Ref: Core and Builtins<11>-Footnote-12911529 +Ref: Core and Builtins<11>-Footnote-22911585 +Ref: Core and Builtins<11>-Footnote-32911641 +Ref: Core and Builtins<11>-Footnote-42911697 +Ref: Core and Builtins<11>-Footnote-52911753 +Ref: Core and Builtins<11>-Footnote-62911809 +Ref: Core and Builtins<11>-Footnote-72911865 +Node: C API<8>2911921 +Ref: whatsnew/changelog id742912046 +Ref: 15f12912046 +Ref: C API<8>-Footnote-12912373 +Ref: C API<8>-Footnote-22912429 +Node: Build<8>2912485 +Ref: whatsnew/changelog id752912580 +Ref: 15f32912580 +Ref: Build<8>-Footnote-12912803 +Node: Python 3 13 0 beta 42912859 +Ref: whatsnew/changelog python-3-13-0-beta-42912996 +Ref: 15f52912996 +Node: Tests<10>2913271 +Ref: whatsnew/changelog id762913357 +Ref: 15f62913357 +Ref: Tests<10>-Footnote-12914250 +Ref: Tests<10>-Footnote-22914306 +Ref: Tests<10>-Footnote-32914362 +Ref: Tests<10>-Footnote-42914418 +Node: Library<11>2914474 +Ref: whatsnew/changelog id772914576 +Ref: 15f82914576 +Ref: Library<11>-Footnote-12917055 +Ref: Library<11>-Footnote-22917110 +Ref: Library<11>-Footnote-32917166 +Ref: Library<11>-Footnote-42917222 +Ref: Library<11>-Footnote-52917278 +Ref: Library<11>-Footnote-62917334 +Ref: Library<11>-Footnote-72917389 +Ref: Library<11>-Footnote-82917445 +Ref: Library<11>-Footnote-92917501 +Ref: Library<11>-Footnote-102917557 +Ref: Library<11>-Footnote-112917614 +Ref: Library<11>-Footnote-122917671 +Ref: Library<11>-Footnote-132917728 +Ref: Library<11>-Footnote-142917785 +Node: IDLE<9>2917842 +Ref: whatsnew/changelog id782917951 +Ref: 15fa2917951 +Ref: IDLE<9>-Footnote-12918151 +Node: Documentation<9>2918206 +Ref: whatsnew/changelog id792918325 +Ref: 15fb2918325 +Ref: Documentation<9>-Footnote-12918695 +Ref: Documentation<9>-Footnote-22918751 +Node: Core and Builtins<12>2918807 +Ref: whatsnew/changelog id802918927 +Ref: 15fe2918927 +Ref: Core and Builtins<12>-Footnote-12920919 +Ref: Core and Builtins<12>-Footnote-22920975 +Ref: Core and Builtins<12>-Footnote-32921031 +Ref: Core and Builtins<12>-Footnote-42921087 +Ref: Core and Builtins<12>-Footnote-52921143 +Ref: Core and Builtins<12>-Footnote-62921199 +Ref: Core and Builtins<12>-Footnote-72921255 +Ref: Core and Builtins<12>-Footnote-82921311 +Ref: Core and Builtins<12>-Footnote-92921367 +Ref: Core and Builtins<12>-Footnote-102921423 +Ref: Core and Builtins<12>-Footnote-112921480 +Ref: Core and Builtins<12>-Footnote-122921537 +Ref: Core and Builtins<12>-Footnote-132921594 +Ref: Core and Builtins<12>-Footnote-142921651 +Node: C API<9>2921708 +Ref: whatsnew/changelog id812921820 +Ref: 15ff2921820 +Ref: C API<9>-Footnote-12923018 +Ref: C API<9>-Footnote-22923073 +Ref: C API<9>-Footnote-32923129 +Ref: C API<9>-Footnote-42923185 +Node: Build<9>2923241 +Ref: whatsnew/changelog id822923323 +Ref: 16032923323 +Ref: Build<9>-Footnote-12924175 +Ref: Build<9>-Footnote-22924231 +Ref: Build<9>-Footnote-32924287 +Ref: Build<9>-Footnote-42924343 +Ref: Build<9>-Footnote-52924399 +Ref: Build<9>-Footnote-62924455 +Ref: Build<9>-Footnote-72924511 +Node: Python 3 13 0 beta 32924567 +Ref: whatsnew/changelog python-3-13-0-beta-32924691 +Ref: 16042924691 +Node: Core and Builtins<13>2924896 +Ref: whatsnew/changelog id832924994 +Ref: 16052924994 +Ref: Core and Builtins<13>-Footnote-12928371 +Ref: Core and Builtins<13>-Footnote-22928427 +Ref: Core and Builtins<13>-Footnote-32928483 +Ref: Core and Builtins<13>-Footnote-42928539 +Ref: Core and Builtins<13>-Footnote-52928595 +Ref: Core and Builtins<13>-Footnote-62928651 +Ref: Core and Builtins<13>-Footnote-72928707 +Ref: Core and Builtins<13>-Footnote-82928763 +Ref: Core and Builtins<13>-Footnote-92928819 +Ref: Core and Builtins<13>-Footnote-102928875 +Ref: Core and Builtins<13>-Footnote-112928932 +Ref: Core and Builtins<13>-Footnote-122928989 +Ref: Core and Builtins<13>-Footnote-132929046 +Ref: Core and Builtins<13>-Footnote-142929103 +Ref: Core and Builtins<13>-Footnote-152929160 +Ref: Core and Builtins<13>-Footnote-162929216 +Ref: Core and Builtins<13>-Footnote-172929273 +Ref: Core and Builtins<13>-Footnote-182929330 +Ref: Core and Builtins<13>-Footnote-192929387 +Ref: Core and Builtins<13>-Footnote-202929444 +Ref: Core and Builtins<13>-Footnote-212929501 +Node: Library<12>2929567 +Ref: whatsnew/changelog id842929683 +Ref: 16062929683 +Ref: Library<12>-Footnote-12935197 +Ref: Library<12>-Footnote-22935253 +Ref: Library<12>-Footnote-32935309 +Ref: Library<12>-Footnote-42935365 +Ref: Library<12>-Footnote-52935421 +Ref: Library<12>-Footnote-62935477 +Ref: Library<12>-Footnote-72935533 +Ref: Library<12>-Footnote-82935589 +Ref: Library<12>-Footnote-92935645 +Ref: Library<12>-Footnote-102935701 +Ref: Library<12>-Footnote-112935758 +Ref: Library<12>-Footnote-122935815 +Ref: Library<12>-Footnote-132935872 +Ref: Library<12>-Footnote-142935929 +Ref: Library<12>-Footnote-152935986 +Ref: Library<12>-Footnote-162936043 +Ref: Library<12>-Footnote-172936099 +Ref: Library<12>-Footnote-182936156 +Ref: Library<12>-Footnote-192936213 +Ref: Library<12>-Footnote-202936270 +Ref: Library<12>-Footnote-212936327 +Ref: Library<12>-Footnote-222936370 +Ref: Library<12>-Footnote-232936427 +Ref: Library<12>-Footnote-242936484 +Ref: Library<12>-Footnote-252936541 +Ref: Library<12>-Footnote-262936597 +Ref: Library<12>-Footnote-272936654 +Ref: Library<12>-Footnote-282936711 +Ref: Library<12>-Footnote-292936768 +Ref: Library<12>-Footnote-302936825 +Ref: Library<12>-Footnote-312936882 +Ref: Library<12>-Footnote-322936939 +Ref: Library<12>-Footnote-332936995 +Ref: Library<12>-Footnote-342937051 +Ref: Library<12>-Footnote-352937108 +Ref: Library<12>-Footnote-362937165 +Node: Build<10>2937222 +Ref: whatsnew/changelog id852937326 +Ref: 16102937326 +Ref: Build<10>-Footnote-12937870 +Ref: Build<10>-Footnote-22937926 +Ref: Build<10>-Footnote-32937982 +Ref: Build<10>-Footnote-42938038 +Node: C API<10>2938094 +Ref: whatsnew/changelog id862938178 +Ref: 16112938178 +Ref: C API<10>-Footnote-12939355 +Ref: C API<10>-Footnote-22939411 +Ref: C API<10>-Footnote-32939467 +Ref: C API<10>-Footnote-42939523 +Ref: C API<10>-Footnote-52939579 +Ref: C API<10>-Footnote-62939635 +Node: Python 3 13 0 beta 22939691 +Ref: whatsnew/changelog python-3-13-0-beta-22939815 +Ref: 16142939815 +Node: Security<8>2940088 +Ref: whatsnew/changelog id872940186 +Ref: 16152940186 +Ref: Security<8>-Footnote-12940703 +Ref: Security<8>-Footnote-22940759 +Ref: Security<8>-Footnote-32940815 +Node: Core and Builtins<14>2940870 +Ref: whatsnew/changelog id882940988 +Ref: 16162940988 +Ref: Core and Builtins<14>-Footnote-12943790 +Ref: Core and Builtins<14>-Footnote-22943846 +Ref: Core and Builtins<14>-Footnote-32943902 +Ref: Core and Builtins<14>-Footnote-42943958 +Ref: Core and Builtins<14>-Footnote-52944014 +Ref: Core and Builtins<14>-Footnote-62944070 +Ref: Core and Builtins<14>-Footnote-72944126 +Ref: Core and Builtins<14>-Footnote-82944182 +Ref: Core and Builtins<14>-Footnote-92944238 +Ref: Core and Builtins<14>-Footnote-102944294 +Ref: Core and Builtins<14>-Footnote-112944351 +Ref: Core and Builtins<14>-Footnote-122944408 +Ref: Core and Builtins<14>-Footnote-132944465 +Ref: Core and Builtins<14>-Footnote-142944522 +Ref: Core and Builtins<14>-Footnote-152944579 +Ref: Core and Builtins<14>-Footnote-162944636 +Ref: Core and Builtins<14>-Footnote-172944693 +Ref: Core and Builtins<14>-Footnote-182944750 +Ref: Core and Builtins<14>-Footnote-192944807 +Node: Library<13>2944864 +Ref: whatsnew/changelog id892944980 +Ref: 16172944980 +Ref: Library<13>-Footnote-12951587 +Ref: Library<13>-Footnote-22951643 +Ref: Library<13>-Footnote-32951699 +Ref: Library<13>-Footnote-42951755 +Ref: Library<13>-Footnote-52951811 +Ref: Library<13>-Footnote-62951866 +Ref: Library<13>-Footnote-72951921 +Ref: Library<13>-Footnote-82951977 +Ref: Library<13>-Footnote-92952032 +Ref: Library<13>-Footnote-102952088 +Ref: Library<13>-Footnote-112952145 +Ref: Library<13>-Footnote-122952202 +Ref: Library<13>-Footnote-132952259 +Ref: Library<13>-Footnote-142952316 +Ref: Library<13>-Footnote-152952373 +Ref: Library<13>-Footnote-162952430 +Ref: Library<13>-Footnote-172952487 +Ref: Library<13>-Footnote-182952544 +Ref: Library<13>-Footnote-192952601 +Ref: Library<13>-Footnote-202952658 +Ref: Library<13>-Footnote-212952715 +Ref: Library<13>-Footnote-222952771 +Ref: Library<13>-Footnote-232952828 +Ref: Library<13>-Footnote-242952885 +Ref: Library<13>-Footnote-252952942 +Ref: Library<13>-Footnote-262952999 +Ref: Library<13>-Footnote-272953056 +Ref: Library<13>-Footnote-282953113 +Ref: Library<13>-Footnote-292953170 +Ref: Library<13>-Footnote-302953227 +Ref: Library<13>-Footnote-312953284 +Ref: Library<13>-Footnote-322953341 +Ref: Library<13>-Footnote-332953398 +Ref: Library<13>-Footnote-342953481 +Ref: Library<13>-Footnote-352953538 +Ref: Library<13>-Footnote-362953595 +Ref: Library<13>-Footnote-372953651 +Ref: Library<13>-Footnote-382953708 +Ref: Library<13>-Footnote-392953764 +Ref: Library<13>-Footnote-402953830 +Node: Tests<11>2953886 +Ref: whatsnew/changelog id902953990 +Ref: 161d2953990 +Ref: Tests<11>-Footnote-12954184 +Node: Build<11>2954240 +Ref: whatsnew/changelog id912954343 +Ref: 161e2954343 +Ref: Build<11>-Footnote-12955389 +Ref: Build<11>-Footnote-22955445 +Ref: Build<11>-Footnote-32955501 +Ref: Build<11>-Footnote-42955557 +Ref: Build<11>-Footnote-52955613 +Node: Windows<9>2955669 +Ref: whatsnew/changelog id922955772 +Ref: 161f2955772 +Ref: Windows<9>-Footnote-12956707 +Ref: Windows<9>-Footnote-22956763 +Ref: Windows<9>-Footnote-32956819 +Ref: Windows<9>-Footnote-42956875 +Ref: Windows<9>-Footnote-52956931 +Ref: Windows<9>-Footnote-62956987 +Ref: Windows<9>-Footnote-72957043 +Node: C API<11>2957099 +Ref: whatsnew/changelog id932957184 +Ref: 16202957184 +Ref: C API<11>-Footnote-12958581 +Ref: C API<11>-Footnote-22958637 +Ref: C API<11>-Footnote-32958693 +Ref: C API<11>-Footnote-42958749 +Ref: C API<11>-Footnote-52958805 +Ref: C API<11>-Footnote-62958861 +Node: Python 3 13 0 beta 12958917 +Ref: whatsnew/changelog python-3-13-0-beta-12959042 +Ref: 16232959042 +Node: Security<9>2959369 +Ref: whatsnew/changelog id942959467 +Ref: 16242959467 +Ref: Security<9>-Footnote-12959862 +Ref: Security<9>-Footnote-22959918 +Node: Core and Builtins<15>2959974 +Ref: whatsnew/changelog id952960092 +Ref: 16252960092 +Ref: Core and Builtins<15>-Footnote-12969487 +Ref: Core and Builtins<15>-Footnote-22969543 +Ref: Core and Builtins<15>-Footnote-32969599 +Ref: Core and Builtins<15>-Footnote-42969655 +Ref: Core and Builtins<15>-Footnote-52969710 +Ref: Core and Builtins<15>-Footnote-62969766 +Ref: Core and Builtins<15>-Footnote-72969822 +Ref: Core and Builtins<15>-Footnote-82969878 +Ref: Core and Builtins<15>-Footnote-92969934 +Ref: Core and Builtins<15>-Footnote-102969990 +Ref: Core and Builtins<15>-Footnote-112970047 +Ref: Core and Builtins<15>-Footnote-122970104 +Ref: Core and Builtins<15>-Footnote-132970161 +Ref: Core and Builtins<15>-Footnote-142970218 +Ref: Core and Builtins<15>-Footnote-152970275 +Ref: Core and Builtins<15>-Footnote-162970331 +Ref: Core and Builtins<15>-Footnote-172970388 +Ref: Core and Builtins<15>-Footnote-182970445 +Ref: Core and Builtins<15>-Footnote-192970502 +Ref: Core and Builtins<15>-Footnote-202970559 +Ref: Core and Builtins<15>-Footnote-212970616 +Ref: Core and Builtins<15>-Footnote-222970673 +Ref: Core and Builtins<15>-Footnote-232970730 +Ref: Core and Builtins<15>-Footnote-242970787 +Ref: Core and Builtins<15>-Footnote-252970844 +Ref: Core and Builtins<15>-Footnote-262970901 +Ref: Core and Builtins<15>-Footnote-272970958 +Ref: Core and Builtins<15>-Footnote-282971015 +Ref: Core and Builtins<15>-Footnote-292971072 +Ref: Core and Builtins<15>-Footnote-302971129 +Ref: Core and Builtins<15>-Footnote-312971186 +Ref: Core and Builtins<15>-Footnote-322971243 +Ref: Core and Builtins<15>-Footnote-332971300 +Ref: Core and Builtins<15>-Footnote-342971357 +Ref: Core and Builtins<15>-Footnote-352971414 +Ref: Core and Builtins<15>-Footnote-362971471 +Ref: Core and Builtins<15>-Footnote-372971528 +Ref: Core and Builtins<15>-Footnote-382971571 +Ref: Core and Builtins<15>-Footnote-392971628 +Ref: Core and Builtins<15>-Footnote-402971685 +Ref: Core and Builtins<15>-Footnote-412971742 +Ref: Core and Builtins<15>-Footnote-422971799 +Ref: Core and Builtins<15>-Footnote-432971856 +Ref: Core and Builtins<15>-Footnote-442971899 +Ref: Core and Builtins<15>-Footnote-452971955 +Ref: Core and Builtins<15>-Footnote-462972012 +Ref: Core and Builtins<15>-Footnote-472972068 +Ref: Core and Builtins<15>-Footnote-482972124 +Node: Library<14>2972181 +Ref: whatsnew/changelog id962972305 +Ref: 16282972305 +Ref: Library<14>-Footnote-12988584 +Ref: Library<14>-Footnote-22988640 +Ref: Library<14>-Footnote-32988696 +Ref: Library<14>-Footnote-42988752 +Ref: Library<14>-Footnote-52988808 +Ref: Library<14>-Footnote-62988864 +Ref: Library<14>-Footnote-72988920 +Ref: Library<14>-Footnote-82988976 +Ref: Library<14>-Footnote-92989032 +Ref: Library<14>-Footnote-102989088 +Ref: Library<14>-Footnote-112989145 +Ref: Library<14>-Footnote-122989202 +Ref: Library<14>-Footnote-132989259 +Ref: Library<14>-Footnote-142989316 +Ref: Library<14>-Footnote-152989359 +Ref: Library<14>-Footnote-162989416 +Ref: Library<14>-Footnote-172989473 +Ref: Library<14>-Footnote-182989530 +Ref: Library<14>-Footnote-192989587 +Ref: Library<14>-Footnote-202989644 +Ref: Library<14>-Footnote-212989701 +Ref: Library<14>-Footnote-222989758 +Ref: Library<14>-Footnote-232989815 +Ref: Library<14>-Footnote-242989872 +Ref: Library<14>-Footnote-252989928 +Ref: Library<14>-Footnote-262989985 +Ref: Library<14>-Footnote-272990042 +Ref: Library<14>-Footnote-282990099 +Ref: Library<14>-Footnote-292990156 +Ref: Library<14>-Footnote-302990213 +Ref: Library<14>-Footnote-312990270 +Ref: Library<14>-Footnote-322990313 +Ref: Library<14>-Footnote-332990370 +Ref: Library<14>-Footnote-342990427 +Ref: Library<14>-Footnote-352990484 +Ref: Library<14>-Footnote-362990540 +Ref: Library<14>-Footnote-372990600 +Ref: Library<14>-Footnote-382990656 +Ref: Library<14>-Footnote-392990713 +Ref: Library<14>-Footnote-402990770 +Ref: Library<14>-Footnote-412990827 +Ref: Library<14>-Footnote-422990883 +Ref: Library<14>-Footnote-432990939 +Ref: Library<14>-Footnote-442990982 +Ref: Library<14>-Footnote-452991039 +Ref: Library<14>-Footnote-462991096 +Ref: Library<14>-Footnote-472991153 +Ref: Library<14>-Footnote-482991210 +Ref: Library<14>-Footnote-492991267 +Ref: Library<14>-Footnote-502991324 +Ref: Library<14>-Footnote-512991381 +Ref: Library<14>-Footnote-522991438 +Ref: Library<14>-Footnote-532991495 +Ref: Library<14>-Footnote-542991552 +Ref: Library<14>-Footnote-552991609 +Ref: Library<14>-Footnote-562991666 +Ref: Library<14>-Footnote-572991723 +Ref: Library<14>-Footnote-582991780 +Ref: Library<14>-Footnote-592991837 +Ref: Library<14>-Footnote-602991894 +Ref: Library<14>-Footnote-612991951 +Ref: Library<14>-Footnote-622992008 +Ref: Library<14>-Footnote-632992051 +Ref: Library<14>-Footnote-642992108 +Ref: Library<14>-Footnote-652992165 +Ref: Library<14>-Footnote-662992222 +Ref: Library<14>-Footnote-672992279 +Ref: Library<14>-Footnote-682992322 +Ref: Library<14>-Footnote-692992378 +Ref: Library<14>-Footnote-702992434 +Ref: Library<14>-Footnote-712992491 +Ref: Library<14>-Footnote-722992548 +Ref: Library<14>-Footnote-732992605 +Ref: Library<14>-Footnote-742992661 +Ref: Library<14>-Footnote-752992717 +Ref: Library<14>-Footnote-762992774 +Ref: Library<14>-Footnote-772992831 +Ref: Library<14>-Footnote-782992888 +Ref: Library<14>-Footnote-792992945 +Ref: Library<14>-Footnote-802993001 +Ref: Library<14>-Footnote-812993058 +Ref: Library<14>-Footnote-822993115 +Ref: Library<14>-Footnote-832993171 +Ref: Library<14>-Footnote-842993228 +Ref: Library<14>-Footnote-852993285 +Ref: Library<14>-Footnote-862993341 +Ref: Library<14>-Footnote-872993397 +Ref: Library<14>-Footnote-882993463 +Ref: Library<14>-Footnote-892993529 +Ref: Library<14>-Footnote-902993595 +Ref: Library<14>-Footnote-912993661 +Node: Documentation<10>2993727 +Ref: whatsnew/changelog id972993839 +Ref: 16372993839 +Ref: Documentation<10>-Footnote-12994021 +Node: Build<12>2994077 +Ref: whatsnew/changelog id982994189 +Ref: 16382994189 +Ref: Build<12>-Footnote-12995138 +Ref: Build<12>-Footnote-22995194 +Ref: Build<12>-Footnote-32995250 +Ref: Build<12>-Footnote-42995306 +Ref: Build<12>-Footnote-52995362 +Ref: Build<12>-Footnote-62995418 +Node: Windows<10>2995474 +Ref: whatsnew/changelog id992995577 +Ref: 16392995577 +Ref: Windows<10>-Footnote-12996616 +Ref: Windows<10>-Footnote-22996672 +Ref: Windows<10>-Footnote-32996728 +Ref: Windows<10>-Footnote-42996784 +Ref: Windows<10>-Footnote-52996840 +Ref: Windows<10>-Footnote-62996896 +Ref: Windows<10>-Footnote-72996951 +Node: macOS<7>2997007 +Ref: whatsnew/changelog id1002997109 +Ref: 163a2997109 +Ref: macOS<7>-Footnote-12997553 +Ref: macOS<7>-Footnote-22997609 +Ref: macOS<7>-Footnote-32997665 +Ref: macOS<7>-Footnote-42997721 +Node: IDLE<10>2997776 +Ref: whatsnew/changelog id1012997876 +Ref: 163b2997876 +Ref: IDLE<10>-Footnote-12998015 +Node: C API<12>2998080 +Ref: whatsnew/changelog id1022998163 +Ref: 163c2998163 +Ref: C API<12>-Footnote-12999439 +Ref: C API<12>-Footnote-22999495 +Ref: C API<12>-Footnote-32999551 +Ref: C API<12>-Footnote-42999607 +Ref: C API<12>-Footnote-52999663 +Ref: C API<12>-Footnote-62999719 +Ref: C API<12>-Footnote-72999774 +Node: Python 3 13 0 alpha 62999830 +Ref: whatsnew/changelog python-3-13-0-alpha-62999956 +Ref: 16422999956 +Node: Core and Builtins<16>3000243 +Ref: whatsnew/changelog id1033000342 +Ref: 16433000342 +Ref: Core and Builtins<16>-Footnote-13005425 +Ref: Core and Builtins<16>-Footnote-23005481 +Ref: Core and Builtins<16>-Footnote-33005537 +Ref: Core and Builtins<16>-Footnote-43005593 +Ref: Core and Builtins<16>-Footnote-53005649 +Ref: Core and Builtins<16>-Footnote-63005705 +Ref: Core and Builtins<16>-Footnote-73005761 +Ref: Core and Builtins<16>-Footnote-83005817 +Ref: Core and Builtins<16>-Footnote-93005872 +Ref: Core and Builtins<16>-Footnote-103005919 +Ref: Core and Builtins<16>-Footnote-113005976 +Ref: Core and Builtins<16>-Footnote-123006033 +Ref: Core and Builtins<16>-Footnote-133006090 +Ref: Core and Builtins<16>-Footnote-143006147 +Ref: Core and Builtins<16>-Footnote-153006204 +Ref: Core and Builtins<16>-Footnote-163006261 +Ref: Core and Builtins<16>-Footnote-173006318 +Ref: Core and Builtins<16>-Footnote-183006375 +Ref: Core and Builtins<16>-Footnote-193006432 +Ref: Core and Builtins<16>-Footnote-203006489 +Ref: Core and Builtins<16>-Footnote-213006546 +Ref: Core and Builtins<16>-Footnote-223006602 +Node: Library<15>3006668 +Ref: whatsnew/changelog id1043006793 +Ref: 16473006793 +Ref: Library<15>-Footnote-13017577 +Ref: Library<15>-Footnote-23017633 +Ref: Library<15>-Footnote-33017689 +Ref: Library<15>-Footnote-43017745 +Ref: Library<15>-Footnote-53017801 +Ref: Library<15>-Footnote-63017857 +Ref: Library<15>-Footnote-73017913 +Ref: Library<15>-Footnote-83017969 +Ref: Library<15>-Footnote-93018025 +Ref: Library<15>-Footnote-103018081 +Ref: Library<15>-Footnote-113018138 +Ref: Library<15>-Footnote-123018194 +Ref: Library<15>-Footnote-133018250 +Ref: Library<15>-Footnote-143018307 +Ref: Library<15>-Footnote-153018364 +Ref: Library<15>-Footnote-163018420 +Ref: Library<15>-Footnote-173018477 +Ref: Library<15>-Footnote-183018534 +Ref: Library<15>-Footnote-193018591 +Ref: Library<15>-Footnote-203018648 +Ref: Library<15>-Footnote-213018705 +Ref: Library<15>-Footnote-223018762 +Ref: Library<15>-Footnote-233018819 +Ref: Library<15>-Footnote-243018876 +Ref: Library<15>-Footnote-253018933 +Ref: Library<15>-Footnote-263018990 +Ref: Library<15>-Footnote-273019046 +Ref: Library<15>-Footnote-283019103 +Ref: Library<15>-Footnote-293019160 +Ref: Library<15>-Footnote-303019216 +Ref: Library<15>-Footnote-313019273 +Ref: Library<15>-Footnote-323019330 +Ref: Library<15>-Footnote-333019386 +Ref: Library<15>-Footnote-343019443 +Ref: Library<15>-Footnote-353019511 +Ref: Library<15>-Footnote-363019567 +Ref: Library<15>-Footnote-373019624 +Ref: Library<15>-Footnote-383019681 +Ref: Library<15>-Footnote-393019738 +Ref: Library<15>-Footnote-403019795 +Ref: Library<15>-Footnote-413019851 +Ref: Library<15>-Footnote-423019907 +Ref: Library<15>-Footnote-433019963 +Ref: Library<15>-Footnote-443020020 +Ref: Library<15>-Footnote-453020077 +Ref: Library<15>-Footnote-463020134 +Ref: Library<15>-Footnote-473020191 +Ref: Library<15>-Footnote-483020247 +Ref: Library<15>-Footnote-493020303 +Ref: Library<15>-Footnote-503020360 +Ref: Library<15>-Footnote-513020417 +Ref: Library<15>-Footnote-523020474 +Ref: Library<15>-Footnote-533020531 +Ref: Library<15>-Footnote-543020588 +Ref: Library<15>-Footnote-553020644 +Ref: Library<15>-Footnote-563020701 +Ref: Library<15>-Footnote-573020758 +Ref: Library<15>-Footnote-583020815 +Ref: Library<15>-Footnote-593020871 +Ref: Library<15>-Footnote-603020927 +Ref: Library<15>-Footnote-613020993 +Ref: Library<15>-Footnote-623021059 +Ref: Library<15>-Footnote-633021125 +Ref: Library<15>-Footnote-643021181 +Node: Documentation<11>3021247 +Ref: whatsnew/changelog id1053021360 +Ref: 164e3021360 +Ref: Documentation<11>-Footnote-13021773 +Ref: Documentation<11>-Footnote-23021829 +Ref: Documentation<11>-Footnote-33021885 +Node: Tests<12>3021940 +Ref: whatsnew/changelog id1063022051 +Ref: 164f3022051 +Ref: Tests<12>-Footnote-13023159 +Ref: Tests<12>-Footnote-23023214 +Ref: Tests<12>-Footnote-33023270 +Ref: Tests<12>-Footnote-43023326 +Ref: Tests<12>-Footnote-53023382 +Ref: Tests<12>-Footnote-63023438 +Ref: Tests<12>-Footnote-73023494 +Node: Build<13>3023550 +Ref: whatsnew/changelog id1073023655 +Ref: 16503023655 +Ref: Build<13>-Footnote-13023933 +Ref: Build<13>-Footnote-23023989 +Ref: Build<13>-Footnote-33024045 +Node: Windows<11>3024100 +Ref: whatsnew/changelog id1083024205 +Ref: 16513024205 +Ref: Windows<11>-Footnote-13025665 +Ref: Windows<11>-Footnote-23025721 +Ref: Windows<11>-Footnote-33025777 +Ref: Windows<11>-Footnote-43025832 +Ref: Windows<11>-Footnote-53025888 +Ref: Windows<11>-Footnote-63025943 +Node: C API<13>3025999 +Ref: whatsnew/changelog id1093026086 +Ref: 16533026086 +Ref: C API<13>-Footnote-13029347 +Ref: C API<13>-Footnote-23029403 +Ref: C API<13>-Footnote-33029445 +Ref: C API<13>-Footnote-43029500 +Ref: C API<13>-Footnote-53029556 +Ref: C API<13>-Footnote-63029612 +Ref: C API<13>-Footnote-73029668 +Ref: C API<13>-Footnote-83029724 +Ref: C API<13>-Footnote-93029780 +Ref: C API<13>-Footnote-103029836 +Ref: C API<13>-Footnote-113029893 +Ref: C API<13>-Footnote-123029950 +Ref: C API<13>-Footnote-133030007 +Ref: C API<13>-Footnote-143030064 +Ref: C API<13>-Footnote-153030107 +Ref: C API<13>-Footnote-163030164 +Ref: C API<13>-Footnote-173030221 +Ref: C API<13>-Footnote-183030277 +Ref: C API<13>-Footnote-193030334 +Node: Python 3 13 0 alpha 53030391 +Ref: whatsnew/changelog python-3-13-0-alpha-53030518 +Ref: 16553030518 +Node: Security<10>3030899 +Ref: whatsnew/changelog id1103030999 +Ref: 16563030999 +Ref: Security<10>-Footnote-13031812 +Ref: Security<10>-Footnote-23031868 +Ref: Security<10>-Footnote-33031924 +Node: Core and Builtins<17>3031980 +Ref: whatsnew/changelog id1113032100 +Ref: 16573032100 +Ref: Core and Builtins<17>-Footnote-13034721 +Ref: Core and Builtins<17>-Footnote-23034777 +Ref: Core and Builtins<17>-Footnote-33034833 +Ref: Core and Builtins<17>-Footnote-43034875 +Ref: Core and Builtins<17>-Footnote-53034931 +Ref: Core and Builtins<17>-Footnote-63034987 +Ref: Core and Builtins<17>-Footnote-73035043 +Ref: Core and Builtins<17>-Footnote-83035099 +Ref: Core and Builtins<17>-Footnote-93035155 +Ref: Core and Builtins<17>-Footnote-103035211 +Ref: Core and Builtins<17>-Footnote-113035268 +Ref: Core and Builtins<17>-Footnote-123035325 +Ref: Core and Builtins<17>-Footnote-133035382 +Ref: Core and Builtins<17>-Footnote-143035439 +Ref: Core and Builtins<17>-Footnote-153035496 +Ref: Core and Builtins<17>-Footnote-163035553 +Ref: Core and Builtins<17>-Footnote-173035610 +Ref: Core and Builtins<17>-Footnote-183035667 +Node: Library<16>3035723 +Ref: whatsnew/changelog id1123035848 +Ref: 16583035848 +Ref: Library<16>-Footnote-13047638 +Ref: Library<16>-Footnote-23047694 +Ref: Library<16>-Footnote-33047750 +Ref: Library<16>-Footnote-43047806 +Ref: Library<16>-Footnote-53047862 +Ref: Library<16>-Footnote-63047904 +Ref: Library<16>-Footnote-73047960 +Ref: Library<16>-Footnote-83048016 +Ref: Library<16>-Footnote-93048072 +Ref: Library<16>-Footnote-103048127 +Ref: Library<16>-Footnote-113048183 +Ref: Library<16>-Footnote-123048239 +Ref: Library<16>-Footnote-133048295 +Ref: Library<16>-Footnote-143048351 +Ref: Library<16>-Footnote-153048408 +Ref: Library<16>-Footnote-163048465 +Ref: Library<16>-Footnote-173048521 +Ref: Library<16>-Footnote-183048577 +Ref: Library<16>-Footnote-193048634 +Ref: Library<16>-Footnote-203048690 +Ref: Library<16>-Footnote-213048747 +Ref: Library<16>-Footnote-223048804 +Ref: Library<16>-Footnote-233048861 +Ref: Library<16>-Footnote-243048918 +Ref: Library<16>-Footnote-253048974 +Ref: Library<16>-Footnote-263049030 +Ref: Library<16>-Footnote-273049087 +Ref: Library<16>-Footnote-283049144 +Ref: Library<16>-Footnote-293049201 +Ref: Library<16>-Footnote-303049258 +Ref: Library<16>-Footnote-313049315 +Ref: Library<16>-Footnote-323049372 +Ref: Library<16>-Footnote-333049429 +Ref: Library<16>-Footnote-343049486 +Ref: Library<16>-Footnote-353049543 +Ref: Library<16>-Footnote-363049600 +Ref: Library<16>-Footnote-373049643 +Ref: Library<16>-Footnote-383049700 +Ref: Library<16>-Footnote-393049757 +Ref: Library<16>-Footnote-403049814 +Ref: Library<16>-Footnote-413049871 +Ref: Library<16>-Footnote-423049928 +Ref: Library<16>-Footnote-433049985 +Ref: Library<16>-Footnote-443050042 +Ref: Library<16>-Footnote-453050099 +Ref: Library<16>-Footnote-463050156 +Ref: Library<16>-Footnote-473050213 +Ref: Library<16>-Footnote-483050269 +Ref: Library<16>-Footnote-493050326 +Ref: Library<16>-Footnote-503050383 +Ref: Library<16>-Footnote-513050439 +Ref: Library<16>-Footnote-523050495 +Ref: Library<16>-Footnote-533050552 +Ref: Library<16>-Footnote-543050608 +Ref: Library<16>-Footnote-553050665 +Ref: Library<16>-Footnote-563050721 +Ref: Library<16>-Footnote-573050778 +Ref: Library<16>-Footnote-583050835 +Ref: Library<16>-Footnote-593050891 +Ref: Library<16>-Footnote-603050947 +Ref: Library<16>-Footnote-613051003 +Ref: Library<16>-Footnote-623051069 +Ref: Library<16>-Footnote-633051135 +Ref: Library<16>-Footnote-643051201 +Ref: Library<16>-Footnote-653051267 +Ref: Library<16>-Footnote-663051333 +Ref: Library<16>-Footnote-673051399 +Node: Documentation<12>3051465 +Ref: whatsnew/changelog id1133051578 +Ref: 16613051578 +Ref: Documentation<12>-Footnote-13051834 +Ref: Documentation<12>-Footnote-23051890 +Ref: Documentation<12>-Footnote-33051946 +Node: Tests<13>3052002 +Ref: whatsnew/changelog id1143052113 +Ref: 16623052113 +Ref: Tests<13>-Footnote-13053308 +Ref: Tests<13>-Footnote-23053363 +Ref: Tests<13>-Footnote-33053418 +Ref: Tests<13>-Footnote-43053474 +Ref: Tests<13>-Footnote-53053530 +Ref: Tests<13>-Footnote-63053586 +Ref: Tests<13>-Footnote-73053642 +Ref: Tests<13>-Footnote-83053698 +Ref: Tests<13>-Footnote-93053754 +Node: Build<14>3053810 +Ref: whatsnew/changelog id1153053915 +Ref: 16633053915 +Ref: Build<14>-Footnote-13054825 +Ref: Build<14>-Footnote-23054881 +Ref: Build<14>-Footnote-33054936 +Ref: Build<14>-Footnote-43054992 +Ref: Build<14>-Footnote-53055047 +Ref: Build<14>-Footnote-63055103 +Ref: Build<14>-Footnote-73055159 +Ref: Build<14>-Footnote-83055215 +Ref: Build<14>-Footnote-93055271 +Node: Windows<12>3055327 +Ref: whatsnew/changelog id1163055431 +Ref: 16643055431 +Ref: Windows<12>-Footnote-13056523 +Ref: Windows<12>-Footnote-23056579 +Ref: Windows<12>-Footnote-33056635 +Ref: Windows<12>-Footnote-43056691 +Node: macOS<8>3056747 +Ref: whatsnew/changelog id1173056850 +Ref: 16653056850 +Ref: macOS<8>-Footnote-13056980 +Node: IDLE<11>3057036 +Ref: whatsnew/changelog id1183057142 +Ref: 16663057142 +Ref: IDLE<11>-Footnote-13057324 +Node: Tools/Demos<6>3057379 +Ref: whatsnew/changelog id1193057486 +Ref: 16673057486 +Ref: Tools/Demos<6>-Footnote-13057729 +Ref: Tools/Demos<6>-Footnote-23057785 +Node: C API<14>3057850 +Ref: whatsnew/changelog id1203057940 +Ref: 16683057940 +Ref: C API<14>-Footnote-13058511 +Ref: C API<14>-Footnote-23058567 +Node: Python 3 13 0 alpha 43058623 +Ref: whatsnew/changelog python-3-13-0-alpha-43058750 +Ref: 166d3058750 +Node: Security<11>3059131 +Ref: whatsnew/changelog id1213059231 +Ref: 166e3059231 +Ref: Security<11>-Footnote-13059492 +Ref: Security<11>-Footnote-23059548 +Node: Core and Builtins<18>3059604 +Ref: whatsnew/changelog id1223059724 +Ref: 166f3059724 +Ref: Core and Builtins<18>-Footnote-13065034 +Ref: Core and Builtins<18>-Footnote-23065090 +Ref: Core and Builtins<18>-Footnote-33065146 +Ref: Core and Builtins<18>-Footnote-43065202 +Ref: Core and Builtins<18>-Footnote-53065258 +Ref: Core and Builtins<18>-Footnote-63065314 +Ref: Core and Builtins<18>-Footnote-73065370 +Ref: Core and Builtins<18>-Footnote-83065426 +Ref: Core and Builtins<18>-Footnote-93065482 +Ref: Core and Builtins<18>-Footnote-103065538 +Ref: Core and Builtins<18>-Footnote-113065594 +Ref: Core and Builtins<18>-Footnote-123065651 +Ref: Core and Builtins<18>-Footnote-133065708 +Ref: Core and Builtins<18>-Footnote-143065765 +Ref: Core and Builtins<18>-Footnote-153065822 +Ref: Core and Builtins<18>-Footnote-163065879 +Ref: Core and Builtins<18>-Footnote-173065936 +Ref: Core and Builtins<18>-Footnote-183065993 +Ref: Core and Builtins<18>-Footnote-193066050 +Ref: Core and Builtins<18>-Footnote-203066107 +Ref: Core and Builtins<18>-Footnote-213066164 +Ref: Core and Builtins<18>-Footnote-223066221 +Ref: Core and Builtins<18>-Footnote-233066278 +Ref: Core and Builtins<18>-Footnote-243066335 +Ref: Core and Builtins<18>-Footnote-253066392 +Ref: Core and Builtins<18>-Footnote-263066449 +Ref: Core and Builtins<18>-Footnote-273066506 +Ref: Core and Builtins<18>-Footnote-283066569 +Ref: Core and Builtins<18>-Footnote-293066626 +Ref: Core and Builtins<18>-Footnote-303066682 +Node: Library<17>3066739 +Ref: whatsnew/changelog id1233066864 +Ref: 16743066864 +Ref: Library<17>-Footnote-13080845 +Ref: Library<17>-Footnote-23080901 +Ref: Library<17>-Footnote-33080957 +Ref: Library<17>-Footnote-43081013 +Ref: Library<17>-Footnote-53081069 +Ref: Library<17>-Footnote-63081125 +Ref: Library<17>-Footnote-73081181 +Ref: Library<17>-Footnote-83081237 +Ref: Library<17>-Footnote-93081292 +Ref: Library<17>-Footnote-103081347 +Ref: Library<17>-Footnote-113081404 +Ref: Library<17>-Footnote-123081460 +Ref: Library<17>-Footnote-133081517 +Ref: Library<17>-Footnote-143081573 +Ref: Library<17>-Footnote-153081630 +Ref: Library<17>-Footnote-163081687 +Ref: Library<17>-Footnote-173081744 +Ref: Library<17>-Footnote-183081801 +Ref: Library<17>-Footnote-193081858 +Ref: Library<17>-Footnote-203081914 +Ref: Library<17>-Footnote-213081971 +Ref: Library<17>-Footnote-223082028 +Ref: Library<17>-Footnote-233082084 +Ref: Library<17>-Footnote-243082141 +Ref: Library<17>-Footnote-253082198 +Ref: Library<17>-Footnote-263082254 +Ref: Library<17>-Footnote-273082310 +Ref: Library<17>-Footnote-283082366 +Ref: Library<17>-Footnote-293082423 +Ref: Library<17>-Footnote-303082479 +Ref: Library<17>-Footnote-313082536 +Ref: Library<17>-Footnote-323082593 +Ref: Library<17>-Footnote-333082650 +Ref: Library<17>-Footnote-343082707 +Ref: Library<17>-Footnote-353082764 +Ref: Library<17>-Footnote-363082821 +Ref: Library<17>-Footnote-373082877 +Ref: Library<17>-Footnote-383082934 +Ref: Library<17>-Footnote-393082991 +Ref: Library<17>-Footnote-403083048 +Ref: Library<17>-Footnote-413083105 +Ref: Library<17>-Footnote-423083162 +Ref: Library<17>-Footnote-433083206 +Ref: Library<17>-Footnote-443083263 +Ref: Library<17>-Footnote-453083320 +Ref: Library<17>-Footnote-463083377 +Ref: Library<17>-Footnote-473083434 +Ref: Library<17>-Footnote-483083490 +Ref: Library<17>-Footnote-493083547 +Ref: Library<17>-Footnote-503083604 +Ref: Library<17>-Footnote-513083660 +Ref: Library<17>-Footnote-523083717 +Ref: Library<17>-Footnote-533083774 +Ref: Library<17>-Footnote-543083830 +Ref: Library<17>-Footnote-553083887 +Ref: Library<17>-Footnote-563083944 +Ref: Library<17>-Footnote-573084001 +Ref: Library<17>-Footnote-583084057 +Ref: Library<17>-Footnote-593084114 +Ref: Library<17>-Footnote-603084170 +Ref: Library<17>-Footnote-613084227 +Ref: Library<17>-Footnote-623084284 +Ref: Library<17>-Footnote-633084341 +Ref: Library<17>-Footnote-643084397 +Ref: Library<17>-Footnote-653084453 +Ref: Library<17>-Footnote-663084510 +Ref: Library<17>-Footnote-673084567 +Ref: Library<17>-Footnote-683084623 +Ref: Library<17>-Footnote-693084679 +Ref: Library<17>-Footnote-703084736 +Ref: Library<17>-Footnote-713084793 +Ref: Library<17>-Footnote-723084850 +Ref: Library<17>-Footnote-733084906 +Ref: Library<17>-Footnote-743084963 +Ref: Library<17>-Footnote-753085019 +Ref: Library<17>-Footnote-763085076 +Ref: Library<17>-Footnote-773085132 +Node: Documentation<13>3085198 +Ref: whatsnew/changelog id1243085311 +Ref: 16863085311 +Ref: Documentation<13>-Footnote-13085882 +Ref: Documentation<13>-Footnote-23085938 +Node: Tests<14>3085994 +Ref: whatsnew/changelog id1253086105 +Ref: 16873086105 +Ref: Tests<14>-Footnote-13086497 +Ref: Tests<14>-Footnote-23086553 +Node: Build<15>3086609 +Ref: whatsnew/changelog id1263086714 +Ref: 16883086714 +Ref: Build<15>-Footnote-13087252 +Ref: Build<15>-Footnote-23087308 +Ref: Build<15>-Footnote-33087364 +Ref: Build<15>-Footnote-43087420 +Node: Windows<13>3087476 +Ref: whatsnew/changelog id1273087580 +Ref: 16893087580 +Ref: Windows<13>-Footnote-13088333 +Ref: Windows<13>-Footnote-23088389 +Ref: Windows<13>-Footnote-33088445 +Ref: Windows<13>-Footnote-43088501 +Ref: Windows<13>-Footnote-53088557 +Ref: Windows<13>-Footnote-63088613 +Ref: Windows<13>-Footnote-73088669 +Node: macOS<9>3088724 +Ref: whatsnew/changelog id1283088827 +Ref: 168a3088827 +Ref: macOS<9>-Footnote-13089366 +Ref: macOS<9>-Footnote-23089422 +Ref: macOS<9>-Footnote-33089478 +Ref: macOS<9>-Footnote-43089534 +Node: IDLE<12>3089589 +Ref: whatsnew/changelog id1293089695 +Ref: 168c3089695 +Ref: IDLE<12>-Footnote-13090030 +Ref: IDLE<12>-Footnote-23090085 +Node: Tools/Demos<7>3090141 +Ref: whatsnew/changelog id1303090248 +Ref: 168d3090248 +Ref: Tools/Demos<7>-Footnote-13090861 +Ref: Tools/Demos<7>-Footnote-23090917 +Ref: Tools/Demos<7>-Footnote-33090973 +Node: C API<15>3091029 +Ref: whatsnew/changelog id1313091119 +Ref: 168f3091119 +Ref: C API<15>-Footnote-13093063 +Ref: C API<15>-Footnote-23093119 +Ref: C API<15>-Footnote-33093175 +Ref: C API<15>-Footnote-43093231 +Ref: C API<15>-Footnote-53093287 +Ref: C API<15>-Footnote-63093343 +Ref: C API<15>-Footnote-73093399 +Node: Python 3 13 0 alpha 33093455 +Ref: whatsnew/changelog python-3-13-0-alpha-33093582 +Ref: 16923093582 +Node: Security<12>3093933 +Ref: whatsnew/changelog id1323094033 +Ref: 16933094033 +Ref: Security<12>-Footnote-13094322 +Ref: Security<12>-Footnote-23094378 +Node: Core and Builtins<19>3094434 +Ref: whatsnew/changelog id1333094554 +Ref: 16943094554 +Ref: Core and Builtins<19>-Footnote-13101949 +Ref: Core and Builtins<19>-Footnote-23102005 +Ref: Core and Builtins<19>-Footnote-33102061 +Ref: Core and Builtins<19>-Footnote-43102117 +Ref: Core and Builtins<19>-Footnote-53102173 +Ref: Core and Builtins<19>-Footnote-63102228 +Ref: Core and Builtins<19>-Footnote-73102270 +Ref: Core and Builtins<19>-Footnote-83102326 +Ref: Core and Builtins<19>-Footnote-93102382 +Ref: Core and Builtins<19>-Footnote-103102438 +Ref: Core and Builtins<19>-Footnote-113102495 +Ref: Core and Builtins<19>-Footnote-123102551 +Ref: Core and Builtins<19>-Footnote-133102608 +Ref: Core and Builtins<19>-Footnote-143102665 +Ref: Core and Builtins<19>-Footnote-153102722 +Ref: Core and Builtins<19>-Footnote-163102779 +Ref: Core and Builtins<19>-Footnote-173102836 +Ref: Core and Builtins<19>-Footnote-183102893 +Ref: Core and Builtins<19>-Footnote-193102950 +Ref: Core and Builtins<19>-Footnote-203103007 +Ref: Core and Builtins<19>-Footnote-213103064 +Ref: Core and Builtins<19>-Footnote-223103121 +Ref: Core and Builtins<19>-Footnote-233103178 +Ref: Core and Builtins<19>-Footnote-243103235 +Ref: Core and Builtins<19>-Footnote-253103291 +Ref: Core and Builtins<19>-Footnote-263103348 +Ref: Core and Builtins<19>-Footnote-273103405 +Ref: Core and Builtins<19>-Footnote-283103461 +Ref: Core and Builtins<19>-Footnote-293103518 +Ref: Core and Builtins<19>-Footnote-303103575 +Ref: Core and Builtins<19>-Footnote-313103632 +Ref: Core and Builtins<19>-Footnote-323103689 +Ref: Core and Builtins<19>-Footnote-333103746 +Ref: Core and Builtins<19>-Footnote-343103802 +Ref: Core and Builtins<19>-Footnote-353103859 +Ref: Core and Builtins<19>-Footnote-363103916 +Ref: Core and Builtins<19>-Footnote-373103973 +Ref: Core and Builtins<19>-Footnote-383104030 +Ref: Core and Builtins<19>-Footnote-393104086 +Ref: Core and Builtins<19>-Footnote-403104143 +Ref: Core and Builtins<19>-Footnote-413104200 +Ref: Core and Builtins<19>-Footnote-423104257 +Ref: Core and Builtins<19>-Footnote-433104313 +Ref: Core and Builtins<19>-Footnote-443104379 +Ref: Core and Builtins<19>-Footnote-453104445 +Ref: Core and Builtins<19>-Footnote-463104488 +Node: Library<18>3104554 +Ref: whatsnew/changelog id1343104679 +Ref: 16993104679 +Ref: Library<18>-Footnote-13129910 +Ref: Library<18>-Footnote-23129966 +Ref: Library<18>-Footnote-33130022 +Ref: Library<18>-Footnote-43130078 +Ref: Library<18>-Footnote-53130134 +Ref: Library<18>-Footnote-63130190 +Ref: Library<18>-Footnote-73130246 +Ref: Library<18>-Footnote-83130302 +Ref: Library<18>-Footnote-93130358 +Ref: Library<18>-Footnote-103130414 +Ref: Library<18>-Footnote-113130470 +Ref: Library<18>-Footnote-123130527 +Ref: Library<18>-Footnote-133130584 +Ref: Library<18>-Footnote-143130641 +Ref: Library<18>-Footnote-153130698 +Ref: Library<18>-Footnote-163130755 +Ref: Library<18>-Footnote-173130812 +Ref: Library<18>-Footnote-183130869 +Ref: Library<18>-Footnote-193130926 +Ref: Library<18>-Footnote-203130983 +Ref: Library<18>-Footnote-213131039 +Ref: Library<18>-Footnote-223131096 +Ref: Library<18>-Footnote-233131152 +Ref: Library<18>-Footnote-243131209 +Ref: Library<18>-Footnote-253131266 +Ref: Library<18>-Footnote-263131323 +Ref: Library<18>-Footnote-273131380 +Ref: Library<18>-Footnote-283131437 +Ref: Library<18>-Footnote-293131494 +Ref: Library<18>-Footnote-303131551 +Ref: Library<18>-Footnote-313131608 +Ref: Library<18>-Footnote-323131665 +Ref: Library<18>-Footnote-333131721 +Ref: Library<18>-Footnote-343131778 +Ref: Library<18>-Footnote-353131835 +Ref: Library<18>-Footnote-363131892 +Ref: Library<18>-Footnote-373131948 +Ref: Library<18>-Footnote-383132005 +Ref: Library<18>-Footnote-393132062 +Ref: Library<18>-Footnote-403132119 +Ref: Library<18>-Footnote-413132176 +Ref: Library<18>-Footnote-423132233 +Ref: Library<18>-Footnote-433132290 +Ref: Library<18>-Footnote-443132347 +Ref: Library<18>-Footnote-453132404 +Ref: Library<18>-Footnote-463132461 +Ref: Library<18>-Footnote-473132517 +Ref: Library<18>-Footnote-483132574 +Ref: Library<18>-Footnote-493132630 +Ref: Library<18>-Footnote-503132687 +Ref: Library<18>-Footnote-513132744 +Ref: Library<18>-Footnote-523132801 +Ref: Library<18>-Footnote-533132858 +Ref: Library<18>-Footnote-543132915 +Ref: Library<18>-Footnote-553132972 +Ref: Library<18>-Footnote-563133028 +Ref: Library<18>-Footnote-573133085 +Ref: Library<18>-Footnote-583133141 +Ref: Library<18>-Footnote-593133197 +Ref: Library<18>-Footnote-603133253 +Ref: Library<18>-Footnote-613133310 +Ref: Library<18>-Footnote-623133367 +Ref: Library<18>-Footnote-633133423 +Ref: Library<18>-Footnote-643133479 +Ref: Library<18>-Footnote-653133536 +Ref: Library<18>-Footnote-663133593 +Ref: Library<18>-Footnote-673133650 +Ref: Library<18>-Footnote-683133707 +Ref: Library<18>-Footnote-693133764 +Ref: Library<18>-Footnote-703133821 +Ref: Library<18>-Footnote-713133877 +Ref: Library<18>-Footnote-723133934 +Ref: Library<18>-Footnote-733133991 +Ref: Library<18>-Footnote-743134048 +Ref: Library<18>-Footnote-753134105 +Ref: Library<18>-Footnote-763134162 +Ref: Library<18>-Footnote-773134219 +Ref: Library<18>-Footnote-783134275 +Ref: Library<18>-Footnote-793134332 +Ref: Library<18>-Footnote-803134389 +Ref: Library<18>-Footnote-813134446 +Ref: Library<18>-Footnote-823134502 +Ref: Library<18>-Footnote-833134559 +Ref: Library<18>-Footnote-843134616 +Ref: Library<18>-Footnote-853134673 +Ref: Library<18>-Footnote-863134730 +Ref: Library<18>-Footnote-873134786 +Ref: Library<18>-Footnote-883134843 +Ref: Library<18>-Footnote-893134899 +Ref: Library<18>-Footnote-903134956 +Ref: Library<18>-Footnote-913135013 +Ref: Library<18>-Footnote-923135070 +Ref: Library<18>-Footnote-933135127 +Ref: Library<18>-Footnote-943135184 +Ref: Library<18>-Footnote-953135240 +Ref: Library<18>-Footnote-963135297 +Ref: Library<18>-Footnote-973135353 +Ref: Library<18>-Footnote-983135410 +Ref: Library<18>-Footnote-993135466 +Ref: Library<18>-Footnote-1003135522 +Ref: Library<18>-Footnote-1013135579 +Ref: Library<18>-Footnote-1023135637 +Ref: Library<18>-Footnote-1033135695 +Ref: Library<18>-Footnote-1043135753 +Ref: Library<18>-Footnote-1053135811 +Ref: Library<18>-Footnote-1063135868 +Ref: Library<18>-Footnote-1073135925 +Ref: Library<18>-Footnote-1083135983 +Ref: Library<18>-Footnote-1093136041 +Ref: Library<18>-Footnote-1103136099 +Ref: Library<18>-Footnote-1113136156 +Ref: Library<18>-Footnote-1123136214 +Ref: Library<18>-Footnote-1133136272 +Ref: Library<18>-Footnote-1143136329 +Ref: Library<18>-Footnote-1153136387 +Ref: Library<18>-Footnote-1163136431 +Ref: Library<18>-Footnote-1173136489 +Ref: Library<18>-Footnote-1183136546 +Ref: Library<18>-Footnote-1193136603 +Ref: Library<18>-Footnote-1203136660 +Ref: Library<18>-Footnote-1213136727 +Ref: Library<18>-Footnote-1223136794 +Ref: Library<18>-Footnote-1233136861 +Ref: Library<18>-Footnote-1243136928 +Ref: Library<18>-Footnote-1253136995 +Ref: Library<18>-Footnote-1263137062 +Ref: Library<18>-Footnote-1273137129 +Ref: Library<18>-Footnote-1283137196 +Ref: Library<18>-Footnote-1293137263 +Ref: Library<18>-Footnote-1303137330 +Ref: Library<18>-Footnote-1313137397 +Ref: Library<18>-Footnote-1323137464 +Ref: Library<18>-Footnote-1333137531 +Ref: Library<18>-Footnote-1343137598 +Node: Documentation<14>3137665 +Ref: whatsnew/changelog id1353137778 +Ref: 16b73137778 +Ref: Documentation<14>-Footnote-13138346 +Ref: Documentation<14>-Footnote-23138402 +Ref: Documentation<14>-Footnote-33138458 +Ref: Documentation<14>-Footnote-43138513 +Node: Tests<15>3138571 +Ref: whatsnew/changelog id1363138682 +Ref: 16b83138682 +Ref: Tests<15>-Footnote-13140627 +Ref: Tests<15>-Footnote-23140683 +Ref: Tests<15>-Footnote-33140739 +Ref: Tests<15>-Footnote-43140795 +Ref: Tests<15>-Footnote-53140850 +Ref: Tests<15>-Footnote-63140906 +Ref: Tests<15>-Footnote-73140962 +Ref: Tests<15>-Footnote-83141018 +Ref: Tests<15>-Footnote-93141074 +Ref: Tests<15>-Footnote-103141130 +Node: Build<16>3141196 +Ref: whatsnew/changelog id1373141301 +Ref: 16b93141301 +Ref: Build<16>-Footnote-13142545 +Ref: Build<16>-Footnote-23142601 +Ref: Build<16>-Footnote-33142657 +Ref: Build<16>-Footnote-43142713 +Ref: Build<16>-Footnote-53142769 +Ref: Build<16>-Footnote-63142825 +Ref: Build<16>-Footnote-73142881 +Ref: Build<16>-Footnote-83142946 +Node: Windows<14>3143011 +Ref: whatsnew/changelog id1383143116 +Ref: 16ba3143116 +Ref: Windows<14>-Footnote-13144957 +Ref: Windows<14>-Footnote-23145013 +Ref: Windows<14>-Footnote-33145069 +Ref: Windows<14>-Footnote-43145125 +Ref: Windows<14>-Footnote-53145181 +Ref: Windows<14>-Footnote-63145236 +Ref: Windows<14>-Footnote-73145291 +Ref: Windows<14>-Footnote-83145347 +Ref: Windows<14>-Footnote-93145403 +Ref: Windows<14>-Footnote-103145458 +Ref: Windows<14>-Footnote-113145514 +Node: macOS<10>3145580 +Ref: whatsnew/changelog id1393145684 +Ref: 16bb3145684 +Ref: macOS<10>-Footnote-13148094 +Ref: macOS<10>-Footnote-23148150 +Ref: macOS<10>-Footnote-33148206 +Ref: macOS<10>-Footnote-43148262 +Ref: macOS<10>-Footnote-53148317 +Ref: macOS<10>-Footnote-63148372 +Ref: macOS<10>-Footnote-73148427 +Ref: macOS<10>-Footnote-83148483 +Ref: macOS<10>-Footnote-93148539 +Ref: macOS<10>-Footnote-103148595 +Ref: macOS<10>-Footnote-113148652 +Ref: macOS<10>-Footnote-123148709 +Node: IDLE<13>3148766 +Ref: whatsnew/changelog id1403148868 +Ref: 16bc3148868 +Ref: IDLE<13>-Footnote-13149452 +Ref: IDLE<13>-Footnote-23149507 +Ref: IDLE<13>-Footnote-33149563 +Ref: IDLE<13>-Footnote-43149619 +Ref: IDLE<13>-Footnote-53149675 +Ref: IDLE<13>-Footnote-63149731 +Node: C API<16>3149796 +Ref: whatsnew/changelog id1413149880 +Ref: 16bd3149880 +Ref: C API<16>-Footnote-13150611 +Ref: C API<16>-Footnote-23150667 +Ref: C API<16>-Footnote-33150723 +Ref: C API<16>-Footnote-43150779 +Node: Python 3 13 0 alpha 23150834 +Ref: whatsnew/changelog python-3-13-0-alpha-23150961 +Ref: 16be3150961 +Node: Core and Builtins<20>3151281 +Ref: whatsnew/changelog id1423151380 +Ref: 16bf3151380 +Ref: Core and Builtins<20>-Footnote-13159217 +Ref: Core and Builtins<20>-Footnote-23159273 +Ref: Core and Builtins<20>-Footnote-33159329 +Ref: Core and Builtins<20>-Footnote-43159385 +Ref: Core and Builtins<20>-Footnote-53159441 +Ref: Core and Builtins<20>-Footnote-63159497 +Ref: Core and Builtins<20>-Footnote-73159553 +Ref: Core and Builtins<20>-Footnote-83159609 +Ref: Core and Builtins<20>-Footnote-93159664 +Ref: Core and Builtins<20>-Footnote-103159719 +Ref: Core and Builtins<20>-Footnote-113159775 +Ref: Core and Builtins<20>-Footnote-123159832 +Ref: Core and Builtins<20>-Footnote-133159889 +Ref: Core and Builtins<20>-Footnote-143159946 +Ref: Core and Builtins<20>-Footnote-153160003 +Ref: Core and Builtins<20>-Footnote-163160060 +Ref: Core and Builtins<20>-Footnote-173160117 +Ref: Core and Builtins<20>-Footnote-183160174 +Ref: Core and Builtins<20>-Footnote-193160231 +Ref: Core and Builtins<20>-Footnote-203160288 +Ref: Core and Builtins<20>-Footnote-213160345 +Ref: Core and Builtins<20>-Footnote-223160402 +Ref: Core and Builtins<20>-Footnote-233160459 +Ref: Core and Builtins<20>-Footnote-243160516 +Ref: Core and Builtins<20>-Footnote-253160573 +Ref: Core and Builtins<20>-Footnote-263160630 +Ref: Core and Builtins<20>-Footnote-273160687 +Ref: Core and Builtins<20>-Footnote-283160744 +Ref: Core and Builtins<20>-Footnote-293160801 +Ref: Core and Builtins<20>-Footnote-303160857 +Ref: Core and Builtins<20>-Footnote-313160913 +Ref: Core and Builtins<20>-Footnote-323160970 +Ref: Core and Builtins<20>-Footnote-333161027 +Ref: Core and Builtins<20>-Footnote-343161084 +Ref: Core and Builtins<20>-Footnote-353161141 +Ref: Core and Builtins<20>-Footnote-363161198 +Ref: Core and Builtins<20>-Footnote-373161255 +Ref: Core and Builtins<20>-Footnote-383161312 +Ref: Core and Builtins<20>-Footnote-393161369 +Ref: Core and Builtins<20>-Footnote-403161426 +Ref: Core and Builtins<20>-Footnote-413161483 +Ref: Core and Builtins<20>-Footnote-423161540 +Ref: Core and Builtins<20>-Footnote-433161597 +Ref: Core and Builtins<20>-Footnote-443161653 +Ref: Core and Builtins<20>-Footnote-453161719 +Ref: Core and Builtins<20>-Footnote-463161776 +Ref: Core and Builtins<20>-Footnote-473161842 +Ref: Core and Builtins<20>-Footnote-483161899 +Ref: Core and Builtins<20>-Footnote-493161956 +Ref: Core and Builtins<20>-Footnote-503162013 +Node: Library<19>3162079 +Ref: whatsnew/changelog id1433162196 +Ref: 16c23162196 +Ref: Library<19>-Footnote-13172769 +Ref: Library<19>-Footnote-23172825 +Ref: Library<19>-Footnote-33172881 +Ref: Library<19>-Footnote-43172937 +Ref: Library<19>-Footnote-53172993 +Ref: Library<19>-Footnote-63173049 +Ref: Library<19>-Footnote-73173105 +Ref: Library<19>-Footnote-83173161 +Ref: Library<19>-Footnote-93173217 +Ref: Library<19>-Footnote-103173273 +Ref: Library<19>-Footnote-113173330 +Ref: Library<19>-Footnote-123173386 +Ref: Library<19>-Footnote-133173443 +Ref: Library<19>-Footnote-143173500 +Ref: Library<19>-Footnote-153173557 +Ref: Library<19>-Footnote-163173614 +Ref: Library<19>-Footnote-173173671 +Ref: Library<19>-Footnote-183173728 +Ref: Library<19>-Footnote-193173785 +Ref: Library<19>-Footnote-203173841 +Ref: Library<19>-Footnote-213173898 +Ref: Library<19>-Footnote-223173955 +Ref: Library<19>-Footnote-233174011 +Ref: Library<19>-Footnote-243174068 +Ref: Library<19>-Footnote-253174124 +Ref: Library<19>-Footnote-263174181 +Ref: Library<19>-Footnote-273174238 +Ref: Library<19>-Footnote-283174295 +Ref: Library<19>-Footnote-293174352 +Ref: Library<19>-Footnote-303174409 +Ref: Library<19>-Footnote-313174466 +Ref: Library<19>-Footnote-323174523 +Ref: Library<19>-Footnote-333174580 +Ref: Library<19>-Footnote-343174637 +Ref: Library<19>-Footnote-353174694 +Ref: Library<19>-Footnote-363174751 +Ref: Library<19>-Footnote-373174808 +Ref: Library<19>-Footnote-383174865 +Ref: Library<19>-Footnote-393174921 +Ref: Library<19>-Footnote-403174977 +Ref: Library<19>-Footnote-413175034 +Ref: Library<19>-Footnote-423175091 +Ref: Library<19>-Footnote-433175148 +Ref: Library<19>-Footnote-443175204 +Ref: Library<19>-Footnote-453175260 +Ref: Library<19>-Footnote-463175317 +Ref: Library<19>-Footnote-473175374 +Ref: Library<19>-Footnote-483175431 +Ref: Library<19>-Footnote-493175488 +Ref: Library<19>-Footnote-503175544 +Ref: Library<19>-Footnote-513175601 +Ref: Library<19>-Footnote-523175658 +Ref: Library<19>-Footnote-533175715 +Ref: Library<19>-Footnote-543175771 +Ref: Library<19>-Footnote-553175827 +Ref: Library<19>-Footnote-563175883 +Ref: Library<19>-Footnote-573175940 +Ref: Library<19>-Footnote-583175997 +Ref: Library<19>-Footnote-593176053 +Ref: Library<19>-Footnote-603176109 +Ref: Library<19>-Footnote-613176194 +Ref: Library<19>-Footnote-623176250 +Node: Tests<16>3176306 +Ref: whatsnew/changelog id1443176411 +Ref: 16d63176411 +Ref: Tests<16>-Footnote-13177997 +Ref: Tests<16>-Footnote-23178053 +Ref: Tests<16>-Footnote-33178109 +Ref: Tests<16>-Footnote-43178165 +Ref: Tests<16>-Footnote-53178221 +Ref: Tests<16>-Footnote-63178277 +Ref: Tests<16>-Footnote-73178333 +Ref: Tests<16>-Footnote-83178389 +Node: Build<17>3178445 +Ref: whatsnew/changelog id1453178550 +Ref: 16d73178550 +Ref: Build<17>-Footnote-13179536 +Ref: Build<17>-Footnote-23179591 +Ref: Build<17>-Footnote-33179647 +Ref: Build<17>-Footnote-43179697 +Ref: Build<17>-Footnote-53179753 +Ref: Build<17>-Footnote-63179809 +Node: Windows<15>3179864 +Ref: whatsnew/changelog id1463179969 +Ref: 16d83179969 +Ref: Windows<15>-Footnote-13180423 +Ref: Windows<15>-Footnote-23180479 +Ref: Windows<15>-Footnote-33180535 +Node: macOS<11>3180591 +Ref: whatsnew/changelog id1473180695 +Ref: 16da3180695 +Ref: macOS<11>-Footnote-13181626 +Ref: macOS<11>-Footnote-23181681 +Ref: macOS<11>-Footnote-33181737 +Ref: macOS<11>-Footnote-43181793 +Ref: macOS<11>-Footnote-53181848 +Node: IDLE<14>3181903 +Ref: whatsnew/changelog id1483182010 +Ref: 16db3182010 +Ref: IDLE<14>-Footnote-13182348 +Node: Tools/Demos<8>3182413 +Ref: whatsnew/changelog id1493182520 +Ref: 16dc3182520 +Ref: Tools/Demos<8>-Footnote-13182877 +Node: C API<17>3182933 +Ref: whatsnew/changelog id1503183023 +Ref: 16dd3183023 +Ref: C API<17>-Footnote-13188399 +Ref: C API<17>-Footnote-23188455 +Ref: C API<17>-Footnote-33188511 +Ref: C API<17>-Footnote-43188567 +Ref: C API<17>-Footnote-53188623 +Ref: C API<17>-Footnote-63188679 +Ref: C API<17>-Footnote-73188735 +Ref: C API<17>-Footnote-83188791 +Ref: C API<17>-Footnote-93188847 +Ref: C API<17>-Footnote-103188903 +Ref: C API<17>-Footnote-113188960 +Ref: C API<17>-Footnote-123189003 +Ref: C API<17>-Footnote-133189060 +Ref: C API<17>-Footnote-143189117 +Ref: C API<17>-Footnote-153189174 +Ref: C API<17>-Footnote-163189231 +Ref: C API<17>-Footnote-173189288 +Ref: C API<17>-Footnote-183189344 +Ref: C API<17>-Footnote-193189400 +Ref: C API<17>-Footnote-203189457 +Node: Python 3 13 0 alpha 13189513 +Ref: whatsnew/changelog python-3-13-0-alpha-13189639 +Ref: 16de3189639 +Node: Security<13>3190021 +Ref: whatsnew/changelog id1513190121 +Ref: 16df3190121 +Ref: Security<13>-Footnote-13191389 +Ref: Security<13>-Footnote-23191445 +Ref: Security<13>-Footnote-33191501 +Ref: Security<13>-Footnote-43191557 +Ref: Security<13>-Footnote-53191613 +Ref: Security<13>-Footnote-63191669 +Ref: Security<13>-Footnote-73191724 +Node: Core and Builtins<21>3191780 +Ref: whatsnew/changelog id1523191900 +Ref: 16e03191900 +Ref: Core and Builtins<21>-Footnote-13222699 +Ref: Core and Builtins<21>-Footnote-23222755 +Ref: Core and Builtins<21>-Footnote-33222811 +Ref: Core and Builtins<21>-Footnote-43222867 +Ref: Core and Builtins<21>-Footnote-53222923 +Ref: Core and Builtins<21>-Footnote-63222979 +Ref: Core and Builtins<21>-Footnote-73223035 +Ref: Core and Builtins<21>-Footnote-83223091 +Ref: Core and Builtins<21>-Footnote-93223147 +Ref: Core and Builtins<21>-Footnote-103223203 +Ref: Core and Builtins<21>-Footnote-113223260 +Ref: Core and Builtins<21>-Footnote-123223317 +Ref: Core and Builtins<21>-Footnote-133223374 +Ref: Core and Builtins<21>-Footnote-143223431 +Ref: Core and Builtins<21>-Footnote-153223488 +Ref: Core and Builtins<21>-Footnote-163223545 +Ref: Core and Builtins<21>-Footnote-173223602 +Ref: Core and Builtins<21>-Footnote-183223659 +Ref: Core and Builtins<21>-Footnote-193223716 +Ref: Core and Builtins<21>-Footnote-203223773 +Ref: Core and Builtins<21>-Footnote-213223830 +Ref: Core and Builtins<21>-Footnote-223223887 +Ref: Core and Builtins<21>-Footnote-233223944 +Ref: Core and Builtins<21>-Footnote-243224001 +Ref: Core and Builtins<21>-Footnote-253224058 +Ref: Core and Builtins<21>-Footnote-263224115 +Ref: Core and Builtins<21>-Footnote-273224172 +Ref: Core and Builtins<21>-Footnote-283224229 +Ref: Core and Builtins<21>-Footnote-293224286 +Ref: Core and Builtins<21>-Footnote-303224343 +Ref: Core and Builtins<21>-Footnote-313224400 +Ref: Core and Builtins<21>-Footnote-323224457 +Ref: Core and Builtins<21>-Footnote-333224514 +Ref: Core and Builtins<21>-Footnote-343224571 +Ref: Core and Builtins<21>-Footnote-353224628 +Ref: Core and Builtins<21>-Footnote-363224685 +Ref: Core and Builtins<21>-Footnote-373224742 +Ref: Core and Builtins<21>-Footnote-383224799 +Ref: Core and Builtins<21>-Footnote-393224856 +Ref: Core and Builtins<21>-Footnote-403224913 +Ref: Core and Builtins<21>-Footnote-413224970 +Ref: Core and Builtins<21>-Footnote-423225027 +Ref: Core and Builtins<21>-Footnote-433225084 +Ref: Core and Builtins<21>-Footnote-443225141 +Ref: Core and Builtins<21>-Footnote-453225197 +Ref: Core and Builtins<21>-Footnote-463225254 +Ref: Core and Builtins<21>-Footnote-473225311 +Ref: Core and Builtins<21>-Footnote-483225368 +Ref: Core and Builtins<21>-Footnote-493225425 +Ref: Core and Builtins<21>-Footnote-503225482 +Ref: Core and Builtins<21>-Footnote-513225539 +Ref: Core and Builtins<21>-Footnote-523225596 +Ref: Core and Builtins<21>-Footnote-533225653 +Ref: Core and Builtins<21>-Footnote-543225710 +Ref: Core and Builtins<21>-Footnote-553225767 +Ref: Core and Builtins<21>-Footnote-563225824 +Ref: Core and Builtins<21>-Footnote-573225881 +Ref: Core and Builtins<21>-Footnote-583225938 +Ref: Core and Builtins<21>-Footnote-593225995 +Ref: Core and Builtins<21>-Footnote-603226052 +Ref: Core and Builtins<21>-Footnote-613226109 +Ref: Core and Builtins<21>-Footnote-623226166 +Ref: Core and Builtins<21>-Footnote-633226223 +Ref: Core and Builtins<21>-Footnote-643226280 +Ref: Core and Builtins<21>-Footnote-653226336 +Ref: Core and Builtins<21>-Footnote-663226393 +Ref: Core and Builtins<21>-Footnote-673226450 +Ref: Core and Builtins<21>-Footnote-683226506 +Ref: Core and Builtins<21>-Footnote-693226563 +Ref: Core and Builtins<21>-Footnote-703226620 +Ref: Core and Builtins<21>-Footnote-713226677 +Ref: Core and Builtins<21>-Footnote-723226734 +Ref: Core and Builtins<21>-Footnote-733226791 +Ref: Core and Builtins<21>-Footnote-743226847 +Ref: Core and Builtins<21>-Footnote-753226904 +Ref: Core and Builtins<21>-Footnote-763226961 +Ref: Core and Builtins<21>-Footnote-773227018 +Ref: Core and Builtins<21>-Footnote-783227075 +Ref: Core and Builtins<21>-Footnote-793227132 +Ref: Core and Builtins<21>-Footnote-803227189 +Ref: Core and Builtins<21>-Footnote-813227246 +Ref: Core and Builtins<21>-Footnote-823227303 +Ref: Core and Builtins<21>-Footnote-833227360 +Ref: Core and Builtins<21>-Footnote-843227417 +Ref: Core and Builtins<21>-Footnote-853227460 +Ref: Core and Builtins<21>-Footnote-863227517 +Ref: Core and Builtins<21>-Footnote-873227574 +Ref: Core and Builtins<21>-Footnote-883227631 +Ref: Core and Builtins<21>-Footnote-893227687 +Ref: Core and Builtins<21>-Footnote-903227744 +Ref: Core and Builtins<21>-Footnote-913227801 +Ref: Core and Builtins<21>-Footnote-923227858 +Ref: Core and Builtins<21>-Footnote-933227915 +Ref: Core and Builtins<21>-Footnote-943227972 +Ref: Core and Builtins<21>-Footnote-953228029 +Ref: Core and Builtins<21>-Footnote-963228086 +Ref: Core and Builtins<21>-Footnote-973228143 +Ref: Core and Builtins<21>-Footnote-983228200 +Ref: Core and Builtins<21>-Footnote-993228257 +Ref: Core and Builtins<21>-Footnote-1003228314 +Ref: Core and Builtins<21>-Footnote-1013228372 +Ref: Core and Builtins<21>-Footnote-1023228430 +Ref: Core and Builtins<21>-Footnote-1033228488 +Ref: Core and Builtins<21>-Footnote-1043228546 +Ref: Core and Builtins<21>-Footnote-1053228604 +Ref: Core and Builtins<21>-Footnote-1063228662 +Ref: Core and Builtins<21>-Footnote-1073228719 +Ref: Core and Builtins<21>-Footnote-1083228776 +Ref: Core and Builtins<21>-Footnote-1093228834 +Ref: Core and Builtins<21>-Footnote-1103228892 +Ref: Core and Builtins<21>-Footnote-1113228950 +Ref: Core and Builtins<21>-Footnote-1123229008 +Ref: Core and Builtins<21>-Footnote-1133229066 +Ref: Core and Builtins<21>-Footnote-1143229124 +Ref: Core and Builtins<21>-Footnote-1153229182 +Ref: Core and Builtins<21>-Footnote-1163229240 +Ref: Core and Builtins<21>-Footnote-1173229298 +Ref: Core and Builtins<21>-Footnote-1183229356 +Ref: Core and Builtins<21>-Footnote-1193229414 +Ref: Core and Builtins<21>-Footnote-1203229472 +Ref: Core and Builtins<21>-Footnote-1213229529 +Ref: Core and Builtins<21>-Footnote-1223229587 +Ref: Core and Builtins<21>-Footnote-1233229645 +Ref: Core and Builtins<21>-Footnote-1243229702 +Ref: Core and Builtins<21>-Footnote-1253229760 +Ref: Core and Builtins<21>-Footnote-1263229818 +Ref: Core and Builtins<21>-Footnote-1273229876 +Ref: Core and Builtins<21>-Footnote-1283229934 +Ref: Core and Builtins<21>-Footnote-1293229992 +Ref: Core and Builtins<21>-Footnote-1303230050 +Ref: Core and Builtins<21>-Footnote-1313230108 +Ref: Core and Builtins<21>-Footnote-1323230166 +Ref: Core and Builtins<21>-Footnote-1333230224 +Ref: Core and Builtins<21>-Footnote-1343230282 +Ref: Core and Builtins<21>-Footnote-1353230340 +Ref: Core and Builtins<21>-Footnote-1363230398 +Ref: Core and Builtins<21>-Footnote-1373230456 +Ref: Core and Builtins<21>-Footnote-1383230514 +Ref: Core and Builtins<21>-Footnote-1393230572 +Ref: Core and Builtins<21>-Footnote-1403230630 +Ref: Core and Builtins<21>-Footnote-1413230688 +Ref: Core and Builtins<21>-Footnote-1423230746 +Ref: Core and Builtins<21>-Footnote-1433230804 +Ref: Core and Builtins<21>-Footnote-1443230862 +Ref: Core and Builtins<21>-Footnote-1453230919 +Ref: Core and Builtins<21>-Footnote-1463230977 +Ref: Core and Builtins<21>-Footnote-1473231035 +Ref: Core and Builtins<21>-Footnote-1483231092 +Ref: Core and Builtins<21>-Footnote-1493231150 +Ref: Core and Builtins<21>-Footnote-1503231208 +Ref: Core and Builtins<21>-Footnote-1513231266 +Ref: Core and Builtins<21>-Footnote-1523231324 +Ref: Core and Builtins<21>-Footnote-1533231382 +Ref: Core and Builtins<21>-Footnote-1543231440 +Ref: Core and Builtins<21>-Footnote-1553231498 +Ref: Core and Builtins<21>-Footnote-1563231556 +Ref: Core and Builtins<21>-Footnote-1573231614 +Ref: Core and Builtins<21>-Footnote-1583231672 +Ref: Core and Builtins<21>-Footnote-1593231730 +Ref: Core and Builtins<21>-Footnote-1603231788 +Ref: Core and Builtins<21>-Footnote-1613231846 +Ref: Core and Builtins<21>-Footnote-1623231904 +Ref: Core and Builtins<21>-Footnote-1633231962 +Ref: Core and Builtins<21>-Footnote-1643232020 +Ref: Core and Builtins<21>-Footnote-1653232078 +Ref: Core and Builtins<21>-Footnote-1663232136 +Ref: Core and Builtins<21>-Footnote-1673232194 +Ref: Core and Builtins<21>-Footnote-1683232251 +Ref: Core and Builtins<21>-Footnote-1693232308 +Ref: Core and Builtins<21>-Footnote-1703232365 +Ref: Core and Builtins<21>-Footnote-1713232423 +Node: Library<20>3232480 +Ref: whatsnew/changelog id1533232605 +Ref: 16f53232605 +Ref: Library<20>-Footnote-13281018 +Ref: Library<20>-Footnote-23281074 +Ref: Library<20>-Footnote-33281130 +Ref: Library<20>-Footnote-43281186 +Ref: Library<20>-Footnote-53281241 +Ref: Library<20>-Footnote-63281297 +Ref: Library<20>-Footnote-73281353 +Ref: Library<20>-Footnote-83281409 +Ref: Library<20>-Footnote-93281464 +Ref: Library<20>-Footnote-103281520 +Ref: Library<20>-Footnote-113281576 +Ref: Library<20>-Footnote-123281633 +Ref: Library<20>-Footnote-133281690 +Ref: Library<20>-Footnote-143281747 +Ref: Library<20>-Footnote-153281804 +Ref: Library<20>-Footnote-163281861 +Ref: Library<20>-Footnote-173281918 +Ref: Library<20>-Footnote-183281975 +Ref: Library<20>-Footnote-193282032 +Ref: Library<20>-Footnote-203282089 +Ref: Library<20>-Footnote-213282146 +Ref: Library<20>-Footnote-223282203 +Ref: Library<20>-Footnote-233282260 +Ref: Library<20>-Footnote-243282317 +Ref: Library<20>-Footnote-253282360 +Ref: Library<20>-Footnote-263282416 +Ref: Library<20>-Footnote-273282473 +Ref: Library<20>-Footnote-283282530 +Ref: Library<20>-Footnote-293282587 +Ref: Library<20>-Footnote-303282644 +Ref: Library<20>-Footnote-313282701 +Ref: Library<20>-Footnote-323282758 +Ref: Library<20>-Footnote-333282815 +Ref: Library<20>-Footnote-343282872 +Ref: Library<20>-Footnote-353282929 +Ref: Library<20>-Footnote-363282986 +Ref: Library<20>-Footnote-373283043 +Ref: Library<20>-Footnote-383283099 +Ref: Library<20>-Footnote-393283156 +Ref: Library<20>-Footnote-403283213 +Ref: Library<20>-Footnote-413283270 +Ref: Library<20>-Footnote-423283327 +Ref: Library<20>-Footnote-433283384 +Ref: Library<20>-Footnote-443283441 +Ref: Library<20>-Footnote-453283498 +Ref: Library<20>-Footnote-463283555 +Ref: Library<20>-Footnote-473283612 +Ref: Library<20>-Footnote-483283669 +Ref: Library<20>-Footnote-493283726 +Ref: Library<20>-Footnote-503283783 +Ref: Library<20>-Footnote-513283839 +Ref: Library<20>-Footnote-523283896 +Ref: Library<20>-Footnote-533283952 +Ref: Library<20>-Footnote-543284009 +Ref: Library<20>-Footnote-553284066 +Ref: Library<20>-Footnote-563284123 +Ref: Library<20>-Footnote-573284180 +Ref: Library<20>-Footnote-583284237 +Ref: Library<20>-Footnote-593284294 +Ref: Library<20>-Footnote-603284351 +Ref: Library<20>-Footnote-613284408 +Ref: Library<20>-Footnote-623284465 +Ref: Library<20>-Footnote-633284522 +Ref: Library<20>-Footnote-643284579 +Ref: Library<20>-Footnote-653284636 +Ref: Library<20>-Footnote-663284693 +Ref: Library<20>-Footnote-673284750 +Ref: Library<20>-Footnote-683284807 +Ref: Library<20>-Footnote-693284864 +Ref: Library<20>-Footnote-703284920 +Ref: Library<20>-Footnote-713284977 +Ref: Library<20>-Footnote-723285034 +Ref: Library<20>-Footnote-733285091 +Ref: Library<20>-Footnote-743285148 +Ref: Library<20>-Footnote-753285205 +Ref: Library<20>-Footnote-763285261 +Ref: Library<20>-Footnote-773285318 +Ref: Library<20>-Footnote-783285375 +Ref: Library<20>-Footnote-793285432 +Ref: Library<20>-Footnote-803285489 +Ref: Library<20>-Footnote-813285546 +Ref: Library<20>-Footnote-823285603 +Ref: Library<20>-Footnote-833285660 +Ref: Library<20>-Footnote-843285716 +Ref: Library<20>-Footnote-853285772 +Ref: Library<20>-Footnote-863285828 +Ref: Library<20>-Footnote-873285884 +Ref: Library<20>-Footnote-883285941 +Ref: Library<20>-Footnote-893285998 +Ref: Library<20>-Footnote-903286055 +Ref: Library<20>-Footnote-913286112 +Ref: Library<20>-Footnote-923286169 +Ref: Library<20>-Footnote-933286225 +Ref: Library<20>-Footnote-943286282 +Ref: Library<20>-Footnote-953286339 +Ref: Library<20>-Footnote-963286396 +Ref: Library<20>-Footnote-973286452 +Ref: Library<20>-Footnote-983286509 +Ref: Library<20>-Footnote-993286566 +Ref: Library<20>-Footnote-1003286623 +Ref: Library<20>-Footnote-1013286681 +Ref: Library<20>-Footnote-1023286739 +Ref: Library<20>-Footnote-1033286797 +Ref: Library<20>-Footnote-1043286855 +Ref: Library<20>-Footnote-1053286913 +Ref: Library<20>-Footnote-1063286971 +Ref: Library<20>-Footnote-1073287029 +Ref: Library<20>-Footnote-1083287086 +Ref: Library<20>-Footnote-1093287144 +Ref: Library<20>-Footnote-1103287201 +Ref: Library<20>-Footnote-1113287259 +Ref: Library<20>-Footnote-1123287316 +Ref: Library<20>-Footnote-1133287373 +Ref: Library<20>-Footnote-1143287430 +Ref: Library<20>-Footnote-1153287488 +Ref: Library<20>-Footnote-1163287546 +Ref: Library<20>-Footnote-1173287604 +Ref: Library<20>-Footnote-1183287662 +Ref: Library<20>-Footnote-1193287720 +Ref: Library<20>-Footnote-1203287778 +Ref: Library<20>-Footnote-1213287836 +Ref: Library<20>-Footnote-1223287894 +Ref: Library<20>-Footnote-1233287952 +Ref: Library<20>-Footnote-1243288010 +Ref: Library<20>-Footnote-1253288068 +Ref: Library<20>-Footnote-1263288126 +Ref: Library<20>-Footnote-1273288184 +Ref: Library<20>-Footnote-1283288242 +Ref: Library<20>-Footnote-1293288300 +Ref: Library<20>-Footnote-1303288358 +Ref: Library<20>-Footnote-1313288416 +Ref: Library<20>-Footnote-1323288474 +Ref: Library<20>-Footnote-1333288532 +Ref: Library<20>-Footnote-1343288590 +Ref: Library<20>-Footnote-1353288648 +Ref: Library<20>-Footnote-1363288705 +Ref: Library<20>-Footnote-1373288763 +Ref: Library<20>-Footnote-1383288821 +Ref: Library<20>-Footnote-1393288879 +Ref: Library<20>-Footnote-1403288937 +Ref: Library<20>-Footnote-1413288995 +Ref: Library<20>-Footnote-1423289053 +Ref: Library<20>-Footnote-1433289111 +Ref: Library<20>-Footnote-1443289169 +Ref: Library<20>-Footnote-1453289227 +Ref: Library<20>-Footnote-1463289285 +Ref: Library<20>-Footnote-1473289343 +Ref: Library<20>-Footnote-1483289401 +Ref: Library<20>-Footnote-1493289459 +Ref: Library<20>-Footnote-1503289516 +Ref: Library<20>-Footnote-1513289574 +Ref: Library<20>-Footnote-1523289631 +Ref: Library<20>-Footnote-1533289689 +Ref: Library<20>-Footnote-1543289747 +Ref: Library<20>-Footnote-1553289805 +Ref: Library<20>-Footnote-1563289863 +Ref: Library<20>-Footnote-1573289921 +Ref: Library<20>-Footnote-1583289979 +Ref: Library<20>-Footnote-1593290037 +Ref: Library<20>-Footnote-1603290095 +Ref: Library<20>-Footnote-1613290153 +Ref: Library<20>-Footnote-1623290211 +Ref: Library<20>-Footnote-1633290269 +Ref: Library<20>-Footnote-1643290327 +Ref: Library<20>-Footnote-1653290385 +Ref: Library<20>-Footnote-1663290443 +Ref: Library<20>-Footnote-1673290500 +Ref: Library<20>-Footnote-1683290557 +Ref: Library<20>-Footnote-1693290615 +Ref: Library<20>-Footnote-1703290673 +Ref: Library<20>-Footnote-1713290731 +Ref: Library<20>-Footnote-1723290789 +Ref: Library<20>-Footnote-1733290833 +Ref: Library<20>-Footnote-1743290891 +Ref: Library<20>-Footnote-1753290949 +Ref: Library<20>-Footnote-1763291007 +Ref: Library<20>-Footnote-1773291065 +Ref: Library<20>-Footnote-1783291123 +Ref: Library<20>-Footnote-1793291181 +Ref: Library<20>-Footnote-1803291239 +Ref: Library<20>-Footnote-1813291297 +Ref: Library<20>-Footnote-1823291355 +Ref: Library<20>-Footnote-1833291413 +Ref: Library<20>-Footnote-1843291471 +Ref: Library<20>-Footnote-1853291529 +Ref: Library<20>-Footnote-1863291587 +Ref: Library<20>-Footnote-1873291645 +Ref: Library<20>-Footnote-1883291703 +Ref: Library<20>-Footnote-1893291761 +Ref: Library<20>-Footnote-1903291819 +Ref: Library<20>-Footnote-1913291877 +Ref: Library<20>-Footnote-1923291935 +Ref: Library<20>-Footnote-1933291993 +Ref: Library<20>-Footnote-1943292051 +Ref: Library<20>-Footnote-1953292109 +Ref: Library<20>-Footnote-1963292167 +Ref: Library<20>-Footnote-1973292225 +Ref: Library<20>-Footnote-1983292282 +Ref: Library<20>-Footnote-1993292340 +Ref: Library<20>-Footnote-2003292398 +Ref: Library<20>-Footnote-2013292456 +Ref: Library<20>-Footnote-2023292514 +Ref: Library<20>-Footnote-2033292572 +Ref: Library<20>-Footnote-2043292630 +Ref: Library<20>-Footnote-2053292688 +Ref: Library<20>-Footnote-2063292745 +Ref: Library<20>-Footnote-2073292803 +Ref: Library<20>-Footnote-2083292861 +Ref: Library<20>-Footnote-2093292919 +Ref: Library<20>-Footnote-2103292977 +Ref: Library<20>-Footnote-2113293034 +Ref: Library<20>-Footnote-2123293092 +Ref: Library<20>-Footnote-2133293150 +Ref: Library<20>-Footnote-2143293208 +Ref: Library<20>-Footnote-2153293266 +Ref: Library<20>-Footnote-2163293324 +Ref: Library<20>-Footnote-2173293382 +Ref: Library<20>-Footnote-2183293440 +Ref: Library<20>-Footnote-2193293484 +Ref: Library<20>-Footnote-2203293542 +Ref: Library<20>-Footnote-2213293586 +Ref: Library<20>-Footnote-2223293644 +Ref: Library<20>-Footnote-2233293688 +Ref: Library<20>-Footnote-2243293746 +Ref: Library<20>-Footnote-2253293790 +Ref: Library<20>-Footnote-2263293848 +Ref: Library<20>-Footnote-2273293892 +Ref: Library<20>-Footnote-2283293950 +Ref: Library<20>-Footnote-2293293994 +Ref: Library<20>-Footnote-2303294052 +Ref: Library<20>-Footnote-2313294110 +Ref: Library<20>-Footnote-2323294154 +Ref: Library<20>-Footnote-2333294212 +Ref: Library<20>-Footnote-2343294256 +Ref: Library<20>-Footnote-2353294314 +Ref: Library<20>-Footnote-2363294372 +Ref: Library<20>-Footnote-2373294430 +Ref: Library<20>-Footnote-2383294488 +Ref: Library<20>-Footnote-2393294532 +Ref: Library<20>-Footnote-2403294590 +Ref: Library<20>-Footnote-2413294634 +Ref: Library<20>-Footnote-2423294681 +Ref: Library<20>-Footnote-2433294738 +Ref: Library<20>-Footnote-2443294796 +Ref: Library<20>-Footnote-2453294840 +Ref: Library<20>-Footnote-2463294898 +Ref: Library<20>-Footnote-2473294942 +Ref: Library<20>-Footnote-2483295000 +Ref: Library<20>-Footnote-2493295044 +Ref: Library<20>-Footnote-2503295102 +Ref: Library<20>-Footnote-2513295146 +Ref: Library<20>-Footnote-2523295204 +Ref: Library<20>-Footnote-2533295248 +Ref: Library<20>-Footnote-2543295306 +Ref: Library<20>-Footnote-2553295364 +Ref: Library<20>-Footnote-2563295422 +Ref: Library<20>-Footnote-2573295480 +Ref: Library<20>-Footnote-2583295537 +Ref: Library<20>-Footnote-2593295595 +Ref: Library<20>-Footnote-2603295639 +Ref: Library<20>-Footnote-2613295697 +Ref: Library<20>-Footnote-2623295755 +Ref: Library<20>-Footnote-2633295813 +Ref: Library<20>-Footnote-2643295871 +Ref: Library<20>-Footnote-2653295915 +Ref: Library<20>-Footnote-2663295973 +Ref: Library<20>-Footnote-2673296017 +Ref: Library<20>-Footnote-2683296075 +Ref: Library<20>-Footnote-2693296119 +Ref: Library<20>-Footnote-2703296177 +Ref: Library<20>-Footnote-2713296221 +Ref: Library<20>-Footnote-2723296279 +Ref: Library<20>-Footnote-2733296336 +Ref: Library<20>-Footnote-2743296394 +Ref: Library<20>-Footnote-2753296452 +Ref: Library<20>-Footnote-2763296510 +Ref: Library<20>-Footnote-2773296568 +Ref: Library<20>-Footnote-2783296626 +Ref: Library<20>-Footnote-2793296684 +Ref: Library<20>-Footnote-2803296742 +Ref: Library<20>-Footnote-2813296800 +Ref: Library<20>-Footnote-2823296858 +Ref: Library<20>-Footnote-2833296916 +Ref: Library<20>-Footnote-2843296973 +Ref: Library<20>-Footnote-2853297031 +Ref: Library<20>-Footnote-2863297089 +Ref: Library<20>-Footnote-2873297147 +Ref: Library<20>-Footnote-2883297204 +Ref: Library<20>-Footnote-2893297262 +Ref: Library<20>-Footnote-2903297319 +Ref: Library<20>-Footnote-2913297376 +Ref: Library<20>-Footnote-2923297433 +Ref: Library<20>-Footnote-2933297490 +Ref: Library<20>-Footnote-2943297547 +Ref: Library<20>-Footnote-2953297604 +Ref: Library<20>-Footnote-2963297661 +Ref: Library<20>-Footnote-2973297728 +Ref: Library<20>-Footnote-2983297789 +Ref: Library<20>-Footnote-2993297856 +Ref: Library<20>-Footnote-3003297900 +Ref: Library<20>-Footnote-3013297967 +Ref: Library<20>-Footnote-3023298034 +Ref: Library<20>-Footnote-3033298101 +Ref: Library<20>-Footnote-3043298168 +Node: Documentation<15>3298235 +Ref: whatsnew/changelog id1543298348 +Ref: 170a3298348 +Ref: Documentation<15>-Footnote-13300302 +Ref: Documentation<15>-Footnote-23300358 +Ref: Documentation<15>-Footnote-33300414 +Ref: Documentation<15>-Footnote-43300470 +Ref: Documentation<15>-Footnote-53300526 +Ref: Documentation<15>-Footnote-63300582 +Ref: Documentation<15>-Footnote-73300638 +Ref: Documentation<15>-Footnote-83300694 +Ref: Documentation<15>-Footnote-93300750 +Ref: Documentation<15>-Footnote-103300805 +Ref: Documentation<15>-Footnote-113300861 +Ref: Documentation<15>-Footnote-123300918 +Ref: Documentation<15>-Footnote-133300974 +Ref: Documentation<15>-Footnote-143301031 +Node: Tests<17>3301088 +Ref: whatsnew/changelog id1553301199 +Ref: 170d3301199 +Ref: Tests<17>-Footnote-13314374 +Ref: Tests<17>-Footnote-23314430 +Ref: Tests<17>-Footnote-33314486 +Ref: Tests<17>-Footnote-43314542 +Ref: Tests<17>-Footnote-53314598 +Ref: Tests<17>-Footnote-63314653 +Ref: Tests<17>-Footnote-73314709 +Ref: Tests<17>-Footnote-83314765 +Ref: Tests<17>-Footnote-93314821 +Ref: Tests<17>-Footnote-103314877 +Ref: Tests<17>-Footnote-113314934 +Ref: Tests<17>-Footnote-123314991 +Ref: Tests<17>-Footnote-133315048 +Ref: Tests<17>-Footnote-143315105 +Ref: Tests<17>-Footnote-153315162 +Ref: Tests<17>-Footnote-163315219 +Ref: Tests<17>-Footnote-173315276 +Ref: Tests<17>-Footnote-183315333 +Ref: Tests<17>-Footnote-193315390 +Ref: Tests<17>-Footnote-203315447 +Ref: Tests<17>-Footnote-213315504 +Ref: Tests<17>-Footnote-223315561 +Ref: Tests<17>-Footnote-233315618 +Ref: Tests<17>-Footnote-243315675 +Ref: Tests<17>-Footnote-253315732 +Ref: Tests<17>-Footnote-263315789 +Ref: Tests<17>-Footnote-273315846 +Ref: Tests<17>-Footnote-283315903 +Ref: Tests<17>-Footnote-293315960 +Ref: Tests<17>-Footnote-303316017 +Ref: Tests<17>-Footnote-313316074 +Ref: Tests<17>-Footnote-323316131 +Ref: Tests<17>-Footnote-333316188 +Ref: Tests<17>-Footnote-343316232 +Ref: Tests<17>-Footnote-353316288 +Ref: Tests<17>-Footnote-363316345 +Ref: Tests<17>-Footnote-373316401 +Ref: Tests<17>-Footnote-383316457 +Ref: Tests<17>-Footnote-393316514 +Ref: Tests<17>-Footnote-403316571 +Ref: Tests<17>-Footnote-413316628 +Ref: Tests<17>-Footnote-423316685 +Ref: Tests<17>-Footnote-433316742 +Ref: Tests<17>-Footnote-443316799 +Ref: Tests<17>-Footnote-453316856 +Ref: Tests<17>-Footnote-463316913 +Ref: Tests<17>-Footnote-473316970 +Ref: Tests<17>-Footnote-483317027 +Ref: Tests<17>-Footnote-493317084 +Ref: Tests<17>-Footnote-503317141 +Ref: Tests<17>-Footnote-513317198 +Ref: Tests<17>-Footnote-523317255 +Ref: Tests<17>-Footnote-533317312 +Ref: Tests<17>-Footnote-543317369 +Ref: Tests<17>-Footnote-553317426 +Ref: Tests<17>-Footnote-563317483 +Ref: Tests<17>-Footnote-573317540 +Ref: Tests<17>-Footnote-583317596 +Ref: Tests<17>-Footnote-593317653 +Node: Build<18>3317709 +Ref: whatsnew/changelog id1563317814 +Ref: 170f3317814 +Ref: Build<18>-Footnote-13321821 +Ref: Build<18>-Footnote-23321877 +Ref: Build<18>-Footnote-33321933 +Ref: Build<18>-Footnote-43321989 +Ref: Build<18>-Footnote-53322045 +Ref: Build<18>-Footnote-63322101 +Ref: Build<18>-Footnote-73322157 +Ref: Build<18>-Footnote-83322212 +Ref: Build<18>-Footnote-93322268 +Ref: Build<18>-Footnote-103322324 +Ref: Build<18>-Footnote-113322380 +Ref: Build<18>-Footnote-123322437 +Ref: Build<18>-Footnote-133322494 +Ref: Build<18>-Footnote-143322551 +Ref: Build<18>-Footnote-153322608 +Ref: Build<18>-Footnote-163322664 +Ref: Build<18>-Footnote-173322721 +Ref: Build<18>-Footnote-183322778 +Ref: Build<18>-Footnote-193322835 +Ref: Build<18>-Footnote-203322892 +Ref: Build<18>-Footnote-213322948 +Ref: Build<18>-Footnote-223323005 +Ref: Build<18>-Footnote-233323061 +Ref: Build<18>-Footnote-243323118 +Node: Windows<16>3323175 +Ref: whatsnew/changelog id1573323280 +Ref: 17113323280 +Ref: Windows<16>-Footnote-13325792 +Ref: Windows<16>-Footnote-23325848 +Ref: Windows<16>-Footnote-33325904 +Ref: Windows<16>-Footnote-43325959 +Ref: Windows<16>-Footnote-53326015 +Ref: Windows<16>-Footnote-63326071 +Ref: Windows<16>-Footnote-73326126 +Ref: Windows<16>-Footnote-83326182 +Ref: Windows<16>-Footnote-93326238 +Ref: Windows<16>-Footnote-103326294 +Ref: Windows<16>-Footnote-113326351 +Ref: Windows<16>-Footnote-123326407 +Ref: Windows<16>-Footnote-133326464 +Node: macOS<12>3326521 +Ref: whatsnew/changelog id1583326625 +Ref: 17123326625 +Ref: macOS<12>-Footnote-13326889 +Ref: macOS<12>-Footnote-23326945 +Ref: macOS<12>-Footnote-33327001 +Node: IDLE<15>3327056 +Ref: whatsnew/changelog id1593327163 +Ref: 17133327163 +Ref: IDLE<15>-Footnote-13327354 +Node: Tools/Demos<9>3327410 +Ref: whatsnew/changelog id1603327517 +Ref: 17143327517 +Ref: Tools/Demos<9>-Footnote-13330044 +Ref: Tools/Demos<9>-Footnote-23330100 +Ref: Tools/Demos<9>-Footnote-33330156 +Ref: Tools/Demos<9>-Footnote-43330218 +Ref: Tools/Demos<9>-Footnote-53330307 +Ref: Tools/Demos<9>-Footnote-63330363 +Ref: Tools/Demos<9>-Footnote-73330457 +Ref: Tools/Demos<9>-Footnote-83330513 +Ref: Tools/Demos<9>-Footnote-93330569 +Ref: Tools/Demos<9>-Footnote-103330624 +Ref: Tools/Demos<9>-Footnote-113330720 +Ref: Tools/Demos<9>-Footnote-123330777 +Ref: Tools/Demos<9>-Footnote-133330834 +Ref: Tools/Demos<9>-Footnote-143330891 +Ref: Tools/Demos<9>-Footnote-153330948 +Ref: Tools/Demos<9>-Footnote-163331005 +Ref: Tools/Demos<9>-Footnote-173331062 +Ref: Tools/Demos<9>-Footnote-183331118 +Node: C API<18>3331216 +Ref: whatsnew/changelog id1613331306 +Ref: 17153331306 +Ref: C API<18>-Footnote-13346245 +Ref: C API<18>-Footnote-23346300 +Ref: C API<18>-Footnote-33346356 +Ref: C API<18>-Footnote-43346412 +Ref: C API<18>-Footnote-53346468 +Ref: C API<18>-Footnote-63346524 +Ref: C API<18>-Footnote-73346580 +Ref: C API<18>-Footnote-83346635 +Ref: C API<18>-Footnote-93346691 +Ref: C API<18>-Footnote-103346747 +Ref: C API<18>-Footnote-113346804 +Ref: C API<18>-Footnote-123346861 +Ref: C API<18>-Footnote-133346918 +Ref: C API<18>-Footnote-143346975 +Ref: C API<18>-Footnote-153347032 +Ref: C API<18>-Footnote-163347089 +Ref: C API<18>-Footnote-173347146 +Ref: C API<18>-Footnote-183347203 +Ref: C API<18>-Footnote-193347260 +Ref: C API<18>-Footnote-203347317 +Ref: C API<18>-Footnote-213347374 +Ref: C API<18>-Footnote-223347431 +Ref: C API<18>-Footnote-233347488 +Ref: C API<18>-Footnote-243347545 +Ref: C API<18>-Footnote-253347602 +Ref: C API<18>-Footnote-263347659 +Ref: C API<18>-Footnote-273347716 +Ref: C API<18>-Footnote-283347773 +Ref: C API<18>-Footnote-293347830 +Ref: C API<18>-Footnote-303347887 +Ref: C API<18>-Footnote-313347944 +Ref: C API<18>-Footnote-323348001 +Ref: C API<18>-Footnote-333348044 +Ref: C API<18>-Footnote-343348101 +Ref: C API<18>-Footnote-353348158 +Ref: C API<18>-Footnote-363348215 +Ref: C API<18>-Footnote-373348272 +Ref: C API<18>-Footnote-383348329 +Ref: C API<18>-Footnote-393348386 +Ref: C API<18>-Footnote-403348443 +Ref: C API<18>-Footnote-413348500 +Ref: C API<18>-Footnote-423348557 +Ref: C API<18>-Footnote-433348614 +Ref: C API<18>-Footnote-443348671 +Ref: C API<18>-Footnote-453348728 +Ref: C API<18>-Footnote-463348785 +Ref: C API<18>-Footnote-473348842 +Ref: C API<18>-Footnote-483348899 +Ref: C API<18>-Footnote-493348956 +Ref: C API<18>-Footnote-503349012 +Ref: C API<18>-Footnote-513349069 +Ref: C API<18>-Footnote-523349126 +Ref: C API<18>-Footnote-533349183 +Ref: C API<18>-Footnote-543349240 +Ref: C API<18>-Footnote-553349297 +Ref: C API<18>-Footnote-563349354 +Ref: C API<18>-Footnote-573349411 +Ref: C API<18>-Footnote-583349468 +Ref: C API<18>-Footnote-593349534 +Node: Python 3 12 0 beta 13349600 +Ref: whatsnew/changelog python-3-12-0-beta-13349726 +Ref: 17203349726 +Node: Security<14>3350107 +Ref: whatsnew/changelog id1623350206 +Ref: 17213350206 +Ref: Security<14>-Footnote-13351025 +Ref: Security<14>-Footnote-23351080 +Ref: Security<14>-Footnote-33351136 +Ref: Security<14>-Footnote-43351191 +Ref: Security<14>-Footnote-53351247 +Node: Core and Builtins<22>3351303 +Ref: whatsnew/changelog id1633351422 +Ref: 17223351422 +Ref: Core and Builtins<22>-Footnote-13362433 +Ref: Core and Builtins<22>-Footnote-23362489 +Ref: Core and Builtins<22>-Footnote-33362545 +Ref: Core and Builtins<22>-Footnote-43362601 +Ref: Core and Builtins<22>-Footnote-53362643 +Ref: Core and Builtins<22>-Footnote-63362699 +Ref: Core and Builtins<22>-Footnote-73362755 +Ref: Core and Builtins<22>-Footnote-83362811 +Ref: Core and Builtins<22>-Footnote-93362853 +Ref: Core and Builtins<22>-Footnote-103362909 +Ref: Core and Builtins<22>-Footnote-113362966 +Ref: Core and Builtins<22>-Footnote-123363022 +Ref: Core and Builtins<22>-Footnote-133363078 +Ref: Core and Builtins<22>-Footnote-143363135 +Ref: Core and Builtins<22>-Footnote-153363192 +Ref: Core and Builtins<22>-Footnote-163363235 +Ref: Core and Builtins<22>-Footnote-173363292 +Ref: Core and Builtins<22>-Footnote-183363349 +Ref: Core and Builtins<22>-Footnote-193363406 +Ref: Core and Builtins<22>-Footnote-203363463 +Ref: Core and Builtins<22>-Footnote-213363520 +Ref: Core and Builtins<22>-Footnote-223363577 +Ref: Core and Builtins<22>-Footnote-233363634 +Ref: Core and Builtins<22>-Footnote-243363691 +Ref: Core and Builtins<22>-Footnote-253363748 +Ref: Core and Builtins<22>-Footnote-263363805 +Ref: Core and Builtins<22>-Footnote-273363848 +Ref: Core and Builtins<22>-Footnote-283363905 +Ref: Core and Builtins<22>-Footnote-293363962 +Ref: Core and Builtins<22>-Footnote-303364019 +Ref: Core and Builtins<22>-Footnote-313364076 +Ref: Core and Builtins<22>-Footnote-323364133 +Ref: Core and Builtins<22>-Footnote-333364190 +Ref: Core and Builtins<22>-Footnote-343364247 +Ref: Core and Builtins<22>-Footnote-353364304 +Ref: Core and Builtins<22>-Footnote-363364361 +Ref: Core and Builtins<22>-Footnote-373364417 +Ref: Core and Builtins<22>-Footnote-383364474 +Ref: Core and Builtins<22>-Footnote-393364530 +Ref: Core and Builtins<22>-Footnote-403364586 +Ref: Core and Builtins<22>-Footnote-413364629 +Ref: Core and Builtins<22>-Footnote-423364686 +Ref: Core and Builtins<22>-Footnote-433364743 +Ref: Core and Builtins<22>-Footnote-443364800 +Ref: Core and Builtins<22>-Footnote-453364856 +Ref: Core and Builtins<22>-Footnote-463364913 +Ref: Core and Builtins<22>-Footnote-473364970 +Ref: Core and Builtins<22>-Footnote-483365013 +Ref: Core and Builtins<22>-Footnote-493365069 +Ref: Core and Builtins<22>-Footnote-503365126 +Ref: Core and Builtins<22>-Footnote-513365169 +Ref: Core and Builtins<22>-Footnote-523365225 +Ref: Core and Builtins<22>-Footnote-533365268 +Ref: Core and Builtins<22>-Footnote-543365324 +Ref: Core and Builtins<22>-Footnote-553365380 +Ref: Core and Builtins<22>-Footnote-563365446 +Node: Library<21>3365512 +Ref: whatsnew/changelog id1643365636 +Ref: 17233365636 +Ref: Library<21>-Footnote-13389164 +Ref: Library<21>-Footnote-23389220 +Ref: Library<21>-Footnote-33389262 +Ref: Library<21>-Footnote-43389318 +Ref: Library<21>-Footnote-53389374 +Ref: Library<21>-Footnote-63389430 +Ref: Library<21>-Footnote-73389486 +Ref: Library<21>-Footnote-83389541 +Ref: Library<21>-Footnote-93389597 +Ref: Library<21>-Footnote-103389653 +Ref: Library<21>-Footnote-113389710 +Ref: Library<21>-Footnote-123389767 +Ref: Library<21>-Footnote-133389824 +Ref: Library<21>-Footnote-143389881 +Ref: Library<21>-Footnote-153389938 +Ref: Library<21>-Footnote-163389995 +Ref: Library<21>-Footnote-173390071 +Ref: Library<21>-Footnote-183390128 +Ref: Library<21>-Footnote-193390185 +Ref: Library<21>-Footnote-203390241 +Ref: Library<21>-Footnote-213390298 +Ref: Library<21>-Footnote-223390364 +Ref: Library<21>-Footnote-233390421 +Ref: Library<21>-Footnote-243390477 +Ref: Library<21>-Footnote-253390533 +Ref: Library<21>-Footnote-263390590 +Ref: Library<21>-Footnote-273390647 +Ref: Library<21>-Footnote-283390704 +Ref: Library<21>-Footnote-293390761 +Ref: Library<21>-Footnote-303390818 +Ref: Library<21>-Footnote-313390875 +Ref: Library<21>-Footnote-323390932 +Ref: Library<21>-Footnote-333390975 +Ref: Library<21>-Footnote-343391032 +Ref: Library<21>-Footnote-353391089 +Ref: Library<21>-Footnote-363391146 +Ref: Library<21>-Footnote-373391203 +Ref: Library<21>-Footnote-383391259 +Ref: Library<21>-Footnote-393391316 +Ref: Library<21>-Footnote-403391372 +Ref: Library<21>-Footnote-413391429 +Ref: Library<21>-Footnote-423391486 +Ref: Library<21>-Footnote-433391543 +Ref: Library<21>-Footnote-443391600 +Ref: Library<21>-Footnote-453391657 +Ref: Library<21>-Footnote-463391714 +Ref: Library<21>-Footnote-473391770 +Ref: Library<21>-Footnote-483391826 +Ref: Library<21>-Footnote-493391883 +Ref: Library<21>-Footnote-503391940 +Ref: Library<21>-Footnote-513391997 +Ref: Library<21>-Footnote-523392054 +Ref: Library<21>-Footnote-533392110 +Ref: Library<21>-Footnote-543392167 +Ref: Library<21>-Footnote-553392223 +Ref: Library<21>-Footnote-563392280 +Ref: Library<21>-Footnote-573392337 +Ref: Library<21>-Footnote-583392393 +Ref: Library<21>-Footnote-593392449 +Ref: Library<21>-Footnote-603392506 +Ref: Library<21>-Footnote-613392563 +Ref: Library<21>-Footnote-623392619 +Ref: Library<21>-Footnote-633392676 +Ref: Library<21>-Footnote-643392733 +Ref: Library<21>-Footnote-653392790 +Ref: Library<21>-Footnote-663392847 +Ref: Library<21>-Footnote-673392904 +Ref: Library<21>-Footnote-683392961 +Ref: Library<21>-Footnote-693393018 +Ref: Library<21>-Footnote-703393075 +Ref: Library<21>-Footnote-713393132 +Ref: Library<21>-Footnote-723393189 +Ref: Library<21>-Footnote-733393246 +Ref: Library<21>-Footnote-743393303 +Ref: Library<21>-Footnote-753393360 +Ref: Library<21>-Footnote-763393417 +Ref: Library<21>-Footnote-773393474 +Ref: Library<21>-Footnote-783393517 +Ref: Library<21>-Footnote-793393574 +Ref: Library<21>-Footnote-803393631 +Ref: Library<21>-Footnote-813393674 +Ref: Library<21>-Footnote-823393730 +Ref: Library<21>-Footnote-833393786 +Ref: Library<21>-Footnote-843393843 +Ref: Library<21>-Footnote-853393900 +Ref: Library<21>-Footnote-863393957 +Ref: Library<21>-Footnote-873394014 +Ref: Library<21>-Footnote-883394071 +Ref: Library<21>-Footnote-893394114 +Ref: Library<21>-Footnote-903394171 +Ref: Library<21>-Footnote-913394214 +Ref: Library<21>-Footnote-923394270 +Ref: Library<21>-Footnote-933394327 +Ref: Library<21>-Footnote-943394384 +Ref: Library<21>-Footnote-953394427 +Ref: Library<21>-Footnote-963394484 +Ref: Library<21>-Footnote-973394541 +Ref: Library<21>-Footnote-983394598 +Ref: Library<21>-Footnote-993394654 +Ref: Library<21>-Footnote-1003394711 +Ref: Library<21>-Footnote-1013394769 +Ref: Library<21>-Footnote-1023394827 +Ref: Library<21>-Footnote-1033394885 +Ref: Library<21>-Footnote-1043394943 +Ref: Library<21>-Footnote-1053395001 +Ref: Library<21>-Footnote-1063395058 +Ref: Library<21>-Footnote-1073395115 +Ref: Library<21>-Footnote-1083395173 +Ref: Library<21>-Footnote-1093395217 +Ref: Library<21>-Footnote-1103395274 +Ref: Library<21>-Footnote-1113395332 +Ref: Library<21>-Footnote-1123395390 +Ref: Library<21>-Footnote-1133395447 +Ref: Library<21>-Footnote-1143395504 +Ref: Library<21>-Footnote-1153395561 +Ref: Library<21>-Footnote-1163395619 +Ref: Library<21>-Footnote-1173395677 +Ref: Library<21>-Footnote-1183395734 +Ref: Library<21>-Footnote-1193395791 +Ref: Library<21>-Footnote-1203395848 +Ref: Library<21>-Footnote-1213395905 +Ref: Library<21>-Footnote-1223395962 +Ref: Library<21>-Footnote-1233396019 +Ref: Library<21>-Footnote-1243396076 +Ref: Library<21>-Footnote-1253396133 +Ref: Library<21>-Footnote-1263396190 +Ref: Library<21>-Footnote-1273396247 +Ref: Library<21>-Footnote-1283396304 +Ref: Library<21>-Footnote-1293396361 +Ref: Library<21>-Footnote-1303396418 +Ref: Library<21>-Footnote-1313396475 +Ref: Library<21>-Footnote-1323396532 +Ref: Library<21>-Footnote-1333396599 +Ref: Library<21>-Footnote-1343396666 +Ref: Library<21>-Footnote-1353396733 +Ref: Library<21>-Footnote-1363396800 +Ref: Library<21>-Footnote-1373396867 +Ref: Library<21>-Footnote-1383396934 +Ref: Library<21>-Footnote-1393397001 +Node: Documentation<16>3397068 +Ref: whatsnew/changelog id1653397180 +Ref: 172f3397180 +Ref: Documentation<16>-Footnote-13397953 +Ref: Documentation<16>-Footnote-23398008 +Ref: Documentation<16>-Footnote-33398064 +Ref: Documentation<16>-Footnote-43398106 +Ref: Documentation<16>-Footnote-53398161 +Ref: Documentation<16>-Footnote-63398216 +Node: Tests<18>3398271 +Ref: whatsnew/changelog id1663398381 +Ref: 17303398381 +Ref: Tests<18>-Footnote-13399296 +Ref: Tests<18>-Footnote-23399352 +Ref: Tests<18>-Footnote-33399408 +Ref: Tests<18>-Footnote-43399463 +Ref: Tests<18>-Footnote-53399519 +Ref: Tests<18>-Footnote-63399575 +Node: Build<19>3399630 +Ref: whatsnew/changelog id1673399734 +Ref: 17323399734 +Ref: Build<19>-Footnote-13401318 +Ref: Build<19>-Footnote-23401374 +Ref: Build<19>-Footnote-33401429 +Ref: Build<19>-Footnote-43401485 +Ref: Build<19>-Footnote-53401541 +Ref: Build<19>-Footnote-63401597 +Ref: Build<19>-Footnote-73401652 +Ref: Build<19>-Footnote-83401707 +Ref: Build<19>-Footnote-93401763 +Node: Windows<17>3401818 +Ref: whatsnew/changelog id1683401922 +Ref: 17333401922 +Ref: Windows<17>-Footnote-13402775 +Ref: Windows<17>-Footnote-23402831 +Ref: Windows<17>-Footnote-33402886 +Ref: Windows<17>-Footnote-43402942 +Ref: Windows<17>-Footnote-53402998 +Ref: Windows<17>-Footnote-63403054 +Node: macOS<13>3403109 +Ref: whatsnew/changelog id1693403212 +Ref: 17343403212 +Ref: macOS<13>-Footnote-13404014 +Ref: macOS<13>-Footnote-23404069 +Ref: macOS<13>-Footnote-33404125 +Ref: macOS<13>-Footnote-43404181 +Ref: macOS<13>-Footnote-53404237 +Ref: macOS<13>-Footnote-63404292 +Node: IDLE<16>3404348 +Ref: whatsnew/changelog id1703404455 +Ref: 17353404455 +Ref: IDLE<16>-Footnote-13404737 +Ref: IDLE<16>-Footnote-23404793 +Ref: IDLE<16>-Footnote-33404849 +Node: Tools/Demos<10>3404904 +Ref: whatsnew/changelog id1713405011 +Ref: 17363405011 +Ref: Tools/Demos<10>-Footnote-13405271 +Node: C API<19>3405327 +Ref: whatsnew/changelog id1723405417 +Ref: 17373405417 +Ref: C API<19>-Footnote-13408401 +Ref: C API<19>-Footnote-23408457 +Ref: C API<19>-Footnote-33408513 +Ref: C API<19>-Footnote-43408569 +Ref: C API<19>-Footnote-53408625 +Ref: C API<19>-Footnote-63408681 +Ref: C API<19>-Footnote-73408737 +Ref: C API<19>-Footnote-83408779 +Ref: C API<19>-Footnote-93408835 +Ref: C API<19>-Footnote-103408891 +Ref: C API<19>-Footnote-113408947 +Node: Python 3 12 0 alpha 73409003 +Ref: whatsnew/changelog python-3-12-0-alpha-73409129 +Ref: 173e3409129 +Node: Core and Builtins<23>3409448 +Ref: whatsnew/changelog id1733409547 +Ref: 173f3409547 +Ref: Core and Builtins<23>-Footnote-13412682 +Ref: Core and Builtins<23>-Footnote-23412738 +Ref: Core and Builtins<23>-Footnote-33412793 +Ref: Core and Builtins<23>-Footnote-43412849 +Ref: Core and Builtins<23>-Footnote-53412905 +Ref: Core and Builtins<23>-Footnote-63412961 +Ref: Core and Builtins<23>-Footnote-73413017 +Ref: Core and Builtins<23>-Footnote-83413073 +Ref: Core and Builtins<23>-Footnote-93413129 +Ref: Core and Builtins<23>-Footnote-103413185 +Ref: Core and Builtins<23>-Footnote-113413241 +Ref: Core and Builtins<23>-Footnote-123413298 +Ref: Core and Builtins<23>-Footnote-133413355 +Ref: Core and Builtins<23>-Footnote-143413412 +Ref: Core and Builtins<23>-Footnote-153413469 +Ref: Core and Builtins<23>-Footnote-163413512 +Ref: Core and Builtins<23>-Footnote-173413569 +Ref: Core and Builtins<23>-Footnote-183413626 +Ref: Core and Builtins<23>-Footnote-193413683 +Ref: Core and Builtins<23>-Footnote-203413740 +Ref: Core and Builtins<23>-Footnote-213413797 +Ref: Core and Builtins<23>-Footnote-223413854 +Ref: Core and Builtins<23>-Footnote-233413922 +Node: Library<22>3413965 +Ref: whatsnew/changelog id1743414090 +Ref: 17413414090 +Ref: Library<22>-Footnote-13421920 +Ref: Library<22>-Footnote-23421976 +Ref: Library<22>-Footnote-33422032 +Ref: Library<22>-Footnote-43422088 +Ref: Library<22>-Footnote-53422144 +Ref: Library<22>-Footnote-63422200 +Ref: Library<22>-Footnote-73422256 +Ref: Library<22>-Footnote-83422312 +Ref: Library<22>-Footnote-93422368 +Ref: Library<22>-Footnote-103422424 +Ref: Library<22>-Footnote-113422481 +Ref: Library<22>-Footnote-123422538 +Ref: Library<22>-Footnote-133422595 +Ref: Library<22>-Footnote-143422651 +Ref: Library<22>-Footnote-153422707 +Ref: Library<22>-Footnote-163422763 +Ref: Library<22>-Footnote-173422820 +Ref: Library<22>-Footnote-183422877 +Ref: Library<22>-Footnote-193422934 +Ref: Library<22>-Footnote-203422991 +Ref: Library<22>-Footnote-213423048 +Ref: Library<22>-Footnote-223423105 +Ref: Library<22>-Footnote-233423161 +Ref: Library<22>-Footnote-243423218 +Ref: Library<22>-Footnote-253423274 +Ref: Library<22>-Footnote-263423331 +Ref: Library<22>-Footnote-273423388 +Ref: Library<22>-Footnote-283423445 +Ref: Library<22>-Footnote-293423501 +Ref: Library<22>-Footnote-303423558 +Ref: Library<22>-Footnote-313423615 +Ref: Library<22>-Footnote-323423672 +Ref: Library<22>-Footnote-333423728 +Ref: Library<22>-Footnote-343423785 +Ref: Library<22>-Footnote-353423841 +Ref: Library<22>-Footnote-363423897 +Ref: Library<22>-Footnote-373423953 +Ref: Library<22>-Footnote-383424009 +Ref: Library<22>-Footnote-393424065 +Ref: Library<22>-Footnote-403424121 +Ref: Library<22>-Footnote-413424177 +Node: Documentation<17>3424243 +Ref: whatsnew/changelog id1753424356 +Ref: 17483424356 +Ref: Documentation<17>-Footnote-13424555 +Node: Tests<19>3424611 +Ref: whatsnew/changelog id1763424722 +Ref: 17493424722 +Ref: Tests<19>-Footnote-13425079 +Ref: Tests<19>-Footnote-23425135 +Ref: Tests<19>-Footnote-33425191 +Node: Build<20>3425247 +Ref: whatsnew/changelog id1773425352 +Ref: 174a3425352 +Ref: Build<20>-Footnote-13425598 +Ref: Build<20>-Footnote-23425654 +Node: Windows<18>3425710 +Ref: whatsnew/changelog id1783425821 +Ref: 174b3425821 +Ref: Windows<18>-Footnote-13426119 +Ref: Windows<18>-Footnote-23426175 +Node: Tools/Demos<11>3426230 +Ref: whatsnew/changelog id1793426341 +Ref: 174c3426341 +Ref: Tools/Demos<11>-Footnote-13426474 +Node: C API<20>3426530 +Ref: whatsnew/changelog id1803426621 +Ref: 174d3426621 +Ref: C API<20>-Footnote-13426837 +Node: Python 3 12 0 alpha 63426893 +Ref: whatsnew/changelog python-3-12-0-alpha-63427020 +Ref: 174e3427020 +Node: Security<15>3427353 +Ref: whatsnew/changelog id1813427453 +Ref: 174f3427453 +Ref: Security<15>-Footnote-13428391 +Ref: Security<15>-Footnote-23428446 +Ref: Security<15>-Footnote-33428502 +Ref: Security<15>-Footnote-43428557 +Ref: Security<15>-Footnote-53428612 +Ref: Security<15>-Footnote-63428667 +Ref: Security<15>-Footnote-73428728 +Ref: Security<15>-Footnote-83428783 +Ref: Security<15>-Footnote-93428831 +Node: Core and Builtins<24>3428887 +Ref: whatsnew/changelog id1823429007 +Ref: 17503429007 +Ref: Core and Builtins<24>-Footnote-13432645 +Ref: Core and Builtins<24>-Footnote-23432701 +Ref: Core and Builtins<24>-Footnote-33432757 +Ref: Core and Builtins<24>-Footnote-43432813 +Ref: Core and Builtins<24>-Footnote-53432869 +Ref: Core and Builtins<24>-Footnote-63432925 +Ref: Core and Builtins<24>-Footnote-73432981 +Ref: Core and Builtins<24>-Footnote-83433037 +Ref: Core and Builtins<24>-Footnote-93433093 +Ref: Core and Builtins<24>-Footnote-103433149 +Ref: Core and Builtins<24>-Footnote-113433206 +Ref: Core and Builtins<24>-Footnote-123433263 +Ref: Core and Builtins<24>-Footnote-133433319 +Ref: Core and Builtins<24>-Footnote-143433376 +Ref: Core and Builtins<24>-Footnote-153433433 +Ref: Core and Builtins<24>-Footnote-163433489 +Ref: Core and Builtins<24>-Footnote-173433545 +Ref: Core and Builtins<24>-Footnote-183433602 +Ref: Core and Builtins<24>-Footnote-193433659 +Ref: Core and Builtins<24>-Footnote-203433716 +Ref: Core and Builtins<24>-Footnote-213433773 +Ref: Core and Builtins<24>-Footnote-223433830 +Node: Library<23>3433886 +Ref: whatsnew/changelog id1833434011 +Ref: 17543434011 +Ref: Library<23>-Footnote-13439853 +Ref: Library<23>-Footnote-23439909 +Ref: Library<23>-Footnote-33439965 +Ref: Library<23>-Footnote-43440020 +Ref: Library<23>-Footnote-53440075 +Ref: Library<23>-Footnote-63440131 +Ref: Library<23>-Footnote-73440187 +Ref: Library<23>-Footnote-83440243 +Ref: Library<23>-Footnote-93440299 +Ref: Library<23>-Footnote-103440366 +Ref: Library<23>-Footnote-113440422 +Ref: Library<23>-Footnote-123440506 +Ref: Library<23>-Footnote-133440563 +Ref: Library<23>-Footnote-143440619 +Ref: Library<23>-Footnote-153440676 +Ref: Library<23>-Footnote-163440732 +Ref: Library<23>-Footnote-173440788 +Ref: Library<23>-Footnote-183440845 +Ref: Library<23>-Footnote-193440902 +Ref: Library<23>-Footnote-203440959 +Ref: Library<23>-Footnote-213441016 +Ref: Library<23>-Footnote-223441073 +Ref: Library<23>-Footnote-233441130 +Ref: Library<23>-Footnote-243441187 +Ref: Library<23>-Footnote-253441243 +Ref: Library<23>-Footnote-263441300 +Ref: Library<23>-Footnote-273441343 +Ref: Library<23>-Footnote-283441399 +Ref: Library<23>-Footnote-293441456 +Ref: Library<23>-Footnote-303441513 +Ref: Library<23>-Footnote-313441556 +Ref: Library<23>-Footnote-323441613 +Ref: Library<23>-Footnote-333441669 +Ref: Library<23>-Footnote-343441712 +Ref: Library<23>-Footnote-353441768 +Ref: Library<23>-Footnote-363441824 +Node: Documentation<18>3441890 +Ref: whatsnew/changelog id1843442003 +Ref: 175e3442003 +Ref: Documentation<18>-Footnote-13442312 +Ref: Documentation<18>-Footnote-23442367 +Node: Tests<20>3442422 +Ref: whatsnew/changelog id1853442533 +Ref: 17603442533 +Ref: Tests<20>-Footnote-13443109 +Ref: Tests<20>-Footnote-23443165 +Ref: Tests<20>-Footnote-33443220 +Node: Build<21>3443275 +Ref: whatsnew/changelog id1863443380 +Ref: 17613443380 +Ref: Build<21>-Footnote-13444059 +Ref: Build<21>-Footnote-23444114 +Ref: Build<21>-Footnote-33444169 +Ref: Build<21>-Footnote-43444225 +Node: Windows<19>3444280 +Ref: whatsnew/changelog id1873444385 +Ref: 17633444385 +Ref: Windows<19>-Footnote-13445404 +Ref: Windows<19>-Footnote-23445460 +Ref: Windows<19>-Footnote-33445516 +Ref: Windows<19>-Footnote-43445572 +Ref: Windows<19>-Footnote-53445628 +Ref: Windows<19>-Footnote-63445684 +Ref: Windows<19>-Footnote-73445740 +Ref: Windows<19>-Footnote-83445796 +Node: macOS<14>3445852 +Ref: whatsnew/changelog id1883445957 +Ref: 17643445957 +Ref: macOS<14>-Footnote-13446087 +Node: C API<21>3446143 +Ref: whatsnew/changelog id1893446228 +Ref: 17653446228 +Ref: C API<21>-Footnote-13447325 +Ref: C API<21>-Footnote-23447381 +Ref: C API<21>-Footnote-33447436 +Ref: C API<21>-Footnote-43447492 +Ref: C API<21>-Footnote-53447547 +Node: Python 3 12 0 alpha 53447589 +Ref: whatsnew/changelog python-3-12-0-alpha-53447716 +Ref: 17663447716 +Node: Security<16>3448009 +Ref: whatsnew/changelog id1903448109 +Ref: 17673448109 +Ref: Security<16>-Footnote-13448487 +Ref: Security<16>-Footnote-23448542 +Node: Core and Builtins<25>3448590 +Ref: whatsnew/changelog id1923448710 +Ref: 17683448710 +Ref: Core and Builtins<25>-Footnote-13451808 +Ref: Core and Builtins<25>-Footnote-23451863 +Ref: Core and Builtins<25>-Footnote-33451918 +Ref: Core and Builtins<25>-Footnote-43451974 +Ref: Core and Builtins<25>-Footnote-53452030 +Ref: Core and Builtins<25>-Footnote-63452086 +Ref: Core and Builtins<25>-Footnote-73452142 +Ref: Core and Builtins<25>-Footnote-83452198 +Ref: Core and Builtins<25>-Footnote-93452254 +Ref: Core and Builtins<25>-Footnote-103452310 +Ref: Core and Builtins<25>-Footnote-113452367 +Ref: Core and Builtins<25>-Footnote-123452424 +Ref: Core and Builtins<25>-Footnote-133452481 +Ref: Core and Builtins<25>-Footnote-143452538 +Ref: Core and Builtins<25>-Footnote-153452594 +Ref: Core and Builtins<25>-Footnote-163452651 +Ref: Core and Builtins<25>-Footnote-173452708 +Node: Library<24>3452774 +Ref: whatsnew/changelog id1933452899 +Ref: 176b3452899 +Ref: Library<24>-Footnote-13457960 +Ref: Library<24>-Footnote-23458016 +Ref: Library<24>-Footnote-33458072 +Ref: Library<24>-Footnote-43458128 +Ref: Library<24>-Footnote-53458184 +Ref: Library<24>-Footnote-63458240 +Ref: Library<24>-Footnote-73458295 +Ref: Library<24>-Footnote-83458337 +Ref: Library<24>-Footnote-93458393 +Ref: Library<24>-Footnote-103458449 +Ref: Library<24>-Footnote-113458506 +Ref: Library<24>-Footnote-123458562 +Ref: Library<24>-Footnote-133458619 +Ref: Library<24>-Footnote-143458676 +Ref: Library<24>-Footnote-153458733 +Ref: Library<24>-Footnote-163458789 +Ref: Library<24>-Footnote-173458846 +Ref: Library<24>-Footnote-183458903 +Ref: Library<24>-Footnote-193458959 +Ref: Library<24>-Footnote-203459015 +Ref: Library<24>-Footnote-213459071 +Ref: Library<24>-Footnote-223459127 +Ref: Library<24>-Footnote-233459183 +Ref: Library<24>-Footnote-243459239 +Ref: Library<24>-Footnote-253459295 +Ref: Library<24>-Footnote-263459351 +Ref: Library<24>-Footnote-273459417 +Ref: Library<24>-Footnote-283459483 +Ref: Library<24>-Footnote-293459549 +Node: Documentation<19>3459605 +Ref: whatsnew/changelog id1943459718 +Ref: 17743459718 +Ref: Documentation<19>-Footnote-13460003 +Node: Tests<21>3460058 +Ref: whatsnew/changelog id1953460169 +Ref: 17753460169 +Ref: Tests<21>-Footnote-13460331 +Node: Build<22>3460387 +Ref: whatsnew/changelog id1963460492 +Ref: 17763460492 +Ref: Build<22>-Footnote-13461931 +Ref: Build<22>-Footnote-23461987 +Ref: Build<22>-Footnote-33462043 +Ref: Build<22>-Footnote-43462098 +Ref: Build<22>-Footnote-53462154 +Ref: Build<22>-Footnote-63462196 +Ref: Build<22>-Footnote-73462252 +Ref: Build<22>-Footnote-83462308 +Ref: Build<22>-Footnote-93462363 +Ref: Build<22>-Footnote-103462418 +Node: Windows<20>3462474 +Ref: whatsnew/changelog id1973462561 +Ref: 17773462561 +Ref: Windows<20>-Footnote-13463813 +Ref: Windows<20>-Footnote-23463869 +Ref: Windows<20>-Footnote-33463925 +Ref: Windows<20>-Footnote-43463980 +Ref: Windows<20>-Footnote-53464036 +Ref: Windows<20>-Footnote-63464091 +Ref: Windows<20>-Footnote-73464147 +Node: Python 3 12 0 alpha 43464203 +Ref: whatsnew/changelog python-3-12-0-alpha-43464330 +Ref: 17783464330 +Node: Core and Builtins<26>3464669 +Ref: whatsnew/changelog id1983464768 +Ref: 17793464768 +Ref: Core and Builtins<26>-Footnote-13469685 +Ref: Core and Builtins<26>-Footnote-23469741 +Ref: Core and Builtins<26>-Footnote-33469796 +Ref: Core and Builtins<26>-Footnote-43469851 +Ref: Core and Builtins<26>-Footnote-53469907 +Ref: Core and Builtins<26>-Footnote-63469963 +Ref: Core and Builtins<26>-Footnote-73470019 +Ref: Core and Builtins<26>-Footnote-83470075 +Ref: Core and Builtins<26>-Footnote-93470131 +Ref: Core and Builtins<26>-Footnote-103470187 +Ref: Core and Builtins<26>-Footnote-113470243 +Ref: Core and Builtins<26>-Footnote-123470286 +Ref: Core and Builtins<26>-Footnote-133470343 +Ref: Core and Builtins<26>-Footnote-143470400 +Ref: Core and Builtins<26>-Footnote-153470457 +Ref: Core and Builtins<26>-Footnote-163470514 +Ref: Core and Builtins<26>-Footnote-173470571 +Ref: Core and Builtins<26>-Footnote-183470627 +Ref: Core and Builtins<26>-Footnote-193470684 +Ref: Core and Builtins<26>-Footnote-203470740 +Ref: Core and Builtins<26>-Footnote-213470797 +Ref: Core and Builtins<26>-Footnote-223470853 +Ref: Core and Builtins<26>-Footnote-233470909 +Ref: Core and Builtins<26>-Footnote-243470965 +Ref: Core and Builtins<26>-Footnote-253471022 +Ref: Core and Builtins<26>-Footnote-263471079 +Ref: Core and Builtins<26>-Footnote-273471136 +Ref: Core and Builtins<26>-Footnote-283471193 +Ref: Core and Builtins<26>-Footnote-293471249 +Ref: Core and Builtins<26>-Footnote-303471305 +Ref: Core and Builtins<26>-Footnote-313471361 +Ref: Core and Builtins<26>-Footnote-323471417 +Ref: Core and Builtins<26>-Footnote-333471473 +Ref: Core and Builtins<26>-Footnote-343471529 +Node: Library<25>3471595 +Ref: whatsnew/changelog id1993471720 +Ref: 177d3471720 +Ref: Library<25>-Footnote-13482017 +Ref: Library<25>-Footnote-23482073 +Ref: Library<25>-Footnote-33482129 +Ref: Library<25>-Footnote-43482185 +Ref: Library<25>-Footnote-53482241 +Ref: Library<25>-Footnote-63482296 +Ref: Library<25>-Footnote-73482351 +Ref: Library<25>-Footnote-83482407 +Ref: Library<25>-Footnote-93482463 +Ref: Library<25>-Footnote-103482518 +Ref: Library<25>-Footnote-113482575 +Ref: Library<25>-Footnote-123482631 +Ref: Library<25>-Footnote-133482688 +Ref: Library<25>-Footnote-143482744 +Ref: Library<25>-Footnote-153482800 +Ref: Library<25>-Footnote-163482857 +Ref: Library<25>-Footnote-173482914 +Ref: Library<25>-Footnote-183482971 +Ref: Library<25>-Footnote-193483028 +Ref: Library<25>-Footnote-203483085 +Ref: Library<25>-Footnote-213483142 +Ref: Library<25>-Footnote-223483199 +Ref: Library<25>-Footnote-233483255 +Ref: Library<25>-Footnote-243483312 +Ref: Library<25>-Footnote-253483369 +Ref: Library<25>-Footnote-263483426 +Ref: Library<25>-Footnote-273483482 +Ref: Library<25>-Footnote-283483539 +Ref: Library<25>-Footnote-293483596 +Ref: Library<25>-Footnote-303483653 +Ref: Library<25>-Footnote-313483710 +Ref: Library<25>-Footnote-323483776 +Ref: Library<25>-Footnote-333483833 +Ref: Library<25>-Footnote-343483889 +Ref: Library<25>-Footnote-353483945 +Ref: Library<25>-Footnote-363484001 +Ref: Library<25>-Footnote-373484057 +Ref: Library<25>-Footnote-383484113 +Ref: Library<25>-Footnote-393484169 +Ref: Library<25>-Footnote-403484225 +Ref: Library<25>-Footnote-413484281 +Ref: Library<25>-Footnote-423484337 +Ref: Library<25>-Footnote-433484380 +Ref: Library<25>-Footnote-443484436 +Ref: Library<25>-Footnote-453484492 +Ref: Library<25>-Footnote-463484548 +Ref: Library<25>-Footnote-473484604 +Ref: Library<25>-Footnote-483484660 +Ref: Library<25>-Footnote-493484716 +Ref: Library<25>-Footnote-503484772 +Ref: Library<25>-Footnote-513484828 +Ref: Library<25>-Footnote-523484884 +Ref: Library<25>-Footnote-533484940 +Ref: Library<25>-Footnote-543484996 +Ref: Library<25>-Footnote-553485062 +Ref: Library<25>-Footnote-563485128 +Node: Documentation<20>3485194 +Ref: whatsnew/changelog id2003485307 +Ref: 17873485307 +Ref: Documentation<20>-Footnote-13485890 +Ref: Documentation<20>-Footnote-23485946 +Ref: Documentation<20>-Footnote-33486002 +Node: Tests<22>3486067 +Ref: whatsnew/changelog id2013486178 +Ref: 17893486178 +Ref: Tests<22>-Footnote-13486633 +Ref: Tests<22>-Footnote-23486689 +Ref: Tests<22>-Footnote-33486745 +Node: Build<23>3486800 +Ref: whatsnew/changelog id2023486905 +Ref: 178a3486905 +Ref: Build<23>-Footnote-13487792 +Ref: Build<23>-Footnote-23487848 +Ref: Build<23>-Footnote-33487903 +Node: Windows<21>3487968 +Ref: whatsnew/changelog id2033488073 +Ref: 178b3488073 +Ref: Windows<21>-Footnote-13488998 +Ref: Windows<21>-Footnote-23489054 +Ref: Windows<21>-Footnote-33489109 +Ref: Windows<21>-Footnote-43489164 +Ref: Windows<21>-Footnote-53489219 +Ref: Windows<21>-Footnote-63489284 +Node: macOS<15>3489349 +Ref: whatsnew/changelog id2043489460 +Ref: 178e3489460 +Ref: macOS<15>-Footnote-13489742 +Ref: macOS<15>-Footnote-23489798 +Node: Tools/Demos<12>3489854 +Ref: whatsnew/changelog id2053489963 +Ref: 178f3489963 +Ref: Tools/Demos<12>-Footnote-13490337 +Ref: Tools/Demos<12>-Footnote-23490402 +Node: C API<22>3490458 +Ref: whatsnew/changelog id2063490549 +Ref: 17903490549 +Ref: C API<22>-Footnote-13491116 +Ref: C API<22>-Footnote-23491171 +Ref: C API<22>-Footnote-33491226 +Node: Python 3 12 0 alpha 33491281 +Ref: whatsnew/changelog python-3-12-0-alpha-33491408 +Ref: 17913491408 +Node: Security<17>3491773 +Ref: whatsnew/changelog id2073491873 +Ref: 17923491873 +Ref: Security<17>-Footnote-13492433 +Ref: Security<17>-Footnote-23492489 +Node: Core and Builtins<27>3492544 +Ref: whatsnew/changelog id2083492664 +Ref: 17933492664 +Ref: Core and Builtins<27>-Footnote-13495975 +Ref: Core and Builtins<27>-Footnote-23496030 +Ref: Core and Builtins<27>-Footnote-33496085 +Ref: Core and Builtins<27>-Footnote-43496140 +Ref: Core and Builtins<27>-Footnote-53496195 +Ref: Core and Builtins<27>-Footnote-63496250 +Ref: Core and Builtins<27>-Footnote-73496305 +Ref: Core and Builtins<27>-Footnote-83496360 +Ref: Core and Builtins<27>-Footnote-93496415 +Ref: Core and Builtins<27>-Footnote-103496470 +Ref: Core and Builtins<27>-Footnote-113496526 +Ref: Core and Builtins<27>-Footnote-123496582 +Ref: Core and Builtins<27>-Footnote-133496638 +Ref: Core and Builtins<27>-Footnote-143496694 +Ref: Core and Builtins<27>-Footnote-153496750 +Ref: Core and Builtins<27>-Footnote-163496806 +Ref: Core and Builtins<27>-Footnote-173496872 +Ref: Core and Builtins<27>-Footnote-183496938 +Node: Library<26>3497004 +Ref: whatsnew/changelog id2093497129 +Ref: 17943497129 +Ref: Library<26>-Footnote-13503371 +Ref: Library<26>-Footnote-23503427 +Ref: Library<26>-Footnote-33503482 +Ref: Library<26>-Footnote-43503537 +Ref: Library<26>-Footnote-53503592 +Ref: Library<26>-Footnote-63503647 +Ref: Library<26>-Footnote-73503702 +Ref: Library<26>-Footnote-83503757 +Ref: Library<26>-Footnote-93503812 +Ref: Library<26>-Footnote-103503867 +Ref: Library<26>-Footnote-113503923 +Ref: Library<26>-Footnote-123503979 +Ref: Library<26>-Footnote-133504035 +Ref: Library<26>-Footnote-143504091 +Ref: Library<26>-Footnote-153504147 +Ref: Library<26>-Footnote-163504203 +Ref: Library<26>-Footnote-173504259 +Ref: Library<26>-Footnote-183504315 +Ref: Library<26>-Footnote-193504371 +Ref: Library<26>-Footnote-203504427 +Ref: Library<26>-Footnote-213504483 +Ref: Library<26>-Footnote-223504539 +Ref: Library<26>-Footnote-233504595 +Ref: Library<26>-Footnote-243504651 +Ref: Library<26>-Footnote-253504707 +Ref: Library<26>-Footnote-263504763 +Ref: Library<26>-Footnote-273504819 +Ref: Library<26>-Footnote-283504875 +Ref: Library<26>-Footnote-293504931 +Ref: Library<26>-Footnote-303504987 +Ref: Library<26>-Footnote-313505043 +Ref: Library<26>-Footnote-323505109 +Ref: Library<26>-Footnote-333505175 +Ref: Library<26>-Footnote-343505241 +Node: Documentation<21>3505307 +Ref: whatsnew/changelog id2103505420 +Ref: 17983505420 +Ref: Documentation<21>-Footnote-13506189 +Ref: Documentation<21>-Footnote-23506244 +Ref: Documentation<21>-Footnote-33506296 +Ref: Documentation<21>-Footnote-43506320 +Ref: Documentation<21>-Footnote-53506375 +Ref: Documentation<21>-Footnote-63506430 +Ref: Documentation<21>-Footnote-73506485 +Node: Tests<23>3506550 +Ref: whatsnew/changelog id2113506661 +Ref: 17993506661 +Ref: Tests<23>-Footnote-13507438 +Ref: Tests<23>-Footnote-23507493 +Ref: Tests<23>-Footnote-33507548 +Ref: Tests<23>-Footnote-43507603 +Ref: Tests<23>-Footnote-53507658 +Ref: Tests<23>-Footnote-63507713 +Node: Build<24>3507768 +Ref: whatsnew/changelog id2123507873 +Ref: 179a3507873 +Ref: Build<24>-Footnote-13508837 +Ref: Build<24>-Footnote-23508892 +Ref: Build<24>-Footnote-33508947 +Ref: Build<24>-Footnote-43509002 +Ref: Build<24>-Footnote-53509057 +Node: Windows<22>3509112 +Ref: whatsnew/changelog id2133509217 +Ref: 179b3509217 +Ref: Windows<22>-Footnote-13509751 +Ref: Windows<22>-Footnote-23509806 +Ref: Windows<22>-Footnote-33509861 +Ref: Windows<22>-Footnote-43509916 +Node: macOS<16>3509981 +Ref: whatsnew/changelog id2143510092 +Ref: 179c3510092 +Ref: macOS<16>-Footnote-13510360 +Ref: macOS<16>-Footnote-23510415 +Node: Tools/Demos<13>3510470 +Ref: whatsnew/changelog id2153510579 +Ref: 179d3510579 +Ref: Tools/Demos<13>-Footnote-13511069 +Node: C API<23>3511124 +Ref: whatsnew/changelog id2163511215 +Ref: 179e3511215 +Ref: C API<23>-Footnote-13512036 +Ref: C API<23>-Footnote-23512091 +Ref: C API<23>-Footnote-33512146 +Node: Python 3 12 0 alpha 23512201 +Ref: whatsnew/changelog python-3-12-0-alpha-23512328 +Ref: 17a03512328 +Node: Security<18>3512661 +Ref: whatsnew/changelog id2173512761 +Ref: 17a13512761 +Ref: Security<18>-Footnote-13513894 +Ref: Security<18>-Footnote-23513949 +Ref: Security<18>-Footnote-33514008 +Ref: Security<18>-Footnote-43514067 +Ref: Security<18>-Footnote-53514126 +Node: Core and Builtins<28>3514181 +Ref: whatsnew/changelog id2183514301 +Ref: 17a23514301 +Ref: Core and Builtins<28>-Footnote-13522311 +Ref: Core and Builtins<28>-Footnote-23522366 +Ref: Core and Builtins<28>-Footnote-33522421 +Ref: Core and Builtins<28>-Footnote-43522476 +Ref: Core and Builtins<28>-Footnote-53522531 +Ref: Core and Builtins<28>-Footnote-63522586 +Ref: Core and Builtins<28>-Footnote-73522641 +Ref: Core and Builtins<28>-Footnote-83522696 +Ref: Core and Builtins<28>-Footnote-93522751 +Ref: Core and Builtins<28>-Footnote-103522806 +Ref: Core and Builtins<28>-Footnote-113522862 +Ref: Core and Builtins<28>-Footnote-123522918 +Ref: Core and Builtins<28>-Footnote-133522974 +Ref: Core and Builtins<28>-Footnote-143523030 +Ref: Core and Builtins<28>-Footnote-153523086 +Ref: Core and Builtins<28>-Footnote-163523142 +Ref: Core and Builtins<28>-Footnote-173523198 +Ref: Core and Builtins<28>-Footnote-183523254 +Ref: Core and Builtins<28>-Footnote-193523310 +Ref: Core and Builtins<28>-Footnote-203523366 +Ref: Core and Builtins<28>-Footnote-213523422 +Ref: Core and Builtins<28>-Footnote-223523478 +Ref: Core and Builtins<28>-Footnote-233523534 +Ref: Core and Builtins<28>-Footnote-243523590 +Ref: Core and Builtins<28>-Footnote-253523633 +Ref: Core and Builtins<28>-Footnote-263523689 +Ref: Core and Builtins<28>-Footnote-273523745 +Ref: Core and Builtins<28>-Footnote-283523801 +Ref: Core and Builtins<28>-Footnote-293523857 +Ref: Core and Builtins<28>-Footnote-303523913 +Ref: Core and Builtins<28>-Footnote-313523969 +Ref: Core and Builtins<28>-Footnote-323524025 +Ref: Core and Builtins<28>-Footnote-333524081 +Ref: Core and Builtins<28>-Footnote-343524137 +Ref: Core and Builtins<28>-Footnote-353524193 +Node: Library<27>3524249 +Ref: whatsnew/changelog id2193524374 +Ref: 17aa3524374 +Ref: Library<27>-Footnote-13530184 +Ref: Library<27>-Footnote-23530239 +Ref: Library<27>-Footnote-33530294 +Ref: Library<27>-Footnote-43530349 +Ref: Library<27>-Footnote-53530404 +Ref: Library<27>-Footnote-63530459 +Ref: Library<27>-Footnote-73530514 +Ref: Library<27>-Footnote-83530569 +Ref: Library<27>-Footnote-93530624 +Ref: Library<27>-Footnote-103530679 +Ref: Library<27>-Footnote-113530735 +Ref: Library<27>-Footnote-123530791 +Ref: Library<27>-Footnote-133530834 +Ref: Library<27>-Footnote-143530890 +Ref: Library<27>-Footnote-153530946 +Ref: Library<27>-Footnote-163531002 +Ref: Library<27>-Footnote-173531058 +Ref: Library<27>-Footnote-183531114 +Ref: Library<27>-Footnote-193531170 +Ref: Library<27>-Footnote-203531226 +Ref: Library<27>-Footnote-213531282 +Ref: Library<27>-Footnote-223531338 +Ref: Library<27>-Footnote-233531394 +Ref: Library<27>-Footnote-243531450 +Ref: Library<27>-Footnote-253531506 +Ref: Library<27>-Footnote-263531562 +Ref: Library<27>-Footnote-273531618 +Ref: Library<27>-Footnote-283531674 +Ref: Library<27>-Footnote-293531730 +Ref: Library<27>-Footnote-303531786 +Ref: Library<27>-Footnote-313531842 +Ref: Library<27>-Footnote-323531885 +Ref: Library<27>-Footnote-333531941 +Ref: Library<27>-Footnote-343531997 +Ref: Library<27>-Footnote-353532053 +Ref: Library<27>-Footnote-363532109 +Ref: Library<27>-Footnote-373532152 +Ref: Library<27>-Footnote-383532208 +Ref: Library<27>-Footnote-393532264 +Ref: Library<27>-Footnote-403532330 +Ref: Library<27>-Footnote-413532396 +Node: Documentation<22>3532462 +Ref: whatsnew/changelog id2203532575 +Ref: 17af3532575 +Ref: Documentation<22>-Footnote-13532894 +Ref: Documentation<22>-Footnote-23532949 +Node: Tests<24>3533004 +Ref: whatsnew/changelog id2213533115 +Ref: 17b03533115 +Ref: Tests<24>-Footnote-13534003 +Ref: Tests<24>-Footnote-23534058 +Ref: Tests<24>-Footnote-33534113 +Ref: Tests<24>-Footnote-43534168 +Ref: Tests<24>-Footnote-53534223 +Node: Build<25>3534288 +Ref: whatsnew/changelog id2223534393 +Ref: 17b13534393 +Ref: Build<25>-Footnote-13536086 +Ref: Build<25>-Footnote-23536141 +Ref: Build<25>-Footnote-33536196 +Ref: Build<25>-Footnote-43536251 +Ref: Build<25>-Footnote-53536306 +Ref: Build<25>-Footnote-63536361 +Ref: Build<25>-Footnote-73536416 +Ref: Build<25>-Footnote-83536506 +Ref: Build<25>-Footnote-93536561 +Ref: Build<25>-Footnote-103536616 +Node: Windows<23>3536672 +Ref: whatsnew/changelog id2233536777 +Ref: 17b33536777 +Ref: Windows<23>-Footnote-13537482 +Ref: Windows<23>-Footnote-23537537 +Ref: Windows<23>-Footnote-33537593 +Ref: Windows<23>-Footnote-43537648 +Ref: Windows<23>-Footnote-53537703 +Ref: Windows<23>-Footnote-63537758 +Node: macOS<17>3537813 +Ref: whatsnew/changelog id2243537918 +Ref: 17b43537918 +Ref: macOS<17>-Footnote-13538047 +Node: C API<24>3538102 +Ref: whatsnew/changelog id2253538187 +Ref: 17b53538187 +Ref: C API<24>-Footnote-13540262 +Ref: C API<24>-Footnote-23540317 +Ref: C API<24>-Footnote-33540372 +Ref: C API<24>-Footnote-43540427 +Ref: C API<24>-Footnote-53540482 +Ref: C API<24>-Footnote-63540537 +Ref: C API<24>-Footnote-73540592 +Node: Python 3 12 0 alpha 13540647 +Ref: whatsnew/changelog python-3-12-0-alpha-13540773 +Ref: 17b73540773 +Node: Security<19>3541156 +Ref: whatsnew/changelog id2263541256 +Ref: 17b83541256 +Ref: Security<19>-Footnote-13543093 +Ref: Security<19>-Footnote-23543148 +Ref: Security<19>-Footnote-33543203 +Ref: Security<19>-Footnote-43543275 +Ref: Security<19>-Footnote-53543331 +Ref: Security<19>-Footnote-63543386 +Ref: Security<19>-Footnote-73543441 +Ref: Security<19>-Footnote-83543496 +Node: Core and Builtins<29>3543551 +Ref: whatsnew/changelog id2273543671 +Ref: 17b93543671 +Ref: Core and Builtins<29>-Footnote-13573063 +Ref: Core and Builtins<29>-Footnote-23573118 +Ref: Core and Builtins<29>-Footnote-33573173 +Ref: Core and Builtins<29>-Footnote-43573228 +Ref: Core and Builtins<29>-Footnote-53573283 +Ref: Core and Builtins<29>-Footnote-63573338 +Ref: Core and Builtins<29>-Footnote-73573393 +Ref: Core and Builtins<29>-Footnote-83573448 +Ref: Core and Builtins<29>-Footnote-93573503 +Ref: Core and Builtins<29>-Footnote-103573558 +Ref: Core and Builtins<29>-Footnote-113573614 +Ref: Core and Builtins<29>-Footnote-123573670 +Ref: Core and Builtins<29>-Footnote-133573726 +Ref: Core and Builtins<29>-Footnote-143573782 +Ref: Core and Builtins<29>-Footnote-153573838 +Ref: Core and Builtins<29>-Footnote-163573894 +Ref: Core and Builtins<29>-Footnote-173573950 +Ref: Core and Builtins<29>-Footnote-183574006 +Ref: Core and Builtins<29>-Footnote-193574062 +Ref: Core and Builtins<29>-Footnote-203574118 +Ref: Core and Builtins<29>-Footnote-213574174 +Ref: Core and Builtins<29>-Footnote-223574230 +Ref: Core and Builtins<29>-Footnote-233574286 +Ref: Core and Builtins<29>-Footnote-243574342 +Ref: Core and Builtins<29>-Footnote-253574398 +Ref: Core and Builtins<29>-Footnote-263574454 +Ref: Core and Builtins<29>-Footnote-273574510 +Ref: Core and Builtins<29>-Footnote-283574566 +Ref: Core and Builtins<29>-Footnote-293574622 +Ref: Core and Builtins<29>-Footnote-303574678 +Ref: Core and Builtins<29>-Footnote-313574734 +Ref: Core and Builtins<29>-Footnote-323574790 +Ref: Core and Builtins<29>-Footnote-333574846 +Ref: Core and Builtins<29>-Footnote-343574902 +Ref: Core and Builtins<29>-Footnote-353574958 +Ref: Core and Builtins<29>-Footnote-363575014 +Ref: Core and Builtins<29>-Footnote-373575070 +Ref: Core and Builtins<29>-Footnote-383575126 +Ref: Core and Builtins<29>-Footnote-393575182 +Ref: Core and Builtins<29>-Footnote-403575238 +Ref: Core and Builtins<29>-Footnote-413575294 +Ref: Core and Builtins<29>-Footnote-423575350 +Ref: Core and Builtins<29>-Footnote-433575406 +Ref: Core and Builtins<29>-Footnote-443575462 +Ref: Core and Builtins<29>-Footnote-453575518 +Ref: Core and Builtins<29>-Footnote-463575574 +Ref: Core and Builtins<29>-Footnote-473575630 +Ref: Core and Builtins<29>-Footnote-483575686 +Ref: Core and Builtins<29>-Footnote-493575729 +Ref: Core and Builtins<29>-Footnote-503575785 +Ref: Core and Builtins<29>-Footnote-513575841 +Ref: Core and Builtins<29>-Footnote-523575897 +Ref: Core and Builtins<29>-Footnote-533575953 +Ref: Core and Builtins<29>-Footnote-543576009 +Ref: Core and Builtins<29>-Footnote-553576065 +Ref: Core and Builtins<29>-Footnote-563576121 +Ref: Core and Builtins<29>-Footnote-573576177 +Ref: Core and Builtins<29>-Footnote-583576233 +Ref: Core and Builtins<29>-Footnote-593576289 +Ref: Core and Builtins<29>-Footnote-603576345 +Ref: Core and Builtins<29>-Footnote-613576401 +Ref: Core and Builtins<29>-Footnote-623576457 +Ref: Core and Builtins<29>-Footnote-633576513 +Ref: Core and Builtins<29>-Footnote-643576569 +Ref: Core and Builtins<29>-Footnote-653576625 +Ref: Core and Builtins<29>-Footnote-663576681 +Ref: Core and Builtins<29>-Footnote-673576737 +Ref: Core and Builtins<29>-Footnote-683576793 +Ref: Core and Builtins<29>-Footnote-693576849 +Ref: Core and Builtins<29>-Footnote-703576905 +Ref: Core and Builtins<29>-Footnote-713576961 +Ref: Core and Builtins<29>-Footnote-723577017 +Ref: Core and Builtins<29>-Footnote-733577073 +Ref: Core and Builtins<29>-Footnote-743577129 +Ref: Core and Builtins<29>-Footnote-753577185 +Ref: Core and Builtins<29>-Footnote-763577241 +Ref: Core and Builtins<29>-Footnote-773577297 +Ref: Core and Builtins<29>-Footnote-783577353 +Ref: Core and Builtins<29>-Footnote-793577409 +Ref: Core and Builtins<29>-Footnote-803577465 +Ref: Core and Builtins<29>-Footnote-813577521 +Ref: Core and Builtins<29>-Footnote-823577577 +Ref: Core and Builtins<29>-Footnote-833577633 +Ref: Core and Builtins<29>-Footnote-843577689 +Ref: Core and Builtins<29>-Footnote-853577745 +Ref: Core and Builtins<29>-Footnote-863577801 +Ref: Core and Builtins<29>-Footnote-873577857 +Ref: Core and Builtins<29>-Footnote-883577913 +Ref: Core and Builtins<29>-Footnote-893577969 +Ref: Core and Builtins<29>-Footnote-903578025 +Ref: Core and Builtins<29>-Footnote-913578081 +Ref: Core and Builtins<29>-Footnote-923578137 +Ref: Core and Builtins<29>-Footnote-933578193 +Ref: Core and Builtins<29>-Footnote-943578249 +Ref: Core and Builtins<29>-Footnote-953578305 +Ref: Core and Builtins<29>-Footnote-963578361 +Ref: Core and Builtins<29>-Footnote-973578417 +Ref: Core and Builtins<29>-Footnote-983578473 +Ref: Core and Builtins<29>-Footnote-993578529 +Ref: Core and Builtins<29>-Footnote-1003578585 +Ref: Core and Builtins<29>-Footnote-1013578642 +Ref: Core and Builtins<29>-Footnote-1023578699 +Ref: Core and Builtins<29>-Footnote-1033578756 +Ref: Core and Builtins<29>-Footnote-1043578813 +Ref: Core and Builtins<29>-Footnote-1053578870 +Ref: Core and Builtins<29>-Footnote-1063578927 +Ref: Core and Builtins<29>-Footnote-1073578971 +Ref: Core and Builtins<29>-Footnote-1083579028 +Ref: Core and Builtins<29>-Footnote-1093579085 +Ref: Core and Builtins<29>-Footnote-1103579142 +Ref: Core and Builtins<29>-Footnote-1113579199 +Ref: Core and Builtins<29>-Footnote-1123579256 +Ref: Core and Builtins<29>-Footnote-1133579313 +Ref: Core and Builtins<29>-Footnote-1143579370 +Ref: Core and Builtins<29>-Footnote-1153579427 +Ref: Core and Builtins<29>-Footnote-1163579484 +Ref: Core and Builtins<29>-Footnote-1173579541 +Ref: Core and Builtins<29>-Footnote-1183579598 +Ref: Core and Builtins<29>-Footnote-1193579655 +Ref: Core and Builtins<29>-Footnote-1203579712 +Ref: Core and Builtins<29>-Footnote-1213579769 +Ref: Core and Builtins<29>-Footnote-1223579826 +Ref: Core and Builtins<29>-Footnote-1233579883 +Ref: Core and Builtins<29>-Footnote-1243579940 +Ref: Core and Builtins<29>-Footnote-1253579997 +Ref: Core and Builtins<29>-Footnote-1263580054 +Ref: Core and Builtins<29>-Footnote-1273580111 +Ref: Core and Builtins<29>-Footnote-1283580168 +Ref: Core and Builtins<29>-Footnote-1293580225 +Ref: Core and Builtins<29>-Footnote-1303580282 +Ref: Core and Builtins<29>-Footnote-1313580339 +Ref: Core and Builtins<29>-Footnote-1323580396 +Ref: Core and Builtins<29>-Footnote-1333580453 +Ref: Core and Builtins<29>-Footnote-1343580510 +Ref: Core and Builtins<29>-Footnote-1353580567 +Ref: Core and Builtins<29>-Footnote-1363580624 +Ref: Core and Builtins<29>-Footnote-1373580681 +Ref: Core and Builtins<29>-Footnote-1383580738 +Ref: Core and Builtins<29>-Footnote-1393580795 +Ref: Core and Builtins<29>-Footnote-1403580852 +Ref: Core and Builtins<29>-Footnote-1413580909 +Ref: Core and Builtins<29>-Footnote-1423580966 +Ref: Core and Builtins<29>-Footnote-1433581023 +Ref: Core and Builtins<29>-Footnote-1443581080 +Ref: Core and Builtins<29>-Footnote-1453581137 +Ref: Core and Builtins<29>-Footnote-1463581194 +Ref: Core and Builtins<29>-Footnote-1473581251 +Ref: Core and Builtins<29>-Footnote-1483581308 +Ref: Core and Builtins<29>-Footnote-1493581369 +Ref: Core and Builtins<29>-Footnote-1503581426 +Ref: Core and Builtins<29>-Footnote-1513581483 +Ref: Core and Builtins<29>-Footnote-1523581540 +Ref: Core and Builtins<29>-Footnote-1533581597 +Ref: Core and Builtins<29>-Footnote-1543581654 +Ref: Core and Builtins<29>-Footnote-1553581711 +Ref: Core and Builtins<29>-Footnote-1563581768 +Ref: Core and Builtins<29>-Footnote-1573581825 +Ref: Core and Builtins<29>-Footnote-1583581882 +Ref: Core and Builtins<29>-Footnote-1593581939 +Ref: Core and Builtins<29>-Footnote-1603581996 +Ref: Core and Builtins<29>-Footnote-1613582053 +Ref: Core and Builtins<29>-Footnote-1623582110 +Ref: Core and Builtins<29>-Footnote-1633582167 +Ref: Core and Builtins<29>-Footnote-1643582224 +Ref: Core and Builtins<29>-Footnote-1653582281 +Ref: Core and Builtins<29>-Footnote-1663582338 +Ref: Core and Builtins<29>-Footnote-1673582395 +Ref: Core and Builtins<29>-Footnote-1683582452 +Ref: Core and Builtins<29>-Footnote-1693582509 +Ref: Core and Builtins<29>-Footnote-1703582576 +Ref: Core and Builtins<29>-Footnote-1713582643 +Node: Library<28>3582710 +Ref: whatsnew/changelog id2283582835 +Ref: 17c23582835 +Ref: Library<28>-Footnote-13626182 +Ref: Library<28>-Footnote-23626237 +Ref: Library<28>-Footnote-33626292 +Ref: Library<28>-Footnote-43626347 +Ref: Library<28>-Footnote-53626402 +Ref: Library<28>-Footnote-63626457 +Ref: Library<28>-Footnote-73626512 +Ref: Library<28>-Footnote-83626567 +Ref: Library<28>-Footnote-93626622 +Ref: Library<28>-Footnote-103626677 +Ref: Library<28>-Footnote-113626733 +Ref: Library<28>-Footnote-123626789 +Ref: Library<28>-Footnote-133626845 +Ref: Library<28>-Footnote-143626901 +Ref: Library<28>-Footnote-153626957 +Ref: Library<28>-Footnote-163627013 +Ref: Library<28>-Footnote-173627069 +Ref: Library<28>-Footnote-183627125 +Ref: Library<28>-Footnote-193627181 +Ref: Library<28>-Footnote-203627241 +Ref: Library<28>-Footnote-213627297 +Ref: Library<28>-Footnote-223627353 +Ref: Library<28>-Footnote-233627409 +Ref: Library<28>-Footnote-243627465 +Ref: Library<28>-Footnote-253627521 +Ref: Library<28>-Footnote-263627577 +Ref: Library<28>-Footnote-273627633 +Ref: Library<28>-Footnote-283627689 +Ref: Library<28>-Footnote-293627745 +Ref: Library<28>-Footnote-303627801 +Ref: Library<28>-Footnote-313627857 +Ref: Library<28>-Footnote-323627913 +Ref: Library<28>-Footnote-333627969 +Ref: Library<28>-Footnote-343628025 +Ref: Library<28>-Footnote-353628081 +Ref: Library<28>-Footnote-363628137 +Ref: Library<28>-Footnote-373628193 +Ref: Library<28>-Footnote-383628249 +Ref: Library<28>-Footnote-393628305 +Ref: Library<28>-Footnote-403628361 +Ref: Library<28>-Footnote-413628417 +Ref: Library<28>-Footnote-423628473 +Ref: Library<28>-Footnote-433628529 +Ref: Library<28>-Footnote-443628585 +Ref: Library<28>-Footnote-453628641 +Ref: Library<28>-Footnote-463628697 +Ref: Library<28>-Footnote-473628753 +Ref: Library<28>-Footnote-483628809 +Ref: Library<28>-Footnote-493628865 +Ref: Library<28>-Footnote-503628921 +Ref: Library<28>-Footnote-513628977 +Ref: Library<28>-Footnote-523629033 +Ref: Library<28>-Footnote-533629089 +Ref: Library<28>-Footnote-543629145 +Ref: Library<28>-Footnote-553629201 +Ref: Library<28>-Footnote-563629257 +Ref: Library<28>-Footnote-573629313 +Ref: Library<28>-Footnote-583629369 +Ref: Library<28>-Footnote-593629425 +Ref: Library<28>-Footnote-603629481 +Ref: Library<28>-Footnote-613629537 +Ref: Library<28>-Footnote-623629593 +Ref: Library<28>-Footnote-633629649 +Ref: Library<28>-Footnote-643629705 +Ref: Library<28>-Footnote-653629761 +Ref: Library<28>-Footnote-663629817 +Ref: Library<28>-Footnote-673629873 +Ref: Library<28>-Footnote-683629939 +Ref: Library<28>-Footnote-693629995 +Ref: Library<28>-Footnote-703630051 +Ref: Library<28>-Footnote-713630107 +Ref: Library<28>-Footnote-723630163 +Ref: Library<28>-Footnote-733630219 +Ref: Library<28>-Footnote-743630275 +Ref: Library<28>-Footnote-753630331 +Ref: Library<28>-Footnote-763630387 +Ref: Library<28>-Footnote-773630443 +Ref: Library<28>-Footnote-783630499 +Ref: Library<28>-Footnote-793630555 +Ref: Library<28>-Footnote-803630611 +Ref: Library<28>-Footnote-813630667 +Ref: Library<28>-Footnote-823630723 +Ref: Library<28>-Footnote-833630779 +Ref: Library<28>-Footnote-843630835 +Ref: Library<28>-Footnote-853630891 +Ref: Library<28>-Footnote-863630947 +Ref: Library<28>-Footnote-873631003 +Ref: Library<28>-Footnote-883631059 +Ref: Library<28>-Footnote-893631115 +Ref: Library<28>-Footnote-903631171 +Ref: Library<28>-Footnote-913631227 +Ref: Library<28>-Footnote-923631283 +Ref: Library<28>-Footnote-933631339 +Ref: Library<28>-Footnote-943631395 +Ref: Library<28>-Footnote-953631451 +Ref: Library<28>-Footnote-963631507 +Ref: Library<28>-Footnote-973631563 +Ref: Library<28>-Footnote-983631619 +Ref: Library<28>-Footnote-993631675 +Ref: Library<28>-Footnote-1003631731 +Ref: Library<28>-Footnote-1013631788 +Ref: Library<28>-Footnote-1023631845 +Ref: Library<28>-Footnote-1033631902 +Ref: Library<28>-Footnote-1043631959 +Ref: Library<28>-Footnote-1053632016 +Ref: Library<28>-Footnote-1063632073 +Ref: Library<28>-Footnote-1073632130 +Ref: Library<28>-Footnote-1083632187 +Ref: Library<28>-Footnote-1093632244 +Ref: Library<28>-Footnote-1103632301 +Ref: Library<28>-Footnote-1113632358 +Ref: Library<28>-Footnote-1123632415 +Ref: Library<28>-Footnote-1133632472 +Ref: Library<28>-Footnote-1143632529 +Ref: Library<28>-Footnote-1153632586 +Ref: Library<28>-Footnote-1163632643 +Ref: Library<28>-Footnote-1173632700 +Ref: Library<28>-Footnote-1183632757 +Ref: Library<28>-Footnote-1193632814 +Ref: Library<28>-Footnote-1203632871 +Ref: Library<28>-Footnote-1213632928 +Ref: Library<28>-Footnote-1223632985 +Ref: Library<28>-Footnote-1233633042 +Ref: Library<28>-Footnote-1243633086 +Ref: Library<28>-Footnote-1253633143 +Ref: Library<28>-Footnote-1263633200 +Ref: Library<28>-Footnote-1273633257 +Ref: Library<28>-Footnote-1283633314 +Ref: Library<28>-Footnote-1293633371 +Ref: Library<28>-Footnote-1303633428 +Ref: Library<28>-Footnote-1313633485 +Ref: Library<28>-Footnote-1323633542 +Ref: Library<28>-Footnote-1333633599 +Ref: Library<28>-Footnote-1343633656 +Ref: Library<28>-Footnote-1353633713 +Ref: Library<28>-Footnote-1363633770 +Ref: Library<28>-Footnote-1373633827 +Ref: Library<28>-Footnote-1383633884 +Ref: Library<28>-Footnote-1393633941 +Ref: Library<28>-Footnote-1403633999 +Ref: Library<28>-Footnote-1413634056 +Ref: Library<28>-Footnote-1423634113 +Ref: Library<28>-Footnote-1433634157 +Ref: Library<28>-Footnote-1443634214 +Ref: Library<28>-Footnote-1453634271 +Ref: Library<28>-Footnote-1463634328 +Ref: Library<28>-Footnote-1473634385 +Ref: Library<28>-Footnote-1483634442 +Ref: Library<28>-Footnote-1493634499 +Ref: Library<28>-Footnote-1503634556 +Ref: Library<28>-Footnote-1513634613 +Ref: Library<28>-Footnote-1523634670 +Ref: Library<28>-Footnote-1533634727 +Ref: Library<28>-Footnote-1543634784 +Ref: Library<28>-Footnote-1553634841 +Ref: Library<28>-Footnote-1563634898 +Ref: Library<28>-Footnote-1573634955 +Ref: Library<28>-Footnote-1583635012 +Ref: Library<28>-Footnote-1593635069 +Ref: Library<28>-Footnote-1603635126 +Ref: Library<28>-Footnote-1613635183 +Ref: Library<28>-Footnote-1623635240 +Ref: Library<28>-Footnote-1633635284 +Ref: Library<28>-Footnote-1643635341 +Ref: Library<28>-Footnote-1653635398 +Ref: Library<28>-Footnote-1663635455 +Ref: Library<28>-Footnote-1673635512 +Ref: Library<28>-Footnote-1683635569 +Ref: Library<28>-Footnote-1693635626 +Ref: Library<28>-Footnote-1703635683 +Ref: Library<28>-Footnote-1713635740 +Ref: Library<28>-Footnote-1723635797 +Ref: Library<28>-Footnote-1733635854 +Ref: Library<28>-Footnote-1743635911 +Ref: Library<28>-Footnote-1753635968 +Ref: Library<28>-Footnote-1763636025 +Ref: Library<28>-Footnote-1773636082 +Ref: Library<28>-Footnote-1783636139 +Ref: Library<28>-Footnote-1793636196 +Ref: Library<28>-Footnote-1803636253 +Ref: Library<28>-Footnote-1813636310 +Ref: Library<28>-Footnote-1823636354 +Ref: Library<28>-Footnote-1833636411 +Ref: Library<28>-Footnote-1843636468 +Ref: Library<28>-Footnote-1853636525 +Ref: Library<28>-Footnote-1863636582 +Ref: Library<28>-Footnote-1873636639 +Ref: Library<28>-Footnote-1883636696 +Ref: Library<28>-Footnote-1893636753 +Ref: Library<28>-Footnote-1903636810 +Ref: Library<28>-Footnote-1913636867 +Ref: Library<28>-Footnote-1923636924 +Ref: Library<28>-Footnote-1933636981 +Ref: Library<28>-Footnote-1943637038 +Ref: Library<28>-Footnote-1953637095 +Ref: Library<28>-Footnote-1963637152 +Ref: Library<28>-Footnote-1973637209 +Ref: Library<28>-Footnote-1983637266 +Ref: Library<28>-Footnote-1993637323 +Ref: Library<28>-Footnote-2003637380 +Ref: Library<28>-Footnote-2013637437 +Ref: Library<28>-Footnote-2023637494 +Ref: Library<28>-Footnote-2033637551 +Ref: Library<28>-Footnote-2043637608 +Ref: Library<28>-Footnote-2053637665 +Ref: Library<28>-Footnote-2063637722 +Ref: Library<28>-Footnote-2073637779 +Ref: Library<28>-Footnote-2083637836 +Ref: Library<28>-Footnote-2093637893 +Ref: Library<28>-Footnote-2103637950 +Ref: Library<28>-Footnote-2113638007 +Ref: Library<28>-Footnote-2123638064 +Ref: Library<28>-Footnote-2133638121 +Ref: Library<28>-Footnote-2143638178 +Ref: Library<28>-Footnote-2153638235 +Ref: Library<28>-Footnote-2163638292 +Ref: Library<28>-Footnote-2173638349 +Ref: Library<28>-Footnote-2183638406 +Ref: Library<28>-Footnote-2193638463 +Ref: Library<28>-Footnote-2203638520 +Ref: Library<28>-Footnote-2213638577 +Ref: Library<28>-Footnote-2223638634 +Ref: Library<28>-Footnote-2233638691 +Ref: Library<28>-Footnote-2243638748 +Ref: Library<28>-Footnote-2253638805 +Ref: Library<28>-Footnote-2263638862 +Ref: Library<28>-Footnote-2273638929 +Ref: Library<28>-Footnote-2283638996 +Ref: Library<28>-Footnote-2293639063 +Ref: Library<28>-Footnote-2303639120 +Ref: Library<28>-Footnote-2313639187 +Ref: Library<28>-Footnote-2323639254 +Ref: Library<28>-Footnote-2333639321 +Ref: Library<28>-Footnote-2343639388 +Ref: Library<28>-Footnote-2353639455 +Ref: Library<28>-Footnote-2363639522 +Ref: Library<28>-Footnote-2373639589 +Ref: Library<28>-Footnote-2383639656 +Ref: Library<28>-Footnote-2393639723 +Ref: Library<28>-Footnote-2403639790 +Ref: Library<28>-Footnote-2413639857 +Ref: Library<28>-Footnote-2423639924 +Ref: Library<28>-Footnote-2433639991 +Ref: Library<28>-Footnote-2443640058 +Ref: Library<28>-Footnote-2453640125 +Ref: Library<28>-Footnote-2463640192 +Ref: Library<28>-Footnote-2473640259 +Ref: Library<28>-Footnote-2483640326 +Ref: Library<28>-Footnote-2493640393 +Ref: Library<28>-Footnote-2503640460 +Ref: Library<28>-Footnote-2513640527 +Ref: Library<28>-Footnote-2523640594 +Ref: Library<28>-Footnote-2533640661 +Ref: Library<28>-Footnote-2543640728 +Node: Documentation<23>3640795 +Ref: whatsnew/changelog id2293640908 +Ref: 17df3640908 +Ref: Documentation<23>-Footnote-13644650 +Ref: Documentation<23>-Footnote-23644705 +Ref: Documentation<23>-Footnote-33644760 +Ref: Documentation<23>-Footnote-43644806 +Ref: Documentation<23>-Footnote-53644861 +Ref: Documentation<23>-Footnote-63644916 +Ref: Documentation<23>-Footnote-73644971 +Ref: Documentation<23>-Footnote-83645026 +Ref: Documentation<23>-Footnote-93645081 +Ref: Documentation<23>-Footnote-103645136 +Ref: Documentation<23>-Footnote-113645192 +Ref: Documentation<23>-Footnote-123645248 +Ref: Documentation<23>-Footnote-133645304 +Ref: Documentation<23>-Footnote-143645360 +Ref: Documentation<23>-Footnote-153645403 +Ref: Documentation<23>-Footnote-163645459 +Ref: Documentation<23>-Footnote-173645515 +Ref: Documentation<23>-Footnote-183645571 +Ref: Documentation<23>-Footnote-193645627 +Ref: Documentation<23>-Footnote-203645683 +Ref: Documentation<23>-Footnote-213645739 +Ref: Documentation<23>-Footnote-223645795 +Ref: Documentation<23>-Footnote-233645851 +Ref: Documentation<23>-Footnote-243645917 +Ref: Documentation<23>-Footnote-253645983 +Ref: Documentation<23>-Footnote-263646049 +Ref: Documentation<23>-Footnote-273646115 +Node: Tests<25>3646181 +Ref: whatsnew/changelog id2303646292 +Ref: 17e63646292 +Ref: Tests<25>-Footnote-13651675 +Ref: Tests<25>-Footnote-23651730 +Ref: Tests<25>-Footnote-33651785 +Ref: Tests<25>-Footnote-43651840 +Ref: Tests<25>-Footnote-53651895 +Ref: Tests<25>-Footnote-63651982 +Ref: Tests<25>-Footnote-73652037 +Ref: Tests<25>-Footnote-83652092 +Ref: Tests<25>-Footnote-93652147 +Ref: Tests<25>-Footnote-103652202 +Ref: Tests<25>-Footnote-113652258 +Ref: Tests<25>-Footnote-123652314 +Ref: Tests<25>-Footnote-133652370 +Ref: Tests<25>-Footnote-143652426 +Ref: Tests<25>-Footnote-153652482 +Ref: Tests<25>-Footnote-163652538 +Ref: Tests<25>-Footnote-173652594 +Ref: Tests<25>-Footnote-183652650 +Ref: Tests<25>-Footnote-193652706 +Ref: Tests<25>-Footnote-203652762 +Ref: Tests<25>-Footnote-213652818 +Ref: Tests<25>-Footnote-223652874 +Ref: Tests<25>-Footnote-233652930 +Ref: Tests<25>-Footnote-243652986 +Ref: Tests<25>-Footnote-253653042 +Ref: Tests<25>-Footnote-263653098 +Ref: Tests<25>-Footnote-273653154 +Ref: Tests<25>-Footnote-283653210 +Ref: Tests<25>-Footnote-293653266 +Ref: Tests<25>-Footnote-303653322 +Ref: Tests<25>-Footnote-313653378 +Ref: Tests<25>-Footnote-323653434 +Ref: Tests<25>-Footnote-333653490 +Ref: Tests<25>-Footnote-343653546 +Ref: Tests<25>-Footnote-353653602 +Ref: Tests<25>-Footnote-363653658 +Node: Build<26>3653724 +Ref: whatsnew/changelog id2313653829 +Ref: 17ea3653829 +Ref: Build<26>-Footnote-13659312 +Ref: Build<26>-Footnote-23659367 +Ref: Build<26>-Footnote-33659422 +Ref: Build<26>-Footnote-43659477 +Ref: Build<26>-Footnote-53659532 +Ref: Build<26>-Footnote-63659587 +Ref: Build<26>-Footnote-73659642 +Ref: Build<26>-Footnote-83659697 +Ref: Build<26>-Footnote-93659752 +Ref: Build<26>-Footnote-103659807 +Ref: Build<26>-Footnote-113659863 +Ref: Build<26>-Footnote-123659919 +Ref: Build<26>-Footnote-133659975 +Ref: Build<26>-Footnote-143660031 +Ref: Build<26>-Footnote-153660087 +Ref: Build<26>-Footnote-163660143 +Ref: Build<26>-Footnote-173660186 +Ref: Build<26>-Footnote-183660242 +Ref: Build<26>-Footnote-193660298 +Ref: Build<26>-Footnote-203660354 +Ref: Build<26>-Footnote-213660410 +Ref: Build<26>-Footnote-223660466 +Ref: Build<26>-Footnote-233660522 +Ref: Build<26>-Footnote-243660578 +Ref: Build<26>-Footnote-253660634 +Ref: Build<26>-Footnote-263660690 +Ref: Build<26>-Footnote-273660746 +Ref: Build<26>-Footnote-283660802 +Ref: Build<26>-Footnote-293660858 +Ref: Build<26>-Footnote-303660914 +Ref: Build<26>-Footnote-313660970 +Ref: Build<26>-Footnote-323661013 +Ref: Build<26>-Footnote-333661069 +Ref: Build<26>-Footnote-343661125 +Ref: Build<26>-Footnote-353661181 +Ref: Build<26>-Footnote-363661237 +Node: Windows<24>3661303 +Ref: whatsnew/changelog id2323661408 +Ref: 17eb3661408 +Ref: Windows<24>-Footnote-13665839 +Ref: Windows<24>-Footnote-23665894 +Ref: Windows<24>-Footnote-33665949 +Ref: Windows<24>-Footnote-43666004 +Ref: Windows<24>-Footnote-53666059 +Ref: Windows<24>-Footnote-63666114 +Ref: Windows<24>-Footnote-73666169 +Ref: Windows<24>-Footnote-83666224 +Ref: Windows<24>-Footnote-93666279 +Ref: Windows<24>-Footnote-103666334 +Ref: Windows<24>-Footnote-113666390 +Ref: Windows<24>-Footnote-123666446 +Ref: Windows<24>-Footnote-133666502 +Ref: Windows<24>-Footnote-143666558 +Ref: Windows<24>-Footnote-153666614 +Ref: Windows<24>-Footnote-163666670 +Ref: Windows<24>-Footnote-173666726 +Ref: Windows<24>-Footnote-183666782 +Ref: Windows<24>-Footnote-193666838 +Ref: Windows<24>-Footnote-203666894 +Ref: Windows<24>-Footnote-213666950 +Ref: Windows<24>-Footnote-223667006 +Ref: Windows<24>-Footnote-233667062 +Ref: Windows<24>-Footnote-243667118 +Ref: Windows<24>-Footnote-253667174 +Ref: Windows<24>-Footnote-263667230 +Ref: Windows<24>-Footnote-273667296 +Ref: Windows<24>-Footnote-283667352 +Ref: Windows<24>-Footnote-293667418 +Node: macOS<18>3667484 +Ref: whatsnew/changelog id2333667588 +Ref: 17ed3667588 +Ref: macOS<18>-Footnote-13668138 +Node: IDLE<17>3668193 +Ref: whatsnew/changelog id2343668301 +Ref: 17ee3668301 +Ref: IDLE<17>-Footnote-13669214 +Ref: IDLE<17>-Footnote-23669269 +Ref: IDLE<17>-Footnote-33669324 +Ref: IDLE<17>-Footnote-43669379 +Ref: IDLE<17>-Footnote-53669434 +Ref: IDLE<17>-Footnote-63669489 +Ref: IDLE<17>-Footnote-73669544 +Node: Tools/Demos<14>3669599 +Ref: whatsnew/changelog id2353669707 +Ref: 17ef3669707 +Ref: Tools/Demos<14>-Footnote-13671218 +Ref: Tools/Demos<14>-Footnote-23671273 +Ref: Tools/Demos<14>-Footnote-33671328 +Ref: Tools/Demos<14>-Footnote-43671376 +Ref: Tools/Demos<14>-Footnote-53671431 +Ref: Tools/Demos<14>-Footnote-63671479 +Ref: Tools/Demos<14>-Footnote-73671534 +Ref: Tools/Demos<14>-Footnote-83671589 +Ref: Tools/Demos<14>-Footnote-93671644 +Ref: Tools/Demos<14>-Footnote-103671699 +Ref: Tools/Demos<14>-Footnote-113671755 +Ref: Tools/Demos<14>-Footnote-123671811 +Node: C API<25>3671867 +Ref: whatsnew/changelog id2373671958 +Ref: 17f03671958 +Ref: C API<25>-Footnote-13679504 +Ref: C API<25>-Footnote-23679559 +Ref: C API<25>-Footnote-33679614 +Ref: C API<25>-Footnote-43679669 +Ref: C API<25>-Footnote-53679724 +Ref: C API<25>-Footnote-63679779 +Ref: C API<25>-Footnote-73679834 +Ref: C API<25>-Footnote-83679889 +Ref: C API<25>-Footnote-93679944 +Ref: C API<25>-Footnote-103679999 +Ref: C API<25>-Footnote-113680055 +Ref: C API<25>-Footnote-123680111 +Ref: C API<25>-Footnote-133680167 +Ref: C API<25>-Footnote-143680223 +Ref: C API<25>-Footnote-153680279 +Ref: C API<25>-Footnote-163680335 +Ref: C API<25>-Footnote-173680391 +Ref: C API<25>-Footnote-183680447 +Ref: C API<25>-Footnote-193680503 +Ref: C API<25>-Footnote-203680559 +Ref: C API<25>-Footnote-213680615 +Ref: C API<25>-Footnote-223680671 +Ref: C API<25>-Footnote-233680727 +Ref: C API<25>-Footnote-243680783 +Ref: C API<25>-Footnote-253680839 +Ref: C API<25>-Footnote-263680895 +Ref: C API<25>-Footnote-273680951 +Ref: C API<25>-Footnote-283681007 +Ref: C API<25>-Footnote-293681063 +Ref: C API<25>-Footnote-303681119 +Ref: C API<25>-Footnote-313681175 +Ref: C API<25>-Footnote-323681231 +Ref: C API<25>-Footnote-333681287 +Ref: C API<25>-Footnote-343681343 +Node: Python 3 11 0 beta 13681409 +Ref: whatsnew/changelog python-3-11-0-beta-13681535 +Ref: 17f23681535 +Node: Security<20>3681898 +Ref: whatsnew/changelog id2383681997 +Ref: 17f33681997 +Ref: Security<20>-Footnote-13682296 +Node: Core and Builtins<30>3682351 +Ref: whatsnew/changelog id2393682470 +Ref: 17f43682470 +Ref: Core and Builtins<30>-Footnote-13691984 +Ref: Core and Builtins<30>-Footnote-23692039 +Ref: Core and Builtins<30>-Footnote-33692104 +Ref: Core and Builtins<30>-Footnote-43692159 +Ref: Core and Builtins<30>-Footnote-53692224 +Ref: Core and Builtins<30>-Footnote-63692279 +Ref: Core and Builtins<30>-Footnote-73692334 +Ref: Core and Builtins<30>-Footnote-83692389 +Ref: Core and Builtins<30>-Footnote-93692444 +Ref: Core and Builtins<30>-Footnote-103692499 +Ref: Core and Builtins<30>-Footnote-113692555 +Ref: Core and Builtins<30>-Footnote-123692611 +Ref: Core and Builtins<30>-Footnote-133692667 +Ref: Core and Builtins<30>-Footnote-143692723 +Ref: Core and Builtins<30>-Footnote-153692766 +Ref: Core and Builtins<30>-Footnote-163692822 +Ref: Core and Builtins<30>-Footnote-173692878 +Ref: Core and Builtins<30>-Footnote-183692934 +Ref: Core and Builtins<30>-Footnote-193692990 +Ref: Core and Builtins<30>-Footnote-203693046 +Ref: Core and Builtins<30>-Footnote-213693102 +Ref: Core and Builtins<30>-Footnote-223693168 +Ref: Core and Builtins<30>-Footnote-233693224 +Ref: Core and Builtins<30>-Footnote-243693280 +Ref: Core and Builtins<30>-Footnote-253693336 +Ref: Core and Builtins<30>-Footnote-263693392 +Ref: Core and Builtins<30>-Footnote-273693448 +Ref: Core and Builtins<30>-Footnote-283693504 +Ref: Core and Builtins<30>-Footnote-293693560 +Ref: Core and Builtins<30>-Footnote-303693616 +Ref: Core and Builtins<30>-Footnote-313693672 +Ref: Core and Builtins<30>-Footnote-323693728 +Ref: Core and Builtins<30>-Footnote-333693771 +Ref: Core and Builtins<30>-Footnote-343693827 +Ref: Core and Builtins<30>-Footnote-353693883 +Ref: Core and Builtins<30>-Footnote-363693939 +Ref: Core and Builtins<30>-Footnote-373694005 +Ref: Core and Builtins<30>-Footnote-383694061 +Ref: Core and Builtins<30>-Footnote-393694117 +Ref: Core and Builtins<30>-Footnote-403694183 +Ref: Core and Builtins<30>-Footnote-413694249 +Ref: Core and Builtins<30>-Footnote-423694315 +Ref: Core and Builtins<30>-Footnote-433694381 +Ref: Core and Builtins<30>-Footnote-443694447 +Ref: Core and Builtins<30>-Footnote-453694513 +Ref: Core and Builtins<30>-Footnote-463694579 +Ref: Core and Builtins<30>-Footnote-473694645 +Ref: Core and Builtins<30>-Footnote-483694711 +Ref: Core and Builtins<30>-Footnote-493694777 +Ref: Core and Builtins<30>-Footnote-503694843 +Ref: Core and Builtins<30>-Footnote-513694909 +Ref: Core and Builtins<30>-Footnote-523694975 +Ref: Core and Builtins<30>-Footnote-533695041 +Ref: Core and Builtins<30>-Footnote-543695107 +Node: Library<29>3695173 +Ref: whatsnew/changelog id2403695297 +Ref: 17f93695297 +Ref: Library<29>-Footnote-13712842 +Ref: Library<29>-Footnote-23712897 +Ref: Library<29>-Footnote-33712952 +Ref: Library<29>-Footnote-43713007 +Ref: Library<29>-Footnote-53713062 +Ref: Library<29>-Footnote-63713117 +Ref: Library<29>-Footnote-73713172 +Ref: Library<29>-Footnote-83713227 +Ref: Library<29>-Footnote-93713282 +Ref: Library<29>-Footnote-103713337 +Ref: Library<29>-Footnote-113713393 +Ref: Library<29>-Footnote-123713449 +Ref: Library<29>-Footnote-133713505 +Ref: Library<29>-Footnote-143713561 +Ref: Library<29>-Footnote-153713617 +Ref: Library<29>-Footnote-163713673 +Ref: Library<29>-Footnote-173713729 +Ref: Library<29>-Footnote-183713785 +Ref: Library<29>-Footnote-193713841 +Ref: Library<29>-Footnote-203713897 +Ref: Library<29>-Footnote-213713953 +Ref: Library<29>-Footnote-223714009 +Ref: Library<29>-Footnote-233714065 +Ref: Library<29>-Footnote-243714121 +Ref: Library<29>-Footnote-253714187 +Ref: Library<29>-Footnote-263714243 +Ref: Library<29>-Footnote-273714299 +Ref: Library<29>-Footnote-283714342 +Ref: Library<29>-Footnote-293714398 +Ref: Library<29>-Footnote-303714454 +Ref: Library<29>-Footnote-313714510 +Ref: Library<29>-Footnote-323714566 +Ref: Library<29>-Footnote-333714609 +Ref: Library<29>-Footnote-343714665 +Ref: Library<29>-Footnote-353714721 +Ref: Library<29>-Footnote-363714777 +Ref: Library<29>-Footnote-373714833 +Ref: Library<29>-Footnote-383714889 +Ref: Library<29>-Footnote-393714945 +Ref: Library<29>-Footnote-403715001 +Ref: Library<29>-Footnote-413715057 +Ref: Library<29>-Footnote-423715113 +Ref: Library<29>-Footnote-433715169 +Ref: Library<29>-Footnote-443715225 +Ref: Library<29>-Footnote-453715281 +Ref: Library<29>-Footnote-463715337 +Ref: Library<29>-Footnote-473715393 +Ref: Library<29>-Footnote-483715449 +Ref: Library<29>-Footnote-493715505 +Ref: Library<29>-Footnote-503715561 +Ref: Library<29>-Footnote-513715617 +Ref: Library<29>-Footnote-523715673 +Ref: Library<29>-Footnote-533715729 +Ref: Library<29>-Footnote-543715785 +Ref: Library<29>-Footnote-553715841 +Ref: Library<29>-Footnote-563715897 +Ref: Library<29>-Footnote-573715963 +Ref: Library<29>-Footnote-583716019 +Ref: Library<29>-Footnote-593716075 +Ref: Library<29>-Footnote-603716131 +Ref: Library<29>-Footnote-613716187 +Ref: Library<29>-Footnote-623716243 +Ref: Library<29>-Footnote-633716299 +Ref: Library<29>-Footnote-643716355 +Ref: Library<29>-Footnote-653716411 +Ref: Library<29>-Footnote-663716467 +Ref: Library<29>-Footnote-673716510 +Ref: Library<29>-Footnote-683716566 +Ref: Library<29>-Footnote-693716622 +Ref: Library<29>-Footnote-703716678 +Ref: Library<29>-Footnote-713716734 +Ref: Library<29>-Footnote-723716790 +Ref: Library<29>-Footnote-733716846 +Ref: Library<29>-Footnote-743716902 +Ref: Library<29>-Footnote-753716958 +Ref: Library<29>-Footnote-763717024 +Ref: Library<29>-Footnote-773717080 +Ref: Library<29>-Footnote-783717136 +Ref: Library<29>-Footnote-793717192 +Ref: Library<29>-Footnote-803717258 +Ref: Library<29>-Footnote-813717324 +Ref: Library<29>-Footnote-823717367 +Ref: Library<29>-Footnote-833717433 +Ref: Library<29>-Footnote-843717499 +Ref: Library<29>-Footnote-853717565 +Ref: Library<29>-Footnote-863717631 +Ref: Library<29>-Footnote-873717697 +Ref: Library<29>-Footnote-883717763 +Ref: Library<29>-Footnote-893717829 +Ref: Library<29>-Footnote-903717895 +Ref: Library<29>-Footnote-913717961 +Ref: Library<29>-Footnote-923718027 +Ref: Library<29>-Footnote-933718093 +Ref: Library<29>-Footnote-943718159 +Ref: Library<29>-Footnote-953718225 +Ref: Library<29>-Footnote-963718291 +Ref: Library<29>-Footnote-973718357 +Ref: Library<29>-Footnote-983718423 +Ref: Library<29>-Footnote-993718489 +Ref: Library<29>-Footnote-1003718555 +Ref: Library<29>-Footnote-1013718622 +Ref: Library<29>-Footnote-1023718689 +Ref: Library<29>-Footnote-1033718756 +Ref: Library<29>-Footnote-1043718823 +Ref: Library<29>-Footnote-1053718890 +Ref: Library<29>-Footnote-1063718957 +Ref: Library<29>-Footnote-1073719024 +Ref: Library<29>-Footnote-1083719091 +Ref: Library<29>-Footnote-1093719158 +Ref: Library<29>-Footnote-1103719225 +Ref: Library<29>-Footnote-1113719292 +Ref: Library<29>-Footnote-1123719359 +Ref: Library<29>-Footnote-1133719426 +Ref: Library<29>-Footnote-1143719493 +Ref: Library<29>-Footnote-1153719560 +Ref: Library<29>-Footnote-1163719627 +Ref: Library<29>-Footnote-1173719694 +Ref: Library<29>-Footnote-1183719761 +Ref: Library<29>-Footnote-1193719828 +Ref: Library<29>-Footnote-1203719895 +Node: Documentation<24>3719962 +Ref: whatsnew/changelog id2413720074 +Ref: 18093720074 +Ref: Documentation<24>-Footnote-13721632 +Ref: Documentation<24>-Footnote-23721687 +Ref: Documentation<24>-Footnote-33721742 +Ref: Documentation<24>-Footnote-43721797 +Ref: Documentation<24>-Footnote-53721852 +Ref: Documentation<24>-Footnote-63721917 +Ref: Documentation<24>-Footnote-73721982 +Ref: Documentation<24>-Footnote-83722047 +Ref: Documentation<24>-Footnote-93722112 +Ref: Documentation<24>-Footnote-103722154 +Ref: Documentation<24>-Footnote-113722197 +Ref: Documentation<24>-Footnote-123722263 +Ref: Documentation<24>-Footnote-133722329 +Ref: Documentation<24>-Footnote-143722394 +Node: Tests<26>3722460 +Ref: whatsnew/changelog id2423722570 +Ref: 180c3722570 +Ref: Tests<26>-Footnote-13723912 +Ref: Tests<26>-Footnote-23723967 +Ref: Tests<26>-Footnote-33724022 +Ref: Tests<26>-Footnote-43724077 +Ref: Tests<26>-Footnote-53724132 +Ref: Tests<26>-Footnote-63724187 +Ref: Tests<26>-Footnote-73724252 +Ref: Tests<26>-Footnote-83724317 +Node: Build<27>3724382 +Ref: whatsnew/changelog id2433724486 +Ref: 180f3724486 +Ref: Build<27>-Footnote-13725113 +Ref: Build<27>-Footnote-23725168 +Ref: Build<27>-Footnote-33725223 +Ref: Build<27>-Footnote-43725288 +Node: Windows<25>3725353 +Ref: whatsnew/changelog id2443725457 +Ref: 18103725457 +Ref: Windows<25>-Footnote-13726091 +Ref: Windows<25>-Footnote-23726156 +Ref: Windows<25>-Footnote-33726221 +Ref: Windows<25>-Footnote-43726286 +Ref: Windows<25>-Footnote-53726351 +Node: macOS<19>3726416 +Ref: whatsnew/changelog id2453726526 +Ref: 18113726526 +Ref: macOS<19>-Footnote-13726656 +Node: Tools/Demos<15>3726721 +Ref: whatsnew/changelog id2463726829 +Ref: 18123726829 +Ref: Tools/Demos<15>-Footnote-13727386 +Ref: Tools/Demos<15>-Footnote-23727441 +Ref: Tools/Demos<15>-Footnote-33727496 +Node: C API<26>3727551 +Ref: whatsnew/changelog id2473727641 +Ref: 18133727641 +Ref: C API<26>-Footnote-13729792 +Ref: C API<26>-Footnote-23729847 +Ref: C API<26>-Footnote-33729902 +Ref: C API<26>-Footnote-43729957 +Ref: C API<26>-Footnote-53730012 +Ref: C API<26>-Footnote-63730067 +Ref: C API<26>-Footnote-73730109 +Ref: C API<26>-Footnote-83730164 +Ref: C API<26>-Footnote-93730219 +Ref: C API<26>-Footnote-103730284 +Ref: C API<26>-Footnote-113730350 +Ref: C API<26>-Footnote-123730416 +Ref: C API<26>-Footnote-133730482 +Node: Python 3 11 0 alpha 73730548 +Ref: whatsnew/changelog python-3-11-0-alpha-73730674 +Ref: 18163730674 +Node: Core and Builtins<31>3731013 +Ref: whatsnew/changelog id2483731112 +Ref: 18173731112 +Ref: Core and Builtins<31>-Footnote-13736681 +Ref: Core and Builtins<31>-Footnote-23736746 +Ref: Core and Builtins<31>-Footnote-33736811 +Ref: Core and Builtins<31>-Footnote-43736876 +Ref: Core and Builtins<31>-Footnote-53736941 +Ref: Core and Builtins<31>-Footnote-63737006 +Ref: Core and Builtins<31>-Footnote-73737071 +Ref: Core and Builtins<31>-Footnote-83737136 +Ref: Core and Builtins<31>-Footnote-93737201 +Ref: Core and Builtins<31>-Footnote-103737266 +Ref: Core and Builtins<31>-Footnote-113737332 +Ref: Core and Builtins<31>-Footnote-123737398 +Ref: Core and Builtins<31>-Footnote-133737464 +Ref: Core and Builtins<31>-Footnote-143737530 +Ref: Core and Builtins<31>-Footnote-153737596 +Ref: Core and Builtins<31>-Footnote-163737662 +Ref: Core and Builtins<31>-Footnote-173737728 +Ref: Core and Builtins<31>-Footnote-183737794 +Ref: Core and Builtins<31>-Footnote-193737860 +Ref: Core and Builtins<31>-Footnote-203737926 +Ref: Core and Builtins<31>-Footnote-213737992 +Ref: Core and Builtins<31>-Footnote-223738058 +Ref: Core and Builtins<31>-Footnote-233738124 +Ref: Core and Builtins<31>-Footnote-243738190 +Ref: Core and Builtins<31>-Footnote-253738256 +Ref: Core and Builtins<31>-Footnote-263738322 +Ref: Core and Builtins<31>-Footnote-273738388 +Ref: Core and Builtins<31>-Footnote-283738454 +Ref: Core and Builtins<31>-Footnote-293738520 +Ref: Core and Builtins<31>-Footnote-303738586 +Ref: Core and Builtins<31>-Footnote-313738652 +Ref: Core and Builtins<31>-Footnote-323738718 +Ref: Core and Builtins<31>-Footnote-333738784 +Node: Library<30>3738850 +Ref: whatsnew/changelog id2493738975 +Ref: 181b3738975 +Ref: Library<30>-Footnote-13753177 +Ref: Library<30>-Footnote-23753242 +Ref: Library<30>-Footnote-33753307 +Ref: Library<30>-Footnote-43753372 +Ref: Library<30>-Footnote-53753437 +Ref: Library<30>-Footnote-63753502 +Ref: Library<30>-Footnote-73753566 +Ref: Library<30>-Footnote-83753631 +Ref: Library<30>-Footnote-93753696 +Ref: Library<30>-Footnote-103753761 +Ref: Library<30>-Footnote-113753827 +Ref: Library<30>-Footnote-123753893 +Ref: Library<30>-Footnote-133753959 +Ref: Library<30>-Footnote-143754025 +Ref: Library<30>-Footnote-153754068 +Ref: Library<30>-Footnote-163754134 +Ref: Library<30>-Footnote-173754200 +Ref: Library<30>-Footnote-183754266 +Ref: Library<30>-Footnote-193754309 +Ref: Library<30>-Footnote-203754375 +Ref: Library<30>-Footnote-213754441 +Ref: Library<30>-Footnote-223754507 +Ref: Library<30>-Footnote-233754550 +Ref: Library<30>-Footnote-243754616 +Ref: Library<30>-Footnote-253754682 +Ref: Library<30>-Footnote-263754748 +Ref: Library<30>-Footnote-273754814 +Ref: Library<30>-Footnote-283754880 +Ref: Library<30>-Footnote-293754946 +Ref: Library<30>-Footnote-303755013 +Ref: Library<30>-Footnote-313755079 +Ref: Library<30>-Footnote-323755145 +Ref: Library<30>-Footnote-333755211 +Ref: Library<30>-Footnote-343755277 +Ref: Library<30>-Footnote-353755320 +Ref: Library<30>-Footnote-363755386 +Ref: Library<30>-Footnote-373755452 +Ref: Library<30>-Footnote-383755517 +Ref: Library<30>-Footnote-393755583 +Ref: Library<30>-Footnote-403755649 +Ref: Library<30>-Footnote-413755715 +Ref: Library<30>-Footnote-423755781 +Ref: Library<30>-Footnote-433755824 +Ref: Library<30>-Footnote-443755890 +Ref: Library<30>-Footnote-453755956 +Ref: Library<30>-Footnote-463756022 +Ref: Library<30>-Footnote-473756088 +Ref: Library<30>-Footnote-483756154 +Ref: Library<30>-Footnote-493756220 +Ref: Library<30>-Footnote-503756286 +Ref: Library<30>-Footnote-513756352 +Ref: Library<30>-Footnote-523756418 +Ref: Library<30>-Footnote-533756484 +Ref: Library<30>-Footnote-543756550 +Ref: Library<30>-Footnote-553756616 +Ref: Library<30>-Footnote-563756682 +Ref: Library<30>-Footnote-573756748 +Ref: Library<30>-Footnote-583756814 +Ref: Library<30>-Footnote-593756880 +Ref: Library<30>-Footnote-603756923 +Ref: Library<30>-Footnote-613756990 +Ref: Library<30>-Footnote-623757056 +Ref: Library<30>-Footnote-633757122 +Ref: Library<30>-Footnote-643757188 +Ref: Library<30>-Footnote-653757254 +Ref: Library<30>-Footnote-663757320 +Ref: Library<30>-Footnote-673757386 +Ref: Library<30>-Footnote-683757452 +Ref: Library<30>-Footnote-693757518 +Ref: Library<30>-Footnote-703757584 +Ref: Library<30>-Footnote-713757650 +Ref: Library<30>-Footnote-723757716 +Ref: Library<30>-Footnote-733757782 +Ref: Library<30>-Footnote-743757848 +Ref: Library<30>-Footnote-753757914 +Ref: Library<30>-Footnote-763757980 +Ref: Library<30>-Footnote-773758046 +Ref: Library<30>-Footnote-783758112 +Ref: Library<30>-Footnote-793758178 +Ref: Library<30>-Footnote-803758244 +Ref: Library<30>-Footnote-813758310 +Ref: Library<30>-Footnote-823758376 +Ref: Library<30>-Footnote-833758442 +Ref: Library<30>-Footnote-843758485 +Ref: Library<30>-Footnote-853758551 +Ref: Library<30>-Footnote-863758617 +Ref: Library<30>-Footnote-873758683 +Ref: Library<30>-Footnote-883758749 +Node: Documentation<25>3758815 +Ref: whatsnew/changelog id2503758928 +Ref: 18283758928 +Ref: Documentation<25>-Footnote-13760066 +Ref: Documentation<25>-Footnote-23760131 +Ref: Documentation<25>-Footnote-33760196 +Ref: Documentation<25>-Footnote-43760238 +Ref: Documentation<25>-Footnote-53760303 +Ref: Documentation<25>-Footnote-63760368 +Ref: Documentation<25>-Footnote-73760433 +Ref: Documentation<25>-Footnote-83760498 +Node: Tests<27>3760563 +Ref: whatsnew/changelog id2513760674 +Ref: 182b3760674 +Ref: Tests<27>-Footnote-13761643 +Ref: Tests<27>-Footnote-23761708 +Ref: Tests<27>-Footnote-33761773 +Ref: Tests<27>-Footnote-43761838 +Ref: Tests<27>-Footnote-53761903 +Ref: Tests<27>-Footnote-63761968 +Ref: Tests<27>-Footnote-73762033 +Ref: Tests<27>-Footnote-83762098 +Node: Build<28>3762140 +Ref: whatsnew/changelog id2523762245 +Ref: 182c3762245 +Ref: Build<28>-Footnote-13763533 +Ref: Build<28>-Footnote-23763598 +Ref: Build<28>-Footnote-33763663 +Ref: Build<28>-Footnote-43763728 +Ref: Build<28>-Footnote-53763793 +Ref: Build<28>-Footnote-63763858 +Ref: Build<28>-Footnote-73763923 +Ref: Build<28>-Footnote-83763988 +Ref: Build<28>-Footnote-93764053 +Node: Windows<26>3764118 +Ref: whatsnew/changelog id2533764223 +Ref: 182e3764223 +Ref: Windows<26>-Footnote-13765414 +Ref: Windows<26>-Footnote-23765479 +Ref: Windows<26>-Footnote-33765535 +Ref: Windows<26>-Footnote-43765600 +Ref: Windows<26>-Footnote-53765665 +Ref: Windows<26>-Footnote-63765707 +Ref: Windows<26>-Footnote-73765772 +Ref: Windows<26>-Footnote-83765837 +Ref: Windows<26>-Footnote-93765902 +Ref: Windows<26>-Footnote-103765957 +Ref: Windows<26>-Footnote-113766014 +Ref: Windows<26>-Footnote-123766080 +Node: macOS<20>3766137 +Ref: whatsnew/changelog id2543766248 +Ref: 182f3766248 +Ref: macOS<20>-Footnote-13766584 +Ref: macOS<20>-Footnote-23766649 +Node: Tools/Demos<16>3766714 +Ref: whatsnew/changelog id2553766823 +Ref: 18303766823 +Ref: Tools/Demos<16>-Footnote-13767028 +Node: C API<27>3767093 +Ref: whatsnew/changelog id2563767184 +Ref: 18313767184 +Ref: C API<27>-Footnote-13769441 +Ref: C API<27>-Footnote-23769506 +Ref: C API<27>-Footnote-33769571 +Ref: C API<27>-Footnote-43769636 +Ref: C API<27>-Footnote-53769701 +Ref: C API<27>-Footnote-63769766 +Ref: C API<27>-Footnote-73769831 +Ref: C API<27>-Footnote-83769896 +Node: Python 3 11 0 alpha 63769961 +Ref: whatsnew/changelog python-3-11-0-alpha-63770088 +Ref: 18343770088 +Node: Core and Builtins<32>3770393 +Ref: whatsnew/changelog id2573770492 +Ref: 18353770492 +Ref: Core and Builtins<32>-Footnote-13777498 +Ref: Core and Builtins<32>-Footnote-23777563 +Ref: Core and Builtins<32>-Footnote-33777628 +Ref: Core and Builtins<32>-Footnote-43777693 +Ref: Core and Builtins<32>-Footnote-53777758 +Ref: Core and Builtins<32>-Footnote-63777823 +Ref: Core and Builtins<32>-Footnote-73777888 +Ref: Core and Builtins<32>-Footnote-83777953 +Ref: Core and Builtins<32>-Footnote-93778018 +Ref: Core and Builtins<32>-Footnote-103778083 +Ref: Core and Builtins<32>-Footnote-113778149 +Ref: Core and Builtins<32>-Footnote-123778215 +Ref: Core and Builtins<32>-Footnote-133778281 +Ref: Core and Builtins<32>-Footnote-143778347 +Ref: Core and Builtins<32>-Footnote-153778413 +Ref: Core and Builtins<32>-Footnote-163778479 +Ref: Core and Builtins<32>-Footnote-173778545 +Ref: Core and Builtins<32>-Footnote-183778611 +Ref: Core and Builtins<32>-Footnote-193778677 +Ref: Core and Builtins<32>-Footnote-203778743 +Ref: Core and Builtins<32>-Footnote-213778809 +Ref: Core and Builtins<32>-Footnote-223778875 +Ref: Core and Builtins<32>-Footnote-233778941 +Ref: Core and Builtins<32>-Footnote-243779007 +Ref: Core and Builtins<32>-Footnote-253779073 +Ref: Core and Builtins<32>-Footnote-263779139 +Ref: Core and Builtins<32>-Footnote-273779205 +Ref: Core and Builtins<32>-Footnote-283779271 +Ref: Core and Builtins<32>-Footnote-293779337 +Ref: Core and Builtins<32>-Footnote-303779403 +Ref: Core and Builtins<32>-Footnote-313779469 +Ref: Core and Builtins<32>-Footnote-323779535 +Ref: Core and Builtins<32>-Footnote-333779601 +Ref: Core and Builtins<32>-Footnote-343779667 +Ref: Core and Builtins<32>-Footnote-353779733 +Ref: Core and Builtins<32>-Footnote-363779799 +Ref: Core and Builtins<32>-Footnote-373779865 +Ref: Core and Builtins<32>-Footnote-383779931 +Ref: Core and Builtins<32>-Footnote-393779997 +Ref: Core and Builtins<32>-Footnote-403780063 +Ref: Core and Builtins<32>-Footnote-413780129 +Ref: Core and Builtins<32>-Footnote-423780195 +Ref: Core and Builtins<32>-Footnote-433780261 +Ref: Core and Builtins<32>-Footnote-443780327 +Ref: Core and Builtins<32>-Footnote-453780393 +Ref: Core and Builtins<32>-Footnote-463780459 +Ref: Core and Builtins<32>-Footnote-473780525 +Ref: Core and Builtins<32>-Footnote-483780591 +Node: Library<31>3780657 +Ref: whatsnew/changelog id2583780782 +Ref: 183b3780782 +Ref: Library<31>-Footnote-13789007 +Ref: Library<31>-Footnote-23789072 +Ref: Library<31>-Footnote-33789137 +Ref: Library<31>-Footnote-43789202 +Ref: Library<31>-Footnote-53789267 +Ref: Library<31>-Footnote-63789332 +Ref: Library<31>-Footnote-73789397 +Ref: Library<31>-Footnote-83789462 +Ref: Library<31>-Footnote-93789527 +Ref: Library<31>-Footnote-103789592 +Ref: Library<31>-Footnote-113789658 +Ref: Library<31>-Footnote-123789724 +Ref: Library<31>-Footnote-133789790 +Ref: Library<31>-Footnote-143789856 +Ref: Library<31>-Footnote-153789922 +Ref: Library<31>-Footnote-163789988 +Ref: Library<31>-Footnote-173790054 +Ref: Library<31>-Footnote-183790120 +Ref: Library<31>-Footnote-193790186 +Ref: Library<31>-Footnote-203790252 +Ref: Library<31>-Footnote-213790318 +Ref: Library<31>-Footnote-223790384 +Ref: Library<31>-Footnote-233790450 +Ref: Library<31>-Footnote-243790516 +Ref: Library<31>-Footnote-253790582 +Ref: Library<31>-Footnote-263790648 +Ref: Library<31>-Footnote-273790714 +Ref: Library<31>-Footnote-283790780 +Ref: Library<31>-Footnote-293790846 +Ref: Library<31>-Footnote-303790912 +Ref: Library<31>-Footnote-313790978 +Ref: Library<31>-Footnote-323791044 +Ref: Library<31>-Footnote-333791110 +Ref: Library<31>-Footnote-343791176 +Ref: Library<31>-Footnote-353791219 +Ref: Library<31>-Footnote-363791285 +Ref: Library<31>-Footnote-373791351 +Ref: Library<31>-Footnote-383791417 +Ref: Library<31>-Footnote-393791483 +Ref: Library<31>-Footnote-403791549 +Ref: Library<31>-Footnote-413791615 +Ref: Library<31>-Footnote-423791681 +Ref: Library<31>-Footnote-433791747 +Ref: Library<31>-Footnote-443791813 +Ref: Library<31>-Footnote-453791879 +Ref: Library<31>-Footnote-463791945 +Ref: Library<31>-Footnote-473792011 +Ref: Library<31>-Footnote-483792077 +Node: Documentation<26>3792143 +Ref: whatsnew/changelog id2593792256 +Ref: 18463792256 +Ref: Documentation<26>-Footnote-13792475 +Node: Tests<28>3792540 +Ref: whatsnew/changelog id2603792651 +Ref: 18473792651 +Ref: Tests<28>-Footnote-13793620 +Ref: Tests<28>-Footnote-23793685 +Ref: Tests<28>-Footnote-33793750 +Ref: Tests<28>-Footnote-43793815 +Ref: Tests<28>-Footnote-53793880 +Node: Build<29>3793945 +Ref: whatsnew/changelog id2613794050 +Ref: 18483794050 +Ref: Build<29>-Footnote-13795478 +Ref: Build<29>-Footnote-23795543 +Ref: Build<29>-Footnote-33795608 +Ref: Build<29>-Footnote-43795673 +Ref: Build<29>-Footnote-53795738 +Ref: Build<29>-Footnote-63795803 +Ref: Build<29>-Footnote-73795868 +Node: Windows<27>3795933 +Ref: whatsnew/changelog id2623796037 +Ref: 18493796037 +Ref: Windows<27>-Footnote-13796695 +Ref: Windows<27>-Footnote-23796760 +Ref: Windows<27>-Footnote-33796825 +Node: IDLE<18>3796890 +Ref: whatsnew/changelog id2633796994 +Ref: 184a3796994 +Ref: IDLE<18>-Footnote-13797274 +Ref: IDLE<18>-Footnote-23797339 +Node: C API<28>3797404 +Ref: whatsnew/changelog id2643797488 +Ref: 184b3797488 +Ref: C API<28>-Footnote-13798435 +Ref: C API<28>-Footnote-23798500 +Ref: C API<28>-Footnote-33798565 +Ref: C API<28>-Footnote-43798630 +Ref: C API<28>-Footnote-53798695 +Node: Python 3 11 0 alpha 53798760 +Ref: whatsnew/changelog python-3-11-0-alpha-53798887 +Ref: 184c3798887 +Node: Core and Builtins<33>3799212 +Ref: whatsnew/changelog id2653799311 +Ref: 184d3799311 +Ref: Core and Builtins<33>-Footnote-13804368 +Ref: Core and Builtins<33>-Footnote-23804433 +Ref: Core and Builtins<33>-Footnote-33804498 +Ref: Core and Builtins<33>-Footnote-43804563 +Ref: Core and Builtins<33>-Footnote-53804628 +Ref: Core and Builtins<33>-Footnote-63804693 +Ref: Core and Builtins<33>-Footnote-73804758 +Ref: Core and Builtins<33>-Footnote-83804823 +Ref: Core and Builtins<33>-Footnote-93804888 +Ref: Core and Builtins<33>-Footnote-103804953 +Ref: Core and Builtins<33>-Footnote-113805019 +Ref: Core and Builtins<33>-Footnote-123805085 +Ref: Core and Builtins<33>-Footnote-133805151 +Ref: Core and Builtins<33>-Footnote-143805194 +Ref: Core and Builtins<33>-Footnote-153805260 +Ref: Core and Builtins<33>-Footnote-163805326 +Ref: Core and Builtins<33>-Footnote-173805392 +Ref: Core and Builtins<33>-Footnote-183805458 +Ref: Core and Builtins<33>-Footnote-193805524 +Ref: Core and Builtins<33>-Footnote-203805590 +Ref: Core and Builtins<33>-Footnote-213805656 +Ref: Core and Builtins<33>-Footnote-223805722 +Ref: Core and Builtins<33>-Footnote-233805788 +Ref: Core and Builtins<33>-Footnote-243805854 +Ref: Core and Builtins<33>-Footnote-253805920 +Ref: Core and Builtins<33>-Footnote-263805986 +Ref: Core and Builtins<33>-Footnote-273806052 +Node: Library<32>3806118 +Ref: whatsnew/changelog id2663806243 +Ref: 18503806243 +Ref: Library<32>-Footnote-13812192 +Ref: Library<32>-Footnote-23812257 +Ref: Library<32>-Footnote-33812322 +Ref: Library<32>-Footnote-43812387 +Ref: Library<32>-Footnote-53812452 +Ref: Library<32>-Footnote-63812517 +Ref: Library<32>-Footnote-73812582 +Ref: Library<32>-Footnote-83812647 +Ref: Library<32>-Footnote-93812712 +Ref: Library<32>-Footnote-103812777 +Ref: Library<32>-Footnote-113812843 +Ref: Library<32>-Footnote-123812909 +Ref: Library<32>-Footnote-133812975 +Ref: Library<32>-Footnote-143813041 +Ref: Library<32>-Footnote-153813107 +Ref: Library<32>-Footnote-163813173 +Ref: Library<32>-Footnote-173813239 +Ref: Library<32>-Footnote-183813305 +Ref: Library<32>-Footnote-193813371 +Ref: Library<32>-Footnote-203813437 +Ref: Library<32>-Footnote-213813503 +Ref: Library<32>-Footnote-223813569 +Ref: Library<32>-Footnote-233813635 +Ref: Library<32>-Footnote-243813701 +Ref: Library<32>-Footnote-253813767 +Ref: Library<32>-Footnote-263813833 +Ref: Library<32>-Footnote-273813899 +Ref: Library<32>-Footnote-283813965 +Ref: Library<32>-Footnote-293814031 +Ref: Library<32>-Footnote-303814097 +Ref: Library<32>-Footnote-313814163 +Ref: Library<32>-Footnote-323814229 +Ref: Library<32>-Footnote-333814295 +Ref: Library<32>-Footnote-343814361 +Ref: Library<32>-Footnote-353814427 +Ref: Library<32>-Footnote-363814493 +Ref: Library<32>-Footnote-373814559 +Node: Documentation<27>3814625 +Ref: whatsnew/changelog id2673814738 +Ref: 18563814738 +Ref: Documentation<27>-Footnote-13814927 +Node: Tests<29>3814992 +Ref: whatsnew/changelog id2683815103 +Ref: 18573815103 +Ref: Tests<29>-Footnote-13817252 +Ref: Tests<29>-Footnote-23817317 +Ref: Tests<29>-Footnote-33817382 +Ref: Tests<29>-Footnote-43817447 +Ref: Tests<29>-Footnote-53817512 +Ref: Tests<29>-Footnote-63817577 +Ref: Tests<29>-Footnote-73817642 +Ref: Tests<29>-Footnote-83817707 +Ref: Tests<29>-Footnote-93817772 +Ref: Tests<29>-Footnote-103817837 +Ref: Tests<29>-Footnote-113817903 +Node: Build<30>3817969 +Ref: whatsnew/changelog id2693818074 +Ref: 18583818074 +Ref: Build<30>-Footnote-13819808 +Ref: Build<30>-Footnote-23819873 +Ref: Build<30>-Footnote-33819938 +Ref: Build<30>-Footnote-43820003 +Ref: Build<30>-Footnote-53820068 +Ref: Build<30>-Footnote-63820133 +Ref: Build<30>-Footnote-73820198 +Ref: Build<30>-Footnote-83820263 +Ref: Build<30>-Footnote-93820328 +Ref: Build<30>-Footnote-103820393 +Node: Windows<28>3820459 +Ref: whatsnew/changelog id2703820564 +Ref: 18593820564 +Ref: Windows<28>-Footnote-13821100 +Ref: Windows<28>-Footnote-23821165 +Ref: Windows<28>-Footnote-33821230 +Node: macOS<21>3821295 +Ref: whatsnew/changelog id2713821399 +Ref: 185a3821399 +Ref: macOS<21>-Footnote-13821529 +Node: IDLE<19>3821594 +Ref: whatsnew/changelog id2723821696 +Ref: 185b3821696 +Ref: IDLE<19>-Footnote-13822115 +Node: C API<29>3822180 +Ref: whatsnew/changelog id2733822264 +Ref: 185c3822264 +Ref: C API<29>-Footnote-13823155 +Ref: C API<29>-Footnote-23823220 +Ref: C API<29>-Footnote-33823285 +Ref: C API<29>-Footnote-43823350 +Ref: C API<29>-Footnote-53823415 +Node: Python 3 11 0 alpha 43823480 +Ref: whatsnew/changelog python-3-11-0-alpha-43823607 +Ref: 185d3823607 +Node: Core and Builtins<34>3823914 +Ref: whatsnew/changelog id2743824013 +Ref: 185e3824013 +Ref: Core and Builtins<34>-Footnote-13830811 +Ref: Core and Builtins<34>-Footnote-23830876 +Ref: Core and Builtins<34>-Footnote-33830941 +Ref: Core and Builtins<34>-Footnote-43831006 +Ref: Core and Builtins<34>-Footnote-53831071 +Ref: Core and Builtins<34>-Footnote-63831136 +Ref: Core and Builtins<34>-Footnote-73831201 +Ref: Core and Builtins<34>-Footnote-83831266 +Ref: Core and Builtins<34>-Footnote-93831331 +Ref: Core and Builtins<34>-Footnote-103831396 +Ref: Core and Builtins<34>-Footnote-113831462 +Ref: Core and Builtins<34>-Footnote-123831528 +Ref: Core and Builtins<34>-Footnote-133831594 +Ref: Core and Builtins<34>-Footnote-143831660 +Ref: Core and Builtins<34>-Footnote-153831726 +Ref: Core and Builtins<34>-Footnote-163831792 +Ref: Core and Builtins<34>-Footnote-173831858 +Ref: Core and Builtins<34>-Footnote-183831924 +Ref: Core and Builtins<34>-Footnote-193831990 +Ref: Core and Builtins<34>-Footnote-203832056 +Ref: Core and Builtins<34>-Footnote-213832122 +Ref: Core and Builtins<34>-Footnote-223832188 +Ref: Core and Builtins<34>-Footnote-233832254 +Ref: Core and Builtins<34>-Footnote-243832320 +Ref: Core and Builtins<34>-Footnote-253832386 +Ref: Core and Builtins<34>-Footnote-263832452 +Ref: Core and Builtins<34>-Footnote-273832518 +Ref: Core and Builtins<34>-Footnote-283832584 +Ref: Core and Builtins<34>-Footnote-293832650 +Ref: Core and Builtins<34>-Footnote-303832716 +Ref: Core and Builtins<34>-Footnote-313832782 +Ref: Core and Builtins<34>-Footnote-323832848 +Ref: Core and Builtins<34>-Footnote-333832914 +Ref: Core and Builtins<34>-Footnote-343832980 +Ref: Core and Builtins<34>-Footnote-353833046 +Ref: Core and Builtins<34>-Footnote-363833112 +Ref: Core and Builtins<34>-Footnote-373833178 +Ref: Core and Builtins<34>-Footnote-383833244 +Ref: Core and Builtins<34>-Footnote-393833310 +Ref: Core and Builtins<34>-Footnote-403833353 +Ref: Core and Builtins<34>-Footnote-413833419 +Node: Library<33>3833485 +Ref: whatsnew/changelog id2753833610 +Ref: 18603833610 +Ref: Library<33>-Footnote-13840891 +Ref: Library<33>-Footnote-23840956 +Ref: Library<33>-Footnote-33841021 +Ref: Library<33>-Footnote-43841086 +Ref: Library<33>-Footnote-53841151 +Ref: Library<33>-Footnote-63841216 +Ref: Library<33>-Footnote-73841281 +Ref: Library<33>-Footnote-83841346 +Ref: Library<33>-Footnote-93841411 +Ref: Library<33>-Footnote-103841476 +Ref: Library<33>-Footnote-113841542 +Ref: Library<33>-Footnote-123841608 +Ref: Library<33>-Footnote-133841674 +Ref: Library<33>-Footnote-143841740 +Ref: Library<33>-Footnote-153841806 +Ref: Library<33>-Footnote-163841872 +Ref: Library<33>-Footnote-173841938 +Ref: Library<33>-Footnote-183842004 +Ref: Library<33>-Footnote-193842070 +Ref: Library<33>-Footnote-203842136 +Ref: Library<33>-Footnote-213842202 +Ref: Library<33>-Footnote-223842268 +Ref: Library<33>-Footnote-233842334 +Ref: Library<33>-Footnote-243842400 +Ref: Library<33>-Footnote-253842466 +Ref: Library<33>-Footnote-263842532 +Ref: Library<33>-Footnote-273842598 +Ref: Library<33>-Footnote-283842664 +Ref: Library<33>-Footnote-293842730 +Ref: Library<33>-Footnote-303842796 +Ref: Library<33>-Footnote-313842862 +Ref: Library<33>-Footnote-323842928 +Ref: Library<33>-Footnote-333842994 +Ref: Library<33>-Footnote-343843060 +Ref: Library<33>-Footnote-353843126 +Ref: Library<33>-Footnote-363843192 +Ref: Library<33>-Footnote-373843258 +Ref: Library<33>-Footnote-383843324 +Ref: Library<33>-Footnote-393843390 +Ref: Library<33>-Footnote-403843456 +Ref: Library<33>-Footnote-413843522 +Ref: Library<33>-Footnote-423843588 +Ref: Library<33>-Footnote-433843654 +Ref: Library<33>-Footnote-443843720 +Node: Documentation<28>3843786 +Ref: whatsnew/changelog id2763843899 +Ref: 18653843899 +Ref: Documentation<28>-Footnote-13844396 +Ref: Documentation<28>-Footnote-23844461 +Ref: Documentation<28>-Footnote-33844526 +Ref: Documentation<28>-Footnote-43844591 +Node: Tests<30>3844656 +Ref: whatsnew/changelog id2773844767 +Ref: 18683844767 +Ref: Tests<30>-Footnote-13845695 +Ref: Tests<30>-Footnote-23845760 +Ref: Tests<30>-Footnote-33845825 +Ref: Tests<30>-Footnote-43845890 +Ref: Tests<30>-Footnote-53845955 +Ref: Tests<30>-Footnote-63846020 +Ref: Tests<30>-Footnote-73846085 +Ref: Tests<30>-Footnote-83846150 +Node: Build<31>3846215 +Ref: whatsnew/changelog id2783846320 +Ref: 18693846320 +Ref: Build<31>-Footnote-13848382 +Ref: Build<31>-Footnote-23848447 +Ref: Build<31>-Footnote-33848512 +Ref: Build<31>-Footnote-43848577 +Ref: Build<31>-Footnote-53848642 +Ref: Build<31>-Footnote-63848707 +Ref: Build<31>-Footnote-73848772 +Ref: Build<31>-Footnote-83848837 +Ref: Build<31>-Footnote-93848902 +Ref: Build<31>-Footnote-103848967 +Ref: Build<31>-Footnote-113849033 +Ref: Build<31>-Footnote-123849099 +Node: Windows<29>3849165 +Ref: whatsnew/changelog id2793849270 +Ref: 186a3849270 +Ref: Windows<29>-Footnote-13849489 +Node: macOS<22>3849554 +Ref: whatsnew/changelog id2803849659 +Ref: 186b3849659 +Ref: macOS<22>-Footnote-13849897 +Node: C API<30>3849962 +Ref: whatsnew/changelog id2813850047 +Ref: 186c3850047 +Ref: C API<30>-Footnote-13851323 +Ref: C API<30>-Footnote-23851388 +Ref: C API<30>-Footnote-33851453 +Ref: C API<30>-Footnote-43851518 +Ref: C API<30>-Footnote-53851583 +Node: Python 3 11 0 alpha 33851648 +Ref: whatsnew/changelog python-3-11-0-alpha-33851775 +Ref: 186e3851775 +Node: Core and Builtins<35>3852082 +Ref: whatsnew/changelog id2823852181 +Ref: 186f3852181 +Ref: Core and Builtins<35>-Footnote-13857811 +Ref: Core and Builtins<35>-Footnote-23857876 +Ref: Core and Builtins<35>-Footnote-33857941 +Ref: Core and Builtins<35>-Footnote-43858006 +Ref: Core and Builtins<35>-Footnote-53858071 +Ref: Core and Builtins<35>-Footnote-63858136 +Ref: Core and Builtins<35>-Footnote-73858201 +Ref: Core and Builtins<35>-Footnote-83858266 +Ref: Core and Builtins<35>-Footnote-93858331 +Ref: Core and Builtins<35>-Footnote-103858396 +Ref: Core and Builtins<35>-Footnote-113858462 +Ref: Core and Builtins<35>-Footnote-123858528 +Ref: Core and Builtins<35>-Footnote-133858594 +Ref: Core and Builtins<35>-Footnote-143858660 +Ref: Core and Builtins<35>-Footnote-153858726 +Ref: Core and Builtins<35>-Footnote-163858792 +Ref: Core and Builtins<35>-Footnote-173858858 +Ref: Core and Builtins<35>-Footnote-183858924 +Ref: Core and Builtins<35>-Footnote-193858990 +Ref: Core and Builtins<35>-Footnote-203859056 +Ref: Core and Builtins<35>-Footnote-213859122 +Ref: Core and Builtins<35>-Footnote-223859188 +Ref: Core and Builtins<35>-Footnote-233859231 +Ref: Core and Builtins<35>-Footnote-243859297 +Ref: Core and Builtins<35>-Footnote-253859363 +Ref: Core and Builtins<35>-Footnote-263859429 +Ref: Core and Builtins<35>-Footnote-273859495 +Ref: Core and Builtins<35>-Footnote-283859561 +Ref: Core and Builtins<35>-Footnote-293859627 +Ref: Core and Builtins<35>-Footnote-303859693 +Ref: Core and Builtins<35>-Footnote-313859759 +Ref: Core and Builtins<35>-Footnote-323859825 +Ref: Core and Builtins<35>-Footnote-333859891 +Ref: Core and Builtins<35>-Footnote-343859957 +Node: Library<34>3860023 +Ref: whatsnew/changelog id2833860148 +Ref: 18713860148 +Ref: Library<34>-Footnote-13866121 +Ref: Library<34>-Footnote-23866186 +Ref: Library<34>-Footnote-33866251 +Ref: Library<34>-Footnote-43866316 +Ref: Library<34>-Footnote-53866381 +Ref: Library<34>-Footnote-63866446 +Ref: Library<34>-Footnote-73866511 +Ref: Library<34>-Footnote-83866576 +Ref: Library<34>-Footnote-93866641 +Ref: Library<34>-Footnote-103866706 +Ref: Library<34>-Footnote-113866772 +Ref: Library<34>-Footnote-123866838 +Ref: Library<34>-Footnote-133866904 +Ref: Library<34>-Footnote-143866970 +Ref: Library<34>-Footnote-153867036 +Ref: Library<34>-Footnote-163867102 +Ref: Library<34>-Footnote-173867168 +Ref: Library<34>-Footnote-183867234 +Ref: Library<34>-Footnote-193867300 +Ref: Library<34>-Footnote-203867366 +Ref: Library<34>-Footnote-213867432 +Ref: Library<34>-Footnote-223867498 +Ref: Library<34>-Footnote-233867564 +Ref: Library<34>-Footnote-243867630 +Ref: Library<34>-Footnote-253867696 +Ref: Library<34>-Footnote-263867762 +Ref: Library<34>-Footnote-273867828 +Ref: Library<34>-Footnote-283867894 +Ref: Library<34>-Footnote-293867960 +Ref: Library<34>-Footnote-303868026 +Ref: Library<34>-Footnote-313868092 +Ref: Library<34>-Footnote-323868135 +Ref: Library<34>-Footnote-333868201 +Ref: Library<34>-Footnote-343868267 +Ref: Library<34>-Footnote-353868333 +Ref: Library<34>-Footnote-363868399 +Node: Documentation<29>3868465 +Ref: whatsnew/changelog id2843868578 +Ref: 18733868578 +Ref: Documentation<29>-Footnote-13869886 +Ref: Documentation<29>-Footnote-23869951 +Ref: Documentation<29>-Footnote-33870016 +Ref: Documentation<29>-Footnote-43870081 +Ref: Documentation<29>-Footnote-53870146 +Ref: Documentation<29>-Footnote-63870211 +Ref: Documentation<29>-Footnote-73870276 +Ref: Documentation<29>-Footnote-83870341 +Ref: Documentation<29>-Footnote-93870406 +Node: Tests<31>3870471 +Ref: whatsnew/changelog id2853870582 +Ref: 18743870582 +Ref: Tests<31>-Footnote-13871393 +Ref: Tests<31>-Footnote-23871458 +Ref: Tests<31>-Footnote-33871523 +Ref: Tests<31>-Footnote-43871588 +Ref: Tests<31>-Footnote-53871653 +Ref: Tests<31>-Footnote-63871718 +Node: Build<32>3871783 +Ref: whatsnew/changelog id2863871888 +Ref: 18753871888 +Ref: Build<32>-Footnote-13877687 +Ref: Build<32>-Footnote-23877752 +Ref: Build<32>-Footnote-33877817 +Ref: Build<32>-Footnote-43877882 +Ref: Build<32>-Footnote-53877947 +Ref: Build<32>-Footnote-63878012 +Ref: Build<32>-Footnote-73878077 +Ref: Build<32>-Footnote-83878142 +Ref: Build<32>-Footnote-93878207 +Ref: Build<32>-Footnote-103878272 +Ref: Build<32>-Footnote-113878338 +Ref: Build<32>-Footnote-123878404 +Ref: Build<32>-Footnote-133878470 +Ref: Build<32>-Footnote-143878536 +Ref: Build<32>-Footnote-153878602 +Ref: Build<32>-Footnote-163878668 +Ref: Build<32>-Footnote-173878734 +Ref: Build<32>-Footnote-183878800 +Ref: Build<32>-Footnote-193878866 +Ref: Build<32>-Footnote-203878932 +Ref: Build<32>-Footnote-213878998 +Ref: Build<32>-Footnote-223879064 +Ref: Build<32>-Footnote-233879130 +Ref: Build<32>-Footnote-243879196 +Ref: Build<32>-Footnote-253879262 +Ref: Build<32>-Footnote-263879328 +Ref: Build<32>-Footnote-273879394 +Ref: Build<32>-Footnote-283879460 +Ref: Build<32>-Footnote-293879526 +Ref: Build<32>-Footnote-303879592 +Ref: Build<32>-Footnote-313879658 +Ref: Build<32>-Footnote-323879724 +Ref: Build<32>-Footnote-333879790 +Node: Windows<30>3879856 +Ref: whatsnew/changelog id2873879961 +Ref: 18763879961 +Ref: Windows<30>-Footnote-13881152 +Ref: Windows<30>-Footnote-23881217 +Ref: Windows<30>-Footnote-33881282 +Ref: Windows<30>-Footnote-43881347 +Ref: Windows<30>-Footnote-53881412 +Ref: Windows<30>-Footnote-63881477 +Node: macOS<23>3881542 +Ref: whatsnew/changelog id2883881647 +Ref: 18773881647 +Ref: macOS<23>-Footnote-13881797 +Node: C API<31>3881862 +Ref: whatsnew/changelog id2893881947 +Ref: 18783881947 +Ref: C API<31>-Footnote-13882152 +Node: Python 3 11 0 alpha 23882217 +Ref: whatsnew/changelog python-3-11-0-alpha-23882344 +Ref: 18793882344 +Node: Core and Builtins<36>3882669 +Ref: whatsnew/changelog id2903882768 +Ref: 187a3882768 +Ref: Core and Builtins<36>-Footnote-13888143 +Ref: Core and Builtins<36>-Footnote-23888208 +Ref: Core and Builtins<36>-Footnote-33888273 +Ref: Core and Builtins<36>-Footnote-43888338 +Ref: Core and Builtins<36>-Footnote-53888403 +Ref: Core and Builtins<36>-Footnote-63888468 +Ref: Core and Builtins<36>-Footnote-73888533 +Ref: Core and Builtins<36>-Footnote-83888598 +Ref: Core and Builtins<36>-Footnote-93888663 +Ref: Core and Builtins<36>-Footnote-103888728 +Ref: Core and Builtins<36>-Footnote-113888794 +Ref: Core and Builtins<36>-Footnote-123888860 +Ref: Core and Builtins<36>-Footnote-133888926 +Ref: Core and Builtins<36>-Footnote-143888992 +Ref: Core and Builtins<36>-Footnote-153889058 +Ref: Core and Builtins<36>-Footnote-163889124 +Ref: Core and Builtins<36>-Footnote-173889190 +Ref: Core and Builtins<36>-Footnote-183889256 +Ref: Core and Builtins<36>-Footnote-193889322 +Ref: Core and Builtins<36>-Footnote-203889388 +Ref: Core and Builtins<36>-Footnote-213889431 +Ref: Core and Builtins<36>-Footnote-223889497 +Ref: Core and Builtins<36>-Footnote-233889563 +Ref: Core and Builtins<36>-Footnote-243889629 +Ref: Core and Builtins<36>-Footnote-253889695 +Ref: Core and Builtins<36>-Footnote-263889761 +Node: Library<35>3889804 +Ref: whatsnew/changelog id2913889929 +Ref: 187c3889929 +Ref: Library<35>-Footnote-13897497 +Ref: Library<35>-Footnote-23897562 +Ref: Library<35>-Footnote-33897627 +Ref: Library<35>-Footnote-43897692 +Ref: Library<35>-Footnote-53897757 +Ref: Library<35>-Footnote-63897822 +Ref: Library<35>-Footnote-73897887 +Ref: Library<35>-Footnote-83897952 +Ref: Library<35>-Footnote-93898017 +Ref: Library<35>-Footnote-103898082 +Ref: Library<35>-Footnote-113898148 +Ref: Library<35>-Footnote-123898214 +Ref: Library<35>-Footnote-133898280 +Ref: Library<35>-Footnote-143898346 +Ref: Library<35>-Footnote-153898412 +Ref: Library<35>-Footnote-163898478 +Ref: Library<35>-Footnote-173898544 +Ref: Library<35>-Footnote-183898610 +Ref: Library<35>-Footnote-193898676 +Ref: Library<35>-Footnote-203898742 +Ref: Library<35>-Footnote-213898808 +Ref: Library<35>-Footnote-223898874 +Ref: Library<35>-Footnote-233898940 +Ref: Library<35>-Footnote-243899006 +Ref: Library<35>-Footnote-253899072 +Ref: Library<35>-Footnote-263899138 +Ref: Library<35>-Footnote-273899204 +Ref: Library<35>-Footnote-283899270 +Ref: Library<35>-Footnote-293899336 +Ref: Library<35>-Footnote-303899402 +Ref: Library<35>-Footnote-313899468 +Ref: Library<35>-Footnote-323899534 +Ref: Library<35>-Footnote-333899600 +Ref: Library<35>-Footnote-343899666 +Ref: Library<35>-Footnote-353899732 +Ref: Library<35>-Footnote-363899798 +Ref: Library<35>-Footnote-373899864 +Ref: Library<35>-Footnote-383899930 +Ref: Library<35>-Footnote-393899996 +Ref: Library<35>-Footnote-403900062 +Ref: Library<35>-Footnote-413900128 +Ref: Library<35>-Footnote-423900194 +Ref: Library<35>-Footnote-433900260 +Ref: Library<35>-Footnote-443900320 +Ref: Library<35>-Footnote-453900386 +Node: Documentation<30>3900452 +Ref: whatsnew/changelog id2923900565 +Ref: 18813900565 +Ref: Documentation<30>-Footnote-13902061 +Ref: Documentation<30>-Footnote-23902126 +Ref: Documentation<30>-Footnote-33902191 +Ref: Documentation<30>-Footnote-43902256 +Ref: Documentation<30>-Footnote-53902321 +Ref: Documentation<30>-Footnote-63902386 +Ref: Documentation<30>-Footnote-73902451 +Ref: Documentation<30>-Footnote-83902516 +Ref: Documentation<30>-Footnote-93902581 +Ref: Documentation<30>-Footnote-103902623 +Ref: Documentation<30>-Footnote-113902689 +Node: Tests<32>3902755 +Ref: whatsnew/changelog id2933902866 +Ref: 18853902866 +Ref: Tests<32>-Footnote-13905134 +Ref: Tests<32>-Footnote-23905199 +Ref: Tests<32>-Footnote-33905264 +Ref: Tests<32>-Footnote-43905329 +Ref: Tests<32>-Footnote-53905394 +Ref: Tests<32>-Footnote-63905459 +Ref: Tests<32>-Footnote-73905524 +Ref: Tests<32>-Footnote-83905589 +Ref: Tests<32>-Footnote-93905654 +Ref: Tests<32>-Footnote-103905719 +Ref: Tests<32>-Footnote-113905785 +Ref: Tests<32>-Footnote-123905851 +Ref: Tests<32>-Footnote-133905917 +Node: Build<33>3905983 +Ref: whatsnew/changelog id2943906088 +Ref: 18863906088 +Ref: Build<33>-Footnote-13908765 +Ref: Build<33>-Footnote-23908830 +Ref: Build<33>-Footnote-33908895 +Ref: Build<33>-Footnote-43908960 +Ref: Build<33>-Footnote-53909025 +Ref: Build<33>-Footnote-63909090 +Ref: Build<33>-Footnote-73909155 +Ref: Build<33>-Footnote-83909220 +Ref: Build<33>-Footnote-93909285 +Ref: Build<33>-Footnote-103909350 +Ref: Build<33>-Footnote-113909416 +Ref: Build<33>-Footnote-123909482 +Ref: Build<33>-Footnote-133909548 +Ref: Build<33>-Footnote-143909614 +Ref: Build<33>-Footnote-153909680 +Node: Windows<31>3909746 +Ref: whatsnew/changelog id2953909851 +Ref: 18873909851 +Ref: Windows<31>-Footnote-13910406 +Ref: Windows<31>-Footnote-23910471 +Ref: Windows<31>-Footnote-33910536 +Node: macOS<24>3910601 +Ref: whatsnew/changelog id2963910705 +Ref: 18883910705 +Ref: macOS<24>-Footnote-13910966 +Node: IDLE<20>3911031 +Ref: whatsnew/changelog id2973911133 +Ref: 18893911133 +Ref: IDLE<20>-Footnote-13911294 +Node: C API<32>3911359 +Ref: whatsnew/changelog id2983911443 +Ref: 188a3911443 +Ref: C API<32>-Footnote-13915173 +Ref: C API<32>-Footnote-23915238 +Ref: C API<32>-Footnote-33915303 +Ref: C API<32>-Footnote-43915368 +Ref: C API<32>-Footnote-53915433 +Ref: C API<32>-Footnote-63915498 +Ref: C API<32>-Footnote-73915563 +Ref: C API<32>-Footnote-83915628 +Ref: C API<32>-Footnote-93915693 +Ref: C API<32>-Footnote-103915758 +Ref: C API<32>-Footnote-113915824 +Ref: C API<32>-Footnote-123915890 +Ref: C API<32>-Footnote-133915956 +Ref: C API<32>-Footnote-143916022 +Node: Python 3 11 0 alpha 13916088 +Ref: whatsnew/changelog python-3-11-0-alpha-13916214 +Ref: 188b3916214 +Node: Security<21>3916597 +Ref: whatsnew/changelog id2993916697 +Ref: 188c3916697 +Ref: Security<21>-Footnote-13918056 +Ref: Security<21>-Footnote-23918121 +Ref: Security<21>-Footnote-33918186 +Ref: Security<21>-Footnote-43918251 +Ref: Security<21>-Footnote-53918316 +Ref: Security<21>-Footnote-63918371 +Ref: Security<21>-Footnote-73918436 +Node: Core and Builtins<37>3918501 +Ref: whatsnew/changelog id3003918621 +Ref: 188e3918621 +Ref: Core and Builtins<37>-Footnote-13942396 +Ref: Core and Builtins<37>-Footnote-23942461 +Ref: Core and Builtins<37>-Footnote-33942526 +Ref: Core and Builtins<37>-Footnote-43942591 +Ref: Core and Builtins<37>-Footnote-53942656 +Ref: Core and Builtins<37>-Footnote-63942721 +Ref: Core and Builtins<37>-Footnote-73942786 +Ref: Core and Builtins<37>-Footnote-83942851 +Ref: Core and Builtins<37>-Footnote-93942916 +Ref: Core and Builtins<37>-Footnote-103942981 +Ref: Core and Builtins<37>-Footnote-113943047 +Ref: Core and Builtins<37>-Footnote-123943113 +Ref: Core and Builtins<37>-Footnote-133943179 +Ref: Core and Builtins<37>-Footnote-143943247 +Ref: Core and Builtins<37>-Footnote-153943313 +Ref: Core and Builtins<37>-Footnote-163943379 +Ref: Core and Builtins<37>-Footnote-173943445 +Ref: Core and Builtins<37>-Footnote-183943511 +Ref: Core and Builtins<37>-Footnote-193943577 +Ref: Core and Builtins<37>-Footnote-203943643 +Ref: Core and Builtins<37>-Footnote-213943709 +Ref: Core and Builtins<37>-Footnote-223943775 +Ref: Core and Builtins<37>-Footnote-233943841 +Ref: Core and Builtins<37>-Footnote-243943907 +Ref: Core and Builtins<37>-Footnote-253943973 +Ref: Core and Builtins<37>-Footnote-263944039 +Ref: Core and Builtins<37>-Footnote-273944105 +Ref: Core and Builtins<37>-Footnote-283944171 +Ref: Core and Builtins<37>-Footnote-293944237 +Ref: Core and Builtins<37>-Footnote-303944303 +Ref: Core and Builtins<37>-Footnote-313944369 +Ref: Core and Builtins<37>-Footnote-323944435 +Ref: Core and Builtins<37>-Footnote-333944501 +Ref: Core and Builtins<37>-Footnote-343944567 +Ref: Core and Builtins<37>-Footnote-353944633 +Ref: Core and Builtins<37>-Footnote-363944699 +Ref: Core and Builtins<37>-Footnote-373944765 +Ref: Core and Builtins<37>-Footnote-383944831 +Ref: Core and Builtins<37>-Footnote-393944897 +Ref: Core and Builtins<37>-Footnote-403944963 +Ref: Core and Builtins<37>-Footnote-413945029 +Ref: Core and Builtins<37>-Footnote-423945095 +Ref: Core and Builtins<37>-Footnote-433945161 +Ref: Core and Builtins<37>-Footnote-443945227 +Ref: Core and Builtins<37>-Footnote-453945293 +Ref: Core and Builtins<37>-Footnote-463945359 +Ref: Core and Builtins<37>-Footnote-473945425 +Ref: Core and Builtins<37>-Footnote-483945491 +Ref: Core and Builtins<37>-Footnote-493945557 +Ref: Core and Builtins<37>-Footnote-503945623 +Ref: Core and Builtins<37>-Footnote-513945689 +Ref: Core and Builtins<37>-Footnote-523945755 +Ref: Core and Builtins<37>-Footnote-533945821 +Ref: Core and Builtins<37>-Footnote-543945887 +Ref: Core and Builtins<37>-Footnote-553945953 +Ref: Core and Builtins<37>-Footnote-563946019 +Ref: Core and Builtins<37>-Footnote-573946085 +Ref: Core and Builtins<37>-Footnote-583946151 +Ref: Core and Builtins<37>-Footnote-593946217 +Ref: Core and Builtins<37>-Footnote-603946283 +Ref: Core and Builtins<37>-Footnote-613946349 +Ref: Core and Builtins<37>-Footnote-623946415 +Ref: Core and Builtins<37>-Footnote-633946481 +Ref: Core and Builtins<37>-Footnote-643946547 +Ref: Core and Builtins<37>-Footnote-653946613 +Ref: Core and Builtins<37>-Footnote-663946679 +Ref: Core and Builtins<37>-Footnote-673946745 +Ref: Core and Builtins<37>-Footnote-683946811 +Ref: Core and Builtins<37>-Footnote-693946877 +Ref: Core and Builtins<37>-Footnote-703946943 +Ref: Core and Builtins<37>-Footnote-713947009 +Ref: Core and Builtins<37>-Footnote-723947075 +Ref: Core and Builtins<37>-Footnote-733947141 +Ref: Core and Builtins<37>-Footnote-743947207 +Ref: Core and Builtins<37>-Footnote-753947273 +Ref: Core and Builtins<37>-Footnote-763947316 +Ref: Core and Builtins<37>-Footnote-773947382 +Ref: Core and Builtins<37>-Footnote-783947448 +Ref: Core and Builtins<37>-Footnote-793947514 +Ref: Core and Builtins<37>-Footnote-803947557 +Ref: Core and Builtins<37>-Footnote-813947623 +Ref: Core and Builtins<37>-Footnote-823947689 +Ref: Core and Builtins<37>-Footnote-833947755 +Ref: Core and Builtins<37>-Footnote-843947821 +Ref: Core and Builtins<37>-Footnote-853947887 +Ref: Core and Builtins<37>-Footnote-863947953 +Ref: Core and Builtins<37>-Footnote-873948019 +Ref: Core and Builtins<37>-Footnote-883948085 +Ref: Core and Builtins<37>-Footnote-893948151 +Ref: Core and Builtins<37>-Footnote-903948217 +Ref: Core and Builtins<37>-Footnote-913948283 +Ref: Core and Builtins<37>-Footnote-923948349 +Ref: Core and Builtins<37>-Footnote-933948415 +Ref: Core and Builtins<37>-Footnote-943948481 +Ref: Core and Builtins<37>-Footnote-953948547 +Ref: Core and Builtins<37>-Footnote-963948613 +Ref: Core and Builtins<37>-Footnote-973948679 +Ref: Core and Builtins<37>-Footnote-983948745 +Ref: Core and Builtins<37>-Footnote-993948811 +Ref: Core and Builtins<37>-Footnote-1003948877 +Ref: Core and Builtins<37>-Footnote-1013948944 +Ref: Core and Builtins<37>-Footnote-1023949011 +Ref: Core and Builtins<37>-Footnote-1033949078 +Ref: Core and Builtins<37>-Footnote-1043949145 +Ref: Core and Builtins<37>-Footnote-1053949212 +Ref: Core and Builtins<37>-Footnote-1063949279 +Ref: Core and Builtins<37>-Footnote-1073949346 +Ref: Core and Builtins<37>-Footnote-1083949413 +Ref: Core and Builtins<37>-Footnote-1093949480 +Ref: Core and Builtins<37>-Footnote-1103949547 +Ref: Core and Builtins<37>-Footnote-1113949614 +Ref: Core and Builtins<37>-Footnote-1123949681 +Ref: Core and Builtins<37>-Footnote-1133949748 +Ref: Core and Builtins<37>-Footnote-1143949815 +Ref: Core and Builtins<37>-Footnote-1153949882 +Ref: Core and Builtins<37>-Footnote-1163949949 +Ref: Core and Builtins<37>-Footnote-1173950016 +Ref: Core and Builtins<37>-Footnote-1183950083 +Ref: Core and Builtins<37>-Footnote-1193950150 +Ref: Core and Builtins<37>-Footnote-1203950217 +Ref: Core and Builtins<37>-Footnote-1213950284 +Ref: Core and Builtins<37>-Footnote-1223950351 +Ref: Core and Builtins<37>-Footnote-1233950418 +Ref: Core and Builtins<37>-Footnote-1243950485 +Ref: Core and Builtins<37>-Footnote-1253950552 +Ref: Core and Builtins<37>-Footnote-1263950619 +Ref: Core and Builtins<37>-Footnote-1273950686 +Ref: Core and Builtins<37>-Footnote-1283950753 +Ref: Core and Builtins<37>-Footnote-1293950820 +Ref: Core and Builtins<37>-Footnote-1303950887 +Node: Library<36>3950954 +Ref: whatsnew/changelog id3013951079 +Ref: 18933951079 +Ref: Library<36>-Footnote-13990887 +Ref: Library<36>-Footnote-23990952 +Ref: Library<36>-Footnote-33991017 +Ref: Library<36>-Footnote-43991082 +Ref: Library<36>-Footnote-53991149 +Ref: Library<36>-Footnote-63991214 +Ref: Library<36>-Footnote-73991279 +Ref: Library<36>-Footnote-83991344 +Ref: Library<36>-Footnote-93991409 +Ref: Library<36>-Footnote-103991474 +Ref: Library<36>-Footnote-113991540 +Ref: Library<36>-Footnote-123991606 +Ref: Library<36>-Footnote-133991672 +Ref: Library<36>-Footnote-143991738 +Ref: Library<36>-Footnote-153991804 +Ref: Library<36>-Footnote-163991870 +Ref: Library<36>-Footnote-173991936 +Ref: Library<36>-Footnote-183992002 +Ref: Library<36>-Footnote-193992068 +Ref: Library<36>-Footnote-203992134 +Ref: Library<36>-Footnote-213992200 +Ref: Library<36>-Footnote-223992266 +Ref: Library<36>-Footnote-233992332 +Ref: Library<36>-Footnote-243992398 +Ref: Library<36>-Footnote-253992464 +Ref: Library<36>-Footnote-263992530 +Ref: Library<36>-Footnote-273992596 +Ref: Library<36>-Footnote-283992662 +Ref: Library<36>-Footnote-293992728 +Ref: Library<36>-Footnote-303992794 +Ref: Library<36>-Footnote-313992860 +Ref: Library<36>-Footnote-323992926 +Ref: Library<36>-Footnote-333992992 +Ref: Library<36>-Footnote-343993058 +Ref: Library<36>-Footnote-353993124 +Ref: Library<36>-Footnote-363993167 +Ref: Library<36>-Footnote-373993233 +Ref: Library<36>-Footnote-383993299 +Ref: Library<36>-Footnote-393993365 +Ref: Library<36>-Footnote-403993431 +Ref: Library<36>-Footnote-413993497 +Ref: Library<36>-Footnote-423993563 +Ref: Library<36>-Footnote-433993629 +Ref: Library<36>-Footnote-443993695 +Ref: Library<36>-Footnote-453993761 +Ref: Library<36>-Footnote-463993827 +Ref: Library<36>-Footnote-473993893 +Ref: Library<36>-Footnote-483993959 +Ref: Library<36>-Footnote-493994025 +Ref: Library<36>-Footnote-503994091 +Ref: Library<36>-Footnote-513994157 +Ref: Library<36>-Footnote-523994223 +Ref: Library<36>-Footnote-533994289 +Ref: Library<36>-Footnote-543994355 +Ref: Library<36>-Footnote-553994421 +Ref: Library<36>-Footnote-563994487 +Ref: Library<36>-Footnote-573994553 +Ref: Library<36>-Footnote-583994619 +Ref: Library<36>-Footnote-593994685 +Ref: Library<36>-Footnote-603994751 +Ref: Library<36>-Footnote-613994817 +Ref: Library<36>-Footnote-623994883 +Ref: Library<36>-Footnote-633994949 +Ref: Library<36>-Footnote-643995015 +Ref: Library<36>-Footnote-653995081 +Ref: Library<36>-Footnote-663995147 +Ref: Library<36>-Footnote-673995213 +Ref: Library<36>-Footnote-683995279 +Ref: Library<36>-Footnote-693995345 +Ref: Library<36>-Footnote-703995411 +Ref: Library<36>-Footnote-713995477 +Ref: Library<36>-Footnote-723995543 +Ref: Library<36>-Footnote-733995609 +Ref: Library<36>-Footnote-743995675 +Ref: Library<36>-Footnote-753995741 +Ref: Library<36>-Footnote-763995807 +Ref: Library<36>-Footnote-773995873 +Ref: Library<36>-Footnote-783995939 +Ref: Library<36>-Footnote-793996005 +Ref: Library<36>-Footnote-803996071 +Ref: Library<36>-Footnote-813996137 +Ref: Library<36>-Footnote-823996203 +Ref: Library<36>-Footnote-833996269 +Ref: Library<36>-Footnote-843996335 +Ref: Library<36>-Footnote-853996401 +Ref: Library<36>-Footnote-863996467 +Ref: Library<36>-Footnote-873996533 +Ref: Library<36>-Footnote-883996599 +Ref: Library<36>-Footnote-893996665 +Ref: Library<36>-Footnote-903996731 +Ref: Library<36>-Footnote-913996797 +Ref: Library<36>-Footnote-923996863 +Ref: Library<36>-Footnote-933996929 +Ref: Library<36>-Footnote-943996995 +Ref: Library<36>-Footnote-953997061 +Ref: Library<36>-Footnote-963997127 +Ref: Library<36>-Footnote-973997193 +Ref: Library<36>-Footnote-983997259 +Ref: Library<36>-Footnote-993997325 +Ref: Library<36>-Footnote-1003997391 +Ref: Library<36>-Footnote-1013997458 +Ref: Library<36>-Footnote-1023997525 +Ref: Library<36>-Footnote-1033997592 +Ref: Library<36>-Footnote-1043997659 +Ref: Library<36>-Footnote-1053997726 +Ref: Library<36>-Footnote-1063997793 +Ref: Library<36>-Footnote-1073997860 +Ref: Library<36>-Footnote-1083997927 +Ref: Library<36>-Footnote-1093997994 +Ref: Library<36>-Footnote-1103998061 +Ref: Library<36>-Footnote-1113998128 +Ref: Library<36>-Footnote-1123998195 +Ref: Library<36>-Footnote-1133998262 +Ref: Library<36>-Footnote-1143998329 +Ref: Library<36>-Footnote-1153998396 +Ref: Library<36>-Footnote-1163998463 +Ref: Library<36>-Footnote-1173998530 +Ref: Library<36>-Footnote-1183998597 +Ref: Library<36>-Footnote-1193998664 +Ref: Library<36>-Footnote-1203998731 +Ref: Library<36>-Footnote-1213998798 +Ref: Library<36>-Footnote-1223998865 +Ref: Library<36>-Footnote-1233998932 +Ref: Library<36>-Footnote-1243998999 +Ref: Library<36>-Footnote-1253999066 +Ref: Library<36>-Footnote-1263999133 +Ref: Library<36>-Footnote-1273999200 +Ref: Library<36>-Footnote-1283999267 +Ref: Library<36>-Footnote-1293999334 +Ref: Library<36>-Footnote-1303999401 +Ref: Library<36>-Footnote-1313999468 +Ref: Library<36>-Footnote-1323999535 +Ref: Library<36>-Footnote-1333999602 +Ref: Library<36>-Footnote-1343999669 +Ref: Library<36>-Footnote-1353999736 +Ref: Library<36>-Footnote-1363999803 +Ref: Library<36>-Footnote-1373999870 +Ref: Library<36>-Footnote-1383999937 +Ref: Library<36>-Footnote-1394000004 +Ref: Library<36>-Footnote-1404000071 +Ref: Library<36>-Footnote-1414000138 +Ref: Library<36>-Footnote-1424000205 +Ref: Library<36>-Footnote-1434000272 +Ref: Library<36>-Footnote-1444000339 +Ref: Library<36>-Footnote-1454000406 +Ref: Library<36>-Footnote-1464000473 +Ref: Library<36>-Footnote-1474000540 +Ref: Library<36>-Footnote-1484000606 +Ref: Library<36>-Footnote-1494000673 +Ref: Library<36>-Footnote-1504000740 +Ref: Library<36>-Footnote-1514000801 +Ref: Library<36>-Footnote-1524000868 +Ref: Library<36>-Footnote-1534000935 +Ref: Library<36>-Footnote-1544001002 +Ref: Library<36>-Footnote-1554001069 +Ref: Library<36>-Footnote-1564001136 +Ref: Library<36>-Footnote-1574001203 +Ref: Library<36>-Footnote-1584001270 +Ref: Library<36>-Footnote-1594001337 +Ref: Library<36>-Footnote-1604001381 +Ref: Library<36>-Footnote-1614001448 +Ref: Library<36>-Footnote-1624001515 +Ref: Library<36>-Footnote-1634001582 +Ref: Library<36>-Footnote-1644001649 +Ref: Library<36>-Footnote-1654001716 +Ref: Library<36>-Footnote-1664001783 +Ref: Library<36>-Footnote-1674001850 +Ref: Library<36>-Footnote-1684001917 +Ref: Library<36>-Footnote-1694001984 +Ref: Library<36>-Footnote-1704002051 +Ref: Library<36>-Footnote-1714002118 +Ref: Library<36>-Footnote-1724002185 +Ref: Library<36>-Footnote-1734002252 +Ref: Library<36>-Footnote-1744002319 +Ref: Library<36>-Footnote-1754002386 +Ref: Library<36>-Footnote-1764002453 +Ref: Library<36>-Footnote-1774002520 +Ref: Library<36>-Footnote-1784002587 +Ref: Library<36>-Footnote-1794002654 +Ref: Library<36>-Footnote-1804002721 +Ref: Library<36>-Footnote-1814002788 +Ref: Library<36>-Footnote-1824002855 +Ref: Library<36>-Footnote-1834002922 +Ref: Library<36>-Footnote-1844002989 +Ref: Library<36>-Footnote-1854003056 +Ref: Library<36>-Footnote-1864003123 +Ref: Library<36>-Footnote-1874003190 +Ref: Library<36>-Footnote-1884003257 +Ref: Library<36>-Footnote-1894003324 +Ref: Library<36>-Footnote-1904003391 +Ref: Library<36>-Footnote-1914003458 +Ref: Library<36>-Footnote-1924003525 +Ref: Library<36>-Footnote-1934003592 +Ref: Library<36>-Footnote-1944003659 +Ref: Library<36>-Footnote-1954003726 +Ref: Library<36>-Footnote-1964003792 +Ref: Library<36>-Footnote-1974003859 +Ref: Library<36>-Footnote-1984003926 +Ref: Library<36>-Footnote-1994003993 +Ref: Library<36>-Footnote-2004004060 +Ref: Library<36>-Footnote-2014004127 +Ref: Library<36>-Footnote-2024004194 +Ref: Library<36>-Footnote-2034004261 +Ref: Library<36>-Footnote-2044004328 +Ref: Library<36>-Footnote-2054004395 +Ref: Library<36>-Footnote-2064004462 +Ref: Library<36>-Footnote-2074004529 +Ref: Library<36>-Footnote-2084004596 +Ref: Library<36>-Footnote-2094004663 +Node: Documentation<31>4004730 +Ref: whatsnew/changelog id3024004843 +Ref: 18aa4004843 +Ref: Documentation<31>-Footnote-14011184 +Ref: Documentation<31>-Footnote-24011249 +Ref: Documentation<31>-Footnote-34011314 +Ref: Documentation<31>-Footnote-44011379 +Ref: Documentation<31>-Footnote-54011444 +Ref: Documentation<31>-Footnote-64011509 +Ref: Documentation<31>-Footnote-74011561 +Ref: Documentation<31>-Footnote-84011626 +Ref: Documentation<31>-Footnote-94011691 +Ref: Documentation<31>-Footnote-104011750 +Ref: Documentation<31>-Footnote-114011816 +Ref: Documentation<31>-Footnote-124011882 +Ref: Documentation<31>-Footnote-134011948 +Ref: Documentation<31>-Footnote-144012014 +Ref: Documentation<31>-Footnote-154012080 +Ref: Documentation<31>-Footnote-164012146 +Ref: Documentation<31>-Footnote-174012212 +Ref: Documentation<31>-Footnote-184012278 +Ref: Documentation<31>-Footnote-194012344 +Ref: Documentation<31>-Footnote-204012410 +Ref: Documentation<31>-Footnote-214012476 +Ref: Documentation<31>-Footnote-224012542 +Ref: Documentation<31>-Footnote-234012608 +Ref: Documentation<31>-Footnote-244012674 +Ref: Documentation<31>-Footnote-254012740 +Ref: Documentation<31>-Footnote-264012806 +Ref: Documentation<31>-Footnote-274012872 +Ref: Documentation<31>-Footnote-284012938 +Ref: Documentation<31>-Footnote-294013004 +Ref: Documentation<31>-Footnote-304013070 +Ref: Documentation<31>-Footnote-314013136 +Ref: Documentation<31>-Footnote-324013202 +Ref: Documentation<31>-Footnote-334013268 +Ref: Documentation<31>-Footnote-344013334 +Ref: Documentation<31>-Footnote-354013400 +Ref: Documentation<31>-Footnote-364013466 +Ref: Documentation<31>-Footnote-374013532 +Ref: Documentation<31>-Footnote-384013598 +Ref: Documentation<31>-Footnote-394013664 +Ref: Documentation<31>-Footnote-404013730 +Ref: Documentation<31>-Footnote-414013796 +Ref: Documentation<31>-Footnote-424013862 +Node: Tests<33>4013928 +Ref: whatsnew/changelog id3034014039 +Ref: 18ac4014039 +Ref: Tests<33>-Footnote-14019899 +Ref: Tests<33>-Footnote-24019964 +Ref: Tests<33>-Footnote-34020029 +Ref: Tests<33>-Footnote-44020094 +Ref: Tests<33>-Footnote-54020159 +Ref: Tests<33>-Footnote-64020224 +Ref: Tests<33>-Footnote-74020289 +Ref: Tests<33>-Footnote-84020354 +Ref: Tests<33>-Footnote-94020419 +Ref: Tests<33>-Footnote-104020484 +Ref: Tests<33>-Footnote-114020550 +Ref: Tests<33>-Footnote-124020616 +Ref: Tests<33>-Footnote-134020682 +Ref: Tests<33>-Footnote-144020748 +Ref: Tests<33>-Footnote-154020814 +Ref: Tests<33>-Footnote-164020880 +Ref: Tests<33>-Footnote-174020946 +Ref: Tests<33>-Footnote-184021012 +Ref: Tests<33>-Footnote-194021078 +Ref: Tests<33>-Footnote-204021144 +Ref: Tests<33>-Footnote-214021210 +Ref: Tests<33>-Footnote-224021276 +Ref: Tests<33>-Footnote-234021342 +Ref: Tests<33>-Footnote-244021408 +Ref: Tests<33>-Footnote-254021474 +Ref: Tests<33>-Footnote-264021540 +Ref: Tests<33>-Footnote-274021606 +Ref: Tests<33>-Footnote-284021672 +Ref: Tests<33>-Footnote-294021738 +Ref: Tests<33>-Footnote-304021804 +Ref: Tests<33>-Footnote-314021870 +Ref: Tests<33>-Footnote-324021936 +Ref: Tests<33>-Footnote-334022002 +Ref: Tests<33>-Footnote-344022068 +Ref: Tests<33>-Footnote-354022134 +Node: Build<34>4022200 +Ref: whatsnew/changelog id3044022305 +Ref: 18af4022305 +Ref: Build<34>-Footnote-14024382 +Ref: Build<34>-Footnote-24024447 +Ref: Build<34>-Footnote-34024512 +Ref: Build<34>-Footnote-44024577 +Ref: Build<34>-Footnote-54024642 +Ref: Build<34>-Footnote-64024707 +Ref: Build<34>-Footnote-74024772 +Ref: Build<34>-Footnote-84024837 +Ref: Build<34>-Footnote-94024902 +Ref: Build<34>-Footnote-104024967 +Ref: Build<34>-Footnote-114025033 +Node: Windows<32>4025099 +Ref: whatsnew/changelog id3054025204 +Ref: 18b04025204 +Ref: Windows<32>-Footnote-14026312 +Ref: Windows<32>-Footnote-24026377 +Ref: Windows<32>-Footnote-34026442 +Ref: Windows<32>-Footnote-44026507 +Ref: Windows<32>-Footnote-54026572 +Ref: Windows<32>-Footnote-64026637 +Ref: Windows<32>-Footnote-74026702 +Ref: Windows<32>-Footnote-84026767 +Ref: Windows<32>-Footnote-94026832 +Node: macOS<25>4026897 +Ref: whatsnew/changelog id3064027001 +Ref: 18b24027001 +Ref: macOS<25>-Footnote-14028156 +Ref: macOS<25>-Footnote-24028221 +Ref: macOS<25>-Footnote-34028286 +Ref: macOS<25>-Footnote-44028351 +Ref: macOS<25>-Footnote-54028416 +Ref: macOS<25>-Footnote-64028481 +Ref: macOS<25>-Footnote-74028546 +Node: IDLE<21>4028611 +Ref: whatsnew/changelog id3074028719 +Ref: 18b34028719 +Ref: IDLE<21>-Footnote-14030248 +Ref: IDLE<21>-Footnote-24030313 +Ref: IDLE<21>-Footnote-34030378 +Ref: IDLE<21>-Footnote-44030443 +Ref: IDLE<21>-Footnote-54030508 +Ref: IDLE<21>-Footnote-64030573 +Ref: IDLE<21>-Footnote-74030638 +Ref: IDLE<21>-Footnote-84030703 +Ref: IDLE<21>-Footnote-94030768 +Node: Tools/Demos<17>4030833 +Ref: whatsnew/changelog id3084030941 +Ref: 18b44030941 +Ref: Tools/Demos<17>-Footnote-14031745 +Ref: Tools/Demos<17>-Footnote-24031810 +Ref: Tools/Demos<17>-Footnote-34031875 +Ref: Tools/Demos<17>-Footnote-44031940 +Ref: Tools/Demos<17>-Footnote-54032005 +Ref: Tools/Demos<17>-Footnote-64032070 +Node: C API<33>4032135 +Ref: whatsnew/changelog id3094032226 +Ref: 18b54032226 +Ref: C API<33>-Footnote-14038077 +Ref: C API<33>-Footnote-24038142 +Ref: C API<33>-Footnote-34038207 +Ref: C API<33>-Footnote-44038272 +Ref: C API<33>-Footnote-54038337 +Ref: C API<33>-Footnote-64038402 +Ref: C API<33>-Footnote-74038467 +Ref: C API<33>-Footnote-84038532 +Ref: C API<33>-Footnote-94038597 +Ref: C API<33>-Footnote-104038662 +Ref: C API<33>-Footnote-114038728 +Ref: C API<33>-Footnote-124038794 +Ref: C API<33>-Footnote-134038860 +Ref: C API<33>-Footnote-144038926 +Ref: C API<33>-Footnote-154038992 +Ref: C API<33>-Footnote-164039058 +Ref: C API<33>-Footnote-174039124 +Ref: C API<33>-Footnote-184039190 +Ref: C API<33>-Footnote-194039256 +Ref: C API<33>-Footnote-204039322 +Ref: C API<33>-Footnote-214039365 +Ref: C API<33>-Footnote-224039431 +Ref: C API<33>-Footnote-234039497 +Ref: C API<33>-Footnote-244039563 +Ref: C API<33>-Footnote-254039606 +Ref: C API<33>-Footnote-264039649 +Node: Python 3 10 0 beta 14039715 +Ref: whatsnew/changelog python-3-10-0-beta-14039841 +Ref: 18b84039841 +Node: Security<22>4040190 +Ref: whatsnew/changelog id3104040289 +Ref: 18b94040289 +Ref: Security<22>-Footnote-14043225 +Ref: Security<22>-Footnote-24043290 +Ref: Security<22>-Footnote-34043355 +Ref: Security<22>-Footnote-44043420 +Ref: Security<22>-Footnote-54043485 +Ref: Security<22>-Footnote-64043550 +Ref: Security<22>-Footnote-74043615 +Ref: Security<22>-Footnote-84043680 +Ref: Security<22>-Footnote-94043745 +Ref: Security<22>-Footnote-104043810 +Ref: Security<22>-Footnote-114043876 +Node: Core and Builtins<38>4043942 +Ref: whatsnew/changelog id3114044061 +Ref: 18bc4044061 +Ref: Core and Builtins<38>-Footnote-14050226 +Ref: Core and Builtins<38>-Footnote-24050291 +Ref: Core and Builtins<38>-Footnote-34050356 +Ref: Core and Builtins<38>-Footnote-44050421 +Ref: Core and Builtins<38>-Footnote-54050486 +Ref: Core and Builtins<38>-Footnote-64050551 +Ref: Core and Builtins<38>-Footnote-74050616 +Ref: Core and Builtins<38>-Footnote-84050681 +Ref: Core and Builtins<38>-Footnote-94050746 +Ref: Core and Builtins<38>-Footnote-104050811 +Ref: Core and Builtins<38>-Footnote-114050877 +Ref: Core and Builtins<38>-Footnote-124050943 +Ref: Core and Builtins<38>-Footnote-134051009 +Ref: Core and Builtins<38>-Footnote-144051075 +Ref: Core and Builtins<38>-Footnote-154051118 +Ref: Core and Builtins<38>-Footnote-164051184 +Ref: Core and Builtins<38>-Footnote-174051250 +Ref: Core and Builtins<38>-Footnote-184051316 +Ref: Core and Builtins<38>-Footnote-194051382 +Ref: Core and Builtins<38>-Footnote-204051448 +Ref: Core and Builtins<38>-Footnote-214051514 +Ref: Core and Builtins<38>-Footnote-224051580 +Ref: Core and Builtins<38>-Footnote-234051646 +Ref: Core and Builtins<38>-Footnote-244051712 +Ref: Core and Builtins<38>-Footnote-254051778 +Ref: Core and Builtins<38>-Footnote-264051844 +Ref: Core and Builtins<38>-Footnote-274051910 +Ref: Core and Builtins<38>-Footnote-284051976 +Ref: Core and Builtins<38>-Footnote-294052042 +Ref: Core and Builtins<38>-Footnote-304052108 +Ref: Core and Builtins<38>-Footnote-314052174 +Ref: Core and Builtins<38>-Footnote-324052240 +Ref: Core and Builtins<38>-Footnote-334052306 +Ref: Core and Builtins<38>-Footnote-344052372 +Ref: Core and Builtins<38>-Footnote-354052438 +Node: Library<37>4052504 +Ref: whatsnew/changelog id3124052628 +Ref: 18c04052628 +Ref: Library<37>-Footnote-14069442 +Ref: Library<37>-Footnote-24069507 +Ref: Library<37>-Footnote-34069572 +Ref: Library<37>-Footnote-44069637 +Ref: Library<37>-Footnote-54069702 +Ref: Library<37>-Footnote-64069767 +Ref: Library<37>-Footnote-74069832 +Ref: Library<37>-Footnote-84069897 +Ref: Library<37>-Footnote-94069962 +Ref: Library<37>-Footnote-104070027 +Ref: Library<37>-Footnote-114070093 +Ref: Library<37>-Footnote-124070159 +Ref: Library<37>-Footnote-134070225 +Ref: Library<37>-Footnote-144070291 +Ref: Library<37>-Footnote-154070357 +Ref: Library<37>-Footnote-164070423 +Ref: Library<37>-Footnote-174070489 +Ref: Library<37>-Footnote-184070555 +Ref: Library<37>-Footnote-194070621 +Ref: Library<37>-Footnote-204070687 +Ref: Library<37>-Footnote-214070753 +Ref: Library<37>-Footnote-224070819 +Ref: Library<37>-Footnote-234070862 +Ref: Library<37>-Footnote-244070928 +Ref: Library<37>-Footnote-254070994 +Ref: Library<37>-Footnote-264071060 +Ref: Library<37>-Footnote-274071126 +Ref: Library<37>-Footnote-284071192 +Ref: Library<37>-Footnote-294071258 +Ref: Library<37>-Footnote-304071324 +Ref: Library<37>-Footnote-314071390 +Ref: Library<37>-Footnote-324071456 +Ref: Library<37>-Footnote-334071522 +Ref: Library<37>-Footnote-344071588 +Ref: Library<37>-Footnote-354071654 +Ref: Library<37>-Footnote-364071720 +Ref: Library<37>-Footnote-374071786 +Ref: Library<37>-Footnote-384071852 +Ref: Library<37>-Footnote-394071918 +Ref: Library<37>-Footnote-404071984 +Ref: Library<37>-Footnote-414072050 +Ref: Library<37>-Footnote-424072116 +Ref: Library<37>-Footnote-434072159 +Ref: Library<37>-Footnote-444072225 +Ref: Library<37>-Footnote-454072291 +Ref: Library<37>-Footnote-464072347 +Ref: Library<37>-Footnote-474072413 +Ref: Library<37>-Footnote-484072479 +Ref: Library<37>-Footnote-494072545 +Ref: Library<37>-Footnote-504072611 +Ref: Library<37>-Footnote-514072677 +Ref: Library<37>-Footnote-524072743 +Ref: Library<37>-Footnote-534072809 +Ref: Library<37>-Footnote-544072874 +Ref: Library<37>-Footnote-554072940 +Ref: Library<37>-Footnote-564073006 +Ref: Library<37>-Footnote-574073072 +Ref: Library<37>-Footnote-584073137 +Ref: Library<37>-Footnote-594073203 +Ref: Library<37>-Footnote-604073269 +Ref: Library<37>-Footnote-614073335 +Ref: Library<37>-Footnote-624073401 +Ref: Library<37>-Footnote-634073467 +Ref: Library<37>-Footnote-644073533 +Ref: Library<37>-Footnote-654073599 +Ref: Library<37>-Footnote-664073665 +Ref: Library<37>-Footnote-674073731 +Ref: Library<37>-Footnote-684073797 +Ref: Library<37>-Footnote-694073840 +Ref: Library<37>-Footnote-704073906 +Ref: Library<37>-Footnote-714073972 +Ref: Library<37>-Footnote-724074038 +Ref: Library<37>-Footnote-734074104 +Ref: Library<37>-Footnote-744074170 +Ref: Library<37>-Footnote-754074236 +Ref: Library<37>-Footnote-764074302 +Ref: Library<37>-Footnote-774074368 +Ref: Library<37>-Footnote-784074434 +Ref: Library<37>-Footnote-794074500 +Ref: Library<37>-Footnote-804074566 +Ref: Library<37>-Footnote-814074632 +Ref: Library<37>-Footnote-824074698 +Ref: Library<37>-Footnote-834074764 +Node: Documentation<32>4074830 +Ref: whatsnew/changelog id3134074942 +Ref: 18c74074942 +Ref: Documentation<32>-Footnote-14075956 +Ref: Documentation<32>-Footnote-24076021 +Ref: Documentation<32>-Footnote-34076086 +Ref: Documentation<32>-Footnote-44076151 +Ref: Documentation<32>-Footnote-54076216 +Ref: Documentation<32>-Footnote-64076281 +Ref: Documentation<32>-Footnote-74076346 +Node: Tests<34>4076411 +Ref: whatsnew/changelog id3144076521 +Ref: 18c84076521 +Ref: Tests<34>-Footnote-14077600 +Ref: Tests<34>-Footnote-24077665 +Ref: Tests<34>-Footnote-34077730 +Ref: Tests<34>-Footnote-44077795 +Ref: Tests<34>-Footnote-54077860 +Node: Build<35>4077925 +Ref: whatsnew/changelog id3154078029 +Ref: 18c94078029 +Ref: Build<35>-Footnote-14078289 +Ref: Build<35>-Footnote-24078354 +Ref: Build<35>-Footnote-34078419 +Node: Windows<33>4078461 +Ref: whatsnew/changelog id3164078565 +Ref: 18ca4078565 +Ref: Windows<33>-Footnote-14079908 +Ref: Windows<33>-Footnote-24079973 +Ref: Windows<33>-Footnote-34080038 +Ref: Windows<33>-Footnote-44080103 +Ref: Windows<33>-Footnote-54080168 +Ref: Windows<33>-Footnote-64080233 +Ref: Windows<33>-Footnote-74080298 +Ref: Windows<33>-Footnote-84080363 +Ref: Windows<33>-Footnote-94080428 +Node: macOS<26>4080493 +Ref: whatsnew/changelog id3174080596 +Ref: 18ce4080596 +Ref: macOS<26>-Footnote-14081904 +Ref: macOS<26>-Footnote-24081969 +Ref: macOS<26>-Footnote-34082034 +Ref: macOS<26>-Footnote-44082099 +Ref: macOS<26>-Footnote-54082164 +Ref: macOS<26>-Footnote-64082229 +Node: IDLE<22>4082294 +Ref: whatsnew/changelog id3184082395 +Ref: 18cf4082395 +Ref: IDLE<22>-Footnote-14083195 +Ref: IDLE<22>-Footnote-24083260 +Ref: IDLE<22>-Footnote-34083325 +Ref: IDLE<22>-Footnote-44083390 +Ref: IDLE<22>-Footnote-54083455 +Node: C API<34>4083520 +Ref: whatsnew/changelog id3194083603 +Ref: 18d04083603 +Ref: C API<34>-Footnote-14085851 +Ref: C API<34>-Footnote-24085916 +Ref: C API<34>-Footnote-34085981 +Ref: C API<34>-Footnote-44086046 +Ref: C API<34>-Footnote-54086111 +Ref: C API<34>-Footnote-64086176 +Ref: C API<34>-Footnote-74086241 +Ref: C API<34>-Footnote-84086306 +Ref: C API<34>-Footnote-94086371 +Ref: C API<34>-Footnote-104086413 +Node: Python 3 10 0 alpha 74086479 +Ref: whatsnew/changelog python-3-10-0-alpha-74086605 +Ref: 18d14086605 +Node: Security<23>4086936 +Ref: whatsnew/changelog id3204087036 +Ref: 18d24087036 +Ref: Security<23>-Footnote-14088120 +Ref: Security<23>-Footnote-24088185 +Ref: Security<23>-Footnote-34088240 +Ref: Security<23>-Footnote-44088305 +Node: Core and Builtins<39>4088370 +Ref: whatsnew/changelog id3214088490 +Ref: 18d34088490 +Ref: Core and Builtins<39>-Footnote-14093016 +Ref: Core and Builtins<39>-Footnote-24093081 +Ref: Core and Builtins<39>-Footnote-34093146 +Ref: Core and Builtins<39>-Footnote-44093211 +Ref: Core and Builtins<39>-Footnote-54093276 +Ref: Core and Builtins<39>-Footnote-64093341 +Ref: Core and Builtins<39>-Footnote-74093406 +Ref: Core and Builtins<39>-Footnote-84093471 +Ref: Core and Builtins<39>-Footnote-94093536 +Ref: Core and Builtins<39>-Footnote-104093578 +Ref: Core and Builtins<39>-Footnote-114093644 +Ref: Core and Builtins<39>-Footnote-124093710 +Ref: Core and Builtins<39>-Footnote-134093776 +Ref: Core and Builtins<39>-Footnote-144093842 +Ref: Core and Builtins<39>-Footnote-154093908 +Ref: Core and Builtins<39>-Footnote-164093974 +Ref: Core and Builtins<39>-Footnote-174094040 +Ref: Core and Builtins<39>-Footnote-184094106 +Ref: Core and Builtins<39>-Footnote-194094172 +Ref: Core and Builtins<39>-Footnote-204094238 +Ref: Core and Builtins<39>-Footnote-214094304 +Ref: Core and Builtins<39>-Footnote-224094370 +Ref: Core and Builtins<39>-Footnote-234094413 +Ref: Core and Builtins<39>-Footnote-244094479 +Node: Library<38>4094545 +Ref: whatsnew/changelog id3224094670 +Ref: 18d44094670 +Ref: Library<38>-Footnote-14102353 +Ref: Library<38>-Footnote-24102418 +Ref: Library<38>-Footnote-34102483 +Ref: Library<38>-Footnote-44102548 +Ref: Library<38>-Footnote-54102613 +Ref: Library<38>-Footnote-64102678 +Ref: Library<38>-Footnote-74102743 +Ref: Library<38>-Footnote-84102808 +Ref: Library<38>-Footnote-94102873 +Ref: Library<38>-Footnote-104102938 +Ref: Library<38>-Footnote-114103004 +Ref: Library<38>-Footnote-124103070 +Ref: Library<38>-Footnote-134103136 +Ref: Library<38>-Footnote-144103202 +Ref: Library<38>-Footnote-154103268 +Ref: Library<38>-Footnote-164103311 +Ref: Library<38>-Footnote-174103377 +Ref: Library<38>-Footnote-184103443 +Ref: Library<38>-Footnote-194103509 +Ref: Library<38>-Footnote-204103575 +Ref: Library<38>-Footnote-214103641 +Ref: Library<38>-Footnote-224103707 +Ref: Library<38>-Footnote-234103773 +Ref: Library<38>-Footnote-244103839 +Ref: Library<38>-Footnote-254103905 +Ref: Library<38>-Footnote-264103987 +Ref: Library<38>-Footnote-274104053 +Ref: Library<38>-Footnote-284104119 +Ref: Library<38>-Footnote-294104185 +Ref: Library<38>-Footnote-304104251 +Ref: Library<38>-Footnote-314104317 +Ref: Library<38>-Footnote-324104383 +Ref: Library<38>-Footnote-334104449 +Ref: Library<38>-Footnote-344104515 +Ref: Library<38>-Footnote-354104581 +Ref: Library<38>-Footnote-364104647 +Ref: Library<38>-Footnote-374104713 +Ref: Library<38>-Footnote-384104779 +Ref: Library<38>-Footnote-394104845 +Ref: Library<38>-Footnote-404104911 +Ref: Library<38>-Footnote-414104977 +Ref: Library<38>-Footnote-424105043 +Ref: Library<38>-Footnote-434105109 +Ref: Library<38>-Footnote-444105175 +Ref: Library<38>-Footnote-454105241 +Node: Documentation<33>4105307 +Ref: whatsnew/changelog id3234105420 +Ref: 18dc4105420 +Ref: Documentation<33>-Footnote-14106117 +Ref: Documentation<33>-Footnote-24106182 +Ref: Documentation<33>-Footnote-34106247 +Ref: Documentation<33>-Footnote-44106312 +Node: Tests<35>4106377 +Ref: whatsnew/changelog id3244106488 +Ref: 18dd4106488 +Ref: Tests<35>-Footnote-14106793 +Ref: Tests<35>-Footnote-24106858 +Node: Build<36>4106923 +Ref: whatsnew/changelog id3254107028 +Ref: 18de4107028 +Ref: Build<36>-Footnote-14107999 +Ref: Build<36>-Footnote-24108064 +Ref: Build<36>-Footnote-34108129 +Ref: Build<36>-Footnote-44108194 +Ref: Build<36>-Footnote-54108259 +Ref: Build<36>-Footnote-64108324 +Node: Windows<34>4108389 +Ref: whatsnew/changelog id3264108493 +Ref: 18df4108493 +Ref: Windows<34>-Footnote-14108683 +Node: IDLE<23>4108748 +Ref: whatsnew/changelog id3274108852 +Ref: 18e04108852 +Ref: IDLE<23>-Footnote-14109093 +Node: C API<35>4109158 +Ref: whatsnew/changelog id3284109242 +Ref: 18e14109242 +Ref: C API<35>-Footnote-14112706 +Ref: C API<35>-Footnote-24112771 +Ref: C API<35>-Footnote-34112836 +Ref: C API<35>-Footnote-44112901 +Ref: C API<35>-Footnote-54112966 +Ref: C API<35>-Footnote-64113031 +Ref: C API<35>-Footnote-74113096 +Ref: C API<35>-Footnote-84113161 +Ref: C API<35>-Footnote-94113226 +Node: Python 3 10 0 alpha 64113268 +Ref: whatsnew/changelog python-3-10-0-alpha-64113395 +Ref: 18e24113395 +Node: Security<24>4113746 +Ref: whatsnew/changelog id3294113846 +Ref: 18e34113846 +Ref: Security<24>-Footnote-14114092 +Node: Core and Builtins<40>4114157 +Ref: whatsnew/changelog id3304114277 +Ref: 18e44114277 +Ref: Core and Builtins<40>-Footnote-14117714 +Ref: Core and Builtins<40>-Footnote-24117779 +Ref: Core and Builtins<40>-Footnote-34117844 +Ref: Core and Builtins<40>-Footnote-44117886 +Ref: Core and Builtins<40>-Footnote-54117951 +Ref: Core and Builtins<40>-Footnote-64118016 +Ref: Core and Builtins<40>-Footnote-74118081 +Ref: Core and Builtins<40>-Footnote-84118146 +Ref: Core and Builtins<40>-Footnote-94118211 +Ref: Core and Builtins<40>-Footnote-104118276 +Ref: Core and Builtins<40>-Footnote-114118342 +Ref: Core and Builtins<40>-Footnote-124118408 +Ref: Core and Builtins<40>-Footnote-134118474 +Ref: Core and Builtins<40>-Footnote-144118540 +Ref: Core and Builtins<40>-Footnote-154118583 +Ref: Core and Builtins<40>-Footnote-164118649 +Node: Library<39>4118715 +Ref: whatsnew/changelog id3314118840 +Ref: 18e54118840 +Ref: Library<39>-Footnote-14121675 +Ref: Library<39>-Footnote-24121740 +Ref: Library<39>-Footnote-34121805 +Ref: Library<39>-Footnote-44121870 +Ref: Library<39>-Footnote-54121935 +Ref: Library<39>-Footnote-64122000 +Ref: Library<39>-Footnote-74122065 +Ref: Library<39>-Footnote-84122130 +Ref: Library<39>-Footnote-94122195 +Ref: Library<39>-Footnote-104122260 +Ref: Library<39>-Footnote-114122326 +Ref: Library<39>-Footnote-124122392 +Ref: Library<39>-Footnote-134122458 +Ref: Library<39>-Footnote-144122524 +Ref: Library<39>-Footnote-154122590 +Ref: Library<39>-Footnote-164122656 +Node: Documentation<34>4122722 +Ref: whatsnew/changelog id3324122835 +Ref: 18e94122835 +Ref: Documentation<34>-Footnote-14123189 +Ref: Documentation<34>-Footnote-24123254 +Ref: Documentation<34>-Footnote-34123319 +Node: Tests<36>4123361 +Ref: whatsnew/changelog id3334123472 +Ref: 18ea4123472 +Ref: Tests<36>-Footnote-14123663 +Node: Build<37>4123728 +Ref: whatsnew/changelog id3344123833 +Ref: 18eb4123833 +Ref: Build<37>-Footnote-14124902 +Ref: Build<37>-Footnote-24124967 +Ref: Build<37>-Footnote-34125032 +Ref: Build<37>-Footnote-44125097 +Ref: Build<37>-Footnote-54125162 +Node: Windows<35>4125227 +Ref: whatsnew/changelog id3354125332 +Ref: 18ec4125332 +Ref: Windows<35>-Footnote-14125496 +Node: macOS<27>4125561 +Ref: whatsnew/changelog id3364125665 +Ref: 18ee4125665 +Ref: macOS<27>-Footnote-14125806 +Node: IDLE<24>4125871 +Ref: whatsnew/changelog id3374125973 +Ref: 18ef4125973 +Ref: IDLE<24>-Footnote-14126243 +Node: C API<36>4126308 +Ref: whatsnew/changelog id3384126392 +Ref: 18f04126392 +Ref: C API<36>-Footnote-14128146 +Ref: C API<36>-Footnote-24128211 +Ref: C API<36>-Footnote-34128276 +Ref: C API<36>-Footnote-44128341 +Ref: C API<36>-Footnote-54128406 +Ref: C API<36>-Footnote-64128471 +Ref: C API<36>-Footnote-74128536 +Ref: C API<36>-Footnote-84128601 +Ref: C API<36>-Footnote-94128666 +Node: Python 3 10 0 alpha 54128731 +Ref: whatsnew/changelog python-3-10-0-alpha-54128858 +Ref: 18f84128858 +Node: Security<25>4129209 +Ref: whatsnew/changelog id3394129309 +Ref: 18f94129309 +Ref: Security<25>-Footnote-14129531 +Node: Core and Builtins<41>4129596 +Ref: whatsnew/changelog id3404129716 +Ref: 18fc4129716 +Ref: Core and Builtins<41>-Footnote-14132236 +Ref: Core and Builtins<41>-Footnote-24132301 +Ref: Core and Builtins<41>-Footnote-34132366 +Ref: Core and Builtins<41>-Footnote-44132431 +Ref: Core and Builtins<41>-Footnote-54132496 +Ref: Core and Builtins<41>-Footnote-64132561 +Ref: Core and Builtins<41>-Footnote-74132626 +Ref: Core and Builtins<41>-Footnote-84132691 +Ref: Core and Builtins<41>-Footnote-94132756 +Ref: Core and Builtins<41>-Footnote-104132821 +Ref: Core and Builtins<41>-Footnote-114132887 +Ref: Core and Builtins<41>-Footnote-124132953 +Ref: Core and Builtins<41>-Footnote-134133019 +Ref: Core and Builtins<41>-Footnote-144133085 +Ref: Core and Builtins<41>-Footnote-154133151 +Node: Library<40>4133217 +Ref: whatsnew/changelog id3414133342 +Ref: 18fd4133342 +Ref: Library<40>-Footnote-14138286 +Ref: Library<40>-Footnote-24138351 +Ref: Library<40>-Footnote-34138416 +Ref: Library<40>-Footnote-44138481 +Ref: Library<40>-Footnote-54138546 +Ref: Library<40>-Footnote-64138611 +Ref: Library<40>-Footnote-74138676 +Ref: Library<40>-Footnote-84138741 +Ref: Library<40>-Footnote-94138806 +Ref: Library<40>-Footnote-104138871 +Ref: Library<40>-Footnote-114138937 +Ref: Library<40>-Footnote-124139003 +Ref: Library<40>-Footnote-134139069 +Ref: Library<40>-Footnote-144139135 +Ref: Library<40>-Footnote-154139201 +Ref: Library<40>-Footnote-164139267 +Ref: Library<40>-Footnote-174139333 +Ref: Library<40>-Footnote-184139399 +Ref: Library<40>-Footnote-194139442 +Ref: Library<40>-Footnote-204139508 +Ref: Library<40>-Footnote-214139574 +Ref: Library<40>-Footnote-224139640 +Ref: Library<40>-Footnote-234139706 +Ref: Library<40>-Footnote-244139774 +Ref: Library<40>-Footnote-254139817 +Ref: Library<40>-Footnote-264139883 +Ref: Library<40>-Footnote-274139949 +Ref: Library<40>-Footnote-284140015 +Ref: Library<40>-Footnote-294140081 +Ref: Library<40>-Footnote-304140147 +Ref: Library<40>-Footnote-314140213 +Ref: Library<40>-Footnote-324140279 +Ref: Library<40>-Footnote-334140345 +Ref: Library<40>-Footnote-344140411 +Node: Documentation<35>4140477 +Ref: whatsnew/changelog id3424140590 +Ref: 18fe4140590 +Ref: Documentation<35>-Footnote-14140918 +Ref: Documentation<35>-Footnote-24140983 +Node: Tests<37>4141048 +Ref: whatsnew/changelog id3434141159 +Ref: 18ff4141159 +Ref: Tests<37>-Footnote-14141515 +Ref: Tests<37>-Footnote-24141580 +Node: Build<38>4141645 +Ref: whatsnew/changelog id3444141750 +Ref: 19004141750 +Ref: Build<38>-Footnote-14142945 +Ref: Build<38>-Footnote-24143010 +Ref: Build<38>-Footnote-34143075 +Ref: Build<38>-Footnote-44143140 +Ref: Build<38>-Footnote-54143205 +Node: Windows<36>4143270 +Ref: whatsnew/changelog id3454143375 +Ref: 19014143375 +Ref: Windows<36>-Footnote-14143588 +Ref: Windows<36>-Footnote-24143653 +Node: macOS<28>4143718 +Ref: whatsnew/changelog id3464143822 +Ref: 19024143822 +Ref: macOS<28>-Footnote-14144073 +Node: IDLE<25>4144138 +Ref: whatsnew/changelog id3474144240 +Ref: 19034144240 +Ref: IDLE<25>-Footnote-14144802 +Ref: IDLE<25>-Footnote-24144867 +Ref: IDLE<25>-Footnote-34144932 +Ref: IDLE<25>-Footnote-44144997 +Node: C API<37>4145062 +Ref: whatsnew/changelog id3484145146 +Ref: 19044145146 +Ref: C API<37>-Footnote-14145752 +Ref: C API<37>-Footnote-24145817 +Node: Python 3 10 0 alpha 44145882 +Ref: whatsnew/changelog python-3-10-0-alpha-44146009 +Ref: 19064146009 +Node: Core and Builtins<42>4146324 +Ref: whatsnew/changelog id3494146423 +Ref: 19074146423 +Ref: Core and Builtins<42>-Footnote-14149841 +Ref: Core and Builtins<42>-Footnote-24149906 +Ref: Core and Builtins<42>-Footnote-34149971 +Ref: Core and Builtins<42>-Footnote-44150036 +Ref: Core and Builtins<42>-Footnote-54150101 +Ref: Core and Builtins<42>-Footnote-64150166 +Ref: Core and Builtins<42>-Footnote-74150231 +Ref: Core and Builtins<42>-Footnote-84150296 +Ref: Core and Builtins<42>-Footnote-94150361 +Ref: Core and Builtins<42>-Footnote-104150426 +Ref: Core and Builtins<42>-Footnote-114150492 +Ref: Core and Builtins<42>-Footnote-124150558 +Ref: Core and Builtins<42>-Footnote-134150624 +Ref: Core and Builtins<42>-Footnote-144150690 +Ref: Core and Builtins<42>-Footnote-154150733 +Ref: Core and Builtins<42>-Footnote-164150799 +Ref: Core and Builtins<42>-Footnote-174150865 +Ref: Core and Builtins<42>-Footnote-184150931 +Ref: Core and Builtins<42>-Footnote-194150999 +Ref: Core and Builtins<42>-Footnote-204151042 +Ref: Core and Builtins<42>-Footnote-214151108 +Node: Library<41>4151174 +Ref: whatsnew/changelog id3504151299 +Ref: 19094151299 +Ref: Library<41>-Footnote-14160125 +Ref: Library<41>-Footnote-24160190 +Ref: Library<41>-Footnote-34160255 +Ref: Library<41>-Footnote-44160320 +Ref: Library<41>-Footnote-54160385 +Ref: Library<41>-Footnote-64160450 +Ref: Library<41>-Footnote-74160515 +Ref: Library<41>-Footnote-84160557 +Ref: Library<41>-Footnote-94160599 +Ref: Library<41>-Footnote-104160664 +Ref: Library<41>-Footnote-114160730 +Ref: Library<41>-Footnote-124160796 +Ref: Library<41>-Footnote-134160862 +Ref: Library<41>-Footnote-144160928 +Ref: Library<41>-Footnote-154160994 +Ref: Library<41>-Footnote-164161060 +Ref: Library<41>-Footnote-174161126 +Ref: Library<41>-Footnote-184161192 +Ref: Library<41>-Footnote-194161257 +Ref: Library<41>-Footnote-204161325 +Ref: Library<41>-Footnote-214161368 +Ref: Library<41>-Footnote-224161434 +Ref: Library<41>-Footnote-234161500 +Ref: Library<41>-Footnote-244161566 +Ref: Library<41>-Footnote-254161632 +Ref: Library<41>-Footnote-264161698 +Ref: Library<41>-Footnote-274161764 +Ref: Library<41>-Footnote-284161830 +Ref: Library<41>-Footnote-294161896 +Ref: Library<41>-Footnote-304161962 +Ref: Library<41>-Footnote-314162028 +Ref: Library<41>-Footnote-324162094 +Ref: Library<41>-Footnote-334162137 +Ref: Library<41>-Footnote-344162203 +Ref: Library<41>-Footnote-354162269 +Ref: Library<41>-Footnote-364162335 +Ref: Library<41>-Footnote-374162401 +Ref: Library<41>-Footnote-384162467 +Ref: Library<41>-Footnote-394162533 +Ref: Library<41>-Footnote-404162599 +Ref: Library<41>-Footnote-414162665 +Ref: Library<41>-Footnote-424162731 +Ref: Library<41>-Footnote-434162797 +Ref: Library<41>-Footnote-444162863 +Ref: Library<41>-Footnote-454162929 +Ref: Library<41>-Footnote-464162995 +Ref: Library<41>-Footnote-474163061 +Ref: Library<41>-Footnote-484163129 +Ref: Library<41>-Footnote-494163172 +Ref: Library<41>-Footnote-504163238 +Ref: Library<41>-Footnote-514163304 +Ref: Library<41>-Footnote-524163370 +Ref: Library<41>-Footnote-534163436 +Ref: Library<41>-Footnote-544163502 +Ref: Library<41>-Footnote-554163568 +Ref: Library<41>-Footnote-564163634 +Ref: Library<41>-Footnote-574163700 +Ref: Library<41>-Footnote-584163766 +Node: Documentation<36>4163832 +Ref: whatsnew/changelog id3514163945 +Ref: 190f4163945 +Ref: Documentation<36>-Footnote-14164261 +Ref: Documentation<36>-Footnote-24164326 +Node: Tests<38>4164391 +Ref: whatsnew/changelog id3524164502 +Ref: 19114164502 +Ref: Tests<38>-Footnote-14165279 +Ref: Tests<38>-Footnote-24165344 +Ref: Tests<38>-Footnote-34165409 +Ref: Tests<38>-Footnote-44165474 +Ref: Tests<38>-Footnote-54165539 +Ref: Tests<38>-Footnote-64165604 +Ref: Tests<38>-Footnote-74165669 +Ref: Tests<38>-Footnote-84165734 +Node: Build<39>4165799 +Ref: whatsnew/changelog id3534165902 +Ref: 19124165902 +Ref: Build<39>-Footnote-14166893 +Ref: Build<39>-Footnote-24166958 +Ref: Build<39>-Footnote-34167023 +Ref: Build<39>-Footnote-44167088 +Ref: Build<39>-Footnote-54167153 +Ref: Build<39>-Footnote-64167218 +Node: macOS<29>4167283 +Ref: whatsnew/changelog id3544167392 +Ref: 19134167392 +Ref: macOS<29>-Footnote-14167710 +Ref: macOS<29>-Footnote-24167775 +Ref: macOS<29>-Footnote-34167840 +Node: Tools/Demos<18>4167905 +Ref: whatsnew/changelog id3554168014 +Ref: 19144168014 +Ref: Tools/Demos<18>-Footnote-14168338 +Ref: Tools/Demos<18>-Footnote-24168403 +Node: C API<38>4168468 +Ref: whatsnew/changelog id3564168559 +Ref: 19154168559 +Ref: C API<38>-Footnote-14169400 +Ref: C API<38>-Footnote-24169465 +Ref: C API<38>-Footnote-34169530 +Ref: C API<38>-Footnote-44169597 +Ref: C API<38>-Footnote-54169662 +Node: Python 3 10 0 alpha 34169727 +Ref: whatsnew/changelog python-3-10-0-alpha-34169854 +Ref: 19164169854 +Node: Security<26>4170237 +Ref: whatsnew/changelog id3574170337 +Ref: 19174170337 +Ref: Security<26>-Footnote-14170577 +Node: Core and Builtins<43>4170642 +Ref: whatsnew/changelog id3584170762 +Ref: 19184170762 +Ref: Core and Builtins<43>-Footnote-14175059 +Ref: Core and Builtins<43>-Footnote-24175124 +Ref: Core and Builtins<43>-Footnote-34175189 +Ref: Core and Builtins<43>-Footnote-44175254 +Ref: Core and Builtins<43>-Footnote-54175319 +Ref: Core and Builtins<43>-Footnote-64175384 +Ref: Core and Builtins<43>-Footnote-74175451 +Ref: Core and Builtins<43>-Footnote-84175493 +Ref: Core and Builtins<43>-Footnote-94175558 +Ref: Core and Builtins<43>-Footnote-104175623 +Ref: Core and Builtins<43>-Footnote-114175689 +Ref: Core and Builtins<43>-Footnote-124175755 +Ref: Core and Builtins<43>-Footnote-134175821 +Ref: Core and Builtins<43>-Footnote-144175887 +Ref: Core and Builtins<43>-Footnote-154175953 +Ref: Core and Builtins<43>-Footnote-164176019 +Ref: Core and Builtins<43>-Footnote-174176085 +Ref: Core and Builtins<43>-Footnote-184176151 +Ref: Core and Builtins<43>-Footnote-194176217 +Ref: Core and Builtins<43>-Footnote-204176283 +Ref: Core and Builtins<43>-Footnote-214176349 +Ref: Core and Builtins<43>-Footnote-224176415 +Ref: Core and Builtins<43>-Footnote-234176481 +Node: Library<42>4176547 +Ref: whatsnew/changelog id3594176672 +Ref: 191b4176672 +Ref: Library<42>-Footnote-14187744 +Ref: Library<42>-Footnote-24187808 +Ref: Library<42>-Footnote-34187873 +Ref: Library<42>-Footnote-44187938 +Ref: Library<42>-Footnote-54188003 +Ref: Library<42>-Footnote-64188068 +Ref: Library<42>-Footnote-74188133 +Ref: Library<42>-Footnote-84188198 +Ref: Library<42>-Footnote-94188263 +Ref: Library<42>-Footnote-104188328 +Ref: Library<42>-Footnote-114188394 +Ref: Library<42>-Footnote-124188460 +Ref: Library<42>-Footnote-134188526 +Ref: Library<42>-Footnote-144188592 +Ref: Library<42>-Footnote-154188658 +Ref: Library<42>-Footnote-164188724 +Ref: Library<42>-Footnote-174188790 +Ref: Library<42>-Footnote-184188856 +Ref: Library<42>-Footnote-194188922 +Ref: Library<42>-Footnote-204188988 +Ref: Library<42>-Footnote-214189054 +Ref: Library<42>-Footnote-224189120 +Ref: Library<42>-Footnote-234189186 +Ref: Library<42>-Footnote-244189254 +Ref: Library<42>-Footnote-254189320 +Ref: Library<42>-Footnote-264189386 +Ref: Library<42>-Footnote-274189429 +Ref: Library<42>-Footnote-284189495 +Ref: Library<42>-Footnote-294189561 +Ref: Library<42>-Footnote-304189627 +Ref: Library<42>-Footnote-314189693 +Ref: Library<42>-Footnote-324189759 +Ref: Library<42>-Footnote-334189825 +Ref: Library<42>-Footnote-344189891 +Ref: Library<42>-Footnote-354189957 +Ref: Library<42>-Footnote-364190023 +Ref: Library<42>-Footnote-374190089 +Ref: Library<42>-Footnote-384190155 +Ref: Library<42>-Footnote-394190221 +Ref: Library<42>-Footnote-404190287 +Ref: Library<42>-Footnote-414190353 +Ref: Library<42>-Footnote-424190419 +Ref: Library<42>-Footnote-434190485 +Ref: Library<42>-Footnote-444190551 +Ref: Library<42>-Footnote-454190617 +Ref: Library<42>-Footnote-464190683 +Ref: Library<42>-Footnote-474190749 +Ref: Library<42>-Footnote-484190815 +Ref: Library<42>-Footnote-494190881 +Ref: Library<42>-Footnote-504190947 +Ref: Library<42>-Footnote-514191013 +Ref: Library<42>-Footnote-524191079 +Ref: Library<42>-Footnote-534191145 +Ref: Library<42>-Footnote-544191211 +Ref: Library<42>-Footnote-554191277 +Ref: Library<42>-Footnote-564191343 +Ref: Library<42>-Footnote-574191409 +Ref: Library<42>-Footnote-584191475 +Ref: Library<42>-Footnote-594191541 +Ref: Library<42>-Footnote-604191607 +Ref: Library<42>-Footnote-614191673 +Ref: Library<42>-Footnote-624191739 +Ref: Library<42>-Footnote-634191805 +Ref: Library<42>-Footnote-644191871 +Ref: Library<42>-Footnote-654191937 +Node: Documentation<37>4192003 +Ref: whatsnew/changelog id3604192116 +Ref: 19204192116 +Ref: Documentation<37>-Footnote-14192582 +Ref: Documentation<37>-Footnote-24192647 +Ref: Documentation<37>-Footnote-34192712 +Node: Tests<39>4192777 +Ref: whatsnew/changelog id3614192888 +Ref: 19214192888 +Ref: Tests<39>-Footnote-14194096 +Ref: Tests<39>-Footnote-24194161 +Ref: Tests<39>-Footnote-34194226 +Ref: Tests<39>-Footnote-44194291 +Ref: Tests<39>-Footnote-54194356 +Ref: Tests<39>-Footnote-64194421 +Ref: Tests<39>-Footnote-74194486 +Ref: Tests<39>-Footnote-84194551 +Ref: Tests<39>-Footnote-94194616 +Ref: Tests<39>-Footnote-104194681 +Ref: Tests<39>-Footnote-114194747 +Ref: Tests<39>-Footnote-124194813 +Node: Build<40>4194879 +Ref: whatsnew/changelog id3624194984 +Ref: 19224194984 +Ref: Build<40>-Footnote-14196125 +Ref: Build<40>-Footnote-24196190 +Ref: Build<40>-Footnote-34196255 +Ref: Build<40>-Footnote-44196320 +Ref: Build<40>-Footnote-54196385 +Ref: Build<40>-Footnote-64196450 +Ref: Build<40>-Footnote-74196515 +Node: Windows<37>4196580 +Ref: whatsnew/changelog id3634196685 +Ref: 19234196685 +Ref: Windows<37>-Footnote-14196977 +Ref: Windows<37>-Footnote-24197042 +Node: macOS<30>4197107 +Ref: whatsnew/changelog id3644197211 +Ref: 19244197211 +Ref: macOS<30>-Footnote-14198159 +Ref: macOS<30>-Footnote-24198224 +Ref: macOS<30>-Footnote-34198289 +Ref: macOS<30>-Footnote-44198354 +Ref: macOS<30>-Footnote-54198419 +Node: IDLE<26>4198484 +Ref: whatsnew/changelog id3654198592 +Ref: 19254198592 +Ref: IDLE<26>-Footnote-14199012 +Ref: IDLE<26>-Footnote-24199077 +Ref: IDLE<26>-Footnote-34199142 +Node: Tools/Demos<19>4199207 +Ref: whatsnew/changelog id3664199315 +Ref: 19264199315 +Ref: Tools/Demos<19>-Footnote-14199717 +Ref: Tools/Demos<19>-Footnote-24199782 +Node: C API<39>4199847 +Ref: whatsnew/changelog id3674199938 +Ref: 19274199938 +Ref: C API<39>-Footnote-14204710 +Ref: C API<39>-Footnote-24204775 +Ref: C API<39>-Footnote-34204842 +Ref: C API<39>-Footnote-44204884 +Ref: C API<39>-Footnote-54204951 +Ref: C API<39>-Footnote-64204993 +Ref: C API<39>-Footnote-74205060 +Ref: C API<39>-Footnote-84205102 +Ref: C API<39>-Footnote-94205169 +Ref: C API<39>-Footnote-104205211 +Ref: C API<39>-Footnote-114205279 +Ref: C API<39>-Footnote-124205322 +Ref: C API<39>-Footnote-134205390 +Ref: C API<39>-Footnote-144205433 +Ref: C API<39>-Footnote-154205501 +Ref: C API<39>-Footnote-164205544 +Ref: C API<39>-Footnote-174205610 +Ref: C API<39>-Footnote-184205678 +Ref: C API<39>-Footnote-194205721 +Ref: C API<39>-Footnote-204205789 +Ref: C API<39>-Footnote-214205832 +Ref: C API<39>-Footnote-224205900 +Ref: C API<39>-Footnote-234205943 +Ref: C API<39>-Footnote-244206011 +Ref: C API<39>-Footnote-254206054 +Ref: C API<39>-Footnote-264206120 +Ref: C API<39>-Footnote-274206186 +Ref: C API<39>-Footnote-284206252 +Ref: C API<39>-Footnote-294206318 +Ref: C API<39>-Footnote-304206384 +Ref: C API<39>-Footnote-314206450 +Ref: C API<39>-Footnote-324206516 +Ref: C API<39>-Footnote-334206584 +Ref: C API<39>-Footnote-344206650 +Ref: C API<39>-Footnote-354206716 +Ref: C API<39>-Footnote-364206782 +Node: Python 3 10 0 alpha 24206848 +Ref: whatsnew/changelog python-3-10-0-alpha-24206975 +Ref: 19294206975 +Node: Security<27>4207326 +Ref: whatsnew/changelog id3684207426 +Ref: 192a4207426 +Ref: Security<27>-Footnote-14207902 +Ref: Security<27>-Footnote-24207967 +Node: Core and Builtins<44>4208032 +Ref: whatsnew/changelog id3694208152 +Ref: 192b4208152 +Ref: Core and Builtins<44>-Footnote-14211978 +Ref: Core and Builtins<44>-Footnote-24212043 +Ref: Core and Builtins<44>-Footnote-34212108 +Ref: Core and Builtins<44>-Footnote-44212173 +Ref: Core and Builtins<44>-Footnote-54212238 +Ref: Core and Builtins<44>-Footnote-64212303 +Ref: Core and Builtins<44>-Footnote-74212368 +Ref: Core and Builtins<44>-Footnote-84212433 +Ref: Core and Builtins<44>-Footnote-94212498 +Ref: Core and Builtins<44>-Footnote-104212563 +Ref: Core and Builtins<44>-Footnote-114212629 +Ref: Core and Builtins<44>-Footnote-124212695 +Ref: Core and Builtins<44>-Footnote-134212761 +Ref: Core and Builtins<44>-Footnote-144212827 +Ref: Core and Builtins<44>-Footnote-154212893 +Ref: Core and Builtins<44>-Footnote-164212959 +Ref: Core and Builtins<44>-Footnote-174213025 +Ref: Core and Builtins<44>-Footnote-184213091 +Ref: Core and Builtins<44>-Footnote-194213157 +Ref: Core and Builtins<44>-Footnote-204213223 +Ref: Core and Builtins<44>-Footnote-214213289 +Node: Library<43>4213332 +Ref: whatsnew/changelog id3704213457 +Ref: 192e4213457 +Ref: Library<43>-Footnote-14220496 +Ref: Library<43>-Footnote-24220561 +Ref: Library<43>-Footnote-34220626 +Ref: Library<43>-Footnote-44220691 +Ref: Library<43>-Footnote-54220756 +Ref: Library<43>-Footnote-64220821 +Ref: Library<43>-Footnote-74220886 +Ref: Library<43>-Footnote-84220928 +Ref: Library<43>-Footnote-94220993 +Ref: Library<43>-Footnote-104221058 +Ref: Library<43>-Footnote-114221124 +Ref: Library<43>-Footnote-124221190 +Ref: Library<43>-Footnote-134221256 +Ref: Library<43>-Footnote-144221322 +Ref: Library<43>-Footnote-154221388 +Ref: Library<43>-Footnote-164221454 +Ref: Library<43>-Footnote-174221520 +Ref: Library<43>-Footnote-184221586 +Ref: Library<43>-Footnote-194221652 +Ref: Library<43>-Footnote-204221718 +Ref: Library<43>-Footnote-214221784 +Ref: Library<43>-Footnote-224221850 +Ref: Library<43>-Footnote-234221916 +Ref: Library<43>-Footnote-244221982 +Ref: Library<43>-Footnote-254222048 +Ref: Library<43>-Footnote-264222091 +Ref: Library<43>-Footnote-274222157 +Ref: Library<43>-Footnote-284222223 +Ref: Library<43>-Footnote-294222289 +Ref: Library<43>-Footnote-304222355 +Ref: Library<43>-Footnote-314222421 +Ref: Library<43>-Footnote-324222487 +Ref: Library<43>-Footnote-334222553 +Ref: Library<43>-Footnote-344222619 +Ref: Library<43>-Footnote-354222685 +Ref: Library<43>-Footnote-364222751 +Ref: Library<43>-Footnote-374222816 +Ref: Library<43>-Footnote-384222882 +Ref: Library<43>-Footnote-394222948 +Ref: Library<43>-Footnote-404223014 +Ref: Library<43>-Footnote-414223080 +Node: Documentation<38>4223146 +Ref: whatsnew/changelog id3714223259 +Ref: 19314223259 +Ref: Documentation<38>-Footnote-14224109 +Ref: Documentation<38>-Footnote-24224174 +Ref: Documentation<38>-Footnote-34224239 +Ref: Documentation<38>-Footnote-44224304 +Ref: Documentation<38>-Footnote-54224369 +Ref: Documentation<38>-Footnote-64224434 +Node: Tests<40>4224499 +Ref: whatsnew/changelog id3724224610 +Ref: 19344224610 +Ref: Tests<40>-Footnote-14225247 +Ref: Tests<40>-Footnote-24225312 +Ref: Tests<40>-Footnote-34225377 +Ref: Tests<40>-Footnote-44225442 +Node: Build<41>4225507 +Ref: whatsnew/changelog id3734225612 +Ref: 19354225612 +Ref: Build<41>-Footnote-14225876 +Node: Windows<38>4225941 +Ref: whatsnew/changelog id3744226046 +Ref: 19364226046 +Ref: Windows<38>-Footnote-14226522 +Ref: Windows<38>-Footnote-24226587 +Ref: Windows<38>-Footnote-34226652 +Ref: Windows<38>-Footnote-44226717 +Ref: Windows<38>-Footnote-54226782 +Node: macOS<31>4226847 +Ref: whatsnew/changelog id3754226951 +Ref: 19374226951 +Ref: macOS<31>-Footnote-14227101 +Node: IDLE<27>4227166 +Ref: whatsnew/changelog id3764227268 +Ref: 19384227268 +Ref: IDLE<27>-Footnote-14227881 +Ref: IDLE<27>-Footnote-24227946 +Ref: IDLE<27>-Footnote-34228011 +Node: C API<40>4228076 +Ref: whatsnew/changelog id3774228160 +Ref: 19394228160 +Ref: C API<40>-Footnote-14229495 +Ref: C API<40>-Footnote-24229560 +Ref: C API<40>-Footnote-34229625 +Ref: C API<40>-Footnote-44229690 +Ref: C API<40>-Footnote-54229755 +Ref: C API<40>-Footnote-64229820 +Ref: C API<40>-Footnote-74229885 +Ref: C API<40>-Footnote-84229950 +Node: Python 3 10 0 alpha 14230015 +Ref: whatsnew/changelog python-3-10-0-alpha-14230140 +Ref: 193b4230140 +Node: Security<28>4230491 +Ref: whatsnew/changelog id3784230591 +Ref: 193c4230591 +Ref: Security<28>-Footnote-14231494 +Ref: Security<28>-Footnote-24231559 +Ref: Security<28>-Footnote-34231624 +Ref: Security<28>-Footnote-44231680 +Ref: Security<28>-Footnote-54231745 +Ref: Security<28>-Footnote-64231810 +Ref: Security<28>-Footnote-74231866 +Ref: Security<28>-Footnote-84231931 +Node: Core and Builtins<45>4231996 +Ref: whatsnew/changelog id3794232116 +Ref: 193d4232116 +Ref: Core and Builtins<45>-Footnote-14247652 +Ref: Core and Builtins<45>-Footnote-24247717 +Ref: Core and Builtins<45>-Footnote-34247782 +Ref: Core and Builtins<45>-Footnote-44247824 +Ref: Core and Builtins<45>-Footnote-54247889 +Ref: Core and Builtins<45>-Footnote-64247954 +Ref: Core and Builtins<45>-Footnote-74247996 +Ref: Core and Builtins<45>-Footnote-84248063 +Ref: Core and Builtins<45>-Footnote-94248105 +Ref: Core and Builtins<45>-Footnote-104248170 +Ref: Core and Builtins<45>-Footnote-114248236 +Ref: Core and Builtins<45>-Footnote-124248304 +Ref: Core and Builtins<45>-Footnote-134248347 +Ref: Core and Builtins<45>-Footnote-144248415 +Ref: Core and Builtins<45>-Footnote-154248458 +Ref: Core and Builtins<45>-Footnote-164248526 +Ref: Core and Builtins<45>-Footnote-174248569 +Ref: Core and Builtins<45>-Footnote-184248637 +Ref: Core and Builtins<45>-Footnote-194248680 +Ref: Core and Builtins<45>-Footnote-204248748 +Ref: Core and Builtins<45>-Footnote-214248814 +Ref: Core and Builtins<45>-Footnote-224248882 +Ref: Core and Builtins<45>-Footnote-234248925 +Ref: Core and Builtins<45>-Footnote-244248993 +Ref: Core and Builtins<45>-Footnote-254249036 +Ref: Core and Builtins<45>-Footnote-264249104 +Ref: Core and Builtins<45>-Footnote-274249147 +Ref: Core and Builtins<45>-Footnote-284249213 +Ref: Core and Builtins<45>-Footnote-294249279 +Ref: Core and Builtins<45>-Footnote-304249345 +Ref: Core and Builtins<45>-Footnote-314249411 +Ref: Core and Builtins<45>-Footnote-324249479 +Ref: Core and Builtins<45>-Footnote-334249522 +Ref: Core and Builtins<45>-Footnote-344249588 +Ref: Core and Builtins<45>-Footnote-354249654 +Ref: Core and Builtins<45>-Footnote-364249722 +Ref: Core and Builtins<45>-Footnote-374249790 +Ref: Core and Builtins<45>-Footnote-384249833 +Ref: Core and Builtins<45>-Footnote-394249899 +Ref: Core and Builtins<45>-Footnote-404249965 +Ref: Core and Builtins<45>-Footnote-414250031 +Ref: Core and Builtins<45>-Footnote-424250099 +Ref: Core and Builtins<45>-Footnote-434250142 +Ref: Core and Builtins<45>-Footnote-444250208 +Ref: Core and Builtins<45>-Footnote-454250274 +Ref: Core and Builtins<45>-Footnote-464250340 +Ref: Core and Builtins<45>-Footnote-474250406 +Ref: Core and Builtins<45>-Footnote-484250472 +Ref: Core and Builtins<45>-Footnote-494250538 +Ref: Core and Builtins<45>-Footnote-504250604 +Ref: Core and Builtins<45>-Footnote-514250670 +Ref: Core and Builtins<45>-Footnote-524250736 +Ref: Core and Builtins<45>-Footnote-534250802 +Ref: Core and Builtins<45>-Footnote-544250870 +Ref: Core and Builtins<45>-Footnote-554250938 +Ref: Core and Builtins<45>-Footnote-564251004 +Ref: Core and Builtins<45>-Footnote-574251070 +Ref: Core and Builtins<45>-Footnote-584251138 +Ref: Core and Builtins<45>-Footnote-594251206 +Ref: Core and Builtins<45>-Footnote-604251272 +Ref: Core and Builtins<45>-Footnote-614251338 +Ref: Core and Builtins<45>-Footnote-624251404 +Ref: Core and Builtins<45>-Footnote-634251470 +Ref: Core and Builtins<45>-Footnote-644251536 +Ref: Core and Builtins<45>-Footnote-654251602 +Ref: Core and Builtins<45>-Footnote-664251668 +Ref: Core and Builtins<45>-Footnote-674251734 +Ref: Core and Builtins<45>-Footnote-684251800 +Ref: Core and Builtins<45>-Footnote-694251866 +Ref: Core and Builtins<45>-Footnote-704251932 +Ref: Core and Builtins<45>-Footnote-714251998 +Ref: Core and Builtins<45>-Footnote-724252064 +Ref: Core and Builtins<45>-Footnote-734252130 +Ref: Core and Builtins<45>-Footnote-744252196 +Ref: Core and Builtins<45>-Footnote-754252262 +Ref: Core and Builtins<45>-Footnote-764252305 +Ref: Core and Builtins<45>-Footnote-774252373 +Ref: Core and Builtins<45>-Footnote-784252439 +Ref: Core and Builtins<45>-Footnote-794252505 +Ref: Core and Builtins<45>-Footnote-804252573 +Ref: Core and Builtins<45>-Footnote-814252639 +Ref: Core and Builtins<45>-Footnote-824252705 +Ref: Core and Builtins<45>-Footnote-834252748 +Ref: Core and Builtins<45>-Footnote-844252814 +Ref: Core and Builtins<45>-Footnote-854252880 +Ref: Core and Builtins<45>-Footnote-864252946 +Ref: Core and Builtins<45>-Footnote-874253012 +Ref: Core and Builtins<45>-Footnote-884253078 +Ref: Core and Builtins<45>-Footnote-894253144 +Ref: Core and Builtins<45>-Footnote-904253210 +Ref: Core and Builtins<45>-Footnote-914253276 +Ref: Core and Builtins<45>-Footnote-924253342 +Ref: Core and Builtins<45>-Footnote-934253408 +Ref: Core and Builtins<45>-Footnote-944253474 +Ref: Core and Builtins<45>-Footnote-954253540 +Ref: Core and Builtins<45>-Footnote-964253608 +Ref: Core and Builtins<45>-Footnote-974253674 +Ref: Core and Builtins<45>-Footnote-984253740 +Ref: Core and Builtins<45>-Footnote-994253806 +Ref: Core and Builtins<45>-Footnote-1004253872 +Ref: Core and Builtins<45>-Footnote-1014253939 +Ref: Core and Builtins<45>-Footnote-1024254006 +Ref: Core and Builtins<45>-Footnote-1034254073 +Ref: Core and Builtins<45>-Footnote-1044254140 +Ref: Core and Builtins<45>-Footnote-1054254207 +Ref: Core and Builtins<45>-Footnote-1064254274 +Ref: Core and Builtins<45>-Footnote-1074254341 +Ref: Core and Builtins<45>-Footnote-1084254408 +Ref: Core and Builtins<45>-Footnote-1094254474 +Ref: Core and Builtins<45>-Footnote-1104254543 +Ref: Core and Builtins<45>-Footnote-1114254612 +Ref: Core and Builtins<45>-Footnote-1124254679 +Ref: Core and Builtins<45>-Footnote-1134254746 +Ref: Core and Builtins<45>-Footnote-1144254813 +Ref: Core and Builtins<45>-Footnote-1154254880 +Node: Library<44>4254947 +Ref: whatsnew/changelog id3804255072 +Ref: 19424255072 +Ref: Library<44>-Footnote-14277254 +Ref: Library<44>-Footnote-24277319 +Ref: Library<44>-Footnote-34277384 +Ref: Library<44>-Footnote-44277449 +Ref: Library<44>-Footnote-54277514 +Ref: Library<44>-Footnote-64277579 +Ref: Library<44>-Footnote-74277644 +Ref: Library<44>-Footnote-84277709 +Ref: Library<44>-Footnote-94277774 +Ref: Library<44>-Footnote-104277839 +Ref: Library<44>-Footnote-114277905 +Ref: Library<44>-Footnote-124277971 +Ref: Library<44>-Footnote-134278037 +Ref: Library<44>-Footnote-144278103 +Ref: Library<44>-Footnote-154278169 +Ref: Library<44>-Footnote-164278235 +Ref: Library<44>-Footnote-174278288 +Ref: Library<44>-Footnote-184278354 +Ref: Library<44>-Footnote-194278420 +Ref: Library<44>-Footnote-204278486 +Ref: Library<44>-Footnote-214278554 +Ref: Library<44>-Footnote-224278597 +Ref: Library<44>-Footnote-234278665 +Ref: Library<44>-Footnote-244278708 +Ref: Library<44>-Footnote-254278774 +Ref: Library<44>-Footnote-264278840 +Ref: Library<44>-Footnote-274278906 +Ref: Library<44>-Footnote-284278972 +Ref: Library<44>-Footnote-294279038 +Ref: Library<44>-Footnote-304279104 +Ref: Library<44>-Footnote-314279170 +Ref: Library<44>-Footnote-324279236 +Ref: Library<44>-Footnote-334279302 +Ref: Library<44>-Footnote-344279368 +Ref: Library<44>-Footnote-354279434 +Ref: Library<44>-Footnote-364279500 +Ref: Library<44>-Footnote-374279566 +Ref: Library<44>-Footnote-384279632 +Ref: Library<44>-Footnote-394279698 +Ref: Library<44>-Footnote-404279764 +Ref: Library<44>-Footnote-414279830 +Ref: Library<44>-Footnote-424279896 +Ref: Library<44>-Footnote-434279962 +Ref: Library<44>-Footnote-444280028 +Ref: Library<44>-Footnote-454280094 +Ref: Library<44>-Footnote-464280160 +Ref: Library<44>-Footnote-474280226 +Ref: Library<44>-Footnote-484280292 +Ref: Library<44>-Footnote-494280358 +Ref: Library<44>-Footnote-504280424 +Ref: Library<44>-Footnote-514280490 +Ref: Library<44>-Footnote-524280556 +Ref: Library<44>-Footnote-534280622 +Ref: Library<44>-Footnote-544280688 +Ref: Library<44>-Footnote-554280754 +Ref: Library<44>-Footnote-564280820 +Ref: Library<44>-Footnote-574280886 +Ref: Library<44>-Footnote-584280943 +Ref: Library<44>-Footnote-594281009 +Ref: Library<44>-Footnote-604281075 +Ref: Library<44>-Footnote-614281141 +Ref: Library<44>-Footnote-624281207 +Ref: Library<44>-Footnote-634281273 +Ref: Library<44>-Footnote-644281339 +Ref: Library<44>-Footnote-654281405 +Ref: Library<44>-Footnote-664281471 +Ref: Library<44>-Footnote-674281537 +Ref: Library<44>-Footnote-684281603 +Ref: Library<44>-Footnote-694281669 +Ref: Library<44>-Footnote-704281735 +Ref: Library<44>-Footnote-714281801 +Ref: Library<44>-Footnote-724281867 +Ref: Library<44>-Footnote-734281933 +Ref: Library<44>-Footnote-744281999 +Ref: Library<44>-Footnote-754282065 +Ref: Library<44>-Footnote-764282131 +Ref: Library<44>-Footnote-774282197 +Ref: Library<44>-Footnote-784282263 +Ref: Library<44>-Footnote-794282329 +Ref: Library<44>-Footnote-804282395 +Ref: Library<44>-Footnote-814282461 +Ref: Library<44>-Footnote-824282527 +Ref: Library<44>-Footnote-834282593 +Ref: Library<44>-Footnote-844282659 +Ref: Library<44>-Footnote-854282725 +Ref: Library<44>-Footnote-864282791 +Ref: Library<44>-Footnote-874282857 +Ref: Library<44>-Footnote-884282923 +Ref: Library<44>-Footnote-894282989 +Ref: Library<44>-Footnote-904283055 +Ref: Library<44>-Footnote-914283121 +Ref: Library<44>-Footnote-924283187 +Ref: Library<44>-Footnote-934283253 +Ref: Library<44>-Footnote-944283319 +Ref: Library<44>-Footnote-954283385 +Ref: Library<44>-Footnote-964283451 +Ref: Library<44>-Footnote-974283517 +Ref: Library<44>-Footnote-984283583 +Ref: Library<44>-Footnote-994283649 +Ref: Library<44>-Footnote-1004283715 +Ref: Library<44>-Footnote-1014283782 +Ref: Library<44>-Footnote-1024283849 +Ref: Library<44>-Footnote-1034283916 +Ref: Library<44>-Footnote-1044283983 +Ref: Library<44>-Footnote-1054284050 +Ref: Library<44>-Footnote-1064284117 +Ref: Library<44>-Footnote-1074284184 +Ref: Library<44>-Footnote-1084284251 +Ref: Library<44>-Footnote-1094284318 +Ref: Library<44>-Footnote-1104284385 +Ref: Library<44>-Footnote-1114284452 +Ref: Library<44>-Footnote-1124284519 +Ref: Library<44>-Footnote-1134284586 +Ref: Library<44>-Footnote-1144284653 +Ref: Library<44>-Footnote-1154284720 +Ref: Library<44>-Footnote-1164284787 +Ref: Library<44>-Footnote-1174284854 +Ref: Library<44>-Footnote-1184284921 +Ref: Library<44>-Footnote-1194284988 +Ref: Library<44>-Footnote-1204285055 +Ref: Library<44>-Footnote-1214285121 +Ref: Library<44>-Footnote-1224285188 +Ref: Library<44>-Footnote-1234285255 +Ref: Library<44>-Footnote-1244285322 +Ref: Library<44>-Footnote-1254285389 +Ref: Library<44>-Footnote-1264285433 +Ref: Library<44>-Footnote-1274285500 +Ref: Library<44>-Footnote-1284285567 +Ref: Library<44>-Footnote-1294285634 +Ref: Library<44>-Footnote-1304285701 +Ref: Library<44>-Footnote-1314285768 +Ref: Library<44>-Footnote-1324285835 +Ref: Library<44>-Footnote-1334285902 +Ref: Library<44>-Footnote-1344285969 +Ref: Library<44>-Footnote-1354286036 +Ref: Library<44>-Footnote-1364286103 +Ref: Library<44>-Footnote-1374286170 +Ref: Library<44>-Footnote-1384286237 +Ref: Library<44>-Footnote-1394286304 +Ref: Library<44>-Footnote-1404286371 +Ref: Library<44>-Footnote-1414286438 +Ref: Library<44>-Footnote-1424286505 +Ref: Library<44>-Footnote-1434286572 +Ref: Library<44>-Footnote-1444286639 +Ref: Library<44>-Footnote-1454286706 +Ref: Library<44>-Footnote-1464286773 +Ref: Library<44>-Footnote-1474286840 +Ref: Library<44>-Footnote-1484286907 +Ref: Library<44>-Footnote-1494286974 +Ref: Library<44>-Footnote-1504287041 +Ref: Library<44>-Footnote-1514287108 +Ref: Library<44>-Footnote-1524287175 +Ref: Library<44>-Footnote-1534287242 +Ref: Library<44>-Footnote-1544287309 +Node: Documentation<39>4287376 +Ref: whatsnew/changelog id3814287489 +Ref: 19494287489 +Ref: Documentation<39>-Footnote-14289254 +Ref: Documentation<39>-Footnote-24289319 +Ref: Documentation<39>-Footnote-34289361 +Ref: Documentation<39>-Footnote-44289426 +Ref: Documentation<39>-Footnote-54289491 +Ref: Documentation<39>-Footnote-64289556 +Ref: Documentation<39>-Footnote-74289621 +Ref: Documentation<39>-Footnote-84289686 +Ref: Documentation<39>-Footnote-94289751 +Ref: Documentation<39>-Footnote-104289816 +Ref: Documentation<39>-Footnote-114289882 +Ref: Documentation<39>-Footnote-124289948 +Ref: Documentation<39>-Footnote-134290014 +Ref: Documentation<39>-Footnote-144290080 +Node: Tests<41>4290146 +Ref: whatsnew/changelog id3824290257 +Ref: 194b4290257 +Ref: Tests<41>-Footnote-14292410 +Ref: Tests<41>-Footnote-24292475 +Ref: Tests<41>-Footnote-34292540 +Ref: Tests<41>-Footnote-44292605 +Ref: Tests<41>-Footnote-54292670 +Ref: Tests<41>-Footnote-64292735 +Ref: Tests<41>-Footnote-74292800 +Ref: Tests<41>-Footnote-84292865 +Ref: Tests<41>-Footnote-94292930 +Ref: Tests<41>-Footnote-104292995 +Ref: Tests<41>-Footnote-114293061 +Ref: Tests<41>-Footnote-124293127 +Ref: Tests<41>-Footnote-134293193 +Ref: Tests<41>-Footnote-144293259 +Ref: Tests<41>-Footnote-154293325 +Ref: Tests<41>-Footnote-164293391 +Node: Build<42>4293457 +Ref: whatsnew/changelog id3834293562 +Ref: 194e4293562 +Ref: Build<42>-Footnote-14294481 +Ref: Build<42>-Footnote-24294546 +Ref: Build<42>-Footnote-34294611 +Ref: Build<42>-Footnote-44294676 +Ref: Build<42>-Footnote-54294741 +Ref: Build<42>-Footnote-64294806 +Node: Windows<39>4294871 +Ref: whatsnew/changelog id3844294976 +Ref: 194f4294976 +Ref: Windows<39>-Footnote-14296747 +Ref: Windows<39>-Footnote-24296812 +Ref: Windows<39>-Footnote-34296877 +Ref: Windows<39>-Footnote-44296942 +Ref: Windows<39>-Footnote-54297007 +Ref: Windows<39>-Footnote-64297072 +Ref: Windows<39>-Footnote-74297137 +Ref: Windows<39>-Footnote-84297202 +Ref: Windows<39>-Footnote-94297267 +Ref: Windows<39>-Footnote-104297332 +Ref: Windows<39>-Footnote-114297398 +Ref: Windows<39>-Footnote-124297464 +Ref: Windows<39>-Footnote-134297530 +Ref: Windows<39>-Footnote-144297596 +Node: macOS<32>4297662 +Ref: whatsnew/changelog id3854297766 +Ref: 19504297766 +Ref: macOS<32>-Footnote-14298655 +Ref: macOS<32>-Footnote-24298720 +Ref: macOS<32>-Footnote-34298785 +Ref: macOS<32>-Footnote-44298850 +Ref: macOS<32>-Footnote-54298915 +Ref: macOS<32>-Footnote-64298980 +Node: IDLE<28>4299045 +Ref: whatsnew/changelog id3864299147 +Ref: 19514299147 +Ref: IDLE<28>-Footnote-14300310 +Ref: IDLE<28>-Footnote-24300375 +Ref: IDLE<28>-Footnote-34300440 +Ref: IDLE<28>-Footnote-44300505 +Ref: IDLE<28>-Footnote-54300570 +Ref: IDLE<28>-Footnote-64300635 +Ref: IDLE<28>-Footnote-74300700 +Ref: IDLE<28>-Footnote-84300765 +Ref: IDLE<28>-Footnote-94300830 +Ref: IDLE<28>-Footnote-104300895 +Ref: IDLE<28>-Footnote-114300961 +Node: C API<41>4301027 +Ref: whatsnew/changelog id3874301111 +Ref: 19524301111 +Ref: C API<41>-Footnote-14306238 +Ref: C API<41>-Footnote-24306303 +Ref: C API<41>-Footnote-34306368 +Ref: C API<41>-Footnote-44306433 +Ref: C API<41>-Footnote-54306498 +Ref: C API<41>-Footnote-64306563 +Ref: C API<41>-Footnote-74306628 +Ref: C API<41>-Footnote-84306693 +Ref: C API<41>-Footnote-94306758 +Ref: C API<41>-Footnote-104306823 +Ref: C API<41>-Footnote-114306889 +Ref: C API<41>-Footnote-124306955 +Ref: C API<41>-Footnote-134307021 +Ref: C API<41>-Footnote-144307087 +Ref: C API<41>-Footnote-154307153 +Ref: C API<41>-Footnote-164307219 +Ref: C API<41>-Footnote-174307285 +Ref: C API<41>-Footnote-184307351 +Ref: C API<41>-Footnote-194307417 +Ref: C API<41>-Footnote-204307483 +Ref: C API<41>-Footnote-214307526 +Ref: C API<41>-Footnote-224307592 +Ref: C API<41>-Footnote-234307658 +Ref: C API<41>-Footnote-244307724 +Ref: C API<41>-Footnote-254307790 +Ref: C API<41>-Footnote-264307856 +Ref: C API<41>-Footnote-274307922 +Ref: C API<41>-Footnote-284307988 +Ref: C API<41>-Footnote-294308054 +Node: Python 3 9 0 beta 14308120 +Ref: whatsnew/changelog python-3-9-0-beta-14308244 +Ref: 19574308244 +Node: Security<29>4308605 +Ref: whatsnew/changelog id3884308703 +Ref: 19584308703 +Ref: Security<29>-Footnote-14308907 +Node: Core and Builtins<46>4308972 +Ref: whatsnew/changelog id3894309090 +Ref: 19594309090 +Ref: Core and Builtins<46>-Footnote-14311633 +Ref: Core and Builtins<46>-Footnote-24311698 +Ref: Core and Builtins<46>-Footnote-34311763 +Ref: Core and Builtins<46>-Footnote-44311828 +Ref: Core and Builtins<46>-Footnote-54311893 +Ref: Core and Builtins<46>-Footnote-64311958 +Ref: Core and Builtins<46>-Footnote-74312000 +Ref: Core and Builtins<46>-Footnote-84312065 +Ref: Core and Builtins<46>-Footnote-94312130 +Ref: Core and Builtins<46>-Footnote-104312197 +Ref: Core and Builtins<46>-Footnote-114312240 +Ref: Core and Builtins<46>-Footnote-124312306 +Ref: Core and Builtins<46>-Footnote-134312374 +Ref: Core and Builtins<46>-Footnote-144312417 +Ref: Core and Builtins<46>-Footnote-154312483 +Ref: Core and Builtins<46>-Footnote-164312549 +Ref: Core and Builtins<46>-Footnote-174312615 +Ref: Core and Builtins<46>-Footnote-184312681 +Ref: Core and Builtins<46>-Footnote-194312749 +Ref: Core and Builtins<46>-Footnote-204312792 +Ref: Core and Builtins<46>-Footnote-214312858 +Ref: Core and Builtins<46>-Footnote-224312924 +Ref: Core and Builtins<46>-Footnote-234312990 +Ref: Core and Builtins<46>-Footnote-244313056 +Node: Library<45>4313122 +Ref: whatsnew/changelog id3904313245 +Ref: 195b4313245 +Ref: Library<45>-Footnote-14320632 +Ref: Library<45>-Footnote-24320697 +Ref: Library<45>-Footnote-34320762 +Ref: Library<45>-Footnote-44320827 +Ref: Library<45>-Footnote-54320892 +Ref: Library<45>-Footnote-64320957 +Ref: Library<45>-Footnote-74321022 +Ref: Library<45>-Footnote-84321087 +Ref: Library<45>-Footnote-94321152 +Ref: Library<45>-Footnote-104321217 +Ref: Library<45>-Footnote-114321283 +Ref: Library<45>-Footnote-124321349 +Ref: Library<45>-Footnote-134321415 +Ref: Library<45>-Footnote-144321481 +Ref: Library<45>-Footnote-154321547 +Ref: Library<45>-Footnote-164321590 +Ref: Library<45>-Footnote-174321656 +Ref: Library<45>-Footnote-184321722 +Ref: Library<45>-Footnote-194321788 +Ref: Library<45>-Footnote-204321854 +Ref: Library<45>-Footnote-214321920 +Ref: Library<45>-Footnote-224321986 +Ref: Library<45>-Footnote-234322052 +Ref: Library<45>-Footnote-244322118 +Ref: Library<45>-Footnote-254322184 +Ref: Library<45>-Footnote-264322250 +Ref: Library<45>-Footnote-274322316 +Ref: Library<45>-Footnote-284322382 +Ref: Library<45>-Footnote-294322448 +Ref: Library<45>-Footnote-304322514 +Ref: Library<45>-Footnote-314322580 +Ref: Library<45>-Footnote-324322646 +Ref: Library<45>-Footnote-334322712 +Ref: Library<45>-Footnote-344322778 +Ref: Library<45>-Footnote-354322844 +Ref: Library<45>-Footnote-364322910 +Ref: Library<45>-Footnote-374322976 +Ref: Library<45>-Footnote-384323042 +Ref: Library<45>-Footnote-394323108 +Ref: Library<45>-Footnote-404323174 +Ref: Library<45>-Footnote-414323240 +Ref: Library<45>-Footnote-424323306 +Ref: Library<45>-Footnote-434323372 +Ref: Library<45>-Footnote-444323438 +Ref: Library<45>-Footnote-454323504 +Ref: Library<45>-Footnote-464323570 +Ref: Library<45>-Footnote-474323636 +Ref: Library<45>-Footnote-484323702 +Ref: Library<45>-Footnote-494323768 +Ref: Library<45>-Footnote-504323834 +Node: Documentation<40>4323900 +Ref: whatsnew/changelog id3914324011 +Ref: 19604324011 +Ref: Documentation<40>-Footnote-14324680 +Ref: Documentation<40>-Footnote-24324745 +Ref: Documentation<40>-Footnote-34324810 +Ref: Documentation<40>-Footnote-44324875 +Ref: Documentation<40>-Footnote-54324940 +Node: Tests<42>4325005 +Ref: whatsnew/changelog id3924325114 +Ref: 19614325114 +Ref: Tests<42>-Footnote-14325469 +Ref: Tests<42>-Footnote-24325534 +Node: Build<43>4325599 +Ref: whatsnew/changelog id3934325702 +Ref: 19624325702 +Ref: Build<43>-Footnote-14326042 +Ref: Build<43>-Footnote-24326107 +Node: Windows<40>4326172 +Ref: whatsnew/changelog id3944326275 +Ref: 19634326275 +Ref: Windows<40>-Footnote-14326730 +Ref: Windows<40>-Footnote-24326795 +Ref: Windows<40>-Footnote-34326860 +Node: macOS<33>4326925 +Ref: whatsnew/changelog id3954327034 +Ref: 19644327034 +Ref: macOS<33>-Footnote-14327657 +Ref: macOS<33>-Footnote-24327722 +Node: Tools/Demos<20>4327787 +Ref: whatsnew/changelog id3964327894 +Ref: 19654327894 +Ref: Tools/Demos<20>-Footnote-14328379 +Ref: Tools/Demos<20>-Footnote-24328444 +Ref: Tools/Demos<20>-Footnote-34328509 +Node: C API<42>4328574 +Ref: whatsnew/changelog id3974328663 +Ref: 19664328663 +Ref: C API<42>-Footnote-14330689 +Ref: C API<42>-Footnote-24330754 +Ref: C API<42>-Footnote-34330819 +Ref: C API<42>-Footnote-44330884 +Ref: C API<42>-Footnote-54330949 +Ref: C API<42>-Footnote-64331014 +Ref: C API<42>-Footnote-74331079 +Ref: C API<42>-Footnote-84331144 +Ref: C API<42>-Footnote-94331209 +Ref: C API<42>-Footnote-104331274 +Ref: C API<42>-Footnote-114331340 +Node: Python 3 9 0 alpha 64331383 +Ref: whatsnew/changelog python-3-9-0-alpha-64331506 +Ref: 19674331506 +Node: Security<30>4331887 +Ref: whatsnew/changelog id3984331986 +Ref: 19684331986 +Ref: Security<30>-Footnote-14332634 +Ref: Security<30>-Footnote-24332699 +Ref: Security<30>-Footnote-34332764 +Ref: Security<30>-Footnote-44332829 +Node: Core and Builtins<47>4332884 +Ref: whatsnew/changelog id3994333003 +Ref: 19694333003 +Ref: Core and Builtins<47>-Footnote-14336776 +Ref: Core and Builtins<47>-Footnote-24336841 +Ref: Core and Builtins<47>-Footnote-34336906 +Ref: Core and Builtins<47>-Footnote-44336971 +Ref: Core and Builtins<47>-Footnote-54337036 +Ref: Core and Builtins<47>-Footnote-64337101 +Ref: Core and Builtins<47>-Footnote-74337166 +Ref: Core and Builtins<47>-Footnote-84337231 +Ref: Core and Builtins<47>-Footnote-94337296 +Ref: Core and Builtins<47>-Footnote-104337361 +Ref: Core and Builtins<47>-Footnote-114337404 +Ref: Core and Builtins<47>-Footnote-124337470 +Ref: Core and Builtins<47>-Footnote-134337538 +Ref: Core and Builtins<47>-Footnote-144337581 +Ref: Core and Builtins<47>-Footnote-154337649 +Ref: Core and Builtins<47>-Footnote-164337692 +Ref: Core and Builtins<47>-Footnote-174337760 +Ref: Core and Builtins<47>-Footnote-184337803 +Ref: Core and Builtins<47>-Footnote-194337869 +Ref: Core and Builtins<47>-Footnote-204337935 +Ref: Core and Builtins<47>-Footnote-214338003 +Ref: Core and Builtins<47>-Footnote-224338071 +Ref: Core and Builtins<47>-Footnote-234338137 +Ref: Core and Builtins<47>-Footnote-244338205 +Ref: Core and Builtins<47>-Footnote-254338248 +Ref: Core and Builtins<47>-Footnote-264338316 +Ref: Core and Builtins<47>-Footnote-274338359 +Ref: Core and Builtins<47>-Footnote-284338425 +Ref: Core and Builtins<47>-Footnote-294338491 +Ref: Core and Builtins<47>-Footnote-304338534 +Ref: Core and Builtins<47>-Footnote-314338600 +Ref: Core and Builtins<47>-Footnote-324338666 +Ref: Core and Builtins<47>-Footnote-334338732 +Node: Library<46>4338775 +Ref: whatsnew/changelog id4004338899 +Ref: 196a4338899 +Ref: Library<46>-Footnote-14349167 +Ref: Library<46>-Footnote-24349232 +Ref: Library<46>-Footnote-34349297 +Ref: Library<46>-Footnote-44349362 +Ref: Library<46>-Footnote-54349427 +Ref: Library<46>-Footnote-64349492 +Ref: Library<46>-Footnote-74349534 +Ref: Library<46>-Footnote-84349599 +Ref: Library<46>-Footnote-94349664 +Ref: Library<46>-Footnote-104349729 +Ref: Library<46>-Footnote-114349795 +Ref: Library<46>-Footnote-124349861 +Ref: Library<46>-Footnote-134349927 +Ref: Library<46>-Footnote-144349993 +Ref: Library<46>-Footnote-154350059 +Ref: Library<46>-Footnote-164350125 +Ref: Library<46>-Footnote-174350191 +Ref: Library<46>-Footnote-184350257 +Ref: Library<46>-Footnote-194350323 +Ref: Library<46>-Footnote-204350389 +Ref: Library<46>-Footnote-214350455 +Ref: Library<46>-Footnote-224350521 +Ref: Library<46>-Footnote-234350587 +Ref: Library<46>-Footnote-244350653 +Ref: Library<46>-Footnote-254350719 +Ref: Library<46>-Footnote-264350785 +Ref: Library<46>-Footnote-274350851 +Ref: Library<46>-Footnote-284350917 +Ref: Library<46>-Footnote-294350983 +Ref: Library<46>-Footnote-304351049 +Ref: Library<46>-Footnote-314351115 +Ref: Library<46>-Footnote-324351181 +Ref: Library<46>-Footnote-334351247 +Ref: Library<46>-Footnote-344351313 +Ref: Library<46>-Footnote-354351379 +Ref: Library<46>-Footnote-364351445 +Ref: Library<46>-Footnote-374351511 +Ref: Library<46>-Footnote-384351577 +Ref: Library<46>-Footnote-394351643 +Ref: Library<46>-Footnote-404351709 +Ref: Library<46>-Footnote-414351775 +Ref: Library<46>-Footnote-424351841 +Ref: Library<46>-Footnote-434351907 +Ref: Library<46>-Footnote-444351973 +Ref: Library<46>-Footnote-454352039 +Ref: Library<46>-Footnote-464352105 +Ref: Library<46>-Footnote-474352171 +Ref: Library<46>-Footnote-484352237 +Ref: Library<46>-Footnote-494352280 +Ref: Library<46>-Footnote-504352346 +Ref: Library<46>-Footnote-514352389 +Ref: Library<46>-Footnote-524352455 +Ref: Library<46>-Footnote-534352521 +Ref: Library<46>-Footnote-544352587 +Ref: Library<46>-Footnote-554352630 +Ref: Library<46>-Footnote-564352696 +Ref: Library<46>-Footnote-574352762 +Ref: Library<46>-Footnote-584352828 +Ref: Library<46>-Footnote-594352894 +Ref: Library<46>-Footnote-604352960 +Ref: Library<46>-Footnote-614353026 +Node: Documentation<41>4353092 +Ref: whatsnew/changelog id4014353204 +Ref: 196f4353204 +Ref: Documentation<41>-Footnote-14353779 +Ref: Documentation<41>-Footnote-24353844 +Ref: Documentation<41>-Footnote-34353909 +Ref: Documentation<41>-Footnote-44353974 +Node: Tests<43>4354039 +Ref: whatsnew/changelog id4024354149 +Ref: 19724354149 +Ref: Tests<43>-Footnote-14355230 +Ref: Tests<43>-Footnote-24355295 +Ref: Tests<43>-Footnote-34355360 +Ref: Tests<43>-Footnote-44355425 +Ref: Tests<43>-Footnote-54355490 +Ref: Tests<43>-Footnote-64355555 +Ref: Tests<43>-Footnote-74355620 +Ref: Tests<43>-Footnote-84355679 +Ref: Tests<43>-Footnote-94355744 +Node: Build<44>4355808 +Ref: whatsnew/changelog id4034355912 +Ref: 19744355912 +Ref: Build<44>-Footnote-14356333 +Ref: Build<44>-Footnote-24356398 +Ref: Build<44>-Footnote-34356463 +Node: Windows<41>4356528 +Ref: whatsnew/changelog id4044356632 +Ref: 19754356632 +Ref: Windows<41>-Footnote-14356845 +Ref: Windows<41>-Footnote-24356910 +Node: macOS<34>4356974 +Ref: whatsnew/changelog id4054357077 +Ref: 19764357077 +Ref: macOS<34>-Footnote-14357533 +Ref: macOS<34>-Footnote-24357598 +Node: IDLE<29>4357663 +Ref: whatsnew/changelog id4064357770 +Ref: 19774357770 +Ref: IDLE<29>-Footnote-14358114 +Ref: IDLE<29>-Footnote-24358179 +Node: Tools/Demos<21>4358244 +Ref: whatsnew/changelog id4074358351 +Ref: 19784358351 +Ref: Tools/Demos<21>-Footnote-14358818 +Ref: Tools/Demos<21>-Footnote-24358883 +Ref: Tools/Demos<21>-Footnote-34358948 +Node: C API<43>4359013 +Ref: whatsnew/changelog id4084359103 +Ref: 19794359103 +Ref: C API<43>-Footnote-14361078 +Ref: C API<43>-Footnote-24361143 +Ref: C API<43>-Footnote-34361208 +Ref: C API<43>-Footnote-44361273 +Ref: C API<43>-Footnote-54361338 +Ref: C API<43>-Footnote-64361403 +Ref: C API<43>-Footnote-74361468 +Ref: C API<43>-Footnote-84361533 +Ref: C API<43>-Footnote-94361598 +Node: Python 3 9 0 alpha 54361663 +Ref: whatsnew/changelog python-3-9-0-alpha-54361787 +Ref: 197a4361787 +Node: Security<31>4362168 +Ref: whatsnew/changelog id4094362267 +Ref: 197b4362267 +Ref: Security<31>-Footnote-14362551 +Ref: Security<31>-Footnote-24362616 +Node: Core and Builtins<48>4362672 +Ref: whatsnew/changelog id4104362791 +Ref: 197c4362791 +Ref: Core and Builtins<48>-Footnote-14368649 +Ref: Core and Builtins<48>-Footnote-24368714 +Ref: Core and Builtins<48>-Footnote-34368781 +Ref: Core and Builtins<48>-Footnote-44368823 +Ref: Core and Builtins<48>-Footnote-54368890 +Ref: Core and Builtins<48>-Footnote-64368932 +Ref: Core and Builtins<48>-Footnote-74368997 +Ref: Core and Builtins<48>-Footnote-84369062 +Ref: Core and Builtins<48>-Footnote-94369129 +Ref: Core and Builtins<48>-Footnote-104369196 +Ref: Core and Builtins<48>-Footnote-114369239 +Ref: Core and Builtins<48>-Footnote-124369305 +Ref: Core and Builtins<48>-Footnote-134369348 +Ref: Core and Builtins<48>-Footnote-144369414 +Ref: Core and Builtins<48>-Footnote-154369480 +Ref: Core and Builtins<48>-Footnote-164369523 +Ref: Core and Builtins<48>-Footnote-174369591 +Ref: Core and Builtins<48>-Footnote-184369634 +Ref: Core and Builtins<48>-Footnote-194369700 +Ref: Core and Builtins<48>-Footnote-204369766 +Ref: Core and Builtins<48>-Footnote-214369832 +Ref: Core and Builtins<48>-Footnote-224369898 +Ref: Core and Builtins<48>-Footnote-234369941 +Ref: Core and Builtins<48>-Footnote-244370007 +Ref: Core and Builtins<48>-Footnote-254370073 +Ref: Core and Builtins<48>-Footnote-264370139 +Ref: Core and Builtins<48>-Footnote-274370205 +Ref: Core and Builtins<48>-Footnote-284370271 +Ref: Core and Builtins<48>-Footnote-294370337 +Ref: Core and Builtins<48>-Footnote-304370403 +Ref: Core and Builtins<48>-Footnote-314370469 +Ref: Core and Builtins<48>-Footnote-324370537 +Ref: Core and Builtins<48>-Footnote-334370580 +Ref: Core and Builtins<48>-Footnote-344370646 +Ref: Core and Builtins<48>-Footnote-354370689 +Ref: Core and Builtins<48>-Footnote-364370755 +Ref: Core and Builtins<48>-Footnote-374370823 +Ref: Core and Builtins<48>-Footnote-384370866 +Ref: Core and Builtins<48>-Footnote-394370932 +Ref: Core and Builtins<48>-Footnote-404370998 +Ref: Core and Builtins<48>-Footnote-414371064 +Ref: Core and Builtins<48>-Footnote-424371130 +Node: Library<47>4371196 +Ref: whatsnew/changelog id4114371320 +Ref: 197d4371320 +Ref: Library<47>-Footnote-14380493 +Ref: Library<47>-Footnote-24380558 +Ref: Library<47>-Footnote-34380623 +Ref: Library<47>-Footnote-44380688 +Ref: Library<47>-Footnote-54380753 +Ref: Library<47>-Footnote-64380818 +Ref: Library<47>-Footnote-74380883 +Ref: Library<47>-Footnote-84380948 +Ref: Library<47>-Footnote-94381013 +Ref: Library<47>-Footnote-104381078 +Ref: Library<47>-Footnote-114381144 +Ref: Library<47>-Footnote-124381210 +Ref: Library<47>-Footnote-134381253 +Ref: Library<47>-Footnote-144381319 +Ref: Library<47>-Footnote-154381385 +Ref: Library<47>-Footnote-164381451 +Ref: Library<47>-Footnote-174381494 +Ref: Library<47>-Footnote-184381560 +Ref: Library<47>-Footnote-194381626 +Ref: Library<47>-Footnote-204381692 +Ref: Library<47>-Footnote-214381758 +Ref: Library<47>-Footnote-224381824 +Ref: Library<47>-Footnote-234381890 +Ref: Library<47>-Footnote-244381956 +Ref: Library<47>-Footnote-254382022 +Ref: Library<47>-Footnote-264382088 +Ref: Library<47>-Footnote-274382154 +Ref: Library<47>-Footnote-284382220 +Ref: Library<47>-Footnote-294382286 +Ref: Library<47>-Footnote-304382352 +Ref: Library<47>-Footnote-314382418 +Ref: Library<47>-Footnote-324382484 +Ref: Library<47>-Footnote-334382527 +Ref: Library<47>-Footnote-344382593 +Ref: Library<47>-Footnote-354382659 +Ref: Library<47>-Footnote-364382725 +Ref: Library<47>-Footnote-374382791 +Ref: Library<47>-Footnote-384382857 +Ref: Library<47>-Footnote-394382923 +Ref: Library<47>-Footnote-404382966 +Ref: Library<47>-Footnote-414383032 +Ref: Library<47>-Footnote-424383098 +Ref: Library<47>-Footnote-434383164 +Ref: Library<47>-Footnote-444383230 +Ref: Library<47>-Footnote-454383296 +Ref: Library<47>-Footnote-464383362 +Ref: Library<47>-Footnote-474383428 +Ref: Library<47>-Footnote-484383494 +Ref: Library<47>-Footnote-494383560 +Ref: Library<47>-Footnote-504383626 +Ref: Library<47>-Footnote-514383692 +Ref: Library<47>-Footnote-524383758 +Ref: Library<47>-Footnote-534383824 +Ref: Library<47>-Footnote-544383890 +Node: Documentation<42>4383956 +Ref: whatsnew/changelog id4124384068 +Ref: 19834384068 +Ref: Documentation<42>-Footnote-14384710 +Ref: Documentation<42>-Footnote-24384775 +Ref: Documentation<42>-Footnote-34384817 +Ref: Documentation<42>-Footnote-44384882 +Ref: Documentation<42>-Footnote-54384947 +Ref: Documentation<42>-Footnote-64385012 +Ref: Documentation<42>-Footnote-74385077 +Node: Tests<44>4385142 +Ref: whatsnew/changelog id4134385252 +Ref: 19844385252 +Ref: Tests<44>-Footnote-14385938 +Ref: Tests<44>-Footnote-24386003 +Ref: Tests<44>-Footnote-34386068 +Ref: Tests<44>-Footnote-44386133 +Node: Build<45>4386198 +Ref: whatsnew/changelog id4144386302 +Ref: 19854386302 +Ref: Build<45>-Footnote-14387177 +Ref: Build<45>-Footnote-24387242 +Ref: Build<45>-Footnote-34387307 +Node: Windows<42>4387374 +Ref: whatsnew/changelog id4154387478 +Ref: 19864387478 +Ref: Windows<42>-Footnote-14388360 +Ref: Windows<42>-Footnote-24388425 +Ref: Windows<42>-Footnote-34388490 +Ref: Windows<42>-Footnote-44388555 +Ref: Windows<42>-Footnote-54388620 +Ref: Windows<42>-Footnote-64388685 +Node: macOS<35>4388750 +Ref: whatsnew/changelog id4164388853 +Ref: 19874388853 +Ref: macOS<35>-Footnote-14388983 +Node: IDLE<30>4389048 +Ref: whatsnew/changelog id4174389155 +Ref: 19884389155 +Ref: IDLE<30>-Footnote-14389717 +Ref: IDLE<30>-Footnote-24389782 +Ref: IDLE<30>-Footnote-34389847 +Ref: IDLE<30>-Footnote-44389912 +Node: Tools/Demos<22>4389977 +Ref: whatsnew/changelog id4184390084 +Ref: 19894390084 +Ref: Tools/Demos<22>-Footnote-14390621 +Ref: Tools/Demos<22>-Footnote-24390686 +Node: C API<44>4390751 +Ref: whatsnew/changelog id4194390841 +Ref: 198a4390841 +Ref: C API<44>-Footnote-14394393 +Ref: C API<44>-Footnote-24394458 +Ref: C API<44>-Footnote-34394523 +Ref: C API<44>-Footnote-44394588 +Ref: C API<44>-Footnote-54394653 +Ref: C API<44>-Footnote-64394718 +Ref: C API<44>-Footnote-74394783 +Ref: C API<44>-Footnote-84394848 +Ref: C API<44>-Footnote-94394913 +Ref: C API<44>-Footnote-104394978 +Ref: C API<44>-Footnote-114395044 +Ref: C API<44>-Footnote-124395110 +Ref: C API<44>-Footnote-134395176 +Ref: C API<44>-Footnote-144395242 +Ref: C API<44>-Footnote-154395308 +Ref: C API<44>-Footnote-164395374 +Ref: C API<44>-Footnote-174395440 +Node: Python 3 9 0 alpha 44395506 +Ref: whatsnew/changelog python-3-9-0-alpha-44395630 +Ref: 198f4395630 +Node: Security<32>4395959 +Ref: whatsnew/changelog id4204396058 +Ref: 19904396058 +Ref: Security<32>-Footnote-14396469 +Ref: Security<32>-Footnote-24396534 +Ref: Security<32>-Footnote-34396599 +Node: Core and Builtins<49>4396664 +Ref: whatsnew/changelog id4214396783 +Ref: 19914396783 +Ref: Core and Builtins<49>-Footnote-14400196 +Ref: Core and Builtins<49>-Footnote-24400261 +Ref: Core and Builtins<49>-Footnote-34400326 +Ref: Core and Builtins<49>-Footnote-44400391 +Ref: Core and Builtins<49>-Footnote-54400456 +Ref: Core and Builtins<49>-Footnote-64400521 +Ref: Core and Builtins<49>-Footnote-74400586 +Ref: Core and Builtins<49>-Footnote-84400651 +Ref: Core and Builtins<49>-Footnote-94400718 +Ref: Core and Builtins<49>-Footnote-104400760 +Ref: Core and Builtins<49>-Footnote-114400828 +Ref: Core and Builtins<49>-Footnote-124400871 +Ref: Core and Builtins<49>-Footnote-134400937 +Ref: Core and Builtins<49>-Footnote-144401003 +Ref: Core and Builtins<49>-Footnote-154401069 +Ref: Core and Builtins<49>-Footnote-164401135 +Ref: Core and Builtins<49>-Footnote-174401201 +Ref: Core and Builtins<49>-Footnote-184401269 +Ref: Core and Builtins<49>-Footnote-194401312 +Ref: Core and Builtins<49>-Footnote-204401380 +Ref: Core and Builtins<49>-Footnote-214401423 +Ref: Core and Builtins<49>-Footnote-224401491 +Ref: Core and Builtins<49>-Footnote-234401534 +Ref: Core and Builtins<49>-Footnote-244401600 +Ref: Core and Builtins<49>-Footnote-254401666 +Ref: Core and Builtins<49>-Footnote-264401732 +Ref: Core and Builtins<49>-Footnote-274401798 +Ref: Core and Builtins<49>-Footnote-284401864 +Ref: Core and Builtins<49>-Footnote-294401930 +Node: Library<48>4401996 +Ref: whatsnew/changelog id4224402120 +Ref: 19944402120 +Ref: Library<48>-Footnote-14408315 +Ref: Library<48>-Footnote-24408380 +Ref: Library<48>-Footnote-34408445 +Ref: Library<48>-Footnote-44408510 +Ref: Library<48>-Footnote-54408575 +Ref: Library<48>-Footnote-64408640 +Ref: Library<48>-Footnote-74408705 +Ref: Library<48>-Footnote-84408770 +Ref: Library<48>-Footnote-94408835 +Ref: Library<48>-Footnote-104408900 +Ref: Library<48>-Footnote-114408966 +Ref: Library<48>-Footnote-124409032 +Ref: Library<48>-Footnote-134409098 +Ref: Library<48>-Footnote-144409164 +Ref: Library<48>-Footnote-154409230 +Ref: Library<48>-Footnote-164409296 +Ref: Library<48>-Footnote-174409378 +Ref: Library<48>-Footnote-184409444 +Ref: Library<48>-Footnote-194409510 +Ref: Library<48>-Footnote-204409576 +Ref: Library<48>-Footnote-214409642 +Ref: Library<48>-Footnote-224409708 +Ref: Library<48>-Footnote-234409774 +Ref: Library<48>-Footnote-244409840 +Ref: Library<48>-Footnote-254409906 +Ref: Library<48>-Footnote-264409972 +Ref: Library<48>-Footnote-274410038 +Ref: Library<48>-Footnote-284410081 +Ref: Library<48>-Footnote-294410147 +Ref: Library<48>-Footnote-304410213 +Ref: Library<48>-Footnote-314410279 +Ref: Library<48>-Footnote-324410345 +Ref: Library<48>-Footnote-334410411 +Ref: Library<48>-Footnote-344410477 +Ref: Library<48>-Footnote-354410543 +Ref: Library<48>-Footnote-364410609 +Ref: Library<48>-Footnote-374410675 +Ref: Library<48>-Footnote-384410741 +Ref: Library<48>-Footnote-394410807 +Node: Documentation<43>4410873 +Ref: whatsnew/changelog id4234410985 +Ref: 19964410985 +Ref: Documentation<43>-Footnote-14412026 +Ref: Documentation<43>-Footnote-24412091 +Ref: Documentation<43>-Footnote-34412156 +Ref: Documentation<43>-Footnote-44412221 +Ref: Documentation<43>-Footnote-54412286 +Ref: Documentation<43>-Footnote-64412351 +Ref: Documentation<43>-Footnote-74412416 +Node: Tests<45>4412480 +Ref: whatsnew/changelog id4244412590 +Ref: 19974412590 +Ref: Tests<45>-Footnote-14412924 +Ref: Tests<45>-Footnote-24412989 +Node: Build<46>4413054 +Ref: whatsnew/changelog id4254413158 +Ref: 19984413158 +Ref: Build<46>-Footnote-14413288 +Node: Windows<43>4413353 +Ref: whatsnew/changelog id4264413456 +Ref: 19994413456 +Ref: Windows<43>-Footnote-14414262 +Ref: Windows<43>-Footnote-24414327 +Ref: Windows<43>-Footnote-34414392 +Ref: Windows<43>-Footnote-44414457 +Ref: Windows<43>-Footnote-54414522 +Ref: Windows<43>-Footnote-64414587 +Node: IDLE<31>4414652 +Ref: whatsnew/changelog id4274414755 +Ref: 199a4414755 +Ref: IDLE<31>-Footnote-14415302 +Ref: IDLE<31>-Footnote-24415367 +Ref: IDLE<31>-Footnote-34415432 +Ref: IDLE<31>-Footnote-44415497 +Ref: IDLE<31>-Footnote-54415562 +Node: C API<45>4415627 +Ref: whatsnew/changelog id4284415710 +Ref: 199b4415710 +Ref: C API<45>-Footnote-14418369 +Ref: C API<45>-Footnote-24418434 +Ref: C API<45>-Footnote-34418499 +Ref: C API<45>-Footnote-44418564 +Ref: C API<45>-Footnote-54418629 +Ref: C API<45>-Footnote-64418694 +Ref: C API<45>-Footnote-74418759 +Ref: C API<45>-Footnote-84418824 +Ref: C API<45>-Footnote-94418889 +Ref: C API<45>-Footnote-104418954 +Ref: C API<45>-Footnote-114419020 +Ref: C API<45>-Footnote-124419086 +Node: Python 3 9 0 alpha 34419152 +Ref: whatsnew/changelog python-3-9-0-alpha-34419276 +Ref: 19a04419276 +Node: Core and Builtins<50>4419535 +Ref: whatsnew/changelog id4294419633 +Ref: 19a14419633 +Ref: Core and Builtins<50>-Footnote-14423737 +Ref: Core and Builtins<50>-Footnote-24423802 +Ref: Core and Builtins<50>-Footnote-34423867 +Ref: Core and Builtins<50>-Footnote-44423932 +Ref: Core and Builtins<50>-Footnote-54423997 +Ref: Core and Builtins<50>-Footnote-64424062 +Ref: Core and Builtins<50>-Footnote-74424127 +Ref: Core and Builtins<50>-Footnote-84424192 +Ref: Core and Builtins<50>-Footnote-94424257 +Ref: Core and Builtins<50>-Footnote-104424322 +Ref: Core and Builtins<50>-Footnote-114424388 +Ref: Core and Builtins<50>-Footnote-124424456 +Ref: Core and Builtins<50>-Footnote-134424499 +Ref: Core and Builtins<50>-Footnote-144424565 +Ref: Core and Builtins<50>-Footnote-154424631 +Ref: Core and Builtins<50>-Footnote-164424697 +Ref: Core and Builtins<50>-Footnote-174424763 +Ref: Core and Builtins<50>-Footnote-184424829 +Ref: Core and Builtins<50>-Footnote-194424895 +Ref: Core and Builtins<50>-Footnote-204424961 +Ref: Core and Builtins<50>-Footnote-214425027 +Ref: Core and Builtins<50>-Footnote-224425093 +Ref: Core and Builtins<50>-Footnote-234425159 +Ref: Core and Builtins<50>-Footnote-244425225 +Node: Library<49>4425291 +Ref: whatsnew/changelog id4304425415 +Ref: 19a54425415 +Ref: Library<49>-Footnote-14435036 +Ref: Library<49>-Footnote-24435101 +Ref: Library<49>-Footnote-34435166 +Ref: Library<49>-Footnote-44435231 +Ref: Library<49>-Footnote-54435296 +Ref: Library<49>-Footnote-64435361 +Ref: Library<49>-Footnote-74435426 +Ref: Library<49>-Footnote-84435491 +Ref: Library<49>-Footnote-94435556 +Ref: Library<49>-Footnote-104435621 +Ref: Library<49>-Footnote-114435687 +Ref: Library<49>-Footnote-124435753 +Ref: Library<49>-Footnote-134435819 +Ref: Library<49>-Footnote-144435885 +Ref: Library<49>-Footnote-154435951 +Ref: Library<49>-Footnote-164436017 +Ref: Library<49>-Footnote-174436083 +Ref: Library<49>-Footnote-184436149 +Ref: Library<49>-Footnote-194436215 +Ref: Library<49>-Footnote-204436281 +Ref: Library<49>-Footnote-214436347 +Ref: Library<49>-Footnote-224436413 +Ref: Library<49>-Footnote-234436479 +Ref: Library<49>-Footnote-244436545 +Ref: Library<49>-Footnote-254436611 +Ref: Library<49>-Footnote-264436677 +Ref: Library<49>-Footnote-274436743 +Ref: Library<49>-Footnote-284436809 +Ref: Library<49>-Footnote-294436875 +Ref: Library<49>-Footnote-304436941 +Ref: Library<49>-Footnote-314437007 +Ref: Library<49>-Footnote-324437073 +Ref: Library<49>-Footnote-334437139 +Ref: Library<49>-Footnote-344437205 +Ref: Library<49>-Footnote-354437271 +Ref: Library<49>-Footnote-364437337 +Ref: Library<49>-Footnote-374437403 +Ref: Library<49>-Footnote-384437469 +Ref: Library<49>-Footnote-394437535 +Ref: Library<49>-Footnote-404437601 +Ref: Library<49>-Footnote-414437667 +Ref: Library<49>-Footnote-424437733 +Ref: Library<49>-Footnote-434437799 +Ref: Library<49>-Footnote-444437865 +Ref: Library<49>-Footnote-454437931 +Ref: Library<49>-Footnote-464437997 +Ref: Library<49>-Footnote-474438063 +Ref: Library<49>-Footnote-484438129 +Ref: Library<49>-Footnote-494438195 +Ref: Library<49>-Footnote-504438261 +Ref: Library<49>-Footnote-514438327 +Ref: Library<49>-Footnote-524438393 +Ref: Library<49>-Footnote-534438459 +Node: Documentation<44>4438525 +Ref: whatsnew/changelog id4314438637 +Ref: 19a84438637 +Ref: Documentation<44>-Footnote-14439254 +Ref: Documentation<44>-Footnote-24439319 +Ref: Documentation<44>-Footnote-34439384 +Node: Build<47>4439448 +Ref: whatsnew/changelog id4324439557 +Ref: 19aa4439557 +Ref: Build<47>-Footnote-14440083 +Ref: Build<47>-Footnote-24440148 +Ref: Build<47>-Footnote-34440213 +Node: IDLE<32>4440278 +Ref: whatsnew/changelog id4334440379 +Ref: 19ab4440379 +Ref: IDLE<32>-Footnote-14440800 +Ref: IDLE<32>-Footnote-24440865 +Ref: IDLE<32>-Footnote-34440930 +Node: C API<46>4440995 +Ref: whatsnew/changelog id4344441078 +Ref: 19ac4441078 +Ref: C API<46>-Footnote-14441843 +Ref: C API<46>-Footnote-24441908 +Node: Python 3 9 0 alpha 24441973 +Ref: whatsnew/changelog python-3-9-0-alpha-24442097 +Ref: 19ad4442097 +Node: Security<33>4442446 +Ref: whatsnew/changelog id4354442545 +Ref: 19ae4442545 +Ref: Security<33>-Footnote-14443418 +Ref: Security<33>-Footnote-24443483 +Ref: Security<33>-Footnote-34443548 +Ref: Security<33>-Footnote-44443613 +Node: Core and Builtins<51>4443678 +Ref: whatsnew/changelog id4364443797 +Ref: 19af4443797 +Ref: Core and Builtins<51>-Footnote-14447506 +Ref: Core and Builtins<51>-Footnote-24447571 +Ref: Core and Builtins<51>-Footnote-34447636 +Ref: Core and Builtins<51>-Footnote-44447701 +Ref: Core and Builtins<51>-Footnote-54447766 +Ref: Core and Builtins<51>-Footnote-64447831 +Ref: Core and Builtins<51>-Footnote-74447896 +Ref: Core and Builtins<51>-Footnote-84447961 +Ref: Core and Builtins<51>-Footnote-94448026 +Ref: Core and Builtins<51>-Footnote-104448091 +Ref: Core and Builtins<51>-Footnote-114448157 +Ref: Core and Builtins<51>-Footnote-124448223 +Ref: Core and Builtins<51>-Footnote-134448289 +Ref: Core and Builtins<51>-Footnote-144448355 +Ref: Core and Builtins<51>-Footnote-154448421 +Ref: Core and Builtins<51>-Footnote-164448487 +Ref: Core and Builtins<51>-Footnote-174448553 +Ref: Core and Builtins<51>-Footnote-184448619 +Ref: Core and Builtins<51>-Footnote-194448685 +Ref: Core and Builtins<51>-Footnote-204448751 +Node: Library<50>4448817 +Ref: whatsnew/changelog id4374448941 +Ref: 19b04448941 +Ref: Library<50>-Footnote-14456724 +Ref: Library<50>-Footnote-24456789 +Ref: Library<50>-Footnote-34456854 +Ref: Library<50>-Footnote-44456919 +Ref: Library<50>-Footnote-54456984 +Ref: Library<50>-Footnote-64457049 +Ref: Library<50>-Footnote-74457114 +Ref: Library<50>-Footnote-84457179 +Ref: Library<50>-Footnote-94457244 +Ref: Library<50>-Footnote-104457309 +Ref: Library<50>-Footnote-114457375 +Ref: Library<50>-Footnote-124457441 +Ref: Library<50>-Footnote-134457507 +Ref: Library<50>-Footnote-144457573 +Ref: Library<50>-Footnote-154457639 +Ref: Library<50>-Footnote-164457705 +Ref: Library<50>-Footnote-174457771 +Ref: Library<50>-Footnote-184457837 +Ref: Library<50>-Footnote-194457903 +Ref: Library<50>-Footnote-204457969 +Ref: Library<50>-Footnote-214458035 +Ref: Library<50>-Footnote-224458101 +Ref: Library<50>-Footnote-234458167 +Ref: Library<50>-Footnote-244458233 +Ref: Library<50>-Footnote-254458299 +Ref: Library<50>-Footnote-264458365 +Ref: Library<50>-Footnote-274458431 +Ref: Library<50>-Footnote-284458497 +Ref: Library<50>-Footnote-294458563 +Ref: Library<50>-Footnote-304458629 +Ref: Library<50>-Footnote-314458695 +Ref: Library<50>-Footnote-324458761 +Ref: Library<50>-Footnote-334458827 +Ref: Library<50>-Footnote-344458893 +Ref: Library<50>-Footnote-354458959 +Ref: Library<50>-Footnote-364459025 +Ref: Library<50>-Footnote-374459091 +Ref: Library<50>-Footnote-384459157 +Ref: Library<50>-Footnote-394459223 +Ref: Library<50>-Footnote-404459289 +Node: Documentation<45>4459355 +Ref: whatsnew/changelog id4384459467 +Ref: 19b14459467 +Ref: Documentation<45>-Footnote-14460054 +Ref: Documentation<45>-Footnote-24460119 +Ref: Documentation<45>-Footnote-34460184 +Node: Tests<46>4460249 +Ref: whatsnew/changelog id4394460359 +Ref: 19b24460359 +Ref: Tests<46>-Footnote-14462939 +Ref: Tests<46>-Footnote-24463004 +Ref: Tests<46>-Footnote-34463069 +Ref: Tests<46>-Footnote-44463134 +Ref: Tests<46>-Footnote-54463199 +Ref: Tests<46>-Footnote-64463264 +Ref: Tests<46>-Footnote-74463329 +Ref: Tests<46>-Footnote-84463394 +Ref: Tests<46>-Footnote-94463459 +Ref: Tests<46>-Footnote-104463524 +Ref: Tests<46>-Footnote-114463590 +Ref: Tests<46>-Footnote-124463656 +Ref: Tests<46>-Footnote-134463722 +Node: Build<48>4463788 +Ref: whatsnew/changelog id4404463892 +Ref: 19b64463892 +Ref: Build<48>-Footnote-14464294 +Ref: Build<48>-Footnote-24464359 +Node: Windows<44>4464424 +Ref: whatsnew/changelog id4414464528 +Ref: 19b74464528 +Ref: Windows<44>-Footnote-14464769 +Ref: Windows<44>-Footnote-24464834 +Node: macOS<36>4464899 +Ref: whatsnew/changelog id4424465002 +Ref: 19b84465002 +Ref: macOS<36>-Footnote-14465310 +Node: IDLE<33>4465375 +Ref: whatsnew/changelog id4434465476 +Ref: 19b94465476 +Ref: IDLE<33>-Footnote-14466071 +Ref: IDLE<33>-Footnote-24466136 +Ref: IDLE<33>-Footnote-34466201 +Ref: IDLE<33>-Footnote-44466266 +Node: C API<47>4466331 +Ref: whatsnew/changelog id4444466414 +Ref: 19ba4466414 +Ref: C API<47>-Footnote-14466948 +Ref: C API<47>-Footnote-24467013 +Ref: C API<47>-Footnote-34467078 +Node: Python 3 9 0 alpha 14467143 +Ref: whatsnew/changelog python-3-9-0-alpha-14467266 +Ref: 19bb4467266 +Node: Security<34>4467647 +Ref: whatsnew/changelog id4454467746 +Ref: 19bc4467746 +Ref: Security<34>-Footnote-14470069 +Ref: Security<34>-Footnote-24470134 +Ref: Security<34>-Footnote-34470199 +Ref: Security<34>-Footnote-44470264 +Ref: Security<34>-Footnote-54470329 +Ref: Security<34>-Footnote-64470394 +Ref: Security<34>-Footnote-74470459 +Ref: Security<34>-Footnote-84470515 +Ref: Security<34>-Footnote-94470580 +Ref: Security<34>-Footnote-104470645 +Ref: Security<34>-Footnote-114470711 +Ref: Security<34>-Footnote-124470777 +Ref: Security<34>-Footnote-134470843 +Ref: Security<34>-Footnote-144470909 +Ref: Security<34>-Footnote-154470975 +Node: Core and Builtins<52>4471041 +Ref: whatsnew/changelog id4464471160 +Ref: 19bf4471160 +Ref: Core and Builtins<52>-Footnote-14486696 +Ref: Core and Builtins<52>-Footnote-24486761 +Ref: Core and Builtins<52>-Footnote-34486826 +Ref: Core and Builtins<52>-Footnote-44486891 +Ref: Core and Builtins<52>-Footnote-54486956 +Ref: Core and Builtins<52>-Footnote-64487021 +Ref: Core and Builtins<52>-Footnote-74487086 +Ref: Core and Builtins<52>-Footnote-84487151 +Ref: Core and Builtins<52>-Footnote-94487216 +Ref: Core and Builtins<52>-Footnote-104487281 +Ref: Core and Builtins<52>-Footnote-114487347 +Ref: Core and Builtins<52>-Footnote-124487413 +Ref: Core and Builtins<52>-Footnote-134487479 +Ref: Core and Builtins<52>-Footnote-144487545 +Ref: Core and Builtins<52>-Footnote-154487611 +Ref: Core and Builtins<52>-Footnote-164487677 +Ref: Core and Builtins<52>-Footnote-174487743 +Ref: Core and Builtins<52>-Footnote-184487809 +Ref: Core and Builtins<52>-Footnote-194487875 +Ref: Core and Builtins<52>-Footnote-204487941 +Ref: Core and Builtins<52>-Footnote-214487984 +Ref: Core and Builtins<52>-Footnote-224488050 +Ref: Core and Builtins<52>-Footnote-234488116 +Ref: Core and Builtins<52>-Footnote-244488182 +Ref: Core and Builtins<52>-Footnote-254488248 +Ref: Core and Builtins<52>-Footnote-264488314 +Ref: Core and Builtins<52>-Footnote-274488380 +Ref: Core and Builtins<52>-Footnote-284488446 +Ref: Core and Builtins<52>-Footnote-294488512 +Ref: Core and Builtins<52>-Footnote-304488578 +Ref: Core and Builtins<52>-Footnote-314488644 +Ref: Core and Builtins<52>-Footnote-324488710 +Ref: Core and Builtins<52>-Footnote-334488776 +Ref: Core and Builtins<52>-Footnote-344488842 +Ref: Core and Builtins<52>-Footnote-354488908 +Ref: Core and Builtins<52>-Footnote-364488974 +Ref: Core and Builtins<52>-Footnote-374489040 +Ref: Core and Builtins<52>-Footnote-384489106 +Ref: Core and Builtins<52>-Footnote-394489172 +Ref: Core and Builtins<52>-Footnote-404489238 +Ref: Core and Builtins<52>-Footnote-414489303 +Ref: Core and Builtins<52>-Footnote-424489369 +Ref: Core and Builtins<52>-Footnote-434489435 +Ref: Core and Builtins<52>-Footnote-444489501 +Ref: Core and Builtins<52>-Footnote-454489567 +Ref: Core and Builtins<52>-Footnote-464489633 +Ref: Core and Builtins<52>-Footnote-474489699 +Ref: Core and Builtins<52>-Footnote-484489765 +Ref: Core and Builtins<52>-Footnote-494489831 +Ref: Core and Builtins<52>-Footnote-504489897 +Ref: Core and Builtins<52>-Footnote-514489963 +Ref: Core and Builtins<52>-Footnote-524490029 +Ref: Core and Builtins<52>-Footnote-534490095 +Ref: Core and Builtins<52>-Footnote-544490138 +Ref: Core and Builtins<52>-Footnote-554490204 +Ref: Core and Builtins<52>-Footnote-564490270 +Ref: Core and Builtins<52>-Footnote-574490336 +Ref: Core and Builtins<52>-Footnote-584490402 +Ref: Core and Builtins<52>-Footnote-594490468 +Ref: Core and Builtins<52>-Footnote-604490534 +Ref: Core and Builtins<52>-Footnote-614490600 +Ref: Core and Builtins<52>-Footnote-624490666 +Ref: Core and Builtins<52>-Footnote-634490732 +Ref: Core and Builtins<52>-Footnote-644490798 +Ref: Core and Builtins<52>-Footnote-654490864 +Ref: Core and Builtins<52>-Footnote-664490930 +Ref: Core and Builtins<52>-Footnote-674490996 +Ref: Core and Builtins<52>-Footnote-684491062 +Ref: Core and Builtins<52>-Footnote-694491128 +Ref: Core and Builtins<52>-Footnote-704491194 +Ref: Core and Builtins<52>-Footnote-714491260 +Ref: Core and Builtins<52>-Footnote-724491326 +Ref: Core and Builtins<52>-Footnote-734491392 +Ref: Core and Builtins<52>-Footnote-744491458 +Ref: Core and Builtins<52>-Footnote-754491524 +Ref: Core and Builtins<52>-Footnote-764491590 +Ref: Core and Builtins<52>-Footnote-774491656 +Ref: Core and Builtins<52>-Footnote-784491722 +Ref: Core and Builtins<52>-Footnote-794491788 +Ref: Core and Builtins<52>-Footnote-804491854 +Ref: Core and Builtins<52>-Footnote-814491920 +Ref: Core and Builtins<52>-Footnote-824491986 +Ref: Core and Builtins<52>-Footnote-834492052 +Ref: Core and Builtins<52>-Footnote-844492118 +Ref: Core and Builtins<52>-Footnote-854492184 +Ref: Core and Builtins<52>-Footnote-864492250 +Ref: Core and Builtins<52>-Footnote-874492316 +Ref: Core and Builtins<52>-Footnote-884492382 +Ref: Core and Builtins<52>-Footnote-894492448 +Ref: Core and Builtins<52>-Footnote-904492514 +Ref: Core and Builtins<52>-Footnote-914492580 +Ref: Core and Builtins<52>-Footnote-924492646 +Ref: Core and Builtins<52>-Footnote-934492712 +Ref: Core and Builtins<52>-Footnote-944492778 +Node: Library<51>4492844 +Ref: whatsnew/changelog id4474492968 +Ref: 19c44492968 +Ref: Library<51>-Footnote-14532456 +Ref: Library<51>-Footnote-24532521 +Ref: Library<51>-Footnote-34532586 +Ref: Library<51>-Footnote-44532651 +Ref: Library<51>-Footnote-54532716 +Ref: Library<51>-Footnote-64532781 +Ref: Library<51>-Footnote-74532846 +Ref: Library<51>-Footnote-84532911 +Ref: Library<51>-Footnote-94532976 +Ref: Library<51>-Footnote-104533041 +Ref: Library<51>-Footnote-114533107 +Ref: Library<51>-Footnote-124533173 +Ref: Library<51>-Footnote-134533239 +Ref: Library<51>-Footnote-144533305 +Ref: Library<51>-Footnote-154533371 +Ref: Library<51>-Footnote-164533437 +Ref: Library<51>-Footnote-174533503 +Ref: Library<51>-Footnote-184533569 +Ref: Library<51>-Footnote-194533635 +Ref: Library<51>-Footnote-204533701 +Ref: Library<51>-Footnote-214533767 +Ref: Library<51>-Footnote-224533833 +Ref: Library<51>-Footnote-234533899 +Ref: Library<51>-Footnote-244533965 +Ref: Library<51>-Footnote-254534031 +Ref: Library<51>-Footnote-264534097 +Ref: Library<51>-Footnote-274534163 +Ref: Library<51>-Footnote-284534229 +Ref: Library<51>-Footnote-294534295 +Ref: Library<51>-Footnote-304534361 +Ref: Library<51>-Footnote-314534427 +Ref: Library<51>-Footnote-324534493 +Ref: Library<51>-Footnote-334534559 +Ref: Library<51>-Footnote-344534625 +Ref: Library<51>-Footnote-354534691 +Ref: Library<51>-Footnote-364534757 +Ref: Library<51>-Footnote-374534823 +Ref: Library<51>-Footnote-384534889 +Ref: Library<51>-Footnote-394534955 +Ref: Library<51>-Footnote-404535021 +Ref: Library<51>-Footnote-414535087 +Ref: Library<51>-Footnote-424535153 +Ref: Library<51>-Footnote-434535219 +Ref: Library<51>-Footnote-444535285 +Ref: Library<51>-Footnote-454535351 +Ref: Library<51>-Footnote-464535417 +Ref: Library<51>-Footnote-474535483 +Ref: Library<51>-Footnote-484535549 +Ref: Library<51>-Footnote-494535615 +Ref: Library<51>-Footnote-504535681 +Ref: Library<51>-Footnote-514535747 +Ref: Library<51>-Footnote-524535813 +Ref: Library<51>-Footnote-534535879 +Ref: Library<51>-Footnote-544535945 +Ref: Library<51>-Footnote-554536011 +Ref: Library<51>-Footnote-564536077 +Ref: Library<51>-Footnote-574536143 +Ref: Library<51>-Footnote-584536209 +Ref: Library<51>-Footnote-594536275 +Ref: Library<51>-Footnote-604536341 +Ref: Library<51>-Footnote-614536407 +Ref: Library<51>-Footnote-624536473 +Ref: Library<51>-Footnote-634536539 +Ref: Library<51>-Footnote-644536604 +Ref: Library<51>-Footnote-654536670 +Ref: Library<51>-Footnote-664536736 +Ref: Library<51>-Footnote-674536802 +Ref: Library<51>-Footnote-684536868 +Ref: Library<51>-Footnote-694536934 +Ref: Library<51>-Footnote-704537000 +Ref: Library<51>-Footnote-714537066 +Ref: Library<51>-Footnote-724537132 +Ref: Library<51>-Footnote-734537198 +Ref: Library<51>-Footnote-744537264 +Ref: Library<51>-Footnote-754537330 +Ref: Library<51>-Footnote-764537396 +Ref: Library<51>-Footnote-774537504 +Ref: Library<51>-Footnote-784537570 +Ref: Library<51>-Footnote-794537636 +Ref: Library<51>-Footnote-804537702 +Ref: Library<51>-Footnote-814537768 +Ref: Library<51>-Footnote-824537834 +Ref: Library<51>-Footnote-834537900 +Ref: Library<51>-Footnote-844537966 +Ref: Library<51>-Footnote-854538032 +Ref: Library<51>-Footnote-864538098 +Ref: Library<51>-Footnote-874538164 +Ref: Library<51>-Footnote-884538230 +Ref: Library<51>-Footnote-894538296 +Ref: Library<51>-Footnote-904538362 +Ref: Library<51>-Footnote-914538428 +Ref: Library<51>-Footnote-924538494 +Ref: Library<51>-Footnote-934538560 +Ref: Library<51>-Footnote-944538626 +Ref: Library<51>-Footnote-954538692 +Ref: Library<51>-Footnote-964538758 +Ref: Library<51>-Footnote-974538824 +Ref: Library<51>-Footnote-984538890 +Ref: Library<51>-Footnote-994538956 +Ref: Library<51>-Footnote-1004539022 +Ref: Library<51>-Footnote-1014539089 +Ref: Library<51>-Footnote-1024539156 +Ref: Library<51>-Footnote-1034539223 +Ref: Library<51>-Footnote-1044539290 +Ref: Library<51>-Footnote-1054539357 +Ref: Library<51>-Footnote-1064539424 +Ref: Library<51>-Footnote-1074539491 +Ref: Library<51>-Footnote-1084539557 +Ref: Library<51>-Footnote-1094539624 +Ref: Library<51>-Footnote-1104539691 +Ref: Library<51>-Footnote-1114539758 +Ref: Library<51>-Footnote-1124539825 +Ref: Library<51>-Footnote-1134539892 +Ref: Library<51>-Footnote-1144539959 +Ref: Library<51>-Footnote-1154540026 +Ref: Library<51>-Footnote-1164540093 +Ref: Library<51>-Footnote-1174540160 +Ref: Library<51>-Footnote-1184540227 +Ref: Library<51>-Footnote-1194540294 +Ref: Library<51>-Footnote-1204540361 +Ref: Library<51>-Footnote-1214540428 +Ref: Library<51>-Footnote-1224540495 +Ref: Library<51>-Footnote-1234540562 +Ref: Library<51>-Footnote-1244540629 +Ref: Library<51>-Footnote-1254540696 +Ref: Library<51>-Footnote-1264540763 +Ref: Library<51>-Footnote-1274540830 +Ref: Library<51>-Footnote-1284540897 +Ref: Library<51>-Footnote-1294540964 +Ref: Library<51>-Footnote-1304541031 +Ref: Library<51>-Footnote-1314541098 +Ref: Library<51>-Footnote-1324541165 +Ref: Library<51>-Footnote-1334541232 +Ref: Library<51>-Footnote-1344541299 +Ref: Library<51>-Footnote-1354541366 +Ref: Library<51>-Footnote-1364541433 +Ref: Library<51>-Footnote-1374541510 +Ref: Library<51>-Footnote-1384541577 +Ref: Library<51>-Footnote-1394541644 +Ref: Library<51>-Footnote-1404541711 +Ref: Library<51>-Footnote-1414541778 +Ref: Library<51>-Footnote-1424541845 +Ref: Library<51>-Footnote-1434541912 +Ref: Library<51>-Footnote-1444541979 +Ref: Library<51>-Footnote-1454542046 +Ref: Library<51>-Footnote-1464542113 +Ref: Library<51>-Footnote-1474542180 +Ref: Library<51>-Footnote-1484542247 +Ref: Library<51>-Footnote-1494542314 +Ref: Library<51>-Footnote-1504542381 +Ref: Library<51>-Footnote-1514542448 +Ref: Library<51>-Footnote-1524542515 +Ref: Library<51>-Footnote-1534542582 +Ref: Library<51>-Footnote-1544542649 +Ref: Library<51>-Footnote-1554542716 +Ref: Library<51>-Footnote-1564542783 +Ref: Library<51>-Footnote-1574542850 +Ref: Library<51>-Footnote-1584542917 +Ref: Library<51>-Footnote-1594542984 +Ref: Library<51>-Footnote-1604543051 +Ref: Library<51>-Footnote-1614543118 +Ref: Library<51>-Footnote-1624543185 +Ref: Library<51>-Footnote-1634543252 +Ref: Library<51>-Footnote-1644543319 +Ref: Library<51>-Footnote-1654543386 +Ref: Library<51>-Footnote-1664543453 +Ref: Library<51>-Footnote-1674543520 +Ref: Library<51>-Footnote-1684543587 +Ref: Library<51>-Footnote-1694543654 +Ref: Library<51>-Footnote-1704543721 +Ref: Library<51>-Footnote-1714543788 +Ref: Library<51>-Footnote-1724543855 +Ref: Library<51>-Footnote-1734543899 +Ref: Library<51>-Footnote-1744543966 +Ref: Library<51>-Footnote-1754544033 +Ref: Library<51>-Footnote-1764544100 +Ref: Library<51>-Footnote-1774544167 +Ref: Library<51>-Footnote-1784544234 +Ref: Library<51>-Footnote-1794544301 +Ref: Library<51>-Footnote-1804544368 +Ref: Library<51>-Footnote-1814544435 +Ref: Library<51>-Footnote-1824544502 +Ref: Library<51>-Footnote-1834544569 +Ref: Library<51>-Footnote-1844544636 +Ref: Library<51>-Footnote-1854544703 +Ref: Library<51>-Footnote-1864544770 +Ref: Library<51>-Footnote-1874544837 +Ref: Library<51>-Footnote-1884544904 +Ref: Library<51>-Footnote-1894544971 +Ref: Library<51>-Footnote-1904545038 +Ref: Library<51>-Footnote-1914545105 +Ref: Library<51>-Footnote-1924545172 +Ref: Library<51>-Footnote-1934545239 +Ref: Library<51>-Footnote-1944545306 +Ref: Library<51>-Footnote-1954545373 +Ref: Library<51>-Footnote-1964545440 +Ref: Library<51>-Footnote-1974545507 +Ref: Library<51>-Footnote-1984545574 +Ref: Library<51>-Footnote-1994545641 +Ref: Library<51>-Footnote-2004545708 +Ref: Library<51>-Footnote-2014545775 +Ref: Library<51>-Footnote-2024545842 +Ref: Library<51>-Footnote-2034545909 +Ref: Library<51>-Footnote-2044545976 +Ref: Library<51>-Footnote-2054546043 +Ref: Library<51>-Footnote-2064546110 +Ref: Library<51>-Footnote-2074546177 +Ref: Library<51>-Footnote-2084546244 +Ref: Library<51>-Footnote-2094546311 +Ref: Library<51>-Footnote-2104546378 +Ref: Library<51>-Footnote-2114546445 +Ref: Library<51>-Footnote-2124546512 +Ref: Library<51>-Footnote-2134546579 +Ref: Library<51>-Footnote-2144546646 +Ref: Library<51>-Footnote-2154546713 +Ref: Library<51>-Footnote-2164546780 +Ref: Library<51>-Footnote-2174546847 +Ref: Library<51>-Footnote-2184546914 +Ref: Library<51>-Footnote-2194546981 +Ref: Library<51>-Footnote-2204547048 +Ref: Library<51>-Footnote-2214547115 +Ref: Library<51>-Footnote-2224547182 +Ref: Library<51>-Footnote-2234547249 +Ref: Library<51>-Footnote-2244547316 +Ref: Library<51>-Footnote-2254547383 +Ref: Library<51>-Footnote-2264547450 +Ref: Library<51>-Footnote-2274547517 +Ref: Library<51>-Footnote-2284547584 +Ref: Library<51>-Footnote-2294547651 +Ref: Library<51>-Footnote-2304547718 +Ref: Library<51>-Footnote-2314547785 +Ref: Library<51>-Footnote-2324547852 +Ref: Library<51>-Footnote-2334547919 +Ref: Library<51>-Footnote-2344547986 +Ref: Library<51>-Footnote-2354548053 +Ref: Library<51>-Footnote-2364548120 +Ref: Library<51>-Footnote-2374548187 +Ref: Library<51>-Footnote-2384548254 +Ref: Library<51>-Footnote-2394548321 +Ref: Library<51>-Footnote-2404548387 +Ref: Library<51>-Footnote-2414548454 +Ref: Library<51>-Footnote-2424548521 +Ref: Library<51>-Footnote-2434548588 +Ref: Library<51>-Footnote-2444548655 +Ref: Library<51>-Footnote-2454548722 +Ref: Library<51>-Footnote-2464548789 +Ref: Library<51>-Footnote-2474548856 +Ref: Library<51>-Footnote-2484548923 +Ref: Library<51>-Footnote-2494548990 +Ref: Library<51>-Footnote-2504549057 +Ref: Library<51>-Footnote-2514549124 +Ref: Library<51>-Footnote-2524549191 +Ref: Library<51>-Footnote-2534549258 +Node: Documentation<46>4549324 +Ref: whatsnew/changelog id4484549436 +Ref: 19d14549436 +Ref: Documentation<46>-Footnote-14553907 +Ref: Documentation<46>-Footnote-24553972 +Ref: Documentation<46>-Footnote-34554037 +Ref: Documentation<46>-Footnote-44554102 +Ref: Documentation<46>-Footnote-54554167 +Ref: Documentation<46>-Footnote-64554232 +Ref: Documentation<46>-Footnote-74554297 +Ref: Documentation<46>-Footnote-84554362 +Ref: Documentation<46>-Footnote-94554427 +Ref: Documentation<46>-Footnote-104554492 +Ref: Documentation<46>-Footnote-114554558 +Ref: Documentation<46>-Footnote-124554624 +Ref: Documentation<46>-Footnote-134554690 +Ref: Documentation<46>-Footnote-144554756 +Ref: Documentation<46>-Footnote-154554822 +Ref: Documentation<46>-Footnote-164554888 +Ref: Documentation<46>-Footnote-174554954 +Ref: Documentation<46>-Footnote-184555020 +Ref: Documentation<46>-Footnote-194555086 +Ref: Documentation<46>-Footnote-204555152 +Ref: Documentation<46>-Footnote-214555218 +Ref: Documentation<46>-Footnote-224555284 +Ref: Documentation<46>-Footnote-234555350 +Ref: Documentation<46>-Footnote-244555416 +Ref: Documentation<46>-Footnote-254555482 +Ref: Documentation<46>-Footnote-264555548 +Ref: Documentation<46>-Footnote-274555614 +Ref: Documentation<46>-Footnote-284555680 +Ref: Documentation<46>-Footnote-294555746 +Ref: Documentation<46>-Footnote-304555812 +Ref: Documentation<46>-Footnote-314555878 +Ref: Documentation<46>-Footnote-324555944 +Ref: Documentation<46>-Footnote-334556010 +Ref: Documentation<46>-Footnote-344556076 +Ref: Documentation<46>-Footnote-354556142 +Node: Tests<47>4556208 +Ref: whatsnew/changelog id4494556318 +Ref: 19d34556318 +Ref: Tests<47>-Footnote-14564455 +Ref: Tests<47>-Footnote-24564520 +Ref: Tests<47>-Footnote-34564585 +Ref: Tests<47>-Footnote-44564650 +Ref: Tests<47>-Footnote-54564715 +Ref: Tests<47>-Footnote-64564780 +Ref: Tests<47>-Footnote-74564845 +Ref: Tests<47>-Footnote-84564910 +Ref: Tests<47>-Footnote-94564975 +Ref: Tests<47>-Footnote-104565040 +Ref: Tests<47>-Footnote-114565106 +Ref: Tests<47>-Footnote-124565172 +Ref: Tests<47>-Footnote-134565238 +Ref: Tests<47>-Footnote-144565304 +Ref: Tests<47>-Footnote-154565370 +Ref: Tests<47>-Footnote-164565436 +Ref: Tests<47>-Footnote-174565502 +Ref: Tests<47>-Footnote-184565568 +Ref: Tests<47>-Footnote-194565634 +Ref: Tests<47>-Footnote-204565700 +Ref: Tests<47>-Footnote-214565766 +Ref: Tests<47>-Footnote-224565832 +Ref: Tests<47>-Footnote-234565898 +Ref: Tests<47>-Footnote-244565964 +Ref: Tests<47>-Footnote-254566030 +Ref: Tests<47>-Footnote-264566096 +Ref: Tests<47>-Footnote-274566162 +Ref: Tests<47>-Footnote-284566228 +Ref: Tests<47>-Footnote-294566294 +Ref: Tests<47>-Footnote-304566360 +Ref: Tests<47>-Footnote-314566426 +Ref: Tests<47>-Footnote-324566492 +Ref: Tests<47>-Footnote-334566558 +Ref: Tests<47>-Footnote-344566624 +Ref: Tests<47>-Footnote-354566690 +Ref: Tests<47>-Footnote-364566756 +Ref: Tests<47>-Footnote-374566822 +Ref: Tests<47>-Footnote-384566888 +Ref: Tests<47>-Footnote-394566954 +Ref: Tests<47>-Footnote-404567020 +Ref: Tests<47>-Footnote-414567086 +Ref: Tests<47>-Footnote-424567152 +Ref: Tests<47>-Footnote-434567218 +Ref: Tests<47>-Footnote-444567284 +Ref: Tests<47>-Footnote-454567350 +Ref: Tests<47>-Footnote-464567416 +Ref: Tests<47>-Footnote-474567482 +Ref: Tests<47>-Footnote-484567548 +Node: Build<49>4567614 +Ref: whatsnew/changelog id4504567718 +Ref: 19d94567718 +Ref: Build<49>-Footnote-14571557 +Ref: Build<49>-Footnote-24571622 +Ref: Build<49>-Footnote-34571687 +Ref: Build<49>-Footnote-44571752 +Ref: Build<49>-Footnote-54571817 +Ref: Build<49>-Footnote-64571882 +Ref: Build<49>-Footnote-74571947 +Ref: Build<49>-Footnote-84572012 +Ref: Build<49>-Footnote-94572077 +Ref: Build<49>-Footnote-104572142 +Ref: Build<49>-Footnote-114572208 +Ref: Build<49>-Footnote-124572274 +Ref: Build<49>-Footnote-134572340 +Ref: Build<49>-Footnote-144572406 +Ref: Build<49>-Footnote-154572472 +Ref: Build<49>-Footnote-164572538 +Node: Windows<45>4572604 +Ref: whatsnew/changelog id4514572708 +Ref: 19db4572708 +Ref: Windows<45>-Footnote-14577616 +Ref: Windows<45>-Footnote-24577681 +Ref: Windows<45>-Footnote-34577746 +Ref: Windows<45>-Footnote-44577811 +Ref: Windows<45>-Footnote-54577876 +Ref: Windows<45>-Footnote-64577941 +Ref: Windows<45>-Footnote-74578006 +Ref: Windows<45>-Footnote-84578071 +Ref: Windows<45>-Footnote-94578136 +Ref: Windows<45>-Footnote-104578201 +Ref: Windows<45>-Footnote-114578267 +Ref: Windows<45>-Footnote-124578333 +Ref: Windows<45>-Footnote-134578399 +Ref: Windows<45>-Footnote-144578465 +Ref: Windows<45>-Footnote-154578531 +Ref: Windows<45>-Footnote-164578597 +Ref: Windows<45>-Footnote-174578663 +Ref: Windows<45>-Footnote-184578729 +Ref: Windows<45>-Footnote-194578795 +Ref: Windows<45>-Footnote-204578861 +Ref: Windows<45>-Footnote-214578927 +Ref: Windows<45>-Footnote-224578993 +Ref: Windows<45>-Footnote-234579059 +Ref: Windows<45>-Footnote-244579124 +Ref: Windows<45>-Footnote-254579189 +Ref: Windows<45>-Footnote-264579255 +Ref: Windows<45>-Footnote-274579321 +Ref: Windows<45>-Footnote-284579387 +Ref: Windows<45>-Footnote-294579453 +Ref: Windows<45>-Footnote-304579519 +Ref: Windows<45>-Footnote-314579585 +Ref: Windows<45>-Footnote-324579651 +Ref: Windows<45>-Footnote-334579717 +Ref: Windows<45>-Footnote-344579783 +Ref: Windows<45>-Footnote-354579849 +Ref: Windows<45>-Footnote-364579915 +Ref: Windows<45>-Footnote-374579981 +Ref: Windows<45>-Footnote-384580047 +Ref: Windows<45>-Footnote-394580113 +Ref: Windows<45>-Footnote-404580179 +Ref: Windows<45>-Footnote-414580245 +Ref: Windows<45>-Footnote-424580311 +Node: macOS<37>4580377 +Ref: whatsnew/changelog id4524580480 +Ref: 19de4580480 +Ref: macOS<37>-Footnote-14581313 +Ref: macOS<37>-Footnote-24581378 +Ref: macOS<37>-Footnote-34581443 +Ref: macOS<37>-Footnote-44581508 +Ref: macOS<37>-Footnote-54581573 +Ref: macOS<37>-Footnote-64581638 +Node: IDLE<34>4581703 +Ref: whatsnew/changelog id4534581810 +Ref: 19df4581810 +Ref: IDLE<34>-Footnote-14586549 +Ref: IDLE<34>-Footnote-24586614 +Ref: IDLE<34>-Footnote-34586678 +Ref: IDLE<34>-Footnote-44586743 +Ref: IDLE<34>-Footnote-54586808 +Ref: IDLE<34>-Footnote-64586873 +Ref: IDLE<34>-Footnote-74586938 +Ref: IDLE<34>-Footnote-84587003 +Ref: IDLE<34>-Footnote-94587068 +Ref: IDLE<34>-Footnote-104587133 +Ref: IDLE<34>-Footnote-114587199 +Ref: IDLE<34>-Footnote-124587265 +Ref: IDLE<34>-Footnote-134587331 +Ref: IDLE<34>-Footnote-144587397 +Ref: IDLE<34>-Footnote-154587463 +Ref: IDLE<34>-Footnote-164587529 +Ref: IDLE<34>-Footnote-174587595 +Ref: IDLE<34>-Footnote-184587661 +Ref: IDLE<34>-Footnote-194587727 +Ref: IDLE<34>-Footnote-204587793 +Ref: IDLE<34>-Footnote-214587859 +Ref: IDLE<34>-Footnote-224587925 +Ref: IDLE<34>-Footnote-234587991 +Ref: IDLE<34>-Footnote-244588057 +Ref: IDLE<34>-Footnote-254588123 +Ref: IDLE<34>-Footnote-264588189 +Ref: IDLE<34>-Footnote-274588255 +Ref: IDLE<34>-Footnote-284588321 +Ref: IDLE<34>-Footnote-294588387 +Ref: IDLE<34>-Footnote-304588452 +Node: Tools/Demos<23>4588518 +Ref: whatsnew/changelog id4544588625 +Ref: 19e04588625 +Ref: Tools/Demos<23>-Footnote-14589626 +Ref: Tools/Demos<23>-Footnote-24589691 +Ref: Tools/Demos<23>-Footnote-34589756 +Ref: Tools/Demos<23>-Footnote-44589821 +Ref: Tools/Demos<23>-Footnote-54589886 +Ref: Tools/Demos<23>-Footnote-64589951 +Ref: Tools/Demos<23>-Footnote-74590016 +Ref: Tools/Demos<23>-Footnote-84590081 +Node: C API<48>4590146 +Ref: whatsnew/changelog id4554590236 +Ref: 19e24590236 +Ref: C API<48>-Footnote-14595631 +Ref: C API<48>-Footnote-24595696 +Ref: C API<48>-Footnote-34595761 +Ref: C API<48>-Footnote-44595826 +Ref: C API<48>-Footnote-54595891 +Ref: C API<48>-Footnote-64595956 +Ref: C API<48>-Footnote-74596021 +Ref: C API<48>-Footnote-84596086 +Ref: C API<48>-Footnote-94596151 +Ref: C API<48>-Footnote-104596216 +Ref: C API<48>-Footnote-114596282 +Ref: C API<48>-Footnote-124596348 +Ref: C API<48>-Footnote-134596414 +Ref: C API<48>-Footnote-144596480 +Ref: C API<48>-Footnote-154596523 +Ref: C API<48>-Footnote-164596589 +Ref: C API<48>-Footnote-174596655 +Ref: C API<48>-Footnote-184596721 +Ref: C API<48>-Footnote-194596787 +Ref: C API<48>-Footnote-204596853 +Ref: C API<48>-Footnote-214596919 +Ref: C API<48>-Footnote-224596985 +Ref: C API<48>-Footnote-234597051 +Ref: C API<48>-Footnote-244597117 +Ref: C API<48>-Footnote-254597183 +Ref: C API<48>-Footnote-264597249 +Ref: C API<48>-Footnote-274597315 +Ref: C API<48>-Footnote-284597381 +Ref: C API<48>-Footnote-294597447 +Ref: C API<48>-Footnote-304597513 +Ref: C API<48>-Footnote-314597579 +Ref: C API<48>-Footnote-324597645 +Ref: C API<48>-Footnote-334597711 +Ref: C API<48>-Footnote-344597777 +Node: Python 3 8 0 beta 14597843 +Ref: whatsnew/changelog python-3-8-0-beta-14597966 +Ref: 19e64597966 +Node: Security<35>4598345 +Ref: whatsnew/changelog id4564598443 +Ref: 19e74598443 +Ref: Security<35>-Footnote-14599037 +Ref: Security<35>-Footnote-24599102 +Ref: Security<35>-Footnote-34599157 +Ref: Security<35>-Footnote-44599222 +Node: Core and Builtins<53>4599287 +Ref: whatsnew/changelog id4574599405 +Ref: 19e84599405 +Ref: Core and Builtins<53>-Footnote-14607465 +Ref: Core and Builtins<53>-Footnote-24607530 +Ref: Core and Builtins<53>-Footnote-34607595 +Ref: Core and Builtins<53>-Footnote-44607660 +Ref: Core and Builtins<53>-Footnote-54607725 +Ref: Core and Builtins<53>-Footnote-64607790 +Ref: Core and Builtins<53>-Footnote-74607855 +Ref: Core and Builtins<53>-Footnote-84607920 +Ref: Core and Builtins<53>-Footnote-94607985 +Ref: Core and Builtins<53>-Footnote-104608050 +Ref: Core and Builtins<53>-Footnote-114608116 +Ref: Core and Builtins<53>-Footnote-124608182 +Ref: Core and Builtins<53>-Footnote-134608248 +Ref: Core and Builtins<53>-Footnote-144608314 +Ref: Core and Builtins<53>-Footnote-154608380 +Ref: Core and Builtins<53>-Footnote-164608446 +Ref: Core and Builtins<53>-Footnote-174608512 +Ref: Core and Builtins<53>-Footnote-184608578 +Ref: Core and Builtins<53>-Footnote-194608643 +Ref: Core and Builtins<53>-Footnote-204608709 +Ref: Core and Builtins<53>-Footnote-214608775 +Ref: Core and Builtins<53>-Footnote-224608841 +Ref: Core and Builtins<53>-Footnote-234608906 +Ref: Core and Builtins<53>-Footnote-244608972 +Ref: Core and Builtins<53>-Footnote-254609038 +Ref: Core and Builtins<53>-Footnote-264609104 +Ref: Core and Builtins<53>-Footnote-274609170 +Ref: Core and Builtins<53>-Footnote-284609236 +Ref: Core and Builtins<53>-Footnote-294609302 +Ref: Core and Builtins<53>-Footnote-304609368 +Ref: Core and Builtins<53>-Footnote-314609434 +Ref: Core and Builtins<53>-Footnote-324609500 +Ref: Core and Builtins<53>-Footnote-334609566 +Ref: Core and Builtins<53>-Footnote-344609632 +Ref: Core and Builtins<53>-Footnote-354609698 +Ref: Core and Builtins<53>-Footnote-364609764 +Ref: Core and Builtins<53>-Footnote-374609830 +Ref: Core and Builtins<53>-Footnote-384609896 +Ref: Core and Builtins<53>-Footnote-394609962 +Ref: Core and Builtins<53>-Footnote-404610028 +Ref: Core and Builtins<53>-Footnote-414610094 +Ref: Core and Builtins<53>-Footnote-424610160 +Ref: Core and Builtins<53>-Footnote-434610226 +Ref: Core and Builtins<53>-Footnote-444610292 +Node: Library<52>4610358 +Ref: whatsnew/changelog id4584610481 +Ref: 19eb4610481 +Ref: Library<52>-Footnote-14628751 +Ref: Library<52>-Footnote-24628816 +Ref: Library<52>-Footnote-34628881 +Ref: Library<52>-Footnote-44628946 +Ref: Library<52>-Footnote-54629011 +Ref: Library<52>-Footnote-64629076 +Ref: Library<52>-Footnote-74629141 +Ref: Library<52>-Footnote-84629206 +Ref: Library<52>-Footnote-94629271 +Ref: Library<52>-Footnote-104629336 +Ref: Library<52>-Footnote-114629402 +Ref: Library<52>-Footnote-124629468 +Ref: Library<52>-Footnote-134629534 +Ref: Library<52>-Footnote-144629600 +Ref: Library<52>-Footnote-154629666 +Ref: Library<52>-Footnote-164629732 +Ref: Library<52>-Footnote-174629798 +Ref: Library<52>-Footnote-184629864 +Ref: Library<52>-Footnote-194629930 +Ref: Library<52>-Footnote-204629996 +Ref: Library<52>-Footnote-214630062 +Ref: Library<52>-Footnote-224630128 +Ref: Library<52>-Footnote-234630194 +Ref: Library<52>-Footnote-244630260 +Ref: Library<52>-Footnote-254630328 +Ref: Library<52>-Footnote-264630394 +Ref: Library<52>-Footnote-274630460 +Ref: Library<52>-Footnote-284630526 +Ref: Library<52>-Footnote-294630592 +Ref: Library<52>-Footnote-304630658 +Ref: Library<52>-Footnote-314630724 +Ref: Library<52>-Footnote-324630790 +Ref: Library<52>-Footnote-334630856 +Ref: Library<52>-Footnote-344630922 +Ref: Library<52>-Footnote-354630988 +Ref: Library<52>-Footnote-364631054 +Ref: Library<52>-Footnote-374631120 +Ref: Library<52>-Footnote-384631186 +Ref: Library<52>-Footnote-394631252 +Ref: Library<52>-Footnote-404631318 +Ref: Library<52>-Footnote-414631384 +Ref: Library<52>-Footnote-424631450 +Ref: Library<52>-Footnote-434631516 +Ref: Library<52>-Footnote-444631582 +Ref: Library<52>-Footnote-454631648 +Ref: Library<52>-Footnote-464631714 +Ref: Library<52>-Footnote-474631780 +Ref: Library<52>-Footnote-484631846 +Ref: Library<52>-Footnote-494631912 +Ref: Library<52>-Footnote-504631978 +Ref: Library<52>-Footnote-514632044 +Ref: Library<52>-Footnote-524632110 +Ref: Library<52>-Footnote-534632176 +Ref: Library<52>-Footnote-544632242 +Ref: Library<52>-Footnote-554632308 +Ref: Library<52>-Footnote-564632374 +Ref: Library<52>-Footnote-574632440 +Ref: Library<52>-Footnote-584632506 +Ref: Library<52>-Footnote-594632572 +Ref: Library<52>-Footnote-604632638 +Ref: Library<52>-Footnote-614632704 +Ref: Library<52>-Footnote-624632770 +Ref: Library<52>-Footnote-634632836 +Ref: Library<52>-Footnote-644632902 +Ref: Library<52>-Footnote-654632968 +Ref: Library<52>-Footnote-664633034 +Ref: Library<52>-Footnote-674633100 +Ref: Library<52>-Footnote-684633166 +Ref: Library<52>-Footnote-694633231 +Ref: Library<52>-Footnote-704633297 +Ref: Library<52>-Footnote-714633362 +Ref: Library<52>-Footnote-724633428 +Ref: Library<52>-Footnote-734633494 +Ref: Library<52>-Footnote-744633560 +Ref: Library<52>-Footnote-754633626 +Ref: Library<52>-Footnote-764633692 +Ref: Library<52>-Footnote-774633758 +Ref: Library<52>-Footnote-784633824 +Ref: Library<52>-Footnote-794633890 +Ref: Library<52>-Footnote-804633956 +Ref: Library<52>-Footnote-814634022 +Ref: Library<52>-Footnote-824634088 +Ref: Library<52>-Footnote-834634154 +Ref: Library<52>-Footnote-844634220 +Ref: Library<52>-Footnote-854634286 +Ref: Library<52>-Footnote-864634352 +Ref: Library<52>-Footnote-874634418 +Ref: Library<52>-Footnote-884634484 +Ref: Library<52>-Footnote-894634550 +Ref: Library<52>-Footnote-904634616 +Ref: Library<52>-Footnote-914634682 +Ref: Library<52>-Footnote-924634748 +Ref: Library<52>-Footnote-934634814 +Ref: Library<52>-Footnote-944634880 +Ref: Library<52>-Footnote-954634946 +Ref: Library<52>-Footnote-964635012 +Ref: Library<52>-Footnote-974635078 +Ref: Library<52>-Footnote-984635144 +Ref: Library<52>-Footnote-994635210 +Ref: Library<52>-Footnote-1004635276 +Ref: Library<52>-Footnote-1014635343 +Ref: Library<52>-Footnote-1024635410 +Ref: Library<52>-Footnote-1034635477 +Ref: Library<52>-Footnote-1044635544 +Ref: Library<52>-Footnote-1054635611 +Ref: Library<52>-Footnote-1064635678 +Ref: Library<52>-Footnote-1074635745 +Node: Documentation<47>4635812 +Ref: whatsnew/changelog id4594635923 +Ref: 19f34635923 +Ref: Documentation<47>-Footnote-14638001 +Ref: Documentation<47>-Footnote-24638066 +Ref: Documentation<47>-Footnote-34638131 +Ref: Documentation<47>-Footnote-44638196 +Ref: Documentation<47>-Footnote-54638261 +Ref: Documentation<47>-Footnote-64638326 +Ref: Documentation<47>-Footnote-74638391 +Ref: Documentation<47>-Footnote-84638456 +Ref: Documentation<47>-Footnote-94638521 +Ref: Documentation<47>-Footnote-104638586 +Ref: Documentation<47>-Footnote-114638652 +Ref: Documentation<47>-Footnote-124638718 +Ref: Documentation<47>-Footnote-134638784 +Ref: Documentation<47>-Footnote-144638850 +Node: Tests<48>4638916 +Ref: whatsnew/changelog id4604639025 +Ref: 19f44639025 +Ref: Tests<48>-Footnote-14640663 +Ref: Tests<48>-Footnote-24640728 +Ref: Tests<48>-Footnote-34640793 +Ref: Tests<48>-Footnote-44640858 +Ref: Tests<48>-Footnote-54640923 +Ref: Tests<48>-Footnote-64640988 +Ref: Tests<48>-Footnote-74641053 +Ref: Tests<48>-Footnote-84641118 +Ref: Tests<48>-Footnote-94641183 +Ref: Tests<48>-Footnote-104641248 +Node: Build<50>4641314 +Ref: whatsnew/changelog id4614641417 +Ref: 19f64641417 +Ref: Build<50>-Footnote-14642633 +Ref: Build<50>-Footnote-24642698 +Node: Windows<46>4642763 +Ref: whatsnew/changelog id4624642866 +Ref: 19f74642866 +Ref: Windows<46>-Footnote-14643298 +Ref: Windows<46>-Footnote-24643363 +Ref: Windows<46>-Footnote-34643428 +Ref: Windows<46>-Footnote-44643493 +Node: macOS<38>4643558 +Ref: whatsnew/changelog id4634643660 +Ref: 19f84643660 +Ref: macOS<38>-Footnote-14643962 +Node: IDLE<35>4644027 +Ref: whatsnew/changelog id4644644133 +Ref: 19f94644133 +Ref: IDLE<35>-Footnote-14644735 +Ref: IDLE<35>-Footnote-24644800 +Ref: IDLE<35>-Footnote-34644865 +Ref: IDLE<35>-Footnote-44644930 +Ref: IDLE<35>-Footnote-54644995 +Ref: IDLE<35>-Footnote-64645060 +Node: Tools/Demos<24>4645125 +Ref: whatsnew/changelog id4654645231 +Ref: 19fa4645231 +Ref: Tools/Demos<24>-Footnote-14645434 +Node: C API<49>4645499 +Ref: whatsnew/changelog id4664645588 +Ref: 19fb4645588 +Ref: C API<49>-Footnote-14646928 +Ref: C API<49>-Footnote-24646993 +Ref: C API<49>-Footnote-34647035 +Ref: C API<49>-Footnote-44647100 +Ref: C API<49>-Footnote-54647165 +Ref: C API<49>-Footnote-64647230 +Ref: C API<49>-Footnote-74647272 +Ref: C API<49>-Footnote-84647337 +Ref: C API<49>-Footnote-94647402 +Node: Python 3 8 0 alpha 44647467 +Ref: whatsnew/changelog python-3-8-0-alpha-44647590 +Ref: 19fd4647590 +Node: Security<36>4647971 +Ref: whatsnew/changelog id4674648070 +Ref: 19fe4648070 +Ref: Security<36>-Footnote-14648955 +Ref: Security<36>-Footnote-24649020 +Ref: Security<36>-Footnote-34649085 +Ref: Security<36>-Footnote-44649140 +Node: Core and Builtins<54>4649205 +Ref: whatsnew/changelog id4684649324 +Ref: 19ff4649324 +Ref: Core and Builtins<54>-Footnote-14652599 +Ref: Core and Builtins<54>-Footnote-24652664 +Ref: Core and Builtins<54>-Footnote-34652729 +Ref: Core and Builtins<54>-Footnote-44652794 +Ref: Core and Builtins<54>-Footnote-54652859 +Ref: Core and Builtins<54>-Footnote-64652924 +Ref: Core and Builtins<54>-Footnote-74652989 +Ref: Core and Builtins<54>-Footnote-84653054 +Ref: Core and Builtins<54>-Footnote-94653119 +Ref: Core and Builtins<54>-Footnote-104653161 +Ref: Core and Builtins<54>-Footnote-114653227 +Ref: Core and Builtins<54>-Footnote-124653293 +Ref: Core and Builtins<54>-Footnote-134653359 +Ref: Core and Builtins<54>-Footnote-144653425 +Ref: Core and Builtins<54>-Footnote-154653491 +Ref: Core and Builtins<54>-Footnote-164653557 +Ref: Core and Builtins<54>-Footnote-174653623 +Ref: Core and Builtins<54>-Footnote-184653689 +Ref: Core and Builtins<54>-Footnote-194653755 +Ref: Core and Builtins<54>-Footnote-204653821 +Node: Library<53>4653887 +Ref: whatsnew/changelog id4694654011 +Ref: 1a004654011 +Ref: Library<53>-Footnote-14663346 +Ref: Library<53>-Footnote-24663411 +Ref: Library<53>-Footnote-34663476 +Ref: Library<53>-Footnote-44663541 +Ref: Library<53>-Footnote-54663608 +Ref: Library<53>-Footnote-64663673 +Ref: Library<53>-Footnote-74663738 +Ref: Library<53>-Footnote-84663803 +Ref: Library<53>-Footnote-94663868 +Ref: Library<53>-Footnote-104663933 +Ref: Library<53>-Footnote-114663999 +Ref: Library<53>-Footnote-124664065 +Ref: Library<53>-Footnote-134664131 +Ref: Library<53>-Footnote-144664197 +Ref: Library<53>-Footnote-154664263 +Ref: Library<53>-Footnote-164664329 +Ref: Library<53>-Footnote-174664395 +Ref: Library<53>-Footnote-184664461 +Ref: Library<53>-Footnote-194664527 +Ref: Library<53>-Footnote-204664593 +Ref: Library<53>-Footnote-214664659 +Ref: Library<53>-Footnote-224664725 +Ref: Library<53>-Footnote-234664791 +Ref: Library<53>-Footnote-244664857 +Ref: Library<53>-Footnote-254664923 +Ref: Library<53>-Footnote-264664989 +Ref: Library<53>-Footnote-274665055 +Ref: Library<53>-Footnote-284665121 +Ref: Library<53>-Footnote-294665187 +Ref: Library<53>-Footnote-304665253 +Ref: Library<53>-Footnote-314665319 +Ref: Library<53>-Footnote-324665385 +Ref: Library<53>-Footnote-334665451 +Ref: Library<53>-Footnote-344665517 +Ref: Library<53>-Footnote-354665583 +Ref: Library<53>-Footnote-364665649 +Ref: Library<53>-Footnote-374665715 +Ref: Library<53>-Footnote-384665781 +Ref: Library<53>-Footnote-394665847 +Ref: Library<53>-Footnote-404665913 +Ref: Library<53>-Footnote-414665979 +Ref: Library<53>-Footnote-424666045 +Ref: Library<53>-Footnote-434666111 +Ref: Library<53>-Footnote-444666177 +Ref: Library<53>-Footnote-454666243 +Ref: Library<53>-Footnote-464666309 +Ref: Library<53>-Footnote-474666375 +Ref: Library<53>-Footnote-484666441 +Ref: Library<53>-Footnote-494666507 +Ref: Library<53>-Footnote-504666573 +Ref: Library<53>-Footnote-514666639 +Ref: Library<53>-Footnote-524666705 +Ref: Library<53>-Footnote-534666771 +Ref: Library<53>-Footnote-544666837 +Node: Documentation<48>4666903 +Ref: whatsnew/changelog id4704667015 +Ref: 1a044667015 +Ref: Documentation<48>-Footnote-14668466 +Ref: Documentation<48>-Footnote-24668531 +Ref: Documentation<48>-Footnote-34668596 +Ref: Documentation<48>-Footnote-44668661 +Ref: Documentation<48>-Footnote-54668726 +Ref: Documentation<48>-Footnote-64668765 +Ref: Documentation<48>-Footnote-74668830 +Ref: Documentation<48>-Footnote-84668895 +Ref: Documentation<48>-Footnote-94668960 +Ref: Documentation<48>-Footnote-104669025 +Ref: Documentation<48>-Footnote-114669091 +Ref: Documentation<48>-Footnote-124669157 +Node: Tests<49>4669223 +Ref: whatsnew/changelog id4714669333 +Ref: 1a054669333 +Ref: Tests<49>-Footnote-14671583 +Ref: Tests<49>-Footnote-24671648 +Ref: Tests<49>-Footnote-34671713 +Ref: Tests<49>-Footnote-44671778 +Ref: Tests<49>-Footnote-54671843 +Ref: Tests<49>-Footnote-64671908 +Ref: Tests<49>-Footnote-74671973 +Ref: Tests<49>-Footnote-84672038 +Ref: Tests<49>-Footnote-94672103 +Ref: Tests<49>-Footnote-104672168 +Ref: Tests<49>-Footnote-114672234 +Ref: Tests<49>-Footnote-124672300 +Ref: Tests<49>-Footnote-134672366 +Ref: Tests<49>-Footnote-144672432 +Ref: Tests<49>-Footnote-154672498 +Node: Build<51>4672564 +Ref: whatsnew/changelog id4724672668 +Ref: 1a074672668 +Ref: Build<51>-Footnote-14675839 +Ref: Build<51>-Footnote-24675904 +Ref: Build<51>-Footnote-34675969 +Ref: Build<51>-Footnote-44676034 +Ref: Build<51>-Footnote-54676099 +Ref: Build<51>-Footnote-64676164 +Ref: Build<51>-Footnote-74676229 +Ref: Build<51>-Footnote-84676294 +Ref: Build<51>-Footnote-94676359 +Ref: Build<51>-Footnote-104676424 +Ref: Build<51>-Footnote-114676490 +Ref: Build<51>-Footnote-124676556 +Ref: Build<51>-Footnote-134676622 +Node: Windows<47>4676688 +Ref: whatsnew/changelog id4734676792 +Ref: 1a084676792 +Ref: Windows<47>-Footnote-14679444 +Ref: Windows<47>-Footnote-24679509 +Ref: Windows<47>-Footnote-34679574 +Ref: Windows<47>-Footnote-44679639 +Ref: Windows<47>-Footnote-54679704 +Ref: Windows<47>-Footnote-64679769 +Ref: Windows<47>-Footnote-74679834 +Ref: Windows<47>-Footnote-84679899 +Ref: Windows<47>-Footnote-94679964 +Ref: Windows<47>-Footnote-104680029 +Ref: Windows<47>-Footnote-114680095 +Ref: Windows<47>-Footnote-124680161 +Node: macOS<39>4680227 +Ref: whatsnew/changelog id4744680330 +Ref: 1a094680330 +Ref: macOS<39>-Footnote-14680644 +Ref: macOS<39>-Footnote-24680709 +Node: IDLE<36>4680774 +Ref: whatsnew/changelog id4754680881 +Ref: 1a0a4680881 +Ref: IDLE<36>-Footnote-14681128 +Node: Tools/Demos<25>4681193 +Ref: whatsnew/changelog id4764681300 +Ref: 1a0b4681300 +Ref: Tools/Demos<25>-Footnote-14681454 +Node: C API<50>4681519 +Ref: whatsnew/changelog id4774681609 +Ref: 1a0c4681609 +Ref: C API<50>-Footnote-14683601 +Ref: C API<50>-Footnote-24683666 +Ref: C API<50>-Footnote-34683731 +Ref: C API<50>-Footnote-44683796 +Ref: C API<50>-Footnote-54683861 +Ref: C API<50>-Footnote-64683926 +Node: Python 3 8 0 alpha 34683991 +Ref: whatsnew/changelog python-3-8-0-alpha-34684115 +Ref: 1a0e4684115 +Node: Security<37>4684476 +Ref: whatsnew/changelog id4784684575 +Ref: 1a0f4684575 +Ref: Security<37>-Footnote-14685139 +Ref: Security<37>-Footnote-24685204 +Node: Core and Builtins<55>4685269 +Ref: whatsnew/changelog id4794685388 +Ref: 1a114685388 +Ref: Core and Builtins<55>-Footnote-14688970 +Ref: Core and Builtins<55>-Footnote-24689035 +Ref: Core and Builtins<55>-Footnote-34689100 +Ref: Core and Builtins<55>-Footnote-44689165 +Ref: Core and Builtins<55>-Footnote-54689230 +Ref: Core and Builtins<55>-Footnote-64689295 +Ref: Core and Builtins<55>-Footnote-74689360 +Ref: Core and Builtins<55>-Footnote-84689425 +Ref: Core and Builtins<55>-Footnote-94689490 +Ref: Core and Builtins<55>-Footnote-104689555 +Ref: Core and Builtins<55>-Footnote-114689621 +Ref: Core and Builtins<55>-Footnote-124689687 +Ref: Core and Builtins<55>-Footnote-134689753 +Ref: Core and Builtins<55>-Footnote-144689819 +Ref: Core and Builtins<55>-Footnote-154689885 +Ref: Core and Builtins<55>-Footnote-164689951 +Ref: Core and Builtins<55>-Footnote-174690017 +Ref: Core and Builtins<55>-Footnote-184690083 +Ref: Core and Builtins<55>-Footnote-194690149 +Ref: Core and Builtins<55>-Footnote-204690215 +Ref: Core and Builtins<55>-Footnote-214690281 +Ref: Core and Builtins<55>-Footnote-224690347 +Node: Library<54>4690413 +Ref: whatsnew/changelog id4804690537 +Ref: 1a134690537 +Ref: Library<54>-Footnote-14696155 +Ref: Library<54>-Footnote-24696220 +Ref: Library<54>-Footnote-34696285 +Ref: Library<54>-Footnote-44696350 +Ref: Library<54>-Footnote-54696415 +Ref: Library<54>-Footnote-64696480 +Ref: Library<54>-Footnote-74696545 +Ref: Library<54>-Footnote-84696610 +Ref: Library<54>-Footnote-94696675 +Ref: Library<54>-Footnote-104696740 +Ref: Library<54>-Footnote-114696806 +Ref: Library<54>-Footnote-124696872 +Ref: Library<54>-Footnote-134696938 +Ref: Library<54>-Footnote-144697004 +Ref: Library<54>-Footnote-154697070 +Ref: Library<54>-Footnote-164697136 +Ref: Library<54>-Footnote-174697202 +Ref: Library<54>-Footnote-184697268 +Ref: Library<54>-Footnote-194697334 +Ref: Library<54>-Footnote-204697400 +Ref: Library<54>-Footnote-214697466 +Ref: Library<54>-Footnote-224697532 +Ref: Library<54>-Footnote-234697598 +Ref: Library<54>-Footnote-244697664 +Ref: Library<54>-Footnote-254697730 +Ref: Library<54>-Footnote-264697796 +Ref: Library<54>-Footnote-274697862 +Ref: Library<54>-Footnote-284697928 +Ref: Library<54>-Footnote-294697994 +Ref: Library<54>-Footnote-304698060 +Ref: Library<54>-Footnote-314698126 +Ref: Library<54>-Footnote-324698192 +Ref: Library<54>-Footnote-334698258 +Ref: Library<54>-Footnote-344698324 +Ref: Library<54>-Footnote-354698390 +Ref: Library<54>-Footnote-364698456 +Ref: Library<54>-Footnote-374698522 +Node: Documentation<49>4698588 +Ref: whatsnew/changelog id4814698700 +Ref: 1a154698700 +Ref: Documentation<49>-Footnote-14699271 +Ref: Documentation<49>-Footnote-24699336 +Ref: Documentation<49>-Footnote-34699401 +Node: Tests<50>4699466 +Ref: whatsnew/changelog id4824699576 +Ref: 1a164699576 +Ref: Tests<50>-Footnote-14700088 +Ref: Tests<50>-Footnote-24700153 +Ref: Tests<50>-Footnote-34700218 +Node: Build<52>4700283 +Ref: whatsnew/changelog id4834700387 +Ref: 1a174700387 +Ref: Build<52>-Footnote-14700907 +Ref: Build<52>-Footnote-24700972 +Ref: Build<52>-Footnote-34701037 +Ref: Build<52>-Footnote-44701102 +Node: Windows<48>4701167 +Ref: whatsnew/changelog id4844701270 +Ref: 1a184701270 +Ref: Windows<48>-Footnote-14701721 +Ref: Windows<48>-Footnote-24701786 +Ref: Windows<48>-Footnote-34701851 +Node: IDLE<37>4701916 +Ref: whatsnew/changelog id4854702025 +Ref: 1a194702025 +Ref: IDLE<37>-Footnote-14703134 +Ref: IDLE<37>-Footnote-24703199 +Ref: IDLE<37>-Footnote-34703264 +Ref: IDLE<37>-Footnote-44703329 +Ref: IDLE<37>-Footnote-54703394 +Ref: IDLE<37>-Footnote-64703459 +Ref: IDLE<37>-Footnote-74703524 +Ref: IDLE<37>-Footnote-84703589 +Ref: IDLE<37>-Footnote-94703654 +Node: Tools/Demos<26>4703719 +Ref: whatsnew/changelog id4864703826 +Ref: 1a1a4703826 +Ref: Tools/Demos<26>-Footnote-14704039 +Ref: Tools/Demos<26>-Footnote-24704104 +Node: C API<51>4704169 +Ref: whatsnew/changelog id4874704259 +Ref: 1a1b4704259 +Ref: C API<51>-Footnote-14704651 +Ref: C API<51>-Footnote-24704716 +Node: Python 3 8 0 alpha 24704781 +Ref: whatsnew/changelog python-3-8-0-alpha-24704905 +Ref: 1a1c4704905 +Node: Core and Builtins<56>4705168 +Ref: whatsnew/changelog id4884705266 +Ref: 1a1d4705266 +Ref: Core and Builtins<56>-Footnote-14708405 +Ref: Core and Builtins<56>-Footnote-24708470 +Ref: Core and Builtins<56>-Footnote-34708535 +Ref: Core and Builtins<56>-Footnote-44708600 +Ref: Core and Builtins<56>-Footnote-54708665 +Ref: Core and Builtins<56>-Footnote-64708732 +Ref: Core and Builtins<56>-Footnote-74708797 +Ref: Core and Builtins<56>-Footnote-84708862 +Ref: Core and Builtins<56>-Footnote-94708927 +Ref: Core and Builtins<56>-Footnote-104708992 +Ref: Core and Builtins<56>-Footnote-114709058 +Ref: Core and Builtins<56>-Footnote-124709124 +Ref: Core and Builtins<56>-Footnote-134709190 +Ref: Core and Builtins<56>-Footnote-144709256 +Ref: Core and Builtins<56>-Footnote-154709322 +Ref: Core and Builtins<56>-Footnote-164709388 +Ref: Core and Builtins<56>-Footnote-174709454 +Node: Library<55>4709520 +Ref: whatsnew/changelog id4894709644 +Ref: 1a1e4709644 +Ref: Library<55>-Footnote-14713359 +Ref: Library<55>-Footnote-24713424 +Ref: Library<55>-Footnote-34713489 +Ref: Library<55>-Footnote-44713554 +Ref: Library<55>-Footnote-54713619 +Ref: Library<55>-Footnote-64713684 +Ref: Library<55>-Footnote-74713749 +Ref: Library<55>-Footnote-84713814 +Ref: Library<55>-Footnote-94713879 +Ref: Library<55>-Footnote-104713944 +Ref: Library<55>-Footnote-114714010 +Ref: Library<55>-Footnote-124714076 +Ref: Library<55>-Footnote-134714142 +Ref: Library<55>-Footnote-144714208 +Ref: Library<55>-Footnote-154714274 +Ref: Library<55>-Footnote-164714340 +Ref: Library<55>-Footnote-174714406 +Node: Documentation<50>4714472 +Ref: whatsnew/changelog id4904714584 +Ref: 1a214714584 +Ref: Documentation<50>-Footnote-14714962 +Ref: Documentation<50>-Footnote-24715027 +Ref: Documentation<50>-Footnote-34715092 +Node: Tests<51>4715157 +Ref: whatsnew/changelog id4914715269 +Ref: 1a224715269 +Ref: Tests<51>-Footnote-14716634 +Ref: Tests<51>-Footnote-24716699 +Ref: Tests<51>-Footnote-34716764 +Ref: Tests<51>-Footnote-44716829 +Ref: Tests<51>-Footnote-54716894 +Ref: Tests<51>-Footnote-64716959 +Ref: Tests<51>-Footnote-74717024 +Ref: Tests<51>-Footnote-84717089 +Node: Windows<49>4717154 +Ref: whatsnew/changelog id4924717257 +Ref: 1a234717257 +Ref: Windows<49>-Footnote-14717854 +Ref: Windows<49>-Footnote-24717919 +Ref: Windows<49>-Footnote-34717984 +Ref: Windows<49>-Footnote-44718049 +Ref: Windows<49>-Footnote-54718114 +Node: IDLE<38>4718179 +Ref: whatsnew/changelog id4934718264 +Ref: 1a244718264 +Ref: IDLE<38>-Footnote-14718570 +Ref: IDLE<38>-Footnote-24718635 +Ref: IDLE<38>-Footnote-34718700 +Node: Python 3 8 0 alpha 14718765 +Ref: whatsnew/changelog python-3-8-0-alpha-14718887 +Ref: 1a254718887 +Node: Security<38>4719268 +Ref: whatsnew/changelog id4944719367 +Ref: 1a264719367 +Ref: Security<38>-Footnote-14721707 +Ref: Security<38>-Footnote-24721772 +Ref: Security<38>-Footnote-34721827 +Ref: Security<38>-Footnote-44721892 +Ref: Security<38>-Footnote-54721957 +Ref: Security<38>-Footnote-64722022 +Ref: Security<38>-Footnote-74722087 +Ref: Security<38>-Footnote-84722143 +Ref: Security<38>-Footnote-94722208 +Ref: Security<38>-Footnote-104722273 +Ref: Security<38>-Footnote-114722339 +Ref: Security<38>-Footnote-124722405 +Ref: Security<38>-Footnote-134722461 +Ref: Security<38>-Footnote-144722527 +Ref: Security<38>-Footnote-154722593 +Ref: Security<38>-Footnote-164722649 +Ref: Security<38>-Footnote-174722705 +Node: Core and Builtins<57>4722771 +Ref: whatsnew/changelog id4954722890 +Ref: 1a274722890 +Ref: Core and Builtins<57>-Footnote-14749080 +Ref: Core and Builtins<57>-Footnote-24749145 +Ref: Core and Builtins<57>-Footnote-34749210 +Ref: Core and Builtins<57>-Footnote-44749275 +Ref: Core and Builtins<57>-Footnote-54749340 +Ref: Core and Builtins<57>-Footnote-64749405 +Ref: Core and Builtins<57>-Footnote-74749470 +Ref: Core and Builtins<57>-Footnote-84749535 +Ref: Core and Builtins<57>-Footnote-94749600 +Ref: Core and Builtins<57>-Footnote-104749665 +Ref: Core and Builtins<57>-Footnote-114749731 +Ref: Core and Builtins<57>-Footnote-124749797 +Ref: Core and Builtins<57>-Footnote-134749863 +Ref: Core and Builtins<57>-Footnote-144749929 +Ref: Core and Builtins<57>-Footnote-154749995 +Ref: Core and Builtins<57>-Footnote-164750061 +Ref: Core and Builtins<57>-Footnote-174750127 +Ref: Core and Builtins<57>-Footnote-184750193 +Ref: Core and Builtins<57>-Footnote-194750259 +Ref: Core and Builtins<57>-Footnote-204750325 +Ref: Core and Builtins<57>-Footnote-214750391 +Ref: Core and Builtins<57>-Footnote-224750457 +Ref: Core and Builtins<57>-Footnote-234750523 +Ref: Core and Builtins<57>-Footnote-244750589 +Ref: Core and Builtins<57>-Footnote-254750655 +Ref: Core and Builtins<57>-Footnote-264750698 +Ref: Core and Builtins<57>-Footnote-274750764 +Ref: Core and Builtins<57>-Footnote-284750830 +Ref: Core and Builtins<57>-Footnote-294750896 +Ref: Core and Builtins<57>-Footnote-304750962 +Ref: Core and Builtins<57>-Footnote-314751028 +Ref: Core and Builtins<57>-Footnote-324751094 +Ref: Core and Builtins<57>-Footnote-334751160 +Ref: Core and Builtins<57>-Footnote-344751226 +Ref: Core and Builtins<57>-Footnote-354751292 +Ref: Core and Builtins<57>-Footnote-364751358 +Ref: Core and Builtins<57>-Footnote-374751424 +Ref: Core and Builtins<57>-Footnote-384751490 +Ref: Core and Builtins<57>-Footnote-394751556 +Ref: Core and Builtins<57>-Footnote-404751622 +Ref: Core and Builtins<57>-Footnote-414751688 +Ref: Core and Builtins<57>-Footnote-424751754 +Ref: Core and Builtins<57>-Footnote-434751820 +Ref: Core and Builtins<57>-Footnote-444751886 +Ref: Core and Builtins<57>-Footnote-454751952 +Ref: Core and Builtins<57>-Footnote-464752018 +Ref: Core and Builtins<57>-Footnote-474752084 +Ref: Core and Builtins<57>-Footnote-484752150 +Ref: Core and Builtins<57>-Footnote-494752216 +Ref: Core and Builtins<57>-Footnote-504752282 +Ref: Core and Builtins<57>-Footnote-514752348 +Ref: Core and Builtins<57>-Footnote-524752414 +Ref: Core and Builtins<57>-Footnote-534752480 +Ref: Core and Builtins<57>-Footnote-544752546 +Ref: Core and Builtins<57>-Footnote-554752612 +Ref: Core and Builtins<57>-Footnote-564752678 +Ref: Core and Builtins<57>-Footnote-574752744 +Ref: Core and Builtins<57>-Footnote-584752810 +Ref: Core and Builtins<57>-Footnote-594752876 +Ref: Core and Builtins<57>-Footnote-604752941 +Ref: Core and Builtins<57>-Footnote-614753007 +Ref: Core and Builtins<57>-Footnote-624753073 +Ref: Core and Builtins<57>-Footnote-634753139 +Ref: Core and Builtins<57>-Footnote-644753205 +Ref: Core and Builtins<57>-Footnote-654753271 +Ref: Core and Builtins<57>-Footnote-664753337 +Ref: Core and Builtins<57>-Footnote-674753403 +Ref: Core and Builtins<57>-Footnote-684753469 +Ref: Core and Builtins<57>-Footnote-694753535 +Ref: Core and Builtins<57>-Footnote-704753601 +Ref: Core and Builtins<57>-Footnote-714753667 +Ref: Core and Builtins<57>-Footnote-724753733 +Ref: Core and Builtins<57>-Footnote-734753799 +Ref: Core and Builtins<57>-Footnote-744753865 +Ref: Core and Builtins<57>-Footnote-754753931 +Ref: Core and Builtins<57>-Footnote-764753997 +Ref: Core and Builtins<57>-Footnote-774754063 +Ref: Core and Builtins<57>-Footnote-784754129 +Ref: Core and Builtins<57>-Footnote-794754195 +Ref: Core and Builtins<57>-Footnote-804754261 +Ref: Core and Builtins<57>-Footnote-814754327 +Ref: Core and Builtins<57>-Footnote-824754393 +Ref: Core and Builtins<57>-Footnote-834754459 +Ref: Core and Builtins<57>-Footnote-844754525 +Ref: Core and Builtins<57>-Footnote-854754591 +Ref: Core and Builtins<57>-Footnote-864754657 +Ref: Core and Builtins<57>-Footnote-874754723 +Ref: Core and Builtins<57>-Footnote-884754789 +Ref: Core and Builtins<57>-Footnote-894754855 +Ref: Core and Builtins<57>-Footnote-904754921 +Ref: Core and Builtins<57>-Footnote-914754987 +Ref: Core and Builtins<57>-Footnote-924755053 +Ref: Core and Builtins<57>-Footnote-934755119 +Ref: Core and Builtins<57>-Footnote-944755185 +Ref: Core and Builtins<57>-Footnote-954755251 +Ref: Core and Builtins<57>-Footnote-964755317 +Ref: Core and Builtins<57>-Footnote-974755385 +Ref: Core and Builtins<57>-Footnote-984755451 +Ref: Core and Builtins<57>-Footnote-994755517 +Ref: Core and Builtins<57>-Footnote-1004755583 +Ref: Core and Builtins<57>-Footnote-1014755650 +Ref: Core and Builtins<57>-Footnote-1024755717 +Ref: Core and Builtins<57>-Footnote-1034755784 +Ref: Core and Builtins<57>-Footnote-1044755851 +Ref: Core and Builtins<57>-Footnote-1054755918 +Ref: Core and Builtins<57>-Footnote-1064755985 +Ref: Core and Builtins<57>-Footnote-1074756052 +Ref: Core and Builtins<57>-Footnote-1084756119 +Ref: Core and Builtins<57>-Footnote-1094756186 +Ref: Core and Builtins<57>-Footnote-1104756253 +Ref: Core and Builtins<57>-Footnote-1114756320 +Ref: Core and Builtins<57>-Footnote-1124756387 +Ref: Core and Builtins<57>-Footnote-1134756454 +Ref: Core and Builtins<57>-Footnote-1144756521 +Ref: Core and Builtins<57>-Footnote-1154756588 +Ref: Core and Builtins<57>-Footnote-1164756655 +Ref: Core and Builtins<57>-Footnote-1174756722 +Ref: Core and Builtins<57>-Footnote-1184756789 +Ref: Core and Builtins<57>-Footnote-1194756856 +Ref: Core and Builtins<57>-Footnote-1204756923 +Ref: Core and Builtins<57>-Footnote-1214756990 +Ref: Core and Builtins<57>-Footnote-1224757057 +Ref: Core and Builtins<57>-Footnote-1234757124 +Ref: Core and Builtins<57>-Footnote-1244757191 +Ref: Core and Builtins<57>-Footnote-1254757258 +Ref: Core and Builtins<57>-Footnote-1264757325 +Ref: Core and Builtins<57>-Footnote-1274757392 +Ref: Core and Builtins<57>-Footnote-1284757459 +Ref: Core and Builtins<57>-Footnote-1294757526 +Ref: Core and Builtins<57>-Footnote-1304757593 +Ref: Core and Builtins<57>-Footnote-1314757660 +Ref: Core and Builtins<57>-Footnote-1324757727 +Ref: Core and Builtins<57>-Footnote-1334757794 +Ref: Core and Builtins<57>-Footnote-1344757861 +Ref: Core and Builtins<57>-Footnote-1354757928 +Ref: Core and Builtins<57>-Footnote-1364757995 +Ref: Core and Builtins<57>-Footnote-1374758062 +Ref: Core and Builtins<57>-Footnote-1384758129 +Ref: Core and Builtins<57>-Footnote-1394758196 +Ref: Core and Builtins<57>-Footnote-1404758263 +Ref: Core and Builtins<57>-Footnote-1414758330 +Ref: Core and Builtins<57>-Footnote-1424758397 +Ref: Core and Builtins<57>-Footnote-1434758464 +Ref: Core and Builtins<57>-Footnote-1444758531 +Ref: Core and Builtins<57>-Footnote-1454758598 +Ref: Core and Builtins<57>-Footnote-1464758665 +Ref: Core and Builtins<57>-Footnote-1474758732 +Ref: Core and Builtins<57>-Footnote-1484758799 +Ref: Core and Builtins<57>-Footnote-1494758866 +Ref: Core and Builtins<57>-Footnote-1504758933 +Ref: Core and Builtins<57>-Footnote-1514759000 +Ref: Core and Builtins<57>-Footnote-1524759067 +Ref: Core and Builtins<57>-Footnote-1534759134 +Ref: Core and Builtins<57>-Footnote-1544759201 +Ref: Core and Builtins<57>-Footnote-1554759268 +Ref: Core and Builtins<57>-Footnote-1564759335 +Ref: Core and Builtins<57>-Footnote-1574759402 +Ref: Core and Builtins<57>-Footnote-1584759469 +Ref: Core and Builtins<57>-Footnote-1594759536 +Ref: Core and Builtins<57>-Footnote-1604759603 +Ref: Core and Builtins<57>-Footnote-1614759670 +Ref: Core and Builtins<57>-Footnote-1624759737 +Node: Library<56>4759804 +Ref: whatsnew/changelog id4964759928 +Ref: 1a2d4759928 +Ref: Library<56>-Footnote-14831104 +Ref: Library<56>-Footnote-24831169 +Ref: Library<56>-Footnote-34831234 +Ref: Library<56>-Footnote-44831299 +Ref: Library<56>-Footnote-54831364 +Ref: Library<56>-Footnote-64831429 +Ref: Library<56>-Footnote-74831494 +Ref: Library<56>-Footnote-84831559 +Ref: Library<56>-Footnote-94831624 +Ref: Library<56>-Footnote-104831689 +Ref: Library<56>-Footnote-114831755 +Ref: Library<56>-Footnote-124831821 +Ref: Library<56>-Footnote-134831887 +Ref: Library<56>-Footnote-144831953 +Ref: Library<56>-Footnote-154832019 +Ref: Library<56>-Footnote-164832085 +Ref: Library<56>-Footnote-174832151 +Ref: Library<56>-Footnote-184832217 +Ref: Library<56>-Footnote-194832283 +Ref: Library<56>-Footnote-204832349 +Ref: Library<56>-Footnote-214832415 +Ref: Library<56>-Footnote-224832481 +Ref: Library<56>-Footnote-234832547 +Ref: Library<56>-Footnote-244832613 +Ref: Library<56>-Footnote-254832679 +Ref: Library<56>-Footnote-264832745 +Ref: Library<56>-Footnote-274832811 +Ref: Library<56>-Footnote-284832877 +Ref: Library<56>-Footnote-294832943 +Ref: Library<56>-Footnote-304833009 +Ref: Library<56>-Footnote-314833075 +Ref: Library<56>-Footnote-324833141 +Ref: Library<56>-Footnote-334833207 +Ref: Library<56>-Footnote-344833273 +Ref: Library<56>-Footnote-354833339 +Ref: Library<56>-Footnote-364833405 +Ref: Library<56>-Footnote-374833471 +Ref: Library<56>-Footnote-384833537 +Ref: Library<56>-Footnote-394833603 +Ref: Library<56>-Footnote-404833669 +Ref: Library<56>-Footnote-414833735 +Ref: Library<56>-Footnote-424833801 +Ref: Library<56>-Footnote-434833867 +Ref: Library<56>-Footnote-444833933 +Ref: Library<56>-Footnote-454833999 +Ref: Library<56>-Footnote-464834065 +Ref: Library<56>-Footnote-474834131 +Ref: Library<56>-Footnote-484834197 +Ref: Library<56>-Footnote-494834263 +Ref: Library<56>-Footnote-504834329 +Ref: Library<56>-Footnote-514834395 +Ref: Library<56>-Footnote-524834461 +Ref: Library<56>-Footnote-534834527 +Ref: Library<56>-Footnote-544834593 +Ref: Library<56>-Footnote-554834659 +Ref: Library<56>-Footnote-564834725 +Ref: Library<56>-Footnote-574834791 +Ref: Library<56>-Footnote-584834857 +Ref: Library<56>-Footnote-594834923 +Ref: Library<56>-Footnote-604834989 +Ref: Library<56>-Footnote-614835055 +Ref: Library<56>-Footnote-624835121 +Ref: Library<56>-Footnote-634835187 +Ref: Library<56>-Footnote-644835253 +Ref: Library<56>-Footnote-654835319 +Ref: Library<56>-Footnote-664835385 +Ref: Library<56>-Footnote-674835451 +Ref: Library<56>-Footnote-684835517 +Ref: Library<56>-Footnote-694835583 +Ref: Library<56>-Footnote-704835649 +Ref: Library<56>-Footnote-714835715 +Ref: Library<56>-Footnote-724835781 +Ref: Library<56>-Footnote-734835847 +Ref: Library<56>-Footnote-744835913 +Ref: Library<56>-Footnote-754835979 +Ref: Library<56>-Footnote-764836045 +Ref: Library<56>-Footnote-774836111 +Ref: Library<56>-Footnote-784836177 +Ref: Library<56>-Footnote-794836243 +Ref: Library<56>-Footnote-804836309 +Ref: Library<56>-Footnote-814836375 +Ref: Library<56>-Footnote-824836441 +Ref: Library<56>-Footnote-834836507 +Ref: Library<56>-Footnote-844836573 +Ref: Library<56>-Footnote-854836639 +Ref: Library<56>-Footnote-864836705 +Ref: Library<56>-Footnote-874836771 +Ref: Library<56>-Footnote-884836837 +Ref: Library<56>-Footnote-894836903 +Ref: Library<56>-Footnote-904836969 +Ref: Library<56>-Footnote-914837035 +Ref: Library<56>-Footnote-924837101 +Ref: Library<56>-Footnote-934837167 +Ref: Library<56>-Footnote-944837227 +Ref: Library<56>-Footnote-954837293 +Ref: Library<56>-Footnote-964837359 +Ref: Library<56>-Footnote-974837425 +Ref: Library<56>-Footnote-984837491 +Ref: Library<56>-Footnote-994837557 +Ref: Library<56>-Footnote-1004837623 +Ref: Library<56>-Footnote-1014837690 +Ref: Library<56>-Footnote-1024837757 +Ref: Library<56>-Footnote-1034837824 +Ref: Library<56>-Footnote-1044837891 +Ref: Library<56>-Footnote-1054837958 +Ref: Library<56>-Footnote-1064838025 +Ref: Library<56>-Footnote-1074838092 +Ref: Library<56>-Footnote-1084838159 +Ref: Library<56>-Footnote-1094838226 +Ref: Library<56>-Footnote-1104838293 +Ref: Library<56>-Footnote-1114838360 +Ref: Library<56>-Footnote-1124838427 +Ref: Library<56>-Footnote-1134838494 +Ref: Library<56>-Footnote-1144838561 +Ref: Library<56>-Footnote-1154838628 +Ref: Library<56>-Footnote-1164838695 +Ref: Library<56>-Footnote-1174838762 +Ref: Library<56>-Footnote-1184838829 +Ref: Library<56>-Footnote-1194838896 +Ref: Library<56>-Footnote-1204838963 +Ref: Library<56>-Footnote-1214839030 +Ref: Library<56>-Footnote-1224839097 +Ref: Library<56>-Footnote-1234839164 +Ref: Library<56>-Footnote-1244839231 +Ref: Library<56>-Footnote-1254839298 +Ref: Library<56>-Footnote-1264839364 +Ref: Library<56>-Footnote-1274839431 +Ref: Library<56>-Footnote-1284839498 +Ref: Library<56>-Footnote-1294839565 +Ref: Library<56>-Footnote-1304839632 +Ref: Library<56>-Footnote-1314839699 +Ref: Library<56>-Footnote-1324839766 +Ref: Library<56>-Footnote-1334839833 +Ref: Library<56>-Footnote-1344839900 +Ref: Library<56>-Footnote-1354839967 +Ref: Library<56>-Footnote-1364840034 +Ref: Library<56>-Footnote-1374840100 +Ref: Library<56>-Footnote-1384840167 +Ref: Library<56>-Footnote-1394840234 +Ref: Library<56>-Footnote-1404840301 +Ref: Library<56>-Footnote-1414840368 +Ref: Library<56>-Footnote-1424840435 +Ref: Library<56>-Footnote-1434840502 +Ref: Library<56>-Footnote-1444840569 +Ref: Library<56>-Footnote-1454840636 +Ref: Library<56>-Footnote-1464840703 +Ref: Library<56>-Footnote-1474840770 +Ref: Library<56>-Footnote-1484840837 +Ref: Library<56>-Footnote-1494840904 +Ref: Library<56>-Footnote-1504840971 +Ref: Library<56>-Footnote-1514841038 +Ref: Library<56>-Footnote-1524841105 +Ref: Library<56>-Footnote-1534841172 +Ref: Library<56>-Footnote-1544841239 +Ref: Library<56>-Footnote-1554841305 +Ref: Library<56>-Footnote-1564841372 +Ref: Library<56>-Footnote-1574841439 +Ref: Library<56>-Footnote-1584841506 +Ref: Library<56>-Footnote-1594841573 +Ref: Library<56>-Footnote-1604841640 +Ref: Library<56>-Footnote-1614841707 +Ref: Library<56>-Footnote-1624841751 +Ref: Library<56>-Footnote-1634841818 +Ref: Library<56>-Footnote-1644841885 +Ref: Library<56>-Footnote-1654841952 +Ref: Library<56>-Footnote-1664842018 +Ref: Library<56>-Footnote-1674842085 +Ref: Library<56>-Footnote-1684842152 +Ref: Library<56>-Footnote-1694842219 +Ref: Library<56>-Footnote-1704842286 +Ref: Library<56>-Footnote-1714842353 +Ref: Library<56>-Footnote-1724842420 +Ref: Library<56>-Footnote-1734842487 +Ref: Library<56>-Footnote-1744842554 +Ref: Library<56>-Footnote-1754842620 +Ref: Library<56>-Footnote-1764842687 +Ref: Library<56>-Footnote-1774842754 +Ref: Library<56>-Footnote-1784842821 +Ref: Library<56>-Footnote-1794842888 +Ref: Library<56>-Footnote-1804842955 +Ref: Library<56>-Footnote-1814843021 +Ref: Library<56>-Footnote-1824843088 +Ref: Library<56>-Footnote-1834843155 +Ref: Library<56>-Footnote-1844843222 +Ref: Library<56>-Footnote-1854843289 +Ref: Library<56>-Footnote-1864843356 +Ref: Library<56>-Footnote-1874843423 +Ref: Library<56>-Footnote-1884843490 +Ref: Library<56>-Footnote-1894843557 +Ref: Library<56>-Footnote-1904843624 +Ref: Library<56>-Footnote-1914843691 +Ref: Library<56>-Footnote-1924843758 +Ref: Library<56>-Footnote-1934843825 +Ref: Library<56>-Footnote-1944843892 +Ref: Library<56>-Footnote-1954843959 +Ref: Library<56>-Footnote-1964844026 +Ref: Library<56>-Footnote-1974844093 +Ref: Library<56>-Footnote-1984844160 +Ref: Library<56>-Footnote-1994844227 +Ref: Library<56>-Footnote-2004844294 +Ref: Library<56>-Footnote-2014844361 +Ref: Library<56>-Footnote-2024844428 +Ref: Library<56>-Footnote-2034844496 +Ref: Library<56>-Footnote-2044844563 +Ref: Library<56>-Footnote-2054844630 +Ref: Library<56>-Footnote-2064844697 +Ref: Library<56>-Footnote-2074844764 +Ref: Library<56>-Footnote-2084844831 +Ref: Library<56>-Footnote-2094844898 +Ref: Library<56>-Footnote-2104844965 +Ref: Library<56>-Footnote-2114845032 +Ref: Library<56>-Footnote-2124845099 +Ref: Library<56>-Footnote-2134845166 +Ref: Library<56>-Footnote-2144845210 +Ref: Library<56>-Footnote-2154845277 +Ref: Library<56>-Footnote-2164845344 +Ref: Library<56>-Footnote-2174845411 +Ref: Library<56>-Footnote-2184845478 +Ref: Library<56>-Footnote-2194845545 +Ref: Library<56>-Footnote-2204845612 +Ref: Library<56>-Footnote-2214845679 +Ref: Library<56>-Footnote-2224845746 +Ref: Library<56>-Footnote-2234845813 +Ref: Library<56>-Footnote-2244845880 +Ref: Library<56>-Footnote-2254845947 +Ref: Library<56>-Footnote-2264846014 +Ref: Library<56>-Footnote-2274846081 +Ref: Library<56>-Footnote-2284846148 +Ref: Library<56>-Footnote-2294846215 +Ref: Library<56>-Footnote-2304846282 +Ref: Library<56>-Footnote-2314846349 +Ref: Library<56>-Footnote-2324846416 +Ref: Library<56>-Footnote-2334846483 +Ref: Library<56>-Footnote-2344846550 +Ref: Library<56>-Footnote-2354846617 +Ref: Library<56>-Footnote-2364846684 +Ref: Library<56>-Footnote-2374846751 +Ref: Library<56>-Footnote-2384846818 +Ref: Library<56>-Footnote-2394846885 +Ref: Library<56>-Footnote-2404846952 +Ref: Library<56>-Footnote-2414847019 +Ref: Library<56>-Footnote-2424847086 +Ref: Library<56>-Footnote-2434847153 +Ref: Library<56>-Footnote-2444847220 +Ref: Library<56>-Footnote-2454847287 +Ref: Library<56>-Footnote-2464847354 +Ref: Library<56>-Footnote-2474847421 +Ref: Library<56>-Footnote-2484847488 +Ref: Library<56>-Footnote-2494847555 +Ref: Library<56>-Footnote-2504847622 +Ref: Library<56>-Footnote-2514847689 +Ref: Library<56>-Footnote-2524847756 +Ref: Library<56>-Footnote-2534847823 +Ref: Library<56>-Footnote-2544847890 +Ref: Library<56>-Footnote-2554847957 +Ref: Library<56>-Footnote-2564848024 +Ref: Library<56>-Footnote-2574848091 +Ref: Library<56>-Footnote-2584848158 +Ref: Library<56>-Footnote-2594848225 +Ref: Library<56>-Footnote-2604848292 +Ref: Library<56>-Footnote-2614848358 +Ref: Library<56>-Footnote-2624848425 +Ref: Library<56>-Footnote-2634848492 +Ref: Library<56>-Footnote-2644848559 +Ref: Library<56>-Footnote-2654848626 +Ref: Library<56>-Footnote-2664848693 +Ref: Library<56>-Footnote-2674848760 +Ref: Library<56>-Footnote-2684848827 +Ref: Library<56>-Footnote-2694848894 +Ref: Library<56>-Footnote-2704848961 +Ref: Library<56>-Footnote-2714849028 +Ref: Library<56>-Footnote-2724849095 +Ref: Library<56>-Footnote-2734849162 +Ref: Library<56>-Footnote-2744849229 +Ref: Library<56>-Footnote-2754849296 +Ref: Library<56>-Footnote-2764849363 +Ref: Library<56>-Footnote-2774849430 +Ref: Library<56>-Footnote-2784849497 +Ref: Library<56>-Footnote-2794849564 +Ref: Library<56>-Footnote-2804849631 +Ref: Library<56>-Footnote-2814849698 +Ref: Library<56>-Footnote-2824849765 +Ref: Library<56>-Footnote-2834849832 +Ref: Library<56>-Footnote-2844849899 +Ref: Library<56>-Footnote-2854849966 +Ref: Library<56>-Footnote-2864850033 +Ref: Library<56>-Footnote-2874850100 +Ref: Library<56>-Footnote-2884850167 +Ref: Library<56>-Footnote-2894850234 +Ref: Library<56>-Footnote-2904850301 +Ref: Library<56>-Footnote-2914850368 +Ref: Library<56>-Footnote-2924850435 +Ref: Library<56>-Footnote-2934850502 +Ref: Library<56>-Footnote-2944850569 +Ref: Library<56>-Footnote-2954850636 +Ref: Library<56>-Footnote-2964850703 +Ref: Library<56>-Footnote-2974850770 +Ref: Library<56>-Footnote-2984850837 +Ref: Library<56>-Footnote-2994850904 +Ref: Library<56>-Footnote-3004850971 +Ref: Library<56>-Footnote-3014851038 +Ref: Library<56>-Footnote-3024851105 +Ref: Library<56>-Footnote-3034851172 +Ref: Library<56>-Footnote-3044851239 +Ref: Library<56>-Footnote-3054851306 +Ref: Library<56>-Footnote-3064851373 +Ref: Library<56>-Footnote-3074851440 +Ref: Library<56>-Footnote-3084851507 +Ref: Library<56>-Footnote-3094851574 +Ref: Library<56>-Footnote-3104851641 +Ref: Library<56>-Footnote-3114851708 +Ref: Library<56>-Footnote-3124851775 +Ref: Library<56>-Footnote-3134851842 +Ref: Library<56>-Footnote-3144851909 +Ref: Library<56>-Footnote-3154851976 +Ref: Library<56>-Footnote-3164852043 +Ref: Library<56>-Footnote-3174852110 +Ref: Library<56>-Footnote-3184852177 +Ref: Library<56>-Footnote-3194852244 +Ref: Library<56>-Footnote-3204852311 +Ref: Library<56>-Footnote-3214852378 +Ref: Library<56>-Footnote-3224852445 +Ref: Library<56>-Footnote-3234852512 +Ref: Library<56>-Footnote-3244852579 +Ref: Library<56>-Footnote-3254852646 +Ref: Library<56>-Footnote-3264852713 +Ref: Library<56>-Footnote-3274852780 +Ref: Library<56>-Footnote-3284852847 +Ref: Library<56>-Footnote-3294852915 +Ref: Library<56>-Footnote-3304852982 +Ref: Library<56>-Footnote-3314853049 +Ref: Library<56>-Footnote-3324853116 +Ref: Library<56>-Footnote-3334853183 +Ref: Library<56>-Footnote-3344853250 +Ref: Library<56>-Footnote-3354853317 +Ref: Library<56>-Footnote-3364853384 +Ref: Library<56>-Footnote-3374853451 +Ref: Library<56>-Footnote-3384853518 +Ref: Library<56>-Footnote-3394853585 +Ref: Library<56>-Footnote-3404853652 +Ref: Library<56>-Footnote-3414853719 +Ref: Library<56>-Footnote-3424853786 +Ref: Library<56>-Footnote-3434853853 +Ref: Library<56>-Footnote-3444853920 +Ref: Library<56>-Footnote-3454853987 +Ref: Library<56>-Footnote-3464854031 +Ref: Library<56>-Footnote-3474854098 +Ref: Library<56>-Footnote-3484854165 +Ref: Library<56>-Footnote-3494854232 +Ref: Library<56>-Footnote-3504854276 +Ref: Library<56>-Footnote-3514854343 +Ref: Library<56>-Footnote-3524854410 +Ref: Library<56>-Footnote-3534854477 +Ref: Library<56>-Footnote-3544854544 +Ref: Library<56>-Footnote-3554854611 +Ref: Library<56>-Footnote-3564854678 +Ref: Library<56>-Footnote-3574854745 +Ref: Library<56>-Footnote-3584854812 +Ref: Library<56>-Footnote-3594854879 +Ref: Library<56>-Footnote-3604854946 +Ref: Library<56>-Footnote-3614855013 +Ref: Library<56>-Footnote-3624855080 +Ref: Library<56>-Footnote-3634855147 +Ref: Library<56>-Footnote-3644855214 +Ref: Library<56>-Footnote-3654855281 +Ref: Library<56>-Footnote-3664855348 +Ref: Library<56>-Footnote-3674855415 +Ref: Library<56>-Footnote-3684855482 +Ref: Library<56>-Footnote-3694855549 +Ref: Library<56>-Footnote-3704855616 +Ref: Library<56>-Footnote-3714855683 +Ref: Library<56>-Footnote-3724855750 +Ref: Library<56>-Footnote-3734855817 +Ref: Library<56>-Footnote-3744855884 +Ref: Library<56>-Footnote-3754855951 +Ref: Library<56>-Footnote-3764856018 +Ref: Library<56>-Footnote-3774856085 +Ref: Library<56>-Footnote-3784856152 +Ref: Library<56>-Footnote-3794856219 +Ref: Library<56>-Footnote-3804856286 +Ref: Library<56>-Footnote-3814856353 +Ref: Library<56>-Footnote-3824856420 +Ref: Library<56>-Footnote-3834856487 +Ref: Library<56>-Footnote-3844856554 +Ref: Library<56>-Footnote-3854856621 +Ref: Library<56>-Footnote-3864856688 +Ref: Library<56>-Footnote-3874856755 +Ref: Library<56>-Footnote-3884856822 +Ref: Library<56>-Footnote-3894856889 +Ref: Library<56>-Footnote-3904856956 +Ref: Library<56>-Footnote-3914857023 +Ref: Library<56>-Footnote-3924857090 +Ref: Library<56>-Footnote-3934857157 +Ref: Library<56>-Footnote-3944857224 +Ref: Library<56>-Footnote-3954857291 +Ref: Library<56>-Footnote-3964857358 +Ref: Library<56>-Footnote-3974857425 +Ref: Library<56>-Footnote-3984857492 +Ref: Library<56>-Footnote-3994857559 +Ref: Library<56>-Footnote-4004857626 +Ref: Library<56>-Footnote-4014857693 +Ref: Library<56>-Footnote-4024857760 +Ref: Library<56>-Footnote-4034857827 +Ref: Library<56>-Footnote-4044857894 +Ref: Library<56>-Footnote-4054857961 +Ref: Library<56>-Footnote-4064858028 +Ref: Library<56>-Footnote-4074858095 +Ref: Library<56>-Footnote-4084858162 +Ref: Library<56>-Footnote-4094858229 +Ref: Library<56>-Footnote-4104858296 +Ref: Library<56>-Footnote-4114858363 +Ref: Library<56>-Footnote-4124858430 +Ref: Library<56>-Footnote-4134858497 +Ref: Library<56>-Footnote-4144858564 +Ref: Library<56>-Footnote-4154858631 +Ref: Library<56>-Footnote-4164858698 +Ref: Library<56>-Footnote-4174858765 +Ref: Library<56>-Footnote-4184858832 +Ref: Library<56>-Footnote-4194858899 +Ref: Library<56>-Footnote-4204858966 +Ref: Library<56>-Footnote-4214859033 +Ref: Library<56>-Footnote-4224859100 +Ref: Library<56>-Footnote-4234859166 +Ref: Library<56>-Footnote-4244859233 +Ref: Library<56>-Footnote-4254859300 +Ref: Library<56>-Footnote-4264859367 +Ref: Library<56>-Footnote-4274859434 +Ref: Library<56>-Footnote-4284859501 +Ref: Library<56>-Footnote-4294859568 +Ref: Library<56>-Footnote-4304859635 +Ref: Library<56>-Footnote-4314859702 +Ref: Library<56>-Footnote-4324859769 +Ref: Library<56>-Footnote-4334859836 +Ref: Library<56>-Footnote-4344859903 +Ref: Library<56>-Footnote-4354859970 +Ref: Library<56>-Footnote-4364860037 +Ref: Library<56>-Footnote-4374860104 +Node: Documentation<51>4860171 +Ref: whatsnew/changelog id4974860283 +Ref: 1a474860283 +Ref: Documentation<51>-Footnote-14866974 +Ref: Documentation<51>-Footnote-24867039 +Ref: Documentation<51>-Footnote-34867104 +Ref: Documentation<51>-Footnote-44867169 +Ref: Documentation<51>-Footnote-54867234 +Ref: Documentation<51>-Footnote-64867299 +Ref: Documentation<51>-Footnote-74867364 +Ref: Documentation<51>-Footnote-84867429 +Ref: Documentation<51>-Footnote-94867494 +Ref: Documentation<51>-Footnote-104867559 +Ref: Documentation<51>-Footnote-114867625 +Ref: Documentation<51>-Footnote-124867691 +Ref: Documentation<51>-Footnote-134867757 +Ref: Documentation<51>-Footnote-144867823 +Ref: Documentation<51>-Footnote-154867889 +Ref: Documentation<51>-Footnote-164867955 +Ref: Documentation<51>-Footnote-174868021 +Ref: Documentation<51>-Footnote-184868087 +Ref: Documentation<51>-Footnote-194868153 +Ref: Documentation<51>-Footnote-204868219 +Ref: Documentation<51>-Footnote-214868285 +Ref: Documentation<51>-Footnote-224868351 +Ref: Documentation<51>-Footnote-234868417 +Ref: Documentation<51>-Footnote-244868460 +Ref: Documentation<51>-Footnote-254868526 +Ref: Documentation<51>-Footnote-264868592 +Ref: Documentation<51>-Footnote-274868658 +Ref: Documentation<51>-Footnote-284868724 +Ref: Documentation<51>-Footnote-294868790 +Ref: Documentation<51>-Footnote-304868833 +Ref: Documentation<51>-Footnote-314868899 +Ref: Documentation<51>-Footnote-324868965 +Ref: Documentation<51>-Footnote-334869031 +Ref: Documentation<51>-Footnote-344869097 +Ref: Documentation<51>-Footnote-354869163 +Ref: Documentation<51>-Footnote-364869229 +Ref: Documentation<51>-Footnote-374869295 +Ref: Documentation<51>-Footnote-384869361 +Ref: Documentation<51>-Footnote-394869427 +Ref: Documentation<51>-Footnote-404869493 +Ref: Documentation<51>-Footnote-414869559 +Ref: Documentation<51>-Footnote-424869625 +Ref: Documentation<51>-Footnote-434869691 +Ref: Documentation<51>-Footnote-444869757 +Ref: Documentation<51>-Footnote-454869823 +Ref: Documentation<51>-Footnote-464869889 +Ref: Documentation<51>-Footnote-474869955 +Ref: Documentation<51>-Footnote-484870021 +Ref: Documentation<51>-Footnote-494870087 +Ref: Documentation<51>-Footnote-504870153 +Ref: Documentation<51>-Footnote-514870218 +Ref: Documentation<51>-Footnote-524870284 +Ref: Documentation<51>-Footnote-534870350 +Ref: Documentation<51>-Footnote-544870416 +Ref: Documentation<51>-Footnote-554870482 +Ref: Documentation<51>-Footnote-564870548 +Ref: Documentation<51>-Footnote-574870613 +Ref: Documentation<51>-Footnote-584870679 +Ref: Documentation<51>-Footnote-594870745 +Node: Tests<52>4870811 +Ref: whatsnew/changelog id4984870921 +Ref: 1a494870921 +Ref: Tests<52>-Footnote-14878547 +Ref: Tests<52>-Footnote-24878612 +Ref: Tests<52>-Footnote-34878677 +Ref: Tests<52>-Footnote-44878742 +Ref: Tests<52>-Footnote-54878807 +Ref: Tests<52>-Footnote-64878872 +Ref: Tests<52>-Footnote-74878937 +Ref: Tests<52>-Footnote-84879002 +Ref: Tests<52>-Footnote-94879067 +Ref: Tests<52>-Footnote-104879132 +Ref: Tests<52>-Footnote-114879198 +Ref: Tests<52>-Footnote-124879264 +Ref: Tests<52>-Footnote-134879330 +Ref: Tests<52>-Footnote-144879396 +Ref: Tests<52>-Footnote-154879462 +Ref: Tests<52>-Footnote-164879528 +Ref: Tests<52>-Footnote-174879594 +Ref: Tests<52>-Footnote-184879660 +Ref: Tests<52>-Footnote-194879726 +Ref: Tests<52>-Footnote-204879792 +Ref: Tests<52>-Footnote-214879858 +Ref: Tests<52>-Footnote-224879924 +Ref: Tests<52>-Footnote-234879990 +Ref: Tests<52>-Footnote-244880056 +Ref: Tests<52>-Footnote-254880122 +Ref: Tests<52>-Footnote-264880188 +Ref: Tests<52>-Footnote-274880254 +Ref: Tests<52>-Footnote-284880320 +Ref: Tests<52>-Footnote-294880386 +Ref: Tests<52>-Footnote-304880452 +Ref: Tests<52>-Footnote-314880518 +Ref: Tests<52>-Footnote-324880584 +Ref: Tests<52>-Footnote-334880650 +Ref: Tests<52>-Footnote-344880716 +Ref: Tests<52>-Footnote-354880782 +Ref: Tests<52>-Footnote-364880848 +Ref: Tests<52>-Footnote-374880914 +Ref: Tests<52>-Footnote-384880980 +Ref: Tests<52>-Footnote-394881046 +Ref: Tests<52>-Footnote-404881112 +Ref: Tests<52>-Footnote-414881178 +Ref: Tests<52>-Footnote-424881244 +Ref: Tests<52>-Footnote-434881310 +Ref: Tests<52>-Footnote-444881376 +Ref: Tests<52>-Footnote-454881442 +Ref: Tests<52>-Footnote-464881508 +Ref: Tests<52>-Footnote-474881574 +Ref: Tests<52>-Footnote-484881640 +Node: Build<53>4881706 +Ref: whatsnew/changelog id4994881810 +Ref: 1a4a4881810 +Ref: Build<53>-Footnote-14886931 +Ref: Build<53>-Footnote-24886996 +Ref: Build<53>-Footnote-34887061 +Ref: Build<53>-Footnote-44887126 +Ref: Build<53>-Footnote-54887191 +Ref: Build<53>-Footnote-64887256 +Ref: Build<53>-Footnote-74887321 +Ref: Build<53>-Footnote-84887386 +Ref: Build<53>-Footnote-94887451 +Ref: Build<53>-Footnote-104887516 +Ref: Build<53>-Footnote-114887582 +Ref: Build<53>-Footnote-124887648 +Ref: Build<53>-Footnote-134887714 +Ref: Build<53>-Footnote-144887780 +Ref: Build<53>-Footnote-154887846 +Ref: Build<53>-Footnote-164887912 +Ref: Build<53>-Footnote-174887978 +Ref: Build<53>-Footnote-184888044 +Ref: Build<53>-Footnote-194888110 +Ref: Build<53>-Footnote-204888176 +Ref: Build<53>-Footnote-214888242 +Ref: Build<53>-Footnote-224888308 +Ref: Build<53>-Footnote-234888374 +Ref: Build<53>-Footnote-244888439 +Ref: Build<53>-Footnote-254888505 +Ref: Build<53>-Footnote-264888571 +Ref: Build<53>-Footnote-274888637 +Ref: Build<53>-Footnote-284888703 +Ref: Build<53>-Footnote-294888769 +Ref: Build<53>-Footnote-304888835 +Ref: Build<53>-Footnote-314888901 +Ref: Build<53>-Footnote-324888967 +Ref: Build<53>-Footnote-334889033 +Ref: Build<53>-Footnote-344889099 +Ref: Build<53>-Footnote-354889165 +Ref: Build<53>-Footnote-364889231 +Ref: Build<53>-Footnote-374889297 +Node: Windows<50>4889363 +Ref: whatsnew/changelog id5004889467 +Ref: 1a4b4889467 +Ref: Windows<50>-Footnote-14893890 +Ref: Windows<50>-Footnote-24893955 +Ref: Windows<50>-Footnote-34894020 +Ref: Windows<50>-Footnote-44894085 +Ref: Windows<50>-Footnote-54894150 +Ref: Windows<50>-Footnote-64894215 +Ref: Windows<50>-Footnote-74894280 +Ref: Windows<50>-Footnote-84894345 +Ref: Windows<50>-Footnote-94894410 +Ref: Windows<50>-Footnote-104894475 +Ref: Windows<50>-Footnote-114894541 +Ref: Windows<50>-Footnote-124894607 +Ref: Windows<50>-Footnote-134894673 +Ref: Windows<50>-Footnote-144894739 +Ref: Windows<50>-Footnote-154894805 +Ref: Windows<50>-Footnote-164894871 +Ref: Windows<50>-Footnote-174894937 +Ref: Windows<50>-Footnote-184895003 +Ref: Windows<50>-Footnote-194895069 +Ref: Windows<50>-Footnote-204895135 +Ref: Windows<50>-Footnote-214895201 +Ref: Windows<50>-Footnote-224895267 +Ref: Windows<50>-Footnote-234895333 +Ref: Windows<50>-Footnote-244895399 +Ref: Windows<50>-Footnote-254895465 +Ref: Windows<50>-Footnote-264895531 +Ref: Windows<50>-Footnote-274895597 +Ref: Windows<50>-Footnote-284895663 +Ref: Windows<50>-Footnote-294895729 +Ref: Windows<50>-Footnote-304895795 +Ref: Windows<50>-Footnote-314895861 +Ref: Windows<50>-Footnote-324895927 +Ref: Windows<50>-Footnote-334895993 +Ref: Windows<50>-Footnote-344896059 +Ref: Windows<50>-Footnote-354896125 +Ref: Windows<50>-Footnote-364896191 +Ref: Windows<50>-Footnote-374896257 +Ref: Windows<50>-Footnote-384896323 +Ref: Windows<50>-Footnote-394896389 +Ref: Windows<50>-Footnote-404896455 +Node: macOS<40>4896520 +Ref: whatsnew/changelog id5014896623 +Ref: 1a4c4896623 +Ref: macOS<40>-Footnote-14898230 +Ref: macOS<40>-Footnote-24898295 +Ref: macOS<40>-Footnote-34898360 +Ref: macOS<40>-Footnote-44898425 +Ref: macOS<40>-Footnote-54898490 +Ref: macOS<40>-Footnote-64898555 +Ref: macOS<40>-Footnote-74898620 +Ref: macOS<40>-Footnote-84898685 +Ref: macOS<40>-Footnote-94898750 +Ref: macOS<40>-Footnote-104898815 +Node: IDLE<39>4898881 +Ref: whatsnew/changelog id5024898988 +Ref: 1a4d4898988 +Ref: IDLE<39>-Footnote-14907450 +Ref: IDLE<39>-Footnote-24907515 +Ref: IDLE<39>-Footnote-34907580 +Ref: IDLE<39>-Footnote-44907645 +Ref: IDLE<39>-Footnote-54907710 +Ref: IDLE<39>-Footnote-64907775 +Ref: IDLE<39>-Footnote-74907840 +Ref: IDLE<39>-Footnote-84907905 +Ref: IDLE<39>-Footnote-94907970 +Ref: IDLE<39>-Footnote-104908035 +Ref: IDLE<39>-Footnote-114908101 +Ref: IDLE<39>-Footnote-124908167 +Ref: IDLE<39>-Footnote-134908233 +Ref: IDLE<39>-Footnote-144908299 +Ref: IDLE<39>-Footnote-154908365 +Ref: IDLE<39>-Footnote-164908431 +Ref: IDLE<39>-Footnote-174908497 +Ref: IDLE<39>-Footnote-184908563 +Ref: IDLE<39>-Footnote-194908629 +Ref: IDLE<39>-Footnote-204908695 +Ref: IDLE<39>-Footnote-214908761 +Ref: IDLE<39>-Footnote-224908827 +Ref: IDLE<39>-Footnote-234908893 +Ref: IDLE<39>-Footnote-244908959 +Ref: IDLE<39>-Footnote-254909025 +Ref: IDLE<39>-Footnote-264909091 +Ref: IDLE<39>-Footnote-274909157 +Ref: IDLE<39>-Footnote-284909225 +Ref: IDLE<39>-Footnote-294909291 +Ref: IDLE<39>-Footnote-304909357 +Ref: IDLE<39>-Footnote-314909423 +Ref: IDLE<39>-Footnote-324909489 +Ref: IDLE<39>-Footnote-334909555 +Ref: IDLE<39>-Footnote-344909621 +Ref: IDLE<39>-Footnote-354909687 +Ref: IDLE<39>-Footnote-364909753 +Ref: IDLE<39>-Footnote-374909819 +Ref: IDLE<39>-Footnote-384909885 +Ref: IDLE<39>-Footnote-394909951 +Ref: IDLE<39>-Footnote-404910017 +Ref: IDLE<39>-Footnote-414910083 +Ref: IDLE<39>-Footnote-424910149 +Ref: IDLE<39>-Footnote-434910215 +Ref: IDLE<39>-Footnote-444910281 +Ref: IDLE<39>-Footnote-454910347 +Ref: IDLE<39>-Footnote-464910413 +Ref: IDLE<39>-Footnote-474910479 +Ref: IDLE<39>-Footnote-484910545 +Ref: IDLE<39>-Footnote-494910611 +Ref: IDLE<39>-Footnote-504910677 +Ref: IDLE<39>-Footnote-514910743 +Ref: IDLE<39>-Footnote-524910809 +Ref: IDLE<39>-Footnote-534910875 +Ref: IDLE<39>-Footnote-544910941 +Ref: IDLE<39>-Footnote-554911007 +Ref: IDLE<39>-Footnote-564911073 +Ref: IDLE<39>-Footnote-574911139 +Ref: IDLE<39>-Footnote-584911205 +Ref: IDLE<39>-Footnote-594911271 +Node: Tools/Demos<27>4911337 +Ref: whatsnew/changelog id5034911444 +Ref: 1a4e4911444 +Ref: Tools/Demos<27>-Footnote-14913093 +Ref: Tools/Demos<27>-Footnote-24913158 +Ref: Tools/Demos<27>-Footnote-34913223 +Ref: Tools/Demos<27>-Footnote-44913288 +Ref: Tools/Demos<27>-Footnote-54913353 +Ref: Tools/Demos<27>-Footnote-64913418 +Ref: Tools/Demos<27>-Footnote-74913483 +Ref: Tools/Demos<27>-Footnote-84913548 +Ref: Tools/Demos<27>-Footnote-94913613 +Ref: Tools/Demos<27>-Footnote-104913678 +Ref: Tools/Demos<27>-Footnote-114913744 +Ref: Tools/Demos<27>-Footnote-124913810 +Node: C API<52>4913876 +Ref: whatsnew/changelog id5044913966 +Ref: 1a4f4913966 +Ref: C API<52>-Footnote-14917376 +Ref: C API<52>-Footnote-24917441 +Ref: C API<52>-Footnote-34917506 +Ref: C API<52>-Footnote-44917571 +Ref: C API<52>-Footnote-54917636 +Ref: C API<52>-Footnote-64917701 +Ref: C API<52>-Footnote-74917766 +Ref: C API<52>-Footnote-84917831 +Ref: C API<52>-Footnote-94917896 +Ref: C API<52>-Footnote-104917961 +Ref: C API<52>-Footnote-114918027 +Ref: C API<52>-Footnote-124918093 +Ref: C API<52>-Footnote-134918159 +Ref: C API<52>-Footnote-144918225 +Ref: C API<52>-Footnote-154918291 +Ref: C API<52>-Footnote-164918357 +Ref: C API<52>-Footnote-174918423 +Ref: C API<52>-Footnote-184918489 +Ref: C API<52>-Footnote-194918555 +Ref: C API<52>-Footnote-204918621 +Ref: C API<52>-Footnote-214918687 +Ref: C API<52>-Footnote-224918753 +Node: Python 3 7 0 final4918819 +Ref: whatsnew/changelog python-3-7-0-final4918953 +Ref: 1a574918953 +Node: Library<57>4919090 +Ref: whatsnew/changelog id5054919174 +Ref: 1a584919174 +Ref: Library<57>-Footnote-14919344 +Node: C API<53>4919409 +Ref: whatsnew/changelog id5064919493 +Ref: 1a5a4919493 +Ref: C API<53>-Footnote-14919704 +Node: Python 3 7 0 release candidate 14919769 +Ref: whatsnew/changelog python-3-7-0-release-candidate-14919902 +Ref: 1a5b4919902 +Node: Core and Builtins<58>4920189 +Ref: whatsnew/changelog id5074920299 +Ref: 1a5c4920299 +Ref: Core and Builtins<58>-Footnote-14920943 +Ref: Core and Builtins<58>-Footnote-24921008 +Ref: Core and Builtins<58>-Footnote-34921073 +Ref: Core and Builtins<58>-Footnote-44921138 +Node: Library<58>4921203 +Ref: whatsnew/changelog id5084921339 +Ref: 1a5d4921339 +Ref: Library<58>-Footnote-14923037 +Ref: Library<58>-Footnote-24923102 +Ref: Library<58>-Footnote-34923167 +Ref: Library<58>-Footnote-44923232 +Ref: Library<58>-Footnote-54923297 +Ref: Library<58>-Footnote-64923362 +Ref: Library<58>-Footnote-74923427 +Ref: Library<58>-Footnote-84923492 +Ref: Library<58>-Footnote-94923557 +Ref: Library<58>-Footnote-104923622 +Ref: Library<58>-Footnote-114923688 +Ref: Library<58>-Footnote-124923754 +Ref: Library<58>-Footnote-134923820 +Node: Documentation<52>4923886 +Ref: whatsnew/changelog id5094924010 +Ref: 1a5e4924010 +Ref: Documentation<52>-Footnote-14924517 +Ref: Documentation<52>-Footnote-24924582 +Ref: Documentation<52>-Footnote-34924624 +Ref: Documentation<52>-Footnote-44924689 +Node: Build<54>4924754 +Ref: whatsnew/changelog id5104924878 +Ref: 1a5f4924878 +Ref: Build<54>-Footnote-14925140 +Node: Windows<51>4925204 +Ref: whatsnew/changelog id5114925319 +Ref: 1a604925319 +Ref: Windows<51>-Footnote-14925476 +Node: IDLE<40>4925541 +Ref: whatsnew/changelog id5124925638 +Ref: 1a614925638 +Ref: IDLE<40>-Footnote-14926858 +Ref: IDLE<40>-Footnote-24926923 +Ref: IDLE<40>-Footnote-34926988 +Ref: IDLE<40>-Footnote-44927053 +Ref: IDLE<40>-Footnote-54927118 +Ref: IDLE<40>-Footnote-64927183 +Node: Python 3 7 0 beta 54927248 +Ref: whatsnew/changelog python-3-7-0-beta-54927382 +Ref: 1a624927382 +Node: Core and Builtins<59>4927659 +Ref: whatsnew/changelog id5134927756 +Ref: 1a634927756 +Ref: Core and Builtins<59>-Footnote-14929270 +Ref: Core and Builtins<59>-Footnote-24929335 +Ref: Core and Builtins<59>-Footnote-34929400 +Ref: Core and Builtins<59>-Footnote-44929465 +Ref: Core and Builtins<59>-Footnote-54929530 +Ref: Core and Builtins<59>-Footnote-64929595 +Ref: Core and Builtins<59>-Footnote-74929660 +Ref: Core and Builtins<59>-Footnote-84929725 +Ref: Core and Builtins<59>-Footnote-94929790 +Node: Library<59>4929855 +Ref: whatsnew/changelog id5144929978 +Ref: 1a644929978 +Ref: Library<59>-Footnote-14935608 +Ref: Library<59>-Footnote-24935673 +Ref: Library<59>-Footnote-34935738 +Ref: Library<59>-Footnote-44935803 +Ref: Library<59>-Footnote-54935868 +Ref: Library<59>-Footnote-64935933 +Ref: Library<59>-Footnote-74935998 +Ref: Library<59>-Footnote-84936063 +Ref: Library<59>-Footnote-94936128 +Ref: Library<59>-Footnote-104936193 +Ref: Library<59>-Footnote-114936259 +Ref: Library<59>-Footnote-124936325 +Ref: Library<59>-Footnote-134936391 +Ref: Library<59>-Footnote-144936457 +Ref: Library<59>-Footnote-154936523 +Ref: Library<59>-Footnote-164936589 +Ref: Library<59>-Footnote-174936655 +Ref: Library<59>-Footnote-184936721 +Ref: Library<59>-Footnote-194936787 +Ref: Library<59>-Footnote-204936853 +Ref: Library<59>-Footnote-214936919 +Ref: Library<59>-Footnote-224936985 +Ref: Library<59>-Footnote-234937051 +Ref: Library<59>-Footnote-244937117 +Ref: Library<59>-Footnote-254937183 +Ref: Library<59>-Footnote-264937249 +Ref: Library<59>-Footnote-274937315 +Ref: Library<59>-Footnote-284937381 +Ref: Library<59>-Footnote-294937447 +Ref: Library<59>-Footnote-304937513 +Ref: Library<59>-Footnote-314937579 +Ref: Library<59>-Footnote-324937645 +Ref: Library<59>-Footnote-334937711 +Ref: Library<59>-Footnote-344937777 +Ref: Library<59>-Footnote-354937843 +Ref: Library<59>-Footnote-364937909 +Ref: Library<59>-Footnote-374937975 +Ref: Library<59>-Footnote-384938041 +Node: Documentation<53>4938107 +Ref: whatsnew/changelog id5154938218 +Ref: 1a654938218 +Ref: Documentation<53>-Footnote-14938688 +Ref: Documentation<53>-Footnote-24938753 +Ref: Documentation<53>-Footnote-34938818 +Ref: Documentation<53>-Footnote-44938860 +Ref: Documentation<53>-Footnote-54938925 +Ref: Documentation<53>-Footnote-64938990 +Node: Tests<53>4939055 +Ref: whatsnew/changelog id5164939164 +Ref: 1a664939164 +Ref: Tests<53>-Footnote-14939513 +Ref: Tests<53>-Footnote-24939578 +Node: Build<55>4939643 +Ref: whatsnew/changelog id5174939744 +Ref: 1a674939744 +Ref: Build<55>-Footnote-14940223 +Ref: Build<55>-Footnote-24940288 +Ref: Build<55>-Footnote-34940353 +Node: macOS<41>4940418 +Ref: whatsnew/changelog id5184940518 +Ref: 1a684940518 +Ref: macOS<41>-Footnote-14940760 +Node: IDLE<41>4940825 +Ref: whatsnew/changelog id5194940907 +Ref: 1a694940907 +Ref: IDLE<41>-Footnote-14941186 +Ref: IDLE<41>-Footnote-24941251 +Ref: IDLE<41>-Footnote-34941316 +Node: Python 3 7 0 beta 44941381 +Ref: whatsnew/changelog python-3-7-0-beta-44941502 +Ref: 1a6a4941502 +Node: Core and Builtins<60>4941835 +Ref: whatsnew/changelog id5204941932 +Ref: 1a6b4941932 +Ref: Core and Builtins<60>-Footnote-14943066 +Ref: Core and Builtins<60>-Footnote-24943131 +Ref: Core and Builtins<60>-Footnote-34943196 +Ref: Core and Builtins<60>-Footnote-44943261 +Ref: Core and Builtins<60>-Footnote-54943326 +Ref: Core and Builtins<60>-Footnote-64943391 +Ref: Core and Builtins<60>-Footnote-74943456 +Node: Library<60>4943521 +Ref: whatsnew/changelog id5214943644 +Ref: 1a6c4943644 +Ref: Library<60>-Footnote-14946481 +Ref: Library<60>-Footnote-24946546 +Ref: Library<60>-Footnote-34946611 +Ref: Library<60>-Footnote-44946676 +Ref: Library<60>-Footnote-54946742 +Ref: Library<60>-Footnote-64946807 +Ref: Library<60>-Footnote-74946872 +Ref: Library<60>-Footnote-84946937 +Ref: Library<60>-Footnote-94947002 +Ref: Library<60>-Footnote-104947067 +Ref: Library<60>-Footnote-114947133 +Ref: Library<60>-Footnote-124947199 +Ref: Library<60>-Footnote-134947265 +Ref: Library<60>-Footnote-144947331 +Ref: Library<60>-Footnote-154947397 +Ref: Library<60>-Footnote-164947463 +Ref: Library<60>-Footnote-174947529 +Ref: Library<60>-Footnote-184947572 +Ref: Library<60>-Footnote-194947638 +Ref: Library<60>-Footnote-204947704 +Ref: Library<60>-Footnote-214947770 +Ref: Library<60>-Footnote-224947836 +Node: Documentation<54>4947902 +Ref: whatsnew/changelog id5224948013 +Ref: 1a6d4948013 +Ref: Documentation<54>-Footnote-14948764 +Ref: Documentation<54>-Footnote-24948829 +Ref: Documentation<54>-Footnote-34948894 +Ref: Documentation<54>-Footnote-44948959 +Ref: Documentation<54>-Footnote-54949024 +Ref: Documentation<54>-Footnote-64949088 +Node: Tests<54>4949153 +Ref: whatsnew/changelog id5234949262 +Ref: 1a6e4949262 +Ref: Tests<54>-Footnote-14949478 +Node: Build<56>4949543 +Ref: whatsnew/changelog id5244949646 +Ref: 1a6f4949646 +Ref: Build<56>-Footnote-14950336 +Ref: Build<56>-Footnote-24950401 +Ref: Build<56>-Footnote-34950466 +Ref: Build<56>-Footnote-44950531 +Ref: Build<56>-Footnote-54950596 +Node: Windows<52>4950661 +Ref: whatsnew/changelog id5254950764 +Ref: 1a704950764 +Ref: Windows<52>-Footnote-14950905 +Node: macOS<42>4950970 +Ref: whatsnew/changelog id5264951072 +Ref: 1a714951072 +Ref: macOS<42>-Footnote-14951213 +Node: IDLE<42>4951278 +Ref: whatsnew/changelog id5274951384 +Ref: 1a724951384 +Ref: IDLE<42>-Footnote-14951974 +Ref: IDLE<42>-Footnote-24952039 +Node: Tools/Demos<28>4952104 +Ref: whatsnew/changelog id5284952192 +Ref: 1a734952192 +Ref: Tools/Demos<28>-Footnote-14952800 +Ref: Tools/Demos<28>-Footnote-24952865 +Ref: Tools/Demos<28>-Footnote-34952930 +Ref: Tools/Demos<28>-Footnote-44952995 +Node: Python 3 7 0 beta 34953060 +Ref: whatsnew/changelog python-3-7-0-beta-34953181 +Ref: 1a744953181 +Node: Security<39>4953560 +Ref: whatsnew/changelog id5294953658 +Ref: 1a754953658 +Ref: Security<39>-Footnote-14954290 +Ref: Security<39>-Footnote-24954355 +Ref: Security<39>-Footnote-34954410 +Ref: Security<39>-Footnote-44954475 +Ref: Security<39>-Footnote-54954540 +Ref: Security<39>-Footnote-64954595 +Node: Core and Builtins<61>4954650 +Ref: whatsnew/changelog id5304954768 +Ref: 1a764954768 +Ref: Core and Builtins<61>-Footnote-14955978 +Ref: Core and Builtins<61>-Footnote-24956043 +Ref: Core and Builtins<61>-Footnote-34956108 +Ref: Core and Builtins<61>-Footnote-44956173 +Ref: Core and Builtins<61>-Footnote-54956238 +Ref: Core and Builtins<61>-Footnote-64956303 +Ref: Core and Builtins<61>-Footnote-74956368 +Node: Library<61>4956433 +Ref: whatsnew/changelog id5314956556 +Ref: 1a774956556 +Ref: Library<61>-Footnote-14960611 +Ref: Library<61>-Footnote-24960676 +Ref: Library<61>-Footnote-34960741 +Ref: Library<61>-Footnote-44960806 +Ref: Library<61>-Footnote-54960871 +Ref: Library<61>-Footnote-64960936 +Ref: Library<61>-Footnote-74961001 +Ref: Library<61>-Footnote-84961066 +Ref: Library<61>-Footnote-94961131 +Ref: Library<61>-Footnote-104961196 +Ref: Library<61>-Footnote-114961262 +Ref: Library<61>-Footnote-124961328 +Ref: Library<61>-Footnote-134961394 +Ref: Library<61>-Footnote-144961460 +Ref: Library<61>-Footnote-154961526 +Ref: Library<61>-Footnote-164961592 +Ref: Library<61>-Footnote-174961658 +Ref: Library<61>-Footnote-184961724 +Ref: Library<61>-Footnote-194961790 +Ref: Library<61>-Footnote-204961856 +Ref: Library<61>-Footnote-214961922 +Ref: Library<61>-Footnote-224961988 +Ref: Library<61>-Footnote-234962054 +Ref: Library<61>-Footnote-244962120 +Ref: Library<61>-Footnote-254962186 +Ref: Library<61>-Footnote-264962252 +Ref: Library<61>-Footnote-274962318 +Node: Documentation<55>4962384 +Ref: whatsnew/changelog id5324962495 +Ref: 1a784962495 +Ref: Documentation<55>-Footnote-14963132 +Ref: Documentation<55>-Footnote-24963197 +Ref: Documentation<55>-Footnote-34963262 +Ref: Documentation<55>-Footnote-44963327 +Ref: Documentation<55>-Footnote-54963392 +Node: Tests<55>4963457 +Ref: whatsnew/changelog id5334963566 +Ref: 1a794963566 +Ref: Tests<55>-Footnote-14963899 +Ref: Tests<55>-Footnote-24963964 +Ref: Tests<55>-Footnote-34964029 +Node: Build<57>4964094 +Ref: whatsnew/changelog id5344964197 +Ref: 1a7a4964197 +Ref: Build<57>-Footnote-14964334 +Node: Windows<53>4964399 +Ref: whatsnew/changelog id5354964502 +Ref: 1a7b4964502 +Ref: Windows<53>-Footnote-14964781 +Ref: Windows<53>-Footnote-24964846 +Node: macOS<43>4964911 +Ref: whatsnew/changelog id5364965013 +Ref: 1a7c4965013 +Ref: macOS<43>-Footnote-14965445 +Node: IDLE<43>4965510 +Ref: whatsnew/changelog id5374965616 +Ref: 1a7d4965616 +Ref: IDLE<43>-Footnote-14966330 +Ref: IDLE<43>-Footnote-24966395 +Node: Tools/Demos<29>4966460 +Ref: whatsnew/changelog id5384966566 +Ref: 1a7e4966566 +Ref: Tools/Demos<29>-Footnote-14966796 +Node: C API<54>4966861 +Ref: whatsnew/changelog id5394966950 +Ref: 1a7f4966950 +Ref: C API<54>-Footnote-14967334 +Ref: C API<54>-Footnote-24967399 +Node: Python 3 7 0 beta 24967464 +Ref: whatsnew/changelog python-3-7-0-beta-24967585 +Ref: 1a804967585 +Node: Security<40>4967944 +Ref: whatsnew/changelog id5404968042 +Ref: 1a814968042 +Ref: Security<40>-Footnote-14968227 +Node: Core and Builtins<62>4968292 +Ref: whatsnew/changelog id5414968410 +Ref: 1a824968410 +Ref: Core and Builtins<62>-Footnote-14969241 +Ref: Core and Builtins<62>-Footnote-24969306 +Ref: Core and Builtins<62>-Footnote-34969371 +Ref: Core and Builtins<62>-Footnote-44969436 +Ref: Core and Builtins<62>-Footnote-54969501 +Ref: Core and Builtins<62>-Footnote-64969566 +Ref: Core and Builtins<62>-Footnote-74969631 +Node: Library<62>4969696 +Ref: whatsnew/changelog id5424969819 +Ref: 1a834969819 +Ref: Library<62>-Footnote-14976254 +Ref: Library<62>-Footnote-24976319 +Ref: Library<62>-Footnote-34976384 +Ref: Library<62>-Footnote-44976449 +Ref: Library<62>-Footnote-54976514 +Ref: Library<62>-Footnote-64976579 +Ref: Library<62>-Footnote-74976644 +Ref: Library<62>-Footnote-84976709 +Ref: Library<62>-Footnote-94976774 +Ref: Library<62>-Footnote-104976839 +Ref: Library<62>-Footnote-114976905 +Ref: Library<62>-Footnote-124976971 +Ref: Library<62>-Footnote-134977037 +Ref: Library<62>-Footnote-144977103 +Ref: Library<62>-Footnote-154977169 +Ref: Library<62>-Footnote-164977235 +Ref: Library<62>-Footnote-174977301 +Ref: Library<62>-Footnote-184977367 +Ref: Library<62>-Footnote-194977433 +Ref: Library<62>-Footnote-204977499 +Ref: Library<62>-Footnote-214977565 +Ref: Library<62>-Footnote-224977631 +Ref: Library<62>-Footnote-234977697 +Ref: Library<62>-Footnote-244977763 +Ref: Library<62>-Footnote-254977829 +Ref: Library<62>-Footnote-264977895 +Ref: Library<62>-Footnote-274977961 +Ref: Library<62>-Footnote-284978027 +Ref: Library<62>-Footnote-294978093 +Ref: Library<62>-Footnote-304978159 +Ref: Library<62>-Footnote-314978225 +Ref: Library<62>-Footnote-324978291 +Ref: Library<62>-Footnote-334978357 +Ref: Library<62>-Footnote-344978423 +Node: Documentation<56>4978489 +Ref: whatsnew/changelog id5434978600 +Ref: 1a844978600 +Ref: Documentation<56>-Footnote-14979551 +Ref: Documentation<56>-Footnote-24979616 +Ref: Documentation<56>-Footnote-34979681 +Ref: Documentation<56>-Footnote-44979746 +Ref: Documentation<56>-Footnote-54979811 +Ref: Documentation<56>-Footnote-64979876 +Ref: Documentation<56>-Footnote-74979940 +Ref: Documentation<56>-Footnote-84980005 +Node: Tests<56>4980070 +Ref: whatsnew/changelog id5444980179 +Ref: 1a854980179 +Ref: Tests<56>-Footnote-14980322 +Node: Build<58>4980387 +Ref: whatsnew/changelog id5454980490 +Ref: 1a864980490 +Ref: Build<58>-Footnote-14980631 +Node: Windows<54>4980696 +Ref: whatsnew/changelog id5464980799 +Ref: 1a874980799 +Ref: Windows<54>-Footnote-14981535 +Ref: Windows<54>-Footnote-24981600 +Ref: Windows<54>-Footnote-34981665 +Ref: Windows<54>-Footnote-44981730 +Ref: Windows<54>-Footnote-54981795 +Ref: Windows<54>-Footnote-64981860 +Node: macOS<44>4981925 +Ref: whatsnew/changelog id5474982027 +Ref: 1a884982027 +Ref: macOS<44>-Footnote-14982162 +Node: IDLE<44>4982227 +Ref: whatsnew/changelog id5484982333 +Ref: 1a894982333 +Ref: IDLE<44>-Footnote-14983180 +Ref: IDLE<44>-Footnote-24983245 +Ref: IDLE<44>-Footnote-34983310 +Ref: IDLE<44>-Footnote-44983375 +Ref: IDLE<44>-Footnote-54983440 +Ref: IDLE<44>-Footnote-64983505 +Node: Tools/Demos<30>4983570 +Ref: whatsnew/changelog id5494983658 +Ref: 1a8a4983658 +Ref: Tools/Demos<30>-Footnote-14983877 +Node: Python 3 7 0 beta 14983942 +Ref: whatsnew/changelog python-3-7-0-beta-14984064 +Ref: 1a8b4984064 +Node: Core and Builtins<63>4984367 +Ref: whatsnew/changelog id5504984464 +Ref: 1a8c4984464 +Ref: Core and Builtins<63>-Footnote-14987898 +Ref: Core and Builtins<63>-Footnote-24987963 +Ref: Core and Builtins<63>-Footnote-34988028 +Ref: Core and Builtins<63>-Footnote-44988093 +Ref: Core and Builtins<63>-Footnote-54988158 +Ref: Core and Builtins<63>-Footnote-64988223 +Ref: Core and Builtins<63>-Footnote-74988288 +Ref: Core and Builtins<63>-Footnote-84988353 +Ref: Core and Builtins<63>-Footnote-94988418 +Ref: Core and Builtins<63>-Footnote-104988460 +Ref: Core and Builtins<63>-Footnote-114988526 +Ref: Core and Builtins<63>-Footnote-124988592 +Ref: Core and Builtins<63>-Footnote-134988658 +Ref: Core and Builtins<63>-Footnote-144988724 +Ref: Core and Builtins<63>-Footnote-154988790 +Ref: Core and Builtins<63>-Footnote-164988856 +Ref: Core and Builtins<63>-Footnote-174988922 +Ref: Core and Builtins<63>-Footnote-184988988 +Ref: Core and Builtins<63>-Footnote-194989031 +Ref: Core and Builtins<63>-Footnote-204989097 +Ref: Core and Builtins<63>-Footnote-214989163 +Ref: Core and Builtins<63>-Footnote-224989229 +Ref: Core and Builtins<63>-Footnote-234989295 +Node: Library<63>4989361 +Ref: whatsnew/changelog id5514989484 +Ref: 1a8d4989484 +Ref: Library<63>-Footnote-14996866 +Ref: Library<63>-Footnote-24996931 +Ref: Library<63>-Footnote-34996996 +Ref: Library<63>-Footnote-44997061 +Ref: Library<63>-Footnote-54997126 +Ref: Library<63>-Footnote-64997191 +Ref: Library<63>-Footnote-74997256 +Ref: Library<63>-Footnote-84997321 +Ref: Library<63>-Footnote-94997386 +Ref: Library<63>-Footnote-104997451 +Ref: Library<63>-Footnote-114997517 +Ref: Library<63>-Footnote-124997583 +Ref: Library<63>-Footnote-134997649 +Ref: Library<63>-Footnote-144997715 +Ref: Library<63>-Footnote-154997781 +Ref: Library<63>-Footnote-164997847 +Ref: Library<63>-Footnote-174997913 +Ref: Library<63>-Footnote-184997979 +Ref: Library<63>-Footnote-194998022 +Ref: Library<63>-Footnote-204998088 +Ref: Library<63>-Footnote-214998154 +Ref: Library<63>-Footnote-224998220 +Ref: Library<63>-Footnote-234998286 +Ref: Library<63>-Footnote-244998352 +Ref: Library<63>-Footnote-254998418 +Ref: Library<63>-Footnote-264998484 +Ref: Library<63>-Footnote-274998550 +Ref: Library<63>-Footnote-284998616 +Ref: Library<63>-Footnote-294998682 +Ref: Library<63>-Footnote-304998748 +Ref: Library<63>-Footnote-314998814 +Ref: Library<63>-Footnote-324998880 +Ref: Library<63>-Footnote-334998946 +Ref: Library<63>-Footnote-344999012 +Ref: Library<63>-Footnote-354999078 +Ref: Library<63>-Footnote-364999144 +Ref: Library<63>-Footnote-374999210 +Ref: Library<63>-Footnote-384999276 +Ref: Library<63>-Footnote-394999342 +Ref: Library<63>-Footnote-404999408 +Ref: Library<63>-Footnote-414999474 +Ref: Library<63>-Footnote-424999540 +Ref: Library<63>-Footnote-434999606 +Ref: Library<63>-Footnote-444999672 +Ref: Library<63>-Footnote-454999738 +Ref: Library<63>-Footnote-464999804 +Ref: Library<63>-Footnote-474999870 +Node: Documentation<57>4999936 +Ref: whatsnew/changelog id5525000047 +Ref: 1a8e5000047 +Ref: Documentation<57>-Footnote-15000588 +Ref: Documentation<57>-Footnote-25000653 +Ref: Documentation<57>-Footnote-35000718 +Node: Tests<57>5000783 +Ref: whatsnew/changelog id5535000892 +Ref: 1a8f5000892 +Ref: Tests<57>-Footnote-15001804 +Ref: Tests<57>-Footnote-25001869 +Ref: Tests<57>-Footnote-35001934 +Ref: Tests<57>-Footnote-45001999 +Ref: Tests<57>-Footnote-55002064 +Ref: Tests<57>-Footnote-65002129 +Node: Build<59>5002194 +Ref: whatsnew/changelog id5545002297 +Ref: 1a905002297 +Ref: Build<59>-Footnote-15002900 +Ref: Build<59>-Footnote-25002965 +Ref: Build<59>-Footnote-35003030 +Ref: Build<59>-Footnote-45003095 +Node: Windows<55>5003160 +Ref: whatsnew/changelog id5555003263 +Ref: 1a915003263 +Ref: Windows<55>-Footnote-15003644 +Ref: Windows<55>-Footnote-25003709 +Ref: Windows<55>-Footnote-35003774 +Node: macOS<45>5003839 +Ref: whatsnew/changelog id5565003942 +Ref: 1a925003942 +Ref: macOS<45>-Footnote-15004464 +Ref: macOS<45>-Footnote-25004529 +Node: C API<55>5004594 +Ref: whatsnew/changelog id5575004677 +Ref: 1a935004677 +Ref: C API<55>-Footnote-15004998 +Ref: C API<55>-Footnote-25005063 +Node: Python 3 7 0 alpha 45005128 +Ref: whatsnew/changelog python-3-7-0-alpha-45005251 +Ref: 1a945005251 +Node: Core and Builtins<64>5005548 +Ref: whatsnew/changelog id5585005646 +Ref: 1a955005646 +Ref: Core and Builtins<64>-Footnote-15009153 +Ref: Core and Builtins<64>-Footnote-25009218 +Ref: Core and Builtins<64>-Footnote-35009283 +Ref: Core and Builtins<64>-Footnote-45009348 +Ref: Core and Builtins<64>-Footnote-55009413 +Ref: Core and Builtins<64>-Footnote-65009478 +Ref: Core and Builtins<64>-Footnote-75009543 +Ref: Core and Builtins<64>-Footnote-85009608 +Ref: Core and Builtins<64>-Footnote-95009673 +Ref: Core and Builtins<64>-Footnote-105009738 +Ref: Core and Builtins<64>-Footnote-115009804 +Ref: Core and Builtins<64>-Footnote-125009870 +Ref: Core and Builtins<64>-Footnote-135009936 +Ref: Core and Builtins<64>-Footnote-145010002 +Ref: Core and Builtins<64>-Footnote-155010068 +Ref: Core and Builtins<64>-Footnote-165010134 +Ref: Core and Builtins<64>-Footnote-175010200 +Ref: Core and Builtins<64>-Footnote-185010266 +Ref: Core and Builtins<64>-Footnote-195010332 +Ref: Core and Builtins<64>-Footnote-205010375 +Ref: Core and Builtins<64>-Footnote-215010441 +Ref: Core and Builtins<64>-Footnote-225010484 +Ref: Core and Builtins<64>-Footnote-235010550 +Ref: Core and Builtins<64>-Footnote-245010593 +Ref: Core and Builtins<64>-Footnote-255010659 +Ref: Core and Builtins<64>-Footnote-265010725 +Ref: Core and Builtins<64>-Footnote-275010768 +Node: Library<64>5010834 +Ref: whatsnew/changelog id5595010958 +Ref: 1a975010958 +Ref: Library<64>-Footnote-15018976 +Ref: Library<64>-Footnote-25019041 +Ref: Library<64>-Footnote-35019106 +Ref: Library<64>-Footnote-45019171 +Ref: Library<64>-Footnote-55019236 +Ref: Library<64>-Footnote-65019301 +Ref: Library<64>-Footnote-75019366 +Ref: Library<64>-Footnote-85019431 +Ref: Library<64>-Footnote-95019496 +Ref: Library<64>-Footnote-105019561 +Ref: Library<64>-Footnote-115019627 +Ref: Library<64>-Footnote-125019693 +Ref: Library<64>-Footnote-135019759 +Ref: Library<64>-Footnote-145019825 +Ref: Library<64>-Footnote-155019891 +Ref: Library<64>-Footnote-165019957 +Ref: Library<64>-Footnote-175020023 +Ref: Library<64>-Footnote-185020089 +Ref: Library<64>-Footnote-195020155 +Ref: Library<64>-Footnote-205020221 +Ref: Library<64>-Footnote-215020287 +Ref: Library<64>-Footnote-225020353 +Ref: Library<64>-Footnote-235020419 +Ref: Library<64>-Footnote-245020485 +Ref: Library<64>-Footnote-255020551 +Ref: Library<64>-Footnote-265020617 +Ref: Library<64>-Footnote-275020683 +Ref: Library<64>-Footnote-285020749 +Ref: Library<64>-Footnote-295020815 +Ref: Library<64>-Footnote-305020881 +Ref: Library<64>-Footnote-315020947 +Ref: Library<64>-Footnote-325021013 +Ref: Library<64>-Footnote-335021079 +Ref: Library<64>-Footnote-345021145 +Ref: Library<64>-Footnote-355021211 +Ref: Library<64>-Footnote-365021277 +Ref: Library<64>-Footnote-375021343 +Ref: Library<64>-Footnote-385021409 +Ref: Library<64>-Footnote-395021475 +Ref: Library<64>-Footnote-405021541 +Ref: Library<64>-Footnote-415021607 +Ref: Library<64>-Footnote-425021673 +Ref: Library<64>-Footnote-435021739 +Ref: Library<64>-Footnote-445021805 +Ref: Library<64>-Footnote-455021871 +Ref: Library<64>-Footnote-465021937 +Ref: Library<64>-Footnote-475022003 +Ref: Library<64>-Footnote-485022069 +Ref: Library<64>-Footnote-495022135 +Ref: Library<64>-Footnote-505022201 +Ref: Library<64>-Footnote-515022267 +Ref: Library<64>-Footnote-525022333 +Ref: Library<64>-Footnote-535022399 +Ref: Library<64>-Footnote-545022465 +Node: Documentation<58>5022531 +Ref: whatsnew/changelog id5605022643 +Ref: 1a985022643 +Ref: Documentation<58>-Footnote-15022813 +Node: Tests<58>5022878 +Ref: whatsnew/changelog id5615022990 +Ref: 1a995022990 +Ref: Tests<58>-Footnote-15023385 +Ref: Tests<58>-Footnote-25023450 +Node: Windows<56>5023515 +Ref: whatsnew/changelog id5625023625 +Ref: 1a9a5023625 +Ref: Windows<56>-Footnote-15023824 +Node: Tools/Demos<31>5023889 +Ref: whatsnew/changelog id5635023999 +Ref: 1a9b5023999 +Ref: Tools/Demos<31>-Footnote-15024281 +Node: C API<56>5024346 +Ref: whatsnew/changelog id5645024436 +Ref: 1a9c5024436 +Ref: C API<56>-Footnote-15025080 +Ref: C API<56>-Footnote-25025145 +Ref: C API<56>-Footnote-35025210 +Ref: C API<56>-Footnote-45025275 +Node: Python 3 7 0 alpha 35025340 +Ref: whatsnew/changelog python-3-7-0-alpha-35025464 +Ref: 1a9d5025464 +Node: Core and Builtins<65>5025819 +Ref: whatsnew/changelog id5655025917 +Ref: 1a9e5025917 +Ref: Core and Builtins<65>-Footnote-15031052 +Ref: Core and Builtins<65>-Footnote-25031117 +Ref: Core and Builtins<65>-Footnote-35031182 +Ref: Core and Builtins<65>-Footnote-45031247 +Ref: Core and Builtins<65>-Footnote-55031312 +Ref: Core and Builtins<65>-Footnote-65031377 +Ref: Core and Builtins<65>-Footnote-75031442 +Ref: Core and Builtins<65>-Footnote-85031507 +Ref: Core and Builtins<65>-Footnote-95031572 +Ref: Core and Builtins<65>-Footnote-105031637 +Ref: Core and Builtins<65>-Footnote-115031703 +Ref: Core and Builtins<65>-Footnote-125031769 +Ref: Core and Builtins<65>-Footnote-135031835 +Ref: Core and Builtins<65>-Footnote-145031901 +Ref: Core and Builtins<65>-Footnote-155031967 +Ref: Core and Builtins<65>-Footnote-165032033 +Ref: Core and Builtins<65>-Footnote-175032099 +Ref: Core and Builtins<65>-Footnote-185032165 +Ref: Core and Builtins<65>-Footnote-195032231 +Ref: Core and Builtins<65>-Footnote-205032297 +Ref: Core and Builtins<65>-Footnote-215032363 +Ref: Core and Builtins<65>-Footnote-225032429 +Node: Library<65>5032495 +Ref: whatsnew/changelog id5665032619 +Ref: 1a9f5032619 +Ref: Library<65>-Footnote-15048675 +Ref: Library<65>-Footnote-25048740 +Ref: Library<65>-Footnote-35048805 +Ref: Library<65>-Footnote-45048870 +Ref: Library<65>-Footnote-55048935 +Ref: Library<65>-Footnote-65049000 +Ref: Library<65>-Footnote-75049065 +Ref: Library<65>-Footnote-85049130 +Ref: Library<65>-Footnote-95049195 +Ref: Library<65>-Footnote-105049260 +Ref: Library<65>-Footnote-115049326 +Ref: Library<65>-Footnote-125049392 +Ref: Library<65>-Footnote-135049458 +Ref: Library<65>-Footnote-145049524 +Ref: Library<65>-Footnote-155049590 +Ref: Library<65>-Footnote-165049656 +Ref: Library<65>-Footnote-175049722 +Ref: Library<65>-Footnote-185049788 +Ref: Library<65>-Footnote-195049854 +Ref: Library<65>-Footnote-205049920 +Ref: Library<65>-Footnote-215049986 +Ref: Library<65>-Footnote-225050052 +Ref: Library<65>-Footnote-235050118 +Ref: Library<65>-Footnote-245050184 +Ref: Library<65>-Footnote-255050250 +Ref: Library<65>-Footnote-265050318 +Ref: Library<65>-Footnote-275050384 +Ref: Library<65>-Footnote-285050450 +Ref: Library<65>-Footnote-295050516 +Ref: Library<65>-Footnote-305050582 +Ref: Library<65>-Footnote-315050648 +Ref: Library<65>-Footnote-325050714 +Ref: Library<65>-Footnote-335050757 +Ref: Library<65>-Footnote-345050823 +Ref: Library<65>-Footnote-355050889 +Ref: Library<65>-Footnote-365050955 +Ref: Library<65>-Footnote-375051021 +Ref: Library<65>-Footnote-385051087 +Ref: Library<65>-Footnote-395051153 +Ref: Library<65>-Footnote-405051219 +Ref: Library<65>-Footnote-415051285 +Ref: Library<65>-Footnote-425051351 +Ref: Library<65>-Footnote-435051417 +Ref: Library<65>-Footnote-445051483 +Ref: Library<65>-Footnote-455051549 +Ref: Library<65>-Footnote-465051615 +Ref: Library<65>-Footnote-475051680 +Ref: Library<65>-Footnote-485051746 +Ref: Library<65>-Footnote-495051812 +Ref: Library<65>-Footnote-505051878 +Ref: Library<65>-Footnote-515051944 +Ref: Library<65>-Footnote-525052010 +Ref: Library<65>-Footnote-535052076 +Ref: Library<65>-Footnote-545052142 +Ref: Library<65>-Footnote-555052208 +Ref: Library<65>-Footnote-565052274 +Ref: Library<65>-Footnote-575052340 +Ref: Library<65>-Footnote-585052406 +Ref: Library<65>-Footnote-595052472 +Ref: Library<65>-Footnote-605052538 +Ref: Library<65>-Footnote-615052604 +Ref: Library<65>-Footnote-625052670 +Ref: Library<65>-Footnote-635052713 +Ref: Library<65>-Footnote-645052779 +Ref: Library<65>-Footnote-655052845 +Ref: Library<65>-Footnote-665052911 +Ref: Library<65>-Footnote-675052977 +Ref: Library<65>-Footnote-685053043 +Ref: Library<65>-Footnote-695053109 +Ref: Library<65>-Footnote-705053175 +Ref: Library<65>-Footnote-715053241 +Ref: Library<65>-Footnote-725053307 +Ref: Library<65>-Footnote-735053373 +Ref: Library<65>-Footnote-745053439 +Ref: Library<65>-Footnote-755053505 +Ref: Library<65>-Footnote-765053571 +Ref: Library<65>-Footnote-775053637 +Ref: Library<65>-Footnote-785053703 +Ref: Library<65>-Footnote-795053769 +Ref: Library<65>-Footnote-805053835 +Ref: Library<65>-Footnote-815053901 +Ref: Library<65>-Footnote-825053967 +Ref: Library<65>-Footnote-835054010 +Ref: Library<65>-Footnote-845054076 +Ref: Library<65>-Footnote-855054142 +Ref: Library<65>-Footnote-865054208 +Ref: Library<65>-Footnote-875054274 +Ref: Library<65>-Footnote-885054340 +Ref: Library<65>-Footnote-895054406 +Ref: Library<65>-Footnote-905054472 +Ref: Library<65>-Footnote-915054538 +Ref: Library<65>-Footnote-925054604 +Ref: Library<65>-Footnote-935054670 +Ref: Library<65>-Footnote-945054736 +Ref: Library<65>-Footnote-955054802 +Ref: Library<65>-Footnote-965054868 +Ref: Library<65>-Footnote-975054934 +Ref: Library<65>-Footnote-985055000 +Node: Documentation<59>5055066 +Ref: whatsnew/changelog id5675055178 +Ref: 1aa45055178 +Ref: Documentation<59>-Footnote-15055361 +Node: Tests<59>5055426 +Ref: whatsnew/changelog id5685055536 +Ref: 1aa55055536 +Ref: Tests<59>-Footnote-15056746 +Ref: Tests<59>-Footnote-25056811 +Ref: Tests<59>-Footnote-35056876 +Ref: Tests<59>-Footnote-45056941 +Ref: Tests<59>-Footnote-55057006 +Ref: Tests<59>-Footnote-65057071 +Ref: Tests<59>-Footnote-75057136 +Node: Build<60>5057201 +Ref: whatsnew/changelog id5695057305 +Ref: 1aa65057305 +Ref: Build<60>-Footnote-15058519 +Ref: Build<60>-Footnote-25058584 +Ref: Build<60>-Footnote-35058649 +Ref: Build<60>-Footnote-45058714 +Ref: Build<60>-Footnote-55058779 +Ref: Build<60>-Footnote-65058844 +Ref: Build<60>-Footnote-75058909 +Ref: Build<60>-Footnote-85058974 +Ref: Build<60>-Footnote-95059039 +Ref: Build<60>-Footnote-105059104 +Ref: Build<60>-Footnote-115059170 +Ref: Build<60>-Footnote-125059236 +Node: Windows<57>5059302 +Ref: whatsnew/changelog id5705059406 +Ref: 1aa75059406 +Ref: Windows<57>-Footnote-15059939 +Ref: Windows<57>-Footnote-25060003 +Ref: Windows<57>-Footnote-35060068 +Ref: Windows<57>-Footnote-45060133 +Node: macOS<46>5060198 +Ref: whatsnew/changelog id5715060301 +Ref: 1aa85060301 +Ref: macOS<46>-Footnote-15060435 +Node: IDLE<45>5060500 +Ref: whatsnew/changelog id5725060607 +Ref: 1aa95060607 +Ref: IDLE<45>-Footnote-15062700 +Ref: IDLE<45>-Footnote-25062765 +Ref: IDLE<45>-Footnote-35062830 +Ref: IDLE<45>-Footnote-45062895 +Ref: IDLE<45>-Footnote-55062960 +Ref: IDLE<45>-Footnote-65063025 +Ref: IDLE<45>-Footnote-75063090 +Ref: IDLE<45>-Footnote-85063155 +Node: Tools/Demos<32>5063220 +Ref: whatsnew/changelog id5735063327 +Ref: 1aaa5063327 +Ref: Tools/Demos<32>-Footnote-15063859 +Ref: Tools/Demos<32>-Footnote-25063924 +Node: C API<57>5063989 +Ref: whatsnew/changelog id5745064079 +Ref: 1aab5064079 +Ref: C API<57>-Footnote-15065207 +Ref: C API<57>-Footnote-25065272 +Ref: C API<57>-Footnote-35065337 +Ref: C API<57>-Footnote-45065402 +Ref: C API<57>-Footnote-55065467 +Ref: C API<57>-Footnote-65065532 +Node: Python 3 7 0 alpha 25065597 +Ref: whatsnew/changelog python-3-7-0-alpha-25065721 +Ref: 1aac5065721 +Node: Core and Builtins<66>5065980 +Ref: whatsnew/changelog id5755066078 +Ref: 1aad5066078 +Ref: Core and Builtins<66>-Footnote-15070271 +Ref: Core and Builtins<66>-Footnote-25070336 +Ref: Core and Builtins<66>-Footnote-35070401 +Ref: Core and Builtins<66>-Footnote-45070466 +Ref: Core and Builtins<66>-Footnote-55070531 +Ref: Core and Builtins<66>-Footnote-65070596 +Ref: Core and Builtins<66>-Footnote-75070661 +Ref: Core and Builtins<66>-Footnote-85070726 +Ref: Core and Builtins<66>-Footnote-95070791 +Ref: Core and Builtins<66>-Footnote-105070856 +Ref: Core and Builtins<66>-Footnote-115070922 +Ref: Core and Builtins<66>-Footnote-125070988 +Ref: Core and Builtins<66>-Footnote-135071054 +Ref: Core and Builtins<66>-Footnote-145071120 +Ref: Core and Builtins<66>-Footnote-155071186 +Ref: Core and Builtins<66>-Footnote-165071252 +Ref: Core and Builtins<66>-Footnote-175071318 +Ref: Core and Builtins<66>-Footnote-185071384 +Ref: Core and Builtins<66>-Footnote-195071450 +Ref: Core and Builtins<66>-Footnote-205071516 +Ref: Core and Builtins<66>-Footnote-215071559 +Ref: Core and Builtins<66>-Footnote-225071625 +Ref: Core and Builtins<66>-Footnote-235071691 +Ref: Core and Builtins<66>-Footnote-245071757 +Ref: Core and Builtins<66>-Footnote-255071823 +Ref: Core and Builtins<66>-Footnote-265071889 +Ref: Core and Builtins<66>-Footnote-275071955 +Node: Library<66>5071998 +Ref: whatsnew/changelog id5765072122 +Ref: 1aae5072122 +Ref: Library<66>-Footnote-15076189 +Ref: Library<66>-Footnote-25076254 +Ref: Library<66>-Footnote-35076319 +Ref: Library<66>-Footnote-45076384 +Ref: Library<66>-Footnote-55076449 +Ref: Library<66>-Footnote-65076514 +Ref: Library<66>-Footnote-75076579 +Ref: Library<66>-Footnote-85076644 +Ref: Library<66>-Footnote-95076709 +Ref: Library<66>-Footnote-105076774 +Ref: Library<66>-Footnote-115076840 +Ref: Library<66>-Footnote-125076906 +Ref: Library<66>-Footnote-135076972 +Ref: Library<66>-Footnote-145077038 +Ref: Library<66>-Footnote-155077104 +Ref: Library<66>-Footnote-165077170 +Ref: Library<66>-Footnote-175077236 +Ref: Library<66>-Footnote-185077302 +Ref: Library<66>-Footnote-195077368 +Ref: Library<66>-Footnote-205077434 +Ref: Library<66>-Footnote-215077500 +Ref: Library<66>-Footnote-225077566 +Ref: Library<66>-Footnote-235077632 +Ref: Library<66>-Footnote-245077698 +Ref: Library<66>-Footnote-255077764 +Ref: Library<66>-Footnote-265077830 +Node: Documentation<60>5077896 +Ref: whatsnew/changelog id5775078008 +Ref: 1aaf5078008 +Ref: Documentation<60>-Footnote-15078399 +Ref: Documentation<60>-Footnote-25078464 +Node: Build<61>5078529 +Ref: whatsnew/changelog id5785078638 +Ref: 1ab05078638 +Ref: Build<61>-Footnote-15079265 +Ref: Build<61>-Footnote-25079330 +Ref: Build<61>-Footnote-35079395 +Ref: Build<61>-Footnote-45079460 +Ref: Build<61>-Footnote-55079525 +Ref: Build<61>-Footnote-65079590 +Node: IDLE<46>5079655 +Ref: whatsnew/changelog id5795079756 +Ref: 1ab15079756 +Ref: IDLE<46>-Footnote-15081062 +Ref: IDLE<46>-Footnote-25081127 +Ref: IDLE<46>-Footnote-35081192 +Ref: IDLE<46>-Footnote-45081257 +Ref: IDLE<46>-Footnote-55081322 +Ref: IDLE<46>-Footnote-65081387 +Node: C API<58>5081454 +Ref: whatsnew/changelog id5805081537 +Ref: 1ab25081537 +Ref: C API<58>-Footnote-15082261 +Ref: C API<58>-Footnote-25082326 +Ref: C API<58>-Footnote-35082391 +Ref: C API<58>-Footnote-45082456 +Node: Python 3 7 0 alpha 15082498 +Ref: whatsnew/changelog python-3-7-0-alpha-15082620 +Ref: 1ab35082620 +Node: Security<41>5082981 +Ref: whatsnew/changelog id5815083080 +Ref: 1ab45083080 +Ref: Security<41>-Footnote-15084734 +Ref: Security<41>-Footnote-25084799 +Ref: Security<41>-Footnote-35084864 +Ref: Security<41>-Footnote-45084929 +Ref: Security<41>-Footnote-55084994 +Ref: Security<41>-Footnote-65085059 +Ref: Security<41>-Footnote-75085114 +Ref: Security<41>-Footnote-85085169 +Ref: Security<41>-Footnote-95085224 +Ref: Security<41>-Footnote-105085279 +Ref: Security<41>-Footnote-115085335 +Ref: Security<41>-Footnote-125085391 +Ref: Security<41>-Footnote-135085457 +Ref: Security<41>-Footnote-145085523 +Ref: Security<41>-Footnote-155085579 +Node: Core and Builtins<67>5085635 +Ref: whatsnew/changelog id5825085754 +Ref: 1ab55085754 +Ref: Core and Builtins<67>-Footnote-15106658 +Ref: Core and Builtins<67>-Footnote-25106723 +Ref: Core and Builtins<67>-Footnote-35106788 +Ref: Core and Builtins<67>-Footnote-45106853 +Ref: Core and Builtins<67>-Footnote-55106918 +Ref: Core and Builtins<67>-Footnote-65106983 +Ref: Core and Builtins<67>-Footnote-75107048 +Ref: Core and Builtins<67>-Footnote-85107113 +Ref: Core and Builtins<67>-Footnote-95107178 +Ref: Core and Builtins<67>-Footnote-105107243 +Ref: Core and Builtins<67>-Footnote-115107309 +Ref: Core and Builtins<67>-Footnote-125107375 +Ref: Core and Builtins<67>-Footnote-135107441 +Ref: Core and Builtins<67>-Footnote-145107507 +Ref: Core and Builtins<67>-Footnote-155107573 +Ref: Core and Builtins<67>-Footnote-165107639 +Ref: Core and Builtins<67>-Footnote-175107705 +Ref: Core and Builtins<67>-Footnote-185107771 +Ref: Core and Builtins<67>-Footnote-195107837 +Ref: Core and Builtins<67>-Footnote-205107903 +Ref: Core and Builtins<67>-Footnote-215107969 +Ref: Core and Builtins<67>-Footnote-225108035 +Ref: Core and Builtins<67>-Footnote-235108101 +Ref: Core and Builtins<67>-Footnote-245108167 +Ref: Core and Builtins<67>-Footnote-255108233 +Ref: Core and Builtins<67>-Footnote-265108299 +Ref: Core and Builtins<67>-Footnote-275108365 +Ref: Core and Builtins<67>-Footnote-285108431 +Ref: Core and Builtins<67>-Footnote-295108497 +Ref: Core and Builtins<67>-Footnote-305108563 +Ref: Core and Builtins<67>-Footnote-315108629 +Ref: Core and Builtins<67>-Footnote-325108695 +Ref: Core and Builtins<67>-Footnote-335108761 +Ref: Core and Builtins<67>-Footnote-345108827 +Ref: Core and Builtins<67>-Footnote-355108893 +Ref: Core and Builtins<67>-Footnote-365108936 +Ref: Core and Builtins<67>-Footnote-375109002 +Ref: Core and Builtins<67>-Footnote-385109068 +Ref: Core and Builtins<67>-Footnote-395109134 +Ref: Core and Builtins<67>-Footnote-405109200 +Ref: Core and Builtins<67>-Footnote-415109266 +Ref: Core and Builtins<67>-Footnote-425109332 +Ref: Core and Builtins<67>-Footnote-435109398 +Ref: Core and Builtins<67>-Footnote-445109464 +Ref: Core and Builtins<67>-Footnote-455109530 +Ref: Core and Builtins<67>-Footnote-465109596 +Ref: Core and Builtins<67>-Footnote-475109662 +Ref: Core and Builtins<67>-Footnote-485109728 +Ref: Core and Builtins<67>-Footnote-495109794 +Ref: Core and Builtins<67>-Footnote-505109860 +Ref: Core and Builtins<67>-Footnote-515109926 +Ref: Core and Builtins<67>-Footnote-525109992 +Ref: Core and Builtins<67>-Footnote-535110058 +Ref: Core and Builtins<67>-Footnote-545110124 +Ref: Core and Builtins<67>-Footnote-555110190 +Ref: Core and Builtins<67>-Footnote-565110256 +Ref: Core and Builtins<67>-Footnote-575110322 +Ref: Core and Builtins<67>-Footnote-585110388 +Ref: Core and Builtins<67>-Footnote-595110454 +Ref: Core and Builtins<67>-Footnote-605110520 +Ref: Core and Builtins<67>-Footnote-615110586 +Ref: Core and Builtins<67>-Footnote-625110652 +Ref: Core and Builtins<67>-Footnote-635110718 +Ref: Core and Builtins<67>-Footnote-645110784 +Ref: Core and Builtins<67>-Footnote-655110850 +Ref: Core and Builtins<67>-Footnote-665110916 +Ref: Core and Builtins<67>-Footnote-675110982 +Ref: Core and Builtins<67>-Footnote-685111048 +Ref: Core and Builtins<67>-Footnote-695111114 +Ref: Core and Builtins<67>-Footnote-705111180 +Ref: Core and Builtins<67>-Footnote-715111246 +Ref: Core and Builtins<67>-Footnote-725111312 +Ref: Core and Builtins<67>-Footnote-735111378 +Ref: Core and Builtins<67>-Footnote-745111444 +Ref: Core and Builtins<67>-Footnote-755111510 +Ref: Core and Builtins<67>-Footnote-765111576 +Ref: Core and Builtins<67>-Footnote-775111642 +Ref: Core and Builtins<67>-Footnote-785111708 +Ref: Core and Builtins<67>-Footnote-795111774 +Ref: Core and Builtins<67>-Footnote-805111840 +Ref: Core and Builtins<67>-Footnote-815111906 +Ref: Core and Builtins<67>-Footnote-825111972 +Ref: Core and Builtins<67>-Footnote-835112038 +Ref: Core and Builtins<67>-Footnote-845112104 +Ref: Core and Builtins<67>-Footnote-855112170 +Ref: Core and Builtins<67>-Footnote-865112236 +Ref: Core and Builtins<67>-Footnote-875112302 +Ref: Core and Builtins<67>-Footnote-885112368 +Ref: Core and Builtins<67>-Footnote-895112434 +Ref: Core and Builtins<67>-Footnote-905112500 +Ref: Core and Builtins<67>-Footnote-915112543 +Ref: Core and Builtins<67>-Footnote-925112609 +Ref: Core and Builtins<67>-Footnote-935112675 +Ref: Core and Builtins<67>-Footnote-945112741 +Ref: Core and Builtins<67>-Footnote-955112807 +Ref: Core and Builtins<67>-Footnote-965112873 +Ref: Core and Builtins<67>-Footnote-975112939 +Ref: Core and Builtins<67>-Footnote-985113005 +Ref: Core and Builtins<67>-Footnote-995113071 +Ref: Core and Builtins<67>-Footnote-1005113137 +Ref: Core and Builtins<67>-Footnote-1015113204 +Ref: Core and Builtins<67>-Footnote-1025113271 +Ref: Core and Builtins<67>-Footnote-1035113338 +Ref: Core and Builtins<67>-Footnote-1045113405 +Ref: Core and Builtins<67>-Footnote-1055113472 +Ref: Core and Builtins<67>-Footnote-1065113539 +Ref: Core and Builtins<67>-Footnote-1075113606 +Ref: Core and Builtins<67>-Footnote-1085113673 +Ref: Core and Builtins<67>-Footnote-1095113740 +Ref: Core and Builtins<67>-Footnote-1105113807 +Ref: Core and Builtins<67>-Footnote-1115113874 +Ref: Core and Builtins<67>-Footnote-1125113941 +Ref: Core and Builtins<67>-Footnote-1135114008 +Ref: Core and Builtins<67>-Footnote-1145114075 +Ref: Core and Builtins<67>-Footnote-1155114142 +Ref: Core and Builtins<67>-Footnote-1165114209 +Ref: Core and Builtins<67>-Footnote-1175114276 +Ref: Core and Builtins<67>-Footnote-1185114343 +Ref: Core and Builtins<67>-Footnote-1195114410 +Ref: Core and Builtins<67>-Footnote-1205114477 +Ref: Core and Builtins<67>-Footnote-1215114544 +Ref: Core and Builtins<67>-Footnote-1225114611 +Ref: Core and Builtins<67>-Footnote-1235114678 +Ref: Core and Builtins<67>-Footnote-1245114745 +Ref: Core and Builtins<67>-Footnote-1255114812 +Ref: Core and Builtins<67>-Footnote-1265114879 +Ref: Core and Builtins<67>-Footnote-1275114946 +Ref: Core and Builtins<67>-Footnote-1285115013 +Ref: Core and Builtins<67>-Footnote-1295115080 +Ref: Core and Builtins<67>-Footnote-1305115147 +Ref: Core and Builtins<67>-Footnote-1315115214 +Ref: Core and Builtins<67>-Footnote-1325115281 +Ref: Core and Builtins<67>-Footnote-1335115348 +Ref: Core and Builtins<67>-Footnote-1345115415 +Ref: Core and Builtins<67>-Footnote-1355115482 +Ref: Core and Builtins<67>-Footnote-1365115549 +Ref: Core and Builtins<67>-Footnote-1375115616 +Ref: Core and Builtins<67>-Footnote-1385115683 +Ref: Core and Builtins<67>-Footnote-1395115750 +Ref: Core and Builtins<67>-Footnote-1405115817 +Ref: Core and Builtins<67>-Footnote-1415115884 +Ref: Core and Builtins<67>-Footnote-1425115951 +Ref: Core and Builtins<67>-Footnote-1435116018 +Ref: Core and Builtins<67>-Footnote-1445116085 +Ref: Core and Builtins<67>-Footnote-1455116152 +Ref: Core and Builtins<67>-Footnote-1465116219 +Ref: Core and Builtins<67>-Footnote-1475116286 +Ref: Core and Builtins<67>-Footnote-1485116353 +Node: Library<67>5116420 +Ref: whatsnew/changelog id5835116544 +Ref: 1ab65116544 +Ref: Library<67>-Footnote-15163200 +Ref: Library<67>-Footnote-25163265 +Ref: Library<67>-Footnote-35163330 +Ref: Library<67>-Footnote-45163395 +Ref: Library<67>-Footnote-55163460 +Ref: Library<67>-Footnote-65163525 +Ref: Library<67>-Footnote-75163590 +Ref: Library<67>-Footnote-85163655 +Ref: Library<67>-Footnote-95163720 +Ref: Library<67>-Footnote-105163785 +Ref: Library<67>-Footnote-115163851 +Ref: Library<67>-Footnote-125163917 +Ref: Library<67>-Footnote-135163983 +Ref: Library<67>-Footnote-145164049 +Ref: Library<67>-Footnote-155164115 +Ref: Library<67>-Footnote-165164181 +Ref: Library<67>-Footnote-175164247 +Ref: Library<67>-Footnote-185164313 +Ref: Library<67>-Footnote-195164379 +Ref: Library<67>-Footnote-205164445 +Ref: Library<67>-Footnote-215164511 +Ref: Library<67>-Footnote-225164579 +Ref: Library<67>-Footnote-235164645 +Ref: Library<67>-Footnote-245164711 +Ref: Library<67>-Footnote-255164777 +Ref: Library<67>-Footnote-265164843 +Ref: Library<67>-Footnote-275164886 +Ref: Library<67>-Footnote-285164952 +Ref: Library<67>-Footnote-295165018 +Ref: Library<67>-Footnote-305165084 +Ref: Library<67>-Footnote-315165150 +Ref: Library<67>-Footnote-325165216 +Ref: Library<67>-Footnote-335165282 +Ref: Library<67>-Footnote-345165348 +Ref: Library<67>-Footnote-355165413 +Ref: Library<67>-Footnote-365165479 +Ref: Library<67>-Footnote-375165545 +Ref: Library<67>-Footnote-385165611 +Ref: Library<67>-Footnote-395165677 +Ref: Library<67>-Footnote-405165742 +Ref: Library<67>-Footnote-415165808 +Ref: Library<67>-Footnote-425165874 +Ref: Library<67>-Footnote-435165940 +Ref: Library<67>-Footnote-445166006 +Ref: Library<67>-Footnote-455166072 +Ref: Library<67>-Footnote-465166138 +Ref: Library<67>-Footnote-475166204 +Ref: Library<67>-Footnote-485166270 +Ref: Library<67>-Footnote-495166336 +Ref: Library<67>-Footnote-505166402 +Ref: Library<67>-Footnote-515166468 +Ref: Library<67>-Footnote-525166534 +Ref: Library<67>-Footnote-535166599 +Ref: Library<67>-Footnote-545166665 +Ref: Library<67>-Footnote-555166731 +Ref: Library<67>-Footnote-565166797 +Ref: Library<67>-Footnote-575166863 +Ref: Library<67>-Footnote-585166929 +Ref: Library<67>-Footnote-595166995 +Ref: Library<67>-Footnote-605167061 +Ref: Library<67>-Footnote-615167127 +Ref: Library<67>-Footnote-625167193 +Ref: Library<67>-Footnote-635167259 +Ref: Library<67>-Footnote-645167325 +Ref: Library<67>-Footnote-655167391 +Ref: Library<67>-Footnote-665167457 +Ref: Library<67>-Footnote-675167523 +Ref: Library<67>-Footnote-685167589 +Ref: Library<67>-Footnote-695167655 +Ref: Library<67>-Footnote-705167721 +Ref: Library<67>-Footnote-715167787 +Ref: Library<67>-Footnote-725167853 +Ref: Library<67>-Footnote-735167918 +Ref: Library<67>-Footnote-745167984 +Ref: Library<67>-Footnote-755168050 +Ref: Library<67>-Footnote-765168116 +Ref: Library<67>-Footnote-775168182 +Ref: Library<67>-Footnote-785168248 +Ref: Library<67>-Footnote-795168314 +Ref: Library<67>-Footnote-805168380 +Ref: Library<67>-Footnote-815168446 +Ref: Library<67>-Footnote-825168512 +Ref: Library<67>-Footnote-835168578 +Ref: Library<67>-Footnote-845168644 +Ref: Library<67>-Footnote-855168710 +Ref: Library<67>-Footnote-865168776 +Ref: Library<67>-Footnote-875168842 +Ref: Library<67>-Footnote-885168908 +Ref: Library<67>-Footnote-895168974 +Ref: Library<67>-Footnote-905169040 +Ref: Library<67>-Footnote-915169106 +Ref: Library<67>-Footnote-925169172 +Ref: Library<67>-Footnote-935169238 +Ref: Library<67>-Footnote-945169304 +Ref: Library<67>-Footnote-955169370 +Ref: Library<67>-Footnote-965169436 +Ref: Library<67>-Footnote-975169502 +Ref: Library<67>-Footnote-985169568 +Ref: Library<67>-Footnote-995169634 +Ref: Library<67>-Footnote-1005169700 +Ref: Library<67>-Footnote-1015169767 +Ref: Library<67>-Footnote-1025169834 +Ref: Library<67>-Footnote-1035169901 +Ref: Library<67>-Footnote-1045169968 +Ref: Library<67>-Footnote-1055170035 +Ref: Library<67>-Footnote-1065170102 +Ref: Library<67>-Footnote-1075170169 +Ref: Library<67>-Footnote-1085170236 +Ref: Library<67>-Footnote-1095170303 +Ref: Library<67>-Footnote-1105170370 +Ref: Library<67>-Footnote-1115170437 +Ref: Library<67>-Footnote-1125170504 +Ref: Library<67>-Footnote-1135170571 +Ref: Library<67>-Footnote-1145170638 +Ref: Library<67>-Footnote-1155170705 +Ref: Library<67>-Footnote-1165170772 +Ref: Library<67>-Footnote-1175170838 +Ref: Library<67>-Footnote-1185170905 +Ref: Library<67>-Footnote-1195170972 +Ref: Library<67>-Footnote-1205171039 +Ref: Library<67>-Footnote-1215171106 +Ref: Library<67>-Footnote-1225171173 +Ref: Library<67>-Footnote-1235171240 +Ref: Library<67>-Footnote-1245171307 +Ref: Library<67>-Footnote-1255171374 +Ref: Library<67>-Footnote-1265171441 +Ref: Library<67>-Footnote-1275171508 +Ref: Library<67>-Footnote-1285171575 +Ref: Library<67>-Footnote-1295171642 +Ref: Library<67>-Footnote-1305171709 +Ref: Library<67>-Footnote-1315171776 +Ref: Library<67>-Footnote-1325171843 +Ref: Library<67>-Footnote-1335171910 +Ref: Library<67>-Footnote-1345171977 +Ref: Library<67>-Footnote-1355172044 +Ref: Library<67>-Footnote-1365172111 +Ref: Library<67>-Footnote-1375172178 +Ref: Library<67>-Footnote-1385172245 +Ref: Library<67>-Footnote-1395172312 +Ref: Library<67>-Footnote-1405172379 +Ref: Library<67>-Footnote-1415172446 +Ref: Library<67>-Footnote-1425172513 +Ref: Library<67>-Footnote-1435172580 +Ref: Library<67>-Footnote-1445172647 +Ref: Library<67>-Footnote-1455172714 +Ref: Library<67>-Footnote-1465172781 +Ref: Library<67>-Footnote-1475172847 +Ref: Library<67>-Footnote-1485172914 +Ref: Library<67>-Footnote-1495172981 +Ref: Library<67>-Footnote-1505173048 +Ref: Library<67>-Footnote-1515173115 +Ref: Library<67>-Footnote-1525173182 +Ref: Library<67>-Footnote-1535173249 +Ref: Library<67>-Footnote-1545173316 +Ref: Library<67>-Footnote-1555173383 +Ref: Library<67>-Footnote-1565173450 +Ref: Library<67>-Footnote-1575173517 +Ref: Library<67>-Footnote-1585173584 +Ref: Library<67>-Footnote-1595173651 +Ref: Library<67>-Footnote-1605173718 +Ref: Library<67>-Footnote-1615173785 +Ref: Library<67>-Footnote-1625173852 +Ref: Library<67>-Footnote-1635173919 +Ref: Library<67>-Footnote-1645173986 +Ref: Library<67>-Footnote-1655174053 +Ref: Library<67>-Footnote-1665174120 +Ref: Library<67>-Footnote-1675174187 +Ref: Library<67>-Footnote-1685174254 +Ref: Library<67>-Footnote-1695174321 +Ref: Library<67>-Footnote-1705174387 +Ref: Library<67>-Footnote-1715174454 +Ref: Library<67>-Footnote-1725174521 +Ref: Library<67>-Footnote-1735174588 +Ref: Library<67>-Footnote-1745174655 +Ref: Library<67>-Footnote-1755174722 +Ref: Library<67>-Footnote-1765174789 +Ref: Library<67>-Footnote-1775174856 +Ref: Library<67>-Footnote-1785174923 +Ref: Library<67>-Footnote-1795174990 +Ref: Library<67>-Footnote-1805175057 +Ref: Library<67>-Footnote-1815175123 +Ref: Library<67>-Footnote-1825175190 +Ref: Library<67>-Footnote-1835175257 +Ref: Library<67>-Footnote-1845175324 +Ref: Library<67>-Footnote-1855175391 +Ref: Library<67>-Footnote-1865175458 +Ref: Library<67>-Footnote-1875175524 +Ref: Library<67>-Footnote-1885175591 +Ref: Library<67>-Footnote-1895175658 +Ref: Library<67>-Footnote-1905175725 +Ref: Library<67>-Footnote-1915175792 +Ref: Library<67>-Footnote-1925175859 +Ref: Library<67>-Footnote-1935175926 +Ref: Library<67>-Footnote-1945175993 +Ref: Library<67>-Footnote-1955176060 +Ref: Library<67>-Footnote-1965176127 +Ref: Library<67>-Footnote-1975176194 +Ref: Library<67>-Footnote-1985176261 +Ref: Library<67>-Footnote-1995176328 +Ref: Library<67>-Footnote-2005176395 +Ref: Library<67>-Footnote-2015176462 +Ref: Library<67>-Footnote-2025176529 +Ref: Library<67>-Footnote-2035176596 +Ref: Library<67>-Footnote-2045176663 +Ref: Library<67>-Footnote-2055176730 +Ref: Library<67>-Footnote-2065176797 +Ref: Library<67>-Footnote-2075176864 +Ref: Library<67>-Footnote-2085176931 +Ref: Library<67>-Footnote-2095176998 +Ref: Library<67>-Footnote-2105177065 +Ref: Library<67>-Footnote-2115177132 +Ref: Library<67>-Footnote-2125177199 +Ref: Library<67>-Footnote-2135177266 +Ref: Library<67>-Footnote-2145177333 +Ref: Library<67>-Footnote-2155177400 +Ref: Library<67>-Footnote-2165177467 +Ref: Library<67>-Footnote-2175177534 +Ref: Library<67>-Footnote-2185177601 +Ref: Library<67>-Footnote-2195177668 +Ref: Library<67>-Footnote-2205177735 +Ref: Library<67>-Footnote-2215177802 +Ref: Library<67>-Footnote-2225177869 +Ref: Library<67>-Footnote-2235177936 +Ref: Library<67>-Footnote-2245178003 +Ref: Library<67>-Footnote-2255178069 +Ref: Library<67>-Footnote-2265178136 +Ref: Library<67>-Footnote-2275178203 +Ref: Library<67>-Footnote-2285178270 +Ref: Library<67>-Footnote-2295178337 +Ref: Library<67>-Footnote-2305178404 +Ref: Library<67>-Footnote-2315178471 +Ref: Library<67>-Footnote-2325178538 +Ref: Library<67>-Footnote-2335178605 +Ref: Library<67>-Footnote-2345178672 +Ref: Library<67>-Footnote-2355178739 +Ref: Library<67>-Footnote-2365178806 +Ref: Library<67>-Footnote-2375178873 +Ref: Library<67>-Footnote-2385178940 +Ref: Library<67>-Footnote-2395179007 +Ref: Library<67>-Footnote-2405179074 +Ref: Library<67>-Footnote-2415179141 +Ref: Library<67>-Footnote-2425179208 +Ref: Library<67>-Footnote-2435179275 +Ref: Library<67>-Footnote-2445179342 +Ref: Library<67>-Footnote-2455179409 +Ref: Library<67>-Footnote-2465179476 +Ref: Library<67>-Footnote-2475179543 +Ref: Library<67>-Footnote-2485179610 +Ref: Library<67>-Footnote-2495179677 +Ref: Library<67>-Footnote-2505179744 +Ref: Library<67>-Footnote-2515179811 +Ref: Library<67>-Footnote-2525179878 +Ref: Library<67>-Footnote-2535179945 +Ref: Library<67>-Footnote-2545180012 +Ref: Library<67>-Footnote-2555180079 +Ref: Library<67>-Footnote-2565180146 +Ref: Library<67>-Footnote-2575180213 +Ref: Library<67>-Footnote-2585180280 +Ref: Library<67>-Footnote-2595180347 +Ref: Library<67>-Footnote-2605180414 +Ref: Library<67>-Footnote-2615180481 +Ref: Library<67>-Footnote-2625180548 +Ref: Library<67>-Footnote-2635180615 +Ref: Library<67>-Footnote-2645180682 +Ref: Library<67>-Footnote-2655180749 +Ref: Library<67>-Footnote-2665180816 +Ref: Library<67>-Footnote-2675180883 +Ref: Library<67>-Footnote-2685180950 +Ref: Library<67>-Footnote-2695181017 +Ref: Library<67>-Footnote-2705181084 +Ref: Library<67>-Footnote-2715181151 +Ref: Library<67>-Footnote-2725181218 +Ref: Library<67>-Footnote-2735181274 +Ref: Library<67>-Footnote-2745181341 +Ref: Library<67>-Footnote-2755181408 +Ref: Library<67>-Footnote-2765181475 +Ref: Library<67>-Footnote-2775181542 +Ref: Library<67>-Footnote-2785181609 +Ref: Library<67>-Footnote-2795181676 +Ref: Library<67>-Footnote-2805181743 +Ref: Library<67>-Footnote-2815181810 +Ref: Library<67>-Footnote-2825181877 +Ref: Library<67>-Footnote-2835181944 +Ref: Library<67>-Footnote-2845182011 +Ref: Library<67>-Footnote-2855182078 +Ref: Library<67>-Footnote-2865182145 +Ref: Library<67>-Footnote-2875182212 +Ref: Library<67>-Footnote-2885182279 +Ref: Library<67>-Footnote-2895182346 +Ref: Library<67>-Footnote-2905182413 +Ref: Library<67>-Footnote-2915182480 +Ref: Library<67>-Footnote-2925182547 +Ref: Library<67>-Footnote-2935182614 +Ref: Library<67>-Footnote-2945182681 +Ref: Library<67>-Footnote-2955182748 +Ref: Library<67>-Footnote-2965182815 +Ref: Library<67>-Footnote-2975182882 +Ref: Library<67>-Footnote-2985182949 +Ref: Library<67>-Footnote-2995183016 +Ref: Library<67>-Footnote-3005183083 +Ref: Library<67>-Footnote-3015183150 +Ref: Library<67>-Footnote-3025183217 +Ref: Library<67>-Footnote-3035183284 +Ref: Library<67>-Footnote-3045183351 +Ref: Library<67>-Footnote-3055183418 +Ref: Library<67>-Footnote-3065183485 +Ref: Library<67>-Footnote-3075183552 +Ref: Library<67>-Footnote-3085183619 +Ref: Library<67>-Footnote-3095183686 +Ref: Library<67>-Footnote-3105183753 +Ref: Library<67>-Footnote-3115183820 +Ref: Library<67>-Footnote-3125183887 +Ref: Library<67>-Footnote-3135183954 +Ref: Library<67>-Footnote-3145184021 +Ref: Library<67>-Footnote-3155184088 +Ref: Library<67>-Footnote-3165184155 +Ref: Library<67>-Footnote-3175184222 +Ref: Library<67>-Footnote-3185184289 +Ref: Library<67>-Footnote-3195184356 +Ref: Library<67>-Footnote-3205184423 +Ref: Library<67>-Footnote-3215184490 +Ref: Library<67>-Footnote-3225184557 +Ref: Library<67>-Footnote-3235184624 +Ref: Library<67>-Footnote-3245184691 +Ref: Library<67>-Footnote-3255184758 +Ref: Library<67>-Footnote-3265184825 +Node: Documentation<61>5184892 +Ref: whatsnew/changelog id5845185004 +Ref: 1ab75185004 +Ref: Documentation<61>-Footnote-15187170 +Ref: Documentation<61>-Footnote-25187235 +Ref: Documentation<61>-Footnote-35187300 +Ref: Documentation<61>-Footnote-45187365 +Ref: Documentation<61>-Footnote-55187430 +Ref: Documentation<61>-Footnote-65187495 +Ref: Documentation<61>-Footnote-75187560 +Ref: Documentation<61>-Footnote-85187625 +Ref: Documentation<61>-Footnote-95187690 +Ref: Documentation<61>-Footnote-105187755 +Ref: Documentation<61>-Footnote-115187821 +Ref: Documentation<61>-Footnote-125187887 +Ref: Documentation<61>-Footnote-135187953 +Ref: Documentation<61>-Footnote-145188019 +Ref: Documentation<61>-Footnote-155188085 +Ref: Documentation<61>-Footnote-165188151 +Ref: Documentation<61>-Footnote-175188194 +Node: Tests<60>5188260 +Ref: whatsnew/changelog id5855188370 +Ref: 1aba5188370 +Ref: Tests<60>-Footnote-15191134 +Ref: Tests<60>-Footnote-25191199 +Ref: Tests<60>-Footnote-35191264 +Ref: Tests<60>-Footnote-45191329 +Ref: Tests<60>-Footnote-55191394 +Ref: Tests<60>-Footnote-65191459 +Ref: Tests<60>-Footnote-75191524 +Ref: Tests<60>-Footnote-85191589 +Ref: Tests<60>-Footnote-95191654 +Ref: Tests<60>-Footnote-105191719 +Ref: Tests<60>-Footnote-115191785 +Ref: Tests<60>-Footnote-125191851 +Ref: Tests<60>-Footnote-135191917 +Ref: Tests<60>-Footnote-145191983 +Ref: Tests<60>-Footnote-155192049 +Ref: Tests<60>-Footnote-165192115 +Ref: Tests<60>-Footnote-175192181 +Ref: Tests<60>-Footnote-185192247 +Ref: Tests<60>-Footnote-195192313 +Node: Build<62>5192379 +Ref: whatsnew/changelog id5865192483 +Ref: 1abb5192483 +Ref: Build<62>-Footnote-15197252 +Ref: Build<62>-Footnote-25197317 +Ref: Build<62>-Footnote-35197382 +Ref: Build<62>-Footnote-45197447 +Ref: Build<62>-Footnote-55197489 +Ref: Build<62>-Footnote-65197554 +Ref: Build<62>-Footnote-75197619 +Ref: Build<62>-Footnote-85197684 +Ref: Build<62>-Footnote-95197749 +Ref: Build<62>-Footnote-105197814 +Ref: Build<62>-Footnote-115197880 +Ref: Build<62>-Footnote-125197946 +Ref: Build<62>-Footnote-135198012 +Ref: Build<62>-Footnote-145198078 +Ref: Build<62>-Footnote-155198144 +Ref: Build<62>-Footnote-165198210 +Ref: Build<62>-Footnote-175198276 +Ref: Build<62>-Footnote-185198342 +Ref: Build<62>-Footnote-195198408 +Ref: Build<62>-Footnote-205198474 +Ref: Build<62>-Footnote-215198540 +Ref: Build<62>-Footnote-225198606 +Ref: Build<62>-Footnote-235198672 +Ref: Build<62>-Footnote-245198738 +Ref: Build<62>-Footnote-255198804 +Ref: Build<62>-Footnote-265198870 +Ref: Build<62>-Footnote-275198936 +Ref: Build<62>-Footnote-285199002 +Ref: Build<62>-Footnote-295199068 +Ref: Build<62>-Footnote-305199134 +Ref: Build<62>-Footnote-315199200 +Ref: Build<62>-Footnote-325199266 +Ref: Build<62>-Footnote-335199332 +Ref: Build<62>-Footnote-345199398 +Ref: Build<62>-Footnote-355199464 +Ref: Build<62>-Footnote-365199530 +Ref: Build<62>-Footnote-375199596 +Node: Windows<58>5199662 +Ref: whatsnew/changelog id5875199765 +Ref: 1abc5199765 +Ref: Windows<58>-Footnote-15202251 +Ref: Windows<58>-Footnote-25202316 +Ref: Windows<58>-Footnote-35202381 +Ref: Windows<58>-Footnote-45202446 +Ref: Windows<58>-Footnote-55202511 +Ref: Windows<58>-Footnote-65202576 +Ref: Windows<58>-Footnote-75202641 +Ref: Windows<58>-Footnote-85202706 +Ref: Windows<58>-Footnote-95202771 +Ref: Windows<58>-Footnote-105202836 +Ref: Windows<58>-Footnote-115202902 +Ref: Windows<58>-Footnote-125202968 +Ref: Windows<58>-Footnote-135203034 +Ref: Windows<58>-Footnote-145203100 +Ref: Windows<58>-Footnote-155203166 +Ref: Windows<58>-Footnote-165203232 +Ref: Windows<58>-Footnote-175203298 +Ref: Windows<58>-Footnote-185203364 +Ref: Windows<58>-Footnote-195203430 +Ref: Windows<58>-Footnote-205203496 +Ref: Windows<58>-Footnote-215203562 +Ref: Windows<58>-Footnote-225203628 +Ref: Windows<58>-Footnote-235203694 +Ref: Windows<58>-Footnote-245203760 +Ref: Windows<58>-Footnote-255203826 +Node: IDLE<47>5203892 +Ref: whatsnew/changelog id5885204001 +Ref: 1abd5204001 +Ref: IDLE<47>-Footnote-15214002 +Ref: IDLE<47>-Footnote-25214067 +Ref: IDLE<47>-Footnote-35214132 +Ref: IDLE<47>-Footnote-45214197 +Ref: IDLE<47>-Footnote-55214262 +Ref: IDLE<47>-Footnote-65214327 +Ref: IDLE<47>-Footnote-75214392 +Ref: IDLE<47>-Footnote-85214457 +Ref: IDLE<47>-Footnote-95214522 +Ref: IDLE<47>-Footnote-105214587 +Ref: IDLE<47>-Footnote-115214653 +Ref: IDLE<47>-Footnote-125214719 +Ref: IDLE<47>-Footnote-135214785 +Ref: IDLE<47>-Footnote-145214851 +Ref: IDLE<47>-Footnote-155214917 +Ref: IDLE<47>-Footnote-165214983 +Ref: IDLE<47>-Footnote-175215049 +Ref: IDLE<47>-Footnote-185215115 +Ref: IDLE<47>-Footnote-195215181 +Ref: IDLE<47>-Footnote-205215247 +Ref: IDLE<47>-Footnote-215215313 +Ref: IDLE<47>-Footnote-225215379 +Ref: IDLE<47>-Footnote-235215445 +Ref: IDLE<47>-Footnote-245215511 +Ref: IDLE<47>-Footnote-255215577 +Ref: IDLE<47>-Footnote-265215643 +Ref: IDLE<47>-Footnote-275215709 +Ref: IDLE<47>-Footnote-285215775 +Ref: IDLE<47>-Footnote-295215841 +Ref: IDLE<47>-Footnote-305215907 +Ref: IDLE<47>-Footnote-315215973 +Ref: IDLE<47>-Footnote-325216039 +Ref: IDLE<47>-Footnote-335216105 +Ref: IDLE<47>-Footnote-345216171 +Ref: IDLE<47>-Footnote-355216236 +Ref: IDLE<47>-Footnote-365216302 +Ref: IDLE<47>-Footnote-375216368 +Ref: IDLE<47>-Footnote-385216434 +Ref: IDLE<47>-Footnote-395216500 +Ref: IDLE<47>-Footnote-405216566 +Ref: IDLE<47>-Footnote-415216632 +Ref: IDLE<47>-Footnote-425216698 +Ref: IDLE<47>-Footnote-435216764 +Ref: IDLE<47>-Footnote-445216829 +Ref: IDLE<47>-Footnote-455216895 +Ref: IDLE<47>-Footnote-465216961 +Ref: IDLE<47>-Footnote-475217027 +Ref: IDLE<47>-Footnote-485217093 +Ref: IDLE<47>-Footnote-495217159 +Ref: IDLE<47>-Footnote-505217225 +Ref: IDLE<47>-Footnote-515217291 +Node: Tools/Demos<33>5217357 +Ref: whatsnew/changelog id5895217464 +Ref: 1abe5217464 +Ref: Tools/Demos<33>-Footnote-15218952 +Ref: Tools/Demos<33>-Footnote-25219017 +Ref: Tools/Demos<33>-Footnote-35219059 +Ref: Tools/Demos<33>-Footnote-45219124 +Ref: Tools/Demos<33>-Footnote-55219189 +Ref: Tools/Demos<33>-Footnote-65219254 +Ref: Tools/Demos<33>-Footnote-75219319 +Ref: Tools/Demos<33>-Footnote-85219384 +Node: C API<59>5219449 +Ref: whatsnew/changelog id5905219539 +Ref: 1abf5219539 +Ref: C API<59>-Footnote-15222603 +Ref: C API<59>-Footnote-25222668 +Ref: C API<59>-Footnote-35222733 +Ref: C API<59>-Footnote-45222798 +Ref: C API<59>-Footnote-55222863 +Ref: C API<59>-Footnote-65222927 +Ref: C API<59>-Footnote-75222992 +Ref: C API<59>-Footnote-85223057 +Ref: C API<59>-Footnote-95223122 +Ref: C API<59>-Footnote-105223187 +Ref: C API<59>-Footnote-115223253 +Ref: C API<59>-Footnote-125223319 +Ref: C API<59>-Footnote-135223385 +Ref: C API<59>-Footnote-145223451 +Ref: C API<59>-Footnote-155223517 +Node: Python 3 6 6 final5223583 +Ref: whatsnew/changelog python-3-6-6-final5223717 +Ref: 1ac05223717 +Node: Python 3 6 6 release candidate 15223845 +Ref: whatsnew/changelog python-3-6-6-release-candidate-15223977 +Ref: 1ac15223977 +Node: Core and Builtins<68>5224356 +Ref: whatsnew/changelog id5915224466 +Ref: 1ac25224466 +Ref: Core and Builtins<68>-Footnote-15226048 +Ref: Core and Builtins<68>-Footnote-25226113 +Ref: Core and Builtins<68>-Footnote-35226178 +Ref: Core and Builtins<68>-Footnote-45226243 +Ref: Core and Builtins<68>-Footnote-55226308 +Ref: Core and Builtins<68>-Footnote-65226373 +Ref: Core and Builtins<68>-Footnote-75226438 +Ref: Core and Builtins<68>-Footnote-85226503 +Ref: Core and Builtins<68>-Footnote-95226568 +Ref: Core and Builtins<68>-Footnote-105226633 +Ref: Core and Builtins<68>-Footnote-115226699 +Ref: Core and Builtins<68>-Footnote-125226765 +Node: Library<68>5226831 +Ref: whatsnew/changelog id5925226967 +Ref: 1ac35226967 +Ref: Library<68>-Footnote-15232448 +Ref: Library<68>-Footnote-25232513 +Ref: Library<68>-Footnote-35232578 +Ref: Library<68>-Footnote-45232643 +Ref: Library<68>-Footnote-55232708 +Ref: Library<68>-Footnote-65232773 +Ref: Library<68>-Footnote-75232838 +Ref: Library<68>-Footnote-85232903 +Ref: Library<68>-Footnote-95232968 +Ref: Library<68>-Footnote-105233033 +Ref: Library<68>-Footnote-115233099 +Ref: Library<68>-Footnote-125233165 +Ref: Library<68>-Footnote-135233231 +Ref: Library<68>-Footnote-145233297 +Ref: Library<68>-Footnote-155233363 +Ref: Library<68>-Footnote-165233429 +Ref: Library<68>-Footnote-175233495 +Ref: Library<68>-Footnote-185233561 +Ref: Library<68>-Footnote-195233627 +Ref: Library<68>-Footnote-205233693 +Ref: Library<68>-Footnote-215233759 +Ref: Library<68>-Footnote-225233826 +Ref: Library<68>-Footnote-235233892 +Ref: Library<68>-Footnote-245233958 +Ref: Library<68>-Footnote-255234024 +Ref: Library<68>-Footnote-265234090 +Ref: Library<68>-Footnote-275234156 +Ref: Library<68>-Footnote-285234222 +Ref: Library<68>-Footnote-295234265 +Ref: Library<68>-Footnote-305234331 +Ref: Library<68>-Footnote-315234397 +Ref: Library<68>-Footnote-325234463 +Ref: Library<68>-Footnote-335234529 +Ref: Library<68>-Footnote-345234595 +Ref: Library<68>-Footnote-355234661 +Ref: Library<68>-Footnote-365234727 +Ref: Library<68>-Footnote-375234793 +Ref: Library<68>-Footnote-385234859 +Ref: Library<68>-Footnote-395234925 +Node: Documentation<62>5234991 +Ref: whatsnew/changelog id5935235115 +Ref: 1ac45235115 +Ref: Documentation<62>-Footnote-15236606 +Ref: Documentation<62>-Footnote-25236671 +Ref: Documentation<62>-Footnote-35236736 +Ref: Documentation<62>-Footnote-45236801 +Ref: Documentation<62>-Footnote-55236866 +Ref: Documentation<62>-Footnote-65236931 +Ref: Documentation<62>-Footnote-75236996 +Ref: Documentation<62>-Footnote-85237061 +Ref: Documentation<62>-Footnote-95237126 +Ref: Documentation<62>-Footnote-105237191 +Ref: Documentation<62>-Footnote-115237257 +Ref: Documentation<62>-Footnote-125237323 +Ref: Documentation<62>-Footnote-135237388 +Node: Tests<61>5237454 +Ref: whatsnew/changelog id5945237576 +Ref: 1ac55237576 +Ref: Tests<61>-Footnote-15237798 +Ref: Tests<61>-Footnote-25237863 +Node: Build<63>5237928 +Ref: whatsnew/changelog id5955238044 +Ref: 1ac65238044 +Ref: Build<63>-Footnote-15238841 +Ref: Build<63>-Footnote-25238905 +Ref: Build<63>-Footnote-35238970 +Ref: Build<63>-Footnote-45239035 +Ref: Build<63>-Footnote-55239100 +Node: Windows<59>5239165 +Ref: whatsnew/changelog id5965239281 +Ref: 1ac75239281 +Ref: Windows<59>-Footnote-15239418 +Node: macOS<47>5239483 +Ref: whatsnew/changelog id5975239598 +Ref: 1ac85239598 +Ref: macOS<47>-Footnote-15239739 +Node: IDLE<48>5239804 +Ref: whatsnew/changelog id5985239923 +Ref: 1ac95239923 +Ref: IDLE<48>-Footnote-15241992 +Ref: IDLE<48>-Footnote-25242057 +Ref: IDLE<48>-Footnote-35242122 +Ref: IDLE<48>-Footnote-45242187 +Ref: IDLE<48>-Footnote-55242252 +Ref: IDLE<48>-Footnote-65242317 +Ref: IDLE<48>-Footnote-75242382 +Ref: IDLE<48>-Footnote-85242447 +Ref: IDLE<48>-Footnote-95242512 +Ref: IDLE<48>-Footnote-105242577 +Ref: IDLE<48>-Footnote-115242643 +Ref: IDLE<48>-Footnote-125242709 +Node: Tools/Demos<34>5242775 +Ref: whatsnew/changelog id5995242894 +Ref: 1aca5242894 +Ref: Tools/Demos<34>-Footnote-15243649 +Ref: Tools/Demos<34>-Footnote-25243714 +Ref: Tools/Demos<34>-Footnote-35243779 +Ref: Tools/Demos<34>-Footnote-45243844 +Ref: Tools/Demos<34>-Footnote-55243909 +Node: C API<60>5243974 +Ref: whatsnew/changelog id6005244076 +Ref: 1acb5244076 +Ref: C API<60>-Footnote-15244289 +Node: Python 3 6 5 final5244354 +Ref: whatsnew/changelog python-3-6-5-final5244500 +Ref: 1acc5244500 +Node: Tests<62>5244633 +Ref: whatsnew/changelog id6015244715 +Ref: 1acd5244715 +Ref: Tests<62>-Footnote-15244869 +Node: Build<64>5244934 +Ref: whatsnew/changelog id6025245016 +Ref: 1ace5245016 +Ref: Build<64>-Footnote-15245153 +Node: Python 3 6 5 release candidate 15245218 +Ref: whatsnew/changelog python-3-6-5-release-candidate-15245350 +Ref: 1acf5245350 +Node: Security<42>5245755 +Ref: whatsnew/changelog id6035245866 +Ref: 1ad05245866 +Ref: Security<42>-Footnote-15246297 +Ref: Security<42>-Footnote-25246362 +Ref: Security<42>-Footnote-35246427 +Ref: Security<42>-Footnote-45246482 +Node: Core and Builtins<69>5246537 +Ref: whatsnew/changelog id6045246668 +Ref: 1ad15246668 +Ref: Core and Builtins<69>-Footnote-15248842 +Ref: Core and Builtins<69>-Footnote-25248907 +Ref: Core and Builtins<69>-Footnote-35248972 +Ref: Core and Builtins<69>-Footnote-45249037 +Ref: Core and Builtins<69>-Footnote-55249102 +Ref: Core and Builtins<69>-Footnote-65249167 +Ref: Core and Builtins<69>-Footnote-75249232 +Ref: Core and Builtins<69>-Footnote-85249297 +Ref: Core and Builtins<69>-Footnote-95249362 +Ref: Core and Builtins<69>-Footnote-105249427 +Ref: Core and Builtins<69>-Footnote-115249493 +Ref: Core and Builtins<69>-Footnote-125249559 +Ref: Core and Builtins<69>-Footnote-135249625 +Ref: Core and Builtins<69>-Footnote-145249691 +Node: Library<69>5249757 +Ref: whatsnew/changelog id6055249893 +Ref: 1ad25249893 +Ref: Library<69>-Footnote-15255824 +Ref: Library<69>-Footnote-25255889 +Ref: Library<69>-Footnote-35255954 +Ref: Library<69>-Footnote-45256019 +Ref: Library<69>-Footnote-55256084 +Ref: Library<69>-Footnote-65256149 +Ref: Library<69>-Footnote-75256214 +Ref: Library<69>-Footnote-85256279 +Ref: Library<69>-Footnote-95256344 +Ref: Library<69>-Footnote-105256409 +Ref: Library<69>-Footnote-115256475 +Ref: Library<69>-Footnote-125256541 +Ref: Library<69>-Footnote-135256607 +Ref: Library<69>-Footnote-145256673 +Ref: Library<69>-Footnote-155256739 +Ref: Library<69>-Footnote-165256805 +Ref: Library<69>-Footnote-175256871 +Ref: Library<69>-Footnote-185256937 +Ref: Library<69>-Footnote-195257003 +Ref: Library<69>-Footnote-205257069 +Ref: Library<69>-Footnote-215257135 +Ref: Library<69>-Footnote-225257201 +Ref: Library<69>-Footnote-235257267 +Ref: Library<69>-Footnote-245257333 +Ref: Library<69>-Footnote-255257399 +Ref: Library<69>-Footnote-265257465 +Ref: Library<69>-Footnote-275257531 +Ref: Library<69>-Footnote-285257597 +Ref: Library<69>-Footnote-295257663 +Ref: Library<69>-Footnote-305257729 +Ref: Library<69>-Footnote-315257795 +Ref: Library<69>-Footnote-325257861 +Ref: Library<69>-Footnote-335257927 +Ref: Library<69>-Footnote-345257993 +Ref: Library<69>-Footnote-355258059 +Ref: Library<69>-Footnote-365258125 +Ref: Library<69>-Footnote-375258191 +Ref: Library<69>-Footnote-385258257 +Ref: Library<69>-Footnote-395258323 +Ref: Library<69>-Footnote-405258389 +Node: Documentation<63>5258455 +Ref: whatsnew/changelog id6065258579 +Ref: 1ad35258579 +Ref: Documentation<63>-Footnote-15259415 +Ref: Documentation<63>-Footnote-25259480 +Ref: Documentation<63>-Footnote-35259545 +Ref: Documentation<63>-Footnote-45259609 +Ref: Documentation<63>-Footnote-55259674 +Ref: Documentation<63>-Footnote-65259739 +Node: Tests<63>5259804 +Ref: whatsnew/changelog id6075259926 +Ref: 1ad45259926 +Ref: Tests<63>-Footnote-15260587 +Ref: Tests<63>-Footnote-25260652 +Ref: Tests<63>-Footnote-35260717 +Ref: Tests<63>-Footnote-45260782 +Node: Build<65>5260847 +Ref: whatsnew/changelog id6085260963 +Ref: 1ad55260963 +Ref: Build<65>-Footnote-15261152 +Node: Windows<60>5261217 +Ref: whatsnew/changelog id6095261333 +Ref: 1ad65261333 +Ref: Windows<60>-Footnote-15262283 +Ref: Windows<60>-Footnote-25262348 +Ref: Windows<60>-Footnote-35262413 +Ref: Windows<60>-Footnote-45262478 +Ref: Windows<60>-Footnote-55262543 +Ref: Windows<60>-Footnote-65262608 +Ref: Windows<60>-Footnote-75262673 +Ref: Windows<60>-Footnote-85262738 +Node: macOS<48>5262803 +Ref: whatsnew/changelog id6105262918 +Ref: 1ad75262918 +Ref: macOS<48>-Footnote-15263311 +Node: IDLE<49>5263376 +Ref: whatsnew/changelog id6115263495 +Ref: 1ad85263495 +Ref: IDLE<49>-Footnote-15264989 +Ref: IDLE<49>-Footnote-25265054 +Ref: IDLE<49>-Footnote-35265119 +Ref: IDLE<49>-Footnote-45265184 +Ref: IDLE<49>-Footnote-55265249 +Ref: IDLE<49>-Footnote-65265314 +Ref: IDLE<49>-Footnote-75265379 +Ref: IDLE<49>-Footnote-85265444 +Node: Tools/Demos<35>5265509 +Ref: whatsnew/changelog id6125265628 +Ref: 1ad95265628 +Ref: Tools/Demos<35>-Footnote-15266048 +Ref: Tools/Demos<35>-Footnote-25266113 +Node: C API<61>5266178 +Ref: whatsnew/changelog id6135266280 +Ref: 1ada5266280 +Ref: C API<61>-Footnote-15266530 +Node: Python 3 6 4 final5266595 +Ref: whatsnew/changelog python-3-6-4-final5266741 +Ref: 1adb5266741 +Node: Python 3 6 4 release candidate 15266890 +Ref: whatsnew/changelog python-3-6-4-release-candidate-15267022 +Ref: 1adc5267022 +Node: Core and Builtins<70>5267401 +Ref: whatsnew/changelog id6145267511 +Ref: 1add5267511 +Ref: Core and Builtins<70>-Footnote-15272243 +Ref: Core and Builtins<70>-Footnote-25272308 +Ref: Core and Builtins<70>-Footnote-35272373 +Ref: Core and Builtins<70>-Footnote-45272438 +Ref: Core and Builtins<70>-Footnote-55272503 +Ref: Core and Builtins<70>-Footnote-65272568 +Ref: Core and Builtins<70>-Footnote-75272633 +Ref: Core and Builtins<70>-Footnote-85272698 +Ref: Core and Builtins<70>-Footnote-95272763 +Ref: Core and Builtins<70>-Footnote-105272828 +Ref: Core and Builtins<70>-Footnote-115272894 +Ref: Core and Builtins<70>-Footnote-125272960 +Ref: Core and Builtins<70>-Footnote-135273026 +Ref: Core and Builtins<70>-Footnote-145273092 +Ref: Core and Builtins<70>-Footnote-155273158 +Ref: Core and Builtins<70>-Footnote-165273224 +Ref: Core and Builtins<70>-Footnote-175273290 +Ref: Core and Builtins<70>-Footnote-185273356 +Ref: Core and Builtins<70>-Footnote-195273422 +Ref: Core and Builtins<70>-Footnote-205273488 +Ref: Core and Builtins<70>-Footnote-215273554 +Ref: Core and Builtins<70>-Footnote-225273620 +Ref: Core and Builtins<70>-Footnote-235273686 +Ref: Core and Builtins<70>-Footnote-245273752 +Node: Library<70>5273818 +Ref: whatsnew/changelog id6155273954 +Ref: 1ade5273954 +Ref: Library<70>-Footnote-15281279 +Ref: Library<70>-Footnote-25281344 +Ref: Library<70>-Footnote-35281409 +Ref: Library<70>-Footnote-45281474 +Ref: Library<70>-Footnote-55281539 +Ref: Library<70>-Footnote-65281604 +Ref: Library<70>-Footnote-75281669 +Ref: Library<70>-Footnote-85281734 +Ref: Library<70>-Footnote-95281799 +Ref: Library<70>-Footnote-105281864 +Ref: Library<70>-Footnote-115281930 +Ref: Library<70>-Footnote-125281996 +Ref: Library<70>-Footnote-135282062 +Ref: Library<70>-Footnote-145282128 +Ref: Library<70>-Footnote-155282194 +Ref: Library<70>-Footnote-165282260 +Ref: Library<70>-Footnote-175282325 +Ref: Library<70>-Footnote-185282391 +Ref: Library<70>-Footnote-195282457 +Ref: Library<70>-Footnote-205282523 +Ref: Library<70>-Footnote-215282589 +Ref: Library<70>-Footnote-225282655 +Ref: Library<70>-Footnote-235282721 +Ref: Library<70>-Footnote-245282787 +Ref: Library<70>-Footnote-255282853 +Ref: Library<70>-Footnote-265282919 +Ref: Library<70>-Footnote-275282985 +Ref: Library<70>-Footnote-285283051 +Ref: Library<70>-Footnote-295283117 +Ref: Library<70>-Footnote-305283183 +Ref: Library<70>-Footnote-315283249 +Ref: Library<70>-Footnote-325283315 +Ref: Library<70>-Footnote-335283381 +Ref: Library<70>-Footnote-345283447 +Ref: Library<70>-Footnote-355283513 +Ref: Library<70>-Footnote-365283579 +Ref: Library<70>-Footnote-375283645 +Ref: Library<70>-Footnote-385283711 +Ref: Library<70>-Footnote-395283777 +Ref: Library<70>-Footnote-405283843 +Ref: Library<70>-Footnote-415283909 +Ref: Library<70>-Footnote-425283975 +Ref: Library<70>-Footnote-435284041 +Ref: Library<70>-Footnote-445284107 +Ref: Library<70>-Footnote-455284173 +Ref: Library<70>-Footnote-465284239 +Ref: Library<70>-Footnote-475284305 +Ref: Library<70>-Footnote-485284371 +Ref: Library<70>-Footnote-495284437 +Ref: Library<70>-Footnote-505284503 +Ref: Library<70>-Footnote-515284569 +Ref: Library<70>-Footnote-525284635 +Node: Documentation<64>5284701 +Ref: whatsnew/changelog id6165284825 +Ref: 1adf5284825 +Ref: Documentation<64>-Footnote-15285314 +Ref: Documentation<64>-Footnote-25285379 +Ref: Documentation<64>-Footnote-35285444 +Node: Tests<64>5285509 +Ref: whatsnew/changelog id6175285631 +Ref: 1ae05285631 +Ref: Tests<64>-Footnote-15286309 +Ref: Tests<64>-Footnote-25286374 +Ref: Tests<64>-Footnote-35286439 +Ref: Tests<64>-Footnote-45286504 +Node: Build<66>5286569 +Ref: whatsnew/changelog id6185286685 +Ref: 1ae15286685 +Ref: Build<66>-Footnote-15287589 +Ref: Build<66>-Footnote-25287654 +Ref: Build<66>-Footnote-35287719 +Ref: Build<66>-Footnote-45287784 +Ref: Build<66>-Footnote-55287849 +Ref: Build<66>-Footnote-65287914 +Ref: Build<66>-Footnote-75287979 +Ref: Build<66>-Footnote-85288044 +Ref: Build<66>-Footnote-95288109 +Node: Windows<61>5288174 +Ref: whatsnew/changelog id6195288290 +Ref: 1ae25288290 +Ref: Windows<61>-Footnote-15288608 +Ref: Windows<61>-Footnote-25288672 +Node: macOS<49>5288737 +Ref: whatsnew/changelog id6205288852 +Ref: 1ae35288852 +Ref: macOS<49>-Footnote-15288986 +Node: IDLE<50>5289051 +Ref: whatsnew/changelog id6215289170 +Ref: 1ae45289170 +Ref: IDLE<50>-Footnote-15292507 +Ref: IDLE<50>-Footnote-25292572 +Ref: IDLE<50>-Footnote-35292637 +Ref: IDLE<50>-Footnote-45292702 +Ref: IDLE<50>-Footnote-55292767 +Ref: IDLE<50>-Footnote-65292832 +Ref: IDLE<50>-Footnote-75292897 +Ref: IDLE<50>-Footnote-85292962 +Ref: IDLE<50>-Footnote-95293027 +Ref: IDLE<50>-Footnote-105293092 +Ref: IDLE<50>-Footnote-115293158 +Ref: IDLE<50>-Footnote-125293224 +Ref: IDLE<50>-Footnote-135293290 +Ref: IDLE<50>-Footnote-145293356 +Node: Tools/Demos<36>5293424 +Ref: whatsnew/changelog id6225293543 +Ref: 1ae55293543 +Ref: Tools/Demos<36>-Footnote-15293833 +Node: C API<62>5293898 +Ref: whatsnew/changelog id6235294000 +Ref: 1ae65294000 +Ref: C API<62>-Footnote-15294728 +Ref: C API<62>-Footnote-25294793 +Ref: C API<62>-Footnote-35294858 +Ref: C API<62>-Footnote-45294923 +Node: Python 3 6 3 final5294988 +Ref: whatsnew/changelog python-3-6-3-final5295134 +Ref: 1ae75295134 +Node: Library<71>5295271 +Ref: whatsnew/changelog id6245295355 +Ref: 1ae85295355 +Ref: Library<71>-Footnote-15295557 +Node: Build<67>5295622 +Ref: whatsnew/changelog id6255295706 +Ref: 1ae95295706 +Ref: Build<67>-Footnote-15295997 +Ref: Build<67>-Footnote-25296062 +Node: Python 3 6 3 release candidate 15296127 +Ref: whatsnew/changelog python-3-6-3-release-candidate-15296259 +Ref: 1aea5296259 +Node: Security<43>5296624 +Ref: whatsnew/changelog id6265296735 +Ref: 1aeb5296735 +Ref: Security<43>-Footnote-15297041 +Ref: Security<43>-Footnote-25297106 +Node: Core and Builtins<71>5297171 +Ref: whatsnew/changelog id6275297302 +Ref: 1aec5297302 +Ref: Core and Builtins<71>-Footnote-15300833 +Ref: Core and Builtins<71>-Footnote-25300898 +Ref: Core and Builtins<71>-Footnote-35300963 +Ref: Core and Builtins<71>-Footnote-45301028 +Ref: Core and Builtins<71>-Footnote-55301093 +Ref: Core and Builtins<71>-Footnote-65301158 +Ref: Core and Builtins<71>-Footnote-75301223 +Ref: Core and Builtins<71>-Footnote-85301288 +Ref: Core and Builtins<71>-Footnote-95301353 +Ref: Core and Builtins<71>-Footnote-105301418 +Ref: Core and Builtins<71>-Footnote-115301484 +Ref: Core and Builtins<71>-Footnote-125301550 +Ref: Core and Builtins<71>-Footnote-135301616 +Ref: Core and Builtins<71>-Footnote-145301682 +Ref: Core and Builtins<71>-Footnote-155301748 +Ref: Core and Builtins<71>-Footnote-165301814 +Ref: Core and Builtins<71>-Footnote-175301880 +Ref: Core and Builtins<71>-Footnote-185301946 +Ref: Core and Builtins<71>-Footnote-195302012 +Ref: Core and Builtins<71>-Footnote-205302078 +Ref: Core and Builtins<71>-Footnote-215302144 +Ref: Core and Builtins<71>-Footnote-225302210 +Node: Library<72>5302276 +Ref: whatsnew/changelog id6285302412 +Ref: 1aed5302412 +Ref: Library<72>-Footnote-15308413 +Ref: Library<72>-Footnote-25308478 +Ref: Library<72>-Footnote-35308543 +Ref: Library<72>-Footnote-45308608 +Ref: Library<72>-Footnote-55308673 +Ref: Library<72>-Footnote-65308738 +Ref: Library<72>-Footnote-75308803 +Ref: Library<72>-Footnote-85308868 +Ref: Library<72>-Footnote-95308933 +Ref: Library<72>-Footnote-105308998 +Ref: Library<72>-Footnote-115309064 +Ref: Library<72>-Footnote-125309130 +Ref: Library<72>-Footnote-135309196 +Ref: Library<72>-Footnote-145309262 +Ref: Library<72>-Footnote-155309328 +Ref: Library<72>-Footnote-165309393 +Ref: Library<72>-Footnote-175309459 +Ref: Library<72>-Footnote-185309525 +Ref: Library<72>-Footnote-195309568 +Ref: Library<72>-Footnote-205309634 +Ref: Library<72>-Footnote-215309700 +Ref: Library<72>-Footnote-225309766 +Ref: Library<72>-Footnote-235309832 +Ref: Library<72>-Footnote-245309898 +Ref: Library<72>-Footnote-255309964 +Ref: Library<72>-Footnote-265310030 +Ref: Library<72>-Footnote-275310096 +Ref: Library<72>-Footnote-285310162 +Ref: Library<72>-Footnote-295310228 +Ref: Library<72>-Footnote-305310294 +Ref: Library<72>-Footnote-315310360 +Ref: Library<72>-Footnote-325310426 +Ref: Library<72>-Footnote-335310492 +Ref: Library<72>-Footnote-345310558 +Ref: Library<72>-Footnote-355310624 +Ref: Library<72>-Footnote-365310690 +Ref: Library<72>-Footnote-375310756 +Ref: Library<72>-Footnote-385310822 +Ref: Library<72>-Footnote-395310888 +Ref: Library<72>-Footnote-405310954 +Ref: Library<72>-Footnote-415311020 +Ref: Library<72>-Footnote-425311086 +Node: Documentation<65>5311152 +Ref: whatsnew/changelog id6295311276 +Ref: 1aee5311276 +Ref: Documentation<65>-Footnote-15311699 +Ref: Documentation<65>-Footnote-25311764 +Ref: Documentation<65>-Footnote-35311829 +Node: Tests<65>5311894 +Ref: whatsnew/changelog id6305312016 +Ref: 1aef5312016 +Ref: Tests<65>-Footnote-15312721 +Ref: Tests<65>-Footnote-25312786 +Ref: Tests<65>-Footnote-35312851 +Ref: Tests<65>-Footnote-45312916 +Node: Build<68>5312981 +Ref: whatsnew/changelog id6315313097 +Ref: 1af05313097 +Ref: Build<68>-Footnote-15313272 +Node: Windows<62>5313337 +Ref: whatsnew/changelog id6325313452 +Ref: 1af15313452 +Ref: Windows<62>-Footnote-15313960 +Ref: Windows<62>-Footnote-25314025 +Ref: Windows<62>-Footnote-35314090 +Ref: Windows<62>-Footnote-45314155 +Node: IDLE<51>5314220 +Ref: whatsnew/changelog id6335314341 +Ref: 1af25314341 +Ref: IDLE<51>-Footnote-15323174 +Ref: IDLE<51>-Footnote-25323239 +Ref: IDLE<51>-Footnote-35323304 +Ref: IDLE<51>-Footnote-45323369 +Ref: IDLE<51>-Footnote-55323434 +Ref: IDLE<51>-Footnote-65323499 +Ref: IDLE<51>-Footnote-75323564 +Ref: IDLE<51>-Footnote-85323629 +Ref: IDLE<51>-Footnote-95323694 +Ref: IDLE<51>-Footnote-105323759 +Ref: IDLE<51>-Footnote-115323825 +Ref: IDLE<51>-Footnote-125323891 +Ref: IDLE<51>-Footnote-135323957 +Ref: IDLE<51>-Footnote-145324023 +Ref: IDLE<51>-Footnote-155324089 +Ref: IDLE<51>-Footnote-165324155 +Ref: IDLE<51>-Footnote-175324221 +Ref: IDLE<51>-Footnote-185324287 +Ref: IDLE<51>-Footnote-195324353 +Ref: IDLE<51>-Footnote-205324419 +Ref: IDLE<51>-Footnote-215324485 +Ref: IDLE<51>-Footnote-225324551 +Ref: IDLE<51>-Footnote-235324617 +Ref: IDLE<51>-Footnote-245324683 +Ref: IDLE<51>-Footnote-255324749 +Ref: IDLE<51>-Footnote-265324815 +Ref: IDLE<51>-Footnote-275324881 +Ref: IDLE<51>-Footnote-285324947 +Ref: IDLE<51>-Footnote-295325013 +Ref: IDLE<51>-Footnote-305325079 +Ref: IDLE<51>-Footnote-315325145 +Ref: IDLE<51>-Footnote-325325211 +Ref: IDLE<51>-Footnote-335325277 +Ref: IDLE<51>-Footnote-345325343 +Ref: IDLE<51>-Footnote-355325408 +Ref: IDLE<51>-Footnote-365325474 +Ref: IDLE<51>-Footnote-375325540 +Ref: IDLE<51>-Footnote-385325606 +Ref: IDLE<51>-Footnote-395325672 +Ref: IDLE<51>-Footnote-405325738 +Ref: IDLE<51>-Footnote-415325804 +Ref: IDLE<51>-Footnote-425325870 +Ref: IDLE<51>-Footnote-435325936 +Node: Tools/Demos<37>5326001 +Ref: whatsnew/changelog id6345326102 +Ref: 1af35326102 +Ref: Tools/Demos<37>-Footnote-15326664 +Ref: Tools/Demos<37>-Footnote-25326729 +Node: Python 3 6 2 final5326771 +Ref: whatsnew/changelog python-3-6-2-final5326917 +Ref: 1af45326917 +Node: Python 3 6 2 release candidate 25327038 +Ref: whatsnew/changelog python-3-6-2-release-candidate-25327184 +Ref: 1af55327184 +Node: Security<44>5327331 +Ref: whatsnew/changelog id6355327412 +Ref: 1af65327412 +Ref: Security<44>-Footnote-15328537 +Ref: Security<44>-Footnote-25328602 +Ref: Security<44>-Footnote-35328667 +Ref: Security<44>-Footnote-45328722 +Ref: Security<44>-Footnote-55328777 +Ref: Security<44>-Footnote-65328832 +Ref: Security<44>-Footnote-75328887 +Ref: Security<44>-Footnote-85328942 +Ref: Security<44>-Footnote-95328997 +Node: Python 3 6 2 release candidate 15329062 +Ref: whatsnew/changelog python-3-6-2-release-candidate-15329208 +Ref: 1af75329208 +Node: Security<45>5329593 +Ref: whatsnew/changelog id6365329704 +Ref: 1af85329704 +Ref: Security<45>-Footnote-15329977 +Ref: Security<45>-Footnote-25330042 +Ref: Security<45>-Footnote-35330097 +Node: Core and Builtins<72>5330152 +Ref: whatsnew/changelog id6375330283 +Ref: 1af95330283 +Ref: Core and Builtins<72>-Footnote-15332283 +Ref: Core and Builtins<72>-Footnote-25332348 +Ref: Core and Builtins<72>-Footnote-35332413 +Ref: Core and Builtins<72>-Footnote-45332478 +Ref: Core and Builtins<72>-Footnote-55332543 +Ref: Core and Builtins<72>-Footnote-65332608 +Ref: Core and Builtins<72>-Footnote-75332673 +Ref: Core and Builtins<72>-Footnote-85332738 +Ref: Core and Builtins<72>-Footnote-95332803 +Ref: Core and Builtins<72>-Footnote-105332868 +Ref: Core and Builtins<72>-Footnote-115332934 +Ref: Core and Builtins<72>-Footnote-125333000 +Ref: Core and Builtins<72>-Footnote-135333066 +Ref: Core and Builtins<72>-Footnote-145333132 +Ref: Core and Builtins<72>-Footnote-155333198 +Node: Library<73>5333264 +Ref: whatsnew/changelog id6385333391 +Ref: 1afa5333391 +Ref: Library<73>-Footnote-15341819 +Ref: Library<73>-Footnote-25341884 +Ref: Library<73>-Footnote-35341949 +Ref: Library<73>-Footnote-45342014 +Ref: Library<73>-Footnote-55342079 +Ref: Library<73>-Footnote-65342144 +Ref: Library<73>-Footnote-75342209 +Ref: Library<73>-Footnote-85342274 +Ref: Library<73>-Footnote-95342339 +Ref: Library<73>-Footnote-105342404 +Ref: Library<73>-Footnote-115342470 +Ref: Library<73>-Footnote-125342536 +Ref: Library<73>-Footnote-135342602 +Ref: Library<73>-Footnote-145342668 +Ref: Library<73>-Footnote-155342734 +Ref: Library<73>-Footnote-165342800 +Ref: Library<73>-Footnote-175342866 +Ref: Library<73>-Footnote-185342932 +Ref: Library<73>-Footnote-195342998 +Ref: Library<73>-Footnote-205343064 +Ref: Library<73>-Footnote-215343130 +Ref: Library<73>-Footnote-225343196 +Ref: Library<73>-Footnote-235343262 +Ref: Library<73>-Footnote-245343328 +Ref: Library<73>-Footnote-255343394 +Ref: Library<73>-Footnote-265343460 +Ref: Library<73>-Footnote-275343526 +Ref: Library<73>-Footnote-285343592 +Ref: Library<73>-Footnote-295343658 +Ref: Library<73>-Footnote-305343724 +Ref: Library<73>-Footnote-315343790 +Ref: Library<73>-Footnote-325343856 +Ref: Library<73>-Footnote-335343922 +Ref: Library<73>-Footnote-345343988 +Ref: Library<73>-Footnote-355344054 +Ref: Library<73>-Footnote-365344120 +Ref: Library<73>-Footnote-375344186 +Ref: Library<73>-Footnote-385344252 +Ref: Library<73>-Footnote-395344318 +Ref: Library<73>-Footnote-405344384 +Ref: Library<73>-Footnote-415344450 +Ref: Library<73>-Footnote-425344516 +Ref: Library<73>-Footnote-435344582 +Ref: Library<73>-Footnote-445344648 +Ref: Library<73>-Footnote-455344714 +Ref: Library<73>-Footnote-465344780 +Ref: Library<73>-Footnote-475344846 +Ref: Library<73>-Footnote-485344912 +Ref: Library<73>-Footnote-495344978 +Ref: Library<73>-Footnote-505345044 +Ref: Library<73>-Footnote-515345110 +Ref: Library<73>-Footnote-525345176 +Ref: Library<73>-Footnote-535345242 +Ref: Library<73>-Footnote-545345308 +Ref: Library<73>-Footnote-555345374 +Ref: Library<73>-Footnote-565345439 +Ref: Library<73>-Footnote-575345505 +Ref: Library<73>-Footnote-585345571 +Ref: Library<73>-Footnote-595345637 +Ref: Library<73>-Footnote-605345703 +Node: IDLE<52>5345769 +Ref: whatsnew/changelog id6395345884 +Ref: 1afb5345884 +Ref: IDLE<52>-Footnote-15346889 +Ref: IDLE<52>-Footnote-25346954 +Ref: IDLE<52>-Footnote-35347019 +Ref: IDLE<52>-Footnote-45347084 +Ref: IDLE<52>-Footnote-55347149 +Ref: IDLE<52>-Footnote-65347214 +Node: C API<63>5347279 +Ref: whatsnew/changelog id6405347392 +Ref: 1afc5347392 +Ref: C API<63>-Footnote-15347580 +Node: Build<69>5347645 +Ref: whatsnew/changelog id6415347767 +Ref: 1afd5347767 +Ref: Build<69>-Footnote-15348576 +Ref: Build<69>-Footnote-25348641 +Ref: Build<69>-Footnote-35348706 +Ref: Build<69>-Footnote-45348771 +Ref: Build<69>-Footnote-55348836 +Node: Documentation<66>5348901 +Ref: whatsnew/changelog id6425349029 +Ref: 1afe5349029 +Ref: Documentation<66>-Footnote-15349758 +Ref: Documentation<66>-Footnote-25349823 +Ref: Documentation<66>-Footnote-35349888 +Node: Tools/Demos<38>5349953 +Ref: whatsnew/changelog id6435350081 +Ref: 1aff5350081 +Ref: Tools/Demos<38>-Footnote-15350271 +Node: Tests<66>5350336 +Ref: whatsnew/changelog id6445350458 +Ref: 1b005350458 +Ref: Tests<66>-Footnote-15351119 +Ref: Tests<66>-Footnote-25351184 +Node: Windows<63>5351249 +Ref: whatsnew/changelog id6455351347 +Ref: 1b015351347 +Ref: Windows<63>-Footnote-15351791 +Ref: Windows<63>-Footnote-25351856 +Node: Python 3 6 1 final5351921 +Ref: whatsnew/changelog python-3-6-1-final5352067 +Ref: 1b025352067 +Node: Core and Builtins<73>5352224 +Ref: whatsnew/changelog id6465352318 +Ref: 1b035352318 +Ref: Core and Builtins<73>-Footnote-15352937 +Ref: Core and Builtins<73>-Footnote-25353002 +Node: Build<70>5353067 +Ref: whatsnew/changelog id6475353161 +Ref: 1b045353161 +Ref: Build<70>-Footnote-15353343 +Node: Python 3 6 1 release candidate 15353408 +Ref: whatsnew/changelog python-3-6-1-release-candidate-15353540 +Ref: 1b055353540 +Node: Core and Builtins<74>5353867 +Ref: whatsnew/changelog id6485353977 +Ref: 1b065353977 +Ref: Core and Builtins<74>-Footnote-15356809 +Ref: Core and Builtins<74>-Footnote-25356874 +Ref: Core and Builtins<74>-Footnote-35356939 +Ref: Core and Builtins<74>-Footnote-45357004 +Ref: Core and Builtins<74>-Footnote-55357069 +Ref: Core and Builtins<74>-Footnote-65357134 +Ref: Core and Builtins<74>-Footnote-75357199 +Ref: Core and Builtins<74>-Footnote-85357264 +Ref: Core and Builtins<74>-Footnote-95357329 +Ref: Core and Builtins<74>-Footnote-105357394 +Ref: Core and Builtins<74>-Footnote-115357460 +Ref: Core and Builtins<74>-Footnote-125357526 +Ref: Core and Builtins<74>-Footnote-135357592 +Ref: Core and Builtins<74>-Footnote-145357658 +Ref: Core and Builtins<74>-Footnote-155357724 +Ref: Core and Builtins<74>-Footnote-165357790 +Ref: Core and Builtins<74>-Footnote-175357856 +Ref: Core and Builtins<74>-Footnote-185357922 +Ref: Core and Builtins<74>-Footnote-195357988 +Ref: Core and Builtins<74>-Footnote-205358054 +Ref: Core and Builtins<74>-Footnote-215358120 +Ref: Core and Builtins<74>-Footnote-225358186 +Node: Library<74>5358252 +Ref: whatsnew/changelog id6495358379 +Ref: 1b075358379 +Ref: Library<74>-Footnote-15364026 +Ref: Library<74>-Footnote-25364091 +Ref: Library<74>-Footnote-35364156 +Ref: Library<74>-Footnote-45364221 +Ref: Library<74>-Footnote-55364286 +Ref: Library<74>-Footnote-65364351 +Ref: Library<74>-Footnote-75364416 +Ref: Library<74>-Footnote-85364481 +Ref: Library<74>-Footnote-95364546 +Ref: Library<74>-Footnote-105364611 +Ref: Library<74>-Footnote-115364677 +Ref: Library<74>-Footnote-125364743 +Ref: Library<74>-Footnote-135364809 +Ref: Library<74>-Footnote-145364875 +Ref: Library<74>-Footnote-155364941 +Ref: Library<74>-Footnote-165365007 +Ref: Library<74>-Footnote-175365073 +Ref: Library<74>-Footnote-185365139 +Ref: Library<74>-Footnote-195365205 +Ref: Library<74>-Footnote-205365271 +Ref: Library<74>-Footnote-215365337 +Ref: Library<74>-Footnote-225365403 +Ref: Library<74>-Footnote-235365469 +Ref: Library<74>-Footnote-245365535 +Ref: Library<74>-Footnote-255365601 +Ref: Library<74>-Footnote-265365667 +Ref: Library<74>-Footnote-275365733 +Ref: Library<74>-Footnote-285365776 +Ref: Library<74>-Footnote-295365842 +Ref: Library<74>-Footnote-305365908 +Ref: Library<74>-Footnote-315365974 +Ref: Library<74>-Footnote-325366040 +Ref: Library<74>-Footnote-335366106 +Ref: Library<74>-Footnote-345366172 +Ref: Library<74>-Footnote-355366238 +Ref: Library<74>-Footnote-365366303 +Ref: Library<74>-Footnote-375366369 +Ref: Library<74>-Footnote-385366435 +Ref: Library<74>-Footnote-395366501 +Ref: Library<74>-Footnote-405366567 +Ref: Library<74>-Footnote-415366633 +Ref: Library<74>-Footnote-425366699 +Ref: Library<74>-Footnote-435366765 +Ref: Library<74>-Footnote-445366831 +Node: IDLE<53>5366897 +Ref: whatsnew/changelog id6505367014 +Ref: 1b085367014 +Ref: IDLE<53>-Footnote-15367303 +Ref: IDLE<53>-Footnote-25367368 +Node: Windows<64>5367433 +Ref: whatsnew/changelog id6515367548 +Ref: 1b095367548 +Ref: Windows<64>-Footnote-15368195 +Ref: Windows<64>-Footnote-25368260 +Ref: Windows<64>-Footnote-35368325 +Ref: Windows<64>-Footnote-45368390 +Ref: Windows<64>-Footnote-55368455 +Ref: Windows<64>-Footnote-65368497 +Ref: Windows<64>-Footnote-75368562 +Ref: Windows<64>-Footnote-85368627 +Node: C API<64>5368692 +Ref: whatsnew/changelog id6525368816 +Ref: 1b0a5368816 +Ref: C API<64>-Footnote-15369642 +Ref: C API<64>-Footnote-25369707 +Ref: C API<64>-Footnote-35369772 +Node: Documentation<67>5369837 +Ref: whatsnew/changelog id6535369959 +Ref: 1b0b5369959 +Ref: Documentation<67>-Footnote-15370496 +Ref: Documentation<67>-Footnote-25370561 +Ref: Documentation<67>-Footnote-35370626 +Ref: Documentation<67>-Footnote-45370691 +Node: Tests<67>5370756 +Ref: whatsnew/changelog id6545370878 +Ref: 1b0c5370878 +Ref: Tests<67>-Footnote-15371863 +Ref: Tests<67>-Footnote-25371928 +Ref: Tests<67>-Footnote-35371993 +Ref: Tests<67>-Footnote-45372058 +Ref: Tests<67>-Footnote-55372123 +Node: Build<71>5372188 +Ref: whatsnew/changelog id6555372284 +Ref: 1b0d5372284 +Ref: Build<71>-Footnote-15373545 +Ref: Build<71>-Footnote-25373610 +Ref: Build<71>-Footnote-35373675 +Ref: Build<71>-Footnote-45373740 +Ref: Build<71>-Footnote-55373805 +Ref: Build<71>-Footnote-65373870 +Ref: Build<71>-Footnote-75373935 +Ref: Build<71>-Footnote-85374000 +Ref: Build<71>-Footnote-95374065 +Ref: Build<71>-Footnote-105374130 +Node: Python 3 6 0 final5374196 +Ref: whatsnew/changelog python-3-6-0-final5374342 +Ref: 1b0e5374342 +Node: Python 3 6 0 release candidate 25374463 +Ref: whatsnew/changelog python-3-6-0-release-candidate-25374609 +Ref: 1b0f5374609 +Node: Core and Builtins<75>5374850 +Ref: whatsnew/changelog id6565374964 +Ref: 1b105374964 +Ref: Core and Builtins<75>-Footnote-15375349 +Ref: Core and Builtins<75>-Footnote-25375414 +Node: Tools/Demos<39>5375479 +Ref: whatsnew/changelog id6575375613 +Ref: 1b115375613 +Ref: Tools/Demos<39>-Footnote-15375747 +Node: Windows<65>5375812 +Ref: whatsnew/changelog id6585375934 +Ref: 1b125375934 +Ref: Windows<65>-Footnote-15376060 +Node: Build<72>5376125 +Ref: whatsnew/changelog id6595376223 +Ref: 1b135376223 +Ref: Build<72>-Footnote-15376378 +Node: Python 3 6 0 release candidate 15376443 +Ref: whatsnew/changelog python-3-6-0-release-candidate-15376590 +Ref: 1b145376590 +Node: Core and Builtins<76>5376867 +Ref: whatsnew/changelog id6605376977 +Ref: 1b155376977 +Ref: Core and Builtins<76>-Footnote-15377786 +Ref: Core and Builtins<76>-Footnote-25377851 +Ref: Core and Builtins<76>-Footnote-35377916 +Ref: Core and Builtins<76>-Footnote-45377981 +Node: Library<75>5378046 +Ref: whatsnew/changelog id6615378174 +Ref: 1b165378174 +Ref: Library<75>-Footnote-15379213 +Ref: Library<75>-Footnote-25379278 +Ref: Library<75>-Footnote-35379343 +Ref: Library<75>-Footnote-45379408 +Ref: Library<75>-Footnote-55379473 +Ref: Library<75>-Footnote-65379538 +Node: C API<65>5379603 +Ref: whatsnew/changelog id6625379727 +Ref: 1b175379727 +Ref: C API<65>-Footnote-15379885 +Node: Documentation<68>5379950 +Ref: whatsnew/changelog id6635380078 +Ref: 1b185380078 +Ref: Documentation<68>-Footnote-15380418 +Ref: Documentation<68>-Footnote-25380483 +Node: Tools/Demos<40>5380525 +Ref: whatsnew/changelog id6645380635 +Ref: 1b195380635 +Ref: Tools/Demos<40>-Footnote-15380801 +Node: Python 3 6 0 beta 45380866 +Ref: whatsnew/changelog python-3-6-0-beta-45381000 +Ref: 1b1a5381000 +Node: Core and Builtins<77>5381239 +Ref: whatsnew/changelog id6655381336 +Ref: 1b1b5381336 +Ref: Core and Builtins<77>-Footnote-15382888 +Ref: Core and Builtins<77>-Footnote-25382953 +Ref: Core and Builtins<77>-Footnote-35383018 +Ref: Core and Builtins<77>-Footnote-45383083 +Ref: Core and Builtins<77>-Footnote-55383148 +Ref: Core and Builtins<77>-Footnote-65383213 +Ref: Core and Builtins<77>-Footnote-75383278 +Ref: Core and Builtins<77>-Footnote-85383343 +Ref: Core and Builtins<77>-Footnote-95383408 +Ref: Core and Builtins<77>-Footnote-105383473 +Ref: Core and Builtins<77>-Footnote-115383539 +Node: Library<76>5383605 +Ref: whatsnew/changelog id6665383728 +Ref: 1b1c5383728 +Ref: Library<76>-Footnote-15385730 +Ref: Library<76>-Footnote-25385795 +Ref: Library<76>-Footnote-35385860 +Ref: Library<76>-Footnote-45385925 +Ref: Library<76>-Footnote-55385990 +Ref: Library<76>-Footnote-65386055 +Ref: Library<76>-Footnote-75386120 +Ref: Library<76>-Footnote-85386185 +Ref: Library<76>-Footnote-95386250 +Ref: Library<76>-Footnote-105386315 +Ref: Library<76>-Footnote-115386381 +Ref: Library<76>-Footnote-125386447 +Ref: Library<76>-Footnote-135386513 +Ref: Library<76>-Footnote-145386579 +Ref: Library<76>-Footnote-155386645 +Ref: Library<76>-Footnote-165386711 +Ref: Library<76>-Footnote-175386777 +Ref: Library<76>-Footnote-185386843 +Node: Documentation<69>5386909 +Ref: whatsnew/changelog id6675387020 +Ref: 1b1d5387020 +Ref: Documentation<69>-Footnote-15387171 +Node: Tests<68>5387236 +Ref: whatsnew/changelog id6685387345 +Ref: 1b1e5387345 +Ref: Tests<68>-Footnote-15387607 +Ref: Tests<68>-Footnote-25387672 +Node: Build<73>5387737 +Ref: whatsnew/changelog id6695387820 +Ref: 1b1f5387820 +Ref: Build<73>-Footnote-15388183 +Ref: Build<73>-Footnote-25388248 +Ref: Build<73>-Footnote-35388313 +Node: Python 3 6 0 beta 35388378 +Ref: whatsnew/changelog python-3-6-0-beta-35388499 +Ref: 1b205388499 +Node: Core and Builtins<78>5388726 +Ref: whatsnew/changelog id6705388823 +Ref: 1b215388823 +Ref: Core and Builtins<78>-Footnote-15389730 +Ref: Core and Builtins<78>-Footnote-25389795 +Ref: Core and Builtins<78>-Footnote-35389860 +Ref: Core and Builtins<78>-Footnote-45389925 +Ref: Core and Builtins<78>-Footnote-55389990 +Ref: Core and Builtins<78>-Footnote-65390055 +Ref: Core and Builtins<78>-Footnote-75390120 +Node: Library<77>5390185 +Ref: whatsnew/changelog id6715390302 +Ref: 1b225390302 +Ref: Library<77>-Footnote-15393349 +Ref: Library<77>-Footnote-25393414 +Ref: Library<77>-Footnote-35393479 +Ref: Library<77>-Footnote-45393544 +Ref: Library<77>-Footnote-55393609 +Ref: Library<77>-Footnote-65393674 +Ref: Library<77>-Footnote-75393739 +Ref: Library<77>-Footnote-85393804 +Ref: Library<77>-Footnote-95393869 +Ref: Library<77>-Footnote-105393934 +Ref: Library<77>-Footnote-115394000 +Ref: Library<77>-Footnote-125394066 +Ref: Library<77>-Footnote-135394132 +Ref: Library<77>-Footnote-145394198 +Ref: Library<77>-Footnote-155394264 +Ref: Library<77>-Footnote-165394330 +Ref: Library<77>-Footnote-175394396 +Ref: Library<77>-Footnote-185394462 +Ref: Library<77>-Footnote-195394528 +Ref: Library<77>-Footnote-205394594 +Ref: Library<77>-Footnote-215394660 +Ref: Library<77>-Footnote-225394726 +Ref: Library<77>-Footnote-235394792 +Ref: Library<77>-Footnote-245394858 +Node: Windows<66>5394924 +Ref: whatsnew/changelog id6725395029 +Ref: 1b235395029 +Ref: Windows<66>-Footnote-15395173 +Node: Build<74>5395238 +Ref: whatsnew/changelog id6735395341 +Ref: 1b245395341 +Ref: Build<74>-Footnote-15395660 +Ref: Build<74>-Footnote-25395725 +Ref: Build<74>-Footnote-35395790 +Node: Tests<69>5395855 +Ref: whatsnew/changelog id6745395938 +Ref: 1b255395938 +Ref: Tests<69>-Footnote-15396197 +Ref: Tests<69>-Footnote-25396262 +Node: Python 3 6 0 beta 25396327 +Ref: whatsnew/changelog python-3-6-0-beta-25396448 +Ref: 1b265396448 +Node: Core and Builtins<79>5396695 +Ref: whatsnew/changelog id6755396792 +Ref: 1b275396792 +Ref: Core and Builtins<79>-Footnote-15399536 +Ref: Core and Builtins<79>-Footnote-25399601 +Ref: Core and Builtins<79>-Footnote-35399666 +Ref: Core and Builtins<79>-Footnote-45399731 +Ref: Core and Builtins<79>-Footnote-55399796 +Ref: Core and Builtins<79>-Footnote-65399861 +Ref: Core and Builtins<79>-Footnote-75399926 +Ref: Core and Builtins<79>-Footnote-85399991 +Ref: Core and Builtins<79>-Footnote-95400056 +Ref: Core and Builtins<79>-Footnote-105400121 +Ref: Core and Builtins<79>-Footnote-115400187 +Ref: Core and Builtins<79>-Footnote-125400253 +Ref: Core and Builtins<79>-Footnote-135400319 +Ref: Core and Builtins<79>-Footnote-145400385 +Ref: Core and Builtins<79>-Footnote-155400451 +Ref: Core and Builtins<79>-Footnote-165400517 +Ref: Core and Builtins<79>-Footnote-175400583 +Ref: Core and Builtins<79>-Footnote-185400649 +Ref: Core and Builtins<79>-Footnote-195400715 +Ref: Core and Builtins<79>-Footnote-205400781 +Ref: Core and Builtins<79>-Footnote-215400847 +Ref: Core and Builtins<79>-Footnote-225400913 +Ref: Core and Builtins<79>-Footnote-235400979 +Node: Library<78>5401045 +Ref: whatsnew/changelog id6765401162 +Ref: 1b285401162 +Ref: Library<78>-Footnote-15406952 +Ref: Library<78>-Footnote-25407017 +Ref: Library<78>-Footnote-35407082 +Ref: Library<78>-Footnote-45407147 +Ref: Library<78>-Footnote-55407212 +Ref: Library<78>-Footnote-65407277 +Ref: Library<78>-Footnote-75407342 +Ref: Library<78>-Footnote-85407407 +Ref: Library<78>-Footnote-95407472 +Ref: Library<78>-Footnote-105407537 +Ref: Library<78>-Footnote-115407603 +Ref: Library<78>-Footnote-125407669 +Ref: Library<78>-Footnote-135407735 +Ref: Library<78>-Footnote-145407801 +Ref: Library<78>-Footnote-155407867 +Ref: Library<78>-Footnote-165407933 +Ref: Library<78>-Footnote-175407999 +Ref: Library<78>-Footnote-185408065 +Ref: Library<78>-Footnote-195408131 +Ref: Library<78>-Footnote-205408197 +Ref: Library<78>-Footnote-215408263 +Ref: Library<78>-Footnote-225408329 +Ref: Library<78>-Footnote-235408395 +Ref: Library<78>-Footnote-245408461 +Ref: Library<78>-Footnote-255408527 +Ref: Library<78>-Footnote-265408593 +Ref: Library<78>-Footnote-275408659 +Ref: Library<78>-Footnote-285408725 +Ref: Library<78>-Footnote-295408791 +Ref: Library<78>-Footnote-305408857 +Ref: Library<78>-Footnote-315408923 +Ref: Library<78>-Footnote-325408989 +Ref: Library<78>-Footnote-335409055 +Ref: Library<78>-Footnote-345409121 +Ref: Library<78>-Footnote-355409187 +Ref: Library<78>-Footnote-365409253 +Ref: Library<78>-Footnote-375409319 +Ref: Library<78>-Footnote-385409385 +Ref: Library<78>-Footnote-395409451 +Ref: Library<78>-Footnote-405409517 +Ref: Library<78>-Footnote-415409583 +Ref: Library<78>-Footnote-425409649 +Ref: Library<78>-Footnote-435409715 +Ref: Library<78>-Footnote-445409781 +Ref: Library<78>-Footnote-455409847 +Ref: Library<78>-Footnote-465409913 +Ref: Library<78>-Footnote-475409979 +Ref: Library<78>-Footnote-485410045 +Node: Windows<67>5410111 +Ref: whatsnew/changelog id6775410216 +Ref: 1b295410216 +Ref: Windows<67>-Footnote-15411027 +Ref: Windows<67>-Footnote-25411092 +Ref: Windows<67>-Footnote-35411157 +Ref: Windows<67>-Footnote-45411222 +Ref: Windows<67>-Footnote-55411287 +Ref: Windows<67>-Footnote-65411352 +Ref: Windows<67>-Footnote-75411417 +Ref: Windows<67>-Footnote-85411482 +Ref: Windows<67>-Footnote-95411547 +Ref: Windows<67>-Footnote-105411612 +Node: C API<66>5411678 +Ref: whatsnew/changelog id6785411781 +Ref: 1b2a5411781 +Ref: C API<66>-Footnote-15412035 +Node: Build<75>5412100 +Ref: whatsnew/changelog id6795412201 +Ref: 1b2b5412201 +Ref: Build<75>-Footnote-15412627 +Ref: Build<75>-Footnote-25412692 +Ref: Build<75>-Footnote-35412757 +Node: Tests<70>5412822 +Ref: whatsnew/changelog id6805412905 +Ref: 1b2c5412905 +Ref: Tests<70>-Footnote-15413042 +Node: Python 3 6 0 beta 15413107 +Ref: whatsnew/changelog python-3-6-0-beta-15413229 +Ref: 1b2d5413229 +Node: Core and Builtins<80>5413526 +Ref: whatsnew/changelog id6815413623 +Ref: 1b2e5413623 +Ref: Core and Builtins<80>-Footnote-15419822 +Ref: Core and Builtins<80>-Footnote-25419887 +Ref: Core and Builtins<80>-Footnote-35419952 +Ref: Core and Builtins<80>-Footnote-45420017 +Ref: Core and Builtins<80>-Footnote-55420059 +Ref: Core and Builtins<80>-Footnote-65420124 +Ref: Core and Builtins<80>-Footnote-75420189 +Ref: Core and Builtins<80>-Footnote-85420254 +Ref: Core and Builtins<80>-Footnote-95420319 +Ref: Core and Builtins<80>-Footnote-105420384 +Ref: Core and Builtins<80>-Footnote-115420450 +Ref: Core and Builtins<80>-Footnote-125420516 +Ref: Core and Builtins<80>-Footnote-135420582 +Ref: Core and Builtins<80>-Footnote-145420625 +Ref: Core and Builtins<80>-Footnote-155420691 +Ref: Core and Builtins<80>-Footnote-165420757 +Ref: Core and Builtins<80>-Footnote-175420800 +Ref: Core and Builtins<80>-Footnote-185420866 +Ref: Core and Builtins<80>-Footnote-195420909 +Ref: Core and Builtins<80>-Footnote-205420975 +Ref: Core and Builtins<80>-Footnote-215421041 +Ref: Core and Builtins<80>-Footnote-225421107 +Ref: Core and Builtins<80>-Footnote-235421173 +Ref: Core and Builtins<80>-Footnote-245421239 +Ref: Core and Builtins<80>-Footnote-255421305 +Ref: Core and Builtins<80>-Footnote-265421371 +Ref: Core and Builtins<80>-Footnote-275421437 +Ref: Core and Builtins<80>-Footnote-285421480 +Ref: Core and Builtins<80>-Footnote-295421546 +Ref: Core and Builtins<80>-Footnote-305421612 +Ref: Core and Builtins<80>-Footnote-315421678 +Ref: Core and Builtins<80>-Footnote-325421744 +Ref: Core and Builtins<80>-Footnote-335421810 +Ref: Core and Builtins<80>-Footnote-345421876 +Ref: Core and Builtins<80>-Footnote-355421942 +Ref: Core and Builtins<80>-Footnote-365422008 +Ref: Core and Builtins<80>-Footnote-375422074 +Ref: Core and Builtins<80>-Footnote-385422140 +Ref: Core and Builtins<80>-Footnote-395422206 +Ref: Core and Builtins<80>-Footnote-405422272 +Ref: Core and Builtins<80>-Footnote-415422338 +Ref: Core and Builtins<80>-Footnote-425422404 +Ref: Core and Builtins<80>-Footnote-435422470 +Ref: Core and Builtins<80>-Footnote-445422536 +Ref: Core and Builtins<80>-Footnote-455422602 +Ref: Core and Builtins<80>-Footnote-465422668 +Ref: Core and Builtins<80>-Footnote-475422711 +Node: Library<79>5422777 +Ref: whatsnew/changelog id6825422891 +Ref: 1b2f5422891 +Ref: Library<79>-Footnote-15433883 +Ref: Library<79>-Footnote-25433948 +Ref: Library<79>-Footnote-35434013 +Ref: Library<79>-Footnote-45434078 +Ref: Library<79>-Footnote-55434143 +Ref: Library<79>-Footnote-65434208 +Ref: Library<79>-Footnote-75434273 +Ref: Library<79>-Footnote-85434338 +Ref: Library<79>-Footnote-95434403 +Ref: Library<79>-Footnote-105434468 +Ref: Library<79>-Footnote-115434534 +Ref: Library<79>-Footnote-125434600 +Ref: Library<79>-Footnote-135434666 +Ref: Library<79>-Footnote-145434732 +Ref: Library<79>-Footnote-155434798 +Ref: Library<79>-Footnote-165434864 +Ref: Library<79>-Footnote-175434930 +Ref: Library<79>-Footnote-185434998 +Ref: Library<79>-Footnote-195435064 +Ref: Library<79>-Footnote-205435130 +Ref: Library<79>-Footnote-215435196 +Ref: Library<79>-Footnote-225435262 +Ref: Library<79>-Footnote-235435328 +Ref: Library<79>-Footnote-245435394 +Ref: Library<79>-Footnote-255435460 +Ref: Library<79>-Footnote-265435527 +Ref: Library<79>-Footnote-275435593 +Ref: Library<79>-Footnote-285435659 +Ref: Library<79>-Footnote-295435725 +Ref: Library<79>-Footnote-305435791 +Ref: Library<79>-Footnote-315435857 +Ref: Library<79>-Footnote-325435923 +Ref: Library<79>-Footnote-335435989 +Ref: Library<79>-Footnote-345436055 +Ref: Library<79>-Footnote-355436121 +Ref: Library<79>-Footnote-365436187 +Ref: Library<79>-Footnote-375436253 +Ref: Library<79>-Footnote-385436319 +Ref: Library<79>-Footnote-395436385 +Ref: Library<79>-Footnote-405436451 +Ref: Library<79>-Footnote-415436517 +Ref: Library<79>-Footnote-425436583 +Ref: Library<79>-Footnote-435436626 +Ref: Library<79>-Footnote-445436692 +Ref: Library<79>-Footnote-455436735 +Ref: Library<79>-Footnote-465436801 +Ref: Library<79>-Footnote-475436867 +Ref: Library<79>-Footnote-485436933 +Ref: Library<79>-Footnote-495436999 +Ref: Library<79>-Footnote-505437065 +Ref: Library<79>-Footnote-515437131 +Ref: Library<79>-Footnote-525437197 +Ref: Library<79>-Footnote-535437263 +Ref: Library<79>-Footnote-545437319 +Ref: Library<79>-Footnote-555437385 +Ref: Library<79>-Footnote-565437451 +Ref: Library<79>-Footnote-575437517 +Ref: Library<79>-Footnote-585437583 +Ref: Library<79>-Footnote-595437649 +Ref: Library<79>-Footnote-605437715 +Ref: Library<79>-Footnote-615437781 +Ref: Library<79>-Footnote-625437847 +Ref: Library<79>-Footnote-635437913 +Ref: Library<79>-Footnote-645437979 +Ref: Library<79>-Footnote-655438045 +Ref: Library<79>-Footnote-665438111 +Ref: Library<79>-Footnote-675438177 +Ref: Library<79>-Footnote-685438243 +Ref: Library<79>-Footnote-695438309 +Ref: Library<79>-Footnote-705438375 +Ref: Library<79>-Footnote-715438441 +Ref: Library<79>-Footnote-725438507 +Ref: Library<79>-Footnote-735438573 +Ref: Library<79>-Footnote-745438639 +Ref: Library<79>-Footnote-755438705 +Ref: Library<79>-Footnote-765438771 +Ref: Library<79>-Footnote-775438836 +Ref: Library<79>-Footnote-785438901 +Ref: Library<79>-Footnote-795438967 +Ref: Library<79>-Footnote-805439033 +Ref: Library<79>-Footnote-815439098 +Ref: Library<79>-Footnote-825439164 +Node: IDLE<54>5439230 +Ref: whatsnew/changelog id6835439332 +Ref: 1b305439332 +Ref: IDLE<54>-Footnote-15440098 +Ref: IDLE<54>-Footnote-25440163 +Ref: IDLE<54>-Footnote-35440228 +Ref: IDLE<54>-Footnote-45440293 +Ref: IDLE<54>-Footnote-55440358 +Ref: IDLE<54>-Footnote-65440423 +Node: C API<67>5440488 +Ref: whatsnew/changelog id6845440588 +Ref: 1b315440588 +Ref: C API<67>-Footnote-15440860 +Ref: C API<67>-Footnote-25440925 +Node: Tests<71>5440990 +Ref: whatsnew/changelog id6855441091 +Ref: 1b325441091 +Ref: Tests<71>-Footnote-15441611 +Ref: Tests<71>-Footnote-25441676 +Ref: Tests<71>-Footnote-35441741 +Ref: Tests<71>-Footnote-45441806 +Node: Build<76>5441871 +Ref: whatsnew/changelog id6865441978 +Ref: 1b335441978 +Ref: Build<76>-Footnote-15443363 +Ref: Build<76>-Footnote-25443428 +Ref: Build<76>-Footnote-35443493 +Ref: Build<76>-Footnote-45443558 +Ref: Build<76>-Footnote-55443623 +Ref: Build<76>-Footnote-65443688 +Ref: Build<76>-Footnote-75443753 +Ref: Build<76>-Footnote-85443818 +Ref: Build<76>-Footnote-95443883 +Ref: Build<76>-Footnote-105443948 +Ref: Build<76>-Footnote-115444014 +Node: Tools/Demos<41>5444080 +Ref: whatsnew/changelog id6875444189 +Ref: 1b345444189 +Ref: Tools/Demos<41>-Footnote-15444468 +Node: Windows<68>5444533 +Ref: whatsnew/changelog id6885444624 +Ref: 1b355444624 +Ref: Windows<68>-Footnote-15445593 +Ref: Windows<68>-Footnote-25445658 +Ref: Windows<68>-Footnote-35445723 +Ref: Windows<68>-Footnote-45445787 +Ref: Windows<68>-Footnote-55445852 +Ref: Windows<68>-Footnote-65445917 +Ref: Windows<68>-Footnote-75445981 +Ref: Windows<68>-Footnote-85446046 +Ref: Windows<68>-Footnote-95446111 +Ref: Windows<68>-Footnote-105446176 +Ref: Windows<68>-Footnote-115446242 +Node: Python 3 6 0 alpha 45446308 +Ref: whatsnew/changelog python-3-6-0-alpha-45446431 +Ref: 1b365446431 +Node: Core and Builtins<81>5446678 +Ref: whatsnew/changelog id6895446776 +Ref: 1b375446776 +Ref: Core and Builtins<81>-Footnote-15448734 +Ref: Core and Builtins<81>-Footnote-25448799 +Ref: Core and Builtins<81>-Footnote-35448864 +Ref: Core and Builtins<81>-Footnote-45448929 +Ref: Core and Builtins<81>-Footnote-55448994 +Ref: Core and Builtins<81>-Footnote-65449059 +Ref: Core and Builtins<81>-Footnote-75449124 +Ref: Core and Builtins<81>-Footnote-85449189 +Ref: Core and Builtins<81>-Footnote-95449254 +Ref: Core and Builtins<81>-Footnote-105449318 +Ref: Core and Builtins<81>-Footnote-115449384 +Ref: Core and Builtins<81>-Footnote-125449450 +Ref: Core and Builtins<81>-Footnote-135449516 +Ref: Core and Builtins<81>-Footnote-145449582 +Node: Library<80>5449625 +Ref: whatsnew/changelog id6905449740 +Ref: 1b385449740 +Ref: Library<80>-Footnote-15454253 +Ref: Library<80>-Footnote-25454318 +Ref: Library<80>-Footnote-35454360 +Ref: Library<80>-Footnote-45454425 +Ref: Library<80>-Footnote-55454490 +Ref: Library<80>-Footnote-65454555 +Ref: Library<80>-Footnote-75454620 +Ref: Library<80>-Footnote-85454685 +Ref: Library<80>-Footnote-95454750 +Ref: Library<80>-Footnote-105454815 +Ref: Library<80>-Footnote-115454881 +Ref: Library<80>-Footnote-125454924 +Ref: Library<80>-Footnote-135454990 +Ref: Library<80>-Footnote-145455056 +Ref: Library<80>-Footnote-155455122 +Ref: Library<80>-Footnote-165455188 +Ref: Library<80>-Footnote-175455253 +Ref: Library<80>-Footnote-185455319 +Ref: Library<80>-Footnote-195455385 +Ref: Library<80>-Footnote-205455451 +Ref: Library<80>-Footnote-215455517 +Ref: Library<80>-Footnote-225455583 +Ref: Library<80>-Footnote-235455649 +Ref: Library<80>-Footnote-245455715 +Ref: Library<80>-Footnote-255455781 +Ref: Library<80>-Footnote-265455847 +Ref: Library<80>-Footnote-275455913 +Ref: Library<80>-Footnote-285455979 +Ref: Library<80>-Footnote-295456038 +Ref: Library<80>-Footnote-305456103 +Ref: Library<80>-Footnote-315456169 +Ref: Library<80>-Footnote-325456235 +Ref: Library<80>-Footnote-335456301 +Ref: Library<80>-Footnote-345456344 +Ref: Library<80>-Footnote-355456410 +Ref: Library<80>-Footnote-365456475 +Ref: Library<80>-Footnote-375456541 +Ref: Library<80>-Footnote-385456607 +Ref: Library<80>-Footnote-395456673 +Node: IDLE<55>5456739 +Ref: whatsnew/changelog id6915456842 +Ref: 1b395456842 +Ref: IDLE<55>-Footnote-15458166 +Ref: IDLE<55>-Footnote-25458231 +Ref: IDLE<55>-Footnote-35458296 +Ref: IDLE<55>-Footnote-45458361 +Ref: IDLE<55>-Footnote-55458426 +Ref: IDLE<55>-Footnote-65458491 +Ref: IDLE<55>-Footnote-75458556 +Ref: IDLE<55>-Footnote-85458621 +Node: Tests<72>5458686 +Ref: whatsnew/changelog id6925458789 +Ref: 1b3a5458789 +Ref: Tests<72>-Footnote-15459378 +Ref: Tests<72>-Footnote-25459443 +Ref: Tests<72>-Footnote-35459508 +Ref: Tests<72>-Footnote-45459573 +Node: Windows<69>5459638 +Ref: whatsnew/changelog id6935459742 +Ref: 1b3b5459742 +Ref: Windows<69>-Footnote-15460118 +Ref: Windows<69>-Footnote-25460183 +Ref: Windows<69>-Footnote-35460248 +Ref: Windows<69>-Footnote-45460290 +Ref: Windows<69>-Footnote-55460355 +Node: Build<77>5460420 +Ref: whatsnew/changelog id6945460506 +Ref: 1b3c5460506 +Ref: Build<77>-Footnote-15461407 +Ref: Build<77>-Footnote-25461472 +Ref: Build<77>-Footnote-35461537 +Ref: Build<77>-Footnote-45461602 +Ref: Build<77>-Footnote-55461667 +Ref: Build<77>-Footnote-65461732 +Node: Python 3 6 0 alpha 35461797 +Ref: whatsnew/changelog python-3-6-0-alpha-35461921 +Ref: 1b3d5461921 +Node: Security<46>5462258 +Ref: whatsnew/changelog id6955462357 +Ref: 1b3e5462357 +Ref: Security<46>-Footnote-15462735 +Ref: Security<46>-Footnote-25462800 +Node: Core and Builtins<82>5462865 +Ref: whatsnew/changelog id6965462984 +Ref: 1b3f5462984 +Ref: Core and Builtins<82>-Footnote-15463735 +Ref: Core and Builtins<82>-Footnote-25463800 +Ref: Core and Builtins<82>-Footnote-35463865 +Ref: Core and Builtins<82>-Footnote-45463930 +Node: Library<81>5463995 +Ref: whatsnew/changelog id6975464110 +Ref: 1b405464110 +Ref: Library<81>-Footnote-15468223 +Ref: Library<81>-Footnote-25468288 +Ref: Library<81>-Footnote-35468353 +Ref: Library<81>-Footnote-45468418 +Ref: Library<81>-Footnote-55468483 +Ref: Library<81>-Footnote-65468548 +Ref: Library<81>-Footnote-75468613 +Ref: Library<81>-Footnote-85468678 +Ref: Library<81>-Footnote-95468743 +Ref: Library<81>-Footnote-105468808 +Ref: Library<81>-Footnote-115468874 +Ref: Library<81>-Footnote-125468940 +Ref: Library<81>-Footnote-135469006 +Ref: Library<81>-Footnote-145469072 +Ref: Library<81>-Footnote-155469138 +Ref: Library<81>-Footnote-165469204 +Ref: Library<81>-Footnote-175469270 +Ref: Library<81>-Footnote-185469336 +Ref: Library<81>-Footnote-195469402 +Ref: Library<81>-Footnote-205469468 +Ref: Library<81>-Footnote-215469534 +Ref: Library<81>-Footnote-225469577 +Ref: Library<81>-Footnote-235469643 +Ref: Library<81>-Footnote-245469709 +Ref: Library<81>-Footnote-255469774 +Ref: Library<81>-Footnote-265469840 +Node: IDLE<56>5469906 +Ref: whatsnew/changelog id6985470009 +Ref: 1b415470009 +Ref: IDLE<56>-Footnote-15471675 +Ref: IDLE<56>-Footnote-25471740 +Ref: IDLE<56>-Footnote-35471805 +Ref: IDLE<56>-Footnote-45471870 +Ref: IDLE<56>-Footnote-55471935 +Ref: IDLE<56>-Footnote-65472000 +Ref: IDLE<56>-Footnote-75472065 +Ref: IDLE<56>-Footnote-85472130 +Ref: IDLE<56>-Footnote-95472195 +Ref: IDLE<56>-Footnote-105472260 +Node: C API<68>5472326 +Ref: whatsnew/changelog id6995472427 +Ref: 1b425472427 +Ref: C API<68>-Footnote-15472667 +Node: Build<78>5472732 +Ref: whatsnew/changelog id7005472840 +Ref: 1b435472840 +Ref: Build<78>-Footnote-15473817 +Ref: Build<78>-Footnote-25473882 +Ref: Build<78>-Footnote-35473947 +Ref: Build<78>-Footnote-45474012 +Ref: Build<78>-Footnote-55474077 +Node: Tools/Demos<42>5474142 +Ref: whatsnew/changelog id7015474258 +Ref: 1b445474258 +Ref: Tools/Demos<42>-Footnote-15474542 +Ref: Tools/Demos<42>-Footnote-25474607 +Node: Documentation<70>5474672 +Ref: whatsnew/changelog id7025474788 +Ref: 1b455474788 +Ref: Documentation<70>-Footnote-15475169 +Ref: Documentation<70>-Footnote-25475234 +Node: Tests<73>5475299 +Ref: whatsnew/changelog id7035475391 +Ref: 1b465475391 +Ref: Tests<73>-Footnote-15475559 +Node: Python 3 6 0 alpha 25475624 +Ref: whatsnew/changelog python-3-6-0-alpha-25475748 +Ref: 1b475475748 +Node: Security<47>5476109 +Ref: whatsnew/changelog id7045476208 +Ref: 1b485476208 +Ref: Security<47>-Footnote-15476699 +Ref: Security<47>-Footnote-25476764 +Ref: Security<47>-Footnote-35476819 +Ref: Security<47>-Footnote-45476874 +Node: Core and Builtins<83>5476939 +Ref: whatsnew/changelog id7055477058 +Ref: 1b495477058 +Ref: Core and Builtins<83>-Footnote-15478690 +Ref: Core and Builtins<83>-Footnote-25478755 +Ref: Core and Builtins<83>-Footnote-35478820 +Ref: Core and Builtins<83>-Footnote-45478885 +Ref: Core and Builtins<83>-Footnote-55478950 +Ref: Core and Builtins<83>-Footnote-65479015 +Ref: Core and Builtins<83>-Footnote-75479057 +Ref: Core and Builtins<83>-Footnote-85479122 +Ref: Core and Builtins<83>-Footnote-95479187 +Ref: Core and Builtins<83>-Footnote-105479252 +Ref: Core and Builtins<83>-Footnote-115479318 +Ref: Core and Builtins<83>-Footnote-125479384 +Node: Library<82>5479450 +Ref: whatsnew/changelog id7065479565 +Ref: 1b4a5479565 +Ref: Library<82>-Footnote-15484776 +Ref: Library<82>-Footnote-25484841 +Ref: Library<82>-Footnote-35484906 +Ref: Library<82>-Footnote-45484971 +Ref: Library<82>-Footnote-55485036 +Ref: Library<82>-Footnote-65485101 +Ref: Library<82>-Footnote-75485166 +Ref: Library<82>-Footnote-85485231 +Ref: Library<82>-Footnote-95485296 +Ref: Library<82>-Footnote-105485338 +Ref: Library<82>-Footnote-115485404 +Ref: Library<82>-Footnote-125485470 +Ref: Library<82>-Footnote-135485536 +Ref: Library<82>-Footnote-145485579 +Ref: Library<82>-Footnote-155485645 +Ref: Library<82>-Footnote-165485688 +Ref: Library<82>-Footnote-175485731 +Ref: Library<82>-Footnote-185485797 +Ref: Library<82>-Footnote-195485863 +Ref: Library<82>-Footnote-205485929 +Ref: Library<82>-Footnote-215485995 +Ref: Library<82>-Footnote-225486061 +Ref: Library<82>-Footnote-235486127 +Ref: Library<82>-Footnote-245486193 +Ref: Library<82>-Footnote-255486259 +Ref: Library<82>-Footnote-265486325 +Ref: Library<82>-Footnote-275486391 +Ref: Library<82>-Footnote-285486457 +Ref: Library<82>-Footnote-295486523 +Ref: Library<82>-Footnote-305486589 +Ref: Library<82>-Footnote-315486655 +Ref: Library<82>-Footnote-325486721 +Ref: Library<82>-Footnote-335486787 +Ref: Library<82>-Footnote-345486853 +Ref: Library<82>-Footnote-355486919 +Node: IDLE<57>5486985 +Ref: whatsnew/changelog id7075487096 +Ref: 1b4b5487096 +Ref: IDLE<57>-Footnote-15489749 +Ref: IDLE<57>-Footnote-25489813 +Ref: IDLE<57>-Footnote-35489878 +Ref: IDLE<57>-Footnote-45489943 +Ref: IDLE<57>-Footnote-55490008 +Ref: IDLE<57>-Footnote-65490073 +Ref: IDLE<57>-Footnote-75490138 +Ref: IDLE<57>-Footnote-85490203 +Ref: IDLE<57>-Footnote-95490268 +Ref: IDLE<57>-Footnote-105490333 +Ref: IDLE<57>-Footnote-115490399 +Ref: IDLE<57>-Footnote-125490465 +Ref: IDLE<57>-Footnote-135490531 +Ref: IDLE<57>-Footnote-145490597 +Ref: IDLE<57>-Footnote-155490663 +Ref: IDLE<57>-Footnote-165490729 +Ref: IDLE<57>-Footnote-175490795 +Ref: IDLE<57>-Footnote-185490861 +Ref: IDLE<57>-Footnote-195490927 +Node: Documentation<71>5490993 +Ref: whatsnew/changelog id7085491102 +Ref: 1b4c5491102 +Ref: Documentation<71>-Footnote-15491549 +Ref: Documentation<71>-Footnote-25491614 +Ref: Documentation<71>-Footnote-35491679 +Ref: Documentation<71>-Footnote-45491721 +Node: Tests<74>5491786 +Ref: whatsnew/changelog id7095491898 +Ref: 1b4d5491898 +Ref: Tests<74>-Footnote-15492278 +Ref: Tests<74>-Footnote-25492343 +Node: Windows<70>5492408 +Ref: whatsnew/changelog id7105492512 +Ref: 1b4e5492512 +Ref: Windows<70>-Footnote-15492922 +Ref: Windows<70>-Footnote-25492987 +Node: Build<79>5493052 +Ref: whatsnew/changelog id7115493156 +Ref: 1b4f5493156 +Ref: Build<79>-Footnote-15493433 +Ref: Build<79>-Footnote-25493498 +Node: C API<69>5493563 +Ref: whatsnew/changelog id7125493671 +Ref: 1b505493671 +Ref: C API<69>-Footnote-15493909 +Ref: C API<69>-Footnote-25493974 +Ref: C API<69>-Footnote-35494016 +Node: Tools/Demos<43>5494081 +Ref: whatsnew/changelog id7135494171 +Ref: 1b515494171 +Ref: Tools/Demos<43>-Footnote-15494369 +Node: Python 3 6 0 alpha 15494434 +Ref: whatsnew/changelog python-3-6-0-alpha-15494556 +Ref: 1b525494556 +Node: Security<48>5494917 +Ref: whatsnew/changelog id7145495016 +Ref: 1b535495016 +Ref: Security<48>-Footnote-15495507 +Ref: Security<48>-Footnote-25495572 +Ref: Security<48>-Footnote-35495637 +Node: Core and Builtins<84>5495702 +Ref: whatsnew/changelog id7155495821 +Ref: 1b545495821 +Ref: Core and Builtins<84>-Footnote-15509013 +Ref: Core and Builtins<84>-Footnote-25509078 +Ref: Core and Builtins<84>-Footnote-35509143 +Ref: Core and Builtins<84>-Footnote-45509208 +Ref: Core and Builtins<84>-Footnote-55509273 +Ref: Core and Builtins<84>-Footnote-65509338 +Ref: Core and Builtins<84>-Footnote-75509403 +Ref: Core and Builtins<84>-Footnote-85509468 +Ref: Core and Builtins<84>-Footnote-95509533 +Ref: Core and Builtins<84>-Footnote-105509598 +Ref: Core and Builtins<84>-Footnote-115509664 +Ref: Core and Builtins<84>-Footnote-125509730 +Ref: Core and Builtins<84>-Footnote-135509796 +Ref: Core and Builtins<84>-Footnote-145509862 +Ref: Core and Builtins<84>-Footnote-155509928 +Ref: Core and Builtins<84>-Footnote-165509994 +Ref: Core and Builtins<84>-Footnote-175510037 +Ref: Core and Builtins<84>-Footnote-185510103 +Ref: Core and Builtins<84>-Footnote-195510169 +Ref: Core and Builtins<84>-Footnote-205510235 +Ref: Core and Builtins<84>-Footnote-215510301 +Ref: Core and Builtins<84>-Footnote-225510367 +Ref: Core and Builtins<84>-Footnote-235510433 +Ref: Core and Builtins<84>-Footnote-245510476 +Ref: Core and Builtins<84>-Footnote-255510542 +Ref: Core and Builtins<84>-Footnote-265510608 +Ref: Core and Builtins<84>-Footnote-275510674 +Ref: Core and Builtins<84>-Footnote-285510740 +Ref: Core and Builtins<84>-Footnote-295510806 +Ref: Core and Builtins<84>-Footnote-305510872 +Ref: Core and Builtins<84>-Footnote-315510938 +Ref: Core and Builtins<84>-Footnote-325511004 +Ref: Core and Builtins<84>-Footnote-335511070 +Ref: Core and Builtins<84>-Footnote-345511136 +Ref: Core and Builtins<84>-Footnote-355511202 +Ref: Core and Builtins<84>-Footnote-365511268 +Ref: Core and Builtins<84>-Footnote-375511333 +Ref: Core and Builtins<84>-Footnote-385511399 +Ref: Core and Builtins<84>-Footnote-395511465 +Ref: Core and Builtins<84>-Footnote-405511531 +Ref: Core and Builtins<84>-Footnote-415511597 +Ref: Core and Builtins<84>-Footnote-425511663 +Ref: Core and Builtins<84>-Footnote-435511729 +Ref: Core and Builtins<84>-Footnote-445511795 +Ref: Core and Builtins<84>-Footnote-455511861 +Ref: Core and Builtins<84>-Footnote-465511927 +Ref: Core and Builtins<84>-Footnote-475511993 +Ref: Core and Builtins<84>-Footnote-485512059 +Ref: Core and Builtins<84>-Footnote-495512125 +Ref: Core and Builtins<84>-Footnote-505512191 +Ref: Core and Builtins<84>-Footnote-515512257 +Ref: Core and Builtins<84>-Footnote-525512323 +Ref: Core and Builtins<84>-Footnote-535512388 +Ref: Core and Builtins<84>-Footnote-545512454 +Ref: Core and Builtins<84>-Footnote-555512520 +Ref: Core and Builtins<84>-Footnote-565512586 +Ref: Core and Builtins<84>-Footnote-575512652 +Ref: Core and Builtins<84>-Footnote-585512718 +Ref: Core and Builtins<84>-Footnote-595512784 +Ref: Core and Builtins<84>-Footnote-605512850 +Ref: Core and Builtins<84>-Footnote-615512916 +Ref: Core and Builtins<84>-Footnote-625512982 +Ref: Core and Builtins<84>-Footnote-635513048 +Ref: Core and Builtins<84>-Footnote-645513114 +Ref: Core and Builtins<84>-Footnote-655513180 +Ref: Core and Builtins<84>-Footnote-665513246 +Ref: Core and Builtins<84>-Footnote-675513312 +Ref: Core and Builtins<84>-Footnote-685513378 +Ref: Core and Builtins<84>-Footnote-695513444 +Ref: Core and Builtins<84>-Footnote-705513510 +Ref: Core and Builtins<84>-Footnote-715513576 +Ref: Core and Builtins<84>-Footnote-725513642 +Ref: Core and Builtins<84>-Footnote-735513708 +Ref: Core and Builtins<84>-Footnote-745513774 +Ref: Core and Builtins<84>-Footnote-755513840 +Ref: Core and Builtins<84>-Footnote-765513906 +Ref: Core and Builtins<84>-Footnote-775513972 +Ref: Core and Builtins<84>-Footnote-785514038 +Ref: Core and Builtins<84>-Footnote-795514103 +Ref: Core and Builtins<84>-Footnote-805514169 +Ref: Core and Builtins<84>-Footnote-815514212 +Ref: Core and Builtins<84>-Footnote-825514278 +Ref: Core and Builtins<84>-Footnote-835514344 +Ref: Core and Builtins<84>-Footnote-845514410 +Ref: Core and Builtins<84>-Footnote-855514476 +Ref: Core and Builtins<84>-Footnote-865514542 +Ref: Core and Builtins<84>-Footnote-875514608 +Node: Library<83>5514674 +Ref: whatsnew/changelog id7165514789 +Ref: 1b565514789 +Ref: Library<83>-Footnote-15545859 +Ref: Library<83>-Footnote-25545924 +Ref: Library<83>-Footnote-35545989 +Ref: Library<83>-Footnote-45546054 +Ref: Library<83>-Footnote-55546119 +Ref: Library<83>-Footnote-65546184 +Ref: Library<83>-Footnote-75546249 +Ref: Library<83>-Footnote-85546314 +Ref: Library<83>-Footnote-95546379 +Ref: Library<83>-Footnote-105546444 +Ref: Library<83>-Footnote-115546510 +Ref: Library<83>-Footnote-125546576 +Ref: Library<83>-Footnote-135546642 +Ref: Library<83>-Footnote-145546708 +Ref: Library<83>-Footnote-155546774 +Ref: Library<83>-Footnote-165546840 +Ref: Library<83>-Footnote-175546906 +Ref: Library<83>-Footnote-185546972 +Ref: Library<83>-Footnote-195547015 +Ref: Library<83>-Footnote-205547081 +Ref: Library<83>-Footnote-215547147 +Ref: Library<83>-Footnote-225547213 +Ref: Library<83>-Footnote-235547279 +Ref: Library<83>-Footnote-245547345 +Ref: Library<83>-Footnote-255547411 +Ref: Library<83>-Footnote-265547477 +Ref: Library<83>-Footnote-275547543 +Ref: Library<83>-Footnote-285547609 +Ref: Library<83>-Footnote-295547675 +Ref: Library<83>-Footnote-305547741 +Ref: Library<83>-Footnote-315547807 +Ref: Library<83>-Footnote-325547873 +Ref: Library<83>-Footnote-335547939 +Ref: Library<83>-Footnote-345548005 +Ref: Library<83>-Footnote-355548071 +Ref: Library<83>-Footnote-365548137 +Ref: Library<83>-Footnote-375548203 +Ref: Library<83>-Footnote-385548269 +Ref: Library<83>-Footnote-395548335 +Ref: Library<83>-Footnote-405548401 +Ref: Library<83>-Footnote-415548467 +Ref: Library<83>-Footnote-425548533 +Ref: Library<83>-Footnote-435548599 +Ref: Library<83>-Footnote-445548665 +Ref: Library<83>-Footnote-455548731 +Ref: Library<83>-Footnote-465548797 +Ref: Library<83>-Footnote-475548863 +Ref: Library<83>-Footnote-485548929 +Ref: Library<83>-Footnote-495548995 +Ref: Library<83>-Footnote-505549061 +Ref: Library<83>-Footnote-515549127 +Ref: Library<83>-Footnote-525549193 +Ref: Library<83>-Footnote-535549259 +Ref: Library<83>-Footnote-545549325 +Ref: Library<83>-Footnote-555549391 +Ref: Library<83>-Footnote-565549457 +Ref: Library<83>-Footnote-575549523 +Ref: Library<83>-Footnote-585549589 +Ref: Library<83>-Footnote-595549655 +Ref: Library<83>-Footnote-605549721 +Ref: Library<83>-Footnote-615549787 +Ref: Library<83>-Footnote-625549853 +Ref: Library<83>-Footnote-635549919 +Ref: Library<83>-Footnote-645549985 +Ref: Library<83>-Footnote-655550051 +Ref: Library<83>-Footnote-665550117 +Ref: Library<83>-Footnote-675550183 +Ref: Library<83>-Footnote-685550249 +Ref: Library<83>-Footnote-695550315 +Ref: Library<83>-Footnote-705550381 +Ref: Library<83>-Footnote-715550447 +Ref: Library<83>-Footnote-725550513 +Ref: Library<83>-Footnote-735550579 +Ref: Library<83>-Footnote-745550645 +Ref: Library<83>-Footnote-755550711 +Ref: Library<83>-Footnote-765550777 +Ref: Library<83>-Footnote-775550843 +Ref: Library<83>-Footnote-785550909 +Ref: Library<83>-Footnote-795550975 +Ref: Library<83>-Footnote-805551041 +Ref: Library<83>-Footnote-815551106 +Ref: Library<83>-Footnote-825551172 +Ref: Library<83>-Footnote-835551238 +Ref: Library<83>-Footnote-845551304 +Ref: Library<83>-Footnote-855551370 +Ref: Library<83>-Footnote-865551436 +Ref: Library<83>-Footnote-875551502 +Ref: Library<83>-Footnote-885551568 +Ref: Library<83>-Footnote-895551634 +Ref: Library<83>-Footnote-905551700 +Ref: Library<83>-Footnote-915551766 +Ref: Library<83>-Footnote-925551832 +Ref: Library<83>-Footnote-935551898 +Ref: Library<83>-Footnote-945551964 +Ref: Library<83>-Footnote-955552030 +Ref: Library<83>-Footnote-965552096 +Ref: Library<83>-Footnote-975552162 +Ref: Library<83>-Footnote-985552228 +Ref: Library<83>-Footnote-995552294 +Ref: Library<83>-Footnote-1005552360 +Ref: Library<83>-Footnote-1015552427 +Ref: Library<83>-Footnote-1025552494 +Ref: Library<83>-Footnote-1035552561 +Ref: Library<83>-Footnote-1045552628 +Ref: Library<83>-Footnote-1055552695 +Ref: Library<83>-Footnote-1065552762 +Ref: Library<83>-Footnote-1075552829 +Ref: Library<83>-Footnote-1085552896 +Ref: Library<83>-Footnote-1095552963 +Ref: Library<83>-Footnote-1105553030 +Ref: Library<83>-Footnote-1115553097 +Ref: Library<83>-Footnote-1125553164 +Ref: Library<83>-Footnote-1135553231 +Ref: Library<83>-Footnote-1145553298 +Ref: Library<83>-Footnote-1155553365 +Ref: Library<83>-Footnote-1165553432 +Ref: Library<83>-Footnote-1175553499 +Ref: Library<83>-Footnote-1185553566 +Ref: Library<83>-Footnote-1195553633 +Ref: Library<83>-Footnote-1205553700 +Ref: Library<83>-Footnote-1215553767 +Ref: Library<83>-Footnote-1225553834 +Ref: Library<83>-Footnote-1235553901 +Ref: Library<83>-Footnote-1245553968 +Ref: Library<83>-Footnote-1255554035 +Ref: Library<83>-Footnote-1265554102 +Ref: Library<83>-Footnote-1275554169 +Ref: Library<83>-Footnote-1285554236 +Ref: Library<83>-Footnote-1295554303 +Ref: Library<83>-Footnote-1305554370 +Ref: Library<83>-Footnote-1315554437 +Ref: Library<83>-Footnote-1325554504 +Ref: Library<83>-Footnote-1335554571 +Ref: Library<83>-Footnote-1345554638 +Ref: Library<83>-Footnote-1355554705 +Ref: Library<83>-Footnote-1365554772 +Ref: Library<83>-Footnote-1375554839 +Ref: Library<83>-Footnote-1385554906 +Ref: Library<83>-Footnote-1395554973 +Ref: Library<83>-Footnote-1405555040 +Ref: Library<83>-Footnote-1415555107 +Ref: Library<83>-Footnote-1425555174 +Ref: Library<83>-Footnote-1435555241 +Ref: Library<83>-Footnote-1445555308 +Ref: Library<83>-Footnote-1455555374 +Ref: Library<83>-Footnote-1465555441 +Ref: Library<83>-Footnote-1475555508 +Ref: Library<83>-Footnote-1485555575 +Ref: Library<83>-Footnote-1495555642 +Ref: Library<83>-Footnote-1505555709 +Ref: Library<83>-Footnote-1515555775 +Ref: Library<83>-Footnote-1525555842 +Ref: Library<83>-Footnote-1535555909 +Ref: Library<83>-Footnote-1545555976 +Ref: Library<83>-Footnote-1555556043 +Ref: Library<83>-Footnote-1565556110 +Ref: Library<83>-Footnote-1575556177 +Ref: Library<83>-Footnote-1585556244 +Ref: Library<83>-Footnote-1595556311 +Ref: Library<83>-Footnote-1605556378 +Ref: Library<83>-Footnote-1615556444 +Ref: Library<83>-Footnote-1625556511 +Ref: Library<83>-Footnote-1635556578 +Ref: Library<83>-Footnote-1645556645 +Ref: Library<83>-Footnote-1655556712 +Ref: Library<83>-Footnote-1665556779 +Ref: Library<83>-Footnote-1675556846 +Ref: Library<83>-Footnote-1685556913 +Ref: Library<83>-Footnote-1695556980 +Ref: Library<83>-Footnote-1705557047 +Ref: Library<83>-Footnote-1715557114 +Ref: Library<83>-Footnote-1725557181 +Ref: Library<83>-Footnote-1735557248 +Ref: Library<83>-Footnote-1745557315 +Ref: Library<83>-Footnote-1755557382 +Ref: Library<83>-Footnote-1765557449 +Ref: Library<83>-Footnote-1775557516 +Ref: Library<83>-Footnote-1785557583 +Ref: Library<83>-Footnote-1795557650 +Ref: Library<83>-Footnote-1805557717 +Ref: Library<83>-Footnote-1815557784 +Ref: Library<83>-Footnote-1825557851 +Ref: Library<83>-Footnote-1835557918 +Ref: Library<83>-Footnote-1845557985 +Ref: Library<83>-Footnote-1855558052 +Ref: Library<83>-Footnote-1865558119 +Ref: Library<83>-Footnote-1875558186 +Ref: Library<83>-Footnote-1885558253 +Ref: Library<83>-Footnote-1895558320 +Ref: Library<83>-Footnote-1905558387 +Ref: Library<83>-Footnote-1915558454 +Ref: Library<83>-Footnote-1925558521 +Ref: Library<83>-Footnote-1935558588 +Ref: Library<83>-Footnote-1945558655 +Ref: Library<83>-Footnote-1955558722 +Ref: Library<83>-Footnote-1965558789 +Ref: Library<83>-Footnote-1975558856 +Ref: Library<83>-Footnote-1985558923 +Ref: Library<83>-Footnote-1995558990 +Ref: Library<83>-Footnote-2005559057 +Ref: Library<83>-Footnote-2015559124 +Ref: Library<83>-Footnote-2025559191 +Ref: Library<83>-Footnote-2035559258 +Ref: Library<83>-Footnote-2045559325 +Ref: Library<83>-Footnote-2055559392 +Ref: Library<83>-Footnote-2065559459 +Ref: Library<83>-Footnote-2075559526 +Ref: Library<83>-Footnote-2085559593 +Ref: Library<83>-Footnote-2095559659 +Ref: Library<83>-Footnote-2105559725 +Ref: Library<83>-Footnote-2115559792 +Ref: Library<83>-Footnote-2125559859 +Ref: Library<83>-Footnote-2135559926 +Ref: Library<83>-Footnote-2145559993 +Ref: Library<83>-Footnote-2155560060 +Ref: Library<83>-Footnote-2165560127 +Ref: Library<83>-Footnote-2175560194 +Ref: Library<83>-Footnote-2185560261 +Ref: Library<83>-Footnote-2195560328 +Ref: Library<83>-Footnote-2205560395 +Ref: Library<83>-Footnote-2215560462 +Ref: Library<83>-Footnote-2225560529 +Ref: Library<83>-Footnote-2235560596 +Ref: Library<83>-Footnote-2245560663 +Node: IDLE<58>5560730 +Ref: whatsnew/changelog id7175560841 +Ref: 1b585560841 +Ref: IDLE<58>-Footnote-15566420 +Ref: IDLE<58>-Footnote-25566485 +Ref: IDLE<58>-Footnote-35566550 +Ref: IDLE<58>-Footnote-45566615 +Ref: IDLE<58>-Footnote-55566680 +Ref: IDLE<58>-Footnote-65566745 +Ref: IDLE<58>-Footnote-75566810 +Ref: IDLE<58>-Footnote-85566875 +Ref: IDLE<58>-Footnote-95566940 +Ref: IDLE<58>-Footnote-105567005 +Ref: IDLE<58>-Footnote-115567071 +Ref: IDLE<58>-Footnote-125567137 +Ref: IDLE<58>-Footnote-135567203 +Ref: IDLE<58>-Footnote-145567269 +Ref: IDLE<58>-Footnote-155567335 +Ref: IDLE<58>-Footnote-165567401 +Ref: IDLE<58>-Footnote-175567467 +Ref: IDLE<58>-Footnote-185567533 +Ref: IDLE<58>-Footnote-195567599 +Ref: IDLE<58>-Footnote-205567665 +Ref: IDLE<58>-Footnote-215567731 +Ref: IDLE<58>-Footnote-225567797 +Ref: IDLE<58>-Footnote-235567863 +Ref: IDLE<58>-Footnote-245567929 +Ref: IDLE<58>-Footnote-255567995 +Ref: IDLE<58>-Footnote-265568061 +Ref: IDLE<58>-Footnote-275568127 +Ref: IDLE<58>-Footnote-285568193 +Node: Documentation<72>5568259 +Ref: whatsnew/changelog id7185568368 +Ref: 1b595568368 +Ref: Documentation<72>-Footnote-15569164 +Ref: Documentation<72>-Footnote-25569229 +Ref: Documentation<72>-Footnote-35569293 +Ref: Documentation<72>-Footnote-45569358 +Ref: Documentation<72>-Footnote-55569423 +Node: Tests<75>5569488 +Ref: whatsnew/changelog id7195569598 +Ref: 1b5a5569598 +Ref: Tests<75>-Footnote-15571354 +Ref: Tests<75>-Footnote-25571419 +Ref: Tests<75>-Footnote-35571484 +Ref: Tests<75>-Footnote-45571549 +Ref: Tests<75>-Footnote-55571614 +Ref: Tests<75>-Footnote-65571679 +Ref: Tests<75>-Footnote-75571744 +Ref: Tests<75>-Footnote-85571809 +Ref: Tests<75>-Footnote-95571874 +Ref: Tests<75>-Footnote-105571939 +Ref: Tests<75>-Footnote-115572005 +Ref: Tests<75>-Footnote-125572071 +Ref: Tests<75>-Footnote-135572137 +Node: Build<80>5572203 +Ref: whatsnew/changelog id7205572307 +Ref: 1b5b5572307 +Ref: Build<80>-Footnote-15575037 +Ref: Build<80>-Footnote-25575102 +Ref: Build<80>-Footnote-35575167 +Ref: Build<80>-Footnote-45575232 +Ref: Build<80>-Footnote-55575297 +Ref: Build<80>-Footnote-65575362 +Ref: Build<80>-Footnote-75575427 +Ref: Build<80>-Footnote-85575492 +Ref: Build<80>-Footnote-95575557 +Ref: Build<80>-Footnote-105575622 +Ref: Build<80>-Footnote-115575688 +Ref: Build<80>-Footnote-125575754 +Ref: Build<80>-Footnote-135575820 +Ref: Build<80>-Footnote-145575886 +Ref: Build<80>-Footnote-155575952 +Ref: Build<80>-Footnote-165576018 +Ref: Build<80>-Footnote-175576084 +Ref: Build<80>-Footnote-185576150 +Ref: Build<80>-Footnote-195576216 +Node: Windows<71>5576282 +Ref: whatsnew/changelog id7215576392 +Ref: 1b5c5576392 +Ref: Windows<71>-Footnote-15577040 +Ref: Windows<71>-Footnote-25577105 +Ref: Windows<71>-Footnote-35577170 +Ref: Windows<71>-Footnote-45577235 +Ref: Windows<71>-Footnote-55577300 +Ref: Windows<71>-Footnote-65577365 +Node: Tools/Demos<44>5577430 +Ref: whatsnew/changelog id7225577540 +Ref: 1b5d5577540 +Ref: Tools/Demos<44>-Footnote-15578330 +Ref: Tools/Demos<44>-Footnote-25578395 +Ref: Tools/Demos<44>-Footnote-35578460 +Ref: Tools/Demos<44>-Footnote-45578525 +Ref: Tools/Demos<44>-Footnote-55578590 +Ref: Tools/Demos<44>-Footnote-65578655 +Node: C API<70>5578720 +Ref: whatsnew/changelog id7235578810 +Ref: 1b5e5578810 +Ref: C API<70>-Footnote-15579307 +Ref: C API<70>-Footnote-25579372 +Node: Python 3 5 5 final5579437 +Ref: whatsnew/changelog python-3-5-5-final5579571 +Ref: 1b5f5579571 +Node: Python 3 5 5 release candidate 15579699 +Ref: whatsnew/changelog python-3-5-5-release-candidate-15579831 +Ref: 1b605579831 +Node: Security<49>5580046 +Ref: whatsnew/changelog id7245580157 +Ref: 1b615580157 +Ref: Security<49>-Footnote-15581428 +Ref: Security<49>-Footnote-25581493 +Ref: Security<49>-Footnote-35581558 +Ref: Security<49>-Footnote-45581623 +Ref: Security<49>-Footnote-55581688 +Ref: Security<49>-Footnote-65581746 +Node: Core and Builtins<85>5581811 +Ref: whatsnew/changelog id7255581942 +Ref: 1b625581942 +Ref: Core and Builtins<85>-Footnote-15582167 +Node: Library<84>5582232 +Ref: whatsnew/changelog id7265582342 +Ref: 1b635582342 +Ref: Library<84>-Footnote-15582869 +Ref: Library<84>-Footnote-25582934 +Node: Python 3 5 4 final5582999 +Ref: whatsnew/changelog python-3-5-4-final5583145 +Ref: 1b645583145 +Node: Library<85>5583262 +Ref: whatsnew/changelog id7275583328 +Ref: 1b655583328 +Ref: Library<85>-Footnote-15583526 +Node: Python 3 5 4 release candidate 15583591 +Ref: whatsnew/changelog python-3-5-4-release-candidate-15583723 +Ref: 1b665583723 +Node: Security<50>5584058 +Ref: whatsnew/changelog id7285584169 +Ref: 1b675584169 +Ref: Security<50>-Footnote-15585495 +Ref: Security<50>-Footnote-25585560 +Ref: Security<50>-Footnote-35585625 +Ref: Security<50>-Footnote-45585680 +Ref: Security<50>-Footnote-55585735 +Ref: Security<50>-Footnote-65585790 +Ref: Security<50>-Footnote-75585845 +Ref: Security<50>-Footnote-85585900 +Ref: Security<50>-Footnote-95585955 +Ref: Security<50>-Footnote-105586020 +Ref: Security<50>-Footnote-115586086 +Ref: Security<50>-Footnote-125586142 +Node: Core and Builtins<86>5586198 +Ref: whatsnew/changelog id7295586329 +Ref: 1b685586329 +Ref: Core and Builtins<86>-Footnote-15588584 +Ref: Core and Builtins<86>-Footnote-25588649 +Ref: Core and Builtins<86>-Footnote-35588714 +Ref: Core and Builtins<86>-Footnote-45588779 +Ref: Core and Builtins<86>-Footnote-55588844 +Ref: Core and Builtins<86>-Footnote-65588909 +Ref: Core and Builtins<86>-Footnote-75588974 +Ref: Core and Builtins<86>-Footnote-85589039 +Ref: Core and Builtins<86>-Footnote-95589104 +Ref: Core and Builtins<86>-Footnote-105589169 +Ref: Core and Builtins<86>-Footnote-115589235 +Ref: Core and Builtins<86>-Footnote-125589301 +Ref: Core and Builtins<86>-Footnote-135589367 +Ref: Core and Builtins<86>-Footnote-145589433 +Ref: Core and Builtins<86>-Footnote-155589499 +Node: Library<86>5589565 +Ref: whatsnew/changelog id7305589701 +Ref: 1b695589701 +Ref: Library<86>-Footnote-15599902 +Ref: Library<86>-Footnote-25599967 +Ref: Library<86>-Footnote-35600032 +Ref: Library<86>-Footnote-45600097 +Ref: Library<86>-Footnote-55600162 +Ref: Library<86>-Footnote-65600227 +Ref: Library<86>-Footnote-75600292 +Ref: Library<86>-Footnote-85600357 +Ref: Library<86>-Footnote-95600422 +Ref: Library<86>-Footnote-105600487 +Ref: Library<86>-Footnote-115600553 +Ref: Library<86>-Footnote-125600619 +Ref: Library<86>-Footnote-135600685 +Ref: Library<86>-Footnote-145600751 +Ref: Library<86>-Footnote-155600817 +Ref: Library<86>-Footnote-165600883 +Ref: Library<86>-Footnote-175600949 +Ref: Library<86>-Footnote-185601015 +Ref: Library<86>-Footnote-195601081 +Ref: Library<86>-Footnote-205601147 +Ref: Library<86>-Footnote-215601213 +Ref: Library<86>-Footnote-225601279 +Ref: Library<86>-Footnote-235601345 +Ref: Library<86>-Footnote-245601411 +Ref: Library<86>-Footnote-255601477 +Ref: Library<86>-Footnote-265601543 +Ref: Library<86>-Footnote-275601609 +Ref: Library<86>-Footnote-285601675 +Ref: Library<86>-Footnote-295601741 +Ref: Library<86>-Footnote-305601807 +Ref: Library<86>-Footnote-315601873 +Ref: Library<86>-Footnote-325601939 +Ref: Library<86>-Footnote-335602005 +Ref: Library<86>-Footnote-345602071 +Ref: Library<86>-Footnote-355602137 +Ref: Library<86>-Footnote-365602203 +Ref: Library<86>-Footnote-375602269 +Ref: Library<86>-Footnote-385602335 +Ref: Library<86>-Footnote-395602401 +Ref: Library<86>-Footnote-405602467 +Ref: Library<86>-Footnote-415602533 +Ref: Library<86>-Footnote-425602599 +Ref: Library<86>-Footnote-435602665 +Ref: Library<86>-Footnote-445602731 +Ref: Library<86>-Footnote-455602797 +Ref: Library<86>-Footnote-465602863 +Ref: Library<86>-Footnote-475602929 +Ref: Library<86>-Footnote-485602995 +Ref: Library<86>-Footnote-495603061 +Ref: Library<86>-Footnote-505603127 +Ref: Library<86>-Footnote-515603193 +Ref: Library<86>-Footnote-525603259 +Ref: Library<86>-Footnote-535603325 +Ref: Library<86>-Footnote-545603391 +Ref: Library<86>-Footnote-555603456 +Ref: Library<86>-Footnote-565603522 +Ref: Library<86>-Footnote-575603588 +Ref: Library<86>-Footnote-585603654 +Ref: Library<86>-Footnote-595603720 +Ref: Library<86>-Footnote-605603786 +Ref: Library<86>-Footnote-615603852 +Ref: Library<86>-Footnote-625603918 +Ref: Library<86>-Footnote-635603984 +Ref: Library<86>-Footnote-645604050 +Ref: Library<86>-Footnote-655604116 +Ref: Library<86>-Footnote-665604182 +Ref: Library<86>-Footnote-675604248 +Ref: Library<86>-Footnote-685604314 +Ref: Library<86>-Footnote-695604380 +Ref: Library<86>-Footnote-705604446 +Ref: Library<86>-Footnote-715604512 +Ref: Library<86>-Footnote-725604578 +Ref: Library<86>-Footnote-735604644 +Ref: Library<86>-Footnote-745604710 +Node: Documentation<73>5604776 +Ref: whatsnew/changelog id7315604900 +Ref: 1b6a5604900 +Ref: Documentation<73>-Footnote-15605610 +Ref: Documentation<73>-Footnote-25605675 +Ref: Documentation<73>-Footnote-35605740 +Ref: Documentation<73>-Footnote-45605805 +Ref: Documentation<73>-Footnote-55605870 +Ref: Documentation<73>-Footnote-65605935 +Node: Tests<76>5606000 +Ref: whatsnew/changelog id7325606122 +Ref: 1b6b5606122 +Ref: Tests<76>-Footnote-15608229 +Ref: Tests<76>-Footnote-25608294 +Ref: Tests<76>-Footnote-35608359 +Ref: Tests<76>-Footnote-45608424 +Ref: Tests<76>-Footnote-55608489 +Ref: Tests<76>-Footnote-65608554 +Ref: Tests<76>-Footnote-75608619 +Ref: Tests<76>-Footnote-85608684 +Ref: Tests<76>-Footnote-95608749 +Node: Build<81>5608814 +Ref: whatsnew/changelog id7335608930 +Ref: 1b6c5608930 +Ref: Build<81>-Footnote-15609446 +Ref: Build<81>-Footnote-25609511 +Ref: Build<81>-Footnote-35609576 +Node: Windows<72>5609641 +Ref: whatsnew/changelog id7345609757 +Ref: 1b6d5609757 +Ref: Windows<72>-Footnote-15610015 +Ref: Windows<72>-Footnote-25610080 +Node: C API<71>5610145 +Ref: whatsnew/changelog id7355610243 +Ref: 1b6e5610243 +Ref: C API<71>-Footnote-15610850 +Ref: C API<71>-Footnote-25610915 +Node: Python 3 5 3 final5610980 +Ref: whatsnew/changelog python-3-5-3-final5611126 +Ref: 1b6f5611126 +Node: Python 3 5 3 release candidate 15611271 +Ref: whatsnew/changelog python-3-5-3-release-candidate-15611403 +Ref: 1b705611403 +Node: Security<51>5611788 +Ref: whatsnew/changelog id7365611899 +Ref: 1b715611899 +Ref: Security<51>-Footnote-15612277 +Ref: Security<51>-Footnote-25612342 +Node: Core and Builtins<87>5612407 +Ref: whatsnew/changelog id7375612538 +Ref: 1b725612538 +Ref: Core and Builtins<87>-Footnote-15617996 +Ref: Core and Builtins<87>-Footnote-25618061 +Ref: Core and Builtins<87>-Footnote-35618126 +Ref: Core and Builtins<87>-Footnote-45618191 +Ref: Core and Builtins<87>-Footnote-55618256 +Ref: Core and Builtins<87>-Footnote-65618321 +Ref: Core and Builtins<87>-Footnote-75618386 +Ref: Core and Builtins<87>-Footnote-85618451 +Ref: Core and Builtins<87>-Footnote-95618516 +Ref: Core and Builtins<87>-Footnote-105618581 +Ref: Core and Builtins<87>-Footnote-115618647 +Ref: Core and Builtins<87>-Footnote-125618713 +Ref: Core and Builtins<87>-Footnote-135618779 +Ref: Core and Builtins<87>-Footnote-145618845 +Ref: Core and Builtins<87>-Footnote-155618911 +Ref: Core and Builtins<87>-Footnote-165618977 +Ref: Core and Builtins<87>-Footnote-175619043 +Ref: Core and Builtins<87>-Footnote-185619109 +Ref: Core and Builtins<87>-Footnote-195619175 +Ref: Core and Builtins<87>-Footnote-205619241 +Ref: Core and Builtins<87>-Footnote-215619307 +Ref: Core and Builtins<87>-Footnote-225619373 +Ref: Core and Builtins<87>-Footnote-235619439 +Ref: Core and Builtins<87>-Footnote-245619505 +Ref: Core and Builtins<87>-Footnote-255619571 +Ref: Core and Builtins<87>-Footnote-265619637 +Ref: Core and Builtins<87>-Footnote-275619703 +Ref: Core and Builtins<87>-Footnote-285619769 +Ref: Core and Builtins<87>-Footnote-295619835 +Ref: Core and Builtins<87>-Footnote-305619901 +Ref: Core and Builtins<87>-Footnote-315619967 +Ref: Core and Builtins<87>-Footnote-325620033 +Ref: Core and Builtins<87>-Footnote-335620099 +Ref: Core and Builtins<87>-Footnote-345620165 +Ref: Core and Builtins<87>-Footnote-355620231 +Ref: Core and Builtins<87>-Footnote-365620297 +Ref: Core and Builtins<87>-Footnote-375620363 +Ref: Core and Builtins<87>-Footnote-385620429 +Ref: Core and Builtins<87>-Footnote-395620495 +Ref: Core and Builtins<87>-Footnote-405620561 +Ref: Core and Builtins<87>-Footnote-415620627 +Ref: Core and Builtins<87>-Footnote-425620693 +Ref: Core and Builtins<87>-Footnote-435620759 +Node: Library<87>5620825 +Ref: whatsnew/changelog id7385620952 +Ref: 1b735620952 +Ref: Library<87>-Footnote-15636965 +Ref: Library<87>-Footnote-25637030 +Ref: Library<87>-Footnote-35637095 +Ref: Library<87>-Footnote-45637160 +Ref: Library<87>-Footnote-55637225 +Ref: Library<87>-Footnote-65637289 +Ref: Library<87>-Footnote-75637354 +Ref: Library<87>-Footnote-85637419 +Ref: Library<87>-Footnote-95637484 +Ref: Library<87>-Footnote-105637549 +Ref: Library<87>-Footnote-115637615 +Ref: Library<87>-Footnote-125637681 +Ref: Library<87>-Footnote-135637747 +Ref: Library<87>-Footnote-145637813 +Ref: Library<87>-Footnote-155637879 +Ref: Library<87>-Footnote-165637945 +Ref: Library<87>-Footnote-175638011 +Ref: Library<87>-Footnote-185638077 +Ref: Library<87>-Footnote-195638143 +Ref: Library<87>-Footnote-205638209 +Ref: Library<87>-Footnote-215638275 +Ref: Library<87>-Footnote-225638341 +Ref: Library<87>-Footnote-235638407 +Ref: Library<87>-Footnote-245638473 +Ref: Library<87>-Footnote-255638539 +Ref: Library<87>-Footnote-265638605 +Ref: Library<87>-Footnote-275638671 +Ref: Library<87>-Footnote-285638737 +Ref: Library<87>-Footnote-295638803 +Ref: Library<87>-Footnote-305638869 +Ref: Library<87>-Footnote-315638935 +Ref: Library<87>-Footnote-325639001 +Ref: Library<87>-Footnote-335639069 +Ref: Library<87>-Footnote-345639135 +Ref: Library<87>-Footnote-355639201 +Ref: Library<87>-Footnote-365639267 +Ref: Library<87>-Footnote-375639333 +Ref: Library<87>-Footnote-385639399 +Ref: Library<87>-Footnote-395639465 +Ref: Library<87>-Footnote-405639531 +Ref: Library<87>-Footnote-415639597 +Ref: Library<87>-Footnote-425639663 +Ref: Library<87>-Footnote-435639729 +Ref: Library<87>-Footnote-445639795 +Ref: Library<87>-Footnote-455639861 +Ref: Library<87>-Footnote-465639927 +Ref: Library<87>-Footnote-475639993 +Ref: Library<87>-Footnote-485640059 +Ref: Library<87>-Footnote-495640125 +Ref: Library<87>-Footnote-505640191 +Ref: Library<87>-Footnote-515640257 +Ref: Library<87>-Footnote-525640323 +Ref: Library<87>-Footnote-535640389 +Ref: Library<87>-Footnote-545640455 +Ref: Library<87>-Footnote-555640521 +Ref: Library<87>-Footnote-565640587 +Ref: Library<87>-Footnote-575640653 +Ref: Library<87>-Footnote-585640719 +Ref: Library<87>-Footnote-595640785 +Ref: Library<87>-Footnote-605640851 +Ref: Library<87>-Footnote-615640907 +Ref: Library<87>-Footnote-625640973 +Ref: Library<87>-Footnote-635641039 +Ref: Library<87>-Footnote-645641105 +Ref: Library<87>-Footnote-655641171 +Ref: Library<87>-Footnote-665641237 +Ref: Library<87>-Footnote-675641303 +Ref: Library<87>-Footnote-685641369 +Ref: Library<87>-Footnote-695641435 +Ref: Library<87>-Footnote-705641501 +Ref: Library<87>-Footnote-715641567 +Ref: Library<87>-Footnote-725641633 +Ref: Library<87>-Footnote-735641698 +Ref: Library<87>-Footnote-745641764 +Ref: Library<87>-Footnote-755641830 +Ref: Library<87>-Footnote-765641896 +Ref: Library<87>-Footnote-775641962 +Ref: Library<87>-Footnote-785642028 +Ref: Library<87>-Footnote-795642094 +Ref: Library<87>-Footnote-805642160 +Ref: Library<87>-Footnote-815642219 +Ref: Library<87>-Footnote-825642285 +Ref: Library<87>-Footnote-835642351 +Ref: Library<87>-Footnote-845642417 +Ref: Library<87>-Footnote-855642483 +Ref: Library<87>-Footnote-865642549 +Ref: Library<87>-Footnote-875642615 +Ref: Library<87>-Footnote-885642681 +Ref: Library<87>-Footnote-895642747 +Ref: Library<87>-Footnote-905642813 +Ref: Library<87>-Footnote-915642879 +Ref: Library<87>-Footnote-925642945 +Ref: Library<87>-Footnote-935643011 +Ref: Library<87>-Footnote-945643077 +Ref: Library<87>-Footnote-955643143 +Ref: Library<87>-Footnote-965643209 +Ref: Library<87>-Footnote-975643275 +Ref: Library<87>-Footnote-985643318 +Ref: Library<87>-Footnote-995643384 +Ref: Library<87>-Footnote-1005643450 +Ref: Library<87>-Footnote-1015643517 +Ref: Library<87>-Footnote-1025643584 +Ref: Library<87>-Footnote-1035643651 +Ref: Library<87>-Footnote-1045643718 +Ref: Library<87>-Footnote-1055643785 +Ref: Library<87>-Footnote-1065643852 +Ref: Library<87>-Footnote-1075643919 +Ref: Library<87>-Footnote-1085643986 +Ref: Library<87>-Footnote-1095644053 +Ref: Library<87>-Footnote-1105644120 +Ref: Library<87>-Footnote-1115644187 +Ref: Library<87>-Footnote-1125644254 +Ref: Library<87>-Footnote-1135644321 +Ref: Library<87>-Footnote-1145644388 +Ref: Library<87>-Footnote-1155644455 +Ref: Library<87>-Footnote-1165644522 +Ref: Library<87>-Footnote-1175644589 +Ref: Library<87>-Footnote-1185644656 +Ref: Library<87>-Footnote-1195644723 +Ref: Library<87>-Footnote-1205644790 +Ref: Library<87>-Footnote-1215644857 +Ref: Library<87>-Footnote-1225644924 +Ref: Library<87>-Footnote-1235644991 +Ref: Library<87>-Footnote-1245645058 +Ref: Library<87>-Footnote-1255645125 +Ref: Library<87>-Footnote-1265645192 +Node: IDLE<59>5645259 +Ref: whatsnew/changelog id7395645374 +Ref: 1b745645374 +Ref: IDLE<59>-Footnote-15646623 +Ref: IDLE<59>-Footnote-25646688 +Ref: IDLE<59>-Footnote-35646753 +Ref: IDLE<59>-Footnote-45646818 +Ref: IDLE<59>-Footnote-55646883 +Ref: IDLE<59>-Footnote-65646948 +Ref: IDLE<59>-Footnote-75647013 +Ref: IDLE<59>-Footnote-85647078 +Node: C API<72>5647143 +Ref: whatsnew/changelog id7405647264 +Ref: 1b755647264 +Ref: C API<72>-Footnote-15647594 +Ref: C API<72>-Footnote-25647659 +Node: Documentation<74>5647724 +Ref: whatsnew/changelog id7415647846 +Ref: 1b765647846 +Ref: Documentation<74>-Footnote-15647997 +Node: Tests<77>5648062 +Ref: whatsnew/changelog id7425648190 +Ref: 1b775648190 +Ref: Tests<77>-Footnote-15648881 +Ref: Tests<77>-Footnote-25648946 +Ref: Tests<77>-Footnote-35649011 +Ref: Tests<77>-Footnote-45649076 +Ref: Tests<77>-Footnote-55649141 +Ref: Tests<77>-Footnote-65649206 +Node: Tools/Demos<45>5649271 +Ref: whatsnew/changelog id7435649393 +Ref: 1b785649393 +Ref: Tools/Demos<45>-Footnote-15649875 +Ref: Tools/Demos<45>-Footnote-25649940 +Ref: Tools/Demos<45>-Footnote-35650005 +Node: Windows<73>5650070 +Ref: whatsnew/changelog id7445650192 +Ref: 1b795650192 +Ref: Windows<73>-Footnote-15650692 +Ref: Windows<73>-Footnote-25650757 +Ref: Windows<73>-Footnote-35650822 +Ref: Windows<73>-Footnote-45650887 +Ref: Windows<73>-Footnote-55650952 +Node: Build<82>5651017 +Ref: whatsnew/changelog id7455651115 +Ref: 1b7a5651115 +Ref: Build<82>-Footnote-15653822 +Ref: Build<82>-Footnote-25653887 +Ref: Build<82>-Footnote-35653952 +Ref: Build<82>-Footnote-45654017 +Ref: Build<82>-Footnote-55654082 +Ref: Build<82>-Footnote-65654147 +Ref: Build<82>-Footnote-75654212 +Ref: Build<82>-Footnote-85654277 +Ref: Build<82>-Footnote-95654342 +Ref: Build<82>-Footnote-105654407 +Ref: Build<82>-Footnote-115654473 +Ref: Build<82>-Footnote-125654539 +Ref: Build<82>-Footnote-135654605 +Ref: Build<82>-Footnote-145654671 +Ref: Build<82>-Footnote-155654737 +Ref: Build<82>-Footnote-165654803 +Ref: Build<82>-Footnote-175654869 +Ref: Build<82>-Footnote-185654935 +Ref: Build<82>-Footnote-195655001 +Ref: Build<82>-Footnote-205655067 +Ref: Build<82>-Footnote-215655133 +Ref: Build<82>-Footnote-225655199 +Node: Python 3 5 2 final5655265 +Ref: whatsnew/changelog python-3-5-2-final5655411 +Ref: 1b7b5655411 +Node: Core and Builtins<88>5655586 +Ref: whatsnew/changelog id7465655680 +Ref: 1b7c5655680 +Ref: Core and Builtins<88>-Footnote-15655838 +Node: Tests<78>5655903 +Ref: whatsnew/changelog id7475656014 +Ref: 1b7d5656014 +Ref: Tests<78>-Footnote-15656174 +Node: IDLE<60>5656239 +Ref: whatsnew/changelog id7485656320 +Ref: 1b7e5656320 +Ref: IDLE<60>-Footnote-15656474 +Node: Python 3 5 2 release candidate 15656539 +Ref: whatsnew/changelog python-3-5-2-release-candidate-15656671 +Ref: 1b7f5656671 +Node: Security<52>5657038 +Ref: whatsnew/changelog id7495657149 +Ref: 1b805657149 +Ref: Security<52>-Footnote-15658058 +Ref: Security<52>-Footnote-25658123 +Ref: Security<52>-Footnote-35658178 +Ref: Security<52>-Footnote-45658233 +Ref: Security<52>-Footnote-55658298 +Ref: Security<52>-Footnote-65658363 +Ref: Security<52>-Footnote-75658428 +Node: Core and Builtins<89>5658493 +Ref: whatsnew/changelog id7505658624 +Ref: 1b815658624 +Ref: Core and Builtins<89>-Footnote-15664477 +Ref: Core and Builtins<89>-Footnote-25664542 +Ref: Core and Builtins<89>-Footnote-35664607 +Ref: Core and Builtins<89>-Footnote-45664672 +Ref: Core and Builtins<89>-Footnote-55664737 +Ref: Core and Builtins<89>-Footnote-65664802 +Ref: Core and Builtins<89>-Footnote-75664867 +Ref: Core and Builtins<89>-Footnote-85664932 +Ref: Core and Builtins<89>-Footnote-95664997 +Ref: Core and Builtins<89>-Footnote-105665062 +Ref: Core and Builtins<89>-Footnote-115665128 +Ref: Core and Builtins<89>-Footnote-125665194 +Ref: Core and Builtins<89>-Footnote-135665260 +Ref: Core and Builtins<89>-Footnote-145665326 +Ref: Core and Builtins<89>-Footnote-155665392 +Ref: Core and Builtins<89>-Footnote-165665458 +Ref: Core and Builtins<89>-Footnote-175665524 +Ref: Core and Builtins<89>-Footnote-185665589 +Ref: Core and Builtins<89>-Footnote-195665655 +Ref: Core and Builtins<89>-Footnote-205665721 +Ref: Core and Builtins<89>-Footnote-215665787 +Ref: Core and Builtins<89>-Footnote-225665853 +Ref: Core and Builtins<89>-Footnote-235665919 +Ref: Core and Builtins<89>-Footnote-245665985 +Ref: Core and Builtins<89>-Footnote-255666051 +Ref: Core and Builtins<89>-Footnote-265666117 +Ref: Core and Builtins<89>-Footnote-275666183 +Ref: Core and Builtins<89>-Footnote-285666249 +Ref: Core and Builtins<89>-Footnote-295666315 +Ref: Core and Builtins<89>-Footnote-305666381 +Ref: Core and Builtins<89>-Footnote-315666447 +Ref: Core and Builtins<89>-Footnote-325666490 +Ref: Core and Builtins<89>-Footnote-335666556 +Ref: Core and Builtins<89>-Footnote-345666622 +Ref: Core and Builtins<89>-Footnote-355666688 +Ref: Core and Builtins<89>-Footnote-365666754 +Ref: Core and Builtins<89>-Footnote-375666820 +Ref: Core and Builtins<89>-Footnote-385666886 +Node: Library<88>5666952 +Ref: whatsnew/changelog id7515667079 +Ref: 1b825667079 +Ref: Library<88>-Footnote-15683900 +Ref: Library<88>-Footnote-25683965 +Ref: Library<88>-Footnote-35684030 +Ref: Library<88>-Footnote-45684072 +Ref: Library<88>-Footnote-55684137 +Ref: Library<88>-Footnote-65684202 +Ref: Library<88>-Footnote-75684267 +Ref: Library<88>-Footnote-85684332 +Ref: Library<88>-Footnote-95684397 +Ref: Library<88>-Footnote-105684462 +Ref: Library<88>-Footnote-115684528 +Ref: Library<88>-Footnote-125684594 +Ref: Library<88>-Footnote-135684660 +Ref: Library<88>-Footnote-145684726 +Ref: Library<88>-Footnote-155684792 +Ref: Library<88>-Footnote-165684858 +Ref: Library<88>-Footnote-175684924 +Ref: Library<88>-Footnote-185684990 +Ref: Library<88>-Footnote-195685056 +Ref: Library<88>-Footnote-205685122 +Ref: Library<88>-Footnote-215685188 +Ref: Library<88>-Footnote-225685254 +Ref: Library<88>-Footnote-235685320 +Ref: Library<88>-Footnote-245685386 +Ref: Library<88>-Footnote-255685452 +Ref: Library<88>-Footnote-265685518 +Ref: Library<88>-Footnote-275685584 +Ref: Library<88>-Footnote-285685650 +Ref: Library<88>-Footnote-295685716 +Ref: Library<88>-Footnote-305685782 +Ref: Library<88>-Footnote-315685848 +Ref: Library<88>-Footnote-325685914 +Ref: Library<88>-Footnote-335685980 +Ref: Library<88>-Footnote-345686046 +Ref: Library<88>-Footnote-355686112 +Ref: Library<88>-Footnote-365686178 +Ref: Library<88>-Footnote-375686244 +Ref: Library<88>-Footnote-385686310 +Ref: Library<88>-Footnote-395686376 +Ref: Library<88>-Footnote-405686442 +Ref: Library<88>-Footnote-415686508 +Ref: Library<88>-Footnote-425686574 +Ref: Library<88>-Footnote-435686640 +Ref: Library<88>-Footnote-445686706 +Ref: Library<88>-Footnote-455686772 +Ref: Library<88>-Footnote-465686838 +Ref: Library<88>-Footnote-475686904 +Ref: Library<88>-Footnote-485686970 +Ref: Library<88>-Footnote-495687036 +Ref: Library<88>-Footnote-505687102 +Ref: Library<88>-Footnote-515687168 +Ref: Library<88>-Footnote-525687234 +Ref: Library<88>-Footnote-535687300 +Ref: Library<88>-Footnote-545687366 +Ref: Library<88>-Footnote-555687432 +Ref: Library<88>-Footnote-565687498 +Ref: Library<88>-Footnote-575687564 +Ref: Library<88>-Footnote-585687630 +Ref: Library<88>-Footnote-595687696 +Ref: Library<88>-Footnote-605687762 +Ref: Library<88>-Footnote-615687828 +Ref: Library<88>-Footnote-625687893 +Ref: Library<88>-Footnote-635687959 +Ref: Library<88>-Footnote-645688025 +Ref: Library<88>-Footnote-655688091 +Ref: Library<88>-Footnote-665688157 +Ref: Library<88>-Footnote-675688223 +Ref: Library<88>-Footnote-685688289 +Ref: Library<88>-Footnote-695688355 +Ref: Library<88>-Footnote-705688421 +Ref: Library<88>-Footnote-715688487 +Ref: Library<88>-Footnote-725688553 +Ref: Library<88>-Footnote-735688619 +Ref: Library<88>-Footnote-745688685 +Ref: Library<88>-Footnote-755688751 +Ref: Library<88>-Footnote-765688817 +Ref: Library<88>-Footnote-775688883 +Ref: Library<88>-Footnote-785688949 +Ref: Library<88>-Footnote-795689015 +Ref: Library<88>-Footnote-805689081 +Ref: Library<88>-Footnote-815689147 +Ref: Library<88>-Footnote-825689213 +Ref: Library<88>-Footnote-835689279 +Ref: Library<88>-Footnote-845689345 +Ref: Library<88>-Footnote-855689411 +Ref: Library<88>-Footnote-865689477 +Ref: Library<88>-Footnote-875689543 +Ref: Library<88>-Footnote-885689609 +Ref: Library<88>-Footnote-895689675 +Ref: Library<88>-Footnote-905689741 +Ref: Library<88>-Footnote-915689807 +Ref: Library<88>-Footnote-925689873 +Ref: Library<88>-Footnote-935689939 +Ref: Library<88>-Footnote-945690005 +Ref: Library<88>-Footnote-955690071 +Ref: Library<88>-Footnote-965690137 +Ref: Library<88>-Footnote-975690203 +Ref: Library<88>-Footnote-985690269 +Ref: Library<88>-Footnote-995690335 +Ref: Library<88>-Footnote-1005690401 +Ref: Library<88>-Footnote-1015690468 +Ref: Library<88>-Footnote-1025690534 +Ref: Library<88>-Footnote-1035690601 +Ref: Library<88>-Footnote-1045690668 +Ref: Library<88>-Footnote-1055690735 +Ref: Library<88>-Footnote-1065690802 +Ref: Library<88>-Footnote-1075690869 +Ref: Library<88>-Footnote-1085690936 +Ref: Library<88>-Footnote-1095691003 +Ref: Library<88>-Footnote-1105691070 +Ref: Library<88>-Footnote-1115691137 +Ref: Library<88>-Footnote-1125691204 +Ref: Library<88>-Footnote-1135691271 +Ref: Library<88>-Footnote-1145691338 +Ref: Library<88>-Footnote-1155691405 +Ref: Library<88>-Footnote-1165691472 +Ref: Library<88>-Footnote-1175691539 +Ref: Library<88>-Footnote-1185691606 +Ref: Library<88>-Footnote-1195691673 +Ref: Library<88>-Footnote-1205691740 +Node: IDLE<61>5691807 +Ref: whatsnew/changelog id7525691930 +Ref: 1b835691930 +Ref: IDLE<61>-Footnote-15694293 +Ref: IDLE<61>-Footnote-25694357 +Ref: IDLE<61>-Footnote-35694422 +Ref: IDLE<61>-Footnote-45694487 +Ref: IDLE<61>-Footnote-55694552 +Ref: IDLE<61>-Footnote-65694617 +Ref: IDLE<61>-Footnote-75694682 +Ref: IDLE<61>-Footnote-85694747 +Ref: IDLE<61>-Footnote-95694812 +Ref: IDLE<61>-Footnote-105694877 +Ref: IDLE<61>-Footnote-115694943 +Ref: IDLE<61>-Footnote-125695009 +Ref: IDLE<61>-Footnote-135695075 +Ref: IDLE<61>-Footnote-145695141 +Ref: IDLE<61>-Footnote-155695207 +Node: Documentation<75>5695273 +Ref: whatsnew/changelog id7535695394 +Ref: 1b845695394 +Ref: Documentation<75>-Footnote-15696354 +Ref: Documentation<75>-Footnote-25696419 +Ref: Documentation<75>-Footnote-35696484 +Ref: Documentation<75>-Footnote-45696526 +Ref: Documentation<75>-Footnote-55696591 +Ref: Documentation<75>-Footnote-65696655 +Ref: Documentation<75>-Footnote-75696720 +Ref: Documentation<75>-Footnote-85696785 +Node: Tests<79>5696850 +Ref: whatsnew/changelog id7545696972 +Ref: 1b855696972 +Ref: Tests<79>-Footnote-15697847 +Ref: Tests<79>-Footnote-25697912 +Ref: Tests<79>-Footnote-35697977 +Ref: Tests<79>-Footnote-45698042 +Ref: Tests<79>-Footnote-55698107 +Ref: Tests<79>-Footnote-65698172 +Ref: Tests<79>-Footnote-75698237 +Node: Build<83>5698302 +Ref: whatsnew/changelog id7555698418 +Ref: 1b865698418 +Ref: Build<83>-Footnote-15700946 +Ref: Build<83>-Footnote-25701011 +Ref: Build<83>-Footnote-35701076 +Ref: Build<83>-Footnote-45701141 +Ref: Build<83>-Footnote-55701206 +Ref: Build<83>-Footnote-65701271 +Ref: Build<83>-Footnote-75701336 +Ref: Build<83>-Footnote-85701401 +Ref: Build<83>-Footnote-95701466 +Ref: Build<83>-Footnote-105701531 +Ref: Build<83>-Footnote-115701597 +Ref: Build<83>-Footnote-125701663 +Ref: Build<83>-Footnote-135701729 +Ref: Build<83>-Footnote-145701795 +Ref: Build<83>-Footnote-155701861 +Ref: Build<83>-Footnote-165701927 +Ref: Build<83>-Footnote-175701993 +Node: Windows<74>5702059 +Ref: whatsnew/changelog id7565702181 +Ref: 1b875702181 +Ref: Windows<74>-Footnote-15702891 +Ref: Windows<74>-Footnote-25702956 +Ref: Windows<74>-Footnote-35703021 +Ref: Windows<74>-Footnote-45703086 +Ref: Windows<74>-Footnote-55703151 +Ref: Windows<74>-Footnote-65703216 +Node: Tools/Demos<46>5703281 +Ref: whatsnew/changelog id7575703385 +Ref: 1b885703385 +Ref: Tools/Demos<46>-Footnote-15704009 +Ref: Tools/Demos<46>-Footnote-25704074 +Ref: Tools/Demos<46>-Footnote-35704139 +Ref: Tools/Demos<46>-Footnote-45704204 +Node: Python 3 5 1 final5704269 +Ref: whatsnew/changelog python-3-5-1-final5704415 +Ref: 1b895704415 +Node: Core and Builtins<90>5704578 +Ref: whatsnew/changelog id7585704674 +Ref: 1b8a5704674 +Ref: Core and Builtins<90>-Footnote-15704860 +Node: Windows<75>5704925 +Ref: whatsnew/changelog id7595705021 +Ref: 1b8b5705021 +Ref: Windows<75>-Footnote-15705213 +Node: Python 3 5 1 release candidate 15705278 +Ref: whatsnew/changelog python-3-5-1-release-candidate-15705410 +Ref: 1b8c5705410 +Node: Core and Builtins<91>5705751 +Ref: whatsnew/changelog id7605705861 +Ref: 1b8d5705861 +Ref: Core and Builtins<91>-Footnote-15709009 +Ref: Core and Builtins<91>-Footnote-25709074 +Ref: Core and Builtins<91>-Footnote-35709139 +Ref: Core and Builtins<91>-Footnote-45709204 +Ref: Core and Builtins<91>-Footnote-55709269 +Ref: Core and Builtins<91>-Footnote-65709334 +Ref: Core and Builtins<91>-Footnote-75709399 +Ref: Core and Builtins<91>-Footnote-85709464 +Ref: Core and Builtins<91>-Footnote-95709529 +Ref: Core and Builtins<91>-Footnote-105709594 +Ref: Core and Builtins<91>-Footnote-115709660 +Ref: Core and Builtins<91>-Footnote-125709726 +Ref: Core and Builtins<91>-Footnote-135709792 +Ref: Core and Builtins<91>-Footnote-145709858 +Ref: Core and Builtins<91>-Footnote-155709924 +Ref: Core and Builtins<91>-Footnote-165709990 +Ref: Core and Builtins<91>-Footnote-175710056 +Ref: Core and Builtins<91>-Footnote-185710122 +Ref: Core and Builtins<91>-Footnote-195710188 +Node: Library<89>5710254 +Ref: whatsnew/changelog id7615710381 +Ref: 1b8e5710381 +Ref: Library<89>-Footnote-15720761 +Ref: Library<89>-Footnote-25720826 +Ref: Library<89>-Footnote-35720891 +Ref: Library<89>-Footnote-45720956 +Ref: Library<89>-Footnote-55721020 +Ref: Library<89>-Footnote-65721085 +Ref: Library<89>-Footnote-75721150 +Ref: Library<89>-Footnote-85721215 +Ref: Library<89>-Footnote-95721280 +Ref: Library<89>-Footnote-105721345 +Ref: Library<89>-Footnote-115721411 +Ref: Library<89>-Footnote-125721477 +Ref: Library<89>-Footnote-135721543 +Ref: Library<89>-Footnote-145721609 +Ref: Library<89>-Footnote-155721675 +Ref: Library<89>-Footnote-165721741 +Ref: Library<89>-Footnote-175721807 +Ref: Library<89>-Footnote-185721873 +Ref: Library<89>-Footnote-195721939 +Ref: Library<89>-Footnote-205722005 +Ref: Library<89>-Footnote-215722071 +Ref: Library<89>-Footnote-225722137 +Ref: Library<89>-Footnote-235722203 +Ref: Library<89>-Footnote-245722269 +Ref: Library<89>-Footnote-255722335 +Ref: Library<89>-Footnote-265722401 +Ref: Library<89>-Footnote-275722467 +Ref: Library<89>-Footnote-285722533 +Ref: Library<89>-Footnote-295722599 +Ref: Library<89>-Footnote-305722665 +Ref: Library<89>-Footnote-315722731 +Ref: Library<89>-Footnote-325722797 +Ref: Library<89>-Footnote-335722863 +Ref: Library<89>-Footnote-345722929 +Ref: Library<89>-Footnote-355722995 +Ref: Library<89>-Footnote-365723061 +Ref: Library<89>-Footnote-375723127 +Ref: Library<89>-Footnote-385723193 +Ref: Library<89>-Footnote-395723259 +Ref: Library<89>-Footnote-405723325 +Ref: Library<89>-Footnote-415723391 +Ref: Library<89>-Footnote-425723457 +Ref: Library<89>-Footnote-435723523 +Ref: Library<89>-Footnote-445723589 +Ref: Library<89>-Footnote-455723655 +Ref: Library<89>-Footnote-465723721 +Ref: Library<89>-Footnote-475723787 +Ref: Library<89>-Footnote-485723853 +Ref: Library<89>-Footnote-495723919 +Ref: Library<89>-Footnote-505723985 +Ref: Library<89>-Footnote-515724051 +Ref: Library<89>-Footnote-525724117 +Ref: Library<89>-Footnote-535724183 +Ref: Library<89>-Footnote-545724249 +Ref: Library<89>-Footnote-555724315 +Ref: Library<89>-Footnote-565724381 +Ref: Library<89>-Footnote-575724447 +Ref: Library<89>-Footnote-585724513 +Ref: Library<89>-Footnote-595724579 +Ref: Library<89>-Footnote-605724645 +Ref: Library<89>-Footnote-615724711 +Ref: Library<89>-Footnote-625724777 +Ref: Library<89>-Footnote-635724843 +Ref: Library<89>-Footnote-645724909 +Ref: Library<89>-Footnote-655724975 +Ref: Library<89>-Footnote-665725041 +Ref: Library<89>-Footnote-675725107 +Ref: Library<89>-Footnote-685725173 +Ref: Library<89>-Footnote-695725239 +Ref: Library<89>-Footnote-705725305 +Node: IDLE<62>5725371 +Ref: whatsnew/changelog id7625725494 +Ref: 1b8f5725494 +Ref: IDLE<62>-Footnote-15730447 +Ref: IDLE<62>-Footnote-25730512 +Ref: IDLE<62>-Footnote-35730577 +Ref: IDLE<62>-Footnote-45730642 +Ref: IDLE<62>-Footnote-55730707 +Ref: IDLE<62>-Footnote-65730772 +Ref: IDLE<62>-Footnote-75730837 +Ref: IDLE<62>-Footnote-85730902 +Ref: IDLE<62>-Footnote-95730967 +Ref: IDLE<62>-Footnote-105731032 +Ref: IDLE<62>-Footnote-115731098 +Ref: IDLE<62>-Footnote-125731164 +Ref: IDLE<62>-Footnote-135731230 +Ref: IDLE<62>-Footnote-145731296 +Ref: IDLE<62>-Footnote-155731362 +Ref: IDLE<62>-Footnote-165731428 +Ref: IDLE<62>-Footnote-175731494 +Ref: IDLE<62>-Footnote-185731560 +Ref: IDLE<62>-Footnote-195731626 +Ref: IDLE<62>-Footnote-205731692 +Ref: IDLE<62>-Footnote-215731758 +Ref: IDLE<62>-Footnote-225731824 +Ref: IDLE<62>-Footnote-235731890 +Ref: IDLE<62>-Footnote-245731956 +Ref: IDLE<62>-Footnote-255732022 +Node: Documentation<76>5732088 +Ref: whatsnew/changelog id7635732209 +Ref: 1b905732209 +Ref: Documentation<76>-Footnote-15733292 +Ref: Documentation<76>-Footnote-25733357 +Ref: Documentation<76>-Footnote-35733422 +Ref: Documentation<76>-Footnote-45733487 +Ref: Documentation<76>-Footnote-55733552 +Ref: Documentation<76>-Footnote-65733617 +Node: Tests<80>5733682 +Ref: whatsnew/changelog id7645733804 +Ref: 1b915733804 +Ref: Tests<80>-Footnote-15734313 +Ref: Tests<80>-Footnote-25734378 +Ref: Tests<80>-Footnote-35734443 +Node: Build<84>5734508 +Ref: whatsnew/changelog id7655734624 +Ref: 1b925734624 +Ref: Build<84>-Footnote-15735051 +Ref: Build<84>-Footnote-25735116 +Ref: Build<84>-Footnote-35735181 +Node: Windows<76>5735246 +Ref: whatsnew/changelog id7665735368 +Ref: 1b935735368 +Ref: Windows<76>-Footnote-15736643 +Ref: Windows<76>-Footnote-25736708 +Ref: Windows<76>-Footnote-35736773 +Ref: Windows<76>-Footnote-45736838 +Ref: Windows<76>-Footnote-55736903 +Ref: Windows<76>-Footnote-65736968 +Ref: Windows<76>-Footnote-75737033 +Ref: Windows<76>-Footnote-85737098 +Ref: Windows<76>-Footnote-95737163 +Ref: Windows<76>-Footnote-105737228 +Ref: Windows<76>-Footnote-115737294 +Ref: Windows<76>-Footnote-125737360 +Ref: Windows<76>-Footnote-135737426 +Ref: Windows<76>-Footnote-145737492 +Node: Tools/Demos<47>5737558 +Ref: whatsnew/changelog id7675737662 +Ref: 1b945737662 +Ref: Tools/Demos<47>-Footnote-15737814 +Node: Python 3 5 0 final5737879 +Ref: whatsnew/changelog python-3-5-0-final5738025 +Ref: 1b955738025 +Node: Build<85>5738140 +Ref: whatsnew/changelog id7685738204 +Ref: 1b965738204 +Ref: Build<85>-Footnote-15738382 +Node: Python 3 5 0 release candidate 45738447 +Ref: whatsnew/changelog python-3-5-0-release-candidate-45738593 +Ref: 1b975738593 +Node: Library<90>5738760 +Ref: whatsnew/changelog id7695738858 +Ref: 1b985738858 +Ref: Library<90>-Footnote-15738989 +Node: Build<86>5739054 +Ref: whatsnew/changelog id7705739152 +Ref: 1b995739152 +Ref: Build<86>-Footnote-15739336 +Node: Python 3 5 0 release candidate 35739401 +Ref: whatsnew/changelog python-3-5-0-release-candidate-35739561 +Ref: 1b9a5739561 +Node: Core and Builtins<92>5739752 +Ref: whatsnew/changelog id7715739862 +Ref: 1b9b5739862 +Ref: Core and Builtins<92>-Footnote-15740232 +Ref: Core and Builtins<92>-Footnote-25740297 +Ref: Core and Builtins<92>-Footnote-35740362 +Ref: Core and Builtins<92>-Footnote-45740427 +Node: Library<91>5740469 +Ref: whatsnew/changelog id7725740579 +Ref: 1b9c5740579 +Ref: Library<91>-Footnote-15741355 +Ref: Library<91>-Footnote-25741420 +Ref: Library<91>-Footnote-35741485 +Ref: Library<91>-Footnote-45741550 +Ref: Library<91>-Footnote-55741615 +Node: Python 3 5 0 release candidate 25741680 +Ref: whatsnew/changelog python-3-5-0-release-candidate-25741840 +Ref: 1b9d5741840 +Node: Core and Builtins<93>5742031 +Ref: whatsnew/changelog id7735742141 +Ref: 1b9e5742141 +Ref: Core and Builtins<93>-Footnote-15742687 +Ref: Core and Builtins<93>-Footnote-25742752 +Ref: Core and Builtins<93>-Footnote-35742817 +Node: Library<92>5742882 +Ref: whatsnew/changelog id7745742992 +Ref: 1b9f5742992 +Ref: Library<92>-Footnote-15743275 +Ref: Library<92>-Footnote-25743340 +Ref: Library<92>-Footnote-35743405 +Node: Python 3 5 0 release candidate 15743470 +Ref: whatsnew/changelog python-3-5-0-release-candidate-15743617 +Ref: 1ba05743617 +Node: Core and Builtins<94>5743882 +Ref: whatsnew/changelog id7755743992 +Ref: 1ba15743992 +Ref: Core and Builtins<94>-Footnote-15744172 +Node: Library<93>5744237 +Ref: whatsnew/changelog id7765744364 +Ref: 1ba25744364 +Ref: Library<93>-Footnote-15745948 +Ref: Library<93>-Footnote-25746013 +Ref: Library<93>-Footnote-35746078 +Ref: Library<93>-Footnote-45746143 +Ref: Library<93>-Footnote-55746207 +Ref: Library<93>-Footnote-65746272 +Ref: Library<93>-Footnote-75746337 +Ref: Library<93>-Footnote-85746402 +Ref: Library<93>-Footnote-95746467 +Ref: Library<93>-Footnote-105746532 +Ref: Library<93>-Footnote-115746598 +Ref: Library<93>-Footnote-125746664 +Ref: Library<93>-Footnote-135746730 +Ref: Library<93>-Footnote-145746796 +Ref: Library<93>-Footnote-155746862 +Node: IDLE<63>5746928 +Ref: whatsnew/changelog id7775747051 +Ref: 1ba35747051 +Ref: IDLE<63>-Footnote-15747804 +Ref: IDLE<63>-Footnote-25747869 +Ref: IDLE<63>-Footnote-35747934 +Ref: IDLE<63>-Footnote-45747999 +Node: Documentation<77>5748064 +Ref: whatsnew/changelog id7785748185 +Ref: 1ba45748185 +Ref: Documentation<77>-Footnote-15748847 +Ref: Documentation<77>-Footnote-25748912 +Ref: Documentation<77>-Footnote-35748977 +Ref: Documentation<77>-Footnote-45749042 +Node: Tests<81>5749107 +Ref: whatsnew/changelog id7795749211 +Ref: 1ba55749211 +Ref: Tests<81>-Footnote-15749451 +Node: Python 3 5 0 beta 45749516 +Ref: whatsnew/changelog python-3-5-0-beta-45749650 +Ref: 1ba65749650 +Node: Core and Builtins<95>5749835 +Ref: whatsnew/changelog id7805749932 +Ref: 1ba75749932 +Ref: Core and Builtins<95>-Footnote-15750738 +Ref: Core and Builtins<95>-Footnote-25750803 +Ref: Core and Builtins<95>-Footnote-35750868 +Ref: Core and Builtins<95>-Footnote-45750910 +Ref: Core and Builtins<95>-Footnote-55750975 +Ref: Core and Builtins<95>-Footnote-65751040 +Ref: Core and Builtins<95>-Footnote-75751105 +Ref: Core and Builtins<95>-Footnote-85751170 +Node: Library<94>5751235 +Ref: whatsnew/changelog id7815751350 +Ref: 1ba85751350 +Ref: Library<94>-Footnote-15753633 +Ref: Library<94>-Footnote-25753698 +Ref: Library<94>-Footnote-35753763 +Ref: Library<94>-Footnote-45753828 +Ref: Library<94>-Footnote-55753893 +Ref: Library<94>-Footnote-65753958 +Ref: Library<94>-Footnote-75754023 +Ref: Library<94>-Footnote-85754088 +Ref: Library<94>-Footnote-95754153 +Ref: Library<94>-Footnote-105754218 +Ref: Library<94>-Footnote-115754284 +Ref: Library<94>-Footnote-125754350 +Ref: Library<94>-Footnote-135754416 +Ref: Library<94>-Footnote-145754482 +Ref: Library<94>-Footnote-155754548 +Ref: Library<94>-Footnote-165754614 +Ref: Library<94>-Footnote-175754680 +Ref: Library<94>-Footnote-185754746 +Ref: Library<94>-Footnote-195754812 +Node: Build<87>5754878 +Ref: whatsnew/changelog id7825754963 +Ref: 1ba95754963 +Ref: Build<87>-Footnote-15755128 +Node: Python 3 5 0 beta 35755193 +Ref: whatsnew/changelog python-3-5-0-beta-35755314 +Ref: 1baa5755314 +Node: Core and Builtins<96>5755555 +Ref: whatsnew/changelog id7835755652 +Ref: 1bab5755652 +Ref: Core and Builtins<96>-Footnote-15756979 +Ref: Core and Builtins<96>-Footnote-25757044 +Ref: Core and Builtins<96>-Footnote-35757109 +Ref: Core and Builtins<96>-Footnote-45757174 +Ref: Core and Builtins<96>-Footnote-55757216 +Ref: Core and Builtins<96>-Footnote-65757281 +Node: Library<95>5757346 +Ref: whatsnew/changelog id7845757461 +Ref: 1bac5757461 +Ref: Library<95>-Footnote-15759423 +Ref: Library<95>-Footnote-25759488 +Ref: Library<95>-Footnote-35759553 +Ref: Library<95>-Footnote-45759618 +Ref: Library<95>-Footnote-55759683 +Ref: Library<95>-Footnote-65759748 +Ref: Library<95>-Footnote-75759813 +Ref: Library<95>-Footnote-85759878 +Ref: Library<95>-Footnote-95759943 +Ref: Library<95>-Footnote-105760008 +Ref: Library<95>-Footnote-115760074 +Ref: Library<95>-Footnote-125760140 +Ref: Library<95>-Footnote-135760206 +Ref: Library<95>-Footnote-145760272 +Ref: Library<95>-Footnote-155760338 +Ref: Library<95>-Footnote-165760404 +Ref: Library<95>-Footnote-175760470 +Ref: Library<95>-Footnote-185760536 +Node: Tests<82>5760602 +Ref: whatsnew/changelog id7855760713 +Ref: 1bad5760713 +Ref: Tests<82>-Footnote-15760995 +Ref: Tests<82>-Footnote-25761060 +Node: Documentation<78>5761125 +Ref: whatsnew/changelog id7865761234 +Ref: 1bae5761234 +Ref: Documentation<78>-Footnote-15761578 +Ref: Documentation<78>-Footnote-25761643 +Node: Build<88>5761708 +Ref: whatsnew/changelog id7875761799 +Ref: 1baf5761799 +Ref: Build<88>-Footnote-15761964 +Node: Python 3 5 0 beta 25762029 +Ref: whatsnew/changelog python-3-5-0-beta-25762150 +Ref: 1bb05762150 +Node: Core and Builtins<97>5762315 +Ref: whatsnew/changelog id7885762412 +Ref: 1bb15762412 +Ref: Core and Builtins<97>-Footnote-15763165 +Ref: Core and Builtins<97>-Footnote-25763230 +Ref: Core and Builtins<97>-Footnote-35763295 +Ref: Core and Builtins<97>-Footnote-45763360 +Ref: Core and Builtins<97>-Footnote-55763425 +Node: Library<96>5763490 +Ref: whatsnew/changelog id7895763587 +Ref: 1bb25763587 +Ref: Library<96>-Footnote-15764294 +Ref: Library<96>-Footnote-25764359 +Ref: Library<96>-Footnote-35764424 +Ref: Library<96>-Footnote-45764466 +Ref: Library<96>-Footnote-55764530 +Ref: Library<96>-Footnote-65764595 +Ref: Library<96>-Footnote-75764660 +Node: Python 3 5 0 beta 15764725 +Ref: whatsnew/changelog python-3-5-0-beta-15764847 +Ref: 1bb35764847 +Node: Core and Builtins<98>5765118 +Ref: whatsnew/changelog id7905765215 +Ref: 1bb45765215 +Ref: Core and Builtins<98>-Footnote-15767088 +Ref: Core and Builtins<98>-Footnote-25767153 +Ref: Core and Builtins<98>-Footnote-35767218 +Ref: Core and Builtins<98>-Footnote-45767283 +Ref: Core and Builtins<98>-Footnote-55767348 +Ref: Core and Builtins<98>-Footnote-65767413 +Ref: Core and Builtins<98>-Footnote-75767478 +Ref: Core and Builtins<98>-Footnote-85767543 +Ref: Core and Builtins<98>-Footnote-95767608 +Ref: Core and Builtins<98>-Footnote-105767673 +Ref: Core and Builtins<98>-Footnote-115767738 +Ref: Core and Builtins<98>-Footnote-125767804 +Ref: Core and Builtins<98>-Footnote-135767870 +Ref: Core and Builtins<98>-Footnote-145767936 +Ref: Core and Builtins<98>-Footnote-155768002 +Ref: Core and Builtins<98>-Footnote-165768068 +Ref: Core and Builtins<98>-Footnote-175768134 +Ref: Core and Builtins<98>-Footnote-185768199 +Ref: Core and Builtins<98>-Footnote-195768265 +Node: Library<97>5768331 +Ref: whatsnew/changelog id7915768445 +Ref: 1bb55768445 +Ref: Library<97>-Footnote-15776107 +Ref: Library<97>-Footnote-25776172 +Ref: Library<97>-Footnote-35776237 +Ref: Library<97>-Footnote-45776302 +Ref: Library<97>-Footnote-55776367 +Ref: Library<97>-Footnote-65776432 +Ref: Library<97>-Footnote-75776497 +Ref: Library<97>-Footnote-85776562 +Ref: Library<97>-Footnote-95776627 +Ref: Library<97>-Footnote-105776692 +Ref: Library<97>-Footnote-115776757 +Ref: Library<97>-Footnote-125776823 +Ref: Library<97>-Footnote-135776889 +Ref: Library<97>-Footnote-145776955 +Ref: Library<97>-Footnote-155777020 +Ref: Library<97>-Footnote-165777086 +Ref: Library<97>-Footnote-175777152 +Ref: Library<97>-Footnote-185777218 +Ref: Library<97>-Footnote-195777284 +Ref: Library<97>-Footnote-205777350 +Ref: Library<97>-Footnote-215777416 +Ref: Library<97>-Footnote-225777482 +Ref: Library<97>-Footnote-235777548 +Ref: Library<97>-Footnote-245777614 +Ref: Library<97>-Footnote-255777680 +Ref: Library<97>-Footnote-265777745 +Ref: Library<97>-Footnote-275777811 +Ref: Library<97>-Footnote-285777877 +Ref: Library<97>-Footnote-295777943 +Ref: Library<97>-Footnote-305778009 +Ref: Library<97>-Footnote-315778075 +Ref: Library<97>-Footnote-325778141 +Ref: Library<97>-Footnote-335778207 +Ref: Library<97>-Footnote-345778273 +Ref: Library<97>-Footnote-355778339 +Ref: Library<97>-Footnote-365778405 +Ref: Library<97>-Footnote-375778471 +Ref: Library<97>-Footnote-385778537 +Ref: Library<97>-Footnote-395778603 +Ref: Library<97>-Footnote-405778669 +Ref: Library<97>-Footnote-415778735 +Ref: Library<97>-Footnote-425778800 +Ref: Library<97>-Footnote-435778866 +Ref: Library<97>-Footnote-445778932 +Ref: Library<97>-Footnote-455778998 +Ref: Library<97>-Footnote-465779064 +Ref: Library<97>-Footnote-475779130 +Ref: Library<97>-Footnote-485779196 +Ref: Library<97>-Footnote-495779262 +Ref: Library<97>-Footnote-505779328 +Ref: Library<97>-Footnote-515779394 +Ref: Library<97>-Footnote-525779460 +Ref: Library<97>-Footnote-535779526 +Ref: Library<97>-Footnote-545779592 +Ref: Library<97>-Footnote-555779658 +Ref: Library<97>-Footnote-565779724 +Node: IDLE<64>5779790 +Ref: whatsnew/changelog id7925779892 +Ref: 1bb65779892 +Ref: IDLE<64>-Footnote-15780061 +Node: Tests<83>5780126 +Ref: whatsnew/changelog id7935780234 +Ref: 1bb75780234 +Ref: Tests<83>-Footnote-15780532 +Ref: Tests<83>-Footnote-25780597 +Node: Documentation<79>5780661 +Ref: whatsnew/changelog id7945780776 +Ref: 1bb85780776 +Ref: Documentation<79>-Footnote-15781183 +Ref: Documentation<79>-Footnote-25781248 +Ref: Documentation<79>-Footnote-35781313 +Node: Tools/Demos<48>5781378 +Ref: whatsnew/changelog id7955781475 +Ref: 1bb95781475 +Ref: Tools/Demos<48>-Footnote-15781994 +Ref: Tools/Demos<48>-Footnote-25782059 +Ref: Tools/Demos<48>-Footnote-35782124 +Ref: Tools/Demos<48>-Footnote-45782189 +Node: Python 3 5 0 alpha 45782254 +Ref: whatsnew/changelog python-3-5-0-alpha-45782377 +Ref: 1bba5782377 +Node: Core and Builtins<99>5782636 +Ref: whatsnew/changelog id7965782734 +Ref: 1bbb5782734 +Ref: Core and Builtins<99>-Footnote-15784103 +Ref: Core and Builtins<99>-Footnote-25784168 +Ref: Core and Builtins<99>-Footnote-35784210 +Ref: Core and Builtins<99>-Footnote-45784275 +Ref: Core and Builtins<99>-Footnote-55784340 +Ref: Core and Builtins<99>-Footnote-65784382 +Ref: Core and Builtins<99>-Footnote-75784447 +Ref: Core and Builtins<99>-Footnote-85784512 +Ref: Core and Builtins<99>-Footnote-95784577 +Ref: Core and Builtins<99>-Footnote-105784642 +Ref: Core and Builtins<99>-Footnote-115784708 +Node: Library<98>5784774 +Ref: whatsnew/changelog id7975784890 +Ref: 1bbc5784890 +Ref: Library<98>-Footnote-15791607 +Ref: Library<98>-Footnote-25791672 +Ref: Library<98>-Footnote-35791737 +Ref: Library<98>-Footnote-45791801 +Ref: Library<98>-Footnote-55791866 +Ref: Library<98>-Footnote-65791931 +Ref: Library<98>-Footnote-75791995 +Ref: Library<98>-Footnote-85792060 +Ref: Library<98>-Footnote-95792125 +Ref: Library<98>-Footnote-105792190 +Ref: Library<98>-Footnote-115792256 +Ref: Library<98>-Footnote-125792322 +Ref: Library<98>-Footnote-135792388 +Ref: Library<98>-Footnote-145792454 +Ref: Library<98>-Footnote-155792520 +Ref: Library<98>-Footnote-165792586 +Ref: Library<98>-Footnote-175792652 +Ref: Library<98>-Footnote-185792718 +Ref: Library<98>-Footnote-195792784 +Ref: Library<98>-Footnote-205792850 +Ref: Library<98>-Footnote-215792916 +Ref: Library<98>-Footnote-225792982 +Ref: Library<98>-Footnote-235793048 +Ref: Library<98>-Footnote-245793114 +Ref: Library<98>-Footnote-255793180 +Ref: Library<98>-Footnote-265793246 +Ref: Library<98>-Footnote-275793312 +Ref: Library<98>-Footnote-285793378 +Ref: Library<98>-Footnote-295793444 +Ref: Library<98>-Footnote-305793510 +Ref: Library<98>-Footnote-315793575 +Ref: Library<98>-Footnote-325793641 +Ref: Library<98>-Footnote-335793707 +Ref: Library<98>-Footnote-345793773 +Ref: Library<98>-Footnote-355793839 +Ref: Library<98>-Footnote-365793905 +Ref: Library<98>-Footnote-375793971 +Ref: Library<98>-Footnote-385794037 +Ref: Library<98>-Footnote-395794103 +Ref: Library<98>-Footnote-405794169 +Ref: Library<98>-Footnote-415794235 +Ref: Library<98>-Footnote-425794301 +Ref: Library<98>-Footnote-435794344 +Ref: Library<98>-Footnote-445794410 +Ref: Library<98>-Footnote-455794476 +Ref: Library<98>-Footnote-465794542 +Ref: Library<98>-Footnote-475794608 +Ref: Library<98>-Footnote-485794674 +Node: Build<89>5794740 +Ref: whatsnew/changelog id7985794844 +Ref: 1bbd5794844 +Ref: Build<89>-Footnote-15795129 +Ref: Build<89>-Footnote-25795194 +Node: Tests<84>5795259 +Ref: whatsnew/changelog id7995795367 +Ref: 1bbe5795367 +Ref: Tests<84>-Footnote-15795668 +Ref: Tests<84>-Footnote-25795733 +Node: Tools/Demos<49>5795798 +Ref: whatsnew/changelog id8005795906 +Ref: 1bbf5795906 +Ref: Tools/Demos<49>-Footnote-15796940 +Ref: Tools/Demos<49>-Footnote-25797005 +Ref: Tools/Demos<49>-Footnote-35797070 +Ref: Tools/Demos<49>-Footnote-45797135 +Ref: Tools/Demos<49>-Footnote-55797200 +Ref: Tools/Demos<49>-Footnote-65797265 +Node: C API<73>5797330 +Ref: whatsnew/changelog id8015797420 +Ref: 1bc05797420 +Ref: C API<73>-Footnote-15797575 +Node: Python 3 5 0 alpha 35797640 +Ref: whatsnew/changelog python-3-5-0-alpha-35797764 +Ref: 1bc15797764 +Node: Core and Builtins<100>5798004 +Ref: whatsnew/changelog id8025798103 +Ref: 1bc25798103 +Ref: Core and Builtins<100>-Footnote-15798899 +Ref: Core and Builtins<100>-Footnote-25798964 +Ref: Core and Builtins<100>-Footnote-35799029 +Ref: Core and Builtins<100>-Footnote-45799094 +Ref: Core and Builtins<100>-Footnote-55799159 +Ref: Core and Builtins<100>-Footnote-65799224 +Node: Library<99>5799289 +Ref: whatsnew/changelog id8035799406 +Ref: 1bc35799406 +Ref: Library<99>-Footnote-15805842 +Ref: Library<99>-Footnote-25805907 +Ref: Library<99>-Footnote-35805972 +Ref: Library<99>-Footnote-45806037 +Ref: Library<99>-Footnote-55806102 +Ref: Library<99>-Footnote-65806167 +Ref: Library<99>-Footnote-75806232 +Ref: Library<99>-Footnote-85806297 +Ref: Library<99>-Footnote-95806362 +Ref: Library<99>-Footnote-105806427 +Ref: Library<99>-Footnote-115806493 +Ref: Library<99>-Footnote-125806559 +Ref: Library<99>-Footnote-135806625 +Ref: Library<99>-Footnote-145806691 +Ref: Library<99>-Footnote-155806756 +Ref: Library<99>-Footnote-165806822 +Ref: Library<99>-Footnote-175806888 +Ref: Library<99>-Footnote-185806954 +Ref: Library<99>-Footnote-195807020 +Ref: Library<99>-Footnote-205807086 +Ref: Library<99>-Footnote-215807152 +Ref: Library<99>-Footnote-225807218 +Ref: Library<99>-Footnote-235807284 +Ref: Library<99>-Footnote-245807350 +Ref: Library<99>-Footnote-255807416 +Ref: Library<99>-Footnote-265807482 +Ref: Library<99>-Footnote-275807548 +Ref: Library<99>-Footnote-285807614 +Ref: Library<99>-Footnote-295807680 +Ref: Library<99>-Footnote-305807746 +Ref: Library<99>-Footnote-315807811 +Ref: Library<99>-Footnote-325807877 +Ref: Library<99>-Footnote-335807943 +Ref: Library<99>-Footnote-345808009 +Ref: Library<99>-Footnote-355808074 +Ref: Library<99>-Footnote-365808140 +Ref: Library<99>-Footnote-375808206 +Ref: Library<99>-Footnote-385808272 +Ref: Library<99>-Footnote-395808338 +Ref: Library<99>-Footnote-405808404 +Ref: Library<99>-Footnote-415808470 +Ref: Library<99>-Footnote-425808536 +Node: Build<90>5808602 +Ref: whatsnew/changelog id8045808706 +Ref: 1bc45808706 +Ref: Build<90>-Footnote-15808851 +Node: Tests<85>5808916 +Ref: whatsnew/changelog id8055809024 +Ref: 1bc55809024 +Ref: Tests<85>-Footnote-15809249 +Ref: Tests<85>-Footnote-25809314 +Node: Tools/Demos<50>5809379 +Ref: whatsnew/changelog id8065809469 +Ref: 1bc65809469 +Ref: Tools/Demos<50>-Footnote-15809738 +Node: Python 3 5 0 alpha 25809803 +Ref: whatsnew/changelog python-3-5-0-alpha-25809927 +Ref: 1bc75809927 +Node: Core and Builtins<101>5810160 +Ref: whatsnew/changelog id8075810260 +Ref: 1bc85810260 +Ref: Core and Builtins<101>-Footnote-15810558 +Node: Library<100>5810623 +Ref: whatsnew/changelog id8085810741 +Ref: 1bc95810741 +Ref: Library<100>-Footnote-15815058 +Ref: Library<100>-Footnote-25815123 +Ref: Library<100>-Footnote-35815165 +Ref: Library<100>-Footnote-45815230 +Ref: Library<100>-Footnote-55815295 +Ref: Library<100>-Footnote-65815360 +Ref: Library<100>-Footnote-75815425 +Ref: Library<100>-Footnote-85815490 +Ref: Library<100>-Footnote-95815555 +Ref: Library<100>-Footnote-105815619 +Ref: Library<100>-Footnote-115815685 +Ref: Library<100>-Footnote-125815751 +Ref: Library<100>-Footnote-135815817 +Ref: Library<100>-Footnote-145815883 +Ref: Library<100>-Footnote-155815949 +Ref: Library<100>-Footnote-165816015 +Ref: Library<100>-Footnote-175816080 +Ref: Library<100>-Footnote-185816147 +Ref: Library<100>-Footnote-195816212 +Ref: Library<100>-Footnote-205816278 +Ref: Library<100>-Footnote-215816343 +Ref: Library<100>-Footnote-225816409 +Ref: Library<100>-Footnote-235816475 +Ref: Library<100>-Footnote-245816541 +Ref: Library<100>-Footnote-255816607 +Ref: Library<100>-Footnote-265816673 +Ref: Library<100>-Footnote-275816739 +Ref: Library<100>-Footnote-285816805 +Ref: Library<100>-Footnote-295816871 +Ref: Library<100>-Footnote-305816937 +Ref: Library<100>-Footnote-315817003 +Ref: Library<100>-Footnote-325817069 +Ref: Library<100>-Footnote-335817135 +Ref: Library<100>-Footnote-345817201 +Ref: Library<100>-Footnote-355817267 +Ref: Library<100>-Footnote-365817333 +Ref: Library<100>-Footnote-375817399 +Node: Build<91>5817465 +Ref: whatsnew/changelog id8095817570 +Ref: 1bca5817570 +Ref: Build<91>-Footnote-15817841 +Ref: Build<91>-Footnote-25817906 +Node: C API<74>5817971 +Ref: whatsnew/changelog id8105818075 +Ref: 1bcb5818075 +Ref: C API<74>-Footnote-15818257 +Node: Windows<77>5818322 +Ref: whatsnew/changelog id8115818408 +Ref: 1bcc5818408 +Ref: Windows<77>-Footnote-15818705 +Ref: Windows<77>-Footnote-25818770 +Ref: Windows<77>-Footnote-35818812 +Node: Python 3 5 0 alpha 15818877 +Ref: whatsnew/changelog python-3-5-0-alpha-15818972 +Ref: 1bcd5818972 +Node: Core and Builtins<102>5819311 +Ref: whatsnew/changelog id8125819411 +Ref: 1bce5819411 +Ref: Core and Builtins<102>-Footnote-15829336 +Ref: Core and Builtins<102>-Footnote-25829401 +Ref: Core and Builtins<102>-Footnote-35829466 +Ref: Core and Builtins<102>-Footnote-45829531 +Ref: Core and Builtins<102>-Footnote-55829596 +Ref: Core and Builtins<102>-Footnote-65829661 +Ref: Core and Builtins<102>-Footnote-75829726 +Ref: Core and Builtins<102>-Footnote-85829791 +Ref: Core and Builtins<102>-Footnote-95829856 +Ref: Core and Builtins<102>-Footnote-105829921 +Ref: Core and Builtins<102>-Footnote-115829987 +Ref: Core and Builtins<102>-Footnote-125830053 +Ref: Core and Builtins<102>-Footnote-135830119 +Ref: Core and Builtins<102>-Footnote-145830185 +Ref: Core and Builtins<102>-Footnote-155830251 +Ref: Core and Builtins<102>-Footnote-165830317 +Ref: Core and Builtins<102>-Footnote-175830383 +Ref: Core and Builtins<102>-Footnote-185830449 +Ref: Core and Builtins<102>-Footnote-195830515 +Ref: Core and Builtins<102>-Footnote-205830581 +Ref: Core and Builtins<102>-Footnote-215830647 +Ref: Core and Builtins<102>-Footnote-225830713 +Ref: Core and Builtins<102>-Footnote-235830779 +Ref: Core and Builtins<102>-Footnote-245830845 +Ref: Core and Builtins<102>-Footnote-255830911 +Ref: Core and Builtins<102>-Footnote-265830977 +Ref: Core and Builtins<102>-Footnote-275831043 +Ref: Core and Builtins<102>-Footnote-285831109 +Ref: Core and Builtins<102>-Footnote-295831175 +Ref: Core and Builtins<102>-Footnote-305831241 +Ref: Core and Builtins<102>-Footnote-315831307 +Ref: Core and Builtins<102>-Footnote-325831373 +Ref: Core and Builtins<102>-Footnote-335831439 +Ref: Core and Builtins<102>-Footnote-345831507 +Ref: Core and Builtins<102>-Footnote-355831573 +Ref: Core and Builtins<102>-Footnote-365831639 +Ref: Core and Builtins<102>-Footnote-375831705 +Ref: Core and Builtins<102>-Footnote-385831771 +Ref: Core and Builtins<102>-Footnote-395831837 +Ref: Core and Builtins<102>-Footnote-405831903 +Ref: Core and Builtins<102>-Footnote-415831969 +Ref: Core and Builtins<102>-Footnote-425832035 +Ref: Core and Builtins<102>-Footnote-435832101 +Ref: Core and Builtins<102>-Footnote-445832167 +Ref: Core and Builtins<102>-Footnote-455832233 +Ref: Core and Builtins<102>-Footnote-465832299 +Ref: Core and Builtins<102>-Footnote-475832365 +Ref: Core and Builtins<102>-Footnote-485832431 +Ref: Core and Builtins<102>-Footnote-495832497 +Ref: Core and Builtins<102>-Footnote-505832563 +Ref: Core and Builtins<102>-Footnote-515832629 +Ref: Core and Builtins<102>-Footnote-525832695 +Ref: Core and Builtins<102>-Footnote-535832761 +Ref: Core and Builtins<102>-Footnote-545832827 +Ref: Core and Builtins<102>-Footnote-555832893 +Ref: Core and Builtins<102>-Footnote-565832959 +Ref: Core and Builtins<102>-Footnote-575833025 +Ref: Core and Builtins<102>-Footnote-585833091 +Ref: Core and Builtins<102>-Footnote-595833157 +Ref: Core and Builtins<102>-Footnote-605833223 +Ref: Core and Builtins<102>-Footnote-615833289 +Ref: Core and Builtins<102>-Footnote-625833355 +Ref: Core and Builtins<102>-Footnote-635833421 +Ref: Core and Builtins<102>-Footnote-645833487 +Ref: Core and Builtins<102>-Footnote-655833553 +Ref: Core and Builtins<102>-Footnote-665833619 +Ref: Core and Builtins<102>-Footnote-675833684 +Ref: Core and Builtins<102>-Footnote-685833750 +Ref: Core and Builtins<102>-Footnote-695833816 +Ref: Core and Builtins<102>-Footnote-705833882 +Ref: Core and Builtins<102>-Footnote-715833948 +Ref: Core and Builtins<102>-Footnote-725834014 +Ref: Core and Builtins<102>-Footnote-735834079 +Node: Library<101>5834145 +Ref: whatsnew/changelog id8135834262 +Ref: 1bcf5834262 +Ref: Library<101>-Footnote-15886793 +Ref: Library<101>-Footnote-25886858 +Ref: Library<101>-Footnote-35886923 +Ref: Library<101>-Footnote-45886988 +Ref: Library<101>-Footnote-55887053 +Ref: Library<101>-Footnote-65887118 +Ref: Library<101>-Footnote-75887183 +Ref: Library<101>-Footnote-85887248 +Ref: Library<101>-Footnote-95887313 +Ref: Library<101>-Footnote-105887378 +Ref: Library<101>-Footnote-115887444 +Ref: Library<101>-Footnote-125887510 +Ref: Library<101>-Footnote-135887576 +Ref: Library<101>-Footnote-145887642 +Ref: Library<101>-Footnote-155887708 +Ref: Library<101>-Footnote-165887774 +Ref: Library<101>-Footnote-175887840 +Ref: Library<101>-Footnote-185887906 +Ref: Library<101>-Footnote-195887972 +Ref: Library<101>-Footnote-205888038 +Ref: Library<101>-Footnote-215888104 +Ref: Library<101>-Footnote-225888170 +Ref: Library<101>-Footnote-235888236 +Ref: Library<101>-Footnote-245888302 +Ref: Library<101>-Footnote-255888368 +Ref: Library<101>-Footnote-265888434 +Ref: Library<101>-Footnote-275888500 +Ref: Library<101>-Footnote-285888566 +Ref: Library<101>-Footnote-295888632 +Ref: Library<101>-Footnote-305888698 +Ref: Library<101>-Footnote-315888764 +Ref: Library<101>-Footnote-325888830 +Ref: Library<101>-Footnote-335888896 +Ref: Library<101>-Footnote-345888962 +Ref: Library<101>-Footnote-355889028 +Ref: Library<101>-Footnote-365889094 +Ref: Library<101>-Footnote-375889160 +Ref: Library<101>-Footnote-385889226 +Ref: Library<101>-Footnote-395889292 +Ref: Library<101>-Footnote-405889358 +Ref: Library<101>-Footnote-415889424 +Ref: Library<101>-Footnote-425889490 +Ref: Library<101>-Footnote-435889556 +Ref: Library<101>-Footnote-445889622 +Ref: Library<101>-Footnote-455889688 +Ref: Library<101>-Footnote-465889754 +Ref: Library<101>-Footnote-475889820 +Ref: Library<101>-Footnote-485889886 +Ref: Library<101>-Footnote-495889952 +Ref: Library<101>-Footnote-505890018 +Ref: Library<101>-Footnote-515890084 +Ref: Library<101>-Footnote-525890150 +Ref: Library<101>-Footnote-535890216 +Ref: Library<101>-Footnote-545890282 +Ref: Library<101>-Footnote-555890348 +Ref: Library<101>-Footnote-565890416 +Ref: Library<101>-Footnote-575890482 +Ref: Library<101>-Footnote-585890548 +Ref: Library<101>-Footnote-595890614 +Ref: Library<101>-Footnote-605890680 +Ref: Library<101>-Footnote-615890746 +Ref: Library<101>-Footnote-625890802 +Ref: Library<101>-Footnote-635890868 +Ref: Library<101>-Footnote-645890934 +Ref: Library<101>-Footnote-655891000 +Ref: Library<101>-Footnote-665891066 +Ref: Library<101>-Footnote-675891132 +Ref: Library<101>-Footnote-685891198 +Ref: Library<101>-Footnote-695891264 +Ref: Library<101>-Footnote-705891330 +Ref: Library<101>-Footnote-715891396 +Ref: Library<101>-Footnote-725891462 +Ref: Library<101>-Footnote-735891528 +Ref: Library<101>-Footnote-745891594 +Ref: Library<101>-Footnote-755891660 +Ref: Library<101>-Footnote-765891726 +Ref: Library<101>-Footnote-775891792 +Ref: Library<101>-Footnote-785891858 +Ref: Library<101>-Footnote-795891924 +Ref: Library<101>-Footnote-805891990 +Ref: Library<101>-Footnote-815892056 +Ref: Library<101>-Footnote-825892122 +Ref: Library<101>-Footnote-835892188 +Ref: Library<101>-Footnote-845892254 +Ref: Library<101>-Footnote-855892320 +Ref: Library<101>-Footnote-865892386 +Ref: Library<101>-Footnote-875892452 +Ref: Library<101>-Footnote-885892518 +Ref: Library<101>-Footnote-895892584 +Ref: Library<101>-Footnote-905892650 +Ref: Library<101>-Footnote-915892716 +Ref: Library<101>-Footnote-925892782 +Ref: Library<101>-Footnote-935892848 +Ref: Library<101>-Footnote-945892914 +Ref: Library<101>-Footnote-955892980 +Ref: Library<101>-Footnote-965893046 +Ref: Library<101>-Footnote-975893111 +Ref: Library<101>-Footnote-985893177 +Ref: Library<101>-Footnote-995893243 +Ref: Library<101>-Footnote-1005893309 +Ref: Library<101>-Footnote-1015893375 +Ref: Library<101>-Footnote-1025893442 +Ref: Library<101>-Footnote-1035893509 +Ref: Library<101>-Footnote-1045893576 +Ref: Library<101>-Footnote-1055893643 +Ref: Library<101>-Footnote-1065893710 +Ref: Library<101>-Footnote-1075893777 +Ref: Library<101>-Footnote-1085893843 +Ref: Library<101>-Footnote-1095893909 +Ref: Library<101>-Footnote-1105893976 +Ref: Library<101>-Footnote-1115894043 +Ref: Library<101>-Footnote-1125894110 +Ref: Library<101>-Footnote-1135894177 +Ref: Library<101>-Footnote-1145894244 +Ref: Library<101>-Footnote-1155894311 +Ref: Library<101>-Footnote-1165894378 +Ref: Library<101>-Footnote-1175894445 +Ref: Library<101>-Footnote-1185894512 +Ref: Library<101>-Footnote-1195894579 +Ref: Library<101>-Footnote-1205894646 +Ref: Library<101>-Footnote-1215894713 +Ref: Library<101>-Footnote-1225894782 +Ref: Library<101>-Footnote-1235894849 +Ref: Library<101>-Footnote-1245894916 +Ref: Library<101>-Footnote-1255894983 +Ref: Library<101>-Footnote-1265895050 +Ref: Library<101>-Footnote-1275895117 +Ref: Library<101>-Footnote-1285895184 +Ref: Library<101>-Footnote-1295895251 +Ref: Library<101>-Footnote-1305895318 +Ref: Library<101>-Footnote-1315895385 +Ref: Library<101>-Footnote-1325895452 +Ref: Library<101>-Footnote-1335895519 +Ref: Library<101>-Footnote-1345895586 +Ref: Library<101>-Footnote-1355895653 +Ref: Library<101>-Footnote-1365895720 +Ref: Library<101>-Footnote-1375895787 +Ref: Library<101>-Footnote-1385895854 +Ref: Library<101>-Footnote-1395895921 +Ref: Library<101>-Footnote-1405895988 +Ref: Library<101>-Footnote-1415896055 +Ref: Library<101>-Footnote-1425896122 +Ref: Library<101>-Footnote-1435896188 +Ref: Library<101>-Footnote-1445896254 +Ref: Library<101>-Footnote-1455896321 +Ref: Library<101>-Footnote-1465896388 +Ref: Library<101>-Footnote-1475896455 +Ref: Library<101>-Footnote-1485896522 +Ref: Library<101>-Footnote-1495896589 +Ref: Library<101>-Footnote-1505896656 +Ref: Library<101>-Footnote-1515896723 +Ref: Library<101>-Footnote-1525896790 +Ref: Library<101>-Footnote-1535896857 +Ref: Library<101>-Footnote-1545896924 +Ref: Library<101>-Footnote-1555896991 +Ref: Library<101>-Footnote-1565897058 +Ref: Library<101>-Footnote-1575897125 +Ref: Library<101>-Footnote-1585897191 +Ref: Library<101>-Footnote-1595897258 +Ref: Library<101>-Footnote-1605897325 +Ref: Library<101>-Footnote-1615897392 +Ref: Library<101>-Footnote-1625897459 +Ref: Library<101>-Footnote-1635897526 +Ref: Library<101>-Footnote-1645897593 +Ref: Library<101>-Footnote-1655897660 +Ref: Library<101>-Footnote-1665897727 +Ref: Library<101>-Footnote-1675897794 +Ref: Library<101>-Footnote-1685897861 +Ref: Library<101>-Footnote-1695897928 +Ref: Library<101>-Footnote-1705897995 +Ref: Library<101>-Footnote-1715898062 +Ref: Library<101>-Footnote-1725898129 +Ref: Library<101>-Footnote-1735898196 +Ref: Library<101>-Footnote-1745898263 +Ref: Library<101>-Footnote-1755898330 +Ref: Library<101>-Footnote-1765898397 +Ref: Library<101>-Footnote-1775898464 +Ref: Library<101>-Footnote-1785898531 +Ref: Library<101>-Footnote-1795898598 +Ref: Library<101>-Footnote-1805898665 +Ref: Library<101>-Footnote-1815898732 +Ref: Library<101>-Footnote-1825898799 +Ref: Library<101>-Footnote-1835898866 +Ref: Library<101>-Footnote-1845898933 +Ref: Library<101>-Footnote-1855899000 +Ref: Library<101>-Footnote-1865899067 +Ref: Library<101>-Footnote-1875899134 +Ref: Library<101>-Footnote-1885899201 +Ref: Library<101>-Footnote-1895899267 +Ref: Library<101>-Footnote-1905899334 +Ref: Library<101>-Footnote-1915899401 +Ref: Library<101>-Footnote-1925899468 +Ref: Library<101>-Footnote-1935899535 +Ref: Library<101>-Footnote-1945899602 +Ref: Library<101>-Footnote-1955899669 +Ref: Library<101>-Footnote-1965899736 +Ref: Library<101>-Footnote-1975899802 +Ref: Library<101>-Footnote-1985899869 +Ref: Library<101>-Footnote-1995899936 +Ref: Library<101>-Footnote-2005900003 +Ref: Library<101>-Footnote-2015900070 +Ref: Library<101>-Footnote-2025900137 +Ref: Library<101>-Footnote-2035900204 +Ref: Library<101>-Footnote-2045900270 +Ref: Library<101>-Footnote-2055900337 +Ref: Library<101>-Footnote-2065900404 +Ref: Library<101>-Footnote-2075900471 +Ref: Library<101>-Footnote-2085900538 +Ref: Library<101>-Footnote-2095900605 +Ref: Library<101>-Footnote-2105900672 +Ref: Library<101>-Footnote-2115900739 +Ref: Library<101>-Footnote-2125900806 +Ref: Library<101>-Footnote-2135900873 +Ref: Library<101>-Footnote-2145900940 +Ref: Library<101>-Footnote-2155901007 +Ref: Library<101>-Footnote-2165901074 +Ref: Library<101>-Footnote-2175901141 +Ref: Library<101>-Footnote-2185901208 +Ref: Library<101>-Footnote-2195901275 +Ref: Library<101>-Footnote-2205901342 +Ref: Library<101>-Footnote-2215901409 +Ref: Library<101>-Footnote-2225901476 +Ref: Library<101>-Footnote-2235901543 +Ref: Library<101>-Footnote-2245901610 +Ref: Library<101>-Footnote-2255901676 +Ref: Library<101>-Footnote-2265901742 +Ref: Library<101>-Footnote-2275901809 +Ref: Library<101>-Footnote-2285901876 +Ref: Library<101>-Footnote-2295901943 +Ref: Library<101>-Footnote-2305902010 +Ref: Library<101>-Footnote-2315902077 +Ref: Library<101>-Footnote-2325902144 +Ref: Library<101>-Footnote-2335902211 +Ref: Library<101>-Footnote-2345902278 +Ref: Library<101>-Footnote-2355902345 +Ref: Library<101>-Footnote-2365902412 +Ref: Library<101>-Footnote-2375902479 +Ref: Library<101>-Footnote-2385902546 +Ref: Library<101>-Footnote-2395902613 +Ref: Library<101>-Footnote-2405902680 +Ref: Library<101>-Footnote-2415902747 +Ref: Library<101>-Footnote-2425902814 +Ref: Library<101>-Footnote-2435902881 +Ref: Library<101>-Footnote-2445902948 +Ref: Library<101>-Footnote-2455903015 +Ref: Library<101>-Footnote-2465903081 +Ref: Library<101>-Footnote-2475903148 +Ref: Library<101>-Footnote-2485903215 +Ref: Library<101>-Footnote-2495903282 +Ref: Library<101>-Footnote-2505903349 +Ref: Library<101>-Footnote-2515903416 +Ref: Library<101>-Footnote-2525903483 +Ref: Library<101>-Footnote-2535903550 +Ref: Library<101>-Footnote-2545903617 +Ref: Library<101>-Footnote-2555903684 +Ref: Library<101>-Footnote-2565903751 +Ref: Library<101>-Footnote-2575903818 +Ref: Library<101>-Footnote-2585903885 +Ref: Library<101>-Footnote-2595903952 +Ref: Library<101>-Footnote-2605904019 +Ref: Library<101>-Footnote-2615904086 +Ref: Library<101>-Footnote-2625904153 +Ref: Library<101>-Footnote-2635904220 +Ref: Library<101>-Footnote-2645904287 +Ref: Library<101>-Footnote-2655904354 +Ref: Library<101>-Footnote-2665904421 +Ref: Library<101>-Footnote-2675904488 +Ref: Library<101>-Footnote-2685904555 +Ref: Library<101>-Footnote-2695904622 +Ref: Library<101>-Footnote-2705904689 +Ref: Library<101>-Footnote-2715904756 +Ref: Library<101>-Footnote-2725904823 +Ref: Library<101>-Footnote-2735904890 +Ref: Library<101>-Footnote-2745904957 +Ref: Library<101>-Footnote-2755905024 +Ref: Library<101>-Footnote-2765905091 +Ref: Library<101>-Footnote-2775905158 +Ref: Library<101>-Footnote-2785905224 +Ref: Library<101>-Footnote-2795905291 +Ref: Library<101>-Footnote-2805905358 +Ref: Library<101>-Footnote-2815905425 +Ref: Library<101>-Footnote-2825905492 +Ref: Library<101>-Footnote-2835905559 +Ref: Library<101>-Footnote-2845905626 +Ref: Library<101>-Footnote-2855905693 +Ref: Library<101>-Footnote-2865905760 +Ref: Library<101>-Footnote-2875905827 +Ref: Library<101>-Footnote-2885905894 +Ref: Library<101>-Footnote-2895905961 +Ref: Library<101>-Footnote-2905906005 +Ref: Library<101>-Footnote-2915906072 +Ref: Library<101>-Footnote-2925906139 +Ref: Library<101>-Footnote-2935906206 +Ref: Library<101>-Footnote-2945906273 +Ref: Library<101>-Footnote-2955906340 +Ref: Library<101>-Footnote-2965906407 +Ref: Library<101>-Footnote-2975906474 +Ref: Library<101>-Footnote-2985906541 +Ref: Library<101>-Footnote-2995906608 +Ref: Library<101>-Footnote-3005906675 +Ref: Library<101>-Footnote-3015906742 +Ref: Library<101>-Footnote-3025906809 +Ref: Library<101>-Footnote-3035906876 +Ref: Library<101>-Footnote-3045906943 +Ref: Library<101>-Footnote-3055907010 +Ref: Library<101>-Footnote-3065907077 +Ref: Library<101>-Footnote-3075907144 +Ref: Library<101>-Footnote-3085907211 +Ref: Library<101>-Footnote-3095907278 +Ref: Library<101>-Footnote-3105907345 +Ref: Library<101>-Footnote-3115907412 +Ref: Library<101>-Footnote-3125907479 +Ref: Library<101>-Footnote-3135907546 +Ref: Library<101>-Footnote-3145907613 +Ref: Library<101>-Footnote-3155907680 +Ref: Library<101>-Footnote-3165907746 +Ref: Library<101>-Footnote-3175907813 +Ref: Library<101>-Footnote-3185907880 +Ref: Library<101>-Footnote-3195907947 +Ref: Library<101>-Footnote-3205908014 +Ref: Library<101>-Footnote-3215908081 +Ref: Library<101>-Footnote-3225908148 +Ref: Library<101>-Footnote-3235908215 +Ref: Library<101>-Footnote-3245908282 +Ref: Library<101>-Footnote-3255908349 +Ref: Library<101>-Footnote-3265908416 +Ref: Library<101>-Footnote-3275908483 +Ref: Library<101>-Footnote-3285908550 +Ref: Library<101>-Footnote-3295908617 +Ref: Library<101>-Footnote-3305908684 +Ref: Library<101>-Footnote-3315908751 +Ref: Library<101>-Footnote-3325908818 +Ref: Library<101>-Footnote-3335908885 +Ref: Library<101>-Footnote-3345908952 +Ref: Library<101>-Footnote-3355909019 +Ref: Library<101>-Footnote-3365909085 +Ref: Library<101>-Footnote-3375909152 +Ref: Library<101>-Footnote-3385909219 +Ref: Library<101>-Footnote-3395909276 +Ref: Library<101>-Footnote-3405909343 +Ref: Library<101>-Footnote-3415909410 +Ref: Library<101>-Footnote-3425909477 +Ref: Library<101>-Footnote-3435909544 +Ref: Library<101>-Footnote-3445909611 +Ref: Library<101>-Footnote-3455909678 +Ref: Library<101>-Footnote-3465909745 +Ref: Library<101>-Footnote-3475909812 +Ref: Library<101>-Footnote-3485909879 +Ref: Library<101>-Footnote-3495909946 +Ref: Library<101>-Footnote-3505910013 +Ref: Library<101>-Footnote-3515910080 +Ref: Library<101>-Footnote-3525910147 +Ref: Library<101>-Footnote-3535910214 +Ref: Library<101>-Footnote-3545910281 +Ref: Library<101>-Footnote-3555910348 +Ref: Library<101>-Footnote-3565910415 +Ref: Library<101>-Footnote-3575910482 +Ref: Library<101>-Footnote-3585910549 +Ref: Library<101>-Footnote-3595910616 +Ref: Library<101>-Footnote-3605910683 +Ref: Library<101>-Footnote-3615910750 +Ref: Library<101>-Footnote-3625910817 +Ref: Library<101>-Footnote-3635910884 +Ref: Library<101>-Footnote-3645910951 +Ref: Library<101>-Footnote-3655911018 +Ref: Library<101>-Footnote-3665911085 +Ref: Library<101>-Footnote-3675911152 +Ref: Library<101>-Footnote-3685911219 +Ref: Library<101>-Footnote-3695911286 +Ref: Library<101>-Footnote-3705911353 +Ref: Library<101>-Footnote-3715911420 +Ref: Library<101>-Footnote-3725911487 +Ref: Library<101>-Footnote-3735911553 +Ref: Library<101>-Footnote-3745911620 +Ref: Library<101>-Footnote-3755911687 +Ref: Library<101>-Footnote-3765911754 +Ref: Library<101>-Footnote-3775911821 +Ref: Library<101>-Footnote-3785911888 +Ref: Library<101>-Footnote-3795911955 +Ref: Library<101>-Footnote-3805912022 +Ref: Library<101>-Footnote-3815912089 +Ref: Library<101>-Footnote-3825912156 +Ref: Library<101>-Footnote-3835912223 +Ref: Library<101>-Footnote-3845912290 +Ref: Library<101>-Footnote-3855912357 +Ref: Library<101>-Footnote-3865912423 +Ref: Library<101>-Footnote-3875912490 +Ref: Library<101>-Footnote-3885912557 +Ref: Library<101>-Footnote-3895912624 +Ref: Library<101>-Footnote-3905912691 +Ref: Library<101>-Footnote-3915912756 +Ref: Library<101>-Footnote-3925912823 +Ref: Library<101>-Footnote-3935912890 +Ref: Library<101>-Footnote-3945912957 +Ref: Library<101>-Footnote-3955913024 +Ref: Library<101>-Footnote-3965913091 +Ref: Library<101>-Footnote-3975913158 +Ref: Library<101>-Footnote-3985913225 +Node: IDLE<65>5913292 +Ref: whatsnew/changelog id8145913396 +Ref: 1bd05913396 +Ref: IDLE<65>-Footnote-15916894 +Ref: IDLE<65>-Footnote-25916959 +Ref: IDLE<65>-Footnote-35917024 +Ref: IDLE<65>-Footnote-45917088 +Ref: IDLE<65>-Footnote-55917153 +Ref: IDLE<65>-Footnote-65917217 +Ref: IDLE<65>-Footnote-75917282 +Ref: IDLE<65>-Footnote-85917347 +Ref: IDLE<65>-Footnote-95917412 +Ref: IDLE<65>-Footnote-105917477 +Ref: IDLE<65>-Footnote-115917543 +Ref: IDLE<65>-Footnote-125917609 +Ref: IDLE<65>-Footnote-135917675 +Ref: IDLE<65>-Footnote-145917741 +Ref: IDLE<65>-Footnote-155917807 +Ref: IDLE<65>-Footnote-165917873 +Ref: IDLE<65>-Footnote-175917939 +Ref: IDLE<65>-Footnote-185918005 +Ref: IDLE<65>-Footnote-195918071 +Ref: IDLE<65>-Footnote-205918137 +Ref: IDLE<65>-Footnote-215918203 +Ref: IDLE<65>-Footnote-225918269 +Ref: IDLE<65>-Footnote-235918335 +Ref: IDLE<65>-Footnote-245918378 +Ref: IDLE<65>-Footnote-255918444 +Ref: IDLE<65>-Footnote-265918510 +Node: Build<92>5918576 +Ref: whatsnew/changelog id8155918677 +Ref: 1bd15918677 +Ref: Build<92>-Footnote-15922111 +Ref: Build<92>-Footnote-25922176 +Ref: Build<92>-Footnote-35922241 +Ref: Build<92>-Footnote-45922306 +Ref: Build<92>-Footnote-55922371 +Ref: Build<92>-Footnote-65922436 +Ref: Build<92>-Footnote-75922501 +Ref: Build<92>-Footnote-85922566 +Ref: Build<92>-Footnote-95922631 +Ref: Build<92>-Footnote-105922696 +Ref: Build<92>-Footnote-115922762 +Ref: Build<92>-Footnote-125922828 +Ref: Build<92>-Footnote-135922894 +Ref: Build<92>-Footnote-145922960 +Ref: Build<92>-Footnote-155923026 +Ref: Build<92>-Footnote-165923092 +Ref: Build<92>-Footnote-175923158 +Ref: Build<92>-Footnote-185923224 +Ref: Build<92>-Footnote-195923290 +Ref: Build<92>-Footnote-205923356 +Ref: Build<92>-Footnote-215923422 +Ref: Build<92>-Footnote-225923488 +Ref: Build<92>-Footnote-235923554 +Ref: Build<92>-Footnote-245923620 +Ref: Build<92>-Footnote-255923686 +Ref: Build<92>-Footnote-265923752 +Node: C API<75>5923818 +Ref: whatsnew/changelog id8165923928 +Ref: 1bd25923928 +Ref: C API<75>-Footnote-15925295 +Ref: C API<75>-Footnote-25925360 +Ref: C API<75>-Footnote-35925425 +Ref: C API<75>-Footnote-45925490 +Ref: C API<75>-Footnote-55925555 +Ref: C API<75>-Footnote-65925620 +Ref: C API<75>-Footnote-75925685 +Node: Documentation<80>5925750 +Ref: whatsnew/changelog id8175925860 +Ref: 1bd35925860 +Ref: Documentation<80>-Footnote-15927669 +Ref: Documentation<80>-Footnote-25927734 +Ref: Documentation<80>-Footnote-35927799 +Ref: Documentation<80>-Footnote-45927864 +Ref: Documentation<80>-Footnote-55927929 +Ref: Documentation<80>-Footnote-65927993 +Ref: Documentation<80>-Footnote-75928058 +Ref: Documentation<80>-Footnote-85928123 +Ref: Documentation<80>-Footnote-95928188 +Ref: Documentation<80>-Footnote-105928253 +Ref: Documentation<80>-Footnote-115928319 +Node: Tests<86>5928385 +Ref: whatsnew/changelog id8185928501 +Ref: 1bd45928501 +Ref: Tests<86>-Footnote-15932694 +Ref: Tests<86>-Footnote-25932759 +Ref: Tests<86>-Footnote-35932824 +Ref: Tests<86>-Footnote-45932889 +Ref: Tests<86>-Footnote-55932954 +Ref: Tests<86>-Footnote-65933019 +Ref: Tests<86>-Footnote-75933084 +Ref: Tests<86>-Footnote-85933149 +Ref: Tests<86>-Footnote-95933214 +Ref: Tests<86>-Footnote-105933279 +Ref: Tests<86>-Footnote-115933345 +Ref: Tests<86>-Footnote-125933411 +Ref: Tests<86>-Footnote-135933477 +Ref: Tests<86>-Footnote-145933543 +Ref: Tests<86>-Footnote-155933608 +Ref: Tests<86>-Footnote-165933674 +Ref: Tests<86>-Footnote-175933740 +Ref: Tests<86>-Footnote-185933806 +Ref: Tests<86>-Footnote-195933872 +Ref: Tests<86>-Footnote-205933938 +Ref: Tests<86>-Footnote-215934004 +Ref: Tests<86>-Footnote-225934070 +Ref: Tests<86>-Footnote-235934136 +Ref: Tests<86>-Footnote-245934202 +Ref: Tests<86>-Footnote-255934268 +Ref: Tests<86>-Footnote-265934334 +Ref: Tests<86>-Footnote-275934400 +Ref: Tests<86>-Footnote-285934466 +Ref: Tests<86>-Footnote-295934532 +Ref: Tests<86>-Footnote-305934598 +Ref: Tests<86>-Footnote-315934664 +Ref: Tests<86>-Footnote-325934730 +Ref: Tests<86>-Footnote-335934796 +Ref: Tests<86>-Footnote-345934862 +Ref: Tests<86>-Footnote-355934928 +Ref: Tests<86>-Footnote-365934994 +Ref: Tests<86>-Footnote-375935060 +Node: Tools/Demos<51>5935126 +Ref: whatsnew/changelog id8195935236 +Ref: 1bd55935236 +Ref: Tools/Demos<51>-Footnote-15936910 +Ref: Tools/Demos<51>-Footnote-25936975 +Ref: Tools/Demos<51>-Footnote-35937040 +Ref: Tools/Demos<51>-Footnote-45937105 +Ref: Tools/Demos<51>-Footnote-55937170 +Ref: Tools/Demos<51>-Footnote-65937235 +Ref: Tools/Demos<51>-Footnote-75937300 +Ref: Tools/Demos<51>-Footnote-85937365 +Ref: Tools/Demos<51>-Footnote-95937430 +Ref: Tools/Demos<51>-Footnote-105937495 +Ref: Tools/Demos<51>-Footnote-115937538 +Ref: Tools/Demos<51>-Footnote-125937604 +Ref: Tools/Demos<51>-Footnote-135937670 +Node: Windows<78>5937736 +Ref: whatsnew/changelog id8205937828 +Ref: 1bd65937828 +Ref: Windows<78>-Footnote-15939041 +Ref: Windows<78>-Footnote-25939106 +Ref: Windows<78>-Footnote-35939171 +Ref: Windows<78>-Footnote-45939236 +Ref: Windows<78>-Footnote-55939301 +Ref: Windows<78>-Footnote-65939366 +Ref: Windows<78>-Footnote-75939431 +Node: The Python Tutorial5939496 +Ref: tutorial/index doc5939617 +Ref: 1bd75939617 +Ref: tutorial/index the-python-tutorial5939617 +Ref: 1bd85939617 +Ref: tutorial/index tutorial-index5939617 +Ref: 1bd95939617 +Node: Whetting Your Appetite5942582 +Ref: tutorial/appetite doc5942697 +Ref: 1bdd5942697 +Ref: tutorial/appetite tut-intro5942697 +Ref: 1bde5942697 +Ref: tutorial/appetite whetting-your-appetite5942697 +Ref: 1bdf5942697 +Node: Using the Python Interpreter5947212 +Ref: tutorial/interpreter doc5947370 +Ref: 1be05947370 +Ref: tutorial/interpreter tut-using5947370 +Ref: 1be15947370 +Ref: tutorial/interpreter using-the-python-interpreter5947370 +Ref: 1be25947370 +Node: Invoking the Interpreter5947516 +Ref: tutorial/interpreter invoking-the-interpreter5947649 +Ref: 1be35947649 +Ref: tutorial/interpreter tut-invoking5947649 +Ref: 1be45947649 +Ref: Invoking the Interpreter-Footnote-15950661 +Ref: Invoking the Interpreter-Footnote-25950857 +Node: Argument Passing5950918 +Ref: tutorial/interpreter argument-passing5951020 +Ref: 1be85951020 +Ref: tutorial/interpreter tut-argpassing5951020 +Ref: 1be95951020 +Node: Interactive Mode5951928 +Ref: tutorial/interpreter interactive-mode5952030 +Ref: 1bea5952030 +Ref: tutorial/interpreter tut-interactive5952030 +Ref: fc15952030 +Node: The Interpreter and Its Environment5953048 +Ref: tutorial/interpreter the-interpreter-and-its-environment5953181 +Ref: 1beb5953181 +Ref: tutorial/interpreter tut-interp5953181 +Ref: 1bec5953181 +Node: Source Code Encoding5953301 +Ref: tutorial/interpreter source-code-encoding5953393 +Ref: 1bed5953393 +Ref: tutorial/interpreter tut-source-encoding5953393 +Ref: 1bee5953393 +Node: An Informal Introduction to Python5954629 +Ref: tutorial/introduction doc5954788 +Ref: 1bf05954788 +Ref: tutorial/introduction an-informal-introduction-to-python5954788 +Ref: 1bf15954788 +Ref: tutorial/introduction tut-informal5954788 +Ref: 1bf25954788 +Node: Using Python as a Calculator5956091 +Ref: tutorial/introduction tut-calculator5956230 +Ref: 1bf35956230 +Ref: tutorial/introduction using-python-as-a-calculator5956230 +Ref: 1bf45956230 +Node: Numbers5956480 +Ref: tutorial/introduction numbers5956565 +Ref: 1bf55956565 +Ref: tutorial/introduction tut-numbers5956565 +Ref: 1bf65956565 +Ref: Numbers-Footnote-15959517 +Node: Text5959713 +Ref: tutorial/introduction text5959812 +Ref: 1bf85959812 +Ref: tutorial/introduction tut-strings5959812 +Ref: 1bf95959812 +Ref: Text-Footnote-15968007 +Node: Lists5968311 +Ref: tutorial/introduction lists5968394 +Ref: 1bfe5968394 +Ref: tutorial/introduction tut-lists5968394 +Ref: 1bff5968394 +Node: First Steps Towards Programming5971597 +Ref: tutorial/introduction first-steps-towards-programming5971736 +Ref: 1c025971736 +Ref: tutorial/introduction tut-firststeps5971736 +Ref: 1c035971736 +Ref: First Steps Towards Programming-Footnote-15974834 +Node: More Control Flow Tools5974891 +Ref: tutorial/controlflow doc5975037 +Ref: 1c055975037 +Ref: tutorial/controlflow more-control-flow-tools5975037 +Ref: 1c065975037 +Ref: tutorial/controlflow tut-morecontrol5975037 +Ref: 1c075975037 +Node: if Statements5975518 +Ref: tutorial/controlflow if-statements5975614 +Ref: 1c085975614 +Ref: tutorial/controlflow tut-if5975614 +Ref: 1c095975614 +Node: for Statements5976640 +Ref: tutorial/controlflow for-statements5976763 +Ref: 1c0c5976763 +Ref: tutorial/controlflow tut-for5976763 +Ref: 1c0d5976763 +Node: The range Function5978128 +Ref: tutorial/controlflow the-range-function5978267 +Ref: 1c0e5978267 +Ref: tutorial/controlflow tut-range5978267 +Ref: 1c0f5978267 +Node: break and continue Statements5980410 +Ref: tutorial/controlflow break-and-continue-statements5980556 +Ref: 1c125980556 +Ref: tutorial/controlflow tut-break5980556 +Ref: 1c135980556 +Ref: tutorial/controlflow tut-for-else5981536 +Ref: 1c145981536 +Node: else Clauses on Loops5981537 +Ref: tutorial/controlflow break-and-continue-statements-and-else-clauses-on-loops5981680 +Ref: 1c155981680 +Ref: tutorial/controlflow else-clauses-on-loops5981680 +Ref: 1c165981680 +Node: pass Statements5983930 +Ref: tutorial/controlflow pass-statements5984060 +Ref: 1c185984060 +Ref: tutorial/controlflow tut-pass5984060 +Ref: 1c195984060 +Node: match Statements5984789 +Ref: tutorial/controlflow match-statements5984916 +Ref: 1c1b5984916 +Ref: tutorial/controlflow tut-match5984916 +Ref: 1c0b5984916 +Ref: match Statements-Footnote-15991589 +Node: Defining Functions5991631 +Ref: tutorial/controlflow defining-functions5991769 +Ref: 1c1c5991769 +Ref: tutorial/controlflow tut-functions5991769 +Ref: 1c1d5991769 +Ref: Defining Functions-Footnote-15996787 +Node: More on Defining Functions5996985 +Ref: tutorial/controlflow more-on-defining-functions5997130 +Ref: 1c205997130 +Ref: tutorial/controlflow tut-defining5997130 +Ref: 1c215997130 +Node: Default Argument Values5997537 +Ref: tutorial/controlflow default-argument-values5997649 +Ref: 1c225997649 +Ref: tutorial/controlflow tut-defaultargs5997649 +Ref: 1c235997649 +Node: Keyword Arguments5999669 +Ref: tutorial/controlflow keyword-arguments5999808 +Ref: 1c245999808 +Ref: tutorial/controlflow tut-keywordargs5999808 +Ref: 1c255999808 +Node: Special parameters6003547 +Ref: tutorial/controlflow special-parameters6003687 +Ref: 1c276003687 +Node: Positional-or-Keyword Arguments6004824 +Ref: tutorial/controlflow positional-or-keyword-arguments6004945 +Ref: 1c286004945 +Node: Positional-Only Parameters6005159 +Ref: tutorial/controlflow positional-only-parameters6005311 +Ref: 1c296005311 +Node: Keyword-Only Arguments6005945 +Ref: tutorial/controlflow keyword-only-arguments6006083 +Ref: 1c2a6006083 +Node: Function Examples6006334 +Ref: tutorial/controlflow function-examples6006451 +Ref: 1c2b6006451 +Node: Recap6009521 +Ref: tutorial/controlflow recap6009607 +Ref: 1c2c6009607 +Node: Arbitrary Argument Lists6010468 +Ref: tutorial/controlflow arbitrary-argument-lists6010615 +Ref: 1c2d6010615 +Ref: tutorial/controlflow tut-arbitraryargs6010615 +Ref: 1c2e6010615 +Node: Unpacking Argument Lists6011651 +Ref: tutorial/controlflow tut-unpacking-arguments6011798 +Ref: 1c2f6011798 +Ref: tutorial/controlflow unpacking-argument-lists6011798 +Ref: 1c306011798 +Node: Lambda Expressions6013031 +Ref: tutorial/controlflow lambda-expressions6013175 +Ref: 1c316013175 +Ref: tutorial/controlflow tut-lambda6013175 +Ref: 1c326013175 +Node: Documentation Strings6014273 +Ref: tutorial/controlflow documentation-strings6014413 +Ref: 1c336014413 +Ref: tutorial/controlflow tut-docstrings6014413 +Ref: 1c1e6014413 +Node: Function Annotations6016339 +Ref: tutorial/controlflow function-annotations6016452 +Ref: 1c346016452 +Ref: tutorial/controlflow tut-annotations6016452 +Ref: 1c356016452 +Ref: Function Annotations-Footnote-16017668 +Ref: Function Annotations-Footnote-26017710 +Node: Intermezzo Coding Style6017752 +Ref: tutorial/controlflow intermezzo-coding-style6017870 +Ref: 1c386017870 +Ref: tutorial/controlflow tut-codingstyle6017870 +Ref: 1c396017870 +Ref: Intermezzo Coding Style-Footnote-16020030 +Node: Data Structures6020072 +Ref: tutorial/datastructures doc6020194 +Ref: 1c3b6020194 +Ref: tutorial/datastructures data-structures6020194 +Ref: 1c3c6020194 +Ref: tutorial/datastructures tut-structures6020194 +Ref: 1c116020194 +Node: More on Lists6020539 +Ref: tutorial/datastructures more-on-lists6020630 +Ref: 1c3d6020630 +Ref: tutorial/datastructures tut-morelists6020630 +Ref: 1c3e6020630 +Ref: More on Lists-Footnote-16024344 +Node: Using Lists as Stacks6024481 +Ref: tutorial/datastructures tut-lists-as-stacks6024582 +Ref: 1c3f6024582 +Ref: tutorial/datastructures using-lists-as-stacks6024582 +Ref: 1c406024582 +Node: Using Lists as Queues6025216 +Ref: tutorial/datastructures tut-lists-as-queues6025348 +Ref: 1c416025348 +Ref: tutorial/datastructures using-lists-as-queues6025348 +Ref: 1c426025348 +Node: List Comprehensions<2>6026412 +Ref: tutorial/datastructures list-comprehensions6026549 +Ref: 1c436026549 +Ref: tutorial/datastructures tut-listcomps6026549 +Ref: 1c446026549 +Node: Nested List Comprehensions6029790 +Ref: tutorial/datastructures nested-list-comprehensions6029897 +Ref: 1c456029897 +Node: The del statement6031555 +Ref: tutorial/datastructures the-del-statement6031675 +Ref: 1c466031675 +Ref: tutorial/datastructures tut-del6031675 +Ref: 1c476031675 +Node: Tuples and Sequences6032527 +Ref: tutorial/datastructures tuples-and-sequences6032638 +Ref: 1c486032638 +Ref: tutorial/datastructures tut-tuples6032638 +Ref: 1c266032638 +Node: Sets6035671 +Ref: tutorial/datastructures sets6035777 +Ref: 1c4a6035777 +Ref: tutorial/datastructures tut-sets6035777 +Ref: 1c4b6035777 +Node: Dictionaries6037518 +Ref: tutorial/datastructures dictionaries6037622 +Ref: 1c4c6037622 +Ref: tutorial/datastructures tut-dictionaries6037622 +Ref: 1c4d6037622 +Node: Looping Techniques6040443 +Ref: tutorial/datastructures looping-techniques6040561 +Ref: 1c4e6040561 +Ref: tutorial/datastructures tut-loopidioms6040561 +Ref: 1c106040561 +Node: More on Conditions6043195 +Ref: tutorial/datastructures more-on-conditions6043336 +Ref: 1c4f6043336 +Ref: tutorial/datastructures tut-conditions6043336 +Ref: 1c506043336 +Node: Comparing Sequences and Other Types6045411 +Ref: tutorial/datastructures comparing-sequences-and-other-types6045525 +Ref: 1c526045525 +Ref: tutorial/datastructures tut-comparing6045525 +Ref: 1c536045525 +Node: Modules<2>6047112 +Ref: tutorial/modules doc6047227 +Ref: 1c546047227 +Ref: tutorial/modules modules6047227 +Ref: 1c556047227 +Ref: tutorial/modules tut-modules6047227 +Ref: 1c566047227 +Node: More on Modules6049874 +Ref: tutorial/modules more-on-modules6049961 +Ref: 1c596049961 +Ref: tutorial/modules tut-moremodules6049961 +Ref: 1c5a6049961 +Ref: More on Modules-Footnote-16053130 +Node: Executing modules as scripts6053329 +Ref: tutorial/modules executing-modules-as-scripts6053440 +Ref: 1c5b6053440 +Ref: tutorial/modules tut-modulesasscripts6053440 +Ref: 1c5c6053440 +Node: The Module Search Path6054328 +Ref: tutorial/modules the-module-search-path6054475 +Ref: 1c5d6054475 +Ref: tutorial/modules tut-searchpath6054475 +Ref: 1c5e6054475 +Node: “Compiled” Python files6056060 +Ref: tutorial/modules compiled-python-files6056170 +Ref: 1c626056170 +Ref: tutorial/modules tut-pycache6056170 +Ref: 6d76056170 +Ref: “Compiled” Python files-Footnote-16058479 +Node: Standard Modules6058521 +Ref: tutorial/modules standard-modules6058633 +Ref: 1c636058633 +Ref: tutorial/modules tut-standardmodules6058633 +Ref: 1c616058633 +Node: The dir Function6060099 +Ref: tutorial/modules the-dir-function6060204 +Ref: 1c646060204 +Ref: tutorial/modules tut-dir6060204 +Ref: 1c656060204 +Node: Packages6064727 +Ref: tutorial/modules packages6064807 +Ref: 1c666064807 +Ref: tutorial/modules tut-packages6064807 +Ref: 1c676064807 +Node: Importing * From a Package6069193 +Ref: tutorial/modules importing-from-a-package6069297 +Ref: 1c696069297 +Ref: tutorial/modules tut-pkg-import-star6069297 +Ref: 1c6a6069297 +Node: Intra-package References6072699 +Ref: tutorial/modules id26072844 +Ref: 1c6b6072844 +Ref: tutorial/modules intra-package-references6072844 +Ref: 1c6c6072844 +Node: Packages in Multiple Directories6073855 +Ref: tutorial/modules packages-in-multiple-directories6073965 +Ref: 1c6d6073965 +Node: Input and Output6074522 +Ref: tutorial/inputoutput doc6074643 +Ref: 1c6f6074643 +Ref: tutorial/inputoutput input-and-output6074643 +Ref: 1c706074643 +Ref: tutorial/inputoutput tut-io6074643 +Ref: 1c716074643 +Node: Fancier Output Formatting6074952 +Ref: tutorial/inputoutput fancier-output-formatting6075064 +Ref: 1c726075064 +Ref: tutorial/inputoutput tut-formatting6075064 +Ref: 1c736075064 +Node: Formatted String Literals6079182 +Ref: tutorial/inputoutput formatted-string-literals6079302 +Ref: 1c766079302 +Ref: tutorial/inputoutput tut-f-strings6079302 +Ref: 1c756079302 +Node: The String format Method6081305 +Ref: tutorial/inputoutput the-string-format-method6081458 +Ref: 1c776081458 +Ref: tutorial/inputoutput tut-string-format6081458 +Ref: 1c786081458 +Node: Manual String Formatting6084395 +Ref: tutorial/inputoutput manual-string-formatting6084544 +Ref: 1c796084544 +Node: Old string formatting6086073 +Ref: tutorial/inputoutput old-string-formatting6086189 +Ref: 1c7d6086189 +Node: Reading and Writing Files6086770 +Ref: tutorial/inputoutput reading-and-writing-files6086882 +Ref: 1c7e6086882 +Ref: tutorial/inputoutput tut-files6086882 +Ref: 1c7f6086882 +Node: Methods of File Objects6090134 +Ref: tutorial/inputoutput methods-of-file-objects6090260 +Ref: 1c806090260 +Ref: tutorial/inputoutput tut-filemethods6090260 +Ref: 1c816090260 +Node: Saving structured data with json6093968 +Ref: tutorial/inputoutput saving-structured-data-with-json6094094 +Ref: 1c836094094 +Ref: tutorial/inputoutput tut-json6094094 +Ref: 1c846094094 +Ref: Saving structured data with json-Footnote-16096961 +Node: Errors and Exceptions6096986 +Ref: tutorial/errors doc6097104 +Ref: 1c886097104 +Ref: tutorial/errors errors-and-exceptions6097104 +Ref: 1c896097104 +Ref: tutorial/errors tut-errors6097104 +Ref: 1c8a6097104 +Node: Syntax Errors6097674 +Ref: tutorial/errors syntax-errors6097764 +Ref: 1c8b6097764 +Ref: tutorial/errors tut-syntaxerrors6097764 +Ref: 1c8c6097764 +Node: Exceptions6098560 +Ref: tutorial/errors exceptions6098678 +Ref: 1c8d6098678 +Ref: tutorial/errors tut-exceptions6098678 +Ref: 1c8e6098678 +Node: Handling Exceptions6100622 +Ref: tutorial/errors handling-exceptions6100745 +Ref: 1c8f6100745 +Ref: tutorial/errors tut-handling6100745 +Ref: 1c176100745 +Node: Raising Exceptions6107213 +Ref: tutorial/errors raising-exceptions6107344 +Ref: 1c906107344 +Ref: tutorial/errors tut-raising6107344 +Ref: 1c916107344 +Node: Exception Chaining6108617 +Ref: tutorial/errors exception-chaining6108752 +Ref: 1c926108752 +Ref: tutorial/errors tut-exception-chaining6108752 +Ref: 1c936108752 +Node: User-defined Exceptions6110986 +Ref: tutorial/errors tut-userexceptions6111128 +Ref: 1c946111128 +Ref: tutorial/errors user-defined-exceptions6111128 +Ref: 1c956111128 +Node: Defining Clean-up Actions6111888 +Ref: tutorial/errors defining-clean-up-actions6112039 +Ref: 1c966112039 +Ref: tutorial/errors tut-cleanup6112039 +Ref: 1c976112039 +Node: Predefined Clean-up Actions6115456 +Ref: tutorial/errors predefined-clean-up-actions6115634 +Ref: 1c986115634 +Ref: tutorial/errors tut-cleanup-with6115634 +Ref: 1c996115634 +Node: Raising and Handling Multiple Unrelated Exceptions6116753 +Ref: tutorial/errors raising-and-handling-multiple-unrelated-exceptions6116937 +Ref: 1c9a6116937 +Ref: tutorial/errors tut-exception-groups6116937 +Ref: 1c9b6116937 +Node: Enriching Exceptions with Notes6120526 +Ref: tutorial/errors enriching-exceptions-with-notes6120674 +Ref: 1c9c6120674 +Ref: tutorial/errors tut-exception-notes6120674 +Ref: 1c9d6120674 +Node: Classes6123553 +Ref: tutorial/classes doc6123689 +Ref: 1c9e6123689 +Ref: tutorial/classes classes6123689 +Ref: 1c9f6123689 +Ref: tutorial/classes tut-classes6123689 +Ref: 1c1f6123689 +Node: A Word About Names and Objects6126003 +Ref: tutorial/classes a-word-about-names-and-objects6126114 +Ref: 1ca16126114 +Ref: tutorial/classes tut-object6126114 +Ref: 1ca26126114 +Node: Python Scopes and Namespaces6127036 +Ref: tutorial/classes python-scopes-and-namespaces6127179 +Ref: 1ca36127179 +Ref: tutorial/classes tut-scopes6127179 +Ref: 1c586127179 +Ref: Python Scopes and Namespaces-Footnote-16133271 +Node: Scopes and Namespaces Example6133655 +Ref: tutorial/classes scopes-and-namespaces-example6133749 +Ref: 1ca56133749 +Ref: tutorial/classes tut-scopeexample6133749 +Ref: 1ca66133749 +Node: A First Look at Classes6135107 +Ref: tutorial/classes a-first-look-at-classes6135234 +Ref: 1ca76135234 +Ref: tutorial/classes tut-firstclasses6135234 +Ref: 1c3a6135234 +Node: Class Definition Syntax6135519 +Ref: tutorial/classes class-definition-syntax6135624 +Ref: 1ca86135624 +Ref: tutorial/classes tut-classdefinition6135624 +Ref: 1ca96135624 +Node: Class Objects6137161 +Ref: tutorial/classes class-objects6137291 +Ref: 1caa6137291 +Ref: tutorial/classes tut-classobjects6137291 +Ref: 1cab6137291 +Node: Instance Objects6139488 +Ref: tutorial/classes instance-objects6139609 +Ref: 1cad6139609 +Ref: tutorial/classes tut-instanceobjects6139609 +Ref: 1cae6139609 +Node: Method Objects6140918 +Ref: tutorial/classes method-objects6141054 +Ref: 1caf6141054 +Ref: tutorial/classes tut-methodobjects6141054 +Ref: 1cb06141054 +Node: Class and Instance Variables6142854 +Ref: tutorial/classes class-and-instance-variables6142965 +Ref: 1cb16142965 +Ref: tutorial/classes tut-class-and-instance-variables6142965 +Ref: 1cb26142965 +Node: Random Remarks6145009 +Ref: tutorial/classes random-remarks6145119 +Ref: 1cb36145119 +Ref: tutorial/classes tut-remarks6145119 +Ref: 1cb46145119 +Node: Inheritance6148952 +Ref: tutorial/classes inheritance6149056 +Ref: 1cb56149056 +Ref: tutorial/classes tut-inheritance6149056 +Ref: 1cb66149056 +Node: Multiple Inheritance6151855 +Ref: tutorial/classes multiple-inheritance6151923 +Ref: 1cb76151923 +Ref: tutorial/classes tut-multiple6151923 +Ref: 1cb86151923 +Node: Private Variables6153919 +Ref: tutorial/classes private-variables6154022 +Ref: 1cb96154022 +Ref: tutorial/classes tut-private6154022 +Ref: 1ca06154022 +Node: Odds and Ends6156815 +Ref: tutorial/classes odds-and-ends6156916 +Ref: 1cbb6156916 +Ref: tutorial/classes tut-odds6156916 +Ref: 1cbc6156916 +Node: Iterators6158052 +Ref: tutorial/classes iterators6158146 +Ref: 1cbf6158146 +Ref: tutorial/classes tut-iterators6158146 +Ref: 1cc06158146 +Node: Generators6160434 +Ref: tutorial/classes generators6160536 +Ref: 1cc26160536 +Ref: tutorial/classes tut-generators6160536 +Ref: 1cc36160536 +Node: Generator Expressions6161976 +Ref: tutorial/classes generator-expressions6162060 +Ref: 1cc66162060 +Ref: tutorial/classes tut-genexps6162060 +Ref: 1cc76162060 +Node: Brief Tour of the Standard Library6163047 +Ref: tutorial/stdlib doc6163208 +Ref: 1cc86163208 +Ref: tutorial/stdlib brief-tour-of-the-standard-library6163208 +Ref: 1cc96163208 +Ref: tutorial/stdlib tut-brieftour6163208 +Ref: 1cca6163208 +Node: Operating System Interface6163605 +Ref: tutorial/stdlib operating-system-interface6163725 +Ref: 1ccb6163725 +Ref: tutorial/stdlib tut-os-interface6163725 +Ref: 1ccc6163725 +Node: File Wildcards6164991 +Ref: tutorial/stdlib file-wildcards6165142 +Ref: 1ccd6165142 +Ref: tutorial/stdlib tut-file-wildcards6165142 +Ref: 1cce6165142 +Node: Command Line Arguments6165384 +Ref: tutorial/stdlib command-line-arguments6165557 +Ref: 1ccf6165557 +Ref: tutorial/stdlib tut-command-line-arguments6165557 +Ref: 1cd06165557 +Node: Error Output Redirection and Program Termination6166723 +Ref: tutorial/stdlib error-output-redirection-and-program-termination6166905 +Ref: 1cd16166905 +Ref: tutorial/stdlib tut-stderr6166905 +Ref: 1cd26166905 +Node: String Pattern Matching6167428 +Ref: tutorial/stdlib string-pattern-matching6167599 +Ref: 1cd36167599 +Ref: tutorial/stdlib tut-string-pattern-matching6167599 +Ref: 1cd46167599 +Node: Mathematics6168238 +Ref: tutorial/stdlib mathematics6168376 +Ref: 1cd56168376 +Ref: tutorial/stdlib tut-mathematics6168376 +Ref: 1cd66168376 +Node: Internet Access6169553 +Ref: tutorial/stdlib internet-access6169683 +Ref: 1cd76169683 +Ref: tutorial/stdlib tut-internet-access6169683 +Ref: 1cd86169683 +Node: Dates and Times6170741 +Ref: tutorial/stdlib dates-and-times6170876 +Ref: 1cd96170876 +Ref: tutorial/stdlib tut-dates-and-times6170876 +Ref: 1cda6170876 +Node: Data Compression6171697 +Ref: tutorial/stdlib data-compression6171840 +Ref: 1cdb6171840 +Ref: tutorial/stdlib tut-data-compression6171840 +Ref: 1cdc6171840 +Node: Performance Measurement6172362 +Ref: tutorial/stdlib performance-measurement6172505 +Ref: 1cdd6172505 +Ref: tutorial/stdlib tut-performance-measurement6172505 +Ref: 1cde6172505 +Node: Quality Control6173378 +Ref: tutorial/stdlib quality-control6173523 +Ref: 1cdf6173523 +Ref: tutorial/stdlib tut-quality-control6173523 +Ref: 1ce06173523 +Node: Batteries Included6175091 +Ref: tutorial/stdlib batteries-included6175204 +Ref: 1ce16175204 +Ref: tutorial/stdlib tut-batteries-included6175204 +Ref: 1ce26175204 +Ref: Batteries Included-Footnote-16177019 +Node: Brief Tour of the Standard Library — Part II6177078 +Ref: tutorial/stdlib2 doc6177265 +Ref: 1ce36177265 +Ref: tutorial/stdlib2 brief-tour-of-the-standard-library-part-ii6177265 +Ref: 1ce46177265 +Ref: tutorial/stdlib2 tut-brieftourtwo6177265 +Ref: 1ce56177265 +Node: Output Formatting6177739 +Ref: tutorial/stdlib2 output-formatting6177858 +Ref: 1ce66177858 +Ref: tutorial/stdlib2 tut-output-formatting6177858 +Ref: 1ce76177858 +Node: Templating6179977 +Ref: tutorial/stdlib2 templating6180144 +Ref: 1ce86180144 +Ref: tutorial/stdlib2 tut-templating6180144 +Ref: 1ce96180144 +Node: Working with Binary Data Record Layouts6182708 +Ref: tutorial/stdlib2 tut-binary-formats6182876 +Ref: 1cec6182876 +Ref: tutorial/stdlib2 working-with-binary-data-record-layouts6182876 +Ref: 1ced6182876 +Node: Multi-threading<2>6184052 +Ref: tutorial/stdlib2 multi-threading6184217 +Ref: 1cee6184217 +Ref: tutorial/stdlib2 tut-multi-threading6184217 +Ref: 1cef6184217 +Node: Logging6186160 +Ref: tutorial/stdlib2 logging6186301 +Ref: 1cf06186301 +Ref: tutorial/stdlib2 tut-logging6186301 +Ref: 1cf16186301 +Node: Weak References6187499 +Ref: tutorial/stdlib2 tut-weak-references6187650 +Ref: 1cf76187650 +Ref: tutorial/stdlib2 weak-references6187650 +Ref: 1cf86187650 +Node: Tools for Working with Lists6189408 +Ref: tutorial/stdlib2 tools-for-working-with-lists6189585 +Ref: 1cf96189585 +Ref: tutorial/stdlib2 tut-list-tools6189585 +Ref: 1cfa6189585 +Node: Decimal Floating-Point Arithmetic6192035 +Ref: tutorial/stdlib2 decimal-floating-point-arithmetic6192188 +Ref: 1cfb6192188 +Ref: tutorial/stdlib2 tut-decimal-fp6192188 +Ref: 1cfc6192188 +Node: Virtual Environments and Packages6194129 +Ref: tutorial/venv doc6194291 +Ref: 1cfd6194291 +Ref: tutorial/venv tut-venv6194291 +Ref: 1cfe6194291 +Ref: tutorial/venv virtual-environments-and-packages6194291 +Ref: 1cff6194291 +Node: Introduction<4>6194478 +Ref: tutorial/venv introduction6194601 +Ref: 1d006194601 +Node: Creating Virtual Environments6195923 +Ref: tutorial/venv creating-virtual-environments6196081 +Ref: 1d026196081 +Node: Managing Packages with pip6198162 +Ref: tutorial/venv managing-packages-with-pip6198296 +Ref: 1d036198296 +Ref: Managing Packages with pip-Footnote-16202268 +Ref: Managing Packages with pip-Footnote-26202293 +Node: What Now?6202371 +Ref: tutorial/whatnow doc6202537 +Ref: 1d046202537 +Ref: tutorial/whatnow tut-whatnow6202537 +Ref: 1d056202537 +Ref: tutorial/whatnow what-now6202537 +Ref: 1d066202537 +Ref: What Now?-Footnote-16205783 +Node: Interactive Input Editing and History Substitution6205936 +Ref: tutorial/interactive doc6206117 +Ref: 1d086206117 +Ref: tutorial/interactive interactive-input-editing-and-history-substitution6206117 +Ref: 1d096206117 +Ref: tutorial/interactive tut-interacting6206117 +Ref: 1be76206117 +Ref: Interactive Input Editing and History Substitution-Footnote-16206713 +Node: Tab Completion and History Editing6206774 +Ref: tutorial/interactive tab-completion-and-history-editing6206947 +Ref: 1d0a6206947 +Ref: tutorial/interactive tut-keybindings6206947 +Ref: 1d0b6206947 +Node: Alternatives to the Interactive Interpreter6207802 +Ref: tutorial/interactive alternatives-to-the-interactive-interpreter6207975 +Ref: 1d0c6207975 +Ref: tutorial/interactive tut-commentary6207975 +Ref: 1d0d6207975 +Ref: Alternatives to the Interactive Interpreter-Footnote-16208882 +Ref: Alternatives to the Interactive Interpreter-Footnote-26208911 +Node: Floating-Point Arithmetic Issues and Limitations6208952 +Ref: tutorial/floatingpoint doc6209132 +Ref: 1d0f6209132 +Ref: tutorial/floatingpoint floating-point-arithmetic-issues-and-limitations6209132 +Ref: 1d106209132 +Ref: tutorial/floatingpoint tut-fp-issues6209132 +Ref: 1d116209132 +Ref: Floating-Point Arithmetic Issues and Limitations-Footnote-16218626 +Ref: Floating-Point Arithmetic Issues and Limitations-Footnote-26218704 +Node: Representation Error6218755 +Ref: tutorial/floatingpoint representation-error6218860 +Ref: 1d146218860 +Ref: tutorial/floatingpoint tut-fp-error6218860 +Ref: 1d156218860 +Node: Appendix6222111 +Ref: tutorial/appendix doc6222232 +Ref: 1d166222232 +Ref: tutorial/appendix appendix6222232 +Ref: 1d176222232 +Ref: tutorial/appendix tut-appendix6222232 +Ref: 1d186222232 +Node: Interactive Mode<2>6222312 +Ref: tutorial/appendix interactive-mode6222376 +Ref: 1d196222376 +Ref: tutorial/appendix tut-interac6222376 +Ref: 16f6222376 +Node: Error Handling6223615 +Ref: tutorial/appendix error-handling6223719 +Ref: 1d1a6223719 +Ref: tutorial/appendix tut-error6223719 +Ref: 1d1b6223719 +Ref: Error Handling-Footnote-16224786 +Node: Executable Python Scripts6224852 +Ref: tutorial/appendix executable-python-scripts6224993 +Ref: 1d1c6224993 +Ref: tutorial/appendix tut-scripts6224993 +Ref: 1bef6224993 +Node: The Interactive Startup File6226073 +Ref: tutorial/appendix the-interactive-startup-file6226225 +Ref: 1d1d6226225 +Ref: tutorial/appendix tut-startup6226225 +Ref: 1d1e6226225 +Node: The Customization Modules6227661 +Ref: tutorial/appendix the-customization-modules6227779 +Ref: 1d1f6227779 +Ref: tutorial/appendix tut-customize6227779 +Ref: 1d206227779 +Node: Python Setup and Usage6228659 +Ref: using/index doc6228787 +Ref: 1d216228787 +Ref: using/index python-setup-and-usage6228787 +Ref: 1d226228787 +Ref: using/index using-index6228787 +Ref: 1d236228787 +Node: Command line and environment6229276 +Ref: using/cmdline doc6229402 +Ref: 1d246229402 +Ref: using/cmdline command-line-and-environment6229402 +Ref: 1d256229402 +Ref: using/cmdline using-on-general6229402 +Ref: 19be6229402 +Node: Command line6229771 +Ref: using/cmdline command-line6229878 +Ref: 1d276229878 +Ref: using/cmdline using-on-cmdline6229878 +Ref: 10006229878 +Node: Interface options6230296 +Ref: using/cmdline interface-options6230386 +Ref: 1d286230386 +Ref: using/cmdline using-on-interface-options6230386 +Ref: 1d296230386 +Ref: using/cmdline cmdoption-c6231856 +Ref: 5dc6231856 +Ref: using/cmdline cmdoption-m6232425 +Ref: 5dd6232425 +Ref: using/cmdline cmdarg-dash6234815 +Ref: 1d2a6234815 +Ref: using/cmdline cmdarg-script6235235 +Ref: 1d2b6235235 +Ref: Interface options-Footnote-16237088 +Node: Generic options6237130 +Ref: using/cmdline generic-options6237250 +Ref: 1d2c6237250 +Ref: using/cmdline using-on-generic-options6237250 +Ref: 1d2d6237250 +Ref: using/cmdline cmdoption-06237299 +Ref: 13f36237299 +Ref: using/cmdline cmdoption-h6237314 +Ref: 1d2e6237314 +Ref: using/cmdline cmdoption-help6237329 +Ref: 5ec6237329 +Ref: using/cmdline cmdoption-help-env6237464 +Ref: 5ee6237464 +Ref: using/cmdline cmdoption-help-xoptions6237605 +Ref: 5ef6237605 +Ref: using/cmdline cmdoption-help-all6237754 +Ref: 5f06237754 +Ref: using/cmdline cmdoption-V6237856 +Ref: 1776237856 +Ref: using/cmdline cmdoption-version6237871 +Ref: d1b6237871 +Node: Miscellaneous options6238213 +Ref: using/cmdline miscellaneous-options6238333 +Ref: 1d2f6238333 +Ref: using/cmdline using-on-misc-options6238333 +Ref: 10016238333 +Ref: using/cmdline cmdoption-b6238394 +Ref: 5df6238394 +Ref: using/cmdline cmdoption-B6238810 +Ref: 13996238810 +Ref: using/cmdline cmdoption-check-hash-based-pycs6238972 +Ref: 1d306238972 +Ref: using/cmdline cmdoption-d6239666 +Ref: 1d316239666 +Ref: using/cmdline cmdoption-E6239899 +Ref: 95d6239899 +Ref: using/cmdline cmdoption-i6240123 +Ref: 14a66240123 +Ref: using/cmdline cmdoption-I6240760 +Ref: 95e6240760 +Ref: using/cmdline cmdoption-O6241212 +Ref: db46241212 +Ref: using/cmdline cmdoption-OO6241600 +Ref: db56241600 +Ref: using/cmdline cmdoption-P6241905 +Ref: 5a06241905 +Ref: using/cmdline cmdoption-q6242578 +Ref: 1d346242578 +Ref: using/cmdline cmdoption-R6242710 +Ref: 1a966242710 +Ref: using/cmdline cmdoption-s6243766 +Ref: 13776243766 +Ref: using/cmdline cmdoption-S6244003 +Ref: 119b6244003 +Ref: using/cmdline cmdoption-u6244320 +Ref: 19a36244320 +Ref: using/cmdline cmdoption-v6244596 +Ref: 13f06244596 +Ref: using/cmdline using-on-warnings6245101 +Ref: 1d386245101 +Ref: using/cmdline cmdoption-W6245101 +Ref: 8c66245101 +Ref: using/cmdline cmdoption-x6247613 +Ref: 1d3a6247613 +Ref: using/cmdline cmdoption-X6247770 +Ref: 1766247770 +Ref: Miscellaneous options-Footnote-16254361 +Ref: Miscellaneous options-Footnote-26254403 +Ref: Miscellaneous options-Footnote-36254445 +Ref: Miscellaneous options-Footnote-46254487 +Ref: Miscellaneous options-Footnote-56254529 +Node: Controlling color6254571 +Ref: using/cmdline controlling-color6254703 +Ref: 1d406254703 +Ref: using/cmdline using-on-controlling-color6254703 +Ref: 16b6254703 +Ref: Controlling color-Footnote-16255761 +Ref: Controlling color-Footnote-26255794 +Node: Options you shouldn’t use6255824 +Ref: using/cmdline no-color6255926 +Ref: 1d416255926 +Ref: using/cmdline options-you-shouldn-t-use6255926 +Ref: 1d426255926 +Ref: using/cmdline cmdoption-J6255997 +Ref: 13986255997 +Ref: Options you shouldn’t use-Footnote-16256086 +Node: Environment variables6256118 +Ref: using/cmdline environment-variables6256225 +Ref: 1d436256225 +Ref: using/cmdline using-on-envvars6256225 +Ref: 5ed6256225 +Ref: using/cmdline envvar-PYTHONHOME6256518 +Ref: 3b86256518 +Ref: using/cmdline envvar-PYTHONPATH6257124 +Ref: 10166257124 +Ref: using/cmdline envvar-PYTHONSAFEPATH6258190 +Ref: 5a16258190 +Ref: using/cmdline envvar-PYTHONPLATLIBDIR6258425 +Ref: 19406258425 +Ref: using/cmdline envvar-PYTHONSTARTUP6258597 +Ref: fc36258597 +Ref: using/cmdline envvar-PYTHONOPTIMIZE6259286 +Ref: 1d336259286 +Ref: using/cmdline envvar-PYTHONBREAKPOINT6259524 +Ref: adb6259524 +Ref: using/cmdline envvar-PYTHONDEBUG6260149 +Ref: 1d326260149 +Ref: using/cmdline envvar-PYTHONINSPECT6260494 +Ref: 14a56260494 +Ref: using/cmdline envvar-PYTHONUNBUFFERED6261113 +Ref: 19a46261113 +Ref: using/cmdline envvar-PYTHONVERBOSE6261264 +Ref: 1d376261264 +Ref: using/cmdline envvar-PYTHONCASEOK6261503 +Ref: 95c6261503 +Ref: using/cmdline envvar-PYTHONDONTWRITEBYTECODE6261663 +Ref: 139a6261663 +Ref: using/cmdline envvar-PYTHONPYCACHEPREFIX6261908 +Ref: 9a36261908 +Ref: using/cmdline envvar-PYTHONHASHSEED6262251 +Ref: 10766262251 +Ref: using/cmdline envvar-PYTHONINTMAXSTRDIGITS6262937 +Ref: 17bd6262937 +Ref: using/cmdline envvar-PYTHONIOENCODING6263177 +Ref: 10036263177 +Ref: using/cmdline envvar-PYTHONNOUSERSITE6264000 +Ref: 13786264000 +Ref: using/cmdline envvar-PYTHONUSERBASE6264243 +Ref: 13766264243 +Ref: using/cmdline envvar-PYTHONEXECUTABLE6264593 +Ref: 1d486264593 +Ref: using/cmdline envvar-PYTHONWARNINGS6264803 +Ref: baa6264803 +Ref: using/cmdline envvar-PYTHONFAULTHANDLER6265791 +Ref: 10796265791 +Ref: using/cmdline envvar-PYTHONTRACEMALLOC6266242 +Ref: 1d3c6266242 +Ref: using/cmdline envvar-PYTHONPROFILEIMPORTTIME6266812 +Ref: af56266812 +Ref: using/cmdline envvar-PYTHONASYNCIODEBUG6267086 +Ref: 1d4e6267086 +Ref: using/cmdline envvar-PYTHONMALLOC6267298 +Ref: c646267298 +Ref: using/cmdline envvar-PYTHONMALLOCSTATS6268758 +Ref: 1b556268758 +Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSFSENCODING6269373 +Ref: 2b16269373 +Ref: using/cmdline envvar-PYTHONLEGACYWINDOWSSTDIO6269910 +Ref: c5b6269910 +Ref: using/cmdline envvar-PYTHONCOERCECLOCALE6270383 +Ref: ad56270383 +Ref: using/cmdline envvar-PYTHONDEVMODE6273113 +Ref: aed6273113 +Ref: using/cmdline envvar-PYTHONUTF86273460 +Ref: ad86273460 +Ref: using/cmdline envvar-PYTHONWARNDEFAULTENCODING6273756 +Ref: 7b76273756 +Ref: using/cmdline envvar-PYTHONNODEBUGRANGES6274060 +Ref: 5b26274060 +Ref: using/cmdline envvar-PYTHONPERFSUPPORT6274529 +Ref: 46a6274529 +Ref: using/cmdline envvar-PYTHON_PERF_JIT_SUPPORT6274941 +Ref: 1906274941 +Ref: using/cmdline envvar-PYTHON_CPU_COUNT6275392 +Ref: 2126275392 +Ref: using/cmdline envvar-PYTHON_FROZEN_MODULES6275693 +Ref: 18e6275693 +Ref: using/cmdline envvar-PYTHON_COLORS6276338 +Ref: 14a6276338 +Ref: using/cmdline envvar-PYTHON_BASIC_REPL6276605 +Ref: 16e6276605 +Ref: using/cmdline envvar-PYTHON_HISTORY6276936 +Ref: 1916276936 +Ref: using/cmdline envvar-PYTHON_GIL6277187 +Ref: 1756277187 +Ref: using/cmdline envvar-PYTHON_JIT6277625 +Ref: 17b6277625 +Ref: Environment variables-Footnote-16277949 +Ref: Environment variables-Footnote-26277991 +Ref: Environment variables-Footnote-36278033 +Ref: Environment variables-Footnote-46278075 +Node: Debug-mode variables6278117 +Ref: using/cmdline debug-mode-variables6278195 +Ref: 1d566278195 +Ref: using/cmdline envvar-PYTHONDUMPREFS6278254 +Ref: 9a66278254 +Ref: using/cmdline envvar-PYTHONDUMPREFSFILE6278497 +Ref: 18926278497 +Ref: using/cmdline envvar-PYTHON_PRESITE6278853 +Ref: 1d3e6278853 +Node: Using Python on Unix platforms6279598 +Ref: using/unix doc6279749 +Ref: 1d576279749 +Ref: using/unix using-on-unix6279749 +Ref: 1d586279749 +Ref: using/unix using-python-on-unix-platforms6279749 +Ref: 1d596279749 +Node: Getting and installing the latest version of Python6279978 +Ref: using/unix getting-and-installing-the-latest-version-of-python6280120 +Ref: 1d5a6280120 +Node: On Linux6280287 +Ref: using/unix on-linux6280414 +Ref: 1d5b6280414 +Node: Installing IDLE6281345 +Ref: using/unix installing-idle6281405 +Ref: 1d5c6281405 +Ref: using/unix installing-idle-on-linux6281405 +Ref: 1d5d6281405 +Node: On FreeBSD and OpenBSD6281849 +Ref: using/unix on-freebsd-and-openbsd6281976 +Ref: 1d5e6281976 +Node: Building Python6282466 +Ref: using/unix building-python6282647 +Ref: 1d5f6282647 +Ref: using/unix building-python-on-unix6282647 +Ref: eee6282647 +Ref: Building Python-Footnote-16283475 +Ref: Building Python-Footnote-26283524 +Ref: Building Python-Footnote-36283587 +Node: Python-related paths and files6283650 +Ref: using/unix python-related-paths-and-files6283793 +Ref: 1d616283793 +Node: Miscellaneous6285336 +Ref: using/unix miscellaneous6285478 +Ref: 1d646285478 +Node: Custom OpenSSL6286036 +Ref: using/unix custom-openssl6286139 +Ref: 1d656286139 +Ref: using/unix unix-custom-openssl6286139 +Ref: 1d666286139 +Node: Configure Python6287759 +Ref: using/configure doc6287905 +Ref: 1d676287905 +Ref: using/configure configure-python6287905 +Ref: 1d686287905 +Node: Build Requirements6288077 +Ref: using/configure build-requirements6288172 +Ref: 1d696288172 +Ref: Build Requirements-Footnote-16289889 +Ref: Build Requirements-Footnote-26289932 +Ref: Build Requirements-Footnote-36290015 +Ref: Build Requirements-Footnote-46290062 +Ref: Build Requirements-Footnote-56290119 +Ref: Build Requirements-Footnote-66290176 +Ref: Build Requirements-Footnote-76290218 +Node: Generated files6290260 +Ref: using/configure generated-files6290381 +Ref: 1d6a6290381 +Node: configure script6290846 +Ref: using/configure configure-script6290914 +Ref: 1d6b6290914 +Node: Configure Options6291452 +Ref: using/configure configure-options6291574 +Ref: 1d606291574 +Ref: using/configure id16291574 +Ref: 1d6c6291574 +Node: General Options6292138 +Ref: using/configure general-options6292234 +Ref: 1d6d6292234 +Ref: using/configure cmdoption-enable-loadable-sqlite-extensions6292283 +Ref: 1d6e6292283 +Ref: using/configure cmdoption-disable-ipv66292602 +Ref: 1d6f6292602 +Ref: using/configure cmdoption-enable-big-digits6292731 +Ref: 7486292731 +Ref: using/configure cmdoption-with-suffix6293016 +Ref: 1d706293016 +Ref: using/configure cmdoption-with-tzpath6293481 +Ref: 1d716293481 +Ref: using/configure cmdoption-without-decimal-contextvar6293910 +Ref: 1d746293910 +Ref: using/configure cmdoption-with-dbmliborder6294242 +Ref: 1d766294242 +Ref: using/configure cmdoption-without-c-locale-coercion6294525 +Ref: 1d776294525 +Ref: using/configure cmdoption-without-freelists6294768 +Ref: 7476294768 +Ref: using/configure cmdoption-with-platlibdir6294892 +Ref: 1d786294892 +Ref: using/configure cmdoption-with-wheel-pkg-dir6295115 +Ref: 88b6295115 +Ref: using/configure cmdoption-with-pkg-config6295538 +Ref: 1d796295538 +Ref: using/configure cmdoption-enable-pystats6295894 +Ref: 17bb6295894 +Ref: using/configure free-threading-build6298207 +Ref: 1d7a6298207 +Ref: using/configure cmdoption-disable-gil6298207 +Ref: 1746298207 +Ref: using/configure cmdoption-enable-experimental-jit6298560 +Ref: 1d7b6298560 +Ref: using/configure cmdoption-arg-PKG_CONFIG6299299 +Ref: 1d7c6299299 +Ref: using/configure cmdoption-arg-PKG_CONFIG_LIBDIR6299363 +Ref: 1d7d6299363 +Ref: using/configure cmdoption-arg-PKG_CONFIG_PATH6299394 +Ref: 1d7e6299394 +Ref: General Options-Footnote-16299491 +Node: C compiler options6299533 +Ref: using/configure c-compiler-options6299652 +Ref: 1d7f6299652 +Ref: using/configure cmdoption-arg-CC6299707 +Ref: 1d806299707 +Ref: using/configure cmdoption-arg-CFLAGS6299749 +Ref: 1d816299749 +Ref: using/configure cmdoption-arg-CPP6299793 +Ref: 1d826299793 +Ref: using/configure cmdoption-arg-CPPFLAGS6299840 +Ref: 1d836299840 +Node: Linker options6299917 +Ref: using/configure linker-options6300057 +Ref: 1d846300057 +Ref: using/configure cmdoption-arg-LDFLAGS6300104 +Ref: 1d856300104 +Ref: using/configure cmdoption-arg-LIBS6300178 +Ref: 1d866300178 +Ref: using/configure cmdoption-arg-MACHDEP6300258 +Ref: 1d876300258 +Node: Options for third-party dependencies6300327 +Ref: using/configure options-for-third-party-dependencies6300468 +Ref: 1d886300468 +Ref: using/configure cmdoption-arg-BZIP2_CFLAGS6300583 +Ref: 1d896300583 +Ref: using/configure cmdoption-arg-BZIP2_LIBS6300609 +Ref: 1d8a6300609 +Ref: using/configure cmdoption-arg-CURSES_CFLAGS6300764 +Ref: 1d8b6300764 +Ref: using/configure cmdoption-arg-CURSES_LIBS6300791 +Ref: 1d8c6300791 +Ref: using/configure cmdoption-arg-GDBM_CFLAGS6300961 +Ref: 1d8d6300961 +Ref: using/configure cmdoption-arg-GDBM_LIBS6300986 +Ref: 1d8e6300986 +Ref: using/configure cmdoption-arg-LIBB2_CFLAGS6301059 +Ref: 1d8f6301059 +Ref: using/configure cmdoption-arg-LIBB2_LIBS6301085 +Ref: 1d906301085 +Ref: using/configure cmdoption-arg-LIBEDIT_CFLAGS6301251 +Ref: 1d926301251 +Ref: using/configure cmdoption-arg-LIBEDIT_LIBS6301279 +Ref: 1d936301279 +Ref: using/configure cmdoption-arg-LIBFFI_CFLAGS6301428 +Ref: 1d946301428 +Ref: using/configure cmdoption-arg-LIBFFI_LIBS6301455 +Ref: 1d956301455 +Ref: using/configure cmdoption-arg-LIBMPDEC_CFLAGS6301600 +Ref: 1d966301600 +Ref: using/configure cmdoption-arg-LIBMPDEC_LIBS6301629 +Ref: 1d976301629 +Ref: using/configure cmdoption-arg-LIBLZMA_CFLAGS6301904 +Ref: 1d986301904 +Ref: using/configure cmdoption-arg-LIBLZMA_LIBS6301932 +Ref: 1d996301932 +Ref: using/configure cmdoption-arg-LIBREADLINE_CFLAGS6302077 +Ref: 1d9a6302077 +Ref: using/configure cmdoption-arg-LIBREADLINE_LIBS6302109 +Ref: 1d9b6302109 +Ref: using/configure cmdoption-arg-LIBSQLITE3_CFLAGS6302266 +Ref: 1d9c6302266 +Ref: using/configure cmdoption-arg-LIBSQLITE3_LIBS6302297 +Ref: 1d9d6302297 +Ref: using/configure cmdoption-arg-LIBUUID_CFLAGS6302451 +Ref: 1d9e6302451 +Ref: using/configure cmdoption-arg-LIBUUID_LIBS6302479 +Ref: 1d9f6302479 +Ref: using/configure cmdoption-arg-PANEL_CFLAGS6302625 +Ref: 1da06302625 +Ref: using/configure cmdoption-arg-PANEL_LIBS6302651 +Ref: 1da16302651 +Ref: using/configure cmdoption-arg-TCLTK_CFLAGS6302896 +Ref: 1da26302896 +Ref: using/configure cmdoption-arg-TCLTK_LIBS6302922 +Ref: 1da36302922 +Ref: using/configure cmdoption-arg-ZLIB_CFLAGS6303020 +Ref: 1da46303020 +Ref: using/configure cmdoption-arg-ZLIB_LIBS6303045 +Ref: 1da56303045 +Node: WebAssembly Options6303187 +Ref: using/configure webassembly-options6303329 +Ref: 1da66303329 +Ref: using/configure cmdoption-with-emscripten-target6303386 +Ref: 1da76303386 +Ref: using/configure cmdoption-enable-wasm-dynamic-linking6303649 +Ref: 182d6303649 +Ref: using/configure cmdoption-enable-wasm-pthreads6303924 +Ref: 17ff6303924 +Node: Install Options6304030 +Ref: using/configure install-options6304155 +Ref: 1da86304155 +Ref: using/configure cmdoption-prefix6304204 +Ref: 1d626304204 +Ref: using/configure cmdoption-exec-prefix6304522 +Ref: 1d636304522 +Ref: using/configure cmdoption-disable-test-modules6304734 +Ref: 88a6304734 +Ref: using/configure cmdoption-with-ensurepip6304962 +Ref: 1da96304962 +Node: Performance options6305345 +Ref: using/configure performance-options6305469 +Ref: 1daa6305469 +Ref: using/configure cmdoption-enable-optimizations6305725 +Ref: 85e6305725 +Ref: using/configure envvar-PROFILE_TASK6306723 +Ref: 17106306723 +Ref: using/configure cmdoption-with-lto6307045 +Ref: 7466307045 +Ref: using/configure cmdoption-enable-bolt6307564 +Ref: 1dab6307564 +Ref: using/configure cmdoption-arg-BOLT_APPLY_FLAGS6308631 +Ref: 1dac6308631 +Ref: using/configure cmdoption-arg-BOLT_INSTRUMENT_FLAGS6308767 +Ref: 1dad6308767 +Ref: using/configure cmdoption-with-computed-gotos6308895 +Ref: 1dae6308895 +Ref: using/configure cmdoption-without-mimalloc6309027 +Ref: 1daf6309027 +Ref: using/configure cmdoption-without-pymalloc6309203 +Ref: 1db06309203 +Ref: using/configure cmdoption-without-doc-strings6309399 +Ref: 1db16309399 +Ref: using/configure cmdoption-enable-profiling6309696 +Ref: 1db26309696 +Ref: using/configure cmdoption-with-strict-overflow6309804 +Ref: 17626309804 +Ref: Performance options-Footnote-16309995 +Ref: Performance options-Footnote-26310055 +Node: Python Debug Build6310103 +Ref: using/configure debug-build6310225 +Ref: 1fb6310225 +Ref: using/configure python-debug-build6310225 +Ref: 1db36310225 +Node: Debug options6312409 +Ref: using/configure debug-options6312529 +Ref: 1db46312529 +Ref: using/configure cmdoption-with-pydebug6312574 +Ref: 4206312574 +Ref: using/configure cmdoption-with-trace-refs6312708 +Ref: 3906312708 +Ref: using/configure cmdoption-with-assertions6313350 +Ref: 3876313350 +Ref: using/configure cmdoption-with-valgrind6313736 +Ref: 1db66313736 +Ref: using/configure cmdoption-with-dtrace6313812 +Ref: 1db76313812 +Ref: using/configure cmdoption-with-address-sanitizer6313982 +Ref: 1db86313982 +Ref: using/configure cmdoption-with-memory-sanitizer6314352 +Ref: 1db96314352 +Ref: using/configure cmdoption-with-undefined-behavior-sanitizer6314506 +Ref: 1dba6314506 +Ref: using/configure cmdoption-with-thread-sanitizer6314687 +Ref: 1dbb6314687 +Node: Linker options<2>6314830 +Ref: using/configure id26314949 +Ref: 1dbc6314949 +Ref: using/configure cmdoption-enable-shared6314998 +Ref: 85f6314998 +Ref: using/configure cmdoption-without-static-libpython6315112 +Ref: 88c6315112 +Node: Libraries options6315300 +Ref: using/configure libraries-options6315422 +Ref: 1dbd6315422 +Ref: using/configure cmdoption-with-libs6315477 +Ref: 1dbe6315477 +Ref: using/configure cmdoption-with-system-expat6315570 +Ref: 17b26315570 +Ref: using/configure cmdoption-with-system-libmpdec6315701 +Ref: 40e6315701 +Ref: using/configure cmdoption-with-readline6316280 +Ref: 1dbf6316280 +Ref: using/configure cmdoption-without-readline6316526 +Ref: 1dc06316526 +Ref: using/configure cmdoption-with-libm6316713 +Ref: 1dc16316713 +Ref: using/configure cmdoption-with-libc6316832 +Ref: 1dc26316832 +Ref: using/configure cmdoption-with-openssl6316948 +Ref: 1dc36316948 +Ref: using/configure cmdoption-with-openssl-rpath6317045 +Ref: 88d6317045 +Node: Security Options6317385 +Ref: using/configure security-options6317503 +Ref: 1dc46317503 +Ref: using/configure cmdoption-with-hash-algorithm6317556 +Ref: 1dc56317556 +Ref: using/configure cmdoption-with-builtin-hashlib-hashes6317881 +Ref: 1dc66317881 +Ref: using/configure cmdoption-with-ssl-default-suites6318182 +Ref: 1dc76318182 +Node: macOS Options6318664 +Ref: using/configure macos-options6318776 +Ref: 1dc86318776 +Ref: using/configure cmdoption-enable-universalsdk6318847 +Ref: 96b6318847 +Ref: using/configure cmdoption-06318882 +Ref: 1dc96318882 +Ref: using/configure cmdoption-enable-framework6319057 +Ref: 1dca6319057 +Ref: using/configure cmdoption-16319089 +Ref: 1dcb6319089 +Ref: using/configure cmdoption-with-universal-archs6319285 +Ref: 1dcc6319285 +Ref: using/configure cmdoption-with-framework-name6320086 +Ref: 1dcd6320086 +Ref: using/configure cmdoption-with-app-store-compliance6320272 +Ref: 15f46320272 +Ref: using/configure cmdoption-26320313 +Ref: 1dce6320313 +Ref: macOS Options-Footnote-16320815 +Ref: macOS Options-Footnote-26320882 +Node: iOS Options6320980 +Ref: using/configure ios-options6321099 +Ref: 1dcf6321099 +Ref: using/configure cmdoption-36321166 +Ref: 1dd06321166 +Ref: using/configure cmdoption-46321335 +Ref: 1dd16321335 +Ref: iOS Options-Footnote-16321482 +Node: Cross Compiling Options6321549 +Ref: using/configure cross-compiling-options6321646 +Ref: 1dd26321646 +Ref: using/configure cmdoption-build6321993 +Ref: 1dd36321993 +Ref: using/configure cmdoption-host6322098 +Ref: 1dd46322098 +Ref: using/configure cmdoption-with-build-python6322194 +Ref: 1dd56322194 +Ref: using/configure cmdoption-arg-CONFIG_SITE6322331 +Ref: 1dd66322331 +Ref: using/configure cmdoption-arg-HOSTRUNNER6322616 +Ref: 1dd76322616 +Node: Python Build System6322951 +Ref: using/configure python-build-system6323083 +Ref: 1dd86323083 +Node: Main files of the build system6323245 +Ref: using/configure main-files-of-the-build-system6323356 +Ref: 1dd96323356 +Node: Main build steps6323719 +Ref: using/configure main-build-steps6323860 +Ref: 1dda6323860 +Node: Main Makefile targets6324240 +Ref: using/configure main-makefile-targets6324363 +Ref: 1ddb6324363 +Node: make6324588 +Ref: using/configure make6324672 +Ref: 1ddc6324672 +Node: make platform6326081 +Ref: using/configure make-platform6326190 +Ref: 1ddd6326190 +Node: make profile-opt6326508 +Ref: using/configure make-profile-opt6326623 +Ref: 1dde6326623 +Node: make clean6326891 +Ref: using/configure make-clean6327007 +Ref: 1ddf6327007 +Node: make distclean6327067 +Ref: using/configure make-distclean6327179 +Ref: 1de06327179 +Ref: make distclean-Footnote-16327424 +Node: make install6327847 +Ref: using/configure make-install6327958 +Ref: 1de16327958 +Node: make test6328049 +Ref: using/configure make-test6328163 +Ref: 1de26328163 +Node: make buildbottest6328504 +Ref: using/configure make-buildbottest6328620 +Ref: 1de36328620 +Node: make regen-all6328818 +Ref: using/configure make-regen-all6328916 +Ref: 1de46328916 +Node: C extensions6329217 +Ref: using/configure c-extensions6329315 +Ref: 1de56329315 +Node: Compiler and linker flags6330983 +Ref: using/configure compiler-and-linker-flags6331089 +Ref: 1de66331089 +Node: Preprocessor flags6331322 +Ref: using/configure preprocessor-flags6331425 +Ref: 1de76331425 +Ref: using/configure envvar-CONFIGURE_CPPFLAGS6331480 +Ref: 1de86331480 +Ref: using/configure envvar-CPPFLAGS6331645 +Ref: 14826331645 +Ref: using/configure envvar-BASECPPFLAGS6332022 +Ref: 1de96332022 +Ref: using/configure envvar-PY_CPPFLAGS6332090 +Ref: 1dea6332090 +Node: Compiler flags6332343 +Ref: using/configure compiler-flags6332467 +Ref: 1deb6332467 +Ref: using/configure envvar-CC6332514 +Ref: 147f6332514 +Ref: using/configure envvar-CXX6332605 +Ref: 1dec6332605 +Ref: using/configure envvar-CFLAGS6332699 +Ref: 14806332699 +Ref: using/configure envvar-CFLAGS_NODIST6332757 +Ref: 1ded6332757 +Ref: using/configure envvar-COMPILEALL_OPTS6333563 +Ref: 1dee6333563 +Ref: using/configure envvar-EXTRA_CFLAGS6333771 +Ref: 1def6333771 +Ref: using/configure envvar-CONFIGURE_CFLAGS6333841 +Ref: 1df06333841 +Ref: using/configure envvar-CONFIGURE_CFLAGS_NODIST6334002 +Ref: 1df16334002 +Ref: using/configure envvar-BASECFLAGS6334177 +Ref: 1df26334177 +Ref: using/configure envvar-OPT6334242 +Ref: 1db56334242 +Ref: using/configure envvar-CFLAGS_ALIASING6334299 +Ref: 1df36334299 +Ref: using/configure envvar-CCSHARED6334454 +Ref: 1df46334454 +Ref: using/configure envvar-CFLAGSFORSHARED6334603 +Ref: 1df56334603 +Ref: using/configure envvar-PY_CFLAGS6334824 +Ref: 1df66334824 +Ref: using/configure envvar-PY_CFLAGS_NODIST6334955 +Ref: 1df76334955 +Ref: using/configure envvar-PY_STDMODULE_CFLAGS6335127 +Ref: 1df86335127 +Ref: using/configure envvar-PY_CORE_CFLAGS6335358 +Ref: 1df96335358 +Ref: using/configure envvar-PY_BUILTIN_MODULE_CFLAGS6335489 +Ref: 1dfa6335489 +Ref: using/configure envvar-PURIFY6335765 +Ref: 1dfb6335765 +Ref: Compiler flags-Footnote-16335935 +Node: Linker flags6335990 +Ref: using/configure linker-flags6336087 +Ref: 1dfc6336087 +Ref: using/configure envvar-LINKCC6336130 +Ref: 1dfd6336130 +Ref: using/configure envvar-CONFIGURE_LDFLAGS6336291 +Ref: 1dfe6336291 +Ref: using/configure envvar-LDFLAGS_NODIST6336638 +Ref: 1dff6336638 +Ref: using/configure envvar-CONFIGURE_LDFLAGS_NODIST6337235 +Ref: 1e006337235 +Ref: using/configure envvar-LDFLAGS6337412 +Ref: 14816337412 +Ref: using/configure envvar-LIBS6337758 +Ref: 1e016337758 +Ref: using/configure envvar-LDSHARED6337909 +Ref: 1e026337909 +Ref: using/configure envvar-BLDSHARED6338033 +Ref: 1e036338033 +Ref: using/configure envvar-PY_LDFLAGS6338178 +Ref: 1e046338178 +Ref: using/configure envvar-PY_LDFLAGS_NODIST6338270 +Ref: 1e056338270 +Ref: using/configure envvar-PY_CORE_LDFLAGS6338411 +Ref: 1e066338411 +Ref: Linker flags-Footnote-16338585 +Node: Using Python on Windows6338640 +Ref: using/windows doc6338777 +Ref: 1e076338777 +Ref: using/windows using-on-windows6338777 +Ref: aa76338777 +Ref: using/windows using-python-on-windows6338777 +Ref: 1e086338777 +Ref: Using Python on Windows-Footnote-16341055 +Ref: Using Python on Windows-Footnote-26341097 +Node: The full installer6341139 +Ref: using/windows the-full-installer6341253 +Ref: 1e0c6341253 +Ref: using/windows windows-full6341253 +Ref: 1e096341253 +Node: Installation steps6341498 +Ref: using/windows installation-steps6341612 +Ref: 1e0d6341612 +Node: Removing the MAX_PATH Limitation6343745 +Ref: using/windows max-path6343889 +Ref: c416343889 +Ref: using/windows removing-the-max-path-limitation6343889 +Ref: 1e0f6343889 +Node: Installing Without UI6344749 +Ref: using/windows install-quiet-option6344905 +Ref: 5ea6344905 +Ref: using/windows installing-without-ui6344905 +Ref: 1e106344905 +Node: Installing Without Downloading6355399 +Ref: using/windows install-layout-option6355543 +Ref: 1e0e6355543 +Ref: using/windows installing-without-downloading6355543 +Ref: 1e116355543 +Node: Modifying an install6356538 +Ref: using/windows modifying-an-install6356694 +Ref: 1e126356694 +Node: Installing Free-threaded Binaries6357583 +Ref: using/windows install-freethreaded-windows6357700 +Ref: 1726357700 +Ref: using/windows installing-free-threaded-binaries6357700 +Ref: 1e136357700 +Ref: Installing Free-threaded Binaries-Footnote-16359612 +Node: The Microsoft Store package6359654 +Ref: using/windows the-microsoft-store-package6359799 +Ref: 1e146359799 +Ref: using/windows windows-store6359799 +Ref: 1be56359799 +Node: Known issues6361959 +Ref: using/windows known-issues6362035 +Ref: 1e156362035 +Node: Redirection of local data registry and temporary paths6362204 +Ref: using/windows redirection-of-local-data-registry-and-temporary-paths6362307 +Ref: 1e166362307 +Ref: Redirection of local data registry and temporary paths-Footnote-16364532 +Node: The nuget org packages6364623 +Ref: using/windows the-nuget-org-packages6364772 +Ref: 1e176364772 +Ref: using/windows windows-nuget6364772 +Ref: 1e0a6364772 +Ref: The nuget org packages-Footnote-16367156 +Ref: The nuget org packages-Footnote-26367187 +Ref: The nuget org packages-Footnote-36367233 +Ref: The nuget org packages-Footnote-46367282 +Node: Free-threaded packages6367333 +Ref: using/windows free-threaded-packages6367414 +Ref: 1e186367414 +Ref: Free-threaded packages-Footnote-16368016 +Ref: Free-threaded packages-Footnote-26368075 +Ref: Free-threaded packages-Footnote-36368137 +Node: The embeddable package6368201 +Ref: using/windows the-embeddable-package6368342 +Ref: 1e196368342 +Ref: using/windows windows-embeddable6368342 +Ref: 1e0b6368342 +Ref: The embeddable package-Footnote-16370127 +Node: Python Application6370241 +Ref: using/windows python-application6370343 +Ref: 1e1a6370343 +Node: Embedding Python6371840 +Ref: using/windows embedding-python6371942 +Ref: 1e1b6371942 +Node: Alternative bundles6372730 +Ref: using/windows alternative-bundles6372867 +Ref: 1e1c6372867 +Ref: Alternative bundles-Footnote-16373814 +Ref: Alternative bundles-Footnote-26373867 +Ref: Alternative bundles-Footnote-36373910 +Ref: Alternative bundles-Footnote-46373962 +Ref: Alternative bundles-Footnote-56374129 +Node: Configuring Python6374166 +Ref: using/windows configuring-python6374291 +Ref: 1e1d6374291 +Node: Excursus Setting environment variables6374859 +Ref: using/windows excursus-setting-environment-variables6374990 +Ref: 1e1e6374990 +Ref: using/windows setting-envvars6374990 +Ref: 1be66374990 +Node: Finding the Python executable6377164 +Ref: using/windows finding-the-python-executable6377295 +Ref: 1e1f6377295 +Ref: using/windows windows-path-mod6377295 +Ref: 10496377295 +Node: UTF-8 mode6378589 +Ref: using/windows utf-8-mode6378722 +Ref: 1e206378722 +Ref: using/windows win-utf8-mode6378722 +Ref: 1e216378722 +Ref: UTF-8 mode-Footnote-16380245 +Ref: UTF-8 mode-Footnote-26380287 +Node: Python Launcher for Windows6380329 +Ref: using/windows launcher6380459 +Ref: 5ba6380459 +Ref: using/windows python-launcher-for-windows6380459 +Ref: 1e226380459 +Ref: Python Launcher for Windows-Footnote-16381313 +Node: Getting started6381355 +Ref: using/windows getting-started6381456 +Ref: 1e236381456 +Node: From the command-line6381611 +Ref: using/windows from-the-command-line6381713 +Ref: 1e246381713 +Ref: From the command-line-Footnote-16384219 +Node: Virtual environments6384261 +Ref: using/windows virtual-environments6384385 +Ref: 1e256384385 +Node: From a script6384883 +Ref: using/windows from-a-script6385008 +Ref: 1e266385008 +Node: From file associations6386054 +Ref: using/windows from-file-associations6386150 +Ref: 1e276386150 +Node: Shebang Lines6386727 +Ref: using/windows shebang-lines6386863 +Ref: 1e286386863 +Node: Arguments in shebang lines6390915 +Ref: using/windows arguments-in-shebang-lines6391049 +Ref: 1e2a6391049 +Node: Customization6391339 +Ref: using/windows customization6391471 +Ref: 1e2b6391471 +Node: Customization via INI files6391598 +Ref: using/windows customization-via-ini-files6391719 +Ref: 1e2c6391719 +Ref: using/windows launcher-ini6391719 +Ref: 1e296391719 +Node: Customizing default Python versions6392405 +Ref: using/windows customizing-default-python-versions6392526 +Ref: 1e2d6392526 +Node: Diagnostics6396364 +Ref: using/windows diagnostics6396477 +Ref: 1e2e6396477 +Node: Dry Run6396965 +Ref: using/windows dry-run6397082 +Ref: 1e2f6397082 +Node: Install on demand6397514 +Ref: using/windows install-on-demand6397632 +Ref: 1e306397632 +Node: Return codes6398213 +Ref: using/windows return-codes6398315 +Ref: 1e316398315 +Node: Finding modules6400070 +Ref: using/windows finding-modules6400208 +Ref: 1e326400208 +Ref: using/windows windows-finding-modules6400208 +Ref: c216400208 +Node: Additional modules6405286 +Ref: using/windows additional-modules6405424 +Ref: 1e336405424 +Node: PyWin326405827 +Ref: using/windows pywin326405907 +Ref: 1e356405907 +Ref: PyWin32-Footnote-16406491 +Ref: PyWin32-Footnote-26406533 +Ref: PyWin32-Footnote-36406622 +Ref: PyWin32-Footnote-46406691 +Ref: PyWin32-Footnote-56406785 +Ref: PyWin32-Footnote-66406844 +Node: cx_Freeze6406894 +Ref: using/windows cx-freeze6406974 +Ref: 1e366406974 +Ref: cx_Freeze-Footnote-16407250 +Node: Compiling Python on Windows6407302 +Ref: using/windows compiling-python-on-windows6407440 +Ref: 1e376407440 +Ref: Compiling Python on Windows-Footnote-16408095 +Ref: Compiling Python on Windows-Footnote-26408144 +Node: Other Platforms6408207 +Ref: using/windows other-platforms6408318 +Ref: 1e396408318 +Ref: Other Platforms-Footnote-16408881 +Ref: Other Platforms-Footnote-26408923 +Ref: Other Platforms-Footnote-36408965 +Ref: Other Platforms-Footnote-46409020 +Ref: Other Platforms-Footnote-56409048 +Ref: Other Platforms-Footnote-66409105 +Node: Using Python on macOS6409155 +Ref: using/mac doc6409299 +Ref: 1e3a6409299 +Ref: using/mac using-on-mac6409299 +Ref: 1e3b6409299 +Ref: using/mac using-python-on-macos6409299 +Ref: 1e3c6409299 +Ref: using/mac getting-osx6410008 +Ref: 1e3e6410008 +Ref: Using Python on macOS-Footnote-16410269 +Node: Using Python for macOS from python org6410311 +Ref: using/mac getting-and-installing-macpython6410441 +Ref: 1e3f6410441 +Ref: using/mac using-python-for-macos-from-python-org6410441 +Ref: 1e406410441 +Node: Installation steps<2>6410626 +Ref: using/mac installation-steps6410757 +Ref: 1e416410757 +Ref: Installation steps<2>-Footnote-16415847 +Ref: Installation steps<2>-Footnote-26415889 +Ref: Installation steps<2>-Footnote-36415937 +Ref: Installation steps<2>-Footnote-46415992 +Ref: Installation steps<2>-Footnote-56416039 +Node: How to run a Python script6416088 +Ref: using/mac how-to-run-a-python-script6416219 +Ref: 1e426416219 +Node: Alternative Distributions6418194 +Ref: using/mac alternative-bundles6418370 +Ref: 1e3d6418370 +Ref: using/mac alternative-distributions6418370 +Ref: 1e446418370 +Ref: Alternative Distributions-Footnote-16419444 +Ref: Alternative Distributions-Footnote-26419497 +Ref: Alternative Distributions-Footnote-36419540 +Ref: Alternative Distributions-Footnote-46419564 +Node: Installing Additional Python Packages6419597 +Ref: using/mac installing-additional-python-packages6419750 +Ref: 1e456419750 +Ref: using/mac mac-package-manager6419750 +Ref: 1e466419750 +Ref: using/mac osx-gui-scripts6419904 +Ref: 1e476419904 +Ref: Installing Additional Python Packages-Footnote-16419942 +Node: GUI Programming6420021 +Ref: using/mac gui-programming6420164 +Ref: 1e486420164 +Ref: using/mac gui-programming-on-the-mac6420164 +Ref: 1e496420164 +Ref: GUI Programming-Footnote-16421103 +Ref: GUI Programming-Footnote-26421144 +Ref: GUI Programming-Footnote-36421184 +Ref: GUI Programming-Footnote-46421225 +Ref: GUI Programming-Footnote-56421279 +Ref: GUI Programming-Footnote-66421304 +Ref: GUI Programming-Footnote-76421340 +Ref: GUI Programming-Footnote-86421368 +Node: Advanced Topics6421397 +Ref: using/mac advanced-topics6421518 +Ref: 1e4a6421518 +Node: Installing Free-threaded Binaries<2>6421748 +Ref: using/mac install-freethreaded-macos6421878 +Ref: 1736421878 +Ref: using/mac installing-free-threaded-binaries6421878 +Ref: 1e4b6421878 +Ref: Installing Free-threaded Binaries<2>-Footnote-16426867 +Node: Installing using the command line6426909 +Ref: using/mac installing-using-the-command-line6427080 +Ref: 1e4c6427080 +Node: Distributing Python Applications6429908 +Ref: using/mac distributing-python-applications6430063 +Ref: 1e4d6430063 +Ref: using/mac distributing-python-applications-on-the-mac6430063 +Ref: 1e4e6430063 +Ref: Distributing Python Applications-Footnote-16430691 +Ref: Distributing Python Applications-Footnote-26430732 +Ref: Distributing Python Applications-Footnote-36430773 +Ref: Distributing Python Applications-Footnote-46430801 +Node: App Store Compliance6430834 +Ref: using/mac app-store-compliance6430947 +Ref: 1e4f6430947 +Ref: App Store Compliance-Footnote-16432057 +Node: Other Resources6432151 +Ref: using/mac other-resources6432248 +Ref: 1e506432248 +Ref: Other Resources-Footnote-16432514 +Ref: Other Resources-Footnote-26432557 +Node: Using Python on Android6432626 +Ref: using/android doc6432766 +Ref: 1e516432766 +Ref: using/android using-android6432766 +Ref: 1e526432766 +Ref: using/android using-python-on-android6432766 +Ref: 1e536432766 +Node: Adding Python to an Android app6434001 +Ref: using/android adding-python-to-an-android-app6434138 +Ref: 1e566434138 +Ref: Adding Python to an Android app-Footnote-16435461 +Ref: Adding Python to an Android app-Footnote-26435502 +Ref: Adding Python to an Android app-Footnote-36435543 +Ref: Adding Python to an Android app-Footnote-46435579 +Ref: Adding Python to an Android app-Footnote-56435646 +Ref: Adding Python to an Android app-Footnote-66435677 +Ref: Adding Python to an Android app-Footnote-76435745 +Ref: Adding Python to an Android app-Footnote-86435815 +Ref: Adding Python to an Android app-Footnote-96435905 +Ref: Adding Python to an Android app-Footnote-106436027 +Node: Building a Python package for Android6436128 +Ref: using/android building-a-python-package-for-android6436265 +Ref: 1e576436265 +Ref: Building a Python package for Android-Footnote-16436650 +Node: Using Python on iOS6436716 +Ref: using/ios doc6436851 +Ref: 1e586436851 +Ref: using/ios using-ios6436851 +Ref: 1e596436851 +Ref: using/ios using-python-on-ios6436851 +Ref: 1e5a6436851 +Ref: Using Python on iOS-Footnote-16438384 +Ref: Using Python on iOS-Footnote-26438412 +Node: Python at runtime on iOS6438437 +Ref: using/ios python-at-runtime-on-ios6438550 +Ref: 1e5b6438550 +Node: iOS version compatibility6438771 +Ref: using/ios ios-version-compatibility6438889 +Ref: 1e5c6438889 +Node: Platform identification6439421 +Ref: using/ios platform-identification6439577 +Ref: 1e5d6439577 +Node: Standard library availability6440219 +Ref: using/ios standard-library-availability6440374 +Ref: 1e606440374 +Node: Binary extension modules6440597 +Ref: using/ios binary-extension-modules6440751 +Ref: 1e616440751 +Node: Compiler stub binaries6443609 +Ref: using/ios compiler-stub-binaries6443725 +Ref: 1e656443725 +Node: Installing Python on iOS6445117 +Ref: using/ios installing-python-on-ios6445262 +Ref: 1e666445262 +Node: Tools for building iOS apps6445432 +Ref: using/ios tools-for-building-ios-apps6445560 +Ref: 1e676445560 +Node: Adding Python to an iOS project6446343 +Ref: using/ios adding-ios6446504 +Ref: 1e626446504 +Ref: using/ios adding-python-to-an-ios-project6446504 +Ref: 1e686446504 +Ref: Adding Python to an iOS project-Footnote-16455685 +Ref: Adding Python to an iOS project-Footnote-26455730 +Node: Testing a Python package6455797 +Ref: using/ios testing-a-python-package6455922 +Ref: 1e6a6455922 +Ref: Testing a Python package-Footnote-16457739 +Ref: Testing a Python package-Footnote-26457803 +Node: App Store Compliance<2>6457870 +Ref: using/ios app-store-compliance6457982 +Ref: 1e6b6457982 +Ref: App Store Compliance<2>-Footnote-16458873 +Node: Editors and IDEs6458967 +Ref: using/editors doc6459070 +Ref: 1e6c6459070 +Ref: using/editors editors6459070 +Ref: 1e436459070 +Ref: using/editors editors-and-ides6459070 +Ref: 1e6d6459070 +Ref: Editors and IDEs-Footnote-16459382 +Node: IDLE — Python editor and shell6459424 +Ref: using/editors idle-python-editor-and-shell6459540 +Ref: 1e6e6459540 +Node: Other Editors and IDEs6459879 +Ref: using/editors other-editors-and-ides6459995 +Ref: 1e6f6459995 +Ref: Other Editors and IDEs-Footnote-16460282 +Ref: Other Editors and IDEs-Footnote-26460333 +Node: The Python Language Reference6460404 +Ref: reference/index doc6460540 +Ref: 1e706460540 +Ref: reference/index reference-index6460540 +Ref: 1456460540 +Ref: reference/index the-python-language-reference6460540 +Ref: 1e716460540 +Node: Introduction<5>6461531 +Ref: reference/introduction doc6461637 +Ref: 1e726461637 +Ref: reference/introduction id16461637 +Ref: 1e736461637 +Ref: reference/introduction introduction6461637 +Ref: 1e746461637 +Node: Alternate Implementations6463432 +Ref: reference/introduction alternate-implementations6463526 +Ref: 1e756463526 +Ref: reference/introduction implementations6463526 +Ref: 1d266463526 +Ref: Alternate Implementations-Footnote-16465706 +Ref: Alternate Implementations-Footnote-26465738 +Ref: Alternate Implementations-Footnote-36465775 +Ref: Alternate Implementations-Footnote-46465807 +Node: Notation6465833 +Ref: reference/introduction id26465927 +Ref: 1e766465927 +Ref: reference/introduction notation6465927 +Ref: 1e776465927 +Ref: reference/introduction grammar-token-notation-name6466114 +Ref: 1e786466114 +Ref: reference/introduction grammar-token-notation-lc_letter6466188 +Ref: 1e796466188 +Ref: Notation-Footnote-16468258 +Node: Lexical analysis6468321 +Ref: reference/lexical_analysis doc6468446 +Ref: 1e7a6468446 +Ref: reference/lexical_analysis lexical6468446 +Ref: 1e7b6468446 +Ref: reference/lexical_analysis lexical-analysis6468446 +Ref: 1e7c6468446 +Ref: Lexical analysis-Footnote-16469133 +Node: Line structure6469175 +Ref: reference/lexical_analysis id16469263 +Ref: 1e7e6469263 +Ref: reference/lexical_analysis line-structure6469263 +Ref: 1e7f6469263 +Node: Logical lines6469569 +Ref: reference/lexical_analysis id26469656 +Ref: 1e806469656 +Ref: reference/lexical_analysis logical-lines6469656 +Ref: 1e816469656 +Node: Physical lines6470034 +Ref: reference/lexical_analysis id36470138 +Ref: 1e826470138 +Ref: reference/lexical_analysis physical-lines6470138 +Ref: 1e836470138 +Node: Comments6470909 +Ref: reference/lexical_analysis comments6471021 +Ref: 1e846471021 +Ref: reference/lexical_analysis id46471021 +Ref: 1e856471021 +Node: Encoding declarations6471324 +Ref: reference/lexical_analysis encoding-declarations6471443 +Ref: 1e866471443 +Ref: reference/lexical_analysis encodings6471443 +Ref: 1e876471443 +Node: Explicit line joining6472567 +Ref: reference/lexical_analysis explicit-joining6472699 +Ref: 1e886472699 +Ref: reference/lexical_analysis explicit-line-joining6472699 +Ref: 1e896472699 +Node: Implicit line joining6473633 +Ref: reference/lexical_analysis implicit-joining6473755 +Ref: 1e8a6473755 +Ref: reference/lexical_analysis implicit-line-joining6473755 +Ref: 1e8b6473755 +Node: Blank lines6474591 +Ref: reference/lexical_analysis blank-lines6474703 +Ref: 1e8c6474703 +Ref: reference/lexical_analysis id56474703 +Ref: 1e8d6474703 +Node: Indentation6475178 +Ref: reference/lexical_analysis id66475294 +Ref: 1e8e6475294 +Ref: reference/lexical_analysis indentation6475294 +Ref: 1e8f6475294 +Node: Whitespace between tokens6478680 +Ref: reference/lexical_analysis whitespace6478776 +Ref: 1e906478776 +Ref: reference/lexical_analysis whitespace-between-tokens6478776 +Ref: 1e916478776 +Node: Other tokens6479178 +Ref: reference/lexical_analysis id76479299 +Ref: 1e926479299 +Ref: reference/lexical_analysis other-tokens6479299 +Ref: 1e936479299 +Node: Identifiers and keywords6479731 +Ref: reference/lexical_analysis identifiers6479846 +Ref: 1e946479846 +Ref: reference/lexical_analysis identifiers-and-keywords6479846 +Ref: 1e956479846 +Ref: reference/lexical_analysis grammar-token-python-grammar-identifier6480718 +Ref: 1e966480718 +Ref: reference/lexical_analysis grammar-token-python-grammar-id_start6480790 +Ref: 1e996480790 +Ref: reference/lexical_analysis grammar-token-python-grammar-id_continue6480939 +Ref: 1e9a6480939 +Ref: reference/lexical_analysis grammar-token-python-grammar-xid_start6481099 +Ref: 1e976481099 +Ref: reference/lexical_analysis grammar-token-python-grammar-xid_continue6481219 +Ref: 1e986481219 +Ref: Identifiers and keywords-Footnote-16482252 +Ref: Identifiers and keywords-Footnote-26482294 +Ref: Identifiers and keywords-Footnote-36482336 +Node: Keywords6482399 +Ref: reference/lexical_analysis id86482490 +Ref: 1e9b6482490 +Ref: reference/lexical_analysis keywords6482490 +Ref: 1e9c6482490 +Node: Soft Keywords6483085 +Ref: reference/lexical_analysis id96483216 +Ref: 1e9d6483216 +Ref: reference/lexical_analysis soft-keywords6483216 +Ref: 8086483216 +Node: Reserved classes of identifiers6483926 +Ref: reference/lexical_analysis id-classes6484040 +Ref: 1e9e6484040 +Ref: reference/lexical_analysis reserved-classes-of-identifiers6484040 +Ref: 1e9f6484040 +Node: Literals6485963 +Ref: reference/lexical_analysis id106486075 +Ref: 1ea16486075 +Ref: reference/lexical_analysis literals6486075 +Ref: 1ea26486075 +Node: String and Bytes literals6486354 +Ref: reference/lexical_analysis string-and-bytes-literals6486461 +Ref: 1ea36486461 +Ref: reference/lexical_analysis strings6486461 +Ref: 1ea46486461 +Ref: reference/lexical_analysis grammar-token-python-grammar-stringliteral6486599 +Ref: 1ea56486599 +Ref: reference/lexical_analysis grammar-token-python-grammar-stringprefix6486704 +Ref: 1ea66486704 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortstring6486844 +Ref: 1ea76486844 +Ref: reference/lexical_analysis grammar-token-python-grammar-longstring6486947 +Ref: 1ea86486947 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortstringitem6487056 +Ref: 1ea96487056 +Ref: reference/lexical_analysis grammar-token-python-grammar-longstringitem6487141 +Ref: 1eaa6487141 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortstringchar6487225 +Ref: 1eab6487225 +Ref: reference/lexical_analysis grammar-token-python-grammar-longstringchar6487308 +Ref: 1ead6487308 +Ref: reference/lexical_analysis grammar-token-python-grammar-stringescapeseq6487367 +Ref: 1eac6487367 +Ref: reference/lexical_analysis grammar-token-python-grammar-bytesliteral6487420 +Ref: 1eae6487420 +Ref: reference/lexical_analysis grammar-token-python-grammar-bytesprefix6487519 +Ref: 1eaf6487519 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortbytes6487609 +Ref: 1eb06487609 +Ref: reference/lexical_analysis grammar-token-python-grammar-longbytes6487709 +Ref: 1eb16487709 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortbytesitem6487815 +Ref: 1eb26487815 +Ref: reference/lexical_analysis grammar-token-python-grammar-longbytesitem6487897 +Ref: 1eb36487897 +Ref: reference/lexical_analysis grammar-token-python-grammar-shortbyteschar6487978 +Ref: 1eb46487978 +Ref: reference/lexical_analysis grammar-token-python-grammar-longbyteschar6488059 +Ref: 1eb66488059 +Ref: reference/lexical_analysis grammar-token-python-grammar-bytesescapeseq6488116 +Ref: 1eb56488116 +Ref: String and Bytes literals-Footnote-16490656 +Node: Escape sequences6490698 +Ref: reference/lexical_analysis escape-sequences6490776 +Ref: 4556490776 +Ref: reference/lexical_analysis id116490776 +Ref: 1eb76490776 +Ref: Escape sequences-Footnote-16497099 +Node: String literal concatenation6497171 +Ref: reference/lexical_analysis string-concatenation6497296 +Ref: 1eb86497296 +Ref: reference/lexical_analysis string-literal-concatenation6497296 +Ref: 1eb96497296 +Ref: reference/lexical_analysis f-strings6498339 +Ref: 9a96498339 +Node: f-strings6498339 +Ref: reference/lexical_analysis formatted-string-literals6498455 +Ref: 1eba6498455 +Ref: reference/lexical_analysis id136498455 +Ref: 1ebb6498455 +Ref: reference/lexical_analysis grammar-token-python-grammar-f_string6499036 +Ref: 1ebc6499036 +Ref: reference/lexical_analysis grammar-token-python-grammar-replacement_field6499139 +Ref: 1ebe6499139 +Ref: reference/lexical_analysis grammar-token-python-grammar-f_expression6499267 +Ref: 1ebf6499267 +Ref: reference/lexical_analysis grammar-token-python-grammar-conversion6499525 +Ref: 1ec06499525 +Ref: reference/lexical_analysis grammar-token-python-grammar-format_spec6499568 +Ref: 1ec16499568 +Ref: reference/lexical_analysis grammar-token-python-grammar-literal_char6499657 +Ref: 1ebd6499657 +Ref: f-strings-Footnote-16505187 +Node: Numeric literals6505229 +Ref: reference/lexical_analysis numbers6505333 +Ref: 1ec56505333 +Ref: reference/lexical_analysis numeric-literals6505333 +Ref: 1ec66505333 +Node: Integer literals6505767 +Ref: reference/lexical_analysis integer-literals6505885 +Ref: 1ec76505885 +Ref: reference/lexical_analysis integers6505885 +Ref: 1ec86505885 +Ref: reference/lexical_analysis grammar-token-python-grammar-integer6506006 +Ref: 1ec96506006 +Ref: reference/lexical_analysis grammar-token-python-grammar-decinteger6506130 +Ref: 1eca6506130 +Ref: reference/lexical_analysis grammar-token-python-grammar-bininteger6506226 +Ref: 1ecb6506226 +Ref: reference/lexical_analysis grammar-token-python-grammar-octinteger6506295 +Ref: 1ecc6506295 +Ref: reference/lexical_analysis grammar-token-python-grammar-hexinteger6506364 +Ref: 1ecd6506364 +Ref: reference/lexical_analysis grammar-token-python-grammar-nonzerodigit6506433 +Ref: 1ece6506433 +Ref: reference/lexical_analysis grammar-token-python-grammar-digit6506465 +Ref: 1ecf6506465 +Ref: reference/lexical_analysis grammar-token-python-grammar-bindigit6506497 +Ref: 1ed06506497 +Ref: reference/lexical_analysis grammar-token-python-grammar-octdigit6506529 +Ref: 1ed16506529 +Ref: reference/lexical_analysis grammar-token-python-grammar-hexdigit6506561 +Ref: 1ed26506561 +Node: Floating-point literals6507428 +Ref: reference/lexical_analysis floating6507548 +Ref: 1ed36507548 +Ref: reference/lexical_analysis floating-point-literals6507548 +Ref: 1ed46507548 +Ref: reference/lexical_analysis grammar-token-python-grammar-floatnumber6507690 +Ref: 1ed56507690 +Ref: reference/lexical_analysis grammar-token-python-grammar-pointfloat6507766 +Ref: 1ed66507766 +Ref: reference/lexical_analysis grammar-token-python-grammar-exponentfloat6507865 +Ref: 1ed76507865 +Ref: reference/lexical_analysis grammar-token-python-grammar-digitpart6507961 +Ref: 1ed86507961 +Ref: reference/lexical_analysis grammar-token-python-grammar-fraction6508031 +Ref: 1ed96508031 +Ref: reference/lexical_analysis grammar-token-python-grammar-exponent6508081 +Ref: 1eda6508081 +Node: Imaginary literals6508660 +Ref: reference/lexical_analysis imaginary6508755 +Ref: 1edb6508755 +Ref: reference/lexical_analysis imaginary-literals6508755 +Ref: 1edc6508755 +Ref: reference/lexical_analysis grammar-token-python-grammar-imagnumber6508882 +Ref: 1edd6508882 +Node: Operators6509371 +Ref: reference/lexical_analysis id146509469 +Ref: 1ede6509469 +Ref: reference/lexical_analysis operators6509469 +Ref: 1edf6509469 +Node: Delimiters6509706 +Ref: reference/lexical_analysis delimiters6509787 +Ref: 1ee06509787 +Ref: reference/lexical_analysis id156509787 +Ref: 1ee16509787 +Node: Data model6510710 +Ref: reference/datamodel doc6510835 +Ref: 1ee26510835 +Ref: reference/datamodel data-model6510835 +Ref: 1ee36510835 +Ref: reference/datamodel datamodel6510835 +Ref: 19706510835 +Node: Objects values and types6511003 +Ref: reference/datamodel objects6511110 +Ref: 1ee46511110 +Ref: reference/datamodel objects-values-and-types6511110 +Ref: 1ee56511110 +Ref: Objects values and types-Footnote-16516140 +Node: The standard type hierarchy6516367 +Ref: reference/datamodel the-standard-type-hierarchy6516503 +Ref: 1ee66516503 +Ref: reference/datamodel types6516503 +Ref: 1ee76516503 +Node: None6517513 +Ref: reference/datamodel none6517604 +Ref: 1ee86517604 +Node: NotImplemented6517937 +Ref: reference/datamodel notimplemented6518045 +Ref: 1ee96518045 +Node: Ellipsis6518866 +Ref: reference/datamodel ellipsis6518984 +Ref: 1eeb6518984 +Node: numbers Number6519210 +Ref: reference/datamodel numbers-number6519323 +Ref: 1eec6519323 +Node: numbers Integral6520554 +Ref: reference/datamodel numbers-integral6520648 +Ref: 1eed6520648 +Node: numbers Real float6521871 +Ref: reference/datamodel numbers-real-float6521997 +Ref: 1eee6521997 +Node: numbers Complex complex6522582 +Ref: reference/datamodel numbers-complex-complex6522683 +Ref: 1eef6522683 +Node: Sequences6523063 +Ref: reference/datamodel sequences6523177 +Ref: 1ef06523177 +Node: Immutable sequences6524336 +Ref: reference/datamodel immutable-sequences6524427 +Ref: 1ef16524427 +Node: Mutable sequences6526398 +Ref: reference/datamodel mutable-sequences6526489 +Ref: 1ef36526489 +Node: Set types6527465 +Ref: reference/datamodel set-types6527573 +Ref: 1ef46527573 +Node: Mappings6528800 +Ref: reference/datamodel mappings6528913 +Ref: 1ef56528913 +Node: Dictionaries<2>6529395 +Ref: reference/datamodel dictionaries6529455 +Ref: 1ef66529455 +Node: Callable types6530894 +Ref: reference/datamodel callable-types6531008 +Ref: 1ef76531008 +Node: User-defined functions6531393 +Ref: reference/datamodel user-defined-funcs6531491 +Ref: 29b6531491 +Ref: reference/datamodel user-defined-functions6531491 +Ref: 1ef86531491 +Node: Special read-only attributes6531870 +Ref: reference/datamodel special-read-only-attributes6531993 +Ref: 1ef96531993 +Ref: reference/datamodel function __globals__6532391 +Ref: 12c66532391 +Ref: reference/datamodel function __closure__6532897 +Ref: 12c36532897 +Node: Special writable attributes6533661 +Ref: reference/datamodel special-writable-attributes6533784 +Ref: 1efc6533784 +Ref: reference/datamodel function __doc__6534240 +Ref: 11cb6534240 +Ref: reference/datamodel function __name__6534532 +Ref: 12c76534532 +Ref: reference/datamodel function __qualname__6534825 +Ref: 1efd6534825 +Ref: reference/datamodel function __module__6535271 +Ref: 1efe6535271 +Ref: reference/datamodel function __defaults__6535577 +Ref: 12c46535577 +Ref: reference/datamodel function __code__6536068 +Ref: 29c6536068 +Ref: reference/datamodel function __dict__6536359 +Ref: 12c56536359 +Ref: reference/datamodel function __annotations__6536742 +Ref: 11ca6536742 +Ref: reference/datamodel function __kwdefaults__6537365 +Ref: 10216537365 +Ref: reference/datamodel function __type_params__6537674 +Ref: 1f006537674 +Node: Instance methods6538674 +Ref: reference/datamodel id26538800 +Ref: 1f026538800 +Ref: reference/datamodel instance-methods6538800 +Ref: 1cbe6538800 +Ref: reference/datamodel method __self__6539036 +Ref: 13946539036 +Ref: reference/datamodel method __func__6539336 +Ref: 12ef6539336 +Ref: reference/datamodel method __doc__6539553 +Ref: 1f046539553 +Ref: reference/datamodel method __name__6540044 +Ref: 1f056540044 +Ref: reference/datamodel method __module__6540339 +Ref: 1f066540339 +Ref: reference/datamodel method-binding6540905 +Ref: 1f036540905 +Node: Generator functions6542379 +Ref: reference/datamodel generator-functions6542502 +Ref: 1f076542502 +Node: Coroutine functions6543206 +Ref: reference/datamodel coroutine-functions6543345 +Ref: 1f086543345 +Node: Asynchronous generator functions6543749 +Ref: reference/datamodel asynchronous-generator-functions6543887 +Ref: 1f0a6543887 +Node: Built-in functions6544757 +Ref: reference/datamodel built-in-functions6544892 +Ref: 1f0b6544892 +Ref: reference/datamodel builtin-functions6544892 +Ref: 1f016544892 +Node: Built-in methods6545682 +Ref: reference/datamodel built-in-methods6545795 +Ref: 1f0c6545795 +Ref: reference/datamodel builtin-methods6545795 +Ref: 1f0d6545795 +Node: Classes<2>6546284 +Ref: reference/datamodel classes6546394 +Ref: 1f0e6546394 +Ref: reference/datamodel id36546394 +Ref: 1f0f6546394 +Node: Class Instances6546747 +Ref: reference/datamodel class-instances6546832 +Ref: 1f106546832 +Node: Modules<3>6546996 +Ref: reference/datamodel module-objects6547116 +Ref: 1f116547116 +Ref: reference/datamodel modules6547116 +Ref: 1f126547116 +Node: Import-related attributes on module objects6548139 +Ref: reference/datamodel import-mod-attrs6548281 +Ref: 1f146548281 +Ref: reference/datamodel import-related-attributes-on-module-objects6548281 +Ref: 1f156548281 +Ref: reference/datamodel module __name__6549928 +Ref: 13746549928 +Ref: reference/datamodel module __spec__6550267 +Ref: 1f176550267 +Ref: reference/datamodel module __package__6550526 +Ref: 2db6550526 +Ref: reference/datamodel module __loader__6552602 +Ref: 2e66552602 +Ref: reference/datamodel module __path__6553820 +Ref: 1c6e6553820 +Ref: reference/datamodel module __file__6554277 +Ref: 1f1d6554277 +Ref: reference/datamodel module __cached__6554309 +Ref: 2d96554309 +Ref: Import-related attributes on module objects-Footnote-16556292 +Ref: Import-related attributes on module objects-Footnote-26556334 +Node: Other writable attributes on module objects6556376 +Ref: reference/datamodel other-writable-attributes-on-module-objects6556546 +Ref: 1f1f6556546 +Ref: reference/datamodel module __doc__6556769 +Ref: 18526556769 +Ref: reference/datamodel module __annotations__6556920 +Ref: 1f206556920 +Node: Module dictionaries6557192 +Ref: reference/datamodel module-dictionaries6557310 +Ref: 1f216557310 +Ref: reference/datamodel module __dict__6557438 +Ref: 1f226557438 +Node: Custom classes6558056 +Ref: reference/datamodel class-attrs-and-methods6558177 +Ref: 1f236558177 +Ref: reference/datamodel custom-classes6558177 +Ref: 1f246558177 +Node: Special attributes6559794 +Ref: reference/datamodel special-attributes6559887 +Ref: 1f256559887 +Ref: reference/datamodel type __name__6560258 +Ref: 14746560258 +Ref: reference/datamodel type __qualname__6560548 +Ref: 1f266560548 +Ref: reference/datamodel type __module__6560858 +Ref: 36f6560858 +Ref: reference/datamodel type __dict__6561133 +Ref: c5d6561133 +Ref: reference/datamodel type __bases__6561537 +Ref: 14756561537 +Ref: reference/datamodel type __doc__6562041 +Ref: 1cac6562041 +Ref: reference/datamodel type __annotations__6562365 +Ref: 1f276562365 +Ref: reference/datamodel type __type_params__6563716 +Ref: 1f286563716 +Ref: reference/datamodel type __static_attributes__6564227 +Ref: 14b6564227 +Ref: reference/datamodel type __firstlineno__6564768 +Ref: 14c6564768 +Ref: reference/datamodel type __mro__6565416 +Ref: 1f296565416 +Node: Special methods6565720 +Ref: reference/datamodel special-methods6565813 +Ref: 1f2a6565813 +Ref: reference/datamodel type mro6565986 +Ref: 1f2b6565986 +Ref: reference/datamodel type __subclasses__6566219 +Ref: 5706566219 +Node: Class instances6566569 +Ref: reference/datamodel id46566718 +Ref: 1f2c6566718 +Node: Special attributes<2>6568198 +Ref: reference/datamodel id56568271 +Ref: 1f2f6568271 +Ref: reference/datamodel object __class__6568328 +Ref: 14766568328 +Ref: reference/datamodel object __dict__6568412 +Ref: 5586568412 +Node: I/O objects also known as file objects6568665 +Ref: reference/datamodel i-o-objects-also-known-as-file-objects6568814 +Ref: 1f316568814 +Node: Internal types6569558 +Ref: reference/datamodel internal-types6569683 +Ref: 1f336569683 +Node: Code objects6570057 +Ref: reference/datamodel code-objects6570142 +Ref: 1d26570142 +Ref: reference/datamodel id66570142 +Ref: 1f346570142 +Node: Special read-only attributes<2>6570875 +Ref: reference/datamodel id76570987 +Ref: 1f356570987 +Ref: reference/datamodel codeobject co_name6571097 +Ref: 1f366571097 +Ref: reference/datamodel codeobject co_qualname6571286 +Ref: 1f376571286 +Ref: reference/datamodel codeobject co_argcount6571621 +Ref: 1f386571621 +Ref: reference/datamodel codeobject co_posonlyargcount6572111 +Ref: 1f396572111 +Ref: reference/datamodel codeobject co_kwonlyargcount6572505 +Ref: 1f3a6572505 +Ref: reference/datamodel codeobject co_nlocals6572890 +Ref: 1f3b6572890 +Ref: reference/datamodel codeobject co_varnames6573200 +Ref: 1f3c6573200 +Ref: reference/datamodel codeobject co_cellvars6573593 +Ref: 1f3d6573593 +Ref: reference/datamodel codeobject co_freevars6574082 +Ref: 1efb6574082 +Ref: reference/datamodel codeobject co_code6574830 +Ref: 1f406574830 +Ref: reference/datamodel codeobject co_consts6575142 +Ref: 15746575142 +Ref: reference/datamodel codeobject co_names6575456 +Ref: 1f416575456 +Ref: reference/datamodel codeobject co_filename6575771 +Ref: 13596575771 +Ref: reference/datamodel codeobject co_firstlineno6576050 +Ref: 1f426576050 +Ref: reference/datamodel codeobject co_lnotab6576262 +Ref: 2e46576262 +Ref: reference/datamodel codeobject co_stacksize6577010 +Ref: 1f436577010 +Ref: reference/datamodel codeobject co_flags6577216 +Ref: 1f446577216 +Node: Methods on code objects6578339 +Ref: reference/datamodel methods-on-code-objects6578451 +Ref: 1f476578451 +Ref: reference/datamodel codeobject co_positions6578518 +Ref: 5af6578518 +Ref: reference/datamodel codeobject co_lines6580067 +Ref: 2f56580067 +Ref: reference/datamodel codeobject replace6581698 +Ref: 1f486581698 +Ref: Methods on code objects-Footnote-16581985 +Node: Frame objects6582027 +Ref: reference/datamodel frame-objects6582138 +Ref: 6db6582138 +Ref: reference/datamodel id86582138 +Ref: 1f496582138 +Node: Special read-only attributes<3>6582491 +Ref: reference/datamodel id96582611 +Ref: 1f4a6582611 +Ref: reference/datamodel frame f_back6582715 +Ref: 7876582715 +Ref: reference/datamodel frame f_code6583042 +Ref: 1f4b6583042 +Ref: reference/datamodel frame f_locals6583568 +Ref: 1826583568 +Ref: reference/datamodel frame f_globals6584300 +Ref: 1f4c6584300 +Ref: reference/datamodel frame f_builtins6584597 +Ref: 1f4d6584597 +Ref: reference/datamodel frame f_lasti6584900 +Ref: 8866584900 +Node: Special writable attributes<2>6585231 +Ref: reference/datamodel id106585380 +Ref: 1f4e6585380 +Ref: reference/datamodel frame f_trace6585483 +Ref: 1f4f6585483 +Ref: reference/datamodel frame f_trace_lines6586026 +Ref: reference/datamodel frame f_trace_opcodes6586350 +Ref: bdc6586350 +Ref: reference/datamodel frame f_lineno6586953 +Ref: 7a76586953 +Node: Frame object methods6587496 +Ref: reference/datamodel frame-object-methods6587605 +Ref: 1f506587605 +Ref: reference/datamodel frame clear6587701 +Ref: 2826587701 +Node: Traceback objects6588383 +Ref: reference/datamodel id116588495 +Ref: 1f516588495 +Ref: reference/datamodel traceback-objects6588495 +Ref: af46588495 +Ref: reference/datamodel traceback tb_frame6589822 +Ref: 1f526589822 +Ref: reference/datamodel traceback tb_lineno6590465 +Ref: 1f536590465 +Ref: reference/datamodel traceback tb_lasti6590682 +Ref: 1f546590682 +Ref: reference/datamodel traceback tb_next6591047 +Ref: af36591047 +Node: Slice objects6591331 +Ref: reference/datamodel slice-objects6591451 +Ref: 1f556591451 +Ref: reference/datamodel slice indices6591898 +Ref: 10206591898 +Node: Static method objects6592380 +Ref: reference/datamodel static-method-objects6592503 +Ref: 1f596592503 +Node: Class method objects6593103 +Ref: reference/datamodel class-method-objects6593204 +Ref: 1f5a6593204 +Node: Special method names6593651 +Ref: reference/datamodel special-method-names6593773 +Ref: 1f5b6593773 +Ref: reference/datamodel specialnames6593773 +Ref: c6e6593773 +Ref: Special method names-Footnote-16595696 +Node: Basic customization6596035 +Ref: reference/datamodel basic-customization6596148 +Ref: 1f5f6596148 +Ref: reference/datamodel customization6596148 +Ref: 1f606596148 +Ref: reference/datamodel object __new__6596205 +Ref: 57d6596205 +Ref: reference/datamodel object __init__6597762 +Ref: 6ac6597762 +Ref: reference/datamodel object __del__6598621 +Ref: 1f616598621 +Ref: reference/datamodel object __repr__6601915 +Ref: 6186601915 +Ref: reference/datamodel object __str__6602844 +Ref: 6196602844 +Ref: reference/datamodel object __bytes__6603520 +Ref: 5e46603520 +Ref: reference/datamodel object __format__6603776 +Ref: 61a6603776 +Ref: reference/datamodel richcmpfuncs6605043 +Ref: 1f626605043 +Ref: reference/datamodel object __lt__6605043 +Ref: 12926605043 +Ref: reference/datamodel object __le__6605083 +Ref: 12fe6605083 +Ref: reference/datamodel object __eq__6605123 +Ref: afa6605123 +Ref: reference/datamodel object __ne__6605163 +Ref: 14e26605163 +Ref: reference/datamodel object __gt__6605203 +Ref: 12ff6605203 +Ref: reference/datamodel object __ge__6605243 +Ref: 13006605243 +Ref: reference/datamodel object __hash__6608326 +Ref: afb6608326 +Ref: reference/datamodel object __bool__6612604 +Ref: 12c86612604 +Node: Customizing attribute access6613104 +Ref: reference/datamodel attribute-access6613252 +Ref: 1f646613252 +Ref: reference/datamodel customizing-attribute-access6613252 +Ref: 1f656613252 +Ref: reference/datamodel object __getattr__6613484 +Ref: 4cf6613484 +Ref: reference/datamodel object __getattribute__6614803 +Ref: bd26614803 +Ref: reference/datamodel object __setattr__6615909 +Ref: 1f2d6615909 +Ref: reference/datamodel object __delattr__6616584 +Ref: 1f2e6616584 +Ref: reference/datamodel object __dir__6616970 +Ref: 1f676616970 +Node: Customizing module attribute access6617312 +Ref: reference/datamodel customizing-module-attribute-access6617445 +Ref: 1f686617445 +Ref: Customizing module attribute access-Footnote-16619574 +Node: Implementing Descriptors6619616 +Ref: reference/datamodel descriptors6619778 +Ref: c4f6619778 +Ref: reference/datamodel implementing-descriptors6619778 +Ref: 1f696619778 +Ref: reference/datamodel object __get__6620338 +Ref: 14b26620338 +Ref: reference/datamodel object __set__6621269 +Ref: 1f6a6621269 +Ref: reference/datamodel object __delete__6621627 +Ref: 16096621627 +Ref: reference/datamodel object __objclass__6621845 +Ref: 1f6c6621845 +Ref: Implementing Descriptors-Footnote-16622412 +Node: Invoking Descriptors6622454 +Ref: reference/datamodel descriptor-invocation6622593 +Ref: 1f6b6622593 +Ref: reference/datamodel invoking-descriptors6622593 +Ref: 1f6d6622593 +Node: __slots__<2>6625747 +Ref: reference/datamodel id136625853 +Ref: 1f6e6625853 +Ref: reference/datamodel slots6625853 +Ref: 1f306625853 +Ref: reference/datamodel object __slots__6626230 +Ref: 14b56626230 +Ref: reference/datamodel datamodel-note-slots6626553 +Ref: 1f6f6626553 +Node: Customizing class creation6629640 +Ref: reference/datamodel class-customization6629809 +Ref: c4b6629809 +Ref: reference/datamodel customizing-class-creation6629809 +Ref: 1f716629809 +Ref: reference/datamodel object __init_subclass__6630294 +Ref: 62d6630294 +Ref: reference/datamodel object __set_name__6631764 +Ref: c4e6631764 +Node: Metaclasses6632729 +Ref: reference/datamodel id146632833 +Ref: 1f726632833 +Ref: reference/datamodel metaclasses6632833 +Ref: 1f736632833 +Node: Resolving MRO entries6633888 +Ref: reference/datamodel resolving-mro-entries6634038 +Ref: 1f746634038 +Ref: reference/datamodel object __mro_entries__6634099 +Ref: 1f756634099 +Ref: Resolving MRO entries-Footnote-16635115 +Node: Determining the appropriate metaclass6635157 +Ref: reference/datamodel determining-the-appropriate-metaclass6635325 +Ref: 1f766635325 +Node: Preparing the class namespace6636256 +Ref: reference/datamodel prepare6636427 +Ref: c5e6636427 +Ref: reference/datamodel preparing-the-class-namespace6636427 +Ref: 1f776636427 +Ref: Preparing the class namespace-Footnote-16637330 +Node: Executing the class body6637372 +Ref: reference/datamodel executing-the-class-body6637531 +Ref: 1f786637531 +Node: Creating the class object6638266 +Ref: reference/datamodel class-object-creation6638416 +Ref: c4a6638416 +Ref: reference/datamodel creating-the-class-object6638416 +Ref: 1f796638416 +Ref: Creating the class object-Footnote-16640860 +Node: Uses for metaclasses6640902 +Ref: reference/datamodel uses-for-metaclasses6641019 +Ref: 1f7a6641019 +Node: Customizing instance and subclass checks6641330 +Ref: reference/datamodel customizing-instance-and-subclass-checks6641494 +Ref: 1f7b6641494 +Ref: reference/datamodel type __instancecheck__6641984 +Ref: 1f7c6641984 +Ref: reference/datamodel type __subclasscheck__6642212 +Ref: 1f7d6642212 +Ref: Customizing instance and subclass checks-Footnote-16643164 +Node: Emulating generic types6643206 +Ref: reference/datamodel emulating-generic-types6643370 +Ref: 1f7e6643370 +Ref: reference/datamodel object __class_getitem__6644285 +Ref: 7366644285 +Ref: Emulating generic types-Footnote-16644783 +Node: The purpose of __class_getitem__6644825 +Ref: reference/datamodel the-purpose-of-class-getitem6644962 +Ref: 1f806644962 +Node: __class_getitem__ versus __getitem__6645853 +Ref: reference/datamodel class-getitem-versus-getitem6645990 +Ref: 1f826645990 +Ref: reference/datamodel classgetitem-versus-getitem6645990 +Ref: 1f836645990 +Ref: __class_getitem__ versus __getitem__-Footnote-16649321 +Node: Emulating callable objects6649363 +Ref: reference/datamodel emulating-callable-objects6649512 +Ref: 1f876649512 +Ref: reference/datamodel id156649512 +Ref: 1f886649512 +Ref: reference/datamodel object __call__6649585 +Ref: 5556649585 +Node: Emulating container types6649888 +Ref: reference/datamodel emulating-container-types6650037 +Ref: 1f896650037 +Ref: reference/datamodel sequence-types6650037 +Ref: 1f8a6650037 +Ref: reference/datamodel object __len__6652424 +Ref: 1f636652424 +Ref: reference/datamodel object __length_hint__6653159 +Ref: f066653159 +Ref: reference/datamodel object __getitem__6653948 +Ref: 2856653948 +Ref: reference/datamodel object __setitem__6655072 +Ref: 12be6655072 +Ref: reference/datamodel object __delitem__6655534 +Ref: 12bf6655534 +Ref: reference/datamodel object __missing__6655960 +Ref: 1f926655960 +Ref: reference/datamodel object __iter__6656151 +Ref: 1f5c6656151 +Ref: reference/datamodel object __reversed__6656458 +Ref: 1f5d6656458 +Ref: reference/datamodel object __contains__6657445 +Ref: 1f5e6657445 +Node: Emulating numeric types6658011 +Ref: reference/datamodel emulating-numeric-types6658165 +Ref: 1f946658165 +Ref: reference/datamodel numeric-types6658165 +Ref: 1f956658165 +Ref: reference/datamodel object __add__6658480 +Ref: 1f8c6658480 +Ref: reference/datamodel object __sub__6658521 +Ref: 1f966658521 +Ref: reference/datamodel object __mul__6658562 +Ref: 1f8f6658562 +Ref: reference/datamodel object __matmul__6658603 +Ref: 1f976658603 +Ref: reference/datamodel object __truediv__6658647 +Ref: 14be6658647 +Ref: reference/datamodel object __floordiv__6658692 +Ref: 14bf6658692 +Ref: reference/datamodel object __mod__6658738 +Ref: 1f986658738 +Ref: reference/datamodel object __divmod__6658779 +Ref: 1f996658779 +Ref: reference/datamodel object __pow__6658823 +Ref: 7ce6658823 +Ref: reference/datamodel object __lshift__6658874 +Ref: 1f9a6658874 +Ref: reference/datamodel object __rshift__6658918 +Ref: 1f9b6658918 +Ref: reference/datamodel object __and__6658962 +Ref: 1f9c6658962 +Ref: reference/datamodel object __xor__6659003 +Ref: 1f9d6659003 +Ref: reference/datamodel object __or__6659044 +Ref: 1f9e6659044 +Ref: reference/datamodel object __radd__6660043 +Ref: 1f8d6660043 +Ref: reference/datamodel object __rsub__6660085 +Ref: 1f9f6660085 +Ref: reference/datamodel object __rmul__6660127 +Ref: 1f906660127 +Ref: reference/datamodel object __rmatmul__6660169 +Ref: 1fa06660169 +Ref: reference/datamodel object __rtruediv__6660214 +Ref: 1fa16660214 +Ref: reference/datamodel object __rfloordiv__6660260 +Ref: 1fa26660260 +Ref: reference/datamodel object __rmod__6660307 +Ref: 1fa36660307 +Ref: reference/datamodel object __rdivmod__6660349 +Ref: 1fa46660349 +Ref: reference/datamodel object __rpow__6660394 +Ref: 7cf6660394 +Ref: reference/datamodel object __rlshift__6660446 +Ref: 1fa56660446 +Ref: reference/datamodel object __rrshift__6660491 +Ref: 1fa66660491 +Ref: reference/datamodel object __rand__6660536 +Ref: 1fa76660536 +Ref: reference/datamodel object __rxor__6660578 +Ref: 1fa86660578 +Ref: reference/datamodel object __ror__6660620 +Ref: 1fa96660620 +Ref: reference/datamodel object __iadd__6661900 +Ref: 1f8e6661900 +Ref: reference/datamodel object __isub__6661942 +Ref: 1faa6661942 +Ref: reference/datamodel object __imul__6661984 +Ref: 1f916661984 +Ref: reference/datamodel object __imatmul__6662026 +Ref: 1fab6662026 +Ref: reference/datamodel object __itruediv__6662071 +Ref: 1fac6662071 +Ref: reference/datamodel object __ifloordiv__6662117 +Ref: 1fad6662117 +Ref: reference/datamodel object __imod__6662164 +Ref: 1fae6662164 +Ref: reference/datamodel object __ipow__6662206 +Ref: 7cc6662206 +Ref: reference/datamodel object __ilshift__6662258 +Ref: 1faf6662258 +Ref: reference/datamodel object __irshift__6662303 +Ref: 1fb06662303 +Ref: reference/datamodel object __iand__6662348 +Ref: 1fb16662348 +Ref: reference/datamodel object __ixor__6662390 +Ref: 1fb26662390 +Ref: reference/datamodel object __ior__6662432 +Ref: 1fb36662432 +Ref: reference/datamodel object __neg__6663638 +Ref: 1fb56663638 +Ref: reference/datamodel object __pos__6663672 +Ref: 1fb66663672 +Ref: reference/datamodel object __abs__6663706 +Ref: 1fb76663706 +Ref: reference/datamodel object __invert__6663740 +Ref: 1fb86663740 +Ref: reference/datamodel object __complex__6663893 +Ref: 5e36663893 +Ref: reference/datamodel object __int__6663931 +Ref: 7176663931 +Ref: reference/datamodel object __float__6663965 +Ref: 9cc6663965 +Ref: reference/datamodel object __index__6664173 +Ref: 7186664173 +Ref: reference/datamodel object __round__6664850 +Ref: 1fb96664850 +Ref: reference/datamodel object __trunc__6664897 +Ref: 7166664897 +Ref: reference/datamodel object __floor__6664933 +Ref: 1fba6664933 +Ref: reference/datamodel object __ceil__6664969 +Ref: 1fbb6664969 +Ref: Emulating numeric types-Footnote-16665687 +Ref: Emulating numeric types-Footnote-26666007 +Node: With Statement Context Managers6666232 +Ref: reference/datamodel context-managers6666419 +Ref: 1fbd6666419 +Ref: reference/datamodel with-statement-context-managers6666419 +Ref: 1fbe6666419 +Ref: reference/datamodel object __enter__6667265 +Ref: 5c46667265 +Ref: reference/datamodel object __exit__6667515 +Ref: 12f36667515 +Ref: With Statement Context Managers-Footnote-16668404 +Node: Customizing positional arguments in class pattern matching6668446 +Ref: reference/datamodel class-pattern-matching6668632 +Ref: 1fc06668632 +Ref: reference/datamodel customizing-positional-arguments-in-class-pattern-matching6668632 +Ref: 1fc16668632 +Ref: reference/datamodel object __match_args__6669063 +Ref: 18bf6669063 +Ref: Customizing positional arguments in class pattern matching-Footnote-16670021 +Node: Emulating buffer types6670063 +Ref: reference/datamodel emulating-buffer-types6670239 +Ref: 1fc26670239 +Ref: reference/datamodel python-buffer-protocol6670239 +Ref: 1fc36670239 +Ref: reference/datamodel object __buffer__6670696 +Ref: 45a6670696 +Ref: reference/datamodel object __release_buffer__6671175 +Ref: 16f36671175 +Ref: Emulating buffer types-Footnote-16671914 +Node: Special method lookup6671956 +Ref: reference/datamodel special-lookup6672065 +Ref: 1f666672065 +Ref: reference/datamodel special-method-lookup6672065 +Ref: 1fc46672065 +Node: Coroutines6674786 +Ref: reference/datamodel coroutines6674872 +Ref: 1fc56674872 +Node: Awaitable Objects6675022 +Ref: reference/datamodel awaitable-objects6675112 +Ref: 1fc66675112 +Ref: reference/datamodel object __await__6675553 +Ref: 1fc76675553 +Ref: Awaitable Objects-Footnote-16676418 +Node: Coroutine Objects6676460 +Ref: reference/datamodel coroutine-objects6676581 +Ref: 1f096676581 +Ref: reference/datamodel id186676581 +Ref: 1fc86676581 +Ref: reference/datamodel coroutine send6677459 +Ref: 1fcb6677459 +Ref: reference/datamodel coroutine throw6677988 +Ref: 4f36677988 +Ref: reference/datamodel coroutine close6678776 +Ref: 1fcd6678776 +Node: Asynchronous Iterators6679399 +Ref: reference/datamodel async-iterators6679532 +Ref: d796679532 +Ref: reference/datamodel asynchronous-iterators6679532 +Ref: 1fce6679532 +Ref: reference/datamodel object __aiter__6679825 +Ref: bfb6679825 +Ref: reference/datamodel object __anext__6679915 +Ref: 15736679915 +Node: Asynchronous Context Managers6680815 +Ref: reference/datamodel async-context-managers6680922 +Ref: 5f86680922 +Ref: reference/datamodel asynchronous-context-managers6680922 +Ref: 1fcf6680922 +Ref: reference/datamodel object __aenter__6681296 +Ref: 1fd06681296 +Ref: reference/datamodel object __aexit__6681455 +Ref: 162a6681455 +Node: Execution model6681933 +Ref: reference/executionmodel doc6682059 +Ref: 1fd16682059 +Ref: reference/executionmodel execmodel6682059 +Ref: 1fd26682059 +Ref: reference/executionmodel execution-model6682059 +Ref: 1fd36682059 +Node: Structure of a program6682189 +Ref: reference/executionmodel prog-structure6682290 +Ref: 1fd46682290 +Ref: reference/executionmodel structure-of-a-program6682290 +Ref: 1fd56682290 +Node: Naming and binding6683332 +Ref: reference/executionmodel naming6683455 +Ref: 1efa6683455 +Ref: reference/executionmodel naming-and-binding6683455 +Ref: 1fd66683455 +Node: Binding of names6683679 +Ref: reference/executionmodel bind-names6683778 +Ref: 1fd76683778 +Ref: reference/executionmodel binding-of-names6683778 +Ref: 1fd86683778 +Node: Resolution of names6685550 +Ref: reference/executionmodel resolution-of-names6685675 +Ref: 1fdb6685675 +Ref: reference/executionmodel resolve-names6685675 +Ref: 1fdc6685675 +Node: Annotation scopes6689556 +Ref: reference/executionmodel annotation-scopes6689680 +Ref: 1886689680 +Ref: reference/executionmodel id16689680 +Ref: 1fde6689680 +Ref: Annotation scopes-Footnote-16692336 +Ref: Annotation scopes-Footnote-26692378 +Ref: Annotation scopes-Footnote-36692420 +Node: Lazy evaluation6692462 +Ref: reference/executionmodel id26692600 +Ref: 1fe06692600 +Ref: reference/executionmodel lazy-evaluation6692600 +Ref: 4526692600 +Node: Builtins and restricted execution6694233 +Ref: reference/executionmodel builtins-and-restricted-execution6694387 +Ref: 1fe16694387 +Ref: reference/executionmodel restrict-exec6694387 +Ref: 1fe26694387 +Node: Interaction with dynamic features6695232 +Ref: reference/executionmodel dynamic-features6695362 +Ref: 1fe36695362 +Ref: reference/executionmodel interaction-with-dynamic-features6695362 +Ref: 1fe46695362 +Ref: Interaction with dynamic features-Footnote-16696155 +Node: Exceptions<2>6696293 +Ref: reference/executionmodel exceptions6696385 +Ref: 1fe56696385 +Ref: reference/executionmodel id46696385 +Ref: 1fe66696385 +Node: The import system6698568 +Ref: reference/import doc6698695 +Ref: 1fe76698695 +Ref: reference/import importsystem6698695 +Ref: 1f136698695 +Ref: reference/import the-import-system6698695 +Ref: 1fe86698695 +Ref: The import system-Footnote-16701330 +Ref: The import system-Footnote-26701371 +Ref: The import system-Footnote-36701413 +Node: importlib<10>6701455 +Ref: reference/import importlib6701542 +Ref: 1fea6701542 +Node: Packages<2>6701917 +Ref: reference/import packages6702022 +Ref: 1feb6702022 +Node: Regular packages6703429 +Ref: reference/import regular-packages6703520 +Ref: 1fec6703520 +Node: Namespace packages6704732 +Ref: reference/import namespace-packages6704823 +Ref: 1fee6704823 +Ref: reference/import reference-namespace-package6704823 +Ref: 1fef6704823 +Ref: Namespace packages-Footnote-16706200 +Node: Searching6706242 +Ref: reference/import searching6706341 +Ref: 1ff16706341 +Node: The module cache6707166 +Ref: reference/import the-module-cache6707256 +Ref: 1ff26707256 +Node: Finders and loaders6708820 +Ref: reference/import finders-and-loaders6708931 +Ref: 1ff36708931 +Ref: reference/import id26708931 +Ref: 1ff46708931 +Node: Import hooks6710688 +Ref: reference/import import-hooks6710796 +Ref: 1ff76710796 +Node: The meta path6711669 +Ref: reference/import the-meta-path6711749 +Ref: 1ff86711749 +Node: Loading6714962 +Ref: reference/import loading6715071 +Ref: 1ffa6715071 +Ref: Loading-Footnote-16718165 +Node: Loaders6718545 +Ref: reference/import loaders6718615 +Ref: 1ffb6718615 +Node: Submodules6721863 +Ref: reference/import submodules6721954 +Ref: 1ffc6721954 +Node: Module specs6723186 +Ref: reference/import id46723300 +Ref: 1ffd6723300 +Ref: reference/import module-specs6723300 +Ref: 1f196723300 +Node: __path__ attributes on modules6724341 +Ref: reference/import package-path-rules6724457 +Ref: 1f1b6724457 +Ref: reference/import path-attributes-on-modules6724457 +Ref: 20006724457 +Ref: __path__ attributes on modules-Footnote-16725791 +Ref: __path__ attributes on modules-Footnote-26725833 +Node: Module reprs6725875 +Ref: reference/import module-reprs6726007 +Ref: 20016726007 +Node: Cached bytecode invalidation6727421 +Ref: reference/import cached-bytecode-invalidation6727514 +Ref: 20026727514 +Ref: reference/import pyc-invalidation6727514 +Ref: 5e86727514 +Node: The Path Based Finder6728863 +Ref: reference/import the-path-based-finder6728999 +Ref: 20036728999 +Node: Path entry finders6731507 +Ref: reference/import path-entry-finders6731618 +Ref: 20056731618 +Node: Path entry finder protocol6736558 +Ref: reference/import path-entry-finder-protocol6736669 +Ref: 20076736669 +Node: Replacing the standard import system6739046 +Ref: reference/import replacing-the-standard-import-system6739199 +Ref: 20086739199 +Node: Package Relative Imports6740202 +Ref: reference/import package-relative-imports6740369 +Ref: 20096740369 +Ref: reference/import relativeimports6740369 +Ref: 200a6740369 +Node: Special considerations for __main__6741572 +Ref: reference/import import-dunder-main6741713 +Ref: 200b6741713 +Ref: reference/import special-considerations-for-main6741713 +Ref: 200c6741713 +Node: __main__ __spec__6742316 +Ref: reference/import id56742405 +Ref: 200d6742405 +Ref: reference/import main-spec6742405 +Ref: 1fff6742405 +Node: References6743802 +Ref: reference/import references6743910 +Ref: 200e6743910 +Ref: References-Footnote-16745141 +Ref: References-Footnote-26745193 +Ref: References-Footnote-36745235 +Ref: References-Footnote-46745277 +Ref: References-Footnote-56745319 +Ref: References-Footnote-66745361 +Ref: References-Footnote-76745403 +Ref: References-Footnote-86745445 +Ref: References-Footnote-96745487 +Ref: References-Footnote-106745529 +Node: Expressions6745572 +Ref: reference/expressions doc6745701 +Ref: 200f6745701 +Ref: reference/expressions expressions6745701 +Ref: 20106745701 +Ref: reference/expressions id16745701 +Ref: 20116745701 +Ref: reference/expressions grammar-token-python-grammar-name6745995 +Ref: 20126745995 +Node: Arithmetic conversions6746561 +Ref: reference/expressions arithmetic-conversions6746645 +Ref: 20136746645 +Ref: reference/expressions conversions6746645 +Ref: 20146746645 +Node: Atoms6747348 +Ref: reference/expressions atoms6747450 +Ref: 20156747450 +Ref: reference/expressions id26747450 +Ref: 20166747450 +Ref: reference/expressions grammar-token-python-grammar-atom6747697 +Ref: 20176747697 +Ref: reference/expressions grammar-token-python-grammar-enclosure6747788 +Ref: 20196747788 +Node: Identifiers Names6748293 +Ref: reference/expressions atom-identifiers6748372 +Ref: 1ea06748372 +Ref: reference/expressions identifiers-names6748372 +Ref: 20206748372 +Ref: reference/expressions private-name-mangling6748811 +Ref: 1cba6748811 +Node: Private name mangling6748847 +Ref: reference/expressions id36748922 +Ref: 20216748922 +Node: Literals<2>6750707 +Ref: reference/expressions atom-literals6750814 +Ref: 20226750814 +Ref: reference/expressions literals6750814 +Ref: 20236750814 +Ref: reference/expressions grammar-token-python-grammar-literal6750922 +Ref: 20186750922 +Node: Parenthesized forms6751694 +Ref: reference/expressions parenthesized6751824 +Ref: 20246751824 +Ref: reference/expressions parenthesized-forms6751824 +Ref: 20256751824 +Ref: reference/expressions grammar-token-python-grammar-parenth_form6751959 +Ref: 201a6751959 +Node: Displays for lists sets and dictionaries6752727 +Ref: reference/expressions comprehensions6752859 +Ref: 5cc6752859 +Ref: reference/expressions displays-for-lists-sets-and-dictionaries6752859 +Ref: 20276752859 +Ref: reference/expressions grammar-token-python-grammar-comprehension6753305 +Ref: 20286753305 +Ref: reference/expressions grammar-token-python-grammar-comp_for6753385 +Ref: 20296753385 +Ref: reference/expressions grammar-token-python-grammar-comp_iter6753500 +Ref: 202c6753500 +Ref: reference/expressions grammar-token-python-grammar-comp_if6753568 +Ref: 202d6753568 +Ref: Displays for lists sets and dictionaries-Footnote-16756070 +Node: List displays6756112 +Ref: reference/expressions list-displays6756237 +Ref: 202e6756237 +Ref: reference/expressions lists6756237 +Ref: 202f6756237 +Ref: reference/expressions grammar-token-python-grammar-list_display6756369 +Ref: 201b6756369 +Node: Set displays6756853 +Ref: reference/expressions set6756957 +Ref: 20316756957 +Ref: reference/expressions set-displays6756957 +Ref: 20326756957 +Ref: reference/expressions grammar-token-python-grammar-set_display6757137 +Ref: 201d6757137 +Node: Dictionary displays6757707 +Ref: reference/expressions dict6757819 +Ref: d7e6757819 +Ref: reference/expressions dictionary-displays6757819 +Ref: 20336757819 +Ref: reference/expressions grammar-token-python-grammar-dict_display6757983 +Ref: 201c6757983 +Ref: reference/expressions grammar-token-python-grammar-dict_item_list6758083 +Ref: 20346758083 +Ref: reference/expressions grammar-token-python-grammar-dict_item6758170 +Ref: 20366758170 +Ref: reference/expressions grammar-token-python-grammar-dict_comprehension6758278 +Ref: 20356758278 +Ref: Dictionary displays-Footnote-16760123 +Ref: Dictionary displays-Footnote-26760165 +Node: Generator expressions6760207 +Ref: reference/expressions generator-expressions6760324 +Ref: 20386760324 +Ref: reference/expressions genexpr6760324 +Ref: 20396760324 +Ref: reference/expressions grammar-token-python-grammar-generator_expression6760457 +Ref: 201e6760457 +Node: Yield expressions6762521 +Ref: reference/expressions yield-expressions6762610 +Ref: 203a6762610 +Ref: reference/expressions yieldexpr6762610 +Ref: 203b6762610 +Ref: reference/expressions grammar-token-python-grammar-yield_atom6762665 +Ref: 201f6762665 +Ref: reference/expressions grammar-token-python-grammar-yield_from6762729 +Ref: 203c6762729 +Ref: reference/expressions grammar-token-python-grammar-yield_expression6762794 +Ref: 1ec46762794 +Ref: Yield expressions-Footnote-16767795 +Ref: Yield expressions-Footnote-26767837 +Ref: Yield expressions-Footnote-36767879 +Ref: Yield expressions-Footnote-46767921 +Ref: Yield expressions-Footnote-56767963 +Node: Generator-iterator methods6768005 +Ref: reference/expressions generator-iterator-methods6768102 +Ref: 20406768102 +Ref: reference/expressions generator-methods6768102 +Ref: 1fca6768102 +Ref: reference/expressions generator __next__6768444 +Ref: 1cc56768444 +Ref: reference/expressions generator send6769202 +Ref: 1fcc6769202 +Ref: reference/expressions generator throw6769784 +Ref: 4f46769784 +Ref: reference/expressions generator close6771076 +Ref: 16f46771076 +Node: Examples6772113 +Ref: reference/expressions examples6772254 +Ref: 20416772254 +Node: Asynchronous generator functions<2>6773314 +Ref: reference/expressions asynchronous-generator-functions6773468 +Ref: 203f6773468 +Ref: reference/expressions id46773468 +Ref: 20426773468 +Ref: Asynchronous generator functions<2>-Footnote-16777139 +Node: Asynchronous generator-iterator methods6777219 +Ref: reference/expressions asynchronous-generator-iterator-methods6777356 +Ref: 20446777356 +Ref: reference/expressions asynchronous-generator-methods6777356 +Ref: 20456777356 +Ref: reference/expressions agen __anext__6777598 +Ref: 20436777598 +Ref: reference/expressions agen asend6778520 +Ref: 8d86778520 +Ref: reference/expressions agen athrow6779379 +Ref: 4f56779379 +Ref: reference/expressions agen aclose6780257 +Ref: 8d76780257 +Node: Primaries6781269 +Ref: reference/expressions id56781365 +Ref: 20466781365 +Ref: reference/expressions primaries6781365 +Ref: 20476781365 +Ref: reference/expressions grammar-token-python-grammar-primary6781487 +Ref: 20486781487 +Node: Attribute references6781698 +Ref: reference/expressions attribute-references6781786 +Ref: 204d6781786 +Ref: reference/expressions id66781786 +Ref: 204e6781786 +Ref: reference/expressions grammar-token-python-grammar-attributeref6781915 +Ref: 20496781915 +Node: Subscriptions6782732 +Ref: reference/expressions id76782837 +Ref: 204f6782837 +Ref: reference/expressions subscriptions6782837 +Ref: 1f846782837 +Ref: reference/expressions grammar-token-python-grammar-subscription6783108 +Ref: 204a6783108 +Ref: Subscriptions-Footnote-16785773 +Node: Slicings6785815 +Ref: reference/expressions id86785905 +Ref: 20506785905 +Ref: reference/expressions slicings6785905 +Ref: 20516785905 +Ref: reference/expressions grammar-token-python-grammar-slicing6786154 +Ref: 204b6786154 +Ref: reference/expressions grammar-token-python-grammar-slice_list6786229 +Ref: 20526786229 +Ref: reference/expressions grammar-token-python-grammar-slice_item6786312 +Ref: 20536786312 +Ref: reference/expressions grammar-token-python-grammar-proper_slice6786386 +Ref: 20546786386 +Ref: reference/expressions grammar-token-python-grammar-lower_bound6786496 +Ref: 20556786496 +Ref: reference/expressions grammar-token-python-grammar-upper_bound6786542 +Ref: 20566786542 +Ref: reference/expressions grammar-token-python-grammar-stride6786588 +Ref: 20576786588 +Node: Calls6787839 +Ref: reference/expressions calls6787907 +Ref: d7c6787907 +Ref: reference/expressions id96787907 +Ref: 20586787907 +Ref: reference/expressions grammar-token-python-grammar-call6788055 +Ref: 204c6788055 +Ref: reference/expressions grammar-token-python-grammar-argument_list6788178 +Ref: 205a6788178 +Ref: reference/expressions grammar-token-python-grammar-positional_arguments6788518 +Ref: 205b6788518 +Ref: reference/expressions grammar-token-python-grammar-positional_item6788613 +Ref: 205e6788613 +Ref: reference/expressions grammar-token-python-grammar-starred_and_keywords6788708 +Ref: 205c6788708 +Ref: reference/expressions grammar-token-python-grammar-keywords_arguments6788893 +Ref: 205d6788893 +Ref: reference/expressions grammar-token-python-grammar-keyword_item6789080 +Ref: 205f6789080 +Ref: Calls-Footnote-16795857 +Node: Await expression6795899 +Ref: reference/expressions await6796008 +Ref: 1b96796008 +Ref: reference/expressions await-expression6796008 +Ref: 20606796008 +Ref: reference/expressions grammar-token-python-grammar-await_expr6796197 +Ref: 20616796197 +Node: The power operator6796270 +Ref: reference/expressions power6796409 +Ref: 20626796409 +Ref: reference/expressions the-power-operator6796409 +Ref: 20636796409 +Ref: reference/expressions grammar-token-python-grammar-power6796606 +Ref: 20646796606 +Node: Unary arithmetic and bitwise operations6797804 +Ref: reference/expressions unary6797955 +Ref: 20666797955 +Ref: reference/expressions unary-arithmetic-and-bitwise-operations6797955 +Ref: 20676797955 +Ref: reference/expressions grammar-token-python-grammar-u_expr6798117 +Ref: 20656798117 +Node: Binary arithmetic operations6798929 +Ref: reference/expressions binary6799081 +Ref: 20686799081 +Ref: reference/expressions binary-arithmetic-operations6799081 +Ref: 20696799081 +Ref: reference/expressions grammar-token-python-grammar-m_expr6799425 +Ref: 206a6799425 +Ref: reference/expressions grammar-token-python-grammar-a_expr6799724 +Ref: 206b6799724 +Ref: Binary arithmetic operations-Footnote-16803483 +Ref: Binary arithmetic operations-Footnote-26804096 +Node: Shifting operations6804379 +Ref: reference/expressions shifting6804517 +Ref: 206d6804517 +Ref: reference/expressions shifting-operations6804517 +Ref: 206e6804517 +Ref: reference/expressions grammar-token-python-grammar-shift_expr6804647 +Ref: 206f6804647 +Node: Binary bitwise operations6805307 +Ref: reference/expressions binary-bitwise-operations6805428 +Ref: 20706805428 +Ref: reference/expressions bitwise6805428 +Ref: 20716805428 +Ref: reference/expressions grammar-token-python-grammar-and_expr6805563 +Ref: 20726805563 +Ref: reference/expressions grammar-token-python-grammar-xor_expr6805657 +Ref: 20736805657 +Ref: reference/expressions grammar-token-python-grammar-or_expr6805747 +Ref: 1ec36805747 +Node: Comparisons6806470 +Ref: reference/expressions comparisons6806590 +Ref: 20746806590 +Ref: reference/expressions id126806590 +Ref: 20756806590 +Ref: reference/expressions grammar-token-python-grammar-comparison6806885 +Ref: 20766806885 +Ref: reference/expressions grammar-token-python-grammar-comp_operator6806980 +Ref: 20776806980 +Node: Value comparisons6808070 +Ref: reference/expressions expressions-value-comparisons6808170 +Ref: 187b6808170 +Ref: reference/expressions value-comparisons6808170 +Ref: 20786808170 +Ref: reference/expressions in6816026 +Ref: 2ee6816026 +Ref: reference/expressions not-in6816026 +Ref: 62b6816026 +Ref: Value comparisons-Footnote-16816064 +Ref: Value comparisons-Footnote-26816106 +Node: Membership test operations6817215 +Ref: reference/expressions membership-test-details6817344 +Ref: 1f936817344 +Ref: reference/expressions membership-test-operations6817344 +Ref: 20796817344 +Ref: reference/expressions is6819238 +Ref: 2ef6819238 +Node: Identity comparisons6819238 +Ref: reference/expressions identity-comparisons6819341 +Ref: 207a6819341 +Ref: reference/expressions is-not6819341 +Ref: 207b6819341 +Ref: reference/expressions booleans6819687 +Ref: 207c6819687 +Ref: reference/expressions and6819687 +Ref: 2eb6819687 +Ref: reference/expressions or6819687 +Ref: 2f06819687 +Ref: Identity comparisons-Footnote-16819725 +Node: Boolean operations6820027 +Ref: reference/expressions boolean-operations6820147 +Ref: 207d6820147 +Ref: reference/expressions not6820147 +Ref: 207e6820147 +Ref: reference/expressions grammar-token-python-grammar-or_test6820200 +Ref: 202b6820200 +Ref: reference/expressions grammar-token-python-grammar-and_test6820290 +Ref: 207f6820290 +Ref: reference/expressions grammar-token-python-grammar-not_test6820382 +Ref: 20806820382 +Node: Assignment expressions<2>6821850 +Ref: reference/expressions assignment-expressions6821982 +Ref: 20816821982 +Ref: reference/expressions id156821982 +Ref: 20826821982 +Ref: reference/expressions grammar-token-python-grammar-assignment_expression6822043 +Ref: 1fdf6822043 +Ref: Assignment expressions<2>-Footnote-16823120 +Node: Conditional expressions6823162 +Ref: reference/expressions conditional-expressions6823283 +Ref: 20836823283 +Ref: reference/expressions if-expr6823283 +Ref: 20846823283 +Ref: reference/expressions grammar-token-python-grammar-conditional_expression6823346 +Ref: 1ec26823346 +Ref: reference/expressions grammar-token-python-grammar-expression6823458 +Ref: 20376823458 +Ref: reference/expressions lambdas6823940 +Ref: 20866823940 +Ref: Conditional expressions-Footnote-16823978 +Node: Lambdas6824020 +Ref: reference/expressions id166824132 +Ref: 20876824132 +Ref: reference/expressions lambda6824132 +Ref: 128f6824132 +Ref: reference/expressions grammar-token-python-grammar-lambda_expr6824163 +Ref: 20856824163 +Node: Expression lists6824723 +Ref: reference/expressions expression-lists6824828 +Ref: 20896824828 +Ref: reference/expressions exprlists6824828 +Ref: d7d6824828 +Ref: reference/expressions grammar-token-python-grammar-starred_expression6824877 +Ref: 20266824877 +Ref: reference/expressions grammar-token-python-grammar-flexible_expression6824938 +Ref: 208a6824938 +Ref: reference/expressions grammar-token-python-grammar-flexible_expression_list6825041 +Ref: 20306825041 +Ref: reference/expressions grammar-token-python-grammar-starred_expression_list6825154 +Ref: 208b6825154 +Ref: reference/expressions grammar-token-python-grammar-expression_list6825265 +Ref: 208c6825265 +Ref: reference/expressions grammar-token-python-grammar-yield_list6825360 +Ref: 203d6825360 +Ref: Expression lists-Footnote-16826488 +Ref: Expression lists-Footnote-26826530 +Node: Evaluation order6826572 +Ref: reference/expressions evalorder6826689 +Ref: 208d6826689 +Ref: reference/expressions evaluation-order6826689 +Ref: 208e6826689 +Node: Operator precedence6827204 +Ref: reference/expressions operator-precedence6827296 +Ref: 208f6827296 +Ref: reference/expressions operator-summary6827296 +Ref: 20906827296 +Ref: Operator precedence-Footnote-16831814 +Ref: Operator precedence-Footnote-26831963 +Node: Simple statements6832057 +Ref: reference/simple_stmts doc6832188 +Ref: 20916832188 +Ref: reference/simple_stmts simple6832188 +Ref: 20926832188 +Ref: reference/simple_stmts simple-statements6832188 +Ref: 20936832188 +Ref: reference/simple_stmts grammar-token-python-grammar-simple_stmt6832412 +Ref: 20946832412 +Node: Expression statements6833634 +Ref: reference/simple_stmts expression-statements6833739 +Ref: 20a66833739 +Ref: reference/simple_stmts exprstmts6833739 +Ref: 20a76833739 +Ref: reference/simple_stmts grammar-token-python-grammar-expression_stmt6834129 +Ref: 20956834129 +Node: Assignment statements6834569 +Ref: reference/simple_stmts assignment6834703 +Ref: 1fd96834703 +Ref: reference/simple_stmts assignment-statements6834703 +Ref: 20a86834703 +Ref: reference/simple_stmts grammar-token-python-grammar-assignment_stmt6834874 +Ref: 20976834874 +Ref: reference/simple_stmts grammar-token-python-grammar-target_list6834997 +Ref: 202a6834997 +Ref: reference/simple_stmts grammar-token-python-grammar-target6835075 +Ref: 20a96835075 +Ref: reference/simple_stmts attr-target-note6838618 +Ref: 20aa6838618 +Ref: Assignment statements-Footnote-16842682 +Node: Augmented assignment statements6842724 +Ref: reference/simple_stmts augassign6842853 +Ref: 20ab6842853 +Ref: reference/simple_stmts augmented-assignment-statements6842853 +Ref: 20ac6842853 +Ref: reference/simple_stmts grammar-token-python-grammar-augmented_assignment_stmt6843050 +Ref: 20986843050 +Ref: reference/simple_stmts grammar-token-python-grammar-augtarget6843190 +Ref: 20ad6843190 +Ref: reference/simple_stmts grammar-token-python-grammar-augop6843328 +Ref: 20ae6843328 +Node: Annotated assignment statements6845069 +Ref: reference/simple_stmts annassign6845198 +Ref: 20af6845198 +Ref: reference/simple_stmts annotated-assignment-statements6845198 +Ref: 20b06845198 +Ref: reference/simple_stmts grammar-token-python-grammar-annotated_assignment_stmt6845433 +Ref: 20996845433 +Ref: Annotated assignment statements-Footnote-16847599 +Ref: Annotated assignment statements-Footnote-26847641 +Node: The assert statement6847683 +Ref: reference/simple_stmts assert6847814 +Ref: 9686847814 +Ref: reference/simple_stmts the-assert-statement6847814 +Ref: 20b16847814 +Ref: reference/simple_stmts grammar-token-python-grammar-assert_stmt6847964 +Ref: 20966847964 +Node: The pass statement6849079 +Ref: reference/simple_stmts pass6849209 +Ref: 1c1a6849209 +Ref: reference/simple_stmts the-pass-statement6849209 +Ref: 20b26849209 +Ref: reference/simple_stmts grammar-token-python-grammar-pass_stmt6849268 +Ref: 209a6849268 +Node: The del statement<2>6849619 +Ref: reference/simple_stmts del6849749 +Ref: 17a66849749 +Ref: reference/simple_stmts the-del-statement6849749 +Ref: 20b36849749 +Ref: reference/simple_stmts grammar-token-python-grammar-del_stmt6849806 +Ref: 209b6849806 +Node: The return statement6850739 +Ref: reference/simple_stmts return6850870 +Ref: 9ce6850870 +Ref: reference/simple_stmts the-return-statement6850870 +Ref: 20b46850870 +Ref: reference/simple_stmts grammar-token-python-grammar-return_stmt6850933 +Ref: 209c6850933 +Node: The yield statement6852078 +Ref: reference/simple_stmts the-yield-statement6852208 +Ref: 20b56852208 +Ref: reference/simple_stmts yield6852208 +Ref: 9cd6852208 +Ref: reference/simple_stmts grammar-token-python-grammar-yield_stmt6852269 +Ref: 209d6852269 +Node: The raise statement6853136 +Ref: reference/simple_stmts raise6853265 +Ref: 5e96853265 +Ref: reference/simple_stmts the-raise-statement6853265 +Ref: 20b66853265 +Ref: reference/simple_stmts grammar-token-python-grammar-raise_stmt6853326 +Ref: 209e6853326 +Node: The break statement6857559 +Ref: reference/simple_stmts break6857691 +Ref: aa96857691 +Ref: reference/simple_stmts the-break-statement6857691 +Ref: 20b96857691 +Ref: reference/simple_stmts grammar-token-python-grammar-break_stmt6857752 +Ref: 209f6857752 +Node: The continue statement6858346 +Ref: reference/simple_stmts continue6858479 +Ref: 9c96858479 +Ref: reference/simple_stmts the-continue-statement6858479 +Ref: 20ba6858479 +Ref: reference/simple_stmts grammar-token-python-grammar-continue_stmt6858548 +Ref: 20a06858548 +Ref: reference/simple_stmts import6859014 +Ref: 5de6859014 +Node: The import statement6859016 +Ref: reference/simple_stmts from6859150 +Ref: 129e6859150 +Ref: reference/simple_stmts the-import-statement6859150 +Ref: 20bb6859150 +Ref: reference/simple_stmts grammar-token-python-grammar-import_stmt6859215 +Ref: 20a16859215 +Ref: reference/simple_stmts grammar-token-python-grammar-module6859876 +Ref: 20bc6859876 +Ref: reference/simple_stmts grammar-token-python-grammar-relative_module6859956 +Ref: 20bd6859956 +Node: Future statements6865296 +Ref: reference/simple_stmts future6865370 +Ref: 1896865370 +Ref: reference/simple_stmts future-statements6865370 +Ref: 20be6865370 +Ref: reference/simple_stmts grammar-token-python-grammar-future_stmt6865896 +Ref: 20a26865896 +Ref: reference/simple_stmts grammar-token-python-grammar-feature6866276 +Ref: 20bf6866276 +Ref: Future statements-Footnote-16869007 +Ref: Future statements-Footnote-26869049 +Node: The global statement6869091 +Ref: reference/simple_stmts global6869225 +Ref: 18a6869225 +Ref: reference/simple_stmts the-global-statement6869225 +Ref: 20c06869225 +Ref: reference/simple_stmts grammar-token-python-grammar-global_stmt6869290 +Ref: 20a36869290 +Node: The nonlocal statement6870380 +Ref: reference/simple_stmts nonlocal6870512 +Ref: 129a6870512 +Ref: reference/simple_stmts the-nonlocal-statement6870512 +Ref: 20c16870512 +Ref: reference/simple_stmts grammar-token-python-grammar-nonlocal_stmt6870581 +Ref: 20a46870581 +Ref: The nonlocal statement-Footnote-16871793 +Node: The type statement6871835 +Ref: reference/simple_stmts the-type-statement6871938 +Ref: 20c26871938 +Ref: reference/simple_stmts type6871938 +Ref: 4336871938 +Ref: reference/simple_stmts grammar-token-python-grammar-type_stmt6871999 +Ref: 20a56871999 +Ref: The type statement-Footnote-16873329 +Node: Compound statements6873371 +Ref: reference/compound_stmts doc6873511 +Ref: 20c46873511 +Ref: reference/compound_stmts compound6873511 +Ref: 20c56873511 +Ref: reference/compound_stmts compound-statements6873511 +Ref: 20c66873511 +Ref: reference/compound_stmts grammar-token-python-grammar-compound_stmt6875280 +Ref: 20c76875280 +Ref: reference/compound_stmts grammar-token-python-grammar-suite6875816 +Ref: 20d36875816 +Ref: reference/compound_stmts grammar-token-python-grammar-statement6875918 +Ref: 20d56875918 +Ref: reference/compound_stmts grammar-token-python-grammar-stmt_list6876001 +Ref: 20d46876001 +Ref: reference/compound_stmts if6876552 +Ref: 2ed6876552 +Ref: reference/compound_stmts elif6876552 +Ref: 1c0a6876552 +Node: The if statement6876800 +Ref: reference/compound_stmts else6876900 +Ref: 18c6876900 +Ref: reference/compound_stmts the-if-statement6876900 +Ref: 20d66876900 +Ref: reference/compound_stmts grammar-token-python-grammar-if_stmt6877020 +Ref: 20c86877020 +Node: The while statement6877632 +Ref: reference/compound_stmts the-while-statement6877758 +Ref: 20d76877758 +Ref: reference/compound_stmts while6877758 +Ref: 1c046877758 +Ref: reference/compound_stmts grammar-token-python-grammar-while_stmt6877918 +Ref: 20c96877918 +Node: The for statement6878557 +Ref: reference/compound_stmts for6878684 +Ref: 2ec6878684 +Ref: reference/compound_stmts the-for-statement6878684 +Ref: 20d86878684 +Ref: reference/compound_stmts grammar-token-python-grammar-for_stmt6878883 +Ref: 20ca6878883 +Node: The try statement6880676 +Ref: reference/compound_stmts the-try-statement6880802 +Ref: 20d96880802 +Ref: reference/compound_stmts try6880802 +Ref: 6e46880802 +Ref: reference/compound_stmts grammar-token-python-grammar-try_stmt6880960 +Ref: 20cb6880960 +Ref: reference/compound_stmts grammar-token-python-grammar-try1_stmt6881052 +Ref: 20da6881052 +Ref: reference/compound_stmts grammar-token-python-grammar-try2_stmt6881316 +Ref: 20db6881316 +Ref: reference/compound_stmts grammar-token-python-grammar-try3_stmt6881582 +Ref: 20dc6881582 +Node: except clause6881987 +Ref: reference/compound_stmts except6882077 +Ref: 18b6882077 +Ref: reference/compound_stmts except-clause6882077 +Ref: 20dd6882077 +Ref: except clause-Footnote-16885327 +Node: except* clause6885525 +Ref: reference/compound_stmts except-star6885635 +Ref: 5b46885635 +Ref: reference/compound_stmts id26885635 +Ref: 20de6885635 +Node: else clause6888058 +Ref: reference/compound_stmts else-clause6888169 +Ref: 20df6888169 +Ref: reference/compound_stmts except-else6888169 +Ref: 20e06888169 +Node: finally clause6888530 +Ref: reference/compound_stmts finally6888618 +Ref: 9ca6888618 +Ref: reference/compound_stmts finally-clause6888618 +Ref: 20e16888618 +Ref: reference/compound_stmts with6890377 +Ref: 5ce6890377 +Node: The with statement6890377 +Ref: reference/compound_stmts as6890505 +Ref: 20e26890505 +Ref: reference/compound_stmts the-with-statement6890505 +Ref: 20e36890505 +Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt6890874 +Ref: 20cc6890874 +Ref: reference/compound_stmts grammar-token-python-grammar-with_stmt_contents6891015 +Ref: 20e46891015 +Ref: reference/compound_stmts grammar-token-python-grammar-with_item6891096 +Ref: 20e56891096 +Ref: The with statement-Footnote-16894332 +Node: The match statement6894374 +Ref: reference/compound_stmts match6894505 +Ref: 8096894505 +Ref: reference/compound_stmts the-match-statement6894505 +Ref: 20e66894505 +Ref: reference/compound_stmts grammar-token-python-grammar-match_stmt6894650 +Ref: 20cd6894650 +Ref: reference/compound_stmts grammar-token-python-grammar-subject_expr6894757 +Ref: 20e76894757 +Ref: reference/compound_stmts grammar-token-python-grammar-case_block6894870 +Ref: 20e86894870 +Ref: The match statement-Footnote-16895771 +Ref: The match statement-Footnote-26895813 +Node: Overview6895855 +Ref: reference/compound_stmts overview6895934 +Ref: 20eb6895934 +Node: Guards6898406 +Ref: reference/compound_stmts guards6898517 +Ref: 20ed6898517 +Ref: reference/compound_stmts grammar-token-python-grammar-guard6898548 +Ref: 20ea6898548 +Node: Irrefutable Case Blocks6899679 +Ref: reference/compound_stmts irrefutable-case6899790 +Ref: 20ee6899790 +Ref: reference/compound_stmts irrefutable-case-blocks6899790 +Ref: 20ef6899790 +Node: Patterns6900495 +Ref: reference/compound_stmts patterns6900591 +Ref: 20f36900591 +Ref: reference/compound_stmts grammar-token-python-grammar-patterns6900915 +Ref: 20e96900915 +Ref: reference/compound_stmts grammar-token-python-grammar-pattern6900997 +Ref: 20f56900997 +Ref: reference/compound_stmts grammar-token-python-grammar-closed_pattern6901071 +Ref: 20f86901071 +Node: OR Patterns6902091 +Ref: reference/compound_stmts id36902167 +Ref: 21016902167 +Ref: reference/compound_stmts or-patterns6902167 +Ref: 20f16902167 +Ref: reference/compound_stmts grammar-token-python-grammar-or_pattern6902291 +Ref: 20f76902291 +Node: AS Patterns6902858 +Ref: reference/compound_stmts as-patterns6902959 +Ref: 20f06902959 +Ref: reference/compound_stmts id46902959 +Ref: 21026902959 +Ref: reference/compound_stmts grammar-token-python-grammar-as_pattern6903108 +Ref: 20f66903108 +Node: Literal Patterns6903490 +Ref: reference/compound_stmts id56903596 +Ref: 21036903596 +Ref: reference/compound_stmts literal-patterns6903596 +Ref: 21046903596 +Ref: reference/compound_stmts grammar-token-python-grammar-literal_pattern6903727 +Ref: 20f96903727 +Ref: reference/compound_stmts grammar-token-python-grammar-signed_number6904047 +Ref: 21056904047 +Node: Capture Patterns6904718 +Ref: reference/compound_stmts capture-patterns6904830 +Ref: 20f26904830 +Ref: reference/compound_stmts id66904830 +Ref: 21076904830 +Ref: reference/compound_stmts grammar-token-python-grammar-capture_pattern6904944 +Ref: 20fa6904944 +Ref: Capture Patterns-Footnote-16905687 +Node: Wildcard Patterns6905729 +Ref: reference/compound_stmts id76905839 +Ref: 21086905839 +Ref: reference/compound_stmts wildcard-patterns6905839 +Ref: 80a6905839 +Ref: reference/compound_stmts grammar-token-python-grammar-wildcard_pattern6905974 +Ref: 20fb6905974 +Node: Value Patterns6906251 +Ref: reference/compound_stmts id86906359 +Ref: 21096906359 +Ref: reference/compound_stmts value-patterns6906359 +Ref: 210a6906359 +Ref: reference/compound_stmts grammar-token-python-grammar-value_pattern6906470 +Ref: 20fc6906470 +Ref: reference/compound_stmts grammar-token-python-grammar-attr6906511 +Ref: 210b6906511 +Ref: reference/compound_stmts grammar-token-python-grammar-name_or_attr6906569 +Ref: 210c6906569 +Node: Group Patterns6907195 +Ref: reference/compound_stmts group-patterns6907303 +Ref: 210d6907303 +Ref: reference/compound_stmts id96907303 +Ref: 210e6907303 +Ref: reference/compound_stmts grammar-token-python-grammar-group_pattern6907503 +Ref: 20fd6907503 +Node: Sequence Patterns6907615 +Ref: reference/compound_stmts id106907725 +Ref: 210f6907725 +Ref: reference/compound_stmts sequence-patterns6907725 +Ref: 21106907725 +Ref: reference/compound_stmts grammar-token-python-grammar-sequence_pattern6907930 +Ref: 20fe6907930 +Ref: reference/compound_stmts grammar-token-python-grammar-open_sequence_pattern6908087 +Ref: 20f46908087 +Ref: reference/compound_stmts grammar-token-python-grammar-maybe_sequence_pattern6908193 +Ref: 21116908193 +Ref: reference/compound_stmts grammar-token-python-grammar-maybe_star_pattern6908267 +Ref: 21126908267 +Ref: reference/compound_stmts grammar-token-python-grammar-star_pattern6908348 +Ref: 21136908348 +Ref: Sequence Patterns-Footnote-16911365 +Node: Mapping Patterns6912082 +Ref: reference/compound_stmts id126912192 +Ref: 21146912192 +Ref: reference/compound_stmts mapping-patterns6912192 +Ref: 21156912192 +Ref: reference/compound_stmts grammar-token-python-grammar-mapping_pattern6912374 +Ref: 20ff6912374 +Ref: reference/compound_stmts grammar-token-python-grammar-items_pattern6912440 +Ref: 21166912440 +Ref: reference/compound_stmts grammar-token-python-grammar-key_value_pattern6912510 +Ref: 21176912510 +Ref: reference/compound_stmts grammar-token-python-grammar-double_star_pattern6912688 +Ref: 21186912688 +Ref: Mapping Patterns-Footnote-16914295 +Node: Class Patterns6914769 +Ref: reference/compound_stmts class-patterns6914853 +Ref: 21196914853 +Ref: reference/compound_stmts id146914853 +Ref: 211a6914853 +Ref: reference/compound_stmts grammar-token-python-grammar-class_pattern6914998 +Ref: 21006914998 +Ref: reference/compound_stmts grammar-token-python-grammar-pattern_arguments6915099 +Ref: 211b6915099 +Ref: reference/compound_stmts grammar-token-python-grammar-positional_patterns6915258 +Ref: 211c6915258 +Ref: reference/compound_stmts grammar-token-python-grammar-keyword_patterns6915313 +Ref: 211d6915313 +Ref: reference/compound_stmts grammar-token-python-grammar-keyword_pattern6915376 +Ref: 211e6915376 +Ref: reference/compound_stmts function6919421 +Ref: 1c366919421 +Ref: Class Patterns-Footnote-16919457 +Ref: Class Patterns-Footnote-26919499 +Node: Function definitions6919541 +Ref: reference/compound_stmts def6919671 +Ref: 14236919671 +Ref: reference/compound_stmts function-definitions6919671 +Ref: 211f6919671 +Ref: reference/compound_stmts grammar-token-python-grammar-funcdef6919844 +Ref: 20ce6919844 +Ref: reference/compound_stmts grammar-token-python-grammar-decorators6920087 +Ref: 21206920087 +Ref: reference/compound_stmts grammar-token-python-grammar-decorator6920146 +Ref: 21226920146 +Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list6920228 +Ref: 20886920228 +Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_no_posonly6920453 +Ref: 21246920453 +Ref: reference/compound_stmts grammar-token-python-grammar-parameter_list_starargs6920666 +Ref: 21256920666 +Ref: reference/compound_stmts grammar-token-python-grammar-parameter_star_kwargs6921000 +Ref: 21276921000 +Ref: reference/compound_stmts grammar-token-python-grammar-parameter6921069 +Ref: 21286921069 +Ref: reference/compound_stmts grammar-token-python-grammar-star_parameter6921158 +Ref: 21266921158 +Ref: reference/compound_stmts grammar-token-python-grammar-defparameter6921253 +Ref: 21236921253 +Ref: reference/compound_stmts grammar-token-python-grammar-funcname6921341 +Ref: 21216921341 +Ref: Function definitions-Footnote-16928366 +Ref: Function definitions-Footnote-26928567 +Ref: Function definitions-Footnote-36928609 +Ref: Function definitions-Footnote-46928651 +Ref: Function definitions-Footnote-56928693 +Ref: Function definitions-Footnote-66928735 +Ref: Function definitions-Footnote-76928777 +Ref: Function definitions-Footnote-86928819 +Ref: Function definitions-Footnote-96928861 +Ref: Function definitions-Footnote-106928903 +Node: Class definitions6928946 +Ref: reference/compound_stmts class6929070 +Ref: 12ca6929070 +Ref: reference/compound_stmts class-definitions6929070 +Ref: 212a6929070 +Ref: reference/compound_stmts grammar-token-python-grammar-classdef6929218 +Ref: 20cf6929218 +Ref: reference/compound_stmts grammar-token-python-grammar-inheritance6929373 +Ref: 212c6929373 +Ref: reference/compound_stmts grammar-token-python-grammar-classname6929431 +Ref: 212b6929431 +Ref: Class definitions-Footnote-16932745 +Ref: Class definitions-Footnote-26932936 +Ref: Class definitions-Footnote-36932978 +Ref: Class definitions-Footnote-46933020 +Ref: Class definitions-Footnote-56933062 +Node: Coroutines<2>6933104 +Ref: reference/compound_stmts async6933228 +Ref: 72d6933228 +Ref: reference/compound_stmts coroutines6933228 +Ref: 212d6933228 +Node: Coroutine function definition6933387 +Ref: reference/compound_stmts async-def6933498 +Ref: 5cd6933498 +Ref: reference/compound_stmts coroutine-function-definition6933498 +Ref: 212e6933498 +Ref: reference/compound_stmts grammar-token-python-grammar-async_funcdef6933575 +Ref: 20d26933575 +Node: The async for statement6934552 +Ref: reference/compound_stmts async-for6934696 +Ref: aab6934696 +Ref: reference/compound_stmts the-async-for-statement6934696 +Ref: 212f6934696 +Ref: reference/compound_stmts grammar-token-python-grammar-async_for_stmt6934769 +Ref: 20d16934769 +Node: The async with statement6935717 +Ref: reference/compound_stmts async-with6935823 +Ref: 5d16935823 +Ref: reference/compound_stmts the-async-with-statement6935823 +Ref: 21306935823 +Ref: reference/compound_stmts grammar-token-python-grammar-async_with_stmt6935898 +Ref: 20d06935898 +Ref: The async with statement-Footnote-16937042 +Node: Type parameter lists6937084 +Ref: reference/compound_stmts type-parameter-lists6937182 +Ref: 21316937182 +Ref: reference/compound_stmts type-params6937182 +Ref: 2b56937182 +Ref: reference/compound_stmts grammar-token-python-grammar-type_params6937344 +Ref: 20c36937344 +Ref: reference/compound_stmts grammar-token-python-grammar-type_param6937429 +Ref: 21326937429 +Ref: reference/compound_stmts grammar-token-python-grammar-typevar6937525 +Ref: 21336937525 +Ref: reference/compound_stmts grammar-token-python-grammar-typevartuple6937633 +Ref: 21346937633 +Ref: reference/compound_stmts grammar-token-python-grammar-paramspec6937714 +Ref: 21356937714 +Ref: Type parameter lists-Footnote-16942098 +Node: Generic functions6942140 +Ref: reference/compound_stmts generic-functions6942238 +Ref: 44e6942238 +Ref: reference/compound_stmts id176942238 +Ref: 21376942238 +Node: Generic classes6944044 +Ref: reference/compound_stmts generic-classes6944171 +Ref: 44d6944171 +Ref: reference/compound_stmts id186944171 +Ref: 21386944171 +Node: Generic type aliases6945307 +Ref: reference/compound_stmts generic-type-aliases6945408 +Ref: 4516945408 +Ref: reference/compound_stmts id196945408 +Ref: 21396945408 +Node: Top-level components6946212 +Ref: reference/toplevel_components doc6946361 +Ref: 213a6946361 +Ref: reference/toplevel_components top-level6946361 +Ref: 213b6946361 +Ref: reference/toplevel_components top-level-components6946361 +Ref: 213c6946361 +Node: Complete Python programs6946754 +Ref: reference/toplevel_components complete-python-programs6946854 +Ref: 213d6946854 +Ref: reference/toplevel_components programs6946854 +Ref: 1ffe6946854 +Node: File input6948236 +Ref: reference/toplevel_components file-input6948362 +Ref: 213e6948362 +Ref: reference/toplevel_components id16948362 +Ref: 213f6948362 +Ref: reference/toplevel_components grammar-token-python-grammar-file_input6948459 +Ref: 21406948459 +Node: Interactive input6948748 +Ref: reference/toplevel_components interactive6948866 +Ref: 21416948866 +Ref: reference/toplevel_components interactive-input6948866 +Ref: 21426948866 +Ref: reference/toplevel_components grammar-token-python-grammar-interactive_input6948981 +Ref: 21436948981 +Node: Expression input6949240 +Ref: reference/toplevel_components expression-input6949339 +Ref: 21446949339 +Ref: reference/toplevel_components id26949339 +Ref: 21456949339 +Ref: reference/toplevel_components grammar-token-python-grammar-eval_input6949541 +Ref: 21466949541 +Node: Full Grammar specification6949600 +Ref: reference/grammar doc6949721 +Ref: 21066949721 +Ref: reference/grammar full-grammar-specification6949721 +Ref: 21476949721 +Ref: reference/grammar id16949721 +Ref: 21486949721 +Ref: Full Grammar specification-Footnote-17021854 +Ref: Full Grammar specification-Footnote-27021926 +Ref: Full Grammar specification-Footnote-37021998 +Ref: Full Grammar specification-Footnote-47022063 +Node: The Python Standard Library7022105 +Ref: library/index doc7022265 +Ref: 21497022265 +Ref: library/index library-index7022265 +Ref: 1447022265 +Ref: library/index the-python-standard-library7022265 +Ref: 214a7022265 +Ref: The Python Standard Library-Footnote-17025100 +Node: Introduction<6>7025125 +Ref: library/intro doc7025231 +Ref: 214b7025231 +Ref: library/intro introduction7025231 +Ref: 214c7025231 +Ref: library/intro library-intro7025231 +Ref: 214d7025231 +Node: Notes on availability7027915 +Ref: library/intro availability7027988 +Ref: 1d547027988 +Ref: library/intro notes-on-availability7027988 +Ref: 214e7027988 +Node: WebAssembly platforms7028744 +Ref: library/intro wasm-availability7028848 +Ref: 17e07028848 +Ref: library/intro webassembly-platforms7028848 +Ref: 214f7028848 +Ref: library/intro mobile-availability7031332 +Ref: 1e557031332 +Ref: WebAssembly platforms-Footnote-17031369 +Ref: WebAssembly platforms-Footnote-27031402 +Ref: WebAssembly platforms-Footnote-37031434 +Ref: WebAssembly platforms-Footnote-47031460 +Ref: WebAssembly platforms-Footnote-57031492 +Ref: WebAssembly platforms-Footnote-67031518 +Ref: WebAssembly platforms-Footnote-77031548 +Ref: WebAssembly platforms-Footnote-87031577 +Ref: WebAssembly platforms-Footnote-97031607 +Node: Mobile platforms7031667 +Ref: library/intro ios-availability7031771 +Ref: 21507031771 +Ref: library/intro mobile-platforms7031771 +Ref: 21517031771 +Ref: Mobile platforms-Footnote-17034585 +Node: Built-in Functions7034651 +Ref: library/functions doc7034784 +Ref: 21527034784 +Ref: library/functions built-in-funcs7034784 +Ref: 12507034784 +Ref: library/functions built-in-functions7034784 +Ref: 21537034784 +Ref: library/functions abs7038222 +Ref: 1ca47038222 +Ref: library/functions aiter7038477 +Ref: 7d07038477 +Ref: library/functions all7038774 +Ref: 13ed7038774 +Ref: library/functions anext7039087 +Ref: 7d17039087 +Ref: library/functions any7039775 +Ref: 13ec7039775 +Ref: library/functions ascii7040099 +Ref: 13b27040099 +Ref: library/functions bin7040458 +Ref: 129b7040458 +Ref: library/functions bool7041130 +Ref: 4637041130 +Ref: library/functions breakpoint7041763 +Ref: 2367041763 +Ref: library/functions func-bytearray7043007 +Ref: 1ab97043007 +Ref: library/functions func-bytes7044464 +Ref: 1ab87044464 +Ref: library/functions callable7045223 +Ref: 11b87045223 +Ref: library/functions chr7045777 +Ref: 16727045777 +Ref: library/functions classmethod7046233 +Ref: 1667046233 +Ref: library/functions compile7047797 +Ref: 1927047797 +Ref: library/functions complex7051849 +Ref: 2f27051849 +Ref: library/functions grammar-token-float-complexvalue7053439 +Ref: 21667053439 +Ref: library/functions delattr7055037 +Ref: 21547055037 +Ref: library/functions func-dict7055482 +Ref: 21557055482 +Ref: library/functions dir7055938 +Ref: 62e7055938 +Ref: library/functions divmod7058712 +Ref: 9a17058712 +Ref: library/functions enumerate7059353 +Ref: 14487059353 +Ref: library/functions func-eval7060246 +Ref: 216a7060246 +Ref: library/functions eval7060246 +Ref: 1807060246 +Ref: library/functions exec7063438 +Ref: 17f7063438 +Ref: library/functions filter7067064 +Ref: 8617067064 +Ref: library/functions float7067855 +Ref: 2f17067855 +Ref: library/functions grammar-token-float-sign7068816 +Ref: 21687068816 +Ref: library/functions grammar-token-float-infinity7068854 +Ref: 216c7068854 +Ref: library/functions grammar-token-float-nan7068901 +Ref: 216d7068901 +Ref: library/functions grammar-token-float-digit7068935 +Ref: 216e7068935 +Ref: library/functions grammar-token-float-digitpart7069037 +Ref: 216f7069037 +Ref: library/functions grammar-token-float-number7069112 +Ref: 21707069112 +Ref: library/functions grammar-token-float-exponent7069223 +Ref: 21717069223 +Ref: library/functions grammar-token-float-floatnumber7069306 +Ref: 21727069306 +Ref: library/functions grammar-token-float-absfloatvalue7069378 +Ref: 21697069378 +Ref: library/functions grammar-token-float-floatvalue7069474 +Ref: 21677069474 +Ref: library/functions format7070633 +Ref: 61b7070633 +Ref: library/functions func-frozenset7071726 +Ref: 21567071726 +Ref: library/functions getattr7072205 +Ref: bd17072205 +Ref: library/functions globals7073043 +Ref: 18677073043 +Ref: library/functions hasattr7073283 +Ref: 4ce7073283 +Ref: library/functions hash7073622 +Ref: 5e77073622 +Ref: library/functions help7074157 +Ref: 8d67074157 +Ref: library/functions hex7075230 +Ref: 12c27075230 +Ref: library/functions id7076298 +Ref: 13ee7076298 +Ref: library/functions input7076756 +Ref: 12cb7076756 +Ref: library/functions int7077648 +Ref: 2597077648 +Ref: library/functions isinstance7080886 +Ref: 43d7080886 +Ref: library/functions issubclass7081703 +Ref: 7bc7081703 +Ref: library/functions iter7082272 +Ref: 7d27082272 +Ref: library/functions len7083685 +Ref: 62a7083685 +Ref: library/functions func-list7084095 +Ref: 21577084095 +Ref: library/functions locals7084331 +Ref: 1417084331 +Ref: library/functions map7086934 +Ref: 8607086934 +Ref: library/functions max7087469 +Ref: f047087469 +Ref: library/functions func-memoryview7088733 +Ref: 21587088733 +Ref: library/functions min7088896 +Ref: f037088896 +Ref: library/functions next7090151 +Ref: 7d37090151 +Ref: library/functions object7090459 +Ref: a8c7090459 +Ref: library/functions oct7090931 +Ref: 12c17090931 +Ref: library/functions open7091715 +Ref: 5177091715 +Ref: library/functions filemodes7093203 +Ref: 21787093203 +Ref: library/functions open-newline-parameter7098344 +Ref: 73c7098344 +Ref: library/functions ord7103250 +Ref: 1ef27103250 +Ref: library/functions pow7103788 +Ref: 9d27103788 +Ref: library/functions print7105832 +Ref: f707105832 +Ref: library/functions property7106983 +Ref: 1947106983 +Ref: library/functions property getter7108622 +Ref: 165a7108622 +Ref: library/functions property setter7108650 +Ref: 165b7108650 +Ref: library/functions property deleter7108678 +Ref: 165c7108678 +Ref: library/functions property __name__7109888 +Ref: 1937109888 +Ref: library/functions func-range7110070 +Ref: 21597110070 +Ref: library/functions repr7110337 +Ref: 7f97110337 +Ref: library/functions reversed7111350 +Ref: 8627111350 +Ref: library/functions round7111666 +Ref: 12cd7111666 +Ref: library/functions func-set7112993 +Ref: 215a7112993 +Ref: library/functions setattr7113464 +Ref: 215b7113464 +Ref: library/functions slice7114539 +Ref: 4657114539 +Ref: library/functions slice start7115065 +Ref: 1f567115065 +Ref: library/functions slice stop7115092 +Ref: 1f577115092 +Ref: library/functions slice step7115118 +Ref: 1f587115118 +Ref: library/functions sorted7115568 +Ref: bce7115568 +Ref: library/functions staticmethod7117217 +Ref: 4127117217 +Ref: library/functions func-str7118973 +Ref: 215c7118973 +Ref: library/functions sum7119310 +Ref: 4667119310 +Ref: library/functions super7120174 +Ref: 4d77120174 +Ref: library/functions func-tuple7124434 +Ref: 215d7124434 +Ref: library/functions type7124677 +Ref: d487124677 +Ref: library/functions vars7126459 +Ref: 1a417126459 +Ref: library/functions zip7127419 +Ref: 7cb7127419 +Ref: library/functions import__7131296 +Ref: 8d37131296 +Ref: Built-in Functions-Footnote-17134655 +Ref: Built-in Functions-Footnote-27134861 +Ref: Built-in Functions-Footnote-37134903 +Ref: Built-in Functions-Footnote-47134945 +Ref: Built-in Functions-Footnote-57134987 +Ref: Built-in Functions-Footnote-67135029 +Ref: Built-in Functions-Footnote-77135106 +Ref: Built-in Functions-Footnote-87135154 +Ref: Built-in Functions-Footnote-97135196 +Node: Built-in Constants7135238 +Ref: library/constants doc7135370 +Ref: 21827135370 +Ref: library/constants built-in-constants7135370 +Ref: 21837135370 +Ref: library/constants built-in-consts7135370 +Ref: 21847135370 +Ref: library/constants False7135489 +Ref: b377135489 +Ref: library/constants True7135639 +Ref: c0d7135639 +Ref: library/constants None7135786 +Ref: 6717135786 +Ref: library/constants NotImplemented7136084 +Ref: 7cd7136084 +Ref: library/constants Ellipsis7137837 +Ref: 21857137837 +Ref: library/constants debug__7138119 +Ref: 7d57138119 +Node: Constants added by the site module7138588 +Ref: library/constants constants-added-by-the-site-module7138677 +Ref: 21867138677 +Ref: library/constants site-consts7138677 +Ref: 21877138677 +Ref: library/constants quit7139046 +Ref: 21887139046 +Ref: library/constants exit7139073 +Ref: 21897139073 +Ref: library/constants copyright7139503 +Ref: 218a7139503 +Ref: library/constants credits7139523 +Ref: 218b7139523 +Ref: library/constants license7139644 +Ref: 218c7139644 +Node: Built-in Types7139871 +Ref: library/stdtypes doc7140004 +Ref: 218d7140004 +Ref: library/stdtypes bltin-types7140004 +Ref: 218e7140004 +Ref: library/stdtypes built-in-types7140004 +Ref: 218f7140004 +Node: Truth Value Testing7141595 +Ref: library/stdtypes truth7141707 +Ref: 15487141707 +Ref: library/stdtypes truth-value-testing7141707 +Ref: 21907141707 +Ref: Truth Value Testing-Footnote-17142782 +Node: Boolean Operations — and or not7142918 +Ref: library/stdtypes boolean7143053 +Ref: 21917143053 +Ref: library/stdtypes boolean-operations-and-or-not7143053 +Ref: 21927143053 +Node: Comparisons<2>7144382 +Ref: library/stdtypes comparisons7144533 +Ref: 21937144533 +Ref: library/stdtypes stdcomparisons7144533 +Ref: 21947144533 +Node: Numeric Types — int float complex7146981 +Ref: library/stdtypes numeric-types-int-float-complex7147118 +Ref: 21957147118 +Ref: library/stdtypes typesnumeric7147118 +Ref: 1bf77147118 +Ref: Numeric Types — int float complex-Footnote-17155308 +Ref: Numeric Types — int float complex-Footnote-27155423 +Node: Bitwise Operations on Integer Types7155500 +Ref: library/stdtypes bitstring-ops7155651 +Ref: 21977155651 +Ref: library/stdtypes bitwise-operations-on-integer-types7155651 +Ref: 21987155651 +Node: Additional Methods on Integer Types7158005 +Ref: library/stdtypes additional-methods-on-integer-types7158192 +Ref: 21997158192 +Ref: library/stdtypes int bit_length7158419 +Ref: 219a7158419 +Ref: library/stdtypes int bit_count7159336 +Ref: 7c77159336 +Ref: library/stdtypes int to_bytes7159800 +Ref: 188f7159800 +Ref: library/stdtypes int from_bytes7161972 +Ref: 184f7161972 +Ref: library/stdtypes int as_integer_ratio7163903 +Ref: 9cb7163903 +Ref: library/stdtypes int is_integer7164210 +Ref: 177a7164210 +Node: Additional Methods on Float7164374 +Ref: library/stdtypes additional-methods-on-float7164550 +Ref: 219d7164550 +Ref: library/stdtypes float as_integer_ratio7164763 +Ref: 1d127164763 +Ref: library/stdtypes float is_integer7165049 +Ref: 219c7165049 +Ref: library/stdtypes float hex7165676 +Ref: 1d137165676 +Ref: library/stdtypes float fromhex7165926 +Ref: 219e7165926 +Node: Hashing of numeric types7167566 +Ref: library/stdtypes hashing-of-numeric-types7167698 +Ref: 219f7167698 +Ref: library/stdtypes numeric-hash7167698 +Ref: 21a07167698 +Ref: library/stdtypes bltin-boolean-values7171879 +Ref: 21a27171879 +Node: Boolean Type - bool7171880 +Ref: library/stdtypes boolean-type-bool7172017 +Ref: 21a37172017 +Ref: library/stdtypes typebool7172017 +Ref: 215e7172017 +Node: Iterator Types7173209 +Ref: library/stdtypes iterator-types7173346 +Ref: 21a47173346 +Ref: library/stdtypes typeiter7173346 +Ref: 21757173346 +Ref: library/stdtypes container __iter__7173740 +Ref: 1cc17173740 +Ref: library/stdtypes iterator __iter__7174487 +Ref: 1cc47174487 +Ref: library/stdtypes iterator __next__7174838 +Ref: 12c07174838 +Node: Generator Types7175620 +Ref: library/stdtypes generator-types7175686 +Ref: 21a57175686 +Ref: library/stdtypes id37175686 +Ref: 21a67175686 +Node: Sequence Types — list tuple range7176185 +Ref: library/stdtypes sequence-types-list-tuple-range7176329 +Ref: 21a77176329 +Ref: library/stdtypes typesseq7176329 +Ref: 1c497176329 +Node: Common Sequence Operations7176796 +Ref: library/stdtypes common-sequence-operations7176927 +Ref: 21a87176927 +Ref: library/stdtypes typesseq-common7176927 +Ref: 21a97176927 +Ref: Common Sequence Operations-Footnote-17185759 +Node: Immutable Sequence Types7185838 +Ref: library/stdtypes immutable-sequence-types7186000 +Ref: 21ad7186000 +Ref: library/stdtypes typesseq-immutable7186000 +Ref: 21ae7186000 +Node: Mutable Sequence Types7186533 +Ref: library/stdtypes mutable-sequence-types7186677 +Ref: 21af7186677 +Ref: library/stdtypes typesseq-mutable7186677 +Ref: 215f7186677 +Node: Lists<2>7192678 +Ref: library/stdtypes lists7192804 +Ref: 21b07192804 +Ref: library/stdtypes typesseq-list7192804 +Ref: 21767192804 +Ref: library/stdtypes list7192987 +Ref: 60d7192987 +Ref: library/stdtypes list sort7194174 +Ref: bcf7194174 +Node: Tuples7196496 +Ref: library/stdtypes tuples7196606 +Ref: 21b17196606 +Ref: library/stdtypes typesseq-tuple7196606 +Ref: 20ec7196606 +Ref: library/stdtypes tuple7196970 +Ref: 36b7196970 +Node: Ranges7198525 +Ref: library/stdtypes ranges7198618 +Ref: 21b27198618 +Ref: library/stdtypes typesseq-range7198618 +Ref: 217c7198618 +Ref: library/stdtypes range7198807 +Ref: 9437198807 +Ref: library/stdtypes range start7200791 +Ref: 21b37200791 +Ref: library/stdtypes range stop7200921 +Ref: 21b47200921 +Ref: library/stdtypes range step7200992 +Ref: 21b57200992 +Ref: Ranges-Footnote-17202985 +Node: Text Sequence Type — str7203071 +Ref: library/stdtypes text-sequence-type-str7203253 +Ref: 21b67203253 +Ref: library/stdtypes textseq7203253 +Ref: 1bfc7203253 +Ref: library/stdtypes str7204930 +Ref: 4477204930 +Node: String Methods<2>7207137 +Ref: library/stdtypes id57207261 +Ref: 21b87207261 +Ref: library/stdtypes string-methods7207261 +Ref: 1bfd7207261 +Ref: library/stdtypes str capitalize7208103 +Ref: 21bb7208103 +Ref: library/stdtypes str casefold7208469 +Ref: dd57208469 +Ref: library/stdtypes str center7209117 +Ref: 1c7c7209117 +Ref: library/stdtypes str count7209575 +Ref: 16447209575 +Ref: library/stdtypes str encode7210262 +Ref: 8d47210262 +Ref: library/stdtypes str endswith7211514 +Ref: ec57211514 +Ref: library/stdtypes str expandtabs7212297 +Ref: 21bc7212297 +Ref: library/stdtypes str find7213526 +Ref: ea17213526 +Ref: library/stdtypes str format7214075 +Ref: 61d7214075 +Ref: library/stdtypes str format_map7215588 +Ref: dd67215588 +Ref: library/stdtypes str index7216104 +Ref: 16457216104 +Ref: library/stdtypes str isalnum7216250 +Ref: 21bd7216250 +Ref: library/stdtypes str isalpha7216590 +Ref: 21be7216590 +Ref: library/stdtypes str isascii7217144 +Ref: af17217144 +Ref: library/stdtypes str isdecimal7217386 +Ref: 21bf7217386 +Ref: library/stdtypes str isdigit7217774 +Ref: 21c07217774 +Ref: library/stdtypes str isidentifier7218282 +Ref: 195a7218282 +Ref: library/stdtypes str islower7218848 +Ref: 21c27218848 +Ref: library/stdtypes str isnumeric7219032 +Ref: 21c37219032 +Ref: library/stdtypes str isprintable7219512 +Ref: dd77219512 +Ref: library/stdtypes str isspace7220367 +Ref: 21c47220367 +Ref: library/stdtypes str istitle7220789 +Ref: 21c57220789 +Ref: library/stdtypes str isupper7221070 +Ref: 21c67221070 +Ref: library/stdtypes meth-str-join7221445 +Ref: 21c77221445 +Ref: library/stdtypes str join7221445 +Ref: 21ab7221445 +Ref: library/stdtypes str ljust7221773 +Ref: 1c7b7221773 +Ref: library/stdtypes str lower7222060 +Ref: 17ec7222060 +Ref: library/stdtypes str lstrip7222305 +Ref: 14797222305 +Ref: library/stdtypes str maketrans7223119 +Ref: dd87223119 +Ref: library/stdtypes str partition7223848 +Ref: ea47223848 +Ref: library/stdtypes str removeprefix7224187 +Ref: 8ce7224187 +Ref: library/stdtypes str removesuffix7224544 +Ref: 8cf7224544 +Ref: library/stdtypes str replace7224932 +Ref: 19a7224932 +Ref: library/stdtypes str rfind7225318 +Ref: ea27225318 +Ref: library/stdtypes str rindex7225615 +Ref: 124b7225615 +Ref: library/stdtypes str rjust7225770 +Ref: 1c7a7225770 +Ref: library/stdtypes str rpartition7226058 +Ref: 124c7226058 +Ref: library/stdtypes str rsplit7226397 +Ref: 12497226397 +Ref: library/stdtypes str rstrip7226847 +Ref: 147a7226847 +Ref: library/stdtypes str split7227642 +Ref: ea37227642 +Ref: library/stdtypes str splitlines7229699 +Ref: 124a7229699 +Ref: library/stdtypes str startswith7232349 +Ref: ec47232349 +Ref: library/stdtypes str strip7232686 +Ref: 14787232686 +Ref: library/stdtypes str swapcase7233694 +Ref: 21c97233694 +Ref: library/stdtypes str title7233911 +Ref: 21ca7233911 +Ref: library/stdtypes str translate7235097 +Ref: 21c87235097 +Ref: library/stdtypes str upper7236003 +Ref: 21cd7236003 +Ref: library/stdtypes str zfill7236494 +Ref: 147b7236494 +Ref: String Methods<2>-Footnote-17237015 +Ref: String Methods<2>-Footnote-27237079 +Ref: String Methods<2>-Footnote-37237143 +Ref: String Methods<2>-Footnote-47237315 +Ref: String Methods<2>-Footnote-57237487 +Ref: String Methods<2>-Footnote-67237659 +Ref: String Methods<2>-Footnote-77237723 +Ref: String Methods<2>-Footnote-87237895 +Node: Formatted String Literals f-strings7237959 +Ref: library/stdtypes formatted-string-literals-f-strings7238122 +Ref: 21ce7238122 +Node: printf-style String Formatting7241836 +Ref: library/stdtypes old-string-formatting7241973 +Ref: 6c87241973 +Ref: library/stdtypes printf-style-string-formatting7241973 +Ref: 21cf7241973 +Ref: printf-style String Formatting-Footnote-17251297 +Ref: printf-style String Formatting-Footnote-27251424 +Node: Binary Sequence Types — bytes bytearray memoryview7251466 +Ref: library/stdtypes binary-sequence-types-bytes-bytearray-memoryview7251640 +Ref: 21d17251640 +Ref: library/stdtypes binaryseq7251640 +Ref: 21617251640 +Node: Bytes Objects7252331 +Ref: library/stdtypes bytes-objects7252459 +Ref: 21d27252459 +Ref: library/stdtypes typebytes7252459 +Ref: 21637252459 +Ref: library/stdtypes bytes7252799 +Ref: 1c27252799 +Ref: library/stdtypes bytes fromhex7255053 +Ref: aef7255053 +Ref: library/stdtypes bytes hex7255660 +Ref: d687255660 +Node: Bytearray Objects7257303 +Ref: library/stdtypes bytearray-objects7257470 +Ref: 21d37257470 +Ref: library/stdtypes typebytearray7257470 +Ref: 21627257470 +Ref: library/stdtypes bytearray7257610 +Ref: 53a7257610 +Ref: library/stdtypes bytearray fromhex7258648 +Ref: af07258648 +Ref: library/stdtypes bytearray hex7259284 +Ref: d697259284 +Node: Bytes and Bytearray Operations7260337 +Ref: library/stdtypes bytes-and-bytearray-operations7260520 +Ref: 21d47260520 +Ref: library/stdtypes bytes-methods7260520 +Ref: 21607260520 +Ref: library/stdtypes bytes count7261738 +Ref: 21d57261738 +Ref: library/stdtypes bytearray count7261784 +Ref: 21d67261784 +Ref: library/stdtypes bytes removeprefix7262381 +Ref: 21d77262381 +Ref: library/stdtypes bytearray removeprefix7262424 +Ref: 21d87262424 +Ref: library/stdtypes bytes removesuffix7263029 +Ref: 21d97263029 +Ref: library/stdtypes bytearray removesuffix7263072 +Ref: 21da7263072 +Ref: library/stdtypes bytes decode7263708 +Ref: 8d57263708 +Ref: library/stdtypes bytearray decode7263769 +Ref: 21db7263769 +Ref: library/stdtypes bytes endswith7265009 +Ref: 21dc7265009 +Ref: library/stdtypes bytearray endswith7265061 +Ref: 21dd7265061 +Ref: library/stdtypes bytes find7265488 +Ref: 183d7265488 +Ref: library/stdtypes bytearray find7265533 +Ref: 21de7265533 +Ref: library/stdtypes bytes index7266339 +Ref: 21df7266339 +Ref: library/stdtypes bytearray index7266385 +Ref: 21e07266385 +Ref: library/stdtypes bytes join7266759 +Ref: 21ac7266759 +Ref: library/stdtypes bytearray join7266793 +Ref: 21e17266793 +Ref: library/stdtypes bytes maketrans7267229 +Ref: 12687267229 +Ref: library/stdtypes bytearray maketrans7267275 +Ref: 12697267275 +Ref: library/stdtypes bytes partition7267643 +Ref: 21e37267643 +Ref: library/stdtypes bytearray partition7267677 +Ref: 21e47267677 +Ref: library/stdtypes bytes replace7268164 +Ref: 21e57268164 +Ref: library/stdtypes bytearray replace7268210 +Ref: 21e67268210 +Ref: library/stdtypes bytes rfind7268730 +Ref: 183e7268730 +Ref: library/stdtypes bytearray rfind7268776 +Ref: 21e77268776 +Ref: library/stdtypes bytes rindex7269306 +Ref: 21e87269306 +Ref: library/stdtypes bytearray rindex7269353 +Ref: 21e97269353 +Ref: library/stdtypes bytes rpartition7269736 +Ref: 21ea7269736 +Ref: library/stdtypes bytearray rpartition7269771 +Ref: 21eb7269771 +Ref: library/stdtypes bytes startswith7270258 +Ref: 21ec7270258 +Ref: library/stdtypes bytearray startswith7270312 +Ref: 21ed7270312 +Ref: library/stdtypes bytes translate7270748 +Ref: 21e27270748 +Ref: library/stdtypes bytearray translate7270799 +Ref: 12ee7270799 +Ref: library/stdtypes bytes center7271821 +Ref: 21ee7271821 +Ref: library/stdtypes bytearray center7271866 +Ref: 21ef7271866 +Ref: library/stdtypes bytes ljust7272367 +Ref: 21f07272367 +Ref: library/stdtypes bytearray ljust7272411 +Ref: 21f17272411 +Ref: library/stdtypes bytes lstrip7272917 +Ref: 21f27272917 +Ref: library/stdtypes bytearray lstrip7272952 +Ref: 21f37272952 +Ref: library/stdtypes bytes rjust7274151 +Ref: 21f47274151 +Ref: library/stdtypes bytearray rjust7274195 +Ref: 21f57274195 +Ref: library/stdtypes bytes rsplit7274702 +Ref: 21f67274702 +Ref: library/stdtypes bytearray rsplit7274751 +Ref: 21f77274751 +Ref: library/stdtypes bytes rstrip7275265 +Ref: 21f97275265 +Ref: library/stdtypes bytearray rstrip7275300 +Ref: 21fa7275300 +Ref: library/stdtypes bytes split7276480 +Ref: 21fb7276480 +Ref: library/stdtypes bytearray split7276528 +Ref: 21f87276528 +Ref: library/stdtypes bytes strip7278461 +Ref: 21fc7278461 +Ref: library/stdtypes bytearray strip7278495 +Ref: 21fd7278495 +Ref: library/stdtypes bytes capitalize7279682 +Ref: 21fe7279682 +Ref: library/stdtypes bytearray capitalize7279714 +Ref: 21ff7279714 +Ref: library/stdtypes bytes expandtabs7280123 +Ref: 22007280123 +Ref: library/stdtypes bytearray expandtabs7280164 +Ref: 22017280164 +Ref: library/stdtypes bytes isalnum7281506 +Ref: 22027281506 +Ref: library/stdtypes bytearray isalnum7281535 +Ref: 22037281535 +Ref: library/stdtypes bytes isalpha7282097 +Ref: 22047282097 +Ref: library/stdtypes bytearray isalpha7282126 +Ref: 22057282126 +Ref: library/stdtypes bytes isascii7282563 +Ref: 22067282563 +Ref: library/stdtypes bytearray isascii7282592 +Ref: 22077282592 +Ref: library/stdtypes bytes isdigit7282809 +Ref: 22087282809 +Ref: library/stdtypes bytearray isdigit7282838 +Ref: 22097282838 +Ref: library/stdtypes bytes islower7283210 +Ref: 220a7283210 +Ref: library/stdtypes bytearray islower7283239 +Ref: 220b7283239 +Ref: library/stdtypes bytes isspace7283777 +Ref: 220c7283777 +Ref: library/stdtypes bytearray isspace7283806 +Ref: 220d7283806 +Ref: library/stdtypes bytes istitle7284138 +Ref: 220e7284138 +Ref: library/stdtypes bytearray istitle7284167 +Ref: 220f7284167 +Ref: library/stdtypes bytes isupper7284540 +Ref: 22117284540 +Ref: library/stdtypes bytearray isupper7284569 +Ref: 22127284569 +Ref: library/stdtypes bytes lower7285123 +Ref: 22137285123 +Ref: library/stdtypes bytearray lower7285150 +Ref: 22147285150 +Ref: library/stdtypes bytes splitlines7285789 +Ref: 22157285789 +Ref: library/stdtypes bytearray splitlines7285835 +Ref: 22167285835 +Ref: library/stdtypes bytes swapcase7286784 +Ref: 22177286784 +Ref: library/stdtypes bytearray swapcase7286814 +Ref: 22187286814 +Ref: library/stdtypes bytes title7287744 +Ref: 22107287744 +Ref: library/stdtypes bytearray title7287771 +Ref: 22197287771 +Ref: library/stdtypes bytes upper7289396 +Ref: 221a7289396 +Ref: library/stdtypes bytearray upper7289423 +Ref: 221b7289423 +Ref: library/stdtypes bytes zfill7290062 +Ref: 221c7290062 +Ref: library/stdtypes bytearray zfill7290094 +Ref: 221d7290094 +Node: printf-style Bytes Formatting7290804 +Ref: library/stdtypes bytes-formatting7290982 +Ref: d807290982 +Ref: library/stdtypes printf-style-bytes-formatting7290982 +Ref: 221e7290982 +Ref: printf-style Bytes Formatting-Footnote-17300477 +Ref: printf-style Bytes Formatting-Footnote-27300604 +Ref: printf-style Bytes Formatting-Footnote-37300646 +Node: Memory Views7300688 +Ref: library/stdtypes memory-views7300827 +Ref: 221f7300827 +Ref: library/stdtypes typememoryview7300827 +Ref: 21777300827 +Ref: library/stdtypes memoryview7301024 +Ref: 4647301024 +Ref: library/stdtypes memoryview __eq__7304851 +Ref: 22237304851 +Ref: library/stdtypes memoryview tobytes7306853 +Ref: 22247306853 +Ref: library/stdtypes memoryview hex7307957 +Ref: d6a7307957 +Ref: library/stdtypes memoryview tolist7308480 +Ref: 22207308480 +Ref: library/stdtypes memoryview toreadonly7309042 +Ref: 22257309042 +Ref: library/stdtypes memoryview release7309656 +Ref: 11b07309656 +Ref: library/stdtypes memoryview cast7311025 +Ref: 22267311025 +Ref: library/stdtypes memoryview obj7314086 +Ref: 22287314086 +Ref: library/stdtypes memoryview nbytes7314326 +Ref: 22297314326 +Ref: library/stdtypes memoryview readonly7315454 +Ref: 222a7315454 +Ref: library/stdtypes memoryview format7315546 +Ref: 22227315546 +Ref: library/stdtypes memoryview itemsize7316084 +Ref: 22217316084 +Ref: library/stdtypes memoryview ndim7316460 +Ref: 222b7316460 +Ref: library/stdtypes memoryview shape7316601 +Ref: 222c7316601 +Ref: library/stdtypes memoryview strides7316856 +Ref: 222d7316856 +Ref: library/stdtypes memoryview suboffsets7317146 +Ref: 222e7317146 +Ref: library/stdtypes memoryview c_contiguous7317271 +Ref: 222f7317271 +Ref: library/stdtypes memoryview f_contiguous7317425 +Ref: 22307317425 +Ref: library/stdtypes memoryview contiguous7317585 +Ref: 22317317585 +Ref: Memory Views-Footnote-17317771 +Node: Set Types — set frozenset7317813 +Ref: library/stdtypes set-types-set-frozenset7317983 +Ref: 22327317983 +Ref: library/stdtypes types-set7317983 +Ref: 21737317983 +Ref: library/stdtypes set7319533 +Ref: 5d57319533 +Ref: library/stdtypes frozenset7319561 +Ref: 5d67319561 +Ref: library/stdtypes frozenset isdisjoint7320597 +Ref: 22337320597 +Ref: library/stdtypes frozenset issubset7320805 +Ref: 22347320805 +Ref: library/stdtypes frozenset issuperset7321084 +Ref: 22357321084 +Ref: library/stdtypes frozenset union7321367 +Ref: 144a7321367 +Ref: library/stdtypes frozenset intersection7321508 +Ref: 144b7321508 +Ref: library/stdtypes frozenset difference7321671 +Ref: 22367321671 +Ref: library/stdtypes frozenset symmetric_difference7321837 +Ref: 22377321837 +Ref: library/stdtypes frozenset copy7322009 +Ref: 22387322009 +Ref: library/stdtypes frozenset update7324245 +Ref: 22397324245 +Ref: library/stdtypes frozenset intersection_update7324377 +Ref: 144c7324377 +Ref: library/stdtypes frozenset difference_update7324549 +Ref: 223a7324549 +Ref: library/stdtypes frozenset symmetric_difference_update7324694 +Ref: 144d7324694 +Ref: library/stdtypes frozenset add7324876 +Ref: 223b7324876 +Ref: library/stdtypes frozenset remove7324947 +Ref: 223c7324947 +Ref: library/stdtypes frozenset discard7325104 +Ref: 223d7325104 +Ref: library/stdtypes frozenset pop7325201 +Ref: 223e7325201 +Ref: library/stdtypes frozenset clear7325350 +Ref: 223f7325350 +Node: Mapping Types — dict7325911 +Ref: library/stdtypes mapping-types-dict7326050 +Ref: 22407326050 +Ref: library/stdtypes typesmapping7326050 +Ref: ac67326050 +Ref: library/stdtypes dict7326835 +Ref: 2587326835 +Ref: library/stdtypes dict clear7332465 +Ref: 22417332465 +Ref: library/stdtypes dict copy7332541 +Ref: bd07332541 +Ref: library/stdtypes dict fromkeys7332619 +Ref: 15517332619 +Ref: library/stdtypes dict get7333167 +Ref: 22427333167 +Ref: library/stdtypes dict items7333428 +Ref: 7ca7333428 +Ref: library/stdtypes dict keys7333602 +Ref: 7c87333602 +Ref: library/stdtypes dict pop7333747 +Ref: 33e7333747 +Ref: library/stdtypes dict popitem7334000 +Ref: 14f17334000 +Ref: library/stdtypes dict setdefault7334775 +Ref: 10727334775 +Ref: library/stdtypes dict update7335011 +Ref: 142e7335011 +Ref: library/stdtypes dict values7335624 +Ref: 7c97335624 +Node: Dictionary view objects7337317 +Ref: library/stdtypes dict-views7337399 +Ref: 22437337399 +Ref: library/stdtypes dictionary-view-objects7337399 +Ref: 22447337399 +Node: Context Manager Types7340994 +Ref: library/stdtypes context-manager-types7341151 +Ref: 22467341151 +Ref: library/stdtypes typecontextmanager7341151 +Ref: 1fbf7341151 +Ref: library/stdtypes contextmanager __enter__7341516 +Ref: 22477341516 +Ref: library/stdtypes contextmanager __exit__7342516 +Ref: 22487342516 +Node: Type Annotation Types — Generic Alias Union7344908 +Ref: library/stdtypes type-annotation-types-generic-alias-union7345063 +Ref: 22497345063 +Node: Generic Alias Type7345328 +Ref: library/stdtypes generic-alias-type7345447 +Ref: 224a7345447 +Ref: library/stdtypes types-genericalias7345447 +Ref: 6ae7345447 +Node: Standard Generic Classes7350252 +Ref: library/stdtypes standard-generic-classes7350382 +Ref: 224c7350382 +Node: Special Attributes of GenericAlias objects7352772 +Ref: library/stdtypes special-attributes-of-genericalias-objects7352902 +Ref: 225a7352902 +Ref: library/stdtypes genericalias __origin__7353083 +Ref: 225b7353083 +Ref: library/stdtypes genericalias __args__7353252 +Ref: 224b7353252 +Ref: library/stdtypes genericalias __parameters__7353543 +Ref: 225c7353543 +Ref: library/stdtypes genericalias __unpacked__7354100 +Ref: 225d7354100 +Ref: Special Attributes of GenericAlias objects-Footnote-17354918 +Ref: Special Attributes of GenericAlias objects-Footnote-27354960 +Node: Union Type7355002 +Ref: library/stdtypes types-union7355121 +Ref: 7bd7355121 +Ref: library/stdtypes union-type7355121 +Ref: 225e7355121 +Ref: Union Type-Footnote-17358543 +Node: Other Built-in Types7358585 +Ref: library/stdtypes other-built-in-types7358737 +Ref: 225f7358737 +Ref: library/stdtypes typesother7358737 +Ref: 22607358737 +Node: Modules<4>7359123 +Ref: library/stdtypes modules7359226 +Ref: 22617359226 +Ref: library/stdtypes typesmodules7359226 +Ref: 22627359226 +Node: Classes and Class Instances7360379 +Ref: library/stdtypes classes-and-class-instances7360500 +Ref: 22637360500 +Ref: library/stdtypes typesobjects7360500 +Ref: 22647360500 +Node: Functions7360665 +Ref: library/stdtypes functions7360783 +Ref: 22657360783 +Ref: library/stdtypes typesfunctions7360783 +Ref: 22667360783 +Node: Methods7361247 +Ref: library/stdtypes methods7361350 +Ref: 22677361350 +Ref: library/stdtypes typesmethods7361350 +Ref: 22687361350 +Node: Code Objects7363179 +Ref: library/stdtypes bltin-code-objects7363285 +Ref: 22697363285 +Ref: library/stdtypes code-objects7363285 +Ref: 226a7363285 +Node: Type Objects7364139 +Ref: library/stdtypes bltin-type-objects7364253 +Ref: 21817364253 +Ref: library/stdtypes type-objects7364253 +Ref: 226b7364253 +Node: The Null Object7364604 +Ref: library/stdtypes bltin-null-object7364725 +Ref: 226c7364725 +Ref: library/stdtypes the-null-object7364725 +Ref: 226d7364725 +Node: The Ellipsis Object7365040 +Ref: library/stdtypes bltin-ellipsis-object7365174 +Ref: 226e7365174 +Ref: library/stdtypes the-ellipsis-object7365174 +Ref: 226f7365174 +Node: The NotImplemented Object7365542 +Ref: library/stdtypes bltin-notimplemented-object7365677 +Ref: 22707365677 +Ref: library/stdtypes the-notimplemented-object7365677 +Ref: 22717365677 +Node: Internal Objects7366086 +Ref: library/stdtypes internal-objects7366193 +Ref: 22727366193 +Ref: library/stdtypes typesinternal7366193 +Ref: 22737366193 +Node: Special Attributes7366411 +Ref: library/stdtypes special-attributes7366561 +Ref: 22747366561 +Ref: library/stdtypes specialattrs7366561 +Ref: 22757366561 +Ref: library/stdtypes definition __name__7366800 +Ref: 105f7366800 +Ref: library/stdtypes definition __qualname__7366923 +Ref: 105e7366923 +Ref: library/stdtypes definition __module__7367101 +Ref: 22767367101 +Ref: library/stdtypes definition __doc__7367210 +Ref: 9277367210 +Ref: library/stdtypes definition __type_params__7367333 +Ref: 21367367333 +Node: Integer string conversion length limitation7367591 +Ref: library/stdtypes int-max-str-digits7367712 +Ref: 5f17367712 +Ref: library/stdtypes integer-string-conversion-length-limitation7367712 +Ref: 22777367712 +Ref: Integer string conversion length limitation-Footnote-17370449 +Node: Affected APIs7370505 +Ref: library/stdtypes affected-apis7370628 +Ref: 22787370628 +Node: Configuring the limit7371558 +Ref: library/stdtypes configuring-the-limit7371715 +Ref: 22797371715 +Node: Recommended configuration7374184 +Ref: library/stdtypes recommended-configuration7374319 +Ref: 227c7374319 +Node: Built-in Exceptions7375189 +Ref: library/exceptions doc7375328 +Ref: 227d7375328 +Ref: library/exceptions bltin-exceptions7375328 +Ref: 18837375328 +Ref: library/exceptions built-in-exceptions7375328 +Ref: 227e7375328 +Node: Exception context7377060 +Ref: library/exceptions exception-context7377177 +Ref: 227f7377177 +Ref: library/exceptions BaseException __context__7377338 +Ref: 12ba7377338 +Ref: library/exceptions BaseException __cause__7377379 +Ref: 12bb7377379 +Ref: library/exceptions BaseException __suppress_context__7377418 +Ref: 20b87377418 +Node: Inheriting from built-in exceptions7379111 +Ref: library/exceptions inheriting-from-built-in-exceptions7379249 +Ref: 22807379249 +Ref: Inheriting from built-in exceptions-Footnote-17380131 +Node: Base classes7380204 +Ref: library/exceptions base-classes7380344 +Ref: 22817380344 +Ref: library/exceptions BaseException7380463 +Ref: 5b77380463 +Ref: library/exceptions BaseException args7380848 +Ref: 5697380848 +Ref: library/exceptions BaseException with_traceback7381216 +Ref: 20b77381216 +Ref: library/exceptions BaseException __traceback__7382116 +Ref: 12b97382116 +Ref: library/exceptions BaseException add_note7382318 +Ref: 5b67382318 +Ref: library/exceptions BaseException __notes__7382603 +Ref: 22827382603 +Ref: library/exceptions Exception7382849 +Ref: 9d97382849 +Ref: library/exceptions ArithmeticError7383033 +Ref: 22837383033 +Ref: library/exceptions BufferError7383261 +Ref: 18247383261 +Ref: library/exceptions LookupError7383372 +Ref: 21cc7383372 +Ref: Base classes-Footnote-17383674 +Node: Concrete exceptions7383716 +Ref: library/exceptions concrete-exceptions7383829 +Ref: 22857383829 +Ref: library/exceptions AssertionError7383952 +Ref: 6a57383952 +Ref: library/exceptions AttributeError7384040 +Ref: 3487384040 +Ref: library/exceptions AttributeError name7384408 +Ref: 22867384408 +Ref: library/exceptions AttributeError obj7384506 +Ref: 22877384506 +Ref: library/exceptions EOFError7384693 +Ref: 12cc7384693 +Ref: library/exceptions FloatingPointError7384971 +Ref: 22847384971 +Ref: library/exceptions GeneratorExit7385032 +Ref: 13937385032 +Ref: library/exceptions ImportError7385355 +Ref: 4157385355 +Ref: library/exceptions ImportError name7385677 +Ref: 22887385677 +Ref: library/exceptions ImportError path7385772 +Ref: 22897385772 +Ref: library/exceptions ModuleNotFoundError7385958 +Ref: b477385958 +Ref: library/exceptions IndexError7386222 +Ref: 14ff7386222 +Ref: library/exceptions KeyError7386449 +Ref: 33f7386449 +Ref: library/exceptions KeyboardInterrupt7386566 +Ref: 9d17386566 +Ref: library/exceptions MemoryError7387438 +Ref: 15767387438 +Ref: library/exceptions NameError7388019 +Ref: 43a7388019 +Ref: library/exceptions NameError name7388309 +Ref: 228b7388309 +Ref: library/exceptions NotImplementedError7388476 +Ref: 22a7388476 +Ref: library/exceptions OSError7389352 +Ref: 4137389352 +Ref: library/exceptions OSError errno7390388 +Ref: 228d7390388 +Ref: library/exceptions OSError winerror7390480 +Ref: 228e7390480 +Ref: library/exceptions OSError strerror7391059 +Ref: 228f7391059 +Ref: library/exceptions OSError filename7391295 +Ref: 22907391295 +Ref: library/exceptions OSError filename27391324 +Ref: 22917391324 +Ref: library/exceptions OverflowError7392343 +Ref: 87f7392343 +Ref: library/exceptions PythonFinalizationError7392836 +Ref: 14d7392836 +Ref: library/exceptions RecursionError7393421 +Ref: d6b7393421 +Ref: library/exceptions ReferenceError7393745 +Ref: 14d97393745 +Ref: library/exceptions RuntimeError7394071 +Ref: 1957394071 +Ref: library/exceptions StopIteration7394273 +Ref: bfa7394273 +Ref: library/exceptions StopIteration value7394495 +Ref: 1fc97394495 +Ref: library/exceptions StopAsyncIteration7395652 +Ref: 1a2c7395652 +Ref: library/exceptions SyntaxError7395846 +Ref: 18d7395846 +Ref: library/exceptions SyntaxError filename7396368 +Ref: 22927396368 +Ref: library/exceptions SyntaxError lineno7396460 +Ref: 22937396460 +Ref: library/exceptions SyntaxError offset7396634 +Ref: 22947396634 +Ref: library/exceptions SyntaxError text7396820 +Ref: 22957396820 +Ref: library/exceptions SyntaxError end_lineno7396901 +Ref: 22967396901 +Ref: library/exceptions SyntaxError end_offset7397093 +Ref: 22977397093 +Ref: library/exceptions IndentationError7397727 +Ref: 7a37397727 +Ref: library/exceptions TabError7397880 +Ref: 5407397880 +Ref: library/exceptions SystemError7398041 +Ref: 5727398041 +Ref: library/exceptions SystemExit7398951 +Ref: d407398951 +Ref: library/exceptions SystemExit code7400255 +Ref: 22997400255 +Ref: library/exceptions TypeError7400397 +Ref: 5347400397 +Ref: library/exceptions UnboundLocalError7401226 +Ref: 15007401226 +Ref: library/exceptions UnicodeError7401444 +Ref: 12967401444 +Ref: library/exceptions UnicodeError encoding7401806 +Ref: 229a7401806 +Ref: library/exceptions UnicodeError reason7401895 +Ref: 229b7401895 +Ref: library/exceptions UnicodeError object7401980 +Ref: 229c7401980 +Ref: library/exceptions UnicodeError start7402076 +Ref: 15bb7402076 +Ref: library/exceptions UnicodeError end7402168 +Ref: 15bc7402168 +Ref: library/exceptions UnicodeEncodeError7402264 +Ref: 6737402264 +Ref: library/exceptions UnicodeDecodeError7402417 +Ref: a127402417 +Ref: library/exceptions UnicodeTranslateError7402570 +Ref: 229d7402570 +Ref: library/exceptions ValueError7402729 +Ref: 2047402729 +Ref: library/exceptions ZeroDivisionError7402982 +Ref: 9457402982 +Ref: library/exceptions EnvironmentError7403339 +Ref: 104c7403339 +Ref: library/exceptions IOError7403372 +Ref: 104b7403372 +Ref: library/exceptions WindowsError7403396 +Ref: 104d7403396 +Ref: Concrete exceptions-Footnote-17403522 +Ref: Concrete exceptions-Footnote-27403564 +Node: OS exceptions7403606 +Ref: library/exceptions os-exceptions7403675 +Ref: 228c7403675 +Ref: library/exceptions BlockingIOError7403836 +Ref: 10507403836 +Ref: library/exceptions BlockingIOError characters_written7404223 +Ref: 22a27404223 +Ref: library/exceptions ChildProcessError7404478 +Ref: 10517404478 +Ref: library/exceptions ConnectionError7404623 +Ref: e097404623 +Ref: library/exceptions BrokenPipeError7404875 +Ref: 10557404875 +Ref: library/exceptions ConnectionAbortedError7405187 +Ref: 10567405187 +Ref: library/exceptions ConnectionRefusedError7405395 +Ref: 10577405395 +Ref: library/exceptions ConnectionResetError7405603 +Ref: 10587405603 +Ref: library/exceptions FileExistsError7405797 +Ref: 10197405797 +Ref: library/exceptions FileNotFoundError7405959 +Ref: 4277405959 +Ref: library/exceptions InterruptedError7406117 +Ref: d877406117 +Ref: library/exceptions IsADirectoryError7406523 +Ref: 10527406523 +Ref: library/exceptions NotADirectoryError7406714 +Ref: 10537406714 +Ref: library/exceptions PermissionError7407086 +Ref: d427407086 +Ref: library/exceptions ProcessLookupError7407464 +Ref: 10547407464 +Ref: library/exceptions TimeoutError7407602 +Ref: 8317407602 +Ref: OS exceptions-Footnote-17407947 +Ref: OS exceptions-Footnote-27407989 +Node: Warnings7408031 +Ref: library/exceptions warning-categories-as-exceptions7408148 +Ref: 22b07408148 +Ref: library/exceptions warnings7408148 +Ref: 22b17408148 +Ref: library/exceptions Warning7408309 +Ref: 22b37408309 +Ref: library/exceptions UserWarning7408374 +Ref: 22b47408374 +Ref: library/exceptions DeprecationWarning7408456 +Ref: 1a57408456 +Ref: library/exceptions PendingDeprecationWarning7408848 +Ref: 8c77408848 +Ref: library/exceptions SyntaxWarning7409420 +Ref: 4617409420 +Ref: library/exceptions RuntimeWarning7409502 +Ref: 1bd7409502 +Ref: library/exceptions FutureWarning7409595 +Ref: 4117409595 +Ref: library/exceptions ImportWarning7409782 +Ref: 4f67409782 +Ref: library/exceptions UnicodeWarning7410006 +Ref: 13ef7410006 +Ref: library/exceptions EncodingWarning7410087 +Ref: 1d3d7410087 +Ref: library/exceptions BytesWarning7410259 +Ref: c237410259 +Ref: library/exceptions ResourceWarning7410378 +Ref: 2467410378 +Ref: Warnings-Footnote-17410652 +Ref: Warnings-Footnote-27410694 +Ref: Warnings-Footnote-37410736 +Node: Exception groups7410778 +Ref: library/exceptions exception-groups7410895 +Ref: 22b57410895 +Ref: library/exceptions lib-exception-groups7410895 +Ref: 22b67410895 +Ref: library/exceptions ExceptionGroup7411278 +Ref: 1b67411278 +Ref: library/exceptions BaseExceptionGroup7411321 +Ref: 2617411321 +Ref: library/exceptions BaseExceptionGroup message7412364 +Ref: 22b77412364 +Ref: library/exceptions BaseExceptionGroup exceptions7412489 +Ref: 22b87412489 +Ref: library/exceptions BaseExceptionGroup subgroup7412653 +Ref: 16c17412653 +Ref: library/exceptions BaseExceptionGroup split7413999 +Ref: 15897413999 +Ref: library/exceptions BaseExceptionGroup derive7414234 +Ref: 16c07414234 +Node: Exception hierarchy7417284 +Ref: library/exceptions exception-hierarchy7417384 +Ref: 22b97417384 +Ref: library/text stringservices7420260 +Ref: 21b77420260 +Node: Text Processing Services7420261 +Ref: library/text doc7420406 +Ref: 22ba7420406 +Ref: library/text text-processing-services7420406 +Ref: 22bb7420406 +Ref: library/text textservices7420406 +Ref: 21ba7420406 +Node: string — Common string operations7421194 +Ref: library/string doc7421335 +Ref: 22bd7421335 +Ref: library/string module-string7421335 +Ref: d37421335 +Ref: library/string string-common-string-operations7421335 +Ref: 22be7421335 +Ref: string — Common string operations-Footnote-17421779 +Node: String constants7421845 +Ref: library/string string-constants7421966 +Ref: 22bf7421966 +Ref: library/string string ascii_letters7422060 +Ref: 12b67422060 +Ref: library/string string ascii_lowercase7422259 +Ref: 22c07422259 +Ref: library/string string ascii_uppercase7422419 +Ref: 22c17422419 +Ref: library/string string digits7422579 +Ref: 22c27422579 +Ref: library/string string hexdigits7422641 +Ref: 22c37422641 +Ref: library/string string octdigits7422718 +Ref: 22c47422718 +Ref: library/string string punctuation7422781 +Ref: 22c57422781 +Ref: library/string string printable7422956 +Ref: 15877422956 +Ref: library/string string whitespace7423417 +Ref: 22c67423417 +Ref: String constants-Footnote-17423659 +Node: Custom String Formatting7423705 +Ref: library/string custom-string-formatting7423855 +Ref: 22c77423855 +Ref: library/string string-formatting7423855 +Ref: 21b97423855 +Ref: library/string string Formatter7424302 +Ref: eb67424302 +Ref: library/string string Formatter format7424403 +Ref: c007424403 +Ref: library/string string Formatter vformat7424764 +Ref: 22c87424764 +Ref: library/string string Formatter parse7425475 +Ref: 22c97425475 +Ref: library/string string Formatter get_field7426231 +Ref: 22ca7426231 +Ref: library/string string Formatter get_value7426780 +Ref: 22cb7426780 +Ref: library/string string Formatter check_unused_args7428017 +Ref: 22cc7428017 +Ref: library/string string Formatter format_field7428621 +Ref: 22cd7428621 +Ref: library/string string Formatter convert_field7428847 +Ref: 22ce7428847 +Ref: Custom String Formatting-Footnote-17429222 +Ref: Custom String Formatting-Footnote-27429264 +Node: Format String Syntax7429306 +Ref: library/string format-string-syntax7429456 +Ref: 22cf7429456 +Ref: library/string formatstrings7429456 +Ref: 137c7429456 +Ref: library/string grammar-token-format-string-replacement_field7430257 +Ref: 22d07430257 +Ref: library/string grammar-token-format-string-field_name7430379 +Ref: 22d17430379 +Ref: library/string grammar-token-format-string-arg_name7430500 +Ref: 22d47430500 +Ref: library/string grammar-token-format-string-attribute_name7430575 +Ref: 22d57430575 +Ref: library/string grammar-token-format-string-element_index7430626 +Ref: 22d67430626 +Ref: library/string grammar-token-format-string-index_string7430701 +Ref: 22d77430701 +Ref: library/string grammar-token-format-string-conversion7430764 +Ref: 22d27430764 +Ref: library/string grammar-token-format-string-format_spec7430807 +Ref: 22d37430807 +Node: Format Specification Mini-Language7434918 +Ref: library/string format-specification-mini-language7435033 +Ref: 22da7435033 +Ref: library/string formatspec7435033 +Ref: 1ea7435033 +Ref: library/string grammar-token-format-spec-format_spec7435915 +Ref: 22d87435915 +Ref: library/string grammar-token-format-spec-options7436049 +Ref: 22db7436049 +Ref: library/string grammar-token-format-spec-fill7436144 +Ref: 22e07436144 +Ref: library/string grammar-token-format-spec-align7436181 +Ref: 22e17436181 +Ref: library/string grammar-token-format-spec-sign7436224 +Ref: 22e27436224 +Ref: library/string grammar-token-format-spec-width7436261 +Ref: 22dc7436261 +Ref: library/string grammar-token-format-spec-grouping7436302 +Ref: 22dd7436302 +Ref: library/string grammar-token-format-spec-precision7436333 +Ref: 22de7436333 +Ref: library/string grammar-token-format-spec-type7436374 +Ref: 22df7436374 +Ref: Format Specification Mini-Language-Footnote-17451056 +Ref: Format Specification Mini-Language-Footnote-27451098 +Ref: Format Specification Mini-Language-Footnote-37451140 +Node: Format examples7451182 +Ref: library/string format-examples7451297 +Ref: 22e47451297 +Ref: library/string formatexamples7451297 +Ref: 22d97451297 +Node: Template strings7456036 +Ref: library/string id17456178 +Ref: 22e57456178 +Ref: library/string template-strings7456178 +Ref: 21d07456178 +Ref: library/string string Template7457639 +Ref: 6837457639 +Ref: library/string string Template substitute7457759 +Ref: 1cea7457759 +Ref: library/string string Template safe_substitute7458244 +Ref: 1ceb7458244 +Ref: library/string string Template is_valid7459199 +Ref: 6827459199 +Ref: library/string string Template get_identifiers7459429 +Ref: 6817459429 +Ref: library/string string Template template7459726 +Ref: 22e67459726 +Ref: Template strings-Footnote-17463647 +Ref: Template strings-Footnote-27463689 +Node: Helper functions7463741 +Ref: library/string helper-functions7463854 +Ref: 22e77463854 +Ref: library/string string capwords7463905 +Ref: 21cb7463905 +Node: re — Regular expression operations7464391 +Ref: library/re doc7464581 +Ref: 22e87464581 +Ref: library/re module-re7464581 +Ref: b97464581 +Ref: library/re re-regular-expression-operations7464581 +Ref: 22e97464581 +Ref: re — Regular expression operations-Footnote-17467149 +Ref: re — Regular expression operations-Footnote-27467209 +Node: Regular Expression Syntax7467249 +Ref: library/re re-syntax7467371 +Ref: 71f7467371 +Ref: library/re regular-expression-syntax7467371 +Ref: 22ea7467371 +Ref: library/re re-conditional-expression7488236 +Ref: 17ad7488236 +Ref: library/re re-special-sequences7488925 +Ref: 22f77488925 +Ref: Regular Expression Syntax-Footnote-17495319 +Ref: Regular Expression Syntax-Footnote-27495361 +Node: Module Contents7495433 +Ref: library/re contents-of-module-re7495590 +Ref: 22f67495590 +Ref: library/re module-contents7495590 +Ref: 22f87495590 +Node: Flags7495954 +Ref: library/re flags7496032 +Ref: 22f97496032 +Ref: library/re re RegexFlag7496193 +Ref: 6297496193 +Ref: library/re re A7496361 +Ref: 22ef7496361 +Ref: library/re re ASCII7496376 +Ref: 6287496376 +Ref: library/re re DEBUG7497049 +Ref: 22fb7497049 +Ref: library/re re I7497164 +Ref: 22f07497164 +Ref: library/re re IGNORECASE7497179 +Ref: 17257497179 +Ref: library/re re L7498167 +Ref: 22f17498167 +Ref: library/re re LOCALE7498182 +Ref: b6c7498182 +Ref: library/re re M7499167 +Ref: 22f27499167 +Ref: library/re re MULTILINE7499182 +Ref: 22ee7499182 +Ref: library/re re NOFLAG7499772 +Ref: 22fc7499772 +Ref: library/re re S7500163 +Ref: 22f37500163 +Ref: library/re re DOTALL7500178 +Ref: 22ed7500178 +Ref: library/re re U7500419 +Ref: 22f47500419 +Ref: library/re re UNICODE7500434 +Ref: b6d7500434 +Ref: library/re re X7500730 +Ref: 22f57500730 +Ref: library/re re VERBOSE7500745 +Ref: 22fd7500745 +Node: Functions<2>7501817 +Ref: library/re functions7501917 +Ref: 22fe7501917 +Ref: library/re re compile7501954 +Ref: bd37501954 +Ref: library/re re search7503091 +Ref: 121f7503091 +Ref: library/re re match7503681 +Ref: 12207503681 +Ref: library/re re fullmatch7504525 +Ref: f807504525 +Ref: library/re re split7505047 +Ref: 2a47505047 +Ref: library/re re findall7507326 +Ref: 10237507326 +Ref: library/re re finditer7508555 +Ref: 14c57508555 +Ref: library/re re sub7509190 +Ref: 2a57509190 +Ref: library/re re subn7512963 +Ref: 2a67512963 +Ref: library/re re escape7513345 +Ref: c097513345 +Ref: library/re re purge7514833 +Ref: 23027514833 +Node: Exceptions<3>7514902 +Ref: library/re exceptions7514988 +Ref: 23037514988 +Ref: library/re re PatternError7515027 +Ref: 2407515027 +Ref: library/re re PatternError msg7515480 +Ref: 23047515480 +Ref: library/re re PatternError pattern7515547 +Ref: 23057515547 +Ref: library/re re PatternError pos7515619 +Ref: 23067515619 +Ref: library/re re PatternError lineno7515734 +Ref: 23077515734 +Ref: library/re re PatternError colno7515826 +Ref: 23087515826 +Node: Regular Expression Objects7516126 +Ref: library/re re-objects7516271 +Ref: f817516271 +Ref: library/re regular-expression-objects7516271 +Ref: 23097516271 +Ref: library/re re Pattern7516342 +Ref: 17dd7516342 +Ref: library/re re Pattern search7516612 +Ref: 23007516612 +Ref: library/re re Pattern match7518069 +Ref: 22ff7518069 +Ref: library/re re Pattern fullmatch7518920 +Ref: 18027518920 +Ref: library/re re Pattern split7519712 +Ref: 230a7519712 +Ref: library/re re Pattern findall7519846 +Ref: 230b7519846 +Ref: library/re re Pattern finditer7520109 +Ref: 230c7520109 +Ref: library/re re Pattern sub7520374 +Ref: 230d7520374 +Ref: library/re re Pattern subn7520507 +Ref: 230e7520507 +Ref: library/re re Pattern flags7520642 +Ref: 230f7520642 +Ref: library/re re Pattern groups7520915 +Ref: 23107520915 +Ref: library/re re Pattern groupindex7520999 +Ref: 23117520999 +Ref: library/re re Pattern pattern7521213 +Ref: 23127521213 +Node: Match Objects7521472 +Ref: library/re id37521629 +Ref: 23137521629 +Ref: library/re match-objects7521629 +Ref: f827521629 +Ref: library/re re Match7521981 +Ref: cc87521981 +Ref: library/re re Match expand7522237 +Ref: 23147522237 +Ref: library/re re Match group7522833 +Ref: 23157522833 +Ref: library/re re Match __getitem__7525103 +Ref: 23167525103 +Ref: library/re re Match groups7525805 +Ref: 23177525805 +Ref: library/re re Match groupdict7526651 +Ref: 23187526651 +Ref: library/re re Match start7527118 +Ref: 23197527118 +Ref: library/re re Match end7527152 +Ref: 231a7527152 +Ref: library/re re Match span7528200 +Ref: 231b7528200 +Ref: library/re re Match pos7528453 +Ref: 231c7528453 +Ref: library/re re Match endpos7528713 +Ref: 231d7528713 +Ref: library/re re Match lastindex7528967 +Ref: 231e7528967 +Ref: library/re re Match lastgroup7529366 +Ref: 231f7529366 +Ref: library/re re Match re7529539 +Ref: 23207529539 +Ref: library/re re Match string7529706 +Ref: 23217529706 +Node: Regular Expression Examples7529944 +Ref: library/re re-examples7530066 +Ref: 12517530066 +Ref: library/re regular-expression-examples7530066 +Ref: 23227530066 +Node: Checking for a Pair7530410 +Ref: library/re checking-for-a-pair7530518 +Ref: 23237530518 +Node: Simulating scanf7532615 +Ref: library/re simulating-scanf7532747 +Ref: 23247532747 +Node: search vs match7534817 +Ref: library/re id47534948 +Ref: 23257534948 +Ref: library/re search-vs-match7534948 +Ref: 23017534948 +Node: Making a Phonebook7536402 +Ref: library/re making-a-phonebook7536529 +Ref: 23267536529 +Node: Text Munging7538728 +Ref: library/re text-munging7538859 +Ref: 23277538859 +Node: Finding all Adverbs7539692 +Ref: library/re finding-all-adverbs7539844 +Ref: 23287539844 +Node: Finding all Adverbs and their Positions7540304 +Ref: library/re finding-all-adverbs-and-their-positions7540463 +Ref: 23297540463 +Node: Raw String Notation7541167 +Ref: library/re raw-string-notation7541326 +Ref: 232a7541326 +Node: Writing a Tokenizer7542253 +Ref: library/re writing-a-tokenizer7542364 +Ref: 232b7542364 +Ref: library/re frie097545735 +Ref: 22eb7545735 +Ref: Writing a Tokenizer-Footnote-17546015 +Node: difflib — Helpers for computing deltas7546070 +Ref: library/difflib doc7546263 +Ref: 232c7546263 +Ref: library/difflib difflib-helpers-for-computing-deltas7546263 +Ref: 232d7546263 +Ref: library/difflib module-difflib7546263 +Ref: 377546263 +Ref: library/difflib difflib Differ7548772 +Ref: 232e7548772 +Ref: library/difflib difflib HtmlDiff7549949 +Ref: 155e7549949 +Ref: library/difflib difflib HtmlDiff __init__7550319 +Ref: 232f7550319 +Ref: library/difflib difflib HtmlDiff make_file7551132 +Ref: dee7551132 +Ref: library/difflib difflib HtmlDiff make_table7552815 +Ref: 23317552815 +Ref: library/difflib difflib context_diff7553276 +Ref: 23327553276 +Ref: library/difflib difflib get_close_matches7555322 +Ref: 23367555322 +Ref: library/difflib difflib ndiff7556486 +Ref: 23307556486 +Ref: library/difflib difflib restore7558052 +Ref: 23397558052 +Ref: library/difflib difflib unified_diff7558795 +Ref: 233b7558795 +Ref: library/difflib difflib diff_bytes7560720 +Ref: def7560720 +Ref: library/difflib difflib IS_LINE_JUNK7561614 +Ref: 23377561614 +Ref: library/difflib difflib IS_CHARACTER_JUNK7561916 +Ref: 23387561916 +Ref: difflib — Helpers for computing deltas-Footnote-17562586 +Ref: difflib — Helpers for computing deltas-Footnote-27562653 +Node: SequenceMatcher Objects7562733 +Ref: library/difflib sequence-matcher7562866 +Ref: 233c7562866 +Ref: library/difflib sequencematcher-objects7562866 +Ref: 233d7562866 +Ref: library/difflib difflib SequenceMatcher7562993 +Ref: 10127562993 +Ref: library/difflib difflib SequenceMatcher set_seqs7564529 +Ref: 233e7564529 +Ref: library/difflib difflib SequenceMatcher set_seq17564948 +Ref: 23407564948 +Ref: library/difflib difflib SequenceMatcher set_seq27565091 +Ref: 233f7565091 +Ref: library/difflib difflib SequenceMatcher find_longest_match7565234 +Ref: 195f7565234 +Ref: library/difflib difflib SequenceMatcher get_matching_blocks7567391 +Ref: 23417567391 +Ref: library/difflib difflib SequenceMatcher get_opcodes7568308 +Ref: 23427568308 +Ref: library/difflib difflib SequenceMatcher get_grouped_opcodes7570295 +Ref: 23437570295 +Ref: library/difflib difflib SequenceMatcher ratio7570728 +Ref: 23447570728 +Ref: library/difflib difflib SequenceMatcher quick_ratio7571751 +Ref: 23457571751 +Ref: library/difflib difflib SequenceMatcher real_quick_ratio7571871 +Ref: 23467571871 +Node: SequenceMatcher Examples7572403 +Ref: library/difflib id17572559 +Ref: 23477572559 +Ref: library/difflib sequencematcher-examples7572559 +Ref: 23487572559 +Ref: SequenceMatcher Examples-Footnote-17574301 +Node: Differ Objects7574378 +Ref: library/difflib differ-objects7574525 +Ref: 23497574525 +Ref: library/difflib id27574525 +Ref: 234a7574525 +Ref: library/difflib difflib Differ compare7575931 +Ref: 233a7575931 +Node: Differ Example7576455 +Ref: library/difflib differ-example7576613 +Ref: 234b7576613 +Ref: library/difflib differ-examples7576613 +Ref: 234c7576613 +Node: A command-line interface to difflib7578878 +Ref: library/difflib a-command-line-interface-to-difflib7579035 +Ref: 234d7579035 +Ref: library/difflib difflib-interface7579035 +Ref: 23357579035 +Node: ndiff example7581674 +Ref: library/difflib ndiff-example7581808 +Ref: 234e7581808 +Node: textwrap — Text wrapping and filling7585458 +Ref: library/textwrap doc7585647 +Ref: 234f7585647 +Ref: library/textwrap module-textwrap7585647 +Ref: ec7585647 +Ref: library/textwrap textwrap-text-wrapping-and-filling7585647 +Ref: 23507585647 +Ref: library/textwrap textwrap wrap7586178 +Ref: 14907586178 +Ref: library/textwrap textwrap fill7586915 +Ref: 148f7586915 +Ref: library/textwrap textwrap shorten7587547 +Ref: fcb7587547 +Ref: library/textwrap textwrap dedent7588785 +Ref: 23567588785 +Ref: library/textwrap textwrap indent7589721 +Ref: 2787589721 +Ref: library/textwrap textwrap TextWrapper7591059 +Ref: fc87591059 +Ref: library/textwrap textwrap TextWrapper width7591734 +Ref: 23587591734 +Ref: library/textwrap textwrap TextWrapper expand_tabs7592056 +Ref: 23537592056 +Ref: library/textwrap textwrap TextWrapper tabsize7592266 +Ref: 23527592266 +Ref: library/textwrap textwrap TextWrapper replace_whitespace7592556 +Ref: 23557592556 +Ref: library/textwrap textwrap TextWrapper drop_whitespace7593519 +Ref: 23547593519 +Ref: library/textwrap textwrap TextWrapper initial_indent7593933 +Ref: 23597593933 +Ref: library/textwrap textwrap TextWrapper subsequent_indent7594168 +Ref: 235a7594168 +Ref: library/textwrap textwrap TextWrapper fix_sentence_endings7594395 +Ref: 235b7594395 +Ref: library/textwrap textwrap TextWrapper break_long_words7595603 +Ref: 23577595603 +Ref: library/textwrap textwrap TextWrapper break_on_hyphens7596093 +Ref: 235c7596093 +Ref: library/textwrap textwrap TextWrapper max_lines7596625 +Ref: fc97596625 +Ref: library/textwrap textwrap TextWrapper placeholder7596872 +Ref: fca7596872 +Ref: library/textwrap textwrap TextWrapper wrap7597188 +Ref: 23517597188 +Ref: library/textwrap textwrap TextWrapper fill7597610 +Ref: 235d7597610 +Ref: textwrap — Text wrapping and filling-Footnote-17597797 +Node: unicodedata — Unicode Database7597865 +Ref: library/unicodedata doc7598056 +Ref: 235e7598056 +Ref: library/unicodedata module-unicodedata7598056 +Ref: 1057598056 +Ref: library/unicodedata unicodedata-unicode-database7598056 +Ref: 235f7598056 +Ref: library/unicodedata unicodedata lookup7598578 +Ref: 10717598578 +Ref: library/unicodedata unicodedata name7598895 +Ref: 23607598895 +Ref: library/unicodedata unicodedata decimal7599121 +Ref: 23617599121 +Ref: library/unicodedata unicodedata digit7599364 +Ref: 23627599364 +Ref: library/unicodedata unicodedata numeric7599602 +Ref: 12567599602 +Ref: library/unicodedata unicodedata category7599842 +Ref: 23637599842 +Ref: library/unicodedata unicodedata bidirectional7599967 +Ref: 23647599967 +Ref: library/unicodedata unicodedata combining7600159 +Ref: 23657600159 +Ref: library/unicodedata unicodedata east_asian_width7600346 +Ref: 23667600346 +Ref: library/unicodedata unicodedata mirrored7600479 +Ref: 23677600479 +Ref: library/unicodedata unicodedata decomposition7600737 +Ref: 23687600737 +Ref: library/unicodedata unicodedata normalize7600952 +Ref: 6d07600952 +Ref: library/unicodedata unicodedata is_normalized7602814 +Ref: a487602814 +Ref: library/unicodedata unicodedata unidata_version7603123 +Ref: 23697603123 +Ref: library/unicodedata unicodedata ucd_3_2_07603225 +Ref: 13ff7603225 +Ref: unicodedata — Unicode Database-Footnote-17604004 +Ref: unicodedata — Unicode Database-Footnote-27604054 +Ref: unicodedata — Unicode Database-Footnote-37604100 +Ref: unicodedata — Unicode Database-Footnote-47604172 +Node: stringprep — Internet String Preparation7604247 +Ref: library/stringprep doc7604435 +Ref: 236a7604435 +Ref: library/stringprep module-stringprep7604435 +Ref: d47604435 +Ref: library/stringprep stringprep-internet-string-preparation7604435 +Ref: 236b7604435 +Ref: library/stringprep stringprep in_table_a17606352 +Ref: 236c7606352 +Ref: library/stringprep stringprep in_table_b17606489 +Ref: 236d7606489 +Ref: library/stringprep stringprep map_table_b27606615 +Ref: 236e7606615 +Ref: library/stringprep stringprep map_table_b37606772 +Ref: 236f7606772 +Ref: library/stringprep stringprep in_table_c117606941 +Ref: 23707606941 +Ref: library/stringprep stringprep in_table_c127607061 +Ref: 23717607061 +Ref: library/stringprep stringprep in_table_c11_c127607190 +Ref: 23727607190 +Ref: library/stringprep stringprep in_table_c217607337 +Ref: 23737607337 +Ref: library/stringprep stringprep in_table_c227607464 +Ref: 23747607464 +Ref: library/stringprep stringprep in_table_c21_c227607595 +Ref: 23757607595 +Ref: library/stringprep stringprep in_table_c37607744 +Ref: 23767607744 +Ref: library/stringprep stringprep in_table_c47607850 +Ref: 23777607850 +Ref: library/stringprep stringprep in_table_c57607975 +Ref: 23787607975 +Ref: library/stringprep stringprep in_table_c67608085 +Ref: 23797608085 +Ref: library/stringprep stringprep in_table_c77608213 +Ref: 237a7608213 +Ref: library/stringprep stringprep in_table_c87608355 +Ref: 237b7608355 +Ref: library/stringprep stringprep in_table_c97608498 +Ref: 237c7608498 +Ref: library/stringprep stringprep in_table_d17608611 +Ref: 237d7608611 +Ref: library/stringprep stringprep in_table_d27608769 +Ref: 237e7608769 +Ref: stringprep — Internet String Preparation-Footnote-17608951 +Ref: stringprep — Internet String Preparation-Footnote-27609021 +Ref: stringprep — Internet String Preparation-Footnote-37609080 +Node: readline — GNU readline interface7609139 +Ref: library/readline doc7609347 +Ref: 237f7609347 +Ref: library/readline module-readline7609347 +Ref: ba7609347 +Ref: library/readline readline-gnu-readline-interface7609347 +Ref: 23807609347 +Ref: library/readline readline backend7611429 +Ref: 16af7611429 +Ref: readline — GNU readline interface-Footnote-17611753 +Node: Init file7611838 +Ref: library/readline init-file7611939 +Ref: 23817611939 +Ref: library/readline readline parse_and_bind7612049 +Ref: 23827612049 +Ref: library/readline readline read_init_file7612230 +Ref: 23837612230 +Node: Line buffer7612452 +Ref: library/readline line-buffer7612574 +Ref: 23847612574 +Ref: library/readline readline get_line_buffer7612668 +Ref: 23857612668 +Ref: library/readline readline insert_text7612819 +Ref: 23867612819 +Ref: library/readline readline redisplay7613029 +Ref: 148e7613029 +Node: History file7613234 +Ref: library/readline history-file7613359 +Ref: 23877613359 +Ref: library/readline readline read_history_file7613454 +Ref: 23887613454 +Ref: library/readline readline write_history_file7613692 +Ref: 23897613692 +Ref: library/readline readline append_history_file7613949 +Ref: e4c7613949 +Ref: library/readline readline get_history_length7614358 +Ref: 238a7614358 +Ref: library/readline readline set_history_length7614403 +Ref: 15f77614403 +Node: History list7614766 +Ref: library/readline history-list7614893 +Ref: 238b7614893 +Ref: library/readline readline clear_history7614995 +Ref: 238c7614995 +Ref: library/readline readline get_current_history_length7615243 +Ref: 148d7615243 +Ref: library/readline readline get_history_item7615508 +Ref: 148c7615508 +Ref: library/readline readline remove_history_item7615718 +Ref: 238d7615718 +Ref: library/readline readline replace_history_item7615938 +Ref: 238e7615938 +Ref: library/readline readline add_history7616169 +Ref: 238f7616169 +Ref: library/readline readline set_auto_history7616353 +Ref: cca7616353 +Node: Startup hooks7616821 +Ref: library/readline startup-hooks7616946 +Ref: 23907616946 +Ref: library/readline readline set_startup_hook7616991 +Ref: 23917616991 +Ref: library/readline readline set_pre_input_hook7617395 +Ref: 23927617395 +Node: Completion7617967 +Ref: library/readline completion7618087 +Ref: 23937618087 +Ref: library/readline readline-completion7618087 +Ref: 23947618087 +Ref: library/readline readline set_completer7618573 +Ref: 23957618573 +Ref: library/readline readline get_completer7619364 +Ref: 23967619364 +Ref: library/readline readline get_completion_type7619497 +Ref: 23977619497 +Ref: library/readline readline get_begidx7619697 +Ref: 18e67619697 +Ref: library/readline readline get_endidx7619734 +Ref: 18e77619734 +Ref: library/readline readline set_completer_delims7620179 +Ref: 16b37620179 +Ref: library/readline readline get_completer_delims7620232 +Ref: 23987620232 +Ref: library/readline readline set_completion_display_matches_hook7620553 +Ref: 23997620553 +Node: Example7621142 +Ref: library/readline example7621240 +Ref: 239a7621240 +Ref: library/readline readline-example7621240 +Ref: 239b7621240 +Node: rlcompleter — Completion function for GNU readline7623880 +Ref: library/rlcompleter doc7624037 +Ref: 239d7624037 +Ref: library/rlcompleter module-rlcompleter7624037 +Ref: bd7624037 +Ref: library/rlcompleter rlcompleter-completion-function-for-gnu-readline7624037 +Ref: 239e7624037 +Ref: library/rlcompleter completer-objects7625525 +Ref: 23a07625525 +Ref: library/rlcompleter rlcompleter Completer7625525 +Ref: 19447625525 +Ref: library/rlcompleter rlcompleter Completer complete7625610 +Ref: 239f7625610 +Ref: rlcompleter — Completion function for GNU readline-Footnote-17626649 +Node: Binary Data Services7626720 +Ref: library/binary doc7626856 +Ref: 23a17626856 +Ref: library/binary binary-data-services7626856 +Ref: 23a27626856 +Ref: library/binary binaryservices7626856 +Ref: 22bc7626856 +Node: struct — Interpret bytes as packed binary data7627622 +Ref: library/struct doc7627778 +Ref: 23a37627778 +Ref: library/struct struct-interpret-bytes-as-packed-binary-data7627778 +Ref: 23a47627778 +Ref: library/struct module-struct7627895 +Ref: d57627895 +Ref: struct — Interpret bytes as packed binary data-Footnote-17629665 +Node: Functions and Exceptions7629731 +Ref: library/struct functions-and-exceptions7629863 +Ref: 23a77629863 +Ref: library/struct struct error7629989 +Ref: 13167629989 +Ref: library/struct struct pack7630115 +Ref: 126a7630115 +Ref: library/struct struct pack_into7630357 +Ref: 23a87630357 +Ref: library/struct struct unpack7630656 +Ref: 17c67630656 +Ref: library/struct struct unpack_from7631023 +Ref: 23a97631023 +Ref: library/struct struct iter_unpack7631419 +Ref: fb97631419 +Ref: library/struct struct calcsize7631941 +Ref: 19c37631941 +Node: Format Strings7632140 +Ref: library/struct format-strings7632293 +Ref: 23aa7632293 +Ref: library/struct struct-format-strings7632293 +Ref: 23a57632293 +Node: Byte Order Size and Alignment7632931 +Ref: library/struct byte-order-size-and-alignment7633037 +Ref: 23ac7633037 +Ref: library/struct struct-alignment7633037 +Ref: 23a67633037 +Ref: Byte Order Size and Alignment-Footnote-17636753 +Node: Format Characters7636807 +Ref: library/struct format-characters7636933 +Ref: 23ab7636933 +Ref: library/struct id17636933 +Ref: 23ae7636933 +Ref: Format Characters-Footnote-17648449 +Ref: Format Characters-Footnote-27648510 +Node: Examples<2>7648586 +Ref: library/struct examples7648674 +Ref: 23af7648674 +Ref: library/struct struct-examples7648674 +Ref: 23ad7648674 +Node: Applications7651182 +Ref: library/struct applications7651321 +Ref: 23b07651321 +Ref: library/struct id27651321 +Ref: 23b17651321 +Node: Native Formats7651822 +Ref: library/struct native-formats7651910 +Ref: 23b47651910 +Ref: library/struct struct-native-formats7651910 +Ref: 23b27651910 +Node: Standard Formats7653058 +Ref: library/struct standard-formats7653146 +Ref: 23b57653146 +Ref: library/struct struct-standard-formats7653146 +Ref: 23b37653146 +Node: Classes<3>7654589 +Ref: library/struct classes7654705 +Ref: 23b67654705 +Ref: library/struct struct-objects7654705 +Ref: 23b77654705 +Ref: library/struct struct Struct7654801 +Ref: 16b17654801 +Ref: library/struct struct Struct pack7655497 +Ref: 23b87655497 +Ref: library/struct struct Struct pack_into7655679 +Ref: 23ba7655679 +Ref: library/struct struct Struct unpack7655837 +Ref: 23bb7655837 +Ref: library/struct struct Struct unpack_from7656037 +Ref: 23bc7656037 +Ref: library/struct struct Struct iter_unpack7656295 +Ref: fba7656295 +Ref: library/struct struct Struct format7656548 +Ref: c067656548 +Ref: library/struct struct Struct size7656763 +Ref: 23b97656763 +Node: codecs — Codec registry and base classes7657099 +Ref: library/codecs doc7657255 +Ref: 23bd7657255 +Ref: library/codecs codecs-codec-registry-and-base-classes7657255 +Ref: 23be7657255 +Ref: library/codecs module-codecs7657255 +Ref: 1b7657255 +Ref: library/codecs codecs encode7658147 +Ref: efc7658147 +Ref: library/codecs codecs decode7658642 +Ref: efd7658642 +Ref: library/codecs codecs charmap_build7659137 +Ref: 23c07659137 +Ref: library/codecs codecs lookup7659630 +Ref: 9637659630 +Ref: library/codecs codecs CodecInfo7660128 +Ref: 16fb7660128 +Ref: library/codecs codecs CodecInfo name7660424 +Ref: 23c17660424 +Ref: library/codecs codecs CodecInfo encode7660487 +Ref: 23c27660487 +Ref: library/codecs codecs CodecInfo decode7660514 +Ref: 23c37660514 +Ref: library/codecs codecs CodecInfo incrementalencoder7660892 +Ref: 23c77660892 +Ref: library/codecs codecs CodecInfo incrementaldecoder7660931 +Ref: 23c87660931 +Ref: library/codecs codecs CodecInfo streamwriter7661270 +Ref: 23cb7661270 +Ref: library/codecs codecs CodecInfo streamreader7661303 +Ref: 23cc7661303 +Ref: library/codecs codecs getencoder7661756 +Ref: 23cf7661756 +Ref: library/codecs codecs getdecoder7661968 +Ref: 23d07661968 +Ref: library/codecs codecs getincrementalencoder7662180 +Ref: 23d17662180 +Ref: library/codecs codecs getincrementaldecoder7662486 +Ref: 23d27662486 +Ref: library/codecs codecs getreader7662792 +Ref: 23d37662792 +Ref: library/codecs codecs getwriter7663038 +Ref: 23d47663038 +Ref: library/codecs codecs register7663367 +Ref: 23d57663367 +Ref: library/codecs codecs unregister7663842 +Ref: 7e37663842 +Ref: library/codecs codecs open7664340 +Ref: 73b7664340 +Ref: library/codecs codecs EncodedFile7665713 +Ref: 23d77665713 +Ref: library/codecs codecs iterencode7666570 +Ref: 23d87666570 +Ref: library/codecs codecs iterdecode7667155 +Ref: 23d97667155 +Ref: library/codecs codecs readbuffer_encode7667814 +Ref: 23da7667814 +Ref: library/codecs codecs BOM7668315 +Ref: 23db7668315 +Ref: library/codecs codecs BOM_BE7668336 +Ref: 23dc7668336 +Ref: library/codecs codecs BOM_LE7668360 +Ref: 23dd7668360 +Ref: library/codecs codecs BOM_UTF87668384 +Ref: 23de7668384 +Ref: library/codecs codecs BOM_UTF167668410 +Ref: 23df7668410 +Ref: library/codecs codecs BOM_UTF16_BE7668437 +Ref: 23e07668437 +Ref: library/codecs codecs BOM_UTF16_LE7668467 +Ref: 23e17668467 +Ref: library/codecs codecs BOM_UTF327668497 +Ref: 23e27668497 +Ref: library/codecs codecs BOM_UTF32_BE7668524 +Ref: 23e37668524 +Ref: library/codecs codecs BOM_UTF32_LE7668554 +Ref: 23e47668554 +Ref: codecs — Codec registry and base classes-Footnote-17669737 +Node: Codec Base Classes7669803 +Ref: library/codecs codec-base-classes7669930 +Ref: 23bf7669930 +Ref: library/codecs id17669930 +Ref: 23e57669930 +Ref: library/codecs surrogateescape7670523 +Ref: 23e67670523 +Node: Error Handlers7670660 +Ref: library/codecs error-handlers7670769 +Ref: 17e57670769 +Ref: library/codecs id27670769 +Ref: 23e77670769 +Ref: library/codecs codecs register_error7675689 +Ref: 14627675689 +Ref: library/codecs codecs lookup_error7677231 +Ref: 14637677231 +Ref: library/codecs codecs strict_errors7677526 +Ref: 23e87677526 +Ref: library/codecs codecs ignore_errors7677699 +Ref: 23e97677699 +Ref: library/codecs codecs replace_errors7677895 +Ref: 23ea7677895 +Ref: library/codecs codecs backslashreplace_errors7678145 +Ref: 23eb7678145 +Ref: library/codecs codecs xmlcharrefreplace_errors7678607 +Ref: 23ec7678607 +Ref: library/codecs codecs namereplace_errors7678971 +Ref: 23ed7678971 +Ref: Error Handlers-Footnote-17679534 +Node: Stateless Encoding and Decoding7679576 +Ref: library/codecs codec-objects7679727 +Ref: 23c67679727 +Ref: library/codecs stateless-encoding-and-decoding7679727 +Ref: 23ee7679727 +Ref: library/codecs codecs Codec7679945 +Ref: 23ef7679945 +Ref: library/codecs codecs Codec encode7679970 +Ref: 23c47679970 +Ref: library/codecs codecs Codec decode7680790 +Ref: 23c57680790 +Node: Incremental Encoding and Decoding7681820 +Ref: library/codecs incremental-encoding-and-decoding7681985 +Ref: 23f07681985 +Node: IncrementalEncoder Objects7682825 +Ref: library/codecs incremental-encoder-objects7682956 +Ref: 23f37682956 +Ref: library/codecs incrementalencoder-objects7682956 +Ref: 23f47682956 +Ref: library/codecs codecs IncrementalEncoder7683255 +Ref: 23c97683255 +Ref: library/codecs codecs IncrementalEncoder encode7684040 +Ref: 23f17684040 +Ref: library/codecs codecs IncrementalEncoder reset7684337 +Ref: 23f57684337 +Ref: library/codecs codecs IncrementalEncoder getstate7684606 +Ref: 23f67684606 +Ref: library/codecs codecs IncrementalEncoder setstate7685019 +Ref: 23f77685019 +Node: IncrementalDecoder Objects7685186 +Ref: library/codecs incremental-decoder-objects7685317 +Ref: 23f87685317 +Ref: library/codecs incrementaldecoder-objects7685317 +Ref: 23f97685317 +Ref: library/codecs codecs IncrementalDecoder7685616 +Ref: 23ca7685616 +Ref: library/codecs codecs IncrementalDecoder decode7686401 +Ref: 23f27686401 +Ref: library/codecs codecs IncrementalDecoder reset7687034 +Ref: 23fa7687034 +Ref: library/codecs codecs IncrementalDecoder getstate7687112 +Ref: 23fb7687112 +Ref: library/codecs codecs IncrementalDecoder setstate7688059 +Ref: 23fc7688059 +Node: Stream Encoding and Decoding7688225 +Ref: library/codecs stream-encoding-and-decoding7688350 +Ref: 23fd7688350 +Node: StreamWriter Objects7688777 +Ref: library/codecs stream-writer-objects7688891 +Ref: 23fe7688891 +Ref: library/codecs streamwriter-objects7688891 +Ref: 23ff7688891 +Ref: library/codecs codecs StreamWriter7689153 +Ref: 23cd7689153 +Ref: library/codecs codecs StreamWriter write7690110 +Ref: 24007690110 +Ref: library/codecs codecs StreamWriter writelines7690208 +Ref: 24017690208 +Ref: library/codecs codecs StreamWriter reset7690514 +Ref: 24027690514 +Node: StreamReader Objects7690983 +Ref: library/codecs stream-reader-objects7691132 +Ref: 24037691132 +Ref: library/codecs streamreader-objects7691132 +Ref: 24047691132 +Ref: library/codecs codecs StreamReader7691394 +Ref: 23ce7691394 +Ref: library/codecs codecs StreamReader read7692465 +Ref: 24057692465 +Ref: library/codecs codecs StreamReader readline7693723 +Ref: 24067693723 +Ref: library/codecs codecs StreamReader readlines7694074 +Ref: 24077694074 +Ref: library/codecs codecs StreamReader reset7694525 +Ref: 24087694525 +Node: StreamReaderWriter Objects7694928 +Ref: library/codecs stream-reader-writer7695078 +Ref: 24097695078 +Ref: library/codecs streamreaderwriter-objects7695078 +Ref: 240a7695078 +Ref: library/codecs codecs StreamReaderWriter7695413 +Ref: 23d67695413 +Node: StreamRecoder Objects7696068 +Ref: library/codecs stream-recoder-objects7696189 +Ref: 240b7696189 +Ref: library/codecs streamrecoder-objects7696189 +Ref: 240c7696189 +Ref: library/codecs codecs StreamRecoder7696539 +Ref: 19f07696539 +Node: Encodings and Unicode7697693 +Ref: library/codecs encodings-and-unicode7697847 +Ref: 240d7697847 +Ref: library/codecs encodings-overview7697847 +Ref: 240e7697847 +Ref: Encodings and Unicode-Footnote-17704539 +Node: Standard Encodings7704581 +Ref: library/codecs id37704742 +Ref: 240f7704742 +Ref: library/codecs standard-encodings7704742 +Ref: db87704742 +Ref: Standard Encodings-Footnote-17727048 +Node: Python Specific Encodings7727126 +Ref: library/codecs python-specific-encodings7727297 +Ref: 24107727297 +Node: Text Encodings7727916 +Ref: library/codecs text-encodings7728018 +Ref: 24117728018 +Ref: Text Encodings-Footnote-17731563 +Ref: Text Encodings-Footnote-27731622 +Node: Binary Transforms7731681 +Ref: library/codecs binary-transforms7731818 +Ref: efe7731818 +Ref: library/codecs id47731818 +Ref: 24127731818 +Ref: Binary Transforms-Footnote-17735504 +Node: Standalone Codec Functions7735645 +Ref: library/codecs id67735783 +Ref: 24187735783 +Ref: library/codecs standalone-codec-functions7735783 +Ref: 24197735783 +Ref: library/codecs codecs codecs escape_encode7736195 +Ref: 241a7736195 +Ref: library/codecs codecs codecs escape_decode7736567 +Ref: 241b7736567 +Node: Text Transforms7736890 +Ref: library/codecs id77737002 +Ref: 241c7737002 +Ref: library/codecs text-transforms7737002 +Ref: eff7737002 +Node: encodings — Encodings package7737748 +Ref: library/codecs encodings-encodings-package7737966 +Ref: 241d7737966 +Ref: library/codecs module-encodings7737966 +Ref: 517737966 +Ref: library/codecs encodings normalize_encoding7738104 +Ref: 7f77738104 +Ref: library/codecs encodings search_function7738680 +Ref: 241e7738680 +Ref: library/codecs encodings CodecRegistryError7739424 +Ref: 241f7739424 +Node: encodings idna — Internationalized Domain Names in Applications7739523 +Ref: library/codecs encodings-idna-internationalized-domain-names-in-applications7739756 +Ref: 24207739756 +Ref: library/codecs module-encodings idna7739756 +Ref: 527739756 +Ref: library/codecs encodings idna nameprep7742371 +Ref: 24217742371 +Ref: library/codecs encodings idna ToASCII7742559 +Ref: 24227742559 +Ref: library/codecs encodings idna ToUnicode7742719 +Ref: 24237742719 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-17742866 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-27742925 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-37742984 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-47743043 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-57743102 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-67743141 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-77743212 +Ref: encodings idna — Internationalized Domain Names in Applications-Footnote-87743271 +Node: encodings mbcs — Windows ANSI codepage7743330 +Ref: library/codecs encodings-mbcs-windows-ansi-codepage7743586 +Ref: 24247743586 +Ref: library/codecs module-encodings mbcs7743586 +Ref: 537743586 +Node: encodings utf_8_sig — UTF-8 codec with BOM signature7743979 +Ref: library/codecs encodings-utf-8-sig-utf-8-codec-with-bom-signature7744161 +Ref: 24257744161 +Ref: library/codecs module-encodings utf_8_sig7744161 +Ref: 547744161 +Node: Data Types7744606 +Ref: library/datatypes doc7744750 +Ref: 24267744750 +Ref: library/datatypes data-types7744750 +Ref: 24277744750 +Ref: library/datatypes datatypes7744750 +Ref: 24287744750 +Node: datetime — Basic date and time types7746129 +Ref: library/datetime doc7746258 +Ref: 24297746258 +Ref: library/datetime datetime-basic-date-and-time-types7746258 +Ref: 242a7746258 +Ref: library/datetime module-datetime7746258 +Ref: 307746258 +Ref: datetime — Basic date and time types-Footnote-17747566 +Ref: datetime — Basic date and time types-Footnote-27747634 +Ref: datetime — Basic date and time types-Footnote-37747685 +Node: Aware and Naive Objects7747728 +Ref: library/datetime aware-and-naive-objects7747844 +Ref: 242c7747844 +Ref: library/datetime datetime-naive-aware7747844 +Ref: 242d7747844 +Ref: Aware and Naive Objects-Footnote-17749766 +Node: Constants7749823 +Ref: library/datetime constants7749963 +Ref: 242e7749963 +Ref: library/datetime datetime MINYEAR7750060 +Ref: 242f7750060 +Ref: library/datetime datetime MAXYEAR7750214 +Ref: 24307750214 +Ref: library/datetime datetime UTC7750370 +Ref: 4ea7750370 +Node: Available Types7750506 +Ref: library/datetime available-types7750640 +Ref: 24317750640 +Node: Common Properties7752402 +Ref: library/datetime common-properties7752522 +Ref: 24427752522 +Node: Determining if an Object is Aware or Naive7752944 +Ref: library/datetime determining-if-an-object-is-aware-or-naive7753064 +Ref: 24437753064 +Node: timedelta Objects7753815 +Ref: library/datetime datetime-timedelta7753952 +Ref: 24447753952 +Ref: library/datetime timedelta-objects7753952 +Ref: 24457753952 +Ref: library/datetime datetime timedelta7754147 +Ref: 9cf7754147 +Ref: library/datetime datetime timedelta min7756879 +Ref: 24467756879 +Ref: library/datetime datetime timedelta max7756997 +Ref: 24477756997 +Ref: library/datetime datetime timedelta resolution7757179 +Ref: 24487757179 +Ref: library/datetime datetime timedelta days7757550 +Ref: 24497757550 +Ref: library/datetime datetime timedelta seconds7757635 +Ref: 244a7757635 +Ref: library/datetime datetime timedelta microseconds7758161 +Ref: 244b7758161 +Ref: library/datetime datetime timedelta total_seconds7764085 +Ref: 12f97764085 +Node: Examples of usage timedelta7764609 +Ref: library/datetime examples-of-usage-timedelta7764690 +Ref: 244c7764690 +Node: date Objects7765631 +Ref: library/datetime date-objects7765769 +Ref: 244d7765769 +Ref: library/datetime datetime-date7765769 +Ref: 244e7765769 +Ref: library/datetime datetime date7766091 +Ref: 1cd7766091 +Ref: library/datetime datetime date today7766510 +Ref: 14957766510 +Ref: library/datetime datetime date fromtimestamp7766653 +Ref: 160a7766653 +Ref: library/datetime datetime date fromordinal7767591 +Ref: 244f7767591 +Ref: library/datetime datetime date fromisoformat7767928 +Ref: 6117767928 +Ref: library/datetime datetime date fromisocalendar7768837 +Ref: 9eb7768837 +Ref: library/datetime datetime date min7769130 +Ref: 24507769130 +Ref: library/datetime datetime date max7769221 +Ref: 24517769221 +Ref: library/datetime datetime date resolution7769312 +Ref: 24527769312 +Ref: library/datetime datetime date year7769479 +Ref: 24327769479 +Ref: library/datetime datetime date month7769576 +Ref: 24337769576 +Ref: library/datetime datetime date day7769637 +Ref: 24347769637 +Ref: library/datetime datetime date replace7772470 +Ref: 167d7772470 +Ref: library/datetime datetime date timetuple7772926 +Ref: 24537772926 +Ref: library/datetime datetime date toordinal7773415 +Ref: 24547773415 +Ref: library/datetime datetime date weekday7773641 +Ref: 24557773641 +Ref: library/datetime datetime date isoweekday7773866 +Ref: 24567773866 +Ref: library/datetime datetime date isocalendar7774125 +Ref: 8f47774125 +Ref: library/datetime datetime date isoformat7775200 +Ref: 24577775200 +Ref: library/datetime datetime date __str__7775426 +Ref: 24587775426 +Ref: library/datetime datetime date ctime7775532 +Ref: 24597775532 +Ref: library/datetime datetime date strftime7776006 +Ref: c917776006 +Ref: library/datetime datetime date __format__7776307 +Ref: 245b7776307 +Ref: date Objects-Footnote-17776758 +Ref: date Objects-Footnote-27777067 +Node: Examples of Usage date7777283 +Ref: library/datetime examples-of-usage-date7777354 +Ref: 245c7777354 +Node: datetime Objects7779255 +Ref: library/datetime datetime-datetime7779388 +Ref: 245d7779388 +Ref: library/datetime datetime-objects7779388 +Ref: 245e7779388 +Ref: library/datetime datetime datetime7779837 +Ref: 1cc7779837 +Ref: library/datetime datetime datetime today7780701 +Ref: 245f7780701 +Ref: library/datetime datetime datetime now7781066 +Ref: 4e87781066 +Ref: library/datetime datetime datetime utcnow7781894 +Ref: 2f67781894 +Ref: library/datetime datetime datetime fromtimestamp7782737 +Ref: 4e97782737 +Ref: library/datetime datetime datetime utcfromtimestamp7784452 +Ref: 2f77784452 +Ref: library/datetime datetime datetime fromordinal7786236 +Ref: 24607786236 +Ref: library/datetime datetime datetime combine7786641 +Ref: c927786641 +Ref: library/datetime datetime datetime fromisoformat7787449 +Ref: 6137787449 +Ref: library/datetime datetime datetime fromisocalendar7789549 +Ref: 9ec7789549 +Ref: library/datetime datetime datetime strptime7789929 +Ref: 160b7789929 +Ref: library/datetime datetime datetime min7791387 +Ref: 17db7791387 +Ref: library/datetime datetime datetime max7791519 +Ref: 24617791519 +Ref: library/datetime datetime datetime resolution7791671 +Ref: 24627791671 +Ref: library/datetime datetime datetime year7791866 +Ref: 243a7791866 +Ref: library/datetime datetime datetime month7791967 +Ref: 243b7791967 +Ref: library/datetime datetime datetime day7792032 +Ref: 243c7792032 +Ref: library/datetime datetime datetime hour7792143 +Ref: 243d7792143 +Ref: library/datetime datetime datetime minute7792199 +Ref: 243e7792199 +Ref: library/datetime datetime datetime second7792257 +Ref: 243f7792257 +Ref: library/datetime datetime datetime microsecond7792315 +Ref: 24407792315 +Ref: library/datetime datetime datetime tzinfo7792383 +Ref: 24417792383 +Ref: library/datetime datetime datetime fold7792544 +Ref: c577792544 +Ref: library/datetime datetime datetime date7797561 +Ref: 24637797561 +Ref: library/datetime datetime datetime time7797659 +Ref: 24647797659 +Ref: library/datetime datetime datetime timetz7797966 +Ref: 24657797966 +Ref: library/datetime datetime datetime replace7798255 +Ref: 14967798255 +Ref: library/datetime datetime datetime astimezone7798909 +Ref: 9d07798909 +Ref: library/datetime datetime datetime utcoffset7801262 +Ref: 24667801262 +Ref: library/datetime datetime datetime dst7801656 +Ref: 24677801656 +Ref: library/datetime datetime datetime tzname7802038 +Ref: 24697802038 +Ref: library/datetime datetime datetime timetuple7802271 +Ref: 246a7802271 +Ref: library/datetime datetime datetime utctimetuple7803114 +Ref: 246c7803114 +Ref: library/datetime datetime datetime toordinal7804283 +Ref: 246d7804283 +Ref: library/datetime datetime datetime timestamp7804425 +Ref: 10937804425 +Ref: library/datetime datetime datetime weekday7805970 +Ref: 246e7805970 +Ref: library/datetime datetime datetime isoweekday7806174 +Ref: 246f7806174 +Ref: library/datetime datetime datetime isocalendar7806407 +Ref: 8f57806407 +Ref: library/datetime datetime datetime isoformat7806599 +Ref: b307806599 +Ref: library/datetime datetime datetime __str__7809588 +Ref: 24707809588 +Ref: library/datetime datetime datetime ctime7809731 +Ref: 24717809731 +Ref: library/datetime datetime datetime strftime7810364 +Ref: c907810364 +Ref: library/datetime datetime datetime __format__7810604 +Ref: 24727810604 +Node: Examples of Usage datetime7811042 +Ref: library/datetime examples-of-usage-datetime7811121 +Ref: 24737811121 +Node: time Objects7815449 +Ref: library/datetime datetime-time7815584 +Ref: 24747815584 +Ref: library/datetime time-objects7815584 +Ref: 24757815584 +Ref: library/datetime datetime time7815792 +Ref: 1ce7815792 +Ref: library/datetime datetime time min7816446 +Ref: 24767816446 +Ref: library/datetime datetime time max7816545 +Ref: 24777816545 +Ref: library/datetime datetime time resolution7816655 +Ref: 24787816655 +Ref: library/datetime datetime time hour7816923 +Ref: 24357816923 +Ref: library/datetime datetime time minute7816975 +Ref: 24367816975 +Ref: library/datetime datetime time second7817029 +Ref: 24377817029 +Ref: library/datetime datetime time microsecond7817083 +Ref: 24387817083 +Ref: library/datetime datetime time tzinfo7817147 +Ref: 24397817147 +Ref: library/datetime datetime time fold7817298 +Ref: 24797817298 +Ref: library/datetime datetime time fromisoformat7818894 +Ref: 6127818894 +Ref: library/datetime datetime time replace7820483 +Ref: 167e7820483 +Ref: library/datetime datetime time isoformat7821068 +Ref: 247a7821068 +Ref: library/datetime datetime time __str__7823084 +Ref: 247c7823084 +Ref: library/datetime datetime time strftime7823190 +Ref: 17827823190 +Ref: library/datetime datetime time __format__7823414 +Ref: 247d7823414 +Ref: library/datetime datetime time utcoffset7823769 +Ref: 247b7823769 +Ref: library/datetime datetime time dst7824159 +Ref: 247e7824159 +Ref: library/datetime datetime time tzname7824538 +Ref: 247f7824538 +Ref: time Objects-Footnote-17824867 +Node: Examples of Usage time7824932 +Ref: library/datetime examples-of-usage-time7825003 +Ref: 24807825003 +Node: tzinfo Objects7825885 +Ref: library/datetime datetime-tzinfo7826020 +Ref: 24817826020 +Ref: library/datetime tzinfo-objects7826020 +Ref: 24827826020 +Ref: library/datetime datetime tzinfo7826077 +Ref: 5da7826077 +Ref: library/datetime datetime tzinfo utcoffset7827711 +Ref: 24837827711 +Ref: library/datetime datetime tzinfo dst7828941 +Ref: 24847828941 +Ref: library/datetime datetime tzinfo tzname7831538 +Ref: 24857831538 +Ref: library/datetime datetime tzinfo fromutc7833687 +Ref: 24687833687 +Ref: tzinfo Objects-Footnote-17846229 +Node: timezone Objects7846269 +Ref: library/datetime datetime-timezone7846422 +Ref: 24867846422 +Ref: library/datetime timezone-objects7846422 +Ref: 24877846422 +Ref: library/datetime datetime timezone7846845 +Ref: 10b57846845 +Ref: library/datetime datetime timezone utcoffset7847475 +Ref: 24887847475 +Ref: library/datetime datetime timezone tzname7847866 +Ref: 24897847866 +Ref: library/datetime datetime timezone dst7848545 +Ref: 248a7848545 +Ref: library/datetime datetime timezone fromutc7848609 +Ref: 248b7848609 +Ref: library/datetime datetime timezone utc7848804 +Ref: 6107848804 +Node: strftime and strptime Behavior7848888 +Ref: library/datetime strftime-and-strptime-behavior7849018 +Ref: 248c7849018 +Ref: library/datetime strftime-strptime-behavior7849018 +Ref: 17c97849018 +Ref: library/datetime format-codes7851108 +Ref: 242b7851108 +Node: strftime and strptime Format Codes7851217 +Ref: library/datetime strftime-and-strptime-format-codes7851343 +Ref: 248d7851343 +Ref: strftime and strptime Format Codes-Footnote-17862254 +Node: Technical Detail7862302 +Ref: library/datetime technical-detail7862428 +Ref: 248e7862428 +Ref: Technical Detail-Footnote-17869368 +Ref: Technical Detail-Footnote-27869468 +Node: zoneinfo — IANA time zone support7869523 +Ref: library/zoneinfo doc7869708 +Ref: 248f7869708 +Ref: library/zoneinfo module-zoneinfo7869708 +Ref: 1347869708 +Ref: library/zoneinfo zoneinfo-iana-time-zone-support7869708 +Ref: 24907869708 +Ref: zoneinfo — IANA time zone support-Footnote-17870940 +Ref: zoneinfo — IANA time zone support-Footnote-27871005 +Ref: zoneinfo — IANA time zone support-Footnote-37871047 +Ref: zoneinfo — IANA time zone support-Footnote-47871088 +Node: Using ZoneInfo7871129 +Ref: library/zoneinfo using-zoneinfo7871236 +Ref: 24917871236 +Ref: Using ZoneInfo-Footnote-17873184 +Node: Data sources7873226 +Ref: library/zoneinfo data-sources7873360 +Ref: 24927873360 +Ref: Data sources-Footnote-17874044 +Node: Configuring the data sources7874085 +Ref: library/zoneinfo configuring-the-data-sources7874162 +Ref: 24937874162 +Ref: library/zoneinfo zoneinfo-data-configuration7874162 +Ref: 24947874162 +Node: Compile-time configuration7874915 +Ref: library/zoneinfo compile-time-configuration7875040 +Ref: 24987875040 +Ref: library/zoneinfo zoneinfo-data-compile-time-config7875040 +Ref: 1d737875040 +Node: Environment configuration7875775 +Ref: library/zoneinfo environment-configuration7875930 +Ref: 24997875930 +Ref: library/zoneinfo zoneinfo-data-environment-var7875930 +Ref: 24957875930 +Ref: library/zoneinfo envvar-PYTHONTZPATH7876249 +Ref: 249a7876249 +Node: Runtime configuration7876910 +Ref: library/zoneinfo runtime-configuration7877030 +Ref: 249c7877030 +Ref: library/zoneinfo zoneinfo-data-runtime-config7877030 +Ref: 24967877030 +Node: The ZoneInfo class7877398 +Ref: library/zoneinfo the-zoneinfo-class7877530 +Ref: 249d7877530 +Ref: library/zoneinfo zoneinfo ZoneInfo7877593 +Ref: 8de7877593 +Ref: library/zoneinfo zoneinfo ZoneInfo from_file7878473 +Ref: 249f7878473 +Ref: library/zoneinfo zoneinfo ZoneInfo no_cache7879006 +Ref: 24a17879006 +Ref: library/zoneinfo zoneinfo ZoneInfo clear_cache7879728 +Ref: 249e7879728 +Ref: library/zoneinfo zoneinfo ZoneInfo key7880525 +Ref: 24a27880525 +Node: String representations7881381 +Ref: library/zoneinfo string-representations7881487 +Ref: 24a47881487 +Node: Pickle serialization7882296 +Ref: library/zoneinfo pickle-serialization7882402 +Ref: 24a57882402 +Ref: library/zoneinfo pickling7882402 +Ref: 24a07882402 +Node: Functions<3>7884812 +Ref: library/zoneinfo functions7884939 +Ref: 24a67884939 +Ref: library/zoneinfo zoneinfo available_timezones7884978 +Ref: 195c7884978 +Ref: library/zoneinfo zoneinfo reset_tzpath7885954 +Ref: 24977885954 +Node: Globals7886650 +Ref: library/zoneinfo globals7886782 +Ref: 24a77886782 +Ref: library/zoneinfo zoneinfo TZPATH7886817 +Ref: 1d727886817 +Node: Exceptions and warnings7887592 +Ref: library/zoneinfo exceptions-and-warnings7887703 +Ref: 24a87887703 +Ref: library/zoneinfo zoneinfo ZoneInfoNotFoundError7887770 +Ref: 152a7887770 +Ref: library/zoneinfo zoneinfo InvalidTZPathWarning7888001 +Ref: 249b7888001 +Node: calendar — General calendar-related functions7888178 +Ref: library/calendar doc7888360 +Ref: 24a97888360 +Ref: library/calendar calendar-general-calendar-related-functions7888360 +Ref: 24aa7888360 +Ref: library/calendar module-calendar7888360 +Ref: 147888360 +Ref: library/calendar calendar Calendar7889562 +Ref: 24ac7889562 +Ref: library/calendar calendar Calendar firstweekday7890115 +Ref: 24af7890115 +Ref: library/calendar calendar Calendar getfirstweekday7890357 +Ref: 24b17890357 +Ref: library/calendar calendar Calendar setfirstweekday7890542 +Ref: 24b07890542 +Ref: library/calendar calendar Calendar iterweekdays7890762 +Ref: 24b27890762 +Ref: library/calendar calendar Calendar itermonthdates7891011 +Ref: c197891011 +Ref: library/calendar calendar Calendar itermonthdays7891383 +Ref: 24b37891383 +Ref: library/calendar calendar Calendar itermonthdays27891768 +Ref: 24b47891768 +Ref: library/calendar calendar Calendar itermonthdays37892118 +Ref: c1a7892118 +Ref: library/calendar calendar Calendar itermonthdays47892500 +Ref: c1b7892500 +Ref: library/calendar calendar Calendar monthdatescalendar7892902 +Ref: 24b57892902 +Ref: library/calendar calendar Calendar monthdays2calendar7893122 +Ref: 24b67893122 +Ref: library/calendar calendar Calendar monthdayscalendar7893350 +Ref: 24b77893350 +Ref: library/calendar calendar Calendar yeardatescalendar7893537 +Ref: 24b87893537 +Ref: library/calendar calendar Calendar yeardays2calendar7893931 +Ref: 24b97893931 +Ref: library/calendar calendar Calendar yeardayscalendar7894247 +Ref: 24ba7894247 +Ref: library/calendar calendar TextCalendar7894532 +Ref: 24bb7894532 +Ref: library/calendar calendar TextCalendar formatday7894716 +Ref: 24bc7894716 +Ref: library/calendar calendar TextCalendar formatweek7895024 +Ref: 24bd7895024 +Ref: library/calendar calendar TextCalendar formatweekday7895369 +Ref: 24be7895369 +Ref: library/calendar calendar TextCalendar formatweekheader7895673 +Ref: 24bf7895673 +Ref: library/calendar calendar TextCalendar formatmonth7895947 +Ref: 24c07895947 +Ref: library/calendar calendar TextCalendar formatmonthname7896396 +Ref: 24c17896396 +Ref: library/calendar calendar TextCalendar prmonth7896800 +Ref: 24c27896800 +Ref: library/calendar calendar TextCalendar formatyear7896946 +Ref: 24c37896946 +Ref: library/calendar calendar TextCalendar pryear7897483 +Ref: 24c47897483 +Ref: library/calendar calendar HTMLCalendar7897638 +Ref: b237897638 +Ref: library/calendar calendar HTMLCalendar formatmonth7897809 +Ref: 24c57897809 +Ref: library/calendar calendar HTMLCalendar formatyear7898059 +Ref: 24c67898059 +Ref: library/calendar calendar HTMLCalendar formatyearpage7898240 +Ref: 24c77898240 +Ref: library/calendar calendar HTMLCalendar formatmonthname7898753 +Ref: 24c87898753 +Ref: library/calendar calendar HTMLCalendar cssclasses7899127 +Ref: 24c97899127 +Ref: library/calendar calendar HTMLCalendar cssclass_noday7899541 +Ref: 24ca7899541 +Ref: library/calendar calendar HTMLCalendar cssclasses_weekday_head7899702 +Ref: 24cb7899702 +Ref: library/calendar calendar HTMLCalendar cssclass_month_head7899917 +Ref: 24cc7899917 +Ref: library/calendar calendar HTMLCalendar cssclass_month7900120 +Ref: 24cd7900120 +Ref: library/calendar calendar HTMLCalendar cssclass_year7900329 +Ref: 24ce7900329 +Ref: library/calendar calendar HTMLCalendar cssclass_year_head7900544 +Ref: 24cf7900544 +Ref: library/calendar calendar LocaleTextCalendar7901453 +Ref: 73f7901453 +Ref: library/calendar calendar LocaleHTMLCalendar7901694 +Ref: 7407901694 +Ref: library/calendar calendar setfirstweekday7902278 +Ref: 24ab7902278 +Ref: library/calendar calendar firstweekday7902752 +Ref: 24d57902752 +Ref: library/calendar calendar isleap7902862 +Ref: 24d67902862 +Ref: library/calendar calendar leapdays7902990 +Ref: 24d77902990 +Ref: library/calendar calendar weekday7903215 +Ref: 24d87903215 +Ref: library/calendar calendar weekheader7903414 +Ref: 24d97903414 +Ref: library/calendar calendar monthrange7903574 +Ref: 24da7903574 +Ref: library/calendar calendar monthcalendar7903743 +Ref: 24db7903743 +Ref: library/calendar calendar prmonth7904024 +Ref: 24dc7904024 +Ref: library/calendar calendar month7904156 +Ref: 159f7904156 +Ref: library/calendar calendar prcal7904356 +Ref: 24dd7904356 +Ref: library/calendar calendar calendar7904500 +Ref: 24de7904500 +Ref: library/calendar calendar timegm7904722 +Ref: 24df7904722 +Ref: library/calendar calendar day_name7905199 +Ref: 24e07905199 +Ref: library/calendar calendar day_abbr7905498 +Ref: 24e17905498 +Ref: library/calendar calendar MONDAY7905777 +Ref: 24ad7905777 +Ref: library/calendar calendar TUESDAY7905803 +Ref: 24d07905803 +Ref: library/calendar calendar WEDNESDAY7905830 +Ref: 24d17905830 +Ref: library/calendar calendar THURSDAY7905859 +Ref: 24d27905859 +Ref: library/calendar calendar FRIDAY7905887 +Ref: 24d37905887 +Ref: library/calendar calendar SATURDAY7905913 +Ref: 24d47905913 +Ref: library/calendar calendar SUNDAY7905941 +Ref: 24ae7905941 +Ref: library/calendar calendar Day7906101 +Ref: 47e7906101 +Ref: library/calendar calendar month_name7906348 +Ref: 24e27906348 +Ref: library/calendar calendar month_abbr7906816 +Ref: 24e37906816 +Ref: library/calendar calendar JANUARY7907258 +Ref: 2f37907258 +Ref: library/calendar calendar FEBRUARY7907285 +Ref: 2f47907285 +Ref: library/calendar calendar MARCH7907313 +Ref: 24e47907313 +Ref: library/calendar calendar APRIL7907338 +Ref: 24e57907338 +Ref: library/calendar calendar MAY7907363 +Ref: 24e67907363 +Ref: library/calendar calendar JUNE7907386 +Ref: 24e77907386 +Ref: library/calendar calendar JULY7907410 +Ref: 24e87907410 +Ref: library/calendar calendar AUGUST7907434 +Ref: 24e97907434 +Ref: library/calendar calendar SEPTEMBER7907460 +Ref: 24ea7907460 +Ref: library/calendar calendar OCTOBER7907489 +Ref: 24eb7907489 +Ref: library/calendar calendar NOVEMBER7907516 +Ref: 24ec7907516 +Ref: library/calendar calendar DECEMBER7907544 +Ref: 24ed7907544 +Ref: library/calendar calendar Month7907712 +Ref: 47d7907712 +Ref: library/calendar calendar IllegalMonthError7908031 +Ref: 159e7908031 +Ref: library/calendar calendar IllegalMonthError month7908207 +Ref: 24ee7908207 +Ref: library/calendar calendar IllegalWeekdayError7908271 +Ref: 24ef7908271 +Ref: library/calendar calendar IllegalWeekdayError weekday7908452 +Ref: 24f07908452 +Ref: calendar — General calendar-related functions-Footnote-17908814 +Node: Command-Line Usage7908882 +Ref: library/calendar calendar-cli7908984 +Ref: 24f17908984 +Ref: library/calendar command-line-usage7908984 +Ref: 24f27908984 +Ref: library/calendar cmdoption-calendar-help7911728 +Ref: 24f37911728 +Ref: library/calendar cmdoption-calendar-h7911728 +Ref: 24f47911728 +Ref: library/calendar cmdoption-calendar-locale7911790 +Ref: 24f57911790 +Ref: library/calendar cmdoption-calendar-L7911790 +Ref: 24f67911790 +Ref: library/calendar cmdoption-calendar-encoding7911910 +Ref: 24f77911910 +Ref: library/calendar cmdoption-calendar-e7911910 +Ref: 24f87911910 +Ref: library/calendar cmdoption-calendar-type7912067 +Ref: 24f97912067 +Ref: library/calendar cmdoption-calendar-t7912067 +Ref: 24fa7912067 +Ref: library/calendar cmdoption-calendar-first-weekday7912189 +Ref: 24fb7912189 +Ref: library/calendar cmdoption-calendar-f7912189 +Ref: 24fc7912189 +Ref: library/calendar cmdoption-calendar-arg-year7912391 +Ref: 24fd7912391 +Ref: library/calendar cmdoption-calendar-arg-month7912482 +Ref: 24fe7912482 +Ref: library/calendar cmdoption-calendar-width7912734 +Ref: 24ff7912734 +Ref: library/calendar cmdoption-calendar-w7912734 +Ref: 25007912734 +Ref: library/calendar cmdoption-calendar-lines7912932 +Ref: 25017912932 +Ref: library/calendar cmdoption-calendar-l7912932 +Ref: 25027912932 +Ref: library/calendar cmdoption-calendar-spacing7913123 +Ref: 25037913123 +Ref: library/calendar cmdoption-calendar-s7913123 +Ref: 25047913123 +Ref: library/calendar cmdoption-calendar-months7913266 +Ref: 25057913266 +Ref: library/calendar cmdoption-calendar-m7913266 +Ref: 25067913266 +Ref: library/calendar cmdoption-calendar-css7913388 +Ref: 25077913388 +Ref: library/calendar cmdoption-calendar-c7913388 +Ref: 25087913388 +Node: collections — Container datatypes7913585 +Ref: library/collections doc7913788 +Ref: 25097913788 +Ref: library/collections collections-container-datatypes7913788 +Ref: 250a7913788 +Ref: library/collections module-collections7913788 +Ref: 1d7913788 +Ref: collections — Container datatypes-Footnote-17915779 +Node: ChainMap objects7915860 +Ref: library/collections chainmap-objects7915972 +Ref: 250b7915972 +Ref: library/collections collections ChainMap7916362 +Ref: c1c7916362 +Ref: library/collections collections ChainMap maps7917395 +Ref: 250c7917395 +Ref: library/collections collections ChainMap new_child7917698 +Ref: f1e7917698 +Ref: library/collections collections ChainMap parents7918512 +Ref: 250d7918512 +Ref: ChainMap objects-Footnote-17920475 +Ref: ChainMap objects-Footnote-27920517 +Ref: ChainMap objects-Footnote-37920612 +Ref: ChainMap objects-Footnote-47920659 +Ref: ChainMap objects-Footnote-57920738 +Ref: ChainMap objects-Footnote-67920835 +Node: ChainMap Examples and Recipes7920888 +Ref: library/collections chainmap-examples-and-recipes7920970 +Ref: 250e7920970 +Node: Counter objects7924084 +Ref: library/collections counter-objects7924218 +Ref: 250f7924218 +Ref: library/collections collections Counter7924932 +Ref: 108b7924932 +Ref: library/collections collections Counter elements7926925 +Ref: 12f77926925 +Ref: library/collections collections Counter most_common7927349 +Ref: 12f67927349 +Ref: library/collections collections Counter subtract7927810 +Ref: 11d07927810 +Ref: library/collections collections Counter total7928366 +Ref: 25107928366 +Ref: library/collections collections Counter fromkeys7928703 +Ref: 25117928703 +Ref: library/collections collections Counter update7928833 +Ref: 25127928833 +Ref: Counter objects-Footnote-17933946 +Ref: Counter objects-Footnote-27934025 +Ref: Counter objects-Footnote-37934072 +Node: deque objects7934165 +Ref: library/collections deque-objects7934302 +Ref: 25137934302 +Ref: library/collections collections deque7934355 +Ref: 5d87934355 +Ref: library/collections collections deque append7935804 +Ref: 25147935804 +Ref: library/collections collections deque appendleft7935884 +Ref: 25157935884 +Ref: library/collections collections deque clear7935967 +Ref: 25167935967 +Ref: library/collections collections deque copy7936066 +Ref: dd37936066 +Ref: library/collections collections deque count7936172 +Ref: 11d27936172 +Ref: library/collections collections deque extend7936293 +Ref: 25177936293 +Ref: library/collections collections deque extendleft7936435 +Ref: 25187936435 +Ref: library/collections collections deque index7936682 +Ref: dd17936682 +Ref: library/collections collections deque insert7936956 +Ref: dd27936956 +Ref: library/collections collections deque pop7937204 +Ref: 25197937204 +Ref: library/collections collections deque popleft7937375 +Ref: 251a7937375 +Ref: library/collections collections deque remove7937549 +Ref: 190b7937549 +Ref: library/collections collections deque reverse7937690 +Ref: 11d37937690 +Ref: library/collections collections deque rotate7937844 +Ref: 18d67937844 +Ref: library/collections collections deque maxlen7938253 +Ref: 12f87938253 +Node: deque Recipes7940912 +Ref: library/collections deque-recipes7940975 +Ref: 251b7940975 +Ref: deque Recipes-Footnote-17943439 +Node: defaultdict objects7943500 +Ref: library/collections defaultdict-objects7943678 +Ref: 251c7943678 +Ref: library/collections collections defaultdict7943743 +Ref: 11af7943743 +Ref: library/collections collections defaultdict __missing__7944531 +Ref: 251e7944531 +Ref: library/collections collections defaultdict default_factory7945738 +Ref: 251d7945738 +Ref: defaultdict objects-Footnote-17946160 +Node: defaultdict Examples7946202 +Ref: library/collections defaultdict-examples7946278 +Ref: 251f7946278 +Node: namedtuple Factory Function for Tuples with Named Fields7948953 +Ref: library/collections namedtuple-factory-function-for-tuples-with-named-fields7949137 +Ref: 25207949137 +Ref: library/collections collections namedtuple7949518 +Ref: 1ca7949518 +Ref: library/collections collections somenamedtuple _make7953557 +Ref: 25227953557 +Ref: library/collections collections somenamedtuple _asdict7953788 +Ref: 9e07953788 +Ref: library/collections collections somenamedtuple _replace7954474 +Ref: 25237954474 +Ref: library/collections collections somenamedtuple _fields7955093 +Ref: 25247955093 +Ref: library/collections collections somenamedtuple _field_defaults7955589 +Ref: 25217955589 +Node: OrderedDict objects7958358 +Ref: library/collections ordereddict-objects7958539 +Ref: 25257958539 +Ref: library/collections collections OrderedDict7960962 +Ref: 5d77960962 +Ref: library/collections collections OrderedDict popitem7961160 +Ref: 12e07961160 +Ref: library/collections collections OrderedDict move_to_end7961441 +Ref: 11d17961441 +Ref: library/collections collections-ordereddict-eq7962160 +Ref: 15c87962160 +Ref: OrderedDict objects-Footnote-17963090 +Ref: OrderedDict objects-Footnote-27963132 +Node: OrderedDict Examples and Recipes7963174 +Ref: library/collections ordereddict-examples-and-recipes7963262 +Ref: 25277963262 +Node: UserDict objects7966303 +Ref: library/collections userdict-objects7966444 +Ref: 25287966444 +Ref: library/collections collections UserDict7966810 +Ref: 19937966810 +Ref: library/collections collections UserDict data7967403 +Ref: 25297967403 +Node: UserList objects7967531 +Ref: library/collections userlist-objects7967671 +Ref: 252a7967671 +Ref: library/collections collections UserList7968186 +Ref: 14ae7968186 +Ref: library/collections collections UserList data7968791 +Ref: 252b7968791 +Node: UserString objects7969585 +Ref: library/collections userstring-objects7969700 +Ref: 252c7969700 +Ref: library/collections collections UserString7970062 +Ref: dd47970062 +Ref: library/collections collections UserString data7970656 +Ref: 252d7970656 +Node: collections abc — Abstract Base Classes for Containers7970956 +Ref: library/collections abc doc7971142 +Ref: 252e7971142 +Ref: library/collections abc collections-abc-abstract-base-classes-for-containers7971142 +Ref: 252f7971142 +Ref: library/collections abc module-collections abc7971142 +Ref: 1e7971142 +Ref: collections abc — Abstract Base Classes for Containers-Footnote-17975158 +Ref: collections abc — Abstract Base Classes for Containers-Footnote-27975235 +Node: Collections Abstract Base Classes7975277 +Ref: library/collections abc collections-abstract-base-classes7975471 +Ref: 8757975471 +Ref: library/collections abc id17975471 +Ref: 25307975471 +Ref: Collections Abstract Base Classes-Footnote-17985178 +Ref: Collections Abstract Base Classes-Footnote-27985467 +Ref: Collections Abstract Base Classes-Footnote-37985756 +Ref: Collections Abstract Base Classes-Footnote-47986045 +Ref: Collections Abstract Base Classes-Footnote-57986397 +Ref: Collections Abstract Base Classes-Footnote-67986686 +Ref: Collections Abstract Base Classes-Footnote-77986975 +Ref: Collections Abstract Base Classes-Footnote-87987264 +Ref: Collections Abstract Base Classes-Footnote-97987553 +Ref: Collections Abstract Base Classes-Footnote-107987842 +Ref: Collections Abstract Base Classes-Footnote-117988132 +Ref: Collections Abstract Base Classes-Footnote-127988422 +Ref: Collections Abstract Base Classes-Footnote-137988712 +Ref: Collections Abstract Base Classes-Footnote-147989002 +Ref: Collections Abstract Base Classes-Footnote-157989292 +Ref: Collections Abstract Base Classes-Footnote-167989582 +Node: Collections Abstract Base Classes – Detailed Descriptions7989872 +Ref: library/collections abc collections-abstract-base-classes-detailed-descriptions7990095 +Ref: 25327990095 +Ref: library/collections abc collections abc Container7990230 +Ref: 224f7990230 +Ref: library/collections abc collections abc Hashable7990348 +Ref: 4f17990348 +Ref: library/collections abc collections abc Sized7990455 +Ref: 4f27990455 +Ref: library/collections abc collections abc Callable7990559 +Ref: 7e57990559 +Ref: library/collections abc collections abc Iterable7990784 +Ref: 224d7990784 +Ref: library/collections abc collections abc Collection7991267 +Ref: c887991267 +Ref: library/collections abc collections abc Iterator7991382 +Ref: 224e7991382 +Ref: library/collections abc collections abc Reversible7991578 +Ref: c897991578 +Ref: library/collections abc collections abc Generator7991739 +Ref: dda7991739 +Ref: library/collections abc collections abc Sequence7992156 +Ref: 11b67992156 +Ref: library/collections abc collections abc MutableSequence7992192 +Ref: 1a17992192 +Ref: library/collections abc collections abc ByteString7992235 +Ref: 2c57992235 +Ref: library/collections abc collections abc Set7993305 +Ref: 22457993305 +Ref: library/collections abc collections abc MutableSet7993336 +Ref: 22507993336 +Ref: library/collections abc collections abc Mapping7993430 +Ref: 8c97993430 +Ref: library/collections abc collections abc MutableMapping7993465 +Ref: 10a27993465 +Ref: library/collections abc collections abc MappingView7993567 +Ref: 22517993567 +Ref: library/collections abc collections abc ItemsView7993606 +Ref: 22537993606 +Ref: library/collections abc collections abc KeysView7993643 +Ref: 22527993643 +Ref: library/collections abc collections abc ValuesView7993679 +Ref: 22547993679 +Ref: library/collections abc collections abc Awaitable7993785 +Ref: ddb7993785 +Ref: library/collections abc collections abc Coroutine7994543 +Ref: ddc7994543 +Ref: library/collections abc collections abc AsyncIterable7995594 +Ref: dde7995594 +Ref: library/collections abc collections abc AsyncIterator7995793 +Ref: ddd7995793 +Ref: library/collections abc collections abc AsyncGenerator7996009 +Ref: c8a7996009 +Ref: library/collections abc collections abc Buffer7996337 +Ref: 2c67996337 +Ref: Collections Abstract Base Classes – Detailed Descriptions-Footnote-17996576 +Ref: Collections Abstract Base Classes – Detailed Descriptions-Footnote-27996618 +Ref: Collections Abstract Base Classes – Detailed Descriptions-Footnote-37996660 +Ref: Collections Abstract Base Classes – Detailed Descriptions-Footnote-47996702 +Node: Examples and Recipes7996744 +Ref: library/collections abc examples-and-recipes7996925 +Ref: 25357996925 +Ref: Examples and Recipes-Footnote-17999896 +Ref: Examples and Recipes-Footnote-27999949 +Node: heapq — Heap queue algorithm7999991 +Ref: library/heapq doc8000178 +Ref: 25368000178 +Ref: library/heapq heapq-heap-queue-algorithm8000178 +Ref: 25378000178 +Ref: library/heapq module-heapq8000178 +Ref: 698000178 +Ref: library/heapq heapq heappush8001784 +Ref: 14858001784 +Ref: library/heapq heapq heappop8001909 +Ref: 14868001909 +Ref: library/heapq heapq heappushpop8002174 +Ref: 25398002174 +Ref: library/heapq heapq heapify8002447 +Ref: 25388002447 +Ref: library/heapq heapq heapreplace8002544 +Ref: 253a8002544 +Ref: library/heapq heapq merge8003392 +Ref: e038003392 +Ref: library/heapq heapq nlargest8004555 +Ref: 253b8004555 +Ref: library/heapq heapq nsmallest8004953 +Ref: 253c8004953 +Ref: heapq — Heap queue algorithm-Footnote-18005822 +Node: Basic Examples8005887 +Ref: library/heapq basic-examples8006012 +Ref: 253d8006012 +Ref: Basic Examples-Footnote-18006979 +Node: Priority Queue Implementation Notes8007026 +Ref: library/heapq priority-queue-implementation-notes8007166 +Ref: 253e8007166 +Ref: Priority Queue Implementation Notes-Footnote-18010102 +Node: Theory8010155 +Ref: library/heapq theory8010272 +Ref: 253f8010272 +Ref: Theory-Footnote-18014438 +Node: bisect — Array bisection algorithm8015094 +Ref: library/bisect doc8015269 +Ref: 25408015269 +Ref: library/bisect bisect-array-bisection-algorithm8015269 +Ref: 25418015269 +Ref: library/bisect module-bisect8015269 +Ref: 118015269 +Ref: library/bisect bisect-functions8016700 +Ref: 25438016700 +Ref: library/bisect bisect bisect_left8016739 +Ref: 25448016739 +Ref: library/bisect bisect bisect_right8017934 +Ref: 25458017934 +Ref: library/bisect bisect bisect8018005 +Ref: 25468018005 +Ref: library/bisect bisect insort_left8018539 +Ref: 25428018539 +Ref: library/bisect bisect insort_right8019179 +Ref: 25478019179 +Ref: library/bisect bisect insort8019250 +Ref: 25488019250 +Ref: bisect — Array bisection algorithm-Footnote-18020074 +Node: Performance Notes8020140 +Ref: library/bisect performance-notes8020261 +Ref: 25498020261 +Ref: Performance Notes-Footnote-18021638 +Ref: Performance Notes-Footnote-28021693 +Node: Searching Sorted Lists8021763 +Ref: library/bisect searching-sorted-lists8021904 +Ref: 254a8021904 +Node: Examples<3>8023126 +Ref: library/bisect examples8023241 +Ref: 254b8023241 +Ref: library/bisect bisect-example8023276 +Ref: 254c8023276 +Node: array — Efficient arrays of numeric values8025803 +Ref: library/array doc8025975 +Ref: 254d8025975 +Ref: library/array array-efficient-arrays-of-numeric-values8025975 +Ref: 254e8025975 +Ref: library/array module-array8025975 +Ref: 78025975 +Ref: library/array array typecodes8030914 +Ref: 25508030914 +Ref: library/array array array8031027 +Ref: 1a08031027 +Ref: library/array array array typecode8032268 +Ref: 25538032268 +Ref: library/array array array itemsize8032358 +Ref: 254f8032358 +Ref: library/array array array append8032479 +Ref: 25548032479 +Ref: library/array array array buffer_info8032577 +Ref: 25558032577 +Ref: library/array array array byteswap8033694 +Ref: 25568033694 +Ref: library/array array array count8034045 +Ref: 25578034045 +Ref: library/array array array extend8034138 +Ref: 25528034138 +Ref: library/array array array frombytes8034522 +Ref: 12658034522 +Ref: library/array array array fromfile8034901 +Ref: 12b38034901 +Ref: library/array array array fromlist8035241 +Ref: 25588035241 +Ref: library/array array array fromunicode8035452 +Ref: 25518035452 +Ref: library/array array array index8035806 +Ref: 7db8035806 +Ref: library/array array array insert8036253 +Ref: 25598036253 +Ref: library/array array array pop8036455 +Ref: 255a8036455 +Ref: library/array array array remove8036684 +Ref: 255b8036684 +Ref: library/array array array clear8036775 +Ref: 1a28036775 +Ref: library/array array array reverse8036883 +Ref: 255c8036883 +Ref: library/array array array tobytes8036968 +Ref: 12648036968 +Ref: library/array array array tofile8037320 +Ref: 12b48037320 +Ref: library/array array array tolist8037443 +Ref: 255d8037443 +Ref: library/array array array tounicode8037541 +Ref: 255e8037541 +Ref: array — Efficient arrays of numeric values-Footnote-18038789 +Node: weakref — Weak references8038816 +Ref: library/weakref doc8039012 +Ref: 255f8039012 +Ref: library/weakref mod-weakref8039012 +Ref: f058039012 +Ref: library/weakref module-weakref8039012 +Ref: 1148039012 +Ref: library/weakref weakref-weak-references8039012 +Ref: 25608039012 +Ref: library/weakref weakref ref8043076 +Ref: fe98043076 +Ref: library/weakref weakref ref __callback__8044886 +Ref: fea8044886 +Ref: library/weakref weakref proxy8045251 +Ref: a518045251 +Ref: library/weakref weakref getweakrefcount8046246 +Ref: 25628046246 +Ref: library/weakref weakref getweakrefs8046379 +Ref: 25638046379 +Ref: library/weakref weakref WeakKeyDictionary8046513 +Ref: 196d8046513 +Ref: library/weakref weakref WeakKeyDictionary keyrefs8048362 +Ref: 25648048362 +Ref: library/weakref weakref WeakValueDictionary8048465 +Ref: 196c8048465 +Ref: library/weakref weakref WeakValueDictionary valuerefs8048937 +Ref: 25658048937 +Ref: library/weakref weakref WeakSet8049046 +Ref: 5d98049046 +Ref: library/weakref weakref WeakMethod8049230 +Ref: fe88049230 +Ref: library/weakref weakref finalize8050282 +Ref: a7c8050282 +Ref: library/weakref weakref finalize __call__8051585 +Ref: 25668051585 +Ref: library/weakref weakref finalize detach8051796 +Ref: 25678051796 +Ref: library/weakref weakref finalize peek8051997 +Ref: 25688051997 +Ref: library/weakref weakref finalize alive8052166 +Ref: 25698052166 +Ref: library/weakref weakref finalize atexit8052281 +Ref: 256a8052281 +Ref: library/weakref weakref ReferenceType8052882 +Ref: 17d38052882 +Ref: library/weakref weakref ProxyType8052966 +Ref: 17d48052966 +Ref: library/weakref weakref CallableProxyType8053064 +Ref: 17d58053064 +Ref: library/weakref weakref ProxyTypes8053156 +Ref: 256b8053156 +Ref: weakref — Weak references-Footnote-18053786 +Ref: weakref — Weak references-Footnote-28053853 +Ref: weakref — Weak references-Footnote-38053895 +Ref: weakref — Weak references-Footnote-48053937 +Node: Weak Reference Objects8053979 +Ref: library/weakref weak-reference-objects8054084 +Ref: 256c8054084 +Ref: library/weakref weakref-objects8054084 +Ref: 256d8054084 +Node: Example<2>8056608 +Ref: library/weakref example8056739 +Ref: 256e8056739 +Ref: library/weakref weakref-example8056739 +Ref: 256f8056739 +Node: Finalizer Objects8057280 +Ref: library/weakref finalize-examples8057430 +Ref: 25708057430 +Ref: library/weakref finalizer-objects8057430 +Ref: 25718057430 +Node: Comparing finalizers with __del__ methods8059281 +Ref: library/weakref comparing-finalizers-with-del-methods8059412 +Ref: 25728059412 +Node: types — Dynamic type creation and names for built-in types8062239 +Ref: library/types doc8062432 +Ref: 25738062432 +Ref: library/types module-types8062432 +Ref: 1038062432 +Ref: library/types types-dynamic-type-creation-and-names-for-built-in-types8062432 +Ref: 25748062432 +Ref: types — Dynamic type creation and names for built-in types-Footnote-18063235 +Node: Dynamic Type Creation8063300 +Ref: library/types dynamic-type-creation8063453 +Ref: 25758063453 +Ref: library/types types new_class8063516 +Ref: 11558063516 +Ref: library/types types prepare_class8064232 +Ref: 11568064232 +Ref: library/types types resolve_bases8065403 +Ref: b9c8065403 +Ref: library/types types get_original_bases8065974 +Ref: 4ca8065974 +Ref: Dynamic Type Creation-Footnote-18067536 +Ref: Dynamic Type Creation-Footnote-28067578 +Ref: Dynamic Type Creation-Footnote-38067620 +Ref: Dynamic Type Creation-Footnote-48067662 +Node: Standard Interpreter Types8067704 +Ref: library/types standard-interpreter-types8067906 +Ref: 25768067906 +Ref: library/types types NoneType8068462 +Ref: 84e8068462 +Ref: library/types types FunctionType8068552 +Ref: 8818068552 +Ref: library/types types LambdaType8068581 +Ref: 25778068581 +Ref: library/types types GeneratorType8068938 +Ref: 16358068938 +Ref: library/types types CoroutineType8069065 +Ref: e848069065 +Ref: library/types types AsyncGeneratorType8069222 +Ref: 25788069222 +Ref: library/types types CodeType8069408 +Ref: 2e38069408 +Ref: library/types types CellType8070002 +Ref: 25798070002 +Ref: library/types types MethodType8070180 +Ref: 17f88070180 +Ref: library/types types BuiltinFunctionType8070267 +Ref: 257a8070267 +Ref: library/types types BuiltinMethodType8070303 +Ref: 257b8070303 +Ref: library/types types WrapperDescriptorType8070527 +Ref: b998070527 +Ref: library/types types MethodWrapperType8070745 +Ref: 6478070745 +Ref: library/types types NotImplementedType8070948 +Ref: 84f8070948 +Ref: library/types types MethodDescriptorType8071058 +Ref: b9a8071058 +Ref: library/types types ClassMethodDescriptorType8071215 +Ref: b9b8071215 +Ref: library/types types ModuleType8071402 +Ref: e128071402 +Ref: library/types types EllipsisType8072182 +Ref: 84d8072182 +Ref: library/types types GenericAlias8072281 +Ref: 7e68072281 +Ref: library/types types UnionType8073195 +Ref: 6368073195 +Ref: library/types types TracebackType8073305 +Ref: af28073305 +Ref: library/types types FrameType8073633 +Ref: 18518073633 +Ref: library/types types GetSetDescriptorType8073786 +Ref: 257c8073786 +Ref: library/types types MemberDescriptorType8074153 +Ref: 257d8074153 +Ref: library/types types MappingProxyType8074945 +Ref: 4698074945 +Ref: library/types types MappingProxyType copy8075939 +Ref: 257e8075939 +Ref: library/types types MappingProxyType get8076025 +Ref: 257f8076025 +Ref: library/types types MappingProxyType items8076298 +Ref: 25808076298 +Ref: library/types types MappingProxyType keys8076428 +Ref: 25818076428 +Ref: library/types types MappingProxyType values8076519 +Ref: 25828076519 +Ref: library/types types CapsuleType8076889 +Ref: 25838076889 +Ref: Standard Interpreter Types-Footnote-18077031 +Ref: Standard Interpreter Types-Footnote-28077073 +Node: Additional Utility Classes and Functions8077115 +Ref: library/types additional-utility-classes-and-functions8077323 +Ref: 25858077323 +Ref: library/types types SimpleNamespace8077424 +Ref: 1d18077424 +Ref: library/types types DynamicClassAttribute8079450 +Ref: 6268079450 +Node: Coroutine Utility Functions8080126 +Ref: library/types coroutine-utility-functions8080299 +Ref: 25868080299 +Ref: library/types types coroutine8080374 +Ref: e838080374 +Node: copy — Shallow and deep copy operations8081202 +Ref: library/copy doc8081398 +Ref: 25878081398 +Ref: library/copy copy-shallow-and-deep-copy-operations8081398 +Ref: 25888081398 +Ref: library/copy module-copy8081398 +Ref: 258081398 +Ref: library/copy copy copy8081953 +Ref: 52f8081953 +Ref: library/copy copy deepcopy8082022 +Ref: b6e8082022 +Ref: library/copy copy replace8082100 +Ref: 1518082100 +Ref: library/copy copy Error8082281 +Ref: 25898082281 +Ref: library/copy shallow-vs-deep-copy8082348 +Ref: 1c018082348 +Ref: library/copy object __copy__8084388 +Ref: 258a8084388 +Ref: library/copy object __deepcopy__8084519 +Ref: 15468084519 +Ref: library/copy object __replace__8085223 +Ref: 1528085223 +Ref: copy — Shallow and deep copy operations-Footnote-18085600 +Node: pprint — Data pretty printer8085664 +Ref: library/pprint doc8085841 +Ref: 258b8085841 +Ref: library/pprint module-pprint8085841 +Ref: ae8085841 +Ref: library/pprint pprint-data-pretty-printer8085841 +Ref: 258c8085841 +Ref: pprint — Data pretty printer-Footnote-18087064 +Node: Functions<4>8087130 +Ref: library/pprint functions8087239 +Ref: 258d8087239 +Ref: library/pprint pprint-functions8087239 +Ref: 258e8087239 +Ref: library/pprint pprint pp8087278 +Ref: a228087278 +Ref: library/pprint pprint pprint8089872 +Ref: 8248089872 +Ref: library/pprint pprint pformat8090272 +Ref: f7b8090272 +Ref: library/pprint pprint isreadable8090723 +Ref: 25908090723 +Ref: library/pprint pprint isrecursive8091031 +Ref: 25918091031 +Ref: library/pprint pprint saferepr8091332 +Ref: 25928091332 +Node: PrettyPrinter Objects8091980 +Ref: library/pprint id18092108 +Ref: 25938092108 +Ref: library/pprint prettyprinter-objects8092108 +Ref: 25948092108 +Ref: library/pprint pprint PrettyPrinter8092171 +Ref: f7a8092171 +Ref: library/pprint pprint PrettyPrinter pformat8093840 +Ref: 25958093840 +Ref: library/pprint pprint PrettyPrinter pprint8094039 +Ref: 25968094039 +Ref: library/pprint pprint PrettyPrinter isreadable8094426 +Ref: 25978094426 +Ref: library/pprint pprint PrettyPrinter isrecursive8094828 +Ref: 25988094828 +Ref: library/pprint pprint PrettyPrinter format8095144 +Ref: 191e8095144 +Node: Example<3>8096304 +Ref: library/pprint example8096411 +Ref: 25998096411 +Ref: library/pprint pprint-example8096411 +Ref: 259a8096411 +Ref: Example<3>-Footnote-18103709 +Node: reprlib — Alternate repr implementation8103734 +Ref: library/reprlib doc8103903 +Ref: 259b8103903 +Ref: library/reprlib module-reprlib8103903 +Ref: bb8103903 +Ref: library/reprlib reprlib-alternate-repr-implementation8103903 +Ref: 259c8103903 +Ref: library/reprlib reprlib Repr8104394 +Ref: 259d8104394 +Ref: library/reprlib reprlib aRepr8105388 +Ref: 259f8105388 +Ref: library/reprlib reprlib repr8105671 +Ref: 25a08105671 +Ref: library/reprlib reprlib recursive_repr8106073 +Ref: 11e58106073 +Ref: reprlib — Alternate repr implementation-Footnote-18106871 +Node: Repr Objects8106938 +Ref: library/reprlib id18107061 +Ref: 259e8107061 +Ref: library/reprlib repr-objects8107061 +Ref: 25a28107061 +Ref: library/reprlib reprlib Repr fillvalue8107302 +Ref: 25a38107302 +Ref: library/reprlib reprlib Repr maxlevel8107451 +Ref: 25a48107451 +Ref: library/reprlib reprlib Repr maxdict8107575 +Ref: 25a58107575 +Ref: library/reprlib reprlib Repr maxlist8107603 +Ref: 25a68107603 +Ref: library/reprlib reprlib Repr maxtuple8107631 +Ref: 25a78107631 +Ref: library/reprlib reprlib Repr maxset8107660 +Ref: 25a88107660 +Ref: library/reprlib reprlib Repr maxfrozenset8107687 +Ref: 25a98107687 +Ref: library/reprlib reprlib Repr maxdeque8107720 +Ref: 25aa8107720 +Ref: library/reprlib reprlib Repr maxarray8107749 +Ref: 25ab8107749 +Ref: library/reprlib reprlib Repr maxlong8107977 +Ref: 25ac8107977 +Ref: library/reprlib reprlib Repr maxstring8108146 +Ref: 25ad8108146 +Ref: library/reprlib reprlib Repr maxother8108503 +Ref: 25ae8108503 +Ref: library/reprlib reprlib Repr indent8108782 +Ref: 25af8108782 +Ref: library/reprlib reprlib Repr repr8110277 +Ref: 25a18110277 +Ref: library/reprlib reprlib Repr repr18110417 +Ref: 25b08110417 +Node: Subclassing Repr Objects8111235 +Ref: library/reprlib subclassing-repr-objects8111358 +Ref: 25b18111358 +Ref: library/reprlib subclassing-reprs8111358 +Ref: 25b28111358 +Node: enum — Support for enumerations8112055 +Ref: library/enum doc8112258 +Ref: 25b38112258 +Ref: library/enum enum-support-for-enumerations8112258 +Ref: 25b48112258 +Ref: library/enum module-enum8112258 +Ref: 568112258 +Ref: enum — Support for enumerations-Footnote-18114152 +Node: Module Contents<2>8114216 +Ref: library/enum module-contents8114326 +Ref: 25b98114326 +Node: Data Types<2>8117810 +Ref: library/enum data-types8117953 +Ref: 25bd8117953 +Ref: library/enum enum EnumType8117994 +Ref: 1e78117994 +Ref: library/enum enum EnumType __call__8118617 +Ref: 25bf8118617 +Ref: library/enum enum EnumType __contains__8119834 +Ref: 25c08119834 +Ref: library/enum enum EnumType __dir__8120254 +Ref: 25c18120254 +Ref: library/enum enum EnumType __getitem__8120641 +Ref: 25c28120641 +Ref: library/enum enum EnumType __iter__8120853 +Ref: 25c38120853 +Ref: library/enum enum EnumType __len__8121046 +Ref: 25c48121046 +Ref: library/enum enum EnumType __members__8121176 +Ref: 25c58121176 +Ref: library/enum enum EnumType __reversed__8121300 +Ref: 25c68121300 +Ref: library/enum enum Enum8121515 +Ref: 62c8121515 +Ref: library/enum enum Enum name8121597 +Ref: 25c78121597 +Ref: library/enum enum Enum value8121739 +Ref: 25c88121739 +Ref: library/enum enum Enum _name_8122605 +Ref: 25ca8122605 +Ref: library/enum enum Enum _value_8122664 +Ref: 25cb8122664 +Ref: library/enum enum Enum _order_8122762 +Ref: 25cc8122762 +Ref: library/enum enum Enum _ignore_8122912 +Ref: 25cd8122912 +Ref: library/enum enum Enum __dir__8123279 +Ref: 18618123279 +Ref: library/enum enum Enum _generate_next_value_8124110 +Ref: 25cf8124110 +Ref: library/enum enum Enum __init__8125027 +Ref: 25d08125027 +Ref: library/enum enum Enum __init_subclass__8125479 +Ref: 25d18125479 +Ref: library/enum enum Enum _missing_8125650 +Ref: 25d28125650 +Ref: library/enum enum Enum __new__8126511 +Ref: 25c98126511 +Ref: library/enum enum Enum __repr__8127177 +Ref: 17848127177 +Ref: library/enum enum Enum __str__8127906 +Ref: 61e8127906 +Ref: library/enum enum Enum __format__8128534 +Ref: 61c8128534 +Ref: library/enum enum Enum _add_alias_8129409 +Ref: 25d38129409 +Ref: library/enum enum Enum _add_value_alias_8129757 +Ref: 25d48129757 +Ref: library/enum enum IntEnum8130113 +Ref: cdf8130113 +Ref: library/enum enum StrEnum8131155 +Ref: 6168131155 +Ref: library/enum enum Flag8132559 +Ref: 61f8132559 +Ref: library/enum enum Flag __contains__8132842 +Ref: 25d58132842 +Ref: library/enum enum Flag __or__8134281 +Ref: 25d68134281 +Ref: library/enum enum Flag __and__8134459 +Ref: 25d78134459 +Ref: library/enum enum Flag __xor__8134695 +Ref: 25d88134695 +Ref: library/enum enum Flag _numeric_repr_8135231 +Ref: 25d98135231 +Ref: library/enum enum IntFlag8135732 +Ref: 22fa8135732 +Ref: library/enum enum ReprEnum8137356 +Ref: 6178137356 +Ref: library/enum enum EnumCheck8137871 +Ref: 6228137871 +Ref: library/enum enum EnumCheck UNIQUE8138075 +Ref: 25da8138075 +Ref: library/enum enum EnumCheck CONTINUOUS8138562 +Ref: 25db8138562 +Ref: library/enum enum EnumCheck NAMED_FLAGS8139092 +Ref: 25dc8139092 +Ref: library/enum enum FlagBoundary8139963 +Ref: 6208139963 +Ref: library/enum enum FlagBoundary STRICT8140108 +Ref: 25dd8140108 +Ref: library/enum enum FlagBoundary CONFORM8140757 +Ref: 25de8140757 +Ref: library/enum enum FlagBoundary EJECT8141226 +Ref: 25df8141226 +Ref: library/enum enum FlagBoundary KEEP8141666 +Ref: 25e08141666 +Ref: library/enum enum EnumDict8142193 +Ref: 1e68142193 +Ref: library/enum enum EnumDict member_names8142915 +Ref: 25e18142915 +Node: Supported __dunder__ names8143151 +Ref: library/enum supported-dunder-names8143260 +Ref: 25e28143260 +Node: Supported _sunder_ names8143689 +Ref: library/enum supported-sunder-names8143798 +Ref: 25e38143798 +Ref: Supported _sunder_ names-Footnote-18145578 +Node: Utilities and Decorators8145665 +Ref: library/enum ipython-s-rich-display8145795 +Ref: 25e48145795 +Ref: library/enum utilities-and-decorators8145795 +Ref: 25e58145795 +Ref: library/enum enum auto8145864 +Ref: c9c8145864 +Ref: library/enum enum property8147357 +Ref: 6258147357 +Ref: library/enum enum unique8147878 +Ref: 25bb8147878 +Ref: library/enum enum verify8148508 +Ref: 6218148508 +Ref: library/enum enum member8148764 +Ref: 6238148764 +Ref: library/enum enum nonmember8148890 +Ref: 6248148890 +Ref: library/enum enum global_enum8149023 +Ref: 6278149023 +Ref: library/enum enum show_flag_values8149392 +Ref: 25bc8149392 +Node: Notes8149617 +Ref: library/enum notes8149725 +Ref: 25ba8149725 +Node: graphlib — Functionality to operate with graph-like structures8150660 +Ref: library/graphlib doc8150813 +Ref: 25e68150813 +Ref: library/graphlib graphlib-functionality-to-operate-with-graph-like-structures8150813 +Ref: 25e78150813 +Ref: library/graphlib module-graphlib8150813 +Ref: 658150813 +Ref: library/graphlib graphlib TopologicalSorter8151067 +Ref: 8e08151067 +Ref: library/graphlib graphlib TopologicalSorter add8154359 +Ref: 25e88154359 +Ref: library/graphlib graphlib TopologicalSorter prepare8155136 +Ref: 25e98155136 +Ref: library/graphlib graphlib TopologicalSorter is_active8155609 +Ref: 25ea8155609 +Ref: library/graphlib graphlib TopologicalSorter done8156502 +Ref: 25ec8156502 +Ref: library/graphlib graphlib TopologicalSorter get_ready8157198 +Ref: 25eb8157198 +Ref: library/graphlib graphlib TopologicalSorter static_order8157754 +Ref: 25ed8157754 +Ref: graphlib — Functionality to operate with graph-like structures-Footnote-18159296 +Node: Exceptions<4>8159364 +Ref: library/graphlib exceptions8159478 +Ref: 25ef8159478 +Ref: library/graphlib graphlib CycleError8159592 +Ref: 25ee8159592 +Node: Numeric and Mathematical Modules8160265 +Ref: library/numeric doc8160419 +Ref: 25f08160419 +Ref: library/numeric numeric8160419 +Ref: 25f18160419 +Ref: library/numeric numeric-and-mathematical-modules8160419 +Ref: 25f28160419 +Node: numbers — Numeric abstract base classes8161324 +Ref: library/numbers doc8161474 +Ref: 25f38161474 +Ref: library/numbers module-numbers8161474 +Ref: 9e8161474 +Ref: library/numbers numbers-numeric-abstract-base-classes8161474 +Ref: 25f48161474 +Ref: library/numbers numbers Number8161904 +Ref: 25f58161904 +Ref: numbers — Numeric abstract base classes-Footnote-18162200 +Ref: numbers — Numeric abstract base classes-Footnote-28162267 +Node: The numeric tower8162309 +Ref: library/numbers the-numeric-tower8162440 +Ref: 25f68162440 +Ref: library/numbers numbers Complex8162493 +Ref: 25f78162493 +Ref: library/numbers numbers Complex real8162944 +Ref: 25f88162944 +Ref: library/numbers numbers Complex imag8163037 +Ref: 25f98163037 +Ref: library/numbers numbers Complex conjugate8163135 +Ref: 25fa8163135 +Ref: library/numbers numbers Real8163294 +Ref: 21968163294 +Ref: library/numbers numbers Rational8163798 +Ref: 12b18163798 +Ref: library/numbers numbers Rational numerator8164189 +Ref: 25fb8164189 +Ref: library/numbers numbers Rational denominator8164281 +Ref: 25fc8164281 +Ref: library/numbers numbers Integral8164377 +Ref: 1fbc8164377 +Node: Notes for type implementers8164740 +Ref: library/numbers notes-for-type-implementers8164871 +Ref: 25fd8164871 +Node: Adding More Numeric ABCs8165721 +Ref: library/numbers adding-more-numeric-abcs8165856 +Ref: 25fe8165856 +Node: Implementing the arithmetic operations8166202 +Ref: library/numbers id18166337 +Ref: 25ff8166337 +Ref: library/numbers implementing-the-arithmetic-operations8166337 +Ref: 1eea8166337 +Node: math — Mathematical functions8171010 +Ref: library/math doc8171221 +Ref: 26008171221 +Ref: library/math math-mathematical-functions8171221 +Ref: 26018171221 +Ref: library/math module-math8171221 +Ref: 8e8171221 +Ref: math — Mathematical functions-Footnote-18185861 +Ref: math — Mathematical functions-Footnote-28185914 +Ref: math — Mathematical functions-Footnote-38185967 +Ref: math — Mathematical functions-Footnote-48186020 +Node: Number-theoretic functions8186073 +Ref: library/math number-theoretic-functions8186201 +Ref: 26138186201 +Ref: library/math math comb8186272 +Ref: 6cb8186272 +Ref: library/math math factorial8186863 +Ref: 9478186863 +Ref: library/math math gcd8187057 +Ref: 90f8187057 +Ref: library/math math isqrt8187592 +Ref: a048187592 +Ref: library/math math lcm8188112 +Ref: 9108188112 +Ref: library/math math perm8188514 +Ref: 6cc8188514 +Node: Floating point arithmetic8189063 +Ref: library/math floating-point-arithmetic8189237 +Ref: 26148189237 +Ref: library/math math ceil8189306 +Ref: 138e8189306 +Ref: library/math math fabs8189547 +Ref: 26028189547 +Ref: library/math math floor8189616 +Ref: 138d8189616 +Ref: library/math math fma8189848 +Ref: 2078189848 +Ref: library/math math fmod8190532 +Ref: 206c8190532 +Ref: library/math math modf8191576 +Ref: 26038191576 +Ref: library/math math remainder8191999 +Ref: b538191999 +Ref: library/math math trunc8193027 +Ref: 138f8193027 +Node: Floating point manipulation functions8193795 +Ref: library/math floating-point-manipulation-functions8193986 +Ref: 26158193986 +Ref: library/math math copysign8194079 +Ref: 139f8194079 +Ref: library/math math frexp8194293 +Ref: 26048194293 +Ref: library/math math isclose8194942 +Ref: daf8194942 +Ref: library/math math isfinite8196548 +Ref: 11dd8196548 +Ref: library/math math isinf8196753 +Ref: 139d8196753 +Ref: library/math math isnan8196882 +Ref: 139e8196882 +Ref: library/math math ldexp8197000 +Ref: 15448197000 +Ref: library/math math nextafter8197135 +Ref: 4948197135 +Ref: library/math math ulp8197803 +Ref: 9118197803 +Ref: Floating point manipulation functions-Footnote-18198879 +Node: Power exponential and logarithmic functions8198921 +Ref: library/math power-exponential-and-logarithmic-functions8199118 +Ref: 26168199118 +Ref: library/math math cbrt8199225 +Ref: 65d8199225 +Ref: library/math math exp8199318 +Ref: 13078199318 +Ref: library/math math exp28199536 +Ref: 65c8199536 +Ref: library/math math expm18199636 +Ref: 11de8199636 +Ref: library/math math log8200252 +Ref: 14898200252 +Ref: library/math math log1p8200487 +Ref: 13a48200487 +Ref: library/math math log28200650 +Ref: 10d18200650 +Ref: library/math math log108200992 +Ref: 26058200992 +Ref: library/math math pow8201124 +Ref: 65e8201124 +Ref: library/math math sqrt8201991 +Ref: a058201991 +Ref: Power exponential and logarithmic functions-Footnote-18202093 +Node: Summation and product functions8202152 +Ref: library/math summation-and-product-functions8202330 +Ref: 26178202330 +Ref: library/math math dist8202411 +Ref: a018202411 +Ref: library/math math fsum8202742 +Ref: 13a08202742 +Ref: library/math math hypot8203416 +Ref: a028203416 +Ref: library/math math prod8204172 +Ref: a038204172 +Ref: library/math math sumprod8204550 +Ref: 4938204550 +Ref: Summation and product functions-Footnote-18205037 +Node: Angular conversion8205142 +Ref: library/math angular-conversion8205300 +Ref: 26188205300 +Ref: library/math math degrees8205355 +Ref: 26068205355 +Ref: library/math math radians8205436 +Ref: 26078205436 +Node: Trigonometric functions8205517 +Ref: library/math trigonometric-functions8205664 +Ref: 26198205664 +Ref: library/math math acos8205729 +Ref: 26088205729 +Ref: library/math math asin8205856 +Ref: 26098205856 +Ref: library/math math atan8205987 +Ref: 260a8205987 +Ref: library/math math atan28206121 +Ref: 260b8206121 +Ref: library/math math cos8206633 +Ref: 14888206633 +Ref: library/math math sin8206701 +Ref: 14878206701 +Ref: library/math math tan8206767 +Ref: 260c8206767 +Node: Hyperbolic functions8206836 +Ref: library/math hyperbolic-functions8206982 +Ref: 261a8206982 +Ref: library/math math acosh8207154 +Ref: 13a18207154 +Ref: library/math math asinh8207235 +Ref: 13a28207235 +Ref: library/math math atanh8207314 +Ref: 13a38207314 +Ref: library/math math cosh8207396 +Ref: 260d8207396 +Ref: library/math math sinh8207468 +Ref: 260e8207468 +Ref: library/math math tanh8207538 +Ref: 260f8207538 +Ref: Hyperbolic functions-Footnote-18207647 +Node: Special functions8207706 +Ref: library/math special-functions8207841 +Ref: 261b8207841 +Ref: library/math math erf8207894 +Ref: bd88207894 +Ref: library/math math erfc8208316 +Ref: bd98208316 +Ref: library/math math gamma8208617 +Ref: 11df8208617 +Ref: library/math math lgamma8208718 +Ref: 11e08208718 +Ref: Special functions-Footnote-18208905 +Ref: Special functions-Footnote-28208958 +Ref: Special functions-Footnote-38209029 +Ref: Special functions-Footnote-48209082 +Ref: Special functions-Footnote-58209141 +Node: Constants<2>8209194 +Ref: library/math constants8209300 +Ref: 261c8209300 +Ref: library/math math pi8209339 +Ref: 26108209339 +Ref: library/math math e8209434 +Ref: 26118209434 +Ref: library/math math tau8209527 +Ref: 26128209527 +Ref: library/math math inf8209907 +Ref: c848209907 +Ref: library/math math nan8210098 +Ref: 65f8210098 +Ref: Constants<2>-Footnote-18212055 +Ref: Constants<2>-Footnote-28212091 +Ref: Constants<2>-Footnote-38212119 +Node: cmath — Mathematical functions for complex numbers8212166 +Ref: library/cmath doc8212397 +Ref: 261d8212397 +Ref: library/cmath cmath-mathematical-functions-for-complex-numbers8212397 +Ref: 261e8212397 +Ref: library/cmath module-cmath8212397 +Ref: 188212397 +Node: Conversions to and from polar coordinates8220734 +Ref: library/cmath conversions-to-and-from-polar-coordinates8220904 +Ref: 26378220904 +Ref: library/cmath cmath phase8221709 +Ref: 26208221709 +Ref: library/cmath cmath polar8222480 +Ref: 26218222480 +Ref: library/cmath cmath rect8222735 +Ref: 26228222735 +Node: Power and logarithmic functions8222916 +Ref: library/cmath power-and-logarithmic-functions8223121 +Ref: 26388223121 +Ref: library/cmath cmath exp8223202 +Ref: 26238223202 +Ref: library/cmath cmath log8223323 +Ref: 26248223323 +Ref: library/cmath cmath log108223567 +Ref: 26258223567 +Ref: library/cmath cmath sqrt8223698 +Ref: 261f8223698 +Node: Trigonometric functions<2>8223822 +Ref: library/cmath trigonometric-functions8224009 +Ref: 26398224009 +Ref: library/cmath cmath acos8224074 +Ref: 26268224074 +Ref: library/cmath cmath asin8224292 +Ref: 26278224292 +Ref: library/cmath cmath atan8224415 +Ref: 26288224415 +Ref: library/cmath cmath cos8224661 +Ref: 26298224661 +Ref: library/cmath cmath sin8224722 +Ref: 262a8224722 +Ref: library/cmath cmath tan8224781 +Ref: 262b8224781 +Node: Hyperbolic functions<2>8224843 +Ref: library/cmath hyperbolic-functions8225023 +Ref: 263a8225023 +Ref: library/cmath cmath acosh8225082 +Ref: 262c8225082 +Ref: library/cmath cmath asinh8225246 +Ref: 262d8225246 +Ref: library/cmath cmath atanh8225505 +Ref: 262e8225505 +Ref: library/cmath cmath cosh8225753 +Ref: 262f8225753 +Ref: library/cmath cmath sinh8225826 +Ref: 26308225826 +Ref: library/cmath cmath tanh8225897 +Ref: 26318225897 +Node: Classification functions8225971 +Ref: library/cmath classification-functions8226137 +Ref: 263b8226137 +Ref: library/cmath cmath isfinite8226204 +Ref: 26328226204 +Ref: library/cmath cmath isinf8226378 +Ref: 26338226378 +Ref: library/cmath cmath isnan8226529 +Ref: 26348226529 +Ref: library/cmath cmath isclose8226674 +Ref: db08226674 +Ref: Classification functions-Footnote-18228305 +Node: Constants<3>8228347 +Ref: library/cmath constants8228481 +Ref: 263c8228481 +Ref: library/cmath cmath pi8228518 +Ref: 26358228518 +Ref: library/cmath cmath e8228588 +Ref: 26368228588 +Ref: library/cmath cmath tau8228656 +Ref: c818228656 +Ref: library/cmath cmath inf8228755 +Ref: c828228755 +Ref: library/cmath cmath infj8228879 +Ref: c858228879 +Ref: library/cmath cmath nan8229062 +Ref: c838229062 +Ref: library/cmath cmath nanj8229206 +Ref: c868229206 +Node: decimal — Decimal fixed-point and floating-point arithmetic8230619 +Ref: library/decimal doc8230849 +Ref: 263d8230849 +Ref: library/decimal decimal-decimal-fixed-point-and-floating-point-arithmetic8230849 +Ref: 263e8230849 +Ref: library/decimal module-decimal8230849 +Ref: 368230849 +Ref: decimal — Decimal fixed-point and floating-point arithmetic-Footnote-18235974 +Ref: decimal — Decimal fixed-point and floating-point arithmetic-Footnote-28236041 +Node: Quick-start tutorial8236095 +Ref: library/decimal decimal-tutorial8236237 +Ref: 264e8236237 +Ref: library/decimal quick-start-tutorial8236237 +Ref: 264f8236237 +Node: Decimal objects8243481 +Ref: library/decimal decimal-decimal8243647 +Ref: 26528243647 +Ref: library/decimal decimal-objects8243647 +Ref: 26538243647 +Ref: library/decimal decimal Decimal8243696 +Ref: 29f8243696 +Ref: library/decimal decimal Decimal adjusted8248986 +Ref: 26548248986 +Ref: library/decimal decimal Decimal as_integer_ratio8249337 +Ref: c948249337 +Ref: library/decimal decimal Decimal as_tuple8249778 +Ref: 26558249778 +Ref: library/decimal decimal Decimal canonical8249936 +Ref: 26568249936 +Ref: library/decimal decimal Decimal compare8250175 +Ref: 26578250175 +Ref: library/decimal decimal Decimal compare_signal8250608 +Ref: 26588250608 +Ref: library/decimal decimal Decimal compare_total8250920 +Ref: 26598250920 +Ref: library/decimal decimal Decimal compare_total_mag8252197 +Ref: 265a8252197 +Ref: library/decimal decimal Decimal conjugate8252802 +Ref: 265b8252802 +Ref: library/decimal decimal Decimal copy_abs8252935 +Ref: 265c8252935 +Ref: library/decimal decimal Decimal copy_negate8253149 +Ref: 265d8253149 +Ref: library/decimal decimal Decimal copy_sign8253360 +Ref: 265e8253360 +Ref: library/decimal decimal Decimal exp8253897 +Ref: 10a08253897 +Ref: library/decimal decimal Decimal from_float8254331 +Ref: 11f68254331 +Ref: library/decimal decimal Decimal fma8255471 +Ref: 265f8255471 +Ref: library/decimal decimal Decimal is_canonical8255715 +Ref: 26608255715 +Ref: library/decimal decimal Decimal is_finite8255990 +Ref: 26618255990 +Ref: library/decimal decimal Decimal is_infinite8256165 +Ref: 26628256165 +Ref: library/decimal decimal Decimal is_nan8256332 +Ref: 26638256332 +Ref: library/decimal decimal Decimal is_normal8256484 +Ref: 26648256484 +Ref: library/decimal decimal Decimal is_qnan8256708 +Ref: 26658256708 +Ref: library/decimal decimal Decimal is_signed8256847 +Ref: 26668256847 +Ref: library/decimal decimal Decimal is_snan8257050 +Ref: 26678257050 +Ref: library/decimal decimal Decimal is_subnormal8257192 +Ref: 26688257192 +Ref: library/decimal decimal Decimal is_zero8257346 +Ref: 26698257346 +Ref: library/decimal decimal Decimal ln8257502 +Ref: 10a18257502 +Ref: library/decimal decimal Decimal log108257710 +Ref: 266a8257710 +Ref: library/decimal decimal Decimal logb8257913 +Ref: 266b8257913 +Ref: library/decimal decimal Decimal logical_and8258300 +Ref: 266c8258300 +Ref: library/decimal decimal Decimal logical_invert8258565 +Ref: 266e8258565 +Ref: library/decimal decimal Decimal logical_or8258744 +Ref: 266f8258744 +Ref: library/decimal decimal Decimal logical_xor8259006 +Ref: 26708259006 +Ref: library/decimal decimal Decimal max8259274 +Ref: 26718259274 +Ref: library/decimal decimal Decimal max_mag8259578 +Ref: 26728259578 +Ref: library/decimal decimal Decimal min8259759 +Ref: 26738259759 +Ref: library/decimal decimal Decimal min_mag8260063 +Ref: 26748260063 +Ref: library/decimal decimal Decimal next_minus8260244 +Ref: 26758260244 +Ref: library/decimal decimal Decimal next_plus8260482 +Ref: 26768260482 +Ref: library/decimal decimal Decimal next_toward8260719 +Ref: 26778260719 +Ref: library/decimal decimal Decimal normalize8261086 +Ref: 26788261086 +Ref: library/decimal decimal Decimal number_class8262132 +Ref: 26798262132 +Ref: library/decimal decimal Decimal quantize8263302 +Ref: 10a68263302 +Ref: library/decimal decimal Decimal radix8264621 +Ref: 267b8264621 +Ref: library/decimal decimal Decimal remainder_near8264838 +Ref: 267c8264838 +Ref: library/decimal decimal Decimal rotate8265682 +Ref: 267d8265682 +Ref: library/decimal decimal Decimal same_quantum8266355 +Ref: 267e8266355 +Ref: library/decimal decimal Decimal scaleb8266767 +Ref: 267f8266767 +Ref: library/decimal decimal Decimal shift8267018 +Ref: 26808267018 +Ref: library/decimal decimal Decimal sqrt8267624 +Ref: 26818267624 +Ref: library/decimal decimal Decimal to_eng_string8267731 +Ref: 26828267731 +Ref: library/decimal decimal Decimal to_integral8268207 +Ref: 26838268207 +Ref: library/decimal decimal Decimal to_integral_exact8268437 +Ref: 26858268437 +Ref: library/decimal decimal Decimal to_integral_value8268867 +Ref: 26848268867 +Node: Logical operands8271369 +Ref: library/decimal logical-operands8271437 +Ref: 26868271437 +Ref: library/decimal logical-operands-label8271437 +Ref: 266d8271437 +Node: Context objects8271810 +Ref: library/decimal context-objects8271968 +Ref: 26878271968 +Ref: library/decimal decimal-context8271968 +Ref: 22e38271968 +Ref: library/decimal decimal getcontext8272352 +Ref: 15d58272352 +Ref: library/decimal decimal setcontext8272445 +Ref: 26508272445 +Ref: library/decimal decimal localcontext8272679 +Ref: 18038272679 +Ref: library/decimal decimal BasicContext8274298 +Ref: 109a8274298 +Ref: library/decimal decimal ExtendedContext8274749 +Ref: 109b8274749 +Ref: library/decimal decimal DefaultContext8275381 +Ref: 10998275381 +Ref: library/decimal decimal Context8276521 +Ref: 10a58276521 +Ref: library/decimal decimal Context prec8276907 +Ref: 26888276907 +Ref: library/decimal decimal Context rounding8277077 +Ref: 26898277077 +Ref: library/decimal decimal Context traps8277199 +Ref: 10a48277199 +Ref: library/decimal decimal Context flags8277225 +Ref: 10a38277225 +Ref: library/decimal decimal Context Emin8277379 +Ref: 109d8277379 +Ref: library/decimal decimal Context Emax8277404 +Ref: 109c8277404 +Ref: library/decimal decimal Context capitals8277638 +Ref: 268e8277638 +Ref: library/decimal decimal Context clamp8277873 +Ref: 11918277873 +Ref: library/decimal decimal Context clear_flags8279668 +Ref: 26518279668 +Ref: library/decimal decimal Context clear_traps8279748 +Ref: 268f8279748 +Ref: library/decimal decimal Context copy8279861 +Ref: 26908279861 +Ref: library/decimal decimal Context copy_decimal8279933 +Ref: 26918279933 +Ref: library/decimal decimal Context create_decimal8280024 +Ref: 109f8280024 +Ref: library/decimal decimal Context create_decimal_from_float8281128 +Ref: 26928281128 +Ref: library/decimal decimal Context Etiny8281894 +Ref: 267a8281894 +Ref: library/decimal decimal Context Etop8282124 +Ref: 26938282124 +Ref: library/decimal decimal Context abs8282630 +Ref: 26948282630 +Ref: library/decimal decimal Context add8282702 +Ref: 26958282702 +Ref: library/decimal decimal Context canonical8282773 +Ref: 12fa8282773 +Ref: library/decimal decimal Context compare8282853 +Ref: 26968282853 +Ref: library/decimal decimal Context compare_signal8282931 +Ref: 26978282931 +Ref: library/decimal decimal Context compare_total8283035 +Ref: 26988283035 +Ref: library/decimal decimal Context compare_total_mag8283144 +Ref: 26998283144 +Ref: library/decimal decimal Context copy_abs8283282 +Ref: 269a8283282 +Ref: library/decimal decimal Context copy_negate8283370 +Ref: 269b8283370 +Ref: library/decimal decimal Context copy_sign8283461 +Ref: 269c8283461 +Ref: library/decimal decimal Context divide8283540 +Ref: 269d8283540 +Ref: library/decimal decimal Context divide_int8283610 +Ref: 269e8283610 +Ref: library/decimal decimal Context divmod8283709 +Ref: 269f8283709 +Ref: library/decimal decimal Context exp8283826 +Ref: 26a08283826 +Ref: library/decimal decimal Context fma8283885 +Ref: 26a18283885 +Ref: library/decimal decimal Context is_canonical8283969 +Ref: 12fb8283969 +Ref: library/decimal decimal Context is_finite8284086 +Ref: 26a28284086 +Ref: library/decimal decimal Context is_infinite8284197 +Ref: 26a38284197 +Ref: library/decimal decimal Context is_nan8284312 +Ref: 26a48284312 +Ref: library/decimal decimal Context is_normal8284438 +Ref: 26a58284438 +Ref: library/decimal decimal Context is_qnan8284568 +Ref: 26a68284568 +Ref: library/decimal decimal Context is_signed8284692 +Ref: 26a78284692 +Ref: library/decimal decimal Context is_snan8284805 +Ref: 26a88284805 +Ref: library/decimal decimal Context is_subnormal8284933 +Ref: 26a98284933 +Ref: library/decimal decimal Context is_zero8285050 +Ref: 26aa8285050 +Ref: library/decimal decimal Context ln8285159 +Ref: 26ab8285159 +Ref: library/decimal decimal Context log108285242 +Ref: 26ac8285242 +Ref: library/decimal decimal Context logb8285319 +Ref: 26ad8285319 +Ref: library/decimal decimal Context logical_and8285419 +Ref: 26ae8285419 +Ref: library/decimal decimal Context logical_invert8285546 +Ref: 26af8285546 +Ref: library/decimal decimal Context logical_or8285624 +Ref: 26b08285624 +Ref: library/decimal decimal Context logical_xor8285749 +Ref: 26b18285749 +Ref: library/decimal decimal Context max8285876 +Ref: 26b28285876 +Ref: library/decimal decimal Context max_mag8285973 +Ref: 26b38285973 +Ref: library/decimal decimal Context min8286074 +Ref: 26b48286074 +Ref: library/decimal decimal Context min_mag8286171 +Ref: 26b58286171 +Ref: library/decimal decimal Context minus8286272 +Ref: 26b68286272 +Ref: library/decimal decimal Context multiply8286385 +Ref: 26b78286385 +Ref: library/decimal decimal Context next_minus8286465 +Ref: 26b88286465 +Ref: library/decimal decimal Context next_plus8286568 +Ref: 26b98286568 +Ref: library/decimal decimal Context next_toward8286670 +Ref: 26ba8286670 +Ref: library/decimal decimal Context normalize8286779 +Ref: 26bb8286779 +Ref: library/decimal decimal Context number_class8286856 +Ref: 26bc8286856 +Ref: library/decimal decimal Context plus8286945 +Ref: 26bd8286945 +Ref: library/decimal decimal Context power8287162 +Ref: 26be8287162 +Ref: library/decimal decimal Context quantize8288972 +Ref: 26bf8288972 +Ref: library/decimal decimal Context radix8289095 +Ref: 26c08289095 +Ref: library/decimal decimal Context remainder8289173 +Ref: 26c18289173 +Ref: library/decimal decimal Context remainder_near8289368 +Ref: 26c28289368 +Ref: library/decimal decimal Context rotate8289588 +Ref: 26c38289588 +Ref: library/decimal decimal Context same_quantum8289673 +Ref: 26c48289673 +Ref: library/decimal decimal Context scaleb8289785 +Ref: 26c58289785 +Ref: library/decimal decimal Context shift8289903 +Ref: 26c68289903 +Ref: library/decimal decimal Context sqrt8289987 +Ref: 26c78289987 +Ref: library/decimal decimal Context subtract8290084 +Ref: 26c88290084 +Ref: library/decimal decimal Context to_eng_string8290172 +Ref: 26c98290172 +Ref: library/decimal decimal Context to_integral_exact8290536 +Ref: 26ca8290536 +Ref: library/decimal decimal Context to_sci_string8290609 +Ref: 26cb8290609 +Node: Constants<4>8290713 +Ref: library/decimal constants8290870 +Ref: 26cc8290870 +Ref: library/decimal decimal-rounding-modes8290870 +Ref: 26cd8290870 +Ref: library/decimal decimal MAX_PREC8291307 +Ref: 268a8291307 +Ref: library/decimal decimal MAX_EMAX8291442 +Ref: 268d8291442 +Ref: library/decimal decimal MIN_EMIN8291577 +Ref: 268c8291577 +Ref: library/decimal decimal MIN_ETINY8291713 +Ref: 26ce8291713 +Ref: library/decimal decimal HAVE_THREADS8291841 +Ref: 10978291841 +Ref: library/decimal decimal HAVE_CONTEXTVAR8291997 +Ref: 1d758291997 +Node: Rounding modes8292360 +Ref: library/decimal rounding-modes8292509 +Ref: 268b8292509 +Ref: library/decimal decimal ROUND_CEILING8292556 +Ref: 263f8292556 +Ref: library/decimal decimal ROUND_DOWN8292625 +Ref: 26408292625 +Ref: library/decimal decimal ROUND_FLOOR8292681 +Ref: 26418292681 +Ref: library/decimal decimal ROUND_HALF_DOWN8292749 +Ref: 26428292749 +Ref: library/decimal decimal ROUND_HALF_EVEN8292837 +Ref: 26438292837 +Ref: library/decimal decimal ROUND_HALF_UP8292936 +Ref: 26448292936 +Ref: library/decimal decimal ROUND_UP8293024 +Ref: 26458293024 +Ref: library/decimal decimal ROUND_05UP8293080 +Ref: 26468293080 +Node: Signals8293238 +Ref: library/decimal decimal-signals8293395 +Ref: 26cf8293395 +Ref: library/decimal signals8293395 +Ref: 26d08293395 +Ref: library/decimal decimal Clamped8294112 +Ref: 26478294112 +Ref: library/decimal decimal DecimalException8294425 +Ref: 26d18294425 +Ref: library/decimal decimal DivisionByZero8294549 +Ref: 26488294549 +Ref: library/decimal decimal Inexact8294887 +Ref: 26498294887 +Ref: library/decimal decimal InvalidOperation8295162 +Ref: 109e8295162 +Ref: library/decimal decimal Overflow8295603 +Ref: 264c8295603 +Ref: library/decimal decimal Rounded8296026 +Ref: 264a8296026 +Ref: library/decimal decimal Subnormal8296364 +Ref: 264b8296364 +Ref: library/decimal decimal Underflow8296593 +Ref: 264d8296593 +Ref: library/decimal decimal FloatOperation8296818 +Ref: 10968296818 +Node: Floating-point notes8298094 +Ref: library/decimal decimal-notes8298257 +Ref: 26d28298257 +Ref: library/decimal floating-point-notes8298257 +Ref: 26d38298257 +Node: Mitigating round-off error with increased precision8298401 +Ref: library/decimal mitigating-round-off-error-with-increased-precision8298532 +Ref: 26d48298532 +Node: Special values8300221 +Ref: library/decimal special-values8300352 +Ref: 26d58300352 +Node: Working with threads8303489 +Ref: library/decimal decimal-threads8303652 +Ref: 26d68303652 +Ref: library/decimal working-with-threads8303652 +Ref: 26d78303652 +Node: Recipes8305026 +Ref: library/decimal decimal-recipes8305180 +Ref: 26d88305180 +Ref: library/decimal recipes8305180 +Ref: 26d98305180 +Node: Decimal FAQ8310025 +Ref: library/decimal decimal-faq8310150 +Ref: 26da8310150 +Ref: library/decimal id18310150 +Ref: 26db8310150 +Ref: Decimal FAQ-Footnote-18319162 +Ref: Decimal FAQ-Footnote-28319229 +Ref: Decimal FAQ-Footnote-38319260 +Ref: Decimal FAQ-Footnote-48319318 +Ref: Decimal FAQ-Footnote-58319421 +Node: fractions — Rational numbers8319531 +Ref: library/fractions doc8319750 +Ref: 26dc8319750 +Ref: library/fractions fractions-rational-numbers8319750 +Ref: 26dd8319750 +Ref: library/fractions module-fractions8319750 +Ref: 5d8319750 +Ref: library/fractions fractions Fraction8320130 +Ref: 1e98320130 +Ref: library/fractions fractions Fraction numerator8324502 +Ref: 26df8324502 +Ref: library/fractions fractions Fraction denominator8324586 +Ref: 26e08324586 +Ref: library/fractions fractions Fraction as_integer_ratio8324713 +Ref: 26e18324713 +Ref: library/fractions fractions Fraction is_integer8324956 +Ref: 26e28324956 +Ref: library/fractions fractions Fraction from_float8325082 +Ref: 11f78325082 +Ref: library/fractions fractions Fraction from_decimal8325533 +Ref: 11f88325533 +Ref: library/fractions fractions Fraction limit_denominator8325906 +Ref: 26de8325906 +Ref: library/fractions fractions Fraction __floor__8326780 +Ref: 17818326780 +Ref: library/fractions fractions Fraction __ceil__8327081 +Ref: 17808327081 +Ref: library/fractions fractions Fraction __round__8327272 +Ref: 177f8327272 +Ref: library/fractions fractions Fraction __format__8327743 +Ref: 26e38327743 +Ref: fractions — Rational numbers-Footnote-18330070 +Ref: fractions — Rational numbers-Footnote-28330139 +Node: random — Generate pseudo-random numbers8330181 +Ref: library/random doc8330387 +Ref: 26e48330387 +Ref: library/random module-random8330387 +Ref: b88330387 +Ref: library/random random-generate-pseudo-random-numbers8330387 +Ref: 26e58330387 +Ref: random — Generate pseudo-random numbers-Footnote-18333671 +Ref: random — Generate pseudo-random numbers-Footnote-28333737 +Node: Bookkeeping functions8333827 +Ref: library/random bookkeeping-functions8333954 +Ref: 26e78333954 +Ref: library/random random seed8334015 +Ref: 12678334015 +Ref: library/random random getstate8335098 +Ref: 26e88335098 +Ref: library/random random setstate8335296 +Ref: 26e98335296 +Node: Functions for bytes8335574 +Ref: library/random functions-for-bytes8335732 +Ref: 26ea8335732 +Ref: library/random random randbytes8335789 +Ref: 15428335789 +Node: Functions for integers8336009 +Ref: library/random functions-for-integers8336169 +Ref: 26ec8336169 +Ref: library/random random randrange8336232 +Ref: 8688336232 +Ref: library/random random randint8337291 +Ref: 12228337291 +Ref: library/random random getrandbits8337432 +Ref: 10068337432 +Node: Functions for sequences8337875 +Ref: library/random functions-for-sequences8338038 +Ref: 26ed8338038 +Ref: library/random random choice8338103 +Ref: 12238338103 +Ref: library/random random choices8338259 +Ref: cc68338259 +Ref: library/random random shuffle8340312 +Ref: 7428340312 +Ref: library/random random sample8340973 +Ref: 7418340973 +Node: Discrete distributions8342510 +Ref: library/random discrete-distributions8342676 +Ref: 26ee8342676 +Ref: library/random random binomialvariate8342798 +Ref: 4ac8342798 +Ref: Discrete distributions-Footnote-18343360 +Node: Real-valued distributions8343424 +Ref: library/random id18343588 +Ref: 26ef8343588 +Ref: library/random real-valued-distributions8343588 +Ref: 26f08343588 +Ref: library/random random random8343927 +Ref: 7438343927 +Ref: library/random random uniform8344049 +Ref: 26f18344049 +Ref: library/random random triangular8344390 +Ref: 26f28344390 +Ref: library/random random betavariate8344747 +Ref: 26f38344747 +Ref: library/random random expovariate8344935 +Ref: 4ad8344935 +Ref: library/random random gammavariate8345390 +Ref: 26f48345390 +Ref: library/random random gauss8345903 +Ref: 18418345903 +Ref: library/random random lognormvariate8346652 +Ref: 26f58346652 +Ref: library/random random normalvariate8346951 +Ref: 18428346951 +Ref: library/random random vonmisesvariate8347178 +Ref: 26f68347178 +Ref: library/random random paretovariate8347520 +Ref: 26f78347520 +Ref: library/random random weibullvariate8347624 +Ref: 26f88347624 +Node: Alternative Generator8347775 +Ref: library/random alternative-generator8347941 +Ref: 26f98347941 +Ref: library/random random Random8348002 +Ref: 18a78348002 +Ref: library/random random Random seed8348503 +Ref: 19808348503 +Ref: library/random random Random getstate8348676 +Ref: 26fa8348676 +Ref: library/random random Random setstate8348840 +Ref: 26fb8348840 +Ref: library/random random Random random8349009 +Ref: 26fc8349009 +Ref: library/random random Random getrandbits8349257 +Ref: 26fd8349257 +Ref: library/random random Random randbytes8349428 +Ref: 9298349428 +Ref: library/random random SystemRandom8349595 +Ref: 26e68349595 +Node: Notes on Reproducibility8350093 +Ref: library/random notes-on-reproducibility8350245 +Ref: 26fe8350245 +Node: Examples<4>8350954 +Ref: library/random examples8351095 +Ref: 26ff8351095 +Ref: library/random random-examples8351095 +Ref: 11ce8351095 +Ref: Examples<4>-Footnote-18356344 +Ref: Examples<4>-Footnote-28356409 +Ref: Examples<4>-Footnote-38356490 +Ref: Examples<4>-Footnote-48356536 +Ref: Examples<4>-Footnote-58356588 +Ref: Examples<4>-Footnote-68356643 +Ref: Examples<4>-Footnote-78356711 +Ref: Examples<4>-Footnote-88356747 +Ref: Examples<4>-Footnote-98356817 +Node: Recipes<2>8356853 +Ref: library/random recipes8356988 +Ref: 27008356988 +Ref: Recipes<2>-Footnote-18360168 +Node: Command-line usage8360236 +Ref: library/random command-line-usage8360380 +Ref: 27018360380 +Ref: library/random random-cli8360380 +Ref: 1548360380 +Ref: library/random cmdoption-random-h8360641 +Ref: 27028360641 +Ref: library/random cmdoption-random-help8360641 +Ref: 27038360641 +Ref: library/random cmdoption-random-c8360703 +Ref: 27048360703 +Ref: library/random cmdoption-random-choice8360738 +Ref: 27058360738 +Ref: library/random cmdoption-random-i8360837 +Ref: 27068360837 +Ref: library/random cmdoption-random-integer8360856 +Ref: 27078360856 +Ref: library/random cmdoption-random-f8360973 +Ref: 27088360973 +Ref: library/random cmdoption-random-float8360992 +Ref: 27098360992 +Node: Command-line example8361321 +Ref: library/random command-line-example8361446 +Ref: 270a8361446 +Ref: library/random random-cli-example8361446 +Ref: 270b8361446 +Node: statistics — Mathematical statistics functions8362275 +Ref: library/statistics doc8362442 +Ref: 270c8362442 +Ref: library/statistics module-statistics8362442 +Ref: d28362442 +Ref: library/statistics statistics-mathematical-statistics-functions8362442 +Ref: 270d8362442 +Ref: statistics — Mathematical statistics functions-Footnote-18364994 +Ref: statistics — Mathematical statistics functions-Footnote-28365064 +Ref: statistics — Mathematical statistics functions-Footnote-38365090 +Node: Averages and measures of central location8365117 +Ref: library/statistics averages-and-measures-of-central-location8365270 +Ref: 270e8365270 +Node: Measures of spread8367095 +Ref: library/statistics measures-of-spread8367300 +Ref: 27138367300 +Node: Statistics for relations between two inputs8367926 +Ref: library/statistics statistics-for-relations-between-two-inputs8368106 +Ref: 27168368106 +Node: Function details8368674 +Ref: library/statistics function-details8368849 +Ref: 27178368849 +Ref: library/statistics statistics mean8369051 +Ref: 6cd8369051 +Ref: library/statistics statistics fmean8370600 +Ref: a338370600 +Ref: library/statistics statistics geometric_mean8371551 +Ref: a348371551 +Ref: library/statistics statistics harmonic_mean8372240 +Ref: ce18372240 +Ref: library/statistics statistics kde8373799 +Ref: 24c8373799 +Ref: library/statistics statistics kde_random8375683 +Ref: 24d8375683 +Ref: library/statistics statistics median8376738 +Ref: 270f8376738 +Ref: library/statistics statistics median_low8377733 +Ref: 27108377733 +Ref: library/statistics statistics median_high8378374 +Ref: 27118378374 +Ref: library/statistics statistics median_grouped8379012 +Ref: 27128379012 +Ref: library/statistics statistics mode8380923 +Ref: a928380923 +Ref: library/statistics statistics multimode8382442 +Ref: a358382442 +Ref: library/statistics statistics pstdev8382863 +Ref: 27148382863 +Ref: library/statistics statistics pvariance8383163 +Ref: 27158383163 +Ref: library/statistics statistics stdev8385438 +Ref: 6cf8385438 +Ref: library/statistics statistics variance8385729 +Ref: 6ce8385729 +Ref: library/statistics statistics quantiles8388015 +Ref: a368388015 +Ref: library/statistics statistics covariance8390999 +Ref: 82c8390999 +Ref: library/statistics statistics correlation8391620 +Ref: 4b88391620 +Ref: library/statistics statistics linear_regression8393712 +Ref: 82d8393712 +Ref: Function details-Footnote-18396297 +Ref: Function details-Footnote-28396343 +Ref: Function details-Footnote-38396398 +Ref: Function details-Footnote-48396494 +Ref: Function details-Footnote-58396552 +Ref: Function details-Footnote-68396624 +Ref: Function details-Footnote-78396675 +Ref: Function details-Footnote-88396745 +Ref: Function details-Footnote-98396826 +Ref: Function details-Footnote-108396898 +Ref: Function details-Footnote-118396962 +Node: Exceptions<5>8397020 +Ref: library/statistics exceptions8397170 +Ref: 27198397170 +Ref: library/statistics statistics StatisticsError8397241 +Ref: 27188397241 +Node: NormalDist objects8397365 +Ref: library/statistics normaldist-objects8397522 +Ref: 271a8397522 +Ref: library/statistics statistics NormalDist8397910 +Ref: a378397910 +Ref: library/statistics statistics NormalDist mean8398175 +Ref: 271b8398175 +Ref: library/statistics statistics NormalDist median8398296 +Ref: 271c8398296 +Ref: library/statistics statistics NormalDist mode8398410 +Ref: 271d8398410 +Ref: library/statistics statistics NormalDist stdev8398510 +Ref: 271e8398510 +Ref: library/statistics statistics NormalDist variance8398635 +Ref: 271f8398635 +Ref: library/statistics statistics NormalDist from_samples8398801 +Ref: 27208398801 +Ref: library/statistics statistics NormalDist samples8399409 +Ref: 27218399409 +Ref: library/statistics statistics NormalDist pdf8400022 +Ref: 27228400022 +Ref: library/statistics statistics NormalDist cdf8400623 +Ref: 27238400623 +Ref: library/statistics statistics NormalDist inv_cdf8400866 +Ref: 27248400866 +Ref: library/statistics statistics NormalDist overlap8401305 +Ref: 27258401305 +Ref: library/statistics statistics NormalDist quantiles8401561 +Ref: 27268401561 +Ref: library/statistics statistics NormalDist zscore8402016 +Ref: 27278402016 +Ref: NormalDist objects-Footnote-18403441 +Ref: NormalDist objects-Footnote-28403505 +Ref: NormalDist objects-Footnote-38403565 +Ref: NormalDist objects-Footnote-48403619 +Ref: NormalDist objects-Footnote-58403676 +Ref: NormalDist objects-Footnote-68403730 +Ref: NormalDist objects-Footnote-78403775 +Ref: NormalDist objects-Footnote-88403831 +Ref: NormalDist objects-Footnote-98403888 +Ref: NormalDist objects-Footnote-108403935 +Ref: NormalDist objects-Footnote-118404003 +Ref: NormalDist objects-Footnote-128404075 +Ref: NormalDist objects-Footnote-138404132 +Ref: NormalDist objects-Footnote-148404267 +Ref: NormalDist objects-Footnote-158404314 +Ref: NormalDist objects-Footnote-168404392 +Node: Examples and Recipes<2>8404477 +Ref: library/statistics examples-and-recipes8404612 +Ref: 27288404612 +Node: Classic probability problems8404824 +Ref: library/statistics classic-probability-problems8404955 +Ref: 27298404955 +Ref: Classic probability problems-Footnote-18405782 +Ref: Classic probability problems-Footnote-28405853 +Ref: Classic probability problems-Footnote-38405900 +Node: Monte Carlo inputs for simulations8405945 +Ref: library/statistics monte-carlo-inputs-for-simulations8406121 +Ref: 272a8406121 +Ref: Monte Carlo inputs for simulations-Footnote-18406811 +Node: Approximating binomial distributions8406868 +Ref: library/statistics approximating-binomial-distributions8407041 +Ref: 272b8407041 +Ref: Approximating binomial distributions-Footnote-18408473 +Node: Naive bayesian classifier8408537 +Ref: library/statistics naive-bayesian-classifier8408667 +Ref: 272c8408667 +Ref: Naive bayesian classifier-Footnote-18410562 +Ref: Naive bayesian classifier-Footnote-28410646 +Ref: Naive bayesian classifier-Footnote-38410702 +Node: Functional Programming Modules8410772 +Ref: library/functional doc8410941 +Ref: 272d8410941 +Ref: library/functional functional-programming-modules8410941 +Ref: 272e8410941 +Node: itertools — Functions creating iterators for efficient looping8411424 +Ref: library/itertools doc8411635 +Ref: 272f8411635 +Ref: library/itertools itertools-functions-creating-iterators-for-efficient-looping8411635 +Ref: 27308411635 +Ref: library/itertools module-itertools8411635 +Ref: 818411635 +Node: Itertool Functions8422685 +Ref: library/itertools itertool-functions8422830 +Ref: 27388422830 +Ref: library/itertools itertools-functions8422830 +Ref: 27398422830 +Ref: library/itertools itertools accumulate8423070 +Ref: 9fc8423070 +Ref: library/itertools itertools batched8425487 +Ref: 2038425487 +Ref: library/itertools itertools chain8426819 +Ref: 217f8426819 +Ref: library/itertools itertools chain from_iterable8427298 +Ref: 27338427298 +Ref: library/itertools itertools combinations8427708 +Ref: 13058427708 +Ref: library/itertools itertools combinations_with_replacement8429320 +Ref: 12748429320 +Ref: library/itertools itertools compress8430904 +Ref: 12758430904 +Ref: library/itertools itertools count8431401 +Ref: 12768431401 +Ref: library/itertools itertools cycle8432218 +Ref: 27318432218 +Ref: library/itertools itertools dropwhile8432921 +Ref: 27348432921 +Ref: library/itertools itertools filterfalse8433628 +Ref: 216b8433628 +Ref: library/itertools itertools groupby8434213 +Ref: 27358434213 +Ref: library/itertools itertools islice8436837 +Ref: b4c8436837 +Ref: library/itertools itertools pairwise8438605 +Ref: 8118438605 +Ref: library/itertools itertools permutations8439222 +Ref: 191a8439222 +Ref: library/itertools itertools product8441291 +Ref: 13068441291 +Ref: library/itertools itertools repeat8442997 +Ref: 27328442997 +Ref: library/itertools itertools starmap8443683 +Ref: 10d98443683 +Ref: library/itertools itertools takewhile8444331 +Ref: 27368444331 +Ref: library/itertools itertools tee8445134 +Ref: 27378445134 +Ref: library/itertools itertools zip_longest8447869 +Ref: 12908447869 +Ref: Itertool Functions-Footnote-18449378 +Ref: Itertool Functions-Footnote-28449452 +Ref: Itertool Functions-Footnote-38449507 +Ref: Itertool Functions-Footnote-48449563 +Node: Itertools Recipes8449661 +Ref: library/itertools id18449806 +Ref: 273b8449806 +Ref: library/itertools itertools-recipes8449806 +Ref: 12528449806 +Ref: Itertools Recipes-Footnote-18463508 +Ref: Itertools Recipes-Footnote-28463557 +Node: functools — Higher-order functions and operations on callable objects8463628 +Ref: library/functools doc8463892 +Ref: 273c8463892 +Ref: library/functools functools-higher-order-functions-and-operations-on-callable-objects8463892 +Ref: 273d8463892 +Ref: library/functools module-functools8463892 +Ref: 5f8463892 +Ref: library/functools functools cache8464435 +Ref: 151f8464435 +Ref: library/functools functools cached_property8465666 +Ref: 53e8465666 +Ref: library/functools functools cmp_to_key8468974 +Ref: 11cc8468974 +Ref: library/functools functools lru_cache8470025 +Ref: 9ee8470025 +Ref: library/functools functools lru_cache cache_info8472554 +Ref: 273f8472554 +Ref: library/functools functools lru_cache cache_clear8472819 +Ref: 27408472819 +Ref: library/functools functools total_ordering8475548 +Ref: f3d8475548 +Ref: library/functools functools partial8477789 +Ref: 4108477789 +Ref: library/functools functools partialmethod8479172 +Ref: a7b8479172 +Ref: library/functools functools reduce8480917 +Ref: 12cf8480917 +Ref: library/functools functools singledispatch8482167 +Ref: 6358482167 +Ref: library/functools functools singledispatch register8482771 +Ref: 27428482771 +Ref: library/functools functools singledispatchmethod8488673 +Ref: 9ef8488673 +Ref: library/functools functools update_wrapper8490388 +Ref: 101b8490388 +Ref: library/functools functools wraps8492977 +Ref: f588492977 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-18494276 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-28494345 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-38494395 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-48494437 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-58494529 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-68494584 +Ref: functools — Higher-order functions and operations on callable objects-Footnote-78494642 +Node: partial Objects8494707 +Ref: library/functools id18494830 +Ref: 27448494830 +Ref: library/functools partial-objects8494830 +Ref: 27418494830 +Ref: library/functools functools partial func8495011 +Ref: 27458495011 +Ref: library/functools functools partial args8495200 +Ref: 27468495200 +Ref: library/functools functools partial keywords8495372 +Ref: 27478495372 +Node: operator — Standard operators as functions8495957 +Ref: library/operator doc8496148 +Ref: 27488496148 +Ref: library/operator module-operator8496148 +Ref: 9f8496148 +Ref: library/operator operator-standard-operators-as-functions8496148 +Ref: 27498496148 +Ref: library/operator operator lt8497081 +Ref: 274a8497081 +Ref: library/operator operator le8497114 +Ref: 274b8497114 +Ref: library/operator operator eq8497147 +Ref: 274c8497147 +Ref: library/operator operator ne8497180 +Ref: 274d8497180 +Ref: library/operator operator ge8497213 +Ref: 274e8497213 +Ref: library/operator operator gt8497246 +Ref: 274f8497246 +Ref: library/operator operator __lt__8497279 +Ref: 27508497279 +Ref: library/operator operator __le__8497316 +Ref: 27518497316 +Ref: library/operator operator __eq__8497353 +Ref: 27528497353 +Ref: library/operator operator __ne__8497390 +Ref: 27538497390 +Ref: library/operator operator __ge__8497427 +Ref: 27548497427 +Ref: library/operator operator __gt__8497464 +Ref: 27558497464 +Ref: library/operator operator not_8498204 +Ref: 27568498204 +Ref: library/operator operator __not__8498238 +Ref: 27578498238 +Ref: library/operator operator truth8498554 +Ref: 27588498554 +Ref: library/operator operator is_8498744 +Ref: 27598498744 +Ref: library/operator operator is_not8498830 +Ref: 275a8498830 +Ref: library/operator operator abs8498987 +Ref: 275b8498987 +Ref: library/operator operator __abs__8499020 +Ref: 275c8499020 +Ref: library/operator operator add8499100 +Ref: 275d8499100 +Ref: library/operator operator __add__8499134 +Ref: 275e8499134 +Ref: library/operator operator and_8499224 +Ref: 275f8499224 +Ref: library/operator operator __and__8499259 +Ref: 27608499259 +Ref: library/operator operator floordiv8499343 +Ref: 27618499343 +Ref: library/operator operator __floordiv__8499382 +Ref: 27628499382 +Ref: library/operator operator index8499453 +Ref: 190e8499453 +Ref: library/operator operator __index__8499486 +Ref: 27638499486 +Ref: library/operator operator inv8499772 +Ref: 27648499772 +Ref: library/operator operator invert8499805 +Ref: 27658499805 +Ref: library/operator operator __inv__8499841 +Ref: 27668499841 +Ref: library/operator operator __invert__8499878 +Ref: 27678499878 +Ref: library/operator operator lshift8500013 +Ref: 27688500013 +Ref: library/operator operator __lshift__8500050 +Ref: 27698500050 +Ref: library/operator operator mod8500130 +Ref: 276a8500130 +Ref: library/operator operator __mod__8500164 +Ref: 276b8500164 +Ref: library/operator operator mul8500229 +Ref: 273a8500229 +Ref: library/operator operator __mul__8500263 +Ref: 276c8500263 +Ref: library/operator operator matmul8500353 +Ref: e348500353 +Ref: library/operator operator __matmul__8500390 +Ref: 276d8500390 +Ref: library/operator operator neg8500486 +Ref: 276e8500486 +Ref: library/operator operator __neg__8500519 +Ref: 276f8500519 +Ref: library/operator operator or_8500598 +Ref: 27708500598 +Ref: library/operator operator __or__8500632 +Ref: 27718500632 +Ref: library/operator operator pos8500714 +Ref: 27728500714 +Ref: library/operator operator __pos__8500747 +Ref: 27738500747 +Ref: library/operator operator pow8500827 +Ref: 27748500827 +Ref: library/operator operator __pow__8500861 +Ref: 27758500861 +Ref: library/operator operator rshift8500952 +Ref: 27768500952 +Ref: library/operator operator __rshift__8500989 +Ref: 27778500989 +Ref: library/operator operator sub8501070 +Ref: 27788501070 +Ref: library/operator operator __sub__8501104 +Ref: 27798501104 +Ref: library/operator operator truediv8501169 +Ref: 277a8501169 +Ref: library/operator operator __truediv__8501207 +Ref: 277b8501207 +Ref: library/operator operator xor8501356 +Ref: 277c8501356 +Ref: library/operator operator __xor__8501390 +Ref: 277d8501390 +Ref: library/operator operator concat8501563 +Ref: 277e8501563 +Ref: library/operator operator __concat__8501600 +Ref: 277f8501600 +Ref: library/operator operator contains8501694 +Ref: 8d98501694 +Ref: library/operator operator __contains__8501733 +Ref: 27808501733 +Ref: library/operator operator countOf8501862 +Ref: 8db8501862 +Ref: library/operator operator delitem8501955 +Ref: 27818501955 +Ref: library/operator operator __delitem__8501993 +Ref: 27828501993 +Ref: library/operator operator getitem8502080 +Ref: 27838502080 +Ref: library/operator operator __getitem__8502118 +Ref: 27848502118 +Ref: library/operator operator indexOf8502205 +Ref: 8da8502205 +Ref: library/operator operator setitem8502309 +Ref: 27858502309 +Ref: library/operator operator __setitem__8502350 +Ref: 27868502350 +Ref: library/operator operator length_hint8502444 +Ref: f688502444 +Ref: library/operator operator call8502780 +Ref: 187d8502780 +Ref: library/operator operator __call__8502834 +Ref: 27878502834 +Ref: library/operator operator attrgetter8503250 +Ref: e328503250 +Ref: library/operator operator itemgetter8504551 +Ref: a618504551 +Ref: library/operator operator methodcaller8506324 +Ref: e338506324 +Ref: operator — Standard operators as functions-Footnote-18507123 +Node: Mapping Operators to Functions8507191 +Ref: library/operator mapping-operators-to-functions8507329 +Ref: 27888507329 +Ref: library/operator operator-map8507329 +Ref: 27898507329 +Node: In-place Operators8514753 +Ref: library/operator in-place-operators8514891 +Ref: 278a8514891 +Ref: library/operator operator iadd8516199 +Ref: 278c8516199 +Ref: library/operator operator __iadd__8516234 +Ref: 278d8516234 +Ref: library/operator operator iand8516332 +Ref: 278e8516332 +Ref: library/operator operator __iand__8516367 +Ref: 278f8516367 +Ref: library/operator operator iconcat8516465 +Ref: 27908516465 +Ref: library/operator operator __iconcat__8516503 +Ref: 27918516503 +Ref: library/operator operator ifloordiv8516638 +Ref: 27928516638 +Ref: library/operator operator __ifloordiv__8516678 +Ref: 27938516678 +Ref: library/operator operator ilshift8516787 +Ref: 27948516787 +Ref: library/operator operator __ilshift__8516825 +Ref: 27958516825 +Ref: library/operator operator imod8516930 +Ref: 27968516930 +Ref: library/operator operator __imod__8516965 +Ref: 27978516965 +Ref: library/operator operator imul8517063 +Ref: 27988517063 +Ref: library/operator operator __imul__8517098 +Ref: 27998517098 +Ref: library/operator operator imatmul8517196 +Ref: e358517196 +Ref: library/operator operator __imatmul__8517234 +Ref: 279a8517234 +Ref: library/operator operator ior8517366 +Ref: 279b8517366 +Ref: library/operator operator __ior__8517400 +Ref: 279c8517400 +Ref: library/operator operator ipow8517496 +Ref: 279d8517496 +Ref: library/operator operator __ipow__8517531 +Ref: 279e8517531 +Ref: library/operator operator irshift8517630 +Ref: 279f8517630 +Ref: library/operator operator __irshift__8517668 +Ref: 27a08517668 +Ref: library/operator operator isub8517773 +Ref: 27a18517773 +Ref: library/operator operator __isub__8517808 +Ref: 27a28517808 +Ref: library/operator operator itruediv8517906 +Ref: 27a38517906 +Ref: library/operator operator __itruediv__8517945 +Ref: 27a48517945 +Ref: library/operator operator ixor8518051 +Ref: 27a58518051 +Ref: library/operator operator __ixor__8518086 +Ref: 27a68518086 +Node: File and Directory Access8518184 +Ref: library/filesys doc8518337 +Ref: 27a78518337 +Ref: library/filesys file-and-directory-access8518337 +Ref: 27a88518337 +Ref: library/filesys filesys8518337 +Ref: 27a98518337 +Node: pathlib — Object-oriented filesystem paths8519174 +Ref: library/pathlib doc8519330 +Ref: 27aa8519330 +Ref: library/pathlib module-pathlib8519330 +Ref: a48519330 +Ref: library/pathlib pathlib-object-oriented-filesystem-paths8519330 +Ref: 27ab8519330 +Ref: pathlib — Object-oriented filesystem paths-Footnote-18521537 +Ref: pathlib — Object-oriented filesystem paths-Footnote-28521602 +Node: Basic use8521644 +Ref: library/pathlib basic-use8521756 +Ref: 27af8521756 +Node: Exceptions<6>8522702 +Ref: library/pathlib exceptions8522833 +Ref: 27b08522833 +Ref: library/pathlib pathlib UnsupportedOperation8522874 +Ref: 2298522874 +Node: Pure paths8523088 +Ref: library/pathlib id18523224 +Ref: 27b18523224 +Ref: library/pathlib pure-paths8523224 +Ref: 27ac8523224 +Ref: library/pathlib pathlib PurePath8523439 +Ref: 4a28523439 +Ref: library/pathlib pathlib PurePosixPath8525803 +Ref: 27b28525803 +Ref: library/pathlib pathlib PureWindowsPath8526107 +Ref: 17048526107 +Ref: Pure paths-Footnote-18526868 +Node: General properties8526927 +Ref: library/pathlib general-properties8527013 +Ref: 27b38527013 +Node: Operators<2>8527876 +Ref: library/pathlib operators8527997 +Ref: 27b48527997 +Node: Accessing individual parts8529540 +Ref: library/pathlib accessing-individual-parts8529665 +Ref: 27b58529665 +Ref: library/pathlib pathlib PurePath parts8529828 +Ref: 27b68529828 +Node: Methods and properties8530231 +Ref: library/pathlib methods-and-properties8530335 +Ref: 27b78530335 +Ref: library/pathlib pathlib PurePath parser8530458 +Ref: 22e8530458 +Ref: library/pathlib pathlib PurePath drive8530667 +Ref: 27b88530667 +Ref: library/pathlib pathlib PurePath root8531090 +Ref: 27b98531090 +Ref: library/pathlib pathlib PurePath anchor8532137 +Ref: 27ba8532137 +Ref: library/pathlib pathlib PurePath parents8532504 +Ref: 81c8532504 +Ref: library/pathlib pathlib PurePath parent8532990 +Ref: 172c8532990 +Ref: library/pathlib pathlib PurePath name8533810 +Ref: 27bb8533810 +Ref: library/pathlib pathlib PurePath suffix8534203 +Ref: 27bc8534203 +Ref: library/pathlib pathlib PurePath suffixes8534563 +Ref: 27bd8534563 +Ref: library/pathlib pathlib PurePath stem8534901 +Ref: 27be8534901 +Ref: library/pathlib pathlib PurePath as_posix8535200 +Ref: 27bf8535200 +Ref: library/pathlib pathlib PurePath is_absolute8535465 +Ref: 172b8535465 +Ref: library/pathlib pathlib PurePath is_relative_to8536057 +Ref: 2cc8536057 +Ref: library/pathlib pathlib PurePath is_reserved8536772 +Ref: 2a88536772 +Ref: library/pathlib pathlib PurePath joinpath8537361 +Ref: 27c08537361 +Ref: library/pathlib pathlib PurePath full_match8537948 +Ref: 22d8537948 +Ref: library/pathlib pathlib PurePath match8538863 +Ref: 4a88538863 +Ref: library/pathlib pathlib PurePath relative_to8539777 +Ref: 2cd8539777 +Ref: library/pathlib pathlib PurePath with_name8541986 +Ref: 16f78541986 +Ref: library/pathlib pathlib PurePath with_stem8542700 +Ref: 165d8542700 +Ref: library/pathlib pathlib PurePath with_suffix8543718 +Ref: 16188543718 +Ref: library/pathlib pathlib PurePath with_segments8544388 +Ref: 4a38544388 +Ref: Methods and properties-Footnote-18545324 +Node: Concrete paths8545416 +Ref: library/pathlib concrete-paths8545555 +Ref: 27ad8545555 +Ref: library/pathlib id28545555 +Ref: 27c28545555 +Ref: library/pathlib pathlib Path8545827 +Ref: 22b8545827 +Ref: library/pathlib pathlib PosixPath8546209 +Ref: 27c38546209 +Ref: library/pathlib pathlib WindowsPath8546698 +Ref: 27ae8546698 +Node: Parsing and generating URIs8548224 +Ref: library/pathlib parsing-and-generating-uris8548340 +Ref: 27c48548340 +Ref: library/pathlib pathlib Path from_uri8548631 +Ref: 22c8548631 +Ref: library/pathlib pathlib Path as_uri8549661 +Ref: 27c68549661 +Ref: Parsing and generating URIs-Footnote-18550217 +Node: Expanding and resolving paths8550276 +Ref: library/pathlib expanding-and-resolving-paths8550430 +Ref: 27c78550430 +Ref: library/pathlib pathlib Path home8550511 +Ref: e428550511 +Ref: library/pathlib pathlib Path expanduser8550881 +Ref: e418550881 +Ref: library/pathlib pathlib Path cwd8551286 +Ref: 172a8551286 +Ref: library/pathlib pathlib Path absolute8551508 +Ref: 16ae8551508 +Ref: library/pathlib pathlib Path resolve8551802 +Ref: 16fc8551802 +Ref: library/pathlib pathlib Path readlink8552937 +Ref: 91e8552937 +Node: Querying file type and status8553427 +Ref: library/pathlib querying-file-type-and-status8553579 +Ref: 27c88553579 +Ref: library/pathlib pathlib Path stat8554024 +Ref: 81f8554024 +Ref: library/pathlib pathlib Path lstat8554612 +Ref: 27c98554612 +Ref: library/pathlib pathlib Path exists8554797 +Ref: a158554797 +Ref: library/pathlib pathlib Path is_file8555343 +Ref: 2318555343 +Ref: library/pathlib pathlib Path is_dir8555852 +Ref: 2328555852 +Ref: library/pathlib pathlib Path is_symlink8556372 +Ref: a178556372 +Ref: library/pathlib pathlib Path is_junction8556621 +Ref: 4a78556621 +Ref: library/pathlib pathlib Path is_mount8556834 +Ref: a168556834 +Ref: library/pathlib pathlib Path is_socket8557537 +Ref: a1b8557537 +Ref: library/pathlib pathlib Path is_fifo8557885 +Ref: a1a8557885 +Ref: library/pathlib pathlib Path is_block_device8558212 +Ref: a188558212 +Ref: library/pathlib pathlib Path is_char_device8558568 +Ref: a198558568 +Ref: library/pathlib pathlib Path samefile8558931 +Ref: e3f8558931 +Node: Reading and writing files8559484 +Ref: library/pathlib reading-and-writing-files8559626 +Ref: 27ca8559626 +Ref: library/pathlib pathlib Path open8559699 +Ref: 27cb8559699 +Ref: library/pathlib pathlib Path read_text8560052 +Ref: e448560052 +Ref: library/pathlib pathlib Path read_bytes8560567 +Ref: e468560567 +Ref: library/pathlib pathlib Path write_text8560878 +Ref: e438560878 +Ref: library/pathlib pathlib Path write_bytes8561444 +Ref: e458561444 +Node: Reading directories8561827 +Ref: library/pathlib reading-directories8561970 +Ref: 27cc8561970 +Ref: library/pathlib pathlib Path iterdir8562031 +Ref: 16318562031 +Ref: library/pathlib pathlib Path glob8562886 +Ref: 22f8562886 +Ref: library/pathlib pathlib Path rglob8564802 +Ref: 2308564802 +Ref: library/pathlib pathlib Path walk8565538 +Ref: 4a48565538 +Node: Creating files and directories8570522 +Ref: library/pathlib creating-files-and-directories8570661 +Ref: 27ce8570661 +Ref: library/pathlib pathlib Path touch8570744 +Ref: 27cf8570744 +Ref: library/pathlib pathlib Path mkdir8571325 +Ref: e408571325 +Ref: library/pathlib pathlib Path symlink_to8572387 +Ref: 81e8572387 +Ref: library/pathlib pathlib Path hardlink_to8573475 +Ref: 81d8573475 +Node: Renaming and deleting8573909 +Ref: library/pathlib renaming-and-deleting8574054 +Ref: 27d08574054 +Ref: library/pathlib pathlib Path rename8574119 +Ref: 27d18574119 +Ref: library/pathlib pathlib Path replace8575140 +Ref: 27d28575140 +Ref: library/pathlib pathlib Path unlink8575678 +Ref: 19f18575678 +Ref: library/pathlib pathlib Path rmdir8576173 +Ref: 27cd8576173 +Node: Permissions and ownership8576259 +Ref: library/pathlib permissions-and-ownership8576365 +Ref: 27d38576365 +Ref: library/pathlib pathlib Path owner8576438 +Ref: 2338576438 +Ref: library/pathlib pathlib Path group8577054 +Ref: 2348577054 +Ref: library/pathlib pathlib Path chmod8577672 +Ref: 8208577672 +Ref: library/pathlib pathlib Path lchmod8578267 +Ref: 27d48578267 +Node: Pattern language8578450 +Ref: library/pathlib pathlib-pattern-language8578608 +Ref: 27c18578608 +Ref: library/pathlib pattern-language8578608 +Ref: 27d58578608 +Node: Comparison to the glob module8581114 +Ref: library/pathlib comparison-to-the-glob-module8581298 +Ref: 27d68581298 +Node: Comparison to the os and os path modules8582748 +Ref: library/pathlib comparison-to-the-os-and-os-path-modules8582907 +Ref: 27d78582907 +Node: Corresponding tools8585094 +Ref: library/pathlib corresponding-tools8585190 +Ref: 27d88585190 +Ref: Corresponding tools-Footnote-18590458 +Ref: Corresponding tools-Footnote-28590772 +Ref: Corresponding tools-Footnote-38590953 +Ref: Corresponding tools-Footnote-48591183 +Node: os path — Common pathname manipulations8591415 +Ref: library/os path doc8591614 +Ref: 27dc8591614 +Ref: library/os path module-os path8591614 +Ref: a28591614 +Ref: library/os path os-path-common-pathname-manipulations8591614 +Ref: 27dd8591614 +Ref: library/os path os path abspath8593622 +Ref: 130e8593622 +Ref: library/os path os path basename8593949 +Ref: 27da8593949 +Ref: library/os path os path commonpath8594463 +Ref: e3c8594463 +Ref: library/os path os path commonprefix8595028 +Ref: e3d8595028 +Ref: library/os path os path dirname8595679 +Ref: 27d98595679 +Ref: library/os path os path exists8595954 +Ref: a0d8595954 +Ref: library/os path os path lexists8596542 +Ref: a0e8596542 +Ref: library/os path os path expanduser8596834 +Ref: a138596834 +Ref: library/os path os path expandvars8597911 +Ref: 13a58597911 +Ref: library/os path os path getatime8598403 +Ref: 27df8598403 +Ref: library/os path os path getmtime8598706 +Ref: 27e08598706 +Ref: library/os path os path getctime8599084 +Ref: 27e18599084 +Ref: library/os path os path getsize8599577 +Ref: 27e28599577 +Ref: library/os path os path isabs8599810 +Ref: 2268599810 +Ref: library/os path os path isfile8600257 +Ref: a108600257 +Ref: library/os path os path isdir8600562 +Ref: a0f8600562 +Ref: library/os path os path isjunction8600866 +Ref: 49f8600866 +Ref: library/os path os path islink8601133 +Ref: a0b8601133 +Ref: library/os path os path ismount8601437 +Ref: a118601437 +Ref: library/os path os path isdevdrive8602455 +Ref: 16488602455 +Ref: library/os path os path isreserved8603291 +Ref: 2258603291 +Ref: library/os path os path join8604182 +Ref: 16338604182 +Ref: library/os path os path normcase8605316 +Ref: 27e38605316 +Ref: library/os path os path normpath8605658 +Ref: 130d8605658 +Ref: library/os path os path realpath8606564 +Ref: 2278606564 +Ref: library/os path os path ALLOW_MISSING8608806 +Ref: 4268608806 +Ref: library/os path os path relpath8608952 +Ref: 4a68608952 +Ref: library/os path os path samefile8609478 +Ref: f6c8609478 +Ref: library/os path os path sameopenfile8609995 +Ref: 27e58609995 +Ref: library/os path os path samestat8610257 +Ref: f6b8610257 +Ref: library/os path os path split8610696 +Ref: 27de8610696 +Ref: library/os path os path splitdrive8611488 +Ref: bf48611488 +Ref: library/os path os path splitroot8612324 +Ref: 4a08612324 +Ref: library/os path os path splitext8613594 +Ref: 27db8613594 +Ref: library/os path os path supports_unicode_filenames8614559 +Ref: 14558614559 +Ref: os path — Common pathname manipulations-Footnote-18614767 +Ref: os path — Common pathname manipulations-Footnote-28614838 +Ref: os path — Common pathname manipulations-Footnote-38614907 +Ref: os path — Common pathname manipulations-Footnote-48614973 +Ref: os path — Common pathname manipulations-Footnote-58615028 +Ref: os path — Common pathname manipulations-Footnote-68615120 +Node: stat — Interpreting stat results8615212 +Ref: library/stat doc8615409 +Ref: 27e68615409 +Ref: library/stat module-stat8615409 +Ref: d18615409 +Ref: library/stat stat-interpreting-stat-results8615409 +Ref: 27e78615409 +Ref: library/stat stat S_ISDIR8616087 +Ref: 27e88616087 +Ref: library/stat stat S_ISCHR8616177 +Ref: 27e98616177 +Ref: library/stat stat S_ISBLK8616292 +Ref: 27ea8616292 +Ref: library/stat stat S_ISREG8616398 +Ref: 27eb8616398 +Ref: library/stat stat S_ISFIFO8616491 +Ref: 27ec8616491 +Ref: library/stat stat S_ISLNK8616590 +Ref: 27ed8616590 +Ref: library/stat stat S_ISSOCK8616684 +Ref: 27ee8616684 +Ref: library/stat stat S_ISDOOR8616772 +Ref: 19c58616772 +Ref: library/stat stat S_ISPORT8616886 +Ref: 19c68616886 +Ref: library/stat stat S_ISWHT8617007 +Ref: 19c78617007 +Ref: library/stat stat S_IMODE8617214 +Ref: 27ef8617214 +Ref: library/stat stat S_IFMT8617481 +Ref: 27f08617481 +Ref: library/stat stat filemode8619012 +Ref: 113f8619012 +Ref: library/stat stat ST_MODE8619425 +Ref: fb48619425 +Ref: library/stat stat ST_INO8619478 +Ref: 27f18619478 +Ref: library/stat stat ST_DEV8619521 +Ref: 27f28619521 +Ref: library/stat stat ST_NLINK8619575 +Ref: 27f38619575 +Ref: library/stat stat ST_UID8619636 +Ref: 27f48619636 +Ref: library/stat stat ST_GID8619687 +Ref: 27f58619687 +Ref: library/stat stat ST_SIZE8619739 +Ref: 27f68619739 +Ref: library/stat stat ST_ATIME8619851 +Ref: 27f78619851 +Ref: library/stat stat ST_MTIME8619903 +Ref: 27f88619903 +Ref: library/stat stat ST_CTIME8619961 +Ref: 27f98619961 +Ref: library/stat stat S_IFSOCK8621003 +Ref: 27fa8621003 +Ref: library/stat stat S_IFLNK8621042 +Ref: 27fb8621042 +Ref: library/stat stat S_IFREG8621087 +Ref: 27fc8621087 +Ref: library/stat stat S_IFBLK8621131 +Ref: 27fd8621131 +Ref: library/stat stat S_IFDIR8621175 +Ref: 27fe8621175 +Ref: library/stat stat S_IFCHR8621216 +Ref: 27ff8621216 +Ref: library/stat stat S_IFIFO8621264 +Ref: 28008621264 +Ref: library/stat stat S_IFDOOR8621300 +Ref: fb58621300 +Ref: library/stat stat S_IFPORT8621365 +Ref: fb68621365 +Ref: library/stat stat S_IFWHT8621436 +Ref: fb78621436 +Ref: library/stat stat S_ISUID8621756 +Ref: 28018621756 +Ref: library/stat stat S_ISGID8621799 +Ref: 28028621799 +Ref: library/stat stat S_ISVTX8622376 +Ref: 28058622376 +Ref: library/stat stat S_IRWXU8622625 +Ref: 28068622625 +Ref: library/stat stat S_IRUSR8622688 +Ref: 28078622688 +Ref: library/stat stat S_IWUSR8622745 +Ref: 28088622745 +Ref: library/stat stat S_IXUSR8622803 +Ref: 28098622803 +Ref: library/stat stat S_IRWXG8622863 +Ref: 280a8622863 +Ref: library/stat stat S_IRGRP8622921 +Ref: 280b8622921 +Ref: library/stat stat S_IWGRP8622978 +Ref: 280c8622978 +Ref: library/stat stat S_IXGRP8623036 +Ref: 28038623036 +Ref: library/stat stat S_IRWXO8623096 +Ref: 280d8623096 +Ref: library/stat stat S_IROTH8623174 +Ref: 280e8623174 +Ref: library/stat stat S_IWOTH8623233 +Ref: 280f8623233 +Ref: library/stat stat S_IXOTH8623293 +Ref: 28108623293 +Ref: library/stat stat S_ENFMT8623355 +Ref: 28048623355 +Ref: library/stat stat S_IREAD8623588 +Ref: 28118623588 +Ref: library/stat stat S_IWRITE8623659 +Ref: 28128623659 +Ref: library/stat stat S_IEXEC8623731 +Ref: 28138623731 +Ref: library/stat stat UF_SETTABLE8623889 +Ref: 28148623889 +Ref: library/stat stat UF_NODUMP8623977 +Ref: 28158623977 +Ref: library/stat stat UF_IMMUTABLE8624031 +Ref: 28168624031 +Ref: library/stat stat UF_APPEND8624095 +Ref: 28178624095 +Ref: library/stat stat UF_OPAQUE8624161 +Ref: 28188624161 +Ref: library/stat stat UF_NOUNLINK8624252 +Ref: 28198624252 +Ref: library/stat stat UF_COMPRESSED8624326 +Ref: 281a8624326 +Ref: library/stat stat UF_TRACKED8624407 +Ref: 281b8624407 +Ref: library/stat stat UF_DATAVAULT8624508 +Ref: 281c8624508 +Ref: library/stat stat UF_HIDDEN8624640 +Ref: 281d8624640 +Ref: library/stat stat SF_SETTABLE8624729 +Ref: 281e8624729 +Ref: library/stat stat SF_SUPPORTED8624824 +Ref: 281f8624824 +Ref: library/stat stat SF_SYNTHETIC8624958 +Ref: 28208624958 +Ref: library/stat stat SF_ARCHIVED8625102 +Ref: 28218625102 +Ref: library/stat stat SF_IMMUTABLE8625162 +Ref: 28228625162 +Ref: library/stat stat SF_APPEND8625226 +Ref: 28238625226 +Ref: library/stat stat SF_RESTRICTED8625292 +Ref: 28248625292 +Ref: library/stat stat SF_NOUNLINK8625414 +Ref: 28258625414 +Ref: library/stat stat SF_SNAPSHOT8625488 +Ref: 28268625488 +Ref: library/stat stat SF_FIRMLINK8625551 +Ref: 28278625551 +Ref: library/stat stat SF_DATALESS8625652 +Ref: 28288625652 +Ref: library/stat stat FILE_ATTRIBUTE_ARCHIVE8626096 +Ref: 28298626096 +Ref: library/stat stat FILE_ATTRIBUTE_COMPRESSED8626134 +Ref: 282a8626134 +Ref: library/stat stat FILE_ATTRIBUTE_DEVICE8626175 +Ref: 282b8626175 +Ref: library/stat stat FILE_ATTRIBUTE_DIRECTORY8626212 +Ref: 282c8626212 +Ref: library/stat stat FILE_ATTRIBUTE_ENCRYPTED8626252 +Ref: 282d8626252 +Ref: library/stat stat FILE_ATTRIBUTE_HIDDEN8626292 +Ref: 282e8626292 +Ref: library/stat stat FILE_ATTRIBUTE_INTEGRITY_STREAM8626329 +Ref: 282f8626329 +Ref: library/stat stat FILE_ATTRIBUTE_NORMAL8626376 +Ref: 28308626376 +Ref: library/stat stat FILE_ATTRIBUTE_NOT_CONTENT_INDEXED8626413 +Ref: 28318626413 +Ref: library/stat stat FILE_ATTRIBUTE_NO_SCRUB_DATA8626463 +Ref: 28328626463 +Ref: library/stat stat FILE_ATTRIBUTE_OFFLINE8626507 +Ref: 28338626507 +Ref: library/stat stat FILE_ATTRIBUTE_READONLY8626545 +Ref: 28348626545 +Ref: library/stat stat FILE_ATTRIBUTE_REPARSE_POINT8626584 +Ref: 28358626584 +Ref: library/stat stat FILE_ATTRIBUTE_SPARSE_FILE8626628 +Ref: 28368626628 +Ref: library/stat stat FILE_ATTRIBUTE_SYSTEM8626670 +Ref: 28378626670 +Ref: library/stat stat FILE_ATTRIBUTE_TEMPORARY8626707 +Ref: 28388626707 +Ref: library/stat stat FILE_ATTRIBUTE_VIRTUAL8626747 +Ref: 28398626747 +Ref: library/stat stat IO_REPARSE_TAG_SYMLINK8627019 +Ref: 283a8627019 +Ref: library/stat stat IO_REPARSE_TAG_MOUNT_POINT8627057 +Ref: 283b8627057 +Ref: library/stat stat IO_REPARSE_TAG_APPEXECLINK8627099 +Ref: 283c8627099 +Ref: stat — Interpreting stat results-Footnote-18627206 +Ref: stat — Interpreting stat results-Footnote-28627270 +Ref: stat — Interpreting stat results-Footnote-38627317 +Node: filecmp — File and Directory Comparisons8627397 +Ref: library/filecmp doc8627606 +Ref: 283d8627606 +Ref: library/filecmp filecmp-file-and-directory-comparisons8627606 +Ref: 283e8627606 +Ref: library/filecmp module-filecmp8627606 +Ref: 5a8627606 +Ref: library/filecmp filecmp cmp8628075 +Ref: 165e8628075 +Ref: library/filecmp filecmp cmpfiles8628868 +Ref: 15ea8628868 +Ref: library/filecmp filecmp clear_cache8629813 +Ref: f398629813 +Ref: filecmp — File and Directory Comparisons-Footnote-18630130 +Node: The dircmp class8630197 +Ref: library/filecmp dircmp-objects8630292 +Ref: 283f8630292 +Ref: library/filecmp the-dircmp-class8630292 +Ref: 28408630292 +Ref: library/filecmp filecmp dircmp8630353 +Ref: f3b8630353 +Ref: library/filecmp filecmp dircmp report8631024 +Ref: 28418631024 +Ref: library/filecmp filecmp dircmp report_partial_closure8631141 +Ref: 28428631141 +Ref: library/filecmp filecmp dircmp report_full_closure8631282 +Ref: 28438631282 +Ref: library/filecmp filecmp dircmp left8631801 +Ref: 28448631801 +Ref: library/filecmp filecmp dircmp right8631857 +Ref: 28458631857 +Ref: library/filecmp filecmp dircmp left_list8631914 +Ref: 28468631914 +Ref: library/filecmp filecmp dircmp right_list8632032 +Ref: 28478632032 +Ref: library/filecmp filecmp dircmp common8632151 +Ref: 28488632151 +Ref: library/filecmp filecmp dircmp left_only8632236 +Ref: 28498632236 +Ref: library/filecmp filecmp dircmp right_only8632316 +Ref: 284a8632316 +Ref: library/filecmp filecmp dircmp common_dirs8632397 +Ref: 284b8632397 +Ref: library/filecmp filecmp dircmp common_files8632477 +Ref: 284c8632477 +Ref: library/filecmp filecmp dircmp common_funny8632549 +Ref: 284d8632549 +Ref: library/filecmp filecmp dircmp same_files8632752 +Ref: 284e8632752 +Ref: library/filecmp filecmp dircmp diff_files8632898 +Ref: 284f8632898 +Ref: library/filecmp filecmp dircmp funny_files8633063 +Ref: 28508633063 +Ref: library/filecmp filecmp dircmp subdirs8633181 +Ref: 191c8633181 +Ref: library/filecmp filecmp DEFAULT_IGNORES8633639 +Ref: f3a8633639 +Node: tempfile — Generate temporary files and directories8634320 +Ref: library/tempfile doc8634541 +Ref: 28518634541 +Ref: library/tempfile module-tempfile8634541 +Ref: e08634541 +Ref: library/tempfile tempfile-generate-temporary-files-and-directories8634541 +Ref: 28528634541 +Ref: library/tempfile tempfile TemporaryFile8635707 +Ref: 28538635707 +Ref: library/tempfile tempfile NamedTemporaryFile8637882 +Ref: 4c28637882 +Ref: library/tempfile tempfile SpooledTemporaryFile8641682 +Ref: 68f8641682 +Ref: library/tempfile tempfile SpooledTemporaryFile rollover8642204 +Ref: 28578642204 +Ref: library/tempfile tempfile TemporaryDirectory8643166 +Ref: 12278643166 +Ref: library/tempfile tempfile TemporaryDirectory name8643693 +Ref: 28588643693 +Ref: library/tempfile tempfile TemporaryDirectory cleanup8644048 +Ref: 28598644048 +Ref: library/tempfile tempfile mkstemp8645310 +Ref: 28548645310 +Ref: library/tempfile tempfile mkdtemp8648193 +Ref: 2218648193 +Ref: library/tempfile tempfile gettempdir8649428 +Ref: 18d98649428 +Ref: library/tempfile tempfile gettempdirb8650612 +Ref: 18da8650612 +Ref: library/tempfile tempfile gettempprefix8650753 +Ref: 285b8650753 +Ref: library/tempfile tempfile gettempprefixb8650912 +Ref: 285c8650912 +Ref: library/tempfile tempfile tempdir8651491 +Ref: 18d88651491 +Ref: tempfile — Generate temporary files and directories-Footnote-18652606 +Node: Examples<5>8652674 +Ref: library/tempfile examples8652818 +Ref: 285d8652818 +Ref: library/tempfile tempfile-examples8652818 +Ref: 28558652818 +Node: Deprecated functions and variables8654213 +Ref: library/tempfile deprecated-functions-and-variables8654357 +Ref: 285e8654357 +Ref: library/tempfile tempfile-mktemp-deprecated8654357 +Ref: 285f8654357 +Ref: library/tempfile tempfile mktemp8654987 +Ref: 188d8654987 +Node: glob — Unix style pathname pattern expansion8656120 +Ref: library/glob doc8656341 +Ref: 28608656341 +Ref: library/glob glob-unix-style-pathname-pattern-expansion8656341 +Ref: 28618656341 +Ref: library/glob module-glob8656341 +Ref: 648656341 +Ref: library/glob glob glob8657484 +Ref: 2a18657484 +Ref: library/glob glob iglob8659818 +Ref: 8038659818 +Ref: library/glob glob escape8660730 +Ref: f418660730 +Ref: library/glob glob translate8661153 +Ref: 1ec8661153 +Ref: glob — Unix style pathname pattern expansion-Footnote-18662716 +Node: Examples<6>8662780 +Ref: library/glob examples8662874 +Ref: 28628662874 +Node: fnmatch — Unix filename pattern matching8663983 +Ref: library/fnmatch doc8664192 +Ref: 28638664192 +Ref: library/fnmatch fnmatch-unix-filename-pattern-matching8664192 +Ref: 28648664192 +Ref: library/fnmatch module-fnmatch8664192 +Ref: 5c8664192 +Ref: library/fnmatch fnmatch fnmatch8666045 +Ref: 189f8666045 +Ref: library/fnmatch fnmatch fnmatchcase8666722 +Ref: 18a08666722 +Ref: library/fnmatch fnmatch filter8666980 +Ref: 18a18666980 +Ref: library/fnmatch fnmatch translate8667272 +Ref: 1a458667272 +Ref: fnmatch — Unix filename pattern matching-Footnote-18667907 +Node: linecache — Random access to text lines8667974 +Ref: library/linecache doc8668174 +Ref: 28658668174 +Ref: library/linecache linecache-random-access-to-text-lines8668174 +Ref: 28668668174 +Ref: library/linecache module-linecache8668174 +Ref: 858668174 +Ref: library/linecache linecache getline8669003 +Ref: e228669003 +Ref: library/linecache linecache clearcache8669772 +Ref: 28698669772 +Ref: library/linecache linecache checkcache8669941 +Ref: 15848669941 +Ref: library/linecache linecache lazycache8670219 +Ref: e218670219 +Ref: linecache — Random access to text lines-Footnote-18670768 +Ref: linecache — Random access to text lines-Footnote-28670837 +Node: shutil — High-level file operations8670879 +Ref: library/shutil doc8671028 +Ref: 286a8671028 +Ref: library/shutil module-shutil8671028 +Ref: c58671028 +Ref: library/shutil shutil-high-level-file-operations8671028 +Ref: 286b8671028 +Ref: shutil — High-level file operations-Footnote-18672129 +Node: Directory and files operations8672195 +Ref: library/shutil directory-and-files-operations8672328 +Ref: 286c8672328 +Ref: library/shutil file-operations8672328 +Ref: 286d8672328 +Ref: library/shutil shutil copyfileobj8672409 +Ref: a5c8672409 +Ref: library/shutil shutil copyfile8673006 +Ref: a588673006 +Ref: library/shutil shutil SameFileError8674620 +Ref: f988674620 +Ref: library/shutil shutil copymode8674792 +Ref: 16ab8674792 +Ref: library/shutil shutil copystat8675700 +Ref: 11228675700 +Ref: library/shutil shutil copy8677841 +Ref: a598677841 +Ref: library/shutil shutil copy28679348 +Ref: a5a8679348 +Ref: library/shutil shutil ignore_patterns8680865 +Ref: 286f8680865 +Ref: library/shutil shutil copytree8681165 +Ref: a288681165 +Ref: library/shutil shutil rmtree8684646 +Ref: 2fb8684646 +Ref: library/shutil shutil rmtree avoids_symlink_attacks8687423 +Ref: 28708687423 +Ref: library/shutil shutil move8687765 +Ref: a5b8687765 +Ref: library/shutil shutil disk_usage8689810 +Ref: 11218689810 +Ref: library/shutil shutil chown8690509 +Ref: 2428690509 +Ref: library/shutil shutil which8691132 +Ref: 4b08691132 +Ref: library/shutil shutil Error8693755 +Ref: f978693755 +Node: Platform-dependent efficient copy operations8694091 +Ref: library/shutil platform-dependent-efficient-copy-operations8694227 +Ref: 28728694227 +Ref: library/shutil shutil-platform-dependent-efficient-copy-operations8694227 +Ref: a5d8694227 +Ref: Platform-dependent efficient copy operations-Footnote-18695349 +Ref: Platform-dependent efficient copy operations-Footnote-28695414 +Node: copytree example8695462 +Ref: library/shutil copytree-example8695621 +Ref: 28738695621 +Ref: library/shutil shutil-copytree-example8695621 +Ref: 28748695621 +Node: rmtree example8696281 +Ref: library/shutil rmtree-example8696387 +Ref: 28758696387 +Ref: library/shutil shutil-rmtree-example8696387 +Ref: 28718696387 +Node: Archiving operations8696928 +Ref: library/shutil archiving-operations8697110 +Ref: 120b8697110 +Ref: library/shutil id18697110 +Ref: 28768697110 +Ref: library/shutil shutil make_archive8697417 +Ref: 4af8697417 +Ref: library/shutil shutil get_archive_formats8699854 +Ref: 28798699854 +Ref: library/shutil shutil register_archive_format8700696 +Ref: 28788700696 +Ref: library/shutil shutil unregister_archive_format8701997 +Ref: 287a8701997 +Ref: library/shutil shutil unpack_archive8702132 +Ref: 4678702132 +Ref: library/shutil shutil register_unpack_format8703919 +Ref: 287b8703919 +Ref: library/shutil shutil unregister_unpack_format8704838 +Ref: 287d8704838 +Ref: library/shutil shutil get_unpack_formats8704962 +Ref: 287c8704962 +Ref: Archiving operations-Footnote-18705915 +Node: Archiving example8705957 +Ref: library/shutil archiving-example8706071 +Ref: 287e8706071 +Ref: library/shutil shutil-archiving-example8706071 +Ref: 287f8706071 +Node: Archiving example with base_dir8707162 +Ref: library/shutil archiving-example-with-base-dir8707276 +Ref: 28808707276 +Ref: library/shutil shutil-archiving-example-with-basedir8707276 +Ref: 28778707276 +Node: Querying the size of the output terminal8708378 +Ref: library/shutil querying-the-size-of-the-output-terminal8708521 +Ref: 28818708521 +Ref: library/shutil shutil get_terminal_size8708622 +Ref: 10f78708622 +Ref: Querying the size of the output terminal-Footnote-18710284 +Node: Data Persistence8710367 +Ref: library/persistence doc8710520 +Ref: 28848710520 +Ref: library/persistence data-persistence8710520 +Ref: 28858710520 +Ref: library/persistence persistence8710520 +Ref: 28868710520 +Node: pickle — Python object serialization8711351 +Ref: library/pickle doc8711496 +Ref: 28878711496 +Ref: library/pickle module-pickle8711496 +Ref: a68711496 +Ref: library/pickle pickle-python-object-serialization8711496 +Ref: 28888711496 +Ref: pickle — Python object serialization-Footnote-18713331 +Ref: pickle — Python object serialization-Footnote-28713397 +Node: Relationship to other Python modules8713461 +Ref: library/pickle relationship-to-other-python-modules8713599 +Ref: 288a8713599 +Node: Comparison with marshal8713755 +Ref: library/pickle comparison-with-marshal8713880 +Ref: 288b8713880 +Node: Comparison with json8716108 +Ref: library/pickle comparison-with-json8716233 +Ref: 28898716233 +Ref: library/pickle id28716233 +Ref: 288c8716233 +Ref: Comparison with json-Footnote-18717398 +Node: Data stream format8717423 +Ref: library/pickle data-stream-format8717586 +Ref: 288e8717586 +Ref: library/pickle pickle-protocols8717586 +Ref: cc18717586 +Ref: Data stream format-Footnote-18720548 +Ref: Data stream format-Footnote-28720590 +Ref: Data stream format-Footnote-38720632 +Node: Module Interface8720674 +Ref: library/pickle module-interface8720835 +Ref: 28918720835 +Ref: library/pickle pickle HIGHEST_PROTOCOL8721288 +Ref: 146c8721288 +Ref: library/pickle pickle DEFAULT_PROTOCOL8721561 +Ref: 82a8721561 +Ref: library/pickle pickle dump8722069 +Ref: 28928722069 +Ref: library/pickle pickle dumps8722568 +Ref: 146b8722568 +Ref: library/pickle pickle load8723005 +Ref: d108723005 +Ref: library/pickle pickle loads8723754 +Ref: d118723754 +Ref: library/pickle pickle PickleError8724482 +Ref: 28938724482 +Ref: library/pickle pickle PicklingError8724621 +Ref: 28948724621 +Ref: library/pickle pickle UnpicklingError8724905 +Ref: 28968724905 +Ref: library/pickle pickle Pickler8725419 +Ref: a1d8725419 +Ref: library/pickle pickle Pickler dump8727004 +Ref: 1a448727004 +Ref: library/pickle pickle Pickler persistent_id8727146 +Ref: 15a08727146 +Ref: library/pickle pickle Pickler dispatch_table8727956 +Ref: 11168727956 +Ref: library/pickle pickle Pickler reducer_override8729125 +Ref: a1e8729125 +Ref: library/pickle pickle Pickler fast8729754 +Ref: 289c8729754 +Ref: library/pickle pickle Unpickler8730239 +Ref: 16a78730239 +Ref: library/pickle pickle Unpickler load8732362 +Ref: 289e8732362 +Ref: library/pickle pickle Unpickler persistent_load8732657 +Ref: 15a88732657 +Ref: library/pickle pickle Unpickler find_class8733240 +Ref: 289f8733240 +Ref: library/pickle pickle PickleBuffer8733920 +Ref: 17f78733920 +Ref: library/pickle pickle PickleBuffer raw8734539 +Ref: 28a18734539 +Ref: library/pickle pickle PickleBuffer release8734882 +Ref: 28a28734882 +Node: What can be pickled and unpickled?8734998 +Ref: library/pickle pickle-picklable8735165 +Ref: 28958735165 +Ref: library/pickle what-can-be-pickled-and-unpickled8735165 +Ref: 28a38735165 +Ref: What can be pickled and unpickled?-Footnote-18737913 +Ref: What can be pickled and unpickled?-Footnote-28738046 +Node: Pickling Class Instances8738182 +Ref: library/pickle pickle-inst8738387 +Ref: 288d8738387 +Ref: library/pickle pickling-class-instances8738387 +Ref: 28a48738387 +Ref: library/pickle object __getnewargs_ex__8739322 +Ref: 28a58739322 +Ref: library/pickle object __getnewargs__8740155 +Ref: 146e8740155 +Ref: library/pickle object __getstate__8740723 +Ref: 5d48740723 +Ref: library/pickle object __setstate__8742065 +Ref: 146d8742065 +Ref: library/pickle object __reduce__8743929 +Ref: 9d38743929 +Ref: library/pickle object __reduce_ex__8746797 +Ref: 15ba8746797 +Ref: Pickling Class Instances-Footnote-18747458 +Node: Persistence of External Objects8747553 +Ref: library/pickle persistence-of-external-objects8747669 +Ref: 28a78747669 +Ref: library/pickle pickle-persistent8747669 +Ref: 28988747669 +Ref: Persistence of External Objects-Footnote-18752337 +Node: Dispatch Tables8752601 +Ref: library/pickle dispatch-tables8752751 +Ref: 28a88752751 +Ref: library/pickle pickle-dispatch8752751 +Ref: 289a8752751 +Node: Handling Stateful Objects8754039 +Ref: library/pickle handling-stateful-objects8754149 +Ref: 28a98754149 +Ref: library/pickle pickle-state8754149 +Ref: 28a68754149 +Node: Custom Reduction for Types Functions and Other Objects8756431 +Ref: library/pickle custom-reduction-for-types-functions-and-other-objects8756621 +Ref: 28aa8756621 +Ref: library/pickle reducer-override8756621 +Ref: 289b8756621 +Node: Out-of-band Buffers8758723 +Ref: library/pickle out-of-band-buffers8758908 +Ref: 28ab8758908 +Ref: library/pickle pickle-oob8758908 +Ref: 28978758908 +Node: Provider API8759758 +Ref: library/pickle provider-api8759847 +Ref: 28ac8759847 +Node: Consumer API8760454 +Ref: library/pickle consumer-api8760562 +Ref: 28ad8760562 +Node: Example<4>8761865 +Ref: library/pickle example8761952 +Ref: 28ae8761952 +Ref: Example<4>-Footnote-18764336 +Node: Restricting Globals8764378 +Ref: library/pickle pickle-restrict8764523 +Ref: 28a08764523 +Ref: library/pickle restricting-globals8764523 +Ref: 28af8764523 +Node: Performance<2>8767299 +Ref: library/pickle performance8767436 +Ref: 28b08767436 +Node: Examples<7>8767712 +Ref: library/pickle examples8767821 +Ref: 28b18767821 +Ref: library/pickle pickle-example8767821 +Ref: 28b28767821 +Node: copyreg — Register pickle support functions8769036 +Ref: library/copyreg doc8769226 +Ref: 28b38769226 +Ref: library/copyreg copyreg-register-pickle-support-functions8769226 +Ref: 28b48769226 +Ref: library/copyreg module-copyreg8769226 +Ref: 268769226 +Ref: library/copyreg copyreg constructor8769818 +Ref: 28b58769818 +Ref: library/copyreg copyreg pickle8770021 +Ref: 28998770021 +Ref: copyreg — Register pickle support functions-Footnote-18770761 +Node: Example<5>8770828 +Ref: library/copyreg example8770920 +Ref: 28b68770920 +Node: shelve — Python object persistence8771464 +Ref: library/shelve doc8771664 +Ref: 28b78771664 +Ref: library/shelve module-shelve8771664 +Ref: c38771664 +Ref: library/shelve shelve-python-object-persistence8771664 +Ref: 28b88771664 +Ref: library/shelve shelve open8772249 +Ref: 17008772249 +Ref: library/shelve shelve-security8774291 +Ref: 28bc8774291 +Ref: library/shelve shelve Shelf sync8774790 +Ref: 28ba8774790 +Ref: library/shelve shelve Shelf close8775111 +Ref: 28bb8775111 +Ref: shelve — Python object persistence-Footnote-18775493 +Ref: shelve — Python object persistence-Footnote-28775559 +Node: Restrictions8775664 +Ref: library/shelve restrictions8775768 +Ref: 28bd8775768 +Ref: library/shelve shelve Shelf8776957 +Ref: f958776957 +Ref: library/shelve shelve BsdDbShelf8778354 +Ref: 22588778354 +Ref: library/shelve shelve DbfilenameShelf8779076 +Ref: 22598779076 +Ref: Restrictions-Footnote-18779691 +Node: Example<6>8779744 +Ref: library/shelve example8779848 +Ref: 28be8779848 +Ref: library/shelve shelve-example8779848 +Ref: 28b98779848 +Node: marshal — Internal Python object serialization8781527 +Ref: library/marshal doc8781724 +Ref: 28bf8781724 +Ref: library/marshal marshal-internal-python-object-serialization8781724 +Ref: 28c08781724 +Ref: library/marshal module-marshal8781724 +Ref: 8d8781724 +Ref: library/marshal marshal dump8784361 +Ref: 28c18784361 +Ref: library/marshal marshal load8785200 +Ref: 1a128785200 +Ref: library/marshal marshal dumps8786203 +Ref: e9e8786203 +Ref: library/marshal marshal loads8786894 +Ref: 28c28786894 +Ref: library/marshal marshal version8787661 +Ref: 28c38787661 +Ref: marshal — Internal Python object serialization-Footnote-18788015 +Node: dbm — Interfaces to Unix “databases”8788395 +Ref: library/dbm doc8788609 +Ref: 28c48788609 +Ref: library/dbm dbm-interfaces-to-unix-databases8788609 +Ref: 28c58788609 +Ref: library/dbm module-dbm8788609 +Ref: 318788609 +Ref: library/dbm dbm error8789155 +Ref: 28c68789155 +Ref: library/dbm dbm whichdb8789427 +Ref: 28c78789427 +Ref: library/dbm dbm open8790130 +Ref: f258790130 +Ref: dbm — Interfaces to Unix “databases”-Footnote-18793763 +Ref: dbm — Interfaces to Unix “databases”-Footnote-28793835 +Node: dbm sqlite3 — SQLite backend for dbm8793888 +Ref: library/dbm dbm-sqlite3-sqlite-backend-for-dbm8794046 +Ref: 28c88794046 +Ref: library/dbm module-dbm sqlite38794046 +Ref: 358794046 +Ref: library/dbm dbm sqlite3 open8794708 +Ref: 28c98794708 +Ref: dbm sqlite3 — SQLite backend for dbm-Footnote-18795726 +Node: dbm gnu — GNU database manager8795797 +Ref: library/dbm dbm-gnu-gnu-database-manager8795997 +Ref: 28ca8795997 +Ref: library/dbm module-dbm gnu8795997 +Ref: 338795997 +Ref: library/dbm dbm gnu error8796676 +Ref: a9a8796676 +Ref: library/dbm dbm gnu open8796880 +Ref: 1a3e8796880 +Ref: library/dbm dbm gnu open_flags8798463 +Ref: 28cb8798463 +Ref: library/dbm dbm gnu gdbm firstkey8798777 +Ref: 28cc8798777 +Ref: library/dbm dbm gnu gdbm nextkey8799115 +Ref: 28cd8799115 +Ref: library/dbm dbm gnu gdbm reorganize8799500 +Ref: 28ce8799500 +Ref: library/dbm dbm gnu gdbm sync8799937 +Ref: 28cf8799937 +Ref: library/dbm dbm gnu gdbm close8800102 +Ref: 28d08800102 +Ref: library/dbm dbm gnu gdbm clear8800170 +Ref: 1d78800170 +Ref: dbm gnu — GNU database manager-Footnote-18800324 +Node: dbm ndbm — New Database Manager8800391 +Ref: library/dbm dbm-ndbm-new-database-manager8800593 +Ref: 28d18800593 +Ref: library/dbm module-dbm ndbm8800593 +Ref: 348800593 +Ref: library/dbm dbm ndbm error8801589 +Ref: a9b8801589 +Ref: library/dbm dbm ndbm library8801795 +Ref: 28d28801795 +Ref: library/dbm dbm ndbm open8801875 +Ref: 1a3f8801875 +Ref: library/dbm dbm ndbm ndbm close8803045 +Ref: 28d38803045 +Ref: library/dbm dbm ndbm ndbm clear8803113 +Ref: 1d88803113 +Ref: dbm ndbm — New Database Manager-Footnote-18803267 +Node: dbm dumb — Portable DBM implementation8803335 +Ref: library/dbm dbm-dumb-portable-dbm-implementation8803496 +Ref: 28d48803496 +Ref: library/dbm module-dbm dumb8803496 +Ref: 328803496 +Ref: library/dbm dbm dumb error8804275 +Ref: a998804275 +Ref: library/dbm dbm dumb open8804481 +Ref: a968804481 +Ref: library/dbm dbm dumb dumbdbm sync8806306 +Ref: 28d58806306 +Ref: library/dbm dbm dumb dumbdbm close8806482 +Ref: 28d68806482 +Ref: dbm dumb — Portable DBM implementation-Footnote-18806584 +Node: sqlite3 — DB-API 2 0 interface for SQLite databases8806652 +Ref: library/sqlite3 doc8806809 +Ref: 28d78806809 +Ref: library/sqlite3 module-sqlite38806809 +Ref: cf8806809 +Ref: library/sqlite3 sqlite3-db-api-2-0-interface-for-sqlite-databases8806809 +Ref: 28d88806809 +Ref: library/sqlite3 sqlite3-intro8806970 +Ref: 28d98806970 +Ref: sqlite3 — DB-API 2 0 interface for SQLite databases-Footnote-18808415 +Ref: sqlite3 — DB-API 2 0 interface for SQLite databases-Footnote-28808480 +Ref: sqlite3 — DB-API 2 0 interface for SQLite databases-Footnote-38808522 +Node: Tutorial8808564 +Ref: library/sqlite3 sqlite3-tutorial8808680 +Ref: 28da8808680 +Ref: library/sqlite3 tutorial8808680 +Ref: 28de8808680 +Ref: Tutorial-Footnote-18814643 +Ref: Tutorial-Footnote-28814700 +Ref: Tutorial-Footnote-38814759 +Ref: Tutorial-Footnote-48814808 +Ref: Tutorial-Footnote-58814854 +Node: Reference8814906 +Ref: library/sqlite3 reference8815044 +Ref: 28e88815044 +Ref: library/sqlite3 sqlite3-reference8815044 +Ref: 28db8815044 +Ref: library/sqlite3 sqlite3-module-contents8815083 +Ref: 28e98815083 +Node: Module functions8815414 +Ref: library/sqlite3 module-functions8815501 +Ref: 28ea8815501 +Ref: library/sqlite3 sqlite3-module-functions8815501 +Ref: 28eb8815501 +Ref: library/sqlite3 sqlite3 connect8815554 +Ref: 2aa8815554 +Ref: library/sqlite3 sqlite3 complete_statement8820289 +Ref: 28f48820289 +Ref: library/sqlite3 sqlite3 enable_callback_tracebacks8821106 +Ref: 28f58821106 +Ref: library/sqlite3 sqlite3 register_adapter8821770 +Ref: 28f68821770 +Ref: library/sqlite3 sqlite3 register_converter8822108 +Ref: 28ed8822108 +Ref: Module functions-Footnote-18822757 +Ref: Module functions-Footnote-28822800 +Ref: Module functions-Footnote-38822842 +Node: Module constants8822919 +Ref: library/sqlite3 module-constants8823033 +Ref: 28f88823033 +Ref: library/sqlite3 sqlite3-module-constants8823033 +Ref: 28f98823033 +Ref: library/sqlite3 sqlite3 LEGACY_TRANSACTION_CONTROL8823086 +Ref: 28f28823086 +Ref: library/sqlite3 sqlite3 PARSE_DECLTYPES8823360 +Ref: 28ee8823360 +Ref: library/sqlite3 sqlite3 PARSE_COLNAMES8824341 +Ref: 28ef8824341 +Ref: library/sqlite3 sqlite3 SQLITE_OK8824936 +Ref: 28fa8824936 +Ref: library/sqlite3 sqlite3 SQLITE_DENY8824964 +Ref: 28fb8824964 +Ref: library/sqlite3 sqlite3 SQLITE_IGNORE8824994 +Ref: 28fc8824994 +Ref: library/sqlite3 sqlite3 apilevel8825428 +Ref: 28fd8825428 +Ref: library/sqlite3 sqlite3 paramstyle8825571 +Ref: 28fe8825571 +Ref: library/sqlite3 sqlite3 sqlite_version8825848 +Ref: 28ff8825848 +Ref: library/sqlite3 sqlite3 sqlite_version_info8825962 +Ref: 29008825962 +Ref: library/sqlite3 sqlite3 threadsafety8826104 +Ref: 6788826104 +Ref: library/sqlite3 sqlite3 version8828435 +Ref: 2d28828435 +Ref: library/sqlite3 sqlite3 version_info8828861 +Ref: 2d38828861 +Ref: library/sqlite3 sqlite3-dbconfig-constants8829315 +Ref: 29018829315 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DEFENSIVE8829315 +Ref: 29028829315 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DDL8829359 +Ref: 29038829359 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_DQS_DML8829401 +Ref: 29048829401 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FKEY8829443 +Ref: 29058829443 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER8829489 +Ref: 29068829489 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION8829545 +Ref: 29078829545 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_QPSG8829601 +Ref: 29088829601 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_TRIGGER8829647 +Ref: 29098829647 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_ENABLE_VIEW8829696 +Ref: 290a8829696 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_ALTER_TABLE8829742 +Ref: 290b8829742 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_LEGACY_FILE_FORMAT8829795 +Ref: 290c8829795 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE8829848 +Ref: 290d8829848 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_RESET_DATABASE8829899 +Ref: 290e8829899 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRIGGER_EQP8829948 +Ref: 290f8829948 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_TRUSTED_SCHEMA8829994 +Ref: 29108829994 +Ref: library/sqlite3 sqlite3 SQLITE_DBCONFIG_WRITABLE_SCHEMA8830043 +Ref: 29118830043 +Ref: Module constants-Footnote-18830552 +Ref: Module constants-Footnote-28830595 +Ref: Module constants-Footnote-38830650 +Node: Connection objects8830701 +Ref: library/sqlite3 connection-objects8830813 +Ref: 29128830813 +Ref: library/sqlite3 sqlite3-connection-objects8830813 +Ref: 29138830813 +Ref: library/sqlite3 sqlite3 Connection8830870 +Ref: 2478830870 +Ref: library/sqlite3 sqlite3 Connection cursor8831549 +Ref: 28df8831549 +Ref: library/sqlite3 sqlite3 Connection blobopen8831861 +Ref: 67d8831861 +Ref: library/sqlite3 sqlite3 Connection commit8833135 +Ref: 28e38833135 +Ref: library/sqlite3 sqlite3 Connection rollback8833494 +Ref: 29158833494 +Ref: library/sqlite3 sqlite3 Connection close8833860 +Ref: 2488833860 +Ref: library/sqlite3 sqlite3 Connection execute8834279 +Ref: 29168834279 +Ref: library/sqlite3 sqlite3 Connection executemany8834506 +Ref: 29178834506 +Ref: library/sqlite3 sqlite3 Connection executescript8834739 +Ref: 29188834739 +Ref: library/sqlite3 sqlite3 Connection create_function8834961 +Ref: 2ab8834961 +Ref: library/sqlite3 sqlite3 Connection create_aggregate8836643 +Ref: 2ac8836643 +Ref: library/sqlite3 sqlite3 Connection create_window_function8838581 +Ref: 67c8838581 +Ref: library/sqlite3 sqlite3 Connection create_collation8841785 +Ref: 6728841785 +Ref: library/sqlite3 sqlite3 Connection interrupt8843217 +Ref: 291c8843217 +Ref: library/sqlite3 sqlite3 Connection set_authorizer8843445 +Ref: 2ad8843445 +Ref: library/sqlite3 sqlite3 Connection set_progress_handler8845085 +Ref: 2ae8845085 +Ref: library/sqlite3 sqlite3 Connection set_trace_callback8845935 +Ref: 2af8845935 +Ref: library/sqlite3 sqlite3 Connection enable_load_extension8847236 +Ref: 83a8847236 +Ref: library/sqlite3 sqlite3 Connection load_extension8849576 +Ref: 4b48849576 +Ref: library/sqlite3 sqlite3 Connection iterdump8850553 +Ref: 2498850553 +Ref: library/sqlite3 sqlite3 Connection backup8851573 +Ref: b7a8851573 +Ref: library/sqlite3 sqlite3 Connection getlimit8853945 +Ref: 6778853945 +Ref: library/sqlite3 sqlite3 Connection setlimit8854581 +Ref: 6768854581 +Ref: library/sqlite3 sqlite3 Connection getconfig8855679 +Ref: 4b58855679 +Ref: library/sqlite3 sqlite3 Connection setconfig8855952 +Ref: 4b68855952 +Ref: library/sqlite3 sqlite3 Connection serialize8856403 +Ref: 67a8856403 +Ref: library/sqlite3 sqlite3 Connection deserialize8857157 +Ref: 67b8857157 +Ref: library/sqlite3 sqlite3 Connection autocommit8858324 +Ref: 4b28858324 +Ref: library/sqlite3 sqlite3 Connection in_transaction8859753 +Ref: 291f8859753 +Ref: library/sqlite3 sqlite3 Connection isolation_level8860039 +Ref: 28f08860039 +Ref: library/sqlite3 sqlite3 Connection row_factory8860978 +Ref: 162e8860978 +Ref: library/sqlite3 sqlite3 Connection text_factory8861474 +Ref: 29218861474 +Ref: library/sqlite3 sqlite3 Connection total_changes8861880 +Ref: 29228861880 +Ref: Connection objects-Footnote-18862111 +Ref: Connection objects-Footnote-28862157 +Ref: Connection objects-Footnote-38862222 +Ref: Connection objects-Footnote-48862281 +Ref: Connection objects-Footnote-58862340 +Ref: Connection objects-Footnote-68862382 +Ref: Connection objects-Footnote-78862424 +Ref: Connection objects-Footnote-88862516 +Ref: Connection objects-Footnote-98862558 +Ref: Connection objects-Footnote-108862650 +Node: Cursor objects8862751 +Ref: library/sqlite3 cursor-objects8862858 +Ref: 29238862858 +Ref: library/sqlite3 sqlite3-cursor-objects8862858 +Ref: 29248862858 +Ref: library/sqlite3 sqlite3 Cursor8863468 +Ref: 28e08863468 +Ref: library/sqlite3 sqlite3 Cursor execute8863579 +Ref: 2d48863579 +Ref: library/sqlite3 sqlite3 Cursor executemany8865077 +Ref: 2d58865077 +Ref: library/sqlite3 sqlite3 Cursor executescript8866580 +Ref: 29198866580 +Ref: library/sqlite3 sqlite3 Cursor fetchone8867426 +Ref: 28e18867426 +Ref: library/sqlite3 sqlite3 Cursor fetchmany8867706 +Ref: 29258867706 +Ref: library/sqlite3 sqlite3 Cursor fetchall8868545 +Ref: 28e48868545 +Ref: library/sqlite3 sqlite3 Cursor close8868826 +Ref: 29278868826 +Ref: library/sqlite3 sqlite3 Cursor setinputsizes8869130 +Ref: 29288869130 +Ref: library/sqlite3 sqlite3 Cursor setoutputsize8869239 +Ref: 29298869239 +Ref: library/sqlite3 sqlite3 Cursor arraysize8869360 +Ref: 29268869360 +Ref: library/sqlite3 sqlite3 Cursor connection8869589 +Ref: 292a8869589 +Ref: library/sqlite3 sqlite3 Cursor description8870091 +Ref: 15638870091 +Ref: library/sqlite3 sqlite3 Cursor lastrowid8870467 +Ref: cd18870467 +Ref: library/sqlite3 sqlite3 Cursor rowcount8871160 +Ref: 17d68871160 +Ref: library/sqlite3 sqlite3 Cursor row_factory8871718 +Ref: 29208871718 +Ref: library/sqlite3 sqlite3-columns-by-name8872503 +Ref: 292b8872503 +Ref: Cursor objects-Footnote-18872539 +Ref: Cursor objects-Footnote-28872596 +Node: Row objects8872647 +Ref: library/sqlite3 row-objects8872748 +Ref: 292c8872748 +Ref: library/sqlite3 sqlite3-row-objects8872748 +Ref: 292d8872748 +Ref: library/sqlite3 sqlite3 Row8872791 +Ref: e6c8872791 +Ref: library/sqlite3 sqlite3 Row keys8873242 +Ref: 292e8873242 +Node: Blob objects8873520 +Ref: library/sqlite3 blob-objects8873630 +Ref: 292f8873630 +Ref: library/sqlite3 sqlite3-blob-objects8873630 +Ref: 29308873630 +Ref: library/sqlite3 sqlite3 Blob8873675 +Ref: 67e8873675 +Ref: library/sqlite3 sqlite3 Blob close8874845 +Ref: 29318874845 +Ref: library/sqlite3 sqlite3 Blob read8875095 +Ref: 29328875095 +Ref: library/sqlite3 sqlite3 Blob write8875451 +Ref: 29338875451 +Ref: library/sqlite3 sqlite3 Blob tell8875680 +Ref: 29348875680 +Ref: library/sqlite3 sqlite3 Blob seek8875765 +Ref: 29358875765 +Node: PrepareProtocol objects8876189 +Ref: library/sqlite3 prepareprotocol-objects8876301 +Ref: 29368876301 +Ref: library/sqlite3 sqlite3 PrepareProtocol8876368 +Ref: 17e18876368 +Ref: PrepareProtocol objects-Footnote-18876637 +Node: Exceptions<7>8876679 +Ref: library/sqlite3 exceptions8876802 +Ref: 29388876802 +Ref: library/sqlite3 sqlite3-exceptions8876802 +Ref: 29398876802 +Ref: library/sqlite3 sqlite3 Warning8876914 +Ref: 18258876914 +Ref: library/sqlite3 sqlite3 Error8877215 +Ref: 18808877215 +Ref: library/sqlite3 sqlite3 Error sqlite_errorcode8877571 +Ref: 6748877571 +Ref: library/sqlite3 sqlite3 Error sqlite_errorname8877700 +Ref: 6758877700 +Ref: library/sqlite3 sqlite3 InterfaceError8877860 +Ref: 6798877860 +Ref: library/sqlite3 sqlite3 DatabaseError8878139 +Ref: 291d8878139 +Ref: library/sqlite3 sqlite3 DataError8878454 +Ref: 189c8878454 +Ref: library/sqlite3 sqlite3 OperationalError8878703 +Ref: 189d8878703 +Ref: library/sqlite3 sqlite3 IntegrityError8879057 +Ref: 293a8879057 +Ref: library/sqlite3 sqlite3 InternalError8879269 +Ref: 293b8879269 +Ref: library/sqlite3 sqlite3 ProgrammingError8879545 +Ref: 4ee8879545 +Ref: library/sqlite3 sqlite3 NotSupportedError8879853 +Ref: 291b8879853 +Ref: Exceptions<7>-Footnote-18880286 +Ref: Exceptions<7>-Footnote-28880328 +Ref: Exceptions<7>-Footnote-38880368 +Node: SQLite and Python types8880408 +Ref: library/sqlite3 sqlite-and-python-types8880550 +Ref: 293c8880550 +Ref: library/sqlite3 sqlite3-types8880550 +Ref: 28ec8880550 +Node: Default adapters and converters deprecated8882462 +Ref: library/sqlite3 default-adapters-and-converters-deprecated8882613 +Ref: 293d8882613 +Ref: library/sqlite3 sqlite3-default-converters8882613 +Ref: 4eb8882613 +Ref: Default adapters and converters deprecated-Footnote-18883840 +Node: Command-line interface8883887 +Ref: library/sqlite3 command-line-interface8884006 +Ref: 293e8884006 +Ref: library/sqlite3 sqlite3-cli8884006 +Ref: 43c8884006 +Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-h8884356 +Ref: 293f8884356 +Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-help8884356 +Ref: 29408884356 +Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-v8884402 +Ref: 29418884402 +Ref: library/sqlite3 cmdoption-python-m-sqlite3-h-v-filename-sql-version8884402 +Ref: 29428884402 +Node: How-to guides8884500 +Ref: library/sqlite3 how-to-guides8884641 +Ref: 29438884641 +Ref: library/sqlite3 sqlite3-howtos8884641 +Ref: 28dc8884641 +Node: How to use placeholders to bind values in SQL queries8885107 +Ref: library/sqlite3 how-to-use-placeholders-to-bind-values-in-sql-queries8885268 +Ref: 29448885268 +Ref: library/sqlite3 sqlite3-placeholders8885268 +Ref: 2d68885268 +Ref: How to use placeholders to bind values in SQL queries-Footnote-18887521 +Ref: How to use placeholders to bind values in SQL queries-Footnote-28887573 +Node: How to adapt custom Python types to SQLite values8887615 +Ref: library/sqlite3 how-to-adapt-custom-python-types-to-sqlite-values8887836 +Ref: 29458887836 +Ref: library/sqlite3 sqlite3-adapters8887836 +Ref: 28e58887836 +Node: How to write adaptable objects8888625 +Ref: library/sqlite3 how-to-write-adaptable-objects8888783 +Ref: 29468888783 +Ref: library/sqlite3 sqlite3-conform8888783 +Ref: 29378888783 +Node: How to register adapter callables8889694 +Ref: library/sqlite3 how-to-register-adapter-callables8889852 +Ref: 29478889852 +Node: How to convert SQLite values to custom Python types8890496 +Ref: library/sqlite3 how-to-convert-sqlite-values-to-custom-python-types8890693 +Ref: 29488890693 +Ref: library/sqlite3 sqlite3-converters8890693 +Ref: 28e68890693 +Node: Adapter and converter recipes8893264 +Ref: library/sqlite3 adapter-and-converter-recipes8893450 +Ref: 29498893450 +Ref: library/sqlite3 sqlite3-adapter-converter-recipes8893450 +Ref: 4ec8893450 +Node: How to use connection shortcut methods8894907 +Ref: library/sqlite3 how-to-use-connection-shortcut-methods8895083 +Ref: 294a8895083 +Ref: library/sqlite3 sqlite3-connection-shortcuts8895083 +Ref: 29148895083 +Node: How to use the connection context manager8896367 +Ref: library/sqlite3 how-to-use-the-connection-context-manager8896542 +Ref: 294b8896542 +Ref: library/sqlite3 sqlite3-connection-context-manager8896542 +Ref: 17e28896542 +Node: How to work with SQLite URIs8898293 +Ref: library/sqlite3 how-to-work-with-sqlite-uris8898465 +Ref: 294d8898465 +Ref: library/sqlite3 sqlite3-uri-tricks8898465 +Ref: 28f38898465 +Ref: How to work with SQLite URIs-Footnote-18899768 +Node: How to create and use row factories8899808 +Ref: library/sqlite3 how-to-create-and-use-row-factories8899977 +Ref: 294e8899977 +Ref: library/sqlite3 sqlite3-howto-row-factory8899977 +Ref: 28e78899977 +Node: How to handle non-UTF-8 text encodings8902837 +Ref: library/sqlite3 how-to-handle-non-utf-8-text-encodings8902969 +Ref: 294f8902969 +Ref: library/sqlite3 sqlite3-howto-encoding8902969 +Ref: 291e8902969 +Ref: How to handle non-UTF-8 text encodings-Footnote-18904309 +Node: Explanation8904358 +Ref: library/sqlite3 explanation8904481 +Ref: 29508904481 +Ref: library/sqlite3 sqlite3-explanation8904481 +Ref: 28dd8904481 +Ref: library/sqlite3 sqlite3-transaction-control8904526 +Ref: 29518904526 +Node: Transaction control8904560 +Ref: library/sqlite3 sqlite3-controlling-transactions8904627 +Ref: 28e28904627 +Ref: library/sqlite3 transaction-control8904627 +Ref: 29528904627 +Node: Transaction control via the autocommit attribute8905120 +Ref: library/sqlite3 sqlite3-transaction-control-autocommit8905286 +Ref: 4b38905286 +Ref: library/sqlite3 transaction-control-via-the-autocommit-attribute8905286 +Ref: 29538905286 +Ref: Transaction control via the autocommit attribute-Footnote-18907045 +Ref: Transaction control via the autocommit attribute-Footnote-28907087 +Ref: Transaction control via the autocommit attribute-Footnote-38907179 +Node: Transaction control via the isolation_level attribute8907221 +Ref: library/sqlite3 sqlite3-transaction-control-isolation-level8907387 +Ref: 28f18907387 +Ref: library/sqlite3 transaction-control-via-the-isolation-level-attribute8907387 +Ref: 29548907387 +Ref: Transaction control via the isolation_level attribute-Footnote-18909468 +Ref: Transaction control via the isolation_level attribute-Footnote-28909568 +Node: Data Compression and Archiving8909660 +Ref: library/archiving doc8909800 +Ref: 288f8909800 +Ref: library/archiving archiving8909800 +Ref: 29558909800 +Ref: library/archiving data-compression-and-archiving8909800 +Ref: 29568909800 +Node: zlib — Compression compatible with gzip8910393 +Ref: library/zlib doc8910541 +Ref: 29578910541 +Ref: library/zlib module-zlib8910541 +Ref: 1338910541 +Ref: library/zlib zlib-compression-compatible-with-gzip8910541 +Ref: 29588910541 +Ref: library/zlib zlib error8911510 +Ref: 29598911510 +Ref: library/zlib zlib adler328911601 +Ref: 18298911601 +Ref: library/zlib zlib compress8912385 +Ref: 63b8912385 +Ref: library/zlib compress-wbits8913027 +Ref: 295a8913027 +Ref: library/zlib zlib compressobj8914256 +Ref: 295b8914256 +Ref: library/zlib zlib crc328916255 +Ref: 16958916255 +Ref: library/zlib zlib decompress8916956 +Ref: d0d8916956 +Ref: library/zlib decompress-wbits8917389 +Ref: 295c8917389 +Ref: library/zlib zlib decompressobj8919124 +Ref: 295d8919124 +Ref: library/zlib zlib Compress compress8920123 +Ref: 295e8920123 +Ref: library/zlib zlib Compress flush8920481 +Ref: 295f8920481 +Ref: library/zlib zlib Compress copy8921236 +Ref: 29608921236 +Ref: library/zlib zlib Decompress unused_data8921604 +Ref: 29618921604 +Ref: library/zlib zlib Decompress unconsumed_tail8921950 +Ref: 29628921950 +Ref: library/zlib zlib Decompress eof8922404 +Ref: 11618922404 +Ref: library/zlib zlib Decompress decompress8922689 +Ref: 29638922689 +Ref: library/zlib zlib Decompress flush8923716 +Ref: 29648923716 +Ref: library/zlib zlib Decompress copy8924121 +Ref: 29658924121 +Ref: library/zlib zlib ZLIB_VERSION8924599 +Ref: 29668924599 +Ref: library/zlib zlib ZLIB_RUNTIME_VERSION8924854 +Ref: 11628924854 +Ref: zlib — Compression compatible with gzip-Footnote-18925460 +Ref: zlib — Compression compatible with gzip-Footnote-28925505 +Node: gzip — Support for gzip files8925558 +Ref: library/gzip doc8925752 +Ref: 29678925752 +Ref: library/gzip gzip-support-for-gzip-files8925752 +Ref: 29688925752 +Ref: library/gzip module-gzip8925752 +Ref: 678925752 +Ref: library/gzip gzip open8926749 +Ref: 29698926749 +Ref: library/gzip gzip BadGzipFile8928281 +Ref: 9f68928281 +Ref: library/gzip gzip GzipFile8928534 +Ref: 4168928534 +Ref: library/gzip gzip GzipFile peek8931593 +Ref: 11fe8931593 +Ref: library/gzip gzip GzipFile mode8932131 +Ref: 296c8932131 +Ref: library/gzip gzip GzipFile mtime8932324 +Ref: 296a8932324 +Ref: library/gzip gzip GzipFile name8932664 +Ref: 5088932664 +Ref: library/gzip gzip compress8933900 +Ref: 63a8933900 +Ref: library/gzip gzip decompress8934845 +Ref: 11ff8934845 +Ref: gzip — Support for gzip files-Footnote-18935504 +Node: Examples of usage8935568 +Ref: library/gzip examples-of-usage8935684 +Ref: 296e8935684 +Ref: library/gzip gzip-usage-examples8935684 +Ref: 296f8935684 +Ref: Examples of usage-Footnote-18936768 +Node: Command Line Interface8936821 +Ref: library/gzip command-line-interface8936937 +Ref: 29708936937 +Ref: library/gzip gzip-cli8936937 +Ref: 29718936937 +Node: Command line options8937357 +Ref: library/gzip command-line-options8937436 +Ref: 29728937436 +Ref: library/gzip cmdoption-gzip-arg-file8937497 +Ref: 29738937497 +Ref: library/gzip cmdoption-gzip-fast8937581 +Ref: 29748937581 +Ref: library/gzip cmdoption-gzip-best8937668 +Ref: 29758937668 +Ref: library/gzip cmdoption-gzip-d8937755 +Ref: 29768937755 +Ref: library/gzip cmdoption-gzip-decompress8937755 +Ref: 29778937755 +Ref: library/gzip cmdoption-gzip-h8937818 +Ref: 29788937818 +Ref: library/gzip cmdoption-gzip-help8937818 +Ref: 29798937818 +Node: bz2 — Support for bzip2 compression8937871 +Ref: library/bz2 doc8938069 +Ref: 297a8938069 +Ref: library/bz2 bz2-support-for-bzip2-compression8938069 +Ref: 297b8938069 +Ref: library/bz2 module-bz28938069 +Ref: 138938069 +Ref: bz2 — Support for bzip2 compression-Footnote-18939030 +Node: De compression of files8939093 +Ref: library/bz2 de-compression-of-files8939225 +Ref: 297c8939225 +Ref: library/bz2 bz2 open8939294 +Ref: 10878939294 +Ref: library/bz2 bz2 BZ2File8940735 +Ref: 8638940735 +Ref: library/bz2 bz2 BZ2File peek8942208 +Ref: 297e8942208 +Ref: library/bz2 bz2 BZ2File fileno8942796 +Ref: 297f8942796 +Ref: library/bz2 bz2 BZ2File readable8942920 +Ref: 29808942920 +Ref: library/bz2 bz2 BZ2File seekable8943042 +Ref: 29818943042 +Ref: library/bz2 bz2 BZ2File writable8943158 +Ref: 29828943158 +Ref: library/bz2 bz2 BZ2File read18943280 +Ref: 29838943280 +Ref: library/bz2 bz2 BZ2File readinto8943601 +Ref: 29848943601 +Ref: library/bz2 bz2 BZ2File mode8943754 +Ref: 29858943754 +Ref: library/bz2 bz2 BZ2File name8943876 +Ref: 29868943876 +Node: Incremental de compression8945116 +Ref: library/bz2 incremental-de-compression8945280 +Ref: 29888945280 +Ref: library/bz2 bz2 BZ2Compressor8945355 +Ref: 175d8945355 +Ref: library/bz2 bz2 BZ2Compressor compress8945695 +Ref: 29898945695 +Ref: library/bz2 bz2 BZ2Compressor flush8946043 +Ref: 298a8946043 +Ref: library/bz2 bz2 BZ2Decompressor8946272 +Ref: 175b8946272 +Ref: library/bz2 bz2 BZ2Decompressor decompress8946825 +Ref: dcb8946825 +Ref: library/bz2 bz2 BZ2Decompressor eof8948192 +Ref: 298d8948192 +Ref: library/bz2 bz2 BZ2Decompressor unused_data8948318 +Ref: 298c8948318 +Ref: library/bz2 bz2 BZ2Decompressor needs_input8948540 +Ref: 298b8948540 +Node: One-shot de compression8948764 +Ref: library/bz2 one-shot-de-compression8948925 +Ref: 298e8948925 +Ref: library/bz2 bz2 compress8948994 +Ref: 24138948994 +Ref: library/bz2 bz2 decompress8949293 +Ref: 10888949293 +Node: Examples of usage<2>8949651 +Ref: library/bz2 bz2-usage-examples8949777 +Ref: 298f8949777 +Ref: library/bz2 examples-of-usage8949777 +Ref: 29908949777 +Node: lzma — Compression using the LZMA algorithm8952712 +Ref: library/lzma doc8952913 +Ref: 29918952913 +Ref: library/lzma lzma-compression-using-the-lzma-algorithm8952913 +Ref: 29928952913 +Ref: library/lzma module-lzma8952913 +Ref: 8a8952913 +Ref: library/lzma lzma LZMAError8953747 +Ref: 29938953747 +Ref: lzma — Compression using the LZMA algorithm-Footnote-18954166 +Node: Reading and writing compressed files8954230 +Ref: library/lzma reading-and-writing-compressed-files8954401 +Ref: 29948954401 +Ref: library/lzma lzma open8954494 +Ref: 29958954494 +Ref: library/lzma lzma LZMAFile8956264 +Ref: 10058956264 +Ref: library/lzma lzma LZMAFile peek8958185 +Ref: 29968958185 +Ref: library/lzma lzma LZMAFile mode8958805 +Ref: 29978958805 +Ref: library/lzma lzma LZMAFile name8958927 +Ref: 29988958927 +Node: Compressing and decompressing data in memory8959381 +Ref: library/lzma compressing-and-decompressing-data-in-memory8959577 +Ref: 29998959577 +Ref: library/lzma lzma LZMACompressor8959686 +Ref: 175c8959686 +Ref: library/lzma lzma LZMACompressor compress8962764 +Ref: 299c8962764 +Ref: library/lzma lzma LZMACompressor flush8963237 +Ref: 299d8963237 +Ref: library/lzma lzma LZMADecompressor8963517 +Ref: 175a8963517 +Ref: library/lzma lzma LZMADecompressor decompress8965046 +Ref: e2d8965046 +Ref: library/lzma lzma LZMADecompressor check8966413 +Ref: 29a18966413 +Ref: library/lzma lzma LZMADecompressor eof8966646 +Ref: 29a28966646 +Ref: library/lzma lzma LZMADecompressor unused_data8966739 +Ref: 29a08966739 +Ref: library/lzma lzma LZMADecompressor needs_input8966910 +Ref: 299f8966910 +Ref: library/lzma lzma compress8967134 +Ref: 299a8967134 +Ref: library/lzma lzma decompress8967480 +Ref: 299e8967480 +Node: Miscellaneous<2>8967987 +Ref: library/lzma miscellaneous8968178 +Ref: 29a38968178 +Ref: library/lzma lzma is_check_supported8968225 +Ref: 29a48968225 +Node: Specifying custom filter chains8968587 +Ref: library/lzma filter-chain-specs8968745 +Ref: 299b8968745 +Ref: library/lzma specifying-custom-filter-chains8968745 +Ref: 29a58968745 +Node: Examples<8>8971430 +Ref: library/lzma examples8971563 +Ref: 29a68971563 +Node: zipfile — Work with ZIP archives8972931 +Ref: library/zipfile doc8973139 +Ref: 29a78973139 +Ref: library/zipfile module-zipfile8973139 +Ref: 1318973139 +Ref: library/zipfile zipfile-work-with-zip-archives8973139 +Ref: 29a88973139 +Ref: library/zipfile zipfile BadZipFile8974000 +Ref: 17de8974000 +Ref: library/zipfile zipfile BadZipfile8974105 +Ref: 29a98974105 +Ref: library/zipfile zipfile LargeZipFile8974266 +Ref: 29aa8974266 +Ref: library/zipfile zipfile ZipInfo8974892 +Ref: d0a8974892 +Ref: library/zipfile zipfile is_zipfile8975833 +Ref: 131d8975833 +Ref: library/zipfile zipfile ZIP_STORED8976126 +Ref: 29af8976126 +Ref: library/zipfile zipfile ZIP_DEFLATED8976219 +Ref: 29b08976219 +Ref: library/zipfile zipfile ZIP_BZIP28976365 +Ref: 29b18976365 +Ref: library/zipfile zipfile ZIP_LZMA8976530 +Ref: 29b28976530 +Ref: zipfile — Work with ZIP archives-Footnote-18977538 +Ref: zipfile — Work with ZIP archives-Footnote-28977603 +Ref: zipfile — Work with ZIP archives-Footnote-38977671 +Ref: zipfile — Work with ZIP archives-Footnote-48977739 +Node: ZipFile Objects8977780 +Ref: library/zipfile id18977887 +Ref: 29b38977887 +Ref: library/zipfile zipfile-objects8977887 +Ref: 29ab8977887 +Ref: library/zipfile zipfile ZipFile8977938 +Ref: 6c08977938 +Ref: library/zipfile zipfile ZipFile close8982949 +Ref: 29b48982949 +Ref: library/zipfile zipfile ZipFile getinfo8983120 +Ref: 29ac8983120 +Ref: library/zipfile zipfile ZipFile infolist8983379 +Ref: 29ad8983379 +Ref: library/zipfile zipfile ZipFile namelist8983637 +Ref: 29b58983637 +Ref: library/zipfile zipfile ZipFile open8983718 +Ref: 4178983718 +Ref: library/zipfile zipfile ZipFile extract8986605 +Ref: 29b98986605 +Ref: library/zipfile zipfile ZipFile extractall8987994 +Ref: 29ba8987994 +Ref: library/zipfile zipfile ZipFile printdir8989042 +Ref: 29bb8989042 +Ref: library/zipfile zipfile ZipFile setpassword8989144 +Ref: 29bc8989144 +Ref: library/zipfile zipfile ZipFile read8989281 +Ref: 29b88989281 +Ref: library/zipfile zipfile ZipFile testzip8990208 +Ref: 29bd8990208 +Ref: library/zipfile zipfile ZipFile write8990578 +Ref: d4c8990578 +Ref: library/zipfile zipfile ZipFile writestr8992383 +Ref: 131e8992383 +Ref: library/zipfile zipfile ZipFile mkdir8993973 +Ref: 6c18993973 +Ref: library/zipfile zipfile ZipFile filename8994496 +Ref: 29be8994496 +Ref: library/zipfile zipfile ZipFile debug8994557 +Ref: 29bf8994557 +Ref: library/zipfile zipfile ZipFile comment8994777 +Ref: 29c08994777 +Node: Path Objects8995100 +Ref: library/zipfile id28995233 +Ref: 29c18995233 +Ref: library/zipfile path-objects8995233 +Ref: 29c28995233 +Ref: library/zipfile zipfile Path8995278 +Ref: 6c58995278 +Ref: library/zipfile zipfile Path name8996458 +Ref: 29c38996458 +Ref: library/zipfile zipfile Path open8996516 +Ref: 15998996516 +Ref: library/zipfile zipfile Path iterdir8997413 +Ref: 29c48997413 +Ref: library/zipfile zipfile Path is_dir8997497 +Ref: 29c58997497 +Ref: library/zipfile zipfile Path is_file8997596 +Ref: 29c68997596 +Ref: library/zipfile zipfile Path is_symlink8997691 +Ref: 29c78997691 +Ref: library/zipfile zipfile Path exists8997934 +Ref: 29c88997934 +Ref: library/zipfile zipfile Path suffix8998062 +Ref: 6c38998062 +Ref: library/zipfile zipfile Path stem8998272 +Ref: 6c28998272 +Ref: library/zipfile zipfile Path suffixes8998412 +Ref: 6c48998412 +Ref: library/zipfile zipfile Path read_text8998580 +Ref: 176d8998580 +Ref: library/zipfile zipfile Path read_bytes8999156 +Ref: 29c98999156 +Ref: library/zipfile zipfile Path joinpath8999226 +Ref: 29ca8999226 +Ref: Path Objects-Footnote-18999876 +Node: PyZipFile Objects8999915 +Ref: library/zipfile id39000048 +Ref: 29cb9000048 +Ref: library/zipfile pyzipfile-objects9000048 +Ref: 29cc9000048 +Ref: library/zipfile zipfile PyZipFile9000250 +Ref: ff39000250 +Ref: library/zipfile zipfile PyZipFile writepy9000584 +Ref: ff29000584 +Node: ZipInfo Objects9003440 +Ref: library/zipfile id49003583 +Ref: 29cd9003583 +Ref: library/zipfile zipinfo-objects9003583 +Ref: 29ae9003583 +Ref: library/zipfile zipfile ZipInfo from_file9003951 +Ref: d099003951 +Ref: library/zipfile zipfile ZipInfo is_dir9005037 +Ref: d0b9005037 +Ref: library/zipfile zipfile ZipInfo filename9005239 +Ref: 29ce9005239 +Ref: library/zipfile zipfile ZipInfo date_time9005311 +Ref: 29cf9005311 +Ref: library/zipfile zipfile ZipInfo compress_type9006093 +Ref: 29d09006093 +Ref: library/zipfile zipfile ZipInfo comment9006181 +Ref: 29d19006181 +Ref: library/zipfile zipfile ZipInfo extra9006297 +Ref: 29d29006297 +Ref: library/zipfile zipfile ZipInfo create_system9006501 +Ref: 29d39006501 +Ref: library/zipfile zipfile ZipInfo create_version9006579 +Ref: 29d49006579 +Ref: library/zipfile zipfile ZipInfo extract_version9006665 +Ref: 29d59006665 +Ref: library/zipfile zipfile ZipInfo reserved9006752 +Ref: 29d69006752 +Ref: library/zipfile zipfile ZipInfo flag_bits9006805 +Ref: 29d79006805 +Ref: library/zipfile zipfile ZipInfo volume9006860 +Ref: 29d89006860 +Ref: library/zipfile zipfile ZipInfo internal_attr9006927 +Ref: 29d99006927 +Ref: library/zipfile zipfile ZipInfo external_attr9006992 +Ref: 29da9006992 +Ref: library/zipfile zipfile ZipInfo header_offset9007062 +Ref: 29db9007062 +Ref: library/zipfile zipfile ZipInfo CRC9007138 +Ref: 29dc9007138 +Ref: library/zipfile zipfile ZipInfo compress_size9007205 +Ref: 29dd9007205 +Ref: library/zipfile zipfile ZipInfo file_size9007278 +Ref: 29b79007278 +Ref: ZipInfo Objects-Footnote-19007385 +Node: Command-Line Interface9007453 +Ref: library/zipfile command-line-interface9007601 +Ref: 29de9007601 +Ref: library/zipfile zipfile-commandline9007601 +Ref: 29df9007601 +Node: Command-line options9008374 +Ref: library/zipfile command-line-options9008453 +Ref: 29e39008453 +Ref: library/zipfile cmdoption-zipfile-l9008514 +Ref: 29e29008514 +Ref: library/zipfile cmdoption-zipfile-list9008539 +Ref: 29e49008539 +Ref: library/zipfile cmdoption-zipfile-c9008600 +Ref: 29e09008600 +Ref: library/zipfile cmdoption-zipfile-create9008649 +Ref: 29e59008649 +Ref: library/zipfile cmdoption-zipfile-e9008745 +Ref: 29e19008745 +Ref: library/zipfile cmdoption-zipfile-extract9008783 +Ref: 29e69008783 +Ref: library/zipfile cmdoption-zipfile-t9008874 +Ref: 29e79008874 +Ref: library/zipfile cmdoption-zipfile-test9008899 +Ref: 29e89008899 +Ref: library/zipfile cmdoption-zipfile-metadata-encoding9008977 +Ref: 29e99008977 +Node: Decompression pitfalls9009150 +Ref: library/zipfile decompression-pitfalls9009274 +Ref: 29ea9009274 +Node: From file itself9009557 +Ref: library/zipfile from-file-itself9009664 +Ref: 29eb9009664 +Node: File System limitations9009843 +Ref: library/zipfile file-system-limitations9009980 +Ref: 29ec9009980 +Node: Resources limitations9010282 +Ref: library/zipfile resources-limitations9010415 +Ref: 29ed9010415 +Ref: library/zipfile zipfile-resources-limitations9010415 +Ref: 29ee9010415 +Ref: Resources limitations-Footnote-19010702 +Node: Interruption9010749 +Ref: library/zipfile interruption9010890 +Ref: 29ef9010890 +Node: Default behaviors of extraction9011096 +Ref: library/zipfile default-behaviors-of-extraction9011207 +Ref: 29f09011207 +Node: tarfile — Read and write tar archive files9011472 +Ref: library/tarfile doc9011626 +Ref: 29f19011626 +Ref: library/tarfile module-tarfile9011626 +Ref: de9011626 +Ref: library/tarfile tarfile-read-and-write-tar-archive-files9011626 +Ref: 29f29011626 +Ref: library/tarfile tarfile open9013219 +Ref: e729013219 +Ref: library/tarfile tarfile is_tarfile9019840 +Ref: 18449019840 +Ref: library/tarfile tarfile TarError9020194 +Ref: 29f79020194 +Ref: library/tarfile tarfile ReadError9020283 +Ref: 189a9020283 +Ref: library/tarfile tarfile CompressionError9020454 +Ref: 29f49020454 +Ref: library/tarfile tarfile StreamError9020604 +Ref: 29f89020604 +Ref: library/tarfile tarfile ExtractError9020744 +Ref: 29f99020744 +Ref: library/tarfile tarfile HeaderError9020925 +Ref: 29fa9020925 +Ref: library/tarfile tarfile FilterError9021050 +Ref: 29fc9021050 +Ref: library/tarfile tarfile FilterError tarinfo9021148 +Ref: 29fe9021148 +Ref: library/tarfile tarfile AbsolutePathError9021287 +Ref: 2a009021287 +Ref: library/tarfile tarfile OutsideDestinationError9021395 +Ref: 2a019021395 +Ref: library/tarfile tarfile SpecialFileError9021526 +Ref: 2a029021526 +Ref: library/tarfile tarfile AbsoluteLinkError9021647 +Ref: 2a039021647 +Ref: library/tarfile tarfile LinkOutsideDestinationError9021762 +Ref: 2a049021762 +Ref: library/tarfile tarfile LinkFallbackError9021913 +Ref: 42c9021913 +Ref: library/tarfile tarfile ENCODING9022330 +Ref: 2a059022330 +Ref: library/tarfile tarfile REGTYPE9022500 +Ref: 2a069022500 +Ref: library/tarfile tarfile AREGTYPE9022526 +Ref: 2a079022526 +Ref: library/tarfile tarfile LNKTYPE9022593 +Ref: 2a099022593 +Ref: library/tarfile tarfile SYMTYPE9022668 +Ref: 2a0a9022668 +Ref: library/tarfile tarfile CHRTYPE9022735 +Ref: 2a0b9022735 +Ref: library/tarfile tarfile BLKTYPE9022813 +Ref: 2a0c9022813 +Ref: library/tarfile tarfile DIRTYPE9022887 +Ref: 2a0d9022887 +Ref: library/tarfile tarfile FIFOTYPE9022950 +Ref: 2a0e9022950 +Ref: library/tarfile tarfile CONTTYPE9023024 +Ref: 2a0f9023024 +Ref: library/tarfile tarfile GNUTYPE_LONGNAME9023094 +Ref: 2a109023094 +Ref: library/tarfile tarfile GNUTYPE_LONGLINK9023173 +Ref: 2a119023173 +Ref: library/tarfile tarfile GNUTYPE_SPARSE9023252 +Ref: 2a129023252 +Ref: library/tarfile tarfile USTAR_FORMAT9023509 +Ref: 2a149023509 +Ref: library/tarfile tarfile GNU_FORMAT9023576 +Ref: 2a159023576 +Ref: library/tarfile tarfile PAX_FORMAT9023628 +Ref: 2a169023628 +Ref: library/tarfile tarfile DEFAULT_FORMAT9023691 +Ref: 2a179023691 +Ref: tarfile — Read and write tar archive files-Footnote-19024565 +Ref: tarfile — Read and write tar archive files-Footnote-29024632 +Node: TarFile Objects9024704 +Ref: library/tarfile id19024824 +Ref: 2a189024824 +Ref: library/tarfile tarfile-objects9024824 +Ref: 29f39024824 +Ref: library/tarfile tarfile TarFile9025697 +Ref: 12029025697 +Ref: library/tarfile tarfile TarFile open9029038 +Ref: 18459029038 +Ref: library/tarfile tarfile TarFile getmember9029203 +Ref: 18539029203 +Ref: library/tarfile tarfile TarFile getmembers9029527 +Ref: e749029527 +Ref: library/tarfile tarfile TarFile getnames9029715 +Ref: 2a1a9029715 +Ref: library/tarfile tarfile TarFile list9029876 +Ref: e739029876 +Ref: library/tarfile tarfile TarFile next9030326 +Ref: 2a1b9030326 +Ref: library/tarfile tarfile TarFile extractall9030548 +Ref: 42a9030548 +Ref: library/tarfile tarfile TarFile extract9032361 +Ref: 42b9032361 +Ref: library/tarfile tarfile TarFile extractfile9033708 +Ref: 2a1c9033708 +Ref: library/tarfile tarfile TarFile errorlevel9034373 +Ref: 42d9034373 +Ref: library/tarfile tarfile TarFile extraction_filter9035304 +Ref: 2a1d9035304 +Ref: library/tarfile tarfile TarFile add9036613 +Ref: bf39036613 +Ref: library/tarfile tarfile TarFile addfile9037522 +Ref: 16309037522 +Ref: library/tarfile tarfile TarFile gettarinfo9038042 +Ref: 2a1f9038042 +Ref: library/tarfile tarfile TarFile close9039186 +Ref: 2a229039186 +Ref: library/tarfile tarfile TarFile pax_headers9039329 +Ref: 2a239039329 +Node: TarInfo Objects9039452 +Ref: library/tarfile id29039599 +Ref: 2a249039599 +Ref: library/tarfile tarinfo-objects9039599 +Ref: 29ff9039599 +Ref: library/tarfile tarfile TarInfo9040808 +Ref: 12039040808 +Ref: library/tarfile tarfile TarInfo frombuf9040890 +Ref: 29fb9040890 +Ref: library/tarfile tarfile TarInfo fromtarfile9041104 +Ref: 2a269041104 +Ref: library/tarfile tarfile TarInfo tobuf9041286 +Ref: 2a279041286 +Ref: library/tarfile tarfile TarInfo name9041727 +Ref: 2a219041727 +Ref: library/tarfile tarfile TarInfo size9041807 +Ref: 2a209041807 +Ref: library/tarfile tarfile TarInfo mtime9041874 +Ref: 2a289041874 +Ref: library/tarfile tarfile TarInfo mode9042234 +Ref: 2a2b9042234 +Ref: library/tarfile tarfile TarInfo type9042506 +Ref: 2a089042506 +Ref: library/tarfile tarfile TarInfo linkname9042950 +Ref: 2a2c9042950 +Ref: library/tarfile tarfile TarInfo uid9043362 +Ref: 2a2d9043362 +Ref: library/tarfile tarfile TarInfo gid9043641 +Ref: 2a2e9043641 +Ref: library/tarfile tarfile TarInfo uname9043921 +Ref: 2a2f9043921 +Ref: library/tarfile tarfile TarInfo gname9044158 +Ref: 2a309044158 +Ref: library/tarfile tarfile TarInfo chksum9044396 +Ref: 2a319044396 +Ref: library/tarfile tarfile TarInfo devmajor9044467 +Ref: 2a329044467 +Ref: library/tarfile tarfile TarInfo devminor9044544 +Ref: 2a339044544 +Ref: library/tarfile tarfile TarInfo offset9044621 +Ref: 2a349044621 +Ref: library/tarfile tarfile TarInfo offset_data9044703 +Ref: 2a359044703 +Ref: library/tarfile tarfile TarInfo sparse9044793 +Ref: 2a369044793 +Ref: library/tarfile tarfile TarInfo pax_headers9044857 +Ref: 2a379044857 +Ref: library/tarfile tarfile TarInfo replace9045000 +Ref: 2a259045000 +Ref: library/tarfile tarfile TarInfo isfile9045689 +Ref: 2a389045689 +Ref: library/tarfile tarfile TarInfo isreg9045809 +Ref: 2a399045809 +Ref: library/tarfile tarfile TarInfo isdir9045875 +Ref: 2a3a9045875 +Ref: library/tarfile tarfile TarInfo issym9045957 +Ref: 2a3b9045957 +Ref: library/tarfile tarfile TarInfo islnk9046043 +Ref: 2a3c9046043 +Ref: library/tarfile tarfile TarInfo ischr9046125 +Ref: 2a3d9046125 +Ref: library/tarfile tarfile TarInfo isblk9046214 +Ref: 2a3e9046214 +Ref: library/tarfile tarfile TarInfo isfifo9046299 +Ref: 2a3f9046299 +Ref: library/tarfile tarfile TarInfo isdev9046377 +Ref: 2a409046377 +Node: Extraction filters9046498 +Ref: library/tarfile extraction-filters9046655 +Ref: 2a419046655 +Ref: library/tarfile tarfile-extraction-filter9046655 +Ref: 4689046655 +Ref: Extraction filters-Footnote-19049749 +Node: Default named filters9049791 +Ref: library/tarfile default-named-filters9049889 +Ref: 2a439049889 +Ref: library/tarfile tarfile fully_trusted_filter9050053 +Ref: 2a1e9050053 +Ref: library/tarfile tarfile tar_filter9050201 +Ref: 2a429050201 +Ref: library/tarfile tarfile data_filter9051008 +Ref: 4299051008 +Node: Filter errors9052711 +Ref: library/tarfile filter-errors9052848 +Ref: 2a449052848 +Ref: library/tarfile tarfile-extraction-refuse9052848 +Ref: 29fd9052848 +Node: Hints for further verification9053208 +Ref: library/tarfile hints-for-further-verification9053356 +Ref: 2a459053356 +Node: Supporting older Python versions9055085 +Ref: library/tarfile supporting-older-python-versions9055254 +Ref: 2a469055254 +Node: Stateful extraction filter example9056804 +Ref: library/tarfile stateful-extraction-filter-example9056934 +Ref: 2a479056934 +Node: Command-Line Interface<2>9057729 +Ref: library/tarfile command-line-interface9057882 +Ref: 2a489057882 +Ref: library/tarfile tarfile-commandline9057882 +Ref: fc69057882 +Node: Command-line options<2>9058837 +Ref: library/tarfile command-line-options9058922 +Ref: 2a4c9058922 +Ref: library/tarfile cmdoption-tarfile-l9058985 +Ref: 2a4b9058985 +Ref: library/tarfile cmdoption-tarfile-list9059010 +Ref: 2a4d9059010 +Ref: library/tarfile cmdoption-tarfile-c9059071 +Ref: 2a499059071 +Ref: library/tarfile cmdoption-tarfile-create9059120 +Ref: 2a4e9059120 +Ref: library/tarfile cmdoption-tarfile-e9059216 +Ref: 2a4a9059216 +Ref: library/tarfile cmdoption-tarfile-extract9059256 +Ref: 2a4f9059256 +Ref: library/tarfile cmdoption-tarfile-t9059392 +Ref: 2a509059392 +Ref: library/tarfile cmdoption-tarfile-test9059417 +Ref: 2a519059417 +Ref: library/tarfile cmdoption-tarfile-v9059495 +Ref: 2a529059495 +Ref: library/tarfile cmdoption-tarfile-verbose9059495 +Ref: 2a539059495 +Ref: library/tarfile cmdoption-tarfile-filter9059544 +Ref: 2a549059544 +Node: Examples<9>9059779 +Ref: library/tarfile examples9059935 +Ref: 2a559059935 +Ref: library/tarfile tar-examples9059935 +Ref: 29f69059935 +Node: Reading examples9060026 +Ref: library/tarfile reading-examples9060115 +Ref: 2a569060115 +Node: Writing examples9061233 +Ref: library/tarfile writing-examples9061322 +Ref: 2a579061322 +Node: Supported tar formats9062494 +Ref: library/tarfile supported-tar-formats9062639 +Ref: 2a589062639 +Ref: library/tarfile tar-formats9062639 +Ref: 2a139062639 +Node: Unicode issues9064861 +Ref: library/tarfile tar-unicode9064986 +Ref: 2a199064986 +Ref: library/tarfile unicode-issues9064986 +Ref: 2a599064986 +Node: File Formats9066961 +Ref: library/fileformats doc9067107 +Ref: 2a5b9067107 +Ref: library/fileformats file-formats9067107 +Ref: 2a5c9067107 +Ref: library/fileformats fileformats9067107 +Ref: 2a5d9067107 +Node: csv — CSV File Reading and Writing9067558 +Ref: library/csv doc9067694 +Ref: 2a5e9067694 +Ref: library/csv csv-csv-file-reading-and-writing9067694 +Ref: 2a5f9067694 +Ref: library/csv module-csv9067694 +Ref: 299067694 +Ref: csv — CSV File Reading and Writing-Footnote-19069605 +Ref: csv — CSV File Reading and Writing-Footnote-29069668 +Ref: csv — CSV File Reading and Writing-Footnote-39069727 +Node: Module Contents<3>9069769 +Ref: library/csv csv-contents9069903 +Ref: 2a609069903 +Ref: library/csv module-contents9069903 +Ref: 2a619069903 +Ref: library/csv csv reader9070014 +Ref: 4829070014 +Ref: library/csv csv writer9071626 +Ref: 4839071626 +Ref: library/csv csv register_dialect9073403 +Ref: 2a649073403 +Ref: library/csv csv unregister_dialect9073873 +Ref: 18079073873 +Ref: library/csv csv get_dialect9074080 +Ref: 18069074080 +Ref: library/csv csv list_dialects9074311 +Ref: 18089074311 +Ref: library/csv csv field_size_limit9074398 +Ref: 18059074398 +Ref: library/csv csv DictReader9074633 +Ref: 9e49074633 +Ref: library/csv csv DictWriter9076491 +Ref: 11f09076491 +Ref: library/csv csv Dialect9078274 +Ref: 167b9078274 +Ref: library/csv csv excel9079097 +Ref: 2a669079097 +Ref: library/csv csv excel_tab9079280 +Ref: 2a679079280 +Ref: library/csv csv unix_dialect9079485 +Ref: 11ef9079485 +Ref: library/csv csv Sniffer9079789 +Ref: 2a689079789 +Ref: library/csv csv Sniffer sniff9079958 +Ref: 2a699079958 +Ref: library/csv csv Sniffer has_header9080280 +Ref: 18a29080280 +Ref: library/csv csv-constants9081426 +Ref: 2a6a9081426 +Ref: library/csv csv QUOTE_ALL9081486 +Ref: 2a6b9081486 +Ref: library/csv csv QUOTE_MINIMAL9081575 +Ref: 2a6c9081575 +Ref: library/csv csv QUOTE_NONNUMERIC9081820 +Ref: 15ed9081820 +Ref: library/csv csv QUOTE_NONE9082355 +Ref: 2a6d9082355 +Ref: library/csv csv QUOTE_NOTNULL9082964 +Ref: 4809082964 +Ref: library/csv csv QUOTE_STRINGS9083402 +Ref: 4819083402 +Ref: library/csv csv Error9083930 +Ref: 2a659083930 +Ref: Module Contents<3>-Footnote-19084056 +Ref: Module Contents<3>-Footnote-29084397 +Node: Dialects and Formatting Parameters9084738 +Ref: library/csv csv-fmt-params9084895 +Ref: 2a639084895 +Ref: library/csv dialects-and-formatting-parameters9084895 +Ref: 2a6e9084895 +Ref: library/csv csv Dialect delimiter9085685 +Ref: 2a6f9085685 +Ref: library/csv csv Dialect doublequote9085805 +Ref: 2a709085805 +Ref: library/csv csv Dialect escapechar9086277 +Ref: 2a719086277 +Ref: library/csv csv Dialect lineterminator9086986 +Ref: 2a729086986 +Ref: library/csv csv Dialect quotechar9087341 +Ref: 2a739087341 +Ref: library/csv csv Dialect quoting9087831 +Ref: 2a749087831 +Ref: library/csv csv Dialect skipinitialspace9088143 +Ref: 2a759088143 +Ref: library/csv csv Dialect strict9088309 +Ref: 2a769088309 +Node: Reader Objects9088449 +Ref: library/csv id39088602 +Ref: 2a779088602 +Ref: library/csv reader-objects9088602 +Ref: 2a629088602 +Ref: library/csv csv csvreader __next__9088795 +Ref: 2a789088795 +Ref: library/csv csv csvreader dialect9089191 +Ref: 2a799089191 +Ref: library/csv csv csvreader line_num9089292 +Ref: 2a7a9089292 +Ref: library/csv csv DictReader fieldnames9089544 +Ref: 2a7b9089544 +Node: Writer Objects9089749 +Ref: library/csv writer-objects9089880 +Ref: 2a7c9089880 +Ref: library/csv csv csvwriter writerow9090496 +Ref: de99090496 +Ref: library/csv csv csvwriter writerows9090826 +Ref: 2a7d9090826 +Ref: library/csv csv csvwriter dialect9091089 +Ref: 2a7e9091089 +Ref: library/csv csv DictWriter writeheader9091244 +Ref: 11f19091244 +Node: Examples<10>9091731 +Ref: library/csv csv-examples9091839 +Ref: 2a7f9091839 +Ref: library/csv examples9091839 +Ref: 2a809091839 +Node: configparser — Configuration file parser9093830 +Ref: library/configparser doc9094003 +Ref: 2a819094003 +Ref: library/configparser configparser-configuration-file-parser9094003 +Ref: 2a829094003 +Ref: library/configparser module-configparser9094003 +Ref: 229094003 +Ref: configparser — Configuration file parser-Footnote-19095514 +Node: Quick Start9095586 +Ref: library/configparser quick-start9095704 +Ref: 2a839095704 +Ref: Quick Start-Footnote-19099448 +Ref: Quick Start-Footnote-29099650 +Node: Supported Datatypes9099852 +Ref: library/configparser supported-datatypes9099994 +Ref: 2a879099994 +Ref: Supported Datatypes-Footnote-19101316 +Ref: Supported Datatypes-Footnote-29101518 +Node: Fallback Values9101720 +Ref: library/configparser fallback-values9101879 +Ref: 2a8b9101879 +Node: Supported INI File Structure9103395 +Ref: library/configparser supported-ini-file-structure9103551 +Ref: 2a849103551 +Ref: Supported INI File Structure-Footnote-19106270 +Ref: Supported INI File Structure-Footnote-29106472 +Ref: Supported INI File Structure-Footnote-39106674 +Ref: Supported INI File Structure-Footnote-49106876 +Ref: Supported INI File Structure-Footnote-59107078 +Node: Unnamed Sections9107280 +Ref: library/configparser id109107444 +Ref: 2a8e9107444 +Ref: library/configparser unnamed-sections9107444 +Ref: 2a8f9107444 +Node: Interpolation of values9107924 +Ref: library/configparser interpolation-of-values9108083 +Ref: 2a909108083 +Ref: library/configparser configparser BasicInterpolation9108319 +Ref: 71d9108319 +Ref: library/configparser configparser ExtendedInterpolation9109608 +Ref: 71e9109608 +Ref: Interpolation of values-Footnote-19111099 +Node: Mapping Protocol Access9111301 +Ref: library/configparser mapping-protocol-access9111472 +Ref: 2a859111472 +Ref: Mapping Protocol Access-Footnote-19114364 +Node: Customizing Parser Behaviour9114566 +Ref: library/configparser customizing-parser-behaviour9114733 +Ref: 2a869114733 +Ref: library/configparser configparser ConfigParser BOOLEAN_STATES9125501 +Ref: 2a949125501 +Ref: library/configparser configparser ConfigParser SECTCRE9127687 +Ref: 2a8c9127687 +Node: Legacy API Examples9128929 +Ref: library/configparser legacy-api-examples9129093 +Ref: 2a959129093 +Node: ConfigParser Objects9132911 +Ref: library/configparser configparser-objects9133070 +Ref: 2a969133070 +Ref: library/configparser id139133070 +Ref: 2a979133070 +Ref: library/configparser configparser ConfigParser9133133 +Ref: 1c89133133 +Ref: library/configparser configparser ConfigParser defaults9138564 +Ref: 2a9a9138564 +Ref: library/configparser configparser ConfigParser sections9138664 +Ref: 2a9b9138664 +Ref: library/configparser configparser ConfigParser add_section9138807 +Ref: 12619138807 +Ref: library/configparser configparser ConfigParser has_section9139297 +Ref: 2a9c9139297 +Ref: library/configparser configparser ConfigParser options9139473 +Ref: 2a9d9139473 +Ref: library/configparser configparser ConfigParser has_option9139583 +Ref: 2a9e9139583 +Ref: library/configparser configparser ConfigParser read9139883 +Ref: 14319139883 +Ref: library/configparser configparser ConfigParser read_file9141624 +Ref: 5019141624 +Ref: library/configparser configparser ConfigParser read_string9142101 +Ref: 2a939142101 +Ref: library/configparser configparser ConfigParser read_dict9142450 +Ref: 2a919142450 +Ref: library/configparser configparser ConfigParser get9143147 +Ref: 125f9143147 +Ref: library/configparser configparser ConfigParser getint9144103 +Ref: 2a899144103 +Ref: library/configparser configparser ConfigParser getfloat9144392 +Ref: 2a8a9144392 +Ref: library/configparser configparser ConfigParser getboolean9144696 +Ref: 2a889144696 +Ref: library/configparser configparser ConfigParser items9145427 +Ref: 2a9f9145427 +Ref: library/configparser configparser ConfigParser set9146066 +Ref: 12609146066 +Ref: library/configparser configparser ConfigParser write9146351 +Ref: 2a929146351 +Ref: library/configparser configparser ConfigParser remove_option9147048 +Ref: 2aa19147048 +Ref: library/configparser configparser ConfigParser remove_section9147362 +Ref: 2aa29147362 +Ref: library/configparser configparser ConfigParser optionxform9147574 +Ref: 2a989147574 +Ref: library/configparser configparser UNNAMED_SECTION9148547 +Ref: 2a8d9148547 +Ref: library/configparser configparser MAX_INTERPOLATION_DEPTH9148718 +Ref: 2aa39148718 +Node: RawConfigParser Objects9148951 +Ref: library/configparser id159149104 +Ref: 2aa49149104 +Ref: library/configparser rawconfigparser-objects9149104 +Ref: 2aa59149104 +Ref: library/configparser configparser RawConfigParser9149173 +Ref: f5f9149173 +Ref: library/configparser configparser RawConfigParser add_section9150566 +Ref: 2aa69150566 +Ref: library/configparser configparser RawConfigParser set9151041 +Ref: 2aa79151041 +Node: Exceptions<8>9151868 +Ref: library/configparser exceptions9151992 +Ref: 2aa89151992 +Ref: library/configparser configparser Error9152035 +Ref: 2aa99152035 +Ref: library/configparser configparser NoSectionError9152137 +Ref: 2aa09152137 +Ref: library/configparser configparser DuplicateSectionError9152243 +Ref: 12629152243 +Ref: library/configparser configparser DuplicateOptionError9152652 +Ref: 12639152652 +Ref: library/configparser configparser NoOptionError9153012 +Ref: 2aaa9153012 +Ref: library/configparser configparser InterpolationError9153146 +Ref: 2aab9153146 +Ref: library/configparser configparser InterpolationDepthError9153291 +Ref: 2aac9153291 +Ref: library/configparser configparser InterpolationMissingOptionError9153551 +Ref: 2aad9153551 +Ref: library/configparser configparser InterpolationSyntaxError9153740 +Ref: 2aae9153740 +Ref: library/configparser configparser MissingSectionHeaderError9153968 +Ref: 2aaf9153968 +Ref: library/configparser configparser ParsingError9154113 +Ref: 5009154113 +Ref: library/configparser configparser MultilineContinuationError9154415 +Ref: 2a999154415 +Node: tomllib — Parse TOML files9154605 +Ref: library/tomllib doc9154773 +Ref: 2ab09154773 +Ref: library/tomllib module-tomllib9154773 +Ref: fc9154773 +Ref: library/tomllib tomllib-parse-toml-files9154773 +Ref: 2ab19154773 +Ref: library/tomllib tomllib load9155609 +Ref: 2ab29155609 +Ref: library/tomllib tomllib loads9156334 +Ref: 2ab59156334 +Ref: library/tomllib tomllib TOMLDecodeError9156753 +Ref: 2ab49156753 +Ref: tomllib — Parse TOML files-Footnote-19156927 +Ref: tomllib — Parse TOML files-Footnote-29156991 +Ref: tomllib — Parse TOML files-Footnote-39157019 +Ref: tomllib — Parse TOML files-Footnote-49157061 +Node: Examples<11>9157103 +Ref: library/tomllib examples9157205 +Ref: 2ab69157205 +Node: Conversion Table9157545 +Ref: library/tomllib conversion-table9157647 +Ref: 2ab79157647 +Ref: library/tomllib toml-to-py-table9157700 +Ref: 2ab39157700 +Node: netrc — netrc file processing9159058 +Ref: library/netrc doc9159233 +Ref: 2ab89159233 +Ref: library/netrc module-netrc9159233 +Ref: 9b9159233 +Ref: library/netrc netrc-netrc-file-processing9159233 +Ref: 2ab99159233 +Ref: library/netrc netrc netrc9159552 +Ref: 18c19159552 +Ref: library/netrc netrc NetrcParseError9161367 +Ref: 2aba9161367 +Ref: library/netrc netrc NetrcParseError msg9161593 +Ref: 2abb9161593 +Ref: library/netrc netrc NetrcParseError filename9161663 +Ref: 2abc9161663 +Ref: library/netrc netrc NetrcParseError lineno9161733 +Ref: 2abd9161733 +Ref: netrc — netrc file processing-Footnote-19161882 +Node: netrc Objects9161947 +Ref: library/netrc id19162028 +Ref: 2abe9162028 +Ref: library/netrc netrc-objects9162028 +Ref: 2abf9162028 +Ref: library/netrc netrc netrc authenticators9162133 +Ref: 2ac09162133 +Ref: library/netrc netrc netrc __repr__9162479 +Ref: 2ac19162479 +Ref: library/netrc netrc netrc hosts9162703 +Ref: 2ac29162703 +Ref: library/netrc netrc netrc macros9162901 +Ref: 2ac39162901 +Node: plistlib — Generate and parse Apple plist files9162984 +Ref: library/plistlib doc9163122 +Ref: 2ac49163122 +Ref: library/plistlib module-plistlib9163122 +Ref: ab9163122 +Ref: library/plistlib plistlib-generate-and-parse-apple-plist-files9163122 +Ref: 2ac59163122 +Ref: library/plistlib plistlib load9164560 +Ref: 94f9164560 +Ref: library/plistlib plistlib loads9165806 +Ref: 9509165806 +Ref: library/plistlib plistlib dump9166153 +Ref: 9519166153 +Ref: library/plistlib plistlib dumps9167555 +Ref: 9529167555 +Ref: library/plistlib plistlib UID9167913 +Ref: a209167913 +Ref: library/plistlib plistlib UID data9168093 +Ref: 2ac69168093 +Ref: library/plistlib plistlib FMT_XML9168279 +Ref: f749168279 +Ref: library/plistlib plistlib FMT_BINARY9168373 +Ref: f759168373 +Ref: library/plistlib plistlib InvalidFileException9168518 +Ref: 192f9168518 +Ref: plistlib — Generate and parse Apple plist files-Footnote-19168707 +Ref: plistlib — Generate and parse Apple plist files-Footnote-29168775 +Node: Examples<12>9168874 +Ref: library/plistlib examples9168972 +Ref: 2ac79168972 +Node: Cryptographic Services9169827 +Ref: library/crypto doc9169976 +Ref: 2ac89169976 +Ref: library/crypto crypto9169976 +Ref: 2ac99169976 +Ref: library/crypto cryptographic-services9169976 +Ref: 2aca9169976 +Node: hashlib — Secure hashes and message digests9170392 +Ref: library/hashlib doc9170554 +Ref: 2acb9170554 +Ref: library/hashlib hashlib-secure-hashes-and-message-digests9170554 +Ref: 2acc9170554 +Ref: library/hashlib module-hashlib9170554 +Ref: 689170554 +Ref: hashlib — Secure hashes and message digests-Footnote-19171466 +Ref: hashlib — Secure hashes and message digests-Footnote-29171533 +Ref: hashlib — Secure hashes and message digests-Footnote-39171590 +Ref: hashlib — Secure hashes and message digests-Footnote-49171640 +Ref: hashlib — Secure hashes and message digests-Footnote-59171710 +Node: Hash algorithms9171769 +Ref: library/hashlib hash-algorithms9171880 +Ref: 2acd9171880 +Ref: library/hashlib id19171880 +Ref: 2ace9171880 +Ref: library/hashlib hashlib-usedforsecurity9174010 +Ref: 2ad79174010 +Ref: Hash algorithms-Footnote-19174695 +Ref: Hash algorithms-Footnote-29174803 +Node: Usage9174850 +Ref: library/hashlib usage9174982 +Ref: 2ad89174982 +Node: Constructors9175634 +Ref: library/hashlib constructors9175761 +Ref: 2ad99175761 +Ref: library/hashlib hashlib new9175806 +Ref: 19479175806 +Ref: library/hashlib hashlib md59176368 +Ref: 153f9176368 +Ref: library/hashlib hashlib sha19176429 +Ref: 2ad29176429 +Ref: library/hashlib hashlib sha2249176491 +Ref: 2ad39176491 +Ref: library/hashlib hashlib sha2569176555 +Ref: 15649176555 +Ref: library/hashlib hashlib sha3849176619 +Ref: 2ad49176619 +Ref: library/hashlib hashlib sha5129176683 +Ref: 2ad59176683 +Ref: library/hashlib hashlib sha3_2249176747 +Ref: ca29176747 +Ref: library/hashlib hashlib sha3_2569176813 +Ref: ca39176813 +Ref: library/hashlib hashlib sha3_3849176879 +Ref: ca49176879 +Ref: library/hashlib hashlib sha3_5129176945 +Ref: ca59176945 +Node: Attributes9177109 +Ref: library/hashlib attributes9177243 +Ref: 2ada9177243 +Ref: library/hashlib hashlib algorithms_guaranteed9177344 +Ref: 135f9177344 +Ref: library/hashlib hashlib algorithms_available9177679 +Ref: 13609177679 +Node: Hash Objects9178110 +Ref: library/hashlib hash-objects9178261 +Ref: 2adb9178261 +Ref: library/hashlib hashlib hash digest_size9178414 +Ref: 2adc9178414 +Ref: library/hashlib hashlib hash block_size9178489 +Ref: 2add9178489 +Ref: library/hashlib hashlib hash name9178623 +Ref: f439178623 +Ref: library/hashlib hashlib hash update9179044 +Ref: 2acf9179044 +Ref: library/hashlib hashlib hash digest9179320 +Ref: 2ad09179320 +Ref: library/hashlib hashlib hash hexdigest9179560 +Ref: 2ad19179560 +Ref: library/hashlib hashlib hash copy9179831 +Ref: 2ade9179831 +Node: SHAKE variable length digests9180018 +Ref: library/hashlib shake-variable-length-digests9180171 +Ref: 2adf9180171 +Ref: library/hashlib hashlib shake_1289180250 +Ref: ca69180250 +Ref: library/hashlib hashlib shake_2569180317 +Ref: ca79180317 +Ref: library/hashlib hashlib shake digest9180645 +Ref: 1a389180645 +Ref: library/hashlib hashlib shake hexdigest9180876 +Ref: 1a399180876 +Node: File hashing9181310 +Ref: library/hashlib file-hashing9181465 +Ref: 2ae09181465 +Ref: library/hashlib hashlib file_digest9181610 +Ref: 6409181610 +Node: Key derivation9183313 +Ref: library/hashlib key-derivation9183445 +Ref: 2ae19183445 +Ref: library/hashlib hashlib pbkdf2_hmac9183756 +Ref: 50a9183756 +Ref: library/hashlib hashlib scrypt9185508 +Ref: c3e9185508 +Ref: Key derivation-Footnote-19186246 +Ref: Key derivation-Footnote-29186308 +Ref: Key derivation-Footnote-39186395 +Ref: Key derivation-Footnote-49186506 +Node: BLAKE29186565 +Ref: library/hashlib blake29186676 +Ref: 2ae29186676 +Ref: library/hashlib hashlib-blake29186676 +Ref: 1d919186676 +Ref: BLAKE2-Footnote-19187399 +Ref: BLAKE2-Footnote-29187430 +Ref: BLAKE2-Footnote-39187489 +Node: Creating hash objects9187567 +Ref: library/hashlib creating-hash-objects9187652 +Ref: 2ae39187652 +Ref: library/hashlib hashlib blake2b9187781 +Ref: 63e9187781 +Ref: library/hashlib hashlib blake2s9188017 +Ref: 63f9188017 +Ref: Creating hash objects-Footnote-19191061 +Node: Constants<5>9191112 +Ref: library/hashlib constants9191218 +Ref: 2ae49191218 +Ref: library/hashlib hashlib blake2b SALT_SIZE9191259 +Ref: 2ae59191259 +Ref: library/hashlib hashlib blake2s SALT_SIZE9191288 +Ref: 2ae69191288 +Ref: library/hashlib hashlib blake2b PERSON_SIZE9191373 +Ref: 2ae79191373 +Ref: library/hashlib hashlib blake2s PERSON_SIZE9191404 +Ref: 2ae89191404 +Ref: library/hashlib hashlib blake2b MAX_KEY_SIZE9191509 +Ref: 2ae99191509 +Ref: library/hashlib hashlib blake2s MAX_KEY_SIZE9191541 +Ref: 2aea9191541 +Ref: library/hashlib hashlib blake2b MAX_DIGEST_SIZE9191592 +Ref: 2aeb9191592 +Ref: library/hashlib hashlib blake2s MAX_DIGEST_SIZE9191627 +Ref: 2aec9191627 +Node: Examples<13>9191718 +Ref: library/hashlib examples9191810 +Ref: 2aed9191810 +Node: Simple hashing9191986 +Ref: library/hashlib simple-hashing9192086 +Ref: 2aee9192086 +Node: Using different digest sizes9193540 +Ref: library/hashlib using-different-digest-sizes9193662 +Ref: 2aef9193662 +Node: Keyed hashing9194805 +Ref: library/hashlib keyed-hashing9194931 +Ref: 2af09194931 +Ref: Keyed hashing-Footnote-19196942 +Node: Randomized hashing9196985 +Ref: library/hashlib randomized-hashing9197098 +Ref: 2af19197098 +Ref: Randomized hashing-Footnote-19199702 +Ref: Randomized hashing-Footnote-29199754 +Node: Personalization9199789 +Ref: library/hashlib personalization9199898 +Ref: 2af29199898 +Ref: Personalization-Footnote-19201893 +Node: Tree mode9201963 +Ref: library/hashlib tree-mode9202045 +Ref: 2af39202045 +Node: Credits9203296 +Ref: library/hashlib credits9203367 +Ref: 2af49203367 +Ref: library/hashlib hashlib-seealso9204798 +Ref: 2ad69204798 +Ref: Credits-Footnote-19205784 +Ref: Credits-Footnote-29205815 +Ref: Credits-Footnote-39205876 +Ref: Credits-Footnote-49205954 +Ref: Credits-Footnote-59205991 +Ref: Credits-Footnote-69206034 +Node: hmac — Keyed-Hashing for Message Authentication9206077 +Ref: library/hmac doc9206311 +Ref: 2af59206311 +Ref: library/hmac hmac-keyed-hashing-for-message-authentication9206311 +Ref: 2af69206311 +Ref: library/hmac module-hmac9206311 +Ref: 6a9206311 +Ref: library/hmac hmac new9206778 +Ref: a9f9206778 +Ref: library/hmac hmac digest9207606 +Ref: b3e9207606 +Ref: library/hmac hmac HMAC update9208249 +Ref: f459208249 +Ref: library/hmac hmac HMAC digest9208597 +Ref: 2af79208597 +Ref: library/hmac hmac HMAC hexdigest9209207 +Ref: 2af89209207 +Ref: library/hmac hmac HMAC copy9209796 +Ref: 2af99209796 +Ref: library/hmac hmac HMAC digest_size9210034 +Ref: f489210034 +Ref: library/hmac hmac HMAC block_size9210121 +Ref: f469210121 +Ref: library/hmac hmac HMAC name9210243 +Ref: f479210243 +Ref: library/hmac hmac compare_digest9210564 +Ref: 10bf9210564 +Ref: hmac — Keyed-Hashing for Message Authentication-Footnote-19211503 +Ref: hmac — Keyed-Hashing for Message Authentication-Footnote-29211567 +Node: secrets — Generate secure random numbers for managing secrets9211626 +Ref: library/secrets doc9211806 +Ref: 2afa9211806 +Ref: library/secrets module-secrets9211806 +Ref: c09211806 +Ref: library/secrets secrets-generate-secure-random-numbers-for-managing-secrets9211806 +Ref: 2afb9211806 +Ref: secrets — Generate secure random numbers for managing secrets-Footnote-19212672 +Ref: secrets — Generate secure random numbers for managing secrets-Footnote-29212739 +Node: Random numbers9212781 +Ref: library/secrets random-numbers9212921 +Ref: 2afc9212921 +Ref: library/secrets secrets SystemRandom9213094 +Ref: 2afd9213094 +Ref: library/secrets secrets choice9213311 +Ref: 2afe9213311 +Ref: library/secrets secrets randbelow9213413 +Ref: 2aff9213413 +Ref: library/secrets secrets randbits9213539 +Ref: 2b009213539 +Node: Generating tokens9213629 +Ref: library/secrets generating-tokens9213793 +Ref: 2b019213793 +Ref: library/secrets secrets token_bytes9214012 +Ref: 26eb9214012 +Ref: library/secrets secrets token_hex9214305 +Ref: 17ab9214305 +Ref: library/secrets secrets token_urlsafe9214641 +Ref: 2b029214641 +Node: How many bytes should tokens use?9215071 +Ref: library/secrets how-many-bytes-should-tokens-use9215158 +Ref: 2b039215158 +Ref: How many bytes should tokens use?-Footnote-19216185 +Node: Other functions9216242 +Ref: library/secrets other-functions9216418 +Ref: 2b049216418 +Ref: library/secrets secrets compare_digest9216469 +Ref: 2b059216469 +Ref: Other functions-Footnote-19216821 +Node: Recipes and best practices9216878 +Ref: library/secrets recipes-and-best-practices9217028 +Ref: 2b069217028 +Ref: Recipes and best practices-Footnote-19218767 +Ref: Recipes and best practices-Footnote-29218823 +Node: Generic Operating System Services9218853 +Ref: library/allos doc9219022 +Ref: 2b079219022 +Ref: library/allos allos9219022 +Ref: 2b089219022 +Ref: library/allos generic-operating-system-services9219022 +Ref: 2b099219022 +Node: os — Miscellaneous operating system interfaces9219942 +Ref: library/os doc9220111 +Ref: 2b0a9220111 +Ref: library/os module-os9220111 +Ref: a19220111 +Ref: library/os os-miscellaneous-operating-system-interfaces9220111 +Ref: 2b0b9220111 +Ref: library/os os error9222398 +Ref: 2b0d9222398 +Ref: library/os os name9222486 +Ref: 2b0e9222486 +Ref: library/os os-filenames9222930 +Ref: 2a5a9222930 +Ref: os — Miscellaneous operating system interfaces-Footnote-19223357 +Node: File Names Command Line Arguments and Environment Variables9223419 +Ref: library/os file-names-command-line-arguments-and-environment-variables9223589 +Ref: 2b0f9223589 +Ref: library/os filesystem-encoding9223589 +Ref: 27c59223589 +Node: Python UTF-8 Mode9224924 +Ref: library/os python-utf-8-mode9225121 +Ref: 2b109225121 +Ref: library/os utf8-mode9225121 +Ref: 6529225121 +Ref: Python UTF-8 Mode-Footnote-19227974 +Ref: Python UTF-8 Mode-Footnote-29228016 +Node: Process Parameters9228058 +Ref: library/os os-procinfo9228216 +Ref: 2b119228216 +Ref: library/os process-parameters9228216 +Ref: 2b129228216 +Ref: library/os os ctermid9228370 +Ref: 2b139228370 +Ref: library/os os environ9228537 +Ref: 11ac9228537 +Ref: library/os os environb9230521 +Ref: 12099230521 +Ref: library/os os fsencode9231292 +Ref: c559231292 +Ref: library/os os fsdecode9231681 +Ref: c549231681 +Ref: library/os os fspath9232074 +Ref: c539232074 +Ref: library/os os PathLike9232487 +Ref: c519232487 +Ref: library/os os PathLike __fspath__9232666 +Ref: c529232666 +Ref: library/os os getenv9232936 +Ref: 2b159232936 +Ref: library/os os getenvb9233615 +Ref: 12089233615 +Ref: library/os os get_exec_path9234198 +Ref: 2b169234198 +Ref: library/os os getegid9234580 +Ref: 2b179234580 +Ref: library/os os geteuid9234821 +Ref: 17e89234821 +Ref: library/os os getgid9234955 +Ref: 2b189234955 +Ref: library/os os getgrouplist9235181 +Ref: 11089235181 +Ref: library/os os getgroups9235576 +Ref: 2b199235576 +Ref: library/os os getlogin9236810 +Ref: 152c9236810 +Ref: library/os os getpgid9237301 +Ref: 2b1b9237301 +Ref: library/os os getpgrp9237536 +Ref: 2b1c9237536 +Ref: library/os os getpid9237664 +Ref: 2b0c9237664 +Ref: library/os os getppid9237833 +Ref: 16529237833 +Ref: library/os os getpriority9238213 +Ref: 10f39238213 +Ref: library/os os PRIO_PROCESS9238857 +Ref: 2b1d9238857 +Ref: library/os os PRIO_PGRP9238883 +Ref: 2b1e9238883 +Ref: library/os os PRIO_USER9238906 +Ref: 2b1f9238906 +Ref: library/os os PRIO_DARWIN_THREAD9239106 +Ref: 2b209239106 +Ref: library/os os PRIO_DARWIN_PROCESS9239138 +Ref: 2b219239138 +Ref: library/os os PRIO_DARWIN_BG9239171 +Ref: 2b229239171 +Ref: library/os os PRIO_DARWIN_NONUI9239199 +Ref: 2b239239199 +Ref: library/os os getresuid9239398 +Ref: 13099239398 +Ref: library/os os getresgid9239621 +Ref: 13089239621 +Ref: library/os os getuid9239845 +Ref: 152b9239845 +Ref: library/os os initgroups9240067 +Ref: 130c9240067 +Ref: library/os os putenv9240383 +Ref: 91b9240383 +Ref: library/os os setegid9241518 +Ref: 2b259241518 +Ref: library/os os seteuid9241670 +Ref: 2b269241670 +Ref: library/os os setgid9241821 +Ref: 2b279241821 +Ref: library/os os setgroups9241960 +Ref: 2b1a9241960 +Ref: library/os os setns9242618 +Ref: 17c09242618 +Ref: library/os os setpgrp9244140 +Ref: 2b299244140 +Ref: library/os os setpgid9244386 +Ref: 2b2a9244386 +Ref: library/os os setpriority9244663 +Ref: 10f49244663 +Ref: library/os os setregid9245452 +Ref: 2b2b9245452 +Ref: library/os os setresgid9245621 +Ref: 130a9245621 +Ref: library/os os setresuid9245833 +Ref: 130b9245833 +Ref: library/os os setreuid9246044 +Ref: 2b2c9246044 +Ref: library/os os getsid9246212 +Ref: 2b2d9246212 +Ref: library/os os setsid9246383 +Ref: 19d49246383 +Ref: library/os os setuid9246548 +Ref: 2b2e9246548 +Ref: library/os os strerror9246687 +Ref: 2b2f9246687 +Ref: library/os os supports_bytes_environ9246933 +Ref: 12079246933 +Ref: library/os os umask9247100 +Ref: 2b309247100 +Ref: library/os os uname9247305 +Ref: 110a9247305 +Ref: library/os os unsetenv9248616 +Ref: 91a9248616 +Ref: library/os os unshare9249386 +Ref: 17c19249386 +Ref: library/os os-unshare-clone-flags9250100 +Ref: 2b289250100 +Ref: library/os os CLONE_FILES9250270 +Ref: 2b329250270 +Ref: library/os os CLONE_FS9250295 +Ref: 2b339250295 +Ref: library/os os CLONE_NEWCGROUP9250317 +Ref: 2b349250317 +Ref: library/os os CLONE_NEWIPC9250346 +Ref: 2b359250346 +Ref: library/os os CLONE_NEWNET9250372 +Ref: 2b369250372 +Ref: library/os os CLONE_NEWNS9250398 +Ref: 2b379250398 +Ref: library/os os CLONE_NEWPID9250423 +Ref: 2b389250423 +Ref: library/os os CLONE_NEWTIME9250449 +Ref: 2b399250449 +Ref: library/os os CLONE_NEWUSER9250476 +Ref: 2b3a9250476 +Ref: library/os os CLONE_NEWUTS9250503 +Ref: 2b3b9250503 +Ref: library/os os CLONE_SIGHAND9250529 +Ref: 2b3c9250529 +Ref: library/os os CLONE_SYSVSEM9250556 +Ref: 2b3d9250556 +Ref: library/os os CLONE_THREAD9250583 +Ref: 2b3e9250583 +Ref: library/os os CLONE_VM9250609 +Ref: 2b3f9250609 +Ref: Process Parameters-Footnote-19250668 +Ref: Process Parameters-Footnote-29250710 +Ref: Process Parameters-Footnote-39250752 +Ref: Process Parameters-Footnote-49250797 +Ref: Process Parameters-Footnote-59250847 +Ref: Process Parameters-Footnote-69250894 +Node: File Object Creation9250941 +Ref: library/os file-object-creation9251108 +Ref: 2b409251108 +Ref: library/os os-newstreams9251108 +Ref: 2b419251108 +Ref: library/os os fdopen9251284 +Ref: 1f329251284 +Node: File Descriptor Operations9251611 +Ref: library/os file-descriptor-operations9251781 +Ref: 2b429251781 +Ref: library/os os-fd-ops9251781 +Ref: 2b439251781 +Ref: library/os os close9252623 +Ref: b749252623 +Ref: library/os os closerange9253068 +Ref: 2b449253068 +Ref: library/os os copy_file_range9253417 +Ref: 2b459253417 +Ref: library/os os device_encoding9255095 +Ref: 18919255095 +Ref: library/os os dup9255507 +Ref: 19dc9255507 +Ref: library/os os dup29255922 +Ref: b639255922 +Ref: library/os os fchmod9256424 +Ref: 21e9256424 +Ref: library/os os fchown9257002 +Ref: d899257002 +Ref: library/os os fdatasync9257569 +Ref: d8a9257569 +Ref: library/os os fpathconf9257800 +Ref: 2b479257800 +Ref: library/os os fstat9258833 +Ref: d8b9258833 +Ref: library/os os fstatvfs9259093 +Ref: d8c9259093 +Ref: library/os os fsync9259371 +Ref: d8d9259371 +Ref: library/os os ftruncate9259857 +Ref: d8e9259857 +Ref: library/os os get_blocking9260302 +Ref: e389260302 +Ref: library/os os grantpt9260881 +Ref: 16839260881 +Ref: library/os os isatty9261265 +Ref: 18909261265 +Ref: library/os os lockf9261419 +Ref: 11079261419 +Ref: library/os os F_LOCK9261941 +Ref: 2b499261941 +Ref: library/os os F_TLOCK9261961 +Ref: 2b4a9261961 +Ref: library/os os F_ULOCK9261982 +Ref: 2b4b9261982 +Ref: library/os os F_TEST9262003 +Ref: 2b4c9262003 +Ref: library/os os login_tty9262160 +Ref: 17599262160 +Ref: library/os os lseek9262519 +Ref: 110b9262519 +Ref: library/os os SEEK_SET9263376 +Ref: 12809263376 +Ref: library/os os SEEK_CUR9263398 +Ref: 12819263398 +Ref: library/os os SEEK_END9263420 +Ref: 12829263420 +Ref: library/os os SEEK_HOLE9263999 +Ref: 2b4d9263999 +Ref: library/os os SEEK_DATA9264022 +Ref: 2b4e9264022 +Ref: library/os os open9264747 +Ref: d919264747 +Ref: library/os os O_RDONLY9266829 +Ref: 2b4f9266829 +Ref: library/os os O_WRONLY9266851 +Ref: 2b509266851 +Ref: library/os os O_RDWR9266873 +Ref: 2b529266873 +Ref: library/os os O_APPEND9266893 +Ref: 2b539266893 +Ref: library/os os O_CREAT9266915 +Ref: 2b549266915 +Ref: library/os os O_EXCL9266936 +Ref: 285a9266936 +Ref: library/os os O_TRUNC9266956 +Ref: 2b559266956 +Ref: library/os os O_DSYNC9267039 +Ref: 2b569267039 +Ref: library/os os O_RSYNC9267060 +Ref: 2b579267060 +Ref: library/os os O_SYNC9267081 +Ref: 2b589267081 +Ref: library/os os O_NDELAY9267101 +Ref: 2b599267101 +Ref: library/os os O_NONBLOCK9267123 +Ref: e3a9267123 +Ref: library/os os O_NOCTTY9267147 +Ref: 2b5a9267147 +Ref: library/os os O_CLOEXEC9267169 +Ref: 10759267169 +Ref: library/os os O_BINARY9267314 +Ref: 2b519267314 +Ref: library/os os O_NOINHERIT9267336 +Ref: 2b5b9267336 +Ref: library/os os O_SHORT_LIVED9267361 +Ref: 2b5c9267361 +Ref: library/os os O_TEMPORARY9267388 +Ref: 2b5d9267388 +Ref: library/os os O_RANDOM9267413 +Ref: 2b5e9267413 +Ref: library/os os O_SEQUENTIAL9267435 +Ref: 2b5f9267435 +Ref: library/os os O_TEXT9267461 +Ref: 2b609267461 +Ref: library/os os O_EVTONLY9267539 +Ref: 8169267539 +Ref: library/os os O_FSYNC9267562 +Ref: 8179267562 +Ref: library/os os O_SYMLINK9267583 +Ref: 8189267583 +Ref: library/os os O_NOFOLLOW_ANY9267606 +Ref: 8199267606 +Ref: library/os os O_ASYNC9267841 +Ref: 2b619267841 +Ref: library/os os O_DIRECT9267862 +Ref: 2b629267862 +Ref: library/os os O_DIRECTORY9267884 +Ref: 2b639267884 +Ref: library/os os O_NOFOLLOW9267909 +Ref: 2b649267909 +Ref: library/os os O_NOATIME9267933 +Ref: 2b659267933 +Ref: library/os os O_PATH9267956 +Ref: f6d9267956 +Ref: library/os os O_TMPFILE9267976 +Ref: f6e9267976 +Ref: library/os os O_SHLOCK9267999 +Ref: 13fa9267999 +Ref: library/os os O_EXLOCK9268021 +Ref: 13fb9268021 +Ref: library/os os openpty9268312 +Ref: 2b669268312 +Ref: library/os os pipe9268756 +Ref: 17da9268756 +Ref: library/os os pipe29269096 +Ref: 10de9269096 +Ref: library/os os posix_fallocate9269487 +Ref: d939269487 +Ref: library/os os posix_fadvise9269750 +Ref: d929269750 +Ref: library/os os POSIX_FADV_NORMAL9270357 +Ref: 2b679270357 +Ref: library/os os POSIX_FADV_SEQUENTIAL9270388 +Ref: 2b689270388 +Ref: library/os os POSIX_FADV_RANDOM9270423 +Ref: 2b699270423 +Ref: library/os os POSIX_FADV_NOREUSE9270454 +Ref: 2b6a9270454 +Ref: library/os os POSIX_FADV_WILLNEED9270486 +Ref: 2b6b9270486 +Ref: library/os os POSIX_FADV_DONTNEED9270519 +Ref: 2b6c9270519 +Ref: library/os os pread9270756 +Ref: b5f9270756 +Ref: library/os os posix_openpt9271148 +Ref: 16829271148 +Ref: library/os os preadv9271745 +Ref: b5d9271745 +Ref: library/os os RWF_NOWAIT9272790 +Ref: 2b6e9272790 +Ref: library/os os RWF_HIPRI9273294 +Ref: 2b6d9273294 +Ref: library/os os ptsname9273687 +Ref: 16859273687 +Ref: library/os os pwrite9274229 +Ref: b629274229 +Ref: library/os os pwritev9274518 +Ref: b609274518 +Ref: library/os os RWF_DSYNC9275562 +Ref: 2b6f9275562 +Ref: library/os os RWF_SYNC9275841 +Ref: 2b709275841 +Ref: library/os os RWF_APPEND9276118 +Ref: 19469276118 +Ref: library/os os read9276675 +Ref: d949276675 +Ref: library/os os sendfile9277619 +Ref: b0f9277619 +Ref: library/os os SF_NODISKIO9279126 +Ref: 2b719279126 +Ref: library/os os SF_MNOWAIT9279151 +Ref: 2b729279151 +Ref: library/os os SF_SYNC9279175 +Ref: 2b739279175 +Ref: library/os os SF_NOCACHE9279373 +Ref: 2b749279373 +Ref: library/os os set_blocking9279657 +Ref: e399279657 +Ref: library/os os splice9280262 +Ref: 8159280262 +Ref: library/os os SPLICE_F_MOVE9281682 +Ref: 2b759281682 +Ref: library/os os SPLICE_F_NONBLOCK9281709 +Ref: 2b769281709 +Ref: library/os os SPLICE_F_MORE9281740 +Ref: 2b779281740 +Ref: library/os os readv9281797 +Ref: b5e9281797 +Ref: library/os os tcgetpgrp9282418 +Ref: 2b789282418 +Ref: library/os os tcsetpgrp9282646 +Ref: 2b799282646 +Ref: library/os os ttyname9282888 +Ref: 2b7a9282888 +Ref: library/os os unlockpt9283142 +Ref: 16849283142 +Ref: library/os os write9283518 +Ref: d9a9283518 +Ref: library/os os writev9284369 +Ref: b619284369 +Ref: File Descriptor Operations-Footnote-19285068 +Ref: File Descriptor Operations-Footnote-29285110 +Ref: File Descriptor Operations-Footnote-39285154 +Ref: File Descriptor Operations-Footnote-49285217 +Ref: File Descriptor Operations-Footnote-59285259 +Node: Querying the size of a terminal9285301 +Ref: library/os querying-the-size-of-a-terminal9285435 +Ref: 2b7b9285435 +Ref: library/os terminal-size9285435 +Ref: 2b7c9285435 +Ref: library/os os get_terminal_size9285541 +Ref: 10f69285541 +Ref: library/os os terminal_size9286182 +Ref: 28839286182 +Ref: library/os os terminal_size columns9286303 +Ref: 2b7d9286303 +Ref: library/os os terminal_size lines9286387 +Ref: 2b7e9286387 +Node: Inheritance of File Descriptors9286470 +Ref: library/os fd-inheritance9286604 +Ref: ef49286604 +Ref: library/os inheritance-of-file-descriptors9286604 +Ref: 2b7f9286604 +Ref: library/os os get_inheritable9287636 +Ref: ef59287636 +Ref: library/os os set_inheritable9287766 +Ref: ef69287766 +Ref: library/os os get_handle_inheritable9287892 +Ref: ef79287892 +Ref: library/os os set_handle_inheritable9288061 +Ref: ef89288061 +Node: Files and Directories9288231 +Ref: library/os files-and-directories9288399 +Ref: 2b809288399 +Ref: library/os os-file-dir9288399 +Ref: 2b149288399 +Ref: library/os path-fd9288548 +Ref: b5c9288548 +Ref: library/os dir-fd9289493 +Ref: 10df9289493 +Ref: library/os follow-symlinks9290209 +Ref: 10e09290209 +Ref: library/os os access9290793 +Ref: 10e19290793 +Ref: library/os os F_OK9293355 +Ref: 2b819293355 +Ref: library/os os R_OK9293373 +Ref: 2b829293373 +Ref: library/os os W_OK9293391 +Ref: 2b839293391 +Ref: library/os os X_OK9293409 +Ref: 2b849293409 +Ref: library/os os chdir9293599 +Ref: 6099293599 +Ref: library/os os chflags9294277 +Ref: 10e29294277 +Ref: library/os os chmod9295366 +Ref: 21d9295366 +Ref: library/os os chown9297444 +Ref: 10e39297444 +Ref: library/os os chroot9298454 +Ref: 19929298454 +Ref: library/os os fchdir9298683 +Ref: d889298683 +Ref: library/os os getcwd9299088 +Ref: 159b9299088 +Ref: library/os os getcwdb9299182 +Ref: a919299182 +Ref: library/os os lchflags9299490 +Ref: 2b869299490 +Ref: library/os os lchmod9299981 +Ref: 21c9299981 +Ref: library/os os lchown9300815 +Ref: 2b879300815 +Ref: library/os os link9301328 +Ref: 10e49301328 +Ref: library/os os listdir9302115 +Ref: 10ee9302115 +Ref: library/os os listdrives9303596 +Ref: 4999303596 +Ref: library/os os listmounts9304229 +Ref: 49b9304229 +Ref: library/os os listvolumes9305070 +Ref: 49a9305070 +Ref: library/os os lstat9305790 +Ref: 49d9305790 +Ref: library/os os mkdir9306901 +Ref: 21f9306901 +Ref: library/os mkdir-modebits9307203 +Ref: 2b889307203 +Ref: library/os os makedirs9308365 +Ref: 2209308365 +Ref: library/os os mkfifo9310095 +Ref: d8f9310095 +Ref: library/os os mknod9311004 +Ref: d909311004 +Ref: library/os os major9311897 +Ref: 161a9311897 +Ref: library/os os minor9312068 +Ref: 161b9312068 +Ref: library/os os makedev9312239 +Ref: 161c9312239 +Ref: library/os os pathconf9312363 +Ref: 10ef9312363 +Ref: library/os os pathconf_names9313461 +Ref: 2b8a9313461 +Ref: library/os os readlink9313785 +Ref: 91f9313785 +Ref: library/os os remove9315267 +Ref: 10e59315267 +Ref: library/os os removedirs9316202 +Ref: 2b8b9316202 +Ref: library/os os rename9317046 +Ref: 10e69317046 +Ref: library/os os renames9318716 +Ref: 2b8c9318716 +Ref: library/os os replace9319505 +Ref: 10e79319505 +Ref: library/os os rmdir9320387 +Ref: 10e89320387 +Ref: library/os os scandir9321033 +Ref: a5e9321033 +Ref: library/os os scandir close9322811 +Ref: cbc9322811 +Ref: library/os os DirEntry9324348 +Ref: 4979324348 +Ref: library/os os DirEntry name9325533 +Ref: 2b8e9325533 +Ref: library/os os DirEntry path9325904 +Ref: 167c9325904 +Ref: library/os os DirEntry inode9326639 +Ref: 16d99326639 +Ref: library/os os DirEntry is_dir9326998 +Ref: 2b8d9326998 +Ref: library/os os DirEntry is_file9328433 +Ref: d839328433 +Ref: library/os os DirEntry is_symlink9329156 +Ref: 2b8f9329156 +Ref: library/os os DirEntry is_junction9330007 +Ref: 4989330007 +Ref: library/os os DirEntry stat9330442 +Ref: 16fa9330442 +Ref: library/os os stat9332184 +Ref: 49c9332184 +Ref: library/os os stat_result9334772 +Ref: 148a9334772 +Ref: library/os os stat_result st_mode9335022 +Ref: 2b909335022 +Ref: library/os os stat_result st_ino9335117 +Ref: 2b919335117 +Ref: library/os os stat_result st_dev9335366 +Ref: 2b929335366 +Ref: library/os os stat_result st_nlink9335458 +Ref: 2b939335458 +Ref: library/os os stat_result st_uid9335521 +Ref: 2b949335521 +Ref: library/os os stat_result st_gid9335595 +Ref: 2b959335595 +Ref: library/os os stat_result st_size9335670 +Ref: 2b969335670 +Ref: library/os os stat_result st_atime9335924 +Ref: 2b979335924 +Ref: library/os os stat_result st_mtime9336014 +Ref: 2a2a9336014 +Ref: library/os os stat_result st_ctime9336118 +Ref: 2b989336118 +Ref: library/os os stat_result st_atime_ns9336488 +Ref: 2b999336488 +Ref: library/os os stat_result st_mtime_ns9336642 +Ref: 2b9a9336642 +Ref: library/os os stat_result st_ctime_ns9336810 +Ref: 2b9b9336810 +Ref: library/os os stat_result st_birthtime9337250 +Ref: 2b9c9337250 +Ref: library/os os stat_result st_birthtime_ns9337525 +Ref: 2b9d9337525 +Ref: library/os os stat_result st_blocks9339111 +Ref: 2b9e9339111 +Ref: library/os os stat_result st_blksize9339285 +Ref: 2b9f9339285 +Ref: library/os os stat_result st_rdev9339487 +Ref: 2ba09339487 +Ref: library/os os stat_result st_flags9339562 +Ref: 2ba19339562 +Ref: library/os os stat_result st_gen9339787 +Ref: 2ba29339787 +Ref: library/os os stat_result st_fstype9339937 +Ref: b649339937 +Ref: library/os os stat_result st_rsize9340144 +Ref: 2ba39340144 +Ref: library/os os stat_result st_creator9340208 +Ref: 2ba49340208 +Ref: library/os os stat_result st_type9340272 +Ref: 2ba59340272 +Ref: library/os os stat_result st_file_attributes9340394 +Ref: e379340394 +Ref: library/os os stat_result st_reparse_tag9340774 +Ref: 2ba69340774 +Ref: library/os os statvfs9343153 +Ref: 10f09343153 +Ref: library/os os supports_dir_fd9345198 +Ref: 10ec9345198 +Ref: library/os os supports_effective_ids9346359 +Ref: 10f29346359 +Ref: library/os os supports_fd9347102 +Ref: 10f19347102 +Ref: library/os os supports_follow_symlinks9347926 +Ref: 286e9347926 +Ref: library/os os symlink9349062 +Ref: 10e99349062 +Ref: library/os os sync9350827 +Ref: 11069350827 +Ref: library/os os truncate9350961 +Ref: e3b9350961 +Ref: library/os os unlink9351485 +Ref: 10ea9351485 +Ref: library/os os utime9352022 +Ref: 10eb9352022 +Ref: library/os os walk9353906 +Ref: 4a59353906 +Ref: library/os os fwalk9359195 +Ref: b5b9359195 +Ref: library/os os memfd_create9361831 +Ref: a0a9361831 +Ref: library/os os MFD_CLOEXEC9362690 +Ref: 2ba79362690 +Ref: library/os os MFD_ALLOW_SEALING9362715 +Ref: 2ba89362715 +Ref: library/os os MFD_HUGETLB9362746 +Ref: 2ba99362746 +Ref: library/os os MFD_HUGE_SHIFT9362771 +Ref: 2baa9362771 +Ref: library/os os MFD_HUGE_MASK9362799 +Ref: 2bab9362799 +Ref: library/os os MFD_HUGE_64KB9362826 +Ref: 2bac9362826 +Ref: library/os os MFD_HUGE_512KB9362853 +Ref: 2bad9362853 +Ref: library/os os MFD_HUGE_1MB9362881 +Ref: 2bae9362881 +Ref: library/os os MFD_HUGE_2MB9362907 +Ref: 2baf9362907 +Ref: library/os os MFD_HUGE_8MB9362933 +Ref: 2bb09362933 +Ref: library/os os MFD_HUGE_16MB9362959 +Ref: 2bb19362959 +Ref: library/os os MFD_HUGE_32MB9362986 +Ref: 2bb29362986 +Ref: library/os os MFD_HUGE_256MB9363013 +Ref: 2bb39363013 +Ref: library/os os MFD_HUGE_512MB9363041 +Ref: 2bb49363041 +Ref: library/os os MFD_HUGE_1GB9363069 +Ref: 2bb59363069 +Ref: library/os os MFD_HUGE_2GB9363095 +Ref: 2bb69363095 +Ref: library/os os MFD_HUGE_16GB9363121 +Ref: 2bb79363121 +Ref: library/os os eventfd9363374 +Ref: 8149363374 +Ref: library/os os eventfd_read9365387 +Ref: 2bb99365387 +Ref: library/os os eventfd_write9365676 +Ref: 2bba9365676 +Ref: library/os os EFD_CLOEXEC9365977 +Ref: 17ce9365977 +Ref: library/os os EFD_NONBLOCK9366162 +Ref: 17cf9366162 +Ref: library/os os EFD_SEMAPHORE9366364 +Ref: 17d09366364 +Ref: Files and Directories-Footnote-19366732 +Ref: Files and Directories-Footnote-29366778 +Ref: Files and Directories-Footnote-39366820 +Ref: Files and Directories-Footnote-49366885 +Ref: Files and Directories-Footnote-59366965 +Ref: Files and Directories-Footnote-69367047 +Ref: Files and Directories-Footnote-79367136 +Ref: Files and Directories-Footnote-89367225 +Ref: Files and Directories-Footnote-99367283 +Node: Timer File Descriptors9367330 +Ref: library/os os-timerfd9367444 +Ref: 1539367444 +Ref: library/os timer-file-descriptors9367444 +Ref: 2bbb9367444 +Ref: library/os os timerfd_create9367658 +Ref: 2139367658 +Ref: library/os os timerfd_settime9370346 +Ref: 2149370346 +Ref: library/os os timerfd_settime_ns9373058 +Ref: 2159373058 +Ref: library/os os timerfd_gettime9373411 +Ref: 2169373411 +Ref: library/os os timerfd_gettime_ns9374003 +Ref: 2179374003 +Ref: library/os os TFD_NONBLOCK9374228 +Ref: 2189374228 +Ref: library/os os TFD_CLOEXEC9374589 +Ref: 2199374589 +Ref: library/os os TFD_TIMER_ABSTIME9374874 +Ref: 21a9374874 +Ref: library/os os TFD_TIMER_CANCEL_ON_SET9375261 +Ref: 21b9375261 +Ref: Timer File Descriptors-Footnote-19375672 +Ref: Timer File Descriptors-Footnote-29375726 +Ref: Timer File Descriptors-Footnote-39375780 +Ref: Timer File Descriptors-Footnote-49375835 +Ref: Timer File Descriptors-Footnote-59375887 +Ref: Timer File Descriptors-Footnote-69375940 +Ref: Timer File Descriptors-Footnote-79375984 +Node: Linux extended attributes9376039 +Ref: library/os linux-extended-attributes9376153 +Ref: 2bbd9376153 +Ref: library/os os getxattr9376299 +Ref: 10f89376299 +Ref: library/os os listxattr9376960 +Ref: 10f99376960 +Ref: library/os os removexattr9377570 +Ref: 10fa9377570 +Ref: library/os os setxattr9378262 +Ref: 10fb9378262 +Ref: library/os os XATTR_SIZE_MAX9379508 +Ref: 2bc09379508 +Ref: library/os os XATTR_CREATE9379644 +Ref: 2bbf9379644 +Ref: library/os os XATTR_REPLACE9379816 +Ref: 2bbe9379816 +Node: Process Management9379999 +Ref: library/os os-process9380167 +Ref: 2bc19380167 +Ref: library/os process-management9380167 +Ref: 2bc29380167 +Ref: library/os os abort9380782 +Ref: 2bc49380782 +Ref: library/os os add_dll_directory9381158 +Ref: 9e99381158 +Ref: library/os os execl9382322 +Ref: 2bc39382322 +Ref: library/os os execle9382369 +Ref: 2bc59382369 +Ref: library/os os execlp9382422 +Ref: 2bc69382422 +Ref: library/os os execlpe9382470 +Ref: 2bc79382470 +Ref: library/os os execv9382524 +Ref: 2b249382524 +Ref: library/os os execve9382560 +Ref: 10ed9382560 +Ref: library/os os execvp9382602 +Ref: 2bc89382602 +Ref: library/os os execvpe9382639 +Ref: 2bc99382639 +Ref: library/os os _exit9386019 +Ref: 22989386019 +Ref: library/os os EX_OK9386765 +Ref: 2bca9386765 +Ref: library/os os EX_USAGE9386999 +Ref: 2bcb9386999 +Ref: library/os os EX_DATAERR9387191 +Ref: 2bcc9387191 +Ref: library/os os EX_NOINPUT9387322 +Ref: 2bcd9387322 +Ref: library/os os EX_NOUSER9387477 +Ref: 2bce9387477 +Ref: library/os os EX_NOHOST9387609 +Ref: 2bcf9387609 +Ref: library/os os EX_UNAVAILABLE9387741 +Ref: 2bd09387741 +Ref: library/os os EX_SOFTWARE9387886 +Ref: 2bd19387886 +Ref: library/os os EX_OSERR9388029 +Ref: 2bd29388029 +Ref: library/os os EX_OSFILE9388221 +Ref: 2bd39388221 +Ref: library/os os EX_CANTCREAT9388412 +Ref: 2bd49388412 +Ref: library/os os EX_IOERR9388571 +Ref: 2bd59388571 +Ref: library/os os EX_TEMPFAIL9388728 +Ref: 2bd69388728 +Ref: library/os os EX_PROTOCOL9389012 +Ref: 2bd79389012 +Ref: library/os os EX_NOPERM9389185 +Ref: 2bd89389185 +Ref: library/os os EX_CONFIG9389401 +Ref: 2bd99389401 +Ref: library/os os EX_NOTFOUND9389554 +Ref: 2bda9389554 +Ref: library/os os fork9389701 +Ref: 1979389701 +Ref: library/os os forkpty9391707 +Ref: 1989391707 +Ref: library/os os kill9392854 +Ref: 13539392854 +Ref: library/os os killpg9393729 +Ref: 19d59393729 +Ref: library/os os nice9393987 +Ref: 10f59393987 +Ref: library/os os pidfd_open9394162 +Ref: 4769394162 +Ref: library/os os PIDFD_NONBLOCK9394573 +Ref: 4969394573 +Ref: library/os os plock9395024 +Ref: 2bdb9395024 +Ref: library/os os popen9395249 +Ref: a879395249 +Ref: library/os os posix_spawn9397189 +Ref: 2229397189 +Ref: library/os os POSIX_SPAWN_OPEN9398291 +Ref: 2bdc9398291 +Ref: library/os os POSIX_SPAWN_CLOSE9398464 +Ref: 2bdd9398464 +Ref: library/os os POSIX_SPAWN_DUP29398587 +Ref: 2bde9398587 +Ref: library/os os POSIX_SPAWN_CLOSEFROM9398725 +Ref: 2239398725 +Ref: library/os os posix_spawnp9401631 +Ref: 1a2e9401631 +Ref: library/os os register_at_fork9402390 +Ref: 2fa9402390 +Ref: library/os os spawnl9403839 +Ref: 17319403839 +Ref: library/os os spawnle9403881 +Ref: 2bdf9403881 +Ref: library/os os spawnlp9403929 +Ref: 2be09403929 +Ref: library/os os spawnlpe9403972 +Ref: 2be19403972 +Ref: library/os os spawnv9404021 +Ref: 2be29404021 +Ref: library/os os spawnve9404064 +Ref: 2be39404064 +Ref: library/os os spawnvp9404113 +Ref: 2be49404113 +Ref: library/os os spawnvpe9404157 +Ref: 2be59404157 +Ref: library/os os P_NOWAIT9408071 +Ref: 2be69408071 +Ref: library/os os P_NOWAITO9408093 +Ref: 2be89408093 +Ref: library/os os P_WAIT9408444 +Ref: 2be79408444 +Ref: library/os os P_DETACH9408866 +Ref: 2be99408866 +Ref: library/os os P_OVERLAY9408888 +Ref: 2bea9408888 +Ref: library/os os startfile9409380 +Ref: 18cb9409380 +Ref: library/os os system9411971 +Ref: 14269411971 +Ref: library/os os times9413726 +Ref: 11099413726 +Ref: library/os os wait9414734 +Ref: d979414734 +Ref: library/os os waitid9415644 +Ref: d989415644 +Ref: library/os os waitpid9417081 +Ref: d999417081 +Ref: library/os os wait39419447 +Ref: d959419447 +Ref: library/os os wait49420075 +Ref: d969420075 +Ref: library/os os P_PID9420666 +Ref: 2beb9420666 +Ref: library/os os P_PGID9420685 +Ref: 2bec9420685 +Ref: library/os os P_ALL9420705 +Ref: 2bed9420705 +Ref: library/os os P_PIDFD9420724 +Ref: 9199420724 +Ref: library/os os WCONTINUED9421457 +Ref: 2bf09421457 +Ref: library/os os WEXITED9421806 +Ref: 2bee9421806 +Ref: library/os os WSTOPPED9422173 +Ref: 2bef9422173 +Ref: library/os os WUNTRACED9422513 +Ref: 2bf59422513 +Ref: library/os os WNOHANG9422919 +Ref: 2bf19422919 +Ref: library/os os WNOWAIT9423216 +Ref: 2bf29423216 +Ref: library/os os CLD_EXITED9423580 +Ref: 2bf49423580 +Ref: library/os os CLD_KILLED9423604 +Ref: 9179423604 +Ref: library/os os CLD_DUMPED9423628 +Ref: 2bf69423628 +Ref: library/os os CLD_TRAPPED9423652 +Ref: 2bf79423652 +Ref: library/os os CLD_STOPPED9423677 +Ref: 9189423677 +Ref: library/os os CLD_CONTINUED9423702 +Ref: 2bf89423702 +Ref: library/os os waitstatus_to_exitcode9424035 +Ref: 91c9424035 +Ref: library/os os WCOREDUMP9425541 +Ref: 2bff9425541 +Ref: library/os os WIFCONTINUED9425845 +Ref: 2c009425845 +Ref: library/os os WIFSTOPPED9426195 +Ref: 2bfd9426195 +Ref: library/os os WIFSIGNALED9426622 +Ref: 2bfb9426622 +Ref: library/os os WIFEXITED9426834 +Ref: 2bf99426834 +Ref: library/os os WEXITSTATUS9427135 +Ref: 2bfa9427135 +Ref: library/os os WSTOPSIG9427369 +Ref: 2bfe9427369 +Ref: library/os os WTERMSIG9427621 +Ref: 2bfc9427621 +Ref: Process Management-Footnote-19427933 +Ref: Process Management-Footnote-29428005 +Ref: Process Management-Footnote-39428048 +Ref: Process Management-Footnote-49428098 +Ref: Process Management-Footnote-59428144 +Ref: Process Management-Footnote-69428189 +Ref: Process Management-Footnote-79428241 +Ref: Process Management-Footnote-89428350 +Ref: Process Management-Footnote-99428392 +Node: Interface to the scheduler9428438 +Ref: library/os interface-to-the-scheduler9428617 +Ref: 2c029428617 +Ref: library/os os-scheduling-policy9429004 +Ref: 2c039429004 +Ref: library/os os SCHED_OTHER9429004 +Ref: 2c049429004 +Ref: library/os os SCHED_BATCH9429067 +Ref: 2c059429067 +Ref: library/os os SCHED_IDLE9429216 +Ref: 2c069429216 +Ref: library/os os SCHED_SPORADIC9429310 +Ref: 2c079429310 +Ref: library/os os SCHED_FIFO9429393 +Ref: 2c089429393 +Ref: library/os os SCHED_RR9429464 +Ref: 2c099429464 +Ref: library/os os SCHED_RESET_ON_FORK9429526 +Ref: 2c0a9429526 +Ref: library/os os sched_param9429748 +Ref: 15a39429748 +Ref: library/os os sched_param sched_priority9430043 +Ref: 2c0b9430043 +Ref: library/os os sched_get_priority_min9430139 +Ref: 10fd9430139 +Ref: library/os os sched_get_priority_max9430304 +Ref: 10fc9430304 +Ref: library/os os sched_setscheduler9430469 +Ref: 11049430469 +Ref: library/os os sched_getscheduler9430758 +Ref: 11009430758 +Ref: library/os os sched_setparam9430983 +Ref: 11039430983 +Ref: library/os os sched_getparam9431200 +Ref: 10ff9431200 +Ref: library/os os sched_rr_get_interval9431403 +Ref: 11019431403 +Ref: library/os os sched_yield9431578 +Ref: 11059431578 +Ref: library/os os sched_setaffinity9431695 +Ref: 11029431695 +Ref: library/os os sched_getaffinity9431961 +Ref: 10fe9431961 +Ref: Interface to the scheduler-Footnote-19432289 +Node: Miscellaneous System Information9432340 +Ref: library/os miscellaneous-system-information9432518 +Ref: 2c0c9432518 +Ref: library/os os-path9432518 +Ref: 2c0d9432518 +Ref: library/os os confstr9432605 +Ref: 156a9432605 +Ref: library/os os confstr_names9433644 +Ref: 2c0e9433644 +Ref: library/os os cpu_count9433937 +Ref: 1c59433937 +Ref: library/os os getloadavg9434433 +Ref: 15e79434433 +Ref: library/os os process_cpu_count9434687 +Ref: 1c49434687 +Ref: library/os os sysconf9435302 +Ref: 156b9435302 +Ref: library/os os sysconf_names9435726 +Ref: 2c0f9435726 +Ref: library/os os curdir9436282 +Ref: 27e49436282 +Ref: library/os os pardir9436483 +Ref: 2b899436483 +Ref: library/os os sep9436684 +Ref: 6669436684 +Ref: library/os os altsep9437096 +Ref: 6679437096 +Ref: library/os os extsep9437395 +Ref: 2c109437395 +Ref: library/os os pathsep9437582 +Ref: 1d449437582 +Ref: library/os os defpath9437826 +Ref: 1a019437826 +Ref: library/os os linesep9438035 +Ref: 217b9438035 +Ref: library/os os devnull9438448 +Ref: 1a329438448 +Ref: library/os os RTLD_LAZY9438622 +Ref: 110c9438622 +Ref: library/os os RTLD_NOW9438645 +Ref: 110d9438645 +Ref: library/os os RTLD_GLOBAL9438667 +Ref: 110e9438667 +Ref: library/os os RTLD_LOCAL9438692 +Ref: 110f9438692 +Ref: library/os os RTLD_NODELETE9438716 +Ref: 11109438716 +Ref: library/os os RTLD_NOLOAD9438743 +Ref: 11119438743 +Ref: library/os os RTLD_DEEPBIND9438768 +Ref: 11129438768 +Ref: Miscellaneous System Information-Footnote-19439054 +Node: Random numbers<2>9439100 +Ref: library/os random-numbers9439243 +Ref: 2c119439243 +Ref: library/os os getrandom9439294 +Ref: cbd9439294 +Ref: library/os os urandom9440124 +Ref: 51e9440124 +Ref: library/os os GRND_NONBLOCK9442189 +Ref: 2c139442189 +Ref: library/os os GRND_RANDOM9442665 +Ref: 2c129442665 +Ref: Random numbers<2>-Footnote-19442886 +Ref: Random numbers<2>-Footnote-29442949 +Node: io — Core tools for working with streams9442991 +Ref: library/io doc9443205 +Ref: 2c149443205 +Ref: library/io io-core-tools-for-working-with-streams9443205 +Ref: 2c159443205 +Ref: library/io module-io9443205 +Ref: 7f9443205 +Ref: io — Core tools for working with streams-Footnote-19443581 +Node: Overview<2>9443643 +Ref: library/io io-overview9443755 +Ref: 21799443755 +Ref: library/io overview9443755 +Ref: 2c169443755 +Node: Text I/O9445016 +Ref: library/io text-i-o9445091 +Ref: 2c179445091 +Node: Binary I/O9445782 +Ref: library/io binary-i-o9445873 +Ref: 2c189445873 +Node: Raw I/O9446743 +Ref: library/io raw-i-o9446817 +Ref: 2c199446817 +Node: Text Encoding9447271 +Ref: library/io io-text-encoding9447419 +Ref: 7b89447419 +Ref: library/io text-encoding9447419 +Ref: 2c1a9447419 +Ref: Text Encoding-Footnote-19448592 +Node: Opt-in EncodingWarning9448634 +Ref: library/io io-encoding-warning9448706 +Ref: 1d559448706 +Ref: library/io opt-in-encodingwarning9448706 +Ref: 2c1b9448706 +Ref: Opt-in EncodingWarning-Footnote-19449524 +Node: High-level Module Interface9449566 +Ref: library/io high-level-module-interface9449718 +Ref: 2c1c9449718 +Ref: library/io io DEFAULT_BUFFER_SIZE9449793 +Ref: 16c79449793 +Ref: library/io io open9450028 +Ref: 5189450028 +Ref: library/io io open_code9450449 +Ref: 17279450449 +Ref: library/io io text_encoding9451112 +Ref: 16c69451112 +Ref: library/io io BlockingIOError9452246 +Ref: 2c1d9452246 +Ref: library/io io UnsupportedOperation9452378 +Ref: 19959452378 +Node: Class hierarchy9452725 +Ref: library/io class-hierarchy9452878 +Ref: 2c1e9452878 +Node: I/O Base Classes9457579 +Ref: library/io i-o-base-classes9457668 +Ref: 2c209457668 +Ref: library/io io IOBase9457721 +Ref: 1f79457721 +Ref: library/io io IOBase close9459568 +Ref: 1f89459568 +Ref: library/io io IOBase closed9459978 +Ref: 1a2b9459978 +Ref: library/io io IOBase fileno9460053 +Ref: 28569460053 +Ref: library/io io IOBase flush9460274 +Ref: 2c219460274 +Ref: library/io io IOBase isatty9460434 +Ref: 1c829460434 +Ref: library/io io IOBase readable9460574 +Ref: 2c229460574 +Ref: library/io io IOBase readline9460736 +Ref: 131c9460736 +Ref: library/io io IOBase readlines9461108 +Ref: 23339461108 +Ref: library/io io IOBase seek9461672 +Ref: 127f9461672 +Ref: library/io io IOBase seekable9462652 +Ref: 2c239462652 +Ref: library/io io IOBase tell9462885 +Ref: 29b69462885 +Ref: library/io io IOBase truncate9462958 +Ref: 13049462958 +Ref: library/io io IOBase writable9463536 +Ref: 2c249463536 +Ref: library/io io IOBase writelines9463737 +Ref: 23349463737 +Ref: library/io io IOBase __del__9463960 +Ref: 2c259463960 +Ref: library/io io RawIOBase9464177 +Ref: 10c69464177 +Ref: library/io io RawIOBase read9464683 +Ref: e1b9464683 +Ref: library/io io RawIOBase readall9465367 +Ref: 2c269465367 +Ref: library/io io RawIOBase readinto9465523 +Ref: e1c9465523 +Ref: library/io io RawIOBase write9465864 +Ref: 29f59465864 +Ref: library/io io BufferedIOBase9466503 +Ref: 6909466503 +Ref: library/io io BufferedIOBase raw9467718 +Ref: 2c289467718 +Ref: library/io io BufferedIOBase detach9467989 +Ref: 297d9467989 +Ref: library/io io BufferedIOBase read9468425 +Ref: 131b9468425 +Ref: library/io io BufferedIOBase read19469710 +Ref: 296d9469710 +Ref: library/io io BufferedIOBase readinto9470298 +Ref: 2c279470298 +Ref: library/io io BufferedIOBase readinto19470833 +Ref: e1a9470833 +Ref: library/io io BufferedIOBase write9471331 +Ref: cdb9471331 +Ref: I/O Base Classes-Footnote-19472188 +Ref: I/O Base Classes-Footnote-29472230 +Node: Raw File I/O9472272 +Ref: library/io raw-file-i-o9472386 +Ref: 2c299472386 +Ref: library/io io FileIO9472433 +Ref: 13039472433 +Ref: library/io io FileIO mode9474751 +Ref: 2c2a9474751 +Ref: library/io io FileIO name9474826 +Ref: 29879474826 +Node: Buffered Streams9474971 +Ref: library/io buffered-streams9475080 +Ref: 2c2b9475080 +Ref: library/io io BytesIO9475226 +Ref: e9d9475226 +Ref: library/io io BytesIO getbuffer9475707 +Ref: 11e39475707 +Ref: library/io io BytesIO getvalue9476276 +Ref: 296b9476276 +Ref: library/io io BytesIO read19476398 +Ref: 2c2c9476398 +Ref: library/io io BytesIO readinto19476581 +Ref: 2c2d9476581 +Ref: library/io io BufferedReader9476737 +Ref: 12009476737 +Ref: library/io io BufferedReader peek9477577 +Ref: 2c2e9477577 +Ref: library/io io BufferedReader read9477877 +Ref: 2c2f9477877 +Ref: library/io io BufferedReader read19478023 +Ref: 2c309478023 +Ref: library/io io BufferedWriter9478243 +Ref: 15499478243 +Ref: library/io io BufferedWriter flush9479363 +Ref: 2c319479363 +Ref: library/io io BufferedWriter write9479548 +Ref: 2c329479548 +Ref: library/io io BufferedRandom9479906 +Ref: 154a9479906 +Ref: library/io io BufferedRWPair9480608 +Ref: 2c1f9480608 +Node: Text I/O<2>9481548 +Ref: library/io id19481636 +Ref: 2c339481636 +Ref: library/io io TextIOBase9481675 +Ref: 6919481675 +Ref: library/io io TextIOBase encoding9481991 +Ref: 2c349481991 +Ref: library/io io TextIOBase errors9482151 +Ref: 13029482151 +Ref: library/io io TextIOBase newlines9482235 +Ref: 2c359482235 +Ref: library/io io TextIOBase buffer9482479 +Ref: 12959482479 +Ref: library/io io TextIOBase detach9482778 +Ref: 2c369482778 +Ref: library/io io TextIOBase read9483295 +Ref: 1c859483295 +Ref: library/io io TextIOBase readline9483503 +Ref: 1cbd9483503 +Ref: library/io io TextIOBase seek9483773 +Ref: 2c379483773 +Ref: library/io io TextIOBase tell9484746 +Ref: 2c389484746 +Ref: library/io io TextIOBase write9484950 +Ref: 1c749484950 +Ref: library/io io TextIOWrapper9485082 +Ref: 7b69485082 +Ref: library/io io TextIOWrapper line_buffering9488940 +Ref: 2c399488940 +Ref: library/io io TextIOWrapper write_through9489022 +Ref: 2c3a9489022 +Ref: library/io io TextIOWrapper reconfigure9489182 +Ref: b499489182 +Ref: library/io io TextIOWrapper seek9490072 +Ref: 2c3b9490072 +Ref: library/io io TextIOWrapper tell9490993 +Ref: 2c3c9490993 +Ref: library/io io StringIO9491216 +Ref: f229491216 +Ref: library/io io StringIO getvalue9492381 +Ref: 2c3d9492381 +Ref: library/io io IncrementalNewlineDecoder9493036 +Ref: 16c89493036 +Node: Performance<3>9493223 +Ref: library/io performance9493340 +Ref: 2c3e9493340 +Node: Binary I/O<2>9493589 +Ref: library/io id29493673 +Ref: 2c3f9493673 +Node: Text I/O<3>9494325 +Ref: library/io id39494436 +Ref: 2c409494436 +Node: Multi-threading<3>9494999 +Ref: library/io multi-threading9495107 +Ref: 2c419495107 +Ref: Multi-threading<3>-Footnote-19495681 +Node: Reentrancy9495725 +Ref: library/io reentrancy9495813 +Ref: 2c429495813 +Node: time — Time access and conversions9496606 +Ref: library/time doc9496811 +Ref: 2c439496811 +Ref: library/time module-time9496811 +Ref: ee9496811 +Ref: library/time time-time-access-and-conversions9496811 +Ref: 2c449496811 +Ref: library/time epoch9497513 +Ref: 2a299497513 +Ref: time — Time access and conversions-Footnote-19501988 +Ref: time — Time access and conversions-Footnote-29502038 +Ref: time — Time access and conversions-Footnote-39502103 +Node: Functions<5>9502161 +Ref: library/time functions9502273 +Ref: 2c479502273 +Ref: library/time time-functions9502273 +Ref: 2c489502273 +Ref: library/time time asctime9502312 +Ref: 11d99502312 +Ref: library/time time pthread_getcpuclockid9502983 +Ref: b929502983 +Ref: library/time time clock_getres9503600 +Ref: 11519503600 +Ref: library/time time clock_gettime9503877 +Ref: 11529503877 +Ref: library/time time clock_gettime_ns9504259 +Ref: ae29504259 +Ref: library/time time clock_settime9504462 +Ref: 11539504462 +Ref: library/time time clock_settime_ns9504856 +Ref: ae39504856 +Ref: library/time time ctime9505084 +Ref: 245a9505084 +Ref: library/time time get_clock_info9505664 +Ref: 11509505664 +Ref: library/time time gmtime9506797 +Ref: 11b29506797 +Ref: library/time time localtime9507289 +Ref: 14c49507289 +Ref: library/time time mktime9507934 +Ref: 11da9507934 +Ref: library/time time monotonic9508644 +Ref: 2559508644 +Ref: library/time time monotonic_ns9509734 +Ref: ae49509734 +Ref: library/time time perf_counter9509878 +Ref: a889509878 +Ref: library/time time perf_counter_ns9510813 +Ref: ae59510813 +Ref: library/time time process_time9510968 +Ref: a899510968 +Ref: library/time time process_time_ns9511497 +Ref: ae69511497 +Ref: library/time time sleep9511652 +Ref: 6999511652 +Ref: library/time time strftime9513752 +Ref: 11db9513752 +Ref: library/time leap-second9521206 +Ref: 2c4a9521206 +Ref: library/time time strptime9522410 +Ref: 13f89522410 +Ref: library/time time struct_time9524113 +Ref: cea9524113 +Ref: library/time time struct_time tm_year9524757 +Ref: 14c39524757 +Ref: library/time time struct_time tm_mon9525021 +Ref: 2c4b9525021 +Ref: library/time time struct_time tm_mday9525281 +Ref: 2c4c9525281 +Ref: library/time time struct_time tm_hour9525540 +Ref: 2c4d9525540 +Ref: library/time time struct_time tm_min9525798 +Ref: 2c4e9525798 +Ref: library/time time struct_time tm_sec9526057 +Ref: 2c4f9526057 +Ref: library/time time struct_time tm_wday9526533 +Ref: 2c509526533 +Ref: library/time time struct_time tm_yday9526804 +Ref: 2c519526804 +Ref: library/time time struct_time tm_isdst9527065 +Ref: 246b9527065 +Ref: library/time time struct_time tm_zone9527331 +Ref: 2c469527331 +Ref: library/time time struct_time tm_gmtoff9527608 +Ref: 2c459527608 +Ref: library/time time time9528285 +Ref: 2569528285 +Ref: library/time time time_ns9529858 +Ref: ae79529858 +Ref: library/time time thread_time9530047 +Ref: 9369530047 +Ref: library/time time thread_time_ns9530716 +Ref: b919530716 +Ref: library/time time tzset9530869 +Ref: 2c529530869 +Ref: Functions<5>-Footnote-19534782 +Ref: Functions<5>-Footnote-29534843 +Ref: Functions<5>-Footnote-39534935 +Ref: Functions<5>-Footnote-49534977 +Ref: Functions<5>-Footnote-59535662 +Ref: Functions<5>-Footnote-69536347 +Ref: Functions<5>-Footnote-79536397 +Ref: Functions<5>-Footnote-89536456 +Ref: Functions<5>-Footnote-99537141 +Ref: Functions<5>-Footnote-109537189 +Ref: Functions<5>-Footnote-119537240 +Ref: Functions<5>-Footnote-129537289 +Node: Clock ID Constants9537336 +Ref: library/time clock-id-constants9537475 +Ref: 2c539537475 +Ref: library/time time-clock-id-constants9537475 +Ref: 2bbc9537475 +Ref: library/time time CLOCK_BOOTTIME9537637 +Ref: b8e9537637 +Ref: library/time time CLOCK_HIGHRES9538115 +Ref: 2c549538115 +Ref: library/time time CLOCK_MONOTONIC9538443 +Ref: 6959538443 +Ref: library/time time CLOCK_MONOTONIC_RAW9538647 +Ref: 2c559538647 +Ref: library/time time CLOCK_MONOTONIC_RAW_APPROX9538916 +Ref: 2c569538916 +Ref: library/time time CLOCK_PROCESS_CPUTIME_ID9539178 +Ref: 2c579539178 +Ref: library/time time CLOCK_PROF9539340 +Ref: b8f9539340 +Ref: library/time time CLOCK_TAI9539513 +Ref: 196b9539513 +Ref: library/time time CLOCK_THREAD_CPUTIME_ID9539808 +Ref: 2c589539808 +Ref: library/time time CLOCK_UPTIME9539953 +Ref: b909539953 +Ref: library/time time CLOCK_UPTIME_RAW9540236 +Ref: a429540236 +Ref: library/time time CLOCK_UPTIME_RAW_APPROX9540535 +Ref: 2c599540535 +Ref: library/time time CLOCK_REALTIME9540884 +Ref: 6969540884 +Ref: Clock ID Constants-Footnote-19541141 +Node: Timezone Constants9541268 +Ref: library/time time-timezone-constants9541386 +Ref: 2c5a9541386 +Ref: library/time timezone-constants9541386 +Ref: 2c5b9541386 +Ref: library/time time altzone9541443 +Ref: 2c5c9541443 +Ref: library/time time daylight9541731 +Ref: 2c5d9541731 +Ref: library/time time timezone9541817 +Ref: 2c5e9541817 +Ref: library/time time tzname9542015 +Ref: 2c5f9542015 +Node: logging — Logging facility for Python9543217 +Ref: library/logging doc9543420 +Ref: 2c609543420 +Ref: library/logging logging-logging-facility-for-python9543420 +Ref: 2c619543420 +Ref: library/logging module-logging9543420 +Ref: 879543420 +Ref: logging — Logging facility for Python-Footnote-19546912 +Node: Logger Objects9546989 +Ref: library/logging logger9547102 +Ref: 2c629547102 +Ref: library/logging logger-objects9547102 +Ref: 2c639547102 +Ref: library/logging logging Logger9548256 +Ref: b4f9548256 +Ref: library/logging logging Logger name9548283 +Ref: 2c649548283 +Ref: library/logging logging Logger level9548510 +Ref: 2c659548510 +Ref: library/logging logging Logger parent9548803 +Ref: 2c669548803 +Ref: library/logging logging Logger propagate9549064 +Ref: 145c9549064 +Ref: library/logging logging Logger handlers9551133 +Ref: 2c679551133 +Ref: library/logging logging Logger disabled9551510 +Ref: 2c6a9551510 +Ref: library/logging logging Logger setLevel9551782 +Ref: 145a9551782 +Ref: library/logging logging Logger isEnabledFor9553761 +Ref: 12e99553761 +Ref: library/logging logging Logger getEffectiveLevel9554104 +Ref: 2c6c9554104 +Ref: library/logging logging Logger getChild9554612 +Ref: 12e79554612 +Ref: library/logging logging Logger getChildren9555113 +Ref: 17c79555113 +Ref: library/logging logging Logger debug9555683 +Ref: e299555683 +Ref: library/logging logging Logger info9561142 +Ref: 2c6e9561142 +Ref: library/logging logging Logger warning9561327 +Ref: 17039561327 +Ref: library/logging logging Logger error9561739 +Ref: 2c709561739 +Ref: library/logging logging Logger critical9561926 +Ref: e289561926 +Ref: library/logging logging Logger log9562130 +Ref: e269562130 +Ref: library/logging logging Logger exception9562326 +Ref: e279562326 +Ref: library/logging logging Logger addFilter9562647 +Ref: 2c719562647 +Ref: library/logging logging Logger removeFilter9562746 +Ref: 2c729562746 +Ref: library/logging logging Logger filter9562853 +Ref: 2c739562853 +Ref: library/logging logging Logger addHandler9563290 +Ref: 2c689563290 +Ref: library/logging logging Logger removeHandler9563387 +Ref: 2c699563387 +Ref: library/logging logging Logger findCaller9563492 +Ref: 2c749563492 +Ref: library/logging logging Logger handle9564294 +Ref: 2c759564294 +Ref: library/logging logging Logger makeRecord9564693 +Ref: 2c769564693 +Ref: library/logging logging Logger hasHandlers9564955 +Ref: 2c779564955 +Node: Logging Levels9565576 +Ref: library/logging levels9565713 +Ref: 6569565713 +Ref: library/logging logging-levels9565713 +Ref: 2c789565713 +Ref: library/logging logging NOTSET9566386 +Ref: 2c6b9566386 +Ref: library/logging logging DEBUG9566996 +Ref: 1cf29566996 +Ref: library/logging logging INFO9567331 +Ref: 1cf39567331 +Ref: library/logging logging WARNING9567578 +Ref: 1cf49567578 +Ref: library/logging logging ERROR9568087 +Ref: 1cf59568087 +Ref: library/logging logging CRITICAL9568403 +Ref: 1cf69568403 +Node: Handler Objects9568675 +Ref: library/logging handler9568815 +Ref: 2c799568815 +Ref: library/logging handler-objects9568815 +Ref: 2c7a9568815 +Ref: library/logging logging Handler9569135 +Ref: 145d9569135 +Ref: library/logging logging Handler __init__9569163 +Ref: 2c7b9569163 +Ref: library/logging logging Handler createLock9569458 +Ref: 2c7c9569458 +Ref: library/logging logging Handler acquire9569646 +Ref: 2c7d9569646 +Ref: library/logging logging Handler release9569760 +Ref: 2c7e9569760 +Ref: library/logging logging Handler setLevel9569862 +Ref: 2c7f9569862 +Ref: library/logging logging Handler setFormatter9570446 +Ref: 2c809570446 +Ref: library/logging logging Handler addFilter9570627 +Ref: 2c819570627 +Ref: library/logging logging Handler removeFilter9570727 +Ref: 2c829570727 +Ref: library/logging logging Handler filter9570835 +Ref: 2c839570835 +Ref: library/logging logging Handler flush9571234 +Ref: 2c849571234 +Ref: library/logging logging Handler close9571402 +Ref: 2c859571402 +Ref: library/logging logging Handler handle9571746 +Ref: 2c869571746 +Ref: library/logging logging Handler handleError9572024 +Ref: 2c879572024 +Ref: library/logging logging Handler format9572826 +Ref: 2c899572826 +Ref: library/logging logging Handler emit9572994 +Ref: 2c889572994 +Node: Formatter Objects9574526 +Ref: library/logging formatter-objects9574666 +Ref: 2c8a9574666 +Ref: library/logging id19574666 +Ref: 2c8b9574666 +Ref: library/logging logging Formatter9574721 +Ref: 145e9574721 +Ref: library/logging logging Formatter format9576927 +Ref: 2c8e9576927 +Ref: library/logging logging Formatter formatTime9578404 +Ref: 2c8c9578404 +Ref: library/logging logging Formatter formatException9580798 +Ref: 2c8f9580798 +Ref: library/logging logging Formatter formatStack9581136 +Ref: 2c909581136 +Ref: library/logging logging BufferingFormatter9581428 +Ref: 2c919581428 +Ref: library/logging logging BufferingFormatter formatHeader9581846 +Ref: 2c929581846 +Ref: library/logging logging BufferingFormatter formatFooter9582160 +Ref: 2c939582160 +Ref: library/logging logging BufferingFormatter format9582465 +Ref: 2c949582465 +Node: Filter Objects9582796 +Ref: library/logging filter9582938 +Ref: 2c959582938 +Ref: library/logging filter-objects9582938 +Ref: 2c969582938 +Ref: library/logging logging Filter9583452 +Ref: 11ed9583452 +Ref: library/logging logging Filter filter9583743 +Ref: 2c979583743 +Node: LogRecord Objects9586147 +Ref: library/logging log-record9586292 +Ref: 2c9a9586292 +Ref: library/logging logrecord-objects9586292 +Ref: 2c9b9586292 +Ref: library/logging logging LogRecord9586585 +Ref: fe19586585 +Ref: library/logging logging LogRecord getMessage9589146 +Ref: 2c9e9589146 +Node: LogRecord attributes9590644 +Ref: library/logging id29590796 +Ref: 2ca19590796 +Ref: library/logging logrecord-attributes9590796 +Ref: 2c6d9590796 +Node: LoggerAdapter Objects9599194 +Ref: library/logging logger-adapter9599342 +Ref: 2ca29599342 +Ref: library/logging loggeradapter-objects9599342 +Ref: 2ca39599342 +Ref: library/logging logging LoggerAdapter9599623 +Ref: 12e89599623 +Ref: library/logging logging LoggerAdapter process9600173 +Ref: 2ca59600173 +Ref: library/logging logging LoggerAdapter manager9600628 +Ref: 2ca69600628 +Ref: library/logging logging LoggerAdapter _log9600723 +Ref: 2ca79600723 +Node: Thread Safety9601883 +Ref: library/logging thread-safety9602033 +Ref: 2ca89602033 +Node: Module-Level Functions9602691 +Ref: library/logging module-level-functions9602843 +Ref: 2ca99602843 +Ref: library/logging logging getLogger9603001 +Ref: 9609603001 +Ref: library/logging logging getLoggerClass9603732 +Ref: 2caa9603732 +Ref: library/logging logging getLogRecordFactory9604210 +Ref: 2c9f9604210 +Ref: library/logging logging debug9604671 +Ref: 2c6f9604671 +Ref: library/logging logging info9605563 +Ref: 2c989605563 +Ref: library/logging logging warning9605772 +Ref: 2f99605772 +Ref: library/logging logging error9606195 +Ref: 2cac9606195 +Ref: library/logging logging critical9606406 +Ref: 2cad9606406 +Ref: library/logging logging exception9606623 +Ref: 145b9606623 +Ref: library/logging logging log9606955 +Ref: 2cae9606955 +Ref: library/logging logging disable9607161 +Ref: 2caf9607161 +Ref: library/logging logging addLevelName9608377 +Ref: 2cb09608377 +Ref: library/logging logging getLevelNamesMapping9609035 +Ref: 6559609035 +Ref: library/logging logging getLevelName9609364 +Ref: 2cb29609364 +Ref: library/logging logging getHandlerByName9611004 +Ref: 17d89611004 +Ref: library/logging logging getHandlerNames9611189 +Ref: 16fd9611189 +Ref: library/logging logging makeLogRecord9611319 +Ref: 2c9c9611319 +Ref: library/logging logging basicConfig9611684 +Ref: 9ff9611684 +Ref: library/logging logging shutdown9617100 +Ref: 2cb39617100 +Ref: library/logging logging setLoggerClass9617542 +Ref: 2cab9617542 +Ref: library/logging logging setLogRecordFactory9618158 +Ref: 2ca09618158 +Ref: Module-Level Functions-Footnote-19619493 +Node: Module-Level Attributes9619558 +Ref: library/logging module-level-attributes9619733 +Ref: 2cb49619733 +Ref: library/logging logging lastResort9619802 +Ref: 11ec9619802 +Ref: library/logging logging raiseExceptions9620409 +Ref: 11eb9620409 +Node: Integration with the warnings module9620806 +Ref: library/logging integration-with-the-warnings-module9620950 +Ref: 2cb59620950 +Ref: library/logging logging captureWarnings9621172 +Ref: 2cb69621172 +Ref: Integration with the warnings module-Footnote-19622563 +Ref: Integration with the warnings module-Footnote-29622605 +Node: logging config — Logging configuration9622658 +Ref: library/logging config doc9622862 +Ref: 2cb79622862 +Ref: library/logging config logging-config-logging-configuration9622862 +Ref: 2cb89622862 +Ref: library/logging config module-logging config9622862 +Ref: 889622862 +Ref: logging config — Logging configuration-Footnote-19623513 +Node: Configuration functions9623587 +Ref: library/logging config configuration-functions9623719 +Ref: 2cb99623719 +Ref: library/logging config logging-config-api9623719 +Ref: 12e49623719 +Ref: library/logging config logging config dictConfig9624161 +Ref: 11a29624161 +Ref: library/logging config logging config fileConfig9626278 +Ref: b519626278 +Ref: library/logging config logging config listen9628996 +Ref: f609628996 +Ref: library/logging config logging-eval-security9630650 +Ref: 2cbe9630650 +Ref: library/logging config logging config stopListening9632335 +Ref: 2cbd9632335 +Node: Security considerations9632579 +Ref: library/logging config security-considerations9632751 +Ref: 2cbf9632751 +Node: Configuration dictionary schema9633469 +Ref: library/logging config configuration-dictionary-schema9633643 +Ref: 2cc19633643 +Ref: library/logging config logging-config-dictschema9633643 +Ref: 2cba9633643 +Node: Dictionary Schema Details9634660 +Ref: library/logging config dictionary-schema-details9634787 +Ref: 2cc39634787 +Ref: library/logging config logging-config-dictschema-formatters9635594 +Ref: 2cc49635594 +Node: Incremental Configuration9640466 +Ref: library/logging config incremental-configuration9640620 +Ref: 2cc69640620 +Ref: library/logging config logging-config-dict-incremental9640620 +Ref: 2cc59640620 +Node: Object connections9642065 +Ref: library/logging config logging-config-dict-connections9642214 +Ref: 2cc29642214 +Ref: library/logging config object-connections9642214 +Ref: 2cc79642214 +Node: User-defined objects9644609 +Ref: library/logging config logging-config-dict-userdef9644760 +Ref: 2cc09644760 +Ref: library/logging config user-defined-objects9644760 +Ref: 2cc89644760 +Node: Handler configuration order9649355 +Ref: library/logging config handler-config-dict-order9649514 +Ref: 2cc99649514 +Ref: library/logging config handler-configuration-order9649514 +Ref: 2cca9649514 +Node: Access to external objects9650827 +Ref: library/logging config access-to-external-objects9650992 +Ref: 2ccb9650992 +Ref: library/logging config logging-config-dict-externalobj9650992 +Ref: 2ccc9650992 +Node: Access to internal objects9652291 +Ref: library/logging config access-to-internal-objects9652467 +Ref: 2ccd9652467 +Ref: library/logging config logging-config-dict-internalobj9652467 +Ref: 2cce9652467 +Node: Import resolution and custom importers9655905 +Ref: library/logging config import-resolution-and-custom-importers9656097 +Ref: 2cd09656097 +Ref: library/logging config logging-import-resolution9656097 +Ref: 2cd19656097 +Node: Configuring QueueHandler and QueueListener9657077 +Ref: library/logging config configure-queue9657234 +Ref: 15dc9657234 +Ref: library/logging config configuring-queuehandler-and-queuelistener9657234 +Ref: 2cd29657234 +Node: Configuration file format9660441 +Ref: library/logging config configuration-file-format9660583 +Ref: 2cd79660583 +Ref: library/logging config logging-config-fileformat9660583 +Ref: 2cbb9660583 +Node: logging handlers — Logging handlers9667948 +Ref: library/logging handlers doc9668176 +Ref: 2cd89668176 +Ref: library/logging handlers logging-handlers-logging-handlers9668176 +Ref: 2cd99668176 +Ref: library/logging handlers module-logging handlers9668176 +Ref: 899668176 +Ref: logging handlers — Logging handlers-Footnote-19669245 +Node: StreamHandler9669322 +Ref: library/logging handlers stream-handler9669429 +Ref: 2cda9669429 +Ref: library/logging handlers streamhandler9669429 +Ref: 2cdb9669429 +Ref: library/logging handlers logging StreamHandler9669743 +Ref: 11ea9669743 +Ref: library/logging handlers logging StreamHandler emit9669981 +Ref: 2cdc9669981 +Ref: library/logging handlers logging StreamHandler flush9670331 +Ref: 2cde9670331 +Ref: library/logging handlers logging StreamHandler setStream9670624 +Ref: b509670624 +Ref: library/logging handlers logging StreamHandler terminator9671040 +Ref: 2cdd9671040 +Node: FileHandler9671456 +Ref: library/logging handlers file-handler9671583 +Ref: 2cdf9671583 +Ref: library/logging handlers filehandler9671583 +Ref: 2ce09671583 +Ref: library/logging handlers logging FileHandler9671818 +Ref: 189e9671818 +Ref: library/logging handlers logging FileHandler close9672640 +Ref: 2ce29672640 +Ref: library/logging handlers logging FileHandler emit9672695 +Ref: 2ce19672695 +Ref: FileHandler-Footnote-19672983 +Node: NullHandler9673048 +Ref: library/logging handlers null-handler9673180 +Ref: 2ce39673180 +Ref: library/logging handlers nullhandler9673180 +Ref: 2ce49673180 +Ref: library/logging handlers logging NullHandler9673441 +Ref: 12779673441 +Ref: library/logging handlers logging NullHandler emit9673541 +Ref: 2ce59673541 +Ref: library/logging handlers logging NullHandler handle9673610 +Ref: 2ce69673610 +Ref: library/logging handlers logging NullHandler createLock9673681 +Ref: 2ce79673681 +Node: WatchedFileHandler9673964 +Ref: library/logging handlers watched-file-handler9674104 +Ref: 2ce99674104 +Ref: library/logging handlers watchedfilehandler9674104 +Ref: 2cea9674104 +Ref: library/logging handlers logging handlers WatchedFileHandler9675119 +Ref: 2ceb9675119 +Ref: library/logging handlers logging handlers WatchedFileHandler reopenIfNeeded9675951 +Ref: cb69675951 +Ref: library/logging handlers logging handlers WatchedFileHandler emit9676244 +Ref: 2cec9676244 +Node: BaseRotatingHandler9676412 +Ref: library/logging handlers base-rotating-handler9676560 +Ref: 2ced9676560 +Ref: library/logging handlers baserotatinghandler9676560 +Ref: 2cee9676560 +Ref: library/logging handlers logging handlers BaseRotatingHandler9676947 +Ref: 2cef9676947 +Ref: library/logging handlers logging handlers BaseRotatingHandler namer9677136 +Ref: 2cf09677136 +Ref: library/logging handlers logging handlers BaseRotatingHandler rotator9678873 +Ref: 2cf39678873 +Ref: library/logging handlers logging handlers BaseRotatingHandler rotation_filename9679158 +Ref: 2cf19679158 +Ref: library/logging handlers logging handlers BaseRotatingHandler rotate9679729 +Ref: 2cf49679729 +Node: RotatingFileHandler9681041 +Ref: library/logging handlers rotating-file-handler9681195 +Ref: 2cf69681195 +Ref: library/logging handlers rotatingfilehandler9681195 +Ref: 2cf79681195 +Ref: library/logging handlers logging handlers RotatingFileHandler9681387 +Ref: 15d99681387 +Ref: library/logging handlers logging handlers RotatingFileHandler doRollover9683358 +Ref: 2cf99683358 +Ref: library/logging handlers logging handlers RotatingFileHandler emit9683438 +Ref: 2cf89683438 +Ref: library/logging handlers logging handlers RotatingFileHandler shouldRollover9683570 +Ref: 2cfa9683570 +Node: TimedRotatingFileHandler9683718 +Ref: library/logging handlers timed-rotating-file-handler9683866 +Ref: 2cfb9683866 +Ref: library/logging handlers timedrotatingfilehandler9683866 +Ref: 2cfc9683866 +Ref: library/logging handlers logging handlers TimedRotatingFileHandler9684099 +Ref: f5c9684099 +Ref: library/logging handlers logging handlers TimedRotatingFileHandler doRollover9689251 +Ref: 2cfe9689251 +Ref: library/logging handlers logging handlers TimedRotatingFileHandler emit9689331 +Ref: 2cfd9689331 +Ref: library/logging handlers logging handlers TimedRotatingFileHandler getFilesToDelete9689458 +Ref: 2cf29689458 +Ref: library/logging handlers logging handlers TimedRotatingFileHandler shouldRollover9689597 +Ref: 2cff9689597 +Node: SocketHandler9689761 +Ref: library/logging handlers socket-handler9689905 +Ref: 2d009689905 +Ref: library/logging handlers sockethandler9689905 +Ref: 2d019689905 +Ref: library/logging handlers logging handlers SocketHandler9690117 +Ref: f5d9690117 +Ref: library/logging handlers logging handlers SocketHandler close9690524 +Ref: 2d029690524 +Ref: library/logging handlers logging handlers SocketHandler emit9690581 +Ref: 2d039690581 +Ref: library/logging handlers logging handlers SocketHandler handleError9691016 +Ref: 2d049691016 +Ref: library/logging handlers logging handlers SocketHandler makeSocket9691246 +Ref: 2d059691246 +Ref: library/logging handlers logging handlers SocketHandler makePickle9691490 +Ref: 2d069691490 +Ref: library/logging handlers logging handlers SocketHandler send9692300 +Ref: 2d079692300 +Ref: library/logging handlers logging handlers SocketHandler createSocket9692621 +Ref: 6599692621 +Node: DatagramHandler9693821 +Ref: library/logging handlers datagram-handler9693954 +Ref: 2d089693954 +Ref: library/logging handlers datagramhandler9693954 +Ref: 2d099693954 +Ref: library/logging handlers logging handlers DatagramHandler9694190 +Ref: f5e9694190 +Ref: library/logging handlers logging handlers DatagramHandler emit9695104 +Ref: 2d0a9695104 +Ref: library/logging handlers logging handlers DatagramHandler makeSocket9695458 +Ref: 2d0b9695458 +Ref: library/logging handlers logging handlers DatagramHandler send9695645 +Ref: 2d0c9695645 +Node: SysLogHandler9695860 +Ref: library/logging handlers syslog-handler9695997 +Ref: 2d0d9695997 +Ref: library/logging handlers sysloghandler9695997 +Ref: 2d0e9695997 +Ref: library/logging handlers logging handlers SysLogHandler9696203 +Ref: 6589696203 +Ref: library/logging handlers logging handlers SysLogHandler close9698168 +Ref: 2d0f9698168 +Ref: library/logging handlers logging handlers SysLogHandler createSocket9698244 +Ref: 6579698244 +Ref: library/logging handlers logging handlers SysLogHandler emit9698699 +Ref: 2d109698699 +Ref: library/logging handlers logging handlers SysLogHandler encodePriority9700581 +Ref: 2d119700581 +Ref: library/logging handlers logging handlers SysLogHandler mapPriority9704605 +Ref: 2d129704605 +Ref: SysLogHandler-Footnote-19705095 +Ref: SysLogHandler-Footnote-29705150 +Ref: SysLogHandler-Footnote-39705215 +Ref: SysLogHandler-Footnote-49705274 +Node: NTEventLogHandler9705339 +Ref: library/logging handlers nt-eventlog-handler9705472 +Ref: 2d139705472 +Ref: library/logging handlers nteventloghandler9705472 +Ref: 2d149705472 +Ref: library/logging handlers logging handlers NTEventLogHandler9705807 +Ref: 2d159705807 +Ref: library/logging handlers logging handlers NTEventLogHandler close9706868 +Ref: 2d169706868 +Ref: library/logging handlers logging handlers NTEventLogHandler emit9707270 +Ref: 2d179707270 +Ref: library/logging handlers logging handlers NTEventLogHandler getEventCategory9707428 +Ref: 2d189707428 +Ref: library/logging handlers logging handlers NTEventLogHandler getEventType9707630 +Ref: 2d199707630 +Ref: library/logging handlers logging handlers NTEventLogHandler getMessageID9708217 +Ref: 2d1a9708217 +Node: SMTPHandler9708647 +Ref: library/logging handlers smtp-handler9708780 +Ref: 2d1b9708780 +Ref: library/logging handlers smtphandler9708780 +Ref: 2d1c9708780 +Ref: library/logging handlers logging handlers SMTPHandler9708977 +Ref: 15689708977 +Ref: library/logging handlers logging handlers SMTPHandler emit9710232 +Ref: 2d1d9710232 +Ref: library/logging handlers logging handlers SMTPHandler getSubject9710336 +Ref: 2d1e9710336 +Node: MemoryHandler9710482 +Ref: library/logging handlers memory-handler9710609 +Ref: 2d1f9710609 +Ref: library/logging handlers memoryhandler9710609 +Ref: 2d209710609 +Ref: library/logging handlers logging handlers BufferingHandler9711312 +Ref: 2d219711312 +Ref: library/logging handlers logging handlers BufferingHandler emit9711508 +Ref: 2d229711508 +Ref: library/logging handlers logging handlers BufferingHandler flush9711698 +Ref: 2d249711698 +Ref: library/logging handlers logging handlers BufferingHandler shouldFlush9711935 +Ref: 2d239711935 +Ref: library/logging handlers logging handlers MemoryHandler9712118 +Ref: 2ccf9712118 +Ref: library/logging handlers logging handlers MemoryHandler close9712933 +Ref: 2d269712933 +Ref: library/logging handlers logging handlers MemoryHandler flush9713061 +Ref: 2d279713061 +Ref: library/logging handlers logging handlers MemoryHandler setTarget9713368 +Ref: 2d259713368 +Ref: library/logging handlers logging handlers MemoryHandler shouldFlush9713458 +Ref: 2d289713458 +Node: HTTPHandler9713584 +Ref: library/logging handlers http-handler9713712 +Ref: 2d299713712 +Ref: library/logging handlers httphandler9713712 +Ref: 2d2a9713712 +Ref: library/logging handlers logging handlers HTTPHandler9713943 +Ref: e2a9713943 +Ref: library/logging handlers logging handlers HTTPHandler mapLogRecord9714903 +Ref: 2d2b9714903 +Ref: library/logging handlers logging handlers HTTPHandler emit9715359 +Ref: 2d2c9715359 +Node: QueueHandler9716093 +Ref: library/logging handlers queue-handler9716221 +Ref: 2d2d9716221 +Ref: library/logging handlers queuehandler9716221 +Ref: 2d2e9716221 +Ref: library/logging handlers logging handlers QueueHandler9716962 +Ref: 17d79716962 +Ref: library/logging handlers logging handlers QueueHandler emit9718104 +Ref: 2d319718104 +Ref: library/logging handlers logging handlers QueueHandler prepare9718607 +Ref: 2d329718607 +Ref: library/logging handlers logging handlers QueueHandler enqueue9720546 +Ref: 2d2f9720546 +Ref: library/logging handlers logging handlers QueueHandler listener9720792 +Ref: 2cd39720792 +Node: QueueListener9721087 +Ref: library/logging handlers queue-listener9721195 +Ref: 2d339721195 +Ref: library/logging handlers queuelistener9721195 +Ref: 2d349721195 +Ref: library/logging handlers logging handlers QueueListener9722217 +Ref: e2b9722217 +Ref: library/logging handlers logging handlers QueueListener dequeue9723448 +Ref: 2d359723448 +Ref: library/logging handlers logging handlers QueueListener prepare9723729 +Ref: 2d369723729 +Ref: library/logging handlers logging handlers QueueListener handle9724046 +Ref: 2d379724046 +Ref: library/logging handlers logging handlers QueueListener start9724308 +Ref: 15479724308 +Ref: library/logging handlers logging handlers QueueListener stop9724598 +Ref: 2d389724598 +Ref: library/logging handlers logging handlers QueueListener enqueue_sentinel9724909 +Ref: 2d399724909 +Node: platform — Access to underlying platform’s identifying data9725408 +Ref: library/platform doc9725635 +Ref: 2d3a9725635 +Ref: library/platform module-platform9725635 +Ref: aa9725635 +Ref: library/platform platform-access-to-underlying-platform-s-identifying-data9725635 +Ref: 2d3b9725635 +Ref: platform — Access to underlying platform’s identifying data-Footnote-19726230 +Node: Cross platform9726298 +Ref: library/platform cross-platform9726434 +Ref: 2d3c9726434 +Ref: library/platform platform architecture9726483 +Ref: 168b9726483 +Ref: library/platform platform machine9727812 +Ref: 2d3d9727812 +Ref: library/platform platform node9727969 +Ref: 2d3e9727969 +Ref: library/platform platform platform9728144 +Ref: 17559728144 +Ref: library/platform platform processor9729087 +Ref: 2d409729087 +Ref: library/platform platform python_build9729408 +Ref: 2d419729408 +Ref: library/platform platform python_compiler9729555 +Ref: 2d429729555 +Ref: library/platform platform python_branch9729678 +Ref: 2d439729678 +Ref: library/platform platform python_implementation9729792 +Ref: 2d449729792 +Ref: library/platform platform python_revision9729996 +Ref: 2d459729996 +Ref: library/platform platform python_version9730119 +Ref: 2d469730119 +Ref: library/platform platform python_version_tuple9730368 +Ref: 2d479730368 +Ref: library/platform platform release9730648 +Ref: 2d489730648 +Ref: library/platform platform system9730825 +Ref: 1e5f9730825 +Ref: library/platform platform system_alias9731254 +Ref: 2d3f9731254 +Ref: library/platform platform version9731537 +Ref: 2d499731537 +Ref: library/platform platform uname9731856 +Ref: 1a319731856 +Node: Java platform9732612 +Ref: library/platform java-platform9732773 +Ref: 2d4a9732773 +Ref: library/platform platform java_ver9732820 +Ref: 2a99732820 +Node: Windows platform9733457 +Ref: library/platform windows-platform9733618 +Ref: 2d4b9733618 +Ref: library/platform platform win32_ver9733671 +Ref: 195e9733671 +Ref: library/platform platform win32_edition9734499 +Ref: 2d4c9734499 +Ref: library/platform platform win32_is_iot9734829 +Ref: 2d4d9734829 +Node: macOS platform9735023 +Ref: library/platform macos-platform9735183 +Ref: 2d4e9735183 +Ref: library/platform platform mac_ver9735232 +Ref: 1a339735232 +Node: iOS platform9735613 +Ref: library/platform ios-platform9735771 +Ref: 2d4f9735771 +Ref: library/platform platform ios_ver9735816 +Ref: 1e5e9735816 +Node: Unix platforms9736591 +Ref: library/platform unix-platforms9736750 +Ref: 2d509736750 +Ref: library/platform platform libc_ver9736799 +Ref: 1a309736799 +Node: Linux platforms9737416 +Ref: library/platform linux-platforms9737579 +Ref: 2d519737579 +Ref: library/platform platform freedesktop_os_release9737630 +Ref: 8229737630 +Ref: Linux platforms-Footnote-19739096 +Node: Android platform9739169 +Ref: library/platform android-platform9739339 +Ref: 2d529739339 +Ref: library/platform platform android_ver9739392 +Ref: 164c9739392 +Ref: Android platform-Footnote-19740530 +Ref: Android platform-Footnote-29740609 +Ref: Android platform-Footnote-39740680 +Ref: Android platform-Footnote-49740752 +Node: Command-line usage<2>9740826 +Ref: library/platform command-line-usage9740972 +Ref: 2d539740972 +Ref: library/platform platform-cli9740972 +Ref: 2d549740972 +Ref: library/platform cmdoption-platform-terse9741243 +Ref: 2d559741243 +Ref: library/platform cmdoption-platform-nonaliased9741433 +Ref: 2d569741433 +Node: errno — Standard errno system symbols9741827 +Ref: library/errno doc9742065 +Ref: 2d579742065 +Ref: library/errno errno-standard-errno-system-symbols9742065 +Ref: 2d589742065 +Ref: library/errno module-errno9742065 +Ref: 579742065 +Ref: library/errno errno errorcode9742468 +Ref: 2d599742468 +Ref: library/errno errno EPERM9742989 +Ref: 17cc9742989 +Ref: library/errno errno ENOENT9743115 +Ref: 22aa9743115 +Ref: library/errno errno ESRCH9743246 +Ref: 22ae9743246 +Ref: library/errno errno EINTR9743368 +Ref: d869743368 +Ref: library/errno errno EIO9743495 +Ref: 2d5a9743495 +Ref: library/errno errno ENXIO9743532 +Ref: 2d5b9743532 +Ref: library/errno errno E2BIG9743587 +Ref: 2d5c9743587 +Ref: library/errno errno ENOEXEC9743634 +Ref: 2d5d9743634 +Ref: library/errno errno EBADF9743683 +Ref: 95b9743683 +Ref: library/errno errno ECHILD9743728 +Ref: 22a39743728 +Ref: library/errno errno EAGAIN9743853 +Ref: 229e9743853 +Ref: library/errno errno ENOMEM9743967 +Ref: 2d5e9743967 +Ref: library/errno errno EACCES9744011 +Ref: 22ad9744011 +Ref: library/errno errno EFAULT9744132 +Ref: 2d5f9744132 +Ref: library/errno errno ENOTBLK9744174 +Ref: 2d609744174 +Ref: library/errno errno EBUSY9744227 +Ref: 2d619744227 +Ref: library/errno errno EEXIST9744280 +Ref: 22a99744280 +Ref: library/errno errno EXDEV9744396 +Ref: 2b469744396 +Ref: library/errno errno ENODEV9744443 +Ref: 2d629744443 +Ref: library/errno errno ENOTDIR9744488 +Ref: 22ac9744488 +Ref: library/errno errno EISDIR9744612 +Ref: 22ab9744612 +Ref: library/errno errno EINVAL9744733 +Ref: 19ee9744733 +Ref: library/errno errno ENFILE9744780 +Ref: 2d639744780 +Ref: library/errno errno EMFILE9744830 +Ref: 2d649744830 +Ref: library/errno errno ENOTTY9744880 +Ref: 2d659744880 +Ref: library/errno errno ETXTBSY9744927 +Ref: 2d669744927 +Ref: library/errno errno EFBIG9744973 +Ref: 2d679744973 +Ref: library/errno errno ENOSPC9745017 +Ref: 2d689745017 +Ref: library/errno errno ESPIPE9745071 +Ref: 2d699745071 +Ref: library/errno errno EROFS9745114 +Ref: 2d6a9745114 +Ref: library/errno errno EMLINK9745165 +Ref: 2d6b9745165 +Ref: library/errno errno EPIPE9745210 +Ref: 22a49745210 +Ref: library/errno errno EDOM9745325 +Ref: 2d6c9745325 +Ref: library/errno errno ERANGE9745389 +Ref: 2d6d9745389 +Ref: library/errno errno EDEADLK9745449 +Ref: 2d6e9745449 +Ref: library/errno errno ENAMETOOLONG9745510 +Ref: 2d6f9745510 +Ref: library/errno errno ENOLCK9745565 +Ref: 2d709745565 +Ref: library/errno errno ENOSYS9745621 +Ref: 17cd9745621 +Ref: library/errno errno ENOTEMPTY9745676 +Ref: 2d719745676 +Ref: library/errno errno ELOOP9745729 +Ref: 2d729745729 +Ref: library/errno errno EWOULDBLOCK9745794 +Ref: 22a09745794 +Ref: library/errno errno ENOMSG9745925 +Ref: 2d739745925 +Ref: library/errno errno EIDRM9745982 +Ref: 2d749745982 +Ref: library/errno errno ECHRNG9746030 +Ref: 2d759746030 +Ref: library/errno errno EL2NSYNC9746088 +Ref: 2d769746088 +Ref: library/errno errno EL3HLT9746145 +Ref: 2d779746145 +Ref: library/errno errno EL3RST9746190 +Ref: 2d789746190 +Ref: library/errno errno ELNRNG9746234 +Ref: 2d799746234 +Ref: library/errno errno EUNATCH9746289 +Ref: 2d7a9746289 +Ref: library/errno errno ENOCSI9746349 +Ref: 2d7b9746349 +Ref: library/errno errno EL2HLT9746406 +Ref: 2d7c9746406 +Ref: library/errno errno EBADE9746451 +Ref: 2d7d9746451 +Ref: library/errno errno EBADR9746497 +Ref: 2d7e9746497 +Ref: library/errno errno EXFULL9746553 +Ref: 2d7f9746553 +Ref: library/errno errno ENOANO9746597 +Ref: 2d809746597 +Ref: library/errno errno EBADRQC9746636 +Ref: 2d819746636 +Ref: library/errno errno EBADSLT9746688 +Ref: 2d829746688 +Ref: library/errno errno EDEADLOCK9746732 +Ref: 2d839746732 +Ref: library/errno errno EBFONT9746793 +Ref: 2d849746793 +Ref: library/errno errno ENOSTR9746844 +Ref: 2d859746844 +Ref: library/errno errno ENODATA9746894 +Ref: 2d869746894 +Ref: library/errno errno ETIME9746943 +Ref: 2d879746943 +Ref: library/errno errno ENOSR9746986 +Ref: 2d889746986 +Ref: library/errno errno ENONET9747040 +Ref: 2d899747040 +Ref: library/errno errno ENOPKG9747100 +Ref: 2d8a9747100 +Ref: library/errno errno EREMOTE9747152 +Ref: 2d8b9747152 +Ref: library/errno errno ENOLINK9747200 +Ref: 2d8c9747200 +Ref: library/errno errno EADV9747253 +Ref: 2d8d9747253 +Ref: library/errno errno ESRMNT9747297 +Ref: 2d8e9747297 +Ref: library/errno errno ECOMM9747341 +Ref: 2d8f9747341 +Ref: library/errno errno EPROTO9747398 +Ref: 2d909747398 +Ref: library/errno errno EMULTIHOP9747443 +Ref: 2d919747443 +Ref: library/errno errno EDOTDOT9747495 +Ref: 2d929747495 +Ref: library/errno errno EBADMSG9747545 +Ref: 2d939747545 +Ref: library/errno errno EOVERFLOW9747595 +Ref: 2d949747595 +Ref: library/errno errno ENOTUNIQ9747666 +Ref: 2d959747666 +Ref: library/errno errno EBADFD9747725 +Ref: 2d969747725 +Ref: library/errno errno EREMCHG9747784 +Ref: 2d979747784 +Ref: library/errno errno ELIBACC9747838 +Ref: 2d989747838 +Ref: library/errno errno ELIBBAD9747908 +Ref: 2d999747908 +Ref: library/errno errno ELIBSCN9747976 +Ref: 2d9a9747976 +Ref: library/errno errno ELIBMAX9748039 +Ref: 2d9b9748039 +Ref: library/errno errno ELIBEXEC9748118 +Ref: 2d9c9748118 +Ref: library/errno errno EILSEQ9748188 +Ref: 2d9d9748188 +Ref: library/errno errno ERESTART9748240 +Ref: 2d9e9748240 +Ref: library/errno errno ESTRPIPE9748316 +Ref: 2d9f9748316 +Ref: library/errno errno EUSERS9748367 +Ref: 2da09748367 +Ref: library/errno errno ENOTSOCK9748412 +Ref: 2da19748412 +Ref: library/errno errno EDESTADDRREQ9748475 +Ref: 2da29748475 +Ref: library/errno errno EMSGSIZE9748540 +Ref: 2da39748540 +Ref: library/errno errno EPROTOTYPE9748589 +Ref: 2da49748589 +Ref: library/errno errno ENOPROTOOPT9748654 +Ref: 2da59748654 +Ref: library/errno errno EPROTONOSUPPORT9748712 +Ref: 2da69748712 +Ref: library/errno errno ESOCKTNOSUPPORT9748774 +Ref: 2da79748774 +Ref: library/errno errno EOPNOTSUPP9748839 +Ref: 2da89748839 +Ref: library/errno errno ENOTSUP9748919 +Ref: 2da99748919 +Ref: library/errno errno EPFNOSUPPORT9749002 +Ref: 2daa9749002 +Ref: library/errno errno EAFNOSUPPORT9749068 +Ref: 2dab9749068 +Ref: library/errno errno EADDRINUSE9749145 +Ref: 2dac9749145 +Ref: library/errno errno EADDRNOTAVAIL9749202 +Ref: 2dad9749202 +Ref: library/errno errno ENETDOWN9749271 +Ref: 2dae9749271 +Ref: library/errno errno ENETUNREACH9749319 +Ref: 1a069749319 +Ref: library/errno errno ENETRESET9749377 +Ref: 2daf9749377 +Ref: library/errno errno ECONNABORTED9749454 +Ref: 22a69749454 +Ref: library/errno errno ECONNRESET9749604 +Ref: 22a89749604 +Ref: library/errno errno ENOBUFS9749742 +Ref: 17e79749742 +Ref: library/errno errno EISCONN9749799 +Ref: 2db09749799 +Ref: library/errno errno ENOTCONN9749870 +Ref: 2db19749870 +Ref: library/errno errno ESHUTDOWN9749938 +Ref: 22a59749938 +Ref: library/errno errno ETOOMANYREFS9750091 +Ref: 2db29750091 +Ref: library/errno errno ETIMEDOUT9750162 +Ref: 22af9750162 +Ref: library/errno errno ECONNREFUSED9750286 +Ref: 22a79750286 +Ref: library/errno errno EHOSTDOWN9750422 +Ref: 2db39750422 +Ref: library/errno errno EHOSTUNREACH9750468 +Ref: 2db49750468 +Ref: library/errno errno EALREADY9750521 +Ref: 229f9750521 +Ref: library/errno errno EINPROGRESS9750657 +Ref: 22a19750657 +Ref: library/errno errno ESTALE9750792 +Ref: 2db59750792 +Ref: library/errno errno EUCLEAN9750844 +Ref: 2db69750844 +Ref: library/errno errno ENOTNAM9750900 +Ref: 2db79750900 +Ref: library/errno errno ENAVAIL9750959 +Ref: 2db89750959 +Ref: library/errno errno EISNAM9751020 +Ref: 2db99751020 +Ref: library/errno errno EREMOTEIO9751071 +Ref: 2dba9751071 +Ref: library/errno errno EDQUOT9751121 +Ref: 2dbb9751121 +Ref: library/errno errno EQFULL9751166 +Ref: 2dbc9751166 +Ref: library/errno errno ENOMEDIUM9751256 +Ref: 2dbd9751256 +Ref: library/errno errno EMEDIUMTYPE9751305 +Ref: 2dbe9751305 +Ref: library/errno errno ENOKEY9751358 +Ref: 2dbf9751358 +Ref: library/errno errno EKEYEXPIRED9751415 +Ref: 2dc09751415 +Ref: library/errno errno EKEYREVOKED9751466 +Ref: 2dc19751466 +Ref: library/errno errno EKEYREJECTED9751522 +Ref: 2dc29751522 +Ref: library/errno errno ERFKILL9751586 +Ref: 2dc39751586 +Ref: library/errno errno ELOCKUNMAPPED9751655 +Ref: 2dc49751655 +Ref: library/errno errno ENOTACTIVE9751717 +Ref: 2dc59751717 +Ref: library/errno errno EAUTH9751774 +Ref: 2dc69751774 +Ref: library/errno errno EBADARCH9751852 +Ref: 2dc79751852 +Ref: library/errno errno EBADEXEC9751939 +Ref: 2dc89751939 +Ref: library/errno errno EBADMACHO9752034 +Ref: 2dc99752034 +Ref: library/errno errno EDEVERR9752117 +Ref: 2dca9752117 +Ref: library/errno errno EFTYPE9752189 +Ref: 2dcb9752189 +Ref: library/errno errno ENEEDAUTH9752281 +Ref: 2dcc9752281 +Ref: library/errno errno ENOATTR9752361 +Ref: 2dcd9752361 +Ref: library/errno errno ENOPOLICY9752440 +Ref: 2dce9752440 +Ref: library/errno errno EPROCLIM9752518 +Ref: 2dcf9752518 +Ref: library/errno errno EPROCUNAVAIL9752597 +Ref: 2dd09752597 +Ref: library/errno errno EPROGMISMATCH9752687 +Ref: 2dd19752687 +Ref: library/errno errno EPROGUNAVAIL9752774 +Ref: 2dd29752774 +Ref: library/errno errno EPWROFF9752859 +Ref: 2dd39752859 +Ref: library/errno errno EBADRPC9752938 +Ref: 2dd49752938 +Ref: library/errno errno ERPCMISMATCH9753015 +Ref: 2dd59753015 +Ref: library/errno errno ESHLIBVERS9753097 +Ref: 2dd69753097 +Ref: library/errno errno ENOTCAPABLE9753191 +Ref: 17bf9753191 +Ref: library/errno errno ECANCELED9753403 +Ref: 2dd79753403 +Ref: library/errno errno EOWNERDEAD9753483 +Ref: 2dd89753483 +Ref: library/errno errno ENOTRECOVERABLE9753556 +Ref: 2dd99753556 +Node: ctypes — A foreign function library for Python9753645 +Ref: library/ctypes doc9753811 +Ref: 2dda9753811 +Ref: library/ctypes ctypes-a-foreign-function-library-for-python9753811 +Ref: 2ddb9753811 +Ref: library/ctypes module-ctypes9753811 +Ref: 2a9753811 +Ref: ctypes — A foreign function library for Python-Footnote-19754328 +Node: ctypes tutorial9754391 +Ref: library/ctypes ctypes-ctypes-tutorial9754516 +Ref: 2ddc9754516 +Ref: library/ctypes ctypes-tutorial9754516 +Ref: 2ddd9754516 +Node: Loading dynamic link libraries9755911 +Ref: library/ctypes ctypes-loading-dynamic-link-libraries9756038 +Ref: 2de09756038 +Ref: library/ctypes loading-dynamic-link-libraries9756038 +Ref: 2de19756038 +Node: Accessing functions from loaded dlls9758096 +Ref: library/ctypes accessing-functions-from-loaded-dlls9758249 +Ref: 2de39758249 +Ref: library/ctypes ctypes-accessing-functions-from-loaded-dlls9758249 +Ref: 2de49758249 +Node: Calling functions9760471 +Ref: library/ctypes calling-functions9760616 +Ref: 2de59760616 +Ref: library/ctypes ctypes-calling-functions9760616 +Ref: 2de69760616 +Node: Fundamental data types9763052 +Ref: library/ctypes ctypes-fundamental-data-types9763188 +Ref: 2de79763188 +Ref: library/ctypes fundamental-data-types9763188 +Ref: 2de89763188 +Node: Calling functions continued9773171 +Ref: library/ctypes calling-functions-continued9773316 +Ref: 2dfd9773316 +Ref: library/ctypes ctypes-calling-functions-continued9773316 +Ref: 2dfe9773316 +Node: Calling variadic functions9774394 +Ref: library/ctypes calling-variadic-functions9774566 +Ref: 2dff9774566 +Ref: library/ctypes ctypes-calling-variadic-functions9774566 +Ref: 2e009774566 +Node: Calling functions with your own custom data types9775261 +Ref: library/ctypes calling-functions-with-your-own-custom-data-types9775464 +Ref: 2e029775464 +Ref: library/ctypes ctypes-calling-functions-with-own-custom-data-types9775464 +Ref: 2e039775464 +Node: Specifying the required argument types function prototypes9776381 +Ref: library/ctypes ctypes-specifying-required-argument-types9776570 +Ref: 2e049776570 +Ref: library/ctypes specifying-the-required-argument-types-function-prototypes9776570 +Ref: 2e059776570 +Node: Return types9778471 +Ref: library/ctypes ctypes-return-types9778662 +Ref: 2e079778662 +Ref: library/ctypes return-types9778662 +Ref: 2e089778662 +Node: Passing pointers or passing parameters by reference9781785 +Ref: library/ctypes ctypes-passing-pointers9781939 +Ref: 2e0c9781939 +Ref: library/ctypes passing-pointers-or-passing-parameters-by-reference9781939 +Ref: 2e0d9781939 +Node: Structures and unions9783031 +Ref: library/ctypes ctypes-structures-unions9783213 +Ref: 2e0f9783213 +Ref: library/ctypes structures-and-unions9783213 +Ref: 2e109783213 +Ref: library/ctypes ctypes-structureunion-alignment-byte-order9785304 +Ref: 2e129785304 +Node: Structure/union alignment and byte order9785632 +Ref: library/ctypes structure-union-alignment-and-byte-order9785798 +Ref: 2e139785798 +Node: Bit fields in structures and unions9786835 +Ref: library/ctypes bit-fields-in-structures-and-unions9786986 +Ref: 2e179786986 +Ref: library/ctypes ctypes-bit-fields-in-structures-unions9786986 +Ref: 2e189786986 +Node: Arrays9787578 +Ref: library/ctypes arrays9787697 +Ref: 2e199787697 +Ref: library/ctypes ctypes-arrays9787697 +Ref: 2e1a9787697 +Node: Pointers9788984 +Ref: library/ctypes ctypes-pointers9789084 +Ref: 2e1b9789084 +Ref: library/ctypes pointers9789084 +Ref: 2e1c9789084 +Node: Type conversions9791745 +Ref: library/ctypes ctypes-type-conversions9791855 +Ref: 2e1e9791855 +Ref: library/ctypes type-conversions9791855 +Ref: 2e1f9791855 +Node: Incomplete Types9794469 +Ref: library/ctypes ctypes-incomplete-types9794589 +Ref: 2e219794589 +Ref: library/ctypes incomplete-types9794589 +Ref: 2e229794589 +Node: Callback functions9796203 +Ref: library/ctypes callback-functions9796342 +Ref: 2e239796342 +Ref: library/ctypes ctypes-callback-functions9796342 +Ref: 2e249796342 +Node: Accessing values exported from dlls9800214 +Ref: library/ctypes accessing-values-exported-from-dlls9800346 +Ref: 2e279800346 +Ref: library/ctypes ctypes-accessing-values-exported-from-dlls9800346 +Ref: 2e289800346 +Node: Surprises9803005 +Ref: library/ctypes ctypes-surprises9803144 +Ref: 2e2b9803144 +Ref: library/ctypes surprises9803144 +Ref: 2e2c9803144 +Node: Variable-sized data types9805317 +Ref: library/ctypes ctypes-variable-sized-data-types9805412 +Ref: 2e2d9805412 +Ref: library/ctypes variable-sized-data-types9805412 +Ref: 2e2e9805412 +Node: ctypes reference9806813 +Ref: library/ctypes ctypes-ctypes-reference9806938 +Ref: 2e309806938 +Ref: library/ctypes ctypes-reference9806938 +Ref: 2e319806938 +Node: Finding shared libraries9807247 +Ref: library/ctypes ctypes-finding-shared-libraries9807357 +Ref: 2e329807357 +Ref: library/ctypes finding-shared-libraries9807357 +Ref: 2e339807357 +Node: Loading shared libraries9809927 +Ref: library/ctypes ctypes-loading-shared-libraries9810063 +Ref: 2e349810063 +Ref: library/ctypes loading-shared-libraries9810063 +Ref: 2e359810063 +Ref: library/ctypes ctypes CDLL9810264 +Ref: 9e89810264 +Ref: library/ctypes ctypes OleDLL9811397 +Ref: 17719811397 +Ref: library/ctypes ctypes WinDLL9812262 +Ref: 17729812262 +Ref: library/ctypes ctypes PyDLL9812862 +Ref: 17739812862 +Ref: library/ctypes ctypes PyDLL _handle9816699 +Ref: 2e3b9816699 +Ref: library/ctypes ctypes PyDLL _name9816781 +Ref: 2e3c9816781 +Ref: library/ctypes ctypes LibraryLoader9817130 +Ref: 2e3d9817130 +Ref: library/ctypes ctypes LibraryLoader LoadLibrary9817588 +Ref: 2de29817588 +Ref: Loading shared libraries-Footnote-19819212 +Ref: Loading shared libraries-Footnote-29819278 +Node: Foreign functions9819324 +Ref: library/ctypes ctypes-foreign-functions9819455 +Ref: 2e3e9819455 +Ref: library/ctypes foreign-functions9819455 +Ref: 2e3f9819455 +Ref: library/ctypes ctypes _CFuncPtr9820151 +Ref: 2e409820151 +Ref: library/ctypes ctypes _CFuncPtr restype9820453 +Ref: 2e099820453 +Ref: library/ctypes ctypes _CFuncPtr argtypes9821130 +Ref: 2e019821130 +Ref: library/ctypes ctypes _CFuncPtr errcheck9822393 +Ref: 2e0b9822393 +Ref: library/ctypes ctypes ArgumentError9823379 +Ref: 2e419823379 +Node: Function prototypes9824019 +Ref: library/ctypes ctypes-function-prototypes9824143 +Ref: 2e429824143 +Ref: library/ctypes function-prototypes9824143 +Ref: 2e439824143 +Ref: library/ctypes ctypes CFUNCTYPE9824724 +Ref: 2e259824724 +Ref: library/ctypes ctypes WINFUNCTYPE9825235 +Ref: 2e269825235 +Ref: library/ctypes ctypes PYFUNCTYPE9825616 +Ref: 2e449825616 +Node: Utility functions9831084 +Ref: library/ctypes ctypes-utility-functions9831201 +Ref: 2e459831201 +Ref: library/ctypes utility-functions9831201 +Ref: 2e469831201 +Ref: library/ctypes ctypes addressof9831258 +Ref: 2e479831258 +Ref: library/ctypes ctypes alignment9831502 +Ref: 2e489831502 +Ref: library/ctypes ctypes byref9831662 +Ref: 2e0e9831662 +Ref: library/ctypes ctypes cast9832176 +Ref: 2e209832176 +Ref: library/ctypes ctypes create_string_buffer9832470 +Ref: 2dfc9832470 +Ref: library/ctypes ctypes create_unicode_buffer9833967 +Ref: 19ce9833967 +Ref: library/ctypes ctypes DllCanUnloadNow9834498 +Ref: 2e499834498 +Ref: library/ctypes ctypes DllGetClassObject9834770 +Ref: 2e4a9834770 +Ref: library/ctypes ctypes util find_library9835052 +Ref: d499835052 +Ref: library/ctypes ctypes util find_msvcrt9835444 +Ref: 2e4b9835444 +Ref: library/ctypes ctypes FormatError9835928 +Ref: 2e4c9835928 +Ref: library/ctypes ctypes GetLastError9836194 +Ref: 2e0a9836194 +Ref: library/ctypes ctypes get_errno9836489 +Ref: 2e379836489 +Ref: library/ctypes ctypes get_last_error9836742 +Ref: 2e399836742 +Ref: library/ctypes ctypes memmove9837045 +Ref: 2e4d9837045 +Ref: library/ctypes ctypes memset9837289 +Ref: 2e4e9837289 +Ref: library/ctypes ctypes POINTER9837542 +Ref: 16e59837542 +Ref: library/ctypes ctypes pointer9837769 +Ref: 16e49837769 +Ref: library/ctypes ctypes resize9838078 +Ref: 2e2f9838078 +Ref: library/ctypes ctypes set_errno9838416 +Ref: 2e389838416 +Ref: library/ctypes ctypes set_last_error9838724 +Ref: 2e3a9838724 +Ref: library/ctypes ctypes sizeof9839083 +Ref: 2e4f9839083 +Ref: library/ctypes ctypes string_at9839254 +Ref: 2e509839254 +Ref: library/ctypes ctypes WinError9839566 +Ref: 2e519839566 +Ref: library/ctypes ctypes wstring_at9840131 +Ref: 2e529840131 +Node: Data types9840489 +Ref: library/ctypes ctypes-data-types9840612 +Ref: 2e539840612 +Ref: library/ctypes data-types9840612 +Ref: 2e549840612 +Ref: library/ctypes ctypes _CData9840655 +Ref: 2e559840655 +Ref: library/ctypes ctypes _CData from_buffer9841290 +Ref: 2e579841290 +Ref: library/ctypes ctypes _CData from_buffer_copy9841877 +Ref: 2e589841877 +Ref: library/ctypes ctypes _CData from_address9842422 +Ref: 2e599842422 +Ref: library/ctypes ctypes _CData from_param9842768 +Ref: 2e069842768 +Ref: library/ctypes ctypes _CData in_dll9843329 +Ref: 2e299843329 +Ref: library/ctypes ctypes _CData _b_base_9843625 +Ref: 2e5a9843625 +Ref: library/ctypes ctypes _CData _b_needsfree_9843930 +Ref: 2e5b9843930 +Ref: library/ctypes ctypes _CData _objects9844104 +Ref: 2e569844104 +Node: Fundamental data types<2>9844416 +Ref: library/ctypes ctypes-fundamental-data-types-29844543 +Ref: 2e5c9844543 +Ref: library/ctypes id19844543 +Ref: 2e5d9844543 +Ref: library/ctypes ctypes _SimpleCData9844610 +Ref: 2e5e9844610 +Ref: library/ctypes ctypes _SimpleCData value9845083 +Ref: 2e5f9845083 +Ref: library/ctypes ctypes c_byte9846445 +Ref: 176f9846445 +Ref: library/ctypes ctypes c_char9846657 +Ref: 2dea9846657 +Ref: library/ctypes ctypes c_char_p9846897 +Ref: 16e69846897 +Ref: library/ctypes ctypes c_double9847191 +Ref: 18fa9847191 +Ref: library/ctypes ctypes c_longdouble9847320 +Ref: 18fb9847320 +Ref: library/ctypes ctypes c_float9847567 +Ref: 2dfb9847567 +Ref: library/ctypes ctypes c_int9847694 +Ref: 2dde9847694 +Ref: library/ctypes ctypes c_int89847958 +Ref: 2dee9847958 +Ref: library/ctypes ctypes c_int169848079 +Ref: 2def9848079 +Ref: library/ctypes ctypes c_int329848205 +Ref: 2df09848205 +Ref: library/ctypes ctypes c_int649848329 +Ref: 2df19848329 +Ref: library/ctypes ctypes c_long9848458 +Ref: 2ddf9848458 +Ref: library/ctypes ctypes c_longlong9848622 +Ref: 2df89848622 +Ref: library/ctypes ctypes c_short9848800 +Ref: 2dec9848800 +Ref: library/ctypes ctypes c_size_t9848966 +Ref: 2dfa9848966 +Ref: library/ctypes ctypes c_ssize_t9849040 +Ref: 122f9849040 +Ref: library/ctypes ctypes c_time_t9849144 +Ref: 17d99849144 +Ref: library/ctypes ctypes c_ubyte9849247 +Ref: 17709849247 +Ref: library/ctypes ctypes c_uint9849461 +Ref: 2df29849461 +Ref: library/ctypes ctypes c_uint89849730 +Ref: 2df39849730 +Ref: library/ctypes ctypes c_uint169849855 +Ref: 2df49849855 +Ref: library/ctypes ctypes c_uint329849985 +Ref: 2df59849985 +Ref: library/ctypes ctypes c_uint649850113 +Ref: 2df69850113 +Ref: library/ctypes ctypes c_ulong9850246 +Ref: 2df79850246 +Ref: library/ctypes ctypes c_ulonglong9850413 +Ref: 2df99850413 +Ref: library/ctypes ctypes c_ushort9850594 +Ref: 2ded9850594 +Ref: library/ctypes ctypes c_void_p9850763 +Ref: 16e89850763 +Ref: library/ctypes ctypes c_wchar9850926 +Ref: 2deb9850926 +Ref: library/ctypes ctypes c_wchar_p9851191 +Ref: 16e79851191 +Ref: library/ctypes ctypes c_bool9851398 +Ref: 2de99851398 +Ref: library/ctypes ctypes HRESULT9851612 +Ref: 2e369851612 +Ref: library/ctypes ctypes py_object9851800 +Ref: 14039851800 +Node: Structured data types9852189 +Ref: library/ctypes ctypes-structured-data-types9852325 +Ref: 2e609852325 +Ref: library/ctypes structured-data-types9852325 +Ref: 2e619852325 +Ref: library/ctypes ctypes Union9852390 +Ref: 16819852390 +Ref: library/ctypes ctypes BigEndianUnion9852488 +Ref: 18269852488 +Ref: library/ctypes ctypes LittleEndianUnion9852630 +Ref: 18279852630 +Ref: library/ctypes ctypes BigEndianStructure9852778 +Ref: 2e159852778 +Ref: library/ctypes ctypes LittleEndianStructure9852899 +Ref: 2e169852899 +Ref: library/ctypes ctypes Structure9853168 +Ref: 1d49853168 +Ref: library/ctypes ctypes Structure _fields_9853592 +Ref: 2e119853592 +Ref: library/ctypes ctypes Structure _pack_9855186 +Ref: 2e149855186 +Ref: library/ctypes ctypes Structure _align_9855551 +Ref: 1d59855551 +Ref: library/ctypes ctypes Structure _anonymous_9855847 +Ref: 2e629855847 +Node: Arrays and pointers9858203 +Ref: library/ctypes arrays-and-pointers9858305 +Ref: 2e639858305 +Ref: library/ctypes ctypes-arrays-pointers9858305 +Ref: 2e649858305 +Ref: library/ctypes ctypes Array9858366 +Ref: 1a299858366 +Ref: library/ctypes ctypes Array _length_9858880 +Ref: 2e659858880 +Ref: library/ctypes ctypes Array _type_9859109 +Ref: 2e669859109 +Ref: library/ctypes ctypes ARRAY9859307 +Ref: 29e9859307 +Ref: library/ctypes ctypes _Pointer9859603 +Ref: 2e679859603 +Ref: library/ctypes ctypes _Pointer _type_9860261 +Ref: 15439860261 +Ref: library/ctypes ctypes _Pointer contents9860331 +Ref: 2e1d9860331 +Node: Command Line Interface Libraries9860521 +Ref: library/cmdlinelibs doc9860688 +Ref: 2e689860688 +Ref: library/cmdlinelibs cmdlinelibs9860688 +Ref: 2e699860688 +Ref: library/cmdlinelibs command-line-interface-libraries9860688 +Ref: 2e6a9860688 +Node: argparse — Parser for command-line options arguments and subcommands9861605 +Ref: library/argparse doc9861797 +Ref: 2e6b9861797 +Ref: library/argparse argparse-parser-for-command-line-options-arguments-and-subcommands9861797 +Ref: 2e6c9861797 +Ref: library/argparse module-argparse9861797 +Ref: 69861797 +Ref: argparse — Parser for command-line options arguments and subcommands-Footnote-19864865 +Node: ArgumentParser objects9864933 +Ref: library/argparse argumentparser-objects9865094 +Ref: 2e719865094 +Ref: library/argparse argparse ArgumentParser9865159 +Ref: 5359865159 +Node: prog9867925 +Ref: library/argparse id19868002 +Ref: 2e7e9868002 +Ref: library/argparse prog9868002 +Ref: 2e729868002 +Node: usage9869503 +Ref: library/argparse usage9869600 +Ref: 2e739869600 +Node: description9870333 +Ref: library/argparse description9870432 +Ref: 2e749870432 +Ref: library/argparse id29870432 +Ref: 2e7f9870432 +Node: epilog9870965 +Ref: library/argparse epilog9871066 +Ref: 2e759871066 +Node: parents9871834 +Ref: library/argparse parents9871939 +Ref: 2e769871939 +Node: formatter_class9873391 +Ref: library/argparse formatter-class9873502 +Ref: 2e779873502 +Ref: library/argparse id39873502 +Ref: 2e809873502 +Ref: library/argparse argparse RawDescriptionHelpFormatter9873718 +Ref: 2e819873718 +Ref: library/argparse argparse RawTextHelpFormatter9873766 +Ref: 2e829873766 +Ref: library/argparse argparse ArgumentDefaultsHelpFormatter9873807 +Ref: 189b9873807 +Ref: library/argparse argparse MetavarTypeHelpFormatter9873857 +Ref: 2e839873857 +Node: prefix_chars9877323 +Ref: library/argparse prefix-chars9877448 +Ref: 2e789877448 +Node: fromfile_prefix_chars9878196 +Ref: library/argparse fromfile-prefix-chars9878322 +Ref: 2e799878322 +Node: argument_default9880300 +Ref: library/argparse argument-default9880426 +Ref: 2e7a9880426 +Node: allow_abbrev9881312 +Ref: library/argparse allow-abbrev9881433 +Ref: dbf9881433 +Ref: library/argparse id49881433 +Ref: 2e889881433 +Node: conflict_handler9882086 +Ref: library/argparse conflict-handler9882199 +Ref: 2e7b9882199 +Node: add_help9883746 +Ref: library/argparse add-help9883860 +Ref: 2e7c9883860 +Node: exit_on_error9885023 +Ref: library/argparse exit-on-error9885112 +Ref: 2e7d9885112 +Node: The add_argument method9885994 +Ref: library/argparse the-add-argument-method9886185 +Ref: 2e899886185 +Ref: library/argparse argparse ArgumentParser add_argument9886258 +Ref: 19e9886258 +Node: name or flags9888238 +Ref: library/argparse id59888326 +Ref: 2e929888326 +Ref: library/argparse name-or-flags9888326 +Ref: 2e8a9888326 +Node: action9889473 +Ref: library/argparse action9889575 +Ref: 2e8b9889575 +Ref: library/argparse id69889575 +Ref: 2e939889575 +Node: nargs9895957 +Ref: library/argparse id79896051 +Ref: 2e959896051 +Ref: library/argparse nargs9896051 +Ref: 15ad9896051 +Node: const9900257 +Ref: library/argparse const9900352 +Ref: 2e8c9900352 +Ref: library/argparse id89900352 +Ref: 2e979900352 +Node: default9901645 +Ref: library/argparse default9901739 +Ref: 2e8d9901739 +Ref: library/argparse id99901739 +Ref: 2e989901739 +Node: type9904183 +Ref: library/argparse argparse-type9904279 +Ref: 2e999904279 +Ref: library/argparse type9904279 +Ref: 2e849904279 +Node: choices9907273 +Ref: library/argparse choices9907370 +Ref: 15aa9907370 +Ref: library/argparse id109907370 +Ref: 2e9b9907370 +Node: required9908947 +Ref: library/argparse id119909044 +Ref: 2e9c9909044 +Ref: library/argparse required9909044 +Ref: 2e8e9909044 +Node: help9909999 +Ref: library/argparse help9910096 +Ref: 2e8f9910096 +Ref: library/argparse id129910096 +Ref: 2e9d9910096 +Node: metavar9911605 +Ref: library/argparse id139911698 +Ref: 2e9e9911698 +Ref: library/argparse metavar9911698 +Ref: 2e909911698 +Node: dest9913913 +Ref: library/argparse dest9914012 +Ref: 2e859914012 +Ref: library/argparse id149914012 +Ref: 2e9f9914012 +Node: deprecated9915645 +Ref: library/argparse deprecated9915751 +Ref: 2e919915751 +Ref: library/argparse id159915751 +Ref: 2ea09915751 +Node: Action classes9916665 +Ref: library/argparse action-classes9916758 +Ref: 2ea19916758 +Ref: library/argparse argparse Action9917051 +Ref: 17fe9917051 +Ref: library/argparse argparse Action __call__9917945 +Ref: 2ea29917945 +Ref: library/argparse argparse Action format_usage9919239 +Ref: 2ea39919239 +Ref: library/argparse argparse BooleanOptionalAction9919547 +Ref: 18559919547 +Node: The parse_args method9920137 +Ref: library/argparse the-parse-args-method9920321 +Ref: 2ea49920321 +Ref: library/argparse argparse ArgumentParser parse_args9920390 +Ref: 2e6f9920390 +Node: Option value syntax9921259 +Ref: library/argparse option-value-syntax9921362 +Ref: 2ea79921362 +Node: Invalid arguments9922759 +Ref: library/argparse invalid-arguments9922893 +Ref: 2ea89922893 +Node: Arguments containing -9923878 +Ref: library/argparse arguments-containing9924031 +Ref: 2ea99924031 +Node: Argument abbreviations prefix matching9926119 +Ref: library/argparse argument-abbreviations-prefix-matching9926270 +Ref: 2eaa9926270 +Ref: library/argparse prefix-matching9926270 +Ref: dbe9926270 +Node: Beyond sys argv9927198 +Ref: library/argparse args9927347 +Ref: 2ea59927347 +Ref: library/argparse beyond-sys-argv9927347 +Ref: 2eab9927347 +Node: The Namespace object9928309 +Ref: library/argparse namespace9928411 +Ref: 2ea69928411 +Ref: library/argparse the-namespace-object9928411 +Ref: 2eac9928411 +Ref: library/argparse argparse Namespace9928474 +Ref: 2e709928474 +Node: Other utilities9929609 +Ref: library/argparse other-utilities9929783 +Ref: 2ead9929783 +Node: Sub-commands9930095 +Ref: library/argparse sub-commands9930184 +Ref: 2eae9930184 +Ref: library/argparse argparse ArgumentParser add_subparsers9930231 +Ref: c179930231 +Node: FileType objects9939618 +Ref: library/argparse filetype-objects9939731 +Ref: 2eaf9939731 +Ref: library/argparse argparse FileType9939786 +Ref: f169939786 +Node: Argument groups9941255 +Ref: library/argparse argument-groups9941372 +Ref: 2eb09941372 +Ref: library/argparse argparse ArgumentParser add_argument_group9941425 +Ref: 2eb19941425 +Node: Mutual exclusion9944215 +Ref: library/argparse mutual-exclusion9944331 +Ref: 2eb29944331 +Ref: library/argparse argparse ArgumentParser add_mutually_exclusive_group9944386 +Ref: 2eb39944386 +Node: Parser defaults9947107 +Ref: library/argparse parser-defaults9947221 +Ref: 2eb49947221 +Ref: library/argparse argparse ArgumentParser set_defaults9947274 +Ref: 2e879947274 +Ref: library/argparse argparse ArgumentParser get_default9948398 +Ref: 2eb59948398 +Node: Printing help9948754 +Ref: library/argparse printing-help9948867 +Ref: 2eb69948867 +Ref: library/argparse argparse ArgumentParser print_usage9949096 +Ref: 2eb79949096 +Ref: library/argparse argparse ArgumentParser print_help9949328 +Ref: 2eb89949328 +Ref: library/argparse argparse ArgumentParser format_usage9949682 +Ref: 19ca9949682 +Ref: library/argparse argparse ArgumentParser format_help9949861 +Ref: 2eb99949861 +Node: Partial parsing9950074 +Ref: library/argparse partial-parsing9950196 +Ref: 2eba9950196 +Ref: library/argparse argparse ArgumentParser parse_known_args9950249 +Ref: 2ebb9950249 +Node: Customizing file parsing9951413 +Ref: library/argparse customizing-file-parsing9951537 +Ref: 2ebc9951537 +Ref: library/argparse argparse ArgumentParser convert_arg_line_to_args9951608 +Ref: 2e869951608 +Node: Exiting methods9952513 +Ref: library/argparse exiting-methods9952640 +Ref: 2ebd9952640 +Ref: library/argparse argparse ArgumentParser exit9952693 +Ref: 2ebe9952693 +Ref: library/argparse argparse ArgumentParser error9953256 +Ref: 2ebf9953256 +Node: Intermixed parsing9953455 +Ref: library/argparse intermixed-parsing9953593 +Ref: 2ec09953593 +Ref: library/argparse argparse ArgumentParser parse_intermixed_args9953652 +Ref: b009953652 +Ref: library/argparse argparse ArgumentParser parse_known_intermixed_args9953740 +Ref: 2ec19953740 +Node: Registering custom types or actions9955385 +Ref: library/argparse registering-custom-types-or-actions9955499 +Ref: 2ec29955499 +Ref: library/argparse argparse ArgumentParser register9955592 +Ref: 2e949955592 +Node: Exceptions<9>9957060 +Ref: library/argparse exceptions9957204 +Ref: 2ec39957204 +Ref: library/argparse argparse ArgumentError9957247 +Ref: 2ec49957247 +Ref: library/argparse argparse ArgumentTypeError9957491 +Ref: 2e9a9957491 +Node: Argparse Tutorial9957737 +Ref: howto/argparse doc9957848 +Ref: 2ec59957848 +Ref: howto/argparse argparse-tutorial9957848 +Ref: 2e6e9957848 +Ref: howto/argparse id19957848 +Ref: 2ec69957848 +Node: Concepts9959111 +Ref: howto/argparse concepts9959192 +Ref: 2ec79959192 +Node: The basics9961286 +Ref: howto/argparse the-basics9961408 +Ref: 2ec89961408 +Node: Introducing Positional arguments9962573 +Ref: howto/argparse introducing-positional-arguments9962717 +Ref: 2ec99962717 +Node: Introducing Optional arguments9965997 +Ref: howto/argparse introducing-optional-arguments9966174 +Ref: 2eca9966174 +Node: Short options9969158 +Ref: howto/argparse short-options9969238 +Ref: 2ecb9969238 +Node: Combining Positional and Optional arguments9970031 +Ref: howto/argparse combining-positional-and-optional-arguments9970206 +Ref: 2ecc9970206 +Node: Getting a little more advanced9978284 +Ref: howto/argparse getting-a-little-more-advanced9978465 +Ref: 2ecd9978465 +Node: Specifying ambiguous arguments9980471 +Ref: howto/argparse id29980596 +Ref: 2ece9980596 +Ref: howto/argparse specifying-ambiguous-arguments9980596 +Ref: 2e969980596 +Node: Conflicting options9981552 +Ref: howto/argparse conflicting-options9981677 +Ref: 2ecf9981677 +Node: How to translate the argparse output9984778 +Ref: howto/argparse how-to-translate-the-argparse-output9984938 +Ref: 2ed09984938 +Ref: How to translate the argparse output-Footnote-19986708 +Node: Custom type converters9986741 +Ref: howto/argparse custom-type-converters9986881 +Ref: 2ed29986881 +Node: Conclusion9988647 +Ref: howto/argparse conclusion9988742 +Ref: 2ed39988742 +Ref: howto/argparse-optparse upgrading-optparse-code9989009 +Ref: 11a09989009 +Node: Migrating optparse code to argparse9989011 +Ref: howto/argparse-optparse doc9989122 +Ref: 2ed49989122 +Ref: howto/argparse-optparse migrating-optparse-code9989122 +Ref: 2ed59989122 +Ref: howto/argparse-optparse migrating-optparse-code-to-argparse9989122 +Ref: 2ed69989122 +Node: optparse — Parser for command line options9992141 +Ref: library/optparse doc9992377 +Ref: 2edc9992377 +Ref: library/optparse module-optparse9992377 +Ref: a09992377 +Ref: library/optparse optparse-parser-for-command-line-options9992377 +Ref: 2edd9992377 +Ref: optparse — Parser for command line options-Footnote-19992845 +Node: Choosing an argument parsing library9992913 +Ref: library/optparse choosing-an-argument-parser9993054 +Ref: 2e6d9993054 +Ref: library/optparse choosing-an-argument-parsing-library9993054 +Ref: 2ede9993054 +Ref: Choosing an argument parsing library-Footnote-19998690 +Ref: Choosing an argument parsing library-Footnote-29998730 +Ref: Choosing an argument parsing library-Footnote-39998770 +Node: Introduction<7>9998818 +Ref: library/optparse introduction9998978 +Ref: 2edf9998978 +Node: Background10001409 +Ref: library/optparse background10001544 +Ref: 2ee010001544 +Ref: library/optparse optparse-background10001544 +Ref: 2ee110001544 +Node: Terminology10002141 +Ref: library/optparse optparse-terminology10002229 +Ref: 2ee210002229 +Ref: library/optparse terminology10002229 +Ref: 2ee310002229 +Node: What are options for?10006090 +Ref: library/optparse optparse-what-options-for10006221 +Ref: 2ee410006221 +Ref: library/optparse what-are-options-for10006221 +Ref: 2ee510006221 +Node: What are positional arguments for?10007906 +Ref: library/optparse optparse-what-positional-arguments-for10008017 +Ref: 2ee610008017 +Ref: library/optparse what-are-positional-arguments-for10008017 +Ref: 2ee710008017 +Node: Tutorial<2>10009352 +Ref: library/optparse optparse-tutorial10009487 +Ref: 2ee810009487 +Ref: library/optparse tutorial10009487 +Ref: 2ee910009487 +Node: Understanding option actions10012106 +Ref: library/optparse optparse-understanding-option-actions10012207 +Ref: 2eee10012207 +Ref: library/optparse understanding-option-actions10012207 +Ref: 2eef10012207 +Node: The store action10012798 +Ref: library/optparse optparse-store-action10012937 +Ref: 2ef110012937 +Ref: library/optparse the-store-action10012937 +Ref: 2ef210012937 +Node: Handling boolean flag options10015133 +Ref: library/optparse handling-boolean-flag-options10015257 +Ref: 2ef310015257 +Ref: library/optparse optparse-handling-boolean-options10015257 +Ref: 2ef410015257 +Node: Other actions10016142 +Ref: library/optparse optparse-other-actions10016264 +Ref: 2ef510016264 +Ref: library/optparse other-actions10016264 +Ref: 2ef610016264 +Node: Default values10016723 +Ref: library/optparse default-values10016831 +Ref: 2efa10016831 +Ref: library/optparse optparse-default-values10016831 +Ref: 2efb10016831 +Node: Generating help10018726 +Ref: library/optparse generating-help10018846 +Ref: 2efc10018846 +Ref: library/optparse optparse-generating-help10018846 +Ref: 2efd10018846 +Node: Grouping Options10023020 +Ref: library/optparse grouping-options10023088 +Ref: 2efe10023088 +Ref: library/optparse optparse OptionGroup10023419 +Ref: 2eff10023419 +Ref: library/optparse optparse OptionParser get_option_group10026917 +Ref: 2f0010026917 +Node: Printing a version string10027187 +Ref: library/optparse optparse-printing-version-string10027320 +Ref: 2f0110027320 +Ref: library/optparse printing-a-version-string10027320 +Ref: 2f0210027320 +Ref: library/optparse optparse OptionParser print_version10028204 +Ref: 2f0310028204 +Ref: library/optparse optparse OptionParser get_version10028578 +Ref: 2f0510028578 +Node: How optparse handles errors10028722 +Ref: library/optparse how-optparse-handles-errors10028863 +Ref: 2f0610028863 +Ref: library/optparse optparse-how-optparse-handles-errors10028863 +Ref: 2f0710028863 +Node: Putting it all together10030953 +Ref: library/optparse optparse-putting-it-all-together10031060 +Ref: 2f0810031060 +Ref: library/optparse putting-it-all-together10031060 +Ref: 2f0910031060 +Node: Reference Guide10031978 +Ref: library/optparse optparse-reference-guide10032119 +Ref: 2ef810032119 +Ref: library/optparse reference-guide10032119 +Ref: 2f0a10032119 +Node: Creating the parser10032460 +Ref: library/optparse creating-the-parser10032561 +Ref: 2f0b10032561 +Ref: library/optparse optparse-creating-parser10032561 +Ref: 2f0c10032561 +Ref: library/optparse optparse OptionParser10032706 +Ref: 149810032706 +Node: Populating the parser10035712 +Ref: library/optparse optparse-populating-parser10035838 +Ref: 2f0e10035838 +Ref: library/optparse populating-the-parser10035838 +Ref: 2f0f10035838 +Node: Defining options10037124 +Ref: library/optparse defining-options10037248 +Ref: 2f1010037248 +Ref: library/optparse optparse-defining-options10037248 +Ref: 2f1110037248 +Ref: library/optparse optparse OptionParser add_option10037664 +Ref: 2ed710037664 +Ref: library/optparse optparse Values10039755 +Ref: 2ed910039755 +Node: Option attributes10041001 +Ref: library/optparse option-attributes10041127 +Ref: 2f1510041127 +Ref: library/optparse optparse-option-attributes10041127 +Ref: 2f1610041127 +Ref: library/optparse optparse Option10041184 +Ref: 2f1210041184 +Ref: library/optparse optparse Option action10041802 +Ref: 2eea10041802 +Ref: library/optparse optparse Option type10042025 +Ref: 2eeb10042025 +Ref: library/optparse optparse Option dest10042242 +Ref: 2eec10042242 +Ref: library/optparse optparse Option default10042587 +Ref: 2f1810042587 +Ref: library/optparse optparse Option nargs10042781 +Ref: 2f1a10042781 +Ref: library/optparse optparse Option const10043014 +Ref: 2ef710043014 +Ref: library/optparse optparse Option choices10043124 +Ref: 2f1b10043124 +Ref: library/optparse optparse Option callback10043248 +Ref: 2f1c10043248 +Ref: library/optparse optparse Option callback_args10043480 +Ref: 2f1d10043480 +Ref: library/optparse optparse Option callback_kwargs10043516 +Ref: 2f1e10043516 +Ref: library/optparse optparse Option help10043680 +Ref: 2eed10043680 +Ref: library/optparse optparse Option metavar10044028 +Ref: 2f1f10044028 +Node: Standard option actions10044233 +Ref: library/optparse optparse-standard-option-actions10044364 +Ref: 2f1310044364 +Ref: library/optparse standard-option-actions10044364 +Ref: 2f2010044364 +Node: Standard option types10052451 +Ref: library/optparse optparse-standard-option-types10052582 +Ref: 2f1710052582 +Ref: library/optparse standard-option-types10052582 +Ref: 2f2110052582 +Node: Parsing arguments10054060 +Ref: library/optparse optparse-parsing-arguments10054212 +Ref: 2f1410054212 +Ref: library/optparse parsing-arguments10054212 +Ref: 2f2210054212 +Ref: library/optparse optparse OptionParser parse_args10054378 +Ref: 149910054378 +Node: Querying and manipulating your option parser10055765 +Ref: library/optparse optparse-querying-manipulating-option-parser10055921 +Ref: 2f2310055921 +Ref: library/optparse querying-and-manipulating-your-option-parser10055921 +Ref: 2f2410055921 +Ref: library/optparse optparse OptionParser disable_interspersed_args10056230 +Ref: 2ed810056230 +Ref: library/optparse optparse OptionParser enable_interspersed_args10057020 +Ref: 2f2510057020 +Ref: library/optparse optparse OptionParser get_option10057226 +Ref: 2f2610057226 +Ref: library/optparse optparse OptionParser has_option10057399 +Ref: 2f2710057399 +Ref: library/optparse optparse OptionParser remove_option10057575 +Ref: 2f2810057575 +Node: Conflicts between options10057961 +Ref: library/optparse conflicts-between-options10058107 +Ref: 2f2910058107 +Ref: library/optparse optparse-conflicts-between-options10058107 +Ref: 2f0d10058107 +Node: Cleanup10060578 +Ref: library/optparse cleanup10060693 +Ref: 2f2b10060693 +Ref: library/optparse optparse-cleanup10060693 +Ref: 2f2c10060693 +Node: Other methods10061106 +Ref: library/optparse optparse-other-methods10061187 +Ref: 2f2d10061187 +Ref: library/optparse other-methods10061187 +Ref: 2f2e10061187 +Ref: library/optparse optparse OptionParser set_usage10061289 +Ref: 2f2f10061289 +Ref: library/optparse optparse OptionParser print_usage10061578 +Ref: 2f0410061578 +Ref: library/optparse optparse OptionParser get_usage10061914 +Ref: 2f3010061914 +Ref: library/optparse optparse OptionParser set_defaults10062052 +Ref: 2f1910062052 +Node: Option Callbacks10063220 +Ref: library/optparse option-callbacks10063368 +Ref: 2f3110063368 +Ref: library/optparse optparse-option-callbacks10063368 +Ref: 2ef910063368 +Node: Defining a callback option10064585 +Ref: library/optparse defining-a-callback-option10064697 +Ref: 2f3210064697 +Ref: library/optparse optparse-defining-callback-option10064697 +Ref: 2f3310064697 +Node: How callbacks are called10066922 +Ref: library/optparse how-callbacks-are-called10067071 +Ref: 2f3410067071 +Ref: library/optparse optparse-how-callbacks-called10067071 +Ref: 2f3510067071 +Node: Raising errors in a callback10069687 +Ref: library/optparse optparse-raising-errors-in-callback10069845 +Ref: 2f3610069845 +Ref: library/optparse raising-errors-in-a-callback10069845 +Ref: 2f3710069845 +Node: Callback example 1 trivial callback10070323 +Ref: library/optparse callback-example-1-trivial-callback10070494 +Ref: 2f3810070494 +Ref: library/optparse optparse-callback-example-110070494 +Ref: 2f3910070494 +Node: Callback example 2 check option order10070942 +Ref: library/optparse callback-example-2-check-option-order10071134 +Ref: 2f3a10071134 +Ref: library/optparse optparse-callback-example-210071134 +Ref: 2f3b10071134 +Node: Callback example 3 check option order generalized10071692 +Ref: library/optparse callback-example-3-check-option-order-generalized10071893 +Ref: 2f3c10071893 +Ref: library/optparse optparse-callback-example-310071893 +Ref: 2f3d10071893 +Node: Callback example 4 check arbitrary condition10072666 +Ref: library/optparse callback-example-4-check-arbitrary-condition10072864 +Ref: 2f3e10072864 +Ref: library/optparse optparse-callback-example-410072864 +Ref: 2f3f10072864 +Node: Callback example 5 fixed arguments10073659 +Ref: library/optparse callback-example-5-fixed-arguments10073845 +Ref: 2f4010073845 +Ref: library/optparse optparse-callback-example-510073845 +Ref: 2f4110073845 +Node: Callback example 6 variable arguments10074919 +Ref: library/optparse callback-example-6-variable-arguments10075052 +Ref: 2f4210075052 +Ref: library/optparse optparse-callback-example-610075052 +Ref: 2f4310075052 +Node: Extending optparse10077157 +Ref: library/optparse extending-optparse10077304 +Ref: 2f4410077304 +Ref: library/optparse optparse-extending-optparse10077304 +Ref: 2ef010077304 +Node: Adding new types10077641 +Ref: library/optparse adding-new-types10077739 +Ref: 2f4510077739 +Ref: library/optparse optparse-adding-new-types10077739 +Ref: 2f4610077739 +Ref: library/optparse optparse Option TYPES10078035 +Ref: 2f4710078035 +Ref: library/optparse optparse Option TYPE_CHECKER10078194 +Ref: 2f4810078194 +Node: Adding new actions10081233 +Ref: library/optparse adding-new-actions10081331 +Ref: 2f4910081331 +Ref: library/optparse optparse-adding-new-actions10081331 +Ref: 2f4a10081331 +Ref: library/optparse optparse Option ACTIONS10082434 +Ref: 2f4b10082434 +Ref: library/optparse optparse Option STORE_ACTIONS10082510 +Ref: 2f4c10082510 +Ref: library/optparse optparse Option TYPED_ACTIONS10082603 +Ref: 2f4d10082603 +Ref: library/optparse optparse Option ALWAYS_TYPED_ACTIONS10082696 +Ref: 2f4e10082696 +Node: Exceptions<10>10086001 +Ref: library/optparse exceptions10086123 +Ref: 2f4f10086123 +Ref: library/optparse optparse OptionError10086166 +Ref: 2eda10086166 +Ref: library/optparse optparse OptionConflictError10086307 +Ref: 2f2a10086307 +Ref: library/optparse optparse OptionValueError10086435 +Ref: 2edb10086435 +Ref: library/optparse optparse BadOptionError10086558 +Ref: 2f5010086558 +Ref: library/optparse optparse AmbiguousOptionError10086663 +Ref: 2f5110086663 +Node: getpass — Portable password input10086776 +Ref: library/getpass doc10087002 +Ref: 2f5210087002 +Ref: library/getpass getpass-portable-password-input10087002 +Ref: 2f5310087002 +Ref: library/getpass module-getpass10087002 +Ref: 6210087002 +Ref: library/getpass getpass getpass10087415 +Ref: 2f5410087415 +Ref: library/getpass getpass GetPassWarning10088264 +Ref: 2f5510088264 +Ref: library/getpass getpass getuser10088392 +Ref: 41410088392 +Ref: getpass — Portable password input-Footnote-110089101 +Node: fileinput — Iterate over lines from multiple input streams10089168 +Ref: library/fileinput doc10089406 +Ref: 2f5610089406 +Ref: library/fileinput fileinput-iterate-over-lines-from-multiple-input-streams10089406 +Ref: 2f5710089406 +Ref: library/fileinput module-fileinput10089406 +Ref: 5b10089406 +Ref: library/fileinput fileinput input10091726 +Ref: 7fb10091726 +Ref: library/fileinput fileinput filename10092972 +Ref: 2f5810092972 +Ref: library/fileinput fileinput fileno10093128 +Ref: 13f910093128 +Ref: library/fileinput fileinput lineno10093327 +Ref: 2f5910093327 +Ref: library/fileinput fileinput filelineno10093600 +Ref: 2f5a10093600 +Ref: library/fileinput fileinput isfirstline10093866 +Ref: 2f5b10093866 +Ref: library/fileinput fileinput isstdin10094018 +Ref: 2f5c10094018 +Ref: library/fileinput fileinput nextfile10094161 +Ref: 2f5d10094161 +Ref: library/fileinput fileinput close10094701 +Ref: 2f5e10094701 +Ref: library/fileinput fileinput FileInput10094872 +Ref: 73210094872 +Ref: library/fileinput fileinput hook_compressed10097589 +Ref: 7fc10097589 +Ref: library/fileinput fileinput hook_encoded10098390 +Ref: ca010098390 +Ref: fileinput — Iterate over lines from multiple input streams-Footnote-110098992 +Node: curses — Terminal handling for character-cell displays10099061 +Ref: library/curses doc10099320 +Ref: 2f5f10099320 +Ref: library/curses curses-terminal-handling-for-character-cell-displays10099320 +Ref: 2f6010099320 +Ref: library/curses module-curses10099320 +Ref: 2b10099320 +Ref: curses — Terminal handling for character-cell displays-Footnote-110101028 +Node: Functions<6>10101091 +Ref: library/curses curses-functions10101219 +Ref: 2f6210101219 +Ref: library/curses functions10101219 +Ref: 2f6310101219 +Ref: library/curses curses error10101321 +Ref: 2f6410101321 +Ref: library/curses curses baudrate10101689 +Ref: 2f6610101689 +Ref: library/curses curses beep10102041 +Ref: 2f6710102041 +Ref: library/curses curses can_change_color10102107 +Ref: 2f6810102107 +Ref: library/curses curses cbreak10102279 +Ref: 2f6910102279 +Ref: library/curses curses color_content10102757 +Ref: 7ec10102757 +Ref: library/curses curses color_pair10103140 +Ref: 2f6b10103140 +Ref: library/curses curses curs_set10103527 +Ref: 2f6f10103527 +Ref: library/curses curses def_prog_mode10103955 +Ref: 2f7010103955 +Ref: library/curses curses def_shell_mode10104283 +Ref: 2f7210104283 +Ref: library/curses curses delay_output10104629 +Ref: 2f7410104629 +Ref: library/curses curses doupdate10104719 +Ref: 2f7510104719 +Ref: library/curses curses echo10105544 +Ref: 2f7910105544 +Ref: library/curses curses endwin10105680 +Ref: 2f7a10105680 +Ref: library/curses curses erasechar10105783 +Ref: 2f7b10105783 +Ref: library/curses curses filter10106051 +Ref: 2f7c10106051 +Ref: library/curses curses flash10106662 +Ref: 2f7d10106662 +Ref: library/curses curses flushinp10106925 +Ref: 2f7e10106925 +Ref: library/curses curses getmouse10107111 +Ref: 2f7f10107111 +Ref: library/curses curses getsyx10108112 +Ref: 2f8910108112 +Ref: library/curses curses getwin10108323 +Ref: 2f8b10108323 +Ref: library/curses curses has_colors10108578 +Ref: 2f8d10108578 +Ref: library/curses curses has_extended_color_support10108710 +Ref: 7f010108710 +Ref: library/curses curses has_ic10109096 +Ref: 2f8e10109096 +Ref: library/curses curses has_il10109352 +Ref: 2f8f10109352 +Ref: library/curses curses has_key10109649 +Ref: 2f9010109649 +Ref: library/curses curses halfdelay10109803 +Ref: 2f9110109803 +Ref: library/curses curses init_color10110241 +Ref: 7ed10110241 +Ref: library/curses curses init_pair10110897 +Ref: 7ee10110897 +Ref: library/curses curses initscr10111618 +Ref: 15a210111618 +Ref: library/curses curses is_term_resized10111893 +Ref: 2f9510111893 +Ref: library/curses curses isendwin10112064 +Ref: 2f9610112064 +Ref: library/curses curses keyname10112222 +Ref: 2f9710112222 +Ref: library/curses curses killchar10112753 +Ref: 2f9810112753 +Ref: library/curses curses longname10113024 +Ref: 2f9910113024 +Ref: library/curses curses meta10113299 +Ref: 2f9a10113299 +Ref: library/curses curses mouseinterval10113456 +Ref: 2f9b10113456 +Ref: library/curses curses mousemask10113763 +Ref: 2f9c10113763 +Ref: library/curses curses napms10114183 +Ref: 15a110114183 +Ref: library/curses curses newpad10114251 +Ref: 2f9d10114251 +Ref: library/curses curses newwin10115339 +Ref: 2f9e10115339 +Ref: library/curses curses nl10115706 +Ref: 2f9f10115706 +Ref: library/curses curses nocbreak10115921 +Ref: 2f9210115921 +Ref: library/curses curses noecho10116042 +Ref: 2fa010116042 +Ref: library/curses curses nonl10116141 +Ref: 2fa110116141 +Ref: library/curses curses noqiflush10116634 +Ref: 2fa210116634 +Ref: library/curses curses noraw10117024 +Ref: 2fa310117024 +Ref: library/curses curses pair_content10117139 +Ref: 7ef10117139 +Ref: library/curses curses pair_number10117365 +Ref: 2f6e10117365 +Ref: library/curses curses putp10117557 +Ref: 2fa410117557 +Ref: library/curses curses qiflush10117803 +Ref: 2fa510117803 +Ref: library/curses curses raw10118069 +Ref: 2f6a10118069 +Ref: library/curses curses reset_prog_mode10118311 +Ref: 2f7110118311 +Ref: library/curses curses reset_shell_mode10118459 +Ref: 2f7310118459 +Ref: library/curses curses resetty10118607 +Ref: 2fa610118607 +Ref: library/curses curses resize_term10118749 +Ref: 15ac10118749 +Ref: library/curses curses resizeterm10119288 +Ref: 15ab10119288 +Ref: library/curses curses savetty10119561 +Ref: 2fa710119561 +Ref: library/curses curses get_escdelay10119696 +Ref: 8ef10119696 +Ref: library/curses curses set_escdelay10119822 +Ref: 8f010119822 +Ref: library/curses curses get_tabsize10120120 +Ref: 8f110120120 +Ref: library/curses curses set_tabsize10120244 +Ref: 8f210120244 +Ref: library/curses curses setsyx10120457 +Ref: 2fa810120457 +Ref: library/curses curses setupterm10120627 +Ref: 2fa910120627 +Ref: library/curses curses start_color10121044 +Ref: 2faa10121044 +Ref: library/curses curses termattrs10121737 +Ref: 2fad10121737 +Ref: library/curses curses termname10121967 +Ref: 2fae10121967 +Ref: library/curses curses tigetflag10122116 +Ref: 2faf10122116 +Ref: library/curses curses tigetnum10122432 +Ref: 2fb010122432 +Ref: library/curses curses tigetstr10122748 +Ref: 2fb110122748 +Ref: library/curses curses tparm10123058 +Ref: 2fb210123058 +Ref: library/curses curses typeahead10123395 +Ref: 2fb310123395 +Ref: library/curses curses unctrl10123988 +Ref: 2fb410123988 +Ref: library/curses curses ungetch10124269 +Ref: 2fb510124269 +Ref: library/curses curses update_lines_cols10124446 +Ref: deb10124446 +Ref: library/curses curses unget_wch10124642 +Ref: 109110124642 +Ref: library/curses curses ungetmouse10124863 +Ref: 2fb610124863 +Ref: library/curses curses use_env10125029 +Ref: 2fb710125029 +Ref: library/curses curses use_default_colors10125539 +Ref: 2f9310125539 +Ref: library/curses curses wrapper10125972 +Ref: a8010125972 +Node: Window Objects10126798 +Ref: library/curses curses-window-objects10126947 +Ref: 2f9410126947 +Ref: library/curses window-objects10126947 +Ref: 2fb810126947 +Ref: library/curses curses window addch10127127 +Ref: 2fb910127127 +Ref: library/curses curses window addnstr10127730 +Ref: 2fba10127730 +Ref: library/curses curses window addstr10127989 +Ref: 2f7710127989 +Ref: library/curses curses window attroff10128989 +Ref: 2fbb10128989 +Ref: library/curses curses window attron10129134 +Ref: 2fbc10129134 +Ref: library/curses curses window attrset10129275 +Ref: 2fbd10129275 +Ref: library/curses curses window bkgd10129423 +Ref: 2fbe10129423 +Ref: library/curses curses window bkgdset10129868 +Ref: 2fbf10129868 +Ref: library/curses curses window border10130434 +Ref: 2fc010130434 +Ref: library/curses curses window box10132442 +Ref: 2fc710132442 +Ref: library/curses curses window chgat10132670 +Ref: 2fc810132670 +Ref: library/curses curses window clear10133294 +Ref: 2fca10133294 +Ref: library/curses curses window clearok10133449 +Ref: 2fcc10133449 +Ref: library/curses curses window clrtobot10133594 +Ref: 2fcd10133594 +Ref: library/curses curses window clrtoeol10133791 +Ref: 2fce10133791 +Ref: library/curses curses window cursyncup10133871 +Ref: 2fcf10133871 +Ref: library/curses curses window delch10134039 +Ref: 2fd010134039 +Ref: library/curses curses window deleteln10134118 +Ref: 2fd110134118 +Ref: library/curses curses window derwin10134242 +Ref: 2fd210134242 +Ref: library/curses curses window echochar10134652 +Ref: 2fd410134652 +Ref: library/curses curses window enclose10134806 +Ref: 18d710134806 +Ref: library/curses curses window encoding10135226 +Ref: 108f10135226 +Ref: library/curses curses window erase10135607 +Ref: 2fcb10135607 +Ref: library/curses curses window getbegyx10135660 +Ref: 2fd510135660 +Ref: library/curses curses window getbkgd10135763 +Ref: 2fd610135763 +Ref: library/curses curses window getch10135878 +Ref: 154010135878 +Ref: library/curses curses window get_wch10136198 +Ref: 109010136198 +Ref: library/curses curses window getkey10136466 +Ref: 2fd710136466 +Ref: library/curses curses window getmaxyx10136774 +Ref: 2fd810136774 +Ref: library/curses curses window getparyx10136879 +Ref: 2fd910136879 +Ref: library/curses curses window getstr10137083 +Ref: 2fda10137083 +Ref: library/curses curses window getyx10137299 +Ref: 2fdb10137299 +Ref: library/curses curses window hline10137440 +Ref: 2fdc10137440 +Ref: library/curses curses window idcok10137626 +Ref: 2fdd10137626 +Ref: library/curses curses window idlok10137972 +Ref: 2fde10137972 +Ref: library/curses curses window immedok10138165 +Ref: 2fdf10138165 +Ref: library/curses curses window inch10138514 +Ref: 2fe010138514 +Ref: library/curses curses window insch10138702 +Ref: 2fe110138702 +Ref: library/curses curses window insdelln10138916 +Ref: 2fe210138916 +Ref: library/curses curses window insertln10139295 +Ref: 2fe310139295 +Ref: library/curses curses window insnstr10139425 +Ref: 2fe410139425 +Ref: library/curses curses window insstr10139938 +Ref: 2fe510139938 +Ref: library/curses curses window instr10140357 +Ref: 2fe610140357 +Ref: library/curses curses window is_linetouched10140753 +Ref: 2fe710140753 +Ref: library/curses curses window is_wintouched10141036 +Ref: 2fe810141036 +Ref: library/curses curses window keypad10141216 +Ref: 2fe910141216 +Ref: library/curses curses window leaveok10141484 +Ref: 2f8a10141484 +Ref: library/curses curses window move10141835 +Ref: 2fea10141835 +Ref: library/curses curses window mvderwin10141918 +Ref: 2feb10141918 +Ref: library/curses curses window mvwin10142195 +Ref: 2fec10142195 +Ref: library/curses curses window nodelay10142311 +Ref: 2fed10142311 +Ref: library/curses curses window notimeout10142420 +Ref: 2fee10142420 +Ref: library/curses curses window noutrefresh10142684 +Ref: 2f7610142684 +Ref: library/curses curses window overlay10142958 +Ref: 2fef10142958 +Ref: library/curses curses window overwrite10143607 +Ref: 2ff010143607 +Ref: library/curses curses window putwin10144259 +Ref: 2f8c10144259 +Ref: library/curses curses window redrawln10144465 +Ref: 2ff110144465 +Ref: library/curses curses window redrawwin10144671 +Ref: 2ff210144671 +Ref: library/curses curses window refresh10144817 +Ref: 2f7810144817 +Ref: library/curses curses window resize10145838 +Ref: 2ff310145838 +Ref: library/curses curses window scroll10146190 +Ref: 2ff410146190 +Ref: library/curses curses window scrollok10146298 +Ref: 2ff510146298 +Ref: library/curses curses window setscrreg10146834 +Ref: 2ff610146834 +Ref: library/curses curses window standend10147003 +Ref: 2ff710147003 +Ref: library/curses curses window standout10147154 +Ref: 2ff810147154 +Ref: library/curses curses window subpad10147224 +Ref: 2ff910147224 +Ref: library/curses curses window subwin10147463 +Ref: 2fd310147463 +Ref: library/curses curses window syncdown10147821 +Ref: 2ffa10147821 +Ref: library/curses curses window syncok10148067 +Ref: 2ffb10148067 +Ref: library/curses curses window syncup10148230 +Ref: 2ffc10148230 +Ref: library/curses curses window timeout10148356 +Ref: 2ffd10148356 +Ref: library/curses curses window touchline10148859 +Ref: 2fc910148859 +Ref: library/curses curses window touchwin10149167 +Ref: 2ffe10149167 +Ref: library/curses curses window untouchwin10149292 +Ref: 2fff10149292 +Ref: library/curses curses window vline10149425 +Ref: 178810149425 +Ref: Window Objects-Footnote-110149684 +Node: Constants<6>10149727 +Ref: library/curses constants10149855 +Ref: 300010149855 +Ref: library/curses curses ERR10149960 +Ref: 300110149960 +Ref: library/curses curses OK10150105 +Ref: 300210150105 +Ref: library/curses curses version10150248 +Ref: 300310150248 +Ref: library/curses curses __version__10150274 +Ref: 300410150274 +Ref: library/curses curses ncurses_version10150373 +Ref: 9e610150373 +Ref: library/curses curses COLORS10150792 +Ref: 2fab10150792 +Ref: library/curses curses COLOR_PAIRS10150948 +Ref: 2fac10150948 +Ref: library/curses curses COLS10151114 +Ref: 170c10151114 +Ref: library/curses curses LINES10151374 +Ref: 170b10151374 +Ref: library/curses curses A_ALTCHARSET10151927 +Ref: 300510151927 +Ref: library/curses curses A_BLINK10152031 +Ref: 300610152031 +Ref: library/curses curses A_BOLD10152130 +Ref: 300710152130 +Ref: library/curses curses A_DIM10152228 +Ref: 300810152228 +Ref: library/curses curses A_INVIS10152328 +Ref: 300910152328 +Ref: library/curses curses A_ITALIC10152442 +Ref: 300a10152442 +Ref: library/curses curses A_NORMAL10152543 +Ref: 2f6510152543 +Ref: library/curses curses A_PROTECT10152650 +Ref: 300b10152650 +Ref: library/curses curses A_REVERSE10152754 +Ref: 2f6d10152754 +Ref: library/curses curses A_STANDOUT10152896 +Ref: 2f6c10152896 +Ref: library/curses curses A_UNDERLINE10152970 +Ref: 300c10152970 +Ref: library/curses curses A_HORIZONTAL10153045 +Ref: 300d10153045 +Ref: library/curses curses A_LEFT10153140 +Ref: 300e10153140 +Ref: library/curses curses A_LOW10153243 +Ref: 300f10153243 +Ref: library/curses curses A_RIGHT10153348 +Ref: 301010153348 +Ref: library/curses curses A_TOP10153451 +Ref: 301110153451 +Ref: library/curses curses A_VERTICAL10153541 +Ref: 301210153541 +Ref: library/curses curses A_ATTRIBUTES10153931 +Ref: 301310153931 +Ref: library/curses curses A_CHARTEXT10154042 +Ref: 301410154042 +Ref: library/curses curses A_COLOR10154163 +Ref: 301510154163 +Ref: library/curses curses KEY_MIN10154611 +Ref: 301610154611 +Ref: library/curses curses KEY_BREAK10154723 +Ref: 301710154723 +Ref: library/curses curses KEY_DOWN10154837 +Ref: 301810154837 +Ref: library/curses curses KEY_UP10154938 +Ref: 301910154938 +Ref: library/curses curses KEY_LEFT10155041 +Ref: 301a10155041 +Ref: library/curses curses KEY_RIGHT10155145 +Ref: 301b10155145 +Ref: library/curses curses KEY_HOME10155248 +Ref: 301c10155248 +Ref: library/curses curses KEY_BACKSPACE10155353 +Ref: 301d10155353 +Ref: library/curses curses KEY_F010155452 +Ref: 301e10155452 +Ref: library/curses curses KEY_Fn10155628 +Ref: 301f10155628 +Ref: library/curses curses KEY_DL10155746 +Ref: 302010155746 +Ref: library/curses curses KEY_IL10155850 +Ref: 302110155850 +Ref: library/curses curses KEY_DC10155954 +Ref: 302210155954 +Ref: library/curses curses KEY_IC10156063 +Ref: 302310156063 +Ref: library/curses curses KEY_EIC10156189 +Ref: 302410156189 +Ref: library/curses curses KEY_CLEAR10156305 +Ref: 302510156305 +Ref: library/curses curses KEY_EOS10156408 +Ref: 302610156408 +Ref: library/curses curses KEY_EOL10156523 +Ref: 302710156523 +Ref: library/curses curses KEY_SF10156635 +Ref: 302810156635 +Ref: library/curses curses KEY_SR10156749 +Ref: 302910156749 +Ref: library/curses curses KEY_NPAGE10156877 +Ref: 302a10156877 +Ref: library/curses curses KEY_PPAGE10156979 +Ref: 302b10156979 +Ref: library/curses curses KEY_STAB10157084 +Ref: 302c10157084 +Ref: library/curses curses KEY_CTAB10157184 +Ref: 302d10157184 +Ref: library/curses curses KEY_CATAB10157287 +Ref: 302e10157287 +Ref: library/curses curses KEY_ENTER10157394 +Ref: 302f10157394 +Ref: library/curses curses KEY_SRESET10157514 +Ref: 303010157514 +Ref: library/curses curses KEY_RESET10157639 +Ref: 303110157639 +Ref: library/curses curses KEY_PRINT10157764 +Ref: 303210157764 +Ref: library/curses curses KEY_LL10157859 +Ref: 303310157859 +Ref: library/curses curses KEY_A110157984 +Ref: 303410157984 +Ref: library/curses curses KEY_A310158097 +Ref: 303510158097 +Ref: library/curses curses KEY_B210158211 +Ref: 303610158211 +Ref: library/curses curses KEY_C110158320 +Ref: 303710158320 +Ref: library/curses curses KEY_C310158433 +Ref: 303810158433 +Ref: library/curses curses KEY_BTAB10158549 +Ref: 303910158549 +Ref: library/curses curses KEY_BEG10158649 +Ref: 303a10158649 +Ref: library/curses curses KEY_CANCEL10158760 +Ref: 303b10158760 +Ref: library/curses curses KEY_CLOSE10158858 +Ref: 303c10158858 +Ref: library/curses curses KEY_COMMAND10158939 +Ref: 303d10158939 +Ref: library/curses curses KEY_COPY10159031 +Ref: 303e10159031 +Ref: library/curses curses KEY_CREATE10159130 +Ref: 303f10159130 +Ref: library/curses curses KEY_END10159226 +Ref: 304010159226 +Ref: library/curses curses KEY_EXIT10159323 +Ref: 304110159323 +Ref: library/curses curses KEY_FIND10159420 +Ref: 304210159420 +Ref: library/curses curses KEY_HELP10159517 +Ref: 304310159517 +Ref: library/curses curses KEY_MARK10159614 +Ref: 304410159614 +Ref: library/curses curses KEY_MESSAGE10159695 +Ref: 304510159695 +Ref: library/curses curses KEY_MOVE10159781 +Ref: 304610159781 +Ref: library/curses curses KEY_NEXT10159878 +Ref: 304710159878 +Ref: library/curses curses KEY_OPEN10159975 +Ref: 304810159975 +Ref: library/curses curses KEY_OPTIONS10160056 +Ref: 304910160056 +Ref: library/curses curses KEY_PREVIOUS10160126 +Ref: 304a10160126 +Ref: library/curses curses KEY_REDO10160220 +Ref: 304b10160220 +Ref: library/curses curses KEY_REFERENCE10160301 +Ref: 304c10160301 +Ref: library/curses curses KEY_REFRESH10160379 +Ref: 304d10160379 +Ref: library/curses curses KEY_REPLACE10160449 +Ref: 304e10160449 +Ref: library/curses curses KEY_RESTART10160519 +Ref: 304f10160519 +Ref: library/curses curses KEY_RESUME10160607 +Ref: 305010160607 +Ref: library/curses curses KEY_SAVE10160704 +Ref: 305110160704 +Ref: library/curses curses KEY_SBEG10160801 +Ref: 305210160801 +Ref: library/curses curses KEY_SCANCEL10160901 +Ref: 305310160901 +Ref: library/curses curses KEY_SCOMMAND10160978 +Ref: 305410160978 +Ref: library/curses curses KEY_SCOPY10161073 +Ref: 305510161073 +Ref: library/curses curses KEY_SCREATE10161161 +Ref: 305610161161 +Ref: library/curses curses KEY_SDC10161253 +Ref: 305710161253 +Ref: library/curses curses KEY_SDL10161365 +Ref: 305810161365 +Ref: library/curses curses KEY_SELECT10161480 +Ref: 305910161480 +Ref: library/curses curses KEY_SEND10161577 +Ref: 305a10161577 +Ref: library/curses curses KEY_SEOL10161681 +Ref: 305b10161681 +Ref: library/curses curses KEY_SEXIT10161793 +Ref: 305c10161793 +Ref: library/curses curses KEY_SFIND10161898 +Ref: 305d10161898 +Ref: library/curses curses KEY_SHELP10162003 +Ref: 305e10162003 +Ref: library/curses curses KEY_SHOME10162108 +Ref: 305f10162108 +Ref: library/curses curses KEY_SIC10162211 +Ref: 306010162211 +Ref: library/curses curses KEY_SLEFT10162319 +Ref: 306110162319 +Ref: library/curses curses KEY_SMESSAGE10162413 +Ref: 306210162413 +Ref: library/curses curses KEY_SMOVE10162508 +Ref: 306310162508 +Ref: library/curses curses KEY_SNEXT10162613 +Ref: 306410162613 +Ref: library/curses curses KEY_SOPTIONS10162701 +Ref: 306510162701 +Ref: library/curses curses KEY_SPREVIOUS10162779 +Ref: 306610162779 +Ref: library/curses curses KEY_SPRINT10162872 +Ref: 306710162872 +Ref: library/curses curses KEY_SREDO10162977 +Ref: 306810162977 +Ref: library/curses curses KEY_SREPLACE10163065 +Ref: 306910163065 +Ref: library/curses curses KEY_SRIGHT10163161 +Ref: 306a10163161 +Ref: library/curses curses KEY_SRSUME10163273 +Ref: 306b10163273 +Ref: library/curses curses KEY_SSAVE10163379 +Ref: 306c10163379 +Ref: library/curses curses KEY_SSUSPEND10163467 +Ref: 306d10163467 +Ref: library/curses curses KEY_SUNDO10163562 +Ref: 306e10163562 +Ref: library/curses curses KEY_SUSPEND10163650 +Ref: 306f10163650 +Ref: library/curses curses KEY_UNDO10163736 +Ref: 307010163736 +Ref: library/curses curses KEY_MOUSE10163834 +Ref: 2f8010163834 +Ref: library/curses curses KEY_RESIZE10163952 +Ref: 307110163952 +Ref: library/curses curses KEY_MAX10164063 +Ref: 307210164063 +Ref: library/curses curses-acs-codes10165266 +Ref: 307310165266 +Ref: library/curses curses ACS_BBSS10165843 +Ref: 307410165843 +Ref: library/curses curses ACS_BLOCK10165971 +Ref: 307510165971 +Ref: library/curses curses ACS_BOARD10166079 +Ref: 307610166079 +Ref: library/curses curses ACS_BSBS10166184 +Ref: 307710166184 +Ref: library/curses curses ACS_BSSB10166308 +Ref: 307810166308 +Ref: library/curses curses ACS_BSSS10166434 +Ref: 307910166434 +Ref: library/curses curses ACS_BTEE10166550 +Ref: 307a10166550 +Ref: library/curses curses ACS_BULLET10166634 +Ref: 307b10166634 +Ref: library/curses curses ACS_CKBOARD10166701 +Ref: 307c10166701 +Ref: library/curses curses ACS_DARROW10166785 +Ref: 307d10166785 +Ref: library/curses curses ACS_DEGREE10166865 +Ref: 307e10166865 +Ref: library/curses curses ACS_DIAMOND10166939 +Ref: 307f10166939 +Ref: library/curses curses ACS_GEQUAL10167007 +Ref: 308010167007 +Ref: library/curses curses ACS_HLINE10167109 +Ref: 2fc210167109 +Ref: library/curses curses ACS_LANTERN10167197 +Ref: 308110167197 +Ref: library/curses curses ACS_LARROW10167272 +Ref: 308210167272 +Ref: library/curses curses ACS_LEQUAL10167343 +Ref: 308310167343 +Ref: library/curses curses ACS_LLCORNER10167425 +Ref: 2fc510167425 +Ref: library/curses curses ACS_LRCORNER10167508 +Ref: 2fc610167508 +Ref: library/curses curses ACS_LTEE10167608 +Ref: 308410167608 +Ref: library/curses curses ACS_NEQUAL10167690 +Ref: 308510167690 +Ref: library/curses curses ACS_PI10167779 +Ref: 308610167779 +Ref: library/curses curses ACS_PLMINUS10167864 +Ref: 308710167864 +Ref: library/curses curses ACS_PLUS10167959 +Ref: 308810167959 +Ref: library/curses curses ACS_RARROW10168046 +Ref: 308910168046 +Ref: library/curses curses ACS_RTEE10168134 +Ref: 308a10168134 +Ref: library/curses curses ACS_S110168231 +Ref: 308b10168231 +Ref: library/curses curses ACS_S310168332 +Ref: 308c10168332 +Ref: library/curses curses ACS_S710168433 +Ref: 308d10168433 +Ref: library/curses curses ACS_S910168534 +Ref: 308e10168534 +Ref: library/curses curses ACS_SBBS10168637 +Ref: 308f10168637 +Ref: library/curses curses ACS_SBSB10168764 +Ref: 309010168764 +Ref: library/curses curses ACS_SBSS10168886 +Ref: 309110168886 +Ref: library/curses curses ACS_SSBB10169004 +Ref: 309210169004 +Ref: library/curses curses ACS_SSBS10169130 +Ref: 309310169130 +Ref: library/curses curses ACS_SSSB10169249 +Ref: 309410169249 +Ref: library/curses curses ACS_SSSS10169366 +Ref: 309510169366 +Ref: library/curses curses ACS_STERLING10169480 +Ref: 309610169480 +Ref: library/curses curses ACS_TTEE10169571 +Ref: 309710169571 +Ref: library/curses curses ACS_UARROW10169652 +Ref: 309810169652 +Ref: library/curses curses ACS_ULCORNER10169721 +Ref: 2fc310169721 +Ref: library/curses curses ACS_URCORNER10169799 +Ref: 2fc410169799 +Ref: library/curses curses ACS_VLINE10169895 +Ref: 2fc110169895 +Ref: library/curses curses BUTTONn_PRESSED10170275 +Ref: 2f8110170275 +Ref: library/curses curses BUTTONn_RELEASED10170420 +Ref: 2f8210170420 +Ref: library/curses curses BUTTONn_CLICKED10170564 +Ref: 2f8310170564 +Ref: library/curses curses BUTTONn_DOUBLE_CLICKED10170685 +Ref: 2f8410170685 +Ref: library/curses curses BUTTONn_TRIPLE_CLICKED10170797 +Ref: 2f8510170797 +Ref: library/curses curses BUTTON_SHIFT10170929 +Ref: 2f8610170929 +Ref: library/curses curses BUTTON_CTRL10171089 +Ref: 2f8710171089 +Ref: library/curses curses BUTTON_ALT10171251 +Ref: 2f8810171251 +Ref: library/curses curses COLOR_BLACK10171696 +Ref: 309910171696 +Ref: library/curses curses COLOR_BLUE10171782 +Ref: 309a10171782 +Ref: library/curses curses COLOR_CYAN10171879 +Ref: 309b10171879 +Ref: library/curses curses COLOR_GREEN10171980 +Ref: 309c10171980 +Ref: library/curses curses COLOR_MAGENTA10172048 +Ref: 309d10172048 +Ref: library/curses curses COLOR_RED10172150 +Ref: 309e10172150 +Ref: library/curses curses COLOR_WHITE10172229 +Ref: 309f10172229 +Ref: library/curses curses COLOR_YELLOW10172297 +Ref: 30a010172297 +Node: curses textpad — Text input widget for curses programs10172357 +Ref: library/curses curses-textpad-text-input-widget-for-curses-programs10172603 +Ref: 30a110172603 +Ref: library/curses module-curses textpad10172603 +Ref: 2e10172603 +Ref: library/curses curses textpad rectangle10173191 +Ref: 30a310173191 +Node: Textbox objects10173914 +Ref: library/curses curses-textpad-objects10174022 +Ref: 30a410174022 +Ref: library/curses textbox-objects10174022 +Ref: 30a510174022 +Ref: library/curses curses textpad Textbox10174136 +Ref: 30a210174136 +Ref: library/curses curses textpad Textbox edit10174615 +Ref: 30a710174615 +Ref: library/curses curses textpad Textbox do_command10175186 +Ref: 30a810175186 +Ref: library/curses curses textpad Textbox gather10178916 +Ref: 30a910178916 +Ref: library/curses curses textpad Textbox stripspaces10179109 +Ref: 30a610179109 +Node: curses ascii — Utilities for ASCII characters10179520 +Ref: library/curses ascii doc10179761 +Ref: 30aa10179761 +Ref: library/curses ascii curses-ascii-utilities-for-ascii-characters10179761 +Ref: 30ab10179761 +Ref: library/curses ascii module-curses ascii10179761 +Ref: 2c10179761 +Ref: library/curses ascii curses ascii NUL10180355 +Ref: 30ac10180355 +Ref: library/curses ascii curses ascii SOH10180393 +Ref: 30ad10180393 +Ref: library/curses ascii curses ascii STX10180477 +Ref: 30ae10180477 +Ref: library/curses ascii curses ascii ETX10180539 +Ref: 30af10180539 +Ref: library/curses ascii curses ascii EOT10180599 +Ref: 30b010180599 +Ref: library/curses ascii curses ascii ENQ10180667 +Ref: 30b110180667 +Ref: library/curses ascii curses ascii ACK10180764 +Ref: 30b210180764 +Ref: library/curses ascii curses ascii BEL10180828 +Ref: 30b310180828 +Ref: library/curses ascii curses ascii BS10180881 +Ref: 30b410180881 +Ref: library/curses ascii curses ascii TAB10180938 +Ref: 30b510180938 +Ref: library/curses ascii curses ascii HT10180990 +Ref: 30b610180990 +Ref: library/curses ascii curses ascii LF10181086 +Ref: 30b710181086 +Ref: library/curses ascii curses ascii NL10181143 +Ref: 30b810181143 +Ref: library/curses ascii curses ascii VT10181232 +Ref: 30b910181232 +Ref: library/curses ascii curses ascii FF10181292 +Ref: 30ba10181292 +Ref: library/curses ascii curses ascii CR10181349 +Ref: 30bb10181349 +Ref: library/curses ascii curses ascii SO10181412 +Ref: 30bc10181412 +Ref: library/curses ascii curses ascii SI10181500 +Ref: 30bd10181500 +Ref: library/curses ascii curses ascii DLE10181586 +Ref: 30be10181586 +Ref: library/curses ascii curses ascii DC110181651 +Ref: 30bf10181651 +Ref: library/curses ascii curses ascii DC210181721 +Ref: 30c010181721 +Ref: library/curses ascii curses ascii DC310181811 +Ref: 30c110181811 +Ref: library/curses ascii curses ascii DC410181882 +Ref: 30c210181882 +Ref: library/curses ascii curses ascii NAK10181947 +Ref: 30c310181947 +Ref: library/curses ascii curses ascii SYN10182020 +Ref: 30c410182020 +Ref: library/curses ascii curses ascii ETB10182085 +Ref: 30c510182085 +Ref: library/curses ascii curses ascii CAN10182156 +Ref: 30c610182156 +Ref: library/curses ascii curses ascii EM10182211 +Ref: 30c710182211 +Ref: library/curses ascii curses ascii SUB10182272 +Ref: 30c810182272 +Ref: library/curses ascii curses ascii ESC10182331 +Ref: 30c910182331 +Ref: library/curses ascii curses ascii FS10182386 +Ref: 30ca10182386 +Ref: library/curses ascii curses ascii GS10182448 +Ref: 30cb10182448 +Ref: library/curses ascii curses ascii RS10182511 +Ref: 30cc10182511 +Ref: library/curses ascii curses ascii US10182598 +Ref: 30cd10182598 +Ref: library/curses ascii curses ascii SP10182660 +Ref: 30ce10182660 +Ref: library/curses ascii curses ascii DEL10182713 +Ref: 30cf10182713 +Ref: library/curses ascii curses ascii isalnum10183011 +Ref: 30d010183011 +Ref: library/curses ascii curses ascii isalpha10183158 +Ref: 30d110183158 +Ref: library/curses ascii curses ascii isascii10183303 +Ref: 30d210183303 +Ref: library/curses ascii curses ascii isblank10183412 +Ref: 30d310183412 +Ref: library/curses ascii curses ascii iscntrl10183525 +Ref: 30d410183525 +Ref: library/curses ascii curses ascii isdigit10183651 +Ref: 30d510183651 +Ref: library/curses ascii curses ascii isgraph10183815 +Ref: 30d610183815 +Ref: library/curses ascii curses ascii islower10183916 +Ref: 30d710183916 +Ref: library/curses ascii curses ascii isprint10184004 +Ref: 30d810184004 +Ref: library/curses ascii curses ascii ispunct10184108 +Ref: 30d910184108 +Ref: library/curses ascii curses ascii isspace10184251 +Ref: 30da10184251 +Ref: library/curses ascii curses ascii isupper10184419 +Ref: 30db10184419 +Ref: library/curses ascii curses ascii isxdigit10184503 +Ref: 30dc10184503 +Ref: library/curses ascii curses ascii isctrl10184646 +Ref: 30dd10184646 +Ref: library/curses ascii curses ascii ismeta10184755 +Ref: 30de10184755 +Ref: library/curses ascii curses ascii ascii10185355 +Ref: 30df10185355 +Ref: library/curses ascii curses ascii ctrl10185462 +Ref: 30e010185462 +Ref: library/curses ascii curses ascii alt10185630 +Ref: 30e110185630 +Ref: library/curses ascii curses ascii unctrl10185902 +Ref: 30e210185902 +Ref: library/curses ascii curses ascii controlnames10186457 +Ref: 30e310186457 +Ref: curses ascii — Utilities for ASCII characters-Footnote-110186739 +Node: curses panel — A panel stack extension for curses10186811 +Ref: library/curses panel doc10186987 +Ref: 30e410186987 +Ref: library/curses panel curses-panel-a-panel-stack-extension-for-curses10186987 +Ref: 30e510186987 +Ref: library/curses panel module-curses panel10186987 +Ref: 2d10186987 +Node: Functions<7>10187463 +Ref: library/curses panel cursespanel-functions10187585 +Ref: 30e610187585 +Ref: library/curses panel functions10187585 +Ref: 30e710187585 +Ref: library/curses panel curses panel bottom_panel10187693 +Ref: 30e810187693 +Ref: library/curses panel curses panel new_panel10187788 +Ref: 30e910187788 +Ref: library/curses panel curses panel top_panel10188090 +Ref: 30ea10188090 +Ref: library/curses panel curses panel update_panels10188179 +Ref: 30eb10188179 +Node: Panel Objects10188390 +Ref: library/curses panel curses-panel-objects10188512 +Ref: 30ec10188512 +Ref: library/curses panel panel-objects10188512 +Ref: 30ed10188512 +Ref: library/curses panel curses panel Panel above10188866 +Ref: 30ee10188866 +Ref: library/curses panel curses panel Panel below10188943 +Ref: 30ef10188943 +Ref: library/curses panel curses panel Panel bottom10189020 +Ref: 30f010189020 +Ref: library/curses panel curses panel Panel hidden10189098 +Ref: 30f110189098 +Ref: library/curses panel curses panel Panel hide10189218 +Ref: 30f210189218 +Ref: library/curses panel curses panel Panel move10189352 +Ref: 30f310189352 +Ref: library/curses panel curses panel Panel replace10189444 +Ref: 30f410189444 +Ref: library/curses panel curses panel Panel set_userptr10189548 +Ref: 30f510189548 +Ref: library/curses panel curses panel Panel show10189742 +Ref: 30f610189742 +Ref: library/curses panel curses panel Panel top10189825 +Ref: 30f710189825 +Ref: library/curses panel curses panel Panel userptr10189893 +Ref: 30f810189893 +Ref: library/curses panel curses panel Panel window10190008 +Ref: 30f910190008 +Node: Concurrent Execution10190096 +Ref: library/concurrency doc10190271 +Ref: 30fa10190271 +Ref: library/concurrency concurrency10190271 +Ref: 30fb10190271 +Ref: library/concurrency concurrent-execution10190271 +Ref: 30fc10190271 +Node: threading — Thread-based parallelism10191224 +Ref: library/threading doc10191373 +Ref: 30fd10191373 +Ref: library/threading module-threading10191373 +Ref: ed10191373 +Ref: library/threading threading-thread-based-parallelism10191373 +Ref: 30fe10191373 +Ref: threading — Thread-based parallelism-Footnote-110192120 +Node: Introduction<8>10192189 +Ref: library/threading introduction10192322 +Ref: 30ff10192322 +Ref: Introduction<8>-Footnote-110195204 +Node: GIL and performance considerations10195261 +Ref: library/threading gil-and-performance-considerations10195415 +Ref: 310010195415 +Ref: GIL and performance considerations-Footnote-110196220 +Node: Reference<2>10196262 +Ref: library/threading reference10196460 +Ref: 310110196460 +Ref: library/threading threading active_count10196545 +Ref: 30410196545 +Ref: library/threading threading current_thread10196836 +Ref: 30310196836 +Ref: library/threading threading excepthook10197233 +Ref: 84710197233 +Ref: library/threading threading __excepthook__10198569 +Ref: 84610198569 +Ref: library/threading threading get_ident10198841 +Ref: 114e10198841 +Ref: library/threading threading get_native_id10199237 +Ref: a3d10199237 +Ref: library/threading threading enumerate10199791 +Ref: 18a510199791 +Ref: library/threading threading main_thread10200175 +Ref: fcd10200175 +Ref: library/threading threading settrace10200402 +Ref: 84410200402 +Ref: library/threading threading settrace_all_threads10200659 +Ref: 4c410200659 +Ref: library/threading threading gettrace10201014 +Ref: 84210201014 +Ref: library/threading threading setprofile10201142 +Ref: 84510201142 +Ref: library/threading threading setprofile_all_threads10201405 +Ref: 4c510201405 +Ref: library/threading threading getprofile10201766 +Ref: 84310201766 +Ref: library/threading threading stack_size10201901 +Ref: 310210201901 +Ref: library/threading threading TIMEOUT_MAX10203227 +Ref: 310310203227 +Node: Thread-local data10204446 +Ref: library/threading thread-local-data10204535 +Ref: 310410204535 +Ref: library/threading threading local10207649 +Ref: 154e10207649 +Node: Thread objects10207726 +Ref: library/threading id110207836 +Ref: 310510207836 +Ref: library/threading thread-objects10207836 +Ref: 310610207836 +Ref: library/threading threading Thread10210514 +Ref: 94c10210514 +Ref: library/threading threading Thread start10211964 +Ref: 2cbc10211964 +Ref: library/threading threading Thread run10212341 +Ref: a3c10212341 +Ref: library/threading meth-thread-join10213153 +Ref: 310710213153 +Ref: library/threading threading Thread join10213153 +Ref: 11d610213153 +Ref: library/threading threading Thread name10214424 +Ref: 30210214424 +Ref: library/threading threading Thread getName10214642 +Ref: 310810214642 +Ref: library/threading threading Thread setName10214670 +Ref: 30110214670 +Ref: library/threading threading Thread ident10214852 +Ref: 2c4910214852 +Ref: library/threading threading Thread native_id10215244 +Ref: a3e10215244 +Ref: library/threading threading Thread is_alive10216057 +Ref: 94d10216057 +Ref: library/threading threading Thread daemon10216395 +Ref: 30010216395 +Ref: library/threading threading Thread isDaemon10216989 +Ref: 310910216989 +Ref: library/threading threading Thread setDaemon10217018 +Ref: 2ff10217018 +Node: Lock objects10217204 +Ref: library/threading id210217310 +Ref: 310a10217310 +Ref: library/threading lock-objects10217310 +Ref: 310b10217310 +Ref: library/threading threading Lock10218727 +Ref: 167710218727 +Ref: library/threading threading Lock acquire10219130 +Ref: 69410219130 +Ref: library/threading threading Lock release10220467 +Ref: 12b510220467 +Ref: library/threading threading Lock locked10220952 +Ref: 310d10220952 +Node: RLock objects10221034 +Ref: library/threading id310221143 +Ref: 310e10221143 +Ref: library/threading rlock-objects10221143 +Ref: 310f10221143 +Ref: library/threading threading RLock10222512 +Ref: 2e210222512 +Ref: library/threading threading RLock acquire10223034 +Ref: e7610223034 +Ref: library/threading threading RLock release10225021 +Ref: 311010225021 +Node: Condition objects10225718 +Ref: library/threading condition-objects10225832 +Ref: 311110225832 +Ref: library/threading id410225832 +Ref: 311210225832 +Ref: library/threading threading Condition10228951 +Ref: 114910228951 +Ref: library/threading threading Condition acquire10229494 +Ref: 311310229494 +Ref: library/threading threading Condition release10229706 +Ref: 311410229706 +Ref: library/threading threading Condition wait10229889 +Ref: 18b110229889 +Ref: library/threading threading Condition wait_for10231419 +Ref: 311510231419 +Ref: library/threading threading Condition notify10232393 +Ref: 17dc10232393 +Ref: library/threading threading Condition notify_all10233295 +Ref: 2fd10233295 +Node: Semaphore objects10233711 +Ref: library/threading id510233829 +Ref: 311610233829 +Ref: library/threading semaphore-objects10233829 +Ref: 311710233829 +Ref: library/threading threading Semaphore10234528 +Ref: 114a10234528 +Ref: library/threading threading Semaphore acquire10235219 +Ref: 124710235219 +Ref: library/threading threading Semaphore release10236514 +Ref: 311810236514 +Ref: library/threading threading BoundedSemaphore10236891 +Ref: 114b10236891 +Node: Semaphore example10237422 +Ref: library/threading semaphore-example10237536 +Ref: 311910237536 +Ref: library/threading semaphore-examples10237536 +Ref: 311a10237536 +Node: Event objects10238407 +Ref: library/threading event-objects10238517 +Ref: 311b10238517 +Ref: library/threading id610238517 +Ref: 311c10238517 +Ref: library/threading threading Event10238921 +Ref: 114c10238921 +Ref: library/threading threading Event is_set10239317 +Ref: 2fe10239317 +Ref: library/threading threading Event set10239489 +Ref: 311d10239489 +Ref: library/threading threading Event clear10239717 +Ref: 311e10239717 +Ref: library/threading threading Event wait10239946 +Ref: 131910239946 +Node: Timer objects10240676 +Ref: library/threading id710240784 +Ref: 311f10240784 +Ref: library/threading timer-objects10240784 +Ref: 312010240784 +Ref: library/threading threading Timer10241548 +Ref: 114d10241548 +Ref: library/threading threading Timer cancel10241997 +Ref: 312110241997 +Node: Barrier objects10242187 +Ref: library/threading barrier-objects10242273 +Ref: 312210242273 +Ref: library/threading threading Barrier10243230 +Ref: 11d510243230 +Ref: library/threading threading Barrier wait10243574 +Ref: 312310243574 +Ref: library/threading threading Barrier reset10244722 +Ref: 312410244722 +Ref: library/threading threading Barrier abort10245159 +Ref: 312510245159 +Ref: library/threading threading Barrier parties10245649 +Ref: 312610245649 +Ref: library/threading threading Barrier n_waiting10245741 +Ref: 312710245741 +Ref: library/threading threading Barrier broken10245839 +Ref: 312810245839 +Ref: library/threading threading BrokenBarrierError10245956 +Ref: 11d710245956 +Node: Using locks conditions and semaphores in the with statement10246134 +Ref: library/threading using-locks-conditions-and-semaphores-in-the-with-statement10246289 +Ref: 312910246289 +Ref: library/threading with-locks10246289 +Ref: 310c10246289 +Node: multiprocessing — Process-based parallelism10247130 +Ref: library/multiprocessing doc10247370 +Ref: 312a10247370 +Ref: library/multiprocessing module-multiprocessing10247370 +Ref: 9410247370 +Ref: library/multiprocessing multiprocessing-process-based-parallelism10247370 +Ref: 312b10247370 +Ref: multiprocessing — Process-based parallelism-Footnote-110247911 +Node: Introduction<9>10247984 +Ref: library/multiprocessing introduction10248102 +Ref: 312c10248102 +Node: The Process class10250044 +Ref: library/multiprocessing the-process-class10250148 +Ref: 312d10250148 +Node: Contexts and start methods10251622 +Ref: library/multiprocessing contexts-and-start-methods10251771 +Ref: 313010251771 +Ref: library/multiprocessing multiprocessing-start-methods10251771 +Ref: 2cb10251771 +Ref: library/multiprocessing multiprocessing-start-method-spawn10251966 +Ref: 313110251966 +Ref: library/multiprocessing multiprocessing-start-method-fork10252528 +Ref: 313310252528 +Ref: library/multiprocessing multiprocessing-start-method-forkserver10253613 +Ref: 313410253613 +Ref: Contexts and start methods-Footnote-110257416 +Node: Exchanging objects between processes10257481 +Ref: library/multiprocessing exchanging-objects-between-processes10257646 +Ref: 313510257646 +Node: Synchronization between processes10259543 +Ref: library/multiprocessing synchronization-between-processes10259713 +Ref: 313710259713 +Node: Sharing state between processes10260433 +Ref: library/multiprocessing sharing-state-between-processes10260590 +Ref: 313810260590 +Node: Using a pool of workers10263688 +Ref: library/multiprocessing using-a-pool-of-workers10263803 +Ref: 314010263803 +Node: Reference<3>10267093 +Ref: library/multiprocessing reference10267242 +Ref: 314110267242 +Node: Process and exceptions10267748 +Ref: library/multiprocessing process-and-exceptions10267844 +Ref: 314210267844 +Ref: library/multiprocessing multiprocessing Process10267917 +Ref: b5910267917 +Ref: library/multiprocessing multiprocessing Process run10271065 +Ref: 313210271065 +Ref: library/multiprocessing multiprocessing Process start10271874 +Ref: 312e10271874 +Ref: library/multiprocessing multiprocessing Process join10272123 +Ref: 314610272123 +Ref: library/multiprocessing multiprocessing Process name10272845 +Ref: 314310272845 +Ref: library/multiprocessing multiprocessing Process is_alive10273310 +Ref: 314810273310 +Ref: library/multiprocessing multiprocessing Process daemon10273546 +Ref: 314410273546 +Ref: library/multiprocessing multiprocessing Process pid10274427 +Ref: 314910274427 +Ref: library/multiprocessing multiprocessing Process exitcode10274552 +Ref: 314710274552 +Ref: library/multiprocessing multiprocessing Process authkey10275154 +Ref: 314a10275154 +Ref: library/multiprocessing multiprocessing Process sentinel10275682 +Ref: 10d610275682 +Ref: library/multiprocessing multiprocessing Process terminate10276323 +Ref: 314c10276323 +Ref: library/multiprocessing multiprocessing Process kill10277134 +Ref: b5810277134 +Ref: library/multiprocessing multiprocessing Process close10277292 +Ref: b5710277292 +Ref: library/multiprocessing multiprocessing ProcessError10278587 +Ref: 314d10278587 +Ref: library/multiprocessing multiprocessing BufferTooShort10278699 +Ref: 314e10278699 +Ref: library/multiprocessing multiprocessing AuthenticationError10279008 +Ref: 314f10279008 +Ref: library/multiprocessing multiprocessing TimeoutError10279112 +Ref: 315010279112 +Ref: Process and exceptions-Footnote-110279258 +Node: Pipes and Queues10279314 +Ref: library/multiprocessing pipes-and-queues10279435 +Ref: 315110279435 +Ref: library/multiprocessing multiprocessing Pipe10283143 +Ref: 313610283143 +Ref: library/multiprocessing multiprocessing Queue10283690 +Ref: 17fb10283690 +Ref: library/multiprocessing multiprocessing Queue qsize10284289 +Ref: 315c10284289 +Ref: library/multiprocessing multiprocessing Queue empty10284631 +Ref: 15fc10284631 +Ref: library/multiprocessing multiprocessing Queue full10284918 +Ref: 315d10284918 +Ref: library/multiprocessing multiprocessing Queue put10285113 +Ref: 1a3b10285113 +Ref: library/multiprocessing multiprocessing Queue put_nowait10285940 +Ref: 315e10285940 +Ref: library/multiprocessing multiprocessing Queue get10286023 +Ref: 1a3c10286023 +Ref: library/multiprocessing multiprocessing Queue get_nowait10286811 +Ref: 315910286811 +Ref: library/multiprocessing multiprocessing Queue close10287058 +Ref: 17fc10287058 +Ref: library/multiprocessing multiprocessing Queue join_thread10287517 +Ref: 315f10287517 +Ref: library/multiprocessing multiprocessing Queue cancel_join_thread10288068 +Ref: 315a10288068 +Ref: library/multiprocessing multiprocessing SimpleQueue10289216 +Ref: 91310289216 +Ref: library/multiprocessing multiprocessing SimpleQueue close10289352 +Ref: 91410289352 +Ref: library/multiprocessing multiprocessing SimpleQueue empty10289663 +Ref: 15fd10289663 +Ref: library/multiprocessing multiprocessing SimpleQueue get10289853 +Ref: 316010289853 +Ref: library/multiprocessing multiprocessing SimpleQueue put10289931 +Ref: 316110289931 +Ref: library/multiprocessing multiprocessing JoinableQueue10289998 +Ref: 315210289998 +Ref: library/multiprocessing multiprocessing JoinableQueue task_done10290218 +Ref: 315510290218 +Ref: library/multiprocessing multiprocessing JoinableQueue join10290906 +Ref: 316210290906 +Ref: Pipes and Queues-Footnote-110291410 +Node: Miscellaneous<3>10291474 +Ref: library/multiprocessing miscellaneous10291591 +Ref: 316310291591 +Ref: library/multiprocessing multiprocessing active_children10291640 +Ref: 316410291640 +Ref: library/multiprocessing multiprocessing cpu_count10291857 +Ref: f6a10291857 +Ref: library/multiprocessing multiprocessing current_process10292599 +Ref: 316510292599 +Ref: library/multiprocessing multiprocessing parent_process10292796 +Ref: 316610292796 +Ref: library/multiprocessing multiprocessing freeze_support10293065 +Ref: 154110293065 +Ref: library/multiprocessing multiprocessing get_all_start_methods10294059 +Ref: f6410294059 +Ref: library/multiprocessing multiprocessing get_context10294414 +Ref: 2c910294414 +Ref: library/multiprocessing multiprocessing get_start_method10295002 +Ref: f6510295002 +Ref: library/multiprocessing multiprocessing set_executable10295784 +Ref: 180410295784 +Ref: library/multiprocessing multiprocessing set_forkserver_preload10296328 +Ref: 159a10296328 +Ref: library/multiprocessing multiprocessing set_start_method10297039 +Ref: 2ca10297039 +Ref: Miscellaneous<3>-Footnote-110298143 +Node: Connection Objects10298208 +Ref: library/multiprocessing connection-objects10298335 +Ref: 316710298335 +Ref: library/multiprocessing multiprocessing connection Connection10298654 +Ref: 16aa10298654 +Ref: library/multiprocessing multiprocessing connection Connection send10298704 +Ref: 316910298704 +Ref: library/multiprocessing multiprocessing connection Connection recv10299031 +Ref: 316a10299031 +Ref: library/multiprocessing multiprocessing connection Connection fileno10299324 +Ref: 316b10299324 +Ref: library/multiprocessing multiprocessing connection Connection close10299424 +Ref: 316c10299424 +Ref: library/multiprocessing multiprocessing connection Connection poll10299576 +Ref: 316d10299576 +Ref: library/multiprocessing multiprocessing connection Connection send_bytes10300063 +Ref: 316e10300063 +Ref: library/multiprocessing multiprocessing connection Connection recv_bytes10300522 +Ref: 316f10300522 +Ref: library/multiprocessing multiprocessing connection Connection recv_bytes_into10301164 +Ref: 317010301164 +Ref: library/multiprocessing multiprocessing-recv-pickle-security10302978 +Ref: 317110302978 +Node: Synchronization primitives10303664 +Ref: library/multiprocessing synchronization-primitives10303796 +Ref: 317210303796 +Ref: library/multiprocessing multiprocessing Barrier10304166 +Ref: 313f10304166 +Ref: library/multiprocessing multiprocessing BoundedSemaphore10304327 +Ref: 313d10304327 +Ref: library/multiprocessing multiprocessing Condition10304826 +Ref: 313e10304826 +Ref: library/multiprocessing multiprocessing Event10305161 +Ref: 186310305161 +Ref: library/multiprocessing multiprocessing Lock10305241 +Ref: 159c10305241 +Ref: library/multiprocessing multiprocessing Lock acquire10306084 +Ref: 317310306084 +Ref: library/multiprocessing multiprocessing Lock release10307610 +Ref: 317410307610 +Ref: library/multiprocessing multiprocessing RLock10307979 +Ref: 159d10307979 +Ref: library/multiprocessing multiprocessing RLock acquire10308710 +Ref: 317510308710 +Ref: library/multiprocessing multiprocessing RLock release10310359 +Ref: 317610310359 +Ref: library/multiprocessing multiprocessing Semaphore10311336 +Ref: 313c10311336 +Ref: Synchronization primitives-Footnote-110312200 +Node: Shared ctypes Objects10312264 +Ref: library/multiprocessing shared-ctypes-objects10312386 +Ref: 317710312386 +Ref: library/multiprocessing multiprocessing Value10312563 +Ref: 313910312563 +Ref: library/multiprocessing multiprocessing Array10313992 +Ref: 313a10313992 +Node: The multiprocessing sharedctypes module10315435 +Ref: library/multiprocessing module-multiprocessing sharedctypes10315532 +Ref: 9a10315532 +Ref: library/multiprocessing the-multiprocessing-sharedctypes-module10315532 +Ref: 317810315532 +Ref: library/multiprocessing multiprocessing sharedctypes RawArray10316163 +Ref: 317910316163 +Ref: library/multiprocessing multiprocessing sharedctypes RawValue10316992 +Ref: 317b10316992 +Ref: library/multiprocessing multiprocessing sharedctypes Array10317776 +Ref: 317a10317776 +Ref: library/multiprocessing multiprocessing sharedctypes Value10318543 +Ref: 317c10318543 +Ref: library/multiprocessing multiprocessing sharedctypes copy10319294 +Ref: 317d10319294 +Ref: library/multiprocessing multiprocessing sharedctypes synchronized10319456 +Ref: e3010319456 +Node: Managers10322471 +Ref: library/multiprocessing managers10322580 +Ref: 317e10322580 +Ref: library/multiprocessing multiprocessing-managers10322580 +Ref: 315610322580 +Ref: library/multiprocessing multiprocessing Manager10322930 +Ref: cba10322930 +Ref: library/multiprocessing module-multiprocessing managers10323251 +Ref: 9710323251 +Ref: library/multiprocessing multiprocessing managers BaseManager10323440 +Ref: 318010323440 +Ref: library/multiprocessing multiprocessing managers BaseManager start10324878 +Ref: 318110324878 +Ref: library/multiprocessing multiprocessing managers BaseManager get_server10325113 +Ref: 318310325113 +Ref: library/multiprocessing multiprocessing managers BaseManager connect10325657 +Ref: 318510325657 +Ref: library/multiprocessing multiprocessing managers BaseManager shutdown10325938 +Ref: 318210325938 +Ref: library/multiprocessing multiprocessing managers BaseManager register10326174 +Ref: 318610326174 +Ref: library/multiprocessing multiprocessing managers BaseManager address10328489 +Ref: 318410328489 +Ref: library/multiprocessing multiprocessing managers SyncManager10329020 +Ref: 317f10329020 +Ref: library/multiprocessing multiprocessing managers SyncManager Barrier10329460 +Ref: 318910329460 +Ref: library/multiprocessing multiprocessing managers SyncManager BoundedSemaphore10329652 +Ref: 318a10329652 +Ref: library/multiprocessing multiprocessing managers SyncManager Condition10329808 +Ref: 318b10329808 +Ref: library/multiprocessing multiprocessing managers SyncManager Event10330182 +Ref: 318c10330182 +Ref: library/multiprocessing multiprocessing managers SyncManager Lock10330309 +Ref: 318d10330309 +Ref: library/multiprocessing multiprocessing managers SyncManager Namespace10330434 +Ref: 318e10330434 +Ref: library/multiprocessing multiprocessing managers SyncManager Queue10330559 +Ref: 2cd610330559 +Ref: library/multiprocessing multiprocessing managers SyncManager RLock10330691 +Ref: 318f10330691 +Ref: library/multiprocessing multiprocessing managers SyncManager Semaphore10330817 +Ref: 319010330817 +Ref: library/multiprocessing multiprocessing managers SyncManager Array10330959 +Ref: 319110330959 +Ref: library/multiprocessing multiprocessing managers SyncManager Value10331058 +Ref: 319210331058 +Ref: library/multiprocessing multiprocessing managers SyncManager dict10331203 +Ref: 319310331203 +Ref: library/multiprocessing multiprocessing managers SyncManager list10331384 +Ref: 319410331384 +Ref: library/multiprocessing multiprocessing managers Namespace10331790 +Ref: 313b10331790 +Node: Customized managers10332630 +Ref: library/multiprocessing customized-managers10332725 +Ref: 319510332725 +Node: Using a remote manager10333497 +Ref: library/multiprocessing using-a-remote-manager10333592 +Ref: 319610333592 +Node: Proxy Objects10335733 +Ref: library/multiprocessing multiprocessing-proxy-objects10335834 +Ref: cb910335834 +Ref: library/multiprocessing proxy-objects10335834 +Ref: 319710335834 +Ref: library/multiprocessing multiprocessing managers BaseProxy10339118 +Ref: 318710339118 +Ref: library/multiprocessing multiprocessing managers BaseProxy _callmethod10339239 +Ref: 318810339239 +Ref: library/multiprocessing multiprocessing managers BaseProxy _getvalue10340820 +Ref: 319810340820 +Ref: library/multiprocessing multiprocessing managers BaseProxy __repr__10340980 +Ref: 319910340980 +Ref: library/multiprocessing multiprocessing managers BaseProxy __str__10341066 +Ref: 319a10341066 +Node: Cleanup<2>10341182 +Ref: library/multiprocessing cleanup10341242 +Ref: 319b10341242 +Node: Process Pools10341531 +Ref: library/multiprocessing module-multiprocessing pool10341645 +Ref: 9810341645 +Ref: library/multiprocessing process-pools10341645 +Ref: 319c10341645 +Ref: library/multiprocessing multiprocessing pool Pool10341806 +Ref: f6610341806 +Ref: library/multiprocessing multiprocessing pool Pool apply10344620 +Ref: 319f10344620 +Ref: library/multiprocessing multiprocessing pool Pool apply_async10344991 +Ref: 31a010344991 +Ref: library/multiprocessing multiprocessing pool Pool map10345843 +Ref: 10da10345843 +Ref: library/multiprocessing multiprocessing pool Pool map_async10346628 +Ref: 10db10346628 +Ref: library/multiprocessing multiprocessing pool Pool imap10347483 +Ref: 31a210347483 +Ref: library/multiprocessing multiprocessing pool Pool imap_unordered10348195 +Ref: 31a310348195 +Ref: library/multiprocessing multiprocessing pool Pool starmap10348521 +Ref: 10d710348521 +Ref: library/multiprocessing multiprocessing pool Pool starmap_async10348876 +Ref: 10d810348876 +Ref: library/multiprocessing multiprocessing pool Pool close10349231 +Ref: 319d10349231 +Ref: library/multiprocessing multiprocessing pool Pool terminate10349418 +Ref: 319e10349418 +Ref: library/multiprocessing multiprocessing pool Pool join10349652 +Ref: 31a410349652 +Ref: library/multiprocessing multiprocessing pool AsyncResult10350100 +Ref: 31a110350100 +Ref: library/multiprocessing multiprocessing pool AsyncResult get10350258 +Ref: 31a510350258 +Ref: library/multiprocessing multiprocessing pool AsyncResult wait10350623 +Ref: 31a610350623 +Ref: library/multiprocessing multiprocessing pool AsyncResult ready10350747 +Ref: 31a710350747 +Ref: library/multiprocessing multiprocessing pool AsyncResult successful10350824 +Ref: 31a810350824 +Node: Listeners and Clients10352117 +Ref: library/multiprocessing listeners-and-clients10352237 +Ref: 31a910352237 +Ref: library/multiprocessing module-multiprocessing connection10352237 +Ref: 9510352237 +Ref: library/multiprocessing multiprocessing-listeners-clients10352237 +Ref: 316810352237 +Ref: library/multiprocessing multiprocessing connection deliver_challenge10352773 +Ref: 31aa10352773 +Ref: library/multiprocessing multiprocessing connection answer_challenge10353179 +Ref: 31ab10353179 +Ref: library/multiprocessing multiprocessing connection Client10353493 +Ref: 31ac10353493 +Ref: library/multiprocessing multiprocessing connection Listener10354257 +Ref: 16a910354257 +Ref: library/multiprocessing multiprocessing connection Listener accept10356027 +Ref: 166010356027 +Ref: library/multiprocessing multiprocessing connection Listener close10356309 +Ref: 31ae10356309 +Ref: library/multiprocessing multiprocessing connection Listener address10356609 +Ref: 31af10356609 +Ref: library/multiprocessing multiprocessing connection Listener last_accepted10356705 +Ref: 31b010356705 +Ref: library/multiprocessing multiprocessing connection wait10357125 +Ref: 10d510357125 +Node: Address Formats10361154 +Ref: library/multiprocessing address-formats10361227 +Ref: 31b110361227 +Ref: library/multiprocessing multiprocessing-address-formats10361227 +Ref: 31ad10361227 +Node: Authentication keys10361941 +Ref: library/multiprocessing authentication-keys10362058 +Ref: 31b210362058 +Ref: library/multiprocessing multiprocessing-auth-keys10362058 +Ref: 314b10362058 +Node: Logging<2>10363242 +Ref: library/multiprocessing logging10363370 +Ref: 31b310363370 +Ref: library/multiprocessing multiprocessing get_logger10363638 +Ref: 2d3010363638 +Ref: library/multiprocessing multiprocessing log_to_stderr10364157 +Ref: 31b410364157 +Node: The multiprocessing dummy module10365264 +Ref: library/multiprocessing module-multiprocessing dummy10365364 +Ref: 9610365364 +Ref: library/multiprocessing the-multiprocessing-dummy-module10365364 +Ref: 31b510365364 +Ref: library/multiprocessing multiprocessing pool ThreadPool10365888 +Ref: 191010365888 +Node: Programming guidelines10367647 +Ref: library/multiprocessing multiprocessing-programming10367793 +Ref: 312f10367793 +Ref: library/multiprocessing programming-guidelines10367793 +Ref: 31b610367793 +Node: All start methods10368041 +Ref: library/multiprocessing all-start-methods10368164 +Ref: 31b710368164 +Ref: library/multiprocessing multiprocessing-programming-spawn10374224 +Ref: 314510374224 +Ref: All start methods-Footnote-110374261 +Ref: All start methods-Footnote-210374325 +Ref: All start methods-Footnote-310374389 +Node: The spawn and forkserver start methods10374453 +Ref: library/multiprocessing multiprocessing-programming-forkserver10374576 +Ref: 31b810374576 +Ref: library/multiprocessing the-spawn-and-forkserver-start-methods10374576 +Ref: 31b910374576 +Ref: library/multiprocessing multiprocessing-safe-main-import10375382 +Ref: 31ba10375382 +Node: Examples<14>10376657 +Ref: library/multiprocessing examples10376782 +Ref: 31bb10376782 +Ref: library/multiprocessing multiprocessing-examples10376782 +Ref: 315b10376782 +Node: multiprocessing shared_memory — Shared memory for direct access across processes10385693 +Ref: library/multiprocessing shared_memory doc10385917 +Ref: 31bc10385917 +Ref: library/multiprocessing shared_memory module-multiprocessing shared_memory10385917 +Ref: 9910385917 +Ref: library/multiprocessing shared_memory multiprocessing-shared-memory-shared-memory-for-direct-access-across-processes10385917 +Ref: 31bd10385917 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory10387475 +Ref: 165910387475 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory close10390783 +Ref: 31bf10390783 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory unlink10391260 +Ref: 31c010391260 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory buf10391880 +Ref: 31c110391880 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory name10391969 +Ref: 31c210391969 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory SharedMemory size10392080 +Ref: 31c310392080 +Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager10395170 +Ref: 31be10395170 +Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager SharedMemory10396572 +Ref: 31c410396572 +Ref: library/multiprocessing shared_memory multiprocessing managers SharedMemoryManager ShareableList10396724 +Ref: 31c510396724 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList10398581 +Ref: 196e10398581 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList count10401077 +Ref: 31c610401077 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList index10401165 +Ref: 31c710401165 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList format10401315 +Ref: 31c810401315 +Ref: library/multiprocessing shared_memory multiprocessing shared_memory ShareableList shm10401469 +Ref: 31c910401469 +Ref: multiprocessing shared_memory — Shared memory for direct access across processes-Footnote-110404061 +Ref: multiprocessing shared_memory — Shared memory for direct access across processes-Footnote-210404151 +Ref: multiprocessing shared_memory — Shared memory for direct access across processes-Footnote-310404178 +Node: The concurrent package10404234 +Ref: library/concurrent doc10404460 +Ref: 31ca10404460 +Ref: library/concurrent the-concurrent-package10404460 +Ref: 31cb10404460 +Node: concurrent futures — Launching parallel tasks10404648 +Ref: library/concurrent futures doc10404828 +Ref: 31cc10404828 +Ref: library/concurrent futures concurrent-futures-launching-parallel-tasks10404828 +Ref: 31cd10404828 +Ref: library/concurrent futures module-concurrent futures10404828 +Ref: 2110404828 +Ref: concurrent futures — Launching parallel tasks-Footnote-110405837 +Ref: concurrent futures — Launching parallel tasks-Footnote-210405923 +Node: Executor Objects10406010 +Ref: library/concurrent futures executor-objects10406137 +Ref: 31cf10406137 +Ref: library/concurrent futures concurrent futures Executor10406190 +Ref: 31ce10406190 +Ref: library/concurrent futures concurrent futures Executor submit10406389 +Ref: a8210406389 +Ref: library/concurrent futures concurrent futures Executor map10406799 +Ref: de310406799 +Ref: library/concurrent futures concurrent futures Executor shutdown10408252 +Ref: 8ec10408252 +Node: ThreadPoolExecutor10410355 +Ref: library/concurrent futures threadpoolexecutor10410510 +Ref: 31d010410510 +Ref: library/concurrent futures concurrent futures ThreadPoolExecutor10411580 +Ref: 73d10411580 +Node: ThreadPoolExecutor Example10413955 +Ref: library/concurrent futures id110414036 +Ref: 31d210414036 +Ref: library/concurrent futures threadpoolexecutor-example10414036 +Ref: 11a510414036 +Node: ProcessPoolExecutor10415244 +Ref: library/concurrent futures processpoolexecutor10415397 +Ref: 31d310415397 +Ref: library/concurrent futures concurrent futures ProcessPoolExecutor10416422 +Ref: 8ed10416422 +Node: ProcessPoolExecutor Example10420012 +Ref: library/concurrent futures id210420095 +Ref: 31d510420095 +Ref: library/concurrent futures processpoolexecutor-example10420095 +Ref: 11a610420095 +Node: Future Objects10421001 +Ref: library/concurrent futures future-objects10421152 +Ref: 31d610421152 +Ref: library/concurrent futures concurrent futures Future10421363 +Ref: 11a410421363 +Ref: library/concurrent futures concurrent futures Future cancel10421603 +Ref: 31d710421603 +Ref: library/concurrent futures concurrent futures Future cancelled10421902 +Ref: 31d810421902 +Ref: library/concurrent futures concurrent futures Future running10422002 +Ref: 31d910422002 +Ref: library/concurrent futures concurrent futures Future done10422135 +Ref: 31da10422135 +Ref: library/concurrent futures concurrent futures Future result10422260 +Ref: 31db10422260 +Ref: library/concurrent futures concurrent futures Future exception10422917 +Ref: 31dc10422917 +Ref: library/concurrent futures concurrent futures Future add_done_callback10423557 +Ref: 31dd10423557 +Ref: library/concurrent futures concurrent futures Future set_running_or_notify_cancel10424395 +Ref: 31de10424395 +Ref: library/concurrent futures concurrent futures Future set_result10425382 +Ref: 31df10425382 +Ref: library/concurrent futures concurrent futures Future set_exception10425800 +Ref: 31e010425800 +Node: Module Functions10426253 +Ref: library/concurrent futures module-functions10426402 +Ref: 31e110426402 +Ref: library/concurrent futures concurrent futures wait10426455 +Ref: 186210426455 +Ref: library/concurrent futures concurrent futures FIRST_COMPLETED10427776 +Ref: 31e210427776 +Ref: library/concurrent futures concurrent futures FIRST_EXCEPTION10428085 +Ref: 31e310428085 +Ref: library/concurrent futures concurrent futures ALL_COMPLETED10428606 +Ref: 31e410428606 +Ref: library/concurrent futures concurrent futures as_completed10428808 +Ref: 164d10428808 +Ref: Module Functions-Footnote-110429842 +Node: Exception classes10429884 +Ref: library/concurrent futures exception-classes10430010 +Ref: 31e510430010 +Ref: library/concurrent futures concurrent futures CancelledError10430065 +Ref: 9da10430065 +Ref: library/concurrent futures concurrent futures TimeoutError10430156 +Ref: 31e610430156 +Ref: library/concurrent futures concurrent futures BrokenExecutor10430413 +Ref: 31e710430413 +Ref: library/concurrent futures concurrent futures InvalidStateError10430671 +Ref: 160c10430671 +Ref: library/concurrent futures concurrent futures thread BrokenThreadPool10430855 +Ref: 31d110430855 +Ref: library/concurrent futures concurrent futures process BrokenProcessPool10431115 +Ref: 31d410431115 +Node: subprocess — Subprocess management10431483 +Ref: library/subprocess doc10431666 +Ref: 31e810431666 +Ref: library/subprocess module-subprocess10431666 +Ref: d610431666 +Ref: library/subprocess subprocess-subprocess-management10431666 +Ref: 31e910431666 +Ref: subprocess — Subprocess management-Footnote-110432777 +Ref: subprocess — Subprocess management-Footnote-210432847 +Node: Using the subprocess Module10432889 +Ref: library/subprocess using-the-subprocess-module10433021 +Ref: 31ea10433021 +Ref: library/subprocess subprocess run10433324 +Ref: b8610433324 +Ref: library/subprocess subprocess CompletedProcess10437900 +Ref: e6e10437900 +Ref: library/subprocess subprocess CompletedProcess args10438033 +Ref: 31ee10438033 +Ref: library/subprocess subprocess CompletedProcess returncode10438155 +Ref: 31ef10438155 +Ref: library/subprocess subprocess CompletedProcess stdout10438429 +Ref: 31f010438429 +Ref: library/subprocess subprocess CompletedProcess stderr10438860 +Ref: 31f110438860 +Ref: library/subprocess subprocess CompletedProcess check_returncode10439102 +Ref: 31f210439102 +Ref: library/subprocess subprocess DEVNULL10439269 +Ref: 114210439269 +Ref: library/subprocess subprocess PIPE10439515 +Ref: b8710439515 +Ref: library/subprocess subprocess STDOUT10439779 +Ref: 31ec10439779 +Ref: library/subprocess subprocess SubprocessError10439986 +Ref: 31f310439986 +Ref: library/subprocess subprocess TimeoutExpired10440117 +Ref: 154510440117 +Ref: library/subprocess subprocess TimeoutExpired cmd10440276 +Ref: 31f410440276 +Ref: library/subprocess subprocess TimeoutExpired timeout10440362 +Ref: 31f510440362 +Ref: library/subprocess subprocess TimeoutExpired output10440422 +Ref: 31f610440422 +Ref: library/subprocess subprocess TimeoutExpired stdout10440805 +Ref: 31f710440805 +Ref: library/subprocess subprocess TimeoutExpired stderr10440900 +Ref: 31f810440900 +Ref: library/subprocess subprocess CalledProcessError10441367 +Ref: 131710441367 +Ref: library/subprocess subprocess CalledProcessError returncode10441629 +Ref: 31fa10441629 +Ref: library/subprocess subprocess CalledProcessError cmd10441797 +Ref: 31fb10441797 +Ref: library/subprocess subprocess CalledProcessError output10441883 +Ref: 31fc10441883 +Ref: library/subprocess subprocess CalledProcessError stdout10442054 +Ref: 31fd10442054 +Ref: library/subprocess subprocess CalledProcessError stderr10442149 +Ref: 31fe10442149 +Node: Frequently Used Arguments10442458 +Ref: library/subprocess frequently-used-arguments10442573 +Ref: 31eb10442573 +Ref: library/subprocess id110442573 +Ref: 31ff10442573 +Node: Popen Constructor10446743 +Ref: library/subprocess popen-constructor10446881 +Ref: 320410446881 +Ref: library/subprocess subprocess Popen10447176 +Ref: 19910447176 +Ref: Popen Constructor-Footnote-110464822 +Node: Exceptions<11>10464882 +Ref: library/subprocess exceptions10464986 +Ref: 321510464986 +Node: Security Considerations10466244 +Ref: library/subprocess security-considerations10466398 +Ref: 320310466398 +Ref: library/subprocess subprocess-security10466398 +Ref: 321610466398 +Ref: Security Considerations-Footnote-110467514 +Ref: Security Considerations-Footnote-210467584 +Node: Popen Objects10467640 +Ref: library/subprocess popen-objects10467788 +Ref: 321810467788 +Ref: library/subprocess subprocess Popen poll10467905 +Ref: 321910467905 +Ref: library/subprocess subprocess Popen wait10468065 +Ref: ce410468065 +Ref: library/subprocess subprocess Popen communicate10469072 +Ref: 31ed10469072 +Ref: library/subprocess subprocess Popen send_signal10470823 +Ref: 13aa10470823 +Ref: library/subprocess subprocess Popen terminate10471208 +Ref: 13a810471208 +Ref: library/subprocess subprocess Popen kill10471427 +Ref: 13a910471427 +Ref: library/subprocess subprocess Popen args10471733 +Ref: 321a10471733 +Ref: library/subprocess subprocess Popen stdin10471918 +Ref: 320010471918 +Ref: library/subprocess subprocess Popen stdout10472359 +Ref: 320110472359 +Ref: library/subprocess subprocess Popen stderr10472872 +Ref: 320210472872 +Ref: library/subprocess subprocess Popen pid10473647 +Ref: 321b10473647 +Ref: library/subprocess subprocess Popen returncode10473829 +Ref: 19a710473829 +Node: Windows Popen Helpers10474329 +Ref: library/subprocess windows-popen-helpers10474474 +Ref: 321c10474474 +Ref: library/subprocess subprocess STARTUPINFO10474628 +Ref: 320810474628 +Ref: library/subprocess subprocess STARTUPINFO dwFlags10475047 +Ref: 321d10475047 +Ref: library/subprocess subprocess STARTUPINFO hStdInput10475361 +Ref: 321e10475361 +Ref: library/subprocess subprocess STARTUPINFO hStdOutput10475683 +Ref: 322010475683 +Ref: library/subprocess subprocess STARTUPINFO hStdError10475994 +Ref: 322110475994 +Ref: library/subprocess subprocess STARTUPINFO wShowWindow10476302 +Ref: 322210476302 +Ref: library/subprocess subprocess STARTUPINFO lpAttributeList10476794 +Ref: c0e10476794 +Ref: Windows Popen Helpers-Footnote-110478050 +Ref: Windows Popen Helpers-Footnote-210478122 +Ref: Windows Popen Helpers-Footnote-310478194 +Node: Windows Constants10478283 +Ref: library/subprocess windows-constants10478358 +Ref: 322510478358 +Ref: library/subprocess subprocess STD_INPUT_HANDLE10478480 +Ref: 322610478480 +Ref: library/subprocess subprocess STD_OUTPUT_HANDLE10478617 +Ref: 322710478617 +Ref: library/subprocess subprocess STD_ERROR_HANDLE10478765 +Ref: 322810478765 +Ref: library/subprocess subprocess SW_HIDE10478911 +Ref: 322410478911 +Ref: library/subprocess subprocess STARTF_USESTDHANDLES10479000 +Ref: 321f10479000 +Ref: library/subprocess subprocess STARTF_USESHOWWINDOW10479231 +Ref: 322310479231 +Ref: library/subprocess subprocess STARTF_FORCEONFEEDBACK10479384 +Ref: 322910479384 +Ref: library/subprocess subprocess STARTF_FORCEOFFFEEDBACK10479678 +Ref: 322a10479678 +Ref: library/subprocess subprocess CREATE_NEW_CONSOLE10479888 +Ref: 320910479888 +Ref: library/subprocess subprocess CREATE_NEW_PROCESS_GROUP10480035 +Ref: 320a10480035 +Ref: library/subprocess subprocess ABOVE_NORMAL_PRIORITY_CLASS10480358 +Ref: 320b10480358 +Ref: library/subprocess subprocess BELOW_NORMAL_PRIORITY_CLASS10480564 +Ref: 320c10480564 +Ref: library/subprocess subprocess HIGH_PRIORITY_CLASS10480769 +Ref: 320d10480769 +Ref: library/subprocess subprocess IDLE_PRIORITY_CLASS10480957 +Ref: 320e10480957 +Ref: library/subprocess subprocess NORMAL_PRIORITY_CLASS10481155 +Ref: 320f10481155 +Ref: library/subprocess subprocess REALTIME_PRIORITY_CLASS10481358 +Ref: 321010481358 +Ref: library/subprocess subprocess CREATE_NO_WINDOW10481894 +Ref: 321110481894 +Ref: library/subprocess subprocess DETACHED_PROCESS10482078 +Ref: 321210482078 +Ref: library/subprocess subprocess CREATE_DEFAULT_ERROR_MODE10482334 +Ref: 321310482334 +Ref: library/subprocess subprocess CREATE_BREAKAWAY_FROM_JOB10482736 +Ref: 321410482736 +Node: Older high-level API10482935 +Ref: library/subprocess call-function-trio10483119 +Ref: 322b10483119 +Ref: library/subprocess older-high-level-api10483119 +Ref: 322c10483119 +Ref: library/subprocess subprocess call10483367 +Ref: b8810483367 +Ref: library/subprocess subprocess check_call10484755 +Ref: 31f910484755 +Ref: library/subprocess subprocess check_output10486423 +Ref: fbc10486423 +Node: Replacing Older Functions with the subprocess Module10488988 +Ref: library/subprocess replacing-older-functions-with-the-subprocess-module10489184 +Ref: 322d10489184 +Ref: library/subprocess subprocess-replacements10489184 +Ref: 117c10489184 +Node: Replacing /bin/sh shell command substitution10490352 +Ref: library/subprocess replacing-bin-sh-shell-command-substitution10490518 +Ref: 322e10490518 +Node: Replacing shell pipeline10490723 +Ref: library/subprocess replacing-shell-pipeline10490917 +Ref: 322f10490917 +Node: Replacing os system10491568 +Ref: library/subprocess replacing-os-system10491747 +Ref: 323010491747 +Node: Replacing the os spawn family10492695 +Ref: library/subprocess replacing-the-os-spawn-family10492888 +Ref: 323110492888 +Node: Replacing os popen os popen2 os popen310493519 +Ref: library/subprocess replacing-os-popen-os-popen2-os-popen310493735 +Ref: 323210493735 +Node: Replacing functions from the popen2 module10495030 +Ref: library/subprocess replacing-functions-from-the-popen2-module10495208 +Ref: 323310495208 +Node: Legacy Shell Invocation Functions10496522 +Ref: library/subprocess legacy-shell-invocation-functions10496706 +Ref: 323410496706 +Ref: library/subprocess subprocess getstatusoutput10497070 +Ref: fbd10497070 +Ref: library/subprocess subprocess getoutput10498392 +Ref: 17fa10498392 +Node: Notes<2>10498950 +Ref: library/subprocess notes10499073 +Ref: 323510499073 +Node: Timeout Behavior10499280 +Ref: library/subprocess subprocess-timeout-behavior10499404 +Ref: 323610499404 +Ref: library/subprocess timeout-behavior10499404 +Ref: 323710499404 +Node: Converting an argument sequence to a string on Windows10500191 +Ref: library/subprocess converting-an-argument-sequence-to-a-string-on-windows10500361 +Ref: 323810500361 +Ref: library/subprocess converting-argument-sequence10500361 +Ref: 320510500361 +Ref: library/subprocess disable-vfork10501521 +Ref: 323910501521 +Node: Disabling use of vfork or posix_spawn10501521 +Ref: library/subprocess disable-posix-spawn10501666 +Ref: 323a10501666 +Ref: library/subprocess disabling-use-of-vfork-or-posix-spawn10501666 +Ref: 323b10501666 +Node: sched — Event scheduler10503081 +Ref: library/sched doc10503253 +Ref: 323c10503253 +Ref: library/sched module-sched10503253 +Ref: bf10503253 +Ref: library/sched sched-event-scheduler10503253 +Ref: 323d10503253 +Ref: library/sched sched scheduler10503523 +Ref: 111b10503523 +Ref: sched — Event scheduler-Footnote-110505594 +Node: Scheduler Objects10505659 +Ref: library/sched id110505738 +Ref: 323e10505738 +Ref: library/sched scheduler-objects10505738 +Ref: 323f10505738 +Ref: library/sched sched scheduler enterabs10505870 +Ref: 111d10505870 +Ref: library/sched sched scheduler enter10506754 +Ref: 111c10506754 +Ref: library/sched sched scheduler cancel10507164 +Ref: 193010507164 +Ref: library/sched sched scheduler empty10507351 +Ref: 324010507351 +Ref: library/sched sched scheduler run10507436 +Ref: 111a10507436 +Ref: library/sched sched scheduler queue10508478 +Ref: 324110508478 +Node: queue — A synchronized queue class10508737 +Ref: library/queue doc10508906 +Ref: 324210508906 +Ref: library/queue module-queue10508906 +Ref: b610508906 +Ref: library/queue queue-a-synchronized-queue-class10508906 +Ref: 324310508906 +Ref: library/queue queue Queue10510230 +Ref: 137a10510230 +Ref: library/queue queue LifoQueue10510594 +Ref: 225610510594 +Ref: library/queue queue PriorityQueue10510962 +Ref: 225710510962 +Ref: library/queue queue SimpleQueue10511959 +Ref: b6a10511959 +Ref: library/queue queue Empty10512135 +Ref: 315710512135 +Ref: library/queue queue Full10512321 +Ref: 315810512321 +Ref: library/queue queue ShutDown10512505 +Ref: 23d10512505 +Ref: queue — A synchronized queue class-Footnote-110512794 +Node: Queue Objects10512859 +Ref: library/queue queue-objects10512973 +Ref: 324610512973 +Ref: library/queue queueobjects10512973 +Ref: 324710512973 +Ref: library/queue queue Queue qsize10513153 +Ref: 324810513153 +Ref: library/queue queue Queue empty10513382 +Ref: 324910513382 +Ref: library/queue queue Queue full10513711 +Ref: 324a10513711 +Ref: library/queue queue Queue put10514036 +Ref: 324510514036 +Ref: library/queue queue Queue put_nowait10514695 +Ref: 2cd410514695 +Ref: library/queue queue Queue get10514782 +Ref: 2cd510514782 +Ref: library/queue queue Queue get_nowait10515819 +Ref: 324410515819 +Ref: library/queue queue Queue task_done10516012 +Ref: 315310516012 +Ref: library/queue queue Queue join10516658 +Ref: 315410516658 +Node: Waiting for task completion10517160 +Ref: library/queue waiting-for-task-completion10517264 +Ref: 324b10517264 +Node: Terminating queues10517918 +Ref: library/queue terminating-queues10518022 +Ref: 324c10518022 +Ref: library/queue queue Queue shutdown10518208 +Ref: 23c10518208 +Node: SimpleQueue Objects10519626 +Ref: library/queue simplequeue-objects10519740 +Ref: 324d10519740 +Ref: library/queue queue SimpleQueue qsize10519876 +Ref: 324e10519876 +Ref: library/queue queue SimpleQueue empty10520042 +Ref: 324f10520042 +Ref: library/queue queue SimpleQueue put10520259 +Ref: 325010520259 +Ref: library/queue queue SimpleQueue put_nowait10521024 +Ref: 325110521024 +Ref: library/queue queue SimpleQueue get10521186 +Ref: 325210521186 +Ref: library/queue queue SimpleQueue get_nowait10521768 +Ref: 325310521768 +Node: contextvars — Context Variables10522216 +Ref: library/contextvars doc10522395 +Ref: 325410522395 +Ref: library/contextvars contextvars-context-variables10522395 +Ref: 325510522395 +Ref: library/contextvars module-contextvars10522395 +Ref: 2410522395 +Ref: contextvars — Context Variables-Footnote-110523254 +Node: Context Variables10523296 +Ref: library/contextvars context-variables10523417 +Ref: 325710523417 +Ref: library/contextvars contextvars ContextVar10523472 +Ref: 155d10523472 +Ref: library/contextvars contextvars ContextVar name10524179 +Ref: 325910524179 +Ref: library/contextvars contextvars ContextVar get10524308 +Ref: 325810524308 +Ref: library/contextvars contextvars ContextVar set10524795 +Ref: 325a10524795 +Ref: library/contextvars contextvars ContextVar reset10525191 +Ref: 325c10525191 +Ref: library/contextvars contextvars Token10525712 +Ref: 325b10525712 +Ref: library/contextvars contextvars Token var10525986 +Ref: 325d10525986 +Ref: library/contextvars contextvars Token old_value10526124 +Ref: 325e10526124 +Ref: library/contextvars contextvars Token MISSING10526416 +Ref: 325f10526416 +Node: Manual Context Management10526509 +Ref: library/contextvars manual-context-management10526654 +Ref: 326010526654 +Ref: library/contextvars contextvars copy_context10526725 +Ref: 325610526725 +Ref: library/contextvars contextvars Context10527203 +Ref: 15a910527203 +Ref: library/contextvars contextvars Context run10529151 +Ref: 160710529151 +Ref: library/contextvars contextvars Context copy10530481 +Ref: 326110530481 +Ref: library/contextvars contextvars Context get10530924 +Ref: 326210530924 +Ref: library/contextvars contextvars Context keys10531366 +Ref: 326310531366 +Ref: library/contextvars contextvars Context values10531457 +Ref: 326410531457 +Ref: library/contextvars contextvars Context items10531560 +Ref: 326510531560 +Node: asyncio support10531699 +Ref: library/contextvars asyncio-support10531818 +Ref: 326610531818 +Node: _thread — Low-level threading API10533513 +Ref: library/_thread doc10533647 +Ref: 326710533647 +Ref: library/_thread module-_thread10533647 +Ref: 210533647 +Ref: library/_thread thread-low-level-threading-api10533647 +Ref: 326810533647 +Ref: library/_thread thread error10534363 +Ref: 326910534363 +Ref: library/_thread thread LockType10534531 +Ref: 326a10534531 +Ref: library/_thread thread start_new_thread10534599 +Ref: 19610534599 +Ref: library/_thread thread interrupt_main10535628 +Ref: 83f10535628 +Ref: library/_thread thread exit10536547 +Ref: 326b10536547 +Ref: library/_thread thread allocate_lock10536696 +Ref: 326c10536696 +Ref: library/_thread thread get_ident10536844 +Ref: 326d10536844 +Ref: library/_thread thread get_native_id10537210 +Ref: 326e10537210 +Ref: library/_thread thread stack_size10537762 +Ref: 326f10537762 +Ref: library/_thread thread TIMEOUT_MAX10539036 +Ref: 327010539036 +Ref: library/_thread thread lock acquire10539321 +Ref: 327110539321 +Ref: library/_thread thread lock release10540398 +Ref: 327210540398 +Ref: library/_thread thread lock locked10540540 +Ref: 327310540540 +Node: Networking and Interprocess Communication10541777 +Ref: library/ipc doc10541942 +Ref: 327410541942 +Ref: library/ipc ipc10541942 +Ref: 327510541942 +Ref: library/ipc networking-and-interprocess-communication10541942 +Ref: 327610541942 +Node: asyncio — Asynchronous I/O10542739 +Ref: library/asyncio doc10542895 +Ref: 327710542895 +Ref: library/asyncio asyncio-asynchronous-i-o10542895 +Ref: 327810542895 +Ref: library/asyncio module-asyncio10542895 +Ref: a10542895 +Ref: library/asyncio asyncio-cli10544635 +Ref: 328410544635 +Node: Runners10545668 +Ref: library/asyncio-runner doc10545769 +Ref: 328510545769 +Ref: library/asyncio-runner runners10545769 +Ref: 328610545769 +Ref: Runners-Footnote-110546187 +Node: Running an asyncio Program10546263 +Ref: library/asyncio-runner running-an-asyncio-program10546364 +Ref: 328710546364 +Ref: library/asyncio-runner asyncio run10546437 +Ref: 47810546437 +Node: Runner context manager10548175 +Ref: library/asyncio-runner runner-context-manager10548315 +Ref: 328910548315 +Ref: library/asyncio-runner asyncio Runner10548380 +Ref: 5fc10548380 +Ref: library/asyncio-runner asyncio Runner run10549530 +Ref: 16ad10549530 +Ref: library/asyncio-runner asyncio Runner close10550042 +Ref: 328a10550042 +Ref: library/asyncio-runner asyncio Runner get_loop10550265 +Ref: 328b10550265 +Node: Handling Keyboard Interruption10550707 +Ref: library/asyncio-runner handling-keyboard-interruption10550812 +Ref: 328c10550812 +Node: Coroutines and Tasks10552322 +Ref: library/asyncio-task doc10552439 +Ref: 328d10552439 +Ref: library/asyncio-task coroutines-and-tasks10552439 +Ref: 328e10552439 +Node: Coroutines<3>10552919 +Ref: library/asyncio-task coroutine10553008 +Ref: 327a10553008 +Ref: library/asyncio-task coroutines10553008 +Ref: 328f10553008 +Ref: Coroutines<3>-Footnote-110556313 +Node: Awaitables10556392 +Ref: library/asyncio-task asyncio-awaitables10556504 +Ref: 329010556504 +Ref: library/asyncio-task awaitables10556504 +Ref: 329110556504 +Node: Creating Tasks10559103 +Ref: library/asyncio-task creating-tasks10559219 +Ref: 329210559219 +Ref: library/asyncio-task asyncio create_task10559376 +Ref: 1bf10559376 +Ref: Creating Tasks-Footnote-110561413 +Node: Task Cancellation10561486 +Ref: library/asyncio-task task-cancellation10561603 +Ref: 329310561603 +Node: Task Groups10562673 +Ref: library/asyncio-task task-groups10562784 +Ref: 329410562784 +Ref: library/asyncio-task taskgroups10562784 +Ref: 329510562784 +Ref: library/asyncio-task asyncio TaskGroup10562951 +Ref: 1b510562951 +Ref: library/asyncio-task asyncio TaskGroup create_task10563216 +Ref: 1bc10563216 +Node: Terminating a Task Group10567214 +Ref: library/asyncio-task terminating-a-task-group10567286 +Ref: 329610567286 +Node: Sleeping10568615 +Ref: library/asyncio-task sleeping10568735 +Ref: 329710568735 +Ref: library/asyncio-task asyncio sleep10568774 +Ref: a6f10568774 +Ref: library/asyncio-task asyncio-example-sleep10569261 +Ref: 329810569261 +Node: Running Tasks Concurrently10569923 +Ref: library/asyncio-task running-tasks-concurrently10570050 +Ref: 329910570050 +Ref: library/asyncio-task asyncio gather10570125 +Ref: 5f910570125 +Ref: library/asyncio-task asyncio-example-gather10571850 +Ref: 329a10571850 +Node: Eager Task Factory10573966 +Ref: library/asyncio-task eager-task-factory10574112 +Ref: 329b10574112 +Ref: library/asyncio-task id110574112 +Ref: 329c10574112 +Ref: library/asyncio-task asyncio eager_task_factory10574171 +Ref: 47310574171 +Ref: library/asyncio-task asyncio create_eager_task_factory10575317 +Ref: 47410575317 +Node: Shielding From Cancellation10575997 +Ref: library/asyncio-task shielding-from-cancellation10576125 +Ref: 329d10576125 +Ref: library/asyncio-task asyncio shield10576202 +Ref: a7010576202 +Node: Timeouts10577880 +Ref: library/asyncio-task timeouts10578008 +Ref: 329e10578008 +Ref: library/asyncio-task asyncio timeout10578047 +Ref: 5fa10578047 +Ref: library/asyncio-task asyncio Timeout10579790 +Ref: 16ca10579790 +Ref: library/asyncio-task asyncio Timeout when10580271 +Ref: 32a010580271 +Ref: library/asyncio-task asyncio Timeout reschedule10580443 +Ref: 329f10580443 +Ref: library/asyncio-task asyncio Timeout expired10580548 +Ref: 32a110580548 +Ref: library/asyncio-task asyncio timeout_at10581388 +Ref: 182110581388 +Ref: library/asyncio-task asyncio wait_for10582003 +Ref: 5fb10582003 +Ref: library/asyncio-task asyncio-example-waitfor10582799 +Ref: 32a210582799 +Node: Waiting Primitives10583639 +Ref: library/asyncio-task waiting-primitives10583758 +Ref: 32a310583758 +Ref: library/asyncio-task asyncio wait10583817 +Ref: 47b10583817 +Ref: library/asyncio-task asyncio FIRST_COMPLETED10585018 +Ref: 32a410585018 +Ref: library/asyncio-task asyncio FIRST_EXCEPTION10585327 +Ref: 32a510585327 +Ref: library/asyncio-task asyncio ALL_COMPLETED10585848 +Ref: 32a610585848 +Ref: library/asyncio-task asyncio as_completed10586409 +Ref: 1aa10586409 +Node: Running in Threads10589265 +Ref: library/asyncio-task running-in-threads10589405 +Ref: 32a710589405 +Ref: library/asyncio-task asyncio to_thread10589464 +Ref: 8e710589464 +Node: Scheduling From Other Threads10591674 +Ref: library/asyncio-task scheduling-from-other-threads10591809 +Ref: 32a810591809 +Ref: library/asyncio-task asyncio run_coroutine_threadsafe10591890 +Ref: 88010591890 +Node: Introspection10593318 +Ref: library/asyncio-task introspection10593446 +Ref: 32aa10593446 +Ref: library/asyncio-task asyncio current_task10593495 +Ref: 47910593495 +Ref: library/asyncio-task asyncio all_tasks10593774 +Ref: 95610593774 +Ref: library/asyncio-task asyncio iscoroutine10594034 +Ref: 47a10594034 +Node: Task Object10594159 +Ref: library/asyncio-task asyncio-task-obj10594249 +Ref: 32ab10594249 +Ref: library/asyncio-task task-object10594249 +Ref: 32ac10594249 +Ref: library/asyncio-task asyncio Task10594294 +Ref: 1be10594294 +Ref: library/asyncio-task asyncio Task done10597075 +Ref: 32b010597075 +Ref: library/asyncio-task asyncio Task result10597291 +Ref: 32b110597291 +Ref: library/asyncio-task asyncio Task exception10597780 +Ref: 32b310597780 +Ref: library/asyncio-task asyncio Task add_done_callback10598267 +Ref: 32b410598267 +Ref: library/asyncio-task asyncio Task remove_done_callback10598582 +Ref: 32b510598582 +Ref: library/asyncio-task asyncio Task get_stack10598880 +Ref: 32b610598880 +Ref: library/asyncio-task asyncio Task print_stack10599876 +Ref: 175f10599876 +Ref: library/asyncio-task asyncio Task get_coro10600368 +Ref: 9db10600368 +Ref: library/asyncio-task asyncio Task get_context10600782 +Ref: 32b710600782 +Ref: library/asyncio-task asyncio Task get_name10600947 +Ref: 9dd10600947 +Ref: library/asyncio-task asyncio Task set_name10601221 +Ref: 9dc10601221 +Ref: library/asyncio-task asyncio Task cancel10601557 +Ref: 1b710601557 +Ref: library/asyncio-task asyncio-example-task-cancel10602766 +Ref: 32b810602766 +Ref: library/asyncio-task asyncio Task cancelled10604021 +Ref: 32ad10604021 +Ref: library/asyncio-task asyncio Task uncancel10604320 +Ref: 1bb10604320 +Ref: library/asyncio-task asyncio Task cancelling10606630 +Ref: 1ba10606630 +Node: Streams10607440 +Ref: library/asyncio-stream doc10607576 +Ref: 32b910607576 +Ref: library/asyncio-stream asyncio-streams10607576 +Ref: 327b10607576 +Ref: library/asyncio-stream streams10607576 +Ref: 32ba10607576 +Ref: library/asyncio-stream asyncio-example-stream10607913 +Ref: 32bb10607913 +Ref: library/asyncio-stream asyncio open_connection10608659 +Ref: b1810608659 +Ref: library/asyncio-stream asyncio start_server10609964 +Ref: b1910609964 +Ref: library/asyncio-stream asyncio open_unix_connection10611571 +Ref: 32bf10611571 +Ref: library/asyncio-stream asyncio start_unix_server10612545 +Ref: 32c110612545 +Ref: Streams-Footnote-110613904 +Node: StreamReader10613980 +Ref: library/asyncio-stream streamreader10614057 +Ref: 32c210614057 +Ref: library/asyncio-stream asyncio StreamReader10614104 +Ref: 18c510614104 +Ref: library/asyncio-stream asyncio StreamReader feed_eof10614490 +Ref: 32c310614490 +Ref: library/asyncio-stream asyncio StreamReader read10614552 +Ref: 32c410614552 +Ref: library/asyncio-stream asyncio StreamReader readline10615181 +Ref: 32c510615181 +Ref: library/asyncio-stream asyncio StreamReader readexactly10615533 +Ref: c7b10615533 +Ref: library/asyncio-stream asyncio StreamReader readuntil10615825 +Ref: 1b410615825 +Ref: library/asyncio-stream asyncio StreamReader at_eof10617117 +Ref: 32c810617117 +Node: StreamWriter10617247 +Ref: library/asyncio-stream streamwriter10617345 +Ref: 32c910617345 +Ref: library/asyncio-stream asyncio StreamWriter10617392 +Ref: 16ff10617392 +Ref: library/asyncio-stream asyncio StreamWriter write10617674 +Ref: 32ca10617674 +Ref: library/asyncio-stream asyncio StreamWriter writelines10618044 +Ref: 32cb10618044 +Ref: library/asyncio-stream asyncio StreamWriter close10618437 +Ref: 32bd10618437 +Ref: library/asyncio-stream asyncio StreamWriter can_write_eof10618717 +Ref: 32cc10618717 +Ref: library/asyncio-stream asyncio StreamWriter write_eof10618888 +Ref: 32cd10618888 +Ref: library/asyncio-stream asyncio StreamWriter transport10619016 +Ref: 32ce10619016 +Ref: library/asyncio-stream asyncio StreamWriter get_extra_info10619099 +Ref: 32cf10619099 +Ref: library/asyncio-stream asyncio StreamWriter drain10619273 +Ref: 17ae10619273 +Ref: library/asyncio-stream asyncio StreamWriter start_tls10619862 +Ref: 60010619862 +Ref: library/asyncio-stream asyncio StreamWriter is_closing10620875 +Ref: b0d10620875 +Ref: library/asyncio-stream asyncio StreamWriter wait_closed10621038 +Ref: b0c10621038 +Node: Examples<15>10621354 +Ref: library/asyncio-stream examples10621431 +Ref: 32bc10621431 +Node: TCP echo client using streams10621628 +Ref: library/asyncio-stream asyncio-tcp-echo-client-streams10621744 +Ref: 32d010621744 +Ref: library/asyncio-stream tcp-echo-client-using-streams10621744 +Ref: 32d110621744 +Node: TCP echo server using streams10622532 +Ref: library/asyncio-stream asyncio-tcp-echo-server-streams10622673 +Ref: 32d310622673 +Ref: library/asyncio-stream tcp-echo-server-using-streams10622673 +Ref: 32d410622673 +Node: Get HTTP headers10623715 +Ref: library/asyncio-stream get-http-headers10623881 +Ref: 32d610623881 +Node: Register an open socket to wait for data using streams10625152 +Ref: library/asyncio-stream asyncio-example-create-connection-streams10625280 +Ref: 32d710625280 +Ref: library/asyncio-stream register-an-open-socket-to-wait-for-data-using-streams10625280 +Ref: 32d810625280 +Node: Synchronization Primitives10626705 +Ref: library/asyncio-sync doc10626833 +Ref: 32dc10626833 +Ref: library/asyncio-sync asyncio-sync10626833 +Ref: 327e10626833 +Ref: library/asyncio-sync synchronization-primitives10626833 +Ref: 32dd10626833 +Ref: Synchronization Primitives-Footnote-110627910 +Node: Lock10627983 +Ref: library/asyncio-sync lock10628064 +Ref: 32de10628064 +Ref: library/asyncio-sync asyncio Lock10628095 +Ref: a7110628095 +Ref: library/asyncio-sync asyncio Lock acquire10628757 +Ref: 32df10628757 +Ref: library/asyncio-sync asyncio Lock release10629247 +Ref: 32e010629247 +Ref: library/asyncio-sync asyncio Lock locked10629464 +Ref: 32e110629464 +Node: Event10629546 +Ref: library/asyncio-sync event10629645 +Ref: 32e210629645 +Ref: library/asyncio-sync asyncio Event10629678 +Ref: a7210629678 +Ref: library/asyncio-sync asyncio-example-sync-event10630207 +Ref: 32e610630207 +Ref: library/asyncio-sync asyncio Event wait10630836 +Ref: 32e510630836 +Ref: library/asyncio-sync asyncio Event set10631042 +Ref: 32e310631042 +Ref: library/asyncio-sync asyncio Event clear10631182 +Ref: 32e410631182 +Ref: library/asyncio-sync asyncio Event is_set10631372 +Ref: 32e710631372 +Node: Condition10631450 +Ref: library/asyncio-sync condition10631554 +Ref: 32e810631554 +Ref: library/asyncio-sync asyncio Condition10631595 +Ref: a7310631595 +Ref: library/asyncio-sync asyncio Condition acquire10632827 +Ref: 32e910632827 +Ref: library/asyncio-sync asyncio Condition notify10633026 +Ref: 167a10633026 +Ref: library/asyncio-sync asyncio Condition locked10633390 +Ref: 32ea10633390 +Ref: library/asyncio-sync asyncio Condition notify_all10633483 +Ref: 32eb10633483 +Ref: library/asyncio-sync asyncio Condition release10633861 +Ref: 32ec10633861 +Ref: library/asyncio-sync asyncio Condition wait10634023 +Ref: 16a510634023 +Ref: library/asyncio-sync asyncio Condition wait_for10634763 +Ref: 32ed10634763 +Node: Semaphore10635111 +Ref: library/asyncio-sync semaphore10635226 +Ref: 32ee10635226 +Ref: library/asyncio-sync asyncio Semaphore10635267 +Ref: a7410635267 +Ref: library/asyncio-sync asyncio Semaphore acquire10636379 +Ref: 16a610636379 +Ref: library/asyncio-sync asyncio Semaphore locked10636663 +Ref: 32f010636663 +Ref: library/asyncio-sync asyncio Semaphore release10636767 +Ref: 32ef10636767 +Node: BoundedSemaphore10637081 +Ref: library/asyncio-sync boundedsemaphore10637194 +Ref: 32f110637194 +Ref: library/asyncio-sync asyncio BoundedSemaphore10637249 +Ref: a7510637249 +Node: Barrier10637608 +Ref: library/asyncio-sync barrier10637703 +Ref: 32f210637703 +Ref: library/asyncio-sync asyncio Barrier10637740 +Ref: 5fd10637740 +Ref: library/asyncio-sync asyncio-example-barrier10638335 +Ref: 32f410638335 +Ref: library/asyncio-sync asyncio Barrier wait10639203 +Ref: 32f310639203 +Ref: library/asyncio-sync asyncio Barrier reset10640280 +Ref: 32f510640280 +Ref: library/asyncio-sync asyncio Barrier abort10640576 +Ref: 32f610640576 +Ref: library/asyncio-sync asyncio Barrier parties10640889 +Ref: 32f710640889 +Ref: library/asyncio-sync asyncio Barrier n_waiting10640979 +Ref: 32f810640979 +Ref: library/asyncio-sync asyncio Barrier broken10641099 +Ref: 32f910641099 +Ref: library/asyncio-sync asyncio BrokenBarrierError10641216 +Ref: 5fe10641216 +Node: Subprocesses10641686 +Ref: library/asyncio-subprocess doc10641813 +Ref: 32fa10641813 +Ref: library/asyncio-subprocess asyncio-subprocess10641813 +Ref: 327c10641813 +Ref: library/asyncio-subprocess subprocesses10641813 +Ref: 32fb10641813 +Ref: library/asyncio-subprocess asyncio-example-subprocess-shell10642101 +Ref: 32fc10642101 +Ref: Subprocesses-Footnote-110643397 +Ref: Subprocesses-Footnote-210643476 +Node: Creating Subprocesses10643560 +Ref: library/asyncio-subprocess creating-subprocesses10643651 +Ref: 32fe10643651 +Ref: library/asyncio-subprocess asyncio create_subprocess_exec10643716 +Ref: a7710643716 +Ref: library/asyncio-subprocess asyncio create_subprocess_shell10644311 +Ref: a7810644311 +Ref: Creating Subprocesses-Footnote-110645852 +Node: Constants<7>10645922 +Ref: library/asyncio-subprocess constants10646051 +Ref: 330910646051 +Ref: library/asyncio-subprocess asyncio subprocess PIPE10646092 +Ref: 330a10646092 +Ref: library/asyncio-subprocess asyncio subprocess STDOUT10646538 +Ref: 330c10646538 +Ref: library/asyncio-subprocess asyncio subprocess DEVNULL10646724 +Ref: 330d10646724 +Node: Interacting with Subprocesses10647005 +Ref: library/asyncio-subprocess interacting-with-subprocesses10647104 +Ref: 330e10647104 +Ref: library/asyncio-subprocess asyncio subprocess Process10647435 +Ref: 330110647435 +Ref: library/asyncio-subprocess asyncio subprocess Process wait10648413 +Ref: 330f10648413 +Ref: library/asyncio-subprocess asyncio subprocess Process communicate10648918 +Ref: 172e10648918 +Ref: library/asyncio-subprocess asyncio subprocess Process send_signal10650277 +Ref: 15f910650277 +Ref: library/asyncio-subprocess asyncio subprocess Process terminate10650691 +Ref: 331210650691 +Ref: library/asyncio-subprocess asyncio subprocess Process kill10650973 +Ref: 331310650973 +Ref: library/asyncio-subprocess asyncio subprocess Process stdin10651218 +Ref: 330b10651218 +Ref: library/asyncio-subprocess asyncio subprocess Process stdout10651380 +Ref: 32ff10651380 +Ref: library/asyncio-subprocess asyncio subprocess Process stderr10651545 +Ref: 330010651545 +Ref: library/asyncio-subprocess asyncio subprocess Process pid10652050 +Ref: 331510652050 +Ref: library/asyncio-subprocess asyncio subprocess Process returncode10652289 +Ref: 331110652289 +Node: Subprocess and Threads10652647 +Ref: library/asyncio-subprocess asyncio-subprocess-threads10652756 +Ref: 331010652756 +Ref: library/asyncio-subprocess subprocess-and-threads10652756 +Ref: 331610652756 +Node: Examples<16>10653624 +Ref: library/asyncio-subprocess examples10653733 +Ref: 32fd10653733 +Ref: library/asyncio-subprocess asyncio-example-create-subprocess-exec10653917 +Ref: 331810653917 +Node: Queues10654720 +Ref: library/asyncio-queue doc10654835 +Ref: 331a10654835 +Ref: library/asyncio-queue asyncio-queues10654835 +Ref: 327d10654835 +Ref: library/asyncio-queue queues10654835 +Ref: 331b10654835 +Ref: Queues-Footnote-110655527 +Node: Queue10655601 +Ref: library/asyncio-queue queue10655672 +Ref: 331d10655672 +Ref: library/asyncio-queue asyncio Queue10655705 +Ref: a7610655705 +Ref: library/asyncio-queue asyncio Queue maxsize10656314 +Ref: 332010656314 +Ref: library/asyncio-queue asyncio Queue empty10656392 +Ref: 332110656392 +Ref: library/asyncio-queue asyncio Queue full10656494 +Ref: 332210656494 +Ref: library/asyncio-queue asyncio Queue get10656750 +Ref: 331e10656750 +Ref: library/asyncio-queue asyncio Queue get_nowait10657055 +Ref: 332310657055 +Ref: library/asyncio-queue asyncio Queue join10657191 +Ref: dc710657191 +Ref: library/asyncio-queue asyncio Queue put10657685 +Ref: 332510657685 +Ref: library/asyncio-queue asyncio Queue put_nowait10657939 +Ref: 332610657939 +Ref: library/asyncio-queue asyncio Queue qsize10658123 +Ref: 331f10658123 +Ref: library/asyncio-queue asyncio Queue shutdown10658202 +Ref: 1b010658202 +Ref: library/asyncio-queue asyncio Queue task_done10659762 +Ref: dc810659762 +Node: Priority Queue10660470 +Ref: library/asyncio-queue priority-queue10660560 +Ref: 332810660560 +Ref: library/asyncio-queue asyncio PriorityQueue10660611 +Ref: 332910660611 +Node: LIFO Queue10660818 +Ref: library/asyncio-queue lifo-queue10660917 +Ref: 332a10660917 +Ref: library/asyncio-queue asyncio LifoQueue10660960 +Ref: 332b10660960 +Node: Exceptions<12>10661103 +Ref: library/asyncio-queue exceptions10661200 +Ref: 332c10661200 +Ref: library/asyncio-queue asyncio QueueEmpty10661243 +Ref: 332410661243 +Ref: library/asyncio-queue asyncio QueueFull10661385 +Ref: 332710661385 +Ref: library/asyncio-queue asyncio QueueShutDown10661542 +Ref: 1b110661542 +Node: Examples<17>10661730 +Ref: library/asyncio-queue examples10661808 +Ref: 331c10661808 +Ref: library/asyncio-queue asyncio-example-queue-dist10661847 +Ref: 332d10661847 +Node: Exceptions<13>10663605 +Ref: library/asyncio-exceptions doc10663718 +Ref: 332e10663718 +Ref: library/asyncio-exceptions asyncio-exceptions10663718 +Ref: 332f10663718 +Ref: library/asyncio-exceptions exceptions10663718 +Ref: 333010663718 +Ref: library/asyncio-exceptions asyncio TimeoutError10663874 +Ref: 174310663874 +Ref: library/asyncio-exceptions asyncio CancelledError10664121 +Ref: 1b810664121 +Ref: library/asyncio-exceptions asyncio InvalidStateError10664515 +Ref: 32b210664515 +Ref: library/asyncio-exceptions asyncio SendfileNotAvailableError10664754 +Ref: 333110664754 +Ref: library/asyncio-exceptions asyncio IncompleteReadError10664939 +Ref: 191f10664939 +Ref: library/asyncio-exceptions asyncio IncompleteReadError expected10665155 +Ref: 333210665155 +Ref: library/asyncio-exceptions asyncio IncompleteReadError partial10665250 +Ref: 32c610665250 +Ref: library/asyncio-exceptions asyncio LimitOverrunError10665373 +Ref: 32c710665373 +Ref: library/asyncio-exceptions asyncio LimitOverrunError consumed10665535 +Ref: 333310665535 +Ref: Exceptions<13>-Footnote-110665654 +Node: Event Loop10665733 +Ref: library/asyncio-eventloop doc10665847 +Ref: 333410665847 +Ref: library/asyncio-eventloop asyncio-event-loop10665847 +Ref: d7810665847 +Ref: library/asyncio-eventloop event-loop10665847 +Ref: 333510665847 +Ref: library/asyncio-eventloop asyncio get_running_loop10666677 +Ref: b0b10666677 +Ref: library/asyncio-eventloop asyncio get_event_loop10666955 +Ref: 2c410666955 +Ref: library/asyncio-eventloop asyncio set_event_loop10667953 +Ref: 17ca10667953 +Ref: library/asyncio-eventloop asyncio new_event_loop10668068 +Ref: 328810668068 +Ref: Event Loop-Footnote-110669347 +Ref: Event Loop-Footnote-210669421 +Node: Event Loop Methods10669501 +Ref: library/asyncio-eventloop asyncio-event-loop-methods10669591 +Ref: 333c10669591 +Ref: library/asyncio-eventloop event-loop-methods10669591 +Ref: 333710669591 +Node: Running and stopping the loop10670174 +Ref: library/asyncio-eventloop running-and-stopping-the-loop10670287 +Ref: 333d10670287 +Ref: library/asyncio-eventloop asyncio loop run_until_complete10670368 +Ref: c7710670368 +Ref: library/asyncio-eventloop asyncio loop run_forever10670684 +Ref: 333e10670684 +Ref: library/asyncio-eventloop asyncio loop stop10671404 +Ref: c7c10671404 +Ref: library/asyncio-eventloop asyncio loop is_running10671457 +Ref: 333f10671457 +Ref: library/asyncio-eventloop asyncio loop is_closed10671553 +Ref: dc310671553 +Ref: library/asyncio-eventloop asyncio loop close10671638 +Ref: 334010671638 +Ref: library/asyncio-eventloop asyncio loop shutdown_asyncgens10672043 +Ref: c7d10672043 +Ref: library/asyncio-eventloop asyncio loop shutdown_default_executor10672724 +Ref: 8e610672724 +Node: Scheduling callbacks10673736 +Ref: library/asyncio-eventloop scheduling-callbacks10673886 +Ref: 334110673886 +Ref: library/asyncio-eventloop asyncio loop call_soon10673949 +Ref: b0410673949 +Ref: library/asyncio-eventloop asyncio loop call_soon_threadsafe10674662 +Ref: b0510674662 +Ref: library/asyncio-eventloop asyncio-pass-keywords10675485 +Ref: 334210675485 +Ref: Scheduling callbacks-Footnote-110675980 +Node: Scheduling delayed callbacks10676022 +Ref: library/asyncio-eventloop asyncio-delayed-calls10676169 +Ref: 334310676169 +Ref: library/asyncio-eventloop scheduling-delayed-callbacks10676169 +Ref: 334410676169 +Ref: library/asyncio-eventloop asyncio loop call_later10676402 +Ref: b0610676402 +Ref: library/asyncio-eventloop asyncio loop call_at10677573 +Ref: b0710677573 +Ref: library/asyncio-eventloop asyncio loop time10678333 +Ref: 334510678333 +Ref: Scheduling delayed callbacks-Footnote-110678768 +Ref: Scheduling delayed callbacks-Footnote-210678810 +Node: Creating Futures and Tasks10678852 +Ref: library/asyncio-eventloop creating-futures-and-tasks10679006 +Ref: 334610679006 +Ref: library/asyncio-eventloop asyncio loop create_future10679081 +Ref: c7910679081 +Ref: library/asyncio-eventloop asyncio loop create_task10679439 +Ref: 1c010679439 +Ref: library/asyncio-eventloop asyncio loop set_task_factory10680908 +Ref: dc510680908 +Ref: library/asyncio-eventloop asyncio loop get_task_factory10681683 +Ref: dc610681683 +Node: Opening network connections10681793 +Ref: library/asyncio-eventloop opening-network-connections10681943 +Ref: 334710681943 +Ref: library/asyncio-eventloop asyncio loop create_connection10682020 +Ref: 5ff10682020 +Ref: library/asyncio-eventloop asyncio loop create_datagram_endpoint10688938 +Ref: 72e10688938 +Ref: library/asyncio-eventloop asyncio loop create_unix_connection10692799 +Ref: 32c010692799 +Ref: Opening network connections-Footnote-110693854 +Ref: Opening network connections-Footnote-210693913 +Node: Creating network servers10693972 +Ref: library/asyncio-eventloop creating-network-servers10694114 +Ref: 335010694114 +Ref: library/asyncio-eventloop loop-create-server10694185 +Ref: 327f10694185 +Ref: library/asyncio-eventloop asyncio loop create_server10694185 +Ref: b1310694185 +Ref: library/asyncio-eventloop asyncio loop create_unix_server10698886 +Ref: 1ae10698886 +Ref: library/asyncio-eventloop asyncio loop connect_accepted_socket10700142 +Ref: b1a10700142 +Node: Transferring files10701702 +Ref: library/asyncio-eventloop transferring-files10701828 +Ref: 335210701828 +Ref: library/asyncio-eventloop asyncio loop sendfile10701887 +Ref: 335310701887 +Node: TLS Upgrade10702943 +Ref: library/asyncio-eventloop tls-upgrade10703070 +Ref: 335410703070 +Ref: library/asyncio-eventloop asyncio loop start_tls10703115 +Ref: b0910703115 +Node: Watching file descriptors10705055 +Ref: library/asyncio-eventloop watching-file-descriptors10705200 +Ref: 335510705200 +Ref: library/asyncio-eventloop asyncio loop add_reader10705273 +Ref: 32db10705273 +Ref: library/asyncio-eventloop asyncio loop remove_reader10705588 +Ref: 335610705588 +Ref: library/asyncio-eventloop asyncio loop add_writer10705769 +Ref: 335710705769 +Ref: library/asyncio-eventloop asyncio loop remove_writer10706186 +Ref: 335810706186 +Node: Working with socket objects directly10706456 +Ref: library/asyncio-eventloop working-with-socket-objects-directly10706593 +Ref: 335a10706593 +Ref: library/asyncio-eventloop asyncio loop sock_recv10707044 +Ref: c1110707044 +Ref: library/asyncio-eventloop asyncio loop sock_recv_into10707509 +Ref: b0a10707509 +Ref: library/asyncio-eventloop asyncio loop sock_recvfrom10707815 +Ref: 60210707815 +Ref: library/asyncio-eventloop asyncio loop sock_recvfrom_into10708116 +Ref: 60310708116 +Ref: library/asyncio-eventloop asyncio loop sock_sendall10708454 +Ref: c1210708454 +Ref: library/asyncio-eventloop asyncio loop sock_sendto10709206 +Ref: 60110709206 +Ref: library/asyncio-eventloop asyncio loop sock_connect10709482 +Ref: dc910709482 +Ref: library/asyncio-eventloop asyncio loop sock_accept10710099 +Ref: c1310710099 +Ref: library/asyncio-eventloop asyncio loop sock_sendfile10710919 +Ref: b0e10710919 +Node: DNS10712119 +Ref: library/asyncio-eventloop dns10712249 +Ref: 335b10712249 +Ref: library/asyncio-eventloop asyncio loop getaddrinfo10712278 +Ref: c1410712278 +Ref: library/asyncio-eventloop asyncio loop getnameinfo10712440 +Ref: c1510712440 +Node: Working with pipes10713278 +Ref: library/asyncio-eventloop working-with-pipes10713384 +Ref: 335c10713384 +Ref: library/asyncio-eventloop asyncio loop connect_read_pipe10713443 +Ref: 330510713443 +Ref: library/asyncio-eventloop asyncio loop connect_write_pipe10714014 +Ref: 330610714014 +Node: Unix signals10714847 +Ref: library/asyncio-eventloop unix-signals10714991 +Ref: 335f10714991 +Ref: library/asyncio-eventloop loop-add-signal-handler10715038 +Ref: 328110715038 +Ref: library/asyncio-eventloop asyncio loop add_signal_handler10715038 +Ref: 336010715038 +Ref: library/asyncio-eventloop asyncio loop remove_signal_handler10715828 +Ref: 336110715828 +Node: Executing code in thread or process pools10716133 +Ref: library/asyncio-eventloop executing-code-in-thread-or-process-pools10716277 +Ref: 336210716277 +Ref: library/asyncio-eventloop asyncio loop run_in_executor10716382 +Ref: 8e810716382 +Ref: library/asyncio-eventloop asyncio loop set_default_executor10719067 +Ref: 73e10719067 +Node: Error Handling API10719377 +Ref: library/asyncio-eventloop error-handling-api10719528 +Ref: 336310719528 +Ref: library/asyncio-eventloop asyncio loop set_exception_handler10719653 +Ref: 336410719653 +Ref: library/asyncio-eventloop asyncio loop get_exception_handler10720509 +Ref: c7a10720509 +Ref: library/asyncio-eventloop asyncio loop default_exception_handler10720685 +Ref: 336610720685 +Ref: library/asyncio-eventloop asyncio loop call_exception_handler10721060 +Ref: 336510721060 +Node: Enabling debug mode10722265 +Ref: library/asyncio-eventloop enabling-debug-mode10722395 +Ref: 336710722395 +Ref: library/asyncio-eventloop asyncio loop get_debug10722456 +Ref: dc210722456 +Ref: library/asyncio-eventloop asyncio loop set_debug10722711 +Ref: dc110722711 +Ref: library/asyncio-eventloop asyncio loop slow_callback_duration10722925 +Ref: 336810722925 +Node: Running Subprocesses10723254 +Ref: library/asyncio-eventloop running-subprocesses10723357 +Ref: 336910723357 +Ref: library/asyncio-eventloop loop-subprocess-exec10723883 +Ref: 328010723883 +Ref: library/asyncio-eventloop asyncio loop subprocess_exec10723883 +Ref: 330210723883 +Ref: library/asyncio-eventloop asyncio loop subprocess_shell10727818 +Ref: 330310727818 +Ref: Running Subprocesses-Footnote-110729134 +Node: Callback Handles10729204 +Ref: library/asyncio-eventloop callback-handles10729317 +Ref: 333810729317 +Ref: library/asyncio-eventloop asyncio Handle10729372 +Ref: 1aa210729372 +Ref: library/asyncio-eventloop asyncio Handle get_context10729517 +Ref: 336c10729517 +Ref: library/asyncio-eventloop asyncio Handle cancel10729684 +Ref: 336d10729684 +Ref: library/asyncio-eventloop asyncio Handle cancelled10729837 +Ref: b1b10729837 +Ref: library/asyncio-eventloop asyncio TimerHandle10729961 +Ref: 176c10729961 +Ref: library/asyncio-eventloop asyncio TimerHandle when10730157 +Ref: b1710730157 +Node: Server Objects10730404 +Ref: library/asyncio-eventloop server-objects10730525 +Ref: 333910730525 +Ref: library/asyncio-eventloop asyncio Server10730812 +Ref: b1210730812 +Ref: library/asyncio-eventloop asyncio Server close10731502 +Ref: 32be10731502 +Ref: library/asyncio-eventloop asyncio Server close_clients10731931 +Ref: 1b210731931 +Ref: library/asyncio-eventloop asyncio Server abort_clients10732299 +Ref: 1b310732299 +Ref: library/asyncio-eventloop asyncio Server get_loop10732741 +Ref: b1110732741 +Ref: library/asyncio-eventloop asyncio Server start_serving10732872 +Ref: b1410732872 +Ref: library/asyncio-eventloop asyncio Server serve_forever10733488 +Ref: b1510733488 +Ref: library/asyncio-eventloop asyncio Server is_serving10734383 +Ref: b1610734383 +Ref: library/asyncio-eventloop asyncio Server wait_closed10734521 +Ref: 16c910734521 +Ref: library/asyncio-eventloop asyncio Server sockets10734676 +Ref: c1610734676 +Ref: library/asyncio-eventloop asyncio-event-loops10735023 +Ref: 336f10735023 +Node: Event Loop Implementations10735023 +Ref: library/asyncio-eventloop asyncio-event-loop-implementations10735140 +Ref: 337010735140 +Ref: library/asyncio-eventloop event-loop-implementations10735140 +Ref: 333a10735140 +Ref: library/asyncio-eventloop asyncio SelectorEventLoop10735405 +Ref: 60410735405 +Ref: library/asyncio-eventloop asyncio ProactorEventLoop10736079 +Ref: 60510736079 +Ref: library/asyncio-eventloop asyncio EventLoop10736353 +Ref: 16f610736353 +Ref: library/asyncio-eventloop asyncio AbstractEventLoop10736663 +Ref: 95f10736663 +Ref: Event Loop Implementations-Footnote-110736959 +Node: Examples<18>10737038 +Ref: library/asyncio-eventloop examples10737132 +Ref: 333b10737132 +Node: Hello World with call_soon10737731 +Ref: library/asyncio-eventloop asyncio-example-lowlevel-helloworld10737855 +Ref: 337110737855 +Ref: library/asyncio-eventloop hello-world-with-call-soon10737855 +Ref: 337210737855 +Node: Display the current date with call_later10738629 +Ref: library/asyncio-eventloop asyncio-example-call-later10738801 +Ref: 337310738801 +Ref: library/asyncio-eventloop display-the-current-date-with-call-later10738801 +Ref: 337410738801 +Node: Watch a file descriptor for read events10739793 +Ref: library/asyncio-eventloop asyncio-example-watch-fd10739981 +Ref: 32da10739981 +Ref: library/asyncio-eventloop watch-a-file-descriptor-for-read-events10739981 +Ref: 337510739981 +Node: Set signal handlers for SIGINT and SIGTERM10741301 +Ref: library/asyncio-eventloop asyncio-example-unix-signals10741440 +Ref: 337610741440 +Ref: library/asyncio-eventloop set-signal-handlers-for-sigint-and-sigterm10741440 +Ref: 337710741440 +Node: Futures10742368 +Ref: library/asyncio-future doc10742492 +Ref: 337810742492 +Ref: library/asyncio-future asyncio-futures10742492 +Ref: 328310742492 +Ref: library/asyncio-future futures10742492 +Ref: 337910742492 +Ref: Futures-Footnote-110742859 +Ref: Futures-Footnote-210742935 +Node: Future Functions10743016 +Ref: library/asyncio-future future-functions10743098 +Ref: 337a10743098 +Ref: library/asyncio-future asyncio isfuture10743153 +Ref: 337b10743153 +Ref: library/asyncio-future asyncio ensure_future10743461 +Ref: c7610743461 +Ref: library/asyncio-future asyncio wrap_future10744694 +Ref: 18c410744694 +Node: Future Object10745038 +Ref: library/asyncio-future asyncio-future-obj10745120 +Ref: 337c10745120 +Ref: library/asyncio-future future-object10745120 +Ref: 337d10745120 +Ref: library/asyncio-future asyncio Future10745169 +Ref: bcd10745169 +Ref: library/asyncio-future asyncio Future result10746296 +Ref: 337e10746296 +Ref: library/asyncio-future asyncio Future set_result10746912 +Ref: 32ae10746912 +Ref: library/asyncio-future asyncio Future set_exception10747108 +Ref: 32af10747108 +Ref: library/asyncio-future asyncio Future done10747312 +Ref: 337f10747312 +Ref: library/asyncio-future asyncio Future cancelled10747576 +Ref: 338010747576 +Ref: library/asyncio-future asyncio Future add_done_callback10747881 +Ref: b0810747881 +Ref: library/asyncio-future asyncio Future remove_done_callback10748870 +Ref: 15a510748870 +Ref: library/asyncio-future asyncio Future cancel10749102 +Ref: 181910749102 +Ref: library/asyncio-future asyncio Future exception10749455 +Ref: 338110749455 +Ref: library/asyncio-future asyncio Future get_loop10749899 +Ref: b1010749899 +Ref: library/asyncio-future asyncio-example-future10750026 +Ref: 338210750026 +Ref: Future Object-Footnote-110752235 +Node: Transports and Protocols10752277 +Ref: library/asyncio-protocol doc10752399 +Ref: 338310752399 +Ref: library/asyncio-protocol asyncio-transports-protocols10752399 +Ref: 328210752399 +Ref: library/asyncio-protocol transports-and-protocols10752399 +Ref: 338410752399 +Node: Transports10754766 +Ref: library/asyncio-protocol asyncio-transport10754855 +Ref: 334910754855 +Ref: library/asyncio-protocol transports10754855 +Ref: 338510754855 +Ref: Transports-Footnote-110755597 +Node: Transports Hierarchy10755676 +Ref: library/asyncio-protocol transports-hierarchy10755766 +Ref: 338c10755766 +Ref: library/asyncio-protocol asyncio BaseTransport10755829 +Ref: 338710755829 +Ref: library/asyncio-protocol asyncio WriteTransport10755958 +Ref: 335e10755958 +Ref: library/asyncio-protocol asyncio ReadTransport10756289 +Ref: 335d10756289 +Ref: library/asyncio-protocol asyncio Transport10756616 +Ref: 338810756616 +Ref: library/asyncio-protocol asyncio DatagramTransport10757219 +Ref: 17ac10757219 +Ref: library/asyncio-protocol asyncio SubprocessTransport10757462 +Ref: 336b10757462 +Node: Base Transport10757788 +Ref: library/asyncio-protocol base-transport10757907 +Ref: 338d10757907 +Ref: library/asyncio-protocol asyncio BaseTransport close10757958 +Ref: 334c10757958 +Ref: library/asyncio-protocol asyncio BaseTransport is_closing10758387 +Ref: c7810758387 +Ref: library/asyncio-protocol asyncio BaseTransport get_extra_info10758494 +Ref: a9c10758494 +Ref: library/asyncio-protocol asyncio BaseTransport set_protocol10760652 +Ref: 339210760652 +Ref: library/asyncio-protocol asyncio BaseTransport get_protocol10760837 +Ref: 339310760837 +Node: Read-only Transports10760915 +Ref: library/asyncio-protocol read-only-transports10761035 +Ref: 339410761035 +Ref: library/asyncio-protocol asyncio ReadTransport is_reading10761098 +Ref: b1c10761098 +Ref: library/asyncio-protocol asyncio ReadTransport pause_reading10761231 +Ref: b1e10761231 +Ref: library/asyncio-protocol asyncio ReadTransport resume_reading10761600 +Ref: b1d10761600 +Node: Write-only Transports10761938 +Ref: library/asyncio-protocol write-only-transports10762063 +Ref: 339510762063 +Ref: library/asyncio-protocol asyncio WriteTransport abort10762128 +Ref: 336e10762128 +Ref: library/asyncio-protocol asyncio WriteTransport can_write_eof10762467 +Ref: 339610762467 +Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_size10762624 +Ref: 339810762624 +Ref: library/asyncio-protocol asyncio WriteTransport get_write_buffer_limits10762751 +Ref: dc410762751 +Ref: library/asyncio-protocol asyncio WriteTransport set_write_buffer_limits10763067 +Ref: 339910763067 +Ref: library/asyncio-protocol asyncio WriteTransport write10764479 +Ref: 339c10764479 +Ref: library/asyncio-protocol asyncio WriteTransport writelines10764678 +Ref: 158010764678 +Ref: library/asyncio-protocol asyncio WriteTransport write_eof10764962 +Ref: 339710764962 +Node: Datagram Transports10765251 +Ref: library/asyncio-protocol datagram-transports10765377 +Ref: 339d10765377 +Ref: library/asyncio-protocol asyncio DatagramTransport sendto10765438 +Ref: 1af10765438 +Ref: library/asyncio-protocol asyncio DatagramTransport abort10766050 +Ref: 339e10766050 +Node: Subprocess Transports10766392 +Ref: library/asyncio-protocol asyncio-subprocess-transports10766488 +Ref: 330710766488 +Ref: library/asyncio-protocol subprocess-transports10766488 +Ref: 339f10766488 +Ref: library/asyncio-protocol asyncio SubprocessTransport get_pid10766553 +Ref: 33a010766553 +Ref: library/asyncio-protocol asyncio SubprocessTransport get_pipe_transport10766651 +Ref: 33a110766651 +Ref: library/asyncio-protocol asyncio SubprocessTransport get_returncode10767397 +Ref: 33a210767397 +Ref: library/asyncio-protocol asyncio SubprocessTransport kill10767633 +Ref: 33a310767633 +Ref: library/asyncio-protocol asyncio SubprocessTransport send_signal10767894 +Ref: 33a510767894 +Ref: library/asyncio-protocol asyncio SubprocessTransport terminate10768053 +Ref: 33a410768053 +Ref: library/asyncio-protocol asyncio SubprocessTransport close10768372 +Ref: 33a610768372 +Node: Protocols10768598 +Ref: library/asyncio-protocol asyncio-protocol10768708 +Ref: 334810768708 +Ref: library/asyncio-protocol protocols10768708 +Ref: 338610768708 +Ref: Protocols-Footnote-110769501 +Node: Base Protocols10769579 +Ref: library/asyncio-protocol base-protocols10769661 +Ref: 33a710769661 +Ref: library/asyncio-protocol asyncio BaseProtocol10769712 +Ref: 338910769712 +Ref: library/asyncio-protocol asyncio Protocol10769804 +Ref: 338a10769804 +Ref: library/asyncio-protocol asyncio BufferedProtocol10769937 +Ref: a9d10769937 +Ref: library/asyncio-protocol asyncio DatagramProtocol10770093 +Ref: 6ca10770093 +Ref: library/asyncio-protocol asyncio SubprocessProtocol10770209 +Ref: 336a10770209 +Node: Base Protocol10770375 +Ref: library/asyncio-protocol base-protocol10770485 +Ref: 33a810770485 +Ref: library/asyncio-protocol asyncio BaseProtocol connection_made10770808 +Ref: 334a10770808 +Ref: library/asyncio-protocol asyncio BaseProtocol connection_lost10771062 +Ref: 338e10771062 +Ref: library/asyncio-protocol asyncio BaseProtocol pause_writing10771605 +Ref: 339a10771605 +Ref: library/asyncio-protocol asyncio BaseProtocol resume_writing10771721 +Ref: 339b10771721 +Node: Streaming Protocols10772185 +Ref: library/asyncio-protocol streaming-protocols10772309 +Ref: 33a910772309 +Ref: library/asyncio-protocol asyncio Protocol data_received10772719 +Ref: 178c10772719 +Ref: library/asyncio-protocol asyncio Protocol eof_received10773400 +Ref: 33aa10773400 +Node: Buffered Streaming Protocols10774264 +Ref: library/asyncio-protocol buffered-streaming-protocols10774393 +Ref: 33ab10774393 +Ref: library/asyncio-protocol asyncio BufferedProtocol get_buffer10775086 +Ref: 33ac10775086 +Ref: library/asyncio-protocol asyncio BufferedProtocol buffer_updated10775559 +Ref: 33ad10775559 +Ref: library/asyncio-protocol asyncio BufferedProtocol eof_received10775760 +Ref: 33ae10775760 +Node: Datagram Protocols10776332 +Ref: library/asyncio-protocol datagram-protocols10776462 +Ref: 33af10776462 +Ref: library/asyncio-protocol asyncio DatagramProtocol datagram_received10776660 +Ref: 33b010776660 +Ref: library/asyncio-protocol asyncio DatagramProtocol error_received10776925 +Ref: 33b110776925 +Node: Subprocess Protocols10777860 +Ref: library/asyncio-protocol asyncio-subprocess-protocols10777953 +Ref: 330810777953 +Ref: library/asyncio-protocol subprocess-protocols10777953 +Ref: 33b210777953 +Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_data_received10778191 +Ref: 17c410778191 +Ref: library/asyncio-protocol asyncio SubprocessProtocol pipe_connection_lost10778464 +Ref: 33b310778464 +Ref: library/asyncio-protocol asyncio SubprocessProtocol process_exited10778674 +Ref: 17c310778674 +Node: Examples<19>10778890 +Ref: library/asyncio-protocol examples10778981 +Ref: 338b10778981 +Node: TCP Echo Server10779236 +Ref: library/asyncio-protocol asyncio-example-tcp-echo-server-protocol10779324 +Ref: 32d510779324 +Ref: library/asyncio-protocol tcp-echo-server10779324 +Ref: 33b410779324 +Node: TCP Echo Client10780598 +Ref: library/asyncio-protocol asyncio-example-tcp-echo-client-protocol10780710 +Ref: 32d210780710 +Ref: library/asyncio-protocol tcp-echo-client10780710 +Ref: 33b510780710 +Node: UDP Echo Server10782268 +Ref: library/asyncio-protocol asyncio-udp-echo-server-protocol10782380 +Ref: 334f10782380 +Ref: library/asyncio-protocol udp-echo-server10782380 +Ref: 33b610782380 +Node: UDP Echo Client10783516 +Ref: library/asyncio-protocol asyncio-udp-echo-client-protocol10783640 +Ref: 334e10783640 +Ref: library/asyncio-protocol udp-echo-client10783640 +Ref: 33b710783640 +Node: Connecting Existing Sockets10785172 +Ref: library/asyncio-protocol asyncio-example-create-connection10785324 +Ref: 32d910785324 +Ref: library/asyncio-protocol connecting-existing-sockets10785324 +Ref: 33b810785324 +Node: loop subprocess_exec and SubprocessProtocol10787238 +Ref: library/asyncio-protocol asyncio-example-subprocess-proto10787366 +Ref: 331910787366 +Ref: library/asyncio-protocol loop-subprocess-exec-and-subprocessprotocol10787366 +Ref: 33b910787366 +Node: Policies10789677 +Ref: library/asyncio-policy doc10789808 +Ref: 33ba10789808 +Ref: library/asyncio-policy asyncio-policies10789808 +Ref: 333610789808 +Ref: library/asyncio-policy policies10789808 +Ref: 33bb10789808 +Node: Getting and Setting the Policy10790739 +Ref: library/asyncio-policy asyncio-policy-get-set10790837 +Ref: 33bc10790837 +Ref: library/asyncio-policy getting-and-setting-the-policy10790837 +Ref: 33c110790837 +Ref: library/asyncio-policy asyncio get_event_loop_policy10791010 +Ref: 33c210791010 +Ref: library/asyncio-policy asyncio set_event_loop_policy10791104 +Ref: 33c310791104 +Node: Policy Objects10791285 +Ref: library/asyncio-policy asyncio-policy-objects10791408 +Ref: 33bf10791408 +Ref: library/asyncio-policy policy-objects10791408 +Ref: 33c410791408 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy10791527 +Ref: 33c010791527 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy get_event_loop10791622 +Ref: 33c510791622 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy set_event_loop10791910 +Ref: 33c610791910 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy new_event_loop10792015 +Ref: 33c710792015 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy get_child_watcher10792160 +Ref: 2c310792160 +Ref: library/asyncio-policy asyncio AbstractEventLoopPolicy set_child_watcher10792437 +Ref: 2c210792437 +Ref: library/asyncio-policy asyncio-policy-builtin10792631 +Ref: 33bd10792631 +Ref: library/asyncio-policy asyncio DefaultEventLoopPolicy10792684 +Ref: 33c810792684 +Ref: library/asyncio-policy asyncio WindowsSelectorEventLoopPolicy10793385 +Ref: 33c910793385 +Ref: library/asyncio-policy asyncio WindowsProactorEventLoopPolicy10793593 +Ref: 33ca10793593 +Node: Process Watchers10793801 +Ref: library/asyncio-policy asyncio-watchers10793909 +Ref: 331710793909 +Ref: library/asyncio-policy process-watchers10793909 +Ref: 33cb10793909 +Ref: library/asyncio-policy asyncio get_child_watcher10794777 +Ref: 2c110794777 +Ref: library/asyncio-policy asyncio set_child_watcher10794921 +Ref: 2c010794921 +Ref: library/asyncio-policy asyncio AbstractChildWatcher10795388 +Ref: 2be10795388 +Ref: library/asyncio-policy asyncio AbstractChildWatcher add_child_handler10795429 +Ref: 33cc10795429 +Ref: library/asyncio-policy asyncio AbstractChildWatcher remove_child_handler10795822 +Ref: 33cd10795822 +Ref: library/asyncio-policy asyncio AbstractChildWatcher attach_loop10796073 +Ref: 17cb10796073 +Ref: library/asyncio-policy asyncio AbstractChildWatcher is_active10796337 +Ref: 33ce10796337 +Ref: library/asyncio-policy asyncio AbstractChildWatcher close10796575 +Ref: 33cf10796575 +Ref: library/asyncio-policy asyncio ThreadedChildWatcher10796771 +Ref: 47710796771 +Ref: library/asyncio-policy asyncio MultiLoopChildWatcher10797243 +Ref: 2bc10797243 +Ref: library/asyncio-policy asyncio SafeChildWatcher10797943 +Ref: 2bf10797943 +Ref: library/asyncio-policy asyncio FastChildWatcher10798570 +Ref: 2bd10798570 +Ref: library/asyncio-policy asyncio PidfdChildWatcher10799074 +Ref: 47510799074 +Node: Custom Policies10799673 +Ref: library/asyncio-policy asyncio-custom-policies10799758 +Ref: 33be10799758 +Ref: library/asyncio-policy custom-policies10799758 +Ref: 33d010799758 +Node: Platform Support10800367 +Ref: library/asyncio-platforms doc10800483 +Ref: 33d110800483 +Ref: library/asyncio-platforms asyncio-platform-support10800483 +Ref: 335910800483 +Ref: library/asyncio-platforms platform-support10800483 +Ref: 33d210800483 +Node: All Platforms10800795 +Ref: library/asyncio-platforms all-platforms10800881 +Ref: 33d310800881 +Node: Windows<79>10801045 +Ref: library/asyncio-platforms windows10801149 +Ref: 33d410801149 +Ref: Windows<79>-Footnote-110802994 +Ref: Windows<79>-Footnote-210803078 +Ref: Windows<79>-Footnote-310803161 +Ref: Windows<79>-Footnote-410803243 +Node: Subprocess Support on Windows10803308 +Ref: library/asyncio-platforms asyncio-windows-subprocess10803385 +Ref: 330410803385 +Ref: library/asyncio-platforms subprocess-support-on-windows10803385 +Ref: 33d610803385 +Node: macOS<50>10803766 +Ref: library/asyncio-platforms macos10803848 +Ref: 33d710803848 +Node: Extending10804479 +Ref: library/asyncio-extending doc10804607 +Ref: 33d910804607 +Ref: library/asyncio-extending extending10804607 +Ref: 33da10804607 +Node: Writing a Custom Event Loop10805087 +Ref: library/asyncio-extending writing-a-custom-event-loop10805205 +Ref: 33db10805205 +Node: Future and Task private constructors10805924 +Ref: library/asyncio-extending future-and-task-private-constructors10806072 +Ref: 33dc10806072 +Ref: library/asyncio-extending asyncio Future __init__10806636 +Ref: 33dd10806636 +Ref: library/asyncio-extending asyncio Task __init__10806770 +Ref: 33de10806770 +Node: Task lifetime support10807080 +Ref: library/asyncio-extending task-lifetime-support10807192 +Ref: 33df10807192 +Ref: library/asyncio-extending asyncio _register_task10807428 +Ref: 33e010807428 +Ref: library/asyncio-extending asyncio _unregister_task10807575 +Ref: 33e110807575 +Ref: library/asyncio-extending asyncio _enter_task10807752 +Ref: 33e210807752 +Ref: library/asyncio-extending asyncio _leave_task10808010 +Ref: 33e310808010 +Node: High-level API Index10808234 +Ref: library/asyncio-api-index doc10808365 +Ref: 87610808365 +Ref: library/asyncio-api-index high-level-api-index10808365 +Ref: 33e410808365 +Node: Tasks10808643 +Ref: library/asyncio-api-index tasks10808723 +Ref: 33e510808723 +Node: Queues<2>10812863 +Ref: library/asyncio-api-index queues10812967 +Ref: 33e610812967 +Node: Subprocesses<2>10813786 +Ref: library/asyncio-api-index subprocesses10813895 +Ref: 33e710813895 +Node: Streams<2>10814457 +Ref: library/asyncio-api-index streams10814572 +Ref: 33e810814572 +Node: Synchronization10816007 +Ref: library/asyncio-api-index synchronization10816121 +Ref: 33e910816121 +Node: Exceptions<14>10817484 +Ref: library/asyncio-api-index exceptions10817579 +Ref: 33ea10817579 +Node: Low-level API Index10818329 +Ref: library/asyncio-llapi-index doc10818474 +Ref: 33eb10818474 +Ref: library/asyncio-llapi-index low-level-api-index10818474 +Ref: 33ec10818474 +Node: Obtaining the Event Loop10818746 +Ref: library/asyncio-llapi-index obtaining-the-event-loop10818856 +Ref: 33ed10818856 +Node: Event Loop Methods<2>10819985 +Ref: library/asyncio-llapi-index event-loop-methods10820117 +Ref: 33ee10820117 +Node: Transports<2>10832445 +Ref: library/asyncio-llapi-index transports10832565 +Ref: 33ef10832565 +Node: Protocols<2>10838610 +Ref: library/asyncio-llapi-index protocols10838728 +Ref: 33f010838728 +Node: Event Loop Policies10842469 +Ref: library/asyncio-llapi-index event-loop-policies10842565 +Ref: 33f110842565 +Node: Developing with asyncio10843394 +Ref: library/asyncio-dev doc10843510 +Ref: 33f210843510 +Ref: library/asyncio-dev asyncio-dev10843510 +Ref: 33f310843510 +Ref: library/asyncio-dev developing-with-asyncio10843510 +Ref: 33f410843510 +Node: Debug Mode10843921 +Ref: library/asyncio-dev asyncio-debug-mode10844030 +Ref: 1d4f10844030 +Ref: library/asyncio-dev debug-mode10844030 +Ref: 33f510844030 +Node: Concurrency and Multithreading10845528 +Ref: library/asyncio-dev asyncio-multithreading10845667 +Ref: 32a910845667 +Ref: library/asyncio-dev concurrency-and-multithreading10845667 +Ref: 33f710845667 +Node: Running Blocking Code10847950 +Ref: library/asyncio-dev asyncio-handle-blocking10848089 +Ref: 33f810848089 +Ref: library/asyncio-dev running-blocking-code10848089 +Ref: 33f910848089 +Node: Logging<3>10848583 +Ref: library/asyncio-dev asyncio-logger10848723 +Ref: 33f610848723 +Ref: library/asyncio-dev logging10848723 +Ref: 33fa10848723 +Node: Detect never-awaited coroutines10849202 +Ref: library/asyncio-dev asyncio-coroutine-not-scheduled10849354 +Ref: 33fc10849354 +Ref: library/asyncio-dev detect-never-awaited-coroutines10849354 +Ref: 33fd10849354 +Node: Detect never-retrieved exceptions10850363 +Ref: library/asyncio-dev detect-never-retrieved-exceptions10850496 +Ref: 33fe10850496 +Ref: Detect never-retrieved exceptions-Footnote-110852106 +Node: socket — Low-level networking interface10852171 +Ref: library/socket doc10852378 +Ref: 33ff10852378 +Ref: library/socket module-socket10852378 +Ref: cc10852378 +Ref: library/socket socket-low-level-networking-interface10852378 +Ref: 340010852378 +Ref: socket — Low-level networking interface-Footnote-110853856 +Node: Socket families10853922 +Ref: library/socket socket-families10854039 +Ref: 340110854039 +Ref: library/socket host-port10855235 +Ref: 340210855235 +Ref: Socket families-Footnote-110865776 +Ref: Socket families-Footnote-210865818 +Node: Module contents10865863 +Ref: library/socket module-contents10866003 +Ref: 340910866003 +Node: Exceptions<15>10866210 +Ref: library/socket exceptions10866297 +Ref: 340a10866297 +Ref: library/socket socket error10866338 +Ref: 104e10866338 +Ref: library/socket socket herror10866525 +Ref: 340b10866525 +Ref: library/socket socket gaierror10867150 +Ref: 175310867150 +Ref: library/socket socket timeout10867755 +Ref: 83010867755 +Ref: Exceptions<15>-Footnote-110868396 +Node: Constants<8>10868438 +Ref: library/socket constants10868546 +Ref: 340d10868546 +Ref: library/socket socket AF_UNIX10868721 +Ref: 181e10868721 +Ref: library/socket socket AF_INET10868746 +Ref: 181c10868746 +Ref: library/socket socket AF_INET610868771 +Ref: 181d10868771 +Ref: library/socket socket AF_UNSPEC10869085 +Ref: 335110869085 +Ref: library/socket socket SOCK_STREAM10869296 +Ref: 12e610869296 +Ref: library/socket socket SOCK_DGRAM10869325 +Ref: 12e510869325 +Ref: library/socket socket SOCK_RAW10869353 +Ref: 340e10869353 +Ref: library/socket socket SOCK_RDM10869379 +Ref: 340f10869379 +Ref: library/socket socket SOCK_SEQPACKET10869405 +Ref: 341010869405 +Ref: library/socket socket SOCK_CLOEXEC10869706 +Ref: c0b10869706 +Ref: library/socket socket SOCK_NONBLOCK10869736 +Ref: c0a10869736 +Ref: library/socket socket-unix-constants10870153 +Ref: 334d10870153 +Ref: library/socket socket SOMAXCONN10870168 +Ref: e5a10870168 +Ref: library/socket socket AF_CAN10872783 +Ref: 340310872783 +Ref: library/socket socket PF_CAN10872807 +Ref: 341110872807 +Ref: library/socket socket CAN_BCM10873228 +Ref: f9d10873228 +Ref: library/socket socket CAN_RAW_FD_FRAMES10873653 +Ref: ec310873653 +Ref: library/socket socket CAN_RAW_JOIN_FILTERS10874069 +Ref: 93110874069 +Ref: library/socket socket CAN_ISOTP10874371 +Ref: 340410874371 +Ref: library/socket socket CAN_J193910874623 +Ref: 93210874623 +Ref: library/socket socket AF_DIVERT10874859 +Ref: 341210874859 +Ref: library/socket socket PF_DIVERT10874886 +Ref: 341310874886 +Ref: library/socket socket AF_PACKET10875113 +Ref: 340510875113 +Ref: library/socket socket PF_PACKET10875140 +Ref: 341410875140 +Ref: library/socket socket ETH_P_ALL10875355 +Ref: 17a810875355 +Ref: library/socket socket AF_RDS10875705 +Ref: 341510875705 +Ref: library/socket socket PF_RDS10875729 +Ref: 341610875729 +Ref: library/socket socket SOL_RDS10875753 +Ref: 341710875753 +Ref: library/socket socket SIO_RCVALL10875994 +Ref: 341810875994 +Ref: library/socket socket SIO_KEEPALIVE_VALS10876022 +Ref: 341910876022 +Ref: library/socket socket SIO_LOOPBACK_FAST_PATH10876058 +Ref: cd410876058 +Ref: library/socket socket AF_ALG10876477 +Ref: cd710876477 +Ref: library/socket socket SOL_ALG10876501 +Ref: 341a10876501 +Ref: library/socket socket AF_VSOCK10876669 +Ref: b7510876669 +Ref: library/socket socket IOCTL_VM_SOCKETS_GET_LOCAL_CID10876695 +Ref: 341b10876695 +Ref: library/socket socket AF_LINK10876908 +Ref: f9e10876908 +Ref: library/socket socket has_ipv610877007 +Ref: 341c10877007 +Ref: library/socket socket BDADDR_ANY10877139 +Ref: 341d10877139 +Ref: library/socket socket BDADDR_LOCAL10877167 +Ref: 341e10877167 +Ref: library/socket socket HCI_FILTER10877436 +Ref: 341f10877436 +Ref: library/socket socket HCI_TIME_STAMP10877464 +Ref: 342010877464 +Ref: library/socket socket HCI_DATA_DIR10877496 +Ref: 342110877496 +Ref: library/socket socket AF_QIPCRTR10877706 +Ref: 340610877706 +Ref: library/socket socket SCM_CREDS210877902 +Ref: 342210877902 +Ref: library/socket socket LOCAL_CREDS10877930 +Ref: 342310877930 +Ref: library/socket socket LOCAL_CREDS_PERSISTENT10877959 +Ref: 342410877959 +Ref: library/socket socket SO_INCOMING_CPU10878397 +Ref: 342510878397 +Ref: library/socket socket AF_HYPERV10878603 +Ref: 340710878603 +Ref: library/socket socket HV_PROTOCOL_RAW10878630 +Ref: 342610878630 +Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT10878663 +Ref: 342710878663 +Ref: library/socket socket HVSOCKET_CONNECT_TIMEOUT_MAX10878705 +Ref: 342810878705 +Ref: library/socket socket HVSOCKET_CONNECTED_SUSPEND10878751 +Ref: 342910878751 +Ref: library/socket socket HVSOCKET_ADDRESS_FLAG_PASSTHRU10878795 +Ref: 342a10878795 +Ref: library/socket socket HV_GUID_ZERO10878843 +Ref: 342b10878843 +Ref: library/socket socket HV_GUID_WILDCARD10878873 +Ref: 342c10878873 +Ref: library/socket socket HV_GUID_BROADCAST10878907 +Ref: 342d10878907 +Ref: library/socket socket HV_GUID_CHILDREN10878942 +Ref: 342e10878942 +Ref: library/socket socket HV_GUID_LOOPBACK10878976 +Ref: 342f10878976 +Ref: library/socket socket HV_GUID_PARENT10879010 +Ref: 343010879010 +Ref: library/socket socket-ethernet-types10879194 +Ref: 17a910879194 +Ref: library/socket socket ETHERTYPE_ARP10879194 +Ref: 343110879194 +Ref: library/socket socket ETHERTYPE_IP10879225 +Ref: 343210879225 +Ref: library/socket socket ETHERTYPE_IPV610879255 +Ref: 343310879255 +Ref: library/socket socket ETHERTYPE_VLAN10879287 +Ref: 343410879287 +Ref: library/socket socket SHUT_RD10879454 +Ref: 343510879454 +Ref: library/socket socket SHUT_WR10879479 +Ref: 343610879479 +Ref: library/socket socket SHUT_RDWR10879504 +Ref: 343710879504 +Ref: Constants<8>-Footnote-110879704 +Ref: Constants<8>-Footnote-210879756 +Ref: Constants<8>-Footnote-310879802 +Node: Functions<8>10879882 +Ref: library/socket functions10879967 +Ref: 343910879967 +Node: Creating sockets10880076 +Ref: library/socket creating-sockets10880168 +Ref: 343a10880168 +Ref: library/socket socket socket10880285 +Ref: da010880285 +Ref: library/socket socket socketpair10882863 +Ref: bf510882863 +Ref: library/socket socket create_connection10883600 +Ref: 66e10883600 +Ref: library/socket socket create_server10885108 +Ref: a2a10885108 +Ref: library/socket socket has_dualstack_ipv610886937 +Ref: a2b10886937 +Ref: library/socket socket fromfd10887134 +Ref: 343c10887134 +Ref: library/socket socket fromshare10888023 +Ref: c0710888023 +Ref: library/socket socket SocketType10888279 +Ref: 343e10888279 +Node: Other functions<2>10888432 +Ref: library/socket other-functions10888524 +Ref: 343f10888524 +Ref: library/socket socket close10888651 +Ref: b7310888651 +Ref: library/socket socket getaddrinfo10888925 +Ref: 175210888925 +Ref: library/socket socket getfqdn10893020 +Ref: 177b10893020 +Ref: library/socket socket gethostbyname10893637 +Ref: 344010893637 +Ref: library/socket socket gethostbyname_ex10894281 +Ref: 18cd10894281 +Ref: library/socket socket gethostname10895071 +Ref: 2b3110895071 +Ref: library/socket socket gethostbyaddr10895501 +Ref: 18cc10895501 +Ref: library/socket socket getnameinfo10896242 +Ref: 16c310896242 +Ref: library/socket socket getprotobyname10897014 +Ref: 344110897014 +Ref: library/socket socket getservbyname10897511 +Ref: 344210897511 +Ref: library/socket socket getservbyport10897966 +Ref: 344310897966 +Ref: library/socket socket ntohl10898407 +Ref: 344410898407 +Ref: library/socket socket ntohs10898664 +Ref: 87e10898664 +Ref: library/socket socket htonl10899040 +Ref: 344510899040 +Ref: library/socket socket htons10899297 +Ref: 87d10899297 +Ref: library/socket socket inet_aton10899673 +Ref: 96110899673 +Ref: library/socket socket inet_ntoa10900604 +Ref: 344610900604 +Ref: library/socket socket inet_pton10901426 +Ref: 96210901426 +Ref: library/socket socket inet_ntop10902215 +Ref: f9f10902215 +Ref: library/socket socket CMSG_LEN10903199 +Ref: 1a3610903199 +Ref: library/socket socket CMSG_SPACE10903881 +Ref: 1a3510903881 +Ref: library/socket socket getdefaulttimeout10904782 +Ref: 343d10904782 +Ref: library/socket socket setdefaulttimeout10905060 +Ref: 340c10905060 +Ref: library/socket socket sethostname10905348 +Ref: 112f10905348 +Ref: library/socket socket if_nameindex10905695 +Ref: a2c10905695 +Ref: library/socket socket if_nametoindex10906497 +Ref: a2d10906497 +Ref: library/socket socket if_indextoname10906959 +Ref: a2e10906959 +Ref: library/socket socket send_fds10907423 +Ref: 93310907423 +Ref: library/socket socket recv_fds10907898 +Ref: 93410907898 +Ref: Other functions<2>-Footnote-110908483 +Ref: Other functions<2>-Footnote-210908536 +Ref: Other functions<2>-Footnote-310908587 +Ref: Other functions<2>-Footnote-410908631 +Node: Socket Objects10908690 +Ref: library/socket id110908839 +Ref: 344710908839 +Ref: library/socket socket-objects10908839 +Ref: 343b10908839 +Ref: library/socket socket socket accept10909192 +Ref: da110909192 +Ref: library/socket socket socket bind10909958 +Ref: 150410909958 +Ref: library/socket socket socket close10910302 +Ref: d4310910302 +Ref: library/socket socket socket connect10911298 +Ref: da210911298 +Ref: library/socket socket socket connect_ex10912412 +Ref: 150310912412 +Ref: library/socket socket socket detach10913035 +Ref: 120f10913035 +Ref: library/socket socket socket dup10913278 +Ref: 344810913278 +Ref: library/socket socket socket fileno10913503 +Ref: 344910913503 +Ref: library/socket socket socket get_inheritable10913864 +Ref: ef910913864 +Ref: library/socket socket socket getpeername10914128 +Ref: 338f10914128 +Ref: library/socket socket socket getsockname10914467 +Ref: 339010914467 +Ref: library/socket socket socket getsockopt10914716 +Ref: cd510914716 +Ref: library/socket socket socket getblocking10915469 +Ref: b7210915469 +Ref: library/socket socket socket gettimeout10915693 +Ref: 344a10915693 +Ref: library/socket socket socket ioctl10915940 +Ref: cd310915940 +Ref: library/socket socket socket listen10916578 +Ref: e5910916578 +Ref: library/socket socket socket makefile10917047 +Ref: 119210917047 +Ref: library/socket socket socket recv10918195 +Ref: da310918195 +Ref: library/socket socket socket recvfrom10918902 +Ref: da410918902 +Ref: library/socket socket socket recvmsg10919844 +Ref: da510919844 +Ref: library/socket socket socket recvmsg_into10923763 +Ref: 112e10923763 +Ref: library/socket socket socket recvfrom_into10925403 +Ref: 131110925403 +Ref: library/socket socket socket recv_into10925941 +Ref: 131010925941 +Ref: library/socket socket socket send10926392 +Ref: da610926392 +Ref: library/socket socket socket sendall10927206 +Ref: da710927206 +Ref: library/socket socket socket sendto10928183 +Ref: da810928183 +Ref: library/socket socket socket sendmsg10929015 +Ref: 47210929015 +Ref: library/socket socket socket sendmsg_afalg10931189 +Ref: cd810931189 +Ref: library/socket socket socket sendfile10931529 +Ref: e5810931529 +Ref: library/socket socket socket set_inheritable10932436 +Ref: efa10932436 +Ref: library/socket socket socket setblocking10932618 +Ref: 2b4810932618 +Ref: library/socket socket socket settimeout10933190 +Ref: 340810933190 +Ref: library/socket socket socket setsockopt10933926 +Ref: cd610933926 +Ref: library/socket socket socket shutdown10935053 +Ref: 343810935053 +Ref: library/socket socket socket share10935410 +Ref: c0810935410 +Ref: library/socket socket socket family10936278 +Ref: 344e10936278 +Ref: library/socket socket socket type10936333 +Ref: c0c10936333 +Ref: library/socket socket socket proto10936384 +Ref: 344f10936384 +Ref: Socket Objects-Footnote-110936476 +Ref: Socket Objects-Footnote-210936518 +Ref: Socket Objects-Footnote-310936560 +Ref: Socket Objects-Footnote-410936610 +Ref: Socket Objects-Footnote-510936684 +Ref: Socket Objects-Footnote-610936728 +Ref: Socket Objects-Footnote-710936770 +Ref: Socket Objects-Footnote-810936814 +Ref: Socket Objects-Footnote-910936856 +Ref: Socket Objects-Footnote-1010936898 +Ref: Socket Objects-Footnote-1110936943 +Ref: Socket Objects-Footnote-1210936988 +Ref: Socket Objects-Footnote-1310937031 +Ref: Socket Objects-Footnote-1410937074 +Ref: Socket Objects-Footnote-1510937117 +Ref: Socket Objects-Footnote-1610937160 +Node: Notes on socket timeouts10937211 +Ref: library/socket notes-on-socket-timeouts10937355 +Ref: 345010937355 +Ref: library/socket socket-timeouts10937355 +Ref: 344d10937355 +Node: Timeouts and the connect method10938724 +Ref: library/socket timeouts-and-the-connect-method10938855 +Ref: 345110938855 +Node: Timeouts and the accept method10939330 +Ref: library/socket timeouts-and-the-accept-method10939461 +Ref: 345210939461 +Node: Example<7>10940202 +Ref: library/socket example10940323 +Ref: 345310940323 +Ref: library/socket socket-example10940323 +Ref: 345410940323 +Ref: Example<7>-Footnote-110948058 +Node: ssl — TLS/SSL wrapper for socket objects10948117 +Ref: library/ssl doc10948333 +Ref: 345510948333 +Ref: library/ssl module-ssl10948333 +Ref: d010948333 +Ref: library/ssl ssl-tls-ssl-wrapper-for-socket-objects10948333 +Ref: 345610948333 +Ref: ssl — TLS/SSL wrapper for socket objects-Footnote-110951368 +Ref: ssl — TLS/SSL wrapper for socket objects-Footnote-210951431 +Node: Functions Constants and Exceptions10951473 +Ref: library/ssl functions-constants-and-exceptions10951606 +Ref: 345710951606 +Node: Socket creation10951854 +Ref: library/ssl socket-creation10951965 +Ref: 345810951965 +Node: Context creation10953493 +Ref: library/ssl context-creation10953627 +Ref: 345910953627 +Ref: library/ssl ssl create_default_context10953769 +Ref: 15510953769 +Ref: Context creation-Footnote-110957777 +Ref: Context creation-Footnote-210957836 +Ref: Context creation-Footnote-310957881 +Node: Exceptions<16>10957940 +Ref: library/ssl exceptions10958076 +Ref: 345e10958076 +Ref: library/ssl ssl SSLError10958117 +Ref: 126d10958117 +Ref: library/ssl ssl SSLError library10958692 +Ref: 113b10958692 +Ref: library/ssl ssl SSLError reason10958972 +Ref: 113c10958972 +Ref: library/ssl ssl SSLZeroReturnError10959233 +Ref: 345f10959233 +Ref: library/ssl ssl SSLWantReadError10959530 +Ref: e6410959530 +Ref: library/ssl ssl SSLWantWriteError10959840 +Ref: e6510959840 +Ref: library/ssl ssl SSLSyscallError10960147 +Ref: 346110960147 +Ref: library/ssl ssl SSLEOFError10960439 +Ref: 174710960439 +Ref: library/ssl ssl SSLCertVerificationError10960710 +Ref: b7c10960710 +Ref: library/ssl ssl SSLCertVerificationError verify_code10960877 +Ref: 346210960877 +Ref: library/ssl ssl SSLCertVerificationError verify_message10960981 +Ref: 346310960981 +Ref: library/ssl ssl CertificateError10961079 +Ref: 346410961079 +Node: Random generation10961278 +Ref: library/ssl random-generation10961418 +Ref: 346510961418 +Ref: library/ssl ssl RAND_bytes10961473 +Ref: 51f10961473 +Ref: library/ssl ssl RAND_status10962155 +Ref: 18c610962155 +Ref: library/ssl ssl RAND_add10962475 +Ref: 346610962475 +Ref: Random generation-Footnote-110962917 +Ref: Random generation-Footnote-210963011 +Node: Certificate handling10963070 +Ref: library/ssl certificate-handling10963208 +Ref: 346710963208 +Ref: library/ssl ssl cert_time_to_seconds10963269 +Ref: e6610963269 +Ref: library/ssl ssl get_server_certificate10964179 +Ref: 83810964179 +Ref: library/ssl ssl DER_cert_to_PEM_cert10965352 +Ref: 346910965352 +Ref: library/ssl ssl PEM_cert_to_DER_cert10965534 +Ref: 346a10965534 +Ref: library/ssl ssl get_default_verify_paths10965714 +Ref: fa410965714 +Ref: library/ssl ssl enum_certificates10966591 +Ref: faf10966591 +Ref: library/ssl ssl enum_crls10967470 +Ref: fb010967470 +Ref: Certificate handling-Footnote-110968039 +Node: Constants<9>10968098 +Ref: library/ssl constants10968210 +Ref: 346b10968210 +Ref: library/ssl ssl CERT_NONE10968377 +Ref: 346c10968377 +Ref: library/ssl ssl CERT_OPTIONAL10968926 +Ref: 346d10968926 +Ref: library/ssl ssl CERT_REQUIRED10969676 +Ref: 345b10969676 +Ref: library/ssl ssl VerifyMode10970646 +Ref: 346f10970646 +Ref: library/ssl ssl VERIFY_DEFAULT10970764 +Ref: fa910970764 +Ref: library/ssl ssl VERIFY_CRL_CHECK_LEAF10971019 +Ref: faa10971019 +Ref: library/ssl ssl VERIFY_CRL_CHECK_CHAIN10971466 +Ref: fab10971466 +Ref: library/ssl ssl VERIFY_X509_STRICT10971674 +Ref: 15710971674 +Ref: library/ssl ssl VERIFY_ALLOW_PROXY_CERTS10971856 +Ref: 18db10971856 +Ref: library/ssl ssl VERIFY_X509_TRUSTED_FIRST10972034 +Ref: 347010972034 +Ref: library/ssl ssl VERIFY_X509_PARTIAL_CHAIN10972325 +Ref: 15610972325 +Ref: library/ssl ssl VerifyFlags10972759 +Ref: 347110972759 +Ref: library/ssl ssl PROTOCOL_TLS10972881 +Ref: 345d10972881 +Ref: library/ssl ssl PROTOCOL_TLS_CLIENT10973379 +Ref: 86f10973379 +Ref: library/ssl ssl PROTOCOL_TLS_SERVER10973692 +Ref: 87010973692 +Ref: library/ssl ssl PROTOCOL_SSLv2310973907 +Ref: 347210973907 +Ref: library/ssl ssl PROTOCOL_SSLv310974060 +Ref: 346810974060 +Ref: library/ssl ssl PROTOCOL_TLSv110974639 +Ref: 347310974639 +Ref: library/ssl ssl PROTOCOL_TLSv1_110974831 +Ref: fa210974831 +Ref: library/ssl ssl PROTOCOL_TLSv1_210975102 +Ref: fa310975102 +Ref: library/ssl ssl OP_ALL10975373 +Ref: 347410975373 +Ref: library/ssl ssl OP_NO_SSLv210975632 +Ref: 83510975632 +Ref: library/ssl ssl OP_NO_SSLv310975935 +Ref: 83610975935 +Ref: library/ssl ssl OP_NO_TLSv110976238 +Ref: 347510976238 +Ref: library/ssl ssl OP_NO_TLSv1_110976679 +Ref: 347610976679 +Ref: library/ssl ssl OP_NO_TLSv1_210977068 +Ref: 347710977068 +Ref: library/ssl ssl OP_NO_TLSv1_310977457 +Ref: 18a610977457 +Ref: library/ssl ssl OP_NO_RENEGOTIATION10978045 +Ref: 347810978045 +Ref: library/ssl ssl OP_CIPHER_SERVER_PREFERENCE10978328 +Ref: 113d10978328 +Ref: library/ssl ssl OP_SINGLE_DH_USE10978561 +Ref: 347910978561 +Ref: library/ssl ssl OP_SINGLE_ECDH_USE10978816 +Ref: 347a10978816 +Ref: library/ssl ssl OP_ENABLE_MIDDLEBOX_COMPAT10979075 +Ref: 347b10979075 +Ref: library/ssl ssl OP_NO_COMPRESSION10979354 +Ref: 113a10979354 +Ref: library/ssl ssl Options10979547 +Ref: 347c10979547 +Ref: library/ssl ssl OP_NO_TICKET10979633 +Ref: 347d10979633 +Ref: library/ssl ssl OP_IGNORE_UNEXPECTED_EOF10979749 +Ref: 83310979749 +Ref: library/ssl ssl OP_ENABLE_KTLS10979937 +Ref: 179710979937 +Ref: library/ssl ssl OP_LEGACY_SERVER_CONNECT10980647 +Ref: 177c10980647 +Ref: library/ssl ssl HAS_ALPN10980807 +Ref: e6110980807 +Ref: library/ssl ssl HAS_NEVER_CHECK_COMMON_NAME10981016 +Ref: 347e10981016 +Ref: library/ssl ssl HAS_ECDH10981254 +Ref: 347f10981254 +Ref: library/ssl ssl HAS_SNI10981513 +Ref: 348010981513 +Ref: library/ssl ssl HAS_NPN10981696 +Ref: 348110981696 +Ref: library/ssl ssl HAS_SSLv210982049 +Ref: 348210982049 +Ref: library/ssl ssl HAS_SSLv310982188 +Ref: 348310982188 +Ref: library/ssl ssl HAS_TLSv110982327 +Ref: 348410982327 +Ref: library/ssl ssl HAS_TLSv1_110982466 +Ref: b8310982466 +Ref: library/ssl ssl HAS_TLSv1_210982607 +Ref: 348510982607 +Ref: library/ssl ssl HAS_TLSv1_310982748 +Ref: 348610982748 +Ref: library/ssl ssl HAS_PSK10982889 +Ref: 348710982889 +Ref: library/ssl ssl CHANNEL_BINDING_TYPES10983009 +Ref: 348810983009 +Ref: library/ssl ssl OPENSSL_VERSION10983230 +Ref: 121110983230 +Ref: library/ssl ssl OPENSSL_VERSION_INFO10983444 +Ref: 121210983444 +Ref: library/ssl ssl OPENSSL_VERSION_NUMBER10983672 +Ref: 121310983672 +Ref: library/ssl ssl ALERT_DESCRIPTION_HANDSHAKE_FAILURE10983943 +Ref: 348910983943 +Ref: library/ssl ssl ALERT_DESCRIPTION_INTERNAL_ERROR10983993 +Ref: 348a10983993 +Ref: library/ssl ssl AlertDescription10984387 +Ref: 348b10984387 +Ref: library/ssl ssl Purpose SERVER_AUTH10984529 +Ref: fad10984529 +Ref: library/ssl ssl Purpose CLIENT_AUTH10984844 +Ref: fae10984844 +Ref: library/ssl ssl SSLErrorNumber10985159 +Ref: 348c10985159 +Ref: library/ssl ssl TLSVersion10985286 +Ref: 348d10985286 +Ref: library/ssl ssl TLSVersion MINIMUM_SUPPORTED10985503 +Ref: 348e10985503 +Ref: library/ssl ssl TLSVersion MAXIMUM_SUPPORTED10985548 +Ref: 348f10985548 +Ref: library/ssl ssl TLSVersion SSLv310985771 +Ref: 349010985771 +Ref: library/ssl ssl TLSVersion TLSv110985804 +Ref: 349110985804 +Ref: library/ssl ssl TLSVersion TLSv1_110985837 +Ref: 349210985837 +Ref: library/ssl ssl TLSVersion TLSv1_210985872 +Ref: 349310985872 +Ref: library/ssl ssl TLSVersion TLSv1_310985907 +Ref: 349410985907 +Ref: Constants<9>-Footnote-110986178 +Ref: Constants<9>-Footnote-210986237 +Ref: Constants<9>-Footnote-310986296 +Ref: Constants<9>-Footnote-410986374 +Ref: Constants<9>-Footnote-510986433 +Node: SSL Sockets10986526 +Ref: library/ssl ssl-sockets10986680 +Ref: 349510986680 +Ref: library/ssl ssl SSLSocket10986723 +Ref: 8e910986723 +Ref: library/ssl ssl SSLSocket read10989161 +Ref: e6910989161 +Ref: library/ssl ssl SSLSocket write10989984 +Ref: e6a10989984 +Ref: library/ssl ssl SSLSocket do_handshake10991217 +Ref: e6810991217 +Ref: library/ssl ssl SSLSocket getpeercert10991972 +Ref: fb210991972 +Ref: library/ssl ssl SSLSocket get_verified_chain10995503 +Ref: 15dd10995503 +Ref: library/ssl ssl SSLSocket get_unverified_chain10995812 +Ref: 15de10995812 +Ref: library/ssl ssl SSLSocket cipher10996006 +Ref: 339110996006 +Ref: library/ssl ssl SSLSocket shared_ciphers10996290 +Ref: e6710996290 +Ref: library/ssl ssl SSLSocket compression10996769 +Ref: 113910996769 +Ref: library/ssl ssl SSLSocket get_channel_binding10997117 +Ref: 113810997117 +Ref: library/ssl ssl SSLSocket selected_alpn_protocol10997752 +Ref: e6010997752 +Ref: library/ssl ssl SSLSocket selected_npn_protocol10998165 +Ref: 87110998165 +Ref: library/ssl ssl SSLSocket unwrap10998590 +Ref: 349610998590 +Ref: library/ssl ssl SSLSocket verify_client_post_handshake10999013 +Ref: a3110999013 +Ref: library/ssl ssl SSLSocket version10999894 +Ref: e6310999894 +Ref: library/ssl ssl SSLSocket pending11000307 +Ref: 349811000307 +Ref: library/ssl ssl SSLSocket context11000445 +Ref: 349711000445 +Ref: library/ssl ssl SSLSocket server_side11000575 +Ref: 349911000575 +Ref: library/ssl ssl SSLSocket server_hostname11000747 +Ref: b7f11000747 +Ref: library/ssl ssl SSLSocket session11001252 +Ref: 15ae11001252 +Ref: library/ssl ssl SSLSocket session_reused11001610 +Ref: 349a11001610 +Ref: SSL Sockets-Footnote-111001715 +Ref: SSL Sockets-Footnote-211001774 +Node: SSL Contexts11001833 +Ref: library/ssl ssl-contexts11001965 +Ref: 349b11001965 +Ref: library/ssl ssl SSLContext11002311 +Ref: 29611002311 +Ref: library/ssl ssl SSLContext cert_store_stats11007277 +Ref: fa611007277 +Ref: library/ssl ssl SSLContext load_cert_chain11007683 +Ref: 29711007683 +Ref: library/ssl ssl SSLContext load_default_certs11009307 +Ref: fac11009307 +Ref: library/ssl ssl SSLContext load_verify_locations11010131 +Ref: ee611010131 +Ref: library/ssl ssl SSLContext get_ca_certs11011461 +Ref: fa711011461 +Ref: library/ssl ssl SSLContext get_ciphers11012098 +Ref: cde11012098 +Ref: library/ssl ssl SSLContext set_default_verify_paths11013401 +Ref: fa511013401 +Ref: library/ssl ssl SSLContext set_ciphers11013870 +Ref: 349d11013870 +Ref: library/ssl ssl SSLContext set_alpn_protocols11014470 +Ref: e5f11014470 +Ref: library/ssl ssl SSLContext set_npn_protocols11015108 +Ref: 2fc11015108 +Ref: library/ssl ssl SSLContext sni_callback11015847 +Ref: 18d511015847 +Ref: library/ssl ssl SSLContext set_servername_callback11018487 +Ref: fb111018487 +Ref: library/ssl ssl SSLContext load_dh_params11019164 +Ref: 113611019164 +Ref: library/ssl ssl SSLContext set_ecdh_curve11019709 +Ref: 113711019709 +Ref: library/ssl ssl SSLContext wrap_socket11020438 +Ref: 52011020438 +Ref: library/ssl ssl SSLContext sslsocket_class11023342 +Ref: 349e11023342 +Ref: library/ssl ssl SSLContext wrap_bio11023640 +Ref: b8211023640 +Ref: library/ssl ssl SSLContext sslobject_class11024379 +Ref: 349f11024379 +Ref: library/ssl ssl SSLContext session_stats11024674 +Ref: 34a011024674 +Ref: library/ssl ssl SSLContext check_hostname11025139 +Ref: 346e11025139 +Ref: library/ssl ssl SSLContext keylog_filename11026666 +Ref: 345c11026666 +Ref: library/ssl ssl SSLContext maximum_version11027112 +Ref: 86e11027112 +Ref: library/ssl ssl SSLContext minimum_version11027970 +Ref: 86d11027970 +Ref: library/ssl ssl SSLContext num_tickets11028183 +Ref: 34a111028183 +Ref: library/ssl ssl SSLContext options11028416 +Ref: 83411028416 +Ref: library/ssl ssl SSLContext post_handshake_auth11029147 +Ref: a3011029147 +Ref: library/ssl ssl SSLContext protocol11029964 +Ref: 34a211029964 +Ref: library/ssl ssl SSLContext hostname_checks_common_name11030100 +Ref: b7d11030100 +Ref: library/ssl ssl SSLContext security_level11030535 +Ref: 34a311030535 +Ref: library/ssl ssl SSLContext verify_flags11030710 +Ref: fa811030710 +Ref: library/ssl ssl SSLContext verify_mode11031246 +Ref: 345a11031246 +Ref: library/ssl ssl SSLContext set_psk_client_callback11031716 +Ref: 34a411031716 +Ref: library/ssl ssl SSLContext set_psk_server_callback11033717 +Ref: 34a511033717 +Ref: SSL Contexts-Footnote-111035601 +Ref: SSL Contexts-Footnote-211035755 +Ref: SSL Contexts-Footnote-311035842 +Ref: SSL Contexts-Footnote-411035929 +Ref: SSL Contexts-Footnote-511036083 +Ref: SSL Contexts-Footnote-611036170 +Ref: SSL Contexts-Footnote-711036257 +Ref: SSL Contexts-Footnote-811036334 +Ref: SSL Contexts-Footnote-911036388 +Ref: SSL Contexts-Footnote-1011036447 +Ref: SSL Contexts-Footnote-1111036526 +Ref: SSL Contexts-Footnote-1211036586 +Ref: SSL Contexts-Footnote-1311036663 +Ref: SSL Contexts-Footnote-1411036729 +Node: Certificates11036803 +Ref: library/ssl certificates11036936 +Ref: 34a611036936 +Ref: library/ssl ssl-certificates11036936 +Ref: 349c11036936 +Ref: Certificates-Footnote-111039285 +Node: Certificate chains11039344 +Ref: library/ssl certificate-chains11039435 +Ref: 34a711039435 +Node: CA certificates11040706 +Ref: library/ssl ca-certificates11040834 +Ref: 34a811040834 +Node: Combined key and certificate11041424 +Ref: library/ssl combined-key-and-certificate11041558 +Ref: 34a911041558 +Node: Self-signed certificates11042174 +Ref: library/ssl self-signed-certificates11042284 +Ref: 34aa11042284 +Node: Examples<20>11043982 +Ref: library/ssl examples11044132 +Ref: 34ab11044132 +Node: Testing for SSL support11044261 +Ref: library/ssl testing-for-ssl-support11044363 +Ref: 34ac11044363 +Node: Client-side operation11044677 +Ref: library/ssl client-side-operation11044809 +Ref: 34ad11044809 +Node: Server-side operation11049550 +Ref: library/ssl server-side-operation11049650 +Ref: 34ae11049650 +Node: Notes on non-blocking sockets11051659 +Ref: library/ssl notes-on-non-blocking-sockets11051818 +Ref: 34af11051818 +Ref: library/ssl ssl-nonblocking11051818 +Ref: 346011051818 +Node: Memory BIO Support<2>11054729 +Ref: library/ssl memory-bio-support11054887 +Ref: 34b011054887 +Ref: library/ssl ssl SSLObject11056005 +Ref: b8111056005 +Ref: library/ssl ssl MemoryBIO11059665 +Ref: e5d11059665 +Ref: library/ssl ssl MemoryBIO pending11059793 +Ref: 34b111059793 +Ref: library/ssl ssl MemoryBIO eof11059892 +Ref: 34b211059892 +Ref: library/ssl ssl MemoryBIO read11060022 +Ref: 34b311060022 +Ref: library/ssl ssl MemoryBIO write11060180 +Ref: 34b411060180 +Ref: library/ssl ssl MemoryBIO write_eof11060462 +Ref: 34b511060462 +Node: SSL session11060754 +Ref: library/ssl ssl-session11060909 +Ref: 34b611060909 +Ref: library/ssl ssl SSLSession11060977 +Ref: cdd11060977 +Ref: library/ssl ssl SSLSession id11061054 +Ref: 34b711061054 +Ref: library/ssl ssl SSLSession time11061078 +Ref: 34b811061078 +Ref: library/ssl ssl SSLSession timeout11061104 +Ref: 34b911061104 +Ref: library/ssl ssl SSLSession ticket_lifetime_hint11061133 +Ref: 34ba11061133 +Ref: library/ssl ssl SSLSession has_ticket11061175 +Ref: 34bb11061175 +Node: Security considerations<2>11061207 +Ref: library/ssl security-considerations11061348 +Ref: 34bc11061348 +Ref: library/ssl ssl-security11061348 +Ref: 334b11061348 +Node: Best defaults11061486 +Ref: library/ssl best-defaults11061586 +Ref: 34bd11061586 +Node: Manual settings11062747 +Ref: library/ssl manual-settings11062872 +Ref: 34be11062872 +Node: Verifying certificates11063005 +Ref: library/ssl verifying-certificates11063105 +Ref: 34bf11063105 +Node: Protocol versions11064298 +Ref: library/ssl protocol-versions11064423 +Ref: 34c011064423 +Node: Cipher selection11065247 +Ref: library/ssl cipher-selection11065341 +Ref: 34c111065341 +Ref: Cipher selection-Footnote-111065997 +Node: Multi-processing11066069 +Ref: library/ssl multi-processing11066172 +Ref: 34c211066172 +Node: TLS 1 311066695 +Ref: library/ssl ssl-tlsv1-311066816 +Ref: b8011066816 +Ref: library/ssl tls-1-311066816 +Ref: 34c311066816 +Ref: TLS 1 3-Footnote-111068930 +Ref: TLS 1 3-Footnote-211068996 +Ref: TLS 1 3-Footnote-311069055 +Ref: TLS 1 3-Footnote-411069114 +Ref: TLS 1 3-Footnote-511069173 +Ref: TLS 1 3-Footnote-611069232 +Ref: TLS 1 3-Footnote-711069291 +Ref: TLS 1 3-Footnote-811069367 +Ref: TLS 1 3-Footnote-911069426 +Node: select — Waiting for I/O completion11069484 +Ref: library/select doc11069700 +Ref: 34c411069700 +Ref: library/select module-select11069700 +Ref: c111069700 +Ref: library/select select-waiting-for-i-o-completion11069700 +Ref: 34c511069700 +Ref: library/select select error11070871 +Ref: 104f11070871 +Ref: library/select select devpoll11071058 +Ref: f9011071058 +Ref: library/select select epoll11071780 +Ref: f8e11071780 +Ref: library/select select poll11073266 +Ref: 2bb811073266 +Ref: library/select select kqueue11073585 +Ref: 16cd11073585 +Ref: library/select select kevent11073924 +Ref: 34ca11073924 +Ref: library/select select select11074201 +Ref: d9f11074201 +Ref: library/select select PIPE_BUF11076471 +Ref: 11fc11076471 +Ref: select — Waiting for I/O completion-Footnote-111077156 +Ref: select — Waiting for I/O completion-Footnote-211077198 +Node: /dev/poll Polling Objects11077240 +Ref: library/select dev-poll-polling-objects11077392 +Ref: 34cc11077392 +Ref: library/select devpoll-objects11077392 +Ref: 34c611077392 +Ref: library/select select devpoll close11077758 +Ref: f9211077758 +Ref: library/select select devpoll closed11077871 +Ref: f9311077871 +Ref: library/select select devpoll fileno11077980 +Ref: f9111077980 +Ref: library/select select devpoll register11078102 +Ref: 34cd11078102 +Ref: library/select select devpoll modify11079086 +Ref: 34ce11079086 +Ref: library/select select devpoll unregister11079294 +Ref: 34cf11079294 +Ref: library/select select devpoll poll11079651 +Ref: d9b11079651 +Ref: /dev/poll Polling Objects-Footnote-111080794 +Node: Edge and Level Trigger Polling epoll Objects11080836 +Ref: library/select edge-and-level-trigger-polling-epoll-objects11081012 +Ref: 34d011081012 +Ref: library/select epoll-objects11081012 +Ref: 34c711081012 +Ref: library/select select epoll close11083882 +Ref: f8f11083882 +Ref: library/select select epoll closed11083971 +Ref: 34d111083971 +Ref: library/select select epoll fileno11084048 +Ref: 34d211084048 +Ref: library/select select epoll fromfd11084136 +Ref: 34d311084136 +Ref: library/select select epoll register11084226 +Ref: 34d411084226 +Ref: library/select select epoll modify11084326 +Ref: 34d511084326 +Ref: library/select select epoll unregister11084411 +Ref: 95a11084411 +Ref: library/select select epoll poll11084604 +Ref: d9c11084604 +Ref: Edge and Level Trigger Polling epoll Objects-Footnote-111085006 +Node: Polling Objects11085048 +Ref: library/select poll-objects11085213 +Ref: 34c811085213 +Ref: library/select polling-objects11085213 +Ref: 34d611085213 +Ref: library/select select poll register11085788 +Ref: 34d711085788 +Ref: library/select select poll modify11087765 +Ref: 34d811087765 +Ref: library/select select poll unregister11088066 +Ref: 34d911088066 +Ref: library/select select poll poll11088455 +Ref: d9e11088455 +Ref: Polling Objects-Footnote-111089601 +Node: Kqueue Objects11089643 +Ref: library/select id111089778 +Ref: 34da11089778 +Ref: library/select kqueue-objects11089778 +Ref: 34c911089778 +Ref: library/select select kqueue close11089827 +Ref: 34db11089827 +Ref: library/select select kqueue closed11089918 +Ref: 34dc11089918 +Ref: library/select select kqueue fileno11089997 +Ref: 34dd11089997 +Ref: library/select select kqueue fromfd11090086 +Ref: 34de11090086 +Ref: library/select select kqueue control11090177 +Ref: d9d11090177 +Ref: Kqueue Objects-Footnote-111090828 +Node: Kevent Objects11090870 +Ref: library/select id211090981 +Ref: 34df11090981 +Ref: library/select kevent-objects11090981 +Ref: 34cb11090981 +Ref: library/select select kevent ident11091096 +Ref: 34e011091096 +Ref: library/select select kevent filter11091398 +Ref: 34e111091398 +Ref: library/select select kevent flags11093177 +Ref: 34e211093177 +Ref: library/select select kevent fflags11094838 +Ref: 34e311094838 +Ref: library/select select kevent data11098580 +Ref: 34e411098580 +Ref: library/select select kevent udata11098636 +Ref: 34e511098636 +Node: selectors — High-level I/O multiplexing11098691 +Ref: library/selectors doc11098912 +Ref: 34e611098912 +Ref: library/selectors module-selectors11098912 +Ref: c211098912 +Ref: library/selectors selectors-high-level-i-o-multiplexing11098912 +Ref: 34e711098912 +Ref: selectors — High-level I/O multiplexing-Footnote-111099273 +Node: Introduction<10>11099342 +Ref: library/selectors introduction11099455 +Ref: 34e811099455 +Node: Classes<4>11100794 +Ref: library/selectors classes11100928 +Ref: 34eb11100928 +Ref: library/selectors selectors EVENT_READ11101505 +Ref: 34ec11101505 +Ref: library/selectors selectors EVENT_WRITE11101594 +Ref: 34ed11101594 +Ref: library/selectors selectors SelectorKey11101671 +Ref: 34ee11101671 +Ref: library/selectors selectors SelectorKey fileobj11101949 +Ref: 34ef11101949 +Ref: library/selectors selectors SelectorKey fd11102013 +Ref: 34f011102013 +Ref: library/selectors selectors SelectorKey events11102076 +Ref: 34f111102076 +Ref: library/selectors selectors SelectorKey data11102167 +Ref: 34f211102167 +Ref: library/selectors selectors BaseSelector11102333 +Ref: 34e911102333 +Ref: library/selectors selectors BaseSelector register11103009 +Ref: 34f311103009 +Ref: library/selectors selectors BaseSelector unregister11103663 +Ref: 34f411103663 +Ref: library/selectors selectors BaseSelector modify11104283 +Ref: bd411104283 +Ref: library/selectors selectors BaseSelector select11104879 +Ref: 34f511104879 +Ref: library/selectors selectors BaseSelector close11106178 +Ref: 34f611106178 +Ref: library/selectors selectors BaseSelector get_key11106396 +Ref: 34f711106396 +Ref: library/selectors selectors BaseSelector get_map11106683 +Ref: 34f811106683 +Ref: library/selectors selectors DefaultSelector11106951 +Ref: 34ea11106951 +Ref: library/selectors selectors SelectSelector11107159 +Ref: 33d511107159 +Ref: library/selectors selectors PollSelector11107246 +Ref: bd611107246 +Ref: library/selectors selectors EpollSelector11107330 +Ref: bd511107330 +Ref: library/selectors selectors EpollSelector fileno11107415 +Ref: 34f911107415 +Ref: library/selectors selectors DevpollSelector11107555 +Ref: bd711107555 +Ref: library/selectors selectors DevpollSelector fileno11107644 +Ref: 34fa11107644 +Ref: library/selectors selectors KqueueSelector11107814 +Ref: 33d811107814 +Ref: library/selectors selectors KqueueSelector fileno11107902 +Ref: 34fb11107902 +Ref: Classes<4>-Footnote-111108080 +Node: Examples<21>11108122 +Ref: library/selectors examples11108231 +Ref: 34fc11108231 +Node: signal — Set handlers for asynchronous events11109258 +Ref: library/signal doc11109477 +Ref: 34fd11109477 +Ref: library/signal module-signal11109477 +Ref: c611109477 +Ref: library/signal signal-set-handlers-for-asynchronous-events11109477 +Ref: 34fe11109477 +Ref: signal — Set handlers for asynchronous events-Footnote-111109954 +Node: General rules11110020 +Ref: library/signal general-rules11110144 +Ref: 34ff11110144 +Node: Execution of Python signal handlers11111111 +Ref: library/signal execution-of-python-signal-handlers11111224 +Ref: 350111111224 +Node: Signals and threads11112546 +Ref: library/signal id111112659 +Ref: 350311112659 +Ref: library/signal signals-and-threads11112659 +Ref: 350411112659 +Node: Module contents<2>11113131 +Ref: library/signal module-contents11113276 +Ref: 350511113276 +Ref: library/signal signal Signals11113890 +Ref: 350911113890 +Ref: library/signal signal Handlers11114036 +Ref: 350a11114036 +Ref: library/signal signal Sigmasks11114199 +Ref: 350b11114199 +Ref: library/signal signal SIG_DFL11114601 +Ref: 182011114601 +Ref: library/signal signal SIG_IGN11114933 +Ref: 181f11114933 +Ref: library/signal signal SIGABRT11115054 +Ref: 1d4b11115054 +Ref: library/signal signal SIGALRM11115123 +Ref: 350c11115123 +Ref: library/signal signal SIGBREAK11115231 +Ref: 350d11115231 +Ref: library/signal signal SIGBUS11115346 +Ref: 1d4c11115346 +Ref: library/signal signal SIGCHLD11115447 +Ref: 2bf311115447 +Ref: library/signal signal SIGCLD11115555 +Ref: 350e11115555 +Ref: library/signal signal SIGCONT11115660 +Ref: 2c0111115660 +Ref: library/signal signal SIGFPE11115779 +Ref: 1d4a11115779 +Ref: library/signal signal SIGHUP11116016 +Ref: 350f11116016 +Ref: library/signal signal SIGILL11116164 +Ref: 1d4d11116164 +Ref: library/signal signal SIGINT11116216 +Ref: 84011116216 +Ref: library/signal signal SIGKILL11116346 +Ref: 331411116346 +Ref: library/signal signal SIGPIPE11116478 +Ref: 350011116478 +Ref: library/signal signal SIGSEGV11116639 +Ref: 1d4911116639 +Ref: library/signal signal SIGSTKFLT11116717 +Ref: 186411116717 +Ref: library/signal signal SIGTERM11117057 +Ref: 13ab11117057 +Ref: library/signal signal SIGUSR111117109 +Ref: 351011117109 +Ref: library/signal signal SIGUSR211117203 +Ref: 351111117203 +Ref: library/signal signal SIGWINCH11117297 +Ref: 351211117297 +Ref: library/signal signal CTRL_C_EVENT11117960 +Ref: 135411117960 +Ref: library/signal signal CTRL_BREAK_EVENT11118198 +Ref: 135511118198 +Ref: library/signal signal NSIG11118443 +Ref: 17fd11118443 +Ref: library/signal signal ITIMER_REAL11118595 +Ref: 351411118595 +Ref: library/signal signal ITIMER_VIRTUAL11118727 +Ref: 351511118727 +Ref: library/signal signal ITIMER_PROF11118873 +Ref: 351611118873 +Ref: library/signal signal SIG_BLOCK11119212 +Ref: 350611119212 +Ref: library/signal signal SIG_UNBLOCK11119397 +Ref: 350711119397 +Ref: library/signal signal SIG_SETMASK11119591 +Ref: 350811119591 +Ref: library/signal signal ItimerError11119844 +Ref: 351711119844 +Ref: library/signal signal alarm11120370 +Ref: 351a11120370 +Ref: library/signal signal getsignal11121017 +Ref: 16ac11121017 +Ref: library/signal signal strsignal11121589 +Ref: 1a3d11121589 +Ref: library/signal signal valid_signals11121895 +Ref: 351311121895 +Ref: library/signal signal pause11122140 +Ref: 351b11122140 +Ref: library/signal signal raise_signal11122532 +Ref: 180111122532 +Ref: library/signal signal pidfd_send_signal11122667 +Ref: 92b11122667 +Ref: library/signal signal pthread_kill11123228 +Ref: 112511123228 +Ref: library/signal signal pthread_sigmask11124461 +Ref: 112411124461 +Ref: library/signal signal setitimer11125897 +Ref: 351811125897 +Ref: library/signal signal getitimer11126916 +Ref: 351911126916 +Ref: library/signal signal set_wakeup_fd11127076 +Ref: b7011127076 +Ref: library/signal signal siginterrupt11129464 +Ref: 112911129464 +Ref: library/signal signal signal11130072 +Ref: 112811130072 +Ref: library/signal signal sigpending11131578 +Ref: 112611131578 +Ref: library/signal signal sigwait11132045 +Ref: 112711132045 +Ref: library/signal signal sigwaitinfo11132631 +Ref: daa11132631 +Ref: library/signal signal sigtimedwait11133903 +Ref: da911133903 +Ref: Module contents<2>-Footnote-111134680 +Ref: Module contents<2>-Footnote-211134731 +Ref: Module contents<2>-Footnote-311134786 +Ref: Module contents<2>-Footnote-411134831 +Ref: Module contents<2>-Footnote-511134876 +Ref: Module contents<2>-Footnote-611134922 +Ref: Module contents<2>-Footnote-711134968 +Ref: Module contents<2>-Footnote-811135014 +Ref: Module contents<2>-Footnote-911135059 +Ref: Module contents<2>-Footnote-1011135105 +Ref: Module contents<2>-Footnote-1111135163 +Ref: Module contents<2>-Footnote-1211135216 +Ref: Module contents<2>-Footnote-1311135268 +Ref: Module contents<2>-Footnote-1411135324 +Ref: Module contents<2>-Footnote-1511135377 +Ref: Module contents<2>-Footnote-1611135424 +Ref: Module contents<2>-Footnote-1711135475 +Ref: Module contents<2>-Footnote-1811135523 +Ref: Module contents<2>-Footnote-1911135575 +Ref: Module contents<2>-Footnote-2011135618 +Ref: Module contents<2>-Footnote-2111135671 +Node: Examples<22>11135714 +Ref: library/signal examples11135861 +Ref: 351c11135861 +Ref: library/signal signal-example11135861 +Ref: 351d11135861 +Node: Note on SIGPIPE11136823 +Ref: library/signal note-on-sigpipe11136990 +Ref: 351e11136990 +Ref: Note on SIGPIPE-Footnote-111138439 +Node: Note on Signal Handlers and Exceptions11138483 +Ref: library/signal handlers-and-exceptions11138629 +Ref: 228a11138629 +Ref: library/signal note-on-signal-handlers-and-exceptions11138629 +Ref: 351f11138629 +Node: mmap — Memory-mapped file support11141236 +Ref: library/mmap doc11141405 +Ref: 352011141405 +Ref: library/mmap mmap-memory-mapped-file-support11141405 +Ref: 352111141405 +Ref: library/mmap module-mmap11141405 +Ref: 9011141405 +Ref: library/mmap mmap mmap11144012 +Ref: 20d11144012 +Ref: library/mmap mmap mmap close11149623 +Ref: 352711149623 +Ref: library/mmap mmap mmap closed11149834 +Ref: 352811149834 +Ref: library/mmap mmap mmap find11149940 +Ref: 352911149940 +Ref: library/mmap mmap mmap flush11150370 +Ref: a9811150370 +Ref: library/mmap mmap mmap madvise11151258 +Ref: a0711151258 +Ref: library/mmap mmap mmap move11151826 +Ref: 352b11151826 +Ref: library/mmap mmap mmap read11152104 +Ref: 10d311152104 +Ref: library/mmap mmap mmap read_byte11152556 +Ref: 352c11152556 +Ref: library/mmap mmap mmap readline11152704 +Ref: 352d11152704 +Ref: library/mmap mmap mmap resize11152929 +Ref: 352611152929 +Ref: library/mmap mmap mmap rfind11153788 +Ref: 352e11153788 +Ref: library/mmap mmap mmap seek11154220 +Ref: 20f11154220 +Ref: library/mmap mmap mmap seekable11154708 +Ref: 20e11154708 +Ref: library/mmap mmap mmap size11154878 +Ref: 352511154878 +Ref: library/mmap mmap mmap tell11155017 +Ref: 352f11155017 +Ref: library/mmap mmap mmap write11155104 +Ref: 353011155104 +Ref: library/mmap mmap mmap write_byte11155811 +Ref: 353111155811 +Node: MADV_* Constants11156177 +Ref: library/mmap madv-constants11156289 +Ref: 353211156289 +Ref: library/mmap madvise-constants11156289 +Ref: 352a11156289 +Ref: library/mmap mmap MADV_NORMAL11156342 +Ref: 353311156342 +Ref: library/mmap mmap MADV_RANDOM11156369 +Ref: 353411156369 +Ref: library/mmap mmap MADV_SEQUENTIAL11156396 +Ref: 353511156396 +Ref: library/mmap mmap MADV_WILLNEED11156427 +Ref: 353611156427 +Ref: library/mmap mmap MADV_DONTNEED11156456 +Ref: 353711156456 +Ref: library/mmap mmap MADV_REMOVE11156485 +Ref: 353811156485 +Ref: library/mmap mmap MADV_DONTFORK11156512 +Ref: 353911156512 +Ref: library/mmap mmap MADV_DOFORK11156541 +Ref: 353a11156541 +Ref: library/mmap mmap MADV_HWPOISON11156568 +Ref: 353b11156568 +Ref: library/mmap mmap MADV_MERGEABLE11156597 +Ref: 353c11156597 +Ref: library/mmap mmap MADV_UNMERGEABLE11156627 +Ref: 353d11156627 +Ref: library/mmap mmap MADV_SOFT_OFFLINE11156659 +Ref: 353e11156659 +Ref: library/mmap mmap MADV_HUGEPAGE11156692 +Ref: 353f11156692 +Ref: library/mmap mmap MADV_NOHUGEPAGE11156721 +Ref: 354011156721 +Ref: library/mmap mmap MADV_DONTDUMP11156752 +Ref: 354111156752 +Ref: library/mmap mmap MADV_DODUMP11156781 +Ref: 354211156781 +Ref: library/mmap mmap MADV_FREE11156808 +Ref: 354311156808 +Ref: library/mmap mmap MADV_NOSYNC11156833 +Ref: 354411156833 +Ref: library/mmap mmap MADV_AUTOSYNC11156860 +Ref: 354511156860 +Ref: library/mmap mmap MADV_NOCORE11156889 +Ref: 354611156889 +Ref: library/mmap mmap MADV_CORE11156916 +Ref: 354711156916 +Ref: library/mmap mmap MADV_PROTECT11156941 +Ref: 354811156941 +Ref: library/mmap mmap MADV_FREE_REUSABLE11156969 +Ref: 354911156969 +Ref: library/mmap mmap MADV_FREE_REUSE11157003 +Ref: 354a11157003 +Node: MAP_* Constants11157243 +Ref: library/mmap id111157355 +Ref: 354b11157355 +Ref: library/mmap map-constants11157355 +Ref: 352411157355 +Ref: library/mmap mmap MAP_SHARED11157406 +Ref: 352311157406 +Ref: library/mmap mmap MAP_PRIVATE11157432 +Ref: 352211157432 +Ref: library/mmap mmap MAP_32BIT11157459 +Ref: 16a111157459 +Ref: library/mmap mmap MAP_ALIGNED_SUPER11157484 +Ref: 175611157484 +Ref: library/mmap mmap MAP_ANON11157517 +Ref: 354c11157517 +Ref: library/mmap mmap MAP_ANONYMOUS11157541 +Ref: 354d11157541 +Ref: library/mmap mmap MAP_CONCEAL11157570 +Ref: 175711157570 +Ref: library/mmap mmap MAP_DENYWRITE11157597 +Ref: 354e11157597 +Ref: library/mmap mmap MAP_EXECUTABLE11157626 +Ref: 354f11157626 +Ref: library/mmap mmap MAP_HASSEMAPHORE11157656 +Ref: 169c11157656 +Ref: library/mmap mmap MAP_JIT11157688 +Ref: 169e11157688 +Ref: library/mmap mmap MAP_NOCACHE11157711 +Ref: 169d11157711 +Ref: library/mmap mmap MAP_NOEXTEND11157738 +Ref: 169b11157738 +Ref: library/mmap mmap MAP_NORESERVE11157766 +Ref: 169a11157766 +Ref: library/mmap mmap MAP_POPULATE11157795 +Ref: 194811157795 +Ref: library/mmap mmap MAP_RESILIENT_CODESIGN11157823 +Ref: 169f11157823 +Ref: library/mmap mmap MAP_RESILIENT_MEDIA11157861 +Ref: 16a011157861 +Ref: library/mmap mmap MAP_STACK11157896 +Ref: 355011157896 +Ref: library/mmap mmap MAP_TPRO11157921 +Ref: 16a411157921 +Ref: library/mmap mmap MAP_TRANSLATED_ALLOW_EXECUTE11157945 +Ref: 16a211157945 +Ref: library/mmap mmap MAP_UNIX0311157989 +Ref: 16a311157989 +Node: Internet Data Handling11158933 +Ref: library/netdata doc11159112 +Ref: 355111159112 +Ref: library/netdata internet-data-handling11159112 +Ref: 355211159112 +Ref: library/netdata netdata11159112 +Ref: 355311159112 +Node: email — An email and MIME handling package11159692 +Ref: library/email doc11159837 +Ref: 355411159837 +Ref: library/email email-an-email-and-mime-handling-package11159837 +Ref: 355511159837 +Ref: library/email module-email11159837 +Ref: 3b11159837 +Ref: email — An email and MIME handling package-Footnote-111166575 +Ref: email — An email and MIME handling package-Footnote-211166649 +Ref: email — An email and MIME handling package-Footnote-311166708 +Ref: email — An email and MIME handling package-Footnote-411166767 +Ref: email — An email and MIME handling package-Footnote-511166826 +Ref: email — An email and MIME handling package-Footnote-611166885 +Ref: email — An email and MIME handling package-Footnote-711166944 +Ref: email — An email and MIME handling package-Footnote-811167003 +Ref: email — An email and MIME handling package-Footnote-911167062 +Node: email message Representing an email message11167121 +Ref: library/email message doc11167289 +Ref: 355611167289 +Ref: library/email message email-message-representing-an-email-message11167289 +Ref: 355711167289 +Ref: library/email message module-email message11167289 +Ref: 4411167289 +Ref: library/email message email message EmailMessage11169762 +Ref: 27d11169762 +Ref: library/email message email message EmailMessage as_string11170243 +Ref: 355a11170243 +Ref: library/email message email message EmailMessage __str__11172096 +Ref: 355c11172096 +Ref: library/email message email message EmailMessage as_bytes11172565 +Ref: 355d11172565 +Ref: library/email message email message EmailMessage __bytes__11173729 +Ref: 355e11173729 +Ref: library/email message email message EmailMessage is_multipart11173905 +Ref: 355f11173905 +Ref: library/email message email message EmailMessage set_unixfrom11174590 +Ref: 356011174590 +Ref: library/email message email message EmailMessage get_unixfrom11174812 +Ref: 356211174812 +Ref: library/email message email message EmailMessage __len__11175944 +Ref: 356411175944 +Ref: library/email message email message EmailMessage __contains__11176042 +Ref: 356511176042 +Ref: library/email message email message EmailMessage __getitem__11176432 +Ref: 356611176432 +Ref: library/email message email message EmailMessage __setitem__11177149 +Ref: 356911177149 +Ref: library/email message email message EmailMessage __delitem__11178187 +Ref: 356a11178187 +Ref: library/email message email message EmailMessage keys11178413 +Ref: 356311178413 +Ref: library/email message email message EmailMessage values11178507 +Ref: 356b11178507 +Ref: library/email message email message EmailMessage items11178597 +Ref: 356c11178597 +Ref: library/email message email message EmailMessage get11178728 +Ref: 356d11178728 +Ref: library/email message email message EmailMessage get_all11179076 +Ref: 356711179076 +Ref: library/email message email message EmailMessage add_header11179313 +Ref: 356e11179313 +Ref: library/email message email message EmailMessage replace_header11181277 +Ref: 356f11181277 +Ref: library/email message email message EmailMessage get_content_type11181583 +Ref: 357011181583 +Ref: library/email message email message EmailMessage get_content_maintype11182467 +Ref: 357211182467 +Ref: library/email message email message EmailMessage get_content_subtype11182673 +Ref: 357311182673 +Ref: library/email message email message EmailMessage get_default_type11182866 +Ref: 357111182866 +Ref: library/email message email message EmailMessage set_default_type11183186 +Ref: 357411183186 +Ref: library/email message email message EmailMessage set_param11183628 +Ref: 357511183628 +Ref: library/email message email message EmailMessage del_param11185249 +Ref: 357711185249 +Ref: library/email message email message EmailMessage get_filename11185685 +Ref: 357811185685 +Ref: library/email message email message EmailMessage get_boundary11186224 +Ref: 357a11186224 +Ref: library/email message email message EmailMessage set_boundary11186588 +Ref: 357b11186588 +Ref: library/email message email message EmailMessage get_content_charset11187256 +Ref: 357d11187256 +Ref: library/email message email message EmailMessage get_charsets11187558 +Ref: 357e11187558 +Ref: library/email message email message EmailMessage is_attachment11188251 +Ref: 357f11188251 +Ref: library/email message email message EmailMessage get_content_disposition11188618 +Ref: 358111188618 +Ref: library/email message email message EmailMessage walk11189095 +Ref: 358211189095 +Ref: library/email message email message EmailMessage get_body11191108 +Ref: 358311191108 +Ref: library/email message email message EmailMessage iter_attachments11193227 +Ref: 358411193227 +Ref: library/email message email message EmailMessage iter_parts11194201 +Ref: 358511194201 +Ref: library/email message email message EmailMessage get_content11194414 +Ref: 358611194414 +Ref: library/email message email message EmailMessage set_content11194824 +Ref: 18a811194824 +Ref: library/email message email message EmailMessage make_related11195234 +Ref: 358911195234 +Ref: library/email message email message EmailMessage make_alternative11195722 +Ref: 358a11195722 +Ref: library/email message email message EmailMessage make_mixed11196241 +Ref: 358b11196241 +Ref: library/email message email message EmailMessage add_related11196780 +Ref: 358c11196780 +Ref: library/email message email message EmailMessage add_alternative11197537 +Ref: 358e11197537 +Ref: library/email message email message EmailMessage add_attachment11198227 +Ref: 358f11198227 +Ref: library/email message email message EmailMessage clear11199212 +Ref: 359011199212 +Ref: library/email message email message EmailMessage clear_content11199293 +Ref: 359111199293 +Ref: library/email message email message EmailMessage preamble11199554 +Ref: 359211199554 +Ref: library/email message email message EmailMessage epilogue11200818 +Ref: 359311200818 +Ref: library/email message email message EmailMessage defects11201164 +Ref: 359411201164 +Ref: library/email message email message MIMEPart11201406 +Ref: f3511201406 +Ref: email message Representing an email message-Footnote-111201772 +Ref: email message Representing an email message-Footnote-211201845 +Ref: email message Representing an email message-Footnote-311202042 +Ref: email message Representing an email message-Footnote-411202101 +Ref: email message Representing an email message-Footnote-511202160 +Ref: email message Representing an email message-Footnote-611202219 +Ref: email message Representing an email message-Footnote-711202278 +Ref: email message Representing an email message-Footnote-811202337 +Ref: email message Representing an email message-Footnote-911202396 +Ref: email message Representing an email message-Footnote-1011202455 +Ref: email message Representing an email message-Footnote-1111202515 +Ref: email message Representing an email message-Footnote-1211202575 +Ref: email message Representing an email message-Footnote-1311202635 +Node: email parser Parsing email messages11202695 +Ref: library/email parser doc11202913 +Ref: 359511202913 +Ref: library/email parser email-parser-parsing-email-messages11202913 +Ref: 359611202913 +Ref: library/email parser module-email parser11202913 +Ref: 4e11202913 +Ref: email parser Parsing email messages-Footnote-111205307 +Node: FeedParser API11205379 +Ref: library/email parser feedparser-api11205484 +Ref: 359811205484 +Ref: library/email parser email parser BytesFeedParser11206783 +Ref: 11bd11206783 +Ref: library/email parser email parser BytesFeedParser feed11207986 +Ref: 359911207986 +Ref: library/email parser email parser BytesFeedParser close11208421 +Ref: 359a11208421 +Ref: library/email parser email parser FeedParser11208661 +Ref: 359711208661 +Node: Parser API11209126 +Ref: library/email parser parser-api11209256 +Ref: 359b11209256 +Ref: library/email parser email parser BytesParser11209990 +Ref: 11be11209990 +Ref: library/email parser email parser BytesParser parse11210659 +Ref: 359c11210659 +Ref: library/email parser email parser BytesParser parsebytes11211704 +Ref: 359d11211704 +Ref: library/email parser email parser BytesHeaderParser11212212 +Ref: 10b111212212 +Ref: library/email parser email parser Parser11212433 +Ref: 119011212433 +Ref: library/email parser email parser Parser parse11212779 +Ref: 359e11212779 +Ref: library/email parser email parser Parser parsestr11213217 +Ref: 359f11213217 +Ref: library/email parser email parser HeaderParser11213646 +Ref: 10b211213646 +Ref: library/email parser email message_from_bytes11214044 +Ref: 11bb11214044 +Ref: library/email parser email message_from_binary_file11214514 +Ref: 11bc11214514 +Ref: library/email parser email message_from_string11214992 +Ref: 35a011214992 +Ref: library/email parser email message_from_file11215388 +Ref: 35a111215388 +Ref: Parser API-Footnote-111216120 +Ref: Parser API-Footnote-211216179 +Node: Additional notes11216238 +Ref: library/email parser additional-notes11216345 +Ref: 35a211216345 +Node: email generator Generating MIME documents11217899 +Ref: library/email generator doc11218101 +Ref: 35a411218101 +Ref: library/email generator email-generator-generating-mime-documents11218101 +Ref: 35a511218101 +Ref: library/email generator module-email generator11218101 +Ref: 4011218101 +Ref: library/email generator email generator BytesGenerator11220193 +Ref: 11c111220193 +Ref: library/email generator email generator BytesGenerator flatten11222102 +Ref: 35a711222102 +Ref: library/email generator email generator BytesGenerator clone11223925 +Ref: 35aa11223925 +Ref: library/email generator email generator BytesGenerator write11224124 +Ref: 35a811224124 +Ref: library/email generator email generator Generator11225180 +Ref: 11c011225180 +Ref: library/email generator email generator Generator flatten11227027 +Ref: 35ab11227027 +Ref: library/email generator email generator Generator clone11228788 +Ref: 35ad11228788 +Ref: library/email generator email generator Generator write11228974 +Ref: 35ac11228974 +Ref: library/email generator email generator DecodedGenerator11229886 +Ref: c9711229886 +Ref: email generator Generating MIME documents-Footnote-111231305 +Ref: email generator Generating MIME documents-Footnote-211231381 +Ref: email generator Generating MIME documents-Footnote-311231888 +Ref: email generator Generating MIME documents-Footnote-411231940 +Ref: email generator Generating MIME documents-Footnote-511231999 +Ref: email generator Generating MIME documents-Footnote-611232051 +Node: email policy Policy Objects11232110 +Ref: library/email policy doc11232318 +Ref: 35ae11232318 +Ref: library/email policy email-policy-policy-objects11232318 +Ref: 35af11232318 +Ref: library/email policy module-email policy11232318 +Ref: 4f11232318 +Ref: library/email policy email policy Policy11238296 +Ref: 10a911238296 +Ref: library/email policy email policy Policy max_line_length11239119 +Ref: 355b11239119 +Ref: library/email policy email policy Policy linesep11239425 +Ref: 35b011239425 +Ref: library/email policy email policy Policy cte_type11239694 +Ref: 35a911239694 +Ref: library/email policy email policy Policy raise_on_defect11240805 +Ref: 35b211240805 +Ref: library/email policy email policy Policy mangle_from_11241049 +Ref: df511241049 +Ref: library/email policy email policy Policy message_factory11241378 +Ref: c9811241378 +Ref: library/email policy email policy Policy verify_generated_headers11241655 +Ref: 1e211241655 +Ref: library/email policy email policy Policy clone11242503 +Ref: 10ab11242503 +Ref: library/email policy email policy Policy handle_defect11242989 +Ref: 35b511242989 +Ref: library/email policy email policy Policy register_defect11243481 +Ref: 35b311243481 +Ref: library/email policy email policy Policy header_max_count11244187 +Ref: 35b711244187 +Ref: library/email policy email policy Policy header_source_parse11245249 +Ref: 35b811245249 +Ref: library/email policy email policy Policy header_store_parse11246262 +Ref: 35b911246262 +Ref: library/email policy email policy Policy header_fetch_parse11247023 +Ref: 35ba11247023 +Ref: library/email policy email policy Policy fold11247846 +Ref: 35bb11247846 +Ref: library/email policy email policy Policy fold_binary11248562 +Ref: 35b111248562 +Ref: library/email policy email policy EmailPolicy11248896 +Ref: 10ad11248896 +Ref: library/email policy email policy EmailPolicy utf811249729 +Ref: df711249729 +Ref: library/email policy email policy EmailPolicy refold_source11250125 +Ref: 35a611250125 +Ref: library/email policy email policy EmailPolicy header_factory11250920 +Ref: 35bc11250920 +Ref: library/email policy email policy EmailPolicy content_manager11251531 +Ref: f3611251531 +Ref: library/email policy email policy EmailPolicy header_max_count11252243 +Ref: 35be11252243 +Ref: library/email policy email policy EmailPolicy header_source_parse11252449 +Ref: 15a611252449 +Ref: library/email policy email policy EmailPolicy header_store_parse11252834 +Ref: 35c011252834 +Ref: library/email policy email policy EmailPolicy header_fetch_parse11253315 +Ref: 35c111253315 +Ref: library/email policy email policy EmailPolicy fold11253741 +Ref: 167511253741 +Ref: library/email policy email policy EmailPolicy fold_binary11254904 +Ref: 35c211254904 +Ref: library/email policy email policy default11255724 +Ref: 355911255724 +Ref: library/email policy email policy SMTP11255934 +Ref: 35c311255934 +Ref: library/email policy email policy SMTPUTF811256136 +Ref: 35c411256136 +Ref: library/email policy email policy HTTP11256550 +Ref: 35c511256550 +Ref: library/email policy email policy strict11256742 +Ref: 35c611256742 +Ref: library/email policy email policy Compat3211258120 +Ref: 10aa11258120 +Ref: library/email policy email policy Compat32 mangle_from_11258653 +Ref: 35c711258653 +Ref: library/email policy email policy Compat32 header_source_parse11258842 +Ref: 15a711258842 +Ref: library/email policy email policy Compat32 header_store_parse11259227 +Ref: 35c811259227 +Ref: library/email policy email policy Compat32 header_fetch_parse11259333 +Ref: 35c911259333 +Ref: library/email policy email policy Compat32 fold11259575 +Ref: 35ca11259575 +Ref: library/email policy email policy Compat32 fold_binary11259918 +Ref: 35cb11259918 +Ref: library/email policy email policy compat3211260448 +Ref: c9911260448 +Ref: email policy Policy Objects-Footnote-111260652 +Ref: email policy Policy Objects-Footnote-211260724 +Ref: email policy Policy Objects-Footnote-311260783 +Ref: email policy Policy Objects-Footnote-411260842 +Ref: email policy Policy Objects-Footnote-511260901 +Ref: email policy Policy Objects-Footnote-611260960 +Ref: email policy Policy Objects-Footnote-711261019 +Ref: email policy Policy Objects-Footnote-811261078 +Ref: email policy Policy Objects-Footnote-911261148 +Ref: email policy Policy Objects-Footnote-1011261207 +Ref: email policy Policy Objects-Footnote-1111261267 +Ref: email policy Policy Objects-Footnote-1211261327 +Node: email errors Exception and Defect classes11261387 +Ref: library/email errors doc11261596 +Ref: 35cc11261596 +Ref: library/email errors email-errors-exception-and-defect-classes11261596 +Ref: 35cd11261596 +Ref: library/email errors module-email errors11261596 +Ref: 3f11261596 +Ref: library/email errors email errors MessageError11261900 +Ref: 35ce11261900 +Ref: library/email errors email errors MessageParseError11262141 +Ref: 35cf11262141 +Ref: library/email errors email errors HeaderParseError11262418 +Ref: 357c11262418 +Ref: library/email errors email errors BoundaryError11263061 +Ref: 35d011263061 +Ref: library/email errors email errors MultipartConversionError11263141 +Ref: 35d111263141 +Ref: library/email errors email errors HeaderWriteError11263502 +Ref: 35b411263502 +Ref: library/email errors email errors MessageDefect11263634 +Ref: 35b611263634 +Ref: library/email errors email errors HeaderDefect11263805 +Ref: 35d411263805 +Ref: library/email errors email errors NoBoundaryInMultipartDefect11264418 +Ref: 35d511264418 +Ref: library/email errors email errors StartBoundaryNotFoundDefect11264560 +Ref: 35d611264560 +Ref: library/email errors email errors CloseBoundaryNotFoundDefect11264705 +Ref: 35d711264705 +Ref: library/email errors email errors FirstHeaderLineIsContinuationDefect11264881 +Ref: 35d811264881 +Ref: library/email errors email errors MisplacedEnvelopeHeaderDefect11265014 +Ref: 35d911265014 +Ref: library/email errors email errors MissingHeaderBodySeparatorDefect11265147 +Ref: 35da11265147 +Ref: library/email errors email errors MalformedHeaderDefect11265431 +Ref: 35db11265431 +Ref: library/email errors email errors MultipartInvariantViolationDefect11265666 +Ref: 35a311265666 +Ref: library/email errors email errors InvalidBase64PaddingDefect11265984 +Ref: 35dc11265984 +Ref: library/email errors email errors InvalidBase64CharactersDefect11266228 +Ref: 35dd11266228 +Ref: library/email errors email errors InvalidBase64LengthDefect11266484 +Ref: 35de11266484 +Ref: library/email errors email errors InvalidDateDefect11266724 +Ref: 35df11266724 +Ref: email errors Exception and Defect classes-Footnote-111266904 +Ref: email errors Exception and Defect classes-Footnote-211266976 +Node: email headerregistry Custom Header Objects11267035 +Ref: library/email headerregistry doc11267259 +Ref: 35e011267259 +Ref: library/email headerregistry email-headerregistry-custom-header-objects11267259 +Ref: 35e111267259 +Ref: library/email headerregistry module-email headerregistry11267259 +Ref: 4211267259 +Ref: library/email headerregistry email headerregistry BaseHeader11269028 +Ref: 356811269028 +Ref: library/email headerregistry email headerregistry BaseHeader name11269341 +Ref: 35e411269341 +Ref: library/email headerregistry email headerregistry BaseHeader defects11269592 +Ref: 35e511269592 +Ref: library/email headerregistry email headerregistry BaseHeader max_count11269951 +Ref: 35bf11269951 +Ref: library/email headerregistry email headerregistry BaseHeader fold11270468 +Ref: 35e611270468 +Ref: library/email headerregistry email headerregistry UnstructuredHeader11272659 +Ref: 35e311272659 +Ref: library/email headerregistry email headerregistry DateHeader11273738 +Ref: 35e711273738 +Ref: library/email headerregistry email headerregistry DateHeader datetime11274101 +Ref: 35e811274101 +Ref: library/email headerregistry email headerregistry AddressHeader11275670 +Ref: 35e911275670 +Ref: library/email headerregistry email headerregistry AddressHeader groups11275954 +Ref: 35ea11275954 +Ref: library/email headerregistry email headerregistry AddressHeader addresses11276269 +Ref: 35ed11276269 +Ref: library/email headerregistry email headerregistry SingleAddressHeader11277431 +Ref: 35ef11277431 +Ref: library/email headerregistry email headerregistry SingleAddressHeader address11277572 +Ref: 35f011277572 +Ref: library/email headerregistry email headerregistry MIMEVersionHeader11278104 +Ref: 35f111278104 +Ref: library/email headerregistry email headerregistry MIMEVersionHeader version11278496 +Ref: 35f211278496 +Ref: library/email headerregistry email headerregistry MIMEVersionHeader major11278623 +Ref: 35f311278623 +Ref: library/email headerregistry email headerregistry MIMEVersionHeader minor11278700 +Ref: 35f411278700 +Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader11278777 +Ref: 35f511278777 +Ref: library/email headerregistry email headerregistry ParameterizedMIMEHeader params11279160 +Ref: 357611279160 +Ref: library/email headerregistry email headerregistry ContentTypeHeader11279257 +Ref: 35f611279257 +Ref: library/email headerregistry email headerregistry ContentTypeHeader content_type11279408 +Ref: 35f711279408 +Ref: library/email headerregistry email headerregistry ContentTypeHeader maintype11279514 +Ref: 35f811279514 +Ref: library/email headerregistry email headerregistry ContentTypeHeader subtype11279544 +Ref: 35f911279544 +Ref: library/email headerregistry email headerregistry ContentDispositionHeader11279573 +Ref: 35fa11279573 +Ref: library/email headerregistry email headerregistry ContentDispositionHeader content_disposition11279738 +Ref: 35fb11279738 +Ref: library/email headerregistry email headerregistry ContentTransferEncoding11279875 +Ref: 35fc11279875 +Ref: library/email headerregistry email headerregistry ContentTransferEncoding cte11279990 +Ref: 35fd11279990 +Ref: library/email headerregistry email headerregistry HeaderRegistry11280159 +Ref: 35e211280159 +Ref: library/email headerregistry email headerregistry HeaderRegistry map_to_type11281892 +Ref: 35fe11281892 +Ref: library/email headerregistry email headerregistry HeaderRegistry __getitem__11282227 +Ref: 35ff11282227 +Ref: library/email headerregistry email headerregistry HeaderRegistry __call__11282350 +Ref: 360011282350 +Ref: library/email headerregistry email headerregistry Address11282992 +Ref: 35ee11282992 +Ref: library/email headerregistry email headerregistry Address display_name11283831 +Ref: 360111283831 +Ref: library/email headerregistry email headerregistry Address username11284057 +Ref: 360211284057 +Ref: library/email headerregistry email headerregistry Address domain11284177 +Ref: 360311284177 +Ref: library/email headerregistry email headerregistry Address addr_spec11284257 +Ref: 360411284257 +Ref: library/email headerregistry email headerregistry Address __str__11284475 +Ref: 360511284475 +Ref: library/email headerregistry email headerregistry Group11284914 +Ref: 35eb11284914 +Ref: library/email headerregistry email headerregistry Group display_name11285463 +Ref: 35ec11285463 +Ref: library/email headerregistry email headerregistry Group addresses11285718 +Ref: 360611285718 +Ref: library/email headerregistry email headerregistry Group __str__11285866 +Ref: 360711285866 +Ref: email headerregistry Custom Header Objects-Footnote-111286306 +Ref: email headerregistry Custom Header Objects-Footnote-211286387 +Ref: email headerregistry Custom Header Objects-Footnote-311286456 +Ref: email headerregistry Custom Header Objects-Footnote-411286515 +Ref: email headerregistry Custom Header Objects-Footnote-511286574 +Ref: email headerregistry Custom Header Objects-Footnote-611286633 +Ref: email headerregistry Custom Header Objects-Footnote-711286692 +Ref: email headerregistry Custom Header Objects-Footnote-811286751 +Ref: email headerregistry Custom Header Objects-Footnote-911286810 +Ref: email headerregistry Custom Header Objects-Footnote-1011286869 +Ref: email headerregistry Custom Header Objects-Footnote-1111286929 +Ref: email headerregistry Custom Header Objects-Footnote-1211286989 +Ref: email headerregistry Custom Header Objects-Footnote-1311287049 +Ref: email headerregistry Custom Header Objects-Footnote-1411287109 +Ref: email headerregistry Custom Header Objects-Footnote-1511287169 +Ref: email headerregistry Custom Header Objects-Footnote-1611287229 +Ref: email headerregistry Custom Header Objects-Footnote-1711287289 +Node: email contentmanager Managing MIME Content11287349 +Ref: library/email contentmanager doc11287546 +Ref: 360811287546 +Ref: library/email contentmanager email-contentmanager-managing-mime-content11287546 +Ref: 360911287546 +Ref: library/email contentmanager module-email contentmanager11287546 +Ref: 3d11287546 +Ref: library/email contentmanager email contentmanager ContentManager11287805 +Ref: 360a11287805 +Ref: library/email contentmanager email contentmanager ContentManager get_content11288094 +Ref: 358711288094 +Ref: library/email contentmanager email contentmanager ContentManager set_content11288928 +Ref: 358811288928 +Ref: library/email contentmanager email contentmanager ContentManager add_get_handler11290560 +Ref: 360c11290560 +Ref: library/email contentmanager email contentmanager ContentManager add_set_handler11290752 +Ref: 360e11290752 +Ref: email contentmanager Managing MIME Content-Footnote-111291117 +Ref: email contentmanager Managing MIME Content-Footnote-211291198 +Node: Content Manager Instances11291267 +Ref: library/email contentmanager content-manager-instances11291371 +Ref: 361011291371 +Ref: library/email contentmanager email contentmanager raw_data_manager11291712 +Ref: 35bd11291712 +Ref: library/email contentmanager email contentmanager get_content11292442 +Ref: 360d11292442 +Ref: library/email contentmanager email contentmanager set_content11293041 +Ref: 360f11293041 +Ref: Content Manager Instances-Footnote-111297825 +Node: email Examples11297884 +Ref: library/email examples doc11298113 +Ref: 361111298113 +Ref: library/email examples email-examples11298113 +Ref: f3711298113 +Ref: library/email examples id111298113 +Ref: 361211298113 +Ref: email Examples-Footnote-111312739 +Ref: email Examples-Footnote-211312797 +Node: email message Message Representing an email message using the compat32 API11312879 +Ref: library/email compat32-message doc11313121 +Ref: 361311313121 +Ref: library/email compat32-message compat32-message11313121 +Ref: 355811313121 +Ref: library/email compat32-message email-message-message-representing-an-email-message-using-the-compat32-api11313121 +Ref: 361411313121 +Ref: library/email compat32-message email message Message11315679 +Ref: 27e11315679 +Ref: library/email compat32-message email message Message as_string11316212 +Ref: f3111316212 +Ref: library/email compat32-message email message Message __str__11318362 +Ref: 361511318362 +Ref: library/email compat32-message email message Message as_bytes11318527 +Ref: f3211318527 +Ref: library/email compat32-message email message Message __bytes__11320085 +Ref: f3311320085 +Ref: library/email compat32-message email message Message is_multipart11320292 +Ref: 358011320292 +Ref: library/email compat32-message email message Message set_unixfrom11320968 +Ref: 361611320968 +Ref: library/email compat32-message email message Message get_unixfrom11321108 +Ref: 361711321108 +Ref: library/email compat32-message email message Message attach11321265 +Ref: 358d11321265 +Ref: library/email compat32-message email message Message get_payload11321889 +Ref: 11bf11321889 +Ref: library/email compat32-message email message Message set_payload11324571 +Ref: 361811324571 +Ref: library/email compat32-message email message Message set_charset11325055 +Ref: 361911325055 +Ref: library/email compat32-message email message Message get_charset11326832 +Ref: 361a11326832 +Ref: library/email compat32-message email message Message __len__11328290 +Ref: 361c11328290 +Ref: library/email compat32-message email message Message __contains__11328388 +Ref: 177e11328388 +Ref: library/email compat32-message email message Message __getitem__11328758 +Ref: 361d11328758 +Ref: library/email compat32-message email message Message __setitem__11329293 +Ref: 361f11329293 +Ref: library/email compat32-message email message Message __delitem__11329850 +Ref: 362011329850 +Ref: library/email compat32-message email message Message keys11330076 +Ref: 361b11330076 +Ref: library/email compat32-message email message Message values11330170 +Ref: 362111330170 +Ref: library/email compat32-message email message Message items11330260 +Ref: 362211330260 +Ref: library/email compat32-message email message Message get11330391 +Ref: 362311330391 +Ref: library/email compat32-message email message Message get_all11330704 +Ref: 361e11330704 +Ref: library/email compat32-message email message Message add_header11330941 +Ref: 362411330941 +Ref: library/email compat32-message email message Message replace_header11332907 +Ref: 362511332907 +Ref: library/email compat32-message email message Message get_content_type11333196 +Ref: 362611333196 +Ref: library/email compat32-message email message Message get_content_maintype11334054 +Ref: 362811334054 +Ref: library/email compat32-message email message Message get_content_subtype11334260 +Ref: 362911334260 +Ref: library/email compat32-message email message Message get_default_type11334453 +Ref: 362711334453 +Ref: library/email compat32-message email message Message set_default_type11334773 +Ref: 362a11334773 +Ref: library/email compat32-message email message Message get_params11335060 +Ref: 362b11335060 +Ref: library/email compat32-message email message Message get_param11336122 +Ref: 362c11336122 +Ref: library/email compat32-message email message Message set_param11338130 +Ref: f3411338130 +Ref: library/email compat32-message email message Message del_param11339397 +Ref: 362e11339397 +Ref: library/email compat32-message email message Message set_type11339838 +Ref: 362f11339838 +Ref: library/email compat32-message email message Message get_filename11340727 +Ref: 363011340727 +Ref: library/email compat32-message email message Message get_boundary11341266 +Ref: 363111341266 +Ref: library/email compat32-message email message Message set_boundary11341630 +Ref: 363211341630 +Ref: library/email compat32-message email message Message get_content_charset11342445 +Ref: 363311342445 +Ref: library/email compat32-message email message Message get_charsets11342933 +Ref: 363411342933 +Ref: library/email compat32-message email message Message get_content_disposition11343635 +Ref: df611343635 +Ref: library/email compat32-message email message Message walk11344000 +Ref: 363511344000 +Ref: library/email compat32-message email message Message preamble11346120 +Ref: 363611346120 +Ref: library/email compat32-message email message Message epilogue11347384 +Ref: 363711347384 +Ref: library/email compat32-message email message Message defects11347783 +Ref: 363811347783 +Ref: email message Message Representing an email message using the compat32 API-Footnote-111348061 +Ref: email message Message Representing an email message using the compat32 API-Footnote-211348120 +Ref: email message Message Representing an email message using the compat32 API-Footnote-311348179 +Ref: email message Message Representing an email message using the compat32 API-Footnote-411348238 +Ref: email message Message Representing an email message using the compat32 API-Footnote-511348297 +Ref: email message Message Representing an email message using the compat32 API-Footnote-611348356 +Ref: email message Message Representing an email message using the compat32 API-Footnote-711348415 +Ref: email message Message Representing an email message using the compat32 API-Footnote-811348474 +Ref: email message Message Representing an email message using the compat32 API-Footnote-911348533 +Ref: email message Message Representing an email message using the compat32 API-Footnote-1011348592 +Ref: email message Message Representing an email message using the compat32 API-Footnote-1111348652 +Ref: email message Message Representing an email message using the compat32 API-Footnote-1211348712 +Node: email mime Creating email and MIME objects from scratch11348772 +Ref: library/email mime doc11349038 +Ref: 363911349038 +Ref: library/email mime email-mime-creating-email-and-mime-objects-from-scratch11349038 +Ref: 363a11349038 +Ref: library/email mime module-email mime11349038 +Ref: 4511349038 +Ref: library/email mime module-email mime base11350274 +Ref: 4811350274 +Ref: library/email mime email mime base MIMEBase11350274 +Ref: 363b11350274 +Ref: library/email mime module-email mime nonmultipart11351423 +Ref: 4c11351423 +Ref: library/email mime email mime nonmultipart MIMENonMultipart11351423 +Ref: 35d211351423 +Ref: library/email mime module-email mime multipart11351920 +Ref: 4b11351920 +Ref: library/email mime email mime multipart MIMEMultipart11351920 +Ref: 363c11351920 +Ref: library/email mime module-email mime application11353239 +Ref: 4611353239 +Ref: library/email mime email mime application MIMEApplication11353239 +Ref: 363d11353239 +Ref: library/email mime module-email mime audio11354595 +Ref: 4711354595 +Ref: library/email mime email mime audio MIMEAudio11354595 +Ref: 363e11354595 +Ref: library/email mime module-email mime image11356163 +Ref: 4911356163 +Ref: library/email mime email mime image MIMEImage11356163 +Ref: 35d311356163 +Ref: library/email mime module-email mime message11357811 +Ref: 4a11357811 +Ref: library/email mime email mime message MIMEMessage11357811 +Ref: 363f11357811 +Ref: library/email mime module-email mime text11358501 +Ref: 4d11358501 +Ref: library/email mime email mime text MIMEText11358501 +Ref: df811358501 +Ref: email mime Creating email and MIME objects from scratch-Footnote-111360145 +Node: email header Internationalized headers11360213 +Ref: library/email header doc11360446 +Ref: 364011360446 +Ref: library/email header email-header-internationalized-headers11360446 +Ref: 364111360446 +Ref: library/email header module-email header11360446 +Ref: 4111360446 +Ref: library/email header email header Header11363143 +Ref: 18a911363143 +Ref: library/email header email header Header append11365015 +Ref: 364211365015 +Ref: library/email header email header Header encode11366350 +Ref: 364311366350 +Ref: library/email header email header Header __str__11367989 +Ref: 364411367989 +Ref: library/email header email header Header __eq__11368488 +Ref: 364511368488 +Ref: library/email header email header Header __ne__11368624 +Ref: 364611368624 +Ref: library/email header email header decode_header11368848 +Ref: 10ae11368848 +Ref: library/email header email header make_header11370314 +Ref: 10af11370314 +Ref: email header Internationalized headers-Footnote-111371139 +Ref: email header Internationalized headers-Footnote-211371211 +Ref: email header Internationalized headers-Footnote-311371270 +Ref: email header Internationalized headers-Footnote-411371328 +Ref: email header Internationalized headers-Footnote-511371387 +Ref: email header Internationalized headers-Footnote-611371446 +Ref: email header Internationalized headers-Footnote-711371505 +Ref: email header Internationalized headers-Footnote-811371564 +Ref: email header Internationalized headers-Footnote-911371623 +Ref: email header Internationalized headers-Footnote-1011371682 +Ref: email header Internationalized headers-Footnote-1111371742 +Ref: email header Internationalized headers-Footnote-1211371802 +Ref: email header Internationalized headers-Footnote-1311371862 +Ref: email header Internationalized headers-Footnote-1411371922 +Ref: email header Internationalized headers-Footnote-1511371982 +Node: email charset Representing character sets11372042 +Ref: library/email charset doc11372243 +Ref: 364711372243 +Ref: library/email charset email-charset-representing-character-sets11372243 +Ref: 364811372243 +Ref: library/email charset module-email charset11372243 +Ref: 3c11372243 +Ref: library/email charset email charset Charset11373054 +Ref: df911373054 +Ref: library/email charset email charset Charset input_charset11374579 +Ref: 364911374579 +Ref: library/email charset email charset Charset header_encoding11374835 +Ref: 364a11374835 +Ref: library/email charset email charset Charset body_encoding11375221 +Ref: 364b11375221 +Ref: library/email charset email charset Charset output_charset11375498 +Ref: 364c11375498 +Ref: library/email charset email charset Charset input_codec11375837 +Ref: 364d11375837 +Ref: library/email charset email charset Charset output_codec11376051 +Ref: 364e11376051 +Ref: library/email charset email charset Charset get_body_encoding11376363 +Ref: 364f11376363 +Ref: library/email charset email charset Charset get_output_charset11377080 +Ref: 365011377080 +Ref: library/email charset email charset Charset header_encode11377284 +Ref: 365111377284 +Ref: library/email charset email charset Charset header_encode_lines11377492 +Ref: 365211377492 +Ref: library/email charset email charset Charset body_encode11377925 +Ref: 365311377925 +Ref: library/email charset email charset Charset __str__11378257 +Ref: 365411378257 +Ref: library/email charset email charset Charset __eq__11378416 +Ref: 365511378416 +Ref: library/email charset email charset Charset __ne__11378552 +Ref: 365611378552 +Ref: library/email charset email charset add_charset11378846 +Ref: 365711378846 +Ref: library/email charset email charset add_alias11380171 +Ref: 365911380171 +Ref: library/email charset email charset add_codec11380497 +Ref: 365811380497 +Ref: email charset Representing character sets-Footnote-111380891 +Node: email encoders Encoders11380964 +Ref: library/email encoders doc11381162 +Ref: 365a11381162 +Ref: library/email encoders email-encoders-encoders11381162 +Ref: 365b11381162 +Ref: library/email encoders module-email encoders11381162 +Ref: 3e11381162 +Ref: library/email encoders email encoders encode_quopri11382854 +Ref: 365c11382854 +Ref: library/email encoders email encoders encode_base6411383182 +Ref: 365d11383182 +Ref: library/email encoders email encoders encode_7or8bit11383578 +Ref: 365e11383578 +Ref: library/email encoders email encoders encode_noop11383838 +Ref: 365f11383838 +Ref: email encoders Encoders-Footnote-111384018 +Ref: email encoders Encoders-Footnote-211384092 +Node: email utils Miscellaneous utilities11384209 +Ref: library/email utils doc11384391 +Ref: 366011384391 +Ref: library/email utils email-utils-miscellaneous-utilities11384391 +Ref: 366111384391 +Ref: library/email utils module-email utils11384391 +Ref: 5011384391 +Ref: library/email utils email utils localtime11384687 +Ref: 2c711384687 +Ref: library/email utils email utils make_msgid11385274 +Ref: 366211385274 +Ref: library/email utils email utils quote11386171 +Ref: 366311386171 +Ref: library/email utils email utils unquote11386350 +Ref: 357911386350 +Ref: library/email utils email utils parseaddr11386620 +Ref: 1e411386620 +Ref: library/email utils email utils formataddr11387187 +Ref: 118d11387187 +Ref: library/email utils email utils getaddresses11387867 +Ref: 1e311387867 +Ref: library/email utils email utils parsedate11388713 +Ref: 366411388713 +Ref: library/email utils email utils parsedate_tz11389343 +Ref: 187e11389343 +Ref: library/email utils email utils parsedate_to_datetime11389923 +Ref: 10b411389923 +Ref: library/email utils email utils mktime_tz11390805 +Ref: 366511390805 +Ref: library/email utils email utils formatdate11391042 +Ref: 143311391042 +Ref: library/email utils email utils format_datetime11391989 +Ref: 10b311391989 +Ref: library/email utils email utils decode_rfc223111392679 +Ref: 366611392679 +Ref: library/email utils email utils encode_rfc223111392779 +Ref: 366711392779 +Ref: library/email utils email utils collapse_rfc2231_value11393187 +Ref: 362d11393187 +Ref: library/email utils email utils decode_params11394041 +Ref: 153511394041 +Ref: email utils Miscellaneous utilities-Footnote-111394297 +Ref: email utils Miscellaneous utilities-Footnote-211394368 +Ref: email utils Miscellaneous utilities-Footnote-311394427 +Ref: email utils Miscellaneous utilities-Footnote-411394486 +Ref: email utils Miscellaneous utilities-Footnote-511394545 +Ref: email utils Miscellaneous utilities-Footnote-611394604 +Ref: email utils Miscellaneous utilities-Footnote-711394877 +Ref: email utils Miscellaneous utilities-Footnote-811394936 +Ref: email utils Miscellaneous utilities-Footnote-911394995 +Ref: email utils Miscellaneous utilities-Footnote-1011395054 +Ref: email utils Miscellaneous utilities-Footnote-1111395114 +Ref: email utils Miscellaneous utilities-Footnote-1211395174 +Node: email iterators Iterators11395234 +Ref: library/email iterators doc11395384 +Ref: 366811395384 +Ref: library/email iterators email-iterators-iterators11395384 +Ref: 366911395384 +Ref: library/email iterators module-email iterators11395384 +Ref: 4311395384 +Ref: library/email iterators email iterators body_line_iterator11395784 +Ref: 366a11395784 +Ref: library/email iterators email iterators typed_subpart_iterator11396362 +Ref: 366b11396362 +Ref: library/email iterators email iterators _structure11397080 +Ref: 366c11397080 +Ref: email iterators Iterators-Footnote-111398501 +Node: json — JSON encoder and decoder11398577 +Ref: library/json doc11398782 +Ref: 366d11398782 +Ref: library/json json-json-encoder-and-decoder11398782 +Ref: 366e11398782 +Ref: library/json module-json11398782 +Ref: 8211398782 +Ref: json — JSON encoder and decoder-Footnote-111403435 +Ref: json — JSON encoder and decoder-Footnote-211403508 +Ref: json — JSON encoder and decoder-Footnote-311403533 +Ref: json — JSON encoder and decoder-Footnote-411403592 +Ref: json — JSON encoder and decoder-Footnote-511403651 +Ref: json — JSON encoder and decoder-Footnote-611403738 +Ref: json — JSON encoder and decoder-Footnote-711403787 +Ref: json — JSON encoder and decoder-Footnote-811404049 +Node: Basic Usage11404075 +Ref: library/json basic-usage11404186 +Ref: 367011404186 +Ref: library/json json dump11404229 +Ref: d4411404229 +Ref: library/json json dumps11408441 +Ref: d4511408441 +Ref: library/json json load11409266 +Ref: cb411409266 +Ref: library/json json loads11412917 +Ref: 95511412917 +Ref: Basic Usage-Footnote-111413628 +Node: Encoders and Decoders11413660 +Ref: library/json encoders-and-decoders11413794 +Ref: 367411413794 +Ref: library/json json JSONDecoder11413857 +Ref: d4711413857 +Ref: library/json json-to-py-table11414111 +Ref: 367311414111 +Ref: library/json json JSONDecoder decode11417094 +Ref: 367511417094 +Ref: library/json json JSONDecoder raw_decode11417346 +Ref: 367611417346 +Ref: library/json json JSONEncoder11417710 +Ref: d4611417710 +Ref: library/json py-to-json-table11418011 +Ref: 367111418011 +Ref: library/json json JSONEncoder default11422339 +Ref: 367211422339 +Ref: library/json json JSONEncoder encode11423028 +Ref: 367711423028 +Ref: library/json json JSONEncoder iterencode11423273 +Ref: 367811423273 +Ref: Encoders and Decoders-Footnote-111423570 +Node: Exceptions<17>11423602 +Ref: library/json exceptions11423765 +Ref: 367911423765 +Ref: library/json json JSONDecodeError11423806 +Ref: e1f11423806 +Ref: library/json json JSONDecodeError msg11423947 +Ref: 367a11423947 +Ref: library/json json JSONDecodeError doc11424014 +Ref: 367b11424014 +Ref: library/json json JSONDecodeError pos11424082 +Ref: 367c11424082 +Ref: library/json json JSONDecodeError lineno11424165 +Ref: 367d11424165 +Ref: library/json json JSONDecodeError colno11424237 +Ref: 367e11424237 +Node: Standard Compliance and Interoperability11424338 +Ref: library/json standard-compliance-and-interoperability11424505 +Ref: 367f11424505 +Ref: Standard Compliance and Interoperability-Footnote-111425655 +Ref: Standard Compliance and Interoperability-Footnote-211425714 +Node: Character Encodings11425801 +Ref: library/json character-encodings11425936 +Ref: 368011425936 +Node: Infinite and NaN Number Values11427267 +Ref: library/json infinite-and-nan-number-values11427442 +Ref: 368111427442 +Node: Repeated Names Within an Object11428230 +Ref: library/json repeated-names-within-an-object11428423 +Ref: 368211428423 +Node: Top-level Non-Object Non-Array Values11428946 +Ref: library/json top-level-non-object-non-array-values11429135 +Ref: 368311429135 +Ref: Top-level Non-Object Non-Array Values-Footnote-111429789 +Ref: Top-level Non-Object Non-Array Values-Footnote-211429848 +Node: Implementation Limitations11429907 +Ref: library/json implementation-limitations11430056 +Ref: 368411430056 +Node: Command Line Interface<2>11431006 +Ref: library/json command-line-interface11431150 +Ref: 368511431150 +Ref: library/json json-commandline11431150 +Ref: 366f11431150 +Ref: library/json module-json tool11431150 +Ref: 8311431150 +Ref: Command Line Interface<2>-Footnote-111432076 +Node: Command line options<2>11432145 +Ref: library/json command-line-options11432230 +Ref: 368711432230 +Ref: library/json cmdoption-json tool-arg-infile11432293 +Ref: 368811432293 +Ref: library/json cmdoption-json tool-arg-outfile11432769 +Ref: 368911432769 +Ref: library/json cmdoption-json tool-sort-keys11432904 +Ref: 368611432904 +Ref: library/json cmdoption-json tool-no-ensure-ascii11433018 +Ref: 368a11433018 +Ref: library/json cmdoption-json tool-json-lines11433181 +Ref: 368b11433181 +Ref: library/json cmdoption-json tool-indent11433289 +Ref: 368c11433289 +Ref: library/json cmdoption-json tool-tab11433289 +Ref: 368d11433289 +Ref: library/json cmdoption-json tool-no-indent11433289 +Ref: 368e11433289 +Ref: library/json cmdoption-json tool-compact11433289 +Ref: 368f11433289 +Ref: library/json cmdoption-json tool-h11433427 +Ref: 369011433427 +Ref: library/json cmdoption-json tool-help11433427 +Ref: 369111433427 +Node: mailbox — Manipulate mailboxes in various formats11433480 +Ref: library/mailbox doc11433682 +Ref: 369211433682 +Ref: library/mailbox mailbox-manipulate-mailboxes-in-various-formats11433682 +Ref: 369311433682 +Ref: library/mailbox module-mailbox11433682 +Ref: 8b11433682 +Ref: mailbox — Manipulate mailboxes in various formats-Footnote-111434564 +Node: Mailbox objects11434631 +Ref: library/mailbox id111434758 +Ref: 369411434758 +Ref: library/mailbox mailbox-objects11434758 +Ref: 369511434758 +Ref: library/mailbox mailbox Mailbox11434817 +Ref: 124011434817 +Ref: library/mailbox mailbox Mailbox add11437606 +Ref: 123f11437606 +Ref: library/mailbox mailbox Mailbox remove11438399 +Ref: 369611438399 +Ref: library/mailbox mailbox Mailbox __delitem__11438429 +Ref: 369a11438429 +Ref: library/mailbox mailbox Mailbox discard11438464 +Ref: 369711438464 +Ref: library/mailbox mailbox Mailbox __setitem__11439009 +Ref: 369b11439009 +Ref: library/mailbox mailbox Mailbox iterkeys11439895 +Ref: 369c11439895 +Ref: library/mailbox mailbox Mailbox keys11439981 +Ref: 369d11439981 +Ref: library/mailbox mailbox Mailbox itervalues11440143 +Ref: 369e11440143 +Ref: library/mailbox mailbox Mailbox __iter__11440174 +Ref: 369f11440174 +Ref: library/mailbox mailbox Mailbox values11440661 +Ref: 36a011440661 +Ref: library/mailbox mailbox Mailbox iteritems11440827 +Ref: 36a111440827 +Ref: library/mailbox mailbox Mailbox items11441248 +Ref: 36a211441248 +Ref: library/mailbox mailbox Mailbox get11441441 +Ref: 36a311441441 +Ref: library/mailbox mailbox Mailbox __getitem__11441482 +Ref: 36a411441482 +Ref: library/mailbox mailbox Mailbox get_message11442057 +Ref: 36a511442057 +Ref: library/mailbox mailbox Mailbox get_bytes11442346 +Ref: 124211442346 +Ref: library/mailbox mailbox Mailbox get_string11442581 +Ref: 124311442581 +Ref: library/mailbox mailbox Mailbox get_file11442920 +Ref: 124111442920 +Ref: library/mailbox mailbox Mailbox __contains__11443951 +Ref: 36a611443951 +Ref: library/mailbox mailbox Mailbox __len__11444085 +Ref: 36a711444085 +Ref: library/mailbox mailbox Mailbox clear11444168 +Ref: 36a811444168 +Ref: library/mailbox mailbox Mailbox pop11444244 +Ref: 36a911444244 +Ref: library/mailbox mailbox Mailbox popitem11444682 +Ref: 36aa11444682 +Ref: library/mailbox mailbox Mailbox update11445198 +Ref: 36ab11445198 +Ref: library/mailbox mailbox Mailbox flush11445900 +Ref: 36ac11445900 +Ref: library/mailbox mailbox Mailbox lock11446185 +Ref: 369811446185 +Ref: library/mailbox mailbox Mailbox unlock11446604 +Ref: 369911446604 +Ref: library/mailbox mailbox Mailbox close11446684 +Ref: 36ae11446684 +Node: Maildir objects11446970 +Ref: library/mailbox mailbox-maildir11447058 +Ref: 36af11447058 +Ref: library/mailbox maildir-objects11447058 +Ref: 36b011447058 +Ref: library/mailbox mailbox Maildir11447117 +Ref: 41811447117 +Ref: library/mailbox mailbox Maildir colon11449248 +Ref: 36b211449248 +Ref: library/mailbox mailbox Maildir list_folders11450062 +Ref: 36b311450062 +Ref: library/mailbox mailbox Maildir get_folder11450150 +Ref: 36b411450150 +Ref: library/mailbox mailbox Maildir add_folder11450384 +Ref: 36b611450384 +Ref: library/mailbox mailbox Maildir remove_folder11450535 +Ref: 36b711450535 +Ref: library/mailbox mailbox Maildir clean11450777 +Ref: 36b911450777 +Ref: library/mailbox mailbox Maildir get_flags11451013 +Ref: 16d111451013 +Ref: library/mailbox mailbox Maildir set_flags11451818 +Ref: 16d211451818 +Ref: library/mailbox mailbox Maildir add_flag11452569 +Ref: 16d311452569 +Ref: library/mailbox mailbox Maildir remove_flag11453081 +Ref: 16d411453081 +Ref: library/mailbox mailbox Maildir get_info11453604 +Ref: 16cf11453604 +Ref: library/mailbox mailbox Maildir set_info11454334 +Ref: 16d011454334 +Ref: library/mailbox mailbox Maildir add11455132 +Ref: 36c111455132 +Ref: library/mailbox mailbox Maildir __setitem__11455163 +Ref: 36be11455163 +Ref: library/mailbox mailbox Maildir update11455207 +Ref: 36c211455207 +Ref: library/mailbox mailbox Maildir flush11455620 +Ref: 36c311455620 +Ref: library/mailbox mailbox Maildir lock11455755 +Ref: 36c411455755 +Ref: library/mailbox mailbox Maildir unlock11455780 +Ref: 36c511455780 +Ref: library/mailbox mailbox Maildir close11455913 +Ref: 36c611455913 +Ref: library/mailbox mailbox Maildir get_file11456104 +Ref: 36c711456104 +Ref: Maildir objects-Footnote-111456640 +Ref: Maildir objects-Footnote-211456689 +Node: mbox objects11456733 +Ref: library/mailbox mailbox-mbox11456840 +Ref: 36c811456840 +Ref: library/mailbox mbox-objects11456840 +Ref: 36c911456840 +Ref: library/mailbox mailbox mbox11456893 +Ref: 167f11456893 +Ref: library/mailbox mailbox mbox get_bytes11458312 +Ref: 36ca11458312 +Ref: library/mailbox mailbox mbox get_file11458609 +Ref: 36cb11458609 +Ref: library/mailbox mailbox mbox get_string11459092 +Ref: 36cc11459092 +Ref: library/mailbox mailbox mbox lock11459390 +Ref: 36cd11459390 +Ref: library/mailbox mailbox mbox unlock11459415 +Ref: 36ce11459415 +Ref: mbox objects-Footnote-111459992 +Ref: mbox objects-Footnote-211460052 +Ref: mbox objects-Footnote-311460104 +Node: MH objects11460182 +Ref: library/mailbox mailbox-mh11460287 +Ref: 36cf11460287 +Ref: library/mailbox mh-objects11460287 +Ref: 36d011460287 +Ref: library/mailbox mailbox MH11460336 +Ref: 16b611460336 +Ref: library/mailbox mailbox MH list_folders11461873 +Ref: 36d211461873 +Ref: library/mailbox mailbox MH get_folder11461961 +Ref: 36d311461961 +Ref: library/mailbox mailbox MH add_folder11462191 +Ref: 36d411462191 +Ref: library/mailbox mailbox MH remove_folder11462338 +Ref: 36d511462338 +Ref: library/mailbox mailbox MH get_sequences11462580 +Ref: 36d611462580 +Ref: library/mailbox mailbox MH set_sequences11462757 +Ref: 36d711462757 +Ref: library/mailbox mailbox MH pack11462995 +Ref: 36d811462995 +Ref: library/mailbox mailbox MH remove11463410 +Ref: 36d911463410 +Ref: library/mailbox mailbox MH __delitem__11463440 +Ref: 36da11463440 +Ref: library/mailbox mailbox MH discard11463475 +Ref: 36db11463475 +Ref: library/mailbox mailbox MH lock11463684 +Ref: 36dc11463684 +Ref: library/mailbox mailbox MH unlock11463709 +Ref: 36dd11463709 +Ref: library/mailbox mailbox MH get_file11464084 +Ref: 36de11464084 +Ref: library/mailbox mailbox MH flush11464276 +Ref: 36df11464276 +Ref: library/mailbox mailbox MH close11464406 +Ref: 36e011464406 +Ref: MH objects-Footnote-111464866 +Ref: MH objects-Footnote-211464902 +Node: Babyl objects11464947 +Ref: library/mailbox babyl-objects11465052 +Ref: 36e111465052 +Ref: library/mailbox mailbox-babyl11465052 +Ref: 36e211465052 +Ref: library/mailbox mailbox Babyl11465107 +Ref: 36e311465107 +Ref: library/mailbox mailbox Babyl get_labels11466671 +Ref: 36e511466671 +Ref: library/mailbox mailbox Babyl get_file11467198 +Ref: 36e611467198 +Ref: library/mailbox mailbox Babyl lock11467718 +Ref: 36e711467718 +Ref: library/mailbox mailbox Babyl unlock11467743 +Ref: 36e811467743 +Ref: Babyl objects-Footnote-111468137 +Ref: Babyl objects-Footnote-211468181 +Node: MMDF objects11468259 +Ref: library/mailbox mailbox-mmdf11468345 +Ref: 36e911468345 +Ref: library/mailbox mmdf-objects11468345 +Ref: 36ea11468345 +Ref: library/mailbox mailbox MMDF11468398 +Ref: 168011468398 +Ref: library/mailbox mailbox MMDF get_bytes11469656 +Ref: 36ec11469656 +Ref: library/mailbox mailbox MMDF get_file11469953 +Ref: 36ed11469953 +Ref: library/mailbox mailbox MMDF lock11470436 +Ref: 36ee11470436 +Ref: library/mailbox mailbox MMDF unlock11470461 +Ref: 36ef11470461 +Ref: MMDF objects-Footnote-111470898 +Ref: MMDF objects-Footnote-211470958 +Node: Message objects11471001 +Ref: library/mailbox mailbox-message-objects11471151 +Ref: 36f011471151 +Ref: library/mailbox message-objects11471151 +Ref: 36f111471151 +Ref: library/mailbox mailbox Message11471210 +Ref: 124411471210 +Ref: Message objects-Footnote-111473255 +Node: MaildirMessage objects11473314 +Ref: library/mailbox mailbox-maildirmessage11473416 +Ref: 36f211473416 +Ref: library/mailbox maildirmessage-objects11473416 +Ref: 36f311473416 +Ref: library/mailbox mailbox MaildirMessage11473489 +Ref: 36b111473489 +Ref: library/mailbox mailbox MaildirMessage get_subdir11475339 +Ref: 36f411475339 +Ref: library/mailbox mailbox MaildirMessage set_subdir11475853 +Ref: 36f511475853 +Ref: library/mailbox mailbox MaildirMessage get_flags11476024 +Ref: 36ba11476024 +Ref: library/mailbox mailbox MaildirMessage set_flags11476496 +Ref: 36bb11476496 +Ref: library/mailbox mailbox MaildirMessage add_flag11476600 +Ref: 36bc11476600 +Ref: library/mailbox mailbox MaildirMessage remove_flag11476950 +Ref: 36bd11476950 +Ref: library/mailbox mailbox MaildirMessage get_date11477305 +Ref: 36f611477305 +Ref: library/mailbox mailbox MaildirMessage set_date11477461 +Ref: 36f711477461 +Ref: library/mailbox mailbox MaildirMessage get_info11477626 +Ref: 36bf11477626 +Ref: library/mailbox mailbox MaildirMessage set_info11477849 +Ref: 36c011477849 +Node: mboxMessage objects11480646 +Ref: library/mailbox mailbox-mboxmessage11480774 +Ref: 36f811480774 +Ref: library/mailbox mboxmessage-objects11480774 +Ref: 36f911480774 +Ref: library/mailbox mailbox mboxMessage11480841 +Ref: 356111480841 +Ref: library/mailbox mailbox mboxMessage get_from11482637 +Ref: 36fa11482637 +Ref: library/mailbox mailbox mboxMessage set_from11482868 +Ref: 36fb11482868 +Ref: library/mailbox mailbox mboxMessage get_flags11483406 +Ref: 36fc11483406 +Ref: library/mailbox mailbox mboxMessage set_flags11483754 +Ref: 36fd11483754 +Ref: library/mailbox mailbox mboxMessage add_flag11484045 +Ref: 36fe11484045 +Ref: library/mailbox mailbox mboxMessage remove_flag11484265 +Ref: 36ff11484265 +Node: MHMessage objects11487243 +Ref: library/mailbox mailbox-mhmessage11487369 +Ref: 370011487369 +Ref: library/mailbox mhmessage-objects11487369 +Ref: 370111487369 +Ref: library/mailbox mailbox MHMessage11487434 +Ref: 36d111487434 +Ref: library/mailbox mailbox MHMessage get_sequences11488394 +Ref: 370211488394 +Ref: library/mailbox mailbox MHMessage set_sequences11488517 +Ref: 370311488517 +Ref: library/mailbox mailbox MHMessage add_sequence11488625 +Ref: 370411488625 +Ref: library/mailbox mailbox MHMessage remove_sequence11488755 +Ref: 370511488755 +Node: BabylMessage objects11490620 +Ref: library/mailbox babylmessage-objects11490746 +Ref: 370611490746 +Ref: library/mailbox mailbox-babylmessage11490746 +Ref: 370711490746 +Ref: library/mailbox mailbox BabylMessage11490817 +Ref: 36e411490817 +Ref: library/mailbox mailbox BabylMessage get_labels11492172 +Ref: 370811492172 +Ref: library/mailbox mailbox BabylMessage set_labels11492255 +Ref: 370911492255 +Ref: library/mailbox mailbox BabylMessage add_label11492355 +Ref: 370a11492355 +Ref: library/mailbox mailbox BabylMessage remove_label11492452 +Ref: 370b11492452 +Ref: library/mailbox mailbox BabylMessage get_visible11492557 +Ref: 370c11492557 +Ref: library/mailbox mailbox BabylMessage set_visible11492725 +Ref: 370d11492725 +Ref: library/mailbox mailbox BabylMessage update_visible11493076 +Ref: 370e11493076 +Node: MMDFMessage objects11495516 +Ref: library/mailbox mailbox-mmdfmessage11495616 +Ref: 370f11495616 +Ref: library/mailbox mmdfmessage-objects11495616 +Ref: 371011495616 +Ref: library/mailbox mailbox MMDFMessage11495685 +Ref: 36eb11495685 +Ref: library/mailbox mailbox MMDFMessage get_from11497365 +Ref: 371111497365 +Ref: library/mailbox mailbox MMDFMessage set_from11497596 +Ref: 371211497596 +Ref: library/mailbox mailbox MMDFMessage get_flags11498134 +Ref: 371311498134 +Ref: library/mailbox mailbox MMDFMessage set_flags11498482 +Ref: 371411498482 +Ref: library/mailbox mailbox MMDFMessage add_flag11498773 +Ref: 371511498773 +Ref: library/mailbox mailbox MMDFMessage remove_flag11498993 +Ref: 371611498993 +Node: Exceptions<18>11501972 +Ref: library/mailbox exceptions11502119 +Ref: 371711502119 +Ref: library/mailbox mailbox Error11502236 +Ref: 371811502236 +Ref: library/mailbox mailbox NoSuchMailboxError11502330 +Ref: 36b511502330 +Ref: library/mailbox mailbox NotEmptyError11502637 +Ref: 36b811502637 +Ref: library/mailbox mailbox ExternalClashError11502799 +Ref: 36ad11502799 +Ref: library/mailbox mailbox FormatError11503112 +Ref: 371911503112 +Node: Examples<23>11503309 +Ref: library/mailbox examples11503432 +Ref: 371a11503432 +Ref: library/mailbox mailbox-examples11503432 +Ref: 371b11503432 +Node: mimetypes — Map filenames to MIME types11505710 +Ref: library/mimetypes doc11505932 +Ref: 371c11505932 +Ref: library/mimetypes mimetypes-map-filenames-to-mime-types11505932 +Ref: 371d11505932 +Ref: library/mimetypes module-mimetypes11505932 +Ref: 8f11505932 +Ref: library/mimetypes mimetypes guess_type11506819 +Ref: 20a11506819 +Ref: library/mimetypes mimetypes guess_file_type11508306 +Ref: 20911508306 +Ref: library/mimetypes mimetypes guess_all_extensions11508637 +Ref: 189511508637 +Ref: library/mimetypes mimetypes guess_extension11509234 +Ref: 371f11509234 +Ref: library/mimetypes mimetypes init11509975 +Ref: 371e11509975 +Ref: library/mimetypes mimetypes read_mime_types11510951 +Ref: 194311510951 +Ref: library/mimetypes mimetypes add_type11511328 +Ref: 372111511328 +Ref: library/mimetypes mimetypes inited11511785 +Ref: 372211511785 +Ref: library/mimetypes mimetypes knownfiles11511955 +Ref: 372011511955 +Ref: library/mimetypes mimetypes suffix_map11512165 +Ref: 372311512165 +Ref: library/mimetypes mimetypes encodings_map11512515 +Ref: 372411512515 +Ref: library/mimetypes mimetypes types_map11512614 +Ref: 372511512614 +Ref: library/mimetypes mimetypes common_types11512705 +Ref: 372611512705 +Ref: mimetypes — Map filenames to MIME types-Footnote-111513247 +Ref: mimetypes — Map filenames to MIME types-Footnote-211513316 +Node: MimeTypes Objects11513387 +Ref: library/mimetypes id111513482 +Ref: 372711513482 +Ref: library/mimetypes mimetypes-objects11513482 +Ref: 372811513482 +Ref: library/mimetypes mimetypes MimeTypes11513731 +Ref: 14c611513731 +Ref: library/mimetypes mimetypes MimeTypes suffix_map11514417 +Ref: 372b11514417 +Ref: library/mimetypes mimetypes MimeTypes encodings_map11514899 +Ref: 372c11514899 +Ref: library/mimetypes mimetypes MimeTypes types_map11515112 +Ref: 372d11515112 +Ref: library/mimetypes mimetypes MimeTypes types_map_inv11515448 +Ref: 372e11515448 +Ref: library/mimetypes mimetypes MimeTypes guess_extension11515798 +Ref: 372f11515798 +Ref: library/mimetypes mimetypes MimeTypes guess_type11515976 +Ref: 1a3711515976 +Ref: library/mimetypes mimetypes MimeTypes guess_file_type11516142 +Ref: 373011516142 +Ref: library/mimetypes mimetypes MimeTypes guess_all_extensions11516356 +Ref: 373111516356 +Ref: library/mimetypes mimetypes MimeTypes read11516544 +Ref: 372911516544 +Ref: library/mimetypes mimetypes MimeTypes readfp11516857 +Ref: 372a11516857 +Ref: library/mimetypes mimetypes MimeTypes read_windows_registry11517188 +Ref: 373211517188 +Ref: library/mimetypes mimetypes MimeTypes add_type11517532 +Ref: 373311517532 +Node: base64 — Base16 Base32 Base64 Base85 Data Encodings11518023 +Ref: library/base64 doc11518239 +Ref: 373411518239 +Ref: library/base64 base64-base16-base32-base64-base85-data-encodings11518239 +Ref: 373511518239 +Ref: library/base64 module-base6411518239 +Ref: e11518239 +Ref: base64 — Base16 Base32 Base64 Base85 Data Encodings-Footnote-111519952 +Ref: base64 — Base16 Base32 Base64 Base85 Data Encodings-Footnote-211520018 +Ref: base64 — Base16 Base32 Base64 Base85 Data Encodings-Footnote-311520077 +Ref: base64 — Base16 Base32 Base64 Base85 Data Encodings-Footnote-411520136 +Ref: base64 — Base16 Base32 Base64 Base85 Data Encodings-Footnote-511520195 +Node: RFC 4648 Encodings11520254 +Ref: library/base64 base64-rfc-464811520387 +Ref: 373611520387 +Ref: library/base64 rfc-4648-encodings11520387 +Ref: 373911520387 +Ref: library/base64 base64 b64encode11520617 +Ref: 373a11520617 +Ref: library/base64 base64 b64decode11521301 +Ref: 19a611521301 +Ref: library/base64 base64 standard_b64encode11522293 +Ref: 373b11522293 +Ref: library/base64 base64 standard_b64decode11522466 +Ref: 373c11522466 +Ref: library/base64 base64 urlsafe_b64encode11522655 +Ref: 373d11522655 +Ref: library/base64 base64 urlsafe_b64decode11522995 +Ref: 373e11522995 +Ref: library/base64 base64 b32encode11523312 +Ref: 373f11523312 +Ref: library/base64 base64 b32decode11523458 +Ref: 101e11523458 +Ref: library/base64 base64 b32hexencode11524454 +Ref: 7de11524454 +Ref: library/base64 base64 b32hexdecode11524632 +Ref: 7df11524632 +Ref: library/base64 base64 b16encode11525081 +Ref: 374011525081 +Ref: library/base64 base64 b16decode11525227 +Ref: 374111525227 +Ref: RFC 4648 Encodings-Footnote-111525752 +Ref: RFC 4648 Encodings-Footnote-211525811 +Ref: RFC 4648 Encodings-Footnote-311525870 +Ref: RFC 4648 Encodings-Footnote-411525929 +Node: Base85 Encodings11525988 +Ref: library/base64 base64-base-8511526146 +Ref: 373711526146 +Ref: library/base64 base85-encodings11526146 +Ref: 374211526146 +Ref: library/base64 base64 a85encode11526921 +Ref: f1911526921 +Ref: library/base64 base64 a85decode11527923 +Ref: f1a11527923 +Ref: library/base64 base64 b85encode11528790 +Ref: f1b11528790 +Ref: library/base64 base64 b85decode11529144 +Ref: f1c11529144 +Ref: library/base64 base64 z85encode11529387 +Ref: 14f11529387 +Ref: library/base64 base64 z85decode11529632 +Ref: 15011529632 +Ref: Base85 Encodings-Footnote-111529911 +Ref: Base85 Encodings-Footnote-211529951 +Node: Legacy Interface11529991 +Ref: library/base64 base64-legacy11530157 +Ref: 373811530157 +Ref: library/base64 legacy-interface11530157 +Ref: 374311530157 +Ref: library/base64 base64 decode11530210 +Ref: 374411530210 +Ref: library/base64 base64 decodebytes11530519 +Ref: 95411530519 +Ref: library/base64 base64 encode11530749 +Ref: 374511530749 +Ref: library/base64 base64 encodebytes11531269 +Ref: 95311531269 +Ref: Legacy Interface-Footnote-111531941 +Ref: Legacy Interface-Footnote-211532000 +Node: Security Considerations<2>11532059 +Ref: library/base64 base64-security11532200 +Ref: 374611532200 +Ref: library/base64 security-considerations11532200 +Ref: 374711532200 +Ref: Security Considerations<2>-Footnote-111532862 +Ref: Security Considerations<2>-Footnote-211532921 +Node: binascii — Convert between binary and ASCII11532980 +Ref: library/binascii doc11533210 +Ref: 374811533210 +Ref: library/binascii binascii-convert-between-binary-and-ascii11533210 +Ref: 374911533210 +Ref: library/binascii module-binascii11533210 +Ref: 1011533210 +Ref: library/binascii binascii a2b_uu11534212 +Ref: 374a11534212 +Ref: library/binascii binascii b2a_uu11534462 +Ref: b2111534462 +Ref: library/binascii binascii a2b_base6411534841 +Ref: 162d11534841 +Ref: library/binascii binascii b2a_base6411535507 +Ref: c7f11535507 +Ref: library/binascii binascii a2b_qp11535857 +Ref: 374b11535857 +Ref: library/binascii binascii b2a_qp11536154 +Ref: 374c11536154 +Ref: library/binascii binascii crc_hqx11536922 +Ref: 72f11536922 +Ref: library/binascii binascii crc3211537227 +Ref: 169611537227 +Ref: library/binascii binascii b2a_hex11537902 +Ref: 241411537902 +Ref: library/binascii binascii hexlify11537966 +Ref: 374d11537966 +Ref: library/binascii binascii a2b_hex11539163 +Ref: 241511539163 +Ref: library/binascii binascii unhexlify11539203 +Ref: 1a4611539203 +Ref: library/binascii binascii Error11539732 +Ref: 101f11539732 +Ref: library/binascii binascii Incomplete11539836 +Ref: 374e11539836 +Ref: binascii — Convert between binary and ASCII-Footnote-111540301 +Ref: binascii — Convert between binary and ASCII-Footnote-211540360 +Ref: binascii — Convert between binary and ASCII-Footnote-311540419 +Node: quopri — Encode and decode MIME quoted-printable data11540478 +Ref: library/quopri doc11540646 +Ref: 374f11540646 +Ref: library/quopri module-quopri11540646 +Ref: b711540646 +Ref: library/quopri quopri-encode-and-decode-mime-quoted-printable-data11540646 +Ref: 375011540646 +Ref: library/quopri quopri decode11541381 +Ref: 241711541381 +Ref: library/quopri quopri encode11541921 +Ref: 241611541921 +Ref: library/quopri quopri decodestring11542578 +Ref: 375111542578 +Ref: library/quopri quopri encodestring11542775 +Ref: 375211542775 +Ref: quopri — Encode and decode MIME quoted-printable data-Footnote-111543225 +Ref: quopri — Encode and decode MIME quoted-printable data-Footnote-211543291 +Ref: quopri — Encode and decode MIME quoted-printable data-Footnote-311543350 +Ref: quopri — Encode and decode MIME quoted-printable data-Footnote-411543409 +Ref: quopri — Encode and decode MIME quoted-printable data-Footnote-511543468 +Node: Structured Markup Processing Tools11543527 +Ref: library/markup doc11543695 +Ref: 375311543695 +Ref: library/markup markup11543695 +Ref: 375411543695 +Ref: library/markup structured-markup-processing-tools11543695 +Ref: 375511543695 +Node: html — HyperText Markup Language support11545238 +Ref: library/html doc11545404 +Ref: 375611545404 +Ref: library/html html-hypertext-markup-language-support11545404 +Ref: 375711545404 +Ref: library/html module-html11545404 +Ref: 6b11545404 +Ref: library/html html escape11545670 +Ref: 100711545670 +Ref: library/html html unescape11546143 +Ref: 95711546143 +Ref: html — HyperText Markup Language support-Footnote-111546847 +Node: html parser — Simple HTML and XHTML parser11546920 +Ref: library/html parser doc11547149 +Ref: 375811547149 +Ref: library/html parser html-parser-simple-html-and-xhtml-parser11547149 +Ref: 375911547149 +Ref: library/html parser module-html parser11547149 +Ref: 6d11547149 +Ref: library/html parser html parser HTMLParser11547525 +Ref: 87411547525 +Ref: html parser — Simple HTML and XHTML parser-Footnote-111548643 +Node: Example HTML Parser Application11548714 +Ref: library/html parser example-html-parser-application11548853 +Ref: 375a11548853 +Node: HTMLParser Methods11550059 +Ref: library/html parser htmlparser-methods11550219 +Ref: 375b11550219 +Ref: library/html parser html parser HTMLParser feed11550346 +Ref: 375c11550346 +Ref: library/html parser html parser HTMLParser close11550613 +Ref: 154b11550613 +Ref: library/html parser html parser HTMLParser reset11550974 +Ref: 375d11550974 +Ref: library/html parser html parser HTMLParser getpos11551117 +Ref: 375e11551117 +Ref: library/html parser html parser HTMLParser get_starttag_text11551196 +Ref: 375f11551196 +Ref: library/html parser html parser HTMLParser handle_starttag11551767 +Ref: 376111551767 +Ref: library/html parser html parser HTMLParser handle_endtag11552571 +Ref: 376211552571 +Ref: library/html parser html parser HTMLParser handle_startendtag11552778 +Ref: 376011552778 +Ref: library/html parser html parser HTMLParser handle_data11553191 +Ref: 376311553191 +Ref: library/html parser html parser HTMLParser handle_entityref11553393 +Ref: 376411553393 +Ref: library/html parser html parser HTMLParser handle_charref11553697 +Ref: 376511553697 +Ref: library/html parser html parser HTMLParser handle_comment11554143 +Ref: 376611554143 +Ref: library/html parser html parser HTMLParser handle_decl11554669 +Ref: 376711554669 +Ref: library/html parser html parser HTMLParser handle_pi11554953 +Ref: 376811554953 +Ref: library/html parser html parser HTMLParser unknown_decl11555643 +Ref: 376911555643 +Node: Examples<24>11556005 +Ref: library/html parser examples11556125 +Ref: 376a11556125 +Ref: library/html parser htmlparser-examples11556125 +Ref: 376b11556125 +Node: html entities — Definitions of HTML general entities11559681 +Ref: library/html entities doc11559890 +Ref: 376c11559890 +Ref: library/html entities html-entities-definitions-of-html-general-entities11559890 +Ref: 376d11559890 +Ref: library/html entities module-html entities11559890 +Ref: 6c11559890 +Ref: library/html entities html entities html511560272 +Ref: 10c811560272 +Ref: library/html entities html entities entitydefs11560759 +Ref: 377011560759 +Ref: library/html entities html entities name2codepoint11560898 +Ref: 376e11560898 +Ref: library/html entities html entities codepoint2name11561019 +Ref: 376f11561019 +Ref: html entities — Definitions of HTML general entities-Footnote-111561167 +Ref: html entities — Definitions of HTML general entities-Footnote-211561240 +Node: XML Processing Modules11561346 +Ref: library/xml doc11561560 +Ref: 377111561560 +Ref: library/xml module-xml11561560 +Ref: 12011561560 +Ref: library/xml xml11561560 +Ref: 377211561560 +Ref: library/xml xml-processing-modules11561560 +Ref: 377311561560 +Ref: library/xml xml-security11562766 +Ref: 377411562766 +Ref: XML Processing Modules-Footnote-111562829 +Node: XML security11562890 +Ref: library/xml id111562961 +Ref: 377511562961 +Ref: library/xml xml-vulnerabilities11562961 +Ref: 377611562961 +Ref: XML security-Footnote-111564944 +Ref: XML security-Footnote-211564997 +Ref: XML security-Footnote-311565050 +Ref: XML security-Footnote-411565097 +Node: xml etree ElementTree — The ElementTree XML API11565153 +Ref: library/xml etree elementtree doc11565354 +Ref: 377711565354 +Ref: library/xml etree elementtree module-xml etree ElementTree11565354 +Ref: 12511565354 +Ref: library/xml etree elementtree xml-etree-elementtree-the-elementtree-xml-api11565354 +Ref: 377811565354 +Ref: xml etree ElementTree — The ElementTree XML API-Footnote-111566151 +Node: Tutorial<3>11566233 +Ref: library/xml etree elementtree tutorial11566352 +Ref: 377911566352 +Node: XML tree and elements11566778 +Ref: library/xml etree elementtree xml-tree-and-elements11566867 +Ref: 377a11566867 +Node: Parsing XML11567445 +Ref: library/xml etree elementtree elementtree-parsing-xml11567576 +Ref: 377b11567576 +Ref: library/xml etree elementtree parsing-xml11567576 +Ref: 377c11567576 +Node: Pull API for non-blocking parsing11570053 +Ref: library/xml etree elementtree elementtree-pull-parsing11570191 +Ref: fed11570191 +Ref: library/xml etree elementtree pull-api-for-non-blocking-parsing11570191 +Ref: 377e11570191 +Node: Finding interesting elements11572304 +Ref: library/xml etree elementtree finding-interesting-elements11572452 +Ref: 378111572452 +Node: Modifying an XML File11573694 +Ref: library/xml etree elementtree modifying-an-xml-file11573831 +Ref: 378411573831 +Node: Building XML documents11576775 +Ref: library/xml etree elementtree building-xml-documents11576911 +Ref: 378711576911 +Node: Parsing XML with Namespaces11577280 +Ref: library/xml etree elementtree parsing-xml-with-namespaces11577386 +Ref: 378911577386 +Ref: Parsing XML with Namespaces-Footnote-111579701 +Ref: Parsing XML with Namespaces-Footnote-211579753 +Node: XPath support11579805 +Ref: library/xml etree elementtree elementtree-xpath11579945 +Ref: bad11579945 +Ref: library/xml etree elementtree xpath-support11579945 +Ref: 378a11579945 +Ref: XPath support-Footnote-111580306 +Node: Example<8>11580342 +Ref: library/xml etree elementtree example11580433 +Ref: 378b11580433 +Node: Supported XPath syntax11581452 +Ref: library/xml etree elementtree supported-xpath-syntax11581543 +Ref: 378c11581543 +Node: Reference<4>11586526 +Ref: library/xml etree elementtree reference11586671 +Ref: 378d11586671 +Node: Functions<9>11586749 +Ref: library/xml etree elementtree elementtree-functions11586810 +Ref: 378e11586810 +Ref: library/xml etree elementtree functions11586810 +Ref: 378f11586810 +Ref: library/xml etree elementtree xml etree ElementTree canonicalize11586851 +Ref: 379011586851 +Ref: library/xml etree elementtree xml etree ElementTree Comment11589235 +Ref: 379111589235 +Ref: library/xml etree elementtree xml etree ElementTree dump11589920 +Ref: 379211589920 +Ref: library/xml etree elementtree xml etree ElementTree fromstring11590394 +Ref: 377d11590394 +Ref: library/xml etree elementtree xml etree ElementTree fromstringlist11590753 +Ref: 11c311590753 +Ref: library/xml etree elementtree xml etree ElementTree indent11591173 +Ref: 379411591173 +Ref: library/xml etree elementtree xml etree ElementTree iselement11591701 +Ref: 379511591701 +Ref: library/xml etree elementtree xml etree ElementTree iterparse11591915 +Ref: 27511591915 +Ref: library/xml etree elementtree xml etree ElementTree parse11594078 +Ref: 379611594078 +Ref: library/xml etree elementtree xml etree ElementTree ProcessingInstruction11594422 +Ref: 379711594422 +Ref: library/xml etree elementtree xml etree ElementTree register_namespace11595150 +Ref: 11c411595150 +Ref: library/xml etree elementtree xml etree ElementTree SubElement11595581 +Ref: 378811595581 +Ref: library/xml etree elementtree xml etree ElementTree tostring11596151 +Ref: fee11596151 +Ref: library/xml etree elementtree xml etree ElementTree tostringlist11597250 +Ref: fef11597250 +Ref: library/xml etree elementtree xml etree ElementTree XML11598521 +Ref: 379311598521 +Ref: library/xml etree elementtree xml etree ElementTree XMLID11598915 +Ref: 379811598915 +Ref: Functions<9>-Footnote-111599390 +Ref: Functions<9>-Footnote-211599431 +Ref: Functions<9>-Footnote-311599740 +Node: XInclude support11600049 +Ref: library/xml etree elementtree elementtree-xinclude11600193 +Ref: 379911600193 +Ref: library/xml etree elementtree xinclude-support11600193 +Ref: 379a11600193 +Ref: XInclude support-Footnote-111600558 +Node: Example<9>11600598 +Ref: library/xml etree elementtree id311600661 +Ref: 379b11600661 +Node: Reference<5>11602475 +Ref: library/xml etree elementtree id411602598 +Ref: 379c11602598 +Node: Functions<10>11602841 +Ref: library/xml etree elementtree elementinclude-functions11602927 +Ref: 379d11602927 +Ref: library/xml etree elementtree id511602927 +Ref: 379e11602927 +Ref: library/xml etree elementtree module-xml etree ElementInclude11602968 +Ref: 12411602968 +Ref: library/xml etree elementtree xml etree ElementInclude default_loader11602968 +Ref: 379f11602968 +Ref: library/xml etree elementtree xml etree ElementInclude include11603563 +Ref: 37a011603563 +Node: Element Objects11604447 +Ref: library/xml etree elementtree element-objects11604561 +Ref: 37a111604561 +Ref: library/xml etree elementtree elementtree-element-objects11604561 +Ref: 37a211604561 +Ref: library/xml etree elementtree xml etree ElementTree Element11604614 +Ref: 30a11604614 +Ref: library/xml etree elementtree xml etree ElementTree Element tag11605096 +Ref: 134111605096 +Ref: library/xml etree elementtree xml etree ElementTree Element text11605241 +Ref: 378211605241 +Ref: library/xml etree elementtree xml etree ElementTree Element tail11605266 +Ref: 37a311605266 +Ref: library/xml etree elementtree xml etree ElementTree Element attrib11606382 +Ref: 37a411606382 +Ref: library/xml etree elementtree xml etree ElementTree Element clear11606926 +Ref: 37a511606926 +Ref: library/xml etree elementtree xml etree ElementTree Element get11607119 +Ref: 378311607119 +Ref: library/xml etree elementtree xml etree ElementTree Element items11607307 +Ref: 37a611607307 +Ref: library/xml etree elementtree xml etree ElementTree Element keys11607476 +Ref: 37a711607476 +Ref: library/xml etree elementtree xml etree ElementTree Element set11607618 +Ref: 378511607618 +Ref: library/xml etree elementtree xml etree ElementTree Element append11607791 +Ref: 378611607791 +Ref: library/xml etree elementtree xml etree ElementTree Element extend11608027 +Ref: 11c511608027 +Ref: library/xml etree elementtree xml etree ElementTree Element find11608258 +Ref: 156511608258 +Ref: library/xml etree elementtree xml etree ElementTree Element findall11608680 +Ref: 156711608680 +Ref: library/xml etree elementtree xml etree ElementTree Element findtext11609099 +Ref: 156611609099 +Ref: library/xml etree elementtree xml etree ElementTree Element insert11609703 +Ref: 37a811609703 +Ref: library/xml etree elementtree xml etree ElementTree Element iter11609914 +Ref: 134211609914 +Ref: library/xml etree elementtree xml etree ElementTree Element iterfind11610406 +Ref: 11c611610406 +Ref: library/xml etree elementtree xml etree ElementTree Element itertext11610740 +Ref: 11c711610740 +Ref: library/xml etree elementtree xml etree ElementTree Element makeelement11610965 +Ref: 37a911610965 +Ref: library/xml etree elementtree xml etree ElementTree Element remove11611188 +Ref: 156911611188 +Ref: Element Objects-Footnote-111613940 +Node: ElementTree Objects11613983 +Ref: library/xml etree elementtree elementtree-elementtree-objects11614097 +Ref: 37aa11614097 +Ref: library/xml etree elementtree elementtree-objects11614097 +Ref: 37ab11614097 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree11614158 +Ref: 94e11614158 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree _setroot11614510 +Ref: 37ac11614510 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree find11614759 +Ref: 37ad11614759 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree findall11614898 +Ref: 37ae11614898 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree findtext11615043 +Ref: 37af11615043 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree getroot11615204 +Ref: 37b011615204 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree iter11615284 +Ref: 37b111615284 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree iterfind11615554 +Ref: 37b211615554 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree parse11615734 +Ref: 37b311615734 +Ref: library/xml etree elementtree xml etree ElementTree ElementTree write11616080 +Ref: ff011616080 +Ref: ElementTree Objects-Footnote-111618880 +Node: QName Objects11619189 +Ref: library/xml etree elementtree elementtree-qname-objects11619307 +Ref: 37b411619307 +Ref: library/xml etree elementtree qname-objects11619307 +Ref: 37b511619307 +Ref: library/xml etree elementtree xml etree ElementTree QName11619356 +Ref: 37b611619356 +Node: TreeBuilder Objects11619869 +Ref: library/xml etree elementtree elementtree-treebuilder-objects11619985 +Ref: 37b711619985 +Ref: library/xml etree elementtree treebuilder-objects11619985 +Ref: 37b811619985 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder11620046 +Ref: a5411620046 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder close11621164 +Ref: 37b911621164 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder data11621326 +Ref: 37ba11621326 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end11621490 +Ref: 11c811621490 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start11621623 +Ref: 198211621623 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder comment11621825 +Ref: 37bb11621825 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder pi11622023 +Ref: 37bc11622023 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder doctype11622358 +Ref: a9711622358 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder start_ns11622684 +Ref: 37bd11622684 +Ref: library/xml etree elementtree xml etree ElementTree TreeBuilder end_ns11623080 +Ref: 37be11623080 +Ref: library/xml etree elementtree xml etree ElementTree C14NWriterTarget11623329 +Ref: 37bf11623329 +Ref: TreeBuilder Objects-Footnote-111623879 +Node: XMLParser Objects11623920 +Ref: library/xml etree elementtree elementtree-xmlparser-objects11624044 +Ref: 37c011624044 +Ref: library/xml etree elementtree xmlparser-objects11624044 +Ref: 37c111624044 +Ref: library/xml etree elementtree xml etree ElementTree XMLParser11624101 +Ref: a5311624101 +Ref: library/xml etree elementtree xml etree ElementTree XMLParser close11624816 +Ref: 37c311624816 +Ref: library/xml etree elementtree xml etree ElementTree XMLParser feed11625072 +Ref: 37c211625072 +Ref: library/xml etree elementtree xml etree ElementTree XMLParser flush11625164 +Ref: 27111625164 +Ref: XMLParser Objects-Footnote-111627802 +Node: XMLPullParser Objects11628111 +Ref: library/xml etree elementtree elementtree-xmlpullparser-objects11628230 +Ref: 37c411628230 +Ref: library/xml etree elementtree xmlpullparser-objects11628230 +Ref: 37c511628230 +Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser11628295 +Ref: fec11628295 +Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser feed11628987 +Ref: 377f11628987 +Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser flush11629069 +Ref: 27211629069 +Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser close11629928 +Ref: 37c611629928 +Ref: library/xml etree elementtree xml etree ElementTree XMLPullParser read_events11630239 +Ref: 378011630239 +Node: Exceptions<19>11631975 +Ref: library/xml etree elementtree exceptions11632068 +Ref: 37c711632068 +Ref: library/xml etree elementtree xml etree ElementTree ParseError11632111 +Ref: 126b11632111 +Ref: library/xml etree elementtree xml etree ElementTree ParseError code11632439 +Ref: 37c811632439 +Ref: library/xml etree elementtree xml etree ElementTree ParseError position11632644 +Ref: 37c911632644 +Node: xml dom — The Document Object Model API11632769 +Ref: library/xml dom doc11632994 +Ref: 37ca11632994 +Ref: library/xml dom module-xml dom11632994 +Ref: 12111632994 +Ref: library/xml dom xml-dom-the-document-object-model-api11632994 +Ref: 37cb11632994 +Ref: xml dom — The Document Object Model API-Footnote-111636468 +Ref: xml dom — The Document Object Model API-Footnote-211636545 +Ref: xml dom — The Document Object Model API-Footnote-311636611 +Ref: xml dom — The Document Object Model API-Footnote-411636658 +Node: Module Contents<4>11636704 +Ref: library/xml dom module-contents11636827 +Ref: 37ce11636827 +Ref: library/xml dom xml dom registerDOMImplementation11636937 +Ref: 37cf11636937 +Ref: library/xml dom xml dom getDOMImplementation11637385 +Ref: 37cc11637385 +Ref: library/xml dom xml dom EMPTY_NAMESPACE11638294 +Ref: 37d011638294 +Ref: library/xml dom xml dom XML_NAMESPACE11638567 +Ref: 37d111638567 +Ref: library/xml dom xml dom XMLNS_NAMESPACE11638724 +Ref: 37d211638724 +Ref: library/xml dom xml dom XHTML_NAMESPACE11638910 +Ref: 37d311638910 +Ref: Module Contents<4>-Footnote-111639645 +Ref: Module Contents<4>-Footnote-211639690 +Ref: Module Contents<4>-Footnote-311639747 +Node: Objects in the DOM11639785 +Ref: library/xml dom dom-objects11639928 +Ref: 37d411639928 +Ref: library/xml dom objects-in-the-dom11639928 +Ref: 37d511639928 +Node: DOMImplementation Objects11644463 +Ref: library/xml dom dom-implementation-objects11644564 +Ref: 37d611644564 +Ref: library/xml dom domimplementation-objects11644564 +Ref: 37e011644564 +Ref: library/xml dom xml dom DOMImplementation hasFeature11644920 +Ref: 37e111644920 +Ref: library/xml dom xml dom DOMImplementation createDocument11645099 +Ref: 37e211645099 +Ref: library/xml dom xml dom DOMImplementation createDocumentType11645619 +Ref: 37e311645619 +Node: Node Objects11645927 +Ref: library/xml dom dom-node-objects11646053 +Ref: 37d711646053 +Ref: library/xml dom node-objects11646053 +Ref: 37e411646053 +Ref: library/xml dom xml dom Node nodeType11646170 +Ref: 37e511646170 +Ref: library/xml dom xml dom Node parentNode11646593 +Ref: 37e611646593 +Ref: library/xml dom xml dom Node attributes11647002 +Ref: 37e711647002 +Ref: library/xml dom xml dom Node previousSibling11647215 +Ref: 37e811647215 +Ref: library/xml dom xml dom Node nextSibling11647701 +Ref: 37e911647701 +Ref: library/xml dom xml dom Node childNodes11647967 +Ref: 37ea11647967 +Ref: library/xml dom xml dom Node firstChild11648086 +Ref: 37eb11648086 +Ref: library/xml dom xml dom Node lastChild11648223 +Ref: 37ec11648223 +Ref: library/xml dom xml dom Node localName11648358 +Ref: 37ed11648358 +Ref: library/xml dom xml dom Node prefix11648522 +Ref: 37ee11648522 +Ref: library/xml dom xml dom Node namespaceURI11648690 +Ref: 37ef11648690 +Ref: library/xml dom xml dom Node nodeName11648853 +Ref: 37f011648853 +Ref: library/xml dom xml dom Node nodeValue11649290 +Ref: 37f111649290 +Ref: library/xml dom xml dom Node hasAttributes11649524 +Ref: 37f211649524 +Ref: library/xml dom xml dom Node hasChildNodes11649615 +Ref: 37f311649615 +Ref: library/xml dom xml dom Node isSameNode11649707 +Ref: 37f411649707 +Ref: library/xml dom xml dom Node appendChild11650336 +Ref: 37f511650336 +Ref: library/xml dom xml dom Node insertBefore11650544 +Ref: 37f611650544 +Ref: library/xml dom xml dom Node removeChild11650885 +Ref: 37f711650885 +Ref: library/xml dom xml dom Node replaceChild11651173 +Ref: 37f811651173 +Ref: library/xml dom xml dom Node normalize11651387 +Ref: 37f911651387 +Ref: library/xml dom xml dom Node cloneNode11651604 +Ref: 37fa11651604 +Node: NodeList Objects11651748 +Ref: library/xml dom dom-nodelist-objects11651869 +Ref: 37d811651869 +Ref: library/xml dom nodelist-objects11651869 +Ref: 37fb11651869 +Ref: library/xml dom xml dom NodeList item11652350 +Ref: 37fc11652350 +Ref: library/xml dom xml dom NodeList length11652580 +Ref: 37fd11652580 +Node: DocumentType Objects11653250 +Ref: library/xml dom documenttype-objects11653375 +Ref: 37fe11653375 +Ref: library/xml dom dom-documenttype-objects11653375 +Ref: 37d911653375 +Ref: library/xml dom xml dom DocumentType publicId11654008 +Ref: 37ff11654008 +Ref: library/xml dom xml dom DocumentType systemId11654174 +Ref: 380011654174 +Ref: library/xml dom xml dom DocumentType internalSubset11654350 +Ref: 380111654350 +Ref: library/xml dom xml dom DocumentType name11654603 +Ref: 380211654603 +Ref: library/xml dom xml dom DocumentType entities11654732 +Ref: 380311654732 +Ref: library/xml dom xml dom DocumentType notations11655115 +Ref: 380411655115 +Node: Document Objects11655494 +Ref: library/xml dom document-objects11655621 +Ref: 380511655621 +Ref: library/xml dom dom-document-objects11655621 +Ref: 37da11655621 +Ref: library/xml dom xml dom Document documentElement11655868 +Ref: 380611655868 +Ref: library/xml dom xml dom Document createElement11655962 +Ref: 380711655962 +Ref: library/xml dom xml dom Document createElementNS11656251 +Ref: 380811656251 +Ref: library/xml dom xml dom Document createTextNode11656602 +Ref: 380911656602 +Ref: library/xml dom xml dom Document createComment11656821 +Ref: 380a11656821 +Ref: library/xml dom xml dom Document createProcessingInstruction11657042 +Ref: 380b11657042 +Ref: library/xml dom xml dom Document createAttribute11657314 +Ref: 380c11657314 +Ref: library/xml dom xml dom Document createAttributeNS11657621 +Ref: 380d11657621 +Ref: library/xml dom xml dom Document getElementsByTagName11658009 +Ref: 380e11658009 +Ref: library/xml dom xml dom Document getElementsByTagNameNS11658185 +Ref: 380f11658185 +Node: Element Objects<2>11658456 +Ref: library/xml dom dom-element-objects11658575 +Ref: 37db11658575 +Ref: library/xml dom element-objects11658575 +Ref: 381011658575 +Ref: library/xml dom xml dom Element tagName11658716 +Ref: 381111658716 +Ref: library/xml dom xml dom Element getElementsByTagName11658863 +Ref: 381211658863 +Ref: library/xml dom xml dom Element getElementsByTagNameNS11658976 +Ref: 381311658976 +Ref: library/xml dom xml dom Element hasAttribute11659107 +Ref: 381411659107 +Ref: library/xml dom xml dom Element hasAttributeNS11659221 +Ref: 381511659221 +Ref: library/xml dom xml dom Element getAttribute11659385 +Ref: 381611659385 +Ref: library/xml dom xml dom Element getAttributeNode11659598 +Ref: 381711659598 +Ref: library/xml dom xml dom Element getAttributeNS11659719 +Ref: 381811659719 +Ref: library/xml dom xml dom Element getAttributeNodeNS11659977 +Ref: 381911659977 +Ref: library/xml dom xml dom Element removeAttribute11660131 +Ref: 381a11660131 +Ref: library/xml dom xml dom Element removeAttributeNode11660289 +Ref: 381c11660289 +Ref: library/xml dom xml dom Element removeAttributeNS11660481 +Ref: 381d11660481 +Ref: library/xml dom xml dom Element setAttribute11660690 +Ref: 381e11660690 +Ref: library/xml dom xml dom Element setAttributeNode11660782 +Ref: 381f11660782 +Ref: library/xml dom xml dom Element setAttributeNodeNS11661126 +Ref: 382111661126 +Ref: library/xml dom xml dom Element setAttributeNS11661499 +Ref: 382211661499 +Node: Attr Objects11661735 +Ref: library/xml dom attr-objects11661858 +Ref: 382311661858 +Ref: library/xml dom dom-attr-objects11661858 +Ref: 37dc11661858 +Ref: library/xml dom xml dom Attr name11661973 +Ref: 382411661973 +Ref: library/xml dom xml dom Attr localName11662085 +Ref: 382511662085 +Ref: library/xml dom xml dom Attr prefix11662239 +Ref: 382611662239 +Ref: library/xml dom xml dom Attr value11662359 +Ref: 382711662359 +Node: NamedNodeMap Objects11662484 +Ref: library/xml dom dom-attributelist-objects11662604 +Ref: 382811662604 +Ref: library/xml dom namednodemap-objects11662604 +Ref: 382911662604 +Ref: library/xml dom xml dom NamedNodeMap length11662723 +Ref: 382a11662723 +Ref: library/xml dom xml dom NamedNodeMap item11662799 +Ref: 382b11662799 +Node: Comment Objects11663280 +Ref: library/xml dom comment-objects11663417 +Ref: 382c11663417 +Ref: library/xml dom dom-comment-objects11663417 +Ref: 37dd11663417 +Ref: library/xml dom xml dom Comment data11663589 +Ref: 382d11663589 +Node: Text and CDATASection Objects11663807 +Ref: library/xml dom dom-text-objects11663953 +Ref: 37de11663953 +Ref: library/xml dom text-and-cdatasection-objects11663953 +Ref: 382e11663953 +Ref: library/xml dom xml dom Text data11664449 +Ref: 382f11664449 +Node: ProcessingInstruction Objects11664942 +Ref: library/xml dom dom-pi-objects11665087 +Ref: 37df11665087 +Ref: library/xml dom processinginstruction-objects11665087 +Ref: 383011665087 +Ref: library/xml dom xml dom ProcessingInstruction target11665299 +Ref: 383111665299 +Ref: library/xml dom xml dom ProcessingInstruction data11665467 +Ref: 383211665467 +Node: Exceptions<20>11665605 +Ref: library/xml dom dom-exceptions11665712 +Ref: 383311665712 +Ref: library/xml dom exceptions11665712 +Ref: 383411665712 +Ref: library/xml dom xml dom DOMException11666391 +Ref: 383511666391 +Ref: library/xml dom xml dom DomstringSizeErr11666553 +Ref: 383611666553 +Ref: library/xml dom xml dom HierarchyRequestErr11666808 +Ref: 383711666808 +Ref: library/xml dom xml dom IndexSizeErr11666947 +Ref: 383811666947 +Ref: library/xml dom xml dom InuseAttributeErr11667089 +Ref: 382011667089 +Ref: library/xml dom xml dom InvalidAccessErr11667253 +Ref: 383911667253 +Ref: library/xml dom xml dom InvalidCharacterErr11667386 +Ref: 383a11667386 +Ref: library/xml dom xml dom InvalidModificationErr11667746 +Ref: 383b11667746 +Ref: library/xml dom xml dom InvalidStateErr11667860 +Ref: 383c11667860 +Ref: library/xml dom xml dom NamespaceErr11668003 +Ref: 383d11668003 +Ref: library/xml dom xml dom NotFoundErr11668212 +Ref: 381b11668212 +Ref: library/xml dom xml dom NotSupportedErr11668443 +Ref: 383e11668443 +Ref: library/xml dom xml dom NoDataAllowedErr11668585 +Ref: 383f11668585 +Ref: library/xml dom xml dom NoModificationAllowedErr11668713 +Ref: 384011668713 +Ref: library/xml dom xml dom SyntaxErr11668879 +Ref: 384111668879 +Ref: library/xml dom xml dom WrongDocumentErr11668974 +Ref: 384211668974 +Ref: Exceptions<20>-Footnote-111672015 +Node: Conformance11672060 +Ref: library/xml dom conformance11672176 +Ref: 384311672176 +Ref: library/xml dom dom-conformance11672176 +Ref: 37cd11672176 +Node: Type Mapping11672433 +Ref: library/xml dom dom-type-mapping11672518 +Ref: 384411672518 +Ref: library/xml dom type-mapping11672518 +Ref: 384511672518 +Node: Accessor Methods11673343 +Ref: library/xml dom accessor-methods11673428 +Ref: 384611673428 +Ref: library/xml dom dom-accessor-methods11673428 +Ref: 384711673428 +Node: xml dom minidom — Minimal DOM implementation11675304 +Ref: library/xml dom minidom doc11675538 +Ref: 384811675538 +Ref: library/xml dom minidom module-xml dom minidom11675538 +Ref: 12211675538 +Ref: library/xml dom minidom xml-dom-minidom-minimal-dom-implementation11675538 +Ref: 384911675538 +Ref: library/xml dom minidom xml dom minidom parse11676770 +Ref: 384a11676770 +Ref: library/xml dom minidom xml dom minidom parseString11677339 +Ref: 384b11677339 +Ref: xml dom minidom — Minimal DOM implementation-Footnote-111679913 +Ref: xml dom minidom — Minimal DOM implementation-Footnote-211679989 +Node: DOM Objects11680036 +Ref: library/xml dom minidom dom-objects11680150 +Ref: 384c11680150 +Ref: library/xml dom minidom minidom-objects11680150 +Ref: 384d11680150 +Ref: library/xml dom minidom xml dom minidom Node unlink11680385 +Ref: 384e11680385 +Ref: library/xml dom minidom xml dom minidom Node writexml11681161 +Ref: 384f11681161 +Ref: library/xml dom minidom xml dom minidom Node toxml11682401 +Ref: 149211682401 +Ref: library/xml dom minidom xml dom minidom Node toprettyxml11683210 +Ref: 149311683210 +Ref: DOM Objects-Footnote-111683951 +Node: DOM Example11684354 +Ref: library/xml dom minidom dom-example11684505 +Ref: 385011684505 +Ref: library/xml dom minidom id211684505 +Ref: 385111684505 +Node: minidom and the DOM standard11686537 +Ref: library/xml dom minidom minidom-and-dom11686668 +Ref: 385211686668 +Ref: library/xml dom minidom minidom-and-the-dom-standard11686668 +Ref: 385311686668 +Node: xml dom pulldom — Support for building partial DOM trees11689309 +Ref: library/xml dom pulldom doc11689538 +Ref: 385411689538 +Ref: library/xml dom pulldom module-xml dom pulldom11689538 +Ref: 12311689538 +Ref: library/xml dom pulldom xml-dom-pulldom-support-for-building-partial-dom-trees11689538 +Ref: 385511689538 +Ref: library/xml dom pulldom xml dom pulldom PullDom11692182 +Ref: 385711692182 +Ref: library/xml dom pulldom xml dom pulldom SAX2DOM11692303 +Ref: 385911692303 +Ref: library/xml dom pulldom xml dom pulldom parse11692424 +Ref: 385a11692424 +Ref: library/xml dom pulldom xml dom pulldom parseString11693016 +Ref: 385c11693016 +Ref: library/xml dom pulldom xml dom pulldom default_bufsize11693168 +Ref: 385d11693168 +Ref: xml dom pulldom — Support for building partial DOM trees-Footnote-111693481 +Node: DOMEventStream Objects11693557 +Ref: library/xml dom pulldom domeventstream-objects11693674 +Ref: 385e11693674 +Ref: library/xml dom pulldom id111693674 +Ref: 385f11693674 +Ref: library/xml dom pulldom xml dom pulldom DOMEventStream11693739 +Ref: 73011693739 +Ref: library/xml dom pulldom xml dom pulldom DOMEventStream getEvent11693907 +Ref: 386011693907 +Ref: library/xml dom pulldom xml dom pulldom DOMEventStream expandNode11694399 +Ref: 385611694399 +Ref: library/xml dom pulldom xml dom pulldom DOMEventStream reset11695113 +Ref: 386111695113 +Node: xml sax — Support for SAX2 parsers11695140 +Ref: library/xml sax doc11695372 +Ref: 386211695372 +Ref: library/xml sax module-xml sax11695372 +Ref: 12911695372 +Ref: library/xml sax xml-sax-support-for-sax2-parsers11695372 +Ref: 386311695372 +Ref: library/xml sax xml sax make_parser11696365 +Ref: 1a3a11696365 +Ref: library/xml sax xml sax parse11696863 +Ref: 1a0311696863 +Ref: library/xml sax xml sax parseString11697458 +Ref: e9511697458 +Ref: library/xml sax xml sax SAXException11699383 +Ref: 386911699383 +Ref: library/xml sax xml sax SAXParseException11700255 +Ref: 386711700255 +Ref: library/xml sax xml sax SAXNotRecognizedException11700666 +Ref: 386a11700666 +Ref: library/xml sax xml sax SAXNotSupportedException11700968 +Ref: 386b11700968 +Ref: xml sax — Support for SAX2 parsers-Footnote-111701982 +Ref: xml sax — Support for SAX2 parsers-Footnote-211702059 +Node: SAXException Objects11702094 +Ref: library/xml sax sax-exception-objects11702187 +Ref: 386c11702187 +Ref: library/xml sax saxexception-objects11702187 +Ref: 386d11702187 +Ref: library/xml sax xml sax SAXException getMessage11702327 +Ref: 386e11702327 +Ref: library/xml sax xml sax SAXException getException11702437 +Ref: 386f11702437 +Node: xml sax handler — Base classes for SAX handlers11702541 +Ref: library/xml sax handler doc11702749 +Ref: 387011702749 +Ref: library/xml sax handler module-xml sax handler11702749 +Ref: 12a11702749 +Ref: library/xml sax handler xml-sax-handler-base-classes-for-sax-handlers11702749 +Ref: 387111702749 +Ref: library/xml sax handler xml sax handler ContentHandler11703452 +Ref: 385811703452 +Ref: library/xml sax handler xml sax handler DTDHandler11703692 +Ref: 387211703692 +Ref: library/xml sax handler xml sax handler EntityResolver11703877 +Ref: 387311703877 +Ref: library/xml sax handler xml sax handler ErrorHandler11704159 +Ref: 386611704159 +Ref: library/xml sax handler xml sax handler LexicalHandler11704433 +Ref: 85811704433 +Ref: library/xml sax handler xml sax handler feature_namespaces11704724 +Ref: 387411704724 +Ref: library/xml sax handler xml sax handler feature_namespace_prefixes11705048 +Ref: 387511705048 +Ref: library/xml sax handler xml sax handler feature_string_interning11705477 +Ref: 387611705477 +Ref: library/xml sax handler xml sax handler feature_validation11705892 +Ref: 387711705892 +Ref: library/xml sax handler xml sax handler feature_external_ges11706231 +Ref: 386511706231 +Ref: library/xml sax handler xml sax handler feature_external_pes11706544 +Ref: 387811706544 +Ref: library/xml sax handler xml sax handler all_features11706925 +Ref: 387911706925 +Ref: library/xml sax handler xml sax handler property_lexical_handler11706993 +Ref: 387a11706993 +Ref: library/xml sax handler xml sax handler property_declaration_handler11707313 +Ref: 387b11707313 +Ref: library/xml sax handler xml sax handler property_dom_node11707671 +Ref: 387c11707671 +Ref: library/xml sax handler xml sax handler property_xml_string11708061 +Ref: 387d11708061 +Ref: library/xml sax handler xml sax handler all_properties11708329 +Ref: 387e11708329 +Ref: xml sax handler — Base classes for SAX handlers-Footnote-111708586 +Node: ContentHandler Objects11708662 +Ref: library/xml sax handler content-handler-objects11708797 +Ref: 387f11708797 +Ref: library/xml sax handler contenthandler-objects11708797 +Ref: 388011708797 +Ref: library/xml sax handler xml sax handler ContentHandler setDocumentLocator11709051 +Ref: 388111709051 +Ref: library/xml sax handler xml sax handler ContentHandler startDocument11710126 +Ref: 388211710126 +Ref: library/xml sax handler xml sax handler ContentHandler endDocument11710404 +Ref: 388311710404 +Ref: library/xml sax handler xml sax handler ContentHandler startPrefixMapping11710772 +Ref: 388411710772 +Ref: library/xml sax handler xml sax handler ContentHandler endPrefixMapping11711974 +Ref: 388511711974 +Ref: library/xml sax handler xml sax handler ContentHandler startElement11712317 +Ref: 150d11712317 +Ref: library/xml sax handler xml sax handler ContentHandler endElement11712958 +Ref: 150e11712958 +Ref: library/xml sax handler xml sax handler ContentHandler startElementNS11713186 +Ref: 388711713186 +Ref: library/xml sax handler xml sax handler ContentHandler endElementNS11714174 +Ref: 388911714174 +Ref: library/xml sax handler xml sax handler ContentHandler characters11714447 +Ref: 150f11714447 +Ref: library/xml sax handler xml sax handler ContentHandler ignorableWhitespace11715474 +Ref: 388a11715474 +Ref: library/xml sax handler xml sax handler ContentHandler processingInstruction11716141 +Ref: 388b11716141 +Ref: library/xml sax handler xml sax handler ContentHandler skippedEntity11716601 +Ref: 388c11716601 +Node: DTDHandler Objects11717101 +Ref: library/xml sax handler dtd-handler-objects11717267 +Ref: 388d11717267 +Ref: library/xml sax handler dtdhandler-objects11717267 +Ref: 388e11717267 +Ref: library/xml sax handler xml sax handler DTDHandler notationDecl11717392 +Ref: 388f11717392 +Ref: library/xml sax handler xml sax handler DTDHandler unparsedEntityDecl11717499 +Ref: 389011717499 +Node: EntityResolver Objects11717637 +Ref: library/xml sax handler entity-resolver-objects11717801 +Ref: 389111717801 +Ref: library/xml sax handler entityresolver-objects11717801 +Ref: 389211717801 +Ref: library/xml sax handler xml sax handler EntityResolver resolveEntity11717868 +Ref: 389311717868 +Node: ErrorHandler Objects11718136 +Ref: library/xml sax handler errorhandler-objects11718304 +Ref: 389411718304 +Ref: library/xml sax handler sax-error-handler11718304 +Ref: 389511718304 +Ref: library/xml sax handler xml sax handler ErrorHandler error11718959 +Ref: 389611718959 +Ref: library/xml sax handler xml sax handler ErrorHandler fatalError11719328 +Ref: 389711719328 +Ref: library/xml sax handler xml sax handler ErrorHandler warning11719514 +Ref: 389811719514 +Node: LexicalHandler Objects11719859 +Ref: library/xml sax handler lexical-handler-objects11719996 +Ref: 389911719996 +Ref: library/xml sax handler lexicalhandler-objects11719996 +Ref: 389a11719996 +Ref: library/xml sax handler xml sax handler LexicalHandler comment11720601 +Ref: 389b11720601 +Ref: library/xml sax handler xml sax handler LexicalHandler startDTD11720755 +Ref: 389c11720755 +Ref: library/xml sax handler xml sax handler LexicalHandler endDTD11720913 +Ref: 389d11720913 +Ref: library/xml sax handler xml sax handler LexicalHandler startCDATA11720993 +Ref: 389e11720993 +Ref: library/xml sax handler xml sax handler LexicalHandler endCDATA11721187 +Ref: 389f11721187 +Node: xml sax saxutils — SAX Utilities11721276 +Ref: library/xml sax utils doc11721495 +Ref: 38a011721495 +Ref: library/xml sax utils module-xml sax saxutils11721495 +Ref: 12b11721495 +Ref: library/xml sax utils xml-sax-saxutils-sax-utilities11721495 +Ref: 38a111721495 +Ref: library/xml sax utils xml sax saxutils escape11721882 +Ref: 38a211721882 +Ref: library/xml sax utils xml sax saxutils unescape11722533 +Ref: 38a311722533 +Ref: library/xml sax utils xml sax saxutils quoteattr11723000 +Ref: 38a411723000 +Ref: library/xml sax utils xml sax saxutils XMLGenerator11723909 +Ref: 38a511723909 +Ref: library/xml sax utils xml sax saxutils XMLFilterBase11724772 +Ref: 38a611724772 +Ref: library/xml sax utils xml sax saxutils prepare_input_source11725194 +Ref: 38a711725194 +Ref: xml sax saxutils — SAX Utilities-Footnote-111725690 +Node: xml sax xmlreader — Interface for XML parsers11725767 +Ref: library/xml sax reader doc11725987 +Ref: 38a911725987 +Ref: library/xml sax reader module-xml sax xmlreader11725987 +Ref: 12c11725987 +Ref: library/xml sax reader xml-sax-xmlreader-interface-for-xml-parsers11725987 +Ref: 38aa11725987 +Ref: library/xml sax reader xml sax xmlreader XMLReader11726487 +Ref: 385b11726487 +Ref: library/xml sax reader xml sax xmlreader IncrementalParser11726583 +Ref: 38ab11726583 +Ref: library/xml sax reader xml sax xmlreader Locator11727710 +Ref: 386811727710 +Ref: library/xml sax reader xml sax xmlreader InputSource11728043 +Ref: e9411728043 +Ref: library/xml sax reader xml sax xmlreader AttributesImpl11728811 +Ref: 38ac11728811 +Ref: library/xml sax reader xml sax xmlreader AttributesNSImpl11729410 +Ref: 38ad11729410 +Ref: xml sax xmlreader — Interface for XML parsers-Footnote-111730167 +Node: XMLReader Objects11730245 +Ref: library/xml sax reader id111730380 +Ref: 38ae11730380 +Ref: library/xml sax reader xmlreader-objects11730380 +Ref: 38af11730380 +Ref: library/xml sax reader xml sax xmlreader XMLReader parse11730507 +Ref: 38a811730507 +Ref: library/xml sax reader xml sax xmlreader XMLReader getContentHandler11731096 +Ref: 38b011731096 +Ref: library/xml sax reader xml sax xmlreader XMLReader setContentHandler11731193 +Ref: 38b111731193 +Ref: library/xml sax reader xml sax xmlreader XMLReader getDTDHandler11731376 +Ref: 38b211731376 +Ref: library/xml sax reader xml sax xmlreader XMLReader setDTDHandler11731465 +Ref: 38b311731465 +Ref: library/xml sax reader xml sax xmlreader XMLReader getEntityResolver11731632 +Ref: 38b411731632 +Ref: library/xml sax reader xml sax xmlreader XMLReader setEntityResolver11731729 +Ref: 38b511731729 +Ref: library/xml sax reader xml sax xmlreader XMLReader getErrorHandler11732021 +Ref: 38b611732021 +Ref: library/xml sax reader xml sax xmlreader XMLReader setErrorHandler11732114 +Ref: 38b711732114 +Ref: library/xml sax reader xml sax xmlreader XMLReader setLocale11732318 +Ref: 38b811732318 +Ref: library/xml sax reader xml sax xmlreader XMLReader getFeature11732684 +Ref: 38b911732684 +Ref: library/xml sax reader xml sax xmlreader XMLReader setFeature11732966 +Ref: 386411732966 +Ref: library/xml sax reader xml sax xmlreader XMLReader getProperty11733255 +Ref: 38ba11733255 +Ref: library/xml sax reader xml sax xmlreader XMLReader setProperty11733546 +Ref: 38bb11733546 +Node: IncrementalParser Objects11733840 +Ref: library/xml sax reader incremental-parser-objects11733999 +Ref: 38bc11733999 +Ref: library/xml sax reader incrementalparser-objects11733999 +Ref: 38bd11733999 +Ref: library/xml sax reader xml sax xmlreader IncrementalParser feed11734157 +Ref: 38be11734157 +Ref: library/xml sax reader xml sax xmlreader IncrementalParser close11734233 +Ref: 38bf11734233 +Ref: library/xml sax reader xml sax xmlreader IncrementalParser reset11734472 +Ref: 38c011734472 +Node: Locator Objects11734734 +Ref: library/xml sax reader id211734895 +Ref: 38c111734895 +Ref: library/xml sax reader locator-objects11734895 +Ref: 38c211734895 +Ref: library/xml sax reader xml sax xmlreader Locator getColumnNumber11735006 +Ref: 38c311735006 +Ref: library/xml sax reader xml sax xmlreader Locator getLineNumber11735109 +Ref: 38c411735109 +Ref: library/xml sax reader xml sax xmlreader Locator getPublicId11735208 +Ref: 38c511735208 +Ref: library/xml sax reader xml sax xmlreader Locator getSystemId11735302 +Ref: 38c611735302 +Node: InputSource Objects11735396 +Ref: library/xml sax reader input-source-objects11735556 +Ref: 38c711735556 +Ref: library/xml sax reader inputsource-objects11735556 +Ref: 38c811735556 +Ref: library/xml sax reader xml sax xmlreader InputSource setPublicId11735617 +Ref: 38c911735617 +Ref: library/xml sax reader xml sax xmlreader InputSource getPublicId11735724 +Ref: 38ca11735724 +Ref: library/xml sax reader xml sax xmlreader InputSource setSystemId11735832 +Ref: 38cb11735832 +Ref: library/xml sax reader xml sax xmlreader InputSource getSystemId11735939 +Ref: 38cc11735939 +Ref: library/xml sax reader xml sax xmlreader InputSource setEncoding11736047 +Ref: 38cd11736047 +Ref: library/xml sax reader xml sax xmlreader InputSource getEncoding11736433 +Ref: 38ce11736433 +Ref: library/xml sax reader xml sax xmlreader InputSource setByteStream11736527 +Ref: 38cf11736527 +Ref: library/xml sax reader xml sax xmlreader InputSource getByteStream11736960 +Ref: 38d011736960 +Ref: library/xml sax reader xml sax xmlreader InputSource setCharacterStream11737168 +Ref: 38d111737168 +Ref: library/xml sax reader xml sax xmlreader InputSource getCharacterStream11737482 +Ref: 38d211737482 +Node: The Attributes Interface11737583 +Ref: library/xml sax reader attributes-objects11737754 +Ref: 388611737754 +Ref: library/xml sax reader the-attributes-interface11737754 +Ref: 38d311737754 +Ref: library/xml sax reader xml sax xmlreader Attributes getLength11738084 +Ref: 38d411738084 +Ref: library/xml sax reader xml sax xmlreader Attributes getNames11738160 +Ref: 38d511738160 +Ref: library/xml sax reader xml sax xmlreader Attributes getType11738238 +Ref: 38d611738238 +Ref: library/xml sax reader xml sax xmlreader Attributes getValue11738363 +Ref: 38d711738363 +Node: The AttributesNS Interface11738447 +Ref: library/xml sax reader attributes-ns-objects11738590 +Ref: 388811738590 +Ref: library/xml sax reader the-attributesns-interface11738590 +Ref: 38d811738590 +Ref: library/xml sax reader xml sax xmlreader AttributesNS getValueByQName11738923 +Ref: 38d911738923 +Ref: library/xml sax reader xml sax xmlreader AttributesNS getNameByQName11739017 +Ref: 38da11739017 +Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNameByName11739140 +Ref: 38db11739140 +Ref: library/xml sax reader xml sax xmlreader AttributesNS getQNames11739261 +Ref: 38dc11739261 +Node: xml parsers expat — Fast XML parsing using Expat11739352 +Ref: library/pyexpat doc11739529 +Ref: 38dd11739529 +Ref: library/pyexpat module-xml parsers expat11739529 +Ref: 12611739529 +Ref: library/pyexpat xml-parsers-expat-fast-xml-parsing-using-expat11739529 +Ref: 38de11739529 +Ref: library/pyexpat xml parsers expat ExpatError11740491 +Ref: 126c11740491 +Ref: library/pyexpat xml parsers expat error11740701 +Ref: 38e011740701 +Ref: library/pyexpat xml parsers expat XMLParserType11740781 +Ref: 38e111740781 +Ref: library/pyexpat xml parsers expat ErrorString11740978 +Ref: 38e311740978 +Ref: library/pyexpat xml parsers expat ParserCreate11741101 +Ref: 38e211741101 +Ref: xml parsers expat — Fast XML parsing using Expat-Footnote-111743537 +Ref: xml parsers expat — Fast XML parsing using Expat-Footnote-211743846 +Node: XMLParser Objects<2>11743879 +Ref: library/pyexpat id211744016 +Ref: 38e411744016 +Ref: library/pyexpat xmlparser-objects11744016 +Ref: 38e511744016 +Ref: library/pyexpat xml parsers expat xmlparser Parse11744126 +Ref: 38e611744126 +Ref: library/pyexpat xml parsers expat xmlparser ParseFile11744504 +Ref: 38e711744504 +Ref: library/pyexpat xml parsers expat xmlparser SetBase11744724 +Ref: 38e811744724 +Ref: library/pyexpat xml parsers expat xmlparser GetBase11745140 +Ref: 38ec11745140 +Ref: library/pyexpat xml parsers expat xmlparser GetInputContext11745338 +Ref: 38ed11745338 +Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityParserCreate11745621 +Ref: 38ee11745621 +Ref: library/pyexpat xml parsers expat xmlparser SetParamEntityParsing11746138 +Ref: 38f111746138 +Ref: library/pyexpat xml parsers expat xmlparser UseForeignDTD11746503 +Ref: 38f211746503 +Ref: library/pyexpat xml parsers expat xmlparser SetReparseDeferralEnabled11747490 +Ref: 27411747490 +Ref: library/pyexpat xml parsers expat xmlparser GetReparseDeferralEnabled11749003 +Ref: 27311749003 +Ref: library/pyexpat xml parsers expat xmlparser buffer_size11749242 +Ref: 38f511749242 +Ref: library/pyexpat xml parsers expat xmlparser buffer_text11749504 +Ref: 148b11749504 +Ref: library/pyexpat xml parsers expat xmlparser buffer_used11750050 +Ref: 38f711750050 +Ref: library/pyexpat xml parsers expat xmlparser ordered_attributes11750323 +Ref: 38ef11750323 +Ref: library/pyexpat xml parsers expat xmlparser specified_attributes11750815 +Ref: 38f011750815 +Ref: library/pyexpat xml parsers expat xmlparser ErrorByteIndex11751622 +Ref: 38f811751622 +Ref: library/pyexpat xml parsers expat xmlparser ErrorCode11751708 +Ref: 38f911751708 +Ref: library/pyexpat xml parsers expat xmlparser ErrorColumnNumber11751939 +Ref: 38fa11751939 +Ref: library/pyexpat xml parsers expat xmlparser ErrorLineNumber11752031 +Ref: 38fb11752031 +Ref: library/pyexpat xml parsers expat xmlparser CurrentByteIndex11752524 +Ref: 38fc11752524 +Ref: library/pyexpat xml parsers expat xmlparser CurrentColumnNumber11752613 +Ref: 38fd11752613 +Ref: library/pyexpat xml parsers expat xmlparser CurrentLineNumber11752708 +Ref: 38fe11752708 +Ref: library/pyexpat xml parsers expat xmlparser XmlDeclHandler11753121 +Ref: 38ff11753121 +Ref: library/pyexpat xml parsers expat xmlparser StartDoctypeDeclHandler11753734 +Ref: 38f311753734 +Ref: library/pyexpat xml parsers expat xmlparser EndDoctypeDeclHandler11754287 +Ref: 38f411754287 +Ref: library/pyexpat xml parsers expat xmlparser ElementDeclHandler11754453 +Ref: 390011754453 +Ref: library/pyexpat xml parsers expat xmlparser AttlistDeclHandler11754667 +Ref: 390111754667 +Ref: library/pyexpat xml parsers expat xmlparser StartElementHandler11755570 +Ref: 390211755570 +Ref: library/pyexpat xml parsers expat xmlparser EndElementHandler11755967 +Ref: 390311755967 +Ref: library/pyexpat xml parsers expat xmlparser ProcessingInstructionHandler11756058 +Ref: 390411756058 +Ref: library/pyexpat xml parsers expat xmlparser CharacterDataHandler11756172 +Ref: 38f611756172 +Ref: library/pyexpat xml parsers expat xmlparser UnparsedEntityDeclHandler11756837 +Ref: 38eb11756837 +Ref: library/pyexpat xml parsers expat xmlparser EntityDeclHandler11757230 +Ref: 390711757230 +Ref: library/pyexpat xml parsers expat xmlparser NotationDeclHandler11757975 +Ref: 38ea11757975 +Ref: library/pyexpat xml parsers expat xmlparser StartNamespaceDeclHandler11758266 +Ref: 390811758266 +Ref: library/pyexpat xml parsers expat xmlparser EndNamespaceDeclHandler11758544 +Ref: 390911758544 +Ref: library/pyexpat xml parsers expat xmlparser CommentHandler11759067 +Ref: 390a11759067 +Ref: library/pyexpat xml parsers expat xmlparser StartCdataSectionHandler11759253 +Ref: 390511759253 +Ref: library/pyexpat xml parsers expat xmlparser EndCdataSectionHandler11759490 +Ref: 390611759490 +Ref: library/pyexpat xml parsers expat xmlparser DefaultHandler11759583 +Ref: 390b11759583 +Ref: library/pyexpat xml parsers expat xmlparser DefaultHandlerExpand11759868 +Ref: 390c11759868 +Ref: library/pyexpat xml parsers expat xmlparser NotStandaloneHandler11760108 +Ref: 390d11760108 +Ref: library/pyexpat xml parsers expat xmlparser ExternalEntityRefHandler11760630 +Ref: 38e911760630 +Node: ExpatError Exceptions11761686 +Ref: library/pyexpat expaterror-exceptions11761843 +Ref: 390e11761843 +Ref: library/pyexpat expaterror-objects11761843 +Ref: 38df11761843 +Ref: library/pyexpat xml parsers expat ExpatError code11761985 +Ref: 390f11761985 +Ref: library/pyexpat xml parsers expat ExpatError lineno11762634 +Ref: 391211762634 +Ref: library/pyexpat xml parsers expat ExpatError offset11762761 +Ref: 391311762761 +Node: Example<10>11762902 +Ref: library/pyexpat example11763065 +Ref: 391411763065 +Ref: library/pyexpat expat-example11763065 +Ref: 391511763065 +Node: Content Model Descriptions11764163 +Ref: library/pyexpat content-model-descriptions11764326 +Ref: 391611764326 +Ref: library/pyexpat expat-content-models11764326 +Ref: 391711764326 +Ref: library/pyexpat module-xml parsers expat model11764326 +Ref: 12811764326 +Node: Expat error constants11766169 +Ref: library/pyexpat expat-error-constants11766312 +Ref: 391811766312 +Ref: library/pyexpat expat-errors11766312 +Ref: 391911766312 +Ref: library/pyexpat module-xml parsers expat errors11766312 +Ref: 12711766312 +Ref: library/pyexpat xml parsers expat errors codes11766902 +Ref: 391111766902 +Ref: library/pyexpat xml parsers expat errors messages11767041 +Ref: 391011767041 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_ASYNC_ENTITY11767196 +Ref: 391a11767196 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF11767255 +Ref: 391b11767255 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_BAD_CHAR_REF11767456 +Ref: 391c11767456 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_BINARY_ENTITY_REF11767651 +Ref: 391d11767651 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_DUPLICATE_ATTRIBUTE11767825 +Ref: 391e11767825 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCORRECT_ENCODING11767950 +Ref: 391f11767950 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_TOKEN11768015 +Ref: 392011768015 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_JUNK_AFTER_DOC_ELEMENT11768229 +Ref: 392111768229 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_MISPLACED_XML_PI11768378 +Ref: 392211768378 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_ELEMENTS11768531 +Ref: 392311768531 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_MEMORY11768706 +Ref: 392411768706 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARAM_ENTITY_REF11768818 +Ref: 392511768818 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_PARTIAL_CHAR11768952 +Ref: 392611768952 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_RECURSIVE_ENTITY_REF11769065 +Ref: 392711769065 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_SYNTAX11769267 +Ref: 392811769267 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_TAG_MISMATCH11769373 +Ref: 392911769373 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_TOKEN11769493 +Ref: 392a11769493 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDEFINED_ENTITY11769677 +Ref: 392b11769677 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNKNOWN_ENCODING11769803 +Ref: 392c11769803 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNCLOSED_CDATA_SECTION11769921 +Ref: 392d11769921 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_EXTERNAL_ENTITY_HANDLING11770035 +Ref: 392e11770035 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_STANDALONE11770106 +Ref: 392f11770106 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNEXPECTED_STATE11770369 +Ref: 393011770369 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_ENTITY_DECLARED_IN_PE11770432 +Ref: 393111770432 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_FEATURE_REQUIRES_XML_DTD11770500 +Ref: 393211770500 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING11770806 +Ref: 393311770806 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNBOUND_PREFIX11771079 +Ref: 393411771079 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_UNDECLARING_PREFIX11771221 +Ref: 393511771221 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_INCOMPLETE_PE11771382 +Ref: 393611771382 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_XML_DECL11771496 +Ref: 393711771496 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_TEXT_DECL11771608 +Ref: 393811771608 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_PUBLICID11771744 +Ref: 393911771744 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPENDED11771866 +Ref: 393a11771866 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_NOT_SUSPENDED11772090 +Ref: 393b11772090 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_ABORTED11772242 +Ref: 393c11772242 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_FINISHED11772354 +Ref: 393d11772354 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_SUSPEND_PE11772600 +Ref: 393e11772600 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XML11772657 +Ref: 393f11772657 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_PREFIX_XMLNS11772843 +Ref: 394011772843 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_RESERVED_NAMESPACE_URI11773005 +Ref: 394111773005 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_INVALID_ARGUMENT11773215 +Ref: 394211773215 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_NO_BUFFER11773336 +Ref: 394311773336 +Ref: library/pyexpat xml parsers expat errors XML_ERROR_AMPLIFICATION_LIMIT_BREACH11773450 +Ref: 394411773450 +Node: Internet Protocols and Support11773617 +Ref: library/internet doc11773782 +Ref: 394511773782 +Ref: library/internet internet11773782 +Ref: 394611773782 +Ref: library/internet internet-protocols-and-support11773782 +Ref: 394711773782 +Node: webbrowser — Convenient web-browser controller11775725 +Ref: library/webbrowser doc11775904 +Ref: 394811775904 +Ref: library/webbrowser module-webbrowser11775904 +Ref: 11511775904 +Ref: library/webbrowser webbrowser-convenient-web-browser-controller11775904 +Ref: 394911775904 +Ref: library/webbrowser cmdoption-webbrowser-n11778047 +Ref: 394b11778047 +Ref: library/webbrowser cmdoption-webbrowser-new-window11778047 +Ref: 394c11778047 +Ref: library/webbrowser cmdoption-webbrowser-t11778135 +Ref: 394d11778135 +Ref: library/webbrowser cmdoption-webbrowser-new-tab11778135 +Ref: 394e11778135 +Ref: library/webbrowser webbrowser Error11778412 +Ref: 394f11778412 +Ref: library/webbrowser webbrowser open11778543 +Ref: 394a11778543 +Ref: library/webbrowser webbrowser open_new11779444 +Ref: 395011779444 +Ref: library/webbrowser webbrowser open_new_tab11779703 +Ref: 395111779703 +Ref: library/webbrowser webbrowser get11779974 +Ref: 395211779974 +Ref: library/webbrowser webbrowser register11780202 +Ref: 395311780202 +Ref: webbrowser — Convenient web-browser controller-Footnote-111786627 +Ref: webbrowser — Convenient web-browser controller-Footnote-211786697 +Node: Browser Controller Objects11786830 +Ref: library/webbrowser browser-controller-objects11786941 +Ref: 395411786941 +Ref: library/webbrowser browser-controllers11786941 +Ref: 395511786941 +Ref: library/webbrowser webbrowser controller name11787158 +Ref: 29911787158 +Ref: library/webbrowser webbrowser controller open11787235 +Ref: 395611787235 +Ref: library/webbrowser webbrowser controller open_new11787499 +Ref: 395711787499 +Ref: library/webbrowser webbrowser controller open_new_tab11787718 +Ref: 395811787718 +Node: wsgiref — WSGI Utilities and Reference Implementation11787918 +Ref: library/wsgiref doc11788137 +Ref: 395911788137 +Ref: library/wsgiref module-wsgiref11788137 +Ref: 11811788137 +Ref: library/wsgiref wsgiref-wsgi-utilities-and-reference-implementation11788137 +Ref: 395a11788137 +Ref: wsgiref — WSGI Utilities and Reference Implementation-Footnote-111790157 +Ref: wsgiref — WSGI Utilities and Reference Implementation-Footnote-211790221 +Ref: wsgiref — WSGI Utilities and Reference Implementation-Footnote-311790263 +Node: wsgiref util – WSGI environment utilities11790300 +Ref: library/wsgiref module-wsgiref util11790490 +Ref: 11d11790490 +Ref: library/wsgiref wsgiref-util-wsgi-environment-utilities11790490 +Ref: 395b11790490 +Ref: library/wsgiref wsgiref util guess_scheme11791034 +Ref: 395d11791034 +Ref: library/wsgiref wsgiref util request_uri11791686 +Ref: 395e11791686 +Ref: library/wsgiref wsgiref util application_uri11792012 +Ref: 395f11792012 +Ref: library/wsgiref wsgiref util shift_path_info11792278 +Ref: 396011792278 +Ref: library/wsgiref wsgiref util setup_testing_defaults11793946 +Ref: 396111793946 +Ref: library/wsgiref wsgiref util is_hop_by_hop11795690 +Ref: 16c411795690 +Ref: library/wsgiref wsgiref util FileWrapper11795863 +Ref: 73111795863 +Ref: wsgiref util – WSGI environment utilities-Footnote-111797106 +Ref: wsgiref util – WSGI environment utilities-Footnote-211797148 +Ref: wsgiref util – WSGI environment utilities-Footnote-311797190 +Ref: wsgiref util – WSGI environment utilities-Footnote-411797232 +Ref: wsgiref util – WSGI environment utilities-Footnote-511797274 +Node: wsgiref headers – WSGI response header tools11797333 +Ref: library/wsgiref module-wsgiref headers11797583 +Ref: 11a11797583 +Ref: library/wsgiref wsgiref-headers-wsgi-response-header-tools11797583 +Ref: 396411797583 +Ref: library/wsgiref wsgiref headers Headers11797845 +Ref: e9111797845 +Ref: library/wsgiref wsgiref headers Headers get_all11800125 +Ref: 396511800125 +Ref: library/wsgiref wsgiref headers Headers add_header11800562 +Ref: 396611800562 +Ref: wsgiref headers – WSGI response header tools-Footnote-111801699 +Node: wsgiref simple_server – a simple WSGI HTTP server11801741 +Ref: library/wsgiref module-wsgiref simple_server11801993 +Ref: 11b11801993 +Ref: library/wsgiref wsgiref-simple-server-a-simple-wsgi-http-server11801993 +Ref: 396711801993 +Ref: library/wsgiref wsgiref simple_server make_server11802587 +Ref: 396811802587 +Ref: library/wsgiref wsgiref simple_server demo_app11803427 +Ref: 396211803427 +Ref: library/wsgiref wsgiref simple_server WSGIServer11803963 +Ref: 396a11803963 +Ref: library/wsgiref wsgiref simple_server WSGIServer set_app11804717 +Ref: 396c11804717 +Ref: library/wsgiref wsgiref simple_server WSGIServer get_app11804862 +Ref: 396d11804862 +Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler11805205 +Ref: 396e11805205 +Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_environ11805821 +Ref: 396f11805821 +Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler get_stderr11806323 +Ref: 397011806323 +Ref: library/wsgiref wsgiref simple_server WSGIRequestHandler handle11806506 +Ref: 397111806506 +Ref: wsgiref simple_server – a simple WSGI HTTP server-Footnote-111806777 +Ref: wsgiref simple_server – a simple WSGI HTTP server-Footnote-211806819 +Node: wsgiref validate — WSGI conformance checker11806861 +Ref: library/wsgiref module-wsgiref validate11807115 +Ref: 11e11807115 +Ref: library/wsgiref wsgiref-validate-wsgi-conformance-checker11807115 +Ref: 397211807115 +Ref: library/wsgiref wsgiref validate validator11808022 +Ref: 397311808022 +Ref: wsgiref validate — WSGI conformance checker-Footnote-111810235 +Ref: wsgiref validate — WSGI conformance checker-Footnote-211810277 +Ref: wsgiref validate — WSGI conformance checker-Footnote-311810336 +Node: wsgiref handlers – server/gateway base classes11810378 +Ref: library/wsgiref module-wsgiref handlers11810634 +Ref: 11911810634 +Ref: library/wsgiref wsgiref-handlers-server-gateway-base-classes11810634 +Ref: 397411810634 +Ref: library/wsgiref wsgiref handlers CGIHandler11811025 +Ref: 397511811025 +Ref: library/wsgiref wsgiref handlers IISCGIHandler11811674 +Ref: 397711811674 +Ref: library/wsgiref wsgiref handlers BaseCGIHandler11813051 +Ref: 397611813051 +Ref: library/wsgiref wsgiref handlers SimpleHandler11813918 +Ref: 397811813918 +Ref: library/wsgiref wsgiref handlers BaseHandler11814867 +Ref: 19ef11814867 +Ref: library/wsgiref wsgiref handlers BaseHandler run11815226 +Ref: 397e11815226 +Ref: library/wsgiref wsgiref handlers BaseHandler _write11815565 +Ref: 397c11815565 +Ref: library/wsgiref wsgiref handlers BaseHandler _flush11815911 +Ref: 397d11815911 +Ref: library/wsgiref wsgiref handlers BaseHandler get_stdin11816120 +Ref: 397911816120 +Ref: library/wsgiref wsgiref handlers BaseHandler get_stderr11816323 +Ref: 397a11816323 +Ref: library/wsgiref wsgiref handlers BaseHandler add_cgi_vars11816528 +Ref: 397b11816528 +Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multithread11817080 +Ref: 398111817080 +Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_multiprocess11817371 +Ref: 398211817371 +Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_run_once11817664 +Ref: 398311817664 +Ref: library/wsgiref wsgiref handlers BaseHandler os_environ11817907 +Ref: 398411817907 +Ref: library/wsgiref wsgiref handlers BaseHandler server_software11818413 +Ref: 398511818413 +Ref: library/wsgiref wsgiref handlers BaseHandler get_scheme11819009 +Ref: 398711819009 +Ref: library/wsgiref wsgiref handlers BaseHandler setup_environ11819370 +Ref: 398811819370 +Ref: library/wsgiref wsgiref handlers BaseHandler log_exception11820030 +Ref: 398a11820030 +Ref: library/wsgiref wsgiref handlers BaseHandler traceback_limit11820530 +Ref: 398b11820530 +Ref: library/wsgiref wsgiref handlers BaseHandler error_output11820752 +Ref: 398c11820752 +Ref: library/wsgiref wsgiref handlers BaseHandler error_status11821934 +Ref: 398d11821934 +Ref: library/wsgiref wsgiref handlers BaseHandler error_headers11822139 +Ref: 398e11822139 +Ref: library/wsgiref wsgiref handlers BaseHandler error_body11822431 +Ref: 398f11822431 +Ref: library/wsgiref wsgiref handlers BaseHandler wsgi_file_wrapper11822777 +Ref: 398911822777 +Ref: library/wsgiref wsgiref handlers BaseHandler sendfile11823050 +Ref: 399011823050 +Ref: library/wsgiref wsgiref handlers BaseHandler origin_server11823626 +Ref: 398611823626 +Ref: library/wsgiref wsgiref handlers BaseHandler http_version11824153 +Ref: 399111824153 +Ref: library/wsgiref wsgiref handlers read_environ11824375 +Ref: 11ab11824375 +Ref: wsgiref handlers – server/gateway base classes-Footnote-111825291 +Ref: wsgiref handlers – server/gateway base classes-Footnote-211825333 +Ref: wsgiref handlers – server/gateway base classes-Footnote-311825375 +Ref: wsgiref handlers – server/gateway base classes-Footnote-411825417 +Ref: wsgiref handlers – server/gateway base classes-Footnote-511825459 +Node: wsgiref types – WSGI types for static type checking11825501 +Ref: library/wsgiref module-wsgiref types11825724 +Ref: 11c11825724 +Ref: library/wsgiref wsgiref-types-wsgi-types-for-static-type-checking11825724 +Ref: 399211825724 +Ref: library/wsgiref wsgiref types StartResponse11825971 +Ref: 396911825971 +Ref: library/wsgiref wsgiref types WSGIEnvironment11826109 +Ref: 395c11826109 +Ref: library/wsgiref wsgiref types WSGIApplication11826211 +Ref: 399311826211 +Ref: library/wsgiref wsgiref types InputStream11826311 +Ref: 397f11826311 +Ref: library/wsgiref wsgiref types ErrorStream11826420 +Ref: 398011826420 +Ref: library/wsgiref wsgiref types FileWrapper11826529 +Ref: 396311826529 +Ref: wsgiref types – WSGI types for static type checking-Footnote-111826769 +Ref: wsgiref types – WSGI types for static type checking-Footnote-211826811 +Ref: wsgiref types – WSGI types for static type checking-Footnote-311826881 +Ref: wsgiref types – WSGI types for static type checking-Footnote-411826923 +Ref: wsgiref types – WSGI types for static type checking-Footnote-511826989 +Ref: wsgiref types – WSGI types for static type checking-Footnote-611827055 +Node: Examples<25>11827139 +Ref: library/wsgiref examples11827305 +Ref: 399411827305 +Node: urllib — URL handling modules11830137 +Ref: library/urllib doc11830362 +Ref: 399511830362 +Ref: library/urllib module-urllib11830362 +Ref: 10811830362 +Ref: library/urllib urllib-url-handling-modules11830362 +Ref: 399611830362 +Ref: urllib — URL handling modules-Footnote-111830943 +Node: urllib request — Extensible library for opening URLs11831007 +Ref: library/urllib request doc11831228 +Ref: 399711831228 +Ref: library/urllib request module-urllib request11831228 +Ref: 10b11831228 +Ref: library/urllib request urllib-request-extensible-library-for-opening-urls11831228 +Ref: 399811831228 +Ref: library/urllib request urllib request urlopen11832333 +Ref: 29511832333 +Ref: library/urllib request urllib request install_opener11835944 +Ref: 399f11835944 +Ref: library/urllib request urllib request build_opener11836397 +Ref: 39a011836397 +Ref: library/urllib request urllib request pathname2url11837516 +Ref: 159511837516 +Ref: library/urllib request urllib request url2pathname11838019 +Ref: 159611838019 +Ref: library/urllib request urllib request getproxies11838529 +Ref: 399911838529 +Ref: library/urllib request urllib request Request11839672 +Ref: fd311839672 +Ref: library/urllib request urllib request OpenerDirector11844174 +Ref: 399d11844174 +Ref: library/urllib request urllib request BaseHandler11844393 +Ref: 39a111844393 +Ref: library/urllib request urllib request HTTPDefaultErrorHandler11844553 +Ref: 39a311844553 +Ref: library/urllib request urllib request HTTPRedirectHandler11844745 +Ref: 39a411844745 +Ref: library/urllib request urllib request HTTPCookieProcessor11844830 +Ref: 39a911844830 +Ref: library/urllib request urllib request ProxyHandler11844932 +Ref: 19cf11844932 +Ref: library/urllib request urllib request HTTPPasswordMgr11846021 +Ref: 39aa11846021 +Ref: library/urllib request urllib request HTTPPasswordMgrWithDefaultRealm11846138 +Ref: 39ab11846138 +Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth11846379 +Ref: e8d11846379 +Ref: library/urllib request urllib request AbstractBasicAuthHandler11846767 +Ref: 18bb11846767 +Ref: library/urllib request urllib request HTTPBasicAuthHandler11848111 +Ref: 39ae11848111 +Ref: library/urllib request urllib request ProxyBasicAuthHandler11848575 +Ref: 39af11848575 +Ref: library/urllib request urllib request AbstractDigestAuthHandler11848915 +Ref: 198111848915 +Ref: library/urllib request urllib request HTTPDigestAuthHandler11849325 +Ref: 39b011849325 +Ref: library/urllib request urllib request ProxyDigestAuthHandler11850187 +Ref: 39b111850187 +Ref: library/urllib request urllib request HTTPHandler11850528 +Ref: 39a211850528 +Ref: library/urllib request urllib request HTTPSHandler11850613 +Ref: 121611850613 +Ref: library/urllib request urllib request FileHandler11850943 +Ref: 39a611850943 +Ref: library/urllib request urllib request DataHandler11851006 +Ref: fd211851006 +Ref: library/urllib request urllib request FTPHandler11851095 +Ref: 39a511851095 +Ref: library/urllib request urllib request CacheFTPHandler11851154 +Ref: 172811851154 +Ref: library/urllib request urllib request UnknownHandler11851283 +Ref: 399e11851283 +Ref: library/urllib request urllib request HTTPErrorProcessor11851373 +Ref: 39a711851373 +Ref: urllib request — Extensible library for opening URLs-Footnote-111852254 +Ref: urllib request — Extensible library for opening URLs-Footnote-211852328 +Ref: urllib request — Extensible library for opening URLs-Footnote-311852379 +Ref: urllib request — Extensible library for opening URLs-Footnote-411852438 +Ref: urllib request — Extensible library for opening URLs-Footnote-511852497 +Node: Request Objects11852556 +Ref: library/urllib request id111852693 +Ref: 39b211852693 +Ref: library/urllib request request-objects11852693 +Ref: 39b311852693 +Ref: library/urllib request urllib request Request full_url11852964 +Ref: fd511852964 +Ref: library/urllib request urllib request Request type11853259 +Ref: 39b411853259 +Ref: library/urllib request urllib request Request host11853310 +Ref: 39b511853310 +Ref: library/urllib request urllib request Request origin_req_host11853437 +Ref: 39b611853437 +Ref: library/urllib request urllib request Request selector11853532 +Ref: 39b711853532 +Ref: library/urllib request urllib request Request data11853696 +Ref: fd611853696 +Ref: library/urllib request urllib request Request unverifiable11853959 +Ref: 39b811853959 +Ref: library/urllib request urllib request Request method11854089 +Ref: fd411854089 +Ref: library/urllib request urllib request Request get_method11854799 +Ref: 115d11854799 +Ref: library/urllib request urllib request Request add_header11855221 +Ref: 39a811855221 +Ref: library/urllib request urllib request Request add_unredirected_header11855901 +Ref: 39b911855901 +Ref: library/urllib request urllib request Request has_header11856027 +Ref: 39ba11856027 +Ref: library/urllib request urllib request Request remove_header11856168 +Ref: fd811856168 +Ref: library/urllib request urllib request Request get_full_url11856343 +Ref: 39bb11856343 +Ref: library/urllib request urllib request Request set_proxy11856500 +Ref: 39bc11856500 +Ref: library/urllib request urllib request Request get_header11856753 +Ref: 39bd11856753 +Ref: library/urllib request urllib request Request header_items11856919 +Ref: 39be11856919 +Ref: Request Objects-Footnote-111857278 +Node: OpenerDirector Objects11857337 +Ref: library/urllib request opener-director-objects11857502 +Ref: 39bf11857502 +Ref: library/urllib request openerdirector-objects11857502 +Ref: 39c011857502 +Ref: library/urllib request urllib request OpenerDirector add_handler11857634 +Ref: 39c111857634 +Ref: library/urllib request urllib request OpenerDirector open11859192 +Ref: fd711859192 +Ref: library/urllib request urllib request OpenerDirector error11859875 +Ref: 39c611859875 +Node: BaseHandler Objects11861669 +Ref: library/urllib request base-handler-objects11861846 +Ref: 39c911861846 +Ref: library/urllib request basehandler-objects11861846 +Ref: 39ca11861846 +Ref: library/urllib request urllib request BaseHandler add_parent11862086 +Ref: 39cb11862086 +Ref: library/urllib request urllib request BaseHandler close11862165 +Ref: 39cc11862165 +Ref: library/urllib request urllib request BaseHandler parent11862541 +Ref: 39cd11862541 +Ref: library/urllib request urllib request BaseHandler default_open11862695 +Ref: 39c711862695 +Ref: library/urllib request protocol-open11863389 +Ref: 39c211863389 +Ref: library/urllib request urllib request BaseHandler unknown_open11863760 +Ref: 39c811863760 +Ref: library/urllib request urllib request BaseHandler http_error_default11864172 +Ref: 39ce11864172 +Ref: library/urllib request http-error-nnn11865057 +Ref: 39c311865057 +Ref: library/urllib request protocol-request11865561 +Ref: 39c411865561 +Ref: library/urllib request protocol-response11865975 +Ref: 39c511865975 +Node: HTTPRedirectHandler Objects11866565 +Ref: library/urllib request http-redirect-handler11866747 +Ref: 39cf11866747 +Ref: library/urllib request httpredirecthandler-objects11866747 +Ref: 39d011866747 +Ref: library/urllib request urllib request HTTPRedirectHandler redirect_request11867250 +Ref: 39d111867250 +Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30111868334 +Ref: 39d211868334 +Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30211868605 +Ref: 39d311868605 +Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30311868784 +Ref: 39d411868784 +Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30711868967 +Ref: 39d511868967 +Ref: library/urllib request urllib request HTTPRedirectHandler http_error_30811869241 +Ref: 39d611869241 +Ref: HTTPRedirectHandler Objects-Footnote-111869580 +Ref: HTTPRedirectHandler Objects-Footnote-211869639 +Node: HTTPCookieProcessor Objects11869698 +Ref: library/urllib request http-cookie-processor11869881 +Ref: 39d711869881 +Ref: library/urllib request httpcookieprocessor-objects11869881 +Ref: 39d811869881 +Ref: library/urllib request urllib request HTTPCookieProcessor cookiejar11870020 +Ref: 39d911870020 +Node: ProxyHandler Objects11870148 +Ref: library/urllib request proxy-handler11870327 +Ref: 39db11870327 +Ref: library/urllib request proxyhandler-objects11870327 +Ref: 39dc11870327 +Node: HTTPPasswordMgr Objects11870805 +Ref: library/urllib request http-password-mgr11870993 +Ref: 39ac11870993 +Ref: library/urllib request httppasswordmgr-objects11870993 +Ref: 39dd11870993 +Ref: library/urllib request urllib request HTTPPasswordMgr add_password11871179 +Ref: 39de11871179 +Ref: library/urllib request urllib request HTTPPasswordMgr find_user_password11871526 +Ref: 183f11871526 +Node: HTTPPasswordMgrWithPriorAuth Objects11871900 +Ref: library/urllib request http-password-mgr-with-prior-auth11872100 +Ref: 39ad11872100 +Ref: library/urllib request httppasswordmgrwithpriorauth-objects11872100 +Ref: 39df11872100 +Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth add_password11872354 +Ref: 39e011872354 +Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth find_user_password11872768 +Ref: 39e111872768 +Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth update_authenticated11872927 +Ref: 39e211872927 +Ref: library/urllib request urllib request HTTPPasswordMgrWithPriorAuth is_authenticated11873123 +Ref: 184011873123 +Node: AbstractBasicAuthHandler Objects11873299 +Ref: library/urllib request abstract-basic-auth-handler11873504 +Ref: 39e311873504 +Ref: library/urllib request abstractbasicauthhandler-objects11873504 +Ref: 39e411873504 +Ref: library/urllib request urllib request AbstractBasicAuthHandler http_error_auth_reqed11873589 +Ref: 39e511873589 +Node: HTTPBasicAuthHandler Objects11874409 +Ref: library/urllib request http-basic-auth-handler11874607 +Ref: 39e611874607 +Ref: library/urllib request httpbasicauthhandler-objects11874607 +Ref: 39e711874607 +Ref: library/urllib request urllib request HTTPBasicAuthHandler http_error_40111874686 +Ref: 39e811874686 +Node: ProxyBasicAuthHandler Objects11874843 +Ref: library/urllib request proxy-basic-auth-handler11875042 +Ref: 39e911875042 +Ref: library/urllib request proxybasicauthhandler-objects11875042 +Ref: 39ea11875042 +Ref: library/urllib request urllib request ProxyBasicAuthHandler http_error_40711875123 +Ref: 39eb11875123 +Node: AbstractDigestAuthHandler Objects11875281 +Ref: library/urllib request abstract-digest-auth-handler11875481 +Ref: 39ec11875481 +Ref: library/urllib request abstractdigestauthhandler-objects11875481 +Ref: 39ed11875481 +Ref: library/urllib request urllib request AbstractDigestAuthHandler http_error_auth_reqed11875570 +Ref: 39ee11875570 +Node: HTTPDigestAuthHandler Objects11875947 +Ref: library/urllib request http-digest-auth-handler11876148 +Ref: 39ef11876148 +Ref: library/urllib request httpdigestauthhandler-objects11876148 +Ref: 39f011876148 +Ref: library/urllib request urllib request HTTPDigestAuthHandler http_error_40111876229 +Ref: 39f111876229 +Node: ProxyDigestAuthHandler Objects11876387 +Ref: library/urllib request proxy-digest-auth-handler11876574 +Ref: 39f211876574 +Ref: library/urllib request proxydigestauthhandler-objects11876574 +Ref: 39f311876574 +Ref: library/urllib request urllib request ProxyDigestAuthHandler http_error_40711876657 +Ref: 39f411876657 +Node: HTTPHandler Objects11876816 +Ref: library/urllib request http-handler-objects11876994 +Ref: 39f511876994 +Ref: library/urllib request httphandler-objects11876994 +Ref: 39f611876994 +Ref: library/urllib request urllib request HTTPHandler http_open11877055 +Ref: 39f711877055 +Node: HTTPSHandler Objects11877191 +Ref: library/urllib request https-handler-objects11877358 +Ref: 39f811877358 +Ref: library/urllib request httpshandler-objects11877358 +Ref: 39f911877358 +Ref: library/urllib request urllib request HTTPSHandler https_open11877421 +Ref: 39fa11877421 +Node: FileHandler Objects11877560 +Ref: library/urllib request file-handler-objects11877727 +Ref: 39fb11877727 +Ref: library/urllib request filehandler-objects11877727 +Ref: 39fc11877727 +Ref: library/urllib request urllib request FileHandler file_open11877788 +Ref: 39fd11877788 +Node: DataHandler Objects11878089 +Ref: library/urllib request data-handler-objects11878254 +Ref: 39fe11878254 +Ref: library/urllib request datahandler-objects11878254 +Ref: 39ff11878254 +Ref: library/urllib request urllib request DataHandler data_open11878315 +Ref: 3a0011878315 +Ref: DataHandler Objects-Footnote-111878873 +Node: FTPHandler Objects11878932 +Ref: library/urllib request ftp-handler-objects11879101 +Ref: 3a0111879101 +Ref: library/urllib request ftphandler-objects11879101 +Ref: 3a0211879101 +Ref: library/urllib request urllib request FTPHandler ftp_open11879160 +Ref: 3a0311879160 +Node: CacheFTPHandler Objects11879308 +Ref: library/urllib request cacheftp-handler-objects11879480 +Ref: 3a0411879480 +Ref: library/urllib request cacheftphandler-objects11879480 +Ref: 3a0511879480 +Ref: library/urllib request urllib request CacheFTPHandler setTimeout11879662 +Ref: 3a0611879662 +Ref: library/urllib request urllib request CacheFTPHandler setMaxConns11879755 +Ref: 3a0711879755 +Node: UnknownHandler Objects11879855 +Ref: library/urllib request unknown-handler-objects11880035 +Ref: 3a0811880035 +Ref: library/urllib request unknownhandler-objects11880035 +Ref: 3a0911880035 +Ref: library/urllib request urllib request UnknownHandler unknown_open11880102 +Ref: 3a0a11880102 +Node: HTTPErrorProcessor Objects11880193 +Ref: library/urllib request http-error-processor-objects11880362 +Ref: 3a0b11880362 +Ref: library/urllib request httperrorprocessor-objects11880362 +Ref: 3a0c11880362 +Ref: library/urllib request urllib request HTTPErrorProcessor http_response11880437 +Ref: 3a0d11880437 +Ref: library/urllib request urllib request HTTPErrorProcessor https_response11880907 +Ref: 3a0e11880907 +Node: Examples<26>11881070 +Ref: library/urllib request examples11881233 +Ref: 3a0f11881233 +Ref: library/urllib request urllib-request-examples11881233 +Ref: 3a1011881233 +Ref: library/urllib request urllib-examples11887119 +Ref: 3a1211887119 +Node: Legacy interface11888611 +Ref: library/urllib request legacy-interface11888775 +Ref: 3a1311888775 +Ref: library/urllib request urllib request urlretrieve11889006 +Ref: 3a1411889006 +Ref: library/urllib request urllib request urlcleanup11891675 +Ref: 19d611891675 +Ref: library/urllib request urllib request URLopener11891835 +Ref: 30811891835 +Ref: library/urllib request urllib request URLopener open11893334 +Ref: 3a1711893334 +Ref: library/urllib request urllib request URLopener open_unknown11893837 +Ref: 3a1811893837 +Ref: library/urllib request urllib request URLopener retrieve11893949 +Ref: 19ed11893949 +Ref: library/urllib request urllib request URLopener version11895498 +Ref: 3a1611895498 +Ref: library/urllib request urllib request FancyURLopener11895819 +Ref: 30911895819 +Ref: library/urllib request urllib request FancyURLopener prompt_user_passwd11897558 +Ref: 3a1911897558 +Ref: Legacy interface-Footnote-111898098 +Node: urllib request Restrictions11898157 +Ref: library/urllib request urllib-request-restrictions11898300 +Ref: 3a1a11898300 +Node: urllib response — Response classes used by urllib11900867 +Ref: library/urllib request module-urllib response11901100 +Ref: 10c11901100 +Ref: library/urllib request urllib-response-response-classes-used-by-urllib11901100 +Ref: 3a1b11901100 +Ref: library/urllib request urllib response addinfourl11901564 +Ref: 399a11901564 +Ref: library/urllib request urllib response addinfourl url11901603 +Ref: 3a1c11901603 +Ref: library/urllib request urllib response addinfourl headers11901735 +Ref: 3a1d11901735 +Ref: library/urllib request urllib response addinfourl status11901874 +Ref: 3a1e11901874 +Ref: library/urllib request urllib response addinfourl geturl11901978 +Ref: 3a1f11901978 +Ref: library/urllib request urllib response addinfourl info11902097 +Ref: 3a2011902097 +Ref: library/urllib request urllib response addinfourl code11902218 +Ref: 3a2111902218 +Ref: library/urllib request urllib response addinfourl getcode11902338 +Ref: 3a2211902338 +Node: urllib parse — Parse URLs into components11902461 +Ref: library/urllib parse doc11902699 +Ref: 3a2311902699 +Ref: library/urllib parse module-urllib parse11902699 +Ref: 10a11902699 +Ref: library/urllib parse urllib-parse-parse-urls-into-components11902699 +Ref: 3a2411902699 +Ref: urllib parse — Parse URLs into components-Footnote-111904708 +Ref: urllib parse — Parse URLs into components-Footnote-211904780 +Ref: urllib parse — Parse URLs into components-Footnote-311904839 +Node: URL Parsing11904898 +Ref: library/urllib parse url-parsing11905018 +Ref: 3a2511905018 +Ref: library/urllib parse urllib parse urlparse11905191 +Ref: 30711905191 +Ref: library/urllib parse urllib parse parse_qs11913110 +Ref: 27c11913110 +Ref: library/urllib parse urllib parse parse_qsl11915291 +Ref: 27b11915291 +Ref: library/urllib parse urllib parse urlunparse11917322 +Ref: 15d811917322 +Ref: library/urllib parse urllib parse urlsplit11917724 +Ref: d3f11917724 +Ref: library/urllib parse urllib parse urlunsplit11922332 +Ref: 15d711922332 +Ref: library/urllib parse urllib parse urljoin11922776 +Ref: e8f11922776 +Ref: library/urllib parse urllib parse urldefrag11924513 +Ref: 123b11924513 +Ref: library/urllib parse urllib parse unwrap11925858 +Ref: 3a2811925858 +Ref: URL Parsing-Footnote-111926206 +Ref: URL Parsing-Footnote-211926265 +Ref: URL Parsing-Footnote-311926324 +Ref: URL Parsing-Footnote-411926383 +Ref: URL Parsing-Footnote-511926445 +Node: URL parsing security11926504 +Ref: library/urllib parse id111926660 +Ref: 3a2911926660 +Ref: library/urllib parse url-parsing-security11926660 +Ref: 3a2711926660 +Ref: URL parsing security-Footnote-111928118 +Ref: URL parsing security-Footnote-211928180 +Node: Parsing ASCII Encoded Bytes11928239 +Ref: library/urllib parse id211928408 +Ref: 3a2a11928408 +Ref: library/urllib parse parsing-ascii-encoded-bytes11928408 +Ref: 123d11928408 +Node: Structured Parse Results11930534 +Ref: library/urllib parse structured-parse-results11930694 +Ref: 3a2b11930694 +Ref: library/urllib parse urlparse-result-object11930694 +Ref: 3a2611930694 +Ref: library/urllib parse urllib parse urllib parse SplitResult geturl11931111 +Ref: 3a2c11931111 +Ref: library/urllib parse urllib parse DefragResult11932235 +Ref: 3a2d11932235 +Ref: library/urllib parse urllib parse ParseResult11932496 +Ref: 3a2f11932496 +Ref: library/urllib parse urllib parse SplitResult11932767 +Ref: 3a3111932767 +Ref: library/urllib parse urllib parse DefragResultBytes11933172 +Ref: 3a2e11933172 +Ref: library/urllib parse urllib parse ParseResultBytes11933435 +Ref: 3a3011933435 +Ref: library/urllib parse urllib parse SplitResultBytes11933736 +Ref: 3a3211933736 +Node: URL Quoting11934029 +Ref: library/urllib parse url-quoting11934153 +Ref: 3a3311934153 +Ref: library/urllib parse urllib parse quote11934556 +Ref: ba311934556 +Ref: library/urllib parse urllib parse quote_plus11935931 +Ref: 123c11935931 +Ref: library/urllib parse urllib parse quote_from_bytes11936424 +Ref: 17c511936424 +Ref: library/urllib parse urllib parse unquote11936717 +Ref: 178511936717 +Ref: library/urllib parse urllib parse unquote_plus11937498 +Ref: 3a3411937498 +Ref: library/urllib parse urllib parse unquote_to_bytes11937838 +Ref: 178611937838 +Ref: library/urllib parse urllib parse urlencode11938271 +Ref: e8e11938271 +Ref: URL Quoting-Footnote-111942134 +Ref: URL Quoting-Footnote-211942193 +Ref: URL Quoting-Footnote-311942252 +Ref: URL Quoting-Footnote-411942289 +Ref: URL Quoting-Footnote-511942348 +Ref: URL Quoting-Footnote-611942407 +Ref: URL Quoting-Footnote-711942466 +Ref: URL Quoting-Footnote-811942525 +Ref: URL Quoting-Footnote-911942584 +Node: urllib error — Exception classes raised by urllib request11942643 +Ref: library/urllib error doc11942874 +Ref: 3a3511942874 +Ref: library/urllib error module-urllib error11942874 +Ref: 10911942874 +Ref: library/urllib error urllib-error-exception-classes-raised-by-urllib-request11942874 +Ref: 3a3611942874 +Ref: library/urllib error urllib error URLError11943373 +Ref: 399c11943373 +Ref: library/urllib error urllib error URLError reason11943551 +Ref: 3a3711943551 +Ref: library/urllib error urllib error HTTPError11943838 +Ref: fd911943838 +Ref: library/urllib error urllib error HTTPError url11944222 +Ref: 3a3811944222 +Ref: library/urllib error urllib error HTTPError code11944319 +Ref: 3a3911944319 +Ref: library/urllib error urllib error HTTPError reason11944579 +Ref: 3a3b11944579 +Ref: library/urllib error urllib error HTTPError headers11944721 +Ref: fda11944721 +Ref: library/urllib error urllib error HTTPError fp11944921 +Ref: 3a3c11944921 +Ref: library/urllib error urllib error ContentTooShortError11945019 +Ref: 3a1511945019 +Ref: library/urllib error urllib error ContentTooShortError content11945290 +Ref: 3a3d11945290 +Ref: urllib error — Exception classes raised by urllib request-Footnote-111945414 +Ref: urllib error — Exception classes raised by urllib request-Footnote-211945486 +Node: urllib robotparser — Parser for robots txt11945545 +Ref: library/urllib robotparser doc11945754 +Ref: 3a3e11945754 +Ref: library/urllib robotparser module-urllib robotparser11945754 +Ref: 10d11945754 +Ref: library/urllib robotparser urllib-robotparser-parser-for-robots-txt11945754 +Ref: 3a3f11945754 +Ref: library/urllib robotparser urllib robotparser RobotFileParser11946295 +Ref: cfd11946295 +Ref: library/urllib robotparser urllib robotparser RobotFileParser set_url11946468 +Ref: 3a4011946468 +Ref: library/urllib robotparser urllib robotparser RobotFileParser read11946562 +Ref: 3a4111946562 +Ref: library/urllib robotparser urllib robotparser RobotFileParser parse11946658 +Ref: 1aa111946658 +Ref: library/urllib robotparser urllib robotparser RobotFileParser can_fetch11946728 +Ref: 3a4211946728 +Ref: library/urllib robotparser urllib robotparser RobotFileParser mtime11946942 +Ref: 3a4311946942 +Ref: library/urllib robotparser urllib robotparser RobotFileParser modified11947170 +Ref: 3a4411947170 +Ref: library/urllib robotparser urllib robotparser RobotFileParser crawl_delay11947299 +Ref: 3a4511947299 +Ref: library/urllib robotparser urllib robotparser RobotFileParser request_rate11947703 +Ref: 3a4611947703 +Ref: library/urllib robotparser urllib robotparser RobotFileParser site_maps11948156 +Ref: 1a4011948156 +Ref: urllib robotparser — Parser for robots txt-Footnote-111949078 +Node: http — HTTP modules11949157 +Ref: library/http doc11949343 +Ref: 3a4711949343 +Ref: library/http http-http-modules11949343 +Ref: 3a4811949343 +Ref: library/http module-http11949343 +Ref: 6e11949343 +Ref: library/http http HTTPStatus11950121 +Ref: 8ff11950121 +Ref: http — HTTP modules-Footnote-111950884 +Node: HTTP status codes11950957 +Ref: library/http http-status-codes11951061 +Ref: 3a4911951061 +Ref: library/http id111951061 +Ref: 3a4a11951061 +Ref: HTTP status codes-Footnote-111965263 +Ref: HTTP status codes-Footnote-211965347 +Ref: HTTP status codes-Footnote-311965406 +Ref: HTTP status codes-Footnote-411965465 +Ref: HTTP status codes-Footnote-511965524 +Ref: HTTP status codes-Footnote-611965583 +Ref: HTTP status codes-Footnote-711965642 +Ref: HTTP status codes-Footnote-811965701 +Ref: HTTP status codes-Footnote-911965760 +Ref: HTTP status codes-Footnote-1011965819 +Ref: HTTP status codes-Footnote-1111965879 +Ref: HTTP status codes-Footnote-1211965939 +Ref: HTTP status codes-Footnote-1311965999 +Ref: HTTP status codes-Footnote-1411966059 +Ref: HTTP status codes-Footnote-1511966119 +Ref: HTTP status codes-Footnote-1611966179 +Ref: HTTP status codes-Footnote-1711966239 +Ref: HTTP status codes-Footnote-1811966299 +Ref: HTTP status codes-Footnote-1911966359 +Ref: HTTP status codes-Footnote-2011966419 +Ref: HTTP status codes-Footnote-2111966479 +Ref: HTTP status codes-Footnote-2211966539 +Ref: HTTP status codes-Footnote-2311966599 +Ref: HTTP status codes-Footnote-2411966659 +Ref: HTTP status codes-Footnote-2511966719 +Ref: HTTP status codes-Footnote-2611966779 +Ref: HTTP status codes-Footnote-2711966839 +Ref: HTTP status codes-Footnote-2811966899 +Ref: HTTP status codes-Footnote-2911966959 +Ref: HTTP status codes-Footnote-3011967019 +Ref: HTTP status codes-Footnote-3111967079 +Ref: HTTP status codes-Footnote-3211967139 +Ref: HTTP status codes-Footnote-3311967199 +Ref: HTTP status codes-Footnote-3411967259 +Ref: HTTP status codes-Footnote-3511967319 +Ref: HTTP status codes-Footnote-3611967379 +Ref: HTTP status codes-Footnote-3711967439 +Ref: HTTP status codes-Footnote-3811967499 +Ref: HTTP status codes-Footnote-3911967559 +Ref: HTTP status codes-Footnote-4011967619 +Ref: HTTP status codes-Footnote-4111967679 +Ref: HTTP status codes-Footnote-4211967739 +Ref: HTTP status codes-Footnote-4311967799 +Ref: HTTP status codes-Footnote-4411967859 +Ref: HTTP status codes-Footnote-4511967919 +Ref: HTTP status codes-Footnote-4611967979 +Ref: HTTP status codes-Footnote-4711968039 +Ref: HTTP status codes-Footnote-4811968099 +Ref: HTTP status codes-Footnote-4911968159 +Ref: HTTP status codes-Footnote-5011968219 +Ref: HTTP status codes-Footnote-5111968279 +Ref: HTTP status codes-Footnote-5211968339 +Ref: HTTP status codes-Footnote-5311968399 +Ref: HTTP status codes-Footnote-5411968459 +Ref: HTTP status codes-Footnote-5511968519 +Ref: HTTP status codes-Footnote-5611968579 +Ref: HTTP status codes-Footnote-5711968639 +Ref: HTTP status codes-Footnote-5811968699 +Ref: HTTP status codes-Footnote-5911968759 +Ref: HTTP status codes-Footnote-6011968819 +Ref: HTTP status codes-Footnote-6111968879 +Ref: HTTP status codes-Footnote-6211968939 +Ref: HTTP status codes-Footnote-6311968999 +Node: HTTP status category11969059 +Ref: library/http http-status-category11969184 +Ref: 3a4b11969184 +Ref: library/http http HTTPMethod11970789 +Ref: 3a4c11970789 +Ref: HTTP status category-Footnote-111971617 +Ref: HTTP status category-Footnote-211971676 +Ref: HTTP status category-Footnote-311971735 +Ref: HTTP status category-Footnote-411971794 +Ref: HTTP status category-Footnote-511971853 +Node: HTTP methods11971912 +Ref: library/http http-methods11972011 +Ref: 3a4d11972011 +Ref: library/http id211972011 +Ref: 3a4e11972011 +Ref: HTTP methods-Footnote-111974388 +Ref: HTTP methods-Footnote-211974461 +Ref: HTTP methods-Footnote-311974520 +Ref: HTTP methods-Footnote-411974579 +Ref: HTTP methods-Footnote-511974638 +Ref: HTTP methods-Footnote-611974697 +Ref: HTTP methods-Footnote-711974756 +Ref: HTTP methods-Footnote-811974815 +Ref: HTTP methods-Footnote-911974874 +Ref: HTTP methods-Footnote-1011974933 +Node: http client — HTTP protocol client11974993 +Ref: library/http client doc11975165 +Ref: 3a4f11975165 +Ref: library/http client http-client-http-protocol-client11975165 +Ref: 3a5011975165 +Ref: library/http client module-http client11975165 +Ref: 6f11975165 +Ref: library/http client http client HTTPConnection11976019 +Ref: b4011976019 +Ref: library/http client http client HTTPSConnection11977599 +Ref: b4111977599 +Ref: library/http client http client HTTPResponse11979279 +Ref: 10c411979279 +Ref: library/http client http client parse_headers11979661 +Ref: 1a4811979661 +Ref: library/http client http client HTTPException11980614 +Ref: 3a5411980614 +Ref: library/http client http client NotConnected11980765 +Ref: 3a5511980765 +Ref: library/http client http client InvalidURL11980853 +Ref: 3a5611980853 +Ref: library/http client http client UnknownProtocol11981006 +Ref: 3a5711981006 +Ref: library/http client http client UnknownTransferEncoding11981097 +Ref: 3a5811981097 +Ref: library/http client http client UnimplementedFileMode11981196 +Ref: 3a5911981196 +Ref: library/http client http client IncompleteRead11981293 +Ref: 3a5a11981293 +Ref: library/http client http client ImproperConnectionState11981383 +Ref: 3a5b11981383 +Ref: library/http client http client CannotSendRequest11981482 +Ref: 3a5c11981482 +Ref: library/http client http client CannotSendHeader11981585 +Ref: 3a5d11981585 +Ref: library/http client http client ResponseNotReady11981687 +Ref: 3a5e11981687 +Ref: library/http client http client BadStatusLine11981789 +Ref: 3a5f11981789 +Ref: library/http client http client LineTooLong11981964 +Ref: 3a6011981964 +Ref: library/http client http client RemoteDisconnected11982142 +Ref: e0811982142 +Ref: library/http client http client HTTP_PORT11982624 +Ref: 3a6111982624 +Ref: library/http client http client HTTPS_PORT11982721 +Ref: 3a6211982721 +Ref: library/http client http client responses11982821 +Ref: 3a6311982821 +Ref: http client — HTTP protocol client-Footnote-111983282 +Ref: http client — HTTP protocol client-Footnote-211983353 +Ref: http client — HTTP protocol client-Footnote-311983404 +Node: HTTPConnection Objects11983463 +Ref: library/http client httpconnection-objects11983587 +Ref: 3a6411983587 +Ref: library/http client id111983587 +Ref: 3a6511983587 +Ref: library/http client http client HTTPConnection request11983720 +Ref: ca911983720 +Ref: library/http client http client HTTPConnection getresponse11987283 +Ref: e0711987283 +Ref: library/http client http client HTTPConnection set_debuglevel11987776 +Ref: 3a6611987776 +Ref: library/http client http client HTTPConnection set_tunnel11988180 +Ref: 121b11988180 +Ref: library/http client http client HTTPConnection get_proxy_response_headers11989858 +Ref: 170211989858 +Ref: library/http client http client HTTPConnection connect11990139 +Ref: 3a6711990139 +Ref: library/http client http client HTTPConnection close11990495 +Ref: 3a6811990495 +Ref: library/http client http client HTTPConnection blocksize11990574 +Ref: 3a6911990574 +Ref: library/http client http client HTTPConnection putrequest11990866 +Ref: 3a6a11990866 +Ref: library/http client http client HTTPConnection putheader11991415 +Ref: 3a6b11991415 +Ref: library/http client http client HTTPConnection endheaders11991750 +Ref: caa11991750 +Ref: library/http client http client HTTPConnection send11993121 +Ref: 3a6c11993121 +Ref: HTTPConnection Objects-Footnote-111993490 +Ref: HTTPConnection Objects-Footnote-211993563 +Ref: HTTPConnection Objects-Footnote-311993636 +Ref: HTTPConnection Objects-Footnote-411993709 +Ref: HTTPConnection Objects-Footnote-511993777 +Ref: HTTPConnection Objects-Footnote-611993835 +Node: HTTPResponse Objects11993894 +Ref: library/http client httpresponse-objects11994039 +Ref: 3a6d11994039 +Ref: library/http client id211994039 +Ref: 3a6e11994039 +Ref: library/http client http client HTTPResponse read11994454 +Ref: 158311994454 +Ref: library/http client http client HTTPResponse readinto11994567 +Ref: 10c511994567 +Ref: library/http client http client HTTPResponse getheader11994756 +Ref: 3a6f11994756 +Ref: library/http client http client HTTPResponse getheaders11995143 +Ref: 3a7011995143 +Ref: library/http client http client HTTPResponse fileno11995230 +Ref: 3a7111995230 +Ref: library/http client http client HTTPResponse msg11995322 +Ref: 3a5211995322 +Ref: library/http client http client HTTPResponse version11995541 +Ref: 3a7211995541 +Ref: library/http client http client HTTPResponse url11995662 +Ref: 3a7311995662 +Ref: library/http client http client HTTPResponse headers11995792 +Ref: 3a7411995792 +Ref: library/http client http client HTTPResponse status11995931 +Ref: 3a7511995931 +Ref: library/http client http client HTTPResponse reason11996005 +Ref: 399b11996005 +Ref: library/http client http client HTTPResponse debuglevel11996081 +Ref: 3a7611996081 +Ref: library/http client http client HTTPResponse closed11996276 +Ref: 3a7711996276 +Ref: library/http client http client HTTPResponse geturl11996357 +Ref: 3a7811996357 +Ref: library/http client http client HTTPResponse info11996474 +Ref: 3a7911996474 +Ref: library/http client http client HTTPResponse getcode11996593 +Ref: 3a7a11996593 +Node: Examples<27>11996714 +Ref: library/http client examples11996856 +Ref: 3a7b11996856 +Node: HTTPMessage Objects11999743 +Ref: library/http client httpmessage-objects11999856 +Ref: 3a7c11999856 +Ref: library/http client id311999856 +Ref: 3a7d11999856 +Ref: library/http client http client HTTPMessage11999917 +Ref: 3a5111999917 +Node: ftplib — FTP protocol client12000138 +Ref: library/ftplib doc12000320 +Ref: 3a7e12000320 +Ref: library/ftplib ftplib-ftp-protocol-client12000320 +Ref: 3a7f12000320 +Ref: library/ftplib module-ftplib12000320 +Ref: 5e12000320 +Ref: ftplib — FTP protocol client-Footnote-112002168 +Ref: ftplib — FTP protocol client-Footnote-212002234 +Ref: ftplib — FTP protocol client-Footnote-312002292 +Node: Reference<6>12002351 +Ref: library/ftplib ftplib-reference12002430 +Ref: 3a8012002430 +Ref: library/ftplib reference12002430 +Ref: 3a8112002430 +Node: FTP objects12002538 +Ref: library/ftplib ftp-objects12002622 +Ref: 3a8212002622 +Ref: library/ftplib id112002622 +Ref: 3a8312002622 +Ref: library/ftplib ftplib FTP12002667 +Ref: 8f912002667 +Ref: library/ftplib ftplib FTP set_debuglevel12005552 +Ref: 3a8512005552 +Ref: library/ftplib ftplib FTP connect12006109 +Ref: 3a8412006109 +Ref: library/ftplib ftplib FTP getwelcome12007500 +Ref: 3a8612007500 +Ref: library/ftplib ftplib FTP login12007756 +Ref: 3a8712007756 +Ref: library/ftplib ftplib FTP abort12008795 +Ref: 3a8812008795 +Ref: library/ftplib ftplib FTP sendcmd12008944 +Ref: 3a8912008944 +Ref: library/ftplib ftplib FTP voidcmd12009190 +Ref: 3a8a12009190 +Ref: library/ftplib ftplib FTP retrbinary12009596 +Ref: 3a8c12009596 +Ref: library/ftplib ftplib FTP retrlines12010655 +Ref: 3a8e12010655 +Ref: library/ftplib ftplib FTP set_pasv12011392 +Ref: 3a8f12011392 +Ref: library/ftplib ftplib FTP storbinary12011554 +Ref: 12fd12011554 +Ref: library/ftplib ftplib FTP storlines12012727 +Ref: 3a9012012727 +Ref: library/ftplib ftplib FTP transfercmd12013225 +Ref: 3a8d12013225 +Ref: library/ftplib ftplib FTP ntransfercmd12014469 +Ref: 3a9112014469 +Ref: library/ftplib ftplib FTP mlsd12014845 +Ref: 10b812014845 +Ref: library/ftplib ftplib FTP nlst12015600 +Ref: 10b912015600 +Ref: library/ftplib ftplib FTP dir12016042 +Ref: 10ba12016042 +Ref: library/ftplib ftplib FTP rename12016739 +Ref: 3a9212016739 +Ref: library/ftplib ftplib FTP delete12016844 +Ref: 3a9312016844 +Ref: library/ftplib ftplib FTP cwd12017128 +Ref: 3a9512017128 +Ref: library/ftplib ftplib FTP mkd12017213 +Ref: 3a9612017213 +Ref: library/ftplib ftplib FTP pwd12017295 +Ref: 3a9712017295 +Ref: library/ftplib ftplib FTP rmd12017391 +Ref: 3a9812017391 +Ref: library/ftplib ftplib FTP size12017486 +Ref: 3a9912017486 +Ref: library/ftplib ftplib FTP quit12017837 +Ref: 3a9a12017837 +Ref: library/ftplib ftplib FTP close12018277 +Ref: 3a9b12018277 +Ref: FTP objects-Footnote-112018778 +Ref: FTP objects-Footnote-212018836 +Ref: FTP objects-Footnote-312018895 +Ref: FTP objects-Footnote-412018953 +Node: FTP_TLS objects12019012 +Ref: library/ftplib ftp-tls-objects12019121 +Ref: 3a9c12019121 +Ref: library/ftplib ftplib FTP_TLS12019174 +Ref: 8fa12019174 +Ref: library/ftplib ftplib FTP_TLS ssl_version12022843 +Ref: 3a9e12022843 +Ref: library/ftplib ftplib FTP_TLS auth12022968 +Ref: 3a9f12022968 +Ref: library/ftplib ftplib FTP_TLS ccc12023358 +Ref: 10b712023358 +Ref: library/ftplib ftplib FTP_TLS prot_p12023617 +Ref: 3a9d12023617 +Ref: library/ftplib ftplib FTP_TLS prot_c12023687 +Ref: 3aa012023687 +Ref: FTP_TLS objects-Footnote-112023797 +Ref: FTP_TLS objects-Footnote-212023856 +Ref: FTP_TLS objects-Footnote-312023914 +Node: Module variables12023973 +Ref: library/ftplib module-variables12024062 +Ref: 3aa112024062 +Ref: library/ftplib ftplib error_reply12024117 +Ref: 3a8b12024117 +Ref: library/ftplib ftplib error_temp12024234 +Ref: 3aa212024234 +Ref: library/ftplib ftplib error_perm12024397 +Ref: 3a9412024397 +Ref: library/ftplib ftplib error_proto12024560 +Ref: 3aa312024560 +Ref: library/ftplib ftplib all_errors12024791 +Ref: 3aa412024791 +Node: poplib — POP3 protocol client12025372 +Ref: library/poplib doc12025551 +Ref: 3aa512025551 +Ref: library/poplib module-poplib12025551 +Ref: ac12025551 +Ref: library/poplib poplib-pop3-protocol-client12025551 +Ref: 3aa612025551 +Ref: library/poplib poplib POP312026826 +Ref: 92312026826 +Ref: library/poplib poplib POP3_SSL12027743 +Ref: 92412027743 +Ref: library/poplib poplib error_proto12029290 +Ref: 118f12029290 +Ref: poplib — POP3 protocol client-Footnote-112029943 +Ref: poplib — POP3 protocol client-Footnote-212030009 +Ref: poplib — POP3 protocol client-Footnote-312030068 +Ref: poplib — POP3 protocol client-Footnote-412030127 +Ref: poplib — POP3 protocol client-Footnote-512030186 +Node: POP3 Objects12030248 +Ref: library/poplib id112030349 +Ref: 3aa712030349 +Ref: library/poplib pop3-objects12030349 +Ref: 3aa812030349 +Ref: library/poplib poplib POP3 set_debuglevel12030580 +Ref: 3aa912030580 +Ref: library/poplib poplib POP3 getwelcome12031045 +Ref: 3aaa12031045 +Ref: library/poplib poplib POP3 capa12031136 +Ref: f7712031136 +Ref: library/poplib poplib POP3 user12031327 +Ref: 3aab12031327 +Ref: library/poplib poplib POP3 pass_12031445 +Ref: 3aac12031445 +Ref: library/poplib poplib POP3 apop12031640 +Ref: 3aad12031640 +Ref: library/poplib poplib POP3 rpop12031758 +Ref: 3aae12031758 +Ref: library/poplib poplib POP3 stat12031877 +Ref: 3aaf12031877 +Ref: library/poplib poplib POP3 list12032009 +Ref: 3ab012032009 +Ref: library/poplib poplib POP3 retr12032201 +Ref: 3ab112032201 +Ref: library/poplib poplib POP3 dele12032364 +Ref: 3ab212032364 +Ref: library/poplib poplib POP3 rset12032642 +Ref: 3ab312032642 +Ref: library/poplib poplib POP3 noop12032717 +Ref: 3ab412032717 +Ref: library/poplib poplib POP3 quit12032793 +Ref: 118e12032793 +Ref: library/poplib poplib POP3 top12032883 +Ref: 3ab512032883 +Ref: library/poplib poplib POP3 uidl12033420 +Ref: 3ab612033420 +Ref: library/poplib poplib POP3 utf812033704 +Ref: e4912033704 +Ref: library/poplib poplib POP3 stls12033914 +Ref: f7812033914 +Ref: POP3 Objects-Footnote-112034715 +Ref: POP3 Objects-Footnote-212034774 +Ref: POP3 Objects-Footnote-312034833 +Node: POP3 Example12034892 +Ref: library/poplib id212034993 +Ref: 3ab712034993 +Ref: library/poplib pop3-example12034993 +Ref: 3ab812034993 +Node: imaplib — IMAP4 protocol client12035505 +Ref: library/imaplib doc12035686 +Ref: 3ab912035686 +Ref: library/imaplib imaplib-imap4-protocol-client12035686 +Ref: 3aba12035686 +Ref: library/imaplib module-imaplib12035686 +Ref: 7412035686 +Ref: library/imaplib imaplib IMAP412036513 +Ref: 90212036513 +Ref: library/imaplib imaplib IMAP4 error12037723 +Ref: 3abb12037723 +Ref: library/imaplib imaplib IMAP4 abort12037866 +Ref: 3abc12037866 +Ref: library/imaplib imaplib IMAP4 readonly12038128 +Ref: 3abd12038128 +Ref: library/imaplib imaplib IMAP4_SSL12038485 +Ref: 90312038485 +Ref: library/imaplib imaplib IMAP4_stream12039897 +Ref: 90512039897 +Ref: library/imaplib imaplib Internaldate2tuple12040167 +Ref: 3abe12040167 +Ref: library/imaplib imaplib Int2AP12040417 +Ref: 3abf12040417 +Ref: library/imaplib imaplib ParseFlags12040565 +Ref: 3ac012040565 +Ref: library/imaplib imaplib Time2Internaldate12040686 +Ref: 3ac112040686 +Ref: imaplib — IMAP4 protocol client-Footnote-112042029 +Ref: imaplib — IMAP4 protocol client-Footnote-212042096 +Ref: imaplib — IMAP4 protocol client-Footnote-312042155 +Node: IMAP4 Objects12042214 +Ref: library/imaplib id112042319 +Ref: 3ac212042319 +Ref: library/imaplib imap4-objects12042319 +Ref: 3ac312042319 +Ref: library/imaplib imaplib IMAP4 append12043821 +Ref: 3ac412043821 +Ref: library/imaplib imaplib IMAP4 authenticate12043925 +Ref: 3ac512043925 +Ref: library/imaplib imaplib IMAP4 check12044761 +Ref: 3ac612044761 +Ref: library/imaplib imaplib IMAP4 close12044825 +Ref: 90712044825 +Ref: library/imaplib imaplib IMAP4 copy12045010 +Ref: 3ac712045010 +Ref: library/imaplib imaplib IMAP4 create12045122 +Ref: 3ac812045122 +Ref: library/imaplib imaplib IMAP4 delete12045200 +Ref: 3ac912045200 +Ref: library/imaplib imaplib IMAP4 deleteacl12045278 +Ref: 3aca12045278 +Ref: library/imaplib imaplib IMAP4 enable12045388 +Ref: e0c12045388 +Ref: library/imaplib imaplib IMAP4 expunge12045707 +Ref: 3acb12045707 +Ref: library/imaplib imaplib IMAP4 fetch12045955 +Ref: 3acc12045955 +Ref: library/imaplib imaplib IMAP4 getacl12046235 +Ref: 3acd12046235 +Ref: library/imaplib imaplib IMAP4 getannotation12046389 +Ref: 3ace12046389 +Ref: library/imaplib imaplib IMAP4 getquota12046590 +Ref: 3acf12046590 +Ref: library/imaplib imaplib IMAP4 getquotaroot12046764 +Ref: 3ad012046764 +Ref: library/imaplib imaplib IMAP4 list12046952 +Ref: 3ad112046952 +Ref: library/imaplib imaplib IMAP4 login12047221 +Ref: 3ad212047221 +Ref: library/imaplib imaplib IMAP4 login_cram_md512047354 +Ref: 3ad312047354 +Ref: library/imaplib imaplib IMAP4 logout12047614 +Ref: 3ad412047614 +Ref: library/imaplib imaplib IMAP4 lsub12047811 +Ref: 3ad512047811 +Ref: library/imaplib imaplib IMAP4 myrights12048101 +Ref: 3ad612048101 +Ref: library/imaplib imaplib IMAP4 namespace12048220 +Ref: 3ad712048220 +Ref: library/imaplib imaplib IMAP4 noop12048309 +Ref: 3ad812048309 +Ref: library/imaplib imaplib IMAP4 open12048369 +Ref: 90412048369 +Ref: library/imaplib imaplib IMAP4 partial12049315 +Ref: 3add12049315 +Ref: library/imaplib imaplib IMAP4 proxyauth12049492 +Ref: 3ade12049492 +Ref: library/imaplib imaplib IMAP4 read12049644 +Ref: 3ad912049644 +Ref: library/imaplib imaplib IMAP4 readline12049760 +Ref: 3ada12049760 +Ref: library/imaplib imaplib IMAP4 recent12049872 +Ref: 3adf12049872 +Ref: library/imaplib imaplib IMAP4 rename12050027 +Ref: 3ae012050027 +Ref: library/imaplib imaplib IMAP4 response12050135 +Ref: 3ae112050135 +Ref: library/imaplib imaplib IMAP4 search12050293 +Ref: 3ae212050293 +Ref: library/imaplib imaplib IMAP4 select12050968 +Ref: 3ae312050968 +Ref: library/imaplib imaplib IMAP4 send12051263 +Ref: 3adb12051263 +Ref: library/imaplib imaplib IMAP4 setacl12051477 +Ref: 3ae412051477 +Ref: library/imaplib imaplib IMAP4 setannotation12051640 +Ref: 3ae512051640 +Ref: library/imaplib imaplib IMAP4 setquota12051829 +Ref: 3ae612051829 +Ref: library/imaplib imaplib IMAP4 shutdown12052003 +Ref: 3adc12052003 +Ref: library/imaplib imaplib IMAP4 socket12052190 +Ref: 3ae712052190 +Ref: library/imaplib imaplib IMAP4 sort12052276 +Ref: 3ae812052276 +Ref: library/imaplib imaplib IMAP4 starttls12053220 +Ref: 121812053220 +Ref: library/imaplib imaplib IMAP4 status12053749 +Ref: 3ae912053749 +Ref: library/imaplib imaplib IMAP4 store12053845 +Ref: 3aea12053845 +Ref: library/imaplib imaplib IMAP4 subscribe12055046 +Ref: 3aeb12055046 +Ref: library/imaplib imaplib IMAP4 thread12055117 +Ref: 3aec12055117 +Ref: library/imaplib imaplib IMAP4 uid12056246 +Ref: 3aed12056246 +Ref: library/imaplib imaplib IMAP4 unsubscribe12056564 +Ref: 3aee12056564 +Ref: library/imaplib imaplib IMAP4 unselect12056641 +Ref: 90612056641 +Ref: library/imaplib imaplib IMAP4 xatom12057040 +Ref: 3aef12057040 +Ref: library/imaplib imaplib IMAP4 PROTOCOL_VERSION12057244 +Ref: 3af012057244 +Ref: library/imaplib imaplib IMAP4 debug12057379 +Ref: 3af112057379 +Ref: library/imaplib imaplib IMAP4 utf8_enabled12057582 +Ref: e0d12057582 +Ref: IMAP4 Objects-Footnote-112057862 +Ref: IMAP4 Objects-Footnote-212057921 +Ref: IMAP4 Objects-Footnote-312057980 +Ref: IMAP4 Objects-Footnote-412058039 +Ref: IMAP4 Objects-Footnote-512058098 +Ref: IMAP4 Objects-Footnote-612058157 +Node: IMAP4 Example12058216 +Ref: library/imaplib id212058321 +Ref: 3af212058321 +Ref: library/imaplib imap4-example12058321 +Ref: 3af312058321 +Node: smtplib — SMTP protocol client12058827 +Ref: library/smtplib doc12059020 +Ref: 3af412059020 +Ref: library/smtplib module-smtplib12059020 +Ref: ca12059020 +Ref: library/smtplib smtplib-smtp-protocol-client12059020 +Ref: 3af512059020 +Ref: library/smtplib smtplib SMTP12059672 +Ref: 92d12059672 +Ref: library/smtplib smtplib SMTP_SSL12062274 +Ref: 92e12062274 +Ref: library/smtplib smtplib LMTP12063751 +Ref: 92f12063751 +Ref: library/smtplib smtplib SMTPException12064672 +Ref: f9b12064672 +Ref: library/smtplib smtplib SMTPServerDisconnected12064928 +Ref: 3af812064928 +Ref: library/smtplib smtplib SMTPResponseException12065156 +Ref: 3af912065156 +Ref: library/smtplib smtplib SMTPSenderRefused12065521 +Ref: 3afa12065521 +Ref: library/smtplib smtplib SMTPRecipientsRefused12065762 +Ref: 3afb12065762 +Ref: library/smtplib smtplib SMTPDataError12066035 +Ref: 3afc12066035 +Ref: library/smtplib smtplib SMTPConnectError12066131 +Ref: 3af612066131 +Ref: library/smtplib smtplib SMTPHeloError12066252 +Ref: 3afd12066252 +Ref: library/smtplib smtplib SMTPNotSupportedError12066339 +Ref: 19c812066339 +Ref: library/smtplib smtplib SMTPAuthenticationError12066483 +Ref: 3afe12066483 +Ref: smtplib — SMTP protocol client-Footnote-112067206 +Ref: smtplib — SMTP protocol client-Footnote-212067273 +Ref: smtplib — SMTP protocol client-Footnote-312067331 +Ref: smtplib — SMTP protocol client-Footnote-412067390 +Ref: smtplib — SMTP protocol client-Footnote-512067449 +Ref: smtplib — SMTP protocol client-Footnote-612067507 +Node: SMTP Objects12067566 +Ref: library/smtplib id112067668 +Ref: 3aff12067668 +Ref: library/smtplib smtp-objects12067668 +Ref: 3b0012067668 +Ref: library/smtplib smtplib SMTP set_debuglevel12067772 +Ref: e5312067772 +Ref: library/smtplib smtplib SMTP docmd12068123 +Ref: 3b0112068123 +Ref: library/smtplib smtplib SMTP connect12068773 +Ref: 19c912068773 +Ref: library/smtplib smtplib SMTP helo12069459 +Ref: 3b0212069459 +Ref: library/smtplib smtplib SMTP ehlo12069919 +Ref: 3b0312069919 +Ref: library/smtplib smtplib SMTP ehlo_or_helo_if_needed12070824 +Ref: 3b0512070824 +Ref: library/smtplib smtplib SMTP has_extn12071166 +Ref: 3b0412071166 +Ref: library/smtplib smtplib SMTP verify12071361 +Ref: 3b0612071361 +Ref: library/smtplib smtplib SMTP login12071780 +Ref: 3b0712071780 +Ref: library/smtplib smtplib SMTP auth12073365 +Ref: e5212073365 +Ref: library/smtplib smtplib SMTP starttls12075610 +Ref: 112c12075610 +Ref: library/smtplib smtplib SMTP sendmail12077112 +Ref: e5412077112 +Ref: library/smtplib smtplib SMTP send_message12080593 +Ref: e5512080593 +Ref: library/smtplib smtplib SMTP quit12082672 +Ref: 3af712082672 +Ref: SMTP Objects-Footnote-112083135 +Ref: SMTP Objects-Footnote-212083193 +Ref: SMTP Objects-Footnote-312083252 +Ref: SMTP Objects-Footnote-412083311 +Ref: SMTP Objects-Footnote-512083369 +Ref: SMTP Objects-Footnote-612083427 +Node: SMTP Example12083486 +Ref: library/smtplib id212083588 +Ref: 3b0812083588 +Ref: library/smtplib smtp-example12083588 +Ref: 3b0912083588 +Ref: SMTP Example-Footnote-112085016 +Node: uuid — UUID objects according to RFC 412212085074 +Ref: library/uuid doc12085282 +Ref: 3b0a12085282 +Ref: library/uuid module-uuid12085282 +Ref: 11012085282 +Ref: library/uuid uuid-uuid-objects-according-to-rfc-412212085282 +Ref: 3b0b12085282 +Ref: library/uuid uuid SafeUUID12086404 +Ref: 3b0c12086404 +Ref: library/uuid uuid SafeUUID safe12086458 +Ref: 3b0d12086458 +Ref: library/uuid uuid SafeUUID unsafe12086575 +Ref: 3b0e12086575 +Ref: library/uuid uuid SafeUUID unknown12086672 +Ref: 3b0f12086672 +Ref: library/uuid uuid UUID12086813 +Ref: a6012086813 +Ref: library/uuid uuid UUID bytes12088774 +Ref: 3b1112088774 +Ref: library/uuid uuid UUID bytes_le12088903 +Ref: 3b1212088903 +Ref: library/uuid uuid UUID fields12089055 +Ref: 3b1312089055 +Ref: library/uuid uuid UUID time_low12089426 +Ref: 3b1412089426 +Ref: library/uuid uuid UUID time_mid12089624 +Ref: 3b1512089624 +Ref: library/uuid uuid UUID time_hi_version12089828 +Ref: 3b1612089828 +Ref: library/uuid uuid UUID clock_seq_hi_variant12090030 +Ref: 3b1712090030 +Ref: library/uuid uuid UUID clock_seq_low12090219 +Ref: 3b1812090219 +Ref: library/uuid uuid UUID node12090406 +Ref: 3b1912090406 +Ref: library/uuid uuid UUID time12090603 +Ref: 3b1a12090603 +Ref: library/uuid uuid UUID clock_seq12090797 +Ref: 3b1b12090797 +Ref: library/uuid uuid UUID hex12090908 +Ref: 3b1c12090908 +Ref: library/uuid uuid UUID int12090996 +Ref: 3b1012090996 +Ref: library/uuid uuid UUID urn12091058 +Ref: 3b1d12091058 +Ref: library/uuid uuid UUID variant12091136 +Ref: 3b1e12091136 +Ref: library/uuid uuid UUID version12091400 +Ref: 3b2312091400 +Ref: library/uuid uuid UUID is_safe12091538 +Ref: ba612091538 +Ref: library/uuid uuid getnode12091795 +Ref: ba712091795 +Ref: library/uuid uuid uuid112092765 +Ref: ba812092765 +Ref: library/uuid uuid uuid312093117 +Ref: 155f12093117 +Ref: library/uuid uuid uuid412093354 +Ref: 156012093354 +Ref: library/uuid uuid uuid512093413 +Ref: 156112093413 +Ref: library/uuid uuid NAMESPACE_DNS12093783 +Ref: 3b2412093783 +Ref: library/uuid uuid NAMESPACE_URL12093910 +Ref: 3b2512093910 +Ref: library/uuid uuid NAMESPACE_OID12094008 +Ref: 3b2612094008 +Ref: library/uuid uuid NAMESPACE_X50012094111 +Ref: 3b2712094111 +Ref: library/uuid uuid RESERVED_NCS12094376 +Ref: 3b1f12094376 +Ref: library/uuid uuid RFC_412212094443 +Ref: 3b2012094443 +Ref: library/uuid uuid RESERVED_MICROSOFT12094522 +Ref: 3b2112094522 +Ref: library/uuid uuid RESERVED_FUTURE12094601 +Ref: 3b2212094601 +Ref: uuid — UUID objects according to RFC 4122-Footnote-112095049 +Ref: uuid — UUID objects according to RFC 4122-Footnote-212095113 +Ref: uuid — UUID objects according to RFC 4122-Footnote-312095172 +Ref: uuid — UUID objects according to RFC 4122-Footnote-412095231 +Ref: uuid — UUID objects according to RFC 4122-Footnote-512095290 +Ref: uuid — UUID objects according to RFC 4122-Footnote-612095349 +Ref: uuid — UUID objects according to RFC 4122-Footnote-712095408 +Node: Command-Line Usage<2>12095467 +Ref: library/uuid command-line-usage12095588 +Ref: 3b2812095588 +Ref: library/uuid uuid-cli12095588 +Ref: 43f12095588 +Ref: library/uuid cmdoption-uuid-h12095870 +Ref: 3b2912095870 +Ref: library/uuid cmdoption-uuid-help12095870 +Ref: 3b2a12095870 +Ref: library/uuid cmdoption-uuid-u12095932 +Ref: 3b2b12095932 +Ref: library/uuid cmdoption-uuid-uuid12095954 +Ref: 3b2c12095954 +Ref: library/uuid cmdoption-uuid-n12096089 +Ref: 3b2d12096089 +Ref: library/uuid cmdoption-uuid-namespace12096116 +Ref: 3b2e12096116 +Ref: library/uuid cmdoption-uuid-N12096430 +Ref: 3b2f12096430 +Ref: library/uuid cmdoption-uuid-name12096452 +Ref: 3b3012096452 +Node: Example<11>12096610 +Ref: library/uuid example12096760 +Ref: 3b3112096760 +Ref: library/uuid uuid-example12096760 +Ref: 3b3212096760 +Node: Command-Line Example12098019 +Ref: library/uuid command-line-example12098139 +Ref: 3b3312098139 +Ref: library/uuid uuid-cli-example12098139 +Ref: 3b3412098139 +Node: socketserver — A framework for network servers12098532 +Ref: library/socketserver doc12098736 +Ref: 3b3512098736 +Ref: library/socketserver module-socketserver12098736 +Ref: cd12098736 +Ref: library/socketserver socketserver-a-framework-for-network-servers12098736 +Ref: 3b3612098736 +Ref: library/socketserver socketserver TCPServer12099258 +Ref: 131212099258 +Ref: library/socketserver socketserver UDPServer12099730 +Ref: 3b3912099730 +Ref: library/socketserver socketserver UnixStreamServer12100033 +Ref: 3b3a12100033 +Ref: library/socketserver socketserver UnixDatagramServer12100146 +Ref: 3b3b12100146 +Ref: socketserver — A framework for network servers-Footnote-112102500 +Node: Server Creation Notes12102572 +Ref: library/socketserver server-creation-notes12102704 +Ref: 3b3f12102704 +Ref: library/socketserver socketserver ForkingMixIn12103477 +Ref: b7712103477 +Ref: library/socketserver socketserver ThreadingMixIn12103514 +Ref: b7812103514 +Ref: library/socketserver socketserver ThreadingMixIn block_on_close12104173 +Ref: bfd12104173 +Ref: library/socketserver socketserver ThreadingMixIn daemon_threads12104564 +Ref: 3b4112104564 +Ref: library/socketserver socketserver ForkingTCPServer12105096 +Ref: 3b4212105096 +Ref: library/socketserver socketserver ForkingUDPServer12105137 +Ref: 3b4312105137 +Ref: library/socketserver socketserver ThreadingTCPServer12105178 +Ref: 3b4412105178 +Ref: library/socketserver socketserver ThreadingUDPServer12105221 +Ref: 3b4012105221 +Ref: library/socketserver socketserver ForkingUnixStreamServer12105264 +Ref: 3b4512105264 +Ref: library/socketserver socketserver ForkingUnixDatagramServer12105312 +Ref: 3b4612105312 +Ref: library/socketserver socketserver ThreadingUnixStreamServer12105362 +Ref: 3b4712105362 +Ref: library/socketserver socketserver ThreadingUnixDatagramServer12105412 +Ref: 3b4812105412 +Node: Server Objects<2>12107770 +Ref: library/socketserver server-objects12107934 +Ref: 3b4a12107934 +Ref: library/socketserver socketserver BaseServer12107985 +Ref: 113112107985 +Ref: library/socketserver socketserver BaseServer fileno12108384 +Ref: 3b4d12108384 +Ref: library/socketserver socketserver BaseServer handle_request12108657 +Ref: 131512108657 +Ref: library/socketserver socketserver BaseServer serve_forever12109259 +Ref: 113312109259 +Ref: library/socketserver socketserver BaseServer service_actions12109912 +Ref: 113212109912 +Ref: library/socketserver socketserver BaseServer shutdown12110215 +Ref: 1a3412110215 +Ref: library/socketserver socketserver BaseServer server_close12110497 +Ref: 3b3e12110497 +Ref: library/socketserver socketserver BaseServer address_family12110583 +Ref: 3b5112110583 +Ref: library/socketserver socketserver BaseServer RequestHandlerClass12110997 +Ref: 3b4c12110997 +Ref: library/socketserver socketserver BaseServer server_address12111155 +Ref: 3b4b12111155 +Ref: library/socketserver socketserver BaseServer socket12111578 +Ref: 3b5212111578 +Ref: library/socketserver socketserver BaseServer allow_reuse_address12111764 +Ref: 3b5312111764 +Ref: library/socketserver socketserver BaseServer request_queue_size12111978 +Ref: 3b5412111978 +Ref: library/socketserver socketserver BaseServer socket_type12112469 +Ref: 3b5512112469 +Ref: library/socketserver socketserver BaseServer timeout12112662 +Ref: 131312112662 +Ref: library/socketserver socketserver BaseServer finish_request12113168 +Ref: 3b5612113168 +Ref: library/socketserver socketserver BaseServer get_request12113385 +Ref: 3b4e12113385 +Ref: library/socketserver socketserver BaseServer handle_error12113615 +Ref: d4112113615 +Ref: library/socketserver socketserver BaseServer handle_timeout12114067 +Ref: 131412114067 +Ref: library/socketserver socketserver BaseServer process_request12114506 +Ref: 3b5012114506 +Ref: library/socketserver socketserver BaseServer server_activate12114877 +Ref: 3b3812114877 +Ref: library/socketserver socketserver BaseServer server_bind12115124 +Ref: 3b3712115124 +Ref: library/socketserver socketserver BaseServer verify_request12115278 +Ref: 3b4f12115278 +Node: Request Handler Objects12115863 +Ref: library/socketserver request-handler-objects12116018 +Ref: 3b5712116018 +Ref: library/socketserver socketserver BaseRequestHandler12116087 +Ref: 3b3c12116087 +Ref: library/socketserver socketserver BaseRequestHandler setup12116441 +Ref: 3b5812116441 +Ref: library/socketserver socketserver BaseRequestHandler handle12116636 +Ref: 3b3d12116636 +Ref: library/socketserver socketserver BaseRequestHandler finish12117351 +Ref: 3b5c12117351 +Ref: library/socketserver socketserver BaseRequestHandler request12117630 +Ref: 3b5912117630 +Ref: library/socketserver socketserver BaseRequestHandler client_address12117766 +Ref: 3b5a12117766 +Ref: library/socketserver socketserver BaseRequestHandler server12117888 +Ref: 3b5b12117888 +Ref: library/socketserver socketserver StreamRequestHandler12117989 +Ref: cda12117989 +Ref: library/socketserver socketserver DatagramRequestHandler12118034 +Ref: 3b4912118034 +Ref: library/socketserver socketserver DatagramRequestHandler rfile12118282 +Ref: 3b5d12118282 +Ref: library/socketserver socketserver DatagramRequestHandler wfile12118447 +Ref: 3b5e12118447 +Node: Examples<28>12118724 +Ref: library/socketserver examples12118853 +Ref: 3b5f12118853 +Node: socketserver TCPServer Example12119058 +Ref: library/socketserver socketserver-tcpserver-example12119176 +Ref: 3b6012119176 +Node: socketserver UDPServer Example12123010 +Ref: library/socketserver socketserver-udpserver-example12123156 +Ref: 3b6112123156 +Node: Asynchronous Mixins12124745 +Ref: library/socketserver asynchronous-mixins12124852 +Ref: 3b6212124852 +Node: http server — HTTP servers12127198 +Ref: library/http server doc12127397 +Ref: 3b6312127397 +Ref: library/http server http-server-http-servers12127397 +Ref: 3b6412127397 +Ref: library/http server module-http server12127397 +Ref: 7212127397 +Ref: library/http server http server HTTPServer12128368 +Ref: 396b12128368 +Ref: library/http server http server ThreadingHTTPServer12128723 +Ref: b4412128723 +Ref: library/http server http server BaseHTTPRequestHandler12129273 +Ref: 10c112129273 +Ref: library/http server http server BaseHTTPRequestHandler client_address12130259 +Ref: 3b6612130259 +Ref: library/http server http server BaseHTTPRequestHandler server12130401 +Ref: 3b6712130401 +Ref: library/http server http server BaseHTTPRequestHandler close_connection12130470 +Ref: 3b6812130470 +Ref: library/http server http server BaseHTTPRequestHandler requestline12130705 +Ref: 3b6a12130705 +Ref: library/http server http server BaseHTTPRequestHandler command12131020 +Ref: 3b6b12131020 +Ref: library/http server http server BaseHTTPRequestHandler path12131124 +Ref: 3b6c12131124 +Ref: library/http server http server BaseHTTPRequestHandler request_version12131398 +Ref: 3b6d12131398 +Ref: library/http server http server BaseHTTPRequestHandler headers12131534 +Ref: 3a5312131534 +Ref: library/http server http server BaseHTTPRequestHandler rfile12131961 +Ref: 3b6f12131961 +Ref: library/http server http server BaseHTTPRequestHandler wfile12132113 +Ref: 3b7012132113 +Ref: library/http server http server BaseHTTPRequestHandler server_version12132562 +Ref: 3b7112132562 +Ref: library/http server http server BaseHTTPRequestHandler sys_version12132849 +Ref: 3b7212132849 +Ref: library/http server http server BaseHTTPRequestHandler error_message_format12133104 +Ref: 3b7412133104 +Ref: library/http server http server BaseHTTPRequestHandler error_content_type12133465 +Ref: 3b7512133465 +Ref: library/http server http server BaseHTTPRequestHandler protocol_version12133645 +Ref: 3b7612133645 +Ref: library/http server http server BaseHTTPRequestHandler MessageClass12134241 +Ref: 3b6e12134241 +Ref: library/http server http server BaseHTTPRequestHandler responses12134479 +Ref: 3a3a12134479 +Ref: library/http server http server BaseHTTPRequestHandler handle12135045 +Ref: 3b7912135045 +Ref: library/http server http server BaseHTTPRequestHandler handle_one_request12135345 +Ref: 3b6912135345 +Ref: library/http server http server BaseHTTPRequestHandler handle_expect_10012135543 +Ref: 3b7a12135543 +Ref: library/http server http server BaseHTTPRequestHandler send_error12136054 +Ref: f4b12136054 +Ref: library/http server http server BaseHTTPRequestHandler send_response12137182 +Ref: 3b7b12137182 +Ref: library/http server http server BaseHTTPRequestHandler send_header12138000 +Ref: 3b7712138000 +Ref: library/http server http server BaseHTTPRequestHandler send_response_only12138583 +Ref: 3b7812138583 +Ref: library/http server http server BaseHTTPRequestHandler end_headers12139005 +Ref: 10c212139005 +Ref: library/http server http server BaseHTTPRequestHandler flush_headers12139305 +Ref: 10c312139305 +Ref: library/http server http server BaseHTTPRequestHandler log_request12139479 +Ref: 3b7d12139479 +Ref: library/http server http server BaseHTTPRequestHandler log_error12139776 +Ref: 3b7e12139776 +Ref: library/http server http server BaseHTTPRequestHandler log_message12140021 +Ref: 3b7f12140021 +Ref: library/http server http server BaseHTTPRequestHandler version_string12140510 +Ref: 3b7312140510 +Ref: library/http server http server BaseHTTPRequestHandler date_time_string12140724 +Ref: 3b7c12140724 +Ref: library/http server http server BaseHTTPRequestHandler log_date_time_string12141112 +Ref: 3b8012141112 +Ref: library/http server http server BaseHTTPRequestHandler address_string12141223 +Ref: 3b8112141223 +Ref: library/http server http server SimpleHTTPRequestHandler12141466 +Ref: b4312141466 +Ref: library/http server http server SimpleHTTPRequestHandler server_version12142253 +Ref: 3b8412142253 +Ref: library/http server http server SimpleHTTPRequestHandler extensions_map12142414 +Ref: 3b8512142414 +Ref: library/http server http server SimpleHTTPRequestHandler do_HEAD12142916 +Ref: 3b8312142916 +Ref: library/http server http server SimpleHTTPRequestHandler do_GET12143204 +Ref: 3b8212143204 +Ref: library/http server http server CGIHTTPRequestHandler12145645 +Ref: 2a312145645 +Ref: library/http server http server CGIHTTPRequestHandler cgi_directories12146834 +Ref: 3b8612146834 +Ref: library/http server http server CGIHTTPRequestHandler do_POST12147074 +Ref: 3b8712147074 +Ref: http server — HTTP servers-Footnote-112148014 +Ref: http server — HTTP servers-Footnote-212148085 +Ref: http server — HTTP servers-Footnote-312148144 +Ref: http server — HTTP servers-Footnote-412148203 +Node: Command-line interface<2>12148274 +Ref: library/http server command-line-interface12148399 +Ref: 3b8812148399 +Ref: library/http server http-server-cli12148399 +Ref: f4c12148399 +Ref: library/http server cmdoption-http server-arg-port12148742 +Ref: 3b8912148742 +Ref: library/http server cmdoption-http server-b12148935 +Ref: 3b8a12148935 +Ref: library/http server cmdoption-http server-bind12148935 +Ref: 3b8b12148935 +Ref: library/http server cmdoption-http server-d12149375 +Ref: 3b8c12149375 +Ref: library/http server cmdoption-http server-directory12149375 +Ref: 3b8d12149375 +Ref: library/http server cmdoption-http server-p12149678 +Ref: 3b8e12149678 +Ref: library/http server cmdoption-http server-protocol12149678 +Ref: 3b8f12149678 +Ref: library/http server cmdoption-http server-cgi12149999 +Ref: 3b9012149999 +Node: Security considerations<3>12150615 +Ref: library/http server http-server-security12150740 +Ref: 3b6512150740 +Ref: library/http server security-considerations12150740 +Ref: 3b9112150740 +Node: http cookies — HTTP state management12151383 +Ref: library/http cookies doc12151585 +Ref: 3b9212151585 +Ref: library/http cookies http-cookies-http-state-management12151585 +Ref: 3b9312151585 +Ref: library/http cookies module-http cookies12151585 +Ref: 7112151585 +Ref: library/http cookies http cookies CookieError12152986 +Ref: 3b9412152986 +Ref: library/http cookies http cookies BaseCookie12153153 +Ref: 3b9512153153 +Ref: library/http cookies http cookies SimpleCookie12153542 +Ref: 1a4212153542 +Ref: http cookies — HTTP state management-Footnote-112154401 +Ref: http cookies — HTTP state management-Footnote-212154473 +Ref: http cookies — HTTP state management-Footnote-312154532 +Ref: http cookies — HTTP state management-Footnote-412154591 +Ref: http cookies — HTTP state management-Footnote-512154650 +Node: Cookie Objects12154709 +Ref: library/http cookies cookie-objects12154821 +Ref: 3b9912154821 +Ref: library/http cookies id112154821 +Ref: 3b9a12154821 +Ref: library/http cookies http cookies BaseCookie value_decode12154872 +Ref: 3b9712154872 +Ref: library/http cookies http cookies BaseCookie value_encode12155144 +Ref: 3b9812155144 +Ref: library/http cookies http cookies BaseCookie output12155596 +Ref: 3b9b12155596 +Ref: library/http cookies http cookies BaseCookie js_output12155964 +Ref: 3b9d12155964 +Ref: library/http cookies http cookies BaseCookie load12156243 +Ref: 3b9612156243 +Node: Morsel Objects12156525 +Ref: library/http cookies id212156657 +Ref: 3b9e12156657 +Ref: library/http cookies morsel-objects12156657 +Ref: 3b9f12156657 +Ref: library/http cookies http cookies Morsel12156708 +Ref: c0412156708 +Ref: library/http cookies http cookies Morsel expires12156939 +Ref: 3ba012156939 +Ref: library/http cookies http cookies Morsel path12156972 +Ref: 3ba112156972 +Ref: library/http cookies http cookies Morsel comment12157002 +Ref: 3ba212157002 +Ref: library/http cookies http cookies Morsel domain12157035 +Ref: 3ba312157035 +Ref: library/http cookies http cookies Morsel secure12157101 +Ref: 3ba412157101 +Ref: library/http cookies http cookies Morsel version12157133 +Ref: 3ba512157133 +Ref: library/http cookies http cookies Morsel httponly12157166 +Ref: 139c12157166 +Ref: library/http cookies http cookies Morsel samesite12157200 +Ref: 3ba612157200 +Ref: library/http cookies http cookies Morsel value12158386 +Ref: c0212158386 +Ref: library/http cookies http cookies Morsel coded_value12158446 +Ref: c0312158446 +Ref: library/http cookies http cookies Morsel key12158552 +Ref: c0112158552 +Ref: library/http cookies http cookies Morsel set12158609 +Ref: c0512158609 +Ref: library/http cookies http cookies Morsel isReservedKey12158718 +Ref: 3ba712158718 +Ref: library/http cookies http cookies Morsel output12158829 +Ref: 3b9c12158829 +Ref: library/http cookies http cookies Morsel js_output12159169 +Ref: 3ba812159169 +Ref: library/http cookies http cookies Morsel OutputString12159443 +Ref: 3ba912159443 +Ref: library/http cookies http cookies Morsel update12159655 +Ref: ec212159655 +Ref: library/http cookies http cookies Morsel copy12159955 +Ref: ec112159955 +Ref: library/http cookies http cookies Morsel setdefault12160110 +Ref: 3baa12160110 +Ref: Morsel Objects-Footnote-112160326 +Ref: Morsel Objects-Footnote-212160385 +Ref: Morsel Objects-Footnote-312160444 +Ref: Morsel Objects-Footnote-412160503 +Node: Example<12>12160562 +Ref: library/http cookies cookie-example12160671 +Ref: 3bab12160671 +Ref: library/http cookies example12160671 +Ref: 3bac12160671 +Node: http cookiejar — Cookie handling for HTTP clients12162323 +Ref: library/http cookiejar doc12162540 +Ref: 3bad12162540 +Ref: library/http cookiejar http-cookiejar-cookie-handling-for-http-clients12162540 +Ref: 3bae12162540 +Ref: library/http cookiejar module-http cookiejar12162540 +Ref: 7012162540 +Ref: library/http cookiejar http cookiejar LoadError12164108 +Ref: 3baf12164108 +Ref: library/http cookiejar http cookiejar CookieJar12164517 +Ref: 39da12164517 +Ref: library/http cookiejar http cookiejar FileCookieJar12164993 +Ref: 3bb012164993 +Ref: library/http cookiejar http cookiejar CookiePolicy12165831 +Ref: 3bb112165831 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy12165991 +Ref: 1a1012165991 +Ref: library/http cookiejar http cookiejar Cookie12167815 +Ref: 3bb612167815 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-112169511 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-212169585 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-312169644 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-412169703 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-512169762 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-612169821 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-712169880 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-812169939 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-912169998 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-1012170057 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-1112170117 +Ref: http cookiejar — Cookie handling for HTTP clients-Footnote-1212170177 +Node: CookieJar and FileCookieJar Objects12170237 +Ref: library/http cookiejar cookie-jar-objects12170428 +Ref: 3bb712170428 +Ref: library/http cookiejar cookiejar-and-filecookiejar-objects12170428 +Ref: 3bb812170428 +Ref: library/http cookiejar http cookiejar CookieJar add_cookie_header12170704 +Ref: 3bb912170704 +Ref: library/http cookiejar http cookiejar CookieJar extract_cookies12171621 +Ref: 3bba12171621 +Ref: library/http cookiejar http cookiejar CookieJar set_policy12172854 +Ref: 3bbc12172854 +Ref: library/http cookiejar http cookiejar CookieJar make_cookies12172958 +Ref: 3bbd12172958 +Ref: library/http cookiejar http cookiejar CookieJar set_cookie_if_ok12173245 +Ref: 3bbe12173245 +Ref: library/http cookiejar http cookiejar CookieJar set_cookie12173370 +Ref: 3bbf12173370 +Ref: library/http cookiejar http cookiejar CookieJar clear12173519 +Ref: 3bc012173519 +Ref: library/http cookiejar http cookiejar CookieJar clear_session_cookies12174024 +Ref: 3bc112174024 +Ref: library/http cookiejar http cookiejar FileCookieJar save12174667 +Ref: 3bc212174667 +Ref: library/http cookiejar http cookiejar FileCookieJar load12175520 +Ref: 3bb212175520 +Ref: library/http cookiejar http cookiejar FileCookieJar revert12176088 +Ref: 3bb312176088 +Ref: library/http cookiejar http cookiejar FileCookieJar filename12176487 +Ref: 3bc312176487 +Ref: library/http cookiejar http cookiejar FileCookieJar delayload12176624 +Ref: 3bc412176624 +Node: FileCookieJar subclasses and co-operation with web browsers12177045 +Ref: library/http cookiejar file-cookie-jar-classes12177265 +Ref: 3bb412177265 +Ref: library/http cookiejar filecookiejar-subclasses-and-co-operation-with-web-browsers12177265 +Ref: 3bc512177265 +Ref: library/http cookiejar http cookiejar MozillaCookieJar12177493 +Ref: 3bc612177493 +Ref: library/http cookiejar http cookiejar LWPCookieJar12178304 +Ref: 3bc712178304 +Ref: FileCookieJar subclasses and co-operation with web browsers-Footnote-112178787 +Node: CookiePolicy Objects12178846 +Ref: library/http cookiejar cookie-policy-objects12179058 +Ref: 3bc812179058 +Ref: library/http cookiejar cookiepolicy-objects12179058 +Ref: 3bc912179058 +Ref: library/http cookiejar http cookiejar CookiePolicy set_ok12179211 +Ref: 3bbb12179211 +Ref: library/http cookiejar http cookiejar CookiePolicy return_ok12179537 +Ref: 3bca12179537 +Ref: library/http cookiejar http cookiejar CookiePolicy domain_return_ok12179866 +Ref: 3bcb12179866 +Ref: library/http cookiejar http cookiejar CookiePolicy path_return_ok12181244 +Ref: 3bcc12181244 +Ref: library/http cookiejar http cookiejar CookiePolicy netscape12181696 +Ref: 3bcd12181696 +Ref: library/http cookiejar http cookiejar CookiePolicy rfc296512181769 +Ref: 3bce12181769 +Ref: library/http cookiejar http cookiejar CookiePolicy hide_cookie212181844 +Ref: 3bcf12181844 +Ref: CookiePolicy Objects-Footnote-112182395 +Ref: CookiePolicy Objects-Footnote-212182454 +Node: DefaultCookiePolicy Objects12182513 +Ref: library/http cookiejar default-cookie-policy-objects12182683 +Ref: 3bd012182683 +Ref: library/http cookiejar defaultcookiepolicy-objects12182683 +Ref: 3bd112182683 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy blocked_domains12185002 +Ref: 3bd212185002 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_blocked_domains12185113 +Ref: 3bd312185113 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_blocked12185227 +Ref: 3bd412185227 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy allowed_domains12185375 +Ref: 3bd512185375 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy set_allowed_domains12185511 +Ref: 3bd612185511 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy is_not_allowed12185645 +Ref: 3bd712185645 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy rfc2109_as_netscape12185985 +Ref: 3bb512185985 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_domain12186572 +Ref: 3bd812186572 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_rfc2965_unverifiable12186876 +Ref: 3bd912186876 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_unverifiable12187254 +Ref: 3bda12187254 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_domain12187403 +Ref: 3bdb12187403 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_initial_dollar12187584 +Ref: 3bdc12187584 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy strict_ns_set_path12187739 +Ref: 3bdd12187739 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNoDots12188070 +Ref: 3bde12188070 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrictNonDomain12188315 +Ref: 3bdf12188315 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainRFC2965Match12188663 +Ref: 3be012188663 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainLiberal12188900 +Ref: 3be112188900 +Ref: library/http cookiejar http cookiejar DefaultCookiePolicy DomainStrict12189048 +Ref: 3be212189048 +Ref: DefaultCookiePolicy Objects-Footnote-112189201 +Ref: DefaultCookiePolicy Objects-Footnote-212189260 +Ref: DefaultCookiePolicy Objects-Footnote-312189319 +Ref: DefaultCookiePolicy Objects-Footnote-412189378 +Ref: DefaultCookiePolicy Objects-Footnote-512189437 +Ref: DefaultCookiePolicy Objects-Footnote-612189496 +Ref: DefaultCookiePolicy Objects-Footnote-712189555 +Node: Cookie Objects<2>12189614 +Ref: library/http cookiejar cookie-objects12189776 +Ref: 3be312189776 +Ref: library/http cookiejar http cookiejar Cookie version12190545 +Ref: 3be412190545 +Ref: library/http cookiejar http cookiejar Cookie name12190903 +Ref: 3be512190903 +Ref: library/http cookiejar http cookiejar Cookie value12190961 +Ref: 3be612190961 +Ref: library/http cookiejar http cookiejar Cookie port12191041 +Ref: 3be712191041 +Ref: library/http cookiejar http cookiejar Cookie domain12191180 +Ref: 3be812191180 +Ref: library/http cookiejar http cookiejar Cookie path12191242 +Ref: 3be912191242 +Ref: library/http cookiejar http cookiejar Cookie secure12191337 +Ref: 3bea12191337 +Ref: library/http cookiejar http cookiejar Cookie expires12191444 +Ref: 3beb12191444 +Ref: library/http cookiejar http cookiejar Cookie discard12191597 +Ref: 3bed12191597 +Ref: library/http cookiejar http cookiejar Cookie comment12191674 +Ref: 3bee12191674 +Ref: library/http cookiejar http cookiejar Cookie comment_url12191807 +Ref: 3bef12191807 +Ref: library/http cookiejar http cookiejar Cookie rfc210912191954 +Ref: 3bf012191954 +Ref: library/http cookiejar http cookiejar Cookie port_specified12192364 +Ref: 3bf112192364 +Ref: library/http cookiejar http cookiejar Cookie domain_specified12192543 +Ref: 3bf212192543 +Ref: library/http cookiejar http cookiejar Cookie domain_initial_dot12192652 +Ref: 3bf312192652 +Ref: library/http cookiejar http cookiejar Cookie has_nonstandard_attr12192908 +Ref: 3bf412192908 +Ref: library/http cookiejar http cookiejar Cookie get_nonstandard_attr12193022 +Ref: 3bf512193022 +Ref: library/http cookiejar http cookiejar Cookie set_nonstandard_attr12193184 +Ref: 3bf612193184 +Ref: library/http cookiejar http cookiejar Cookie is_expired12193356 +Ref: 3bec12193356 +Ref: Cookie Objects<2>-Footnote-112193649 +Ref: Cookie Objects<2>-Footnote-212193708 +Ref: Cookie Objects<2>-Footnote-312193767 +Ref: Cookie Objects<2>-Footnote-412193826 +Node: Examples<29>12193885 +Ref: library/http cookiejar examples12194011 +Ref: 3bf712194011 +Ref: Examples<29>-Footnote-112195464 +Node: xmlrpc — XMLRPC server and client modules12195523 +Ref: library/xmlrpc doc12195741 +Ref: 3bf812195741 +Ref: library/xmlrpc module-xmlrpc12195741 +Ref: 12d12195741 +Ref: library/xmlrpc xmlrpc-xmlrpc-server-and-client-modules12195741 +Ref: 3bf912195741 +Node: xmlrpc client — XML-RPC client access12196243 +Ref: library/xmlrpc client doc12196449 +Ref: 3bfa12196449 +Ref: library/xmlrpc client module-xmlrpc client12196449 +Ref: 12e12196449 +Ref: library/xmlrpc client xmlrpc-client-xml-rpc-client-access12196449 +Ref: 3bfb12196449 +Ref: library/xmlrpc client xmlrpc client ServerProxy12197539 +Ref: a5612197539 +Ref: xmlrpc client — XML-RPC client access-Footnote-112205541 +Ref: xmlrpc client — XML-RPC client access-Footnote-212205614 +Ref: xmlrpc client — XML-RPC client access-Footnote-312205708 +Ref: xmlrpc client — XML-RPC client access-Footnote-412205764 +Ref: xmlrpc client — XML-RPC client access-Footnote-512205823 +Node: ServerProxy Objects12205869 +Ref: library/xmlrpc client id112205989 +Ref: 3bff12205989 +Ref: library/xmlrpc client serverproxy-objects12205989 +Ref: 3c0012205989 +Ref: library/xmlrpc client xmlrpc client ServerProxy system listMethods12206645 +Ref: 3c0112206645 +Ref: library/xmlrpc client xmlrpc client ServerProxy system methodSignature12206808 +Ref: 3c0212206808 +Ref: library/xmlrpc client xmlrpc client ServerProxy system methodHelp12207832 +Ref: 3c0312207832 +Node: DateTime Objects12208907 +Ref: library/xmlrpc client datetime-objects12209050 +Ref: 3c0412209050 +Ref: library/xmlrpc client id212209050 +Ref: 3c0512209050 +Ref: library/xmlrpc client xmlrpc client DateTime12209105 +Ref: 13af12209105 +Ref: library/xmlrpc client xmlrpc client DateTime decode12209414 +Ref: 3c0612209414 +Ref: library/xmlrpc client xmlrpc client DateTime encode12209511 +Ref: 3c0712209511 +Node: Binary Objects12210596 +Ref: library/xmlrpc client binary-objects12210733 +Ref: 3c0812210733 +Ref: library/xmlrpc client id312210733 +Ref: 3c0912210733 +Ref: library/xmlrpc client xmlrpc client Binary12210784 +Ref: 3bfc12210784 +Ref: library/xmlrpc client xmlrpc client Binary data12211001 +Ref: 3c0a12211001 +Ref: library/xmlrpc client xmlrpc client Binary decode12211307 +Ref: 3c0b12211307 +Ref: library/xmlrpc client xmlrpc client Binary encode12211446 +Ref: 3c0c12211446 +Ref: Binary Objects-Footnote-112212690 +Node: Fault Objects12212761 +Ref: library/xmlrpc client fault-objects12212903 +Ref: 3c0d12212903 +Ref: library/xmlrpc client id412212903 +Ref: 3c0e12212903 +Ref: library/xmlrpc client xmlrpc client Fault12212952 +Ref: 3bfd12212952 +Ref: library/xmlrpc client xmlrpc client Fault faultCode12213119 +Ref: 3c0f12213119 +Ref: library/xmlrpc client xmlrpc client Fault faultString12213195 +Ref: 3c1012213195 +Node: ProtocolError Objects12214157 +Ref: library/xmlrpc client protocol-error-objects12214302 +Ref: 3c1112214302 +Ref: library/xmlrpc client protocolerror-objects12214302 +Ref: 3c1212214302 +Ref: library/xmlrpc client xmlrpc client ProtocolError12214367 +Ref: 3bfe12214367 +Ref: library/xmlrpc client xmlrpc client ProtocolError url12214644 +Ref: 3c1312214644 +Ref: library/xmlrpc client xmlrpc client ProtocolError errcode12214721 +Ref: 3c1412214721 +Ref: library/xmlrpc client xmlrpc client ProtocolError errmsg12214777 +Ref: 3c1512214777 +Ref: library/xmlrpc client xmlrpc client ProtocolError headers12214856 +Ref: 3c1612214856 +Node: MultiCall Objects12215596 +Ref: library/xmlrpc client multicall-objects12215749 +Ref: 3c1712215749 +Ref: library/xmlrpc client xmlrpc client MultiCall12215932 +Ref: 3c1812215932 +Ref: MultiCall Objects-Footnote-112217638 +Node: Convenience Functions12217817 +Ref: library/xmlrpc client convenience-functions12217972 +Ref: 3c1912217972 +Ref: library/xmlrpc client xmlrpc client dumps12218037 +Ref: 3c1a12218037 +Ref: library/xmlrpc client xmlrpc client loads12218750 +Ref: 140012218750 +Node: Example of Client Usage12219618 +Ref: library/xmlrpc client example-of-client-usage12219790 +Ref: 3c1b12219790 +Ref: library/xmlrpc client xmlrpc-client-example12219790 +Ref: 3c1c12219790 +Node: Example of Client and Server Usage12221097 +Ref: library/xmlrpc client example-of-client-and-server-usage12221239 +Ref: 3c1d12221239 +Node: xmlrpc server — Basic XML-RPC servers12221375 +Ref: library/xmlrpc server doc12221582 +Ref: 3c1f12221582 +Ref: library/xmlrpc server module-xmlrpc server12221582 +Ref: 12f12221582 +Ref: library/xmlrpc server xmlrpc-server-basic-xml-rpc-servers12221582 +Ref: 3c2012221582 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer12222421 +Ref: 3c2112222421 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler12223945 +Ref: 3c2212223945 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler12224596 +Ref: 131a12224596 +Ref: xmlrpc server — Basic XML-RPC servers-Footnote-112225084 +Node: SimpleXMLRPCServer Objects12225157 +Ref: library/xmlrpc server simple-xmlrpc-servers12225291 +Ref: 3c2312225291 +Ref: library/xmlrpc server simplexmlrpcserver-objects12225291 +Ref: 3c2412225291 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_function12225527 +Ref: 3c2512225527 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_instance12226283 +Ref: 3c2612226283 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_introspection_functions12227899 +Ref: 3c2712227899 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCServer register_multicall_functions12228108 +Ref: 3c2812228108 +Ref: library/xmlrpc server xmlrpc server SimpleXMLRPCRequestHandler rpc_paths12228237 +Ref: 3c2912228237 +Node: SimpleXMLRPCServer Example12228657 +Ref: library/xmlrpc server id112228746 +Ref: 3c2a12228746 +Ref: library/xmlrpc server simplexmlrpcserver-example12228746 +Ref: 3c1e12228746 +Node: CGIXMLRPCRequestHandler12233263 +Ref: library/xmlrpc server cgixmlrpcrequesthandler12233431 +Ref: 3c2b12233431 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_function12233615 +Ref: 3c2c12233615 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_instance12234376 +Ref: 3c2d12234376 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_introspection_functions12235261 +Ref: 3c2e12235261 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler register_multicall_functions12235474 +Ref: 3c2f12235474 +Ref: library/xmlrpc server xmlrpc server CGIXMLRPCRequestHandler handle_request12235613 +Ref: 3c3012235613 +Node: Documenting XMLRPC server12236200 +Ref: library/xmlrpc server documenting-xmlrpc-server12236365 +Ref: 3c3112236365 +Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer12236693 +Ref: 19bd12236693 +Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler12237171 +Ref: 3c3212237171 +Ref: library/xmlrpc server xmlrpc server DocXMLRPCRequestHandler12237306 +Ref: 3c3312237306 +Node: DocXMLRPCServer Objects12237625 +Ref: library/xmlrpc server doc-xmlrpc-servers12237793 +Ref: 3c3412237793 +Ref: library/xmlrpc server docxmlrpcserver-objects12237793 +Ref: 3c3512237793 +Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_title12238230 +Ref: 3c3612238230 +Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_name12238420 +Ref: 3c3712238420 +Ref: library/xmlrpc server xmlrpc server DocXMLRPCServer set_server_documentation12238642 +Ref: 3c3812238642 +Node: DocCGIXMLRPCRequestHandler12238898 +Ref: library/xmlrpc server doccgixmlrpcrequesthandler12239032 +Ref: 3c3912239032 +Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_title12239483 +Ref: 3c3a12239483 +Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_name12239684 +Ref: 3c3b12239684 +Ref: library/xmlrpc server xmlrpc server DocCGIXMLRPCRequestHandler set_server_documentation12239917 +Ref: 3c3c12239917 +Node: ipaddress — IPv4/IPv6 manipulation library12240184 +Ref: library/ipaddress doc12240343 +Ref: 3c3d12240343 +Ref: library/ipaddress ipaddress-ipv4-ipv6-manipulation-library12240343 +Ref: 3c3e12240343 +Ref: library/ipaddress module-ipaddress12240343 +Ref: 8012240343 +Ref: ipaddress — IPv4/IPv6 manipulation library-Footnote-112241368 +Node: Convenience factory functions12241437 +Ref: library/ipaddress convenience-factory-functions12241568 +Ref: 3c4012241568 +Ref: library/ipaddress ipaddress ip_address12241771 +Ref: 3c4112241771 +Ref: library/ipaddress ipaddress ip_network12242356 +Ref: 3c4212242356 +Ref: library/ipaddress ipaddress ip_interface12243071 +Ref: 3c4312243071 +Node: IP Addresses12243930 +Ref: library/ipaddress ip-addresses12244092 +Ref: 3c4412244092 +Node: Address objects12244235 +Ref: library/ipaddress address-objects12244342 +Ref: 3c4512244342 +Ref: library/ipaddress ipaddress IPv4Address12244781 +Ref: 1fe12244781 +Ref: library/ipaddress ipaddress IPv4Address version12246071 +Ref: 3c4712246071 +Ref: library/ipaddress ipaddress IPv4Address max_prefixlen12246179 +Ref: 3c4812246179 +Ref: library/ipaddress ipaddress IPv4Address compressed12246517 +Ref: 3c4912246517 +Ref: library/ipaddress ipaddress IPv4Address exploded12246549 +Ref: 3c4a12246549 +Ref: library/ipaddress ipaddress IPv4Address packed12247038 +Ref: 3c4b12247038 +Ref: library/ipaddress ipaddress IPv4Address reverse_pointer12247275 +Ref: 3c4c12247275 +Ref: library/ipaddress ipaddress IPv4Address is_multicast12247822 +Ref: 3c4d12247822 +Ref: library/ipaddress ipaddress IPv4Address is_private12247989 +Ref: 164912247989 +Ref: library/ipaddress ipaddress IPv4Address is_global12249639 +Ref: f5a12249639 +Ref: library/ipaddress ipaddress IPv4Address is_unspecified12250554 +Ref: 3c4f12250554 +Ref: library/ipaddress ipaddress IPv4Address is_reserved12250708 +Ref: 3c5012250708 +Ref: library/ipaddress ipaddress IPv4Address is_loopback12251413 +Ref: 3c5212251413 +Ref: library/ipaddress ipaddress IPv4Address is_link_local12251566 +Ref: 3c5312251566 +Ref: library/ipaddress ipaddress IPv4Address ipv6_mapped12251701 +Ref: 1fd12251701 +Ref: library/ipaddress ipaddress IPv4Address __format__12251882 +Ref: 3c5412251882 +Ref: library/ipaddress ipaddress IPv6Address12253132 +Ref: 1ff12253132 +Ref: library/ipaddress ipaddress IPv6Address compressed12254505 +Ref: 3c5512254505 +Ref: library/ipaddress ipaddress IPv6Address exploded12254814 +Ref: 3c5612254814 +Ref: library/ipaddress ipaddress IPv6Address packed12255102 +Ref: 3c5712255102 +Ref: library/ipaddress ipaddress IPv6Address reverse_pointer12255130 +Ref: 15d612255130 +Ref: library/ipaddress ipaddress IPv6Address version12255167 +Ref: 3c5812255167 +Ref: library/ipaddress ipaddress IPv6Address max_prefixlen12255196 +Ref: 3c5912255196 +Ref: library/ipaddress ipaddress IPv6Address is_multicast12255231 +Ref: 3c5a12255231 +Ref: library/ipaddress ipaddress IPv6Address is_private12255265 +Ref: 164a12255265 +Ref: library/ipaddress ipaddress IPv6Address is_global12255297 +Ref: 164b12255297 +Ref: library/ipaddress ipaddress IPv6Address is_unspecified12255361 +Ref: 3c5b12255361 +Ref: library/ipaddress ipaddress IPv6Address is_reserved12255397 +Ref: 3c5c12255397 +Ref: library/ipaddress ipaddress IPv6Address is_loopback12255430 +Ref: 163412255430 +Ref: library/ipaddress ipaddress IPv6Address is_link_local12255463 +Ref: 3c5d12255463 +Ref: library/ipaddress ipaddress IPv6Address is_site_local12255498 +Ref: 3c5112255498 +Ref: library/ipaddress ipaddress IPv6Address ipv4_mapped12255844 +Ref: 3c4e12255844 +Ref: library/ipaddress ipaddress IPv6Address scope_id12256116 +Ref: 90d12256116 +Ref: library/ipaddress ipaddress IPv6Address sixtofour12256416 +Ref: 3c5e12256416 +Ref: library/ipaddress ipaddress IPv6Address teredo12256706 +Ref: 3c5f12256706 +Ref: library/ipaddress ipaddress IPv6Address __format__12257020 +Ref: 3c6012257020 +Ref: Address objects-Footnote-112257212 +Ref: Address objects-Footnote-212257271 +Ref: Address objects-Footnote-312257330 +Ref: Address objects-Footnote-412257432 +Ref: Address objects-Footnote-512257534 +Ref: Address objects-Footnote-612257636 +Ref: Address objects-Footnote-712257738 +Ref: Address objects-Footnote-812257797 +Ref: Address objects-Footnote-912257856 +Ref: Address objects-Footnote-1012257942 +Ref: Address objects-Footnote-1112258045 +Ref: Address objects-Footnote-1212258105 +Ref: Address objects-Footnote-1312258165 +Ref: Address objects-Footnote-1412258225 +Ref: Address objects-Footnote-1512258285 +Ref: Address objects-Footnote-1612258345 +Ref: Address objects-Footnote-1712258405 +Ref: Address objects-Footnote-1812258465 +Ref: Address objects-Footnote-1912258525 +Ref: Address objects-Footnote-2012258585 +Ref: Address objects-Footnote-2112258645 +Ref: Address objects-Footnote-2212258705 +Node: Conversion to Strings and Integers12258765 +Ref: library/ipaddress conversion-to-strings-and-integers12258893 +Ref: 3c6112258893 +Node: Operators<3>12259517 +Ref: library/ipaddress operators12259621 +Ref: 3c6212259621 +Node: Comparison operators12259886 +Ref: library/ipaddress comparison-operators12259984 +Ref: 3c6312259984 +Node: Arithmetic operators12260578 +Ref: library/ipaddress arithmetic-operators12260676 +Ref: 3c6412260676 +Node: IP Network definitions12261179 +Ref: library/ipaddress ip-network-definitions12261329 +Ref: 3c6512261329 +Node: Prefix net mask and host mask12262039 +Ref: library/ipaddress prefix-net-mask-and-host-mask12262151 +Ref: 3c6612262151 +Node: Network objects12262821 +Ref: library/ipaddress network-objects12262954 +Ref: 3c6712262954 +Ref: library/ipaddress ipaddress IPv4Network12263412 +Ref: 20012263412 +Ref: library/ipaddress ipaddress IPv4Network version12265835 +Ref: 3c6912265835 +Ref: library/ipaddress ipaddress IPv4Network max_prefixlen12265864 +Ref: 3c6a12265864 +Ref: library/ipaddress ipaddress IPv4Network is_multicast12265998 +Ref: 3c6b12265998 +Ref: library/ipaddress ipaddress IPv4Network is_private12266032 +Ref: 3c6c12266032 +Ref: library/ipaddress ipaddress IPv4Network is_unspecified12266064 +Ref: 3c6d12266064 +Ref: library/ipaddress ipaddress IPv4Network is_reserved12266100 +Ref: 3c6e12266100 +Ref: library/ipaddress ipaddress IPv4Network is_loopback12266133 +Ref: 3c6f12266133 +Ref: library/ipaddress ipaddress IPv4Network is_link_local12266166 +Ref: 3c7012266166 +Ref: library/ipaddress ipaddress IPv4Network network_address12266358 +Ref: 3c7112266358 +Ref: library/ipaddress ipaddress IPv4Network broadcast_address12266532 +Ref: 3c7212266532 +Ref: library/ipaddress ipaddress IPv4Network hostmask12266729 +Ref: 3c7312266729 +Ref: library/ipaddress ipaddress IPv4Network netmask12266823 +Ref: 3c7412266823 +Ref: library/ipaddress ipaddress IPv4Network with_prefixlen12266915 +Ref: 3c7512266915 +Ref: library/ipaddress ipaddress IPv4Network compressed12266951 +Ref: 3c7612266951 +Ref: library/ipaddress ipaddress IPv4Network exploded12266983 +Ref: 3c7712266983 +Ref: library/ipaddress ipaddress IPv4Network with_netmask12267284 +Ref: 3c7812267284 +Ref: library/ipaddress ipaddress IPv4Network with_hostmask12267415 +Ref: 3c7912267415 +Ref: library/ipaddress ipaddress IPv4Network num_addresses12267548 +Ref: 3c7a12267548 +Ref: library/ipaddress ipaddress IPv4Network prefixlen12267640 +Ref: 3c7b12267640 +Ref: library/ipaddress ipaddress IPv4Network hosts12267721 +Ref: 3c7c12267721 +Ref: library/ipaddress ipaddress IPv4Network overlaps12268718 +Ref: 3c7d12268718 +Ref: library/ipaddress ipaddress IPv4Network address_exclude12268890 +Ref: 3c7e12268890 +Ref: library/ipaddress ipaddress IPv4Network subnets12269496 +Ref: e9912269496 +Ref: library/ipaddress ipaddress IPv4Network supernet12271044 +Ref: e9a12271044 +Ref: library/ipaddress ipaddress IPv4Network subnet_of12271850 +Ref: 3c7f12271850 +Ref: library/ipaddress ipaddress IPv4Network supernet_of12272149 +Ref: 3c8012272149 +Ref: library/ipaddress ipaddress IPv4Network compare_networks12272454 +Ref: 3c8112272454 +Ref: library/ipaddress ipaddress IPv6Network12273152 +Ref: 20112273152 +Ref: library/ipaddress ipaddress IPv6Network version12274959 +Ref: 3c8212274959 +Ref: library/ipaddress ipaddress IPv6Network max_prefixlen12274988 +Ref: 3c8312274988 +Ref: library/ipaddress ipaddress IPv6Network is_multicast12275023 +Ref: 3c8412275023 +Ref: library/ipaddress ipaddress IPv6Network is_private12275057 +Ref: 3c8512275057 +Ref: library/ipaddress ipaddress IPv6Network is_unspecified12275089 +Ref: 3c8612275089 +Ref: library/ipaddress ipaddress IPv6Network is_reserved12275125 +Ref: 3c8712275125 +Ref: library/ipaddress ipaddress IPv6Network is_loopback12275158 +Ref: 3c8812275158 +Ref: library/ipaddress ipaddress IPv6Network is_link_local12275191 +Ref: 3c8912275191 +Ref: library/ipaddress ipaddress IPv6Network network_address12275226 +Ref: 3c8a12275226 +Ref: library/ipaddress ipaddress IPv6Network broadcast_address12275263 +Ref: 3c8b12275263 +Ref: library/ipaddress ipaddress IPv6Network hostmask12275302 +Ref: 3c8c12275302 +Ref: library/ipaddress ipaddress IPv6Network netmask12275332 +Ref: 3c8d12275332 +Ref: library/ipaddress ipaddress IPv6Network with_prefixlen12275361 +Ref: 3c8e12275361 +Ref: library/ipaddress ipaddress IPv6Network compressed12275397 +Ref: 3c8f12275397 +Ref: library/ipaddress ipaddress IPv6Network exploded12275429 +Ref: 3c9012275429 +Ref: library/ipaddress ipaddress IPv6Network with_netmask12275459 +Ref: 3c9112275459 +Ref: library/ipaddress ipaddress IPv6Network with_hostmask12275493 +Ref: 3c9212275493 +Ref: library/ipaddress ipaddress IPv6Network num_addresses12275528 +Ref: 3c9312275528 +Ref: library/ipaddress ipaddress IPv6Network prefixlen12275563 +Ref: 3c9412275563 +Ref: library/ipaddress ipaddress IPv6Network hosts12275594 +Ref: 3c9512275594 +Ref: library/ipaddress ipaddress IPv6Network overlaps12276044 +Ref: 3c9612276044 +Ref: library/ipaddress ipaddress IPv6Network address_exclude12276079 +Ref: 3c9712276079 +Ref: library/ipaddress ipaddress IPv6Network subnets12276123 +Ref: 3c9812276123 +Ref: library/ipaddress ipaddress IPv6Network supernet12276185 +Ref: 3c9912276185 +Ref: library/ipaddress ipaddress IPv6Network subnet_of12276248 +Ref: 3c9a12276248 +Ref: library/ipaddress ipaddress IPv6Network supernet_of12276284 +Ref: 3c9b12276284 +Ref: library/ipaddress ipaddress IPv6Network compare_networks12276322 +Ref: 3c9c12276322 +Ref: library/ipaddress ipaddress IPv6Network is_site_local12276464 +Ref: 3c9d12276464 +Node: Operators<4>12276641 +Ref: library/ipaddress id112276736 +Ref: 3c9e12276736 +Node: Logical operators12277029 +Ref: library/ipaddress logical-operators12277113 +Ref: 3c9f12277113 +Node: Iteration12277318 +Ref: library/ipaddress iteration12277446 +Ref: 3ca012277446 +Node: Networks as containers of addresses12278274 +Ref: library/ipaddress networks-as-containers-of-addresses12278376 +Ref: 3ca112278376 +Node: Interface objects12278834 +Ref: library/ipaddress interface-objects12279000 +Ref: 3ca212279000 +Ref: library/ipaddress ipaddress IPv4Interface12279148 +Ref: 180d12279148 +Ref: library/ipaddress ipaddress IPv4Interface ip12279564 +Ref: 3ca312279564 +Ref: library/ipaddress ipaddress IPv4Interface network12279810 +Ref: 3ca412279810 +Ref: library/ipaddress ipaddress IPv4Interface with_prefixlen12280067 +Ref: 3ca512280067 +Ref: library/ipaddress ipaddress IPv4Interface with_netmask12280335 +Ref: 3ca612280335 +Ref: library/ipaddress ipaddress IPv4Interface with_hostmask12280608 +Ref: 3ca712280608 +Ref: library/ipaddress ipaddress IPv6Interface12280880 +Ref: 180e12280880 +Ref: library/ipaddress ipaddress IPv6Interface ip12281296 +Ref: 3ca812281296 +Ref: library/ipaddress ipaddress IPv6Interface network12281320 +Ref: 3ca912281320 +Ref: library/ipaddress ipaddress IPv6Interface with_prefixlen12281349 +Ref: 3caa12281349 +Ref: library/ipaddress ipaddress IPv6Interface with_netmask12281385 +Ref: 3cab12281385 +Ref: library/ipaddress ipaddress IPv6Interface with_hostmask12281419 +Ref: 3cac12281419 +Node: Operators<5>12281593 +Ref: library/ipaddress id212281659 +Ref: 3cad12281659 +Node: Logical operators<2>12281921 +Ref: library/ipaddress id312281990 +Ref: 3cae12281990 +Node: Other Module Level Functions12282647 +Ref: library/ipaddress other-module-level-functions12282808 +Ref: 3caf12282808 +Ref: library/ipaddress ipaddress v4_int_to_packed12282953 +Ref: 3cb012282953 +Ref: library/ipaddress ipaddress v6_int_to_packed12283427 +Ref: 3cb112283427 +Ref: library/ipaddress ipaddress summarize_address_range12283736 +Ref: e9b12283736 +Ref: library/ipaddress ipaddress collapse_addresses12284615 +Ref: e9c12284615 +Ref: library/ipaddress ipaddress get_mixed_type_key12285196 +Ref: 3cb212285196 +Node: Custom Exceptions12285795 +Ref: library/ipaddress custom-exceptions12285930 +Ref: 3cb312285930 +Ref: library/ipaddress ipaddress AddressValueError12286101 +Ref: 3c4612286101 +Ref: library/ipaddress ipaddress NetmaskValueError12286204 +Ref: 3c6812286204 +Node: Multimedia Services12286308 +Ref: library/mm doc12286459 +Ref: 3cb412286459 +Ref: library/mm mmedia12286459 +Ref: 3cb512286459 +Ref: library/mm multimedia-services12286459 +Ref: 3cb612286459 +Node: wave — Read and write WAV files12286825 +Ref: library/wave doc12286969 +Ref: 3cb712286969 +Ref: library/wave module-wave12286969 +Ref: 11312286969 +Ref: library/wave wave-read-and-write-wav-files12286969 +Ref: 3cb812286969 +Ref: library/wave wave open12287566 +Ref: 94b12287566 +Ref: library/wave wave Error12288629 +Ref: 3cbb12288629 +Ref: wave — Read and write WAV files-Footnote-112288883 +Node: Wave_read Objects12288947 +Ref: library/wave id112289061 +Ref: 3cbc12289061 +Ref: library/wave wave-read-objects12289061 +Ref: 3cbd12289061 +Ref: library/wave wave Wave_read12289116 +Ref: 2b812289116 +Ref: library/wave wave Wave_read close12289258 +Ref: 3cb912289258 +Ref: library/wave wave Wave_read getnchannels12289454 +Ref: 3cbe12289454 +Ref: library/wave wave Wave_read getsampwidth12289582 +Ref: 3cbf12289582 +Ref: library/wave wave Wave_read getframerate12289658 +Ref: 3cc012289658 +Ref: library/wave wave Wave_read getnframes12289731 +Ref: 3cc112289731 +Ref: library/wave wave Wave_read getcomptype12289806 +Ref: 3cc212289806 +Ref: library/wave wave Wave_read getcompname12289928 +Ref: 3cc312289928 +Ref: library/wave wave Wave_read getparams12290091 +Ref: 3cc412290091 +Ref: library/wave wave Wave_read readframes12290308 +Ref: 3cc512290308 +Ref: library/wave wave Wave_read rewind12290440 +Ref: 3cc612290440 +Ref: library/wave wave Wave_read getmarkers12290677 +Ref: 2b712290677 +Ref: library/wave wave Wave_read getmark12290943 +Ref: 2b612290943 +Ref: library/wave wave Wave_read setpos12291347 +Ref: 3cc712291347 +Ref: library/wave wave Wave_read tell12291437 +Ref: 3cc812291437 +Node: Wave_write Objects12291512 +Ref: library/wave id212291626 +Ref: 3cc912291626 +Ref: library/wave wave-write-objects12291626 +Ref: fe412291626 +Ref: library/wave wave Wave_write12291683 +Ref: 2b912291683 +Ref: library/wave wave Wave_write close12292714 +Ref: 3cba12292714 +Ref: library/wave wave Wave_write setnchannels12293060 +Ref: 3ccc12293060 +Ref: library/wave wave Wave_write setsampwidth12293134 +Ref: 3ccd12293134 +Ref: library/wave wave Wave_write setframerate12293215 +Ref: 3cce12293215 +Ref: library/wave wave Wave_write setnframes12293404 +Ref: 3cca12293404 +Ref: library/wave wave Wave_write setcomptype12293673 +Ref: 3ccf12293673 +Ref: library/wave wave Wave_write setparams12293866 +Ref: 3ccb12293866 +Ref: library/wave wave Wave_write tell12294095 +Ref: 3cd012294095 +Ref: library/wave wave Wave_write writeframesraw12294297 +Ref: fe512294297 +Ref: library/wave wave Wave_write writeframes12294494 +Ref: fe612294494 +Node: colorsys — Conversions between color systems12295142 +Ref: library/colorsys doc12295286 +Ref: 3cd112295286 +Ref: library/colorsys colorsys-conversions-between-color-systems12295286 +Ref: 3cd212295286 +Ref: library/colorsys module-colorsys12295286 +Ref: 1f12295286 +Ref: library/colorsys colorsys rgb_to_yiq12296273 +Ref: 3cd312296273 +Ref: library/colorsys colorsys yiq_to_rgb12296383 +Ref: 3cd412296383 +Ref: library/colorsys colorsys rgb_to_hls12296493 +Ref: 170112296493 +Ref: library/colorsys colorsys hls_to_rgb12296603 +Ref: 3cd512296603 +Ref: library/colorsys colorsys rgb_to_hsv12296713 +Ref: 3cd612296713 +Ref: library/colorsys colorsys hsv_to_rgb12296823 +Ref: 3cd712296823 +Ref: colorsys — Conversions between color systems-Footnote-112297135 +Node: Internationalization12297203 +Ref: library/i18n doc12297342 +Ref: 3cd812297342 +Ref: library/i18n i18n12297342 +Ref: 3cd912297342 +Ref: library/i18n internationalization12297342 +Ref: 3cda12297342 +Node: gettext — Multilingual internationalization services12297797 +Ref: library/gettext doc12297957 +Ref: 3cdb12297957 +Ref: library/gettext gettext-multilingual-internationalization-services12297957 +Ref: 3cdc12297957 +Ref: library/gettext module-gettext12297957 +Ref: 6312297957 +Ref: gettext — Multilingual internationalization services-Footnote-112298934 +Node: GNU gettext API12299001 +Ref: library/gettext gnu-gettext-api12299131 +Ref: 3cdd12299131 +Ref: library/gettext gettext bindtextdomain12299675 +Ref: 3cde12299675 +Ref: library/gettext gettext textdomain12300247 +Ref: 3cdf12300247 +Ref: library/gettext gettext gettext12300493 +Ref: 143212300493 +Ref: library/gettext gettext dgettext12300762 +Ref: 3ce012300762 +Ref: library/gettext gettext ngettext12300902 +Ref: 3ce112300902 +Ref: library/gettext gettext dngettext12301613 +Ref: 3ce212301613 +Ref: library/gettext gettext pgettext12301767 +Ref: 9f412301767 +Ref: library/gettext gettext dpgettext12301818 +Ref: 3ce312301818 +Ref: library/gettext gettext npgettext12301878 +Ref: 3ce412301878 +Ref: library/gettext gettext dnpgettext12301942 +Ref: 3ce512301942 +Ref: GNU gettext API-Footnote-112302761 +Ref: GNU gettext API-Footnote-212303241 +Node: Class-based API12303306 +Ref: library/gettext class-based-api12303489 +Ref: 3ce612303489 +Ref: library/gettext gettext find12304019 +Ref: 3ce812304019 +Ref: library/gettext gettext translation12305468 +Ref: a7912305468 +Ref: library/gettext gettext install12306707 +Ref: a7a12306707 +Ref: Class-based API-Footnote-112307742 +Node: The NullTranslations class12307808 +Ref: library/gettext the-nulltranslations-class12307920 +Ref: 3ceb12307920 +Ref: library/gettext gettext NullTranslations12308365 +Ref: 3ce912308365 +Ref: library/gettext gettext NullTranslations _parse12308765 +Ref: 3ced12308765 +Ref: library/gettext gettext NullTranslations add_fallback12309076 +Ref: 3cec12309076 +Ref: library/gettext gettext NullTranslations gettext12309339 +Ref: 3cee12309339 +Ref: library/gettext gettext NullTranslations ngettext12309537 +Ref: 3cef12309537 +Ref: library/gettext gettext NullTranslations pgettext12309789 +Ref: 3cf012309789 +Ref: library/gettext gettext NullTranslations npgettext12310049 +Ref: 3cf112310049 +Ref: library/gettext gettext NullTranslations info12310324 +Ref: 3cf212310324 +Ref: library/gettext gettext NullTranslations charset12310450 +Ref: 3cf312310450 +Ref: library/gettext gettext NullTranslations install12310539 +Ref: 3cea12310539 +Node: The GNUTranslations class12311731 +Ref: library/gettext the-gnutranslations-class12311883 +Ref: 3cf412311883 +Ref: library/gettext gettext GNUTranslations12313388 +Ref: 3ce712313388 +Ref: library/gettext gettext GNUTranslations gettext12313508 +Ref: 3cf512313508 +Ref: library/gettext gettext GNUTranslations ngettext12313917 +Ref: 3cf612313917 +Ref: library/gettext gettext GNUTranslations pgettext12314841 +Ref: 3cf712314841 +Ref: library/gettext gettext GNUTranslations npgettext12315319 +Ref: 3cf812315319 +Ref: The GNUTranslations class-Footnote-112315968 +Node: Solaris message catalog support12316026 +Ref: library/gettext solaris-message-catalog-support12316175 +Ref: 3cf912316175 +Node: The Catalog constructor12316424 +Ref: library/gettext the-catalog-constructor12316539 +Ref: 3cfa12316539 +Node: Internationalizing your programs and modules12317197 +Ref: library/gettext i18n-howto12317384 +Ref: 2ed112317384 +Ref: library/gettext internationalizing-your-programs-and-modules12317384 +Ref: 3cfb12317384 +Ref: Internationalizing your programs and modules-Footnote-112320964 +Ref: Internationalizing your programs and modules-Footnote-212320997 +Node: Localizing your module12321040 +Ref: library/gettext localizing-your-module12321179 +Ref: 3cfc12321179 +Node: Localizing your application12321774 +Ref: library/gettext localizing-your-application12321951 +Ref: 3cfd12321951 +Node: Changing languages on the fly12322679 +Ref: library/gettext changing-languages-on-the-fly12322855 +Ref: 3cfe12322855 +Node: Deferred translations12323534 +Ref: library/gettext deferred-translations12323674 +Ref: 3cff12323674 +Node: Acknowledgements<9>12325914 +Ref: library/gettext acknowledgements12326077 +Ref: 3d0012326077 +Node: locale — Internationalization services12326473 +Ref: library/locale doc12326633 +Ref: 3d0112326633 +Ref: library/locale locale-internationalization-services12326633 +Ref: 3d0212326633 +Ref: library/locale module-locale12326633 +Ref: 8612326633 +Ref: library/locale locale Error12327361 +Ref: 3d0312327361 +Ref: library/locale locale setlocale12327487 +Ref: 2df12327487 +Ref: library/locale locale localeconv12328834 +Ref: bfe12328834 +Ref: library/locale locale nl_langinfo12337135 +Ref: 3d0812337135 +Ref: library/locale locale CODESET12337656 +Ref: 3d0912337656 +Ref: library/locale locale D_T_FMT12337790 +Ref: 3d0a12337790 +Ref: library/locale locale D_FMT12337987 +Ref: 3d0b12337987 +Ref: library/locale locale T_FMT12338175 +Ref: 3d0c12338175 +Ref: library/locale locale T_FMT_AMPM12338363 +Ref: 3d0d12338363 +Ref: library/locale locale DAY_112338510 +Ref: 3d0e12338510 +Ref: library/locale locale DAY_212338538 +Ref: 3d0f12338538 +Ref: library/locale locale DAY_312338566 +Ref: 3d1012338566 +Ref: library/locale locale DAY_412338594 +Ref: 3d1112338594 +Ref: library/locale locale DAY_512338622 +Ref: 3d1212338622 +Ref: library/locale locale DAY_612338650 +Ref: 3d1312338650 +Ref: library/locale locale DAY_712338678 +Ref: 3d1412338678 +Ref: library/locale locale ABDAY_112338965 +Ref: 3d1512338965 +Ref: library/locale locale ABDAY_212338995 +Ref: 3d1612338995 +Ref: library/locale locale ABDAY_312339025 +Ref: 3d1712339025 +Ref: library/locale locale ABDAY_412339055 +Ref: 3d1812339055 +Ref: library/locale locale ABDAY_512339085 +Ref: 3d1912339085 +Ref: library/locale locale ABDAY_612339115 +Ref: 3d1a12339115 +Ref: library/locale locale ABDAY_712339145 +Ref: 3d1b12339145 +Ref: library/locale locale MON_112339241 +Ref: 3d1c12339241 +Ref: library/locale locale MON_212339269 +Ref: 3d1d12339269 +Ref: library/locale locale MON_312339297 +Ref: 3d1e12339297 +Ref: library/locale locale MON_412339325 +Ref: 3d1f12339325 +Ref: library/locale locale MON_512339353 +Ref: 3d2012339353 +Ref: library/locale locale MON_612339381 +Ref: 3d2112339381 +Ref: library/locale locale MON_712339409 +Ref: 3d2212339409 +Ref: library/locale locale MON_812339437 +Ref: 3d2312339437 +Ref: library/locale locale MON_912339465 +Ref: 3d2412339465 +Ref: library/locale locale MON_1012339493 +Ref: 3d2512339493 +Ref: library/locale locale MON_1112339522 +Ref: 3d2612339522 +Ref: library/locale locale MON_1212339551 +Ref: 3d2712339551 +Ref: library/locale locale ABMON_112339624 +Ref: 3d2812339624 +Ref: library/locale locale ABMON_212339654 +Ref: 3d2912339654 +Ref: library/locale locale ABMON_312339684 +Ref: 3d2a12339684 +Ref: library/locale locale ABMON_412339714 +Ref: 3d2b12339714 +Ref: library/locale locale ABMON_512339744 +Ref: 3d2c12339744 +Ref: library/locale locale ABMON_612339774 +Ref: 3d2d12339774 +Ref: library/locale locale ABMON_712339804 +Ref: 3d2e12339804 +Ref: library/locale locale ABMON_812339834 +Ref: 3d2f12339834 +Ref: library/locale locale ABMON_912339864 +Ref: 3d3012339864 +Ref: library/locale locale ABMON_1012339894 +Ref: 3d3112339894 +Ref: library/locale locale ABMON_1112339925 +Ref: 3d3212339925 +Ref: library/locale locale ABMON_1212339956 +Ref: 3d3312339956 +Ref: library/locale locale RADIXCHAR12340043 +Ref: 3d3412340043 +Ref: library/locale locale THOUSEP12340147 +Ref: 3d3512340147 +Ref: library/locale locale YESEXPR12340267 +Ref: 3d3612340267 +Ref: library/locale locale NOEXPR12340450 +Ref: 3d3712340450 +Ref: library/locale locale CRNCYSTR12340907 +Ref: 3d3812340907 +Ref: library/locale locale ERA12341185 +Ref: 3d3912341185 +Ref: library/locale locale ERA_D_T_FMT12342004 +Ref: 3d3a12342004 +Ref: library/locale locale ERA_D_FMT12342176 +Ref: 3d3b12342176 +Ref: library/locale locale ERA_T_FMT12342339 +Ref: 3d3c12342339 +Ref: library/locale locale ALT_DIGITS12342502 +Ref: 3d3d12342502 +Ref: library/locale locale getdefaultlocale12342737 +Ref: 2dd12342737 +Ref: library/locale locale getlocale12344111 +Ref: 2de12344111 +Ref: library/locale locale getpreferredencoding12344687 +Ref: 53612344687 +Ref: library/locale locale getencoding12345769 +Ref: 2e012345769 +Ref: library/locale locale normalize12346543 +Ref: 3d4112346543 +Ref: library/locale locale strcoll12346963 +Ref: 3d4212346963 +Ref: library/locale locale strxfrm12347282 +Ref: 3d4412347282 +Ref: library/locale locale format_string12347626 +Ref: 51a12347626 +Ref: library/locale locale currency12348328 +Ref: 3d4512348328 +Ref: library/locale locale str12348975 +Ref: 3d4612348975 +Ref: library/locale locale delocalize12349164 +Ref: e2412349164 +Ref: library/locale locale localize12349344 +Ref: 3d4712349344 +Ref: library/locale locale atof12349564 +Ref: 3d4812349564 +Ref: library/locale locale atoi12349788 +Ref: 3d4912349788 +Ref: library/locale locale LC_CTYPE12349919 +Ref: 3d3f12349919 +Ref: library/locale locale LC_COLLATE12350588 +Ref: 3d4312350588 +Ref: library/locale locale LC_TIME12350781 +Ref: 3d4a12350781 +Ref: library/locale locale LC_MONETARY12350932 +Ref: 3d0712350932 +Ref: library/locale locale LC_MESSAGES12351105 +Ref: 3d4b12351105 +Ref: library/locale locale LC_NUMERIC12351527 +Ref: 3d0512351527 +Ref: library/locale locale LC_ALL12351850 +Ref: 3d3e12351850 +Ref: library/locale locale CHAR_MAX12352275 +Ref: 3d0612352275 +Ref: locale — Internationalization services-Footnote-112353143 +Ref: locale — Internationalization services-Footnote-212353209 +Ref: locale — Internationalization services-Footnote-312353307 +Ref: locale — Internationalization services-Footnote-412353349 +Node: Background details hints tips and caveats12353391 +Ref: library/locale background-details-hints-tips-and-caveats12353530 +Ref: 3d4c12353530 +Node: Locale names12355737 +Ref: library/locale locale-name12355937 +Ref: 3d0412355937 +Ref: library/locale locale-names12355937 +Ref: 3d4d12355937 +Ref: Locale names-Footnote-112357607 +Ref: Locale names-Footnote-212357757 +Ref: Locale names-Footnote-312357807 +Ref: Locale names-Footnote-412357863 +Ref: Locale names-Footnote-512358036 +Ref: Locale names-Footnote-612358125 +Ref: Locale names-Footnote-712358171 +Node: For extension writers and programs that embed Python12358213 +Ref: library/locale embedding-locale12358398 +Ref: 3d4e12358398 +Ref: library/locale for-extension-writers-and-programs-that-embed-python12358398 +Ref: 3d4f12358398 +Node: Access to message catalogs12359195 +Ref: library/locale access-to-message-catalogs12359359 +Ref: 3d5012359359 +Ref: library/locale locale-gettext12359359 +Ref: 3d5112359359 +Ref: library/locale locale gettext12359432 +Ref: 3d5212359432 +Ref: library/locale locale dgettext12359468 +Ref: 3d5312359468 +Ref: library/locale locale dcgettext12359513 +Ref: 3d5412359513 +Ref: library/locale locale textdomain12359569 +Ref: 3d5512359569 +Ref: library/locale locale bindtextdomain12359611 +Ref: 3d5612359611 +Ref: library/locale locale bind_textdomain_codeset12359662 +Ref: 3d5712359662 +Node: Program Frameworks12360649 +Ref: library/frameworks doc12360802 +Ref: 3d5812360802 +Ref: library/frameworks frameworks12360802 +Ref: 3d5912360802 +Ref: library/frameworks program-frameworks12360802 +Ref: 3d5a12360802 +Node: turtle — Turtle graphics12361251 +Ref: library/turtle doc12361395 +Ref: 3d5b12361395 +Ref: library/turtle module-turtle12361395 +Ref: 10112361395 +Ref: library/turtle turtle-turtle-graphics12361395 +Ref: 3d5c12361395 +Ref: turtle — Turtle graphics-Footnote-112362076 +Node: Introduction<11>12362142 +Ref: library/turtle introduction12362241 +Ref: 3d5d12362241 +Ref: Introduction<11>-Footnote-112362495 +Node: Get started12362548 +Ref: library/turtle get-started12362667 +Ref: 3d5e12362667 +Node: Tutorial<4>12363853 +Ref: library/turtle turtle-tutorial12363965 +Ref: 3d5f12363965 +Ref: library/turtle tutorial12363965 +Ref: 3d6012363965 +Node: Starting a turtle environment12364198 +Ref: library/turtle starting-a-turtle-environment12364297 +Ref: 3d6112364297 +Node: Basic drawing12364610 +Ref: library/turtle basic-drawing12364745 +Ref: 3d6212364745 +Node: Pen control12365384 +Ref: library/turtle pen-control12365477 +Ref: 3d6312365477 +Node: The turtle’s position12365805 +Ref: library/turtle the-turtle-s-position12365898 +Ref: 3d6412365898 +Node: Making algorithmic patterns12366341 +Ref: library/turtle making-algorithmic-patterns12366438 +Ref: 3d6512366438 +Node: How to…12367415 +Ref: library/turtle how-to12367541 +Ref: 3d6612367541 +Ref: library/turtle turtle-how-to12367541 +Ref: 3d6712367541 +Node: Get started as quickly as possible12367806 +Ref: library/turtle get-started-as-quickly-as-possible12367926 +Ref: 3d6812367926 +Ref: library/turtle note12368682 +Ref: 3d6a12368682 +Node: Use the turtle module namespace12368954 +Ref: library/turtle use-the-turtle-module-namespace12369114 +Ref: 3d6b12369114 +Node: Use turtle graphics in a script12369782 +Ref: library/turtle use-turtle-graphics-in-a-script12369943 +Ref: 3d6c12369943 +Node: Use object-oriented turtle graphics12370637 +Ref: library/turtle use-object-oriented-turtle-graphics12370758 +Ref: 3d6d12370758 +Node: Turtle graphics reference12371988 +Ref: library/turtle turtle-graphics-reference12372158 +Ref: 3d7012372158 +Node: Turtle methods12372476 +Ref: library/turtle turtle-methods12372591 +Ref: 3d7112372591 +Node: Methods of TurtleScreen/Screen12375605 +Ref: library/turtle methods-of-turtlescreen-screen12375720 +Ref: 3dbe12375720 +Node: Methods of RawTurtle/Turtle and corresponding functions12377042 +Ref: library/turtle methods-of-rawturtle-turtle-and-corresponding-functions12377261 +Ref: 3ddd12377261 +Node: Turtle motion12377675 +Ref: library/turtle turtle-motion12377810 +Ref: 3dde12377810 +Ref: library/turtle turtle forward12377859 +Ref: 3d6912377859 +Ref: library/turtle turtle fd12377899 +Ref: 3d7212377899 +Ref: library/turtle turtle back12378337 +Ref: 3d7512378337 +Ref: library/turtle turtle bk12378374 +Ref: 3d7412378374 +Ref: library/turtle turtle backward12378409 +Ref: 3d7312378409 +Ref: library/turtle turtle right12378781 +Ref: 3d7612378781 +Ref: library/turtle turtle rt12378816 +Ref: 3d7712378816 +Ref: library/turtle turtle left12379282 +Ref: 3d7812379282 +Ref: library/turtle turtle lt12379316 +Ref: 3d7912379316 +Ref: library/turtle turtle goto12379779 +Ref: 3d7a12379779 +Ref: library/turtle turtle setpos12379817 +Ref: 3d7b12379817 +Ref: library/turtle turtle setposition12379857 +Ref: 3d7c12379857 +Ref: library/turtle turtle teleport12380612 +Ref: 172612380612 +Ref: library/turtle turtle setx12381624 +Ref: 3d7d12381624 +Ref: library/turtle turtle sety12381948 +Ref: 3d7e12381948 +Ref: library/turtle turtle setheading12382271 +Ref: 3d7f12382271 +Ref: library/turtle turtle seth12382314 +Ref: 3d8012382314 +Ref: library/turtle turtle home12383130 +Ref: 3d8112383130 +Ref: library/turtle turtle circle12383557 +Ref: 3d8212383557 +Ref: library/turtle turtle dot12384942 +Ref: 3d8312384942 +Ref: library/turtle turtle stamp12385492 +Ref: 3d8412385492 +Ref: library/turtle turtle clearstamp12385829 +Ref: 3d8512385829 +Ref: library/turtle turtle clearstamps12386339 +Ref: 3d8612386339 +Ref: library/turtle turtle undo12386850 +Ref: 3d8712386850 +Ref: library/turtle turtle speed12387175 +Ref: 3d8812387175 +Node: Tell Turtle’s state12388174 +Ref: library/turtle tell-turtle-s-state12388342 +Ref: 3de012388342 +Ref: library/turtle turtle position12388405 +Ref: 3d8912388405 +Ref: library/turtle turtle pos12388438 +Ref: 3d8a12388438 +Ref: library/turtle turtle towards12388610 +Ref: 3d8b12388610 +Ref: library/turtle turtle xcor12389175 +Ref: 3d8c12389175 +Ref: library/turtle turtle ycor12389455 +Ref: 3d8d12389455 +Ref: library/turtle turtle heading12389742 +Ref: 3d8e12389742 +Ref: library/turtle turtle distance12389990 +Ref: 3d8f12389990 +Node: Settings for measurement12390579 +Ref: library/turtle settings-for-measurement12390748 +Ref: 3de112390748 +Ref: library/turtle turtle degrees12390819 +Ref: 3d9012390819 +Ref: library/turtle turtle radians12391459 +Ref: 3d9112391459 +Node: Pen control<2>12391784 +Ref: library/turtle id112391944 +Ref: 3de212391944 +Node: Drawing state12392072 +Ref: library/turtle drawing-state12392158 +Ref: 3de312392158 +Ref: library/turtle turtle pendown12392207 +Ref: 3d9212392207 +Ref: library/turtle turtle pd12392239 +Ref: 3d9312392239 +Ref: library/turtle turtle down12392266 +Ref: 3d9412392266 +Ref: library/turtle turtle penup12392345 +Ref: 3d9512392345 +Ref: library/turtle turtle pu12392375 +Ref: 3d9612392375 +Ref: library/turtle turtle up12392402 +Ref: 3d9712392402 +Ref: library/turtle turtle pensize12392480 +Ref: 3d9812392480 +Ref: library/turtle turtle width12392522 +Ref: 3d9912392522 +Ref: library/turtle turtle pen12392984 +Ref: 3d9a12392984 +Ref: library/turtle turtle isdown12394894 +Ref: 3d9b12394894 +Node: Color control12395144 +Ref: library/turtle color-control12395246 +Ref: 3de412395246 +Ref: library/turtle turtle pencolor12395295 +Ref: 3d9d12395295 +Ref: library/turtle turtle fillcolor12396899 +Ref: 3d9e12396899 +Ref: library/turtle turtle color12398407 +Ref: 3d9c12398407 +Node: Filling12399605 +Ref: library/turtle filling12399714 +Ref: 3de512399714 +Ref: library/turtle turtle filling12399751 +Ref: 3d9f12399751 +Ref: library/turtle turtle begin_fill12400010 +Ref: 3da012400010 +Ref: library/turtle turtle end_fill12400107 +Ref: 3da112400107 +Node: More drawing control12400654 +Ref: library/turtle more-drawing-control12400741 +Ref: 3de612400741 +Ref: library/turtle turtle reset12400804 +Ref: 3da212400804 +Ref: library/turtle turtle clear12401252 +Ref: 3da312401252 +Ref: library/turtle turtle write12401456 +Ref: 3da412401456 +Node: Turtle state12402235 +Ref: library/turtle turtle-state12402383 +Ref: 3de712402383 +Node: Visibility12402470 +Ref: library/turtle visibility12402548 +Ref: 3de812402548 +Ref: library/turtle turtle hideturtle12402591 +Ref: 3da712402591 +Ref: library/turtle turtle ht12402626 +Ref: 3da812402626 +Ref: library/turtle turtle showturtle12402883 +Ref: 3da512402883 +Ref: library/turtle turtle st12402918 +Ref: 3da612402918 +Ref: library/turtle turtle isvisible12403012 +Ref: 3da912403012 +Node: Appearance12403291 +Ref: library/turtle appearance12403369 +Ref: 3de912403369 +Ref: library/turtle turtle shape12403412 +Ref: 3daa12403412 +Ref: library/turtle turtle resizemode12404085 +Ref: 3dab12404085 +Ref: library/turtle turtle shapesize12405056 +Ref: 3dac12405056 +Ref: library/turtle turtle turtlesize12405148 +Ref: 3dad12405148 +Ref: library/turtle turtle shearfactor12406133 +Ref: 3dae12406133 +Ref: library/turtle turtle tilt12406797 +Ref: 3daf12406797 +Ref: library/turtle turtle tiltangle12407237 +Ref: 72012407237 +Ref: library/turtle turtle shapetransform12407959 +Ref: 3db012407959 +Ref: library/turtle turtle get_shapepoly12408991 +Ref: 3db112408991 +Node: Using events12409362 +Ref: library/turtle using-events12409518 +Ref: 3dea12409518 +Ref: library/turtle turtle onrelease12410418 +Ref: 3db312410418 +Ref: library/turtle turtle ondrag12411429 +Ref: 3db412411429 +Node: Special Turtle methods12412304 +Ref: library/turtle special-turtle-methods12412463 +Ref: 3deb12412463 +Ref: library/turtle turtle begin_poly12412530 +Ref: 3db512412530 +Ref: library/turtle turtle end_poly12412673 +Ref: 3db612412673 +Ref: library/turtle turtle get_poly12412864 +Ref: 3db712412864 +Ref: library/turtle turtle clone12413266 +Ref: 3db812413266 +Ref: library/turtle turtle getturtle12413463 +Ref: 3db912413463 +Ref: library/turtle turtle getpen12413497 +Ref: 3dba12413497 +Ref: library/turtle turtle getscreen12413765 +Ref: 3dbb12413765 +Ref: library/turtle turtle setundobuffer12414071 +Ref: 3dbc12414071 +Ref: library/turtle turtle undobufferentries12414508 +Ref: 3dbd12414508 +Node: Compound shapes12414668 +Ref: library/turtle compound-shapes12414806 +Ref: 3ded12414806 +Ref: library/turtle compoundshapes12414806 +Ref: 3dee12414806 +Node: Methods of TurtleScreen/Screen and corresponding functions12415840 +Ref: library/turtle methods-of-turtlescreen-screen-and-corresponding-functions12416048 +Ref: 3df112416048 +Node: Window control12416528 +Ref: library/turtle window-control12416663 +Ref: 3df212416663 +Ref: library/turtle turtle bgcolor12416714 +Ref: 3dbf12416714 +Ref: library/turtle turtle bgpic12417127 +Ref: 3dc012417127 +Ref: library/turtle turtle clearscreen12418003 +Ref: 3dc112418003 +Ref: library/turtle turtle resetscreen12418512 +Ref: 3dc212418512 +Ref: library/turtle turtle screensize12418611 +Ref: 3dc312418611 +Ref: library/turtle turtle setworldcoordinates12419520 +Ref: 3dc412419520 +Node: Animation control12420502 +Ref: library/turtle animation-control12420665 +Ref: 3df312420665 +Ref: library/turtle turtle delay12420722 +Ref: 3dc512420722 +Ref: library/turtle turtle tracer12421161 +Ref: 3dc612421161 +Ref: library/turtle turtle update12421862 +Ref: 3dc712421862 +Node: Using screen events12422034 +Ref: library/turtle using-screen-events12422196 +Ref: 3df412422196 +Ref: library/turtle turtle listen12422257 +Ref: 3dc812422257 +Ref: library/turtle turtle onkey12422492 +Ref: 3dc912422492 +Ref: library/turtle turtle onkeyrelease12422530 +Ref: 3dca12422530 +Ref: library/turtle turtle onkeypress12423152 +Ref: 3dcb12423152 +Ref: library/turtle turtle onclick12423755 +Ref: 3db212423755 +Ref: library/turtle turtle onscreenclick12423807 +Ref: 3dcc12423807 +Ref: library/turtle turtle ontimer12424995 +Ref: 3dcd12424995 +Ref: library/turtle turtle mainloop12425479 +Ref: 3dce12425479 +Ref: library/turtle turtle done12425512 +Ref: 3dcf12425512 +Node: Input methods12425838 +Ref: library/turtle input-methods12426011 +Ref: 3df512426011 +Ref: library/turtle turtle textinput12426060 +Ref: 18c212426060 +Ref: library/turtle turtle numinput12426514 +Ref: 18c312426514 +Node: Settings and special methods12427437 +Ref: library/turtle settings-and-special-methods12427649 +Ref: 3df612427649 +Ref: library/turtle turtle mode12427728 +Ref: 3dd012427728 +Ref: library/turtle turtle colormode12428957 +Ref: 3dd112428957 +Ref: library/turtle turtle getcanvas12429597 +Ref: 3dd212429597 +Ref: library/turtle turtle getshapes12429848 +Ref: 3dd312429848 +Ref: library/turtle turtle register_shape12430042 +Ref: 3dd412430042 +Ref: library/turtle turtle addshape12430097 +Ref: 3dd512430097 +Ref: library/turtle turtle turtles12431058 +Ref: 3dd612431058 +Ref: library/turtle turtle window_height12431224 +Ref: 3dd712431224 +Ref: library/turtle turtle window_width12431361 +Ref: 3dd812431361 +Node: Methods specific to Screen not inherited from TurtleScreen12431495 +Ref: library/turtle methods-specific-to-screen-not-inherited-from-turtlescreen12431685 +Ref: 3df712431685 +Ref: library/turtle screenspecific12431685 +Ref: 3df812431685 +Ref: library/turtle turtle bye12431826 +Ref: 3dd912431826 +Ref: library/turtle turtle exitonclick12431893 +Ref: 3dda12431893 +Ref: library/turtle turtle setup12432333 +Ref: 3ddb12432333 +Ref: library/turtle turtle title12433653 +Ref: 3ddc12433653 +Node: Public classes12433919 +Ref: library/turtle public-classes12434086 +Ref: 3df912434086 +Ref: library/turtle turtle RawTurtle12434137 +Ref: 3dfa12434137 +Ref: library/turtle turtle RawPen12434174 +Ref: 3dfb12434174 +Ref: library/turtle turtle Turtle12434445 +Ref: 3dfd12434445 +Ref: library/turtle turtle TurtleScreen12434637 +Ref: 3dec12434637 +Ref: library/turtle turtle Screen12434832 +Ref: 3d6f12434832 +Ref: library/turtle turtle ScrolledCanvas12434927 +Ref: 3dfc12434927 +Ref: library/turtle turtle Shape12435222 +Ref: 3def12435222 +Ref: library/turtle turtle Shape addcomponent12436030 +Ref: 3df012436030 +Ref: library/turtle turtle Vec2D12436630 +Ref: 3ddf12436630 +Node: Explanation<2>12437182 +Ref: library/turtle explanation12437313 +Ref: 3dfe12437313 +Ref: library/turtle turtle-explanation12437313 +Ref: 3d6e12437313 +Node: Help and configuration12438745 +Ref: library/turtle help-and-configuration12438889 +Ref: 3dff12438889 +Node: How to use help12439081 +Ref: library/turtle how-to-use-help12439214 +Ref: 3e0012439214 +Node: Translation of docstrings into different languages12441532 +Ref: library/turtle translation-of-docstrings-into-different-languages12441709 +Ref: 3e0112441709 +Ref: library/turtle turtle write_docstringdict12442013 +Ref: 3e0212442013 +Node: How to configure Screen and Turtles12443052 +Ref: library/turtle how-to-configure-screen-and-turtles12443205 +Ref: 3e0312443205 +Node: turtledemo — Demo scripts12446012 +Ref: library/turtle module-turtledemo12446166 +Ref: 10212446166 +Ref: library/turtle turtledemo-demo-scripts12446166 +Ref: 3e0412446166 +Node: Changes since Python 2 612452001 +Ref: library/turtle changes-since-python-2-612452157 +Ref: 3e0512452157 +Node: Changes since Python 3 012453195 +Ref: library/turtle changes-since-python-3-012453315 +Ref: 3e0612453315 +Node: cmd — Support for line-oriented command interpreters12454569 +Ref: library/cmd doc12454755 +Ref: 3e0712454755 +Ref: library/cmd cmd-support-for-line-oriented-command-interpreters12454755 +Ref: 3e0812454755 +Ref: library/cmd module-cmd12454755 +Ref: 1912454755 +Ref: library/cmd cmd Cmd12455231 +Ref: 16c512455231 +Ref: cmd — Support for line-oriented command interpreters-Footnote-112456898 +Node: Cmd Objects12456961 +Ref: library/cmd cmd-objects12457083 +Ref: 3e0a12457083 +Ref: library/cmd id112457083 +Ref: 3e0b12457083 +Ref: library/cmd cmd Cmd cmdloop12457182 +Ref: 3e0c12457182 +Ref: library/cmd cmd Cmd do_help12459273 +Ref: 16b412459273 +Ref: library/cmd cmd Cmd onecmd12459806 +Ref: 3e0f12459806 +Ref: library/cmd cmd Cmd emptyline12460397 +Ref: 3e1212460397 +Ref: library/cmd cmd Cmd default12460595 +Ref: 3e1112460595 +Ref: library/cmd cmd Cmd completedefault12460792 +Ref: 3e1312460792 +Ref: library/cmd cmd Cmd columnize12461014 +Ref: 186612461014 +Ref: library/cmd cmd Cmd precmd12461250 +Ref: 3e1012461250 +Ref: library/cmd cmd Cmd postcmd12461729 +Ref: 3e0e12461729 +Ref: library/cmd cmd Cmd preloop12462362 +Ref: 3e1412462362 +Ref: library/cmd cmd Cmd postloop12462556 +Ref: 3e1512462556 +Ref: library/cmd cmd Cmd prompt12462840 +Ref: 3e1612462840 +Ref: library/cmd cmd Cmd identchars12462909 +Ref: 3e1712462909 +Ref: library/cmd cmd Cmd lastcmd12463004 +Ref: 3e1812463004 +Ref: library/cmd cmd Cmd cmdqueue12463077 +Ref: 3e1912463077 +Ref: library/cmd cmd Cmd intro12463328 +Ref: 3e0d12463328 +Ref: library/cmd cmd Cmd doc_header12463482 +Ref: 3e1a12463482 +Ref: library/cmd cmd Cmd misc_header12463602 +Ref: 3e1b12463602 +Ref: library/cmd cmd Cmd undoc_header12463821 +Ref: 3e1c12463821 +Ref: library/cmd cmd Cmd ruler12464037 +Ref: 3e1d12464037 +Ref: library/cmd cmd Cmd use_rawinput12464211 +Ref: 3e0912464211 +Node: Cmd Example12464687 +Ref: library/cmd cmd-example12464809 +Ref: 3e1e12464809 +Ref: library/cmd id212464809 +Ref: 3e1f12464809 +Node: shlex — Simple lexical analysis12470159 +Ref: library/shlex doc12470310 +Ref: 3e2012470310 +Ref: library/shlex module-shlex12470310 +Ref: c412470310 +Ref: library/shlex shlex-simple-lexical-analysis12470310 +Ref: 3e2112470310 +Ref: library/shlex shlex split12470831 +Ref: 53812470831 +Ref: library/shlex shlex join12471428 +Ref: a2612471428 +Ref: library/shlex shlex quote12471886 +Ref: 27f12471886 +Ref: library/shlex shlex-quote-warning12472114 +Ref: 321712472114 +Ref: library/shlex shlex shlex12473749 +Ref: ccd12473749 +Ref: shlex — Simple lexical analysis-Footnote-112475995 +Node: shlex Objects12476060 +Ref: library/shlex id112476165 +Ref: 3e2512476165 +Ref: library/shlex shlex-objects12476165 +Ref: 3e2612476165 +Ref: library/shlex shlex shlex get_token12476269 +Ref: 3e2712476269 +Ref: library/shlex shlex shlex push_token12476632 +Ref: 3e2812476632 +Ref: library/shlex shlex shlex read_token12476714 +Ref: 3e2a12476714 +Ref: library/shlex shlex shlex sourcehook12476953 +Ref: 3e2b12476953 +Ref: library/shlex shlex shlex push_source12478492 +Ref: 3e2d12478492 +Ref: library/shlex shlex shlex pop_source12478795 +Ref: 3e2e12478795 +Ref: library/shlex shlex shlex error_leader12478994 +Ref: 3e2f12478994 +Ref: library/shlex shlex shlex commenters12479723 +Ref: 3e2212479723 +Ref: library/shlex shlex shlex wordchars12479945 +Ref: 3e2412479945 +Ref: library/shlex shlex shlex whitespace12480641 +Ref: 3e3112480641 +Ref: library/shlex shlex shlex escape12480839 +Ref: 3e3212480839 +Ref: library/shlex shlex shlex quotes12481004 +Ref: 3e3312481004 +Ref: library/shlex shlex shlex escapedquotes12481289 +Ref: 3e3412481289 +Ref: library/shlex shlex shlex whitespace_split12481518 +Ref: 3e3012481518 +Ref: library/shlex shlex shlex infile12482056 +Ref: 3e2312482056 +Ref: library/shlex shlex shlex instream12482287 +Ref: 3e3512482287 +Ref: library/shlex shlex shlex source12482412 +Ref: 3e2c12482412 +Ref: library/shlex shlex shlex debug12483001 +Ref: 3e3612483001 +Ref: library/shlex shlex shlex lineno12483265 +Ref: 3e3712483265 +Ref: library/shlex shlex shlex token12483361 +Ref: 3e3812483361 +Ref: library/shlex shlex shlex eof12483478 +Ref: 3e2912483478 +Ref: library/shlex shlex shlex punctuation_chars12483654 +Ref: 19d012483654 +Node: Parsing Rules12484065 +Ref: library/shlex parsing-rules12484213 +Ref: 3e3912484213 +Ref: library/shlex shlex-parsing-rules12484213 +Ref: 3e3a12484213 +Node: Improved Compatibility with Shells12486234 +Ref: library/shlex improved-compatibility-with-shells12486360 +Ref: 3e3b12486360 +Ref: library/shlex improved-shell-compatibility12486360 +Ref: cce12486360 +Node: Graphical User Interfaces with Tk12489195 +Ref: library/tk doc12489345 +Ref: 3e3c12489345 +Ref: library/tk graphical-user-interfaces-with-tk12489345 +Ref: 3e3d12489345 +Ref: library/tk tkinter12489345 +Ref: 3e3e12489345 +Ref: Graphical User Interfaces with Tk-Footnote-112491212 +Node: tkinter — Python interface to Tcl/Tk12491264 +Ref: library/tkinter doc12491427 +Ref: 3e3f12491427 +Ref: library/tkinter module-tkinter12491427 +Ref: f012491427 +Ref: library/tkinter tkinter-python-interface-to-tcl-tk12491427 +Ref: 3e4012491427 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-112494314 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-212494391 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-312494419 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-412494459 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-512494516 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-612494543 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-712494580 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-812494678 +Ref: tkinter — Python interface to Tcl/Tk-Footnote-912494730 +Node: Architecture12494789 +Ref: library/tkinter architecture12494900 +Ref: 3e4112494900 +Ref: Architecture-Footnote-112497232 +Node: Tkinter Modules12497272 +Ref: library/tkinter tkinter-modules12497414 +Ref: 3e4312497414 +Ref: library/tkinter tkinter Tk12497741 +Ref: 163612497741 +Ref: library/tkinter tkinter Tk tk12499889 +Ref: 3e4512499889 +Ref: library/tkinter tkinter Tk master12500188 +Ref: 3e4612500188 +Ref: library/tkinter tkinter Tk children12500758 +Ref: 3e4712500758 +Ref: library/tkinter tkinter Tcl12500968 +Ref: 3e4412500968 +Ref: library/tkinter module-_tkinter12502566 +Ref: 312502566 +Node: Tkinter Life Preserver12503478 +Ref: library/tkinter tkinter-life-preserver12503623 +Ref: 3e4812503623 +Node: A Hello World Program12504451 +Ref: library/tkinter a-hello-world-program12504561 +Ref: 3e4912504561 +Node: Important Tk Concepts12506026 +Ref: library/tkinter important-tk-concepts12506183 +Ref: 3e4a12506183 +Node: Understanding How Tkinter Wraps Tcl/Tk12507531 +Ref: library/tkinter understanding-how-tkinter-wraps-tcl-tk12507700 +Ref: 3e4b12507700 +Node: How do I…? What option does…?12509855 +Ref: library/tkinter how-do-i-what-option-does12510041 +Ref: 3e4c12510041 +Node: Navigating the Tcl/Tk Reference Manual12511787 +Ref: library/tkinter navigating-the-tcl-tk-reference-manual12511926 +Ref: 3e4d12511926 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-112514004 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-212514061 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-312514120 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-412514173 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-512514229 +Ref: Navigating the Tcl/Tk Reference Manual-Footnote-612514288 +Node: Threading model12514342 +Ref: library/tkinter threading-model12514487 +Ref: 3e4212514487 +Node: Handy Reference12517509 +Ref: library/tkinter handy-reference12517645 +Ref: 3e4e12517645 +Node: Setting Options12517899 +Ref: library/tkinter setting-options12517985 +Ref: 3e4f12517985 +Ref: library/tkinter tkinter-setting-options12517985 +Ref: 3e5012517985 +Ref: Setting Options-Footnote-112521233 +Node: The Packer12521280 +Ref: library/tkinter the-packer12521389 +Ref: 3e5112521389 +Node: Packer Options12523039 +Ref: library/tkinter packer-options12523158 +Ref: 3e5212523158 +Node: Coupling Widget Variables12523858 +Ref: library/tkinter coupling-widget-variables12523985 +Ref: 3e5312523985 +Node: The Window Manager12526185 +Ref: library/tkinter the-window-manager12526318 +Ref: 3e5412526318 +Node: Tk Option Data Types12527711 +Ref: library/tkinter tk-option-data-types12527838 +Ref: 3e5512527838 +Node: Bindings and Events12530900 +Ref: library/tkinter bindings-and-events12531028 +Ref: 3e5612531028 +Ref: library/tkinter id212531028 +Ref: 3e5712531028 +Ref: Bindings and Events-Footnote-112533860 +Node: The index Parameter12533906 +Ref: library/tkinter the-index-parameter12534020 +Ref: 3e5812534020 +Node: Images12535954 +Ref: library/tkinter images12536040 +Ref: 3e5912536040 +Ref: Images-Footnote-112537338 +Node: File Handlers12537373 +Ref: library/tkinter file-handlers12537485 +Ref: 3e5a12537485 +Ref: library/tkinter tkinter-file-handlers12537485 +Ref: 3e5b12537485 +Ref: library/tkinter tkinter Widget tk createfilehandler12538427 +Ref: 3e5c12538427 +Ref: library/tkinter tkinter Widget tk deletefilehandler12538862 +Ref: 3e5d12538862 +Ref: library/tkinter tkinter READABLE12538944 +Ref: 3e5e12538944 +Ref: library/tkinter tkinter WRITABLE12538972 +Ref: 3e5f12538972 +Ref: library/tkinter tkinter EXCEPTION12539000 +Ref: 3e6012539000 +Node: tkinter colorchooser — Color choosing dialog12539076 +Ref: library/tkinter colorchooser doc12539285 +Ref: 3e6112539285 +Ref: library/tkinter colorchooser module-tkinter colorchooser12539285 +Ref: f112539285 +Ref: library/tkinter colorchooser tkinter-colorchooser-color-choosing-dialog12539285 +Ref: 3e6212539285 +Ref: library/tkinter colorchooser tkinter colorchooser Chooser12539783 +Ref: 3e6312539783 +Ref: library/tkinter colorchooser tkinter colorchooser askcolor12539849 +Ref: 3e6512539849 +Ref: tkinter colorchooser — Color choosing dialog-Footnote-112540243 +Node: tkinter font — Tkinter font wrapper12540324 +Ref: library/tkinter font doc12540510 +Ref: 3e6612540510 +Ref: library/tkinter font module-tkinter font12540510 +Ref: f512540510 +Ref: library/tkinter font tkinter-font-tkinter-font-wrapper12540510 +Ref: 3e6712540510 +Ref: library/tkinter font tkinter font NORMAL12540867 +Ref: 3e6812540867 +Ref: library/tkinter font tkinter font BOLD12540897 +Ref: 3e6912540897 +Ref: library/tkinter font tkinter font ITALIC12540925 +Ref: 3e6a12540925 +Ref: library/tkinter font tkinter font ROMAN12540955 +Ref: 3e6b12540955 +Ref: library/tkinter font tkinter font Font12540985 +Ref: 190a12540985 +Ref: library/tkinter font tkinter font Font actual12542291 +Ref: 3e6c12542291 +Ref: library/tkinter font tkinter font Font cget12542392 +Ref: 3e6d12542392 +Ref: library/tkinter font tkinter font Font config12542470 +Ref: 3e6e12542470 +Ref: library/tkinter font tkinter font Font copy12542549 +Ref: 3e6f12542549 +Ref: library/tkinter font tkinter font Font measure12542627 +Ref: 3e7012542627 +Ref: library/tkinter font tkinter font Font metrics12542886 +Ref: 3e7112542886 +Ref: library/tkinter font tkinter font families12543463 +Ref: 3e7212543463 +Ref: library/tkinter font tkinter font names12543570 +Ref: 3e7312543570 +Ref: library/tkinter font tkinter font nametofont12543657 +Ref: 190c12543657 +Ref: tkinter font — Tkinter font wrapper-Footnote-112543881 +Node: Tkinter Dialogs12543953 +Ref: library/dialog doc12544139 +Ref: 3e7412544139 +Ref: library/dialog tkinter-dialogs12544139 +Ref: 3e7512544139 +Node: tkinter simpledialog — Standard Tkinter input dialogs12544510 +Ref: library/dialog module-tkinter simpledialog12544671 +Ref: f812544671 +Ref: library/dialog tkinter-simpledialog-standard-tkinter-input-dialogs12544671 +Ref: 3e7612544671 +Ref: library/dialog tkinter simpledialog askfloat12545074 +Ref: 3e7712545074 +Ref: library/dialog tkinter simpledialog askinteger12545140 +Ref: 190d12545140 +Ref: library/dialog tkinter simpledialog askstring12545208 +Ref: 3e7812545208 +Ref: library/dialog tkinter simpledialog Dialog12545388 +Ref: 3e7912545388 +Ref: library/dialog tkinter simpledialog Dialog body12545490 +Ref: 3e7a12545490 +Ref: library/dialog tkinter simpledialog Dialog buttonbox12545644 +Ref: 3e7b12545644 +Ref: tkinter simpledialog — Standard Tkinter input dialogs-Footnote-112545815 +Node: tkinter filedialog — File selection dialogs12545896 +Ref: library/dialog module-tkinter filedialog12546114 +Ref: f412546114 +Ref: library/dialog tkinter-filedialog-file-selection-dialogs12546114 +Ref: 3e7c12546114 +Ref: tkinter filedialog — File selection dialogs-Footnote-112546547 +Node: Native Load/Save Dialogs12546626 +Ref: library/dialog native-load-save-dialogs12546732 +Ref: 3e7d12546732 +Ref: library/dialog tkinter filedialog askopenfile12547741 +Ref: 3e7e12547741 +Ref: library/dialog tkinter filedialog askopenfiles12547808 +Ref: 3e7f12547808 +Ref: library/dialog tkinter filedialog asksaveasfile12548003 +Ref: 3e8112548003 +Ref: library/dialog tkinter filedialog askopenfilename12548172 +Ref: 3e8312548172 +Ref: library/dialog tkinter filedialog askopenfilenames12548233 +Ref: 3e8412548233 +Ref: library/dialog tkinter filedialog asksaveasfilename12548444 +Ref: 3e8512548444 +Ref: library/dialog tkinter filedialog askdirectory12548589 +Ref: 3e8612548589 +Ref: library/dialog tkinter filedialog Open12548815 +Ref: 3e8012548815 +Ref: library/dialog tkinter filedialog SaveAs12548875 +Ref: 3e8212548875 +Ref: library/dialog tkinter filedialog Directory12549196 +Ref: 3e8712549196 +Ref: library/dialog tkinter filedialog FileDialog12549428 +Ref: 3e8812549428 +Ref: library/dialog tkinter filedialog FileDialog cancel_command12549535 +Ref: 3e8912549535 +Ref: library/dialog tkinter filedialog FileDialog dirs_double_event12549638 +Ref: 3e8a12549638 +Ref: library/dialog tkinter filedialog FileDialog dirs_select_event12549744 +Ref: 3e8b12549744 +Ref: library/dialog tkinter filedialog FileDialog files_double_event12549843 +Ref: 3e8c12549843 +Ref: library/dialog tkinter filedialog FileDialog files_select_event12549945 +Ref: 3e8d12549945 +Ref: library/dialog tkinter filedialog FileDialog filter_command12550047 +Ref: 3e8e12550047 +Ref: library/dialog tkinter filedialog FileDialog get_filter12550135 +Ref: 3e8f12550135 +Ref: library/dialog tkinter filedialog FileDialog get_selection12550221 +Ref: 3e9012550221 +Ref: library/dialog tkinter filedialog FileDialog go12550305 +Ref: 3e9112550305 +Ref: library/dialog tkinter filedialog FileDialog ok_event12550447 +Ref: 3e9212550447 +Ref: library/dialog tkinter filedialog FileDialog quit12550534 +Ref: 3e9312550534 +Ref: library/dialog tkinter filedialog FileDialog set_filter12550619 +Ref: 3e9412550619 +Ref: library/dialog tkinter filedialog FileDialog set_selection12550691 +Ref: 3e9512550691 +Ref: library/dialog tkinter filedialog LoadFileDialog12550786 +Ref: 3e9612550786 +Ref: library/dialog tkinter filedialog LoadFileDialog ok_command12550950 +Ref: 3e9712550950 +Ref: library/dialog tkinter filedialog SaveFileDialog12551091 +Ref: 3e9812551091 +Ref: library/dialog tkinter filedialog SaveFileDialog ok_command12551257 +Ref: 3e9912551257 +Node: tkinter commondialog — Dialog window templates12551469 +Ref: library/dialog module-tkinter commondialog12551623 +Ref: f212551623 +Ref: library/dialog tkinter-commondialog-dialog-window-templates12551623 +Ref: 3e9a12551623 +Ref: library/dialog tkinter commondialog Dialog12552016 +Ref: 3e6412552016 +Ref: library/dialog tkinter commondialog Dialog show12552081 +Ref: 3e9b12552081 +Ref: tkinter commondialog — Dialog window templates-Footnote-112552286 +Node: tkinter messagebox — Tkinter message prompts12552367 +Ref: library/tkinter messagebox doc12552561 +Ref: 3e9c12552561 +Ref: library/tkinter messagebox module-tkinter messagebox12552561 +Ref: f612552561 +Ref: library/tkinter messagebox tkinter-messagebox-tkinter-message-prompts12552561 +Ref: 3e9d12552561 +Ref: library/tkinter messagebox tkinter messagebox Message12553262 +Ref: 3ea212553262 +Ref: library/tkinter messagebox tkinter messagebox Message show12555403 +Ref: 3ea712555403 +Ref: library/tkinter messagebox tkinter messagebox showinfo12555708 +Ref: 3ea812555708 +Ref: library/tkinter messagebox tkinter messagebox showwarning12555921 +Ref: 3ea912555921 +Ref: library/tkinter messagebox tkinter messagebox showerror12556107 +Ref: 3eaa12556107 +Ref: library/tkinter messagebox tkinter messagebox askquestion12556316 +Ref: 3eab12556316 +Ref: library/tkinter messagebox tkinter messagebox askokcancel12556566 +Ref: 3eac12556566 +Ref: library/tkinter messagebox tkinter messagebox askretrycancel12556831 +Ref: 3ead12556831 +Ref: library/tkinter messagebox tkinter messagebox askyesno12557105 +Ref: 3eaf12557105 +Ref: library/tkinter messagebox tkinter messagebox askyesnocancel12557342 +Ref: 3eb012557342 +Ref: library/tkinter messagebox messagebox-buttons12557635 +Ref: 3ea312557635 +Ref: library/tkinter messagebox tkinter messagebox ABORT12557663 +Ref: 3eb112557663 +Ref: library/tkinter messagebox tkinter messagebox RETRY12557709 +Ref: 3eae12557709 +Ref: library/tkinter messagebox tkinter messagebox IGNORE12557755 +Ref: 3eb212557755 +Ref: library/tkinter messagebox tkinter messagebox OK12557803 +Ref: 3e9e12557803 +Ref: library/tkinter messagebox tkinter messagebox CANCEL12557843 +Ref: 3e9f12557843 +Ref: library/tkinter messagebox tkinter messagebox YES12557891 +Ref: 3ea012557891 +Ref: library/tkinter messagebox tkinter messagebox NO12557933 +Ref: 3ea112557933 +Ref: library/tkinter messagebox messagebox-types12557972 +Ref: 3ea612557972 +Ref: library/tkinter messagebox tkinter messagebox ABORTRETRYIGNORE12558001 +Ref: 3eb312558001 +Ref: library/tkinter messagebox tkinter messagebox OKCANCEL12558295 +Ref: 3eb412558295 +Ref: library/tkinter messagebox tkinter messagebox RETRYCANCEL12558444 +Ref: 3eb512558444 +Ref: library/tkinter messagebox tkinter messagebox YESNO12558602 +Ref: 3eb612558602 +Ref: library/tkinter messagebox tkinter messagebox YESNOCANCEL12558742 +Ref: 3eb712558742 +Ref: library/tkinter messagebox messagebox-icons12558915 +Ref: 3ea412558915 +Ref: library/tkinter messagebox tkinter messagebox ERROR12558929 +Ref: 3eb812558929 +Ref: library/tkinter messagebox tkinter messagebox INFO12558975 +Ref: 3ea512558975 +Ref: library/tkinter messagebox tkinter messagebox QUESTION12559019 +Ref: 3eb912559019 +Ref: library/tkinter messagebox tkinter messagebox WARNING12559071 +Ref: 3eba12559071 +Ref: tkinter messagebox — Tkinter message prompts-Footnote-112559157 +Node: tkinter scrolledtext — Scrolled Text Widget12559236 +Ref: library/tkinter scrolledtext doc12559452 +Ref: 3ebb12559452 +Ref: library/tkinter scrolledtext module-tkinter scrolledtext12559452 +Ref: f712559452 +Ref: library/tkinter scrolledtext tkinter-scrolledtext-scrolled-text-widget12559452 +Ref: 3ebc12559452 +Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText12560365 +Ref: 3ebd12560365 +Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText frame12560431 +Ref: 3ebe12560431 +Ref: library/tkinter scrolledtext tkinter scrolledtext ScrolledText vbar12560528 +Ref: 3ebf12560528 +Ref: tkinter scrolledtext — Scrolled Text Widget-Footnote-112560624 +Node: tkinter dnd — Drag and drop support12560705 +Ref: library/tkinter dnd doc12560908 +Ref: 3ec012560908 +Ref: library/tkinter dnd module-tkinter dnd12560908 +Ref: f312560908 +Ref: library/tkinter dnd tkinter-dnd-drag-and-drop-support12560908 +Ref: 3ec112560908 +Ref: library/tkinter dnd tkinter dnd DndHandler12562411 +Ref: 3ec312562411 +Ref: library/tkinter dnd tkinter dnd DndHandler cancel12562599 +Ref: 3ec412562599 +Ref: library/tkinter dnd tkinter dnd DndHandler finish12562682 +Ref: 3ec512562682 +Ref: library/tkinter dnd tkinter dnd DndHandler on_motion12562776 +Ref: 3ec612562776 +Ref: library/tkinter dnd tkinter dnd DndHandler on_release12562902 +Ref: 3ec712562902 +Ref: library/tkinter dnd tkinter dnd dnd_start12563008 +Ref: 3ec212563008 +Ref: tkinter dnd — Drag and drop support-Footnote-112563200 +Node: tkinter ttk — Tk themed widgets12563271 +Ref: library/tkinter ttk doc12563464 +Ref: 3ec812563464 +Ref: library/tkinter ttk module-tkinter ttk12563464 +Ref: f912563464 +Ref: library/tkinter ttk tkinter-ttk-tk-themed-widgets12563464 +Ref: 3ec912563464 +Ref: tkinter ttk — Tk themed widgets-Footnote-112564383 +Ref: tkinter ttk — Tk themed widgets-Footnote-212564454 +Node: Using Ttk12564507 +Ref: library/tkinter ttk using-ttk12564606 +Ref: 3eca12564606 +Ref: Using Ttk-Footnote-112565762 +Node: Ttk Widgets12565826 +Ref: library/tkinter ttk ttk-widgets12565940 +Ref: 3ecb12565940 +Node: Widget12567048 +Ref: library/tkinter ttk widget12567161 +Ref: 3ed112567161 +Node: Standard Options12567478 +Ref: library/tkinter ttk standard-options12567571 +Ref: 3ed212567571 +Node: Scrollable Widget Options12569112 +Ref: library/tkinter ttk scrollable-widget-options12569227 +Ref: 3ed312569227 +Node: Label Options12570260 +Ref: library/tkinter ttk label-options12570380 +Ref: 3ed412570380 +Node: Compatibility Options12572714 +Ref: library/tkinter ttk compatibility-options12572822 +Ref: 3ed512572822 +Node: Widget States12573313 +Ref: library/tkinter ttk widget-states12573418 +Ref: 3ed712573418 +Node: ttk Widget12574922 +Ref: library/tkinter ttk ttk-widget12574997 +Ref: 3ed812574997 +Ref: library/tkinter ttk tkinter ttk Widget12575184 +Ref: 3ecf12575184 +Ref: library/tkinter ttk tkinter ttk Widget identify12575215 +Ref: 3ed912575215 +Ref: library/tkinter ttk tkinter ttk Widget instate12575458 +Ref: 3eda12575458 +Ref: library/tkinter ttk tkinter ttk Widget state12575802 +Ref: 3ed612575802 +Node: Combobox12576190 +Ref: library/tkinter ttk combobox12576299 +Ref: 3edb12576299 +Node: Options12576994 +Ref: library/tkinter ttk options12577069 +Ref: 3edc12577069 +Node: Virtual events12579360 +Ref: library/tkinter ttk virtual-events12579456 +Ref: 3edd12579456 +Node: ttk Combobox12579636 +Ref: library/tkinter ttk ttk-combobox12579716 +Ref: 3ede12579716 +Ref: library/tkinter ttk tkinter ttk Combobox12579763 +Ref: 3ecc12579763 +Ref: library/tkinter ttk tkinter ttk Combobox current12579796 +Ref: 3edf12579796 +Ref: library/tkinter ttk tkinter ttk Combobox get12580072 +Ref: 3ee012580072 +Ref: library/tkinter ttk tkinter ttk Combobox set12580151 +Ref: 3ee112580151 +Node: Spinbox12580235 +Ref: library/tkinter ttk spinbox12580346 +Ref: 3ee212580346 +Node: Options<2>12581106 +Ref: library/tkinter ttk id112581186 +Ref: 3ee312581186 +Node: Virtual events<2>12583572 +Ref: library/tkinter ttk id212583672 +Ref: 3ee412583672 +Node: ttk Spinbox12583880 +Ref: library/tkinter ttk ttk-spinbox12583961 +Ref: 3ee512583961 +Ref: library/tkinter ttk tkinter ttk Spinbox12584006 +Ref: b9412584006 +Ref: library/tkinter ttk tkinter ttk Spinbox get12584038 +Ref: 3ee612584038 +Ref: library/tkinter ttk tkinter ttk Spinbox set12584116 +Ref: 3ee712584116 +Node: Notebook12584199 +Ref: library/tkinter ttk notebook12584313 +Ref: 3ee812584313 +Node: Options<3>12584673 +Ref: library/tkinter ttk id312584748 +Ref: 3ee912584748 +Node: Tab Options12585823 +Ref: library/tkinter ttk tab-options12585922 +Ref: 3eea12585922 +Node: Tab Identifiers12587807 +Ref: library/tkinter ttk tab-identifiers12587910 +Ref: 3eec12587910 +Node: Virtual Events12588444 +Ref: library/tkinter ttk id412588548 +Ref: 3eee12588548 +Node: ttk Notebook12588692 +Ref: library/tkinter ttk ttk-notebook12588772 +Ref: 3eef12588772 +Ref: library/tkinter ttk tkinter ttk Notebook12588819 +Ref: 3ecd12588819 +Ref: library/tkinter ttk tkinter ttk Notebook add12588852 +Ref: 3ef012588852 +Ref: library/tkinter ttk tkinter ttk Notebook forget12589137 +Ref: 3ef112589137 +Ref: library/tkinter ttk tkinter ttk Notebook hide12589275 +Ref: 3ef212589275 +Ref: library/tkinter ttk tkinter ttk Notebook identify12589585 +Ref: 3ef312589585 +Ref: library/tkinter ttk tkinter ttk Notebook index12589727 +Ref: 3eed12589727 +Ref: library/tkinter ttk tkinter ttk Notebook insert12589906 +Ref: 3ef412589906 +Ref: library/tkinter ttk tkinter ttk Notebook select12590291 +Ref: 3ef512590291 +Ref: library/tkinter ttk tkinter ttk Notebook tab12590605 +Ref: 3ef612590605 +Ref: library/tkinter ttk tkinter ttk Notebook tabs12590951 +Ref: 3ef712590951 +Ref: library/tkinter ttk tkinter ttk Notebook enable_traversal12591039 +Ref: 3eeb12591039 +Node: Progressbar12591890 +Ref: library/tkinter ttk progressbar12592006 +Ref: 3ef812592006 +Node: Options<4>12592447 +Ref: library/tkinter ttk id512592529 +Ref: 3ef912592529 +Node: ttk Progressbar12594229 +Ref: library/tkinter ttk ttk-progressbar12594311 +Ref: 3efa12594311 +Ref: library/tkinter ttk tkinter ttk Progressbar12594364 +Ref: 3ece12594364 +Ref: library/tkinter ttk tkinter ttk Progressbar start12594400 +Ref: 3efb12594400 +Ref: library/tkinter ttk tkinter ttk Progressbar step12594668 +Ref: 3efc12594668 +Ref: library/tkinter ttk tkinter ttk Progressbar stop12594815 +Ref: 3efd12594815 +Node: Separator12595000 +Ref: library/tkinter ttk separator12595116 +Ref: 3efe12595116 +Node: Options<5>12595346 +Ref: library/tkinter ttk id612595402 +Ref: 3eff12595402 +Node: Sizegrip12595756 +Ref: library/tkinter ttk sizegrip12595869 +Ref: 3f0012595869 +Node: Platform-specific notes12596219 +Ref: library/tkinter ttk platform-specific-notes12596300 +Ref: 3f0112596300 +Node: Bugs12596556 +Ref: library/tkinter ttk bugs12596637 +Ref: 3f0212596637 +Node: Treeview12596910 +Ref: library/tkinter ttk treeview12597025 +Ref: 3f0312597025 +Node: Options<6>12598383 +Ref: library/tkinter ttk id712598459 +Ref: 3f0712598459 +Node: Item Options12600875 +Ref: library/tkinter ttk item-options12600971 +Ref: 3f0812600971 +Node: Tag Options12602027 +Ref: library/tkinter ttk tag-options12602131 +Ref: 3f0912602131 +Node: Column Identifiers12602781 +Ref: library/tkinter ttk column-identifiers12602890 +Ref: 3f0412602890 +Node: Virtual Events<2>12603762 +Ref: library/tkinter ttk id812603872 +Ref: 3f0a12603872 +Node: ttk Treeview12604704 +Ref: library/tkinter ttk ttk-treeview12604787 +Ref: 3f0c12604787 +Ref: library/tkinter ttk tkinter ttk Treeview12604834 +Ref: a9412604834 +Ref: library/tkinter ttk tkinter ttk Treeview bbox12604867 +Ref: 3f0d12604867 +Ref: library/tkinter ttk tkinter ttk Treeview get_children12605304 +Ref: 3f0e12605304 +Ref: library/tkinter ttk tkinter ttk Treeview set_children12605470 +Ref: 3f0f12605470 +Ref: library/tkinter ttk tkinter ttk Treeview column12605862 +Ref: 3f1012605862 +Ref: library/tkinter ttk tkinter ttk Treeview delete12607107 +Ref: 3f1112607107 +Ref: library/tkinter ttk tkinter ttk Treeview detach12607253 +Ref: 3f1212607253 +Ref: library/tkinter ttk tkinter ttk Treeview exists12607564 +Ref: 3f1312607564 +Ref: library/tkinter ttk tkinter ttk Treeview focus12607674 +Ref: 3f0b12607674 +Ref: library/tkinter ttk tkinter ttk Treeview heading12607867 +Ref: 3f1412607867 +Ref: library/tkinter ttk tkinter ttk Treeview identify12608858 +Ref: 3f1512608858 +Ref: library/tkinter ttk tkinter ttk Treeview identify_row12609095 +Ref: 3f1612609095 +Ref: library/tkinter ttk tkinter ttk Treeview identify_column12609190 +Ref: 3f1712609190 +Ref: library/tkinter ttk tkinter ttk Treeview identify_region12609351 +Ref: 3f1812609351 +Ref: library/tkinter ttk tkinter ttk Treeview identify_element12609987 +Ref: 3f1912609987 +Ref: library/tkinter ttk tkinter ttk Treeview index12610115 +Ref: 3f1a12610115 +Ref: library/tkinter ttk tkinter ttk Treeview insert12610243 +Ref: 3f1b12610243 +Ref: library/tkinter ttk tkinter ttk Treeview item12611141 +Ref: 3f1c12611141 +Ref: library/tkinter ttk tkinter ttk Treeview move12611519 +Ref: 3f1d12611519 +Ref: library/tkinter ttk tkinter ttk Treeview next12611957 +Ref: 3f1e12611957 +Ref: library/tkinter ttk tkinter ttk Treeview parent12612112 +Ref: 3f1f12612112 +Ref: library/tkinter ttk tkinter ttk Treeview prev12612263 +Ref: 3f2012612263 +Ref: library/tkinter ttk tkinter ttk Treeview reattach12612423 +Ref: 3f2112612423 +Ref: library/tkinter ttk tkinter ttk Treeview see12612525 +Ref: 3f2212612525 +Ref: library/tkinter ttk tkinter ttk Treeview selection12612781 +Ref: a9312612781 +Ref: library/tkinter ttk tkinter ttk Treeview selection_set12613029 +Ref: a9512613029 +Ref: library/tkinter ttk tkinter ttk Treeview selection_add12613234 +Ref: 3f2312613234 +Ref: library/tkinter ttk tkinter ttk Treeview selection_remove12613434 +Ref: 3f2412613434 +Ref: library/tkinter ttk tkinter ttk Treeview selection_toggle12613642 +Ref: 3f2512613642 +Ref: library/tkinter ttk tkinter ttk Treeview set12613867 +Ref: 3f2612613867 +Ref: library/tkinter ttk tkinter ttk Treeview tag_bind12614232 +Ref: 3f2712614232 +Ref: library/tkinter ttk tkinter ttk Treeview tag_configure12614502 +Ref: 3f2812614502 +Ref: library/tkinter ttk tkinter ttk Treeview tag_has12614931 +Ref: 3f2912614931 +Ref: library/tkinter ttk tkinter ttk Treeview xview12615216 +Ref: 3f0512615216 +Ref: library/tkinter ttk tkinter ttk Treeview yview12615312 +Ref: 3f0612615312 +Node: Ttk Styling12615406 +Ref: library/tkinter ttk ttk-styling12615504 +Ref: 3f2a12615504 +Ref: library/tkinter ttk ttkstyling12615504 +Ref: 3ed012615504 +Ref: library/tkinter ttk tkinter ttk Style12616096 +Ref: 25b12616096 +Ref: library/tkinter ttk tkinter ttk Style configure12616185 +Ref: 3f2b12616185 +Ref: library/tkinter ttk tkinter ttk Style map12616912 +Ref: 191d12616912 +Ref: library/tkinter ttk tkinter ttk Style lookup12618177 +Ref: 3f2c12618177 +Ref: library/tkinter ttk tkinter ttk Style layout12618698 +Ref: 3f2d12618698 +Ref: library/tkinter ttk tkinter ttk Style element_create12620010 +Ref: 25a12620010 +Ref: library/tkinter ttk tkinter ttk Style element_names12625383 +Ref: 3f2f12625383 +Ref: library/tkinter ttk tkinter ttk Style element_options12625488 +Ref: 3f3012625488 +Ref: library/tkinter ttk tkinter ttk Style theme_create12625594 +Ref: 3f3112625594 +Ref: library/tkinter ttk tkinter ttk Style theme_settings12626007 +Ref: 3f3212626007 +Ref: library/tkinter ttk tkinter ttk Style theme_names12627483 +Ref: 3f3312627483 +Ref: library/tkinter ttk tkinter ttk Style theme_use12627563 +Ref: 3f3412627563 +Ref: Ttk Styling-Footnote-112627860 +Node: Layouts12627922 +Ref: library/tkinter ttk layouts12627977 +Ref: 3f2e12627977 +Ref: library/tkinter ttk layout12629049 +Ref: 3f3512629049 +Node: IDLE — Python editor and shell<2>12629050 +Ref: library/idle doc12629197 +Ref: 3f3612629197 +Ref: library/idle idle12629197 +Ref: 100e12629197 +Ref: library/idle idle-python-editor-and-shell12629197 +Ref: 3f3712629197 +Ref: IDLE — Python editor and shell<2>-Footnote-112630252 +Node: Menus12630317 +Ref: library/idle menus12630425 +Ref: 3f3812630425 +Node: File menu Shell and Editor12631707 +Ref: library/idle file-menu-shell-and-editor12631810 +Ref: 3f3912631810 +Node: Edit menu Shell and Editor12633660 +Ref: library/idle edit-menu-shell-and-editor12633802 +Ref: 3f3a12633802 +Node: Format menu Editor window only12635543 +Ref: library/idle format-menu12635686 +Ref: 3f3d12635686 +Ref: library/idle format-menu-editor-window-only12635686 +Ref: 3f3e12635686 +Node: Run menu Editor window only12637055 +Ref: library/idle run-menu-editor-window-only12637200 +Ref: 3f3f12637200 +Ref: library/idle run-module12637279 +Ref: 3f4012637279 +Ref: library/idle run-custom12637771 +Ref: 3f4212637771 +Ref: library/idle check-module12638031 +Ref: 3f4112638031 +Ref: library/idle python-shell12638375 +Ref: 3f4312638375 +Node: Shell menu Shell window only12638437 +Ref: library/idle shell-menu-shell-window-only12638580 +Ref: 3f4412638580 +Node: Debug menu Shell window only12639097 +Ref: library/idle debug-menu-shell-window-only12639242 +Ref: 3f4512639242 +Node: Options menu Shell and Editor12640198 +Ref: library/idle options-menu-shell-and-editor12640343 +Ref: 3f4612640343 +Node: Window menu Shell and Editor12641960 +Ref: library/idle window-menu-shell-and-editor12642103 +Ref: 3f4912642103 +Node: Help menu Shell and Editor12642295 +Ref: library/idle help-menu-shell-and-editor12642422 +Ref: 3f4a12642422 +Node: Context menus12643142 +Ref: library/idle context-menus12643232 +Ref: 3f4c12643232 +Node: Editing and Navigation12644406 +Ref: library/idle editing-and-navigation12644549 +Ref: 3f4d12644549 +Ref: library/idle id112644549 +Ref: 3f4e12644549 +Node: Editor windows12644790 +Ref: library/idle editor-windows12644884 +Ref: 3f4f12644884 +Node: Key bindings12645506 +Ref: library/idle key-bindings12645630 +Ref: 3f5012645630 +Node: Automatic indentation12647049 +Ref: library/idle automatic-indentation12647177 +Ref: 3f5112647177 +Node: Search and Replace12647757 +Ref: library/idle search-and-replace12647884 +Ref: 3f5212647884 +Node: Completions12648218 +Ref: library/idle completions12648332 +Ref: 3f3b12648332 +Ref: library/idle id212648332 +Ref: 3f5312648332 +Node: Calltips12650982 +Ref: library/idle calltips12651090 +Ref: 3f3c12651090 +Ref: library/idle id312651090 +Ref: 3f5412651090 +Node: Code Context12652716 +Ref: library/idle code-context12652825 +Ref: 3f4812652825 +Ref: library/idle id412652825 +Ref: 3f5512652825 +Node: Shell window12653713 +Ref: library/idle shell-window12653825 +Ref: 3f5612653825 +Node: Text colors12655504 +Ref: library/idle text-colors12655595 +Ref: 3f5712655595 +Node: Startup and Code Execution12656628 +Ref: library/idle startup-and-code-execution12656786 +Ref: 3f5812656786 +Node: Command line usage12657917 +Ref: library/idle command-line-usage12658022 +Ref: 3f5912658022 +Ref: library/idle cmdoption-idle-c12658253 +Ref: 3f5a12658253 +Ref: library/idle cmdoption-idle-d12658465 +Ref: 3f5b12658465 +Ref: library/idle cmdoption-idle-e12658534 +Ref: 3f5c12658534 +Ref: library/idle cmdoption-idle-h12658579 +Ref: 3f5d12658579 +Ref: library/idle cmdoption-idle-i12658667 +Ref: 3f5e12658667 +Ref: library/idle cmdoption-idle-r12658710 +Ref: 3f5f12658710 +Ref: library/idle cmdoption-idle-s12658783 +Ref: 3f6012658783 +Ref: library/idle cmdoption-idle-t12658958 +Ref: 3f6112658958 +Ref: library/idle cmdoption-idle-012659023 +Ref: 3f6212659023 +Node: Startup failure12659610 +Ref: library/idle startup-failure12659741 +Ref: 3f6312659741 +Node: Running user code12662928 +Ref: library/idle running-user-code12663061 +Ref: 3f6412663061 +Node: User output in Shell12665845 +Ref: library/idle user-output-in-shell12665994 +Ref: 3f6512665994 +Node: Developing tkinter applications12669080 +Ref: library/idle developing-tkinter-applications12669240 +Ref: 3f6612669240 +Node: Running without a subprocess12670489 +Ref: library/idle running-without-a-subprocess12670620 +Ref: 3f6712670620 +Node: Help and Preferences12672002 +Ref: library/idle help-and-preferences12672184 +Ref: 3f6812672184 +Node: Help sources12672331 +Ref: library/idle help-sources12672428 +Ref: 3f4b12672428 +Ref: library/idle id512672428 +Ref: 3f6912672428 +Node: Setting preferences12673298 +Ref: library/idle preferences12673417 +Ref: 3f4712673417 +Ref: library/idle setting-preferences12673417 +Ref: 3f6a12673417 +Node: IDLE on macOS12674426 +Ref: library/idle idle-on-macos12674543 +Ref: 3f6b12674543 +Node: Extensions12674810 +Ref: library/idle extensions12674899 +Ref: 3f6c12674899 +Node: idlelib — implementation of IDLE application12675250 +Ref: library/idle idlelib-implementation-of-idle-application12675397 +Ref: 3f6d12675397 +Ref: library/idle module-idlelib12675397 +Ref: 7312675397 +Ref: idlelib — implementation of IDLE application-Footnote-112676105 +Ref: idlelib — implementation of IDLE application-Footnote-212676169 +Node: Development Tools12676211 +Ref: library/development doc12676366 +Ref: 3f6e12676366 +Ref: library/development development12676366 +Ref: 3f6f12676366 +Ref: library/development development-tools12676366 +Ref: 3f7012676366 +Node: typing — Support for type hints12678296 +Ref: library/typing doc12678448 +Ref: 3f7112678448 +Ref: library/typing typing-support-for-type-hints12678448 +Ref: 3f7212678448 +Ref: library/typing module-typing12678537 +Ref: 10412678537 +Ref: typing — Support for type hints-Footnote-112680669 +Ref: typing — Support for type hints-Footnote-212680735 +Ref: typing — Support for type hints-Footnote-312680787 +Ref: typing — Support for type hints-Footnote-412680854 +Ref: typing — Support for type hints-Footnote-512680911 +Node: Specification for the Python Type System12680956 +Ref: library/typing relevant-peps12681087 +Ref: 3f7312681087 +Ref: library/typing specification-for-the-python-type-system12681087 +Ref: 3f7412681087 +Ref: Specification for the Python Type System-Footnote-112681352 +Node: Type aliases12681412 +Ref: library/typing id212681559 +Ref: 3f7512681559 +Ref: library/typing type-aliases12681559 +Ref: 44f12681559 +Node: NewType12683064 +Ref: library/typing distinct12683198 +Ref: 3f7612683198 +Ref: library/typing newtype12683198 +Ref: 3f7712683198 +Ref: NewType-Footnote-112686295 +Node: Annotating callable objects12686337 +Ref: library/typing annotating-callable-objects12686467 +Ref: 3f7812686467 +Ref: library/typing annotating-callables12686467 +Ref: 253312686467 +Ref: Annotating callable objects-Footnote-112689558 +Node: Generics12689600 +Ref: library/typing generics12689740 +Ref: 1f7f12689740 +Ref: library/typing id312689740 +Ref: 3f7a12689740 +Node: Annotating tuples12691045 +Ref: library/typing annotating-tuples12691183 +Ref: 3f7b12691183 +Ref: library/typing id412691183 +Ref: 3f7c12691183 +Node: The type of class objects12693530 +Ref: library/typing the-type-of-class-objects12693696 +Ref: 3f7d12693696 +Ref: library/typing type-of-class-objects12693696 +Ref: 3f7e12693696 +Node: Annotating generators and coroutines12695375 +Ref: library/typing annotating-generators-and-coroutines12695550 +Ref: 253412695550 +Ref: library/typing id512695550 +Ref: 3f8012695550 +Node: User-defined generic types12698117 +Ref: library/typing user-defined-generic-types12698279 +Ref: 3f8112698279 +Ref: library/typing user-defined-generics12698279 +Ref: 4cb12698279 +Ref: User-defined generic types-Footnote-112704194 +Node: The Any type12704236 +Ref: library/typing the-any-type12704393 +Ref: 3f8312704393 +Node: Nominal vs structural subtyping12707028 +Ref: library/typing nominal-vs-structural-subtyping12707177 +Ref: 3f8412707177 +Ref: Nominal vs structural subtyping-Footnote-112708853 +Ref: Nominal vs structural subtyping-Footnote-212708895 +Ref: Nominal vs structural subtyping-Footnote-312708937 +Node: Module contents<3>12708979 +Ref: library/typing module-contents12709154 +Ref: 3f8512709154 +Node: Special typing primitives12709476 +Ref: library/typing special-typing-primitives12709577 +Ref: 3f8612709577 +Node: Special types12709769 +Ref: library/typing special-types12709866 +Ref: 3f8712709866 +Ref: library/typing typing Any12710009 +Ref: 6a812710009 +Ref: library/typing typing AnyStr12710406 +Ref: 2b412710406 +Ref: library/typing typing LiteralString12712221 +Ref: 5c612712221 +Ref: library/typing typing Never12713445 +Ref: 6a412713445 +Ref: library/typing typing NoReturn12713468 +Ref: 3f8912713468 +Ref: library/typing typing Self12714707 +Ref: 5c312714707 +Ref: library/typing typing TypeAlias12716638 +Ref: 7c412716638 +Ref: Special types-Footnote-112718269 +Ref: Special types-Footnote-212718311 +Ref: Special types-Footnote-312718353 +Ref: Special types-Footnote-412718403 +Ref: Special types-Footnote-512718445 +Node: Special forms12718487 +Ref: library/typing special-forms12718632 +Ref: 3f8a12718632 +Ref: library/typing typing Union12718802 +Ref: 63712718802 +Ref: library/typing typing Optional12720219 +Ref: 6af12720219 +Ref: library/typing typing Concatenate12721030 +Ref: 7bf12721030 +Ref: library/typing typing Literal12723424 +Ref: 85112723424 +Ref: library/typing typing ClassVar12725518 +Ref: 26812725518 +Ref: library/typing typing Final12726718 +Ref: 26912726718 +Ref: library/typing typing Required12727465 +Ref: 5c012727465 +Ref: library/typing typing NotRequired12727733 +Ref: 5c112727733 +Ref: library/typing typing ReadOnly12727953 +Ref: 16112727953 +Ref: library/typing typing Annotated12728482 +Ref: 93d12728482 +Ref: library/typing typing TypeIs12734245 +Ref: 16312734245 +Ref: library/typing typing TypeGuard12738051 +Ref: 16412738051 +Ref: library/typing typing Unpack12740472 +Ref: 162f12740472 +Ref: Special forms-Footnote-112742179 +Ref: Special forms-Footnote-212742221 +Ref: Special forms-Footnote-312742263 +Ref: Special forms-Footnote-412742305 +Ref: Special forms-Footnote-512742347 +Ref: Special forms-Footnote-612742389 +Ref: Special forms-Footnote-712742431 +Ref: Special forms-Footnote-812742473 +Ref: Special forms-Footnote-912742515 +Ref: Special forms-Footnote-1012742557 +Ref: Special forms-Footnote-1112742600 +Node: Building generic types and type aliases12742643 +Ref: library/typing building-generic-types-and-type-aliases12742799 +Ref: 3f8c12742799 +Ref: library/typing typing Generic12743310 +Ref: 161912743310 +Ref: library/typing typevar12744515 +Ref: 3f8212744515 +Ref: library/typing typing TypeVar12744515 +Ref: 15d12744515 +Ref: library/typing typing-constrained-typevar12748039 +Ref: 3f8812748039 +Ref: library/typing typing TypeVar __name__12748657 +Ref: 3f8d12748657 +Ref: library/typing typing TypeVar __covariant__12748729 +Ref: 3f8e12748729 +Ref: library/typing typing TypeVar __contravariant__12748837 +Ref: 3f8f12748837 +Ref: library/typing typing TypeVar __infer_variance__12748963 +Ref: 3f9012748963 +Ref: library/typing typing TypeVar __bound__12749134 +Ref: 3f9112749134 +Ref: library/typing typing TypeVar __constraints__12749490 +Ref: 3f9212749490 +Ref: library/typing typing TypeVar __default__12749888 +Ref: 3f9312749888 +Ref: library/typing typing TypeVar has_default12750070 +Ref: 3f9412750070 +Ref: library/typing typevartuple12750717 +Ref: 3f8b12750717 +Ref: library/typing typing TypeVarTuple12750717 +Ref: 15f12750717 +Ref: library/typing typing TypeVarTuple __name__12754981 +Ref: 3f9512754981 +Ref: library/typing typing TypeVarTuple __default__12755059 +Ref: 3f9612755059 +Ref: library/typing typing TypeVarTuple has_default12755247 +Ref: 3f9712755247 +Ref: library/typing typing ParamSpec12755890 +Ref: 15e12755890 +Ref: library/typing typing ParamSpec args12758386 +Ref: 3f9912758386 +Ref: library/typing typing ParamSpec kwargs12758412 +Ref: 3f9a12758412 +Ref: library/typing typing ParamSpec __name__12759176 +Ref: 3f9b12759176 +Ref: library/typing typing ParamSpec __default__12759258 +Ref: 3f9c12759258 +Ref: library/typing typing ParamSpec has_default12759450 +Ref: 3f9d12759450 +Ref: library/typing typing ParamSpecArgs12760791 +Ref: 7c112760791 +Ref: library/typing typing ParamSpecKwargs12760822 +Ref: 7c212760822 +Ref: library/typing typing TypeAliasType12761537 +Ref: 45012761537 +Ref: library/typing typing TypeAliasType __name__12761830 +Ref: 3f9e12761830 +Ref: library/typing typing TypeAliasType __module__12761993 +Ref: 3f9f12761993 +Ref: library/typing typing TypeAliasType __type_params__12762183 +Ref: 3fa012762183 +Ref: library/typing typing TypeAliasType __value__12762554 +Ref: 3fa112762554 +Ref: Building generic types and type aliases-Footnote-112763150 +Ref: Building generic types and type aliases-Footnote-212763192 +Ref: Building generic types and type aliases-Footnote-312763234 +Ref: Building generic types and type aliases-Footnote-412763276 +Ref: Building generic types and type aliases-Footnote-512763318 +Ref: Building generic types and type aliases-Footnote-612763360 +Ref: Building generic types and type aliases-Footnote-712763402 +Node: Other special directives12763444 +Ref: library/typing other-special-directives12763578 +Ref: 3fa212763578 +Ref: library/typing typing NamedTuple12763804 +Ref: 2b212763804 +Ref: library/typing typing NewType12767000 +Ref: cf512767000 +Ref: library/typing typing NewType __module__12767441 +Ref: 3fa312767441 +Ref: library/typing typing NewType __name__12767529 +Ref: 3fa412767529 +Ref: library/typing typing NewType __supertype__12767596 +Ref: 3fa512767596 +Ref: library/typing typing Protocol12767801 +Ref: 26612767801 +Ref: library/typing typing runtime_checkable12769182 +Ref: 43e12769182 +Ref: library/typing typing TypedDict12771862 +Ref: 16212771862 +Ref: library/typing typing TypedDict __total__12776571 +Ref: 3fa612776571 +Ref: library/typing typing TypedDict __required_keys__12777635 +Ref: 3fa712777635 +Ref: library/typing typing TypedDict __optional_keys__12777707 +Ref: 3fa812777707 +Ref: library/typing typing TypedDict __readonly_keys__12779520 +Ref: 3fa912779520 +Ref: library/typing typing TypedDict __mutable_keys__12779762 +Ref: 3faa12779762 +Ref: Other special directives-Footnote-112781114 +Ref: Other special directives-Footnote-212781156 +Ref: Other special directives-Footnote-312781198 +Ref: Other special directives-Footnote-412781240 +Node: Protocols<3>12781282 +Ref: library/typing protocols12781416 +Ref: 3fab12781416 +Ref: library/typing typing SupportsAbs12781578 +Ref: 3fac12781578 +Ref: library/typing typing SupportsBytes12781704 +Ref: 5e612781704 +Ref: library/typing typing SupportsComplex12781792 +Ref: 5e512781792 +Ref: library/typing typing SupportsFloat12781884 +Ref: 3fad12781884 +Ref: library/typing typing SupportsIndex12781972 +Ref: a4512781972 +Ref: library/typing typing SupportsInt12782088 +Ref: a4412782088 +Ref: library/typing typing SupportsRound12782172 +Ref: 3fae12782172 +Node: ABCs for working with IO12782302 +Ref: library/typing abcs-for-working-with-io12782435 +Ref: 3faf12782435 +Ref: library/typing typing IO12782506 +Ref: 72612782506 +Ref: library/typing typing TextIO12782527 +Ref: 3fb012782527 +Ref: library/typing typing BinaryIO12782552 +Ref: 3fb112782552 +Node: Functions and decorators12782771 +Ref: library/typing functions-and-decorators12782913 +Ref: 3fb212782913 +Ref: library/typing typing cast12782984 +Ref: 3f9812782984 +Ref: library/typing typing assert_type12783285 +Ref: 6a712783285 +Ref: library/typing typing assert_never12784380 +Ref: 6a312784380 +Ref: library/typing typing reveal_type12785785 +Ref: 6a612785785 +Ref: library/typing typing dataclass_transform12786979 +Ref: 4d012786979 +Ref: library/typing overload12793011 +Ref: 3f7912793011 +Ref: library/typing typing overload12793011 +Ref: 3fb312793011 +Ref: library/typing typing get_overloads12794542 +Ref: 6aa12794542 +Ref: library/typing typing clear_overloads12795217 +Ref: 6ab12795217 +Ref: library/typing typing final12795417 +Ref: 6a912795417 +Ref: library/typing typing no_type_check12796678 +Ref: 6b012796678 +Ref: library/typing typing no_type_check_decorator12797166 +Ref: 2b312797166 +Ref: library/typing typing override12797632 +Ref: 44612797632 +Ref: library/typing typing type_check_only12798978 +Ref: 3fb412798978 +Ref: Functions and decorators-Footnote-112799686 +Ref: Functions and decorators-Footnote-212799754 +Ref: Functions and decorators-Footnote-312799796 +Ref: Functions and decorators-Footnote-412799838 +Ref: Functions and decorators-Footnote-512799880 +Node: Introspection helpers12799922 +Ref: library/typing introspection-helpers12800048 +Ref: 3fb512800048 +Ref: library/typing typing get_type_hints12800113 +Ref: 6ad12800113 +Ref: library/typing typing get_origin12802650 +Ref: a4612802650 +Ref: library/typing typing get_args12803510 +Ref: 87c12803510 +Ref: library/typing typing get_protocol_members12804152 +Ref: 26512804152 +Ref: library/typing typing is_protocol12804610 +Ref: 26712804610 +Ref: library/typing typing is_typeddict12804916 +Ref: 85212804916 +Ref: library/typing typing ForwardRef12805362 +Ref: 184312805362 +Ref: library/typing typing NoDefault12805972 +Ref: 26412805972 +Ref: Introspection helpers-Footnote-112806360 +Ref: Introspection helpers-Footnote-212806402 +Node: Constant12806444 +Ref: library/typing constant12806564 +Ref: 3fb612806564 +Ref: library/typing typing TYPE_CHECKING12806603 +Ref: cf412806603 +Ref: library/typing generic-concrete-collections12807617 +Ref: 3fb712807617 +Ref: Constant-Footnote-112807653 +Node: Deprecated aliases12807695 +Ref: library/typing deprecated-aliases12807785 +Ref: 3fb812807785 +Ref: library/typing id612807785 +Ref: 3fb912807785 +Ref: Deprecated aliases-Footnote-112809369 +Node: Aliases to built-in types12809411 +Ref: library/typing aliases-to-built-in-types12809531 +Ref: 3fba12809531 +Ref: library/typing corresponding-to-built-in-types12809531 +Ref: 3fbb12809531 +Ref: library/typing typing Dict12809604 +Ref: 3fbc12809604 +Ref: library/typing typing List12810049 +Ref: 3fbd12810049 +Ref: library/typing typing Set12810517 +Ref: 3fbe12810517 +Ref: library/typing typing FrozenSet12810975 +Ref: 3fbf12810975 +Ref: library/typing typing Tuple12811258 +Ref: 3fc012811258 +Ref: library/typing typing Type12811625 +Ref: 3f7f12811625 +Ref: Aliases to built-in types-Footnote-112812070 +Ref: Aliases to built-in types-Footnote-212812112 +Ref: Aliases to built-in types-Footnote-312812154 +Ref: Aliases to built-in types-Footnote-412812196 +Ref: Aliases to built-in types-Footnote-512812238 +Ref: Aliases to built-in types-Footnote-612812280 +Node: Aliases to types in collections12812322 +Ref: library/typing aliases-to-types-in-collections12812482 +Ref: 3fc112812482 +Ref: library/typing corresponding-to-types-in-collections12812482 +Ref: 3fc212812482 +Ref: library/typing typing DefaultDict12812575 +Ref: 3fc312812575 +Ref: library/typing typing OrderedDict12812931 +Ref: 3fc412812931 +Ref: library/typing typing ChainMap12813285 +Ref: 3fc512813285 +Ref: library/typing typing Counter12813627 +Ref: 3fc612813627 +Ref: library/typing typing Deque12813947 +Ref: 3fc712813947 +Ref: Aliases to types in collections-Footnote-112814287 +Ref: Aliases to types in collections-Footnote-212814329 +Ref: Aliases to types in collections-Footnote-312814371 +Ref: Aliases to types in collections-Footnote-412814413 +Ref: Aliases to types in collections-Footnote-512814455 +Node: Aliases to other concrete types12814497 +Ref: library/typing aliases-to-other-concrete-types12814676 +Ref: 3fc812814676 +Ref: library/typing other-concrete-types12814676 +Ref: 3fc912814676 +Ref: library/typing typing Pattern12814761 +Ref: 72712814761 +Ref: library/typing typing Match12814787 +Ref: 3fca12814787 +Ref: library/typing typing Text12815368 +Ref: 30512815368 +Ref: library/typing abstract-base-classes12816130 +Ref: 3fcb12816130 +Ref: Aliases to other concrete types-Footnote-112816166 +Node: Aliases to container ABCs in collections abc12816208 +Ref: library/typing aliases-to-container-abcs-in-collections-abc12816403 +Ref: 3fcc12816403 +Ref: library/typing corresponding-to-collections-in-collections-abc12816403 +Ref: 3fcd12816403 +Ref: library/typing typing AbstractSet12816522 +Ref: 3fce12816522 +Ref: library/typing typing ByteString12816799 +Ref: 2d712816799 +Ref: library/typing typing Collection12817148 +Ref: cf312817148 +Ref: library/typing typing Container12817486 +Ref: 3fcf12817486 +Ref: library/typing typing ItemsView12817770 +Ref: 3fd012817770 +Ref: library/typing typing KeysView12818096 +Ref: 3fd112818096 +Ref: library/typing typing Mapping12818395 +Ref: 3fd212818395 +Ref: library/typing typing MappingView12818692 +Ref: 3fd312818692 +Ref: library/typing typing MutableMapping12818974 +Ref: 3fd412818974 +Ref: library/typing typing MutableSequence12819275 +Ref: 3fd512819275 +Ref: library/typing typing MutableSet12819573 +Ref: 3fd612819573 +Ref: library/typing typing Sequence12819862 +Ref: 3fd712819862 +Ref: library/typing typing ValuesView12820165 +Ref: 3fd812820165 +Ref: Aliases to container ABCs in collections abc-Footnote-112820507 +Ref: Aliases to container ABCs in collections abc-Footnote-212820549 +Ref: Aliases to container ABCs in collections abc-Footnote-312820591 +Ref: Aliases to container ABCs in collections abc-Footnote-412820633 +Ref: Aliases to container ABCs in collections abc-Footnote-512820675 +Ref: Aliases to container ABCs in collections abc-Footnote-612820717 +Ref: Aliases to container ABCs in collections abc-Footnote-712820759 +Ref: Aliases to container ABCs in collections abc-Footnote-812820801 +Ref: Aliases to container ABCs in collections abc-Footnote-912820843 +Ref: Aliases to container ABCs in collections abc-Footnote-1012820885 +Ref: Aliases to container ABCs in collections abc-Footnote-1112820928 +Ref: Aliases to container ABCs in collections abc-Footnote-1212820971 +Node: Aliases to asynchronous ABCs in collections abc12821014 +Ref: library/typing aliases-to-asynchronous-abcs-in-collections-abc12821218 +Ref: 3fd912821218 +Ref: library/typing asynchronous-programming12821218 +Ref: 3fda12821218 +Ref: library/typing typing Coroutine12821343 +Ref: 194a12821343 +Ref: library/typing typing AsyncGenerator12821892 +Ref: 162c12821892 +Ref: library/typing typing AsyncIterable12822541 +Ref: 3fdb12822541 +Ref: library/typing typing AsyncIterator12822865 +Ref: 3fdc12822865 +Ref: library/typing typing Awaitable12823195 +Ref: 3fdd12823195 +Ref: Aliases to asynchronous ABCs in collections abc-Footnote-112823543 +Ref: Aliases to asynchronous ABCs in collections abc-Footnote-212823585 +Ref: Aliases to asynchronous ABCs in collections abc-Footnote-312823627 +Ref: Aliases to asynchronous ABCs in collections abc-Footnote-412823669 +Ref: Aliases to asynchronous ABCs in collections abc-Footnote-512823711 +Node: Aliases to other ABCs in collections abc12823753 +Ref: library/typing aliases-to-other-abcs-in-collections-abc12823939 +Ref: 3fde12823939 +Ref: library/typing corresponding-to-other-types-in-collections-abc12823939 +Ref: 3fdf12823939 +Ref: library/typing typing Iterable12824050 +Ref: 3fe012824050 +Ref: library/typing typing Iterator12824331 +Ref: 3fe112824331 +Ref: library/typing typing Callable12824613 +Ref: 7c012824613 +Ref: library/typing typing Generator12825194 +Ref: 162b12825194 +Ref: library/typing typing Hashable12825804 +Ref: 4ef12825804 +Ref: library/typing typing Reversible12825996 +Ref: 3fe212825996 +Ref: library/typing typing Sized12826282 +Ref: 4f012826282 +Ref: Aliases to other ABCs in collections abc-Footnote-112826501 +Ref: Aliases to other ABCs in collections abc-Footnote-212826543 +Ref: Aliases to other ABCs in collections abc-Footnote-312826585 +Ref: Aliases to other ABCs in collections abc-Footnote-412826627 +Ref: Aliases to other ABCs in collections abc-Footnote-512826669 +Ref: Aliases to other ABCs in collections abc-Footnote-612826711 +Node: Aliases to contextlib ABCs12826753 +Ref: library/typing aliases-to-contextlib-abcs12826883 +Ref: 3fe312826883 +Ref: library/typing context-manager-types12826883 +Ref: 3fe412826883 +Ref: library/typing typing ContextManager12826966 +Ref: c8e12826966 +Ref: library/typing typing AsyncContextManager12827688 +Ref: 162912827688 +Ref: Aliases to contextlib ABCs-Footnote-112828477 +Ref: Aliases to contextlib ABCs-Footnote-212828519 +Node: Deprecation Timeline of Major Features12828561 +Ref: library/typing deprecation-timeline-of-major-features12828696 +Ref: 3fe512828696 +Ref: Deprecation Timeline of Major Features-Footnote-112831452 +Ref: Deprecation Timeline of Major Features-Footnote-212831494 +Ref: Deprecation Timeline of Major Features-Footnote-312831549 +Ref: Deprecation Timeline of Major Features-Footnote-412831604 +Ref: Deprecation Timeline of Major Features-Footnote-512831659 +Ref: Deprecation Timeline of Major Features-Footnote-612831701 +Ref: Deprecation Timeline of Major Features-Footnote-712831757 +Node: pydoc — Documentation generator and online help system12831813 +Ref: library/pydoc doc12831997 +Ref: 3fe612831997 +Ref: library/pydoc module-pydoc12831997 +Ref: b512831997 +Ref: library/pydoc pydoc-documentation-generator-and-online-help-system12831997 +Ref: 3fe712831997 +Ref: pydoc — Documentation generator and online help system-Footnote-112836986 +Node: Python Development Mode12837051 +Ref: library/devmode doc12837246 +Ref: 3fe812837246 +Ref: library/devmode devmode12837246 +Ref: 1fa12837246 +Ref: library/devmode python-development-mode12837246 +Ref: 3fe912837246 +Node: Effects of the Python Development Mode12837881 +Ref: library/devmode effects-of-the-python-development-mode12838011 +Ref: 3fea12838011 +Node: ResourceWarning Example12841708 +Ref: library/devmode resourcewarning-example12841880 +Ref: 3feb12841880 +Node: Bad file descriptor error example12843792 +Ref: library/devmode bad-file-descriptor-error-example12843917 +Ref: 3fec12843917 +Ref: Bad file descriptor error example-Footnote-112845452 +Node: doctest — Test interactive Python examples12845517 +Ref: library/doctest doc12845691 +Ref: 3fed12845691 +Ref: library/doctest doctest-test-interactive-python-examples12845691 +Ref: 3fee12845691 +Ref: library/doctest module-doctest12845691 +Ref: 3a12845691 +Ref: doctest — Test interactive Python examples-Footnote-112849829 +Node: Simple Usage Checking Examples in Docstrings12849896 +Ref: library/doctest doctest-simple-testmod12850075 +Ref: 3fef12850075 +Ref: library/doctest simple-usage-checking-examples-in-docstrings12850075 +Ref: 3ff012850075 +Node: Simple Usage Checking Examples in a Text File12851498 +Ref: library/doctest doctest-simple-testfile12851704 +Ref: 3ff312851704 +Ref: library/doctest simple-usage-checking-examples-in-a-text-file12851704 +Ref: 3ff412851704 +Node: Command-line Usage12853750 +Ref: library/doctest command-line-usage12853924 +Ref: 3ff612853924 +Ref: library/doctest doctest-cli12853924 +Ref: 3ff112853924 +Ref: library/doctest cmdoption-doctest-v12854124 +Ref: 3ff712854124 +Ref: library/doctest cmdoption-doctest-verbose12854124 +Ref: 3ff812854124 +Ref: library/doctest cmdoption-doctest-o12854732 +Ref: 3ff912854732 +Ref: library/doctest cmdoption-doctest-option12854732 +Ref: 3ffa12854732 +Ref: library/doctest cmdoption-doctest-f12854905 +Ref: 3ffb12854905 +Ref: library/doctest cmdoption-doctest-fail-fast12854905 +Ref: 3ffc12854905 +Node: How It Works12855010 +Ref: library/doctest doctest-how-it-works12855148 +Ref: 3ffd12855148 +Ref: library/doctest how-it-works12855148 +Ref: 3ffe12855148 +Node: Which Docstrings Are Examined?12855803 +Ref: library/doctest doctest-which-docstrings12855929 +Ref: 3fff12855929 +Ref: library/doctest which-docstrings-are-examined12855929 +Ref: 400012855929 +Ref: library/doctest module __test__12856145 +Ref: 400112856145 +Node: How are Docstring Examples Recognized?12857423 +Ref: library/doctest doctest-finding-examples12857589 +Ref: 400212857589 +Ref: library/doctest how-are-docstring-examples-recognized12857589 +Ref: 400312857589 +Node: What’s the Execution Context?12860705 +Ref: library/doctest doctest-execution-context12860863 +Ref: 400712860863 +Ref: library/doctest what-s-the-execution-context12860863 +Ref: 400812860863 +Node: What About Exceptions?12861581 +Ref: library/doctest doctest-exceptions12861713 +Ref: 400912861713 +Ref: library/doctest what-about-exceptions12861713 +Ref: 400a12861713 +Ref: library/doctest option-flags-and-directives12866260 +Ref: 400b12866260 +Ref: What About Exceptions?-Footnote-112866297 +Node: Option Flags12866497 +Ref: library/doctest doctest-options12866608 +Ref: f2e12866608 +Ref: library/doctest option-flags12866608 +Ref: 400c12866608 +Ref: library/doctest doctest DONT_ACCEPT_TRUE_FOR_112867171 +Ref: 400d12867171 +Ref: library/doctest doctest DONT_ACCEPT_BLANKLINE12867799 +Ref: 400e12867799 +Ref: library/doctest doctest NORMALIZE_WHITESPACE12868252 +Ref: 400412868252 +Ref: library/doctest doctest ELLIPSIS12868742 +Ref: 143712868742 +Ref: library/doctest doctest IGNORE_EXCEPTION_DETAIL12869178 +Ref: 12fc12869178 +Ref: library/doctest doctest SKIP12870642 +Ref: 400f12870642 +Ref: library/doctest doctest COMPARISON_FLAGS12871156 +Ref: 401012871156 +Ref: library/doctest doctest REPORT_UDIFF12871328 +Ref: 143812871328 +Ref: library/doctest doctest REPORT_CDIFF12871484 +Ref: 143912871484 +Ref: library/doctest doctest REPORT_NDIFF12871644 +Ref: 143a12871644 +Ref: library/doctest doctest REPORT_ONLY_FIRST_FAILURE12872108 +Ref: 401112872108 +Ref: library/doctest doctest FAIL_FAST12872687 +Ref: f2f12872687 +Ref: library/doctest doctest REPORTING_FLAGS12873025 +Ref: 401212873025 +Ref: library/doctest doctest register_optionflag12873282 +Ref: 401312873282 +Node: Directives12873772 +Ref: library/doctest directives12873872 +Ref: 401612873872 +Ref: library/doctest doctest-directives12873872 +Ref: 400512873872 +Ref: library/doctest grammar-token-doctest-directive12874099 +Ref: 401712874099 +Ref: library/doctest grammar-token-doctest-directive_options12874176 +Ref: 401812874176 +Ref: library/doctest grammar-token-doctest-directive_option12874274 +Ref: 401912874274 +Ref: library/doctest grammar-token-doctest-on_or_off12874363 +Ref: 401a12874363 +Ref: library/doctest grammar-token-doctest-directive_option_name12874404 +Ref: 401b12874404 +Node: Warnings<2>12876505 +Ref: library/doctest doctest-warnings12876584 +Ref: 401c12876584 +Ref: library/doctest warnings12876584 +Ref: 401d12876584 +Node: Basic API12878336 +Ref: library/doctest basic-api12878468 +Ref: 401e12878468 +Ref: library/doctest doctest-basic-api12878468 +Ref: 3ff212878468 +Ref: library/doctest doctest testfile12878852 +Ref: 3ff512878852 +Ref: library/doctest doctest testmod12882797 +Ref: 143612882797 +Ref: library/doctest doctest run_docstring_examples12884521 +Ref: 402012884521 +Node: Unittest API12885499 +Ref: library/doctest doctest-unittest-api12885631 +Ref: 402112885631 +Ref: library/doctest unittest-api12885631 +Ref: 402212885631 +Ref: library/doctest doctest DocFileSuite12886406 +Ref: 402412886406 +Ref: library/doctest doctest DocTestSuite12890273 +Ref: df212890273 +Ref: library/doctest doctest set_unittest_reportflags12893605 +Ref: 402712893605 +Node: Advanced API12894779 +Ref: library/doctest advanced-api12894911 +Ref: 402812894911 +Ref: library/doctest doctest-advanced-api12894911 +Ref: 402912894911 +Node: DocTest Objects12897076 +Ref: library/doctest doctest-doctest12897164 +Ref: 402b12897164 +Ref: library/doctest doctest-objects12897164 +Ref: 402c12897164 +Ref: library/doctest doctest DocTest12897217 +Ref: 16b212897217 +Ref: library/doctest doctest DocTest examples12897633 +Ref: 402d12897633 +Ref: library/doctest doctest DocTest globs12897808 +Ref: 402612897808 +Ref: library/doctest doctest DocTest name12898143 +Ref: 402e12898143 +Ref: library/doctest doctest DocTest filename12898336 +Ref: 402f12898336 +Ref: library/doctest doctest DocTest lineno12898566 +Ref: 151e12898566 +Ref: library/doctest doctest DocTest docstring12898844 +Ref: 403012898844 +Node: Example Objects12899043 +Ref: library/doctest doctest-example12899161 +Ref: 403112899161 +Ref: library/doctest example-objects12899161 +Ref: 403212899161 +Ref: library/doctest doctest Example12899214 +Ref: 402a12899214 +Ref: library/doctest doctest Example source12899653 +Ref: 403312899653 +Ref: library/doctest doctest Example want12899897 +Ref: 403412899897 +Ref: library/doctest doctest Example exc_msg12900248 +Ref: 403512900248 +Ref: library/doctest doctest Example lineno12900732 +Ref: 403612900732 +Ref: library/doctest doctest Example indent12900963 +Ref: 403712900963 +Ref: library/doctest doctest Example options12901156 +Ref: 403812901156 +Node: DocTestFinder objects12901568 +Ref: library/doctest doctest-doctestfinder12901692 +Ref: 403912901692 +Ref: library/doctest doctestfinder-objects12901692 +Ref: 403a12901692 +Ref: library/doctest doctest DocTestFinder12901757 +Ref: 163212901757 +Ref: library/doctest doctest DocTestFinder find12902896 +Ref: 16fe12902896 +Node: DocTestParser objects12905020 +Ref: library/doctest doctest-doctestparser12905148 +Ref: 403b12905148 +Ref: library/doctest doctestparser-objects12905148 +Ref: 403c12905148 +Ref: library/doctest doctest DocTestParser12905213 +Ref: 400612905213 +Ref: library/doctest doctest DocTestParser get_doctest12905447 +Ref: 403d12905447 +Ref: library/doctest doctest DocTestParser get_examples12905835 +Ref: 403e12905835 +Ref: library/doctest doctest DocTestParser parse12906173 +Ref: 403f12906173 +Node: TestResults objects12906561 +Ref: library/doctest testresults-objects12906689 +Ref: 404012906689 +Ref: library/doctest doctest TestResults12906750 +Ref: 404112906750 +Ref: library/doctest doctest TestResults failed12906802 +Ref: 404212906802 +Ref: library/doctest doctest TestResults attempted12906865 +Ref: 404312906865 +Ref: library/doctest doctest TestResults skipped12906934 +Ref: 1e012906934 +Node: DocTestRunner objects12907033 +Ref: library/doctest doctest-doctestrunner12907161 +Ref: 404412907161 +Ref: library/doctest doctestrunner-objects12907161 +Ref: 404512907161 +Ref: library/doctest doctest DocTestRunner12907226 +Ref: 401512907226 +Ref: library/doctest doctest DocTestRunner report_start12909658 +Ref: 404612909658 +Ref: library/doctest doctest DocTestRunner report_success12910156 +Ref: 404712910156 +Ref: library/doctest doctest DocTestRunner report_failure12910688 +Ref: 404912910688 +Ref: library/doctest doctest DocTestRunner report_unexpected_exception12911210 +Ref: 404812911210 +Ref: library/doctest doctest DocTestRunner run12911884 +Ref: 1de12911884 +Ref: library/doctest doctest DocTestRunner summarize12912954 +Ref: 401f12912954 +Ref: library/doctest doctest DocTestRunner tries12913415 +Ref: 404a12913415 +Ref: library/doctest doctest DocTestRunner failures12913483 +Ref: 404b12913483 +Ref: library/doctest doctest DocTestRunner skips12913551 +Ref: 1df12913551 +Node: OutputChecker objects12913651 +Ref: library/doctest doctest-outputchecker12913751 +Ref: 404c12913751 +Ref: library/doctest outputchecker-objects12913751 +Ref: 404d12913751 +Ref: library/doctest doctest OutputChecker12913816 +Ref: 401412913816 +Ref: library/doctest doctest OutputChecker check_output12914312 +Ref: 404e12914312 +Ref: library/doctest doctest OutputChecker output_difference12914799 +Ref: 404f12914799 +Node: Debugging12915114 +Ref: library/doctest debugging12915241 +Ref: 405012915241 +Ref: library/doctest doctest-debugging12915241 +Ref: 405112915241 +Ref: library/doctest doctest script_from_examples12917340 +Ref: 405412917340 +Ref: library/doctest doctest testsource12918327 +Ref: 405512918327 +Ref: library/doctest doctest debug12919124 +Ref: 405312919124 +Ref: library/doctest doctest debug_src12920215 +Ref: 405712920215 +Ref: library/doctest doctest DebugRunner12921089 +Ref: 405212921089 +Ref: library/doctest doctest DocTestFailure12921866 +Ref: 405912921866 +Ref: library/doctest doctest DocTestFailure test12922229 +Ref: 405a12922229 +Ref: library/doctest doctest DocTestFailure example12922352 +Ref: 405b12922352 +Ref: library/doctest doctest DocTestFailure got12922435 +Ref: 405c12922435 +Ref: library/doctest doctest UnexpectedException12922507 +Ref: 405812922507 +Ref: library/doctest doctest UnexpectedException test12922860 +Ref: 405d12922860 +Ref: library/doctest doctest UnexpectedException example12922988 +Ref: 405e12922988 +Ref: library/doctest doctest UnexpectedException exc_info12923076 +Ref: 405f12923076 +Node: Soapbox12923237 +Ref: library/doctest doctest-soapbox12923343 +Ref: 406012923343 +Ref: library/doctest soapbox12923343 +Ref: 406112923343 +Node: unittest — Unit testing framework12927184 +Ref: library/unittest doc12927372 +Ref: 406212927372 +Ref: library/unittest module-unittest12927372 +Ref: 10612927372 +Ref: library/unittest unittest-unit-testing-framework12927372 +Ref: 406312927372 +Ref: unittest — Unit testing framework-Footnote-112930532 +Ref: unittest — Unit testing framework-Footnote-212930610 +Ref: unittest — Unit testing framework-Footnote-312930703 +Ref: unittest — Unit testing framework-Footnote-412930736 +Ref: unittest — Unit testing framework-Footnote-512930800 +Ref: unittest — Unit testing framework-Footnote-612930858 +Ref: unittest — Unit testing framework-Footnote-712930888 +Ref: unittest — Unit testing framework-Footnote-812930920 +Ref: unittest — Unit testing framework-Footnote-912930964 +Node: Basic example12930998 +Ref: library/unittest basic-example12931117 +Ref: 406512931117 +Ref: library/unittest unittest-minimal-example12931117 +Ref: 406612931117 +Node: Command-Line Interface<3>12934100 +Ref: library/unittest command-line-interface12934242 +Ref: 406812934242 +Ref: library/unittest unittest-command-line-interface12934242 +Ref: 406912934242 +Node: Command-line options<3>12935638 +Ref: library/unittest command-line-options12935723 +Ref: 406b12935723 +Ref: library/unittest cmdoption-unittest-b12935837 +Ref: 132512935837 +Ref: library/unittest cmdoption-unittest-buffer12935837 +Ref: 406c12935837 +Ref: library/unittest cmdoption-unittest-c12936096 +Ref: 132612936096 +Ref: library/unittest cmdoption-unittest-catch12936096 +Ref: 406d12936096 +Ref: library/unittest cmdoption-unittest-f12936440 +Ref: 132812936440 +Ref: library/unittest cmdoption-unittest-failfast12936440 +Ref: 406f12936440 +Ref: library/unittest cmdoption-unittest-k12936523 +Ref: 407012936523 +Ref: library/unittest cmdoption-unittest-locals12937235 +Ref: 407112937235 +Ref: library/unittest cmdoption-unittest-durations12937299 +Ref: 407212937299 +Node: Test Discovery12937771 +Ref: library/unittest test-discovery12937920 +Ref: 407312937920 +Ref: library/unittest unittest-test-discovery12937920 +Ref: 406a12937920 +Ref: library/unittest cmdoption-unittest-discover-v12938775 +Ref: 407412938775 +Ref: library/unittest cmdoption-unittest-discover-verbose12938775 +Ref: 407512938775 +Ref: library/unittest cmdoption-unittest-discover-s12938823 +Ref: 407612938823 +Ref: library/unittest cmdoption-unittest-discover-start-directory12938823 +Ref: 407712938823 +Ref: library/unittest cmdoption-unittest-discover-p12938921 +Ref: 407812938921 +Ref: library/unittest cmdoption-unittest-discover-pattern12938921 +Ref: 407912938921 +Ref: library/unittest cmdoption-unittest-discover-t12939015 +Ref: 407a12939015 +Ref: library/unittest cmdoption-unittest-discover-top-level-directory12939015 +Ref: 407b12939015 +Node: Organizing test code12941434 +Ref: library/unittest organizing-test-code12941580 +Ref: 407d12941580 +Ref: library/unittest organizing-tests12941580 +Ref: 406712941580 +Node: Re-using old test code12946346 +Ref: library/unittest legacy-unit-tests12946514 +Ref: 407e12946514 +Ref: library/unittest re-using-old-test-code12946514 +Ref: 407f12946514 +Node: Skipping tests and expected failures12948054 +Ref: library/unittest skipping-tests-and-expected-failures12948247 +Ref: 408012948247 +Ref: library/unittest unittest-skipping12948247 +Ref: 408112948247 +Ref: library/unittest unittest skip12951405 +Ref: 19d812951405 +Ref: library/unittest unittest skipIf12951553 +Ref: 408412951553 +Ref: library/unittest unittest skipUnless12951659 +Ref: 408512951659 +Ref: library/unittest unittest expectedFailure12951773 +Ref: 408312951773 +Ref: library/unittest unittest SkipTest12952082 +Ref: fdf12952082 +Node: Distinguishing test iterations using subtests12952573 +Ref: library/unittest distinguishing-test-iterations-using-subtests12952765 +Ref: 408612952765 +Ref: library/unittest subtests12952765 +Ref: fdd12952765 +Node: Classes and functions12955368 +Ref: library/unittest classes-and-functions12955549 +Ref: 408712955549 +Ref: library/unittest unittest-contents12955549 +Ref: 408812955549 +Node: Test cases12955751 +Ref: library/unittest test-cases12955842 +Ref: 408912955842 +Ref: library/unittest testcase-objects12955842 +Ref: 408a12955842 +Ref: library/unittest unittest TestCase12955885 +Ref: 44912955885 +Ref: library/unittest unittest TestCase setUp12957207 +Ref: 132c12957207 +Ref: library/unittest unittest TestCase tearDown12957584 +Ref: 132d12957584 +Ref: library/unittest unittest TestCase setUpClass12958358 +Ref: a4e12958358 +Ref: library/unittest unittest TestCase tearDownClass12958799 +Ref: 132a12958799 +Ref: library/unittest unittest TestCase run12959249 +Ref: 115a12959249 +Ref: library/unittest unittest TestCase skipTest12959878 +Ref: 408212959878 +Ref: library/unittest unittest TestCase subTest12960137 +Ref: fdc12960137 +Ref: library/unittest unittest TestCase debug12960694 +Ref: 189412960694 +Ref: library/unittest assert-methods12960929 +Ref: 406412960929 +Ref: library/unittest unittest TestCase assertEqual12964779 +Ref: 52412964779 +Ref: library/unittest unittest TestCase assertNotEqual12965651 +Ref: 52512965651 +Ref: library/unittest unittest TestCase assertTrue12965830 +Ref: 52212965830 +Ref: library/unittest unittest TestCase assertFalse12965875 +Ref: 52312965875 +Ref: library/unittest unittest TestCase assertIs12966376 +Ref: 132e12966376 +Ref: library/unittest unittest TestCase assertIsNot12966428 +Ref: 132f12966428 +Ref: library/unittest unittest TestCase assertIsNone12966603 +Ref: 127d12966603 +Ref: library/unittest unittest TestCase assertIsNotNone12966650 +Ref: 127e12966650 +Ref: library/unittest unittest TestCase assertIn12966789 +Ref: 133712966789 +Ref: library/unittest unittest TestCase assertNotIn12966845 +Ref: 133812966845 +Ref: library/unittest unittest TestCase assertIsInstance12966999 +Ref: 133012966999 +Ref: library/unittest unittest TestCase assertNotIsInstance12967054 +Ref: 133112967054 +Ref: library/unittest unittest TestCase assertRaises12970241 +Ref: 52812970241 +Ref: library/unittest unittest TestCase assertRaisesRegex12971968 +Ref: 52a12971968 +Ref: library/unittest unittest TestCase assertWarns12972978 +Ref: 115812972978 +Ref: library/unittest unittest TestCase assertWarnsRegex12974693 +Ref: 115912974693 +Ref: library/unittest unittest TestCase assertLogs12975633 +Ref: 85512975633 +Ref: library/unittest unittest TestCase records12976709 +Ref: 408e12976709 +Ref: library/unittest unittest TestCase output12976852 +Ref: 408f12976852 +Ref: library/unittest unittest TestCase assertNoLogs12977401 +Ref: 85412977401 +Ref: library/unittest unittest TestCase assertAlmostEqual12980975 +Ref: 52612980975 +Ref: library/unittest unittest TestCase assertNotAlmostEqual12981073 +Ref: 52712981073 +Ref: library/unittest unittest TestCase assertGreater12982145 +Ref: 133212982145 +Ref: library/unittest unittest TestCase assertGreaterEqual12982202 +Ref: 133312982202 +Ref: library/unittest unittest TestCase assertLess12982264 +Ref: 133412982264 +Ref: library/unittest unittest TestCase assertLessEqual12982318 +Ref: 133512982318 +Ref: library/unittest unittest TestCase assertRegex12982685 +Ref: 52912982685 +Ref: library/unittest unittest TestCase assertNotRegex12982738 +Ref: 52b12982738 +Ref: library/unittest unittest TestCase assertCountEqual12983480 +Ref: 121d12983480 +Ref: library/unittest type-specific-methods12984143 +Ref: 408d12984143 +Ref: library/unittest unittest TestCase addTypeEqualityFunc12984462 +Ref: 133b12984462 +Ref: library/unittest unittest TestCase assertMultiLineEqual12987208 +Ref: 133612987208 +Ref: library/unittest unittest TestCase assertSequenceEqual12987625 +Ref: 127c12987625 +Ref: library/unittest unittest TestCase assertListEqual12988254 +Ref: 127a12988254 +Ref: library/unittest unittest TestCase assertTupleEqual12988313 +Ref: 127b12988313 +Ref: library/unittest unittest TestCase assertSetEqual12988763 +Ref: 127812988763 +Ref: library/unittest unittest TestCase assertDictEqual12989217 +Ref: 127912989217 +Ref: library/unittest other-methods-and-attrs12989577 +Ref: 409012989577 +Ref: library/unittest unittest TestCase fail12989668 +Ref: 409112989668 +Ref: library/unittest unittest TestCase failureException12989811 +Ref: 402512989811 +Ref: library/unittest unittest TestCase longMessage12990226 +Ref: 132912990226 +Ref: library/unittest unittest TestCase maxDiff12990966 +Ref: 121e12990966 +Ref: library/unittest unittest TestCase countTestCases12991662 +Ref: 409212991662 +Ref: library/unittest unittest TestCase defaultTestResult12991844 +Ref: 408c12991844 +Ref: library/unittest unittest TestCase id12992276 +Ref: 409312992276 +Ref: library/unittest unittest TestCase shortDescription12992471 +Ref: 409412992471 +Ref: library/unittest unittest TestCase addCleanup12993090 +Ref: a8112993090 +Ref: library/unittest unittest TestCase enterContext12993698 +Ref: 6b512993698 +Ref: library/unittest unittest TestCase doCleanups12994027 +Ref: 132b12994027 +Ref: library/unittest unittest TestCase addClassCleanup12994683 +Ref: a4d12994683 +Ref: library/unittest unittest TestCase enterClassContext12995359 +Ref: 6b612995359 +Ref: library/unittest unittest TestCase doClassCleanups12995710 +Ref: 409512995710 +Ref: library/unittest unittest IsolatedAsyncioTestCase12996416 +Ref: 30612996416 +Ref: library/unittest unittest IsolatedAsyncioTestCase loop_factory12996629 +Ref: 409612996629 +Ref: library/unittest unittest IsolatedAsyncioTestCase asyncSetUp12996885 +Ref: 409712996885 +Ref: library/unittest unittest IsolatedAsyncioTestCase asyncTearDown12997320 +Ref: 409812997320 +Ref: library/unittest unittest IsolatedAsyncioTestCase addAsyncCleanup12998161 +Ref: 409912998161 +Ref: library/unittest unittest IsolatedAsyncioTestCase enterAsyncContext12998319 +Ref: 6b712998319 +Ref: library/unittest unittest IsolatedAsyncioTestCase run12998680 +Ref: 409a12998680 +Ref: library/unittest unittest FunctionTestCase13000418 +Ref: 170813000418 +Node: Grouping tests13000896 +Ref: library/unittest grouping-tests13001021 +Ref: 409b13001021 +Ref: library/unittest testsuite-objects13001021 +Ref: 409c13001021 +Ref: library/unittest unittest TestSuite13001072 +Ref: df313001072 +Ref: library/unittest unittest TestSuite addTest13002019 +Ref: 409d13002019 +Ref: library/unittest unittest TestSuite addTests13002139 +Ref: 409e13002139 +Ref: library/unittest unittest TestSuite run13002515 +Ref: 409f13002515 +Ref: library/unittest unittest TestSuite debug13002818 +Ref: 40a013002818 +Ref: library/unittest unittest TestSuite countTestCases13003091 +Ref: 40a113003091 +Ref: library/unittest unittest TestSuite __iter__13003255 +Ref: 102213003255 +Node: Loading and running tests13004700 +Ref: library/unittest loading-and-running-tests13004806 +Ref: 40a213004806 +Ref: library/unittest unittest TestLoader13004879 +Ref: 29013004879 +Ref: library/unittest unittest TestLoader errors13005373 +Ref: e8713005373 +Ref: library/unittest unittest TestLoader loadTestsFromTestCase13005842 +Ref: 29213005842 +Ref: library/unittest unittest TestLoader loadTestsFromModule13006391 +Ref: 29113006391 +Ref: library/unittest unittest TestLoader loadTestsFromName13007781 +Ref: 133913007781 +Ref: library/unittest unittest TestLoader loadTestsFromNames13009581 +Ref: 40a413009581 +Ref: library/unittest unittest TestLoader getTestCaseNames13009867 +Ref: 29313009867 +Ref: library/unittest unittest TestLoader discover13010070 +Ref: fe013010070 +Ref: library/unittest unittest TestLoader testMethodPrefix13013346 +Ref: 40a513013346 +Ref: library/unittest unittest TestLoader sortTestMethodsUsing13013632 +Ref: 40a613013632 +Ref: library/unittest unittest TestLoader suiteClass13013843 +Ref: 133a13013843 +Ref: library/unittest unittest TestLoader testNamePatterns13014138 +Ref: 40a713014138 +Ref: library/unittest unittest TestResult13014852 +Ref: 115b13014852 +Ref: library/unittest unittest TestResult errors13015718 +Ref: 40a813015718 +Ref: library/unittest unittest TestResult failures13015948 +Ref: 40a913015948 +Ref: library/unittest unittest TestResult skipped13016232 +Ref: 40aa13016232 +Ref: library/unittest unittest TestResult expectedFailures13016430 +Ref: 40ab13016430 +Ref: library/unittest unittest TestResult unexpectedSuccesses13016672 +Ref: 40ac13016672 +Ref: library/unittest unittest TestResult collectedDurations13016837 +Ref: 170e13016837 +Ref: library/unittest unittest TestResult shouldStop13017047 +Ref: 40ad13017047 +Ref: library/unittest unittest TestResult testsRun13017181 +Ref: 40af13017181 +Ref: library/unittest unittest TestResult buffer13017260 +Ref: 40b013017260 +Ref: library/unittest unittest TestResult failfast13017711 +Ref: 40b313017711 +Ref: library/unittest unittest TestResult tb_locals13017898 +Ref: 40b413017898 +Ref: library/unittest unittest TestResult wasSuccessful13018048 +Ref: 40b513018048 +Ref: library/unittest unittest TestResult stop13018385 +Ref: 40ae13018385 +Ref: library/unittest unittest TestResult startTest13019345 +Ref: 40b113019345 +Ref: library/unittest unittest TestResult stopTest13019444 +Ref: 40b213019444 +Ref: library/unittest unittest TestResult startTestRun13019579 +Ref: 133d13019579 +Ref: library/unittest unittest TestResult stopTestRun13019700 +Ref: 133e13019700 +Ref: library/unittest unittest TestResult addError13019819 +Ref: 189713019819 +Ref: library/unittest unittest TestResult addFailure13020286 +Ref: 189613020286 +Ref: library/unittest unittest TestResult addSuccess13020744 +Ref: 40b613020744 +Ref: library/unittest unittest TestResult addSkip13020886 +Ref: 189813020886 +Ref: library/unittest unittest TestResult addExpectedFailure13021182 +Ref: 40b713021182 +Ref: library/unittest unittest TestResult addUnexpectedSuccess13021608 +Ref: 40b813021608 +Ref: library/unittest unittest TestResult addSubTest13021914 +Ref: 189913021914 +Ref: library/unittest unittest TestResult addDuration13022588 +Ref: 174613022588 +Ref: library/unittest unittest TextTestResult13022834 +Ref: 52c13022834 +Ref: library/unittest unittest defaultTestLoader13023233 +Ref: 40a313023233 +Ref: library/unittest unittest TextTestRunner13023488 +Ref: 174513023488 +Ref: library/unittest unittest TextTestRunner _makeResult13024901 +Ref: 40ba13024901 +Ref: library/unittest unittest TextTestRunner run13025552 +Ref: 40bb13025552 +Ref: library/unittest unittest main13025914 +Ref: fde13025914 +Node: load_tests Protocol13028860 +Ref: library/unittest id113028941 +Ref: 407c13028941 +Ref: library/unittest load-tests-protocol13028941 +Ref: 402313028941 +Node: Class and Module Fixtures13031615 +Ref: library/unittest class-and-module-fixtures13031766 +Ref: 408b13031766 +Node: setUpClass and tearDownClass13033654 +Ref: library/unittest setupclass-and-teardownclass13033783 +Ref: 40bc13033783 +Node: setUpModule and tearDownModule13034697 +Ref: library/unittest setupmodule-and-teardownmodule13034826 +Ref: 40bd13034826 +Ref: library/unittest unittest addModuleCleanup13035439 +Ref: a4c13035439 +Ref: library/unittest unittest enterModuleContext13036019 +Ref: 6b813036019 +Ref: library/unittest unittest doModuleCleanups13036341 +Ref: 183c13036341 +Node: Signal Handling13036961 +Ref: library/unittest signal-handling13037082 +Ref: 406e13037082 +Ref: library/unittest unittest installHandler13038316 +Ref: 40be13038316 +Ref: library/unittest unittest registerResult13038560 +Ref: 40bf13038560 +Ref: library/unittest unittest removeResult13039056 +Ref: 40c013039056 +Ref: library/unittest unittest removeHandler13039278 +Ref: 132713039278 +Node: unittest mock — mock object library13039668 +Ref: library/unittest mock doc13039845 +Ref: 40c113039845 +Ref: library/unittest mock module-unittest mock13039845 +Ref: 10713039845 +Ref: library/unittest mock unittest-mock-mock-object-library13039845 +Ref: 40c213039845 +Ref: unittest mock — mock object library-Footnote-113041504 +Ref: unittest mock — mock object library-Footnote-213041577 +Node: Quick Guide13041616 +Ref: library/unittest mock quick-guide13041724 +Ref: 40c313041724 +Node: The Mock Class13047132 +Ref: library/unittest mock the-mock-class13047261 +Ref: 40c813047261 +Ref: library/unittest mock unittest mock Mock13048289 +Ref: a4b13048289 +Ref: library/unittest mock unittest mock Mock assert_called13051773 +Ref: cf813051773 +Ref: library/unittest mock unittest mock Mock assert_called_once13052065 +Ref: cf913052065 +Ref: library/unittest mock unittest mock Mock assert_called_with13052703 +Ref: 1a2013052703 +Ref: library/unittest mock unittest mock Mock assert_called_once_with13053087 +Ref: 40ce13053087 +Ref: library/unittest mock unittest mock Mock assert_any_call13053768 +Ref: 40cf13053768 +Ref: library/unittest mock unittest mock Mock assert_has_calls13054434 +Ref: 16a813054434 +Ref: library/unittest mock unittest mock Mock assert_not_called13055279 +Ref: e8913055279 +Ref: library/unittest mock unittest mock Mock reset_mock13055748 +Ref: cfa13055748 +Ref: library/unittest mock unittest mock Mock mock_add_spec13057361 +Ref: 40d113057361 +Ref: library/unittest mock unittest mock Mock attach_mock13057686 +Ref: 160f13057686 +Ref: library/unittest mock unittest mock Mock configure_mock13057979 +Ref: 40cd13057979 +Ref: library/unittest mock unittest mock Mock __dir__13059213 +Ref: 40d313059213 +Ref: library/unittest mock unittest mock Mock _get_child_mock13059546 +Ref: 40d513059546 +Ref: library/unittest mock unittest mock Mock called13059946 +Ref: 40d613059946 +Ref: library/unittest mock unittest mock Mock call_count13060246 +Ref: 40d713060246 +Ref: library/unittest mock unittest mock Mock return_value13060577 +Ref: 40cc13060577 +Ref: library/unittest mock unittest mock Mock side_effect13061383 +Ref: 40c413061383 +Ref: library/unittest mock unittest mock Mock call_args13063853 +Ref: 197f13063853 +Ref: library/unittest mock unittest mock Mock call_args_list13065683 +Ref: 40d813065683 +Ref: library/unittest mock unittest mock Mock method_calls13066726 +Ref: 40d213066726 +Ref: library/unittest mock unittest mock Mock mock_calls13067464 +Ref: 40d013067464 +Ref: library/unittest mock unittest mock Mock __class__13069002 +Ref: 40da13069002 +Ref: library/unittest mock unittest mock NonCallableMock13069761 +Ref: 40c913069761 +Ref: library/unittest mock unittest mock PropertyMock13072279 +Ref: 40db13072279 +Ref: library/unittest mock unittest mock AsyncMock13074179 +Ref: a4a13074179 +Ref: library/unittest mock unittest mock AsyncMock assert_awaited13077042 +Ref: 40dc13077042 +Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once13077777 +Ref: 40dd13077777 +Ref: library/unittest mock unittest mock AsyncMock assert_awaited_with13078335 +Ref: 40de13078335 +Ref: library/unittest mock unittest mock AsyncMock assert_awaited_once_with13079005 +Ref: 40df13079005 +Ref: library/unittest mock unittest mock AsyncMock assert_any_await13079730 +Ref: 40e013079730 +Ref: library/unittest mock unittest mock AsyncMock assert_has_awaits13080373 +Ref: 40e113080373 +Ref: library/unittest mock unittest mock AsyncMock assert_not_awaited13081468 +Ref: 40e213081468 +Ref: library/unittest mock unittest mock AsyncMock reset_mock13081643 +Ref: 40e313081643 +Ref: library/unittest mock unittest mock AsyncMock await_count13081874 +Ref: 40e413081874 +Ref: library/unittest mock unittest mock AsyncMock await_args13082320 +Ref: 40e513082320 +Ref: library/unittest mock unittest mock AsyncMock await_args_list13082939 +Ref: 197e13082939 +Ref: library/unittest mock unittest mock ThreadingMock13083651 +Ref: 40e613083651 +Ref: library/unittest mock unittest mock ThreadingMock wait_until_called13084358 +Ref: 40e813084358 +Ref: library/unittest mock unittest mock ThreadingMock wait_until_any_call_with13084911 +Ref: 40e913084911 +Ref: library/unittest mock unittest mock ThreadingMock DEFAULT_TIMEOUT13085510 +Ref: 40e713085510 +Ref: The Mock Class-Footnote-113085835 +Node: Calling13086257 +Ref: library/unittest mock calling13086343 +Ref: 40ea13086343 +Node: Deleting Attributes13089613 +Ref: library/unittest mock deleting-attributes13089741 +Ref: 40eb13089741 +Ref: library/unittest mock id213089741 +Ref: 40ec13089741 +Node: Mock names and the name attribute13090518 +Ref: library/unittest mock mock-names-and-the-name-attribute13090668 +Ref: 40ed13090668 +Node: Attaching Mocks as Attributes13091258 +Ref: library/unittest mock attaching-mocks-as-attributes13091380 +Ref: 40ee13091380 +Node: The patchers13093244 +Ref: library/unittest mock the-patchers13093396 +Ref: 40ef13093396 +Node: patch13094011 +Ref: library/unittest mock patch13094086 +Ref: 40f013094086 +Ref: library/unittest mock unittest mock patch13094233 +Ref: e8b13094233 +Node: patch object13103180 +Ref: library/unittest mock patch-object13103274 +Ref: 40f213103274 +Ref: library/unittest mock unittest mock patch object13103319 +Ref: 159813103319 +Node: patch dict13104798 +Ref: library/unittest mock patch-dict13104901 +Ref: 40f313104901 +Ref: library/unittest mock unittest mock patch dict13104944 +Ref: 19f213104944 +Node: patch multiple13109077 +Ref: library/unittest mock patch-multiple13109196 +Ref: 40f513109196 +Ref: library/unittest mock unittest mock patch multiple13109247 +Ref: 40f613109247 +Node: patch methods start and stop13111955 +Ref: library/unittest mock patch-methods-start-and-stop13112078 +Ref: 40f713112078 +Ref: library/unittest mock start-and-stop13112078 +Ref: 40f813112078 +Ref: library/unittest mock unittest mock patch stopall13114821 +Ref: 40f913114821 +Node: patch builtins13114930 +Ref: library/unittest mock id413115050 +Ref: 40fa13115050 +Ref: library/unittest mock patch-builtins13115050 +Ref: 40fb13115050 +Node: TEST_PREFIX13115371 +Ref: library/unittest mock id513115487 +Ref: 40fc13115487 +Ref: library/unittest mock test-prefix13115487 +Ref: 40f413115487 +Node: Nesting Patch Decorators13116370 +Ref: library/unittest mock nesting-patch-decorators13116486 +Ref: 40fd13116486 +Node: Where to patch13117403 +Ref: library/unittest mock id613117546 +Ref: 40f113117546 +Ref: library/unittest mock where-to-patch13117546 +Ref: 40c513117546 +Node: Patching Descriptors and Proxy Objects13119312 +Ref: library/unittest mock patching-descriptors-and-proxy-objects13119422 +Ref: 40fe13119422 +Ref: Patching Descriptors and Proxy Objects-Footnote-113119863 +Node: MagicMock and magic method support13119988 +Ref: library/unittest mock magicmock-and-magic-method-support13120133 +Ref: 40ff13120133 +Node: Mocking Magic Methods13120275 +Ref: library/unittest mock magic-methods13120386 +Ref: 40c613120386 +Ref: library/unittest mock mocking-magic-methods13120386 +Ref: 410013120386 +Ref: Mocking Magic Methods-Footnote-113124276 +Ref: Mocking Magic Methods-Footnote-213124515 +Node: Magic Mock13124636 +Ref: library/unittest mock magic-mock13124747 +Ref: 410213124747 +Ref: library/unittest mock unittest mock MagicMock13124891 +Ref: e8a13124891 +Ref: library/unittest mock unittest mock NonCallableMagicMock13125375 +Ref: 40ca13125375 +Node: Helpers13128716 +Ref: library/unittest mock helpers13128906 +Ref: 410313128906 +Node: sentinel13129079 +Ref: library/unittest mock sentinel13129147 +Ref: 410413129147 +Ref: library/unittest mock unittest mock sentinel13129186 +Ref: ba013129186 +Node: DEFAULT13130347 +Ref: library/unittest mock default13130428 +Ref: 410513130428 +Ref: library/unittest mock unittest mock DEFAULT13130465 +Ref: 40cb13130465 +Node: call13130718 +Ref: library/unittest mock call13130806 +Ref: 410613130806 +Ref: library/unittest mock unittest mock call13130837 +Ref: 19cd13130837 +Ref: library/unittest mock unittest mock call call_list13131378 +Ref: 410713131378 +Ref: library/unittest mock calls-as-tuples13132330 +Ref: 40d913132330 +Node: create_autospec13133956 +Ref: library/unittest mock create-autospec13134040 +Ref: 410813134040 +Ref: library/unittest mock unittest mock create_autospec13134093 +Ref: 160813134093 +Node: ANY13135393 +Ref: library/unittest mock any13135483 +Ref: 410913135483 +Ref: library/unittest mock unittest mock ANY13135512 +Ref: 19cb13135512 +Node: FILTER_DIR13136674 +Ref: library/unittest mock filter-dir13136758 +Ref: 410a13136758 +Ref: library/unittest mock unittest mock FILTER_DIR13136801 +Ref: 40d413136801 +Node: mock_open13138817 +Ref: library/unittest mock mock-open13138910 +Ref: 410b13138910 +Ref: library/unittest mock unittest mock mock_open13138951 +Ref: 170913138951 +Ref: mock_open-Footnote-113141794 +Node: Autospeccing13141819 +Ref: library/unittest mock auto-speccing13141915 +Ref: 40c713141915 +Ref: library/unittest mock autospeccing13141915 +Ref: 410c13141915 +Ref: Autospeccing-Footnote-113150632 +Node: Sealing mocks13150873 +Ref: library/unittest mock sealing-mocks13150951 +Ref: 410d13150951 +Ref: library/unittest mock unittest mock seal13151000 +Ref: ba113151000 +Node: Order of precedence of side_effect return_value and wraps13151814 +Ref: library/unittest mock order-of-precedence-of-side-effect-return-value-and-wraps13151961 +Ref: 410e13151961 +Node: unittest mock — getting started13156044 +Ref: library/unittest mock-examples doc13156230 +Ref: 410f13156230 +Ref: library/unittest mock-examples unittest-mock-getting-started13156230 +Ref: 411013156230 +Ref: library/unittest mock-examples getting-started13156342 +Ref: 411113156342 +Node: Using Mock13156409 +Ref: library/unittest mock-examples using-mock13156514 +Ref: 411213156514 +Node: Mock Patching Methods13156979 +Ref: library/unittest mock-examples mock-patching-methods13157090 +Ref: 411313157090 +Node: Mock for Method Calls on an Object13158640 +Ref: library/unittest mock-examples mock-for-method-calls-on-an-object13158775 +Ref: 411413158775 +Node: Mocking Classes13159876 +Ref: library/unittest mock-examples mocking-classes13160007 +Ref: 411513160007 +Node: Naming your mocks13161004 +Ref: library/unittest mock-examples naming-your-mocks13161119 +Ref: 411613161119 +Node: Tracking all Calls13161551 +Ref: library/unittest mock-examples tracking-all-calls13161687 +Ref: 411713161687 +Node: Setting Return Values and Attributes13163094 +Ref: library/unittest mock-examples setting-return-values-and-attributes13163242 +Ref: 411813163242 +Node: Raising exceptions with mocks13164753 +Ref: library/unittest mock-examples raising-exceptions-with-mocks13164918 +Ref: 411913164918 +Node: Side effect functions and iterables13165298 +Ref: library/unittest mock-examples side-effect-functions-and-iterables13165457 +Ref: 411a13165457 +Node: Mocking asynchronous iterators13166497 +Ref: library/unittest mock-examples mocking-asynchronous-iterators13166663 +Ref: 411b13166663 +Node: Mocking asynchronous context manager13167236 +Ref: library/unittest mock-examples mocking-asynchronous-context-manager13167406 +Ref: 411c13167406 +Node: Creating a Mock from an Existing Object13168307 +Ref: library/unittest mock-examples creating-a-mock-from-an-existing-object13168491 +Ref: 411d13168491 +Node: Using side_effect to return per file content13170337 +Ref: library/unittest mock-examples using-side-effect-to-return-per-file-content13170476 +Ref: 411e13170476 +Node: Patch Decorators13171327 +Ref: library/unittest mock-examples patch-decorators13171457 +Ref: 411f13171457 +Node: Further Examples13176730 +Ref: library/unittest mock-examples further-examples13176841 +Ref: 412013176841 +Ref: library/unittest mock-examples id113176841 +Ref: 412113176841 +Node: Mocking chained calls13177469 +Ref: library/unittest mock-examples mocking-chained-calls13177567 +Ref: 412213177567 +Node: Partial mocking13180682 +Ref: library/unittest mock-examples partial-mocking13180815 +Ref: 412313180815 +Ref: Partial mocking-Footnote-113182847 +Node: Mocking a Generator Method13182948 +Ref: library/unittest mock-examples mocking-a-generator-method13183104 +Ref: 412413183104 +Ref: Mocking a Generator Method-Footnote-113184238 +Node: Applying the same patch to every test method13184558 +Ref: library/unittest mock-examples applying-the-same-patch-to-every-test-method13184722 +Ref: 412513184722 +Node: Mocking Unbound Methods13187020 +Ref: library/unittest mock-examples mocking-unbound-methods13187191 +Ref: 412613187191 +Node: Checking multiple calls with mock13188959 +Ref: library/unittest mock-examples checking-multiple-calls-with-mock13189115 +Ref: 412713189115 +Node: Coping with mutable arguments13190731 +Ref: library/unittest mock-examples coping-with-mutable-arguments13190879 +Ref: 412813190879 +Node: Nesting Patches13195063 +Ref: library/unittest mock-examples nesting-patches13195213 +Ref: 412913195213 +Node: Mocking a dictionary with MagicMock13197020 +Ref: library/unittest mock-examples mocking-a-dictionary-with-magicmock13197177 +Ref: 412a13197177 +Node: Mock subclasses and their attributes13199824 +Ref: library/unittest mock-examples mock-subclasses-and-their-attributes13199997 +Ref: 412b13199997 +Ref: Mock subclasses and their attributes-Footnote-113202133 +Ref: Mock subclasses and their attributes-Footnote-213202303 +Ref: Mock subclasses and their attributes-Footnote-313202361 +Node: Mocking imports with patch dict13202442 +Ref: library/unittest mock-examples mocking-imports-with-patch-dict13202636 +Ref: 412c13202636 +Node: Tracking order of calls and less verbose call assertions13205284 +Ref: library/unittest mock-examples tracking-order-of-calls-and-less-verbose-call-assertions13205472 +Ref: 412d13205472 +Node: More complex argument matching13208811 +Ref: library/unittest mock-examples more-complex-argument-matching13208959 +Ref: 412e13208959 +Ref: More complex argument matching-Footnote-113212031 +Ref: More complex argument matching-Footnote-213212074 +Node: test — Regression tests package for Python13212196 +Ref: library/test doc13212397 +Ref: 412f13212397 +Ref: library/test module-test13212397 +Ref: e213212397 +Ref: library/test test-regression-tests-package-for-python13212397 +Ref: 413013212397 +Node: Writing Unit Tests for the test package13213830 +Ref: library/test writing-tests13214005 +Ref: 413113214005 +Ref: library/test writing-unit-tests-for-the-test-package13214005 +Ref: 413213214005 +Node: Running tests using the command-line interface13218578 +Ref: library/test module-test regrtest13218753 +Ref: e313218753 +Ref: library/test regrtest13218753 +Ref: 100213218753 +Ref: library/test running-tests-using-the-command-line-interface13218753 +Ref: 413313218753 +Node: test support — Utilities for the Python test suite13220692 +Ref: library/test module-test support13220917 +Ref: e413220917 +Ref: library/test test-support-utilities-for-the-python-test-suite13220917 +Ref: 413413220917 +Ref: library/test test support TestFailed13221423 +Ref: 413513221423 +Ref: library/test test support ResourceDenied13221643 +Ref: 413613221643 +Ref: library/test test support verbose13221936 +Ref: 413813221936 +Ref: library/test test support is_jython13222156 +Ref: 413913222156 +Ref: library/test test support is_android13222245 +Ref: 413a13222245 +Ref: library/test test support unix_shell13222323 +Ref: 413b13222323 +Ref: library/test test support LOOPBACK_TIMEOUT13222420 +Ref: 19b313222420 +Ref: library/test test support INTERNET_TIMEOUT13223013 +Ref: 19b413223013 +Ref: library/test test support SHORT_TIMEOUT13223509 +Ref: 18ae13223509 +Ref: library/test test support LONG_TIMEOUT13223901 +Ref: 19b513223901 +Ref: library/test test support PGO13224410 +Ref: 413d13224410 +Ref: library/test test support PIPE_MAX_SIZE13224508 +Ref: 413e13224508 +Ref: library/test test support Py_DEBUG13224656 +Ref: 413f13224656 +Ref: library/test test support SOCK_MAX_SIZE13224861 +Ref: 414113224861 +Ref: library/test test support TEST_SUPPORT_DIR13225011 +Ref: 414213225011 +Ref: library/test test support TEST_HOME_DIR13225132 +Ref: 414313225132 +Ref: library/test test support TEST_DATA_DIR13225229 +Ref: 414413225229 +Ref: library/test test support MAX_Py_ssize_t13225330 +Ref: 414513225330 +Ref: library/test test support max_memuse13225429 +Ref: 414613225429 +Ref: library/test test support real_max_memuse13225592 +Ref: 414813225592 +Ref: library/test test support MISSING_C_DOCSTRINGS13225764 +Ref: 414913225764 +Ref: library/test test support HAVE_DOCSTRINGS13226051 +Ref: 414a13226051 +Ref: library/test test support TEST_HTTP_URL13226326 +Ref: 414b13226326 +Ref: library/test test support ALWAYS_EQ13226435 +Ref: 414c13226435 +Ref: library/test test support NEVER_EQ13226551 +Ref: 414d13226551 +Ref: library/test test support LARGEST13226703 +Ref: 414e13226703 +Ref: library/test test support SMALLEST13226837 +Ref: 414f13226837 +Ref: library/test test support busy_retry13227038 +Ref: 415013227038 +Ref: library/test test support sleeping_retry13227680 +Ref: 415113227680 +Ref: library/test test support is_resource_enabled13228564 +Ref: 415213228564 +Ref: library/test test support python_is_optimized13228796 +Ref: 415313228796 +Ref: library/test test support with_pymalloc13228924 +Ref: 415413228924 +Ref: library/test test support requires13229013 +Ref: 413713229013 +Ref: library/test test support sortdict13229384 +Ref: 415513229384 +Ref: library/test test support findfile13229476 +Ref: 415613229476 +Ref: library/test test support get_pagesize13229848 +Ref: 415713229848 +Ref: library/test test support setswitchinterval13229956 +Ref: 415813229956 +Ref: library/test test support check_impl_detail13230182 +Ref: 415913230182 +Ref: library/test test support set_memlimit13230700 +Ref: 414713230700 +Ref: library/test test support record_original_stdout13230858 +Ref: 415a13230858 +Ref: library/test test support get_original_stdout13231024 +Ref: 415b13231024 +Ref: library/test test support args_from_interpreter_flags13231197 +Ref: 415c13231197 +Ref: library/test test support optim_args_from_interpreter_flags13231386 +Ref: 415d13231386 +Ref: library/test test support captured_stdin13231568 +Ref: 415e13231568 +Ref: library/test test support captured_stdout13231613 +Ref: 415f13231613 +Ref: library/test test support captured_stderr13231659 +Ref: 19f513231659 +Ref: library/test test support disable_faulthandler13232384 +Ref: 416013232384 +Ref: library/test test support gc_collect13232508 +Ref: 416113232508 +Ref: library/test test support disable_gc13232844 +Ref: 416213232844 +Ref: library/test test support swap_attr13233025 +Ref: 416313233025 +Ref: library/test test support swap_item13233611 +Ref: 416413233611 +Ref: library/test test support flush_std_streams13234195 +Ref: 416513234195 +Ref: library/test test support print_warning13234471 +Ref: 416613234471 +Ref: library/test test support wait_process13234745 +Ref: 197313234745 +Ref: library/test test support calcobjsize13235264 +Ref: 416813235264 +Ref: library/test test support calcvobjsize13235497 +Ref: 416913235497 +Ref: library/test test support checksizeof13235735 +Ref: 416b13235735 +Ref: library/test test support anticipate_failure13235906 +Ref: 416c13235906 +Ref: library/test test support system_must_validate_cert13236168 +Ref: 416d13236168 +Ref: library/test test support run_with_locale13236321 +Ref: 416e13236321 +Ref: library/test test support run_with_tz13236681 +Ref: 416f13236681 +Ref: library/test test support requires_freebsd_version13236843 +Ref: 417013236843 +Ref: library/test test support requires_linux_version13237057 +Ref: 417113237057 +Ref: library/test test support requires_mac_version13237266 +Ref: 417213237266 +Ref: library/test test support requires_gil_enabled13237472 +Ref: 417313237472 +Ref: library/test test support requires_IEEE_75413237648 +Ref: 417413237648 +Ref: library/test test support requires_zlib13237757 +Ref: 417513237757 +Ref: library/test test support requires_gzip13237872 +Ref: 417613237872 +Ref: library/test test support requires_bz213237986 +Ref: 417713237986 +Ref: library/test test support requires_lzma13238098 +Ref: 417813238098 +Ref: library/test test support requires_resource13238212 +Ref: 417913238212 +Ref: library/test test support requires_docstrings13238337 +Ref: 417a13238337 +Ref: library/test test support requires_limited_api13238460 +Ref: 417b13238460 +Ref: library/test test support cpython_only13238600 +Ref: 417c13238600 +Ref: library/test test support impl_detail13238696 +Ref: 417d13238696 +Ref: library/test test support no_tracing13238926 +Ref: 417e13238926 +Ref: library/test test support refcount_test13239049 +Ref: 417f13239049 +Ref: library/test test support bigmemtest13239353 +Ref: 418013239353 +Ref: library/test test support bigaddrspacetest13240100 +Ref: 418113240100 +Ref: library/test test support check_syntax_error13240201 +Ref: 418213240201 +Ref: library/test test support open_urlresource13240755 +Ref: 418313240755 +Ref: library/test test support reap_children13240884 +Ref: 418413240884 +Ref: library/test test support get_attribute13241158 +Ref: 418513241158 +Ref: library/test test support catch_unraisable_exception13241320 +Ref: 19d713241320 +Ref: library/test test support load_package_tests13242208 +Ref: 418613242208 +Ref: library/test test support detect_api_mismatch13242838 +Ref: 418713242838 +Ref: library/test test support patch13243309 +Ref: 418813243309 +Ref: library/test test support run_in_subinterp13243645 +Ref: 418913243645 +Ref: library/test test support check_free_after_iterating13243813 +Ref: 418a13243813 +Ref: library/test test support missing_compiler_executable13243970 +Ref: 418b13243970 +Ref: library/test test support check__all__13244292 +Ref: 194c13244292 +Ref: library/test test support skip_if_broken_multiprocessing_synchronize13246112 +Ref: 194d13246112 +Ref: library/test test support check_disallow_instantiation13246405 +Ref: 418c13246405 +Ref: library/test test support adjust_int_max_str_digits13246613 +Ref: 418d13246613 +Ref: library/test test support SuppressCrashReport13247084 +Ref: 418e13247084 +Ref: library/test test support SaveSignals13247587 +Ref: 419013247587 +Ref: library/test test support SaveSignals save13247718 +Ref: 419113247718 +Ref: library/test test support SaveSignals restore13247864 +Ref: 419213247864 +Ref: library/test test support Matcher13248003 +Ref: 419313248003 +Ref: library/test test support Matcher matches13248036 +Ref: 419413248036 +Ref: library/test test support Matcher match_value13248149 +Ref: 419513248149 +Ref: test support — Utilities for the Python test suite-Footnote-113248324 +Node: test support socket_helper — Utilities for socket tests13248404 +Ref: library/test module-test support socket_helper13248656 +Ref: e913248656 +Ref: library/test test-support-socket-helper-utilities-for-socket-tests13248656 +Ref: 419613248656 +Ref: library/test test support socket_helper IPV6_ENABLED13248903 +Ref: 419713248903 +Ref: library/test test support socket_helper find_unused_port13249034 +Ref: 419813249034 +Ref: library/test test support socket_helper bind_port13250357 +Ref: 419913250357 +Ref: library/test test support socket_helper bind_unix_socket13251302 +Ref: 419a13251302 +Ref: library/test test support socket_helper skip_unless_bind_unix_socket13251485 +Ref: 419b13251485 +Ref: library/test test support socket_helper transient_internet13251655 +Ref: 413c13251655 +Node: test support script_helper — Utilities for the Python execution tests13251928 +Ref: library/test module-test support script_helper13252214 +Ref: e813252214 +Ref: library/test test-support-script-helper-utilities-for-the-python-execution-tests13252214 +Ref: 419c13252214 +Ref: library/test test support script_helper interpreter_requires_environment13252487 +Ref: 419d13252487 +Ref: library/test test support script_helper run_python_until_end13253463 +Ref: 419e13253463 +Ref: library/test test support script_helper assert_python_ok13253841 +Ref: 419f13253841 +Ref: library/test test support script_helper assert_python_failure13254474 +Ref: 41a013254474 +Ref: library/test test support script_helper spawn_python13254908 +Ref: 41a113254908 +Ref: library/test test support script_helper kill_python13255221 +Ref: 41a213255221 +Ref: library/test test support script_helper make_script13255377 +Ref: 41a313255377 +Ref: library/test test support script_helper make_zip_script13255686 +Ref: 41a413255686 +Ref: library/test test support script_helper make_pkg13256055 +Ref: 41a513256055 +Ref: library/test test support script_helper make_zip_pkg13256258 +Ref: 41a613256258 +Node: test support bytecode_helper — Support tools for testing correct bytecode generation13256788 +Ref: library/test module-test support bytecode_helper13257080 +Ref: e513257080 +Ref: library/test test-support-bytecode-helper-support-tools-for-testing-correct-bytecode-generation13257080 +Ref: 41a713257080 +Ref: library/test test support bytecode_helper BytecodeTestCase13257458 +Ref: 41a813257458 +Ref: library/test test support bytecode_helper BytecodeTestCase get_disassembly_as_string13257617 +Ref: 41a913257617 +Ref: library/test test support bytecode_helper BytecodeTestCase assertInBytecode13257726 +Ref: 41aa13257726 +Ref: library/test test support bytecode_helper BytecodeTestCase assertNotInBytecode13257906 +Ref: 41ab13257906 +Node: test support threading_helper — Utilities for threading tests13258061 +Ref: library/test module-test support threading_helper13258331 +Ref: ea13258331 +Ref: library/test test-support-threading-helper-utilities-for-threading-tests13258331 +Ref: 41ac13258331 +Ref: library/test test support threading_helper join_thread13258597 +Ref: 41ad13258597 +Ref: library/test test support threading_helper reap_threads13258819 +Ref: 41ae13258819 +Ref: library/test test support threading_helper start_threads13258960 +Ref: 41af13258960 +Ref: library/test test support threading_helper threading_cleanup13259368 +Ref: 41b013259368 +Ref: library/test test support threading_helper threading_setup13259606 +Ref: 41b113259606 +Ref: library/test test support threading_helper wait_threads_exit13259734 +Ref: 41b213259734 +Ref: library/test test support threading_helper catch_threading_exception13259917 +Ref: 41b313259917 +Node: test support os_helper — Utilities for os tests13260878 +Ref: library/test module-test support os_helper13261119 +Ref: e713261119 +Ref: library/test test-support-os-helper-utilities-for-os-tests13261119 +Ref: 41b413261119 +Ref: library/test test support os_helper FS_NONASCII13261343 +Ref: 41b513261343 +Ref: library/test test support os_helper SAVEDCWD13261456 +Ref: 41b613261456 +Ref: library/test test support os_helper TESTFN13261537 +Ref: 41b713261537 +Ref: library/test test support os_helper TESTFN_NONASCII13261737 +Ref: 41b813261737 +Ref: library/test test support os_helper TESTFN_UNENCODABLE13262122 +Ref: 41b913262122 +Ref: library/test test support os_helper TESTFN_UNDECODABLE13262372 +Ref: 41ba13262372 +Ref: library/test test support os_helper TESTFN_UNICODE13262624 +Ref: 41bb13262624 +Ref: library/test test support os_helper EnvironmentVarGuard13262725 +Ref: 13ae13262725 +Ref: library/test test support os_helper FakePath13263193 +Ref: 41bc13263193 +Ref: library/test test support os_helper EnvironmentVarGuard set13263455 +Ref: 41bd13263455 +Ref: library/test test support os_helper EnvironmentVarGuard unset13263602 +Ref: 41be13263602 +Ref: library/test test support os_helper can_symlink13263713 +Ref: 41bf13263713 +Ref: library/test test support os_helper can_xattr13263848 +Ref: 41c013263848 +Ref: library/test test support os_helper change_cwd13263972 +Ref: 41c113263972 +Ref: library/test test support os_helper create_empty_file13264341 +Ref: 41c213264341 +Ref: library/test test support os_helper fd_count13264493 +Ref: 41c313264493 +Ref: library/test test support os_helper fs_is_case_insensitive13264592 +Ref: 41c413264592 +Ref: library/test test support os_helper make_bad_fd13264750 +Ref: 41c513264750 +Ref: library/test test support os_helper rmdir13264919 +Ref: 41c613264919 +Ref: library/test test support os_helper rmtree13265227 +Ref: 41c713265227 +Ref: library/test test support os_helper skip_unless_symlink13265570 +Ref: 41c813265570 +Ref: library/test test support os_helper skip_unless_xattr13265711 +Ref: 41c913265711 +Ref: library/test test support os_helper temp_cwd13265836 +Ref: 41ca13265836 +Ref: library/test test support os_helper temp_dir13266493 +Ref: 41cb13266493 +Ref: library/test test support os_helper temp_umask13266945 +Ref: 41cc13266945 +Ref: library/test test support os_helper unlink13267067 +Ref: 41cd13267067 +Node: test support import_helper — Utilities for import tests13267312 +Ref: library/test module-test support import_helper13267551 +Ref: e613267551 +Ref: library/test test-support-import-helper-utilities-for-import-tests13267551 +Ref: 41ce13267551 +Ref: library/test test support import_helper forget13267799 +Ref: 41cf13267799 +Ref: library/test test support import_helper import_fresh_module13267984 +Ref: 18ad13267984 +Ref: library/test test support import_helper import_module13269601 +Ref: 41d013269601 +Ref: library/test test support import_helper modules_setup13270222 +Ref: 41d113270222 +Ref: library/test test support import_helper modules_cleanup13270329 +Ref: 41d213270329 +Ref: library/test test support import_helper unload13270507 +Ref: 41d313270507 +Ref: library/test test support import_helper make_legacy_pyc13270607 +Ref: 41d413270607 +Ref: library/test test support import_helper CleanImport13270956 +Ref: 41d513270956 +Ref: library/test test support import_helper DirsOnSysPath13271346 +Ref: 41d613271346 +Ref: test support import_helper — Utilities for import tests-Footnote-113271903 +Ref: test support import_helper — Utilities for import tests-Footnote-213271945 +Node: test support warnings_helper — Utilities for warnings tests13271987 +Ref: library/test module-test support warnings_helper13272168 +Ref: eb13272168 +Ref: library/test test-support-warnings-helper-utilities-for-warnings-tests13272168 +Ref: 41d713272168 +Ref: library/test test support warnings_helper ignore_warnings13272428 +Ref: 41d813272428 +Ref: library/test test support warnings_helper check_no_resource_warning13272941 +Ref: 41d913272941 +Ref: library/test test support warnings_helper check_syntax_warning13273231 +Ref: 41da13273231 +Ref: library/test test support warnings_helper check_warnings13274050 +Ref: 41db13274050 +Ref: library/test test support warnings_helper WarningsRecorder13277120 +Ref: 41dc13277120 +Node: Debugging and Profiling13277311 +Ref: library/debug doc13277468 +Ref: 41dd13277468 +Ref: library/debug debugging-and-profiling13277468 +Ref: 41de13277468 +Ref: library/audit_events audit-events13277928 +Ref: 187013277928 +Node: Audit events table13278258 +Ref: library/audit_events doc13278371 +Ref: 41df13278371 +Ref: library/audit_events audit-events-table13278371 +Ref: 41e013278371 +Ref: Audit events table-Footnote-113337231 +Node: bdb — Debugger framework13337273 +Ref: library/bdb doc13337437 +Ref: 420013337437 +Ref: library/bdb bdb-debugger-framework13337437 +Ref: 420113337437 +Ref: library/bdb module-bdb13337437 +Ref: f13337437 +Ref: library/bdb bdb BdbQuit13337772 +Ref: 420213337772 +Ref: library/bdb bdb Breakpoint13337937 +Ref: 420313337937 +Ref: library/bdb bdb Breakpoint deleteMe13338891 +Ref: 420a13338891 +Ref: library/bdb bdb Breakpoint enable13339107 +Ref: 420b13339107 +Ref: library/bdb bdb Breakpoint disable13339178 +Ref: 420c13339178 +Ref: library/bdb bdb Breakpoint bpformat13339251 +Ref: 420d13339251 +Ref: library/bdb bdb Breakpoint bpprint13339648 +Ref: 420e13339648 +Ref: library/bdb bdb Breakpoint file13339884 +Ref: 420613339884 +Ref: library/bdb bdb Breakpoint line13339962 +Ref: 420f13339962 +Ref: library/bdb bdb Breakpoint temporary13340077 +Ref: 421013340077 +Ref: library/bdb bdb Breakpoint cond13340199 +Ref: 420913340199 +Ref: library/bdb bdb Breakpoint funcname13340314 +Ref: 420713340314 +Ref: library/bdb bdb Breakpoint enabled13340461 +Ref: 421113340461 +Ref: library/bdb bdb Breakpoint bpbynumber13340551 +Ref: 420413340551 +Ref: library/bdb bdb Breakpoint bplist13340669 +Ref: 420513340669 +Ref: library/bdb bdb Breakpoint ignore13340823 +Ref: 421213340823 +Ref: library/bdb bdb Breakpoint hits13340914 +Ref: 420813340914 +Ref: library/bdb bdb Bdb13341030 +Ref: 12f513341030 +Ref: library/bdb bdb Bdb canonic13341828 +Ref: 421313341828 +Ref: library/bdb bdb Bdb reset13342207 +Ref: 421413342207 +Ref: library/bdb bdb Bdb trace_dispatch13342399 +Ref: 421613342399 +Ref: library/bdb bdb Bdb dispatch_line13343818 +Ref: 421713343818 +Ref: library/bdb bdb Bdb dispatch_call13344295 +Ref: 421913344295 +Ref: library/bdb bdb Bdb dispatch_return13344779 +Ref: 421b13344779 +Ref: library/bdb bdb Bdb dispatch_exception13345271 +Ref: 421d13345271 +Ref: library/bdb bdb Bdb is_skipped_line13345930 +Ref: 421f13345930 +Ref: library/bdb bdb Bdb stop_here13346050 +Ref: 422013346050 +Ref: library/bdb bdb Bdb break_here13346178 +Ref: 422113346178 +Ref: library/bdb bdb Bdb break_anywhere13346486 +Ref: 422313346486 +Ref: library/bdb bdb Bdb user_call13346705 +Ref: 421a13346705 +Ref: library/bdb bdb Bdb user_line13347006 +Ref: 421813347006 +Ref: library/bdb bdb Bdb user_return13347200 +Ref: 421c13347200 +Ref: library/bdb bdb Bdb user_exception13347366 +Ref: 421e13347366 +Ref: library/bdb bdb Bdb do_clear13347534 +Ref: 422413347534 +Ref: library/bdb bdb Bdb set_step13347819 +Ref: 422513347819 +Ref: library/bdb bdb Bdb set_next13347889 +Ref: 422613347889 +Ref: library/bdb bdb Bdb set_return13347986 +Ref: 422713347986 +Ref: library/bdb bdb Bdb set_until13348076 +Ref: 422813348076 +Ref: library/bdb bdb Bdb set_trace13348261 +Ref: 422913348261 +Ref: library/bdb bdb Bdb set_continue13348591 +Ref: 422b13348591 +Ref: library/bdb bdb Bdb set_quit13348764 +Ref: 421513348764 +Ref: library/bdb bdb Bdb set_break13349182 +Ref: 422c13349182 +Ref: library/bdb bdb Bdb clear_break13349547 +Ref: 422d13349547 +Ref: library/bdb bdb Bdb clear_bpbynumber13349712 +Ref: 422e13349712 +Ref: library/bdb bdb Bdb clear_all_file_breaks13349941 +Ref: 422f13349941 +Ref: library/bdb bdb Bdb clear_all_breaks13350095 +Ref: 423013350095 +Ref: library/bdb bdb Bdb get_bpbynumber13350231 +Ref: 423113350231 +Ref: library/bdb bdb Bdb get_break13350582 +Ref: 423213350582 +Ref: library/bdb bdb Bdb get_breaks13350721 +Ref: 423313350721 +Ref: library/bdb bdb Bdb get_file_breaks13350875 +Ref: 423413350875 +Ref: library/bdb bdb Bdb get_all_breaks13351013 +Ref: 423513351013 +Ref: library/bdb bdb Bdb get_stack13351219 +Ref: 423613351219 +Ref: library/bdb bdb Bdb format_stack_entry13351510 +Ref: 423713351510 +Ref: library/bdb bdb Bdb run13352093 +Ref: 423813352093 +Ref: library/bdb bdb Bdb runeval13352323 +Ref: 423913352323 +Ref: library/bdb bdb Bdb runctx13352551 +Ref: 423a13352551 +Ref: library/bdb bdb Bdb runcall13352687 +Ref: a7e13352687 +Ref: library/bdb bdb checkfuncname13352856 +Ref: 423b13352856 +Ref: library/bdb bdb effective13353309 +Ref: 422213353309 +Ref: library/bdb bdb set_trace13354077 +Ref: 422a13354077 +Ref: bdb — Debugger framework-Footnote-113354228 +Node: faulthandler — Dump the Python traceback13354291 +Ref: library/faulthandler doc13354464 +Ref: 423c13354464 +Ref: library/faulthandler faulthandler-dump-the-python-traceback13354464 +Ref: 423d13354464 +Ref: library/faulthandler module-faulthandler13354464 +Ref: 5813354464 +Node: Dumping the traceback13356863 +Ref: library/faulthandler dumping-the-traceback13356991 +Ref: 423e13356991 +Ref: library/faulthandler faulthandler dump_traceback13357054 +Ref: dfd13357054 +Node: Fault handler state13357481 +Ref: library/faulthandler fault-handler-state13357656 +Ref: 423f13357656 +Ref: library/faulthandler faulthandler enable13357715 +Ref: c9e13357715 +Ref: library/faulthandler faulthandler disable13358571 +Ref: 424113358571 +Ref: library/faulthandler faulthandler is_enabled13358712 +Ref: 424213358712 +Node: Dumping the tracebacks after a timeout13358799 +Ref: library/faulthandler dumping-the-tracebacks-after-a-timeout13358991 +Ref: 424313358991 +Ref: library/faulthandler faulthandler dump_traceback_later13359088 +Ref: dfe13359088 +Ref: library/faulthandler faulthandler cancel_dump_traceback_later13360120 +Ref: 424413360120 +Node: Dumping the traceback on a user signal13360244 +Ref: library/faulthandler dumping-the-traceback-on-a-user-signal13360444 +Ref: 424513360444 +Ref: library/faulthandler faulthandler register13360541 +Ref: dfc13360541 +Ref: library/faulthandler faulthandler unregister13361172 +Ref: 424613361172 +Node: Issue with file descriptors13361447 +Ref: library/faulthandler faulthandler-fd13361620 +Ref: 424013361620 +Ref: library/faulthandler issue-with-file-descriptors13361620 +Ref: 424713361620 +Node: Example<13>13362088 +Ref: library/faulthandler example13362214 +Ref: 424813362214 +Node: pdb — The Python Debugger13362758 +Ref: library/pdb doc13362925 +Ref: 424913362925 +Ref: library/pdb debugger13362925 +Ref: 424a13362925 +Ref: library/pdb module-pdb13362925 +Ref: a513362925 +Ref: library/pdb pdb-the-python-debugger13362925 +Ref: 424b13362925 +Ref: library/pdb cmdoption-pdb-c13365555 +Ref: 424d13365555 +Ref: library/pdb cmdoption-pdb-command13365555 +Ref: 424e13365555 +Ref: library/pdb cmdoption-pdb-m13365751 +Ref: 425013365751 +Ref: library/pdb pdb run13366910 +Ref: 405613366910 +Ref: library/pdb pdb runeval13367602 +Ref: 425313367602 +Ref: library/pdb pdb runcall13367915 +Ref: 425413367915 +Ref: library/pdb pdb set_trace13368230 +Ref: 23713368230 +Ref: library/pdb pdb post_mortem13368801 +Ref: 13a613368801 +Ref: library/pdb pdb pm13369144 +Ref: 23913369144 +Ref: library/pdb pdb Pdb13369481 +Ref: 92113369481 +Ref: library/pdb pdb Pdb run13370888 +Ref: 425513370888 +Ref: library/pdb pdb Pdb runeval13370948 +Ref: 425613370948 +Ref: library/pdb pdb Pdb runcall13371013 +Ref: 425713371013 +Ref: library/pdb pdb Pdb set_trace13371064 +Ref: 425813371064 +Ref: pdb — The Python Debugger-Footnote-113371231 +Ref: pdb — The Python Debugger-Footnote-213371294 +Ref: pdb — The Python Debugger-Footnote-313371336 +Node: Debugger Commands13371465 +Ref: library/pdb debugger-commands13371546 +Ref: 424f13371546 +Ref: library/pdb id213371546 +Ref: 425913371546 +Ref: library/pdb pdbcommand-help13375046 +Ref: 425c13375046 +Ref: library/pdb pdbcommand-where13375439 +Ref: 425d13375439 +Ref: library/pdb pdbcommand-down13375639 +Ref: 425e13375639 +Ref: library/pdb pdbcommand-up13375778 +Ref: 425f13375778 +Ref: library/pdb pdbcommand-break13375914 +Ref: 426013375914 +Ref: library/pdb pdbcommand-tbreak13377040 +Ref: 426113377040 +Ref: library/pdb pdbcommand-clear13377251 +Ref: 426213377251 +Ref: library/pdb pdbcommand-disable13377548 +Ref: 426313377548 +Ref: library/pdb pdbcommand-enable13377871 +Ref: 426413377871 +Ref: library/pdb pdbcommand-ignore13377959 +Ref: 426513377959 +Ref: library/pdb pdbcommand-condition13378361 +Ref: 426613378361 +Ref: library/pdb pdbcommand-commands13378654 +Ref: 426713378654 +Ref: library/pdb pdbcommand-step13380289 +Ref: 425113380289 +Ref: library/pdb pdbcommand-next13380474 +Ref: 425213380474 +Ref: library/pdb pdbcommand-until13380872 +Ref: 426b13380872 +Ref: library/pdb pdbcommand-return13381268 +Ref: 426813381268 +Ref: library/pdb pdbcommand-continue13381355 +Ref: 424c13381355 +Ref: library/pdb pdbcommand-jump13381455 +Ref: 426913381455 +Ref: library/pdb pdbcommand-list13381885 +Ref: 425a13381885 +Ref: library/pdb pdbcommand-ll13382633 +Ref: 426c13382633 +Ref: library/pdb pdbcommand-args13382813 +Ref: 426d13382813 +Ref: library/pdb pdbcommand-p13382918 +Ref: f7113382918 +Ref: library/pdb pdbcommand-pp13383178 +Ref: 426e13383178 +Ref: library/pdb pdbcommand-whatis13383339 +Ref: 426f13383339 +Ref: library/pdb pdbcommand-source13383412 +Ref: 427013383412 +Ref: library/pdb pdbcommand-display13383536 +Ref: 427113383536 +Ref: library/pdb pdbcommand-undisplay13384989 +Ref: 427213384989 +Ref: library/pdb pdbcommand-interact13385202 +Ref: 427313385202 +Ref: library/pdb debugger-aliases13386105 +Ref: 425b13386105 +Ref: library/pdb pdbcommand-alias13386105 +Ref: 427413386105 +Ref: library/pdb pdbcommand-unalias13387214 +Ref: 427513387214 +Ref: library/pdb pdbcommand-013387285 +Ref: 427613387285 +Ref: library/pdb pdbcommand-run13387772 +Ref: 427713387772 +Ref: library/pdb pdbcommand-restart13387803 +Ref: 427813387803 +Ref: library/pdb pdbcommand-quit13388138 +Ref: 426a13388138 +Ref: library/pdb pdbcommand-debug13388232 +Ref: 427913388232 +Ref: library/pdb pdbcommand-retval13388420 +Ref: 427a13388420 +Ref: library/pdb pdbcommand-exceptions13388518 +Ref: 23a13388518 +Node: The Python Profilers13389845 +Ref: library/profile doc13390026 +Ref: 427b13390026 +Ref: library/profile profile13390026 +Ref: 427c13390026 +Ref: library/profile the-python-profilers13390026 +Ref: 427d13390026 +Ref: The Python Profilers-Footnote-113390470 +Ref: The Python Profilers-Footnote-213390537 +Node: Introduction to the profilers13390603 +Ref: library/profile introduction-to-the-profilers13390721 +Ref: 427e13390721 +Ref: library/profile profiler-introduction13390721 +Ref: 427f13390721 +Node: Instant User’s Manual13392206 +Ref: library/profile instant-user-s-manual13392370 +Ref: 428013392370 +Ref: library/profile profile-instant13392370 +Ref: 428113392370 +Ref: library/profile profile-cli13395250 +Ref: 428313395250 +Ref: library/profile cmdoption-cProfile-o13395463 +Ref: 428413395463 +Ref: library/profile cmdoption-cProfile-s13395558 +Ref: 428513395558 +Ref: library/profile cmdoption-cProfile-m13395742 +Ref: 428713395742 +Node: profile and cProfile Module Reference13398670 +Ref: library/profile module-cProfile13398820 +Ref: 2713398820 +Ref: library/profile profile-and-cprofile-module-reference13398820 +Ref: 428a13398820 +Ref: library/profile module-profile13398931 +Ref: af13398931 +Ref: library/profile profile run13399025 +Ref: 428b13399025 +Ref: library/profile profile runctx13399660 +Ref: 428c13399660 +Ref: library/profile profile Profile13400057 +Ref: 9e213400057 +Ref: library/profile profile Profile enable13401629 +Ref: 428d13401629 +Ref: library/profile profile Profile disable13401730 +Ref: 428e13401730 +Ref: library/profile profile Profile create_stats13401831 +Ref: 428f13401831 +Ref: library/profile profile Profile print_stats13401975 +Ref: 429013401975 +Ref: library/profile profile Profile dump_stats13402463 +Ref: 429113402463 +Ref: library/profile profile Profile run13402570 +Ref: 429213402570 +Ref: library/profile profile Profile runctx13402648 +Ref: 429313402648 +Ref: library/profile profile Profile runcall13402805 +Ref: a7d13402805 +Node: The Stats Class13403150 +Ref: library/profile profile-stats13403309 +Ref: 429413403309 +Ref: library/profile the-stats-class13403309 +Ref: 429513403309 +Ref: library/profile module-pstats13403443 +Ref: b013403443 +Ref: library/profile pstats Stats13403443 +Ref: 428213403443 +Ref: library/profile pstats Stats strip_dirs13404706 +Ref: 428813404706 +Ref: library/profile pstats Stats add13405528 +Ref: 429613405528 +Ref: library/profile pstats Stats dump_stats13406021 +Ref: 429713406021 +Ref: library/profile pstats Stats sort_stats13406402 +Ref: 428613406402 +Ref: library/profile pstats Stats reverse_order13411761 +Ref: 429813411761 +Ref: library/profile pstats Stats print_stats13412047 +Ref: 428913412047 +Ref: library/profile pstats Stats print_callers13413491 +Ref: 429913413491 +Ref: library/profile pstats Stats print_callees13414607 +Ref: 429a13414607 +Ref: library/profile pstats Stats get_stats_profile13414988 +Ref: 429b13414988 +Node: What Is Deterministic Profiling?13415535 +Ref: library/profile deterministic-profiling13415668 +Ref: 429c13415668 +Ref: library/profile what-is-deterministic-profiling13415668 +Ref: 429d13415668 +Node: Limitations13417466 +Ref: library/profile limitations13417595 +Ref: 429e13417595 +Ref: library/profile profile-limitations13417595 +Ref: 429f13417595 +Node: Calibration13419478 +Ref: library/profile calibration13419595 +Ref: 42a013419595 +Ref: library/profile profile-calibration13419595 +Ref: 42a113419595 +Node: Using a custom timer13421287 +Ref: library/profile profile-timers13421384 +Ref: 42a213421384 +Ref: library/profile using-a-custom-timer13421384 +Ref: 42a313421384 +Node: timeit — Measure execution time of small code snippets13423835 +Ref: library/timeit doc13424040 +Ref: 42a413424040 +Ref: library/timeit module-timeit13424040 +Ref: ef13424040 +Ref: library/timeit timeit-measure-execution-time-of-small-code-snippets13424040 +Ref: 42a513424040 +Ref: timeit — Measure execution time of small code snippets-Footnote-113424825 +Node: Basic Examples<2>13424891 +Ref: library/timeit basic-examples13425026 +Ref: 42a813425026 +Node: Python Interface13426311 +Ref: library/timeit id113426480 +Ref: 42aa13426480 +Ref: library/timeit python-interface13426480 +Ref: 42a713426480 +Ref: library/timeit timeit timeit13426601 +Ref: e7913426601 +Ref: library/timeit timeit repeat13427064 +Ref: 42ab13427064 +Ref: library/timeit timeit default_timer13427654 +Ref: 42ad13427654 +Ref: library/timeit timeit Timer13427949 +Ref: 149113427949 +Ref: library/timeit timeit Timer timeit13429396 +Ref: ced13429396 +Ref: library/timeit timeit Timer autorange13430521 +Ref: cec13430521 +Ref: library/timeit timeit Timer repeat13431251 +Ref: 42ac13431251 +Ref: library/timeit timeit Timer print_exc13432526 +Ref: 42ae13432526 +Node: Command-Line Interface<4>13433106 +Ref: library/timeit command-line-interface13433270 +Ref: 42af13433270 +Ref: library/timeit timeit-command-line-interface13433270 +Ref: 42a613433270 +Ref: library/timeit cmdoption-timeit-n13433539 +Ref: 42b013433539 +Ref: library/timeit cmdoption-timeit-number13433539 +Ref: 42b113433539 +Ref: library/timeit cmdoption-timeit-r13433617 +Ref: 42b213433617 +Ref: library/timeit cmdoption-timeit-repeat13433617 +Ref: 42b313433617 +Ref: library/timeit cmdoption-timeit-s13433700 +Ref: 42b413433700 +Ref: library/timeit cmdoption-timeit-setup13433700 +Ref: 42b513433700 +Ref: library/timeit cmdoption-timeit-p13433796 +Ref: 42b613433796 +Ref: library/timeit cmdoption-timeit-process13433796 +Ref: 42b713433796 +Ref: library/timeit cmdoption-timeit-u13434011 +Ref: 42b813434011 +Ref: library/timeit cmdoption-timeit-unit13434011 +Ref: 42b913434011 +Ref: library/timeit cmdoption-timeit-v13434174 +Ref: 42ba13434174 +Ref: library/timeit cmdoption-timeit-verbose13434174 +Ref: 42bb13434174 +Ref: library/timeit cmdoption-timeit-h13434266 +Ref: 42bc13434266 +Ref: library/timeit cmdoption-timeit-help13434266 +Ref: 42bd13434266 +Node: Examples<30>13435477 +Ref: library/timeit examples13435616 +Ref: 42be13435616 +Ref: library/timeit timeit-examples13435616 +Ref: 42a913435616 +Node: trace — Trace or track Python statement execution13439250 +Ref: library/trace doc13439475 +Ref: 42bf13439475 +Ref: library/trace module-trace13439475 +Ref: fd13439475 +Ref: library/trace trace-trace-or-track-python-statement-execution13439475 +Ref: 42c013439475 +Ref: trace — Trace or track Python statement execution-Footnote-113440241 +Ref: trace — Trace or track Python statement execution-Footnote-213440306 +Node: Command-Line Usage<3>13440347 +Ref: library/trace command-line-usage13440487 +Ref: 42c113440487 +Ref: library/trace trace-cli13440487 +Ref: 42c213440487 +Ref: library/trace cmdoption-trace-help13440840 +Ref: 42c313440840 +Ref: library/trace cmdoption-trace-version13440890 +Ref: 42c413440890 +Node: Main options13441108 +Ref: library/trace main-options13441196 +Ref: 42c513441196 +Ref: library/trace cmdoption-trace-c13441573 +Ref: 42c813441573 +Ref: library/trace cmdoption-trace-count13441573 +Ref: 42c913441573 +Ref: library/trace cmdoption-trace-t13441826 +Ref: 42c713441826 +Ref: library/trace cmdoption-trace-trace13441826 +Ref: 42cd13441826 +Ref: library/trace cmdoption-trace-l13441893 +Ref: 42c613441893 +Ref: library/trace cmdoption-trace-listfuncs13441893 +Ref: 42ce13441893 +Ref: library/trace cmdoption-trace-r13441983 +Ref: 42cf13441983 +Ref: library/trace cmdoption-trace-report13441983 +Ref: 42d013441983 +Ref: library/trace cmdoption-trace-T13442177 +Ref: 42d113442177 +Ref: library/trace cmdoption-trace-trackcalls13442177 +Ref: 42d213442177 +Node: Modifiers13442279 +Ref: library/trace modifiers13442383 +Ref: 42d313442383 +Ref: library/trace cmdoption-trace-f13442422 +Ref: 42cb13442422 +Ref: library/trace cmdoption-trace-file13442422 +Ref: 42d413442422 +Ref: library/trace cmdoption-trace-C13442579 +Ref: 42ca13442579 +Ref: library/trace cmdoption-trace-coverdir13442579 +Ref: 42d513442579 +Ref: library/trace cmdoption-trace-m13442769 +Ref: 42d613442769 +Ref: library/trace cmdoption-trace-missing13442769 +Ref: 42d713442769 +Ref: library/trace cmdoption-trace-s13442897 +Ref: 42d813442897 +Ref: library/trace cmdoption-trace-summary13442897 +Ref: 42d913442897 +Ref: library/trace cmdoption-trace-R13443047 +Ref: 42cc13443047 +Ref: library/trace cmdoption-trace-no-report13443047 +Ref: 42da13443047 +Ref: library/trace cmdoption-trace-g13443268 +Ref: 42db13443268 +Ref: library/trace cmdoption-trace-timing13443268 +Ref: 42dc13443268 +Node: Filters13443389 +Ref: library/trace filters13443472 +Ref: 42dd13443472 +Ref: library/trace cmdoption-trace-ignore-module13443554 +Ref: 42de13443554 +Ref: library/trace cmdoption-trace-ignore-dir13443743 +Ref: 42df13443743 +Node: Programmatic Interface13443946 +Ref: library/trace programmatic-interface13444086 +Ref: 42e013444086 +Ref: library/trace trace-api13444086 +Ref: 42e113444086 +Ref: library/trace trace Trace13444151 +Ref: 42e213444151 +Ref: library/trace trace Trace run13445062 +Ref: 42e313445062 +Ref: library/trace trace Trace runctx13445304 +Ref: 42e413445304 +Ref: library/trace trace Trace runfunc13445618 +Ref: a7f13445618 +Ref: library/trace trace Trace results13445811 +Ref: 42e513445811 +Ref: library/trace trace CoverageResults13446120 +Ref: 42e613446120 +Ref: library/trace trace CoverageResults update13446284 +Ref: 42e713446284 +Ref: library/trace trace CoverageResults write_results13446402 +Ref: 42e813446402 +Node: tracemalloc — Trace memory allocations13447760 +Ref: library/tracemalloc doc13447920 +Ref: 42e913447920 +Ref: library/tracemalloc module-tracemalloc13447920 +Ref: ff13447920 +Ref: library/tracemalloc tracemalloc-trace-memory-allocations13447920 +Ref: 42ea13447920 +Ref: tracemalloc — Trace memory allocations-Footnote-113449262 +Node: Examples<31>13449333 +Ref: library/tracemalloc examples13449434 +Ref: 42eb13449434 +Node: Display the top 1013449583 +Ref: library/tracemalloc display-the-top-1013449678 +Ref: 42ec13449678 +Node: Compute differences13451162 +Ref: library/tracemalloc compute-differences13451301 +Ref: 42ee13451301 +Node: Get the traceback of a memory block13453491 +Ref: library/tracemalloc get-the-traceback-of-a-memory-block13453622 +Ref: 42f113453622 +Node: Pretty top13456254 +Ref: library/tracemalloc pretty-top13456357 +Ref: 42f213456357 +Node: Record the current and peak size of all traced memory blocks13458819 +Ref: library/tracemalloc record-the-current-and-peak-size-of-all-traced-memory-blocks13458926 +Ref: 42f313458926 +Node: API13460618 +Ref: library/tracemalloc api13460719 +Ref: 42f513460719 +Node: Functions<11>13460891 +Ref: library/tracemalloc functions13460965 +Ref: 42f613460965 +Ref: library/tracemalloc tracemalloc clear_traces13461004 +Ref: 42f713461004 +Ref: library/tracemalloc tracemalloc get_object_traceback13461139 +Ref: 1b5713461139 +Ref: library/tracemalloc tracemalloc get_traceback_limit13461545 +Ref: 42f813461545 +Ref: library/tracemalloc tracemalloc get_traced_memory13461868 +Ref: 42f413461868 +Ref: library/tracemalloc tracemalloc reset_peak13462073 +Ref: 93b13462073 +Ref: library/tracemalloc tracemalloc get_tracemalloc_memory13462705 +Ref: 42fa13462705 +Ref: library/tracemalloc tracemalloc is_tracing13462902 +Ref: 42fb13462902 +Ref: library/tracemalloc tracemalloc start13463134 +Ref: 1d3b13463134 +Ref: library/tracemalloc tracemalloc stop13464498 +Ref: 158213464498 +Ref: library/tracemalloc tracemalloc take_snapshot13464932 +Ref: 42f913464932 +Node: DomainFilter13465630 +Ref: library/tracemalloc domainfilter13465719 +Ref: 42ff13465719 +Ref: library/tracemalloc tracemalloc DomainFilter13465764 +Ref: cf113465764 +Ref: library/tracemalloc tracemalloc DomainFilter inclusive13465930 +Ref: 430013465930 +Ref: library/tracemalloc tracemalloc DomainFilter domain13466230 +Ref: 430113466230 +Node: Filter13466335 +Ref: library/tracemalloc filter13466416 +Ref: 430213466416 +Ref: library/tracemalloc tracemalloc Filter13466451 +Ref: 430313466451 +Ref: library/tracemalloc tracemalloc Filter domain13467313 +Ref: 430413467313 +Ref: library/tracemalloc tracemalloc Filter inclusive13467584 +Ref: 430513467584 +Ref: library/tracemalloc tracemalloc Filter lineno13468016 +Ref: 430713468016 +Ref: library/tracemalloc tracemalloc Filter filename_pattern13468168 +Ref: 430613468168 +Ref: library/tracemalloc tracemalloc Filter all_frames13468282 +Ref: 430813468282 +Node: Frame13468689 +Ref: library/tracemalloc frame13468766 +Ref: 430a13468766 +Ref: library/tracemalloc tracemalloc Frame13468799 +Ref: 430b13468799 +Ref: library/tracemalloc tracemalloc Frame filename13468947 +Ref: 430c13468947 +Ref: library/tracemalloc tracemalloc Frame lineno13469010 +Ref: 430d13469010 +Node: Snapshot13469074 +Ref: library/tracemalloc snapshot13469154 +Ref: 430e13469154 +Ref: library/tracemalloc tracemalloc Snapshot13469193 +Ref: 42fe13469193 +Ref: library/tracemalloc tracemalloc Snapshot compare_to13469371 +Ref: 42fd13469371 +Ref: library/tracemalloc tracemalloc Snapshot dump13470099 +Ref: 42ef13470099 +Ref: library/tracemalloc tracemalloc Snapshot filter_traces13470235 +Ref: 431513470235 +Ref: library/tracemalloc tracemalloc Snapshot load13470912 +Ref: 42f013470912 +Ref: library/tracemalloc tracemalloc Snapshot statistics13471038 +Ref: 42ed13471038 +Ref: library/tracemalloc tracemalloc Snapshot traceback_limit13472239 +Ref: 430913472239 +Ref: library/tracemalloc tracemalloc Snapshot traces13472458 +Ref: 431613472458 +Node: Statistic13472753 +Ref: library/tracemalloc statistic13472841 +Ref: 431b13472841 +Ref: library/tracemalloc tracemalloc Statistic13472882 +Ref: 431713472882 +Ref: library/tracemalloc tracemalloc Statistic count13473106 +Ref: 431313473106 +Ref: library/tracemalloc tracemalloc Statistic size13473181 +Ref: 431813473181 +Ref: library/tracemalloc tracemalloc Statistic traceback13473268 +Ref: 431913473268 +Node: StatisticDiff13473400 +Ref: library/tracemalloc statisticdiff13473485 +Ref: 431c13473485 +Ref: library/tracemalloc tracemalloc StatisticDiff13473534 +Ref: 430f13473534 +Ref: library/tracemalloc tracemalloc StatisticDiff count13473834 +Ref: 431d13473834 +Ref: library/tracemalloc tracemalloc StatisticDiff count_diff13474008 +Ref: 431213474008 +Ref: library/tracemalloc tracemalloc StatisticDiff size13474230 +Ref: 431113474230 +Ref: library/tracemalloc tracemalloc StatisticDiff size_diff13474426 +Ref: 431013474426 +Ref: library/tracemalloc tracemalloc StatisticDiff traceback13474660 +Ref: 431413474660 +Node: Trace13474794 +Ref: library/tracemalloc trace13474879 +Ref: 431e13474879 +Ref: library/tracemalloc tracemalloc Trace13474912 +Ref: 431a13474912 +Ref: library/tracemalloc tracemalloc Trace domain13475145 +Ref: 431f13475145 +Ref: library/tracemalloc tracemalloc Trace size13475423 +Ref: 432013475423 +Ref: library/tracemalloc tracemalloc Trace traceback13475507 +Ref: 432113475507 +Node: Traceback13475639 +Ref: library/tracemalloc traceback13475702 +Ref: 432213475702 +Ref: library/tracemalloc tracemalloc Traceback13475743 +Ref: b9613475743 +Ref: library/tracemalloc tracemalloc Traceback total_nframe13476670 +Ref: 42fc13476670 +Ref: library/tracemalloc tracemalloc Traceback format13476979 +Ref: b9713476979 +Node: Software Packaging and Distribution13478047 +Ref: library/distribution doc13478210 +Ref: 432413478210 +Ref: library/distribution software-packaging-and-distribution13478210 +Ref: 432513478210 +Ref: Software Packaging and Distribution-Footnote-113478737 +Node: ensurepip — Bootstrapping the pip installer13478762 +Ref: library/ensurepip doc13478929 +Ref: 432613478929 +Ref: library/ensurepip ensurepip-bootstrapping-the-pip-installer13478929 +Ref: 432713478929 +Ref: library/ensurepip module-ensurepip13478929 +Ref: 5513478929 +Ref: ensurepip — Bootstrapping the pip installer-Footnote-113480530 +Ref: ensurepip — Bootstrapping the pip installer-Footnote-213480596 +Node: Command line interface13480638 +Ref: library/ensurepip command-line-interface13480761 +Ref: 432813480761 +Ref: library/ensurepip cmdoption-ensurepip-root13481510 +Ref: 432913481510 +Ref: library/ensurepip cmdoption-ensurepip-user13481739 +Ref: 432a13481739 +Ref: library/ensurepip cmdoption-ensurepip-altinstall13482192 +Ref: 432b13482192 +Ref: library/ensurepip cmdoption-ensurepip-default-pip13482319 +Ref: 432c13482319 +Node: Module API13482561 +Ref: library/ensurepip module-api13482684 +Ref: 432d13482684 +Ref: library/ensurepip ensurepip version13482791 +Ref: 432e13482791 +Ref: library/ensurepip ensurepip bootstrap13482953 +Ref: 41ea13482953 +Node: venv — Creation of virtual environments13484736 +Ref: library/venv doc13484960 +Ref: 432f13484960 +Ref: library/venv module-venv13484960 +Ref: 11113484960 +Ref: library/venv venv-creation-of-virtual-environments13484960 +Ref: 433013484960 +Ref: library/venv venv-def13485185 +Ref: 433113485185 +Ref: library/venv venv-intro13485185 +Ref: 433213485185 +Ref: venv — Creation of virtual environments-Footnote-113487235 +Ref: venv — Creation of virtual environments-Footnote-213487297 +Ref: venv — Creation of virtual environments-Footnote-313487335 +Ref: venv — Creation of virtual environments-Footnote-413487377 +Node: Creating virtual environments13487505 +Ref: library/venv creating-virtual-environments13487635 +Ref: 433313487635 +Ref: library/venv venv-cli13489388 +Ref: 433413489388 +Ref: library/venv cmdoption-venv-arg-ENV_DIR13489388 +Ref: 433513489388 +Ref: library/venv cmdoption-venv-system-site-packages13489495 +Ref: 433613489495 +Ref: library/venv cmdoption-venv-symlinks13489617 +Ref: 433713489617 +Ref: library/venv cmdoption-venv-copies13489744 +Ref: 433813489744 +Ref: library/venv cmdoption-venv-clear13489870 +Ref: 433913489870 +Ref: library/venv cmdoption-venv-upgrade13490002 +Ref: 433a13490002 +Ref: library/venv cmdoption-venv-without-pip13490145 +Ref: 433b13490145 +Ref: library/venv cmdoption-venv-prompt13490278 +Ref: 433c13490278 +Ref: library/venv cmdoption-venv-upgrade-deps13490375 +Ref: 433d13490375 +Ref: library/venv cmdoption-venv-without-scm-ignore-files13490472 +Ref: 433e13490472 +Ref: Creating virtual environments-Footnote-113492390 +Node: How venvs work13492445 +Ref: library/venv how-venvs-work13492590 +Ref: 433f13492590 +Ref: library/venv venv-explanation13492590 +Ref: 44813492590 +Node: API<2>13497089 +Ref: library/venv api13497239 +Ref: 434013497239 +Ref: library/venv venv-api13497239 +Ref: eed13497239 +Ref: library/venv venv EnvBuilder13497496 +Ref: 26c13497496 +Ref: library/venv venv EnvBuilder create13499778 +Ref: 434213499778 +Ref: library/venv venv EnvBuilder ensure_directories13501073 +Ref: 434313501073 +Ref: library/venv venv EnvBuilder create_configuration13503799 +Ref: 434413503799 +Ref: library/venv venv EnvBuilder setup_python13503937 +Ref: 434513503937 +Ref: library/venv venv EnvBuilder setup_scripts13504303 +Ref: 434613504303 +Ref: library/venv venv EnvBuilder upgrade_dependencies13504452 +Ref: 434913504452 +Ref: library/venv venv EnvBuilder post_setup13504822 +Ref: 434713504822 +Ref: library/venv venv EnvBuilder install_scripts13505057 +Ref: 434813505057 +Ref: library/venv venv EnvBuilder create_git_ignore_file13506496 +Ref: 434113506496 +Ref: library/venv venv create13507320 +Ref: 26d13507320 +Ref: API<2>-Footnote-113507989 +Ref: API<2>-Footnote-213508027 +Node: An example of extending EnvBuilder13508072 +Ref: library/venv an-example-of-extending-envbuilder13508199 +Ref: 434a13508199 +Ref: An example of extending EnvBuilder-Footnote-113518344 +Node: zipapp — Manage executable Python zip archives13518391 +Ref: library/zipapp doc13518561 +Ref: 434b13518561 +Ref: library/zipapp module-zipapp13518561 +Ref: 13013518561 +Ref: library/zipapp zipapp-manage-executable-python-zip-archives13518561 +Ref: 434c13518561 +Ref: zipapp — Manage executable Python zip archives-Footnote-113519340 +Node: Basic Example13519406 +Ref: library/zipapp basic-example13519538 +Ref: 434f13519538 +Node: Command-Line Interface<5>13519943 +Ref: library/zipapp command-line-interface13520094 +Ref: 435013520094 +Ref: library/zipapp zipapp-command-line-interface13520094 +Ref: 434d13520094 +Ref: library/zipapp cmdoption-zipapp-o13520590 +Ref: 435113520590 +Ref: library/zipapp cmdoption-zipapp-output13520590 +Ref: 435213520590 +Ref: library/zipapp cmdoption-zipapp-p13521087 +Ref: 435313521087 +Ref: library/zipapp cmdoption-zipapp-python13521087 +Ref: 435413521087 +Ref: library/zipapp cmdoption-zipapp-m13521363 +Ref: 435513521363 +Ref: library/zipapp cmdoption-zipapp-main13521363 +Ref: 435613521363 +Ref: library/zipapp cmdoption-zipapp-c13521792 +Ref: 435713521792 +Ref: library/zipapp cmdoption-zipapp-compress13521792 +Ref: 435813521792 +Ref: library/zipapp cmdoption-zipapp-info13522069 +Ref: 435913522069 +Ref: library/zipapp cmdoption-zipapp-h13522272 +Ref: 435a13522272 +Ref: library/zipapp cmdoption-zipapp-help13522272 +Ref: 435b13522272 +Node: Python API13522340 +Ref: library/zipapp python-api13522490 +Ref: 435c13522490 +Ref: library/zipapp zipapp-python-api13522490 +Ref: 434e13522490 +Ref: library/zipapp zipapp create_archive13522578 +Ref: bb013522578 +Ref: library/zipapp zipapp get_interpreter13526371 +Ref: 435d13526371 +Node: Examples<32>13526728 +Ref: library/zipapp examples13526879 +Ref: 435e13526879 +Ref: library/zipapp zipapp-examples13526879 +Ref: 435f13526879 +Node: Specifying the Interpreter13528250 +Ref: library/zipapp specifying-the-interpreter13528435 +Ref: 436013528435 +Ref: library/zipapp zipapp-specifying-the-interpreter13528435 +Ref: 436113528435 +Node: Creating Standalone Applications with zipapp13529674 +Ref: library/zipapp creating-standalone-applications-with-zipapp13529888 +Ref: 436213529888 +Node: Caveats13531599 +Ref: library/zipapp caveats13531687 +Ref: 436313531687 +Node: The Python Zip Application Archive Format13532426 +Ref: library/zipapp the-python-zip-application-archive-format13532605 +Ref: 436413532605 +Node: Python Runtime Services13534508 +Ref: library/python doc13534674 +Ref: 436513534674 +Ref: library/python python13534674 +Ref: 436613534674 +Ref: library/python python-runtime-services13534674 +Ref: 436713534674 +Node: sys — System-specific parameters and functions13535624 +Ref: library/sys doc13535786 +Ref: 436813535786 +Ref: library/sys module-sys13535786 +Ref: d913535786 +Ref: library/sys sys-system-specific-parameters-and-functions13535786 +Ref: 436913535786 +Ref: library/sys sys abiflags13536210 +Ref: a6313536210 +Ref: library/sys sys addaudithook13536574 +Ref: 41e113536574 +Ref: library/sys sys argv13538790 +Ref: 125813538790 +Ref: library/sys auditing13539718 +Ref: 18ba13539718 +Ref: library/sys sys audit13539718 +Ref: 15b913539718 +Ref: library/sys sys base_exec_prefix13541118 +Ref: 3ea13541118 +Ref: library/sys sys base_prefix13541761 +Ref: 3eb13541761 +Ref: library/sys sys byteorder13542394 +Ref: 219b13542394 +Ref: library/sys sys builtin_module_names13542650 +Ref: 1c5f13542650 +Ref: library/sys sys call_tracing13542983 +Ref: 183213542983 +Ref: library/sys sys copyright13543506 +Ref: 436a13543506 +Ref: library/sys sys _clear_type_cache13543614 +Ref: 167113543614 +Ref: library/sys sys _clear_internal_caches13544059 +Ref: 167013544059 +Ref: library/sys sys _current_frames13544298 +Ref: 13fe13544298 +Ref: library/sys sys _current_exceptions13545167 +Ref: 4be13545167 +Ref: library/sys sys breakpointhook13545878 +Ref: ada13545878 +Ref: library/sys sys _debugmallocstats13547778 +Ref: 436b13547778 +Ref: library/sys sys dllhandle13548261 +Ref: 436c13548261 +Ref: library/sys sys displayhook13548383 +Ref: 14ea13548383 +Ref: library/sys sys dont_write_bytecode13549910 +Ref: 436d13549910 +Ref: library/sys sys _emscripten_info13550309 +Ref: 180013550309 +Ref: library/sys sys _emscripten_info emscripten_version13550524 +Ref: 436e13550524 +Ref: library/sys sys _emscripten_info runtime13550684 +Ref: 436f13550684 +Ref: library/sys sys _emscripten_info pthreads13550839 +Ref: 437013550839 +Ref: library/sys sys _emscripten_info shared_memory13550964 +Ref: 437113550964 +Ref: library/sys sys pycache_prefix13551162 +Ref: 9a413551162 +Ref: library/sys sys excepthook13552135 +Ref: 80713552135 +Ref: library/sys sys __breakpointhook__13553500 +Ref: 437213553500 +Ref: library/sys sys __displayhook__13553533 +Ref: 437313553533 +Ref: library/sys sys __excepthook__13553563 +Ref: 437413553563 +Ref: library/sys sys __unraisablehook__13553592 +Ref: 437513553592 +Ref: library/sys sys exception13554104 +Ref: 68713554104 +Ref: library/sys sys exc_info13554574 +Ref: 68613554574 +Ref: library/sys sys exec_prefix13555580 +Ref: 3ae13555580 +Ref: library/sys sys executable13556499 +Ref: 3b413556499 +Ref: library/sys sys exit13556800 +Ref: 133c13556800 +Ref: library/sys sys flags13558472 +Ref: 68813558472 +Ref: library/sys sys flags debug13558644 +Ref: 437613558644 +Ref: library/sys sys flags inspect13558844 +Ref: 437713558844 +Ref: library/sys sys flags interactive13559046 +Ref: 437813559046 +Ref: library/sys sys flags isolated13559241 +Ref: 437913559241 +Ref: library/sys sys flags optimize13559438 +Ref: 437a13559438 +Ref: library/sys sys flags dont_write_bytecode13559665 +Ref: 437b13559665 +Ref: library/sys sys flags no_user_site13559856 +Ref: 437c13559856 +Ref: library/sys sys flags no_site13560049 +Ref: 437d13560049 +Ref: library/sys sys flags ignore_environment13560258 +Ref: 437e13560258 +Ref: library/sys sys flags verbose13560444 +Ref: 437f13560444 +Ref: library/sys sys flags bytes_warning13560648 +Ref: 438013560648 +Ref: library/sys sys flags quiet13560837 +Ref: 438113560837 +Ref: library/sys sys flags hash_randomization13561048 +Ref: 438213561048 +Ref: library/sys sys flags dev_mode13561236 +Ref: 1aa013561236 +Ref: library/sys sys flags utf8_mode13561536 +Ref: 438313561536 +Ref: library/sys sys flags safe_path13561738 +Ref: 23813561738 +Ref: library/sys sys flags int_max_str_digits13561944 +Ref: 227a13561944 +Ref: library/sys sys flags warn_default_encoding13562281 +Ref: 438413562281 +Ref: library/sys sys float_info13563262 +Ref: 19ea13563262 +Ref: library/sys sys float_info epsilon13564220 +Ref: 438613564220 +Ref: library/sys sys float_info dig13564916 +Ref: 438713564916 +Ref: library/sys sys float_info mant_dig13565427 +Ref: 438813565427 +Ref: library/sys sys float_info max13565919 +Ref: 438913565919 +Ref: library/sys sys float_info max_exp13566302 +Ref: 438a13566302 +Ref: library/sys sys float_info max_10_exp13566780 +Ref: 438b13566780 +Ref: library/sys sys float_info min13567300 +Ref: 438c13567300 +Ref: library/sys sys float_info min_exp13568109 +Ref: 438d13568109 +Ref: library/sys sys float_info min_10_exp13568577 +Ref: 438e13568577 +Ref: library/sys sys float_info radix13568993 +Ref: 438f13568993 +Ref: library/sys sys float_info rounds13569362 +Ref: 439013569362 +Ref: library/sys sys float_repr_style13572256 +Ref: 12ed13572256 +Ref: library/sys sys getallocatedblocks13572797 +Ref: fc013572797 +Ref: library/sys sys getunicodeinternedsize13573441 +Ref: 439113573441 +Ref: library/sys sys getandroidapilevel13573583 +Ref: b8a13573583 +Ref: library/sys sys getdefaultencoding13573928 +Ref: 439213573928 +Ref: library/sys sys getdlopenflags13574098 +Ref: 14da13574098 +Ref: library/sys sys getfilesystemencoding13574411 +Ref: c5913574411 +Ref: library/sys sys getfilesystemencodeerrors13575823 +Ref: ce613575823 +Ref: library/sys sys get_int_max_str_digits13576565 +Ref: 152d13576565 +Ref: library/sys sys getrefcount13576793 +Ref: 439313576793 +Ref: library/sys sys getrecursionlimit13577565 +Ref: 4c013577565 +Ref: library/sys sys getsizeof13577877 +Ref: 176a13577877 +Ref: library/sys sys getswitchinterval13578829 +Ref: 94913578829 +Ref: library/sys sys _getframe13579012 +Ref: 6dc13579012 +Ref: library/sys sys _getframemodulename13579668 +Ref: 176e13579668 +Ref: library/sys sys getobjects13580400 +Ref: 42313580400 +Ref: library/sys sys getprofile13581525 +Ref: 13ac13581525 +Ref: library/sys sys gettrace13581626 +Ref: 13ad13581626 +Ref: library/sys sys getwindowsversion13582066 +Ref: ce713582066 +Ref: library/sys sys get_asyncgen_hooks13584595 +Ref: 183313584595 +Ref: library/sys sys get_coroutine_origin_tracking_depth13585204 +Ref: b8b13585204 +Ref: library/sys sys hash_info13585556 +Ref: ff813585556 +Ref: library/sys sys hash_info width13585769 +Ref: 439713585769 +Ref: library/sys sys hash_info modulus13585856 +Ref: 21a113585856 +Ref: library/sys sys hash_info inf13585955 +Ref: 439813585955 +Ref: library/sys sys hash_info nan13586049 +Ref: 439913586049 +Ref: library/sys sys hash_info imag13586130 +Ref: 439a13586130 +Ref: library/sys sys hash_info algorithm13586240 +Ref: 439b13586240 +Ref: library/sys sys hash_info hash_bits13586370 +Ref: 439c13586370 +Ref: library/sys sys hash_info seed_bits13586469 +Ref: 439d13586469 +Ref: library/sys sys hexversion13586678 +Ref: 439e13586678 +Ref: library/sys sys implementation13587572 +Ref: 51213587572 +Ref: library/sys sys int_info13589775 +Ref: 128613589775 +Ref: library/sys sys int_info bits_per_digit13589944 +Ref: 43a013589944 +Ref: library/sys sys int_info sizeof_digit13590130 +Ref: 43a113590130 +Ref: library/sys sys int_info default_max_str_digits13590243 +Ref: 227b13590243 +Ref: library/sys sys int_info str_digits_check_threshold13590429 +Ref: 43a213590429 +Ref: library/sys sys __interactivehook__13590822 +Ref: fc213590822 +Ref: library/sys sys intern13591370 +Ref: 12ce13591370 +Ref: library/sys sys _is_gil_enabled13592157 +Ref: 43a313592157 +Ref: library/sys sys is_finalizing13592442 +Ref: a8f13592442 +Ref: library/sys sys last_exc13592704 +Ref: 4ba13592704 +Ref: library/sys sys _is_interned13593277 +Ref: 25213593277 +Ref: library/sys sys last_type13593558 +Ref: 4bb13593558 +Ref: library/sys sys last_value13593582 +Ref: 4bc13593582 +Ref: library/sys sys last_traceback13593607 +Ref: 4bd13593607 +Ref: library/sys sys maxsize13593836 +Ref: 11b713593836 +Ref: library/sys sys maxunicode13594058 +Ref: 104513594058 +Ref: library/sys sys meta_path13594457 +Ref: d2b13594457 +Ref: library/sys sys modules13595766 +Ref: 155013595766 +Ref: library/sys sys orig_argv13596374 +Ref: 83c13596374 +Ref: library/sys sys path13596850 +Ref: 3b013596850 +Ref: library/sys sys path_hooks13598124 +Ref: 101d13598124 +Ref: library/sys sys path_importer_cache13598415 +Ref: 5e013598415 +Ref: library/sys sys platform13598822 +Ref: a8d13598822 +Ref: library/sys sys platlibdir13601160 +Ref: 93813601160 +Ref: library/sys sys prefix13602164 +Ref: 3b213602164 +Ref: library/sys sys ps113602792 +Ref: 1d4513602792 +Ref: library/sys sys ps213602810 +Ref: 1d4613602810 +Ref: library/sys sys setdlopenflags13603286 +Ref: 111313603286 +Ref: library/sys sys set_int_max_str_digits13603887 +Ref: 17be13603887 +Ref: library/sys sys setprofile13604124 +Ref: 14c913604124 +Ref: library/sys sys setrecursionlimit13606529 +Ref: 4bf13606529 +Ref: library/sys sys setswitchinterval13607321 +Ref: 94a13607321 +Ref: library/sys sys settrace13607900 +Ref: 14ca13607900 +Ref: library/sys sys set_asyncgen_hooks13612671 +Ref: 162613612671 +Ref: library/sys sys set_coroutine_origin_tracking_depth13613782 +Ref: b8c13613782 +Ref: library/sys sys activate_stack_trampoline13614605 +Ref: 46b13614605 +Ref: library/sys sys deactivate_stack_trampoline13614979 +Ref: 46c13614979 +Ref: library/sys sys is_stack_trampoline_active13615232 +Ref: 46d13615232 +Ref: library/sys sys _enablelegacywindowsfsencoding13615416 +Ref: 2b013615416 +Ref: library/sys sys stdin13616385 +Ref: 53913616385 +Ref: library/sys sys stdout13616405 +Ref: ad613616405 +Ref: library/sys sys stderr13616426 +Ref: 93913616426 +Ref: library/sys sys __stdin__13619584 +Ref: 43a513619584 +Ref: library/sys sys __stdout__13619608 +Ref: 288213619608 +Ref: library/sys sys __stderr__13619633 +Ref: 416713619633 +Ref: library/sys sys stdlib_module_names13620598 +Ref: 83d13620598 +Ref: library/sys sys thread_info13621333 +Ref: 114413621333 +Ref: library/sys sys thread_info name13621450 +Ref: 43a613621450 +Ref: library/sys sys thread_info lock13621804 +Ref: 43a713621804 +Ref: library/sys sys thread_info version13622103 +Ref: 43a813622103 +Ref: library/sys sys tracebacklimit13622300 +Ref: 15db13622300 +Ref: library/sys sys unraisablehook13622664 +Ref: 1f913622664 +Ref: library/sys sys version13624492 +Ref: 17813624492 +Ref: library/sys sys api_version13624894 +Ref: 43a913624894 +Ref: library/sys sys version_info13625082 +Ref: 69c13625082 +Ref: library/sys sys warnoptions13625703 +Ref: 3ac13625703 +Ref: library/sys sys winver13625922 +Ref: 43aa13625922 +Ref: library/sys sys _xoptions13626563 +Ref: 1d3f13626563 +Ref: library/sys c9913627364 +Ref: 438513627364 +Ref: sys — System-specific parameters and functions-Footnote-113627576 +Ref: sys — System-specific parameters and functions-Footnote-213627618 +Ref: sys — System-specific parameters and functions-Footnote-313627660 +Ref: sys — System-specific parameters and functions-Footnote-413627702 +Ref: sys — System-specific parameters and functions-Footnote-513627807 +Ref: sys — System-specific parameters and functions-Footnote-613627849 +Ref: sys — System-specific parameters and functions-Footnote-713627891 +Ref: sys — System-specific parameters and functions-Footnote-813627933 +Ref: sys — System-specific parameters and functions-Footnote-913627975 +Ref: sys — System-specific parameters and functions-Footnote-1013628017 +Ref: sys — System-specific parameters and functions-Footnote-1113628060 +Ref: sys — System-specific parameters and functions-Footnote-1213628103 +Ref: sys — System-specific parameters and functions-Footnote-1313628146 +Ref: sys — System-specific parameters and functions-Footnote-1413628189 +Ref: sys — System-specific parameters and functions-Footnote-1513628232 +Ref: sys — System-specific parameters and functions-Footnote-1613628313 +Ref: sys — System-specific parameters and functions-Footnote-1713628356 +Ref: sys — System-specific parameters and functions-Footnote-1813628399 +Node: sys monitoring — Execution event monitoring13628442 +Ref: library/sys monitoring doc13628681 +Ref: 43ab13628681 +Ref: library/sys monitoring module-sys monitoring13628681 +Ref: da13628681 +Ref: library/sys monitoring sys-monitoring-execution-event-monitoring13628681 +Ref: 43ac13628681 +Node: Tool identifiers13629691 +Ref: library/sys monitoring tool-identifiers13629804 +Ref: 43ad13629804 +Node: Registering and using tools13630361 +Ref: library/sys monitoring registering-and-using-tools13630441 +Ref: 43b013630441 +Ref: library/sys monitoring sys monitoring use_tool_id13630516 +Ref: 43b113630516 +Ref: library/sys monitoring sys monitoring free_tool_id13630773 +Ref: 43b213630773 +Ref: library/sys monitoring sys monitoring get_tool13631187 +Ref: 43b313631187 +Node: Events13631690 +Ref: library/sys monitoring events13631837 +Ref: 43ae13631837 +Ref: library/sys monitoring monitoring-event-BRANCH13631907 +Ref: 43b413631907 +Ref: library/sys monitoring monitoring-event-CALL13632005 +Ref: 164613632005 +Ref: library/sys monitoring monitoring-event-C_RAISE13632115 +Ref: 43b513632115 +Ref: library/sys monitoring monitoring-event-C_RETURN13632277 +Ref: 43b613632277 +Ref: library/sys monitoring monitoring-event-EXCEPTION_HANDLED13632429 +Ref: 43b713632429 +Ref: library/sys monitoring monitoring-event-INSTRUCTION13632523 +Ref: 43b813632523 +Ref: library/sys monitoring monitoring-event-JUMP13632628 +Ref: 43b913632628 +Ref: library/sys monitoring monitoring-event-LINE13632741 +Ref: 43ba13632741 +Ref: library/sys monitoring monitoring-event-PY_RESUME13632906 +Ref: 43bb13632906 +Ref: library/sys monitoring monitoring-event-PY_RETURN13633077 +Ref: 43bc13633077 +Ref: library/sys monitoring monitoring-event-PY_START13633256 +Ref: 43bd13633256 +Ref: library/sys monitoring monitoring-event-PY_THROW13633427 +Ref: 43be13633427 +Ref: library/sys monitoring monitoring-event-PY_UNWIND13633541 +Ref: 43bf13633541 +Ref: library/sys monitoring monitoring-event-PY_YIELD13633658 +Ref: 43c013633658 +Ref: library/sys monitoring monitoring-event-RAISE13633834 +Ref: 15f013633834 +Ref: library/sys monitoring monitoring-event-RERAISE13633981 +Ref: 43c213633981 +Ref: library/sys monitoring monitoring-event-STOP_ITERATION13634127 +Ref: 43c113634127 +Ref: library/sys monitoring monitoring-event-NO_EVENTS13634679 +Ref: 43c413634679 +Node: Local events13635007 +Ref: library/sys monitoring local-events13635087 +Ref: 43c513635087 +Ref: library/sys monitoring monitoring-event-local13635087 +Ref: 43c613635087 +Node: Ancillary events13635573 +Ref: library/sys monitoring ancillary-events13635674 +Ref: 43c713635674 +Node: Other events13636117 +Ref: library/sys monitoring other-events13636230 +Ref: 43c813636230 +Node: The STOP_ITERATION event13636553 +Ref: library/sys monitoring the-stop-iteration-event13636641 +Ref: 43c313636641 +Ref: The STOP_ITERATION event-Footnote-113637284 +Node: Turning events on and off13637365 +Ref: library/sys monitoring turning-events-on-and-off13637526 +Ref: 43c913637526 +Node: Setting events globally13637887 +Ref: library/sys monitoring setting-events-globally13638003 +Ref: 43ca13638003 +Ref: library/sys monitoring sys monitoring get_events13638153 +Ref: 43cb13638153 +Ref: library/sys monitoring sys monitoring set_events13638283 +Ref: 43cc13638283 +Node: Per code object events13638533 +Ref: library/sys monitoring per-code-object-events13638674 +Ref: 43cd13638674 +Ref: library/sys monitoring sys monitoring get_local_events13639003 +Ref: 43ce13639003 +Ref: library/sys monitoring sys monitoring set_local_events13639147 +Ref: 43cf13639147 +Node: Disabling events13639568 +Ref: library/sys monitoring disabling-events13639677 +Ref: 43d013639677 +Ref: library/sys monitoring sys monitoring DISABLE13639732 +Ref: 43d113639732 +Ref: library/sys monitoring sys monitoring restart_events13640345 +Ref: 43d213640345 +Node: Registering callback functions13640507 +Ref: library/sys monitoring callbacks13640653 +Ref: 43af13640653 +Ref: library/sys monitoring registering-callback-functions13640653 +Ref: 43d313640653 +Ref: library/sys monitoring sys monitoring register_callback13640776 +Ref: 41ef13640776 +Node: Callback function arguments13641501 +Ref: library/sys monitoring callback-function-arguments13641595 +Ref: 43d413641595 +Ref: library/sys monitoring sys monitoring MISSING13641672 +Ref: 43d513641672 +Node: sysconfig — Provide access to Python’s configuration information13643330 +Ref: library/sysconfig doc13643550 +Ref: 43d613643550 +Ref: library/sysconfig module-sysconfig13643550 +Ref: db13643550 +Ref: library/sysconfig sysconfig-provide-access-to-python-s-configuration-information13643550 +Ref: 43d713643550 +Ref: sysconfig — Provide access to Python’s configuration information-Footnote-113644286 +Node: Configuration variables13644352 +Ref: library/sysconfig configuration-variables13644507 +Ref: 43d813644507 +Ref: library/sysconfig sysconfig get_config_vars13644999 +Ref: 102513644999 +Ref: library/sysconfig sysconfig get_config_var13645370 +Ref: 102413645370 +Node: Installation paths13645813 +Ref: library/sysconfig id113645988 +Ref: 43d913645988 +Ref: library/sysconfig installation-paths13645988 +Ref: 68b13645988 +Node: User scheme13648330 +Ref: library/sysconfig sysconfig-user-scheme13648493 +Ref: 1d4713648493 +Ref: library/sysconfig user-scheme13648493 +Ref: 43da13648493 +Node: posix_user13649022 +Ref: library/sysconfig posix-user13649096 +Ref: 43db13649096 +Node: nt_user13649940 +Ref: library/sysconfig nt-user13650041 +Ref: 43dc13650041 +Node: osx_framework_user13650873 +Ref: library/sysconfig osx-framework-user13650955 +Ref: 43dd13650955 +Node: Home scheme13651795 +Ref: library/sysconfig home-scheme13651953 +Ref: 43de13651953 +Ref: library/sysconfig sysconfig-home-scheme13651953 +Ref: 43df13651953 +Node: posix_home13652434 +Ref: library/sysconfig posix-home13652492 +Ref: 43e013652492 +Node: Prefix scheme13653342 +Ref: library/sysconfig prefix-scheme13653516 +Ref: 43e113653516 +Ref: library/sysconfig sysconfig-prefix-scheme13653516 +Ref: 43e213653516 +Node: posix_prefix13654856 +Ref: library/sysconfig posix-prefix13654929 +Ref: 43e313654929 +Node: nt13655858 +Ref: library/sysconfig nt13655931 +Ref: 43e413655931 +Node: Installation path functions13656772 +Ref: library/sysconfig installation-path-functions13656953 +Ref: 43e513656953 +Ref: library/sysconfig sysconfig get_scheme_names13657115 +Ref: 43e613657115 +Ref: library/sysconfig sysconfig get_default_scheme13657253 +Ref: 182313657253 +Ref: library/sysconfig sysconfig get_preferred_scheme13657613 +Ref: 68c13657613 +Ref: library/sysconfig sysconfig _get_preferred_schemes13658205 +Ref: 43e713658205 +Ref: library/sysconfig sysconfig get_path_names13658872 +Ref: 43e813658872 +Ref: library/sysconfig sysconfig get_path13659011 +Ref: 132113659011 +Ref: library/sysconfig sysconfig get_paths13660240 +Ref: 123713660240 +Node: Other functions<3>13660865 +Ref: library/sysconfig other-functions13661054 +Ref: 43e913661054 +Ref: library/sysconfig sysconfig get_python_version13661107 +Ref: 123613661107 +Ref: library/sysconfig sysconfig get_platform13661278 +Ref: 123513661278 +Ref: library/sysconfig sysconfig is_python_build13662349 +Ref: 2e113662349 +Ref: library/sysconfig sysconfig parse_config_h13662640 +Ref: 43ea13662640 +Ref: library/sysconfig sysconfig get_config_h_filename13663034 +Ref: 43eb13663034 +Ref: library/sysconfig sysconfig get_makefile_filename13663127 +Ref: 43ec13663127 +Ref: library/sysconfig sysconfig-cli13663217 +Ref: 43ed13663217 +Node: Command-line usage<3>13663218 +Ref: library/sysconfig command-line-usage13663371 +Ref: 43ee13663371 +Ref: library/sysconfig using-sysconfig-as-a-script13663371 +Ref: 43ef13663371 +Node: builtins — Built-in objects13664424 +Ref: library/builtins doc13664638 +Ref: 43f013664638 +Ref: library/builtins builtins-built-in-objects13664638 +Ref: 43f113664638 +Ref: library/builtins module-builtins13664638 +Ref: 1213664638 +Node: __main__ — Top-level code environment13666215 +Ref: library/__main__ doc13666389 +Ref: 43f213666389 +Ref: library/__main__ main-top-level-code-environment13666389 +Ref: 43f313666389 +Ref: library/__main__ module-__main__13666389 +Ref: 113666389 +Node: __name__ == '__main__'13667222 +Ref: library/__main__ name-equals-main13667359 +Ref: 43f413667359 +Ref: library/__main__ name-main13667359 +Ref: 43f513667359 +Node: What is the “top-level code environment”?13668135 +Ref: library/__main__ what-is-the-top-level-code-environment13668263 +Ref: 43f613668263 +Node: Idiomatic Usage13670282 +Ref: library/__main__ idiomatic-usage13670443 +Ref: 43f713670443 +Node: Packaging Considerations13672423 +Ref: library/__main__ packaging-considerations13672530 +Ref: 43f813672530 +Ref: Packaging Considerations-Footnote-113674041 +Ref: Packaging Considerations-Footnote-213674070 +Node: __main__ py in Python Packages13674108 +Ref: library/__main__ main-py-in-python-packages13674269 +Ref: 43f913674269 +Node: Idiomatic Usage<2>13675676 +Ref: library/__main__ id113675761 +Ref: 43fa13675761 +Node: import __main__13677102 +Ref: library/__main__ import-main13677232 +Ref: 43fb13677232 +Node: warnings — Warning control13680416 +Ref: library/warnings doc13680589 +Ref: 43fc13680589 +Ref: library/warnings module-warnings13680589 +Ref: 11213680589 +Ref: library/warnings warnings-warning-control13680589 +Ref: 43fd13680589 +Ref: warnings — Warning control-Footnote-113682903 +Node: Warning Categories13682971 +Ref: library/warnings id113683082 +Ref: 440113683082 +Ref: library/warnings warning-categories13683082 +Ref: 22b213683082 +Node: The Warnings Filter13687086 +Ref: library/warnings the-warnings-filter13687238 +Ref: 440213687238 +Ref: library/warnings warning-filter13687238 +Ref: 8c813687238 +Node: Repeated Warning Suppression Criteria13690423 +Ref: library/warnings id213690551 +Ref: 440313690551 +Ref: library/warnings repeated-warning-suppression-criteria13690551 +Ref: 440413690551 +Node: Describing Warning Filters13691186 +Ref: library/warnings describing-warning-filters13691345 +Ref: 1d3913691345 +Ref: library/warnings id313691345 +Ref: 440513691345 +Node: Default Warning Filter13693070 +Ref: library/warnings default-warning-filter13693221 +Ref: 440613693221 +Ref: library/warnings id413693221 +Ref: 440713693221 +Node: Overriding the default filter13694321 +Ref: library/warnings overriding-the-default-filter13694437 +Ref: 440813694437 +Ref: library/warnings warning-disable13694437 +Ref: 440913694437 +Node: Temporarily Suppressing Warnings13695872 +Ref: library/warnings temporarily-suppressing-warnings13696022 +Ref: 440a13696022 +Ref: library/warnings warning-suppress13696022 +Ref: 440b13696022 +Node: Testing Warnings13697038 +Ref: library/warnings testing-warnings13697215 +Ref: 440c13697215 +Ref: library/warnings warning-testing13697215 +Ref: 440d13697215 +Node: Updating Code For New Versions of Dependencies13699277 +Ref: library/warnings updating-code-for-new-versions-of-dependencies13699441 +Ref: 440e13699441 +Ref: library/warnings warning-ignored13699441 +Ref: 40b913699441 +Node: Available Functions13700831 +Ref: library/warnings available-functions13701005 +Ref: 440f13701005 +Ref: library/warnings warning-functions13701005 +Ref: 441013701005 +Ref: library/warnings warnings warn13701066 +Ref: 14e413701066 +Ref: library/warnings warnings warn_explicit13703642 +Ref: d0013703642 +Ref: library/warnings warnings showwarning13704831 +Ref: 440013704831 +Ref: library/warnings warnings formatwarning13705469 +Ref: 1a1413705469 +Ref: library/warnings warnings filterwarnings13705901 +Ref: 147213705901 +Ref: library/warnings warnings simplefilter13706577 +Ref: 6bd13706577 +Ref: library/warnings warnings resetwarnings13707013 +Ref: 43ff13707013 +Ref: library/warnings warnings deprecated13707281 +Ref: 16013707281 +Ref: Available Functions-Footnote-113709142 +Node: Available Context Managers13709184 +Ref: library/warnings available-context-managers13709303 +Ref: 441113709303 +Ref: library/warnings warnings catch_warnings13709378 +Ref: 58113709378 +Node: dataclasses — Data Classes13711083 +Ref: library/dataclasses doc13711269 +Ref: 441213711269 +Ref: library/dataclasses dataclasses-data-classes13711269 +Ref: 441313711269 +Ref: library/dataclasses module-dataclasses13711269 +Ref: 2f13711269 +Ref: dataclasses — Data Classes-Footnote-113712976 +Ref: dataclasses — Data Classes-Footnote-213713047 +Ref: dataclasses — Data Classes-Footnote-313713089 +Node: Module contents<4>13713131 +Ref: library/dataclasses module-contents13713243 +Ref: 441413713243 +Ref: library/dataclasses dataclasses dataclass13713294 +Ref: 1cb13713294 +Ref: library/dataclasses dataclasses field13723254 +Ref: 1a1f13723254 +Ref: library/dataclasses dataclasses Field13727884 +Ref: 225513727884 +Ref: library/dataclasses dataclasses InitVar13728640 +Ref: 182213728640 +Ref: library/dataclasses dataclasses fields13729047 +Ref: 174213729047 +Ref: library/dataclasses dataclasses asdict13729426 +Ref: 172413729426 +Ref: library/dataclasses dataclasses astuple13730468 +Ref: 172d13730468 +Ref: library/dataclasses dataclasses make_dataclass13731207 +Ref: 174413731207 +Ref: library/dataclasses dataclasses replace13733002 +Ref: 16f913733002 +Ref: library/dataclasses dataclasses is_dataclass13734502 +Ref: 187213734502 +Ref: library/dataclasses dataclasses MISSING13734981 +Ref: 441613734981 +Ref: library/dataclasses dataclasses KW_ONLY13735084 +Ref: 441513735084 +Ref: library/dataclasses dataclasses FrozenInstanceError13736027 +Ref: 441913736027 +Ref: Module contents<4>-Footnote-113736338 +Ref: Module contents<4>-Footnote-213736393 +Node: Post-init processing13736448 +Ref: library/dataclasses id113736584 +Ref: 441a13736584 +Ref: library/dataclasses post-init-processing13736584 +Ref: 441b13736584 +Ref: library/dataclasses dataclasses __post_init__13736645 +Ref: 441813736645 +Node: Class variables13738406 +Ref: library/dataclasses class-variables13738543 +Ref: 441c13738543 +Ref: library/dataclasses dataclasses-class-variables13738543 +Ref: 441d13738543 +Ref: Class variables-Footnote-113739101 +Node: Init-only variables13739143 +Ref: library/dataclasses dataclasses-init-only-variables13739276 +Ref: 441713739276 +Ref: library/dataclasses init-only-variables13739276 +Ref: 441e13739276 +Node: Frozen instances13740505 +Ref: library/dataclasses dataclasses-frozen13740637 +Ref: 441f13740637 +Ref: library/dataclasses frozen-instances13740637 +Ref: 442013740637 +Node: Inheritance<2>13741234 +Ref: library/dataclasses dataclasses-inheritance13741397 +Ref: 442113741397 +Ref: library/dataclasses inheritance13741397 +Ref: 442213741397 +Node: Re-ordering of keyword-only parameters in __init__13742453 +Ref: library/dataclasses re-ordering-of-keyword-only-parameters-in-init13742625 +Ref: 442313742625 +Node: Default factory functions13743880 +Ref: library/dataclasses default-factory-functions13744060 +Ref: 442413744060 +Node: Mutable default values13744678 +Ref: library/dataclasses mutable-default-values13744831 +Ref: 442513744831 +Node: Descriptor-typed fields13746856 +Ref: library/dataclasses descriptor-typed-fields13746975 +Ref: 442613746975 +Node: contextlib — Utilities for with-statement contexts13748953 +Ref: library/contextlib doc13749140 +Ref: 442713749140 +Ref: library/contextlib contextlib-utilities-for-with-statement-contexts13749140 +Ref: 442813749140 +Ref: library/contextlib module-contextlib13749140 +Ref: 2313749140 +Ref: contextlib — Utilities for with-statement contexts-Footnote-113749802 +Node: Utilities13749872 +Ref: library/contextlib utilities13750002 +Ref: 442913750002 +Ref: library/contextlib contextlib AbstractContextManager13750074 +Ref: c8d13750074 +Ref: library/contextlib contextlib AbstractAsyncContextManager13750564 +Ref: b2b13750564 +Ref: library/contextlib contextlib contextmanager13751078 +Ref: 11f413751078 +Ref: library/contextlib contextlib asynccontextmanager13754100 +Ref: b2a13754100 +Ref: library/contextlib contextlib closing13756131 +Ref: 294c13756131 +Ref: library/contextlib contextlib aclosing13757372 +Ref: 7e813757372 +Ref: library/contextlib simplifying-support-for-single-optional-context-managers13758493 +Ref: 442a13758493 +Ref: library/contextlib contextlib nullcontext13758493 +Ref: 7e913758493 +Ref: library/contextlib contextlib suppress13760204 +Ref: f2113760204 +Ref: library/contextlib contextlib redirect_stdout13761776 +Ref: de713761776 +Ref: library/contextlib contextlib redirect_stderr13763250 +Ref: de613763250 +Ref: library/contextlib contextlib chdir13763514 +Ref: 60813763514 +Ref: library/contextlib contextlib ContextDecorator13764245 +Ref: 11f313764245 +Ref: library/contextlib contextlib AsyncContextDecorator13766686 +Ref: 7ea13766686 +Ref: library/contextlib contextlib ExitStack13767778 +Ref: b2913767778 +Ref: library/contextlib contextlib ExitStack enter_context13769775 +Ref: 5cf13769775 +Ref: library/contextlib contextlib ExitStack push13770365 +Ref: 442c13770365 +Ref: library/contextlib contextlib ExitStack callback13771257 +Ref: a8313771257 +Ref: library/contextlib contextlib ExitStack pop_all13771713 +Ref: 442d13771713 +Ref: library/contextlib contextlib ExitStack close13772765 +Ref: 442e13772765 +Ref: library/contextlib contextlib AsyncExitStack13773053 +Ref: b2c13773053 +Ref: library/contextlib contextlib AsyncExitStack enter_async_context13773420 +Ref: 5d213773420 +Ref: library/contextlib contextlib AsyncExitStack push_async_exit13773755 +Ref: 443013773755 +Ref: library/contextlib contextlib AsyncExitStack push_async_callback13773934 +Ref: a8413773934 +Ref: library/contextlib contextlib AsyncExitStack aclose13774100 +Ref: 442f13774100 +Node: Examples and Recipes<3>13774709 +Ref: library/contextlib examples-and-recipes13774898 +Ref: 443113774898 +Node: Supporting a variable number of context managers13775346 +Ref: library/contextlib supporting-a-variable-number-of-context-managers13775505 +Ref: 443213775505 +Node: Catching exceptions from __enter__ methods13776547 +Ref: library/contextlib catching-exceptions-from-enter-methods13776757 +Ref: 443313776757 +Node: Cleaning up in an __enter__ implementation13777905 +Ref: library/contextlib cleaning-up-in-an-enter-implementation13778118 +Ref: 443413778118 +Node: Replacing any use of try-finally and flag variables13780021 +Ref: library/contextlib replacing-any-use-of-try-finally-and-flag-variables13780239 +Ref: 443513780239 +Node: Using a context manager as a function decorator13782751 +Ref: library/contextlib using-a-context-manager-as-a-function-decorator13782918 +Ref: 443613782918 +Ref: Using a context manager as a function decorator-Footnote-113784754 +Node: Single use reusable and reentrant context managers13784796 +Ref: library/contextlib single-use-reusable-and-reentrant-cms13784967 +Ref: f2313784967 +Ref: library/contextlib single-use-reusable-and-reentrant-context-managers13784967 +Ref: 443713784967 +Node: Reentrant context managers13786505 +Ref: library/contextlib reentrant-cms13786652 +Ref: 442b13786652 +Ref: library/contextlib reentrant-context-managers13786652 +Ref: 443813786652 +Node: Reusable context managers13788189 +Ref: library/contextlib reusable-cms13788336 +Ref: 443913788336 +Ref: library/contextlib reusable-context-managers13788336 +Ref: 443a13788336 +Node: abc — Abstract Base Classes13791014 +Ref: library/abc doc13791197 +Ref: 443b13791197 +Ref: library/abc abc-abstract-base-classes13791197 +Ref: 443c13791197 +Ref: library/abc module-abc13791197 +Ref: 413791197 +Ref: library/abc abc ABC13792187 +Ref: f1213792187 +Ref: library/abc abc ABCMeta13793005 +Ref: f1313793005 +Ref: library/abc abc ABCMeta register13793779 +Ref: 108213793779 +Ref: library/abc abc ABCMeta __subclasshook__13794456 +Ref: 253113794456 +Ref: library/abc abc abstractmethod13797372 +Ref: 107f13797372 +Ref: library/abc abc abstractclassmethod13800517 +Ref: 108013800517 +Ref: library/abc abc abstractstaticmethod13801237 +Ref: 108113801237 +Ref: library/abc abc abstractproperty13801959 +Ref: 107e13801959 +Ref: library/abc abc get_cache_token13803363 +Ref: f1113803363 +Ref: library/abc abc update_abstractmethods13803743 +Ref: 443d13803743 +Ref: abc — Abstract Base Classes-Footnote-113804398 +Ref: abc — Abstract Base Classes-Footnote-213804461 +Ref: abc — Abstract Base Classes-Footnote-313804503 +Ref: abc — Abstract Base Classes-Footnote-413804545 +Node: atexit — Exit handlers13804652 +Ref: library/atexit doc13804832 +Ref: 443e13804832 +Ref: library/atexit atexit-exit-handlers13804832 +Ref: 443f13804832 +Ref: library/atexit module-atexit13804832 +Ref: c13804832 +Ref: library/atexit atexit register13805849 +Ref: 87b13805849 +Ref: library/atexit atexit unregister13807456 +Ref: 444013807456 +Node: atexit Example13808146 +Ref: library/atexit atexit-example13808221 +Ref: 444113808221 +Ref: library/atexit id113808221 +Ref: 444213808221 +Node: traceback — Print or retrieve a stack traceback13809584 +Ref: library/traceback doc13809778 +Ref: 444313809778 +Ref: library/traceback module-traceback13809778 +Ref: fe13809778 +Ref: library/traceback traceback-print-or-retrieve-a-stack-traceback13809778 +Ref: 444413809778 +Ref: traceback — Print or retrieve a stack traceback-Footnote-113811786 +Node: Module-Level Functions<2>13811855 +Ref: library/traceback module-level-functions13812001 +Ref: 444513812001 +Ref: library/traceback traceback print_tb13812068 +Ref: e8013812068 +Ref: library/traceback traceback print_exception13813015 +Ref: 84b13813015 +Ref: library/traceback traceback print_exc13814536 +Ref: 187f13814536 +Ref: library/traceback traceback print_last13814719 +Ref: 444613814719 +Ref: library/traceback traceback print_stack13815025 +Ref: e8113815025 +Ref: library/traceback traceback extract_tb13815587 +Ref: 444713815587 +Ref: library/traceback traceback extract_stack13816236 +Ref: 444c13816236 +Ref: library/traceback traceback print_list13816549 +Ref: 444d13816549 +Ref: library/traceback traceback format_list13816852 +Ref: 444e13816852 +Ref: library/traceback traceback format_exception_only13817361 +Ref: 84a13817361 +Ref: library/traceback traceback format_exception13818744 +Ref: 84913818744 +Ref: library/traceback traceback format_exc13819484 +Ref: 444f13819484 +Ref: library/traceback traceback format_tb13819644 +Ref: 432313819644 +Ref: library/traceback traceback format_stack13819760 +Ref: 445013819760 +Ref: library/traceback traceback clear_frames13819885 +Ref: fcf13819885 +Ref: library/traceback traceback walk_stack13820130 +Ref: e7c13820130 +Ref: library/traceback traceback walk_tb13820448 +Ref: e7d13820448 +Node: TracebackException Objects13820690 +Ref: library/traceback tracebackexception-objects13820865 +Ref: 445213820865 +Ref: library/traceback traceback TracebackException13821348 +Ref: 25e13821348 +Ref: library/traceback traceback TracebackException __cause__13822654 +Ref: 445413822654 +Ref: library/traceback traceback TracebackException __context__13822762 +Ref: 445313822762 +Ref: library/traceback traceback TracebackException exceptions13822884 +Ref: 445613822884 +Ref: library/traceback traceback TracebackException __suppress_context__13823163 +Ref: 445513823163 +Ref: library/traceback traceback TracebackException __notes__13823299 +Ref: 445713823299 +Ref: library/traceback traceback TracebackException stack13823609 +Ref: 445813823609 +Ref: library/traceback traceback TracebackException exc_type13823702 +Ref: 25f13823702 +Ref: library/traceback traceback TracebackException exc_type_str13823822 +Ref: 25d13823822 +Ref: library/traceback traceback TracebackException filename13823956 +Ref: 445913823956 +Ref: library/traceback traceback TracebackException lineno13824057 +Ref: 445a13824057 +Ref: library/traceback traceback TracebackException end_lineno13824158 +Ref: 445b13824158 +Ref: library/traceback traceback TracebackException text13824346 +Ref: 445c13824346 +Ref: library/traceback traceback TracebackException offset13824438 +Ref: 445d13824438 +Ref: library/traceback traceback TracebackException end_offset13824558 +Ref: 445e13824558 +Ref: library/traceback traceback TracebackException msg13824755 +Ref: 445f13824755 +Ref: library/traceback traceback TracebackException from_exception13824839 +Ref: 446013824839 +Ref: library/traceback traceback TracebackException print13825222 +Ref: 6a013825222 +Ref: library/traceback traceback TracebackException format13825430 +Ref: 446113825430 +Ref: library/traceback traceback TracebackException format_exception_only13825881 +Ref: 26013825881 +Node: StackSummary Objects13826919 +Ref: library/traceback stacksummary-objects13827089 +Ref: 446213827089 +Ref: library/traceback traceback StackSummary13827256 +Ref: e7e13827256 +Ref: library/traceback traceback StackSummary extract13827291 +Ref: 445113827291 +Ref: library/traceback traceback StackSummary from_list13828283 +Ref: 446313828283 +Ref: library/traceback traceback StackSummary format13828587 +Ref: 446413828587 +Ref: library/traceback traceback StackSummary format_frame_summary13829219 +Ref: 69f13829219 +Node: FrameSummary Objects13829623 +Ref: library/traceback framesummary-objects13829811 +Ref: 446513829811 +Ref: library/traceback traceback FrameSummary13829999 +Ref: e7f13829999 +Ref: library/traceback traceback FrameSummary filename13830917 +Ref: 444813830917 +Ref: library/traceback traceback FrameSummary lineno13831120 +Ref: 444913831120 +Ref: library/traceback traceback FrameSummary name13831210 +Ref: 444a13831210 +Ref: library/traceback traceback FrameSummary line13831346 +Ref: 444b13831346 +Ref: library/traceback traceback FrameSummary end_lineno13831555 +Ref: 446613831555 +Ref: library/traceback traceback FrameSummary colno13831838 +Ref: 446713831838 +Ref: library/traceback traceback FrameSummary end_colno13831999 +Ref: 446813831999 +Node: Examples of Using the Module-Level Functions13832169 +Ref: library/traceback examples-of-using-the-module-level-functions13832373 +Ref: 446913832373 +Ref: library/traceback traceback-example13832373 +Ref: 446a13832373 +Node: Examples of Using TracebackException13837818 +Ref: library/traceback examples-of-using-tracebackexception13837993 +Ref: 446b13837993 +Node: __future__ — Future statement definitions13840649 +Ref: library/__future__ doc13840853 +Ref: 446c13840853 +Ref: library/__future__ future-future-statement-definitions13840853 +Ref: 446d13840853 +Ref: library/__future__ module-__future__13840853 +Ref: 013840853 +Ref: __future__ — Future statement definitions-Footnote-113842391 +Node: Module Contents<5>13842461 +Ref: library/__future__ module-contents13842559 +Ref: 446e13842559 +Ref: library/__future__ future__ nested_scopes13843213 +Ref: 446f13843213 +Ref: library/__future__ future__ generators13843614 +Ref: 447013843614 +Ref: library/__future__ future__ division13844008 +Ref: 447113844008 +Ref: library/__future__ future__ absolute_import13844415 +Ref: 447213844415 +Ref: library/__future__ future__ with_statement13844923 +Ref: 447313844923 +Ref: library/__future__ future__ print_function13845324 +Ref: 447413845324 +Ref: library/__future__ future__ unicode_literals13845723 +Ref: 447513845723 +Ref: library/__future__ future__ generator_stop13846130 +Ref: 447613846130 +Ref: library/__future__ future__ annotations13846547 +Ref: 447713846547 +Ref: library/__future__ future-classes13846861 +Ref: 447813846861 +Ref: library/__future__ future__ _Feature13846861 +Ref: 216513846861 +Ref: library/__future__ future__ _Feature getOptionalRelease13847508 +Ref: 447913847508 +Ref: library/__future__ future__ _Feature getMandatoryRelease13847642 +Ref: 447a13847642 +Ref: library/__future__ future__ _Feature compiler_flag13848230 +Ref: 1f4613848230 +Ref: Module Contents<5>-Footnote-113848815 +Ref: Module Contents<5>-Footnote-213848857 +Ref: Module Contents<5>-Footnote-313848899 +Ref: Module Contents<5>-Footnote-413848941 +Ref: Module Contents<5>-Footnote-513848983 +Ref: Module Contents<5>-Footnote-613849025 +Ref: Module Contents<5>-Footnote-713849067 +Ref: Module Contents<5>-Footnote-813849109 +Ref: Module Contents<5>-Footnote-913849151 +Ref: Module Contents<5>-Footnote-1013849737 +Ref: Module Contents<5>-Footnote-1113849780 +Node: gc — Garbage Collector interface13849823 +Ref: library/gc doc13850010 +Ref: 447b13850010 +Ref: library/gc gc-garbage-collector-interface13850010 +Ref: 447c13850010 +Ref: library/gc module-gc13850010 +Ref: 6013850010 +Ref: library/gc gc enable13850937 +Ref: 447d13850937 +Ref: library/gc gc disable13851008 +Ref: 447e13851008 +Ref: library/gc gc isenabled13851081 +Ref: 447f13851081 +Ref: library/gc gc collect13851172 +Ref: a3913851172 +Ref: library/gc gc set_debug13851945 +Ref: 448013851945 +Ref: library/gc gc get_debug13852212 +Ref: 448113852212 +Ref: library/gc gc get_objects13852291 +Ref: 7ff13852291 +Ref: library/gc gc get_stats13852714 +Ref: f3f13852714 +Ref: library/gc gc set_threshold13853411 +Ref: 448213853411 +Ref: library/gc gc get_count13854637 +Ref: 448313854637 +Ref: library/gc gc get_threshold13854762 +Ref: 448413854762 +Ref: library/gc gc get_referrers13854907 +Ref: 80013854907 +Ref: library/gc gc get_referents13855946 +Ref: 80113855946 +Ref: library/gc gc is_tracked13856679 +Ref: 130113856679 +Ref: library/gc gc is_finalized13857506 +Ref: 8fc13857506 +Ref: library/gc gc freeze13858018 +Ref: b3a13858018 +Ref: library/gc gc unfreeze13858857 +Ref: b3b13858857 +Ref: library/gc gc get_freeze_count13859018 +Ref: b3c13859018 +Ref: library/gc gc garbage13859263 +Ref: 11b313859263 +Ref: library/gc gc callbacks13860132 +Ref: 10bd13860132 +Ref: library/gc gc DEBUG_STATS13861467 +Ref: 448613861467 +Ref: library/gc gc DEBUG_COLLECTABLE13861610 +Ref: 448713861610 +Ref: library/gc gc DEBUG_UNCOLLECTABLE13861696 +Ref: 11b413861696 +Ref: library/gc gc DEBUG_SAVEALL13862077 +Ref: 448513862077 +Ref: library/gc gc DEBUG_LEAK13862269 +Ref: 448813862269 +Ref: gc — Garbage Collector interface-Footnote-113862513 +Ref: gc — Garbage Collector interface-Footnote-213862602 +Node: inspect — Inspect live objects13862644 +Ref: library/inspect doc13862829 +Ref: 448913862829 +Ref: library/inspect inspect-inspect-live-objects13862829 +Ref: 448a13862829 +Ref: library/inspect module-inspect13862918 +Ref: 7e13862918 +Ref: inspect — Inspect live objects-Footnote-113864111 +Node: Types and members13864178 +Ref: library/inspect inspect-types13864295 +Ref: 19a913864295 +Ref: library/inspect types-and-members13864295 +Ref: 448b13864295 +Ref: library/inspect inspect getmembers13881321 +Ref: 185413881321 +Ref: library/inspect inspect getmembers_static13881934 +Ref: 64513881934 +Ref: library/inspect inspect getmodulename13882673 +Ref: d3913882673 +Ref: library/inspect inspect ismodule13883350 +Ref: 448d13883350 +Ref: library/inspect inspect isclass13883442 +Ref: 448e13883442 +Ref: library/inspect inspect ismethod13883581 +Ref: 448f13883581 +Ref: library/inspect inspect isfunction13883697 +Ref: 449013883697 +Ref: library/inspect inspect isgeneratorfunction13883875 +Ref: 17d113883875 +Ref: library/inspect inspect isgenerator13884346 +Ref: 449113884346 +Ref: library/inspect inspect iscoroutinefunction13884444 +Ref: 2e813884444 +Ref: library/inspect inspect markcoroutinefunction13885294 +Ref: 48c13885294 +Ref: library/inspect inspect iscoroutine13885885 +Ref: e1513885885 +Ref: library/inspect inspect isawaitable13886073 +Ref: e1613886073 +Ref: library/inspect inspect isasyncgenfunction13886549 +Ref: 17d213886549 +Ref: library/inspect inspect isasyncgen13887244 +Ref: 449213887244 +Ref: library/inspect inspect istraceback13887474 +Ref: 449313887474 +Ref: library/inspect inspect isframe13887572 +Ref: 449413887572 +Ref: library/inspect inspect iscode13887662 +Ref: 449513887662 +Ref: library/inspect inspect isbuiltin13887750 +Ref: 449613887750 +Ref: library/inspect inspect ismethodwrapper13887886 +Ref: 64613887886 +Ref: library/inspect inspect isroutine13888191 +Ref: 15ec13888191 +Ref: library/inspect inspect isabstract13888326 +Ref: 449713888326 +Ref: library/inspect inspect ismethoddescriptor13888434 +Ref: 15eb13888434 +Ref: library/inspect inspect isdatadescriptor13889643 +Ref: 449813889643 +Ref: library/inspect inspect isgetsetdescriptor13890273 +Ref: 449913890273 +Ref: library/inspect inspect ismemberdescriptor13890624 +Ref: 449a13890624 +Node: Retrieving source code13890986 +Ref: library/inspect inspect-source13891161 +Ref: 449b13891161 +Ref: library/inspect retrieving-source-code13891161 +Ref: 449c13891161 +Ref: library/inspect inspect getdoc13891228 +Ref: 9f913891228 +Ref: library/inspect inspect getcomments13891736 +Ref: 15c713891736 +Ref: library/inspect inspect getfile13892160 +Ref: 1aa313892160 +Ref: library/inspect inspect getmodule13892394 +Ref: 17e313892394 +Ref: library/inspect inspect getsourcefile13892554 +Ref: 17e413892554 +Ref: library/inspect inspect getsourcelines13892855 +Ref: 449d13892855 +Ref: library/inspect inspect getsource13893571 +Ref: 15c613893571 +Ref: library/inspect inspect cleandoc13894123 +Ref: 16b513894123 +Node: Introspecting callables with the Signature object13894534 +Ref: library/inspect inspect-signature-object13894716 +Ref: 449e13894716 +Ref: library/inspect introspecting-callables-with-the-signature-object13894716 +Ref: 449f13894716 +Ref: library/inspect inspect signature13895047 +Ref: 73313895047 +Ref: library/inspect inspect Signature13897622 +Ref: 1cf13897622 +Ref: library/inspect inspect Signature empty13898737 +Ref: 44a213898737 +Ref: library/inspect inspect Signature parameters13898857 +Ref: 44a013898857 +Ref: library/inspect inspect Signature return_annotation13899352 +Ref: 44a313899352 +Ref: library/inspect inspect Signature bind13899571 +Ref: 156213899571 +Ref: library/inspect inspect Signature bind_partial13899849 +Ref: 44a413899849 +Ref: library/inspect inspect Signature replace13900226 +Ref: 44a113900226 +Ref: library/inspect inspect Signature format13901100 +Ref: 44a513901100 +Ref: library/inspect inspect Signature from_callable13901514 +Ref: 73513901514 +Ref: library/inspect inspect Parameter13902230 +Ref: 1d013902230 +Ref: library/inspect inspect Parameter empty13902642 +Ref: 44a713902642 +Ref: library/inspect inspect Parameter name13902773 +Ref: 44a813902773 +Ref: library/inspect inspect Parameter default13903241 +Ref: 44a913903241 +Ref: library/inspect inspect Parameter annotation13903432 +Ref: 44aa13903432 +Ref: library/inspect inspect Parameter kind13903620 +Ref: 44ab13903620 +Ref: library/inspect inspect Parameter kind description13906524 +Ref: 44ac13906524 +Ref: library/inspect inspect Parameter replace13907074 +Ref: 44a613907074 +Ref: library/inspect inspect BoundArguments13908208 +Ref: 106213908208 +Ref: library/inspect inspect BoundArguments arguments13908412 +Ref: 90b13908412 +Ref: library/inspect inspect BoundArguments args13909261 +Ref: 44ad13909261 +Ref: library/inspect inspect BoundArguments kwargs13909412 +Ref: 44ae13909412 +Ref: library/inspect inspect BoundArguments signature13909657 +Ref: 44af13909657 +Ref: library/inspect inspect BoundArguments apply_defaults13909755 +Ref: e1413909755 +Ref: Introspecting callables with the Signature object-Footnote-113910734 +Node: Classes and functions<2>13910776 +Ref: library/inspect classes-and-functions13910957 +Ref: 44b013910957 +Ref: library/inspect inspect-classes-functions13910957 +Ref: 44b113910957 +Ref: library/inspect inspect getclasstree13911022 +Ref: 44b213911022 +Ref: library/inspect inspect getfullargspec13911601 +Ref: 73413911601 +Ref: library/inspect inspect getargvalues13913969 +Ref: eb813913969 +Ref: library/inspect inspect formatargvalues13914474 +Ref: eb913914474 +Ref: library/inspect inspect getmro13914944 +Ref: 44b313914944 +Ref: library/inspect inspect getcallargs13915308 +Ref: eb713915308 +Ref: library/inspect inspect getclosurevars13916673 +Ref: 10cb13916673 +Ref: library/inspect inspect unwrap13917391 +Ref: f5713917391 +Ref: library/inspect inspect get_annotations13918127 +Ref: 80f13918127 +Node: The interpreter stack13921028 +Ref: library/inspect inspect-stack13921190 +Ref: 44b413921190 +Ref: library/inspect the-interpreter-stack13921190 +Ref: 44b513921190 +Ref: library/inspect inspect FrameInfo13921512 +Ref: 64813921512 +Ref: library/inspect inspect FrameInfo frame13921542 +Ref: 44b613921542 +Ref: library/inspect inspect FrameInfo filename13921641 +Ref: 44b713921641 +Ref: library/inspect inspect FrameInfo lineno13921787 +Ref: 44b813921787 +Ref: library/inspect inspect FrameInfo function13921953 +Ref: 44b913921953 +Ref: library/inspect inspect FrameInfo code_context13922086 +Ref: 44ba13922086 +Ref: library/inspect inspect FrameInfo index13922254 +Ref: 44bb13922254 +Ref: library/inspect inspect FrameInfo positions13922386 +Ref: 44bc13922386 +Ref: library/inspect inspect Traceback13922925 +Ref: 64913922925 +Ref: library/inspect inspect Traceback filename13922955 +Ref: 44be13922955 +Ref: library/inspect inspect Traceback lineno13923104 +Ref: 44bf13923104 +Ref: library/inspect inspect Traceback function13923273 +Ref: 44c013923273 +Ref: library/inspect inspect Traceback code_context13923409 +Ref: 44c113923409 +Ref: library/inspect inspect Traceback index13923580 +Ref: 44c213923580 +Ref: library/inspect inspect Traceback positions13923712 +Ref: 44c313923712 +Ref: library/inspect inspect getframeinfo13925643 +Ref: 64b13925643 +Ref: library/inspect inspect getouterframes13925910 +Ref: 64c13925910 +Ref: library/inspect inspect getinnerframes13926517 +Ref: 64d13926517 +Ref: library/inspect inspect currentframe13927120 +Ref: 6dd13927120 +Ref: library/inspect inspect stack13927521 +Ref: 64e13927521 +Ref: library/inspect inspect trace13928020 +Ref: 64f13928020 +Node: Fetching attributes statically13928608 +Ref: library/inspect fetching-attributes-statically13928812 +Ref: 44c413928812 +Ref: library/inspect inspect getattr_static13929394 +Ref: 49013929394 +Node: Current State of Generators Coroutines and Asynchronous Generators13931201 +Ref: library/inspect current-state-of-generators-coroutines-and-asynchronous-generators13931406 +Ref: 44c513931406 +Ref: library/inspect inspect getgeneratorstate13931888 +Ref: 122913931888 +Ref: library/inspect inspect getcoroutinestate13932283 +Ref: e1813932283 +Ref: library/inspect inspect getasyncgenstate13932899 +Ref: 48e13932899 +Ref: library/inspect inspect getgeneratorlocals13933771 +Ref: 10cc13933771 +Ref: library/inspect inspect getcoroutinelocals13934648 +Ref: e1713934648 +Ref: library/inspect inspect getasyncgenlocals13934886 +Ref: 48f13934886 +Node: Code Objects Bit Flags13935174 +Ref: library/inspect code-objects-bit-flags13935361 +Ref: 44c613935361 +Ref: library/inspect inspect-module-co-flags13935361 +Ref: 1f4513935361 +Ref: library/inspect inspect CO_OPTIMIZED13935531 +Ref: 44c713935531 +Ref: library/inspect inspect CO_NEWLOCALS13935618 +Ref: 44c813935618 +Ref: library/inspect inspect CO_VARARGS13935769 +Ref: 44c913935769 +Ref: library/inspect inspect CO_VARKEYWORDS13935877 +Ref: 44ca13935877 +Ref: library/inspect inspect CO_NESTED13935989 +Ref: 44cb13935989 +Ref: library/inspect inspect CO_GENERATOR13936083 +Ref: 44cc13936083 +Ref: library/inspect inspect CO_COROUTINE13936258 +Ref: 44cd13936258 +Ref: library/inspect inspect CO_ITERABLE_COROUTINE13936495 +Ref: 44ce13936495 +Ref: library/inspect inspect CO_ASYNC_GENERATOR13936810 +Ref: 44cf13936810 +Ref: Code Objects Bit Flags-Footnote-113937457 +Ref: Code Objects Bit Flags-Footnote-213937499 +Ref: Code Objects Bit Flags-Footnote-313937541 +Node: Buffer flags13937583 +Ref: library/inspect buffer-flags13937729 +Ref: 44d013937729 +Ref: library/inspect inspect BufferFlags13937776 +Ref: 45b13937776 +Ref: library/inspect inspect BufferFlags SIMPLE13938087 +Ref: 44d213938087 +Ref: library/inspect inspect BufferFlags WRITABLE13938115 +Ref: 44d313938115 +Ref: library/inspect inspect BufferFlags FORMAT13938145 +Ref: 44d413938145 +Ref: library/inspect inspect BufferFlags ND13938173 +Ref: 44d513938173 +Ref: library/inspect inspect BufferFlags STRIDES13938197 +Ref: 44d613938197 +Ref: library/inspect inspect BufferFlags C_CONTIGUOUS13938226 +Ref: 44d713938226 +Ref: library/inspect inspect BufferFlags F_CONTIGUOUS13938260 +Ref: 44d813938260 +Ref: library/inspect inspect BufferFlags ANY_CONTIGUOUS13938294 +Ref: 44d913938294 +Ref: library/inspect inspect BufferFlags INDIRECT13938330 +Ref: 44da13938330 +Ref: library/inspect inspect BufferFlags CONTIG13938360 +Ref: 44db13938360 +Ref: library/inspect inspect BufferFlags CONTIG_RO13938388 +Ref: 44dc13938388 +Ref: library/inspect inspect BufferFlags STRIDED13938419 +Ref: 44dd13938419 +Ref: library/inspect inspect BufferFlags STRIDED_RO13938448 +Ref: 44de13938448 +Ref: library/inspect inspect BufferFlags RECORDS13938480 +Ref: 44df13938480 +Ref: library/inspect inspect BufferFlags RECORDS_RO13938509 +Ref: 44e013938509 +Ref: library/inspect inspect BufferFlags FULL13938541 +Ref: 44e113938541 +Ref: library/inspect inspect BufferFlags FULL_RO13938567 +Ref: 44e213938567 +Ref: library/inspect inspect BufferFlags READ13938596 +Ref: 15b713938596 +Ref: library/inspect inspect BufferFlags WRITE13938622 +Ref: 15b813938622 +Node: Command Line Interface<3>13938678 +Ref: library/inspect command-line-interface13938793 +Ref: 44e313938793 +Ref: library/inspect inspect-module-cli13938793 +Ref: f5613938793 +Ref: library/inspect cmdoption-inspect-details13939170 +Ref: 44e413939170 +Node: site — Site-specific configuration hook13939277 +Ref: library/site doc13939419 +Ref: 44e513939419 +Ref: library/site module-site13939419 +Ref: c713939419 +Ref: library/site site-site-specific-configuration-hook13939419 +Ref: 44e613939419 +Ref: site — Site-specific configuration hook-Footnote-113944376 +Node: sitecustomize13944440 +Ref: library/site module-sitecustomize13944553 +Ref: c813944553 +Ref: library/site sitecustomize13944553 +Ref: 44e713944553 +Node: usercustomize13945319 +Ref: library/site module-usercustomize13945463 +Ref: 10e13945463 +Ref: library/site usercustomize13945463 +Ref: 44e813945463 +Node: Readline configuration13946273 +Ref: library/site readline-configuration13946422 +Ref: 44ea13946422 +Ref: library/site rlcompleter-config13946422 +Ref: fc413946422 +Node: Module contents<5>13947091 +Ref: library/site module-contents13947252 +Ref: 44eb13947252 +Ref: library/site site PREFIXES13947305 +Ref: 44ec13947305 +Ref: library/site site ENABLE_USER_SITE13947386 +Ref: 44e913947386 +Ref: library/site site USER_SITE13947824 +Ref: 1d3513947824 +Ref: library/site site USER_BASE13948441 +Ref: 130f13948441 +Ref: library/site site main13949001 +Ref: 1d3613949001 +Ref: library/site site addsitedir13949351 +Ref: 1e6913949351 +Ref: library/site site getsitepackages13949573 +Ref: 123113949573 +Ref: library/site site getuserbase13949709 +Ref: 123213949709 +Ref: library/site site getusersitepackages13949956 +Ref: 123313949956 +Node: Command Line Interface<4>13950358 +Ref: library/site command-line-interface13950488 +Ref: 44ed13950488 +Ref: library/site site-commandline13950488 +Ref: 44ee13950488 +Ref: library/site cmdoption-site-user-base13951036 +Ref: 44ef13951036 +Ref: library/site cmdoption-site-user-site13951110 +Ref: 44f013951110 +Ref: Command Line Interface<4>-Footnote-113951844 +Node: Custom Python Interpreters13951886 +Ref: library/custominterp doc13952034 +Ref: 44f113952034 +Ref: library/custominterp custom-python-interpreters13952034 +Ref: 44f213952034 +Ref: library/custominterp custominterp13952034 +Ref: 44f313952034 +Node: code — Interpreter base classes13952619 +Ref: library/code doc13952754 +Ref: 44f413952754 +Ref: library/code code-interpreter-base-classes13952754 +Ref: 44f513952754 +Ref: library/code module-code13952754 +Ref: 1a13952754 +Ref: library/code code InteractiveInterpreter13953172 +Ref: 15da13953172 +Ref: library/code code InteractiveConsole13953950 +Ref: 239c13953950 +Ref: library/code code interact13954508 +Ref: 16d513954508 +Ref: library/code code compile_command13955445 +Ref: 44f813955445 +Ref: code — Interpreter base classes-Footnote-113956731 +Node: Interactive Interpreter Objects13956795 +Ref: library/code interactive-interpreter-objects13956932 +Ref: 44f913956932 +Ref: library/code interpreter-objects13956932 +Ref: 44fa13956932 +Ref: library/code code InteractiveInterpreter runsource13957015 +Ref: 44fb13957015 +Ref: library/code code InteractiveInterpreter runcode13958302 +Ref: 44fd13958302 +Ref: library/code code InteractiveInterpreter showsyntaxerror13958761 +Ref: 44fc13958761 +Ref: library/code code InteractiveInterpreter showtraceback13959235 +Ref: dcf13959235 +Ref: library/code code InteractiveInterpreter write13959616 +Ref: 44fe13959616 +Node: Interactive Console Objects13959836 +Ref: library/code console-objects13959973 +Ref: 44ff13959973 +Ref: library/code interactive-console-objects13959973 +Ref: 450013959973 +Ref: library/code code InteractiveConsole interact13960237 +Ref: 44f713960237 +Ref: library/code code InteractiveConsole push13961090 +Ref: 450113961090 +Ref: library/code code InteractiveConsole resetbuffer13961798 +Ref: 450213961798 +Ref: library/code code InteractiveConsole raw_input13961907 +Ref: 44f613961907 +Node: codeop — Compile Python code13962268 +Ref: library/codeop doc13962403 +Ref: 450313962403 +Ref: library/codeop codeop-compile-python-code13962403 +Ref: 450413962403 +Ref: library/codeop module-codeop13962403 +Ref: 1c13962403 +Ref: library/codeop codeop compile_command13963364 +Ref: 17c813963364 +Ref: library/codeop codeop Compile13964783 +Ref: 450513964783 +Ref: library/codeop codeop CommandCompiler13965183 +Ref: 450613965183 +Ref: codeop — Compile Python code-Footnote-113965604 +Node: Importing Modules13965670 +Ref: library/modules doc13965819 +Ref: 450713965819 +Ref: library/modules importing-modules13965819 +Ref: 450813965819 +Ref: library/modules modules13965819 +Ref: 450913965819 +Node: zipimport — Import modules from Zip archives13966797 +Ref: library/zipimport doc13966943 +Ref: 450a13966943 +Ref: library/zipimport module-zipimport13966943 +Ref: 13213966943 +Ref: library/zipimport zipimport-import-modules-from-zip-archives13966943 +Ref: 450b13966943 +Ref: library/zipimport zipimport ZipImportError13969146 +Ref: 450c13969146 +Ref: zipimport — Import modules from Zip archives-Footnote-113969438 +Ref: zipimport — Import modules from Zip archives-Footnote-213969507 +Ref: zipimport — Import modules from Zip archives-Footnote-313969575 +Ref: zipimport — Import modules from Zip archives-Footnote-413969617 +Ref: zipimport — Import modules from Zip archives-Footnote-513969659 +Node: zipimporter Objects13969701 +Ref: library/zipimport id113969824 +Ref: 450d13969824 +Ref: library/zipimport zipimporter-objects13969824 +Ref: 450e13969824 +Ref: library/zipimport zipimport zipimporter13969947 +Ref: 450f13969947 +Ref: library/zipimport zipimport zipimporter create_module13970586 +Ref: 85b13970586 +Ref: library/zipimport zipimport zipimporter exec_module13970832 +Ref: 30c13970832 +Ref: library/zipimport zipimport zipimporter find_spec13970991 +Ref: 85a13970991 +Ref: library/zipimport zipimport zipimporter get_code13971173 +Ref: 451013971173 +Ref: library/zipimport zipimport zipimporter get_data13971354 +Ref: 451113971354 +Ref: library/zipimport zipimport zipimporter get_filename13971639 +Ref: 451213971639 +Ref: library/zipimport zipimport zipimporter get_source13971904 +Ref: 451313971904 +Ref: library/zipimport zipimport zipimporter is_package13972194 +Ref: 451413972194 +Ref: library/zipimport zipimport zipimporter load_module13972405 +Ref: 30b13972405 +Ref: library/zipimport zipimport zipimporter invalidate_caches13972769 +Ref: 85c13972769 +Ref: library/zipimport zipimport zipimporter archive13972949 +Ref: 451513972949 +Ref: library/zipimport zipimport zipimporter prefix13973082 +Ref: 451613973082 +Node: Examples<33>13973489 +Ref: library/zipimport examples13973612 +Ref: 451713973612 +Ref: library/zipimport zipimport-examples13973612 +Ref: 451813973612 +Node: pkgutil — Package extension utility13974292 +Ref: library/pkgutil doc13974493 +Ref: 451913974493 +Ref: library/pkgutil module-pkgutil13974493 +Ref: a913974493 +Ref: library/pkgutil pkgutil-package-extension-utility13974493 +Ref: 451a13974493 +Ref: library/pkgutil pkgutil ModuleInfo13974778 +Ref: d4b13974778 +Ref: library/pkgutil pkgutil extend_path13974934 +Ref: 15e613974934 +Ref: library/pkgutil pkgutil find_loader13976668 +Ref: 2ce13976668 +Ref: library/pkgutil pkgutil get_importer13977398 +Ref: 451b13977398 +Ref: library/pkgutil pkgutil get_loader13977914 +Ref: 2cf13977914 +Ref: library/pkgutil pkgutil iter_importers13978756 +Ref: 118c13978756 +Ref: library/pkgutil pkgutil iter_modules13979485 +Ref: d4a13979485 +Ref: library/pkgutil pkgutil walk_packages13980336 +Ref: bff13980336 +Ref: library/pkgutil pkgutil get_data13981914 +Ref: 451c13981914 +Ref: library/pkgutil pkgutil resolve_name13983048 +Ref: 451e13983048 +Ref: pkgutil — Package extension utility-Footnote-113984916 +Ref: pkgutil — Package extension utility-Footnote-213984983 +Ref: pkgutil — Package extension utility-Footnote-313985025 +Ref: pkgutil — Package extension utility-Footnote-413985067 +Ref: pkgutil — Package extension utility-Footnote-513985109 +Ref: pkgutil — Package extension utility-Footnote-613985151 +Ref: pkgutil — Package extension utility-Footnote-713985193 +Ref: pkgutil — Package extension utility-Footnote-813985235 +Ref: pkgutil — Package extension utility-Footnote-913985277 +Ref: pkgutil — Package extension utility-Footnote-1013985319 +Node: modulefinder — Find modules used by a script13985385 +Ref: library/modulefinder doc13985587 +Ref: 451f13985587 +Ref: library/modulefinder module-modulefinder13985587 +Ref: 9113985587 +Ref: library/modulefinder modulefinder-find-modules-used-by-a-script13985587 +Ref: 452013985587 +Ref: library/modulefinder modulefinder AddPackagePath13986106 +Ref: 452113986106 +Ref: library/modulefinder modulefinder ReplacePackage13986256 +Ref: 452213986256 +Ref: library/modulefinder modulefinder ModuleFinder13986419 +Ref: 1a0213986419 +Ref: library/modulefinder modulefinder ModuleFinder report13987078 +Ref: 452413987078 +Ref: library/modulefinder modulefinder ModuleFinder run_script13987293 +Ref: 452313987293 +Ref: library/modulefinder modulefinder ModuleFinder modules13987431 +Ref: 452513987431 +Ref: modulefinder — Find modules used by a script-Footnote-113987655 +Node: Example usage of ModuleFinder13987727 +Ref: library/modulefinder example-usage-of-modulefinder13987839 +Ref: 452713987839 +Ref: library/modulefinder modulefinder-example13987839 +Ref: 452613987839 +Node: runpy — Locating and executing Python modules13989212 +Ref: library/runpy doc13989419 +Ref: 452813989419 +Ref: library/runpy module-runpy13989419 +Ref: be13989419 +Ref: library/runpy runpy-locating-and-executing-python-modules13989419 +Ref: 452913989419 +Ref: library/runpy runpy run_module13990454 +Ref: 180b13990454 +Ref: library/runpy runpy run_path13993881 +Ref: 18113993881 +Ref: runpy — Locating and executing Python modules-Footnote-113998326 +Ref: runpy — Locating and executing Python modules-Footnote-213998391 +Ref: runpy — Locating and executing Python modules-Footnote-313998433 +Ref: runpy — Locating and executing Python modules-Footnote-413998475 +Ref: runpy — Locating and executing Python modules-Footnote-513998517 +Ref: runpy — Locating and executing Python modules-Footnote-613998559 +Ref: runpy — Locating and executing Python modules-Footnote-713998601 +Ref: runpy — Locating and executing Python modules-Footnote-813998643 +Node: importlib — The implementation of import13998685 +Ref: library/importlib doc13998913 +Ref: 452a13998913 +Ref: library/importlib importlib-the-implementation-of-import13998913 +Ref: 452b13998913 +Ref: library/importlib module-importlib13998913 +Ref: 7713998913 +Ref: importlib — The implementation of import-Footnote-113999616 +Node: Introduction<12>13999695 +Ref: library/importlib introduction13999812 +Ref: 452c13999812 +Ref: Introduction<12>-Footnote-114002101 +Ref: Introduction<12>-Footnote-214002153 +Ref: Introduction<12>-Footnote-314002195 +Ref: Introduction<12>-Footnote-414002237 +Ref: Introduction<12>-Footnote-514002279 +Ref: Introduction<12>-Footnote-614002321 +Ref: Introduction<12>-Footnote-714002363 +Ref: Introduction<12>-Footnote-814002405 +Ref: Introduction<12>-Footnote-914002447 +Ref: Introduction<12>-Footnote-1014002489 +Ref: Introduction<12>-Footnote-1114002532 +Ref: Introduction<12>-Footnote-1214002575 +Ref: Introduction<12>-Footnote-1314002618 +Node: Functions<12>14002661 +Ref: library/importlib functions14002844 +Ref: 452d14002844 +Ref: library/importlib importlib __import__14002883 +Ref: 106614002883 +Ref: library/importlib importlib import_module14003191 +Ref: 51314003191 +Ref: library/importlib importlib invalidate_caches14004522 +Ref: c1014004522 +Ref: library/importlib importlib reload14005155 +Ref: 51414005155 +Node: importlib abc – Abstract base classes related to import14008678 +Ref: library/importlib importlib-abc-abstract-base-classes-related-to-import14008893 +Ref: 452e14008893 +Ref: library/importlib module-importlib abc14008893 +Ref: 7814008893 +Ref: library/importlib importlib abc MetaPathFinder14009686 +Ref: 86b14009686 +Ref: library/importlib importlib abc MetaPathFinder find_spec14009898 +Ref: 86514009898 +Ref: library/importlib importlib abc MetaPathFinder invalidate_caches14010643 +Ref: 452f14010643 +Ref: library/importlib importlib abc PathEntryFinder14011057 +Ref: 86c14011057 +Ref: library/importlib importlib abc PathEntryFinder find_spec14011495 +Ref: 86914011495 +Ref: library/importlib importlib abc PathEntryFinder invalidate_caches14012134 +Ref: 453014012134 +Ref: library/importlib importlib abc Loader14012434 +Ref: ec014012434 +Ref: library/importlib importlib abc Loader create_module14012861 +Ref: cae14012861 +Ref: library/importlib importlib abc Loader exec_module14013263 +Ref: 86714013263 +Ref: library/importlib importlib abc Loader load_module14013740 +Ref: 86614013740 +Ref: library/importlib importlib abc ResourceLoader14015796 +Ref: be714015796 +Ref: library/importlib importlib abc ResourceLoader get_data14016259 +Ref: 451d14016259 +Ref: library/importlib importlib abc InspectLoader14017073 +Ref: f4f14017073 +Ref: library/importlib importlib abc InspectLoader get_code14017257 +Ref: f5014017257 +Ref: library/importlib importlib abc InspectLoader get_source14017840 +Ref: f5314017840 +Ref: library/importlib importlib abc InspectLoader is_package14018477 +Ref: 453214018477 +Ref: library/importlib importlib abc InspectLoader source_to_code14018848 +Ref: e1014018848 +Ref: library/importlib importlib abc InspectLoader exec_module14019494 +Ref: 100b14019494 +Ref: library/importlib importlib abc InspectLoader load_module14019628 +Ref: 453314019628 +Ref: library/importlib importlib abc ExecutionLoader14019855 +Ref: 453414019855 +Ref: library/importlib importlib abc ExecutionLoader get_filename14020102 +Ref: 453514020102 +Ref: library/importlib importlib abc FileLoader14020689 +Ref: 106c14020689 +Ref: library/importlib importlib abc FileLoader name14021185 +Ref: 453614021185 +Ref: library/importlib importlib abc FileLoader path14021268 +Ref: 453714021268 +Ref: library/importlib importlib abc FileLoader load_module14021337 +Ref: 453814021337 +Ref: library/importlib importlib abc FileLoader get_filename14021556 +Ref: 453914021556 +Ref: library/importlib importlib abc FileLoader get_data14021650 +Ref: 453a14021650 +Ref: library/importlib importlib abc SourceLoader14021771 +Ref: 453b14021771 +Ref: library/importlib importlib abc SourceLoader path_stats14022868 +Ref: 117e14022868 +Ref: library/importlib importlib abc SourceLoader path_mtime14023648 +Ref: 117d14023648 +Ref: library/importlib importlib abc SourceLoader set_data14024197 +Ref: 453c14024197 +Ref: library/importlib importlib abc SourceLoader get_code14024712 +Ref: 453d14024712 +Ref: library/importlib importlib abc SourceLoader exec_module14024835 +Ref: 100c14024835 +Ref: library/importlib importlib abc SourceLoader load_module14024978 +Ref: 453e14024978 +Ref: library/importlib importlib abc SourceLoader get_source14025214 +Ref: 101a14025214 +Ref: library/importlib importlib abc SourceLoader is_package14025341 +Ref: 453f14025341 +Ref: library/importlib importlib abc ResourceReader14025744 +Ref: afd14025744 +Ref: library/importlib importlib abc ResourceReader open_resource14027593 +Ref: 454014027593 +Ref: library/importlib importlib abc ResourceReader resource_path14027874 +Ref: 454114027874 +Ref: library/importlib importlib abc ResourceReader is_resource14028125 +Ref: 454214028125 +Ref: library/importlib importlib abc ResourceReader contents14028355 +Ref: 1a4314028355 +Ref: library/importlib importlib abc Traversable14029290 +Ref: 188414029290 +Ref: library/importlib importlib abc Traversable name14029730 +Ref: 454314029730 +Ref: library/importlib importlib abc Traversable iterdir14029848 +Ref: 454414029848 +Ref: library/importlib importlib abc Traversable is_dir14029950 +Ref: 454514029950 +Ref: library/importlib importlib abc Traversable is_file14030052 +Ref: 454614030052 +Ref: library/importlib importlib abc Traversable joinpath14030150 +Ref: 454714030150 +Ref: library/importlib importlib abc Traversable __truediv__14030251 +Ref: 454814030251 +Ref: library/importlib importlib abc Traversable open14030361 +Ref: 454914030361 +Ref: library/importlib importlib abc Traversable read_bytes14030725 +Ref: 454a14030725 +Ref: library/importlib importlib abc Traversable read_text14030806 +Ref: 454b14030806 +Ref: library/importlib importlib abc TraversableResources14030898 +Ref: 188214030898 +Ref: library/importlib importlib abc TraversableResources files14031669 +Ref: 454c14031669 +Ref: importlib abc – Abstract base classes related to import-Footnote-114031857 +Ref: importlib abc – Abstract base classes related to import-Footnote-214031930 +Ref: importlib abc – Abstract base classes related to import-Footnote-314031972 +Ref: importlib abc – Abstract base classes related to import-Footnote-414032014 +Ref: importlib abc – Abstract base classes related to import-Footnote-514032056 +Node: importlib machinery – Importers and path hooks14032098 +Ref: library/importlib importlib-machinery-importers-and-path-hooks14032345 +Ref: 454d14032345 +Ref: library/importlib module-importlib machinery14032345 +Ref: 7914032345 +Ref: library/importlib importlib machinery SOURCE_SUFFIXES14032676 +Ref: 50f14032676 +Ref: library/importlib importlib machinery DEBUG_BYTECODE_SUFFIXES14032842 +Ref: 454e14032842 +Ref: library/importlib importlib machinery OPTIMIZED_BYTECODE_SUFFIXES14033105 +Ref: 454f14033105 +Ref: library/importlib importlib machinery BYTECODE_SUFFIXES14033368 +Ref: 51114033368 +Ref: library/importlib importlib machinery EXTENSION_SUFFIXES14033654 +Ref: 51014033654 +Ref: library/importlib importlib machinery all_suffixes14033826 +Ref: 448c14033826 +Ref: library/importlib importlib machinery BuiltinImporter14034262 +Ref: caf14034262 +Ref: library/importlib importlib machinery FrozenImporter14034827 +Ref: 101814034827 +Ref: library/importlib importlib machinery WindowsRegistryFinder14035247 +Ref: d2a14035247 +Ref: library/importlib importlib machinery PathFinder14035735 +Ref: 101c14035735 +Ref: library/importlib importlib machinery PathFinder find_spec14036050 +Ref: 100a14036050 +Ref: library/importlib importlib machinery PathFinder invalidate_caches14037231 +Ref: c0f14037231 +Ref: library/importlib importlib machinery FileFinder14037844 +Ref: 106b14037844 +Ref: library/importlib importlib machinery FileFinder path14039151 +Ref: 455014039151 +Ref: library/importlib importlib machinery FileFinder find_spec14039224 +Ref: ebf14039224 +Ref: library/importlib importlib machinery FileFinder invalidate_caches14039401 +Ref: 455114039401 +Ref: library/importlib importlib machinery FileFinder path_hook14039481 +Ref: 455214039481 +Ref: library/importlib importlib machinery SourceFileLoader14039929 +Ref: 106d14039929 +Ref: library/importlib importlib machinery SourceFileLoader name14040223 +Ref: 455314040223 +Ref: library/importlib importlib machinery SourceFileLoader path14040313 +Ref: 455414040313 +Ref: library/importlib importlib machinery SourceFileLoader is_package14040379 +Ref: 455514040379 +Ref: library/importlib importlib machinery SourceFileLoader path_stats14040508 +Ref: 455614040508 +Ref: library/importlib importlib machinery SourceFileLoader set_data14040645 +Ref: 455714040645 +Ref: library/importlib importlib machinery SourceFileLoader load_module14040784 +Ref: d2814040784 +Ref: library/importlib importlib machinery SourcelessFileLoader14041136 +Ref: 106e14041136 +Ref: library/importlib importlib machinery SourcelessFileLoader name14041610 +Ref: 455814041610 +Ref: library/importlib importlib machinery SourcelessFileLoader path14041694 +Ref: 455914041694 +Ref: library/importlib importlib machinery SourcelessFileLoader is_package14041762 +Ref: 455a14041762 +Ref: library/importlib importlib machinery SourcelessFileLoader get_code14041888 +Ref: 455b14041888 +Ref: library/importlib importlib machinery SourcelessFileLoader get_source14042024 +Ref: 455c14042024 +Ref: library/importlib importlib machinery SourcelessFileLoader load_module14042163 +Ref: d2914042163 +Ref: library/importlib importlib machinery ExtensionFileLoader14042490 +Ref: cb014042490 +Ref: library/importlib importlib machinery ExtensionFileLoader name14043163 +Ref: 455d14043163 +Ref: library/importlib importlib machinery ExtensionFileLoader path14043240 +Ref: 455e14043240 +Ref: library/importlib importlib machinery ExtensionFileLoader create_module14043307 +Ref: 455f14043307 +Ref: library/importlib importlib machinery ExtensionFileLoader exec_module14043486 +Ref: 456014043486 +Ref: library/importlib importlib machinery ExtensionFileLoader is_package14043646 +Ref: 456114043646 +Ref: library/importlib importlib machinery ExtensionFileLoader get_code14043829 +Ref: 456214043829 +Ref: library/importlib importlib machinery ExtensionFileLoader get_source14043938 +Ref: 456314043938 +Ref: library/importlib importlib machinery ExtensionFileLoader get_filename14044054 +Ref: f5414044054 +Ref: library/importlib importlib machinery NamespaceLoader14044166 +Ref: f5114044166 +Ref: library/importlib importlib machinery ModuleSpec14044818 +Ref: 1e6414044818 +Ref: library/importlib importlib machinery ModuleSpec name14045619 +Ref: 1f1814045619 +Ref: library/importlib importlib machinery ModuleSpec loader14045829 +Ref: 2e714045829 +Ref: library/importlib importlib machinery ModuleSpec origin14046032 +Ref: 456414046032 +Ref: library/importlib importlib machinery ModuleSpec submodule_search_locations14046534 +Ref: 1f1c14046534 +Ref: library/importlib importlib machinery ModuleSpec loader_state14047184 +Ref: 456514047184 +Ref: library/importlib importlib machinery ModuleSpec cached14047428 +Ref: 2da14047428 +Ref: library/importlib importlib machinery ModuleSpec parent14047726 +Ref: 2dc14047726 +Ref: library/importlib importlib machinery ModuleSpec has_location14048017 +Ref: 456614048017 +Ref: library/importlib importlib machinery AppleFrameworkLoader14048304 +Ref: 1e6314048304 +Ref: library/importlib importlib machinery AppleFrameworkLoader name14051605 +Ref: 456714051605 +Ref: library/importlib importlib machinery AppleFrameworkLoader path14051682 +Ref: 456814051682 +Ref: importlib machinery – Importers and path hooks-Footnote-114051811 +Ref: importlib machinery – Importers and path hooks-Footnote-214051891 +Ref: importlib machinery – Importers and path hooks-Footnote-314051933 +Ref: importlib machinery – Importers and path hooks-Footnote-414051975 +Ref: importlib machinery – Importers and path hooks-Footnote-514052017 +Node: importlib util – Utility code for importers14052059 +Ref: library/importlib importlib-util-utility-code-for-importers14052261 +Ref: 456914052261 +Ref: library/importlib module-importlib util14052261 +Ref: 7d14052261 +Ref: library/importlib importlib util MAGIC_NUMBER14052587 +Ref: 50e14052587 +Ref: library/importlib importlib util cache_from_source14052827 +Ref: 2f814052827 +Ref: library/importlib importlib util source_from_cache14054738 +Ref: 51514054738 +Ref: library/importlib importlib util decode_source14055365 +Ref: f5214055365 +Ref: library/importlib importlib util resolve_name14055637 +Ref: 90914055637 +Ref: library/importlib importlib util find_spec14056539 +Ref: 2d014056539 +Ref: library/importlib importlib util module_from_spec14057434 +Ref: e1114057434 +Ref: library/importlib importlib util spec_from_loader14058069 +Ref: 86a14058069 +Ref: library/importlib importlib util spec_from_file_location14058524 +Ref: cb114058524 +Ref: library/importlib importlib util source_hash14059007 +Ref: 456a14059007 +Ref: library/importlib importlib util _incompatible_extension_module_restrictions14059281 +Ref: 456b14059281 +Ref: library/importlib importlib util LazyLoader14060400 +Ref: cad14060400 +Ref: library/importlib importlib util LazyLoader factory14061884 +Ref: 456c14061884 +Ref: importlib util – Utility code for importers-Footnote-114062447 +Ref: importlib util – Utility code for importers-Footnote-214062521 +Ref: importlib util – Utility code for importers-Footnote-314062563 +Ref: importlib util – Utility code for importers-Footnote-414062605 +Ref: importlib util – Utility code for importers-Footnote-514062647 +Ref: importlib util – Utility code for importers-Footnote-614062689 +Ref: importlib util – Utility code for importers-Footnote-714062731 +Node: Examples<34>14062773 +Ref: library/importlib examples14062918 +Ref: 456d14062918 +Ref: library/importlib importlib-examples14062918 +Ref: 456e14062918 +Node: Importing programmatically14063213 +Ref: library/importlib importing-programmatically14063333 +Ref: 456f14063333 +Node: Checking if a module can be imported14063564 +Ref: library/importlib checking-if-a-module-can-be-imported14063725 +Ref: 457014063725 +Node: Importing a source file directly14064638 +Ref: library/importlib importing-a-source-file-directly14064798 +Ref: 457114064798 +Node: Implementing lazy imports14065966 +Ref: library/importlib implementing-lazy-imports14066112 +Ref: 457214066112 +Node: Setting up an importer14066831 +Ref: library/importlib setting-up-an-importer14066982 +Ref: 457314066982 +Node: Approximating importlib import_module14068559 +Ref: library/importlib approximating-importlib-import-module14068676 +Ref: 457414068676 +Node: importlib resources – Package resource reading opening and access14070176 +Ref: library/importlib resources doc14070420 +Ref: 457514070420 +Ref: library/importlib resources importlib-resources-package-resource-reading-opening-and-access14070420 +Ref: 457614070420 +Ref: library/importlib resources module-importlib resources14070420 +Ref: 7b14070420 +Ref: library/importlib resources importlib resources Anchor14072455 +Ref: 457714072455 +Ref: library/importlib resources importlib resources files14072653 +Ref: 48a14072653 +Ref: library/importlib resources importlib resources as_file14073694 +Ref: 48914073694 +Ref: importlib resources – Package resource reading opening and access-Footnote-114074533 +Ref: importlib resources – Package resource reading opening and access-Footnote-214074622 +Ref: importlib resources – Package resource reading opening and access-Footnote-314074693 +Ref: importlib resources – Package resource reading opening and access-Footnote-414074787 +Ref: importlib resources – Package resource reading opening and access-Footnote-514074859 +Node: Functional API14074936 +Ref: library/importlib resources functional-api14075054 +Ref: 457814075054 +Ref: library/importlib resources importlib-resources-functional14075054 +Ref: 457914075054 +Ref: library/importlib resources importlib resources open_binary14076296 +Ref: 1ef14076296 +Ref: library/importlib resources importlib resources open_text14076781 +Ref: 1f014076781 +Ref: library/importlib resources importlib resources read_binary14077726 +Ref: 1f214077726 +Ref: library/importlib resources importlib resources read_text14078138 +Ref: 1f314078138 +Ref: library/importlib resources importlib resources path14079007 +Ref: 1f114079007 +Ref: library/importlib resources importlib resources is_resource14079995 +Ref: 1ee14079995 +Ref: library/importlib resources importlib resources contents14080464 +Ref: 1f414080464 +Node: importlib resources abc – Abstract base classes for resources14081167 +Ref: library/importlib resources abc doc14081418 +Ref: 457a14081418 +Ref: library/importlib resources abc importlib-resources-abc-abstract-base-classes-for-resources14081418 +Ref: 457b14081418 +Ref: library/importlib resources abc module-importlib resources abc14081418 +Ref: 7c14081418 +Ref: library/importlib resources abc importlib resources abc ResourceReader14081709 +Ref: 453114081709 +Ref: library/importlib resources abc importlib resources abc ResourceReader open_resource14083507 +Ref: 457c14083507 +Ref: library/importlib resources abc importlib resources abc ResourceReader resource_path14083768 +Ref: 457d14083768 +Ref: library/importlib resources abc importlib resources abc ResourceReader is_resource14084004 +Ref: 457e14084004 +Ref: library/importlib resources abc importlib resources abc ResourceReader contents14084218 +Ref: 457f14084218 +Ref: library/importlib resources abc importlib resources abc Traversable14085087 +Ref: 1f514085087 +Ref: library/importlib resources abc importlib resources abc Traversable name14085373 +Ref: 458014085373 +Ref: library/importlib resources abc importlib resources abc Traversable iterdir14085491 +Ref: 458114085491 +Ref: library/importlib resources abc importlib resources abc Traversable is_dir14085581 +Ref: 458214085581 +Ref: library/importlib resources abc importlib resources abc Traversable is_file14085677 +Ref: 458314085677 +Ref: library/importlib resources abc importlib resources abc Traversable joinpath14085769 +Ref: 458414085769 +Ref: library/importlib resources abc importlib resources abc Traversable __truediv__14086883 +Ref: 458514086883 +Ref: library/importlib resources abc importlib resources abc Traversable open14087029 +Ref: 458614087029 +Ref: library/importlib resources abc importlib resources abc Traversable read_bytes14087393 +Ref: 458714087393 +Ref: library/importlib resources abc importlib resources abc Traversable read_text14087468 +Ref: 458814087468 +Ref: library/importlib resources abc importlib resources abc TraversableResources14087554 +Ref: 2c814087554 +Ref: library/importlib resources abc importlib resources abc TraversableResources files14088078 +Ref: 458914088078 +Ref: importlib resources abc – Abstract base classes for resources-Footnote-114088266 +Node: importlib metadata – Accessing package metadata14088350 +Ref: library/importlib metadata doc14088587 +Ref: 458a14088587 +Ref: library/importlib metadata importlib-metadata-accessing-package-metadata14088587 +Ref: 458b14088587 +Ref: library/importlib metadata module-importlib metadata14088587 +Ref: 7a14088587 +Ref: library/importlib metadata using14088587 +Ref: 458c14088587 +Ref: importlib metadata – Accessing package metadata-Footnote-114090884 +Ref: importlib metadata – Accessing package metadata-Footnote-214090972 +Ref: importlib metadata – Accessing package metadata-Footnote-314091056 +Ref: importlib metadata – Accessing package metadata-Footnote-414091134 +Ref: importlib metadata – Accessing package metadata-Footnote-514091219 +Ref: importlib metadata – Accessing package metadata-Footnote-614091304 +Ref: importlib metadata – Accessing package metadata-Footnote-714091342 +Ref: importlib metadata – Accessing package metadata-Footnote-814091434 +Ref: importlib metadata – Accessing package metadata-Footnote-914091503 +Node: Overview<3>14091579 +Ref: library/importlib metadata overview14091702 +Ref: 458d14091702 +Ref: library/importlib metadata importlib metadata PackageNotFoundError14093221 +Ref: 459214093221 +Ref: Overview<3>-Footnote-114093514 +Node: Functional API<2>14093598 +Ref: library/importlib metadata functional-api14093743 +Ref: 459314093743 +Node: Entry points14094039 +Ref: library/importlib metadata entry-points14094135 +Ref: 28614094135 +Ref: library/importlib metadata id214094135 +Ref: 459414094135 +Ref: library/importlib metadata importlib metadata entry_points14094180 +Ref: 459514094180 +Ref: library/importlib metadata importlib metadata EntryPoints14094752 +Ref: 459614094752 +Ref: library/importlib metadata importlib metadata EntryPoint14095032 +Ref: 459714095032 +Ref: Entry points-Footnote-114097808 +Ref: Entry points-Footnote-214097880 +Node: Distribution metadata14097948 +Ref: library/importlib metadata distribution-metadata14098074 +Ref: 459814098074 +Ref: library/importlib metadata metadata14098074 +Ref: 458e14098074 +Ref: library/importlib metadata importlib metadata metadata14098137 +Ref: 459914098137 +Ref: library/importlib metadata importlib metadata PackageMetadata14098474 +Ref: 459a14098474 +Ref: Distribution metadata-Footnote-114099743 +Ref: Distribution metadata-Footnote-214099848 +Ref: Distribution metadata-Footnote-314099932 +Ref: Distribution metadata-Footnote-414099974 +Node: Distribution versions14100066 +Ref: library/importlib metadata distribution-versions14100198 +Ref: 459b14100198 +Ref: library/importlib metadata version14100198 +Ref: 458f14100198 +Ref: library/importlib metadata importlib metadata version14100261 +Ref: 15b414100261 +Ref: Distribution versions-Footnote-114100754 +Ref: Distribution versions-Footnote-214100840 +Node: Distribution files14100924 +Ref: library/importlib metadata distribution-files14101060 +Ref: 459c14101060 +Ref: library/importlib metadata files14101060 +Ref: 459014101060 +Ref: library/importlib metadata importlib metadata files14101117 +Ref: 459d14101117 +Ref: library/importlib metadata importlib metadata PackagePath14101585 +Ref: 459e14101585 +Ref: Distribution files-Footnote-114103171 +Ref: Distribution files-Footnote-214103255 +Node: Distribution requirements14103352 +Ref: library/importlib metadata distribution-requirements14103506 +Ref: 459f14103506 +Ref: library/importlib metadata requirements14103506 +Ref: 459114103506 +Ref: library/importlib metadata importlib metadata requires14103577 +Ref: 45a014103577 +Ref: library/importlib metadata package-distributions14104073 +Ref: 80c14104073 +Ref: Distribution requirements-Footnote-114104110 +Node: Mapping import to distribution packages14104194 +Ref: library/importlib metadata import-distribution-package-mapping14104321 +Ref: 45a114104321 +Ref: library/importlib metadata mapping-import-to-distribution-packages14104321 +Ref: 45a214104321 +Ref: library/importlib metadata importlib metadata packages_distributions14104420 +Ref: 45a314104420 +Ref: Mapping import to distribution packages-Footnote-114105455 +Ref: Mapping import to distribution packages-Footnote-214105539 +Ref: Mapping import to distribution packages-Footnote-314105617 +Node: Distributions14105679 +Ref: library/importlib metadata distributions14105835 +Ref: 80d14105835 +Ref: library/importlib metadata id914105835 +Ref: 45a414105835 +Ref: library/importlib metadata importlib metadata distribution14105882 +Ref: 45a514105882 +Ref: library/importlib metadata importlib metadata Distribution14106185 +Ref: 45a614106185 +Ref: Distributions-Footnote-114107806 +Ref: Distributions-Footnote-214107890 +Ref: Distributions-Footnote-314107932 +Node: Distribution Discovery14108024 +Ref: library/importlib metadata distribution-discovery14108193 +Ref: 45a714108193 +Ref: Distribution Discovery-Footnote-114108859 +Node: Extending the search algorithm14108943 +Ref: library/importlib metadata extending-the-search-algorithm14109090 +Ref: 45a814109090 +Ref: Extending the search algorithm-Footnote-114110959 +Node: Example<14>14111043 +Ref: library/importlib metadata example14111121 +Ref: 45a914111121 +Node: The initialization of the sys path module search path14114415 +Ref: library/sys_path_init doc14114580 +Ref: 45aa14114580 +Ref: library/sys_path_init sys-path-init14114580 +Ref: 1c6014114580 +Ref: library/sys_path_init the-initialization-of-the-sys-path-module-search-path14114580 +Ref: 45ab14114580 +Node: Virtual environments<2>14118112 +Ref: library/sys_path_init virtual-environments14118244 +Ref: 45ad14118244 +Node: _pth files14118846 +Ref: library/sys_path_init pth-files14119002 +Ref: 45ae14119002 +Node: Embedded Python14120156 +Ref: library/sys_path_init embedded-python14120280 +Ref: 45af14120280 +Node: Python Language Services14120723 +Ref: library/language doc14120874 +Ref: 45b014120874 +Ref: library/language language14120874 +Ref: 45b114120874 +Ref: library/language python-language-services14120874 +Ref: 45b214120874 +Node: ast — Abstract Syntax Trees14121686 +Ref: library/ast doc14121838 +Ref: 45b314121838 +Ref: library/ast ast-abstract-syntax-trees14121838 +Ref: 45b414121838 +Ref: library/ast module-ast14121838 +Ref: 814121838 +Ref: ast — Abstract Syntax Trees-Footnote-114122854 +Node: Abstract Grammar14122917 +Ref: library/ast abstract-grammar14123020 +Ref: 45b614123020 +Ref: library/ast id114123020 +Ref: 45b714123020 +Node: Node classes14130432 +Ref: library/ast node-classes14130555 +Ref: 45b814130555 +Ref: library/ast ast AST14130600 +Ref: 1a614130600 +Ref: library/ast ast AST _fields14131430 +Ref: 15a414131430 +Ref: library/ast ast AST _field_types14132232 +Ref: 1a714132232 +Ref: library/ast ast AST lineno14132624 +Ref: 45b914132624 +Ref: library/ast ast AST col_offset14132651 +Ref: 45ba14132651 +Ref: library/ast ast AST end_lineno14132682 +Ref: 45bb14132682 +Ref: library/ast ast AST end_col_offset14132713 +Ref: 45bc14132713 +Ref: Node classes-Footnote-114136389 +Node: Root nodes14136447 +Ref: library/ast ast-root-nodes14136526 +Ref: 45be14136526 +Ref: library/ast root-nodes14136526 +Ref: 45bf14136526 +Ref: library/ast ast Module14136567 +Ref: 45c014136567 +Ref: library/ast ast Expression14137245 +Ref: 45c214137245 +Ref: library/ast ast Interactive14137623 +Ref: 45c414137623 +Ref: library/ast ast FunctionType14138349 +Ref: 45c514138349 +Ref: Root nodes-Footnote-114139395 +Node: Literals<3>14139437 +Ref: library/ast literals14139534 +Ref: 45c614139534 +Ref: library/ast ast Constant14139571 +Ref: 2bb14139571 +Ref: library/ast ast FormattedValue14140095 +Ref: 45c714140095 +Ref: library/ast ast JoinedStr14140950 +Ref: 16ea14140950 +Ref: library/ast ast List14141925 +Ref: 45c814141925 +Ref: library/ast ast Tuple14141957 +Ref: 45c914141957 +Ref: library/ast ast Set14142837 +Ref: 45cb14142837 +Ref: library/ast ast Dict14143225 +Ref: 195d14143225 +Node: Variables14144048 +Ref: library/ast variables14144149 +Ref: 45cc14144149 +Ref: library/ast ast Name14144188 +Ref: 193f14144188 +Ref: library/ast ast Load14144330 +Ref: 1a414144330 +Ref: library/ast ast Store14144350 +Ref: 45ca14144350 +Ref: library/ast ast Del14144371 +Ref: 45cd14144371 +Ref: library/ast ast Starred14145236 +Ref: 45ce14145236 +Node: Expressions<2>14146035 +Ref: library/ast ast-expressions14146135 +Ref: 45c314146135 +Ref: library/ast expressions14146135 +Ref: 45d014146135 +Ref: library/ast ast Expr14146178 +Ref: 45d114146178 +Ref: library/ast ast UnaryOp14146821 +Ref: 45bd14146821 +Ref: library/ast ast UAdd14146955 +Ref: 45d514146955 +Ref: library/ast ast USub14146975 +Ref: 45d614146975 +Ref: library/ast ast Not14146995 +Ref: 45d714146995 +Ref: library/ast ast Invert14147014 +Ref: 45d814147014 +Ref: library/ast ast BinOp14147365 +Ref: 19cc14147365 +Ref: library/ast ast Add14147798 +Ref: 45d914147798 +Ref: library/ast ast Sub14147817 +Ref: 45da14147817 +Ref: library/ast ast Mult14147836 +Ref: 45db14147836 +Ref: library/ast ast Div14147856 +Ref: 45dc14147856 +Ref: library/ast ast FloorDiv14147875 +Ref: 45dd14147875 +Ref: library/ast ast Mod14147899 +Ref: 45de14147899 +Ref: library/ast ast Pow14147918 +Ref: 45df14147918 +Ref: library/ast ast LShift14147937 +Ref: 45e014147937 +Ref: library/ast ast RShift14147959 +Ref: 45e114147959 +Ref: library/ast ast BitOr14147981 +Ref: 45e214147981 +Ref: library/ast ast BitXor14148002 +Ref: 45e314148002 +Ref: library/ast ast BitAnd14148024 +Ref: 45e414148024 +Ref: library/ast ast MatMult14148046 +Ref: 45e514148046 +Ref: library/ast ast BoolOp14148100 +Ref: 45e614148100 +Ref: library/ast ast And14148761 +Ref: 45e814148761 +Ref: library/ast ast Or14148780 +Ref: 45e714148780 +Ref: library/ast ast Compare14148830 +Ref: 45e914148830 +Ref: library/ast ast Eq14149476 +Ref: 45ea14149476 +Ref: library/ast ast NotEq14149494 +Ref: 45eb14149494 +Ref: library/ast ast Lt14149515 +Ref: 45ec14149515 +Ref: library/ast ast LtE14149533 +Ref: 45ed14149533 +Ref: library/ast ast Gt14149552 +Ref: 45ee14149552 +Ref: library/ast ast GtE14149570 +Ref: 45ef14149570 +Ref: library/ast ast Is14149589 +Ref: 45f014149589 +Ref: library/ast ast IsNot14149607 +Ref: 45f114149607 +Ref: library/ast ast In14149628 +Ref: 45f214149628 +Ref: library/ast ast NotIn14149646 +Ref: 45f314149646 +Ref: library/ast ast Call14149702 +Ref: 45cf14149702 +Ref: library/ast ast keyword14150829 +Ref: 45f514150829 +Ref: library/ast ast IfExp14151025 +Ref: 45f614151025 +Ref: library/ast ast Attribute14151508 +Ref: 45f414151508 +Ref: library/ast ast NamedExpr14152097 +Ref: 45f714152097 +Node: Subscripting14152751 +Ref: library/ast subscripting14152837 +Ref: 45f914152837 +Ref: library/ast ast Subscript14152882 +Ref: 45fa14152882 +Ref: library/ast ast Slice14153780 +Ref: 45fb14153780 +Node: Comprehensions14154369 +Ref: library/ast comprehensions14154455 +Ref: 45fc14154455 +Ref: library/ast ast ListComp14154504 +Ref: 45fd14154504 +Ref: library/ast ast SetComp14154546 +Ref: 45fe14154546 +Ref: library/ast ast GeneratorExp14154587 +Ref: 45ff14154587 +Ref: library/ast ast DictComp14154633 +Ref: 460014154633 +Ref: library/ast ast comprehension14156557 +Ref: 460114156557 +Node: Statements14159599 +Ref: library/ast ast-statements14159702 +Ref: 45c114159702 +Ref: library/ast statements14159702 +Ref: 460214159702 +Ref: library/ast ast Assign14159743 +Ref: 45f814159743 +Ref: library/ast ast Assign type_comment14160086 +Ref: 460314160086 +Ref: library/ast ast AnnAssign14161027 +Ref: 460414161027 +Ref: library/ast ast AugAssign14163296 +Ref: 460514163296 +Ref: library/ast ast Raise14164021 +Ref: 460614164021 +Ref: library/ast ast Assert14164558 +Ref: 460714164558 +Ref: library/ast ast Delete14164964 +Ref: 460814164964 +Ref: library/ast ast Pass14165482 +Ref: 460914165482 +Ref: library/ast ast TypeAlias14165659 +Ref: 16e114165659 +Node: Imports14166362 +Ref: library/ast imports14166416 +Ref: 460b14166416 +Ref: library/ast ast Import14166453 +Ref: 460c14166453 +Ref: library/ast ast ImportFrom14166863 +Ref: 460d14166863 +Ref: library/ast ast alias14167576 +Ref: 18be14167576 +Node: Control flow14168095 +Ref: library/ast control-flow14168200 +Ref: 460e14168200 +Ref: library/ast ast If14168354 +Ref: 460f14168354 +Ref: library/ast ast For14169611 +Ref: 461014169611 +Ref: library/ast ast For type_comment14170149 +Ref: 461114170149 +Ref: library/ast ast While14170874 +Ref: 461214170874 +Ref: library/ast ast Break14171549 +Ref: 461314171549 +Ref: library/ast ast Continue14171570 +Ref: 461414171570 +Ref: library/ast ast Try14172577 +Ref: 461514172577 +Ref: library/ast ast TryStar14174154 +Ref: 461714174154 +Ref: library/ast ast ExceptHandler14175160 +Ref: 461614175160 +Ref: library/ast ast With14176294 +Ref: 461814176294 +Ref: library/ast ast With type_comment14176525 +Ref: 461a14176525 +Ref: library/ast ast withitem14176660 +Ref: 461914176660 +Node: Pattern matching14177950 +Ref: library/ast pattern-matching14178061 +Ref: 461b14178061 +Ref: library/ast ast Match14178116 +Ref: 461c14178116 +Ref: library/ast ast match_case14178425 +Ref: 461d14178425 +Ref: library/ast ast MatchValue14180388 +Ref: 461e14180388 +Ref: library/ast ast MatchSingleton14181358 +Ref: 461f14181358 +Ref: library/ast ast MatchSequence14182214 +Ref: 462014182214 +Ref: library/ast ast MatchStar14183405 +Ref: 462114183405 +Ref: library/ast ast MatchMapping14185014 +Ref: 462214185014 +Ref: library/ast ast MatchClass14186980 +Ref: 462314186980 +Ref: library/ast ast MatchAs14189915 +Ref: 462414189915 +Ref: library/ast ast MatchOr14191533 +Ref: 462514191533 +Node: Type annotations14192780 +Ref: library/ast type-annotations14192894 +Ref: 462614192894 +Ref: library/ast ast TypeIgnore14192949 +Ref: 179614192949 +Node: Type parameters14194195 +Ref: library/ast ast-type-params14194323 +Ref: 460a14194323 +Ref: library/ast type-parameters14194323 +Ref: 462714194323 +Ref: library/ast ast TypeVar14194456 +Ref: 462814194456 +Ref: library/ast ast ParamSpec14195647 +Ref: 462914195647 +Ref: library/ast ast TypeVarTuple14197021 +Ref: 462a14197021 +Node: Function and class definitions14198227 +Ref: library/ast function-and-class-definitions14198354 +Ref: 462b14198354 +Ref: library/ast ast FunctionDef14198437 +Ref: 170714198437 +Ref: library/ast ast FunctionDef type_comment14199046 +Ref: 462d14199046 +Ref: library/ast ast Lambda14199237 +Ref: 45d214199237 +Ref: library/ast ast arguments14199846 +Ref: 462c14199846 +Ref: library/ast ast arg14200593 +Ref: 462e14200593 +Ref: library/ast ast arg type_comment14200809 +Ref: 462f14200809 +Ref: library/ast ast Return14202377 +Ref: 463014202377 +Ref: library/ast ast Yield14202618 +Ref: 45d314202618 +Ref: library/ast ast YieldFrom14202647 +Ref: 45d414202647 +Ref: library/ast ast Global14203314 +Ref: 463114203314 +Ref: library/ast ast Nonlocal14203344 +Ref: 463214203344 +Ref: library/ast ast ClassDef14203993 +Ref: 170514203993 +Ref: Function and class definitions-Footnote-114205668 +Node: Async and await14205710 +Ref: library/ast async-and-await14205813 +Ref: 463314205813 +Ref: library/ast ast AsyncFunctionDef14205866 +Ref: 170614205866 +Ref: library/ast ast Await14206136 +Ref: 463414206136 +Ref: library/ast ast AsyncFor14206752 +Ref: 463514206752 +Ref: library/ast ast AsyncWith14206819 +Ref: 463614206819 +Node: ast Helpers14207454 +Ref: library/ast ast-helpers14207575 +Ref: 463714207575 +Ref: library/ast ast parse14207765 +Ref: 1a814207765 +Ref: library/ast ast unparse14210870 +Ref: 8e414210870 +Ref: library/ast ast literal_eval14211492 +Ref: c1814211492 +Ref: library/ast ast get_docstring14213292 +Ref: 1a5914213292 +Ref: library/ast ast get_source_segment14213753 +Ref: 9d714213753 +Ref: library/ast ast fix_missing_locations14214235 +Ref: 463914214235 +Ref: library/ast ast increment_lineno14214710 +Ref: 179514214710 +Ref: library/ast ast copy_location14214942 +Ref: 463a14214942 +Ref: library/ast ast iter_fields14215201 +Ref: 463b14215201 +Ref: library/ast ast iter_child_nodes14215356 +Ref: 463c14215356 +Ref: library/ast ast walk14215534 +Ref: 463d14215534 +Ref: library/ast ast NodeVisitor14215800 +Ref: a6d14215800 +Ref: library/ast ast NodeVisitor visit14216142 +Ref: 463e14216142 +Ref: library/ast ast NodeVisitor generic_visit14216420 +Ref: 463f14216420 +Ref: library/ast ast NodeVisitor visit_Constant14216741 +Ref: a6e14216741 +Ref: library/ast ast NodeTransformer14217345 +Ref: 464014217345 +Ref: library/ast ast dump14219217 +Ref: 8e314219217 +Ref: ast Helpers-Footnote-114221524 +Ref: ast Helpers-Footnote-214221566 +Ref: ast Helpers-Footnote-314221608 +Node: Compiler Flags14221650 +Ref: library/ast ast-compiler-flags14221780 +Ref: 216414221780 +Ref: library/ast compiler-flags14221780 +Ref: 464114221780 +Ref: library/ast ast PyCF_ALLOW_TOP_LEVEL_AWAIT14221951 +Ref: 464214221951 +Ref: library/ast ast PyCF_ONLY_AST14222135 +Ref: 45b514222135 +Ref: library/ast ast PyCF_OPTIMIZED_AST14222266 +Ref: 464314222266 +Ref: library/ast ast PyCF_TYPE_COMMENTS14222459 +Ref: 463814222459 +Ref: Compiler Flags-Footnote-114222688 +Ref: Compiler Flags-Footnote-214222730 +Node: Command-Line Usage<4>14222772 +Ref: library/ast ast-cli14222882 +Ref: 464414222882 +Ref: library/ast command-line-usage14222882 +Ref: 464514222882 +Ref: library/ast cmdoption-ast-h14223145 +Ref: 464614223145 +Ref: library/ast cmdoption-ast-help14223145 +Ref: 464714223145 +Ref: library/ast cmdoption-ast-m14223207 +Ref: 464814223207 +Ref: library/ast cmdoption-ast-mode14223229 +Ref: 464914223229 +Ref: library/ast cmdoption-ast-no-type-comments14223359 +Ref: 464a14223359 +Ref: library/ast cmdoption-ast-a14223426 +Ref: 464b14223426 +Ref: library/ast cmdoption-ast-include-attributes14223426 +Ref: 464c14223426 +Ref: library/ast cmdoption-ast-i14223530 +Ref: 464d14223530 +Ref: library/ast cmdoption-ast-indent14223554 +Ref: 464e14223554 +Ref: Command-Line Usage<4>-Footnote-114224657 +Ref: Command-Line Usage<4>-Footnote-214224705 +Ref: Command-Line Usage<4>-Footnote-314224772 +Ref: Command-Line Usage<4>-Footnote-414224846 +Ref: Command-Line Usage<4>-Footnote-514224885 +Node: symtable — Access to the compiler’s symbol tables14224922 +Ref: library/symtable doc14225131 +Ref: 464f14225131 +Ref: library/symtable module-symtable14225131 +Ref: d814225131 +Ref: library/symtable symtable-access-to-the-compiler-s-symbol-tables14225131 +Ref: 465014225131 +Ref: symtable — Access to the compiler’s symbol tables-Footnote-114225758 +Node: Generating Symbol Tables14225826 +Ref: library/symtable generating-symbol-tables14225972 +Ref: 465114225972 +Ref: library/symtable symtable symtable14226041 +Ref: 19ec14226041 +Node: Examining Symbol Tables14226321 +Ref: library/symtable examining-symbol-tables14226497 +Ref: 465314226497 +Ref: library/symtable symtable SymbolTableType14226564 +Ref: 160d14226564 +Ref: library/symtable symtable SymbolTableType MODULE14226685 +Ref: 465414226685 +Ref: library/symtable symtable SymbolTableType FUNCTION14226774 +Ref: 465514226774 +Ref: library/symtable symtable SymbolTableType CLASS14226869 +Ref: 465614226869 +Ref: library/symtable symtable SymbolTableType ANNOTATION14227048 +Ref: 465714227048 +Ref: library/symtable symtable SymbolTableType TYPE_ALIAS14227192 +Ref: 465814227192 +Ref: library/symtable symtable SymbolTableType TYPE_PARAMETERS14227311 +Ref: 465914227311 +Ref: library/symtable symtable SymbolTableType TYPE_VARIABLE14227479 +Ref: 465a14227479 +Ref: library/symtable symtable SymbolTable14227848 +Ref: 465214227848 +Ref: library/symtable symtable SymbolTable get_type14227950 +Ref: 160e14227950 +Ref: library/symtable symtable SymbolTable get_id14228616 +Ref: 465b14228616 +Ref: library/symtable symtable SymbolTable get_name14228688 +Ref: 465c14228688 +Ref: library/symtable symtable SymbolTable get_lineno14229334 +Ref: 465d14229334 +Ref: library/symtable symtable SymbolTable is_optimized14229459 +Ref: 465e14229459 +Ref: library/symtable symtable SymbolTable is_nested14229568 +Ref: 465f14229568 +Ref: library/symtable symtable SymbolTable has_children14229672 +Ref: 466014229672 +Ref: library/symtable symtable SymbolTable get_identifiers14229846 +Ref: 466214229846 +Ref: library/symtable symtable SymbolTable lookup14230023 +Ref: 466314230023 +Ref: library/symtable symtable SymbolTable get_symbols14230146 +Ref: 466414230146 +Ref: library/symtable symtable SymbolTable get_children14230271 +Ref: 466114230271 +Ref: library/symtable symtable Function14230359 +Ref: 466514230359 +Ref: library/symtable symtable Function get_parameters14230489 +Ref: 466614230489 +Ref: library/symtable symtable Function get_locals14230610 +Ref: 466714230610 +Ref: library/symtable symtable Function get_globals14230713 +Ref: 466814230713 +Ref: library/symtable symtable Function get_nonlocals14230818 +Ref: 466914230818 +Ref: library/symtable symtable Function get_frees14230957 +Ref: 466a14230957 +Ref: library/symtable symtable Class14231100 +Ref: 466b14231100 +Ref: library/symtable symtable Class get_methods14231213 +Ref: 2e914231213 +Ref: library/symtable symtable Symbol14232449 +Ref: 16ce14232449 +Ref: library/symtable symtable Symbol get_name14232605 +Ref: 466c14232605 +Ref: library/symtable symtable Symbol is_referenced14232674 +Ref: 466d14232674 +Ref: library/symtable symtable Symbol is_imported14232774 +Ref: 466e14232774 +Ref: library/symtable symtable Symbol is_parameter14232897 +Ref: 466f14232897 +Ref: library/symtable symtable Symbol is_global14232990 +Ref: 467014232990 +Ref: library/symtable symtable Symbol is_nonlocal14233075 +Ref: 1a2a14233075 +Ref: library/symtable symtable Symbol is_declared_global14233164 +Ref: 131814233164 +Ref: library/symtable symtable Symbol is_local14233301 +Ref: 467114233301 +Ref: library/symtable symtable Symbol is_annotated14233397 +Ref: 467214233397 +Ref: library/symtable symtable Symbol is_free14233521 +Ref: 467314233521 +Ref: library/symtable symtable Symbol is_assigned14233652 +Ref: 467414233652 +Ref: library/symtable symtable Symbol is_namespace14233757 +Ref: 467514233757 +Ref: library/symtable symtable Symbol get_namespaces14234399 +Ref: 467614234399 +Ref: library/symtable symtable Symbol get_namespace14234494 +Ref: 467714234494 +Node: Command-Line Usage<5>14234694 +Ref: library/symtable command-line-usage14234837 +Ref: 467814234837 +Ref: library/symtable symtable-cli14234837 +Ref: 467914234837 +Node: token — Constants used with Python parse trees14235191 +Ref: library/token doc14235410 +Ref: 467a14235410 +Ref: library/token module-token14235410 +Ref: fa14235410 +Ref: library/token token-constants-used-with-python-parse-trees14235410 +Ref: 467b14235410 +Ref: library/token token tok_name14236366 +Ref: 468014236366 +Ref: library/token token ISTERMINAL14236584 +Ref: 468114236584 +Ref: library/token token ISNONTERMINAL14236671 +Ref: 468214236671 +Ref: library/token token ISEOF14236765 +Ref: 468314236765 +Ref: library/token token NAME14236896 +Ref: 467e14236896 +Ref: library/token token NUMBER14237054 +Ref: 468414237054 +Ref: library/token token STRING14237142 +Ref: 468514237142 +Ref: library/token token OP14237487 +Ref: 467d14237487 +Ref: library/token token COMMENT14237790 +Ref: 468714237790 +Ref: library/token token NEWLINE14237908 +Ref: 468814237908 +Ref: library/token token NL14238005 +Ref: 468914238005 +Ref: library/token token INDENT14238236 +Ref: 1d0e14238236 +Ref: library/token token DEDENT14238392 +Ref: 468a14238392 +Ref: library/token token FSTRING_START14238546 +Ref: 468b14238546 +Ref: library/token token FSTRING_MIDDLE14238819 +Ref: 468c14238819 +Ref: library/token token FSTRING_END14239246 +Ref: 469114239246 +Ref: library/token token ENDMARKER14239436 +Ref: 469214239436 +Ref: library/token token ENCODING14239514 +Ref: 469314239514 +Ref: library/token token TYPE_IGNORE14240022 +Ref: 469414240022 +Ref: library/token token TYPE_COMMENT14240270 +Ref: 469514240270 +Ref: library/token token SOFT_KEYWORD14240500 +Ref: 467f14240500 +Ref: library/token token ERRORTOKEN14240755 +Ref: 469714240755 +Ref: library/token token-operators-delimiters14241085 +Ref: 468614241085 +Ref: library/token token LPAR14241624 +Ref: 469814241624 +Ref: library/token token RPAR14241801 +Ref: 469914241801 +Ref: library/token token LSQB14241978 +Ref: 469a14241978 +Ref: library/token token RSQB14242155 +Ref: 469b14242155 +Ref: library/token token COLON14242333 +Ref: 469014242333 +Ref: library/token token COMMA14242510 +Ref: 469c14242510 +Ref: library/token token SEMI14242686 +Ref: 469d14242686 +Ref: library/token token PLUS14242863 +Ref: 467c14242863 +Ref: library/token token MINUS14243041 +Ref: 469e14243041 +Ref: library/token token STAR14243217 +Ref: 469f14243217 +Ref: library/token token SLASH14243395 +Ref: 46a014243395 +Ref: library/token token VBAR14243571 +Ref: 46a114243571 +Ref: library/token token AMPER14243749 +Ref: 46a214243749 +Ref: library/token token LESS14243925 +Ref: 46a314243925 +Ref: library/token token GREATER14244105 +Ref: 46a414244105 +Ref: library/token token EQUAL14244280 +Ref: 46a514244280 +Ref: library/token token DOT14244455 +Ref: 46a614244455 +Ref: library/token token PERCENT14244636 +Ref: 46a714244636 +Ref: library/token token LBRACE14244812 +Ref: 468d14244812 +Ref: library/token token RBRACE14244989 +Ref: 468e14244989 +Ref: library/token token EQEQUAL14245167 +Ref: 46a814245167 +Ref: library/token token NOTEQUAL14245346 +Ref: 46a914245346 +Ref: library/token token LESSEQUAL14245525 +Ref: 46aa14245525 +Ref: library/token token GREATEREQUAL14245706 +Ref: 46ab14245706 +Ref: library/token token TILDE14245877 +Ref: 46ac14245877 +Ref: library/token token CIRCUMFLEX14246059 +Ref: 46ad14246059 +Ref: library/token token LEFTSHIFT14246235 +Ref: 46ae14246235 +Ref: library/token token RIGHTSHIFT14246414 +Ref: 46af14246414 +Ref: library/token token DOUBLESTAR14246592 +Ref: 46b014246592 +Ref: library/token token PLUSEQUAL14246769 +Ref: 46b114246769 +Ref: library/token token MINEQUAL14246946 +Ref: 46b214246946 +Ref: library/token token STAREQUAL14247125 +Ref: 46b314247125 +Ref: library/token token SLASHEQUAL14247304 +Ref: 46b414247304 +Ref: library/token token PERCENTEQUAL14247484 +Ref: 46b514247484 +Ref: library/token token AMPEREQUAL14247660 +Ref: 46b614247660 +Ref: library/token token VBAREQUAL14247837 +Ref: 46b714247837 +Ref: library/token token CIRCUMFLEXEQUAL14248021 +Ref: 46b814248021 +Ref: library/token token LEFTSHIFTEQUAL14248198 +Ref: 46b914248198 +Ref: library/token token RIGHTSHIFTEQUAL14248378 +Ref: 46ba14248378 +Ref: library/token token DOUBLESTAREQUAL14248557 +Ref: 46bb14248557 +Ref: library/token token DOUBLESLASH14248732 +Ref: 46bc14248732 +Ref: library/token token DOUBLESLASHEQUAL14248915 +Ref: 46bd14248915 +Ref: library/token token AT14249080 +Ref: 46be14249080 +Ref: library/token token ATEQUAL14249262 +Ref: 46bf14249262 +Ref: library/token token RARROW14249439 +Ref: 46c014249439 +Ref: library/token token ELLIPSIS14249619 +Ref: 46c114249619 +Ref: library/token token COLONEQUAL14249800 +Ref: 46c214249800 +Ref: library/token token EXCLAMATION14249979 +Ref: 468f14249979 +Ref: library/token token N_TOKENS14250123 +Ref: 46c314250123 +Ref: library/token token EXACT_TOKEN_TYPES14250205 +Ref: 159414250205 +Ref: token — Constants used with Python parse trees-Footnote-114251128 +Node: keyword — Testing for Python keywords14251193 +Ref: library/keyword doc14251399 +Ref: 46c414251399 +Ref: library/keyword keyword-testing-for-python-keywords14251399 +Ref: 46c514251399 +Ref: library/keyword module-keyword14251399 +Ref: 8414251399 +Ref: library/keyword keyword iskeyword14251718 +Ref: 21c114251718 +Ref: library/keyword keyword kwlist14251819 +Ref: 46c614251819 +Ref: library/keyword keyword issoftkeyword14252087 +Ref: 469614252087 +Ref: library/keyword keyword softkwlist14252224 +Ref: 46c714252224 +Ref: keyword — Testing for Python keywords-Footnote-114252569 +Node: tokenize — Tokenizer for Python source14252636 +Ref: library/tokenize doc14252841 +Ref: 46c814252841 +Ref: library/tokenize module-tokenize14252841 +Ref: fb14252841 +Ref: library/tokenize tokenize-tokenizer-for-python-source14252841 +Ref: 46c914252841 +Ref: tokenize — Tokenizer for Python source-Footnote-114254122 +Node: Tokenizing Input14254190 +Ref: library/tokenize tokenizing-input14254313 +Ref: 46ca14254313 +Ref: library/tokenize tokenize tokenize14254420 +Ref: 4d514254420 +Ref: library/tokenize tokenize generate_tokens14255854 +Ref: 4d614255854 +Ref: library/tokenize tokenize untokenize14256618 +Ref: 158514256618 +Ref: library/tokenize tokenize detect_encoding14257499 +Ref: 286814257499 +Ref: library/tokenize tokenize open14258495 +Ref: 286714258495 +Ref: library/tokenize tokenize TokenError14258666 +Ref: 53f14258666 +Ref: Tokenizing Input-Footnote-114258982 +Ref: Tokenizing Input-Footnote-214259024 +Node: Command-Line Usage<6>14259066 +Ref: library/tokenize command-line-usage14259210 +Ref: 46cb14259210 +Ref: library/tokenize tokenize-cli14259210 +Ref: 46cc14259210 +Ref: library/tokenize cmdoption-tokenize-h14259475 +Ref: 46cd14259475 +Ref: library/tokenize cmdoption-tokenize-help14259475 +Ref: 46ce14259475 +Ref: library/tokenize cmdoption-tokenize-e14259537 +Ref: 46cf14259537 +Ref: library/tokenize cmdoption-tokenize-exact14259537 +Ref: 46d014259537 +Node: Examples<35>14259729 +Ref: library/tokenize examples14259848 +Ref: 46d114259848 +Node: tabnanny — Detection of ambiguous indentation14264341 +Ref: library/tabnanny doc14264547 +Ref: 46d214264547 +Ref: library/tabnanny module-tabnanny14264547 +Ref: dd14264547 +Ref: library/tabnanny tabnanny-detection-of-ambiguous-indentation14264547 +Ref: 46d314264547 +Ref: library/tabnanny tabnanny check14265078 +Ref: 46d414265078 +Ref: library/tabnanny tabnanny verbose14265518 +Ref: 46d514265518 +Ref: library/tabnanny tabnanny filename_only14265675 +Ref: 46d614265675 +Ref: library/tabnanny tabnanny NannyNag14265893 +Ref: 46d714265893 +Ref: library/tabnanny tabnanny process_tokens14266058 +Ref: 46d814266058 +Ref: tabnanny — Detection of ambiguous indentation-Footnote-114266355 +Node: pyclbr — Python module browser support14266423 +Ref: library/pyclbr doc14266631 +Ref: 46d914266631 +Ref: library/pyclbr module-pyclbr14266631 +Ref: b414266631 +Ref: library/pyclbr pyclbr-python-module-browser-support14266631 +Ref: 46da14266631 +Ref: library/pyclbr pyclbr readmodule14267329 +Ref: 82714267329 +Ref: library/pyclbr pyclbr readmodule_ex14267940 +Ref: 82814267940 +Ref: pyclbr — Python module browser support-Footnote-114269018 +Node: Function Objects14269084 +Ref: library/pyclbr function-objects14269202 +Ref: 46db14269202 +Ref: library/pyclbr pyclbr-function-objects14269202 +Ref: 46dc14269202 +Ref: library/pyclbr pyclbr Function14269255 +Ref: 46dd14269255 +Ref: library/pyclbr pyclbr Function file14269408 +Ref: 46de14269408 +Ref: library/pyclbr pyclbr Function module14269496 +Ref: 46df14269496 +Ref: library/pyclbr pyclbr Function name14269591 +Ref: 46e014269591 +Ref: library/pyclbr pyclbr Function lineno14269654 +Ref: 46e114269654 +Ref: library/pyclbr pyclbr Function parent14269750 +Ref: 46e214269750 +Ref: library/pyclbr pyclbr Function children14269904 +Ref: 46e314269904 +Ref: library/pyclbr pyclbr Function is_async14270076 +Ref: 46e414270076 +Node: Class Objects<2>14270261 +Ref: library/pyclbr class-objects14270379 +Ref: 46e514270379 +Ref: library/pyclbr pyclbr-class-objects14270379 +Ref: 46e614270379 +Ref: library/pyclbr pyclbr Class14270426 +Ref: 46e714270426 +Ref: library/pyclbr pyclbr Class file14270612 +Ref: 46e814270612 +Ref: library/pyclbr pyclbr Class module14270697 +Ref: 46e914270697 +Ref: library/pyclbr pyclbr Class name14270789 +Ref: 46ea14270789 +Ref: library/pyclbr pyclbr Class lineno14270849 +Ref: 46eb14270849 +Ref: library/pyclbr pyclbr Class parent14270945 +Ref: 46ec14270945 +Ref: library/pyclbr pyclbr Class children14271095 +Ref: 46ed14271095 +Ref: library/pyclbr pyclbr Class super14271255 +Ref: 46ee14271255 +Ref: library/pyclbr pyclbr Class methods14271616 +Ref: 46ef14271616 +Node: py_compile — Compile Python source files14271844 +Ref: library/py_compile doc14272049 +Ref: 46f014272049 +Ref: library/py_compile module-py_compile14272049 +Ref: b314272049 +Ref: library/py_compile py-compile-compile-python-source-files14272049 +Ref: 46f114272049 +Ref: library/py_compile py_compile PyCompileError14272672 +Ref: 46f214272672 +Ref: library/py_compile py_compile compile14272801 +Ref: a2414272801 +Ref: library/py_compile py_compile PycInvalidationMode14276553 +Ref: 46f314276553 +Ref: library/py_compile py_compile PycInvalidationMode TIMESTAMP14276977 +Ref: 46f514276977 +Ref: library/py_compile py_compile PycInvalidationMode CHECKED_HASH14277259 +Ref: 46f414277259 +Ref: library/py_compile py_compile PycInvalidationMode UNCHECKED_HASH14277505 +Ref: 46f614277505 +Ref: py_compile — Compile Python source files-Footnote-114278053 +Ref: py_compile — Compile Python source files-Footnote-214278123 +Ref: py_compile — Compile Python source files-Footnote-314278165 +Ref: py_compile — Compile Python source files-Footnote-414278207 +Ref: py_compile — Compile Python source files-Footnote-514278249 +Node: Command-Line Interface<6>14278291 +Ref: library/py_compile command-line-interface14278395 +Ref: 46f714278395 +Ref: library/py_compile py-compile-cli14278395 +Ref: 46f814278395 +Ref: library/py_compile cmdoption-python-m-py_compile-arg-file14278824 +Ref: 46f914278824 +Ref: library/py_compile cmdoption-python-m-py_compile14278855 +Ref: 46fa14278855 +Ref: library/py_compile cmdoption-python-m-py_compile-q14279007 +Ref: 46fb14279007 +Ref: library/py_compile cmdoption-python-m-py_compile-quiet14279007 +Ref: 46fc14279007 +Node: compileall — Byte-compile Python libraries14279295 +Ref: library/compileall doc14279500 +Ref: 46fd14279500 +Ref: library/compileall compileall-byte-compile-python-libraries14279500 +Ref: 46fe14279500 +Ref: library/compileall module-compileall14279500 +Ref: 2014279500 +Ref: compileall — Byte-compile Python libraries-Footnote-114280321 +Node: Command-line use14280391 +Ref: library/compileall command-line-use14280513 +Ref: 46ff14280513 +Ref: library/compileall compileall-cli14280513 +Ref: 470014280513 +Ref: library/compileall cmdoption-compileall-arg-directory14280662 +Ref: 470114280662 +Ref: library/compileall cmdoption-compileall-arg-file14280688 +Ref: 470214280688 +Ref: library/compileall cmdoption-compileall-l14280936 +Ref: 470314280936 +Ref: library/compileall cmdoption-compileall-f14281086 +Ref: 470414281086 +Ref: library/compileall cmdoption-compileall-q14281157 +Ref: 470514281157 +Ref: library/compileall cmdoption-compileall-d14281341 +Ref: 470614281341 +Ref: library/compileall cmdoption-compileall-s14281694 +Ref: 470714281694 +Ref: library/compileall cmdoption-compileall-p14281909 +Ref: 470814281909 +Ref: library/compileall cmdoption-compileall-x14282129 +Ref: 470914282129 +Ref: library/compileall cmdoption-compileall-i14282302 +Ref: 470a14282302 +Ref: library/compileall cmdoption-compileall-b14282504 +Ref: 470b14282504 +Ref: library/compileall cmdoption-compileall-r14282830 +Ref: 470c14282830 +Ref: library/compileall cmdoption-compileall-j14283100 +Ref: 470d14283100 +Ref: library/compileall cmdoption-compileall-invalidation-mode14283287 +Ref: 470e14283287 +Ref: library/compileall cmdoption-compileall-o14284086 +Ref: 470f14284086 +Ref: library/compileall cmdoption-compileall-e14284279 +Ref: 471014284279 +Ref: library/compileall cmdoption-compileall-hardlink-dupes14284359 +Ref: 471114284359 +Ref: Command-line use-Footnote-114285654 +Node: Public functions14285696 +Ref: library/compileall public-functions14285818 +Ref: 471214285818 +Ref: library/compileall compileall compile_dir14285871 +Ref: b2614285871 +Ref: library/compileall compileall compile_file14290017 +Ref: de014290017 +Ref: library/compileall compileall compile_path14293015 +Ref: de114293015 +Ref: Public functions-Footnote-114294749 +Ref: Public functions-Footnote-214294791 +Node: dis — Disassembler for Python bytecode14294833 +Ref: library/dis doc14295039 +Ref: 471314295039 +Ref: library/dis dis-disassembler-for-python-bytecode14295039 +Ref: 471414295039 +Ref: library/dis module-dis14295039 +Ref: 3814295039 +Ref: dis — Disassembler for Python bytecode-Footnote-114297763 +Node: Command-line interface<3>14297826 +Ref: library/dis command-line-interface14297954 +Ref: 471514297954 +Ref: library/dis dis-cli14297954 +Ref: 471614297954 +Ref: library/dis cmdoption-dis-h14298179 +Ref: 471714298179 +Ref: library/dis cmdoption-dis-help14298179 +Ref: 471814298179 +Ref: library/dis cmdoption-dis-C14298233 +Ref: 471914298233 +Ref: library/dis cmdoption-dis-show-caches14298233 +Ref: 471a14298233 +Ref: library/dis cmdoption-dis-O14298319 +Ref: 1da14298319 +Ref: library/dis cmdoption-dis-show-offsets14298319 +Ref: 471b14298319 +Node: Bytecode analysis14298578 +Ref: library/dis bytecode-analysis14298733 +Ref: 471c14298733 +Ref: library/dis dis Bytecode14298975 +Ref: f2914298975 +Ref: library/dis dis Bytecode from_traceback14300466 +Ref: f2b14300466 +Ref: library/dis dis Bytecode codeobj14300712 +Ref: 471d14300712 +Ref: library/dis dis Bytecode first_line14300773 +Ref: 471e14300773 +Ref: library/dis dis Bytecode dis14300867 +Ref: f2a14300867 +Ref: library/dis dis Bytecode info14301058 +Ref: 471f14301058 +Node: Analysis functions14301607 +Ref: library/dis analysis-functions14301765 +Ref: 472014301765 +Ref: library/dis dis code_info14302071 +Ref: 122c14302071 +Ref: library/dis dis show_code14302612 +Ref: f2714302612 +Ref: library/dis dis dis14303078 +Ref: b3414303078 +Ref: library/dis dis disassemble14305581 +Ref: f2814305581 +Ref: library/dis dis get_instructions14306804 +Ref: 1db14306804 +Ref: library/dis dis findlinestarts14307938 +Ref: 472114307938 +Ref: library/dis dis findlabels14308645 +Ref: 472214308645 +Ref: library/dis dis stack_effect14308815 +Ref: f2c14308815 +Ref: Analysis functions-Footnote-114309735 +Node: Python Bytecode Instructions14309777 +Ref: library/dis bytecodes14309936 +Ref: 5ae14309936 +Ref: library/dis python-bytecode-instructions14309936 +Ref: 472314309936 +Ref: library/dis dis Instruction14310170 +Ref: 1dc14310170 +Ref: library/dis dis Instruction opcode14310237 +Ref: 472414310237 +Ref: library/dis dis Instruction opname14310430 +Ref: 472614310430 +Ref: library/dis dis Instruction baseopcode14310498 +Ref: 472714310498 +Ref: library/dis dis Instruction baseopname14310650 +Ref: 472814310650 +Ref: library/dis dis Instruction arg14310809 +Ref: 472a14310809 +Ref: library/dis dis Instruction oparg14310901 +Ref: 472b14310901 +Ref: library/dis dis Instruction argval14310961 +Ref: 472c14310961 +Ref: library/dis dis Instruction argrepr14311045 +Ref: 472d14311045 +Ref: library/dis dis Instruction offset14311176 +Ref: 472e14311176 +Ref: library/dis dis Instruction start_offset14311260 +Ref: 472f14311260 +Ref: library/dis dis Instruction cache_offset14311471 +Ref: 473014311471 +Ref: library/dis dis Instruction end_offset14311568 +Ref: 473114311568 +Ref: library/dis dis Instruction starts_line14311661 +Ref: 473214311661 +Ref: library/dis dis Instruction line_number14311770 +Ref: 473314311770 +Ref: library/dis dis Instruction is_jump_target14311897 +Ref: 473414311897 +Ref: library/dis dis Instruction jump_target14312001 +Ref: 473514312001 +Ref: library/dis dis Instruction positions14312134 +Ref: 473614312134 +Ref: library/dis dis Instruction cache_info14312289 +Ref: 473714312289 +Ref: library/dis dis Positions14312998 +Ref: 44bd14312998 +Ref: library/dis dis Positions lineno14313110 +Ref: 473814313110 +Ref: library/dis dis Positions end_lineno14313133 +Ref: 473914313133 +Ref: library/dis dis Positions col_offset14313160 +Ref: 473a14313160 +Ref: library/dis dis Positions end_col_offset14313187 +Ref: 473b14313187 +Ref: library/dis opcode-NOP14313551 +Ref: 473c14313551 +Ref: library/dis opcode-POP_TOP14313683 +Ref: 473d14313683 +Ref: library/dis opcode-END_FOR14313764 +Ref: 473e14313764 +Ref: library/dis opcode-END_SEND14313941 +Ref: 473f14313941 +Ref: library/dis opcode-COPY14314077 +Ref: 70414314077 +Ref: library/dis opcode-SWAP14314288 +Ref: 70514314288 +Ref: library/dis opcode-CACHE14314449 +Ref: 6f414314449 +Ref: library/dis opcode-UNARY_NEGATIVE14315284 +Ref: 474014315284 +Ref: library/dis opcode-UNARY_NOT14315359 +Ref: 16ef14315359 +Ref: library/dis opcode-UNARY_INVERT14315533 +Ref: 474114315533 +Ref: library/dis opcode-GET_ITER14315606 +Ref: 474214315606 +Ref: library/dis opcode-GET_YIELD_FROM_ITER14315680 +Ref: 474314315680 +Ref: library/dis opcode-TO_BOOL14315920 +Ref: 16ec14315920 +Ref: library/dis opcode-BINARY_OP14316437 +Ref: 70114316437 +Ref: library/dis opcode-BINARY_SUBSCR14316676 +Ref: 174014316676 +Ref: library/dis opcode-STORE_SUBSCR14316823 +Ref: 181a14316823 +Ref: library/dis opcode-DELETE_SUBSCR14316993 +Ref: 474414316993 +Ref: library/dis opcode-BINARY_SLICE14317130 +Ref: 4db14317130 +Ref: library/dis opcode-STORE_SLICE14317341 +Ref: 4dc14317341 +Ref: library/dis opcode-GET_AWAITABLE14317597 +Ref: 183614317597 +Ref: library/dis opcode-GET_AITER14318223 +Ref: 474514318223 +Ref: library/dis opcode-GET_ANEXT14318440 +Ref: 474614318440 +Ref: library/dis opcode-END_ASYNC_FOR14318647 +Ref: aaa14318647 +Ref: library/dis opcode-CLEANUP_THROW14319132 +Ref: 4df14319132 +Ref: library/dis opcode-BEFORE_ASYNC_WITH14319494 +Ref: 474714319494 +Ref: library/dis opcode-SET_ADD14319778 +Ref: 474814319778 +Ref: library/dis opcode-LIST_APPEND14319930 +Ref: 474914319930 +Ref: library/dis opcode-MAP_ADD14320091 +Ref: aac14320091 +Ref: library/dis opcode-RETURN_VALUE14320699 +Ref: 17a714320699 +Ref: library/dis opcode-RETURN_CONST14320791 +Ref: 4e514320791 +Ref: library/dis opcode-YIELD_VALUE14320929 +Ref: 30e14320929 +Ref: library/dis opcode-SETUP_ANNOTATIONS14321325 +Ref: d5414321325 +Ref: library/dis opcode-POP_EXCEPT14321625 +Ref: 474a14321625 +Ref: library/dis opcode-RERAISE14321847 +Ref: 474b14321847 +Ref: library/dis opcode-PUSH_EXC_INFO14322205 +Ref: 6fe14322205 +Ref: library/dis opcode-CHECK_EXC_MATCH14322445 +Ref: 70614322445 +Ref: library/dis opcode-CHECK_EG_MATCH14322707 +Ref: 6fd14322707 +Ref: library/dis opcode-WITH_EXCEPT_START14323164 +Ref: 474c14323164 +Ref: library/dis opcode-LOAD_ASSERTION_ERROR14323700 +Ref: 96714323700 +Ref: library/dis opcode-LOAD_BUILD_CLASS14323866 +Ref: 474d14323866 +Ref: library/dis opcode-BEFORE_WITH14324005 +Ref: 70814324005 +Ref: library/dis opcode-GET_LEN14324428 +Ref: 474e14324428 +Ref: library/dis opcode-MATCH_MAPPING14324625 +Ref: 474f14324625 +Ref: library/dis opcode-MATCH_SEQUENCE14324946 +Ref: 475014324946 +Ref: library/dis opcode-MATCH_KEYS14325360 +Ref: 70e14325360 +Ref: library/dis opcode-STORE_NAME14325827 +Ref: 475114325827 +Ref: library/dis opcode-DELETE_NAME14326111 +Ref: 475314326111 +Ref: library/dis opcode-UNPACK_SEQUENCE14326277 +Ref: 183814326277 +Ref: library/dis opcode-UNPACK_EX14326569 +Ref: 475414326569 +Ref: library/dis opcode-STORE_ATTR14327528 +Ref: 183714327528 +Ref: library/dis opcode-DELETE_ATTR14327766 +Ref: 475514327766 +Ref: library/dis opcode-STORE_GLOBAL14327973 +Ref: 475214327973 +Ref: library/dis opcode-DELETE_GLOBAL14328079 +Ref: 475614328079 +Ref: library/dis opcode-LOAD_CONST14328181 +Ref: 475714328181 +Ref: library/dis opcode-LOAD_NAME14328267 +Ref: 475814328267 +Ref: library/dis opcode-LOAD_LOCALS14328463 +Ref: 4e414328463 +Ref: library/dis opcode-LOAD_FROM_DICT_OR_GLOBALS14328728 +Ref: 4e314328728 +Ref: library/dis opcode-BUILD_TUPLE14329121 +Ref: 475914329121 +Ref: library/dis opcode-BUILD_LIST14329447 +Ref: 475a14329447 +Ref: library/dis opcode-BUILD_SET14329539 +Ref: 475b14329539 +Ref: library/dis opcode-BUILD_MAP14329629 +Ref: 16e214329629 +Ref: library/dis opcode-BUILD_CONST_KEY_MAP14330010 +Ref: d5114330010 +Ref: library/dis opcode-BUILD_STRING14330332 +Ref: d5014330332 +Ref: library/dis opcode-LIST_EXTEND14330497 +Ref: 475c14330497 +Ref: library/dis opcode-SET_UPDATE14330666 +Ref: 475d14330666 +Ref: library/dis opcode-DICT_UPDATE14330832 +Ref: 475e14330832 +Ref: library/dis opcode-DICT_MERGE14331001 +Ref: 475f14331001 +Ref: library/dis opcode-LOAD_ATTR14331142 +Ref: 4da14331142 +Ref: library/dis opcode-LOAD_SUPER_ATTR14332079 +Ref: 4d814332079 +Ref: library/dis opcode-COMPARE_OP14333150 +Ref: 96914333150 +Ref: library/dis opcode-IS_OP14333529 +Ref: 476014333529 +Ref: library/dis opcode-CONTAINS_OP14333659 +Ref: 476114333659 +Ref: library/dis opcode-IMPORT_NAME14333795 +Ref: 476214333795 +Ref: library/dis opcode-IMPORT_FROM14334215 +Ref: 476314334215 +Ref: library/dis opcode-JUMP_FORWARD14334464 +Ref: 15e114334464 +Ref: library/dis opcode-JUMP_BACKWARD14334544 +Ref: 70714334544 +Ref: library/dis opcode-JUMP_BACKWARD_NO_INTERRUPT14334678 +Ref: 6fa14334678 +Ref: library/dis opcode-POP_JUMP_IF_TRUE14334838 +Ref: 16ed14334838 +Ref: library/dis opcode-POP_JUMP_IF_FALSE14335380 +Ref: 16ee14335380 +Ref: library/dis opcode-POP_JUMP_IF_NOT_NONE14335925 +Ref: 17f614335925 +Ref: library/dis opcode-POP_JUMP_IF_NONE14336188 +Ref: 17f514336188 +Ref: library/dis opcode-FOR_ITER14336443 +Ref: 175114336443 +Ref: library/dis opcode-LOAD_GLOBAL14336856 +Ref: 16e914336856 +Ref: library/dis opcode-LOAD_FAST14337102 +Ref: 476414337102 +Ref: library/dis opcode-LOAD_FAST_LOAD_FAST14337411 +Ref: 476514337411 +Ref: library/dis opcode-LOAD_FAST_CHECK14337602 +Ref: 4e114337602 +Ref: library/dis opcode-LOAD_FAST_AND_CLEAR14337851 +Ref: 4e014337851 +Ref: library/dis opcode-STORE_FAST14338149 +Ref: 16f114338149 +Ref: library/dis opcode-STORE_FAST_STORE_FAST14338257 +Ref: 476614338257 +Ref: library/dis opcode-STORE_FAST_LOAD_FAST14338463 +Ref: 476714338463 +Ref: library/dis opcode-DELETE_FAST14338711 +Ref: 476814338711 +Ref: library/dis opcode-MAKE_CELL14338794 +Ref: 6fb14338794 +Ref: library/dis opcode-LOAD_DEREF14338968 +Ref: 476914338968 +Ref: library/dis opcode-LOAD_FROM_DICT_OR_DEREF14339253 +Ref: 4e214339253 +Ref: library/dis opcode-STORE_DEREF14339784 +Ref: 476a14339784 +Ref: library/dis opcode-DELETE_DEREF14340029 +Ref: 476b14340029 +Ref: library/dis opcode-COPY_FREE_VARS14340322 +Ref: 6f914340322 +Ref: library/dis opcode-RAISE_VARARGS14340570 +Ref: 476c14340570 +Ref: library/dis opcode-CALL14341039 +Ref: 70214341039 +Ref: library/dis opcode-CALL_KW14341811 +Ref: 16e314341811 +Ref: library/dis opcode-CALL_FUNCTION_EX14342643 +Ref: d5314342643 +Ref: library/dis opcode-PUSH_NULL14343325 +Ref: 70314343325 +Ref: library/dis opcode-MAKE_FUNCTION14343529 +Ref: d5214343529 +Ref: library/dis opcode-SET_FUNCTION_ATTRIBUTE14344006 +Ref: 476d14344006 +Ref: library/dis opcode-BUILD_SLICE14344721 +Ref: 476e14344721 +Ref: library/dis opcode-EXTENDED_ARG14345190 +Ref: 17a514345190 +Ref: library/dis opcode-CONVERT_VALUE14345527 +Ref: 476f14345527 +Ref: library/dis opcode-FORMAT_SIMPLE14346003 +Ref: 477014346003 +Ref: library/dis opcode-FORMAT_WITH_SPEC14346269 +Ref: 477114346269 +Ref: library/dis opcode-MATCH_CLASS14346586 +Ref: 70d14346586 +Ref: library/dis opcode-RESUME14347303 +Ref: 30f14347303 +Ref: library/dis opcode-RETURN_GENERATOR14348041 +Ref: 6f714348041 +Ref: library/dis opcode-SEND14348335 +Ref: 6f814348335 +Ref: library/dis opcode-HAVE_ARGUMENT14348702 +Ref: 48514348702 +Ref: library/dis opcode-CALL_INTRINSIC_114349563 +Ref: 4dd14349563 +Ref: library/dis opcode-CALL_INTRINSIC_214352893 +Ref: 4de14352893 +Ref: library/dis opcode-SETUP_FINALLY14354936 +Ref: 477214354936 +Ref: library/dis opcode-SETUP_CLEANUP14355200 +Ref: 477314355200 +Ref: library/dis opcode-SETUP_WITH14355605 +Ref: 477414355605 +Ref: library/dis opcode-POP_BLOCK14356037 +Ref: 477514356037 +Ref: library/dis opcode-JUMP14356190 +Ref: 477614356190 +Ref: library/dis opcode-JUMP_NO_INTERRUPT14356208 +Ref: 181814356208 +Ref: library/dis opcode-LOAD_CLOSURE14356375 +Ref: 16eb14356375 +Ref: library/dis opcode-LOAD_METHOD14356670 +Ref: c1f14356670 +Node: Opcode collections14356804 +Ref: library/dis id114356936 +Ref: 477714356936 +Ref: library/dis opcode-collections14356936 +Ref: 472514356936 +Ref: library/dis dis opname14357290 +Ref: 472914357290 +Ref: library/dis dis opmap14357377 +Ref: 477814357377 +Ref: library/dis dis cmp_op14357453 +Ref: 477914357453 +Ref: library/dis dis hasarg14357522 +Ref: 2a014357522 +Ref: library/dis dis hasconst14357626 +Ref: 477a14357626 +Ref: library/dis dis hasfree14357702 +Ref: 477b14357702 +Ref: library/dis dis hasname14358050 +Ref: 477c14358050 +Ref: library/dis dis hasjump14358135 +Ref: 477d14358135 +Ref: library/dis dis haslocal14358270 +Ref: 477e14358270 +Ref: library/dis dis hascompare14358352 +Ref: 477f14358352 +Ref: library/dis dis hasexc14358429 +Ref: 48614358429 +Ref: library/dis dis hasjrel14358539 +Ref: 478014358539 +Ref: library/dis dis hasjabs14358720 +Ref: 478114358720 +Node: pickletools — Tools for pickle developers14358897 +Ref: library/pickletools doc14359050 +Ref: 478214359050 +Ref: library/pickletools module-pickletools14359050 +Ref: a714359050 +Ref: library/pickletools pickletools-tools-for-pickle-developers14359050 +Ref: 478314359050 +Ref: pickletools — Tools for pickle developers-Footnote-114359841 +Node: Command line usage<2>14359912 +Ref: library/pickletools command-line-usage14360047 +Ref: 478414360047 +Ref: library/pickletools pickletools-cli14360047 +Ref: 478514360047 +Node: Command line options<3>14361002 +Ref: library/pickletools command-line-options14361083 +Ref: 478614361083 +Ref: library/pickletools cmdoption-pickletools-a14361146 +Ref: 478714361146 +Ref: library/pickletools cmdoption-pickletools-annotate14361146 +Ref: 478814361146 +Ref: library/pickletools cmdoption-pickletools-o14361232 +Ref: 478914361232 +Ref: library/pickletools cmdoption-pickletools-output14361232 +Ref: 478a14361232 +Ref: library/pickletools cmdoption-pickletools-l14361322 +Ref: 478b14361322 +Ref: library/pickletools cmdoption-pickletools-indentlevel14361322 +Ref: 478c14361322 +Ref: library/pickletools cmdoption-pickletools-m14361423 +Ref: 478d14361423 +Ref: library/pickletools cmdoption-pickletools-memo14361423 +Ref: 478e14361423 +Ref: library/pickletools cmdoption-pickletools-p14361535 +Ref: 478f14361535 +Ref: library/pickletools cmdoption-pickletools-preamble14361535 +Ref: 479014361535 +Node: Programmatic Interface<2>14361677 +Ref: library/pickletools programmatic-interface14361812 +Ref: 479114361812 +Ref: library/pickletools pickletools dis14361879 +Ref: cc314361879 +Ref: library/pickletools pickletools genops14362719 +Ref: 479214362719 +Ref: library/pickletools pickletools optimize14363155 +Ref: 289d14363155 +Node: MS Windows Specific Services14363435 +Ref: library/windows doc14363591 +Ref: 479314363591 +Ref: library/windows ms-windows-specific-services14363591 +Ref: 479414363591 +Ref: library/windows mswin-specific-services14363591 +Ref: 1e3414363591 +Node: msvcrt — Useful routines from the MS VC++ runtime14363899 +Ref: library/msvcrt doc14364058 +Ref: 479514364058 +Ref: library/msvcrt module-msvcrt14364058 +Ref: 9314364058 +Ref: library/msvcrt msvcrt-useful-routines-from-the-ms-vc-runtime14364058 +Ref: 479614364058 +Node: File Operations14365074 +Ref: library/msvcrt file-operations14365197 +Ref: 479714365197 +Ref: library/msvcrt msvcrt-files14365197 +Ref: 479814365197 +Ref: library/msvcrt msvcrt locking14365248 +Ref: 41ed14365248 +Ref: library/msvcrt msvcrt LK_LOCK14365912 +Ref: 479914365912 +Ref: library/msvcrt msvcrt LK_RLCK14365937 +Ref: 479a14365937 +Ref: library/msvcrt msvcrt LK_NBLCK14366178 +Ref: 479b14366178 +Ref: library/msvcrt msvcrt LK_NBRLCK14366204 +Ref: 479c14366204 +Ref: library/msvcrt msvcrt LK_UNLCK14366333 +Ref: 479d14366333 +Ref: library/msvcrt msvcrt setmode14366440 +Ref: 479e14366440 +Ref: library/msvcrt msvcrt open_osfhandle14366679 +Ref: 41ee14366679 +Ref: library/msvcrt msvcrt get_osfhandle14367331 +Ref: 41ec14367331 +Node: Console I/O14367591 +Ref: library/msvcrt console-i-o14367738 +Ref: 479f14367738 +Ref: library/msvcrt msvcrt-console14367738 +Ref: 47a014367738 +Ref: library/msvcrt msvcrt kbhit14367781 +Ref: 47a114367781 +Ref: library/msvcrt msvcrt getch14367905 +Ref: 47a214367905 +Ref: library/msvcrt msvcrt getwch14368392 +Ref: 13c114368392 +Ref: library/msvcrt msvcrt getche14368504 +Ref: 47a314368504 +Ref: library/msvcrt msvcrt getwche14368651 +Ref: 13c214368651 +Ref: library/msvcrt msvcrt putch14368765 +Ref: 47a414368765 +Ref: library/msvcrt msvcrt putwch14368869 +Ref: 13c314368869 +Ref: library/msvcrt msvcrt ungetch14368993 +Ref: 47a514368993 +Ref: library/msvcrt msvcrt ungetwch14369208 +Ref: 47a614369208 +Node: Other Functions14369336 +Ref: library/msvcrt msvcrt-other14369459 +Ref: 47a714369459 +Ref: library/msvcrt other-functions14369459 +Ref: 47a814369459 +Ref: library/msvcrt msvcrt heapmin14369510 +Ref: 47a914369510 +Ref: library/msvcrt msvcrt set_error_mode14369703 +Ref: 47aa14369703 +Ref: library/msvcrt msvcrt OUT_TO_DEFAULT14370075 +Ref: 47ac14370075 +Ref: library/msvcrt msvcrt OUT_TO_STDERR14370218 +Ref: 47ad14370218 +Ref: library/msvcrt msvcrt OUT_TO_MSGBOX14370346 +Ref: 47ae14370346 +Ref: library/msvcrt msvcrt REPORT_ERRMODE14370471 +Ref: 47ab14370471 +Ref: library/msvcrt msvcrt CrtSetReportMode14370605 +Ref: 47af14370605 +Ref: library/msvcrt msvcrt CrtSetReportFile14370993 +Ref: 47b014370993 +Ref: library/msvcrt msvcrt CRT_WARN14371390 +Ref: 47b214371390 +Ref: library/msvcrt msvcrt CRT_ERROR14371505 +Ref: 47b314371505 +Ref: library/msvcrt msvcrt CRT_ASSERT14371621 +Ref: 47b414371621 +Ref: library/msvcrt msvcrt CRTDBG_MODE_DEBUG14371676 +Ref: 47b514371676 +Ref: library/msvcrt msvcrt CRTDBG_MODE_FILE14371772 +Ref: 47b114371772 +Ref: library/msvcrt msvcrt CRTDBG_MODE_WNDW14371989 +Ref: 47b614371989 +Ref: library/msvcrt msvcrt CRTDBG_REPORT_MODE14372147 +Ref: 47b714372147 +Ref: library/msvcrt msvcrt CRT_ASSEMBLY_VERSION14372239 +Ref: 134b14372239 +Ref: library/msvcrt msvcrt VC_ASSEMBLY_PUBLICKEYTOKEN14372349 +Ref: 134c14372349 +Ref: library/msvcrt msvcrt LIBRARIES_ASSEMBLY_NAME_PREFIX14372478 +Ref: 134d14372478 +Node: winreg — Windows registry access14372613 +Ref: library/winreg doc14372829 +Ref: 47b814372829 +Ref: library/winreg module-winreg14372829 +Ref: 11614372829 +Ref: library/winreg winreg-windows-registry-access14372829 +Ref: 47b914372829 +Ref: library/winreg exception-changed14373243 +Ref: 47bb14373243 +Node: Functions<13>14373484 +Ref: library/winreg functions14373590 +Ref: 47bc14373590 +Ref: library/winreg id114373590 +Ref: 47bd14373590 +Ref: library/winreg winreg CloseKey14373674 +Ref: 47be14373674 +Ref: library/winreg winreg ConnectRegistry14373995 +Ref: 41f214373995 +Ref: library/winreg winreg CreateKey14374687 +Ref: 41f314374687 +Ref: library/winreg winreg CreateKeyEx14375649 +Ref: 134e14375649 +Ref: library/winreg winreg DeleteKey14376989 +Ref: 41f414376989 +Ref: library/winreg winreg DeleteKeyEx14377738 +Ref: 134f14377738 +Ref: library/winreg winreg DeleteValue14379017 +Ref: 41f514379017 +Ref: library/winreg winreg EnumKey14379385 +Ref: 41f614379385 +Ref: library/winreg winreg EnumValue14380052 +Ref: 41f714380052 +Ref: library/winreg winreg ExpandEnvironmentStrings14381318 +Ref: 13c414381318 +Ref: library/winreg winreg FlushKey14381669 +Ref: 47c514381669 +Ref: library/winreg winreg LoadKey14382489 +Ref: 41f814382489 +Ref: library/winreg winreg OpenKey14383682 +Ref: 41f914383682 +Ref: library/winreg winreg OpenKeyEx14383755 +Ref: 47c814383755 +Ref: library/winreg winreg QueryInfoKey14384838 +Ref: 41fb14384838 +Ref: library/winreg winreg QueryValue14385734 +Ref: 41fc14385734 +Ref: library/winreg winreg QueryValueEx14386611 +Ref: 41fd14386611 +Ref: library/winreg winreg SaveKey14387487 +Ref: 41fe14387487 +Ref: library/winreg winreg SetValue14388529 +Ref: 41ff14388529 +Ref: library/winreg winreg SetValueEx14389708 +Ref: 178d14389708 +Ref: library/winreg winreg DisableReflectionKey14390956 +Ref: 135014390956 +Ref: library/winreg winreg EnableReflectionKey14391588 +Ref: 135114391588 +Ref: library/winreg winreg QueryReflectionKey14392097 +Ref: 135214392097 +Ref: Functions<13>-Footnote-114392601 +Ref: Functions<13>-Footnote-214392678 +Node: Constants<10>14392755 +Ref: library/winreg constants14392893 +Ref: 47cd14392893 +Ref: library/winreg id214392893 +Ref: 47ce14392893 +Node: HKEY_* Constants14393080 +Ref: library/winreg hkey-constants14393168 +Ref: 47c014393168 +Ref: library/winreg id314393168 +Ref: 47cf14393168 +Ref: library/winreg winreg HKEY_CLASSES_ROOT14393221 +Ref: 47d014393221 +Ref: library/winreg winreg HKEY_CURRENT_USER14393472 +Ref: 47d114393472 +Ref: library/winreg winreg HKEY_LOCAL_MACHINE14393775 +Ref: 47c714393775 +Ref: library/winreg winreg HKEY_USERS14393999 +Ref: 47c614393999 +Ref: library/winreg winreg HKEY_PERFORMANCE_DATA14394208 +Ref: 47d214394208 +Ref: library/winreg winreg HKEY_CURRENT_CONFIG14394475 +Ref: 47d314394475 +Ref: library/winreg winreg HKEY_DYN_DATA14394610 +Ref: 47d414394610 +Node: Access Rights14394702 +Ref: library/winreg access-rights14394810 +Ref: 47c214394810 +Ref: library/winreg id414394810 +Ref: 47d514394810 +Ref: library/winreg winreg KEY_ALL_ACCESS14394921 +Ref: 47d614394921 +Ref: library/winreg winreg KEY_WRITE14395210 +Ref: 47c114395210 +Ref: library/winreg winreg KEY_READ14395363 +Ref: 47c914395363 +Ref: library/winreg winreg KEY_EXECUTE14395542 +Ref: 47dc14395542 +Ref: library/winreg winreg KEY_QUERY_VALUE14395614 +Ref: 47d714395614 +Ref: library/winreg winreg KEY_SET_VALUE14395702 +Ref: 47cb14395702 +Ref: library/winreg winreg KEY_CREATE_SUB_KEY14395793 +Ref: 47d814395793 +Ref: library/winreg winreg KEY_ENUMERATE_SUB_KEYS14395883 +Ref: 47d914395883 +Ref: library/winreg winreg KEY_NOTIFY14395983 +Ref: 47da14395983 +Ref: library/winreg winreg KEY_CREATE_LINK14396117 +Ref: 47db14396117 +Ref: Access Rights-Footnote-114396248 +Node: 64-bit Specific14396325 +Ref: library/winreg bit-access-rights14396390 +Ref: 47dd14396390 +Ref: library/winreg bit-specific14396390 +Ref: 47de14396390 +Ref: library/winreg winreg KEY_WOW64_64KEY14396509 +Ref: 47c314396509 +Ref: library/winreg winreg KEY_WOW64_32KEY14396697 +Ref: 47df14396697 +Ref: 64-bit Specific-Footnote-114396921 +Node: Value Types14396993 +Ref: library/winreg id514397076 +Ref: 47e014397076 +Ref: library/winreg value-types14397076 +Ref: 47cc14397076 +Ref: library/winreg winreg REG_BINARY14397171 +Ref: 47e114397171 +Ref: library/winreg winreg REG_DWORD14397231 +Ref: 47e214397231 +Ref: library/winreg winreg REG_DWORD_LITTLE_ENDIAN14397280 +Ref: 47e314397280 +Ref: library/winreg winreg REG_DWORD_BIG_ENDIAN14397412 +Ref: 47e414397412 +Ref: library/winreg winreg REG_EXPAND_SZ14397495 +Ref: 47c414397495 +Ref: library/winreg winreg REG_LINK14397624 +Ref: 47e514397624 +Ref: library/winreg winreg REG_MULTI_SZ14397682 +Ref: 19dd14397682 +Ref: library/winreg winreg REG_NONE14397848 +Ref: 47e614397848 +Ref: library/winreg winreg REG_QWORD14397904 +Ref: d0214397904 +Ref: library/winreg winreg REG_QWORD_LITTLE_ENDIAN14397983 +Ref: 47e714397983 +Ref: library/winreg winreg REG_RESOURCE_LIST14398142 +Ref: 47e814398142 +Ref: library/winreg winreg REG_FULL_RESOURCE_DESCRIPTOR14398215 +Ref: 47e914398215 +Ref: library/winreg winreg REG_RESOURCE_REQUIREMENTS_LIST14398288 +Ref: 47ea14398288 +Ref: library/winreg winreg REG_SZ14398369 +Ref: 47ca14398369 +Ref: Value Types-Footnote-114398462 +Node: Registry Handle Objects14398539 +Ref: library/winreg handle-object14398655 +Ref: 47ba14398655 +Ref: library/winreg registry-handle-objects14398655 +Ref: 47eb14398655 +Ref: library/winreg winreg PyHKEY Close14399816 +Ref: 47bf14399816 +Ref: library/winreg winreg PyHKEY Detach14399948 +Ref: 41fa14399948 +Ref: library/winreg winreg PyHKEY __enter__14400547 +Ref: 47ec14400547 +Ref: library/winreg winreg PyHKEY __exit__14400579 +Ref: 47ed14400579 +Node: winsound — Sound-playing interface for Windows14400974 +Ref: library/winsound doc14401130 +Ref: 47ee14401130 +Ref: library/winsound module-winsound14401130 +Ref: 11714401130 +Ref: library/winsound winsound-sound-playing-interface-for-windows14401130 +Ref: 47ef14401130 +Ref: library/winsound winsound Beep14401480 +Ref: d0414401480 +Ref: library/winsound winsound PlaySound14401868 +Ref: d0614401868 +Ref: library/winsound winsound MessageBeep14402440 +Ref: d0514402440 +Ref: library/winsound winsound SND_FILENAME14403049 +Ref: 47f014403049 +Ref: library/winsound winsound SND_ALIAS14403182 +Ref: 47f114403182 +Ref: library/winsound winsound SND_LOOP14404800 +Ref: 47f314404800 +Ref: library/winsound winsound SND_MEMORY14404987 +Ref: 47f514404987 +Ref: library/winsound winsound SND_PURGE14405349 +Ref: 47f614405349 +Ref: library/winsound winsound SND_ASYNC14405509 +Ref: 47f414405509 +Ref: library/winsound winsound SND_NODEFAULT14405605 +Ref: 47f214405605 +Ref: library/winsound winsound SND_NOSTOP14405728 +Ref: 47f714405728 +Ref: library/winsound winsound SND_NOWAIT14405808 +Ref: 47f814405808 +Ref: library/winsound winsound SND_APPLICATION14405966 +Ref: 47f914405966 +Ref: library/winsound winsound MB_ICONASTERISK14406201 +Ref: 47fa14406201 +Ref: library/winsound winsound MB_ICONEXCLAMATION14406279 +Ref: 47fb14406279 +Ref: library/winsound winsound MB_ICONHAND14406364 +Ref: 47fc14406364 +Ref: library/winsound winsound MB_ICONQUESTION14406435 +Ref: 47fd14406435 +Ref: library/winsound winsound MB_OK14406514 +Ref: 47fe14406514 +Node: Unix Specific Services14406582 +Ref: library/unix doc14406748 +Ref: 47ff14406748 +Ref: library/unix unix14406748 +Ref: 480014406748 +Ref: library/unix unix-specific-services14406748 +Ref: 480114406748 +Node: posix — The most common POSIX system calls14407369 +Ref: library/posix doc14407510 +Ref: 480214407510 +Ref: library/posix module-posix14407510 +Ref: ad14407510 +Ref: library/posix posix-the-most-common-posix-system-calls14407510 +Ref: 480314407510 +Node: Large File Support14408743 +Ref: library/posix large-file-support14408874 +Ref: 480414408874 +Ref: library/posix posix-large-files14408874 +Ref: 480514408874 +Node: Notable Module Contents14409828 +Ref: library/posix notable-module-contents14409959 +Ref: 480614409959 +Ref: library/posix posix-contents14409959 +Ref: 480714409959 +Ref: library/posix posix environ14410160 +Ref: 480814410160 +Node: pwd — The password database14411350 +Ref: library/pwd doc14411526 +Ref: 480914411526 +Ref: library/pwd module-pwd14411526 +Ref: b214411526 +Ref: library/pwd pwd-the-password-database14411526 +Ref: 480a14411526 +Ref: library/pwd pwd getpwuid14413694 +Ref: 1a2f14413694 +Ref: library/pwd pwd getpwnam14413800 +Ref: 320714413800 +Ref: library/pwd pwd getpwall14413901 +Ref: 480b14413901 +Node: grp — The group database14414122 +Ref: library/grp doc14414289 +Ref: 480c14414289 +Ref: library/grp grp-the-group-database14414289 +Ref: 480d14414289 +Ref: library/grp module-grp14414289 +Ref: 6614414289 +Ref: library/grp grp getgrgid14415899 +Ref: d2614415899 +Ref: library/grp grp getgrnam14416201 +Ref: 320614416201 +Ref: library/grp grp getgrall14416377 +Ref: 159714416377 +Node: termios — POSIX style tty control14416580 +Ref: library/termios doc14416752 +Ref: 480e14416752 +Ref: library/termios module-termios14416752 +Ref: e114416752 +Ref: library/termios termios-posix-style-tty-control14416752 +Ref: 480f14416752 +Ref: library/termios termios tcgetattr14417767 +Ref: 167614417767 +Ref: library/termios termios tcsetattr14418345 +Ref: 16f814418345 +Ref: library/termios termios TCSANOW14418624 +Ref: 481014418624 +Ref: library/termios termios TCSADRAIN14418698 +Ref: 481114418698 +Ref: library/termios termios TCSAFLUSH14418799 +Ref: 481214418799 +Ref: library/termios termios tcsendbreak14418942 +Ref: 481314418942 +Ref: library/termios termios tcdrain14419156 +Ref: 481414419156 +Ref: library/termios termios tcflush14419279 +Ref: 481514419279 +Ref: library/termios termios tcflow14419537 +Ref: 481614419537 +Ref: library/termios termios tcgetwinsize14419817 +Ref: 481714419817 +Ref: library/termios termios tcsetwinsize14420061 +Ref: 481814420061 +Ref: termios — POSIX style tty control-Footnote-114420670 +Node: Example<15>14420717 +Ref: library/termios example14420800 +Ref: 481914420800 +Ref: library/termios termios-example14420800 +Ref: 481a14420800 +Node: tty — Terminal control functions14421558 +Ref: library/tty doc14421737 +Ref: 481b14421737 +Ref: library/tty module-tty14421737 +Ref: 10014421737 +Ref: library/tty tty-terminal-control-functions14421737 +Ref: 481c14421737 +Ref: library/tty tty cfmakeraw14422193 +Ref: 16cc14422193 +Ref: library/tty tty cfmakecbreak14422417 +Ref: 167914422417 +Ref: library/tty tty setraw14422985 +Ref: 16cb14422985 +Ref: library/tty tty setcbreak14423469 +Ref: 167814423469 +Ref: tty — Terminal control functions-Footnote-114424474 +Node: pty — Pseudo-terminal utilities14424537 +Ref: library/pty doc14424723 +Ref: 481d14424723 +Ref: library/pty module-pty14424723 +Ref: b114424723 +Ref: library/pty pty-pseudo-terminal-utilities14424723 +Ref: 481e14424723 +Ref: library/pty pty fork14425403 +Ref: 175814425403 +Ref: library/pty pty openpty14426001 +Ref: 2d114426001 +Ref: library/pty pty spawn14426280 +Ref: f7d14426280 +Ref: pty — Pseudo-terminal utilities-Footnote-114428547 +Node: Example<16>14428610 +Ref: library/pty example14428691 +Ref: 481f14428691 +Ref: Example<16>-Footnote-114429912 +Node: fcntl — The fcntl and ioctl system calls14429958 +Ref: library/fcntl doc14430149 +Ref: 482014430149 +Ref: library/fcntl fcntl-the-fcntl-and-ioctl-system-calls14430149 +Ref: 482114430149 +Ref: library/fcntl module-fcntl14430149 +Ref: 5914430149 +Ref: library/fcntl fcntl fcntl14433611 +Ref: 344b14433611 +Ref: library/fcntl fcntl ioctl14435504 +Ref: 144314435504 +Ref: library/fcntl fcntl flock14438096 +Ref: 41eb14438096 +Ref: library/fcntl fcntl lockf14438620 +Ref: 13b814438620 +Ref: library/fcntl fcntl LOCK_UN14438963 +Ref: 482214438963 +Ref: library/fcntl fcntl LOCK_SH14439030 +Ref: 482314439030 +Ref: library/fcntl fcntl LOCK_EX14439094 +Ref: 482414439094 +Ref: library/fcntl fcntl LOCK_NB14439162 +Ref: 482514439162 +Ref: fcntl — The fcntl and ioctl system calls-Footnote-114441463 +Ref: fcntl — The fcntl and ioctl system calls-Footnote-214441508 +Ref: fcntl — The fcntl and ioctl system calls-Footnote-314441553 +Node: resource — Resource usage information14441598 +Ref: library/resource doc14441795 +Ref: 482614441795 +Ref: library/resource module-resource14441795 +Ref: bc14441795 +Ref: library/resource resource-resource-usage-information14441795 +Ref: 482714441795 +Ref: library/resource resource error14442322 +Ref: 482814442322 +Ref: resource — Resource usage information-Footnote-114442596 +Node: Resource Limits14442638 +Ref: library/resource resource-limits14442752 +Ref: 482914442752 +Ref: library/resource resource RLIM_INFINITY14443632 +Ref: 151c14443632 +Ref: library/resource resource getrlimit14443736 +Ref: 151b14443736 +Ref: library/resource resource setrlimit14444030 +Ref: 151d14444030 +Ref: library/resource resource prlimit14445189 +Ref: f8414445189 +Ref: library/resource resource RLIMIT_CORE14446785 +Ref: 418f14446785 +Ref: library/resource resource RLIMIT_CPU14447046 +Ref: 482b14447046 +Ref: library/resource resource RLIMIT_FSIZE14447406 +Ref: 482c14447406 +Ref: library/resource resource RLIMIT_DATA14447502 +Ref: 482d14447502 +Ref: library/resource resource RLIMIT_STACK14447593 +Ref: 482e14447593 +Ref: library/resource resource RLIMIT_RSS14447790 +Ref: 482f14447790 +Ref: library/resource resource RLIMIT_NPROC14447908 +Ref: 483014447908 +Ref: library/resource resource RLIMIT_NOFILE14448011 +Ref: 482a14448011 +Ref: library/resource resource RLIMIT_OFILE14448125 +Ref: 483114448125 +Ref: library/resource resource RLIMIT_MEMLOCK14448208 +Ref: 483214448208 +Ref: library/resource resource RLIMIT_VMEM14448306 +Ref: 483314448306 +Ref: library/resource resource RLIMIT_AS14448456 +Ref: 483414448456 +Ref: library/resource resource RLIMIT_MSGQUEUE14448577 +Ref: f8514448577 +Ref: library/resource resource RLIMIT_NICE14448764 +Ref: f8614448764 +Ref: library/resource resource RLIMIT_RTPRIO14448959 +Ref: f8714448959 +Ref: library/resource resource RLIMIT_RTTIME14449116 +Ref: f8814449116 +Ref: library/resource resource RLIMIT_SIGPENDING14449371 +Ref: f8914449371 +Ref: library/resource resource RLIMIT_SBSIZE14449543 +Ref: f8a14449543 +Ref: library/resource resource RLIMIT_SWAP14449839 +Ref: f8b14449839 +Ref: library/resource resource RLIMIT_NPTS14450217 +Ref: f8c14450217 +Ref: library/resource resource RLIMIT_KQUEUES14450389 +Ref: 18e814450389 +Ref: Resource Limits-Footnote-114450608 +Ref: Resource Limits-Footnote-214450657 +Ref: Resource Limits-Footnote-314450706 +Node: Resource Usage14450773 +Ref: library/resource resource-usage14450887 +Ref: 483514450887 +Ref: library/resource resource getrusage14451002 +Ref: 13fc14451002 +Ref: library/resource resource getpagesize14455498 +Ref: 483614455498 +Ref: library/resource resource RUSAGE_SELF14455803 +Ref: 483714455803 +Ref: library/resource resource RUSAGE_CHILDREN14456004 +Ref: 483814456004 +Ref: library/resource resource RUSAGE_BOTH14456204 +Ref: 483914456204 +Ref: library/resource resource RUSAGE_THREAD14456402 +Ref: 483a14456402 +Ref: Resource Usage-Footnote-114456635 +Node: syslog — Unix syslog library routines14456684 +Ref: library/syslog doc14456830 +Ref: 483b14456830 +Ref: library/syslog module-syslog14456830 +Ref: dc14456830 +Ref: library/syslog syslog-unix-syslog-library-routines14456830 +Ref: 483c14456830 +Ref: library/syslog syslog syslog14457467 +Ref: 53d14457467 +Ref: library/syslog syslog openlog14458931 +Ref: 53b14458931 +Ref: library/syslog syslog closelog14460284 +Ref: 53c14460284 +Ref: library/syslog syslog setlogmask14461147 +Ref: 41f014461147 +Ref: library/syslog syslog LOG_EMERG14461752 +Ref: 483f14461752 +Ref: library/syslog syslog LOG_ALERT14461779 +Ref: 484014461779 +Ref: library/syslog syslog LOG_CRIT14461806 +Ref: 484114461806 +Ref: library/syslog syslog LOG_ERR14461832 +Ref: 484214461832 +Ref: library/syslog syslog LOG_WARNING14461857 +Ref: 484314461857 +Ref: library/syslog syslog LOG_NOTICE14461886 +Ref: 484414461886 +Ref: library/syslog syslog LOG_INFO14461914 +Ref: 483d14461914 +Ref: library/syslog syslog LOG_DEBUG14461940 +Ref: 484514461940 +Ref: library/syslog syslog LOG_AUTH14462005 +Ref: 484614462005 +Ref: library/syslog syslog LOG_AUTHPRIV14462031 +Ref: 484714462031 +Ref: library/syslog syslog LOG_CRON14462061 +Ref: 484814462061 +Ref: library/syslog syslog LOG_DAEMON14462087 +Ref: 484914462087 +Ref: library/syslog syslog LOG_FTP14462115 +Ref: 484a14462115 +Ref: library/syslog syslog LOG_INSTALL14462140 +Ref: 484b14462140 +Ref: library/syslog syslog LOG_KERN14462169 +Ref: 484c14462169 +Ref: library/syslog syslog LOG_LAUNCHD14462195 +Ref: 484d14462195 +Ref: library/syslog syslog LOG_LPR14462224 +Ref: 484e14462224 +Ref: library/syslog syslog LOG_MAIL14462249 +Ref: 484f14462249 +Ref: library/syslog syslog LOG_NETINFO14462275 +Ref: 485014462275 +Ref: library/syslog syslog LOG_NEWS14462304 +Ref: 485114462304 +Ref: library/syslog syslog LOG_RAS14462330 +Ref: 485214462330 +Ref: library/syslog syslog LOG_REMOTEAUTH14462355 +Ref: 485314462355 +Ref: library/syslog syslog LOG_SYSLOG14462387 +Ref: 485414462387 +Ref: library/syslog syslog LOG_USER14462415 +Ref: 483e14462415 +Ref: library/syslog syslog LOG_UUCP14462441 +Ref: 485514462441 +Ref: library/syslog syslog LOG_LOCAL014462467 +Ref: 485614462467 +Ref: library/syslog syslog LOG_LOCAL114462495 +Ref: 485714462495 +Ref: library/syslog syslog LOG_LOCAL214462523 +Ref: 485814462523 +Ref: library/syslog syslog LOG_LOCAL314462551 +Ref: 485914462551 +Ref: library/syslog syslog LOG_LOCAL414462579 +Ref: 485a14462579 +Ref: library/syslog syslog LOG_LOCAL514462607 +Ref: 485b14462607 +Ref: library/syslog syslog LOG_LOCAL614462635 +Ref: 485c14462635 +Ref: library/syslog syslog LOG_LOCAL714462663 +Ref: 485d14462663 +Ref: library/syslog syslog LOG_PID14463121 +Ref: 485e14463121 +Ref: library/syslog syslog LOG_CONS14463146 +Ref: 485f14463146 +Ref: library/syslog syslog LOG_NDELAY14463172 +Ref: 486014463172 +Ref: library/syslog syslog LOG_ODELAY14463200 +Ref: 486114463200 +Ref: library/syslog syslog LOG_NOWAIT14463228 +Ref: 486214463228 +Ref: library/syslog syslog LOG_PERROR14463256 +Ref: 486314463256 +Node: Examples<36>14463476 +Ref: library/syslog examples14463564 +Ref: 486414463564 +Node: Simple example14463630 +Ref: library/syslog simple-example14463693 +Ref: 486514463693 +Node: Modules command-line interface CLI14464203 +Ref: library/cmdline doc14464359 +Ref: 486614464359 +Ref: library/cmdline modules-command-line-interface-cli14464359 +Ref: 486714464359 +Node: Superseded Modules14465893 +Ref: library/superseded doc14466042 +Ref: 486814466042 +Ref: library/superseded superseded14466042 +Ref: 486914466042 +Ref: library/superseded superseded-modules14466042 +Ref: 486a14466042 +Ref: Superseded Modules-Footnote-114467141 +Node: getopt — C-style parser for command line options14467183 +Ref: library/getopt doc14467288 +Ref: 486b14467288 +Ref: library/getopt getopt-c-style-parser-for-command-line-options14467288 +Ref: 486c14467288 +Ref: library/getopt module-getopt14467288 +Ref: 6114467288 +Ref: library/getopt getopt getopt14468712 +Ref: 148414468712 +Ref: library/getopt getopt gnu_getopt14470899 +Ref: 148314470899 +Ref: library/getopt getopt GetoptError14471479 +Ref: 486d14471479 +Ref: library/getopt getopt error14472059 +Ref: 486e14472059 +Ref: getopt — C-style parser for command line options-Footnote-114475268 +Node: Removed Modules14475334 +Ref: library/removed doc14475475 +Ref: 486f14475475 +Ref: library/removed removed14475475 +Ref: 487014475475 +Ref: library/removed removed-modules14475475 +Ref: 487114475475 +Node: aifc — Read and write AIFF and AIFC files14476798 +Ref: library/aifc doc14476959 +Ref: 487214476959 +Ref: library/aifc aifc-read-and-write-aiff-and-aifc-files14476959 +Ref: 487314476959 +Ref: library/aifc module-aifc14476959 +Ref: 514476959 +Ref: aifc — Read and write AIFF and AIFC files-Footnote-114477430 +Ref: aifc — Read and write AIFF and AIFC files-Footnote-214477472 +Node: asynchat — Asynchronous socket command/response handler14477527 +Ref: library/asynchat doc14477737 +Ref: 487414477737 +Ref: library/asynchat asynchat-asynchronous-socket-command-response-handler14477737 +Ref: 487514477737 +Ref: library/asynchat module-asynchat14477737 +Ref: 914477737 +Ref: asynchat — Asynchronous socket command/response handler-Footnote-114478300 +Ref: asynchat — Asynchronous socket command/response handler-Footnote-214478342 +Node: asyncore — Asynchronous socket handler14478401 +Ref: library/asyncore doc14478605 +Ref: 487614478605 +Ref: library/asyncore asyncore-asynchronous-socket-handler14478605 +Ref: 487714478605 +Ref: library/asyncore module-asyncore14478605 +Ref: b14478605 +Ref: asyncore — Asynchronous socket handler-Footnote-114479134 +Ref: asyncore — Asynchronous socket handler-Footnote-214479176 +Node: audioop — Manipulate raw audio data14479235 +Ref: library/audioop doc14479422 +Ref: 487814479422 +Ref: library/audioop audioop-manipulate-raw-audio-data14479422 +Ref: 487914479422 +Ref: library/audioop module-audioop14479422 +Ref: d14479422 +Ref: audioop — Manipulate raw audio data-Footnote-114479884 +Ref: audioop — Manipulate raw audio data-Footnote-214479926 +Node: cgi — Common Gateway Interface support14479984 +Ref: library/cgi doc14480174 +Ref: 487a14480174 +Ref: library/cgi cgi-common-gateway-interface-support14480174 +Ref: 487b14480174 +Ref: library/cgi module-cgi14480174 +Ref: 1514480174 +Ref: cgi — Common Gateway Interface support-Footnote-114480798 +Ref: cgi — Common Gateway Interface support-Footnote-214480840 +Ref: cgi — Common Gateway Interface support-Footnote-314480885 +Node: cgitb — Traceback manager for CGI scripts14480939 +Ref: library/cgitb doc14481123 +Ref: 487c14481123 +Ref: library/cgitb cgitb-traceback-manager-for-cgi-scripts14481123 +Ref: 487d14481123 +Ref: library/cgitb module-cgitb14481123 +Ref: 1614481123 +Ref: cgitb — Traceback manager for CGI scripts-Footnote-114481758 +Ref: cgitb — Traceback manager for CGI scripts-Footnote-214481800 +Ref: cgitb — Traceback manager for CGI scripts-Footnote-314481845 +Node: chunk — Read IFF chunked data14481901 +Ref: library/chunk doc14482087 +Ref: 487e14482087 +Ref: library/chunk chunk-read-iff-chunked-data14482087 +Ref: 487f14482087 +Ref: library/chunk module-chunk14482087 +Ref: 1714482087 +Ref: chunk — Read IFF chunked data-Footnote-114482535 +Ref: chunk — Read IFF chunked data-Footnote-214482577 +Node: crypt — Function to check Unix passwords14482633 +Ref: library/crypt doc14482828 +Ref: 488014482828 +Ref: library/crypt crypt-function-to-check-unix-passwords14482828 +Ref: 488114482828 +Ref: library/crypt module-crypt14482828 +Ref: 2814482828 +Ref: crypt — Function to check Unix passwords-Footnote-114483565 +Ref: crypt — Function to check Unix passwords-Footnote-214483607 +Ref: crypt — Function to check Unix passwords-Footnote-314483653 +Ref: crypt — Function to check Unix passwords-Footnote-414483694 +Ref: crypt — Function to check Unix passwords-Footnote-514483740 +Ref: crypt — Function to check Unix passwords-Footnote-614483782 +Node: distutils — Building and installing Python modules14483838 +Ref: library/distutils doc14484043 +Ref: 488214484043 +Ref: library/distutils distutils-building-and-installing-python-modules14484043 +Ref: 488314484043 +Ref: library/distutils module-distutils14484043 +Ref: 3914484043 +Ref: distutils — Building and installing Python modules-Footnote-114484568 +Ref: distutils — Building and installing Python modules-Footnote-214484610 +Ref: distutils — Building and installing Python modules-Footnote-314484669 +Node: imghdr — Determine the type of an image14484729 +Ref: library/imghdr doc14484927 +Ref: 488414484927 +Ref: library/imghdr imghdr-determine-the-type-of-an-image14484927 +Ref: 488514484927 +Ref: library/imghdr module-imghdr14484927 +Ref: 7514484927 +Ref: imghdr — Determine the type of an image-Footnote-114485569 +Ref: imghdr — Determine the type of an image-Footnote-214485611 +Ref: imghdr — Determine the type of an image-Footnote-314485654 +Ref: imghdr — Determine the type of an image-Footnote-414485698 +Ref: imghdr — Determine the type of an image-Footnote-514485745 +Node: imp — Access the import internals14485802 +Ref: library/imp doc14485981 +Ref: 488614485981 +Ref: library/imp imp-access-the-import-internals14485981 +Ref: 488714485981 +Ref: library/imp module-imp14485981 +Ref: 7614485981 +Ref: imp — Access the import internals-Footnote-114486503 +Node: mailcap — Mailcap file handling14486557 +Ref: library/mailcap doc14486746 +Ref: 488814486746 +Ref: library/mailcap mailcap-mailcap-file-handling14486746 +Ref: 488914486746 +Ref: library/mailcap module-mailcap14486746 +Ref: 8c14486746 +Ref: mailcap — Mailcap file handling-Footnote-114487202 +Ref: mailcap — Mailcap file handling-Footnote-214487244 +Node: msilib — Read and write Microsoft Installer files14487302 +Ref: library/msilib doc14487501 +Ref: 488a14487501 +Ref: library/msilib module-msilib14487501 +Ref: 9214487501 +Ref: library/msilib msilib-read-and-write-microsoft-installer-files14487501 +Ref: 488b14487501 +Ref: msilib — Read and write Microsoft Installer files-Footnote-114487992 +Ref: msilib — Read and write Microsoft Installer files-Footnote-214488034 +Node: nis — Interface to Sun’s NIS Yellow Pages14488091 +Ref: library/nis doc14488289 +Ref: 488c14488289 +Ref: library/nis module-nis14488289 +Ref: 9c14488289 +Ref: library/nis nis-interface-to-suns-nis-yellow-pages14488289 +Ref: 488d14488289 +Ref: nis — Interface to Sun’s NIS Yellow Pages-Footnote-114488767 +Ref: nis — Interface to Sun’s NIS Yellow Pages-Footnote-214488809 +Node: nntplib — NNTP protocol client14488863 +Ref: library/nntplib doc14489064 +Ref: 488e14489064 +Ref: library/nntplib module-nntplib14489064 +Ref: 9d14489064 +Ref: library/nntplib nntplib-nntp-protocol-client14489064 +Ref: 488f14489064 +Ref: nntplib — NNTP protocol client-Footnote-114489518 +Ref: nntplib — NNTP protocol client-Footnote-214489560 +Node: ossaudiodev — Access to OSS-compatible audio devices14489618 +Ref: library/ossaudiodev doc14489812 +Ref: 489014489812 +Ref: library/ossaudiodev module-ossaudiodev14489812 +Ref: a314489812 +Ref: library/ossaudiodev ossaudiodev-access-to-oss-compatible-audio-devices14489812 +Ref: 489114489812 +Ref: ossaudiodev — Access to OSS-compatible audio devices-Footnote-114490314 +Ref: ossaudiodev — Access to OSS-compatible audio devices-Footnote-214490356 +Node: pipes — Interface to shell pipelines14490418 +Ref: library/pipes doc14490601 +Ref: 489214490601 +Ref: library/pipes module-pipes14490601 +Ref: a814490601 +Ref: library/pipes pipes-interface-to-shell-pipelines14490601 +Ref: 489314490601 +Ref: pipes — Interface to shell pipelines-Footnote-114491132 +Ref: pipes — Interface to shell pipelines-Footnote-214491174 +Node: smtpd — SMTP Server14491230 +Ref: library/smtpd doc14491398 +Ref: 489414491398 +Ref: library/smtpd module-smtpd14491398 +Ref: c914491398 +Ref: library/smtpd smtpd-smtp-server14491398 +Ref: 489514491398 +Ref: smtpd — SMTP Server-Footnote-114491959 +Ref: smtpd — SMTP Server-Footnote-214492001 +Ref: smtpd — SMTP Server-Footnote-314492044 +Node: sndhdr — Determine type of sound file14492100 +Ref: library/sndhdr doc14492267 +Ref: 489614492267 +Ref: library/sndhdr module-sndhdr14492267 +Ref: cb14492267 +Ref: library/sndhdr sndhdr-determine-type-of-sound-file14492267 +Ref: 489714492267 +Ref: sndhdr — Determine type of sound file-Footnote-114492903 +Ref: sndhdr — Determine type of sound file-Footnote-214492945 +Ref: sndhdr — Determine type of sound file-Footnote-314492988 +Ref: sndhdr — Determine type of sound file-Footnote-414493032 +Ref: sndhdr — Determine type of sound file-Footnote-514493079 +Node: spwd — The shadow password database14493136 +Ref: library/spwd doc14493319 +Ref: 489814493319 +Ref: library/spwd module-spwd14493319 +Ref: ce14493319 +Ref: library/spwd spwd-the-shadow-password-database14493319 +Ref: 489914493319 +Ref: spwd — The shadow password database-Footnote-114493916 +Ref: spwd — The shadow password database-Footnote-214493958 +Ref: spwd — The shadow password database-Footnote-314494003 +Node: sunau — Read and write Sun AU files14494058 +Ref: library/sunau doc14494229 +Ref: 489a14494229 +Ref: library/sunau module-sunau14494229 +Ref: d714494229 +Ref: library/sunau sunau-read-and-write-sun-au-files14494229 +Ref: 489b14494229 +Ref: sunau — Read and write Sun AU files-Footnote-114494691 +Ref: sunau — Read and write Sun AU files-Footnote-214494733 +Node: telnetlib — Telnet client14494789 +Ref: library/telnetlib doc14494962 +Ref: 489c14494962 +Ref: library/telnetlib module-telnetlib14494962 +Ref: df14494962 +Ref: library/telnetlib telnetlib-telnet-client14494962 +Ref: 489d14494962 +Ref: telnetlib — Telnet client-Footnote-114495562 +Ref: telnetlib — Telnet client-Footnote-214495604 +Ref: telnetlib — Telnet client-Footnote-314495649 +Ref: telnetlib — Telnet client-Footnote-414495692 +Node: uu — Encode and decode uuencode files14495752 +Ref: library/uu doc14495925 +Ref: 489e14495925 +Ref: library/uu module-uu14495925 +Ref: 10f14495925 +Ref: library/uu uu-encode-and-decode-uuencode-files14495925 +Ref: 489f14495925 +Ref: uu — Encode and decode uuencode files-Footnote-114496388 +Ref: uu — Encode and decode uuencode files-Footnote-214496430 +Node: xdrlib — Encode and decode XDR data14496483 +Ref: library/xdrlib doc14496620 +Ref: 48a014496620 +Ref: library/xdrlib module-xdrlib14496620 +Ref: 11f14496620 +Ref: library/xdrlib xdrlib-encode-and-decode-xdr-data14496620 +Ref: 48a114496620 +Ref: library/security_warnings security-warnings14497047 +Ref: 48a214497047 +Ref: xdrlib — Encode and decode XDR data-Footnote-114497083 +Ref: xdrlib — Encode and decode XDR data-Footnote-214497125 +Node: Security Considerations<3>14497182 +Ref: library/security_warnings doc14497296 +Ref: 48a314497296 +Ref: library/security_warnings security-considerations14497296 +Ref: 48a414497296 +Ref: Security Considerations<3>-Footnote-114499075 +Node: Extending and Embedding the Python Interpreter14499134 +Ref: extending/index doc14499294 +Ref: 48a514499294 +Ref: extending/index extending-and-embedding-the-python-interpreter14499294 +Ref: 48a614499294 +Ref: extending/index extending-index14499294 +Ref: 1bda14499294 +Node: Recommended third party tools14500596 +Ref: extending/index recommended-third-party-tools14500762 +Ref: 48a714500762 +Node: Creating extensions without third party tools14501075 +Ref: extending/index creating-extensions-without-third-party-tools14501303 +Ref: 48a914501303 +Ref: Creating extensions without third party tools-Footnote-114502034 +Node: Extending Python with C or C++14502076 +Ref: extending/extending doc14502230 +Ref: 48aa14502230 +Ref: extending/extending extending-intro14502230 +Ref: 48ab14502230 +Ref: extending/extending extending-python-with-c-or-c14502230 +Ref: 48ac14502230 +Ref: Extending Python with C or C++-Footnote-114504161 +Node: A Simple Example14504198 +Ref: extending/extending a-simple-example14504322 +Ref: 48ad14504322 +Ref: extending/extending extending-simpleexample14504322 +Ref: 48ae14504322 +Ref: A Simple Example-Footnote-114508801 +Node: Intermezzo Errors and Exceptions14508951 +Ref: extending/extending extending-errors14509103 +Ref: 48af14509103 +Ref: extending/extending intermezzo-errors-and-exceptions14509103 +Ref: 48b014509103 +Node: Back to the Example14517199 +Ref: extending/extending back-to-the-example14517390 +Ref: 48b714517390 +Ref: extending/extending backtoexample14517390 +Ref: 48b814517390 +Node: The Module’s Method Table and Initialization Function14519047 +Ref: extending/extending methodtable14519229 +Ref: 48ba14519229 +Ref: extending/extending the-module-s-method-table-and-initialization-function14519229 +Ref: 48bb14519229 +Node: Compilation and Linkage14524229 +Ref: extending/extending compilation14524423 +Ref: 48c014524423 +Ref: extending/extending compilation-and-linkage14524423 +Ref: 48c114524423 +Node: Calling Python Functions from C14525897 +Ref: extending/extending calling-python-functions-from-c14526080 +Ref: 48c314526080 +Ref: extending/extending callingpython14526080 +Ref: 48c414526080 +Node: Extracting Parameters in Extension Functions14532764 +Ref: extending/extending extracting-parameters-in-extension-functions14532966 +Ref: 48c814532966 +Ref: extending/extending parsetuple14532966 +Ref: 48c514532966 +Node: Keyword Parameters for Extension Functions14535599 +Ref: extending/extending keyword-parameters-for-extension-functions14535795 +Ref: 48c914535795 +Ref: extending/extending parsetupleandkeywords14535795 +Ref: 48ca14535795 +Node: Building Arbitrary Values14538498 +Ref: extending/extending building-arbitrary-values14538666 +Ref: 48cb14538666 +Ref: extending/extending buildvalue14538666 +Ref: 48cc14538666 +Node: Reference Counts14540752 +Ref: extending/extending refcounts14540903 +Ref: 48c614540903 +Ref: extending/extending reference-counts14540903 +Ref: 48cd14540903 +Node: Reference Counting in Python14545348 +Ref: extending/extending refcountsinpython14545453 +Ref: 48ce14545453 +Ref: extending/extending reference-counting-in-python14545453 +Ref: 48cf14545453 +Ref: Reference Counting in Python-Footnote-114547830 +Ref: Reference Counting in Python-Footnote-214547954 +Node: Ownership Rules14548125 +Ref: extending/extending ownership-rules14548247 +Ref: 48d014548247 +Ref: extending/extending ownershiprules14548247 +Ref: 48d114548247 +Node: Thin Ice14550711 +Ref: extending/extending thin-ice14550818 +Ref: 48d514550818 +Ref: extending/extending thinice14550818 +Ref: 48d614550818 +Node: NULL Pointers14554082 +Ref: extending/extending null-pointers14554165 +Ref: 48d814554165 +Ref: extending/extending nullpointers14554165 +Ref: 48d914554165 +Ref: NULL Pointers-Footnote-114555790 +Node: Writing Extensions in C++14555927 +Ref: extending/extending cplusplus14556094 +Ref: 48da14556094 +Ref: extending/extending writing-extensions-in-c14556094 +Ref: 48db14556094 +Node: Providing a C API for an Extension Module14556814 +Ref: extending/extending providing-a-c-api-for-an-extension-module14556956 +Ref: 48dc14556956 +Ref: extending/extending using-capsules14556956 +Ref: 134914556956 +Node: Defining Extension Types Tutorial14565519 +Ref: extending/newtypes_tutorial doc14565722 +Ref: 182a14565722 +Ref: extending/newtypes_tutorial defining-extension-types-tutorial14565722 +Ref: 48de14565722 +Ref: extending/newtypes_tutorial defining-new-types14565722 +Ref: 48df14565722 +Node: The Basics14566366 +Ref: extending/newtypes_tutorial dnt-basics14566499 +Ref: 48e014566499 +Ref: extending/newtypes_tutorial the-basics14566499 +Ref: 48e114566499 +Node: Adding data and methods to the Basic example14575912 +Ref: extending/newtypes_tutorial adding-data-and-methods-to-the-basic-example14576098 +Ref: 48e714576098 +Ref: Adding data and methods to the Basic example-Footnote-114592296 +Ref: Adding data and methods to the Basic example-Footnote-214592389 +Node: Providing finer control over data attributes14592526 +Ref: extending/newtypes_tutorial providing-finer-control-over-data-attributes14592738 +Ref: 48ef14592738 +Ref: Providing finer control over data attributes-Footnote-114602515 +Node: Supporting cyclic garbage collection14602895 +Ref: extending/newtypes_tutorial supporting-cyclic-garbage-collection14603086 +Ref: 48f114603086 +Ref: Supporting cyclic garbage collection-Footnote-114613678 +Node: Subclassing other types14613852 +Ref: extending/newtypes_tutorial subclassing-other-types14613990 +Ref: 48f314613990 +Node: Defining Extension Types Assorted Topics14619237 +Ref: extending/newtypes doc14619439 +Ref: 48f614619439 +Ref: extending/newtypes defining-extension-types-assorted-topics14619439 +Ref: 48f714619439 +Ref: extending/newtypes new-types-topics14619439 +Ref: 48f814619439 +Ref: extending/newtypes dnt-type-methods14619536 +Ref: 48f914619536 +Node: Finalization and De-allocation14624296 +Ref: extending/newtypes finalization-and-de-allocation14624431 +Ref: 48fa14624431 +Ref: Finalization and De-allocation-Footnote-114627929 +Node: Object Presentation14627971 +Ref: extending/newtypes object-presentation14628135 +Ref: 48fc14628135 +Node: Attribute Management14629787 +Ref: extending/newtypes attribute-management14629938 +Ref: 48ff14629938 +Node: Generic Attribute Management14631487 +Ref: extending/newtypes generic-attribute-management14631615 +Ref: 48ec14631615 +Ref: extending/newtypes id114631615 +Ref: 490014631615 +Node: Type-specific Attribute Management14635187 +Ref: extending/newtypes type-specific-attribute-management14635315 +Ref: 490514635315 +Node: Object Comparison14637083 +Ref: extending/newtypes object-comparison14637240 +Ref: 490814637240 +Node: Abstract Protocol Support14639023 +Ref: extending/newtypes abstract-protocol-support14639182 +Ref: 490b14639182 +Node: Weak Reference Support14644881 +Ref: extending/newtypes weak-reference-support14645039 +Ref: 491014645039 +Ref: extending/newtypes weakref-support14645039 +Ref: 256114645039 +Node: More Suggestions14646334 +Ref: extending/newtypes more-suggestions14646458 +Ref: 491114646458 +Node: Building C and C++ Extensions14647427 +Ref: extending/building doc14647636 +Ref: 491214647636 +Ref: extending/building building14647636 +Ref: 48c214647636 +Ref: extending/building building-c-and-c-extensions14647636 +Ref: 491314647636 +Ref: extending/building c PyInit_modulename14648134 +Ref: 491414648134 +Ref: extending/building install-index14649345 +Ref: ef114649345 +Ref: Building C and C++ Extensions-Footnote-114649442 +Node: Building C and C++ Extensions with setuptools14649484 +Ref: extending/building building-c-and-c-extensions-with-setuptools14649595 +Ref: 491714649595 +Ref: extending/building setuptools-index14649595 +Ref: ef214649595 +Node: Building C and C++ Extensions on Windows14649958 +Ref: extending/windows doc14650118 +Ref: 491814650118 +Ref: extending/windows building-c-and-c-extensions-on-windows14650118 +Ref: 491914650118 +Ref: extending/windows building-on-windows14650118 +Ref: 1e3814650118 +Node: A Cookbook Approach14651387 +Ref: extending/windows a-cookbook-approach14651528 +Ref: 491a14651528 +Ref: extending/windows win-cookbook14651528 +Ref: 491b14651528 +Ref: A Cookbook Approach-Footnote-114652157 +Node: Differences Between Unix and Windows14652235 +Ref: extending/windows differences-between-unix-and-windows14652407 +Ref: 491c14652407 +Ref: extending/windows dynamic-linking14652407 +Ref: 491d14652407 +Node: Using DLLs in Practice14655330 +Ref: extending/windows using-dlls-in-practice14655474 +Ref: 491e14655474 +Ref: extending/windows win-dlls14655474 +Ref: 491f14655474 +Node: Embedding the CPython runtime in a larger application14657005 +Ref: extending/index embedding-the-cpython-runtime-in-a-larger-application14657195 +Ref: 492014657195 +Node: Embedding Python in Another Application14657637 +Ref: extending/embedding doc14657766 +Ref: 492114657766 +Ref: extending/embedding embedding14657766 +Ref: 1e5414657766 +Ref: extending/embedding embedding-python-in-another-application14657766 +Ref: 492214657766 +Node: Very High Level Embedding14660110 +Ref: extending/embedding high-level-embedding14660264 +Ref: 492514660264 +Ref: extending/embedding very-high-level-embedding14660264 +Ref: 492614660264 +Node: Beyond Very High Level Embedding An overview14662596 +Ref: extending/embedding beyond-very-high-level-embedding-an-overview14662773 +Ref: 492714662773 +Ref: extending/embedding lower-level-embedding14662773 +Ref: 492814662773 +Node: Pure Embedding14664492 +Ref: extending/embedding id114664669 +Ref: 492914664669 +Ref: extending/embedding pure-embedding14664669 +Ref: 492a14664669 +Node: Extending Embedded Python14669294 +Ref: extending/embedding extending-embedded-python14669450 +Ref: 492c14669450 +Ref: extending/embedding extending-with-embedding14669450 +Ref: 492d14669450 +Node: Embedding Python in C++14671487 +Ref: extending/embedding embedding-python-in-c14671674 +Ref: 492e14671674 +Ref: extending/embedding embeddingincplusplus14671674 +Ref: 492f14671674 +Node: Compiling and Linking under Unix-like systems14672046 +Ref: extending/embedding compiling14672199 +Ref: 492b14672199 +Ref: extending/embedding compiling-and-linking-under-unix-like-systems14672199 +Ref: 493014672199 +Node: Python/C API Reference Manual14674396 +Ref: c-api/index doc14674554 +Ref: 493214674554 +Ref: c-api/index c-api-index14674554 +Ref: 1bdb14674554 +Ref: c-api/index python-c-api-reference-manual14674554 +Ref: 493314674554 +Node: Introduction<13>14675409 +Ref: c-api/intro doc14675515 +Ref: 493414675515 +Ref: c-api/intro api-intro14675515 +Ref: 493514675515 +Ref: c-api/intro introduction14675515 +Ref: 493614675515 +Node: Coding standards14677156 +Ref: c-api/intro coding-standards14677247 +Ref: 493714677247 +Ref: Coding standards-Footnote-114677686 +Node: Include Files14677728 +Ref: c-api/intro api-includes14677841 +Ref: 77f14677841 +Ref: c-api/intro include-files14677841 +Ref: 493814677841 +Node: Useful macros14680389 +Ref: c-api/intro useful-macros14680520 +Ref: 493914680520 +Ref: c-api/intro c PyMODINIT_FUNC14680808 +Ref: 149e14680808 +Ref: c-api/intro c Py_ABS14681604 +Ref: 493a14681604 +Ref: c-api/intro c Py_ALWAYS_INLINE14681701 +Ref: 18b614681701 +Ref: c-api/intro c Py_CHARMASK14682679 +Ref: 493b14682679 +Ref: c-api/intro c Py_DEPRECATED14682861 +Ref: aa414682861 +Ref: c-api/intro c Py_GETENV14683135 +Ref: 493c14683135 +Ref: c-api/intro c Py_MAX14683312 +Ref: 493d14683312 +Ref: c-api/intro c Py_MEMBER_SIZE14683428 +Ref: 493e14683428 +Ref: c-api/intro c Py_MIN14683573 +Ref: 493f14683573 +Ref: c-api/intro c Py_NO_INLINE14683689 +Ref: 18b714683689 +Ref: c-api/intro c Py_STRINGIFY14683989 +Ref: 494014683989 +Ref: c-api/intro c Py_UNREACHABLE14684142 +Ref: bb514684142 +Ref: c-api/intro c Py_UNUSED14685297 +Ref: 171c14685297 +Ref: c-api/intro c PyDoc_STRVAR14685521 +Ref: 197114685521 +Ref: c-api/intro c PyDoc_STR14686102 +Ref: 180a14686102 +Ref: Useful macros-Footnote-114686651 +Ref: Useful macros-Footnote-214686716 +Ref: Useful macros-Footnote-314686758 +Node: Objects Types and Reference Counts14686800 +Ref: c-api/intro api-objects14686932 +Ref: 494114686932 +Ref: c-api/intro objects-types-and-reference-counts14686932 +Ref: 494214686932 +Node: Reference Counts<2>14688314 +Ref: c-api/intro api-refcounts14688418 +Ref: 494314688418 +Ref: c-api/intro reference-counts14688418 +Ref: 494414688418 +Node: Reference Count Details14692362 +Ref: c-api/intro api-refcountdetails14692441 +Ref: 494514692441 +Ref: c-api/intro reference-count-details14692441 +Ref: 494614692441 +Node: Types14699649 +Ref: c-api/intro api-types14699753 +Ref: 494914699753 +Ref: c-api/intro types14699753 +Ref: 494a14699753 +Ref: c-api/intro c Py_ssize_t14700207 +Ref: a5f14700207 +Ref: Types-Footnote-114700608 +Node: Exceptions<21>14700650 +Ref: c-api/intro api-exceptions14700788 +Ref: 494b14700788 +Ref: c-api/intro exceptions14700788 +Ref: 494c14700788 +Node: Embedding Python<2>14706927 +Ref: c-api/intro api-embedding14707047 +Ref: 494e14707047 +Ref: c-api/intro embedding-python14707047 +Ref: 494f14707047 +Node: Debugging Builds14710263 +Ref: c-api/intro api-debugging14710401 +Ref: 495114710401 +Ref: c-api/intro debugging-builds14710401 +Ref: 495214710401 +Ref: c-api/intro c Py_DEBUG14711030 +Ref: 414014711030 +Node: Recommended third party tools<2>14712128 +Ref: c-api/intro c-api-tools14712238 +Ref: 48a814712238 +Ref: c-api/intro recommended-third-party-tools14712238 +Ref: 495314712238 +Ref: Recommended third party tools<2>-Footnote-114713645 +Ref: Recommended third party tools<2>-Footnote-214713673 +Ref: Recommended third party tools<2>-Footnote-314713709 +Ref: Recommended third party tools<2>-Footnote-414713741 +Ref: Recommended third party tools<2>-Footnote-514713784 +Ref: Recommended third party tools<2>-Footnote-614713818 +Ref: Recommended third party tools<2>-Footnote-714713859 +Ref: Recommended third party tools<2>-Footnote-814713884 +Ref: Recommended third party tools<2>-Footnote-914713913 +Node: C API Stability14713986 +Ref: c-api/stable doc14714126 +Ref: 495414714126 +Ref: c-api/stable c-api-stability14714126 +Ref: 495514714126 +Ref: c-api/stable stable14714126 +Ref: 55014714126 +Ref: C API Stability-Footnote-114715657 +Ref: C API Stability-Footnote-214715699 +Node: Unstable C API14715754 +Ref: c-api/stable id114715864 +Ref: 495714715864 +Ref: c-api/stable unstable-c-api14715864 +Ref: 54414715864 +Node: Stable Application Binary Interface14716362 +Ref: c-api/stable stable-application-binary-interface14716504 +Ref: 495814716504 +Node: Limited C API14716863 +Ref: c-api/stable id214716967 +Ref: 495914716967 +Ref: c-api/stable limited-c-api14716967 +Ref: 39114716967 +Ref: c-api/stable c Py_LIMITED_API14717250 +Ref: 41a14717250 +Node: Stable ABI14718105 +Ref: c-api/stable id314718251 +Ref: 495a14718251 +Ref: c-api/stable stable-abi14718251 +Ref: 495b14718251 +Ref: Stable ABI-Footnote-114719667 +Node: Limited API Scope and Performance14719709 +Ref: c-api/stable limited-api-scope-and-performance14719861 +Ref: 495c14719861 +Node: Limited API Caveats14720983 +Ref: c-api/stable limited-api-caveats14721116 +Ref: 495e14721116 +Node: Platform Considerations14722769 +Ref: c-api/stable platform-considerations14722920 +Ref: 495f14722920 +Ref: c-api/stable stable-abi-platform14722920 +Ref: 495614722920 +Node: Contents of Limited API14723538 +Ref: c-api/stable contents-of-limited-api14723645 +Ref: 496014723645 +Ref: c-api/stable limited-api-list14723645 +Ref: 79514723645 +Node: The Very High Level Layer14759845 +Ref: c-api/veryhigh doc14759987 +Ref: 4b0a14759987 +Ref: c-api/veryhigh the-very-high-level-layer14759987 +Ref: 4b0b14759987 +Ref: c-api/veryhigh veryhigh14759987 +Ref: 4b0c14759987 +Ref: c-api/veryhigh c PyRun_AnyFile14761014 +Ref: 4b1014761014 +Ref: c-api/veryhigh c PyRun_AnyFileFlags14761239 +Ref: 4b1214761239 +Ref: c-api/veryhigh c PyRun_AnyFileEx14761481 +Ref: 4b1314761481 +Ref: c-api/veryhigh c PyRun_AnyFileExFlags14761710 +Ref: 4b1114761710 +Ref: c-api/veryhigh c PyRun_SimpleString14762372 +Ref: 492314762372 +Ref: c-api/veryhigh c PyRun_SimpleStringFlags14762599 +Ref: 4b1514762599 +Ref: c-api/veryhigh c PyRun_SimpleFile14763287 +Ref: 492414763287 +Ref: c-api/veryhigh c PyRun_SimpleFileEx14763518 +Ref: 4b1614763518 +Ref: c-api/veryhigh c PyRun_SimpleFileExFlags14763740 +Ref: 190814763740 +Ref: c-api/veryhigh c PyRun_InteractiveOne14764419 +Ref: 4b1714764419 +Ref: c-api/veryhigh c PyRun_InteractiveOneFlags14764637 +Ref: 4b1814764637 +Ref: c-api/veryhigh c PyRun_InteractiveLoop14765381 +Ref: 4b1414765381 +Ref: c-api/veryhigh c PyRun_InteractiveLoopFlags14765601 +Ref: 4b1914765601 +Ref: c-api/veryhigh c PyOS_InputHook14766049 +Ref: 58214766049 +Ref: c-api/veryhigh c PyOS_ReadlineFunctionPointer14766672 +Ref: 58314766672 +Ref: c-api/veryhigh c PyRun_String14767802 +Ref: 19da14767802 +Ref: c-api/veryhigh c PyRun_StringFlags14768086 +Ref: 4b1a14768086 +Ref: c-api/veryhigh c PyRun_File14768769 +Ref: 4b1b14768769 +Ref: c-api/veryhigh c PyRun_FileEx14769095 +Ref: 4b1d14769095 +Ref: c-api/veryhigh c PyRun_FileFlags14769417 +Ref: 4b1e14769417 +Ref: c-api/veryhigh c PyRun_FileExFlags14769752 +Ref: 4b1c14769752 +Ref: c-api/veryhigh c Py_CompileString14770338 +Ref: 88314770338 +Ref: c-api/veryhigh c Py_CompileStringFlags14770658 +Ref: 4b1f14770658 +Ref: c-api/veryhigh c Py_CompileStringObject14770964 +Ref: 4b2114770964 +Ref: c-api/veryhigh c Py_CompileStringExFlags14772118 +Ref: 4b2014772118 +Ref: c-api/veryhigh c PyEval_EvalCode14772507 +Ref: 88414772507 +Ref: c-api/veryhigh c PyEval_EvalCodeEx14772883 +Ref: 176914772883 +Ref: c-api/veryhigh c PyEval_EvalFrame14773615 +Ref: 49b414773615 +Ref: c-api/veryhigh c PyEval_EvalFrameEx14773911 +Ref: 102714773911 +Ref: c-api/veryhigh c PyEval_MergeCompilerFlags14774662 +Ref: 4b2214774662 +Ref: c-api/veryhigh c Py_eval_input14774854 +Ref: 4b0d14774854 +Ref: c-api/veryhigh c Py_file_input14775011 +Ref: 4b0e14775011 +Ref: c-api/veryhigh c Py_single_input14775296 +Ref: 4b0f14775296 +Ref: c-api/veryhigh c PyCompilerFlags14775521 +Ref: aa114775521 +Ref: c-api/veryhigh c PyCompilerFlags cf_flags14776061 +Ref: 4b2314776061 +Ref: c-api/veryhigh c PyCompilerFlags cf_feature_version14776121 +Ref: 4b2414776121 +Ref: c-api/veryhigh c PyCF_ALLOW_TOP_LEVEL_AWAIT14776550 +Ref: 4b2514776550 +Ref: c-api/veryhigh c PyCF_ONLY_AST14776595 +Ref: 4b2614776595 +Ref: c-api/veryhigh c PyCF_OPTIMIZED_AST14776627 +Ref: 4b2714776627 +Ref: c-api/veryhigh c PyCF_TYPE_COMMENTS14776664 +Ref: 4b2814776664 +Node: Reference Counting14777144 +Ref: c-api/refcounting doc14777289 +Ref: 4b2b14777289 +Ref: c-api/refcounting countingrefs14777289 +Ref: 4b2c14777289 +Ref: c-api/refcounting reference-counting14777289 +Ref: 4b2d14777289 +Ref: c-api/refcounting c Py_REFCNT14777436 +Ref: 8a814777436 +Ref: c-api/refcounting c Py_SET_REFCNT14778215 +Ref: 8a914778215 +Ref: c-api/refcounting c Py_INCREF14778648 +Ref: 56b14778648 +Ref: c-api/refcounting c Py_XINCREF14779535 +Ref: a6414779535 +Ref: c-api/refcounting c Py_NewRef14779740 +Ref: 89814779740 +Ref: c-api/refcounting c Py_XNewRef14780451 +Ref: 89914780451 +Ref: c-api/refcounting c Py_DECREF14780757 +Ref: 56c14780757 +Ref: c-api/refcounting c Py_XDECREF14782377 +Ref: 78a14782377 +Ref: c-api/refcounting c Py_CLEAR14782616 +Ref: 57514782616 +Ref: c-api/refcounting c Py_IncRef14783447 +Ref: 4ae614783447 +Ref: c-api/refcounting c Py_DecRef14783723 +Ref: 4adf14783723 +Ref: c-api/refcounting c Py_SETREF14783987 +Ref: 57614783987 +Ref: c-api/refcounting c Py_XSETREF14784743 +Ref: 57714784743 +Ref: Reference Counting-Footnote-114785119 +Ref: Reference Counting-Footnote-214785161 +Node: Exception Handling14785203 +Ref: c-api/exceptions doc14785335 +Ref: 4b2e14785335 +Ref: c-api/exceptions exception-handling14785335 +Ref: 4b2f14785335 +Ref: c-api/exceptions exceptionhandling14785335 +Ref: 43fe14785335 +Node: Printing and clearing14787623 +Ref: c-api/exceptions printing-and-clearing14787726 +Ref: 4b3014787726 +Ref: c-api/exceptions c PyErr_Clear14787783 +Ref: 102a14787783 +Ref: c-api/exceptions c PyErr_PrintEx14787951 +Ref: 49a814787951 +Ref: c-api/exceptions c PyErr_Print14788885 +Ref: 194514788885 +Ref: c-api/exceptions c PyErr_WriteUnraisable14789005 +Ref: 34a14789005 +Ref: c-api/exceptions c PyErr_FormatUnraisable14789984 +Ref: 34914789984 +Ref: c-api/exceptions c PyErr_DisplayException14790498 +Ref: 3fe14790498 +Node: Raising exceptions14790773 +Ref: c-api/exceptions raising-exceptions14790901 +Ref: 4b3114790901 +Ref: c-api/exceptions c PyErr_SetString14791141 +Ref: 57914791141 +Ref: c-api/exceptions c PyErr_SetObject14791666 +Ref: 57814791666 +Ref: c-api/exceptions c PyErr_Format14791936 +Ref: eaa14791936 +Ref: c-api/exceptions c PyErr_FormatV14792439 +Ref: ea914792439 +Ref: c-api/exceptions c PyErr_SetNone14792803 +Ref: 49b014792803 +Ref: c-api/exceptions c PyErr_BadArgument14792967 +Ref: 49a514792967 +Ref: c-api/exceptions c PyErr_NoMemory14793263 +Ref: 48b314793263 +Ref: c-api/exceptions c PyErr_SetFromErrno14793594 +Ref: 48b214793594 +Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObject14794532 +Ref: 49ac14794532 +Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilenameObjects14795075 +Ref: 49ad14795075 +Ref: c-api/exceptions c PyErr_SetFromErrnoWithFilename14795547 +Ref: 171714795547 +Ref: c-api/exceptions c PyErr_SetFromWindowsErr14795938 +Ref: 49ae14795938 +Ref: c-api/exceptions c PyErr_SetExcFromWindowsErr14796845 +Ref: 49a914796845 +Ref: c-api/exceptions c PyErr_SetFromWindowsErrWithFilename14797230 +Ref: 171914797230 +Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObject14797871 +Ref: 49aa14797871 +Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilenameObjects14798464 +Ref: 49ab14798464 +Ref: c-api/exceptions c PyErr_SetExcFromWindowsErrWithFilename14798933 +Ref: 171814798933 +Ref: c-api/exceptions c PyErr_SetImportError14799374 +Ref: d3e14799374 +Ref: c-api/exceptions c PyErr_SetImportErrorSubclass14799905 +Ref: d1614799905 +Ref: c-api/exceptions c PyErr_SyntaxLocationObject14800329 +Ref: 4b3214800329 +Ref: c-api/exceptions c PyErr_SyntaxLocationEx14800739 +Ref: 49b214800739 +Ref: c-api/exceptions c PyErr_SyntaxLocation14801097 +Ref: 49b114801097 +Ref: c-api/exceptions c PyErr_BadInternalCall14801325 +Ref: 49a614801325 +Node: Issuing warnings14801666 +Ref: c-api/exceptions issuing-warnings14801801 +Ref: 4b3314801801 +Ref: c-api/exceptions c PyErr_WarnEx14802697 +Ref: 141614802697 +Ref: c-api/exceptions c PyErr_WarnExplicitObject14803904 +Ref: 4b3514803904 +Ref: c-api/exceptions c PyErr_WarnExplicit14804448 +Ref: 171f14804448 +Ref: c-api/exceptions c PyErr_WarnFormat14804881 +Ref: 49b314804881 +Ref: c-api/exceptions c PyErr_ResourceWarning14805241 +Ref: d1714805241 +Node: Querying the error indicator14805623 +Ref: c-api/exceptions querying-the-error-indicator14805758 +Ref: 4b3614805758 +Ref: c-api/exceptions c PyErr_Occurred14805829 +Ref: 18f114805829 +Ref: c-api/exceptions c PyErr_ExceptionMatches14806708 +Ref: 494d14806708 +Ref: c-api/exceptions c PyErr_GivenExceptionMatches14807032 +Ref: 49a714807032 +Ref: c-api/exceptions c PyErr_GetRaisedException14807469 +Ref: 3f014807469 +Ref: c-api/exceptions c PyErr_SetRaisedException14808313 +Ref: 3f314808313 +Ref: c-api/exceptions c PyErr_Fetch14808679 +Ref: 3ef14808679 +Ref: c-api/exceptions c PyErr_Restore14809739 +Ref: 3f214809739 +Ref: c-api/exceptions c PyErr_NormalizeException14810905 +Ref: 3f114810905 +Ref: c-api/exceptions c PyErr_GetHandledException14811968 +Ref: 76a14811968 +Ref: c-api/exceptions c PyErr_SetHandledException14812773 +Ref: 76b14812773 +Ref: c-api/exceptions c PyErr_GetExcInfo14813446 +Ref: 76d14813446 +Ref: c-api/exceptions c PyErr_SetExcInfo14814415 +Ref: 76c14814415 +Node: Signal Handling<2>14815592 +Ref: c-api/exceptions signal-handling14815728 +Ref: 4b3714815728 +Ref: c-api/exceptions c PyErr_CheckSignals14815773 +Ref: 46214815773 +Ref: c-api/exceptions c PyErr_SetInterrupt14817028 +Ref: 49af14817028 +Ref: c-api/exceptions c PyErr_SetInterruptEx14817378 +Ref: 89c14817378 +Ref: c-api/exceptions c PySignal_SetWakeupFd14818457 +Ref: 13a714818457 +Node: Exception Classes14819127 +Ref: c-api/exceptions exception-classes14819252 +Ref: 4b3814819252 +Ref: c-api/exceptions c PyErr_NewException14819301 +Ref: 125d14819301 +Ref: c-api/exceptions c PyErr_NewExceptionWithDoc14820307 +Ref: 125c14820307 +Ref: c-api/exceptions c PyExceptionClass_Check14820770 +Ref: 4b3914820770 +Ref: c-api/exceptions c PyExceptionClass_Name14820934 +Ref: a6514820934 +Node: Exception Objects14821125 +Ref: c-api/exceptions exception-objects14821257 +Ref: 4b3a14821257 +Ref: c-api/exceptions c PyException_GetTraceback14821306 +Ref: 49fa14821306 +Ref: c-api/exceptions c PyException_SetTraceback14821700 +Ref: 19e914821700 +Ref: c-api/exceptions c PyException_GetContext14821923 +Ref: 49f914821923 +Ref: c-api/exceptions c PyException_SetContext14822381 +Ref: 49fc14822381 +Ref: c-api/exceptions c PyException_GetCause14822719 +Ref: 49f814822719 +Ref: c-api/exceptions c PyException_SetCause14823117 +Ref: 49fb14823117 +Ref: c-api/exceptions c PyException_GetArgs14823589 +Ref: 56714823589 +Ref: c-api/exceptions c PyException_SetArgs14823806 +Ref: 56814823806 +Ref: c-api/exceptions c PyUnstable_Exc_PrepReraiseStar14823998 +Ref: 4b3b14823998 +Node: Unicode Exception Objects14824913 +Ref: c-api/exceptions unicode-exception-objects14825045 +Ref: 4b3c14825045 +Ref: c-api/exceptions unicodeexceptions14825045 +Ref: 4b3d14825045 +Ref: c-api/exceptions c PyUnicodeDecodeError_Create14825192 +Ref: 4a9c14825192 +Ref: c-api/exceptions c PyUnicodeDecodeError_GetEncoding14825665 +Ref: 4a9d14825665 +Ref: c-api/exceptions c PyUnicodeEncodeError_GetEncoding14825762 +Ref: 4aa514825762 +Ref: c-api/exceptions c PyUnicodeDecodeError_GetObject14826008 +Ref: 4a9f14826008 +Ref: c-api/exceptions c PyUnicodeEncodeError_GetObject14826103 +Ref: 4aa714826103 +Ref: c-api/exceptions c PyUnicodeTranslateError_GetObject14826198 +Ref: 4aaf14826198 +Ref: c-api/exceptions c PyUnicodeDecodeError_GetStart14826438 +Ref: 4aa114826438 +Ref: c-api/exceptions c PyUnicodeEncodeError_GetStart14826533 +Ref: 4aa914826533 +Ref: c-api/exceptions c PyUnicodeTranslateError_GetStart14826628 +Ref: 4ab114826628 +Ref: c-api/exceptions c PyUnicodeDecodeError_SetStart14826947 +Ref: 4aa414826947 +Ref: c-api/exceptions c PyUnicodeEncodeError_SetStart14827041 +Ref: 4aac14827041 +Ref: c-api/exceptions c PyUnicodeTranslateError_SetStart14827135 +Ref: 4ab414827135 +Ref: c-api/exceptions c PyUnicodeDecodeError_GetEnd14827404 +Ref: 4a9e14827404 +Ref: c-api/exceptions c PyUnicodeEncodeError_GetEnd14827495 +Ref: 4aa614827495 +Ref: c-api/exceptions c PyUnicodeTranslateError_GetEnd14827586 +Ref: 4aae14827586 +Ref: c-api/exceptions c PyUnicodeDecodeError_SetEnd14827895 +Ref: 4aa214827895 +Ref: c-api/exceptions c PyUnicodeEncodeError_SetEnd14827985 +Ref: 4aaa14827985 +Ref: c-api/exceptions c PyUnicodeTranslateError_SetEnd14828075 +Ref: 4ab214828075 +Ref: c-api/exceptions c PyUnicodeDecodeError_GetReason14828336 +Ref: 4aa014828336 +Ref: c-api/exceptions c PyUnicodeEncodeError_GetReason14828431 +Ref: 4aa814828431 +Ref: c-api/exceptions c PyUnicodeTranslateError_GetReason14828526 +Ref: 4ab014828526 +Ref: c-api/exceptions c PyUnicodeDecodeError_SetReason14828766 +Ref: 4aa314828766 +Ref: c-api/exceptions c PyUnicodeEncodeError_SetReason14828863 +Ref: 4aab14828863 +Ref: c-api/exceptions c PyUnicodeTranslateError_SetReason14828960 +Ref: 4ab314828960 +Node: Recursion Control14829234 +Ref: c-api/exceptions recursion14829376 +Ref: 4b3e14829376 +Ref: c-api/exceptions recursion-control14829376 +Ref: 4b3f14829376 +Ref: c-api/exceptions c Py_EnterRecursiveCall14829808 +Ref: 97314829808 +Ref: c-api/exceptions c Py_LeaveRecursiveCall14830727 +Ref: 97414830727 +Ref: c-api/exceptions c Py_ReprEnter14831438 +Ref: 4ae814831438 +Ref: c-api/exceptions c Py_ReprLeave14832244 +Ref: 4ae914832244 +Node: Exception and warning types14832478 +Ref: c-api/exceptions exception-and-warning-types14832586 +Ref: 4b4014832586 +Ref: c-api/exceptions standardexceptions14832586 +Ref: 4b4114832586 +Node: Exception types14833001 +Ref: c-api/exceptions exception-types14833104 +Ref: 4b4214833104 +Ref: c-api/exceptions c PyExc_BaseException14833481 +Ref: 49bb14833481 +Ref: c-api/exceptions c PyExc_BaseExceptionGroup14833662 +Ref: 49bc14833662 +Ref: c-api/exceptions c PyExc_Exception14833873 +Ref: 49ca14833873 +Ref: c-api/exceptions c PyExc_ArithmeticError14834050 +Ref: 49b814834050 +Ref: c-api/exceptions c PyExc_AssertionError14834234 +Ref: 49b914834234 +Ref: c-api/exceptions c PyExc_AttributeError14834416 +Ref: 49ba14834416 +Ref: c-api/exceptions c PyExc_BlockingIOError14834598 +Ref: 49bd14834598 +Ref: c-api/exceptions c PyExc_BrokenPipeError14834806 +Ref: 49be14834806 +Ref: c-api/exceptions c PyExc_BufferError14835014 +Ref: 49bf14835014 +Ref: c-api/exceptions c PyExc_ChildProcessError14835194 +Ref: 49c114835194 +Ref: c-api/exceptions c PyExc_ConnectionAbortedError14835404 +Ref: 49c214835404 +Ref: c-api/exceptions c PyExc_ConnectionError14835619 +Ref: 49c314835619 +Ref: c-api/exceptions c PyExc_ConnectionRefusedError14835826 +Ref: 49c414835826 +Ref: c-api/exceptions c PyExc_ConnectionResetError14836041 +Ref: 49c514836041 +Ref: c-api/exceptions c PyExc_EOFError14836270 +Ref: 49c714836270 +Ref: c-api/exceptions c PyExc_FileExistsError14836388 +Ref: 49cb14836388 +Ref: c-api/exceptions c PyExc_FileNotFoundError14836596 +Ref: 49cc14836596 +Ref: c-api/exceptions c PyExc_FloatingPointError14836805 +Ref: 49cd14836805 +Ref: c-api/exceptions c PyExc_GeneratorExit14836992 +Ref: 49cf14836992 +Ref: c-api/exceptions c PyExc_ImportError14837174 +Ref: 49d114837174 +Ref: c-api/exceptions c PyExc_IndentationError14837353 +Ref: 49d314837353 +Ref: c-api/exceptions c PyExc_IndexError14837537 +Ref: 49d414837537 +Ref: c-api/exceptions c PyExc_InterruptedError14837716 +Ref: 49d514837716 +Ref: c-api/exceptions c PyExc_IsADirectoryError14837924 +Ref: 49d614837924 +Ref: c-api/exceptions c PyExc_KeyError14838150 +Ref: 49d714838150 +Ref: c-api/exceptions c PyExc_KeyboardInterrupt14838267 +Ref: 49d814838267 +Ref: c-api/exceptions c PyExc_LookupError14838452 +Ref: 49d914838452 +Ref: c-api/exceptions c PyExc_MemoryError14838632 +Ref: 49da14838632 +Ref: c-api/exceptions c PyExc_ModuleNotFoundError14838812 +Ref: 49db14838812 +Ref: c-api/exceptions c PyExc_NameError14839023 +Ref: 49dc14839023 +Ref: c-api/exceptions c PyExc_NotADirectoryError14839200 +Ref: 49dd14839200 +Ref: c-api/exceptions c PyExc_NotImplementedError14839411 +Ref: 49de14839411 +Ref: c-api/exceptions c PyExc_OSError14839613 +Ref: 48b514839613 +Ref: c-api/exceptions c PyExc_OverflowError14839730 +Ref: 49df14839730 +Ref: c-api/exceptions c PyExc_PermissionError14839911 +Ref: 49e114839911 +Ref: c-api/exceptions c PyExc_ProcessLookupError14840118 +Ref: 49e214840118 +Ref: c-api/exceptions c PyExc_PythonFinalizationError14840329 +Ref: 4b4314840329 +Ref: c-api/exceptions c PyExc_RecursionError14840477 +Ref: eab14840477 +Ref: c-api/exceptions c PyExc_ReferenceError14840683 +Ref: 49e314840683 +Ref: c-api/exceptions c PyExc_RuntimeError14840866 +Ref: 49e514840866 +Ref: c-api/exceptions c PyExc_StopAsyncIteration14841046 +Ref: 49e714841046 +Ref: c-api/exceptions c PyExc_StopIteration14841257 +Ref: 49e814841257 +Ref: c-api/exceptions c PyExc_SyntaxError14841438 +Ref: 49e914841438 +Ref: c-api/exceptions c PyExc_SystemError14841617 +Ref: 49eb14841617 +Ref: c-api/exceptions c PyExc_SystemExit14841796 +Ref: 49ec14841796 +Ref: c-api/exceptions c PyExc_TabError14841990 +Ref: 49ed14841990 +Ref: c-api/exceptions c PyExc_TimeoutError14842107 +Ref: 49ee14842107 +Ref: c-api/exceptions c PyExc_TypeError14842311 +Ref: 48b414842311 +Ref: c-api/exceptions c PyExc_UnboundLocalError14842488 +Ref: 49ef14842488 +Ref: c-api/exceptions c PyExc_UnicodeDecodeError14842674 +Ref: 49f014842674 +Ref: c-api/exceptions c PyExc_UnicodeEncodeError14842860 +Ref: 49f114842860 +Ref: c-api/exceptions c PyExc_UnicodeError14843046 +Ref: 49f214843046 +Ref: c-api/exceptions c PyExc_UnicodeTranslateError14843227 +Ref: 49f314843227 +Ref: c-api/exceptions c PyExc_ValueError14843417 +Ref: 48b614843417 +Ref: c-api/exceptions c PyExc_ZeroDivisionError14843595 +Ref: 48b114843595 +Ref: Exception types-Footnote-114844622 +Node: OSError aliases14844664 +Ref: c-api/exceptions oserror-aliases14844789 +Ref: 4b4414844789 +Ref: c-api/exceptions c PyExc_EnvironmentError14845355 +Ref: 49c914845355 +Ref: c-api/exceptions c PyExc_IOError14845535 +Ref: 49d014845535 +Ref: c-api/exceptions c PyExc_WindowsError14845706 +Ref: 49f714845706 +Ref: c-api/exceptions win14845985 +Ref: 4b4514845985 +Node: Warning types14846141 +Ref: c-api/exceptions standardwarningcategories14846242 +Ref: 4b3414846242 +Ref: c-api/exceptions warning-types14846242 +Ref: 4b4614846242 +Ref: c-api/exceptions c PyExc_Warning14846630 +Ref: 49f614846630 +Ref: c-api/exceptions c PyExc_BytesWarning14846748 +Ref: 49c014846748 +Ref: c-api/exceptions c PyExc_DeprecationWarning14846928 +Ref: 49c614846928 +Ref: c-api/exceptions c PyExc_EncodingWarning14847114 +Ref: 49c814847114 +Ref: c-api/exceptions c PyExc_FutureWarning14847323 +Ref: 49ce14847323 +Ref: c-api/exceptions c PyExc_ImportWarning14847504 +Ref: 49d214847504 +Ref: c-api/exceptions c PyExc_PendingDeprecationWarning14847685 +Ref: 49e014847685 +Ref: c-api/exceptions c PyExc_ResourceWarning14847878 +Ref: 49e414847878 +Ref: c-api/exceptions c PyExc_RuntimeWarning14848085 +Ref: 49e614848085 +Ref: c-api/exceptions c PyExc_SyntaxWarning14848267 +Ref: 49ea14848267 +Ref: c-api/exceptions c PyExc_UnicodeWarning14848448 +Ref: 49f414848448 +Ref: c-api/exceptions c PyExc_UserWarning14848631 +Ref: 49f514848631 +Node: Utilities<2>14848892 +Ref: c-api/utilities doc14849028 +Ref: 4b4714849028 +Ref: c-api/utilities id114849028 +Ref: 4b4814849028 +Ref: c-api/utilities utilities14849028 +Ref: 4b4914849028 +Node: Operating System Utilities14849635 +Ref: c-api/sys doc14849735 +Ref: 4b4a14849735 +Ref: c-api/sys operating-system-utilities14849735 +Ref: 4b4b14849735 +Ref: c-api/sys os14849735 +Ref: 4b4c14849735 +Ref: c-api/sys c PyOS_FSPath14849802 +Ref: d1814849802 +Ref: c-api/sys c Py_FdIsInteractive14850437 +Ref: 4b4d14850437 +Ref: c-api/sys c PyOS_BeforeFork14850982 +Ref: bbf14850982 +Ref: c-api/sys c PyOS_AfterFork_Parent14851604 +Ref: bc014851604 +Ref: c-api/sys c PyOS_AfterFork_Child14852317 +Ref: 3f714852317 +Ref: c-api/sys c PyOS_AfterFork14853312 +Ref: 3f614853312 +Ref: c-api/sys c PyOS_CheckStack14853797 +Ref: 181514853797 +Ref: c-api/sys c PyOS_sighandler_t14854306 +Ref: 4a5414854306 +Ref: c-api/sys c PyOS_getsig14854401 +Ref: 150814854401 +Ref: c-api/sys c PyOS_setsig14854687 +Ref: 150914854687 +Ref: c-api/sys c Py_DecodeLocale14855039 +Ref: bc714855039 +Ref: c-api/sys c Py_EncodeLocale14857358 +Ref: bc814857358 +Node: System Functions14859122 +Ref: c-api/sys system-functions14859246 +Ref: 4b4f14859246 +Ref: c-api/sys systemfunctions14859246 +Ref: 4b5014859246 +Ref: c-api/sys c PySys_GetObject14859545 +Ref: 38414859545 +Ref: c-api/sys c PySys_SetObject14859831 +Ref: 4a8d14859831 +Ref: c-api/sys c PySys_ResetWarnOptions14860133 +Ref: 3ab14860133 +Ref: c-api/sys c PySys_WriteStdout14860498 +Ref: 4a8f14860498 +Ref: c-api/sys c PySys_WriteStderr14861412 +Ref: 4a8e14861412 +Ref: c-api/sys c PySys_FormatStdout14861625 +Ref: 4a8b14861625 +Ref: c-api/sys c PySys_FormatStderr14861941 +Ref: 4a8a14861941 +Ref: c-api/sys c PySys_GetXOptions14862184 +Ref: 4a8c14862184 +Ref: c-api/sys c PySys_Audit14862542 +Ref: 36a14862542 +Ref: c-api/sys c PySys_AuditTuple14863877 +Ref: 36914863877 +Ref: c-api/sys c PySys_AddAuditHook14864215 +Ref: 41e214864215 +Ref: c-api/sys c Py_AuditHookFunction14865836 +Ref: 4b5114865836 +Ref: System Functions-Footnote-114866341 +Node: Process Control14866383 +Ref: c-api/sys process-control14866501 +Ref: 4b5314866501 +Ref: c-api/sys processcontrol14866501 +Ref: 4b5414866501 +Ref: c-api/sys c Py_FatalError14866546 +Ref: 98314866546 +Ref: c-api/sys c Py_Exit14867321 +Ref: d4e14867321 +Ref: c-api/sys c Py_AtExit14867718 +Ref: 4add14867718 +Node: Importing Modules<2>14868525 +Ref: c-api/import doc14868651 +Ref: 4b5514868651 +Ref: c-api/import importing14868651 +Ref: 4b5614868651 +Ref: c-api/import importing-modules14868651 +Ref: 4b5714868651 +Ref: c-api/import c PyImport_ImportModule14868700 +Ref: 3ba14868700 +Ref: c-api/import c PyImport_ImportModuleNoBlock14869013 +Ref: 3b914869013 +Ref: c-api/import c PyImport_ImportModuleEx14869680 +Ref: 119814869680 +Ref: c-api/import c PyImport_ImportModuleLevelObject14870430 +Ref: 4a0f14870430 +Ref: c-api/import c PyImport_ImportModuleLevel14871266 +Ref: 119714871266 +Ref: c-api/import c PyImport_Import14871738 +Ref: 13c814871738 +Ref: c-api/import c PyImport_ReloadModule14872314 +Ref: 4a1014872314 +Ref: c-api/import c PyImport_AddModuleRef14872641 +Ref: 35314872641 +Ref: c-api/import c PyImport_AddModuleObject14873640 +Ref: 4a0614873640 +Ref: c-api/import c PyImport_AddModule14874011 +Ref: 35414874011 +Ref: c-api/import c PyImport_ExecCodeModule14874279 +Ref: 4a0714874279 +Ref: c-api/import c PyImport_ExecCodeModuleEx14876296 +Ref: 4a0814876296 +Ref: c-api/import c PyImport_ExecCodeModuleObject14876734 +Ref: 4a0914876734 +Ref: c-api/import c PyImport_ExecCodeModuleWithPathnames14877380 +Ref: 4a0a14877380 +Ref: c-api/import c PyImport_GetMagicNumber14878139 +Ref: 119614878139 +Ref: c-api/import c PyImport_GetMagicTag14878532 +Ref: 4a0b14878532 +Ref: c-api/import c PyImport_GetModuleDict14878880 +Ref: 4a0c14878880 +Ref: c-api/import c PyImport_GetModule14879173 +Ref: bb314879173 +Ref: c-api/import c PyImport_GetImporter14879608 +Ref: 171614879608 +Ref: c-api/import c PyImport_ImportFrozenModuleObject14880336 +Ref: 4a0e14880336 +Ref: c-api/import c PyImport_ImportFrozenModule14880974 +Ref: 4a0d14880974 +Ref: c-api/import c _frozen14881224 +Ref: 77014881224 +Ref: c-api/import c PyImport_FrozenModules14881856 +Ref: 2e2a14881856 +Ref: c-api/import c PyImport_AppendInittab14882271 +Ref: 17a314882271 +Ref: c-api/import c _inittab14882853 +Ref: 4b5814882853 +Ref: c-api/import c _inittab name14883183 +Ref: 4b5914883183 +Ref: c-api/import c _inittab initfunc14883276 +Ref: 4b5a14883276 +Ref: c-api/import c PyImport_ExtendInittab14883422 +Ref: 17a414883422 +Ref: Importing Modules<2>-Footnote-114884233 +Node: Data marshalling support14884275 +Ref: c-api/marshal doc14884423 +Ref: 4b5b14884423 +Ref: c-api/marshal data-marshalling-support14884423 +Ref: 4b5c14884423 +Ref: c-api/marshal marshalling-utils14884423 +Ref: 4b5d14884423 +Ref: c-api/marshal c PyMarshal_WriteLongToFile14885170 +Ref: 79114885170 +Ref: c-api/marshal c PyMarshal_WriteObjectToFile14885607 +Ref: 79214885607 +Ref: c-api/marshal c PyMarshal_WriteObjectToString14885935 +Ref: 79414885935 +Ref: c-api/marshal c PyMarshal_ReadLongFromFile14886274 +Ref: 4b5e14886274 +Ref: c-api/marshal c PyMarshal_ReadShortFromFile14886613 +Ref: 4b5f14886613 +Ref: c-api/marshal c PyMarshal_ReadObjectFromFile14886955 +Ref: 4b6014886955 +Ref: c-api/marshal c PyMarshal_ReadLastObjectFromFile14887316 +Ref: 4b6114887316 +Ref: c-api/marshal c PyMarshal_ReadObjectFromString14888110 +Ref: 79314888110 +Node: Parsing arguments and building values14888531 +Ref: c-api/arg doc14888691 +Ref: 4b6214888691 +Ref: c-api/arg arg-parsing14888691 +Ref: 8a714888691 +Ref: c-api/arg parsing-arguments-and-building-values14888691 +Ref: 4b6314888691 +Node: Parsing arguments<2>14889362 +Ref: c-api/arg parsing-arguments14889480 +Ref: 4b6414889480 +Node: Strings and buffers14890210 +Ref: c-api/arg arg-parsing-string-and-buffers14890305 +Ref: 38614890305 +Ref: c-api/arg strings-and-buffers14890305 +Ref: 4b6514890305 +Ref: c-api/arg c-arg-borrowed-buffer14891584 +Ref: 4b6614891584 +Node: Numbers<2>14900920 +Ref: c-api/arg numbers14901037 +Ref: 4b6714901037 +Node: Other objects14903714 +Ref: c-api/arg other-objects14903825 +Ref: 4b6914903825 +Ref: c-api/arg o-ampersand14904643 +Ref: 4b6a14904643 +Ref: c-api/arg c Py_CLEANUP_SUPPORTED14905433 +Ref: 4b6b14905433 +Node: API Functions14908938 +Ref: c-api/arg api-functions14909030 +Ref: 4b6c14909030 +Ref: c-api/arg c PyArg_ParseTuple14909075 +Ref: 56e14909075 +Ref: c-api/arg c PyArg_VaParse14909412 +Ref: 496214909412 +Ref: c-api/arg c PyArg_ParseTupleAndKeywords14909684 +Ref: 37e14909684 +Ref: c-api/arg c PyArg_VaParseTupleAndKeywords14910786 +Ref: 37f14910786 +Ref: c-api/arg c PyArg_ValidateKeywordArguments14911132 +Ref: 496314911132 +Ref: c-api/arg c PyArg_Parse14911474 +Ref: 19e314911474 +Ref: c-api/arg c PyArg_UnpackTuple14912156 +Ref: 14d214912156 +Ref: c-api/arg c PY_CXX_CONST14914138 +Ref: 38014914138 +Node: Building values14914557 +Ref: c-api/arg building-values14914675 +Ref: 4b6d14914675 +Ref: c-api/arg c Py_BuildValue14914724 +Ref: 8a614914724 +Ref: c-api/arg capi-py-buildvalue-format-k14919460 +Ref: 155414919460 +Ref: c-api/arg c Py_VaBuildValue14922297 +Ref: 4aeb14922297 +Node: String conversion and formatting14922601 +Ref: c-api/conversion doc14922747 +Ref: 4b6e14922747 +Ref: c-api/conversion string-conversion14922747 +Ref: 4b6f14922747 +Ref: c-api/conversion string-conversion-and-formatting14922747 +Ref: 4b7014922747 +Ref: c-api/conversion c PyOS_snprintf14922888 +Ref: 14d514922888 +Ref: c-api/conversion c PyOS_vsnprintf14923190 +Ref: 14d614923190 +Ref: c-api/conversion c PyOS_strtoul14924919 +Ref: 4a5614924919 +Ref: c-api/conversion c PyOS_strtol14925949 +Ref: 4a5514925949 +Ref: c-api/conversion c PyOS_string_to_double14926466 +Ref: 128814926466 +Ref: c-api/conversion c PyOS_double_to_string14928225 +Ref: 4a5314928225 +Ref: c-api/conversion c PyOS_stricmp14929853 +Ref: 4b7114929853 +Ref: c-api/conversion c PyOS_strnicmp14930061 +Ref: 4b7214930061 +Ref: String conversion and formatting-Footnote-114930334 +Ref: String conversion and formatting-Footnote-214930382 +Ref: String conversion and formatting-Footnote-314930431 +Ref: String conversion and formatting-Footnote-414930478 +Node: PyHash API14930524 +Ref: c-api/hash doc14930643 +Ref: 4b7314930643 +Ref: c-api/hash pyhash-api14930643 +Ref: 4b7414930643 +Ref: c-api/hash c Py_hash_t14930775 +Ref: 125714930775 +Ref: c-api/hash c Py_uhash_t14930870 +Ref: 4b7514930870 +Ref: c-api/hash c PyHASH_MODULUS14930968 +Ref: 166914930968 +Ref: c-api/hash c PyHASH_BITS14931103 +Ref: 166a14931103 +Ref: c-api/hash c PyHASH_MULTIPLIER14931227 +Ref: 162214931227 +Ref: c-api/hash c PyHASH_INF14931352 +Ref: 166b14931352 +Ref: c-api/hash c PyHASH_IMAG14931461 +Ref: 166c14931461 +Ref: c-api/hash c PyHash_FuncDef14931586 +Ref: 4b7614931586 +Ref: c-api/hash c PyHash_FuncDef hash14931691 +Ref: 4b7814931691 +Ref: c-api/hash c PyHash_FuncDef name14931826 +Ref: 4b7914931826 +Ref: c-api/hash c PyHash_FuncDef hash_bits14931917 +Ref: 4b7a14931917 +Ref: c-api/hash c PyHash_FuncDef seed_bits14932009 +Ref: 4b7b14932009 +Ref: c-api/hash c PyHash_GetFuncDef14932116 +Ref: 4b7714932116 +Ref: c-api/hash c Py_HashPointer14932350 +Ref: 36314932350 +Ref: c-api/hash c PyObject_GenericHash14932659 +Ref: 36214932659 +Ref: PyHash API-Footnote-114933077 +Ref: PyHash API-Footnote-214933130 +Node: Reflection14933172 +Ref: c-api/reflection doc14933295 +Ref: 4b7c14933295 +Ref: c-api/reflection id114933295 +Ref: 4b7d14933295 +Ref: c-api/reflection reflection14933295 +Ref: 4b7e14933295 +Ref: c-api/reflection c PyEval_GetBuiltins14933330 +Ref: 34c14933330 +Ref: c-api/reflection c PyEval_GetLocals14933731 +Ref: 35014933731 +Ref: c-api/reflection c PyEval_GetGlobals14935277 +Ref: 34e14935277 +Ref: c-api/reflection c PyEval_GetFrame14935654 +Ref: 17bc14935654 +Ref: c-api/reflection c PyEval_GetFrameBuiltins14935962 +Ref: 34b14935962 +Ref: c-api/reflection c PyEval_GetFrameLocals14936314 +Ref: 34f14936314 +Ref: c-api/reflection c PyEval_GetFrameGlobals14936940 +Ref: 34d14936940 +Ref: c-api/reflection c PyEval_GetFuncName14937341 +Ref: 49b614937341 +Ref: c-api/reflection c PyEval_GetFuncDesc14937564 +Ref: 49b514937564 +Ref: Reflection-Footnote-114938016 +Node: Codec registry and support functions14938058 +Ref: c-api/codec doc14938183 +Ref: 4b7f14938183 +Ref: c-api/codec codec-registry14938183 +Ref: d3514938183 +Ref: c-api/codec codec-registry-and-support-functions14938183 +Ref: 4b8014938183 +Ref: c-api/codec c PyCodec_Register14938272 +Ref: 498b14938272 +Ref: c-api/codec c PyCodec_Unregister14938592 +Ref: 89514938592 +Ref: c-api/codec c PyCodec_KnownEncoding14938956 +Ref: 498914938956 +Ref: c-api/codec c PyCodec_Encode14939208 +Ref: 3fc14939208 +Ref: c-api/codec c PyCodec_Decode14939744 +Ref: 3fb14939744 +Node: Codec lookup API14940364 +Ref: c-api/codec codec-lookup-api14940510 +Ref: 4b8114940510 +Ref: c-api/codec c PyCodec_Encoder14940830 +Ref: 498514940830 +Ref: c-api/codec c PyCodec_Decoder14941048 +Ref: 498414941048 +Ref: c-api/codec c PyCodec_IncrementalEncoder14941265 +Ref: 498814941265 +Ref: c-api/codec c PyCodec_IncrementalDecoder14941541 +Ref: 498714941541 +Ref: c-api/codec c PyCodec_StreamReader14941817 +Ref: 498e14941817 +Ref: c-api/codec c PyCodec_StreamWriter14942108 +Ref: 498f14942108 +Node: Registry API for Unicode encoding error handlers14942399 +Ref: c-api/codec registry-api-for-unicode-encoding-error-handlers14942545 +Ref: 4b8214942545 +Ref: c-api/codec c PyCodec_RegisterError14942662 +Ref: 498c14942662 +Ref: c-api/codec c PyCodec_LookupError14943792 +Ref: 498a14943792 +Ref: c-api/codec c PyCodec_StrictErrors14944161 +Ref: 499014944161 +Ref: c-api/codec c PyCodec_IgnoreErrors14944352 +Ref: 498614944352 +Ref: c-api/codec c PyCodec_ReplaceErrors14944571 +Ref: 498d14944571 +Ref: c-api/codec c PyCodec_XMLCharRefReplaceErrors14944801 +Ref: 499114944801 +Ref: c-api/codec c PyCodec_BackslashReplaceErrors14945047 +Ref: 498314945047 +Ref: c-api/codec c PyCodec_NameReplaceErrors14945319 +Ref: ea814945319 +Node: PyTime C API14945603 +Ref: c-api/time doc14945739 +Ref: 15a14945739 +Ref: c-api/time c-api-time14945739 +Ref: 32714945739 +Ref: c-api/time pytime-c-api14945739 +Ref: 4b8314945739 +Node: Types<2>14946094 +Ref: c-api/time types14946175 +Ref: 4b8514946175 +Ref: c-api/time c PyTime_t14946206 +Ref: 32814946206 +Ref: c-api/time c PyTime_MIN14946731 +Ref: 32914946731 +Ref: c-api/time c PyTime_MAX14946824 +Ref: 32a14946824 +Node: Clock Functions14946917 +Ref: c-api/time clock-functions14947026 +Ref: 4b8614947026 +Ref: c-api/time c PyTime_Monotonic14947740 +Ref: 32c14947740 +Ref: c-api/time c PyTime_PerfCounter14947905 +Ref: 32e14947905 +Ref: c-api/time c PyTime_Time14948079 +Ref: 33014948079 +Node: Raw Clock Functions14948240 +Ref: c-api/time raw-clock-functions14948361 +Ref: 4b8714948361 +Ref: c-api/time c PyTime_MonotonicRaw14948849 +Ref: 32d14948849 +Ref: c-api/time c PyTime_PerfCounterRaw14949037 +Ref: 32f14949037 +Ref: c-api/time c PyTime_TimeRaw14949229 +Ref: 33114949229 +Node: Conversion functions14949407 +Ref: c-api/time conversion-functions14949504 +Ref: 4b8814949504 +Ref: c-api/time c PyTime_AsSecondsDouble14949565 +Ref: 32b14949565 +Node: Support for Perf Maps14949786 +Ref: c-api/perfmaps doc14949877 +Ref: 4b8914949877 +Ref: c-api/perfmaps perfmaps14949877 +Ref: 4b8a14949877 +Ref: c-api/perfmaps support-for-perf-maps14949877 +Ref: 4b8b14949877 +Ref: c-api/perfmaps c PyUnstable_PerfMapState_Init14950548 +Ref: 173a14950548 +Ref: c-api/perfmaps c PyUnstable_WritePerfMapEntry14951380 +Ref: 173914951380 +Ref: c-api/perfmaps c PyUnstable_PerfMapState_Fini14952165 +Ref: 173b14952165 +Ref: Support for Perf Maps-Footnote-114952719 +Ref: Support for Perf Maps-Footnote-214952776 +Node: Abstract Objects Layer14952900 +Ref: c-api/abstract doc14953040 +Ref: 4b8c14953040 +Ref: c-api/abstract abstract14953040 +Ref: 490c14953040 +Ref: c-api/abstract abstract-objects-layer14953040 +Ref: 4b8d14953040 +Node: Object Protocol14953745 +Ref: c-api/object doc14953841 +Ref: 4b8e14953841 +Ref: c-api/object object14953841 +Ref: 4b8f14953841 +Ref: c-api/object object-protocol14953841 +Ref: 4b9014953841 +Ref: c-api/object c Py_GetConstant14953886 +Ref: 35114953886 +Ref: c-api/object c Py_CONSTANT_NONE14954556 +Ref: 4b9114954556 +Ref: c-api/object c Py_CONSTANT_FALSE14954760 +Ref: 4b9214954760 +Ref: c-api/object c Py_CONSTANT_TRUE14954963 +Ref: 4b9314954963 +Ref: c-api/object c Py_CONSTANT_ELLIPSIS14955170 +Ref: 4b9414955170 +Ref: c-api/object c Py_CONSTANT_NOT_IMPLEMENTED14955385 +Ref: 4b9514955385 +Ref: c-api/object c Py_CONSTANT_ZERO14955587 +Ref: 4b9614955587 +Ref: c-api/object c Py_CONSTANT_ONE14955780 +Ref: 4b9714955780 +Ref: c-api/object c Py_CONSTANT_EMPTY_STR14955980 +Ref: 4b9814955980 +Ref: c-api/object c Py_CONSTANT_EMPTY_BYTES14956177 +Ref: 4b9914956177 +Ref: c-api/object c Py_CONSTANT_EMPTY_TUPLE14956373 +Ref: 4b9a14956373 +Ref: c-api/object c Py_GetConstantBorrowed14956698 +Ref: 35214956698 +Ref: c-api/object c Py_NotImplemented14957232 +Ref: 4b9b14957232 +Ref: c-api/object c Py_RETURN_NOTIMPLEMENTED14957420 +Ref: 4b9c14957420 +Ref: c-api/object c Py_PRINT_RAW14957655 +Ref: 4b9d14957655 +Ref: c-api/object c PyObject_Print14957948 +Ref: 15f214957948 +Ref: c-api/object c PyObject_HasAttrWithError14958330 +Ref: 37514958330 +Ref: c-api/object c PyObject_HasAttrStringWithError14958711 +Ref: 37714958711 +Ref: c-api/object c PyObject_HasAttr14959090 +Ref: 37614959090 +Ref: c-api/object c PyObject_HasAttrString14959739 +Ref: 37814959739 +Ref: c-api/object c PyObject_GetAttr14960484 +Ref: 34614960484 +Ref: c-api/object c PyObject_GetAttrString14960998 +Ref: 34714960998 +Ref: c-api/object c PyObject_GetOptionalAttr14961497 +Ref: 34414961497 +Ref: c-api/object c PyObject_GetOptionalAttrString14962217 +Ref: 34514962217 +Ref: c-api/object c PyObject_GenericGetAttr14962616 +Ref: 4a5f14962616 +Ref: c-api/object c PyObject_SetAttr14963295 +Ref: 4a6814963295 +Ref: c-api/object c PyObject_SetAttrString14963880 +Ref: 160214963880 +Ref: c-api/object c PyObject_GenericSetAttr14964811 +Ref: 4a6014964811 +Ref: c-api/object c PyObject_DelAttr14965512 +Ref: 153814965512 +Ref: c-api/object c PyObject_DelAttrString14965817 +Ref: 153914965817 +Ref: c-api/object c PyObject_GenericGetDict14966619 +Ref: 193a14966619 +Ref: c-api/object c PyObject_GenericSetDict14967361 +Ref: 4a6114967361 +Ref: c-api/object c _PyObject_GetDictPtr14967701 +Ref: 4b9e14967701 +Ref: c-api/object c PyObject_RichCompare14968129 +Ref: 490a14968129 +Ref: c-api/object c PyObject_RichCompareBool14968855 +Ref: 19a214968855 +Ref: c-api/object c PyObject_Format14969394 +Ref: 4a5e14969394 +Ref: c-api/object c PyObject_Repr14969836 +Ref: 102814969836 +Ref: c-api/object c PyObject_ASCII14970392 +Ref: 4a5714970392 +Ref: c-api/object c PyObject_Str14970935 +Ref: 102914970935 +Ref: c-api/object c PyObject_Bytes14971540 +Ref: 4a5914971540 +Ref: c-api/object c PyObject_IsSubclass14972026 +Ref: ea014972026 +Ref: c-api/object c PyObject_IsInstance14973058 +Ref: e9f14973058 +Ref: c-api/object c PyObject_Hash14974080 +Ref: 3ff14974080 +Ref: c-api/object c PyObject_HashNotImplemented14974488 +Ref: 139214974488 +Ref: c-api/object c PyObject_IsTrue14974913 +Ref: 4a6414974913 +Ref: c-api/object c PyObject_Not14975198 +Ref: 4a6614975198 +Ref: c-api/object c PyObject_Type14975476 +Ref: 4a6a14975476 +Ref: c-api/object c PyObject_TypeCheck14976181 +Ref: 18f714976181 +Ref: c-api/object c PyObject_Size14976406 +Ref: 4a6914976406 +Ref: c-api/object c PyObject_Length14976473 +Ref: 4a6514976473 +Ref: c-api/object c PyObject_LengthHint14976840 +Ref: ffd14976840 +Ref: c-api/object c PyObject_GetItem14977301 +Ref: 34214977301 +Ref: c-api/object c PyObject_SetItem14977631 +Ref: 494714977631 +Ref: c-api/object c PyObject_DelItem14978016 +Ref: 4a5b14978016 +Ref: c-api/object c PyObject_DelItemString14978289 +Ref: 4a5c14978289 +Ref: c-api/object c PyObject_Dir14978585 +Ref: 4a5d14978585 +Ref: c-api/object c PyObject_GetIter14979177 +Ref: 4a6314979177 +Ref: c-api/object c PyObject_SelfIter14979604 +Ref: 4a6714979604 +Ref: c-api/object c PyObject_GetAIter14979948 +Ref: 4a6214979948 +Ref: c-api/object c PyObject_GetTypeData14980506 +Ref: 54614980506 +Ref: c-api/object c PyType_GetTypeDataSize14980978 +Ref: 54714980978 +Ref: c-api/object c PyObject_GetItemData14981659 +Ref: 54914981659 +Ref: c-api/object c PyObject_VisitManagedDict14982002 +Ref: 36414982002 +Ref: c-api/object c PyObject_ClearManagedDict14982317 +Ref: 36514982317 +Ref: Object Protocol-Footnote-114982631 +Ref: Object Protocol-Footnote-214982673 +Node: Call Protocol14982715 +Ref: c-api/call doc14982835 +Ref: 4ba514982835 +Ref: c-api/call call14982835 +Ref: 58014982835 +Ref: c-api/call call-protocol14982835 +Ref: 4ba614982835 +Node: The tp_call Protocol14983060 +Ref: c-api/call the-tp-call-protocol14983162 +Ref: 4ba714983162 +Node: The Vectorcall Protocol14983898 +Ref: c-api/call the-vectorcall-protocol14984027 +Ref: 4ba914984027 +Ref: c-api/call vectorcall14984027 +Ref: 54f14984027 +Ref: c-api/call c vectorcallfunc14985803 +Ref: 55414985803 +Ref: c-api/call c PY_VECTORCALL_ARGUMENTS_OFFSET14986885 +Ref: 55b14986885 +Ref: The Vectorcall Protocol-Footnote-114988021 +Node: Recursion Control<2>14988063 +Ref: c-api/call recursion-control14988174 +Ref: 4bab14988174 +Node: Vectorcall Support API14988586 +Ref: c-api/call vectorcall-support-api14988697 +Ref: 4bac14988697 +Ref: c-api/call c PyVectorcall_NARGS14988760 +Ref: 55214988760 +Ref: c-api/call c PyVectorcall_Function14989221 +Ref: 4bad14989221 +Ref: c-api/call c PyVectorcall_Call14989770 +Ref: 55314989770 +Node: Object Calling API14990383 +Ref: c-api/call capi-call14990508 +Ref: 4ba814990508 +Ref: c-api/call object-calling-api14990508 +Ref: 4bae14990508 +Ref: c-api/call c PyObject_Call14995136 +Ref: 39814995136 +Ref: c-api/call c PyObject_CallNoArgs14995824 +Ref: 39714995824 +Ref: c-api/call c PyObject_CallOneArg14996306 +Ref: 97814996306 +Ref: c-api/call c PyObject_CallObject14996699 +Ref: 48c714996699 +Ref: c-api/call c PyObject_CallFunction14997218 +Ref: 39a14997218 +Ref: c-api/call c PyObject_CallMethod14998074 +Ref: 39b14998074 +Ref: c-api/call c PyObject_CallFunctionObjArgs14998994 +Ref: 4a5a14998994 +Ref: c-api/call c PyObject_CallMethodObjArgs14999570 +Ref: 19fc14999570 +Ref: c-api/call c PyObject_CallMethodNoArgs15000160 +Ref: 4baf15000160 +Ref: c-api/call c PyObject_CallMethodOneArg15000551 +Ref: 4bb015000551 +Ref: c-api/call c PyObject_Vectorcall15000979 +Ref: 55915000979 +Ref: c-api/call c PyObject_VectorcallDict15001570 +Ref: 4bb115001570 +Ref: c-api/call c PyObject_VectorcallMethod15002282 +Ref: 55a15002282 +Node: Call Support API15003404 +Ref: c-api/call call-support-api15003497 +Ref: 4bb315003497 +Ref: c-api/call c PyCallable_Check15003548 +Ref: 497915003548 +Node: Number Protocol15003792 +Ref: c-api/number doc15003914 +Ref: 4bb415003914 +Ref: c-api/number number15003914 +Ref: 4bb515003914 +Ref: c-api/number number-protocol15003914 +Ref: 4bb615003914 +Ref: c-api/number c PyNumber_Check15003959 +Ref: a6615003959 +Ref: c-api/number c PyNumber_Add15004252 +Ref: 4a3615004252 +Ref: c-api/number c PyNumber_Subtract15004567 +Ref: 4a5015004567 +Ref: c-api/number c PyNumber_Multiply15004893 +Ref: 4a4915004893 +Ref: c-api/number c PyNumber_MatrixMultiply15005218 +Ref: eaf15005218 +Ref: c-api/number c PyNumber_FloorDivide15005609 +Ref: 4a3a15005609 +Ref: c-api/number c PyNumber_TrueDivide15005931 +Ref: 4a5115005931 +Ref: c-api/number c PyNumber_Remainder15006546 +Ref: 4a4e15006546 +Ref: c-api/number c PyNumber_Divmod15006871 +Ref: 4a3915006871 +Ref: c-api/number c PyNumber_Power15007210 +Ref: 4a4d15007210 +Ref: c-api/number c PyNumber_Negative15007728 +Ref: 4a4a15007728 +Ref: c-api/number c PyNumber_Positive15008009 +Ref: 4a4c15008009 +Ref: c-api/number c PyNumber_Absolute15008274 +Ref: 4a3515008274 +Ref: c-api/number c PyNumber_Invert15008559 +Ref: 4a4715008559 +Ref: c-api/number c PyNumber_Lshift15008846 +Ref: 4a4815008846 +Ref: c-api/number c PyNumber_Rshift15009182 +Ref: 4a4f15009182 +Ref: c-api/number c PyNumber_And15009519 +Ref: 4a3715009519 +Ref: c-api/number c PyNumber_Xor15009849 +Ref: 4a5215009849 +Ref: c-api/number c PyNumber_Or15010187 +Ref: 4a4b15010187 +Ref: c-api/number c PyNumber_InPlaceAdd15010515 +Ref: 4a3b15010515 +Ref: c-api/number c PyNumber_InPlaceSubtract15010893 +Ref: 4a4415010893 +Ref: c-api/number c PyNumber_InPlaceMultiply15011283 +Ref: 4a3f15011283 +Ref: c-api/number c PyNumber_InPlaceMatrixMultiply15011672 +Ref: eb015011672 +Ref: c-api/number c PyNumber_InPlaceFloorDivide15012132 +Ref: 4a3d15012132 +Ref: c-api/number c PyNumber_InPlaceTrueDivide15012538 +Ref: 4a4515012538 +Ref: c-api/number c PyNumber_InPlaceRemainder15013222 +Ref: 4a4215013222 +Ref: c-api/number c PyNumber_InPlacePower15013610 +Ref: 4a4115013610 +Ref: c-api/number c PyNumber_InPlaceLshift15014260 +Ref: 4a3e15014260 +Ref: c-api/number c PyNumber_InPlaceRshift15014665 +Ref: 4a4315014665 +Ref: c-api/number c PyNumber_InPlaceAnd15015071 +Ref: 4a3c15015071 +Ref: c-api/number c PyNumber_InPlaceXor15015470 +Ref: 4a4615015470 +Ref: c-api/number c PyNumber_InPlaceOr15015877 +Ref: 4a4015015877 +Ref: c-api/number c PyNumber_Long15016274 +Ref: a6715016274 +Ref: c-api/number c PyNumber_Float15016584 +Ref: a6815016584 +Ref: c-api/number c PyNumber_Index15016894 +Ref: 89115016894 +Ref: c-api/number c PyNumber_ToBase15017342 +Ref: 17e915017342 +Ref: c-api/number c PyNumber_AsSsize_t15017867 +Ref: 4a3815017867 +Ref: c-api/number c PyIndex_Check15018676 +Ref: 98a15018676 +Node: Sequence Protocol15018978 +Ref: c-api/sequence doc15019103 +Ref: 4bb715019103 +Ref: c-api/sequence sequence15019103 +Ref: 4bb815019103 +Ref: c-api/sequence sequence-protocol15019103 +Ref: 4bb915019103 +Ref: c-api/sequence c PySequence_Check15019152 +Ref: 4a6e15019152 +Ref: c-api/sequence c PySequence_Size15019609 +Ref: 1a5115019609 +Ref: c-api/sequence c PySequence_Length15019678 +Ref: 4a7815019678 +Ref: c-api/sequence c PySequence_Concat15019946 +Ref: 4a6f15019946 +Ref: c-api/sequence c PySequence_Repeat15020277 +Ref: 4a7a15020277 +Ref: c-api/sequence c PySequence_InPlaceConcat15020624 +Ref: 4a7515020624 +Ref: c-api/sequence c PySequence_InPlaceRepeat15021025 +Ref: 4a7615021025 +Ref: c-api/sequence c PySequence_GetItem15021441 +Ref: 1a5215021441 +Ref: c-api/sequence c PySequence_GetSlice15021742 +Ref: 4a7415021742 +Ref: c-api/sequence c PySequence_SetItem15022099 +Ref: 1a5315022099 +Ref: c-api/sequence c PySequence_DelItem15022637 +Ref: 1a5415022637 +Ref: c-api/sequence c PySequence_SetSlice15022893 +Ref: 4a7b15022893 +Ref: c-api/sequence c PySequence_DelSlice15023209 +Ref: 4a7215023209 +Ref: c-api/sequence c PySequence_Count15023515 +Ref: 4a7115023515 +Ref: c-api/sequence c PySequence_Contains15023889 +Ref: 4a7015023889 +Ref: c-api/sequence c PySequence_Index15024228 +Ref: 4a7715024228 +Ref: c-api/sequence c PySequence_List15024533 +Ref: 4a7915024533 +Ref: c-api/sequence c PySequence_Tuple15024904 +Ref: 4a7c15024904 +Ref: c-api/sequence c PySequence_Fast15025367 +Ref: 4a7315025367 +Ref: c-api/sequence c PySequence_Fast_GET_SIZE15026111 +Ref: 4bbb15026111 +Ref: c-api/sequence c PySequence_Fast_GET_ITEM15026532 +Ref: 4bbc15026532 +Ref: c-api/sequence c PySequence_Fast_ITEMS15026838 +Ref: 4bbd15026838 +Ref: c-api/sequence c PySequence_ITEM15027264 +Ref: 4bbe15027264 +Node: Mapping Protocol15027635 +Ref: c-api/mapping doc15027762 +Ref: 4bbf15027762 +Ref: c-api/mapping mapping15027762 +Ref: 4bc015027762 +Ref: c-api/mapping mapping-protocol15027762 +Ref: 4bc115027762 +Ref: c-api/mapping c PyMapping_Check15027918 +Ref: 4a2615027918 +Ref: c-api/mapping c PyMapping_Size15028348 +Ref: 1a5515028348 +Ref: c-api/mapping c PyMapping_Length15028416 +Ref: 4a2715028416 +Ref: c-api/mapping c PyMapping_GetItemString15028678 +Ref: 34315028678 +Ref: c-api/mapping c PyMapping_GetOptionalItem15029028 +Ref: 34015029028 +Ref: c-api/mapping c PyMapping_GetOptionalItemString15029711 +Ref: 34115029711 +Ref: c-api/mapping c PyMapping_SetItemString15030099 +Ref: 4a2815030099 +Ref: c-api/mapping c PyMapping_DelItem15030409 +Ref: 4bc215030409 +Ref: c-api/mapping c PyMapping_DelItemString15030535 +Ref: 4bc315030535 +Ref: c-api/mapping c PyMapping_HasKeyWithError15030794 +Ref: 37915030794 +Ref: c-api/mapping c PyMapping_HasKeyStringWithError15031156 +Ref: 37b15031156 +Ref: c-api/mapping c PyMapping_HasKey15031523 +Ref: 37a15031523 +Ref: c-api/mapping c PyMapping_HasKeyString15032121 +Ref: 37c15032121 +Ref: c-api/mapping c PyMapping_Keys15032805 +Ref: bbc15032805 +Ref: c-api/mapping c PyMapping_Values15033131 +Ref: bbd15033131 +Ref: c-api/mapping c PyMapping_Items15033461 +Ref: bbe15033461 +Node: Iterator Protocol15033850 +Ref: c-api/iter doc15033975 +Ref: 4bc415033975 +Ref: c-api/iter iterator15033975 +Ref: 4bc515033975 +Ref: c-api/iter iterator-protocol15033975 +Ref: 4bc615033975 +Ref: c-api/iter c PyIter_Check15034090 +Ref: 18f415034090 +Ref: c-api/iter c PyAIter_Check15034356 +Ref: 496115034356 +Ref: c-api/iter c PyIter_Next15034640 +Ref: 4a1315034640 +Ref: c-api/iter c PySendResult15035701 +Ref: 4bc715035701 +Ref: c-api/iter c PyIter_Send15035852 +Ref: 89615035852 +Node: Buffer Protocol15036437 +Ref: c-api/buffer doc15036537 +Ref: 4bc815036537 +Ref: c-api/buffer buffer-protocol15036537 +Ref: 4bc915036537 +Ref: c-api/buffer bufferobjects15036537 +Ref: 39315036537 +Node: Buffer structure15039304 +Ref: c-api/buffer buffer-structure15039401 +Ref: 4bcb15039401 +Ref: c-api/buffer id115039401 +Ref: 4bcc15039401 +Ref: c-api/buffer c Py_buffer15040476 +Ref: 75315040476 +Ref: c-api/buffer c Py_buffer buf15040594 +Ref: 4bce15040594 +Ref: c-api/buffer c Py_buffer obj15041056 +Ref: 4bd015041056 +Ref: c-api/buffer c Py_buffer len15041693 +Ref: 4bd115041693 +Ref: c-api/buffer c Py_buffer readonly15042305 +Ref: 4bd315042305 +Ref: c-api/buffer c Py_buffer itemsize15042475 +Ref: 4bd415042475 +Ref: c-api/buffer c Py_buffer format15043404 +Ref: 4bd515043404 +Ref: c-api/buffer c Py_buffer ndim15043726 +Ref: 4bd815043726 +Ref: c-api/buffer c Py_buffer shape15044150 +Ref: 4bd715044150 +Ref: c-api/buffer c Py_buffer strides15044715 +Ref: 4bcf15044715 +Ref: c-api/buffer c Py_buffer suboffsets15045253 +Ref: 4bd915045253 +Ref: c-api/buffer c Py_buffer internal15046157 +Ref: 4bdc15046157 +Ref: c-api/buffer c PyBUF_MAX_NDIM15046544 +Ref: 4bda15046544 +Node: Buffer request types15046810 +Ref: c-api/buffer buffer-request-types15046930 +Ref: 44d115046930 +Ref: c-api/buffer id215046930 +Ref: 4bdd15046930 +Node: request-independent fields15047538 +Ref: c-api/buffer request-independent-fields15047645 +Ref: 4bde15047645 +Node: readonly format15047913 +Ref: c-api/buffer readonly-format15048053 +Ref: 4bdf15048053 +Ref: c-api/buffer c PyBUF_WRITABLE15048104 +Ref: 138615048104 +Ref: c-api/buffer c PyBUF_FORMAT15048576 +Ref: 4bd615048576 +Node: shape strides suboffsets15049212 +Ref: c-api/buffer shape-strides-suboffsets15049345 +Ref: 4be015049345 +Ref: c-api/buffer c PyBUF_INDIRECT15049882 +Ref: 4be115049882 +Ref: c-api/buffer c PyBUF_STRIDES15050073 +Ref: 4be215050073 +Ref: c-api/buffer c PyBUF_ND15050255 +Ref: 4be315050255 +Ref: c-api/buffer c PyBUF_SIMPLE15050446 +Ref: 4bd215050446 +Node: contiguity requests15050548 +Ref: c-api/buffer contiguity-requests15050683 +Ref: 4be415050683 +Ref: c-api/buffer c PyBUF_C_CONTIGUOUS15051292 +Ref: 138715051292 +Ref: c-api/buffer c PyBUF_F_CONTIGUOUS15051545 +Ref: 138815051545 +Ref: c-api/buffer c PyBUF_ANY_CONTIGUOUS15051800 +Ref: 4be515051800 +Node: compound requests15052195 +Ref: c-api/buffer compound-requests15052297 +Ref: 4be615052297 +Ref: c-api/buffer c PyBUF_FULL15053171 +Ref: 4be715053171 +Ref: c-api/buffer c PyBUF_FULL_RO15053501 +Ref: 4be815053501 +Ref: c-api/buffer c PyBUF_RECORDS15053828 +Ref: 4be915053828 +Ref: c-api/buffer c PyBUF_RECORDS_RO15054158 +Ref: 4bea15054158 +Ref: c-api/buffer c PyBUF_STRIDED15054482 +Ref: 4beb15054482 +Ref: c-api/buffer c PyBUF_STRIDED_RO15054813 +Ref: 4bec15054813 +Ref: c-api/buffer c PyBUF_CONTIG15055137 +Ref: 4bed15055137 +Ref: c-api/buffer c PyBUF_CONTIG_RO15055468 +Ref: 4bee15055468 +Node: Complex arrays15055661 +Ref: c-api/buffer complex-arrays15055789 +Ref: 4bdb15055789 +Node: NumPy-style shape and strides15055995 +Ref: c-api/buffer numpy-style-shape-and-strides15056122 +Ref: 4bef15056122 +Node: PIL-style shape strides and suboffsets15058002 +Ref: c-api/buffer pil-style-shape-strides-and-suboffsets15058129 +Ref: 4bf015058129 +Node: Buffer-related functions15059355 +Ref: c-api/buffer buffer-related-functions15059454 +Ref: 4bf115059454 +Ref: c-api/buffer c PyObject_CheckBuffer15059523 +Ref: 39415059523 +Ref: c-api/buffer c PyObject_GetBuffer15059867 +Ref: 39515059867 +Ref: c-api/buffer c PyBuffer_Release15060877 +Ref: 39615060877 +Ref: c-api/buffer c PyBuffer_SizeFromFormat15061406 +Ref: 75515061406 +Ref: c-api/buffer c PyBuffer_IsContiguous15061714 +Ref: 75915061714 +Ref: c-api/buffer c PyBuffer_GetPointer15062133 +Ref: 75415062133 +Ref: c-api/buffer c PyBuffer_FromContiguous15062446 +Ref: 75715062446 +Ref: c-api/buffer c PyBuffer_ToContiguous15062829 +Ref: 75615062829 +Ref: c-api/buffer c PyObject_CopyData15063307 +Ref: 75815063307 +Ref: c-api/buffer c PyBuffer_FillContiguousStrides15063607 +Ref: 75a15063607 +Ref: c-api/buffer c PyBuffer_FillInfo15064058 +Ref: 75b15064058 +Node: Concrete Objects Layer15065088 +Ref: c-api/concrete doc15065255 +Ref: 4bf215065255 +Ref: c-api/concrete concrete15065255 +Ref: 4bf315065255 +Ref: c-api/concrete concrete-objects-layer15065255 +Ref: 4bf415065255 +Node: Fundamental Objects15066240 +Ref: c-api/concrete fundamental15066342 +Ref: 4bf615066342 +Ref: c-api/concrete fundamental-objects15066342 +Ref: 4bf715066342 +Node: Type Objects<2>15066539 +Ref: c-api/type doc15066634 +Ref: 4bf815066634 +Ref: c-api/type type-objects15066634 +Ref: 4bf915066634 +Ref: c-api/type typeobjects15066634 +Ref: 4bfa15066634 +Ref: c-api/type c PyTypeObject15066677 +Ref: aa515066677 +Ref: c-api/type c PyType_Type15066845 +Ref: 54a15066845 +Ref: c-api/type c PyType_Check15067058 +Ref: 199d15067058 +Ref: c-api/type c PyType_CheckExact15067304 +Ref: 199e15067304 +Ref: c-api/type c PyType_ClearCache15067533 +Ref: 4a9915067533 +Ref: c-api/type c PyType_GetFlags15067699 +Ref: 195415067699 +Ref: c-api/type c PyType_GetDict15068244 +Ref: 171d15068244 +Ref: c-api/type c PyType_Modified15068987 +Ref: 17f115068987 +Ref: c-api/type c PyType_AddWatcher15069287 +Ref: 56115069287 +Ref: c-api/type c PyType_ClearWatcher15069805 +Ref: 4bfb15069805 +Ref: c-api/type c PyType_Watch15070276 +Ref: 56215070276 +Ref: c-api/type c PyType_WatchCallback15070979 +Ref: 4bfc15070979 +Ref: c-api/type c PyType_HasFeature15071334 +Ref: 195315071334 +Ref: c-api/type c PyType_IS_GC15071529 +Ref: 4bfd15071529 +Ref: c-api/type c PyType_IsSubtype15071720 +Ref: 4a9a15071720 +Ref: c-api/type c PyType_GenericAlloc15072123 +Ref: a6b15072123 +Ref: c-api/type c PyType_GenericNew15072517 +Ref: 48e515072517 +Ref: c-api/type c PyType_Ready15072863 +Ref: 77715072863 +Ref: c-api/type c PyType_GetName15073757 +Ref: 74d15073757 +Ref: c-api/type c PyType_GetQualName15074071 +Ref: 74e15074071 +Ref: c-api/type c PyType_GetFullyQualifiedName15074403 +Ref: 36e15074403 +Ref: c-api/type c PyType_GetModuleName15074834 +Ref: 37015074834 +Ref: c-api/type c PyType_GetSlot15075127 +Ref: 89a15075127 +Ref: c-api/type c PyType_GetModule15075827 +Ref: 96e15075827 +Ref: c-api/type c PyType_GetModuleState15076779 +Ref: 96f15076779 +Ref: c-api/type c PyType_GetModuleByDef15077371 +Ref: 38f15077371 +Ref: c-api/type c PyUnstable_Type_AssignVersionTag15078359 +Ref: 4c0015078359 +Node: Creating Heap-Allocated Types15078874 +Ref: c-api/type creating-heap-allocated-types15078955 +Ref: 4c0115078955 +Ref: c-api/type c PyType_FromMetaclass15079111 +Ref: 54d15079111 +Ref: c-api/type c PyType_FromModuleAndSpec15081534 +Ref: 54e15081534 +Ref: c-api/type c PyType_FromSpecWithBases15082445 +Ref: 57b15082445 +Ref: c-api/type c PyType_FromSpec15083194 +Ref: 57a15083194 +Ref: c-api/type c PyType_Spec15083899 +Ref: 171b15083899 +Ref: c-api/type c PyType_Spec name15084042 +Ref: 4c0215084042 +Ref: c-api/type c PyType_Spec basicsize15084164 +Ref: 54515084164 +Ref: c-api/type c PyType_Spec itemsize15084930 +Ref: 4c0315084930 +Ref: c-api/type c PyType_Spec flags15086053 +Ref: 4c0415086053 +Ref: c-api/type c PyType_Spec slots15086295 +Ref: 4c0515086295 +Ref: c-api/type c PyType_Slot15086527 +Ref: 4a9b15086527 +Ref: c-api/type c PyType_Slot slot15086730 +Ref: 4bfe15086730 +Ref: c-api/type c PyType_Slot pfunc15088972 +Ref: 4c0f15088972 +Node: The None Object15089172 +Ref: c-api/none doc15089267 +Ref: 4c1015089267 +Ref: c-api/none noneobject15089267 +Ref: 4c1115089267 +Ref: c-api/none the-none-object15089267 +Ref: 4c1215089267 +Ref: c-api/none c Py_None15089586 +Ref: 48b915089586 +Ref: c-api/none c Py_RETURN_NONE15089837 +Ref: 143c15089837 +Node: Numeric Objects15089917 +Ref: c-api/concrete numeric-objects15090044 +Ref: 4c1315090044 +Ref: c-api/concrete numericobjects15090044 +Ref: 4c1415090044 +Node: Integer Objects15090193 +Ref: c-api/long doc15090284 +Ref: 4c1515090284 +Ref: c-api/long integer-objects15090284 +Ref: 4c1615090284 +Ref: c-api/long longobjects15090284 +Ref: 4c1715090284 +Ref: c-api/long c PyLongObject15090576 +Ref: 58515090576 +Ref: c-api/long c PyLong_Type15090753 +Ref: 4a2515090753 +Ref: c-api/long c PyLong_Check15091004 +Ref: 4c1815091004 +Ref: c-api/long c PyLong_CheckExact15091194 +Ref: 4c1915091194 +Ref: c-api/long c PyLong_FromLong15091394 +Ref: 183915091394 +Ref: c-api/long c PyLong_FromUnsignedLong15091856 +Ref: 19c015091856 +Ref: c-api/long c PyLong_FromSsize_t15092127 +Ref: 4a2115092127 +Ref: c-api/long c PyLong_FromSize_t15092388 +Ref: 19c215092388 +Ref: c-api/long c PyLong_FromLongLong15092635 +Ref: 183a15092635 +Ref: c-api/long c PyLong_FromUnsignedLongLong15092884 +Ref: 19c115092884 +Ref: c-api/long c PyLong_FromDouble15093169 +Ref: 94215093169 +Ref: c-api/long c PyLong_FromString15093423 +Ref: 4a2215093423 +Ref: c-api/long c PyLong_FromUnicodeObject15094763 +Ref: 8b915094763 +Ref: c-api/long c PyLong_FromVoidPtr15095013 +Ref: 4a2315095013 +Ref: c-api/long c PyLong_FromNativeBytes15095316 +Ref: 35d15095316 +Ref: c-api/long c PyLong_FromUnsignedNativeBytes15095996 +Ref: 35e15095996 +Ref: c-api/long c PyLong_AsLong15096536 +Ref: 35b15096536 +Ref: c-api/long c PyLong_AS_LONG15097199 +Ref: 4c1a15097199 +Ref: c-api/long c PyLong_AsInt15097549 +Ref: 35a15097549 +Ref: c-api/long c PyLong_AsLongAndOverflow15097794 +Ref: 125a15097794 +Ref: c-api/long c PyLong_AsLongLong15098700 +Ref: 4a1b15098700 +Ref: c-api/long c PyLong_AsLongLongAndOverflow15099382 +Ref: 125915099382 +Ref: c-api/long c PyLong_AsSsize_t15100332 +Ref: 4a1d15100332 +Ref: c-api/long c PyLong_AsUnsignedLong15100794 +Ref: 4a1e15100794 +Ref: c-api/long c PyLong_AsSize_t15101241 +Ref: 4a1c15101241 +Ref: c-api/long c PyLong_AsUnsignedLongLong15101666 +Ref: 128715101666 +Ref: c-api/long c PyLong_AsUnsignedLongMask15102266 +Ref: 4a1f15102266 +Ref: c-api/long c PyLong_AsUnsignedLongLongMask15103010 +Ref: 19e515103010 +Ref: c-api/long c PyLong_AsDouble15103789 +Ref: 4a1a15103789 +Ref: c-api/long c PyLong_AsVoidPtr15104196 +Ref: 4a2015104196 +Ref: c-api/long c PyLong_AsNativeBytes15104658 +Ref: 35c15104658 +Ref: c-api/long c Py_ASNATIVEBYTES_DEFAULTS15108797 +Ref: 4c1b15108797 +Ref: c-api/long c Py_ASNATIVEBYTES_BIG_ENDIAN15108975 +Ref: 4c1c15108975 +Ref: c-api/long c Py_ASNATIVEBYTES_LITTLE_ENDIAN15109153 +Ref: 4c1d15109153 +Ref: c-api/long c Py_ASNATIVEBYTES_NATIVE_ENDIAN15109328 +Ref: 4c1e15109328 +Ref: c-api/long c Py_ASNATIVEBYTES_UNSIGNED_BUFFER15109505 +Ref: 4c1f15109505 +Ref: c-api/long c Py_ASNATIVEBYTES_REJECT_NEGATIVE15109680 +Ref: 4c2015109680 +Ref: c-api/long c Py_ASNATIVEBYTES_ALLOW_INDEX15109851 +Ref: 4c2115109851 +Ref: c-api/long c PyLong_GetInfo15111795 +Ref: 4a2415111795 +Ref: c-api/long c PyUnstable_Long_IsCompact15112203 +Ref: 58615112203 +Ref: c-api/long c PyUnstable_Long_CompactValue15112994 +Ref: 58715112994 +Node: Boolean Objects15113448 +Ref: c-api/bool doc15113570 +Ref: 4c2215113570 +Ref: c-api/bool boolean-objects15113570 +Ref: 4c2315113570 +Ref: c-api/bool boolobjects15113570 +Ref: 4c2415113570 +Ref: c-api/bool c PyBool_Type15113885 +Ref: 496615113885 +Ref: c-api/bool c PyBool_Check15114134 +Ref: 4c2715114134 +Ref: c-api/bool c Py_False15114280 +Ref: 4c2515114280 +Ref: c-api/bool c Py_True15114510 +Ref: 4c2615114510 +Ref: c-api/bool c Py_RETURN_FALSE15114737 +Ref: 143e15114737 +Ref: c-api/bool c Py_RETURN_TRUE15114819 +Ref: 143d15114819 +Ref: c-api/bool c PyBool_FromLong15114899 +Ref: 496515114899 +Node: Floating-Point Objects15115138 +Ref: c-api/float doc15115267 +Ref: 4c2815115267 +Ref: c-api/float floating-point-objects15115267 +Ref: 4c2915115267 +Ref: c-api/float floatobjects15115267 +Ref: 4c2a15115267 +Ref: c-api/float c PyFloatObject15115330 +Ref: 4c2b15115330 +Ref: c-api/float c PyFloat_Type15115453 +Ref: 4a0315115453 +Ref: c-api/float c PyFloat_Check15115714 +Ref: 4c2c15115714 +Ref: c-api/float c PyFloat_CheckExact15115914 +Ref: 4c2d15115914 +Ref: c-api/float c PyFloat_FromString15116124 +Ref: 4a0215116124 +Ref: c-api/float c PyFloat_FromDouble15116388 +Ref: 4a0115116388 +Ref: c-api/float c PyFloat_AsDouble15116621 +Ref: a6915116621 +Ref: c-api/float c PyFloat_AS_DOUBLE15117257 +Ref: 4c2e15117257 +Ref: c-api/float c PyFloat_GetInfo15117421 +Ref: 13bc15117421 +Ref: c-api/float c PyFloat_GetMax15117749 +Ref: 13ba15117749 +Ref: c-api/float c PyFloat_GetMin15117909 +Ref: 13bb15117909 +Node: Pack and Unpack functions15118108 +Ref: c-api/float pack-and-unpack-functions15118192 +Ref: 4c2f15118192 +Node: Pack functions15119493 +Ref: c-api/float pack-functions15119594 +Ref: 4c3015119594 +Ref: c-api/float c PyFloat_Pack215120368 +Ref: 76015120368 +Ref: c-api/float c PyFloat_Pack415120501 +Ref: 76115120501 +Ref: c-api/float c PyFloat_Pack815120636 +Ref: 76215120636 +Node: Unpack functions15120771 +Ref: c-api/float unpack-functions15120872 +Ref: 4c3115120872 +Ref: c-api/float c PyFloat_Unpack215121623 +Ref: 76315121623 +Ref: c-api/float c PyFloat_Unpack415121759 +Ref: 76415121759 +Ref: c-api/float c PyFloat_Unpack815121897 +Ref: 76515121897 +Node: Complex Number Objects15122035 +Ref: c-api/complex doc15122140 +Ref: 4c3215122140 +Ref: c-api/complex complex-number-objects15122140 +Ref: 4c3315122140 +Ref: c-api/complex complexobjects15122140 +Ref: 4c3415122140 +Node: Complex Numbers as C Structures15122573 +Ref: c-api/complex complex-numbers-as-c-structures15122705 +Ref: 4c3515122705 +Ref: c-api/complex c Py_complex15122988 +Ref: 4b6815122988 +Ref: c-api/complex c Py_complex real15123262 +Ref: 4c3615123262 +Ref: c-api/complex c Py_complex imag15123293 +Ref: 4c3715123293 +Ref: c-api/complex c _Py_c_sum15123466 +Ref: 4c3815123466 +Ref: c-api/complex c _Py_c_diff15123665 +Ref: 4c3915123665 +Ref: c-api/complex c _Py_c_neg15123877 +Ref: 4c3a15123877 +Ref: c-api/complex c _Py_c_prod15124057 +Ref: 4c3b15124057 +Ref: c-api/complex c _Py_c_quot15124261 +Ref: 4c3c15124261 +Ref: c-api/complex c _Py_c_pow15124566 +Ref: 15b615124566 +Node: Complex Numbers as Python Objects15124898 +Ref: c-api/complex complex-numbers-as-python-objects15125030 +Ref: 4c3d15125030 +Ref: c-api/complex c PyComplexObject15125115 +Ref: 4c3e15125115 +Ref: c-api/complex c PyComplex_Type15125240 +Ref: 499315125240 +Ref: c-api/complex c PyComplex_Check15125503 +Ref: 4c3f15125503 +Ref: c-api/complex c PyComplex_CheckExact15125709 +Ref: 4c4015125709 +Ref: c-api/complex c PyComplex_FromCComplex15125925 +Ref: 4c4115125925 +Ref: c-api/complex c PyComplex_FromDoubles15126192 +Ref: 499215126192 +Ref: c-api/complex c PyComplex_RealAsDouble15126499 +Ref: 169715126499 +Ref: c-api/complex c PyComplex_ImagAsDouble15127204 +Ref: 169815127204 +Ref: c-api/complex c PyComplex_AsCComplex15127924 +Ref: 13bd15127924 +Node: Sequence Objects15128748 +Ref: c-api/concrete sequence-objects15128873 +Ref: 4c4215128873 +Ref: c-api/concrete sequenceobjects15128873 +Ref: 4c4315128873 +Node: Bytes Objects<2>15129268 +Ref: c-api/bytes doc15129364 +Ref: 4c4415129364 +Ref: c-api/bytes bytes-objects15129364 +Ref: 4c4515129364 +Ref: c-api/bytes bytesobjects15129364 +Ref: 4c4615129364 +Ref: c-api/bytes c PyBytesObject15129526 +Ref: 78d15129526 +Ref: c-api/bytes c PyBytes_Type15129640 +Ref: 497315129640 +Ref: c-api/bytes c PyBytes_Check15129889 +Ref: 138015129889 +Ref: c-api/bytes c PyBytes_CheckExact15130076 +Ref: 4c4715130076 +Ref: c-api/bytes c PyBytes_FromString15130279 +Ref: 497115130279 +Ref: c-api/bytes c PyBytes_FromStringAndSize15130614 +Ref: 138115130614 +Ref: c-api/bytes c PyBytes_FromFormat15131007 +Ref: 1a2815131007 +Ref: c-api/bytes c PyBytes_FromFormatV15134919 +Ref: 496f15134919 +Ref: c-api/bytes c PyBytes_FromObject15135200 +Ref: 497015135200 +Ref: c-api/bytes c PyBytes_Size15135440 +Ref: 497215135440 +Ref: c-api/bytes c PyBytes_GET_SIZE15135608 +Ref: 4c4815135608 +Ref: c-api/bytes c PyBytes_AsString15135752 +Ref: 88515135752 +Ref: c-api/bytes c PyBytes_AS_STRING15136402 +Ref: 4c4915136402 +Ref: c-api/bytes c PyBytes_AsStringAndSize15136543 +Ref: 496c15136543 +Ref: c-api/bytes c PyBytes_Concat15137617 +Ref: 496d15137617 +Ref: c-api/bytes c PyBytes_ConcatAndDel15138153 +Ref: 496e15138153 +Ref: c-api/bytes c _PyBytes_Resize15138507 +Ref: 165415138507 +Ref: Bytes Objects<2>-Footnote-115139274 +Ref: Bytes Objects<2>-Footnote-215139400 +Ref: Bytes Objects<2>-Footnote-315139526 +Ref: Bytes Objects<2>-Footnote-415139652 +Ref: Bytes Objects<2>-Footnote-515139778 +Ref: Bytes Objects<2>-Footnote-615139904 +Ref: Bytes Objects<2>-Footnote-715140030 +Ref: Bytes Objects<2>-Footnote-815140156 +Node: Byte Array Objects15140282 +Ref: c-api/bytearray doc15140413 +Ref: 4c4a15140413 +Ref: c-api/bytearray byte-array-objects15140413 +Ref: 4c4b15140413 +Ref: c-api/bytearray bytearrayobjects15140413 +Ref: 4c4c15140413 +Ref: c-api/bytearray c PyByteArrayObject15140468 +Ref: 4c4d15140468 +Ref: c-api/bytearray c PyByteArray_Type15140590 +Ref: 496b15140590 +Node: Type check macros15140919 +Ref: c-api/bytearray type-check-macros15141020 +Ref: 4c4e15141020 +Ref: c-api/bytearray c PyByteArray_Check15141073 +Ref: 4c4f15141073 +Ref: c-api/bytearray c PyByteArray_CheckExact15141272 +Ref: 4c5015141272 +Node: Direct API functions15141487 +Ref: c-api/bytearray direct-api-functions15141603 +Ref: 4c5115141603 +Ref: c-api/bytearray c PyByteArray_FromObject15141662 +Ref: 138215141662 +Ref: c-api/bytearray c PyByteArray_FromStringAndSize15141992 +Ref: 138315141992 +Ref: c-api/bytearray c PyByteArray_Concat15142319 +Ref: 496815142319 +Ref: c-api/bytearray c PyByteArray_Size15142632 +Ref: 496a15142632 +Ref: c-api/bytearray c PyByteArray_AsString15142842 +Ref: 496715142842 +Ref: c-api/bytearray c PyByteArray_Resize15143113 +Ref: 496915143113 +Node: Macros15143302 +Ref: c-api/bytearray macros15143392 +Ref: 4c5215143392 +Ref: c-api/bytearray c PyByteArray_AS_STRING15143493 +Ref: 4c5315143493 +Ref: c-api/bytearray c PyByteArray_GET_SIZE15143646 +Ref: 4c5415143646 +Node: Unicode Objects and Codecs15143821 +Ref: c-api/unicode doc15143949 +Ref: 119315143949 +Ref: c-api/unicode unicode-objects-and-codecs15143949 +Ref: 4c5515143949 +Ref: c-api/unicode unicodeobjects15143949 +Ref: 4c5615143949 +Node: Unicode Objects15144101 +Ref: c-api/unicode unicode-objects15144203 +Ref: 4c5715144203 +Ref: Unicode Objects-Footnote-115145076 +Ref: Unicode Objects-Footnote-215145118 +Node: Unicode Type15145160 +Ref: c-api/unicode unicode-type15145261 +Ref: 4c5815145261 +Ref: c-api/unicode c Py_UCS415145393 +Ref: 29d15145393 +Ref: c-api/unicode c Py_UCS215145418 +Ref: 116815145418 +Ref: c-api/unicode c Py_UCS115145443 +Ref: 116715145443 +Ref: c-api/unicode c Py_UNICODE15145758 +Ref: 3e915145758 +Ref: c-api/unicode c PyASCIIObject15146175 +Ref: 116915146175 +Ref: c-api/unicode c PyCompactUnicodeObject15146206 +Ref: 116a15146206 +Ref: c-api/unicode c PyUnicodeObject15146246 +Ref: 78f15146246 +Ref: c-api/unicode c PyUnicode_Type15146562 +Ref: 4ad915146562 +Ref: c-api/unicode c PyUnicodeIter_Type15146795 +Ref: 4aad15146795 +Ref: c-api/unicode c PyUnicode_Check15147185 +Ref: 4c5915147185 +Ref: c-api/unicode c PyUnicode_CheckExact15147370 +Ref: 4c5a15147370 +Ref: c-api/unicode c PyUnicode_READY15147558 +Ref: 3fd15147558 +Ref: c-api/unicode c PyUnicode_GET_LENGTH15147800 +Ref: 8b315147800 +Ref: c-api/unicode c PyUnicode_1BYTE_DATA15148083 +Ref: 116e15148083 +Ref: c-api/unicode c PyUnicode_2BYTE_DATA15148172 +Ref: 116f15148172 +Ref: c-api/unicode c PyUnicode_4BYTE_DATA15148261 +Ref: 117015148261 +Ref: c-api/unicode c PyUnicode_1BYTE_KIND15148676 +Ref: 117215148676 +Ref: c-api/unicode c PyUnicode_2BYTE_KIND15148710 +Ref: 117315148710 +Ref: c-api/unicode c PyUnicode_4BYTE_KIND15148744 +Ref: 117415148744 +Ref: c-api/unicode c PyUnicode_KIND15148947 +Ref: 117115148947 +Ref: c-api/unicode c PyUnicode_DATA15149285 +Ref: 116d15149285 +Ref: c-api/unicode c PyUnicode_WRITE15149527 +Ref: 117715149527 +Ref: c-api/unicode c PyUnicode_READ15150091 +Ref: 117515150091 +Ref: c-api/unicode c PyUnicode_READ_CHAR15150386 +Ref: 117615150386 +Ref: c-api/unicode c PyUnicode_MAX_CHAR_VALUE15150735 +Ref: 117815150735 +Ref: c-api/unicode c PyUnicode_IsIdentifier15151108 +Ref: 199c15151108 +Node: Unicode Character Properties15151514 +Ref: c-api/unicode unicode-character-properties15151662 +Ref: 4c5b15151662 +Ref: c-api/unicode c Py_UNICODE_ISSPACE15151926 +Ref: 190515151926 +Ref: c-api/unicode c Py_UNICODE_ISLOWER15152069 +Ref: 4c5c15152069 +Ref: c-api/unicode c Py_UNICODE_ISUPPER15152211 +Ref: 4c5d15152211 +Ref: c-api/unicode c Py_UNICODE_ISTITLE15152354 +Ref: 4c5e15152354 +Ref: c-api/unicode c Py_UNICODE_ISLINEBREAK15152496 +Ref: 4c5f15152496 +Ref: c-api/unicode c Py_UNICODE_ISDECIMAL15152642 +Ref: 4c6015152642 +Ref: c-api/unicode c Py_UNICODE_ISDIGIT15152779 +Ref: 4c6115152779 +Ref: c-api/unicode c Py_UNICODE_ISNUMERIC15152912 +Ref: 4c6215152912 +Ref: c-api/unicode c Py_UNICODE_ISALPHA15153049 +Ref: 4c6315153049 +Ref: c-api/unicode c Py_UNICODE_ISALNUM15153193 +Ref: 4c6415153193 +Ref: c-api/unicode c Py_UNICODE_ISPRINTABLE15153339 +Ref: 4c6515153339 +Ref: c-api/unicode c Py_UNICODE_TOLOWER15153594 +Ref: 4c6615153594 +Ref: c-api/unicode c Py_UNICODE_TOUPPER15153720 +Ref: 4c6715153720 +Ref: c-api/unicode c Py_UNICODE_TOTITLE15153846 +Ref: 4c6815153846 +Ref: c-api/unicode c Py_UNICODE_TODECIMAL15153972 +Ref: 4c6915153972 +Ref: c-api/unicode c Py_UNICODE_TODIGIT15154193 +Ref: 4c6a15154193 +Ref: c-api/unicode c Py_UNICODE_TONUMERIC15154408 +Ref: 4c6b15154408 +Ref: c-api/unicode c Py_UNICODE_IS_SURROGATE15154661 +Ref: 4c6c15154661 +Ref: c-api/unicode c Py_UNICODE_IS_HIGH_SURROGATE15154786 +Ref: 4c6d15154786 +Ref: c-api/unicode c Py_UNICODE_IS_LOW_SURROGATE15154921 +Ref: 4c6e15154921 +Ref: c-api/unicode c Py_UNICODE_JOIN_SURROGATES15155054 +Ref: 4c6f15155054 +Node: Creating and accessing Unicode strings15155447 +Ref: c-api/unicode creating-and-accessing-unicode-strings15155598 +Ref: 4c7015155598 +Ref: c-api/unicode c PyUnicode_New15155782 +Ref: 8aa15155782 +Ref: c-api/unicode c PyUnicode_FromKindAndData15156355 +Ref: 116b15156355 +Ref: c-api/unicode c PyUnicode_FromStringAndSize15157157 +Ref: 4ad215157157 +Ref: c-api/unicode c PyUnicode_FromString15157827 +Ref: 4ad115157827 +Ref: c-api/unicode c PyUnicode_FromFormat15158080 +Ref: 38515158080 +Ref: c-api/unicode c PyUnicode_FromFormatV15171033 +Ref: 57115171033 +Ref: c-api/unicode c PyUnicode_FromObject15171317 +Ref: 4acf15171317 +Ref: c-api/unicode c PyUnicode_FromOrdinal15171785 +Ref: 4ad015171785 +Ref: c-api/unicode c PyUnicode_FromEncodedObject15172140 +Ref: 4ace15172140 +Ref: c-api/unicode c PyUnicode_BuildEncodingMap15172952 +Ref: 16f015172952 +Ref: c-api/unicode c PyUnicode_GetDefaultEncoding15173515 +Ref: 4ad315173515 +Ref: c-api/unicode c PyUnicode_GetLength15173839 +Ref: 8b215173839 +Ref: c-api/unicode c PyUnicode_CopyCharacters15174136 +Ref: 8b415174136 +Ref: c-api/unicode c PyUnicode_Fill15174627 +Ref: 118115174627 +Ref: c-api/unicode c PyUnicode_WriteChar15175130 +Ref: 116615175130 +Ref: c-api/unicode c PyUnicode_ReadChar15175831 +Ref: 116515175831 +Ref: c-api/unicode c PyUnicode_Substring15176331 +Ref: 8b515176331 +Ref: c-api/unicode c PyUnicode_AsUCS415176794 +Ref: 116c15176794 +Ref: c-api/unicode c PyUnicode_AsUCS4Copy15177319 +Ref: 8ba15177319 +Node: Locale Encoding15177762 +Ref: c-api/unicode locale-encoding15177905 +Ref: 4c7215177905 +Ref: c-api/unicode c PyUnicode_DecodeLocaleAndSize15178039 +Ref: bc915178039 +Ref: c-api/unicode c PyUnicode_DecodeLocale15179275 +Ref: 4ac015179275 +Ref: c-api/unicode c PyUnicode_EncodeLocale15179629 +Ref: bca15179629 +Ref: Locale Encoding-Footnote-115180877 +Ref: Locale Encoding-Footnote-215180919 +Node: File System Encoding15180961 +Ref: c-api/unicode file-system-encoding15181081 +Ref: 4c7315181081 +Ref: c-api/unicode c PyUnicode_FSConverter15181442 +Ref: d1915181442 +Ref: c-api/unicode c PyUnicode_FSDecoder15182702 +Ref: 57415182702 +Ref: c-api/unicode c PyUnicode_DecodeFSDefaultAndSize15183807 +Ref: 4abe15183807 +Ref: c-api/unicode c PyUnicode_DecodeFSDefault15184376 +Ref: 171a15184376 +Ref: c-api/unicode c PyUnicode_EncodeFSDefault15184828 +Ref: 1a5015184828 +Ref: File System Encoding-Footnote-115185544 +Ref: File System Encoding-Footnote-215185586 +Node: wchar_t Support15185628 +Ref: c-api/unicode wchar-t-support15185724 +Ref: 4c7415185724 +Ref: c-api/unicode c PyUnicode_FromWideChar15185830 +Ref: 118015185830 +Ref: c-api/unicode c PyUnicode_AsWideChar15186263 +Ref: 1a5615186263 +Ref: c-api/unicode c PyUnicode_AsWideCharString15187257 +Ref: 8bb15187257 +Node: Built-in Codecs15188388 +Ref: c-api/unicode built-in-codecs15188525 +Ref: 4c7515188525 +Ref: c-api/unicode builtincodecs15188525 +Ref: 4c7115188525 +Node: Generic Codecs15189748 +Ref: c-api/unicode generic-codecs15189835 +Ref: 4c7615189835 +Ref: c-api/unicode c PyUnicode_Decode15189919 +Ref: 19e115189919 +Ref: c-api/unicode c PyUnicode_AsEncodedString15190499 +Ref: 4ab615190499 +Node: UTF-8 Codecs15191060 +Ref: c-api/unicode utf-8-codecs15191169 +Ref: 4c7715191169 +Ref: c-api/unicode c PyUnicode_DecodeUTF815191247 +Ref: 4aca15191247 +Ref: c-api/unicode c PyUnicode_DecodeUTF8Stateful15191606 +Ref: 179f15191606 +Ref: c-api/unicode c PyUnicode_AsUTF8String15192166 +Ref: 118215192166 +Ref: c-api/unicode c PyUnicode_AsUTF8AndSize15192629 +Ref: 89715192629 +Ref: c-api/unicode c PyUnicode_AsUTF815193940 +Ref: bbb15193940 +Ref: UTF-8 Codecs-Footnote-115194704 +Node: UTF-32 Codecs15194757 +Ref: c-api/unicode utf-32-codecs15194865 +Ref: 4c7815194865 +Ref: c-api/unicode c PyUnicode_DecodeUTF3215194946 +Ref: 4ac615194946 +Ref: c-api/unicode c PyUnicode_DecodeUTF32Stateful15196149 +Ref: 4ac715196149 +Ref: c-api/unicode c PyUnicode_AsUTF32String15196828 +Ref: 4ab815196828 +Node: UTF-16 Codecs15197227 +Ref: c-api/unicode utf-16-codecs15197335 +Ref: 4c7915197335 +Ref: c-api/unicode c PyUnicode_DecodeUTF1615197416 +Ref: 4ac415197416 +Ref: c-api/unicode c PyUnicode_DecodeUTF16Stateful15198703 +Ref: 4ac515198703 +Ref: c-api/unicode c PyUnicode_AsUTF16String15199391 +Ref: 4ab715199391 +Node: UTF-7 Codecs15199790 +Ref: c-api/unicode utf-7-codecs15199906 +Ref: 4c7a15199906 +Ref: c-api/unicode c PyUnicode_DecodeUTF715199984 +Ref: 4ac815199984 +Ref: c-api/unicode c PyUnicode_DecodeUTF7Stateful15200343 +Ref: 4ac915200343 +Node: Unicode-Escape Codecs15200905 +Ref: c-api/unicode unicode-escape-codecs15201033 +Ref: 4c7b15201033 +Ref: c-api/unicode c PyUnicode_DecodeUnicodeEscape15201144 +Ref: 4acb15201144 +Ref: c-api/unicode c PyUnicode_AsUnicodeEscapeString15201521 +Ref: 118315201521 +Node: Raw-Unicode-Escape Codecs15201891 +Ref: c-api/unicode raw-unicode-escape-codecs15202021 +Ref: 4c7c15202021 +Ref: c-api/unicode c PyUnicode_DecodeRawUnicodeEscape15202144 +Ref: 4ac315202144 +Ref: c-api/unicode c PyUnicode_AsRawUnicodeEscapeString15202528 +Ref: 118415202528 +Node: Latin-1 Codecs15202905 +Ref: c-api/unicode latin-1-codecs15203026 +Ref: 4c7d15203026 +Ref: c-api/unicode c PyUnicode_DecodeLatin115203223 +Ref: 4abf15203223 +Ref: c-api/unicode c PyUnicode_AsLatin1String15203586 +Ref: 118515203586 +Node: ASCII Codecs15203947 +Ref: c-api/unicode ascii-codecs15204063 +Ref: 4c7e15204063 +Ref: c-api/unicode c PyUnicode_DecodeASCII15204211 +Ref: 4abb15204211 +Ref: c-api/unicode c PyUnicode_AsASCIIString15204571 +Ref: 118615204571 +Node: Character Map Codecs15204929 +Ref: c-api/unicode character-map-codecs15205054 +Ref: 4c7f15205054 +Ref: c-api/unicode c PyUnicode_DecodeCharmap15205534 +Ref: 4abc15205534 +Ref: c-api/unicode c PyUnicode_AsCharmapString15206426 +Ref: 4ab515206426 +Ref: c-api/unicode c PyUnicode_Translate15207205 +Ref: 4ad815207205 +Node: MBCS codecs for Windows15208103 +Ref: c-api/unicode mbcs-codecs-for-windows15208207 +Ref: 4c8015208207 +Ref: c-api/unicode c PyUnicode_DecodeMBCS15208567 +Ref: 4ac115208567 +Ref: c-api/unicode c PyUnicode_DecodeMBCSStateful15208955 +Ref: 4ac215208955 +Ref: c-api/unicode c PyUnicode_DecodeCodePageStateful15209517 +Ref: 4abd15209517 +Ref: c-api/unicode c PyUnicode_AsMBCSString15209928 +Ref: 118715209928 +Ref: c-api/unicode c PyUnicode_EncodeCodePage15210314 +Ref: 118815210314 +Node: Methods and Slot Functions15210799 +Ref: c-api/unicode methods-and-slot-functions15210912 +Ref: 4c8115210912 +Ref: c-api/unicode unicodemethodsandslots15210912 +Ref: 4c8215210912 +Ref: c-api/unicode c PyUnicode_Concat15211235 +Ref: 119415211235 +Ref: c-api/unicode c PyUnicode_Split15211463 +Ref: 4ad615211463 +Ref: c-api/unicode c PyUnicode_RSplit15212084 +Ref: 156e15212084 +Ref: c-api/unicode c PyUnicode_Splitlines15212499 +Ref: 4ad715212499 +Ref: c-api/unicode c PyUnicode_Partition15212912 +Ref: 156f15212912 +Ref: c-api/unicode c PyUnicode_RPartition15213538 +Ref: 157015213538 +Ref: c-api/unicode c PyUnicode_Join15214092 +Ref: 119515214092 +Ref: c-api/unicode c PyUnicode_Tailmatch15214374 +Ref: 8b715214374 +Ref: c-api/unicode c PyUnicode_Find15214833 +Ref: 4acc15214833 +Ref: c-api/unicode c PyUnicode_FindChar15215444 +Ref: 8b815215444 +Ref: c-api/unicode c PyUnicode_Count15216221 +Ref: 4aba15216221 +Ref: c-api/unicode c PyUnicode_Replace15216541 +Ref: 4ad415216541 +Ref: c-api/unicode c PyUnicode_Compare15216960 +Ref: 8b615216960 +Ref: c-api/unicode c PyUnicode_EqualToUTF8AndSize15217325 +Ref: 37115217325 +Ref: c-api/unicode c PyUnicode_EqualToUTF815217928 +Ref: 37215217928 +Ref: c-api/unicode c PyUnicode_CompareWithASCIIString15218311 +Ref: 125b15218311 +Ref: c-api/unicode c PyUnicode_RichCompare15218813 +Ref: 4ad515218813 +Ref: c-api/unicode c PyUnicode_Format15219480 +Ref: 4acd15219480 +Ref: c-api/unicode c PyUnicode_Contains15219761 +Ref: 4ab915219761 +Ref: c-api/unicode c PyUnicode_InternInPlace15220097 +Ref: 8b015220097 +Ref: c-api/unicode c PyUnicode_InternFromString15221474 +Ref: 160015221474 +Node: Tuple Objects15222323 +Ref: c-api/tuple doc15222456 +Ref: 4c8315222456 +Ref: c-api/tuple tuple-objects15222456 +Ref: 4c8415222456 +Ref: c-api/tuple tupleobjects15222456 +Ref: 4c8515222456 +Ref: c-api/tuple c PyTupleObject15222503 +Ref: 4b5215222503 +Ref: c-api/tuple c PyTuple_Type15222617 +Ref: 4a9815222617 +Ref: c-api/tuple c PyTuple_Check15222866 +Ref: 4c8615222866 +Ref: c-api/tuple c PyTuple_CheckExact15223042 +Ref: 4c8715223042 +Ref: c-api/tuple c PyTuple_New15223229 +Ref: 39915223229 +Ref: c-api/tuple c PyTuple_Pack15223471 +Ref: 4a9615223471 +Ref: c-api/tuple c PyTuple_Size15223906 +Ref: 4a9715223906 +Ref: c-api/tuple c PyTuple_GET_SIZE15224150 +Ref: 4c8815224150 +Ref: c-api/tuple c PyTuple_GetItem15224288 +Ref: 48d215224288 +Ref: c-api/tuple c PyTuple_GET_ITEM15224922 +Ref: 4c8915224922 +Ref: c-api/tuple c PyTuple_GetSlice15225140 +Ref: 4a9515225140 +Ref: c-api/tuple c PyTuple_SetItem15225591 +Ref: 48d315225591 +Ref: c-api/tuple c PyTuple_SET_ITEM15226107 +Ref: 38815226107 +Ref: c-api/tuple c _PyTuple_Resize15226726 +Ref: 14d715226726 +Node: Struct Sequence Objects15227642 +Ref: c-api/tuple id115227761 +Ref: 4c8a15227761 +Ref: c-api/tuple struct-sequence-objects15227761 +Ref: 11b115227761 +Ref: c-api/tuple c PyStructSequence_NewType15228069 +Ref: 4a8815228069 +Ref: c-api/tuple c PyStructSequence_InitType15228490 +Ref: ffc15228490 +Ref: c-api/tuple c PyStructSequence_InitType215228668 +Ref: ffb15228668 +Ref: c-api/tuple c PyStructSequence_Desc15228938 +Ref: bba15228938 +Ref: c-api/tuple c PyStructSequence_Desc name15229118 +Ref: 4c8b15229118 +Ref: c-api/tuple c PyStructSequence_Desc doc15229281 +Ref: 4c8c15229281 +Ref: c-api/tuple c PyStructSequence_Desc fields15229385 +Ref: 4c8d15229385 +Ref: c-api/tuple c PyStructSequence_Desc n_in_sequence15229542 +Ref: 4c8e15229542 +Ref: c-api/tuple c PyStructSequence_Field15229665 +Ref: bb915229665 +Ref: c-api/tuple c PyStructSequence_Field name15230075 +Ref: 4c8f15230075 +Ref: c-api/tuple c PyStructSequence_Field doc15230276 +Ref: 4c9015230276 +Ref: c-api/tuple c PyStructSequence_UnnamedField15230362 +Ref: 98215230362 +Ref: c-api/tuple c PyStructSequence_New15230618 +Ref: 4a8715230618 +Ref: c-api/tuple c PyStructSequence_GetItem15230957 +Ref: 4a8615230957 +Ref: c-api/tuple c PyStructSequence_GET_ITEM15231361 +Ref: 4c9115231361 +Ref: c-api/tuple c PyStructSequence_SetItem15231669 +Ref: 4a8915231669 +Ref: c-api/tuple c PyStructSequence_SET_ITEM15232189 +Ref: 4c9215232189 +Node: List Objects15232453 +Ref: c-api/list doc15232550 +Ref: 4c9315232550 +Ref: c-api/list list-objects15232550 +Ref: 4c9415232550 +Ref: c-api/list listobjects15232550 +Ref: 4c9515232550 +Ref: c-api/list c PyListObject15232595 +Ref: 4bba15232595 +Ref: c-api/list c PyList_Type15232707 +Ref: 48f515232707 +Ref: c-api/list c PyList_Check15232956 +Ref: 4c9615232956 +Ref: c-api/list c PyList_CheckExact15233129 +Ref: 4c9715233129 +Ref: c-api/list c PyList_New15233313 +Ref: 494815233313 +Ref: c-api/list c PyList_Size15234081 +Ref: 13e515234081 +Ref: c-api/list c PyList_GET_SIZE15234308 +Ref: 4c9815234308 +Ref: c-api/list c PyList_GetItemRef15234453 +Ref: 35615234453 +Ref: c-api/list c PyList_GetItem15234984 +Ref: 35715234984 +Ref: c-api/list c PyList_GET_ITEM15235297 +Ref: 495d15235297 +Ref: c-api/list c PyList_SetItem15235508 +Ref: 157715235508 +Ref: c-api/list c PyList_SET_ITEM15236001 +Ref: 38915236001 +Ref: c-api/list c PyList_Insert15236652 +Ref: 157515236652 +Ref: c-api/list c PyList_Append15237005 +Ref: 4a1415237005 +Ref: c-api/list c PyList_GetSlice15237308 +Ref: 4a1615237308 +Ref: c-api/list c PyList_SetSlice15237753 +Ref: 4a1815237753 +Ref: c-api/list c PyList_Extend15238263 +Ref: 35815238263 +Ref: c-api/list c PyList_Clear15238706 +Ref: 35915238706 +Ref: c-api/list c PyList_Sort15239080 +Ref: 4a1915239080 +Ref: c-api/list c PyList_Reverse15239310 +Ref: 4a1715239310 +Ref: c-api/list c PyList_AsTuple15239553 +Ref: 4a1515239553 +Node: Container Objects15239808 +Ref: c-api/concrete container-objects15239937 +Ref: 4c9915239937 +Ref: c-api/concrete mapobjects15239937 +Ref: 4c9a15239937 +Node: Dictionary Objects15240035 +Ref: c-api/dict doc15240127 +Ref: 4c9b15240127 +Ref: c-api/dict dictionary-objects15240127 +Ref: 4c9c15240127 +Ref: c-api/dict dictobjects15240127 +Ref: 4c9d15240127 +Ref: c-api/dict c PyDictObject15240182 +Ref: 3bd15240182 +Ref: c-api/dict c PyDict_Type15240300 +Ref: 49a115240300 +Ref: c-api/dict c PyDict_Check15240555 +Ref: 4bf515240555 +Ref: c-api/dict c PyDict_CheckExact15240728 +Ref: 4c9e15240728 +Ref: c-api/dict c PyDict_New15240912 +Ref: 499f15240912 +Ref: c-api/dict c PyDictProxy_New15241102 +Ref: 499715241102 +Ref: c-api/dict c PyDict_Clear15241493 +Ref: 499815241493 +Ref: c-api/dict c PyDict_Contains15241644 +Ref: 33315241644 +Ref: c-api/dict c PyDict_ContainsString15241981 +Ref: 33215241981 +Ref: c-api/dict c PyDict_Copy15242255 +Ref: 41c15242255 +Ref: c-api/dict c PyDict_SetItem15242476 +Ref: 48d415242476 +Ref: c-api/dict c PyDict_SetItemString15242883 +Ref: 160115242883 +Ref: c-api/dict c PyDict_DelItem15243190 +Ref: 499915243190 +Ref: c-api/dict c PyDict_DelItemString15243574 +Ref: 499a15243574 +Ref: c-api/dict c PyDict_GetItemRef15243856 +Ref: 33515243856 +Ref: c-api/dict c PyDict_GetItem15244487 +Ref: 38215244487 +Ref: c-api/dict c PyDict_GetItemWithError15245235 +Ref: 33715245235 +Ref: c-api/dict c PyDict_GetItemString15245656 +Ref: 38315245656 +Ref: c-api/dict c PyDict_GetItemStringRef15246365 +Ref: 33615246365 +Ref: c-api/dict c PyDict_SetDefault15246726 +Ref: 33b15246726 +Ref: c-api/dict c PyDict_SetDefaultRef15247331 +Ref: 33a15247331 +Ref: c-api/dict c PyDict_Pop15248429 +Ref: 33c15248429 +Ref: c-api/dict c PyDict_PopString15249153 +Ref: 33d15249153 +Ref: c-api/dict c PyDict_Items15249437 +Ref: 499b15249437 +Ref: c-api/dict c PyDict_Keys15249669 +Ref: 499c15249669 +Ref: c-api/dict c PyDict_Values15249899 +Ref: 49a315249899 +Ref: c-api/dict c PyDict_Size15250137 +Ref: 49a015250137 +Ref: c-api/dict c PyDict_Next15250356 +Ref: 161215250356 +Ref: c-api/dict c PyDict_Merge15252719 +Ref: 499d15252719 +Ref: c-api/dict c PyDict_Update15253306 +Ref: 49a215253306 +Ref: c-api/dict c PyDict_MergeFromSeq215253769 +Ref: 499e15253769 +Ref: c-api/dict c PyDict_AddWatcher15254495 +Ref: 55f15254495 +Ref: c-api/dict c PyDict_ClearWatcher15254857 +Ref: 4ca015254857 +Ref: c-api/dict c PyDict_Watch15255160 +Ref: 56015255160 +Ref: c-api/dict c PyDict_Unwatch15255486 +Ref: 4ca115255486 +Ref: c-api/dict c PyDict_WatchEvent15255900 +Ref: 4ca215255900 +Ref: c-api/dict c PyDict_WatchCallback15256210 +Ref: 4ca315256210 +Node: Set Objects15258477 +Ref: c-api/set doc15258569 +Ref: 4ca415258569 +Ref: c-api/set set-objects15258569 +Ref: 4ca515258569 +Ref: c-api/set setobjects15258569 +Ref: 4ca615258569 +Ref: c-api/set c PySetObject15259346 +Ref: 4ca715259346 +Ref: c-api/set c PySet_Type15259986 +Ref: 4a7f15259986 +Ref: c-api/set c PyFrozenSet_Type15260182 +Ref: 4a0415260182 +Ref: c-api/set c PySet_Check15260541 +Ref: 4ca815260541 +Ref: c-api/set c PyFrozenSet_Check15260707 +Ref: 4ca915260707 +Ref: c-api/set c PyAnySet_Check15260885 +Ref: 4caa15260885 +Ref: c-api/set c PySet_CheckExact15261092 +Ref: 89b15261092 +Ref: c-api/set c PyAnySet_CheckExact15261297 +Ref: 4cab15261297 +Ref: c-api/set c PyFrozenSet_CheckExact15261515 +Ref: 4cac15261515 +Ref: c-api/set c PySet_New15261703 +Ref: 141015261703 +Ref: c-api/set c PyFrozenSet_New15262204 +Ref: 141115262204 +Ref: c-api/set c PySet_Size15262805 +Ref: 141515262805 +Ref: c-api/set c PySet_GET_SIZE15263167 +Ref: 4cad15263167 +Ref: c-api/set c PySet_Contains15263311 +Ref: 141415263311 +Ref: c-api/set c PySet_Add15263863 +Ref: 141215263863 +Ref: c-api/set c PySet_Discard15264658 +Ref: 141315264658 +Ref: c-api/set c PySet_Pop15265266 +Ref: 4a7e15265266 +Ref: c-api/set c PySet_Clear15265705 +Ref: 4a7d15265705 +Node: Function Objects<2>15265994 +Ref: c-api/concrete function-objects15266120 +Ref: 4cae15266120 +Ref: c-api/concrete otherobjects15266120 +Ref: 4caf15266120 +Node: Function Objects<3>15266377 +Ref: c-api/function doc15266484 +Ref: 4cb015266484 +Ref: c-api/function function-objects15266484 +Ref: 4cb115266484 +Ref: c-api/function id115266484 +Ref: 4cb215266484 +Ref: c-api/function c PyFunctionObject15266592 +Ref: 55e15266592 +Ref: c-api/function c PyFunction_Type15266669 +Ref: 4cb315266669 +Ref: c-api/function c PyFunction_Check15266898 +Ref: 4cb415266898 +Ref: c-api/function c PyFunction_New15267118 +Ref: 4cb515267118 +Ref: c-api/function c PyFunction_NewWithQualName15267749 +Ref: 4cb615267749 +Ref: c-api/function c PyFunction_GetCode15268266 +Ref: 4cb715268266 +Ref: c-api/function c PyFunction_GetGlobals15268451 +Ref: 4cb815268451 +Ref: c-api/function c PyFunction_GetModule15268656 +Ref: 4cb915268656 +Ref: c-api/function c PyFunction_GetDefaults15269062 +Ref: 4cba15269062 +Ref: c-api/function c PyFunction_SetDefaults15269314 +Ref: 4cbb15269314 +Ref: c-api/function c PyFunction_SetVectorcall15269591 +Ref: 55d15269591 +Ref: c-api/function c PyFunction_GetKwDefaults15269916 +Ref: 4cbc15269916 +Ref: c-api/function c PyFunction_GetClosure15270188 +Ref: 4cbd15270188 +Ref: c-api/function c PyFunction_SetClosure15270439 +Ref: 4cbe15270439 +Ref: c-api/function c PyFunction_GetAnnotations15270725 +Ref: 17ba15270725 +Ref: c-api/function c PyFunction_SetAnnotations15270963 +Ref: 4cbf15270963 +Ref: c-api/function c PyFunction_GET_CODE15271243 +Ref: 4cc015271243 +Ref: c-api/function c PyFunction_GET_GLOBALS15271316 +Ref: 4cc115271316 +Ref: c-api/function c PyFunction_GET_MODULE15271402 +Ref: 4cc215271402 +Ref: c-api/function c PyFunction_GET_DEFAULTS15271487 +Ref: 4cc315271487 +Ref: c-api/function c PyFunction_GET_KW_DEFAULTS15271574 +Ref: 4cc415271574 +Ref: c-api/function c PyFunction_GET_CLOSURE15271664 +Ref: 4cc515271664 +Ref: c-api/function c PyFunction_GET_ANNOTATIONS15271750 +Ref: 4cc615271750 +Ref: c-api/function c PyFunction_AddWatcher15272095 +Ref: 4cc715272095 +Ref: c-api/function c PyFunction_ClearWatcher15272476 +Ref: 4cc815272476 +Ref: c-api/function c PyFunction_WatchEvent15272844 +Ref: 4cc915272844 +Ref: c-api/function c PyFunction_WatchCallback15273229 +Ref: 4cca15273229 +Node: Instance Method Objects15275432 +Ref: c-api/method doc15275565 +Ref: 4ccb15275565 +Ref: c-api/method instance-method-objects15275565 +Ref: 4ccc15275565 +Ref: c-api/method instancemethod-objects15275565 +Ref: 4ccd15275565 +Ref: c-api/method c PyInstanceMethod_Type15275832 +Ref: 4cce15275832 +Ref: c-api/method c PyInstanceMethod_Check15276032 +Ref: 4ccf15276032 +Ref: c-api/method c PyInstanceMethod_New15276271 +Ref: 4cd015276271 +Ref: c-api/method c PyInstanceMethod_Function15276561 +Ref: 4cd115276561 +Ref: c-api/method c PyInstanceMethod_GET_FUNCTION15276767 +Ref: 4cd215276767 +Node: Method Objects<2>15276995 +Ref: c-api/method id115277121 +Ref: 4cd315277121 +Ref: c-api/method method-objects15277121 +Ref: 4cd415277121 +Ref: c-api/method c PyMethod_Type15277347 +Ref: 4cd515277347 +Ref: c-api/method c PyMethod_Check15277559 +Ref: 4cd615277559 +Ref: c-api/method c PyMethod_New15277773 +Ref: 4cd715277773 +Ref: c-api/method c PyMethod_Function15278141 +Ref: 4cd815278141 +Ref: c-api/method c PyMethod_GET_FUNCTION15278324 +Ref: 4cd915278324 +Ref: c-api/method c PyMethod_Self15278538 +Ref: 4cda15278538 +Ref: c-api/method c PyMethod_GET_SELF15278710 +Ref: 4cdb15278710 +Node: Cell Objects15278906 +Ref: c-api/cell doc15279024 +Ref: 4cdc15279024 +Ref: c-api/cell cell-objects15279024 +Ref: 6fc15279024 +Ref: c-api/cell id115279024 +Ref: 4cdd15279024 +Ref: c-api/cell c PyCellObject15279669 +Ref: 4cde15279669 +Ref: c-api/cell c PyCell_Type15279745 +Ref: 4cdf15279745 +Ref: c-api/cell c PyCell_Check15279852 +Ref: 4ce015279852 +Ref: c-api/cell c PyCell_New15280010 +Ref: 4ce115280010 +Ref: c-api/cell c PyCell_Get15280214 +Ref: 4ce215280214 +Ref: c-api/cell c PyCell_GET15280468 +Ref: 4ce315280468 +Ref: c-api/cell c PyCell_Set15280697 +Ref: 4ce415280697 +Ref: c-api/cell c PyCell_SET15281069 +Ref: 8ad15281069 +Node: Code Objects<2>15281332 +Ref: c-api/code doc15281450 +Ref: 4ce515281450 +Ref: c-api/code code-objects15281450 +Ref: 4ce615281450 +Ref: c-api/code codeobjects15281450 +Ref: 5b115281450 +Ref: c-api/code c PyCodeObject15281655 +Ref: 77215281655 +Ref: c-api/code c PyCode_Type15281819 +Ref: 4ce715281819 +Ref: c-api/code c PyCode_Check15281980 +Ref: 4ce815281980 +Ref: c-api/code c PyCode_GetNumFree15282121 +Ref: 4ce915282121 +Ref: c-api/code c PyUnstable_Code_GetFirstFree15282296 +Ref: 38115282296 +Ref: c-api/code c PyUnstable_Code_New15282839 +Ref: 4cea15282839 +Ref: c-api/code c PyUnstable_Code_NewWithPosOnlyArgs15284246 +Ref: 4ceb15284246 +Ref: c-api/code c PyCode_NewEmpty15285448 +Ref: 134415285448 +Ref: c-api/code c PyCode_Addr2Line15285794 +Ref: 88715285794 +Ref: c-api/code c PyCode_Addr2Location15286197 +Ref: 5b015286197 +Ref: c-api/code c PyCode_GetCode15286677 +Ref: 77315286677 +Ref: c-api/code c PyCode_GetVarnames15287261 +Ref: 77415287261 +Ref: c-api/code c PyCode_GetCellvars15287625 +Ref: 77515287625 +Ref: c-api/code c PyCode_GetFreevars15288034 +Ref: 77615288034 +Ref: c-api/code c PyCode_AddWatcher15288419 +Ref: 56315288419 +Ref: c-api/code c PyCode_ClearWatcher15288780 +Ref: 56415288780 +Ref: c-api/code c PyCodeEvent15289139 +Ref: 4cec15289139 +Ref: c-api/code c PyCode_WatchCallback15289320 +Ref: 4ced15289320 +Ref: Code Objects<2>-Footnote-115291136 +Node: Code Object Flags15291218 +Ref: c-api/code c-codeobject-flags15291341 +Ref: 4b2a15291341 +Ref: c-api/code code-object-flags15291341 +Ref: 4cee15291341 +Ref: c-api/code c CO_OPTIMIZED15292389 +Ref: 4cef15292389 +Ref: c-api/code c CO_NEWLOCALS15292590 +Ref: 4cf015292590 +Ref: c-api/code c CO_VARARGS15292789 +Ref: 4cf115292789 +Ref: c-api/code c CO_VARKEYWORDS15292992 +Ref: 4cf215292992 +Ref: c-api/code c CO_NESTED15293190 +Ref: 4cf315293190 +Ref: c-api/code c CO_GENERATOR15293391 +Ref: 4cf415293391 +Ref: c-api/code c CO_COROUTINE15293592 +Ref: 4cf515293592 +Ref: c-api/code c CO_ITERABLE_COROUTINE15293802 +Ref: 4cf615293802 +Ref: c-api/code c CO_ASYNC_GENERATOR15294009 +Ref: 4cf715294009 +Ref: c-api/code c CO_FUTURE_DIVISION15294216 +Ref: 4cf815294216 +Ref: c-api/code c CO_FUTURE_ABSOLUTE_IMPORT15294435 +Ref: 4cf915294435 +Ref: c-api/code c CO_FUTURE_WITH_STATEMENT15294653 +Ref: 4cfa15294653 +Ref: c-api/code c CO_FUTURE_PRINT_FUNCTION15294871 +Ref: 4cfb15294871 +Ref: c-api/code c CO_FUTURE_UNICODE_LITERALS15295091 +Ref: 4cfc15295091 +Ref: c-api/code c CO_FUTURE_GENERATOR_STOP15295309 +Ref: 4cfd15295309 +Ref: c-api/code c CO_FUTURE_ANNOTATIONS15295524 +Ref: 4b2915295524 +Node: Extra information15295638 +Ref: c-api/code extra-information15295737 +Ref: 4cfe15295737 +Ref: c-api/code c PyUnstable_Eval_RequestCodeExtraIndex15296110 +Ref: 4cff15296110 +Ref: c-api/code c PyUnstable_Code_GetExtra15297118 +Ref: 4d0015297118 +Ref: c-api/code c PyUnstable_Code_SetExtra15297862 +Ref: 4d0115297862 +Node: Other Objects15298489 +Ref: c-api/concrete other-objects15298589 +Ref: 4d0215298589 +Node: File Objects15299022 +Ref: c-api/file doc15299107 +Ref: 4d0315299107 +Ref: c-api/file file-objects15299107 +Ref: 4d0415299107 +Ref: c-api/file fileobjects15299107 +Ref: 4d0515299107 +Ref: c-api/file c PyFile_FromFd15299688 +Ref: 49fd15299688 +Ref: c-api/file c PyObject_AsFileDescriptor15300699 +Ref: 4a5815300699 +Ref: c-api/file c PyFile_GetLine15301152 +Ref: 49fe15301152 +Ref: c-api/file c PyFile_SetOpenCodeHook15301985 +Ref: 172915301985 +Ref: c-api/file c Py_OpenCodeHookFunction15302240 +Ref: 4d0615302240 +Ref: c-api/file c PyFile_WriteObject15303350 +Ref: 49ff15303350 +Ref: c-api/file c PyFile_WriteString15303795 +Ref: 4a0015303795 +Node: Module Objects15304045 +Ref: c-api/module doc15304155 +Ref: 4d0715304155 +Ref: c-api/module module-objects15304155 +Ref: 4d0815304155 +Ref: c-api/module moduleobjects15304155 +Ref: 4d0915304155 +Ref: c-api/module c PyModule_Type15304202 +Ref: 4a3415304202 +Ref: c-api/module c PyModule_Check15304457 +Ref: 4d0a15304457 +Ref: c-api/module c PyModule_CheckExact15304622 +Ref: 4d0b15304622 +Ref: c-api/module c PyModule_NewObject15304807 +Ref: 4a3215304807 +Ref: c-api/module c PyModule_New15305540 +Ref: 4a3115305540 +Ref: c-api/module c PyModule_GetDict15305809 +Ref: 4a2e15305809 +Ref: c-api/module c PyModule_GetNameObject15306459 +Ref: 4a3015306459 +Ref: c-api/module c PyModule_GetName15306866 +Ref: 4a2f15306866 +Ref: c-api/module c PyModule_GetState15307080 +Ref: 98015307080 +Ref: c-api/module c PyModule_GetDef15307365 +Ref: 4a2d15307365 +Ref: c-api/module c PyModule_GetFilenameObject15307660 +Ref: 3f515307660 +Ref: c-api/module c PyModule_GetFilename15308153 +Ref: 3f415308153 +Node: Initializing C modules15308630 +Ref: c-api/module initializing-c-modules15308725 +Ref: 4d0c15308725 +Ref: c-api/module initializing-modules15308725 +Ref: 491515308725 +Ref: c-api/module c PyModuleDef15309359 +Ref: 97d15309359 +Ref: c-api/module c PyModuleDef m_base15309654 +Ref: 4d0e15309654 +Ref: c-api/module c PyModuleDef m_name15309771 +Ref: 4d0f15309771 +Ref: c-api/module c PyModuleDef m_doc15309846 +Ref: 4d1015309846 +Ref: c-api/module c PyModuleDef m_size15310008 +Ref: 97f15310008 +Ref: c-api/module c PyModuleDef m_methods15310979 +Ref: 4d1115310979 +Ref: c-api/module c PyModuleDef m_slots15311208 +Ref: 4d1215311208 +Ref: c-api/module c PyModuleDef m_slots m_reload15311598 +Ref: 4d1415311598 +Ref: c-api/module c PyModuleDef m_traverse15311658 +Ref: 97a15311658 +Ref: c-api/module c PyModuleDef m_clear15312393 +Ref: 97b15312393 +Ref: c-api/module c PyModuleDef m_free15313458 +Ref: 97c15313458 +Ref: Initializing C modules-Footnote-115314346 +Node: Single-phase initialization15314388 +Ref: c-api/module single-phase-initialization15314509 +Ref: 4d1615314509 +Ref: c-api/module c PyModule_Create15314788 +Ref: 4d0d15314788 +Ref: c-api/module c PyModule_Create215315083 +Ref: 4a2c15315083 +Node: Multi-phase initialization15315893 +Ref: c-api/module id115316058 +Ref: 4d1715316058 +Ref: c-api/module multi-phase-initialization15316058 +Ref: 491615316058 +Ref: c-api/module c PyModuleDef_Init15318281 +Ref: 48bd15318281 +Ref: c-api/module c PyModuleDef_Slot15318818 +Ref: 4d1315318818 +Ref: c-api/module c PyModuleDef_Slot slot15318853 +Ref: 4d1a15318853 +Ref: c-api/module c PyModuleDef_Slot value15318954 +Ref: 4d1b15318954 +Ref: c-api/module c Py_mod_create15319174 +Ref: 4d1c15319174 +Ref: c-api/module c Py_mod_create create_module15319367 +Ref: 4d1d15319367 +Ref: c-api/module c Py_mod_exec15320798 +Ref: 97e15320798 +Ref: c-api/module c Py_mod_exec exec_module15321070 +Ref: 4d1e15321070 +Ref: c-api/module c Py_mod_multiple_interpreters15321257 +Ref: 4d1915321257 +Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED15321345 +Ref: 48bf15321345 +Ref: c-api/module c Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED15321481 +Ref: 4d1f15321481 +Ref: c-api/module c Py_MOD_PER_INTERPRETER_GIL_SUPPORTED15321727 +Ref: 4d2015321727 +Ref: c-api/module c Py_mod_gil15322334 +Ref: 15815322334 +Ref: c-api/module c Py_MOD_GIL_USED15322404 +Ref: 4d2115322404 +Ref: c-api/module c Py_MOD_GIL_NOT_USED15322596 +Ref: 4d2215322596 +Ref: Multi-phase initialization-Footnote-115323290 +Ref: Multi-phase initialization-Footnote-215323332 +Node: Low-level module creation functions15323374 +Ref: c-api/module low-level-module-creation-functions15323529 +Ref: 4d2315323529 +Ref: c-api/module c PyModule_FromDefAndSpec15323908 +Ref: eac15323908 +Ref: c-api/module c PyModule_FromDefAndSpec215324298 +Ref: ead15324298 +Ref: c-api/module c PyModule_ExecDef15325049 +Ref: eae15325049 +Ref: c-api/module c PyModule_SetDocString15325300 +Ref: 4a3315325300 +Ref: c-api/module c PyModule_AddFunctions15325703 +Ref: 4a2b15325703 +Node: Support functions15326459 +Ref: c-api/module support-functions15326579 +Ref: 4d2415326579 +Ref: c-api/module c PyModule_AddObjectRef15326865 +Ref: 36015326865 +Ref: c-api/module c PyModule_Add15328788 +Ref: 35f15328788 +Ref: c-api/module c PyModule_AddObject15329368 +Ref: 36115329368 +Ref: c-api/module c PyModule_AddIntConstant15330806 +Ref: 150615330806 +Ref: c-api/module c PyModule_AddStringConstant15331336 +Ref: 150715331336 +Ref: c-api/module c PyModule_AddIntMacro15331941 +Ref: 13bf15331941 +Ref: c-api/module c PyModule_AddStringMacro15332298 +Ref: 13be15332298 +Ref: c-api/module c PyModule_AddType15332393 +Ref: 97515332393 +Ref: c-api/module c PyUnstable_Module_SetGIL15332867 +Ref: 17915332867 +Node: Module lookup15333707 +Ref: c-api/module module-lookup15333802 +Ref: 4d2515333802 +Ref: c-api/module c PyState_FindModule15334221 +Ref: 4a8415334221 +Ref: c-api/module c PyState_AddModule15334771 +Ref: 4a8315334771 +Ref: c-api/module c PyState_RemoveModule15335810 +Ref: 4a8515335810 +Node: Iterator Objects15336149 +Ref: c-api/iterator doc15336265 +Ref: 4d2615336265 +Ref: c-api/iterator id115336265 +Ref: 4d2715336265 +Ref: c-api/iterator iterator-objects15336265 +Ref: 4d2815336265 +Ref: c-api/iterator c PySeqIter_Type15336663 +Ref: 4a6d15336663 +Ref: c-api/iterator c PySeqIter_Check15336952 +Ref: 4d2915336952 +Ref: c-api/iterator c PySeqIter_New15337109 +Ref: 4a6c15337109 +Ref: c-api/iterator c PyCallIter_Type15337438 +Ref: 497815337438 +Ref: c-api/iterator c PyCallIter_Check15337696 +Ref: 4d2a15337696 +Ref: c-api/iterator c PyCallIter_New15337855 +Ref: 497715337855 +Node: Descriptor Objects15338340 +Ref: c-api/descriptor doc15338455 +Ref: 4d2b15338455 +Ref: c-api/descriptor descriptor-objects15338455 +Ref: 4d2c15338455 +Ref: c-api/descriptor id115338455 +Ref: 4d2d15338455 +Ref: c-api/descriptor c PyProperty_Type15338636 +Ref: 4a6b15338636 +Ref: c-api/descriptor c PyDescr_NewGetSet15338794 +Ref: 499515338794 +Ref: c-api/descriptor c PyDescr_NewMember15338989 +Ref: 499615338989 +Ref: c-api/descriptor c PyDescr_NewMethod15339182 +Ref: 198b15339182 +Ref: c-api/descriptor c PyDescr_NewWrapper15339375 +Ref: 4d2e15339375 +Ref: c-api/descriptor c PyDescr_NewClassMethod15339544 +Ref: 499415339544 +Ref: c-api/descriptor c PyDescr_IsData15339737 +Ref: 18f515339737 +Ref: c-api/descriptor c PyWrapper_New15339988 +Ref: 4adc15339988 +Node: Slice Objects15340153 +Ref: c-api/slice doc15340270 +Ref: 4d2f15340270 +Ref: c-api/slice id115340270 +Ref: 4d3015340270 +Ref: c-api/slice slice-objects15340270 +Ref: 4d3115340270 +Ref: c-api/slice c PySlice_Type15340317 +Ref: 4a8215340317 +Ref: c-api/slice c PySlice_Check15340521 +Ref: 4d3215340521 +Ref: c-api/slice c PySlice_New15340681 +Ref: 4a8115340681 +Ref: c-api/slice c PySlice_GetIndices15341264 +Ref: 4a8015341264 +Ref: c-api/slice c PySlice_GetIndicesEx15342027 +Ref: 3f815342027 +Ref: c-api/slice c PySlice_Unpack15344031 +Ref: 3f915344031 +Ref: c-api/slice c PySlice_AdjustIndices15344695 +Ref: 3fa15344695 +Node: Ellipsis Object15345241 +Ref: c-api/slice ellipsis-object15345306 +Ref: 4d3315345306 +Ref: c-api/slice c PyEllipsis_Type15345357 +Ref: 49a415345357 +Ref: c-api/slice c Py_Ellipsis15345580 +Ref: 4d3415345580 +Ref: c-api/memoryview memoryview-objects15345855 +Ref: 4bcd15345855 +Node: MemoryView objects15345855 +Ref: c-api/memoryview doc15345979 +Ref: 4d3515345979 +Ref: c-api/memoryview id115345979 +Ref: 4d3615345979 +Ref: c-api/memoryview c PyMemoryView_FromObject15346192 +Ref: 4a2915346192 +Ref: c-api/memoryview c PyBUF_READ15346626 +Ref: 169015346626 +Ref: c-api/memoryview c PyBUF_WRITE15346692 +Ref: 169115346692 +Ref: c-api/memoryview c PyMemoryView_FromMemory15346759 +Ref: 116415346759 +Ref: c-api/memoryview c PyMemoryView_FromBuffer15347149 +Ref: 75c15347149 +Ref: c-api/memoryview c PyMemoryView_GetContiguous15347519 +Ref: 4a2a15347519 +Ref: c-api/memoryview c PyMemoryView_Check15348151 +Ref: 4d3715348151 +Ref: c-api/memoryview c PyMemoryView_GET_BUFFER15348386 +Ref: 4d3815348386 +Ref: c-api/memoryview c PyMemoryView_GET_BASE15348708 +Ref: 4d3915348708 +Node: Weak Reference Objects<2>15349098 +Ref: c-api/weakref doc15349220 +Ref: 4d3a15349220 +Ref: c-api/weakref weak-reference-objects15349220 +Ref: 4d3b15349220 +Ref: c-api/weakref weakrefobjects15349220 +Ref: 4d3c15349220 +Ref: c-api/weakref c PyWeakref_Check15349538 +Ref: 4d3d15349538 +Ref: c-api/weakref c PyWeakref_CheckRef15349695 +Ref: 4d3e15349695 +Ref: c-api/weakref c PyWeakref_CheckProxy15349840 +Ref: 4d3f15349840 +Ref: c-api/weakref c PyWeakref_NewRef15349983 +Ref: 184e15349983 +Ref: c-api/weakref c PyWeakref_NewProxy15350817 +Ref: 4adb15350817 +Ref: c-api/weakref c PyWeakref_GetRef15351654 +Ref: 37315351654 +Ref: c-api/weakref c PyWeakref_GetObject15352186 +Ref: 37415352186 +Ref: c-api/weakref c PyWeakref_GET_OBJECT15352939 +Ref: 3bb15352939 +Ref: c-api/weakref c PyObject_ClearWeakRefs15353264 +Ref: 57315353264 +Ref: c-api/weakref c PyUnstable_Object_ClearWeakRefsNoCallbacks15353646 +Ref: 161315353646 +Node: Capsules<2>15354546 +Ref: c-api/capsule doc15354663 +Ref: 4d4015354663 +Ref: c-api/capsule capsules15354663 +Ref: 258415354663 +Ref: c-api/capsule id115354663 +Ref: 4d4115354663 +Ref: c-api/capsule c PyCapsule15354833 +Ref: 126615354833 +Ref: c-api/capsule c PyCapsule_Destructor15355276 +Ref: 497a15355276 +Ref: c-api/capsule c PyCapsule_CheckExact15355584 +Ref: 4d4215355584 +Ref: c-api/capsule c PyCapsule_New15355739 +Ref: 48dd15355739 +Ref: c-api/capsule c PyCapsule_GetPointer15356702 +Ref: 497e15356702 +Ref: c-api/capsule c PyCapsule_GetDestructor15357210 +Ref: 497c15357210 +Ref: c-api/capsule c PyCapsule_GetContext15357699 +Ref: 497b15357699 +Ref: c-api/capsule c PyCapsule_GetName15358141 +Ref: 497d15358141 +Ref: c-api/capsule c PyCapsule_Import15358580 +Ref: 186d15358580 +Ref: c-api/capsule c PyCapsule_IsValid15359591 +Ref: 134815359591 +Ref: c-api/capsule c PyCapsule_SetContext15360412 +Ref: 497f15360412 +Ref: c-api/capsule c PyCapsule_SetDestructor15360690 +Ref: 498015360690 +Ref: c-api/capsule c PyCapsule_SetName15360987 +Ref: 498115360987 +Ref: c-api/capsule c PyCapsule_SetPointer15361413 +Ref: 498215361413 +Node: Frame Objects15361724 +Ref: c-api/frame doc15361833 +Ref: 4d4315361833 +Ref: c-api/frame frame-objects15361833 +Ref: 4d4415361833 +Ref: c-api/frame c PyFrameObject15361880 +Ref: 78415361880 +Ref: c-api/frame c PyFrame_Type15362421 +Ref: 78215362421 +Ref: c-api/frame c PyFrame_Check15362706 +Ref: 78015362706 +Ref: c-api/frame c PyFrame_GetBack15362927 +Ref: 78115362927 +Ref: c-api/frame c PyFrame_GetBuiltins15363213 +Ref: 76615363213 +Ref: c-api/frame c PyFrame_GetCode15363509 +Ref: 78515363509 +Ref: c-api/frame c PyFrame_GetGenerator15363847 +Ref: 76715363847 +Ref: c-api/frame c PyFrame_GetGlobals15364278 +Ref: 76815364278 +Ref: c-api/frame c PyFrame_GetLasti15364572 +Ref: 76915364572 +Ref: c-api/frame c PyFrame_GetVar15364774 +Ref: 56515364774 +Ref: c-api/frame c PyFrame_GetVarString15365281 +Ref: 56615365281 +Ref: c-api/frame c PyFrame_GetLocals15365557 +Ref: 41b15365557 +Ref: c-api/frame c PyFrame_GetLineNumber15366269 +Ref: 78615366269 +Ref: Frame Objects-Footnote-115366555 +Node: Frame Locals Proxies15366597 +Ref: c-api/frame frame-locals-proxies15366691 +Ref: 4d4615366691 +Ref: c-api/frame c PyFrameLocalsProxy_Type15367155 +Ref: 4d4515367155 +Ref: c-api/frame c PyFrameLocalsProxy_Check15367281 +Ref: 4d4715367281 +Ref: Frame Locals Proxies-Footnote-115367449 +Node: Internal Frames15367491 +Ref: c-api/frame internal-frames15367585 +Ref: 4d4815367585 +Ref: c-api/frame c _PyInterpreterFrame15367686 +Ref: 4d4915367686 +Ref: c-api/frame c PyUnstable_InterpreterFrame_GetCode15367814 +Ref: 4d4a15367814 +Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLasti15368235 +Ref: 4d4b15368235 +Ref: c-api/frame c PyUnstable_InterpreterFrame_GetLine15368601 +Ref: 4d4c15368601 +Ref: Internal Frames-Footnote-115369026 +Node: Generator Objects15369068 +Ref: c-api/gen doc15369186 +Ref: 4d4d15369186 +Ref: c-api/gen gen-objects15369186 +Ref: 4d4e15369186 +Ref: c-api/gen generator-objects15369186 +Ref: 4d4f15369186 +Ref: c-api/gen c PyGenObject15369486 +Ref: 4d5215369486 +Ref: c-api/gen c PyGen_Type15369566 +Ref: 4d5315369566 +Ref: c-api/gen c PyGen_Check15369677 +Ref: 4d5415369677 +Ref: c-api/gen c PyGen_CheckExact15369839 +Ref: 4d5515369839 +Ref: c-api/gen c PyGen_New15370021 +Ref: 4d5015370021 +Ref: c-api/gen c PyGen_NewWithQualName15370300 +Ref: 4d5115370300 +Node: Coroutine Objects<2>15370728 +Ref: c-api/coro doc15370858 +Ref: 4d5615370858 +Ref: c-api/coro coro-objects15370858 +Ref: ec915370858 +Ref: c-api/coro coroutine-objects15370858 +Ref: 4d5715370858 +Ref: c-api/coro c PyCoroObject15371019 +Ref: 4d5815371019 +Ref: c-api/coro c PyCoro_Type15371100 +Ref: 4d5915371100 +Ref: c-api/coro c PyCoro_CheckExact15371212 +Ref: 4d5a15371212 +Ref: c-api/coro c PyCoro_New15371396 +Ref: 4d5b15371396 +Node: Context Variables Objects15371813 +Ref: c-api/contextvars doc15371945 +Ref: 4d5c15371945 +Ref: c-api/contextvars context-variables-objects15371945 +Ref: 4d5d15371945 +Ref: c-api/contextvars contextvarsobjects15371945 +Ref: af815371945 +Ref: c-api/contextvars contextvarsobjects-pointertype-change15372016 +Ref: c2615372016 +Ref: c-api/contextvars c PyContext15372557 +Ref: 4d5e15372557 +Ref: c-api/contextvars c PyContextVar15372673 +Ref: 4d5f15372673 +Ref: c-api/contextvars c PyContextToken15372795 +Ref: 4d6015372795 +Ref: c-api/contextvars c PyContext_Type15372914 +Ref: 4d6115372914 +Ref: c-api/contextvars c PyContextVar_Type15373026 +Ref: 4d6215373026 +Ref: c-api/contextvars c PyContextToken_Type15373150 +Ref: 4d6315373150 +Ref: c-api/contextvars c PyContext_CheckExact15373302 +Ref: 4d6415373302 +Ref: c-api/contextvars c PyContextVar_CheckExact15373488 +Ref: 4d6515373488 +Ref: c-api/contextvars c PyContextToken_CheckExact15373680 +Ref: 4d6615373680 +Ref: c-api/contextvars c PyContext_New15373914 +Ref: 4d6715373914 +Ref: c-api/contextvars c PyContext_Copy15374096 +Ref: 4d6815374096 +Ref: c-api/contextvars c PyContext_CopyCurrent15374312 +Ref: 4d6915374312 +Ref: c-api/contextvars c PyContext_Enter15374521 +Ref: 4d6a15374521 +Ref: c-api/contextvars c PyContext_Exit15374694 +Ref: 4d6b15374694 +Ref: c-api/contextvars c PyContextVar_New15374952 +Ref: 4d6c15374952 +Ref: c-api/contextvars c PyContextVar_Get15375377 +Ref: 4d6d15375377 +Ref: c-api/contextvars c PyContextVar_Set15376000 +Ref: 4d6e15376000 +Ref: c-api/contextvars c PyContextVar_Reset15376289 +Ref: 4d6f15376289 +Ref: Context Variables Objects-Footnote-115376625 +Node: DateTime Objects<2>15376690 +Ref: c-api/datetime doc15376826 +Ref: 4d7015376826 +Ref: c-api/datetime datetime-objects15376826 +Ref: 4d7115376826 +Ref: c-api/datetime datetimeobjects15376826 +Ref: 4b8415376826 +Ref: c-api/datetime c PyDateTime_Date15377349 +Ref: 4d7215377349 +Ref: c-api/datetime c PyDateTime_DateTime15377464 +Ref: 4d7315377464 +Ref: c-api/datetime c PyDateTime_Time15377587 +Ref: 4d7415377587 +Ref: c-api/datetime c PyDateTime_Delta15377702 +Ref: 4d7515377702 +Ref: c-api/datetime c PyDateTime_DateType15377840 +Ref: 4d7615377840 +Ref: c-api/datetime c PyDateTime_DateTimeType15378065 +Ref: 4d7715378065 +Ref: c-api/datetime c PyDateTime_TimeType15378302 +Ref: 4d7815378302 +Ref: c-api/datetime c PyDateTime_DeltaType15378527 +Ref: 4d7915378527 +Ref: c-api/datetime c PyDateTime_TZInfoType15378796 +Ref: 4d7a15378796 +Ref: c-api/datetime c PyDateTime_TimeZone_UTC15379075 +Ref: bc315379075 +Ref: c-api/datetime c PyDate_Check15379300 +Ref: 4d7b15379300 +Ref: c-api/datetime c PyDate_CheckExact15379534 +Ref: 4d7c15379534 +Ref: c-api/datetime c PyDateTime_Check15379724 +Ref: 4d7d15379724 +Ref: c-api/datetime c PyDateTime_CheckExact15379970 +Ref: 4d7e15379970 +Ref: c-api/datetime c PyTime_Check15380168 +Ref: 4d7f15380168 +Ref: c-api/datetime c PyTime_CheckExact15380402 +Ref: 4d8015380402 +Ref: c-api/datetime c PyDelta_Check15380592 +Ref: 4d8115380592 +Ref: c-api/datetime c PyDelta_CheckExact15380828 +Ref: 4d8215380828 +Ref: c-api/datetime c PyTZInfo_Check15381020 +Ref: 4d8315381020 +Ref: c-api/datetime c PyTZInfo_CheckExact15381259 +Ref: 4d8415381259 +Ref: c-api/datetime c PyDate_FromDate15381480 +Ref: 4d8515381480 +Ref: c-api/datetime c PyDateTime_FromDateAndTime15381700 +Ref: 4d8615381700 +Ref: c-api/datetime c PyDateTime_FromDateAndTimeAndFold15382032 +Ref: 4d8715382032 +Ref: c-api/datetime c PyTime_FromTime15382415 +Ref: 4d8815382415 +Ref: c-api/datetime c PyTime_FromTimeAndFold15382669 +Ref: 4d8915382669 +Ref: c-api/datetime c PyDelta_FromDSU15382979 +Ref: 4d8a15382979 +Ref: c-api/datetime c PyTimeZone_FromOffset15383409 +Ref: bc115383409 +Ref: c-api/datetime c PyTimeZone_FromOffsetAndName15383688 +Ref: bc215383688 +Ref: c-api/datetime c PyDateTime_GET_YEAR15384247 +Ref: 4d8b15384247 +Ref: c-api/datetime c PyDateTime_GET_MONTH15384351 +Ref: 4d8c15384351 +Ref: c-api/datetime c PyDateTime_GET_DAY15384467 +Ref: 4d8d15384467 +Ref: c-api/datetime c PyDateTime_DATE_GET_HOUR15384787 +Ref: 4d8e15384787 +Ref: c-api/datetime c PyDateTime_DATE_GET_MINUTE15384910 +Ref: 4d8f15384910 +Ref: c-api/datetime c PyDateTime_DATE_GET_SECOND15385037 +Ref: 4d9015385037 +Ref: c-api/datetime c PyDateTime_DATE_GET_MICROSECOND15385164 +Ref: 4d9115385164 +Ref: c-api/datetime c PyDateTime_DATE_GET_FOLD15385315 +Ref: 4d9215385315 +Ref: c-api/datetime c PyDateTime_DATE_GET_TZINFO15385465 +Ref: 89315385465 +Ref: c-api/datetime c PyDateTime_TIME_GET_HOUR15385846 +Ref: 4d9315385846 +Ref: c-api/datetime c PyDateTime_TIME_GET_MINUTE15385965 +Ref: 4d9415385965 +Ref: c-api/datetime c PyDateTime_TIME_GET_SECOND15386088 +Ref: 4d9515386088 +Ref: c-api/datetime c PyDateTime_TIME_GET_MICROSECOND15386211 +Ref: 4d9615386211 +Ref: c-api/datetime c PyDateTime_TIME_GET_FOLD15386348 +Ref: 4d9715386348 +Ref: c-api/datetime c PyDateTime_TIME_GET_TZINFO15386494 +Ref: 89415386494 +Ref: c-api/datetime c PyDateTime_DELTA_GET_DAYS15386878 +Ref: 4d9815386878 +Ref: c-api/datetime c PyDateTime_DELTA_GET_SECONDS15387048 +Ref: 4d9915387048 +Ref: c-api/datetime c PyDateTime_DELTA_GET_MICROSECONDS15387216 +Ref: 4d9a15387216 +Ref: c-api/datetime c PyDateTime_FromTimestamp15387469 +Ref: 4d9b15387469 +Ref: c-api/datetime c PyDate_FromTimestamp15387762 +Ref: 1a0d15387762 +Node: Objects for Type Hinting15388044 +Ref: c-api/typehints doc15388146 +Ref: 4d9c15388146 +Ref: c-api/typehints objects-for-type-hinting15388146 +Ref: 4d9d15388146 +Ref: c-api/typehints typehintobjects15388146 +Ref: 4d9e15388146 +Ref: c-api/typehints c Py_GenericAlias15388391 +Ref: 4ae015388391 +Ref: c-api/typehints c Py_GenericAliasType15389774 +Ref: 4ae115389774 +Node: Initialization Finalization and Threads15390061 +Ref: c-api/init doc15390241 +Ref: 4d9f15390241 +Ref: c-api/init initialization15390241 +Ref: 4da015390241 +Ref: c-api/init initialization-finalization-and-threads15390241 +Ref: 4da115390241 +Node: Before Python Initialization15390894 +Ref: c-api/init before-python-initialization15391037 +Ref: 4da215391037 +Ref: c-api/init pre-init-safe15391037 +Ref: bc515391037 +Node: Global configuration variables15393714 +Ref: c-api/init global-conf-vars15393909 +Ref: 4da315393909 +Ref: c-api/init global-configuration-variables15393909 +Ref: 4da715393909 +Ref: c-api/init c Py_BytesWarningFlag15394381 +Ref: 3d015394381 +Ref: c-api/init c Py_DebugFlag15394913 +Ref: 3c215394913 +Ref: c-api/init c Py_DontWriteBytecodeFlag15395392 +Ref: 3d615395392 +Ref: c-api/init c Py_FrozenFlag15395910 +Ref: 3d215395910 +Ref: c-api/init c Py_HashRandomizationFlag15396383 +Ref: 3dc15396383 +Ref: c-api/init c Py_IgnoreEnvironmentFlag15396961 +Ref: 3d415396961 +Ref: c-api/init c Py_InspectFlag15397454 +Ref: 3ca15397454 +Ref: c-api/init c Py_InteractiveFlag15398069 +Ref: 3c815398069 +Ref: c-api/init c Py_IsolatedFlag15398398 +Ref: 3df15398398 +Ref: c-api/init c Py_LegacyWindowsFSEncodingFlag15398916 +Ref: 3e115398916 +Ref: c-api/init c Py_LegacyWindowsStdioFlag15399677 +Ref: 3e315399677 +Ref: c-api/init c Py_NoSiteFlag15400321 +Ref: 3ce15400321 +Ref: c-api/init c Py_NoUserSiteDirectory15400946 +Ref: 3d815400946 +Ref: c-api/init c Py_OptimizeFlag15401465 +Ref: 3cc15401465 +Ref: c-api/init c Py_QuietFlag15401859 +Ref: 3c615401859 +Ref: c-api/init c Py_UnbufferedStdioFlag15402292 +Ref: 3da15402292 +Ref: c-api/init c Py_VerboseFlag15402752 +Ref: 3c415402752 +Ref: Global configuration variables-Footnote-115403486 +Ref: Global configuration variables-Footnote-215403528 +Node: Initializing and finalizing the interpreter15403570 +Ref: c-api/init initializing-and-finalizing-the-interpreter15403760 +Ref: 4da815403760 +Ref: c-api/init c Py_Initialize15403861 +Ref: 8ab15403861 +Ref: c-api/init c Py_InitializeEx15405020 +Ref: 4ae715405020 +Ref: c-api/init c Py_InitializeFromConfig15405496 +Ref: 3c115405496 +Ref: c-api/init c Py_IsInitialized15405935 +Ref: 495015405935 +Ref: c-api/init c Py_IsFinalizing15406243 +Ref: 35515406243 +Ref: c-api/init c Py_FinalizeEx15406501 +Ref: d1515406501 +Ref: c-api/init c Py_Finalize15408979 +Ref: 134515408979 +Ref: c-api/init c Py_BytesMain15409174 +Ref: 9c115409174 +Ref: c-api/init c Py_Main15409504 +Ref: c2515409504 +Ref: c-api/init c Py_RunMain15411862 +Ref: 9c515411862 +Ref: c-api/init c PyUnstable_AtExit15413435 +Ref: 158b15413435 +Node: Process-wide parameters15414000 +Ref: c-api/init process-wide-parameters15414204 +Ref: 4dae15414204 +Ref: c-api/init c Py_SetProgramName15414265 +Ref: 163e15414265 +Ref: c-api/init c Py_GetProgramName15415432 +Ref: 3b515415432 +Ref: c-api/init c Py_GetPrefix15416046 +Ref: 3b115416046 +Ref: c-api/init c Py_GetExecPrefix15417294 +Ref: 3ad15417294 +Ref: c-api/init c Py_GetProgramFullPath15419949 +Ref: 3b315419949 +Ref: c-api/init c Py_GetPath15420761 +Ref: 3af15420761 +Ref: c-api/init c Py_GetVersion15421837 +Ref: 4ae515421837 +Ref: c-api/init c Py_GetPlatform15422483 +Ref: 4ae415422483 +Ref: c-api/init c Py_GetCopyright15423116 +Ref: 4ae315423116 +Ref: c-api/init c Py_GetCompiler15423537 +Ref: 4ae215423537 +Ref: c-api/init c Py_GetBuildInfo15423963 +Ref: 13fd15423963 +Ref: c-api/init c PySys_SetArgvEx15424416 +Ref: 163f15424416 +Ref: c-api/init c PySys_SetArgv15426860 +Ref: 164015426860 +Ref: c-api/init c Py_SetPythonHome15427712 +Ref: 163d15427712 +Ref: c-api/init c Py_GetPythonHome15428551 +Ref: 3b615428551 +Ref: Process-wide parameters-Footnote-115429235 +Node: Thread State and the Global Interpreter Lock15429290 +Ref: c-api/init thread-state-and-the-global-interpreter-lock15429474 +Ref: 4daf15429474 +Ref: c-api/init threads15429474 +Ref: 4db015429474 +Node: Releasing the GIL from extension code15431014 +Ref: c-api/init releasing-the-gil-from-extension-code15431167 +Ref: 4db115431167 +Node: Non-Python created threads15433042 +Ref: c-api/init gilstate15433223 +Ref: 4db215433223 +Ref: c-api/init non-python-created-threads15433223 +Ref: 4db315433223 +Node: Cautions about fork15434976 +Ref: c-api/init cautions-about-fork15435134 +Ref: 4db415435134 +Ref: c-api/init fork-and-threads15435134 +Ref: 4b4e15435134 +Node: High-level API15437071 +Ref: c-api/init high-level-api15437216 +Ref: 4db515437216 +Ref: c-api/init c PyInterpreterState15437390 +Ref: 8bc15437390 +Ref: c-api/init c PyThreadState15438029 +Ref: 78815438029 +Ref: c-api/init c PyThreadState interp15438233 +Ref: 4db615438233 +Ref: c-api/init c PyEval_InitThreads15438338 +Ref: 164115438338 +Ref: c-api/init c PyEval_SaveThread15438914 +Ref: 3a415438914 +Ref: c-api/init c PyEval_RestoreThread15439282 +Ref: 3a515439282 +Ref: c-api/init c PyThreadState_Get15440052 +Ref: 36d15440052 +Ref: c-api/init c PyThreadState_GetUnchecked15440433 +Ref: 36c15440433 +Ref: c-api/init c PyThreadState_Swap15440819 +Ref: 4a9215440819 +Ref: c-api/init c PyGILState_Ensure15441296 +Ref: 3a715441296 +Ref: c-api/init c PyGILState_Release15443069 +Ref: 3a815443069 +Ref: c-api/init c PyGILState_GetThisThreadState15443594 +Ref: 4a0515443594 +Ref: c-api/init c PyGILState_Check15444048 +Ref: 4db715444048 +Ref: c-api/init c Py_BEGIN_ALLOW_THREADS15444783 +Ref: 48d715444783 +Ref: c-api/init c Py_END_ALLOW_THREADS15445132 +Ref: a8e15445132 +Ref: c-api/init c Py_BLOCK_THREADS15445458 +Ref: 4ade15445458 +Ref: c-api/init c Py_UNBLOCK_THREADS15445681 +Ref: 4aea15445681 +Node: Low-level API15445939 +Ref: c-api/init low-level-api15446056 +Ref: 4db815446056 +Ref: c-api/init c PyInterpreterState_New15446271 +Ref: 41e515446271 +Ref: c-api/init c PyInterpreterState_Clear15446673 +Ref: 41e415446673 +Ref: c-api/init c PyInterpreterState_Delete15447017 +Ref: 4a1115447017 +Ref: c-api/init c PyThreadState_New15447355 +Ref: 4a9115447355 +Ref: c-api/init c PyThreadState_Clear15447710 +Ref: 162115447710 +Ref: c-api/init c PyThreadState_Delete15448182 +Ref: 199f15448182 +Ref: c-api/init c PyThreadState_DeleteCurrent15448484 +Ref: 19d215448484 +Ref: c-api/init c PyThreadState_GetFrame15448818 +Ref: 78915448818 +Ref: c-api/init c PyThreadState_GetID15449264 +Ref: 97215449264 +Ref: c-api/init c PyThreadState_GetInterpreter15449546 +Ref: 97115449546 +Ref: c-api/init c PyThreadState_EnterTracing15449851 +Ref: 74f15449851 +Ref: c-api/init c PyThreadState_LeaveTracing15450110 +Ref: 75015450110 +Ref: c-api/init c PyInterpreterState_Get15450454 +Ref: 3a915450454 +Ref: c-api/init c PyInterpreterState_GetID15450826 +Ref: bc615450826 +Ref: c-api/init c PyInterpreterState_GetDict15451172 +Ref: 4a1215451172 +Ref: c-api/init c PyUnstable_InterpreterState_GetMainModule15451751 +Ref: 4db915451751 +Ref: c-api/init c _PyFrameEvalFunction15452238 +Ref: 77115452238 +Ref: c-api/init c _PyInterpreterState_GetEvalFrameFunc15452793 +Ref: 198d15452793 +Ref: c-api/init c _PyInterpreterState_SetEvalFrameFunc15453071 +Ref: 198e15453071 +Ref: c-api/init c PyThreadState_GetDict15453344 +Ref: 4a9015453344 +Ref: c-api/init c PyThreadState_SetAsyncExc15453895 +Ref: bc415453895 +Ref: c-api/init c PyEval_AcquireThread15454716 +Ref: 3a615454716 +Ref: c-api/init c PyEval_ReleaseThread15455863 +Ref: 49b715455863 +Ref: Low-level API-Footnote-115456511 +Ref: Low-level API-Footnote-215456553 +Node: Sub-interpreter support15456595 +Ref: c-api/init id115456782 +Ref: 4dba15456782 +Ref: c-api/init sub-interpreter-support15456782 +Ref: 58415456782 +Ref: c-api/init c PyInterpreterConfig15457713 +Ref: 56a15457713 +Ref: c-api/init c PyInterpreterConfig use_main_obmalloc15458000 +Ref: 439515458000 +Ref: c-api/init c PyInterpreterConfig allow_fork15458442 +Ref: 4dbf15458442 +Ref: c-api/init c PyInterpreterConfig allow_exec15458776 +Ref: 4dc015458776 +Ref: c-api/init c PyInterpreterConfig allow_threads15459170 +Ref: 4dc115459170 +Ref: c-api/init c PyInterpreterConfig allow_daemon_threads15459361 +Ref: 4dc215459361 +Ref: c-api/init c PyInterpreterConfig check_multi_interp_extensions15459645 +Ref: 4dbc15459645 +Ref: c-api/init c PyInterpreterConfig gil15460168 +Ref: 4dbd15460168 +Ref: c-api/init c PyInterpreterConfig_DEFAULT_GIL15460316 +Ref: 4dc315460316 +Ref: c-api/init c PyInterpreterConfig_SHARED_GIL15460476 +Ref: 4dc415460476 +Ref: c-api/init c PyInterpreterConfig_OWN_GIL15460589 +Ref: 4dbe15460589 +Ref: c-api/init c Py_NewInterpreterFromConfig15460840 +Ref: 45715460840 +Ref: c-api/init c Py_NewInterpreter15465347 +Ref: 17b615465347 +Ref: c-api/init c Py_EndInterpreter15465823 +Ref: 185f15465823 +Ref: Sub-interpreter support-Footnote-115466625 +Node: A Per-Interpreter GIL15466667 +Ref: c-api/init a-per-interpreter-gil15466773 +Ref: 4dc615466773 +Ref: A Per-Interpreter GIL-Footnote-115468819 +Node: Bugs and caveats15468861 +Ref: c-api/init bugs-and-caveats15468967 +Ref: 4dc515468967 +Node: Asynchronous Notifications15470573 +Ref: c-api/init asynchronous-notifications15470737 +Ref: 4dc715470737 +Ref: c-api/init c Py_AddPendingCall15470982 +Ref: 98115470982 +Node: Profiling and Tracing15473145 +Ref: c-api/init profiling15473303 +Ref: 4dc815473303 +Ref: c-api/init profiling-and-tracing15473303 +Ref: 4dc915473303 +Ref: c-api/init c Py_tracefunc15473982 +Ref: 4dca15473982 +Ref: c-api/init c PyTrace_CALL15476331 +Ref: 4dcb15476331 +Ref: c-api/init c PyTrace_EXCEPTION15476721 +Ref: 4dcc15476721 +Ref: c-api/init c PyTrace_LINE15477331 +Ref: 4dcd15477331 +Ref: c-api/init c PyTrace_RETURN15477633 +Ref: 4dce15477633 +Ref: c-api/init c PyTrace_C_CALL15477786 +Ref: 4dcf15477786 +Ref: c-api/init c PyTrace_C_EXCEPTION15477948 +Ref: 4dd015477948 +Ref: c-api/init c PyTrace_C_RETURN15478117 +Ref: 4dd115478117 +Ref: c-api/init c PyTrace_OPCODE15478272 +Ref: 4dd215478272 +Ref: c-api/init c PyEval_SetProfile15478612 +Ref: 14c815478612 +Ref: c-api/init c PyEval_SetProfileAllThreads15479302 +Ref: 55c15479302 +Ref: c-api/init c PyEval_SetTrace15479814 +Ref: 41d15479814 +Ref: c-api/init c PyEval_SetTraceAllThreads15480494 +Ref: 41e15480494 +Node: Reference tracing15480991 +Ref: c-api/init reference-tracing15481148 +Ref: 4dd315481148 +Ref: c-api/init c PyRefTracer15481221 +Ref: 4dd415481221 +Ref: c-api/init c PyRefTracer_CREATE15481783 +Ref: 4dd515481783 +Ref: c-api/init c PyRefTracer_DESTROY15481947 +Ref: 4dd615481947 +Ref: c-api/init c PyRefTracer_SetTracer15482114 +Ref: 36715482114 +Ref: c-api/init c PyRefTracer_GetTracer15482908 +Ref: 36815482908 +Node: Advanced Debugger Support15483361 +Ref: c-api/init advanced-debugger-support15483525 +Ref: 4dd715483525 +Ref: c-api/init advanced-debugging15483525 +Ref: 4dd815483525 +Ref: c-api/init c PyInterpreterState_Head15483667 +Ref: 14cb15483667 +Ref: c-api/init c PyInterpreterState_Main15483845 +Ref: 4dbb15483845 +Ref: c-api/init c PyInterpreterState_Next15483979 +Ref: 14cc15483979 +Ref: c-api/init c PyInterpreterState_ThreadHead15484193 +Ref: 14cd15484193 +Ref: c-api/init c PyThreadState_Next15484447 +Ref: 14ce15484447 +Node: Thread Local Storage Support15484706 +Ref: c-api/init thread-local-storage15484882 +Ref: 4dd915484882 +Ref: c-api/init thread-local-storage-support15484882 +Ref: 4dda15484882 +Node: Thread Specific Storage TSS API15485991 +Ref: c-api/init thread-specific-storage-api15486124 +Ref: ade15486124 +Ref: c-api/init thread-specific-storage-tss-api15486124 +Ref: 4ddb15486124 +Ref: c-api/init c Py_tss_t15486510 +Ref: adf15486510 +Ref: c-api/init c Py_tss_NEEDS_INIT15486954 +Ref: 4ddc15486954 +Ref: Thread Specific Storage TSS API-Footnote-115487241 +Node: Dynamic Allocation15487283 +Ref: c-api/init dynamic-allocation15487388 +Ref: 4ddd15487388 +Ref: c-api/init c PyThread_tss_alloc15487668 +Ref: 40115487668 +Ref: c-api/init c PyThread_tss_free15487962 +Ref: 40315487962 +Node: Methods<2>15488445 +Ref: c-api/init methods15488550 +Ref: 4dde15488550 +Ref: c-api/init c PyThread_tss_is_created15488854 +Ref: 4a9415488854 +Ref: c-api/init c PyThread_tss_create15489105 +Ref: 4a9315489105 +Ref: c-api/init c PyThread_tss_delete15489584 +Ref: 40915489584 +Ref: c-api/init c PyThread_tss_set15490078 +Ref: 40515490078 +Ref: c-api/init c PyThread_tss_get15490397 +Ref: 40715490397 +Node: Thread Local Storage TLS API15490689 +Ref: c-api/init thread-local-storage-api15490822 +Ref: add15490822 +Ref: c-api/init thread-local-storage-tls-api15490822 +Ref: 4ddf15490822 +Ref: c-api/init c PyThread_create_key15491445 +Ref: 40015491445 +Ref: c-api/init c PyThread_delete_key15491532 +Ref: 40215491532 +Ref: c-api/init c PyThread_set_key_value15491627 +Ref: 40415491627 +Ref: c-api/init c PyThread_get_key_value15491737 +Ref: 40615491737 +Ref: c-api/init c PyThread_delete_key_value15491836 +Ref: 40815491836 +Ref: c-api/init c PyThread_ReInitTLS15491937 +Ref: 40a15491937 +Node: Synchronization Primitives<2>15492024 +Ref: c-api/init synchronization-primitives15492166 +Ref: 4de015492166 +Ref: c-api/init c PyMutex15492286 +Ref: 15b15492286 +Ref: c-api/init c PyMutex_Lock15492908 +Ref: 32515492908 +Ref: c-api/init c PyMutex_Unlock15493210 +Ref: 32615493210 +Node: Python Critical Section API15493440 +Ref: c-api/init id215493533 +Ref: 4de115493533 +Ref: c-api/init python-critical-section-api15493533 +Ref: 4de215493533 +Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION15495594 +Ref: 4c9f15495594 +Ref: c-api/init c Py_END_CRITICAL_SECTION15495992 +Ref: 4de415495992 +Ref: c-api/init c Py_BEGIN_CRITICAL_SECTION215496303 +Ref: 4de315496303 +Ref: c-api/init c Py_END_CRITICAL_SECTION215496841 +Ref: 4de515496841 +Node: Python Initialization Configuration15497156 +Ref: c-api/init_config doc15497331 +Ref: 4de615497331 +Ref: c-api/init_config init-config15497331 +Ref: 3a315497331 +Ref: c-api/init_config python-initialization-configuration15497331 +Ref: 4de715497331 +Ref: Python Initialization Configuration-Footnote-115498801 +Node: Example<17>15498843 +Ref: c-api/init_config example15498951 +Ref: 4de915498951 +Node: PyWideStringList15499960 +Ref: c-api/init_config pywidestringlist15500085 +Ref: 4dea15500085 +Ref: c-api/init_config c PyWideStringList15500134 +Ref: 9ae15500134 +Ref: c-api/init_config c PyWideStringList_Append15500329 +Ref: 9bf15500329 +Ref: c-api/init_config c PyWideStringList_Insert15500557 +Ref: 9c015500557 +Ref: c-api/init_config c PyWideStringList length15501016 +Ref: 4deb15501016 +Ref: c-api/init_config c PyWideStringList items15501090 +Ref: 4dec15501090 +Node: PyStatus15501149 +Ref: c-api/init_config pystatus15501274 +Ref: 4ded15501274 +Ref: c-api/init_config c PyStatus15501307 +Ref: 9ad15501307 +Ref: c-api/init_config c PyStatus exitcode15501530 +Ref: 4dee15501530 +Ref: c-api/init_config c PyStatus err_msg15501619 +Ref: 4def15501619 +Ref: c-api/init_config c PyStatus func15501685 +Ref: 4df015501685 +Ref: c-api/init_config c PyStatus_Ok15501833 +Ref: 9be15501833 +Ref: c-api/init_config c PyStatus_Error15501915 +Ref: 9b815501915 +Ref: c-api/init_config c PyStatus_NoMemory15502103 +Ref: 9bd15502103 +Ref: c-api/init_config c PyStatus_Exit15502225 +Ref: 9ba15502225 +Ref: c-api/init_config c PyStatus_Exception15502386 +Ref: 9b915502386 +Ref: c-api/init_config c PyStatus_IsError15502617 +Ref: 9bb15502617 +Ref: c-api/init_config c PyStatus_IsExit15502713 +Ref: 9bc15502713 +Ref: c-api/init_config c Py_ExitStatusException15502807 +Ref: 9c215502807 +Node: PyPreConfig15503748 +Ref: c-api/init_config pypreconfig15503894 +Ref: 4df115503894 +Ref: c-api/init_config c PyPreConfig15503933 +Ref: 9ac15503933 +Ref: c-api/init_config c PyPreConfig_InitPythonConfig15504058 +Ref: 9b715504058 +Ref: c-api/init_config c PyPreConfig_InitIsolatedConfig15504246 +Ref: 9b615504246 +Ref: c-api/init_config c PyPreConfig allocator15504462 +Ref: 4df215504462 +Ref: c-api/init_config c PyPreConfig configure_locale15506249 +Ref: 4df415506249 +Ref: c-api/init_config c PyPreConfig coerce_c_locale15506610 +Ref: 4df515506610 +Ref: c-api/init_config c PyPreConfig coerce_c_locale_warn15506929 +Ref: 4df615506929 +Ref: c-api/init_config c PyPreConfig dev_mode15507116 +Ref: 4df715507116 +Ref: c-api/init_config c PyPreConfig isolated15507313 +Ref: 4df915507313 +Ref: c-api/init_config c PyPreConfig legacy_windows_fs_encoding15507476 +Ref: 3e215507476 +Ref: c-api/init_config c PyPreConfig parse_argv15508048 +Ref: 4dfa15508048 +Ref: c-api/init_config c PyPreConfig use_environment15508433 +Ref: 4dfb15508433 +Ref: c-api/init_config c PyPreConfig utf8_mode15508652 +Ref: 3e615508652 +Node: Preinitialize Python with PyPreConfig15509063 +Ref: c-api/init_config c-preinit15509209 +Ref: 3d4015509209 +Ref: c-api/init_config preinitialize-python-with-pypreconfig15509209 +Ref: 4dfc15509209 +Ref: c-api/init_config c Py_PreInitialize15509698 +Ref: 3e715509698 +Ref: c-api/init_config c Py_PreInitializeFromBytesArgs15509898 +Ref: 9c415509898 +Ref: c-api/init_config c Py_PreInitializeFromArgs15510258 +Ref: 9c315510258 +Node: PyConfig15512195 +Ref: c-api/init_config pyconfig15512358 +Ref: 4dfd15512358 +Ref: c-api/init_config c PyConfig15512391 +Ref: 3a215512391 +Ref: c-api/init_config c PyConfig_InitPythonConfig15512621 +Ref: 9b115512621 +Ref: c-api/init_config c PyConfig_InitIsolatedConfig15512782 +Ref: 9b015512782 +Ref: c-api/init_config c PyConfig_SetString15512947 +Ref: 9b515512947 +Ref: c-api/init_config c PyConfig_SetBytesString15513219 +Ref: 9b415513219 +Ref: c-api/init_config c PyConfig_SetArgv15513549 +Ref: 9b215513549 +Ref: c-api/init_config c PyConfig_SetBytesArgv15513865 +Ref: 9b315513865 +Ref: c-api/init_config c PyConfig_SetWideStringList15514234 +Ref: 19e415514234 +Ref: c-api/init_config c PyConfig_Read15514541 +Ref: 78b15514541 +Ref: c-api/init_config c PyConfig_Clear15515911 +Ref: 9af15515911 +Ref: c-api/init_config c PyConfig argv15517035 +Ref: 3bf15517035 +Ref: c-api/init_config c PyConfig safe_path15518049 +Ref: 76e15518049 +Ref: c-api/init_config c PyConfig base_exec_prefix15518927 +Ref: 4dfe15518927 +Ref: c-api/init_config c PyConfig base_executable15519172 +Ref: 4e0015519172 +Ref: c-api/init_config c PyConfig base_prefix15519570 +Ref: 4e0115519570 +Ref: c-api/init_config c PyConfig buffered_stdio15519800 +Ref: 3db15519800 +Ref: c-api/init_config c PyConfig bytes_warning15520213 +Ref: 3d115520213 +Ref: c-api/init_config c PyConfig warn_default_encoding15520658 +Ref: 4e0415520658 +Ref: c-api/init_config c PyConfig code_debug_ranges15520970 +Ref: 4e0515520970 +Ref: c-api/init_config c PyConfig check_hash_pycs_mode15521443 +Ref: 4e0615521443 +Ref: c-api/init_config c PyConfig configure_c_stdio15522115 +Ref: 4e0315522115 +Ref: c-api/init_config c PyConfig dev_mode15522664 +Ref: 4df815522664 +Ref: c-api/init_config c PyConfig dump_refs15522964 +Ref: 4e0715522964 +Ref: c-api/init_config c PyConfig exec_prefix15523377 +Ref: 4dff15523377 +Ref: c-api/init_config c PyConfig executable15523729 +Ref: 3a115523729 +Ref: c-api/init_config c PyConfig faulthandler15524047 +Ref: 4e0815524047 +Ref: c-api/init_config c PyConfig filesystem_encoding15524401 +Ref: 3e415524401 +Ref: c-api/init_config c PyConfig filesystem_errors15525628 +Ref: 3e515525628 +Ref: c-api/init_config c PyConfig hash_seed15526297 +Ref: 3de15526297 +Ref: c-api/init_config c PyConfig use_hash_seed15526341 +Ref: 3dd15526341 +Ref: c-api/init_config c PyConfig home15526748 +Ref: 3b715526748 +Ref: c-api/init_config c PyConfig import_time15527100 +Ref: 4e0915527100 +Ref: c-api/init_config c PyConfig inspect15527353 +Ref: 3cb15527353 +Ref: c-api/init_config c PyConfig install_signal_handlers15527941 +Ref: 8bd15527941 +Ref: c-api/init_config c PyConfig interactive15528102 +Ref: 3c915528102 +Ref: c-api/init_config c PyConfig int_max_str_digits15528306 +Ref: 4e0a15528306 +Ref: c-api/init_config c PyConfig cpu_count15529195 +Ref: 4e0b15529195 +Ref: c-api/init_config c PyConfig isolated15529682 +Ref: 3e015529682 +Ref: c-api/init_config c PyConfig legacy_windows_stdio15530683 +Ref: 3a015530683 +Ref: c-api/init_config c PyConfig malloc_stats15531280 +Ref: 4e0c15531280 +Ref: c-api/init_config c PyConfig platlibdir15531664 +Ref: 193e15531664 +Ref: c-api/init_config c PyConfig pythonpath_env15532475 +Ref: 4e0d15532475 +Ref: c-api/init_config c PyConfig module_search_paths15532815 +Ref: 39e15532815 +Ref: c-api/init_config c PyConfig module_search_paths_set15532884 +Ref: 5eb15532884 +Ref: c-api/init_config c PyConfig optimization_level15533409 +Ref: 3cd15533409 +Ref: c-api/init_config c PyConfig orig_argv15533904 +Ref: 89215533904 +Ref: c-api/init_config c PyConfig parse_argv15534576 +Ref: 192815534576 +Ref: c-api/init_config c PyConfig parser_debug15535475 +Ref: 3c315535475 +Ref: c-api/init_config c PyConfig pathconfig_warnings15535951 +Ref: 3d315535951 +Ref: c-api/init_config c PyConfig prefix15536370 +Ref: 4e0215536370 +Ref: c-api/init_config c PyConfig program_name15536699 +Ref: 3c015536699 +Ref: c-api/init_config c PyConfig pycache_prefix15537431 +Ref: 4e0e15537431 +Ref: c-api/init_config c PyConfig quiet15537893 +Ref: 3c715537893 +Ref: c-api/init_config c PyConfig run_command15538159 +Ref: 4daa15538159 +Ref: c-api/init_config c PyConfig run_filename15538336 +Ref: 4dab15538336 +Ref: c-api/init_config c PyConfig run_module15538803 +Ref: 4dac15538803 +Ref: c-api/init_config c PyConfig run_presite15538979 +Ref: 4e1015538979 +Ref: c-api/init_config c PyConfig show_ref_count15539470 +Ref: 4e1115539470 +Ref: c-api/init_config c PyConfig site_import15539826 +Ref: 3cf15539826 +Ref: c-api/init_config c PyConfig skip_source_first_line15540479 +Ref: 4e0f15540479 +Ref: c-api/init_config c PyConfig stdio_encoding15540852 +Ref: 39f15540852 +Ref: c-api/init_config c PyConfig stdio_errors15540896 +Ref: 43a415540896 +Ref: c-api/init_config c PyConfig tracemalloc15541804 +Ref: 4e1215541804 +Ref: c-api/init_config c PyConfig perf_profiling15542157 +Ref: 4e1315542157 +Ref: c-api/init_config c PyConfig use_environment15542853 +Ref: 3d515542853 +Ref: c-api/init_config c PyConfig user_site_directory15543175 +Ref: 3d915543175 +Ref: c-api/init_config c PyConfig verbose15543570 +Ref: 3c515543570 +Ref: c-api/init_config c PyConfig warnoptions15544178 +Ref: 39c15544178 +Ref: c-api/init_config c PyConfig write_bytecode15545020 +Ref: 3d715545020 +Ref: c-api/init_config c PyConfig xoptions15545479 +Ref: 39d15545479 +Ref: PyConfig-Footnote-115546101 +Ref: PyConfig-Footnote-215546143 +Node: Initialization with PyConfig15546185 +Ref: c-api/init_config init-from-config15546333 +Ref: 4da915546333 +Ref: c-api/init_config initialization-with-pyconfig15546333 +Ref: 4e1415546333 +Node: Isolated Configuration15550028 +Ref: c-api/init_config init-isolated-conf15550188 +Ref: 4de815550188 +Ref: c-api/init_config isolated-configuration15550188 +Ref: 4e1515550188 +Node: Python Configuration15550955 +Ref: c-api/init_config init-python-config15551112 +Ref: 4dad15551112 +Ref: c-api/init_config python-configuration15551112 +Ref: 4e1615551112 +Ref: Python Configuration-Footnote-115551744 +Ref: Python Configuration-Footnote-215551786 +Node: Python Path Configuration15551828 +Ref: c-api/init_config init-path-config15551977 +Ref: 8ac15551977 +Ref: c-api/init_config python-path-configuration15551977 +Ref: 4e1715551977 +Node: Py_GetArgcArgv15555713 +Ref: c-api/init_config py-getargcargv15555892 +Ref: 4e1815555892 +Ref: c-api/init_config c Py_GetArgcArgv15555943 +Ref: 195615555943 +Node: Multi-Phase Initialization Private Provisional API15556144 +Ref: c-api/init_config multi-phase-initialization-private-provisional-api15556289 +Ref: 4e1915556289 +Ref: c-api/init_config c _Py_InitializeMain15557486 +Ref: 4e1a15557486 +Ref: Multi-Phase Initialization Private Provisional API-Footnote-115559513 +Ref: Multi-Phase Initialization Private Provisional API-Footnote-215559555 +Node: Memory Management15559597 +Ref: c-api/memory doc15559762 +Ref: 4e1b15559762 +Ref: c-api/memory memory15559762 +Ref: 4df315559762 +Ref: c-api/memory memory-management15559762 +Ref: 4e1c15559762 +Node: Overview<4>15560146 +Ref: c-api/memory memoryoverview15560237 +Ref: 4e1d15560237 +Ref: c-api/memory overview15560237 +Ref: 4e1e15560237 +Node: Allocator Domains15564153 +Ref: c-api/memory allocator-domains15564273 +Ref: 4e1f15564273 +Ref: c-api/memory id115564324 +Ref: 4e2015564324 +Node: Raw Memory Interface15566318 +Ref: c-api/memory raw-memory-interface15566443 +Ref: 4e2615566443 +Ref: c-api/memory raw-memoryinterface15566443 +Ref: 4e2215566443 +Ref: c-api/memory c PyMem_RawMalloc15566886 +Ref: 38b15566886 +Ref: c-api/memory c PyMem_RawCalloc15567330 +Ref: 38c15567330 +Ref: c-api/memory c PyMem_RawRealloc15567889 +Ref: 38d15567889 +Ref: c-api/memory c PyMem_RawFree15568696 +Ref: 38e15568696 +Node: Memory Interface15569165 +Ref: c-api/memory memory-interface15569290 +Ref: 4e2715569290 +Ref: c-api/memory memoryinterface15569290 +Ref: 4e2315569290 +Ref: c-api/memory c PyMem_Malloc15569796 +Ref: c6615569796 +Ref: c-api/memory c PyMem_Calloc15570215 +Ref: ea615570215 +Ref: c-api/memory c PyMem_Realloc15570768 +Ref: 102b15570768 +Ref: c-api/memory c PyMem_Free15571539 +Ref: 140e15571539 +Ref: c-api/memory c PyMem_New15572076 +Ref: 14ef15572076 +Ref: c-api/memory c PyMem_Resize15572311 +Ref: 4e2815572311 +Ref: c-api/memory c PyMem_Del15572759 +Ref: 14f015572759 +Node: Object allocators15573336 +Ref: c-api/memory object-allocators15573466 +Ref: 4e2915573466 +Ref: c-api/memory objectinterface15573466 +Ref: 4e2415573466 +Ref: c-api/memory c PyObject_Malloc15574155 +Ref: c6815574155 +Ref: c-api/memory c PyObject_Calloc15574580 +Ref: ea715574580 +Ref: c-api/memory c PyObject_Realloc15575139 +Ref: 140f15575139 +Ref: c-api/memory c PyObject_Free15575928 +Ref: c6515575928 +Node: Default Memory Allocators15576374 +Ref: c-api/memory default-memory-allocators15576515 +Ref: 1d5015576515 +Ref: c-api/memory id215576515 +Ref: 4e2b15576515 +Node: Customize Memory Allocators15579015 +Ref: c-api/memory customize-memory-allocators15579182 +Ref: 4e2a15579182 +Ref: c-api/memory id315579182 +Ref: 4e2c15579182 +Ref: c-api/memory c PyMemAllocatorEx15579276 +Ref: ec715579276 +Ref: c-api/memory c PyMemAllocatorDomain15581110 +Ref: 4e2115581110 +Ref: c-api/memory c PYMEM_DOMAIN_RAW15581208 +Ref: 1d5115581208 +Ref: c-api/memory c PYMEM_DOMAIN_MEM15581449 +Ref: c6915581449 +Ref: c-api/memory c PYMEM_DOMAIN_OBJ15581680 +Ref: c6715581680 +Ref: c-api/memory c PyMem_GetAllocator15581922 +Ref: 4da515581922 +Ref: c-api/memory c PyMem_SetAllocator15582094 +Ref: 58815582094 +Ref: c-api/memory c PyMem_SetupDebugHooks15584022 +Ref: c6a15584022 +Node: Debug hooks on the Python memory allocators15584172 +Ref: c-api/memory debug-hooks-on-the-python-memory-allocators15584336 +Ref: 4e2d15584336 +Ref: c-api/memory pymem-debug-hooks15584336 +Ref: 1d5315584336 +Node: The pymalloc allocator15589584 +Ref: c-api/memory pymalloc15589743 +Ref: d0f15589743 +Ref: c-api/memory the-pymalloc-allocator15589743 +Ref: 4e2e15589743 +Node: Customize pymalloc Arena Allocator15591058 +Ref: c-api/memory customize-pymalloc-arena-allocator15591151 +Ref: 4e2f15591151 +Ref: c-api/memory c PyObjectArenaAllocator15591263 +Ref: 4e3015591263 +Ref: c-api/memory c PyObject_GetArenaAllocator15592272 +Ref: 4da615592272 +Ref: c-api/memory c PyObject_SetArenaAllocator15592398 +Ref: 4da415592398 +Node: The mimalloc allocator15592524 +Ref: c-api/memory mimalloc15592657 +Ref: 1d5215592657 +Ref: c-api/memory the-mimalloc-allocator15592657 +Ref: 4e3115592657 +Node: tracemalloc C API15593018 +Ref: c-api/memory tracemalloc-c-api15593141 +Ref: 4e3215593141 +Ref: c-api/memory c PyTraceMalloc_Track15593217 +Ref: bb615593217 +Ref: c-api/memory c PyTraceMalloc_Untrack15593629 +Ref: bb715593629 +Node: Examples<37>15593920 +Ref: c-api/memory examples15594012 +Ref: 4e3315594012 +Ref: c-api/memory memoryexamples15594012 +Ref: 4e3415594012 +Node: Object Implementation Support15595924 +Ref: c-api/objimpl doc15596076 +Ref: 4e3515596076 +Ref: c-api/objimpl newtypes15596076 +Ref: 4e3615596076 +Ref: c-api/objimpl object-implementation-support15596076 +Ref: 4e3715596076 +Node: Allocating Objects on the Heap15596383 +Ref: c-api/allocation doc15596512 +Ref: 4e3815596512 +Ref: c-api/allocation allocating-objects15596512 +Ref: 4e3915596512 +Ref: c-api/allocation allocating-objects-on-the-heap15596512 +Ref: 4e3a15596512 +Ref: c-api/allocation c _PyObject_New15596589 +Ref: 4e3b15596589 +Ref: c-api/allocation c _PyObject_NewVar15596699 +Ref: 4e3c15596699 +Ref: c-api/allocation c PyObject_Init15596843 +Ref: a6a15596843 +Ref: c-api/allocation c PyObject_InitVar15597193 +Ref: 195515597193 +Ref: c-api/allocation c PyObject_New15597535 +Ref: 98515597535 +Ref: c-api/allocation c PyObject_NewVar15598179 +Ref: 98615598179 +Ref: c-api/allocation c PyObject_Del15599060 +Ref: 149c15599060 +Ref: c-api/allocation c _Py_NoneStruct15599447 +Ref: 4e3d15599447 +Node: Common Object Structures15599774 +Ref: c-api/structures doc15599934 +Ref: 4e3e15599934 +Ref: c-api/structures common-object-structures15599934 +Ref: 4e3f15599934 +Ref: c-api/structures common-structs15599934 +Ref: 4e4015599934 +Node: Base object types and macros15600290 +Ref: c-api/structures base-object-types-and-macros15600422 +Ref: 4e4115600422 +Ref: c-api/structures c PyObject15600930 +Ref: 33415600930 +Ref: c-api/structures c PyVarObject15601614 +Ref: 416a15601614 +Ref: c-api/structures c PyObject_HEAD15602095 +Ref: 12d115602095 +Ref: c-api/structures c PyObject_VAR_HEAD15602356 +Ref: 4e4215602356 +Ref: c-api/structures c PyBaseObject_Type15602659 +Ref: 496415602659 +Ref: c-api/structures c Py_Is15602847 +Ref: 89e15602847 +Ref: c-api/structures c Py_IsNone15603077 +Ref: 89f15603077 +Ref: c-api/structures c Py_IsTrue15603311 +Ref: 8a015603311 +Ref: c-api/structures c Py_IsFalse15603545 +Ref: 8a115603545 +Ref: c-api/structures c Py_TYPE15603782 +Ref: 77b15603782 +Ref: c-api/structures c Py_IS_TYPE15604217 +Ref: 181415604217 +Ref: c-api/structures c Py_SET_TYPE15604438 +Ref: 77c15604438 +Ref: c-api/structures c Py_SIZE15604575 +Ref: 77d15604575 +Ref: c-api/structures c Py_SET_SIZE15604927 +Ref: 77e15604927 +Ref: c-api/structures c PyObject_HEAD_INIT15605064 +Ref: 4e4315605064 +Ref: c-api/structures c PyVarObject_HEAD_INIT15605282 +Ref: 4e4415605282 +Node: Implementing functions and methods15605566 +Ref: c-api/structures implementing-functions-and-methods15605746 +Ref: 4e4515605746 +Ref: c-api/structures c PyCFunction15605835 +Ref: 144015605835 +Ref: c-api/structures c PyCFunctionWithKeywords15606453 +Ref: 497615606453 +Ref: c-api/structures c PyCFunctionFast15606880 +Ref: 497415606880 +Ref: c-api/structures c PyCFunctionFastWithKeywords15607287 +Ref: 497515607287 +Ref: c-api/structures c PyCMethod15607830 +Ref: 75f15607830 +Ref: c-api/structures c PyMethodDef15608320 +Ref: 14a215608320 +Ref: c-api/structures c PyMethodDef ml_name15608519 +Ref: 490215608519 +Ref: c-api/structures c PyMethodDef ml_meth15608590 +Ref: 4e4815608590 +Ref: c-api/structures c PyMethodDef ml_flags15608687 +Ref: 4e4915608687 +Ref: c-api/structures c PyMethodDef ml_doc15608789 +Ref: 4e4a15608789 +Ref: c-api/structures c METH_VARARGS15609520 +Ref: 14d415609520 +Ref: c-api/structures c METH_KEYWORDS15610034 +Ref: 48bc15610034 +Ref: c-api/structures meth-varargs-meth-keywords15610287 +Ref: 4e4615610287 +Ref: c-api/structures c METH_FASTCALL15610724 +Ref: 162715610724 +Ref: c-api/structures meth-fastcall-meth-keywords15611224 +Ref: 4e4715611224 +Ref: c-api/structures c METH_METHOD15611892 +Ref: 97015611892 +Ref: c-api/structures meth-method-meth-fastcall-meth-keywords15612039 +Ref: 168e15612039 +Ref: c-api/structures c METH_NOARGS15612564 +Ref: 149f15612564 +Ref: c-api/structures c METH_O15613127 +Ref: 14d315613127 +Ref: c-api/structures c METH_CLASS15613721 +Ref: 14a015613721 +Ref: c-api/structures c METH_STATIC15613997 +Ref: 14a115613997 +Ref: c-api/structures c METH_COEXIST15614385 +Ref: 143f15614385 +Ref: c-api/structures c PyCMethod_New15615055 +Ref: 18ed15615055 +Ref: c-api/structures c PyCFunction_NewEx15616197 +Ref: 198c15616197 +Ref: c-api/structures c PyCFunction_New15616455 +Ref: 18f315616455 +Node: Accessing attributes of extension types15616715 +Ref: c-api/structures accessing-attributes-of-extension-types15616858 +Ref: 4e4b15616858 +Ref: c-api/structures c PyMemberDef15616957 +Ref: 54c15616957 +Ref: c-api/structures c PyMemberDef name15617300 +Ref: 4e4c15617300 +Ref: c-api/structures c PyMemberDef type15617501 +Ref: 490315617501 +Ref: c-api/structures c PyMemberDef offset15617647 +Ref: 4e4d15617647 +Ref: c-api/structures c PyMemberDef flags15617796 +Ref: 490415617796 +Ref: c-api/structures c PyMemberDef doc15617920 +Ref: 4e4f15617920 +Ref: c-api/structures pymemberdef-offsets15618460 +Ref: 4c0915618460 +Ref: c-api/structures c PyMember_GetOne15619585 +Ref: 58a15619585 +Ref: c-api/structures c PyMember_SetOne15620035 +Ref: 58b15620035 +Node: Member flags15620611 +Ref: c-api/structures member-flags15620720 +Ref: 4e5115620720 +Ref: c-api/structures pymemberdef-flags15620720 +Ref: 4e4e15620720 +Ref: c-api/structures c Py_READONLY15620835 +Ref: 58e15620835 +Ref: c-api/structures c Py_AUDIT_READ15620881 +Ref: 58f15620881 +Ref: c-api/structures c Py_RELATIVE_OFFSET15620994 +Ref: 54b15620994 +Node: Member types15622232 +Ref: c-api/structures member-types15622378 +Ref: 4e5215622378 +Ref: c-api/structures pymemberdef-types15622378 +Ref: 167315622378 +Ref: c-api/structures c Py_T_BYTE15623260 +Ref: 4e5315623260 +Ref: c-api/structures c Py_T_SHORT15623492 +Ref: 4e5415623492 +Ref: c-api/structures c Py_T_INT15623721 +Ref: 58c15623721 +Ref: c-api/structures c Py_T_LONG15623953 +Ref: 4e5515623953 +Ref: c-api/structures c Py_T_LONGLONG15624188 +Ref: 4e5615624188 +Ref: c-api/structures c Py_T_UBYTE15624416 +Ref: 4e5715624416 +Ref: c-api/structures c Py_T_UINT15624646 +Ref: 4e5815624646 +Ref: c-api/structures c Py_T_USHORT15624879 +Ref: 4e5915624879 +Ref: c-api/structures c Py_T_ULONG15625109 +Ref: 4e5a15625109 +Ref: c-api/structures c Py_T_ULONGLONG15625344 +Ref: 4e5b15625344 +Ref: c-api/structures c Py_T_PYSSIZET15625574 +Ref: 4e5c15625574 +Ref: c-api/structures c Py_T_FLOAT15625802 +Ref: 4e5d15625802 +Ref: c-api/structures c Py_T_DOUBLE15626036 +Ref: 58d15626036 +Ref: c-api/structures c Py_T_BOOL15626267 +Ref: 4e5e15626267 +Ref: c-api/structures c Py_T_STRING15626501 +Ref: 4e5015626501 +Ref: c-api/structures c Py_T_STRING_INPLACE15626745 +Ref: 4e5f15626745 +Ref: c-api/structures c Py_T_CHAR15626971 +Ref: 4e6015626971 +Ref: c-api/structures c Py_T_OBJECT_EX15627212 +Ref: 59115627212 +Ref: c-api/structures c T_OBJECT15628079 +Ref: 59015628079 +Ref: c-api/structures c T_NONE15628294 +Ref: 59215628294 +Node: Defining Getters and Setters15628383 +Ref: c-api/structures defining-getters-and-setters15628508 +Ref: 4e6115628508 +Ref: c-api/structures c PyGetSetDef15628585 +Ref: bb815628585 +Ref: c-api/structures c PyGetSetDef name15628817 +Ref: 4e6215628817 +Ref: c-api/structures c PyGetSetDef get15628880 +Ref: 4e6315628880 +Ref: c-api/structures c PyGetSetDef set15628968 +Ref: 4e6415628968 +Ref: c-api/structures c PyGetSetDef doc15629129 +Ref: 4e6515629129 +Ref: c-api/structures c PyGetSetDef closure15629195 +Ref: 4e6615629195 +Ref: c-api/structures c getter15629327 +Ref: 4af515629327 +Ref: c-api/structures c setter15629712 +Ref: 4b0315629712 +Node: Type Object Structures15630192 +Ref: c-api/typeobj doc15630358 +Ref: 4e6715630358 +Ref: c-api/typeobj type-object-structures15630358 +Ref: 4e6815630358 +Ref: c-api/typeobj type-structs15630358 +Ref: 98d15630358 +Node: Quick Reference15631816 +Ref: c-api/typeobj quick-reference15631922 +Ref: 4e6a15631922 +Node: “tp slots”15632034 +Ref: c-api/typeobj tp-slots15632118 +Ref: 4e6b15632118 +Ref: c-api/typeobj tp-slots-table15632118 +Ref: 4e6c15632118 +Ref: “tp slots”-Footnote-115645371 +Ref: “tp slots”-Footnote-215645683 +Node: sub-slots15646478 +Ref: c-api/typeobj id315646584 +Ref: 4e7715646584 +Ref: c-api/typeobj sub-slots15646584 +Ref: 4e6e15646584 +Node: slot typedefs15656992 +Ref: c-api/typeobj slot-typedefs15657075 +Ref: 4ea715657075 +Ref: c-api/typeobj slot-typedefs-table15657075 +Ref: 4e6d15657075 +Node: PyTypeObject Definition15664938 +Ref: c-api/typeobj pytypeobject-definition15665067 +Ref: 4ea915665067 +Node: PyObject Slots15668215 +Ref: c-api/typeobj pyobject-slots15668346 +Ref: 4eaa15668346 +Ref: c-api/typeobj c PyObject ob_refcnt15668781 +Ref: 89d15668781 +Ref: c-api/typeobj c PyObject ob_type15669369 +Ref: 48e615669369 +Node: PyVarObject Slots15670539 +Ref: c-api/typeobj pyvarobject-slots15670665 +Ref: 4eab15670665 +Ref: c-api/typeobj c PyVarObject ob_size15670720 +Ref: 4ada15670720 +Node: PyTypeObject Slots15671208 +Ref: c-api/typeobj pytypeobject-slots15671332 +Ref: 4eac15671332 +Ref: c-api/typeobj c PyTypeObject tp_name15671690 +Ref: 18f215671690 +Ref: c-api/typeobj c PyTypeObject tp_basicsize15673449 +Ref: 98715673449 +Ref: c-api/typeobj c PyTypeObject tp_itemsize15673533 +Ref: 1f7015673533 +Ref: c-api/typeobj c PyTypeObject tp_dealloc15677677 +Ref: 48e815677677 +Ref: c-api/typeobj c PyTypeObject tp_vectorcall_offset15680959 +Ref: 4baa15680959 +Ref: c-api/typeobj c PyTypeObject tp_getattr15682886 +Ref: 490615682886 +Ref: c-api/typeobj c PyTypeObject tp_setattr15683654 +Ref: 490715683654 +Ref: c-api/typeobj c PyTypeObject tp_as_async15684442 +Ref: ec815684442 +Ref: c-api/typeobj c PyTypeObject tp_repr15685019 +Ref: 48fd15685019 +Ref: c-api/typeobj c PyTypeObject tp_as_number15685993 +Ref: 98b15685993 +Ref: c-api/typeobj c PyTypeObject tp_as_sequence15686427 +Ref: 4e6f15686427 +Ref: c-api/typeobj c PyTypeObject tp_as_mapping15686872 +Ref: 4e7015686872 +Ref: c-api/typeobj c PyTypeObject tp_hash15687312 +Ref: 490f15687312 +Ref: c-api/typeobj c PyTypeObject tp_call15689046 +Ref: 55615689046 +Ref: c-api/typeobj c PyTypeObject tp_str15689469 +Ref: 48fe15689469 +Ref: c-api/typeobj c PyTypeObject tp_getattro15690444 +Ref: 16f215690444 +Ref: c-api/typeobj c PyTypeObject tp_setattro15691365 +Ref: 490115691365 +Ref: c-api/typeobj c PyTypeObject tp_as_buffer15692412 +Ref: 98915692412 +Ref: c-api/typeobj c PyTypeObject tp_flags15692845 +Ref: 18bd15692845 +Ref: c-api/typeobj c Py_TPFLAGS_HEAPTYPE15694815 +Ref: 8ae15694815 +Ref: c-api/typeobj c Py_TPFLAGS_BASETYPE15695629 +Ref: 48ee15695629 +Ref: c-api/typeobj c Py_TPFLAGS_READY15695909 +Ref: 4eb215695909 +Ref: c-api/typeobj c Py_TPFLAGS_READYING15696101 +Ref: 4eb315696101 +Ref: c-api/typeobj c Py_TPFLAGS_HAVE_GC15696302 +Ref: 77815696302 +Ref: c-api/typeobj c Py_TPFLAGS_DEFAULT15697330 +Ref: 48e315697330 +Ref: c-api/typeobj c Py_TPFLAGS_METHOD_DESCRIPTOR15697668 +Ref: 4bb215697668 +Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_DICT15698601 +Ref: 36615698601 +Ref: c-api/typeobj c Py_TPFLAGS_MANAGED_WEAKREF15699267 +Ref: 55715699267 +Ref: c-api/typeobj c Py_TPFLAGS_ITEMS_AT_END15699588 +Ref: 54815699588 +Ref: c-api/typeobj c Py_TPFLAGS_LONG_SUBCLASS15700257 +Ref: 4eb415700257 +Ref: c-api/typeobj c Py_TPFLAGS_LIST_SUBCLASS15700301 +Ref: 4eb515700301 +Ref: c-api/typeobj c Py_TPFLAGS_TUPLE_SUBCLASS15700345 +Ref: 4eb615700345 +Ref: c-api/typeobj c Py_TPFLAGS_BYTES_SUBCLASS15700390 +Ref: 4eb715700390 +Ref: c-api/typeobj c Py_TPFLAGS_UNICODE_SUBCLASS15700435 +Ref: 4eb815700435 +Ref: c-api/typeobj c Py_TPFLAGS_DICT_SUBCLASS15700482 +Ref: 4eb915700482 +Ref: c-api/typeobj c Py_TPFLAGS_BASE_EXC_SUBCLASS15700526 +Ref: 4eba15700526 +Ref: c-api/typeobj c Py_TPFLAGS_TYPE_SUBCLASS15700574 +Ref: 4ebb15700574 +Ref: c-api/typeobj c Py_TPFLAGS_HAVE_FINALIZE15701135 +Ref: 3ee15701135 +Ref: c-api/typeobj c Py_TPFLAGS_HAVE_VECTORCALL15701520 +Ref: 55115701520 +Ref: c-api/typeobj c Py_TPFLAGS_IMMUTABLETYPE15702081 +Ref: 3be15702081 +Ref: c-api/typeobj c Py_TPFLAGS_DISALLOW_INSTANTIATION15702449 +Ref: 57f15702449 +Ref: c-api/typeobj c Py_TPFLAGS_MAPPING15703578 +Ref: 18a315703578 +Ref: c-api/typeobj c Py_TPFLAGS_SEQUENCE15704429 +Ref: 18a415704429 +Ref: c-api/typeobj c Py_TPFLAGS_VALID_VERSION_TAG15705281 +Ref: 4ebc15705281 +Ref: c-api/typeobj c PyTypeObject tp_doc15705630 +Ref: 48e415705630 +Ref: c-api/typeobj c PyTypeObject tp_traverse15705960 +Ref: 77915705960 +Ref: c-api/typeobj c PyTypeObject tp_clear15710122 +Ref: 48fb15710122 +Ref: c-api/typeobj c PyTypeObject tp_richcompare15714049 +Ref: 490915714049 +Ref: c-api/typeobj c Py_LT15715032 +Ref: 4b9f15715032 +Ref: c-api/typeobj c Py_LE15715132 +Ref: 4ba015715132 +Ref: c-api/typeobj c Py_EQ15715233 +Ref: 4ba115715233 +Ref: c-api/typeobj c Py_NE15715334 +Ref: 4ba215715334 +Ref: c-api/typeobj c Py_GT15715435 +Ref: 4ba315715435 +Ref: c-api/typeobj c Py_GE15715535 +Ref: 4ba415715535 +Ref: c-api/typeobj c Py_RETURN_RICHCOMPARE15715668 +Ref: bb415715668 +Ref: c-api/typeobj c PyTypeObject tp_weaklistoffset15716939 +Ref: 98815716939 +Ref: c-api/typeobj c PyTypeObject tp_iter15718469 +Ref: 14b915718469 +Ref: c-api/typeobj c PyTypeObject tp_iternext15718992 +Ref: 14ba15718992 +Ref: c-api/typeobj c PyTypeObject tp_methods15719830 +Ref: 48ed15719830 +Ref: c-api/typeobj c PyTypeObject tp_members15720361 +Ref: 48eb15720361 +Ref: c-api/typeobj c PyTypeObject tp_getset15720926 +Ref: 48f015720926 +Ref: c-api/typeobj c PyTypeObject tp_base15721483 +Ref: 48f415721483 +Ref: c-api/typeobj c PyTypeObject tp_dict15722805 +Ref: 171e15722805 +Ref: c-api/typeobj c PyTypeObject tp_descr_get15724324 +Ref: 4e7115724324 +Ref: c-api/typeobj c PyTypeObject tp_descr_set15724654 +Ref: 18f615724654 +Ref: c-api/typeobj c PyTypeObject tp_dictoffset15725079 +Ref: 4c0815725079 +Ref: c-api/typeobj c PyTypeObject tp_init15726971 +Ref: 57e15726971 +Ref: c-api/typeobj c PyTypeObject tp_alloc15728436 +Ref: 48ea15728436 +Ref: c-api/typeobj c PyTypeObject tp_new15729152 +Ref: 57c15729152 +Ref: c-api/typeobj c PyTypeObject tp_free15730887 +Ref: 48e915730887 +Ref: c-api/typeobj c PyTypeObject tp_is_gc15731620 +Ref: 4e7215731620 +Ref: c-api/typeobj c PyTypeObject tp_bases15732803 +Ref: 4e7315732803 +Ref: c-api/typeobj c PyTypeObject tp_mro15733554 +Ref: 4c0b15733554 +Ref: c-api/typeobj c PyTypeObject tp_cache15734034 +Ref: 4c0c15734034 +Ref: c-api/typeobj c PyTypeObject tp_subclasses15734194 +Ref: 56f15734194 +Ref: c-api/typeobj c PyTypeObject tp_weaklist15734650 +Ref: 4c0d15734650 +Ref: c-api/typeobj c PyTypeObject tp_del15735226 +Ref: 4e7415735226 +Ref: c-api/typeobj c PyTypeObject tp_version_tag15735366 +Ref: 4e7515735366 +Ref: c-api/typeobj c PyTypeObject tp_finalize15735552 +Ref: aa615735552 +Ref: c-api/typeobj c PyTypeObject tp_vectorcall15737028 +Ref: 4c0a15737028 +Ref: c-api/typeobj c PyTypeObject tp_watched15737577 +Ref: 4e7615737577 +Ref: PyTypeObject Slots-Footnote-115737735 +Ref: PyTypeObject Slots-Footnote-215737777 +Ref: PyTypeObject Slots-Footnote-315737819 +Ref: PyTypeObject Slots-Footnote-415737862 +Node: Static Types15737904 +Ref: c-api/typeobj id415738021 +Ref: 4ebd15738021 +Ref: c-api/typeobj static-types15738021 +Ref: 77a15738021 +Node: Heap Types15738928 +Ref: c-api/typeobj heap-types15739051 +Ref: 96515739051 +Ref: c-api/typeobj id515739051 +Ref: 4ebe15739051 +Node: Number Object Structures15739556 +Ref: c-api/typeobj number-object-structures15739692 +Ref: 4ebf15739692 +Ref: c-api/typeobj number-structs15739692 +Ref: 4eae15739692 +Ref: c-api/typeobj c PyNumberMethods15739763 +Ref: 13e915739763 +Ref: c-api/typeobj c PyNumberMethods nb_add15742211 +Ref: 4bff15742211 +Ref: c-api/typeobj c PyNumberMethods nb_subtract15742285 +Ref: 4e7e15742285 +Ref: c-api/typeobj c PyNumberMethods nb_multiply15742374 +Ref: 4e8015742374 +Ref: c-api/typeobj c PyNumberMethods nb_remainder15742463 +Ref: 4e8215742463 +Ref: c-api/typeobj c PyNumberMethods nb_divmod15742553 +Ref: 4e8415742553 +Ref: c-api/typeobj c PyNumberMethods nb_power15742640 +Ref: 4e8515742640 +Ref: c-api/typeobj c PyNumberMethods nb_negative15742727 +Ref: 4e8715742727 +Ref: c-api/typeobj c PyNumberMethods nb_positive15742815 +Ref: 4e8815742815 +Ref: c-api/typeobj c PyNumberMethods nb_absolute15742903 +Ref: 4e8915742903 +Ref: c-api/typeobj c PyNumberMethods nb_bool15742991 +Ref: 4e8a15742991 +Ref: c-api/typeobj c PyNumberMethods nb_invert15743063 +Ref: 4e8b15743063 +Ref: c-api/typeobj c PyNumberMethods nb_lshift15743149 +Ref: 4e8c15743149 +Ref: c-api/typeobj c PyNumberMethods nb_rshift15743236 +Ref: 4e8e15743236 +Ref: c-api/typeobj c PyNumberMethods nb_and15743323 +Ref: 4e9015743323 +Ref: c-api/typeobj c PyNumberMethods nb_xor15743397 +Ref: 4e9215743397 +Ref: c-api/typeobj c PyNumberMethods nb_or15743471 +Ref: 4e9415743471 +Ref: c-api/typeobj c PyNumberMethods nb_int15743544 +Ref: 4e9615743544 +Ref: c-api/typeobj c PyNumberMethods nb_reserved15743617 +Ref: 4e9715743617 +Ref: c-api/typeobj c PyNumberMethods nb_float15743678 +Ref: 4e9815743678 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_add15743763 +Ref: 4e7d15743763 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_subtract15743855 +Ref: 4e7f15743855 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_multiply15743952 +Ref: 4e8115743952 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_remainder15744049 +Ref: 4e8315744049 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_power15744147 +Ref: 4e8615744147 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_lshift15744242 +Ref: 4e8d15744242 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_rshift15744337 +Ref: 4e8f15744337 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_and15744432 +Ref: 4e9115744432 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_xor15744524 +Ref: 4e9315744524 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_or15744616 +Ref: 4e9515744616 +Ref: c-api/typeobj c PyNumberMethods nb_floor_divide15744707 +Ref: 4e9915744707 +Ref: c-api/typeobj c PyNumberMethods nb_true_divide15744800 +Ref: 4e9b15744800 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_floor_divide15744892 +Ref: 4e9a15744892 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_true_divide15744993 +Ref: 4e9c15744993 +Ref: c-api/typeobj c PyNumberMethods nb_index15745093 +Ref: 13e815745093 +Ref: c-api/typeobj c PyNumberMethods nb_matrix_multiply15745178 +Ref: 4e9d15745178 +Ref: c-api/typeobj c PyNumberMethods nb_inplace_matrix_multiply15745274 +Ref: 4e9e15745274 +Node: Mapping Object Structures15745378 +Ref: c-api/typeobj mapping-object-structures15745530 +Ref: 4ec015745530 +Ref: c-api/typeobj mapping-structs15745530 +Ref: 4eb015745530 +Ref: c-api/typeobj c PyMappingMethods15745603 +Ref: 490e15745603 +Ref: c-api/typeobj c PyMappingMethods mp_length15745775 +Ref: 4e9f15745775 +Ref: c-api/typeobj c PyMappingMethods mp_subscript15746065 +Ref: 192d15746065 +Ref: c-api/typeobj c PyMappingMethods mp_ass_subscript15746458 +Ref: 4ea015746458 +Node: Sequence Object Structures15746950 +Ref: c-api/typeobj sequence-object-structures15747102 +Ref: 4ec115747102 +Ref: c-api/typeobj sequence-structs15747102 +Ref: 4eaf15747102 +Ref: c-api/typeobj c PySequenceMethods15747177 +Ref: 490d15747177 +Ref: c-api/typeobj c PySequenceMethods sq_length15747328 +Ref: 4c0715747328 +Ref: c-api/typeobj c PySequenceMethods sq_concat15747668 +Ref: 4ea115747668 +Ref: c-api/typeobj c PySequenceMethods sq_repeat15747969 +Ref: 4ea215747969 +Ref: c-api/typeobj c PySequenceMethods sq_item15748284 +Ref: 192c15748284 +Ref: c-api/typeobj c PySequenceMethods sq_ass_item15749041 +Ref: 4ea315749041 +Ref: c-api/typeobj c PySequenceMethods sq_contains15749530 +Ref: 4ea415749530 +Ref: c-api/typeobj c PySequenceMethods sq_inplace_concat15749867 +Ref: 4ea515749867 +Ref: c-api/typeobj c PySequenceMethods sq_inplace_repeat15750416 +Ref: 4ea615750416 +Node: Buffer Object Structures15750978 +Ref: c-api/typeobj buffer-object-structures15751128 +Ref: 4ec215751128 +Ref: c-api/typeobj buffer-structs15751128 +Ref: 4bca15751128 +Ref: c-api/typeobj c PyBufferProcs15751199 +Ref: 4c0e15751199 +Ref: c-api/typeobj c PyBufferProcs bf_getbuffer15751433 +Ref: 75d15751433 +Ref: c-api/typeobj c PyBufferProcs bf_releasebuffer15753319 +Ref: 75e15753319 +Node: Async Object Structures15754459 +Ref: c-api/typeobj async-object-structures15754601 +Ref: 4ec315754601 +Ref: c-api/typeobj async-structs15754601 +Ref: 4ead15754601 +Ref: c-api/typeobj c PyAsyncMethods15754693 +Ref: 4c0615754693 +Ref: c-api/typeobj c PyAsyncMethods am_await15755110 +Ref: 4e7815755110 +Ref: c-api/typeobj c PyAsyncMethods am_aiter15755488 +Ref: 4e7915755488 +Ref: c-api/typeobj c PyAsyncMethods am_anext15755872 +Ref: 4e7a15755872 +Ref: c-api/typeobj c PyAsyncMethods am_send15756170 +Ref: 4e7b15756170 +Node: Slot Type typedefs15756486 +Ref: c-api/typeobj id615756616 +Ref: 4ea815756616 +Ref: c-api/typeobj slot-type-typedefs15756616 +Ref: 4ec415756616 +Ref: c-api/typeobj c allocfunc15756675 +Ref: 4aec15756675 +Ref: c-api/typeobj c destructor15757746 +Ref: 4af015757746 +Ref: c-api/typeobj c freefunc15757852 +Ref: 4d1515757852 +Ref: c-api/typeobj c newfunc15757928 +Ref: 4afb15757928 +Ref: c-api/typeobj c initproc15758132 +Ref: 4af715758132 +Ref: c-api/typeobj c reprfunc15758316 +Ref: 4aff15758316 +Ref: c-api/typeobj c getattrfunc15758473 +Ref: 4af115758473 +Ref: c-api/typeobj c setattrfunc15758686 +Ref: 4b0115758686 +Ref: c-api/typeobj c getattrofunc15758978 +Ref: 4af215758978 +Ref: c-api/typeobj c setattrofunc15759243 +Ref: 4b0215759243 +Ref: c-api/typeobj c descrgetfunc15759587 +Ref: 4aee15759587 +Ref: c-api/typeobj c descrsetfunc15759804 +Ref: 4aef15759804 +Ref: c-api/typeobj c hashfunc15760003 +Ref: 4af615760003 +Ref: c-api/typeobj c richcmpfunc15760161 +Ref: 4b0015760161 +Ref: c-api/typeobj c getiterfunc15760361 +Ref: 4af415760361 +Ref: c-api/typeobj c iternextfunc15760521 +Ref: 4af915760521 +Ref: c-api/typeobj c lenfunc15760686 +Ref: 4afa15760686 +Ref: c-api/typeobj c getbufferproc15760817 +Ref: 4af315760817 +Ref: c-api/typeobj c releasebufferproc15760984 +Ref: 4afe15760984 +Ref: c-api/typeobj c unaryfunc15761151 +Ref: 4b0815761151 +Ref: c-api/typeobj c binaryfunc15761283 +Ref: 4aed15761283 +Ref: c-api/typeobj c sendfunc15761439 +Ref: 4e7c15761439 +Ref: c-api/typeobj c ternaryfunc15761619 +Ref: 4b0615761619 +Ref: c-api/typeobj c ssizeargfunc15761799 +Ref: 4b0415761799 +Ref: c-api/typeobj c ssizeobjargproc15761958 +Ref: 4b0515761958 +Ref: c-api/typeobj c objobjproc15762124 +Ref: 4afd15762124 +Ref: c-api/typeobj c objobjargproc15762262 +Ref: 4afc15762262 +Node: Examples<38>15762426 +Ref: c-api/typeobj examples15762524 +Ref: 4ec515762524 +Ref: c-api/typeobj typedef-examples15762524 +Ref: 4e6915762524 +Node: Supporting Cyclic Garbage Collection15767899 +Ref: c-api/gcsupport doc15768032 +Ref: 4ec615768032 +Ref: c-api/gcsupport supporting-cycle-detection15768032 +Ref: 4eb115768032 +Ref: c-api/gcsupport supporting-cyclic-garbage-collection15768032 +Ref: 4ec715768032 +Ref: c-api/gcsupport c PyObject_GC_New15770390 +Ref: aa215770390 +Ref: c-api/gcsupport c PyObject_GC_NewVar15770561 +Ref: aa315770561 +Ref: c-api/gcsupport c PyUnstable_Object_GC_NewWithExtraData15770744 +Ref: 173815770744 +Ref: c-api/gcsupport c PyObject_GC_Resize15771743 +Ref: 173d15771743 +Ref: c-api/gcsupport c PyObject_GC_Track15772126 +Ref: 14d015772126 +Ref: c-api/gcsupport c PyObject_IS_GC15772564 +Ref: 98415772564 +Ref: c-api/gcsupport c PyObject_GC_IsTracked15772815 +Ref: 97615772815 +Ref: c-api/gcsupport c PyObject_GC_IsFinalized15773197 +Ref: 97715773197 +Ref: c-api/gcsupport c PyObject_GC_Del15773582 +Ref: 14cf15773582 +Ref: c-api/gcsupport c PyObject_GC_UnTrack15773792 +Ref: 14d115773792 +Ref: c-api/gcsupport c visitproc15774512 +Ref: 4b0915774512 +Ref: c-api/gcsupport c traverseproc15775127 +Ref: 4b0715775127 +Ref: c-api/gcsupport c Py_VISIT15775938 +Ref: 48f215775938 +Ref: c-api/gcsupport c inquiry15776534 +Ref: 4af815776534 +Node: Controlling the Garbage Collector State15777157 +Ref: c-api/gcsupport controlling-the-garbage-collector-state15777310 +Ref: 4ec815777310 +Ref: c-api/gcsupport c PyGC_Collect15777494 +Ref: 98e15777494 +Ref: c-api/gcsupport c PyGC_Enable15778061 +Ref: 8a215778061 +Ref: c-api/gcsupport c PyGC_Disable15778333 +Ref: 8a315778333 +Ref: c-api/gcsupport c PyGC_IsEnabled15778607 +Ref: 8a415778607 +Node: Querying Garbage Collector State15778901 +Ref: c-api/gcsupport querying-garbage-collector-state15779054 +Ref: 4ec915779054 +Ref: c-api/gcsupport c PyUnstable_GC_VisitObjects15779237 +Ref: 4eca15779237 +Ref: c-api/gcsupport c gcvisitobjects_t15780010 +Ref: 4ecb15780010 +Node: API and ABI Versioning15780497 +Ref: c-api/apiabiversion doc15780648 +Ref: 4ecc15780648 +Ref: c-api/apiabiversion api-and-abi-versioning15780648 +Ref: 4ecd15780648 +Ref: c-api/apiabiversion apiabiversion15780648 +Ref: 439f15780648 +Ref: c-api/apiabiversion c PY_MAJOR_VERSION15780971 +Ref: 4ece15780971 +Ref: c-api/apiabiversion c PY_MINOR_VERSION15781038 +Ref: 4ecf15781038 +Ref: c-api/apiabiversion c PY_MICRO_VERSION15781105 +Ref: 4ed015781105 +Ref: c-api/apiabiversion c PY_RELEASE_LEVEL15781172 +Ref: 4ed115781172 +Ref: c-api/apiabiversion c PY_RELEASE_SERIAL15781354 +Ref: 4ed215781354 +Ref: c-api/apiabiversion c PY_VERSION_HEX15781448 +Ref: 75215781448 +Ref: c-api/apiabiversion c Py_Version15783367 +Ref: 75115783367 +Ref: API and ABI Versioning-Footnote-115783807 +Node: Monitoring C API15783880 +Ref: c-api/monitoring doc15784029 +Ref: 4ed315784029 +Ref: c-api/monitoring c-api-monitoring15784029 +Ref: 15c15784029 +Ref: c-api/monitoring monitoring-c-api15784029 +Ref: 4ed415784029 +Node: Generating Execution Events15784283 +Ref: c-api/monitoring generating-execution-events15784401 +Ref: 4ed515784401 +Ref: c-api/monitoring c PyMonitoringState15785336 +Ref: 31215785336 +Ref: c-api/monitoring c PyMonitoring_FirePyStartEvent15785698 +Ref: 31315785698 +Ref: c-api/monitoring c PyMonitoring_FirePyResumeEvent15785857 +Ref: 31415785857 +Ref: c-api/monitoring c PyMonitoring_FirePyReturnEvent15786018 +Ref: 31515786018 +Ref: c-api/monitoring c PyMonitoring_FirePyYieldEvent15786197 +Ref: 31615786197 +Ref: c-api/monitoring c PyMonitoring_FireCallEvent15786374 +Ref: 31715786374 +Ref: c-api/monitoring c PyMonitoring_FireLineEvent15786572 +Ref: 31815786572 +Ref: c-api/monitoring c PyMonitoring_FireJumpEvent15786736 +Ref: 31915786736 +Ref: c-api/monitoring c PyMonitoring_FireBranchEvent15786923 +Ref: 31a15786923 +Ref: c-api/monitoring c PyMonitoring_FireCReturnEvent15787114 +Ref: 31b15787114 +Ref: c-api/monitoring c PyMonitoring_FirePyThrowEvent15787291 +Ref: 31c15787291 +Ref: c-api/monitoring c PyMonitoring_FireRaiseEvent15787538 +Ref: 31d15787538 +Ref: c-api/monitoring c PyMonitoring_FireCRaiseEvent15787780 +Ref: 31e15787780 +Ref: c-api/monitoring c PyMonitoring_FireReraiseEvent15788025 +Ref: 31f15788025 +Ref: c-api/monitoring c PyMonitoring_FireExceptionHandledEvent15788271 +Ref: 32015788271 +Ref: c-api/monitoring c PyMonitoring_FirePyUnwindEvent15788537 +Ref: 32115788537 +Ref: c-api/monitoring c PyMonitoring_FireStopIterationEvent15788786 +Ref: 32215788786 +Node: Managing the Monitoring State15789213 +Ref: c-api/monitoring managing-the-monitoring-state15789306 +Ref: 4ed615789306 +Ref: c-api/monitoring c PyMonitoring_EnterScope15789509 +Ref: 32315789509 +Ref: c-api/monitoring c PY_MONITORING_EVENT_BRANCH15791560 +Ref: 4ed715791560 +Ref: c-api/monitoring c PY_MONITORING_EVENT_CALL15791760 +Ref: 4ed815791760 +Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RAISE15791963 +Ref: 4ed915791963 +Ref: c-api/monitoring c PY_MONITORING_EVENT_C_RETURN15792167 +Ref: 4eda15792167 +Ref: c-api/monitoring c PY_MONITORING_EVENT_EXCEPTION_HANDLED15792380 +Ref: 4edb15792380 +Ref: c-api/monitoring c PY_MONITORING_EVENT_INSTRUCTION15792587 +Ref: 4edc15792587 +Ref: c-api/monitoring c PY_MONITORING_EVENT_JUMP15792787 +Ref: 4edd15792787 +Ref: c-api/monitoring c PY_MONITORING_EVENT_LINE15792987 +Ref: 4ede15792987 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RESUME15793192 +Ref: 4edf15793192 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_RETURN15793397 +Ref: 4ee015793397 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_START15793601 +Ref: 4ee115793601 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_THROW15793805 +Ref: 4ee215793805 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_UNWIND15794010 +Ref: 4ee315794010 +Ref: c-api/monitoring c PY_MONITORING_EVENT_PY_YIELD15794214 +Ref: 4ee415794214 +Ref: c-api/monitoring c PY_MONITORING_EVENT_RAISE15794415 +Ref: 4ee515794415 +Ref: c-api/monitoring c PY_MONITORING_EVENT_RERAISE15794618 +Ref: 4ee615794618 +Ref: c-api/monitoring c PY_MONITORING_EVENT_STOP_ITERATION15794828 +Ref: 4ee715794828 +Ref: c-api/monitoring c PyMonitoring_ExitScope15794926 +Ref: 32415794926 +Ref: c-api/monitoring c PY_MONITORING_IS_INSTRUMENTED_EVENT15795063 +Ref: 4ee815795063 +Node: Installing Python Modules15795352 +Ref: installing/index doc15795477 +Ref: 4ee915795477 +Ref: installing/index installing-index15795477 +Ref: ef015795477 +Ref: installing/index installing-python-modules15795477 +Ref: 4eea15795477 +Ref: Installing Python Modules-Footnote-115796639 +Node: Key terms15796717 +Ref: installing/index key-terms15796808 +Ref: 4eeb15796808 +Ref: Key terms-Footnote-115798905 +Ref: Key terms-Footnote-215798930 +Ref: Key terms-Footnote-315798959 +Ref: Key terms-Footnote-415798991 +Node: Basic usage15799071 +Ref: installing/index basic-usage15799184 +Ref: 4eec15799184 +Ref: Basic usage-Footnote-115800835 +Ref: Basic usage-Footnote-215800872 +Node: How do I …?15800921 +Ref: installing/index how-do-i15801051 +Ref: 4eed15801051 +Node: … install pip in versions of Python prior to Python 3 4?15801440 +Ref: installing/index install-pip-in-versions-of-python-prior-to-python-3-415801604 +Ref: 4eee15801604 +Ref: … install pip in versions of Python prior to Python 3 4?-Footnote-115802036 +Node: … install packages just for the current user?15802123 +Ref: installing/index install-packages-just-for-the-current-user15802335 +Ref: 4eef15802335 +Node: … install scientific Python packages?15802597 +Ref: installing/index install-scientific-python-packages15802815 +Ref: 4ef015802815 +Ref: … install scientific Python packages?-Footnote-115803321 +Ref: … install scientific Python packages?-Footnote-215803367 +Node: … work with multiple versions of Python installed in parallel?15803413 +Ref: installing/index work-with-multiple-versions-of-python-installed-in-parallel15803575 +Ref: 4ef115803575 +Node: Common installation issues15804547 +Ref: installing/index common-installation-issues15804657 +Ref: 4ef215804657 +Node: Installing into the system Python on Linux15804832 +Ref: installing/index installing-into-the-system-python-on-linux15804963 +Ref: 4ef315804963 +Node: Pip not installed15805530 +Ref: installing/index pip-not-installed15805698 +Ref: 4ef415805698 +Ref: Pip not installed-Footnote-115805972 +Node: Installing binary extensions15806098 +Ref: installing/index installing-binary-extensions15806215 +Ref: 4ef515806215 +Ref: Installing binary extensions-Footnote-115807105 +Ref: Installing binary extensions-Footnote-215807151 +Node: Python HOWTOs15807200 +Ref: howto/index doc15807329 +Ref: 4ef615807329 +Ref: howto/index how-tos15807329 +Ref: 4ef715807329 +Ref: howto/index python-howtos15807329 +Ref: 4ef815807329 +Node: A Conceptual Overview of asyncio15808476 +Ref: howto/a-conceptual-overview-of-asyncio doc15808604 +Ref: 4ef915808604 +Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-of-asyncio15808604 +Ref: 327915808604 +Ref: howto/a-conceptual-overview-of-asyncio id115808604 +Ref: 4efa15808604 +Ref: A Conceptual Overview of asyncio-Footnote-115809981 +Ref: A Conceptual Overview of asyncio-Footnote-215810062 +Ref: A Conceptual Overview of asyncio-Footnote-315810155 +Node: A conceptual overview part 1 the high-level15810236 +Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-1-the-high-level15810404 +Ref: 4efb15810404 +Node: Event Loop<2>15810777 +Ref: howto/a-conceptual-overview-of-asyncio event-loop15810916 +Ref: 4efc15810916 +Node: Asynchronous functions and coroutines15812525 +Ref: howto/a-conceptual-overview-of-asyncio asynchronous-functions-and-coroutines15812681 +Ref: 4efd15812681 +Node: Tasks<2>15815621 +Ref: howto/a-conceptual-overview-of-asyncio tasks15815769 +Ref: 4efe15815769 +Node: await15818559 +Ref: howto/a-conceptual-overview-of-asyncio await15818661 +Ref: 4eff15818661 +Node: A conceptual overview part 2 the nuts and bolts15822840 +Ref: howto/a-conceptual-overview-of-asyncio a-conceptual-overview-part-2-the-nuts-and-bolts15823008 +Ref: 4f0015823008 +Node: The inner workings of coroutines15823498 +Ref: howto/a-conceptual-overview-of-asyncio the-inner-workings-of-coroutines15823633 +Ref: 4f0115823633 +Node: Futures<2>15827298 +Ref: howto/a-conceptual-overview-of-asyncio futures15827466 +Ref: 4f0215827466 +Node: A homemade asyncio sleep15828740 +Ref: howto/a-conceptual-overview-of-asyncio a-homemade-asyncio-sleep15828867 +Ref: 4f0315828867 +Node: Porting Extension Modules to Python 315833502 +Ref: howto/cporting doc15833669 +Ref: 4f0415833669 +Ref: howto/cporting cporting-howto15833669 +Ref: 12d415833669 +Ref: howto/cporting porting-extension-modules-to-python-315833669 +Ref: 4f0515833669 +Ref: Porting Extension Modules to Python 3-Footnote-115834460 +Ref: Porting Extension Modules to Python 3-Footnote-215834511 +Node: Curses Programming with Python15834568 +Ref: howto/curses doc15834719 +Ref: 4f0615834719 +Ref: howto/curses curses-howto15834719 +Ref: 2f6115834719 +Ref: howto/curses curses-programming-with-python15834719 +Ref: 4f0715834719 +Node: What is curses?15835128 +Ref: howto/curses what-is-curses15835259 +Ref: 4f0815835259 +Ref: What is curses?-Footnote-115837615 +Ref: What is curses?-Footnote-215837655 +Node: The Python curses module15837699 +Ref: howto/curses the-python-curses-module15837775 +Ref: 4f0915837775 +Node: Starting and ending a curses application15838602 +Ref: howto/curses starting-and-ending-a-curses-application15838758 +Ref: 4f0a15838758 +Node: Windows and Pads15842034 +Ref: howto/curses windows-and-pads15842190 +Ref: 4f0b15842190 +Node: Displaying Text15846748 +Ref: howto/curses displaying-text15846874 +Ref: 4f0c15846874 +Node: Attributes and Color15850670 +Ref: howto/curses attributes-and-color15850742 +Ref: 4f0d15850742 +Node: User Input15855301 +Ref: howto/curses user-input15855431 +Ref: 4f0e15855431 +Ref: User Input-Footnote-115859251 +Node: For More Information15859291 +Ref: howto/curses for-more-information15859397 +Ref: 4f0f15859397 +Ref: For More Information-Footnote-115860897 +Ref: For More Information-Footnote-215860934 +Ref: For More Information-Footnote-315860998 +Ref: For More Information-Footnote-415861042 +Ref: For More Information-Footnote-515861104 +Ref: For More Information-Footnote-615861156 +Node: Descriptor Guide15861227 +Ref: howto/descriptor doc15861398 +Ref: 4f1015861398 +Ref: howto/descriptor descriptor-guide15861398 +Ref: 4f1115861398 +Ref: howto/descriptor descriptorhowto15861398 +Ref: 14b715861398 +Node: Primer15862552 +Ref: howto/descriptor primer15862646 +Ref: 4f1215862646 +Node: Simple example A descriptor that returns a constant15862990 +Ref: howto/descriptor simple-example-a-descriptor-that-returns-a-constant15863108 +Ref: 4f1315863108 +Node: Dynamic lookups15864577 +Ref: howto/descriptor dynamic-lookups15864722 +Ref: 4f1415864722 +Node: Managed attributes15866131 +Ref: howto/descriptor managed-attributes15866241 +Ref: 4f1515866241 +Node: Customized names15868896 +Ref: howto/descriptor customized-names15869007 +Ref: 4f1615869007 +Node: Closing thoughts15871352 +Ref: howto/descriptor closing-thoughts15871436 +Ref: 4f1715871436 +Node: Complete Practical Example15872826 +Ref: howto/descriptor complete-practical-example15872947 +Ref: 4f1815872947 +Node: Validator class15873210 +Ref: howto/descriptor validator-class15873314 +Ref: 4f1915873314 +Node: Custom validators15874340 +Ref: howto/descriptor custom-validators15874474 +Ref: 4f1a15874474 +Ref: Custom validators-Footnote-115877105 +Node: Practical application15877174 +Ref: howto/descriptor practical-application15877284 +Ref: 4f1b15877284 +Node: Technical Tutorial15878672 +Ref: howto/descriptor technical-tutorial15878810 +Ref: 4f1c15878810 +Node: Abstract15879242 +Ref: howto/descriptor abstract15879341 +Ref: 4f1d15879341 +Node: Definition and introduction15879656 +Ref: howto/descriptor definition-and-introduction15879783 +Ref: 4f1e15879783 +Node: Descriptor protocol15881023 +Ref: howto/descriptor descriptor-protocol15881175 +Ref: 4f1f15881175 +Node: Overview of descriptor invocation15882459 +Ref: howto/descriptor overview-of-descriptor-invocation15882611 +Ref: 4f2015882611 +Node: Invocation from an instance15883258 +Ref: howto/descriptor invocation-from-an-instance15883414 +Ref: 4f2115883414 +Node: Invocation from a class15885931 +Ref: howto/descriptor invocation-from-a-class15886075 +Ref: 4f2215886075 +Ref: Invocation from a class-Footnote-115886643 +Node: Invocation from super15886716 +Ref: howto/descriptor invocation-from-super15886860 +Ref: 4f2315886860 +Ref: Invocation from super-Footnote-115887494 +Ref: Invocation from super-Footnote-215887567 +Node: Summary of invocation logic15887647 +Ref: howto/descriptor summary-of-invocation-logic15887795 +Ref: 4f2415887795 +Node: Automatic name notification15888799 +Ref: howto/descriptor automatic-name-notification15888937 +Ref: 4f2515888937 +Ref: Automatic name notification-Footnote-115889821 +Node: ORM example15889894 +Ref: howto/descriptor orm-example15889996 +Ref: 4f2615889996 +Ref: ORM example-Footnote-115892009 +Ref: ORM example-Footnote-215892081 +Node: Pure Python Equivalents15892134 +Ref: howto/descriptor pure-python-equivalents15892237 +Ref: 4f2715892237 +Node: Properties15892710 +Ref: howto/descriptor properties15892810 +Ref: 4f2815892810 +Node: Functions and methods15895647 +Ref: howto/descriptor functions-and-methods15895772 +Ref: 4f2915895772 +Node: Kinds of methods15899044 +Ref: howto/descriptor kinds-of-methods15899173 +Ref: 4f2a15899173 +Node: Static methods15900415 +Ref: howto/descriptor static-methods15900536 +Ref: 4f2b15900536 +Node: Class methods15902645 +Ref: howto/descriptor class-methods15902778 +Ref: 4f2c15902778 +Node: Member objects and __slots__15904835 +Ref: howto/descriptor member-objects-and-slots15904945 +Ref: 4f2d15904945 +Ref: Member objects and __slots__-Footnote-115912568 +Node: Debugging C API extensions and CPython Internals with GDB15912624 +Ref: howto/gdb_helpers doc15912775 +Ref: 4f2e15912775 +Ref: howto/gdb_helpers debugging-c-api-extensions-and-cpython-internals-with-gdb15912775 +Ref: 4f2f15912775 +Ref: howto/gdb_helpers gdb15912775 +Ref: 4f3015912775 +Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-115914177 +Ref: Debugging C API extensions and CPython Internals with GDB-Footnote-215914213 +Node: Prerequisites15914267 +Ref: howto/gdb_helpers prerequisites15914425 +Ref: 4f3115914425 +Node: Setup with Python built from source15915066 +Ref: howto/gdb_helpers setup-with-python-built-from-source15915196 +Ref: 4f3215915196 +Node: Setup for Python from a Linux distro15915969 +Ref: howto/gdb_helpers setup-for-python-from-a-linux-distro15916099 +Ref: 4f3315916099 +Node: Using the Debug build and Development mode15916747 +Ref: howto/gdb_helpers using-the-debug-build-and-development-mode15916944 +Ref: 4f3415916944 +Node: Using the python-gdb extension15917548 +Ref: howto/gdb_helpers using-the-python-gdb-extension15917753 +Ref: 4f3515917753 +Node: Pretty-printers15918059 +Ref: howto/gdb_helpers pretty-printers15918157 +Ref: 4f3615918157 +Node: py-list15922688 +Ref: howto/gdb_helpers py-list15922812 +Ref: 4f3715922812 +Node: py-up and py-down15923704 +Ref: howto/gdb_helpers py-up-and-py-down15923818 +Ref: 4f3815923818 +Node: py-bt15928543 +Ref: howto/gdb_helpers py-bt15928658 +Ref: 4f3915928658 +Node: py-print15930913 +Ref: howto/gdb_helpers py-print15931020 +Ref: 4f3a15931020 +Node: py-locals15931769 +Ref: howto/gdb_helpers py-locals15931862 +Ref: 4f3b15931862 +Node: Use with GDB commands15932765 +Ref: howto/gdb_helpers use-with-gdb-commands15932919 +Ref: 4f3c15932919 +Node: Enum HOWTO15938940 +Ref: howto/enum doc15939103 +Ref: 4f3d15939103 +Ref: howto/enum enum-howto15939103 +Ref: 4f3e15939103 +Ref: howto/enum id115939103 +Ref: 4f3f15939103 +Ref: howto/enum enum-basic-tutorial15939134 +Ref: 25b515939134 +Node: Programmatic access to enumeration members and their attributes15945083 +Ref: howto/enum enum-advanced-tutorial15945237 +Ref: 25b615945237 +Ref: howto/enum programmatic-access-to-enumeration-members-and-their-attributes15945237 +Ref: 4f4015945237 +Node: Duplicating enum members and values15945989 +Ref: howto/enum duplicating-enum-members-and-values15946186 +Ref: 4f4115946186 +Node: Ensuring unique enumeration values15947414 +Ref: howto/enum ensuring-unique-enumeration-values15947570 +Ref: 4f4215947570 +Node: Using automatic values15948124 +Ref: howto/enum using-automatic-values15948257 +Ref: 4f4315948257 +Node: Iteration<2>15949194 +Ref: howto/enum iteration15949307 +Ref: 4f4415949307 +Node: Comparisons<3>15950569 +Ref: howto/enum comparisons15950706 +Ref: 4f4515950706 +Node: Allowed members and attributes of enumerations15951824 +Ref: howto/enum allowed-members-and-attributes-of-enumerations15951976 +Ref: 4f4715951976 +Node: Restricted Enum subclassing15954124 +Ref: howto/enum restricted-enum-subclassing15954279 +Ref: 4f4b15954279 +Node: Dataclass support15955393 +Ref: howto/enum dataclass-support15955510 +Ref: 4f4d15955510 +Ref: howto/enum enum-dataclass-support15955510 +Ref: 178315955510 +Node: Pickling15956880 +Ref: howto/enum pickling15956987 +Ref: 4f4e15956987 +Node: Functional API<3>15957926 +Ref: howto/enum functional-api15958036 +Ref: 4f4815958036 +Node: Derived Enumerations15961427 +Ref: howto/enum derived-enumerations15961560 +Ref: 4f4f15961560 +Node: IntEnum15961693 +Ref: howto/enum intenum15961773 +Ref: 4f4615961773 +Node: StrEnum15962898 +Ref: howto/enum strenum15962994 +Ref: 4f5015962994 +Node: IntFlag15963301 +Ref: howto/enum intflag15963394 +Ref: 4f5115963394 +Node: Flag15965762 +Ref: howto/enum flag15965857 +Ref: 4f5215965857 +Node: Others<2>15968154 +Ref: howto/enum others15968233 +Ref: 4f5315968233 +Node: When to use __new__ vs __init__15970274 +Ref: howto/enum new-vs-init15970424 +Ref: 4f4a15970424 +Ref: howto/enum when-to-use-new-vs-init15970424 +Ref: 4f5415970424 +Node: Finer Points15971723 +Ref: howto/enum finer-points15971803 +Ref: 4f5515971803 +Node: Supported __dunder__ names<2>15972210 +Ref: howto/enum supported-dunder-names15972324 +Ref: 4f5615972324 +Node: Supported _sunder_ names<2>15972759 +Ref: howto/enum supported-sunder-names15972897 +Ref: 4f5715972897 +Node: _Private__names15974970 +Ref: howto/enum private-names15975095 +Ref: 4f5915975095 +Node: Enum member type15975265 +Ref: howto/enum enum-member-type15975416 +Ref: 4f5a15975416 +Node: Creating members that are mixed with other data types15975899 +Ref: howto/enum creating-members-that-are-mixed-with-other-data-types15976076 +Ref: 4f5b15976076 +Node: Boolean value of Enum classes and members15976611 +Ref: howto/enum boolean-value-of-enum-classes-and-members15976797 +Ref: 4f5c15976797 +Node: Enum classes with methods15977362 +Ref: howto/enum enum-classes-with-methods15977520 +Ref: 4f5d15977520 +Node: Combining members of Flag15978060 +Ref: howto/enum combining-members-of-flag15978201 +Ref: 4f5e15978201 +Node: Flag and IntFlag minutia15978763 +Ref: howto/enum flag-and-intflag-minutia15978870 +Ref: 4f5f15978870 +Node: How are Enums and Flags different?15981406 +Ref: howto/enum enum-class-differences15981549 +Ref: 25b815981549 +Ref: howto/enum how-are-enums-and-flags-different15981549 +Ref: 4f6015981549 +Node: Enum Classes15981884 +Ref: howto/enum enum-classes15981988 +Ref: 4f6115981988 +Node: Flag Classes15982580 +Ref: howto/enum flag-classes15982719 +Ref: 4f6215982719 +Node: Enum Members aka instances15983085 +Ref: howto/enum enum-members-aka-instances15983224 +Ref: 4f6315983224 +Node: Flag Members15983612 +Ref: howto/enum flag-members15983730 +Ref: 4f6415983730 +Node: Enum Cookbook15984365 +Ref: howto/enum enum-cookbook15984497 +Ref: 25b715984497 +Ref: howto/enum id215984497 +Ref: 4f6515984497 +Node: Omitting values15984963 +Ref: howto/enum omitting-values15985048 +Ref: 4f6615985048 +Node: Using auto15985842 +Ref: howto/enum using-auto15985925 +Ref: 4f6715985925 +Node: Using object15986177 +Ref: howto/enum using-object15986295 +Ref: 4f6815986295 +Node: Using a descriptive string15986948 +Ref: howto/enum using-a-descriptive-string15987078 +Ref: 4f6915987078 +Node: Using a custom __new__15987365 +Ref: howto/enum using-a-custom-new15987474 +Ref: 4f6a15987474 +Node: OrderedEnum15989348 +Ref: howto/enum orderedenum15989459 +Ref: 4f4c15989459 +Node: DuplicateFreeEnum15990639 +Ref: howto/enum duplicatefreeenum15990749 +Ref: 4f6b15990749 +Node: MultiValueEnum15991829 +Ref: howto/enum multivalueenum15991934 +Ref: 4f5815991934 +Node: Planet15992517 +Ref: howto/enum planet15992615 +Ref: 4f4915992615 +Node: TimePeriod15993676 +Ref: howto/enum enum-time-period15993751 +Ref: 25ce15993751 +Ref: howto/enum timeperiod15993751 +Ref: 4f6c15993751 +Node: Subclassing EnumType15994373 +Ref: howto/enum enumtype-examples15994462 +Ref: 25be15994462 +Ref: howto/enum subclassing-enumtype15994462 +Ref: 4f6d15994462 +Node: Functional Programming HOWTO15994726 +Ref: howto/functional doc15994845 +Ref: 4f6e15994845 +Ref: howto/functional functional-howto15994845 +Ref: 4f6f15994845 +Ref: howto/functional functional-programming-howto15994845 +Ref: 4f7015994845 +Node: Introduction<14>15995676 +Ref: howto/functional introduction15995778 +Ref: 4f7115995778 +Node: Formal provability16000476 +Ref: howto/functional formal-provability16000566 +Ref: 4f7316000566 +Node: Modularity16002480 +Ref: howto/functional modularity16002608 +Ref: 4f7416002608 +Node: Ease of debugging and testing16003013 +Ref: howto/functional ease-of-debugging-and-testing16003136 +Ref: 4f7516003136 +Node: Composability16003871 +Ref: howto/functional composability16003975 +Ref: 4f7616003975 +Node: Iterators<2>16004698 +Ref: howto/functional functional-howto-iterators16004854 +Ref: 4f7216004854 +Ref: howto/functional iterators16004854 +Ref: 4f7716004854 +Node: Data Types That Support Iterators16008219 +Ref: howto/functional data-types-that-support-iterators16008301 +Ref: 4f7816008301 +Node: Generator expressions and list comprehensions16010265 +Ref: howto/functional generator-expressions-and-list-comprehensions16010418 +Ref: 4f7916010418 +Node: Generators<2>16014975 +Ref: howto/functional generators16015137 +Ref: 4f7a16015137 +Ref: Generators<2>-Footnote-116018996 +Node: Passing values into a generator16019077 +Ref: howto/functional passing-values-into-a-generator16019158 +Ref: 4f7b16019158 +Ref: Passing values into a generator-Footnote-116023122 +Node: Built-in functions<2>16023164 +Ref: howto/functional built-in-functions16023301 +Ref: 4f7c16023301 +Ref: Built-in functions<2>-Footnote-116027347 +Node: The itertools module16027401 +Ref: howto/functional the-itertools-module16027545 +Ref: 4f7d16027545 +Node: Creating new iterators16028288 +Ref: howto/functional creating-new-iterators16028405 +Ref: 4f7e16028405 +Node: Calling functions on elements16031089 +Ref: howto/functional calling-functions-on-elements16031233 +Ref: 4f7f16031233 +Node: Selecting elements16032045 +Ref: howto/functional selecting-elements16032189 +Ref: 4f8016032189 +Node: Combinatoric functions16033680 +Ref: howto/functional combinatoric-functions16033812 +Ref: 4f8116033812 +Node: Grouping elements16036145 +Ref: howto/functional grouping-elements16036250 +Ref: 4f8216036250 +Node: The functools module16037800 +Ref: howto/functional the-functools-module16037964 +Ref: 4f8316037964 +Node: The operator module16041575 +Ref: howto/functional the-operator-module16041651 +Ref: 4f8416041651 +Node: Small functions and the lambda expression16042463 +Ref: howto/functional small-functions-and-the-lambda-expression16042644 +Ref: 4f8516042644 +Node: Revision History and Acknowledgements16045503 +Ref: howto/functional revision-history-and-acknowledgements16045677 +Ref: 4f8616045677 +Node: References<2>16046454 +Ref: howto/functional references16046578 +Ref: 4f8716046578 +Node: General16046682 +Ref: howto/functional general16046763 +Ref: 4f8816046763 +Node: Python-specific16047824 +Ref: howto/functional python-specific16047934 +Ref: 4f8916047934 +Ref: Python-specific-Footnote-116048408 +Ref: Python-specific-Footnote-216048459 +Ref: Python-specific-Footnote-316048512 +Node: Python documentation16048565 +Ref: howto/functional python-documentation16048659 +Ref: 4f8a16048659 +Ref: Python documentation-Footnote-116049058 +Ref: Python documentation-Footnote-216049100 +Node: Logging HOWTO16049142 +Ref: howto/logging doc16049267 +Ref: 4f8b16049267 +Ref: howto/logging id116049267 +Ref: 4f8c16049267 +Ref: howto/logging logging-howto16049267 +Ref: 4f8d16049267 +Ref: howto/logging logging-basic-tutorial16049360 +Ref: 11e716049360 +Node: Basic Logging Tutorial16049740 +Ref: howto/logging basic-logging-tutorial16049846 +Ref: 4f8f16049846 +Node: When to use logging16050596 +Ref: howto/logging when-to-use-logging16050699 +Ref: 4f9016050699 +Node: A simple example16054701 +Ref: howto/logging a-simple-example16054830 +Ref: 4f9116054830 +Ref: howto/logging howto-minimal-example16054830 +Ref: 4f9216054830 +Node: Logging to a file16056071 +Ref: howto/logging logging-to-a-file16056202 +Ref: 4f9316056202 +Node: Logging variable data16059268 +Ref: howto/logging logging-variable-data16059424 +Ref: 4f9416059424 +Node: Changing the format of displayed messages16060241 +Ref: howto/logging changing-the-format-of-displayed-messages16060416 +Ref: 4f9516060416 +Node: Displaying the date/time in messages16061410 +Ref: howto/logging displaying-the-date-time-in-messages16061574 +Ref: 4f9616061574 +Ref: Displaying the date/time in messages-Footnote-116062625 +Node: Next Steps16062684 +Ref: howto/logging next-steps16062798 +Ref: 4f9716062798 +Ref: Next Steps-Footnote-116063731 +Node: Advanced Logging Tutorial16063775 +Ref: howto/logging advanced-logging-tutorial16063907 +Ref: 4f9816063907 +Ref: howto/logging logging-advanced-tutorial16063907 +Ref: 11e816063907 +Node: Logging Flow16067294 +Ref: howto/logging logging-flow16067384 +Ref: 4f9916067384 +Node: Loggers16067579 +Ref: howto/logging loggers16067686 +Ref: 4f9a16067686 +Node: Handlers16071963 +Ref: howto/logging handler-basic16072068 +Ref: 4f9b16072068 +Ref: howto/logging handlers16072068 +Ref: 4f9c16072068 +Node: Formatters16074143 +Ref: howto/logging formatters16074260 +Ref: 4f9e16074260 +Ref: howto/logging logging logging Formatter __init__16074708 +Ref: 4f9f16074708 +Node: Configuring Logging16076417 +Ref: howto/logging configuring-logging16076570 +Ref: 4fa016076570 +Node: What happens if no configuration is provided16083122 +Ref: howto/logging what-happens-if-no-configuration-is-provided16083298 +Ref: 4fa116083298 +Node: Configuring Logging for a Library16084559 +Ref: howto/logging configuring-logging-for-a-library16084707 +Ref: 4fa216084707 +Ref: howto/logging library-config16084707 +Ref: 2ce816084707 +Node: Logging Levels<2>16087576 +Ref: howto/logging logging-levels16087701 +Ref: 4fa316087701 +Node: Custom Levels16090560 +Ref: howto/logging custom-levels16090627 +Ref: 2cb116090627 +Ref: howto/logging id216090627 +Ref: 4fa416090627 +Node: Useful Handlers16091340 +Ref: howto/logging id316091472 +Ref: 4fa516091472 +Ref: howto/logging useful-handlers16091472 +Ref: 4f9d16091472 +Node: Exceptions raised during logging16095498 +Ref: howto/logging exceptions-raised-during-logging16095648 +Ref: 4fa616095648 +Ref: howto/logging logging-exceptions16095648 +Ref: 4fa716095648 +Node: Using arbitrary objects as messages16096821 +Ref: howto/logging arbitrary-object-messages16096968 +Ref: 2c9d16096968 +Ref: howto/logging using-arbitrary-objects-as-messages16096968 +Ref: 4fa816096968 +Node: Optimization16097580 +Ref: howto/logging optimization16097710 +Ref: 4fa916097710 +Node: Other resources16101340 +Ref: howto/logging other-resources16101426 +Ref: 4faa16101426 +Ref: howto/logging tutorial-ref-links16101426 +Ref: 4f8e16101426 +Node: Logging Cookbook16101768 +Ref: howto/logging-cookbook doc16101889 +Ref: 4fab16101889 +Ref: howto/logging-cookbook id116101889 +Ref: 4fac16101889 +Ref: howto/logging-cookbook logging-cookbook16101889 +Ref: 11e916101889 +Node: Using logging in multiple modules16104032 +Ref: howto/logging-cookbook using-logging-in-multiple-modules16104156 +Ref: 4fae16104156 +Node: Logging from multiple threads16107728 +Ref: howto/logging-cookbook logging-from-multiple-threads16107893 +Ref: 4faf16107893 +Node: Multiple handlers and formatters16109638 +Ref: howto/logging-cookbook multiple-handlers-and-formatters16109802 +Ref: 4fb016109802 +Node: Logging to multiple destinations16111963 +Ref: howto/logging-cookbook logging-to-multiple-destinations16112123 +Ref: 4fb116112123 +Ref: howto/logging-cookbook multiple-destinations16112123 +Ref: 4fb216112123 +Node: Custom handling of levels16115292 +Ref: howto/logging-cookbook custom-handling-of-levels16115448 +Ref: 4fb316115448 +Ref: howto/logging-cookbook custom-level-handling16115448 +Ref: 4fb416115448 +Node: Configuration server example16121320 +Ref: howto/logging-cookbook configuration-server-example16121476 +Ref: 4fb516121476 +Node: Dealing with handlers that block16123036 +Ref: howto/logging-cookbook blocking-handlers16123220 +Ref: 33fb16123220 +Ref: howto/logging-cookbook dealing-with-handlers-that-block16123220 +Ref: 4fb616123220 +Node: Sending and receiving logging events across a network16127413 +Ref: howto/logging-cookbook network-logging16127621 +Ref: 4fb716127621 +Ref: howto/logging-cookbook sending-and-receiving-logging-events-across-a-network16127621 +Ref: 4fb816127621 +Node: Running a logging socket listener in production16133156 +Ref: howto/logging-cookbook running-a-logging-socket-listener-in-production16133293 +Ref: 4fb916133293 +Ref: Running a logging socket listener in production-Footnote-116137404 +Ref: Running a logging socket listener in production-Footnote-216137436 +Ref: Running a logging socket listener in production-Footnote-316137508 +Ref: Running a logging socket listener in production-Footnote-416137538 +Node: Adding contextual information to your logging output16137610 +Ref: howto/logging-cookbook adding-contextual-information-to-your-logging-output16137804 +Ref: 4fba16137804 +Ref: howto/logging-cookbook context-info16137804 +Ref: 2ca416137804 +Node: Using LoggerAdapters to impart contextual information16138903 +Ref: howto/logging-cookbook using-loggeradapters-to-impart-contextual-information16139100 +Ref: 4fbb16139100 +Node: Using objects other than dicts to pass contextual information16142377 +Ref: howto/logging-cookbook using-objects-other-than-dicts-to-pass-contextual-information16142528 +Ref: 4fbc16142528 +Node: Using Filters to impart contextual information16142992 +Ref: howto/logging-cookbook filters-contextual16143189 +Ref: 2c9916143189 +Ref: howto/logging-cookbook using-filters-to-impart-contextual-information16143189 +Ref: 4fbd16143189 +Node: Use of contextvars16147004 +Ref: howto/logging-cookbook use-of-contextvars16147189 +Ref: 4fbe16147189 +Node: Imparting contextual information in handlers16156767 +Ref: howto/logging-cookbook imparting-contextual-information-in-handlers16156948 +Ref: 4fbf16156948 +Node: Logging to a single file from multiple processes16157893 +Ref: howto/logging-cookbook logging-to-a-single-file-from-multiple-processes16158075 +Ref: 4fc016158075 +Ref: howto/logging-cookbook multiple-processes16158075 +Ref: 4fc116158075 +Node: Using concurrent futures ProcessPoolExecutor16168353 +Ref: howto/logging-cookbook using-concurrent-futures-processpoolexecutor16168542 +Ref: 4fc216168542 +Node: Deploying Web applications using Gunicorn and uWSGI16169548 +Ref: howto/logging-cookbook deploying-web-applications-using-gunicorn-and-uwsgi16169737 +Ref: 4fc316169737 +Ref: Deploying Web applications using Gunicorn and uWSGI-Footnote-116170397 +Ref: Deploying Web applications using Gunicorn and uWSGI-Footnote-216170427 +Node: Using file rotation16170480 +Ref: howto/logging-cookbook using-file-rotation16170654 +Ref: 4fc416170654 +Node: Use of alternative formatting styles16172557 +Ref: howto/logging-cookbook format-styles16172704 +Ref: 4fc516172704 +Ref: howto/logging-cookbook use-of-alternative-formatting-styles16172704 +Ref: 4fc616172704 +Node: Customizing LogRecord16179857 +Ref: howto/logging-cookbook custom-logrecord16180045 +Ref: 4fc716180045 +Ref: howto/logging-cookbook customizing-logrecord16180045 +Ref: 4fc816180045 +Node: Subclassing QueueHandler and QueueListener- a ZeroMQ example16183959 +Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-zeromq-example16184170 +Ref: 4fc916184170 +Ref: howto/logging-cookbook zeromq-handlers16184170 +Ref: 4fca16184170 +Node: Subclass QueueHandler16184370 +Ref: howto/logging-cookbook subclass-queuehandler16184519 +Ref: 4fcb16184519 +Node: Subclass QueueListener16185828 +Ref: howto/logging-cookbook subclass-queuelistener16185977 +Ref: 4fcc16185977 +Node: Subclassing QueueHandler and QueueListener- a pynng example16186722 +Ref: howto/logging-cookbook pynng-handlers16186953 +Ref: 4fcd16186953 +Ref: howto/logging-cookbook subclassing-queuehandler-and-queuelistener-a-pynng-example16186953 +Ref: 4fce16186953 +Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-116187579 +Ref: Subclassing QueueHandler and QueueListener- a pynng example-Footnote-216187619 +Node: Subclass QueueListener<2>16187652 +Ref: howto/logging-cookbook id316187806 +Ref: 4fcf16187806 +Node: Subclass QueueHandler<2>16189782 +Ref: howto/logging-cookbook id416189936 +Ref: 4fd016189936 +Node: An example dictionary-based configuration16193650 +Ref: howto/logging-cookbook an-example-dictionary-based-configuration16193883 +Ref: 4fd116193883 +Ref: An example dictionary-based configuration-Footnote-116195817 +Ref: An example dictionary-based configuration-Footnote-216195903 +Node: Using a rotator and namer to customize log rotation processing16195989 +Ref: howto/logging-cookbook cookbook-rotator-namer16196203 +Ref: 2cf516196203 +Ref: howto/logging-cookbook using-a-rotator-and-namer-to-customize-log-rotation-processing16196203 +Ref: 4fd216196203 +Node: A more elaborate multiprocessing example16197604 +Ref: howto/logging-cookbook a-more-elaborate-multiprocessing-example16197830 +Ref: 4fd316197830 +Node: Inserting a BOM into messages sent to a SysLogHandler16207456 +Ref: howto/logging-cookbook inserting-a-bom-into-messages-sent-to-a-sysloghandler16207651 +Ref: 4fd416207651 +Ref: Inserting a BOM into messages sent to a SysLogHandler-Footnote-116209816 +Ref: Inserting a BOM into messages sent to a SysLogHandler-Footnote-216209875 +Ref: Inserting a BOM into messages sent to a SysLogHandler-Footnote-316209944 +Ref: Inserting a BOM into messages sent to a SysLogHandler-Footnote-416210003 +Node: Implementing structured logging16210062 +Ref: howto/logging-cookbook implementing-structured-logging16210253 +Ref: 4fd516210253 +Node: Customizing handlers with dictConfig16212787 +Ref: howto/logging-cookbook custom-handlers16212987 +Ref: 4fd616212987 +Ref: howto/logging-cookbook customizing-handlers-with-dictconfig16212987 +Ref: 4fd716212987 +Node: Using particular formatting styles throughout your application16218183 +Ref: howto/logging-cookbook formatting-styles16218387 +Ref: 2c8d16218387 +Ref: howto/logging-cookbook using-particular-formatting-styles-throughout-your-application16218387 +Ref: 4fd816218387 +Node: Using LogRecord factories16220389 +Ref: howto/logging-cookbook using-logrecord-factories16220550 +Ref: 4fd916220550 +Node: Using custom message objects16221524 +Ref: howto/logging-cookbook using-custom-message-objects16221685 +Ref: 4fda16221685 +Node: Configuring filters with dictConfig16224393 +Ref: howto/logging-cookbook configuring-filters-with-dictconfig16224592 +Ref: 4fdb16224592 +Ref: howto/logging-cookbook filters-dictconfig16224592 +Ref: 4fdc16224592 +Node: Customized exception formatting16227559 +Ref: howto/logging-cookbook custom-format-exception16227721 +Ref: 4fdd16227721 +Ref: howto/logging-cookbook customized-exception-formatting16227721 +Ref: 4fde16227721 +Node: Speaking logging messages16229786 +Ref: howto/logging-cookbook speaking-logging-messages16229973 +Ref: 4fdf16229973 +Ref: howto/logging-cookbook spoken-messages16229973 +Ref: 4fe016229973 +Node: Buffering logging messages and outputting them conditionally16232139 +Ref: howto/logging-cookbook buffered-logging16232343 +Ref: 4fe116232343 +Ref: howto/logging-cookbook buffering-logging-messages-and-outputting-them-conditionally16232343 +Ref: 4fe216232343 +Node: Sending logging messages to email with buffering16237919 +Ref: howto/logging-cookbook buffered-smtp16238146 +Ref: 4fe316238146 +Ref: howto/logging-cookbook sending-logging-messages-to-email-with-buffering16238146 +Ref: 4fe416238146 +Node: Formatting times using UTC GMT via configuration16241712 +Ref: howto/logging-cookbook formatting-times-using-utc-gmt-via-configuration16241924 +Ref: 4fe516241924 +Ref: howto/logging-cookbook utc-formatting16241924 +Ref: 4fe616241924 +Node: Using a context manager for selective logging16243825 +Ref: howto/logging-cookbook context-manager16244023 +Ref: 4fe716244023 +Ref: howto/logging-cookbook using-a-context-manager-for-selective-logging16244023 +Ref: 4fe816244023 +Node: A CLI application starter template16248603 +Ref: howto/logging-cookbook a-cli-application-starter-template16248773 +Ref: 4fe916248773 +Ref: howto/logging-cookbook starter-template16248773 +Ref: 4fea16248773 +Node: A Qt GUI for logging16254754 +Ref: howto/logging-cookbook a-qt-gui-for-logging16254917 +Ref: 4feb16254917 +Ref: howto/logging-cookbook qt-gui16254917 +Ref: 4fec16254917 +Ref: A Qt GUI for logging-Footnote-116265220 +Ref: A Qt GUI for logging-Footnote-216265247 +Ref: A Qt GUI for logging-Footnote-316265289 +Node: Logging to syslog with RFC5424 support16265329 +Ref: howto/logging-cookbook logging-to-syslog-with-rfc5424-support16265501 +Ref: 4fed16265501 +Ref: Logging to syslog with RFC5424 support-Footnote-116269231 +Ref: Logging to syslog with RFC5424 support-Footnote-216269290 +Node: How to treat a logger like an output stream16269349 +Ref: howto/logging-cookbook how-to-treat-a-logger-like-an-output-stream16269551 +Ref: 4fee16269551 +Node: How to uniformly handle newlines in logging output16274227 +Ref: howto/logging-cookbook how-to-uniformly-handle-newlines-in-logging-output16274408 +Ref: 4fef16274408 +Ref: How to uniformly handle newlines in logging output-Footnote-116277938 +Node: Patterns to avoid16278000 +Ref: howto/logging-cookbook patterns-to-avoid16278156 +Ref: 4ff016278156 +Node: Opening the same log file multiple times16278708 +Ref: howto/logging-cookbook opening-the-same-log-file-multiple-times16278879 +Ref: 4ff116278879 +Node: Using loggers as attributes in a class or passing them as parameters16280802 +Ref: howto/logging-cookbook using-loggers-as-attributes-in-a-class-or-passing-them-as-parameters16281045 +Ref: 4ff216281045 +Node: Adding handlers other than NullHandler to a logger in a library16281731 +Ref: howto/logging-cookbook adding-handlers-other-than-nullhandler-to-a-logger-in-a-library16281959 +Ref: 4ff316281959 +Node: Creating a lot of loggers16282399 +Ref: howto/logging-cookbook creating-a-lot-of-loggers16282550 +Ref: 4ff416282550 +Node: Other resources<2>16283105 +Ref: howto/logging-cookbook cookbook-ref-links16283202 +Ref: 4fad16283202 +Ref: howto/logging-cookbook other-resources16283202 +Ref: 4ff516283202 +Node: Regular Expression HOWTO16283574 +Ref: howto/regex doc16283706 +Ref: 4ff616283706 +Ref: howto/regex regex-howto16283706 +Ref: 22ec16283706 +Ref: howto/regex regular-expression-howto16283706 +Ref: 4ff716283706 +Node: Introduction<15>16284203 +Ref: howto/regex introduction16284304 +Ref: 4ff816284304 +Node: Simple Patterns16285909 +Ref: howto/regex simple-patterns16286044 +Ref: 4ff916286044 +Node: Matching Characters16286539 +Ref: howto/regex matching-characters16286635 +Ref: 4ffa16286635 +Node: Repeating Things16291286 +Ref: howto/regex repeating-things16291382 +Ref: 4ffb16291382 +Node: Using Regular Expressions16296460 +Ref: howto/regex using-regular-expressions16296597 +Ref: 4ffc16296597 +Node: Compiling Regular Expressions16297090 +Ref: howto/regex compiling-regular-expressions16297210 +Ref: 4ffd16297210 +Node: The Backslash Plague16298427 +Ref: howto/regex id116298574 +Ref: 4ffe16298574 +Ref: howto/regex the-backslash-plague16298574 +Ref: 4fff16298574 +Node: Performing Matches16301460 +Ref: howto/regex performing-matches16301603 +Ref: 500016301603 +Node: Module-Level Functions<3>16307146 +Ref: howto/regex module-level-functions16307286 +Ref: 500116307286 +Node: Compilation Flags16308489 +Ref: howto/regex compilation-flags16308602 +Ref: 500216308602 +Node: More Pattern Power16315752 +Ref: howto/regex more-pattern-power16315891 +Ref: 500416315891 +Node: More Metacharacters16316256 +Ref: howto/regex id216316347 +Ref: 500516316347 +Ref: howto/regex more-metacharacters16316347 +Ref: 500316316347 +Node: Grouping16321028 +Ref: howto/regex grouping16321158 +Ref: 500616321158 +Node: Non-capturing and Named Groups16324634 +Ref: howto/regex non-capturing-and-named-groups16324765 +Ref: 500716324765 +Node: Lookahead Assertions16329901 +Ref: howto/regex lookahead-assertions16330015 +Ref: 500816330015 +Node: Modifying Strings16333684 +Ref: howto/regex modifying-strings16333813 +Ref: 500916333813 +Node: Splitting Strings16334805 +Ref: howto/regex splitting-strings16334906 +Ref: 500a16334906 +Node: Search and Replace<2>16337224 +Ref: howto/regex search-and-replace16337325 +Ref: 500b16337325 +Node: Common Problems16341813 +Ref: howto/regex common-problems16341932 +Ref: 500c16341932 +Node: Use String Methods16342370 +Ref: howto/regex use-string-methods16342468 +Ref: 500d16342468 +Node: match versus search16344184 +Ref: howto/regex match-versus-search16344315 +Ref: 500e16344315 +Node: Greedy versus Non-Greedy16345949 +Ref: howto/regex greedy-versus-non-greedy16346078 +Ref: 500f16346078 +Node: Using re VERBOSE16348002 +Ref: howto/regex using-re-verbose16348103 +Ref: 501016348103 +Node: Feedback16349630 +Ref: howto/regex feedback16349723 +Ref: 501116349723 +Node: Socket Programming HOWTO16350506 +Ref: howto/sockets doc16350640 +Ref: 501216350640 +Ref: howto/sockets socket-howto16350640 +Ref: 344c16350640 +Ref: howto/sockets socket-programming-howto16350640 +Ref: 501316350640 +Node: Sockets16351238 +Ref: howto/sockets sockets16351332 +Ref: 501416351332 +Node: History16352492 +Ref: howto/sockets history16352543 +Ref: 501516352543 +Node: Creating a Socket16353118 +Ref: howto/sockets creating-a-socket16353235 +Ref: 501616353235 +Node: IPC16356491 +Ref: howto/sockets ipc16356548 +Ref: 501716356548 +Node: Using a Socket16356994 +Ref: howto/sockets using-a-socket16357117 +Ref: 501816357117 +Node: Binary Data16363256 +Ref: howto/sockets binary-data16363318 +Ref: 501916363318 +Ref: Binary Data-Footnote-116364605 +Node: Disconnecting16364665 +Ref: howto/sockets disconnecting16364791 +Ref: 501a16364791 +Node: When Sockets Die16366267 +Ref: howto/sockets when-sockets-die16366333 +Ref: 501b16366333 +Node: Non-blocking Sockets16367212 +Ref: howto/sockets non-blocking-sockets16367315 +Ref: 501c16367315 +Node: Sorting Techniques16371136 +Ref: howto/sorting doc16371259 +Ref: 501d16371259 +Ref: howto/sorting sorting-techniques16371259 +Ref: 501e16371259 +Ref: howto/sorting sortinghowto16371259 +Ref: 217e16371259 +Node: Sorting Basics16371917 +Ref: howto/sorting sorting-basics16372008 +Ref: 501f16372008 +Node: Key Functions16372808 +Ref: howto/sorting key-functions16372965 +Ref: 502016372965 +Node: Operator Module Functions and Partial Function Evaluation16374833 +Ref: howto/sorting operator-module-functions-and-partial-function-evaluation16375000 +Ref: 502116375000 +Ref: Operator Module Functions and Partial Function Evaluation-Footnote-116376827 +Node: Ascending and Descending16376871 +Ref: howto/sorting ascending-and-descending16377057 +Ref: 502216377057 +Node: Sort Stability and Complex Sorts16377592 +Ref: howto/sorting sort-stability-and-complex-sorts16377745 +Ref: 502316377745 +Ref: Sort Stability and Complex Sorts-Footnote-116379378 +Ref: Sort Stability and Complex Sorts-Footnote-216379444 +Node: Decorate-Sort-Undecorate16379490 +Ref: howto/sorting decorate-sort-undecorate16379639 +Ref: 502416379639 +Ref: Decorate-Sort-Undecorate-Footnote-116381290 +Node: Comparison Functions16381350 +Ref: howto/sorting comparison-functions16381483 +Ref: 502516381483 +Ref: Comparison Functions-Footnote-116382454 +Node: Odds and Ends<2>16382541 +Ref: howto/sorting odds-and-ends16382663 +Ref: 502616382663 +Ref: Odds and Ends<2>-Footnote-116384908 +Node: Partial Sorts16384950 +Ref: howto/sorting partial-sorts16385043 +Ref: 502716385043 +Node: Unicode HOWTO16386126 +Ref: howto/unicode doc16386280 +Ref: 502816386280 +Ref: howto/unicode id116386280 +Ref: 502916386280 +Ref: howto/unicode unicode-howto16386280 +Ref: 129716386280 +Node: Introduction to Unicode16386680 +Ref: howto/unicode introduction-to-unicode16386788 +Ref: 502a16386788 +Node: Definitions16386920 +Ref: howto/unicode definitions16387009 +Ref: 502b16387009 +Ref: Definitions-Footnote-116390073 +Node: Encodings16390130 +Ref: howto/unicode encodings16390241 +Ref: 502c16390241 +Node: References<3>16393922 +Ref: howto/unicode references16394013 +Ref: 502d16394013 +Ref: References<3>-Footnote-116394888 +Ref: References<3>-Footnote-216394920 +Ref: References<3>-Footnote-316394961 +Ref: References<3>-Footnote-416395013 +Ref: References<3>-Footnote-516395060 +Ref: References<3>-Footnote-616395234 +Ref: References<3>-Footnote-716395291 +Node: Python’s Unicode Support16395335 +Ref: howto/unicode python-s-unicode-support16395484 +Ref: 502e16395484 +Node: The String Type16395851 +Ref: howto/unicode the-string-type16395957 +Ref: 502f16395957 +Node: Converting to Bytes16399067 +Ref: howto/unicode converting-to-bytes16399220 +Ref: 503016399220 +Node: Unicode Literals in Python Source Code16401064 +Ref: howto/unicode unicode-literals-in-python-source-code16401220 +Ref: 503116401220 +Ref: Unicode Literals in Python Source Code-Footnote-116403325 +Node: Unicode Properties16403367 +Ref: howto/unicode unicode-properties16403521 +Ref: 503216403521 +Ref: Unicode Properties-Footnote-116405286 +Node: Comparing Strings16405356 +Ref: howto/unicode comparing-strings16405499 +Ref: 503316405499 +Node: Unicode Regular Expressions16408353 +Ref: howto/unicode unicode-regular-expressions16408491 +Ref: 503416408491 +Node: References<4>16409630 +Ref: howto/unicode id216409742 +Ref: 503516409742 +Ref: References<4>-Footnote-116410528 +Ref: References<4>-Footnote-216410624 +Ref: References<4>-Footnote-316410676 +Node: Reading and Writing Unicode Data16410745 +Ref: howto/unicode reading-and-writing-unicode-data16410891 +Ref: 503616410891 +Node: Unicode filenames16414599 +Ref: howto/unicode unicode-filenames16414733 +Ref: 503716414733 +Node: Tips for Writing Unicode-aware Programs16417196 +Ref: howto/unicode tips-for-writing-unicode-aware-programs16417352 +Ref: 503816417352 +Node: Converting Between File Encodings16418715 +Ref: howto/unicode converting-between-file-encodings16418861 +Ref: 503916418861 +Node: Files in an Unknown Encoding16419630 +Ref: howto/unicode files-in-an-unknown-encoding16419776 +Ref: 503a16419776 +Node: References<5>16420677 +Ref: howto/unicode id316420807 +Ref: 503b16420807 +Ref: References<5>-Footnote-116421413 +Ref: References<5>-Footnote-216421485 +Ref: References<5>-Footnote-316421590 +Node: Acknowledgements<10>16421659 +Ref: howto/unicode acknowledgements16421770 +Ref: 503c16421770 +Node: HOWTO Fetch Internet Resources Using The urllib Package16422294 +Ref: howto/urllib2 doc16422469 +Ref: 503d16422469 +Ref: howto/urllib2 howto-fetch-internet-resources-using-the-urllib-package16422469 +Ref: 503e16422469 +Ref: howto/urllib2 urllib-howto16422469 +Ref: 3a1116422469 +Ref: HOWTO Fetch Internet Resources Using The urllib Package-Footnote-116422883 +Node: Introduction<16>16422922 +Ref: howto/urllib2 introduction16423052 +Ref: 503f16423052 +Ref: Introduction<16>-Footnote-116424646 +Ref: Introduction<16>-Footnote-216424763 +Node: Fetching URLs16424822 +Ref: howto/urllib2 fetching-urls16424983 +Ref: 504016424983 +Node: Data16427220 +Ref: howto/urllib2 data16427290 +Ref: 504116427290 +Ref: Data-Footnote-116429941 +Node: Headers16430010 +Ref: howto/urllib2 headers16430080 +Ref: 504216430080 +Ref: Headers-Footnote-116431592 +Ref: Headers-Footnote-216431620 +Ref: Headers-Footnote-316431830 +Ref: Headers-Footnote-416431950 +Node: Handling Exceptions<2>16432069 +Ref: howto/urllib2 handling-exceptions16432229 +Ref: 504416432229 +Node: URLError16432732 +Ref: howto/urllib2 urlerror16432817 +Ref: 504516432817 +Node: HTTPError16433369 +Ref: howto/urllib2 httperror16433477 +Ref: 504616433477 +Ref: HTTPError-Footnote-116434368 +Node: Error Codes16434427 +Ref: howto/urllib2 error-codes16434484 +Ref: 504716434484 +Ref: Error Codes-Footnote-116436648 +Node: Wrapping it Up16436707 +Ref: howto/urllib2 wrapping-it-up16436798 +Ref: 504816436798 +Node: Number 116437030 +Ref: howto/urllib2 number-116437106 +Ref: 504916437106 +Node: Number 216437731 +Ref: howto/urllib2 number-216437807 +Ref: 504a16437807 +Node: info and geturl16438339 +Ref: howto/urllib2 info-and-geturl16438506 +Ref: 504316438506 +Ref: info and geturl-Footnote-116439437 +Node: Openers and Handlers16439475 +Ref: howto/urllib2 openers-and-handlers16439640 +Ref: 504b16439640 +Node: Basic Authentication16441288 +Ref: howto/urllib2 id516441445 +Ref: 504c16441445 +Ref: Basic Authentication-Footnote-116444858 +Node: Proxies16444975 +Ref: howto/urllib2 proxies16445130 +Ref: 504d16445130 +Ref: Proxies-Footnote-116446152 +Ref: Proxies-Footnote-216446454 +Ref: Proxies-Footnote-316446571 +Node: Sockets and Layers16446738 +Ref: howto/urllib2 sockets-and-layers16446882 +Ref: 504e16446882 +Node: Footnotes16447901 +Ref: howto/urllib2 footnotes16448029 +Ref: 504f16448029 +Node: An introduction to the ipaddress module16448117 +Ref: howto/ipaddress doc16448326 +Ref: 505016448326 +Ref: howto/ipaddress an-introduction-to-the-ipaddress-module16448326 +Ref: 505116448326 +Ref: howto/ipaddress ipaddress-howto16448326 +Ref: 3c3f16448326 +Node: Creating Address/Network/Interface objects16449067 +Ref: howto/ipaddress creating-address-network-interface-objects16449238 +Ref: 505216449238 +Node: A Note on IP Versions16449663 +Ref: howto/ipaddress a-note-on-ip-versions16449789 +Ref: 505316449789 +Node: IP Host Addresses16450575 +Ref: howto/ipaddress ip-host-addresses16450727 +Ref: 505416450727 +Node: Defining Networks16451912 +Ref: howto/ipaddress defining-networks16452058 +Ref: 505516452058 +Node: Host Interfaces16454414 +Ref: howto/ipaddress host-interfaces16454534 +Ref: 505616454534 +Node: Inspecting Address/Network/Interface Objects16455537 +Ref: howto/ipaddress inspecting-address-network-interface-objects16455747 +Ref: 505716455747 +Node: Networks as lists of Addresses16458095 +Ref: howto/ipaddress networks-as-lists-of-addresses16458277 +Ref: 505816458277 +Node: Comparisons<4>16459074 +Ref: howto/ipaddress comparisons16459249 +Ref: 505916459249 +Node: Using IP Addresses with other modules16459606 +Ref: howto/ipaddress using-ip-addresses-with-other-modules16459799 +Ref: 505a16459799 +Node: Getting more detail when instance creation fails16460228 +Ref: howto/ipaddress getting-more-detail-when-instance-creation-fails16460398 +Ref: 505b16460398 +Node: Instrumenting CPython with DTrace and SystemTap16462454 +Ref: howto/instrumentation doc16462650 +Ref: 505c16462650 +Ref: howto/instrumentation instrumentation16462650 +Ref: c6c16462650 +Ref: howto/instrumentation instrumenting-cpython-with-dtrace-and-systemtap16462650 +Ref: 505d16462650 +Node: Enabling the static markers16463831 +Ref: howto/instrumentation enabling-the-static-markers16463971 +Ref: 505e16463971 +Node: Static DTrace probes16468169 +Ref: howto/instrumentation static-dtrace-probes16468342 +Ref: 505f16468342 +Node: Static SystemTap markers16470781 +Ref: howto/instrumentation static-systemtap-markers16470951 +Ref: 506016470951 +Node: Available static markers16472995 +Ref: howto/instrumentation available-static-markers16473162 +Ref: 506116473162 +Node: SystemTap Tapsets16475710 +Ref: howto/instrumentation systemtap-tapsets16475865 +Ref: 506216475865 +Node: Examples<39>16477483 +Ref: howto/instrumentation examples16477605 +Ref: 506316477605 +Node: Python support for the Linux perf profiler16478926 +Ref: howto/perf_profiling doc16479109 +Ref: 173c16479109 +Ref: howto/perf_profiling perf-profiling16479109 +Ref: 18f16479109 +Ref: howto/perf_profiling python-support-for-the-linux-perf-profiler16479109 +Ref: 506416479109 +Ref: Python support for the Linux perf profiler-Footnote-116486994 +Node: How to enable perf profiling support16487031 +Ref: howto/perf_profiling how-to-enable-perf-profiling-support16487185 +Ref: 506516487185 +Node: How to obtain the best results16488327 +Ref: howto/perf_profiling how-to-obtain-the-best-results16488524 +Ref: 506616488524 +Node: How to work without frame pointers16489306 +Ref: howto/perf_profiling how-to-work-without-frame-pointers16489458 +Ref: 506716489458 +Node: Annotations Best Practices16493322 +Ref: howto/annotations doc16493485 +Ref: 506816493485 +Ref: howto/annotations annotations-best-practices16493485 +Ref: 506916493485 +Ref: howto/annotations annotations-howto16493485 +Ref: 7d416493485 +Node: Accessing The Annotations Dict Of An Object In Python 3 10 And Newer16494847 +Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-10-and-newer16495054 +Ref: 506a16495054 +Node: Accessing The Annotations Dict Of An Object In Python 3 9 And Older16496710 +Ref: howto/annotations accessing-the-annotations-dict-of-an-object-in-python-3-9-and-older16496972 +Ref: 506b16496972 +Node: Manually Un-Stringizing Stringized Annotations16499366 +Ref: howto/annotations manually-un-stringizing-stringized-annotations16499616 +Ref: 506c16499616 +Ref: Manually Un-Stringizing Stringized Annotations-Footnote-116501954 +Node: Best Practices For __annotations__ In Any Python Version16501996 +Ref: howto/annotations best-practices-for-annotations-in-any-python-version16502201 +Ref: 506d16502201 +Node: __annotations__ Quirks16502940 +Ref: howto/annotations annotations-quirks16503090 +Ref: 506e16503090 +Node: Isolating Extension Modules16504783 +Ref: howto/isolating-extensions doc16504931 +Ref: 506f16504931 +Ref: howto/isolating-extensions isolating-extension-modules16504931 +Ref: 507016504931 +Ref: howto/isolating-extensions isolating-extensions-howto16504931 +Ref: 48be16504931 +Node: Who should read this16505671 +Ref: howto/isolating-extensions who-should-read-this16505777 +Ref: 507116505777 +Node: Background<2>16506015 +Ref: howto/isolating-extensions background16506176 +Ref: 507216506176 +Node: Enter Per-Module State16507787 +Ref: howto/isolating-extensions enter-per-module-state16507891 +Ref: 507316507891 +Node: Isolated Module Objects16509062 +Ref: howto/isolating-extensions isolated-module-objects16509196 +Ref: 507416509196 +Node: Surprising Edge Cases16510233 +Ref: howto/isolating-extensions surprising-edge-cases16510336 +Ref: 507616510336 +Node: Making Modules Safe with Multiple Interpreters16511352 +Ref: howto/isolating-extensions making-modules-safe-with-multiple-interpreters16511506 +Ref: 507716511506 +Node: Managing Global State16511825 +Ref: howto/isolating-extensions managing-global-state16511963 +Ref: 507516511963 +Node: Managing Per-Module State16512923 +Ref: howto/isolating-extensions managing-per-module-state16513119 +Ref: 507816513119 +Ref: Managing Per-Module State-Footnote-116514795 +Node: Opt-Out Limiting to One Module Object per Process16514869 +Ref: howto/isolating-extensions isolating-extensions-optout16515078 +Ref: 4d1816515078 +Ref: howto/isolating-extensions opt-out-limiting-to-one-module-object-per-process16515078 +Ref: 507916515078 +Node: Module State Access from Functions16516440 +Ref: howto/isolating-extensions module-state-access-from-functions16516615 +Ref: 507a16516615 +Node: Heap Types<2>16517397 +Ref: howto/isolating-extensions heap-types16517549 +Ref: 507b16517549 +Node: Changing Static Types to Heap Types16519215 +Ref: howto/isolating-extensions changing-static-types-to-heap-types16519328 +Ref: 507c16519328 +Node: Defining Heap Types16520308 +Ref: howto/isolating-extensions defining-heap-types16520457 +Ref: 507d16520457 +Node: Garbage-Collection Protocol16521114 +Ref: howto/isolating-extensions garbage-collection-protocol16521260 +Ref: 507e16521260 +Node: tp_traverse in Python 3 8 and lower16522350 +Ref: howto/isolating-extensions tp-traverse-in-python-3-8-and-lower16522480 +Ref: 507f16522480 +Node: Delegating tp_traverse16523248 +Ref: howto/isolating-extensions delegating-tp-traverse16523406 +Ref: 508016523406 +Node: Defining tp_dealloc16524216 +Ref: howto/isolating-extensions defining-tp-dealloc16524361 +Ref: 508116524361 +Node: Not overriding tp_free16525133 +Ref: howto/isolating-extensions not-overriding-tp-free16525277 +Ref: 508216525277 +Node: Avoiding PyObject_New16525484 +Ref: howto/isolating-extensions avoiding-pyobject-new16525600 +Ref: 508316525600 +Node: Module State Access from Classes16526389 +Ref: howto/isolating-extensions module-state-access-from-classes16526556 +Ref: 508416526556 +Node: Module State Access from Regular Methods16527129 +Ref: howto/isolating-extensions module-state-access-from-regular-methods16527326 +Ref: 508516527326 +Node: Module State Access from Slot Methods Getters and Setters16529839 +Ref: howto/isolating-extensions module-state-access-from-slot-methods-getters-and-setters16530032 +Ref: 508616530032 +Node: Lifetime of the Module State16531461 +Ref: howto/isolating-extensions lifetime-of-the-module-state16531605 +Ref: 508716531605 +Node: Open Issues16532148 +Ref: howto/isolating-extensions open-issues16532245 +Ref: 508816532245 +Ref: Open Issues-Footnote-116532557 +Node: Per-Class Scope16532612 +Ref: howto/isolating-extensions per-class-scope16532717 +Ref: 508916532717 +Node: Lossless Conversion to Heap Types16533010 +Ref: howto/isolating-extensions lossless-conversion-to-heap-types16533115 +Ref: 508a16533115 +Node: timer file descriptor HOWTO16533357 +Ref: howto/timerfd doc16533517 +Ref: 508b16533517 +Ref: howto/timerfd timer-file-descriptor-howto16533517 +Ref: 508c16533517 +Ref: howto/timerfd timerfd-howto16533517 +Ref: 508d16533517 +Node: Examples<40>16533714 +Ref: howto/timerfd examples16533790 +Ref: 508e16533790 +Node: The Python 2 3 Method Resolution Order16542596 +Ref: howto/mro doc16542775 +Ref: 508f16542775 +Ref: howto/mro python-2-3-mro16542775 +Ref: 147316542775 +Ref: howto/mro the-python-2-3-method-resolution-order16542775 +Ref: 509016542775 +Ref: The Python 2 3 Method Resolution Order-Footnote-116544388 +Node: The beginning16544435 +Ref: howto/mro the-beginning16544562 +Ref: 509116544562 +Ref: The beginning-Footnote-116549149 +Ref: The beginning-Footnote-216549286 +Node: The C3 Method Resolution Order16549398 +Ref: howto/mro the-c3-method-resolution-order16549546 +Ref: 509216549546 +Node: Examples<41>16551877 +Ref: howto/mro examples16552040 +Ref: 509316552040 +Node: Bad Method Resolution Orders16557591 +Ref: howto/mro bad-method-resolution-orders16557731 +Ref: 509416557731 +Ref: Bad Method Resolution Orders-Footnote-116563979 +Node: The end16564165 +Ref: howto/mro the-end16564302 +Ref: 509516564302 +Node: Resources16567481 +Ref: howto/mro resources16567581 +Ref: 509616567581 +Node: Python experimental support for free threading16567616 +Ref: howto/free-threading-python doc16567810 +Ref: 509716567810 +Ref: howto/free-threading-python freethreading-python-howto16567810 +Ref: 509816567810 +Ref: howto/free-threading-python python-experimental-support-for-free-threading16567810 +Ref: 509916567810 +Ref: Python experimental support for free threading-Footnote-116569092 +Node: Installation16569134 +Ref: howto/free-threading-python installation16569270 +Ref: 509b16569270 +Ref: Installation-Footnote-116569856 +Node: Identifying free-threaded Python16569920 +Ref: howto/free-threading-python identifying-free-threaded-python16570116 +Ref: 509c16570116 +Node: The global interpreter lock in free-threaded Python16570800 +Ref: howto/free-threading-python the-global-interpreter-lock-in-free-threaded-python16570997 +Ref: 509d16570997 +Node: Thread safety16571747 +Ref: howto/free-threading-python thread-safety16571929 +Ref: 509e16571929 +Node: Known limitations16572721 +Ref: howto/free-threading-python known-limitations16572843 +Ref: 509f16572843 +Node: Immortalization16573096 +Ref: howto/free-threading-python immortalization16573190 +Ref: 50a016573190 +Node: Frame objects<2>16574301 +Ref: howto/free-threading-python frame-objects16574416 +Ref: 50a116574416 +Node: Iterators<3>16574861 +Ref: howto/free-threading-python iterators16574988 +Ref: 50a216574988 +Node: Single-threaded performance16575199 +Ref: howto/free-threading-python single-threaded-performance16575301 +Ref: 50a316575301 +Ref: Single-threaded performance-Footnote-116576067 +Ref: Single-threaded performance-Footnote-216576113 +Node: C API Extension Support for Free Threading16576155 +Ref: howto/free-threading-extensions doc16576302 +Ref: 50a416576302 +Ref: howto/free-threading-extensions c-api-extension-support-for-free-threading16576302 +Ref: 50a516576302 +Ref: howto/free-threading-extensions freethreading-extensions-howto16576302 +Ref: 509a16576302 +Node: Identifying the Free-Threaded Build in C16576954 +Ref: howto/free-threading-extensions identifying-the-free-threaded-build-in-c16577103 +Ref: 50a616577103 +Node: Module Initialization16577810 +Ref: howto/free-threading-extensions module-initialization16577990 +Ref: 50a716577990 +Node: Multi-Phase Initialization16578484 +Ref: howto/free-threading-extensions multi-phase-initialization16578604 +Ref: 50a816578604 +Node: Single-Phase Initialization16579277 +Ref: howto/free-threading-extensions single-phase-initialization16579397 +Ref: 50a916579397 +Node: General API Guidelines16580237 +Ref: howto/free-threading-extensions general-api-guidelines16580396 +Ref: 50aa16580396 +Node: Container Thread Safety16581217 +Ref: howto/free-threading-extensions container-thread-safety16581299 +Ref: 50ac16581299 +Node: PyDict_Next16581634 +Ref: howto/free-threading-extensions id116581705 +Ref: 50ad16581705 +Ref: howto/free-threading-extensions pydict-next16581705 +Ref: 50ae16581705 +Node: Borrowed References16582193 +Ref: howto/free-threading-extensions borrowed-references16582353 +Ref: 50af16582353 +Ref: howto/free-threading-extensions id216582408 +Ref: 50ab16582408 +Ref: Borrowed References-Footnote-116585198 +Node: Memory Allocation APIs16585250 +Ref: howto/free-threading-extensions free-threaded-memory-allocation16585413 +Ref: 4e2516585413 +Ref: howto/free-threading-extensions memory-allocation-apis16585413 +Ref: 50b016585413 +Node: Thread State and GIL APIs16586159 +Ref: howto/free-threading-extensions thread-state-and-gil-apis16586338 +Ref: 50b116586338 +Node: Protecting Internal Extension State16587304 +Ref: howto/free-threading-extensions protecting-internal-extension-state16587508 +Ref: 50b216587508 +Ref: Protecting Internal Extension State-Footnote-116588264 +Node: Building Extensions for the Free-Threaded Build16588330 +Ref: howto/free-threading-extensions building-extensions-for-the-free-threaded-build16588500 +Ref: 50b316588500 +Ref: Building Extensions for the Free-Threaded Build-Footnote-116589102 +Ref: Building Extensions for the Free-Threaded Build-Footnote-216589144 +Ref: Building Extensions for the Free-Threaded Build-Footnote-316589189 +Node: Limited C API and Stable ABI16589252 +Ref: howto/free-threading-extensions limited-c-api-and-stable-abi16589384 +Ref: 50b416589384 +Ref: Limited C API and Stable ABI-Footnote-116590081 +Node: Windows<80>16590142 +Ref: howto/free-threading-extensions windows16590274 +Ref: 50b516590274 +Ref: Windows<80>-Footnote-116591902 +Node: Python Frequently Asked Questions16591955 +Ref: faq/index doc16592071 +Ref: 50b616592071 +Ref: faq/index faq-index16592071 +Ref: 1d0716592071 +Ref: faq/index python-frequently-asked-questions16592071 +Ref: 50b716592071 +Node: General Python FAQ16592395 +Ref: faq/general doc16592507 +Ref: 50b816592507 +Ref: faq/general general-python-faq16592507 +Ref: 50b916592507 +Node: General Information16592619 +Ref: faq/general general-information16592726 +Ref: 50ba16592726 +Node: What is Python?16593715 +Ref: faq/general what-is-python16593834 +Ref: 50bb16593834 +Ref: What is Python?-Footnote-116594782 +Node: What is the Python Software Foundation?16594834 +Ref: faq/general what-is-the-python-software-foundation16595016 +Ref: 50bc16595016 +Ref: What is the Python Software Foundation?-Footnote-116595620 +Node: Are there copyright restrictions on the use of Python?16595666 +Ref: faq/general are-there-copyright-restrictions-on-the-use-of-python16595875 +Ref: 50bd16595875 +Ref: Are there copyright restrictions on the use of Python?-Footnote-116596737 +Ref: Are there copyright restrictions on the use of Python?-Footnote-216596784 +Node: Why was Python created in the first place?16596831 +Ref: faq/general why-was-python-created-in-the-first-place16597025 +Ref: 50be16597025 +Node: What is Python good for?16599357 +Ref: faq/general what-is-python-good-for16599547 +Ref: 50bf16599547 +Ref: What is Python good for?-Footnote-116600398 +Node: How does the Python version numbering scheme work?16600423 +Ref: faq/general faq-version-numbering-scheme16600615 +Ref: 50c016600615 +Ref: faq/general how-does-the-python-version-numbering-scheme-work16600615 +Ref: 50c116600615 +Ref: How does the Python version numbering scheme work?-Footnote-116602691 +Ref: How does the Python version numbering scheme work?-Footnote-216602765 +Node: How do I obtain a copy of the Python source?16602807 +Ref: faq/general how-do-i-obtain-a-copy-of-the-python-source16603012 +Ref: 50c216603012 +Ref: How do I obtain a copy of the Python source?-Footnote-116603794 +Node: How do I get documentation on Python?16603837 +Ref: faq/general how-do-i-get-documentation-on-python16604050 +Ref: 50c316604050 +Ref: How do I get documentation on Python?-Footnote-116604613 +Node: I’ve never programmed before Is there a Python tutorial?16604649 +Ref: faq/general i-ve-never-programmed-before-is-there-a-python-tutorial16604873 +Ref: 50c416604873 +Ref: I’ve never programmed before Is there a Python tutorial?-Footnote-116605284 +Node: Is there a newsgroup or mailing list devoted to Python?16605336 +Ref: faq/general is-there-a-newsgroup-or-mailing-list-devoted-to-python16605566 +Ref: 50c516605566 +Ref: Is there a newsgroup or mailing list devoted to Python?-Footnote-116606445 +Ref: Is there a newsgroup or mailing list devoted to Python?-Footnote-216606506 +Node: How do I get a beta test version of Python?16606587 +Ref: faq/general how-do-i-get-a-beta-test-version-of-python16606810 +Ref: 50c616606810 +Ref: How do I get a beta test version of Python?-Footnote-116607347 +Node: How do I submit bug reports and patches for Python?16607384 +Ref: faq/general how-do-i-submit-bug-reports-and-patches-for-python16607619 +Ref: 50c716607619 +Ref: How do I submit bug reports and patches for Python?-Footnote-116607980 +Node: Are there any published articles about Python that I can reference?16608017 +Ref: faq/general are-there-any-published-articles-about-python-that-i-can-reference16608239 +Ref: 50c816608239 +Ref: Are there any published articles about Python that I can reference?-Footnote-116608791 +Node: Are there any books on Python?16608827 +Ref: faq/general are-there-any-books-on-python16609043 +Ref: 50c916609043 +Node: Where in the world is www python org located?16609420 +Ref: faq/general where-in-the-world-is-www-python-org-located16609593 +Ref: 50ca16609593 +Ref: Where in the world is www python org located?-Footnote-116609879 +Node: Why is it called Python?16609908 +Ref: faq/general why-is-it-called-python16610106 +Ref: 50cb16610106 +Ref: Why is it called Python?-Footnote-116610510 +Node: Do I have to like “Monty Python’s Flying Circus”?16610561 +Ref: faq/general do-i-have-to-like-monty-python-s-flying-circus16610705 +Ref: 50cc16610705 +Node: Python in the real world16610855 +Ref: faq/general python-in-the-real-world16610962 +Ref: 50cd16610962 +Node: How stable is Python?16611342 +Ref: faq/general how-stable-is-python16611466 +Ref: 50ce16611466 +Ref: How stable is Python?-Footnote-116612392 +Ref: How stable is Python?-Footnote-216612434 +Ref: How stable is Python?-Footnote-316612476 +Node: How many people are using Python?16612518 +Ref: faq/general how-many-people-are-using-python16612701 +Ref: 50cf16612701 +Node: Have any significant projects been done in Python?16613207 +Ref: faq/general have-any-significant-projects-been-done-in-python16613429 +Ref: 50d016613429 +Ref: Have any significant projects been done in Python?-Footnote-116614143 +Ref: Have any significant projects been done in Python?-Footnote-216614195 +Ref: Have any significant projects been done in Python?-Footnote-316614224 +Ref: Have any significant projects been done in Python?-Footnote-416614253 +Node: What new developments are expected for Python in the future?16614284 +Ref: faq/general what-new-developments-are-expected-for-python-in-the-future16614532 +Ref: 50d116614532 +Ref: What new developments are expected for Python in the future?-Footnote-116615112 +Node: Is it reasonable to propose incompatible changes to Python?16615182 +Ref: faq/general is-it-reasonable-to-propose-incompatible-changes-to-python16615432 +Ref: 50d216615432 +Ref: Is it reasonable to propose incompatible changes to Python?-Footnote-116616236 +Node: Is Python a good language for beginning programmers?16616278 +Ref: faq/general is-python-a-good-language-for-beginning-programmers16616459 +Ref: 50d316616459 +Ref: Is Python a good language for beginning programmers?-Footnote-116620280 +Ref: Is Python a good language for beginning programmers?-Footnote-216620331 +Node: Programming FAQ16620393 +Ref: faq/programming doc16620536 +Ref: 50d416620536 +Ref: faq/programming programming-faq16620536 +Ref: 50d516620536 +Node: General Questions16620771 +Ref: faq/programming general-questions16620862 +Ref: 50d616620862 +Node: Is there a source code level debugger with breakpoints single-stepping etc ?16621282 +Ref: faq/programming is-there-a-source-code-level-debugger-with-breakpoints-single-stepping-etc16621482 +Ref: 50d716621482 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-116622926 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-216622998 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-316623042 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-416623095 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-516623141 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-616623190 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-716623229 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-816623259 +Ref: Is there a source code level debugger with breakpoints single-stepping etc ?-Footnote-916623316 +Node: Are there tools to help find bugs or perform static analysis?16623359 +Ref: faq/programming are-there-tools-to-help-find-bugs-or-perform-static-analysis16623627 +Ref: 50d816623627 +Ref: Are there tools to help find bugs or perform static analysis?-Footnote-116624001 +Ref: Are there tools to help find bugs or perform static analysis?-Footnote-216624055 +Ref: Are there tools to help find bugs or perform static analysis?-Footnote-316624097 +Ref: Are there tools to help find bugs or perform static analysis?-Footnote-416624128 +Ref: Are there tools to help find bugs or perform static analysis?-Footnote-516624160 +Node: How can I create a stand-alone binary from a Python script?16624201 +Ref: faq/programming faq-create-standalone-binary16624457 +Ref: 50d916624457 +Ref: faq/programming how-can-i-create-a-stand-alone-binary-from-a-python-script16624457 +Ref: 50da16624457 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-116626173 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-216626238 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-316626266 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-416626299 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-516626352 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-616626404 +Ref: How can I create a stand-alone binary from a Python script?-Footnote-716626453 +Node: Are there coding standards or a style guide for Python programs?16626485 +Ref: faq/programming are-there-coding-standards-or-a-style-guide-for-python-programs16626671 +Ref: 50db16626671 +Ref: Are there coding standards or a style guide for Python programs?-Footnote-116626945 +Node: Core Language16626987 +Ref: faq/programming core-language16627106 +Ref: 50dc16627106 +Node: Why am I getting an UnboundLocalError when the variable has a value?16628476 +Ref: faq/programming faq-unboundlocalerror16628663 +Ref: 1fdd16628663 +Ref: faq/programming why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value16628663 +Ref: 50dd16628663 +Node: What are the rules for local and global variables in Python?16630569 +Ref: faq/programming what-are-the-rules-for-local-and-global-variables-in-python16630847 +Ref: 50de16630847 +Node: Why do lambdas defined in a loop with different values all return the same result?16631747 +Ref: faq/programming why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result16632004 +Ref: 50df16632004 +Node: How do I share global variables across modules?16633913 +Ref: faq/programming how-do-i-share-global-variables-across-modules16634173 +Ref: 50e016634173 +Node: What are the “best practices” for using import in a module?16634976 +Ref: faq/programming what-are-the-best-practices-for-using-import-in-a-module16635200 +Ref: 50e116635200 +Node: Why are default values shared between objects?16637997 +Ref: faq/programming why-are-default-values-shared-between-objects16638249 +Ref: 50e216638249 +Node: How can I pass optional or keyword parameters from one function to another?16640637 +Ref: faq/programming how-can-i-pass-optional-or-keyword-parameters-from-one-function-to-another16640882 +Ref: 50e316640882 +Node: What is the difference between arguments and parameters?16641469 +Ref: faq/programming faq-argument-vs-parameter16641723 +Ref: 50e416641723 +Ref: faq/programming what-is-the-difference-between-arguments-and-parameters16641723 +Ref: 50e516641723 +Node: Why did changing list ‘y’ also change list ‘x’?16642424 +Ref: faq/programming why-did-changing-list-y-also-change-list-x16642671 +Ref: 50e616642671 +Node: How do I write a function with output parameters call by reference ?16646080 +Ref: faq/programming how-do-i-write-a-function-with-output-parameters-call-by-reference16646321 +Ref: 50e716646321 +Node: How do you make a higher order function in Python?16648726 +Ref: faq/programming how-do-you-make-a-higher-order-function-in-python16648946 +Ref: 50e816648946 +Node: How do I copy an object in Python?16650520 +Ref: faq/programming how-do-i-copy-an-object-in-python16650726 +Ref: 50e916650726 +Node: How can I find the methods or attributes of an object?16651133 +Ref: faq/programming how-can-i-find-the-methods-or-attributes-of-an-object16651336 +Ref: 50ea16651336 +Node: How can my code discover the name of an object?16651662 +Ref: faq/programming how-can-my-code-discover-the-name-of-an-object16651882 +Ref: 50eb16651882 +Node: What’s up with the comma operator’s precedence?16653527 +Ref: faq/programming what-s-up-with-the-comma-operator-s-precedence16653751 +Ref: 50ec16653751 +Node: Is there an equivalent of C’s “? ” ternary operator?16654309 +Ref: faq/programming is-there-an-equivalent-of-c-s-ternary-operator16654542 +Ref: 50ed16654542 +Node: Is it possible to write obfuscated one-liners in Python?16655137 +Ref: faq/programming is-it-possible-to-write-obfuscated-one-liners-in-python16655382 +Ref: 50ee16655382 +Node: What does the slash / in the parameter list of a function mean?16656882 +Ref: faq/programming faq-positional-only-arguments16657060 +Ref: 217416657060 +Ref: faq/programming what-does-the-slash-in-the-parameter-list-of-a-function-mean16657060 +Ref: 50ef16657060 +Node: Numbers and strings16658160 +Ref: faq/programming numbers-and-strings16658276 +Ref: 50f016658276 +Node: How do I specify hexadecimal and octal integers?16659061 +Ref: faq/programming how-do-i-specify-hexadecimal-and-octal-integers16659203 +Ref: 50f116659203 +Node: Why does -22 // 10 return -3?16659852 +Ref: faq/programming why-does-22-10-return-316660061 +Ref: 50f216660061 +Node: How do I get int literal attribute instead of SyntaxError?16660822 +Ref: faq/programming how-do-i-get-int-literal-attribute-instead-of-syntaxerror16661021 +Ref: 50f316661021 +Node: How do I convert a string to a number?16661607 +Ref: faq/programming how-do-i-convert-a-string-to-a-number16661815 +Ref: 50f416661815 +Node: How do I convert a number to a string?16663148 +Ref: faq/programming how-do-i-convert-a-number-to-a-string16663332 +Ref: 50f516663332 +Node: How do I modify a string in place?16663878 +Ref: faq/programming how-do-i-modify-a-string-in-place16664071 +Ref: 50f616664071 +Node: How do I use strings to call functions/methods?16664927 +Ref: faq/programming how-do-i-use-strings-to-call-functions-methods16665167 +Ref: 50f716665167 +Node: Is there an equivalent to Perl’s chomp for removing trailing newlines from strings?16666495 +Ref: faq/programming is-there-an-equivalent-to-perl-s-chomp-for-removing-trailing-newlines-from-strings16666739 +Ref: 50f816666739 +Node: Is there a scanf or sscanf equivalent?16667506 +Ref: faq/programming is-there-a-scanf-or-sscanf-equivalent16667765 +Ref: 50f916667765 +Node: What does UnicodeDecodeError or UnicodeEncodeError error mean?16668430 +Ref: faq/programming what-does-unicodedecodeerror-or-unicodeencodeerror-error-mean16668661 +Ref: 50fa16668661 +Node: Can I end a raw string with an odd number of backslashes?16668860 +Ref: faq/programming can-i-end-a-raw-string-with-an-odd-number-of-backslashes16669044 +Ref: 50fb16669044 +Ref: faq/programming faq-programming-raw-string-backslash16669044 +Ref: 1bfa16669044 +Node: Performance<4>16670326 +Ref: faq/programming performance16670451 +Ref: 50fc16670451 +Node: My program is too slow How do I speed it up?16670668 +Ref: faq/programming my-program-is-too-slow-how-do-i-speed-it-up16670840 +Ref: 50fd16670840 +Ref: My program is too slow How do I speed it up?-Footnote-116673722 +Ref: My program is too slow How do I speed it up?-Footnote-216673749 +Node: What is the most efficient way to concatenate many strings together?16673814 +Ref: faq/programming efficient-string-concatenation16673986 +Ref: 50fe16673986 +Ref: faq/programming what-is-the-most-efficient-way-to-concatenate-many-strings-together16673986 +Ref: 50ff16673986 +Node: Sequences Tuples/Lists16674956 +Ref: faq/programming sequences-tuples-lists16675069 +Ref: 510016675069 +Node: How do I convert between tuples and lists?16675825 +Ref: faq/programming how-do-i-convert-between-tuples-and-lists16675961 +Ref: 510116675961 +Node: What’s a negative index?16676808 +Ref: faq/programming what-s-a-negative-index16677003 +Ref: 510216677003 +Node: How do I iterate over a sequence in reverse order?16677583 +Ref: faq/programming how-do-i-iterate-over-a-sequence-in-reverse-order16677777 +Ref: 510316677777 +Node: How do you remove duplicates from a list?16678126 +Ref: faq/programming how-do-you-remove-duplicates-from-a-list16678338 +Ref: 510416678338 +Node: How do you remove multiple items from a list16679165 +Ref: faq/programming how-do-you-remove-multiple-items-from-a-list16679362 +Ref: 510516679362 +Node: How do you make an array in Python?16679910 +Ref: faq/programming how-do-you-make-an-array-in-python16680106 +Ref: 510616680106 +Ref: How do you make an array in Python?-Footnote-116681140 +Node: How do I create a multidimensional list?16681167 +Ref: faq/programming faq-multidimensional-list16681380 +Ref: 21aa16681380 +Ref: faq/programming how-do-i-create-a-multidimensional-list16681380 +Ref: 510716681380 +Ref: How do I create a multidimensional list?-Footnote-116682602 +Node: How do I apply a method or function to a sequence of objects?16682629 +Ref: faq/programming how-do-i-apply-a-method-or-function-to-a-sequence-of-objects16682886 +Ref: 510816682886 +Node: Why does a_tuple[i] += [‘item’] raise an exception when the addition works?16683465 +Ref: faq/programming faq-augmented-assignment-tuple-error16683759 +Ref: 1fb416683759 +Ref: faq/programming why-does-a-tuple-i-item-raise-an-exception-when-the-addition-works16683759 +Ref: 510916683759 +Node: I want to do a complicated sort can you do a Schwartzian Transform in Python?16686999 +Ref: faq/programming i-want-to-do-a-complicated-sort-can-you-do-a-schwartzian-transform-in-python16687284 +Ref: 510a16687284 +Node: How can I sort one list by values from another list?16687769 +Ref: faq/programming how-can-i-sort-one-list-by-values-from-another-list16687966 +Ref: 510b16687966 +Node: Objects16688561 +Ref: faq/programming objects16688670 +Ref: 510c16688670 +Node: What is a class?16689847 +Ref: faq/programming what-is-a-class16689933 +Ref: 510d16689933 +Node: What is a method?16690659 +Ref: faq/programming what-is-a-method16690767 +Ref: 510e16690767 +Node: What is self?16691076 +Ref: faq/programming what-is-self16691251 +Ref: 510f16691251 +Node: How do I check if an object is an instance of a given class or of a subclass of it?16691693 +Ref: faq/programming how-do-i-check-if-an-object-is-an-instance-of-a-given-class-or-of-a-subclass-of-it16691870 +Ref: 511116691870 +Node: What is delegation?16694173 +Ref: faq/programming what-is-delegation16694421 +Ref: 511216694421 +Node: How do I call a method defined in a base class from a derived class that extends it?16696528 +Ref: faq/programming how-do-i-call-a-method-defined-in-a-base-class-from-a-derived-class-that-extends-it16696763 +Ref: 511316696763 +Node: How can I organize my code to make it easier to change the base class?16697385 +Ref: faq/programming how-can-i-organize-my-code-to-make-it-easier-to-change-the-base-class16697660 +Ref: 511416697660 +Node: How do I create static class data and static class methods?16698210 +Ref: faq/programming how-do-i-create-static-class-data-and-static-class-methods16698454 +Ref: 511516698454 +Node: How can I overload constructors or methods in Python?16700023 +Ref: faq/programming how-can-i-overload-constructors-or-methods-in-python16700262 +Ref: 511616700262 +Node: I try to use __spam and I get an error about _SomeClassName__spam16701169 +Ref: faq/programming i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam16701419 +Ref: 511716701419 +Node: My class defines __del__ but it is not called when I delete the object16702624 +Ref: faq/programming my-class-defines-del-but-it-is-not-called-when-i-delete-the-object16702875 +Ref: 511816702875 +Node: How do I get a list of all instances of a given class?16704826 +Ref: faq/programming how-do-i-get-a-list-of-all-instances-of-a-given-class16705062 +Ref: 511916705062 +Node: Why does the result of id appear to be not unique?16705403 +Ref: faq/programming why-does-the-result-of-id-appear-to-be-not-unique16705624 +Ref: 511a16705624 +Node: When can I rely on identity tests with the is operator?16706517 +Ref: faq/programming when-can-i-rely-on-identity-tests-with-the-is-operator16706756 +Ref: 511b16706756 +Ref: When can I rely on identity tests with the is operator?-Footnote-116710099 +Node: How can a subclass control what data is stored in an immutable instance?16710141 +Ref: faq/programming how-can-a-subclass-control-what-data-is-stored-in-an-immutable-instance16710358 +Ref: 511c16710358 +Node: How do I cache method calls?16711834 +Ref: faq/programming faq-cache-method-calls16711987 +Ref: 273e16711987 +Ref: faq/programming how-do-i-cache-method-calls16711987 +Ref: 511d16711987 +Node: Modules<5>16714982 +Ref: faq/programming modules16715060 +Ref: 511e16715060 +Node: How do I create a pyc file?16715600 +Ref: faq/programming how-do-i-create-a-pyc-file16715721 +Ref: 511f16715721 +Ref: How do I create a pyc file?-Footnote-116718303 +Node: How do I find the current module name?16718345 +Ref: faq/programming how-do-i-find-the-current-module-name16718530 +Ref: 512016718530 +Node: How can I have modules that mutually import each other?16719088 +Ref: faq/programming how-can-i-have-modules-that-mutually-import-each-other16719310 +Ref: 512116719310 +Node: __import__ ‘x y z’ returns ; how do I get z?16721359 +Ref: faq/programming import-x-y-z-returns-module-x-how-do-i-get-z16721639 +Ref: 512216721639 +Node: When I edit an imported module and reimport it the changes don’t show up Why does this happen?16721929 +Ref: faq/programming when-i-edit-an-imported-module-and-reimport-it-the-changes-don-t-show-up-why-does-this-happen16722145 +Ref: 512316722145 +Node: Design and History FAQ16723592 +Ref: faq/design doc16723742 +Ref: 512416723742 +Ref: faq/design design-and-history-faq16723742 +Ref: 512516723742 +Node: Why does Python use indentation for grouping of statements?16725841 +Ref: faq/design why-does-python-use-indentation-for-grouping-of-statements16726035 +Ref: 512616726035 +Node: Why am I getting strange results with simple arithmetic operations?16727755 +Ref: faq/design why-am-i-getting-strange-results-with-simple-arithmetic-operations16728008 +Ref: 512716728008 +Node: Why are floating-point calculations so inaccurate?16728183 +Ref: faq/design why-are-floating-point-calculations-so-inaccurate16728410 +Ref: 512816728410 +Node: Why are Python strings immutable?16729949 +Ref: faq/design why-are-python-strings-immutable16730180 +Ref: 512916730180 +Node: Why must ‘self’ be used explicitly in method definitions and calls?16730783 +Ref: faq/design why-must-self-be-used-explicitly-in-method-definitions-and-calls16731013 +Ref: 512a16731013 +Ref: faq/design why-self16731013 +Ref: 511016731013 +Node: Why can’t I use an assignment in an expression?16733503 +Ref: faq/design id116733804 +Ref: 512b16733804 +Ref: faq/design why-can-t-i-use-an-assignment-in-an-expression16733804 +Ref: 1c5116733804 +Ref: Why can’t I use an assignment in an expression?-Footnote-116734176 +Node: Why does Python use methods for some functionality e g list index but functions for other e g len list ?16734218 +Ref: faq/design why-does-python-use-methods-for-some-functionality-e-g-list-index-but-functions-for-other-e-g-len-list16734510 +Ref: 512c16734510 +Node: Why is join a string method instead of a list or tuple method?16735848 +Ref: faq/design why-is-join-a-string-method-instead-of-a-list-or-tuple-method16736115 +Ref: 512d16736115 +Node: How fast are exceptions?16737926 +Ref: faq/design how-fast-are-exceptions16738144 +Ref: 512e16738144 +Node: Why isn’t there a switch or case statement in Python?16738982 +Ref: faq/design why-isn-t-there-a-switch-or-case-statement-in-python16739244 +Ref: 512f16739244 +Node: Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?16740735 +Ref: faq/design can-t-you-emulate-threads-in-the-interpreter-instead-of-relying-on-an-os-specific-thread-implementation16741023 +Ref: 513016741023 +Ref: Can’t you emulate threads in the interpreter instead of relying on an OS-specific thread implementation?-Footnote-116741670 +Node: Why can’t lambda expressions contain statements?16741726 +Ref: faq/design why-can-t-lambda-expressions-contain-statements16742023 +Ref: 513116742023 +Node: Can Python be compiled to machine code C or some other language?16742888 +Ref: faq/design can-python-be-compiled-to-machine-code-c-or-some-other-language16743109 +Ref: 513216743109 +Ref: Can Python be compiled to machine code C or some other language?-Footnote-116743497 +Ref: Can Python be compiled to machine code C or some other language?-Footnote-216743525 +Node: How does Python manage memory?16743553 +Ref: faq/design how-does-python-manage-memory16743795 +Ref: 513316743795 +Ref: How does Python manage memory?-Footnote-116745467 +Ref: How does Python manage memory?-Footnote-216745498 +Node: Why doesn’t CPython use a more traditional garbage collection scheme?16745523 +Ref: faq/design why-doesn-t-cpython-use-a-more-traditional-garbage-collection-scheme16745749 +Ref: 513416745749 +Node: Why isn’t all memory freed when CPython exits?16746700 +Ref: faq/design why-isn-t-all-memory-freed-when-cpython-exits16746945 +Ref: 513516746945 +Node: Why are there separate tuple and list data types?16747640 +Ref: faq/design why-are-there-separate-tuple-and-list-data-types16747851 +Ref: 513616747851 +Node: How are lists implemented in CPython?16749104 +Ref: faq/design how-are-lists-implemented-in-cpython16749311 +Ref: 513716749311 +Node: How are dictionaries implemented in CPython?16750052 +Ref: faq/design how-are-dictionaries-implemented-in-cpython16750248 +Ref: 513816750248 +Node: Why must dictionary keys be immutable?16751217 +Ref: faq/design why-must-dictionary-keys-be-immutable16751423 +Ref: 513916751423 +Node: Why doesn’t list sort return the sorted list?16755631 +Ref: faq/design why-doesn-t-list-sort-return-the-sorted-list16755852 +Ref: 513a16755852 +Node: How do you specify and enforce an interface spec in Python?16756696 +Ref: faq/design how-do-you-specify-and-enforce-an-interface-spec-in-python16756900 +Ref: 513b16756900 +Node: Why is there no goto?16759228 +Ref: faq/design why-is-there-no-goto16759440 +Ref: 513c16759440 +Node: Why can’t raw strings r-strings end with a backslash?16760583 +Ref: faq/design why-can-t-raw-strings-r-strings-end-with-a-backslash16760811 +Ref: 513d16760811 +Node: Why doesn’t Python have a “with” statement for attribute assignments?16761912 +Ref: faq/design why-doesn-t-python-have-a-with-statement-for-attribute-assignments16762169 +Ref: 513e16762169 +Node: Why don’t generators support the with statement?16764634 +Ref: faq/design why-don-t-generators-support-the-with-statement16764898 +Ref: 513f16764898 +Node: Why are colons required for the if/while/def/class statements?16765316 +Ref: faq/design why-are-colons-required-for-the-if-while-def-class-statements16765565 +Ref: 514016765565 +Node: Why does Python allow commas at the end of lists and tuples?16766310 +Ref: faq/design why-does-python-allow-commas-at-the-end-of-lists-and-tuples16766500 +Ref: 514116766500 +Node: Library and Extension FAQ16767601 +Ref: faq/library doc16767759 +Ref: 514216767759 +Ref: faq/library library-and-extension-faq16767759 +Ref: 514316767759 +Node: General Library Questions16768008 +Ref: faq/library general-library-questions16768116 +Ref: 514416768116 +Node: How do I find a module or application to perform task X?16768628 +Ref: faq/library how-do-i-find-a-module-or-application-to-perform-task-x16768811 +Ref: 514516768811 +Ref: How do I find a module or application to perform task X?-Footnote-116769398 +Ref: How do I find a module or application to perform task X?-Footnote-216769423 +Node: Where is the math py socket py regex py etc source file?16769454 +Ref: faq/library where-is-the-math-py-socket-py-regex-py-etc-source-file16769695 +Ref: 514616769695 +Node: How do I make a Python script executable on Unix?16770479 +Ref: faq/library how-do-i-make-a-python-script-executable-on-unix16770709 +Ref: 514716770709 +Node: Is there a curses/termcap package for Python?16772186 +Ref: faq/library is-there-a-curses-termcap-package-for-python16772409 +Ref: 514816772409 +Ref: Is there a curses/termcap package for Python?-Footnote-116773204 +Node: Is there an equivalent to C’s onexit in Python?16773264 +Ref: faq/library is-there-an-equivalent-to-c-s-onexit-in-python16773474 +Ref: 514916773474 +Node: Why don’t my signal handlers work?16773694 +Ref: faq/library why-don-t-my-signal-handlers-work16773850 +Ref: 514a16773850 +Node: Common tasks16774175 +Ref: faq/library common-tasks16774299 +Ref: 514b16774299 +Node: How do I test a Python program or component?16774497 +Ref: faq/library how-do-i-test-a-python-program-or-component16774646 +Ref: 514c16774646 +Node: How do I create documentation from doc strings?16776597 +Ref: faq/library how-do-i-create-documentation-from-doc-strings16776796 +Ref: 514d16776796 +Ref: How do I create documentation from doc strings?-Footnote-116777172 +Ref: How do I create documentation from doc strings?-Footnote-216777212 +Node: How do I get a single keypress at a time?16777247 +Ref: faq/library how-do-i-get-a-single-keypress-at-a-time16777393 +Ref: 514e16777393 +Node: Threads16777639 +Ref: faq/library threads16777757 +Ref: 514f16777757 +Node: How do I program using threads?16778085 +Ref: faq/library how-do-i-program-using-threads16778204 +Ref: 515016778204 +Node: None of my threads seem to run why?16778514 +Ref: faq/library none-of-my-threads-seem-to-run-why16778699 +Ref: 515116778699 +Node: How do I parcel out work among a bunch of worker threads?16780248 +Ref: faq/library how-do-i-parcel-out-work-among-a-bunch-of-worker-threads16780454 +Ref: 515216780454 +Node: What kinds of global value mutation are thread-safe?16783054 +Ref: faq/library what-kinds-of-global-value-mutation-are-thread-safe16783275 +Ref: 515316783275 +Node: Can’t we get rid of the Global Interpreter Lock?16784782 +Ref: faq/library can-t-we-get-rid-of-the-global-interpreter-lock16784937 +Ref: 515416784937 +Ref: Can’t we get rid of the Global Interpreter Lock?-Footnote-116787952 +Ref: Can’t we get rid of the Global Interpreter Lock?-Footnote-216787994 +Ref: Can’t we get rid of the Global Interpreter Lock?-Footnote-316788037 +Node: Input and Output<2>16788097 +Ref: faq/library input-and-output16788231 +Ref: 515516788231 +Node: How do I delete a file? And other file questions…16788866 +Ref: faq/library how-do-i-delete-a-file-and-other-file-questions16789003 +Ref: 515616789003 +Node: How do I copy a file?16790254 +Ref: faq/library how-do-i-copy-a-file16790435 +Ref: 515716790435 +Ref: How do I copy a file?-Footnote-116790910 +Ref: How do I copy a file?-Footnote-216790981 +Node: How do I read or write binary data?16791033 +Ref: faq/library how-do-i-read-or-write-binary-data16791231 +Ref: 515816791231 +Node: I can’t seem to use os read on a pipe created with os popen ; why?16792428 +Ref: faq/library i-can-t-seem-to-use-os-read-on-a-pipe-created-with-os-popen-why16792643 +Ref: 515916792643 +Node: How do I access the serial RS232 port?16793164 +Ref: faq/library how-do-i-access-the-serial-rs232-port16793406 +Ref: 515a16793406 +Ref: How do I access the serial RS232 port?-Footnote-116793731 +Node: Why doesn’t closing sys stdout stdin stderr really close it?16793774 +Ref: faq/library why-doesn-t-closing-sys-stdout-stdin-stderr-really-close-it16793939 +Ref: 515b16793939 +Node: Network/Internet Programming16795167 +Ref: faq/library network-internet-programming16795303 +Ref: 515c16795303 +Node: What WWW tools are there for Python?16795655 +Ref: faq/library what-www-tools-are-there-for-python16795819 +Ref: 515d16795819 +Node: What module should I use to help with generating HTML?16796262 +Ref: faq/library what-module-should-i-use-to-help-with-generating-html16796475 +Ref: 515e16796475 +Ref: What module should I use to help with generating HTML?-Footnote-116796720 +Node: How do I send mail from a Python script?16796772 +Ref: faq/library how-do-i-send-mail-from-a-python-script16797007 +Ref: 515f16797007 +Node: How do I avoid blocking in the connect method of a socket?16798348 +Ref: faq/library how-do-i-avoid-blocking-in-the-connect-method-of-a-socket16798520 +Ref: 516016798520 +Ref: How do I avoid blocking in the connect method of a socket?-Footnote-116799859 +Node: Databases16799888 +Ref: faq/library databases16800029 +Ref: 516116800029 +Node: Are there any interfaces to database packages in Python?16800190 +Ref: faq/library are-there-any-interfaces-to-database-packages-in-python16800351 +Ref: 516216800351 +Ref: Are there any interfaces to database packages in Python?-Footnote-116800857 +Node: How do you implement persistent objects in Python?16800914 +Ref: faq/library how-do-you-implement-persistent-objects-in-python16801075 +Ref: 516316801075 +Node: Mathematics and Numerics16801476 +Ref: faq/library mathematics-and-numerics16801580 +Ref: 516416801580 +Node: How do I generate random numbers in Python?16801703 +Ref: faq/library how-do-i-generate-random-numbers-in-python16801807 +Ref: 516516801807 +Node: Extending/Embedding FAQ16802760 +Ref: faq/extending doc16802917 +Ref: 516616802917 +Ref: faq/extending extending-embedding-faq16802917 +Ref: 516716802917 +Node: Can I create my own functions in C?16804405 +Ref: faq/extending can-i-create-my-own-functions-in-c16804546 +Ref: 516816804546 +Node: Can I create my own functions in C++?16804906 +Ref: faq/extending id116805102 +Ref: 516916805102 +Node: Writing C is hard; are there any alternatives?16805489 +Ref: faq/extending c-wrapper-software16805703 +Ref: 516a16805703 +Ref: faq/extending writing-c-is-hard-are-there-any-alternatives16805703 +Ref: 516b16805703 +Node: How can I execute arbitrary Python statements from C?16806065 +Ref: faq/extending how-can-i-execute-arbitrary-python-statements-from-c16806299 +Ref: 516c16806299 +Node: How can I evaluate an arbitrary Python expression from C?16806845 +Ref: faq/extending how-can-i-evaluate-an-arbitrary-python-expression-from-c16807080 +Ref: 516d16807080 +Node: How do I extract C values from a Python object?16807396 +Ref: faq/extending how-do-i-extract-c-values-from-a-python-object16807643 +Ref: 516e16807643 +Node: How do I use Py_BuildValue to create a tuple of arbitrary length?16808889 +Ref: faq/extending how-do-i-use-py-buildvalue-to-create-a-tuple-of-arbitrary-length16809121 +Ref: 516f16809121 +Node: How do I call an object’s method from C?16809328 +Ref: faq/extending how-do-i-call-an-object-s-method-from-c16809598 +Ref: 517016809598 +Node: How do I catch the output from PyErr_Print or anything that prints to stdout/stderr ?16810822 +Ref: faq/extending how-do-i-catch-the-output-from-pyerr-print-or-anything-that-prints-to-stdout-stderr16811077 +Ref: 517116811077 +Node: How do I access a module written in Python from C?16812290 +Ref: faq/extending how-do-i-access-a-module-written-in-python-from-c16812549 +Ref: 517216812549 +Node: How do I interface to C++ objects from Python?16813383 +Ref: faq/extending how-do-i-interface-to-c-objects-from-python16813619 +Ref: 517316813619 +Node: I added a module using the Setup file and the make fails; why?16814191 +Ref: faq/extending i-added-a-module-using-the-setup-file-and-the-make-fails-why16814405 +Ref: 517416814405 +Node: How do I debug an extension?16814755 +Ref: faq/extending how-do-i-debug-an-extension16815007 +Ref: 517516815007 +Node: I want to compile a Python module on my Linux system but some files are missing Why?16815558 +Ref: faq/extending i-want-to-compile-a-python-module-on-my-linux-system-but-some-files-are-missing-why16815810 +Ref: 517616815810 +Node: How do I tell “incomplete input” from “invalid input”?16816217 +Ref: faq/extending how-do-i-tell-incomplete-input-from-invalid-input16816509 +Ref: 517716816509 +Node: How do I find undefined g++ symbols __builtin_new or __pure_virtual?16817478 +Ref: faq/extending how-do-i-find-undefined-g-symbols-builtin-new-or-pure-virtual16817796 +Ref: 517816817796 +Node: Can I create an object class with some methods implemented in C and others in Python e g through inheritance ?16818184 +Ref: faq/extending can-i-create-an-object-class-with-some-methods-implemented-in-c-and-others-in-python-e-g-through-inheritance16818431 +Ref: 517916818431 +Node: Python on Windows FAQ16818985 +Ref: faq/windows doc16819143 +Ref: 517a16819143 +Ref: faq/windows python-on-windows-faq16819143 +Ref: 517b16819143 +Ref: faq/windows windows-faq16819143 +Ref: 517c16819143 +Node: How do I run a Python program under Windows?16819799 +Ref: faq/windows faq-run-program-under-windows16819950 +Ref: 517d16819950 +Ref: faq/windows how-do-i-run-a-python-program-under-windows16819950 +Ref: 517e16819950 +Node: How do I make Python scripts executable?16823518 +Ref: faq/windows how-do-i-make-python-scripts-executable16823726 +Ref: 517f16823726 +Node: Why does Python sometimes take so long to start?16824288 +Ref: faq/windows why-does-python-sometimes-take-so-long-to-start16824501 +Ref: 518016824501 +Node: How do I make an executable from a Python script?16825380 +Ref: faq/windows how-do-i-make-an-executable-from-a-python-script16825587 +Ref: 518116825587 +Node: Is a * pyd file the same as a DLL?16825838 +Ref: faq/windows is-a-pyd-file-the-same-as-a-dll16826047 +Ref: 518216826047 +Node: How can I embed Python into a Windows application?16827044 +Ref: faq/windows how-can-i-embed-python-into-a-windows-application16827268 +Ref: 518316827268 +Node: How do I keep editors from inserting tabs into my Python source?16831727 +Ref: faq/windows how-do-i-keep-editors-from-inserting-tabs-into-my-python-source16831964 +Ref: 518416831964 +Ref: How do I keep editors from inserting tabs into my Python source?-Footnote-116832840 +Node: How do I check for a keypress without blocking?16832882 +Ref: faq/windows how-do-i-check-for-a-keypress-without-blocking16833136 +Ref: 518516833136 +Node: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?16833485 +Ref: faq/windows how-do-i-solve-the-missing-api-ms-win-crt-runtime-l1-1-0-dll-error16833666 +Ref: 518616833666 +Ref: How do I solve the missing api-ms-win-crt-runtime-l1-1-0 dll error?-Footnote-116834172 +Node: Graphic User Interface FAQ16834230 +Ref: faq/gui doc16834414 +Ref: 518716834414 +Ref: faq/gui graphic-user-interface-faq16834414 +Ref: 518816834414 +Node: General GUI Questions16834577 +Ref: faq/gui general-gui-questions16834705 +Ref: 518916834705 +Node: What GUI toolkits exist for Python?16834764 +Ref: faq/gui what-gui-toolkits-exist-for-python16834918 +Ref: 518a16834918 +Ref: What GUI toolkits exist for Python?-Footnote-116835625 +Ref: What GUI toolkits exist for Python?-Footnote-216835667 +Ref: What GUI toolkits exist for Python?-Footnote-316835694 +Ref: What GUI toolkits exist for Python?-Footnote-416835773 +Node: Tkinter questions16835855 +Ref: faq/gui tkinter-questions16835979 +Ref: 518b16835979 +Node: How do I freeze Tkinter applications?16836245 +Ref: faq/gui how-do-i-freeze-tkinter-applications16836396 +Ref: 518c16836396 +Node: Can I have Tk events handled while waiting for I/O?16836981 +Ref: faq/gui can-i-have-tk-events-handled-while-waiting-for-i-o16837191 +Ref: 518d16837191 +Node: I can’t get key bindings to work in Tkinter why?16837666 +Ref: faq/gui i-can-t-get-key-bindings-to-work-in-tkinter-why16837830 +Ref: 518e16837830 +Node: “Why is Python Installed on my Computer?” FAQ16838395 +Ref: faq/installed doc16838549 +Ref: 518f16838549 +Ref: faq/installed why-is-python-installed-on-my-computer-faq16838549 +Ref: 519016838549 +Node: What is Python?<2>16838773 +Ref: faq/installed what-is-python16838924 +Ref: 519116838924 +Ref: What is Python?<2>-Footnote-116839403 +Node: Why is Python installed on my machine?16839455 +Ref: faq/installed why-is-python-installed-on-my-machine16839635 +Ref: 519216839635 +Node: Can I delete Python?16840720 +Ref: faq/installed can-i-delete-python16840873 +Ref: 519316840873 +Node: Deprecations16841601 +Ref: deprecations/index doc16841712 +Ref: 519416841712 +Ref: deprecations/index deprecations16841712 +Ref: 519516841712 +Node: Pending Removal in Python 3 14<5>16842062 +Ref: deprecations/index pending-removal-in-python-3-1416842186 +Ref: 519616842186 +Ref: Pending Removal in Python 3 14<5>-Footnote-116846872 +Ref: Pending Removal in Python 3 14<5>-Footnote-216846927 +Ref: Pending Removal in Python 3 14<5>-Footnote-316846982 +Ref: Pending Removal in Python 3 14<5>-Footnote-416847037 +Ref: Pending Removal in Python 3 14<5>-Footnote-516847092 +Ref: Pending Removal in Python 3 14<5>-Footnote-616847148 +Ref: Pending Removal in Python 3 14<5>-Footnote-716847203 +Ref: Pending Removal in Python 3 14<5>-Footnote-816847258 +Ref: Pending Removal in Python 3 14<5>-Footnote-916847313 +Ref: Pending Removal in Python 3 14<5>-Footnote-1016847369 +Ref: Pending Removal in Python 3 14<5>-Footnote-1116847425 +Ref: Pending Removal in Python 3 14<5>-Footnote-1216847481 +Node: Pending Removal in Python 3 15<5>16847537 +Ref: deprecations/index pending-removal-in-python-3-1516847703 +Ref: 519716847703 +Ref: Pending Removal in Python 3 15<5>-Footnote-116852025 +Ref: Pending Removal in Python 3 15<5>-Footnote-216852080 +Ref: Pending Removal in Python 3 15<5>-Footnote-316852135 +Ref: Pending Removal in Python 3 15<5>-Footnote-416852190 +Ref: Pending Removal in Python 3 15<5>-Footnote-516852246 +Ref: Pending Removal in Python 3 15<5>-Footnote-616852288 +Node: Pending removal in Python 3 16<5>16852344 +Ref: deprecations/index pending-removal-in-python-3-1616852514 +Ref: 519816852514 +Ref: Pending removal in Python 3 16<5>-Footnote-116854693 +Node: Pending Removal in Future Versions<5>16854749 +Ref: deprecations/index pending-removal-in-future-versions16854904 +Ref: 519916854904 +Ref: Pending Removal in Future Versions<5>-Footnote-116861741 +Ref: Pending Removal in Future Versions<5>-Footnote-216861796 +Ref: Pending Removal in Future Versions<5>-Footnote-316861852 +Ref: Pending Removal in Future Versions<5>-Footnote-416861908 +Ref: Pending Removal in Future Versions<5>-Footnote-516861963 +Node: C API Deprecations16862018 +Ref: deprecations/index c-api-deprecations16862131 +Ref: 519a16862131 +Node: Pending Removal in Python 3 14<6>16862405 +Ref: deprecations/index id116862535 +Ref: 519b16862535 +Ref: Pending Removal in Python 3 14<6>-Footnote-116865758 +Ref: Pending Removal in Python 3 14<6>-Footnote-216865800 +Ref: Pending Removal in Python 3 14<6>-Footnote-316865856 +Node: Pending Removal in Python 3 15<6>16865911 +Ref: deprecations/index id216866087 +Ref: 519c16866087 +Node: Pending Removal in Future Versions<6>16867336 +Ref: deprecations/index id316867470 +Ref: 519d16867470 +Node: Glossary16869707 +Ref: glossary doc16869809 +Ref: 519e16869809 +Ref: glossary glossary16869809 +Ref: 1bdc16869809 +Ref: glossary id116869809 +Ref: 519f16869809 +Ref: glossary term-016869834 +Ref: 16c16869834 +Ref: glossary term-16870008 +Ref: 16d16870008 +Ref: glossary term-abstract-base-class16870414 +Ref: 11a816870414 +Ref: glossary term-annotation16871250 +Ref: 45316871250 +Ref: glossary term-argument16871928 +Ref: 44416871928 +Ref: glossary term-asynchronous-context-manager16873362 +Ref: 5d316873362 +Ref: glossary term-asynchronous-generator16873596 +Ref: 203e16873596 +Ref: glossary term-asynchronous-generator-iterator16874321 +Ref: 439616874321 +Ref: glossary term-asynchronous-iterable16875062 +Ref: d7716875062 +Ref: glossary term-asynchronous-iterator16875285 +Ref: 1ab16875285 +Ref: glossary term-attribute16875710 +Ref: 24a316875710 +Ref: glossary term-awaitable16876275 +Ref: 1ad16876275 +Ref: glossary term-BDFL16876473 +Ref: 51a116876473 +Ref: glossary term-binary-file16876570 +Ref: 1c8716876570 +Ref: glossary term-borrowed-reference16877027 +Ref: 33916877027 +Ref: glossary term-bytes-like-object16877735 +Ref: d2d16877735 +Ref: glossary term-bytecode16878719 +Ref: 18716878719 +Ref: glossary term-callable16879448 +Ref: 28f716879448 +Ref: glossary term-callback16879842 +Ref: 291a16879842 +Ref: glossary term-class16879960 +Ref: 193216879960 +Ref: glossary term-class-variable16880125 +Ref: 51a216880125 +Ref: glossary term-closure-variable16880271 +Ref: 1f3f16880271 +Ref: glossary term-complex-number16881366 +Ref: 51a316881366 +Ref: glossary term-context16882136 +Ref: 15b116882136 +Ref: glossary term-context-management-protocol16882728 +Ref: 15b316882728 +Ref: glossary term-context-manager16882891 +Ref: 5d016882891 +Ref: glossary term-context-variable16883081 +Ref: 51a416883081 +Ref: glossary term-contiguous16883373 +Ref: 222716883373 +Ref: glossary term-coroutine16883916 +Ref: 48d16883916 +Ref: glossary term-coroutine-function16884239 +Ref: d7616884239 +Ref: glossary term-CPython16884553 +Ref: 6f116884553 +Ref: glossary term-current-context16884806 +Ref: 15b216884806 +Ref: glossary term-decorator16885279 +Ref: 72c16885279 +Ref: glossary term-descriptor16885993 +Ref: 157216885993 +Ref: glossary term-dictionary16886841 +Ref: 1f8b16886841 +Ref: glossary term-dictionary-comprehension16887047 +Ref: 51a516887047 +Ref: glossary term-dictionary-view16887392 +Ref: 252616887392 +Ref: glossary term-docstring16887838 +Ref: 212916887838 +Ref: glossary term-duck-typing16888235 +Ref: 51a016888235 +Ref: glossary term-dunder16888940 +Ref: 51a616888940 +Ref: glossary term-EAFP16889138 +Ref: 2b8516889138 +Ref: glossary term-expression16889584 +Ref: 1f8516889584 +Ref: glossary term-extension-module16890098 +Ref: 45ac16890098 +Ref: glossary term-f-string16890226 +Ref: 43116890226 +Ref: glossary term-file-object16890421 +Ref: 11b516890421 +Ref: glossary term-file-like-object16891198 +Ref: 258f16891198 +Ref: glossary term-filesystem-encoding-and-error-handler16891261 +Ref: 53716891261 +Ref: glossary term-finder16892132 +Ref: 1f1e16892132 +Ref: glossary term-floor-division16892530 +Ref: 94416892530 +Ref: glossary term-free-threading16892906 +Ref: 152216892906 +Ref: glossary term-free-variable16893201 +Ref: 1fda16893201 +Ref: glossary term-function16893630 +Ref: 205916893630 +Ref: glossary term-function-annotation16893937 +Ref: 1c3716893937 +Ref: glossary term-__future__16894636 +Ref: dac16894636 +Ref: glossary term-garbage-collection16895269 +Ref: 191916895269 +Ref: glossary term-generator16895589 +Ref: 105a16895589 +Ref: glossary term-generator-iterator16896105 +Ref: bde16896105 +Ref: glossary term-generator-expression16896495 +Ref: 51a816896495 +Ref: glossary term-generic-function16896900 +Ref: 9f016896900 +Ref: glossary term-generic-type16897259 +Ref: 43416897259 +Ref: glossary term-GIL16897622 +Ref: 15916897622 +Ref: glossary term-global-interpreter-lock16897673 +Ref: 14816897673 +Ref: glossary term-hash-based-pyc16898924 +Ref: 51a916898924 +Ref: glossary term-hashable16899138 +Ref: 60c16899138 +Ref: glossary term-IDLE16900054 +Ref: 51aa16900054 +Ref: glossary term-immortal16900290 +Ref: 439416900290 +Ref: glossary term-immutable16900641 +Ref: 1bfb16900641 +Ref: glossary term-import-path16900985 +Ref: 1ff616900985 +Ref: glossary term-importing16901324 +Ref: 1fe916901324 +Ref: glossary term-importer16901445 +Ref: 1ff516901445 +Ref: glossary term-interactive16901571 +Ref: 16916901571 +Ref: glossary term-interpreted16902062 +Ref: 51ab16902062 +Ref: glossary term-interpreter-shutdown16902554 +Ref: 14e16902554 +Ref: glossary term-iterable16903289 +Ref: 121a16903289 +Ref: glossary term-iterator16904493 +Ref: 1ac16904493 +Ref: glossary term-key-function16905986 +Ref: e0416905986 +Ref: glossary term-keyword-argument16907149 +Ref: d1216907149 +Ref: glossary term-lambda16907198 +Ref: 274316907198 +Ref: glossary term-LBYL16907431 +Ref: 51a716907431 +Ref: glossary term-lexical-analyzer16908098 +Ref: 51ac16908098 +Ref: glossary term-list16908178 +Ref: 51ad16908178 +Ref: glossary term-list-comprehension16908362 +Ref: 6c916908362 +Ref: glossary term-loader16908780 +Ref: 16b016908780 +Ref: glossary term-locale-encoding16909140 +Ref: 24416909140 +Ref: glossary term-magic-method16909600 +Ref: 410116909600 +Ref: glossary term-mapping16909672 +Ref: 11ae16909672 +Ref: glossary term-meta-path-finder16910078 +Ref: 106916910078 +Ref: glossary term-metaclass16910376 +Ref: 1f8616910376 +Ref: glossary term-method16911116 +Ref: 155216911116 +Ref: glossary term-method-resolution-order16911425 +Ref: 218016911425 +Ref: glossary term-module16911711 +Ref: 165f16911711 +Ref: glossary term-module-spec16911974 +Ref: 1f1616911974 +Ref: glossary term-MRO16912181 +Ref: 360b16912181 +Ref: glossary term-mutable16912233 +Ref: 1c0016912233 +Ref: glossary term-named-tuple16912358 +Ref: 64a16912358 +Ref: glossary term-namespace16913578 +Ref: 1c5716913578 +Ref: glossary term-namespace-package16914334 +Ref: 1c6816914334 +Ref: glossary term-nested-scope16914914 +Ref: 1f3e16914914 +Ref: glossary term-new-style-class16915403 +Ref: 289016915403 +Ref: glossary term-object16915730 +Ref: 51ae16915730 +Ref: glossary term-optimized-scope16915894 +Ref: 17e16915894 +Ref: glossary term-package16916425 +Ref: 1f1a16916425 +Ref: glossary term-parameter16916697 +Ref: 1eff16916697 +Ref: glossary positional-only-parameter16917237 +Ref: a8516917237 +Ref: glossary keyword-only-parameter16917637 +Ref: 2a716917637 +Ref: glossary term-path-entry16919148 +Ref: 200416919148 +Ref: glossary term-path-entry-finder16919302 +Ref: 106a16919302 +Ref: glossary term-path-entry-hook16919626 +Ref: 200616919626 +Ref: glossary term-path-based-finder16919827 +Ref: 1ff916919827 +Ref: glossary term-path-like-object16919963 +Ref: 2a216919963 +Ref: glossary term-PEP16920596 +Ref: 51af16920596 +Ref: glossary term-portion16921250 +Ref: 1ff016921250 +Ref: glossary term-positional-argument16921411 +Ref: d1316921411 +Ref: glossary term-provisional-API16921463 +Ref: b0316921463 +Ref: glossary term-provisional-package16922467 +Ref: 103a16922467 +Ref: glossary term-Python-300016922526 +Ref: 51b016922526 +Ref: glossary term-Pythonic16922719 +Ref: 51b116922719 +Ref: glossary term-qualified-name16923359 +Ref: 194116923359 +Ref: glossary term-reference-count16924204 +Ref: 48e216924204 +Ref: glossary term-regular-package16925001 +Ref: 1fed16925001 +Ref: glossary term-REPL16925168 +Ref: 16a16925168 +Ref: glossary term-__slots__16925300 +Ref: 5db16925300 +Ref: glossary term-sequence16925646 +Ref: 4ed16925646 +Ref: glossary term-set-comprehension16926762 +Ref: 51b216926762 +Ref: glossary term-single-dispatch16927078 +Ref: 9f116927078 +Ref: glossary term-slice16927229 +Ref: 217d16927229 +Ref: glossary term-soft-deprecated16927554 +Ref: 20b16927554 +Ref: glossary term-special-method16927926 +Ref: 18ab16927926 +Ref: glossary term-standard-library16928206 +Ref: 51b316928206 +Ref: glossary term-statement16928717 +Ref: 278b16928717 +Ref: glossary term-static-type-checker16928961 +Ref: 26f16928961 +Ref: glossary term-stdlib16929168 +Ref: 51b416929168 +Ref: glossary term-strong-reference16929231 +Ref: 33816929231 +Ref: glossary term-text-encoding16929889 +Ref: 217a16929889 +Ref: glossary term-text-file16930413 +Ref: 1c8616930413 +Ref: glossary term-token16930936 +Ref: 1e7d16930936 +Ref: glossary term-triple-quoted-string16931316 +Ref: 51b516931316 +Ref: glossary term-type16931816 +Ref: 193316931816 +Ref: glossary term-type-alias16932050 +Ref: 43516932050 +Ref: glossary term-type-hint16932631 +Ref: 1f8116932631 +Ref: glossary term-universal-newlines16933232 +Ref: d3a16933232 +Ref: glossary term-variable-annotation16933606 +Ref: d5516933606 +Ref: glossary term-virtual-environment16934333 +Ref: 1d0116934333 +Ref: glossary term-virtual-machine16934642 +Ref: 350216934642 +Ref: glossary term-walrus-operator16934808 +Ref: 51b616934808 +Ref: glossary term-Zen-of-Python16934989 +Ref: 51b716934989 +Ref: Glossary-Footnote-116935256 +Ref: Glossary-Footnote-216935298 +Ref: Glossary-Footnote-316935340 +Ref: Glossary-Footnote-416935382 +Ref: Glossary-Footnote-516935424 +Ref: Glossary-Footnote-616935466 +Ref: Glossary-Footnote-716935508 +Ref: Glossary-Footnote-816935550 +Ref: Glossary-Footnote-916935592 +Ref: Glossary-Footnote-1016935634 +Ref: Glossary-Footnote-1116935673 +Ref: Glossary-Footnote-1216935716 +Ref: Glossary-Footnote-1316935759 +Ref: Glossary-Footnote-1416935802 +Ref: Glossary-Footnote-1516935845 +Ref: Glossary-Footnote-1616935877 +Ref: Glossary-Footnote-1716935920 +Ref: Glossary-Footnote-1816935963 +Ref: Glossary-Footnote-1916936006 +Ref: Glossary-Footnote-2016936049 +Ref: Glossary-Footnote-2116936092 +Ref: Glossary-Footnote-2216936135 +Ref: Glossary-Footnote-2316936178 +Ref: Glossary-Footnote-2416936221 +Ref: Glossary-Footnote-2516936264 +Ref: Glossary-Footnote-2616936307 +Ref: Glossary-Footnote-2716936350 +Ref: Glossary-Footnote-2816936393 +Ref: Glossary-Footnote-2916936436 +Ref: Glossary-Footnote-3016936479 +Ref: Glossary-Footnote-3116936522 +Ref: Glossary-Footnote-3216936565 +Ref: Glossary-Footnote-3316936608 +Ref: Glossary-Footnote-3416936651 +Ref: Glossary-Footnote-3516936711 +Ref: Glossary-Footnote-3616936754 +Ref: Glossary-Footnote-3716936797 +Ref: Glossary-Footnote-3816936840 +Ref: Glossary-Footnote-3916936883 +Ref: Glossary-Footnote-4016936926 +Node: About this documentation16936969 +Ref: about doc16937076 +Ref: 51b816937076 +Ref: about about-this-documentation16937076 +Ref: 51b916937076 +Ref: About this documentation-Footnote-116938025 +Ref: About this documentation-Footnote-216938074 +Ref: About this documentation-Footnote-316938110 +Node: Contributors to the Python documentation16938151 +Ref: about contributors-to-the-python-documentation16938252 +Ref: 51ba16938252 +Ref: Contributors to the Python documentation-Footnote-116938711 +Node: Dealing with Bugs16938773 +Ref: bugs doc16938881 +Ref: 51bb16938881 +Ref: bugs dealing-with-bugs16938881 +Ref: 51bc16938881 +Ref: bugs reporting-bugs16938881 +Ref: 493116938881 +Node: Documentation bugs16939424 +Ref: bugs documentation-bugs16939535 +Ref: 51be16939535 +Ref: Documentation bugs-Footnote-116940829 +Ref: Documentation bugs-Footnote-216940883 +Ref: Documentation bugs-Footnote-316940935 +Ref: Documentation bugs-Footnote-416941021 +Ref: Documentation bugs-Footnote-516941066 +Ref: Documentation bugs-Footnote-616941142 +Node: Using the Python issue tracker16941205 +Ref: bugs using-the-python-issue-tracker16941372 +Ref: 51bf16941372 +Ref: bugs using-the-tracker16941372 +Ref: 25016941372 +Ref: Using the Python issue tracker-Footnote-116943604 +Ref: Using the Python issue tracker-Footnote-216943667 +Node: Getting started contributing to Python yourself16943733 +Ref: bugs contributing-to-python16943873 +Ref: 51bd16943873 +Ref: bugs getting-started-contributing-to-python-yourself16943873 +Ref: 51c016943873 +Ref: Getting started contributing to Python yourself-Footnote-116944390 +Ref: Getting started contributing to Python yourself-Footnote-216944427 +Node: Copyright16944503 +Ref: copyright doc16944606 +Ref: 51c116944606 +Ref: copyright copyright16944606 +Ref: 51c216944606 +Node: History and License16945121 +Ref: license doc16945226 +Ref: 51c416945226 +Ref: license history-and-license16945226 +Ref: 51c316945226 +Ref: license id116945226 +Ref: 51c516945226 +Node: History of the software16945436 +Ref: license history-of-the-software16945584 +Ref: 51c616945584 +Node: Terms and conditions for accessing or otherwise using Python16950418 +Ref: license terms-and-conditions-for-accessing-or-otherwise-using-python16950630 +Ref: 51c716950630 +Node: PYTHON SOFTWARE FOUNDATION LICENSE VERSION 216951700 +Ref: license psf-license16951893 +Ref: 51ca16951893 +Ref: license python-software-foundation-license-version-216951893 +Ref: 51cb16951893 +Node: BEOPEN COM LICENSE AGREEMENT FOR PYTHON 2 016954515 +Ref: license beopen-com-license-agreement-for-python-2-016954756 +Ref: 51cc16954756 +Node: CNRI LICENSE AGREEMENT FOR PYTHON 1 6 116957464 +Ref: license cnri-license-agreement-for-python-1-6-116957711 +Ref: 51cd16957711 +Node: CWI LICENSE AGREEMENT FOR PYTHON 0 9 0 THROUGH 1 216961889 +Ref: license cwi-license-agreement-for-python-0-9-0-through-1-216962153 +Ref: 51ce16962153 +Node: ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION16963423 +Ref: license bsd016963639 +Ref: 51c816963639 +Ref: license zero-clause-bsd-license-for-code-in-the-python-documentation16963639 +Ref: 51cf16963639 +Node: Licenses and Acknowledgements for Incorporated Software16964429 +Ref: license licenses-and-acknowledgements-for-incorporated-software16964609 +Ref: 51d016964609 +Ref: license otherlicenses16964609 +Ref: 51c916964609 +Node: Mersenne Twister16965360 +Ref: license mersenne-twister16965487 +Ref: 51d116965487 +Node: Sockets<2>16967806 +Ref: license sockets16967970 +Ref: 51d216967970 +Node: Asynchronous socket services16969803 +Ref: license asynchronous-socket-services16969968 +Ref: 51d316969968 +Node: Cookie management16971206 +Ref: license cookie-management16971378 +Ref: 51d416971378 +Node: Execution tracing16972595 +Ref: license execution-tracing16972770 +Ref: 51d516972770 +Node: UUencode and UUdecode functions16974029 +Ref: license uuencode-and-uudecode-functions16974213 +Ref: 51d616974213 +Node: XML Remote Procedure Calls16975788 +Ref: license xml-remote-procedure-calls16975965 +Ref: 51d716975965 +Node: test_epoll16977490 +Ref: license test-epoll16977649 +Ref: 51d816977649 +Node: Select kqueue16978914 +Ref: license select-kqueue16979056 +Ref: 51d916979056 +Node: SipHash2416980608 +Ref: license siphash2416980755 +Ref: 51da16980755 +Node: strtod and dtoa16981938 +Ref: license strtod-and-dtoa16982082 +Ref: 51db16982082 +Node: OpenSSL<2>16983479 +Ref: license openssl16983619 +Ref: 51dc16983619 +Node: expat16994537 +Ref: license expat16994668 +Ref: 51dd16994668 +Node: libffi16996074 +Ref: license libffi16996202 +Ref: 51de16996202 +Node: zlib<3>16997583 +Ref: license zlib16997713 +Ref: 51df16997713 +Node: cfuhash16998946 +Ref: license cfuhash16999078 +Ref: 51e016999078 +Node: libmpdec17000894 +Ref: license libmpdec17001038 +Ref: 51e117001038 +Node: W3C C14N test suite17002648 +Ref: license w3c-c14n-test-suite17002793 +Ref: 51e217002793 +Node: mimalloc17004695 +Ref: license mimalloc17004843 +Ref: 51e317004843 +Ref: license mimalloc-license17004843 +Ref: 40d17004843 +Node: asyncio<12>17006056 +Ref: license asyncio17006215 +Ref: 51e417006215 +Ref: asyncio<12>-Footnote-117007572 +Node: Global Unbounded Sequences GUS17007630 +Ref: license global-unbounded-sequences-gus17007772 +Ref: 51e517007772 +Ref: Global Unbounded Sequences GUS-Footnote-117009454 +Node: Python Module Index17009532 +Node: Index17028763 +Ref: library/_thread start_new_thread19086544 +Ref: 41e619086545 +Ref: 41f119086547 +Ref: 41e919086549 +Ref: 41e719086551 +Ref: 41e319086553 +Ref: using/cmdline audit_event_cpython_run_stdin_119086555 +Ref: using/cmdline audit_event_cpython_run_stdin_019086557 +Ref: 41e819086559 +Ref: library/asyncio audit_event_cpython_run_stdin_019086561 +Ref: library/time audit_event_time_sleep_019086563 +Ref: using/cmdline audit_event_cpython_run_file_019086565 + +End Tag Table + + +Local Variables: +coding: utf-8 +End: -- cgit v1.2.3